Hello Henrique,

Carsten Neumann wrote:
        Hello Henrique,

[EMAIL PROTECTED] wrote:
Do you know of any change to OpenSG that may explain this problem?

There was a change involving bounding boxes, they were incorrect for Geometry that was not a leaf of the scene graph. To double check I just took another look at that code and it looks ok to me.

well, upon looking even closer, there actually is a problem when adding/removing children. Would you mind trying the attached patch and see if that makes any difference ?

        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-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to