Changeset 1629 for GTP/trunk/App/Demos/Illum/Ogre/src
- Timestamp:
- 10/17/06 09:25:48 (18 years ago)
- Location:
- GTP/trunk/App/Demos/Illum/Ogre/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/Ogre/src/CausticTest/include/CausticTest.h
r1490 r1629 36 36 protected: 37 37 38 Light* light; 38 39 SceneNode* lightNode; 39 40 SceneNode* sphereNode; … … 41 42 42 43 public: 43 RaytraceDemoListener(RenderWindow* window, Camera* maincam,SceneNode* lightNode, SceneNode* sphereNode )44 RaytraceDemoListener(RenderWindow* window, Camera* maincam,SceneNode* lightNode, SceneNode* sphereNode, Light* l) 44 45 :ExampleFrameListener(window, maincam) 45 46 … … 48 49 this->sphereNode = sphereNode; 49 50 this->lightNode = lightNode; 51 light = l; 50 52 } 51 53 bool processUnbufferedKeyInput(const FrameEvent& evt) … … 57 59 lDir.normalise(); 58 60 lPos -= lDir; 59 lightNode->setPosition(lPos); 61 lightNode->setPosition(lPos); 62 light->setDirection(lDir); 60 63 } 61 64 if (mInputDevice->isKeyDown(KC_ADD)) … … 66 69 lDir.normalise(); 67 70 lPos += lDir; 68 lightNode->setPosition(lPos); 71 lightNode->setPosition(lPos); 72 light->setDirection(lDir); 69 73 } 70 74 if (mInputDevice->isKeyDown(KC_MULTIPLY)) … … 76 80 Vector3 up = lDir.crossProduct(right); 77 81 lPos += up, 78 lightNode->setPosition(lPos); 82 lightNode->setPosition(lPos); 83 light->setDirection(lDir); 79 84 } 80 85 if (mInputDevice->isKeyDown(KC_DIVIDE)) … … 87 92 lPos -= up, 88 93 lightNode->setPosition(lPos); 94 light->setDirection(lDir); 89 95 90 96 } … … 127 133 } 128 134 129 135 Light* light; 130 136 void createScene(void) 131 137 { 132 138 133 139 //createPostproc(); 134 140 OgreIlluminationManager::getSingleton().setBlurShadowMap(true); 141 OgreIlluminationManager::getSingleton().setUseLISPSM(false); 142 135 143 OgreIlluminationManager::getSingleton().setMainCamera(mCamera); 136 144 OgreIlluminationManager::getSingleton().setMainViewport(mWindow->getViewport(0)); … … 159 167 sphereNode->_updateBounds(); 160 168 161 /* 169 162 170 Light* mainLight = mSceneMgr->createLight("MainLight"); 163 mainLight->setType(Light::LT_POINT); 171 light = mainLight; 172 mainLight->setType(Light::LT_DIRECTIONAL); 164 173 mainLight->setDiffuseColour(ColourValue::White); 165 174 mainLight->setSpecularColour(ColourValue::White); … … 176 185 177 186 createPlane("ground", "TestPlane", Vector3(0,0,0), Vector2(500,500)); 178 */187 179 188 OgreIlluminationManager::getSingleton().initTechniques(); 180 189 … … 208 217 mCamera, 209 218 mainLightNode, 210 sphereNode 219 sphereNode, 220 light 211 221 ); 222 mFrameListener->setPriority(1); 223 OgreIlluminationManager::getSingleton().setPriority(2); 212 224 mRoot->addFrameListener(&OgreIlluminationManager::getSingleton()); 213 225 mRoot->addFrameListener(mFrameListener); -
GTP/trunk/App/Demos/Illum/Ogre/src/CausticTest/scripts/CausticTest.vcproj
r1450 r1629 145 145 </Filter> 146 146 <Filter 147 Name="Header Files"148 Filter="h;hpp;hxx;hm;inl;inc">149 <File150 RelativePath="..\include\CausticTest.h">151 </File>152 </Filter>153 <Filter154 147 Name="Resource Files" 155 148 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"> 149 <File 150 RelativePath="..\..\..\Media\materials\scripts\GameTools.material"> 151 </File> 156 152 <File 157 153 RelativePath="..\..\..\Media\materials\scripts\GameTools.program"> … … 163 159 RelativePath="..\..\..\Media\materials\scripts\GlassHead.material"> 164 160 </File> 161 <Filter 162 Name="Header Files" 163 Filter="h;hpp;hxx;hm;inl;inc"> 164 <File 165 RelativePath="..\include\CausticTest.h"> 166 </File> 167 </Filter> 165 168 </Filter> 166 169 </Files> -
GTP/trunk/App/Demos/Illum/Ogre/src/DiffuseTest/include/DiffuseTest.h
r1611 r1629 29 29 float causize = 10; 30 30 float cauintens = 40; 31 int scene = 1;31 int scene = 3; 32 32 // Listener class for frame updates 33 33 class RaytraceDemoListener : public ExampleFrameListener … … 55 55 if (mInputDevice->isKeyDown(KC_MULTIPLY)) 56 56 { 57 objectNode->scale(1.1,1.1,1.1); 57 //objectNode->scale(1.1,1.1,1.1); 58 objectNode->rotate(Vector3(0,0,1), Degree(10)); 58 59 mTimeUntilNextToggle = 1; 59 60 } 60 61 if (mInputDevice->isKeyDown(KC_DIVIDE)) 61 62 { 62 objectNode->scale(1.0/1.1,1.0/1.1,1.0/1.1); 63 //objectNode->scale(1.0/1.1,1.0/1.1,1.0/1.1); 64 objectNode->rotate(Vector3(1,0,0), Degree(10)); 63 65 mTimeUntilNextToggle = 1; 64 66 } … … 66 68 { 67 69 objectNode->rotate(Vector3(0,1,0), Degree(10)); 70 } 71 if (mInputDevice->isKeyDown(KC_HOME)) 72 { 73 objectNode->translate(0,0.5,0); 74 } 75 if (mInputDevice->isKeyDown(KC_END)) 76 { 77 objectNode->translate(0,-0.5,0); 68 78 } 69 79 if (mInputDevice->isKeyDown(KC_DOWN)) … … 329 339 Root::getSingleton()._setCurrentSceneManager(mSceneMgr); 330 340 331 mCamera->setPosition(0,1 0,10);341 mCamera->setPosition(0,1,0); 332 342 mCamera->setFOVy(Radian(Degree(80))); 333 343 mCamera->setFarClipDistance(200); 334 344 mCamera->setNearClipDistance(0.1); 335 345 336 if(scene == 1) 337 createScene1(); 338 else 339 createScene2(); 340 346 switch (scene) 347 { 348 case 1: 349 createScene1();break; 350 case 2: 351 createScene2();break; 352 case 3: 353 createScene3();break; 354 } 341 355 OgreIlluminationManager::getSingleton().initTechniques(); 342 356 … … 502 516 503 517 // mSceneMgr->setAmbientLight(ColourValue(0.1, 0.0537, 0.0)); 504 mSceneMgr->setAmbientLight(ColourValue(0. 0, 0.0, 0.0));518 mSceneMgr->setAmbientLight(ColourValue(0.2, 0.25, 0.3)); 505 519 506 520 SceneNode* rootNode = mSceneMgr->getRootSceneNode(); 507 521 508 Entity* object = mSceneMgr->createEntity("object", " athene.mesh");522 Entity* object = mSceneMgr->createEntity("object", "santa.mesh"); 509 523 object->setMaterialName("GameTools/Diffuse/use"); 510 524 //object->setMaterialName("GameTools/Diffuse2"); 511 525 objectNode = rootNode->createChildSceneNode(); 512 526 objectNode->attachObject(object); 513 objectNode->scale(0.05,0.05,0.05); 514 objectNode->setPosition(0,4,0); 527 objectNode->scale(0.5,0.5,0.5); 528 objectNode->rotate(Vector3(0,1,0),Radian(Math::PI)); 529 objectNode->setPosition(0,0,2); 515 530 objectNode->_updateBounds(); 516 531 … … 559 574 560 575 576 } 577 578 void createScene3() 579 { 580 mSceneMgr->setAmbientLight(ColourValue(0.505 * 0.2, 0.897 * 0.2, 0.914 * 0.2)); 581 582 SceneNode* rootNode = mSceneMgr->getRootSceneNode(); 583 584 Entity* object = mSceneMgr->createEntity("object", "santa.mesh"); 585 object->setMaterialName("GameTools/Diffuse/use"); 586 //object->setMaterialName("GameTools/Diffuse2"); 587 objectNode = rootNode->createChildSceneNode(); 588 objectNode->attachObject(object); 589 objectNode->scale(0.1,0.1,0.1); 590 objectNode->rotate(Vector3(0,1,0),Radian(Math::PI)); 591 objectNode->setPosition(0,0,2); 592 objectNode->_updateBounds(); 593 594 Entity* room = mSceneMgr->createEntity("scene", "difflab.mesh"); 595 //room->setMaterialName("GameTools/Phong"); 596 SceneNode* roomNode = rootNode->createChildSceneNode(); 597 roomNode->attachObject(room); 598 roomNode->_updateBounds(); 599 600 mSceneMgr->setShadowTechnique(SHADOWTYPE_NONE); 601 Light* redLight1 = mSceneMgr->createLight("RedLight1"); 602 redLight1->setType(Light::LT_POINT); 603 redLight1->setCastShadows(false); 604 redLight1->setDiffuseColour(ColourValue(1,0.055, 0.0)); 605 redLight1->setPowerScale(1.6); 606 SceneNode* redLightNode1 = rootNode->createChildSceneNode(); 607 redLightNode1->setPosition(0.05,2.361,-1.07); 608 redLightNode1->attachObject(redLight1); 609 610 Light* greenLight1 = mSceneMgr->createLight("GreenLight1"); 611 greenLight1->setType(Light::LT_POINT); 612 greenLight1->setCastShadows(false); 613 greenLight1->setDiffuseColour(ColourValue(0.362,0.783, 0.685)); 614 greenLight1->setPowerScale(2.0); 615 SceneNode* greenLightNode1 = rootNode->createChildSceneNode(); 616 greenLightNode1->setPosition(1.312,1.313,0); 617 greenLightNode1->attachObject(greenLight1); 618 619 Light* mainBlueLight = mSceneMgr->createLight("MainBlueLight"); 620 mainBlueLight->setType(Light::LT_SPOTLIGHT); 621 mainBlueLight->setCastShadows(true); 622 mainBlueLight->setDiffuseColour(ColourValue(0.395,0.766, 1.0)); 623 mainBlueLight->setPowerScale(5.0); 624 mainBlueLight->setSpotlightRange(Degree(20),Degree(90)); 625 SceneNode* mainBlueLightNode = rootNode->createChildSceneNode(); 626 mainBlueLightNode->setPosition(-0.546,2.095,1.035); 627 //mainBlueLightNode->rotate(Vector3::UNIT_X, Degree(161.396)); 628 //mainBlueLightNode->rotate(Vector3::UNIT_Y, Degree(53.955)); 629 //mainBlueLightNode->rotate(Vector3::UNIT_Z, Degree(-145.065)); 630 mainBlueLight->setDirection(-1.5,-2.0,1.0); 631 mainBlueLightNode->attachObject(mainBlueLight); 632 /* 633 Light* blueLight1 = mSceneMgr->createLight("BlueLight1"); 634 blueLight1->setType(Light::LT_SPOTLIGHT); 635 blueLight1->setCastShadows(false); 636 blueLight1->setDiffuseColour(ColourValue(0.395,0.766, 1.0)); 637 blueLight1->setPowerScale(0.7); 638 blueLight1->setSpotlightRange(Degree(20),Degree(90)); 639 SceneNode* blueLightNode = rootNode->createChildSceneNode(); 640 blueLightNode->setPosition(-0.9,2.095,0.185); 641 //blueLightNode->rotate(Vector3::UNIT_X, Degree(148.785)); 642 //blueLightNode->rotate(Vector3::UNIT_Y, Degree(39.001)); 643 //blueLightNode->rotate(Vector3::UNIT_Z, Degree(-154.304)); 644 blueLight1->setDirection(-1.5,-2.0,1.0); 645 blueLightNode->attachObject(blueLight1); 646 647 Light* blueLight2 = mSceneMgr->createLight("BlueLight2"); 648 blueLight2->setType(Light::LT_SPOTLIGHT); 649 blueLight2->setCastShadows(false); 650 blueLight2->setDiffuseColour(ColourValue(0.395,0.766, 1.0)); 651 blueLight2->setPowerScale(0.7); 652 blueLight2->setSpotlightRange(Degree(20),Degree(90)); 653 SceneNode* blueLightNode2 = rootNode->createChildSceneNode(); 654 blueLightNode2->setPosition(0.091,2.095,1.556); 655 //blueLightNode2->rotate(Vector3::UNIT_X, Degree(-112.941)); 656 //blueLightNode2->rotate(Vector3::UNIT_Y, Degree(68.432)); 657 //blueLightNode2->rotate(Vector3::UNIT_Z, Degree(-66.441)); 658 blueLight2->setDirection(-1.5,-2.0,1.0); 659 blueLightNode2->attachObject(blueLight2); */ 561 660 } 562 661 -
GTP/trunk/App/Demos/Illum/Ogre/src/DiffuseTest/scripts/DiffuseTest.vcproj
r1598 r1629 155 155 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"> 156 156 <File 157 RelativePath="..\..\..\Media\materials\scripts\difflab.material"> 158 </File> 159 <File 157 160 RelativePath="..\..\..\Media\materials\scripts\diffscene.material"> 158 161 </File> -
GTP/trunk/App/Demos/Illum/Ogre/src/GameToolsRaytraceDemo/include/GameToolsRaytraceDemo.h
r1487 r1629 41 41 SceneNode* aluSphereNode; 42 42 SceneNode* lightNode; 43 Light* light; 43 44 unsigned long framecount; 44 45 … … 48 49 SceneNode* silverSphereNode, 49 50 SceneNode* copperSphereNode, 50 SceneNode* aluSphereNode) 51 SceneNode* aluSphereNode, 52 Light* light) 51 53 :ExampleFrameListener(window, maincam) 52 54 … … 58 60 this->aluSphereNode = aluSphereNode; 59 61 this->lightNode = lightNode; 62 this->light = light; 60 63 } 61 64 bool processUnbufferedKeyInput(const FrameEvent& evt) … … 108 111 109 112 lightNode->setPosition( 100.0 * Vector3(cos(-(float)framecount/500.0),2.0,sin(-(float)framecount/500.0))); 110 //lightNode->setDirection(-lightNode->getPosition());113 light->setDirection(Vector3(0,100,0)-lightNode->getPosition()); 111 114 112 115 goldSphereNode->setPosition( 100.0 * … … 145 148 146 149 public: 147 /* virtual void go(void) 148 { 149 if (!setup()) 150 return; 151 152 renderScene(); 153 154 // clean up 155 destroyScene(); 156 } 157 */ 150 158 151 159 152 protected: … … 164 157 SceneNode* copperSphereNode; 165 158 SceneNode* aluSphereNode; 166 /* 167 void renderScene(){ 168 169 mWindow->resetStatistics(); 170 while(true){ 171 172 173 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 174 // Pump events on Win32 175 MSG msg; 176 while( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) ) 177 { 178 TranslateMessage( &msg ); 179 DispatchMessage( &msg ); 180 } 181 182 #endif 183 184 if(!mRoot->_fireFrameStarted()){ 185 break; 186 } 187 unsigned long framenum = mRoot->getCurrentFrameNumber(); 188 189 OgreIlluminationManager::getSingleton().update(framenum, mWindow); 190 191 //mRoot->renderOneFrame(); 192 mRoot->_updateAllRenderTargets(); 193 194 mRoot->_fireFrameEnded(); 195 196 } 197 }*/ 159 Light* mainLight; 160 198 161 199 162 void createPostproc() … … 302 265 303 266 //Init lights 304 Light*mainLight = mSceneMgr->createLight("MainLight");305 mainLight->setType(Light::LT_ POINT);267 mainLight = mSceneMgr->createLight("MainLight"); 268 mainLight->setType(Light::LT_SPOTLIGHT); 306 269 mainLight->setDiffuseColour(ColourValue::White); 307 270 mainLight->setSpecularColour(ColourValue::White); 271 mainLight->setSpotlightRange(Radian(Degree(175)),Radian(Degree(180))); 308 272 mainLightNode = rootNode->createChildSceneNode(); 309 273 mainLightNode->setPosition(0,0,0); 310 274 mainLight->setPosition(mainLightNode->getWorldPosition()); 311 275 mainLightNode->attachObject(mainLight); 312 276 BillboardSet* bbs = mSceneMgr->createBillboardSet("bb", 1); 277 bbs->setDefaultDimensions(10,10); 278 bbs->createBillboard(Vector3::ZERO, ColourValue::White); 279 bbs->setMaterialName("Flare"); 280 mainLightNode->attachObject(bbs); 313 281 aluSphere->setMaterialName("EnvMetals/Alu"); 314 282 copperSphere->setMaterialName("EnvMetals/Copper"); … … 340 308 silverSphereNode, 341 309 copperSphereNode, 342 aluSphereNode); 343 mRoot->addFrameListener(mFrameListener); 310 aluSphereNode, 311 mainLight); 312 mFrameListener->setPriority(1); 313 OgreIlluminationManager::getSingleton().setPriority(2); 314 mRoot->addFrameListener(mFrameListener); 344 315 mRoot->addFrameListener(&OgreIlluminationManager::getSingleton()); 345 316
Note: See TracChangeset
for help on using the changeset viewer.