Fixed a bug with shifting the heightmap.

This commit is contained in:
Steffen Fündgens 2015-03-02 17:17:06 +01:00
parent 262241f559
commit 319ef672df

View File

@ -57,7 +57,7 @@ void Loader::load(std::string filePath, Level* level, std::string compositionsPa
float terrainShininess = queryFloat(terrainElement, "shininess"); float terrainShininess = queryFloat(terrainElement, "shininess");
Material terrainMaterial = Material(terrainTexture, terrainAmbientFactor, terrainDiffuseFactor, terrainSpecularFactor, terrainShininess); Material terrainMaterial = Material(terrainTexture, terrainAmbientFactor, terrainDiffuseFactor, terrainSpecularFactor, terrainShininess);
Object* terrainObject = new Object(terrainModel, terrainMaterial, Object* terrainObject = new Object(terrainModel, terrainMaterial,
glm::vec3(-0.5*(float)level->getTerrain()->getHeightmapHeight(), 0.0f, -0.5f*(float)level->getTerrain()->getHeightmapWidth()), glm::vec3(-0.5*((float)level->getTerrain()->getHeightmapHeight()-1), 0.0f, -0.5f*((float)level->getTerrain()->getHeightmapWidth()-1)),
glm::vec3(0.0f, 0.0f, 0.0f), true); glm::vec3(0.0f, 0.0f, 0.0f), true);
level->addObject(terrainObject); level->addObject(terrainObject);
level->getPhysics()->addTerrain(level->getTerrain()->getHeightmapWidth(), level->getTerrain()->getHeightmapHeight(), level->getTerrain()->getHeightmap()); level->getPhysics()->addTerrain(level->getTerrain()->getHeightmapWidth(), level->getTerrain()->getHeightmapHeight(), level->getTerrain()->getHeightmap());