Changeset 1190

Show
Ignore:
Timestamp:
04/25/08 03:25:46 (2 weeks ago)
Author:
vossg
Message:

fixed: adjusted collada loader to the new fc ptr structure

Notes: looses memory somewhere inside the dom

need dom 1.4.1 (dom 2.0 changed the integration so
it will not work)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Source/System/FileIO/Collada/OSGColladaFileType.cpp

    r785 r1190  
    138138 
    139139 
    140 NodePtr ColladaFileType::read(      std::istream &is, 
    141                               const Char8        *fileNameOrExtension) const 
     140NodeTransitPtr ColladaFileType::read( 
     141          std::istream &is, 
     142    const Char8        *fileNameOrExtension) const 
    142143{ 
    143     NodePtr returnValue = NullFC
     144    NodeTransitPtr returnValue(NULL)
    144145 
    145146    ColladaLoader *pLoader = new ColladaLoader; 
  • trunk/Source/System/FileIO/Collada/OSGColladaFileType.h

    r785 r1190  
    183183    /*------------------------- your_category -------------------------------*/ 
    184184 
    185     virtual NodePtr read(      std::istream &is, 
    186                          const Char8        *fileNameOrExtension) const; 
     185    virtual NodeTransitPtr read(      std::istream &is, 
     186                                 const Char8        *fileNameOrExtension) const; 
    187187 
    188188    /*------------------------- your_category -------------------------------*/ 
  • trunk/Source/System/FileIO/Collada/OSGColladaIntegration.cpp

    r887 r1190  
    188188VisualSceneIntegration::~VisualSceneIntegration(void) 
    189189{ 
    190     OSG::subRef(_pScene)
     190    _pScene = NULL
    191191} 
    192192 
     
    322322        _pTransform = Transform::create(); 
    323323 
    324         OSG::addRef(_pTransform); 
    325  
    326324        _pNode->setCore(_pTransform); 
    327325    } 
     
    354352    { 
    355353        _pTransform = Transform::create(); 
    356  
    357         OSG::addRef(_pTransform); 
    358354 
    359355        _pNode->setCore(_pTransform); 
     
    392388        _pTransform = Transform::create(); 
    393389 
    394         OSG::addRef(_pTransform); 
    395  
    396390        _pNode->setCore(_pTransform); 
    397391    } 
     
    453447NodeIntegration::~NodeIntegration(void) 
    454448{ 
    455     OSG::subRef(_pNode     )
    456     OSG::subRef(_pTransform)
     449    _pNode      = NULL
     450    _pTransform = NULL
    457451} 
    458452 
     
    503497 
    504498    _pNode = Node::create(); 
    505  
    506     OSG::addRef(_pNode); 
    507499 
    508500    daeMetaElement *pMeta = _pElement->getMeta(); 
     
    565557InstanceIntegration::~InstanceIntegration(void) 
    566558{ 
    567     OSG::subRef(_pNode)
    568 } 
    569  
    570 NodePtr InstanceIntegration::getInstance(void) 
     559    _pNode = NULL
     560} 
     561 
     562NodeTransitPtr InstanceIntegration::getInstance(void) 
    571563{ 
    572564    if(_pNode == NullFC) 
    573         return NullFC
     565        return NodeTransitPtr(NullFC)
    574566 
    575567    if(_uiCount == 0) 
     
    577569        ++_uiCount; 
    578570 
    579         return _pNode
     571        return NodeTransitPtr(_pNode)
    580572    } 
    581573    else 
     
    934926        for(UInt32 i = 0; i < geoIt->second.size(); ++i) 
    935927        { 
    936             MaterialGroupPtr pMatGroup     = MaterialGroup::create(); 
    937             NodePtr          pMatGroupNode = Node         ::create(); 
    938              
    939             NodePtr          pGeoNode      = Node         ::create(); 
     928            MaterialGroupUnrecPtr pMatGroup     = MaterialGroup::create(); 
     929            NodeUnrecPtr          pMatGroupNode = Node         ::create(); 
     930             
     931            NodeUnrecPtr          pGeoNode      = Node         ::create(); 
    940932 
    941933#ifdef OSG_DEBUG_PRINT 
     
    979971    domInputLocal_Array       &aVertexInput, 
    980972    domInputLocalOffset_Array &aInput, 
    981     GeoUInt32PropertyPtr      &pLengthsOut, 
    982     GeoUInt8PropertyPtr       &pTypesOut, 
     973    GeoUInt32PropertyUnrecPtr &pLengthsOut, 
     974    GeoUInt8PropertyUnrecPtr  &pTypesOut, 
    983975    PropVec                   &vPropVecOut  ) 
    984976{ 
     
    10351027                SemanticToPropGeoIndex(aInput[i]->getSemantic()); 
    10361028 
    1037             GeoUInt32PropertyPtr pProp  = GeoUInt32Property::create(); 
    1038             GeoVectorPropertyPtr pVProp = NullFC; 
     1029            GeoUInt32PropertyUnrecPtr pProp  = GeoUInt32Property::create(); 
     1030            GeoVectorPropertyUnrecPtr pVProp = NullFC; 
    10391031 
    10401032            if(uiPropIdx == 0xFFFE) 
     
    11261118                    else 
    11271119                    { 
    1128                         OSG::subRef(pProp)
     1120                        pProp = NullFC
    11291121                    } 
    11301122                } 
     
    11821174            { 
    11831175                vPropVecOut[aInput[i]->getOffset()] = 
    1184                     static_cast<GeoUInt32PropertyPtr>( 
     1176                    static_pointer_cast<GeoUInt32Property>( 
    11851177                        propIt->second.first); 
    11861178            } 
     
    12011193    domInputLocalOffset_Array &aInput   = pPoly->getInput_array(); 
    12021194 
    1203     GeoUInt32PropertyPtr       pLengths = NullFC; 
    1204     GeoUInt8PropertyPtr        pTypes   = NullFC; 
     1195    GeoUInt32PropertyUnrecPtr  pLengths = NullFC; 
     1196    GeoUInt8PropertyUnrecPtr   pTypes   = NullFC; 
    12051197 
    12061198    PropVec                    aProps; 
     
    12531245    domInputLocalOffset_Array &aInput   = pPoly->getInput_array(); 
    12541246 
    1255     GeoUInt32PropertyPtr       pLengths = NullFC; 
    1256     GeoUInt8PropertyPtr        pTypes   = NullFC; 
     1247    GeoUInt32PropertyUnrecPtr  pLengths = NullFC; 
     1248    GeoUInt8PropertyUnrecPtr   pTypes   = NullFC; 
    12571249 
    12581250    PropVec                    aProps; 
     
    12981290    domInputLocalOffset_Array &aInput   = pTriangles->getInput_array(); 
    12991291 
    1300     GeoUInt32PropertyPtr       pLengths = NullFC; 
    1301     GeoUInt8PropertyPtr        pTypes   = NullFC; 
     1292    GeoUInt32PropertyUnrecPtr  pLengths = NullFC; 
     1293    GeoUInt8PropertyUnrecPtr   pTypes   = NullFC; 
    13021294 
    13031295    PropVec                    aProps; 
     
    16101602SourceIntegration::~SourceIntegration(void) 
    16111603{ 
    1612     OSG::subRef(_pVec3fProp)
    1613     OSG::subRef(_pPnt3fProp)
    1614     OSG::subRef(_pVec2fProp)
     1604    _pVec3fProp = NULL
     1605    _pPnt3fProp = NULL
     1606    _pVec2fProp = NULL
    16151607} 
    16161608 
     
    16721664 
    16731665    _pVec3fProp = GeoVec3fProperty::create(); 
    1674  
    1675     OSG::addRef(_pVec3fProp); 
    16761666 
    16771667    UInt32 uiCurr = 0; 
     
    17091699    _pPnt3fProp = GeoPnt3fProperty::create(); 
    17101700 
    1711     OSG::addRef(_pPnt3fProp); 
    1712  
    17131701    UInt32 uiCurr = 0; 
    17141702    Vec3f  tmpVec; 
     
    17441732 
    17451733    _pVec2fProp = GeoVec2fProperty::create(); 
    1746  
    1747     OSG::addRef(_pVec2fProp); 
    17481734 
    17491735    UInt32 uiCurr = 0; 
     
    17801766                                          Real32    fTransparency) 
    17811767{ 
    1782     MaterialChunkPtr pMatChunk = MaterialChunk::create(); 
     1768    MaterialChunkUnrecPtr pMatChunk = MaterialChunk::create(); 
    17831769 
    17841770    Color4f colVal; 
     
    19371923            if(pTexObj != NULL) 
    19381924            { 
    1939                 TextureEnvChunkPtr pTexEnv = TextureEnvChunk::create(); 
     1925                TextureEnvChunkUnrecPtr pTexEnv = TextureEnvChunk::create(); 
    19401926                 
    19411927                _pMaterial->addChunk(pTexObj); 
     
    19941980            if(pImage != NullFC) 
    19951981            { 
    1996                 TextureObjChunkPtr pTexObj = TextureObjChunk::create(); 
    1997                 TextureEnvChunkPtr pTexEnv = TextureEnvChunk::create(); 
     1982                TextureObjChunkUnrecPtr pTexObj = TextureObjChunk::create(); 
     1983                TextureEnvChunkUnrecPtr pTexEnv = TextureEnvChunk::create(); 
    19981984                 
    19991985                pTexObj->setImage(pImage); 
     
    20432029            if(pTexObj != NULL) 
    20442030            { 
    2045                 TextureEnvChunkPtr pTexEnv = TextureEnvChunk::create(); 
     2031                TextureEnvChunkUnrecPtr pTexEnv = TextureEnvChunk::create(); 
    20462032                 
    20472033                _pMaterial->addChunk(pTexObj); 
     
    21002086            if(pImage != NullFC) 
    21012087            { 
    2102                 TextureObjChunkPtr pTexObj = TextureObjChunk::create(); 
    2103                 TextureEnvChunkPtr pTexEnv = TextureEnvChunk::create(); 
     2088                TextureObjChunkUnrecPtr pTexObj = TextureObjChunk::create(); 
     2089                TextureEnvChunkUnrecPtr pTexEnv = TextureEnvChunk::create(); 
    21042090                 
    21052091                pTexObj->setImage(pImage); 
     
    22762262EffectIntegration::~EffectIntegration(void) 
    22772263{ 
    2278     OSG::subRef(_pMaterial)
     2264    _pMaterial = NULL
    22792265} 
    22802266 
     
    24362422ImageIntegration::~ImageIntegration(void) 
    24372423{ 
    2438     OSG::subRef(_pImage)
     2424    _pImage = NULL
    24392425} 
    24402426 
     
    25102496                fprintf(stderr, "Image loaded\n"); 
    25112497#endif 
    2512                 OSG::addRef(_pImage); 
    25132498            } 
    25142499        } 
     
    25352520Sampler2DIntegration::~Sampler2DIntegration(void) 
    25362521{ 
    2537     OSG::subRef(_pTexObj)
     2522    _pTexObj = NULL
    25382523} 
    25392524 
     
    26392624 
    26402625        _pTexObj = pSurfaceInt->getTexObj(); 
    2641  
    2642         OSG::addRef(_pTexObj); 
    26432626    } 
    26442627 
     
    26642647SurfaceIntegration::~SurfaceIntegration(void) 
    26652648{ 
    2666     OSG::subRef(_pTexObj)
     2649    _pTexObj = NULL
    26672650} 
    26682651 
  • trunk/Source/System/FileIO/Collada/OSGColladaIntegration.h

    r829 r1190  
    156156    static daeMetaElement *_pMeta; 
    157157 
    158     NodePtr _pScene; 
     158    NodeUnrecPtr _pScene; 
    159159 
    160160  public: 
     
    188188    static daeMetaElement *_pMeta; 
    189189 
    190     NodePtr      _pNode; 
    191     TransformPtr _pTransform; 
     190    NodeUnrecPtr      _pNode; 
     191    TransformUnrecPtr _pTransform; 
    192192 
    193193    bool handleNode     (daeElementRef pElem); 
     
    225225    typedef ColladaIntegrationBase Inherited; 
    226226 
    227     NodePtr _pNode; 
    228     UInt32  _uiCount; 
     227    NodeUnrecPtr _pNode; 
     228    UInt32       _uiCount; 
    229229 
    230230  public: 
     
    233233    ~InstanceIntegration(void); 
    234234 
    235     NodePtr getInstance(void); 
     235    NodeTransitPtr getInstance(void); 
    236236}; 
    237237 
     
    252252 
    253253 
    254     typedef std::pair  <GeoIntegralPropertyPtr, 
    255                         GeoVectorPropertyPtr   >           PropIndexPair; 
     254    typedef std::pair  <GeoIntegralPropertyUnrecPtr, 
     255                        GeoVectorPropertyUnrecPtr  >           PropIndexPair; 
    256256     
    257257    typedef std::map   <std::string,   
    258                         PropIndexPair          >           PropIndexMap; 
     258                        PropIndexPair              >           PropIndexMap; 
    259259    typedef std::map   <std::string,   
    260                         PropIndexPair          >::iterator PropIndexMapIt; 
     260                        PropIndexPair              >::iterator PropIndexMapIt; 
    261261 
    262262 
     
    264264    struct GeometryInfo 
    265265    { 
    266         GeometryPtr   pGeo; 
    267         PropIndexMap _mPropIndexMap; 
     266        GeometryUnrecPtr  pGeo; 
     267        PropIndexMap     _mPropIndexMap; 
    268268    }; 
    269269 
     
    289289                                  domInputLocal_Array        &aVertexInput, 
    290290                                  domInputLocalOffset_Array  &aInput, 
    291                                   GeoUInt32PropertyPtr       &pLengthsOut, 
    292                                   GeoUInt8PropertyPtr        &pTypesOut, 
     291                                  GeoUInt32PropertyUnrecPtr  &pLengthsOut, 
     292                                  GeoUInt8PropertyUnrecPtr   &pTypesOut, 
    293293                                  PropVec                    &pPropVecOut ); 
    294294 
     
    382382    static daeMetaElement *_pMeta; 
    383383     
    384     GeoVec3fPropertyPtr    _pVec3fProp; 
    385     GeoPnt3fPropertyPtr    _pPnt3fProp; 
    386     GeoVec2fPropertyPtr    _pVec2fProp; 
     384    GeoVec3fPropertyUnrecPtr    _pVec3fProp; 
     385    GeoPnt3fPropertyUnrecPtr    _pPnt3fProp; 
     386    GeoVec2fPropertyUnrecPtr    _pVec2fProp; 
    387387 
    388388  public: 
     
    422422    typedef ColladaIntegrationBase Inherited; 
    423423 
    424     static daeMetaElement   *_pMeta; 
    425            ChunkMaterialPtr  _pMaterial; 
     424    static daeMetaElement        *_pMeta; 
     425           ChunkMaterialUnrecPtr  _pMaterial; 
    426426     
    427427           std::vector<std::string>              _vTexCoordMapping; 
     
    489489    static daeMetaElement *_pMeta; 
    490490 
    491     ImagePtr      _pImage; 
     491    ImageUnrecPtr          _pImage; 
    492492 
    493493  public: 
     
    520520    typedef ColladaIntegrationBase Inherited; 
    521521 
    522     static daeMetaElement *_pMeta; 
    523  
    524     static EffectIntegration *_pEffectInt; 
    525  
    526            TextureObjChunkPtr _pTexObj; 
     522    static daeMetaElement           *_pMeta; 
     523 
     524    static EffectIntegration       *_pEffectInt; 
     525 
     526           TextureObjChunkUnrecPtr _pTexObj; 
    527527 
    528528  public: 
     
    557557    typedef ColladaIntegrationBase Inherited; 
    558558 
    559     static daeMetaElement *_pMeta; 
    560  
    561     TextureObjChunkPtr _pTexObj; 
     559    static daeMetaElement   *_pMeta; 
     560 
     561    TextureObjChunkUnrecPtr _pTexObj; 
    562562 
    563563  public: 
  • trunk/Source/System/FileIO/Collada/OSGColladaLoader.cpp

    r829 r1190  
    122122} 
    123123 
    124 NodePtr ColladaLoader::read(      std::istream  &is,  
    125                             const Char8         *szFileName) 
     124NodeTransitPtr ColladaLoader::read(      std::istream  &is,  
     125                                   const Char8         *szFileName) 
    126126{ 
    127     NodePtr returnValue = NullFC
     127    NodeTransitPtr returnValue(NullFC)
    128128 
    129129#ifdef OSG_WITH_COLLADA 
     
    229229#endif 
    230230 
     231    pInput->clear(); 
     232 
     233    pInput->setDatabase(NULL); 
     234 
     235    delete pDataBase; 
     236    delete pInput; 
     237 
     238    daeMetaElement::releaseMetas(); 
     239 
    231240    return returnValue; 
    232241} 
  • trunk/Source/System/FileIO/Collada/OSGColladaLoader.h

    r785 r1190  
    187187    /*------------------------- your_operators ------------------------------*/ 
    188188 
    189     virtual NodePtr read(      std::istream  &is,  
    190                          const Char8         *szFileName); 
     189    virtual NodeTransitPtr read(      std::istream  &is,  
     190                                const Char8         *szFileName); 
    191191 
    192192    /*------------------------- your_operators ------------------------------*/