UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Migration
Migrating to UNIGINE 2.0
C++ API Migration
Migrating from UNIGINE 2.0 to UNIGINE 2.1

Unigine::ObjectMeshSkinned Class

The updated Unigine::ObjectMeshSkinned class provides the following features:

  • Up to 7 active morph targets per surface with arbitrary weights available for any kind of animations. The overall number of morph targets is not limited.
  • Animation layers with all of the animation buffers functionality.
    Notice
    Animation buffers have been removed. Use the animation layers instead.
  • Unified vertex format with the ObjectMeshStatic class.
UNIGINEUNIGINE 2.0Comments
-Ptr< ObjectMeshSkinned > create(const MeshPtr & mesh) An ObjectMeshSkinned constructor that receives a mesh smart pointer.
Ptr< ObjectMeshSkinned > create(const char * name)Ptr< ObjectMeshSkinned > create(const char * name, int dynamic) An ObjectMeshSkinned constructor that receives a dynamic mesh flag as the second argument.
-static int type() ObjectMeshSkinned type.
-int createMesh(const char * name, int dynamic) A new function. Creates a mesh.
-int loadMesh(const char * name) A new function. It loads a new mesh, but doesn't change the mesh name. So, you should use it together with void setMeshName().
int save(const char * name)int saveMesh(const char * name) Renamed.
-virtual int setMesh(const MeshPtr & mesh) const =0 Copies the source mesh into the current mesh.
-virtual int getMesh(const MeshPtr & mesh) const =0 Copies the current mesh into the source mesh.
-virtual void flushMesh() const =0 Flushes the mesh geometry into the video memory.
-virtual void setMeshName(const char * name) const =0 Sets the mesh name.
-virtual const char * getMeshName() const =0 Returns the mesh name.
-virtual void setAnimName(const char * name) const =0 Sets the animation name.
-virtual const char * getAnimName() const =0 Returns the name of the current animation.
int addBone(const char * name, int parent)- Removed. Use the int addBone(const char * name, int parent) function of the Unigine::Mesh class.
int addFrame(const mat4 * transforms)- Removed.
int addMeshFrame(Ptr < ObjectMeshSkinned > mesh, int frame)- Removed.
void setSurfaceTransform(const mat4 & transform, int surface)void setSurfaceTransform(const mat4 & transform, int surface, int target) Transforms the mesh surface.
-void setAnimName() Sets the name for the animation.
-const char * getAnimName() Returns the name of the current animation.
-void setQuaternion(int quaternion) Sets the quaternion skinning mode.
-int isQuaternion() Returns the value indicating if the quaternion skinning mode is used.
-virtual void setControlled(int c) const =0 Sets a value indicating if the animation should be controlled by a parent ObjectMeshSkinned (useful for attaching clothes to a character body).
-virtual int isControlled() const =0 Returns a value indicating if the animation is controlled by a parent ObjectMeshSkinned.
-virtual void updateSurfaceBounds(int surface) const =0 Updates mesh bounds.
int addMeshSurface(const char * name, Ptr< ObjectMeshSkinned > mesh, int surface)int addMeshSurface(const char * name, const Ptr< ObjectMeshSkinned > & mesh, int surface, int target) The new function receives the number of the surface morph target as the 4th argument.
int addMeshSurface(int dest_surface, Ptr< ObjectMeshSkinned > mesh, int surface)int addMeshSurface(int dest_surface, const Ptr< ObjectMeshSkinned > & mesh, int surface, int target) The new function receives the number of the surface morph target as the 4th argument.
-virtual int addMeshSurface(const char * name, const MeshPtr & mesh, int surface, int target) const =0 Appends a new mesh surface to the current mesh.
void updateSurfaces()- Removed. See void updateSurfaceBounds(int surface).
-int getMeshSurface(const MeshPtr & mesh, int surface, int target) Copies the specified mesh surface into the source mesh.
-virtual int addSurfaceTarget(int surface, const char * name) const =0 Appends a surface target into the mesh.
void setVertex(int num, const vec3 & xyz, int surface)void setVertex(int num, const vec3 & vertex, int surface, int target) The new function receives the number of the surface morph target as the 4th argument.
vec3 getVertex(int num, int surface)vec3 getVertex(int num, int surface, int target) The new function receives the number of the surface morph target as the 3rd argument.
void setNormal(int num, const vec3 & normal, int surface)- Removed. Use void setTangent(int num, const quat & tangent, int surface, int target).
vec3 getNormal(int num, int surface)vec3 getNormal(int num, int surface, int target) Returns normal of a given vertex. Also, you can use quat getTangent(int num, int surface, int target) to get the normal.
-vec3 getSkinnedVertex(int num, int surface) Returns skinned coordinates of the given vertex.
-int getNumTangents(int surface) Returns the number of tangents for the given mesh surface.
void setTangent(int num, const vec4 & tangent, int surface)void setTangent(int num, const quat & tangent, int surface, int target) Now the tangent basis is stored as quaternion. So, the type of the second function argument has been changed.
vec4 getTangent(int num, int surface)quat getTangent(int num, int surface, int target) Now the tangent basis is stored as quaternion. So, the type of the return value has been changed.
-virtual quat getSkinnedTangent(int num, int index, int surface) const =0 Returns skinned tangent of a given vertex.
-virtual vec3 getSkinnedNormal(int num, int index, int surface) const =0 Returns the skinned normal for the given vertex.
void setTexCoord(int num, const vec4 & texcoord, int surface)- Removed. Use void setTexCoord0(int num, const vec2 & texcoord, int surface) for the 1st UV map and void setTexCoord1(int num, const vec2 & texcoord, int surface) for the 2nd UV map.
vec4 getTexCoord(int num, int surface)- Removed. Use vec2 getTexCoord0(int num, int surface) for the 1st UV map and vec2 getTexCoord1(int num, int surface) for the 2nd UV map.
-virtual int getNumTexCoords0(int surface) const =0 Returns the number of first texture coordinates.
-virtual int getNumTexCoords1(int surface) const =0 Returns the number of second texture coordinates.
-virtual void setNumTexCoords0(int num, int surface) const =0 Sets the number of first texture coordinates.
-virtual void setNumTexCoords1(int num, int surface) const =0 Sets the number of second texture coordinates.
-virtual int getNumColors(int surface) const =0 Returns the number of vertex colors.
-virtual void setColor(int num, const vec4 & color, int surface) const =0 Updates vertex color.
-virtual vec4 getColor(int num, int surface) const =0 Returns vertex color.
void setNumWeights(int num, int num_weights, int surface)- Removed.
int getNumWeights(int num, int surface)- Removed. Use the virtual int getNumWeights (int surface) const =0 function of the Unigine::Mesh class.
void setWeights(int num, const vec4 & weights, int surface)- Removed.
vec4 getWeights(int num, int surface)- Removed.
void setBones(int num, const ivec4 & bones, int surface)- Removed.
ivec4 getBones(int num, int surface)- Removed.
int getNumIndices(int surface)- Removed. Use int getNumCIndices(int surface) and int getNumTIndices(int surface).
void setIndex(int num, int index, int surface)- Removed. Use void setCIndex(int num, int index, int surface) and void setTIndex(int num, int index, int surface) .
int getIndex(int num, int surface)- Removed. Use int getCIndex(int num, int surface) and int getTIndex(int num, int surface).
int getNumCoordinateVertex(int surface)- Removed.
vec3 getCoordinateVertex(int num, int surface)- Removed.
int getCoordinateIndex(int num, int surface)- Removed.
-virtual int addTarget(int surface) const =0 Adds an animation target.
-virtual void removeTarget(int Target, int surface) const =0 Removes an animation target.
-virtual void setNumTargets(int num, int surface) const =0 Sets the number of animation targets.
-virtual int getNumTargets(int surface) const =0 Returns the number of animation targets.
-virtual void setTarget(int target, int enable, int index, float weight, int surface) const =0 Sets all parameters to a given animation target.
-virtual void setTargetEnabled(int target, int enable, int surface) const =0 Enables or disables a given animation target.
-virtual int isTargetEnabled(int target, int surface) const =0 Returns a value indicating if a given animation target is enabled.
-virtual void setTargetIndex(int target, int index, int surface) const =0 Sets an index for the animation target.
-virtual int getTargetIndex(int target, int surface) const =0 Returns the weight of the animation target.
-virtual void setTargetWeight(int target, float weight, int surface) const =0 Sets a weight for the animation target.
-virtual float getTargetWeight(int target, int surface) const =0 Returns the weight of the animation target.
void setLayer(int layer)void setLayer(int layer, int enable, float weight) Sets all parameters to a given animation layer.
-virtual void setLayer(int layer, int enable, float weight) const =0 Enables or disables a given animation layer.
-virtual int isLayerEnabled(int layer) const =0 Returns a value indicating if a given animation layer is enabled.
int getLayer()- Removed.
float getWeight()- Removed. Use float getLayerWeight(int layer)
int addBuffer()- Removed. Use int addLayer().
void removeBuffer(int num)- Removed. Use void removeLayer(int layer).
void setNumBuffers(int num)- Removed. Use void setNumLayers(int num).
int getNumBuffers()- Removed. Use int getNumLayers().
void setBuffer(int buffer, int layer)- Removed. Use void setLayer(int layer, int enable, float weight).
void getBuffer(int buffer, int layer)- Removed.
void clearBuffer(int buffer)- Removed. Use void clearLayer(int layer).
void copyBuffer(int buffer, int b)- Removed. Use void copyLayer(int layer, int layer_0).
void inverseBuffer(int buffer, int b)- Removed. Use void inverseLayer(int layer, int layer_0).
void lerpBuffer(int buffer, int b0, int b1, float weight)- Removed. Use void lerpLayer(int layer, int layer_0, int layer_1, float weight).
void mulBuffer(int buffer, int b0, int b1, float weight)- Removed. Use void mulLayer(int layer, int layer_0, int layer_1, float weight).
-virtual void setLayerEnabled(int layer, int enable) const =0 Enables or disables a given animation layer.
-virtual int isLayerEnabled(int layer) const =0 Returns a value indicating if a given animation layer is enabled.
-virtual void setLayerWeight(int layer, float weight) const =0 Sets a weight for the animation layer.
-virtual float getLayerWeight(int layer) const =0 Returns the weight of the animation layer.
-virtual void importLayer(int layer) const =0 Imports a given animation layer.
int setAnimation(const char * name)- Removed. Use int addAnimation(const char * name, const char * animation) or int addAnimation(const MeshPtr & mesh, const char * animation).
const char * getAnimation()int getAnimation(int layer) Returns the animation identifier from the given animation layer.
void setAnimationID(int id)- Removed. Use int setAnimation(int layer, const char * name). It sets the animation name or id for the given animation layer.
int getAnimationID()int getAnimationID(int num) Returns the animation identifier at the specified position.
-virtual int findAnimation(const char * name) const =0 Searches for an animation with a given name.
-virtual const char * getAnimationName(int animation) const =0 Returns the animation name.
-virtual int getNumAnimationBones(int animation) const =0 Returns the number of animation bones.
-virtual int getNumAnimationFrames(int animation) const =0 Returns the number of animation frames.
void setFrame(float time, int from, int to)float setFrame(int layer, float time, int from, int to) Sets a frame for the animation layer.
void getFrame()virtual float getFrame(int layer) const =0 Returns the frame number (time value passed to the last setFrame() call).
void clearFrame()- Removed.
int getFrameFrom()int getFrameFrom(int layer) Returns the start frame passed as the from argument on the last setFrame() call.
int getFrameTo()int getFrameTo(int layer) Returns the start frame passed as the to argument on the last setFrame() call.
float getFrameTime()- Removed. Use float getFrame(int layer).
-virtual const char * getBoneName(int bone) const =0 Returns name of a given bone.
-virtual mat4 getBoneBindTransform(int bone) const =0 Returns bind pose bone transformation matrix.
-virtual mat4 getIBoneBindTransform(int bone) const =0 Returns inverse bind pose bone transformation matrix.
-virtual mat4 getIBoneTransform(int bone) const =0 Returns an inverse transformation matrix for a given bone relatively to the parent object.
mat4 getOffsetTransform(int bone)- Removed.
-virtual void setWorldBoneChildsTransform(int bone, const UNIGINE_MAT4 & transform) const =0 Applies transformation to a given bone in the world space coordinates. All child bones will recalculate their matrices.
void setBufferBoneTransformEnabled(int buffer, int bone, int enable)- Removed. Use void setLayerBoneTransformEnabled(int layer, int bone, int enable).
void setBufferBoneTransform(int buffer, int bone, const mat4 & transform)- Removed. Use void setLayerBoneTransform(int layer, int bone, const mat4 & transform).
mat4 getBufferBoneTransform(int buffer, int bone)- Removed. Use mat4 getLayerBoneTransform(int layer, int bone).
int isBufferBoneTransform(int buffer, int bone)- Removed. Use int isLayerBoneTransform(int layer, int bone).
void setFrameBoneTransformEnabled(int bone, int enable)- Removed.
void setFrameBoneTransform(int bone, const mat4 & transform)- Removed.
mat4 getFrameBoneTransform(int bone)- Removed.
int isFrameBoneTransform(int bone)- Removed.
-int getNumSurfaceTargets(int surface) Returns the number of surface morph targets for the given mesh surface.
-virtual const char * getSurfaceTargetName(int surface, int target) const =0 Returns the name of a given surface target.
-int findSurfaceTarget(const char * name, int surface) Searches for the morph target number by the name.
Last update: 2017-07-03