Constructs the given view with a camera projection - with the view origin being located at three times the bounding box size away (following the view direction) - with the given view angles (pitch, yaw, roll)
| 78 | // - with the view origin being located at three times the bounding box size away (following the view direction) |
| 79 | // - with the given view angles (pitch, yaw, roll) |
| 80 | inline void constructCameraView(render::View& view, const AABB& objectAABB, const Vector3& viewDirection, const Vector3& angles) |
| 81 | { |
| 82 | // Position the camera top-down, similar to what an XY view is seeing |
| 83 | auto objectHeight = std::max(objectAABB.getExtents().getLength(), 20.0); // use a minimum height |
| 84 | Vector3 origin = objectAABB.getOrigin() - (viewDirection * objectHeight * 3); |
| 85 | |
| 86 | auto farClip = 32768.0f; |
| 87 | Matrix4 projection = camera::calculateProjectionMatrix(farClip / 4096.0f, farClip, 75.0f, algorithm::DeviceWidth, algorithm::DeviceHeight); |
| 88 | Matrix4 modelview = camera::calculateModelViewMatrix(origin, angles); |
| 89 | |
| 90 | view.construct(projection, modelview, algorithm::DeviceWidth, algorithm::DeviceHeight); |
| 91 | } |
| 92 | |
| 93 | } |
| 94 |
no test coverage detected