MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / constructCameraView

Function constructCameraView

test/algorithm/View.h:80–91  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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)
80inline 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

Callers 4

TEST_FFunction · 0.85
TEST_FFunction · 0.85
TEST_FFunction · 0.85
constructViewMethod · 0.85

Calls 4

calculateModelViewMatrixFunction · 0.85
getLengthMethod · 0.45
constructMethod · 0.45

Tested by

no test coverage detected