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/16lights.cpp

    r835 r1039  
    2121OSG_USING_NAMESPACE 
    2222 
    23 UInt32          nlights = 6; 
    24  
    25 TransformPtr    lightBeacons[8]; 
    26 LightPtr        lights      [8]; 
     23UInt32                   nlights = 6; 
     24 
     25TransformGlobalRefPtr    lightBeacons[8]; 
     26LightGlobalRefPtr        lights      [8]; 
    2727 
    2828// The SimpleSceneManager to manage simple applications 
     
    9292     
    9393    // the connection between GLUT and OpenSG 
    94     GLUTWindowPtr gwin= GLUTWindow::create(); 
     94    GLUTWindowGlobalRefPtr gwin= GLUTWindow::create(); 
    9595    gwin->setGlutId(winid); 
    9696    gwin->init(); 
     
    148148    // Create the scene  
    149149     
    150     NodePtr scene = Node::create(); 
    151     GroupPtr group = Group::create(); 
     150    NodeGlobalRefPtr scene = Node::create(); 
     151    GroupGlobalRefPtr group = Group::create(); 
    152152    scene->setCore(group); 
    153     // keep it open, will be needed below 
    154153 
    155154    // create the scene to be lit 
     
    157156    // a simple torus is fine for now. 
    158157    // You can add more Geometry here if you want to. 
    159     NodePtr lit_scene = makeTorus(.5, 2, 32, 64); 
     158    NodeGlobalRefPtr lit_scene = makeTorus(.5, 2, 32, 64); 
    160159 
    161160    // helper node to keep the lights on top of each other 
    162     NodePtr lastnode = lit_scene; 
     161    NodeGlobalRefPtr lastnode = lit_scene; 
    163162 
    164163    // create the light sources     
     
    179178    {         
    180179        // create the light source 
    181         NodePtr     light = Node::create(); 
    182         LightPtr    light_core; 
    183         NodePtr     geo_node; 
     180        NodeRefPtr     light = Node::create(); 
     181        LightRefPtr    light_core; 
     182        NodeRefPtr     geo_node; 
    184183         
    185184        switch((i % 3) + 0) 
     
    198197            case 0: 
    199198            { 
    200                 PointLightPtr l = PointLight::create(); 
     199                PointLightRefPtr l = PointLight::create(); 
    201200                 
    202201                l->setPosition             (0, 0, 0); 
     
    208207                geo_node = makeLatLongSphere(8, 8, 0.1); 
    209208 
    210                 GeometryPtr geo = dynamic_cast<GeometryPtr>(geo_node->getCore()); 
    211  
    212                 SimpleMaterialPtr sm = SimpleMaterial::create(); 
     209                GeometryRefPtr       geo(dynamic_cast<GeometryPtr>(geo_node->getCore())); 
     210                SimpleMaterialRefPtr sm (SimpleMaterial::create()); 
    213211 
    214212                sm->setLit(false); 
     
    236234            case 1: 
    237235            { 
    238                 DirectionalLightPtr l = DirectionalLight::create(); 
     236                DirectionalLightRefPtr l = DirectionalLight::create(); 
    239237                 
    240238                l->setDirection(0, 0, 1); 
     
    243241                geo_node = makeCylinder(.1, .03, 8, true, true, true); 
    244242 
    245                 GeometryPtr geo = dynamic_cast<GeometryPtr>(geo_node->getCore()); 
    246  
    247                 SimpleMaterialPtr sm = SimpleMaterial::create(); 
     243                GeometryRefPtr       geo(dynamic_cast<GeometryPtr>(geo_node->getCore())); 
     244                SimpleMaterialRefPtr sm (SimpleMaterial::create()); 
    248245 
    249246                sm->setLit(false); 
     
    268265            case 2: 
    269266            { 
    270                 SpotLightPtr l = SpotLight::create(); 
     267                SpotLightRefPtr l = SpotLight::create(); 
    271268                 
    272269                l->setPosition             (Pnt3f(0,  0, 0)); 
     
    281278                geo_node = makeCone(.2, .2, 8, true, true); 
    282279 
    283                 GeometryPtr geo = dynamic_cast<GeometryPtr>(geo_node->getCore()); 
    284  
    285                 SimpleMaterialPtr sm = SimpleMaterial::create(); 
     280                GeometryRefPtr       geo(dynamic_cast<GeometryPtr>(geo_node->getCore())); 
     281                SimpleMaterialRefPtr sm (SimpleMaterial::create()); 
    286282 
    287283                sm->setLit(false); 
     
    298294         
    299295        // create the beacon and attach it to the scene 
    300         NodePtr         beacon      = Node::create(); 
    301         TransformPtr    beacon_core = Transform::create(); 
     296        NodeRefPtr         beacon      = Node::create(); 
     297        TransformRefPtr    beacon_core = Transform::create(); 
    302298         
    303299        lightBeacons[i] = beacon_core; 
     
    388384        case 27:     
    389385        { 
     386            delete mgr; 
     387         
    390388            osgExit(); 
    391389            exit(1);