|
Oxygen Engine
Modern C++ 3D Engine using OpenGL
|
Skinned mesh node. More...
#include <OxygenEngine/scene/node/skinned_mesh.h>
Inheritance diagram for oe::scene::SkinnedMeshNode:
Collaboration diagram for oe::scene::SkinnedMeshNode:Public Member Functions | |
| SkinnedMeshNode (std::shared_ptr< oe::scene::SkinnedMesh > mesh=nullptr) | |
| void | addMesh (std::shared_ptr< oe::scene::SkinnedMesh > mesh, Material *material=nullptr) |
| void | addBone (Node *node=nullptr, const glm::mat4 inverse_bind_matrix=glm::mat4(1.0)) |
| oe::scene::SkinnedMesh getMesh() { return _mesh; } | |
| virtual void | update (const std::chrono::nanoseconds delta, const int8_t flags=0) override |
| const std::vector< glm::mat4 > | getBonesMatrices () const |
| const std::vector< skin::Bone > & | getBones () const |
| virtual std::unique_ptr< oe::render::Node > | generateRenderNode () override |
Public Member Functions inherited from oe::scene::RenderableNode | |
| Material & | generateMaterial () |
| Material & | getMaterial (size_t id=0) |
| std::vector< Material > & | getAllMaterials () |
Public Member Functions inherited from oe::scene::Node | |
| const Node * | getParentNode () const noexcept |
| Node * | getParentNode () noexcept |
| Manager * | getSceneManager () |
| void | addChild (Node &child) |
| const std::vector< oe::scene::Node * > & | getChildren () noexcept |
| const std::vector< oe::scene::Node * > & | getChildren () const noexcept |
| void | setParent (Node &parent) noexcept |
| Change the parent of this node. | |
| void | moveToRoot () noexcept |
| Detach the node from parent to make a root node. | |
| void | foreachChildren (void(*func)(Node &, void *), const bool recursion=false, void *user_data=nullptr) |
| Do actions on children. | |
| void | foreachChildren (std::function< void(Node &)> func, const bool recursion=false) |
| Do actions on children. | |
| const std::string | getAbsoluteName (const std::string &separator="/") const noexcept |
| Get absolute name (from the hierarchy) | |
| template<typename T = Node> | |
| T * | search (const std::string path, const std::string separator="/") |
| Search for a node among children using a name path. | |
| bool | isVisible () const |
| void | setVisible (const bool &is_visible=true) |
| bool | canRender (const scene::Camera &camera) const |
| const AABB & | getBoundingBox () const |
| Recompute and return bounding box from raw AABB. | |
| const AABB | getEnglobingBoundingBox () const |
| Compute englobing bounding box including all children ones. | |
| std::vector< Node * > | getAllParents () const |
| Get all node parents hierarchy of the node. | |
| Transform | getAbsoluteTransform () const |
| Get Node transform relative from world origin. | |
| glm::vec3 | getAbsolutePosition () const |
| Get Node position from world origin. | |
| const glm::mat4 & | getAbsoluteModelMatrix () const |
| Get absolute model matrix (by taking the parents into account) | |
| const glm::mat4 | getAbsoluteInverseModelMatrix () const |
| Get absolute inverse model matrix (by taking the parents into account) | |
| glm::quat | getRotationNeededToLookAt (const glm::vec3 &target, const glm::vec3 &up=glm::vec3(0.f, 1.f, 0.f)) const |
| Get the rotation needed to orient the node at a specified target. | |
| void | lookAt (const glm::vec3 &target, const glm::vec3 &up=glm::vec3(0.f, 1.f, 0.f)) |
| Orient the node to stare at a specified target. | |
| void | generateModel (const bool recursive=true) const |
| Force regeneration of Models Matrices. | |
Public Member Functions inherited from oe::scene::Transform | |
| Transform (const glm::vec3 &translation=glm::vec3(0.f), const glm::quat &rotation=glm::quat(1.f, 0.f, 0.f, 0.f), const glm::vec3 &scale=glm::vec3(1.f), const glm::vec3 &skew=glm::vec3(0.f), const glm::vec4 &perspective=glm::vec4(glm::vec3(0.f), 1.f)) | |
| Generate Transform from its translation, rotation, scale values. | |
| Transform (const glm::mat4 &model) | |
| Generate Transform from a model matrix. | |
| const glm::vec3 & | getTranslation () const |
| Get Translation component value of the transform. | |
| const glm::vec3 & | getPosition () const |
| Get Translation component value of the transform. | |
| const glm::quat & | getRotation () const |
| Get Rotation component value of the transform. | |
| const glm::vec3 & | getScale () const |
| Get Scaling component value of the transform. | |
| const glm::vec3 & | getSkew () const |
| Get Skew component value of the transform. | |
| const glm::vec4 & | getPerspective () const |
| get Perspective component value of the transform | |
| void | setTranslation (const float x, const float y, const float z) |
| Translate to the specified position, filled component wise. | |
| void | setPosition (const glm::vec3 &position) |
| Translate to the specified position. | |
| void | setPosition (const float x, const float y, const float z) |
| Translate to the specified position. | |
| void | setRotation (const float x, const float y, const float z) |
| Set rotation from Euler angles. | |
| void | setRotation (const lit::Angle &x, const lit::Angle &y, const lit::Angle &z) |
| Relatively rotate the transform using a lit::Angle triad. | |
| void | setScale (const float x, const float y, const float z) |
| Set scaling. | |
| void | relativeTranslate (const glm::vec3 &translation) |
| Translate the transform from current position. | |
| void | relativeTranslate (const float x, const float y, const float z) |
| Translate the transform from current position, component wise. | |
| void | loadFromModel (const glm::mat4 &model) |
| Fill the transform from a model matrix. | |
| void | relativeMove (const glm::vec3 &translation) |
| Move the transform relative to current translation. | |
| void | relativeRotate (const glm::quat &quaternion) |
| Rotate the transform relative to current rotation. | |
| void | relativeRotate (const float x, const float y, const float z) |
| Rotate the transform from Euler angles (component wise) | |
| void | relativeRotate (const lit::Angle &x, const lit::Angle &y, const lit::Angle &z) |
| Relatively rotate the transform using a lit::Angle triad. | |
| void | relativeScale (const glm::vec3 &scale) |
| Multiply current scale by the new one. | |
| void | setSkew (const glm::vec3 &skew) |
| Set skew of the transform. | |
| void | setPerspective (const glm::vec4 &perspective) |
| Set perspective effect of the transform. | |
| void | interpolateWith (const float ratio, const Transform &target) |
| Interpolate this transform with another one. | |
| void | fillFrom (const Transform &transform) |
| Fill current values from another transform. | |
| template<TranslationType T> | |
| void | setTranslation (const T &translation) |
| Translate to the specified position. | |
| template<RotationType R> | |
| void | setRotation (const R &rotation) |
| Get rotation quaternion from a generic type. | |
| template<ScaleType S> | |
| void | setScale (const S &scale) |
| Set scale vector from a generic type. | |
| template<TranslationType T> | |
| void | getTranslationAs (T &result) const |
| Get translation vector and fill in generic type. | |
| template<RotationType R> | |
| void | getRotationAs (R &result) const |
| Get rotation quaternion and fill in generic type. | |
| template<ScaleType S> | |
| void | getScaleAs (S &result) const |
| Get scale vector and fill in generic type. | |
| glm::mat4 | getModelMatrix () const |
| Generate a Model matrix from the transform. | |
| bool | isDirty () const |
| Check if something modified this transform. | |
Public Member Functions inherited from oe::component::HasComponents< Node, NodeComponent > | |
| HasComponents (Node &entity) | |
| ComponentList< Node, NodeComponent > & | getComponents () noexcept |
| Get components bound to the entity. | |
| const ComponentList< Node, NodeComponent > & | getComponents () const noexcept |
| Get components bound to the entity. | |
| std::shared_ptr< T > | addComponent (Args &&... args) |
| Add a new a component. | |
| std::shared_ptr< T > | addNamedComponent (const std::string &name, Args &&... args) |
| Add a new a component. | |
| void | removeComponent (const std::string &name) |
| Remove a component. | |
| const T * | getComponentByType () const noexcept |
| Fetch a component by its type. | |
| T * | getComponentByType () noexcept |
| Fetch a component by its type. | |
| T * | getComponentByName (const std::string &name) noexcept |
| Fetch a component when you know its name. | |
| const T * | getComponentByName (const std::string &name) const noexcept |
| Fetch a component when you know its name. | |
Friends | |
| class | oe::render::SkinnedMeshNode |
Additional Inherited Members | |
Public Attributes inherited from oe::scene::Node | |
| std::string | name = "" |
| Name, used as identifier for search. | |
| AABB | raw_aabb |
| Raw bounding box (ie. without taking node transform) | |
Protected Member Functions inherited from oe::scene::Transform | |
| void | forceDirty (const bool is_dirty) const |
| Set custom dirty status. | |
Protected Member Functions inherited from oe::util::NonCopyable | |
| NonCopyable (NonCopyable &&)=default | |
| NonCopyable & | operator= (NonCopyable &&)=default |
Protected Attributes inherited from oe::scene::RenderableNode | |
| std::vector< Material > | _materials |
Protected Attributes inherited from oe::scene::Node | |
| AABB | _aabb |
Protected Attributes inherited from oe::component::HasComponents< Node, NodeComponent > | |
| ComponentList< Node, NodeComponent > | _components |
Skinned mesh node.
Skinned meshes are meshes where animations are based on bones/joints that are used to deform the mesh (for example humanoïd avatars)
Skinned can also have blendshapes
The node can contain multiple meshes, each one have their corresponding material
| oe::scene::SkinnedMeshNode::SkinnedMeshNode | ( | std::shared_ptr< oe::scene::SkinnedMesh > | mesh = nullptr | ) |
Constructor
| mesh | Sub mesh to add |
| void oe::scene::SkinnedMeshNode::addBone | ( | Node * | node = nullptr, |
| const glm::mat4 | inverse_bind_matrix = glm::mat4(1.0) |
||
| ) |
oe::scene::SkinnedMesh getMesh() { return _mesh; }
Add a bone to the node
| inverse_bind_matrix | Matrix to convert model space to bone space |
| node | Node bound to the bone, if none provided its assumed that the bone will stay at same transform |
| void oe::scene::SkinnedMeshNode::addMesh | ( | std::shared_ptr< oe::scene::SkinnedMesh > | mesh, |
| Material * | material = nullptr |
||
| ) |
Add a new skinned mesh to the node
| mesh | Submesh to add |
| material | Material to use as duplicate source to fill the material related to this mesh |
|
overridevirtual |
Generate a render node from this node
Reimplemented from oe::scene::RenderableNode.
|
inline |
Get all bones
You can use it for example to fetch the node related to each bones, or to do collision detection on the bounding boxes
|
inline |
Get bones matrices
For example, in a vertex shader, vertex positions might be calculated as
|
overridevirtual |
Update the bones' matrices from associated nodes and bounding boxes
| delta | time since last call of this function |
| flags | custom flags |
Reimplemented from oe::scene::Node.