Original Post
I'm trying to optimize (once again) my XNA game project.
I've been using an octree for a long time ONLY to check collisions but not to draw, & now I'd like to use it to draw as well.
Nowadays in order to draw I'm looping through all the objects & drawing them if they are in the view frustum.
I'm currently building my models by myself (in 3Ds Max), & a Model usually contains many parts (Meshes). It may be a telephone (with buttons, wire, etc), or a train station (with stairs, lamp posts, rails, house, bridge, etc, etc, etc). Because of this, in order to check for collisions, I store the Meshes in each octree leaf (not the models).
It works good because I can identify if I'm standing over a stairstep or if i collided onto a solid wall or so.
The main issue is that the "draw" method is in my Model & not in my Mesh (& I cannot build a draw method per mesh because the model applies the corresponding transformations to its meshes when drawing them, inside "draw" method).
I thought of storing a reference to the model on each mesh, so when looping through the meshes in the octree, I call the draw method of the mesh owner's model. But the problem is that I will find several meshes which belong to the same model...
It's a mess...
I hope you can help me!
Thanks a lot for reading & helping!
Synth
I've been using an octree for a long time ONLY to check collisions but not to draw, & now I'd like to use it to draw as well.
Nowadays in order to draw I'm looping through all the objects & drawing them if they are in the view frustum.
I'm currently building my models by myself (in 3Ds Max), & a Model usually contains many parts (Meshes). It may be a telephone (with buttons, wire, etc), or a train station (with stairs, lamp posts, rails, house, bridge, etc, etc, etc). Because of this, in order to check for collisions, I store the Meshes in each octree leaf (not the models).
It works good because I can identify if I'm standing over a stairstep or if i collided onto a solid wall or so.
The main issue is that the "draw" method is in my Model & not in my Mesh (& I cannot build a draw method per mesh because the model applies the corresponding transformations to its meshes when drawing them, inside "draw" method).
I thought of storing a reference to the model on each mesh, so when looping through the meshes in the octree, I call the draw method of the mesh owner's model. But the problem is that I will find several meshes which belong to the same model...
It's a mess...
I hope you can help me!
Thanks a lot for reading & helping!
Synth