This page has been translated automatically.
Видеоуроки
Интерфейс
Основы
Продвинутый уровень
Подсказки и советы
Основы
Программирование на C#
Рендеринг
Профессиональный уровень (SIM)
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Режимы вывода изображения
Физика
Браузер SDK 2
Лицензирование и типы лицензий
Дополнения (Add-Ons)
Демонстрационные проекты
API Samples
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Контроль версий
Настройки и предпочтения
Работа с проектами
Настройка параметров ноды
Setting Up Materials
Настройка свойств
Освещение
Sandworm
Использование инструментов редактора для конкретных задач
Расширение функционала редактора
Встроенные объекты
Ноды (Nodes)
Объекты (Objects)
Эффекты
Декали
Источники света
Geodetics
World-ноды
Звуковые объекты
Объекты поиска пути
Player-ноды
Программирование
Основы
Настройка среды разработки
Примеры использования
C++
C#
UnigineScript
Унифицированный язык шейдеров UUSL (Unified UNIGINE Shader Language)
Плагины
Форматы файлов
Материалы и шейдеры
Rebuilding the Engine Tools
Интерфейс пользователя (GUI)
Двойная точность координат
API
Animations-Related Classes
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
VR-Related Classes
Работа с контентом
Оптимизация контента
Материалы
Визуальный редактор материалов
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Учебные материалы

Unigine::MeshAnimation Class

Header: #include <UnigineMesh.h>

MeshAnimation Class

Members

int getNumBones() const#

Returns the current total number of the mesh bones.

Return value

Current number of the mesh bones.

MeshAnimation ( ) #

Constructor. Creates an empty mesh.

MeshAnimation ( const char * path ) #

Constructor. Creates a mesh animation using the specified file.

Arguments

  • const char * path - Path to the mesh animation file.

MeshAnimation ( const Ptr<MeshAnimation> & src ) #

Constructor. Creates a mesh animation using the specified source mesh animation.

Arguments

  • const Ptr<MeshAnimation> & src - Source mesh animation instance.

void assignFrom ( const Ptr<MeshAnimation> & src ) #

Copies the animation data from the source: bones, list of animated bones, and animation frames.

Arguments

  • const Ptr<MeshAnimation> & src - Source mesh animation instance.

void clear ( ) #

Clears the mesh animation data: bones, list of animated bones, and animation frames.

int flipYZ ( ) #

Flips the Y and Z axes for the animation:
  • Y axis becomes equal to -Z
  • Z axis becomes equal to Y

Return value

1 if the axes are flipped successfully; otherwise, 0.

int info ( const char * path ) const#

Returns the information about the specified animation.

Arguments

  • const char * path - Path to the file containing animation.

Return value

int load ( const char * path ) #

Loads the animation (bone names and bone parent indices) from the specified file.

Arguments

  • const char * path - Path to the file containing animation.

Return value

1 if the animation is loaded from the file successfully; otherwise, 0.

int save ( const char * path ) const#

Saves the given animation in the ANIM file format. Creates the given file if it doesn’t exist yet (including subdirectories).

Arguments

  • const char * path - Path to a file including the file name and extension to which animation is to be saved (*.anim).

Return value

1 if the animation is saved successfully; otherwise, 0.

int findBone ( const char * name ) const#

Searches for a bone with a given name and returns its number.

Arguments

  • const char * name - Name of the bone.

Return value

Bone number.

int addBone ( const char * name = 0, int parent = -1 ) #

Appends a new mesh bone.

Arguments

  • const char * name - Bone name. This argument is empty by default.
  • int parent - Parent bone number. The default value is -1 (the new bone has no parent bone).

Return value

Number of mesh bones.

void setBoneName ( int bone, const char * name ) #

Sets the name for the given bone.

Arguments

  • int bone - Bone number.
  • const char * name - Bone name.

const char * getBoneName ( int bone ) const#

Returns the name of the given bone.

Arguments

  • int bone - Bone number.

Return value

Bone name.

void setBoneParent ( int bone, int parent ) #

Sets the bone specified as the second argument as the parent bone for the bone specified as the first argument.

Arguments

  • int bone - Number of the bone, for which the parent will be returned.
  • int parent - Parent bone number, if the parent exists; otherwise, -1.

int getBoneParent ( int bone ) const#

Returns the number of the parent bone for a given one.

Arguments

  • int bone - Number of the bone, for which the parent will be returned.

Return value

Parent bone number, if the parent exists; otherwise, -1.

void setBoneTransform ( int bone, const Math::mat4 & transform ) #

Sets a transformation matrix for the given bone (without considering node transformations).
Notice
Bones can be scaled only uniformly.

Arguments

  • int bone - Bone number.
  • const Math::mat4 & transform - Transformation matrix.

Math::mat4 getBoneTransform ( int bone ) const#

Returns a transformation matrix of the given bone relatively to the parent object (not considering transformations of the Mesh Skinned node itself).

Arguments

  • int bone - Bone number.

Return value

Transformation matrix.

int setBoneTransforms ( const Vector< Math::mat4> & transforms ) #

