Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6828


Ignore:
Timestamp:
May 3, 2010, 11:34:44 AM (14 years ago)
Author:
scheusso
Message:

level pointer for the baseobject

Location:
code/branches/lod/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/lod/src/libraries/core/BaseObject.cc

    r6524 r6828  
    7575            this->setScene(this->creator_->getScene(), this->creator_->getSceneID());
    7676            this->setGametype(this->creator_->getGametype());
     77            this->setLevel(this->creator_->getLevel());
    7778        }
    7879        else
     
    8384            this->sceneID_ = OBJECTID_UNKNOWN;
    8485            this->gametype_ = 0;
     86            this->level_ = 0;
    8587        }
    8688    }
  • code/branches/lod/src/libraries/core/BaseObject.h

    r6524 r6828  
    5151    class Scene;
    5252    class Gametype;
     53    class Level;
    5354
    5455    //! The BaseObject is the parent of all classes representing an instance in the game.
     
    153154            inline Gametype* getOldGametype() const { return this->oldGametype_; }
    154155            virtual void changedGametype() {}
     156           
     157            inline void setLevel(const SmartPtr<Level>& level)
     158            {
     159                if (level != this->level_)
     160                {
     161                    this->level_ = level;
     162                    this->changedLevel();
     163                }
     164            }
     165            inline const SmartPtr<Level>& getLevel() const { return this->level_; }
     166            virtual void changedLevel() {}
    155167
    156168            void addEventSource(BaseObject* source, const std::string& state);
     
    210222            SmartPtr<Gametype>     gametype_;
    211223            Gametype*              oldGametype_;
     224            SmartPtr<Level>        level_;
    212225            std::set<Template*>    templates_;
    213226
  • code/branches/lod/src/orxonox/Level.cc

    r6786 r6828  
    3232#include "core/CoreIncludes.h"
    3333#include "core/Loader.h"
    34 #include "core/template.h"
     34#include "core/Template.h"
    3535#include "core/XMLFile.h"
    3636#include "core/XMLPort.h"
     
    126126        this->objects_.push_back(object);
    127127        object->setGametype(this->getGametype());
     128        object->setLevel(this);
    128129    }
    129130
  • code/branches/lod/src/orxonox/graphics/Model.cc

    r6794 r6828  
    2929#include "Model.h"
    3030
    31 #include <OgreEntity.h>
     31#include <OGRE/OgreEntity.h>
    3232
    3333#include "core/CoreIncludes.h"
     
    9292                    &&this->lodLevel_!=0)
    9393                {
    94                                         Vector3 scale3d = this->getScale3D();
     94                    Vector3 scale3d = this->getScale3D();
    9595                    float scaleFactor = scale3d.x;
    96                                         if(scale3d.y>scaleFactor)
    97                                                 scaleFactor = scale3d.y;
    98                                         if(scale3d.z>scaleFactor)
    99                                                 scaleFactor = scale3d.z;
    100                                                
     96                    if(scale3d.y>scaleFactor)
     97                        scaleFactor = scale3d.y;
     98                    if(scale3d.z>scaleFactor)
     99                        scaleFactor = scale3d.z;
     100
    101101                    COUT(0) << this->meshSrc_<< " lodLevel_: " << this->lodLevel_ <<" scale: "<< scaleFactor << std::endl;
    102                     //Für Asteroiden perfekt
     102                    //Fuer Asteroiden perfekt
    103103
    104104#if OGRE_VERSION >= 0x010700
     
    108108#endif
    109109
    110                                         float factor = scaleFactor;
    111                                         COUT(0)<<"scaleFactor:"<<scaleFactor<<std::endl;
     110                    float factor = scaleFactor;
     111                    COUT(0)<<"scaleFactor:"<<scaleFactor<<std::endl;
    112112
    113113                    distList.push_back(70.0f*factor);
Note: See TracChangeset for help on using the changeset viewer.