Changeset 861 for GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src
- Timestamp:
- 04/28/06 19:49:56 (19 years ago)
- Location:
- GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IBRBillboardCloudTreeApplication.cpp
r778 r861 206 206 207 207 { 208 LBBC::EntityTextureAtlasViewMode *textureAtlasFrameListenerMode; 209 textureAtlasFrameListenerMode = new LBBC::EntityTextureAtlasViewMode(mWindow,mFrameListener->getNumFrameListenerModes()); 210 textureAtlasFrameListenerMode->chooseSceneManager(); 211 textureAtlasFrameListenerMode->createCamera(); 212 textureAtlasFrameListenerMode->createViewports(); 213 textureAtlasFrameListenerMode->setTextureAtlasSize(mSampleConfigFile->getBillboardCloudDiffuseColorEntityTextureAtlasSize()); 214 textureAtlasFrameListenerMode->setTextureAtlasBitRange(mSampleConfigFile->getBillboardCloudDiffuseColorEntityTextureAtlasBitRange()); 215 textureAtlasFrameListenerMode->setTextureAtlasNumSamples(mSampleConfigFile->getBillboardCloudDiffuseColorEntityTextureAtlasNumSamples()); 216 textureAtlasFrameListenerMode->setTextureName(mSampleConfigFile->getBillboardCloudDiffuseColorEntityTextureName()); 217 textureAtlasFrameListenerMode->setTextureAtlasName(mSampleConfigFile->getBillboardCloudDiffuseColorEntityTextureAtlasName()); 218 textureAtlasFrameListenerMode->setTextureAtlasFolder(mSampleConfigFile->getBillboardCloudFolder()); 219 220 mFrameListener->addFrameListenerMode(textureAtlasFrameListenerMode); 221 textureAtlasFrameListenerMode->createScene(); 222 } 223 224 { 208 225 LBBC::BillboardViewMode *anotherFrameListenerMode; 209 226 anotherFrameListenerMode = new LBBC::BillboardViewMode(mWindow,mFrameListener->getNumFrameListenerModes()); … … 211 228 anotherFrameListenerMode->createCamera(); 212 229 anotherFrameListenerMode->createViewports(); 213 //anotherFrameListenerMode->setBillboardCloudMeshName(mSampleConfigFile->getBillboardCloudGroupedMeshName());230 anotherFrameListenerMode->setBillboardCloudMeshName(mSampleConfigFile->getBillboardCloudGroupedMeshName()); 214 231 anotherFrameListenerMode->createScene(); 215 232 mFrameListener->addFrameListenerMode(anotherFrameListenerMode); … … 222 239 anotherFrameListenerMode->createCamera(); 223 240 anotherFrameListenerMode->createViewports(); 224 //anotherFrameListenerMode->setEntityClustersMeshName(mSampleConfigFile->getEntityClustersGroupedMeshName());241 anotherFrameListenerMode->setEntityClustersMeshName(mSampleConfigFile->getEntityClustersGroupedMeshName()); 225 242 anotherFrameListenerMode->createScene(); 226 243 mFrameListener->addFrameListenerMode(anotherFrameListenerMode); -
GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IBRBillboardCloudTreeFrameListener.cpp
r721 r861 2 2 #include "IBRBillboardCloudTreeFrameListener.h" 3 3 4 IBRBillboardCloudTreeFrameListener::IBRBillboardCloudTreeFrameListener(Ogre::RenderWindow *win, bool useBufferedInputKeys, bool useBufferedInputMouse) 5 : OgreFrameListener(win, useBufferedInputKeys, useBufferedInputMouse) 6 { 7 } 8 9 IBRBillboardCloudTreeFrameListener::~IBRBillboardCloudTreeFrameListener() 10 { 11 } 12 13 bool IBRBillboardCloudTreeFrameListener::frameStarted(const Ogre::FrameEvent& evt) 14 { 15 if (!mInputTypeSwitchingOn) 16 { 17 mInputDevice->capture(); 18 } 19 20 if ( !mUseBufferedInputMouse || !mUseBufferedInputKeys) 21 { 22 // one of the input modes is immediate, so setup what is needed for immediate mouse/key movement 23 if (mTimeUntilNextToggle >= 0) 24 { 25 mTimeUntilNextToggle -= evt.timeSinceLastFrame; 26 } 27 } 28 29 if (mUseBufferedInputKeys) 30 { 31 // no need to do any processing here, it is handled by event processor and 32 // you get the results as KeyEvents 33 } 34 else 35 { 36 if (processUnbufferedKeyInput(evt) == false) 37 { 38 return false; 39 } 40 } 41 42 //mWindow->setDebugText("P: " + mDefaultOgreFrameListenerMode->getSceneManager()->getName() + " -- " + Ogre::StringConverter::toString(mTimeUntilNextToggle)); 43 44 return mDefaultOgreFrameListenerMode->frameStarted(evt,mInputDevice); 45 } 46 47 bool IBRBillboardCloudTreeFrameListener::processUnbufferedKeyInput(const Ogre::FrameEvent& evt) 48 { 49 if( mInputDevice->isKeyDown(Ogre::KC_ESCAPE) ) 50 { 51 return false; 52 } 53 54 if (mInputDevice->isKeyDown(Ogre::KC_F1)) 55 { 56 mCurrentOgreFrameListenerMode = 0; 57 this->setEnabledFrameListenerMode(mCurrentOgreFrameListenerMode); 58 mWindow->setDebugText("P: " + mDefaultOgreFrameListenerMode->getSceneManager()->getName()); 59 60 //mTimeUntilNextToggle = 0.25; 61 } 62 63 if (mInputDevice->isKeyDown(Ogre::KC_F2)) 64 { 65 mCurrentOgreFrameListenerMode = 1; 66 this->setEnabledFrameListenerMode(mCurrentOgreFrameListenerMode); 67 mWindow->setDebugText("P: " + mDefaultOgreFrameListenerMode->getSceneManager()->getName()); 68 69 //mTimeUntilNextToggle = 0.25; 70 } 71 72 if (mInputDevice->isKeyDown(Ogre::KC_F3)) 73 { 74 mCurrentOgreFrameListenerMode = 2; 75 this->setEnabledFrameListenerMode(mCurrentOgreFrameListenerMode); 76 mWindow->setDebugText("P: " + mDefaultOgreFrameListenerMode->getSceneManager()->getName()); 77 78 //mTimeUntilNextToggle = 0.25; 79 } 80 81 if (mInputDevice->isKeyDown(Ogre::KC_F4)) 82 { 83 mCurrentOgreFrameListenerMode = 3; 84 this->setEnabledFrameListenerMode(mCurrentOgreFrameListenerMode); 85 mWindow->setDebugText("P: " + mDefaultOgreFrameListenerMode->getSceneManager()->getName()); 86 87 //mTimeUntilNextToggle = 0.25; 88 } 89 90 if (mInputDevice->isKeyDown(Ogre::KC_F5)) 91 { 92 mCurrentOgreFrameListenerMode = 4; 93 this->setEnabledFrameListenerMode(mCurrentOgreFrameListenerMode); 94 mWindow->setDebugText("P: " + mDefaultOgreFrameListenerMode->getSceneManager()->getName()); 95 96 //mTimeUntilNextToggle = 0.25; 97 } 98 99 // Return true to continue rendering 100 return true; 101 } -
GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/LBBCBillboardCloudIndirectTextureViewMode.cpp
r821 r861 164 164 Ogre::GpuProgramParametersSharedPtr fragParams; 165 165 166 fragParams = mBillboardCloudPointClusters->getSubEntity(mCurrentTexture % mBillboardCloudPointClusters->getNumSubEntities())->getMaterial()->getTechnique(0)->getPass(0)->getFragmentProgramParameters();167 fragParams->setNamedConstant("textureSize", (Ogre::Real)mTextureSize);168 mBillboardCloudPointClusters->getSubEntity(mCurrentTexture % mBillboardCloudPointClusters->getNumSubEntities())->getMaterial()->reload();169 170 166 if (mDebugTextureAtlasGeneration) 171 167 { … … 403 399 404 400 mTextureAtlas = IMG::TextureAtlasPtr( new IMG::TextureAtlas() ); 405 mTextureAtlas->create("IndirectTextureAtlas", mTextureAtlasSize, mTextureAtlasSize, mSrcPixelFormat, mCamera, Ogre::ColourValue(0.0, 0.0, 0.0 ));401 mTextureAtlas->create("IndirectTextureAtlas", mTextureAtlasSize, mTextureAtlasSize, mSrcPixelFormat, mCamera, Ogre::ColourValue(0.0, 0.0, 0.0, 0.0)); 406 402 mTextureAtlas->setTextureAtlasSceneNode(mBillboardCloudPointClustersSceneNode); 407 403 Ogre::MaterialPtr materialPtr1 = Ogre::MaterialManager::getSingleton().create("IndirectTextureAtlasMaterial", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); … … 415 411 416 412 mClusterTexture = IMG::TexturePtr( new IMG::Texture() ); 417 mClusterTexture->create("ClusterIndirectTexture", mTextureSize, mTextureSize, mSrcPixelFormat, mCamera, Ogre::ColourValue(0.0, 0.0, 0.0 ));413 mClusterTexture->create("ClusterIndirectTexture", mTextureSize, mTextureSize, mSrcPixelFormat, mCamera, Ogre::ColourValue(0.0, 0.0, 0.0, 0.0)); 418 414 Ogre::MaterialPtr materialPtr = Ogre::MaterialManager::getSingleton().create("IndirectTextureMaterial", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); 419 415 if (!mDebugTextureAtlasGeneration) -
GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/LBBCManager.cpp
r778 r861 192 192 void LBBCManager::generateEntityDistribution() 193 193 { 194 if (mSampleConfigFile->getEntityDistributionGeneration()) 195 { 196 createEntityDistribution(); 197 saveEntityDistributionSplitted(); 198 saveEntityDistributionXML(); 199 } 194 createEntityDistribution(); 195 saveEntityDistributionSplitted(); 196 saveEntityDistributionXML(); 200 197 } 201 198 … … 552 549 553 550 //vertex.uv[0] = Ogre::Vector3(wDistance / width, hDistance / height, 0.0); 554 vertex.uv[0] = Ogre::Vector3(1.0 - (hDistance / height), 1.0 - (wDistance / width), 0.0); 551 //vertex.uv[0] = Ogre::Vector3(1.0 - (hDistance / height), 1.0 - (wDistance / width), 0.0); 552 Ogre::Real numSamples = mSampleConfigFile->getBillboardCloudDiffuseColorEntityTextureAtlasNumSamples(); 553 Ogre::Real randomInt = Ogre::Math::Ceil(Ogre::Math::RangeRandom(0.5,numSamples)); 554 555 Ogre::Vector2 topLeftCorner[16]; 556 topLeftCorner[0] = Ogre::Vector2(0.0, 0.0); 557 topLeftCorner[1] = Ogre::Vector2(0.25, 0.0); 558 topLeftCorner[2] = Ogre::Vector2(0.5, 0.0); 559 topLeftCorner[3] = Ogre::Vector2(0.75, 0.0); 560 topLeftCorner[4] = Ogre::Vector2(0.0, 0.25); 561 topLeftCorner[5] = Ogre::Vector2(0.25, 0.25); 562 topLeftCorner[6] = Ogre::Vector2(0.5, 0.25); 563 topLeftCorner[7] = Ogre::Vector2(0.75, 0.25); 564 topLeftCorner[8] = Ogre::Vector2(0.0, 0.5); 565 topLeftCorner[9] = Ogre::Vector2(0.25, 0.5); 566 topLeftCorner[10] = Ogre::Vector2(0.5, 0.5); 567 topLeftCorner[11] = Ogre::Vector2(0.75, 0.5); 568 topLeftCorner[12] = Ogre::Vector2(0.0, 0.75); 569 topLeftCorner[13] = Ogre::Vector2(0.25, 0.75); 570 topLeftCorner[14] = Ogre::Vector2(0.5, 0.75); 571 topLeftCorner[15] = Ogre::Vector2(0.75, 0.75); 572 573 //vertex.uv[0] = Ogre::Vector3(randomInt / numSamples, 0.0, 0.0); 574 575 vertex.uv[0] = Ogre::Vector3(1.0 - topLeftCorner[(unsigned int)randomInt-1][0], 1.0 - topLeftCorner[(unsigned int)randomInt-1][1], 0.0); 555 576 vertex.colour = Ogre::ColourValue(Ogre::Math::RangeRandom(0.0, 1.0), Ogre::Math::RangeRandom(0.0, 1.0), Ogre::Math::RangeRandom(0.0, 1.0), 1.0).getAsRGBA(); 556 577 entity->getSubEntity(numSubEntities)->addUniqueVertex(vertex);
Note: See TracChangeset
for help on using the changeset viewer.