world.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. class World
  17. {
  18. public:
  19. uint32_t objectCount;
  20. uint32_t lightCount;
  21. private:
  22. uint32_t allocatedObjectCount;
  23. uint32_t allocatedLightCount;
  24. Light* *lightList;
  25. Shape* *objectList;
  26. public:
  27. World();
  28. ~World();
  29. void addObject(Shape *s);
  30. void addLight(Light *l);
  31. /* Some debug things */
  32. bool lightIsIn(Light &l);
  33. bool objectIsIn(Shape &s);
  34. Shape *getObject(int i) { return this->objectList[i]; };
  35. Light *getLight(int i) { return this->lightList[i]; };
  36. Tuple shadeHit(Computation comps, uint32_t depthCount = 4);
  37. Tuple colourAt(Ray r, uint32_t depthCount = 4);
  38. bool isShadowed(Tuple point);
  39. Colour reflectColour(Computation comps, uint32_t depthCount = 4);
  40. Colour refractedColour(Computation comps, uint32_t depthCount = 4);
  41. Intersect intersect(Ray r);
  42. };
  43. #endif /* DORAYME_WORLD_H */