Show
Ignore:
Timestamp:
01/16/08 16:07:40 (1 year ago)
Author:
cneumann
Message:

changed: - factory functions return a TransitPtr? that can not be implicitly

converted to C Ptr. Should help with porting.

added: - GlobalRefPtr?, needed for cases where upon return from main

a RefPtr? goes out of scope (it would attempt to access the
FCFactory which is already shutdown at that point).

status: - vrml loader does not compile (needs porting to ref ptr)

  • tutorials compile, run and exit cleanly
  • multithreading and cluster are untested, yet
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/Carsten_PtrWork2/Source/System/FileIO/OBJ/OSGOBJSceneFileType.cpp

    r1023 r1039  
    134134// 
    135135//------------------------------ 
    136 NodePtr OBJSceneFileType::read(std::istream &is, const Char8 *) const 
     136NodeTransitPtr OBJSceneFileType::read(std::istream &is, const Char8 *) const 
    137137{ 
    138     NodePtr rootPtr, nodePtr; 
     138    NodeRefPtr rootPtr, nodePtr; 
    139139    std::string elem; 
    140140    std::map<std::string, DataElem>::const_iterator elemI; 
     
    143143    Vec2r vec2r; 
    144144    Real32 x,y,z; 
    145     GeoPnt3rPropertyPtr coordPtr    = GeoPnt3rProperty::create(); 
    146     GeoVec2rPropertyPtr texCoordPtr = GeoVec2rProperty::create(); 
    147     GeoVec3rPropertyPtr normalPtr   = GeoVec3rProperty::create(); 
    148     GeometryPtr geoPtr; 
    149     GeoIntegralPropertyPtr posIndexPtr, texIndexPtr, normalIndexPtr; 
    150     GeoIntegralPropertyPtr lensPtr; 
    151     GeoIntegralPropertyPtr typePtr; 
     145    GeoPnt3rProperty::ObjRefPtr coordPtr    = GeoPnt3rProperty::create(); 
     146    GeoVec2rProperty::ObjRefPtr texCoordPtr = GeoVec2rProperty::create(); 
     147    GeoVec3rProperty::ObjRefPtr normalPtr   = GeoVec3rProperty::create(); 
     148    Geometry::ObjRefPtr geoPtr; 
     149    GeoIntegralProperty::ObjRefPtr posIndexPtr, texIndexPtr, normalIndexPtr; 
     150    GeoIntegralProperty::ObjRefPtr lensPtr; 
     151    GeoIntegralProperty::ObjRefPtr typePtr; 
    152152    DataElem dataElem; 
    153153    Char8 strBuf[8192], *token, *nextToken; 
     
    156156    Int32 i,j,n,primCount[3]; 
    157157    std::list<Mesh> meshList; 
    158     std::map<std::string, SimpleTexturedMaterialPtr> mtlMap; 
    159     std::map<std::string, SimpleTexturedMaterialPtr>::iterator mtlI; 
     158    std::map<std::string, SimpleTexturedMaterialRefPtr> mtlMap; 
     159    std::map<std::string, SimpleTexturedMaterialRefPtr>::iterator mtlI; 
    160160    Mesh emptyMesh; 
    161161    Face emptyFace; 
     
    291291        for (meshI = meshList.begin(); meshI != meshList.end(); meshI++) 
    292292        { 
    293             geoPtr   = Geometry::create(); 
    294             posIndexPtr = NullFC; 
    295             texIndexPtr = NullFC; 
     293            geoPtr         = Geometry::create(); 
     294            posIndexPtr    = NullFC; 
     295            texIndexPtr    = NullFC; 
    296296            normalIndexPtr = NullFC; 
    297             lensPtr  = GeoUIntProperty::create(); 
    298             typePtr  = GeoUInt8Property::create(); 
     297            lensPtr        = GeoUIntProperty::create(); 
     298            typePtr        = GeoUInt8Property::create(); 
    299299 
    300300            // create and check mesh index mask 
     
    461461                    { 
    462462                        rootPtr = Node::create(); 
    463                         rootPtr->setCore ( Group::create() ); 
     463                        rootPtr->setCore (GroupRefPtr(Group::create())); 
    464464                        rootPtr->addChild(nodePtr); 
    465465                    } 
     
    480480        SceneFileHandler::the()->updateReadProgress(100); 
    481481#endif 
    482     return rootPtr
     482    return NodeTransitPtr(rootPtr)
    483483} 
    484484 
     
    761761 
    762762Int32 OBJSceneFileType::readMTL ( const Char8 *fileName, 
    763                                   std::map<std::string, SimpleTexturedMaterialPtr> & mtlMap ) 
     763                                  std::map<std::string, SimpleTexturedMaterialRefPtr> & mtlMap ) 
    764764  const 
    765765{ 
     
    787787 
    788788    std::ifstream in(fullFilePath.c_str()); 
    789     SimpleTexturedMaterialPtr mtlPtr = NullFC
     789    SimpleTexturedMaterialRefPtr mtlPtr
    790790    Real32 a,b,c; 
    791791    std::string elem; 
    792792    std::map<std::string, MaterialElem>::const_iterator elemI; 
    793793    MaterialElem mtlElem; 
    794     std::map<std::string, OSG::ImagePtr> imageMap; 
    795     std::map<std::string, OSG::ImagePtr>::iterator iI; 
    796     ImagePtr image = NullFC
     794    std::map<std::string, OSG::ImageRefPtr> imageMap; 
     795    std::map<std::string, OSG::ImageRefPtr>::iterator iI; 
     796    ImageRefPtr image
    797797    bool constDiffuse = false, constAmbient = false, constSpecular = false; 
    798798 
     
    935935        } 
    936936    } 
     937     
    937938    return mtlCount; 
    938939}