Class VertexAnimationBakerSince
Constructors
constructor
-
Create a new VertexAnimationBaker object which can help baking animations into a texture.
Parameters
- scene: Scene
Defines the scene the VAT belongs to
- meshOrSkeleton: any
Defines the skeleton or the mesh from which to retrieve the skeleton from.
Returns VertexAnimationBaker
- scene: Scene
Methods
bake Vertex Data
-
Bakes the animation into the texture. This should be called once, when the scene starts, so the VAT is generated and associated to the mesh.
Parameters
- ranges: AnimationRange[]
Defines the ranges in the animation that will be baked.
Returns Promise<Float32Array<ArrayBufferLike>>
The array of matrix transforms for each vertex (columns) and frame (rows), as a Float32Array.
- ranges: AnimationRange[]
bake Vertex Data Sync
-
bakeVertexDataSync(
ranges: AnimationRange[],
halfFloat: boolean,
): Float32Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike>Parameters
- ranges: AnimationRange[]
Defines the ranges in the animation that will be baked.
- halfFloat: boolean
If true, the vertex data will be returned as half-float (Uint16Array), otherwise as full float (Float32Array).
Returns Float32Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike>
The array of matrix transforms for each vertex (columns) and frame (rows), as a Float32Array or Uint16Array.
- ranges: AnimationRange[]
load Baked Vertex Data From JSON
-
Loads previously baked data in string format.
Parameters
- json: string
The json string as serialized by serializeBakedVertexDataToJSON().
Returns Float32Array
The array of matrix transforms for each vertex (columns) and frame (rows), as a Float32Array.
- json: string
load Baked Vertex Data From Object
-
Loads previously baked data.
Parameters
- data: Record<string, any>
The object as serialized by serializeBakedVertexDataToObject()
Returns Float32Array
The array of matrix transforms for each vertex (columns) and frame (rows), as a Float32Array.
- data: Record<string, any>
serialize Baked Vertex Data To JSON
-
Serializes our vertexData to a JSON string, with a nice string for the vertexData. Should be called right after bakeVertexData().
Parameters
- vertexData: Float32Array
The vertex array data.
Returns string
This object serialized to a safe string.
- vertexData: Float32Array
serialize Baked Vertex Data To Object
-
Serializes our vertexData to an object, with a nice string for the vertexData.
Parameters
- vertexData: Float32Array
The vertex array data.
Returns Record<string, any>
This object serialized to a JS dict.
- vertexData: Float32Array
texture From Baked Vertex Data
-
textureFromBakedVertexData(
vertexData: Float32Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike>,
): RawTextureBuilds a vertex animation texture given the vertexData in an array.
Parameters
- vertexData: Float32Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike>
The vertex animation data. You can generate it with bakeVertexData(). You can pass in a Float32Array to return a full precision texture, or a Uint16Array to return a half-float texture. If you pass in a Uint16Array, make sure your device supports half-float textures
Returns RawTexture
The vertex animation texture to be used with BakedVertexAnimationManager.
- vertexData: Float32Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike>
Class to bake vertex animation textures. 5.0