Merge remote-tracking branch 'zini/master' into physics

This commit is contained in:
Chris Robinson 2013-08-20 04:42:28 -07:00
commit 0e56b2facb
6 changed files with 15 additions and 19 deletions

View file

@ -248,6 +248,9 @@ namespace MWGui
delete mCharGen; delete mCharGen;
mCharGen = new CharacterCreation(); mCharGen = new CharacterCreation();
mGuiModes.clear(); mGuiModes.clear();
mHud->unsetSelectedWeapon();
mHud->unsetSelectedSpell();
unsetForceHide(GW_ALL);
} }
else else
allow(GW_ALL); allow(GW_ALL);

View file

@ -145,7 +145,6 @@ RenderingManager::RenderingManager(OEngine::Render::OgreRenderer& _rend, const b
sh::Factory::getInstance ().setGlobalSetting ("fog", "true"); sh::Factory::getInstance ().setGlobalSetting ("fog", "true");
sh::Factory::getInstance ().setGlobalSetting ("num_lights", Settings::Manager::getString ("num lights", "Objects")); sh::Factory::getInstance ().setGlobalSetting ("num_lights", Settings::Manager::getString ("num lights", "Objects"));
sh::Factory::getInstance ().setGlobalSetting ("terrain_num_lights", Settings::Manager::getString ("num lights", "Terrain"));
sh::Factory::getInstance ().setGlobalSetting ("simple_water", Settings::Manager::getBool("shader", "Water") ? "false" : "true"); sh::Factory::getInstance ().setGlobalSetting ("simple_water", Settings::Manager::getBool("shader", "Water") ? "false" : "true");
sh::Factory::getInstance ().setGlobalSetting ("render_refraction", "false"); sh::Factory::getInstance ().setGlobalSetting ("render_refraction", "false");
@ -1003,7 +1002,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);
} }

View file

@ -240,12 +240,13 @@ namespace MWWorld
// Rebuild player // Rebuild player
setupPlayer(); setupPlayer();
MWWorld::Ptr player = mPlayer->getPlayer(); MWWorld::Ptr player = mPlayer->getPlayer();
renderPlayer();
mRendering->resetCamera();
// removes NpcStats, ContainerStore etc // removes NpcStats, ContainerStore etc
player.getRefData().setCustomData(NULL); player.getRefData().setCustomData(NULL);
renderPlayer();
mRendering->resetCamera();
// make sure to do this so that local scripts from items that were in the players inventory are removed // make sure to do this so that local scripts from items that were in the players inventory are removed
mLocalScripts.clear(); mLocalScripts.clear();
@ -1026,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

View file

@ -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

View file

@ -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;

View file

@ -200,13 +200,6 @@
@shPassthroughFragmentInputs @shPassthroughFragmentInputs
shUniform(float4, lightAmbient) @shAutoConstant(lightAmbient, ambient_light_colour)
@shForeach(@shGlobalSettingString(terrain_num_lights))
shUniform(float4, lightPosObjSpace@shIterator) @shAutoConstant(lightPosObjSpace@shIterator, light_position, @shIterator)
shUniform(float4, lightAttenuation@shIterator) @shAutoConstant(lightAttenuation@shIterator, light_attenuation, @shIterator)
shUniform(float4, lightDiffuse@shIterator) @shAutoConstant(lightDiffuse@shIterator, light_diffuse_colour, @shIterator)
@shEndForeach
#if SHADOWS #if SHADOWS
shSampler2D(shadowMap0) shSampler2D(shadowMap0)
shUniform(float2, invShadowmapSize0) @shAutoConstant(invShadowmapSize0, inverse_texture_size, @shPropertyString(shadowtexture_offset)) shUniform(float2, invShadowmapSize0) @shAutoConstant(invShadowmapSize0, inverse_texture_size, @shPropertyString(shadowtexture_offset))