Ignore:
Timestamp:
03/31/06 17:29:32 (18 years ago)
Author:
igarcia
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/src/BBCBillboardCloudUVMapper.cpp

    r709 r721  
    1414BillboardCloudUVMapper::~BillboardCloudUVMapper() 
    1515{ 
    16         clear();  
     16        shutdown();  
    1717} 
    1818 
     
    2121} 
    2222 
    23 void BillboardCloudUVMapper::clear()  
    24 { 
    25         Ogre::LogManager::getSingleton().logMessage("Init.BSP:" + Ogre::StringConverter::toString(getNumBsp())); 
    26  
     23void BillboardCloudUVMapper::shutdown()  
     24{ 
    2725        while (getNumBsp() > 0) 
    2826        { 
     
    3028        } 
    3129 
    32         Ogre::LogManager::getSingleton().logMessage("Clear.BSP:" + Ogre::StringConverter::toString(getNumBsp())); 
    33  
    34         Ogre::LogManager::getSingleton().logMessage("Init.CL:" + Ogre::StringConverter::toString(getNumClusterLists())); 
    35  
    36         //while (getNumClusterLists() > 0) 
    37         //{ 
    38         //      removeBsp(getNumClusterLists()-1); 
    39         //} 
    40         mClusterLists.clear(); 
    41  
    42         Ogre::LogManager::getSingleton().logMessage("Clear.CL:" + Ogre::StringConverter::toString(getNumClusterLists())); 
     30        while (getNumClusterLists() > 0) 
     31        { 
     32                removeClusterList(getNumClusterLists()-1); 
     33        }        
    4334} 
    4435 
     
    8273void BillboardCloudUVMapper::removeClusterList(unsigned int iClusterList) 
    8374{ 
    84         //mClusterLists.erase(mClusterLists.begin() + iClusterList); 
     75        IMG::ClusterList *clusterList = mClusterLists[iClusterList]; 
     76        mClusterLists.erase(mClusterLists.begin() + iClusterList); 
     77        delete clusterList; 
    8578} 
    8679 
     
    142135                "," + Ogre::StringConverter::toString(max[1]-min[1]) + ")"); 
    143136 
    144         SubEntity *subEntity;                                                                                            
     137        SubEntityPtr subEntity;                                                                                          
    145138         
    146139        Ogre::Vector2 texCoords01,texCoords02,texCoords03,texCoords04; 
     
    160153        { 
    161154                Ogre::LogManager::getSingleton().logMessage("DontMerge"); 
    162                 subEntity = subEntity = mBillboardCloud->getEntity()->getSubEntity(iBillboardGroup);                             
     155                subEntity = mBillboardCloud->getEntity()->getSubEntity(iBillboardGroup);                                 
    163156                 
    164157                // Face A 
     
    285278void BillboardCloudUVMapper::addTextureInBsp(unsigned int iBillboardGroup, unsigned int iBillboard) 
    286279{ 
    287         IMG::NodeBsp *nodeDest; 
     280        IMG::NodeBspPtr nodeDest; 
    288281        IMG::Cluster cluster; 
    289282        Ogre::LogManager::getSingleton().logMessage("w:" + Ogre::StringConverter::toString(mTextureWidth)); 
     
    304297        for (unsigned int iBillboard = 0; iBillboard < mBillboardCloud->getNumBillboards(); iBillboard++) 
    305298        { 
    306                 Billboard *billboard = mBillboardCloud->getBillboard(iBillboard);                
    307                 EntityCluster *entityCluster = billboard->getBillboardClusterData()->getEntityCluster(); 
     299                BillboardPtr billboard = mBillboardCloud->getBillboard(iBillboard);              
     300                EntityClusterPtr entityCluster = billboard->getBillboardClusterData()->getEntityCluster(); 
    308301 
    309302                if (entityCluster->getNumEntitiesClusterData() > 0) 
     
    313306                                if (!enabledTextureCoordSet) 
    314307                                { 
    315                                         SubEntity *subEntity = mBillboardCloud->getEntity()->getSubEntity(0);    
     308                                        SubEntityPtr subEntity = mBillboardCloud->getEntity()->getSubEntity(0);  
    316309                                        subEntity->addTextureCoordSet(2); 
    317310                                        subEntity->enableVertexColours(true); 
     
    323316                                if (groupedBillboards) 
    324317                                { 
    325                                         SubEntity *subEntity = mBillboardCloud->getEntity()->getSubEntity(numGeneratedBillboardClouds);  
     318                                        SubEntityPtr subEntity = mBillboardCloud->getEntity()->getSubEntity(numGeneratedBillboardClouds);        
    326319                                        subEntity->addTextureCoordSet(2); 
    327320                                        subEntity->enableVertexColours(true); 
     
    355348        unsigned int iBillboardGroup; 
    356349        for (iBillboardGroup = 0; iBillboardGroup < numBillboardGroups; iBillboardGroup++) 
    357         { 
    358                  
    359                 IMG::NodeBsp *node = new IMG::NodeBsp; 
     350        {                
    360351                IMG::Bsp *bsp = new IMG::Bsp(); 
    361                 IMG::Box2d *box = new IMG::Box2d; 
    362352                IMG::ClusterList *clusterList = new IMG::ClusterList(); 
    363  
    364                 box->SetBoundBox(0, 0, mTextureAtlasWidth, mTextureAtlasHeight); 
    365                 node->SetBound(box); 
     353                IMG::NodeBspPtr node = IMG::NodeBspPtr(new IMG::NodeBsp); 
     354 
     355                node->GetBound()->SetBoundBox(0, 0, mTextureAtlasWidth, mTextureAtlasHeight); 
    366356                bsp->SetRoot(node);      
     357 
    367358                addBsp(bsp); 
    368359                addClusterList(clusterList); 
     
    375366                Ogre::LogManager::getSingleton().logMessage("id:" + Ogre::StringConverter::toString(mBillboardCloud->getBillboard(iBillboard)->getBillboardHandle())); 
    376367 
    377                 BillboardClusterData *billboardClusterData = mBillboardCloud->getBillboard(iBillboard)->getBillboardClusterData();               
     368                BillboardClusterData *billboardClusterData = mBillboardCloud->getBillboard(iBillboard)->getBillboardClusterData().get();                 
    378369                 
    379370                if (billboardClusterData != NULL) 
    380371                { 
    381372                        Ogre::LogManager::getSingleton().logMessage("billboardData"); 
    382                         EntityCluster *entityCluster = billboardClusterData->getEntityCluster(); 
     373                        EntityClusterPtr entityCluster = billboardClusterData->getEntityCluster(); 
    383374                        if (entityCluster->getNumEntitiesClusterData() > 0) 
    384375                        {                        
Note: See TracChangeset for help on using the changeset viewer.