#include "IBRBillboardCloudTreeApplication.h" IBRBillboardCloudTreeApplication::IBRBillboardCloudTreeApplication() { } IBRBillboardCloudTreeApplication::~IBRBillboardCloudTreeApplication() { // Gametools -- BUG: 31/03/2006 //if (mLBBCManager) //{ // delete mLBBCManager; //} } void IBRBillboardCloudTreeApplication::initialize() { for (unsigned int i = 0; i < 1; i++) { mSampleConfigFile = new LBBC::SampleConfigFile(); mSampleConfigFile->load(mOpts.cfg); //---------------------------------------------------------------------------- this->setup(false); mLBBCManager = new LBBC::LBBCManager(); mLBBCManager->setSampleConfigFile(mSampleConfigFile); //mLBBCManager->loadSampleConfigFile(mOpts.cfg); mLBBCManager->initialize(); if (mSampleConfigFile->getEntityDistributionGeneration()) { mLBBCManager->generateEntityDistribution(); } else { mLBBCManager->loadEntityDistribution(); } if (mSampleConfigFile->getEntitySampleMeshGeneration()) { mLBBCManager->saveSingleEntity(); } if (mSampleConfigFile->getEntityClustersGeneration()) { mLBBCManager->generateEntityClusters(); } if (mSampleConfigFile->getBillboardCloudGeneration()) { mLBBCManager->generateBillboardCloud(); } mLBBCManager->shutdown(); delete mLBBCManager; mOgreBase->shutdown(); delete mOgreBase; //---------------------------------------------------------------------------- this->setup(true); mLBBCManager = new LBBC::LBBCManager(); mLBBCManager->setSampleConfigFile(mSampleConfigFile); //mLBBCManager->loadSampleConfigFile(mOpts.cfg); mLBBCManager->initialize(); //mLBBCManager->loadBillboardCloudMergedXML(); mLBBCManager->loadBillboardCloudGroupedXML(); this->go(); for (unsigned int iFrameListenerMode = 0; iFrameListenerMode < mFrameListener->getNumFrameListenerModes(); iFrameListenerMode++) { mFrameListener->getFrameListenerMode(iFrameListenerMode)->destroyScene(); } mLBBCManager->shutdown(); delete mLBBCManager; mRoot->shutdown(); mWindow->destroy(); delete mRoot; delete mSampleConfigFile; } } int IBRBillboardCloudTreeApplication::findCommandLineOpts(int numargs, char** argv, Ogre::UnaryOptionList& unaryOptList, Ogre::BinaryOptionList& binOptList) { int startIndex = 1; for (int i = 1; i < numargs; ++i) { Ogre::String tmp(argv[i]); if (Ogre::StringUtil::startsWith(tmp, "-")) { Ogre::UnaryOptionList::iterator ui = unaryOptList.find(argv[i]); if(ui != unaryOptList.end()) { ui->second = true; ++startIndex; continue; } Ogre::BinaryOptionList::iterator bi = binOptList.find(argv[i]); if(bi != binOptList.end()) { bi->second = argv[i+1]; startIndex += 2; ++i; continue; } // Invalid option std::cout<<"Invalid option "<second.empty()) { mOpts.cfg = bi->second; } } } void IBRBillboardCloudTreeApplication::createFrameListener(void) { mFrameListener = new IBRBillboardCloudTreeFrameListener(mWindow); mSceneMgr = mFrameListener->getEnabledFrameListenerMode()->getSceneManager(); if (mSampleConfigFile->getBillboardCloudDiffuseColorEntityTextureAtlasGeneration()) { LBBC::EntityTextureAtlasViewMode *textureAtlasFrameListenerMode; textureAtlasFrameListenerMode = new LBBC::EntityTextureAtlasViewMode(mWindow,mFrameListener->getNumFrameListenerModes()); textureAtlasFrameListenerMode->chooseSceneManager(); textureAtlasFrameListenerMode->createCamera(); textureAtlasFrameListenerMode->createViewports(); textureAtlasFrameListenerMode->setTextureAtlasSize(mSampleConfigFile->getBillboardCloudDiffuseColorEntityTextureAtlasSize()); textureAtlasFrameListenerMode->setTextureAtlasBitRange(mSampleConfigFile->getBillboardCloudDiffuseColorEntityTextureAtlasBitRange()); textureAtlasFrameListenerMode->setTextureAtlasNumSamples(mSampleConfigFile->getBillboardCloudDiffuseColorEntityTextureAtlasNumSamples()); textureAtlasFrameListenerMode->setTextureName(mSampleConfigFile->getBillboardCloudDiffuseColorEntityTextureName()); textureAtlasFrameListenerMode->setTextureAtlasName(mSampleConfigFile->getBillboardCloudDiffuseColorEntityTextureAtlasName()); textureAtlasFrameListenerMode->setTextureAtlasFolder(mSampleConfigFile->getBillboardCloudFolder()); mFrameListener->addFrameListenerMode(textureAtlasFrameListenerMode); textureAtlasFrameListenerMode->createScene(); } if (mSampleConfigFile->getBillboardCloudDiffuseColorGroupedBillboardsTextureAtlasGeneration()) { LBBC::BillboardCloudDiffuseColorTextureViewMode *anotherFrameListenerMode; anotherFrameListenerMode = new LBBC::BillboardCloudDiffuseColorTextureViewMode(mWindow,mFrameListener->getNumFrameListenerModes()); anotherFrameListenerMode->chooseSceneManager(); anotherFrameListenerMode->createCamera(); anotherFrameListenerMode->createViewports(); anotherFrameListenerMode->setTextureAtlasSize(mSampleConfigFile->getBillboardCloudDiffuseColorGroupedBillboardsTextureAtlasSize()); anotherFrameListenerMode->setTextureSize(mSampleConfigFile->getBillboardCloudDiffuseColorGroupedBillboardsTextureSize()); anotherFrameListenerMode->setTextureAtlasBitRange(mSampleConfigFile->getBillboardCloudDiffuseColorGroupedBillboardsTextureAtlasBitRange()); anotherFrameListenerMode->setTextureAtlasName(mSampleConfigFile->getBillboardCloudDiffuseColorGroupedBillboardsTextureAtlasName()); anotherFrameListenerMode->setTextureName(mSampleConfigFile->getBillboardCloudDiffuseColorEntityTextureName()); anotherFrameListenerMode->setTextureAtlasFolder(mSampleConfigFile->getBillboardCloudFolder()); anotherFrameListenerMode->setEntityClustersGroupedName(mSampleConfigFile->getEntityClustersGroupedMeshName()); anotherFrameListenerMode->setBillboardCloudSplittedName(mSampleConfigFile->getBillboardCloudSplittedMeshName()); anotherFrameListenerMode->setBillboardCloudGroupedTextureAtlasDebug(mSampleConfigFile->getBillboardCloudDiffuseColorGroupedBillboardsTextureAtlasDebug()); anotherFrameListenerMode->createScene(); mFrameListener->addFrameListenerMode(anotherFrameListenerMode); } if (mSampleConfigFile->getBillboardCloudIndirectGroupedBillboardsTextureAtlasGeneration()) { LBBC::BillboardCloudIndirectTextureViewMode *anotherFrameListenerMode; anotherFrameListenerMode = new LBBC::BillboardCloudIndirectTextureViewMode(mWindow, mFrameListener->getNumFrameListenerModes()); anotherFrameListenerMode->chooseSceneManager(); anotherFrameListenerMode->createCamera(); anotherFrameListenerMode->createViewports(); anotherFrameListenerMode->setTextureAtlasSize(mSampleConfigFile->getBillboardCloudIndirectGroupedBillboardsTextureAtlasSize()); anotherFrameListenerMode->setTextureSize(mSampleConfigFile->getBillboardCloudIndirectGroupedBillboardsTextureSize()); anotherFrameListenerMode->setTextureAtlasBitRange(mSampleConfigFile->getBillboardCloudIndirectGroupedBillboardsTextureAtlasBitRange()); anotherFrameListenerMode->setTextureAtlasName(mSampleConfigFile->getBillboardCloudIndirectGroupedBillboardsTextureAtlasName()); anotherFrameListenerMode->setTextureAtlasFolder(mSampleConfigFile->getBillboardCloudFolder()); anotherFrameListenerMode->setBillboardCloudPointClustersName(mSampleConfigFile->getBillboardCloudIndirectPointMeshName()); anotherFrameListenerMode->setBillboardCloudSplittedName(mSampleConfigFile->getBillboardCloudSplittedMeshName()); anotherFrameListenerMode->setEntityClustersGroupedName(mSampleConfigFile->getEntityClustersGroupedMeshName()); anotherFrameListenerMode->setBillboardCloudGroupedTextureAtlasDebug(mSampleConfigFile->getBillboardCloudIndirectGroupedBillboardsTextureAtlasDebug()); anotherFrameListenerMode->createScene(); mFrameListener->addFrameListenerMode(anotherFrameListenerMode); } { LBBC::BillboardViewMode *anotherFrameListenerMode; anotherFrameListenerMode = new LBBC::BillboardViewMode(mWindow,mFrameListener->getNumFrameListenerModes()); anotherFrameListenerMode->chooseSceneManager(); anotherFrameListenerMode->createCamera(); anotherFrameListenerMode->createViewports(); //anotherFrameListenerMode->setBillboardCloudMeshName(mSampleConfigFile->getBillboardCloudGroupedMeshName()); anotherFrameListenerMode->createScene(); mFrameListener->addFrameListenerMode(anotherFrameListenerMode); } { LBBC::ClusterViewMode *anotherFrameListenerMode; anotherFrameListenerMode = new LBBC::ClusterViewMode(mWindow,mFrameListener->getNumFrameListenerModes()); anotherFrameListenerMode->chooseSceneManager(); anotherFrameListenerMode->createCamera(); anotherFrameListenerMode->createViewports(); //anotherFrameListenerMode->setEntityClustersMeshName(mSampleConfigFile->getEntityClustersGroupedMeshName()); anotherFrameListenerMode->createScene(); mFrameListener->addFrameListenerMode(anotherFrameListenerMode); } mFrameListener->removeFrameListenerMode(0); mFrameListener->setEnabledFrameListenerMode(0); mRoot->addFrameListener(mFrameListener); }