forcing users to use osgDB::readRef*File() methods. The later is preferable as it closes a potential threading bug when using paging databases in conjunction
with the osgDB::Registry Object Cache. This threading bug occurs when one thread gets an object from the Cache via an osgDB::read*File() call where only
a pointer to the object is passed back, so taking a reference to the object is delayed till it gets reassigned to a ref_ptr<>, but at the same time another
thread calls a flush of the Object Cache deleting this object as it's referenceCount is now zero. Using osgDB::readREf*File() makes sure the a ref_ptr<> is
passed back and the referenceCount never goes to zero.
To ensure the OSG builds when OSG_PROVIDE_READFILE is to OFF the many cases of osgDB::read*File() usage had to be replaced with a ref_ptr<> osgDB::readRef*File()
usage. The avoid this change causing lots of other client code to be rewritten to handle the use of ref_ptr<> in place of C pointer I introduced a serious of
templte methods in various class to adapt ref_ptr<> to the underly C pointer to be passed to old OSG API's, example of this is found in include/osg/Group:
bool addChild(Node* child); // old method which can only be used with a Node*
tempalte<class T> bool addChild(const osg::ref_ptr<T>& child) { return addChild(child.get()); } // adapter template method
These changes together cover 149 modified files, so it's a large submission. This extent of changes are warrent to make use of the Object Cache
and multi-threaded loaded more robust.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15164 16af8721-9629-0410-8352-f15c8da7e697
osgconv --compressed-dxt1 cow.osg cow.ive
due to different handling of the extentions in osg 3.4 and up.
attached is a zip with the files:
OpenSceneGraph\applications\osgconv\osgconv.cpp
This file is valid for svn branch and stable3.4."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15124 16af8721-9629-0410-8352-f15c8da7e697
80 columns. I reorganized some of the help strings to make the output of
osgconv --help --all
fit to 80 columns. This avoids difficult to read line breaks added by the
terminal program itself."
First Submission email from Gustav:
"This submission adds a --cache option to osgconv and osgviewer that enables setObjectCacheHint(osgDB::Options::CACHE_ALL); It greatly reduces memory usage when a .osg file has lots of external references with ProxyNode:s that points to the same file.
Options are also added to the osg plugin. The code was already mostly implemented but there was no way to change the options.
includeExternalReferences
writeExternalReferenceFiles
A counter is added to keep track if an external file has already been written down to avoid writing the same file over and over again. If it has already been written once then it is not written again.
The counter is added to the Output class in osgDB.
"
Second Submission email from Gustav:
"This is a continuation to my previous submission.
I noticed that the same problem that I fixed in ProxyNode.cpp for the osg plugin (external files being written over and over again) also existed in the ive plugin. I attached a submission where the ive plugin remembers which external files that have already been written and do not write them again."
Changes to the above done by Robert Osfield,
changed command line parameter to --enable-object-cache
changed set/get methods in osgDB::Output and ive/DataOutputStream.cpp to be s/getExternalFileWritten(const std::string&)
cleaned up set up of osgDB::Options.
" + "Further improvement for conversion to IVE format. Compressed DDS files are written for IVE output when noTexturesInIVEFile option is defined i.e. osgconv --compressed -O noTexturesInIVEFile dir1/input.osg dir2/output.ive will write images into dir2."
The code changes osgconv so that "osgconv --help" displays help info about --formats and --plugins, plus it also displays documentation for --format and --plugin, which were previously missing."
2) complementarily add a "--overallNormal" to replace
per-vert/per-facet normals with an overall. simplifier doesn't work
in certain cases without less complex normals. this gets that done.
3) add env var output with full verbose output so people realize it's
active when the app is run - i see this all the time in training where
people run osgconv, with unintended data transformations due to
osgUtil:;Optimzer, for example"
provides a mechansim for adding in a white colour where none previously
existed. This solves the problem that exists on some databases where
no colour is present, causing the colour to be inherited randomly.
osgarchive
osgconv
osgdem
osgversion
osgviewer
into applications directory. Leaving them in the examples directory
as well, for now.
Made examples optional via the make COMPILE_EXAMPLES=yes option
Added static lib and static plugin build support.