world.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * DoRayMe - a quick and dirty Raytracer
  3. * World header
  4. *
  5. * Created by Manoël Trapier
  6. * Copyright (c) 2020 986-Studio.
  7. *
  8. */
  9. #ifndef DORAYME_WORLD_H
  10. #define DORAYME_WORLD_H
  11. #include <stdint.h>
  12. #include <light.h>
  13. #include <shape.h>
  14. #include <intersect.h>
  15. #include <ray.h>
  16. #include <stdio.h>
  17. class World
  18. {
  19. public:
  20. uint32_t objectCount;
  21. uint32_t lightCount;
  22. private:
  23. uint32_t allocatedObjectCount;
  24. uint32_t allocatedLightCount;
  25. Light* *lightList;
  26. Shape* *objectList;
  27. public:
  28. World();
  29. ~World();
  30. void addObject(Shape *s);
  31. void addLight(Light *l);
  32. /* Some debug things */
  33. bool lightIsIn(Light &l);
  34. bool objectIsIn(Shape &s);
  35. Shape *getObject(int i) { return this->objectList[i]; };
  36. Light *getLight(int i) { return this->lightList[i]; };
  37. Tuple shadeHit(Computation comps, uint32_t depthCount = 4);
  38. Tuple colourAt(Ray r, uint32_t depthCount = 4);
  39. bool isShadowed(Tuple point, Tuple lightPosition);
  40. Colour reflectColour(Computation comps, uint32_t depthCount = 4);
  41. Colour refractedColour(Computation comps, uint32_t depthCount = 4);
  42. Intersect intersect(Ray r);
  43. void dumpMe(FILE *fp);
  44. };
  45. #endif /* DORAYME_WORLD_H */