LS.Components.MorphDeformer Class
It complements a MeshRenderer to add Morph Targets (Blend Shapes) to deform meshes. Morph Targets of a mesh must have the same topology and number of vertex, otherwise it won't work.
Constructor
LS.Components.MorphDeformer
-
object
Parameters:
-
object
Objectto configure from
Item Index
Methods
clearWeights
-
object
Sets the weight for all the
Parameters:
-
object
Objectwith the serialized info
getBaseMesh
()
Returns the base mesh on which the morph targets will be applied
getMorphIndex
-
mesh_name
returns the index of the morph target that uses this mesh
Parameters:
-
mesh_name
Stringthe name (filename) of the mesh in the morph target
Returns:
the index
optimizeMorphTargets
()
Removes innecesary morph targets and removes data from mesh that is already in the base mesh
setMorphMesh
-
index
-
mesh
sets the mesh for a morph target
Parameters:
-
index
Numberthe index of the morph target
-
mesh
Stringthe mesh resource
setMorphWeight
-
index
-
weight
sets the weight for a morph target
Parameters:
-
index
Numberthe index of the morph target
-
weight
Numberthe weight
Properties
mode MorphDeformer.AUTOMATIC, MorphDeformer.CPU, MorphDeformer.STREAMS, MorphDeformer.TEXTURES
Number
The mode used to apply the morph targets, could be using the CPU, the GPU using uniforms( limited by the browser/driver) or using Textures (more expensive). Leave it as automatic so the system knows the best case.
Default: MorphDeformer.AUTOMATIC;
morph_targets
Array
An array with every morph targets info in the form of { mesh: mesh_name, weight: number }
Default: [];