renderstat.h 4.1 KB

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