[Orxonox-commit 1783] r6501 - in code/trunk/src: libraries/core modules/objects orxonox orxonox/controllers orxonox/graphics orxonox/worldentities

rgrieder at orxonox.net rgrieder at orxonox.net
Thu Mar 11 11:32:01 CET 2010


Author: rgrieder
Date: 2010-03-11 11:32:01 +0100 (Thu, 11 Mar 2010)
New Revision: 6501

Modified:
   code/trunk/src/libraries/core/Resource.cc
   code/trunk/src/modules/objects/Planet.cc
   code/trunk/src/modules/objects/Planet.h
   code/trunk/src/orxonox/LevelManager.cc
   code/trunk/src/orxonox/controllers/NewHumanController.cc
   code/trunk/src/orxonox/graphics/Camera.cc
   code/trunk/src/orxonox/worldentities/WorldEntity.cc
   code/trunk/src/orxonox/worldentities/WorldEntity.h
Log:
Ensured OGRE v1.7 "Cthugha" code compatibility. Does not yet seem to run run though.

Modified: code/trunk/src/libraries/core/Resource.cc
===================================================================
--- code/trunk/src/libraries/core/Resource.cc	2010-03-11 09:15:35 UTC (rev 6500)
+++ code/trunk/src/libraries/core/Resource.cc	2010-03-11 10:32:01 UTC (rev 6501)
@@ -78,7 +78,7 @@
             return shared_ptr<ResourceInfo>();
         }
         Ogre::FileInfoListPtr infos = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo(group, name);
