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

Camera controller for 3D scenes, handles interactive camera manipulation and view transformation. More...

#include <legocameracontroller.h>

Inheritance diagram for LegoCameraController:
Collaboration diagram for LegoCameraController:

Public Member Functions

 LegoCameraController ()
 Constructor. More...
 
 ~LegoCameraController () override
 Destructor. More...
 
MxLong Notify (MxParam &p_param) override
 Handles notifications for camera-relevant events (like mouse drag and mouse clicks). More...
 
const char * ClassName () const override
 Returns the runtime class name for this type. More...
 
MxBool IsA (const char *p_name) const override
 Checks if the name is compatible with this type or its ancestors. More...
 
virtual void OnLButtonDown (MxPoint32 p_point)
 Called when the left mouse button is pressed at a screen point. More...
 
virtual void OnLButtonUp (MxPoint32 p_point)
 Called when the left mouse button is released at a screen point. More...
 
virtual void OnRButtonDown (MxPoint32 p_point)
 Called when the right mouse button is pressed at a screen point. More...
 
virtual void OnRButtonUp (MxPoint32 p_point)
 Called when the right mouse button is released at a screen point. More...
 
virtual void OnMouseMove (MxU8 p_modifier, MxPoint32 p_point)
 Called when the mouse is moved. More...
 
virtual MxResult Create ()
 Registers the camera controller with input manager and initializes state with current view. More...
 
void SetWorldTransform (const Vector3 &p_at, const Vector3 &p_dir, const Vector3 &p_up)
 Updates the camera's world transformation matrix using view reference parameters. More...
 
void FUN_10012290 (float p_angle)
 Rotates the current camera transformation by a given angle around the Z axis. More...
 
void FUN_10012320 (float p_angle)
 Rotates the current camera transformation by a given angle around the Y axis. More...
 
MxResult FUN_100123b0 (Matrix4 &p_matrix)
 Retrieves the current point-of-view transformation into a matrix if it exists. More...
 
void FUN_100123e0 (const Matrix4 &p_transform, MxU32 p_und)
 Sets the camera's transformation matrix in the 3D view, optionally applying a blend with the internal matrix. More...
 
Mx3DPointFloat GetWorldUp ()
 Gets the camera's current world-space up vector. More...
 
Mx3DPointFloat GetWorldLocation ()
 Gets the camera's current world-space location. More...
 
Mx3DPointFloat GetWorldDirection ()
 Gets the camera's world-space forward direction vector. More...
 
- Public Member Functions inherited from LegoPointOfViewController
 LegoPointOfViewController ()
 [AI] Initializes state for coordinating mouse and point-of-view. [AI] More...
 
 ~LegoPointOfViewController () override
 [AI] Destructor; cleans up any owned references. [AI] More...
 
MxResult Tickle () override
 [AI] Called each frame (tick) to update the state of the point of view, potentially responding to input or animation. More...
 
void LeftDown (int p_x, int p_y) override
 [AI] Called when left mouse button is pressed; may start point-of-view manipulation. More...
 
void LeftDrag (int p_x, int p_y) override
 [AI] Called when cursor moves with left mouse button held; typically drags the point of view. More...
 
void LeftUp (int p_x, int p_y) override
 [AI] Called when the left button is released, possibly to end the manipulation and update the camera/entity. More...
 
void RightDown (int p_x, int p_y) override
 [AI] Called when the right mouse button is pressed; often used for alternative camera controls. More...
 
void RightDrag (int p_x, int p_y) override
 [AI] Called when right button is held and cursor is moved, e.g., for rotational camera movement. More...
 
void RightUp (int p_x, int p_y) override
 [AI] Called when the right mouse button is released, possibly to finalize alternative camera/entity action. More...
 
virtual void SetEntity (LegoEntity *p_entity)
 [AI] Assign the entity which this controller operates on, typically to associate the point of view with a specific character or camera. More...
 
MxResult Create (Lego3DView *p_lego3DView)
 [AI] Initializes the controller with a specific 3D view. More...
 
void OnViewSize (int p_width, int p_height)
 [AI] Updates the controller's internal state for a view size change, such as resizing the 3D viewport. More...
 
LegoEntityGetEntity ()
 [AI] Accessor for the currently attached entity. More...
 
LegoNavControllerGetNavController ()
 [AI] Accessor for the navigation controller associated with this point-of-view controller. More...
 
- Public Member Functions inherited from LegoMouseController
 LegoMouseController ()
 [AI] Constructor initializing state of mouse button. [AI] More...
 
 ~LegoMouseController () override
 [AI] Destructor for mouse controller. [AI] More...
 
virtual void LeftDown (int, int)
 [AI] Invoked when the left mouse button is pressed. More...
 
virtual void LeftDrag (int, int)
 [AI] Invoked as the mouse drags while the left button is held. More...
 
