@awayjs/graphics
Version:
AwayJS graphics classes
110 lines • 5.04 kB
TypeScript
import { ShaderBase, _Render_RenderableBase, IElements, TriangleElements } from '@awayjs/renderer';
import { _Render_Shape } from '../renderables/Shape';
import { Skeleton } from './data/Skeleton';
import { SkeletonPose } from './data/SkeletonPose';
import { IAnimationTransition } from './transitions/IAnimationTransition';
import { SkeletonAnimationSet } from './SkeletonAnimationSet';
import { AnimatorBase } from './AnimatorBase';
/**
* Provides an interface for assigning skeleton-based animation data sets to sprite-based entity objects
* and controlling the various available states of animation through an interative playhead that can be
* automatically updated or manually triggered.
*/
export declare class SkeletonAnimator extends AnimatorBase {
private _globalMatrices;
private _globalPose;
private _globalPropertiesDirty;
private _numJoints;
private _morphedElements;
private _morphedElementsDirty;
private _condensedMatrices;
private _skeletonAnimationSet;
private _skeleton;
private _forceCPU;
private _useCondensedIndices;
private _jointsPerVertex;
private _activeSkeletonState;
private _onTransitionCompleteDelegate;
private _onIndicesUpdateDelegate;
private _onVerticesUpdateDelegate;
/**
* returns the calculated global matrices of the current skeleton pose.
*
* @see #globalPose
*/
get globalMatrices(): Float32Array;
/**
* returns the current skeleton pose output from the animator.
*
* @see away.animators.data.SkeletonPose
*/
get globalPose(): SkeletonPose;
/**
* Returns the skeleton object in use by the animator - this defines the number and heirarchy of joints used by the
* skinned geoemtry to which skeleon animator is applied.
*/
get skeleton(): Skeleton;
/**
* Indicates whether the skeleton animator is disabled by default for GPU rendering, something that allows the animator to perform calculation on the GPU.
* Defaults to false.
*/
get forceCPU(): boolean;
/**
* Offers the option of enabling GPU accelerated animation on skeletons larger than 32 joints
* by condensing the number of joint index values required per sprite. Only applicable to
* skeleton animations that utilise more than one sprite object. Defaults to false.
*/
get useCondensedIndices(): boolean;
set useCondensedIndices(value: boolean);
/**
* Creates a new <code>SkeletonAnimator</code> object.
*
* @param skeletonAnimationSet The animation data set containing the skeleton animations used by the animator.
* @param skeleton The skeleton object used for calculating the resulting global matrices for transforming skinned sprite data.
* @param forceCPU Optional value that only allows the animator to perform calculation on the CPU. Defaults to false.
*/
constructor(animationSet: SkeletonAnimationSet, skeleton: Skeleton, forceCPU?: boolean);
/**
* @inheritDoc
*/
clone(): AnimatorBase;
/**
* Plays an animation state registered with the given name in the animation data set.
*
* @param name The data set name of the animation state to be played.
* @param transition An optional transition object that determines how the animator will transition from the currently active animation state.
* @param offset An option offset time (in milliseconds) that resets the state's internal clock to the absolute time of the animator plus the offset value. Required for non-looping animation states.
*/
play(name: string, transition?: IAnimationTransition, offset?: number): void;
/**
* @inheritDoc
*/
setRenderState(shader: ShaderBase, renderable: _Render_Shape): void;
/**
* @inheritDoc
*/
testGPUCompatibility(shader: ShaderBase): void;
/**
* Applies the calculated time delta to the active animation state node or state transition object.
*/
_pUpdateDeltaTime(dt: number): void;
private updateCondensedMatrices;
private updateGlobalProperties;
getRenderableElements(renderable: _Render_RenderableBase, sourceElements: TriangleElements): IElements;
/**
* If the animation can't be performed on GPU, transform vertices manually
* @param subGeom The subgeometry containing the weights and joint index data per vertex.
* @param pass The material pass for which we need to transform the vertices
*/
morphElements(renderable: _Render_RenderableBase, sourceElements: TriangleElements): void;
/**
* Converts a local hierarchical skeleton pose to a global pose
* @param targetPose The SkeletonPose object that will contain the global pose.
* @param skeleton The skeleton containing the joints, and as such, the hierarchical data to transform to global poses.
*/
private localToGlobalPose;
private onTransitionComplete;
private onIndicesUpdate;
private onVerticesUpdate;
}
//# sourceMappingURL=SkeletonAnimator.d.ts.map