Renamed file3ds and options member variables to _file3ds and _options to avoid confusion and keep the code consistent with the rest of the class/OSG.

Added _option parameter to writeImageFile(..) call.
This commit is contained in:
Robert Osfield
2010-09-15 11:10:10 +00:00
parent 7a6a226ddd
commit d6fe337728
2 changed files with 10 additions and 10 deletions

View File

@@ -503,12 +503,12 @@ WriterNodeVisitor::WriterNodeVisitor(Lib3dsFile * file3ds, const std::string & f
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN),
_succeeded(true),
_srcDirectory(srcDirectory),
file3ds(file3ds),
_file3ds(file3ds),
_currentStateSet(new osg::StateSet()),
_lastMaterialIndex(0),
_lastMeshIndex(0),
_cur3dsNode(NULL),
options(options),
_options(options),
_imageCount(0),
_extendedFilePaths(false)
{
@@ -531,7 +531,7 @@ WriterNodeVisitor::WriterNodeVisitor(Lib3dsFile * file3ds, const std::string & f
void WriterNodeVisitor::writeMaterials()
{
unsigned int nbMat = _materialMap.size();
lib3ds_file_reserve_materials(file3ds, nbMat, 1);
lib3ds_file_reserve_materials(_file3ds, nbMat, 1);
// Ugly thing: it seems lib3ds_file_insert_material() doesn't support insertion in a random order (else materials are not assigned the right way)
for (unsigned int iMat=0; iMat<nbMat; ++iMat)
{
@@ -580,7 +580,7 @@ void WriterNodeVisitor::writeMaterials()
if(_imageSet.find(mat.image.get()) == _imageSet.end())
{
_imageSet.insert(mat.image.get());
osgDB::writeImageFile(*(mat.image), path);
osgDB::writeImageFile(*(mat.image), path, _options);
}
// Here we don't assume anything about initial flags state (actually it is set to LIB3DS_TEXTURE_NO_TILE by lib3DS, but this is subject to change)
if (mat.texture_transparency) tex.flags |= LIB3DS_TEXTURE_ALPHA_SOURCE;
@@ -590,7 +590,7 @@ void WriterNodeVisitor::writeMaterials()
}
if (!succeeded())
return;
lib3ds_file_insert_material(file3ds, mat3ds, itr->second.index);
lib3ds_file_insert_material(_file3ds, mat3ds, itr->second.index);
break; // Ugly thing (3)
}
assert(found); // Ugly thing (4) - Implementation error if !found
@@ -795,11 +795,11 @@ WriterNodeVisitor::buildMesh(osg::Geode & geo,
mesh->texcos[it->second][1] = vecs[it->first.first][1];
}
}
lib3ds_file_insert_mesh(file3ds, mesh, _lastMeshIndex);
lib3ds_file_insert_mesh(_file3ds, mesh, _lastMeshIndex);
++_lastMeshIndex;
Lib3dsMeshInstanceNode * node3ds = lib3ds_node_new_mesh_instance(mesh, mesh->name, NULL, NULL, NULL);
lib3ds_file_append_node(file3ds, reinterpret_cast<Lib3dsNode*>(node3ds), reinterpret_cast<Lib3dsNode*>(_cur3dsNode));
lib3ds_file_append_node(_file3ds, reinterpret_cast<Lib3dsNode*>(node3ds), reinterpret_cast<Lib3dsNode*>(_cur3dsNode));
}
unsigned int
@@ -1066,7 +1066,7 @@ void WriterNodeVisitor::apply3DSMatrixNode(osg::Node &node, const osg::Matrix *
node3ds = lib3ds_node_new_mesh_instance(NULL, getUniqueName(node.getName().empty() ? node.className() : node.getName(), prefix).c_str(), NULL, NULL, NULL);
}
lib3ds_file_append_node(file3ds, reinterpret_cast<Lib3dsNode*>(node3ds), reinterpret_cast<Lib3dsNode*>(parent));
lib3ds_file_append_node(_file3ds, reinterpret_cast<Lib3dsNode*>(node3ds), reinterpret_cast<Lib3dsNode*>(parent));
_cur3dsNode = node3ds;
}

View File

@@ -201,7 +201,7 @@ class WriterNodeVisitor: public osg::NodeVisitor
bool _succeeded;
std::string _directory;
std::string _srcDirectory;
Lib3dsFile * file3ds;
Lib3dsFile * _file3ds;
StateSetStack _stateSetStack;
osg::ref_ptr<osg::StateSet> _currentStateSet;
std::map<std::string, unsigned int> _mapPrefix; ///< List of next number to use in unique name generation, for each prefix
@@ -210,7 +210,7 @@ class WriterNodeVisitor: public osg::NodeVisitor
unsigned int _lastMaterialIndex;
unsigned int _lastMeshIndex;
Lib3dsMeshInstanceNode * _cur3dsNode;
const osgDB::ReaderWriter::Options* options;
const osgDB::ReaderWriter::Options* _options;
unsigned int _imageCount;
bool _extendedFilePaths;
std::set<osg::Image *> _imageSet;