- Timestamp:
- 04/06/06 20:48:19 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/LBBCManager.cpp
r721 r731 4 4 namespace LBBC { 5 5 6 Manager::Manager()7 : BBC:: Manager()6 LBBCManager::LBBCManager() 7 : BBC::BBCManager() 8 8 { 9 9 mBillboardCloudSerializer = new KMeansClusterSerializer(); … … 15 15 } 16 16 17 Manager::~Manager()17 LBBCManager::~LBBCManager() 18 18 { 19 19 if (mOgreMeshSerializer) … … 21 21 delete mOgreMeshSerializer; 22 22 } 23 if (mSampleConfigFile) 24 { 25 delete mSampleConfigFile; 26 } 23 // Gametools -- BUG: 06/04/2006 24 //if (mSampleConfigFile) 25 //{ 26 // delete mSampleConfigFile; 27 //} 27 28 if (mLeafDistributionSerializer) 28 29 { … … 52 53 } 53 54 54 SampleConfigFile* Manager::getSampleConfigFile()55 SampleConfigFile* LBBCManager::getSampleConfigFile() 55 56 { 56 57 return mSampleConfigFile; 57 58 } 58 59 59 void Manager::setSampleConfigFile(SampleConfigFile *sampleConfigFile)60 void LBBCManager::setSampleConfigFile(SampleConfigFile *sampleConfigFile) 60 61 { 61 62 mSampleConfigFile = sampleConfigFile; 62 63 } 63 64 64 void Manager::loadSampleConfigFile(Ogre::String sampleConfigFile)65 void LBBCManager::loadSampleConfigFile(Ogre::String sampleConfigFile) 65 66 { 66 67 mSampleConfigFile = new SampleConfigFile(); … … 68 69 } 69 70 70 void Manager::runSampleConfigFile()71 void LBBCManager::runSampleConfigFile() 71 72 { 72 73 mLeaves = new Leaves(); 73 74 74 75 BBC::EntityPtr entityLeaves(new BBC::Entity); 75 BBC::MeshPtr meshLeaves(new BBC::Mesh(this->loadMesh(mSampleConfigFile->getEntitiesFolder(), mSampleConfigFile->getEntitiesMeshPrefix Filename() + ".mesh")) );76 BBC::MeshPtr meshLeaves(new BBC::Mesh(this->loadMesh(mSampleConfigFile->getEntitiesFolder(), mSampleConfigFile->getEntitiesMeshPrefixName() + ".mesh")) ); 76 77 entityLeaves->setMesh(meshLeaves); 77 78 mLeaves->setEntity(entityLeaves); … … 87 88 } 88 89 90 if (mSampleConfigFile->getEntitySampleMeshGeneration()) 91 { 92 saveSingleEntity(); 93 } 94 89 95 if (mSampleConfigFile->getEntityClustersGeneration()) 90 96 { … … 96 102 generateBillboardCloud(); 97 103 } 98 } 99 100 void Manager::createEntityDistribution() 104 105 } 106 107 void LBBCManager::createEntityDistribution() 101 108 { 102 109 mLeafDistributionGenerator->setDistribution(mLeaves->getDistribution()); … … 105 112 } 106 113 107 void Manager::saveEntityDistributionSplitted()114 void LBBCManager::saveEntityDistributionSplitted() 108 115 { 109 116 BBC::EntityPtr entity; … … 143 150 mOgreMeshSerializer->setEntity(entity); 144 151 mOgreMeshSerializer->exportMesh(mSampleConfigFile->getEntityClustersFolder() + 145 mSampleConfigFile->getEntityClustersMeshPrefix Filename() + "Splitted.mesh", false, false);152 mSampleConfigFile->getEntityClustersMeshPrefixName() + "Splitted.mesh", false, false); 146 153 147 OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh(entity->getMesh()->get(), mSampleConfigFile->getEntityDistributionFolder() + mSampleConfigFile->getEntitiesMeshPrefix Filename() + "Splitted.mesh");148 //OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(entity->getMesh().get(), mSampleConfigFile->getEntityClustersFolder() + mSampleConfigFile->getEntitiesMeshPrefix Filename() + "Splitted.mesh" + ".xml");154 OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh(entity->getMesh()->get(), mSampleConfigFile->getEntityDistributionFolder() + mSampleConfigFile->getEntitiesMeshPrefixName() + "Splitted.mesh"); 155 //OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(entity->getMesh().get(), mSampleConfigFile->getEntityClustersFolder() + mSampleConfigFile->getEntitiesMeshPrefixName() + "Splitted.mesh" + ".xml"); 149 156 } 150 157 } … … 157 164 mOgreMeshSerializer->setEntity(entity); 158 165 mOgreMeshSerializer->exportMesh(mSampleConfigFile->getEntityClustersFolder() + 159 mSampleConfigFile->getEntityClustersMeshPrefixFilename() + "Merged.mesh", false, false); 160 161 OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh((Ogre::Mesh*)entity->getMesh().get(), mSampleConfigFile->getEntityDistributionFolder() + mSampleConfigFile->getEntitiesMeshPrefixFilename() + "Merged.mesh"); 162 //OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(entity->getMesh(), mSampleConfigFile->getEntityClustersFolder() + mSampleConfigFile->getEntitiesMeshPrefixFilename() + "Merged.mesh" + ".xml"); 163 164 //Ogre::MeshManager::getSingleton().unload(mSampleConfigFile->getEntitiesMeshPrefixFilename() + "Merged.mesh"); 165 } 166 } 167 168 void Manager::saveEntityDistributionXML() 166 mSampleConfigFile->getEntityClustersMeshPrefixName() + "Merged.mesh", false, false); 167 168 OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh((Ogre::Mesh*)entity->getMesh().get(), mSampleConfigFile->getEntityDistributionFolder() + mSampleConfigFile->getEntitiesMeshPrefixName() + "Merged.mesh"); 169 //OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(entity->getMesh(), mSampleConfigFile->getEntityClustersFolder() + mSampleConfigFile->getEntitiesMeshPrefixName() + "Merged.mesh" + ".xml"); 170 } 171 } 172 173 void LBBCManager::saveEntityDistributionXML() 169 174 { 170 175 TiXmlDocument *document = mLeafDistributionSerializer->create( 171 176 mSampleConfigFile->getEntityDistributionFolder() + 172 mSampleConfigFile->getEntityDistributionXMLPrefix Filename() + ".xml");177 mSampleConfigFile->getEntityDistributionXMLPrefixName() + ".xml"); 173 178 mLeafDistributionSerializer->setLeafDistribution(mLeaves->getDistribution()); 174 179 mLeafDistributionSerializer->writeLeafDistribution(document); … … 176 181 } 177 182 178 void Manager::loadEntityDistribution()183 void LBBCManager::loadEntityDistribution() 179 184 { 180 185 TiXmlDocument *document = mLeafDistributionSerializer->load( 181 186 mSampleConfigFile->getEntityDistributionFolder() + 182 mSampleConfigFile->getEntityDistributionXMLPrefix Filename() + ".xml");187 mSampleConfigFile->getEntityDistributionXMLPrefixName() + ".xml"); 183 188 mLeafDistributionSerializer->setLeafDistribution(mLeaves->getDistribution()); 184 189 mLeafDistributionSerializer->getEntity()->setMesh(mLeaves->getEntity()->getMesh()); … … 188 193 BBC::EntityDistribution *entityDistribution; 189 194 190 BBC::MeshPtr pMeshLeavesSplitted(new BBC::Mesh(this->loadMesh(mSampleConfigFile->getEntitiesFolder(), mSampleConfigFile->getEntitiesMeshPrefix Filename() + "Splitted.mesh")));195 BBC::MeshPtr pMeshLeavesSplitted(new BBC::Mesh(this->loadMesh(mSampleConfigFile->getEntitiesFolder(), mSampleConfigFile->getEntitiesMeshPrefixName() + "Splitted.mesh"))); 191 196 entity = BBC::EntityPtr(new BBC::Entity()); 192 197 entity->setMesh(pMeshLeavesSplitted); … … 211 216 } 212 217 213 void Manager::generateEntityDistribution()218 void LBBCManager::generateEntityDistribution() 214 219 { 215 220 if (mSampleConfigFile->getEntityDistributionGeneration()) … … 221 226 } 222 227 223 void Manager::saveBillboardCloudGrouped()228 void LBBCManager::saveBillboardCloudGrouped() 224 229 { 225 230 for (unsigned int iSubEntity = 0; iSubEntity < mLeaves->getBillboardCloud()->getEntity()->getNumSubEntities(); iSubEntity++) 226 231 { 227 232 BBC::SubEntityPtr subEntity = mLeaves->getBillboardCloud()->getEntity()->getSubEntity(iSubEntity); 228 subEntity->setMaterialName(mSampleConfigFile->getBillboardCloud MaterialPrefixFilename());233 subEntity->setMaterialName(mSampleConfigFile->getBillboardCloudBillboardGroupMaterialPrefixName()); 229 234 } 230 235 mOgreMeshSerializer->setEntity(mLeaves->getBillboardCloud()->getEntity()); … … 232 237 Ogre::LogManager::getSingleton().logMessage("Num.SubEntities:" + Ogre::StringConverter::toString(mLeaves->getBillboardCloud()->getEntity()->getNumSubEntities())); 233 238 mOgreMeshSerializer->exportMesh(mSampleConfigFile->getBillboardCloudFolder() + 234 mSampleConfigFile->getBillboardCloudMeshPrefixFilename() + "Grouped.mesh",false, false); 235 OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh()->get(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixFilename() + "Grouped.mesh"); 236 OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh()->get(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixFilename() + "Grouped.mesh.xml"); 237 238 //Ogre::MeshManager::getSingleton().unload(mSampleConfigFile->getBillboardCloudMeshPrefixFilename() + "Grouped.mesh"); 239 } 240 241 242 void Manager::saveBillboardCloudSplitted() 239 mSampleConfigFile->getBillboardCloudMeshPrefixName() + "Grouped.mesh",false, false); 240 OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh()->get(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixName() + "Grouped.mesh"); 241 OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh()->get(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixName() + "Grouped.mesh.xml"); 242 } 243 244 245 void LBBCManager::saveBillboardCloudSplitted() 243 246 { 244 247 for (unsigned int iSubEntity = 0; iSubEntity < mLeaves->getBillboardCloud()->getEntity()->getNumSubEntities(); iSubEntity++) 245 248 { 246 249 BBC::SubEntityPtr subEntity = mLeaves->getBillboardCloud()->getEntity()->getSubEntity(iSubEntity); 247 subEntity->setMaterialName(mSampleConfigFile->getBillboardCloud MaterialPrefixFilename());250 subEntity->setMaterialName(mSampleConfigFile->getBillboardCloudBillboardMaterialPrefixName()); 248 251 } 249 252 … … 253 256 254 257 mOgreMeshSerializer->exportMesh(mSampleConfigFile->getBillboardCloudFolder() + 255 mSampleConfigFile->getBillboardCloudMeshPrefix Filename() + "Splitted.mesh",false, false);256 257 OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh()->get(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefix Filename() + "Splitted.mesh");258 259 OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh()->get(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefix Filename() + "Splitted.mesh.xml");260 } 261 262 void Manager::saveBillboardCloudMerged()258 mSampleConfigFile->getBillboardCloudMeshPrefixName() + "Splitted.mesh",false, false); 259 260 OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh()->get(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixName() + "Splitted.mesh"); 261 262 OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh()->get(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixName() + "Splitted.mesh.xml"); 263 } 264 265 void LBBCManager::saveBillboardCloudMerged() 263 266 { 264 //mLeaves->getBillboardCloud()->getEntity()->getSubEntity(0)->setMaterialName(mSampleConfigFile->getBillboardCloudMaterialPrefix Filename());267 //mLeaves->getBillboardCloud()->getEntity()->getSubEntity(0)->setMaterialName(mSampleConfigFile->getBillboardCloudMaterialPrefixName()); 265 268 //mOgreMeshSerializer->setEntity(mLeaves->getBillboardCloud()->getEntity()); 266 269 //mOgreMeshSerializer->exportMesh(mSampleConfigFile->getBillboardCloudFolder() + 267 // mSampleConfigFile->getBillboardCloudMeshPrefix Filename() + "Merged.mesh", mSampleConfigFile->getBillboardCloudMergedBillboards(), false);270 // mSampleConfigFile->getBillboardCloudMeshPrefixName() + "Merged.mesh", mSampleConfigFile->getBillboardCloudMergedBillboards(), false); 268 271 //OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh(), 269 // mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefix Filename() + "Merged.mesh");270 //OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefix Filename() + "Merged.mesh.xml");272 // mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixName() + "Merged.mesh"); 273 //OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixName() + "Merged.mesh.xml"); 271 274 272 275 … … 274 277 { 275 278 BBC::SubEntityPtr subEntity = mLeaves->getBillboardCloud()->getEntity()->getSubEntity(iSubEntity); 276 subEntity->setMaterialName(mSampleConfigFile->getBillboardCloud MaterialPrefixFilename());279 subEntity->setMaterialName(mSampleConfigFile->getBillboardCloudBillboardGroupMaterialPrefixName()); 277 280 } 278 281 mOgreMeshSerializer->setEntity(mLeaves->getBillboardCloud()->getEntity()); … … 280 283 Ogre::LogManager::getSingleton().logMessage("Num.SubEntities:" + Ogre::StringConverter::toString(mLeaves->getBillboardCloud()->getEntity()->getNumSubEntities())); 281 284 mOgreMeshSerializer->exportMesh(mSampleConfigFile->getBillboardCloudFolder() + 282 mSampleConfigFile->getBillboardCloudMeshPrefixFilename() + "Merged.mesh",false, false); 283 OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh()->get(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixFilename() + "Merged.mesh"); 284 OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh()->get(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixFilename() + "Merged.mesh.xml"); 285 286 //Ogre::MeshManager::getSingleton().unload(mSampleConfigFile->getBillboardCloudMeshPrefixFilename() + "Merged.mesh"); 287 } 288 289 void Manager::saveBillboardCloudXML() 285 mSampleConfigFile->getBillboardCloudMeshPrefixName() + "Merged.mesh",false, false); 286 OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh()->get(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixName() + "Merged.mesh"); 287 OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(mLeaves->getBillboardCloud()->getEntity()->getMesh()->get(), mSampleConfigFile->getBillboardCloudFolder() + mSampleConfigFile->getBillboardCloudMeshPrefixName() + "Merged.mesh.xml"); 288 } 289 290 void LBBCManager::saveBillboardCloudXML() 290 291 { 291 292 //saveBillboardCloud() 292 293 TiXmlDocument *document2 = mBillboardCloudSerializer->create( 293 294 mSampleConfigFile->getBillboardCloudFolder() + 294 mSampleConfigFile->getBillboardCloudXMLPrefix Filename() + ".xml");295 mSampleConfigFile->getBillboardCloudXMLPrefixName() + ".xml"); 295 296 mBillboardCloudSerializer->setBillboardCloud(mLeaves->getBillboardCloud()); 296 297 mBillboardCloudSerializer->writeBillboardCloud(document2); … … 298 299 } 299 300 300 void Manager::saveEntityClusters()301 void LBBCManager::saveEntityClusters() 301 302 { 302 303 BBC::BillboardClusterDataPtr billboardClusterData; … … 315 316 { 316 317 BBC::EntityPtr entityClusterized = entityCluster->getEntity(); 317 entityClusterized->getSubEntity(0)->setMaterialName(mSampleConfigFile->getEntityClustersMaterialPrefix Filename());318 entityClusterized->getSubEntity(0)->setMaterialName(mSampleConfigFile->getEntityClustersMaterialPrefixName()); 318 319 mOgreMeshSerializer->setEntity(entityClusterized); 319 320 mOgreMeshSerializer->exportMesh(mSampleConfigFile->getEntityDistributionFolder() + 320 mSampleConfigFile->getEntityClustersMeshPrefix Filename() +321 mSampleConfigFile->getEntityClustersMeshPrefixName() + 321 322 Ogre::StringConverter::toString(numSerializedBillboards) + ".mesh", !(mSampleConfigFile->getEntityClustersSplittedClusters()), false); 322 323 OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh(entityClusterized->getMesh()->get(), 323 324 mSampleConfigFile->getEntityClustersFolder() + 324 mSampleConfigFile->getEntityClustersMeshPrefix Filename() +325 mSampleConfigFile->getEntityClustersMeshPrefixName() + 325 326 Ogre::StringConverter::toString(numSerializedBillboards) + ".mesh"); 326 327 //OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(entityClusterized->getMesh(), entityClusterized->getMesh()->getName() + ".xml"); 327 328 //Ogre::MeshManager::getSingleton().unload(mSampleConfigFile->getEntityClustersMeshPrefixFilename() + Ogre::StringConverter::toString(numSerializedBillboards) + ".mesh");329 328 330 329 numSerializedBillboards++; … … 347 346 { 348 347 BBC::EntityPtr entityClusterized = entityCluster->getEntity(); 349 entityClusterized->getSubEntity(0)->setMaterialName(mSampleConfigFile->getEntityClustersMaterialPrefix Filename());348 entityClusterized->getSubEntity(0)->setMaterialName(mSampleConfigFile->getEntityClustersMaterialPrefixName()); 350 349 BBC::SubEntityPtr subEntity = entityClusterized->getSubEntity(0); 351 350 … … 371 370 mOgreMeshSerializer->setEntity(entity); 372 371 mOgreMeshSerializer->exportMesh(mSampleConfigFile->getEntityClustersFolder() + 373 mSampleConfigFile->getEntityClustersMeshPrefixFilename() + "Merged.mesh", false, false); 374 375 OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh(entity->getMesh()->get(), mSampleConfigFile->getEntityClustersFolder() + mSampleConfigFile->getEntityClustersMeshPrefixFilename() + "Merged.mesh"); 376 //OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(entity->getMesh(), mSampleConfigFile->getEntityClustersFolder() + mSampleConfigFile->getEntityClustersMeshPrefixFilename() + "Merged.mesh" + ".xml"); 377 378 //Ogre::MeshManager::getSingleton().unload(mSampleConfigFile->getEntityClustersMeshPrefixFilename() + "Merged.mesh"); 379 380 Ogre::LogManager::getSingleton().logMessage("Before deleting:" + mSampleConfigFile->getEntityClustersMeshPrefixFilename() + "Merged.mesh"); 381 } 382 } 383 384 void Manager::createEntityClusters() 372 mSampleConfigFile->getEntityClustersMeshPrefixName() + "Merged.mesh", false, false); 373 374 OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh(entity->getMesh()->get(), mSampleConfigFile->getEntityClustersFolder() + mSampleConfigFile->getEntityClustersMeshPrefixName() + "Merged.mesh"); 375 //OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(entity->getMesh(), mSampleConfigFile->getEntityClustersFolder() + mSampleConfigFile->getEntityClustersMeshPrefixName() + "Merged.mesh" + ".xml"); 376 377 Ogre::LogManager::getSingleton().logMessage("Before deleting:" + mSampleConfigFile->getEntityClustersMeshPrefixName() + "Merged.mesh"); 378 } 379 } 380 381 void LBBCManager::createEntityClusters() 385 382 { 386 383 mBillboardCloudGenerator->setDistribution(mLeaves->getDistribution()); … … 392 389 } 393 390 394 void Manager::saveSingleEntity() 395 { 396 if (mSampleConfigFile->getEntitySampleMeshGeneration()) 397 { 398 BBC::EntityPtr entityLeaf = mLeaves->getDistribution()->getEntity(2); 399 entityLeaf->getSubEntity(0)->setMaterialName(mSampleConfigFile->getEntityClustersMaterialPrefixFilename()); 400 mOgreMeshSerializer->setEntity(entityLeaf); 401 mOgreMeshSerializer->exportMesh(mSampleConfigFile->getEntityDistributionFolder() + 402 mSampleConfigFile->getEntitySampleMeshPrefixFilename(), mSampleConfigFile->getEntityClustersMergedClusters(), false); 403 //OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(entityLeaf->getMesh(), entityLeaf->getMesh()->getName() + ".xml"); 404 405 } 406 } 407 408 void Manager::generateEntityClusters() 409 { 410 Ogre::LogManager::getSingleton().logMessage("EntityClustersMeshPrefixName:" + mSampleConfigFile->getEntityClustersMeshPrefixFilename()); 391 void LBBCManager::saveSingleEntity() 392 { 393 BBC::EntityPtr entityLeaf = mLeaves->getDistribution()->getEntity(2); 394 entityLeaf->getSubEntity(0)->setMaterialName(mSampleConfigFile->getEntitySampleMaterialPrefixName()); 395 mOgreMeshSerializer->setEntity(entityLeaf); 396 mOgreMeshSerializer->exportMesh(mSampleConfigFile->getEntityDistributionFolder() + 397 mSampleConfigFile->getEntitySampleMeshPrefixName(), false, false); 398 OBA::OgreBase::getSingleton().getMeshSerializer()->exportMesh(entityLeaf->getMesh()->get(), mSampleConfigFile->getEntityDistributionFolder() + mSampleConfigFile->getEntitySampleMeshPrefixName() + ".mesh"); 399 OBA::OgreBase::getSingleton().getXMLMeshSerializer()->exportMesh(entityLeaf->getMesh()->get(), mSampleConfigFile->getEntityDistributionFolder() + mSampleConfigFile->getEntitySampleMeshPrefixName() + ".mesh.xml"); 400 } 401 402 void LBBCManager::generateEntityClusters() 403 { 404 Ogre::LogManager::getSingleton().logMessage("EntityClustersMeshPrefixName:" + mSampleConfigFile->getEntityClustersMeshPrefixName()); 411 405 createEntityClusters(); 412 saveEntityClusters(); 413 saveSingleEntity(); 414 } 415 416 void Manager::generateBillboardCloud() 406 saveEntityClusters(); 407 } 408 409 void LBBCManager::generateBillboardCloud() 417 410 { 418 411 if (mSampleConfigFile->getBillboardCloudMergedBillboards()) … … 422 415 mLeaves->getBillboardCloud()->initializeBillboardCloudGroups(1); 423 416 424 if (mSampleConfigFile->getBillboardCloudDiffuseColor TextureAtlasGeneration())417 if (mSampleConfigFile->getBillboardCloudDiffuseColorMergedBillboardsTextureAtlasGeneration()) 425 418 { 426 419 mBillboardCloudUVMapper->shutdown(); 427 420 mBillboardCloudUVMapper->setBillboardCloud(mLeaves->getBillboardCloud()); 428 mBillboardCloudUVMapper->setTextureWidth(mSampleConfigFile->getBillboardCloudDiffuseColor TextureSize());429 mBillboardCloudUVMapper->setTextureHeight(mSampleConfigFile->getBillboardCloudDiffuseColor TextureSize());430 mBillboardCloudUVMapper->setTextureAtlasWidth(mSampleConfigFile->getBillboardCloudDiffuseColor TextureAtlasSize());431 mBillboardCloudUVMapper->setTextureAtlasHeight(mSampleConfigFile->getBillboardCloudDiffuseColor TextureAtlasSize());421 mBillboardCloudUVMapper->setTextureWidth(mSampleConfigFile->getBillboardCloudDiffuseColorMergedBillboardsTextureSize()); 422 mBillboardCloudUVMapper->setTextureHeight(mSampleConfigFile->getBillboardCloudDiffuseColorMergedBillboardsTextureSize()); 423 mBillboardCloudUVMapper->setTextureAtlasWidth(mSampleConfigFile->getBillboardCloudDiffuseColorMergedBillboardsTextureAtlasSize()); 424 mBillboardCloudUVMapper->setTextureAtlasHeight(mSampleConfigFile->getBillboardCloudDiffuseColorMergedBillboardsTextureAtlasSize()); 432 425 mBillboardCloudUVMapper->initialize(); 433 426 … … 446 439 mLeaves->getBillboardCloud()->initializeBillboardCloudGroups(mSampleConfigFile->getBillboardCloudGroups()); 447 440 448 if (mSampleConfigFile->getBillboardCloudDiffuseColor TextureAtlasGeneration())441 if (mSampleConfigFile->getBillboardCloudDiffuseColorBillboardGroupTextureAtlasGeneration()) 449 442 { 450 443 mBillboardCloudUVMapper->shutdown(); 451 444 mBillboardCloudUVMapper->setBillboardCloud(mLeaves->getBillboardCloud()); 452 mBillboardCloudUVMapper->setTextureWidth(mSampleConfigFile->getBillboardCloudDiffuseColor TextureSize());453 mBillboardCloudUVMapper->setTextureHeight(mSampleConfigFile->getBillboardCloudDiffuseColor TextureSize());454 mBillboardCloudUVMapper->setTextureAtlasWidth(mSampleConfigFile->getBillboardCloudDiffuseColor TextureAtlasSize());455 mBillboardCloudUVMapper->setTextureAtlasHeight(mSampleConfigFile->getBillboardCloudDiffuseColor TextureAtlasSize());445 mBillboardCloudUVMapper->setTextureWidth(mSampleConfigFile->getBillboardCloudDiffuseColorBillboardGroupTextureSize()); 446 mBillboardCloudUVMapper->setTextureHeight(mSampleConfigFile->getBillboardCloudDiffuseColorBillboardGroupTextureSize()); 447 mBillboardCloudUVMapper->setTextureAtlasWidth(mSampleConfigFile->getBillboardCloudDiffuseColorBillboardGroupTextureAtlasSize()); 448 mBillboardCloudUVMapper->setTextureAtlasHeight(mSampleConfigFile->getBillboardCloudDiffuseColorBillboardGroupTextureAtlasSize()); 456 449 mBillboardCloudUVMapper->initialize(); 457 450 mBillboardCloudUVMapper->generateTextureAtlasTextureCoords(false, mSampleConfigFile->getBillboardCloudGroupedBillboards(), mSampleConfigFile->getBillboardCloudGroups()); … … 466 459 { 467 460 mLeaves->getBillboardCloud()->generateBillboardCloud(false); 468 if (mSampleConfigFile->getBillboardCloudDiffuseColorTextureAtlasGeneration())469 {470 mBillboardCloudUVMapper->shutdown();471 mBillboardCloudUVMapper->setBillboardCloud(mLeaves->getBillboardCloud());472 mBillboardCloudUVMapper->setTextureWidth(mSampleConfigFile->getBillboardCloudDiffuseColorTextureSize());473 mBillboardCloudUVMapper->setTextureHeight(mSampleConfigFile->getBillboardCloudDiffuseColorTextureSize());474 mBillboardCloudUVMapper->setTextureAtlasWidth(mSampleConfigFile->getBillboardCloudDiffuseColorTextureAtlasSize());475 mBillboardCloudUVMapper->setTextureAtlasHeight(mSampleConfigFile->getBillboardCloudDiffuseColorTextureAtlasSize());476 mBillboardCloudUVMapper->initialize();477 mBillboardCloudUVMapper->generateTextureAtlasTextureCoords(!mSampleConfigFile->getBillboardCloudSplittedBillboards(),false);478 }461 //if (mSampleConfigFile->getBillboardCloudDiffuseColorTextureAtlasGeneration()) 462 //{ 463 // mBillboardCloudUVMapper->shutdown(); 464 // mBillboardCloudUVMapper->setBillboardCloud(mLeaves->getBillboardCloud()); 465 // mBillboardCloudUVMapper->setTextureWidth(mSampleConfigFile->getBillboardCloudDiffuseColorTextureSize()); 466 // mBillboardCloudUVMapper->setTextureHeight(mSampleConfigFile->getBillboardCloudDiffuseColorTextureSize()); 467 // mBillboardCloudUVMapper->setTextureAtlasWidth(mSampleConfigFile->getBillboardCloudDiffuseColorTextureAtlasSize()); 468 // mBillboardCloudUVMapper->setTextureAtlasHeight(mSampleConfigFile->getBillboardCloudDiffuseColorTextureAtlasSize()); 469 // mBillboardCloudUVMapper->initialize(); 470 // mBillboardCloudUVMapper->generateTextureAtlasTextureCoords(!mSampleConfigFile->getBillboardCloudSplittedBillboards(),false); 471 //} 479 472 saveBillboardCloudSplitted(); 480 473 } … … 483 476 } 484 477 485 Leaves* Manager::getLeaves()478 Leaves* LBBCManager::getLeaves() 486 479 { 487 480 return mLeaves;
Note: See TracChangeset
for help on using the changeset viewer.