diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2009-04-14 00:08:33 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2009-04-14 00:08:33 +0400 |
commit | 0b8661ab4da1a7cfbc756640649a2d07bb36cc64 (patch) | |
tree | 6d171db30ddcba3d379dea04b2da9449203419a6 /source/gameengine/Ketsji/KX_Scene.cpp | |
parent | 6f12e584a97f664c654ddfbe5f721d2a7be3d491 (diff) |
BGE: Occlusion culling and other performance improvements.
Added occlusion culling capability in the BGE.
More info: http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.49/Game_Engine#BGE_Scenegraph_improvement
MSVC, scons, cmake, Makefile updated.
Other minor performance improvements:
- The rasterizer was computing the openGL model matrix of the objects too many times
- DBVT view frustrum culling was not properly culling behind the near plane:
Large objects behind the camera were sent to the GPU
- Remove all references to mesh split/join feature as it is not yet functional
Diffstat (limited to 'source/gameengine/Ketsji/KX_Scene.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_Scene.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 2f7c1b77794..98c129ebca5 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -138,6 +138,7 @@ KX_Scene::KX_Scene(class SCA_IInputDevice* keyboarddevice, m_suspendeddelta = 0.0; m_dbvt_culling = false; + m_dbvt_occlusion_res = 0; m_activity_culling = false; m_suspend = false; m_isclearingZbuffer = true; @@ -1352,17 +1353,18 @@ void KX_Scene::CalculateVisibleMeshes(RAS_IRasterizer* rasty,KX_Camera* cam, int if (m_dbvt_culling) { // test culling through Bullet - PHY__Vector4 planes[5]; + PHY__Vector4 planes[6]; // get the clip planes MT_Vector4* cplanes = cam->GetNormalizedClipPlanes(); // and convert - planes[0].setValue(cplanes[0].getValue()); - planes[1].setValue(cplanes[1].getValue()); - planes[2].setValue(cplanes[2].getValue()); - planes[3].setValue(cplanes[3].getValue()); - planes[4].setValue(cplanes[5].getValue()); + planes[0].setValue(cplanes[4].getValue()); // near + planes[1].setValue(cplanes[5].getValue()); // far + planes[2].setValue(cplanes[0].getValue()); // left + planes[3].setValue(cplanes[1].getValue()); // right + planes[4].setValue(cplanes[2].getValue()); // top + planes[5].setValue(cplanes[3].getValue()); // bottom CullingInfo info(layer); - dbvt_culling = m_physicsEnvironment->cullingTest(PhysicsCullingCallback,&info,planes,5); + dbvt_culling = m_physicsEnvironment->cullingTest(PhysicsCullingCallback,&info,planes,5,m_dbvt_occlusion_res); } if (!dbvt_culling) { // the physics engine couldn't help us, do it the hard way |