Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //I Higmap render
- if (0 < camera.getCameraPosition().x && camera.getCameraPosition().x < heightmap._image->width
- && 0 < camera.getCameraPosition().z && camera.getCameraPosition().z < heightmap._image->height)
- {
- if (camera.getCameraPosition().y - 1 < heightmap.getHeight((int)camera.getCameraPosition().x, (int)camera.getCameraPosition().z))
- {
- camera.newHeight(heightmap.getHeight((int)camera.getCameraPosition().x, (int)camera.getCameraPosition().z));
- }
- }
- //Imgu
- ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
- ImGui::Text("Camera Height %.3f", camera.getCameraPosition().y);
- if (0 < camera.getCameraPosition().x && camera.getCameraPosition().x < heightmap._image->width
- && 0 < camera.getCameraPosition().z && camera.getCameraPosition().z < heightmap._image->height)
- {
- ImGui::Text("Map Height %.3f", heightmap.getHeight((int)camera.getCameraPosition().x, (int)camera.getCameraPosition().z));
- }
- //Camera.cpp
- void Camera::newHeight(float floor)
- {
- this->position.y = floor + 1;
- this->view = glm::lookAt(
- this->position, //Camera location
- this->position + this->direction, //Camera looking towards origo
- this->up //y-axis is considered "up"
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement