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/13ClusterClientShader.cpp

    r739 r1039  
    6060SimpleSceneManager *mgr; 
    6161 
    62 static SHLChunkPtr _shl = NullFC
    63 static Int32 _animation = 1; 
     62static SHLChunkGlobalRefPtr _shl
     63static Int32                _animation = 1; 
    6464 
    6565// forward declaration so we can have the interesting stuff upfront 
     
    6767 
    6868 
    69 NodePtr createScene(void) 
    70 { 
    71     NodePtr _scene; 
     69NodeTransitPtr createScene(void) 
     70{ 
     71    NodeRefPtr _scene; 
    7272 
    7373    // Create the shader material 
    74     ChunkMaterialPtr cmat = ChunkMaterial::create(); 
     74    ChunkMaterialRefPtr cmat = ChunkMaterial::create(); 
    7575 
    7676    // Read the image for the normal texture 
    77     ImagePtr earth_map_img = Image::create(); 
     77    ImageRefPtr earth_map_img = Image::create(); 
    7878    if(!earth_map_img->read("Earth.jpg")) 
    7979    { 
    8080        fprintf(stderr, "Couldn't read texture 'Earth.jpg'\n"); 
    81         return NullFC
    82     } 
    83     TextureObjChunkPtr tex_earth     = TextureObjChunk::create(); 
    84     TextureEnvChunkPtr tex_earth_env = TextureEnvChunk::create(); 
     81        return NodeTransitPtr()
     82    } 
     83    TextureObjChunkRefPtr tex_earth     = TextureObjChunk::create(); 
     84    TextureEnvChunkRefPtr tex_earth_env = TextureEnvChunk::create(); 
    8585 
    8686    tex_earth->setImage(earth_map_img); 
     
    9393 
    9494    // Read the image for the normal texture 
    95     ImagePtr earth_night_map_img = Image::create(); 
     95    ImageRefPtr earth_night_map_img = Image::create(); 
    9696    if(!earth_night_map_img->read("EarthNight.jpg")) 
    9797    { 
    9898        fprintf(stderr, "Couldn't read texture 'EarthNight.jpg'\n"); 
    99         return NullFC
    100     } 
    101  
    102     TextureObjChunkPtr tex_earth_night     = TextureObjChunk::create(); 
    103     TextureEnvChunkPtr tex_earth_night_env = TextureEnvChunk::create(); 
     99        return NodeTransitPtr()
     100    } 
     101 
     102    TextureObjChunkRefPtr tex_earth_night     = TextureObjChunk::create(); 
     103    TextureEnvChunkRefPtr tex_earth_night_env = TextureEnvChunk::create(); 
    104104 
    105105    tex_earth_night->setImage(earth_night_map_img); 
     
    112112     
    113113    // Read the image for the normal texture 
    114     ImagePtr earth_clouds_map_img = Image::create(); 
     114    ImageRefPtr earth_clouds_map_img = Image::create(); 
    115115    if(!earth_clouds_map_img->read("EarthClouds.jpg")) 
    116116    { 
    117117        fprintf(stderr, "Couldn't read texture 'EarthClouds.jpg'\n"); 
    118         return NullFC
    119     } 
    120  
    121     TextureObjChunkPtr tex_earth_clouds     = TextureObjChunk::create(); 
    122     TextureEnvChunkPtr tex_earth_clouds_env = TextureEnvChunk::create(); 
     118        return NodeTransitPtr()
     119    } 
     120 
     121    TextureObjChunkRefPtr tex_earth_clouds     = TextureObjChunk::create(); 
     122    TextureEnvChunkRefPtr tex_earth_clouds_env = TextureEnvChunk::create(); 
    123123 
    124124    tex_earth_clouds->setImage(earth_clouds_map_img); 
     
    159159    _scene = Node::create(); 
    160160 
    161     GeometryPtr geo = makeLatLongSphereGeo (100, 100, 1.0); 
     161    GeometryRefPtr geo = makeLatLongSphereGeo (100, 100, 1.0); 
    162162 
    163163    geo->setMaterial(cmat); 
    164164 
    165165 
    166     NodePtr torus = Node::create(); 
     166    NodeRefPtr torus = Node::create(); 
    167167     
    168168    torus->setCore(geo); 
     
    170170 
    171171    // add torus to scene 
    172     GroupPtr group = Group::create(); 
     172    GroupRefPtr group = Group::create(); 
    173173 
    174174    _scene->setCore(group); 
    175175    _scene->addChild(torus); 
    176176 
    177     return _scene
     177    return NodeTransitPtr(_scene)
    178178} 
    179179 
     
    181181int main(int argc, char **argv) 
    182182{ 
    183     char     *opt; 
    184     NodePtr   scene=NullFC
     183    char             *opt; 
     184    NodeGlobalRefPtr  scene
    185185 
    186186    // OSG init 
     
    191191 
    192192    // the connection between this client and the servers 
    193     MultiDisplayWindowPtr mwin= MultiDisplayWindow::create(); 
     193    MultiDisplayWindowGlobalRefPtr mwin = MultiDisplayWindow::create(); 
    194194 
    195195    // evaluate params 
     
    345345        case 27:     
    346346        { 
     347            delete mgr; 
     348         
    347349            OSG::osgExit(); 
    348350            exit(0);