MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Samples / get_height

Method get_height

framework/heightmap.cpp:58–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58float HeightMap::get_height(const uint32_t x, const uint32_t y)
59{
60 glm::ivec2 rpos = glm::ivec2(x, y) * glm::ivec2(scale);
61 rpos.x = std::max(0, std::min(rpos.x, static_cast<int>(dim) - 1));
62 rpos.y = std::max(0, std::min(rpos.y, static_cast<int>(dim) - 1));
63 rpos /= glm::ivec2(scale);
64 return *(data + (rpos.x + rpos.y * dim) * scale) / 65535.0f;
65}
66} // namespace vkb

Callers 3

generate_terrainMethod · 0.80
generate_terrainMethod · 0.80
generate_terrainMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected