Nameless Engine
Loading...
Searching...
No Matches
ne::EditorCameraNode Class Reference

#include <EditorCameraNode.h>

Inheritance diagram for ne::EditorCameraNode:
ne::CameraNode ne::SpatialNode ne::Node ne::Serializable

Public Member Functions

 EditorCameraNode (const std::string &sNodeName)
 
void setIgnoreInput (bool bIgnore)
 
- Public Member Functions inherited from ne::CameraNode
 CameraNode (const std::string &sNodeName)
 
void makeActive ()
 
void setCameraMode (CameraMode mode)
 
void setOrbitalTargetLocation (const glm::vec3 &targetPointLocation)
 
void clearOrbitalTargetLocation ()
 
void setOrbitalRotation (float phi, float theta)
 
void setOrbitalDistanceToTarget (float distanceToTarget)
 
glm::vec3 getOrbitalTargetLocation ()
 
CameraPropertiesgetCameraProperties ()
 
- Public Member Functions inherited from ne::SpatialNode
 SpatialNode (const std::string &sNodeName)
 
void setRelativeLocation (const glm::vec3 &location)
 
void setRelativeRotation (const glm::vec3 &rotation)
 
void setRelativeScale (const glm::vec3 &scale)
 
void setWorldLocation (const glm::vec3 &location)
 
void setWorldRotation (const glm::vec3 &rotation)
 
void setWorldScale (const glm::vec3 &scale)
 
glm::vec3 getRelativeLocation () const
 
glm::vec3 getRelativeRotation () const
 
glm::vec3 getRelativeScale () const
 
glm::mat4x4 getRelativeRotationMatrix ()
 
glm::vec3 getWorldLocation ()
 
glm::vec3 getWorldRotation ()
 
glm::quat getWorldRotationQuaternion ()
 
glm::vec3 getWorldScale ()
 
glm::vec3 getWorldForwardDirection ()
 
glm::vec3 getWorldRightDirection ()
 
glm::vec3 getWorldUpDirection ()
 
glm::mat4x4 getWorldMatrix ()
 
std::pair< std::recursive_mutex, sgc::GcPtr< SpatialNode > > * getClosestSpatialParent ()
 
- Public Member Functions inherited from ne::Node
 Node ()
 
 Node (const std::string &sName)
 
 Node (const Node &)=delete
 
Nodeoperator= (const Node &)=delete
 
 Node (Node &&)=delete
 
Nodeoperator= (Node &&)=delete
 
virtual ~Node () override
 
void setNodeName (const std::string &sName)
 
void detachFromParentAndDespawn ()
 
void addChildNode (const sgc::GcPtr< Node > &pNode, AttachmentRule locationRule=AttachmentRule::KEEP_WORLD, AttachmentRule rotationRule=AttachmentRule::KEEP_WORLD, AttachmentRule scaleRule=AttachmentRule::KEEP_WORLD)
 
void setSerialize (bool bSerialize)
 
std::optional< ErrorserializeNodeTree (const std::filesystem::path &pathToFile, bool bEnableBackup)
 
std::string getNodeName () const
 
sgc::GcPtr< NodegetWorldRootNode ()
 
std::pair< std::recursive_mutex, sgc::GcPtr< Node > > * getParentNode ()
 
std::pair< std::recursive_mutex, sgc::GcVector< sgc::GcPtr< Node > > > * getChildNodes ()
 
template<typename NodeType >
requires std::derived_from<NodeType, Node>
sgc::GcPtr< NodeType > getParentNodeOfType (const std::string &sParentNodeName="")
 
template<typename NodeType >
requires std::derived_from<NodeType, Node>
sgc::GcPtr< NodeType > getChildNodeOfType (const std::string &sChildNodeName="")
 
TickGroup getTickGroup () const
 
std::optional< size_t > getNodeId () const
 
bool isCalledEveryFrame ()
 
bool isReceivingInput ()
 
bool isSpawned ()
 
bool isParentOf (Node *pNode)
 
bool isChildOf (Node *pNode)
 
bool isSerialized () const
 
- Public Member Functions inherited from ne::Serializable
std::optional< Errorserialize (std::filesystem::path pathToFile, bool bEnableBackup, const std::unordered_map< std::string, std::string > &customAttributes={})
 
std::variant< std::string, Errorserialize (toml::value &tomlData, const std::string &sEntityId="", const std::unordered_map< std::string, std::string > &customAttributes={}, const std::optional< std::filesystem::path > &optionalPathToFile={}, bool bEnableBackup=false)
 
std::variant< std::string, Errorserialize (toml::value &tomlData, Serializable *pOriginalObject, std::string sEntityId="", const std::unordered_map< std::string, std::string > &customAttributes={}, const std::optional< std::filesystem::path > &optionalPathToFile={}, bool bEnableBackup=false)
 
std::optional< std::pair< std::string, std::string > > getPathDeserializedFromRelativeToRes () const
 

