I finally tried the Quadtree thing
I simply copied the 2 files (cpp, h) in my src directory, and use a define to use (or not) the quadtree, like in their demo (but I do not use the LODSceneNode... At least not for the time being).
Before speaking of the results (comparison between not using it, and using it), I had a compile error... I checked the forums and Hybrid told in the "bugs report" that he changed the include orders.
Here is the "crashing" code (in CQuadTreeSceneNode.cpp) :
Code: Select all
void CQuadTreeSceneNode::OnPreRender() {
ICameraSceneNode* cam = smgr->getActiveCamera();
// bool vis = ( viewFrustrum->getBoundingBox().intersectsWithBox( bbox ) );// getTransformedBoundingBox() ) );
bool vis = true;
setVisible( vis );
SceneManager->registerNodeForRendering( this );
ISceneNode::OnPreRender();
}
The line that generates the compile error is the commented one, the error is :
Code: Select all
src/CQuadTreeSceneNode.cpp: In member function «virtual void CQuadTreeSceneNode::OnPreRender()»:
src/CQuadTreeSceneNode.cpp:72: erreur: invalid use of undefined type «const struct irr::scene::SViewFrustrum»
/home/renaud/Irrlicht/irrlicht_svn/include/ICameraSceneNode.h:16: erreur: forward declaration of «const struct irr::scene::SViewFrustrum»
I could not get rid of it, and according to Hybrid this is not possible (otherwise he would have posted the workaround).
So, I always setVisible(true), so I guess there is a performance leak compared to the original code. If you have an idea on how to make it compile... I would be happy to learn it
Here is now the performance comparison between Octree and Quadtree (about Octree : it makes my map disappear if I add it as an OctreeSceneNode... CF the topic "triangles disappearing then reappearing")
The tests are made with a map composed of 9 simple faces (one face is a separate object in the .obj file), and 70 objects.
Octree :
Camera where there are all the objects :
160 fps
Camera where there are NO object :
330 fps
Quadtree :
Camera where there are all the objects :
190 fps
Camera where there are NO object :
190 fps
(this is normal since I always set setVisible(true) in the prerender(), as I told above)
Then, Quadtree seems far better !
(but I have not tested with about 300 objects though)
One question :
I'm only creating ONE QuadTreeSceneNode, and then adding ALL my objects to it... Is that good ?
Thank you again for that Quadtree thing
If you have the solution about the compile error, and also the answer for my last question (about the single QuadTreeNode usage), I would really be glad to read that
Good afternoon,