Ignore:
Timestamp:
02/15/07 14:45:30 (17 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp

    r2115 r2119  
    2323#include "IntersectableWrapper.h" 
    2424#include "IVReader.h" 
     25#include "ObjReader.h" 
     26 
    2527 
    2628 
     
    154156 
    155157        // load the scene 
    156         LoadScene(mFilename); 
    157          
    158         // load view cells 
    159         //mViewCellsLoaded = LoadViewCells(mViewCellsFilename); 
     158        LoadScene(mFilename, mViewCellsFilename); 
     159         
     160        // load view cells: load later ... 
     161        if (0) mViewCellsLoaded = LoadViewCells(mViewCellsFilename); 
    160162 
    161163        if (mShowTerrain) 
     
    15921594} 
    15931595//----------------------------------------------------------------------- 
    1594 bool OcclusionCullingSceneManager::LoadScene(const String &filename) 
     1596bool OcclusionCullingSceneManager::LoadScene(const String &filename,  
     1597                                                                                         const String &viewCellsFilename) 
    15951598{ 
    15961599        using namespace std; 
     
    16201623                const string fn = *fit; 
    16211624 
    1622                 if (strstr(fn.c_str(), ".iv") || strstr(fn.c_str(), ".wrl")) 
     1625                if (strstr(fn.c_str(), ".obj")) 
     1626                { 
     1627                        // load iv files 
     1628                        if (!LoadSceneObj(filename, viewCellsFilename, getRootSceneNode())) 
     1629                        { 
     1630                                LogManager::getSingleton().logMessage("error loading file"); 
     1631                                return false; 
     1632            } 
     1633                } 
     1634                else if (strstr(fn.c_str(), ".iv") || strstr(fn.c_str(), ".wrl")) 
    16231635                { 
    16241636                        // load iv files 
     
    16821694} 
    16831695//----------------------------------------------------------------------- 
     1696bool OcclusionCullingSceneManager::LoadSceneObj(const String &filename, 
     1697                                                                                                const String &viewCellsFile, 
     1698                                                                                                SceneNode *root) 
     1699{ 
     1700        ObjReader objReader(this); 
     1701 
     1702        Timer *timer = PlatformManager::getSingleton().createTimer(); 
     1703        timer->reset(); 
     1704 
     1705        if (!objReader.LoadFile(filename.c_str(), viewCellsFile, root)) 
     1706        { 
     1707                PlatformManager::getSingleton().destroyTimer(timer); 
     1708                return false; 
     1709        } 
     1710 
     1711        SceneNode *node = root->createChildSceneNode("ObjSceneNode"); 
     1712 
     1713        std::stringstream d;  
     1714        d << "loaded " << filename << " in " << timer->getMilliseconds() * 1e-3 << " secs"; 
     1715        LogManager::getSingleton().logMessage(d.str()); 
     1716                 
     1717        PlatformManager::getSingleton().destroyTimer(timer); 
     1718 
     1719        return true; 
     1720} 
     1721//----------------------------------------------------------------------- 
    16841722const String OcclusionCullingSceneManagerFactory::FACTORY_TYPE_NAME = "OcclusionCullingSceneManager"; 
    16851723//----------------------------------------------------------------------- 
Note: See TracChangeset for help on using the changeset viewer.