Added support for "-O OutputTextureFiles" options string in .osg plugin to

allow texture files to be written out when writing out a .osg file.
This commit is contained in:
Robert Osfield
2005-09-19 14:07:44 +00:00
parent ea1ea88a17
commit d1108ea862
9 changed files with 121 additions and 15 deletions

View File

@@ -16,6 +16,7 @@
#include <osg/Notify>
#include <sstream>
#include <stdio.h>
using namespace std;
@@ -43,6 +44,8 @@ void Output::init()
_indentStep = 2;
_numIndicesPerLine = 10;
_pathNameHint = AS_IS;
_outputTextureFiles = false;
_textureFileNameNumber = 0;
}
void Output::open(const char *name)
@@ -157,3 +160,20 @@ std::string Output::getFileNameForOutput(const std::string& filename) const
return filename;
}
}
std::string Output::getTextureFileNameForOutput()
{
std::string fileName = osgDB::getNameLessExtension(_filename);
if (_textureFileNameNumber>0)
{
std::ostringstream o;
o << '_' << _textureFileNameNumber;
fileName += o.str();
}
fileName += ".dds";
++_textureFileNameNumber;
return fileName;
}