Hello Christoph,

Christoph Schäfer wrote:
> I have a problem getting the correct volume from loaded models (load as
> VRML, save as osb, load as osb)
> 
> What I do:
> 
> OSG::NodeRecPtr file = OSG::SceneFileHandler::the()->read(
> filePath.toUtf8() );
> file->updateVolume();
> OSG::BoxVolume vol = file->getVolume();
> 
> Now  the problem: vol only has zero values for min and max. If I load
> the example files provided (tie fighter) the values are ok. Any ideas?
> The model looks fine, so zero bounding box can not be true...

the zero bounding box is only on the root of your graph, everything 
below most likely has a correct bounding box and since the root itself 
is not tested for visibility the model is not culled away.
The reason you see a zero volume is that volume updates and invalidation 
are propagated very lazily by OpenSG. Volumes are only invalidated when 
calling commitChanges() and updateVolume() does nothing if the volume is 
marked as valid.
So to make this work you need to insert a commitChanges() call between 
reading the file and calling updateVolume().
The loader should probably commitChanges() when done loading a file to 
avoid this kind of surprise (similar things have come up in the past) - 
I'll take a look.

        Cheers,
                Carsten

------------------------------------------------------------------------------

_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to