Changeset 1035

Show
Ignore:
Timestamp:
12/21/07 16:07:14 (7 months ago)
Author:
cneumann
Message:

fixed: use of non-ref ptrs

first two tutorials

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/Carsten_PtrWork2/Source/System/Material/Base/OSGSimpleMaterial.cpp

    r1032 r1035  
    8080    { 
    8181        _materialChunk = MaterialChunk::create(); 
    82  
    83         addRef(_materialChunk); 
    8482    } 
    8583 
     
    9088        _blendChunk->setSrcFactor (GL_SRC_ALPHA); 
    9189        _blendChunk->setDestFactor(GL_ONE_MINUS_SRC_ALPHA); 
    92  
    93         addRef(_blendChunk); 
    9490    } 
    9591} 
     
    108104    Inherited::resolveLinks(); 
    109105 
    110     subRefLocalVar(_materialChunk)
    111     subRefLocalVar(_blendChunk   );     
     106    _materialChunk = NullFC
     107    _blendChunk    = NullFC; 
    112108} 
    113109 
     
    152148StatePtr SimpleMaterial::makeState(void) 
    153149{ 
    154     StatePtr state = State::create(); 
     150    StateRefPtr state = State::create(); 
    155151 
    156152    Color3f v3; 
     
    220216 
    221217        _pState->setDefaultSortKey(getContainerId(this)); 
    222  
    223         addRef(_pState); 
    224218    } 
    225219 
  • branches/Carsten_PtrWork2/Source/System/Material/Base/OSGSimpleMaterial.h

    r996 r1035  
    9898    // these chunks are used for rendering the material 
    9999 
    100     MaterialChunkPtr _materialChunk; 
    101     BlendChunkPtr    _blendChunk; 
     100    MaterialChunkInternalRefPtr _materialChunk; 
     101    BlendChunkInternalRefPtr    _blendChunk; 
    102102 
    103103    /*---------------------------------------------------------------------*/ 
  • branches/Carsten_PtrWork2/Source/System/NodeCores/Drawables/Base/OSGDrawableStatsAttachment.cpp

    r1018 r1035  
    134134*/ 
    135135 
    136 DrawableStatsAttachmentPtr DrawableStatsAttachment::calcStatic( 
     136DrawableStatsAttachmentRefPtr DrawableStatsAttachment::calcStatic( 
    137137    DrawablePtrArg pDrawable) 
    138138{ 
    139     DrawableStatsAttachmentPtr st = DrawableStatsAttachment::create(); 
     139    DrawableStatsAttachmentRefPtr st = DrawableStatsAttachment::create(); 
    140140 
    141141    if(pDrawable != NullFC) 
     
    151151    AttachmentContainerPtr obj) 
    152152{ 
    153     DrawableStatsAttachmentPtr st = DrawableStatsAttachment::create(); 
     153    DrawableStatsAttachmentRefPtr st = DrawableStatsAttachment::create(); 
    154154 
    155155    st->attachTo(obj); 
  • branches/Carsten_PtrWork2/Source/System/NodeCores/Drawables/Base/OSGDrawableStatsAttachment.h

    r998 r1035  
    8787    void                              reset(void); 
    8888 
    89     static DrawableStatsAttachmentPtr calcStatic(DrawablePtrArg pDrawable); 
     89    static DrawableStatsAttachmentRefPtr calcStatic(DrawablePtrArg pDrawable); 
    9090 
    9191    /*! \}                                                                 */ 
  • branches/Carsten_PtrWork2/Source/System/NodeCores/Groups/Base/OSGLight.cpp

    r997 r1035  
    151151Light::~Light(void) 
    152152{ 
    153     OSG::subRef(_pChunk     ); 
     153
     154 
     155void 
     156Light::resolveLinks(void) 
     157
     158    Inherited::resolveLinks(); 
     159     
     160    _pChunk = NullFC; 
    154161} 
    155162 
  • branches/Carsten_PtrWork2/Source/System/NodeCores/Groups/Base/OSGLight.h

    r997 r1035  
    118118  protected: 
    119119 
    120     typedef LightBase          Inherited; 
     120    typedef LightBase                 Inherited; 
    121121 
    122             LightChunkPtr    _pChunk; 
     122            LightChunkInternalRefPtr _pChunk; 
    123123 
    124124    /*---------------------------------------------------------------------*/ 
     
    136136    virtual ~Light(void); 
    137137 
     138    virtual void resolveLinks(void); 
     139     
    138140    /*! \}                                                                 */ 
    139141    /*---------------------------------------------------------------------*/ 
  • branches/Carsten_PtrWork2/Source/System/Window/Utilities/OSGSimpleSceneManager.cpp

    r1023 r1035  
    178178    The material used by the highlight object. 
    179179 */ 
    180 SimpleMaterialPtr SimpleSceneManager::_highlightMaterial; 
     180SimpleMaterialRefPtr SimpleSceneManager::_highlightMaterial; 
    181181 
    182182/*-------------------------------------------------------------------------*/ 
     
    240240    setRoot(NullFC); // sub root 
    241241 
    242     if(_internalRoot != NullFC) 
    243         subRef(_internalRoot); 
    244  
    245     if(_camera != NullFC) 
    246         subRef(_camera); 
     242    _internalRoot = NullFC; 
     243    _camera       = NullFC; 
    247244} 
    248245 
     
    438435    camera->setFar   (_camera->getFar()); 
    439436 
    440     for(UInt32 i=0;i<_win->getPort().size();++i) 
     437    for(UInt32 i = 0; i < _win->getPort().size(); ++i) 
    441438    { 
    442439        ViewportPtr vp = _win->getPort()[i]; 
     
    447444        } 
    448445    } 
    449  
    450     // destroy old camera. 
    451     addRef( camera); 
    452     subRef(_camera); 
    453446 
    454447    _camera = camera; 
     
    524517 
    525518    // the camera and light beacon 
    526     NodePtr cartN = Node::create(); 
    527     _cart = Transform::create(); 
     519    NodeRefPtr cartN = Node::create(); 
     520    _cart            = Transform::create(); 
    528521 
    529522    cartN->setCore(_cart); 
     
    533526    _headlight    = DirectionalLight::create(); 
    534527 
    535     addRef(_internalRoot); 
    536  
    537528    _internalRoot->setCore(_headlight); 
    538529    _internalRoot->addChild(cartN); 
    539  
    540530 
    541531    _headlight->setAmbient  (.3, .3, .3, 1); 
     
    548538    _camera = PerspectiveCamera::create(); 
    549539 
    550     addRef(_camera); 
    551  
    552540    _camera->setBeacon(cartN); 
    553541    _camera->setFov   (osgDegree2Rad(60.f)); 
     
    558546    if(_win->getPort().size() == 0) 
    559547    { 
    560         SolidBackgroundPtr bg = SolidBackground::create(); 
     548        SolidBackgroundRefPtr bg = SolidBackground::create(); 
    561549 
    562550        bg->setColor(Color3f(0.2, 0.2, 0.2)); 
     
    564552        _foreground = ImageForeground::create(); 
    565553 
    566         SimpleStatisticsForegroundPtr sf = SimpleStatisticsForeground::create(); 
     554        SimpleStatisticsForegroundRefPtr sf = SimpleStatisticsForeground::create(); 
    567555 
    568556        sf->setSize(25); 
     
    664652        addRef(_statforeground); 
    665653 
    666         ViewportPtr vp = Viewport::create(); 
     654        ViewportRefPtr vp = Viewport::create(); 
    667655 
    668656        vp->setCamera    (_camera); 
     
    725713void SimpleSceneManager::useOpenSGLogo(void) 
    726714{ 
    727     ImagePtr lo = Image::create(); 
     715    ImageRefPtr lo = Image::create(); 
    728716    ImageFileType::restore( lo, (UChar8*)LogoData, -1 ); 
    729717 
     
    798786    if(_highlightNode == NullFC) 
    799787    { 
    800         GeoUInt8PropertyPtr type = GeoUInt8Property::create(); 
     788        GeoUInt8PropertyRefPtr type = GeoUInt8Property::create(); 
    801789        GeoUInt8Property::StoredFieldType* t = type->editFieldPtr(); 
    802790        t->push_back(GL_LINE_STRIP); 
    803791        t->push_back(GL_LINES); 
    804792 
    805         GeoUInt32PropertyPtr lens = GeoUInt32Property::create(); 
     793        GeoUInt32PropertyRefPtr lens = GeoUInt32Property::create(); 
    806794        GeoUInt32Property::StoredFieldType* l = lens->editFieldPtr(); 
    807795        l->push_back(10); 
    808796        l->push_back(6); 
    809797 
    810         GeoUInt32PropertyPtr index = OSG::GeoUInt32Property::create(); 
     798        GeoUInt32PropertyRefPtr index = OSG::GeoUInt32Property::create(); 
    811799        GeoUInt32Property::StoredFieldType* idx = index->editFieldPtr(); 
    812800        idx->push_back(0); 
     
    839827        p->push_back(Pnt3f( 1,  1,  1)); 
    840828 
    841         GeometryPtr geo = Geometry::create(); 
     829        GeometryRefPtr geo = Geometry::create(); 
    842830        geo->setTypes     (type); 
    843831        geo->setLengths   (lens); 
     
    845833        geo->setPositions (_highlightPoints); 
    846834        geo->setMaterial  (_highlightMaterial); 
    847         addRef(geo); 
    848835 
    849836        _highlightNode = Node::create(); 
    850837        _highlightNode->setCore(geo); 
    851         addRef(_highlightNode); 
    852838    } 
    853839 
  • branches/Carsten_PtrWork2/Source/System/Window/Utilities/OSGSimpleSceneManager.h

    r1004 r1035  
    202202    /*! \{                                                                 */ 
    203203 
    204     WindowPtr                    _win; 
    205     NodePtr                      _root; 
    206  
    207     ImageForegroundPtr           _foreground; 
    208     StatisticsForegroundPtr      _statforeground; 
    209     bool                         _statstate; 
    210  
    211     NodePtr                      _highlight; 
    212     NodePtr                      _highlightNode; 
    213     //GeoPositions3fPtr            _highlightPoints; 
    214     GeoPnt3fPropertyPtr          _highlightPoints; 
    215  
    216     NodePtr                      _internalRoot; 
    217     DirectionalLightPtr          _headlight; 
     204    WindowRefPtr                    _win; 
     205    NodeRefPtr                      _root; 
     206 
     207    ImageForegroundRefPtr           _foreground; 
     208    StatisticsForegroundRefPtr      _statforeground; 
     209    bool                            _statstate; 
     210 
     211    NodeRefPtr                      _highlight; 
     212    NodeRefPtr                      _highlightNode; 
     213    GeoPnt3fPropertyRefPtr          _highlightPoints; 
     214 
     215    NodeRefPtr                      _internalRoot; 
     216    DirectionalLightRefPtr          _headlight; 
    218217#ifdef OSG_OLD_RENDER_ACTION 
    219     RenderAction *               _renderAction;   /**< The RenderAction to use if using RenderActions. */ 
    220     RenderAction *               _ownAction; 
     218    RenderAction *                  _renderAction;   /**< The RenderAction to use if using RenderActions. */ 
     219    RenderAction *                  _ownAction; 
    221220#endif 
    222221 
    223222    /** The RenderAction to use if using render traversals. */ 
    224     RenderAction *      _rtaction; 
    225  
    226     TransformPtr                 _cart; 
    227     PerspectiveCameraPtr         _camera; 
    228  
    229     Navigator                    _navigator; 
    230  
    231     Int16                        _lastx; 
    232     Int16                        _lasty; 
    233     UInt16                       _mousebuttons; 
    234  
    235     bool                         _traversalAction; 
    236  
    237     static  SimpleMaterialPtr    _highlightMaterial; 
     223    RenderAction *                  _rtaction; 
     224 
     225    TransformRefPtr                 _cart; 
     226    PerspectiveCameraRefPtr         _camera; 
     227 
     228    Navigator                       _navigator; 
     229 
     230    Int16                           _lastx; 
     231    Int16                           _lasty; 
     232    UInt16                          _mousebuttons; 
     233 
     234    bool                            _traversalAction; 
     235 
     236    static  SimpleMaterialRefPtr    _highlightMaterial; 
    238237 
    239238    /*! \}                                                                 */ 
  • branches/Carsten_PtrWork2/Tutorials/01hello.cpp

    r835 r1035  
    4646 
    4747    // the connection between GLUT and OpenSG 
    48     GLUTWindowPtr gwin= GLUTWindow::create(); 
     48    GLUTWindowRefPtr gwin = GLUTWindow::create(); 
    4949    gwin->setGlutId(winid); 
    5050    gwin->init(); 
    5151 
    5252    // create the scene 
    53     NodePtr scene = makeTorus(.5, 2, 16, 16); 
     53    NodeRefPtr scene = makeTorus(.5, 2, 16, 16); 
    5454 
    5555    commitChanges(); 
     
    7878void display(void) 
    7979{ 
     80    std::cerr << "-- BEGIN Frame --" << std::endl; 
     81 
    8082    mgr->redraw(); 
     83     
     84    std::cerr << "-- END   Frame --" << std::endl; 
    8185} 
    8286 
  • branches/Carsten_PtrWork2/Tutorials/02move.cpp

    r835 r1035  
    2424 
    2525// The pointer to the transformation 
    26 TransformPtr trans; 
     26TransformRefPtr trans; 
    2727 
    2828 
     
    6565 
    6666    // the connection between GLUT and OpenSG 
    67     GLUTWindowPtr gwin= GLUTWindow::create(); 
     67    GLUTWindowRefPtr gwin= GLUTWindow::create(); 
    6868    gwin->setGlutId(winid); 
    6969    gwin->init(); 
     
    7171    // create the scene 
    7272 
    73     NodePtr torus = makeTorus( .5, 2, 16, 32 ); 
     73    NodeRefPtr torus = makeTorus( .5, 2, 16, 32 ); 
    7474 
    7575    // create the transformation node 
     
    7777     
    7878    // 1. create the Node 
    79     NodePtr scene = Node::create(); 
     79    NodeRefPtr scene = Node::create(); 
    8080     
    8181    // 2. create the core