3DRadSpace 0.1.0Alpha
3DRadSpace is a free, simple to use, rapid application development game engine.
Loading...
Searching...
No Matches
Engine3DRadSpace.Objects.FreeCam Class Reference

FreeCam is a camera that can be moved freely in the scene using a 6 DoF control scheme. More...

#include <FreeCam.hpp>

Inheritance diagram for Engine3DRadSpace.Objects.FreeCam:
Collaboration diagram for Engine3DRadSpace.Objects.FreeCam:

Public Member Functions

 FreeCam ()
 FreeCam (const std::string &name="FreeCam", bool visible=true, const Math::Vector3 &pos=Math::Vector3::Zero(), const Math::Quaternion &rotation=Math::Quaternion(), const Math::Vector3 &up=Math::Vector3::UnitY(), float aspectRatio=4.0f/3.0f, float fov=Math::ToRadians(65.0f), float npd=0.01f, float fpd=500.0f)
 Complete FreeCam constructor.
 FreeCam (FreeCam &&other) noexcept=default
 Default move constructor for FreeCam.
FreeCam & operator= (FreeCam &&other) noexcept=default
 Default move assignment operator for FreeCam.
Math::Vector3 ForwardDir () const noexcept
 Gets the camera's forward direction in world space.
void SetCameraRotation (const Math::Vector2 &camCoords) noexcept
 Sets the camera rotation using an input vector formed of radians.
void Update () override
 Handles input for this object.
Reflection::UUID GetUUID () const noexcept override
 Gets the UUID of FreeCam class type.
Objects::Gizmos::IGizmo * GetGizmo () const noexcept override
 Gets the gizmo associated with this object.
Public Member Functions inherited from Engine3DRadSpace.Objects.Camera
 Camera ()
 Camera (IntPtr instance)
unsafe void SetLookAt (Vector3 value)
Matrix4x4 GetViewMatrix ()
Matrix4x4 GetProjectionMatrix ()
 Camera (const std::string &name="Camera", bool visible=true, const Math::Vector3 &pos=Math::Vector3::Zero(), const Math::Quaternion &rotation=Math::Quaternion(), const Math::Vector3 &up=Math::Vector3::UnitY(), float aspectRatio=4.0f/3.0f, float fov=Math::ToRadians(65.0f), float npd=0.01f, float fpd=500.0f)
 Complete camera constructor.
 Camera (Camera &&) noexcept=default
 Move constructor for Camera.
Camera & operator= (Camera &&) noexcept=default
 Move assignment operator for Camera.
void Initialize () override
 Updates the camera.
void Load () override
 Does nothing.
void Load (const std::filesystem::path &path) override
 Does nothing.
Math::Matrix4x4 GetModelMatrix () const override
 Gets the world matrix of this object, considering the entire hierarchy of parent objects.
Math::Matrix4x4 GetViewMatrix () const noexcept override
 Gets the View matrix of the camera.
Math::Matrix4x4 GetProjectionMatrix () const override
 Calculates the projection matrix.
void Draw3D () override
 Sets the view and projection matrices.
void ForceUpdate ()
 Same as both Draw3D() and Update() as if the camera is enabled.
void SetLookAt (const Math::Vector3 &lookAt)
float Intersects (const Math::Ray &r) const override
 Returns the distance from the ray origin to the intersection point, or NaN if there is no intersection.
 ~Camera () override
Public Member Functions inherited from Engine3DRadSpace.Objects.InstIObject3D
Matrix4x4 GetModelMatrix ()
float? Intersects (Ray ray)
 InstIObject3D (IntPtr natPtr)
Public Member Functions inherited from Engine3DRadSpace.NatPtrWrapper
virtual void Dispose ()
Public Member Functions inherited from Engine3DRadSpace.Objects.ICamera
Matrix4x4 GetViewMatrix ()
Matrix4x4 GetProjectionMatrix ()
virtual Math::ViewingFrustum GetViewingFrustum () const
 Calculates the viewing frustum from the view and projection matrices.
virtual ~ICamera ()=default
Public Member Functions inherited from Engine3DRadSpace.Objects.IObject3D
Matrix4x4 GetModelMatrix ()
float? Intersects (Ray ray)
virtual Math::Matrix4x4 GetLocalMatrix () const
 Gets the local transformation matrix of this object, considering only its own position, rotation, and scale.
virtual Math::BoundingBox GetBoundingBox () const noexcept
 Gets the axis-aligned bounding box of this object in world space. Used for culling and intersections.
 ~IObject3D ()=default
Public Member Functions inherited from Engine3DRadSpace.Objects.IObject
void Enable ()
void Disable ()
bool Switch ()
void Show ()
void Hide ()
bool SwitchVisibility ()
IObject GetChild (int idx)
int GetChildrenCount ()
void InternalInitialize (IGame *game)
 Called by ObjectsList to set the _game Game instance. If there are objects manually managed, this MUST be called before Initialize or EditorInitialize.