Protected Member Functions

virtual void onBeforeNewFrame (float timeSincePrevFrameInSec) override
 
virtual void onMouseMove (double xOffset, double yOffset) override
 
virtual void onAfterAttachedToNewParent (bool bThisNodeBeingAttached) override
 
- Protected Member Functions inherited from ne::CameraNode
virtual void onWorldLocationRotationScaleChanged () override
 
virtual void onDespawning () override
 
- Protected Member Functions inherited from ne::SpatialNode
virtual void onAfterDeserialized () override
 
virtual void onSpawning () override
 
virtual void onAfterAttachedToNewParent (bool bThisNodeBeingAttached) override
 
virtual void onWorldLocationRotationScaleChanged ()
 
- Protected Member Functions inherited from ne::Node
void setIsCalledEveryFrame (bool bEnable)
 
void setTickGroup (TickGroup tickGroup)
 
void setIsReceivingInput (bool bEnable)
 
TimercreateTimer (const std::string &sTimerName)
 
template<typename FunctionType >
NodeNotificationBroadcaster< FunctionType > * createNotificationBroadcaster ()
 
std::pair< std::recursive_mutex, std::unordered_map< unsigned int, std::function< void(KeyboardModifiers, bool)> > > * getActionEventBindings ()
 
std::pair< std::recursive_mutex, std::unordered_map< unsigned int, std::function< void(KeyboardModifiers, float)> > > * getAxisEventBindings ()
 
std::recursive_mutex * getSpawnDespawnMutex ()
 
virtual void onMouseMove (double xOffset, double yOffset)
 
virtual void onMouseScrollMove (int iOffset)
 
virtual void onBeforeNewFrame (float timeSincePrevFrameInSec)
 
virtual void onSpawning ()
 
virtual void onChildNodesSpawned ()
 
virtual void onDespawning ()
 
virtual void onBeforeDetachedFromParent (bool bThisNodeBeingDetached)
 
virtual void onAfterAttachedToNewParent (bool bThisNodeBeingAttached)
 
virtual void onAfterDeserialized ()
 

Private Attributes

glm::vec3 lastInputDirection = glm::vec3(0.0F, 0.0F, 0.0F)
 
float currentMovementSpeed = 0.0F
 
float currentMovementSpeedMultiplier = 1.0F
 
bool bIgnoreInput = true
 

Static Private Attributes

static constexpr double rotationSensitivity = 0.1
 
static constexpr float movementSpeed = 5.0F
 
static constexpr float speedIncreaseMultiplier = 2.0F
 
static constexpr float speedDecreaseMultiplier = 0.5F
 

Additional Inherited Members

- Public Types inherited from ne::Node
enum class  AttachmentRule { RESET_RELATIVE , KEEP_RELATIVE , KEEP_WORLD }
 
- Static Public Member Functions inherited from ne::Node
static size_t getAliveNodeCount ()
 
static std::variant< sgc::GcPtr< Node >, ErrordeserializeNodeTree (const std::filesystem::path &pathToFile)
 
static GameInstancegetGameInstance ()
 
- Static Public Member Functions inherited from ne::Serializable
static std::optional< ErrorserializeMultiple (std::filesystem::path pathToFile, std::vector< SerializableObjectInformation > vObjects, bool bEnableBackup)
 
static std::variant< std::set< std::string >, ErrorgetIdsFromFile (std::filesystem::path pathToFile)
 
template<typename SmartPointer , typename InnerType = typename SmartPointer::element_type>
requires std::derived_from<InnerType, Serializable> && (std::same_as<SmartPointer, sgc::GcPtr<InnerType>> || std::same_as<SmartPointer, std::unique_ptr<InnerType>>)
static std::variant< SmartPointer, Errordeserialize (const std::filesystem::path &pathToFile)
 
template<typename SmartPointer , typename InnerType = typename SmartPointer::element_type>
requires std::derived_from<InnerType, Serializable> && (std::same_as<SmartPointer, sgc::GcPtr<InnerType>> || std::same_as<SmartPointer, std::unique_ptr<InnerType>>)
static std::variant< SmartPointer, Errordeserialize (const std::filesystem::path &pathToFile, std::unordered_map< std::string, std::string > &customAttributes)
 
template<typename SmartPointer , typename InnerType = typename SmartPointer::element_type>
requires std::derived_from<InnerType, Serializable> && (std::same_as<SmartPointer, sgc::GcPtr<InnerType>> || std::same_as<SmartPointer, std::unique_ptr<InnerType>>)
static std::variant< SmartPointer, Errordeserialize (std::filesystem::path pathToFile, std::unordered_map< std::string, std::string > &customAttributes, const std::string &sEntityId)
 
