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

Function constructCenteredOrthoview

test/algorithm/View.h:18–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16constexpr const char* const RKEY_SELECT_EPSILON = "user/ui/selectionEpsilon";
17
18inline void constructCenteredOrthoview(render::View& view, const Vector3& origin)
19{
20 // Move the orthoview exactly to the center of this object
21 double scale = 1.0;
22
23 Matrix4 projection;
24
25 projection[0] = 1.0 / static_cast<double>(DeviceWidth / 2);
26 projection[5] = 1.0 / static_cast<double>(DeviceHeight / 2);
27 projection[10] = 1.0 / (32768 * scale);
28
29 projection[12] = 0.0;
30 projection[13] = 0.0;
31 projection[14] = -1.0;
32
33 projection[1] = projection[2] = projection[3] =
34 projection[4] = projection[6] = projection[7] =
35 projection[8] = projection[9] = projection[11] = 0.0;
36
37 projection[15] = 1.0f;
38
39 // Modelview
40 Matrix4 modelView;
41
42 // Translate the view to the center of the brush
43 modelView[12] = -origin.x() * scale;
44 modelView[13] = -origin.y() * scale;
45 modelView[14] = 32768 * scale;
46
47 // axis base
48 modelView[0] = scale;
49 modelView[1] = 0;
50 modelView[2] = 0;
51
52 modelView[4] = 0;
53 modelView[5] = scale;
54 modelView[6] = 0;
55
56 modelView[8] = 0;
57 modelView[9] = 0;
58 modelView[10] = -scale;
59
60 modelView[3] = modelView[7] = modelView[11] = 0;
61 modelView[15] = 1;
62
63 view.construct(projection, modelView, DeviceWidth, DeviceHeight);
64}
65
66inline SelectionVolume constructOrthoviewSelectionTest(const render::View& orthoView)
67{

Callers 6

selectLightPlaneAt320Function · 0.85
TEST_FFunction · 0.85
constructViewMethod · 0.85
performDragOperationFunction · 0.85

Calls 3

xMethod · 0.80
yMethod · 0.80
constructMethod · 0.45

Tested by

no test coverage detected