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/OSB/OSGNFIOGeometry.cpp

    r1023 r1039  
    119119} 
    120120 
    121 FieldContainerPtr NFIOGeometry::readFC(const std::string &/*typeName*/) 
     121FieldContainerTransitPtr NFIOGeometry::readFC(const std::string &/*typeName*/) 
    122122{ 
    123123    FDEBUG(("NFIOGeometry::readFC\n")); 
    124124     
    125     GeometryPtr geo = Geometry::create(); 
     125    GeometryRefPtr geo = Geometry::create(); 
    126126     
    127127    UInt16 version; 
     
    363363     
    364364        if(fieldName.empty()) 
    365             return geo
     365            return FieldContainerTransitPtr(geo)
    366366 
    367367        // qpositions 
     
    371371            _in->getValue(fieldName); 
    372372            if(fieldName.empty()) 
    373                 return geo
     373                return FieldContainerTransitPtr(geo)
    374374        } 
    375375     
     
    380380            _in->getValue(fieldName); 
    381381            if(fieldName.empty()) 
    382                 return geo
     382                return FieldContainerTransitPtr(geo)
    383383        } 
    384384     
     
    389389            _in->getValue(fieldName); 
    390390            if(fieldName.empty()) 
    391                 return geo
     391                return FieldContainerTransitPtr(geo)
    392392        } 
    393393     
     
    398398            _in->getValue(fieldName); 
    399399            if(fieldName.empty()) 
    400                 return geo
    401         } 
    402     } 
    403  
    404     return geo
    405 } 
    406  
    407 void NFIOGeometry::readQuantizedPositions(GeometryPtr &geo) 
     400                return FieldContainerTransitPtr(geo)
     401        } 
     402    } 
     403 
     404    return FieldContainerTransitPtr(geo)
     405} 
     406 
     407void NFIOGeometry::readQuantizedPositions(GeometryPtr geo) 
    408408{ 
    409409    // read quantized normals. 
     
    412412    _in->getValue(fieldType); 
    413413     
    414     GeoPnt3fPropertyPtr positions = GeoPnt3fProperty::create(); 
     414    GeoPnt3fPropertyRefPtr positions = GeoPnt3fProperty::create(); 
    415415    readQuantizedVectors<Pnt3f>(positions); 
    416416     
     
    418418} 
    419419 
    420 void NFIOGeometry::readQuantizedNormals(GeometryPtr &geo) 
     420void NFIOGeometry::readQuantizedNormals(GeometryPtr geo) 
    421421{ 
    422422    // read quantized normals. 
     
    425425    _in->getValue(fieldType); 
    426426     
    427     GeoVec3fPropertyPtr normals = GeoVec3fProperty::create(); 
     427    GeoVec3fPropertyRefPtr normals = GeoVec3fProperty::create(); 
    428428    readQuantizedVectors<Vec3f>(normals); 
    429429     
     
    431431} 
    432432 
    433 void NFIOGeometry::readQuantizedTexCoords(GeometryPtr &geo) 
     433void NFIOGeometry::readQuantizedTexCoords(GeometryPtr geo) 
    434434{ 
    435435    // read quantized texcoords. 
     
    438438    _in->getValue(fieldType); 
    439439     
    440     GeoVec2fPropertyPtr texcoords = GeoVec2fProperty::create(); 
     440    GeoVec2fPropertyRefPtr texcoords = GeoVec2fProperty::create(); 
    441441    readQuantizedVectors<Vec2f>(texcoords); 
    442442     
     
    444444} 
    445445 
    446 void NFIOGeometry::readPackedIndices(GeometryPtr &geo, UInt32 size) 
     446void NFIOGeometry::readPackedIndices(GeometryPtr geo, UInt32 size) 
    447447{ 
    448448    // read packed indices. 
     
    466466    _in->getValue(noe); 
    467467     
    468     GeoIntegralPropertyPtr indices = NullFC
     468    GeoIntegralPropertyRefPtr indices
    469469    bool using_16bit = false; 
    470470    if(getOptions().unpack16BitIndices()) 
     
    497497    if(using_16bit) 
    498498    { 
    499         MFUInt16 *ind = dynamic_cast<GeoUInt16PropertyPtr>(indices)->editFieldPtr(); 
     499        MFUInt16 *ind = 
     500            boost::dynamic_pointer_cast<GeoUInt16Property>(indices)->editFieldPtr(); 
    500501        ind->reserve(indices_size); 
    501502        BitUnpacker unpacker(buffer, max); 
     
    505506    else 
    506507    { 
    507         MFUInt32 *ind = dynamic_cast<GeoUInt32PropertyPtr>(indices)->editFieldPtr(); 
     508        MFUInt32 *ind = 
     509            boost::dynamic_pointer_cast<GeoUInt32Property>(indices)->editFieldPtr(); 
    508510        ind->reserve(indices_size); 
    509511        BitUnpacker unpacker(buffer, max); 
     
    621623} 
    622624 
    623 void NFIOGeometry::writeQuantizedPositions(const GeometryPtr &geo, UInt8 res) 
     625void NFIOGeometry::writeQuantizedPositions(const GeometryPtr geo, UInt8 res) 
    624626{ 
    625627    GeoPnt3fPropertyPtr positions = dynamic_cast<GeoPnt3fPropertyPtr>(geo->getPositions()); 
     
    632634 
    633635 
    634 void NFIOGeometry::writeQuantizedNormals(const GeometryPtr &geo, UInt8 res) 
     636void NFIOGeometry::writeQuantizedNormals(const GeometryPtr geo, UInt8 res) 
    635637{ 
    636638    GeoVec3fPropertyPtr normals = dynamic_cast<GeoVec3fPropertyPtr>(geo->getNormals()); 
     
    642644} 
    643645 
    644 void NFIOGeometry::writeQuantizedTexCoords(const GeometryPtr &geo, UInt8 res) 
     646void NFIOGeometry::writeQuantizedTexCoords(const GeometryPtr geo, UInt8 res) 
    645647{ 
    646648    GeoVec2fPropertyPtr texcoords = dynamic_cast<GeoVec2fPropertyPtr>(geo->getTexCoords()); 
     
    652654} 
    653655 
    654 void NFIOGeometry::writePackedIndices(const GeometryPtr &geo) 
     656void NFIOGeometry::writePackedIndices(const GeometryPtr geo) 
    655657{ 
    656658    // write packed indices. 
     
    835837        for(UInt32 i=0;i<size;++i) 
    836838        { 
    837             GeoUInt32PropertyPtr indices = GeoUInt32Property::create(); 
     839            GeoUInt32PropertyRefPtr indices = GeoUInt32Property::create(); 
    838840            GeoUInt32Property::StoredFieldType *indicesp = indices->editFieldPtr(); 
    839841            indices_list.push_back(indices);