Changeset 13342

Show
Ignore:
Timestamp:
11/09/15 17:13:03 (2 years ago)
Author:
robert
Message:

Release OpenSceneGraph-3.5.1

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgPlugins/3ds/ReaderWriter3DS.cpp

    r13041 r13342  
    600600        } 
    601601 
     602        // MIKEC: "group" handles the node transform, siblings, and our child geometry if we don't want an MT node for it 
     603        // if noMatrixTransforms is not set, we create a transform node for the mesh's matrix 
     604        osg::Group* meshTransform=NULL; 
     605 
     606        if ((noMatrixTransforms==false) && meshAppliedMatPtr) { // we are allowed to have, and need another matrixtransform 
     607            meshTransform=new osg::MatrixTransform(meshMat); 
     608            meshAppliedMatPtr=NULL; // since meshTransform applies it 
     609 
     610            meshTransform->setName("3DSMeshMatrix");  
     611            if (group) group->addChild(meshTransform); 
     612        } else { 
     613            meshTransform=group; // don't need the meshTransform node - note group can be NULL 
     614        } 
     615 
    602616        if (group) 
    603617        { 
    604618            // add our geometry to group (where our children already are) 
    605619            // creates geometry under modifier node 
    606             processMesh(drawStateMap,group,mesh,meshAppliedMatPtr); 
     620            processMesh(drawStateMap,meshTransform,mesh,meshAppliedMatPtr); 
    607621            return group; 
    608622        } 
    609623        else 
    610624        { 
    611             // didnt use group for children 
    612             // return a ptr directly to the Geode for this mesh 
    613             return processMesh(drawStateMap,NULL,mesh,meshAppliedMatPtr); 
     625            // didnt use group for children, return a ptr directly to the Geode for this mesh 
     626            // there is no group node but may have a meshTransform node to hold the meshes matrix 
     627            if (meshTransform) { 
     628                processMesh(drawStateMap,meshTransform,mesh,meshAppliedMatPtr); 
     629                return meshTransform; 
     630            } else { // no group or meshTransform nodes - create a new Geode and return that 
     631                return processMesh(drawStateMap,NULL,mesh,meshAppliedMatPtr); 
     632            } 
    614633        } 
    615634 
     
    793812    // if your model is broken, especially wrt object positions try setting this flag. If that fixes it, 
    794813    // send me the model 
    795     bool traverse_nodes=false; 
     814    bool traverse_nodes=true; 
    796815 
    797816    // MIKEC: have found 3ds files with NO node structure - only meshes, for this case we fall back to the old traverse-by-meshes code 
     
    800819    { 
    801820        OSG_WARN<<"Warning: in 3ds loader: file has no nodes, traversing by meshes instead"<< std::endl; 
    802         traverse_nodes=true; 
     821        traverse_nodes=false; 
    803822    } 
    804823 
    805824    osg::Node* group = NULL; 
    806825 
    807     if (traverse_nodes) // old method 
     826    if (!traverse_nodes) // old method, traverse by mesh 
    808827    { 
    809828        group = new osg::Group(); 
     
    11281147            else 
    11291148            { 
    1130                 OSG_WARN << "texture '"<<texture->name<<"' not found"<< std::endl; 
    1131                 return NULL; 
     1149                // MIKEC: We can still continue to call osgDB::readRefImageFile in case user has a ReadFileCallback registered  
     1150                //        in that case we just use the image's filename as it exists in the 3DS file 
     1151                fileName=texture->name; 
    11321152            } 
    11331153        }