From 0bc8befc5773a3abb01162e79c122c796ecb8e81 Mon Sep 17 00:00:00 2001 From: vlj Date: Wed, 3 Sep 2014 01:49:39 +0200 Subject: [PATCH] Use Irrlicht culling function --- src/graphics/stkscenemanager.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/graphics/stkscenemanager.cpp b/src/graphics/stkscenemanager.cpp index da61dc53b..580508f94 100644 --- a/src/graphics/stkscenemanager.cpp +++ b/src/graphics/stkscenemanager.cpp @@ -352,19 +352,20 @@ parseSceneManager(core::list List, std::vectorisVisible()) continue; (*I)->updateAbsolutePosition(); - core::aabbox3d tbox = (*I)->getBoundingBox(); - (*I)->getAbsoluteTransformation().transformBoxEx(tbox); const scene::ICameraSceneNode* cam = irr_driver->getSceneManager()->getActiveCamera(); - bool IsCulledForSolid = !(tbox.intersectsWithBox(cam->getViewFrustum()->getBoundingBox())); + bool IsCulledForSolid = irr_driver->getSceneManager()->isCulled(*I); bool IsCulledForShadow[4]; - bool IsCulledForRSM = false; for (unsigned i = 0; i < 4; ++i) { - const scene::ICameraSceneNode* cam = shadowCams[i]; - IsCulledForShadow[i] = !(tbox.intersectsWithBox(cam->getViewFrustum()->getBoundingBox())); + scene::ICameraSceneNode* cam = shadowCams[i]; + irr_driver->getSceneManager()->setActiveCamera(cam); + IsCulledForShadow[i] = irr_driver->getSceneManager()->isCulled(*I); } + irr_driver->getSceneManager()->setActiveCamera(RSM_cam); + bool IsCulledForRSM = irr_driver->getSceneManager()->isCulled(*I); + if (IsCulledForSolid && IsCulledForShadow[0] && IsCulledForShadow[1] && IsCulledForShadow[2] && IsCulledForShadow[3]) continue; @@ -378,7 +379,7 @@ parseSceneManager(core::list List, std::vectorgetChildren(), ImmediateDraw, shadowCams, RSM_cam); }