Graphics::IGraphicsDevice * GetGraphicsDeviceHandle () const noexcept
 Returns the graphics device handle associated with this object.
IGame * GetGame () const noexcept
 Gets the game that this object belongs to.
IObject * operator[] (size_t idxChild) const
 Returns the idx-th child of this object.
IObject * GetParent () const noexcept
 Returns the parent of this object.
void SetParent (IObject *newParent) noexcept
 Sets the parent of this object.
bool HasParent () const noexcept
 Checks if this object has a parent.
size_t GetChildrenCount () const noexcept
 Returns the number of children of this object.
virtual void Enable ()
 Enables this object.
virtual void Disable ()
 Disables this object.
virtual bool Switch ()
 Switched the enable/disable state of this object.
virtual void Show ()
 Shows this object.
virtual void Hide ()
 Hides this object.
virtual bool SwitchVisibility ()
 Switches the visibility state of this object.
void Uninitialize () override
 Called before the object has the destructor called.
virtual ~IObject ()
Public Member Functions inherited from Engine3DRadSpace.IInitializable
void Initialize ()
virtual ~IInitializable ()=default
Public Member Functions inherited from Engine3DRadSpace.IUpdateable
void Update ()
virtual ~IUpdateable ()=default
Public Member Functions inherited from Engine3DRadSpace.ILoadable
void Load ()
void Load (string path)
virtual ~ILoadable ()=default
Public Member Functions inherited from Engine3DRadSpace.IDrawable3D
void Draw3D ()
virtual ~IDrawable3D ()=default

Public Attributes

float Sensitivity = 0.01f
 Camera rotation sensitivity. The higher the value, the more sensitive the camera is to mouse movement.
bool InvertX = false
 Invert the X axis for mouse movement.
bool InvertY = false
 Invert the Y axis for mouse movement.
bool EnableElevation = true
 Enable elevation using the Elevate and Descent keys.
bool Frozen = false
 Is movement entirely disabled?
Input::Key Forward = Input::Key::W
 Forward key.
Input::Key Backward = Input::Key::S
 Backward key.
Input::Key Left = Input::Key::A
 Left key.
Input::Key Right = Input::Key::D
 Right key.
Input::Key Elevate = Input::Key::Q
 Elevate key.
Input::Key Descend = Input::Key::E
 Descend key.
Public Attributes inherited from Engine3DRadSpace.Objects.ICamera
Math::Vector3 Normal
 Normal vector of the camera.
float AspectRatio
 Aspect ratio of the camera (width / height).
float FieldOfView
 Field of view in radians.
float NearPlaneDistance
 Minimal rendering distance.
float FarPlaneDistance
 Maximum rendering distance.
Public Attributes inherited from Engine3DRadSpace.Objects.IObject3D
Math::Vector3 Position
 Position in world space of this object.
Math::Vector3 RotationCenter
 Rotation pivot.
Math::Quaternion Rotation
 Rotation of this object. Default is (0,0,0,1) (identity quaternion).
Math::Vector3 Scale
 Scale of this object. Default is (1,1,1).
bool PostRender = false
 Forces a second draw pass after the main rendering passes completes.
Public Attributes inherited from Engine3DRadSpace.Objects.IObject
std::string Name
 Name of the object.
ChildObjectCollection Children
 Children of this object.

Protected Attributes

Math::Vector2 _camCoords
Math::Vector3 _fwd
Math::Vector3 _dir
Protected Attributes inherited from Engine3DRadSpace.NatPtrWrapper
IntPtr _handle
bool _disposed
Protected Attributes inherited from Engine3DRadSpace.Objects.IObject
IGame * _game = nullptr
Graphics::IGraphicsDevice * _device = nullptr
IObject * _parent = nullptr

Properties

float MovementSpeed = 1.0f [get, set]
 Camera movement speed in m/s.
bool XInverted [get, set]
bool YInverted [get, set]
Key ForwardKey [get, set]
Key BackwardKey [get, set]
Key LeftKey [get, set]
Key RightKey [get, set]
Properties inherited from Engine3DRadSpace.Objects.Camera
unsafe Vector3 Normal [get, set]
float AspectRatio [get, set]
float FieldOfView [get, set]
float NearPlaneDistance [get, set]
float FarPlaneDistance [get, set]
Properties inherited from Engine3DRadSpace.Objects.InstIObject3D
Vector3 Position [get, set]
Vector3 RotationCenter [get, set]
Quaternion Rotation [get, set]
Vector3 Scale [get, set]
Properties inherited from Engine3DRadSpace.NatPtrWrapper
IntPtr Handle [get]
Properties inherited from Engine3DRadSpace.Objects.IObject3D
Vector3 Position [get, set]
Vector3 RotationCenter [get, set]
Quaternion Rotation [get, set]
Vector3 Scale [get, set]
Properties inherited from Engine3DRadSpace.Objects.IObject
string Name [get, set]
bool Enabled [get, set]
 Is this object enabled?