template<typename SmartPointer , typename InnerType = typename SmartPointer::element_type>
requires std::derived_from<InnerType, Serializable> && (std::same_as<SmartPointer, sgc::GcPtr<InnerType>> || std::same_as<SmartPointer, std::unique_ptr<InnerType>>)
static std::variant< SmartPointer, Errordeserialize (const std::filesystem::path &pathToFile, const std::string &sEntityId)
 
template<typename SmartPointer , typename InnerType = typename SmartPointer::element_type>
requires std::same_as<SmartPointer, sgc::GcPtr<Serializable>> || std::same_as<SmartPointer, std::unique_ptr<Serializable>>
static std::variant< std::vector< DeserializedObjectInformation< SmartPointer > >, ErrordeserializeMultiple (std::filesystem::path pathToFile, const std::set< std::string > &ids)
 
template<typename SmartPointer , typename InnerType = typename SmartPointer::element_type>
requires std::derived_from<InnerType, Serializable> && (std::same_as<SmartPointer, sgc::GcPtr<InnerType>> || std::same_as<SmartPointer, std::unique_ptr<InnerType>>)
static std::variant< SmartPointer, Errordeserialize (const toml::value &tomlData, std::unordered_map< std::string, std::string > &customAttributes, std::string sEntityId="", std::optional< std::filesystem::path > optionalPathToFile={})
 

Detailed Description

Camera used in the editor.

Constructor & Destructor Documentation

◆ EditorCameraNode()

ne::EditorCameraNode::EditorCameraNode ( const std::string &  sNodeName)

Creates a new node with the specified name.

Parameters
sNodeNameName of this node.

Member Function Documentation

◆ onAfterAttachedToNewParent()

void ne::EditorCameraNode::onAfterAttachedToNewParent ( bool  bThisNodeBeingAttached)
overrideprotectedvirtual

Called after this node or one of the node's parents (in the parent hierarchy) was attached to a new parent node.

Warning
If overriding you must call the parent's version of this function first (before executing your login) to execute parent's logic.
Remarks
This function will also be called on all child nodes after this function is finished.
Parameters
bThisNodeBeingAttachedtrue if this node was attached to a parent, false if some node in the parent hierarchy was attached to a parent.

Reimplemented from ne::SpatialNode.

◆ onBeforeNewFrame()

void ne::EditorCameraNode::onBeforeNewFrame ( float  timeSincePrevFrameInSec)
overrideprotectedvirtual

Called before a new frame is rendered.

Remarks
This function will only be called while this node is spawned.
Warning
If overriding you must call the parent's version of this function first (before executing your login) to execute parent's logic (if there is any).
Parameters
timeSincePrevFrameInSecAlso known as deltatime - time in seconds that has passed since the last frame was rendered.

Reimplemented from ne::Node.

◆ onMouseMove()

void ne::EditorCameraNode::onMouseMove ( double  xOffset,
double  yOffset 
)
overrideprotectedvirtual

Called when the window received mouse movement.

Remarks
This function will only be called while this node is spawned.
Parameters
xOffsetMouse X movement delta in pixels (plus if moved to the right, minus if moved to the left).
yOffsetMouse Y movement delta in pixels (plus if moved up, minus if moved down).

Reimplemented from ne::Node.

◆ setIgnoreInput()

void ne::EditorCameraNode::setIgnoreInput ( bool  bIgnore)

Sets whether to ignore user input or not.

Parameters
bIgnoretrue to ignore, false otherwise.

Member Data Documentation

◆ bIgnoreInput

bool ne::EditorCameraNode::bIgnoreInput = true
private

Determines whether the camera should ignore the user input or not. Generally we only want to process user input when some special condition is met (for ex. mouse captured).

◆ currentMovementSpeed

float ne::EditorCameraNode::currentMovementSpeed = 0.0F
private

Editor camera's current movement speed.

◆ currentMovementSpeedMultiplier

float ne::EditorCameraNode::currentMovementSpeedMultiplier = 1.0F
private

Stores speedIncreaseMultiplier or speedDecreaseMultiplier when the user holds a special button.

◆ lastInputDirection

glm::vec3 ne::EditorCameraNode::lastInputDirection = glm::vec3(0.0F, 0.0F, 0.0F)
private

Last received user input direction for moving the camera.

◆ movementSpeed

constexpr float ne::EditorCameraNode::movementSpeed = 5.0F
staticconstexprprivate

Speed of editor camera's movement.

◆ rotationSensitivity

constexpr double ne::EditorCameraNode::rotationSensitivity = 0.1
staticconstexprprivate

Rotation multiplier for editor's camera.

◆ speedDecreaseMultiplier

constexpr float ne::EditorCameraNode::speedDecreaseMultiplier = 0.5F
staticconstexprprivate

Camera speed multiplier when slow movement mode is enabled (for ex. Ctrl is pressed).

◆ speedIncreaseMultiplier

constexpr float ne::EditorCameraNode::speedIncreaseMultiplier = 2.0F
staticconstexprprivate

Camera speed multiplier when fast movement mode is enabled (for ex. Shift is pressed).


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