Hello Pablo,
Pablo Carneiro Elias wrote:
I've created a custom node which I want to get rendered always (withou
culling by boundingbox). So, I simply set
OSG::BoxVolume& volume = myCustomNode->editVolume();
volume.setInfinite();
volume.setStatic();
and it does not work.
But if I replace setInfinite() by:
volume.extendBy( OSG::BoxVolume( -vr::INT32_MAX, -vr::INT32_MAX,
-vr::INT32_MAX, vr::INT32_MAX, vr::INT32_MAX, vr::INT32_MAX ) );
it works fine. Shouldn't setInfinite() work in this case?
yes, it should work, but it seems the code used for frustum culling does
not check if the volume it tests against is empty or infinite :-/
Fix committed as r2233.
Can you please update or try the attached patch?
Cheers,
Carsten
Index: Source/Base/Base/OSGFrustumVolume.cpp
===================================================================
--- Source/Base/Base/OSGFrustumVolume.cpp (revision 2232)
+++ Source/Base/Base/OSGFrustumVolume.cpp (working copy)
@@ -489,26 +489,40 @@
const OSG::Volume &vol,
OSG::FrustumVolume::PlaneSet &inplanes)
{
- Pnt3r min, max;
+ // it's probably safe to assume the frustum is not empty and finite
+ // so we only check vol for these conditions
- vol.getBounds(min, max);
+ if(vol.isEmpty() == true)
+ {
+ return false;
+ }
+ else if(vol.isInfinite() == true)
+ {
+ return true;
+ }
+ else
+ {
+ Pnt3r min, max;
+
+ vol.getBounds(min, max);
- const Plane *frust = frustum.getPlanes();
- FrustumVolume::PlaneSet mask = 0x1;
+ const Plane *frust = frustum.getPlanes();
+ FrustumVolume::PlaneSet mask = 0x1;
- // check the box against the 6 planes, adjust the inplanes set
- // accordingly
+ // check the box against the 6 planes, adjust the inplanes set
+ // accordingly
- for(Int32 i = 0; i < 6; i++, mask <<= 1)
- {
- if((inplanes & mask) != 0)
- continue;
+ for(Int32 i = 0; i < 6; i++, mask <<= 1)
+ {
+ if((inplanes & mask) != 0)
+ continue;
- if(frust[i].isOutHalfSpace(min, max))
- return false;
+ if(frust[i].isOutHalfSpace(min, max))
+ return false;
- if(frust[i].isInHalfSpace(min, max))
- inplanes |= mask;
+ if(frust[i].isInHalfSpace(min, max))
+ inplanes |= mask;
+ }
}
return true;
------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users