Skylicht Engine
Loading...
Searching...
No Matches
Skylicht::CEditorCamera Class Reference

This is an object class that can perform mouse operations to move the camera. It is used on operating systems with a mouse, such as Windows, Mac, and within the engine's Editor. More...

#include <Camera/CEditorCamera.h>

Inheritance diagram for Skylicht::CEditorCamera:
Skylicht::CComponentSystem Skylicht::IActivatorObject

Public Types

enum  EControlStyle { Default , Maya , Blender }
 Supported control styles for the editor camera. More...

Public Member Functions

virtual void initComponent ()
virtual void updateComponent ()
virtual void endUpdate ()
virtual bool OnEvent (const SEvent &event)
void setRotateSpeed (float speed)
 Sets the orbit rotation speed.
void setMoveSpeed (float speed)
 Sets the panning speed.
float getMoveSpeed ()
 Gets the current panning speed.
float getRotateSpeed ()
 Gets the current orbit rotation speed.
float getZoomSpeed ()
 Gets the zooming speed.
void setZoomSpeed (float z)
 Sets the zooming speed.
CCameragetCamera ()
 Gets the attached camera component.
void setControlStyle (EControlStyle style)
 Sets the active control style (Maya, Blender, etc.).
EControlStyle getControlStyle ()
 Gets the current control style.
bool isRightMousePressed ()
 Checks if the right mouse button is currently held.
bool isLeftMousePressed ()
 Checks if the left mouse button is currently held.
void setPivotRotate (const core::vector3df &pos)
 Sets the orbit pivot point and calculates distance.
void setPivotRotateDistance (float d)
 Directly sets the distance to the orbit pivot.
Public Member Functions inherited from Skylicht::CComponentSystem
const char * getName ()
virtual void reset ()
virtual void startComponent ()
virtual void onEnable (bool b)
virtual void onUpdateCullingLayer (u32 mask)
virtual CObjectSerializablecreateSerializable ()
virtual void loadSerializable (CObjectSerializable *object)
void setEnable (bool b)
bool isEnable ()
CGameObject * getGameObject ()
void setEnableSerializable (bool b)
bool isSerializable ()
void addLinkComponent (CComponentSystem *comp)
void removeAllLink ()
Public Member Functions inherited from Skylicht::IActivatorObject
virtual ~IActivatorObject ()
 Virtual destructor for polymorphic activator objects.

Protected Member Functions

void fixVector (core::vector3df &v)
 Cleans up tiny vector components to prevent floating point drift.
void updateInputRotate (core::vector3df &relativeRotation, f32 timeDiff, bool useCenterPivot=false)
 Updates horizontal and vertical orbit rotation.
void updateInputOffset (core::vector3df &offsetPosition, f32 timeDiff)
 Updates position offset (panning).
void updateInputZoom (f32 timeDiff, core::vector3df &pos, const core::vector3df &moveDir)
 Updates zoom by moving the camera along its forward vector.
Protected Member Functions inherited from Skylicht::CComponentSystem
void setOwner (CGameObject *obj)

Protected Attributes

CCameram_camera
 Pointer to the CCamera component.
f32 m_moveSpeed
 Panning/Movement sensitivity.
f32 m_rotateSpeed
 Orbit/Rotation sensitivity.
f32 m_zoomSpeed
 Zooming sensitivity.
gui::ICursorControl * m_cursorControl
 Cursor control service for retrieving mouse position.
core::position2df m_centerCursor
 Normalized cursor position at start of interaction.
core::position2df m_cursorPos
 Current normalized cursor position.
bool m_altKeyDown
 Modifier key states.
bool m_ctrlKeyDown
bool m_shiftKeyDown
bool m_leftMousePress
 Basic mouse button states.
bool m_rightMousePress
bool m_midMousePress
bool m_mayaLeftMousePress
 Specialized Maya mouse button states.
bool m_mayaRightMousePress
bool m_mouseWhell
 Mouse wheel state and delta.
float m_wheel
float m_pivotRotateDistance
 Distance from the pivot point for orbit rotation.
EControlStyle m_controlStyle
 Active control style.
Protected Attributes inherited from Skylicht::CComponentSystem
CGameObject * m_gameObject
bool m_enable
bool m_serializable
std::vector< CComponentSystem * > m_linkComponent

Additional Inherited Members

Static Public Member Functions inherited from Skylicht::CComponentSystem
static int useComponent (CComponentSystem *used)

Detailed Description

