Changed the tolower of the file extension into the plugin name construction code.
Added support for CompositeLayer.
This commit is contained in:
@@ -30,6 +30,15 @@
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
|
||||
#if defined(__sgi)
|
||||
#include <ctype.h>
|
||||
#elif defined(__GNUC__) || !defined(WIN32) || defined(__MWERKS__)
|
||||
#include <cctype>
|
||||
using std::tolower;
|
||||
using std::strlen;
|
||||
#endif
|
||||
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgDB;
|
||||
|
||||
@@ -545,14 +554,20 @@ std::string Registry::trim( const std::string& str )
|
||||
|
||||
std::string Registry::createLibraryNameForFile(const std::string& fileName)
|
||||
{
|
||||
std::string ext = getLowerCaseFileExtension(fileName);
|
||||
return createLibraryNameForExtension(ext);
|
||||
return createLibraryNameForExtension(getFileExtension(fileName));
|
||||
}
|
||||
|
||||
std::string Registry::createLibraryNameForExtension(const std::string& ext)
|
||||
{
|
||||
std::string lowercase_ext;
|
||||
for(std::string::const_iterator itr=ext.begin();
|
||||
itr!=ext.end();
|
||||
++itr)
|
||||
{
|
||||
lowercase_ext.push_back(tolower(*itr));
|
||||
}
|
||||
|
||||
ExtensionAliasMap::iterator itr=_extAliasMap.find(ext);
|
||||
ExtensionAliasMap::iterator itr=_extAliasMap.find(lowercase_ext);
|
||||
if (itr!=_extAliasMap.end() && ext != itr->second) return createLibraryNameForExtension(itr->second);
|
||||
|
||||
#ifdef OSG_JAVA_BUILD
|
||||
@@ -569,23 +584,23 @@ std::string Registry::createLibraryNameForExtension(const std::string& ext)
|
||||
#if defined(WIN32)
|
||||
// !! recheck evolving Cygwin DLL extension naming protocols !! NHV
|
||||
#ifdef __CYGWIN__
|
||||
return "cyg"+prepend+"osgdb_"+ext+".dll";
|
||||
return "cyg"+prepend+"osgdb_"+lowercase_ext+".dll";
|
||||
#elif defined(__MINGW32__)
|
||||
return "lib"+prepend+"osgdb_"+ext+".dll";
|
||||
return "lib"+prepend+"osgdb_"+lowercase_ext+".dll";
|
||||
#else
|
||||
#ifdef _DEBUG
|
||||
return prepend+"osgdb_"+ext+"d.dll";
|
||||
return prepend+"osgdb_"+lowercase_ext+"d.dll";
|
||||
#else
|
||||
return prepend+"osgdb_"+ext+".dll";
|
||||
return prepend+"osgdb_"+lowercase_ext+".dll";
|
||||
#endif
|
||||
#endif
|
||||
#elif macintosh
|
||||
return prepend+"osgdb_"+ext;
|
||||
return prepend+"osgdb_"+lowercase_ext;
|
||||
#elif defined(__hpux__)
|
||||
// why don't we use PLUGIN_EXT from the makefiles here?
|
||||
return prepend+"osgdb_"+ext+".sl";
|
||||
return prepend+"osgdb_"+lowercase_ext+".sl";
|
||||
#else
|
||||
return prepend+"osgdb_"+ext+".so";
|
||||
return prepend+"osgdb_"+lowercase_ext+".so";
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -38,6 +38,27 @@ osgTerrain::Layer* readLayer(osgDB::Input& fr)
|
||||
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
|
||||
{
|
||||
bool itrAdvanced = false;
|
||||
|
||||
if (fr.matchSequence("Images {") || fr.matchSequence("images {"))
|
||||
{
|
||||
osg::ref_ptr<osgTerrain::CompositeLayer> cl = new osgTerrain::CompositeLayer;
|
||||
|
||||
int local_entry = fr[0].getNoNestedBrackets();
|
||||
|
||||
fr += 2;
|
||||
while (!fr.eof() && fr[0].getNoNestedBrackets()>local_entry)
|
||||
{
|
||||
cl->addLayer(fr[0].getStr());
|
||||
++fr;
|
||||
}
|
||||
|
||||
layer = cl.get();
|
||||
|
||||
itrAdvanced = true;
|
||||
|
||||
++fr;
|
||||
}
|
||||
|
||||
if (fr.matchSequence("Image %w") || fr.matchSequence("image %w") ||
|
||||
fr.matchSequence("Image %s") || fr.matchSequence("image %s"))
|
||||
{
|
||||
|
||||
@@ -20,8 +20,9 @@ Layer::Layer()
|
||||
{
|
||||
}
|
||||
|
||||
Layer::Layer(const Layer& Layer,const osg::CopyOp& copyop):
|
||||
osg::Object(Layer,copyop)
|
||||
Layer::Layer(const Layer& layer,const osg::CopyOp& copyop):
|
||||
osg::Object(layer,copyop),
|
||||
_filename(layer._filename)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -321,3 +322,19 @@ unsigned int HeightFieldLayer::getModifiedCount() const
|
||||
{
|
||||
return _modifiedCount;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// HieghtFieldLayer
|
||||
//
|
||||
CompositeLayer::CompositeLayer()
|
||||
{
|
||||
}
|
||||
|
||||
CompositeLayer::CompositeLayer(const CompositeLayer& compositeLayer,const osg::CopyOp& copyop):
|
||||
Layer(compositeLayer,copyop)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user