Ignore:
Timestamp:
01/01/09 23:49:53 (15 years ago)
Author:
mattausch
Message:

debug version

Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp

    r3236 r3237  
    196196 
    197197 
    198 void ResourceManager::LoadTextures(igzstream &str) 
     198int ResourceManager::LoadTextures(igzstream &str) 
    199199{ 
    200200        int numTextures; 
     
    228228        } 
    229229 
    230         cout << "loaded " << (int)mTextureTable.size() << " textures" << endl; 
    231 } 
    232  
    233 // mtt todo_ split that up 
    234 void ResourceManager::LoadShapes(igzstream &str) 
     230        return numTextures; 
     231} 
     232 
     233// todo: split up geometry and materials!! 
     234int ResourceManager::LoadShapes(igzstream &str) 
    235235{ 
    236236        int numShapes; 
     
    249249        } 
    250250 
    251         cout << "loaded " << (int)mGeometryTable.size() << " shapes" << endl; 
     251        return numShapes; 
    252252} 
    253253 
     
    393393 
    394394 
    395 void ResourceManager::LoadSceneEntities(igzstream &str,  
    396                                                                                 SceneEntityContainer &entities) 
     395int ResourceManager::LoadSceneEntities(igzstream &str,  
     396                                                                           SceneEntityContainer &entities) 
    397397{ 
    398398        int entityCount; 
     
    411411        } 
    412412 
    413         cout << "loaded " << entityCount << " scene entities" << endl; 
    414 } 
    415  
    416  
    417 bool ResourceManager::Load(const std::string &filename, 
    418                                                    SceneEntityContainer &entities) 
     413        return entityCount; 
     414} 
     415 
     416 
     417int ResourceManager::Load(const std::string &filename, 
     418                                                  SceneEntityContainer &entities) 
    419419{ 
    420420        igzstream istr(filename.c_str()); 
    421421         
    422422        if (!istr.is_open()) 
    423                 return false; 
     423                return 0; 
    424424 
    425425        cout << "loading textures" << endl; 
    426426         
    427427        // load the texture table 
    428         LoadTextures(istr); 
     428        int numTextures = LoadTextures(istr); 
     429 
     430        cout << "loaded " << numTextures << " textures" << endl; 
    429431 
    430432        cout << "loading shapes (geometry + materials)" << endl; 
    431433 
    432434        // load the shapees 
    433         LoadShapes(istr); 
     435        int numShapes = LoadShapes(istr); 
     436 
     437        cout << "loaded " << (int)mGeometryTable.size() << " shapes" << endl; 
    434438 
    435439        cout << "loading scene entites" << endl; 
    436         LoadSceneEntities(istr, entities); 
    437          
     440         
     441        int numEntities = LoadSceneEntities(istr, entities); 
     442         
     443        cout << "loaded " << numEntities << " scene entities" << endl; 
     444 
    438445        cout << "bin loading finished" << endl; 
    439446 
    440         // clean up 
     447        // clean up temporary tables 
    441448        mTextureTable.clear(); 
    442449        mGeometryTable.clear(); 
    443450        mMaterialTable.clear(); 
    444451 
    445         return true; 
     452        return numEntities; 
    446453} 
    447454 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.h

    r3226 r3237  
    3232public: 
    3333 
    34         /** Loads a model 
     34        /** Loads a scene containing of several scene entities. the entities are added to 
     35                the previously loaded entities. Returns the number of entities in the 
     36                scene. 
    3537        */ 
    36         bool Load(const std::string &filename, SceneEntityContainer &geometry); 
     38        int Load(const std::string &filename, SceneEntityContainer &geometry); 
    3739        /** Returns number of scene entities loaded with this manager. 
    3840        */ 
     
    6062        Material *CreateMaterial(); 
    6163 
     64        ///////////////// 
     65 
    6266        /// giant hack: set this to true if the geometry to load has tangent data for normal mapping 
    6367        bool mUseNormalMapping; 
     
    7579        ~ResourceManager(); 
    7680 
    77         void LoadTextures(igzstream &str); 
    78         void LoadShapes(igzstream &str); 
    79         void LoadSceneEntities(igzstream &str, SceneEntityContainer &entities); 
     81        int LoadTextures(igzstream &str); 
     82        int LoadShapes(igzstream &str); 
     83        int LoadSceneEntities(igzstream &str, SceneEntityContainer &entities); 
    8084 
    8185        SceneEntity *LoadSceneEntity(igzstream &str); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r3236 r3237  
    335335void PrepareRenderQueue(); 
    336336/// loads the specified model 
    337 void LoadModel(const string &model, SceneEntityContainer &entities); 
     337int LoadModel(const string &model, SceneEntityContainer &entities); 
    338338 
    339339inline float KeyRotationAngle() { return keyRotation * elapsedTime * 1e-3f; } 
     
    578578 
    579579 
    580         LoadModel("vienna_full_hp.dem", dynamicObjects); 
    581         dynamicObjects.back()->GetTransform()->SetMatrix(transl); 
     580        int cityEntities = LoadModel("vienna_full_hp.dem", dynamicObjects); 
     581         
     582        for (int i = (int)dynamicObjects.size() - cityEntities; i < (int)dynamicObjects.size(); ++ i) 
     583                dynamicObjects[i]->GetTransform()->SetMatrix(transl); 
    582584 
    583585 
     
    24082410 
    24092411 
    2410 void LoadModel(const string &model, SceneEntityContainer &entities) 
     2412int LoadModel(const string &model, SceneEntityContainer &entities) 
    24112413{ 
    24122414        const string filename = string(model_path + model); 
    24132415 
     2416        int numEntities = 0; 
     2417 
    24142418        cout << "\nloading model " << filename << endl; 
    2415         if (resourceManager->Load(filename, entities)) 
     2419 
     2420        if (numEntities = resourceManager->Load(filename, entities)) 
    24162421        { 
    24172422                cout << "model " << filename << " successfully loaded" << endl; 
     
    24242429                exit(0); 
    24252430        } 
     2431 
     2432        return numEntities; 
    24262433} 
    24272434 
Note: See TracChangeset for help on using the changeset viewer.