/** * The attribute size type corresponds to float, vec2, vec3, or vec4. */ type AttributeSizeType = 1 | 2 | 3 | 4; /** * An array of attribute values associated with meta data describing how to interpret the values. */ interface Attribute { /** * The values of the attribute. */ values: number[]; /** * The number of values that are associated with a given vertex. */ size: AttributeSizeType; } /** * DataType with values from WebGLRenderingContextBase. * * https://www.khronos.org/registry/webgl/specs/1.0/ */ declare enum DataType { BYTE = 5120, UNSIGNED_BYTE = 5121, SHORT = 5122, UNSIGNED_SHORT = 5123, INT = 5124, UNSIGNED_INT = 5125, FLOAT = 5126 } /** * A convenience class for implementing the Attribute interface. * @hidden */ declare class DrawAttribute implements Attribute { readonly values: number[]; readonly size: AttributeSizeType; readonly type: DataType; constructor(values: number[], size: AttributeSizeType, type: DataType); } /** * The enumerated modes of drawing WebGL primitives. * (POINTS, LINES, LINE_LOOP, LINE_STRIP, TRIANGLES, TRIANGLE_STRIP,TRIANGLE_FAN) * * https://www.khronos.org/registry/webgl/specs/1.0/ */ declare enum BeginMode { POINTS = 0, LINES = 1, LINE_LOOP = 2, LINE_STRIP = 3, TRIANGLES = 4, TRIANGLE_STRIP = 5, TRIANGLE_FAN = 6 } /** * The data corresponding to a drawArrays or drawElements call to the WebGL API. * This data is not interleaved. */ interface Primitive { /** * The mode used to draw the attribute data. */ mode: BeginMode; /** * Optional indices for the attribute data. */ indices?: number[]; /** * A mapping from attribute name to attribute data. */ attributes: { [name: string]: Attribute; }; } /** * A convenience class for implementing the Primitive interface. * @hidden */ declare class DrawPrimitive implements Primitive { mode: BeginMode; indices: number[]; attributes: { [name: string]: Attribute; }; constructor(mode: BeginMode, indices: number[], attributes: { [name: string]: Attribute; }); } /** * reduces multiple TRIANGLE_STRIP Primitives to a single TRAINGLE_STRIP Primitive. * @hidden */ declare function reduce(primitives: Primitive[]): Primitive; /** * */ interface Lockable { /** * Determines whether this `Lockable` is locked. * If the `Lockable` is in the unlocked state then it is mutable. * If the `Lockable` is in the locked state then it is immutable. */ isLocked(): boolean; /** * Locks this `Lockable` (preventing any further mutation), * and returns a token that may be used to unlock it. */ lock(): number; /** * Unlocks this `Lockable` (allowing mutation), * using a token that was obtained from a preceding lock method call. */ unlock(token: number): void; } /** * @hidden */ declare class VectorN$1 implements Lockable { /** * */ private readonly lock_; /** * */ private size_; /** * */ private data_; /** * */ private modified_; /** * * @param data * @param modified * @param size */ constructor(data: T[], modified?: boolean, size?: number); isLocked(): boolean; lock(): number; unlock(token: number): void; /** * */ get coords(): T[]; set coords(data: T[]); get modified(): boolean; set modified(modified: boolean); /** * */ get length(): number; /** * */ clone(): VectorN$1; /** * @param index */ getComponent(index: number): T; /** * */ pop(): T; /** * @param value * @returns */ push(value: T): number; /** * @param index * @param value */ setComponent(index: number, value: T): void; /** * @param array * @param offset * @returns */ toArray(array?: T[], offset?: number): T[]; /** * @returns */ toLocaleString(): string; /** * @returns */ toString(): string; } /** * @hidden */ declare class Coords extends VectorN$1 { /** * */ constructor(coords: number[], modified?: boolean, size?: number); /** * Sets any coordinate whose absolute value is less than pow(10, -n) times the absolute value of the largest coordinate to zero. * @param n The exponent used to determine which components are set to zero. * @returns approx(this) */ approx(n: number): void; /** * */ equals(other: any): boolean; } interface VectorN { length: number; getComponent(index: number): T; toArray(): T[]; } /** * A mapping from the name of an attribute to VectorN parameterized by number. * Using VectorN allows Geometric2, Geometric3, Vector1, Vector2, Vector3, Vector4, Spinor2, Spinor3. * @hidden */ interface VertexAttributeMap { [name: string]: VectorN; } /** * The data for a vertex in a normalized and uncompressed format that is easy to manipulate. * @hidden */ declare class Vertex { /** * The attribute data for this vertex. */ attributes: VertexAttributeMap; /** * The abstract coordinates that label the vertex. */ coords: Coords; /** * The index of the vertex. */ index: number; /** * @param numCoordinates The number of coordinates (dimensionality). */ constructor(numCoordinates: number); /** * @returns A string representation of this vertex. */ toString(): string; } /** * */ interface Shareable { /** * * Increments the reference count of an Shareable instance. * * @return The new reference count. This value is intended to be used only for testing purposes. */ addRef?(): number; /** * * Decrements the reference count of an Shareable instance. * * @return The new reference count. This value is intended to be used only for testing purposes. */ release?(): number; } /** *

* Convenient base class for derived classes implementing Shareable. *

*/ declare class ShareableBase implements Shareable { /** * */ private _refCount; /** * */ private _type; /** * The unique identifier used for reference count monitoring. */ private _uuid; /** * Keeps track of the level in the hierarchy of classes. */ private _levelUp; /** * */ constructor(); /** * @hidden * Experimental * * restore (a zombie) to life. */ protected resurrector(levelUp: number, grumble?: boolean): void; /** * @hidden *

* Outputs a warning to the console that this method should be implemented by the derived class. *

*

* This method should be implemented by derived classes. *

*

* Not implementing this method in a derived class risks leaking resources allocated by the derived class. *

* * @param levelUp A number that should be incremented for each destructor call. */ protected destructor(levelUp: number, grumble?: boolean): void; /** * Returns the total length of the inheritance hierarchy that this instance is involved in. */ /** * An object is a zombie if it has been released by all who have held references. * In some cases it may be possible to recycle a zombie. */ isZombie(): boolean; /** *

* Notifies this instance that something is referencing it. *

* * @returns The new value of the reference count. */ addRef(): number; /** * Returns the name that was assigned by the call to the setLoggingName method. */ getLoggingName(): string; /** * This method is for use within constructors. * * Immediately after a call to the super class constructor, make a call to setLoggingName. * This will have the effect of refining the name used for reporting reference counts. * * This method has the secondary purpose of enabling a tally of the number of classes * in the constructor chain. This enables the runtime architecture to verify that destructor * chains are consistent with constructor chains, which is a good practice for cleaning up resources. * * Notice that this method is intentionally protected to discourage it from being called outside of the constructor. * * @param name This will usually be set to the name of the class. */ protected setLoggingName(name: string): void; /** *

* Notifies this instance that something is dereferencing it. *

* * @returns The new value of the reference count. */ release(): number; } /** * @hidden */ declare class NumberShareableMap extends ShareableBase { private _elements; constructor(); protected destructor(levelUp: number): void; exists(key: number): boolean; get(key: number): V; getWeakRef(index: number): V; put(key: number, value: V): void; putWeakRef(key: number, value: V): void; forEach(callback: (key: number, value: V) => void): void; get keys(): number[]; remove(key: number): void; } /** *

* Collection class for maintaining an array of types derived from Shareable. *

*

* Provides a safer way to maintain reference counts than a native array. *

*/ declare class ShareableArray extends ShareableBase { /** * */ private _elements; /** * */ constructor(elements?: T[]); /** * */ protected destructor(levelUp: number): void; /** * */ find(match: (element: T) => boolean): ShareableArray; /** * */ findOne(match: (element: T) => boolean): T; /** * Gets the element at the specified index, incrementing the reference count. */ get(index: number): T; /** * Gets the element at the specified index, without incrementing the reference count. */ getWeakRef(index: number): T; /** * */ indexOf(searchElement: T, fromIndex?: number): number; /** * */ get length(): number; set length(unused: number); /** * The slice() method returns a shallow copy of a portion of an array into a new array object. * * It does not remove elements from the original array. */ slice(begin?: number, end?: number): ShareableArray; /** * The splice() method changes the content of an array by removing existing elements and/or adding new elements. */ splice(index: number, deleteCount: number): ShareableArray; /** * */ shift(): T; /** * Traverse without Reference Counting */ forEach(callback: (value: T, index: number) => void): void; /** * Pushes element onto the tail of the list and increments the element reference count. */ push(element: T): number; /** * Pushes element onto the tail of the list without incrementing the element reference count. */ pushWeakRef(element: T): number; /** * */ pop(): T; /** * */ unshift(element: T): number; /** *

* unshift without incrementing the element reference count. *

*/ unshiftWeakRef(element: T): number; } /** * @hidden */ declare class StringShareableMap extends ShareableBase implements Shareable { private elements; /** * A map of string to V extends Shareable. */ constructor(); protected destructor(levelUp: number): void; /** * Determines whether the key exists in the map with a defined value. */ exists(key: string): boolean; get(key: string): V; getWeakRef(key: string): V; put(key: string, value: V): void; putWeakRef(key: string, value: V): void; forEach(callback: (key: string, value: V) => void): void; get keys(): string[]; get values(): V[]; remove(key: string): V; } /** * */ declare enum BlendingFactorDest { ZERO = 0, ONE = 1, SRC_COLOR = 768, ONE_MINUS_SRC_COLOR = 769, SRC_ALPHA = 770, ONE_MINUS_SRC_ALPHA = 771, DST_ALPHA = 772, ONE_MINUS_DST_ALPHA = 773 } /** * */ declare enum BlendingFactorSrc { ZERO = 0, ONE = 1, DST_COLOR = 774, ONE_MINUS_DST_COLOR = 775, SRC_ALPHA_SATURATE = 776, SRC_ALPHA = 770, ONE_MINUS_SRC_ALPHA = 771, DST_ALPHA = 772, ONE_MINUS_DST_ALPHA = 773 } /** * This interface standardizes the concept of an implementation being dependent upon * a WebGL rendering context. The notification methods for context gain, loss, and free * allow the implementation to participate in the dynamic and volatile environment * whereupon a browser may reset its WebGL rendering contexts. */ interface ContextConsumer extends Shareable { /** * Called to request the consumer to free any WebGL resources acquired and owned. * The consumer may assume that its cached context is still valid in order * to properly dispose of any cached resources. In the case of shared objects, this * method may be called multiple times for what is logically the same context. In such * cases the consumer must be idempotent and respond only to the first request. */ contextFree?(): void; /** * Called to inform the dependent of a new WebGL rendering context. * The implementation should ignore the notification if it has already * received the same context. */ contextGain?(): void; /** * Called to inform the dependent of a loss of WebGL rendering context. * The dependent must assume that any cached context is invalid. * The dependent must not try to use and cached context to free resources. * The dependent should reset its state to that for which there is no context. */ contextLost?(): void; } /** * */ interface ContextManager extends Shareable { /** * */ readonly gl: WebGL2RenderingContext | WebGLRenderingContext; /** * The context identifier that was used to get the WebGL rendering context. */ readonly contextId: "webgl2" | "webgl"; /** * */ synchronize(consumer: ContextConsumer): void; /** * */ addContextListener(consumer: ContextConsumer): void; /** * */ removeContextListener(consumer: ContextConsumer): void; } /** * @hidden */ declare class WebGLBlendFunc extends ShareableBase { private contextManager; sfactor: BlendingFactorSrc; dfactor: BlendingFactorDest; constructor(contextManager: ContextManager, sfactor: BlendingFactorSrc, dfactor: BlendingFactorDest); destructor(levelUp: number): void; contextFree(): void; contextGain(): void; contextLost(): void; private execute; } /** * @hidden */ declare class WebGLClearColor extends ShareableBase { private contextManager; r: number; g: number; b: number; a: number; constructor(contextManager: ContextManager, r?: number, g?: number, b?: number, a?: number); /** * */ destructor(levelUp: number): void; contextFree(): void; contextGain(): void; contextLost(): void; } /** * A capability that may be enabled or disabled for a WebGL rendering context. */ declare enum Capability { /** * Let polygons be culled. */ CULL_FACE = 2884, /** * Blend computed fragment color values with color buffer values. */ BLEND = 3042, /** * */ DITHER = 3024, /** * */ STENCIL_TEST = 2960, /** * Enable updates of the depth buffer. */ DEPTH_TEST = 2929, /** * Abandon fragments outside a scissor rectangle. */ SCISSOR_TEST = 3089, /** * Add an offset to the depth values of a polygon's fragments. */ POLYGON_OFFSET_FILL = 32823, /** * */ SAMPLE_ALPHA_TO_COVERAGE = 32926, /** * */ SAMPLE_COVERAGE = 32928 } /** * disable(capability: Capability): void * @hidden */ declare class WebGLDisable extends ShareableBase { private contextManager; private _capability; constructor(contextManager: ContextManager, capability: Capability); protected destructor(levelUp: number): void; contextFree(): void; contextGain(): void; contextLost(): void; } /** * enable(capability: Capability): void * @hidden */ declare class WebGLEnable extends ShareableBase { private contextManager; private _capability; constructor(contextManager: ContextManager, capability: Capability); protected destructor(levelUp: number): void; contextFree(): void; contextGain(): void; contextLost(): void; } /** * @hidden */ interface BrowserHTMLElement extends EventTarget { clientLeft: number; clientTop: number; ownerDocument: BrowserDocument; getBoundingClientRect(): { left: number; top: number; width: number; height: number; }; } /** * Intentionally undocumented. * This interface is defined to enable mocking in tests. * @hidden */ interface BrowserDocument extends EventTarget { documentElement: BrowserHTMLElement; getElementById(elementId: string): HTMLElement; } /** * Intentionally undocumented. * This interface is defined to enable mocking in tests. * @hidden */ interface BrowserWindow extends EventTarget { document: BrowserDocument; cancelAnimationFrame(handle: number): void; requestAnimationFrame(callback: FrameRequestCallback): number; } /** * Cartesian coordinates of a vector using the standard basis. */ interface VectorE3 { /** * The Cartesian x-coordinate. */ readonly x: number; /** * The Cartesian y-coordinate. */ readonly y: number; /** * The Cartesian z-coordinate. */ readonly z: number; } /** * Cartesian coordinates of a bivector using the standard basis. */ interface BivectorE3 { /** * The Cartesian yz-coordinate. */ yz: number; /** * The Cartesian zx-coordinate. */ zx: number; /** * The Cartesian xy-coordinate. */ xy: number; } /** * Base class for matrices with the expectation that they will be used with WebGL. * The underlying data storage is a Float32Array. */ declare class AbstractMatrix implements Lockable { private lock_; private elements_; private length_; private dimensions_; /** * */ modified: boolean; /** * @param elements * @param dimensions */ constructor(elements: Float32Array, dimensions: number); isLocked(): boolean; lock(): number; unlock(token: number): void; get dimensions(): number; set dimensions(unused: number); get elements(): Float32Array; set elements(elements: Float32Array); copy(m: T): T; /** * @param row The zero-based row. * @param column The zero-based column. */ getElement(row: number, column: number): number; /** * Determines whether this matrix is the identity matrix. */ isOne(): boolean; /** * @param row The zero-based row. * @param column The zero-based column. * @param value The value of the element. */ setElement(row: number, column: number, value: number): void; } /** * @hidden */ interface Pseudo { /** * The pseudoscalar coordinate as a number.I */ readonly b: number; } /** * */ interface Scalar { /** * The scalar coordinate as a number. */ a: number; } /** * The even sub-algebra of the Euclidean algebra 𝓖(2, 0). */ interface SpinorE2 extends Scalar, Pseudo { } /** * */ interface VectorE2 { /** * The Cartesian x-coordinate or abscissa. */ x: number; /** * The Cartesian y-coordinate or ordinate. */ y: number; } /** * The even sub-algebra of the Euclidean algebra 𝓖(3, 0). */ interface SpinorE3 extends Scalar, BivectorE3 { } /** * A 4x4 (square) matrix of numbers. * * An adapter for a `Float32Array`. */ declare class Matrix4 extends AbstractMatrix { /** * */ constructor(elements: Float32Array); /** * The identity matrix for multiplication, 1. * The matrix is locked (immutable), but may be cloned. */ static readonly one: Matrix4; /** * The identity matrix for addition, 0. * The matrix is locked (immutable), but may be cloned. */ static readonly zero: Matrix4; /** * Constructs a 4x4 matrix that performs the scaling specified by the vector. */ static scaling(scale: VectorE3): Matrix4; /** * Constructs a 4x4 matrix that performs the translation specified by the vector. */ static translation(vector: VectorE3): Matrix4; /** * Constructs a 4x4 matrix that performs the rotation specified by the spinor. */ static rotation(spinor: SpinorE3): Matrix4; /** * Sets this matrix to `this + rhs`. */ add(rhs: Matrix4): this; /** * Sets this matrix to `a + b`. */ add2(a: Matrix4, b: Matrix4): this; /** * Returns a copy of this Matrix4 instance. */ clone(): Matrix4; /** * Sets this matrix to perform the specified scaling, rotation, and translation. */ compose(S: VectorE3, R: SpinorE3, T: VectorE3): this; /** * Copies the specified matrix into this matrix. */ copy(m: Matrix4): this; /** * Computes the determinant. */ det(): number; /** * Sets the elements of this matrix to that of its inverse. */ inv(): this; /** * Sets this matrix to the identity element for multiplication, 1. */ one(): this; /** * Multiplies all elements of this matrix by the specified value. */ scale(s: number): this; /** * Sets this matrix to its transpose. */ transpose(): this; /** * @param left * @param right * @param bottom * @param top * @param near * @param far */ frustum(left: number, right: number, bottom: number, top: number, near: number, far: number): this; /** * Sets this matrix to the viewing transformation. * This is the matrix that may be applied to points in the truncated viewing pyramid. * The resulting points then lie in the image space (cube). */ perspective(fov: number, aspect: number, near: number, far: number): this; /** * @param axis * @param angle */ rotationAxis(axis: VectorE3, angle: number): this; /** * */ mul(rhs: Matrix4): this; /** * */ mul2(a: Matrix4, b: Matrix4): this; /** * */ rmul(lhs: Matrix4): this; /** * Sets this matrix to the transformation for a * reflection in the plane normal to the unit vector n. * * this ⟼ reflection(n) * * @param n */ reflection(n: VectorE3): this; /** * this ⟼ rotation(spinor) * this * * @param spinor */ rotate(spinor: SpinorE3): this; /** * Sets this matrix to be equivalent to the spinor. * * this ⟼ rotation(spinor) * * @param spinor The spinor from which the rotation will be computed. */ rotation(spinor: SpinorE3): this; /** * @param i the zero-based index of the row. */ row(i: number): Array; /** * */ scaleXYZ(scale: VectorE3): this; /** * */ scaling(scale: VectorE3): this; /** * */ set(n11: number, n12: number, n13: number, n14: number, n21: number, n22: number, n23: number, n24: number, n31: number, n32: number, n33: number, n34: number, n41: number, n42: number, n43: number, n44: number): this; /** * */ toExponential(fractionDigits?: number): string; /** * */ toFixed(fractionDigits?: number): string; /** * */ toPrecision(fractionDigits?: number): string; /** * */ toString(radix?: number): string; /** * this ⟼ translation(spinor) * this */ translate(d: VectorE3): this; /** * Sets this matrix to be equivalent to the displacement vector argument. */ translation(displacement: VectorE3): this; /** * Sets this matrix to the identity element for addition, 0. */ zero(): this; __mul__(rhs: Matrix4 | number): Matrix4; __rmul__(lhs: Matrix4 | number): Matrix4; } /** *

* A 3x3 (square) matrix of numbers. *

*

* An adapter over a Float32Array, enabling it to be used directly with WebGL. *

*

* The 9 elements are stored in column-major order (the order expected by WebGL): * * * * *
036
147
258
*

*/ declare class Matrix3 extends AbstractMatrix { /** * @param elements */ constructor(elements: Float32Array); /** * */ add(rhs: Matrix3): this; /** * */ add2(a: Matrix3, b: Matrix3): this; /** * Returns a copy of this Matrix3 instance. */ clone(): Matrix3; /** * Computes the determinant. */ det(): number; /** *

* Sets this matrix to the inverse of the upper-left 3x3 portion of a 4x4 matrix. *

* * @param matrix * @param throwOnSingular */ private invertUpperLeft; /** * */ inv(): this; /** * */ isOne(): boolean; /** * */ isZero(): boolean; /** * @param rhs */ mul(rhs: Matrix3): this; /** * @param lhs */ rmul(lhs: Matrix3): this; /** * @param a * @param b */ mul2(a: Matrix3, b: Matrix3): this; /** * */ neg(): this; /** *

* Sets this 3x3 matrix to the matrix required to properly transform normal vectors * (pseudo or axial vectors) based upon the 4x4 matrix used to transform polar vectors. *

* * @param m */ normalFromMatrix4(m: Matrix4): this; /** * */ one(): this; /** *

* Sets this matrix to the transformation for a * reflection in the plane normal to the unit vector n. *

*

* this ⟼ reflection(n) *

* * @param n */ reflection(n: VectorE2): this; /** * @param i the zero-based index of the row. */ row(i: number): number[]; /** * @param spinor */ rotate(spinor: SpinorE2): this; /** * @param spinor */ rotation(spinor: SpinorE2): this; /** * @param s */ scale(s: number): this; /** *

* Sets all elements of this matrix to the supplied values (provided in row-major order). *

*

* An advantage of this method is that the function call resembles the matrix written out. *

*

* The parameters are named according to the 1-based row and column. *

* * @param n11 * @param n12 * @param n13 * @param n21 * @param n22 * @param n23 * @param n31 * @param n32 * @param n33 */ set(n11: number, n12: number, n13: number, n21: number, n22: number, n23: number, n31: number, n32: number, n33: number): this; /** * @param rhs */ sub(rhs: Matrix3): this; /** * @param fractionDigits */ toExponential(fractionDigits?: number): string; /** * @param fractionDigits */ toFixed(fractionDigits?: number): string; /** * @param precision */ toPrecision(precision?: number): string; /** * @param radix */ toString(radix?: number): string; /** *

* Computes the homogeneous translation matrix for a 2D translation. *

* * @param d */ translation(d: VectorE2): this; /** * */ transpose(): this; /** * Sets this matrix to the identity element for addition, 0. */ zero(): this; __add__(rhs: any): Matrix3; __radd__(lhs: any): Matrix3; __mul__(rhs: any): Matrix3; __rmul__(lhs: any): Matrix3; __pos__(): Matrix3; __neg__(): Matrix3; __sub__(rhs: any): Matrix3; __rsub__(lhs: any): Matrix3; /** * The identity matrix for multiplication. * The matrix is locked (immutable), but may be cloned. */ static readonly one: Matrix3; /** * @param n */ static reflection(n: VectorE2): Matrix3; /** * @param spinor */ static rotation(spinor: SpinorE2): Matrix3; /** * @param d */ static translation(d: VectorE2): Matrix3; /** * The identity matrix for addition. * The matrix is locked (immutable), but may be cloned. */ static readonly zero: Matrix3; } /** * */ declare class Vector3 { isLocked(): boolean; lock(): number; unlock(token: number): void; /** * */ private coords_; /** * */ private modified_; /** * @param a * @param b */ static dot(a: VectorE3, b: VectorE3): number; /** * Initializes the vector to the specified coordinates and modification state. * The returned vector is not locked. * @param coords Three numbers corresponding to the x, y, and z coordinates. Default is [0, 0, 0]. * @param modified The modification state. Default is false. */ constructor(coords?: [number, number, number], modified?: boolean); get length(): number; get modified(): boolean; set modified(modified: boolean); getComponent(i: number): number; /** * The coordinate corresponding to the e1 basis vector. */ get x(): number; set x(value: number); /** * The coordinate corresponding to the e2 basis vector. */ get y(): number; set y(value: number); /** * The coordinate corresponding to the e3 basis vector. */ get z(): number; set z(value: number); /** * */ get maskG3(): number; set maskG3(unused: number); /** *

* this ⟼ this + vector * α *

* * @param vector * @param α * @return this */ add(vector: VectorE3, α?: number): this; /** *

* this ⟼ σ * thisT *

* * @param σ */ applyMatrix(σ: Matrix3): this; /** * Pre-multiplies the column vector corresponding to this vector by the matrix. * The result is applied to this vector. * Strictly speaking, this method does not make much sense because the dimensions * of the square matrix and column vector don't match. * TODO: Used by TubeSimplexGeometry. * * @param σ The 4x4 matrix that pre-multiplies this column vector. * @return {Vector3} this */ applyMatrix4(σ: Matrix4): Vector3; /** * */ approx(n: number): Vector3; /** *

* this ⟼ - n * this * n *

* * @param n */ reflect(n: VectorE3): this; /** * @param R * @returns R * this * reverse(R) */ rotate(R: SpinorE3): Vector3; /** * @return {Vector3} copy(this) */ clone(): Vector3; /** * this ⟼ copy(source) * * @returns copy(this) */ copy(source: VectorE3): this; /** * Copies the coordinate values into this Vector3. * * @param coordinates * @returns */ copyCoordinates(coordinates: number[]): this; /** *

* this ⟼ this ✕ v *

* * @param v */ cross(v: VectorE3): Vector3; /** * this ⟼ a ✕ b * * @param a * @param b * @returns a x b */ cross2(a: VectorE3, b: VectorE3): Vector3; /** * @param point */ distanceTo(point: VectorE3): number; /** * @param point */ quadranceTo(point: VectorE3): number; /** *

* this ⟼ this / α *

*/ divByScalar(α: number): this; /** * @param v */ dot(v: VectorE3): number; /** *

* this ⟼ I * B *

* * Sets this vector to the dual of the bivector, B. * If changeSign is true, the direction of the resulting vector is reversed. * * @param B * @param changeSign */ dual(B: SpinorE3, changeSign: boolean): Vector3; /** * @param other */ equals(other: any): boolean; /** * */ isZero(): boolean; /** * Computes the square root of the squared norm. */ magnitude(): number; /** * @return {Vector3} this */ neg(): this; /** *

* this ⟼ this + α * (target - this) *

* * @param target * @param α * @return {Vector3} this */ lerp(target: VectorE3, α: number): this; /** *

* this ⟼ a + α * (b - a) *

* @param a * @param b * @param α */ lerp2(a: VectorE3, b: VectorE3, α: number): this; /** *

* this ⟼ this / norm(this) *

* * @return {Vector3} this */ normalize(): Vector3; /** *

* this ⟼ this * α *

* * @param α */ scale(α: number): Vector3; /** * @param σ */ stress(σ: VectorE3): this; /** *

* this ⟼ this, with components modified. *

* * @param x * @param y * @param z */ setXYZ(x: number, y: number, z: number): this; /** * Returns the (Euclidean) inner product of this vector with itself. * * @return this ⋅ this or norm(this) * norm(this) */ squaredNorm(): number; /** *

* this ⟼ this - v *

* * @param v * @param α * @return {Vector3} this */ sub(v: VectorE3, α?: number): Vector3; sub2(a: VectorE3, b: VectorE3): Vector3; /** * */ toArray(): number[]; /** * @param fractionDigits * @returns */ toExponential(fractionDigits?: number): string; /** * @param fractionDigits * @returns */ toFixed(fractionDigits?: number): string; /** * @param precision * @returns */ toPrecision(precision?: number): string; /** * @param radix * @returns */ toString(radix?: number): string; /** * Sets this vector to the identity element for addition, 0. */ zero(): Vector3; __add__(rhs: Vector3): Vector3; __radd__(lhs: Vector3): Vector3; __sub__(rhs: Vector3): Vector3; __rsub__(lhs: Vector3): Vector3; __mul__(rhs: number): Vector3; __rmul__(lhs: number | Matrix3): Vector3; __div__(rhs: number): Vector3; __rdiv__(lhs: any): Vector3; __pos__(): Vector3; __neg__(): Vector3; /** * @param vector */ static copy(vector: VectorE3): Vector3; /** * Constructs a vector which is the dual of the supplied bivector, B. * dual(B) = B << inv(I) */ static dual(B: BivectorE3): Vector3; static e1(): Vector3; static e2(): Vector3; static e3(): Vector3; /** * */ static isInstance(x: any): x is Vector3; /** * @param a * @param b * @param α * @return {Vector3} a + α * (b - a) */ static lerp(a: VectorE3, b: VectorE3, α: number): Vector3; /** *

* Computes a unit vector with a random direction. *

* * @return {Vector3} */ static random(): Vector3; /** * Creates a vector with the specified cartesian coordinates. * The returned vector is not locked. * The returned vector is not modified. * @param x The x-coordinate. * @param y The y-coordinate. * @param z The z-coordinate. */ static vector(x: number, y: number, z: number): Vector3; /** * Creates a vector with all cartesian coordinates set to zero. * The returned vector is not locked. * The returned vector is not modified. */ static zero(): Vector3; } /** * */ interface VectorE1 { /** * The Cartesian x-coordinate. */ readonly x: number; } /** * */ declare class Matrix2 extends AbstractMatrix { /** * 2x2 (square) matrix of numbers. * Constructs a Matrix2 by wrapping a Float32Array. * The elements are stored in column-major order: * 0 2 * 1 3 * * @param elements The elements of the matrix in column-major order. */ constructor(elements: Float32Array); add(rhs: Matrix2): Matrix2; add2(a: Matrix2, b: Matrix2): Matrix2; clone(): Matrix2; /** * Computes the determinant. */ det(): number; /** * Sets this matrix to its inverse. */ inv(): Matrix2; /** * Determines whether this matrix is the identity matrix for multiplication. */ isOne(): boolean; /** * Determines whether this matrix is the identity matrix for addition. */ isZero(): boolean; mul(rhs: Matrix2): Matrix2; mul2(a: Matrix2, b: Matrix2): Matrix2; /** * Sets this matrix to its additive inverse. */ neg(): Matrix2; /** * Sets this matrix to the identity element for multiplication, 1. */ one(): Matrix2; /** * Sets this matrix to the transformation for a * reflection in the line normal to the unit vector n. * * this ⟼ reflection(n) = I - 2 * nT * n * */ reflection(n: VectorE1): Matrix2; /** * Returns the row for the specified index. * @param i the zero-based index of the row. */ row(i: number): Array; /** * Multiplies this matrix by the scale factor, α. */ scale(α: number): Matrix2; /** * Sets all elements of this matrix to the supplied row-major values m11, ..., m22. * * @param m11 * @param m12 * @param m21 * @param m22 */ set(m11: number, m12: number, m21: number, m22: number): this; /** * @param rhs */ sub(rhs: Matrix2): this; /** * @param fractionDigits * @return */ toExponential(fractionDigits?: number): string; /** * @param fractionDigits * @return */ toFixed(fractionDigits?: number): string; /** * @param precision * @return */ toPrecision(precision?: number): string; /** * @param radix */ toString(radix?: number): string; /** * @param d */ translation(d: VectorE1): this; /** * Sets this matrix to the identity element for addition, 0. */ zero(): Matrix2; __add__(rhs: any): Matrix2; __radd__(lhs: any): Matrix2; __mul__(rhs: any): Matrix2; __rmul__(lhs: any): Matrix2; __pos__(): Matrix2; __neg__(): Matrix2; __sub__(rhs: any): Matrix2; __rsub__(lhs: any): Matrix2; static readonly one: Matrix2; /** * */ static reflection(n: VectorE1): Matrix2; static readonly zero: Matrix2; } /** * */ declare class Vector2 { isLocked(): boolean; lock(): number; unlock(token: number): void; /** * */ private coords_; /** * */ private modified_; /** * @param coords The x coordinate and y coordinate. * @param modified */ constructor(coords?: number[], modified?: boolean); get length(): number; get modified(): boolean; set modified(modified: boolean); getComponent(i: number): number; /** * */ get x(): number; set x(value: number); /** * */ get y(): number; set y(value: number); /** * @param v * @param α * @returns */ add(v: VectorE2, α?: number): Vector2; /** * @param a * @param b * @returns */ add2(a: VectorE2, b: VectorE2): Vector2; /** *

* this ⟼ σ * thisT *

* * @param σ */ applyMatrix(σ: Matrix2): this; /** * @param n */ approx(n: number): this; /** * @return {Vector2} */ clone(): Vector2; /** * @param v */ copy(v: VectorE2): this; /** * @param t * @param controlBegin * @param endPoint */ cubicBezier(t: number, controlBegin: VectorE2, controlEnd: VectorE2, endPoint: VectorE2): Vector2; /** * @param position */ distanceTo(position: VectorE2): number; /** * @param v */ sub(v: VectorE2): this; /** * @param a * @param b */ sub2(a: VectorE2, b: VectorE2): this; /** * @param α */ scale(α: number): this; /** * @param α */ divByScalar(α: number): this; min(v: VectorE2): this; max(v: VectorE2): this; floor(): this; ceil(): this; round(): this; roundToZero(): this; /** * @return {Vector2} this */ neg(): this; dot(v: VectorE2): number; /** * Computes the square root of the squared norm. */ magnitude(): number; normalize(): Vector2; squaredNorm(): number; quadranceTo(position: VectorE2): number; /** * @param t * @param controlPoint * @param endPoint */ quadraticBezier(t: number, controlPoint: VectorE2, endPoint: VectorE2): Vector2; reflect(n: VectorE2): Vector2; /** * @param spinor */ rotate(spinor: SpinorE2): this; /** * this ⟼ this + (v - this) * α * * @param v * @param α */ lerp(v: VectorE2, α: number): this; /** *

* this ⟼ a + α * (b - a) *

* * @param a * @param b * @param α * @return {Vector2} this */ lerp2(a: VectorE2, b: VectorE2, α: number): Vector2; equals(v: VectorE2): boolean; /** * @param σ */ stress(σ: VectorE2): this; /** * */ toArray(): number[]; /** * @param fractionDigits */ toExponential(fractionDigits?: number): string; /** * @param fractionDigits */ toFixed(fractionDigits?: number): string; /** * @param precision */ toPrecision(precision?: number): string; /** * @param radix */ toString(radix?: number): string; fromArray(array: number[], offset?: number): this; fromAttribute(attribute: { itemSize: number; array: number[]; }, index: number, offset?: number): this; /** * Sets this vector to the identity element for addition, 0. */ zero(): Vector2; __neg__(): Vector2; /** * @param vector */ static copy(vector: VectorE2): Vector2; /** * @param a * @param b * @return a + α * (b - a) */ static lerp(a: VectorE2, b: VectorE2, α: number): Vector2; /** *

* Computes a unit vector with a random direction. *

*/ static random(): Vector2; static vector(x: number, y: number): Vector2; static readonly zero: Vector2; } /** * @hidden */ declare class MouseControls extends ShareableBase { /** * * @default true */ enabled: boolean; /** * * @default false */ noRotate: boolean; /** * * @default false */ noZoom: boolean; /** * * @default false */ noPan: boolean; /** * * @default 0 */ minDistance: number; /** * * @default Infinity */ maxDistance: number; /** * */ private domElement; /** * The mouse controls operate modally. You can only do one thing (rotate, zoom, or pan) at a time. */ private mode; /** * Using the keyboard allows us to change modes, so we keep this so that we can revert. */ private prevMode; /** * */ protected moveCurr: Vector2; /** * */ protected movePrev: Vector2; /** * */ protected zoomStart: Vector2; /** * */ protected zoomEnd: Vector2; /** * */ protected panStart: Vector2; /** * */ protected panEnd: Vector2; /** * Initialized by calling handleResize */ private screenLoc; /** * Think of this vector as running from the top left corner of the screen. */ private circleExt; /** * Think of this vector as running from the bottom left corner of the screen. */ private screenExt; private mouseOnCircle; private mouseOnScreen; private mousedown; private mousemove; private mouseup; private mousewheel; private keydown; private keyup; private contextmenu; private wnd; /** * * @param wnd */ constructor(wnd?: BrowserWindow); protected destructor(levelUp: number): void; /** * Simulates a movement of the mouse in coordinates -1 to +1 in both directions. * * @param x * @param y */ move(x: number, y: number): void; /** * @param domElement */ subscribe(domElement: HTMLElement): void; /** * */ unsubscribe(): void; disableContextMenu(): void; enableContextMenu(): void; /** * */ reset(): void; /** * Computes coordinates in the range [-1,+1] in both e1 and e2 directions. * e1 goes to the RIGHT * e2 goes UP * Updates the mouseOnCircle property. * * @param mouse */ private updateMouseOnCircle; /** * Computes coordinates in the range [0,1] in both e1 and e2 directions. * e1 goes to the RIGHT * e2 goes DOWN * Updates the mouseOnScreen property. * * @param mouse */ private updateMouseOnScreen; /** * This should be called whenever the window is resized. */ handleResize(): void; } /** * */ interface ViewController { /** *

* Called during the animation loop to update the target based upon mouse events. *

*/ update(): void; /** *

* Called at any time to reset the target to the last synchonization point. *

*/ reset(): void; /** *

* Called at any time to set a view for this controller. *

* This method also synchronizes the controller with the view. * * @param view */ setView(view: { eye: VectorE3; look: VectorE3; up: VectorE3; }): void; /** *

* Called at any time to synchronize the controller with the view state. *

*/ synchronize(): void; } /** * @hidden */ declare class ViewControls extends MouseControls implements ViewController { /** * * @default 1 */ rotateSpeed: number; /** * * @default 1 */ zoomSpeed: number; /** * * @default 1 */ panSpeed: number; /** * The view.eye value when the view was acquired by this view controller. */ private eye0; /** * The view.look value when the view was acquired by this view controller. */ private look0; /** * The view.up value when the view was acquired by this view controller. */ private up0; /** * The view that is being controlled. * We work only with coordinates to minimize requirements for interoperability. */ private view; /** * */ protected eyeMinusLook: Vector3; /** * */ protected look: Vector3; /** * */ protected up: Vector3; /** * @param view * @param wnd */ constructor(view: { eye: VectorE3; look: VectorE3; up: VectorE3; }, wnd?: BrowserWindow); /** * @hidden */ protected destructor(levelUp: number): void; /** * @returns */ protected hasView(): boolean; /** * This should be called inside the animation frame to update the camera location. * Notice that the movement of the mouse controls is decoupled from the effect. * We also want to avoid temporary object creation in this and called methods by recycling variables. */ update(): void; /** * */ protected rotateCamera(): void; /** * */ protected zoomCamera(): void; /** * */ protected panCamera(): void; /** * */ reset(): void; /** * @param view */ setView(view: { eye: VectorE3; look: VectorE3; up: VectorE3; }): void; /** * */ synchronize(): void; } /** *

* OrbitControls move a camera over a sphere such that the camera up vector * remains aligned with the local north vector. *

*

* For rotations, the final camera position dictates a new camera local reference frame. * A rotor may be calculated that rotates the camera from its old reference frame to the * new reference frame. This rotor may also be interpolated for animations. *

* @hidden */ declare class OrbitControls extends ViewControls { /** * @param view * @param wnd */ constructor(view: { eye: VectorE3; look: VectorE3; up: VectorE3; }, wnd?: BrowserWindow); /** * @param levelUp */ protected destructor(levelUp: number): void; /** * */ protected rotateCamera(): void; } /** *

* Allows a camera to be manipulated using mouse controls. *

* * // The trackball controls a view implementation such as a camera. * const camera = new EIGHT.PerspectiveCamera() * * // Create TrackballControls anytime. * const controls = new EIGHT.TrackballControls(camera) * * // Subscribe to mouse events, usually in the window.onload function. * controls.subscribe(canvas) * * // Update the camera position, usually in the animate function. * controls.update() * * // Stop listening to mouse events. * controls.unsubscribe() * * // Inform the controls they are no longer needed, usually in the window.onunload function. * controls.release() * * You may decide to update directional lighting to synchronize with the camera. */ declare class TrackballControls extends ViewControls { private moveDirection; private eyeMinusLookDirection; private objectUpDirection; private objectSidewaysDirection; /** * The bivector for a rotation. */ private B; private rotor; private mouseChange; private pan; private objectUp; /** * * @param view eye, look, and up vectors. The coordinates will be manipulated by this object. * @param wnd The browser window. Used to add listeners for mouse and keyboard events. */ constructor(view: { eye: VectorE3; look: VectorE3; up: VectorE3; }, wnd?: Window); /** * @hidden */ protected destructor(levelUp: number): void; /** * @hidden */ protected rotateCamera(): void; /** * @hidden */ protected panCamera(): void; } /** * */ declare enum TextureUnit { TEXTURE0 = 33984, TEXTURE1 = 33985, TEXTURE2 = 33986, TEXTURE3 = 33987, TEXTURE4 = 33988, TEXTURE5 = 33989, TEXTURE6 = 33990, TEXTURE7 = 33991, TEXTURE8 = 33992, TEXTURE9 = 33993, TEXTURE10 = 33994, TEXTURE11 = 33995, TEXTURE12 = 33996, TEXTURE13 = 33997, TEXTURE14 = 33998, TEXTURE15 = 33999, TEXTURE16 = 34000, TEXTURE17 = 34001, TEXTURE18 = 34002, TEXTURE19 = 34003, TEXTURE20 = 34004, TEXTURE21 = 34005, TEXTURE22 = 34006, TEXTURE23 = 34007, TEXTURE24 = 34008, TEXTURE25 = 34009, TEXTURE26 = 34010, TEXTURE27 = 34011, TEXTURE28 = 34012, TEXTURE29 = 34013, TEXTURE30 = 34014, TEXTURE31 = 34015, ACTIVE_TEXTURE = 34016 } /** * A facet visitor implementation is able to accept a value to be assigned to a WebGL uniform in a WebGL program. * This interface is normally only implemented by a Material. */ interface FacetVisitor { /** * Informs the facet visitor of which texture unit is to be used. * @param unit The texture unit to be used. */ activeTexture(unit: TextureUnit): void; matrix2fv(name: string, mat2: Float32Array, transpose: boolean): void; matrix3fv(name: string, mat3: Float32Array, transpose: boolean): void; matrix4fv(name: string, mat4: Float32Array, transpose: boolean): void; uniform1f(name: string, x: number): void; uniform1fv(name: string, data: Float32Array, srcOffset: number, srcLength: number): void; uniform1i(name: string, x: number): void; uniform1iv(name: string, data: Int32Array, srcOffset?: number, srcLength?: number): void; uniform2f(name: string, x: number, y: number): void; uniform2fv(name: string, data: Float32Array, srcOffset?: number, srcLength?: number): void; uniform2i(name: string, x: number, y: number): void; uniform2iv(name: string, data: Int32Array, srcOffset?: number, srcLength?: number): void; uniform3f(name: string, x: number, y: number, z: number): void; uniform3fv(name: string, data: Float32Array, srcOffset?: number, srcLength?: number): void; uniform3i(name: string, x: number, y: number, z: number): void; uniform3iv(name: string, data: Int32Array, srcOffset?: number, srcLength?: number): void; uniform4f(name: string, x: number, y: number, z: number, w: number): void; uniform4fv(name: string, data: Float32Array, srcOffset?: number, srcLength?: number): void; uniform4i(name: string, x: number, y: number, z: number, w: number): void; uniform4iv(name: string, data: Int32Array, srcOffset?: number, srcLength?: number): void; } /** * A `facet` is an adapter between a domain concept and a `uniform` value parameter in a WebGL shader program. * An object implementing the `Facet` interface is capable of setting uniform values on a `FacetVisitor` (which is * usually implemented by a `Material`). */ interface Facet extends Shareable { /** * Sets one of more uniform values on the `FacetVisitor`. * @param visitor A visitor to the `Facet`, usually a `Material` implementation. */ setUniforms(visitor: FacetVisitor): void; } /** * */ interface ContextProgramConsumer { contextFree(): void; contextGain(gl: WebGL2RenderingContext | WebGLRenderingContext, program: WebGLProgram): void; contextLost(): void; } /** * An object-oriented representation of an attribute in a GLSL shader program. */ declare class Attrib implements ContextProgramConsumer { /** * The name of the attribute in the GLSL program. */ private _name; /** * The index of the attribute in the GLSL program. * This is obtained by calling the getAttribLocation method on * the WebGLRenderingContext when it becomes available through * a contextGain notification. */ private _index; /** * The cached WebGLRenderingContext obtained through * a contextGain notification. */ private _gl; /** * */ private suppressWarnings; /** * */ constructor(contextManager: ContextManager, info: WebGLActiveInfo); /** * Returns the cached index obtained by calling getAttribLocation on the * WebGLRenderingContext. */ get index(): number; set index(unused: number); /** * Notifies this Attrib of a browser free WebGL context event. * This Attrib responds by setting its cached index and context to undefined. */ contextFree(): void; /** * Notifies this Attrib of a browser gain WebGL context event. * This Attrib responds by obtaining and caching attribute index. * * @param context * @param program */ contextGain(context: WebGL2RenderingContext | WebGLRenderingContext, program: WebGLProgram): void; /** * Notifies this Attrib of a browser lost WebGL context event. * This Attrib responds by setting its cached index and context to undefined. */ contextLost(): void; /** * Specifies the data formats and locations of vertex attributes in a vertex attributes array. * Calls the vertexAttribPointer method * on the underlying WebGLRenderingContext * using the cached attribute index and the supplied parameters. * Note that the type parameter is hard-code to FLOAT. * * @param size The number of components per attribute. Must be 1, 2, 3, or 4. * @param type The data type of each component in the array. * @param normalized Specifies whether fixed-point data values should be normalized (true), or are converted to fixed point vales (false) when accessed. * @param stride The distance in bytes between the beginning of consecutive vertex attributes. * @param offset The offset in bytes of the first component in the vertex attribute array. Must be a multiple of type. */ config(size: number, type: DataType, normalized?: boolean, stride?: number, offset?: number): void; /** * Calls the enableVertexAttribArray method * on the underlying WebGLRenderingContext * using the cached attribute index. */ enable(): void; /** * Calls the disableVertexAttribArray method * on the underlying WebGLRenderingContext * using the cached attribute index. */ disable(): void; /** * Returns the address of the specified vertex attribute. * Experimental. */ getOffset(): number; /** * Returns a non-normative string representation of the GLSL attribute. */ toString(): string; } /** * A wrapper around a WebGLUniformLocation. */ declare class Uniform implements ContextProgramConsumer { private gl; private location; private name; constructor(info: WebGLActiveInfo); contextFree(): void; contextGain(gl: WebGL2RenderingContext | WebGLRenderingContext, program: WebGLProgram): void; contextLost(): void; uniform1f(x: number): void; uniform1fv(data: Float32Array, srcOffset?: number, srcLength?: number): void; uniform1i(x: number): void; uniform1iv(data: Int32Array, srcOffset?: number, srcLength?: number): void; uniform2f(x: number, y: number): void; uniform2fv(data: Float32Array, srcOffset?: number, srcLength?: number): void; uniform2i(x: number, y: number): void; uniform2iv(data: Int32Array, srcOffset?: number, srcLength?: number): void; uniform3f(x: number, y: number, z: number): void; uniform3fv(data: Float32Array, srcOffset?: number, srcLength?: number): void; uniform3i(x: number, y: number, z: number): void; uniform3iv(data: Int32Array, srcOffset?: number, srcLength?: number): void; uniform4f(x: number, y: number, z: number, w: number): void; uniform4fv(data: Float32Array, srcOffset?: number, srcLength?: number): void; uniform4i(x: number, y: number, z: number, w: number): void; uniform4iv(data: Int32Array, srcOffset?: number, srcLength?: number): void; /** * Sets a uniform location of type mat2 in the WebGLProgram. */ matrix2fv(transpose: boolean, value: Float32Array): void; /** * Sets a uniform location of type mat3 in a WebGLProgram. */ matrix3fv(transpose: boolean, value: Float32Array): void; /** * Sets a uniform location of type mat4 in a WebGLProgram. */ matrix4fv(transpose: boolean, value: Float32Array): void; toString(): string; } /** * @hidden */ declare class ShareableContextConsumer extends ShareableBase implements ContextConsumer { protected contextManager: ContextManager; /** * Keep track of subscription state */ private isSubscribed; /** * Creates a subscription to WebGL rendering context events from the contextManager but * defers synchronization (because this is a base class). * The contextManager must be defined. * @param contextManager The ContextManager that will be subscribed to for WebGL rendering context events. */ constructor(contextManager: ContextManager); /** * */ protected resurrector(levelUp: number): void; /** * */ protected destructor(levelUp: number): void; /** * Instructs the consumer to subscribe to context events. * * This method is idempotent; calling it more than once with the same ContextManager does not change the state. */ private subscribe; /** * Instructs the consumer to unsubscribe from context events. * * This method is idempotent; calling it more than once does not change the state. */ private unsubscribe; /** * */ synchUp(): void; /** * */ cleanUp(): void; contextFree(): void; contextGain(): void; contextLost(): void; /** * Provides access to the underlying WebGL context. */ get gl(): WebGLRenderingContext; } /** * WebGLBuffer usage. */ declare enum Usage { /** * Contents of the buffer are likely to not be used often. * Contents are written to the buffer, but not read. */ STREAM_DRAW = 35040, /** * Contents of the buffer are likely to be used often and not change often. * Contents are written to the buffer, but not read. */ STATIC_DRAW = 35044, /** * Contents of the buffer are likely to be used often and change often. * Contents are written to the buffer, but not read. */ DYNAMIC_DRAW = 35048 } /** * A wrapper around a WebGLBuffer with binding to ARRAY_BUFFER. */ declare class VertexBuffer extends ShareableContextConsumer { private data; private usage; /** * The underlying WebGL buffer resource. */ private webGLBuffer; /** * */ constructor(contextManager: ContextManager, data: Float32Array, usage: Usage, levelUp?: number); /** * */ protected resurrector(levelUp: number): void; /** * */ protected destructor(levelUp: number): void; upload(): void; contextFree(): void; contextGain(): void; contextLost(): void; /** * Binds this buffer to the ARRAY_BUFFER target. */ bind(): void; /** * Unbinds this buffer from the ARRAY_BUFFER target. */ unbind(): void; } /** * Material is an object-oriented wrapper around a WebGLProgram. */ interface Material extends FacetVisitor, ContextConsumer { /** * */ attrib(name: string, value: VertexBuffer, size: number, normalized?: boolean, stride?: number, offset?: number): Material; /** * */ getAttrib(indexOrName: number | string): Attrib; /** * @param name The name of the attribute. * @returns The index of the attribute. */ getAttribLocation(name: string): number; /** * @param indexOrName The index or name of the attribute. */ enableAttrib(indexOrName: number | string): void; /** * @param indexOrName The index or name of the attribute. */ disableAttrib(indexOrName: number | string): void; /** * */ drawArrays(mode: BeginMode, first: number, count: number): Material; /** * */ drawElements(mode: BeginMode, count: number, type: DataType, offset: number): Material; getUniform(name: string): Uniform; hasUniform(name: string): boolean; matrix2fv(name: string, elements: Float32Array, transpose?: boolean): Material; matrix3fv(name: string, elements: Float32Array, transpose?: boolean): Material; matrix4fv(name: string, elements: Float32Array, transpose?: boolean): Material; /** * */ uniform(name: string, value: number | number[]): Material; use(): Material; } /** * Encapsulates one or more buffers and a call to drawArrays or drawElements. */ interface Geometry extends ContextConsumer { /** * Binds the attributes of the material to the buffers in this Geometry. */ bind(material: Material): void; /** * Unbinds the attributes of the material from the buffers in this Geometry. */ unbind(material: Material): void; /** * A call to drawArrays or drawElements. */ draw(): void; } /** * The interface contract for an object that may exist in a Scene. * This interface is designed to place very few demands on the implementation. */ interface Renderable extends ContextConsumer { /** * An optional name allowing the object to be found by name. */ name?: string; /** * Determines when this object will be renderered relative to other objects. * Transparent objects are rendered after non-transparent objects. */ transparent?: boolean; /** * Renders this object to the WebGL pipeline. */ render(ambients: Facet[]): void; } /** * */ interface AbstractDrawable extends Renderable { /** * */ name: string; /** *

* The Geometry that provides the buffered vertex attributes for this AbstractDrawable. *

* *

* Geometry is a shareable WebGL resource and so is reference counted. * Consequently, accessing the geometry property increments the Geometry instance reference count. * Be sure to call release() on shareable WebGL resources in order to prevent memory leaks. *

* */ geometry: G; /** *

* The Material that provides the WebGLProgram for this AbstractDrawable. *

* *

* Material is a shareable WebGL resource and so is reference counted. * Consequently, accessing the material property increments the Material instance reference count. * Be sure to call release() on shareable WebGL resources in order to prevent memory leaks. *

* */ material: M; /** * Determines whether this object will be drawn. */ visible: boolean; /** * Determines when this object will be drawn. * Transparent objects should be rendered after non-transparent objects. */ transparent: boolean; /** * A convenience method for geometry.bind(material). */ bind(): AbstractDrawable; /** * Calls the underlying drawArrays or drawElements method on the WebGLRenderingContext. */ draw(): AbstractDrawable; /** * High-Level rendering convenience method equivalent to... * * use() * bind() * setAmbients(ambients) * setUniforms() * draw() * unbind() */ render(ambients: Facet[]): AbstractDrawable; /** * */ setAmbients(ambients: Facet[]): AbstractDrawable; /** * */ setUniforms(): AbstractDrawable; /** * A convenience method for geometry.unbind(material). */ unbind(): AbstractDrawable; /** * A convenience method for material.use(). */ use(): AbstractDrawable; } /** * Marker interface * * Cartesian coordinates * 3 linear dimensions * No units of measure * Euclidean metric. * @hidden */ interface CartesianG3 { /** * A bitmask describing the grades. * * 0x0 = zero * 0x1 = scalar * 0x2 = vector * 0x4 = bivector * 0x8 = pseudoscalar */ readonly maskG3: number; } /** * */ interface GeometricE3 extends Pseudo, Scalar, SpinorE3, VectorE3 { } /** * */ declare class Geometric3 { isLocked(): boolean; lock(): number; unlock(token: number): void; /** * */ private coords_; /** * */ private modified_; /** * Constructs a Geometric3. * The multivector is initialized to zero. * coords [a, x, y, z, xy, yz, zx, b] */ constructor(coords?: [number, number, number, number, number, number, number, number]); get length(): number; get modified(): boolean; set modified(modified: boolean); getComponent(i: number): number; /** * Consistently set a coordinate value in the most optimized way, * by checking for a change from the old value to the new value. * The modified flag is only set to true if the value has changed. * Throws an exception if this multivector is locked. */ private setCoordinate; /** * The scalar part of this multivector. */ get a(): number; set a(a: number); /** * The coordinate corresponding to the e1 standard basis vector. */ get x(): number; set x(x: number); /** * The coordinate corresponding to the e2 standard basis vector. */ get y(): number; set y(y: number); /** * The coordinate corresponding to the e3 standard basis vector. */ get z(): number; set z(z: number); /** * The coordinate corresponding to the e2e3 standard basis bivector. */ get yz(): number; set yz(yz: number); /** * The coordinate corresponding to the e3e1 standard basis bivector. */ get zx(): number; set zx(zx: number); /** * The coordinate corresponding to the e1e2 standard basis bivector. */ get xy(): number; set xy(xy: number); /** * The pseudoscalar part of this multivector. */ get b(): number; set b(b: number); /** * A bitmask describing the grades. * * 0x0 = zero * 0x1 = scalar * 0x2 = vector * 0x4 = bivector * 0x8 = pseudoscalar */ get maskG3(): number; /** * Adds a multivector value to this multivector with optional scaling. * * this ⟼ this + M * alpha * * @param M The multivector to be added to this multivector. * @param alpha An optional scale factor that multiplies the multivector argument. * * @returns this + M * alpha */ add(M: GeometricE3, alpha?: number): Geometric3; /** * Adds a bivector value to this multivector. * * this ⟼ this + B * * @returns this + B */ addBivector(B: BivectorE3): Geometric3; /** * Adds a pseudoscalar value to this multivector. * * this ⟼ this + I * β * * @param β The pseudoscalar value to be added to this multivector. * @returns this + I * β */ addPseudo(β: number): Geometric3; /** * Adds a scalar value to this multivector. * * @param alpha The scalar value to be added to this multivector. * @return this + alpha */ addScalar(alpha: number): Geometric3; /** * Adds a vector value to this multivector. * * @param v The vector to be added. * @param alpha The scaling factor for the vector. * @returns this + v * alpha */ addVector(v: VectorE3, alpha?: number): Geometric3; /** *

* this ⟼ a + b *

* * @param a * @param b */ add2(a: GeometricE3, b: GeometricE3): this; /** * arg(A) = grade(log(A), 2) * * @returns The arg of this multivector. */ arg(): Geometric3; /** * Sets any coordinate whose absolute value is less than pow(10, -n) times the absolute value of the largest coordinate. */ approx(n: number): Geometric3; /** * @returns copy(this) */ clone(): Geometric3; /** * The Clifford conjugate. * The multiplier for the grade x is (-1) raised to the power x * (x + 1) / 2 * The pattern of grades is +--++--+ * * @returns conj(this) */ conj(): Geometric3; /** * Copies the coordinate values into this Geometric3. * * @param coordinates The coordinates in order a, x, y, z, yz, zx, xy, b. */ copyCoordinates(coordinates: number[]): this; /** * @param point */ distanceTo(point: VectorE3): number; /** * Computes the quadrance from this position (vector) to the specified point. */ quadranceTo(point: VectorE3): number; /** * Left contraction of this multivector with another multivector. * @param m * @returns this << m */ lco(m: GeometricE3): Geometric3; /** * Sets this multivector to a << b * * @param a * @param b * @returns a << b */ lco2(a: GeometricE3, b: GeometricE3): this; /** * Right contraction. * * A >> B = grade(A * B, a - b) = A.rco(B) * * @returns this >> rhs */ rco(m: GeometricE3): this; /** *

* this ⟼ a >> b *

* * @param a * @param b */ rco2(a: GeometricE3, b: GeometricE3): this; /** * Sets this multivector to be a copy of another multivector. * @returns copy(M) */ copy(M: GeometricE3): this; /** * Sets this multivector to the value of the scalar, α. * The non-scalar components are set to zero. * * @param α The scalar to be copied. */ copyScalar(α: number): this; /** * Copies the spinor argument value into this multivector. * The non-spinor components are set to zero. * * @param spinor The spinor to be copied. */ copySpinor(spinor: SpinorE3): this; /** * Copies the vector argument value into this multivector. * The non-vector components are set to zero. * * @param vector The vector to be copied. */ copyVector(vector: VectorE3): this; /** * Sets this multivector to the generalized vector cross product with another multivector. * * this ⟼ dual(this ^ m) */ cross(m: GeometricE3): Geometric3; /** *

* this ⟼ this / m *

* * @param m The multivector dividend. * @returns this / m */ div(m: GeometricE3): Geometric3; /** * Division of this multivector by a scalar. * * @returns this / alpha */ divByScalar(alpha: number): Geometric3; /** * this ⟼ this / v * * @param v The vector on the right hand side of the / operator. * @returns this / v */ divByVector(v: VectorE3): Geometric3; /** * this ⟼ a / b */ div2(a: SpinorE3, b: SpinorE3): this; dual(): Geometric3; /** * @param other * @returns */ equals(other: any): boolean; /** * this ⟼ exp(this) */ exp(): Geometric3; /** * @returns inverse(this) */ inv(): Geometric3; /** * Determins whether this multivector is exactly zero. */ isOne(): boolean; /** * Determins whether this multivector is exactly one. */ isZero(): boolean; /** * @returns this + α * (target - this) */ lerp(target: GeometricE3, α: number): Geometric3; /** * Linear interpolation. * Sets this multivector to a + α * (b - a) */ lerp2(a: GeometricE3, b: GeometricE3, α: number): this; /** * this ⟼ log(this) * * @returns log(this) */ log(): Geometric3; /** * magnitude(this) = sqrt(this | ~this) */ magnitude(): number; /** * this ⟼ this * m * * @returns this * m */ mul(m: GeometricE3): Geometric3; private mulByVector; /** * this ⟼ a * b */ mul2(a: GeometricE3, b: GeometricE3): this; /** * this ⟼ -1 * this * * @returns -1 * this */ neg(): Geometric3; /** * norm(A) = |A| = A | ~A, where | is the scalar product and ~ is reversion. * * this ⟼ magnitude(this) = sqrt(scp(this, rev(this))) = sqrt(this | ~this) * * @returns norm(this) */ norm(): Geometric3; /** * @returns this / magnitude(this) */ direction(): Geometric3; /** * this ⟼ this / magnitude(this) * * If the magnitude is zero (a null multivector), this multivector is unchanged. * Since the metric is Euclidean, this will only happen if the multivector is also the * zero multivector. */ normalize(): Geometric3; /** * Sets this multivector to the identity element for multiplication, 1. */ one(): this; /** * squaredNorm(A) = |A||A| = A | ~A * * Returns the (squared) norm of this multivector. * * If this multivector is mutable (unlocked), then it is set to the squared norm of this multivector, * and the return value is this multivector. * If thus multivector is immutable (locked), then a new multivector is returned which is also immutable. * * this ⟼ squaredNorm(this) = scp(this, rev(this)) = this | ~this * * @returns squaredNorm(this) */ squaredNorm(): Geometric3; /** * Computes the square of the magnitude. */ quaditude(): number; /** * Sets this multivector to its reflection in the plane orthogonal to vector n. * * Mathematically, * * this ⟼ - n * this * n * * Geometrically, * * Reflects this multivector in the plane orthogonal to the unit vector, n. * * If n is not a unit vector then the result is scaled by n squared. * * @param n The unit vector that defines the reflection plane. */ reflect(n: VectorE3): Geometric3; /** * this ⟼ reverse(this) */ rev(): Geometric3; /** * Rotates this multivector using a rotor, R. * * @returns R * this * reverse(R) = R * this * ~R */ rotate(R: SpinorE3): Geometric3; /** * Sets this multivector to a rotor that rotates through angle θ around the specified axis. * * @param axis The (unit) vector defining the rotation direction. * @param θ The rotation angle in radians when the rotor is applied on both sides as R * M * ~R */ rotorFromAxisAngle(axis: VectorE3, θ: number): this; /** * Computes a rotor, R, from two unit vectors, where * R = (|b||a| + b * a) / sqrt(2 * |b||a|(|b||a| + b << a)) * * The result is independent of the magnitudes of a and b. * * @param a The starting vector * @param b The ending vector * @returns The rotor representing a rotation from a to b. */ rotorFromDirections(a: VectorE3, b: VectorE3): this; /** * Helper function for rotorFromFrameToFrame. */ private rotorFromTwoVectors; /** * */ rotorFromFrameToFrame(es: VectorE3[], fs: VectorE3[]): this; /** * Sets this multivector to a rotor that rotates through angle θ in the oriented plane defined by B. * * this ⟼ exp(- B * θ / 2) = cos(|B| * θ / 2) - B * sin(|B| * θ / 2) / |B| * * @param B The (unit) bivector generating the rotation. * @param θ The rotation angle in radians when the rotor is applied on both sides as R * M * ~R */ rotorFromGeneratorAngle(B: BivectorE3, θ: number): this; /** * R = (|b||a| + b * a) / sqrt(2 * |b||a|(|b||a| + b << a)) * * The result is independent of the magnitudes of a and b. */ rotorFromVectorToVector(a: VectorE3, b: VectorE3, B: BivectorE3 | undefined): this; /** * Scalar Product * @returns scp(this, rhs) = this | rhs */ scp(rhs: GeometricE3): Geometric3; /** * this ⟼ scp(a, b) = a | b */ scp2(a: GeometricE3, b: GeometricE3): this; /** * this ⟼ this * alpha */ scale(alpha: number): Geometric3; /** * Applies the diagonal elements of a scaling matrix to this multivector. * * @param σ */ stress(σ: VectorE3): Geometric3; /** * Sets this multivector to the geometric product of the arguments. * This multivector must be mutable (in the unlocked state). * * this ⟼ a * b * * @param a The vector on the left of the operator. * @param b The vector on the right of the operator. * * @returns the geometric product, a * b, of the vector arguments. */ versor(a: VectorE3, b: VectorE3): this; /** * @returns this - M * α */ sub(M: GeometricE3, α?: number): Geometric3; /** *

* this ⟼ this - v * α *

* * @param v * @param α * @returns this - v * α */ subVector(v: VectorE3, α?: number): Geometric3; /** *

* this ⟼ a - b *

* * @param a * @param b */ sub2(a: GeometricE3, b: GeometricE3): this; /** * */ toArray(): number[]; /** * Returns a string representing the number in exponential notation. */ toExponential(fractionDigits?: number): string; /** * Returns a string representing the number in fixed-point notation. */ toFixed(fractionDigits?: number): string; /** * */ toPrecision(precision?: number): string; /** * Returns a string representation of this multivector. */ toString(radix?: number): string; /** * Extraction of grade i. * * If this multivector is mutable (unlocked) then it is set to the result. * * @param i The index of the grade to be extracted. */ grade(i: number): Geometric3; /** * @returns this ^ m */ ext(m: GeometricE3): Geometric3; /** * Sets this multivector to the outer product of `a` and `b`. * this ⟼ a ^ b */ ext2(a: GeometricE3, b: GeometricE3): this; /** * Sets this multivector to the identity element for addition, 0. */ zero(): this; /** * Implements `this + rhs` as addition. * The returned value is locked. * @hidden */ __add__(rhs: number | CartesianG3): Geometric3 | undefined; /** * Implements `lhs + this` as addition. * The returned value is locked. * @hidden */ __radd__(lhs: number | Geometric3): Geometric3 | undefined; /** * Implements `this / rhs` as division. * The returned value is locked. * @hidden */ __div__(rhs: number | CartesianG3): Geometric3 | undefined; /** * Implements `lhs / this` as division. * The returned value is locked. * @hidden */ __rdiv__(lhs: number | Geometric3): Geometric3 | undefined; /** * Implements `this * rhs` as the geometric product. * The returned value is locked. * @hidden */ __mul__(rhs: number | CartesianG3): Geometric3 | undefined; /** * Implements `lhs * this` as the geometric product. * The returned value is locked. * @hidden */ __rmul__(lhs: number | Geometric3): Geometric3 | undefined; /** * Implements `this - rhs` as subtraction. * The returned value is locked. * @hidden */ __sub__(rhs: number | CartesianG3): Geometric3 | undefined; /** * Implements `lhs - this` as subtraction. * The returned value is locked. * @hidden */ __rsub__(lhs: number | Geometric3): Geometric3 | undefined; /** * Implements `this ^ rhs` as the extension. * The returned value is locked. * @hidden */ __wedge__(rhs: number | Geometric3): Geometric3 | undefined; /** * Implements `lhs ^ this` as the extension. * The returned value is locked. * @hidden */ __rwedge__(lhs: number | Geometric3): Geometric3 | undefined; /** * Implements `this << rhs` as the left contraction. * The returned value is locked. * @hidden */ __lshift__(rhs: number | Geometric3): Geometric3 | undefined; /** * Implements `lhs << this` as the left contraction. * The returned value is locked. * @hidden */ __rlshift__(lhs: number | Geometric3): Geometric3 | undefined; /** * Implements `this >> rhs` as the right contraction. * The returned value is locked. * @hidden */ __rshift__(rhs: number | Geometric3): Geometric3 | undefined; /** * Implements `lhs >> this` as the right contraction. * The returned value is locked. * @hidden */ __rrshift__(lhs: number | Geometric3): Geometric3 | undefined; /** * Implements `this | rhs` as the scalar product. * The returned value is locked. * @hidden */ __vbar__(rhs: number | Geometric3): Geometric3 | undefined; /** * Implements `lhs | this` as the scalar product. * The returned value is locked. * @hidden */ __rvbar__(lhs: number | Geometric3): Geometric3 | undefined; /** * Implements `!this` as the inverse (if it exists) of `this`. * The returned value is locked. * @hidden */ __bang__(): Geometric3; /** * Implements `+this` as `this`. * The returned value is locked. * @hidden */ __pos__(): Geometric3; /** * Implements `-this` as the negative of `this`. * The returned value is locked. * @hidden */ __neg__(): Geometric3; /** * Implements `~this` as the reversion of `this`. * The returned value is locked. * @hidden */ __tilde__(): Geometric3; /** * The identity element for addition, `0`. * The multivector is locked. */ static readonly ZERO: Geometric3; /** * The identity element for multiplication, `1`. * The multivector is locked (immutable), but may be cloned. */ static readonly ONE: Geometric3; /** * */ static one(lock?: boolean): Geometric3; /** * The basis element corresponding to the vector `x` coordinate. * The multivector is locked (immutable), but may be cloned. */ static readonly E1: Geometric3; /** * Constructs the basis vector e1. * Locking the vector prevents mutation. */ static e1(lock?: boolean): Geometric3; /** * The basis element corresponding to the vector `y` coordinate. * The multivector is locked (immutable), but may be cloned. */ static readonly E2: Geometric3; /** * Constructs the basis vector e2. * Locking the vector prevents mutation. */ static e2(lock?: boolean): Geometric3; /** * The basis element corresponding to the vector `z` coordinate. * The multivector is locked (immutable), but may be cloned. */ static readonly E3: Geometric3; /** * Constructs the basis vector e3. * Locking the vector prevents mutation. */ static e3(lock?: boolean): Geometric3; /** * The basis element corresponding to the pseudoscalar `b` coordinate. * The multivector is locked (immutable), but may be cloned. */ static readonly PSEUDO: Geometric3; /** * */ static I(lock?: boolean): Geometric3; /** * Constructs a mutable bivector with the coordinates `yz`, `zx`, and `xy`. */ static bivector(yz: number, zx: number, xy: number): Geometric3; /** * Constructs a mutable multivector by copying a multivector. */ static copy(M: GeometricE3): Geometric3; /** * Constructs a mutable multivector which is the dual of the bivector `B`. */ static dualOfBivector(B: BivectorE3): Geometric3; /** * Constructs a mutable multivector which is the dual of the vector `v`. */ static dualOfVector(v: VectorE3): Geometric3; /** * Constructs a mutable multivector by copying the bivector `B`. */ static fromBivector(B: BivectorE3): Geometric3; /** * Constructs a mutable multivector by copying the scalar `α`. */ static fromScalar(α: Scalar): Geometric3; /** * Constructs a mutable multivector by copying the spinor `s`. */ static fromSpinor(s: SpinorE3): Geometric3; /** * Constructs a mutable multivector by copying the vector `v`. */ static fromVector(v: VectorE3): Geometric3; /** * Constructs a mutable multivector that linearly interpolates `A` and `B`, A + α * (B - A) */ static lerp(A: GeometricE3, B: GeometricE3, α: number): Geometric3; /** * Constructs a mutable pseudoscalar with the magnitude `β`. */ static pseudo(β: number): Geometric3; /** * Computes a multivector with random components in the range [lowerBound, upperBound]. */ static random(lowerBound?: number, upperBound?: number): Geometric3; /** * Computes the rotor that rotates vector `a` to vector `b`. * The result is independent of the magnitudes of `a` and `b`. */ static rotorFromDirections(a: VectorE3, b: VectorE3): Geometric3; static rotorFromFrameToFrame(es: VectorE3[], fs: VectorE3[]): Geometric3; /** * Computes the rotor that rotates vector `a` to vector `b`. * The bivector B provides the plane of rotation when `a` and `b` are anti-aligned. * The result is independent of the magnitudes of `a` and `b`. */ static rotorFromVectorToVector(a: VectorE3, b: VectorE3, B: BivectorE3): Geometric3; /** * Constructs a mutable scalar with the magnitude `α`. */ static scalar(α: number): Geometric3; /** * Constructs a mutable scalar with the coordinates `yz`, `zx`, `xy`, and `α`. */ static spinor(yz: number, zx: number, xy: number, α: number): Geometric3; /** * Constructs a mutable vector with the coordinates `x`, `y`, and `z`. */ static vector(x: number, y: number, z: number): Geometric3; /** * Constructs a mutable bivector as the outer product of two vectors. */ static wedge(a: VectorE3, b: VectorE3): Geometric3; /** * */ static zero(lock?: boolean): Geometric3; } /** * A mutable type representing a color through its RGB components. */ declare class Color extends Coords { /** * */ static black: Color; /** * */ static blue: Color; /** * */ static green: Color; /** * */ static cyan: Color; /** * */ static red: Color; /** * */ static magenta: Color; /** * */ static yellow: Color; /** * */ static white: Color; /** * */ static gray: Color; /** * */ static blueviolet: Color; /** * */ static chartreuse: Color; /** * */ static cobalt: Color; /** * */ static hotpink: Color; /** * */ static lime: Color; /** * */ static slateblue: Color; /** * */ static springgreen: Color; /** * */ static teal: Color; constructor(r: number, g: number, b: number); /** * The red coordinate (component) of this color. * The value is clamped to the range [0,1]. */ get r(): number; set r(r: number); get red(): number; set red(red: number); /** * The green coordinate (component) of this color. * The value is clamped to the range [0,1]. */ get g(): number; set g(g: number); get green(): number; set green(green: number); /** * The blue coordinate (component) of this color. * The value is clamped to the range [0,1]. */ get b(): number; set b(b: number); get blue(): number; set blue(blue: number); /** * Returns a color in which any rgb component whose absolute value is less than pow(10, -n) times the absolute value of the largest coordinate is zero. * @param n The exponent used to determine which components are set to zero. * @returns approx(this) */ approx(n: number): Color; /** * @returns a mutable instance of this color. */ clone(): Color; /** * Copies the specified color into this Color instance. * @param color The color to be copied. * @returns */ copy(color: { r: number; g: number; b: number; }): this; /** * Linearly interpolates from this color to the specified color. * @param target The color returned when α = 1. * @param α The parameter that determines the composition of the color. * @returns this + (target - this) * α */ lerp(target: { r: number; g: number; b: number; }, α: number): Color; /** * Computes the luminance of this color. */ get luminance(): number; /** * */ scale(α: number): Color; toExponential(fractionDigits?: number): string; toFixed(fractionDigits?: number): string; toPrecision(precision?: number): string; /** * @returns A string representation of this color. */ toString(radix?: number): string; /** * @param color The color to be copied. * @returns A mutable copy of the specified color. */ static copy(color: { r: number; g: number; b: number; }): Color; /** * @param r * @param g * @param b * @returns */ static luminance(r: number, g: number, b: number): number; /** * @param coords * @returns */ /** * Converts an angle, radius, height to a color on a color wheel. * * @param H * @param S * @param L * @returns */ static fromHSL(H: number, S: number, L: number): Color; /** * Constructs a new mutable instance of Color from the rgb components. * The components are clamped to the range [0, 1]. * * @param r The red component. * @param g The green component. * @param b The blue component. */ static fromRGB(r: number, g: number, b: number): Color; private static isInstance; /** * @param a * @param b * @param α * @returns */ static lerp(a: { r: number; g: number; b: number; }, b: { r: number; g: number; b: number; }, α: number): Color; static mustBe(name: string, color: Color): Color; /** * Creates a color in which the red, green, and blue properties lie in the range [0, 1]. */ static random(): Color; } /** * */ interface AbstractMesh extends AbstractDrawable { /** * */ R: Geometric3; /** * */ color: Color; /** * */ opacity: number; /** * */ pointSize: number; /** * */ X: Geometric3; } /** * */ declare enum ClearBufferMask { DEPTH_BUFFER_BIT = 256, STENCIL_BUFFER_BIT = 1024, COLOR_BUFFER_BIT = 16384 } /** * An enumeration specifying the depth comparison function, which sets the conditions * under which the pixel will be drawn. The default value is LESS. */ declare enum DepthFunction { /** * never pass */ NEVER = 512, /** * pass if the incoming value is less than the depth buffer value */ LESS = 513, /** * pass if the incoming value equals the the depth buffer value */ EQUAL = 514, /** * pass if the incoming value is less than or equal to the depth buffer value */ LEQUAL = 515, /** * pass if the incoming value is greater than the depth buffer value */ GREATER = 516, /** * pass if the incoming value is not equal to the depth buffer value */ NOTEQUAL = 517, /** * pass if the incoming value is greater than or equal to the depth buffer value */ GEQUAL = 518, /** * always pass */ ALWAYS = 519 } /** * This class may be used as either a base class or standalone. */ declare class Drawable extends ShareableContextConsumer implements AbstractDrawable { name: string; /** * The (private) reference to an instance that extends Geometry. */ private _geometry; /** * The (private) reference to an instance that extends Material. */ private _material; private _visible; private _transparent; private facetMap; /** * */ constructor(geometry: G, material: M, contextManager: ContextManager, levelUp?: number); /** * @hidden */ protected resurrector(levelUp: number): void; /** * @hidden */ protected destructor(levelUp: number): void; get opacity(): number; set opacity(newOpacity: number); get pointSize(): number; set pointSize(newPointSize: number); /** * A convenience method for calling geometry.bind(material). */ bind(): Drawable; /** * Sets the Material uniforms from the Facets of this composite object. */ setUniforms(): Drawable; /** * */ draw(): Drawable; contextFree(): void; contextGain(): void; contextLost(): void; /** * @param name The name of the Facet. */ getFacet(name: string): Facet; /** * A convenience method for performing all of the methods required for rendering. * The following methods are called in order. * use() * bind() * setAmbients(ambients) * setUniforms() * draw() * unbind() * In particle simulations it may be useful to call the underlying methods directly. */ render(ambients: Facet[]): Drawable; /** * Updates the Material uniforms from the ambient Facets argument. */ setAmbients(ambients: Facet[]): Drawable; removeFacet(name: string): Facet; /** * @param name The name of the Facet. * @param facet The Facet. */ setFacet(name: string, facet: Facet): void; unbind(): Drawable; use(): Drawable; /** * Provides a reference counted reference to the geometry property. * Getting the geometry property will cause the */ get geometry(): G; set geometry(geometry: G); /** * Provides a reference counted reference to the material property. */ get material(): M; set material(material: M); /** * @default true */ get visible(): boolean; set visible(visible: boolean); /** * @default false */ get transparent(): boolean; set transparent(transparent: boolean); } /** * A vector with cartesian coordinates and immutable. */ interface R3 extends VectorE3 { readonly x: number; readonly y: number; readonly z: number; add(rhs: VectorE3): Readonly; cross(rhs: VectorE3): Readonly; /** * Returns the unit vector for this vector. * Returns undefined if the magnitude is zero. */ direction(): Readonly; dot(rhs: VectorE3): number; magnitude(): number; projectionOnto(direction: VectorE3): Readonly; rejectionFrom(direction: VectorE3): Readonly; rotate(R: SpinorE3): Readonly; scale(α: number): Readonly; sub(rhs: VectorE3): Readonly; toString(): string; __add__(rhs: VectorE3): Readonly; __radd__(lhs: VectorE3): Readonly; __sub__(rhs: VectorE3): Readonly; __rsub__(lhs: VectorE3): Readonly; __mul__(rhs: number): Readonly; __rmul__(lhs: number): Readonly; __pos__(): Readonly; __neg__(): Readonly; } /** * */ declare enum PixelFormat { DEPTH_COMPONENT = 6402, ALPHA = 6406, RGB = 6407, RGBA = 6408, LUMINANCE = 6409, LUMINANCE_ALPHA = 6410 } /** * */ declare enum PixelType { UNSIGNED_BYTE = 5121, UNSIGNED_SHORT_4_4_4_4 = 32819, UNSIGNED_SHORT_5_5_5_1 = 32820, UNSIGNED_SHORT_5_6_5 = 33635 } /** * */ interface EngineAttributes extends WebGLContextAttributes { /** * Determines the WebGL context identifier used to get the context from the canvas element. */ contextId?: "webgl2" | "webgl"; /** * Determines whether the Engine logs the version of the library to the console. */ eightLogging?: boolean; /** * Determines whether the Engine logs the version of WebGL to the console. */ webglLogging?: boolean; } /** * A wrapper around an HTMLCanvasElement providing access to the WebGL rendering context * and notifications of context loss and restore. An instance of the Engine will usually * be a required parameter for any consumer of WebGL resources. */ declare class Engine extends ShareableBase implements ContextManager { /** * */ private _gl; private _contextId; private _overrideContextId; /** * */ private _attributes; private _users; /** * */ private _webGLContextLost; /** * */ private _webGLContextRestored; /** * Actions that are executed when a WebGL rendering context is gained. */ private _commands; /** * @param canvas The canvas element identifier, or canvas element, or WebGL rendering context. * @param attributes Allows the context to be configured. * @param dom The document object model that contains the canvas. */ constructor(canvas?: string | HTMLCanvasElement | WebGL2RenderingContext, attributes?: EngineAttributes, dom?: Document); /** * @hidden */ protected resurrector(levelUp: number): void; /** * @hidden */ protected destructor(levelUp: number): void; /** * */ addContextListener(consumer: ContextConsumer): void; /** * The canvas element associated with the WebGLRenderingContext. */ get canvas(): HTMLCanvasElement; get drawingBufferHeight(): number; get drawingBufferWidth(): number; blendFunc(sfactor: BlendingFactorSrc, dfactor: BlendingFactorDest): this; /** *

* Sets the graphics buffers to values preselected by clearColor, clearDepth or clearStencil. *

*/ clear(mask?: number): this; /** * Specifies color values to use by the clear method to clear the color buffer. */ clearColor(red: number, green: number, blue: number, alpha: number): this; /** * Specifies the clear value for the depth buffer. * This specifies what depth value to use when calling the clear() method. * The value is clamped between 0 and 1. * * @param depth Specifies the depth value used when the depth buffer is cleared. * The default value is 1. */ clearDepth(depth: number): this; /** * @param s Specifies the index used when the stencil buffer is cleared. * The default value is 0. */ clearStencil(s: number): this; depthFunc(func: DepthFunction): this; depthMask(flag: boolean): this; /** * Disables the specified WebGL capability. */ disable(capability: Capability): this; /** * Enables the specified WebGL capability. */ enable(capability: Capability): this; finish(): this; /** * The underlying WebGL rendering context. */ get gl(): WebGL2RenderingContext | WebGLRenderingContext; get contextId(): "webgl2" | "webgl"; /** * */ readPixels(x: number, y: number, width: number, height: number, format: PixelFormat, type: PixelType, pixels: ArrayBufferView): void; /** * @param consumer */ removeContextListener(consumer: ContextConsumer): void; /** * A convenience method for setting the width and height properties of the * underlying canvas and for setting the viewport to the drawing buffer height and width. */ size(width: number, height: number): this; /** * The viewport width and height are clamped to a range that is * implementation dependent. * * @returns e.g. Int32Array[16384, 16384] */ getMaxViewportDims(): Int32Array; /** * Returns the current viewport settings. * * @returns e.g. Int32Array[x, y, width, height] */ getViewport(): Int32Array; /** * Defines what part of the canvas will be used in rendering the drawing buffer. * * @param x * @param y * @param width * @param height */ viewport(x: number, y: number, width: number, height: number): this; /** * Initializes the WebGLRenderingContext for the specified HTMLCanvasElement. * * @param canvas The HTML canvas element or canvas element identifier. * @param dom The document object model that contains the canvas identifier. */ start(canvas: string | HTMLCanvasElement | WebGL2RenderingContext | WebGLRenderingContext, dom?: Document): this; /** * */ stop(): this; private emitStartEvent; private emitContextGain; private emitStopEvent; private emitContextFree; /** * @param consumer */ synchronize(consumer: ContextConsumer): this; /** * Computes the coordinates of a point in the image cube corresponding to device coordinates. * @param deviceX The x-coordinate of the device event. * @param deviceY The y-coordinate of the device event. * @param imageZ The optional value to use as the resulting depth coordinate. */ deviceToImageCoords(deviceX: number, deviceY: number, imageZ?: number): Readonly; } /** * GeometryBase * @hidden */ declare class GeometryBase extends ShareableContextConsumer implements Geometry { /** * */ constructor(contextManager: ContextManager, levelUp: number); /** * @hidden */ protected resurrector(levelUp: number): void; /** * @hidden */ protected destructor(levelUp: number): void; /** * */ bind(material: Material): this; /** * */ unbind(material: Material): this; /** * */ draw(): GeometryBase; } /** * A concrete Geometry for supporting drawArrays. * @hidden */ declare class GeometryArrays extends GeometryBase { /** * */ private mode; /** * The first parameter in the drawArrays call. * This is currently hard-code to zero because this class only supportes buffering one primitive. */ private first; /** * The count parameter in the drawArrays call. * This is currently maintained at this level because this class only supportes buffering one primitive. */ private count; /** * The number of bytes for each element. * * This is used in the vertexAttribPointer method. * Normally, we will use gl.FLOAT for each number which takes 4 bytes. */ private stride; /** * */ private pointers; /** * */ private vbo; /** * */ constructor(contextManager: ContextManager, primitive: Primitive, options?: { order?: string[]; tilt?: SpinorE3; }, levelUp?: number); /** * */ protected resurrector(levelUp: number): void; /** * */ protected destructor(levelUp: number): void; bind(material: Material): this; draw(): this; unbind(material: Material): this; } /** * A Geometry that supports interleaved vertex buffers. */ declare class GeometryElements extends GeometryBase { /** * */ private mode; /** * */ private count; /** * Hard-coded to zero right now. * This suggests that the index buffer could be used for several gl.drawElements(...) */ private offset; /** * The number of bytes for each element. * * This is used in the vertexAttribPointer method. * Normally, we will use gl.FLOAT for each number which takes 4 bytes. */ private stride; /** * */ private pointers; /** * */ private ibo; /** * */ private vbo; /** * */ constructor(contextManager: ContextManager, primitive: Primitive, options?: { axis?: VectorE3; meridian?: VectorE3; order?: string[]; tilt?: SpinorE3; }, levelUp?: number); /** * @hidden */ protected resurrector(levelUp: number): void; /** * @hidden */ protected destructor(levelUp: number): void; contextFree(): void; contextGain(): void; contextLost(): void; bind(material: Material): this; unbind(material: Material): this; draw(): GeometryElements; } /** * Canonical variable names, which also act as semantic identifiers for name overrides. * These names must be stable to avoid breaking custom vertex and fragment shaders. * @hidden */ declare class GraphicsProgramSymbols { /** * 'aColor' */ static ATTRIBUTE_COLOR: string; /** * 'aGeometryIndex' */ static ATTRIBUTE_GEOMETRY_INDEX: string; /** * 'aNormal' */ static ATTRIBUTE_NORMAL: string; /** * 'aOpacity' */ static ATTRIBUTE_OPACITY: string; /** * 'aPosition' */ static ATTRIBUTE_POSITION: string; /** * 'aTangent' */ static ATTRIBUTE_TANGENT: string; /** * 'aCoords' */ static ATTRIBUTE_COORDS: string; /** * 'uAlpha' */ static UNIFORM_ALPHA: string; /** * 'uAmbientLight' */ static UNIFORM_AMBIENT_LIGHT: string; /** * 'uColor' */ static UNIFORM_COLOR: string; /** * 'uDirectionalLightColor' */ static UNIFORM_DIRECTIONAL_LIGHT_COLOR: string; /** * 'uDirectionalLightDirection' */ static UNIFORM_DIRECTIONAL_LIGHT_DIRECTION: string; /** * 'uImage' */ static UNIFORM_IMAGE: string; /** * 'uOpacity' */ static UNIFORM_OPACITY: string; /** * 'uPointLightColor' */ static UNIFORM_POINT_LIGHT_COLOR: string; /** * 'uPointLightPosition' */ static UNIFORM_POINT_LIGHT_POSITION: string; /** * 'uPointSize' */ static UNIFORM_POINT_SIZE: string; /** * 'uProjection' */ static UNIFORM_PROJECTION_MATRIX: string; /** * 'uReflectionOne' */ static UNIFORM_REFLECTION_ONE_MATRIX: string; /** * 'uReflectionTwo' */ static UNIFORM_REFLECTION_TWO_MATRIX: string; /** * 'uModel' */ static UNIFORM_MODEL_MATRIX: string; /** * 'uNormal' */ static UNIFORM_NORMAL_MATRIX: string; /** * 'uView' */ static UNIFORM_VIEW_MATRIX: string; /** * 'vColor' */ static VARYING_COLOR: string; /** * 'vCoords' */ static VARYING_COORDS: string; /** * 'vLight' */ static VARYING_LIGHT: string; } /** * */ declare enum TextureMagFilter { NEAREST = 9728, LINEAR = 9729 } /** * */ declare enum TextureMinFilter { NEAREST = 9728, LINEAR = 9729, NEAREST_MIPMAP_NEAREST = 9984, LINEAR_MIPMAP_NEAREST = 9985, NEAREST_MIPMAP_LINEAR = 9986, LINEAR_MIPMAP_LINEAR = 9987 } /** * */ declare enum TextureTarget { TEXTURE_2D = 3553, TEXTURE = 5890 } /** * */ declare enum TextureWrapMode { REPEAT = 10497, CLAMP_TO_EDGE = 33071, MIRRORED_REPEAT = 33648 } declare class Texture extends ShareableContextConsumer { private _texture; protected _target: TextureTarget; /** * * @param target * @param contextManager * @param levelUp */ constructor(target: TextureTarget, contextManager: ContextManager, levelUp?: number); protected destructor(levelUp: number): void; contextFree(): void; contextGain(): void; contextLost(): void; /** * */ bind(): void; /** * */ unbind(): void; get minFilter(): TextureMinFilter; set minFilter(filter: TextureMinFilter); get magFilter(): TextureMagFilter; set magFilter(filter: TextureMagFilter); get wrapS(): TextureWrapMode; set wrapS(mode: TextureWrapMode); get wrapT(): TextureWrapMode; set wrapT(mode: TextureWrapMode); /** * */ upload(): void; } declare class ImageTexture extends Texture { private image; /** * @param image * @param target * @param contextManager * @param levelUp */ constructor(image: HTMLImageElement, target: TextureTarget, contextManager: ContextManager, levelUp?: number); /** * @hidden */ protected destructor(levelUp: number): void; get naturalHeight(): number; get naturalWidth(): number; upload(): void; } /** * A wrapper around a WebGLBuffer with binding to ELEMENT_ARRAY_BUFFER. * @hidden */ declare class IndexBuffer extends ShareableContextConsumer { private data; private usage; private webGLBuffer; /** * */ constructor(contextManager: ContextManager, data: Uint16Array, usage: Usage, levelUp?: number); /** * @hidden */ protected resurrector(levelUp: number): void; /** * @hidden */ protected destructor(levelUp: number): void; upload(): void; contextFree(): void; contextGain(): void; contextLost(): void; /** * Binds the underlying WebGLBuffer to the ELEMENT_ARRAY_BUFFER target. */ bind(): void; unbind(): void; } /** * */ interface MeshOptions { /** * The reference axis. */ axis?: VectorE3; /** * The reference meridian. */ meridian?: VectorE3; } /** * The standard pairing of a Geometry and a Material. */ declare class Mesh extends Drawable implements AbstractMesh { /** * The reference frame axis. */ readonly referenceAxis: Readonly; /** * The reference frame meridian. */ readonly referenceMeridian: Readonly; /** * Scratch variable for intermediate calculation value. * This can probably be raised to a module level constant. */ private readonly canonicalScale; /** * The rotation matrix equivalent to the initial tilt spinor. */ private readonly K; /** * The (cached) inverse of K. */ private readonly Kinv; /** * Cached value that tells you whether the K matrix is unity. */ private readonly Kidentity; /** * Initializes this Mesh with a ColorFacet ('color'), a TextureFacet ('image'), and a ModelFacet ('model'). * * @param geometry An optional Geometry, which may be supplied later. * @param material An optional Material, which may be supplied later. * @param contextManager * @param options * @param levelUp The zero-based level of this instance in an inheritance hierarchy. */ constructor(geometry: G, material: M, contextManager: ContextManager, options?: MeshOptions, levelUp?: number); /** * @hidden */ protected destructor(levelUp: number): void; /** * Attitude (spinor). This is an alias for the R property. */ get attitude(): Geometric3; set attitude(spinor: Geometric3); /** * Attitude (spinor). This is an alias for the attitude property. */ get R(): Geometric3; set R(spinor: Geometric3); /** * Color */ get color(): Color; set color(color: Color); /** * Texture (image). */ get texture(): Texture; set texture(value: Texture); /** * Position (vector). This is an alias for the position property. */ get X(): Geometric3; set X(vector: Geometric3); /** * Position (vector). This is an alias for the X property. */ get position(): Geometric3; set position(vector: Geometric3); /** * Stress (tensor) */ private get stress(); private set stress(value); /** * @param i The row index (zero-based). * @param j The column index (zero-based). * @returns The ij th element of the stress matrix (possibly Kinv * stress * K). */ private getScale; /** * @hidden */ protected getScaleX(): number; /** * @hidden */ protected getScaleY(): number; /** * @hidden */ protected getScaleZ(): number; /** * Implementations of setPrincipalScale are expected to call this method. * @hidden */ protected setScale(x: number, y: number, z: number): void; /** * Implementation of the axis (get) property. * Derived classes may overide to perform scaling. * @hidden */ protected getAxis(): Readonly; /** * @hidden * Implementation of the axis (set) property. * The result is independent of the magnitude of the `axis` parameter. * Derived classes may overide to perform scaling. * * @param axis */ protected setAxis(axis: VectorE3): void; /** * The current axis (unit vector) of the mesh. */ get axis(): VectorE3; set axis(axis: VectorE3); /** * @hidden */ protected getMeridian(): Readonly; /** * The current meridian (unit vector) of the mesh. */ get meridian(): VectorE3; set meridian(value: VectorE3); /** * The name of the uniform mat4 variable in the vertex shader that receives the model matrix value. * The default name is `uModel`. */ get modelMatrixUniformName(): string; set modelMatrixUniformName(name: string); /** * The name of the uniform mat3 variable in the vertex shader that receives the normal matrix value. * The default name is `uNormal`. */ get normalMatrixUniformName(): string; set normalMatrixUniformName(name: string); } /** * @hidden */ declare function refChange(uuid: string, name?: string, change?: number): number; /** * A collection of Renderable objects. */ declare class Scene extends ShareableContextConsumer implements Renderable { private _drawables; constructor(contextManager: ContextManager, levelUp?: number); protected destructor(levelUp: number): void; add(drawable: Renderable): void; contains(drawable: Renderable): boolean; /** * @deprecated. Use the render method instead. */ draw(ambients: Facet[]): void; /** * Traverses the collection of Renderable objects, calling render(ambients) on each one. * The rendering takes place in two stages. * In the first stage, non-transparent objects are drawn. * In the second state, transparent objects are drawn. */ render(ambients: Facet[]): void; find(match: (drawable: Renderable) => boolean): ShareableArray; findOne(match: (drawable: Renderable) => boolean): Renderable; findOneByName(name: string): Renderable; findByName(name: string): ShareableArray; remove(drawable: Renderable): void; contextFree(): void; contextGain(): void; contextLost(): void; } /** * @hidden */ declare class Shader extends ShareableContextConsumer { private _source; private _shaderType; private _shader; constructor(source: string, type: number, engine: Engine); destructor(levelUp: number): void; contextFree(): void; contextGain(): void; contextLost(): void; } /** * @hidden */ declare enum TextureParameterName { TEXTURE_MAG_FILTER = 10240, TEXTURE_MIN_FILTER = 10241, TEXTURE_WRAP_S = 10242, TEXTURE_WRAP_T = 10243 } /** * */ type UniformGlslType = "float" | "mat2" | "mat3" | "mat4" | "sampler2D" | "vec2" | "vec3" | "vec4"; /** * @hidden */ interface VertexAttribPointer { /** * */ name: string; /** * */ size: number; /** * */ type: DataType; /** * */ normalized: boolean; /** * */ offset: number; } /** * Geometry data that has been interleaved for efficiency. * @hidden */ interface VertexArrays { /** * */ mode: BeginMode; /** * */ indices?: number[]; /** * The interleaved attribute data. */ attributes: number[]; /** * */ stride: number; /** * A description of the interleaved attribute data. */ pointers: VertexAttribPointer[]; } /** * Converts the Primitive to the interleaved VertexArrays format. * This conversion is performed for eddiciency; it allows multiple attributes to be * combined into a single array of numbers so that it may be stored in a single vertex buffer. * @hidden * * @param primitive The Primitive to be converted. * @param order The ordering of the attributes. */ declare function vertexArraysFromPrimitive(primitive: Primitive, order?: string[]): VertexArrays; /** * Defines the conventional (eye, look, up) triple. */ interface Camera { /** * The position of the camera, a position vector. */ eye: VectorE3; /** * The point (position vector) that the camera looks at. */ look: VectorE3; /** * The direction that is used to orient the camera. */ up: VectorE3; } /** * Defines the conventional (near, far, fov, and aspect) quadruple that define a viewport. */ interface Prism { /** * The distance to the near plane of the viewport. */ near: number; /** * The distance to the far plane of the viewport. */ far: number; /** * The field of view is the angle in the camera horizontal plane that the viewport subtends at the camera. * The field of view is measured in radians. */ fov: number; /** * The aspect ratio of the viewport, i.e., width / height. */ aspect: number; } /** * A wrapper around the HTML canvas element that projects from 3D onto the canvas. * This utility conveniently integrates with the `PerspectiveCamera` to provide an overlay for WebGL. */ declare class Diagram3D { /** * */ private camera; /** * */ private prism; /** * */ readonly ctx: CanvasRenderingContext2D; /** * */ /** * * @param canvas The canvas elementId or the HTML canvas element. * @param camera Provides the camera (eye, look, and up) parameters. * @param prism Provides the viewport (near, far, fov, and aspect) parameters. */ constructor(canvas: string | HTMLCanvasElement, camera: Camera, prism: Prism); get canvas(): HTMLCanvasElement; get fillStyle(): string | CanvasGradient | CanvasPattern; set fillStyle(fillStyle: string | CanvasGradient | CanvasPattern); beginPath(): void; clear(): void; closePath(): void; fill(fillRule?: "nonzero" | "evenodd"): void; fillText(text: string, X: VectorE3, maxWidth?: number): void; moveTo(X: VectorE3): void; lineTo(X: VectorE3): void; stroke(): void; strokeText(text: string, X: VectorE3, maxWidth?: number): void; } /** * Sets the 'uAmbientLight' uniform to the color RGB value. */ declare class AmbientLight implements Facet { /** * */ color: Color; /** * */ constructor(color: { r: number; g: number; b: number; }); /** * */ setUniforms(visitor: FacetVisitor): void; } /** * Sets the 'uColor' uniform to the color RGB value. */ declare class ColorFacet implements Facet { uColorName: string; /** * @hidden */ static PROP_RGB: string; /** * @hidden */ static PROP_RED: string; /** * @hidden */ static PROP_GREEN: string; /** * @hidden */ static PROP_BLUE: string; /** * */ color: Color; /** * @param uColorName The name of the WebL uniform that this facet will affect. */ constructor(uColorName?: string); /** * The red component of the color. */ get r(): number; set r(r: number); /** * The green component of the color. */ get g(): number; set g(g: number); /** * The blue component of the color. */ get b(): number; set b(b: number); scaleRGB(α: number): this; setRGB(r: number, g: number, b: number): this; /** * */ setUniforms(visitor: FacetVisitor): void; } /** * */ declare class DirectionalLight implements Facet { private readonly direction_; private readonly color_; constructor(direction?: VectorE3, color?: { r: number; g: number; b: number; }); get color(): Color; set color(color: Color); get direction(): Geometric3; set direction(direction: Geometric3); setUniforms(visitor: FacetVisitor): void; } /** * @hidden */ declare function frustumMatrix(left: number, right: number, bottom: number, top: number, near: number, far: number, matrix?: Float32Array): Float32Array; /** * @hidden */ interface GeometricE2 extends Pseudo, Scalar, SpinorE2, VectorE2 { } /** * @hidden */ declare class Geometric2 { isLocked(): boolean; lock(): number; unlock(token: number): void; /** * */ private coords_; /** * */ private modified_; /** * */ static readonly BASIS_LABELS: string[]; /** * */ static readonly BASIS_LABELS_COMPASS: (string | string[])[]; /** * */ static readonly BASIS_LABELS_GEOMETRIC: (string | string[])[]; /** * */ static readonly BASIS_LABELS_STANDARD: string[]; /** * [scalar, x, y, pseudo] */ constructor(coords?: [number, number, number, number], modified?: boolean); get length(): number; get modified(): boolean; set modified(modified: boolean); getComponent(i: number): number; get a(): number; set a(a: number); get x(): number; set x(x: number); get y(): number; set y(y: number); get b(): number; set b(b: number); /** * */ /** * this ⟼ this + M * α */ add(M: GeometricE2, α?: number): this; /** * this ⟼ a + b */ add2(a: GeometricE2, b: GeometricE2): this; /** * this ⟼ this + Iβ */ addPseudo(β: number): this; /** * this ⟼ this + α */ addScalar(α: number): this; /** * this ⟼ this + v * α */ addVector(v: VectorE2, α?: number): this; /** * arg(A) = grade(log(A), 2) * * @returns The arg of this multivector. */ arg(): Geometric2; /** * */ approx(n: number): this; /** * copy(this) */ clone(): Geometric2; /** * The Clifford conjugate. * The multiplier for the grade x is (-1) raised to the power x * (x + 1) / 2 * The pattern of grades is +--++--+ * * @returns conj(this) */ conj(): this; /** * */ cos(): this; /** * */ cosh(): this; /** * */ distanceTo(M: GeometricE2): number; /** * this ⟼ copy(M) */ copy(M: GeometricE2): this; /** * Sets this multivector to the value of the scalar, α. */ copyScalar(α: number): this; /** * this ⟼ copy(spinor) */ copySpinor(spinor: SpinorE2): this; /** * this ⟼ copyVector(vector) */ copyVector(vector: VectorE2): this; /** * */ cubicBezier(t: number, controlBegin: GeometricE2, controlEnd: GeometricE2, endPoint: GeometricE2): this; /** * this ⟼ this / magnitude(this) */ normalize(): this; /** * this ⟼ this / m */ div(m: GeometricE2): this; /** * this ⟼ a / b */ div2(a: GeometricE2, b: GeometricE2): this; /** * this ⟼ this / α */ divByScalar(α: number): this; /** * */ dual(): Geometric2; /** * */ equals(other: any): boolean; /** * this ⟼ exp(this) */ exp(): this; /** * this ⟼ this ^ m */ ext(m: GeometricE2): this; /** * this ⟼ a ^ b */ ext2(a: GeometricE2, b: GeometricE2): this; /** * Sets this multivector to its inverse, if it exists. */ inv(): Geometric2; /** * */ isOne(): boolean; /** * */ isZero(): boolean; /** * this ⟼ this << m */ lco(m: GeometricE2): Geometric2; /** * this ⟼ a << b */ lco2(a: GeometricE2, b: GeometricE2): this; /** * this ⟼ this + α * (target - this) */ lerp(target: GeometricE2, α: number): this; /** * this ⟼ a + α * (b - a) */ lerp2(a: GeometricE2, b: GeometricE2, α: number): this; /** * this ⟼ log(sqrt(α * α + β * β)) + e1e2 * atan2(β, α), * where α is the scalar part of `this`, * and β is the pseudoscalar part of `this`. */ log(): this; /** * Computes the square root of the squared norm. * * This method does not change this multivector. */ magnitude(): number; /** * this ⟼ this * m */ mul(m: GeometricE2): Geometric2; /** * this ⟼ a * b */ mul2(a: GeometricE2, b: GeometricE2): this; /** * this ⟼ -1 * this */ neg(): Geometric2; /** * this ⟼ sqrt(this * conj(this)) */ norm(): this; /** * Sets this multivector to the identity element for multiplication, 1. */ one(): this; /** * */ pow(M: GeometricE2): this; /** * Updates this target to be the quad or squared norm of the target. * * this ⟼ scp(this, rev(this)) = this | ~this */ quad(): this; /** * */ quadraticBezier(t: number, controlPoint: GeometricE2, endPoint: GeometricE2): this; /** * this ⟼ this >> m */ rco(m: GeometricE2): this; /** * this ⟼ a >> b */ rco2(a: GeometricE2, b: GeometricE2): this; /** * this ⟼ - n * this * n */ reflect(n: VectorE2): this; /** * this ⟼ rev(this) */ rev(): Geometric2; /** * */ sin(): this; /** * */ sinh(): this; /** * this ⟼ R * this * rev(R) */ rotate(R: SpinorE2): this; /** * Sets this multivector to a rotation from vector a to vector b. */ rotorFromDirections(a: VectorE2, b: VectorE2): this; rotorFromVectorToVector(a: VectorE2, b: VectorE2): this; /** * this ⟼ exp(- B * θ / 2) */ rotorFromGeneratorAngle(B: SpinorE2, θ: number): this; /** * this ⟼ scp(this, m) */ scp(m: GeometricE2): this; /** * this ⟼ scp(a, b) */ scp2(a: GeometricE2, b: GeometricE2): this; /** * this ⟼ this * α */ scale(α: number): this; /** * */ stress(σ: VectorE2): this; /** * this ⟼ a * b = a · b + a ^ b * * Sets this Geometric2 to the geometric product, a * b, of the vector arguments. */ versor(a: VectorE2, b: VectorE2): this; /** * this ⟼ this * ~this */ squaredNorm(): this; /** * @returns the square of the magnitude of this. */ quaditude(): number; /** * this ⟼ this - M * α */ sub(M: GeometricE2, α?: number): this; /** * this ⟼ a - b */ sub2(a: GeometricE2, b: GeometricE2): this; /** * */ toArray(): number[]; /** * Returns a representation of this multivector in exponential notation. */ toExponential(fractionDigits?: number): string; /** * Returns a representation of this multivector in fixed-point notation. */ toFixed(fractionDigits?: number): string; /** * Returns a representation of this multivector in exponential or fixed-point notation. */ toPrecision(precision?: number): string; /** * Returns a representation of this multivector. */ toString(radix?: number): string; /** * Extraction of grade i. * * If this multivector is mutable (unlocked) then it is set to the result. * * @param i The index of the grade to be extracted. */ grade(i: number): Geometric2; /** * Sets this multivector to the identity element for addition, 0. * * this ⟼ 0 */ zero(): this; /** * Implements this + rhs as addition. * The returned value is locked. */ __add__(rhs: any): Geometric2; /** * */ __div__(rhs: any): Geometric2; /** * */ __rdiv__(lhs: any): Geometric2; /** * */ __mul__(rhs: any): Geometric2; /** * */ __rmul__(lhs: any): Geometric2; /** * */ __radd__(lhs: any): Geometric2; /** * */ __sub__(rhs: any): Geometric2; /** * */ __rsub__(lhs: any): Geometric2; /** * */ __wedge__(rhs: any): Geometric2; /** * */ __rwedge__(lhs: any): Geometric2; /** * */ __lshift__(rhs: any): Geometric2; /** * */ __rlshift__(lhs: any): Geometric2; /** * */ __rshift__(rhs: any): Geometric2; /** * */ __rrshift__(lhs: any): Geometric2; /** * */ __vbar__(rhs: any): Geometric2; /** * */ __rvbar__(lhs: any): Geometric2; /** * */ __bang__(): Geometric2; /** * */ __tilde__(): Geometric2; /** * */ __pos__(): Geometric2; /** * */ __neg__(): Geometric2; /** * */ static copy(M: GeometricE2): Geometric2; /** * The basis element corresponding to the vector `x` coordinate. * The multivector is locked (immutable), but may be cloned. */ static readonly E1: Geometric2; /** * Constructs the basis vector e1. * Locking the vector prevents mutation. */ static e1(lock?: boolean): Geometric2; /** * The basis element corresponding to the vector `y` coordinate. * The multivector is locked (immutable), but may be cloned. */ static readonly E2: Geometric2; /** * Constructs the basis vector e2. * Locking the vector prevents mutation. */ static e2(lock?: boolean): Geometric2; /** * */ static fromCartesian(a: number, x: number, y: number, b: number): Geometric2; static fromBivector(B: Pseudo): Geometric2; /** * */ static fromSpinor(spinor: SpinorE2): Geometric2; /** * */ static fromVector(v: VectorE2): Geometric2; /** * The identity element for addition, `0`. * The multivector is locked. */ static readonly PSEUDO: Geometric2; /** * */ static I(lock?: boolean): Geometric2; /** * A + α * (B - A) */ static lerp(A: GeometricE2, B: GeometricE2, α: number): Geometric2; /** * The identity element for multiplication, `1`. * The multivector is locked (immutable), but may be cloned. */ static readonly ONE: Geometric2; /** * */ static one(lock?: boolean): Geometric2; /** * Computes the rotor that rotates vector a to vector b. */ static rotorFromDirections(a: VectorE2, b: VectorE2): Geometric2; /** * */ static pseudo(β: number): Geometric2; /** * */ static scalar(α: number): Geometric2; /** * */ static vector(x: number, y: number): Geometric2; /** * The identity element for addition, `0`. * The multivector is locked. */ static readonly ZERO: Geometric2; /** * */ static zero(lock?: boolean): Geometric2; } /** * @hidden */ declare class ModelE2 { /** * The name of the property that designates the attitude. */ static PROP_ATTITUDE: string; /** * The name of the property that designates the position. */ static PROP_POSITION: string; private _position; private _attitude; /** *

* A collection of properties for Rigid Body Modeling. *

*

* ModelE2 implements Facet required for manipulating a composite object. *

*

* Constructs a ModelE2 at the origin and with unity attitude. *

*/ constructor(); /** *

* The attitude, a unitary spinor. *

*/ get R(): Geometric2; set R(attitude: Geometric2); /** *

* The position, a vector. * The vector X designates the center of mass of the body (Physics). * The vector X designates the displacement from the local origin (Computer Graphics). *

*/ get X(): Geometric2; set X(position: Geometric2); } /** * @hidden */ declare class ModelE3 { /** * The name of the property that designates the attitude. */ static readonly PROP_ATTITUDE = "R"; /** * The name of the property that designates the position. */ static readonly PROP_POSITION = "X"; private readonly _position; private readonly _attitude; /** *

* A collection of properties for Rigid Body Modeling. *

*

* ModelE3 implements Facet required for manipulating a composite object. *

*

* Constructs a ModelE3 at the origin and with unity attitude. *

*/ constructor(); /** *

* The attitude, a rotor. *

*/ get R(): Geometric3; set R(attitude: Geometric3); /** *

* The position, a vector. *

*/ get X(): Geometric3; set X(position: Geometric3); } /** * @hidden */ declare class ModelFacet extends ModelE3 implements Facet { /** * @default diag(1, 1, 1, 1) */ private matS; private _matM; private _matN; private matR; private matT; /** * The name used for the model matrix in the vertex shader. */ private nameM; /** * The name used for the normal matrix in the vertex shader. */ private nameN; /** *

* A collection of properties governing GLSL uniforms for Rigid Body Modeling. *

*

* In Physics, the composite object may represent a rigid body. * In Computer Graphics, the composite object is a collection of drawing primitives. *

*

* ModelFacet implements Facet required for manipulating a composite object. *

*

* Constructs a ModelFacet at the origin and with unity attitude. *

*/ constructor(); /** * Stress (tensor) */ get stress(): Matrix4; set stress(stress: Matrix4); /** * */ get matrix(): Matrix4; set matrix(unused: Matrix4); /** * The name of the uniform variable in the vertex shader that receives the model matrix value. */ get modelMatrixUniformName(): string; set modelMatrixUniformName(name: string); /** * The name of the uniform variable in the vertex shader that receives the normal matrix value. */ get normalMatrixUniformName(): string; set normalMatrixUniformName(name: string); /** * */ setUniforms(visitor: FacetVisitor): void; private updateMatrices; } /** *

* The PerspectiveCamera provides projection matrix and view matrix uniforms to the * current Material. *

*

* The PerspectiveCamera plays the role of a host in the Visitor pattern. * The FacetVistor will normally be a Material implementation. The accepting * method is called setUniforms. *

* * const ambients: Facet[] = [] * * const camera = new EIGHT.PerspectiveCamera() * camera.aspect = canvas.clientWidth / canvas.clientHeight * camera.eye = Geometric3.copyVector(R3.e3) * ambients.push(camera) * * scene.draw(ambients) * *

The camera is initially positioned at e3.

*/ declare class PerspectiveCamera implements Facet, Camera, Prism { /** * */ private P; /** * */ private V; /** * * @param fov The field of view. * @param aspect The aspect is the ratio width / height. * @param near The distance of the near plane from the camera. * @param far The distance of the far plane from the camera. */ constructor(fov?: number, aspect?: number, near?: number, far?: number); /** * Converts from image cube coordinates to world coordinates. * @param imageX The x-coordinate in the image cube. -1 <= x <= +1. * @param imageY The y-coordinate in the image cube. -1 <= y <= +1. * @param imageZ The z-coordinate in the image cube. -1 <= z <= +1. */ imageToWorldCoords(imageX: number, imageY: number, imageZ: number): Geometric3; /** * */ setUniforms(visitor: FacetVisitor): void; /** * The aspect ratio (width / height) of the camera viewport. */ get aspect(): number; set aspect(aspect: number); /** * The position of the camera, a vector. */ get eye(): Geometric3; set eye(eye: Geometric3); /** * The field of view is the (planar) angle (magnitude) in the camera horizontal plane that encloses object that can be seen. * Measured in radians. */ get fov(): number; set fov(value: number); /** * The point that is being looked at. */ get look(): Geometric3; set look(look: Geometric3); /** * The distance to the near plane. */ get near(): number; set near(near: number); /** * The distance to the far plane. */ get far(): number; set far(far: number); /** * The approximate up direction. */ get up(): Geometric3; set up(up: Geometric3); /** * The name of the uniform mat4 variable in the vertex shader that receives the projection matrix value. * The default name is `uProjection`. */ get projectionMatrixUniformName(): string; set projectionMatrixUniformName(name: string); get projectionMatrix(): Matrix4; /** * The name of the uniform mat4 variable in the vertex shader that receives the view matrix value. * The default name is `uView`. */ get viewMatrixUniformName(): string; set viewMatrixUniformName(name: string); get viewMatrix(): Matrix4; } /** * @hidden */ declare function perspectiveMatrix(fov: number, aspect: number, near: number, far: number, matrix?: Matrix4): Matrix4; /** * @hidden */ declare class PerspectiveTransform implements Facet { /** * */ private _aspect; /** * */ private _fov; /** * */ private _near; /** * */ private _far; /** * */ matrix: Matrix4; /** * */ private matrixName; /** * */ constructor(fov?: number, aspect?: number, near?: number, far?: number); /** * The aspect ratio (width / height) of the camera viewport. */ get aspect(): number; set aspect(aspect: number); /** * The field of view is the (planar) angle (magnitude) in the camera horizontal plane that encloses object that can be seen. * Measured in radians. */ get fov(): number; set fov(fov: number); /** * The distance to the near plane. */ get near(): number; set near(near: number); /** * The distance to the far plane. */ get far(): number; set far(far: number); /** * */ setUniforms(visitor: FacetVisitor): void; /** * The name of the uniform mat4 variable in the vertex shader that receives the projection matrix value. * The default name is `uProjection`. */ get projectionMatrixUniformName(): string; set projectionMatrixUniformName(name: string); /** * Converts from image cube coordinates to camera coordinates. * This method performs the inverse of the perspective transformation. */ imageToCameraCoords(x: number, y: number, z: number): number[]; /** * */ private refreshMatrix; } /** * @hidden */ declare class PointSizeFacet implements Facet { /** * */ pointSize: number; /** * */ constructor(pointSize?: number); /** * */ setUniforms(visitor: FacetVisitor): void; } /** * @hidden */ declare class ReflectionFacetE2 implements Facet { /** * The vector perpendicular to the (hyper-)plane of reflection. */ _normal: Vector2; /** * */ private matrix; private name; /** * @param name The name of the uniform variable. */ constructor(name: string); /** * */ get normal(): Vector2; set normal(unused: Vector2); /** * */ setUniforms(visitor: FacetVisitor): void; } /** * @hidden */ declare class ReflectionFacetE3 implements Facet { /** * The vector perpendicular to the (hyper-)plane of reflection. */ _normal: Geometric3; private matrix; private name; /** * @param name The name of the uniform variable. */ constructor(name: string); get normal(): Geometric3; set normal(unused: Geometric3); setUniforms(visitor: FacetVisitor): void; } /** * Updates a uniform vec3 shader parameter from a VectorE3. * Using a VectorE3 makes assignment easier, which is the dominant use case. * @hidden */ declare class Vector3Facet implements Facet { /** * Hide the name to provide some degree of safety. */ private _name; /** * Intentionally provide access to the mutable property. * The value property provides interoperability with other types. */ vector: Vector3; constructor(name: string); get name(): string; set name(value: string); get value(): VectorE3; set value(value: VectorE3); /** * */ setUniforms(visitor: FacetVisitor): void; } /** * @hidden */ declare function viewMatrixFromEyeLookUp(eye: VectorE3, look: VectorE3, up: VectorE3, matrix?: Matrix4): Matrix4; /** * @hidden */ declare class ViewTransform implements Facet { /** * */ private _eye; /** * */ private _look; /** * */ private _up; /** * */ private _matrix; /** * */ private matrixName; /** * */ constructor(); /** * */ cameraToWorldCoords(cameraCoords: number[]): Geometric3; /** * */ setUniforms(visitor: FacetVisitor): void; /** * The name of the uniform mat4 variable in the vertex shader that receives the view matrix value. * The default name is `uView`. */ get viewMatrixUniformName(): string; set viewMatrixUniformName(name: string); /** * The position of the camera, a vector. */ get eye(): Geometric3; set eye(eye: Geometric3); /** * The point that is being looked at. */ get look(): Geometric3; set look(look: Geometric3); /** * The approximate up direction. */ get up(): Geometric3; set up(up: Geometric3); get matrix(): Matrix4; private refreshMatrix; } /** * @hidden */ interface GeometryKey { kind?: "ArrowGeometry" | "BoxGeometry" | "CurveGeometry" | "CylinderGeometry" | "GridGeometry" | "HollowCylinderGeometry" | "SphereGeometry" | "TetrahedronGeometry" | "TurtleGeometry"; } /** * @hidden */ interface GeometryOptions { /** * */ axis?: VectorE3; /** * */ meridian?: VectorE3; /** * A translation from the canonical position. * This is the third and last operation applied to canonical vertex data. */ offset?: VectorE3; /** * A scaling along the standard basis directions from the canonical unit scaling. * This is the first operation applied to canonical vertex data. */ stress?: VectorE3; /** * */ tilt?: SpinorE3; } /** * @hidden */ interface ArrowGeometryOptions extends GeometryOptions, GeometryKey { /** * Defaults to 0.08. */ radiusCone?: number; /** * Defaults to 16. * Minimum is 3. */ thetaSegments?: number; } /** *

* A convenience class for creating an arrow. *

*

* The initial axis unit vector defaults to e2 *

*

* The cutLine unit vector defaults to e3 *

* @hidden */ declare class ArrowGeometry extends GeometryElements { /** * */ constructor(contextManager: ContextManager, options?: ArrowGeometryOptions, levelUp?: number); /** * */ protected resurrector(levelUp: number): void; /** * */ protected destructor(levelUp: number): void; } /** * Determines how a Geometry will be rendered. */ declare enum GeometryMode { /** * */ POINT = 0, /** * */ WIRE = 1, /** * */ MESH = 2 } /** * The options when creating a BoxGeometry. * @hidden */ interface BoxGeometryOptions extends GeometryOptions, GeometryKey { /** * */ depth?: number; /** * */ height?: number; /** * */ mode?: GeometryMode; /** * */ openBack?: boolean; /** * */ openBase?: boolean; /** * */ openFront?: boolean; /** * */ openLeft?: boolean; /** * */ openRight?: boolean; /** * */ openCap?: boolean; /** * */ width?: number; } /** * A convenience class for creating a BoxGeometry. * @hidden */ declare class BoxGeometry extends GeometryElements { /** * */ constructor(contextManager: ContextManager, options?: BoxGeometryOptions, levelUp?: number); /** * */ protected resurrector(levelUp: number): void; /** * */ protected destructor(levelUp: number): void; } /** * Determines how a Curve will be rendered. */ declare enum CurveMode { /** * */ POINTS = 0, /** * */ LINES = 1 } /** * */ interface CurveGeometryOptions extends GeometryOptions, GeometryKey { /** * A parametric function determining the positions of points on the curve. * * @default () => (u, 0) */ aPosition?: (u: number) => VectorE3; /** * */ aColor?: (u: number) => { r: number; g: number; b: number; }; /** * @default LINES */ mode?: CurveMode; /** * @default 0 */ uMin?: number; /** * @default 1 */ uMax?: number; /** * @default 1 */ uSegments?: number; } /** * A Geometry for representing functions of one scalar parameter. */ declare class CurveGeometry extends GeometryElements { constructor(contextManager: ContextManager, options?: CurveGeometryOptions, levelUp?: number); /** * */ protected resurrector(levelUp: number): void; /** * */ protected destructor(levelUp: number): void; } /** * @hidden */ interface CylinderGeometryOptions extends GeometryOptions, GeometryKey { /** * */ heightSegments?: number; /** * */ length?: number; /** * */ mode?: GeometryMode; /** * */ openBase?: boolean; /** * */ openCap?: boolean; /** * */ openWall?: boolean; /** * */ radius?: number; /** * */ thetaSegments?: number; } /** * A geometry for a Cylinder. * @hidden */ declare class CylinderGeometry extends GeometryElements { /** * */ constructor(contextManager: ContextManager, options?: CylinderGeometryOptions, levelUp?: number); /** * */ protected resurrector(levelUp: number): void; /** * */ protected destructor(levelUp: number): void; } /** * @hidden */ interface GridGeometryOptions extends GeometryOptions, GeometryKey { /** * A parametric function determining the vertex positions. */ aPosition?: (u: number, v: number) => VectorE3; /** * A parametric function determining the vertex normals. */ aNormal?: (u: number, v: number) => VectorE3; /** * A parametric function determining the vertex colors. */ aColor?: (u: number, v: number) => { r: number; g: number; b: number; }; /** * A parametric function determining the vertex colors. */ aCoords?: (u: number, v: number) => { u: number; v: number; }; /** * @default WIRE */ mode?: GeometryMode; /** * @default 0 */ uMin?: number; /** * @default 1 */ uMax?: number; /** * @default 1 */ uSegments?: number; /** * */ uClosed?: boolean; /** * @default 0 */ vMin?: number; /** * @default 1 */ vMax?: number; /** * @default 1 */ vSegments?: number; /** * */ vClosed?: boolean; } /** * A Geometry for representing functions of two scalar parameters. * @hidden */ declare class GridGeometry extends GeometryElements { /** * */ constructor(contextManager: ContextManager, options?: GridGeometryOptions, levelUp?: number); /** * */ protected resurrector(levelUp: number): void; /** * */ protected destructor(levelUp: number): void; } /** * The common low values for a Simplex. * @hidden */ declare enum SimplexMode { EMPTY = -1, POINT = 0, LINE = 1, TRIANGLE = 2, TETRAHEDRON = 3, FIVE_CELL = 4 } /** * @hidden */ declare class Simplex { vertices: Vertex[]; constructor(k: SimplexMode); get k(): SimplexMode; static indices(simplex: Simplex): number[]; private static boundaryMap; private static subdivideMap; static boundary(simplices: Simplex[], count?: number): Simplex[]; static subdivide(simplices: Simplex[], count?: number): Simplex[]; /** * Copies the attributes onto all vertices of the simplex. */ static setAttributeValues(attributes: { [name: string]: VectorN[]; }, simplex: Simplex): void; } /** * A Geometric Number representing the even sub-algebra of G3. */ declare class Spinor3 { isLocked(): boolean; lock(): number; unlock(token: number): void; /** * */ private coords_; /** * */ private modified_; /** * Initializes the spinor from the specified coordinates. * The spinor is not locked. * The spinor is not modified. * @param coords [yz, zx, xy, a] * @param code */ constructor(coords: number[], code: number); get modified(): boolean; set modified(modified: boolean); /** * The coordinate corresponding to the e23 basis bivector. */ get yz(): number; set yz(yz: number); /** * The coordinate corresponding to the e31 basis bivector. */ get zx(): number; set zx(zx: number); /** * The coordinate corresponding to the e12 basis bivector. */ get xy(): number; set xy(xy: number); /** * The coordinate corresponding to the 1 basis scalar. */ get a(): number; set a(α: number); get length(): number; /** * */ get maskG3(): number; set maskG3(unused: number); /** *

* this ⟼ this + α * spinor *

* @param spinor * @param α * @returns this + α * spinor */ add(spinor: SpinorE3, α?: number): this; /** *

* this ⟼ a + b *

* * @param a * @param b * @returns a + b */ add2(a: SpinorE3, b: SpinorE3): Spinor3; /** * Intentionally undocumented. * @return this + I * β */ addPseudo(β: number): Spinor3; /** * this ⟼ this + α * * @param α * @returns this + α */ addScalar(α: number): this; /** * arg(A) = grade(log(A), 2) * * @returns arg(this) */ arg(): Spinor3; /** * */ approx(n: number): this; /** * Returns an unlocked (mutable) copy of `this`. */ clone(): Spinor3; /** * The Clifford conjugate. * The multiplier for the grade x is (-1) raised to the power x * (x + 1) / 2 * The pattern of grades is +--++--+ * * @returns conj(this) */ conj(): this; /** *

* this ⟼ copy(source) *

* * @param source */ copy(source: SpinorE3): this; copyCoordinates(coordinates: number[]): Spinor3; /** * Sets this spinor to the value of the scalar, α. * * @param α The scalar to be copied. */ copyScalar(α: number): Spinor3; /** * Intentionally undocumented. */ copySpinor(s: SpinorE3): Spinor3; /** * Intentionally undocumented. */ copyVector(vector: VectorE3): Spinor3; /** *

* this ⟼ this / s *

* @param s */ div(s: SpinorE3): this; /** *

* this ⟼ a / b *

* @param a * @param b */ div2(a: SpinorE3, b: SpinorE3): this; /** *

* this ⟼ this / α *

* @param α */ divByScalar(α: number): this; /** * this ⟼ dual(v) = v <<< inv(I) * * @param v The vector whose dual will be used to set this spinor. * @param changeSign Changes the sign from the usual convention for a right-handed pseudoscalar. */ dual(v: VectorE3, changeSign: boolean): Spinor3; equals(other: any): boolean; /** * this ⟼ ethis * * @returns exp(this) */ exp(): this; getComponent(index: number): number; /** *

* this ⟼ conj(this) / quad(this) *

*/ inv(): this; /** * */ isOne(): boolean; /** * */ isZero(): boolean; /** * @param rhs */ lco(rhs: SpinorE3): Spinor3; /** * */ lco2(a: SpinorE3, b: SpinorE3): Spinor3; /** *

* this ⟼ this + α * (target - this) *

* @param target * @param α */ lerp(target: SpinorE3, α: number): this; /** *

* this ⟼ a + α * (b - a) *

* @param a * @param b * @param α */ lerp2(a: SpinorE3, b: SpinorE3, α: number): this; /** * this ⟼ log(this) */ log(): this; /** *

* Computes the square root of the squared norm. *

*

* This method does not change this multivector. *

*/ magnitude(): number; /** * Intentionally undocumented. */ magnitudeSansUnits(): number; /** *

* this ⟼ this * rhs *

* * @param rhs */ mul(rhs: SpinorE3): this; /** *

* this ⟼ a * b *

* * @param a * @param b */ mul2(a: SpinorE3, b: SpinorE3): this; /** * */ neg(): this; /** *

* this ⟼ sqrt(this * conj(this)) *

*/ norm(): this; /** *

* this ⟼ this / magnitude(this) *

*/ normalize(): this; /** * Sets this spinor to the identity element for multiplication, 1. */ one(): this; /** *

* this ⟼ this * conj(this) *

*/ quad(): this; /** *

* This method does not change this multivector. *

*/ squaredNorm(): number; /** * Intentionally undocumented. */ squaredNormSansUnits(): number; /** * @param σ */ stress(σ: VectorE3): this; rco(rhs: SpinorE3): this; rco2(a: SpinorE3, b: SpinorE3): this; /** *

* this = (w, B) ⟼ (w, -B) *

*/ rev(): this; /** * Sets this Spinor to the value of its reflection in the plane orthogonal to n. * The geometric formula for bivector reflection is B' = n * B * n. * * @param n */ reflect(n: VectorE3): this; /** *

* this = ⟼ R * this * rev(R) *

* * @param R */ rotate(R: SpinorE3): this; /** *

* Computes a rotor, R, from two vectors, where * R = (abs(b) * abs(a) + b * a) / sqrt(2 * (quad(b) * quad(a) + abs(b) * abs(a) * b << a)) *

* * @param a The from vector. * @param b The to vector. * @return The rotor representing a rotation from a to b. */ rotorFromDirections(a: VectorE3, b: VectorE3): this; /** *

* this = ⟼ exp(- B * θ / 2) *

* * @param B The unit bivector that generates the rotation. * @param θ The rotation angle in radians. */ rotorFromGeneratorAngle(B: BivectorE3, θ: number): this; rotorFromVectorToVector(a: VectorE3, b: VectorE3, B: BivectorE3): this; scp(rhs: SpinorE3): Spinor3; scp2(a: SpinorE3, b: SpinorE3): this; /** *

* this ⟼ this * α *

* * @param α */ scale(α: number): this; /** *

* this ⟼ this - s * α *

* * @param s * @param α */ sub(s: SpinorE3, α?: number): this; /** *

* this ⟼ a - b *

* * @param a * @param b */ sub2(a: SpinorE3, b: SpinorE3): this; /** *

* this ⟼ a * b *

* * Sets this Spinor3 to the geometric product, a * b, of the vector arguments. * * @param a * @param b */ versor(a: VectorE3, b: VectorE3): this; /** *

* this ⟼ a ^ b *

* * Sets this Spinor3 to the exterior product, a ^ b, of the vector arguments. * * @param a * @param b */ wedge(a: VectorE3, b: VectorE3): this; /** * @param grade */ grade(grade: number): this; /** * */ toArray(): number[]; /** * @param fractionDigits * @return */ toExponential(fractionDigits?: number): string; /** * @param fractionDigits */ toFixed(fractionDigits?: number): string; /** * @param position * @return */ toPrecision(position?: number): string; /** * @param radix * @return A non-normative string representation of the target. */ toString(radix?: number): string; ext(rhs: SpinorE3): Spinor3; ext2(a: SpinorE3, b: SpinorE3): Spinor3; /** * Sets this spinor to the identity element for addition, 0. */ zero(): this; /** * @param spinor The spinor to be copied. * @returns A copy of the spinor argument. */ static copy(spinor: SpinorE3): Spinor3; /** * Computes dual(V) = v << inv(I). * * @param v * @param changeSign */ static dual(v: VectorE3, changeSign: boolean): Spinor3; static fromBivector(B: BivectorE3): Spinor3; /** * */ static isOne(spinor: SpinorE3): boolean; /** * @param a * @param b * @param α * @returns a + α * (b - a) */ static lerp(a: SpinorE3, b: SpinorE3, α: number): Spinor3; /** *

* Computes a unit spinor with a random direction. *

*/ static random(): Spinor3; /** * Computes the rotor that rotates vector a to vector b. * * @param a The from vector. * @param b The to vector. */ static rotorFromDirections(a: VectorE3, b: VectorE3): Spinor3; /** * Constructs a new Spinor3 from coordinates. * The returned spinor is not locked. * The returned spinor is not modified. * @param yz The coordinate corresponding to the e2e3 basis bivector. * @param zx The coordinate corresponding to the e3e1 basis bivector. * @param xy The coordinate corresponding to the e1e2 basis bivector. * @param a The coordinate corresponding to the 1 basis scalar. */ static spinor(yz: number, zx: number, xy: number, a: number): Spinor3; /** * A spinor with the value of 1. * The spinor is not modified (initially). * The spinor is not locked (initially). * @deprecated This value may become locked in future. User Spinor3.spinor(0, 0, 0, 1) instead. */ static readonly one: Spinor3; /** * @param a * @param b */ static wedge(a: VectorE3, b: VectorE3): Spinor3; /** * A spinor with the value of 0. * The spinor is not modified (initially). * The spinor is not locked (initially). * @deprecated This value may become locked in future. User Spinor3.spinor(0, 0, 0, 0) instead. */ static readonly zero: Spinor3; } /** * @hidden */ interface SphereGeometryOptions extends GeometryOptions, GeometryKey { azimuthSegments?: number; azimuthStart?: number; azimuthLength?: number; elevationSegments?: number; elevationStart?: number; elevationLength?: number; mode?: GeometryMode; radius?: number; } /** * A convenience class for creating sphere geometry elements. * @hidden */ declare class SphereGeometry extends GeometryElements { /** * */ constructor(contextManager: ContextManager, options?: SphereGeometryOptions, levelUp?: number); /** * */ protected resurrector(levelUp: number): void; /** * */ protected destructor(levelUp: number): void; } /** * @hidden */ interface TetrahedronGeometryOptions extends GeometryOptions, GeometryKey { radius?: number; } /** * A convenience class for creating a tetrahedron geometry. * @hidden */ declare class TetrahedronGeometry extends GeometryElements { /** * */ constructor(contextManager: ContextManager, options?: TetrahedronGeometryOptions, levelUp?: number); /** * */ protected resurrector(levelUp: number): void; /** * */ protected destructor(levelUp: number): void; } /** * */ interface TextureLoaderOptions { crossOrigin?: string; } /** * A utility for loading Texture resources from a URL. */ declare class TextureLoader { private contextManager; /** * @param contextManager */ constructor(contextManager: ContextManager); /** * * @param url The Uniform Resource Locator of the image. * @param options */ imageTexture(url: string, options?: TextureLoaderOptions): Promise; /** * @deprecated * @param url The Uniform Resource Locator of the image. * @param onLoad * @param onError * @param options */ loadImageTexture(url: string, onLoad: (texture: ImageTexture) => any, onError?: () => any, options?: TextureLoaderOptions): void; } /** * */ declare enum GLSLESVersion { OneHundred = "100", ThreeHundred = "300" } /** * GraphicsProgramBuilder is the builder pattern for generating vertex and fragment shader source code. * @hidden */ declare class GraphicsProgramBuilder { private aMeta; private uParams; private _version; /** * @param primitive */ constructor(primitive?: Primitive); attribute(name: string, size: AttributeSizeType): this; uniform(name: string, glslType: UniformGlslType): this; version(version: GLSLESVersion): this; /** * Computes vertex shader source code consistent with the state of this builder. */ vertexShaderSrc(): string; /** * Computes fragment shader source code consistent with the state of this builder. */ fragmentShaderSrc(): string; } /** * */ declare class ShaderMaterial extends ShareableContextConsumer implements Material { /** * */ private _vertexShaderSrc; /** * */ private _fragmentShaderSrc; /** * */ private _attribs; /** * */ private _program; /** * */ private _attributesByName; private _attributesByIndex; /** * */ private _uniforms; /** * 1. Creates a subscription to WebGL rendering context events but does not synchronize. * 2. Constructs vertex and fragment shader sources. * 3. Synchronizes with the WebGL rendering context if this is a top-level class (levelUp is zero). * * The contextManager must be defined. * * @param vertexShaderSrc The vertex shader source code. * @param fragmentShaderSrc The fragment shader source code. * @param attribs The attribute ordering. * @param contextManager The ContextManager to subscribe to for WebGL rendering context events. * @param levelUp The level of this class in the implementation inheritance hierarchy. */ constructor(vertexShaderSrc: string, fragmentShaderSrc: string, attribs: string[], contextManager: ContextManager, levelUp?: number); /** * */ protected resurrector(levelUp: number): void; /** * */ protected destructor(levelUp: number): void; /** * */ contextGain(): void; /** * */ contextLost(): void; /** * */ contextFree(): void; /** * */ get vertexShaderSrc(): string; /** * */ get fragmentShaderSrc(): string; /** * */ get attributeNames(): string[]; set attributeNames(unused: string[]); /** * Convenience method for dereferencing the name to an attribute location, followed by enabling the attribute. */ enableAttrib(indexOrName: number | string): void; /** * */ enableAttribs(): void; /** * */ disableAttrib(indexOrName: number | string): void; /** * */ disableAttribs(): void; attrib(name: string, value: VertexBuffer, size: number, normalized?: boolean, stride?: number, offset?: number): Material; getAttrib(indexOrName: number | string): Attrib; /** * Returns the location (index) of the attribute with the specified name. * Returns -1 if the name does not correspond to an attribute. */ getAttribLocation(name: string): number; /** * Returns a Uniform object corresponding to the uniform * parameter of the same name in the shader code. If a uniform parameter of the specified name * does not exist, this method returns undefined (void 0). */ getUniform(name: string): Uniform; /** *

* Determines whether a uniform with the specified name exists in the WebGLProgram. *

*/ hasUniform(name: string): boolean; activeTexture(texture: TextureUnit): void; uniform1f(name: string, x: number): void; uniform1fv(name: string, data: Float32Array, srcOffset?: number, srcLength?: number): void; uniform1i(name: string, x: number): void; uniform1iv(name: string, data: Int32Array, srcOffset?: number, srcLength?: number): void; uniform2f(name: string, x: number, y: number): void; uniform2fv(name: string, data: Float32Array, srcOffset?: number, srcLength?: number): void; uniform2i(name: string, x: number, y: number): void; uniform2iv(name: string, src: Int32Array, srcOffset?: number, srcLength?: number): void; uniform3f(name: string, x: number, y: number, z: number): void; uniform3fv(name: string, data: Float32Array, srcOffset: number, srcLength: number): void; uniform3i(name: string, x: number, y: number, z: number): void; uniform3iv(name: string, src: Int32Array, srcOffset?: number, srcLength?: number): void; uniform4f(name: string, x: number, y: number, z: number, w: number): void; uniform4fv(name: string, data: Float32Array, srcOffset?: number, srcLength?: number): void; uniform4i(name: string, x: number, y: number, z: number, w: number): void; uniform4iv(name: string, src: Int32Array, srcOffset?: number, srcLength?: number): void; uniform(name: string, value: number | number[]): Material; /** * */ use(): ShaderMaterial; matrix2fv(name: string, matrix: Float32Array, transpose?: boolean): this; matrix3fv(name: string, matrix: Float32Array, transpose?: boolean): this; matrix4fv(name: string, matrix: Float32Array, transpose?: boolean): this; /** * @param mode Specifies the type of the primitive being rendered. * @param first Specifies the starting index in the array of vector points. * @param count The number of points to be rendered. */ drawArrays(mode: BeginMode, first: number, count: number): Material; /** * @param mode Specifies the type of the primitive being rendered. * @param count The number of elements to be rendered. * @param type The type of the values in the element array buffer. * @param offset Specifies an offset into the element array buffer. */ drawElements(mode: BeginMode, count: number, type: DataType, offset: number): Material; } /** * A shareable WebGL program based upon shader source code in HTML script elements. * * This class provides a convenient way of creating custom GLSL programs. * The scripts are lazily loaded so that the constructor may be called before * the DOM has finished loading. */ declare class HTMLScriptsMaterial extends ShaderMaterial { /** * @param contextManager * @param scriptIds The element identifiers for the vertex and fragment shader respectively. * @param attribs An array of strings containing the order of attributes. * @param dom The document object model that owns the script elements. * @param levelUp */ constructor(contextManager: ContextManager, scriptIds: string[], attribs?: string[], dom?: Document, levelUp?: number); /** * */ protected resurrector(levelUp: number): void; /** * */ protected destructor(levelUp: number): void; } /** * A specification of the attributes and uniforms required in the Material. * @hidden */ interface MaterialOptions { /** * A mapping from the attribute name to the size of the float or vector. * 'aThing': 1 => 'attribute float aThing' * 'aThing': 2 => 'attribute vec2 aThing;' * 'aThing': 3 => 'attribute vec3 aThing;' * 'aThing': 4 => 'attribute vec4 aThing;' */ attributes?: { [name: string]: AttributeSizeType; }; /** * A mapping from the uniform name to the type name. * For example, 'M': 'mat4' produces 'uniform mat4 M;'. */ uniforms?: { [name: string]: UniformGlslType; }; /** * An optional GLSL version that can be used to override the default algorithm for shader version. */ version?: GLSLESVersion; } /** * */ interface LineMaterialOptions extends MaterialOptions { } /** * Generates a WebGLProgram suitable for use with LINES, and LINE_STRIP. */ declare class LineMaterial extends ShaderMaterial { /** * */ constructor(contextManager: ContextManager, options?: LineMaterialOptions, levelUp?: number); /** * */ protected resurrector(levelUp: number): void; /** * */ protected destructor(levelUp: number): void; } /** * @hidden */ interface MeshMaterialOptions extends MaterialOptions { } /** * @hidden */ declare class MeshMaterial extends ShaderMaterial { /** * 1. Creates a subscription to WebGL rendering context events but does not subscribe. * 2. Constructs vertex and fragment shader sources. * 3. Sets the name for reporting reference counts. * 4. Synchronize with the WebGL rendering context if this is a top-level class (levelUp is zero). * * The contextManager must be defined. * * @param contextManager The ContextManager that will be subscribed to for WebGL rendering context events. * @param options Used to configure the MeshMaterial. * @param levelUp Defines the level of the MeshMaterial in the inheritance hierarchy. */ constructor(contextManager: ContextManager, options: MeshMaterialOptions, levelUp?: number); /** * */ protected resurrector(levelUp: number): void; /** * */ protected destructor(levelUp: number): void; } /** * @hidden */ interface PointMaterialOptions extends MaterialOptions { } /** * @hidden */ declare class PointMaterial extends ShaderMaterial { /** * */ constructor(contextManager: ContextManager, options: PointMaterialOptions, levelUp?: number); /** * */ protected resurrector(levelUp: number): void; /** * */ protected destructor(levelUp: number): void; } /** * @hidden */ declare const acos: (x: T) => T; /** * @hidden */ declare const asin: (x: T) => T; /** * @hidden */ declare const atan: (x: T) => T; /** * @hidden */ declare const cos: (x: T) => T; /** * @hidden */ declare const cosh: (x: T) => T; /** * @hidden */ declare const exp: (x: T) => T; /** * @hidden */ declare const log: (x: T) => T; /** * @hidden */ declare const norm: (x: T) => T; /** * @hidden */ declare const quad: (x: T) => T; /** * @hidden */ declare const sin: (x: T) => T; /** * @hidden */ declare const sinh: (x: T) => T; /** * @hidden */ declare const sqrt: (x: T) => T; /** * @hidden */ declare const tan: (x: T) => T; /** * @hidden */ declare const tanh: (x: T) => T; /** * @hidden */ declare class Spinor2 { isLocked(): boolean; lock(): number; unlock(token: number): void; /** * */ private coords_; /** * */ private modified_; /** * */ constructor(coords?: number[], modified?: boolean); get length(): number; get modified(): boolean; set modified(modified: boolean); getComponent(i: number): number; /** * The bivector part of this spinor as a number. */ get xy(): number; set xy(xy: number); /** * The scalar part of this spinor as a number. */ get a(): number; set a(α: number); /** * The pseudoscalar part of this spinor as a number. */ get b(): number; set b(b: number); /** * * this ⟼ this + α * spinor * * @param spinor * @param α * @return this */ add(spinor: SpinorE2, α?: number): Spinor2; /** * * this ⟼ a + b * * @param a * @param b * @return this */ add2(a: SpinorE2, b: SpinorE2): Spinor2; /** * Intentionally undocumented. */ addPseudo(β: number): Spinor2; /** * this ⟼ this + α * * @param α * @return this */ addScalar(α: number): this; /** * arg(A) = grade(log(A), 2) */ arg(): Spinor2; /** * */ approx(n: number): this; /** * @return A copy of this */ clone(): Spinor2; /** * The Clifford conjugate. * The multiplier for the grade x is (-1) raised to the power x * (x + 1) / 2 * The pattern of grades is +--++--+ * * @returns conj(this) */ conj(): this; /** *

* this ⟼ copy(spinor) *

* * @param spinor */ copy(spinor: SpinorE2): this; /** * Sets this spinor to the value of the scalar, α. * * @param α The scalar to be copied. * @return */ copyScalar(α: number): this; /** * Intentionally undocumented. */ copySpinor(spinor: SpinorE2): this; /** * Intentionally undocumented. */ copyVector(vector: VectorE2): Spinor2; cos(): Spinor2; cosh(): Spinor2; /** *

* this ⟼ this / s *

* * @param s */ div(s: SpinorE2): this; /** *

* this ⟼ a / b *

* * @param a * @param b */ div2(a: SpinorE2, b: SpinorE2): this; /** *

* this ⟼ this / α *

* * @param α */ divByScalar(α: number): this; /** *

* this ⟼ ethis *

* * @return {Spinor2} this */ exp(): this; /** *

* this ⟼ conj(this) / quad(this) *

* * @return {Spinor2} this */ inv(): this; /** * */ isOne(): boolean; /** * */ isZero(): boolean; lco(rhs: SpinorE2): this; lco2(a: SpinorE2, b: SpinorE2): this; /** *

* this ⟼ this + α * (target - this) *

* * @param target * @param α */ lerp(target: SpinorE2, α: number): this; /** *

* this ⟼ a + α * (b - a) *

* * @param a * @param b * @param α */ lerp2(a: SpinorE2, b: SpinorE2, α: number): this; /** * this ⟼ log(this) * * @returns log(this) */ log(): Spinor2; /** *

* Computes the square root of the squared norm. *

*

* This method does not change this spinor. *

*/ magnitude(): number; /** *

* this ⟼ this * s *

* * @param s */ mul(s: SpinorE2): this; /** *

* this ⟼ a * b *

* * @param a * @param b */ mul2(a: SpinorE2, b: SpinorE2): this; /** * @return {Spinor2} this */ neg(): this; /** *

* this ⟼ sqrt(this * conj(this)) *

* * @return {Spinor2} this */ norm(): this; /** *

* this ⟼ this / magnitude(this) *

* * @return {Spinor2} this */ normalize(): this; /** * Sets this spinor to the identity element for multiplication, 1. * @return {Spinor2} this */ one(): this; pow(): Spinor2; /** * @returns The square of the magnitude. */ quaditude(): number; sin(): Spinor2; sinh(): Spinor2; /** *

* this ⟼ this * conj(this) *

* * @return {Spinor2} this */ squaredNorm(): this; rco(rhs: SpinorE2): Spinor2; rco2(a: SpinorE2, b: SpinorE2): Spinor2; /** *

* this = (w, B) ⟼ (w, -B) *

* * @return {Spinor2} this */ rev(): this; /** * Sets this Spinor to the value of its reflection in the plane orthogonal to n. * The geometric formula for bivector reflection is B' = n * B * n. */ reflect(n: VectorE2): this; /** *

* this = ⟼ rotor * this * rev(rotor) *

* * @param rotor * @return this */ rotate(rotor: SpinorE2): this; /** *

* Sets this multivector to a rotation from vector a to vector b. *

* * @param a The from vector. * @param b The to vector. * @return The rotor representing a rotation from a to b. */ rotorFromDirections(a: VectorE2, b: VectorE2): this; /** * * this = ⟼ exp(- B * θ / 2) * * @param B * @param θ * @returns this */ rotorFromGeneratorAngle(B: SpinorE2, θ: number): this; rotorFromVectorToVector(a: VectorE2, b: VectorE2): Spinor2; scp(rhs: SpinorE2): Spinor2; scp2(a: SpinorE2, b: SpinorE2): Spinor2; /** *

* this ⟼ this * α *

* * @param α */ scale(α: number): this; stress(σ: VectorE2): Spinor2; /** *

* this ⟼ this - s * α *

* * @param s * @param α */ sub(s: SpinorE2, α?: number): this; /** *

* this ⟼ a - b *

* * @param a * @param b */ sub2(a: SpinorE2, b: SpinorE2): this; /** *

* this ⟼ a * b *

* Sets this Spinor2 to the geometric product a * b of the vector arguments. * * @param a * @param b */ versor(a: VectorE2, b: VectorE2): this; grade(i: number): Spinor2; /** * */ toArray(): number[]; toExponential(fractionDigits?: number): string; toFixed(fractionDigits?: number): string; toPrecision(precision?: number): string; /** * @return A non-normative string representation of the target. */ toString(radix?: number): string; ext(rhs: SpinorE2): Spinor2; ext2(a: SpinorE2, b: SpinorE2): Spinor2; /** * Sets this spinor to the identity element for addition, 0 */ zero(): this; static copy(spinor: SpinorE2): Spinor2; static fromBivector(B: Pseudo): Spinor2; /** * a + α * (b - a) */ static lerp(a: SpinorE2, b: SpinorE2, α: number): Spinor2; /** * */ static one(): Spinor2; /** * Computes the rotor that rotates vector a to vector b. */ static rotorFromDirections(a: VectorE2, b: VectorE2): Spinor2; /** * */ static zero(): Spinor2; } /** * The even sub-algebra of the Euclidean algebra 𝓖(4, 0). */ interface SpinorE4 extends Scalar { } /** * @hidden */ declare class Matrix1 extends AbstractMatrix { } /** * The even sub-algebra of the Euclidean algebra 𝓖(1, 0). * @hidden */ interface SpinorE1 extends Scalar { } /** * @hidden */ interface VectorE0 { } /** * @hidden */ declare class Vector1 extends Coords { /** * @class Vector1 * @param data Default is [0]. * @param modified Default is false. */ constructor(data?: number[], modified?: boolean); /** * @property x * @type Number */ get x(): number; set x(value: number); set(x: number): Vector1; add(vector: VectorE1, alpha?: number): this; add2(a: VectorE1, b: VectorE1): this; scp(v: VectorE1): this; /** *

* this ⟼ σ * thisT *

* * @param σ */ applyMatrix(σ: Matrix1): this; /** * @param n */ approx(n: number): this; /** * The Clifford conjugate. * The multiplier for the grade x is (-1) raised to the power x * (x + 1) / 2 * The pattern of grades is +--++--+ * * @returns conj(this) */ conj(): this; copy(v: VectorE1): this; det(): number; dual(): this; exp(): this; one(): this; inv(): this; lco(v: VectorE1): this; log(): this; mul(v: VectorE1): this; norm(): this; div(v: VectorE1): this; divByScalar(scalar: number): this; min(v: VectorE1): this; max(v: VectorE1): this; floor(): this; ceil(): this; rev(): this; rco(v: VectorE1): this; round(): this; roundToZero(): this; scale(scalar: number): this; stress(σ: VectorE1): this; sub(v: VectorE1): this; subScalar(s: number): this; sub2(a: VectorE1, b: VectorE1): Vector1; /** * @return {Vector1} this */ neg(): this; /** * @param position */ distanceTo(position: VectorE1): number; dot(v: VectorE1): number; /** * Computes the square root of the squared norm. */ magnitude(): number; normalize(): Vector1; mul2(a: VectorE1, b: VectorE1): this; quad(): this; squaredNorm(): number; quadranceTo(position: VectorE1): number; reflect(n: VectorE1): Vector1; reflection(n: VectorE0): Vector1; rotate(rotor: SpinorE1): Vector1; /** * this ⟼ this + α * (v - this) * @param v * @param α */ lerp(v: VectorE1, α: number): this; /** *

* this ⟼ a + α * (b - a) *

* @param a * @param b * @param α * @return {Vector1} */ lerp2(a: Vector1, b: Vector1, α: number): this; equals(v: VectorE1): boolean; fromArray(array: number[], offset?: number): this; toArray(array?: number[], offset?: number): number[]; toExponential(fractionDigits?: number): string; toFixed(fractionDigits?: number): string; toPrecision(precision?: number): string; toString(radix?: number): string; /** * @param d */ translation(d: VectorE0): this; fromAttribute(attribute: { itemSize: number; array: number[]; }, index: number, offset?: number): this; clone(): Vector1; ext(v: VectorE1): this; /** * Sets this vector to the identity element for addition, 0. * @return {Vector1} */ zero(): Vector1; /** * @return {Vector1} */ static random(): Vector1; /** * */ static zero(): Vector1; } /** * */ interface VectorE4 { /** * The Cartesian x-coordinate. */ readonly x: number; /** * The Cartesian y-coordinate. */ readonly y: number; /** * The Cartesian z-coordinate. */ readonly z: number; /** * The Cartesian w-coordinate. */ readonly w: number; } /** * */ declare class Vector4 extends Coords { /** * @param data Default is [0, 0, 0, 0] corresponding to x, y, z, and w coordinate labels. * @param modified Default is false. */ constructor(data?: number[], modified?: boolean); /** * @property x * @type Number */ get x(): number; set x(value: number); /** * @property y * @type Number */ get y(): number; set y(value: number); /** * @property z * @type Number */ get z(): number; set z(value: number); /** * @property w * @type Number */ get w(): number; set w(value: number); setW(w: number): this; add(vector: VectorE4, α?: number): this; add2(a: VectorE4, b: VectorE4): this; /** * Pre-multiplies the column vector corresponding to this vector by the matrix. * The result is applied to this vector. * * @param σ The 4x4 matrix that pre-multiplies this column vector. * @return {Vector4} this */ applyMatrix(σ: Matrix4): Vector4; /** * @param n */ approx(n: number): Vector4; clone(): Vector4; copy(v: VectorE4): this; divByScalar(α: number): this; lerp(target: VectorE4, α: number): this; lerp2(a: VectorE4, b: VectorE4, α: number): Vector4; neg(): this; scale(α: number): this; reflect(n: VectorE4): this; rotate(rotor: SpinorE4): this; stress(σ: VectorE4): this; sub(v: VectorE4, α: number): this; sub2(a: VectorE4, b: VectorE4): this; magnitude(): number; squaredNorm(): number; toExponential(fractionDigits?: number): string; toFixed(fractionDigits?: number): string; toPrecision(precision?: number): string; toString(radix?: number): string; zero(): Vector4; } /** * @hidden */ interface WindowAnimationRunner { /** * @method start * @return {void} */ start(): void; /** * @method stop * @return {void} */ stop(): void; /** * @method reset * @return {void} */ reset(): void; /** * @method lap * @return {void} */ lap(): void; /** * @property time * @type number * @readOnly */ time: number; /** * @property isRunning * @type boolean * @readOnly */ isRunning: boolean; /** * @property isPaused * @type boolean * @readOnly */ isPaused: boolean; } /** * @hidden */ interface WindowAnimationOptions { setUp?: () => void; tearDown?: (animateException: any) => void; terminate?: (time: number) => boolean; window?: BrowserWindow; } /** * @hidden */ declare function animation(animate: (time: number) => void, options?: WindowAnimationOptions): WindowAnimationRunner; /** * @hidden */ declare function getCanvasElementById(elementId: string, dom?: Document): HTMLCanvasElement; /** * */ interface ArrowOptions { /** * */ axis?: VectorE3; /** * */ color?: { r: number; g: number; b: number; }; /** * The height of the cone that constitutes the arrow head. * Default is 0.20 */ heightCone?: number; /** * The height of the cylinder that constitutes the arrow tail. * Default is 0.80 */ heightShaft?: number; /** * length = heightCone + heightShaft */ length?: number; /** * */ meridian?: VectorE3; /** * */ mode?: "mesh" | "wire" | "point"; /** * */ offset?: VectorE3; /** * The radius of the cone that constitutes the arrow head. * Default is 0.08 */ radiusCone?: number; /** * The radius of the cylinder that constitutes the arrow tail. * Default is 0.01 */ radiusShaft?: number; /** * The number of segments, in the azimuth plane, used to construct the arrow. * Default is 16. * Minimum is 3. */ thetaSegments?: number; /** * */ tilt?: SpinorE3; textured?: boolean; transparent?: boolean; emissive?: boolean; colored?: boolean; reflective?: boolean; } /** * A Mesh in the form of an arrow that may be used to represent a vector quantity. */ declare class Arrow extends Mesh { /** * @param contextManager This will usually be provided by the `Engine`. * @param options * @param levelUp Leave as zero unless you are extending this class. */ constructor(contextManager: ContextManager, options?: Partial, levelUp?: number); /** * @hidden */ protected destructor(levelUp: number): void; /** * The vector that is represented by the Arrow. * * magnitude(Arrow.vector) = Arrow.length * direction(Arrow.vector) = Arrow.axis * Arrow.vector = Arrow.length * Arrow.axis */ get vector(): VectorE3; set vector(vector: VectorE3); /** * The length of the Arrow. * This property determines the scaling of the Arrow in all directions. */ get length(): number; set length(length: number); } /** * An arrow with a fixed head and variable length. */ declare class ArrowFH implements Renderable { private readonly head; private readonly tail; private readonly $vector; private $vectorLock; private readonly $position; private $positionLock; private readonly $attitude; private $attitudeLock; private readonly $color; private $colorLock; private $isHeadVisible; /** * @param contextManager This will usually be provided by the `Engine`. * @param options */ constructor(contextManager: ContextManager, options?: Partial); name: string; transparent: boolean; render(ambients: Facet[]): void; /** * @hidden */ contextFree(): void; /** * @hidden */ contextGain(): void; /** * @hidden */ contextLost(): void; addRef(): number; release(): number; /** * The vector from the tail of the arrow to the head of the arrow. */ get vector(): Geometric3; set vector(vector: Geometric3); /** * @hidden */ isZombie(): boolean; /** * Alias for `position`. */ get X(): Geometric3; set X(X: Geometric3); /** * The position (vector). */ get position(): Geometric3; set position(position: Geometric3); /** * Alias for `attitude`. */ get R(): Geometric3; set R(R: Geometric3); /** * The attitude (spinor). */ get attitude(): Geometric3; set attitude(attitude: Geometric3); get color(): Color; set color(color: Color); private setPosition; private setAttitude; private updateHeadPosition; private updateHeadAttitude; } /** * */ interface BasisOptions extends Record { /** * */ axis?: VectorE3; /** * */ color?: { r: number; g: number; b: number; }; /** * */ meridian?: VectorE3; /** * */ tilt?: SpinorE3; } /** * A 3D visual representation of a reference frame or basis vectors. */ declare class Basis extends Mesh { private uPointA; private uPointB; private uPointC; private uColorA; private uColorB; private uColorC; /** * @param contextManager This will usually be provided by the `Engine`. * @param options * @param levelUp Leave as zero unless you are extending this class. */ constructor(contextManager: ContextManager, options?: BasisOptions, levelUp?: number); /** * @hidden */ protected destructor(levelUp: number): void; get a(): Vector3; get b(): Vector3; get c(): Vector3; get colorA(): Color; get colorB(): Color; get colorC(): Color; } /** * */ interface BoxOptions extends Record { /** * */ axis?: VectorE3; /** * */ color?: { r: number; g: number; b: number; }; /** * */ colored?: boolean; /** * The extent of the box in the z-axis direction. */ depth?: number; /** * The extent of the box in the y-axis direction. */ height?: number; /** * */ meridian?: VectorE3; /** * */ mode?: "mesh" | "wire" | "point" | GeometryMode; /** * */ offset?: VectorE3; /** * */ openBack?: boolean; /** * */ openBase?: boolean; /** * */ openFront?: boolean; /** * */ openLeft?: boolean; /** * */ openRight?: boolean; /** * */ openCap?: boolean; /** * The extent of the box in the x-axis direction. */ width?: number; /** * */ textured?: boolean; /** * Rotation (spinor) to be applied to the geometry at construction time to establish the reference orientation. * This cannot be changed once the object has been created because it is burned-in to the vertex locations. */ tilt?: SpinorE3; /** * */ transparent?: boolean; } /** * A 3D visual representation of a box. */ declare class Box extends Mesh { /** * @param contextManager This will usually be provided by the `Engine`. * @param options * @param levelUp Leave as zero unless you are extending this class. */ constructor(contextManager: ContextManager, options?: BoxOptions, levelUp?: number); /** * @hidden */ protected destructor(levelUp: number): void; /** * @default 1 */ get width(): number; set width(width: number); /** * */ get height(): number; set height(height: number); /** * */ get depth(): number; set depth(depth: number); } /** * */ interface CurveOptions extends Record { /** *

* A parametric function determining the positions of points on the curve. *

*

* umin <= u <= umax *

* * @default (u: number) => u * e1 + v * e2 */ aPosition?: (u: number) => VectorE3; /** * */ aColor?: (u: number) => { r: number; g: number; b: number; }; /** * */ aOpacity?: (u: number) => number; /** * */ color?: { r: number; g: number; b: number; }; /** * Specifies the required Geometric Primitive Type. * Implementations may choose the nearest type. * * @default LINES */ mode?: CurveMode; /** * * @default -0.5 */ uMin?: number; /** * * @default +0.5 */ uMax?: number; /** * The number of segments for the u coordinate. * * @default 1 */ uSegments?: number; } /** * A 3D visual representation of a discrete parameterized line. */ declare class Curve extends Mesh { /** * @param contextManager This will usually be provided by the `Engine`. * @param options * @param levelUp Leave as zero unless you are extending this class. */ constructor(contextManager: ContextManager, options?: CurveOptions, levelUp?: number); /** * @hidden */ protected destructor(levelUp: number): void; } /** * */ interface CylinderOptions extends Record { /** * Defaults to e2. */ axis?: VectorE3; /** * */ color?: { r: number; g: number; b: number; }; /** * */ colored?: boolean; /** * */ heightSegments?: number; /** * Defaults to 1. */ length?: number; /** * */ meridian?: VectorE3; /** * */ mode?: "mesh" | "wire" | "point" | GeometryMode; /** * */ offset?: VectorE3; /** * Defaults to false. */ openBase?: boolean; /** * Defaults to false. */ openCap?: boolean; /** * Defaults to false. */ openWall?: boolean; /** * Defaults to 1. */ radius?: number; /** * */ textured?: boolean; /** * */ thetaSegments?: number; /** * */ tilt?: SpinorE3; /** * */ transparent?: boolean; } /** * A 3D visual representation of a cylinder. */ declare class Cylinder extends Mesh { /** * @param contextManager This will usually be provided by the `Engine`. * @param options * @param levelUp Leave as zero unless you are extending this class. */ constructor(contextManager: ContextManager, options?: CylinderOptions, levelUp?: number); /** * @hidden */ protected destructor(levelUp: number): void; /** * The length of the cylinder, a scalar. Defaults to 1. */ get length(): number; set length(length: number); /** * The radius of the cylinder, a scalar. Defaults to 1. */ get radius(): number; set radius(radius: number); } /** * */ interface GridOptions extends Record { /** *

* A parametric function determining the positions of points in the grid. *

*

* umin <= u <= umax *

*

* vmin <= v <= vmax *

* * @default (u: number, v: number) => u * e1 + v * e2 */ aPosition?: (u: number, v: number) => VectorE3; /** * * @default (u: number, v: number) => e3 */ aNormal?: (u: number, v: number) => VectorE3; /** * */ axis?: VectorE3; /** * */ aColor?: (u: number, v: number) => { r: number; g: number; b: number; }; /** * */ color?: { r: number; g: number; b: number; }; /** * */ mode?: GeometryMode; /** * The minimum value of the u coordinate. */ uMin?: number; /** * The maximum value of the u coordinate. */ uMax?: number; /** * The number of segments for the u coordinate. */ uSegments?: number; /** * The minimum value of the v coordinate. */ vMin?: number; /** * The maximum value of the v coordinate. */ vMax?: number; /** * The number of segments for the v coordinate. */ vSegments?: number; } /** * A 3D visual representation of a a discrete parameterized surface. */ declare class Grid extends Mesh { /** * @param contextManager This will usually be provided by the `Engine`. * @param options * @param levelUp Leave as zero unless you are extending this class. */ constructor(contextManager: ContextManager, options?: GridOptions, levelUp?: number); /** * @hidden */ protected destructor(levelUp: number): void; } /** * */ interface GridXYOptions { xMin?: number; xMax?: number; xSegments?: number; yMin?: number; yMax?: number; ySegments?: number; z?: (x: number, y: number) => number; mode?: GeometryMode; } /** * A grid in the xy plane. */ declare class GridXY extends Grid { /** * @param contextManager This will usually be provided by the `Engine`. * @param options * @param levelUp Leave as zero unless you are extending this class. */ constructor(contextManager: ContextManager, options?: GridXYOptions, levelUp?: number); /** * @hidden */ protected destructor(levelUp: number): void; } /** * */ interface GridYZOptions { yMin?: number; yMax?: number; ySegments?: number; zMin?: number; zMax?: number; zSegments?: number; x?: (y: number, z: number) => number; mode?: GeometryMode; } /** * A grid in the yz plane. */ declare class GridYZ extends Grid { /** * @param contextManager This will usually be provided by the `Engine`. * @param options * @param levelUp Leave as zero unless you are extending this class. */ constructor(contextManager: ContextManager, options?: GridYZOptions, levelUp?: number); /** * @hidden */ protected destructor(levelUp: number): void; } /** * */ interface GridZXOptions { zMin?: number; zMax?: number; zSegments?: number; xMin?: number; xMax?: number; xSegments?: number; y?: (z: number, x: number) => number; mode?: GeometryMode; } /** * A #d visual representation of a grid in the zx plane. */ declare class GridZX extends Grid { /** * @param contextManager This will usually be provided by the `Engine`. * @param options * @param levelUp Leave as zero unless you are extending this class. */ constructor(contextManager: ContextManager, options?: GridZXOptions, levelUp?: number); /** * @hidden */ protected destructor(levelUp: number): void; } /** * @hidden */ interface GroupMember extends Renderable { X: Geometric3; R: Geometric3; visible: boolean; } /** * A collection of objects that can be treated as a single Renderable. * @hidden */ declare class Group extends ShareableBase implements GroupMember { /** * The members of this group. */ private members; /** * Position (vector). This is a short alias for the position property. */ private pos; /** * Attitude (spinor). This is a short alias for the attitude property. */ private att; /** * */ stress: Matrix4; /** * Determines whether this group will be rendered. */ visible: boolean; /** * Constructs */ constructor(); /** * */ protected destructor(levelUp: number): void; /** * Position (vector). This is a long alias for the X property. */ get position(): Geometric3; set position(value: Geometric3); get X(): Geometric3; set X(value: Geometric3); /** * Attitude (spinor). This is a long alias for the R property. */ get attitude(): Geometric3; set attitude(value: Geometric3); get R(): Geometric3; set R(value: Geometric3); /** * Adds a Renderable item to this Group. */ add(member: GroupMember): void; /** * Removes a member item from this Group. */ remove(member: GroupMember): void; /** * Renders all the members of this Group. */ render(ambients: Facet[]): void; } /** * */ interface HollowCylinderOptions extends Record { /** * The symmetry axis and the height of the cylinder. */ axis?: VectorE3; /** * */ color?: { r: number; g: number; b: number; }; /** * */ length?: number; /** * The starting direction for the slice. * A unit vector orthogonal to the height vector. */ meridian?: VectorE3; /** * */ offset?: VectorE3; /** * The outer radius of the cylinder. */ outerRadius?: number; /** * The inner radius of the cylinder. */ innerRadius?: number; /** * The angular size of the cylinder. Default is 2 * PI. */ sliceAngle?: number; /** * */ tilt?: SpinorE3; } /** * A 3D visual representation of a hollow cylinder. */ declare class HollowCylinder extends Mesh { /** * @param contextManager This will usually be provided by the `Engine`. * @param options * @param levelUp Leave as zero unless you are extending this class. */ constructor(contextManager: ContextManager, options?: HollowCylinderOptions, levelUp?: number); /** * @hidden */ protected destructor(levelUp: number): void; /** * The length of the cylinder, a scalar. Defaults to 1. */ get length(): number; set length(length: number); } /** * @hidden */ declare enum MinecraftPartKind { Head = 0, Helm = 1, RightLeg = 2, Torso = 3, RightArm = 4, LeftLeg = 5, LeftArm = 6, RightLegLayer2 = 7, TorsoLayer2 = 8, RightArmLayer2 = 9, LeftLegLayer2 = 10, LeftArmLayer2 = 11 } /** * @hidden */ interface MinecraftInternalBodyPartOptions { height: number; partKind: MinecraftPartKind; oldSkinLayout: boolean; offset?: VectorE3; } /** * @hidden */ declare class MinecraftBodyPart extends Mesh { constructor(engine: Engine, texture: ImageTexture, options: MinecraftInternalBodyPartOptions, levelUp?: number); protected destructor(levelUp: number): void; } /** * @hidden */ interface MinecraftBodyPartOptions { height?: number; oldSkinLayout?: boolean; offset?: VectorE3; } /** * @hidden */ declare class MinecraftHead extends MinecraftBodyPart { constructor(engine: Engine, texture: ImageTexture, options?: MinecraftBodyPartOptions); protected destructor(levelUp: number): void; } /** * @hidden */ declare class MinecraftTorso extends MinecraftBodyPart { constructor(engine: Engine, texture: ImageTexture, options?: MinecraftBodyPartOptions); protected destructor(levelUp: number): void; } /** * @hidden */ declare class MinecraftArmL extends MinecraftBodyPart { constructor(engine: Engine, texture: ImageTexture, options?: MinecraftBodyPartOptions); protected destructor(levelUp: number): void; } /** * @hidden */ declare class MinecraftArmR extends MinecraftBodyPart { constructor(engine: Engine, texture: ImageTexture, options?: MinecraftBodyPartOptions); protected destructor(levelUp: number): void; } /** * @hidden */ declare class MinecraftLegL extends MinecraftBodyPart { constructor(engine: Engine, texture: ImageTexture, options?: MinecraftBodyPartOptions); protected destructor(levelUp: number): void; } /** * @hidden */ declare class MinecraftLegR extends MinecraftBodyPart { constructor(engine: Engine, texture: ImageTexture, options?: MinecraftBodyPartOptions); protected destructor(levelUp: number): void; } /** * @hidden */ interface MinecraftFigureOptions { height?: number; oldSkinLayout?: boolean; } /** * A group of body parts arranged to look like a figure. * @hidden */ declare class MinecraftFigure extends Group { head: MinecraftHead; armL: MinecraftArmL; armR: MinecraftArmR; legL: MinecraftLegL; legR: MinecraftLegR; torso: MinecraftTorso; constructor(engine: Engine, texture: ImageTexture, options?: MinecraftFigureOptions); } /** * @hidden */ declare class Parallelepiped implements Renderable { private levelUp; name: string; opacity: number; transparent: boolean; X: Geometric3; /** * */ a: Geometric3; b: Geometric3; c: Geometric3; /** * Face colors * top - 0 * right - 1 * front - 2 * bottom - 3 * left - 4 * back - 5 */ colors: Color[]; private contextManager; private refCount; private mesh; constructor(contextManager: ContextManager, levelUp?: number); /** * @hidden */ protected destructor(levelUp: number): void; render(ambients: Facet[]): void; addRef(): number; release(): number; contextFree(): void; contextGain(): void; contextLost(): void; } /** * The options for creating a Sphere. */ interface SphereOptions extends Record { /** * */ axis?: VectorE3; /** * */ azimuthSegments?: number; /** * */ azimuthStart?: number; /** * */ azimuthLength?: number; /** * */ color?: { r: number; g: number; b: number; }; /** * */ colored?: boolean; /** * */ elevationSegments?: number; /** * */ elevationStart?: number; /** * */ elevationLength?: number; /** * */ meridian?: VectorE3; /** * Why does this not appear to be used? */ mode?: "mesh" | "wire" | "point" | GeometryMode; /** * The center of the sphere. */ offset?: VectorE3; /** * */ radius?: number; /** * */ textured?: boolean; /** * */ tilt?: SpinorE3; /** * */ transparent?: boolean; } /** * */ declare class Sphere extends Mesh { /** * @param contextManager This will usually be provided by the `Engine`. * @param options * @param levelUp Leave as zero unless you are extending this class. */ constructor(contextManager: ContextManager, options?: SphereOptions, levelUp?: number); /** * @hidden */ protected destructor(levelUp: number): void; get radius(): number; set radius(radius: number); } /** * */ interface TetrahedronOptions extends Record { /** * */ axis?: VectorE3; /** * */ color?: { r: number; g: number; b: number; }; /** * */ meridian?: VectorE3; /** * */ mode?: "mesh" | "wire" | "point"; /** * */ offset?: VectorE3; /** * */ tilt?: SpinorE3; textured?: boolean; transparent?: boolean; emissive?: boolean; colored?: boolean; reflective?: boolean; } /** * A 3D visual representation of a tetrahedron. */ declare class Tetrahedron extends Mesh { /** * @param contextManager This will usually be provided by the `Engine`. * @param options * @param levelUp Leave as zero unless you are extending this class. */ constructor(contextManager: ContextManager, options?: TetrahedronOptions, levelUp?: number); /** * */ protected destructor(levelUp: number): void; /** * */ get radius(): number; set radius(radius: number); } /** * */ declare class TrackGeometry implements Geometry { private contextManager; scaling: Matrix4; private data; private count; private N; private dirty; private vbo; private refCount; constructor(contextManager: ContextManager); protected destructor(): void; bind(material: Material): TrackGeometry; unbind(material: Material): TrackGeometry; draw(): TrackGeometry; contextFree(): void; contextGain(): void; contextLost(): void; addRef(): number; release(): number; /** * */ addPoint(x: number, y: number, z: number): void; /** * */ erase(): void; } /** * */ interface TrackOptions { color?: { r: 0; g: 0; b: 0; }; } /** * */ declare class Track extends Mesh { /** * @param contextManager This will usually be provided by the `Engine`. * @param options * @param levelUp Leave as zero unless you are extending this class. */ constructor(contextManager: ContextManager, options?: TrackOptions, levelUp?: number); /** * @hidden */ protected destructor(levelUp: number): void; /** * */ addPoint(point: VectorE3): void; /** * */ clear(): void; } /** * */ declare class TrailConfig { /** * */ enabled: boolean; /** * Determines the number of animation frames between the recording of events. */ interval: number; /** * Determines the maximum number of historical events that form the trail. */ retain: number; } /** *

* Records the position and attitude history of a Mesh allowing the * Mesh to be drawn in multiple historical configurations. *

*

* This class is refererce counted because it maintains a reference to a Mesh. * You should call the release method when the trail is no longer required. *

* * * // The trail is constructed, at any time, on an existing mesh. * const trail = new EIGHT.Trail(mesh) * * // Configure the Trail object, or use the defaults. * trail.config.enabled = true * trail.config.interval = 30 * trail.config.retain = 5 * * // Take a snapshot of the ball position and attitude, usually each animation frame. * trail.snapshot() * * // Draw the trail during the animation frame. * trail.draw(ambients) * * // Release the trail when no longer required, usually in the window.onunload function. * trail.release() */ declare class Trail extends ShareableBase implements Renderable { /** * The underlying Mesh. */ private mesh; /** * The position history. */ private Xs; /** * The attitude history. */ private Rs; /** * The parameter history. */ private Ns; /** * The configuration that determines how the history is recorded. */ config: TrailConfig; private counter; private modulo; /** * Constructs a trail for the specified mesh. */ constructor(mesh: Mesh); /** * @hidden */ protected destructor(levelUp: number): void; /** * @deprecated. Use the render method instead. */ draw(ambients: Facet[]): void; /** * Erases the trail history. */ erase(): void; forEach(callback: (alpha: number, X: Vector3, R: Spinor3) => any): void; /** * Renders the mesh in its historical positions and attitudes. */ render(ambients: Facet[]): void; /** * Records the Mesh variables according to the interval property. */ snapshot(alpha?: number): void; } /** * */ interface TurtleOptions { axis?: VectorE3; color?: { r: number; g: number; b: number; }; colored?: boolean; emissive?: boolean; meridian?: VectorE3; mode?: "mesh" | "wire" | "point"; offset?: VectorE3; textured?: boolean; tilt?: SpinorE3; transparent?: boolean; reflective?: boolean; } /** * A 3D visual representation of a turtle. */ declare class Turtle extends Mesh { /** * @param contextManager This will usually be provided by the `Engine`. * @param options * @param levelUp Leave as zero unless you are extending this class. */ constructor(contextManager: ContextManager, options?: TurtleOptions, levelUp?: number); /** * @hidden */ protected destructor(levelUp: number): void; get width(): number; set width(width: number); /** * */ get height(): number; set height(height: number); } export { AmbientLight, Arrow, ArrowFH, ArrowGeometry, Attrib, Basis, BeginMode, BlendingFactorDest, BlendingFactorSrc, Box, BoxGeometry, Capability, ClearBufferMask, Color, ColorFacet, Curve, CurveGeometry, CurveMode, Cylinder, CylinderGeometry, DataType, DepthFunction, Diagram3D, DirectionalLight, DrawAttribute, DrawPrimitive, Drawable, Engine, GLSLESVersion, Geometric2, Geometric3, GeometryArrays, GeometryElements, GeometryMode, GraphicsProgramBuilder, GraphicsProgramSymbols, Grid, GridGeometry, GridXY, GridYZ, GridZX, Group, HTMLScriptsMaterial, HollowCylinder, ImageTexture, IndexBuffer, LineMaterial, Matrix2, Matrix3, Matrix4, Mesh, MeshMaterial, MinecraftArmL, MinecraftArmR, MinecraftFigure, MinecraftHead, MinecraftLegL, MinecraftLegR, MinecraftTorso, ModelE2, ModelE3, ModelFacet, NumberShareableMap, OrbitControls, Parallelepiped, PerspectiveCamera, PerspectiveTransform, PixelFormat, PixelType, PointMaterial, PointSizeFacet, ReflectionFacetE2, ReflectionFacetE3, Scene, Shader, ShaderMaterial, ShareableArray, ShareableBase, Simplex, Sphere, SphereGeometry, Spinor2, Spinor3, StringShareableMap, Tetrahedron, TetrahedronGeometry, Texture, TextureLoader, TextureMagFilter, TextureMinFilter, TextureParameterName, TextureTarget, TextureUnit, TextureWrapMode, Track, TrackGeometry, TrackballControls, Trail, TrailConfig, Turtle, Uniform, Usage, Vector1, Vector2, Vector3, Vector3Facet, Vector4, VectorN$1 as VectorN, Vertex, VertexBuffer, ViewTransform, WebGLBlendFunc, WebGLClearColor, WebGLDisable, WebGLEnable, acos, animation, asin, atan, cos, cosh, exp, frustumMatrix, getCanvasElementById, log, norm, perspectiveMatrix, quad, reduce, refChange, sin, sinh, sqrt, tan, tanh, vertexArraysFromPrimitive, viewMatrixFromEyeLookUp }; export type { AbstractDrawable, AbstractMesh, ArrowOptions, Attribute, AttributeSizeType, BasisOptions, BivectorE3, BoxOptions, Camera, ContextConsumer, ContextManager, ContextProgramConsumer, CurveGeometryOptions, CurveOptions, CylinderOptions, EngineAttributes, Facet, FacetVisitor, GeometricE3, Geometry, GridOptions, GridXYOptions, GridYZOptions, GridZXOptions, HollowCylinderOptions, LineMaterialOptions, Material, MeshOptions, MinecraftFigureOptions, Primitive, Prism, R3, Renderable, Scalar, Shareable, SphereOptions, SpinorE2, SpinorE3, SpinorE4, TetrahedronOptions, TextureLoaderOptions, TrackOptions, TurtleOptions, UniformGlslType, VectorE1, VectorE2, VectorE3, VectorE4, VertexArrays, ViewController };