diff --git a/src/graphics/lod_node.cpp b/src/graphics/lod_node.cpp index fa4c06448..444ac18c8 100644 --- a/src/graphics/lod_node.cpp +++ b/src/graphics/lod_node.cpp @@ -241,8 +241,11 @@ void LODNode::OnRegisterSceneNode() scene::ISceneNode::OnRegisterSceneNode(); } -void LODNode::autoComputeLevel() +void LODNode::autoComputeLevel(float scale) { + printf("Scale2 %f\n", scale); + m_volume *= scale; + printf("Factor %f\n", m_volume); // This will be set based on the amount of objects in a scene. float agressivity = 1.0; @@ -272,8 +275,11 @@ void LODNode::add(int level, scene::ISceneNode* node, bool reparent) { Box = node->getBoundingBox(); m_volume = Box.getArea(); + printf("\nLod\n==========================\n"); + printf("Level %d\n", level); printf("Area %f\n", Box.getArea()); printf("Volume %f\n", Box.getVolume()); + printf("Scale %f, %f, %f \n", node->getScale().X, node->getScale().Y, node->getScale().Z); // samuncle suggested to put a slight randomisation in LOD // I'm not convinced (Auria) but he's the artist pro, so I listen ;P diff --git a/src/graphics/lod_node.hpp b/src/graphics/lod_node.hpp index ba7b852a1..fe2fe79b3 100644 --- a/src/graphics/lod_node.hpp +++ b/src/graphics/lod_node.hpp @@ -111,7 +111,7 @@ public: /** * This method can be used to automatically compute LoD level */ - void autoComputeLevel(); + void autoComputeLevel(float scale); void forceLevelOfDetail(int n); diff --git a/src/tracks/model_definition_loader.cpp b/src/tracks/model_definition_loader.cpp index 184d8eb2e..17f9b6c59 100644 --- a/src/tracks/model_definition_loader.cpp +++ b/src/tracks/model_definition_loader.cpp @@ -142,7 +142,9 @@ LODNode* ModelDefinitionLoader::instanciateAsLOD(const XMLNode* node, scene::ISc lod_node->add(group[m].m_distance, scene_node, true); } } - lod_node->autoComputeLevel(); + vector3df scale = vector3df(1.f, 1.f, 1.f); + node->get("scale", &scale); + lod_node->autoComputeLevel(scale.getLength()); #ifdef DEBUG std::string debug_name = groupname+" (LOD track-object)";