Changeset 778 for GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src
- Timestamp:
- 04/21/06 19:56:55 (18 years ago)
- Location:
- GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src
- Files:
-
- 2 added
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/BBCBillboardCloudUVMapper.cpp
r751 r778 152 152 Ogre::Vector2 texCoords01,texCoords02,texCoords03,texCoords04; 153 153 154 // DirectX working version... 155 texCoords03[0] = min[0] / mTextureAtlasWidth; 156 texCoords03[1] = 1.0 - (min[1] / mTextureAtlasHeight); 157 158 texCoords04[0] = max[0] / mTextureAtlasWidth; 159 texCoords04[1] = 1.0 - (min[1] / mTextureAtlasHeight); 160 161 texCoords01[0] = max[0] / mTextureAtlasWidth; 162 texCoords01[1] = 1.0 - (max[1] / mTextureAtlasHeight); 163 154 164 texCoords02[0] = min[0] / mTextureAtlasWidth; 155 texCoords02[1] = 1.0 - (min[1] / mTextureAtlasHeight); 156 157 texCoords01[0] = max[0] / mTextureAtlasWidth; 158 texCoords01[1] = 1.0 - (min[1] / mTextureAtlasHeight); 159 160 texCoords04[0] = max[0] / mTextureAtlasWidth; 161 texCoords04[1] = 1.0 - (max[1] / mTextureAtlasHeight); 162 163 texCoords03[0] = min[0] / mTextureAtlasWidth; 164 texCoords03[1] = 1.0 - (max[1] / mTextureAtlasHeight); 165 texCoords02[1] = 1.0 - (max[1] / mTextureAtlasHeight); 166 167 //texCoords02[0] = min[0] / mTextureAtlasWidth; 168 //texCoords02[1] = 1.0 - (min[1] / mTextureAtlasHeight); 169 170 //texCoords01[0] = max[0] / mTextureAtlasWidth; 171 //texCoords01[1] = 1.0 - (min[1] / mTextureAtlasHeight); 172 173 //texCoords04[0] = max[0] / mTextureAtlasWidth; 174 //texCoords04[1] = 1.0 - (max[1] / mTextureAtlasHeight); 175 176 //texCoords03[0] = min[0] / mTextureAtlasWidth; 177 //texCoords03[1] = 1.0 - (max[1] / mTextureAtlasHeight); 165 178 166 179 if (groupedBillboards) -
GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/IBRBillboardCloudTreeApplication.cpp
r751 r778 147 147 mSceneMgr = mFrameListener->getEnabledFrameListenerMode()->getSceneManager(); 148 148 149 if (mSampleConfigFile->getBillboardCloudDiffuseColorEntityTextureAtlasGeneration()) 149 150 { 150 151 LBBC::EntityTextureAtlasViewMode *textureAtlasFrameListenerMode; … … 164 165 } 165 166 166 { 167 LBBC::BillboardCloudTextureViewMode *anotherFrameListenerMode; 168 anotherFrameListenerMode = new LBBC::BillboardCloudTextureViewMode(mWindow,mFrameListener->getNumFrameListenerModes()); 167 if (mSampleConfigFile->getBillboardCloudDiffuseColorGroupedBillboardsTextureAtlasGeneration()) 168 { 169 LBBC::BillboardCloudDiffuseColorTextureViewMode *anotherFrameListenerMode; 170 anotherFrameListenerMode = new LBBC::BillboardCloudDiffuseColorTextureViewMode(mWindow,mFrameListener->getNumFrameListenerModes()); 169 171 anotherFrameListenerMode->chooseSceneManager(); 170 172 anotherFrameListenerMode->createCamera(); … … 177 179 anotherFrameListenerMode->setTextureAtlasFolder(mSampleConfigFile->getBillboardCloudFolder()); 178 180 anotherFrameListenerMode->setEntityClustersGroupedName(mSampleConfigFile->getEntityClustersGroupedMeshName()); 179 //anotherFrameListenerMode->setBillboardCloudSplittedName(mSampleConfigFile->getBillboardCloudSplittedMeshName()); 180 anotherFrameListenerMode->setBillboardCloudSplittedName(mSampleConfigFile->getBillboardCloudIndirectPointMeshName()); 181 anotherFrameListenerMode->setBillboardCloudSplittedName(mSampleConfigFile->getBillboardCloudSplittedMeshName()); 181 182 anotherFrameListenerMode->setBillboardCloudGroupedTextureAtlasDebug(mSampleConfigFile->getBillboardCloudDiffuseColorGroupedBillboardsTextureAtlasDebug()); 183 anotherFrameListenerMode->createScene(); 184 mFrameListener->addFrameListenerMode(anotherFrameListenerMode); 185 } 186 187 if (mSampleConfigFile->getBillboardCloudIndirectGroupedBillboardsTextureAtlasGeneration()) 188 { 189 LBBC::BillboardCloudIndirectTextureViewMode *anotherFrameListenerMode; 190 anotherFrameListenerMode = new LBBC::BillboardCloudIndirectTextureViewMode(mWindow, mFrameListener->getNumFrameListenerModes()); 191 anotherFrameListenerMode->chooseSceneManager(); 192 anotherFrameListenerMode->createCamera(); 193 anotherFrameListenerMode->createViewports(); 194 anotherFrameListenerMode->setTextureAtlasSize(mSampleConfigFile->getBillboardCloudIndirectGroupedBillboardsTextureAtlasSize()); 195 anotherFrameListenerMode->setTextureSize(mSampleConfigFile->getBillboardCloudIndirectGroupedBillboardsTextureSize()); 196 anotherFrameListenerMode->setTextureAtlasBitRange(mSampleConfigFile->getBillboardCloudIndirectGroupedBillboardsTextureAtlasBitRange()); 197 anotherFrameListenerMode->setTextureAtlasName(mSampleConfigFile->getBillboardCloudIndirectGroupedBillboardsTextureAtlasName()); 198 anotherFrameListenerMode->setTextureAtlasFolder(mSampleConfigFile->getBillboardCloudFolder()); 199 anotherFrameListenerMode->setBillboardCloudPointClustersName(mSampleConfigFile->getBillboardCloudIndirectPointMeshName()); 200 anotherFrameListenerMode->setBillboardCloudSplittedName(mSampleConfigFile->getBillboardCloudSplittedMeshName()); 201 anotherFrameListenerMode->setEntityClustersGroupedName(mSampleConfigFile->getEntityClustersGroupedMeshName()); 202 anotherFrameListenerMode->setBillboardCloudGroupedTextureAtlasDebug(mSampleConfigFile->getBillboardCloudIndirectGroupedBillboardsTextureAtlasDebug()); 182 203 anotherFrameListenerMode->createScene(); 183 204 mFrameListener->addFrameListenerMode(anotherFrameListenerMode); -
GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/LBBCManager.cpp
r751 r778 497 497 entity->getSubEntity(numSubEntities)->setMaterialName(mSampleConfigFile->getBillboardCloudIndirectPointMaterialName()); 498 498 entity->getSubEntity(numSubEntities)->enableNormals(false); 499 entity->getSubEntity(numSubEntities)->enableTextureCoords(false); 499 entity->getSubEntity(numSubEntities)->enableTextureCoords(true); 500 entity->getSubEntity(numSubEntities)->addTextureCoordSet(2); 500 501 entity->getSubEntity(numSubEntities)->enableVertexColours(true); 502 503 Ogre::Vector3 p1, p2, p3, p4, pa, pb; 504 Ogre::Real mua, mub; 505 Ogre::Real height, width; 506 Ogre::Real hDistance, wDistance; 507 508 height = Ogre::Vector3(billboard->getBillboardClusterData()->getQuadTopLeftCorner() - billboard->getBillboardClusterData()->getQuadBottomLeftCorner()).length(); 509 width = Ogre::Vector3(billboard->getBillboardClusterData()->getQuadTopLeftCorner() - billboard->getBillboardClusterData()->getQuadTopRightCorner()).length(); 501 510 502 511 for (unsigned int iLeaf = 0; iLeaf < entityCluster->getNumEntitiesClusterData(); iLeaf++) … … 507 516 Leaf *leaf = (Leaf*)leafKMeansClusterData->getEntity().get(); 508 517 vertex.position = leaf->getPosition(); 518 519 hDistance = 0.0; 520 wDistance = 0.0; 521 522 p1 = billboard->getBillboardClusterData()->getQuadTopRightCorner(); 523 p2 = billboard->getBillboardClusterData()->getQuadBottomRightCorner(); 524 p3 = leaf->getPosition(); 525 p4 = leaf->getPosition() + billboard->getBillboardClusterData()->getAxisY(); 526 527 if (BBC::Util::lineLineIntersect(p1, p2, p3, p4, &pa, &pb, &mua, &mub)) 528 { 529 hDistance = Ogre::Vector3(pa - p1).length(); 530 } 531 else 532 { 533 Ogre::LogManager::getSingleton().logMessage("Error with intersection: no solution exists."); 534 } 535 536 p1 = billboard->getBillboardClusterData()->getQuadTopLeftCorner(); 537 p2 = billboard->getBillboardClusterData()->getQuadTopRightCorner(); 538 p3 = leaf->getPosition(); 539 p4 = leaf->getPosition() + billboard->getBillboardClusterData()->getAxisX(); 540 541 if (BBC::Util::lineLineIntersect(p1, p2, p3, p4, &pa, &pb, &mua, &mub)) 542 { 543 wDistance = Ogre::Vector3(pa - p2).length(); 544 } 545 else 546 { 547 Ogre::LogManager::getSingleton().logMessage("Error with intersection: no solution exists."); 548 } 549 550 //Ogre::LogManager::getSingleton().logMessage("W:" + Ogre::StringConverter::toString(width) + " UW:" + Ogre::StringConverter::toString(wDistance)); 551 //Ogre::LogManager::getSingleton().logMessage("H:" + Ogre::StringConverter::toString(height) + " UH:" + Ogre::StringConverter::toString(hDistance)); 552 553 //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); 509 555 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(); 510 556 entity->getSubEntity(numSubEntities)->addUniqueVertex(vertex); -
GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/OBAOgreFrameListener.cpp
r751 r778 102 102 } 103 103 104 if (mInputDevice->isKeyDown(Ogre::KC_TAB) && mTimeUntilNextToggle <= 0) 104 //if (mInputDevice->isKeyDown(Ogre::KC_TAB) && mTimeUntilNextToggle <= 0) 105 if (mInputDevice->isKeyDown(Ogre::KC_TAB)) 105 106 { 106 107 mCurrentOgreFrameListenerMode = (mCurrentOgreFrameListenerMode+1) % this->getNumFrameListenerModes(); … … 108 109 mWindow->setDebugText("P: " + mDefaultOgreFrameListenerMode->getSceneManager()->getName()); 109 110 110 mTimeUntilNextToggle = 0.25;111 //mTimeUntilNextToggle = 0.25; 111 112 } 112 113
Note: See TracChangeset
for help on using the changeset viewer.