bool Visible [get, set]
 Is this object visible?
Reflection.UUID UUID [get]
IGame Game [get]
IGraphicsDevice GraphicsDevice [get]
IGizmo Gizmo [get]
ObjectCollection Children [get]
IObject Parent [get, set]

Additional Inherited Members

Protected Member Functions inherited from Engine3DRadSpace.NatPtrWrapper
 NatPtrWrapper (IntPtr handle, Action< IntPtr > fnDestroy)
 NatPtrWrapper (Action< IntPtr > fnDestroy)
void Reset (IntPtr newObj)
void Dispose (bool disposing)
Protected Member Functions inherited from Engine3DRadSpace.Objects.ICamera
 ICamera (const Math::Vector3 &normal, float aspectRatio, float fov, float npd, float fpd)
 ICamera complete constructor.
 ICamera (const ICamera &)=delete
ICamera & operator= (const ICamera &)=delete
 ICamera (ICamera &&) noexcept=default
ICamera & operator= (ICamera &&) noexcept=default
Protected Member Functions inherited from Engine3DRadSpace.Objects.IObject3D
 IObject3D (const std::string &name="", bool enabled=false, bool visible=false, const Math::Vector3 &pos=Math::Vector3::Zero(), const Math::Vector3 &pivot=Math::Vector3::Zero(), const Math::Quaternion &rotation=Math::Quaternion(), const Math::Vector3 &scale=Math::Vector3::One())
 IObject3D (const IObject3D &) noexcept=delete
IObject3D & operator= (const IObject3D &) noexcept=delete
 IObject3D (IObject3D &&) noexcept=default
IObject3D & operator= (IObject3D &&) noexcept=default
Protected Member Functions inherited from Engine3DRadSpace.Objects.IObject
 IObject (const std::string &name="Empty", bool enabled=false, bool visible=false)
 Default constructor used for reflection. Objects created with this constructor are initially invalid, until internalInitialize() is called.
 IObject (const IObject &) noexcept=delete
IObject & operator= (const IObject &) noexcept=delete
 IObject (IObject &&) noexcept=default
IObject & operator= (IObject &&) noexcept=default
Protected Member Functions inherited from Engine3DRadSpace.IInitializable
 IInitializable ()=default
 IInitializable (const IInitializable &) noexcept=default
IInitializable & operator= (const IInitializable &) noexcept=default
 IInitializable (IInitializable &&) noexcept=default
IInitializable & operator= (IInitializable &&) noexcept=default
Protected Member Functions inherited from Engine3DRadSpace.IUpdateable
 IUpdateable ()=default
 IUpdateable (const IUpdateable &) noexcept=default
IUpdateable & operator= (const IUpdateable &) noexcept=default
 IUpdateable (IUpdateable &&) noexcept=default
IUpdateable & operator= (IUpdateable &&) noexcept=default
Protected Member Functions inherited from Engine3DRadSpace.ILoadable
 ILoadable ()=default
 ILoadable (const ILoadable &) noexcept=default
ILoadable & operator= (const ILoadable &) noexcept=default
 ILoadable (ILoadable &&) noexcept=default
ILoadable & operator= (ILoadable &&) noexcept=default
Protected Member Functions inherited from Engine3DRadSpace.IDrawable3D
 IDrawable3D ()=default
 IDrawable3D (const IDrawable3D &)=default
IDrawable3D & operator= (const IDrawable3D &)=default
 IDrawable3D (IDrawable3D &&) noexcept=default
IDrawable3D & operator= (IDrawable3D &&) noexcept=default

Detailed Description

FreeCam is a camera that can be moved freely in the scene using a 6 DoF control scheme.

Constructor & Destructor Documentation

◆ FreeCam() [1/3]

Engine3DRadSpace.Objects.FreeCam.FreeCam ( )
inline

◆ FreeCam() [2/3]

Engine3DRadSpace.Objects.FreeCam.FreeCam ( const std::string & name = "FreeCam",
bool visible = true,
const Math::Vector3 & pos = Math::Vector3::Zero(),
const Math::Quaternion & rotation = Math::Quaternion(),
const Math::Vector3 & up = Math::Vector3::UnitY(),
float aspectRatio = 4.0f/3.0f,
float fov = Math::ToRadians(65.0f),
float npd = 0.01f,
float fpd = 500.0f )
explicit

Complete FreeCam constructor.

