mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:23:51 +00:00
Terrain: take cell world size into account for LOD selection
This commit is contained in:
parent
065b6d3331
commit
b3fed853ae
1 changed files with 16 additions and 14 deletions
|
@ -171,7 +171,7 @@ QuadTreeNode::QuadTreeNode(World* terrain, ChildDirection dir, float size, const
|
||||||
float cellWorldSize = mTerrain->getStorage()->getCellWorldSize();
|
float cellWorldSize = mTerrain->getStorage()->getCellWorldSize();
|
||||||
|
|
||||||
Ogre::Vector3 sceneNodePos (pos.x*cellWorldSize, pos.y*cellWorldSize, 0);
|
Ogre::Vector3 sceneNodePos (pos.x*cellWorldSize, pos.y*cellWorldSize, 0);
|
||||||
mTerrain->convertPosition(sceneNodePos.x, sceneNodePos.y, sceneNodePos.z);
|
mTerrain->convertPosition(sceneNodePos);
|
||||||
|
|
||||||
mSceneNode->setPosition(sceneNodePos);
|
mSceneNode->setPosition(sceneNodePos);
|
||||||
|
|
||||||
|
@ -274,21 +274,23 @@ void QuadTreeNode::update(const Ogre::Vector3 &cameraPos)
|
||||||
mParent->getSceneNode()->addChild(mSceneNode);
|
mParent->getSceneNode()->addChild(mSceneNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \todo implement error metrics or some other means of not using arbitrary values
|
// Simple LOD selection
|
||||||
/// (general quality needs to be user configurable as well)
|
/// \todo use error metrics?
|
||||||
size_t wantedLod = 0;
|
size_t wantedLod = 0;
|
||||||
if (dist > 8192*1)
|
float cellWorldSize = mTerrain->getStorage()->getCellWorldSize();
|
||||||
wantedLod = 1;
|
|
||||||
if (dist > 8192*2)
|
if (dist > cellWorldSize*64)
|
||||||
wantedLod = 2;
|
|
||||||
if (dist > 8192*5)
|
|
||||||
wantedLod = 3;
|
|
||||||
if (dist > 8192*12)
|
|
||||||
wantedLod = 4;
|
|
||||||
if (dist > 8192*32)
|
|
||||||
wantedLod = 5;
|
|
||||||
if (dist > 8192*64)
|
|
||||||
wantedLod = 6;
|
wantedLod = 6;
|
||||||
|
else if (dist > cellWorldSize*32)
|
||||||
|
wantedLod = 5;
|
||||||
|
else if (dist > cellWorldSize*12)
|
||||||
|
wantedLod = 4;
|
||||||
|
else if (dist > cellWorldSize*5)
|
||||||
|
wantedLod = 3;
|
||||||
|
else if (dist > cellWorldSize*2)
|
||||||
|
wantedLod = 2;
|
||||||
|
else if (dist > cellWorldSize)
|
||||||
|
wantedLod = 1;
|
||||||
|
|
||||||
bool hadChunk = hasChunk();
|
bool hadChunk = hasChunk();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue