MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / DiagBBox

Function DiagBBox

engine/Poseidon/World/Scene/ObjectIntersect.cpp:69–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69static void DiagBBox(const Vector3* minMax, const Frame& pos, PackedColor color)
70{
71 LODShapeWithShadow* shape = GScene->Preloaded(SphereModel);
72
73 for (int lr = 0; lr < 2; lr++)
74 {
75 for (int ud = 0; ud < 2; ud++)
76 {
77 for (int fb = 0; fb < 2; fb++)
78 {
79 Vector3 wCorner = MinMaxCorner(minMax, lr, ud, fb);
80 Ref<Object> obj = new ObjectColored(shape, -1);
81 obj->SetPosition(pos.PositionModelToWorld(wCorner));
82 obj->SetScale(0.1);
83 obj->SetConstantColor(color);
84 GLandscape->ShowObject(obj);
85 }
86 }
87 }
88
89 // draw 12 lines
90 static const int lines[12][2][3] = {
91 {{0, 0, 0}, {0, 0, 1}}, // diff in Z
92 {{0, 1, 0}, {0, 1, 1}}, {{1, 0, 0}, {1, 0, 1}}, {{1, 1, 0}, {1, 1, 1}},
93
94 {{0, 0, 0}, {0, 1, 0}}, // diff in Y
95 {{0, 0, 1}, {0, 1, 1}}, {{1, 0, 0}, {1, 1, 0}}, {{1, 0, 1}, {1, 1, 1}},
96
97 {{0, 0, 0}, {1, 0, 0}}, // diff in X
98 {{0, 0, 1}, {1, 0, 1}}, {{0, 1, 0}, {1, 1, 0}}, {{0, 1, 1}, {1, 1, 1}},
99 };
100 for (int l = 0; l < 12; l++)
101 {
102 // get from
103 Vector3 from = MinMaxCorner(minMax, lines[l][0][0], lines[l][0][1], lines[l][0][2]);
104 Vector3 to = MinMaxCorner(minMax, lines[l][1][0], lines[l][1][1], lines[l][1][2]);
105 Ref<Object> obj = DrawDiagLine(pos.PositionModelToWorld(from), pos.PositionModelToWorld(to), color);
106 GLandscape->ShowObject(obj);
107 }
108}
109
110static bool IntersectBBox(Vector3* isect, const Vector3 tMinMax[2], const Vector3 wMinMax[2], const Matrix4& withToThis)
111{

Callers 1

IntersectMethod · 0.85

Calls 8

DrawDiagLineFunction · 0.85
PositionModelToWorldMethod · 0.80
ShowObjectMethod · 0.80
MinMaxCornerFunction · 0.70
PreloadedMethod · 0.45
SetPositionMethod · 0.45
SetScaleMethod · 0.45
SetConstantColorMethod · 0.45

Tested by

no test coverage detected