From 0c8cc738643c86db450ba98d815232038e8436d6 Mon Sep 17 00:00:00 2001 From: saschawillems Date: Thu, 20 Oct 2016 21:27:49 +0200 Subject: [PATCH] Heightmap class constructor parameters --- base/vulkanheightmap.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/base/vulkanheightmap.hpp b/base/vulkanheightmap.hpp index df29522e..50b31e25 100644 --- a/base/vulkanheightmap.hpp +++ b/base/vulkanheightmap.hpp @@ -67,9 +67,9 @@ namespace vkTools } #if defined(__ANDROID__) - void loadFromFile(const std::string filename, uint32_t patchsize, float heightScale, Topology topology, AAssetManager* assetManager) + void loadFromFile(const std::string filename, uint32_t patchsize, glm::vec3 scale, Topology topology, AAssetManager* assetManager) #else - void loadFromFile(const std::string filename, uint32_t patchsize, float heightScale, Topology topology) + void loadFromFile(const std::string filename, uint32_t patchsize, glm::vec3 scale, Topology topology) #endif { assert(device); @@ -92,7 +92,7 @@ namespace vkTools heightdata = new uint16_t[dim * dim]; memcpy(heightdata, heightTex.data(), heightTex.size()); this->scale = dim / patchsize; - this->heightScale = heightScale; + this->heightScale = scale.y; // Generate vertices @@ -106,9 +106,9 @@ namespace vkTools for (uint32_t y = 0; y < patchsize; y++) { uint32_t index = (x + y * patchsize); - vertices[index].pos[0] = x * wx + wx / 2.0f - (float)patchsize * wx / 2.0f; + vertices[index].pos[0] = (x * wx + wx / 2.0f - (float)patchsize * wx / 2.0f) * scale.x; vertices[index].pos[1] = -getHeight(x, y); - vertices[index].pos[2] = y * wy + wy / 2.0f - (float)patchsize * wy / 2.0f; + vertices[index].pos[2] = (y * wy + wy / 2.0f - (float)patchsize * wy / 2.0f) * scale.z; vertices[index].uv = glm::vec2((float)x / patchsize, (float)y / patchsize) * uvScale; } }