using namespace osgDB;
using namespace simgear;
-// Little helper class that holds an extra reference to a
-// loaded 3d model.
-// Since we clone all structural nodes from our 3d models,
-// the database pager will only see one single reference to
-// top node of the model and expire it relatively fast.
-// We attach that extra reference to every model cloned from
-// a base model in the pager. When that cloned model is deleted
-// this extra reference is deleted too. So if there are no
-// cloned models left the model will expire.
namespace {
-class SGDatabaseReference : public Observer {
-public:
- SGDatabaseReference(Referenced* referenced) :
- mReferenced(referenced)
- { }
- virtual void objectDeleted(void*)
- {
- mReferenced = 0;
- }
-private:
- ref_ptr<Referenced> mReferenced;
-};
-
// Set the name of a Texture to the simple name of its image
// file. This can be used to do livery substitution after the image
// has been deallocated.
} // namespace
Node* DefaultProcessPolicy::process(Node* node, const string& filename,
- const ReaderWriter::Options* opt)
+ const Options* opt)
{
TextureNameVisitor nameVisitor;
node->accept(nameVisitor);
ReaderWriter::ReadResult
ModelRegistry::readImage(const string& fileName,
- const ReaderWriter::Options* opt)
+ const Options* opt)
{
CallbackMap::iterator iter
= imageCallbackMap.find(getFileExtension(fileName));
case GL_COMPRESSED_RED_GREEN_RGTC2_EXT:
case GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:
- SG_LOG(SG_IO, SG_ALERT, "Image \"" << fileName
- << "\" contains non portable compressed textures.\n"
- "Usage of these textures depend on an extension that"
- " is not guaranteed to be present.");
+ SG_LOG(SG_IO, SG_ALERT, "Image \"" << fileName << "\"\n"
+ "uses compressed textures which cannot be supported on "
+ "some systems.\n"
+ "Please decompress this texture for improved portability.");
break;
default:
osg::Node* DefaultCachePolicy::find(const string& fileName,
- const ReaderWriter::Options* opt)
+ const Options* opt)
{
Registry* registry = Registry::instance();
osg::Node* cached
_osgOptions(Optimizer::SHARE_DUPLICATE_STATE
| Optimizer::MERGE_GEOMETRY
| Optimizer::FLATTEN_STATIC_TRANSFORMS
- | Optimizer::TRISTRIP_GEOMETRY)
+ | Optimizer::INDEX_MESH
+ | Optimizer::VERTEX_POSTTRANSFORM
+ | Optimizer::VERTEX_PRETRANSFORM)
{
}
osg::Node* OptimizeModelPolicy::optimize(osg::Node* node,
const string& fileName,
- const osgDB::ReaderWriter::Options* opt)
+ const osgDB::Options* opt)
{
osgUtil::Optimizer optimizer;
optimizer.optimize(node, _osgOptions);
}
string OSGSubstitutePolicy::substitute(const string& name,
- const ReaderWriter::Options* opt)
+ const Options* opt)
{
string fileSansExtension = getNameLessExtension(name);
string osgFileName = fileSansExtension + ".osg";
ReaderWriter::ReadResult
ModelRegistry::readNode(const string& fileName,
- const ReaderWriter::Options* opt)
+ const Options* opt)
{
ReaderWriter::ReadResult res;
CallbackMap::iterator iter
Referenced::setThreadSafeReferenceCounting(true);
Registry* registry = Registry::instance();
- ReaderWriter::Options* options = new ReaderWriter::Options;
- int cacheOptions = ReaderWriter::Options::CACHE_ALL;
+ Options* options = new Options;
+ int cacheOptions = Options::CACHE_ALL;
options->
- setObjectCacheHint((ReaderWriter::Options::CacheHintOptions)cacheOptions);
+ setObjectCacheHint((Options::CacheHintOptions)cacheOptions);
registry->setOptions(options);
registry->getOrCreateSharedStateManager()->
setShareMode(SharedStateManager::SHARE_STATESETS);
_osgOptions &= ~Optimizer::TRISTRIP_GEOMETRY;
}
Node* optimize(Node* node, const string& fileName,
- const ReaderWriter::Options* opt)
+ const Options* opt)
{
ref_ptr<Node> optimized
= OptimizeModelPolicy::optimize(node, fileName, opt);
struct ACProcessPolicy {
ACProcessPolicy(const string& extension) {}
Node* process(Node* node, const string& filename,
- const ReaderWriter::Options* opt)
+ const Options* opt)
{
Matrix m(1, 0, 0, 0,
0, 0, 1, 0,