Added height at location

This commit is contained in:
2016-05-26 17:06:34 +02:00
parent 4c613b606a
commit 2b0e22d4c9
10 changed files with 54 additions and 29 deletions
+10 -1
View File
@@ -25,7 +25,11 @@ World::World(const std::string &fileName)
if (v["objects"].isNull())
std::cout << "Invalid world file: objects - " << fileName << "\n";
heightmap = new HeightMap(v["world"]["heightmap"].asString());
float scale = 1.0f;
if (!v["world"]["scale"].isNull())
scale = v["world"]["scale"].asFloat();
heightmap = new HeightMap(v["world"]["heightmap"].asString(), scale);
if(!v["world"]["texture"].isNull())
heightmap->SetTexture(v["world"]["texture"].asString());
@@ -86,6 +90,11 @@ World::~World()
delete heightmap;
}
float World::getHeight(float x, float y)
{
return heightmap->GetHeight(x, y);
}
void World::draw()
{
player->setCamera();