virtual void LeftUp (int, int)
 [AI] Invoked when the left mouse button is released. More...
 
virtual void RightDown (int, int)
 [AI] Invoked when the right mouse button is pressed. More...
 
virtual void RightDrag (int, int)
 [AI] Invoked as the mouse drags while the right button is held. More...
 
virtual void RightUp (int, int)
 [AI] Invoked when the right mouse button is released. More...
 
BOOL GetIsButtonDown ()
 [AI] Returns whether any mouse button is currently in the 'down' state. More...
 
MxDouble GetButtonX ()
 [AI] Returns the X coordinate where the last mouse button event occurred. More...
 
MxDouble GetButtonY ()
 [AI] Returns the Y coordinate where the last mouse button event occurred. More...
 
- Public Member Functions inherited from MxCore
 MxCore ()
 [AI] Constructs a new MxCore object and assigns it a unique id. More...
 
virtual ~MxCore ()
 [AI] Virtual destructor. Required for correct polymorphic cleanup in derived classes. More...
 
virtual MxLong Notify (MxParam &p_param)
 [AI] Virtual callback notification mechanism. More...
 
virtual MxResult Tickle ()
 [AI] Called by tickle managers to allow the object to update itself. More...
 
virtual const char * ClassName () const
 [AI] Returns the runtime class name of this object. More...
 
virtual MxBool IsA (const char *p_name) const
 [AI] Checks whether this object's class type or parents match the given name. More...
 
MxU32 GetId ()
 [AI] Gets the unique (per-process) id assigned to this object instance. More...
 

Additional Inherited Members

- Protected Member Functions inherited from LegoPointOfViewController
void AffectPointOfView ()
 [AI] Internal method to compute and apply the effect of user mouse input on the current point of view, entity, or camera, as appropriate. More...
 
- Protected Attributes inherited from LegoPointOfViewController
Lego3DViewm_lego3DView
 [AI] The active 3D view that input actions are translated into. [AI] More...
 
LegoEntitym_entity
 [AI] The entity whose point of view this controller manipulates. [AI] More...
 
MxDouble m_entityOffsetUp
 [AI] Offset along the entity's upward vector (for perspective/camera alignment). [AI] More...
 
LegoNavControllerm_nav
 [AI] Navigation controller used to translate input to navigation/camera changes. [AI] More...
 

Detailed Description

Camera controller for 3D scenes, handles interactive camera manipulation and view transformation.

[AI]

Inherits from LegoPointOfViewController. Handles left/right mouse button and mouse movement to manipulate a camera's position and orientation within a 3D world. Maintains two transformation matrices for current and original state, and is capable of interacting with sound and video managers to reflect the new camera positions. [AI]

Definition at line 17 of file legocameracontroller.h.

Constructor & Destructor Documentation

◆ LegoCameraController()

LegoCameraController::LegoCameraController ( )

Constructor.

Initializes the camera's world transform to a default pose at origin, looking forward. [AI]

Definition at line 18 of file legocameracontroller.cpp.

◆ ~LegoCameraController()

LegoCameraController::~LegoCameraController ( )
override

Destructor.

Cleans up and deregisters the camera from the input manager if set. [AI]

Definition at line 24 of file legocameracontroller.cpp.

Member Function Documentation

◆ ClassName()

const char * LegoCameraController::ClassName ( ) const
inlineoverridevirtual

Returns the runtime class name for this type.

[AI]

Returns
Pointer to literal class name string. [AI]

Reimplemented from MxCore.

Definition at line 40 of file legocameracontroller.h.

◆ Create()

MxResult LegoCameraController::Create ( )
virtual

Registers the camera controller with input manager and initializes state with current view.

[AI]

Returns
Result status for creation. [AI]

Definition at line 34 of file legocameracontroller.cpp.

◆ FUN_10012290()

void LegoCameraController::FUN_10012290 ( float  p_angle)

Rotates the current camera transformation by a given angle around the Z axis.

[AI]

Parameters
p_angleAngle in radians to rotate around Z. [AI]

Restores backup matrix before applying new rotation to avoid cumulative drift. [AI]

Definition at line 129 of file legocameracontroller.cpp.

◆ FUN_10012320()

void LegoCameraController::FUN_10012320 ( float  p_angle)

Rotates the current camera transformation by a given angle around the Y axis.

[AI]

Parameters
p_angleAngle in radians to rotate around Y. [AI]

Restores backup matrix before applying new rotation to avoid cumulative drift. [AI]

Definition at line 137 of file legocameracontroller.cpp.

◆ FUN_100123b0()

MxResult LegoCameraController::FUN_100123b0 ( Matrix4 p_matrix)

Retrieves the current point-of-view transformation into a matrix if it exists.

[AI]

Parameters
p_matrixReference to the destination Matrix4. [AI]
Returns
SUCCESS if POV matrix is available; otherwise FAILURE. [AI]

