Isle
Loading...
Searching...
No Matches
viewmanager.cpp
Go to the documentation of this file.
1#include "viewmanager.h"
2
4#include "tgl/d3drm/impl.h"
5#include "viewlod.h"
6
7#include <vec.h>
8
10
11// GLOBAL: LEGO1 0x100dbc78
13 {{0, 0, 0}, {0, 0, 1}, {0, 1, 0}, {1, 0, 0}, {0, 1, 1}, {1, 0, 1}, {1, 1, 0}, {1, 1, 1}};
14
15// GLOBAL: LEGO1 0x100dbcd8
16int g_planePointIndexMap[18] = {0, 1, 5, 6, 2, 3, 3, 0, 4, 1, 2, 6, 0, 3, 2, 4, 5, 6};
17
18// GLOBAL: LEGO1 0x10101050
19float g_LODScaleFactor = 4.0F;
20
21// GLOBAL: LEGO1 0x10101054
22float g_minLODThreshold = 0.00097656297;
23
24// GLOBAL: LEGO1 0x10101058
26
27// GLOBAL: LEGO1 0x1010105c
28float g_unk0x1010105c = 0.000125F;
29
30// GLOBAL: LEGO1 0x10101060
32
33inline void SetAppData(ViewROI* p_roi, LPD3DRM_APPDATA data);
34inline undefined4 GetD3DRM(IDirect3DRM2*& d3drm, Tgl::Renderer* pRenderer);
35inline undefined4 GetFrame(IDirect3DRMFrame2*& frame, Tgl::Group* scene);
36
37// FUNCTION: LEGO1 0x100a5eb0
38ViewManager::ViewManager(Tgl::Renderer* pRenderer, Tgl::Group* scene, const OrientableROI* point_of_view)
39 : scene(scene), flags(c_bit1 | c_bit2 | c_bit3 | c_bit4)
40{
41 SetPOVSource(point_of_view);
42 prev_render_time = 0.09;
43 GetD3DRM(d3drm, pRenderer);
44 GetFrame(frame, scene);
45 width = 0.0;
46 height = 0.0;
47 view_angle = 0.0;
48 pov.SetIdentity();
49 front = 0.0;
50 back = 0.0;
51
52 memset(transformed_points, 0, sizeof(transformed_points));
53 seconds_allowed = 1.0;
54}
55
56// FUNCTION: LEGO1 0x100a60c0
58{
60}
61
62// FUNCTION: LEGO1 0x100a6150
63// FUNCTION: BETA10 0x10172164
64unsigned int ViewManager::IsBoundingBoxInFrustum(const BoundingBox& p_bounding_box)
65{
66 const Vector3* box[] = {&p_bounding_box.Min(), &p_bounding_box.Max()};
67
68 float und[8][3];
69 int i, j, k;
70
71 for (i = 0; i < 8; i++) {
72 for (j = 0; j < 3; j++) {
73 und[i][j] = box[g_boundingBoxCornerMap[i][j]]->operator[](j);
74 }
75 }
76
77 for (i = 0; i < 6; i++) {
78 for (k = 0; k < 8; k++) {
79 if (frustum_planes[i][0] * und[k][0] + frustum_planes[i][2] * und[k][2] + frustum_planes[i][1] * und[k][1] +
80 frustum_planes[i][3] >=
81 0.0f) {
82 break;
83 }
84 }
85
86 if (k == 8) {
87 return FALSE;
88 }
89 }
90
91 return TRUE;
92}
93
94// FUNCTION: LEGO1 0x100a6410
96{
97 for (CompoundObject::iterator it = rois.begin(); it != rois.end(); it++) {
98 if (*it == p_roi) {
99 rois.erase(it);
100
101 if (p_roi->GetUnknown0xe0() >= 0) {
103 }
104
105 const CompoundObject* comp = p_roi->GetComp();
106
107 if (comp != NULL) {
108 for (CompoundObject::const_iterator it = comp->begin(); !(it == comp->end()); it++) {
109 if (((ViewROI*) *it)->GetUnknown0xe0() >= 0) {
111 }
112 }
113 }
114
115 return;
116 }
117 }
118}
119
120// FUNCTION: LEGO1 0x100a64d0
122{
123 if (p_roi == NULL) {
124 for (CompoundObject::iterator it = rois.begin(); it != rois.end(); it++) {
125 RemoveAll((ViewROI*) *it);
126 }
127
128 rois.erase(rois.begin(), rois.end());
129 }
130 else {
131 if (p_roi->GetUnknown0xe0() >= 0) {
133 }
134
135 p_roi->SetUnknown0xe0(-1);
136 const CompoundObject* comp = p_roi->GetComp();
137
138 if (comp != NULL) {
139 for (CompoundObject::const_iterator it = comp->begin(); !(it == comp->end()); it++) {
140 if ((ViewROI*) *it != NULL) {
141 RemoveAll((ViewROI*) *it);
142 }
143 }
144 }
145 }
146}
147
148// FUNCTION: LEGO1 0x100a65b0
150{
151 if (p_roi->GetLODCount() <= p_und) {
152 p_und = p_roi->GetLODCount() - 1;
153 }
154
155 int unk0xe0 = p_roi->GetUnknown0xe0();
156
157 if (unk0xe0 == p_und) {
158 return;
159 }
160
161 Tgl::Group* group = p_roi->GetGeometry();
162 Tgl::MeshBuilder* meshBuilder;
163 ViewLOD* lod;
164
165 if (unk0xe0 < 0) {
166 lod = (ViewLOD*) p_roi->GetLOD(p_und);
167
168 if (lod->GetUnknown0x08() & ViewLOD::c_bit4) {
169 scene->Add((Tgl::MeshBuilder*) group);
170 SetAppData(p_roi, reinterpret_cast<LPD3DRM_APPDATA>(p_roi));
171 }
172 }
173 else {
174 lod = (ViewLOD*) p_roi->GetLOD(unk0xe0);
175
176 if (lod != NULL) {
177 meshBuilder = lod->GetMeshBuilder();
178
179 if (meshBuilder != NULL) {
180 group->Remove(meshBuilder);
181 }
182 }
183
184 lod = (ViewLOD*) p_roi->GetLOD(p_und);
185 }
186
187 if (lod->GetUnknown0x08() & ViewLOD::c_bit4) {
188 meshBuilder = lod->GetMeshBuilder();
189
190 if (meshBuilder != NULL) {
191 group->Add(meshBuilder);
192 SetAppData(p_roi, reinterpret_cast<LPD3DRM_APPDATA>(p_roi));
193 p_roi->SetUnknown0xe0(p_und);
194 return;
195 }
196 }
197
198 p_roi->SetUnknown0xe0(-1);
199}
200
201// FUNCTION: LEGO1 0x100a66a0
203{
204 const ViewLOD* lod = (const ViewLOD*) p_roi->GetLOD(p_roi->GetUnknown0xe0());
205
206 if (lod != NULL) {
207 const Tgl::MeshBuilder* meshBuilder = NULL;
208 Tgl::Group* roiGeometry = p_roi->GetGeometry();
209
210 meshBuilder = lod->GetMeshBuilder();
211
212 if (meshBuilder != NULL) {
213 roiGeometry->Remove(meshBuilder);
214 }
215
216 scene->Remove(roiGeometry);
217 }
218
219 p_roi->SetUnknown0xe0(-1);
220}
221
222// FUNCTION: LEGO1 0x100a66f0
224{
225 if (!p_roi->GetVisibility() && p_und != -2) {
227 }
228 else {
229 const CompoundObject* comp = p_roi->GetComp();
230
231 if (p_und == -1) {
232 if (p_roi->GetWorldBoundingSphere().Radius() > 0.001F) {
233 float und = ProjectedSize(p_roi->GetWorldBoundingSphere());
234
235 if (und < seconds_allowed * g_unk0x1010105c) {
236 if (p_roi->GetUnknown0xe0() == -2) {
237 return;
238 }
239
241 return;
242 }
243
244 p_und = CalculateLODLevel(und, RealtimeView::GetUserMaxLodPower() * seconds_allowed, p_roi);
245 }
246 }
247
248 if (p_und == -2) {
249 if (p_roi->GetUnknown0xe0() >= 0) {
251 p_roi->SetUnknown0xe0(-2);
252 }
253
254 if (comp != NULL) {
255 for (CompoundObject::const_iterator it = comp->begin(); !(it == comp->end()); it++) {
257 }
258 }
259 }
260 else if (comp == NULL) {
261 if (p_roi->GetLODs() != NULL && p_roi->GetLODCount() > 0) {
262 UpdateROIDetailBasedOnLOD(p_roi, p_und);
263 return;
264 }
265 }
266 else {
267 p_roi->SetUnknown0xe0(-1);
268
269 for (CompoundObject::const_iterator it = comp->begin(); !(it == comp->end()); it++) {
271 }
272 }
273 }
274}
275
276// FUNCTION: LEGO1 0x100a6930
277void ViewManager::Update(float p_previousRenderTime, float)
278{
279 MxStopWatch stopWatch;
280 stopWatch.Start();
281
282 prev_render_time = p_previousRenderTime;
283 flags |= c_bit1;
284
285 if (flags & c_bit3) {
287 }
288 else if (flags & c_bit2) {
290 }
291
292 for (CompoundObject::iterator it = rois.begin(); it != rois.end(); it++) {
294 }
295
296 stopWatch.Stop();
297 g_elapsedSeconds = stopWatch.ElapsedSeconds();
298}
299
301{
302 flags &= ~c_bit3;
303
304 if (height == 0.0F || front == 0.0F) {
305 return -1;
306 }
307 else {
308 float fVar7 = tan(view_angle / 2.0F);
309 view_area_at_one = view_angle * view_angle * 4.0F;
310
311 float fVar1 = front * fVar7;
312 float fVar2 = (width / height) * fVar1;
313 float uVar6 = front;
314 float fVar3 = back + front;
315 float fVar4 = fVar3 / front;
316 float fVar5 = fVar4 * fVar1;
317 fVar4 = fVar4 * fVar2;
318
319 float* frustumVertices = (float*) this->frustum_vertices;
320
321 // clang-format off
322 *frustumVertices = fVar2; frustumVertices++;
323 *frustumVertices = fVar1; frustumVertices++;
324 *frustumVertices = uVar6; frustumVertices++;
325 *frustumVertices = fVar2; frustumVertices++;
326 *frustumVertices = -fVar1; frustumVertices++;
327 *frustumVertices = uVar6; frustumVertices++;
328 *frustumVertices = -fVar2; frustumVertices++;
329 *frustumVertices = -fVar1; frustumVertices++;
330 *frustumVertices = uVar6; frustumVertices++;
331 *frustumVertices = -fVar2; frustumVertices++;
332 *frustumVertices = fVar1; frustumVertices++;
333 *frustumVertices = uVar6; frustumVertices++;
334 *frustumVertices = fVar4; frustumVertices++;
335 *frustumVertices = fVar5; frustumVertices++;
336 *frustumVertices = fVar3; frustumVertices++;
337 *frustumVertices = fVar4; frustumVertices++;
338 *frustumVertices = -fVar5; frustumVertices++;
339 *frustumVertices = fVar3; frustumVertices++;
340 *frustumVertices = -fVar4; frustumVertices++;
341 *frustumVertices = -fVar5; frustumVertices++;
342 *frustumVertices = fVar3; frustumVertices++;
343 *frustumVertices = -fVar4; frustumVertices++;
344 *frustumVertices = fVar5; frustumVertices++;
345 *frustumVertices = fVar3;
346 // clang-format on
347
349 return 0;
350 }
351}
352
353inline int ViewManager::CalculateLODLevel(float p_und1, float p_und2, ViewROI* p_roi)
354{
355 int result;
356 float i;
357
358 if (IsROIVisibleAtLOD(p_roi) != 0) {
359 if (p_und1 < g_minLODThreshold) {
360 return 0;
361 }
362
363 result = 1;
364 }
365 else {
366 result = 0;
367 }
368
369 for (i = p_und2; result < g_maxLODLevels && p_und1 >= i; i *= g_LODScaleFactor) {
370 result++;
371 }
372
373 return result;
374}
375
377{
378 const LODListBase* lods = p_roi->GetLODs();
379
380 if (lods != NULL && lods->Size() > 0) {
381 if (((ViewLOD*) p_roi->GetLOD(0))->GetUnknown0x08Test8()) {
382 return 1;
383 }
384
385 return 0;
386 }
387
388 const CompoundObject* comp = p_roi->GetComp();
389
390 if (comp != NULL) {
391 for (CompoundObject::const_iterator it = comp->begin(); !(it == comp->end()); it++) {
392 const LODListBase* lods = ((ViewROI*) *it)->GetLODs();
393
394 if (lods != NULL && lods->Size() > 0) {
395 if (((ViewLOD*) ((ViewROI*) *it)->GetLOD(0))->GetUnknown0x08Test8()) {
396 return 1;
397 }
398
399 return 0;
400 }
401 }
402 }
403
404 return 0;
405}
406
407// FUNCTION: LEGO1 0x100a6b90
409{
410 flags &= ~c_bit2;
411
412 int i, j, k;
413
414 for (i = 0; i < 8; i++) {
415 for (j = 0; j < 3; j++) {
416 transformed_points[i][j] = pov[3][j];
417
418 for (k = 0; k < 3; k++) {
419 transformed_points[i][j] += pov[k][j] * frustum_vertices[i][k];
420 }
421 }
422 }
423
424 for (i = 0; i < 6; i++) {
425 Vector3 a(transformed_points[g_planePointIndexMap[i * 3]]);
426 Vector3 b(transformed_points[g_planePointIndexMap[i * 3 + 1]]);
427 Vector3 c(transformed_points[g_planePointIndexMap[i * 3 + 2]]);
430 Vector3 normal(frustum_planes[i]);
431
432 x = c;
433 x -= b;
434
435 y = a;
436 y -= b;
437
438 normal.EqualsCross(x, y);
439 normal.Unitize();
440
441 frustum_planes[i][3] = -normal.Dot(normal, a);
442 }
443
444 flags |= c_bit4;
445}
446
447// FUNCTION: LEGO1 0x100a6d50
448void ViewManager::SetResolution(int width, int height)
449{
450 flags |= c_bit3;
451 this->width = width;
452 this->height = height;
453}
454
455// FUNCTION: LEGO1 0x100a6d70
456void ViewManager::SetFrustrum(float fov, float front, float back)
457{
458 this->front = front;
459 this->back = back;
460 flags |= c_bit3;
461 view_angle = fov * 0.017453292519944444;
462}
463
464// FUNCTION: LEGO1 0x100a6da0
465void ViewManager::SetPOVSource(const OrientableROI* point_of_view)
466{
467 if (point_of_view != NULL) {
468 pov = point_of_view->GetLocal2World();
469 flags |= c_bit2;
470 }
471}
472
473// FUNCTION: LEGO1 0x100a6dc0
474// FUNCTION: BETA10 0x101739b8
475float ViewManager::ProjectedSize(const BoundingSphere& p_bounding_sphere)
476{
477 // The algorithm projects the radius of bounding sphere onto the perpendicular
478 // plane one unit in front of the camera. That value is simply the ratio of the
479 // radius to the distance from the camera to the sphere center. The projected size
480 // is then the ratio of the area of that projected circle to the view surface area
481 // at Z == 1.0.
482 //
483 float sphere_projected_area = 3.14159265359 * (p_bounding_sphere.Radius() * p_bounding_sphere.Radius());
484 float square_dist_to_sphere = DISTSQRD3(p_bounding_sphere.Center(), pov[3]);
485 return sphere_projected_area / view_area_at_one / square_dist_to_sphere;
486}
487
488// FUNCTION: LEGO1 0x100a6e00
489ViewROI* ViewManager::Pick(Tgl::View* p_view, unsigned long x, unsigned long y)
490{
491 LPDIRECT3DRMPICKEDARRAY picked = NULL;
492 ViewROI* result = NULL;
493 TglImpl::ViewImpl* view = (TglImpl::ViewImpl*) p_view;
494 IDirect3DRMViewport* d3drm = view->ImplementationData();
495
496 if (d3drm->Pick(x, y, &picked) != D3DRM_OK) {
497 return NULL;
498 }
499
500 if (picked != NULL) {
501 if (picked->GetSize() != 0) {
502 LPDIRECT3DRMVISUAL visual;
503 LPDIRECT3DRMFRAMEARRAY frameArray;
504 D3DRMPICKDESC desc;
505
506 if (picked->GetPick(0, &visual, &frameArray, &desc) == D3DRM_OK) {
507 if (frameArray != NULL) {
508 int size = frameArray->GetSize();
509
510 if (size > 1) {
511 for (int i = 1; i < size; i++) {
512 LPDIRECT3DRMFRAME frame = NULL;
513
514 if (frameArray->GetElement(i, &frame) == D3DRM_OK) {
515 result = (ViewROI*) frame->GetAppData();
516
517 if (result != NULL) {
518 frame->Release();
519 break;
520 }
521
522 frame->Release();
523 }
524 }
525 }
526
527 visual->Release();
528 frameArray->Release();
529 }
530 }
531 }
532
533 picked->Release();
534 }
535
536 return result;
537}
538
539inline void SetAppData(ViewROI* p_roi, LPD3DRM_APPDATA data)
540{
541 IDirect3DRMFrame2* frame = NULL;
542
543 if (GetFrame(frame, p_roi->GetGeometry()) == 0) {
544 frame->SetAppData(data);
545 }
546}
547
548inline undefined4 GetD3DRM(IDirect3DRM2*& d3drm, Tgl::Renderer* pRenderer)
549{
550 d3drm = ((TglImpl::RendererImpl*) pRenderer)->ImplementationData();
551 return 0;
552}
553
554inline undefined4 GetFrame(IDirect3DRMFrame2*& frame, Tgl::Group* scene)
555{
556 frame = ((TglImpl::GroupImpl*) scene)->ImplementationData();
557 return 0;
558}
[AI] Represents an axis-aligned bounding box in 3D space, using minimum and maximum points.
Definition: roi.h:20
const Vector3 & Min() const
[AI] Const accessor for the minimum corner of the bounding box.
Definition: roi.h:26
const Vector3 & Max() const
[AI] Const accessor for the maximum corner of the bounding box.
Definition: roi.h:36
[AI] Represents a bounding sphere in 3D space with center and radius.
Definition: roi.h:56
const float & Radius() const
[AI] Const accessor for the sphere radius.
Definition: roi.h:72
const Vector3 & Center() const
[AI] Const accessor for the center of the sphere.
Definition: roi.h:62
[AI] Abstract base class for an ordered list of LODObject pointers, where each entry represents an in...
Definition: lodlist.h:31
size_t Size() const
[AI] Returns the current number of LODObject pointers contained.
Definition: lodlist.h:165
virtual void SetIdentity()
Sets this matrix to identity (diagonal 1, others 0).
[AI] Represents a 3D point with floating-point precision, inheriting from Vector3.
Definition: mxgeometry3d.h:14
Measures elapsed wall clock time using high resolution performance counters.
Definition: mxstopwatch.h:25
void Stop()
Stops timing and accumulates the elapsed interval to m_elapsedSeconds.
double ElapsedSeconds() const
Returns the total accumulated elapsed time in seconds.
void Start()
Starts (or resumes) timing from the current moment.
[AI] Represents an ROI (Real-time Object Instance) that can be oriented in world space,...
Definition: orientableroi.h:29
const BoundingSphere & GetWorldBoundingSphere() const override
Returns the object's bounding sphere in world coordinates.
const Matrix4 & GetLocal2World() const
Accessor for the current local-to-world transformation matrix.
unsigned char GetVisibility()
[AI] Returns the visibility flag; true if visible, false if hidden.
Definition: roi.h:228
const CompoundObject * GetComp() const
[AI] Returns the pointer to the compound object structure, or NULL if not present.
Definition: roi.h:222
int GetLODCount() const
[AI] Returns the number of available LODs for this ROI.
Definition: roi.h:216
const LODListBase * GetLODs() const
[AI] Returns the LOD list associated with this ROI, or NULL if not set.
Definition: roi.h:203
const LODObject * GetLOD(int i) const
[AI] Returns the LODObject at the specified index.
Definition: roi.h:208
static float GetUserMaxLodPower()
[AI] Returns the cached LOD power, used for faster LOD checks in rendering.
Definition: realtimeview.h:62
[AI] Implementation of Tgl::Group, wraps a Direct3DRMFrame2 and provides scene graph and transformati...
Definition: impl.h:944
[AI] Implements Tgl::MeshBuilder; facilitates mesh construction [AI]
Definition: impl.h:55
[AI] Implementation of Tgl::View backed by Direct3DRMViewport, handles scene rendering,...
Definition: impl.h:449
const ViewDataType & ImplementationData() const
Gets internal viewport pointer, const [AI].
Definition: impl.h:571
[AI] Scene graph node for parental transforms/color/material/texture; can hold meshes or other groups...
Definition: tgl.h:669
virtual Result Remove(const Group *)=0
[AI] Removes a child group from this group.
virtual Result Add(const Group *)=0
[AI] Adds a child group to this group.
[AI] Builder class for assembling mesh data and extracting mesh objects.
Definition: tgl.h:768
[AI] Main interface/factory for rendering resources and scene graphs.
Definition: tgl.h:188
[AI] Represents a rendering viewport and drawing context.
Definition: tgl.h:397
virtual float Dot(const float *p_a, const float *p_b) const
[AI] Compute the dot product of the two float arrays interpreted as vectors of 2 elements.
virtual int Unitize()
[AI] Scales the vector so its norm is 1 (unit vector).
[AI] 3D vector class, providing vector and cross-product operations in 3D space.
Definition: vector.h:249
virtual void EqualsCross(const Vector3 &p_a, const Vector3 &p_b)
[AI] Sets this vector to be the cross product of p_a and p_b.
[AI] Represents a Level of Detail (LOD) object for rendering, implemented with a mesh builder and sup...
Definition: viewlod.h:20
@ c_bit4
[AI] Flag value for bit 4 mask operation.
Definition: viewlod.h:23
undefined4 GetUnknown0x08()
[AI] Returns the internal flag value m_unk0x08.
Definition: viewlod.h:67
Tgl::MeshBuilder * GetMeshBuilder()
[AI] Returns a pointer to the mesh builder associated with this LOD.
Definition: viewlod.h:55
[AI] Manages all ViewROI objects that are rendered in a given scene, handles frustum culling,...
Definition: viewmanager.h:16
void SetFrustrum(float fov, float front, float back)
[AI] Sets the projection frustum parameters and marks the frustum as needing recalculation.
void SetPOVSource(const OrientableROI *point_of_view)
[AI] Sets the OrientableROI to use as the camera's point-of-view; updates the transformation matrix a...
void ManageVisibilityAndDetailRecursively(ViewROI *p_roi, int p_und)
[AI] Recursively traverses and updates the visibility and LOD detail of a ROI and its children,...
@ c_bit1
[AI] Used to signals a pending operation (exact purpose is contextually flagged during update routine...
Definition: viewmanager.h:22
@ c_bit4
[AI] Signals that the frustum parameters/planes are valid and up to date.
Definition: viewmanager.h:25
@ c_bit2
[AI] Indicates the need to update view transformation matrices.
Definition: viewmanager.h:23
@ c_bit3
[AI] Indicates the need to recalculate frustum parameters (e.g., due to a resolution or frustum chang...
Definition: viewmanager.h:24
ViewROI * Pick(Tgl::View *p_view, unsigned long x, unsigned long y)
[AI] Using a screen coordinate and viewport, finds the ViewROI (if any) under the given coordinates b...
void Update(float p_previousRenderTime, float)
[AI] Performs the per-frame update: applies frustum/view updates if needed and recurses the ROI graph...
ViewManager(Tgl::Renderer *pRenderer, Tgl::Group *scene, const OrientableROI *point_of_view)
[AI] Constructs the ViewManager with the renderer, scene group, and initial point-of-view.
Definition: viewmanager.cpp:38
unsigned int IsBoundingBoxInFrustum(const BoundingBox &p_bounding_box)
[AI] Determines if a bounding box is (partially) inside the camera's view frustum using frustum-plane...
Definition: viewmanager.cpp:64
void SetResolution(int width, int height)
[AI] Sets the viewport resolution and marks the frustum as needing recalculation.
static int CalculateLODLevel(float p_und1, float p_und2, ViewROI *p_roi)
[AI] Determines the LOD level index for a ROI based on projected size and user-defined/scene paramete...
void Remove(ViewROI *p_roi)
[AI] Removes a single ViewROI from the managed ROI list, also detaching any associated LOD data from ...
Definition: viewmanager.cpp:95
void UpdateROIDetailBasedOnLOD(ViewROI *p_roi, int p_und)
[AI] Based on computed LOD, updates the scene to show the correct mesh for a given ROI,...
static int IsROIVisibleAtLOD(ViewROI *p_roi)
[AI] Checks whether the given ROI should be considered visible at any LOD, including compound sub-ROI...
void RemoveROIDetailFromScene(ViewROI *p_roi)
[AI] Removes the currently active LOD detail from the rendering scene for the given ROI and detaches ...
void UpdateViewTransformations()
[AI] Updates the transformation matrices using the current POV and frustum edges, recalculating plane...
float ProjectedSize(const BoundingSphere &p_bounding_sphere)
[AI] Computes the projected area of a bounding sphere onto the camera's viewing plane (used for LOD c...
virtual ~ViewManager()
[AI] Destroys the ViewManager including detaching the current POV source and releasing Direct3DRM obj...
Definition: viewmanager.cpp:57
void RemoveAll(ViewROI *p_roi)
[AI] Recursively removes all ViewROI objects.
int CalculateFrustumTransformations()
[AI] Computes frustum planes and transformed corner positions for the current camera/view,...
[AI] ViewROI objects represent viewable and placeable objects in the scene, each holding their own tr...
Definition: viewroi.h:13
int GetUnknown0xe0()
[AI] Gets the value of an internal state field at offset 0xe0.
Definition: viewroi.h:108
void SetUnknown0xe0(int p_unk0xe0)
[AI] Sets the value of the internal state field at offset 0xe0.
Definition: viewroi.h:114
virtual Tgl::Group * GetGeometry()
[AI] Returns a pointer to this ROI's Tgl::Group geometry for rendering and manipulation.
Definition: viewroi.cpp:19
#define D3DRM_OK
Definition: d3drm.h:197
#define TRUE
Definition: d3drmdef.h:28
#define FALSE
Definition: d3drmdef.h:27
#define DECOMP_SIZE_ASSERT(T, S)
Definition: decomp.h:19
unsigned int undefined4
Definition: decomp.h:28
LPVOID LPD3DRM_APPDATA
[AI] Application data type varies by DirectX version [AI]
Definition: impl.h:10
IDirect3DRM2 * GetD3DRM(Tgl::Renderer *pRenderer)
Definition: legolod.cpp:405
#define NULL
[AI] Null pointer value (C/C++ semantics).
Definition: legotypes.h:26
list< ROI * > CompoundObject
Definition: roi.h:135
#define DISTSQRD3(v, w)
Definition: vec.h:478
int g_planePointIndexMap[18]
Definition: viewmanager.cpp:16
float g_unk0x1010105c
Definition: viewmanager.cpp:28
undefined4 GetFrame(IDirect3DRMFrame2 *&frame, Tgl::Group *scene)
int g_boundingBoxCornerMap[8][3]
Definition: viewmanager.cpp:12
float g_minLODThreshold
Definition: viewmanager.cpp:22
void SetAppData(ViewROI *p_roi, LPD3DRM_APPDATA data)
float g_LODScaleFactor
Definition: viewmanager.cpp:19
int g_maxLODLevels
Definition: viewmanager.cpp:25
float g_elapsedSeconds
Definition: viewmanager.cpp:31
undefined4 GetD3DRM(IDirect3DRM2 *&d3drm, Tgl::Renderer *pRenderer)