forked from mirror/openmw-tes3mp
Some terrain fixes
This commit is contained in:
parent
0545622f5a
commit
fa76d1631b
4 changed files with 9 additions and 9 deletions
|
@ -1003,7 +1003,8 @@ void RenderingManager::resetCamera()
|
||||||
|
|
||||||
float RenderingManager::getTerrainHeightAt(Ogre::Vector3 worldPos)
|
float RenderingManager::getTerrainHeightAt(Ogre::Vector3 worldPos)
|
||||||
{
|
{
|
||||||
assert(mTerrain);
|
if (!mTerrain || !mTerrain->getVisible())
|
||||||
|
return -std::numeric_limits<float>::max();
|
||||||
return mTerrain->getHeightAt(worldPos);
|
return mTerrain->getHeightAt(worldPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1027,13 +1027,10 @@ namespace MWWorld
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ptr.getCell()->isExterior())
|
float terrainHeight = mRendering->getTerrainHeightAt(pos);
|
||||||
{
|
|
||||||
float terrainHeight = mRendering->getTerrainHeightAt(pos);
|
|
||||||
|
|
||||||
if (pos.z < terrainHeight)
|
if (pos.z < terrainHeight)
|
||||||
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
|
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'
|
// Algorithm described by Hanan Samet - 'Neighbour Finding in Quadtrees'
|
||||||
// http://www.cs.umd.edu/~hjs/pubs/SametPRIP81.pdf
|
// 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())
|
if (!currentNode->getParent())
|
||||||
return NULL; // Arrived at root node, the root node does not have neighbours
|
return NULL; // Arrived at root node, the root node does not have neighbours
|
||||||
|
|
||||||
Terrain::QuadTreeNode* nextNode;
|
QuadTreeNode* nextNode;
|
||||||
if (adjacent(currentNode->getDirection(), dir))
|
if (adjacent(currentNode->getDirection(), dir))
|
||||||
nextNode = searchNeighbourRecursive(currentNode->getParent(), dir);
|
nextNode = searchNeighbourRecursive(currentNode->getParent(), dir);
|
||||||
else
|
else
|
||||||
|
|
|
@ -14,6 +14,8 @@ namespace Terrain
|
||||||
/// We keep storage of terrain data abstract here since we need different implementations for game and editor
|
/// We keep storage of terrain data abstract here since we need different implementations for game and editor
|
||||||
class Storage
|
class Storage
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
virtual ~Storage() {}
|
||||||
private:
|
private:
|
||||||
virtual ESM::Land* getLand (int cellX, int cellY) = 0;
|
virtual ESM::Land* getLand (int cellX, int cellY) = 0;
|
||||||
virtual const ESM::LandTexture* getLandTexture(int index, short plugin) = 0;
|
virtual const ESM::LandTexture* getLandTexture(int index, short plugin) = 0;
|
||||||
|
|
Loading…
Reference in a new issue