Definition at line 144 of file legocameracontroller.cpp.

◆ FUN_100123e0()

void LegoCameraController::FUN_100123e0 ( const Matrix4 p_transform,
MxU32  p_und 
)

Sets the camera's transformation matrix in the 3D view, optionally applying a blend with the internal matrix.

[AI]

Parameters
p_transformThe new transformation matrix to use. [AI]
p_undIf true, a combined transform is computed with the current matrix; otherwise, p_transform is used as-is. [AI]

Also updates the associated sound listener orientation to match the camera. [AI]

Definition at line 159 of file legocameracontroller.cpp.

◆ GetWorldDirection()

Mx3DPointFloat LegoCameraController::GetWorldDirection ( )

Gets the camera's world-space forward direction vector.

[AI]

Returns
Current direction as a Mx3DPointFloat. Returns zero vector if not available. [AI]

Definition at line 215 of file legocameracontroller.cpp.

◆ GetWorldLocation()

Mx3DPointFloat LegoCameraController::GetWorldLocation ( )

Gets the camera's current world-space location.

[AI]

Returns
Current location as a Mx3DPointFloat. Applies entity offset if available; returns zero vector if not available. [AI]

Definition at line 202 of file legocameracontroller.cpp.

◆ GetWorldUp()

Mx3DPointFloat LegoCameraController::GetWorldUp ( )

Gets the camera's current world-space up vector.

[AI]

Returns
Current up vector as a Mx3DPointFloat. Returns zero vector if not available. [AI]

Definition at line 189 of file legocameracontroller.cpp.

◆ IsA()

MxBool LegoCameraController::IsA ( const char *  p_name) const
inlineoverridevirtual

Checks if the name is compatible with this type or its ancestors.

[AI]

Parameters
p_nameName string to compare. [AI]
Returns
True if the queried name matches this class or a parent; otherwise false. [AI]

Reimplemented from MxCore.

Definition at line 51 of file legocameracontroller.h.

◆ Notify()

MxLong LegoCameraController::Notify ( MxParam p_param)
overridevirtual

Handles notifications for camera-relevant events (like mouse drag and mouse clicks).

[AI]

Parameters
p_paramNotification parameter. Casts to specific notification types as needed. [AI]

This method dispatches notifications to appropriate event handlers (OnLButtonDown/Up, OnRButtonDown/Up, OnMouseMove) depending on the notification type and mouse button states. [AI]

Reimplemented from MxCore.

Definition at line 42 of file legocameracontroller.cpp.

◆ OnLButtonDown()

void LegoCameraController::OnLButtonDown ( MxPoint32  p_point)
virtual

Called when the left mouse button is pressed at a screen point.

[AI]

Parameters
p_point2D point, typically window coordinates. [AI]

Used to initiate camera interactions like dragging. [AI]

Definition at line 86 of file legocameracontroller.cpp.

◆ OnLButtonUp()

void LegoCameraController::OnLButtonUp ( MxPoint32  p_point)
virtual

Called when the left mouse button is released at a screen point.

[AI]

Parameters
p_point2D point, typically window coordinates. [AI]

Definition at line 92 of file legocameracontroller.cpp.

◆ OnMouseMove()

void LegoCameraController::OnMouseMove ( MxU8  p_modifier,
MxPoint32  p_point 
)
virtual

Called when the mouse is moved.

[AI]

Parameters
p_modifierModifier indicating which mouse buttons/states are active (bitmask from LegoEventNotificationParam). [AI]
p_point2D mouse position. [AI]

Used to process camera rotation or movement during dragging. [AI]

Definition at line 110 of file legocameracontroller.cpp.

◆ OnRButtonDown()

void LegoCameraController::OnRButtonDown ( MxPoint32  p_point)
virtual

Called when the right mouse button is pressed at a screen point.

[AI]

Parameters
p_point2D point, typically window coordinates. [AI]

Definition at line 98 of file legocameracontroller.cpp.

◆ OnRButtonUp()

void LegoCameraController::OnRButtonUp ( MxPoint32  p_point)
virtual

Called when the right mouse button is released at a screen point.

[AI]

Parameters
p_point2D point, typically window coordinates. [AI]

Definition at line 104 of file legocameracontroller.cpp.

◆ SetWorldTransform()

void LegoCameraController::SetWorldTransform ( const Vector3 p_at,
const Vector3 p_dir,
const Vector3 p_up 
)

Updates the camera's world transformation matrix using view reference parameters.

[AI]

Parameters
p_atCamera position or 'at' vector. [AI]
p_dirCamera forward direction. [AI]
p_upCamera up vector. [AI]

Computes the local transform matrix from position, direction, and up vector. Stores both original and working matrices. [AI]

Definition at line 121 of file legocameracontroller.cpp.


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