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/Tutorials/19LocalLights.cpp

    r835 r1039  
    2727 
    2828// The SimpleSceneManager to manage simple applications 
    29 SimpleSceneManager *_mgr = NULL; 
    30 NodePtr _scene = NullFC
     29SimpleSceneManager *_mgr   = NULL; 
     30NodeGlobalRefPtr    _scene
    3131 
    3232// forward declaration so we can have the interesting stuff upfront 
     
    5050 
    5151    // the connection between GLUT and OpenSG 
    52     GLUTWindowPtr gwin= GLUTWindow::create(); 
     52    GLUTWindowGlobalRefPtr gwin= GLUTWindow::create(); 
    5353    gwin->setGlutId(winid); 
    5454    gwin->init(); 
     
    5858 
    5959    // create four lights sharing the same beacon. 
    60     TransformPtr light_trans; 
    61     NodePtr light_beacon = makeCoredNode<Transform>(&light_trans); 
     60    TransformGlobalRefPtr light_trans; 
     61    NodeGlobalRefPtr      light_beacon = makeCoredNode<Transform>(&light_trans); 
    6262    light_trans->editMatrix().setTranslate(0.0, 0.0, 10.0); 
    6363 
    6464    // red light. 
    65     PointLightPtr light1_core; 
    66     NodePtr light1 = makeCoredNode<PointLight>(&light1_core); 
     65    PointLightGlobalRefPtr light1_core; 
     66    NodeGlobalRefPtr      light1 = makeCoredNode<PointLight>(&light1_core); 
    6767    light1_core->setAmbient(0.0,0.0,0.0,1); 
    6868    light1_core->setDiffuse(1.0,0.0,0.0,1); 
     
    7272 
    7373    // green light. 
    74     PointLightPtr light2_core; 
    75     NodePtr light2 = makeCoredNode<PointLight>(&light2_core); 
     74    PointLightGlobalRefPtr light2_core; 
     75    NodeGlobalRefPtr      light2 = makeCoredNode<PointLight>(&light2_core); 
    7676    light2_core->setAmbient(0.0,0.0,0.0,1); 
    7777    light2_core->setDiffuse(0.0,1.0,0.0,1); 
     
    8181     
    8282    // blue light. 
    83     PointLightPtr light3_core; 
    84     NodePtr light3 = makeCoredNode<PointLight>(&light3_core); 
     83    PointLightGlobalRefPtr light3_core; 
     84    NodeGlobalRefPtr      light3 = makeCoredNode<PointLight>(&light3_core); 
    8585    light3_core->setAmbient(0.0,0.0,0.0,1); 
    8686    light3_core->setDiffuse(0.0,0.0,1.0,1); 
     
    9090 
    9191    // white light. 
    92     PointLightPtr light4_core; 
    93     NodePtr light4 = makeCoredNode<PointLight>(&light4_core); 
     92    PointLightGlobalRefPtr light4_core; 
     93    NodeGlobalRefPtr      light4 = makeCoredNode<PointLight>(&light4_core); 
    9494    light4_core->setAmbient(0.0,0.0,0.0,1); 
    9595    light4_core->setDiffuse(1.0,1.0,1.0,1); 
     
    9898    light4_core->setOn(true); 
    9999 
    100     NodePtr bottom = makePlane(25.0, 25.0, 128, 128); 
     100    NodeGlobalRefPtr bottom = makePlane(25.0, 25.0, 128, 128); 
    101101 
    102102    // create three spheres. 
    103     NodePtr sphere1 = makeLatLongSphere(50, 50, 1.0); 
    104     TransformPtr sphere1_trans_core; 
    105     NodePtr sphere1_trans = makeCoredNode<Transform>(&sphere1_trans_core); 
     103    NodeGlobalRefPtr      sphere1 = makeLatLongSphere(50, 50, 1.0); 
     104    TransformGlobalRefPtr sphere1_trans_core; 
     105    NodeGlobalRefPtr      sphere1_trans = makeCoredNode<Transform>(&sphere1_trans_core); 
    106106    sphere1_trans_core->editMatrix().setTranslate(-5.0, 0.0, 5.0); 
    107107    sphere1_trans->addChild(sphere1); 
    108108     
    109     NodePtr sphere2 = makeLatLongSphere(50, 50, 1.0); 
    110     TransformPtr sphere2_trans_core; 
    111     NodePtr sphere2_trans = makeCoredNode<Transform>(&sphere2_trans_core); 
     109    NodeGlobalRefPtr      sphere2 = makeLatLongSphere(50, 50, 1.0); 
     110    TransformGlobalRefPtr sphere2_trans_core; 
     111    NodeGlobalRefPtr      sphere2_trans = makeCoredNode<Transform>(&sphere2_trans_core); 
    112112    sphere2_trans_core->editMatrix().setTranslate(0.0, 0.0, 5.0); 
    113113    sphere2_trans->addChild(sphere2); 
    114114     
    115     NodePtr sphere3 = makeLatLongSphere(50, 50, 1.0); 
    116     TransformPtr sphere3_trans_core; 
    117     NodePtr sphere3_trans = makeCoredNode<Transform>(&sphere3_trans_core); 
     115    NodeGlobalRefPtr      sphere3 = makeLatLongSphere(50, 50, 1.0); 
     116    TransformGlobalRefPtr sphere3_trans_core; 
     117    NodeGlobalRefPtr      sphere3_trans = makeCoredNode<Transform>(&sphere3_trans_core); 
    118118    sphere3_trans_core->editMatrix().setTranslate(5.0, 0.0, 5.0); 
    119119    sphere3_trans->addChild(sphere3); 
     
    143143    _mgr->showAll(); 
    144144 
    145     // enable local lights. 
    146     RenderAction *ract = (RenderAction *) _mgr->getAction(); 
    147     ract->setLocalLights(true); 
     145//     // enable local lights. 
     146//     _mgr->getRenderAction()->setLocalLights(true); 
    148147 
    149148    // GLUT main loop 
     
    188187    { 
    189188        case 27: 
     189            delete _mgr; 
     190         
    190191            OSG::osgExit(); 
    191192            exit(0);