Isle
Loading...
Searching...
No Matches
viewmanager.h
Go to the documentation of this file.
1#ifndef VIEWMANAGER_H
2#define VIEWMANAGER_H
3
4#include "decomp.h"
6#include "viewroi.h"
7
8#include <d3drm.h>
9
10// VTABLE: LEGO1 0x100dbd88
11// SIZE 0x1bc
17public:
21 enum Flags {
22 c_bit1 = 0x01,
23 c_bit2 = 0x02,
24 c_bit3 = 0x04,
25 c_bit4 = 0x08
26 };
27
34 ViewManager(Tgl::Renderer* pRenderer, Tgl::Group* scene, const OrientableROI* point_of_view);
35
39 virtual ~ViewManager();
40
45 void Remove(ViewROI* p_roi);
46
51 void RemoveAll(ViewROI* p_roi);
52
58 unsigned int IsBoundingBoxInFrustum(const BoundingBox& p_bounding_box);
59
65 void UpdateROIDetailBasedOnLOD(ViewROI* p_roi, int p_und);
66
72
77 void SetPOVSource(const OrientableROI* point_of_view);
78
84 float ProjectedSize(const BoundingSphere& p_bounding_sphere);
85
93 ViewROI* Pick(Tgl::View* p_view, unsigned long x, unsigned long y);
94
100 void SetResolution(int width, int height);
101
108 void SetFrustrum(float fov, float front, float back);
109
115 inline void ManageVisibilityAndDetailRecursively(ViewROI* p_roi, int p_und);
116
122 void Update(float p_previousRenderTime, float);
123
129
134
142 inline static int CalculateLODLevel(float p_und1, float p_und2, ViewROI* p_roi);
143
149 inline static int IsROIVisibleAtLOD(ViewROI* p_roi);
150
155 const CompoundObject& GetROIs() { return rois; }
156
161 void Add(ViewROI* p_roi) { rois.push_back(p_roi); }
162
163 // SYNTHETIC: LEGO1 0x100a6000
164 // ViewManager::`scalar deleting destructor'
165
166private:
167 Tgl::Group* scene;
168 CompoundObject rois;
169 RealtimeView rt_view;
170 ROIList visible_rois;
171 float prev_render_time;
172 float view_area_at_one;
173 unsigned int flags;
174 float width;
175 float height;
176 float view_angle;
177 MxMatrix pov;
178 float front;
179 float back;
180 float frustum_vertices[8][3];
181 float transformed_points[8][3];
182 float frustum_planes[6][4];
183 IDirect3DRM2* d3drm;
184 IDirect3DRMFrame2* frame;
185 float seconds_allowed;
186};
187
188// TEMPLATE: LEGO1 0x10022030
189// list<ROI *,allocator<ROI *> >::insert
190
191// TEMPLATE: LEGO1 0x100a6020
192// List<ROI *>::~List<ROI *>
193
194// TEMPLATE: LEGO1 0x100a6070
195// Vector<ROI const *>::~Vector<ROI const *>
196
197// TEMPLATE: LEGO1 0x100a6f80
198// vector<ROI const *,allocator<ROI const *> >::~vector<ROI const *,allocator<ROI const *> >
199
200#endif // VIEWMANAGER_H
[AI] Represents an axis-aligned bounding box in 3D space, using minimum and maximum points.
Definition: roi.h:20
[AI] Represents a bounding sphere in 3D space with center and radius.
Definition: roi.h:56
[AI] Represents a 4x4 transformation matrix, specialized for the LEGO Island engine and derived from ...
Definition: mxmatrix.h:16
[AI] Represents an ROI (Real-time Object Instance) that can be oriented in world space,...
Definition: orientableroi.h:29
[AI] Handles global view and level-of-detail (LOD) settings for real-time rendering.
Definition: realtimeview.h:14
[AI] Scene graph node for parental transforms/color/material/texture; can hold meshes or other groups...
Definition: tgl.h:669
[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
[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,...
Flags
[AI] Bit flags used internally by ViewManager to track various states or trigger needed calculations ...
Definition: viewmanager.h:21
@ 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...
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.
const CompoundObject & GetROIs()
[AI] Returns the internal CompoundObject list of all managed ViewROI objects for iteration or queries...
Definition: viewmanager.h:155
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 Add(ViewROI *p_roi)
[AI] Adds a ViewROI object to the list of managed ROI objects.
Definition: viewmanager.h:161
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
vector< const ROI * > ROIList
[AI] Typedef for a list of ROI pointers.
Definition: roi.h:144
list< ROI * > CompoundObject
Definition: roi.h:135