[Orxonox-commit 2301] r7016 - code/branches/presentation3/src/orxonox/graphics
scheusso at orxonox.net
scheusso at orxonox.net
Sun May 30 14:52:34 CEST 2010
Author: scheusso
Date: 2010-05-30 14:52:34 +0200 (Sun, 30 May 2010)
New Revision: 7016
Modified:
code/branches/presentation3/src/orxonox/graphics/Model.cc
Log:
change in LoD: use volume of the bounding box instead of scalefactor to determine scaling parameters
Modified: code/branches/presentation3/src/orxonox/graphics/Model.cc
===================================================================
--- code/branches/presentation3/src/orxonox/graphics/Model.cc 2010-05-30 12:51:33 UTC (rev 7015)
+++ code/branches/presentation3/src/orxonox/graphics/Model.cc 2010-05-30 12:52:34 UTC (rev 7016)
@@ -99,11 +99,14 @@
this->mesh_.getEntity()->setCastShadows(this->bCastShadows_);
this->mesh_.setVisible(this->isVisible());
+
//LOD
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))
@@ -111,6 +114,7 @@
scaleFactor *= getBiggestScale(((WorldEntity*) creatorPtr)->getScale3D());
creatorPtr = creatorPtr->getCreator();
}
+// COUT(0) << "name: " << this->meshSrc_ << "scaleFactor: " << scaleFactor << ", volume: " << volume << endl;
Level* level = this->getLevel();
@@ -126,9 +130,10 @@
Ogre::Mesh::LodDistanceList distList;
#endif
- if(lodLevel_>0&&lodLevel_<=5)
+ if( lodLevel_>0 )
{
- float factor = scaleFactor*5/lodLevel_;
+// float factor = scaleFactor*5/lodLevel_;
+ float factor = volume/3/lodLevel_;
COUT(4)<<"LodLevel set with factor: "<<factor<<std::endl;
More information about the Orxonox-commit
mailing list