Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6838


Ignore:
Timestamp:
May 3, 2010, 2:29:27 PM (14 years ago)
Author:
kolibri7
Message:

implemented the XMLPort for additional lod information.

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

Legend:

Unmodified
Added
Removed
  • code/branches/lod/src/orxonox/Level.cc

    r6828 r6838  
    126126        this->objects_.push_back(object);
    127127        object->setGametype(this->getGametype());
    128         object->setLevel(this);
     128    object->setLevel(this);
    129129    }
    130130
     
    144144    void Level::addLodInfo(MeshLodInformation* lodInformation)
    145145    {
    146 //              std::pair<std::map<std::string,MeshLodInformation*>::iterator,bool> it
    147 //                  = new std::pair<lodInformation->getMeshName(),lodInformation>;
    148                 std::string meshName = lodInformation->getMeshName();
     146//        std::pair<std::map<std::string,MeshLodInformation*>::iterator,bool> it
     147//            = new std::pair<lodInformation->getMeshName(),lodInformation>;
     148        std::string meshName = lodInformation->getMeshName();
    149149        this->lodInformation_.insert(std::make_pair(meshName,lodInformation));
    150                 //this->lodInformation_[std::make_pair<meshName,lodInformation>);
     150        //this->lodInformation_[std::make_pair<meshName,lodInformation>);
    151151    }
    152152
    153     const MeshLodInformation* Level::getLodInfo(std::string meshName) const
     153    MeshLodInformation* Level::getLodInfo(std::string meshName) const
    154154    {
    155155        if(this->lodInformation_.find(meshName)!=this->lodInformation_.end())
  • code/branches/lod/src/orxonox/Level.h

    r6786 r6838  
    5757            void playerEntered(PlayerInfo* player);
    5858            void playerLeft(PlayerInfo* player);
     59                       
     60            MeshLodInformation* getLodInfo(std::string meshName) const;
     61
    5962
    6063        private:
     
    6366
    6467            void addLodInfo(MeshLodInformation* object);
    65             const MeshLodInformation* getLodInfo(std::string meshName) const;
     68//            const MeshLodInformation* getLodInfo(std::string meshName) const;
    6669//            MeshLodInformation* getLodInfo(unsigned int index) const;
    6770
  • code/branches/lod/src/orxonox/graphics/MeshLodInformation.h

    r6786 r6838  
    4242                private:
    4343                        void setLodLevel(unsigned int lodLevel);
    44                         int getLodLevel();
    4544                        void setMeshSource(std::string meshSource);
    4645                        std::string getMeshSource();
     
    5251            virtual ~MeshLodInformation();
    5352           
     53                        int getLodLevel();
    5454            std::string getMeshName();
    5555
  • code/branches/lod/src/orxonox/graphics/Model.cc

    r6828 r6838  
    2929#include "Model.h"
    3030
    31 #include <OGRE/OgreEntity.h>
     31// What's this? With the directory in front the filename, my compiler can't find the file...
     32//#include <OGRE/OgreEntity.h>
     33#include <OgreEntity.h>
    3234
    3335#include "core/CoreIncludes.h"
     
    3537#include "core/XMLPort.h"
    3638#include "Scene.h"
     39#include "graphics/MeshLodInformation.h"
     40#include "Level.h"
    3741
    3842namespace orxonox
     
    5862    {
    5963        SUPER(Model, XMLPort, xmlelement, mode);
    60                
    61                 //LoD
     64       
     65        //LoD
    6266        XMLPortParam(Model, "lodLevel", setLodLevel, getLodLevel, xmlelement, mode).defaultValues(5);
    63                
     67       
    6468        XMLPortParam(Model, "mesh", setMeshSource, getMeshSource, xmlelement, mode);
    6569        XMLPortParam(Model, "shadow", setCastShadows, getCastShadows, xmlelement, mode).defaultValues(true);
     
    98102                    if(scale3d.z>scaleFactor)
    99103                        scaleFactor = scale3d.z;
    100 
     104                   
     105                    Level* level_ = this->getLevel();
     106                   
     107                    MeshLodInformation* lodInfo = level_->getLodInfo(this->meshSrc_);
     108                    if(lodInfo!=0)
     109                        setLodLevel(lodInfo->getLodLevel());
     110                   
    101111                    COUT(0) << this->meshSrc_<< " lodLevel_: " << this->lodLevel_ <<" scale: "<< scaleFactor << std::endl;
    102112                    //Fuer Asteroiden perfekt
Note: See TracChangeset for help on using the changeset viewer.