Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6877


Ignore:
Timestamp:
May 10, 2010, 3:35:48 PM (14 years ago)
Author:
kolibri7
Message:

*everything works now; setting the lodlevels and also the XML-Port.
*added lod information for Carrier.mesh in gametype_underattack.oxw

Location:
code/branches/lod
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/lod/data/levels/gametype_underattack.oxw

    r5781 r6877  
    1111 gametype     = UnderAttack
    1212>
     13
     14  <lodinformation>
     15    <MeshLodInformation mesh=Carrier.mesh lodQuality=1 />
     16  </lodinformation>
     17 
    1318  <Scene
    1419   ambientlight = "0.5, 0.5, 0.5"
  • code/branches/lod/src/orxonox/Level.cc

    r6838 r6877  
    7272        XMLPortParam(Level, "description", setDescription, getDescription, xmlelement, mode);
    7373        XMLPortParam(Level, "gametype", setGametypeString, getGametypeString, xmlelement, mode).defaultValues("Gametype");
    74 
    75         XMLPortObjectExtended(Level, BaseObject, "", addObject, getObject, xmlelement, mode, true, false);           
     74           
    7675        XMLPortObject(Level, MeshLodInformation, "lodinformation", addLodInfo, getLodInfo, xmlelement, mode);
     76        XMLPortObjectExtended(Level, BaseObject, "", addObject, getObject, xmlelement, mode, true, false);
    7777}
    7878
     
    141141    }
    142142   
    143     //LoD
    144143    void Level::addLodInfo(MeshLodInformation* lodInformation)
    145144    {
    146 //        std::pair<std::map<std::string,MeshLodInformation*>::iterator,bool> it
    147 //            = new std::pair<lodInformation->getMeshName(),lodInformation>;
    148145        std::string meshName = lodInformation->getMeshName();
    149146        this->lodInformation_.insert(std::make_pair(meshName,lodInformation));
    150         //this->lodInformation_[std::make_pair<meshName,lodInformation>);
    151147    }
    152148
     
    157153       
    158154        return 0;
    159        
    160        
    161         /*
    162         unsigned int i = 0;
    163         for (std::map<MeshLodInformation*>::const_iterator it = this->lodInformation_.begin(); it != this->lodInformation_.end(); ++it)
    164         {
    165             if (i == index)
    166                 return (*it);
    167             ++i;
    168         }
    169         return 0;*/
    170155    }
    171156
  • code/branches/lod/src/orxonox/graphics/MeshLodInformation.cc

    r6852 r6877  
    5353        SUPER(MeshLodInformation, XMLPort, xmlelement, mode);
    5454
    55         XMLPortParam(MeshLodInformation, "lodQuality", setLodLevel, getLodLevel, xmlelement, mode).defaultValues(5);
    5655        XMLPortParam(MeshLodInformation, "mesh", setMeshSource, getMeshSource, xmlelement, mode);
     56        XMLPortParam(MeshLodInformation, "lodQuality", setLodLevel, getLodLevel, xmlelement, mode);
    5757    }
    5858   
  • code/branches/lod/src/orxonox/graphics/Model.cc

    r6852 r6877  
    6161        SUPER(Model, XMLPort, xmlelement, mode);
    6262       
    63         //LoD
    6463        XMLPortParam(Model, "lodLevel", setLodLevel, getLodLevel, xmlelement, mode).defaultValues(5);
    6564       
     
    103102                    &&this->meshSrc_!="laserbeam.mesh")
    104103                {
    105                     float scaleFactor = getBiggestScale(this->getScale3D());
    106                     BaseObject* creatorPtr = this->getCreator();
    107                                         //TODO Doesn't work...
    108                     while(creatorPtr!=0&&typeid(creatorPtr)!=typeid(new WorldEntity*))
     104                    float scaleFactor = 1;
     105                    BaseObject* creatorPtr = this;
     106                   
     107                    while(creatorPtr!=NULL&&orxonox_cast<WorldEntity*>(creatorPtr))
    109108                    {
    110109                        scaleFactor *= getBiggestScale(((WorldEntity*) creatorPtr)->getScale3D());
    111                         creatorPtr = this->getCreator();
     110                        creatorPtr = creatorPtr->getCreator();
    112111                    }
    113112                   
     
    115114                   
    116115                    MeshLodInformation* lodInfo = level_->getLodInfo(this->meshSrc_);
     116                   
    117117                    if(lodInfo!=0)
    118118                        setLodLevel(lodInfo->getLodLevel());
     
    126126#endif
    127127
    128                     if(lodLevel_>0)
     128                    if(lodLevel_>0&&lodLevel_<=5)
    129129                    {
    130130                        float factor = scaleFactor*5/lodLevel_;
     
    143143                        distList.push_back(330.0f*factor);
    144144
    145                         float reductionValue = 0.2f;
     145                        float reductionValue = 0.15f;
    146146
    147147                       
     
    151151                    else
    152152                    {
    153                         COUT(0)<<"LodLevel not set because lodLevel("<<lodLevel_<<") was < 0."<<std::endl;
     153                        std::string what;
     154                        if(lodLevel_>5)
     155                            what = ">5";
     156                        else
     157                            what = "<0";
     158                       
     159                        COUT(0)<<"LodLevel not set because lodLevel("<<lodLevel_<<") was "<<what<<"."<<std::endl;
    154160                    }
    155161                }
Note: See TracChangeset for help on using the changeset viewer.