[Orxonox-commit 2321] r7036 - in code/branches/presentation3: data/levels data/levels/templates src/orxonox src/orxonox/graphics
scheusso at orxonox.net
scheusso at orxonox.net
Mon May 31 09:02:49 CEST 2010
Author: scheusso
Date: 2010-05-31 09:02:48 +0200 (Mon, 31 May 2010)
New Revision: 7036
Modified:
code/branches/presentation3/data/levels/Level(Deathmatch).oxw
code/branches/presentation3/data/levels/Level(UnderAttack).oxw
code/branches/presentation3/data/levels/Quest_PirateAttack.oxw
code/branches/presentation3/data/levels/events.oxw
code/branches/presentation3/data/levels/mylevel.oxw
code/branches/presentation3/data/levels/pickups.oxw
code/branches/presentation3/data/levels/presentation.oxw
code/branches/presentation3/data/levels/presentation09.oxw
code/branches/presentation3/data/levels/presentation09b.oxw
code/branches/presentation3/data/levels/presentationHS09.oxw
code/branches/presentation3/data/levels/presentationHS09b.oxw
code/branches/presentation3/data/levels/presentationLOD.oxw
code/branches/presentation3/data/levels/presentationLODdif.oxw
code/branches/presentation3/data/levels/presentation_dm.oxw
code/branches/presentation3/data/levels/presentation_pong.oxw
code/branches/presentation3/data/levels/princessaeryn.oxw
code/branches/presentation3/data/levels/quest_test.oxw
code/branches/presentation3/data/levels/sound.oxw
code/branches/presentation3/data/levels/templates/lodinformation.oxt
code/branches/presentation3/data/levels/test_ghost.oxw
code/branches/presentation3/data/levels/test_stars.oxw
code/branches/presentation3/data/levels/tutorial.oxw
code/branches/presentation3/data/levels/waypoints.oxw
code/branches/presentation3/src/orxonox/Level.cc
code/branches/presentation3/src/orxonox/graphics/MeshLodInformation.cc
code/branches/presentation3/src/orxonox/graphics/MeshLodInformation.h
code/branches/presentation3/src/orxonox/graphics/Model.cc
code/branches/presentation3/src/orxonox/graphics/Model.h
Log:
some changes regarding lod:
- added lodtemplate in different levels
- trying to avoid sigabrt's because of models with too much lod levels
Modified: code/branches/presentation3/data/levels/Level(Deathmatch).oxw
===================================================================
--- code/branches/presentation3/data/levels/Level(Deathmatch).oxw 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/data/levels/Level(Deathmatch).oxw 2010-05-31 07:02:48 UTC (rev 7036)
@@ -1,10 +1,11 @@
<?lua
- include("stats.oxo")
- include("hudtemplates3.oxo")
- include("underattackhud.oxo")
- include("templates/spaceship_assff.oxt")
- include("templates/spaceship_pirate.oxt")
- include("templates/spaceship_Transporter.oxt")
+ include("stats.oxo")
+ include("hudtemplates3.oxo")
+ include("underattackhud.oxo")
+ include("templates/spaceship_assff.oxt")
+ include("templates/spaceship_pirate.oxt")
+ include("templates/spaceship_Transporter.oxt")
+ include("templates/lodinformation.oxt")
?>
<!--*****************************************************************************************************************************************************************************************-->
@@ -59,9 +60,9 @@
description="Level zerstoeren von Transportern"
gametype=TeamDeathmatch
>
- <lodinformation>
- <MeshLodInformation mesh=Transporter.mesh lodQuality=10 />
- </lodinformation>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
<!-- Ausgang: Szene ===> ambientlight/skybox -->
<Scene
Modified: code/branches/presentation3/data/levels/Level(UnderAttack).oxw
===================================================================
--- code/branches/presentation3/data/levels/Level(UnderAttack).oxw 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/data/levels/Level(UnderAttack).oxw 2010-05-31 07:02:48 UTC (rev 7036)
@@ -1,10 +1,11 @@
<?lua
- include("stats.oxo")
- include("hudtemplates3.oxo")
- include("underattackhud.oxo")
- include("templates/spaceship_assff.oxt")
- include("templates/spaceship_pirate.oxt")
- include("templates/spaceship_destroyer.oxt")
+ include("stats.oxo")
+ include("hudtemplates3.oxo")
+ include("underattackhud.oxo")
+ include("templates/spaceship_assff.oxt")
+ include("templates/spaceship_pirate.oxt")
+ include("templates/spaceship_destroyer.oxt")
+ include("templates/lodinformation.oxt")
?>
<!-- Ausgang: Level ===> name/description -->
@@ -13,6 +14,9 @@
description="Level zerstoeren von Transportern"
gametype=UnderAttack
>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
<!-- Ausgang: Szene ===> ambientlight/skybox -->
<Scene
Modified: code/branches/presentation3/data/levels/Quest_PirateAttack.oxw
===================================================================
--- code/branches/presentation3/data/levels/Quest_PirateAttack.oxw 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/data/levels/Quest_PirateAttack.oxw 2010-05-31 07:02:48 UTC (rev 7036)
@@ -4,6 +4,7 @@
include("templates/spaceship_assff.oxt")
include("templates/spaceship_HXY_SL.oxt")
include("templates/spaceship_pirate.oxt")
+ include("templates/lodinformation.oxt")
?>
<Template name=spaceshipassffplayer defaults=0>
@@ -35,6 +36,10 @@
gametype=TeamDeathmatch
>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+
<Scene
ambientlight = "0.3, 0.3, 0.3"
skybox = "Orxonox/skypanoramagen1"
@@ -555,4 +560,4 @@
</StaticEntity>
</Scene>
-</Level>
\ No newline at end of file
+</Level>
Modified: code/branches/presentation3/data/levels/events.oxw
===================================================================
--- code/branches/presentation3/data/levels/events.oxw 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/data/levels/events.oxw 2010-05-31 07:02:48 UTC (rev 7036)
@@ -3,12 +3,17 @@
include("stats.oxo")
include("templates/spaceship_assff.oxt")
include("templates/spaceship_H2.oxt")
+ include("templates/lodinformation.oxt")
?>
<Level
name = "Event testing"
description = "A simple level to test the event-system (with comments)"
>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+
<Scene
ambientlight = "0.5, 0.5, 0.5"
skybox = "Orxonox/skypanoramagen1"
Modified: code/branches/presentation3/data/levels/mylevel.oxw
===================================================================
--- code/branches/presentation3/data/levels/mylevel.oxw 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/data/levels/mylevel.oxw 2010-05-31 07:02:48 UTC (rev 7036)
@@ -5,6 +5,7 @@
include("templates/spaceship_assff.oxt")
include("templates/spaceship_pirate.oxt")
include("templates/spaceship_Transporter.oxt")
+ include("templates/lodinformation.oxt")
?>
<Template name=spaceshipassffplayer>
Modified: code/branches/presentation3/data/levels/pickups.oxw
===================================================================
--- code/branches/presentation3/data/levels/pickups.oxw 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/data/levels/pickups.oxw 2010-05-31 07:02:48 UTC (rev 7036)
@@ -7,12 +7,16 @@
include("templates/spaceship_assff.oxt")
include("templates/spaceship_pirate.oxt")
include("templates/pickup_representation_templates.oxt")
+ include("templates/lodinformation.oxt")
?>
<Level
name = "Sample"
description = "Just a few tests"
>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
<Scene
ambientlight = "0.8, 0.8, 0.8"
skybox = "Orxonox/Starbox"
Modified: code/branches/presentation3/data/levels/presentation.oxw
===================================================================
--- code/branches/presentation3/data/levels/presentation.oxw 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/data/levels/presentation.oxw 2010-05-31 07:02:48 UTC (rev 7036)
@@ -2,12 +2,16 @@
include("hudtemplates3.oxo")
include("stats.oxo")
include("templates/spaceship_assff.oxt")
+ include("templates/lodinformation.oxt")
?>
<Level
name = "Sample"
description = "Just a few tests"
>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
<Scene
ambientlight = "0.3, 0.3, 0.3"
skybox = "Orxonox/Starbox"
Modified: code/branches/presentation3/data/levels/presentation09.oxw
===================================================================
--- code/branches/presentation3/data/levels/presentation09.oxw 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/data/levels/presentation09.oxw 2010-05-31 07:02:48 UTC (rev 7036)
@@ -3,6 +3,7 @@
include("stats.oxo")
include("templates/spaceship_assff.oxt")
include("templates/spaceship_H2.oxt")
+ include("templates/lodinformation.oxt")
?>
<Level
@@ -10,6 +11,9 @@
description = "presentation level for Orxonox Convention X"
>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
<Scene
ambientlight = "0.5, 0.5, 0.5"
skybox = "Orxonox/skypanoramagen1"
Modified: code/branches/presentation3/data/levels/presentation09b.oxw
===================================================================
--- code/branches/presentation3/data/levels/presentation09b.oxw 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/data/levels/presentation09b.oxw 2010-05-31 07:02:48 UTC (rev 7036)
@@ -5,6 +5,7 @@
include("templates/spaceship_H2.oxt")
include("templates/spaceship_pirate.oxt")
include("templates/pickup_representation_templates.oxt")
+ include("templates/lodinformation.oxt")
?>
<Level
@@ -12,6 +13,9 @@
description = "presentation level for Orxonox Convention X"
gametype = TeamDeathmatch
>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
<Scene
ambientlight = "0.5, 0.5, 0.5"
skybox = "Orxonox/skypanoramagen2"
Modified: code/branches/presentation3/data/levels/presentationHS09.oxw
===================================================================
--- code/branches/presentation3/data/levels/presentationHS09.oxw 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/data/levels/presentationHS09.oxw 2010-05-31 07:02:48 UTC (rev 7036)
@@ -5,6 +5,7 @@
include("templates/spaceship_H2.oxt")
include("templates/spaceship_pirate.oxt")
include("templates/pickup_representation_templates.oxt")
+ include("templates/lodinformation.oxt")
?>
<Level
@@ -13,6 +14,9 @@
gametype = TeamDeathmatch
hasPhysics = true
>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
<Scene
ambientlight = "0.6, 0.4, 0.4"
skybox = "Orxonox/skypanoramagen2"
Modified: code/branches/presentation3/data/levels/presentationHS09b.oxw
===================================================================
--- code/branches/presentation3/data/levels/presentationHS09b.oxw 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/data/levels/presentationHS09b.oxw 2010-05-31 07:02:48 UTC (rev 7036)
@@ -1,6 +1,7 @@
<?lua
include("stats.oxo")
include("hudtemplates3.oxo")
+ include("templates/lodinformation.oxt")
?>
<?lua
@@ -18,6 +19,9 @@
description = "Just a few tests"
gametype = TeamDeathmatch
>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
<Scene
ambientlight = "0.8, 0.8, 0.8"
skybox = "Orxonox/Starbox"
Modified: code/branches/presentation3/data/levels/presentationLOD.oxw
===================================================================
--- code/branches/presentation3/data/levels/presentationLOD.oxw 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/data/levels/presentationLOD.oxw 2010-05-31 07:02:48 UTC (rev 7036)
@@ -1,6 +1,7 @@
<?lua
include("stats.oxo")
include("hudtemplates3.oxo")
+ include("templates/lodinformation.oxt")
?>
<?lua
@@ -12,6 +13,9 @@
name = "Sample"
description = "Just a few tests"
>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
<Scene
ambientlight = "0.8, 0.8, 0.8"
skybox = "Orxonox/Starbox"
Modified: code/branches/presentation3/data/levels/presentationLODdif.oxw
===================================================================
--- code/branches/presentation3/data/levels/presentationLODdif.oxw 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/data/levels/presentationLODdif.oxw 2010-05-31 07:02:48 UTC (rev 7036)
@@ -13,6 +13,9 @@
name = "Sample"
description = "Just a few tests"
>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
<lodinformation>
<MeshLodInformation mesh=ast1.mesh lodQuality=4 />
Modified: code/branches/presentation3/data/levels/presentation_dm.oxw
===================================================================
--- code/branches/presentation3/data/levels/presentation_dm.oxw 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/data/levels/presentation_dm.oxw 2010-05-31 07:02:48 UTC (rev 7036)
@@ -3,12 +3,16 @@
include("stats.oxo")
include("templates/spaceship_assff.oxt")
include("templates/spaceship_H2.oxt")
+ include("templates/lodinformation.oxt")
?>
<Level
name = "Presentation"
description = "A simple testlevel"
>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
<Scene
ambientlight = "0.5, 0.5, 0.5"
skybox = "Orxonox/skypanoramagen1"
Modified: code/branches/presentation3/data/levels/presentation_pong.oxw
===================================================================
--- code/branches/presentation3/data/levels/presentation_pong.oxw 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/data/levels/presentation_pong.oxw 2010-05-31 07:02:48 UTC (rev 7036)
@@ -2,6 +2,7 @@
include("hudtemplates3.oxo")
include("stats.oxo")
include("ponghud.oxo")
+ include("templates/lodinformation.oxt")
?>
<Template name=pongbatcameras defaults=0>
Modified: code/branches/presentation3/data/levels/princessaeryn.oxw
===================================================================
--- code/branches/presentation3/data/levels/princessaeryn.oxw 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/data/levels/princessaeryn.oxw 2010-05-31 07:02:48 UTC (rev 7036)
@@ -2,6 +2,7 @@
include("hudtemplates3.oxo")
include("stats.oxo")
include("templates/spaceship_assff.oxt")
+ include("templates/lodinformation.oxt")
?>
<?lua
@@ -22,6 +23,10 @@
width = 50
/>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+
<Scene
ambientlight = "0.3, 0.3, 0.3"
skybox = "Orxonox/skypanoramagen1"
Modified: code/branches/presentation3/data/levels/quest_test.oxw
===================================================================
--- code/branches/presentation3/data/levels/quest_test.oxw 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/data/levels/quest_test.oxw 2010-05-31 07:02:48 UTC (rev 7036)
@@ -4,6 +4,7 @@
include("templates/spaceship_assff.oxt")
include("templates/spaceship_HXY_SL.oxt")
include("templates/spaceship_pirate.oxt")
+ include("templates/lodinformation.oxt")
?>
<Template name=spaceshipassffplayer defaults=0>
@@ -32,6 +33,10 @@
width = 50
/>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+
<Scene
ambientlight = "0.3, 0.3, 0.3"
skybox = "Orxonox/skypanoramagen1"
Modified: code/branches/presentation3/data/levels/sound.oxw
===================================================================
--- code/branches/presentation3/data/levels/sound.oxw 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/data/levels/sound.oxw 2010-05-31 07:02:48 UTC (rev 7036)
@@ -1,6 +1,7 @@
<?lua
include("stats.oxo")
include("hudtemplates3.oxo")
+ include("templates/lodinformation.oxt")
?>
<?lua
@@ -12,6 +13,10 @@
name = "Sample"
description = "Just a few tests"
>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+
<Scene
ambientlight = "0.8, 0.8, 0.8"
skybox = "Orxonox/Starbox"
Modified: code/branches/presentation3/data/levels/templates/lodinformation.oxt
===================================================================
--- code/branches/presentation3/data/levels/templates/lodinformation.oxt 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/data/levels/templates/lodinformation.oxt 2010-05-31 07:02:48 UTC (rev 7036)
@@ -1,10 +1,12 @@
<Template name=lodtemplate_default defaults=false>
<Level>
- <lodinformation>
- <MeshLodInformation mesh=Carrier.mesh lodQuality=1.8 />
- <MeshLodInformation mesh=assff.mesh lodQuality=3 />
- <MeshLodInformation mesh=Transporter.mesh lodQuality=5 />
- <MeshLodInformation mesh=rocket.mesh lodQuality=5 enabled=true />
- </lodinformation>
+ <lodinformation>
+ <MeshLodInformation mesh=Carrier.mesh lodQuality=1.8 />
+ <MeshLodInformation mesh=assff.mesh lodQuality=3 />
+ <MeshLodInformation mesh=rocket.mesh lodQuality=5 enabled=true />
+ <MeshLodInformation mesh=laserbeam.mesh enabled=false />
+ <MeshLodInformation mesh=HXY.mesh enabled=true numLevels=8 />
+ <MeshLodInformation mesh=Transporter.mesh enabled=true numLevels=8 />
+ </lodinformation>
</Level>
</Template>
Modified: code/branches/presentation3/data/levels/test_ghost.oxw
===================================================================
--- code/branches/presentation3/data/levels/test_ghost.oxw 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/data/levels/test_ghost.oxw 2010-05-31 07:02:48 UTC (rev 7036)
@@ -3,6 +3,7 @@
include("stats.oxo")
include("templates/spaceship_ghost.oxt")
include("templates/spaceship_pirate.oxt")
+ include("templates/lodinformation.oxt")
?>
<Level
@@ -10,6 +11,10 @@
description = "presentation level for Orxonox Convention X"
>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+
<Scene
ambientlight = "0.5, 0.5, 0.5"
skybox = "Orxonox/skypanoramagen1"
Modified: code/branches/presentation3/data/levels/test_stars.oxw
===================================================================
--- code/branches/presentation3/data/levels/test_stars.oxw 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/data/levels/test_stars.oxw 2010-05-31 07:02:48 UTC (rev 7036)
@@ -12,6 +12,9 @@
name = "Sample"
description = "Just a few tests"
>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
<Scene
ambientlight = "0.8, 0.8, 0.8"
>
Modified: code/branches/presentation3/data/levels/tutorial.oxw
===================================================================
--- code/branches/presentation3/data/levels/tutorial.oxw 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/data/levels/tutorial.oxw 2010-05-31 07:02:48 UTC (rev 7036)
@@ -8,6 +8,9 @@
name = "Presentation"
description = "A simple testlevel"
>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
<Scene
ambientlight = "0.5, 0.5, 0.5"
skybox = "Orxonox/skypanoramagen1"
Modified: code/branches/presentation3/data/levels/waypoints.oxw
===================================================================
--- code/branches/presentation3/data/levels/waypoints.oxw 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/data/levels/waypoints.oxw 2010-05-31 07:02:48 UTC (rev 7036)
@@ -4,12 +4,16 @@
include("templates/spaceship_assff.oxt")
include("templates/spaceship_H2.oxt")
include("templates/spaceship_pirate.oxt")
+ include("templates/lodinformation.oxt")
?>
<Level
name = "Waypoints"
description = "Testing waypoings for AI controlled spaceships."
>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
<Scene
ambientlight = "0.5, 0.5, 0.5"
skybox = "Orxonox/skypanoramagen1"
Modified: code/branches/presentation3/src/orxonox/Level.cc
===================================================================
--- code/branches/presentation3/src/orxonox/Level.cc 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/src/orxonox/Level.cc 2010-05-31 07:02:48 UTC (rev 7036)
@@ -144,7 +144,10 @@
void Level::addLodInfo(MeshLodInformation* lodInformation)
{
std::string meshName = lodInformation->getMeshName();
- this->lodInformation_.insert(std::make_pair(meshName,lodInformation));
+// this->lodInformation_.insert(std::make_pair(meshName,lodInformation));
+ if( this->lodInformation_.find(meshName) != this->lodInformation_.end())
+ CCOUT(4) << "replacing lod information for " << meshName << endl;
+ this->lodInformation_[meshName] = lodInformation;
}
MeshLodInformation* Level::getLodInfo(std::string meshName) const
Modified: code/branches/presentation3/src/orxonox/graphics/MeshLodInformation.cc
===================================================================
--- code/branches/presentation3/src/orxonox/graphics/MeshLodInformation.cc 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/src/orxonox/graphics/MeshLodInformation.cc 2010-05-31 07:02:48 UTC (rev 7036)
@@ -40,7 +40,7 @@
CreateFactory(MeshLodInformation);
MeshLodInformation::MeshLodInformation(BaseObject* creator)
- : BaseObject(creator), lodLevel_(-1), bEnabled_(true)
+ : BaseObject(creator), lodLevel_(5), bEnabled_(true), numLevels_(10), reductionRate_(0.15)
{
RegisterObject(MeshLodInformation);
}
@@ -55,6 +55,8 @@
XMLPortParam(MeshLodInformation, "mesh", setMeshSource, getMeshSource, xmlelement, mode);
XMLPortParam(MeshLodInformation, "lodQuality", setLodLevel, getLodLevel, xmlelement, mode);
XMLPortParam(MeshLodInformation, "enabled", setEnabled, getEnabled, xmlelement, mode);
+ XMLPortParam(MeshLodInformation, "numLevels", setNumLevels, getNumLevels, xmlelement, mode);
+ XMLPortParam(MeshLodInformation, "reductionRate", setReductionRate, getReductionRate, xmlelement, mode);
}
std::string MeshLodInformation::getMeshName()
Modified: code/branches/presentation3/src/orxonox/graphics/MeshLodInformation.h
===================================================================
--- code/branches/presentation3/src/orxonox/graphics/MeshLodInformation.h 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/src/orxonox/graphics/MeshLodInformation.h 2010-05-31 07:02:48 UTC (rev 7036)
@@ -46,17 +46,23 @@
float getLodLevel();
std::string getMeshName();
bool getEnabled(){ return this->bEnabled_; }
+ unsigned int getNumLevels(){ return this->numLevels_; }
+ float getReductionRate(){ return this->reductionRate_; }
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
private:
void setLodLevel(float lodLevel);
void setMeshSource(std::string meshSource);
- void setEnabled( bool enabled ){ this->bEnabled_ = true; }
+ void setEnabled( bool enabled ){ this->bEnabled_ = enabled; }
+ void setNumLevels( unsigned int num ){ this->numLevels_ = num; }
+ void setReductionRate( float rate ){ this->reductionRate_ = rate; }
std::string getMeshSource();
std::string meshSource_;
float lodLevel_;
bool bEnabled_;
+ unsigned int numLevels_;
+ float reductionRate_;
};
}
Modified: code/branches/presentation3/src/orxonox/graphics/Model.cc
===================================================================
--- code/branches/presentation3/src/orxonox/graphics/Model.cc 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/src/orxonox/graphics/Model.cc 2010-05-31 07:02:48 UTC (rev 7036)
@@ -41,15 +41,12 @@
{
CreateFactory(Model);
- Model::Model(BaseObject* creator) : StaticEntity(creator)
+ Model::Model(BaseObject* creator) :
+ StaticEntity(creator), bCastShadows_(true), lodLevel_(5), bLodEnabled_(true), numLodLevels_(10), lodReductionRate_(.15)
{
RegisterObject(Model);
- this->bCastShadows_ = true;
-
this->registerVariables();
- //LoD
- this->lodLevel_=5;
}
Model::~Model()
@@ -101,18 +98,27 @@
//LOD
- if(this->mesh_.getEntity()->getMesh()->getNumLodLevels()==1
- &&this->meshSrc_!="laserbeam.mesh")
+ if( this->mesh_.getEntity()->getMesh()->getNumLodLevels()==1 )
{
Level* level = this->getLevel();
assert( level != 0 );
- if( level->getLodInfo(this->meshSrc_)!=0 )
- setLodLevel(level->getLodInfo(this->meshSrc_)->getLodLevel());
- if( level->getLodInfo(this->meshSrc_)==0 || level->getLodInfo(this->meshSrc_)->getEnabled() )
+ MeshLodInformation* lodInfo = level->getLodInfo(this->meshSrc_);
+ if( lodInfo )
{
-
+ setLodLevel(lodInfo->getLodLevel());
+ this->bLodEnabled_ = lodInfo->getEnabled();
+ this->numLodLevels_ = lodInfo->getNumLevels();
+ this->lodReductionRate_ = lodInfo->getReductionRate();
+ }
+ if( this->numLodLevels_>10 )
+ {
+ CCOUT(2) << "More than 10 LoD levels requested. Creating only 10." << endl;
+ this->numLodLevels_ = 10;
+ }
+ if( this->bLodEnabled_ )
+ {
float volume = this->mesh_.getEntity()->getBoundingBox().volume();
// float scaleFactor = 1;
@@ -138,7 +144,7 @@
// float factor = scaleFactor*5/lodLevel_;
float factor = volume/3/lodLevel_;
- COUT(4)<<"LodLevel set with factor: "<<factor<<std::endl;
+ COUT(4) << "LodLevel set with factor: " << factor << endl;
distList.push_back(70.0f*factor);
distList.push_back(140.0f*factor);
@@ -150,12 +156,12 @@
distList.push_back(290.0f*factor);
distList.push_back(310.0f*factor);
distList.push_back(330.0f*factor);
+ while(distList.size()>this->numLodLevels_)
+ distList.pop_back();
- float reductionValue = 0.15f;
-
//Generiert LOD-Levels
- this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, reductionValue);
+ this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, this->lodReductionRate_);
}
else
{
@@ -165,9 +171,11 @@
else
what = "<0";
- COUT(4)<<"LodLevel not set because lodLevel("<<lodLevel_<<") was "<<what<<"."<<std::endl;
+ COUT(4)<<"LodLevel not set because lodLevel("<<lodLevel_<<") was "<<what<<"." << endl;
}
}
+ else
+ COUT(4) << "LodLevel for " << this->meshSrc_ << " not set because is disabled." << endl;
}
}
}
Modified: code/branches/presentation3/src/orxonox/graphics/Model.h
===================================================================
--- code/branches/presentation3/src/orxonox/graphics/Model.h 2010-05-31 05:43:51 UTC (rev 7035)
+++ code/branches/presentation3/src/orxonox/graphics/Model.h 2010-05-31 07:02:48 UTC (rev 7036)
@@ -78,6 +78,10 @@
//LoD
float lodLevel_;
+ bool bLodEnabled_;
+ unsigned int numLodLevels_;
+ float lodReductionRate_;
+
};
}
More information about the Orxonox-commit
mailing list