- Timestamp:
- 11/08/06 14:03:40 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Illum/Ogre/src/ReflectionTest/include/ReflectionTest.h
r1720 r1724 35 35 protected: 36 36 unsigned long framecount; 37 SceneNode* objectNode; 37 38 38 39 public: 39 RaytraceDemoListener(RenderWindow* window, Camera* maincam )40 RaytraceDemoListener(RenderWindow* window, Camera* maincam, SceneNode* objectNode) 40 41 :ExampleFrameListener(window, maincam) 41 42 … … 43 44 this->mMoveSpeed = 2.0; 44 45 framecount = 0; 46 this->objectNode = objectNode; 45 47 } 46 48 bool processUnbufferedKeyInput(const FrameEvent& evt) 47 49 { 48 return ExampleFrameListener::processUnbufferedKeyInput(evt); 50 static float objmove = 0.01; 51 if (mInputDevice->isKeyDown(KC_UP)) 52 { 53 objectNode->translate(0,0,objmove); 54 } 55 if (mInputDevice->isKeyDown(KC_MULTIPLY)) 56 { 57 //objectNode->scale(1.1,1.1,1.1); 58 objectNode->rotate(Vector3(0,0,1), Degree(10)); 59 mTimeUntilNextToggle = 1; 60 } 61 if (mInputDevice->isKeyDown(KC_DIVIDE)) 62 { 63 //objectNode->scale(1.0/1.1,1.0/1.1,1.0/1.1); 64 objectNode->rotate(Vector3(1,0,0), Degree(10)); 65 mTimeUntilNextToggle = 1; 66 } 67 if (mInputDevice->isKeyDown(KC_ADD)) 68 { 69 objectNode->rotate(Vector3(0,1,0), Degree(10)); 70 } 71 if (mInputDevice->isKeyDown(KC_HOME)) 72 { 73 objectNode->translate(0,objmove,0); 74 } 75 if (mInputDevice->isKeyDown(KC_END)) 76 { 77 objectNode->translate(0,-objmove,0); 78 } 79 if (mInputDevice->isKeyDown(KC_DOWN)) 80 { 81 objectNode->translate(0,0,-objmove); 82 } 83 if (mInputDevice->isKeyDown(KC_RIGHT)) 84 { 85 objectNode->translate(-objmove,0,0); 86 } 87 if (mInputDevice->isKeyDown(KC_LEFT)) 88 { 89 objectNode->translate(objmove,0,0); 90 } 91 92 if (mInputDevice->isKeyDown(KC_A)) 93 { 94 // Move camera left 95 mTranslateVector.x = -mMoveScale; 96 } 97 98 if (mInputDevice->isKeyDown(KC_D)) 99 { 100 // Move camera RIGHT 101 mTranslateVector.x = mMoveScale; 102 } 103 104 /* Move camera forward by keypress. */ 105 if ( mInputDevice->isKeyDown(KC_W) ) 106 { 107 mTranslateVector.z = -mMoveScale; 108 } 109 110 /* Move camera backward by keypress. */ 111 if (mInputDevice->isKeyDown(KC_S) ) 112 { 113 mTranslateVector.z = mMoveScale; 114 } 115 116 if (mInputDevice->isKeyDown(KC_PGUP)) 117 { 118 // Move camera up 119 mTranslateVector.y = mMoveScale; 120 } 121 122 if (mInputDevice->isKeyDown(KC_PGDOWN)) 123 { 124 // Move camera down 125 mTranslateVector.y = -mMoveScale; 126 } 127 128 if( mInputDevice->isKeyDown( KC_ESCAPE) ) 129 { 130 return false; 131 } 132 133 // see if switching is on, and you want to toggle 134 if (mInputTypeSwitchingOn && mInputDevice->isKeyDown(KC_M) && mTimeUntilNextToggle <= 0) 135 { 136 switchMouseMode(); 137 mTimeUntilNextToggle = 1; 138 } 139 140 if (mInputTypeSwitchingOn && mInputDevice->isKeyDown(KC_K) && mTimeUntilNextToggle <= 0) 141 { 142 // must be going from immediate keyboard to buffered keyboard 143 switchKeyMode(); 144 mTimeUntilNextToggle = 1; 145 } 146 if (mInputDevice->isKeyDown(KC_F) && mTimeUntilNextToggle <= 0) 147 { 148 mStatsOn = !mStatsOn; 149 showDebugOverlay(mStatsOn); 150 151 mTimeUntilNextToggle = 1; 152 } 153 154 if (mInputDevice->isKeyDown(KC_SYSRQ) && mTimeUntilNextToggle <= 0) 155 { 156 char tmp[20]; 157 sprintf(tmp, "screenshot_%d.png", ++mNumScreenShots); 158 mWindow->writeContentsToFile(tmp); 159 mTimeUntilNextToggle = 0.5; 160 mWindow->setDebugText(String("Wrote ") + tmp); 161 } 162 163 static bool displayCameraDetails = false; 164 if (mInputDevice->isKeyDown(KC_P) && mTimeUntilNextToggle <= 0) 165 { 166 displayCameraDetails = !displayCameraDetails; 167 mTimeUntilNextToggle = 0.5; 168 if (!displayCameraDetails) 169 mWindow->setDebugText(""); 170 } 171 if (displayCameraDetails) 172 { 173 // Print camera details 174 mWindow->setDebugText("P: " + StringConverter::toString(mCamera->getDerivedPosition()) + " " + 175 "O: " + StringConverter::toString(mCamera->getDerivedOrientation())); 176 } 177 178 // Return true to continue rendering 179 return true; 49 180 } 50 181 bool frameStarted(const FrameEvent& evt) … … 91 222 92 223 Entity* object = mSceneMgr->createEntity("object", "teapot.mesh"); 93 object->setMaterialName(" EnvMetals/Gold");224 object->setMaterialName("MetalTeapotMultipleBounce"); 94 225 objectNode = rootNode->createChildSceneNode(); 95 226 objectNode->attachObject(object); 96 227 objectNode->scale(0.5,0.5,0.5); 97 objectNode->rotate(Vector3(0,1,0),Radian(Math::PI));228 //objectNode->scale(0.005,0.005,0.005); 98 229 objectNode->setPosition(0,1.2,0); 99 230 objectNode->_updateBounds(); … … 146 277 { 147 278 // This is where we instantiate our own frame listener 148 mFrameListener= new RaytraceDemoListener(mWindow, mCamera );279 mFrameListener= new RaytraceDemoListener(mWindow, mCamera, objectNode); 149 280 mFrameListener->setPriority(1); 150 281 OgreIlluminationManager::getSingleton().setPriority(2);
Note: See TracChangeset
for help on using the changeset viewer.