Changeset 2340 for GTP/trunk/App/Demos/Illum/Ogre/src
- Timestamp:
- 04/24/07 18:09:37 (18 years ago)
- Location:
- GTP/trunk/App/Demos/Illum/Ogre/src/CausticTest
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/Ogre/src/CausticTest/include/CausticTest.h
r2319 r2340 31 31 float cauintens = 40; 32 32 33 class RaytraceDemoApplication; 34 33 35 // Listener class for frame updates 34 36 class RaytraceDemoListener : public ExampleFrameListener … … 40 42 SceneNode* sphereNode; 41 43 unsigned long framecount; 44 RaytraceDemoApplication* app; 42 45 43 46 public: 44 RaytraceDemoListener(RenderWindow* window, Camera* maincam,SceneNode* lightNode, SceneNode* sphereNode, Light* l )47 RaytraceDemoListener(RenderWindow* window, Camera* maincam,SceneNode* lightNode, SceneNode* sphereNode, Light* l, RaytraceDemoApplication* app) 45 48 :ExampleFrameListener(window, maincam) 46 49 … … 50 53 this->lightNode = lightNode; 51 54 light = l; 55 this->app = app; 52 56 } 53 57 bool processUnbufferedKeyInput(const FrameEvent& evt) … … 120 124 return ExampleFrameListener::processUnbufferedKeyInput(evt); 121 125 } 122 bool frameStarted(const FrameEvent& evt) 123 { 124 static bool first = true; 125 126 127 // lightNode->setPosition( 100.0 * Vector3(cos(-(float)framecount/500.0),2.0,sin(-(float)framecount/500.0))); 128 129 130 bool result = ExampleFrameListener::frameStarted(evt); 131 framecount++; 132 133 if (framecount == 60) 134 OgreIlluminationManager::getSingleton().freeAllResources(); 135 return result; 136 } 137 126 127 bool frameStarted(const FrameEvent& evt); 138 128 139 129 … … 145 135 146 136 public: 147 148 protected: 149 SceneNode* mainLightNode; 150 SceneNode* sphereNode; 151 152 void chooseSceneManager() 153 { 154 //mSceneMgr = mRoot->createSceneManager("OctreeSceneManager"); 155 mSceneMgr = mRoot->createSceneManager("OcclusionCullingSceneManager"); 156 } 157 158 void loadResources(void) 159 { 160 161 // Initialise, parse scripts etc 162 ResourceGroupManager::getSingleton().initialiseResourceGroup("Bootstrap"); 163 ResourceGroupManager::getSingleton().initialiseResourceGroup("General"); 164 ResourceGroupManager::getSingleton().initialiseResourceGroup("GTP_Basic"); 165 ResourceGroupManager::getSingleton().initialiseResourceGroup("PostProc"); 166 ResourceGroupManager::getSingleton().initialiseResourceGroup("GTP_EnvMap"); 167 ResourceGroupManager::getSingleton().initialiseResourceGroup("GTP_Caustic"); 168 } 169 170 void createPostproc() 171 { 172 CompositorManager::getSingleton().addCompositor(mWindow->getViewport(0), 173 "GTP/PostProc/Glow"); 174 CompositorManager::getSingleton().setCompositorEnabled(mWindow->getViewport(0), 175 "GTP/PostProc/Glow", true); 176 177 CompositorManager::getSingleton().addCompositor(mWindow->getViewport(0), 178 "GTP/PostProc/ToneMap"); 179 CompositorManager::getSingleton().setCompositorEnabled(mWindow->getViewport(0), 180 "GTP/PostProc/ToneMap", true); 181 } 182 183 Light* light; 184 void createScene(void) 185 { 186 std::string occlusion_cfg("OcclusionCulling.cfg"); 187 mSceneMgr->setWorldGeometry(occlusion_cfg); 188 189 //createPostproc(); 190 OgreIlluminationManager::getSingleton().setBlurShadowMap(true); 191 OgreIlluminationManager::getSingleton().setUseLISPSM(false); 192 193 OgreIlluminationManager::getSingleton().setMainCamera(mCamera); 194 OgreIlluminationManager::getSingleton().setMainViewport(mWindow->getViewport(0)); 195 196 OgreIlluminationManager::getSingleton().setMaxJoinRadius(420); 197 198 Root::getSingleton()._setCurrentSceneManager(mSceneMgr); 199 200 mCamera->setPosition(0,100,240); 201 mCamera->setFOVy(Radian(Degree(80))); 202 //mCamera->setFarClipDistance(1000); 203 // Set ambient light 204 mSceneMgr->setAmbientLight(ColourValue(1, 1, 1)); 205 137 void LoadRes() 138 { 139 loadResources(); 140 } 141 void setupScene() 142 { 206 143 // Skybox 207 144 mSceneMgr->setSkyBox(true, "Examples/EveningSkyBox"); … … 249 186 //createPlane("ground", "TestPlane", Vector3(0,0,0), Vector2(500,500)); 250 187 OgreIlluminationManager::getSingleton().initTechniques(); 188 189 OgreIlluminationManager::getSingleton().setPriority(2); 190 mRoot->addFrameListener(&OgreIlluminationManager::getSingleton()); 191 } 192 193 protected: 194 SceneNode* mainLightNode; 195 SceneNode* sphereNode; 196 197 void chooseSceneManager() 198 { 199 //mSceneMgr = mRoot->createSceneManager("OctreeSceneManager"); 200 mSceneMgr = mRoot->createSceneManager("OcclusionCullingSceneManager"); 201 } 202 203 void loadResources(void) 204 { 205 206 // Initialise, parse scripts etc 207 ResourceGroupManager::getSingleton().initialiseResourceGroup("Bootstrap"); 208 ResourceGroupManager::getSingleton().initialiseResourceGroup("General"); 209 ResourceGroupManager::getSingleton().initialiseResourceGroup("GTP_Basic"); 210 ResourceGroupManager::getSingleton().initialiseResourceGroup("PostProc"); 211 ResourceGroupManager::getSingleton().initialiseResourceGroup("GTP_EnvMap"); 212 ResourceGroupManager::getSingleton().initialiseResourceGroup("GTP_Caustic"); 213 } 214 215 void createPostproc() 216 { 217 CompositorManager::getSingleton().addCompositor(mWindow->getViewport(0), 218 "GTP/PostProc/Glow"); 219 CompositorManager::getSingleton().setCompositorEnabled(mWindow->getViewport(0), 220 "GTP/PostProc/Glow", true); 221 222 CompositorManager::getSingleton().addCompositor(mWindow->getViewport(0), 223 "GTP/PostProc/ToneMap"); 224 CompositorManager::getSingleton().setCompositorEnabled(mWindow->getViewport(0), 225 "GTP/PostProc/ToneMap", true); 226 } 227 228 Light* light; 229 void createScene(void) 230 { 231 std::string occlusion_cfg("OcclusionCulling.cfg"); 232 mSceneMgr->setWorldGeometry(occlusion_cfg); 233 234 //createPostproc(); 235 OgreIlluminationManager::getSingleton().setBlurShadowMap(true); 236 OgreIlluminationManager::getSingleton().setUseLISPSM(false); 237 238 OgreIlluminationManager::getSingleton().setMainCamera(mCamera); 239 OgreIlluminationManager::getSingleton().setMainViewport(mWindow->getViewport(0)); 240 241 OgreIlluminationManager::getSingleton().setMaxJoinRadius(420); 242 243 Root::getSingleton()._setCurrentSceneManager(mSceneMgr); 244 245 mCamera->setPosition(0,100,240); 246 mCamera->setFOVy(Radian(Degree(80))); 247 //mCamera->setFarClipDistance(1000); 248 // Set ambient light 249 mSceneMgr->setAmbientLight(ColourValue(1, 1, 1)); 250 251 setupScene(); 251 252 } 253 254 252 255 void createPlane(Ogre::String _name, Ogre::String _material, Ogre::Vector3 _pos, Ogre::Vector2 _size, Ogre::Vector2 _subdivisions = Ogre::Vector2(1,1)) { 253 256 … … 278 281 mainLightNode, 279 282 sphereNode, 280 light 283 light, 284 this 281 285 ); 282 286 mFrameListener->setPriority(1); 283 OgreIlluminationManager::getSingleton().setPriority(2);284 mRoot->addFrameListener(&OgreIlluminationManager::getSingleton());285 287 mRoot->addFrameListener(mFrameListener); 286 288 … … 289 291 }; 290 292 293 294 295 296 297 -
GTP/trunk/App/Demos/Illum/Ogre/src/CausticTest/src/CausticTest.cpp
r1450 r2340 33 33 #endif 34 34 35 bool RaytraceDemoListener::frameStarted(const FrameEvent& evt) 36 { 37 static bool first = true; 38 35 39 40 // lightNode->setPosition( 100.0 * Vector3(cos(-(float)framecount/500.0),2.0,sin(-(float)framecount/500.0))); 41 42 43 bool result = ExampleFrameListener::frameStarted(evt); 44 framecount++; 45 46 if (framecount == 60) 47 { 48 OgreIlluminationManager::getSingleton().freeAllResources(); 49 Root::getSingleton().removeFrameListener(&OgreIlluminationManager::getSingleton()); 50 Root::getSingleton()._getCurrentSceneManager()->clearScene(); 51 TextureManager::getSingleton().removeAll(); 52 MeshManager::getSingleton().removeAll(); 53 MaterialManager::getSingleton().removeAll(); 54 //} 55 //if (framecount == 120) 56 //{ 57 app->LoadRes(); 58 app->setupScene(); 59 } 60 return result; 61 } 36 62 37 63 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 … … 61 87 } 62 88 #endif 89 90 91
Note: See TracChangeset
for help on using the changeset viewer.