Continue working work optimiser.

This commit is contained in:
Godzil
2020-03-11 19:35:08 +00:00
parent 420203e95d
commit 0aa949c60b
6 changed files with 263 additions and 8 deletions

View File

@@ -39,7 +39,8 @@ public:
void addObject(Shape *s);
void removeObject(Shape *s);
Shape *operator[](const int p) { return this->objectList[p]; };
Shape *operator[](const int p) { return this->getObject(p); };
Shape *getObject(const int p) { return this->objectList[p]; };
Shape *getUnboxable(const int p) { return this->unboxableObjectList[p]; };
Intersect intersect(Ray r);

View File

@@ -11,25 +11,39 @@
#include <group.h>
/* World Optimiser subclasses will created move objcet around to try to optimise the parsing of the world.
/* World Optimiser subclasses will created move objects around to try to optimise the raytrace of the world, to
* have as least as possible object to intersect per ray.
* This class is abstract to we can implement different type and change at runtime or build time
*/
class WorldOptimiser
{
protected:
Group *root;
void moveInfiniteObjects(Shape *s = nullptr);
void moveAllObjects(Shape *s = nullptr);
public:
virtual void run(Group *root) = 0;
void setRoot(Group *root) { this->root = root; };
virtual void run() = 0;
};
class NoWorldOptimisation : public WorldOptimiser
{
public:
void run(Group *root) {};
void run() {};
};
class BVHOptimisation : public WorldOptimiser
{
public:
void run();
};
class OctreeOptimisation : public WorldOptimiser
{
private:
void makeTree(Group *leaf);
public:
void run(Group *root) {};
void run();
};
#endif /* DORAYME_WORLDOPTIMISER_H */