API Docs for:
Show:

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 Object

    to configure from

Methods

clearWeights

(
  • object
)

Sets the weight for all the

Parameters:

  • object Object

    with the serialized info

getBaseMesh

()

Returns the base mesh on which the morph targets will be applied

getMorphIndex

(
  • mesh_name
)
Number

returns the index of the morph target that uses this mesh

Parameters:

  • mesh_name String

    the name (filename) of the mesh in the morph target

Returns:

Number:

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 Number

    the index of the morph target

  • mesh String

    the mesh resource

setMorphWeight

(
  • index
  • weight
)

sets the weight for a morph target

Parameters:

  • index Number

    the index of the morph target

  • weight Number

    the 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: [];