123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- /*
- * DoRayMe - a quick and dirty Raytracer
- * Render statistics implementation
- *
- * Created by Manoël Trapier
- * Copyright (c) 2020 986-Studio.
- *
- */
- #include <renderstat.h>
- #include <stdio.h>
- RenderStats stats;
- #ifdef RENDER_STATS
- void RenderStats::addCone()
- {
- #pragma omp atomic
- this->coneCount++;
- };
- void RenderStats::addCylinder()
- {
- #pragma omp atomic
- this->cylinderCount++;
- };
- void RenderStats::addCube()
- {
- #pragma omp atomic
- this->cubeCount++;
- };
- void RenderStats::addGroup()
- {
- #pragma omp atomic
- this->groupCount++;
- };
- void RenderStats::addLight()
- {
- #pragma omp atomic
- this->lightCount++;
- };
- void RenderStats::addPlane()
- {
- #pragma omp atomic
- this->planeCount++;
- };
- void RenderStats::addSphere()
- {
- #pragma omp atomic
- this->sphereCount++;
- };
- void RenderStats::addTriangle()
- {
- #pragma omp atomic
- this->triangleCount++;
- };
- void RenderStats::addSmoothTriangle()
- {
- #pragma omp atomic
- this->smoothTriangleCount++;
- };
- void RenderStats::addOBJFile()
- {
- #pragma omp atomic
- this->objfileCount++;
- };
- void RenderStats::addPixel()
- {
- #pragma omp atomic
- this->pixelCount++;
- };
- void RenderStats::addRay()
- {
- #pragma omp atomic
- this->rayCount++;
- };
- void RenderStats::addLightRay()
- {
- #pragma omp atomic
- this->lightRayEmitedCount++;
- };
- void RenderStats::addReflectRay()
- {
- #pragma omp atomic
- this->reflectionRayCount++;
- };
- void RenderStats::addRefractRay()
- {
- #pragma omp atomic
- this->refractedRayCount++;
- };
- void RenderStats::addIntersect()
- {
- #pragma omp atomic
- this->intersectCount++;
- };
- void RenderStats::addIntersection()
- {
- #pragma omp atomic
- this->intersectionCount++;
- };
- void RenderStats::addMalloc()
- {
- #pragma omp atomic
- this->mallocCallCount++;
- };
- void RenderStats::addRealloc()
- {
- #pragma omp atomic
- this->reallocCallCount++;
- };
- void RenderStats::addDiscardedIntersect()
- {
- #pragma omp atomic
- this->discardedIntersectCount++;
- };
- void RenderStats::addCsg()
- {
- #pragma omp atomic
- this->csgCount++;
- };
- void RenderStats::setMaxDepth(uint32_t depth)
- {
- if (this->maxDepthAttained > depth)
- {
- this->maxDepthAttained = depth;
- }
- };
- void RenderStats::setMaxIntersect(uint32_t count)
- {
- if (this->maxIntersectOnARay < count)
- {
- this->maxIntersectOnARay = count;
- }
- };
- void RenderStats::printStats()
- {
- printf("Rendering statistics:\n");
- printf("Cones : %lld\n", this->coneCount);
- printf("Cubes : %lld\n", this->cubeCount);
- printf("Cylinders : %lld\n", this->cylinderCount);
- printf("Groups : %lld\n", this->groupCount);
- printf("Lights : %lld\n", this->lightCount);
- printf("Planes : %lld\n", this->planeCount);
- printf("Spheres : %lld\n", this->sphereCount);
- printf("Triangles : %lld\n", this->triangleCount);
- printf("Smooth Triangles : %lld\n", this->smoothTriangleCount);
- printf("OBJ File : %lld\n", this->objfileCount);
- printf("CSG : %lld\n", this->csgCount);
- printf("==================================================\n");
- printf("Pixel rendered : %lld\n", this->pixelCount);
- printf("Ray casted : %lld\n", this->rayCount);
- printf("Light Ray casted : %lld\n", this->lightRayEmitedCount);
- printf("Reflection ray casted : %lld\n", this->reflectionRayCount);
- printf("Refraction ray casted : %lld\n", this->refractedRayCount);
- printf("Intersect object created: %lld\n", this->intersectCount);
- printf("Intersection created : %lld\n", this->intersectionCount);
- printf("Malloc called : %lld\n", this->mallocCallCount);
- printf("Realloc called : %lld\n", this->reallocCallCount);
- printf("Bounding box missed : %lld\n", this->discardedIntersectCount);
- printf("Min depth atteined : %lld\n", this->maxDepthAttained);
- printf("Max intersect count : %lld\n", this->maxIntersectOnARay);
- printf("==================================================\n");
- };
- #endif
|