- Timestamp:
- 04/25/06 13:13:16 (19 years ago)
- Location:
- GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/LBBC
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/LBBC/LBBCBillboardViewMode.h
r786 r821 14 14 { 15 15 showDebugOverlay(false); 16 mReloadedTextures = false; 16 epsilonX = 0.0; 17 epsilonY = 0.0; 18 factor = 1.0 / 255.0; 17 19 } 18 20 … … 23 25 bool frameStarted(const Ogre::FrameEvent& evt, Ogre::InputReader *inputReader) 24 26 { 25 mWindow->getViewport(0)->setBackgroundColour(Ogre::ColourValue(0.0, 0.0, 0.0, 1.0)); 26 27 //if (!mReloadedTextures) 28 //{ 29 // for (unsigned int iSubEntity = 0; iSubEntity < mBillboardCloudEntity->getNumSubEntities(); iSubEntity++) 30 // { 31 // Ogre::MaterialPtr materialPtr = Ogre::MaterialManager::getSingleton().getByName(mBillboardCloudEntity->getSubEntity(iSubEntity)->getMaterialName()); 32 // Ogre::LogManager::getSingleton().logMessage("Reloading texture:" + materialPtr->getTechnique(0)->getPass(0)->getTextureUnitState(0)->getTextureName()); 33 34 // Ogre::TexturePtr texturePtr = Ogre::TextureManager::getSingleton().getByName(materialPtr->getTechnique(0)->getPass(0)->getTextureUnitState(0)->getTextureName()); 35 // texturePtr->reload(); 36 // materialPtr->reload(); 37 // } 38 // mReloadedTextures = true; 39 //} 27 showDebugOverlay(true); 28 mWindow->getViewport(0)->setBackgroundColour(Ogre::ColourValue(0.0, 0.0, 0.0, 1.0)); 29 mEpsilonText = Ogre::String("Epsilon:") + Ogre::StringConverter::toString(epsilonX) + Ogre::String(",") + Ogre::StringConverter::toString(epsilonY); 30 mWindow->setDebugText(mEpsilonText); 40 31 41 32 return OgreFrameListenerMode::frameStarted(evt, inputReader); 42 33 } 43 34 35 virtual bool processUnbufferedKeyInput(const Ogre::FrameEvent& evt) 36 { 37 if (mInputDevice->isKeyDown(Ogre::KC_1)) 38 { 39 epsilonX = epsilonX + factor; 40 } 41 42 if (mInputDevice->isKeyDown(Ogre::KC_2)) 43 { 44 epsilonX = epsilonX - factor; 45 } 46 47 if (mInputDevice->isKeyDown(Ogre::KC_3)) 48 { 49 epsilonY = epsilonY + factor; 50 } 51 52 if (mInputDevice->isKeyDown(Ogre::KC_4)) 53 { 54 epsilonY = epsilonY - factor; 55 } 56 57 mFragParams = mBillboardCloudEntity->getSubEntity(0)->getMaterial()->getBestTechnique()->getPass(0)->getFragmentProgramParameters(); 58 mFragParams->setNamedConstant("epsilonX", epsilonX); 59 mFragParams->setNamedConstant("epsilonY", epsilonY); 60 61 if (mInputDevice->isKeyDown(Ogre::KC_A)) 62 { 63 // Move camera left 64 mTranslateVector.x = -mMoveScale; 65 } 66 67 if (mInputDevice->isKeyDown(Ogre::KC_D)) 68 { 69 // Move camera RIGHT 70 mTranslateVector.x = mMoveScale; 71 } 72 73 /* Move camera forward by keypress. */ 74 if (mInputDevice->isKeyDown(Ogre::KC_UP) || mInputDevice->isKeyDown(Ogre::KC_W) ) 75 { 76 mTranslateVector.z = -mMoveScale; 77 } 78 79 /* Move camera backward by keypress. */ 80 if (mInputDevice->isKeyDown(Ogre::KC_DOWN) || mInputDevice->isKeyDown(Ogre::KC_S) ) 81 { 82 mTranslateVector.z = mMoveScale; 83 } 84 85 if (mInputDevice->isKeyDown(Ogre::KC_PGUP)) 86 { 87 // Move camera up 88 mTranslateVector.y = mMoveScale; 89 } 90 91 if (mInputDevice->isKeyDown(Ogre::KC_PGDOWN)) 92 { 93 // Move camera down 94 mTranslateVector.y = -mMoveScale; 95 } 96 97 if (mInputDevice->isKeyDown(Ogre::KC_RIGHT)) 98 { 99 mCamera->yaw(-mRotScale); 100 } 101 102 if (mInputDevice->isKeyDown(Ogre::KC_LEFT)) 103 { 104 mCamera->yaw(mRotScale); 105 } 106 107 // see if switching is on, and you want to toggle 108 if (mInputTypeSwitchingOn && mInputDevice->isKeyDown(Ogre::KC_M) && mTimeUntilNextToggle <= 0) 109 { 110 switchMouseMode(); 111 mTimeUntilNextToggle = 1; 112 } 113 114 if (mInputTypeSwitchingOn && mInputDevice->isKeyDown(Ogre::KC_K) && mTimeUntilNextToggle <= 0) 115 { 116 // must be going from immediate keyboard to buffered keyboard 117 switchKeyMode(); 118 mTimeUntilNextToggle = 1; 119 } 120 if (mInputDevice->isKeyDown(Ogre::KC_F) && mTimeUntilNextToggle <= 0) 121 { 122 mStatsOn = !mStatsOn; 123 showDebugOverlay(mStatsOn); 124 125 mTimeUntilNextToggle = 1; 126 } 127 if (mInputDevice->isKeyDown(Ogre::KC_T) && mTimeUntilNextToggle <= 0) 128 { 129 switch(mFiltering) 130 { 131 case Ogre::TFO_BILINEAR: 132 mFiltering = Ogre::TFO_TRILINEAR; 133 mAniso = 1; 134 break; 135 case Ogre::TFO_TRILINEAR: 136 mFiltering = Ogre::TFO_ANISOTROPIC; 137 mAniso = 8; 138 break; 139 case Ogre::TFO_ANISOTROPIC: 140 mFiltering = Ogre::TFO_BILINEAR; 141 mAniso = 1; 142 break; 143 default: 144 break; 145 } 146 Ogre::MaterialManager::getSingleton().setDefaultTextureFiltering(mFiltering); 147 Ogre::MaterialManager::getSingleton().setDefaultAnisotropy(mAniso); 148 149 150 showDebugOverlay(mStatsOn); 151 152 mTimeUntilNextToggle = 1; 153 } 154 155 if (mInputDevice->isKeyDown(Ogre::KC_SYSRQ) && mTimeUntilNextToggle <= 0) 156 { 157 char tmp[20]; 158 sprintf(tmp, "screenshot_%d.png", ++mNumScreenShots); 159 mWindow->writeContentsToFile(tmp); 160 mTimeUntilNextToggle = 0.5; 161 mWindow->setDebugText(Ogre::String("Wrote ") + tmp); 162 } 163 164 if (mInputDevice->isKeyDown(Ogre::KC_R) && mTimeUntilNextToggle <=0) 165 { 166 mSceneDetailIndex = (mSceneDetailIndex+1)%3 ; 167 switch(mSceneDetailIndex) { 168 case 0 : mCamera->setPolygonMode(Ogre::PM_SOLID) ; break ; 169 case 1 : mCamera->setPolygonMode(Ogre::PM_WIREFRAME) ; break ; 170 case 2 : mCamera->setPolygonMode(Ogre::PM_POINTS) ; break ; 171 } 172 mTimeUntilNextToggle = 0.5; 173 } 174 175 static bool displayCameraDetails = false; 176 if (mInputDevice->isKeyDown(Ogre::KC_P) && mTimeUntilNextToggle <= 0) 177 { 178 displayCameraDetails = !displayCameraDetails; 179 mTimeUntilNextToggle = 0.5; 180 if (!displayCameraDetails) 181 mWindow->setDebugText(""); 182 } 183 if (displayCameraDetails) 184 { 185 // Print camera details 186 mWindow->setDebugText("P: " + Ogre::StringConverter::toString(mCamera->getDerivedPosition()) + " " + 187 "O: " + Ogre::StringConverter::toString(mCamera->getDerivedOrientation())); 188 } 189 190 // Return true to continue rendering 191 return true; 192 } 44 193 void setBillboardCloudMeshName(Ogre::String billboardCloudMeshName) 45 194 { … … 55 204 mBillboardCloudEntity = mSceneMgr->createEntity("chestnutLeavesBillboardCloudGrouped.mesh", "chestnutLeavesBillboardCloudGrouped.mesh"); 56 205 //mBillboardCloudEntity = mSceneMgr->createEntity("mapleLeavesBillboardCloudGrouped.mesh", "mapleLeavesBillboardCloudGrouped.mesh"); 206 //mBillboardCloudEntity = mSceneMgr->createEntity("prunusLeavesBillboardCloudGrouped.mesh", "prunusLeavesBillboardCloudGrouped.mesh"); 57 207 sNode->attachObject(mBillboardCloudEntity); 58 208 sNode->rotate(Ogre::Vector3::UNIT_X, Ogre::Radian(Ogre::Degree(-90.0))); … … 64 214 Ogre::Entity *mBillboardCloudEntity; 65 215 66 bool mReloadedTextures; 216 Ogre::Real epsilonX; 217 218 Ogre::Real epsilonY; 219 220 Ogre::Real factor; 221 222 Ogre::String mEpsilonText; 223 224 Ogre::GpuProgramParametersSharedPtr mFragParams; 67 225 }; 68 226 -
GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/LBBC/LBBCClusterViewMode.h
r786 r821 22 22 bool frameStarted(const Ogre::FrameEvent& evt, Ogre::InputReader *inputReader) 23 23 { 24 showDebugOverlay(true); 24 25 mWindow->getViewport(0)->setBackgroundColour(Ogre::ColourValue(0.0, 0.0, 0.0, 1.0)); 25 26 … … 40 41 Ogre::Entity* eLeafClustersGrouped = mSceneMgr->createEntity("chestnutLeafClustersGrouped.mesh", "chestnutLeafClustersGrouped.mesh"); 41 42 //Ogre::Entity* eLeafClustersGrouped = mSceneMgr->createEntity("mapleLeafClustersGrouped.mesh", "mapleLeafClustersGrouped.mesh"); 43 //Ogre::Entity* eLeafClustersGrouped = mSceneMgr->createEntity("prunusLeafClustersGrouped.mesh", "prunusLeafClustersGrouped.mesh"); 42 44 sNode->attachObject(eLeafClustersGrouped); 43 45 sNode->rotate(Ogre::Vector3::UNIT_X, Ogre::Radian(Ogre::Degree(-90.0)));
Note: See TracChangeset
for help on using the changeset viewer.