Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- glm::vec3 Landscape::calculateNormal(const glm::vec2& position)
- {
- float height_l = getHeightAtXZ(glm::dvec2(position.x - 1, position.y));
- float height_r = getHeightAtXZ(glm::dvec2(position.x + 1, position.y));
- float height_d = getHeightAtXZ(glm::dvec2(position.x, position.y + 1));
- float height_u = getHeightAtXZ(glm::dvec2(position.x, position.y - 1));
- return glm::normalize(glm::dvec3(height_l - height_r, 0.1f, height_d - height_u));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement