Transform from world coordinates to screen coordinates
| 316 | |
| 317 | // Transform from world coordinates to screen coordinates |
| 318 | vec3 Camera::worldToScreen(const vec3 point) const { |
| 319 | glm::vec3 window_pos = glm::project(glm::vec3(point.x(), point.y(), point.z()), |
| 320 | glm::make_mat4(modelview_matrix), |
| 321 | glm::make_mat4(projection_matrix), |
| 322 | glm::make_vec4(viewport)); |
| 323 | |
| 324 | vec3 window; |
| 325 | window.x() = window_pos.x; |
| 326 | window.y() = window_pos.y; |
| 327 | window.z() = window_pos.z; |
| 328 | |
| 329 | return window; |
| 330 | } |
| 331 | |
| 332 | float GetAspectRatio() { |
| 333 | Graphics* gi = Graphics::Instance(); |