![]() |
Lysa
0.0
Lysa 3D Engine
|
Base class for all 3D nodes
Inheritance diagram for Node:Public Types | |
| enum | Type { ANIMATION_PLAYER, CAMERA, CHARACTER, COLLISION_AREA, COLLISION_OBJECT, DIRECTIONAL_LIGHT, ENVIRONMENT, KINEMATIC_BODY, LIGHT, MESH_INSTANCE, NODE, OMNI_LIGHT, PHYSICS_BODY, RAYCAST, RIGID_BODY, SKYBOX, SPOT_LIGHT, STATIC_BODY, VIEWPORT } |
| Node type. More... | |
Public Member Functions | |
| Node (const Node &node) | |
| Node (const std::string &name=TypeNames[NODE], Type type=NODE) | |
| auto | getId () const |
| virtual void | onReady () |
| virtual void | onEnterScene () |
| virtual void | onExitScene () |
| virtual void | onProcess (const float alpha) |
| virtual void | onPhysicsProcess (const float delta) |
| virtual bool | onInput (InputEvent &inputEvent) |
| void | setTransformLocal (const float4x4 &transform) |
| const float4x4 & | getTransformGlobal () const |
| const float4x4 & | getTransform () const |
| virtual void | setPosition (const float3 &position) |
| virtual void | setPosition (const float x, const float y, const float z) |
| float3 | getPosition () const |
| void | translate (const float3 &localOffset) |
| void | translate (float x, float y, float z) |
| virtual void | setPositionGlobal (const float3 &position) |
| virtual void | setPositionGlobal (const float x, const float y, const float z) |
| float3 | getPositionGlobal () const |
| void | rotateX (float angle) |
| void | rotateY (float angle) |
| void | rotateZ (float angle) |
| quaternion | getRotation () const |
| quaternion | getRotationGlobal () const |
| float3 | getRotationEulerAngles () const |
| float3 | getRotationEulerAnglesGlobal () const |
| virtual void | scale (float scale) |
| void | setRotation (const quaternion &quat) |
| void | setRotationGlobal (const quaternion &quat) |
| void | setRotationX (float angle) |
| void | setRotationY (float angle) |
| void | setRotationZ (float angle) |
| float | getRotationX () const |
| float | getRotationY () const |
| float | getRotationZ () const |
| float3 | getScale () const |
| float3 | getScaleGlobal () const |
| auto * | getParent () const |
| bool | addChild (std::shared_ptr< Node > child, bool async=false) |
| bool | removeChild (const std::shared_ptr< Node > &child, bool async=false) |
| void | removeAllChildren (bool async=false) |
| bool | haveChild (const std::shared_ptr< Node > &child, bool recursive) const |
| void | lookAt (const float3 &target) |
| template<typename T = Node> | |
| std::shared_ptr< T > | getChild (const std::string &name) const |
| template<typename T = Node> | |
| std::shared_ptr< T > | getChildByPath (const std::string &path) const |
| template<typename T = Node> | |
| std::shared_ptr< T > | findFirstChild (const std::string &name) const |
| template<typename T > | |
| std::shared_ptr< T > | findFirstChild (const bool recursive=true) const |
| template<typename T > | |
| std::list< std::shared_ptr< T > > | findAllChildren (const bool recursive=true) const |
| template<typename T = Node> | |
| std::list< std::shared_ptr< T > > | findAllChildren (const std::string &name, const bool recursive=true) const |
| template<typename T = Node> | |
| std::list< std::shared_ptr< T > > | findAllChildrenByGroup (const std::string &groupName, const bool recursive=true) const |
| const std::list< std::shared_ptr< Node > > & | getChildren () const |
| const std::list< std::string > & | getGroups () const |
| void | addToGroup (const std::string &group) |
| void | removeFromGroup (const std::string &group) |
| bool | isVisible () const |
| virtual void | setVisible (bool visible=true) |
| auto | isInGroup (const std::string &group) const |
| void | setProcessMode (const ProcessMode mode) |
| bool | isProcessed () const |
| auto | getType () const |
| auto | getViewport () const |
| const std::string & | getName () const |
| std::string | getPath () const |
| virtual void | setProperty (const std::string &property, const std::string &value) |
| void | printTree (int tab=0) const |
| std::shared_ptr< Node > | duplicate (bool recursiveFilter=false) const |
| float3 | toGlobal (const float3 &local) const |
| float3 | toLocal (const float3 &global) const |
| float3 | getRightVector () const |
| float3 | getLeftVector () const |
| float3 | getFrontVector () const |
| float3 | getBackVector () const |
| float3 | getUpVector () const |
| float3 | getDownVector () const |
| void | setName (const std::string &nodeName) |
| template<typename T > | |
| std::shared_ptr< Tween > | createPropertyTween (typename PropertyTween< T >::Setter set, const T initial, const T final, float duration, const TransitionType ttype=TransitionType::LINEAR, const Tween::Callback &callback=nullptr) |
| void | killTween (const std::shared_ptr< Tween > &tween) |
| auto | getSharedPtr () |
| ~Node () override = default | |
Public Member Functions inherited from Object | |
| void | connect (const Signal::signal &name, const Signal::Handler &handler) |
| void | connect (const Signal::signal &name, const std::function< void ()> &handler) |
| void | emit (const Signal::signal &name, void *params=nullptr) |
| virtual std::string | toString () const |
| Object () = default | |
| virtual | ~Object () = default |
Public Member Functions inherited from Updatable | |
| auto | isUpdated () const |
| void | decrementUpdates () |
| void | setUpdated () |
| void | setMaxUpdates (const uint32 maxUpdates) |
Static Public Attributes | |
| static constexpr auto | TypeNames |
Protected Member Functions | |
| virtual std::shared_ptr< Node > | duplicateInstance () const |
| virtual void | updateGlobalTransform () |
| virtual void | ready () |
| virtual void | physicsProcess (float delta) |
| virtual void | process (float alpha) |
| virtual void | enterScene () |
| virtual void | exitScene () |
| virtual void | attachToViewport (Viewport *viewport) |
| virtual void | detachFromViewport () |
| virtual void | pause () |
| virtual void | resume () |
Protected Attributes | |
| float4x4 | localTransform {} |
| float4x4 | globalTransform {} |
Additional Inherited Members | |
Public Attributes inherited from Updatable | |
| uint32 | pendingUpdates {0} |
| uint32 | maxUpdates {0} |
| enum Type |
Node type.
| Node | ( | const Node & | node | ) |
Creates a node by copying the transforms, process mode, type and name
| Node | ( | const std::string & | name = TypeNames[NODE], |
| Type | type = NODE |
||
| ) |
Creates a new node at (0.0, 0.0, 0.0) without a parent
|
overridedefault |
| bool addChild | ( | std::shared_ptr< Node > | child, |
| bool | async = false |
||
| ) |
Adds a child node.
Nodes can have any number of children, but a child can have only one parent.
The node will be added to the scene at the start of the next frame.
| child | the node to add |
| async | if true and the node have children all the nodes will be added in batch mode. Be careful to set the visibility of the nodes to falseor they will appear slowly in the scene. |
|
inline |
Adds the node to the group. Groups can be helpful to organize a subset of nodes, for example "enemies" or "stairs".
|
protectedvirtual |
|
inline |
Creates a Tween to tweens a property of the node between an initial value and final value in a span of time equal to duration, in seconds.
|
protectedvirtual |
| std::shared_ptr<Node> duplicate | ( | bool | recursiveFilter = false | ) | const |
Duplicates a node. Warning : not implemented on all node types, check documentation for the node type before using it.
|
protectedvirtual |
Reimplemented in lysa::AnimationPlayer::duplicateInstance(), lysa::RigidBody::duplicateInstance(), lysa::Camera::duplicateInstance(), lysa::MeshInstance::duplicateInstance(), lysa::SpotLight::duplicateInstance(), lysa::OmniLight::duplicateInstance(), lysa::DirectionalLight::duplicateInstance(), lysa::CollisionArea::duplicateInstance(), lysa::Environment::duplicateInstance(), lysa::StaticBody::duplicateInstance(), lysa::KinematicBody::duplicateInstance()
|
protectedvirtual |
|
protectedvirtual |
Reimplemented in lysa::CollisionObject::exitScene()
|
inline |
Finds all children by type
|
inline |
Finds all children by name
|
inline |
Finds all children by group
|
inline |
Finds the first child by is type.
|
inline |
Finds the first child by is name.
|
inline |
Returns the normalized back vector
|
inline |
Returns the child node by is name. Not recursive
|
inline |
Returns the child node by its relative path (does not start with '/')
|
inline |
Returns the immutable list of children nodes
|
inline |
Returns the normalized down vector
|
inline |
Returns the normalized front vector
|
inline |
Returns a list of group names that the node has been added to.
|
inline |
Returns the unique id of the node
|
inline |
Returns the normalized left vector
|
inline |
Returns the node name
|
inline |
Returns the node's parent in the scene tree
| std::string getPath | ( | ) | const |
Returns the node path
|
inline |
Returns the local space position (relative to parent)
|
inline |
Returns the world space position
|
inline |
Returns the normalized right vector
| quaternion getRotation | ( | ) | const |
Returns the rotation of the local transformation
| float3 getRotationEulerAngles | ( | ) | const |
Returns the rotation of the local transformation, in euler angles in radians
| float3 getRotationEulerAnglesGlobal | ( | ) | const |
Returns the rotation of the world transformation, in euler angles in radians
| quaternion getRotationGlobal | ( | ) | const |
Returns the rotation of the world transformation
| float getRotationX | ( | ) | const |
Returns the X axis rotation of the local transformation
| float getRotationY | ( | ) | const |
Returns the Y axis rotation of the local transformation
| float getRotationZ | ( | ) | const |
Returns the Z axis rotation of the local transformation
| float3 getScale | ( | ) | const |
Returns the scale part of the local transformation.
| float3 getScaleGlobal | ( | ) | const |
Returns the scale part of the global transformation.
|
inline |
|
inline |
Returns the local space transformation matrix
|
inline |
Returns the world space transformation matrix
|
inline |
Returns the node type
|
inline |
Returns the normalized up vector
|
inline |
Returns the attached rendering window or nullptr if the node is not attached to a window.
| bool haveChild | ( | const std::shared_ptr< Node > & | child, |
| bool | recursive | ||
| ) | const |
Returns true if the node have this child
|
inline |
Returns true if this node has been added to the given group
| bool isProcessed | ( | ) | const |
Returns true if the node is processed and receive input callbacks
|
inline |
Returns the visibility of the node.
| void killTween | ( | const std::shared_ptr< Tween > & | tween | ) |
Removes the tween from the processing list
| void lookAt | ( | const float3 & | target | ) |
|
inlinevirtual |
Called when a node is added to the scene
|
inlinevirtual |
Called when a node is removed from the scene
|
inlinevirtual |
Called on a keyboard, mouse or gamepad event
|
inlinevirtual |
Called just after the physics system has been updated (can be called multiple times if we have free time between frames)
|
inlinevirtual |
Called each frame after the physics have been updated and just before drawing the frame
|
inlinevirtual |
Called when a node is ready to initialize, before being added to the scene
|
protectedvirtual |
Reimplemented in lysa::CollisionObject::pause()
|
protectedvirtual |
Reimplemented in lysa::Character::physicsProcess(), lysa::RayCast::physicsProcess()
| void printTree | ( | int | tab = 0 | ) | const |
Recursively prints the node tree in the log system
|
protectedvirtual |
|
protectedvirtual |
| void removeAllChildren | ( | bool | async = false | ) |
Removes all children nodes. The nodes, along with their children can be deleted depending on their reference counters. The nodes will be removed from the scene at the start of the next frame.
| async | if true and the nodes will be removed in batch mode. Be careful to set the visibility of the nodes to false or they will disappear slowly from the scene. |
| bool removeChild | ( | const std::shared_ptr< Node > & | child, |
| bool | async = false |
||
| ) |
Removes a child node. The node, along with its children can be deleted depending on their reference counter.
Use the iterator version in a for-each loop.
The node will be removed from the scene at the start of the next frame.
| child | the node to remove |
| async | if true and the node have children all the nodes will be removed in batch mode. Be careful to set the visibility of the nodes to false or they will disappear slowly from the scene. |
|
inline |
Removes the node from the given group. Does nothing if the node is not in the group
|
protectedvirtual |
Reimplemented in lysa::Character::resume(), lysa::CollisionObject::resume()
| void rotateX | ( | float | angle | ) |
Rotates the local transformation
Interpolate the local transformation
Rotates the local transformation around the X axis by angle in radians.
| void rotateY | ( | float | angle | ) |
Rotates the local transformation around the Y axis by angle in radians.
| void rotateZ | ( | float | angle | ) |
Rotates the local transformation around the Z axis by angle in radians.
|
virtual |
Rotates the local transformation
Scale the local transformation
Reimplemented in lysa::CollisionObject::scale()
|
inline |
Sets the node name (purely informative)
|
inlinevirtual |
Sets the local space position (relative to parent)
|
virtual |
Sets the local space position (relative to parent)
|
inlinevirtual |
Sets the world space position
|
virtual |
Sets the world space position
|
inline |
Changes the node's processing behavior.
|
virtual |
Sets a property by its name and value. Currently, not all properties in all node classes are supported.
Reimplemented in lysa::Light::setProperty(), lysa::RigidBody::setProperty(), lysa::CollisionObject::setProperty(), lysa::MeshInstance::setProperty(), lysa::SpotLight::setProperty(), lysa::DirectionalLight::setProperty(), lysa::OmniLight::setProperty(), lysa::CollisionArea::setProperty(), lysa::Environment::setProperty(), lysa::PhysicsBody::setProperty()
| void setRotation | ( | const quaternion & | quat | ) |
Sets the local transformation
| void setRotationGlobal | ( | const quaternion & | quat | ) |
Sets the world transformation
| void setRotationX | ( | float | angle | ) |
Sets the local transformation
Sets the X axis rotation of the local transformation by angle in radians.
| void setRotationY | ( | float | angle | ) |
Sets the Y axis rotation of the local transformation by angle in radians.
| void setRotationZ | ( | float | angle | ) |
Sets the Z axis rotation of the local transformation by angle in radians.
| void setTransformLocal | ( | const float4x4 & | transform | ) |
Returns the local space transformation matrix
|
virtual |
Changes the visibility of the node.
The node stays in the scene tree and the data in VRAM.
Reimplemented in lysa::Character::setVisible(), lysa::CollisionObject::setVisible()
| float3 toGlobal | ( | const float3 & | local | ) | const |
Transforms a local vector from this node's local space to world space.
| float3 toLocal | ( | const float3 & | global | ) | const |
Transforms a world space vector to this node's local space.
| void translate | ( | const float3 & | localOffset | ) |
Changes the node's position by the given offset vector in local space.
| void translate | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
Changes the node's position by the given offset vector in local space.
|
protectedvirtual |
Reimplemented in lysa::CollisionObject::updateGlobalTransform()
|
friend |
|
friend |
|
friend |
|
protected |
|
protected |
|
staticconstexpr |