It
is useful to have a function that can return the height y of a point on the
plane specified by (x, z).
- Setting objects so that they are placed
on the ground
- Setting the camera so that it is always y
units above the ground
One
way to do this is to map between world coordinates [x, y, z] and the heightmap
image.
glm::vec3
MHeightMapTerrain::WorldToImageCoordinates(glm::vec3 p)
glm::vec3
MHeightMapTerrain::ImageToWorldCoordinates(glm::vec3 p)
Example
provided on
Moodle.