Show
Ignore:
Timestamp:
02/11/10 12:56:43 (3 years ago)
Author:
robert
Message:

From Sukender, "- Added support for extended filenames (=not 8.3) for images: reads without crashing, optionnally write extended filenames (correctly truncate names if option is OFF). Write option is OFF by default.
- Improved identifiers generation in duplicate name handling (was limited to 1000 name collisions, which can be very short for some usages).
- Set all read/write operations use a custom log function that will redirect lib3DS log to osg::notify() (was only used for streams)
- Removed custom code (now uses osgDB::getFilePath())
- Added missing supportsOption() calls
- Cleaned a few minor things"

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgPlugins/3ds/WriterNodeVisitor.h

    r10945 r11056  
    4242#include "lib3ds/lib3ds.h" 
    4343#include "WriterCompareTriangle.h" 
     44#include <set> 
    4445 
    4546void copyOsgMatrixToLib3dsMatrix(Lib3dsMatrix lib3ds_matrix, const osg::Matrix& osg_matrix); 
     
    5051class WriterNodeVisitor: public osg::NodeVisitor 
    5152{ 
    52  
    5353    public: 
    5454        static const unsigned int MAX_VERTICES = 65000; 
     
    5757        WriterNodeVisitor(Lib3dsFile * file3ds, const std::string & fileName,  
    5858                        const osgDB::ReaderWriter::Options* options,  
    59                         const std::string & srcDirectory) : 
    60             osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), 
    61             _suceedLastApply(true), 
    62             _srcDirectory(srcDirectory), 
    63             file3ds(file3ds), 
    64             _currentStateSet(new osg::StateSet()), 
    65             _lastGeneratedNumberedName(0), 
    66             _lastMaterialIndex(0), 
    67             _lastMeshIndex(0), 
    68             _cur3dsNode(NULL), 
    69             options(options), 
    70             _imageCount(0) 
    71         { 
    72             //supportsOption("flipTexture", "flip texture upside-down"); 
    73             if (!fileName.empty()) 
    74                 _directory = options->getDatabasePathList().empty() ? osgDB::getFilePath(fileName) : options->getDatabasePathList().front(); 
    75         } 
     59                        const std::string & srcDirectory); 
    7660 
    7761        bool        suceedLastApply() const; 
     
    216200        StateSetStack                       _stateSetStack; 
    217201        osg::ref_ptr<osg::StateSet>         _currentStateSet; 
    218         std::map<std::string, unsigned int> _mapPrefix; 
     202        std::map<std::string, unsigned int> _mapPrefix;            ///< List of next number to use in unique name generation, for each prefix 
    219203        std::set<std::string>                _nameMap; 
    220204        MaterialMap                         _materialMap; 
    221         unsigned int                        _lastGeneratedNumberedName; 
    222205        unsigned int                        _lastMaterialIndex; 
    223206        unsigned int                        _lastMeshIndex; 
     
    225208        const osgDB::ReaderWriter::Options* options; 
    226209        unsigned int                        _imageCount; 
     210        bool                                _extendedFilePaths; 
     211        std::set<osg::Image *>              _imageSet; 
    227212}; 
    228213