Add OutputTextureFiles Option
Add OutputTextureFiles Option support Write out the texture images to file
This commit is contained in:
committed by
Robert Osfield
parent
c6c49c3745
commit
7ec8b65ec4
@@ -75,6 +75,7 @@ public:
|
||||
supportsOption("NsIfNotPresent=<value>", "set specular exponent if not present");
|
||||
|
||||
supportsOption("precision=<digits>","Set the floating point precision when writing out files");
|
||||
supportsOption("OutputTextureFiles", "Write out the texture images to file");
|
||||
}
|
||||
|
||||
virtual const char* className() const { return "Wavefront OBJ Reader"; }
|
||||
@@ -103,7 +104,7 @@ public:
|
||||
f.precision(localOptions.precision);
|
||||
|
||||
std::string materialFile = osgDB::getNameLessExtension(fileName) + ".mtl";
|
||||
OBJWriterNodeVisitor nv(f, osgDB::getSimpleFileName(materialFile), options);
|
||||
OBJWriterNodeVisitor nv(f, osgDB::getSimpleFileName(materialFile), localOptions.outputTextureFiles, options);
|
||||
|
||||
// we must cast away constness
|
||||
(const_cast<osg::Node*>(&node))->accept(nv);
|
||||
@@ -131,7 +132,7 @@ public:
|
||||
|
||||
// writing to a stream does not support materials
|
||||
|
||||
OBJWriterNodeVisitor nv(fout, "", options);
|
||||
OBJWriterNodeVisitor nv(fout, "", localOptions.outputTextureFiles, options);
|
||||
|
||||
// we must cast away constness
|
||||
(const_cast<osg::Node*>(&node))->accept(nv);
|
||||
@@ -157,6 +158,7 @@ protected:
|
||||
TextureAllocationMap textureUnitAllocation;
|
||||
/// Coordinates precision.
|
||||
int precision;
|
||||
bool outputTextureFiles;
|
||||
int specularExponent;
|
||||
|
||||
ObjOptionsStruct()
|
||||
@@ -168,6 +170,7 @@ protected:
|
||||
fixBlackMaterials = true;
|
||||
noReverseFaces = false;
|
||||
precision = std::numeric_limits<double>::digits10 + 2;
|
||||
outputTextureFiles = false;
|
||||
specularExponent = -1;
|
||||
}
|
||||
};
|
||||
@@ -881,6 +884,10 @@ ReaderWriterOBJ::ObjOptionsStruct ReaderWriterOBJ::parseOptions(const osgDB::Rea
|
||||
{
|
||||
localOptions.noReverseFaces = true;
|
||||
}
|
||||
else if (pre_equals == "OutputTextureFiles")
|
||||
{
|
||||
localOptions.outputTextureFiles = true;
|
||||
}
|
||||
else if (pre_equals == "precision")
|
||||
{
|
||||
int val = std::atoi(post_equals.c_str());
|
||||
|
||||
Reference in New Issue
Block a user