Changeset 2095 for GTP/trunk/App/Demos/Illum/Ogre/src/ReflectionTest
- Timestamp:
- 02/05/07 17:43:39 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/Ogre/src/ReflectionTest/include/ReflectionTest.h
r2057 r2095 36 36 bool multiplebounce = true; 37 37 38 int currentMaterial = 6;39 int currentObject = 0;38 int currentMaterial = 2; 39 int currentObject = 2; 40 40 String objectNames[] = {String("sphere.mesh"), 41 String("teapot.mesh")}; 41 String("teapot.mesh"), 42 String("buddha.mesh")}; 42 43 43 44 String materialNames[] = {String("GTP/MultiBounce/Reflector"), … … 46 47 String("GTP/MultiBounce/Reflector_MinMax"), 47 48 String("GTP/MultiBounce/Refractor_MinMax"), 48 String("GTP/MultiBounce/CausticRefractor_MinMax"), 49 String("GTP/MultiBounce/Refractor2L")}; 49 String("GTP/MultiBounce/CausticRefractor_MinMax")}; 50 50 51 51 String resourceGroupName[] = { String("GTP_MultipleReflection"), … … 54 54 String("GTP_MultipleReflection_MinMax"), 55 55 String("GTP_MultipleRefraction_MinMax"), 56 String("GTP_MultipleRefraction_MinMax"), 57 String("GTP_MultipleRefraction2L")}; 56 String("GTP_MultipleRefraction_MinMax")}; 58 57 59 58 // Listener class for frame updates … … 106 105 107 106 if (mInputDevice->isKeyDown(KC_J)) 108 { 109 MaterialPtr mat1 = MaterialManager::getSingleton().getByName("GTP/MultiBounce/Refractor2L"); 110 GpuProgramParameters* Fparams1 = mat1->getTechnique(0)->getPass(0)->getFragmentProgramParameters().getPointer(); 111 MaterialPtr mat2 = MaterialManager::getSingleton().getByName("GTP/MultiBounce/PhotonMap2L"); 112 GpuProgramParameters* Fparams2 = mat2->getTechnique(0)->getPass(0)->getFragmentProgramParameters().getPointer(); 107 { 108 refIndex -= 0.001; 109 110 MaterialPtr mat1 = MaterialManager::getSingleton().getByName(materialNames[currentMaterial]); 111 if(!mat1.isNull()) 112 { 113 GpuProgramParameters* Fparams1 = mat1->getTechnique(0)->getPass(0)->getFragmentProgramParameters().getPointer(); 114 Fparams1->setNamedConstant("refIndex", refIndex); 115 } 116 MaterialPtr mat2 = MaterialManager::getSingleton().getByName("GTP/MultiBounce/PhotonMap"); 117 if(!mat2.isNull()) 118 { 119 GpuProgramParameters* Fparams2 = mat2->getTechnique(0)->getPass(0)->getFragmentProgramParameters().getPointer(); 120 Fparams2->setNamedConstant("refIndex", refIndex); 121 } 122 } 123 if (mInputDevice->isKeyDown(KC_K)) 124 { 125 refIndex += 0.001; 113 126 114 refIndex -= 0.001; 115 116 Fparams1->setNamedConstant("refIndex", refIndex); 117 Fparams2->setNamedConstant("refIndex", refIndex); 118 } 119 if (mInputDevice->isKeyDown(KC_K)) 120 { 121 MaterialPtr mat1 = MaterialManager::getSingleton().getByName("GTP/MultiBounce/Refractor2L"); 122 GpuProgramParameters* Fparams1 = mat1->getTechnique(0)->getPass(0)->getFragmentProgramParameters().getPointer(); 123 MaterialPtr mat2 = MaterialManager::getSingleton().getByName("GTP/MultiBounce/PhotonMap2L"); 124 GpuProgramParameters* Fparams2 = mat2->getTechnique(0)->getPass(0)->getFragmentProgramParameters().getPointer(); 125 126 refIndex += 0.001; 127 Fparams1->setNamedConstant("refIndex", refIndex); 128 Fparams2->setNamedConstant("refIndex", refIndex); 127 MaterialPtr mat1 = MaterialManager::getSingleton().getByName(materialNames[currentMaterial]); 128 if(!mat1.isNull()) 129 { 130 GpuProgramParameters* Fparams1 = mat1->getTechnique(0)->getPass(0)->getFragmentProgramParameters().getPointer(); 131 Fparams1->setNamedConstant("refIndex", refIndex); 132 } 133 MaterialPtr mat2 = MaterialManager::getSingleton().getByName("GTP/MultiBounce/PhotonMap"); 134 if(!mat2.isNull()) 135 { 136 GpuProgramParameters* Fparams2 = mat2->getTechnique(0)->getPass(0)->getFragmentProgramParameters().getPointer(); 137 Fparams2->setNamedConstant("refIndex", refIndex); 138 } 129 139 } 130 140 … … 220 230 capture->playEvent(); 221 231 mTimeUntilNextToggle = 1; 222 } 223 if (mInputDevice->isKeyDown(KC_V) && mTimeUntilNextToggle <= 0) 224 { 225 multiplebounce = ! multiplebounce; 226 if(multiplebounce) 227 { 228 MaterialPtr mat = MaterialManager::getSingleton().getByName("MetalTeapotMultipleBounce"); 229 mat->getTechnique(0)->getPass(0)->getFragmentProgramParameters()->setNamedConstant("SingleBounce", 0.0f); 230 } 231 else 232 { 233 MaterialPtr mat = MaterialManager::getSingleton().getByName("MetalTeapotMultipleBounce"); 234 mat->getTechnique(0)->getPass(0)->getFragmentProgramParameters()->setNamedConstant("SingleBounce", 1.0f); 235 } 236 237 mTimeUntilNextToggle = 1; 238 } 232 } 239 233 240 234 if( mInputDevice->isKeyDown( KC_ESCAPE) ) … … 338 332 ResourceGroupManager::getSingleton().initialiseResourceGroup(resourceGroupName[currentMaterial]); 339 333 if(currentMaterial == 2) 340 ResourceGroupManager::getSingleton().initialiseResourceGroup("GTP_Multi Bounce_PhotonMap");334 ResourceGroupManager::getSingleton().initialiseResourceGroup("GTP_MultipleCausticRefraction"); 341 335 if(currentMaterial == 5) 342 ResourceGroupManager::getSingleton().initialiseResourceGroup("GTP_Multi Bounce_PhotonMap_MinMax");336 ResourceGroupManager::getSingleton().initialiseResourceGroup("GTP_MultipleCausticRefraction_MinMax"); 343 337 } 344 338 … … 478 472 //mCamera->getParentSceneNode()->translate(Vector3(6.564,4.328,0.059)); 479 473 //mCamera->setPosition(4.0,4.2,-3.5); 480 mCamera->getParentSceneNode()->translate(7.0,2.6,-0.5);481 //mCamera->setPosition(7.0,2.6,-0.5);482 //mCamera->lookAt(Vector3(1.0, 0.0,0.6));474 //mCamera->getParentSceneNode()->translate(7.0,2.6,-0.5); 475 mCamera->setPosition(7.0,2.6,-0.5); 476 mCamera->lookAt(Vector3(1.0, 0.0,0.6)); 483 477 Entity* object; 484 478 … … 520 514 Light1->setSpotlightRange(Degree(0),Degree(120)); 521 515 LightNode1->attachObject(Light1); 522 516 /* 523 517 BillboardSet* bbs = mSceneMgr->createBillboardSet("bb", 1); 524 518 bbs->setDefaultDimensions(0.2, 0.2); 525 519 bbs->createBillboard(Vector3::ZERO, ColourValue::White); 526 520 bbs->setMaterialName("Flare"); 527 LightNode1->attachObject(bbs); 521 LightNode1->attachObject(bbs);*/ 528 522 } 529 523
Note: See TracChangeset
for help on using the changeset viewer.