Isle
|
[AI] Manages all ViewROI objects that are rendered in a given scene, handles frustum culling, LOD management, and visibility determination for 3D ROI objects. More...
#include <viewmanager.h>
Public Types | |
enum | Flags { c_bit1 = 0x01 , c_bit2 = 0x02 , c_bit3 = 0x04 , c_bit4 = 0x08 } |
[AI] Bit flags used internally by ViewManager to track various states or trigger needed calculations (such as view or frustum updates). More... | |
Public Member Functions | |
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. More... | |
virtual | ~ViewManager () |
[AI] Destroys the ViewManager including detaching the current POV source and releasing Direct3DRM objects. More... | |
void | Remove (ViewROI *p_roi) |
[AI] Removes a single ViewROI from the managed ROI list, also detaching any associated LOD data from the scene and handling recursively any compound child ROIs. More... | |
void | RemoveAll (ViewROI *p_roi) |
[AI] Recursively removes all ViewROI objects. More... | |
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 testing. More... | |
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, removing or replacing representations as required. More... | |
void | RemoveROIDetailFromScene (ViewROI *p_roi) |
[AI] Removes the currently active LOD detail from the rendering scene for the given ROI and detaches it from the top-level scene group. More... | |
void | SetPOVSource (const OrientableROI *point_of_view) |
[AI] Sets the OrientableROI to use as the camera's point-of-view; updates the transformation matrix accordingly. More... | |
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 calculation). More... | |
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 by querying Direct3DRM's pick pipeline. More... | |
void | SetResolution (int width, int height) |
[AI] Sets the viewport resolution and marks the frustum as needing recalculation. More... | |
void | SetFrustrum (float fov, float front, float back) |
[AI] Sets the projection frustum parameters and marks the frustum as needing recalculation. More... | |
void | ManageVisibilityAndDetailRecursively (ViewROI *p_roi, int p_und) |
[AI] Recursively traverses and updates the visibility and LOD detail of a ROI and its children, based on projected size and thresholds. More... | |
void | Update (float p_previousRenderTime, float) |
[AI] Performs the per-frame update: applies frustum/view updates if needed and recurses the ROI graph for visibility/LOD/detail management. More... | |
int | CalculateFrustumTransformations () |
[AI] Computes frustum planes and transformed corner positions for the current camera/view, updating internal matrices. More... | |
void | UpdateViewTransformations () |
[AI] Updates the transformation matrices using the current POV and frustum edges, recalculating plane normals and D terms for culling. More... | |
const CompoundObject & | GetROIs () |
[AI] Returns the internal CompoundObject list of all managed ViewROI objects for iteration or queries. More... | |
void | Add (ViewROI *p_roi) |
[AI] Adds a ViewROI object to the list of managed ROI objects. More... | |
Static Public Member Functions | |
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 parameters. More... | |
static int | IsROIVisibleAtLOD (ViewROI *p_roi) |
[AI] Checks whether the given ROI should be considered visible at any LOD, including compound sub-ROIs. More... | |
[AI] Manages all ViewROI objects that are rendered in a given scene, handles frustum culling, LOD management, and visibility determination for 3D ROI objects.
Coordinates detail level based on view parameters and maintains view transformation matrices for efficient rendering.
[AI] ViewManager is responsible for controlling the rendering of all 3D real-time object instances (ROIs) in the current scene. It maintains a collection of ViewROI objects, calculates visibility based on the camera's frustum, manages geometric detail levels according to projected object size and LOD thresholds, and applies transformations for the scene's camera (point-of-view) parameters. It provides utility for picking ROI objects using screen coordinates and is tightly bound to the Direct3DRM retained mode pipeline.
Definition at line 16 of file viewmanager.h.
enum ViewManager::Flags |
[AI] Bit flags used internally by ViewManager to track various states or trigger needed calculations (such as view or frustum updates).
Definition at line 21 of file viewmanager.h.
ViewManager::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.
Initializes transformation matrices and internal state.
pRenderer | [AI] Pointer to the renderer (Direct3DRM abstraction) to use for view operations. |
scene | [AI] The top-level scene group for geometry association and manipulation. |
point_of_view | [AI] The initial camera reference used for setting up the view transformation. |
Definition at line 38 of file viewmanager.cpp.
|
virtual |
[AI] Destroys the ViewManager including detaching the current POV source and releasing Direct3DRM objects.
Definition at line 57 of file viewmanager.cpp.
|
inline |
[AI] Adds a ViewROI object to the list of managed ROI objects.
p_roi | [AI] The ROI to add. |
Definition at line 161 of file viewmanager.h.
|
inline |
[AI] Computes frustum planes and transformed corner positions for the current camera/view, updating internal matrices.
Definition at line 300 of file viewmanager.cpp.
|
inlinestatic |
[AI] Determines the LOD level index for a ROI based on projected size and user-defined/scene parameters.
p_und1 | [AI] Projected size value. |
p_und2 | [AI] LOD threshold. |
p_roi | [AI] Target ROI. |
Definition at line 353 of file viewmanager.cpp.
|
inline |
[AI] Returns the internal CompoundObject list of all managed ViewROI objects for iteration or queries.
Definition at line 155 of file viewmanager.h.
unsigned int ViewManager::IsBoundingBoxInFrustum | ( | const BoundingBox & | p_bounding_box | ) |
[AI] Determines if a bounding box is (partially) inside the camera's view frustum using frustum-plane testing.
p_bounding_box | [AI] Axis-aligned bounding box to test. |
Definition at line 64 of file viewmanager.cpp.
|
inlinestatic |
[AI] Checks whether the given ROI should be considered visible at any LOD, including compound sub-ROIs.
p_roi | [AI] The object to check. |
Definition at line 376 of file viewmanager.cpp.
|
inline |
[AI] Recursively traverses and updates the visibility and LOD detail of a ROI and its children, based on projected size and thresholds.
p_roi | [AI] The starting ROI for recursive update. |
p_und | [AI] LOD index, or -1 to auto-calculate, or -2 to hide. |
Definition at line 223 of file viewmanager.cpp.
[AI] Using a screen coordinate and viewport, finds the ViewROI (if any) under the given coordinates by querying Direct3DRM's pick pipeline.
p_view | [AI] Pointer to the Tgl view (Direct3DRM viewport abstraction). |
x | [AI] Screen-space X coordinate. |
y | [AI] Screen-space Y coordinate. |
Definition at line 489 of file viewmanager.cpp.
float ViewManager::ProjectedSize | ( | const BoundingSphere & | p_bounding_sphere | ) |
[AI] Computes the projected area of a bounding sphere onto the camera's viewing plane (used for LOD calculation).
p_bounding_sphere | [AI] The bounding sphere to project. |
Definition at line 475 of file viewmanager.cpp.
void ViewManager::Remove | ( | ViewROI * | p_roi | ) |
[AI] Removes a single ViewROI from the managed ROI list, also detaching any associated LOD data from the scene and handling recursively any compound child ROIs.
p_roi | [AI] The ViewROI instance to remove. |
Definition at line 95 of file viewmanager.cpp.
void ViewManager::RemoveAll | ( | ViewROI * | p_roi | ) |
[AI] Recursively removes all ViewROI objects.
If called with NULL, purges all managed ROI objects in the scene.
p_roi | [AI] If NULL, removes all; otherwise recursively removes the given ROI and children. |
Definition at line 121 of file viewmanager.cpp.
void ViewManager::RemoveROIDetailFromScene | ( | ViewROI * | p_roi | ) |
[AI] Removes the currently active LOD detail from the rendering scene for the given ROI and detaches it from the top-level scene group.
p_roi | [AI] The target ROI. |
Definition at line 202 of file viewmanager.cpp.
void ViewManager::SetFrustrum | ( | float | fov, |
float | front, | ||
float | back | ||
) |
[AI] Sets the projection frustum parameters and marks the frustum as needing recalculation.
fov | [AI] Field of view in degrees. |
front | [AI] Near plane Z position. |
back | [AI] Far plane Z position. |
Definition at line 456 of file viewmanager.cpp.
void ViewManager::SetPOVSource | ( | const OrientableROI * | point_of_view | ) |
[AI] Sets the OrientableROI to use as the camera's point-of-view; updates the transformation matrix accordingly.
point_of_view | [AI] The OrientableROI representing the camera. |
Definition at line 465 of file viewmanager.cpp.
void ViewManager::SetResolution | ( | int | width, |
int | height | ||
) |
[AI] Sets the viewport resolution and marks the frustum as needing recalculation.
width | [AI] The width of the view area in pixels. |
height | [AI] The height of the view area in pixels. |
Definition at line 448 of file viewmanager.cpp.
void ViewManager::Update | ( | float | p_previousRenderTime, |
float | |||
) |
[AI] Performs the per-frame update: applies frustum/view updates if needed and recurses the ROI graph for visibility/LOD/detail management.
p_previousRenderTime | [AI] Time mark of the previous render. |
[unused] | [AI] Unused parameter. |
Definition at line 277 of file viewmanager.cpp.
void ViewManager::UpdateROIDetailBasedOnLOD | ( | ViewROI * | p_roi, |
int | p_und | ||
) |
[AI] Based on computed LOD, updates the scene to show the correct mesh for a given ROI, removing or replacing representations as required.
p_roi | [AI] The ROI for which to update level-of-detail. |
p_und | [AI] Target LOD index. |
Definition at line 149 of file viewmanager.cpp.
void ViewManager::UpdateViewTransformations | ( | ) |
[AI] Updates the transformation matrices using the current POV and frustum edges, recalculating plane normals and D terms for culling.
Definition at line 408 of file viewmanager.cpp.