Some terrain fixes

pull/51/head
scrawl 12 years ago
parent 0545622f5a
commit fa76d1631b

@ -1003,7 +1003,8 @@ void RenderingManager::resetCamera()
float RenderingManager::getTerrainHeightAt(Ogre::Vector3 worldPos)
{
assert(mTerrain);
if (!mTerrain || !mTerrain->getVisible())
return -std::numeric_limits<float>::max();
return mTerrain->getHeightAt(worldPos);
}

@ -1027,13 +1027,10 @@ namespace MWWorld
return;
}
if (ptr.getCell()->isExterior())
{
float terrainHeight = mRendering->getTerrainHeightAt(pos);
float terrainHeight = mRendering->getTerrainHeightAt(pos);
if (pos.z < terrainHeight)
pos.z = terrainHeight;
}
if (pos.z < terrainHeight)
pos.z = terrainHeight;
ptr.getRefData().getPosition().pos[2] = pos.z + 20; // place slightly above. will snap down to ground with code below

@ -46,12 +46,12 @@ namespace
// Algorithm described by Hanan Samet - 'Neighbour Finding in Quadtrees'
// http://www.cs.umd.edu/~hjs/pubs/SametPRIP81.pdf
Terrain::QuadTreeNode* searchNeighbourRecursive (Terrain::QuadTreeNode* currentNode, Terrain::Direction dir)
QuadTreeNode* searchNeighbourRecursive (QuadTreeNode* currentNode, Direction dir)
{
if (!currentNode->getParent())
return NULL; // Arrived at root node, the root node does not have neighbours
Terrain::QuadTreeNode* nextNode;
QuadTreeNode* nextNode;
if (adjacent(currentNode->getDirection(), dir))
nextNode = searchNeighbourRecursive(currentNode->getParent(), dir);
else

@ -14,6 +14,8 @@ namespace Terrain
/// We keep storage of terrain data abstract here since we need different implementations for game and editor
class Storage
{
public:
virtual ~Storage() {}
private:
virtual ESM::Land* getLand (int cellX, int cellY) = 0;
virtual const ESM::LandTexture* getLandTexture(int index, short plugin) = 0;

Loading…
Cancel
Save