Starting to work on the World Optimiser sequence.
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#include <ray.h>
|
||||
#include <stdio.h>
|
||||
#include <group.h>
|
||||
#include <worldoptimiser.h>
|
||||
|
||||
#ifdef ENABLE_LUA_SUPPORT
|
||||
extern "C" {
|
||||
@@ -64,6 +65,8 @@ public:
|
||||
|
||||
Intersect intersect(Ray r);
|
||||
|
||||
void finalise(WorldOptimiser &opt);
|
||||
|
||||
void dumpMe(FILE *fp);
|
||||
};
|
||||
|
||||
|
||||
@@ -9,12 +9,27 @@
|
||||
#ifndef DORAYME_WORLDOPTIMISER_H
|
||||
#define DORAYME_WORLDOPTIMISER_H
|
||||
|
||||
#include <group.h>
|
||||
|
||||
/* World Optimiser subclasses will created move objcet around to try to optimise the parsing of the world.
|
||||
* This class is abstract to we can implement different type and change at runtime or build time
|
||||
*/
|
||||
class WorldOptimiser
|
||||
{
|
||||
public:
|
||||
virtual void run(Group *root) = 0;
|
||||
};
|
||||
|
||||
class NoWorldOptimisation : public WorldOptimiser
|
||||
{
|
||||
public:
|
||||
void run(Group *root) {};
|
||||
};
|
||||
|
||||
class OctreeOptimisation : public WorldOptimiser
|
||||
{
|
||||
public:
|
||||
void run(Group *root) {};
|
||||
};
|
||||
|
||||
#endif /* DORAYME_WORLDOPTIMISER_H */
|
||||
|
||||
@@ -187,6 +187,15 @@ Colour World::refractedColour(Computation comps, uint32_t depthCount)
|
||||
return Colour(hitColour.x, hitColour.y, hitColour.z);
|
||||
}
|
||||
|
||||
void World::finalise(WorldOptimiser &opt)
|
||||
{
|
||||
/* First lock eveyrything */
|
||||
this->worldGroup.lock();
|
||||
|
||||
/* Now run the optimiser */
|
||||
opt.run(&this->worldGroup);
|
||||
}
|
||||
|
||||
void World::dumpMe(FILE *fp)
|
||||
{
|
||||
int i;
|
||||
|
||||
Reference in New Issue
Block a user