import { Mat4, Vec3 } from '../../math'; import { Component } from '../component'; /** * Built-in Transform3D Component, defining the position, scale, rotation and velocity of a three dimensional Entity * * Provides for both relative movement along own axes as well as absolute movement along the world axes * * Produces the Mat4 Transformation Matrix used in shaders to position Game Objects * * NB: this Transform3D does not suffer gimbal lock * // TODO maybe we want a version that *does*? */ export declare class Transform3D extends Component { readonly initialPosition: Vec3; readonly initialScale: Vec3; readonly initialAngles: Vec3; readonly velocity: Vec3; /** Maintained position */ readonly position: Vec3; /** Maintained 'forward' Axis */ readonly forward: Vec3; /** Maintained 'up' Axis */ readonly up: Vec3; /** Maintained 'right' Axis */ readonly right: Vec3; /** Maintained scale factor */ readonly scale: Vec3; /** Maintained rotation angles (radians) */ readonly angles: Vec3; /** * Constructor. Take and store the initial position, scale, angle and velocity * * @param initialPosition the position of the Entity, expressed as a Vec3. Defaults to 0,0,0 * @param initialScale the starting scale of the Entity, expressed as a Vec3. Defaults to 1,1,1 * @param initialAngle the starting rotation around the x, y and z axes of the Entity. Defaults to 0,0,0 * @param velocity the velocity of the Entity, expressed as a Vec3. Defaults to 0,0,0 */ constructor(initialPosition?: Vec3, initialScale?: Vec3, initialAngles?: Vec3, velocity?: Vec3); /** * Move along the right axis by a given amount * * Facilitates relative movement * * @param amount the amount to move by */ moveRight(amount: number): void; /** * Move along the up axis by a given amount * * Facilitates relative movement * * @param amount the amount to move by */ moveUp(amount: number): void; /** * Move along the forward axis by a given amount * * Facilitates relative movement * * @param amount the amount to move by */ moveForward(amount: number): void; /** * Convenience wrapper for moveRight(), moveUp() and moveForward(), taking a Vec3 to represent the Right, Up and Forward amounts * * @param amounts the Right, Up and Forward amounts to move by */ move(amounts: Vec3): void; /** * Move along the World axes by a given translation vector * * Facilitates absolute movement * * @param translate the translation vector */ translate(translate: Vec3): void; /** * Rotate by a given angle (radians) around the X axis; pitch * * @param angle the angle (radians) to rotate by */ rotateX(angle: number): void; /** * Rotate by a given angle (radians) around the Y axis; yaw * * @param angle the angle (radians) to rotate by */ rotateY(angle: number): void; /** * Rotate by a given angle (radians) around the Z axis; roll * * @param angle the angle (radians) to rotate by */ rotateZ(angle: number): void; /** * Convenience wrapper for rotateX(), rotateY() and rotateZ(), taking a Vec3 representing the X, Y and Z angles (radians) to rotate by * * @param angles the X, Y and Z angles (radians) to rotate by */ rotate(angles: Vec3): void; /** * Scale the Transform3D by a given factor, relative to its current scale * * @param factor the Vec3 to scale by */ scaleBy(factor: Vec3): void; /** * Scale the Transform3D to a given absolute factor * * @param factor the Vec3 scale factor to adopt */ scaleTo(factor: Vec3): void; /** * Reset all transformations back to their initial values, including the Transform's axes */ reset(): void; /** * Compute the composite Transform Matrix from the maintained translation, scaling and rotation * * @returns the Transform matrix */ compute(): Mat4; /** * Getter for a Mutable cast of the Transform3D instance; used for enabling internal-only mutation of translation, rotation and scale * * @returns the typecasted Mutable Transform3D instance */ private get mutable(); }