renderstat.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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 smoothTriangleCount; /* Total number of smooth triangle */
  24. uint64_t objfileCount; /* Total number of OBJ File */
  25. uint64_t csgCount; /* Total number of CSG */
  26. uint64_t pixelCount; /* Total number of rendered pixels */
  27. uint64_t rayCount; /* Total number of rays object created */
  28. uint64_t rayCasted; /* Total number of rays actually casted */
  29. uint64_t lightRayEmitedCount; /* Total number of ray launched for light tests */
  30. uint64_t reflectionRayCount; /* Total number of reflection ray launched */
  31. uint64_t refractedRayCount; /* Total number of refracted ray launched */
  32. uint64_t intersectCount; /* Total number of intersect object created */
  33. uint64_t intersectionCount; /* Total number of intersection for all casted rays, including light and reflections */
  34. uint64_t reallocCallCount; /* Total number of time realloc being called */
  35. uint64_t mallocCallCount; /* Total number of time malloc/calloc being called */
  36. uint64_t discardedIntersectCount; /* Number of time a bounding box check said "no need to test me" */
  37. uint64_t maxDepthAttained; /* Report the lowest depth attained during ray recursion */
  38. uint64_t maxIntersectOnARay; /* Biggest intersect done */
  39. public:
  40. RenderStats() : coneCount(0), cylinderCount(0), cubeCount(0), groupCount(0), lightCount(0), planeCount(0), sphereCount(0), triangleCount(0),
  41. pixelCount(0), rayCount(0), lightRayEmitedCount(0), reflectionRayCount(0), refractedRayCount(0),
  42. intersectCount(0), intersectionCount(0), reallocCallCount(0), mallocCallCount(0), smoothTriangleCount(0),
  43. discardedIntersectCount(0), maxDepthAttained(UINT64_MAX), maxIntersectOnARay(0), objfileCount(0),
  44. csgCount(0), rayCasted(0) {};
  45. #ifdef RENDER_STATS
  46. void addCone();
  47. void addCylinder();
  48. void addCube();
  49. void addGroup();
  50. void addLight();
  51. void addPlane();
  52. void addSphere();
  53. void addCsg();
  54. void addOBJFile();
  55. void addTriangle();
  56. void addSmoothTriangle();
  57. void printStats();
  58. void addPixel();
  59. void addRay();
  60. void addCastedRay();
  61. void addLightRay();
  62. void addReflectRay();
  63. void addRefractRay();
  64. void addIntersection();
  65. void addDiscardedIntersect();
  66. void setMaxDepth(uint32_t depth);
  67. void addIntersect();
  68. void addMalloc();
  69. void addRealloc();
  70. void setMaxIntersect(uint32_t count);
  71. #else
  72. static void addCone() {};
  73. static void addCylinder() {};
  74. static void addCube() {};
  75. static void addGroup() {};
  76. static void addLight() {};
  77. static void addPlane() {};
  78. static void addSphere() {};
  79. static void addTriangle() {};
  80. static void addSmoothTriangle() {};
  81. static void printStats() {};
  82. static void addPixel() {};
  83. static void addRay() {};
  84. static void addCastedRay() {};
  85. static void addLightRay() {};
  86. static void addReflectRay() {};
  87. static void addRefractRay() {};
  88. static void addIntersection() {};
  89. static void addDiscardedIntersect() {};
  90. static void setMaxDepth(uint32_t depth) {};
  91. static void addIntersect() {};
  92. static void addMalloc() {};
  93. static void addRealloc() {};
  94. static void setMaxIntersect(uint32_t count) {};
  95. static void addOBJFile() {};
  96. static void addCsg() {};
  97. #endif
  98. };
  99. extern RenderStats stats;
  100. #endif /* DORAYME_RENDERSTAT_H */