Sets transformation matrices for all bones. The transforms are in the object-space coordinates (not local, i.e. not bound to the parent bone).

Arguments

  • const Vector< Math::mat4> & transforms - Transformation matrices in the object-space coordinates.

Return value

1 if transforms are set successfully for bones. The return value of 0 means that the number of transforms did not match the number of bones

int getBoneTransforms ( Vector< Math::mat4> & OUT_transforms ) const#

Returns transformation matrices for all bones The transforms are in the object-space coordinates (not local, i.e. not bound to the parent bone).

Arguments

  • Vector< Math::mat4> & OUT_transforms - Transformation matrices in the object-space coordinates.
    Notice
    This output buffer is to be filled by the Engine as a result of executing the method.

int getNumAnimationBones ( ) const#

Returns the total number of mesh animation bones.

Return value

Number of the mesh animation bones.

short getAnimationBoneID ( int num ) const#

Returns the mesh bone ID for the specified animated bone.

Arguments

  • int num - Bone index in the list of animated bones.

Return value

Bone ID in the list of mesh bones.

void setAnimationBones ( const Vector<short> & bone_indices ) #

Copies bones from the given array to the current array of animation bones.

Arguments

  • const Vector<short> & bone_indices - Array of bones taking part in the animation to be set.

void getAnimationBones ( Vector<short> & OUT_bone_indices ) const#

Adds all bones of the given animation to the given array of bones.

Arguments

  • Vector<short> & OUT_bone_indices - Array with indices of bones taking part in the animation.
    Notice
    This output buffer is to be filled by the Engine as a result of executing the method.

int setAnimationBoneTransforms ( const Vector< Math::mat4> & transforms, int frame ) #

Sets transforms for the specified frame. This method applies transformations to all bones in the mesh, then takes transforms for animated bones and writes them into the frame. All transfomrs are object-bound.

Arguments

  • const Vector< Math::mat4> & transforms - Animation bone transformation matrix, in the object space.
  • int frame - Animation frame.

Return value

0, if the number of transforms doesn't match the number of bones in the mesh.

int getAnimationBoneTransforms ( Vector< Math::mat4> & OUT_transforms, int frame ) const#

Returns a transformation matrix for the specified frame. If bones are animated, transforms for them are taken from the frame, if bones are not animated, their transforms are taken from the mesh. All transforms are object-bound.

Arguments

  • Vector< Math::mat4> & OUT_transforms - Animation bone transformation matrix, in the object space.
    Notice
    This output buffer is to be filled by the Engine as a result of executing the method.
  • int frame - Animation frame.

Return value

Always returns 1, as it always performs correctly.

void setNumFrames ( int num ) #

Sets the number of frames for the animation.

Arguments

  • int num - Number of the animation frames.

int getNumFrames ( ) const#

Returns the number of frames for the animation.

Return value

Number of the animation frames.

void setFrame ( int frame, const Vector< Math::mat4> & bones ) #

Sets the animation frame transformation matrices. If the number of transforms does not match the number of animated bones, the method won't be applied.

Arguments

  • int frame - Frame number in the array of the animation frames.
  • const Vector< Math::mat4> & bones - Bones transformation matrices in local space — relevant to the parent bone.

void getFrame ( int frame, Vector< Math::mat4> & OUT_bones ) const#

Returns the animation frame transformation matrices.

Arguments

  • int frame - Frame number in the array of the animation frames.
  • Vector< Math::mat4> & OUT_bones - Bones transformation matrices in local space — relevant to the parent bone.
    Notice
    This output buffer is to be filled by the Engine as a result of executing the method.

void setFrame ( int frame, const Vector< Math::vec3> & xyz, const Vector< Math::quat> & rot, const Vector< Math::vec3> & scale ) #

Sets the animation frame coordinates, rotation quaternions and scaling vectors.

Arguments

  • int frame - Frame number in the array of the animation frames.
  • const Vector< Math::vec3> & xyz - Array with coordinates of the animation frame.
  • const Vector< Math::quat> & rot - Array with rotation quaternions of the animation frame.
  • const Vector< Math::vec3> & scale - Array with scaling vectors of the animation frame.

void getFrame ( int frame, Vector< Math::vec3> & OUT_xyz, Vector< Math::quat> & OUT_rot, Vector< Math::vec3> & OUT_scale ) const#

Returns the animation frame coordinates, rotation quaternions and scaling vectors.

Arguments

  • int frame - Frame number in the array of the animation frames.
  • Vector< Math::vec3> & OUT_xyz - Array with coordinates of the animation frame.
    Notice
    This output buffer is to be filled by the Engine as a result of executing the method.
  • Vector< Math::quat> & OUT_rot - Array with rotation quaternions of the animation frame.
    Notice
    This output buffer is to be filled by the Engine as a result of executing the method.
  • Vector< Math::vec3> & OUT_scale - Array with scaling vectors of the animation frame.
    Notice
    This output buffer is to be filled by the Engine as a result of executing the method.
Last update: 13.12.2024
Build: ()