Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7036


Ignore:
Timestamp:
May 31, 2010, 9:02:48 AM (14 years ago)
Author:
scheusso
Message:

some changes regarding lod:

  • added lodtemplate in different levels
  • trying to avoid sigabrt's because of models with too much lod levels
Location:
code/branches/presentation3
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation3/data/levels/Level(Deathmatch).oxw

    r7032 r7036  
    11<?lua
    2         include("stats.oxo")
    3         include("hudtemplates3.oxo")
    4         include("underattackhud.oxo")
    5         include("templates/spaceship_assff.oxt")
    6         include("templates/spaceship_pirate.oxt")
    7         include("templates/spaceship_Transporter.oxt")
     2  include("stats.oxo")
     3  include("hudtemplates3.oxo")
     4  include("underattackhud.oxo")
     5  include("templates/spaceship_assff.oxt")
     6  include("templates/spaceship_pirate.oxt")
     7  include("templates/spaceship_Transporter.oxt")
     8  include("templates/lodinformation.oxt")
    89?>
    910
     
    6061  gametype=TeamDeathmatch
    6162>
    62     <lodinformation>
    63             <MeshLodInformation mesh=Transporter.mesh lodQuality=10 />
    64     </lodinformation>
     63  <templates>
     64    <Template link=lodtemplate_default />
     65  </templates>
    6566
    6667        <!-- Ausgang: Szene ===> ambientlight/skybox -->
  • code/branches/presentation3/data/levels/Level(UnderAttack).oxw

    r7032 r7036  
    11<?lua
    2         include("stats.oxo")
    3         include("hudtemplates3.oxo")
    4         include("underattackhud.oxo")
    5         include("templates/spaceship_assff.oxt")
    6         include("templates/spaceship_pirate.oxt")
    7         include("templates/spaceship_destroyer.oxt")
     2  include("stats.oxo")
     3  include("hudtemplates3.oxo")
     4  include("underattackhud.oxo")
     5  include("templates/spaceship_assff.oxt")
     6  include("templates/spaceship_pirate.oxt")
     7  include("templates/spaceship_destroyer.oxt")
     8  include("templates/lodinformation.oxt")
    89?>
    910
     
    1415  gametype=UnderAttack
    1516>
     17  <templates>
     18    <Template link=lodtemplate_default />
     19  </templates>
    1620
    1721        <!-- Ausgang: Szene ===> ambientlight/skybox -->
  • code/branches/presentation3/data/levels/Quest_PirateAttack.oxw

    r7032 r7036  
    55  include("templates/spaceship_HXY_SL.oxt")
    66  include("templates/spaceship_pirate.oxt")
     7  include("templates/lodinformation.oxt")
    78?>
    89
     
    3536gametype=TeamDeathmatch
    3637>
     38
     39  <templates>
     40    <Template link=lodtemplate_default />
     41  </templates>
    3742
    3843    <Scene
  • code/branches/presentation3/data/levels/events.oxw

    r6417 r7036  
    44  include("templates/spaceship_assff.oxt")
    55  include("templates/spaceship_H2.oxt")
     6  include("templates/lodinformation.oxt")
    67?>
    78
     
    1011 description  = "A simple level to test the event-system (with comments)"
    1112>
     13  <templates>
     14    <Template link=lodtemplate_default />
     15  </templates>
     16
    1217  <Scene
    1318   ambientlight = "0.5, 0.5, 0.5"
  • code/branches/presentation3/data/levels/mylevel.oxw

    r7032 r7036  
    66  include("templates/spaceship_pirate.oxt")
    77  include("templates/spaceship_Transporter.oxt")
     8  include("templates/lodinformation.oxt")
    89?>
    910
  • code/branches/presentation3/data/levels/pickups.oxw

    r7034 r7036  
    88  include("templates/spaceship_pirate.oxt")
    99  include("templates/pickup_representation_templates.oxt")
     10  include("templates/lodinformation.oxt")
    1011?>
    1112
     
    1415 description  = "Just a few tests"
    1516>
     17  <templates>
     18    <Template link=lodtemplate_default />
     19  </templates>
    1620  <Scene
    1721    ambientlight = "0.8, 0.8, 0.8"
  • code/branches/presentation3/data/levels/presentation.oxw

    r6417 r7036  
    33  include("stats.oxo")
    44  include("templates/spaceship_assff.oxt")
     5  include("templates/lodinformation.oxt")
    56?>
    67
     
    910 description  = "Just a few tests"
    1011>
     12  <templates>
     13    <Template link=lodtemplate_default />
     14  </templates>
    1115  <Scene
    1216   ambientlight = "0.3, 0.3, 0.3"
  • code/branches/presentation3/data/levels/presentation09.oxw

    r7007 r7036  
    44  include("templates/spaceship_assff.oxt")
    55  include("templates/spaceship_H2.oxt")
     6  include("templates/lodinformation.oxt")
    67?>
    78
     
    1112
    1213>
     14  <templates>
     15    <Template link=lodtemplate_default />
     16  </templates>
    1317  <Scene
    1418   ambientlight = "0.5, 0.5, 0.5"
  • code/branches/presentation3/data/levels/presentation09b.oxw

    r7007 r7036  
    66  include("templates/spaceship_pirate.oxt")
    77  include("templates/pickup_representation_templates.oxt")
     8  include("templates/lodinformation.oxt")
    89?>
    910
     
    1314 gametype     = TeamDeathmatch
    1415>
     16  <templates>
     17    <Template link=lodtemplate_default />
     18  </templates>
    1519  <Scene
    1620   ambientlight = "0.5, 0.5, 0.5"
  • code/branches/presentation3/data/levels/presentationHS09.oxw

    r7007 r7036  
    66  include("templates/spaceship_pirate.oxt")
    77  include("templates/pickup_representation_templates.oxt")
     8  include("templates/lodinformation.oxt")
    89?>
    910
     
    1415 hasPhysics = true
    1516>
     17  <templates>
     18    <Template link=lodtemplate_default />
     19  </templates>
    1620  <Scene
    1721   ambientlight = "0.6, 0.4, 0.4"
  • code/branches/presentation3/data/levels/presentationHS09b.oxw

    r7007 r7036  
    22  include("stats.oxo")
    33  include("hudtemplates3.oxo")
     4  include("templates/lodinformation.oxt")
    45?>
    56
     
    1920 gametype     = TeamDeathmatch
    2021>
     22  <templates>
     23    <Template link=lodtemplate_default />
     24  </templates>
    2125  <Scene
    2226    ambientlight = "0.8, 0.8, 0.8"
  • code/branches/presentation3/data/levels/presentationLOD.oxw

    r7007 r7036  
    22  include("stats.oxo")
    33  include("hudtemplates3.oxo")
     4  include("templates/lodinformation.oxt")
    45?>
    56
     
    1314 description  = "Just a few tests"
    1415>
     16  <templates>
     17    <Template link=lodtemplate_default />
     18  </templates>
    1519  <Scene
    1620    ambientlight = "0.8, 0.8, 0.8"
  • code/branches/presentation3/data/levels/presentationLODdif.oxw

    r7007 r7036  
    1414 description  = "Just a few tests"
    1515>
     16  <templates>
     17    <Template link=lodtemplate_default />
     18  </templates>
    1619
    1720  <lodinformation>
  • code/branches/presentation3/data/levels/presentation_dm.oxw

    r7007 r7036  
    44  include("templates/spaceship_assff.oxt")
    55  include("templates/spaceship_H2.oxt")
     6  include("templates/lodinformation.oxt")
    67?>
    78
     
    1011 description  = "A simple testlevel"
    1112>
     13  <templates>
     14    <Template link=lodtemplate_default />
     15  </templates>
    1216  <Scene
    1317   ambientlight = "0.5, 0.5, 0.5"
  • code/branches/presentation3/data/levels/presentation_pong.oxw

    r7007 r7036  
    33  include("stats.oxo")
    44  include("ponghud.oxo")
     5  include("templates/lodinformation.oxt")
    56?>
    67
  • code/branches/presentation3/data/levels/princessaeryn.oxw

    r7007 r7036  
    33  include("stats.oxo")
    44  include("templates/spaceship_assff.oxt")
     5  include("templates/lodinformation.oxt")
    56?>
    67
     
    2223   width  = 50
    2324  />
     25
     26  <templates>
     27    <Template link=lodtemplate_default />
     28  </templates>
    2429
    2530  <Scene
  • code/branches/presentation3/data/levels/quest_test.oxw

    r7032 r7036  
    55  include("templates/spaceship_HXY_SL.oxt")
    66  include("templates/spaceship_pirate.oxt")
     7  include("templates/lodinformation.oxt")
    78?>
    89
     
    3233             width    = 50
    3334    />
     35
     36  <templates>
     37    <Template link=lodtemplate_default />
     38  </templates>
    3439
    3540    <Scene
  • code/branches/presentation3/data/levels/sound.oxw

    r7007 r7036  
    22  include("stats.oxo")
    33  include("hudtemplates3.oxo")
     4  include("templates/lodinformation.oxt")
    45?>
    56
     
    1314 description  = "Just a few tests"
    1415>
     16  <templates>
     17    <Template link=lodtemplate_default />
     18  </templates>
     19
    1520  <Scene
    1621    ambientlight = "0.8, 0.8, 0.8"
  • code/branches/presentation3/data/levels/templates/lodinformation.oxt

    r7020 r7036  
    11<Template name=lodtemplate_default defaults=false>
    22  <Level>
    3         <lodinformation>
    4           <MeshLodInformation mesh=Carrier.mesh lodQuality=1.8 />
    5           <MeshLodInformation mesh=assff.mesh lodQuality=3 />
    6           <MeshLodInformation mesh=Transporter.mesh lodQuality=5 />
    7           <MeshLodInformation mesh=rocket.mesh lodQuality=5 enabled=true />
    8         </lodinformation>
     3    <lodinformation>
     4      <MeshLodInformation mesh=Carrier.mesh lodQuality=1.8 />
     5      <MeshLodInformation mesh=assff.mesh lodQuality=3 />
     6      <MeshLodInformation mesh=rocket.mesh lodQuality=5 enabled=true />
     7      <MeshLodInformation mesh=laserbeam.mesh enabled=false />
     8      <MeshLodInformation mesh=HXY.mesh enabled=true numLevels=8 />
     9      <MeshLodInformation mesh=Transporter.mesh enabled=true numLevels=8 />
     10    </lodinformation>
    911  </Level>
    1012</Template>
  • code/branches/presentation3/data/levels/test_ghost.oxw

    r7007 r7036  
    44  include("templates/spaceship_ghost.oxt")
    55  include("templates/spaceship_pirate.oxt")
     6  include("templates/lodinformation.oxt")
    67?>
    78
     
    1112
    1213>
     14  <templates>
     15    <Template link=lodtemplate_default />
     16  </templates>
     17
    1318  <Scene
    1419   ambientlight = "0.5, 0.5, 0.5"
  • code/branches/presentation3/data/levels/test_stars.oxw

    r7032 r7036  
    1313 description  = "Just a few tests"
    1414>
     15  <templates>
     16    <Template link=lodtemplate_default />
     17  </templates>
    1518  <Scene
    1619    ambientlight = "0.8, 0.8, 0.8"
  • code/branches/presentation3/data/levels/tutorial.oxw

    r7018 r7036  
    99 description  = "A simple testlevel"
    1010>
     11  <templates>
     12    <Template link=lodtemplate_default />
     13  </templates>
    1114  <Scene
    1215   ambientlight = "0.5, 0.5, 0.5"
  • code/branches/presentation3/data/levels/waypoints.oxw

    r7007 r7036  
    55  include("templates/spaceship_H2.oxt")
    66  include("templates/spaceship_pirate.oxt")
     7  include("templates/lodinformation.oxt")
    78?>
    89
     
    1112 description  = "Testing waypoings for AI controlled spaceships."
    1213>
     14  <templates>
     15    <Template link=lodtemplate_default />
     16  </templates>
    1317  <Scene
    1418   ambientlight = "0.5, 0.5, 0.5"
  • code/branches/presentation3/src/orxonox/Level.cc

    r6961 r7036  
    145145    {
    146146        std::string meshName = lodInformation->getMeshName();
    147         this->lodInformation_.insert(std::make_pair(meshName,lodInformation));
     147//         this->lodInformation_.insert(std::make_pair(meshName,lodInformation));
     148        if( this->lodInformation_.find(meshName) != this->lodInformation_.end())
     149          CCOUT(4) << "replacing lod information for " << meshName << endl;
     150        this->lodInformation_[meshName] = lodInformation;
    148151    }
    149152
  • code/branches/presentation3/src/orxonox/graphics/MeshLodInformation.cc

    r7020 r7036  
    4141
    4242    MeshLodInformation::MeshLodInformation(BaseObject* creator)
    43         : BaseObject(creator), lodLevel_(-1), bEnabled_(true)
     43        : BaseObject(creator), lodLevel_(5), bEnabled_(true), numLevels_(10), reductionRate_(0.15)
    4444    {
    4545        RegisterObject(MeshLodInformation);
     
    5656        XMLPortParam(MeshLodInformation, "lodQuality", setLodLevel, getLodLevel, xmlelement, mode);
    5757        XMLPortParam(MeshLodInformation, "enabled", setEnabled, getEnabled, xmlelement, mode);
     58        XMLPortParam(MeshLodInformation, "numLevels", setNumLevels, getNumLevels, xmlelement, mode);
     59        XMLPortParam(MeshLodInformation, "reductionRate", setReductionRate, getReductionRate, xmlelement, mode);
    5860    }
    5961   
  • code/branches/presentation3/src/orxonox/graphics/MeshLodInformation.h

    r7020 r7036  
    4747            std::string getMeshName();
    4848            bool getEnabled(){ return this->bEnabled_; }
     49            unsigned int getNumLevels(){ return this->numLevels_; }
     50            float getReductionRate(){ return this->reductionRate_; }
    4951           
    5052            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     
    5355            void setLodLevel(float lodLevel);
    5456            void setMeshSource(std::string meshSource);
    55             void setEnabled( bool enabled ){ this->bEnabled_ = true; }
     57            void setEnabled( bool enabled ){ this->bEnabled_ = enabled; }
     58            void setNumLevels( unsigned int num ){ this->numLevels_ = num; }
     59            void setReductionRate( float rate ){ this->reductionRate_ = rate; }
    5660            std::string getMeshSource();
    5761            std::string meshSource_;
    5862            float lodLevel_;
    5963            bool bEnabled_;
     64            unsigned int numLevels_;
     65            float reductionRate_;
    6066
    6167    };
  • code/branches/presentation3/src/orxonox/graphics/Model.cc

    r7024 r7036  
    4242    CreateFactory(Model);
    4343
    44     Model::Model(BaseObject* creator) : StaticEntity(creator)
     44    Model::Model(BaseObject* creator) :
     45        StaticEntity(creator), bCastShadows_(true), lodLevel_(5), bLodEnabled_(true), numLodLevels_(10), lodReductionRate_(.15)
    4546    {
    4647        RegisterObject(Model);
    4748
    48         this->bCastShadows_ = true;
    49 
    5049        this->registerVariables();
    51         //LoD
    52         this->lodLevel_=5;
    5350    }
    5451
     
    10299               
    103100                //LOD
    104                 if(this->mesh_.getEntity()->getMesh()->getNumLodLevels()==1
    105                     &&this->meshSrc_!="laserbeam.mesh")
     101                if( this->mesh_.getEntity()->getMesh()->getNumLodLevels()==1 )
    106102                {
    107103                    Level* level = this->getLevel();
     
    109105                    assert( level != 0 );
    110106                   
    111                     if( level->getLodInfo(this->meshSrc_)!=0 )
    112                         setLodLevel(level->getLodInfo(this->meshSrc_)->getLodLevel());
    113                     if( level->getLodInfo(this->meshSrc_)==0 || level->getLodInfo(this->meshSrc_)->getEnabled() )
     107                    MeshLodInformation* lodInfo = level->getLodInfo(this->meshSrc_);
     108                    if( lodInfo )
    114109                    {
    115 
     110                        setLodLevel(lodInfo->getLodLevel());
     111                        this->bLodEnabled_ = lodInfo->getEnabled();
     112                        this->numLodLevels_ = lodInfo->getNumLevels();
     113                        this->lodReductionRate_ = lodInfo->getReductionRate();
     114                    }
     115                    if( this->numLodLevels_>10 )
     116                    {
     117                        CCOUT(2) << "More than 10 LoD levels requested. Creating only 10." << endl;
     118                        this->numLodLevels_ = 10;
     119                    }
     120                    if( this->bLodEnabled_ )
     121                    {
    116122                        float volume = this->mesh_.getEntity()->getBoundingBox().volume();
    117123    //                     float scaleFactor = 1;
     
    139145                            float factor = volume/3/lodLevel_;
    140146                           
    141                             COUT(4)<<"LodLevel set with factor: "<<factor<<std::endl;
     147                            COUT(4) << "LodLevel set with factor: " << factor << endl;
    142148
    143149                            distList.push_back(70.0f*factor);
     
    151157                            distList.push_back(310.0f*factor);
    152158                            distList.push_back(330.0f*factor);
    153 
    154                             float reductionValue = 0.15f;
     159                            while(distList.size()>this->numLodLevels_)
     160                                distList.pop_back();
    155161
    156162                           
    157163                            //Generiert LOD-Levels
    158                             this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, reductionValue);
     164                            this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, this->lodReductionRate_);
    159165                        }
    160166                        else
     
    166172                                what = "<0";
    167173                           
    168                             COUT(4)<<"LodLevel not set because lodLevel("<<lodLevel_<<") was "<<what<<"."<<std::endl;
     174                            COUT(4)<<"LodLevel not set because lodLevel("<<lodLevel_<<") was "<<what<<"." << endl;
    169175                        }
    170176                    }
     177                    else
     178                        COUT(4) << "LodLevel for " << this->meshSrc_ << " not set because is disabled." << endl;
    171179                }
    172180            }
  • code/branches/presentation3/src/orxonox/graphics/Model.h

    r6937 r7036  
    7979            //LoD
    8080            float lodLevel_;
     81            bool bLodEnabled_;
     82            unsigned int numLodLevels_;
     83            float lodReductionRate_;
     84           
    8185    };
    8286}
Note: See TracChangeset for help on using the changeset viewer.