Changeset 1039 for branches/Carsten_PtrWork2/Tutorials/16lights.cpp
- Timestamp:
- 01/16/08 16:07:40 (1 year ago)
- Files:
-
- branches/Carsten_PtrWork2/Tutorials/16lights.cpp (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/Carsten_PtrWork2/Tutorials/16lights.cpp
r835 r1039 21 21 OSG_USING_NAMESPACE 22 22 23 UInt32 nlights = 6;24 25 Transform Ptr lightBeacons[8];26 Light Ptr lights [8];23 UInt32 nlights = 6; 24 25 TransformGlobalRefPtr lightBeacons[8]; 26 LightGlobalRefPtr lights [8]; 27 27 28 28 // The SimpleSceneManager to manage simple applications … … 92 92 93 93 // the connection between GLUT and OpenSG 94 GLUTWindow Ptr gwin= GLUTWindow::create();94 GLUTWindowGlobalRefPtr gwin= GLUTWindow::create(); 95 95 gwin->setGlutId(winid); 96 96 gwin->init(); … … 148 148 // Create the scene 149 149 150 Node Ptrscene = Node::create();151 Group Ptr group = Group::create();150 NodeGlobalRefPtr scene = Node::create(); 151 GroupGlobalRefPtr group = Group::create(); 152 152 scene->setCore(group); 153 // keep it open, will be needed below154 153 155 154 // create the scene to be lit … … 157 156 // a simple torus is fine for now. 158 157 // You can add more Geometry here if you want to. 159 Node Ptr lit_scene = makeTorus(.5, 2, 32, 64);158 NodeGlobalRefPtr lit_scene = makeTorus(.5, 2, 32, 64); 160 159 161 160 // helper node to keep the lights on top of each other 162 Node Ptr lastnode = lit_scene;161 NodeGlobalRefPtr lastnode = lit_scene; 163 162 164 163 // create the light sources … … 179 178 { 180 179 // create the light source 181 Node Ptr light = Node::create();182 Light Ptr light_core;183 Node Ptr geo_node;180 NodeRefPtr light = Node::create(); 181 LightRefPtr light_core; 182 NodeRefPtr geo_node; 184 183 185 184 switch((i % 3) + 0) … … 198 197 case 0: 199 198 { 200 PointLight Ptr l = PointLight::create();199 PointLightRefPtr l = PointLight::create(); 201 200 202 201 l->setPosition (0, 0, 0); … … 208 207 geo_node = makeLatLongSphere(8, 8, 0.1); 209 208 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()); 213 211 214 212 sm->setLit(false); … … 236 234 case 1: 237 235 { 238 DirectionalLight Ptr l = DirectionalLight::create();236 DirectionalLightRefPtr l = DirectionalLight::create(); 239 237 240 238 l->setDirection(0, 0, 1); … … 243 241 geo_node = makeCylinder(.1, .03, 8, true, true, true); 244 242 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()); 248 245 249 246 sm->setLit(false); … … 268 265 case 2: 269 266 { 270 SpotLight Ptr l = SpotLight::create();267 SpotLightRefPtr l = SpotLight::create(); 271 268 272 269 l->setPosition (Pnt3f(0, 0, 0)); … … 281 278 geo_node = makeCone(.2, .2, 8, true, true); 282 279 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()); 286 282 287 283 sm->setLit(false); … … 298 294 299 295 // create the beacon and attach it to the scene 300 Node Ptr beacon = Node::create();301 Transform Ptr beacon_core = Transform::create();296 NodeRefPtr beacon = Node::create(); 297 TransformRefPtr beacon_core = Transform::create(); 302 298 303 299 lightBeacons[i] = beacon_core; … … 388 384 case 27: 389 385 { 386 delete mgr; 387 390 388 osgExit(); 391 389 exit(1);
