Hi,
I am using openscenegraph 3.0.1 with Visual Studio 2010. Everything is working 
fine, I assume build is fine.

Now I am trying to load OpenFlight models and terrains to my scene. The 
openflight plugin seem to have a  osgUtil::Optimizer::optimize() call inside it 
so it optimizes every loaded model. 

Code:

// File ReaderWriter.flt
// virtual ReadResult readNode(const std::string& file, const Options* options) 
const
// ...
if (!document.getPreserveFace())
{
osgUtil::Optimizer optimizer;
optimizer.optimize(document.getHeaderNode(),
osgUtil::Optimizer::SHARE_DUPLICATE_STATE |
osgUtil::Optimizer::MERGE_GEOMETRY | 
osgUtil::Optimizer::MERGE_GEODES | 
osgUtil::Optimizer::TESSELLATE_GEOMETRY |
osgUtil::Optimizer::STATIC_OBJECT_DETECTION);
}
// ...




So, the optimisation is helpfull, it cuts a lot of StateSet, Geode etc. nodes, 
but takes a lot of time. So I am trying to save the optimized model/terrain 
back to the file:

Code:

// the optimization is taking place in this instruction, inside the plugin code.
osg::ref_ptr<osg::Node> root = osgDB::readNodeFile("model.flt"); 
osgDB::writeNodeFile(*root,"model_optimized.flt");




But all I get is the file with different size (why?), but with the same stats 
(with the same amount of StateSet and others node) like the optimization never 
took place. 

Is it because this optimization is such that optimized scene cannot be saved, 
or am I doing something wrong?

Please advise me how to either save optimized graph, or decrease loading time 
in any other way.

Thank you!

Cheers,
Sergey

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=53024#53024





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to