[Orxonox-commit 2305] r7020 - in code/branches/presentation3: . data/levels/templates src/orxonox/graphics
scheusso at orxonox.net
scheusso at orxonox.net
Sun May 30 15:46:09 CEST 2010
Author: scheusso
Date: 2010-05-30 15:46:08 +0200 (Sun, 30 May 2010)
New Revision: 7020
Modified:
code/branches/presentation3/
code/branches/presentation3/data/levels/templates/lodinformation.oxt
code/branches/presentation3/src/orxonox/graphics/MeshLodInformation.cc
code/branches/presentation3/src/orxonox/graphics/MeshLodInformation.h
code/branches/presentation3/src/orxonox/graphics/Model.cc
Log:
some enhancements to lod (can be disabled now in the lodinformation template)
Property changes on: code/branches/presentation3
___________________________________________________________________
Modified: svn:mergeinfo
- /code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hudelements:6584-6941
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/map:2801-3086,3089
/code/branches/menu:5941-6146,6148
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network64:2210-2355
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup2:5942-6405
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/presentation:2369-2652,2654-2660
/code/branches/presentation2:6106-6416
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/script_trigger:1295-1953,1955
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/steering:5949-6091
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051
/code/branches/weaponsystem:2742-2890
+ /code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hudelements:6584-6941
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/map:2801-3086,3089
/code/branches/menu:5941-6146,6148
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network64:2210-2355
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup2:5942-6405
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/presentation:2369-2652,2654-2660
/code/branches/presentation2:6106-6416
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/steering:5949-6091
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051
/code/branches/weaponsystem:2742-2890
Modified: code/branches/presentation3/data/levels/templates/lodinformation.oxt
===================================================================
--- code/branches/presentation3/data/levels/templates/lodinformation.oxt 2010-05-30 13:44:22 UTC (rev 7019)
+++ code/branches/presentation3/data/levels/templates/lodinformation.oxt 2010-05-30 13:46:08 UTC (rev 7020)
@@ -3,7 +3,8 @@
<lodinformation>
<MeshLodInformation mesh=Carrier.mesh lodQuality=1.8 />
<MeshLodInformation mesh=assff.mesh lodQuality=3 />
- <MeshLodInformation mesh=Transporter.mesh lodQuality=100 />
+ <MeshLodInformation mesh=Transporter.mesh lodQuality=5 />
+ <MeshLodInformation mesh=rocket.mesh lodQuality=5 enabled=true />
</lodinformation>
</Level>
</Template>
Modified: code/branches/presentation3/src/orxonox/graphics/MeshLodInformation.cc
===================================================================
--- code/branches/presentation3/src/orxonox/graphics/MeshLodInformation.cc 2010-05-30 13:44:22 UTC (rev 7019)
+++ code/branches/presentation3/src/orxonox/graphics/MeshLodInformation.cc 2010-05-30 13:46:08 UTC (rev 7020)
@@ -40,7 +40,7 @@
CreateFactory(MeshLodInformation);
MeshLodInformation::MeshLodInformation(BaseObject* creator)
- : BaseObject(creator), lodLevel_(-1)
+ : BaseObject(creator), lodLevel_(-1), bEnabled_(true)
{
RegisterObject(MeshLodInformation);
}
@@ -54,6 +54,7 @@
XMLPortParam(MeshLodInformation, "mesh", setMeshSource, getMeshSource, xmlelement, mode);
XMLPortParam(MeshLodInformation, "lodQuality", setLodLevel, getLodLevel, xmlelement, mode);
+ XMLPortParam(MeshLodInformation, "enabled", setEnabled, getEnabled, 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-30 13:44:22 UTC (rev 7019)
+++ code/branches/presentation3/src/orxonox/graphics/MeshLodInformation.h 2010-05-30 13:46:08 UTC (rev 7020)
@@ -39,21 +39,25 @@
{
class _OrxonoxExport MeshLodInformation : public BaseObject
{
- private:
- void setLodLevel(float lodLevel);
- void setMeshSource(std::string meshSource);
- std::string getMeshSource();
- std::string meshSource_;
- float lodLevel_;
-
public:
MeshLodInformation(BaseObject* creator);
virtual ~MeshLodInformation();
- float getLodLevel();
+ float getLodLevel();
std::string getMeshName();
+ bool getEnabled(){ return this->bEnabled_; }
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- 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; }
+ std::string getMeshSource();
+ std::string meshSource_;
+ float lodLevel_;
+ bool bEnabled_;
+
};
}
Modified: code/branches/presentation3/src/orxonox/graphics/Model.cc
===================================================================
--- code/branches/presentation3/src/orxonox/graphics/Model.cc 2010-05-30 13:44:22 UTC (rev 7019)
+++ code/branches/presentation3/src/orxonox/graphics/Model.cc 2010-05-30 13:46:08 UTC (rev 7020)
@@ -104,65 +104,67 @@
if(this->mesh_.getEntity()->getMesh()->getNumLodLevels()==1
&&this->meshSrc_!="laserbeam.mesh")
{
- float volume = this->mesh_.getEntity()->getBoundingBox().volume();
- float scaleFactor = 1;
-
- BaseObject* creatorPtr = this;
-
- while(creatorPtr!=NULL&&orxonox_cast<WorldEntity*>(creatorPtr))
- {
- scaleFactor *= getBiggestScale(((WorldEntity*) creatorPtr)->getScale3D());
- creatorPtr = creatorPtr->getCreator();
- }
-// COUT(0) << "name: " << this->meshSrc_ << "scaleFactor: " << scaleFactor << ", volume: " << volume << endl;
-
Level* level = this->getLevel();
-
+
assert( level != 0 );
- if( level->getLodInfo(this->meshSrc_)!=0 )
+ if( level->getLodInfo(this->meshSrc_)!=0 && level->getLodInfo(this->meshSrc_)->getEnabled() )
+ {
setLodLevel(level->getLodInfo(this->meshSrc_)->getLodLevel());
-
- COUT(4) << "Setting lodLevel for " << this->meshSrc_<< " with lodLevel_: " << this->lodLevel_ <<" and scale: "<< scaleFactor << ":" << std::endl;
+ float volume = this->mesh_.getEntity()->getBoundingBox().volume();
+ // float scaleFactor = 1;
+
+ // BaseObject* creatorPtr = this;
+ //
+ // while(creatorPtr!=NULL&&orxonox_cast<WorldEntity*>(creatorPtr))
+ // {
+ // scaleFactor *= getBiggestScale(((WorldEntity*) creatorPtr)->getScale3D());
+ // creatorPtr = creatorPtr->getCreator();
+ // }
+ // COUT(0) << "name: " << this->meshSrc_ << "scaleFactor: " << scaleFactor << ", volume: " << volume << endl;
+
+ COUT(4) << "Setting lodLevel for " << this->meshSrc_<< " with lodLevel_: " << this->lodLevel_ <<" and volume: "<< volume << ":" << std::endl;
+
#if OGRE_VERSION >= 0x010700
- Ogre::Mesh::LodValueList distList;
+ Ogre::Mesh::LodValueList distList;
#else
- Ogre::Mesh::LodDistanceList distList;
+ Ogre::Mesh::LodDistanceList distList;
#endif
- if( lodLevel_>0 )
- {
-// float factor = scaleFactor*5/lodLevel_;
- float factor = volume/3/lodLevel_;
-
- COUT(4)<<"LodLevel set with factor: "<<factor<<std::endl;
+ if( lodLevel_>0 )
+ {
+ // float factor = scaleFactor*5/lodLevel_;
+ float factor = volume/3/lodLevel_;
+
+ COUT(4)<<"LodLevel set with factor: "<<factor<<std::endl;
- distList.push_back(70.0f*factor);
- distList.push_back(140.0f*factor);
- distList.push_back(170.0f*factor);
- distList.push_back(200.0f*factor);
- distList.push_back(230.0f*factor);
- distList.push_back(250.0f*factor);
- distList.push_back(270.0f*factor);
- distList.push_back(290.0f*factor);
- distList.push_back(310.0f*factor);
- distList.push_back(330.0f*factor);
+ distList.push_back(70.0f*factor);
+ distList.push_back(140.0f*factor);
+ distList.push_back(170.0f*factor);
+ distList.push_back(200.0f*factor);
+ distList.push_back(230.0f*factor);
+ distList.push_back(250.0f*factor);
+ distList.push_back(270.0f*factor);
+ distList.push_back(290.0f*factor);
+ distList.push_back(310.0f*factor);
+ distList.push_back(330.0f*factor);
- float reductionValue = 0.15f;
+ float reductionValue = 0.15f;
-
- //Generiert LOD-Levels
- this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, reductionValue);
- }
- else
- {
- std::string what;
- if(lodLevel_>5)
- what = ">5";
+
+ //Generiert LOD-Levels
+ this->mesh_.getEntity()->getMesh()->generateLodLevels(distList, Ogre::ProgressiveMesh::VRQ_PROPORTIONAL, reductionValue);
+ }
else
- what = "<0";
-
- COUT(4)<<"LodLevel not set because lodLevel("<<lodLevel_<<") was "<<what<<"."<<std::endl;
+ {
+ std::string what;
+ if(lodLevel_>5)
+ what = ">5";
+ else
+ what = "<0";
+
+ COUT(4)<<"LodLevel not set because lodLevel("<<lodLevel_<<") was "<<what<<"."<<std::endl;
+ }
}
}
}
More information about the Orxonox-commit
mailing list