[Orxonox-commit 2112] r6828 - in code/branches/lod/src: libraries/core orxonox orxonox/graphics
scheusso at orxonox.net
scheusso at orxonox.net
Mon May 3 11:34:44 CEST 2010
Author: scheusso
Date: 2010-05-03 11:34:44 +0200 (Mon, 03 May 2010)
New Revision: 6828
Modified:
code/branches/lod/src/libraries/core/BaseObject.cc
code/branches/lod/src/libraries/core/BaseObject.h
code/branches/lod/src/orxonox/Level.cc
code/branches/lod/src/orxonox/graphics/Model.cc
Log:
level pointer for the baseobject
Modified: code/branches/lod/src/libraries/core/BaseObject.cc
===================================================================
--- code/branches/lod/src/libraries/core/BaseObject.cc 2010-05-03 09:20:00 UTC (rev 6827)
+++ code/branches/lod/src/libraries/core/BaseObject.cc 2010-05-03 09:34:44 UTC (rev 6828)
@@ -74,6 +74,7 @@
this->setNamespace(this->creator_->getNamespace());
this->setScene(this->creator_->getScene(), this->creator_->getSceneID());
this->setGametype(this->creator_->getGametype());
+ this->setLevel(this->creator_->getLevel());
}
else
{
@@ -82,6 +83,7 @@
this->scene_ = 0;
this->sceneID_ = OBJECTID_UNKNOWN;
this->gametype_ = 0;
+ this->level_ = 0;
}
}
Modified: code/branches/lod/src/libraries/core/BaseObject.h
===================================================================
--- code/branches/lod/src/libraries/core/BaseObject.h 2010-05-03 09:20:00 UTC (rev 6827)
+++ code/branches/lod/src/libraries/core/BaseObject.h 2010-05-03 09:34:44 UTC (rev 6828)
@@ -50,6 +50,7 @@
{
class Scene;
class Gametype;
+ class Level;
//! The BaseObject is the parent of all classes representing an instance in the game.
class _CoreExport BaseObject : virtual public OrxonoxClass
@@ -152,6 +153,17 @@
inline const SmartPtr<Gametype>& getGametype() const { return this->gametype_; }
inline Gametype* getOldGametype() const { return this->oldGametype_; }
virtual void changedGametype() {}
+
+ inline void setLevel(const SmartPtr<Level>& level)
+ {
+ if (level != this->level_)
+ {
+ this->level_ = level;
+ this->changedLevel();
+ }
+ }
+ inline const SmartPtr<Level>& getLevel() const { return this->level_; }
+ virtual void changedLevel() {}
void addEventSource(BaseObject* source, const std::string& state);
void removeEventSource(BaseObject* source);
@@ -209,6 +221,7 @@
uint32_t sceneID_;
SmartPtr<Gametype> gametype_;
Gametype* oldGametype_;
+ SmartPtr<Level> level_;
std::set<Template*> templates_;
std::map<BaseObject*, std::string> eventSources_; //!< List of objects which send events to this object, mapped to the state which they affect
Modified: code/branches/lod/src/orxonox/Level.cc
===================================================================
--- code/branches/lod/src/orxonox/Level.cc 2010-05-03 09:20:00 UTC (rev 6827)
+++ code/branches/lod/src/orxonox/Level.cc 2010-05-03 09:34:44 UTC (rev 6828)
@@ -31,7 +31,7 @@
#include "util/Math.h"
#include "core/CoreIncludes.h"
#include "core/Loader.h"
-#include "core/template.h"
+#include "core/Template.h"
#include "core/XMLFile.h"
#include "core/XMLPort.h"
@@ -125,6 +125,7 @@
{
this->objects_.push_back(object);
object->setGametype(this->getGametype());
+ object->setLevel(this);
}
BaseObject* Level::getObject(unsigned int index) const
Modified: code/branches/lod/src/orxonox/graphics/Model.cc
===================================================================
--- code/branches/lod/src/orxonox/graphics/Model.cc 2010-05-03 09:20:00 UTC (rev 6827)
+++ code/branches/lod/src/orxonox/graphics/Model.cc 2010-05-03 09:34:44 UTC (rev 6828)
@@ -28,7 +28,7 @@
#include "Model.h"
-#include <OgreEntity.h>
+#include <OGRE/OgreEntity.h>
#include "core/CoreIncludes.h"
#include "core/GameMode.h"
@@ -91,15 +91,15 @@
&&this->meshSrc_!="laserbeam.mesh"
&&this->lodLevel_!=0)
{
- Vector3 scale3d = this->getScale3D();
+ Vector3 scale3d = this->getScale3D();
float scaleFactor = scale3d.x;
- if(scale3d.y>scaleFactor)
- scaleFactor = scale3d.y;
- if(scale3d.z>scaleFactor)
- scaleFactor = scale3d.z;
-
+ if(scale3d.y>scaleFactor)
+ scaleFactor = scale3d.y;
+ if(scale3d.z>scaleFactor)
+ scaleFactor = scale3d.z;
+
COUT(0) << this->meshSrc_<< " lodLevel_: " << this->lodLevel_ <<" scale: "<< scaleFactor << std::endl;
- //Für Asteroiden perfekt
+ //Fuer Asteroiden perfekt
#if OGRE_VERSION >= 0x010700
Ogre::Mesh::LodValueList distList;
@@ -107,8 +107,8 @@
Ogre::Mesh::LodDistanceList distList;
#endif
- float factor = scaleFactor;
- COUT(0)<<"scaleFactor:"<<scaleFactor<<std::endl;
+ float factor = scaleFactor;
+ COUT(0)<<"scaleFactor:"<<scaleFactor<<std::endl;
distList.push_back(70.0f*factor);
distList.push_back(140.0f*factor);
More information about the Orxonox-commit
mailing list