Parameters
nameName of this object
visibleIs the camera visible
posInitial position of the camera
rotationInitial rotation of the camera
upUp direction of the camera
aspectRatioAspect ratio of the camera
fovField of view of the camera
npdNear plane distance of the camera
fpdFar plane distance of the camera

◆ FreeCam() [3/3]

Default move constructor for FreeCam.

Parameters
otherThe other FreeCam to move from

Member Function Documentation

◆ ForwardDir()

Math::Vector3 FreeCam::ForwardDir ( ) const
noexcept

Gets the camera's forward direction in world space.

Returns
The direction the camera is heading

◆ GetGizmo()

Objects::Gizmos::IGizmo * FreeCam::GetGizmo ( ) const
overridevirtualnoexcept

Gets the gizmo associated with this object.

Returns

Reimplemented from Engine3DRadSpace.Objects.Camera.

◆ GetUUID()

Reflection::UUID FreeCam::GetUUID ( ) const
overridevirtualnoexcept

Gets the UUID of FreeCam class type.

Returns
{FDA0C96A-3040-4E5C-B12C-D34577D99415}

Reimplemented from Engine3DRadSpace.Objects.Camera.

◆ operator=()

FreeCam & Engine3DRadSpace.Objects.FreeCam.operator= ( FreeCam && other)
defaultnoexcept

Default move assignment operator for FreeCam.

Parameters
otherThe other FreeCam to move from
Returns
The moved FreeCam

◆ SetCameraRotation()

void FreeCam::SetCameraRotation ( const Math::Vector2 & camCoords)
noexcept

Sets the camera rotation using an input vector formed of radians.

Parameters
camCoords

◆ Update()

void FreeCam::Update ( )
overridevirtual

Handles input for this object.

Reimplemented from Engine3DRadSpace.Objects.Camera.

Member Data Documentation

◆ _camCoords

Math::Vector2 Engine3DRadSpace.Objects.FreeCam._camCoords
protected

◆ _dir

Math::Vector3 Engine3DRadSpace.Objects.FreeCam._dir
protected

◆ _fwd

Math::Vector3 Engine3DRadSpace.Objects.FreeCam._fwd
protected

◆ Backward

Input::Key Engine3DRadSpace.Objects.FreeCam.Backward = Input::Key::S

Backward key.

◆ Descend

Input::Key Engine3DRadSpace.Objects.FreeCam.Descend = Input::Key::E

Descend key.

◆ Elevate

Input::Key Engine3DRadSpace.Objects.FreeCam.Elevate = Input::Key::Q

Elevate key.

◆ EnableElevation

bool Engine3DRadSpace.Objects.FreeCam.EnableElevation = true

Enable elevation using the Elevate and Descent keys.

◆ Forward

Input::Key Engine3DRadSpace.Objects.FreeCam.Forward = Input::Key::W

Forward key.

◆ Frozen

bool Engine3DRadSpace.Objects.FreeCam.Frozen = false

Is movement entirely disabled?

◆ InvertX

bool Engine3DRadSpace.Objects.FreeCam.InvertX = false

Invert the X axis for mouse movement.

◆ InvertY

bool Engine3DRadSpace.Objects.FreeCam.InvertY = false

Invert the Y axis for mouse movement.

◆ Left

Input::Key Engine3DRadSpace.Objects.FreeCam.Left = Input::Key::A

Left key.

◆ Right

Input::Key Engine3DRadSpace.Objects.FreeCam.Right = Input::Key::D

Right key.

◆ Sensitivity

float Engine3DRadSpace.Objects.FreeCam.Sensitivity = 0.01f

Camera rotation sensitivity. The higher the value, the more sensitive the camera is to mouse movement.

Property Documentation

◆ BackwardKey

Key Engine3DRadSpace.Objects.FreeCam.BackwardKey
getset

◆ ForwardKey

Key Engine3DRadSpace.Objects.FreeCam.ForwardKey
getset

◆ LeftKey

Key Engine3DRadSpace.Objects.FreeCam.LeftKey
getset

◆ MovementSpeed

float Engine3DRadSpace.Objects.FreeCam.MovementSpeed = 1.0f
getset

Camera movement speed in m/s.

◆ RightKey

Key Engine3DRadSpace.Objects.FreeCam.RightKey
getset

◆ XInverted

bool Engine3DRadSpace.Objects.FreeCam.XInverted
getset

◆ YInverted

bool Engine3DRadSpace.Objects.FreeCam.YInverted
getset

The documentation for this class was generated from the following files:
  • E:/3DRadSpace/3DRadSpace_CSharp/Objects/FreeCam.cs
  • E:/3DRadSpace/Engine3DRadSpace/Objects/Impl/FreeCam.hpp
  • E:/3DRadSpace/Engine3DRadSpace/Objects/Impl/FreeCam.cpp