-        for (std::vector<Ogre::FileInfo>::const_iterator it = infos->begin(); it != infos->end(); ++it)
+        for (Ogre::FileInfoList::const_iterator it = infos->begin(); it != infos->end(); ++it)
         {
             if (it->filename == name)
             {

Modified: code/trunk/src/modules/objects/Planet.cc
===================================================================
--- code/trunk/src/modules/objects/Planet.cc	2010-03-11 09:15:35 UTC (rev 6500)
+++ code/trunk/src/modules/objects/Planet.cc	2010-03-11 10:32:01 UTC (rev 6501)
@@ -90,17 +90,23 @@
     {
         float scaleFactor = this->getScale();
 
-        this->distList.push_back(10.0f*scaleFactor);
-        this->distList.push_back(19.0f*scaleFactor);
-        this->distList.push_back(27.0f*scaleFactor);
-        this->distList.push_back(34.0f*scaleFactor);
-        this->distList.push_back(40.0f*scaleFactor);
-        this->distList.push_back(45.0f*scaleFactor);
-        this->distList.push_back(49.0f*scaleFactor);
-        this->distList.push_back(52.0f*scaleFactor);
-        this->distList.push_back(54.0f*scaleFactor);
-        this->distList.push_back(55.0f*scaleFactor);
+#if OGRE_VERSION >= 0x010700
+        Ogre::Mesh::LodValueList distList;
+#else
+        Ogre::Mesh::LodDistanceList distList;
+#endif
 
+        distList.push_back(10.0f*scaleFactor);
+        distList.push_back(19.0f*scaleFactor);
+        distList.push_back(27.0f*scaleFactor);
+        distList.push_back(34.0f*scaleFactor);
+        distList.push_back(40.0f*scaleFactor);
+        distList.push_back(45.0f*scaleFactor);
+        distList.push_back(49.0f*scaleFactor);
+        distList.push_back(52.0f*scaleFactor);
+        distList.push_back(54.0f*scaleFactor);
+        distList.push_back(55.0f*scaleFactor);
+
         float reductionValue = 0.2f;
 
         this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, reductionValue);

Modified: code/trunk/src/modules/objects/Planet.h
===================================================================
--- code/trunk/src/modules/objects/Planet.h	2010-03-11 09:15:35 UTC (rev 6500)
+++ code/trunk/src/modules/objects/Planet.h	2010-03-11 10:32:01 UTC (rev 6501)
@@ -105,7 +105,6 @@
             Mesh mesh_;
             float atmosphereSize;
             float imageSize;
-            std::vector<float> distList;
             BillboardSet billboard_;
             bool bCastShadows_;
 

Modified: code/trunk/src/orxonox/LevelManager.cc
===================================================================
--- code/trunk/src/orxonox/LevelManager.cc	2010-03-11 09:15:35 UTC (rev 6500)
+++ code/trunk/src/orxonox/LevelManager.cc	2010-03-11 10:32:01 UTC (rev 6501)
@@ -131,15 +131,15 @@
 
     void LevelManager::compileAvailableLevelList()
     {
-        availableLevels_ = *Resource::findResourceNames("*.oxw");
-        for (std::vector<std::string>::iterator it = availableLevels_.begin(); it != availableLevels_.end();)
-            if (it->find("old/") == 0)
-                it = availableLevels_.erase(it);
-            else
+        this->availableLevels_.clear();
+        Ogre::StringVectorPtr levels = Resource::findResourceNames("*.oxw");
+        for (Ogre::StringVector::const_iterator it = levels->begin(); it != levels->end(); ++it)
+        {
+            if (it->find("old/") != 0)
             {
                 size_t pos = it->find(".oxw");
-                *it = it->substr(0, pos);
-                ++it;
+                this->availableLevels_.push_back(it->substr(0, pos));
             }
+        }
     }
 }

Modified: code/trunk/src/orxonox/controllers/NewHumanController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/NewHumanController.cc	2010-03-11 09:15:35 UTC (rev 6500)
+++ code/trunk/src/orxonox/controllers/NewHumanController.cc	2010-03-11 10:32:01 UTC (rev 6501)
@@ -365,7 +365,7 @@
             if (itr->movable->isInScene() && itr->movable->getMovableType() == "Entity" && itr->distance > 500)
             {
                 // Try to cast the user pointer
-                WorldEntity* wePtr = dynamic_cast<WorldEntity*>(itr->movable->getUserObject());
+                WorldEntity* wePtr = dynamic_cast<WorldEntity*>(Ogre::any_cast<OrxonoxClass*>(itr->movable->getUserAny()));
                 if (wePtr)
                 {
                     // go through all parents of object and look whether they are sightable or not

Modified: code/trunk/src/orxonox/graphics/Camera.cc
===================================================================
--- code/trunk/src/orxonox/graphics/Camera.cc	2010-03-11 09:15:35 UTC (rev 6500)
+++ code/trunk/src/orxonox/graphics/Camera.cc	2010-03-11 10:32:01 UTC (rev 6501)
@@ -61,7 +61,7 @@
             ThrowException(AbortLoading, "Can't create Camera, no root-scene-node given.");
 
         this->camera_ = this->getScene()->getSceneManager()->createCamera(getUniqueNumberString());
-        this->camera_->setUserObject(this);
+        static_cast<Ogre::MovableObject*>(this->camera_)->setUserAny(Ogre::Any(static_cast<OrxonoxClass*>(this)));
         this->cameraNode_ = this->getScene()->getRootSceneNode()->createChildSceneNode();
         this->attachNode(this->cameraNode_);
         this->cameraNode_->attachObject(this->camera_);

Modified: code/trunk/src/orxonox/worldentities/WorldEntity.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/WorldEntity.cc	2010-03-11 09:15:35 UTC (rev 6500)
+++ code/trunk/src/orxonox/worldentities/WorldEntity.cc	2010-03-11 10:32:01 UTC (rev 6501)
@@ -473,7 +473,7 @@
     void WorldEntity::attachOgreObject(Ogre::MovableObject* object)
     {
         this->node_->attachObject(object);
-        object->setUserObject(this);
+        object->setUserAny(Ogre::Any(static_cast<OrxonoxClass*>(this)));
     }
 
     void WorldEntity::attachOgreObject(Ogre::BillboardSet* object)
@@ -488,7 +488,7 @@
     //! Detaches an Ogre::MovableObject from this WorldEntity.
     void WorldEntity::detachOgreObject(Ogre::MovableObject* object)
     {
-        object->setUserObject(NULL);
+        object->setUserAny(Ogre::Any(static_cast<OrxonoxClass*>(NULL)));
         this->node_->detachObject(object);
     }
 

Modified: code/trunk/src/orxonox/worldentities/WorldEntity.h
===================================================================
--- code/trunk/src/orxonox/worldentities/WorldEntity.h	2010-03-11 09:15:35 UTC (rev 6500)
+++ code/trunk/src/orxonox/worldentities/WorldEntity.h	2010-03-11 10:32:01 UTC (rev 6501)
@@ -32,7 +32,6 @@
 
 #include "OrxonoxPrereqs.h"
 
-#include <OgreUserDefinedObject.h>
 #ifdef ORXONOX_RELEASE
 #  include <OgreSceneNode.h>
 #endif
@@ -69,7 +68,7 @@
 
         Collision shapes: These are controlled by the internal WorldEntityCollisionShape. @see WorldEntityCollisionShape.
     */
-    class _OrxonoxExport WorldEntity : public BaseObject, public Synchronisable, public btMotionState, public Ogre::UserDefinedObject
+    class _OrxonoxExport WorldEntity : public BaseObject, public Synchronisable, public btMotionState
     {
         friend class Scene;
 




More information about the Orxonox-commit mailing list