UNPKG

@zeainc/zea-kinematics

Version:

Kinematics extension for Zea Engine.

486 lines (469 loc) 14.6 kB
import { Operator, NumberParameter, BooleanParameter, TreeItemParameter, Xfo, ListParameter, StructParameter, Vec3Parameter, Vec2Parameter, XfoOperatorOutput, Vec3, MultiChoiceParameter, XfoOperatorInput, Quat, TreeItem, XfoParameter, OperatorOutput, NumberOperatorInput, EventEmitter, Vec2, GeomItem, Material, Cuboid } from '@zeainc/zea-engine'; import { Change } from '@zeainc/zea-ux'; /** Class representing an explode part parameter. * @extends StructParameter * @private */ declare class ExplodePartParameter extends StructParameter { stageParam: NumberParameter; axisParam: Vec3Parameter; movementParam: Vec2Parameter; multiplierParam: NumberParameter; output: XfoOperatorOutput; /** * Create an explode part parameter. * @param {string} name - The name value. */ constructor(name?: string); /** * The getStage method. * @return {any} - The return value. */ getStage(): number; /** * The setStage method. * @param {any} stage - The stage value. */ setStage(stage: number): void; /** * The getOutput method. * @return {XfoOperatorOutput} - The return value. */ getOutput(): XfoOperatorOutput; /** * The evaluate method. * @param {any} explode - The explode value. * @param {any} explodeDist - The distance that the parts explode to. * @param {any} offset - The offset value. * @param {any} stages - The stages value. * @param {any} cascade - In "cascade" mode, the parts move in a cascade. * @param {any} centered - The centered value. * @param {Xfo} parentXfo - The parentXfo value. * @param {any} parentDelta - The parentDelta value. */ evaluate(explode: number, explodeDist: number, offset: number, stages: number, cascade: boolean, centered: boolean, parentXfo: Xfo, parentDelta: Xfo): void; /** * The toJSON method encodes this type as a json object for persistence. * @param {object} context - The context value. * @return {object} - Returns the json object. */ toJSON(context: Record<string, any>): Record<string, any>; /** * The fromJSON method decodes a json object for this type. * @param {object} j - The json object this item must decode. * @param {object} context - The context value. */ fromJSON(j: Record<string, any>, context: Record<string, any>): void; } /** Class representing an explode parts operator. * @extends ParameterOwner */ declare class ExplodePartsOperator extends Operator { stagesParam: NumberParameter; explodeParam: NumberParameter; distParam: NumberParameter; offsetParam: NumberParameter; cascadeParam: BooleanParameter; centeredParam: BooleanParameter; parentItemParam: TreeItemParameter; invParentSpace: Xfo; itemsParam: ListParameter; localXfos: Array<Xfo>; /** * Create an explode parts operator. * @param {string} name - The name value. */ constructor(name?: string); addPart(): ExplodePartParameter; /** * The evaluate method. */ evaluate(): void; /** * The toJSON method encodes this type as a json object for persistence. * * @param {object} context - The context value. * @return {object} - Returns the json object. */ toJSON(context: Record<string, any>): Record<string, any>; /** * The fromJSON method decodes a json object for this type. * @param {object} j - The json object this item must decode. * @param {object} context - The context value. */ fromJSON(j: Record<string, any>, context: Record<string, any>): void; } /** Class representing a gear parameter. * @extends StructParameter */ declare class GearParameter extends StructParameter { __ratioParam: NumberParameter; __offsetParam: NumberParameter; __axisParam: Vec3Parameter; __output: any; /** * Create a gear parameter. * @param {string} name - The name value. */ constructor(name?: string); /** * The getOutput method. * @return {any} - The return value. */ getOutput(): any; /** * Getter for the gear ratio. * @return {number} - Returns the ratio. */ getRatio(): number; /** * getter for the gear offset. * @return {number} - Returns the offset. */ getOffset(): number; /** * The getAxis method. * @return {any} - The return value. */ getAxis(): Vec3; /** * The toJSON method encodes this type as a json object for persistence. * @param {object} context - The context value. * @return {object} - Returns the json object. */ toJSON(context: Record<string, any>): Record<string, any>; /** * The fromJSON method decodes a json object for this type. * @param {object} j - The json object this item must decode. * @param {object} context - The context value. */ fromJSON(j: Record<string, any>, context: Record<string, any>): void; } /** * Class representing a gears operator. * * @extends Operator */ declare class GearsOperator extends Operator { __revolutionsParam: NumberParameter; rpmParam: NumberParameter; __timeoutId: any; __gearsParam: ListParameter; __gears: any[]; /** * Create a gears operator. * @param {string} name - The name value. */ constructor(name?: string); addGear(): GearParameter; /** * The evaluate method. */ evaluate(): void; /** * The detach method. */ detach(): void; /** * The reattach method. */ reattach(): void; /** * The destroy is called by the system to cause explicit resources cleanup. * Users should never need to call this method directly. */ destroy(): void; } /** An operator for aiming items at targets. * @extends Operator */ declare class AimOperator extends Operator { weightParam: NumberParameter; axisParam: MultiChoiceParameter; stretchParam: NumberParameter; initialDistParam: NumberParameter; targetInput: XfoOperatorInput; xfoInputOutput: XfoOperatorOutput; /** * Create a gears operator. * @param {string} name - The name value. */ constructor(name?: string); /** * The resetStretchRefDist method. */ resetStretchRefDist(): void; /** * The evaluate method. */ evaluate(): void; } /** An operator for aiming items at targets. * @extends Operator */ declare class RamAndPistonOperator extends Operator { axisParam: MultiChoiceParameter; ramXfoOutput: XfoOperatorOutput; pistonXfoOutput: XfoOperatorOutput; /** * Create a gears operator. * @param {string} name - The name value. */ constructor(name?: string); /** * The evaluate method. */ evaluate(): void; } /** An operator for aiming items at targets. * @extends Operator */ declare class TriangleIKSolver extends Operator { align: Quat; enabled: boolean; joint1Offset: Vec3; joint1TargetOffset: Vec3; joint0Length: number; joint1Length: number; targetXfoInput: XfoOperatorInput; joint0XfoOutput: XfoOperatorOutput; joint1XfoOutput: XfoOperatorOutput; /** * Create a gears operator. * @param {string} name - The name value. */ constructor(name?: string); enable(): void; /** * The evaluate method. */ evaluate(): void; } declare class IKJoint { index: number; axisId: number; limits: Array<number>; backPropagationWeight: number; align: Quat; debugTree: TreeItem; debugLines: {}; xfo: Xfo; output: OperatorOutput<any>; localXfo: Xfo; bindLocalXfo: Xfo; axis: Vec3; constructor(index: number, axisId: number, limits: Array<number>, globalXfoParam: XfoParameter, solverDebugTree: TreeItem); addDebugSegment(color: number, p0: Vec3, p1: Vec3): void; init(parentXfo: Xfo, index: number, numJoints: number): void; backPropagateOrientation(baseXfo: Xfo, targetXfo: Xfo, index: number, joints: Array<IKJoint>): void; forwardPropagateAlignment(baseXfo: Xfo, targetXfo: Xfo, index: number, joints: Array<IKJoint>): void; setClean(): void; } /** An operator for aiming items at targets. * @extends Operator */ declare class IKSolver extends Operator { joints: any[]; enabled: boolean; debugTree: TreeItem; iterationsParam: NumberParameter; baseXfoInput: XfoOperatorInput; targetXfoInput: XfoOperatorInput; /** * Create a gears operator. * @param {string} name - The name value. */ constructor(name?: string); addJoint(globalXfoParam: XfoParameter, axisId?: number, limits?: number[]): IKJoint; enable(): void; /** * The evaluate method. */ evaluate(): void; } /** An operator for aiming items at targets. * @extends Operator */ declare class AttachmentConstraint extends Operator { timeInput: NumberOperatorInput; attachedXfoOutput: XfoOperatorOutput; private attachTargets; private attachId; /** * Create a gears operator. * @param {string} name - The name value. */ constructor(name?: string); addAttachTarget(target: XfoParameter, time: number): void; getAttachTarget(attachId: number): Record<string, any>; findTarget(time: number): number; /** * The evaluate method. */ evaluate(): void; } declare class IndexEvent { index: number; constructor(index: number); } /** Class representing a gear parameter. * @extends BaseTrack */ declare class BaseTrack extends EventEmitter { name: string; owner: TreeItem; keys: any[]; __sampleCache: {}; __currChange: any; __secondaryChange: any; __secondaryChangeTime: number; __name: any; constructor(name?: string, owner?: TreeItem); getName(): string; getOwner(): TreeItem; setOwner(owner: TreeItem): void; getPath(): (string | void)[]; getNumKeys(): number; getKeyTime(index: number): any; getKeyValue(index: number): any; setKeyValue(index: number, value: any): void; setKeyTimeAndValue(index: number, time: number, value: any): void; getTimeRange(): Vec2; addKey(time: number, value: any): number; updateKey(index: number, value: any): void; removeKey(index: number): void; findKeyAndLerp(time: number): { keyIndex: number; lerp: number; }; evaluate(time: number): void; setValue(time: number, value: any): void; /** * Encodes the current object as a json object. * * @param {object} context - The context value. * @return {object} - Returns the json object. */ toJSON(context: Record<string, any>): Record<string, any>; /** * Decodes a json object for this type. * * @param {object} j - The json object this item must decode. * @param {object} context - The context value. */ fromJSON(j: Record<string, any>, context: Record<string, any>): void; loadKeyJSON(json: Record<string, any>): Record<string, any>; } declare class ColorTrack extends BaseTrack { constructor(name?: string); evaluate(time: number): any; } declare class XfoTrack extends BaseTrack { constructor(name?: string); evaluate(time: number): any; loadKeyJSON(json: Record<string, any>): { time: any; value: Xfo; }; } /** An operator for aiming items at targets. * @extends Operator */ declare class TrackSampler extends Operator { track: BaseTrack; __initialValue: any; __currChange: any; __secondaryChange: Change; __secondaryChangeTime: number; timeNumberOutput: NumberOperatorInput; xfoOutput: XfoOperatorOutput; /** * Create a TrackSampler operator. * @param {string} name - The name value. */ constructor(name?: string, track?: BaseTrack); /** * @param {Xfo} value - The value param. * @return {any} - The modified value. */ backPropagateValue(value: Xfo): Xfo; /** * The evaluate method. */ evaluate(): void; } /** An operator for aiming items at targets. * @extends Operator */ declare class XfoTrackDisplay extends GeomItem { track: XfoTrack; dotsItem: GeomItem; keyMat: Material; keyCube: Cuboid; keys: GeomItem[]; /** * Create a TrackDisplay operator. * @param {string} name - The name value. * @param {XfoTrack} track - The track to display. */ constructor(track: XfoTrack); displayKeys(): void; updatePath(timeRange?: Array<number>): void; } declare class KeyChange extends Change { track: BaseTrack; index: number; prevValue: any; newValue: any; newTime: number; constructor(track?: BaseTrack, index?: number, value?: any, time?: number); update(value: any, time?: number): void; undo(): void; redo(): void; toJSON(context: Record<string, any>): Record<string, any>; fromJSON(j: Record<string, any>, context: Record<string, any>): void; changeFromJSON(j: Record<string, any>): void; } declare class AddKeyChange extends Change { track: BaseTrack; time: number; value: any; index: number; constructor(track: BaseTrack, time: number, value: any); update(value: any): void; emit(arg0: string, arg1: { value: any; }): void; undo(): void; redo(): void; /** * Serializes `Parameter` instance value as a JSON object, allowing persistence/replication. * * @param {object} context - The context param. * @return {object} The return value. */ toJSON(context: Record<string, any>): Record<string, any>; /** * Restores `Parameter` instance's state with the specified JSON object. * * @param {object} j - The j param. * @param {object} context - The context param. */ fromJSON(j: Record<string, any>, context: Record<string, any>): void; /** * Updates the state of an existing identified `Parameter` through replication. * * @param {object} j - The j param. */ changeFromJSON(j: Record<string, any>): void; } declare class RemoveKeyChange extends Change { track: BaseTrack; index: number; time: number; value: any; constructor(track: BaseTrack, index: number); undo(): void; redo(): void; } export { AddKeyChange, AimOperator, AttachmentConstraint, BaseTrack, ColorTrack, ExplodePartsOperator, GearsOperator, IKSolver, IndexEvent, KeyChange, RamAndPistonOperator, RemoveKeyChange, TrackSampler, TriangleIKSolver, XfoTrack, XfoTrackDisplay };