UNPKG

@babylonjs/core

Version:

Getting started? Play directly with the Babylon.js API using our [playground](https://playground.babylonjs.com/). It also contains a lot of samples to learn how to use it.

178 lines (177 loc) 6.03 kB
import type { IAnimatable } from "../Animations/animatable.interface.js"; import { Observable } from "../Misc/observable.js"; import type { Nullable, FloatArray } from "../types.js"; import type { Scene } from "../scene.js"; import type { AbstractMesh } from "../Meshes/abstractMesh.js"; import type { AnimationPropertiesOverride } from "../Animations/animationPropertiesOverride.js"; import type { Animation } from "../Animations/animation.js"; /** * Defines a target to use with MorphTargetManager * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/morphTargets */ export declare class MorphTarget implements IAnimatable { /** defines the name of the target */ name: string; /** * Gets or sets the list of animations */ animations: Animation[]; private _scene; private _positions; private _normals; private _tangents; private _uvs; private _uv2s; private _colors; private _influence; private _uniqueId; /** * Observable raised when the influence changes */ onInfluenceChanged: Observable<boolean>; /** @internal */ _onDataLayoutChanged: Observable<void>; /** * Gets or sets the influence of this target (ie. its weight in the overall morphing) */ get influence(): number; set influence(influence: number); /** * Gets or sets the id of the morph Target */ id: string; private _animationPropertiesOverride; /** * Gets or sets the animation properties override */ get animationPropertiesOverride(): Nullable<AnimationPropertiesOverride>; set animationPropertiesOverride(value: Nullable<AnimationPropertiesOverride>); /** * Creates a new MorphTarget * @param name defines the name of the target * @param influence defines the influence to use * @param scene defines the scene the morphtarget belongs to */ constructor( /** defines the name of the target */ name: string, influence?: number, scene?: Nullable<Scene>); /** * Gets the unique ID of this manager */ get uniqueId(): number; /** * Gets a boolean defining if the target contains position data */ get hasPositions(): boolean; /** * Gets a boolean defining if the target contains normal data */ get hasNormals(): boolean; /** * Gets a boolean defining if the target contains tangent data */ get hasTangents(): boolean; /** * Gets a boolean defining if the target contains texture coordinates data */ get hasUVs(): boolean; /** * Gets a boolean defining if the target contains texture coordinates 2 data */ get hasUV2s(): boolean; get hasColors(): boolean; /** * Gets the number of vertices stored in this target */ get vertexCount(): number; /** * Affects position data to this target * @param data defines the position data to use */ setPositions(data: Nullable<FloatArray>): void; /** * Gets the position data stored in this target * @returns a FloatArray containing the position data (or null if not present) */ getPositions(): Nullable<FloatArray>; /** * Affects normal data to this target * @param data defines the normal data to use */ setNormals(data: Nullable<FloatArray>): void; /** * Gets the normal data stored in this target * @returns a FloatArray containing the normal data (or null if not present) */ getNormals(): Nullable<FloatArray>; /** * Affects tangent data to this target * @param data defines the tangent data to use */ setTangents(data: Nullable<FloatArray>): void; /** * Gets the tangent data stored in this target * @returns a FloatArray containing the tangent data (or null if not present) */ getTangents(): Nullable<FloatArray>; /** * Affects texture coordinates data to this target * @param data defines the texture coordinates data to use */ setUVs(data: Nullable<FloatArray>): void; /** * Gets the texture coordinates data stored in this target * @returns a FloatArray containing the texture coordinates data (or null if not present) */ getUVs(): Nullable<FloatArray>; /** * Affects texture coordinates 2 data to this target * @param data defines the texture coordinates 2 data to use */ setUV2s(data: Nullable<FloatArray>): void; /** * Gets the texture coordinates 2 data stored in this target * @returns a FloatArray containing the texture coordinates 2 data (or null if not present) */ getUV2s(): Nullable<FloatArray>; /** * Affects color data to this target * @param data defines the color data to use */ setColors(data: Nullable<FloatArray>): void; /** * Gets the color data stored in this target * @returns a FloatArray containing the color data (or null if not present) */ getColors(): Nullable<FloatArray>; /** * Clone the current target * @returns a new MorphTarget */ clone(): MorphTarget; /** * Serializes the current target into a Serialization object * @returns the serialized object */ serialize(): any; /** * Returns the string "MorphTarget" * @returns "MorphTarget" */ getClassName(): string; /** * Creates a new target from serialized data * @param serializationObject defines the serialized data to use * @param scene defines the hosting scene * @returns a new MorphTarget */ static Parse(serializationObject: any, scene?: Scene): MorphTarget; /** * Creates a MorphTarget from mesh data * @param mesh defines the source mesh * @param name defines the name to use for the new target * @param influence defines the influence to attach to the target * @returns a new MorphTarget */ static FromMesh(mesh: AbstractMesh, name?: string, influence?: number): MorphTarget; }