| 56 | } |
| 57 | |
| 58 | float 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 |
no outgoing calls
no test coverage detected