Permalink
Browse files

fixed: culling problems with infinite subtree volumes

git-svn-id: https://external.lite3d.com/opensg/svn_repo/trunk@2278 4683daeb-ad0f-0410-a623-93161e962ae5
  • Loading branch information...
1 parent 3759691 commit c803c4c390e7368ac72402a553c487dce6795007 vossg committed Jan 29, 2010
View
24 Source/System/Action/RenderAction/OSGRenderPartition.cpp
@@ -1146,6 +1146,9 @@ bool RenderPartition::isVisible(Node *pNode)
// _oDrawEnv.getRTAction()->getStatistics()->getElem(statCullTestedNodes)->inc();
+ if(pNode->getVolume().isInfinite() == true)
+ return true;
+
BoxVolume vol;
pNode->updateVolume();
@@ -1191,21 +1194,26 @@ bool RenderPartition::pushVisibility(Node * const pNode)
Color3f col;
bool result = true;
- pNode->updateVolume();
-
- BoxVolume vol = pNode->getVolume();
FrustumVolume frustum = _oFrustum;
+ BoxVolume vol = pNode->getVolume();
+
+ // don't mess with infinite volumes
+ if(vol.isInfinite() == false)
+ {
+ pNode->updateVolume();
+
+ vol = pNode->getVolume();
#if 1
- vol.transform(topMatrix());
+ vol.transform(topMatrix());
#else
// not quite working
- Matrix m = topMatrix();
- m.invert();
+ Matrix m = topMatrix();
+ m.invert();
- frustum.transform(m);
+ frustum.transform(m);
#endif
-
+ }
if(_oDrawEnv.getStatCollector() != NULL)
{
View
18 Source/WindowSystem/GLUT/testWindowGLUT.cpp
@@ -38,6 +38,7 @@
#include "OSGGraphOp.h"
#include "OSGGraphOpFactory.h"
#include "OSGMultiCore.h"
+#include "OSGFrameHandler.h"
#include "OSGTrackball.h"
@@ -109,6 +110,8 @@ display(void)
cam_trans->editSFMatrix()->setValue( m1 );
}
+ OSG::FrameHandler::the()->frame();
+
OSG::commitChanges();
win->render(rentravact);
@@ -212,6 +215,8 @@ void key(unsigned char key, int x, int y)
switch ( key )
{
case 27:
+ OSG::FrameHandler::the()->shutdown();
+
root = NULL;
file = NULL;
cam = NULL;
@@ -323,7 +328,9 @@ void key(unsigned char key, int x, int y)
int init(int argc, char **argv)
{
OSG::osgInit(argc,argv);
-
+
+ OSG::setVBOUsageOnPropertyProtos(true);
+
// GLUT init
glutInit(&argc, argv);
@@ -344,7 +351,7 @@ int init(int argc, char **argv)
// glEnable( GL_LIGHTING );
// glEnable( GL_LIGHT0 );
// glFrontFace(GL_CW);
- glEnable(GL_CULL_FACE);
+// glEnable(GL_CULL_FACE);
// OSG
@@ -403,6 +410,8 @@ int init(int argc, char **argv)
}
+ OSG::Thread::getCurrentChangeList()->commitChanges();
+
#if 0
OSG::GeometryPtr pGeo = cast_dynamic<OSG::GeometryPtr>(file->getCore());
@@ -423,7 +432,6 @@ int init(int argc, char **argv)
// createOptimizedPrimitives(pGeo);
// createSharedIndex(pGeo);
- OSG::Thread::getCurrentChangeList()->commitChanges();
// file->dump();
file->updateVolume();
@@ -498,7 +506,7 @@ int init(int argc, char **argv)
// Background
OSG::SolidBackgroundUnrecPtr bkgnd = OSG::SolidBackground::create();
- bkgnd->setColor(OSG::Color3f(1,0,0));
+ bkgnd->setColor(OSG::Color3f(0.1,0.1,0.1));
// Viewport
@@ -599,6 +607,8 @@ int init(int argc, char **argv)
pGr = NULL;
#endif
+ OSG::FrameHandler::the()->init();
+
return 0;
}

0 comments on commit c803c4c

Please sign in to comment.