renderstat.h 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * DoRayMe - a quick and dirty Raytracer
  3. * Render statistics header
  4. *
  5. * Created by Manoël Trapier
  6. * Copyright (c) 2020 986-Studio.
  7. *
  8. */
  9. #ifndef DORAYME_RENDERSTAT_H
  10. #define DORAYME_RENDERSTAT_H
  11. #include <stdint.h>
  12. class RenderStats
  13. {
  14. private:
  15. uint64_t coneCount; /* Total number of cones */
  16. uint64_t cylinderCount; /* Total number of cylinder */
  17. uint64_t cubeCount; /* Total number of cubes */
  18. uint64_t groupCount; /* Total number of groups */
  19. uint64_t lightCount; /* Total number of light */
  20. uint64_t planeCount; /* Total number of plane */
  21. uint64_t sphereCount; /* Total number of sphere */
  22. uint64_t triangleCount; /* Total number of triangle */
  23. uint64_t pixelCount; /* Total number of rendered pixels */
  24. uint64_t rayCount; /* Total number of rays */
  25. uint64_t lightRayEmitedCount; /* Total number of ray launched for light tests */
  26. uint64_t reflectionRayCount; /* Total number of reflection ray launched */
  27. uint64_t refractedRayCount; /* Total number of refracted ray launched */
  28. uint64_t intersectCount; /* Total number of intersect object created */
  29. uint64_t intersectionCount; /* Total number of intersection for all casted rays, including light and reflections */
  30. uint64_t reallocCallCount; /* Total number of time realloc being called */
  31. uint64_t mallocCallCount; /* Total number of time malloc/calloc being called */
  32. uint64_t discardedIntersectCount; /* Number of time a bounding box check said "no need to test me" */
  33. uint64_t maxDepthAttained; /* Report the lowest depth attained during ray recursion */
  34. uint64_t maxIntersectOnARay; /* Biggest intersect done */
  35. public:
  36. RenderStats() : coneCount(0), cylinderCount(0), cubeCount(0), groupCount(0), lightCount(0), planeCount(0), sphereCount(0), triangleCount(0),
  37. pixelCount(0), rayCount(0), lightRayEmitedCount(0), reflectionRayCount(0), refractedRayCount(0),
  38. intersectCount(0), intersectionCount(0), reallocCallCount(0), mallocCallCount(0),
  39. discardedIntersectCount(0), maxDepthAttained(UINT64_MAX), maxIntersectOnARay(0) {};
  40. #ifdef RENDER_STATS
  41. void addCone();
  42. void addCylinder();
  43. void addCube();
  44. void addGroup();
  45. void addLight();
  46. void addPlane();
  47. void addSphere();
  48. void addTriangle();
  49. void printStats();
  50. void addPixel();
  51. void addRay();
  52. void addLightRay();
  53. void addReflectRay();
  54. void addRefractRay();
  55. void addIntersection();
  56. void addDiscardedIntersect();
  57. void setMaxDepth(uint32_t depth);
  58. void addIntersect();
  59. void addMalloc();
  60. void addRealloc();
  61. void setMaxIntersect(uint32_t count);
  62. #else
  63. static void addCone() {};
  64. static void addCylinder() {};
  65. static void addCube() {};
  66. static void addGroup() {};
  67. static void addLight() {};
  68. static void addPlane() {};
  69. static void addSphere() {};
  70. static void addTriangle() {};
  71. static void printStats() {};
  72. static void addPixel() {};
  73. static void addRay() {};
  74. static void addLightRay() {};
  75. static void addReflectRay() {};
  76. static void addRefractRay() {};
  77. static void addIntersection() {};
  78. static void addDiscardedIntersect() {};
  79. static void setMaxDepth(uint32_t depth) {};
  80. static void addIntersect() {};
  81. static void addMalloc() {};
  82. static void addRealloc() {};
  83. static void setMaxIntersect(uint32_t count) {};
  84. #endif
  85. };
  86. extern RenderStats stats;
  87. #endif /* DORAYME_RENDERSTAT_H */