Changeset 1039 for branches/Carsten_PtrWork2/Tutorials/19LocalLights.cpp
- Timestamp:
- 01/16/08 16:07:40 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/Carsten_PtrWork2/Tutorials/19LocalLights.cpp
r835 r1039 27 27 28 28 // The SimpleSceneManager to manage simple applications 29 SimpleSceneManager *_mgr = NULL;30 Node Ptr _scene = NullFC;29 SimpleSceneManager *_mgr = NULL; 30 NodeGlobalRefPtr _scene; 31 31 32 32 // forward declaration so we can have the interesting stuff upfront … … 50 50 51 51 // the connection between GLUT and OpenSG 52 GLUTWindow Ptr gwin= GLUTWindow::create();52 GLUTWindowGlobalRefPtr gwin= GLUTWindow::create(); 53 53 gwin->setGlutId(winid); 54 54 gwin->init(); … … 58 58 59 59 // create four lights sharing the same beacon. 60 Transform Ptr light_trans;61 Node Ptrlight_beacon = makeCoredNode<Transform>(&light_trans);60 TransformGlobalRefPtr light_trans; 61 NodeGlobalRefPtr light_beacon = makeCoredNode<Transform>(&light_trans); 62 62 light_trans->editMatrix().setTranslate(0.0, 0.0, 10.0); 63 63 64 64 // red light. 65 PointLight Ptr light1_core;66 Node Ptrlight1 = makeCoredNode<PointLight>(&light1_core);65 PointLightGlobalRefPtr light1_core; 66 NodeGlobalRefPtr light1 = makeCoredNode<PointLight>(&light1_core); 67 67 light1_core->setAmbient(0.0,0.0,0.0,1); 68 68 light1_core->setDiffuse(1.0,0.0,0.0,1); … … 72 72 73 73 // green light. 74 PointLight Ptr light2_core;75 Node Ptrlight2 = makeCoredNode<PointLight>(&light2_core);74 PointLightGlobalRefPtr light2_core; 75 NodeGlobalRefPtr light2 = makeCoredNode<PointLight>(&light2_core); 76 76 light2_core->setAmbient(0.0,0.0,0.0,1); 77 77 light2_core->setDiffuse(0.0,1.0,0.0,1); … … 81 81 82 82 // blue light. 83 PointLight Ptr light3_core;84 Node Ptrlight3 = makeCoredNode<PointLight>(&light3_core);83 PointLightGlobalRefPtr light3_core; 84 NodeGlobalRefPtr light3 = makeCoredNode<PointLight>(&light3_core); 85 85 light3_core->setAmbient(0.0,0.0,0.0,1); 86 86 light3_core->setDiffuse(0.0,0.0,1.0,1); … … 90 90 91 91 // white light. 92 PointLight Ptr light4_core;93 Node Ptrlight4 = makeCoredNode<PointLight>(&light4_core);92 PointLightGlobalRefPtr light4_core; 93 NodeGlobalRefPtr light4 = makeCoredNode<PointLight>(&light4_core); 94 94 light4_core->setAmbient(0.0,0.0,0.0,1); 95 95 light4_core->setDiffuse(1.0,1.0,1.0,1); … … 98 98 light4_core->setOn(true); 99 99 100 Node Ptr bottom = makePlane(25.0, 25.0, 128, 128);100 NodeGlobalRefPtr bottom = makePlane(25.0, 25.0, 128, 128); 101 101 102 102 // create three spheres. 103 Node Ptrsphere1 = makeLatLongSphere(50, 50, 1.0);104 Transform Ptr sphere1_trans_core;105 Node Ptrsphere1_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); 106 106 sphere1_trans_core->editMatrix().setTranslate(-5.0, 0.0, 5.0); 107 107 sphere1_trans->addChild(sphere1); 108 108 109 Node Ptrsphere2 = makeLatLongSphere(50, 50, 1.0);110 Transform Ptr sphere2_trans_core;111 Node Ptrsphere2_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); 112 112 sphere2_trans_core->editMatrix().setTranslate(0.0, 0.0, 5.0); 113 113 sphere2_trans->addChild(sphere2); 114 114 115 Node Ptrsphere3 = makeLatLongSphere(50, 50, 1.0);116 Transform Ptr sphere3_trans_core;117 Node Ptrsphere3_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); 118 118 sphere3_trans_core->editMatrix().setTranslate(5.0, 0.0, 5.0); 119 119 sphere3_trans->addChild(sphere3); … … 143 143 _mgr->showAll(); 144 144 145 // enable local lights. 146 RenderAction *ract = (RenderAction *) _mgr->getAction(); 147 ract->setLocalLights(true); 145 // // enable local lights. 146 // _mgr->getRenderAction()->setLocalLights(true); 148 147 149 148 // GLUT main loop … … 188 187 { 189 188 case 27: 189 delete _mgr; 190 190 191 OSG::osgExit(); 191 192 exit(0);
