Changeset 160 for trunk/VUT/Ogre/src
- Timestamp:
- 07/08/05 01:53:01 (19 years ago)
- Location:
- trunk/VUT/Ogre/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/Ogre/src/OgreSceneContentGenerator.cpp
r159 r160 12 12 namespace Ogre { 13 13 14 /******************************************************* /15 /* SceneContentGenerator implementation */16 /******************************************************* /14 /*************************************************************/ 15 /* SceneContentGenerator implementation */ 16 /*************************************************************/ 17 17 18 18 //----------------------------------------------------------------------- … … 23 23 mMinAngle(Vector3(0.0f, 0.0f, 0.0f)), 24 24 mMaxAngle(Vector3(360, 360, 360)), 25 mScale(0.1, 0.1, 0.1) 26 //, mObjectCount(0) 25 mScale(0.1, 0.1, 0.1)//, mObjectCount(0) 27 26 { 28 27 } … … 36 35 Vector3 translationRatio; 37 36 38 int old_count = GetObjectCount();37 int new_size = GetObjectCount() + numObjects; 39 38 int failed_attempts = 0; // counter used to avoid invinite loop 40 39 41 40 //-- create random values between zero and one 42 while ((GetObjectCount() < numObjects + old_count) &&41 while ((GetObjectCount() < new_size) && 43 42 (failed_attempts < MAX_FAILED_ATTEMPTS)) 44 43 { … … 70 69 Entity *ent = mSceneMgr->createEntity(name, objName + ".mesh"); 71 70 72 SceneNode * currentObject= mSceneMgr->getRootSceneNode()->71 SceneNode *node = mSceneMgr->getRootSceneNode()-> 73 72 createChildSceneNode(String(name) + "Node", position); 74 73 75 74 //ent->setCastShadows(false); 76 currentObject->attachObject(ent); 77 currentObject->setScale(mScale); 78 currentObject->setOrientation(orientation); 79 80 //-- store pointer to object 81 mSceneObjects.push_back(currentObject); 82 83 return currentObject; 75 node->attachObject(ent); 76 node->setScale(mScale); 77 node->setOrientation(orientation); 78 79 // store pointer to node and object 80 mSceneNodes.push_back(node); 81 mEntities.push_back(ent); 82 83 return node; 84 84 } 85 85 //----------------------------------------------------------------------- … … 116 116 int SceneContentGenerator::GetObjectCount() 117 117 { 118 return (int)mScene Objects.size();118 return (int)mSceneNodes.size(); 119 119 } 120 120 //----------------------------------------------------------------------- … … 129 129 std::vector<SceneNode *>::const_iterator it, it_end; 130 130 131 it_end = mScene Objects.end();131 it_end = mSceneNodes.end(); 132 132 133 133 if(!ofstr.is_open()) … … 136 136 char str[100]; 137 137 138 for(it = mScene Objects.begin(); it < it_end; ++it)138 for(it = mSceneNodes.begin(); it < it_end; ++it) 139 139 { 140 140 SceneNode *node = (*it); … … 164 164 return false; 165 165 166 //mScene Objects.clear(); // reset list of objects166 //mSceneNodes.clear(); // reset list of objects 167 167 168 168 while (!ifstr.eof()) … … 173 173 &orientation.w, &orientation.x, &orientation.y, &orientation.z, 174 174 &mScale.x, &mScale.y, &mScale.z); 175 176 /*Vector3 rot(orientation.getYaw().valueDegrees(),177 orientation.getPitch().valueDegrees(),178 orientation.getRoll().valueDegrees());*/179 175 180 176 GenerateSceneObject(position, orientation, objName); … … 187 183 return true; 188 184 } 189 185 //----------------------------------------------------------------------- 186 SceneNodeList *SceneContentGenerator::GetGeneratedSceneNodes() 187 { 188 return &mSceneNodes; 189 } 190 //----------------------------------------------------------------------- 191 EntityList *SceneContentGenerator::GetGeneratedEntities() 192 { 193 return &mEntities; 194 } 195 //----------------------------------------------------------------------- 196 void SceneContentGenerator::RemoveGeneratedObjects() 197 { 198 //-- destroy scene nodes and detach entities 199 while (!mSceneNodes.empty()) 200 { 201 SceneNode *node = mSceneNodes.back(); 202 mSceneNodes.pop_back(); 203 204 //node->detachAllObjects(); 205 mSceneMgr->destroySceneNode(node->getName()); 206 } 207 //-- remove and destroy entities 208 while (!mEntities.empty()) 209 { 210 Entity *ent = mEntities.back(); 211 mEntities.pop_back(); 212 213 mSceneMgr->removeEntity(ent); 214 } 215 } 190 216 } // namespace Ogre -
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r159 r160 40 40 //mShowBoundingBoxes = true; 41 41 //mShowBoxes = true; 42 //mShowBoxes = true;43 42 44 43 // TODO: set maxdepth to reasonable value
Note: See TracChangeset
for help on using the changeset viewer.