This is an object class that can perform mouse operations to move the camera. It is used on operating systems with a mouse, such as Windows, Mac, and within the engine's Editor.

Member Enumeration Documentation

◆ EControlStyle

Supported control styles for the editor camera.

Enumerator
Maya 

Standard WASD/Mouse controls.

Blender 

Alt-based navigation (Alt+LMB Rotate, Alt+MMB Pan, Alt+RMB Zoom).

Blender-style navigation (MMB Rotate, Shift+MMB Pan, Ctrl+MMB Zoom).

Member Function Documentation

◆ endUpdate()

virtual void Skylicht::CEditorCamera::endUpdate ( )
virtual

Reimplemented from Skylicht::CComponentSystem.

◆ fixVector()

void Skylicht::CEditorCamera::fixVector ( core::vector3df & v)
protected

Cleans up tiny vector components to prevent floating point drift.

Parameters
vVector to fix.

◆ getCamera()

CCamera * Skylicht::CEditorCamera::getCamera ( )
inline

Gets the attached camera component.

Returns
Pointer to CCamera.

◆ getControlStyle()

EControlStyle Skylicht::CEditorCamera::getControlStyle ( )
inline

Gets the current control style.

Returns
EControlStyle.

◆ getMoveSpeed()

float Skylicht::CEditorCamera::getMoveSpeed ( )
inline

Gets the current panning speed.

Returns
Speed.

◆ getRotateSpeed()

float Skylicht::CEditorCamera::getRotateSpeed ( )
inline

Gets the current orbit rotation speed.

Returns
Speed.

◆ getZoomSpeed()

float Skylicht::CEditorCamera::getZoomSpeed ( )
inline

Gets the zooming speed.

Returns
Speed.

◆ initComponent()

virtual void Skylicht::CEditorCamera::initComponent ( )
virtual

◆ isLeftMousePressed()

bool Skylicht::CEditorCamera::isLeftMousePressed ( )
inline

Checks if the left mouse button is currently held.

Returns
True if pressed.

◆ isRightMousePressed()

bool Skylicht::CEditorCamera::isRightMousePressed ( )
inline

Checks if the right mouse button is currently held.

Returns
True if pressed.

◆ setControlStyle()

void Skylicht::CEditorCamera::setControlStyle ( EControlStyle style)
inline

Sets the active control style (Maya, Blender, etc.).

Parameters
styleControl style.

◆ setMoveSpeed()

void Skylicht::CEditorCamera::setMoveSpeed ( float speed)
inline

Sets the panning speed.

Parameters
speedSpeed value.

◆ setPivotRotate()

void Skylicht::CEditorCamera::setPivotRotate ( const core::vector3df & pos)

Sets the orbit pivot point and calculates distance.

Parameters
posWorld position of the pivot.

◆ setPivotRotateDistance()

void Skylicht::CEditorCamera::setPivotRotateDistance ( float d)
inline

Directly sets the distance to the orbit pivot.

Parameters
dDistance.

◆ setRotateSpeed()

void Skylicht::CEditorCamera::setRotateSpeed ( float speed)
inline

Sets the orbit rotation speed.

Parameters
speedSpeed value.

◆ setZoomSpeed()

void Skylicht::CEditorCamera::setZoomSpeed ( float z)
inline

Sets the zooming speed.

Parameters
zSpeed value.

◆ updateComponent()

virtual void Skylicht::CEditorCamera::updateComponent ( )
virtual

◆ updateInputOffset()

void Skylicht::CEditorCamera::updateInputOffset ( core::vector3df & offsetPosition,
f32 timeDiff )
protected

Updates position offset (panning).

Parameters
offsetPosition[out] Calculated world offset.
timeDiffElapsed time.

◆ updateInputRotate()

void Skylicht::CEditorCamera::updateInputRotate ( core::vector3df & relativeRotation,
f32 timeDiff,
bool useCenterPivot = false )
protected

Updates horizontal and vertical orbit rotation.

Parameters
relativeRotation[in/out] Current rotation angles.
timeDiffElapsed time.
useCenterPivotWhether to rotate around the pivot point.

◆ updateInputZoom()

void Skylicht::CEditorCamera::updateInputZoom ( f32 timeDiff,
core::vector3df & pos,
const core::vector3df & moveDir )
protected

Updates zoom by moving the camera along its forward vector.

Parameters
timeDiffElapsed time.
pos[in/out] Camera position.
moveDirForward viewing direction.

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