Heightmap class constructor parameters
This commit is contained in:
parent
21276cb497
commit
0c8cc73864
1 changed files with 5 additions and 5 deletions
|
|
@ -67,9 +67,9 @@ namespace vkTools
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__ANDROID__)
|
#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
|
#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
|
#endif
|
||||||
{
|
{
|
||||||
assert(device);
|
assert(device);
|
||||||
|
|
@ -92,7 +92,7 @@ namespace vkTools
|
||||||
heightdata = new uint16_t[dim * dim];
|
heightdata = new uint16_t[dim * dim];
|
||||||
memcpy(heightdata, heightTex.data(), heightTex.size());
|
memcpy(heightdata, heightTex.data(), heightTex.size());
|
||||||
this->scale = dim / patchsize;
|
this->scale = dim / patchsize;
|
||||||
this->heightScale = heightScale;
|
this->heightScale = scale.y;
|
||||||
|
|
||||||
// Generate vertices
|
// Generate vertices
|
||||||
|
|
||||||
|
|
@ -106,9 +106,9 @@ namespace vkTools
|
||||||
for (uint32_t y = 0; y < patchsize; y++)
|
for (uint32_t y = 0; y < patchsize; y++)
|
||||||
{
|
{
|
||||||
uint32_t index = (x + y * patchsize);
|
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[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;
|
vertices[index].uv = glm::vec2((float)x / patchsize, (float)y / patchsize) * uvScale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue