Hi Gerrit,

this patch is also in 2 as r1411. It makes sure that the volume cache does not give wrong results for geometry with children by only caching the geos volume not the union of the children and the geo.
Please let me know if I should apply or you will do it.

        Thanks,
                Carsten
Index: Source/System/NodeCores/Drawables/Geometry/OSGGeometry.cpp
===================================================================
RCS file: /cvsroot/opensg/OpenSG/Source/System/NodeCores/Drawables/Geometry/OSGGeometry.cpp,v
retrieving revision 1.54
diff -u -r1.54 OSGGeometry.cpp
--- Source/System/NodeCores/Drawables/Geometry/OSGGeometry.cpp	1 Jul 2008 06:43:06 -0000	1.54
+++ Source/System/NodeCores/Drawables/Geometry/OSGGeometry.cpp	31 Jul 2008 20:23:51 -0000
@@ -191,7 +191,7 @@
     _nvertices(0),
     _nprimitives(0),
     _numBytesOnGfxCard(0),
-    _volume()
+    _volumeCache()
 {
 }
 
@@ -203,7 +203,7 @@
     _nvertices(source._nvertices),
     _nprimitives(source._nprimitives),
     _numBytesOnGfxCard(source._numBytesOnGfxCard),
-    _volume(source._volume)
+    _volumeCache(source._volumeCache)
 {
 }
 
@@ -427,36 +427,38 @@
 
 void Geometry::adjustVolume(Volume & volume)
 {
-    if(!_volume.isEmpty())
+    if(!_volumeCache.isEmpty())
     {
         // use cached volume.
-        volume.setValid();
-        volume.extendBy(_volume);
+        volume.setValid(            );
+        volume.extendBy(_volumeCache);
         return;
     }
 
     // calculate volume.
     GeoPositionsPtr pos = getPositions();
 
-    volume.setValid();
+    _volumeCache.setValid();
 
     if(pos == NullFC)
     {
         return;                  // Node has no points, no volume
     }
 
-    PrimitiveIterator it = this->beginPrimitives();
-    PrimitiveIterator itEnd = this->endPrimitives();
+    PrimitiveIterator it    = this->beginPrimitives();
+    PrimitiveIterator itEnd = this->endPrimitives  ();
 
     while(it != itEnd)
     {
         for(UInt32 v=0; v < it.getLength(); ++v)
         {
-            volume.extendBy(it.getPosition(v));
+            _volumeCache.extendBy(it.getPosition(v));
         }
         ++it;
     }
-    _volume.extendBy(volume);
+    
+    volume.setValid(            );
+    volume.extendBy(_volumeCache);
 }
 
 /*---------------------------- pointer ------------------------------------*/
@@ -1293,8 +1295,8 @@
     {
         for(UInt32 i = 0; i < _parents.size(); i++)
         {
-            _volume.setValid();
-            _volume.setEmpty();
+            _volumeCache.setValid();
+            _volumeCache.setEmpty();
             _parents[i]->invalidateVolume();
         }
 
Index: Source/System/NodeCores/Drawables/Geometry/OSGGeometry.h
===================================================================
RCS file: /cvsroot/opensg/OpenSG/Source/System/NodeCores/Drawables/Geometry/OSGGeometry.h,v
retrieving revision 1.23
diff -u -r1.23 OSGGeometry.h
--- Source/System/NodeCores/Drawables/Geometry/OSGGeometry.h	1 Jul 2008 06:43:06 -0000	1.23
+++ Source/System/NodeCores/Drawables/Geometry/OSGGeometry.h	31 Jul 2008 20:23:51 -0000
@@ -268,9 +268,9 @@
     UInt32 _numBytesOnGfxCard;
 
 #ifndef OSG_2_PREP
-    DynamicVolume   _volume;
+    DynamicVolume   _volumeCache;
 #else
-    BoxVolume       _volume;
+    BoxVolume       _volumeCache;
 #endif
 };
 
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Opensg-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-core

Reply via email to