Changeset 12763 for OpenSceneGraph/trunk/examples/osgshadow/osgshadow.cpp
- Timestamp:
- 08/25/11 17:39:09 (21 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgshadow/osgshadow.cpp
r12762 r12763 139 139 140 140 141 class LightAnimationHandler : public osgGA::GUIEventHandler 142 { 143 public: 144 LightAnimationHandler(bool flag=true): _animating(flag) {} 145 146 void setAnimating(bool flag) { _animating = flag; } 147 bool getAnimating() const { return _animating; } 148 149 /** Deprecated, Handle events, return true if handled, false otherwise. */ 150 virtual bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa) 151 { 152 if (ea.getEventType() == osgGA::GUIEventAdapter::KEYUP) 153 { 154 if (ea.getKey() == 'p' ) 155 { 156 _animating = !_animating; 157 return true; 158 } 159 } 160 161 return false; 162 } 163 164 bool _animating; 165 }; 166 167 141 168 static int ReceivesShadowTraversalMask = 0x1; 142 169 static int CastsShadowTraversalMask = 0x2; … … 974 1001 } 975 1002 1003 osg::ref_ptr<LightAnimationHandler> lightAnimationHandler = updateLightPosition ? new LightAnimationHandler : 0; 1004 if (lightAnimationHandler) viewer.addEventHandler(lightAnimationHandler.get()); 1005 976 1006 977 1007 // osgDB::writeNodeFile(*group,"test.osgt"); … … 1003 1033 } 1004 1034 1005 if ( updateLightPosition)1035 if (lightAnimationHandler.valid() && lightAnimationHandler ->getAnimating()) 1006 1036 { 1007 1037 float t = viewer.getFrameStamp()->getSimulationTime();
