group.h 902 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * DoRayMe - a quick and dirty Raytracer
  3. * Group header
  4. *
  5. * Created by Manoël Trapier
  6. * Copyright (c) 2020 986-Studio.
  7. *
  8. */
  9. #ifndef DORAYME_GROUP_H
  10. #define DORAYME_GROUP_H
  11. #include <shape.h>
  12. /* TODO: Add a way to force(?) material from group to be applied on childs */
  13. class Group : public Shape
  14. {
  15. private:
  16. uint32_t allocatedObjectCount;
  17. Shape* *objectList;
  18. uint32_t objectCount;
  19. uint32_t allocatedUnboxableObjectCount;
  20. Shape* *unboxableObjectList;
  21. uint32_t unboxableObjectCount;
  22. protected:
  23. Intersect localIntersect(Ray r);
  24. Tuple localNormalAt(Tuple point);
  25. BoundingBox bounds;
  26. public:
  27. bool isEmpty();
  28. void addObject(Shape *s);
  29. Shape *operator[](const int p) { return this->objectList[p]; }
  30. Intersect intersect(Ray r);
  31. BoundingBox getBounds();
  32. void updateBoundingBox();
  33. Group();
  34. };
  35. #endif /* DORAYME_GROUP_H */