Scene Management
Hello,
I've just sketched a design for a scene management with scene graphs and octrees/quadtrees. Just wanted some advice before i get to implement that system. Here is the design:
there is a generic TreeNode structure. Then there are render objects:
class Entity : public TreeNode
class Skeleton : public TreeNode
class Light : public TreeNode
class Particle : public TreeNode
etc.
class Octree {
List<TreeNodePtr> nodes;
void update(real time);
};
class SceneGraph {
List<TreeNodePtr> nodes;
void update(real time);
};
class Scene {
Octree octree;
SceneGraph scenegraph;
};
the render objects are classified to stay in SceneGraph or Octree or both:
void Scene::addEntity(Entity * entity) {
octree->addNode(entity);
scenegraph->addNode(entity);
}
void Scene::addSkeleton(Skeleton * skeleton) {
scenegraph->addNode(skeleton);
}
etc.
void Scene::update(real time) {
scenegraph->update(time);
octree->update(time);
}
in scene graphs the node's transform data is calculated relative to parent. in octree the node's collision data, cull data are calculated and executed depending of the current node, Obstacles etc.
Then the Renderer Renders the final, altered data.
Is that a good design?
Another question about SceneGraphs:
Suppose, I have a large island like in Just Cause 2. if im at one edge of that huge island and the citizen or soldier is at another edge of the map, does scene graph need to update its position, current animation cycle or octree need to update its collision data etc.?
Thanks,
Kasya
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement