Isle
Loading...
Searching...
No Matches
Lego3DView Class Reference

[AI] Represents a 3D view for rendering and managing LEGO game objects in a 3D scene. More...

#include <lego3dview.h>

Inheritance diagram for Lego3DView:
Collaboration diagram for Lego3DView:

Public Member Functions

 Lego3DView ()
 [AI] Constructs a new Lego3DView instance. More...
 
 ~Lego3DView () override
 [AI] Destroys the Lego3DView instance and all associated resources via Destroy(). More...
 
BOOL Create (const CreateStruct &rCreateStruct, Tgl::Renderer *pRenderer)
 [AI] Initializes the 3D view with the specified surface creation parameters and renderer interface. More...
 
void Destroy () override
 [AI] Cleans up resources allocated by the view, including the ViewManager, unset the point of view, and calls the parent Destroy(). More...
 
BOOL Add (ViewROI &rROI)
 [AI] Adds a ViewROI (renderable object instance) to the scene. More...
 
BOOL Remove (ViewROI &rROI)
 [AI] Removes a ViewROI from the scene. More...
 
BOOL Moved (ViewROI &rROI)
 [AI] Notifies the view that a ViewROI has moved. More...
 
BOOL SetPointOfView (ViewROI &rROI)
 [AI] Sets the current point of view to the specified ViewROI and updates the camera transformation. More...
 
double Render (double p_und)
 [AI] Renders the scene using the ViewManager and returns the render time. More...
 
ViewROIPick (unsigned long x, unsigned long y)
 [AI] Picks (selects) a ViewROI in the scene by screen-space coordinates. More...
 
ViewROIGetPointOfView ()
 [AI] Returns the current point-of-view object (the ViewROI the camera is following). More...
 
ViewManagerGetViewManager ()
 [AI] Returns the ViewManager responsible for managing scene objects and transformations. More...
 
- Public Member Functions inherited from LegoView1
 LegoView1 ()
 [AI] Constructs the view and zeros out all light pointers (sun, directional, ambient). More...
 
 ~LegoView1 () override
 [AI] Destructor. More...
 
BOOL AddLightsToViewport ()
 [AI] Adds the view's lights (sun, directional, ambient) to the active Tgl view for rendering. More...
 
BOOL Create (const TglSurface::CreateStruct &rCreateStruct, Tgl::Renderer *pRenderer)
 [AI] Initializes scene, camera, and three types of lights (sun, directional, ambient) using supplied renderer. More...
 
void Destroy () override
 [AI] Safely removes all lights from the scene, deletes them, and nulls pointers. More...
 
void SetLightTransform (BOOL bDirectionalLight, Tgl::FloatMatrix4 &rMatrix)
 [AI] Sets the transformation matrix (position/orientation) for either the sun or directional light. More...
 
void SetLightColor (BOOL bDirectionalLight, float red, float green, float blue)
 [AI] Sets the RGB color for either the sun or directional light. More...
 
- Public Member Functions inherited from LegoView
 LegoView ()
 [AI] Constructs an empty LegoView with uninitialized scene and camera. More...
 
 ~LegoView () override
 [AI] Destructor. More...
 
BOOL Create (const CreateStruct &rCreateStruct, Tgl::Renderer *pRenderer)
 [AI] Initialize the LegoView with a scene root and camera using the provided creation parameters and renderer. More...
 
void Destroy () override
 [AI] Release all scene and camera resources, call TglSurface cleanup. More...
 
Tgl::GroupGetScene () const
 [AI] Accessor for the root scene group. More...
 
Tgl::CameraGetCamera () const
 [AI] Accessor for the view's main camera. More...
 
- Public Member Functions inherited from TglSurface
 TglSurface ()
 [AI] Constructs a new TglSurface instance with members initialized to their default state. More...
 
virtual ~TglSurface ()
 [AI] Virtual destructor also triggers Destroy(). More...
 
virtual BOOL Create (const CreateStruct &, Tgl::Renderer *, Tgl::Group *pScene)
 [AI] Creates and initializes the surface, rendering device, and optionally installs scene graph. More...
 
virtual void Destroy ()
 [AI] Destroys all resources (view, device), releasing scene and renderer references. More...
 
virtual double Render ()
 [AI] Renders a single frame and returns the render time for that frame. More...
 
Tgl::RendererGetRenderer () const
 [AI] Gets the active renderer for this surface. More...
 
Tgl::DeviceGetDevice () const
 [AI] Returns the graphics device used by this surface, e.g. More...
 
Tgl::ViewGetView () const
 [AI] Gets the current view/camera for this surface. More...
 
Tgl::GroupGetScene () const
 [AI] Returns the currently attached 3D scene root/group. More...
 
unsigned long GetWidth () const
 [AI] Returns the width (in pixels) of the rendered surface. More...
 
unsigned long GetHeight () const
 [AI] Returns the height (in pixels) of the rendered surface. More...
 
double GetRenderingRate () const
 [AI] Returns the measured rendering rate (frames per second) for the rendering routine. More...
 
double GetFrameRate () const
 [AI] Returns the measured frame rate (frames per second) for the current surface. More...
 
unsigned long GetFrameCount () const
 [AI] Returns the frame count since creation or since last meter reset. More...
 

Additional Inherited Members

- Protected Member Functions inherited from LegoView
Tgl::ViewCreateView (Tgl::Renderer *pRenderer, Tgl::Device *pDevice) override
 [AI] Create and return the Tgl::View object for this surface. More...
 
- Protected Member Functions inherited from TglSurface
virtual Tgl::ViewCreateView (Tgl::Renderer *, Tgl::Device *)=0
 [AI] Abstract view creation. More...
 
virtual void DestroyView ()
 [AI] Destroys (deletes) the surface's view/camera, and resets the pointer to null. More...
 

Detailed Description

[AI] Represents a 3D view for rendering and managing LEGO game objects in a 3D scene.

Inherits from LegoView1 and acts as the main render target for 3D objects, handling the addition and removal of objects, point of view management, and rendering logic. Utilizes a ViewManager to coordinate the scene and camera. [AI]

Definition at line 20 of file lego3dview.h.

Constructor & Destructor Documentation

◆ Lego3DView()

Lego3DView::Lego3DView ( )

[AI] Constructs a new Lego3DView instance.

Definition at line 14 of file lego3dview.cpp.

◆ ~Lego3DView()

Lego3DView::~Lego3DView ( )
override

[AI] Destroys the Lego3DView instance and all associated resources via Destroy().

Definition at line 23 of file lego3dview.cpp.

Member Function Documentation

◆ Add()

BOOL Lego3DView::Add ( ViewROI rROI)

[AI] Adds a ViewROI (renderable object instance) to the scene.

Forwards to ViewManager::Add().

Parameters
rROIReference to the ViewROI to be added.
Returns
TRUE if added successfully. [AI]

Definition at line 78 of file lego3dview.cpp.

◆ Create()

BOOL Lego3DView::Create ( const CreateStruct rCreateStruct,
Tgl::Renderer pRenderer 
)

[AI] Initializes the 3D view with the specified surface creation parameters and renderer interface.

Initializes the underlying rendering view, sets up the viewing frustum and constructs the ViewManager for scene management.

Parameters
rCreateStructStruct containing properties for initialization, including view angle.
pRendererRenderer interface used for low-level rendering context creation.
Returns
TRUE if successfully created; FALSE otherwise. [AI]

Definition at line 29 of file lego3dview.cpp.

◆ Destroy()

void Lego3DView::Destroy ( )
overridevirtual

[AI] Cleans up resources allocated by the view, including the ViewManager, unset the point of view, and calls the parent Destroy().

[AI]

Reimplemented from TglSurface.

Definition at line 63 of file lego3dview.cpp.

◆ GetPointOfView()

ViewROI * Lego3DView::GetPointOfView ( )
inline

[AI] Returns the current point-of-view object (the ViewROI the camera is following).

[AI] Returns the current point-of-view object (the ViewROI the camera is following). [AI]

Returns
Pointer to the current POV ViewROI, or nullptr if none. [AI]

[AI]

Returns
Pointer to the current POV ViewROI, or nullptr if none. [AI]

[AI] [AI]

Definition at line 162 of file lego3dview.h.

◆ GetViewManager()

ViewManager * Lego3DView::GetViewManager ( )
inline

[AI] Returns the ViewManager responsible for managing scene objects and transformations.

[AI] Returns the ViewManager responsible for managing scene objects and transformations. [AI]

Returns
Pointer to the associated ViewManager. [AI]

[AI]

Returns
Pointer to the associated ViewManager. [AI]

[AI] [AI]

Definition at line 154 of file lego3dview.h.

◆ Moved()

BOOL Lego3DView::Moved ( ViewROI rROI)

[AI] Notifies the view that a ViewROI has moved.

If the moved object is the current point of view, updates the camera transformation to match the object's transformation.

Parameters
rROIThe ViewROI that moved.
Returns
TRUE after handling update. [AI]

Definition at line 126 of file lego3dview.cpp.

◆ Pick()

ViewROI * Lego3DView::Pick ( unsigned long  x,
unsigned long  y 
)

[AI] Picks (selects) a ViewROI in the scene by screen-space coordinates.

Uses ViewManager's picking logic.

Parameters
xThe horizontal screen coordinate.
yThe vertical screen coordinate.
Returns
The ViewROI* under the (x, y) position or nullptr if none. [AI]

Definition at line 157 of file lego3dview.cpp.

◆ Remove()

BOOL Lego3DView::Remove ( ViewROI rROI)

[AI] Removes a ViewROI from the scene.

Forwards to ViewManager::Remove(). If the ViewROI is the current point of view, it resets the POV.

Parameters
rROIReference to the ViewROI to remove.
Returns
TRUE if removed successfully. [AI]

Definition at line 89 of file lego3dview.cpp.

◆ Render()

double Lego3DView::Render ( double  p_und)

[AI] Renders the scene using the ViewManager and returns the render time.

Calls ViewManager::Update() and then base surface Render().

Parameters
p_undElapsed time or time delta since last render, for frame update logic.
Returns
The time of the last render; used for animation/timing. [AI]

Definition at line 148 of file lego3dview.cpp.

◆ SetPointOfView()

BOOL Lego3DView::SetPointOfView ( ViewROI rROI)

[AI] Sets the current point of view to the specified ViewROI and updates the camera transformation.

Updates the ViewManager's POV source as well.

Parameters
rROIThe ViewROI to use as the new point of view.
Returns
TRUE if successful. [AI]

Definition at line 105 of file lego3dview.cpp.


The documentation for this class was generated from the following files: