/** * Libraries registry. */ declare class LibsRegistry { registry: Record; version: string; /** * Construct a new libraries registry for the specific version. * @param version - The version of the Zea Engine that will be validated against the registered libraries. */ constructor(version: string); /** * Validate and register a library. * @param packageJson - The package.json of the library to register. */ registerLib(packageJson: Record): void; /** * List the registered libraries with their versions. * @return Libraries list. */ listLibs(): Record; } interface GPUDescription { vendor: string; renderer: string; gpuVendor: string; maxTextureSize: number; supportsWebGL: boolean; supportsWebGL2: boolean; } interface SystemDescription { OS: string; isMobileDevice: boolean; isIOSDevice: boolean; browserName: string; webGLSupported: boolean; deviceCategory: string; hardwareConcurrency: number; fullVersion?: any; majorVersion?: any; appName?: any; userAgent?: any; gpuDesc?: GPUDescription; } declare const SystemDesc: SystemDescription; /** * Class representing a BaseClass. * The BaseClass is the foundation class of the SceneTree, as almost all classes derive from it. */ declare class BaseClass { protected __id: number; /** * Create an BaseClass. */ constructor(); /** * Every instance of each class based on BaseClass is assigned a unique number. * This number is not persistent in between different loads of a scene. * Returns the unique id of the object. * @return - The Id of the object. */ getId(): number; /** * Returns the unmangled name of the class. * @return - The name of the class definition. */ getClassName(): string; } /** * Registry is a static factory that handles registration/reconstruction of * classes bases on BaseClass. Registered classes can then be constructed by the Registry by name. * * Note: className is required because on minification process * the name of classes change and we can't simply use '....constructor.name'. * So, we need a way of relating minified class names to the one stored for persistency. * * i.e. * ```javascript * // Import registry class * class Foo() extends BaseClass {} * * Registry.register('Foo', Foo) * // In case 'Foo' class gets its name changed to 'c' on minification, * // and the persisted data type is 'Foo', we would know how to relate them. * ``` * * @static * @class Registry */ declare class Registry { /** * Registers a new class to the factory. * * @param className - Name of the registered class * @param classDef - Class representation(Class function, type) */ static register(className: string, classDef: typeof BaseClass): void; /** * Returns class definition using the name it was registered with. * * @param className - Name of the registered class * @return - Class representation(Class function, type) */ static getClassDefinition(className: string): typeof BaseClass; /** * Returns class name registered for the instantiated object. * @param classDefinition - Class type definition. * @return - Name of the registered class */ static getClassName(classDefinition: typeof BaseClass): string; /** * The factory function that construct the class registered under the given name. * * @param className - Name of the registered class * @return - Instantiated object of the specified class */ static constructClass(className: string): BaseClass; /** * For testing purpose only, never call this outside of the test scope. * * @private */ static flush(): void; } /** * Reads binary data in a specific encoding. Used in loading binary data such as zcad files. */ declare class BinReader { protected __data: ArrayBuffer; protected __byteOffset: number; protected __dataView: DataView; protected __isMobileDevice: boolean; protected utf8decoder: TextDecoder; /** * Create a bin reader. * * @param data - The data buffer. * @param byteOffset - The byte offset value to start reading the buffer. * @param isMobileDevice - The isMobileDevice value. */ constructor(data: ArrayBuffer, byteOffset?: number, isMobileDevice?: boolean); /** * Returns state of whether or not the `BinReader` object was instantiated from a mobile device. * * @return - Returns true is a mobile device is detected. */ get isMobileDevice(): boolean; /** * Returns the data buffer we're reading from. * * @return - The data buffer we are reading from, */ get data(): ArrayBuffer; /** * Returns the length of the buffer. * * @return - The total length of the buffer */ get byteLength(): number; /** * Returns remaining length of the buffer to read. * * @return - The remaining length of the buffer to read. */ get remainingByteLength(): number; /** * Returns current byte offset in the buffer. * @return - The current offset in the binary buffer */ pos(): number; /** * Sets the byte offset value. * @param byteOffset - The byteOffset param. */ seek(byteOffset: number): void; /** * Adds offset bytes to current offset value. * * @param byteOffset - The byte Offset amount. */ advance(byteOffset: number): void; /** * Returns the unsigned Uint8 value at current byte offset position, * and adds one byte to the offset. * * @return - The return value. */ loadUInt8(): number; /** * Returns the unsigned Uint16 value at current byte offset position, * and adds two bytes to the offset. * * @return - The return value. */ loadUInt16(): number; /** * Returns the unsigned Uint32 value at current byte offset position, * and adds four bytes to the offset. * * @return - The return value. */ loadUInt32(): number; /** * Returns the signed Int32 value at current byte offset position, * and adds four bytes to the offset. * * @return - The return value. */ loadSInt32(): number; /** * Returns the Float16 value at current byte offset position, * and adds four bytes to the offset. * * @return - The return value. */ loadFloat16(): number; /** * Returns the Float16 value at current byte offset position, * and adds two bytes to the offset. * * @return - The return value. */ loadUFloat16(): number; /** * Returns a single signed Float16 value at current byte offset position from 2 unsigned Int8 values, * and adds two bytes to the offset. * * @return - The return value. */ loadFloat16From2xUInt8(): void; /** * Loads and returns a single Signed integer value from 2 Unsigned Float16 values. * @return - The return value. */ loadUInt32From2xUFloat16(): number; /** * Loads and returns a single Signed integer value from 2 signed Float16 values. * @return - The return value. */ loadSInt32From2xFloat16(): number; /** * Returns the Float32 value at current byte offset position, * and adds four bytes to the offset. * * @return - The return value. */ loadFloat32(): number; /** * Reads buffer and return a signed Int8 array with the specified size, * starting from current byte offset. * Byte offset is increased by the specified byte size. * * @param size - The size param. * @param clone - The clone param. * @return - The return value. */ loadInt8Array(size?: number, clone?: boolean): Int8Array; /** * Reads buffer and return an unsigned Int8 array with the specified size, * starting from current byte offset. * Byte offset is increased by the specified byte size. * * @param size - The size param. * @param clone - The clone param. * @return - The return value. */ loadUInt8Array(size?: number, clone?: boolean): Uint8Array; /** * Reads buffer and return an unsigned Int16 array with the specified size, * starting from current byte offset. * Byte offset is increased by the specified byte size x 2. * * @param size - The size param. * @param clone - The clone param. * @return - The return value. */ loadUInt16Array(size?: number, clone?: boolean): Uint16Array; /** * Reads buffer and return an unsigned Int32 array with the specified size, * starting from current byte offset. * Byte offset is increased by the specified byte size x 4. * * @param size - The size param. * @param clone - The clone param. * @return - The return value. */ loadUInt32Array(size?: number, clone?: boolean): Uint32Array; /** * Reads buffer and return a Float32 array with the specified size, * starting from current byte offset. * Byte offset is increased by the specified byte size x 4. * * @param size - The size param. * @param clone - The clone param. * @return - The return value. */ loadFloat32Array(size?: number, clone?: boolean): Float32Array; /** * Returns next string. * First looks for the string length description in the next four bytes in the buffer(Starting from byte offset). * * @return - The return value. */ loadStr(): string; /** * Returns an array of strings. * First reading the size of the array then reading each string. * * @return - The return value. */ loadStrArray(): string[]; /** * Creates and returns a `Vec2` object with the next two signed Int32 values in the buffer. * * @return - Returns a Vec2. */ loadSInt32Vec2(): Vec2; /** * Creates and returns a `Vec2` object with the next two unsigned Int32 values in the buffer. * @return - Returns a Vec2. */ loadUInt32Vec2(): Vec2; /** * Creates and returns a `Vec2` object with the next two Float16 values in the buffer. * * @return - Returns a Vec2. */ loadFloat16Vec2(): Vec2; /** * Creates and returns a `Vec2` object with the next two Float32 values in the buffer. * @return - Returns a Vec2. */ loadFloat32Vec2(): Vec2; /** * Creates and returns a `Vec3` object with the next three Float16 values in the buffer. * * @return - Returns a Vec3. */ loadFloat16Vec3(): Vec3; /** * Creates and returns a `Vec3` object with the next three Float32 values in the buffer. * * @return - Returns a Vec3. */ loadFloat32Vec3(): Vec3; /** * Creates and returns a `Quat` object with the next four Float16 values in the buffer. * * @return - Returns a Quat. */ loadFloat16Quat(): Quat; /** * Creates and returns a `Quat` object with the next four Float32 values in the buffer. * @return - Returns a Quat. */ loadFloat32Quat(): Quat; /** * Creates and returns a `Color` object with the next three Float32 values in the buffer. * * @return - Returns a Color. */ loadRGBFloat32Color(): Color; /** * Creates and returns a RGBA `Color` object with the next four Float32 values in the buffer. * @return - Returns a Color. */ loadRGBAFloat32Color(): Color; /** * Creates and returns a `Color` object with the next three unsigned Int8 values in the buffer. * @return - Returns a Color. */ loadRGBUInt8Color(): Color; /** * Creates and returns a RGBA `Color` object with the next four unsigned Int8 values in the buffer. * @return - Returns a Color. */ loadRGBAUInt8Color(): Color; /** * Creates and returns a `Box2` object with the next four Float32 values in the buffer. * Next four because it creates two Vec2. * * @return - Returns a Box2. */ loadBox2(): Box2; /** * Creates and returns a `Box2` object with the next six Float32 values in the buffer. * Next four because it creates two Vec3. * * @return - Returns a Box3. */ loadBox3(): Box3; /** * Given a stridee value, advance the pointer to the end of the current stride. * @param stride - The stride param. */ readPad(stride: number): void; } /** * Representing a Vec2(two-dimensional floating point vector). A Vec2 is for representing 2 dimensional values, such as screen coordinates or pixel coordinates within an image. * * Math types internally store values in {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array|Float32Array} and * expose getters and setters for the component values. * */ declare class Vec2 { x: number; y: number; /** * Creates a Vec2. * * ```javascript * const myVec2 = new Vec2(1.2, 3.4) * ``` * */ constructor(x?: number, y?: number); /** * Setter from scalar components. * @param x - The x component. * @param y - The y component. */ set(x: number, y: number): void; /** * Replaces this Vec2 data with the Vec2 data passed as parameter. * * @param other - The other Vec2 to set from. */ setFromOther(other: Vec2): void; /** * Checks if this Vec2 contains the same values as the other Vec2. * * @param other - The other Vec2 to compare with. * @return - Returns `true` if are the same Vector, otherwise, `false`. */ isEqual(other: Vec2): boolean; /** * Checks if this Vec2 is different from another Vec2. * * @param other - The other Vec2 to compare with. * @return - Returns `true` if the Vec2s are different, otherwise, `false`. */ notEqual(other: Vec2): boolean; /** * Returns true if this Vec2 is approximately the same as other. * * @param other - The other Vec2 to compare with. * @param precision - The precision to which the values must match. * @return - Returns true or false. */ approxEqual(other: Vec2, precision?: number): boolean; /** * Adds other to this Vec2 and returns the result as a new Vec2. * * @param other - The other Vec2 to add. * @return - Returns a new Vec2. */ add(other: Vec2): Vec2; /** * Adds a Vec2 to this Vec2. * * @param other - The other Vec2 to add. */ addInPlace(other: Vec2): void; /** * Subtracts a Vec2 from this Vec2 and returns the result as a new Vec2. * * @param other - The other Vec2 to subtract. * @return - Returns a new Vec2. */ subtract(other: Vec2): Vec2; /** * Subtracts a Vec2 from this Vec2. * * @param other - The other Vec2 to subtract. * @return - Returns a new Vec2. */ subtractInPlace(other: Vec2): Vec2; /** * Scales this Vec2 by scalar and returns the result as a new Vec2. * * @param scalar - The scalar value. * @return - Returns a new Vec2. */ scale(scalar: number): Vec2; /** * Scales this Vec2 by scalar. * * @param scalar - The scalar value. */ scaleInPlace(scalar: number): void; /** * Inverts this Vec2 and returns the result as a new Vec2. * * @return - Returns a new Vec2. */ invert(): Vec2; /** * Inverts this Vec2. * * @return - The return value. */ invertInPlace(): Vec2; /** * Multiplies a Vec2 with this Vec2 and returns the result as a new Vec2. * * @param other - The other Vec2 to multiply with. * @return - Returns a new Vec2. */ multiply(other: Vec2): Vec2; /** * Multiplies a Vec2 with this Vec2. * * @param other - The other Vec2 to multiply with. */ multiplyInPlace(other: Vec2): void; /** * Calculates the squared length of this Vec2. * * @return - Returns the length squared. */ lengthSquared(): number; /** * Calculates the length of this Vec2. * * @return - Returns the length. */ length(): number; /** * Calculates the distance to another vector. * * @param other - The other value. * @return - Returns the distance between vectors. */ distanceTo(other: Vec2): number; /** * Normalizes the Vec2 and returns it as a new Vec2. * Multiplies coordinates value by the inverse of the vector length. * * @return - Returns the Vec2 normalized. */ normalize(): Vec2; /** * Normalizes this Vec2 multiplying coordinate values by the inverse of the vector length. */ normalizeInPlace(): void; /** * Calculates the dot product of this Vec2 against another Vec2. * * @param other - The other Vec2 to compare with. * @return - Returns the dot product. */ dot(other: Vec2): number; /** * Calculates the cross product of this Vec2 against another Vec2. * * @param other - The other Vec2 to compare with. * @return - Returns the cross product. */ cross(other: Vec2): number; /** * Gets the angle between this Vec2 and other assuming both are normalized vectors. * * @param other - The other Vec2 to compare with. * @return - Returns the angle in radians. */ angleTo(other: Vec2): number; /** * Gets the angle between this Vec2 and other. * * @param other - The other Vec2 to compare with. * @return - Returns the angle in radians. */ signedAngleTo(other: Vec2): number; /** * Rotates a Vec2 in a clockwise direction and returns a new rotated Vec2. * * @param angle - The angle of rotation. * @return - Returns the rotated vector. */ rotate(angle: number): Vec2; /** * Performs a linear interpolation between this Vec2 and other Vec2. * * @param other - The other Vec2 to interpolate between. * @param t - Interpolation amount between the two inputs. * @return - Returns a new Vec2. */ lerp(other: Vec2, t: number): Vec2; /** * Generates a random vector with the given scale. * * @param scale - Length of the resulting vector. If omitted, a unit vector will be returned. * @return - The return value. */ setRandomDir(scale?: number): Vec2; /** * Randomizes the scale of this Vec2 coordinates. * * @param scale - The scale value. * @return - The return value. */ setRandom(scale?: number): Vec2; /** * Clones this Vec2 and returns a new Vec2. * * @return - Returns a new Vec2. */ clone(): Vec2; /** * Returns current Vec2 data as array. Often used to pass types to the GPU. * * @return - Returns as an array. */ asArray(): number[]; /** * Setter from an array. */ fromArray(vals: Float32Array | number[]): void; /** * Converts this Vec3 to a string in JSON format. * * @return - The return value. */ toString(): string; /** * Encodes Vec2 Class as a JSON object for persistence. * * @return - The json object. */ toJSON(): Record; /** * Decodes a JSON object to set the state of this class. * * @param j - The json object. */ fromJSON(j: Record): void; /** * Loads the state of the value from a binary reader. * * @param reader - The reader value. */ readBinary(reader: BinReader): void; /** * Calculate the intersection point of 2 2d lines, returning the parameters values for each line. * * @param p0 - The point of the first line * @param d0 - The direction of the first line * @param p1 - The point of the second line * @param d1 - The direction of the second line * @return - Returns an array containing 2 parameter values for the 2 lines. */ static intersectionOfLines(p1: Vec2, p2: Vec2, p3: Vec2, p4: Vec2): Vec2 | null; isValid(): boolean; } /** * Represents a three dimensional coordinate, such as 3D scene values, or mesh vertex positions. */ declare class Vec3 { x: number; y: number; z: number; /** * Creates a Vec3. */ constructor(x?: number, y?: number, z?: number); /** * Getter for `xy` swizzel. * * @return - Returns the xy components as a Vec2. */ get xy(): Vec2; /** * Getter for `yz` swizzel. * * @return - Returns the yz components as a Vec2. */ get yz(): Vec2; /** * Setter from scalar components. * * @param x - The x component. * @param y - The y component. * @param z - The y component. */ set(x: number, y: number, z: number): void; /** * Sets the state of a Vec3 Object from another Vec3. * * @param other - The other Vec3 to set from. */ setFromOther(other: Vec3): void; /** * Checks if the coordinates of this Vec3 are 0 0 0. * * @return - Returns `true` if the coordinates are(0, 0, 0), otherwise, `false`. */ isNull(): boolean; /** * Checks if the coordinates of this Vec3 are 1 1 1. * * @return - Returns `true` if the coordinates are(1, 1, 1), otherwise, `false`. */ is111(): boolean; /** * Checks if this Vec3 contains the same values as the other Vec3. * * @param other - The other Vec3 to compare with. * @return - Returns `true` if the values are the same, otherwise, `false`. */ isEqual(other: Vec3): boolean; /** * Checks if this Vec2 is different from another Vec2. * * @param other - The other Vec3 to compare with. * @return - Returns `true` if the Vec3s are different, otherwise, `false`. */ notEqual(other: Vec3): boolean; /** * Returns true if this Vec2 is approximately the same as other. * * @param other - The other Vec3 to compare with. * @param precision - The precision to which the values must match. * @return - Returns true or false. */ approxEqual(other: Vec3, precision?: number): boolean; /** * Adds other to this Vec3 and return the result as a new Vec3. * * @param other - The other Vec3 to add. * @return - Returns a new Vec3. */ add(other: Vec3): Vec3; /** * Adds other to this Vec3. * * @param other - The other Vec3 to add. */ addInPlace(other: Vec3): void; /** * Subtracts other from this Vec3 and returns the result as a new Vec3. * * @param other - The other Vec3 to subtract. * @return - Returns a new Vec3. */ subtract(other: Vec3): Vec3; /** * Subtracts other from this Vec3. * * @param other - The other Vec3 to subtract. */ subtractInPlace(other: Vec3): void; /** * Multiplies two Vec3s and returns the result as a new Vec3. * * @param other - The other Vec3 to multiply with. * @return - Returns a new Vec3. */ multiply(other: Vec3): Vec3; /** * Multiplies two Vec3s. * * @param other - The other Vec3 to multiply with. */ multiplyInPlace(other: Vec3): void; /** * Divides two Vec3s and returns the result as a new Vec3. * * @param vec3 - The other Vec3 to divide by. * @return - Returns a new Vec3. */ divide(vec3: Vec3): Vec3; /** * Divides two Vec3s. * * @param vec3 - The other Vec3 to divide by. */ divideInPlace(vec3: Vec3): void; /** * Scales this Vec3 by scalar and returns the result as a new Vec3. * * @param scalar - The scalar value. * @return - Returns a new Vec3. */ scale(scalar: number): Vec3; /** * Scales this Vec3 by scalar. * * @param scalar - The scalar value. */ scaleInPlace(scalar: number): void; /** * Negates this Vec3 (x = -x, y = -y and z = -z), but returns the result as a new Vec3. * * @return - Returns a new Vec3. */ negate(): Vec3; /** * Returns the inverse of this Vec3, but returns. the result as a new Vec3 * * @return - Returns a new Vec3. */ inverse(): Vec3; /** * Calculates the squared length of this Vec3. * * @return - Returns the length. */ lengthSquared(): number; /** * Calculates the length of this Vec3. * * @return - Returns the length. */ length(): number; /** * Calculates the distance to another Vec3. * * @param other - The other Vec3 to calculate the distance to. * @return - Returns the distance between vectors. */ distanceTo(other: Vec3): number; /** * Normalizes the Vec3 and returns it as a new Vec3. * Multiplies coordinates value by the inverse of the vector length. * * @return - Returns the Vec3 normalized. */ normalize(): Vec3; /** * Normalizes this Vec3 multiplying coordinate values by the inverse of the vector length. * * @return - The return value. */ normalizeInPlace(): number | void; /** * Creates and returns a new Vec3 with the new coordinates(calculated with this Vec3 coordinates and the specified length). * * @param length - The length value. * @return - The return value. */ resize(length: number): Vec3 | void; /** * Modifies current coordinates using the specified length. * * @param length - The length value. */ resizeInPlace(length: number): void; /** * Calculates the dot product of this Vec3 against another Vec3. * * @param other - The other Vec3 to compare with. * @return - Returns the dot product. */ dot(other: Vec3): number; /** * Calculates the cross product of two Vec3s and returns the result as a new Vec3. * * @param other - The other Vec3 to calculate with. * @return - Returns the cross product as a new Vec3. */ cross(other: Vec3): Vec3; /** * Gets the angle between this Vec3 and b. * * @param other - The other Vec3 to compare with. * @return - Returns the angle in radians. */ angleTo(other: Vec3): number; /** * Performs a linear interpolation between this Vec3 and other. * * @param other - The other Vec3 to interpolate towards. * @param t - Interpolation ratio. * @return - Returns a new Vec3. */ lerp(other: Vec3, t: number): Vec3; /** * Returns a new Vec3 whose component values are the abs of this Vec3s component values. * * @return - Returns a new Vec3. */ abs(): Vec3; /** * Sets the vector a random vector on the surface of a sphere with the radius of the given scale value. * * @param scale - The radius of the surface sphere. * @return - The random Vec3. */ setRandomDir(scale?: number): Vec3; /** * Generates a random vector anywhere in the sphere defined by the provided scale value. * * @param scale - The radius of the bounding sphere. * @return - The random Vec3. */ setRandom(scale?: number): Vec3; /** * Clones this Vec3 and returns a new Vec3. * * @return - Returns a new Vec3. */ clone(): Vec3; /** * Returns the type as an array. Often used to pass types to the GPU. * * @return - Returns as an array. */ asArray(): number[]; /** * Setter from an array. */ fromArray(vals: Float32Array | number[]): void; /** * Converts this Vec3 to a string in JSON format. * * @return - The return value. */ toString(): string; /** * Encodes Vec3 Class as a JSON object for persistence. * * @return - The json object. */ toJSON(): Record; /** * Decodes a JSON object to set the state of this class. * * @param j - The json object. */ fromJSON(j: Record): void; /** * Loads the state of the value from a binary reader. * * @param reader - The reader value. */ readBinary(reader: BinReader): void; isValid(): boolean; } /** * Represents a four-dimensional coordinate. * Math types internally store values in {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array|Float32Array} and * expose getters and setters for the component values. * */ declare class Vec4 { x: number; y: number; z: number; w: number; /** * Creates a Vec4. * */ constructor(x?: number, y?: number, z?: number, w?: number); /** * Getter for `xyz` swizzel. * * @return - Returns the z value. */ get xyz(): Vec3; /** * Setter from scalar components. * * @param x - The x value. * @param y - The y value. * @param z - The y value. * @param w - The w value. */ set(x: number, y: number, z: number, w: number): void; /** * Sets the state of a Vec4 Object from another Vec4. * * @param other - The other Vec4 to set from. */ setFromOther(other: Vec4): void; /** * Checks if this Vec4 contains the same values as the other Vec4. * * @param other - The other Vec4 to compare with. * @return - Returns true or false. */ isEqual(other: Vec4): boolean; /** * Checks if this Vec4 is different from another Vec4. * * @param other - The other Vec4 to compare with. * @return - Returns true or false. */ notEqual(other: Vec4): boolean; /** * Returns true if this Vec4 is approximately the same as other. * * @param other - The other Vec4 to compare with. * @param precision - The precision to which the values must match. * @return - The return value. */ approxEqual(other: Vec4, precision?: number): boolean; /** * Adds other to this Vec4 and returns the result as a new Vec4. * * @param other - The other Vec4 to add. * @return - Returns a new Vec4. */ add(other: Vec4): Vec4; /** * Adds other to this Vec4 mutating the values of this instance * * @param other - The other Vec4 to add. */ addInPlace(other: Vec4): void; /** * Subtracts other from this Vec4 and returns then result as a new Vec4. * * @param other - The other Vec4 to subtract. * @return - Returns a new Vec4. */ subtract(other: Vec4): Vec4; /** * Subtracts other from this Vec4 mutating the values of this instance * * @param other - The other Vec4 to subtract. */ subtractInPlace(other: Vec4): void; /** * Multiplies two Vec4s and returns the result as a new Vec4. * * @param other - The other Vec4 to multiply with. * @return - Returns a new Vec4. */ multiply(other: Vec4): Vec4; /** * Multiplies two Vec4s mutating the values of this instance * * @param other - The other Vec4 to multiply with. */ multiplyInPlace(other: Vec4): void; /** * Divides two Vec4s and returns the result as a new Vec4. * * @param other - The other Vec4 to divide by. * @return - Returns a new Vec4. */ divide(other: Vec4): Vec4; /** * Divides two Vec4s. * * @param other - The other Vec4 to divide by. */ divideInPlace(other: Vec4): void; /** * Scales this Vec4 by scalar and returns the result as a new Vec4. * * @param scalar - The scalar value. * @return - The return value. */ scale(scalar: number): Vec4; /** * Scales this Vec4 by scalar. * * @param scalar - The scalar value. */ scaleInPlace(scalar: number): void; /** * Calculates the length of this Vec4. * * @return - Returns the length. */ length(): number; /** * Calculates the squared length of this Vec4. * * @return - Returns the length. */ lengthSquared(): number; /** * Normalizes the Vec4 and returns it as a new Vec4. * Multiplies coordinates value by the inverse of the vector length. * * @return - Returns the Vec4 normalized. */ normalize(): Vec4; /** * Normalizes this Vec4 multiplying coordinate values by the inverse of the vector length. */ normalizeInPlace(): void; /** * Calculates the dot product of this Vec4 against another Vec4. * * @param other - The other Vec4 to compare with. * @return - Returns the dot product. */ dot(other: Vec4): number; /** * Calculates the cross product of two Vec4s and returns the result as a new Vec4. * * @param other - The other Vec4 to calculate with. * @return - Returns the cross product as a new Vec4. */ cross(other: Vec4): Vec4; /** * Gets the angle between this Vec4 and b. * * @param other - The other Vec4 to compare with. * @return - Returns the angle in radians. */ angleTo(other: Vec4): number; /** * Performs a linear interpolation between this Vec4 and other. * * @param other - The other Vec4 to interpolate between. * @param w - Interpolation amount between the two inputs. * @return - Returns a new Vec4. */ lerp(other: Vec4, t: number): Vec4; /** * Generates a random vector with the given scale. * * @param scale - Length of the resulting vector. If omitted, a unit vector will be returned. * @return - The return value. */ /** * Clones this Vec4 and returns a new Vec4. * * @return - Returns a new Vec4. */ clone(): Vec4; /** * Converts this Vec4 into a Vec3. * * @return - Returns the value as a new Vec3. */ toVec3(): Vec3; /** * Returns the type as an array. Often used to pass types to the GPU. * * @return - Returns as an array. */ asArray(): number[]; /** * Setter from an array. */ fromArray(vals: Float32Array | number[]): void; /** * Converts this Vec3 to a string in JSON format. * * @return - The return value. */ toString(): string; /** * The toJSON method encodes this type as a json object for persistence. * @return - The json object. */ toJSON(): Record; /** * Decodes a JSON object to set the state of this class. * * @param j - The json object. */ fromJSON(j: Record): void; /** * Loads the state of the value from a binary reader. * * @param reader - The reader value. */ readBinary(reader: BinReader): void; /** * Verifies if the values stored in this Math type are valid numeric values. * Returns `false` If at least one of the values is either {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Referencia/Objetos_globales/Infinity|Infinity} or * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Referencia/Objetos_globales/NaN|NaN}. * * @return - Returns the result as a boolean. */ isValid(): boolean; } /** * Class representing the red, green, blue and alpha channel of a color as 8bit values. * */ declare class RGBA { r: number; g: number; b: number; a: number; /** * Create a RGBA. * @param r - The red channel of a color. * @param g - The green channel of a color. * @param b - The blue channel of a color. * @param a - The alpha (transparency) channel of a color. */ constructor(r?: number | string, g?: number, b?: number, a?: number); /** * Setter from scalar components. * * @param r - The red channel. * @param g - The green channel. * @param b - The blue channel. * @param a - The alpha channel. */ set(r: number, g: number, b: number, a?: number): void; /** * Setter from another RGBA color. * * @param other - The other RGBA to set from. */ setFromOther(other: RGBA): void; /** * Setter from a scalar array. * * @param values - The array of values. */ setFromArray(values: number[]): void; /** * Setter from a hexadecimal value. * E.g. #ff0000 * * @param hex - The hex value. */ setFromHex(hex: string): void; /** * Setter from a CSS color name. * E.g. "red" * * @param name - The CSS color name. */ setFromCSSColorName(name: string): void; /** * Returns the hexadecimal value of this RGBA color. * * @return - Returns the hex value. */ toHex(): string; /** * Returns true if this RGBA color is exactly the same as other. * * @param other - The other RGBA to compare with. * @return - Returns true or false. */ equal(other: RGBA): boolean; /** * Returns true if this RGBA color is NOT exactly the same as other. * * @param other - The other RGBA to compare with. * @return - Returns true or false. */ notEquals(other: RGBA): boolean; /** * Returns true if this RGBA color is approximately the same as other. * * @param other - The other RGBA to compare with. * @param precision - The precision to which the values must match. * @return - Returns true or false. */ approxEqual(other: RGBA, precision?: number): boolean; /** * Returns a new RGBA color which is this RGBA color added to other. * * @param other - The other RGBA to add. * @return - Returns a new RGBA. */ add(other: RGBA): RGBA; /** * Returns a new RGBA color which is this RGBA color subtracted from other. * * @param other - The other RGBA to subtract. * @return - Returns a new RGBA. */ subtract(other: RGBA): RGBA; /** * Returns a new RGBA color which is this vector scaled by scalar. * * @param scalar - The scalar value. * @return - Returns a new RGBA. */ scale(scalar: number): RGBA; /** * Scales this RGBA color by scalar. * * @param scalar - The scalar value. */ scaleInPlace(scalar: number): void; /** * Apply gamma correction to this RGBA color. * * @param gamma - The gamma value. */ applyGamma(gamma: number): void; /** * Converts to linear color space and returns a new color. * @param gamma - The gamma value. * @return - Returns a new RGBA. */ toLinear(gamma?: number): RGBA; /** * Converts to gamma color space and returns a new RGBA color. * * @param gamma - The gamma value. * @return - Returns a new RGBA. */ toGamma(gamma?: number): RGBA; /** * Calculates and returns the relative luminance of the linear RGB component. * * @return - The return value. */ luminance(): number; /** * Performs a linear interpolation between this RGBA color and other. * * @param other - The other RGBA to interpolate between. * @param t - Interpolation amount between the two inputs. * @return - Returns a new RGBA. */ lerp(other: RGBA, t: number): RGBA; /** * Creates a random RGBA. * * @param gammaOffset - The gamma offset. * @param randomAlpha - Determines whether the alpha channel is random. * @return - Returns a new random RGBA. */ static random(gammaOffset?: number, randomAlpha?: boolean): RGBA; /** * Clones this RGBA color and returns a new RGBA color. * * @return - Returns a new RGBA. */ clone(): RGBA; /** * Returns the type as an array. Often used to pass types to the GPU. * * @return - Returns as an array. */ asArray(): number[]; /** * The toJSON method encodes this type as a json object for persistence. * * @return - The json object. */ toJSON(): Record; /** * The fromJSON method decodes a json object for this type. * * @param j - The json object. */ fromJSON(j: Record): void; /** * Returns the CSS rgba string. * * @return - The return value. */ toCSSString(): string; } /** * Class representing a color as 4 floating point values. */ declare class Color { r: number; g: number; b: number; a: number; /** * Creates a `Color` object with an RGBA structure. * * @param r - The red channel of a color. * @param g - The green channel of a color. * @param b - The blue channel of a color. * @param a - The alpha (transparency) channel of a color. */ constructor(r?: number | string, g?: number, b?: number, a?: number); /** * Setter from scalar components. * * @param r - The red channel. * @param g - The green channel. * @param b - The blue channel. * @param a - The alpha channel. */ set(r: number, g: number, b: number, a?: number): void; /** * Sets current color state with another `Color` object. * * @param other - The other color to set from. */ setFromOther(other: Color): void; /** * Getter from an RGB array. * * @return - The return value. */ getAsRGBArray(): number[]; /** * Getter from an RGB dict. * * @return - The return value. */ getAsRGBDict(): Record; /** * Setter from a RGB value. * * @param r - The red channel. * @param g - The green channel. * @param b - The blue channel. * @param a - The alpha channel. */ setFromRGB(r: number, g: number, b: number, a?: number): void; /** * Setter from an RGB dict. * * @param vals - The vals param. */ setFromRGBDict(vals: Record): void; /** * Setter from a hexadecimal value. * E.g. #ff0000 * @param hex - The hex value. */ setFromHex(hex: string): void; /** * Sets the Color values from a CSS color name. * E.g. "red" * @param name - The CSS color name. */ setFromCSSColorName(name: string): void; /** * Returns the hexadecimal value of this color, including the leading "#" character. * * @return - Returns the hex value. */ toHex(): string; /** * Checks if this Color contains the same values as the other. * * @param other - The other Color to compare with. * @return - Returns `true` if the values are the same, otherwise, `false`. */ isEqual(other: Color): boolean; /** * Returns true if this color is NOT exactly the same as other. * * @param other - The other color to compare with. * @return - Returns true or false. */ notEquals(other: Color): boolean; /** * Returns true if this color is approximately the same as other. * * @param other - The other color to compare with. * @param precision - The precision to which the values must match. * @return - Returns true or false. */ approxEqual(other: Color, precision?: number): boolean; /** * Returns a new Color which is this Color added to other. * * @param other - The other color to add. * @return - Returns a new color. */ add(other: Color): Color; /** * Updates this Color by adding the values from the other color. * * @param other - The other color to add. */ addInPlace(other: Color): void; /** * Returns a new color which is this color subtracted from other. * * @param other - The other color to subtract. * @return - Returns a new color. */ subtract(other: Color): Color; /** * Scales this color by scalar and return the result as a new Vec4. * * @param scalar - The scalar value. * @return - Returns a new color. */ scale(scalar: number): Color; /** * Scales this color by scalar. * * @param scalar - The scalar value. */ scaleInPlace(scalar: number): void; /** * Apply gamma correction to this color * * @param gamma - The gamma value. */ applyGamma(gamma: number): void; /** * Converts to linear color space and returns a new color * * @param gamma - The gamma value. * @return - Returns a new color. */ toLinear(gamma?: number): Color; /** * returns a new color value value is mapped into a gamma curve * * @param gamma - The gamma value. * @return - Returns a new color. */ toGamma(gamma?: number): Color; /** * Calculates and returns the luminance of the linear RGB components. * * @return - The return value. */ luminance(): number; /** * Performs a linear interpolation between this color and other. * * @param other - The other color to interpolate between. * @param t - Interpolation amount between the two inputs. * @return - Returns a new color. */ lerp(other: Color, t: number): Color; /** * Creates a random color. * * @param gammaOffset - The gamma offset. Values between 0 and 1 increase the average brightness of the generated color. Values between 0 and -1 darken the generated color values. * @param randomAlpha - Determines whether the alpha channel is random. If not, the alpha values will be 1.0. * @return - The new random color. */ static random(gammaOffset?: number, randomAlpha?: boolean): Color; /** * Clones this color and returns a new color. * * @return - Returns a new color. */ clone(): Color; /** * Returns the type as an array. Often used to pass types to the GPU. * * @return - Returns as an array. */ asArray(): number[]; /** * Setter from an RGB array. * * @param vals - The vals param. */ fromArray(vals: Float32Array | number[]): void; /** * The toJSON method encodes this type as a json object for persistence. * * @return - The json object. */ toJSON(): Record; /** * The fromJSON method decodes a json object for this type. * * @param j - The json object. */ fromJSON(j: Record): void; /** * Loads the state of the value from a binary reader. * * @param reader - The reader value. */ readBinary(reader: BinReader): void; /** * Returns the CSS rgba string. * * @return - The return value. */ toCSSString(): string; /** * Converts this Vec3 to a string in JSON format. * * @return - The return value. */ toString(): string; } declare enum EulerAnglesAxisOrder { XYZ = 0, YZX = 1, ZXY = 2, XZY = 3, ZYX = 4, YXZ = 5 } /** * Class representing euler angles. Euler angles describe rotating an object * around its various axis in a specified axis order. * */ declare class EulerAngles { x: number; y: number; z: number; order: number; /** * Create a euler angle. Receives the xyz values in radians and the order that the rotations are applied. * * Order parameter values: `XYZ: 0`, `YZX: 1`, `ZXY: 2`, `XZY: 3`, `ZYX: 4`, `YXZ: 5` * * It could be either the `string` or the `number` value. * * @param x - The angle of the x axis in radians. Default is 0. * @param y - The angle of the y axis in radians. Default is 0. * @param z - The angle of the z axis in radians. Default is 0. * @param order - The order in which the rotations are applied. */ constructor(x?: number, y?: number, z?: number, order?: number | string); /** * Sets the EulerAngles * * @param x - The x axis rotation in radians. * @param y - The y axis rotation in radians. * @param z - The z axis rotation in radians. */ set(x: number, y: number, z: number): void; /** * Converts this Vec3 to a string in JSON format. * * @return - The return value. */ toString(): string; toJSON(): Record; fromJSON(json: Record): void; } /** * A class representing a 3x3 matrix. * This matrix class is based on GLM, and is column major. * */ declare class Mat3 { m00: number; m01: number; m02: number; m10: number; m11: number; m12: number; m20: number; m21: number; m22: number; /** * Initializes the Mat3 class with given data. * * @param m00 - Row 0, column 0. * @param m01 - Row 0, column 1. * @param m02 - Row 0, column 2. * @param m10 - Row 1, column 0. * @param m11 - Row 1, column 1. * @param m12 - Row 1, column 2. * @param m20 - Row 2, column 0. * @param m21 - Row 2, column 1. * @param m22 - Row 2, column 2. */ constructor(m00?: number | Vec3 | Float32Array, m01?: number | Vec3, m02?: number | Vec3, m10?: number, m11?: number, m12?: number, m20?: number, m21?: number, m22?: number); /** * Getter for the `x` axis. * * @return - Returns the `x` axis as a Vec3. */ get xAxis(): Vec3; /** * Setter for the `x` axis. * * @param vec3 - The vec3 value. */ set xAxis(vec3: Vec3); /** * Getter for the `y` axis. * * @return - Returns the `y` axis as a Vec3. */ get yAxis(): Vec3; /** * Setter for the `y` axis. * @param vec3 - The vec3 value. */ set yAxis(vec3: Vec3); /** * Getter for the `z` axis. * * @return - Returns the `z` axis as a Vec3. */ get zAxis(): Vec3; /** * Setter for the `z` axis. * @param vec3 - The vec3 value. */ set zAxis(vec3: Vec3); /** * Sets the state of the Mat3 class * * @param m00 - Row 0, column 0. * @param m01 - Row 0, column 1. * @param m02 - Row 0, column 2. * @param m10 - Row 1, column 0. * @param m11 - Row 1, column 1. * @param m12 - Row 1, column 2. * @param m20 - Row 2, column 0. * @param m21 - Row 2, column 1. * @param m22 - Row 2, column 2. */ set(m00?: number, m01?: number, m02?: number, m10?: number, m11?: number, m12?: number, m20?: number, m21?: number, m22?: number): void; /** * Sets state of the Mat3 with the identity Matrix */ setIdentity(): void; /** * Sets state of the Mat3 from another Mat3 * * Note: works with either Mat3 or Mat4. * * @param mat - The mat value. */ setFromMat(mat: Mat3): void; /** * Scales and calculates the cross product of the `Vec3` and sets the result in the Mat3 * Note: the resulting matrix +Z axis is aligned with the provided direction value. * * @param dir - The dir value. * @param up - The up value. */ setFromDirectionAndUpvector(dir: Vec3, up: Vec3): void; /** * Inverts a Mat3 and returns the result as a new instance. * * @return - Returns a new Mat3. */ inverse(): Mat3; /** * Inverts a Mat3 in place modifying its values. * * @return - The return value. */ invertInPlace(): boolean; /** * Transposes (exchanges columns with rows) this matrix * and returns the result as a new instance. * * @return - Return a new transposed Mat3. */ transpose(): Mat3; /** * Transposes (exchanges columns with rows) this matrix modifying its values. */ transposeInPlace(): void; /** * Transforms the Vec3 with a Mat3. * * @param vec3 - The vec3 value. * @return - Return the result as a new Vec3. */ transformVec3(vec3: Vec3): Vec3; /** * Clones this Mat3 returning a new instance. * * @return - Returns a new Mat3. */ clone(): Mat3; /** * Loads the state of the value from a binary reader. * * @param reader - The reader value. */ readBinary(reader: BinReader): void; /** * The toJSON method encodes this type as a json object for persistence. */ toJSON(): number[]; /** * The fromJSON method decodes a json object for this type. * * @param json - The json param. */ fromJSON(json: number[]): void; /** * Converts this Vec3 to a string in JSON format. * * @return - The return value. */ toString(): string; /** * Returns current Math type data as array. Often used to pass types to the GPU. * * @return - Returns the result as an array. */ asArray(): number[]; fromArray(array: number[] | Float32Array): void; } /** * A class representing a 4x4 matrix. * This matrix class is based on GLM, and is column major. * */ declare class Mat4 { m00: number; m01: number; m02: number; m03: number; m10: number; m11: number; m12: number; m13: number; m20: number; m21: number; m22: number; m23: number; m30: number; m31: number; m32: number; m33: number; constructor(m00?: number, m01?: number, m02?: number, m03?: number, m10?: number, m11?: number, m12?: number, m13?: number, m20?: number, m21?: number, m22?: number, m23?: number, m30?: number, m31?: number, m32?: number, m33?: number); /** * Getter for the `x` axis. * * @return - Returns the `x` axis as a Vec3. */ get xAxis(): Vec3; /** * Setter for the `x` axis. * * @param vec3 - The vec3 value. */ set xAxis(vec3: Vec3); /** * Getter for the `y` axis. * * @return - Returns the `y` axis as a Vec3. */ get yAxis(): Vec3; /** * Setter for the `y` axis. * * @param vec3 - The vec3 value. */ set yAxis(vec3: Vec3); /** * Getter for the `z` axis. * * @return - Returns the `z` axis as a Vec3. */ get zAxis(): Vec3; /** * Setter for the `z` axis. * * @param vec3 - The vec3 value. */ set zAxis(vec3: Vec3); /** * Getter for the translation of the matrix. Assumes the translation values are 12, 13, & 14. * * @return - Returns the translation. */ get translation(): Vec3; /** * Setter for the translation of the matrix. Assumes the translation values are 12, 13, & 14. * * @param vec3 - The translation. */ set translation(vec3: Vec3); /** * Sets the state of the Mat4 class * * @param m00 - Row 0, column 0. * @param m01 - Row 0, column 1. * @param m02 - Row 0, column 2. * @param m03 - Row 0, column 3. * @param m10 - Row 1, column 0. * @param m11 - Row 1, column 1. * @param m12 - Row 1, column 2. * @param m13 - Row 1, column 3. * @param m20 - Row 2, column 0. * @param m21 - Row 2, column 1. * @param m22 - Row 2, column 2. * @param m23 - Row 2, column 3. * @param m30 - Row 3, column 0. * @param m31 - Row 3, column 1. * @param m32 - Row 3, column 2. * @param m33 - Row 3, column 3. */ set(m00?: number, m01?: number, m02?: number, m03?: number, m10?: number, m11?: number, m12?: number, m13?: number, m20?: number, m21?: number, m22?: number, m23?: number, m30?: number, m31?: number, m32?: number, m33?: number): void; /** * Sets state of the Mat4 with the identity Matrix */ setIdentity(): void; /** * Sets state of the Mat4 from another Mat4 * * Note: works with either Mat3 or Mat4. * * @param mat4 - The mat4 value. */ setFromMat4(mat4: Mat4): void; /** * Converts a Mat4 to a Mat3. * * @return - Returns a new Mat3. */ toMat3(): Mat3; /** * Transposes (exchanges columns with rows) this matrix. */ transposeInPlace(): void; /** * Transposes (exchanges columns with rows) this matrix * and returns the result as a new instance. * * @return - Return a new transposed Mat4. */ transpose(): Mat4; /** * Inverts a Mat4 and returns the result as a new instance. * * @return - Returns a new Mat4. */ inverse(): Mat4; /** * Inverts a Mat4. * * @return - The return value. */ invertInPlace(): boolean; /** * Sets this matrix as the inverse of the given Mat4. * * @param mat4 - The mat4 value. * @return - In case the `determinant` can't be calculated, a `null` will be returned, otherwise, nothing is returned */ setInverse(mat4: Mat4): void; /** * Multiplies two Mat4s and returns the result as a new instance. * * @param other - The other Mat4 to multiply with. * @return - Returns a new Mat4. */ multiply(other: Mat4): Mat4; /** * Multiplies two Mat4s in place explicitly not using SIMD. * * @param other - The other Mat4 to multiply with. * @return - Returns a new Mat4. */ multiplyInPlace(other: Mat4): Mat4; /** * Post multiplies two Mat4s in place explicitly not using SIMD. * * @param other - The other Mat4 to multiply with. * @return - Returns the result as a new Mat4. */ postMultiplyInPlace(other: Mat4): Mat4; /** * Translate a Mat4 by the given vector not using SIMD. * * @param v3 - The given vector to translate along. * @return - The return value. */ translateInPlace(v3: Vec3): Mat4; /** * Generates a look-at matrix with the given position, focal point, and up axis. * * @param pos - Position of the viewer. * @param target - Point the viewer is looking at. * @param up - Vec3 pointing up. */ setLookAt(pos: Vec3, target: Vec3, up: Vec3): void; /** * Creates a matrix from a given angle around a given axis. * This is equivalent to (but much faster than): * * mat4.identity(dest); * mat4.rotate(dest, dest, rad, axis); * * @param axis - The axis to rotate around. * @param rad - The angle to rotate the matrix by. * @return - The return value. */ setRotation(axis: Vec3, rad: number): Mat4 | null; /** * Creates a matrix from the given angle around the X axis. * This is equivalent to (but much faster than): * * mat4.identity(dest); * mat4.rotateX(dest, dest, rad); * * @param rad - The angle to rotate the matrix by. * @return - The return value. */ setXRotation(rad: number): Mat4; /** * Creates a matrix from the given angle around the Y axis. * This is equivalent to (but much faster than): * * mat4.identity(dest); * mat4.rotateY(dest, dest, rad); * * @param rad - The angle to rotate the matrix by. * @return - The return value. */ setYRotation(rad: number): Mat4; /** * Creates a matrix from the given angle around the Z axis. * This is equivalent to (but much faster than): * * mat4.identity(dest); * mat4.rotateZ(dest, dest, rad); * * @param rad - The angle to rotate the matrix by. * @return - The return value. */ setZRotation(rad: number): Mat4; /** * Transforms the Vec4 with a Mat4. * * @param vec - The vec value. * @return - Return the result as a new Vec4. */ transformVec4(vec: Vec4): Vec4; /** * Transforms the Vec3 with a Mat4. * * @param vec - The vec value. * @return - Return the result as a new Vec3. */ transformVec3(vec: Vec3): Vec3; /** * Rotates a given `Vec3` and the result is returned as a new `Vec3`, applying only the top left components of the matrix, so not applying any translation. * @param vec - The vec value. * @return - Return the result as a new Vec3. */ rotateVec3(vec: Vec3): Vec3; /** * Set the perspective from a Mat4. * * @param fovY - The fovY value. * @param aspect - The aspect value. * @param near - The near value. * @param far - The far value. */ setPerspectiveMatrix(fovy: number, aspect: number, near: number, far: number): void; /** * Calculates the orthographic matrix and sets the state of the Mat4 class * * @param left - The left value. * @param right - The right value. * @param bottom - The bottom value. * @param top - The top value. * @param near - The near value. * @param far - The far value. */ setOrthographicMatrix(left: number, right: number, bottom: number, top: number, near: number, far: number): void; /** * Set the Matrix to be a scale matrix. * * @param x - The x value. * @param y - The y value. * @param z - The z value. */ setScale(x: number | Vec3, y: number, z: number): void; /** * Transforms a 3x4 matrix into a 4x4 matrix and set the result to the Math4 state. * * @param m3x4 - The m3x4 value. */ setFromMat3x4Array(m3x4: number[]): void; /** * Clones this Mat4 returning a new instance. * * @return - Returns a new Mat4. */ clone(): Mat4; /** * Converts this Vec3 to a string in JSON format. * * @return - The return value. */ toString(): string; /** * The toJSON method encodes this type as a json object for persistence. * */ toJSON(): number[]; /** * The fromJSON method decodes a json object for this type. * */ fromJSON(json: number[]): void; /** * Loads the state of the value from a binary reader. * * @param reader - The reader value. */ readBinary(reader: BinReader): void; /** * Returns current Math type data as array. Often used to pass types to the GPU. * * @return - Returns the result as an array. */ asArray(): number[]; fromArray(array: number[] | Float32Array): void; } /** * Class representing a quaternion. Quaternions are used to represent 3 dimensional rotations. * * While Quaternions are difficult to understand they have important mathematical properties that make them very useful in 3d engines. * They can be directly multiplied together in the same was as matrices. * They can be interpolated from one value to another while maintaining constant angular velocity. * They can be converted to other more easily understood representations such as EulerAngles or Matrices. * */ declare class Quat { x: number; y: number; z: number; w: number; /** * Creates a quaternion. */ constructor(x?: number, y?: number, z?: number, w?: number); /** * Setter from scalar components. * * @param x - The x axis rotation. * @param y - The y axis rotation. * @param z - The z axis rotation. * @param w - The w value. */ set(x: number, y: number, z: number, w: number): void; /** * Setter from another vector. * * @param other - The other vector to set from. */ setFromOther(other: Quat): void; /** * Set this Quat from a euler rotation. * * @param eulerAngles - The euler angles rotation. */ setFromEulerAngles(eulerAngles: EulerAngles): void; /** * Converts Quat to an EulerAngles * * @param rotationOrder - The order in which the rotations are applied. * @return - The return value. */ toEulerAngles(rotationOrder: number | string): EulerAngles; /** * Set this Quat to a rotation defined by an axis and an angle (in radians). * * @param axis - The axis around which to rotate. * @param angle - The angle to rotate */ setFromAxisAndAngle(axis: Vec3, angle: number): void; /** * Sets the state of the Quat to look in a particular direction along the z axis. * > The camera looks down the negative z axis, so to set a rotation value * > for the camera, remember to negate the direction vector. * * @param dir - The direction value. * @param up - The up vector. */ setFromDirectionAndUpvector(dir: Vec3, up: Vec3): void; /** * Sets the state of the `Quat` from two `Vec3`. The quaternion would then represent the rotation from v0 to v1 in 3d space. * * @param v0 - The v0 unit vector. * @param v1 - The v1 unit vector. */ setFrom2Vectors(v0: Vec3, v1: Vec3): void; /** * Set the Quat from a Mat3. * * @param mat3 - The mat3 value. */ setFromMat3(mat3: Mat3): void; /** * Set the Quat from a Mat4. * * @param mat4 - The mat4 value. */ setFromMat4(mat4: Mat4): void; /** * Checks if the angle of the Quat is less that ` Number.EPSILON` * * @return - Returns true or false. */ isIdentity(): boolean; /** * Return the angle of the Quat. * * @return - The return value. */ getAngle(): number; /** * Checks if this Quat contains the same values as the other Quat. * * @param other - The other Quat to compare with. * @return - Returns `true` if are the same Vector, otherwise, `false`. */ isEqual(other: Quat): boolean; /** * Returns true if this Quat is NOT exactly the same other. * * @param other - The other Quat to compare with. * @return - Returns true or false. */ notEquals(other: Quat): boolean; /** * Returns true if this Quat is approximately the same as other * * @param other - The other Quat to compare with. * @param precision - The precision to which the values must match. * @return - Returns true or false. */ approxEqual(other: Quat, precision?: number): boolean; /** * Adds other to this Quat and return the result as a new Quat. * * @param other - The other Quat to add. * @return - Returns a new Quat. */ add(other: Quat): Quat; /** * Adds other to this Quat. * * @param other - The other Quat to add. */ addInPlace(other: Quat): void; /** * Subtracts other from this Quat and returns the result as a new Quat. * * @param other - The other Quat to subtract. * @return - Returns a new Quat. */ subtract(other: Quat): Quat; /** * Scales this Quat by scalar and returns the result as a new Quat. * * @param scalar - The scalar value. * @return - Returns a new Vec3. */ scale(scalar: number): Quat; /** * Scales this Quat by scalar. * * @param scalar - The scalar value. */ scaleInPlace(scalar: number): void; /** * Calculates the length of this Quat. * * @return - Returns the length. */ length(): number; /** * Calculates the squared length of this Quat. * * @return - Returns the length. */ lengthSquared(): number; /** * Normalizes the Quat and returns it as a new Quat. * * @return - Returns the Quat normalized. */ normalize(): Quat; /** * Normalizes the Quat, modifying its values in place. */ normalizeInPlace(): void; /** * Calculates the dot product of this quat against another. * * @param other - The other Quat to compare with. * @return - Returns the dot product. */ dot(other: Quat): number; /** * Calculates the cross product of two Quats and returns the result as a new Quat. * * @param other - The other Quat to calculate with. * @return - Returns the cross product as a new Quat. */ cross(other: Quat): Quat; /** * Returns the rotational conjugate of this Quat. * Conjugation represents the same rotation of the Quat but * in the opposite direction around the rotational axis. * * @return - the return value. */ conjugate(): Quat; /** * Return the inverse of the `Quat` * * @return - Returns a new Quat. */ inverse(): Quat; /** * Aligns this quaternion with another one ensuring that the delta between * the Quat values is the shortest path over the hyper-sphere. * * @param other - The other Quat to divide by. */ alignWith(other: Quat): void; /** * Multiplies two this quat by another returning the result as a new Quat. * * @param other - The other Quat to multiply. * @return - Returns a new Quat. */ multiply(other: Quat): Quat; /** * Multiplies this quat by another, modifying its values in place. * * @param other - The other Quat to multiply. */ multiplyInPlace(other: Quat): void; /** * Rotates a vector by this quaternion. * Don't forget to normalize the quaternion unless * you want axial translation as well as rotation. * * @param vec3 - The vec3 value. * @return - Returns a new Vec3. */ rotateVec3(vec3: Vec3): Vec3; /** * Sets this quaternion to a rotation by the given angle about the X axis. * * @param rad - Angle (in radians) to rotate. */ rotateX(rad: number): void; /** * Sets this quaternion to a rotation by the given angle about the Y axis. * * @param rad - Angle (in radians) to rotate. */ rotateY(rad: number): void; /** * Sets this quaternion to a rotation by the given angle about the Z axis. * * @param rad - Angle (in radians) to rotate. */ rotateZ(rad: number): void; /** * Converts this Quat to a Mat3 (a 3x3 matrix). * * @return - TReturns a new Mat3. */ toMat3(): Mat3; /** * Calculates a Vec3 value aligned with the X axis of this quaternion. * * @return - The resulting Vec3 value */ getXaxis(): Vec3; /** * Calculates a Vec3 value aligned with the Y axis of this quaternion. * * @return - The resulting Vec3 value */ getYaxis(): Vec3; /** * Calculates a Vec3 value aligned with the Z axis of this quaternion. * * @return - The resulting Vec3 value */ getZaxis(): Vec3; /** * Reflects this quaternion according to the axis provided. * * @param axisIndex - An integer with value of 0 for the X axis, 1 for the Y axis, and 2 for the Z axis. * @return - Returns a new Quat. */ mirror(axisIndex: number): Quat; /** * Converts this Quat to a Mat4 (a 4x4 matrix). * * @return - Returns a new Mat4. */ toMat4(): Mat4; /** * Performs a linear interpolation of this Quat towards another Quat, returning the result as a new Quat. * * @param other - The other Quat to interpolate towards. * @param t - Interpolation ratio. * @return - Returns a new Quat. */ lerp(other: Quat, t: number): Quat; /** * Performs a spherical linear interpolation of this Quat towards another Quat, returning the result as a new Quat. * * @param other - The other Quat to interpolate towards. * @param t - Interpolation amount between the two inputs. * @return - Returns a new Quat. */ slerp(other: Quat, lambda: number): Quat; /** * Clones this Quat and returns a new Quat. * * @return - Returns a new Quat. */ clone(): Quat; /** * Returns the type as an array. Often used to pass types to the GPU. * * @return - Returns as an array. */ asArray(): number[]; fromArray(array: number[]): void; /** * Converts this Vec3 to a string in JSON format. * * @return - The return value. */ toString(): string; /** * The toJSON method encodes this type as a json object for persistence. * * @return - The json object. */ toJSON(): Record; /** * The fromJSON method decodes a json object for this type. * * @param j - The json object. */ fromJSON(j: Record): void; /** * Loads the state of the value from a binary reader. * * @param reader - The reader value. */ readBinary(reader: BinReader): void; } /** * Class representing a mathematical sphere, as opposed to the Sphere class derived from ProceduralMesh. * */ declare class SphereType { pos: Vec3; radius: number; /** * Create a sphere. * @param pos - The position of the sphere. * @param radius - The radius of the sphere. */ constructor(pos?: Vec3, radius?: number); /** * Clones this sphere and returns a new sphere. * * @return - Returns a new sphere. */ clone(): SphereType; /** * Checks if this sphere intersects a box. * * @param box - The box value. * @return - The return value. */ intersectsBox(box: Box3): boolean; /** * The toJSON method encodes this type as a json object for persistence. * * @return - The json object. */ toJSON(): Record>; /** * Calls `toJSON` method and stringifies it. * * @return - The return value. */ toString(): string; } /** * Class representing an Xfo transform, which is a transformation decomposed into 3 component values. Translation, Orientation, and Scaling. */ declare class Xfo { tr: Vec3; ori: Quat; sc: Vec3; /** * Initializes the Xfo object. * * @param tr - The translation value. * @param ori - The orientation value. * @param sc - The scaling value. */ constructor(tr?: Vec3, ori?: Quat, sc?: Vec3); /** * Sets the state of the Xfo object. * * @param tr - The translation value. * @param ori - The orientation value. * @param sc - The scaling value. */ set(tr: Vec3, ori: Quat, sc?: Vec3): void; /** * Sets the state of the Xfo object using another Xfo object. * * @param other - The other Xfo to set from. */ setFromOther(other: Xfo): void; /** * Verifies that the Xfo object is an `identity`, checking that the translation, orientation and scaling attributes are in their initial state. * * @return - The return value. */ isIdentity(): boolean; /** * Checks if this Vec3 contains the same values as the other Vec3. * * @param other - The other Vec3 to compare with. * @return - Returns `true` if are the same Vector, otherwise, `false`. */ isEqual(other: Xfo): boolean; /** * Returns true if this Vec2 is approximately the same as other. * * @param other - The other Vec3 to compare with. * @param precision - The precision to which the values must match. * @return - Returns true or false. */ approxEqual(other: Xfo, precision?: number): boolean; /** * The setLookAt method. * @param pos - The position value. * @param target - The target value. * @param up - The up value. */ setLookAt(pos: Vec3, target: Vec3, up: Vec3): void; /** * Multiplies two Xfo transforms. * * @param xfo - The xfo to multiply with. * @return - Returns an Xfo. */ multiply(xfo: Xfo): Xfo; /** * Returns the inverse of the Xfo object, but returns. the result as a new Xfo. * * @return - Returns a new Xfo. */ inverse(): Xfo; /** * Transforms Xfo object using a `Vec3` object. First scaling it, then rotating and finally adding the result to current translation object. * * @param vec3 - The vec3 value. * @return - The return value. */ transformVec3(vec3: Vec3): Vec3; /** * Performs a linear interpolation between this Xfo and other. * * @param other - The other Xfo to interpolate towards. * @param t - Interpolation ratio. * @return - Returns a new Xfo. */ lerp(other: Xfo, t: number): Xfo; /** * Converts this Xfo to a Mat4 (a 4x4 matrix). * * @return - Returns a new Mat4. */ toMat4(): Mat4; /** * Sets the state of the Xfo object using Mat4. * @param mat4 - The mat4 value. */ setFromMat4(mat4: Mat4): void; /** * Clones this Xfo and returns a new Xfo. * * @return - Returns a new Xfo. */ clone(): Xfo; /** * The toJSON method encodes this type as a json object for persistence. * * @return - The json object. */ toJSON(): Record; /** * The fromJSON method decodes a json object for this type. * * @param j - The json object. */ fromJSON(j: Record): void; /** * Loads the state of the value from a binary reader. * * @param reader - The reader value. */ readBinary(reader: BinReader): void; /** * The fromJSON method decodes a json object for this type. * * @return - The return value. */ toString(): string; } /** * Class representing a plane. */ declare class PlaneType { normal: Vec3; w: number; /** * Create a plane. * * @param normal - The normal of the plane. * @param w - The w value. */ constructor(normal?: Vec3, w?: number); /** * Setter from scalar components. * * @param x - The x value. * @param y - The y value. * @param z - The z value. * @param w - The w value. */ set(x: number, y: number, z: number, w: number): void; /** * The divideScalar method * * @param value - The value value. */ divideScalar(value: number): void; /** * Calculates the distance from a point to this plane. * * @param point - The point value. * @return - The return value. */ distanceToPoint(point: Vec3): number; /** * Normalize this plane in place modifying its values. */ normalizeInPlace(): void; /** * Clones this plane and returns a new plane. * * @return - Returns a new plane. */ clone(): PlaneType; /** * The toJSON method encodes this type as a json object for persistence. * * @return - The json object. */ toJSON(): Record; fromJSON(json: Record): void; /** * Calls `toJSON` method and stringifies it. * * @return - The return value. */ toString(): string; } /** * Class representing a box in 3D space. * Represents a box in 3D space defined by two Vec3 values which define opposing corners of the box. */ declare class Box3 { p0: Vec3; p1: Vec3; /** * Creates a Box3 object using Vec3s. * In case the parameters are not passed by, their values are pre-defined: * * p0 is a Vec2 with {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY|`Number.POSITIVE_INFINITY`} * * p1 is a Vec2 with {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/NEGATIVE_INFINITY|`Number.NEGATIVE_INFINITY`} * * @param p0 - A point representing the corners of a 3D box. * @param p1 - A point representing the corners of a 3D box. */ constructor(p0?: Vec3, p1?: Vec3); /** * Getter for the lower (x, y, z) boundary of the box. * * @return - Returns the minimum Vec3. */ get min(): Vec3; /** * Getter for the upper (x, y, z) boundary of the box. * * @return - Returns the maximum Vec3. */ get max(): Vec3; /** * Sets both Vec3 points * * @param p0 - A point representing the corners of a 3D box. * @param p1 - A point representing the corners of a 3D box. */ set(p0: Vec3, p1: Vec3): void; /** * Resets the box3 back to an uninitialized state. */ reset(): void; /** * Returns `true` if the box has been expanded to contain a point. * * @return - The return value. */ isValid(): boolean; /** * Expands the Box3 to contain the new point. * * @param point - A point represents the corners of a 3D box. */ addPoint(point: Vec3): void; /** * Adds `Box3` to this `Box3`, of the Xfo instance is passed in the parameters * it proceeds to apply the transform for the Vec3. * * @param box3 - A 3D box. * @param xfo - A 3D transform. */ addBox3(box3: Box3, transform?: Xfo | Mat4): void; /** * Returns the length of the diagonal of the box. * * @return - Returns the distance. */ size(): number; /** * Returns the diagonal vector of the B=box from p0 to p1. * * @return - Returns a Box3. */ diagonal(): Vec3; /** * Returns the center point of a Box3. * * @return - Returns a Vec3. */ center(): Vec3; /** * Converts this Box3 to a Mat4 (a 4x4 matrix). The returned mat4 would transform a unit cube into the shape of the Bounding box. * * @return - Returns a new Mat4. */ toMat4(): Mat4; /** * Calculates and returns the bounding Sphere of the Box3 * * @return - The return value. */ getBoundingSphere(): SphereType; /** * Determines if this Box3 intersects a given box value. * * @param box - The box to check for intersection against. * @return - Returns true if the shapes intersect. */ intersectsBox(box: Box3): boolean; /** * Determines if this Box3 intersects a sphere. * * @param sphere - The sphere to check for intersection against. * @return - Returns true if the shapes intersect. */ intersectsSphere(sphere: SphereType): boolean; /** * Determines if this Box3 intersects a plane. * * @param plane - The plane to check for intersection against. * @return - The return value. */ intersectsPlane(plane: PlaneType): boolean; /** * Clones this Box3 and returns a new Box3. * @return - Returns a new Box3. */ clone(): Box3; /** * Encodes `Box3` Class as a JSON object for persistence. * * @return - The json object. */ toJSON(): Record>; /** * Decodes a JSON object to set the state of this class. * * @param j - The json object. */ fromJSON(j: Record>): void; /** * Calls `toJSON` method and stringifies it. * * @return - The return value. */ toString(): string; } /** * Class representing a ray that starts from an origin in a specified direction. */ declare class Ray { dir: Vec3; start: Vec3; /** * Create a ray. * * @param start - The origin of the ray. * @param dir - The direction of the ray. */ constructor(start?: Vec3, dir?: Vec3); /** * Get the closest point on the ray to the given point. * * @param point - The point in 3D space. * @return - returns a number */ closestPoint(point: Vec3): number; /** * Get the closest point between the ray and the given line segment made of the 2 points. * * @param p0 - The point in 3D space. * @param p1 - The point in 3D space. * @return - Returns an array containing 2 scalar values indicating 0: the fraction of the line segment, 1: distance along the Ray */ closestPointOnLineSegment(p0: Vec3, p1: Vec3): Array; /** * Get the closest point at a distance. * * @param dist - The distance value. * @return - Returns a Vec3. */ pointAtDist(dist: number): Vec3; /** * Returns the two ray params that represent the closest point between the two rays. * * @param ray - The ray value. * @return - Returns a Ray. */ intersectRayVector(ray: Ray): number | Vec3 | number[]; /** * Returns one ray param representing the intersection * of this ray against the plane defined by the given ray. * * @param plane - The plane to intersect with. * @return - The return value. */ intersectRayPlane(plane: Ray): number; /** * Determines if this Box3 intersects a ray. * * @param box3 - The box to check for intersection against. * @param tolerance - The tolerance of the test. * @return - The return value. */ intersectRayBox3(box3: Box3, tolerance?: number): boolean; /** * Clones this Ray and returns a new Ray. * * @return - Returns a new Ray. */ clone(): Ray; /** * The toJSON method encodes this type as a json object for persistence. * * @return - The json object. */ toJSON(): Record>; /** * The fromJSON method decodes a json object for this type. * * @param j - The json object. */ fromJSON(j: Record>): void; /** * Calls `toJSON` method and stringifies it. * * @return - The return value. */ toString(): string; } /** * Represents a box in 2D space. Needing two Vec2 vectors describing the corners */ declare class Box2 { p0: Vec2; p1: Vec2; /** * Creates a Box2 object using Vec2s. * In case the parameters are not passed by, their values are pre-defined: * * p0 is a Vec2 with {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY|`Number.POSITIVE_INFINITY`} * * p1 is a Vec2 with {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/NEGATIVE_INFINITY|`Number.NEGATIVE_INFINITY`} * * @param p0 - A point representing the corners of a 2D box. * @param p1 - A point representing the corners of a 2D box. */ constructor(p0?: Vec2, p1?: Vec2); /** * Sets both Vec2 points * * @param p0 - A point representing the corners of a 2D box. * @param p1 - A point representing the corners of a 2D box. */ set(p0: Vec2, p1: Vec2): void; /** * Resets the box2 back to an uninitialized state. * * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY|`Number.POSITIVE_INFINITY`} * and {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/NEGATIVE_INFINITY|`Number.NEGATIVE_INFINITY`} */ reset(): void; /** * Returns `true` if the box has been expanded to contain a point. * * @return - The return value. */ isValid(): boolean; /** * Expands the Box2 to contain the new point. * * @param point - A point represents the corners of a 2D box. */ addPoint(point: Vec2): void; /** * Returns the length of the diagonal of the box. * * @return - Returns the distance. */ size(): number; /** * Returns the size of a Box2 - the same as size(). * * @return - Returns a Vec2. */ diagonal(): Vec2; /** * Returns the center point of a Box2. * * @return - Returns a Vec2. */ center(): Vec2; /** * Clones this Vec2 and returns a new Vec2. * * @return - Returns a new Vec2. */ clone(): Box2; /** * Encodes `Box2` Class as a JSON object for persistence. * * @return - The json object. */ toJSON(): Record>; /** * Decodes a JSON object to set the state of this class. * * @param j - The json object. */ fromJSON(j: Record>): void; /** * Calls `toJSON` method and stringifies it. * * @return - The return value. */ toString(): string; } /** * Class representing a Frustum. Frustums are used to determine what * is inside the camera's field of view. * @private * */ declare class Frustum { planes: PlaneType[]; /** * Create a Frustum * @param p0 - the p0 value. * @param p1 - the p1 value. * @param p2 - the p2 value. * @param p3 - the p3 value. * @param p4 - the p4 value. * @param p5 - the p5 value. */ constructor(p0: PlaneType, p1: PlaneType, p2: PlaneType, p3: PlaneType, p4: PlaneType, p5: PlaneType); /** * The setFromMatrix configures a Frustum object using a matrix. * Typically the matrix is a model view projection matrix. * @param mat4 - The matrix to use. */ setFromMatrix(mat4: Mat4): void; /** * Tests a box to see if it is entirely within the frustum. * @param box3 - The box to test. * @return - True if the frustum intersects the box. */ intersectsBox(box3: Box3): boolean; /** * The toJSON method encodes this type as a json object for persistence. * * @return - The json object. */ toJSON(): Record; /** * The fromJSON method decodes a json object for this type. * * @param j - The json object. */ fromJSON(j: Record): void; /** * Calls `toJSON` method and stringifies it. * * @return - The return value. */ toString(): string; } /** Class representing a BaseEvent. */ declare class BaseEvent { /** * Create an BaseEvent. */ constructor(); } interface Listener { (event: BaseEvent | any): void; } /** * Provides an interface for emitting events under given names, and registering listeners to those events. * This is a base class for most classes in the Scene Tree and Renderer, enabling observers to listen to changes throughout the system. * The interface exposed is similar to [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter) in Node. * * Similar to how the DOM event system in the browser works, events are registered by name. * Example: Registering a listener for a custom event, and then emitting that event. * ```javascript * const ee = new EventEmitter() * * const eventID = ee.on('myEvent', (event) => { * console.log('My Event was emitted:', event) * }) * * ee.emit('myEvent', { data: 42 }) * // We no longer want to listen to this event, so let's remove the listener. * ee.off('myEvent', eventID) * ``` * * */ declare class EventEmitter extends BaseClass { listeners: Record>; /** * Initializes an empty `listeners` map that will host all the events, * which implies that it doesn't allow multiple events with the same name. * */ constructor(); /** * Adds a listener function for a given event name. * * @param eventName - The name of the event. * @param listener - The listener function(callback). * @return - the id that can be used to remove the listener. */ on(eventName: string, listener?: Listener): number; /** * Similar to the `on` method with the difference that when the event is triggered, * it is automatically unregistered meaning that the event listener will be triggered at most one time. * * Useful for events that we expect to trigger one time, such as when assets load. * ```javascript * const asset = new Asset(); * asset.once('loaded', () => { * console.log("Yay! the asset is loaded") * }) * ``` * * @param eventName - The eventName value * @param listener - The listener value * @return - the id that can be used to remove the listener. */ once(eventName: string, listener: Listener): number; /** * Removes a listener from the specified event, using either the function or the index id. Depends on what is passed in. * * @param eventName - The name of the event. * @param listenerOrId - The listener function or the id number returned by 'on'. */ off(eventName: string, listenerOrId: number | Listener): void; /** * remove listener by ID returned from #on * * @param eventName - The name of the event. * @param id - The id returned by addListener */ removeListenerById(eventName: string, id: number): void; /** * Triggers all listener functions in an event. * * @param eventName - The name of the event. * @param event - The data you want to pass down to all listener functions as parameter. * */ emit(eventName: string, event?: BaseEvent): void; } /****************************************************************************** This is a binary tree based bin packing algorithm that is more complex than the simple Packer (packer.js). Instead of starting off with a fixed width and height, it starts with the width and height of the first block passed and then grows as necessary to accommodate each subsequent block. As it grows it attempts to maintain a roughly square ratio by making 'smart' choices about whether to grow right or down. When growing, the algorithm can only grow to the right OR down. Therefore, if the new block is BOTH wider and taller than the current target then it will be rejected. This makes it very important to initialize with a sensible starting width and height. If you are providing sorted input (largest first) then this will not be an issue. A potential way to solve this limitation would be to allow growth in BOTH directions at once, but this requires maintaining a more complex tree with 3 children (down, right and center) and that complexity can be avoided by simply choosing a sensible starting block. Best results occur when the input blocks are sorted by height, or even better when sorted by max(width,height). Inputs: ------ blocks: array of any objects that have .w and .h attributes Outputs: ------- marks each block that fits with a .fit attribute pointing to a node with .x and .y coordinates Example: ------- var blocks = [ { w: 100, h: 100 }, { w: 100, h: 100 }, { w: 80, h: 80 }, { w: 80, h: 80 }, etc etc ]; var packer = new GrowingPacker(); packer.fit(blocks); for(var n = 0 ; n < blocks.length ; n++) { var block = blocks[n]; if (block.fit) { Draw(block.fit.x, block.fit.y, block.w, block.h); } } ******************************************************************************/ declare class GrowingPacker extends EventEmitter { root: Record; constructor(w?: number, h?: number); fit(blocks: Array>): void; __addBlock(block: Record): Record | null | undefined; addBlock(block: Record): Record | null | undefined; findNode(root: Record, w: number, h: number): Record | null; splitNode(node: Record, w: number, h: number): Record; growNode(w: number, h: number): Record | null | undefined; growRight(w: number, h: number): Record | null | undefined; growDown(w: number, h: number): Record | null | undefined; } /** * An Allocation1D represents an allocated block of memory. * */ declare class Allocation1D { start: number; size: number; /** * Initializes the allocation * @param start - The start of the allocated block of memory. * @param size - The size of the allocated block of memory. */ constructor(start?: number, size?: number); } /** * An 1D allocator is used to manage packing multiple smaller blocks of data * into a single large block of memory, supporting resizing and re-allocating. * As allocations are changed, fragmentation occurs as blocks must be moved * * Example: * ```javascript * const allocator = new Allocator1D() * * let memory = new Uint32Array(25) * allocator.on('resize', () => { * memory = new Uint32Array(allocator.reservedSpace) * }) * allocator.on('dataReallocated', (event) => { * // during allocation, a defragment might occur, which means * // we need to reload some of our data. * }) * * allocator.allocate(1, 5) * allocator.allocate(2, 10) * allocator.allocate(3, 10) * allocator.allocate(4, 20) * allocator.allocate(3, 20) // resize 3 to grow the allocated space. * allocator.allocate(1, 7) // resize 1 to fit into the previous space of 3, leaving a new free block. * allocator.allocate(1, 10) // resize 1 to fit into the previous space of 3, consuming the free block. * ``` * */ declare class Allocator1D extends EventEmitter { freeList: number[]; allocations: Allocation1D[]; allocationsMap: Record; allocatedSpace: number; reservedSpace: number; freeSpace: number; /** * Initializes the allocator ready to start work */ constructor(); /** * Returns the Allocates for the given Id. * * @param id - The unique numerical identifer for the block. * @return - The allocation */ getAllocation(id: number): Allocation1D; /** * Allocates space for a new or existing item. The id is a handle that the consuming code uses to * track allocations. * * @param id - The unique numerical identifer for the block. * @param size - The name of the event. * @return - The new allocation */ allocate(id: number, size: number): Allocation1D; /** * Adds a new block * @private * * @param index - The index where the block should be inserted. * @param allocation - The allocation to insert */ addBlock(index: number, allocation: Allocation1D): void; /** * Remove a new block * @private * * @param index - The index where the block should be removed */ removeBlock(index: number): void; /** * Frees a block by either growing neighboring blocks or adding a new free block * @private * * @param index - The index of the block to free. */ freeBlock(index: number): void; /** * Deallocate space for an existing item, making it free for other uses. * * @param id - The unique numerical identifer for the block. */ deallocate(id: number): void; /** * Returns the ratio of fragmented memory over reserved memory. * * @return The fragmentation ratio. Between 0 and some value less than 1 */ getFragmentation(): number; /** * Defragment the memory space reducing memory requirements. * TODO: Implement this method. */ defragment(): void; /** * Checks that the allocations are consistent and not corrupt in any way. */ verifyConsistency(): void; } /** * String functions * */ declare class StringFunctions { /** * Replaces all matches in a string. * * @static * @param str - * @param pattern - * @param replacement - * @return - */ static replaceAll(str: string, pattern: string | RegExp, replacement: string): string; /** * Returns JSON object as a formatted string, but the numeric values are fixed to the specified precision. * * @static * @param val - * @param space - * @param precision - * @return - */ static stringifyJSONWithFixedPrecision(val: Record, space?: number, precision?: number): string; /** * Transforms the given string into a numeric value. * * @static * @param str - * @return - */ static hashStr(str: string): number; } declare const UInt8 = 0; declare const SInt8 = 1; declare const UInt16 = 2; declare const SInt16 = 3; declare const UInt32 = 4; declare const SInt32 = 5; declare const Float32 = 6; /** * Math Functions */ declare class MathFunctions { /** * Converts Radians to Degrees * * @static * @param rad - Radians value * @return - Degrees equivalent */ static radToDeg(rad: number): number; /** * Converts Degrees to Radiants * * @static * @param deg - Degrees value * @return - Radians equivalent */ static degToRad(deg: number): number; /** * Verifies if the specified parameter is numeric. * * @static * @param number - Number to test * @return - `true` when is a valid number */ static isNumeric(number: any): boolean; /** * Generates and returns a random integer within the specified range. * * @static * @param min - Lower value random int can be. * @param max - Highest value random int can be. * @return - Random number inside range. */ static randomInt(min: number, max: number): number; /** * Calculates a lineal interpolation between two inputs for the specified parameter(t). * * @static * @param v0 - * @param v1 - * @param t - * @return - */ static lerp(v0: number, v1: number, t: number): number; /** * Restricts the specified value between two numbers * * @static * @param value * @param min * @param max * @return */ static clamp(value: number, min: number, max: number): number; /** * Returns the nearest pow of two value of the specified number. * * @static * @param value - * @return - */ static nearestPow2(value: number): number; /** * Returns the nearest pow of ten value of the specified number. * * @static * @param value - * @return - */ static nearestPow10(value: number): number; /** * Returns the next pow of two value of the specified number. * * @static * @param value - * @return - */ static nextPow2(value: number): number; /** * Returns the fractional component of a number * * @static * @param value - * @return - */ static fract(value: number): number; /** * Moves the specified value from one numeric domain(range) to another. * * @static * @param value - * @param start1 - * @param end1 - * @param start2 - * @param end2 - * @return - */ static remap(value: number, start1: number, end1: number, start2: number, end2: number): number; /** * Perform Hermite interpolation between two values * * @static * @param edge0 - * @param edge1 - * @param x - * @return - */ static smoothStep(edge0: number, edge1: number, x: number): number; /** * Performs - interpolation between two values * * @static * @param edge0 - * @param edge1 - * @param x - * @return - */ static linStep(edge0: number, edge1: number, x: number): number; /** * Decodes a Float16 from two unsigned Int8 * * @static * @param c - Array with the two UInt8 * @return - Decoded Float16 */ static decode16BitFloatFrom2xUInt8(c: Uint8Array): number; /** * Encodes an array of two unsigned Int8 to a Float16 * * @static * @param v - Float16 number * @return - Encoded Unsigned Int8 array */ static encode16BitFloatInto2xUInt8(v: number): Uint8Array; /** * Transforms a 16 bit float to an encoded integer. * * @static * @param v - Float16 number to encode * @return - Encoded number */ static encode16BitFloat(v: number): number; /** * As opposite of the `encode16BitFloat` method, this takes an encoded integer value, * and returns the 16 bit float. * * @static * @param h - Encoded integer * @return - Decoded 16 bit float. */ static decode16BitFloat(h: number): number; /** * Transforms an array of Float 32 to an array of unsigned Int16. * * @static * @param float32Array - * @return - Unsigned Int16 array representative of the Float32Array */ static convertFloat32ArrayToUInt16Array(float32Array: Float32Array): Uint16Array; } /** * Class designed to store version data. Widely used in the zea engine for backwards compatibility. */ declare class Version { major: number; minor: number; patch: number; branch: string; /** * Creates a version. * The version string should have the following structure: * major, minor and patch separated by a dot(`.`) and parts separated by a dash(`-`). * * @param arg - The version string value, or an array of version numbers. */ constructor(arg?: string | Array); /** * Compare a version object against a version numbers array. * * @param numbers - An array containing 3 version numbers. [Major, Minor, Patch] * @return - return positive: v1 > v2, zero:v1 == v2, negative: v1 < v2 */ compare(numbers: number[]): number; /** * Converts the Version class instance back to an array for comparisons with other version class instances. * e.g. * ``` * const version1 = new Version([1, 2, 3]) * const version2 = new Version([1, 2, 4]) * const res = version1.compare(version2.asArray()) * ``` * @returns an array containing the major, minor and patch version numbers. */ asArray(): number[]; toString(): string; } interface AttrBuffer { values: Uint8Array | Int8Array | Uint16Array | Int16Array | Float32Array; count: number; dimension: number; normalized: boolean; dataType: string; } interface CompoundGeomMaterialGroup { materialId: number; offset: number; count: number; } interface GeomBuffers { attrBuffers: Record; numVertices: number; numRenderVerts?: number; indices?: Uint8Array | Uint16Array | Uint32Array; numSubGeoms?: number; offsets?: Record; counts?: Record; materialSubGeoms?: Record>; subGeomOffsets?: Record; subGeomCounts?: Record; materialLibraryIndices?: Uint32Array; subGeomMaterialIndices?: Uint8Array; materials?: Array; } /** Class representing a ref counted object. RefCounted * objects track ownership and allow explicit cleanup * of resources. This is necessary when JavaScript * objects own references to GPU resources that need to * be cleaned up when the JavaScript object is destroyed. * @private */ declare class RefCounted extends EventEmitter { protected __refs: BaseClass[]; protected __destroyed: boolean; /** * Create a ref counted object. */ constructor(); /** * Returns the unique id of the object. Every Object has a unique * identifier which is based on a counter that is incremented. * @return - The return value. */ getId(): number; /** * The numRefs method. * @return - The return value. */ numRefs(): number; /** * The addRef method. * @param referer - The referer value. * @return - The return value. */ addRef(referer: BaseClass): boolean; /** * The removeRef method. * @param referer - The referer value. */ removeRef(referer: BaseClass): void; /** * The getRefer method. * @param index - The index value. * @return - The return value. */ getRefer(index: number): BaseClass; /** * The getRefIndex method. * @param referer - The referer value. * @return - The return value. */ getRefIndex(referer: BaseClass): number; /** * Returns true if this object has already been destroyed. * @return - Returns true or false. */ isDestroyed(): boolean; /** * The destroy method is invoked when the last owner * is removed from a RefCounted object. Derived objects can * override this method to perform explicit cleanup. * The destructing signal is triggered so observers can * respond to this objects destruction. */ destroy(): void; } declare const getFileFolder: (filePath: string) => string; declare const loadTextfile: (url: string, onSucceed: (result: string) => void, onFail?: (statusTest: string) => void, onProgress?: (total: number, loaded: number) => void) => void; declare const loadJSONfile: (url: string, onSucceed: (result: object, xhr: XMLHttpRequest) => void, onFail?: (statusTest: string) => void, onProgress?: (total: number, loaded: number) => void) => void; declare const loadXMLfile: (url: string, onSucceed: (result: Document) => void, onFail?: (statusTest: string) => void, onProgress?: (total: number, loaded: number) => void) => void; declare const loadBinfile: (url: string, onSucceed: (result: ArrayBuffer) => void, onFail?: (statusTest: string) => void, onProgress?: (total: number, loaded: number) => void) => void; declare class ResourceLoaderPlugin { /** * The type of file this plugin handles. * @return The type of file. */ getType(): string; loadFile(url: string): Promise; } interface ResourceCache { get(key: string): Promise; set(key: string, value: any): Promise; } /** * Class for delegating resource loading, enabling an abstraction of a cloud file system to be implemented. * * The resource loader can be used to load data, where it provides central tracking of loading progress and functionality to load various file types, including compressed archives. * The plugins script must be loaded along with the engine * * ```html * * ``` * * To load a 'text' file. * ```javascript * resourceLoader.loadFile('text', url).then((txt) =>{ * console.log(txt) * }) * ``` * * To load a 'JSON' file. * ```javascript * resourceLoader.loadFile('json', url).then((txt) =>{ * console.log(json) * }) * ``` * * To load a 'binary' file. * ```javascript * resourceLoader.loadFile('binary', url).then((arrayBuffer) =>{ * console.log(arrayBuffer.length) * }) * ``` * * To load an 'archive' file that is a compressed archive containing multiple sub-files. * ```javascript * resourceLoader.loadFile('archive', url).then((entries) =>{ * console.log(entries) * }) * ``` * **Events** * * **loaded:** emitted when a file has finished loading * * **progressIncremented:** emitted when a loading of processing task has been incremented * * **allResourcesLoaded:** emitted when all outstanding resources are loaded. This event can be used to signal the completion of load. */ declare class ResourceLoader extends EventEmitter { protected totalWork: number; protected doneWork: number; protected baseUrl: string; plugins: Record; systemUrls: Record; commonResources: Record; private loadCount; private queue; cache?: ResourceCache; /** * Create a resource loader. */ constructor(); registerPlugin(plugin: ResourceLoaderPlugin): void; /** * Loads a file, returning a promise that resolves to the JSON data value. * Note: using the resource loader to centralize data loading enables progress to be tracked and displayed * @param url - The url of the data to load. * @return - The promise value. */ loadFile(type: string, url: string, incrementWorkload?: boolean): Promise; /** * Returns a previously stored common resource. Typically this would be a VR asset. * * @param resourceId - The resourceId value. * @return - The common resource if it exists */ getCommonResource(resourceId: string): TreeItem | null; /** * Saves a common resource for reuse by other tools. Typically this would be a VR asset. * * @param resourceId - The resourceId value. * @param resource - The common resource to store */ setCommonResource(resourceId: string, resource: TreeItem): void; /** * Resets the progress counters back to zero. This must be done if a new asset needs to be * loaded after some preivous asset has already been loaded and a new load sequence is starting * * @param amount - The amount value. */ resetProgress(): void; /** * Increments the amount of work to be done causing a 'progressIncremented' event to be emitted. * * The progress bar is based on how much work there is to do Vs how much work has been done. * Before loading starts, we don't know how much work is coming because we don't know how many files * will be loaded, and how big those files will be. Big files are decompressed as a steam, which * involves many small increments. * Add we laod files, the work load is incrementened, and then as the work is done, we increment * the work done. * The ratio between work load and work done determines the percentage of load. * * @param amount - The amount value. */ incrementWorkload(amount?: number): void; /** * Increments the amount of work done causing a 'progressIncremented' event to be emitted. * If 5 items of work have been added using #incrementWorkload, and subsequently 3 items have * been completed and #incrementWorkDone called. The progress will be at 3/5, or 60% * * @param amount - The amount value. */ incrementWorkDone(amount?: number): void; } declare const resourceLoader: ResourceLoader; declare class IndexDBCache implements ResourceCache { name: string; objStoreName: string; version?: number; private db; constructor(name: string, objStoreName: string, version?: number); init(): Promise; /** * Gets a value from the Cache. * @param key the unique key to use. This is typically the URL * @returns the cached value, or null if the value is not in the Cache */ get(key: string): Promise; /** * Stores a value in the Cache. * @param key the unique key to use. This is typically the URL * @param value this can be any object or value. */ set(key: string, value: any): Promise; } /** * Writes `TypedArray` types in binary using a specific encoding. */ declare class BinWriter { protected __data: ArrayBuffer; protected __byteOffset: number; protected __reserved: number; protected __dataView: DataView; /** * Create a bin writer. * @param dataSize - The dataSize value. */ constructor(dataSize?: number); /** * Returns the byte offset position. * * @return - The return value. */ pos(): number; /** * Sets byte offset value. * * @param byteOffset - The byteOffset value. */ seek(byteOffset: number): void; /** * The seekEnd method. */ seekEnd(): void; /** * Returns written buffer data to current point. * * @return - Returns an array buffer. */ getBuffer(): ArrayBuffer; /** * The __grow method. * @private */ __grow(): void; /** * The __reserve method. * @param offset - The offset value. * @private */ __reserve(offset: number): void; /** * The __offset method. * @param byteCount - The byteCount value. * @private */ __offset(byteCount: number): void; /** * Writes an unsigned Int8 value in current byte offset. * * @param value - The value param. */ writeUInt8(value: number): void; /** * Writes an unsigned Int16 value in current byte offset. * @param value - The value param. */ writeUInt16(value: number): void; /** * Writes an unsigned Int32 value in current byte offset. * @param value - The value param. */ writeUInt32(value: number): void; /** * Writes a signed Int32 value in current byte offset. * @param value - The value param. */ writeSInt32(value: number): void; /** * Writes a Float16 value in current byte offset. * * @param value - The value param. */ writeFloat16(value: number): void; /** * Writes a Float32 value in current byte offset. * * @param value - The value param. */ writeFloat32(value: number): void; /** * Writes an unsigned Int8 array value from current byte offset. * * @param value - The value param. * @param writeSize - The writeSize value. */ writeUInt8Array(value: Uint8Array, writeSize?: boolean): void; /** * Writes an unsigned Int16 array value from current byte offset. * * @param value - The value param. * @param writeSize - The writeSize value. */ writeUInt16Array(value: Uint16Array, writeSize?: boolean): void; /** * Writes an unsigned Int32 array value from current byte offset. * * @param value - The value param. * @param writeSize - The writeSize value. */ writeUInt32Array(value: Uint32Array, writeSize?: boolean): void; /** * Writes a Float32 array value from current byte offset. * * @param value - The value param. * @param writeSize - The writeSize value. */ writeFloat32Array(value: Float32Array, writeSize?: boolean): void; /** * Writes string value in current position, first writing an unsigned Int32 describing its length, then adding the string in Float32 values. * * @param str - The str value. * @param writeSize - The writeSize value. */ writeStr(str: string, writeSize?: boolean): void; /** * Writes a `Vec2` in the buffer using signed Int32 values(In `x,y` order). * @param value - The Vec2 to write. */ writeSInt32Vec2(value: Vec2): void; /** * Writes a `Vec2` in the buffer using unsigned Int32 values(In `x,y` order). * * @param value - The Vec2 to write. */ writeUInt32Vec2(value: Vec2): void; /** * Writes a `Vec2` in the buffer using Float16 values(In `x,y` order). * @param value - The Vec2 to write. */ writeFloat16Vec2(value: Vec2): void; /** * Writes a `Vec2` in the buffer using Float32 values(In `x,y` order). * * @param value - The Vec2 to write. */ writeFloat32Vec2(value: Vec2): void; /** * Writes a `Vec3` in the buffer using Float16 values(In `x,y,z` order). * * @param value - The Vec3 to write. */ writeFloat16Vec3(value: Vec3): void; /** * Writes a `Vec3` in the buffer using Float32 values(In `x,y,z` order). * @param value - The Vec3 to write. */ writeFloat32Vec3(value: Vec3): void; /** * Writes a `Quat` in the buffer using Float16 values(In `x,y,z,w` order). * * @param value - The Quat to write. */ writeFloat16Quat(value: Quat): void; /** * Writes a `Quat` in the buffer using Float32 values(In `x,y,z,w` order). * * @param value - The Quat to write. */ writeFloat32Quat(value: Quat): void; /** * Writes a RGB `Color` in the buffer using Float32 values(In `r,g,b` order). * * @param value - The Color to write. */ writeRGBFloat32Color(value: Color): void; /** * Writes a RGBA `Color` in the buffer using Float32 values(In `r,g,b,a` order). * * @param value - The Color to write. */ writeRGBAFloat32Color(value: Color): void; /** * Writes a RGB `Color` in the buffer using unsigned Int8 values(In `r,g,b` order). * * @param value - The Color to write. */ writeRGBUInt8Color(value: Color): void; /** * Writes a RGBA `Color` in the buffer using unsigned Int8 values(In `r,g,b,a` order). * * @param value - The Color to write. */ writeRGBAUInt8Color(value: Color): void; /** * Writes a `Box2` in the buffer using Floar32 values(In `p0,p1` order). * * @param value - The Box2 to write. */ writeBox2(value: Box2): void; /** * Writes a `Box3` in the buffer using Floar32 values(In `p0,p1` order). * * @param value - The Box3 to write. */ writeBox3(value: Box3): void; /** * The writePadd method. * @param size - The size value. */ writePadd(size: number): void; /** * The writeAlignment method. * @param numBytes - The numBytes value. */ writeAlignment(numBytes: number): void; } type Shaderopts = Record; interface Viewport { region?: number[]; viewMatrix?: Mat4; projectionMatrix?: Mat4; viewportFrustum?: Vec4; isOrthographic?: boolean; fovY?: number; } interface ShaderParseAttribute { glslType: string; instanced: boolean; integer: boolean; } interface ShaderParseUniform { glslType: string; } interface ShaderParseResult { glsl: string; numLines: number; uniforms: Record; attributes: Record; } interface ShaderUniform { name: string; location: WebGLUniformLocation; glslType: string; } interface ShaderAttribute { name: string; glslType: string; location: number; instanced: boolean; integer: boolean; } type ShaderAttributes = Record; type ShaderUniforms = Record; interface ShaderCompileResult { shaderkey?: string; unifs: ShaderUniforms; attrs: ShaderAttributes; shaderHdls?: Record; shaderProgramHdl?: WebGLProgram; } interface GLAttrDesc { name: string; dimension: number; elementSize: number; dataType: number; normalized?: boolean; } interface GLAttrBuffer { dataType: number; name: string; dimension: number; elementSize: number; normalized: boolean; shared: boolean; numValues: number; offset?: number; buffer?: WebGLBuffer; } interface LayoutItem { pos: Vec2; size: Vec2; } interface Bindings { textureTypeUnif: WebGLUniformLocation; } type JSON = Record; declare enum GeomType { TRIANGLES = 0, LINES = 1, POINTS = 2 } interface WebGLRenderingContextExtension extends WebGLRenderingContext { readonly READ_BUFFER: number; readonly UNPACK_ROW_LENGTH: number; readonly UNPACK_SKIP_ROWS: number; readonly UNPACK_SKIP_PIXELS: number; readonly PACK_ROW_LENGTH: number; readonly PACK_SKIP_ROWS: number; readonly PACK_SKIP_PIXELS: number; readonly COLOR: number; readonly DEPTH: number; readonly STENCIL: number; readonly RED: number; readonly RGB8: number; readonly RGBA8: number; readonly RGB10_A2: number; readonly TEXTURE_BINDING_3D: number; readonly UNPACK_SKIP_IMAGES: number; readonly UNPACK_IMAGE_HEIGHT: number; readonly TEXTURE_3D: number; readonly TEXTURE_WRAP_R: number; readonly MAX_3D_TEXTURE_SIZE: number; readonly UNSIGNED_INT_2_10_10_10_REV: number; readonly MAX_ELEMENTS_VERTICES: number; readonly MAX_ELEMENTS_INDICES: number; readonly TEXTURE_MIN_LOD: number; readonly TEXTURE_MAX_LOD: number; readonly TEXTURE_BASE_LEVEL: number; readonly TEXTURE_MAX_LEVEL: number; readonly MIN: number; readonly MAX: number; readonly DEPTH_COMPONENT24: number; readonly MAX_TEXTURE_LOD_BIAS: number; readonly TEXTURE_COMPARE_MODE: number; readonly TEXTURE_COMPARE_FUNC: number; readonly CURRENT_QUERY: number; readonly QUERY_RESULT: number; readonly QUERY_RESULT_AVAILABLE: number; readonly STREAM_READ: number; readonly STREAM_COPY: number; readonly STATIC_READ: number; readonly STATIC_COPY: number; readonly DYNAMIC_READ: number; readonly DYNAMIC_COPY: number; MAX_DRAW_BUFFERS: number; readonly DRAW_BUFFER0: number; readonly DRAW_BUFFER1: number; readonly DRAW_BUFFER2: number; readonly DRAW_BUFFER3: number; readonly DRAW_BUFFER4: number; readonly DRAW_BUFFER5: number; readonly DRAW_BUFFER6: number; readonly DRAW_BUFFER7: number; readonly DRAW_BUFFER8: number; readonly DRAW_BUFFER9: number; readonly DRAW_BUFFER10: number; readonly DRAW_BUFFER11: number; readonly DRAW_BUFFER12: number; readonly DRAW_BUFFER13: number; readonly DRAW_BUFFER14: number; readonly DRAW_BUFFER15: number; readonly MAX_FRAGMENT_UNIFORM_COMPONENTS: number; readonly MAX_VERTEX_UNIFORM_COMPONENTS: number; readonly SAMPLER_3D: number; readonly SAMPLER_2D_SHADOW: number; readonly FRAGMENT_SHADER_DERIVATIVE_HINT: number; readonly PIXEL_PACK_BUFFER: number; readonly PIXEL_UNPACK_BUFFER: number; readonly PIXEL_PACK_BUFFER_BINDING: number; readonly PIXEL_UNPACK_BUFFER_BINDING: number; readonly FLOAT_MAT2x3: number; readonly FLOAT_MAT2x4: number; readonly FLOAT_MAT3x2: number; readonly FLOAT_MAT3x4: number; readonly FLOAT_MAT4x2: number; readonly FLOAT_MAT4x3: number; readonly SRGB: number; readonly SRGB8: number; readonly SRGB8_ALPHA8: number; readonly COMPARE_REF_TO_TEXTURE: number; readonly RGBA32F: number; readonly RGB32F: number; readonly RGBA16F: number; readonly RGB16F: number; readonly VERTEX_ATTRIB_ARRAY_INTEGER: number; readonly MAX_ARRAY_TEXTURE_LAYERS: number; readonly MIN_PROGRAM_TEXEL_OFFSET: number; readonly MAX_PROGRAM_TEXEL_OFFSET: number; readonly MAX_VARYING_COMPONENTS: number; readonly TEXTURE_2D_ARRAY: number; readonly TEXTURE_BINDING_2D_ARRAY: number; readonly R11F_G11F_B10F: number; readonly UNSIGNED_INT_10F_11F_11F_REV: number; readonly RGB9_E5: number; readonly UNSIGNED_INT_5_9_9_9_REV: number; readonly TRANSFORM_FEEDBACK_BUFFER_MODE: number; readonly MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: number; readonly TRANSFORM_FEEDBACK_VARYINGS: number; readonly TRANSFORM_FEEDBACK_BUFFER_START: number; readonly TRANSFORM_FEEDBACK_BUFFER_SIZE: number; readonly TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: number; readonly RASTERIZER_DISCARD: number; readonly MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: number; readonly MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: number; readonly INTERLEAVED_ATTRIBS: number; readonly SEPARATE_ATTRIBS: number; readonly TRANSFORM_FEEDBACK_BUFFER: number; readonly TRANSFORM_FEEDBACK_BUFFER_BINDING: number; readonly RGBA32UI: number; readonly RGB32UI: number; readonly RGBA16UI: number; readonly RGB16UI: number; readonly RGBA8UI: number; readonly RGB8UI: number; readonly RGBA32I: number; readonly RGB32I: number; readonly RGBA16I: number; readonly RGB16I: number; readonly RGBA8I: number; readonly RGB8I: number; readonly RED_INTEGER: number; readonly RGB_INTEGER: number; readonly RGBA_INTEGER: number; readonly SAMPLER_2D_ARRAY: number; readonly SAMPLER_2D_ARRAY_SHADOW: number; readonly SAMPLER_CUBE_SHADOW: number; readonly UNSIGNED_INT_VEC2: number; readonly UNSIGNED_INT_VEC3: number; readonly UNSIGNED_INT_VEC4: number; readonly INT_SAMPLER_2D: number; readonly INT_SAMPLER_3D: number; readonly INT_SAMPLER_CUBE: number; readonly INT_SAMPLER_2D_ARRAY: number; readonly UNSIGNED_INT_SAMPLER_2D: number; readonly UNSIGNED_INT_SAMPLER_3D: number; readonly UNSIGNED_INT_SAMPLER_CUBE: number; readonly UNSIGNED_INT_SAMPLER_2D_ARRAY: number; readonly DEPTH_COMPONENT32F: number; readonly DEPTH32F_STENCIL8: number; readonly FLOAT_32_UNSIGNED_INT_24_8_REV: number; readonly FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: number; readonly FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: number; readonly FRAMEBUFFER_ATTACHMENT_RED_SIZE: number; readonly FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: number; readonly FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: number; readonly FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: number; readonly FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: number; readonly FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: number; readonly FRAMEBUFFER_DEFAULT: number; readonly UNSIGNED_INT_24_8: number; readonly DEPTH24_STENCIL8: number; readonly UNSIGNED_NORMALIZED: number; readonly DRAW_FRAMEBUFFER_BINDING: number; readonly READ_FRAMEBUFFER: number; readonly DRAW_FRAMEBUFFER: number; readonly READ_FRAMEBUFFER_BINDING: number; readonly RENDERBUFFER_SAMPLES: number; readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: number; MAX_COLOR_ATTACHMENTS: number; readonly COLOR_ATTACHMENT1: number; readonly COLOR_ATTACHMENT2: number; readonly COLOR_ATTACHMENT3: number; readonly COLOR_ATTACHMENT4: number; readonly COLOR_ATTACHMENT5: number; readonly COLOR_ATTACHMENT6: number; readonly COLOR_ATTACHMENT7: number; readonly COLOR_ATTACHMENT8: number; readonly COLOR_ATTACHMENT9: number; readonly COLOR_ATTACHMENT10: number; readonly COLOR_ATTACHMENT11: number; readonly COLOR_ATTACHMENT12: number; readonly COLOR_ATTACHMENT13: number; readonly COLOR_ATTACHMENT14: number; readonly COLOR_ATTACHMENT15: number; readonly FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: number; readonly MAX_SAMPLES: number; readonly HALF_FLOAT: number; readonly RG: number; readonly RG_INTEGER: number; readonly R8: number; readonly RG8: number; readonly R16F: number; readonly R32F: number; readonly RG16F: number; readonly RG32F: number; readonly R8I: number; readonly R8UI: number; readonly R16I: number; readonly R16UI: number; readonly R32I: number; readonly R32UI: number; readonly RG8I: number; readonly RG8UI: number; readonly RG16I: number; readonly RG16UI: number; readonly RG32I: number; readonly RG32UI: number; readonly VERTEX_ARRAY_BINDING: number; readonly R8_SNORM: number; readonly RG8_SNORM: number; readonly RGB8_SNORM: number; readonly RGBA8_SNORM: number; readonly SIGNED_NORMALIZED: number; readonly COPY_READ_BUFFER: number; readonly COPY_WRITE_BUFFER: number; readonly COPY_READ_BUFFER_BINDING: number; readonly COPY_WRITE_BUFFER_BINDING: number; readonly UNIFORM_BUFFER: number; readonly UNIFORM_BUFFER_BINDING: number; readonly UNIFORM_BUFFER_START: number; readonly UNIFORM_BUFFER_SIZE: number; readonly MAX_VERTEX_UNIFORM_BLOCKS: number; readonly MAX_FRAGMENT_UNIFORM_BLOCKS: number; readonly MAX_COMBINED_UNIFORM_BLOCKS: number; readonly MAX_UNIFORM_BUFFER_BINDINGS: number; readonly MAX_UNIFORM_BLOCK_SIZE: number; readonly MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS: number; readonly MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS: number; readonly UNIFORM_BUFFER_OFFSET_ALIGNMENT: number; readonly ACTIVE_UNIFORM_BLOCKS: number; readonly UNIFORM_TYPE: number; readonly UNIFORM_SIZE: number; readonly UNIFORM_BLOCK_INDEX: number; readonly UNIFORM_OFFSET: number; readonly UNIFORM_ARRAY_STRIDE: number; readonly UNIFORM_MATRIX_STRIDE: number; readonly UNIFORM_IS_ROW_MAJOR: number; readonly UNIFORM_BLOCK_BINDING: number; readonly UNIFORM_BLOCK_DATA_SIZE: number; readonly UNIFORM_BLOCK_ACTIVE_UNIFORMS: number; readonly UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: number; readonly UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER: number; readonly UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER: number; readonly INVALID_INDEX: number; readonly MAX_VERTEX_OUTPUT_COMPONENTS: number; readonly MAX_FRAGMENT_INPUT_COMPONENTS: number; readonly MAX_SERVER_WAIT_TIMEOUT: number; readonly OBJECT_TYPE: number; readonly SYNC_CONDITION: number; readonly SYNC_STATUS: number; readonly SYNC_FLAGS: number; readonly SYNC_FENCE: number; readonly SYNC_GPU_COMMANDS_COMPLETE: number; readonly UNSIGNALED: number; readonly SIGNALED: number; readonly ALREADY_SIGNALED: number; readonly TIMEOUT_EXPIRED: number; readonly CONDITION_SATISFIED: number; readonly WAIT_FAILED: number; readonly SYNC_FLUSH_COMMANDS_BIT: number; readonly VERTEX_ATTRIB_ARRAY_DIVISOR: number; readonly ANY_SAMPLES_PASSED: number; readonly ANY_SAMPLES_PASSED_CONSERVATIVE: number; readonly SAMPLER_BINDING: number; readonly RGB10_A2UI: number; readonly INT_2_10_10_10_REV: number; readonly TRANSFORM_FEEDBACK: number; readonly TRANSFORM_FEEDBACK_PAUSED: number; readonly TRANSFORM_FEEDBACK_ACTIVE: number; readonly TRANSFORM_FEEDBACK_BINDING: number; readonly TEXTURE_IMMUTABLE_FORMAT: number; readonly MAX_ELEMENT_INDEX: number; readonly TEXTURE_IMMUTABLE_LEVELS: number; readonly TIMEOUT_IGNORED: number; readonly MAX_CLIENT_WAIT_TIMEOUT_WEBGL: number; bufferData(target: number, sizeOrData: number | Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer | null, usage: number): void; bufferSubData(target: number, dstByteOffset: number, srcData: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer | null): void; bufferData(target: number, data: ArrayBufferView, usage: number): void; bufferSubData(target: number, dstByteOffset: number, srcData: ArrayBufferView): void; bufferData(target: number, srcData: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer | null, usage: number, srcOffset: number, length?: number): void; bufferSubData(target: number, dstByteOffset: number, srcData: ArrayBufferView, srcOffset: number, length?: number): void; copyBufferSubData(readTarget: number, writeTarget: number, readOffset: number, writeOffset: number, size: number): void; getBufferSubData(target: number, srcByteOffset: number, dstBuffer: ArrayBufferView, dstOffset?: number, length?: number): void; blitFramebuffer(srcX0: number, srcY0: number, srcX1: number, srcY1: number, dstX0: number, dstY0: number, dstX1: number, dstY1: number, mask: number, filter: number): void; framebufferTextureLayer(target: number, attachment: number, texture: WebGLTexture | null, level: number, layer: number): void; invalidateFramebuffer(target: number, attachments: number[]): void; invalidateSubFramebuffer(target: number, attachments: number[], x: number, y: number, width: number, height: number): void; readBuffer(src: number): void; getInternalformatParameter(target: number, internalformat: number, pname: number): any; renderbufferStorageMultisample(target: number, samples: number, internalformat: number, width: number, height: number): void; texStorage2D(target: number, levels: number, internalformat: number, width: number, height: number): void; texStorage3D(target: number, levels: number, internalformat: number, width: number, height: number, depth: number): void; texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pixels?: ArrayBufferView | null): void; texImage2D(target: number, level: number, internalformat: number, format: number, type: number, source: ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement): void; texImage2D(target: number, level: number, internalformat: number, format: number, type: number, source: ImageBitmap | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels?: ArrayBufferView | null): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, source: ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, format: number, type: number, source: ImageBitmap | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement): void; texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, pboOffset: number): void; texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, source: ImageBitmap | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement): void; texImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, format: number, type: number, srcData: ArrayBufferView, srcOffset: number): void; texImage3D(target: number, level: number, internalformat: number, width: number, height: number, depth: number, border: number, format: number, type: number, pboOffset: number): void; texImage3D(target: number, level: number, internalformat: number, width: number, height: number, depth: number, border: number, format: number, type: number, source: ImageBitmap | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement): void; texImage3D(target: number, level: number, internalformat: number, width: number, height: number, depth: number, border: number, format: number, type: number, srcData: ArrayBufferView | null): void; texImage3D(target: number, level: number, internalformat: number, width: number, height: number, depth: number, border: number, format: number, type: number, srcData: ArrayBufferView, srcOffset: number): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pboOffset: number): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, source: ImageBitmap | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement): void; texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, srcData: ArrayBufferView, srcOffset: number): void; texSubImage3D(target: number, level: number, xoffset: number, yoffset: number, zoffset: number, width: number, height: number, depth: number, format: number, type: number, pboOffset: number): void; texSubImage3D(target: number, level: number, xoffset: number, yoffset: number, zoffset: number, width: number, height: number, depth: number, format: number, type: number, source: ImageBitmap | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement): void; texSubImage3D(target: number, level: number, xoffset: number, yoffset: number, zoffset: number, width: number, height: number, depth: number, format: number, type: number, srcData: ArrayBufferView | null, srcOffset?: number): void; copyTexSubImage3D(target: number, level: number, xoffset: number, yoffset: number, zoffset: number, x: number, y: number, width: number, height: number): void; compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, imageSize: number, offset: number): void; compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, srcData: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | null, srcOffset?: number, srcLengthOverride?: number): void; compressedTexImage2D(target: number, level: number, internalformat: number, width: number, height: number, border: number, srcData: ArrayBufferView, srcOffset?: number, srcLengthOverride?: number): void; compressedTexImage3D(target: number, level: number, internalformat: number, width: number, height: number, depth: number, border: number, imageSize: number, offset: number): void; compressedTexImage3D(target: number, level: number, internalformat: number, width: number, height: number, depth: number, border: number, srcData: ArrayBufferView, srcOffset?: number, srcLengthOverride?: number): void; compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, imageSize: number, offset: number): void; compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, srcData: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | null, srcOffset?: number, srcLengthOverride?: number): void; compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, srcData: ArrayBufferView | null, srcOffset?: number, srcLengthOverride?: number): void; compressedTexSubImage3D(target: number, level: number, xoffset: number, yoffset: number, zoffset: number, width: number, height: number, depth: number, format: number, imageSize: number, offset: number): void; compressedTexSubImage3D(target: number, level: number, xoffset: number, yoffset: number, zoffset: number, width: number, height: number, depth: number, format: number, srcData: ArrayBufferView, srcOffset?: number, srcLengthOverride?: number): void; getFragDataLocation(program: WebGLProgram, name: string): number; uniform1ui(location: WebGLUniformLocation | null, v0: number): void; uniform2ui(location: WebGLUniformLocation | null, v0: number, v1: number): void; uniform3ui(location: WebGLUniformLocation | null, v0: number, v1: number, v2: number): void; uniform4ui(location: WebGLUniformLocation | null, v0: number, v1: number, v2: number, v3: number): void; uniform1fv(location: WebGLUniformLocation | null, data: Float32Array | ArrayLike, srcOffset?: number, srcLength?: number): void; uniform2fv(location: WebGLUniformLocation | null, data: Float32Array | ArrayLike, srcOffset?: number, srcLength?: number): void; uniform3fv(location: WebGLUniformLocation | null, data: Float32Array | ArrayLike, srcOffset?: number, srcLength?: number): void; uniform4fv(location: WebGLUniformLocation | null, data: Float32Array | ArrayLike, srcOffset?: number, srcLength?: number): void; uniform1iv(location: WebGLUniformLocation | null, data: Int32Array | ArrayLike, srcOffset?: number, srcLength?: number): void; uniform2iv(location: WebGLUniformLocation | null, data: Int32Array | ArrayLike, srcOffset?: number, srcLength?: number): void; uniform3iv(location: WebGLUniformLocation | null, data: Int32Array | ArrayLike, srcOffset?: number, srcLength?: number): void; uniform4iv(location: WebGLUniformLocation | null, data: Int32Array | ArrayLike, srcOffset?: number, srcLength?: number): void; uniform1uiv(location: WebGLUniformLocation | null, data: Uint32Array | ArrayLike, srcOffset?: number, srcLength?: number): void; uniform2uiv(location: WebGLUniformLocation | null, data: Uint32Array | ArrayLike, srcOffset?: number, srcLength?: number): void; uniform3uiv(location: WebGLUniformLocation | null, data: Uint32Array | ArrayLike, srcOffset?: number, srcLength?: number): void; uniform4uiv(location: WebGLUniformLocation | null, data: Uint32Array | ArrayLike, srcOffset?: number, srcLength?: number): void; uniformMatrix2fv(location: WebGLUniformLocation | null, transpose: boolean, data: Float32Array | ArrayLike, srcOffset?: number, srcLength?: number): void; uniformMatrix3x2fv(location: WebGLUniformLocation | null, transpose: boolean, data: Float32Array | ArrayLike, srcOffset?: number, srcLength?: number): void; uniformMatrix4x2fv(location: WebGLUniformLocation | null, transpose: boolean, data: Float32Array | ArrayLike, srcOffset?: number, srcLength?: number): void; uniformMatrix2x3fv(location: WebGLUniformLocation | null, transpose: boolean, data: Float32Array | ArrayLike, srcOffset?: number, srcLength?: number): void; uniformMatrix3fv(location: WebGLUniformLocation | null, transpose: boolean, data: Float32Array | ArrayLike, srcOffset?: number, srcLength?: number): void; uniformMatrix4x3fv(location: WebGLUniformLocation | null, transpose: boolean, data: Float32Array | ArrayLike, srcOffset?: number, srcLength?: number): void; uniformMatrix2x4fv(location: WebGLUniformLocation | null, transpose: boolean, data: Float32Array | ArrayLike, srcOffset?: number, srcLength?: number): void; uniformMatrix3x4fv(location: WebGLUniformLocation | null, transpose: boolean, data: Float32Array | ArrayLike, srcOffset?: number, srcLength?: number): void; uniformMatrix4fv(location: WebGLUniformLocation | null, transpose: boolean, data: Float32Array | ArrayLike, srcOffset?: number, srcLength?: number): void; vertexAttribI4i(index: number, x: number, y: number, z: number, w: number): void; vertexAttribI4iv(index: number, values: Int32Array | ArrayLike): void; vertexAttribI4ui(index: number, x: number, y: number, z: number, w: number): void; vertexAttribI4uiv(index: number, values: Uint32Array | ArrayLike): void; vertexAttribIPointer(index: number, size: number, type: number, stride: number, offset: number): void; vertexAttribDivisor(index: number, divisor: number): void; drawArraysInstanced(mode: number, first: number, count: number, instanceCount: number): void; drawElementsInstanced(mode: number, count: number, type: number, offset: number, instanceCount: number): void; drawRangeElements(mode: number, start: number, end: number, count: number, type: number, offset: number): void; readPixels(x: number, y: number, width: number, height: number, format: number, type: number, dstData: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | null): void; readPixels(x: number, y: number, width: number, height: number, format: number, type: number, dstData: ArrayBufferView | null): void; readPixels(x: number, y: number, width: number, height: number, format: number, type: number, offset: number): void; readPixels(x: number, y: number, width: number, height: number, format: number, type: number, dstData: ArrayBufferView, dstOffset: number): void; drawBuffers(buffers: number[]): void; clearBufferfv(buffer: number, drawbuffer: number, values: Float32Array | ArrayLike, srcOffset?: number): void; clearBufferiv(buffer: number, drawbuffer: number, values: Int32Array | ArrayLike, srcOffset?: number): void; clearBufferuiv(buffer: number, drawbuffer: number, values: Uint32Array | ArrayLike, srcOffset?: number): void; clearBufferfi(buffer: number, drawbuffer: number, depth: number, stencil: number): void; createQuery(): WebGLQuery | null; deleteQuery(query: WebGLQuery | null): void; isQuery(query: WebGLQuery | null): boolean; beginQuery(target: number, query: WebGLQuery): void; endQuery(target: number): void; getQuery(target: number, pname: number): WebGLQuery | null; getQueryParameter(query: WebGLQuery, pname: number): any; createSampler(): WebGLSampler | null; deleteSampler(sampler: WebGLSampler | null): void; isSampler(sampler: WebGLSampler | null): boolean; bindSampler(unit: number, sampler: WebGLSampler | null): void; samplerParameteri(sampler: WebGLSampler, pname: number, param: number): void; samplerParameterf(sampler: WebGLSampler, pname: number, param: number): void; getSamplerParameter(sampler: WebGLSampler, pname: number): any; fenceSync(condition: number, flags: number): WebGLSync | null; isSync(sync: WebGLSync | null): boolean; deleteSync(sync: WebGLSync | null): void; clientWaitSync(sync: WebGLSync, flags: number, timeout: number): number; waitSync(sync: WebGLSync, flags: number, timeout: number): void; getSyncParameter(sync: WebGLSync, pname: number): any; createTransformFeedback(): WebGLTransformFeedback | null; deleteTransformFeedback(tf: WebGLTransformFeedback | null): void; isTransformFeedback(tf: WebGLTransformFeedback | null): boolean; bindTransformFeedback(target: number, tf: WebGLTransformFeedback | null): void; beginTransformFeedback(primitiveMode: number): void; endTransformFeedback(): void; transformFeedbackVaryings(program: WebGLProgram, varyings: string[], bufferMode: number): void; getTransformFeedbackVarying(program: WebGLProgram, index: number): WebGLActiveInfo | null; pauseTransformFeedback(): void; resumeTransformFeedback(): void; bindBufferBase(target: number, index: number, buffer: WebGLBuffer | null): void; bindBufferRange(target: number, index: number, buffer: WebGLBuffer | null, offset: number, size: number): void; getIndexedParameter(target: number, index: number): any; getUniformIndices(program: WebGLProgram, uniformNames: string[]): number[] | null; getActiveUniforms(program: WebGLProgram, uniformIndices: number[], pname: number): any; getUniformBlockIndex(program: WebGLProgram, uniformBlockName: string): number; getActiveUniformBlockParameter(program: WebGLProgram, uniformBlockIndex: number, pname: number): any; getActiveUniformBlockName(program: WebGLProgram, uniformBlockIndex: number): string | null; uniformBlockBinding(program: WebGLProgram, uniformBlockIndex: number, uniformBlockBinding: number): void; createVertexArray(): WebGLVertexArrayObject$1 | null; deleteVertexArray(vertexArray: WebGLVertexArrayObject$1 | null): void; isVertexArray(vertexArray: WebGLVertexArrayObject$1 | null): boolean; bindVertexArray(array: WebGLVertexArrayObject$1 | null): void; } interface WebGLQuery { } declare var WebGLQuery: { prototype: WebGLQuery; new (): WebGLQuery; }; interface WebGLSampler { } declare var WebGLSampler: { prototype: WebGLSampler; new (): WebGLSampler; }; interface WebGLSync { } declare var WebGLSync: { prototype: WebGLSync; new (): WebGLSync; }; interface WebGLTransformFeedback { } declare var WebGLTransformFeedback: { prototype: WebGLTransformFeedback; new (): WebGLTransformFeedback; }; interface WebGLVertexArrayObject$1 { } declare var WebGLVertexArrayObject$1: { prototype: WebGLVertexArrayObject$1; new (): WebGLVertexArrayObject$1; }; interface WebGL12RenderingContext extends WebGLRenderingContextExtension { name: string; __ext_draw_buffers: any; __ext_WEBGL_depth_texture: any; setupInstancedQuad: any; __quadVertexIdsBuffer: any; __quadattrbuffers: Record; __quadIndexBuffer: WebGLBuffer | null; renderer: any; floatTexturesSupported: boolean; multiDrawArrays: any; multiDrawElements: any; multiDrawElementsInstanced: any; multiDrawArraysInstanced: any; floatGeomBuffer: boolean; makeXRCompatible(): any; drawQuad(): void; } declare const create3DContext: (canvas: HTMLCanvasElement, opt_attribs: Record) => WebGL12RenderingContext; interface ShaderCompileAttributeAndUniformResult { unifs: ShaderUniforms; attrs: ShaderAttributes; } /** Class representing a GL shader. * @extends BaseItem * @private */ declare class GLShader extends BaseItem { protected __gl: WebGL12RenderingContext | undefined; private shaderStagesGLSL; private shaderStages; private shaderProgramHdls; /** * Create a GL shader. * @param gl - The webgl rendering context. */ constructor(gl?: WebGL12RenderingContext, name?: string); /** * Sets the GL context to the shader. * > Note: normally the context should be passed to the constructor. This method us used when using the Registry to construct shaders. * @param gl - The webgl rendering context. */ setGLContext(gl: WebGL12RenderingContext): void; /** * Sets the GLSL code for a given shader stage. * @param stageName - The name of the stage. currently only 'VERTEX_SHADER' or 'FRAGMENT_SHADER' are supported. * @param glsl - The GLSL code for the shader stage. */ setShaderStage(stageName: string, glsl: string): void; /** * Gets the GLSL code for a given shader stage. * @param stageName - The name of the stage. currently only 'VERTEX_SHADER' or 'FRAGMENT_SHADER' are supported. * @return - The GLSL code for the shader stage. */ getShaderStage(stageName: string): string; /** * Clears all cached shader compilations for this shader. */ clearProgramsCache(): void; /** * The isOpaque method. * @return - The return value. */ static isOpaque(): boolean; /** * The isOverlay method. * @return - The return value. */ static isOverlay(): boolean; private generateNumberedLines; /** * The compileShaderStage method. * @param glsl - The glsl value. * @param stageID - The stageID value. * @param name - The name value. * @param directives - The directives value. * @return - The return value. * @private */ private compileShaderStage; /** * The createProgram method. * @param directives - The directives value. * @return - The program value. * @private */ private createProgram; /** * The extractAttributeAndUniformLocations method. * @param shaderProgramHdl - The shaderProgramHdl value. * @param directives - GLSL shader directives * @return - The dictionary of attributes and uniform values * @private */ private extractAttributeAndUniformLocations; /** * The getAttributes method. * @return - The dictionary of attributes that this shader expects to be bound. */ getAttributes(): Record; /** * The getUniforms method. * @return - The dictionary of uniforms that this shader expects to be bound. */ getUniforms(): Record; /** * Checks to see if the engine is compiled for the target specified by the key * @param key - The key value. * @return - The return value. */ isCompiledForTarget(key: string): boolean; /** * The compileForTarget method. * @param key - The key value. * @param directives - The directives value. * @return - The result of the shader compilation. */ compileForTarget(key: string, directives: string[]): ShaderCompileResult | null; /** * The bind method. * @param renderstate - The object tracking the current state of the renderer * @param key - The key value. * @return - The return value. */ bind(renderstate: RenderState, key?: string): boolean; /** * The unbind method. * @param renderstate - The object tracking the current state of the renderer * @return - The return value. */ unbind(renderstate: RenderState): boolean; /** * The getGeomDataShaderName method. * @return - an array of param declarations that the shader expects the material tp provide. */ getGeomDataShaderName(): string; /** * The getSelectedShaderName method. */ getSelectedShaderName(): string; /** * The supportsInstancing method. * @return - return false for shaders that cannot be rendered in instanced mode. */ static supportsInstancing(): boolean; /** * The getPackedMaterialData method. * @param material - The material param. * @return - The return value. */ static getPackedMaterialData(material: Material): Float32Array; /** * Each shader provides a template material that each material instance is * based on. The shader specifies the parameters needed by the shader, and * the material provides values to the shader during rendering. * @return - The template material value. */ static getMaterialTemplate(): Material; /** * The destroy is called by the system to cause explicit resources cleanup. * Users should never need to call this method directly. */ destroy(): void; } declare class ScreenQuadShader extends GLShader { /** * Create a GL shader. * @param gl - The webgl rendering context. */ constructor(gl: WebGL12RenderingContext); } /** * Returns a descriptor for the provided geom attribute. * Used to generate WebGLBuffers from the data provided by the geometry. * @private * @param gl - The webgl context * @param attrDataType - The geometry attribute value. * * @return */ declare const genDataTypeDesc: (gl: WebGL12RenderingContext, name: string) => GLAttrDesc; declare abstract class IGeomShaderBinding { abstract bind(renderstate: RenderState): void; abstract unbind(renderstate: RenderState): void; abstract destroy(): void; } declare function generateShaderGeomBinding(gl: WebGL12RenderingContext, shaderAttrs: Record, geomAttrBuffers: Record, indexBuffer: WebGLBuffer | null): IGeomShaderBinding; /** Class representing a GL screen quad. * @private */ declare class GLScreenQuad { protected __gl: WebGL12RenderingContext; protected __pos: number[]; protected __size: number[]; protected flipY: boolean; protected __glshader: ScreenQuadShader; protected __quadBinding: IGeomShaderBinding; protected ready: boolean; /** * Create a GL screen quad. * @param gl - The webgl rendering context. * @param directives - GLSL shader directives */ constructor(gl: WebGL12RenderingContext, directives: string[]); /** * The bind method. * @param renderstate - The object tracking the current state of the renderer * @param textureOrColor - The texture or color value. * @param pos - The pos value. * @param size - The size value. */ bind(renderstate: RenderState, textureOrColor?: GLTexture2D | WebGLTexture | Color, pos?: Vec2, size?: Vec2): void; /** * The bindShader method. * @param renderstate - The object tracking the current state of the renderer * @return - The return value. */ bindShader(renderstate: RenderState): boolean; /** * The draw method. * @param renderstate - The object tracking the current state of the renderer * @param textureOrColor - The texture or color value. * @param pos - The pos value. * @param size - The size value. */ draw(renderstate: RenderState, textureOrColor?: GLTexture2D | WebGLTexture | Color, pos?: Vec2, size?: Vec2): void; } /** * ZeaUIEvent are emitted from a 2D UI, such as from a HTMLCanvas element generated from * a mouse or touch interaction, or key presses */ declare class ZeaUIEvent extends BaseEvent { viewport: GLBaseViewport; propagating: boolean; constructor(); } declare const POINTER_TYPES: { mouse: string; touch: string; xr: string; }; /** * ZeaPointerEvent are emitted from mouse or touch interactions or from WebXR controllers. */ declare class ZeaPointerEvent extends ZeaUIEvent { pointerType: string; pointerRay: Ray; pointerPos: Vec2; detail: number; intersectionData?: IntersectionData; leftGeometry: TreeItem; constructor(pointerType: string); stopPropagation(): void; setCapture(item: TreeItem | BaseTool): void; getCapture(): TreeItem | BaseTool; releaseCapture(): void; } declare class ZeaKeyboardEvent extends ZeaUIEvent { private sourceEvent; propagating: boolean; altKey: boolean; code: string; ctrlKey: boolean; isComposing: boolean; key: string; location: number; metaKey: boolean; repeat: boolean; shiftKey: boolean; which: number; constructor(sourceEvent?: globalThis.KeyboardEvent); stopPropagation(): void; preventDefault(): void; } declare class KeyboardEvent extends ZeaKeyboardEvent { } declare class ZeaMouseEvent extends ZeaPointerEvent { button: number; clientX: number; clientY: number; rendererX: number; rendererY: number; altKey: boolean; metaKey: boolean; ctrlKey: boolean; shiftKey: boolean; private sourceEvent; constructor(sourceEvent: globalThis.MouseEvent, rect: DOMRect); stopPropagation(): void; preventDefault(): void; } declare class ZeaWheelEvent extends ZeaMouseEvent { wheelDelta: number; deltaMode: number; deltaX: number; deltaY: number; deltaZ: number; constructor(sourceEvent: globalThis.WheelEvent, rect: DOMRect); } declare class Touch { identifier: number; clientX: number; clientY: number; screenX: number; screenY: number; pageX: number; pageY: number; radiusX: number; radiusY: number; rotationAngle: number; force: number; altitudeAngle: number; azimuthAngle: number; touchType: string; rendererX: number; rendererY: number; touchPos: Vec2; touchRay: Ray; constructor(touch: globalThis.Touch, rect: DOMRect); } declare class ZeaTouchEvent extends ZeaPointerEvent { touches: Touch[]; changedTouches: Touch[]; targetTouches: Touch[]; altKey: boolean; metaKey: boolean; ctrlKey: boolean; shiftKey: boolean; private sourceEvent; constructor(sourceEvent: globalThis.TouchEvent, rect: DOMRect); stopPropagation(): void; preventDefault(): void; } interface GeomsInView { geomItems: TreeItem[]; histogram: number[]; } /** * Class representing a GL viewport. * * **Events** * * **resized:** Emitted when the GLViewport resizes * * **updated:** Emitted when the GLViewport needs updating. The Renderer will trigger a redraw when this occurs. * * **viewChanged:** Emitted when the view changes. Usually caused by the camera moving. * * **pointerDoubleClick:** Emitted when the user double clicks with the mouse, or double taps in the viewport. * * **pointerDown:** Emitted when the user presses a pointer * * **pointerUp:** Emitted when the user releases a pointer * * **pointerOverGeom:** Emitted when the pointer is moved over a geometry * * **pointerLeaveGeom:** Emitted when the pointer is moved off a geometry * * **pointerMove:** Emitted when the pointer is moved * * **pointerEnter:** Emitted when the pointer is moved into thg viewport * * **pointerLeave:** Emitted when the mouse leaves the viewport. * * **pointerClick:** Emitted when a pointer is clicked on an item. * * **pointerLongPress:** Emitted when a pointer is clicked and held on an item for a long time. * * **keyDown:** Emitted when the user presses a key on the keyboard * * **keyUp:** Emitted when the user releases a key on the keyboard * * **touchCancel:** Emitted when the user cancels a touch interaction * * @extends GLBaseViewport */ declare class GLViewport extends GLBaseViewport { #private; debugGeomDataBuffer: boolean; debugOcclusionBuffer: boolean; debugReductionBuffer: boolean; debugHighlightedGeomsBuffer: boolean; mousePointerSearchArea: number; touchPointerSearchArea: number; private projectionMatrix; private viewportFrustum; private camera; private bottomLeftCoords; private topRightCoords; private posX; private posY; private pointerDownTime; private pointerDownButton; private pointerDownPos; private prevClickTime; private prevClickPos; private prevClickButton; private geomDataBufferSizeFactor; private geomDataRenderTarget; private geomDataBufferRendered; private geomDataBufferInvalid; private cameraXfo; private cameraMat; private viewMatrix; private screenPos; private intersectionData; private pointerOverItem; /** * Create a GL viewport. * @param renderer - The renderer value. * @param name - The name value. * @param width - The width of the viewport * @param height - The height of the viewport */ constructor(renderer: GLRenderer, name: string, width: number, height: number); /** * The getBl method. * @return - The return value. */ getBl(): Vec2; /** * The setBl method. * @param bl - The bl value. */ setBl(bl: Vec2): void; /** * The getTr method. * @return - The return value. */ getTr(): Vec2; /** * The setTr method. * @param tr - The tr value. */ setTr(tr: Vec2): void; /** * The getPosX method. * @return - The return value. */ getPosX(): number; /** * The getPosY method. * @return - The return value. */ getPosY(): number; /** * Dynamically resizes viewport. * * @param canvasWidth - The canvasWidth value. * @param canvasHeight - The canvasHeight value. */ resize(canvasWidth: number, canvasHeight: number): void; /** * Resize any offscreen render targets. * > Note: Values ,ay not be the entire canvas with if multiple viewports exists. * @param width - The width used by this viewport. * @param height - The height used by this viewport. */ resizeRenderTargets(width: number, height: number): void; /** * Returns current camera object * * @return - The return value. */ getCamera(): Camera; /** * Sets current camera object * * @param camera - The camera value. */ setCamera(camera: Camera): void; private updateProjectionMatrix; /** * The getProjectionMatrix method. * @return - The return projection matrix for the viewport. */ getProjectionMatrix(): Mat4; /** * The getProjectionMatrix method. * @return - The return projection matrix for the viewport. */ getViewMatrix(): Mat4; /** * Calculates a new camera position that frames all the items passed in `treeItems` array, moving * the camera to a point where we can see all of them. * > See Camera.frameView * @param treeItems - The array of TreeItem. * @param duration - The duration of time to apply the frame. A value of 0 specifies an instantaneous movement of the camera. * @param frameBorder - The variable to use to provide an empty space around the border for geometries. */ frameView(treeItems: TreeItem[], duration?: number, frameBorder?: number): void; /** * Compute the screen space position of an item from a world space coordinate. * @param screenPos - The screen position. * @return - The return value. */ calcScreenPosFromWorldPos(worldPos: Vec3): Vec2; /** * Compute a ray into the scene based on a mouse coordinate. * @param screenPos - The screen position. * @return - The return value. */ calcRayFromScreenPos(screenPos: Vec2): Ray; /** * Renders the scene geometry to the viewport's geom data buffer * in preparation for mouse picking. */ private renderGeomDataFbo; /** * The invalidateGeomDataBuffer method. */ invalidateGeomDataBuffer(): void; /** * The getGeomDataAtPos method. * @param screenPos - The screen position. * @param pointerRay - The pointerRay value. * @return - The return value. */ getGeomDataAtPos(screenPos: Vec2, pointerRay: Ray | undefined, searchArea?: number): IntersectionData | null; /** * this method returns an object containing an array of geomitems, and an array of count values in * the form of a histogram. The results are sorted by count, so the first items are the most visible, * down to the least visible. * @param tl - The top left value of the rectangle. * @param br - The bottom right corner of the rectangle. * @return - The return value. */ getGeomVisiblity(tl: Vec2, br: Vec2): GeomsInView; /** * getGeomItemsInRect * Gathers all the geoms renders in a given rectangle of the viewport. * @param tl - The top left value of the rectangle. * @param br - The bottom right corner of the rectangle. * @return - The return value. */ getGeomItemsInRect(tl: Vec2, br: Vec2): Set; /** * Calculates the event coordinates relative to the viewport. * There could be multiple viewports connected to the current renderer. * * @param rendererX - The rendererX value * @param rendererY - The rendererY value * @return - Returns a new Vec2. * @private */ __getPointerPos(rendererX: number, rendererY: number): Vec2; /** * Prepares pointer event by adding properties of the engine to it. * * @param event - The event that occurs in the canvas * @private */ prepareUIEvent(event: ZeaUIEvent): void; /** * Handler of the `pointerdown` event fired when the pointer device is initially pressed. * * @param event - The DOM event produced by a pointer */ onPointerDown(event: ZeaPointerEvent): void; /** * Causes an event to occur when a user releases a mouse button over a element. * * @param event - The event that occurs. */ onPointerUp(event: ZeaPointerEvent): void; /** * Causes an event to occur when the pointer device is moving. * * @param event - The event that occurs. */ onPointerMove(event: ZeaPointerEvent): void; /** * Causes an event to occur when the mouse pointer is moved into this viewport * @param event - The event that occurs. */ onPointerEnter(event: ZeaPointerEvent): void; /** * Causes an event to occur when the mouse pointer is moved out of this viewport * @param event - The event that occurs. */ onPointerLeave(event: ZeaPointerEvent): void; /** * Causes an event to occur when the user is pressing a key on the keyboard. * @param event - The event that occurs. */ onKeyDown(event: ZeaKeyboardEvent): void; /** * Causes an event to occur when the user releases a key on the keyboard. * @param event - The event that occurs. */ onKeyUp(event: ZeaKeyboardEvent): void; /** * Causes an event to occur when the mouse wheel is rolled up or down over an element. * @param event - The event that occurs. */ onWheel(event: ZeaWheelEvent): void; /** * Causes an event to occur when the touch event gets interrupted. * @param event - The event that occurs. */ onTouchCancel(event: ZeaTouchEvent): void; /** * The bindGLViewport method. * @param renderstate - The object tracking the current state of the renderer * @private */ bindGLViewport(renderstate: RenderState): void; /** * The draw method. */ draw(renderstate: ColorRenderState): void; } /** Class representing a VR head. * @private */ declare class XRHead { private xrvp; protected treeItem: TreeItem; private mat4; private localXfo; private hmdGeomItem; /** * Create a VR head. * @param xrvp - The VR viewport. * @param stageTreeItem - The stageTreeItem value. */ constructor(xrvp: any, stageTreeItem: any); /** * The Set wether the HMB is visible in rendering or not. Used in spectator rendering. * @param state - The visibility value. */ setVisible(state: boolean): void; /** * The update method. * @param pose - The pose value. */ update(pose: any): void; /** * The getTreeItem method. * @return - The return value. */ getTreeItem(): TreeItem; /** * The getXfo method. * @return - The return value. */ getXfo(): Xfo; } /** Class representing a VR controller. * * The XRController class wraps the XRInputSource provided by the WebXR API. * * https://developer.mozilla.org/en-US/docs/Web/API/XRInputSource * * The XRController provides a tree item that can be used to attach geometries to represenet * the controllers or tools that the user may have in thier hands. * ```javascript * renderer.getXRViewport().then((xrvp) => { * xrvp.on('controllerAdded', (event) => { * const controller = event.controller * * // Configure the distance of the ray cast performed by the controller into the scene. * // Note: setting to 0 disables ray casting. * controller.raycastDist = 20.0 * * // Remove the green ball added by the VRViewManipulator. * controller.tipItem.removeAllChildren() * * // Add a visual indication of the ray. * const pointerItem = new GeomItem('PointerRay', line, pointermat) * pointerItem.setSelectable(false) * const pointerXfo = new Xfo() * pointerXfo.sc.set(1, 1, controller.raycastDist) * pointerItem.localXfoParam.value = pointerXfo * controller.tipItem.addChild(pointerItem, false) * * // The tip items needs to be rotated down a little to make it * // point in the right direction. * const tipItemXfo = controller.tipItem.localXfoParam.value * tipItemXfo.ori.setFromAxisAndAngle(new Vec3(1, 0, 0), -0.8) * controller.tipItem.localXfoParam.value = tipItemXfo * * controller.on('buttonPressed', (event) => { * console.log('buttonPressed', event) * }) * controller.on('buttonReleased', (event) => { * console.log('buttonReleased', event) * }) * }) * }) * ``` * * **Events** * * **buttonPressed:** Emitted when the user presses any of the buttons aside from the trigger button. * * **buttonReleased:** Emitted when the user release any of the buttons aside from the trigger button. * * * @extends EventEmitter */ declare class XRController extends EventEmitter { id: number; buttonPressed: boolean; xrvp: XRViewport; inputSource: XRInputSource; pressedButtons: Array; treeItem: TreeItem; tipItem: TreeItem; raycastTick: number; raycastArea: number; raycastDist: number; pointerRay: Ray; private mat4; private xfo; private raycastAreaCache; private raycastDistCache; private rayCastRenderTargetProjMatrix; private tick; private hitTested; private pointerOverItem; private intersectionData; /** * Create a VR controller. * @param xrvp - The Vr viewport. * @param inputSource - The input source. * @param id - The id value. */ constructor(xrvp: any, inputSource: XRInputSource, id: number); /** * The getHandedness method. * @return - The return value. */ getHandedness(): any; /** * The getId method. * @return - The return value. */ getId(): number; /** * The getTreeItem method. * @return - The return value. */ getTreeItem(): TreeItem; /** * The getTipItem method. * @return - The return value. */ getTipItem(): TreeItem; /** * The getTipXfo method. * @return - The return value. */ getTipXfo(): Xfo; /** * The isButtonPressed method. * @return - The return value. */ isButtonPressed(): boolean; /** * The getControllerStageLocalXfo method. * @return - The return value. */ getControllerStageLocalXfo(): Xfo; /** * The getControllerTipStageLocalXfo method. * @return - The return value. */ getControllerTipStageLocalXfo(): Xfo; /** * The updatePose method. * @param refSpace - The refSpace value. * @param xrFrame - The xrFrame value. * @param inputSource - The inputSource value. */ updatePose(refSpace: XRReferenceSpace, xrFrame: XRFrame, inputSource: XRInputSource): boolean; /** * The getGeomItemAtTip method. * @return - The return value. */ getGeomItemAtTip(): IntersectionData; } declare class VRController extends XRController { } declare class XRControllerEvent extends ZeaPointerEvent { controller: XRController; button: number; buttonPressed: number; constructor(viewport: XRViewport, controller: XRController, button: number, buttonPressed: number); stopPropagation(): void; setCapture(item: TreeItem | BaseTool): void; getCapture(): TreeItem | BaseTool; releaseCapture(): void; } /** This Viewport class is used for rendering stereoscopic views to VR controllers using the WebXR api. * When the GLRenderer class detects a valid WebXF capable device is plugged in, this class is automatically * instantiated ready for XR sessions * * **Events** * * **presentingChanged:** Emitted when presenting is started or stopped * * **controllerAdded:** Emitted when a new XR controller is detected. * * **viewChanged:** Emitted during presentation each time the frame is rendered. * * **pointerDoubleClick:** Emitted when the user double clicks with an XR pointer. * * **pointerDown:** Emitted when the user presses an XR pointer * * **pointerUp:** Emitted when the user releases an XR pointer * * @extends XRViewport */ declare class VRViewport extends XRViewport { private vrAsset?; private hmd; private hmdAssetPromise?; private xrhead; /** * Create a VR viewport. * @param renderer - The renderer value. */ constructor(renderer: any, sessionMode: string); /** * The getAsset method. * @return - The return value. */ getAsset(): VLAAsset; /** * The getVRHead method. * @return - The return value. */ getVRHead(): XRHead; /** * Returns the name of the HMD being used. * @return - The return value. */ getHMDName(): string; /** * The loadHMDResources method. * @return - The return value. */ loadHMDResources(): Promise; /** * The startPresenting method. */ startPresenting(): Promise; /** * The updateControllers method. * @param xrFrame - The xrFrame value. * @param event - The pose changed event object that will be emitted for observers such as collab. */ updateControllers(xrFrame: XRFrame): boolean; /** * The drawXRFrame method. * @param xrFrame - The xrFrame value. */ drawXRFrame(xrFrame: XRFrame): void; /** * Handler of the `pointerdown` event fired when the pointer device is initially pressed. * * @param event - The DOM event produced by a pointer */ onPointerDown(event: XRControllerEvent): void; /** * Causes an event to occur when a user releases a mouse button over a element. * * @param event - The event that occurs. */ onPointerUp(event: XRControllerEvent): void; } /** * The BaseTool provides an interface you can implement to define your own mouse, keyboard, and touch event handlers. * * A tool is a class that is delegated the handling of all user interaction events. The built-in {CameraManipulator} * class provides a default tool for moving the viewport camera. * * You can define your own custom tool, and replace the default CameraManipulator like so. * ```javascript * const customManipulator = new MyCustomCameraManipulator() * renderer.getViewport().setManipulator(customManipulator) * ``` * * Each tool should provide handlers for the main types of events it will be responsible for handling. * These include mouse, keyboard, touch and VR events. Once a tool is installed on the viewport, the viewport * will start invoking the handler methods defined in the interface. * If the Tool handles an event, it should call stopPropagation on the event so the engine knows to stop the * propagation of the event to other classes. * * > Note: VR Events are ann emulation of mouse events, generated by the engine, allowing custom tools to be used to provide various VR interactions. * * **Events** * * **installChanged:** Triggered when the tool is installed or uninstalled. * * **activatedChanged:** Triggered when a tool is activated or deactivated. * * @extends ParameterOwner */ declare class BaseTool extends ParameterOwner { protected __activated: boolean; /** * Creates an instance of BaseTool. */ constructor(); /** * Enables tools usage. This method is called by either the Viewport when a tool is removed, or the ToolManage if it is installed. */ activateTool(): void; /** * Disables tool usage. This method is called by either the Viewport when a tool is removed, or the ToolManage if it is installed. */ deactivateTool(): void; /** * Event fired when either the mouse button is pressed, or a touch start event occurs. * * @param event - The event param. */ onPointerDown(event: ZeaPointerEvent): void; /** * Event fired when either the mouse cursor is moved, or a touch point moves. * * @param event - The event param. */ onPointerMove(event: ZeaPointerEvent): void; /** * Event fired when either the mouse button is released, or a touch end event occurs. * * @param event - The event param. */ onPointerUp(event: ZeaPointerEvent): void; /** * Event fired when a pointing device button is clicked. * * @param event - The event param. */ onPointerClick(event: ZeaPointerEvent): void; /** * Event fired when a pointing device button is double clicked. * * @param event - The event param. */ onPointerDoubleClick(event: ZeaPointerEvent): void; /** * Event fired when a pointing device button is held for a long time.. * * @param event - The event param. */ onPointerLongPress(event: ZeaPointerEvent): void; /** * Event fired when a mouse pointer enters the viewport * * @param event - The event param. */ onPointerEnter(event: ZeaPointerEvent): void; /** * Event fired when a mouse pointer leaves the viewport * * @param event - The event param. */ onPointerLeave(event: ZeaPointerEvent): void; /** * Event fired when the user rotates the pointing device wheel. * * @param event - The event param. */ onWheel(event: ZeaPointerEvent): void; /** * Event fired when the user presses down a key on the keyboard. * * @param event - The event param. */ onKeyDown(event: ZeaKeyboardEvent): void; /** * Event fired when the user releases a key on the keyboard. * * @param event - The event param. */ onKeyUp(event: ZeaKeyboardEvent): void; /** * Event fired when one or more touch points have been disrupted in an implementation-specific manner. * * @param event - The event param. */ onTouchCancel(event: ZeaTouchEvent): void; } declare class XRPoseEvent extends ZeaPointerEvent { viewXfo: Xfo; controllers: XRController[]; constructor(viewport: XRViewport, viewXfo: Xfo, controllers?: XRController[]); } /** * Class representing a view tool * @extends BaseTool */ declare class XRViewManipulator extends BaseTool { enableViewScale: boolean; private listenerIDs; private controllerTriggersHeld; private xrvp; private vrControllerToolTip; private vrControllerToolTipMat; private grabPos; private stageXfo__GrabStart; private grabDir; private grabDist; /** */ constructor(xrvp: VRViewport); /** * Adds the icon to the tip of the VR Controller * @param event */ /** * The activateTool method. */ activateTool(): void; /** * The deactivateTool method. */ deactivateTool(): void; private initMoveStage; /** * The onXRControllerButtonDown method. * @param event - The event param. * @return The return value. */ onXRControllerButtonDown(event: XRControllerEvent): void; /** * The onXRControllerButtonUp method. * @param event - The event param. * @return The return value. */ onXRControllerButtonUp(event: XRControllerEvent): void; /** * The onVRControllerDoubleClicked method. * @param event - The event param. */ onVRControllerDoubleClicked(event: XRControllerEvent): void; /** * The onVRPoseChanged method. * @param event - The event param. */ onVRPoseChanged(event: XRPoseEvent): void; /** * Event fired when a pointing device button is pressed while the pointer is over the tool. * * @param event - The event param. */ onPointerDown(event: ZeaPointerEvent): void; /** * Event fired when a pointing device is moved while the cursor's hotspot is inside it. * * @param event - The event param. */ onPointerMove(event: ZeaPointerEvent): void; /** * Event fired when a pointing device button is released while the pointer is over the tool. * * @param event - The event param. */ onPointerUp(event: ZeaPointerEvent): void; /** * Event fired when a pointing device button is double clicked on the tool. * * @param event - The event param. */ onPointerDoubleClick(event: ZeaPointerEvent): void; } /** This base class supports various XR experiences via spcialized clases such as VRViewport and XRViewport. * @extends GLBaseViewport */ declare abstract class XRViewport extends GLBaseViewport { protected projectionMatricesUpdated: boolean; protected tick: number; stageTreeItem: TreeItem; stageScale: number; protected viewXfo: Xfo; protected stageXfo: Xfo; protected invStageXfo: Xfo; protected invStageMatrix: Mat4; protected region: Array; protected session: XRSession; protected refSpace: XRReferenceSpace; protected projectionMatrices: Array; protected viewMatrices: Array; protected cameraMatrices: Array; protected sessionMode: string; protected controllersMap: Record; controllers: XRController[]; protected controllerPointerDownTime: number[][]; /** * Create a VR viewport. * @param renderer - The renderer value. */ constructor(renderer: any, sessionMode: string); getRenderer(): GLRenderer; /** * The getTreeItem method. * @return - The return value. */ getTreeItem(): TreeItem; /** * The getXfo method. * @return - The return value. */ getXfo(): Xfo; /** * Sets the stage Xfo, which is the Xfo that transforms the user into the world. * The local displacement of the user within their volume is applied on top of this Xfo. * @param xfo - The xfo value. */ setXfo(xfo: Xfo): void; /** * The getControllers method. * @return - The return value. */ getControllers(): XRController[]; /** * The isPresenting method. * @return - The return value. */ isPresenting(): boolean; /** * Lanuches the session loop */ protected startSession(): void; /** * The startPresenting method. */ abstract startPresenting(): Promise; /** * The stopPresenting method. */ stopPresenting(): void; /** * The togglePresenting method. */ togglePresenting(): void; /** * The bindCullingViewport method. * @param renderstate - The object tracking the current state of the renderer */ bindCullingViewport(renderstate: RenderState, fovY: number, projectionMatrixMat4: Mat4): void; /** * The bindXRViewport method. * @param renderstate - The object tracking the current state of the renderer */ bindXRViewport(renderstate: RenderState, viewports: ViewportRenderState[]): void; /** * The drawXRFrame method. * @param xrFrame - The xrFrame value. */ abstract drawXRFrame(xrFrame: XRFrame): void; } /** Class representing a GL material. * @extends EventEmitter * @private */ declare class GLMaterial extends EventEmitter { private gl; material: Material; glShader: GLShader; private shaderBindings; private boundTexturesBeforeMaterial; /** * Create a GL material. * @param gl - The webgl rendering context. * @param material - The material value. * @param glShader - The glShader value. */ constructor(gl: WebGL12RenderingContext, material: Material, glShader: GLShader); /** * The bind method. * @param renderstate - The object tracking the current state of the renderer * @param warnMissingUnifs - The renderstate value. */ bind(renderstate: RenderState, warnMissingUnifs: boolean): void; /** * The unbind method. * @param renderstate - The object tracking the current state of the renderer */ unbind(renderstate: RenderState): void; } /** Class representing a GL CAD material library. * @ignore */ declare class GLMaterialLibrary extends EventEmitter { private renderer; materials: Material[]; private materialBindings; private freeIndices; private dirtyIndices; private materialsAllocator; private materialsTexture; /** * Create a GL CAD material library. * @param renderer - The renderer object */ constructor(renderer: GLBaseRenderer); /** * The addMaterial method. * @param material - The material object. * @return - The index of GLMaterial */ addMaterial(material: Material): number; /** * Given a material, generates a GLMaterial that manages the GPU state for the material. * @param material - The material value. * @return - The constructed GLMaterial. */ getGLMaterial(material: Material): GLMaterial; getMaterialAllocation(material: Material): Allocation1D | undefined; /** * The removeMaterial method. * @param material - The material object. */ removeMaterial(material: Material): void; /** * The uploadMaterials method. * @param renderstate - The render state for the current draw traversal */ uploadMaterials(renderstate: RenderState): void; /** * Updates the GPU state if any update is needed. * @param renderstate - The object tracking the current state of the renderer */ update(renderstate: RenderState): void; /** * The bind method. * @param renderstate - The renderstate param. * @return - The return value. */ bind(renderstate: any): boolean; } /** Class representing a GL geom. * @private */ declare class GLGeom extends RefCounted { protected __gl: WebGL12RenderingContext; geom: BaseGeom | BaseProxy; protected numVertices: number; protected glattrbuffers: Record; protected shaderBindings: Record; protected buffersDirty: boolean; protected genBufferOpts: Record; protected indexBuffer: WebGLBuffer | null; /** * Create a GL geom. * @param gl - The webgl rendering context. * @param geom - A geometry object */ constructor(gl: WebGL12RenderingContext, geom: BaseGeom | BaseProxy); /** * Returns the owned Geometry object * @return - The geometry object. */ getGeom(): BaseGeom | BaseProxy; /** * The dirtyBuffers method. * @param opts - options passed when geomDataChanged is emitted. (Currently ony used by the FreehandLines tool) */ dirtyBuffers(opts: Record): void; /** * The genBuffers method. * @param renderstate - The object tracking the current state of the renderer */ genBuffers(renderstate: RenderState): any; /** * The updateBuffers method. * @param renderstate - The object tracking the current state of the renderer */ updateBuffers(renderstate: RenderState): void; /** * The bind method. * @param renderstate - The object tracking the current state of the renderer * @return - returns false if the binding failed. */ bind(renderstate: RenderState): void; /** * The unbind method. * @param renderstate - The object tracking the current state of the renderer */ unbind(renderstate: RenderState): void; /** * The draw method. * @param renderstate - The object tracking the current state of the renderer */ draw(renderstate: RenderState): void; /** * The drawInstanced method. * @param renderstate - The object tracking the current state of the renderer * @param instanceCount - The instanceCount param. */ drawInstanced(renderstate: RenderState, instanceCount: number): void; /** * The bindAndDraw method. * @param renderstate - The object tracking the current state of the renderer */ bindAndDraw(renderstate: RenderState): void; /** * The clearBuffers method. */ clearBuffers(): void; /** * The destroy is called by the system to cause explicit resources cleanup. * Users should never need to call this method directly. */ destroy(): void; } /** Class representing a GL geom. * @private */ declare class GLGeomLibrary extends EventEmitter { protected renderer: GLBaseRenderer; protected __gl: WebGL12RenderingContext; protected freeGeomIndices: number[]; protected geoms: Array; protected geomRefCounts: number[]; protected geomsDict: Map; protected glGeomsDict: Map; protected geomBuffersTmp: GeomBuffers[]; protected shaderAttrSpec: Record; protected glattrbuffers: Record; protected shaderBindings: Record; protected attributesBufferNeedsRealloc: boolean; protected attributesBufferNeedsAlloc: string[]; protected attributesAllocator: Allocator1D; protected dirtyGeomIndices: Set; protected geomVertexOffsets: Int32Array; protected geomVertexCounts: Int32Array; protected numIndices: number; protected indicesBufferNeedsRealloc: boolean; protected indicesAllocator: Allocator1D; protected indicesCounts: Int32Array; protected indicesOffsets: Int32Array; protected indexBuffer: WebGLBuffer | null; freeDataAfterUpload: boolean; protected __destroyed: boolean; protected geomEventHandlerIds: Record[]; /** * Create a GLGeomLibrary. * @param renderer - The renderer object */ constructor(renderer: GLBaseRenderer); reserveSpace(attributeCount: number, vertexCount: number): void; /** * Given a BaseGeom, constructs the GLGeom that manages the state of the geometry in the GPU. * @param geom - The geom value. * @return - The return value. */ constructGLGeom(geom: BaseGeom | BaseProxy): GLGeom; /** * Adds a geom to the GLGeomLibrary. * * @param geom - The geom to be managed by this GLGeomLibrary. * @return - The index of the geom in the GLGeomLibrary */ addGeom(geom: BaseGeom | BaseProxy): number; /** * Removes a Geom managed by this GLGeomLibrary. * @param geom - The geom to remove */ removeGeom(geom: BaseGeom | BaseProxy): void; /** * Returns a Geom managed by this GLGeomLibrary. * @param index - The index of the geom to retrieve * @return - The return value. */ getGeom(index: number): BaseGeom | BaseProxy; /** * Returns a Geom managed by this GLGeomLibrary. * @param index - The index of the geom to retrieve * @return - The return value. */ getGeomOffsetAndCount(index: number): number[]; /** * Returns a Geom managed by this GLGeomLibrary. * @param {number} index - The index of the geom to retrieve * @return {array} - The return value. */ getGeomBuffers(index: number): GeomBuffers; /** * Allocates space for the geomBuffers for the specified geometry * @param index - The index of the geom to upload */ private allocateBuffers; /** * Generates the GPU buffers required to store all the geometries */ private genAttributesBuffers; /** * Generates a single GPU buffer */ private genAttributesBuffer; private genIndicesBuffers; /** * The uploadBuffers method. * @param index - The index of the geom to upload */ private uploadBuffers; /** * Cleans the state of this GeomSet during rendering. */ private cleanGeomBuffers; calcMemoryAllocation(): { attrs: {}; indices: {}; }; private resetBindings; /** * The bind method. * @param renderstate - The renderstate value. * @return - Returns true if binding was successful */ bind(renderstate: RenderState): boolean; /** * The unbind method. * @param renderstate - The object tracking the current state of the renderer */ unbind(renderstate: RenderState): void; /** * The clearBuffers method. */ clearBuffers(): void; /** * The destroy is called by the system to cause explicit resources cleanup. * Users should never need to call this method directly. */ destroy(): void; } /** Class representing GL shader materials. * @private */ declare class GLShaderGeomSets extends EventEmitter { private renderer; private gl; private glShader; private glGeomItemSets; /** * Create a GL shader material. * @param pass - The pass that owns this object. * @param gl - The glShader value. * @param shaders - The shader value. */ constructor(renderer: GLRenderer, gl: WebGL12RenderingContext, glShader: GLShader); /** * Given a GeomItem, constructs the GLGeomItemSet that handles drawing that type of geometry. * @param geom - The geomitem value. * @return - The return value. * */ private getOrCreateGLGeomItemSet; /** * The addGLGeomItem method. * @param glGeomItem - The glGeomItem value. */ addGLGeomItem(glGeomItem: GLGeomItem): void; /** * Called by the GLPass to remove an item from this GLShaderGeomSets object. * @param glGeomItem - The glGeomItem value. */ removeGLGeomItem(glGeomItem: GLGeomItem): void; /** * Binds one of its shaders for rendering, and also the other textures and values needed. * @param glShader - The shader to bind * @param renderstate - The render state for the current draw traversal * @param key - The key to use to cache the shader binding. * @private */ private bindShader; /** * Draws all elements, binding the shader and continuing into the GLGLGeomSetGeomItemSets * @param renderstate - The render state for the current draw traversal */ draw(renderstate: ColorRenderState): void; /** * The drawHighlightedGeoms method. * @param renderstate - The object tracking the current state of the renderer */ drawHighlightedGeoms(renderstate: HighlightRenderState): void; /** * The drawGeomData method. * @param renderstate - The object tracking the current state of the renderer */ drawGeomData(renderstate: GeomDataRenderState): void; /** * Sorts the drawn items in order furthest to nearest when rendering transparent objects. * @param viewPos - The position of the camera that we are sorting relative to. */ sortItems(viewPos: Vec3): void; } declare class Vec3Ref { data: Uint8Array | Int8Array | Uint16Array | Float32Array; constructor(data: Uint8Array | Int8Array | Uint16Array | Float32Array); get x(): number; set x(value: number); get y(): number; set y(value: number); get z(): number; set z(value: number); set(x: number, y: number, z: number): void; } /** * Class representing an attribute. */ declare class Vec3Attribute extends Attribute { /** * Create a Vec3Attribute. */ constructor(dataTypeName?: string); /** * Returns a copy of the Vec3 value at the specified index. * * @param index - The index value. * @return Vec3 - The value at the specified index. */ getValue(index: number): Vec3; /** * Returns a copy of the Vec3 value at the specified index. * * @deprecated - This method will soon be removed. * @return Vec3 - The value at the specified index. */ getValueRef(index: number): Vec3Ref; /** * Sets Vec3 at the specified index. * * @param index - The index value. * @param value - The value param. */ setValue(index: number, value: Vec3): void; /** * Gets the value of a corner vertex of a face. * > Note: 'Ref' means that the value contains a reference to the data in the attribute. * > The components of the value can be changed causing the attributes data is changed. * > No need to call 'setFaceVertexValue'. * @param face - The face index. * @param faceVertex - The index of vertex within the face. [0... num face vertices] * @return - The return value. */ getFaceVertexValue(face: number, faceVertex: number): Vec3; /** * Sets the value of a corner vertex of a face. * @param face - The face index. * @param faceVertex - The index of vertex within the face. [0... num face vertices] * @param value - The value value. */ setFaceVertexValue(face: number, faceVertex: number, value: Vec3): void; /** * The setSplitVertexValue method. * @param vertex - The vertex value. * @param face - The face index. * @param value - The value value. */ setSplitVertexValue(vertex: number, face: number, value: Vec3): void; merge(other: Vec3Attribute, xfo?: Xfo): void; } /** * The Mesh class provides a flexible and fast polygon mesh representation. It supports polygons of arbitrary complexity, * from basic triangles and quads to pentagons more. * It supports storing per face attributes, and per edge attributes. * The Mesh class handles converting its internal representation of polygons into a simpler triangles representation for rendering. * * ``` * const mesh = new Mesh() * ``` * * **Events** * * **geomDataTopologyChanged:** Triggered when the topology of the mesh has been changed. * * **geomDataChanged:** Triggered when the vertices of the mesh have changed, but not necessarily the topology. * * @extends BaseGeom */ declare class Mesh extends BaseGeom { protected faceCounts: Array; protected faceVertexIndices: Uint32Array; protected __logTopologyWarnings: boolean; protected __edgeAttributes: Map; protected __faceAttributes: Map; protected numEdges: number; edgeVerts: Array; protected edgeAngles: Float32Array; protected edgeVecs: Array; protected edgeFaces: Array; protected faceEdges: Array>; protected vertexEdges: Array>; /** * Creates an instance of Mesh. */ constructor(); /** * The clear method. */ clear(): void; /** * Adds a new vertex attribute to the geometry. * * @param name - The name of the vertex attribute. * @param attr - The attribute to add to the geometry */ addVertexAttribute(name: string, attr: Attribute): void; /** * The getFaceCounts method. * @return - The return value. */ getFaceCounts(): Array; /** * The getNumFaces method. * @return - The return value. */ getNumFaces(): number; /** * The getNumTriangles method. * @return {number} - The return value. */ getNumTriangles(): number; /** * Sets the number of faces on the mesh using an array specifying the counts per polygon size. * The first item in the array specifies the number of triangles, the second, the number of quads, the 3rd, the number of 5 sided polygons etc.. * e.g. to specify 2 triangles, and 7 quads, we would pass [2, 7] * @param faceCounts - The faceCounts value. */ setFaceCounts(faceCounts: Array): void; /** * Returns the number of face vertices * @return - The return value. */ getNumFaceVertices(): number; /** * Returns the number of vertices indexed by this face * @param faceIndex - The faceIndex value. * @return - The return value. */ getFaceVertexCount(faceIndex: number): number; private getFaceVertexOffset; /** * The setFaceVertexIndices method. * @param faceIndex - The faceIndex value. * @param vertexIndices - The array of vertex indices for this face value. */ setFaceVertexIndices(faceIndex: number, vertexIndices: Array): void; /** * Adds a new face to the mesh * @param vertexIndices - The vertex indices of the face. * @return - The index of the face in the mesh. */ addFace(vertexIndices: number[]): number; /** * Returns the vertex indices of the specified face. * @param faceIndex - The index of the specified face * @return - An array of indices into the vertex attributes */ getFaceVertexIndices(faceIndex: number): number[]; /** * Returns a single vertex index for a given face and faceVertex. * @param faceIndex - The faceIndex value. * @param faceVertex - The face vertex is the index within the face. So the first vertex index is 0. * @return - The vertex index */ getFaceVertexIndex(faceIndex: number, faceVertex: number): number; /** * The addFaceAttribute method. * @param name - The name of the face attribute to add. * @param attr - The attr value */ addFaceAttribute(name: string, attr: Attribute): Attribute; /** * The hasFaceAttribute method. * @param name - The name of the face attribute. * @return - The return value. */ hasFaceAttribute(name: string): boolean; /** * The getFaceAttribute method. * @param name - The name of the face attribute. * @return - The return value. */ getFaceAttribute(name: string): Attribute; /** * The addEdgeAttribute method. * @param name - The name of the edge attribute to add. * @param attr - The attr value */ addEdgeAttribute(name: string, attr: Attribute): void; /** * The hasEdgeAttribute method. * @param name - The name of the edge attribute. * @return - The return value. */ hasEdgeAttribute(name: string): boolean; /** * The getEdgeAttribute method. * @param name - The name of the edge attribute. * @return - The return value. */ getEdgeAttribute(name: string): Attribute | undefined; /** * The genTopologyInfo method. */ genTopologyInfo(): void; /** * Computes a normal value per face by averaging the triangle normals of the face. */ computeFaceNormals(): void; /** * Calculates the angles at each edge between the adjoining faces */ calculateEdgeAngles(): void; /** * Compute vertex normals. * @param hardAngle - The hardAngle value in radians. * @return - The return value. */ computeVertexNormals(hardAngle?: number): Vec3Attribute; /** * The computeHardEdgesIndices method. * @param hardAngle - The hardAngle value in radians. * @return - The return value. */ computeHardEdgesIndices(hardAngle?: number): Uint32Array; /** * Merges a separate geometry into this one. Similar to a 'union' boolean operation. * @param other the other geom that will be merged into this one * @param xfo the transformation to be applied to the other geom as it is merged in. */ merge(other: Mesh, xfo?: Xfo): void; /** * The genBuffers method. * @param opts - The opts value. * @return - The return value. */ genBuffers(opts?: Record): GeomBuffers; /** * Compute the number of triangles. For higher degree polygons, they are divided into multiple triangles for rendering. * @return - Returns the number of triangles. */ computeNumTriangles(): number; /** * To prepare data for rendering, the indices for the polygons is used to compute a new index buffer based on * only triangles. This is used during rendering and the resulting indices uploaded ot the GPU by GLMesh class. * * @param totalNumVertices - The total number of vertices. * @param numUnSplitVertices - The total number of un-split vertices. * @param splitIndices - The splitIndices value. * @return - Returns a typed array containing the triangulated indices. */ generateTriangulatedIndices(totalNumVertices: number, numUnSplitVertices: number, splitIndices: Record>): Uint8Array | Uint16Array | Uint32Array; /** * Restores mesh properties from a binary reader. * * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context?: Record): void; /** * The toJSON method encodes this type as a json object for persistence. * * @param context - The context value. * @return - Returns the json object. */ toJSON(context?: Record): Record; /** * The fromJSON method decodes a json object for this type. * * e.g. to load data into the mesh class, provide a json structure similar to the following. * Note: faceCounts is an array of count values, starting with the number of triangles, then the number of quads. See #setFaceCounts * The faceVertexIndices array should also be sorted to contain all the triangles first, followed by the quads, and then the pentagons etc.. * ```json * // This code will define a mesh made up of 2 triangles and then a quad. * const mesh = new Mesh() * mesh.fromJSON({ * faceCounts:[2, 1], * faceVertexIndices: [0, 1, 2, 0, 2, 3, 3, 2, 4, 5], * numVertices: 6, * vertexAttributes: { * positions: { * dataType: 'Vec3' * defaultScalarValue: 0.0, * data: [0,0,0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 2, 1, 0, 2, 0, 0] * } * } * } * ``` * * @param j - The json object this item must decode. * @param context - The context value. */ fromJSON(j: Record, context?: Record): void; } declare class Attribute extends BaseClass { dataTypeName: string; stride: number; initValue: number; protected normalized: boolean; protected data: Uint8Array | Int8Array | Uint16Array | Float32Array; protected mesh: Mesh; protected splitValues: Array>; protected splits: Record>; constructor(dataTypeName: string, stride: number, initValue?: number); protected init(): void; /** * Sets the Mesh reference to the VertexAttribute. This is needed for attributes * assigned to meshes, and is used to calculate face vertex indices. * > Note: the mesh automatically calls this method when a vertex attribute is assigned. * * @param mesh - The mesh object */ setMesh(mesh: Mesh): void; /** * Returns the backing array for this attribute * * @return - The return value. */ asArray(): Uint8Array | Int8Array | Uint16Array | Float32Array; /** * Returns the name of the math type this attribute stores. * * @return - The return value. */ getDataTypeName(): string; /** * Returns the count of attribute values in the data. * * @return - The return value. */ getCount(): number; /** * Returns the count of attribute values in the data. * * @return - The return value. */ get count(): number; /** * Sets the count of attribute values in the data. * * @param size - The size value. */ setCount(count: number): void; /** * Fills up data values with default ones starting from the specified index. * * @param start - The start value. */ protected initRange(start: number): void; protected isInitialized(a: ArrayLike): boolean; /** * Returns the number of elements stored in each `T`. * * @return - The return value. */ get numElements(): number; /** * Returns data value of the specified index. * * @param index - The index value. * @return - The return value. */ getFloat32Value(index: number): number; /** * Sets data value in the specified index. * * @param index - The index value. * @param value - The value param. */ setFloat32Value(index: number, value: number): void; /** * Sets data values in the specified index. */ getValues(index: number): Uint8Array | Int8Array | Uint16Array | Float32Array; /** * Sets data values in the specified index. */ setValues(index: number, values: number[] | Uint8Array | Int8Array | Uint16Array | Float32Array): void; merge(other: Attribute, xfo?: Xfo): void; /** * The getSplits method. * @return - The return value. */ getSplits(): Record>; /** * Gets the value of a corner vertex of a face. * @param face - The face index. * @param faceVertex - The index of vertex within the face. [0... num face vertices] * @return - The return value. */ getFaceVertexValue_array(face: number, faceVertex: number): Uint8Array | Int8Array | Uint16Array | Float32Array | ArrayLike; /** * Sets the value of a corner vertex of a face. * @param face - The face index. * @param faceVertex - The index of vertex within the face. [0... num face vertices] * @param value - The value value. */ setFaceVertexValue_array(face: number, faceVertex: number, value: ArrayLike): void; /** * The setFaceVertexValue_ByVertexIndex method. * @param face - The face index. * @param vertex - The vertex value. * @param value - The value value. */ setFaceVertexValue_ByVertexIndex(face: number, vertex: number, value: ArrayLike): void; /** * The setSplitVertexValue method. * @param vertex - The vertex value. * @param face - The face index. * @param value - The value value. */ setSplitVertexValue_array(vertex: number, face: number, value: ArrayLike): void; /** * The setSplitVertexValues method. * @param vertex - The vertex value. * @param faceGroup - The faceGroup value. * @param value - The value value. */ setSplitVertexValues(vertex: number, faceGroup: number[], values: number[]): void; /** * The generateSplitValues method. * @param splitIndices - The splitIndices value. * @param splitCount - The splitCount value. * @return - The return value. */ generateSplitValues(splitIndices: Record>, splitCount: number): Uint8Array | Int8Array | Uint16Array | Float32Array; /** * The toJSON method encodes this type as a json object for persistence. * * @param context - The context value. * @return - Returns the json object. */ toJSON(context?: Record): Record; /** * The fromJSON method decodes a json object for this type. * * @param j - The json object this item must decode. */ fromJSON(j: Record): void; /** * The loadSplitValues method. * @param reader - The reader value. */ loadSplitValues(reader: BinReader): void; /** * Returns the string representation of the object's state. * * @return - The return value. */ toString(): string; /** * Returns vertex attributes buffers and its count. * * @return - The return value. */ genBuffer(): AttrBuffer; } /** * Represents a base class for 3D geometry items. * * **Events** * * **boundingBoxChanged:** Triggered when the bounding box changes. * * **geomDataChanged:** Emitted when the geometry attributes have changed. The topology did not change. The Renderer will upload the new attributes to the GPU. * * **geomDataTopologyChanged:** Emitted when the geometry attributes and topology have changed. The Renderer will upload the new attributes and topology to the GPU. * * @extends ParameterOwner */ declare class BaseGeom extends ParameterOwner { #private; protected boundingBox: Box3; protected boundingBoxDirty: boolean; protected __metaData: Map; protected __vertexAttributes: Map; debugColor: Color; /** * Create a base geom. */ constructor(); /** * Returns the current path of the item in the tree as an array of names. * * @return - Returns an array. */ getPath(): string[]; /** * The clear method. */ clear(): void; /** * Adds a new vertex attribute to the geometry. * * @param name - The name of the vertex attribute. * @param dataType - The dataType value. // TODO: is any ok vs. AttrValue | number. Unsure about how dataType is used * @return - Returns an attribute. */ addVertexAttribute(name: string, attr: Attribute): void; /** * Checks if the the geometry has an attribute with the specified name. * * @param name - The name of the vertex attribute. * @return - The return value. */ hasVertexAttribute(name: string): boolean; /** * Returns vertex attribute with the specified name. * * @param name - The name of the vertex attribute. * @return - The return value. */ getVertexAttribute(name: string): Attribute | undefined; /** * Returns all vertex attributes in an object with their names. * * @return - The return value. */ getVertexAttributes(): Record; /** * Returns 'positions' vertex attribute. */ get positions(): Vec3Attribute; /** * Returns the number of vertex attributes. * * @return - The return value. */ numVertices(): number; /** * Returns the number of vertex attributes. * * @return - The return value. */ getNumVertices(): number; /** * Sets the number of vertices the geometry has. * * @param count - The count value. */ setNumVertices(count: number): void; /** * Returns the bounding box for geometry. * @return - The return value. */ getBoundingBox(): Box3; /** * The setBoundingBoxDirty method. */ setBoundingBoxDirty(): void; /** * The updateBoundingBox method. */ updateBoundingBox(): void; /** * Merges a separate geometry into this one. Similar to a 'union' boolean operation. * @param other the other geom that will be merged into this one * @param xfo the transformation to be applied to the other geom as it is merged in. */ merge(other: BaseGeom, xfo?: Xfo): void; /** * Returns metadata value of the specified name. * * @param key - The key value. * @return - The return value. */ getMetadata(key: string): any; /** * Verifies if geometry's metadata contains a value with the specified key. * * @param key - The key value. * @return - The return value. */ hasMetadata(key: string): boolean; /** * Sets metadata value to the geometry. * * @param key - The key value. * @param metaData - The metaData value. */ setMetadata(key: string, metaData: Record): void; /** * Removes metadata value from the geometry with the specified key. * * @param key - The key value. */ deleteMetadata(key: string): void; /** * Returns vertex attributes buffers and its count. * @return - The return value. */ genBuffers(opts?: Record): GeomBuffers; /** * Once the buffers have been uploaded to the GPU, we are free to release them. * The GLGeomLibrary may call this function to let the geometry know it can release any handles. */ freeBuffers(): void; /** * Sets state of current Geometry(Including Vertices and Bounding Box) using a binary reader object. * * @param reader - The reader value. */ protected loadBaseGeomBinary(reader: BinReader, context?: Record): void; /** * The toJSON method encodes this type as a json object for persistence. * * @param context - The context value. * @return - Returns the json object. */ toJSON(context?: Record): Record; /** * The fromJSON method decodes a json object for this type. * * @param json - The json object this item must decode. * @param context - The context value. */ fromJSON(json: Record, context?: Record): void; /** * Returns geometry data value in json format. * * @return - The return value. */ toString(): string; } /** * Class representing an attribute. */ declare class Vec2Attribute extends Attribute { /** * Create a Vec2Attribute. */ constructor(dataTypeName?: string); /** * Returns the Vec2 from the specified index. * * @param index - The index value. * @return Vec2 - The return value. */ getValue(index: number): Vec2; /** * Sets Vec2 at the specified index. * * @param index - The index value. * @param value - The value param. */ setValue(index: number, value: Vec2): void; /** * Gets the value of a corner vertex of a face. * > Note: 'Ref' means that the value contains a reference to the data in the attribute. * > The components of the value can be changed causing the attributes data is changed. * > No need to call 'setFaceVertexValue'. * @param face - The face index. * @param faceVertex - The index of vertex within the face. [0... num face vertices] * @return - The return value. */ getFaceVertexValue(face: number, faceVertex: number): Vec2; /** * Sets the value of a corner vertex of a face. * @param face - The face index. * @param faceVertex - The index of vertex within the face. [0... num face vertices] * @param value - The value value. */ setFaceVertexValue(face: number, faceVertex: number, value: Vec2): void; /** * The setSplitVertexValue method. * @param vertex - The vertex value. * @param face - The face index. * @param value - The value value. */ setSplitVertexValue(vertex: number, face: number, value: Vec2): void; merge(other: Vec2Attribute, xfo?: Xfo): void; } /** * Class representing an attribute. */ declare class Vec4Attribute extends Attribute { /** * Create a Vec4Attribute. */ constructor(); /** * Returns a copy of the Vec4 value at the specified index. * * @param index - The index value. * @return Vec4 - The value at the specified index. */ getValue(index: number): Vec4; /** * Sets Vec4 at the specified index. * * @param index - The index value. * @param value - The value param. */ setValue(index: number, value: Vec4): void; /** * Gets the value of a corner vertex of a face. * > Note: 'Ref' means that the value contains a reference to the data in the attribute. * > The components of the value can be changed causing the attributes data is changed. * > No need to call 'setFaceVertexValue'. * @param face - The face index. * @param faceVertex - The index of vertex within the face. [0... num face vertices] * @return - The return value. */ getFaceVertexValue(face: number, faceVertex: number): Vec4; /** * Sets the value of a corner vertex of a face. * @param face - The face index. * @param faceVertex - The index of vertex within the face. [0... num face vertices] * @param value - The value value. */ setFaceVertexValue(face: number, faceVertex: number, value: Vec4): void; /** * The setSplitVertexValue method. * @param vertex - The vertex value. * @param face - The face index. * @param value - The value value. */ setSplitVertexValue(vertex: number, face: number, value: Vec4): void; merge(other: Vec4Attribute, xfo?: Xfo): void; } /** * Class representing an attribute. */ declare class ColorAttribute extends Attribute { /** * Create a ColorAttribute. */ constructor(); /** * Returns a copy of the Color value at the specified index. * * @param index - The index value. * @return Color - The return value. */ getValue(index: number): Color; /** * Sets Color at the specified index. * * @param index - The index value. * @param value - The value param. */ setValue(index: number, value: Color): void; /** * Gets the value of a corner vertex of a face. * > Note: 'Ref' means that the value contains a reference to the data in the attribute. * > The components of the value can be changed causing the attributes data is changed. * > No need to call 'setFaceVertexValue'. * @param face - The face index. * @param faceVertex - The index of vertex within the face. [0... num face vertices] * @return - The return value. */ getFaceVertexValue(face: number, faceVertex: number): Color; /** * Sets the value of a corner vertex of a face. * @param face - The face index. * @param faceVertex - The index of vertex within the face. [0... num face vertices] * @param value - The value value. */ setFaceVertexValue(face: number, faceVertex: number, value: Color): void; /** * The setSplitVertexValue method. * @param vertex - The vertex value. * @param face - The face index. * @param value - The value value. */ setSplitVertexValue(vertex: number, face: number, value: Color): void; merge(other: ColorAttribute, xfo?: Xfo): void; } /** * Class representing a point primitive drawing type, every vertex specified is a point. * * ``` * const points = new Points() * ``` * * * **Events** * * **boundingBoxChanged:** Triggered when the bounding box changes. * * @extends BaseGeom */ declare class Points extends BaseGeom { /** * Create points. */ constructor(); /** * The clear method. */ clear(): void; /** * Sets state of current geometry(Including line segments) using a binary reader object. * * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context: AssetLoadContext): void; } interface ImageParams { type: string; format: string; width: number; height: number; wrapS?: string; wrapT?: string; minFilter?: string; magFilter?: string; mipMapped?: boolean; data?: HTMLImageElement | HTMLVideoElement | Uint8Array | Float32Array | HTMLCanvasElement | ImageData | Record; exposure?: number; flipY?: boolean; alphaFromLuminance?: boolean; } /** * Represents a 2D image item, containing width and height. * * **Events** * * **updated:** Triggered when the value of any of the parameters listed above changes. * * @extends ParameterOwner */ declare class BaseImage extends ParameterOwner { width: number; height: number; format: string; type: string; loaded: boolean; mipMapped: boolean; wrapS: string; wrapT: string; minFilter: string; magFilter: string; alphaFromLuminance: boolean; /** * Creates an instance of BaseImage. * @param name - name of the item */ constructor(name?: string); /** * Returns true if loaded. * @private * @return - Returns a boolean. */ isLoaded(): boolean; /** * Returns all parameters and class state values. * * @return - The return value. */ getParams(): ImageParams; } declare class ImageArrayParameter extends Parameter { constructor(name?: string, value?: BaseImage[]); /** * The toJSON method encodes this type as a json object for persistence. * * @param context - The context value. * @return - Returns the json object. */ toJSON(context?: Record): Record; /** * The fromJSON method decodes a json object for this type. * * @param j - The json object this item must decode. * @param context - The context value. * @return - Returns the json object. */ fromJSON(j: Record, context: Record): void; clone(): ImageArrayParameter; } /** * @extends Points */ declare class FatPoints extends Points { sprites: ImageArrayParameter; /** * Create points. */ constructor(); } /** * * Class representing lines primitive drawing type, connecting vertices using the specified indices. * i.e. We have 4 points(vertices) but we don't know how they connect to each other, * and that's why we need indices(Numbers indicating which vertex connects to which). * In this case if we say that `indices` is `[0,1,2,3]`, it would connect the first vertex to the second, * and the third to the fourth. * * ``` * const lines = new Lines() * ``` * * **Events** * * **geomDataChanged:** Triggered when the data value of the geometry is set(This includes reading binary) * * @extends BaseGeom */ declare class Lines extends BaseGeom { protected __indices: Uint8Array | Uint16Array | Uint32Array; /** * Create lines. */ constructor(); /** * The clear method. */ clear(): void; /** * Returns the specified indices(Vertex connectors) * * @return - The indices index array. */ getIndices(): Float32Array | Int32Array | Int16Array | Int8Array | Uint8Array | Uint16Array | Uint32Array; /** * Returns the number of line segments. * * @return - Returns the number of segments. */ getNumSegments(): number; /** * Returns the number of line segments. * * @return - Returns the number of segments. */ getNumLineSegments(): number; /** * Sets the number of line segments in the lines geometry. * **Important:** It resets indices values. * * @param numOfSegments - The count value. */ setNumSegments(numOfSegments: number): void; /** * Sets segment values in the specified index. * * @param index - The index value. * @param p0 - The p0 value. * @param p1 - The p1 value. */ setSegmentVertexIndices(index: number, p0: number, p1: number): void; /** * The getSegmentVertexIndex method. * * @param line - The line value. * @param lineVertex - The lineVertex value. * @return - The return value. * @private */ getSegmentVertexIndex(line: number, lineVertex: number): number; /** * Merges a separate geometry into this one. Similar to a 'union' boolean operation. * @param other the other geom that will be merged into this one * @param xfo the transformation to be applied to the other geom as it is merged in. */ merge(other: Lines, xfo?: Xfo): void; /** * Returns vertex attributes buffers and its count. * * @return - The return value. */ genBuffers(opts?: Record): GeomBuffers; /** * Sets state of current geometry(Including line segments) using a binary reader object. * * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context?: Record): void; /** * The toJSON method encodes this type as a json object for persistence. * * @param context - The context value. * @return - Returns the json object. */ toJSON(context?: Record): Record; /** * The fromJSON method decodes a json object for this type. * * @param j - The json object this item must decode. * @param context - The context value. */ fromJSON(j: Record, context?: Record): void; } /** Class representing a material library in a scene tree. * @private */ declare class MaterialLibrary extends BaseItem { private assetItem; images: Record; materials: Array; private __materialsMap; constructor(assetItem: AssetItem); /** * The clear method. */ clear(): void; /** * The getPath method. * @return - The return value. */ getPath(): string[]; /** * The resolvePath method traverses the subtree from this item down * matching each name in the path with a child until it reaches the * end of the path. * * @param path - The path value. * @param index - The index value. * @return - The return value. */ resolvePath(path: string[], index?: number): BaseItem | null; /** * The getNumMaterials method. * @return - The return value. */ getNumMaterials(): number; /** * The getMaterials method. * @return - The return value. */ getMaterials(): Material[]; /** * The getMaterialNames method. * @return - The return value. */ getMaterialNames(): string[]; /** * The hasMaterial method. * @param name - The name value. * @return - The return value. */ hasMaterial(name: string): boolean; /** * Add a material. * @param material - The material value. */ addMaterial(material: Material): void; /** * The getMaterial method. * @param nameOrIndex - The material name or its index. * @param assert - The assert value. * @return - The return value. */ getMaterial(nameOrIndex: string | number): Material; /** * The hasImage method. * @param name - The material name. * @return - The return value. */ hasImage(name: string): boolean; /** * The addImage method. * @param image - The image value. */ addImage(image: BaseImage): void; /** * The getImage method. * @param name - The material name. * @param assert - The assert value. * @return - The return value. */ getImage(name: string, assert?: boolean): BaseImage; /** * The getImageNames method. * @return - The return value. */ getImageNames(): string[]; /** * The load method. * @param filePath - The file path. */ load(filePath: string): void; /** * The toJSON method encodes the current object as a json object. * @param context - The context value. * @return - Returns the json object. */ toJSON(context?: Record): Record; /** * The fromJSON method decodes a json object for this type. * @param j - The json object this item must decode. * @param context - The context value. */ fromJSON(j: Record, context?: Record): void; /** * The readBinary method. * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context: AssetLoadContext): void; /** * The toString method. * @return - The return value. */ toString(): string; } declare class SubGeom extends ParameterOwner { } /** * Class representing a point primitive drawing type, every vertex specified is a point. * * ``` * const compoundGeom = new CompoundGeom() * ``` * * * **Events** * * **boundingBoxChanged:** Triggered when the bounding box changes. * * @extends BaseProxy */ declare class CompoundGeom extends BaseProxy { materials: Array; subGeoms: Array; private counts; private materialGroupsDirty; /** * Create points. */ constructor(data?: any, materialLibrary?: MaterialLibrary); /** * Returns the number of faces, edges and point sub-geoms in this compound geom. * * @return - The return value. */ getNumSubGeoms(): number; /** * Returns the number of Face sub-geoms in this compound geom. * * @return - The return value. */ getNumFaces(): number; /** * Returns the number of Edge sub-geoms in this compound geom. * * @return - The return value. */ getNumEdges(): number; /** * Returns the number of triangles in this compound geom. * * @return - The return value. */ getNumTriangles(): number; /** * Returns the number line segments in this lines proxy geometry * * @return - The return value. */ getNumLineSegments(): number; /** * Returns the number line segments in this lines proxy geometry * * @return - The return value. */ getNumPoints(): number; getSubGeomMaterial(subGeomId: number): Material | undefined; /** * Assigns a material to a sub-geom by ID; * @param subGeomId - The ID of the sub-geom to assign the material. * @param material - The material to assign. */ setSubGeomMaterial(subGeomId: number, material: Material): void; /** * Assigns a material to a sub-geom by ID; * @deprecated * Please use: setSubGeomMaterial * @param subGeomId - The ID of the sub-geom to assign the material. * @param material - The material to assign. */ assignSubGeomMaterial(subGeomId: number, material: Material): void; /** * Clears all sub--geom material assignments. This means the geometry will be drawn * using only the material of the GeomItem or CADBody. */ clearMaterials(): void; /** * Each subgeom may be a assigned a different material. * * We calculate groups that enable multiple subgeoms to * be rendered at once using the same material id. * Note: this is an optimization that only applies when * rendering geoms in non-shattered mode. */ private calcMaterialGroups; /** * The genBuffers method. * @return - The return value. */ genBuffers(): any; /** * The toJSON method encodes this type as a json object for persistence. * * @param context - The context value. * @return - Returns the json object. */ toJSON(context?: Record): Record; /** * The fromJSON method decodes a json object for this type. * * @param json - The json object this item must decode. * @param context - The context value. */ fromJSON(json: Record, context?: AssetLoadContext): void; /** * Sets state of current geometry(Including line segments) using a binary reader object. * * @param reader - The reader value. * @param context - The context value. */ loadMetadata(metadataReader: BinReader, context: AssetLoadContext): void; } /** * Base Class for procedural points generated by mathematical functions. * * @extends {Points} */ declare abstract class ProceduralPoints extends Points { dirtyTopology: boolean; dirtyVertices: boolean; topologyParams: string[]; /** * Creates an instance of ProceduralPoints. */ constructor(); abstract rebuild(): void; abstract resize(): void; /** * This method can be overridden in derived classes * to perform general updates (see GLPass or BaseItem). * @param event - The event object emitted by the parameter. * @private */ protected parameterValueChanged(event: Record): void; /** * If the Procedural geometry is out of date, for example if a parameter has been changed, * this method explicitly forces the geometry to be recomputed. */ update(): void; /** * Returns the bounding box for geometry. * @return - The return value. */ getBoundingBox(): Box3; /** * Returns the number of vertex attributes. * * @return - The return value. */ getNumVertices(): number; /** * The genBuffers method. * @param opts - The opts value. * @return - The return value. */ genBuffers(opts?: Record): GeomBuffers; /** * The toJSON method encodes this type as a json object for persistence. * * @param context - The context value. * @return - Returns the json object. */ toJSON(context?: Record): Record; } /** * Base Class for procedural lines generated by mathematical functions. * * @extends {Lines} */ declare abstract class ProceduralLines extends Lines { dirtyTopology: boolean; dirtyVertices: boolean; topologyParams: string[]; /** * Creates an instance of ProceduralLines. */ constructor(); abstract rebuild(): void; abstract resize(): void; /** * This method can be overridden in derived classes * to perform general updates (see GLPass or BaseItem). * @param event - The event object emitted by the parameter. * @private */ protected parameterValueChanged(event: Record): void; /** * If the Procedural geometry is out of date, for example if a parameter has been changed, * this method explicitly forces the geometry to be recomputed. */ update(): void; /** * Returns the bounding box for geometry. * @return - The return value. */ getBoundingBox(): Box3; /** * Returns the number of vertex attributes. * * @return - The return value. */ getNumVertices(): number; /** * The genBuffers method. * @param opts - The opts value. * @return - The return value. */ genBuffers(opts?: Record): GeomBuffers; /** * The toJSON method encodes this type as a json object for persistence. * * @param context - The context value. * @return - Returns the json object. */ toJSON(context?: Record): Record; } /** * Base Class for procedural meshes generated by mathematical functions. * * @extends {Mesh} */ declare abstract class ProceduralMesh extends Mesh { dirtyTopology: boolean; dirtyVertices: boolean; topologyParams: string[]; /** * Creates an instance of ProceduralMesh. */ constructor(); abstract rebuild(): void; abstract resize(): void; /** * This method can be overridden in derived classes * to perform general updates (see GLPass or BaseItem). * @param event - The event object emitted by the parameter. * @private */ protected parameterValueChanged(event: Record): void; /** * If the Procedural geometry is out of date, for example if a parameter has been changed, * this method explicitly forces the geometry to be recomputed. */ update(): void; /** * Returns the bounding box for geometry. * @return - The return value. */ getBoundingBox(): Box3; /** * Returns the number of vertex attributes. * * @return - The return value. */ getNumVertices(): number; /** * Compute vertex normals. * @param hardAngle - The hardAngle value in radians. * @return - The return value. */ computeVertexNormals(hardAngle?: number): Vec3Attribute; /** * The computeHardEdgesIndices method. * @param hardAngle - The hardAngle value in radians. * @return - The return value. */ computeHardEdgesIndices(hardAngle?: number): Uint32Array; /** * The genBuffers method. * @param opts - The opts value. * @return - The return value. */ genBuffers(opts?: Record): GeomBuffers; /** * The toJSON method encodes this type as a json object for persistence. * * @param context - The context value. * @return - Returns the json object. */ toJSON(context?: Record): Record; } /** * Represents an ordered grid of points along `X` and `Y` axes. * * ``` * const pointGrid = new PointGrid(2.2, 1.5, 12, 12) * ``` * * **Parameters** * * **X(`NumberParameter`):** Length of the grid along the `X` axis. * * **Y(`NumberParameter`):** Length of the grid along the `Y` axis. * * **XDivisions(`NumberParameter`):** Number of divisions along `X` axis * * **YDivisions(`NumberParameter`):** Number of divisions along `Y` axis * @extends {ProceduralPoints} */ declare class PointGrid extends ProceduralPoints { /** * @member sizeXParam - Length of the grid along the `X` axis. */ sizeXParam: NumberParameter; /** * @member sizeYParam - Length of the grid along the `Y` axis. */ sizeYParam: NumberParameter; /** * @member divisionsXParam - Number of divisions along `X` axis */ divisionsXParam: NumberParameter; /** * @member divisionsYParam - Number of divisions along `Y` axis */ divisionsYParam: NumberParameter; /** * Creates an instance of PointGrid. * * @param x - The length of the point grid along the X axis. * @param y - The length of the point grid along the Y axis. * @param xDivisions - The number of divisions along the X axis. * @param yDivisions - The number of divisions along the Y axis. * @param addTextureCoords - The addTextureCoords value. */ constructor(x?: number, y?: number, xDivisions?: number, yDivisions?: number); /** * The rebuild method. * @private */ rebuild(): void; /** * The resize method. * @private */ resize(): void; } /** * A class for generating a rectangle shape. * * ``` * const rect = new Rect(1.5, 2.0) * ``` * * **Parameters** * * **X(`NumberParameter`):** Length of the rectangle along the `X` axis. * * **Y(`NumberParameter`):** Length of the rectangle along the `Y` axis. * * * @extends {ProceduralLines} */ declare class Rect extends ProceduralLines { /** * @member sizeXParam - Length of the rectangle along the `X` axis. */ sizeXParam: NumberParameter; /** * @member sizeYParam - Length of the rectangle along the `Y` axis. */ sizeYParam: NumberParameter; /** * Create a rect. * @param x - The length of the rect along the `X` axis. * @param y - The length of the rect along the `Y` axis. */ constructor(x?: number, y?: number); /** * The rebuild method. * @private */ rebuild(): void; /** * The resize method. * @private */ resize(): void; } /** * A class for generating a circle shape using line segments. * * ``` * const circle = new Circle(2.2, 12) * ``` * * **Parameters** * * **Radius(`NumberParameter`):** Radius of the circle. * * **Angle(`NumberParameter`):** Number of segments used to build the circle. * * **Sides(`NumberParameter`):** Segments angle in radiants. * * @extends {ProceduralLines} */ declare class Circle extends ProceduralLines { /** * @member angleParam - TODO */ angleParam: AngleParameter; /** * @member sidesParam - The number of sides that compose the circle (e.g. 3 creates a triangle) */ sidesParam: NumberParameter; /** * @member radiusParam - The radius of the circle */ radiusParam: NumberParameter; /** * Creates an instance of Circle. * @param radius - The radius of the circle. * @param sides - The number of segments. * @param angle - Arc segments angle(radians) */ constructor(radius?: number, sides?: number, angle?: number); /** * The rebuild method. * @private */ rebuild(): void; /** * The resize method. * @private */ resize(): void; } /** * A class for generating a cross shape, drawing a line on the `X,Y,Z` axes. * The axis line length is the `size` you specify, but the middle of the line is positioned in the coordinate `(0, 0, 0)` . * Meaning that half of the line goes negative and half goes positive. * * ``` * const cross = new Cross(1.5) * ``` * * **Parameters** * * **Size(`NumberParameter`):** Specifies the size of the cross. * * @extends {ProceduralLines} */ declare class Cross extends ProceduralLines { /** * @member sizeParam - Specifies the size of the cross. */ sizeParam: NumberParameter; /** * Create a cross. * @param size - The size of the cross. */ constructor(size?: number); /** * The rebuild method. * @private */ rebuild(): void; /** * The resize method. * @private */ resize(): void; } /** * A class for generating a lines cuboid shape(Without faces). * * **Parameters** * * **X(`NumberParameter`):** Length of the line cuboid along the `X` axis * * **Y(`NumberParameter`):** Length of the line cuboid along the `Y` axis * * **Z(`NumberParameter`):** Length of the line cuboid along the `Z` axis * * **BaseZAtZero(`NumberParameter`):** Property to start or not `Z` axis from position `0. * * @extends {ProceduralLines} */ declare class LinesCuboid extends ProceduralLines { /** * @member baseZAtZeroParam - Property to start or not `Z` axis from position `0. */ baseZAtZeroParam: BooleanParameter; /** * @member sizeXParam - Length of the line cuboid along the `X` axis */ sizeXParam: NumberParameter; /** * @member sizeYParam - Length of the line cuboid along the `Y` axis */ sizeYParam: NumberParameter; /** * @member sizeZParam - Length of the line cuboid along the `Z` axis */ sizeZParam: NumberParameter; /** * Create a lines cuboid. * @param x - The length of the line cuboid along the X axis. * @param y - The length of the line cuboid along the Y axis. * @param z - The length of the line cuboid along the Z axis. * @param baseZAtZero - The baseZAtZero value. */ constructor(x?: number, y?: number, z?: number, baseZAtZero?: boolean); /** * The rebuild method. * @private */ rebuild(): void; /** * The resize method. * * @private */ resize(): void; } /** * A class for generating a sphere made up of 3 circles, one on each plane: XY, YZ, XZ. * * ``` * const linesSphere = new LinesSphere(2.2, 12) * ``` * * **Parameters** * * **Radius(`NumberParameter`):** Radius of the circle. * * **Sides(`NumberParameter`):** Segments angle in radiants. * * @extends {ProceduralLines} */ declare class LinesSphere extends ProceduralLines { /** * @member radiusParam - The radius of the circle */ radiusParam: NumberParameter; /** * @member sidesParam - The number of sides that compose the circle (e.g. 3 creates a triangle) */ sidesParam: NumberParameter; /** * Creates an instance of LinesSphere. * @param radius - The radius of the circle. * @param sides - The number of segments. * @param angle - Arc segments angle(radians) */ constructor(radius?: number, sides?: number); /** * The rebuild method. * @private */ rebuild(): void; /** * The resize method. * @private */ resize(): void; } /** * Represents a network of lines that cross each other to form a series of squares or rectangles. * * ``` * const grid = new Grid(5, 5, 50, 50, true) * ``` * * **Parameters** * * **X(`NumberParameter`):** Length of the grid along the `X` axis. * * **Y(`NumberParameter`):** Length of the grid along the `Y` axis. * * **XDivisions(`NumberParameter`):** Number of divisions along `X` axis * * **YDivisions(`NumberParameter`):** Number of divisions along `Y` axis * * **SkipCenterLines(`BooleanParameter`):** Property that indicates whether to display the center grid lines or not * * @extends {ProceduralLines} */ declare class Grid extends ProceduralLines { /** * @member sizeXParam - Length of the grid along the `X` axis. */ sizeXParam: NumberParameter; /** * @member sizeYParam - Length of the grid along the `Y` axis. */ sizeYParam: NumberParameter; /** * @member divisionsXParam - Number of divisions along `X` axis */ divisionsXParam: NumberParameter; /** * @member divisionsYParam - Number of divisions along `Y` axis */ divisionsYParam: NumberParameter; /** * @member skipCenterLinesParam - Property that indicates whether to display the center grid lines or not */ skipCenterLinesParam: BooleanParameter; /** * Create a grid. * @param x - The length of the grid along the `X` axis. * @param y - The length of the grid along the `Y` axis. * @param xDivisions - The number of divisions along `X` axis. * @param yDivisions - The number of divisions along `Y` axis. * @param skipCenterLines - A boolean indicating whether to display the center grid lines or not. */ constructor(x?: number, y?: number, xDivisions?: number, yDivisions?: number, skipCenterLines?: boolean); /** * The rebuild method. * @private */ rebuild(): void; /** * The resize method. * @private */ resize(): void; } /** * Represents a cone geometry. * * ``` * const cone = new Cone(1.2, 4.0) * ``` * * **Parameters** * * **Radius(`NumberParameter`):** Specifies the radius of the base of the cone. * * **Height(`NumberParameter`):** Specifies the height of the cone. * * **Detail(`NumberParameter`):** Specifies the number of subdivisions around the `Z` axis. * * **Cap(`BooleanParameter`):** Specifies whether the base of the cone is capped or open. * * @extends {ProceduralMesh} */ declare class Cone extends ProceduralMesh { /** * @member capParam - Specifies whether the base of the cone is capped or open. */ capParam: BooleanParameter; /** * @member detailParam - Specifies the number of subdivisions around the `Z` axis. */ detailParam: NumberParameter; /** * @member heightParam - Specifies the height of the cone. */ heightParam: NumberParameter; /** * @member radiusParam - Specifies the radius of the base of the cone. */ radiusParam: NumberParameter; /** * Create a cone. * @param radius - The radius of the base of the cone. * @param height - The height of the cone. * @param detail - The detail of the cone. * @param cap - A boolean indicating whether the base of the cone is capped or open. * @param addNormals - Compute vertex normals for the geometry * @param addTextureCoords - Compute texture coordinates for the geometry */ constructor(radius?: number, height?: number, detail?: number, cap?: boolean, addNormals?: boolean, addTextureCoords?: boolean); /** * The rebuild method. * @private */ rebuild(): void; /** * The resize method. * @private */ resize(): void; } /** * A class for generating a cuboid geometry. * * **Parameters** * * **x(`NumberParameter`):** Length of the line cuboid along the `X` axis * * **y(`NumberParameter`):** Length of the line cuboid along the `Y` axis * * **z(`NumberParameter`):** Length of the line cuboid along the `Z` axis * * **BaseZAtZero(`NumberParameter`):** Property to start or not `Z` axis from position `0. * * @extends {ProceduralMesh} */ declare class Cuboid extends ProceduralMesh { /** * @member baseZAtZeroParam - Property to start or not `Z` axis from position `0. */ baseZAtZeroParam: BooleanParameter; /** * @member sizeXParam - Length of the line cuboid along the `X` axis */ sizeXParam: NumberParameter; /** * @member sizeYParam - Length of the line cuboid along the `Y` axis */ sizeYParam: NumberParameter; /** * @member sizeZParam - Length of the line cuboid along the `Z` axis */ sizeZParam: NumberParameter; /** * Create a cuboid. * @param x - The length of the cuboid along the X axis. * @param y - The length of the cuboid along the Y axis. * @param z - The length of the cuboid along the Z axis. * @param baseZAtZero - The baseZAtZero value. */ constructor(x?: number, y?: number, z?: number, baseZAtZero?: boolean); /** * The rebuild method. * @private */ rebuild(): void; /** * The resize method. * @private */ resize(): void; } /** * A class for generating a cylinder geometry. It is very much like a cuboid but with `N` number of sides. * * ``` * const cylinder = new Cylinder(1.5, 2.0, 6) * ``` * * **Parameters** * * **Radius(`NumberParameter`):** Specifies the radius of the cylinder. * * **Height(`NumberParameter`):** Specifies the height of the cone. * * **Sides(`NumberParameter`):** Specifies the number of subdivisions around the `Z` axis. * * **Loops(`NumberParameter`):** Specifies the number of subdivisions(stacks) on the `Z` axis. * * **Caps(`BooleanParameter`):** Specifies whether the ends of the cylinder are capped or open. * * **BaseZAtZero(`BooleanParameter`):** Property to start or not `Z` axis from position `0. * * @extends {ProceduralMesh} */ declare class Cylinder extends ProceduralMesh { /** * @member baseZAtZeroParam - Property to start or not `Z` axis from position `0. */ baseZAtZeroParam: BooleanParameter; /** * @member capsParam - Specifies whether the ends of the cylinder are capped or open. */ capsParam: BooleanParameter; /** * @member heightParam - Specifies the height of the cone. */ heightParam: NumberParameter; /** * @member radiusParam - Specifies the radius of the cylinder. */ radiusParam: NumberParameter; /** * @member loopsParam - Specifies the number of subdivisions(stacks) on the `Z` axis. */ loopsParam: NumberParameter; /** * @member sidesParam - Specifies the number of subdivisions around the `Z` axis. */ sidesParam: NumberParameter; /** * Create a cylinder. * @param radius - The radius of the cylinder. * @param height - The height of the cylinder. * @param sides - The number of sides. * @param loops - The number of loops. * @param caps - A boolean indicating whether the ends of the cylinder are capped or open. * @param baseZAtZero - The baseZAtZero value. */ constructor(radius?: number, height?: number, sides?: number, loops?: number, caps?: boolean, baseZAtZero?: boolean, addNormals?: boolean, addTextureCoords?: boolean); /** * The rebuild method. * @private */ rebuild(): void; /** * The resize method. * @private */ resize(): void; } /** * A class for generating a disc geometry. * * ``` * const disc = new Disc(2.0, 22) * ``` * * **Parameters** * * **Radius(`NumberParameter`):** Specifies the radius of the disc. * * **Sides(`NumberParameter`):** Specifies the resolution, or the disc subdivisions around `Z` axis. * * @extends {ProceduralMesh} */ declare class Disc extends ProceduralMesh { /** * @member radiusParam - Specifies the radius of the disc. */ radiusParam: NumberParameter; /** * @member sidesParam - Specifies the resolution, or the disc subdivisions around `Z` axis. */ sidesParam: NumberParameter; /** * Creates an instance of Disc. * * @param radius - The radius of the disc. * @param sides - The number of sides. */ constructor(radius?: number, sides?: number); /** * The rebuild method. * @private */ rebuild(): void; /** * The resize method. * @private */ resize(): void; } /** * A class for generating a plane geometry. * * ``` * const plane = new Plane(2.0, 1.5, 10, 10) * ``` * * **Parameters** * * **SizeX(`NumberParameter`):** Length of the plane along `X` axis. * * **SizeY(`NumberParameter`):** Length of the plane along `Y` axis. * * **DetailX(`NumberParameter`):** Number of divisions along `X`axis. * * **DetailY(`NumberParameter`):** Number of divisions along `Y`axis. * * @extends {ProceduralMesh} */ declare class Plane extends ProceduralMesh { /** * @member sizeXParam - Number of divisions along `X`axis. */ sizeXParam: NumberParameter; /** * @member sizeYParam - Number of divisions along `Y`axis. */ sizeYParam: NumberParameter; /** * @member detailXParam - Length of the plane along `X` axis. */ detailXParam: NumberParameter; /** * @member detailYParam - Length of the plane along `Y` axis. */ detailYParam: NumberParameter; /** * Create a plane. * @param SizeX - The length of the plane along the X axis. * @param SizeY - The length of the plane along the Y axis. * @param DetailX - The number of divisions along the X axis. * @param DetailY - The number of divisions along the Y axis. * @param addNormals - The addNormals value. * @param addTextureCoords - The addTextureCoords value. */ constructor(SizeX?: number, SizeY?: number, DetailX?: number, DetailY?: number, addNormals?: boolean, addTextureCoords?: boolean); /** * The rebuild method. * @private */ rebuild(): void; /** * The resize method. * * @private */ resize(): void; } /** * A class for generating a sphere geometry. * * ``` * const sphere = new Sphere(1.4, 13) * ``` * * **Parameters** * * **Radius(`NumberParameter`):** Radius of the sphere. * * **Sides(`NumberParameter`):** Specifies the number of subdivisions around the `Z` axis. * * **Loops(`NumberParameter`):** Specifies the number of subdivisions(stacks) along the `Z` axis. * * @extends {ProceduralMesh} */ declare class Sphere extends ProceduralMesh { /** * @member radiusParam - Radius of the sphere. */ radiusParam: NumberParameter; /** * @member sidesParam - Specifies the number of subdivisions around the `Z` axis. */ sidesParam: NumberParameter; /** * @member loopsParam - Specifies the number of subdivisions(stacks) along the `Z` axis. */ loopsParam: NumberParameter; /** * Creates an instance of Sphere. * @param radius - The radius of the sphere. * @param sides - The number of sides. * @param loops - The number of loops. * @param addNormals - Compute vertex normals for the geometry * @param addTextureCoords - Compute texture coordinates for the geometry */ constructor(radius?: number, sides?: number, loops?: number, addNormals?: boolean, addTextureCoords?: boolean); /** * The rebuild method. * @private */ rebuild(): void; /** * The resize method. * @private */ resize(): void; } /** * A class for generating a torus geometry. * * ``` * const torus = new Torus(0.4, 1.3) * ``` * * @extends ProceduralMesh */ declare class Torus extends ProceduralMesh { innerRadiusParam: NumberParameter; outerRadiusParam: NumberParameter; arcAngleParam: AngleParameter; detailParam: NumberParameter; /** * Creates an instance of Torus. * * @param innerRadius - The inner radius of the torus. * @param outerRadius - The outer radius of the torus. * @param detail - The detail of the cone. * @param arcAngle - The angle of the arc. */ constructor(innerRadius?: number, outerRadius?: number, detail?: number, arcAngle?: number); /** * The rebuild method. * @private */ rebuild(): void; /** * The resize method. * @private */ resize(): void; } /** Class representing a geometry parameter. * @extends Parameter * @private */ declare class GeometryParameter extends Parameter { protected listenerIDs: Record; /** * Create a geometry parameter. * @param name - The name of the color parameter. * @param value - The value of the parameter. */ constructor(name?: string, value?: BaseGeom | BaseProxy); private emitBoundingBoxDirtied; /** * The setValue method. * @param value - The geom value. */ setValue(value: BaseGeom | BaseProxy): void; /** * The loadValue is used to change the value of a parameter, without triggering a * valueChanges, or setting the USER_EDITED state. * * @param value - The context value. */ loadValue(value: BaseGeom | BaseProxy): void; /** * The toJSON method encodes this type as a json object for persistence. * @param context - The context value. * @return - Returns the json object. */ toJSON(context?: Record): Record; /** * The fromJSON method decodes a json object for this type. * @param j - The json object this item must decode. * @param context - The context value. */ fromJSON(j: Record, context?: AssetLoadContext): void; /** * The clone method constructs a new geometry parameter, copies its values * from this parameter and returns it. * @return - Returns a new geometry parameter. */ clone(): GeometryParameter; } /** Class representing an operator input. * @extends EventEmitter */ declare abstract class OperatorInput extends EventEmitter { name: string; _op?: Operator; param?: Parameter; detached: boolean; /** * Create an operator input. * @param name - The name value. */ constructor(name: string); /** * The getName method. * @return - The return value. */ getName(): string; /** * Sets operator that owns this input. Called by the operator when adding inputs * @param op - The operator object. */ setOperator(op: Operator): void; /** * Returns operator that owns this input. * @return - The operator object. */ getOperator(): Operator; /** * Returns true if this input is connected to a parameter. * @return - The return value. */ isConnected(): boolean; /** * The getParam method. * @return - The return value. */ getParam(): Parameter | undefined; /** * @private * The handler function for when the input paramter changes. * @param event - The event object. */ paramValueChanged(): void; /** * Assigns the Paramter to be used to provide the input value. * @param param - The param value. */ setParam(param?: Parameter): void; /** * The getValue method. * @return - The return value. */ getValue(): T; /** * The setValue method. * @param value - The value param. */ setValue(value: T): void; /** * Propagates from the upstream parameter to the connected operator. */ setDirty(): void; /** * The toJSON method encodes this type as a json object for persistence. * * @param context - The context value. * @return - Returns the json object. */ toJSON(context?: Record): { name: string; paramPath: string[]; }; /** * The fromJSON method decodes a json object for this type. * @param j - The json object this item must decode. * @param context - The context value. */ fromJSON(j: Record, context?: Record): void; /** * The detach method is called when an operator is being removed from the scene tree. * It removes all connections to parameters in the scene. */ detach(): void; /** * The reattach method can be called when re-instating an operator in the scene. */ reattach(): void; } declare class BooleanOperatorInput extends OperatorInput { } declare class NumberOperatorInput extends OperatorInput { } declare class Vec2OperatorInput extends OperatorInput { } declare class Vec3OperatorInput extends OperatorInput { } declare class Vec4OperatorInput extends OperatorInput { } declare class ColorOperatorInput extends OperatorInput { } declare class QuatOperatorInput extends OperatorInput { } declare class XfoOperatorInput extends OperatorInput { } declare class Mat3OperatorInput extends OperatorInput { } declare class Mat4OperatorInput extends OperatorInput { } declare enum OperatorOutputMode { OP_WRITE = 0, OP_READ_WRITE = 1 } /** Class representing an operator output. * @extends EventEmitter */ declare abstract class OperatorOutput extends EventEmitter { __name: string; _mode: OperatorOutputMode; _op: Operator | null; private _param?; _paramBindIndex: number; detached: boolean; /** * Create an operator output. * @param name - The name value. * @param operatorOutputMode - The mode which the OperatorOutput uses to bind to its target parameter. */ constructor(name: string, operatorOutputMode?: OperatorOutputMode); /** * Returns name of the output. * @return - The name string. */ getName(): string; /** * Sets operator that owns this output. Called by the operator when adding outputs * @param op - The operator object. */ setOperator(op: Operator): void; /** * Returns operator that owns this output. * @return - The operator object. */ getOperator(): Operator; /** * Returns mode that the output writes to be parameter. Must be a number from OperatorOutputMode * @return - The mode value. */ getMode(): OperatorOutputMode; /** * Returns true if this output is connected to a parameter. * @return - The return value. */ isConnected(): boolean; /** * The getParam method. * @return - The return value. */ getParam(): Parameter | undefined; /** * Sets the Parameter for this output to write to. * @param param - The param value. * @param index - The index to bind at in the Parameter. */ setParam(param?: Parameter, index?: number): void; /** * Returns the index of the binding on the parameter of this OperatorOutput * up to date. * @return index - The index of the binding on the parameter. */ getParamBindIndex(): number; /** * If bindings change on a Parameter, it will call this method to ensure the output index is * up to date. * @param index - The index of the binding on the parameter. */ setParamBindIndex(index: number): void; /** * Propagates dirty to the connected parameter. */ setDirty(): void; /** * The getValue method. * @return - The return value. */ getValue(): T; /** * When the value on a Parameter is modified by a user by calling 'setValue, * then if any operators are bound, the value of the Parameter cannot be modified * directly as it is the result of a computation. Instead, the Parameter calls * 'backPropagateValue' on the Operator to cause the Operator to handle propagating * the value to one or more of its inputs. * to its inputs. * @param value - The value param. * @return - The modified value. */ backPropagateValue(value: any): any; /** * The setClean method. * @param value - The value param. */ setClean(value: T): void; /** * The toJSON method encodes this type as a json object for persistence. * @param context - The context value. * @return - Returns the json object. */ toJSON(context?: Record): { name: string; paramPath: string[]; paramBindIndex: number; }; /** * The fromJSON method decodes a json object for this type. * @param j - The json object this item must decode. * @param context - The context value. */ fromJSON(j: Record, context?: Record): void; /** * The detach method is called when an operator is being removed from the scene tree. * It removes all connections to parameters in the scene. */ detach(): void; /** * The reattach method can be called when re-instating an operator in the scene. */ reattach(): void; /** * The rebind rebinds the outputs to be at the top of the stack for its parameter. */ rebind(): void; } declare class BooleanOperatorOutput extends OperatorOutput { } declare class NumberOperatorOutput extends OperatorOutput { } declare class Vec2OperatorOutput extends OperatorOutput { } declare class Vec3OperatorOutput extends OperatorOutput { } declare class Vec4OperatorOutput extends OperatorOutput { } declare class ColorOperatorOutput extends OperatorOutput { } declare class QuatOperatorOutput extends OperatorOutput { } declare class XfoOperatorOutput extends OperatorOutput { } declare class Mat3OperatorOutput extends OperatorOutput { } declare class Mat4OperatorOutput extends OperatorOutput { } /** * Class representing an operator. * * @extends ParameterOwner */ declare class Operator extends ParameterOwner { __inputs: Map>; __outputs: Map>; /** * Create an operator. * @param name - The name value. */ constructor(name?: string); /** * This method sets the state of the operator to dirty which propagates * to the outputs of this operator, and which may then propagate to other * operators. When the scene is cleaned, which usually is caused by rendering * then the chain of operators are cleaned by triggering evaluation. * @private */ setDirty(): void; /** * This method can be overridden in derived classes * to perform general updates (see GLPass or BaseItem). * * @param event * @private */ protected parameterValueChanged(event: Record): void; /** * The addInput method. * @param input - The name of the input, or the input object * @return - The return value. */ addInput(input: OperatorInput): OperatorInput; /** * The removeInput method. * @param input - The name of the input, or the input object */ removeInput(input: OperatorInput): void; /** * Getter for the number of inputs in this operator. * @return - Returns the number of inputs. */ getNumInputs(): number; /** * The getInputByIndex method. * @param index - The index value. * @return - The return value. */ getInputByIndex(index: number): Record; /** * The getInput method. * @param name - The name value. * @return - The return value. */ getInput(name: string): OperatorInput; /** * The addOutput method. * @param output - The name of the output, or the output object * @return - The return value. */ addOutput(output: OperatorOutput): OperatorOutput; /** * The removeOutput method. * @param output - The name of the output, or the output object */ removeOutput(output: OperatorOutput | string): void; /** * Getter for the number of outputs in this operator. * @return - Returns the number of outputs. */ getNumOutputs(): number; /** * The getOutputByIndex method. * @param index - The index value. * @return - The return value. */ getOutputByIndex(index: number): OperatorOutput; /** * The getOutput method. * @param name - The name value. * @return - The return value. */ getOutput(name: string): OperatorOutput; /** * The evaluate method. * Computes the values of each of the outputs based on the values of the inputs * and the values of outputs with mode OP_READ_WRITE. * This method must be implemented by all Operators. */ evaluate(): void; /** * When the value on a Parameter is modified by a user by calling 'setValue, * then if any operators are bound, the value of the Parameter cannot be modified * directly as it is the result of a computation. Instead, the Parameter calls * 'backPropagateValue' on the Operator to cause the Operator to handle propagating * the value to one or more of its inputs. * to its inputs. * @param value - The value param. * @return - The modified value. */ backPropagateValue(value: unknown): unknown; /** * The toJSON method encodes this type as a json object for persistence. * * @param context - The context value. * @return - Returns the json object. */ toJSON(context?: Record): Record; /** * The fromJSON method decodes a json object for this type. * * @param j - The json object this item must decode. * @param context - The context value. */ fromJSON(j: Record, context?: Record): void; /** * The detach method. */ detach(): void; /** * The reattach method. */ reattach(): void; /** * The rebind method. */ rebind(): void; } /** * Class representing a geometry item in a scene tree. * * **Parameters** * * **Geometry(`GeometryParameter`):** The geometry to be rendered for this GeomItem * * **Material(`MaterialParameter`):** The Material to use when rendering this GeomItem * * **GeomOffsetXfo(`XfoParameter`):** Provides an offset transformation that is applied only to the geometry and not inherited by child items. * * **GeomMat(`Mat4Parameter`):** Calculated from the GlobalXfo and the GeomOffsetXfo, this matrix is provided to the renderer for rendering. * * @extends BaseGeomItem */ declare class GeomItem extends BaseGeomItem { protected listenerIDs: Record; protected geomBBox?: Box3; protected geomIndex: number; protected assetItem: AssetItem | null; protected calcGeomMatOperator: Operator; cullable: boolean; /** * @member geomOffsetXfoParam - Provides an offset transformation that is applied only to the geometry and not inherited by child items. */ geomOffsetXfoParam: XfoParameter; /** * @member geomParam - The geometry to be rendered for this GeomItem */ geomParam: GeometryParameter; /** * @member geomMatParam - Calculated from the GlobalXfo and the GeomOffsetXfo, this matrix is provided to the renderer for rendering. */ geomMatParam: Mat4Parameter; /** * Creates a geometry item. * @param name - The name of the geom item. * @param geometry - The geometry value. * @param material - The material value. * @param xfo - The initial Xfo of the new GeomItem. */ constructor(name?: string, geometry?: BaseGeom, material?: Material, xfo?: Xfo); /** * The _cleanBoundingBox method. * @private */ _cleanBoundingBox(): Box3; /** * The fromJSON method decodes a json object for this type. * * @param json - The json object this item must decode. * @param context - The context value. */ fromJSON(json: Record, context: Record): void; /** * Loads state of the Item from a binary object. * * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context: AssetLoadContext): void; /** * Returns string representation of current object's state. * @param context * @return - The return value. */ toString(context: Record): string; /** * The clone method constructs a new geom item, copies its values * from this item and returns it. * * @param context - The context value. * @return - Returns a new cloned geom item. */ clone(context?: CloneContext): GeomItem; /** * Copies current GeomItem with all its children. * * @param src - The geom item to copy from. * @param context - The context value. */ copyFrom(src: GeomItem, context?: CloneContext): void; /** * Sets the global boolean that controls if GeomItems calculate precise bounding boxes * or use the approximate bounding boxes that are much faster to generate. * Note: computing the precise bounding box is much slower and can make loading * big scenes take a bit longer. This setting is only relevant to geometries loaded * from zcad files. * @deprecated * zcad files from version 3.11.0 contain precise bounding boxes by default. * @param value - true for precise bounding boxes, else false for faster approximate bounding boxes. */ static setCalculatePreciseBoundingBoxes(value: boolean): void; } /** This class abstracts the rendering of a collection of geometries to screen. * @extends EventEmitter * @private */ declare class GLGeomItemSet extends EventEmitter { protected gl: WebGL12RenderingContext; protected glGeom: GLGeom; protected id: number; glGeomItems: Array; protected glgeomItems_freeIndices: number[]; protected glgeomItemEventHandlers: any[]; protected drawIdsArray: Float32Array | null; protected drawIdsBuffer: WebGLBuffer | null; protected drawIdsBufferDirty: boolean; protected highlightedIdsArray: Float32Array | null; protected highlightedIdsBuffer: WebGLBuffer | null; protected highlightedIdsBufferDirty: boolean; protected visibleItems: number[]; protected highlightedItems: number[]; /** * Create a GL geom item set. * @param gl - The webgl rendering context. * @param glGeom - The glGeom value. */ constructor(gl: WebGL12RenderingContext, glGeom: GLGeom); /** * The getGLGeom method. * @return - The return value. */ getGLGeom(): GLGeom; /** * The getDrawCount method. * @return - The return value. */ getDrawCount(): number; /** * The addGLGeomItem method. * @param glGeomItem - The glGeomItem value. */ addGLGeomItem(glGeomItem: GLGeomItem): void; /** * The removeGLGeomItem method. * @param glGeomItem - The glGeomItem value. */ removeGLGeomItem(glGeomItem: GLGeomItem): void; /** * The updateDrawIDsBuffer method. * The culling system will specify a subset of the total number of items for * drawing. */ updateDrawIDsBuffer(): void; /** * The getDrawIdsArray method. * @return - The drawIds for each GeomItem packed into a Float32Array */ getDrawIdsArray(): Float32Array; /** * The updateHighlightedIDsBuffer method. */ updateHighlightedIDsBuffer(): void; /** * The getHighlightedIdsArray method. * @return - The drawIds for each GeomItem packed into a Float32Array */ getHighlightedIdsArray(): Float32Array; /** * The draw method. * @param renderstate - The object tracking the current state of the renderer */ draw(renderstate: ColorRenderState): void; /** * The drawHighlighted method. * @param renderstate - The object tracking the current state of the renderer */ drawHighlighted(renderstate: RenderState): void; /** * The drawGeomData method. * @param renderstate - The object tracking the current state of the renderer */ drawGeomData(renderstate: GeomDataRenderState): void; private bindAndRender; /** * The destroy is called by the system to cause explicit resources cleanup. * Users should never need to call this method directly. */ destroy(): void; } declare class FattenLinesShader extends GLShader { /** * Create a GL shader. * @param gl - The webgl rendering context. */ constructor(gl: WebGL12RenderingContext); } /** Class representing a GL mesh. * @extends GLGeom * @private */ declare class GLMesh extends GLGeom { protected numTriIndices: number; protected indexDataType: number; protected numTriangles: number; /** * Create a GL mesh. * @param gl - The webgl rendering context. * @param mesh - The mesh value. */ constructor(gl: WebGL12RenderingContext, mesh: Mesh | MeshProxy); /** * The genBuffers method. */ genBuffers(renderstate: RenderState): void; /** * The clearBuffers method. */ clearBuffers(): void; /** * The bind method. * @param renderstate - The object tracking the current state of the renderer * @return - returns false if the binding failed. */ bind(renderstate: RenderState): void; /** * Draw an item to screen. * @param renderstate - The object tracking the current state of the renderer */ draw(renderstate: RenderState): void; /** * The drawInstanced method. * @param renderstate - The object tracking the current state of the renderer * @param instanceCount - The instanceCount value. */ drawInstanced(renderstate: RenderState, instanceCount: number): void; /** * The destroy is called by the system to cause explicit resources cleanup. * Users should never need to call this method directly. */ destroy(): void; } /** This class abstracts the rendering of a collection of geometries to screen. * @extends EventEmitter * @private */ declare class GLGeomItemSetMultiDrawCompoundGeom extends EventEmitter { protected renderer: GLRenderer; protected gl: WebGL12RenderingContext; protected glGeomItems: Array; protected glGeomIdsMapping: Record; protected glgeomItemEventHandlers: Record[]; protected freeIndices: number[]; protected dirtyGeomItems: Set; protected drawIdsBufferDirty: boolean; protected drawIdsArraysAllocators: Record; protected drawIdsArrays: Record; protected drawIdsTextures: Record; protected drawElementCounts: Record; protected drawElementOffsets: Record; protected drawOrderToIndex: number[]; protected indexToDrawIndex: number[]; protected highlightedItems: Record>; protected highlightedIdsArraysAllocators: Record; protected highlightElementCounts: Record; protected highlightElementOffsets: Record; protected highlightedIdsArray?: Record; protected highlightedIdsTextures: Record; protected dirtyHighlightedGeomItems: Set; protected highlightedIdsBufferDirty: boolean; protected linesGeomDataBuffer: GLTexture2D | null; protected fattenLinesShader: FattenLinesShader | null; protected quad: GLMesh | null; protected fbo: WebGLFramebuffer | null; /** * Create a GL geom item set. * @param {GLBaseRenderer} renderer - The renderer object. */ constructor(renderer: GLBaseRenderer); private addItemToHighlight; /** * The addGLGeomItem method. * @param {GLGeomItem} glGeomItem - The glGeomItem value. */ addGLGeomItem(glGeomItem: GLGeomItem): void; /** * The removeGLGeomItem method. * @param {GLGeomItem} glGeomItem - The glGeomItem value. */ removeGLGeomItem(glGeomItem: GLGeomItem): void; /** * The updateDrawIDsBuffer method. * @param {RenderState} renderstate - The object used to track state changes during rendering. */ updateDrawIDsBuffer(renderstate: RenderState): void; /** * The updateHighlightedIDsBuffer method. * @param {RenderState} renderstate - The object used to track state changes during rendering. */ updateHighlightedIDsBuffer(renderstate: HighlightRenderState): void; /** * The draw method. * @param {RenderState} renderstate - The object tracking the current state of the renderer */ draw(renderstate: RenderState): void; /** * The drawGeomData method. * @param renderstate - The object tracking the current state of the renderer */ drawGeomData(renderstate: GeomDataRenderState): void; /** * The drawHighlighted method. * @param {HighlightRenderState} renderstate - The object tracking the current state of the renderer */ drawHighlighted(renderstate: HighlightRenderState): void; multiDrawMeshes(renderstate: RenderState, counts: Int32Array, offsets: Int32Array, drawCount: number): void; multiDrawLines(renderstate: RenderState, counts: Int32Array, offsets: Int32Array, drawCount: number): void; multiDrawPoints(renderstate: RenderState, counts: Int32Array, offsets: Int32Array, drawCount: number): void; /** * Sorts the drawn items in order furthest to nearest when rendering transparent objects. * @param {Vec3} viewPos - The position of the camera that we are sorting relative to. */ sortItems(viewPos: Vec3): void; /** * The destroy is called by the system to cause explicit resources cleanup. * Users should never need to call this method directly. */ destroy(): void; } /** This class abstracts the rendering of a collection of geometries to screen. * @extends EventEmitter * @private */ declare abstract class GLGeomItemSetMultiDraw extends EventEmitter { protected renderer: GLBaseRenderer; protected gl: WebGL12RenderingContext; protected glGeomItems: Array; protected glGeomIdsMapping: Record; protected glgeomItemEventHandlers: any[]; protected freeIndices: number[]; protected viewPos: Vec3; protected drawElementCounts: Int32Array; protected drawElementOffsets: Int32Array; protected highlightElementCounts: Int32Array; protected highlightElementOffsets: Int32Array; protected drawOrderToIndex: number[]; protected indexToDrawIndex: number[]; protected drawIdsArray: Float32Array; protected drawIdsBufferDirty: boolean; protected drawIdsTexture: GLTexture2D | null; protected highlightedItems: GLGeomItem[]; protected highlightedIdsArray: Float32Array | null; protected highlightedIdsTexture: GLTexture2D | null; protected highlightedIdsBufferDirty: boolean; private dirtyGeomIndices; /** * Create a GL geom item set. * @param renderer - The renderer object. */ constructor(renderer: GLBaseRenderer); /** * The addGLGeomItem method. * @param glGeomItem - The glGeomItem value. */ addGLGeomItem(glGeomItem: GLGeomItem): void; /** * The removeGLGeomItem method. * @param glGeomItem - The glGeomItem value. */ removeGLGeomItem(glGeomItem: GLGeomItem): void; cleanGeomIds(): void; /** * The updateDrawIDsBuffer method. * @param renderstate - The object used to track state changes during rendering. */ updateDrawIDsBuffer(renderstate: RenderState): void; /** * The updateHighlightedIDsBuffer method. * @param renderstate - The object used to track state changes during rendering. */ updateHighlightedIDsBuffer(renderstate: RenderState): void; /** * The draw method. * @param renderstate - The object tracking the current state of the renderer */ draw(renderstate: ColorRenderState): void; /** * The drawHighlighted method. * @param renderstate - The object tracking the current state of the renderer */ drawHighlighted(renderstate: RenderState): void; /** * The drawGeomData method. * @param renderstate - The object tracking the current state of the renderer */ drawGeomData(renderstate: GeomDataRenderState): void; /** * The bindAndRender method. * @param renderstate - The object tracking the current state of the renderer * @param counts - the counts for each element drawn in by this draw call. * @param offsets - the offsets for each element drawn in by this draw call. * @private */ bindAndRender(renderstate: RenderState, counts: Int32Array, offsets: Int32Array, drawCount: number): void; /** * Draw an item to screen. * @param renderstate - The object tracking the current state of the renderer * @param drawIds - the draw id for each element drawn in by this draw call. * @param counts - the geom element count for each element drawn in by this draw call. * @param offsets - the geom element offset for each element drawn in by this draw call. * @param drawCount - the number of active draw calls for this invocation */ abstract multiDraw(renderstate: RenderState, counts: Int32Array, offsets: Int32Array, drawCount: number): void; /** * Sorts the drawn items in order furthest to nearest when rendering transparent objects. * @param viewPos - The position of the camera that we are sorting relative to. */ sortItems(viewPos: Vec3): void; /** * The destroy is called by the system to cause explicit resources cleanup. * Users should never need to call this method directly. */ destroy(): void; } declare const GLGeomItemChangeType: { GEOMITEM_CHANGED: number; GEOM_CHANGED: number; VISIBILITY_CHANGED: number; HIGHLIGHT_CHANGED: number; }; declare const GLGeomItemFlags: { GEOMITEM_FLAG_CUTAWAY: number; GEOMITEM_INVISIBLE_IN_GEOMDATA: number; GEOMITEM_TRANSPARENT: number; }; /** This class is responsible for managing a GeomItem within the renderer. * @private * @extends EventEmitter */ declare class GLGeomItem extends EventEmitter { private listenerIDs; GLGeomItemSet: GLGeomItemSet | GLGeomItemSetMultiDrawCompoundGeom | GLGeomItemSetMultiDraw; GLShaderGeomSets: GLShaderGeomSets; private gl; geomItem: GeomItem; geomItemId: number; geomId: number; materialId: number; supportInstancing: boolean; visible: boolean; shattered: boolean; culled: boolean; private geomMatrixDirty; private modelMatrixArray; private geomData; private highlightSubIndex; /** * Create a GL geom item. * @param gl - The gl value. * @param geomItem - The geomItem value. * @param geomItemId - The geomItemId value. * @param geomId - The geomId value. * @param materialId - The materialId value. * @param supportInstancing - a boolean to disable instancing support on some mobile platforms */ constructor(gl: WebGL12RenderingContext, geomItem: GeomItem, geomItemId: number, geomId: number, materialId: number, supportInstancing?: boolean); /** * The isVisible method. * @return - The return value. */ isVisible(): boolean; /** * Sets the additional culled value which controls visiblity * @param culled - True if culled, else false. */ setCulled(culled: boolean): void; /** * The bind method. * @param renderstate - The object tracking the current state of the renderer * @return - The return value. */ bind(renderstate: RenderState): boolean; /** * The destroy is called by the system to cause explicit resources cleanup. * Users should never need to call this method directly. */ destroy(): void; } /** The GLRenderTarget is used to generate a WebGL Framebuffer and its associated textures. * It can be used to create a FrameBuffer, several color textures and an optional depth texture, all bound to the Framebuffer. * * * ```javascript * const renderTarget = new GLRenderTarget(gl, { * type: gl.FLOAT, * format: gl.RGBA, * minFilter: gl.NEAREST, * magFilter: gl.NEAREST, * width: 128, * height: 64, * depthType: gl.FLOAT, * depthFormat: gl.DEPTH_COMPONENT, * depthInternalFormat: gl.DEPTH_COMPONENT32F, * }) * ``` */ declare class GLRenderTarget extends EventEmitter { protected __gl: WebGL12RenderingContext; textureTargets: WebGLTexture[]; depthTexture: WebGLTexture; frameBuffer: WebGLFramebuffer; protected textureDesc: number[]; protected params: Record; protected type: number; protected format: number; protected internalFormat: number; protected minFilter: number; protected maxFilter: number; protected wrap: any; protected flipY: boolean; width: number; height: number; clearColor: Color; private colorMask; private textureType; private prevBoundFbo; /** * Create a GL render target. * @param gl - The webgl rendering context. * @param params - The params value. */ constructor(gl: WebGL12RenderingContext, params?: Record); /** * The configure method. * @param params - The params param. */ configure(params: Record): void; /** * The checkFramebuffer method. */ checkFramebuffer(): void; /** * The bindForWriting method. * @param renderstate - The object tracking the current state of the renderer * @param clear - The clear value. */ bindForWriting(renderstate?: RenderState, clear?: boolean): void; /** * The unbindForWriting method. * @param renderstate - The object tracking the current state of the renderer */ unbindForWriting(renderstate?: RenderState): void; /** * The clear method. * @param clearDepth - The clearDepth value. */ clear(clearDepth?: boolean): void; /** * Binds the render target in preparation for 'readPixels' calls to pull data back to main memory. */ bindForReading(): void; /** * The unbindForReading method. */ unbindForReading(): void; /** * The bindColorTexture method. * @param renderstate - The object tracking the current state of the renderer * @param channelId - The channelId value. * @return - The return value. */ bindColorTexture(renderstate: RenderState, unif: ShaderUniform, channelId?: number): boolean; /** * The bindDepthTexture method. * @param renderstate - The object tracking the current state of the renderer * @param unif - The WebGL uniform * @return - The return value. */ bindDepthTexture(renderstate: RenderState, unif: ShaderUniform): boolean; /** * The unbind method. */ unbind(renderstate?: RenderState): void; /** * The resize method. * @param width - The width value. * @param height - The height value. * @param preserveData - The preserveData value. */ resize(width: number, height: number, preserveData?: boolean): void; /** * The bindToUniform method. * @param renderstate - The renderstate param. * @param unif - The WebGL uniform * @param bindings - The bindings param. * @return - The return value. */ bindToUniform(renderstate: RenderState, unif: ShaderUniform, bindings?: ShaderUniforms): boolean; /** * The destroy is called by the system to cause explicit resources cleanup. * Users should never need to call this method directly. */ destroy(): void; } declare class ReductionShader extends GLShader { /** * Create an atlas layout shader. * @param gl - The webgl rendering context. */ constructor(gl: WebGL12RenderingContext); } declare class BoundingBoxShader extends GLShader { /** * Create a GL shader. * @param gl - The webgl rendering context. */ constructor(gl: WebGL12RenderingContext); } /** Class for managing all the GeomItems discovered in the SceneTree. * @private */ declare class GLGeomItemLibrary extends EventEmitter { protected renderer: GLBaseRenderer; protected glGeomItems: Array; protected glGeomItemEventHandlers: any[]; protected glGeomItemsMap: Map; protected glGeomItemsIndexFreeList: number[]; protected dirtyItemIndices: Set; protected dirtyWorkerItemIndices: Set; protected removedItemIndices: number[]; protected glGeomItemsTexture: GLTexture2D | null; protected enableFrustumCulling: boolean; protected xrViewport?: XRViewport; protected xrPresenting: boolean; protected xrFovY: number; protected xrProjectionMatrix: Mat4; protected enableOcclusionCulling: boolean; protected debugOcclusionBuffer: boolean; protected occlusionDataBuffer: GLRenderTarget; protected occlusionImage: DataImage; protected occlusionImageItem: GeomItem; protected reductionDataBuffer: GLRenderTarget; protected bbox: GLGeom; protected reductionShader: ReductionShader; protected boundingBoxShader: BoundingBoxShader; protected inFrustumIndicesCount: number; protected drawIdsBufferDirty: boolean; protected inFrustumDrawIdsBuffer: WebGLBuffer; protected reductionDataArray: Uint8Array; occlusionDataBufferSizeFactor: number; private timer_query_ext; private worker; /** * Create a GLGeomItemLibrary. * @param renderer - The renderer instance * @param options - The options object passed to the GLRenderer constructor. */ constructor(renderer: GLBaseRenderer, options: RendererOptions); /** * Sets up the Culling Worker to start calculating frustum culling. * @param renderer - The renderer instance */ setupCullingWorker(renderer: GLBaseRenderer): void; /** * Handles applying the culling results received from the GLGeomItemLibraryCullingWorker * @param {object} data - The object containing the newlyCulled and newlyUnCulled results. */ applyCullResults(data: Record): void; /** * @private * @param data */ emitCullingUpdateData(data: Record): void; /** * Given the IDs of the items we know are in the frustum, setup an instanced attribute we can use * to render bounding boxes for these items if they do not show up in the initial GPU buffer. * @param {Float32Array} inFrustumIndices - The array of indices of items we know are in the frustum. */ updateCulledDrawIDsBuffer(inFrustumIndices: Float32Array): void; /** * Calculate a further refinement of the culling by using the GPU to see which items are actually visible. * @param inFrustumIndices - The array of indices of items we know are in the frustum. */ calculateOcclusionCulling(inFrustumIndices: Float32Array): void; /** * The addGeomItem method. * @param geomItem - The geomItem value. * @return - The index of GLGeomItem */ addGeomItem(geomItem: GeomItem): GLGeomItem; /** * The removeGeomItem method. * @param geomItem - The geomItem value. * @return - The return value. */ removeGeomItem(geomItem: GeomItem): GLGeomItem; /** * The getGeomItem method. * @param index - The index value. * @return - The GLGeomItem that wraps the provided GeomItem */ getGeomItem(index: number): GeomItem | undefined; /** * The getGeomItem method. * @param geomItem - The geomItem value. * @return - The GLGeomItem that wraps the provided GeomItem */ getGLGeomItem(geomItem: GeomItem): GLGeomItem | null; /** * The populateDrawItemDataArray method. * @param index - The index of the item in the library. * @param subIndex - The index of the item within the block being uploaded. * @param dataArray - The dataArray value. * @private */ populateDrawItemDataArray(index: number, subIndex: number, dataArray: Float32Array): void; /** * Gathers data to pass to the culling worker. * @param geomItem - The GeomItem to gether the data for. * @param material - The material of GeomItem. * @param index - The index of the item to gether the data for. * @return - the JSON data that will be passed to the worker. */ getCullingWorkerData(geomItem: GeomItem, index: number): Record | null; /** * Any items that need to be updated on the worker are now pushed. */ uploadGeomItemsToWorker(): void; /** * The uploadGeomItems method. * @param renderstate - The object tracking the current state of the renderer */ uploadGeomItems(renderstate: RenderState): void; /** * Updates the GPU state if any update is needed. * @param renderstate - The object tracking the current state of the renderer */ bind(renderstate: RenderState): void; } declare const PassType: { PRE: number; OPAQUE: number; TRANSPARENT: number; OVERLAY: number; }; /** This class abstracts the rendering of a collection of geometries to screen. * @extends ParameterOwner */ declare abstract class GLPass extends ParameterOwner { enabled: boolean; protected passIndex: number; protected __gl: WebGL12RenderingContext | null; renderer: GLRenderer | null; protected __renderer: GLRenderer | null; enabledParam: BooleanParameter; /** * Create a GL pass. */ constructor(); /** * The __parameterValueChanged method. * @param event - The event object. * @private */ parameterValueChanged(event: Record): void; /** * The init method. * @param renderer - The renderer value. * @param passIndex - The index of the pass in the GLRenderer */ init(renderer: GLRenderer, passIndex: number): void; /** * The setPassIndex method. * @param passIndex - The index of the pass in the GLRenderer */ setPassIndex(passIndex: number): void; /** * Returns the pass type. OPAQUE passes are always rendered first, followed by TRANSPARENT passes, and finally OVERLAY. * @return - The pass type value. */ getPassType(): number; /** * The itemAddedToScene method is called on each pass when a new item * is added to the scene, and the renderer must decide how to render it. * It allows Passes to select geometries to handle the drawing of. * @param treeItem - The treeItem value. * @param rargs - Extra return values are passed back in this object. * The object contains a parameter 'continueInSubTree', which can be set to false, * so the subtree of this node will not be traversed after this node is handled. * @return - The return value. */ itemAddedToScene(treeItem: TreeItem, rargs: Record): boolean; /** * The itemRemovedFromScene method is called on each pass when aa item * is removed to the scene, and the pass must handle cleaning up any resources. * @param treeItem - The treeItem value. * @param rargs - Extra return values are passed back in this object. * @return - The return value. */ itemRemovedFromScene(treeItem: TreeItem, rargs: Record): boolean; /** * The startPresenting method. */ startPresenting(): void; /** * The stopPresenting method. */ stopPresenting(): void; /** * The draw method. * @param renderstate - The object tracking the current state of the renderer */ draw(renderstate: RenderState): void; /** * The drawHighlightedGeoms method. * @param renderstate - The object tracking the current state of the renderer */ drawHighlightedGeoms(renderstate: HighlightRenderState): void; /** * The drawGeomData method. * @param renderstate - The object tracking the current state of the renderer */ drawGeomData(renderstate: GeomDataRenderState): void; /** * The getGeomItemAndDist method. * @param geomData - The geomData value. */ getGeomItemAndDist(geomData: Float32Array | Uint8Array): GeomItemAndDist | undefined; } declare class HighlightsShader extends GLShader { /** * Create a GL shader. * @param gl - The webgl rendering context. */ constructor(gl: WebGL12RenderingContext); } declare class SilhouetteShader extends GLShader { /** * Create a GL shader. * @param gl - The webgl rendering context. */ constructor(gl: WebGL12RenderingContext); } interface RendererOptions { supportXR?: boolean; xrMode?: 'VR' | 'AR'; alpha?: boolean; premultipliedAlpha?: boolean; antialias?: boolean; powerPreference?: string; disableTextures?: boolean; debugGeomIds?: boolean; enableFrustumCulling?: boolean; enableOcclusionCulling?: boolean; disableMultiDraw?: boolean; floatGeomBuffer?: boolean; debugGeomDataBuffer?: boolean; debugOcclusionBuffer?: boolean; } /** * Class representing a GL base renderer. * * @extends ParameterOwner */ declare class GLBaseRenderer extends ParameterOwner { #private; directives: string[]; directivesHash: string; solidAngleLimit: number; __gl: WebGL12RenderingContext; glcanvas: HTMLCanvasElement | null; floatGeomBuffer: boolean; multiSampledScreenBuffer: boolean; xrViewportPresenting: boolean; xrViewport: XRViewport | undefined; glMaterialLibrary: GLMaterialLibrary; glGeomItemLibrary: GLGeomItemLibrary; glGeomLibrary: GLGeomLibrary; highlightsShader: HighlightsShader; silhouetteShader: SilhouetteShader; screenQuad: GLScreenQuad | null; /** * Create a GL base renderer. * @param $canvas - The canvas element. * @param options - The options value. */ constructor($canvas: HTMLCanvasElement, options?: RendererOptions); /** * The setShaderPreprocessorDirective method. * @param name - The name value. * @param value - The value param. */ setShaderPreprocessorDirective(name: string, value: string): void; /** * Returns HTMLCanvasElement's width * * @return - The return value. */ getWidth(): number; /** * Returns HTMLCanvasElement's Height * @return - The return value. */ getHeight(): number; /** * Adds a new viewport(viewing region) to the scene. * * @param name - The name of the viewport. * @return - The return value. */ addViewport(name: string): GLViewport; /** * Returns a viewport element by specifying its index in the list of viewports. * * @param index - The index value. * @return - The return value. */ getViewport(index?: number): GLViewport; /** * Returns a viewport element under the specified XY coordinates. * * @param offsetX - The viewport offset in the X axis. * @param offsetY - The viewport offset in the Y axis. * @return - The return value. */ getViewportAtPos(offsetX: number, offsetY: number): GLViewport | undefined; /** * Sets as `active` the specified viewport. * * @param vp - The viewport. */ activateViewport(vp: GLViewport): void; /** * Sets as àctive` the viewport under the specified XY coordinates. * * @param offsetX - The viewport offset in the X axis. * @param offsetY - The viewport offset in the Y axis. */ activateViewportAtPos(offsetX: number, offsetY: number): void; /** * Returns current active viewport. * * @return - The return value. */ getActiveViewport(): GLViewport | undefined; /** * The suspendDrawing method. */ suspendDrawing(): void; /** * The resumeDrawing method. */ resumeDrawing(): void; /** * The renderGeomDataFbos method. Frame buffer (FBO). */ renderGeomDataFbos(): void; /** * Returns current scene(Environment where all assets live) object. * * @return - The return value. */ getScene(): Scene; /** * Sets scene to the renderer. * * @param scene - The scene value. */ setScene(scene: Scene): void; /** * Adds tree items to the renderer, selecting the correct pass to delegate rendering too, and listens to future changes in the tree. * * @param treeItem - The tree item to add. */ addTreeItem(treeItem: TreeItem): void; /** * Searches through the passes and finds the appropriate pass to draw the given tree items. * * @param treeItem - The tree item to assign. */ assignTreeItemToGLPass(treeItem: TreeItem): boolean; /** * Remove tree items from the scene. * * @param treeItem - The tree item to remove. */ removeTreeItem(treeItem: TreeItem): void; /** * Getter for gl. */ get gl(): WebGL12RenderingContext; /** * The getGL method. * @return - The return value. */ getGL(): WebGL12RenderingContext; /** * Handle the canvas's parent resizing. * * @param newWidth - The new width of the canvas. * @param newHeight - The new height of the canvas. * * @private */ handleResize(newWidth: number, newHeight: number): void; /** * Returns host div of the canvas element. * * @return - The return value. */ getDiv(): HTMLElement | null; /** * Setups the WebGL configuration for the renderer, specifying the canvas element where our * @private * @param $canvas - The $canvas element. * @param webglOptions - The webglOptions value. */ private setupWebGL; /** * Binds IO event handlers to the canvas */ bindEventHandlers(): void; /** * Returns canvas that was used to generate the gl context. * * @return - The return value. */ getGLCanvas(): HTMLCanvasElement | null; /** * Frames the specified viewport to the entire scene. * > See also: ${Viewport#frameView} * @param viewportIndex - The viewportIndex value. If multiple viewports are configured, a viewport index will need to be provided. * @param duration - The duration of time to apply the frame. A value of 0 specifies an instantaneous movement of the camera. * @param frameBorder - The variable to use to provide an empty space around the border for geometries. */ frameAll(viewportIndex?: number, duration?: number, frameBorder?: number): void; /** * A factory function used to construct new shader objects. If that specified shader has already been constructed, it returns the existing shader. * @param shaderName - The shader name. * @return - The return value. */ getOrCreateShader(shaderName: string): GLShader; /** * The addPass method. * @param pass - The pass value. * @param passType - The passType value. * @param updateIndices - The updateIndices value. * @return - The return value. */ addPass(pass: GLPass, passType?: number): number; /** * The getPass method. * @param index - The index value. * @return - The return value. */ getPass(index: number): GLPass | undefined; /** * Find a pass given a class type. Used by the GPViewport to find the GLOverlayPass. * @param index - The index value. * @return - The return value. */ findPassIndex(cls: typeof BaseClass): number; /** * The setupXRViewport method. */ private setupXRViewport; /** * The getVRViewport method. * @return - The return value. */ getVRViewport(): XRViewport | undefined; /** * The getXRViewport method. * @return - The return value. */ getXRViewport(): Promise; /** * The isXRViewportPresenting method. * @return - The return value. */ isXRViewportPresenting(): boolean; /** * The isContinuouslyDrawing method. * @return - The return value. */ isContinuouslyDrawing(): boolean; /** * The startContinuousDrawing method. */ startContinuousDrawing(): void; /** * The stopContinuousDrawing method. */ stopContinuousDrawing(): void; /** * The toggleContinuousDrawing method. */ toggleContinuousDrawing(): void; /** * The drawItemChanged method. */ drawItemChanged(): void; /** * Request a single redraw, usually in response to a signal/event. * @return - The return value. */ requestRedraw(): boolean; /** * Forces a redraw of the viewports */ forceRender(): void; /** * The bindGLRenderer method. * @param renderstate - The renderstate value. */ bindGLRenderer(renderstate: RenderState): void; /** * The drawScene method. * @param renderstate - The renderstate value. */ drawScene(renderstate: RenderState): void; /** * The drawHighlightedGeoms method. * @param renderstate - The renderstate value. */ drawHighlightedGeoms(renderstate: HighlightRenderState): void; /** * The drawSceneGeomData method. * @param renderstate - The renderstate value. * @param mask - The mask value */ drawSceneGeomData(renderstate: GeomDataRenderState, mask?: number): void; /** * The registerPass method. * @param cls - The cls value. * @param passType - The passType value. */ static registerPass(cls: typeof GLPass, passType: number): void; /** * The destroy is called by the system to cause explicit resources cleanup. * Users should never need to call this method directly. */ destroy(loseContext?: boolean): void; } /** Class representing a GL renderer. * @extends GLBaseRenderer */ declare class GLRenderer extends GLBaseRenderer { #private; highlightOutlineThickness: number; renderMode: 'wireframe' | 'hiddenline' | 'flat' | 'flat-noedges' | 'shaded' | 'shaded-noedges' | 'pbr' | 'pbr-noedges'; outlineMethod: 'geometry' | 'image'; outlineThickness: number; outlineColor: Color; hiddenLineColor: Color; outlineSensitivity: number; outlineDepthBias: number; /** * Create a GL renderer. * @param $canvas - The $canvas value. * @param options - The dictionary of options. */ constructor($canvas: HTMLCanvasElement, options?: RendererOptions); /** * The __bindEnvMap method. * @param env - The env value. * @private */ __bindEnvMap(env: EnvMap | BaseImage): void; /** * The setScene method. * @param scene - The scene value. */ setScene(scene: Scene): void; /** * The addViewport method. * @param name - The name value. * @return - The return value. */ addViewport(name: string): GLViewport; /** * Getter for exposure. * @return exposure */ get exposure(): number; /** * Setter for exposure. * @param val - The val value. */ set exposure(val: number); /** * Getter for gamma. */ get gamma(): number; /** * Setter for gamma. * @param val - The val value. */ set gamma(val: number); /** * Getter for displayEnvironment. */ get displayEnvironment(): boolean; /** * Setter for displayEnvironment. * @param val - The val value. */ set displayEnvironment(val: boolean); private bindRaycastViewport; /** * Ray casting is implemented by rendering a small image from the position of the ray, and capturing geometries detected in the resulting image. * This method takes a Ray value, and uses that base the ray cast operation. * * @param ray - The ray to use in the raycast. * @param dist - The maximum distance to cast the ray * @param area - The area to use for the ray * @param mask - The mask to filter our certain pass types. Can be PassType.OPAQUE | PassType.TRANSPARENT | PassType.OVERLAY * @return - The object containing the ray cast results. */ raycastWithRay(ray: Ray, dist: number, area?: number, mask?: number): IntersectionData | null; /** * Ray casting is implemented by rendering a small image from the position of the ray, and capturing geometries detected in the resulting image. * This method takes an Xfo value, and uses that base the ray cast operation. * * @param xfo - The xfo to use in the raycast. * @param dist - The maximum distance to cast the ray * @param area - The area to use for the ray * @param mask - The mask to filter our certain pass types. Can be PassType.OPAQUE | PassType.TRANSPARENT | PassType.OVERLAY * @return - The object containing the ray cast results. */ raycastWithXfo(xfo: Xfo, dist: number, area?: number, mask?: number): IntersectionData | null; /** * Ray casting is implemented by rendering a small image from the position of the ray, and capturing geometries detected in the resulting image. * * @private * * @param xfo - The xfo to use in the raycast. * @param ray - The ray to use in the raycast. * @param dist - The maximum distance to cast the ray * @param area - The area to use for the ray * @param mask - The mask to filter our certain pass types. Can be PassType.OPAQUE | PassType.TRANSPARENT | PassType.OVERLAY * @return - The object containing the ray cast results. */ raycast(xfo: Xfo, ray: Ray, dist: number, area?: number, mask?: number): IntersectionData | null; /** * Ray casting is implemented by rendering a small image from the position of the ray, and capturing geometries detected in the resulting image. * * @private * * @param viewXfo - The xfo to use in the raycast. * @param projectionMatrix - The projectionMatrix to use in the raycast. * @param ray - The ray to use in the raycast. * @param mask - The mask to filter our certain pass types. Can be PassType.OPAQUE | PassType.TRANSPARENT | PassType.OVERLAY * @return - The object containing the ray cast results. */ raycastWithProjection(viewXfo: Xfo, projectionMatrix: Mat4, ray: Ray, mask?: number): IntersectionData | null; /** * * @private * * @param xfo - The ray to use in the raycast. * @param ray - The ray to use in the raycast. * @param dist - The maximum distance to cast the ray * @param area - The area to use for the ray * @param mask - The mask to filter our certain pass types. Can be PassType.OPAQUE | PassType.TRANSPARENT | PassType.OVERLAY * @return - The object containing the ray cast results. */ raycastCluster(xfo: Xfo, ray: Ray, dist: number, area?: number, mask?: number): IntersectionData[]; /** * The drawBackground method. * @param renderstate - The object tracking the current state of the renderer */ drawBackground(renderstate: ColorRenderState): void; /** * The bindGLRenderer method. * @param renderstate - The object tracking the current state of the renderer */ bindGLRenderer(renderstate: RenderState): void; /** * The drawScene method. * @param renderstate - The object tracking the current state of the renderer */ drawScene(renderstate: ColorRenderState): void; } /** * This class abstracts the rendering of a collection of geometries to screen. */ declare class GLFbo { protected colorTextureResizeEventId: number; protected __gl: WebGL12RenderingContext; protected __colorTexture: GLTexture2D; protected __createDepthTexture: boolean; protected __clearColor: Color; __depthTexture: WebGLTexture | null; protected __fbo: WebGLFramebuffer | null; protected __prevBoundFbo: WebGLFramebuffer | null; /** * Creates a GL Framebuffer Object * * @param gl - The Canvas 3D Context. * @param colorTexture - Represents 2D Texture in GL. * @param createDepthTexture - The createDepthTexture value. */ constructor(gl: WebGL12RenderingContext, colorTexture: GLTexture2D, createDepthTexture?: boolean); /** * Sets FBO clear color using RGBA array structure. * * @param clearColor - The clearColor value. */ setClearColor(clearColor: Color): void; /** * Returns the `width` of the GL Texture * * @return - The return value. */ getWidth(): number; /** * Returns the `height` of the GL Texture * * @return - The return value. */ getHeight(): number; /** * Returns the `width`(Index 0) and the `height`(Index 1) of the GL Texture. * * @return - The return value. */ getSize(): Array; /** * Returns the ColorTexture of the Fbo * * @return - The return value. */ getColorTexture(): GLTexture2D; /** * Returns the value of the deptTexture property. * * @return - The return value. */ getDepthTextureGL(): WebGLTexture | null; /** * Returns the `width` of the GL Texture * * @return - width of GLTexture */ get width(): number; /** * Returns the `height` of the GL Texture * * @return - height of GLTexture */ get height(): number; /** * Returns the [width, height] of the GL Texture. * * @return - returns [width, height] of the __colorTexture */ get size(): Array; /** * Returns the ColorTexture of the Fbo * * @returns {GLTexture2D} - returns this.__colorTexture */ get colorTexture(): GLTexture2D; /** * Sets ColorTexture of the Fbo. * * @param colorTexture - The colorTexture value. */ setColorTexture(colorTexture: GLTexture2D): void; /** * Returns the value of the depthTexture property. * * @return */ get depthTextureGL(): WebGLTexture | null; /** * The setup method. */ setup(): void; private createDepthTexture; /** * Triggered Automatically when the texture resizes. * * @todo: Fbos should manage the textures assigned to them. * E.g. resizing and preserving data. */ resize(width: number, height: number, resizeTexture?: boolean): void; /** * Binds the Fbo to the canvas context, meaning that all WRITE operations will affect the current Fbo. * * @param renderstate - The renderstate value. */ bindForWriting(renderstate?: RenderState): void; /** * Unbinds the Fbo to the canvas context for WRITE operations. * * @param renderstate - The renderstate value. */ unbindForWriting(renderstate: RenderState): void; /** * Binds the Fbo to the canvas context, meaning that all WRITE operations will affect the current Fbo. * * @param renderstate - The renderstate value. */ bind(renderstate?: RenderState): void; /** * Unbinds the Fbo to the canvas context for WRITE operations. * * @param renderstate - The renderstate value. */ unbind(renderstate?: RenderState): void; /** * Binds the Fbo to the canvas context, meaning that all READ operations will affect the current Fbo. * * @param renderstate - The renderstate value. */ bindForReading(renderstate?: RenderState): void; /** * Unbinds the Fbo to the canvas context for READ operations. * * @param renderstate - The renderstate value. */ unbindForReading(): void; /** * Enables all color components of the rendering context of the Fbo, * specifying the default color values when clearing color buffers and clears the buffers to preset values. */ clear(): void; /** * Runs [`bind`](#bind) then [`clear`](#clear) methods. * @param renderstate - The renderstate value. */ bindAndClear(renderstate?: RenderState): void; /** * The destroy is called by the system to cause explicit resources cleanup. * Users should never need to call this method directly. */ destroy(): void; } declare function checkFramebuffer(gl: WebGL12RenderingContext, width: number, height: number): void; interface HDRImageData { ldr: HTMLImageElement; cdm: any; } /** * Class representing a VLH image. * * **Events** * * **loaded:** Triggered when image data is loaded. * * **updated:** Triggered when image data is updated. * * @extends BaseImage */ declare class HDRImage extends BaseImage { exposure: number; hdrTint: Color; protected __data: HDRImageData; /** * Create a VLH image. * @param name - The name value. * @param params - The params value. */ constructor(name?: string, params?: Record); /** * The __decodeData method. * @param entries - The entries value. * @private */ __decodeData(entries: Record): Promise; /** * Loads a vlh file given a URL. * @param url - The URL of the vlh file to load * @return - Returns a promise that resolves once the initial load is complete */ load(url: string): Promise; /** * Returns if the data is a stream or not. * * @return - The return value. */ isStream(): boolean; /** * Returns all parameters and class state values. * * @return - The return value. */ getParams(): ImageParams; /** * The setHDRTint method. * @private * @param hdrTint - The hdrTint value. */ setHDRTint(hdrTint: Color): void; /** * The getHDRTint method. * @private * @return - The return value. */ getHDRTint(): Color; /** * Sets state of current Image using a binary reader object, and adds it to the resource loader. * * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context: Record): void; } /** Class representing a GL high dynamic range (HDR) image. * @extends GLTexture2D * @private */ declare class GLHDRImage extends GLTexture2D { protected listenerIDs: Record; protected hdrImage: HDRImage; protected fbo: GLFbo | null; protected srcLDRTex: GLTexture2D | null; protected srcCDMTex: GLTexture2D | null; protected unpackHDRShader: GLShader | null; protected shaderBinding: IGeomShaderBinding | null; /** * Create a GL HDR image. * @param gl - The webgl rendering context. * @param hdrImage - The HDR image. */ constructor(gl: WebGL12RenderingContext, hdrImage: HDRImage); /** * Returns the `BaseImage` of the GL Texture * * @return - The return value. */ getImage(): BaseImage; /** * The __unpackHDRImage method. * @param hdrImageParams - The HDR image parameters. * @private */ __unpackHDRImage(hdrImageParams: Record): void; /** * The bindToUniform method. * @param renderstate - The object tracking the current state of the renderer * @param unif - The WebGL uniform * @param bindings - The bindings value. * @return - The return value. */ bindToUniform(renderstate: RenderState, unif: ShaderUniform, bindings?: Record): boolean; /** * The destroy is called by the system to cause explicit resources cleanup. * Users should never need to call this method directly. */ destroy(): void; } declare const FRAMEBUFFER: { MSAA_RENDERBUFFER: number; COLORBUFFER: number; DEPTHBUFFER: number; }; /** * Class representing a GL base viewport. * @extends ParameterOwner * @private */ declare class GLBaseViewport extends ParameterOwner { protected __gl: WebGL12RenderingContext; protected renderer: GLRenderer; protected __renderer: GLRenderer; protected __fbo: WebGLFramebuffer | null; protected quad: GLMesh; protected offscreenBuffer: GLTexture2D | null; protected depthTexture: GLTexture2D | null; protected highlightedGeomsBufferFbo: GLRenderTarget; protected __backgroundTexture: BaseImage | null; protected __backgroundGLTexture: GLHDRImage | GLTexture2D | null; protected offscreenBufferFbo: GLRenderTarget | null; width: number; height: number; protected __canvasWidth: number; protected __canvasHeight: number; protected fb: Array | null; protected colorRenderbuffer: WebGLRenderbuffer; protected depthBuffer: WebGLRenderbuffer | null; protected EXT_frag_depth: EXT_frag_depth | null; protected manipulator: BaseTool; protected depthRange: number[]; protected region: Array; /** * @member backgroundColorParam - Changes background color of the scene */ backgroundColorParam: ColorParameter; clickTime: number; doubleClickTime: number; longPressTime: number; pointerClickTolerance: number; protected longPressId: NodeJS.Timeout; /** * Create a GL base viewport. * @param renderer - The renderer value. */ constructor(renderer: GLRenderer); /** * Returns the renderer this viewport is bound to. */ getRenderer(): GLBaseRenderer; /** * The getWidth method. * @return - The return value. */ getWidth(): number; /** * The getHeight method. * @return - The return value. */ getHeight(): number; /** * The resize method. * @param canvasWidth - The canvasWidth value. * @param canvasHeight - The canvasHeight value. */ resize(canvasWidth: number, canvasHeight: number): void; /** * Resize any offscreen render targets. * > Note: Values ,ay not be the entire canvas with if multiple viewports exists. * @param width - The width used by this viewport. * @param height - The height used by this viewport. */ resizeRenderTargets(width: number, height: number): void; /** * The draw method. * @param renderstate - The object tracking the current state of the renderer */ draw(renderstate: ColorRenderState): void; /** * Draws the Silhouettes around geometries. * @param renderstate - The object tracking the current state of the renderer * @private */ drawSilhouettes(renderstate: RenderState): void; /** * Draws the highlights around geometries. * @param renderstate - The object tracking the current state of the renderer * @private */ drawHighlights(renderstate: HighlightRenderState): void; /** * The getManipulator method. * @return - The return value. */ getManipulator(): BaseTool; /** * Sets the tool that will receive mouse, touch and keyboard events from the viewport. * @param tool - The manipulator value. */ setManipulator(tool: BaseTool): void; /** * Handler of the `pointerdown` event fired when the pointer device is initially pressed. * * @param event - The DOM event produced by a pointer */ onPointerDown(event: ZeaPointerEvent): void; /** * Handler of the `pointerup` event fired when the pointer device is finally released. * * @param event - The DOM event produced by a pointer */ onPointerUp(event: ZeaPointerEvent): void; /** * Handler of the `pointermove` event fired when the pointer device changes coordinates, and the pointer has not been cancelled * * @param event - The DOM event produced by a pointer */ onPointerMove(event: ZeaPointerEvent): void; /** * Invoked when the mouse pointer is moved into this viewport. * * @param event - The DOM event produced by a pointer */ onPointerEnter(event: ZeaPointerEvent): void; /** * Invoked when the mouse pointer is moved out of this viewport. * * @param event - The DOM event produced by a pointer */ onPointerLeave(event: ZeaPointerEvent): void; /** * Invoked when the mouse pointer is moved out of an element. * @param event - The event that occurs. */ onMouseLeave(event: ZeaPointerEvent): void; /** * Invoked when the user is pressing a key on the keyboard. * @param event - The event that occurs. */ onKeyDown(event: ZeaKeyboardEvent): void; /** * Causes an event to occur when the user releases a key on the keyboard. * @param event - The event that occurs. */ onKeyUp(event: ZeaKeyboardEvent): void; } /** Class representing GL points. * @extends GLGeom * @private */ declare class GLPoints extends GLGeom { /** * Create a GL point. * @param gl - The webgl rendering context. * @param points - The points value. */ constructor(gl: WebGL12RenderingContext, points: Points | PointsProxy); /** * The draw method. * @param renderstate - The object tracking the current state of the renderer */ draw(renderstate: RenderState): void; /** * The drawInstanced method. * @param renderstate - The object tracking the current state of the renderer * @param instanceCount - The instanceCount value. */ drawInstanced(renderstate: RenderState, instanceCount: number): void; } /** Class representing GL lines. * @extends GLGeom * @private */ declare class GLLines extends GLGeom { protected numSegIndices: number; private fatBuffersNeedUpload; private numFatVertices; private fatBuffers; protected indexDataType: number; /** * Create a GL line. * @param gl - The webgl rendering context. * @param lines - The geom value. */ constructor(gl: WebGL12RenderingContext, lines: Lines | LinesProxy); /** * The dirtyBuffers method. * @param opts - options passed when geomDataChanged is emitted. (Currently ony used by the FreehandLines tool) */ dirtyBuffers(opts: Record): void; /** * The clearBuffers method. */ clearBuffers(): void; /** * The genFatBuffers method. * @param renderstate - The object tracking the current state of the renderer */ genFatBuffers(renderstate: RenderState): void; /** * The genBuffers method. * @param renderstate - The object tracking the current state of the renderer */ genBuffers(renderstate: RenderState): void; /** * The bind method. * @param renderstate - The object tracking the current state of the renderer * @return - The return value. */ bind(renderstate: RenderState): boolean; /** * The drawPoints method. */ drawPoints(): void; /** * The draw method. * @param renderstate - The object tracking the current state of the renderer */ draw(renderstate: RenderState): void; /** * The drawInstanced method. * @param renderstate - The object tracking the current state of the renderer * @param instanceCount - The instanceCount value. */ drawInstanced(renderstate: RenderState, instanceCount: number): void; } /** Class representing a GL mesh. * @extends GLGeom * @private */ declare class GLPointsItemSet extends GLGeomItemSetMultiDraw { /** * Draw an item to screen. * @param renderstate - The object tracking the current state of the renderer * @param drawIds - the draw id for each element drawn in by this draw call. * @param counts - the geom element count for each element drawn in by this draw call. * @param offsets - the geom element offset for each element drawn in by this draw call. * @param drawCount - the number of active draw calls for this invocation */ multiDraw(renderstate: RenderState, counts: Int32Array, offsets: Int32Array, drawCount: number): void; } /** Class representing a GL mesh. * @extends GLGeom * @private */ declare class GLLinesItemSet extends GLGeomItemSetMultiDraw { /** * Draw an item to screen. * @param renderstate - The object tracking the current state of the renderer * @param drawIds - the draw id for each element drawn in by this draw call. * @param counts - the geom element count for each element drawn in by this draw call. * @param offsets - the geom element offset for each element drawn in by this draw call. * @param drawCount - the number of active draw calls for this invocation */ multiDraw(renderstate: RenderState, counts: Int32Array, offsets: Int32Array, drawCount: number): void; } /** Class representing a GL mesh. * @extends GLGeom * @private */ declare class GLMeshItemSet extends GLGeomItemSetMultiDraw { /** * Draw an item to screen. * @param renderstate - The object tracking the current state of the renderer * @param drawIds - the draw id for each element drawn in by this draw call. * @param counts - the geom element count for each element drawn in by this draw call. * @param offsets - the geom element offset for each element drawn in by this draw call. * @param drawCount - the number of active draw calls for this invocation */ multiDraw(renderstate: RenderState, counts: Int32Array, offsets: Int32Array, drawCount: number): void; } /** This class abstracts the rendering of a collection of geometries to screen. * @extends GLPass */ declare class GLStandardGeomsPass extends GLPass { protected materials: Map; protected listenerIDs: Map>; /** * Create a GL pass. */ constructor(); /** * The init method. * @param renderer - The renderer value. * @param passIndex - The index of the pass in the GLRenderer */ init(renderer: GLRenderer, passIndex: number): void; /** * The itemAddedToScene method is called on each pass when a new item * is added to the scene, and the renderer must decide how to render it. * It allows Passes to select geometries to handle the drawing of. * @param treeItem - The treeItem value. * @param rargs - Extra return values are passed back in this object. * The object contains a parameter 'continueInSubTree', which can be set to false, * so the subtree of this node will not be traversed after this node is handled. * @return - Returns true if the item is now added to the pass. */ itemAddedToScene(treeItem: TreeItem, rargs: Record): boolean; /** * The itemRemovedFromScene method is called on each pass when aa item * is removed to the scene, and the pass must handle cleaning up any resources. * @param treeItem - The treeItem value. * @param rargs - Extra return values are passed back in this object. * @return - The return value. */ itemRemovedFromScene(treeItem: TreeItem, rargs: Record): boolean; /** * The filterGeomItem method. * @param geomItem - The geomItem value. * @return - The return value. */ filterGeomItem(geomItem: GeomItem): boolean; /** * Checks the material to see if it is opaque. * @param material - The geomItem value. * @return - The return value. */ checkMaterial(material: Material): boolean; /** * The addGeomItem method. * @param geomItem - The geomItem value. */ addGeomItem(geomItem: GeomItem): void; /** * The removeGeomItem method. * @param geomItem - The geomItem value. */ removeGeomItem(geomItem: GeomItem): void; /** * The constructShader method. * Given a material, generate the various shaders required to render objects * using this material. There should always be at least a single glShader * and optionally a glgeomdatashader for rendering the goem data buffer * and a glselectedshader for rendering selection hilghlights * @param shaderName - The name of the base shader. * @return - The object containing the shader instances. */ constructShader(shaderName: string): GLShader; /** * The getGeomItemAndDist method. * @param geomData - The geomData value. * @return - The return value. */ getGeomItemAndDist(geomData: Float32Array | Uint8Array): GeomItemAndDist | undefined; } /** Class representing a GL opaque geoms pass. * @extends GLStandardGeomsPass * @private */ declare class GLOpaqueGeomsPass extends GLStandardGeomsPass { private glShaderMaterials; private glShaderGeomSets; /** * Create a GL opaque geoms pass. */ constructor(); /** * Returns the pass type. OPAQUE passes are always rendered first, followed by TRANSPARENT passes, and finally OVERLAY. * @return - The pass type value. */ getPassType(): number; /** * The filterGeomItem method. * @param geomItem - The geomItem value. * @return - The return value. */ filterGeomItem(geomItem: GeomItem): boolean; /** * Checks the material to see if it is opaque. * @param material - The geomItem value. * @return - The return value. */ checkMaterial(material: Material): boolean; /** * Removes the GeomITem from this pass, and then asks the renderer to re-add it. * @param geomItem - The geomItem value. */ removeAndReAddGeomItem(geomItem: GeomItem): void; /** * The addGeomItem method. * @param geomItem - The geomItem value. * @return - The return value. */ addGeomItem(geomItem: GeomItem): void; protected addGeomItemToMultiDraw(geomItem: GeomItem, glGeomItem: GLGeomItem): void; protected addGeomItemToConventionalDraw(geomItem: GeomItem, glGeomItem: GLGeomItem): void; /** * The removeGeomItem method. * @param geomItem - The geomItem value. * @return - The return value. */ removeGeomItem(geomItem: GeomItem): void; /** * The removeMaterial method. * @param material - The material value. */ removeMaterial(material: Material): void; /** * The traverseTreeAndDraw method. * @param renderstate - The renderstate value. * @private */ traverseTreeAndDraw(renderstate: ColorRenderState): void; /** * The draw method. * @param renderstate - The object tracking the current state of the renderer */ draw(renderstate: ColorRenderState): void; /** * The drawHighlightedGeoms method. * @param renderstate - The object tracking the current state of the renderer */ drawHighlightedGeoms(renderstate: HighlightRenderState): void; /** * The drawGeomData method. * @param renderstate - The object tracking the current state of the renderer */ drawGeomData(renderstate: GeomDataRenderState): void; } /** Class representing a GL opaque geoms pass. * @extends GLOpaqueGeomsPass * @private */ declare class GLLinesPass extends GLOpaqueGeomsPass { protected linesGeomDataBuffer: GLTexture2D | null; protected fattenLinesShader: FattenLinesShader | null; protected quad: GLMesh | null; protected fbo: WebGLFramebuffer | null; /** * Create a GL opaque geoms pass. */ constructor(); /** * The init method. * @param renderer - The renderer value. * @param passIndex - The index of the pass in the GLBAseRenderer */ init(renderer: GLRenderer, passIndex: number): void; /** * The filterGeomItem method. * @param geomItem - The geomItem value. * @return - The return value. */ filterGeomItem(geomItem: GeomItem): boolean; /** * The draw method. * @param renderstate - The object tracking the current state of the renderer */ draw(renderstate: ColorRenderState): void; /** * The drawGeomData method. * @param renderstate - The object tracking the current state of the renderer */ drawGeomData(renderstate: GeomDataRenderState): void; } interface TransparentItem { geomItem: GeomItem; glShader: GLShader; glGeom: GLGeom; glMaterial: GLMaterial; glGeomItem: GLGeomItem; material: Material; dist: number; } /** Class representing a GL transparent geoms pass. * @extends GLStandardGeomsPass * @private */ declare class GLTransparentGeomsPass extends GLStandardGeomsPass { protected itemCount: number; protected glShaderGeomSets: Record; protected transparentItems: TransparentItem[]; private transparentItemIndices; private freeList; protected visibleItems: TransparentItem[]; private prevSortCameraPos; private sortCameraMovementDistance; protected reSort: boolean; /** * Create GL transparent geoms pass. */ constructor(); /** * The init method. * @param renderer - The renderer value. * @param passIndex - The index of the pass in the GLBAseRenderer */ init(renderer: GLRenderer, passIndex: number): void; /** * Returns the pass type. OPAQUE passes are always rendered first, followed by TRANSPARENT passes, and finally OVERLAY. * @return - The pass type value. */ getPassType(): number; /** * The init method. * @param geomItem - The geomItem value. * @return - The return value. */ filterGeomItem(geomItem: GeomItem): boolean; /** * When an item visibility changes, we trigger this method, as new items become visible */ resortNeeded(): void; /** * The addGeomItem method. * @param geomItem - The geomItem value. */ addGeomItem(geomItem: GeomItem): void; /** * The removeGeomItem method. * @param geomItem - The geomItem value. */ removeGeomItem(geomItem: GeomItem): boolean; /** * Sorts the drawn items in order furthest to nearest when rendering transparent objects. * @param viewPos - The position of the camera that we are sorting relative to. */ sortItems(viewPos: Vec3): void; /** * Draw n individual item, binding the shader and material if necessary. * @param renderstate - current renderstad * @param transparentItem - current item to render * @param cache - cache tracking which material/shader is currently bound. */ private drawItem; /** * The _drawItems method. * @param renderstate - The object tracking the current state of the renderer * @private */ _drawItems(renderstate: ColorRenderState): void; /** * The draw method. * @param renderstate - The object tracking the current state of the renderer */ draw(renderstate: ColorRenderState): void; /** * The drawHighlightedGeoms method. * @param renderstate - The object tracking the current state of the renderer */ drawHighlightedGeoms(renderstate: HighlightRenderState): void; /** * The drawGeomData method. * @param renderstate - The object tracking the current state of the renderer */ drawGeomData(renderstate: GeomDataRenderState): void; } /** * An Image Atlas lays out multiple smaller images within a larger image atlas, and tracks their positions. * @private */ declare class GLImageAtlas extends GLRenderTarget { protected name: string; protected formatParam: string; protected typeParam: string; protected subImages: any[]; protected layoutNeedsRegeneration: boolean; protected asyncCount: number; protected loaded: boolean; protected ready: boolean; protected layout: Array; protected atlasLayoutTexture: any; protected layoutVec4s: Array; protected atlasLayoutShaderBinding: IGeomShaderBinding | null; protected atlasLayoutShader: GLShader | null; /** * Create an image atlas.. * @param gl - The webgl rendering context. * @param name - The name value. * @param format - The format value. * @param type - The type value. */ constructor(gl: WebGL12RenderingContext, name: string, format?: string, type?: string); incAsyncCount(count?: number): void; decAsyncCount(): void; /** * The isLoaded method. * @return - The return value. */ isLoaded(): boolean; /** * The addSubImage method. * @param subImage - The subImage value. * @return - The return value. */ addSubImage(subImage: BaseImage | WebGLTexture | null): number; /** * The removeSubImage method. * @param subImage - The subImage value. */ removeSubImage(subImage: BaseImage): void; /** * The getSubImage method. * @param index - The index value. * @return - The image value. */ getSubImage(index: number): GLTexture2D; /** * The numSubImages method. * @return - The return value. */ numSubImages(): number; /** * The generateAtlasLayout method. */ generateAtlasLayout(minTileSize?: any): void; /** * The getLayoutData method. * @param index - The index value. * @return - The return value. */ getLayoutData(index: number): Array; /** * The renderAtlas method. * @param cleanup - The cleanup value. * @param off - The off value. */ renderAtlas(cleanup?: boolean, off?: number): void; /** * The isReady method. * @return - The return value. */ isReady(): boolean; /** * The bindToUniform method. * @param renderstate - The object tracking the current state of the renderer * @param unif - The WebGL uniform * @return - The return value. */ bindToUniform(renderstate: RenderState, unif: ShaderUniform): boolean; /** * The cleanup method. */ cleanup(): void; /** * The destroy is called by the system to cause explicit resources cleanup. * Users should never need to call this method directly. */ destroy(): void; } /** Class representing a GL billboards pass. * @extends GLPass * @private */ declare class GLBillboardsPass extends GLPass { protected billboards: any[]; protected dirtyBillboards: Set; protected freeIndices: Array; protected drawCount: number; protected threshold: number; protected updateRequested: boolean; protected prevSortCameraPos: Vec3; protected atlas: GLImageAtlas | null; protected indexArrayUpdateNeeded: boolean; protected instanceIdsBuffer: WebGLBuffer | null; protected indexArray: Float32Array; protected glshader: GLShader | null; protected shaderComp: Record; protected shaderBinding: IGeomShaderBinding | null; protected modelMatrixArray: Array; protected billboardDataArray: Array; protected tintColorArray: Array>; protected width: number; protected drawItemsTexture: GLTexture2D | null; /** * Create a GL billboards pass. */ constructor(); /** * The init method. * @param renderer - The renderer value. * @param passIndex - The index of the pass in the GLBAseRenderer */ init(renderer: GLRenderer, passIndex: number): void; /** * Returns the pass type. OPAQUE passes are always rendered first, followed by TRANSPARENT passes, and finally OVERLAY. * @return - The pass type value. */ getPassType(): number; /** * The itemAddedToScene method is called on each pass when a new item * is added to the scene, and the renderer must decide how to render it. * It allows Passes to select geometries to handle the drawing of. * @param treeItem - The treeItem value. * @param rargs - Extra return values are passed back in this object. * The object contains a parameter 'continueInSubTree', which can be set to false, * so the subtree of this node will not be traversed after this node is handled. * @return - The return value. */ itemAddedToScene(treeItem: TreeItem, rargs: Record): boolean; /** * The itemRemovedFromScene method is called on each pass when aa item * is removed to the scene, and the pass must handle cleaning up any resources. * @param treeItem - The treeItem value. * @param rargs - Extra return values are passed back in this object. * @return - The return value. */ itemRemovedFromScene(treeItem: TreeItem, rargs: Record): boolean; /** * The addBillboard method. * @param billboard - The billboard value. */ addBillboard(billboard: BillboardItem): void; /** * The removeBillboard method. * @param billboard - The billboard value. */ removeBillboard(billboard: any): void; /** * The populateBillboardDataArray method. * @param billboardData - The billboardData value. * @param index - The index value. * @param dataArray - The dataArray value. * @private */ populateBillboardDataArray(billboardData: any, index: number, dataArray: any): void; /** * The requestUpdate method. * @private */ requestUpdate(): void; /** * The reqUpdateIndexArray method. * @private */ reqUpdateIndexArray(): void; updateIndexArray(): void; /** * The updateBillboards method. * @param renderstate - The object tracking the current state of the renderer * @private */ updateBillboards(renderstate: RenderState): void; /** * The updateBillboard method. * @param index - The index of the Billboard to update . * @private */ updateBillboard(index: number): void; /** * The sort method. * @param cameraPos - The cameraPos value. */ sort(cameraPos: Vec3): void; /** * Invoke the drawing of each item, compiling the shader using the provided key. * @param renderstate - The object tracking the current state of the renderer * @param key - The key to cache the compiler results against. */ __draw(renderstate: RenderState, key: string): void; /** * The sort method. * @param renderstate - The object tracking the current state of the renderer */ draw(renderstate: RenderState): void; /** * The drawHighlightedGeoms method. * @param renderstate - The object tracking the current state of the renderer */ drawHighlightedGeoms(renderstate: HighlightRenderState): void; /** * The drawGeomData method. * @param renderstate - The object tracking the current state of the renderer */ drawGeomData(renderstate: GeomDataRenderState): void; /** * The getGeomItemAndDist method. * @param geomData - The geomData value. * @return - The return value. */ getGeomItemAndDist(geomData: Float32Array | Uint8Array): GeomItemAndDist | undefined; } /** Class representing a GL overlay pass. * @extends GLOpaqueGeomsPass */ declare class GLOverlayPass extends GLOpaqueGeomsPass { /** * Create a GL overlay pass. * @param name - The name value. */ constructor(); /** * Returns the pass type. OPAQUE passes are always rendered first, followed by TRANSPARENT passes, and finally OVERLAY. * @return - The pass type value. */ getPassType(): number; /** * The filterGeomItem method. * @param geomItem - The geomItem value. * @return - The return value. */ filterGeomItem(geomItem: GeomItem): boolean; /** * The draw method. * @param renderstate - The object tracking the current state of the renderer */ draw(renderstate: ColorRenderState): void; /** * The drawGeomData method. * @param renderstate - The object tracking the current state of the renderer */ drawGeomData(renderstate: GeomDataRenderState): void; } /** Class representing a GL treeItems pass. * @extends GLPass * @private */ declare class GLBoundingBoxPass extends GLPass { protected boxes: any[]; protected dirtyBoxes: Set; protected freeIndices: Array; protected idToIndex: Map; protected drawCount: number; protected indexArrayUpdateNeeded: boolean; protected __updateRequested: boolean; protected glgeom?: GLGeom; protected glshader?: GLShader; protected __modelMatrixArray: Array; protected __treeItemDataArray: Array>; protected __tintColorArray: Array>; protected __instanceIdsBuffer?: WebGLBuffer; protected __indexArray: Float32Array; protected __drawItemsTexture?: GLTexture2D; protected width: number; /** * Create a GL treeItems pass. */ constructor(); /** * The getPassType method. * @return - The pass type value. */ getPassType(): number; /** * The init method. * @param renderer - The renderer value. * @param passIndex - The index of the pass in the GLBAseRenderer */ init(renderer: GLRenderer, passIndex: number): void; /** * The itemAddedToScene method is called on each pass when a new item * is added to the scene, and the renderer must decide how to render it. * It allows Passes to select geometries to handle the drawing of. * @param treeItem - The treeItem value. * @param rargs - Extra return values are passed back in this object. * The object contains a parameter 'continueInSubTree', which can be set to false, * so the subtree of this node will not be traversed after this node is handled. * @return - The return value. */ itemAddedToScene(treeItem: TreeItem, rargs: Record): boolean; /** * The itemRemovedFromScene method is called on each pass when aa item * is removed to the scene, and the pass must handle cleaning up any resources. * @param treeItem - The treeItem value. * @param rargs - Extra return values are passed back in this object. * @return - The return value. */ itemRemovedFromScene(treeItem: TreeItem, rargs: Record): boolean; /** * Adds tree items to the renderer, selecting the correct pass to delegate rendering too, and listens to future changes in the tree. * * @param treeItem - The tree item to add. */ addTreeItem(treeItem: TreeItem, continueIntoSubTree?: boolean): void; /** * The bindTreeItem method. * @param treeItem - The treeItem value. */ bindTreeItem(treeItem: TreeItem): void; /** * The unbindTreeItem method. * @param treeItem - The treeItem value. */ unbindTreeItem(treeItem: TreeItem): void; /** * The __populateBoxesDataArray method. * @param treeItemData - The treeItemData value. * @param index - The index value. * @param dataArray - The dataArray value. * @private */ __populateBoxesDataArray(treeItemData: any, index: number, dataArray: any): void; __updateIndexArray(): void; /** * The __updateBoxes method. * @private */ __updateBoxes(): void; /** * The __updateBoxes method. * @param index - The index value. * @private */ __updateBox(index: number): void; /** * The sort method. * @param renderstate - The object tracking the current state of the renderer */ draw(renderstate: RenderState): void; } declare class GLMaskGeomsPass extends GLOpaqueGeomsPass { private frontRenderTarget; private backRenderTarget; private itemCount; drawMaskGeoms: boolean; init(renderer: GLRenderer, passIndex: number): void; filterGeomItem(geomItem: GeomItem): boolean; /** * The addGeomItem method. * @param geomItem - The geomItem value. */ addGeomItem(geomItem: GeomItem): void; /** * The removeGeomItem method. * @param geomItem - The geomItem value. */ removeGeomItem(geomItem: GeomItem): void; /** * The draw method. * @param renderstate - The object tracking the current state of the renderer */ draw(renderstate: ColorRenderState): void; drawGeomData(renderstate: GeomDataRenderState): void; } /** Class representing GL material geom item sets. * @private */ declare class GLMaterialGeomItemSets extends EventEmitter { private pass; private gl; glMaterial: GLMaterial; private glGeomItemSets; private listenerIds; private drawCount; /** * Create a GL material geom item set. * @param pass - The pass that owns the GLMaterialGeomItemSets. * @param glMaterial - The glMaterial value. */ constructor(pass: GLStandardGeomsPass, glMaterial: GLMaterial); /** * The addGLGeomItem method. * @param glGeomItem - The glGeomItem value. * @param glGeom - The glGeomItem value. * @private */ addGLGeomItem(glGeomItem: GLGeomItem, glGeom: GLGeom): void; /** * The drawCountChanged method. * @param event - The change value. * @private */ private drawCountChanged; /** * The addGeomItemSet method. * @param glGeomItemSet - The glGeomItemSet value. */ addGeomItemSet(glGeomItemSet: GLGeomItemSet): void; /** * Draws all elements, binding the shader and continuing into the GLGeomItemSet * @param renderstate - The render state for the current draw traversal */ draw(renderstate: ColorRenderState): void; /** * The drawHighlighted method. * @param renderstate - The object tracking the current state of the renderer */ drawHighlighted(renderstate: HighlightRenderState): void; /** * The drawHighlightedGeoms method. * @param renderstate - The object tracking the current state of the renderer */ drawGeomData(renderstate: GeomDataRenderState): void; } /** Class representing GL shader materials. * @private */ declare class GLShaderMaterials extends EventEmitter { private gl; private pass; private glShader; private glShaderKey; private glShaderGeomDataKey; private glShaderHighlightKey; private glMaterialGeomItemSets; /** * Create a GL shader material. * @param gl - The WebGL Context value. * @param pass - The pass that owns this GLShaderMaterials object. * @param shaders - The shaders value. */ constructor(gl: WebGL12RenderingContext, pass: GLStandardGeomsPass, glShader: GLShader); private getOrCreateGLMaterialGeomItemSets; addGLGeomItem(glGeomItem: GLGeomItem, glGeom: GLGeom, glMaterial: GLMaterial): void; private addMaterialGeomItemSets; /** * The removeMaterialGeomItemSets method. * @param glMaterialGeomItemSets - The glMaterialGeomItemSets value. */ removeMaterialGeomItemSets(glMaterial: GLMaterial): void; /** * Draws all elements, binding the shader and continuing into the GLMaterialGeomItemSets * @param renderstate - The render state for the current draw traversal */ draw(renderstate: ColorRenderState): void; /** * The drawHighlightedGeoms method. * @param renderstate - The object tracking the current state of the renderer */ drawHighlightedGeoms(renderstate: HighlightRenderState): void; /** * The drawGeomData method. * @param renderstate - The object tracking the current state of the renderer */ drawGeomData(renderstate: GeomDataRenderState): void; } interface ViewportRenderState { region: number[]; viewMatrix: Mat4; projectionMatrix?: Mat4; isOrthographic: number; viewportFrustum?: Vec4; fovY?: number; } interface ShaderInstanceGeom { attrBuffers: Record; indexBuffer?: WebGLBuffer; indexDataType?: number; numVertices?: number; numTriIndices?: number; } interface StackObj { name: string; enabled: Set; disabled: Set; functions: Record; } declare class RenderState { gl: WebGL12RenderingContext; renderer: GLBaseRenderer; stack: Array; top: StackObj | null; glShader?: GLShader; shaderkey?: string; directives: string[]; directivesHash: string; attrs: ShaderAttributes; unifs: ShaderUniforms; drawItemsTexture?: GLTexture2D; shaderInstancedGeom?: ShaderInstanceGeom; glGeom?: GLGeom; boundVao?: WebGLVertexArrayObject; xrviewport?: XRViewport; passIndex: number; pass?: string; vrPresenting?: boolean; supportsInstancing?: boolean; viewport?: GLBaseViewport; viewports?: Array; bindViewports: (unifs: ShaderUniforms, draw: () => void) => void; bindRendererUnifs: (unifs: ShaderUniforms) => void; boundTextures: number; boundRendertarget: WebGLFramebuffer | null; geometryMaskTextures: WebGLTexture[]; viewXfo?: Xfo; viewScale: number; region?: number[]; depthRange?: number[]; cameraMatrix?: Mat4; constructor(gl: WebGL12RenderingContext); pushGLStack(name: string): void; popGLStack(): void; glEnable(prop: number): void; glDisable(prop: number): void; bindTexture(unif: ShaderUniform, gltex: WebGLTexture): void; } /** Class representing a GL probe. * @private */ declare class GLProbe extends EventEmitter { protected __gl: WebGL12RenderingContext; protected maxFragmentShaderTextureUnits: any; protected textureType: number; protected textureDesc: number[]; protected __convolved: boolean; protected __fbos: any[]; protected brdfLUTTexture: any; protected irradianceCubeTex: any; protected specularCubetex: any; /** * Create a GL probe. * @param gl - The webgl rendering context. * @param name - The name value. */ constructor(gl: WebGL12RenderingContext, name: string); /** * The convolveProbe method. * @param srcGLTex - The srcGLTex value. */ convolveProbe(srcGLTex: GLTexture2D): void; /** * The bind method. * @param renderstate - The object tracking the current state of the renderer * @param unif - The WebGL uniform * @return - Returns true if the Probe was successfully bound. */ bind(renderstate: RenderState): boolean; /** * The destroy is called by the system to cause explicit resources cleanup. * Users should never need to call this method directly. */ destroy(): void; } declare class EnvMapShader extends GLShader { /** * Create a GL shader. * @param gl - The webgl rendering context. */ constructor(gl: WebGL12RenderingContext); } /** * An EnvMap can load High Dynamic Range environment map images, necessary for high quality PBR lighting. * * * **Parameters** * * **HeadLightMode(`BooleanParameter`):** Enables Headlight mode so that the environment lighting is aligned with the camera. * With Headlight mode on, the top of the env map is aligned with the direction of the camera, so a the view is generally well lit. * * @extends HDRImage */ declare class EnvMap extends HDRImage { protected utf8decoder: TextDecoder; protected shCoeffs: any[]; protected luminanceData: any; headlightModeParam: BooleanParameter; /** * Create an env map. * @param name - The name value. * @param params - The params value. */ constructor(name?: string, params?: Record); /** * The __decodeData method. * @param entries - The entries value. * @return * @private */ __decodeData(entries: Record): Promise; /** * Calculate the luminance of the Environment in the direction. * * @param dir - The dir value. * @return - The return value. */ dirToLuminance(dir: Vec3): any; } /** Class representing a GL environment map. * @extends GLProbe * @private */ declare class GLEnvMap extends GLProbe { protected __renderer: GLRenderer; protected __envMap: EnvMap; protected __backgroundFocus: number; protected __srcGLTex: GLHDRImage | null; protected __envMapShader: EnvMapShader | null; protected __envMapShaderBinding: IGeomShaderBinding | null; protected __lodPyramid: any; /** * Create a GL env map. * @param renderer - The renderer value. * @param envMap - The environment map. */ constructor(renderer: GLRenderer, envMap: EnvMap); get glTex(): GLHDRImage; /** * @private */ init(): void; /** * The getEnvMap method. * @return - The return value. */ getEnvMap(): EnvMap; /** * The getBackgroundFocus method. * @return - The return value. */ getBackgroundFocus(): number; /** * The setBackgroundFocus method. * @param val - The val param. */ setBackgroundFocus(val: number): void; /** * The draw method. * @param renderstate - The object tracking the current state of the renderer */ draw(renderstate: ColorRenderState): void; /** * The destroy is called by the system to cause explicit resources cleanup. * Users should never need to call this method directly. */ destroy(): void; } declare class HighlightRenderState extends RenderState { } declare class ColorRenderState extends RenderState { envMap?: GLEnvMap; renderMode: string; outlineMethod: string; outlineThickness: number; outlineColor: Color; hiddenLineColor: Color; screenQuad: GLScreenQuad; exposure: number; gamma: number; toHighlightRenderState(): HighlightRenderState; } declare class GeomDataRenderState extends RenderState { geomDataFbo?: GLRenderTarget; floatGeomBuffer: boolean; occlusionCulling: number; } /** * Represents a texture that contains 2-dimensional images. * Images have width and height, but no depth. * * @extends RefCounted */ declare class GLTexture2D extends RefCounted { protected __gl: WebGL12RenderingContext; protected ready: boolean; width: number; height: number; protected textureType: number; protected textureDesc: number[]; protected __loaded: boolean; protected __bound: boolean; protected __image: BaseImage | null; protected __internalFormat: number; protected __type: number; protected __format: number; protected __wrapParam: number; protected params: Record; protected __minFilter: number; protected __magFilter: number; protected __wrapS: number; protected __wrapT: number; protected __flipY: boolean; protected __mipMapped: boolean; invert: boolean; alphaFromLuminance: boolean; protected gltex: WebGLTexture | null; protected __typeParam: string; protected __formatParam: string; /** * Create a GL texture 2D. * * @param gl - The gl value. * @param params - The params value. */ constructor(gl: WebGL12RenderingContext, params?: BaseImage | Record); /** * Returns the loaded status of the 2D Texture * * @return - The return value. */ isLoaded(): boolean; /** * Returns the `BaseImage` of the GL Texture * * @return - The return value. */ getImage(): BaseImage | null; /** * Returns the specified value of the color components in the texture. * * @return - The return value. */ getInternalFormat(): number; /** * Returns the value of the specified data type of the texel data. * * @return - The return value. */ getType(): number; /** * Returns the value of the specified texel data. It must be the same as the `internalFormat` * * @return - The return value. */ getFormat(): number; /** * Returns the value of the specified wrapping function for texture coordinate * * @return - The return value. */ getWrap(): number; /** * Returns the value of the specified binding point. * * @return - The return value. */ getMipMapped(): boolean; /** * Builds the GLTexture2D using the specified parameters object. * Parameters must have the `BaseImage` properties structure. * * @param params - The params value. * * @param emit - The emit value. */ configure(params: Record): void; private activateLastTextureUnit; /** * The updateGLTexParams method. * @private */ private updateGLTexParams; /** * Initializes and creates the buffer of the object's data store. * * @param data - The data value. * @param width - The width value. * @param height - The height value. * @param bind - The bind value. * @param emit - The emit value. */ bufferData(data: HTMLImageElement | ImageData | HTMLCanvasElement | HTMLImageElement | HTMLVideoElement | Uint8Array | Uint8ClampedArray | Uint16Array | Float32Array | WebGLTexture, width?: number, height?: number, bind?: boolean, emit?: boolean): void; /** * Clears the buffers to preset values */ clear(): void; /** * The resize method. * @param width - The width value. * @param height - The height value. * @param preserveData - The preserveData value. * @param emit - The emit value. */ resize(width: number, height: number, preserveData?: boolean, emit?: boolean): void; /** * Upload data for the image to the GPU. * * @param dataArray - The dataArray value. * @param width - The width value * @param height - The height value * @param offsetX - The offsetX value * @param offsetY - The offsetY value * @param bind - The bind value */ populate(dataArray: Uint16Array | Float32Array, width: number, height: number, offsetX?: number, offsetY?: number, bind?: boolean): void; /** * Returns the `width`(Index 0) and the `height`(Index 1) of the GL Texture. * * @return - The return value. */ getSize(): number[]; /** * Returns the value of the WebGLTexture value * * @return - The return value. */ get glTex(): WebGLTexture | null; /** * Returns the value of the WebGLTexture value * * @return - The return value. */ getTexHdl(): WebGLTexture | null; /** * The preBind method. * @param unif - The unif value. * @param unifs - The unifs value. * @return - The return value. */ preBind(unif: ShaderUniform, unifs: ShaderUniforms): ShaderUniforms; /** * Binds Texture to the ShaderUniform attribute. * * @param renderstate - The renderstate value. * @param unif - The unif value. * @param bindings - The bindings value. * @return - The return value. */ bindToUniform(renderstate: RenderState, unif: ShaderUniform, bindings?: ShaderUniforms): boolean; /** * The destroy is called by the system to cause explicit resources cleanup. * Users should never need to call this method directly. */ destroy(): void; /** * @private */ static getCachedGLTexture2D(image: BaseImage): GLTexture2D; /** * @private */ static setCachedGLTexture2D(image: BaseImage, gltexture: GLTexture2D): void; } /** Class representing a shader library. * @private */ declare class ShaderLibrary { __shaderModules: Record; materialTemplates: Record; /** * Create a shader library. */ constructor(); /** * The setShaderModule method. Shader must be set before parsing. * @param shaderName - The shader name. * @param shader - The unparsed shader GLSL. */ setShaderModule(shaderName: string, shader: string): void; /** * The getShaderModule method. Access specific uniforms, attributes of a particular module. * @param shaderName - The shader name. * @return - The return value. */ getShaderModule(shaderName: string): string; /** * The getShaderModuleNames method. * @return - The return value. */ getShaderModuleNames(): string[]; /** * The parseAttr * @param parts - parts * @param instanced - instanced * @param result - result object to store parsed data */ parseAttr(parts: string[], instanced: boolean, result: ShaderParseResult, line: string): void; /** * The handleImport method -- takes the includeFile and if it exists, adds the parsed glsl, uniforms, and attributes to the result, recursively. * @param result - result object that stores the glsl, attribute, uniform * @param shaderName - shaderName * @param includeFile - file name of the shader snippet/module * @param includes - keep track of what was included * @param lineNumber - keep track of what line we're on */ handleImport(result: ShaderParseResult, shaderName: string, includeFile: string, includes: string[], lineNumber: number): void; /** * The parseShader method. * @param shaderName - The shader name. * @param glsl - The glsl param. * @return - returns the 'result' object */ parseShader(shaderName: string, glsl: string): ShaderParseResult; /** * The parseShader recursive helper method * @param shaderName - The shader name. * @param glsl - The glsl param. * @param includes - keep track of what was included * @param lineNumber - keep track of what line we're on * @return - The return value. */ parseShaderHelper(shaderName: string, glsl: string, includes: string[], lineNumber: number): ShaderParseResult; } declare const shaderLibrary: ShaderLibrary; declare class BillboardShader extends GLShader { /** * Create a GL shader. * @param gl - The webgl rendering context. */ constructor(gl: WebGL12RenderingContext); } declare class EnvProjectionShader extends GLShader { /** * Create a GL shader. * @param gl - The webgl rendering context. */ constructor(gl?: WebGL12RenderingContext); /** * The bind method. * @param renderstate - The object tracking the current state of the renderer * @param key - The key value. * @return - The return value. */ bind(renderstate: RenderState, key: string): boolean; /** * The supportsInstancing method. * @return - return false for shaders that cannot be rendered in instanced mode. */ static supportsInstancing(): boolean; /** * Each shader provides a template material that each material instance is * based on. The shader specifies the parameters needed by the shader, and * the material provides values to the shader during rendering. * @return - The template material value. */ static getMaterialTemplate(): Material; } /** Shader for drawing Fat lines * @extends GLShader * @private */ declare class FatLinesShader extends GLShader { /** * Create a GL shader. * @param gl - The webgl rendering context. */ constructor(gl?: WebGL12RenderingContext); bind(renderstate: RenderState, key: any): boolean; /** * The supportsInstancing method. * @return - return false for shaders that cannot be rendered in instanced mode. */ static supportsInstancing(): boolean; /** * Each shader provides a template material that each material instance is * based on. The shader specifies the parameters needed by the shader, and * the material provides values to the shader during rendering. * @return - The template material value. */ static getMaterialTemplate(): Material; } declare class FlatSurfaceShader extends GLShader { /** * Create a GL shader. * @param gl - The webgl rendering context. */ constructor(gl?: WebGL12RenderingContext); /** * The bind method. * @param renderstate - The object tracking the current state of the renderer * @param key - The key value. * @return - The return value. */ bind(renderstate: RenderState, key?: string): boolean; /** * The unbind method. * @param renderstate - The object tracking the current state of the renderer * @return - The return value. */ unbind(renderstate: RenderState): boolean; /** * The getPackedMaterialData method. * @param material - The material param. * @return - The return value. */ static getPackedMaterialData(material: Material): Float32Array; /** * Each shader provides a template material that each material instance is * based on. The shader specifies the parameters needed by the shader, and * the material provides values to the shader during rendering. * @return - The template material value. */ static getMaterialTemplate(): Material; } declare class LinesShader extends GLShader { /** * Create a GL shader. * @param gl - The webgl rendering context. */ constructor(gl?: WebGL12RenderingContext); /** * The getPackedMaterialData method. * @param material - The material param. * @return - The return value. */ static getPackedMaterialData(material: Material): Float32Array; /** * Each shader provides a template material that each material instance is * based on. The shader specifies the parameters needed by the shader, and * the material provides values to the shader during rendering. * @return - The template material value. */ static getMaterialTemplate(): Material; } declare class PointsShader extends GLShader { /** * Create a GL shader. * @param gl - The webgl rendering context. */ constructor(gl?: WebGL12RenderingContext); /** * The getPackedMaterialData method. * @param material - The material param. * @return - The return value. */ static getPackedMaterialData(material: Material): Float32Array; /** * Each shader provides a template material that each material instance is * based on. The shader specifies the parameters needed by the shader, and * the material provides values to the shader during rendering. * @return - The template material value. */ static getMaterialTemplate(): Material; } declare class FatPointsShader extends GLShader { /** * Create a GL shader. * @param gl - The webgl rendering context. */ constructor(gl?: WebGL12RenderingContext); bind(renderstate: RenderState, key?: string): boolean; /** * The getPackedMaterialData method. * @param material - The material param. * @return - The return value. */ static getPackedMaterialData(material: Material): Float32Array; /** * The supportsInstancing method. * @return - return false for shaders that cannot be rendered in instanced mode. */ static supportsInstancing(): boolean; /** * Each shader provides a template material that each material instance is * based on. The shader specifies the parameters needed by the shader, and * the material provides values to the shader during rendering. * @return - The template material value. */ static getMaterialTemplate(): Material; } /** A simple shader with no support for PBR or textures * @ignore */ declare class SimpleSurfaceShader extends GLShader { /** * Create a SimpleSurfaceShader * @param gl - gl context */ constructor(gl?: WebGL12RenderingContext); /** * The getPackedMaterialData method. * @param material - The material param. * @return - The return value. */ static getPackedMaterialData(material: Material): Float32Array; /** * Each shader provides a template material that each material instance is * based on. The shader specifies the parameters needed by the shader, and * the material provides values to the shader during rendering. * @return - The template material value. */ static getMaterialTemplate(): Material; } /** A standard shader handling Opaque and transparent items and PBR rendering. * @extends GLShader * @private */ declare class StandardSurfaceShader extends GLShader { /** * Create a GL shader. * @param gl - The webgl rendering context. */ constructor(gl?: WebGL12RenderingContext); /** * The bind method. * @param renderstate - The object tracking the current state of the renderer * @param key - The key value. * @return - The return value. */ bind(renderstate: RenderState, key: string): boolean; /** * The getPackedMaterialData method. * @param material - The material param. * @return - The return value. */ static getPackedMaterialData(material: Material): Float32Array; /** * Each shader provides a template material that each material instance is * based on. The shader specifies the parameters needed by the shader, and * the material provides values to the shader during rendering. * @return - The template material value. */ static getMaterialTemplate(): Material; } /** A simple shader with no support for PBR or textures * @ignore */ declare class VertexColorShader extends GLShader { /** * Create a VertexColorShader * @param gl - gl context */ constructor(gl?: WebGL12RenderingContext); /** * The bind method. * @param renderstate - The object tracking the current state of the renderer * @param key - The key value. * @return - The return value. */ bind(renderstate: RenderState, key: string): boolean; /** * Each shader provides a template material that each material instance is * based on. The shader specifies the parameters needed by the shader, and * the material provides values to the shader during rendering. * @return - The template material value. */ static getMaterialTemplate(): Material; /** * The supportsInstancing method. * @return - return false for shaders that cannot be rendered in instanced mode. */ static supportsInstancing(): boolean; } declare class ScreenSpaceShader extends GLShader { /** * Create a GL shader. * @param gl - The webgl rendering context. */ constructor(gl?: WebGL12RenderingContext); static isOverlay(): boolean; /** * The getPackedMaterialData method. * @param material - The material param. * @return - The return value. */ static getPackedMaterialData(material: Material): Float32Array; /** * Each shader provides a template material that each material instance is * based on. The shader specifies the parameters needed by the shader, and * the material provides values to the shader during rendering. * @return - The template material value. */ static getMaterialTemplate(): Material; } /** Shader for unpacking HDR images using Boost HDR algorithm. * @extends GLShader * @private */ declare class UnpackHDRShader extends GLShader { /** * Create a GL shader. * @param gl - The webgl rendering context. */ constructor(gl: WebGL12RenderingContext); } /** * Represents a type of `ParameterOwner` class that holds material configuration. * Use this to apply materials to your assets or item parts. * * **Events** * * **shaderNameChanged:** Triggered when the shader's name is set through `setShaderName` method. * * @extends ParameterOwner */ declare class Material extends ParameterOwner { protected __isOpaque: boolean; protected __isTextured: boolean; protected __shaderName: string; libraryIndex: number; /** * Create a material * @param name - The name of the material. * @param shaderName - Shader's class name. */ constructor(name?: string, shaderName?: string); /** * Getter for the shader name. * @return - Returns the shader name. */ getShaderName(): string; /** * Sets shader by using the name of the class with the script. * It is important that the shader is registered in `Registry`, otherwise it will error. * See all classes that extend from `GLShader`. * * @param shaderName - The shader name. */ setShaderName(shaderName: string): void; /** * Remove all textures from Material's parameters. */ removeAllTextures(): void; /** * Returns the current path of the item in the tree as an array of names. * * @return - Returns an array. */ getPath(): string[]; /** * Returns all texture parameters in current Material. * * @return - The return value. */ getParamTextures(): Record; /** * Checks if the material is transparent by checking the `Opacity` parameter. * * @return - Returns true if the material is transparent. */ isOpaque(): boolean; private __checkOpacity; /** * Checks if the material has a texture applied. The renderer can use this to optimize rendering of non-textured objects * * @return - Returns true if the material is textured. */ isTextured(): boolean; __checkTextures(event?: Record): void; /** * This method can be overridden in derived classes * to perform general updates (see GLPass or BaseItem). * @param event - The event object emitted by the parameter. * @private */ parameterValueChanged(event: Record): void; /** * Returns shaders class of current material, if set. Otherwise it returns `undefined` * * @return - The return value. */ getShaderClass(): typeof GLShader; /** * The toJSON method encodes the current object as a json object. * * @param context - The context value. * @return - Returns the json object. */ toJSON(context?: Record): Record; /** * The fromJSON method decodes a json object for this type. * * @param j - The json object this item must decode. * @param context - The context value. */ fromJSON(j: Record, context?: Record): void; /** * Sets state of current Item(Including Shaders and Materials) using a binary reader object. * * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context: AssetLoadContext): void; /** * The clone method constructs a new material, copies its values * from this material and returns it. * * @param context - The context value. * @return - Returns a new cloned material. */ clone(context?: CloneContext): Material; /** * When a Material is copied, first runs `BaseItem` copyFrom method, then sets shader. * * @param src - The material to copy from. * @param context - The context value. */ copyFrom(src: Material, context?: CloneContext): void; } /** * Represents a specific type of parameter, that only stores `Material` values. * * i.e.: * ```javascript * const material = new Material('itemMaterial', 'SimpleSurfaceShader') * material.getParameter('BaseColor').setValue(new Color(89 / 255, 182 / 255, 92 / 255)) * * const materialParam = new MaterialParameter('MyMaterial', material) * //'myParameterOwnerItem' is an instance of a 'ParameterOwner' class. * // Remember that only 'ParameterOwner' and classes that extend from it can host 'Parameter' objects. * myParameterOwnerItem.addParameter(materialParam) * ``` * **Events** * * **valueParameterValueChanged:** Triggered when parameter's value changes. * * **valueChanged:** Triggered when parameter's value changes, except on cleaning processes. * * @extends Parameter */ declare class MaterialParameter extends Parameter { protected listenerIDs: Record; /** * Create a material parameter. * @param name - The name of the material parameter. * @param value - The value of the parameter. */ constructor(name?: string, value?: Material); private valueParameterValueChanged; /** * Sets `Material` value of the parameter. * * @param value - The material value. */ setValue(value: Material): void; /** * The loadValue is used to change the value of a parameter, without triggering a * valueChanges. * * @param value - The context value. */ loadValue(value: Material): void; /** * The toJSON method encodes this type as a json object for persistence. * * @param context - The context value. * @return - Returns the json object. */ toJSON(context?: Record): Record; /** * The fromJSON method decodes a json object for this type. * * @param j - The json object this item must decode. * @param context - The context value. */ fromJSON(j: Record, context: Record): void; /** * The clone method constructs a new material parameter, copies its values * from this parameter and returns it. * * @return - Returns a new material parameter. */ clone(): MaterialParameter; } /** * Base class that represents geometry items with layering, overlaying and cut away features. * * **Events** * * **cutAwayChanged:** Triggered when the cutaway variables change(if enabled or not, the vector and the distance). * @extends TreeItem */ declare class BaseGeomItem extends TreeItem { protected overlay: boolean; protected cutAway: boolean; protected cutAwayVector: Vec3; protected cutAwayDist: number; protected layers: string[]; /** * @member materialParam - The Material to use when rendering this GeomItem */ materialParam: MaterialParameter; /** * Create a base geometry item. * @param name - The name of the base geom item. */ constructor(name?: string); /** * Sets overlay value. * * @todo Need to find the layer and add this item to it. * @param val - `true` to enable it. */ setOverlay(val: boolean): void; /** * Returns `true` if overlay is enabled for current item. * * @return - The return value. */ isOverlay(): boolean; /** * Adds a layer to current item. * * @todo Need to find the layer and add this item to it. * @param name - The name of the layer. */ addLayer(name: string): void; /** * Returns all layers in current item. * * @return - The return value. */ getLayers(): string[]; /** * Checks if cutaway is enabled. * * @return - Returns `true` if enabled. */ isCutawayEnabled(): boolean; /** * Sets cutaway state. * * @param state - `true` to enable it, otherwise `false`. */ setCutawayEnabled(state: boolean): void; /** * Returns cutaway vector value. * * @return - `Vec3` when it is set, `false` on default. */ getCutVector(): Vec3; /** * Sets cutaway vector value. * * @param cutAwayVector - The cutAwayVector value. */ setCutVector(cutAwayVector: Vec3): void; /** * Getter for the cutaway distance. * * @return - The return value. */ getCutDist(): number; /** * Sets cutaway distance value. * * @param cutAwayDist - The cutAwayDist value. */ setCutDist(cutAwayDist: number): void; /** * Sets state of current Item(Including layers & material) using a binary reader object. * * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context: AssetLoadContext): void; } /** * The Camera class is used to provide a point of view of the scene. The viewport is assigned * a camera, which is uses during drawing. The camera controls the view and projection used to * render the scene. * * Cameras can provide a perspective projection, or an orthographic projection, and anything in between. * To configure whether th projection provided by the camera is Orthographic or Perspective, set * the value of the 'isOrthographic' Parameter to a value between 0 and 1. 0.0 being fully perspective * and 1.0 being fully Orthographic. * Alternatively, you can call camera.setIsOrthographic and pass the value, and a time in milliseconds to * take to transition between the current value and your new value. * ```javascript * camera.setIsOrthographic(1, 400); * ``` * * By default, the Camera automatically adjusts the near and far planes as the focal distance is modified. This * behavior can be disabled, by setting the adjustNearAndFarPlanesToFocalDist property to false. * Alternatively, you can also adjust the factors that are used to modify the near and far plane based on the * focal distance. * ```javascript * camera.adjustNearAndFarPlanesToFocalDist = true * camera.nearDistFactor = 0.01 * camera.farDistFactor = 5 * ``` * * **Parameters** * * **isOrthographic(`NumberParameter`):** Controls the projection matrix generated by the camera. A value of 0.0, means a perspective projection, while 1 an orthographic projection. Any value in between generates a blended perspective -> orthographic projection. * * **fov(`NumberParameter`):** The vertical angle of the view frustum when generating a perspective projection. In orthographic mode, this value is used to calculate the size of the view at the target distance. * * **near(`NumberParameter`):** The near clipping distance of the camera. * * **far(`NumberParameter`):** The far clipping distance of the camera. * * **focalDistance(`NumberParameter`):** The distance at which the camera is focussed. Note: the CameraManipulator sets the focal distance when zooming in on a target. * * **Events** * * **projectionParamChanged:** When on of the parameters above change, the camera emits this event. Note: the Viewport listens to this event and triggers re-rendering. * * **movementFinished:** Triggered at the conclusion of some action. E.g. when a zoom action is finished, or when the mouse is released after an orbit action. The viewport listens to this event and triggers a re-rendering of the selection buffers. * * @extends TreeItem */ declare class Camera extends TreeItem { isOrthographicParam: NumberParameter; fovParam: NumberParameter; nearParam: NumberParameter; farParam: NumberParameter; focalDistanceParam: NumberParameter; protected adjustNearAndFarPlanesToFocalDist: boolean; protected nearDistFactor: number; protected farDistFactor: number; protected frameOnBoundingSphere: boolean; protected viewHeight: number; private intervalId; /** * Instantiates a camera object, setting default configuration like zoom, target and positioning. * * @param name - The name of the camera. */ constructor(name?: string); /** * Returns `near` parameter value. * * @return - Returns the near value. */ getNear(): number; /** * Sets `near` parameter value * * @param value - The near value. */ setNear(value: number): void; /** * Returns `far` parameter value. * * @return - Returns the far value. */ getFar(): number; /** * Sets `far` parameter value * * @param value - The far value. */ setFar(value: number): void; /** * Getter for the camera field of view (FOV). * The FOV defines the vertical angle of the view frustum * The horizontal angle is calculated from the FOV and the Viewport aspect ratio. * * @return - Returns the FOV value. */ getFov(): number; /** * Setter for the camera field of view (FOV). * The FOV defines the vertical angle of the view frustum * The horizontal angle is calculated from the FOV and the Viewport aspect ratio. * > Note: The Fov can also be set by calling #setLensFocalLength * * @param value - The new FOV value. */ setFov(value: number): void; /** * Getter for the camera frustum height value. * The frustum hight value is used to compute the orthographic projection of the scene. * * @return - Returns the Frustum Height value. */ getFrustumHeight(): number; /** * Setter for the camera frustum height in orthographic mode. * > Note: in perspective mode, the frustum height is calculated based on the FOV value and focal distance. * * @param value - The new Frustum Height value. */ setFrustumHeight(value: number): void; /** * Setter for the camera lens focal length. This method calculates a new vertical Field of View value * from the provided camera lense focal length. * > Note: conversion from Lense Focal length to Fov is based on the table found here: https://www.nikonians.org/reviews/fov-tables * * **Focal Length accepted values as string values:** 10mm, 11mm, 12mm, 14mm, 15mm, 17mm, 18mm, * 19mm, 20mm, 24mm, 28mm, 30mm, 35mm, 45mm, 50mm, 55mm, 60mm, 70mm, 75mm, 80mm, * 85mm, 90mm, 100mm, 105mm, 120mm, 125mm, 135mm, 150mm, 170mm, 180mm, 210mm, 300mm, * 400mm, 500mm, 600mm, 800mm * * @param value - The lens focal length value. */ setLensFocalLength(value: string): void; /** * Returns `focalDistance` parameter value. * * @return - Returns the lens focal length value.. */ getFocalDistance(): number; /** * Sets `focalDistance` parameter value. * * @errors on dist value lower or less than zero. * @param dist - The focal distance value. */ setFocalDistance(dist: number): void; /** * Returns true if the camera is providing an orthographic projection. * @return - true if orthographic else false */ isOrthographic(): boolean; /** * Sets the camera to be orthographic. The value can be between 0, and 1. * A value of 0 means fully perspective. A value of 1 means fully orthographic. * Any value in between produces a linear interpolation of perspective and orthographic. * * @param value - The value param. * @param duration - The duration in milliseconds to change the projection. */ setIsOrthographic(value: number, duration?: number): void; /** * Setter for the camera position and target. * As described at the start of the class, this is a `TreeItem`, * which means we can move it around using translation modifiers. * You can do it this way or using the changing `TreeItem` parameters, * although we recommend this one because it also changes focal distance. * * @param position - The position of the camera. * @param target - The target of the camera. */ setPositionAndTarget(position: Vec3, target: Vec3): void; /** * Getter for the target position. * @return - Returns the target position. */ getTargetPosition(): Vec3; /** * Calculates a new camera position that frames all the items passed in `treeItems` array, moving * the camera to a point where we can see all of them. * * @param viewport - The viewport value. * @param treeItems - The treeItems value. * @param duration - The duration of time to apply the frame. A value of 0 specifies an instantaneous movement of the camera. * @param frameBorder - The variable to use to provide an empty space around the border for geometries. */ frameView(viewport: GLBaseViewport, treeItems: TreeItem[], duration?: number, frameBorder?: number): void; /** * Sets camera perspective from a Mat4 object. * * @param mat - The mat value. * @param aspect - The aspect value. */ updateProjectionMatrix(mat: Mat4, aspect: number): void; } /** * Class for loading zcad files. * The CADAsset is a TreeItem and can be added to the scene tree. * * **Events** * * **loaded:** Emitted when the asset is loaded * @extends AssetItem */ declare class CADAsset extends AssetItem { cadfileVersion: Version; sdk: string; url: string; private metadataLoadPromise; private metadataLoaded; /** * Create a CAD asset. * @param {string} name - The name value. */ constructor(name?: string); /** * The clone method constructs a new CADAsset, copies its values * from this item and returns it. * * @param context - The CloneContext param. * @return - The cloned instance. */ clone(context?: CloneContext): CADAsset; /** * Copies current TreeItem with all its children. * * @param src - The tree item to copy from. * @param context - The context value. */ copyFrom(src: CADAsset, context?: CloneContext): void; /** * Returns the version of the data loaded by the CADAsset. * * @return - The version value. */ getVersion(): Version; /** * Initializes CADAsset's asset, material, version and layers; adding current `CADAsset` Geometry Item toall the layers in reader * * @param {BinReader} reader - The reader param. * @param {AssetLoadContext} context - The load context object that provides additional data such as the units of the scene we are loading into. */ private readRootLevelBinary; /** * Enables loading zcad data records. * * @param {Record} entries - The entries that were stored in the zcad file. * @param {AssetLoadContext} context - The load context object that provides additional data such as the units of the scene we are loading into. */ loadZCADEntries(entries: Record, context: AssetLoadContext): Promise; /** * Loads all the geometries and metadata from the asset file. * @param data - The URL of the asset to load, or the ArrayBuffer of the asset. * @param context - The load context object that provides additional data such as paths to external references. * @return - Returns a promise that resolves once the load of the tree is complete. Geometries, textures and other resources might still be loading. */ load(data: string | ArrayBuffer, context?: AssetLoadContext): Promise; /** * Loads the metadata file for the previously loaded zcad file. * Note: in most cases, the CADAsset can generate the url for the metadata file. * * @param metaDataUrl - The URL of the metadata file to load. */ loadMetadata(metaDataUrl?: string): Promise; } /** * Represents a Tree Item of an Assembly modeling. Brings together components to define a larger product. * * @extends TreeItem */ declare class CADAssembly extends TreeItem { /** * Create a CAD assembly. * * @param name - The name of the tree item. */ constructor(name?: string); /** * The clone method constructs a new CADAssembly item, copies its values * from this item and returns it. * * @param context - The CloneContext param. * @return - The cloned instance. */ clone(context: CloneContext): CADAssembly; } /** * Represents a Part within a CAD assembly. * * @extends TreeItem */ declare class CADPart extends TreeItem { /** * Creates an instance of CADPart setting up the initial configuration for Material and Color parameters. * * @param name - The name value. */ constructor(name?: string); /** * The clone method constructs a new CADPart, copies its values * from this item and returns it. * * @param context - The CloneContext param. * @return - The cloned instance. */ clone(context?: CloneContext): CADPart; } /** * Represents a Body within a CAD Part. A Body is made up of either a single mesh or a collection of meshes, one for each surface. * When a zcad file is produced, the tool can optimize bodies to contain only one mesh to speed up loading of large models, and support bigger models being loaded. * * @extends GeomItem */ declare class CADBody extends GeomItem { shattered: boolean; /** * Creates an instance of CADBody setting up the initial configuration for Material and Color parameters. * * @param {string} name - The name value. */ constructor(name?: string); /** * Sets the state of this CADBody whether the geometry isdisplayed as * 'shattered', meaning that each face, edge and vertex can be selected * individually. * * @param state - The state value. */ setShatterState(state: boolean): void; /** * The clone method constructs a new CADBody, copies its values * from this item and returns it. * * @param context - The CloneContext param. * @return - The cloned instance. */ clone(context: CloneContext): CADBody; /** * Initializes CADBody's asset, material, version and layers; adding current `CADBody` Geometry Item toall the layers in reader * * @param reader - The reader param. * @param context - The context param. */ readBinary(reader: BinReader, context: AssetLoadContext): void; } /** * Represents a view of PMI data. within a CAD assembly. * * @extends TreeItem */ declare class PMIItem extends TreeItem { private materialMapping; /** * Creates an instance of PMIItem setting up the initial configuration for Material and Color parameters. * * @param {string} name - The name value. */ constructor(name?: string); /** * The clone method constructs a new PMIItem, copies its values * from this item and returns it. * * @param {number} flags - The flags param. * @return {PMIItem} - The return value. */ clone(context?: CloneContext): PMIItem; /** * Changes the current state of the selection of this item. * Note: the PMIItem also activates the PMI linking when selected. * * @emits `selectedChanged` with selected state * @param sel - Boolean indicating the new selection state. */ setSelected(sel: boolean): void; /** * Activates the PMIView, adjusting visibility of the PMI items and the camera Xfo */ activate(): void; /** * Deactivates the PMIItem */ deactivate(): void; /** * Adds a highlight to the tree item. * * @param {string} name - The name of the tree item. * @param {Color} color - The color of the highlight. * @param {boolean} propagateToChildren - A boolean indicating whether to propagate to children. */ addHighlight(name?: string, color?: Color, propagateToChildren?: boolean): void; /** * Removes a highlight to the tree item. * * @param {string} name - The name of the tree item. * @param {boolean} propagateToChildren - A boolean indicating whether to propagate to children. */ removeHighlight(name: string, propagateToChildren?: boolean): void; /** * Load the binary data for this class * @param reader - The reader param. * @param context - The context param. */ readBinary(reader: BinReader, context: AssetLoadContext): void; } /** * Represents a view of PMI data. within a CAD assembly. * * @extends PMIItem */ declare class PMIView extends PMIItem { camera: Camera; /** * Creates an instance of PMIView setting up the initial configuration for Material and Color parameters. * * @param {string} name - The name value. */ constructor(name?: string); /** * The clone method constructs a new PMIView, copies its values * from this item and returns it. * * @param context - The clone context. * @return - The return value. */ clone(context?: CloneContext): PMIView; /** * Activates the PMIView, adjusting visibility of the PMI items and the camera Xfo */ activate(): void; /** * Deactivates the PMIItem */ deactivate(): void; /** * Load the binary data for this class * @param reader - The reader param. * @param context - The context param. */ readBinary(reader: BinReader, context: AssetLoadContext): void; } /** * Represents a specific type of parameter, that only stores Mat4(4x4 matrix) values. * * i.e.: * ```javascript * const stringParam = new StringParameter('MyString', 'A String value goes here') * //'myParameterOwnerItem' is an instance of a 'ParameterOwner' class. * // Remember that only 'ParameterOwner' and classes that extend from it can host 'Parameter' objects. * myParameterOwnerItem.addParameter(stringParam) * ``` * * @extends Parameter */ declare class StringParameter extends Parameter implements IBinaryReader { multiLine: boolean; /** * Create a string parameter. * @param name - The name of the material color parameter. * @param value - The value of the parameter. */ constructor(name?: string, value?: string); /** * Sets flag that indicates if the string contains new line feeds. * * @param multiLine - The multiLine value. */ setMultiLine(multiLine: boolean): void; /** * Returns multi-line flag value. * * @return - The return value. */ getMultiLine(): boolean; setValue(value: string): void; /** * Extracts the string value from a buffer, updating current parameter state. * * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context?: AssetLoadContext): void; /** * The toJSON method serializes this instance as a JSON. * It can be used for persistence, data transfer, etc. * * @param context - The context value. * @return - Returns the json object. */ toJSON(context?: Record): Record; /** * The fromJSON method takes a JSON and deserializes into an instance of this type. * * @param j - The json object this item must decode. * @param context - The context value. */ fromJSON(j: Record, context?: Record): void; /** * The clone method constructs a new string parameter, copies its values * from this parameter and returns it. * * @return - Returns a new string parameter. */ clone(): StringParameter; } /** * Represents a view of PMI data. within a CAD assembly. * * @extends TreeItem */ declare class XRef extends CADAsset { /** * @member configurationParam - Stores the value of the configuration this XRef must attempt to load */ configurationParam: StringParameter; /** * Creates an instance of XRef setting up the initial configuration for Material and Color parameters. * * @param {string} name - The name value. */ constructor(name?: string); /** * The clone method constructs a new XRef, copies its values * from this item and returns it. * * @param context - The context value. * @return - Returns a new cloned xref. */ clone(context?: CloneContext): XRef; /** * Initializes XRef's asset, material, version and layers; adding current `XRef` Geometry Item toall the layers in reader * * @paramreader - The reader param. * @param context - The load context param. */ readBinary(reader: BinReader, context: AssetLoadContext): void; private applyAssemblyLevelFeatures; private applyFeatureToChildren; private applyFeature; } /** * Class representing a GL CAD pass. * * **Events** * * **updated** * @extends GLPass */ declare class GLCADPass extends GLPass { /** * Create a GL CAD pass. * @param {boolean} debugMode - If true, then puts the GLCADPass rendering into debug mode. */ constructor(debugMode?: boolean); /** * The itemAddedToScene method is called on each pass when a new item * is added to the scene, and the renderer must decide how to render it. * It allows Passes to select geometries to handle the drawing of. * @param {TreeItem} treeItem - The treeItem value. * @param {object} rargs - Extra return values are passed back in this object. * The object contains a parameter 'continueInSubTree', which can be set to false, * so the subtree of this node will not be traversed after this node is handled. * @return {Boolean} - The return value. */ itemAddedToScene(treeItem: TreeItem, rargs: Record): boolean; /** * The itemRemovedFromScene method is called on each pass when aa item * is removed to the scene, and the pass must handle cleaning up any resources. * @param {TreeItem} treeItem - The treeItem value. * @param {object} rargs - Extra return values are passed back in this object. * @return {Boolean} - The return value. */ itemRemovedFromScene(treeItem: TreeItem, rargs: Record): boolean; } /** * Provides a context for loading assets. This context can provide the units of the loading scene. * E.g. you can specify the scene units as 'millimeters' in the context object. * To load external references, you can also provide a dictionary that maps filenames to URLs that are used * to resolve the URL of an external reference that a given asset is expecting to find. */ declare class AssetLoadContext extends EventEmitter { units: string; versions: Record; sdk: string; url: string; folder: string; camera: Camera; assetItem: AssetItem; resources: Record | null; xrefs: Record; xrefLoadCallback: (xrefPath: string, xref: XRef) => string | null; lazyLoading: false; protected postLoadCallbacks: Array<() => void>; promisses: Array>; urlStack: Array; assetStack: Array; addGeomToLayer: (geomItem: BaseGeomItem, layer: string) => void; /** * Create a AssetLoadContext * @param context The source context to base this context on. */ constructor(context?: AssetLoadContext); /** * During loading, asynchronous processes may be launched, and subsequently completed. * These method helps the Asset track how many asynchronous loading operations may be * occurring with the tree during load. * As each external reference starts to load, it adds a promise, letting the owning * Asset know to wait till the children promisses are resolved before emitting its own 'loaded' event. */ addPromise(promise: Promise): void; /** * Resolves a path within the loading asset. This is used to connect * items within the tree to other items. e.g. a Group can find its members. * or an instance can find its source tree. * @param path the path within the tree relative to the loading asset * @param onSucceed called with the successful result of the path resolution. * @param onFail called when the path resolution fails. */ resolvePath(path: Array, onSucceed: (result: BaseItem | Parameter) => void, onFail: (e: Error) => void): void; /** * Adds a function to be called back once the main load call stack exists. * This is used to connect parts of the tree together after loading. * e.g. an instance will * @param postLoadCallback */ addPLCB(postLoadCallback: () => void): void; /** * Triggers the resolution of any remaining callbacks. * During loading, InstanceItems, or Groups may try to resolve other * Items, but they might not be available yet, which causes a Post * Load Callback (PLCB) to be registered. The last step in loading * should be to resolve the PLCBs. */ resolvePLCBs(): void; /** * The clone method constructs a new AssetLoadContext, copies its values * from this instance and returns it. */ clone(): AssetLoadContext; } interface IBinaryReader { /** * The readBinary method. * * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context?: AssetLoadContext): void; } /** * Represents a specific type of parameter, that only stores numeric values. * * ```javascript * const numberParam = new NumberParameter('MyNumber', 15) * //'myParameterOwnerItem' is an instance of a 'ParameterOwner' class. * // Remember that only 'ParameterOwner' and classes that extend from it can host 'Parameter' objects. * myParameterOwnerItem.addParameter(numberParam) * ``` * * @extends Parameter */ declare class NumberParameter extends Parameter implements IBinaryReader { protected range?: Array; protected step?: number; /** * Create a number parameter. * @param name - The name of the number parameter. * @param value - The value of the parameter. * @param range - An array with two numbers. If defined, the parameter value will be clamped. * @param step - The step value. If defined, the parameter value will be rounded to the nearest integer. */ constructor(name?: string, value?: number, range?: number[], step?: number); /** * Returns the range to which the parameter is restrained. * * @return - The return value. */ getRange(): number[] | undefined; /** * Sets the range to which the parameter is restrained. * * @param range - The range value. */ setRange(range: number[]): void; /** * Returns the step number, which is the one used for rounding. * * @return - The return value. */ getStep(): number | undefined; /** * Returns step value. * * @param step - The step value. */ setStep(step: number): void; setValue(value: number): void; /** * The toJSON method encodes this type as a json object for persistence. * * @param context - The context value. * @return - Returns the json object. */ toJSON(context?: Record): Record; /** * The fromJSON method decodes a json object for this type. * * @param j - The json object this item must decode. * @param context - The context value. */ fromJSON(j: Record, context?: Record): void; /** * Extracts a number value from a buffer, updating current parameter state. * * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context?: AssetLoadContext): void; /** * The clone method constructs a new number parameter, copies its values * from this parameter and returns it. * * @return - Returns a new number parameter. */ clone(): NumberParameter; } declare class Float32Parameter extends NumberParameter { readBinary(reader: BinReader, context?: AssetLoadContext): void; } declare class AngleParameter extends Float32Parameter { } /** * Represents a specific type of parameter, that stores multiple choice(array) values. * * i.e.: * ```javascript * const multiChoiceParameter = new MultiChoiceParameter('InitialXfoMode', GROUP_INITIAL_XFO_MODES.average, [ * 'manual', * 'first', * 'average', * 'global', * ]) * //'myParameterOwnerItem' is an instance of a 'ParameterOwner' class. * // Remember that only 'ParameterOwner' and classes that extend from it can host 'Parameter' objects. * myParameterOwnerItem.addParameter(multiChoiceParameter) * ``` * @extends NumberParameter */ declare class MultiChoiceParameter extends NumberParameter { choices: any[]; /** * Create a multi choice parameter. * @param name - The name of the multi choice parameter. * @param index - The index value. * @param choices - The choices value. */ constructor(name?: string, index?: number, choices?: any[]); /** * Returns choices array. * * @return - The return value. */ getChoices(): Array; /** * Sets parameter index value. * * @param value - The value param. */ setValue(value: any): void; clone(): MultiChoiceParameter; } /** * Represents a specific type of parameter, that only stores Vec2(two-dimensional coordinate) values. * * i.e.: * ```javascript * const vec2Param = new Vec2Parameter('MyVec2', new Vec2(1.2, 3.4)) * //'myParameterOwnerItem' is an instance of a 'ParameterOwner' class. * // Remember that only 'ParameterOwner' and classes that extend from it can host 'Parameter' objects. * myParameterOwnerItem.addParameter(vec2Param) * ``` * * **Events** * * **rangeChanged:** Triggered when rage array changes. * * @extends Parameter */ declare class Vec2Parameter extends Parameter implements IBinaryReader { protected range?: Vec2[]; /** * Create a Vec2 parameter. * * @param name - The name of the Vec2 parameter. * @param value - The value of the parameter. * @param range - The range value is an array of two `Vec2` objects. */ constructor(name?: string, value?: Vec2, range?: Vec2[]); /** * Returns the range of values in which current parameter can be. * * @return - The return value. */ getRange(): Vec2[] | undefined; /** * The __setRange method. * @param range - The range value. * @private */ protected setRange(range: Vec2[]): void; setValue(value: Vec2): void; /** * Extracts a number value from a buffer, updating current parameter state. * * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context?: AssetLoadContext): void; toJSON(context?: Record): Record; fromJSON(j: Record, context?: Record): void; /** * The clone method constructs a new Vec2 parameter, copies its values * from this parameter and returns it. * * @return - Returns a new Vec2 parameter. */ clone(): Vec2Parameter; } /** * Represents a specific type of parameter, that only stores Vec3(three-dimensional coordinate) values. * * i.e.: * ```javascript * const vec3Param = new Vec3Parameter('MyVec3', new Vec3(1.2, 3.4, 1)) * //'myParameterOwnerItem' is an instance of a 'ParameterOwner' class. * // Remember that only 'ParameterOwner' and classes that extend from it can host 'Parameter' objects. * myParameterOwnerItem.addParameter(vec3Param) * ``` * @extends Parameter */ declare class Vec3Parameter extends Parameter implements IBinaryReader { protected range?: Vec3[]; /** * Create a Vec3 parameter. * * @param name - The name of the Vec3 parameter. * @param value - The value of the parameter. * @param range - The range value is an array of two `Vec3` objects. */ constructor(name?: string, value?: Vec3, range?: Vec3[]); setValue(value: Vec3): void; /** * Extracts a number value from a buffer, updating current parameter state. * * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context?: AssetLoadContext): void; toJSON(context?: Record): Record; fromJSON(j: Record, context?: Record): void; /** * The clone method constructs a new Vec3 parameter, copies its values * from this parameter and returns it. * * @return - Returns a new Vec3 parameter. */ clone(): Vec3Parameter; } /** * Represents a specific type of parameter, that only stores Vec4(four-dimensional coordinate) values. * * i.e.: * ```javascript * const vec4Param = new Vec4Parameter('MyVec4', new Vec4(1.2, 3.4, 1, 4.2)) * //'myParameterOwnerItem' is an instance of a 'ParameterOwner' class. * // Remember that only 'ParameterOwner' and classes that extend from it can host 'Parameter' objects. * myParameterOwnerItem.addParameter(vec4Param) * ``` * * @extends Parameter */ declare class Vec4Parameter extends Parameter implements IBinaryReader { /** * Create a Vec4 parameter. * @param name - The name of the Vec4 parameter. * @param value - The value of the parameter. */ constructor(name?: string, value?: Vec4); setValue(value: Vec4): void; /** * Extracts a number value from a buffer, updating current parameter state. * * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context?: AssetLoadContext): void; toJSON(context?: Record): Record; fromJSON(j: Record, context?: Record): void; /** * The clone method constructs a new Vec4 parameter, copies its values * from this parameter and returns it. * * @return - Returns a new Vec4 parameter. */ clone(): Vec4Parameter; } /** * @extends Parameter */ declare class Box2Parameter extends Parameter implements IBinaryReader { /** * Create a Box2 parameter. * @param name - The name of the Box2 parameter. * @param value - The value of the parameter. */ constructor(name?: string, value?: Box2); setValue(value: Box2): void; /** * Extracts a number value from a buffer, updating current parameter state. * * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context?: AssetLoadContext): void; toJSON(context?: Record): Record; fromJSON(j: Record, context?: Record): void; /** * The clone method constructs a new Box2 parameter, * copies its values from this parameter and returns it. * * @return - Returns a new cloned Box2 parameter. */ clone(): Box2Parameter; } /** * @extends Parameter */ declare class Box3Parameter extends Parameter implements IBinaryReader { /** * Create a Box3 parameter. * @param name - The name of the Box3 parameter. * @param value - The value of the parameter. */ constructor(name?: string, value?: Box3); setValue(value: Box3): void; /** * Extracts a number value from a buffer, updating current parameter state. * * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context?: AssetLoadContext): void; toJSON(context?: Record): Record; fromJSON(j: Record, context?: Record): void; /** * The clone method constructs a new Box3 parameter, * copies its values from this parameter and returns it. * * @return - Returns a new cloned Box3 parameter. */ clone(): Box3Parameter; } /** * Represents a specific type of parameter, that only stores `Color` values. * * i.e.: * ```javascript * const colorParam = new ColorParameter('MyColor', new Color(0, 254, 2)) * //'myParameterOwnerItem' is an instance of a 'ParameterOwner' class. * // Remember that only 'ParameterOwner' and classes that extend from it can host 'Parameter' objects. * myParameterOwnerItem.addParameter(colorParam) * ``` * * @extends Parameter */ declare class ColorParameter extends Parameter implements IBinaryReader { /** * Create a color parameter. * @param name - The name of the color parameter. * @param value - The value of the parameter. */ constructor(name?: string, value?: Color); setValue(value: Color): void; /** * Extracts `Color` values from a buffer, updating current parameter state. * * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context?: AssetLoadContext): void; toJSON(context?: Record): Record; fromJSON(j: Record, context?: Record): void; /** * The clone method constructs a new color parameter, * copies its values from this parameter and returns it. * * @return - Returns a new cloned color parameter. */ clone(): ColorParameter; } /** * Represents a specific type of parameter, that only stores Vec3(four-dimensional coordinate) values. * * i.e.: * ```javascript * const quatParam = new QuatParameter('MyQuat', new Quat(1.2, 3.4, 1, 4.2)) * //'myParameterOwnerItem' is an instance of a 'ParameterOwner' class. * // Remember that only 'ParameterOwner' and classes that extend from it can host 'Parameter' objects. * myParameterOwnerItem.addParameter(quatParam) * ``` * * @extends Parameter */ declare class QuatParameter extends Parameter implements IBinaryReader { /** * Create a Quat parameter. * @param name - The name of the Quat parameter. * @param value - The value of the parameter. */ constructor(name?: string, value?: Quat); setValue(value: Quat): void; /** * Extracts a number value from a buffer, updating current parameter state. * * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context?: AssetLoadContext): void; toJSON(context?: Record): Record; fromJSON(j: Record, context?: Record): void; /** * The clone method constructs a new Quat parameter, copies its values * from this parameter and returns it. * * @return - Returns a new Quat parameter. */ clone(): QuatParameter; } /** * Represents a specific type of parameter, that only stores Mat3(3x3 matrix) values. * * i.e.: * ```javascript * const mat3Param = new Ma3Parameter('MyMat3', new Mat3(...args)) * //'myParameterOwnerItem' is an instance of a 'ParameterOwner' class. * // Remember that only 'ParameterOwner' and classes that extend from it can host 'Parameter' objects. * myParameterOwnerItem.addParameter(mat3Param) * ``` * * @extends Parameter */ declare class Mat3Parameter extends Parameter implements IBinaryReader { /** * Create a Mat3 parameter. * @param name - The name of the Mat3 parameter. * @param value - The value of the parameter. */ constructor(name?: string, value?: Mat3); setValue(value: Mat3): void; /** * Extracts a number value from a buffer, updating current parameter state. * * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context?: AssetLoadContext): void; toJSON(context?: Record): Record; fromJSON(j: Record, context?: Record): void; /** * The clone method constructs a new Mat3 parameter, * copies its values from this parameter and returns it. * * @return - Returns a new cloned Mat3 parameter. */ clone(): Mat3Parameter; } /** * Represents a specific type of parameter, that only stores Mat4(4x4 matrix) values. * * i.e.: * ```javascript * const mat4Param = new Ma3Parameter('MyMat4', new Mat4(...args)) * //'myParameterOwnerItem' is an instance of a 'ParameterOwner' class. * // Remember that only 'ParameterOwner' and classes that extend from it can host 'Parameter' objects. * myParameterOwnerItem.addParameter(mat4Param) * ``` * * @extends Parameter */ declare class Mat4Parameter extends Parameter implements IBinaryReader { /** * Create a Mat4 parameter. * * @param name - The name of the Mat4 parameter. * @param value - The value of the parameter. */ constructor(name?: string, value?: Mat4); setValue(value: Mat4): void; /** * Extracts a number value from a buffer, updating current parameter state. * * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context?: AssetLoadContext): void; toJSON(context?: Record): Record; fromJSON(j: Record, context?: Record): void; /** * The clone method constructs a new Mat4 parameter, * copies its values from this parameter and returns it. * * @return - Returns a new cloned Mat4 parameter. */ clone(): Mat4Parameter; } /** * Represents a specific type of parameter, that only stores `Xfo` transform values. * * ```javascript * const xfoParam = new XfoParameter('MyXfo', new Xfo(new Vec3(1.2, 3.4, 1))) * //'myParameterOwnerItem' is an instance of a 'ParameterOwner' class. * // Remember that only 'ParameterOwner' and classes that extend from it can host 'Parameter' objects. * myParameterOwnerItem.addParameter(xfoParam) * ``` * * @extends Parameter */ declare class XfoParameter extends Parameter implements IBinaryReader { /** * Create a Xfo parameter. * @param name - The name of the Xfo parameter. * @param value - The value of the parameter. */ constructor(name?: string, value?: Xfo); setValue(value: Xfo): void; /** * Extracts a number value from a buffer, updating current parameter state. * * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context?: AssetLoadContext): void; toJSON(context?: Record): Record; fromJSON(j: Record, context?: Record): void; /** * The clone method constructs a new Xfo parameter, copies its values * from this parameter and returns it. * * @return - Returns a new Xfo parameter. */ clone(): XfoParameter; } /** * Represents a specific type of parameter, that only stores `BaseImage` values. * * i.e.: * ```javascript * // Since `Label` is a `BaseImage` implementation, it helps us with the example. * const label = new Label('My awesome label', 'LabelPack') * const imageParam = new ImageParameter('MyImage', label) * //'myParameterOwnerItem' is an instance of a 'ParameterOwner' class. * // Remember that only 'ParameterOwner' and classes that extend from it can host 'Parameter' objects. * myParameterOwnerItem.addParameter(imageParam) * ``` * * @extends Parameter */ declare class ImageParameter extends Parameter { /** * Create an image parameter. * * @param name - The name of the image parameter. * @param value - The value of the parameter. */ constructor(name?: string, value?: BaseImage); setValue(value: BaseImage): void; /** * The toJSON method encodes this type as a json object for persistence. * * @param context - The context value. * @return - Returns the json object. */ toJSON(context?: Record): Record; /** * The fromJSON method decodes a json object for this type. * * @param j - The json object this item must decode. * @param context - The context value. * @return - Returns the json object. */ fromJSON(j: Record, context: Record): void; /** * The clone method constructs a new image parameter, * copies its values from this parameter and returns it. * * @return - Returns a new cloned image parameter. */ clone(): ImageParameter; } /** * A parameter for storing an array of string values. * * @extends Parameter */ declare class StringListParameter extends Parameter> implements IBinaryReader { /** * Create a string parameter. * @param {string} name - The name of the material color parameter. * @param {string} value - The value of the parameter. */ constructor(name?: string, value?: Array); setValue(value: Array): void; /** * Extracts the string value from a buffer, updating current parameter state. * * @param {BinReader} reader - The reader value. * @param {object} context - The context value. */ readBinary(reader: BinReader, context?: AssetLoadContext): void; /** * The toJSON method serializes this instance as a JSON. * It can be used for persistence, data transfer, etc. * * @param {Record} context - The context value. * @return {Record} - Returns the json object. */ toJSON(context?: Record): Record>; /** * The fromJSON method takes a JSON and deserializes into an instance of this type. * * @param {Record} j - The json object this item must decode. * @param {Record} context - The context value. */ fromJSON(j: Record, context?: Record): void; /** * The clone method constructs a new string parameter, copies its values * from this parameter and returns it. * * @return {StringListParameter} - Returns a new string parameter. */ clone(): StringListParameter; } /** * A parameter for storing an array of string values. * * @extends Parameter */ declare class Float32ArrayParameter extends Parameter implements IBinaryReader { /** * Create a string parameter. * @param {string} name - The name of the material color parameter. * @param {string} value - The value of the parameter. */ constructor(name?: string, value?: Float32Array); /** * Extracts the string value from a buffer, updating current parameter state. * * @param {BinReader} reader - The reader value. * @param {object} context - The context value. */ readBinary(reader: BinReader, context?: AssetLoadContext): void; /** * The toJSON method serializes this instance as a JSON. * It can be used for persistence, data transfer, etc. * * @param {Record} context - The context value. * @return {Record} - Returns the json object. */ toJSON(context?: Record): Record; /** * The fromJSON method takes a JSON and deserializes into an instance of this type. * * @param {Record} j - The json object this item must decode. * @param {Record} context - The context value. */ fromJSON(j: Record, context?: Record): void; /** * The clone method constructs a new string parameter, copies its values * from this parameter and returns it. * * @return {Float32ArrayParameter} - Returns a new string parameter. */ clone(): Float32ArrayParameter; } /** * A Parameter for storing list(array) values. * * i.e.: * ```javascript * const listParam = new ListParameter('MyList', GearParameter) * //'myParameterOwnerItem' is an instance of a 'ParameterOwner' class. * // Remember that only 'ParameterOwner' and classes that extend from it can host 'Parameter' objects. * myParameterOwnerItem.addParameter(listParam) * ``` * * **Events** * * **valueChanged:** Triggered when setting a value changes in the array(insert, add, remove). * * **elementAdded:** Triggered when an element is added to the array(add, insert). * * **elementRemoved:** Triggered when an element is removed from the array * * @extends Parameter */ declare class ListParameter extends Parameter> { /** * Create a list parameter. * @param name - The name of the list parameter. * @param dataType - The dataType value. */ constructor(name?: string, dataType?: string); /** * The filter method. * @param item - The item value. * @return - The return value. * * @private */ protected filter(item: unknown): boolean; /** * Returns the count of items in the array. * * @return - The return value. */ getCount(): number; /** * Returns value from the array in the specified index. * * @param index - The index value. * @return - The return value. */ getElement(index: number): unknown; /** * Sets a value in the specified array's index. * * @param index - The index value. * @param value - The value value. */ setElement(index: number, value: unknown): void; /** * Adds a new element at the end of the array pile. * * @param elem - The elem value. * @return - The return value. */ addElement(elem: unknown): unknown; /** * Removes an array element from the specified index * * @param index - The index value. */ removeElement(index: number): void; /** * Inserts a new element in the specified index. * * @param index - The index value. * @param elem - The elem value. */ insertElement(index: number, elem: unknown): void; setValue(value: Array): void; /** * The toJSON method encodes this type as a json object for persistence. * * @param context - The context value. * @return - Returns the json object. */ toJSON(context: Record): Record; /** * The fromJSON method decodes a json object for this type. * * @param j - The json object this item must decode. * @param context - The context value. */ fromJSON(j: Record, context?: Record): void; /** * The clone method constructs a new list parameter, copies its values * from this parameter and returns it. * * @return - Returns a new list parameter. */ clone(): ListParameter; /** * The destroy is called by the system to cause explicit resources cleanup. * Users should never need to call this method directly. */ destroy(): void; } /** * Represents a specific type of parameter, that stores multiple parameters in object format. * * i.e.: * ```javascript * const structParam = new StructParameter('MyStructParam') * //'myParameterOwnerItem' is an instance of a 'ParameterOwner' class. * // Remember that only 'ParameterOwner' and classes that extend from it can host 'Parameter' objects. * myParameterOwnerItem.addParameter(structParam) * ``` * * **Events** * * **valueChanged:** Triggered whenever parameter's value changes. * * @extends Parameter */ declare class StructParameter extends Parameter> { members: Parameter[]; /** * Create a struct parameter. * @param name - The name of the struct parameter. */ constructor(name?: string); /** * The _addMember method. * @param parameter - The parameter value. * @return - The return value. * @private */ protected addMember(parameter: Parameter): Parameter; /** * The getParameter method. * * @private * @param name - The parameter name. * @return - The return value. */ getParameter(name: string): Parameter | undefined; /** * Looks for a member parameter with the specified name and returns it. * * @param name - The parameter name. * @return - The return value. */ getMember(name: string): Parameter; /** * Returns the name of all parameters in StructParameter. * * @return - The return value. */ getMemberNames(): Array; /** * The toJSON method encodes this type as a json object for persistence. * * @param context - The context value. * @return - Returns the json object. */ toJSON(context?: Record): Record; /** * The fromJSON method decodes a json object for this type. * * @param j - The json object this item must decode. * @param context - The context value. */ fromJSON(j: Record, context: Record): void; clone(): StructParameter; /** * The destroy is called by the system to cause explicit resources cleanup. * Users should never need to call this method directly. */ destroy(): void; } /** * Represents a specific type of parameter, that only stores `TreeItem` values. * * i.e.: * ```javascript * const treeItem = new TreeItem('tree1') * const treeItemParam = new TreeItemParameter('MyTreeItem', treeItem) * //'myParameterOwnerItem' is an instance of a 'ParameterOwner' class. * // Remember that only 'ParameterOwner' and classes that extend from it can host 'Parameter' objects. * myParameterOwnerItem.addParameter(treeItemParam) * ``` * * **Events** * * **treeItemGlobalXfoChanged:** Triggered when computed world Xfo of parameter's `TreeItem` changes. * * **valueChanged:** Triggered when parameter's value changes. * * @extends Parameter */ declare class TreeItemParameter extends Parameter { protected filterFn?: (...args: any[]) => unknown; protected owner: TreeItem; protected listenerIDs: Record; /** * Create a tree item parameter. * @param name - The name of the tree item parameter. * @param filterFn - The filterFn value. */ constructor(name?: string, filterFn?: (...args: []) => unknown); private emitTreeItemGlobalXfoChanged; /** * Sets parameter value's owner `TreeItem`. * * @param owner - The owner value. */ setOwner(owner: TreeItem): void; /** * Returns parameter value's owner `TreeItem`. * * @return - The return value. */ getOwner(): TreeItem; /** * The setFilterFn method. * @param filterFn - The filterFn value. */ setFilterFn(filterFn: (...args: []) => unknown): void; /** * The getFilterFn method. * @return - The return value. */ getFilterFn(): any; /** * Sets parameter's `TreeItem` value. * * @param value - The treeItem value * @return - The return value. */ setValue(value: TreeItem): void; /** * The toJSON method encodes this type as a json object for persistence. * * @param context - The context value. * @return - Returns the json object. */ toJSON(context: Record): Record; /** * The fromJSON method decodes a json object for this type. * * @param j - The json object this item must decode. * @param context - The context value. */ fromJSON(j: Record, context: Record): void; /** * The clone method constructs a new tree item parameter, copies its values * from this parameter and returns it. * * @return - Returns a new tree item parameter. */ clone(context?: CloneContext): TreeItemParameter; } declare class ItemEvent extends BaseEvent { item: TreeItem; index: number; constructor(item: TreeItem, index: number); } /** Class representing an item set parameter. * @extends Parameter * @private */ declare class ItemSetParameter extends Parameter> { protected filterFn: (item: TreeItem) => boolean; /** * Create an item set parameter. * @param name - The name of the item set parameter. * @param filterFn - The filterFn value. */ constructor(name?: string, filterFn?: (item: TreeItem) => boolean); /** * The setFilterFn method. * @param filterFn - The filterFn value. */ setFilterFn(filterFn: (item: TreeItem) => boolean): void; /** * The getFilterFn method. * @return - The return value. */ getFilterFn(): (item: TreeItem) => boolean; /** * The getItem method. * @param index - The index param. * @return - The return value. */ getItem(index: number): TreeItem | undefined; /** * The addItem method. * @param item - The item value. * @param emitValueChanged - The emit value. * @return - The return value. */ addItem(item: TreeItem, emitValueChanged?: boolean): number | void; /** * Adds items to the parameter value * * @param items - list of items to add to the parameter * @param emitValueChanged * @memberof ItemSetParameter */ addItems(items: Set, emitValueChanged?: boolean): void; /** * The removeItem method. * @param index - The index value. * @param emitValueChanged - The emit param. * @return - The return value. */ removeItem(index: number, emitValueChanged?: boolean): TreeItem | void; /** * The setItems method. * @param items - The item param. * @param emit - The emit param. */ setItems(items: Set, emit?: boolean): void; /** * The clearItems method. * @param emit - The emit value. */ clearItems(emitValueChanged?: boolean): void; /** * The getNumItems method. * @return - The return value. */ getNumItems(): number; /** * The toJSON method encodes this type as a json object for persistence. * @param context - The context value. * @return - The return value. */ toJSON(context?: Record): Record; /** * The fromJSON method decodes a json object for this type. * @param j - The json object this item must decode. * @param context - The context value. */ fromJSON(j: Record, context?: Record): void; /** * The clone method constructs a item set new parameter, copies its values * from this parameter and returns it. * * @return - Returns a new item set parameter. */ clone(): ItemSetParameter; } /** * Represents a specific type of parameter, that stores `number` and `BaseImage` texture values. * * i.e.: * ```javascript * const image = new LDRImage(); * image.load("https://storage.googleapis.com/zea-playground-assets/zea-engine/texture.png") * * const numberParam = new MaterialFloatParam('MyMaterialFloat', 15.5) * numberParam.setImage(image) * //'myParameterOwnerItem' is an instance of a 'ParameterOwner' class. * // Remember that only 'ParameterOwner' and classes that extend from it can host 'Parameter' objects. * myParameterOwnerItem.addParameter(numberParam) * ``` * * * **Events** * * **valueChanged:** Triggered every time the Image value changes * * **textureDisconnected:** Triggered when Image value is cleaned/removed. * * **textureConnected:** Triggered when the Image value is set. * * @extends NumberParameter */ declare class MaterialFloatParam extends NumberParameter implements IBinaryReader { protected image?: BaseImage; /** * Create a material float parameter. * @param name - The name of the material color parameter. * @param value - The value of the parameter. * @param range - An array with two numbers. If defined, the parameter value will be clamped. */ constructor(name?: string, value?: number, range?: number[]); /** * Returns `BaseImage` texture of the Material. * * @return - The return value. */ getImage(): BaseImage | undefined; /** * Sets `BaseImage` texture value in parameter. * * @param value - The value value. */ setImage(value: BaseImage | null): void; /** * Sets `number` or the `BaseImage` texture value in parameter. * * @param value - The value param. */ setValue(value: number | BaseImage): void; /** * Extracts `number` and `Image` values from a buffer, updating current parameter state. * * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context: AssetLoadContext): void; /** * The clone method constructs a new material float parameter, * copies its values from this parameter and returns it. * * @return - Returns a new cloned material float parameter. */ clone(): MaterialFloatParam; } declare enum ColorSpace { Gamma = "Gamma", Linear = "Linear" } /** * Represents a specific type of parameter, that stores `Color` and `BaseImage` texture values. * * i.e.: * ```javascript * const image = new LDRImage(); * image.load("https://storage.googleapis.com/zea-playground-assets/zea-engine/texture.png") * * const matColorParam = new MaterialColorParam('MyMaterialColor', new Color(0, 254, 2)) * matColorParam.setImage(image) * //'myParameterOwnerItem' is an instance of a 'ParameterOwner' class. * // Remember that only 'ParameterOwner' and classes that extend from it can host 'Parameter' objects. * myParameterOwnerItem.addParameter(matColorParam) * ``` * * **Events** * * **valueChanged:** Triggered every time the Image value changes * * **textureDisconnected:** Triggered when Image value is cleaned/removed. * * **textureConnected:** Triggered when the Image value is set. * * @extends ColorParameter */ declare class MaterialColorParam extends ColorParameter { protected listenerIDs: Record; protected image?: BaseImage; colorSpace?: ColorSpace; /** * Create a material color parameter. * @param name - The name of the material color parameter. * @param value - The value of the parameter. */ constructor(name?: string, value?: Color); /** * Returns `BaseImage` texture of the Material. * * @return - The return value. */ getImage(): BaseImage | undefined; /** * The imageUpdated method. * @private */ private imageUpdated; /** * Sets `BaseImage` texture value in parameter. * * @param value - The value param. */ setImage(value: BaseImage | null): void; /** * Sets `Color` or the `BaseImage` texture value in parameter. * * @param value - The value param. */ setValue(value: Color | BaseImage): void; /** * Retrieves `Color` and `Image` values from a buffer, updating current parameter state. * * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context: AssetLoadContext): void; toJSON(context?: Record): Record; fromJSON(j: Record, context?: Record): void; /** * The clone method constructs a new material color parameter, * copies its values from this parameter and returns it. * * @return - Returns a new cloned material color parameter. */ clone(): MaterialColorParam; } /** * Represents a BaseImage with the ability to load data. * * **Events** * * **loaded:** Triggered when the data is loaded. * * **updated:** Triggered when the data is updated. * @extends BaseImage */ declare class DataImage extends BaseImage { protected __data: Uint8Array | Uint8ClampedArray | Uint16Array | Float32Array | ImageData | WebGLTexture; /** * Create a data image. * @param name - The name value. */ constructor(name?: string); /** * Returns an indicator of current item's loaded state. * @return - `true` if bytes data is fully loaded, `false` otherwise. */ isLoaded(): boolean; /** * Images are static content, so the value for this method is always going to be `false` * * @return - The return value. */ isStream(): boolean; /** * Sets Image's data by recieving an bytes array. * * @param width - The width value. * @param height - The height value. * @param data - The data value. */ setData(width: number, height: number, data: Uint8Array | Uint8ClampedArray | Uint16Array | Float32Array | ImageData | WebGLTexture): void; /** * Returns all parameters and class state values(Including data). * * @return - The return value. */ getParams(): ImageParams; } /** Class representing a file image. * @extends BaseImage */ declare class FileImage extends BaseImage { crossOrigin: string; url: string; protected __data: HTMLImageElement | null; /** * Create a file image. * @param name - The name value. * @param filePath - The filePath value. * @param params - The params value. */ constructor(name?: string, filePath?: string, params?: Record); /** * Defines how to handle cross origin request. * * **Possible values:** * * **anonymous** - CORS requests for this element will have the credentials flag set to 'same-origin'. * * **use-credentials** - CORS requests for this element will have the credentials flag set to 'include'. * * **""** - Setting the attribute name to an empty value, like crossorigin or crossorigin="", is the same as anonymous. * * @default anonymous * @param crossOrigin - The crossOrigin value. */ setCrossOrigin(crossOrigin: string): void; /** * Returns the HTML DOM element used to load the image file. * Be * @returns { HTMLImageElement | null } */ getDOMElement(): HTMLImageElement | null; /** * Uses the specify url to load an Image element and adds it to the data library. * Sets the state of the current object. * * @param url - The url value. * @param format - The format value. * @return Returns a promise that resolves once the image is loaded. */ load(url: string, format?: string): Promise; /** * Loads in Image file using the given URL * * @param url - The url value. * @param format - The format value. Can be 'RGB' or 'RGBA' for files that contain an alpha channel. This will cause objects to be drawn using the Transparent pass. */ setImageURL(url: string, format?: string): void; /** * The getParams method. * @return - The return value. */ getParams(): ImageParams; /** * The readBinary method. * @param reader - The reader param. * @param context - The context param. */ readBinary(reader: BinReader, context: AssetLoadContext): void; } /** Class representing a 2D file image. * @extends FileImage */ declare class FileImage2D extends FileImage { /** * Create a file image 2D. * @param filePath - The filePath value. * @param params - The params value. */ constructor(filePath: string, params?: any); } /** * Class representing a LDR (low dynamic range) image. * * ``` * const image = new LDRImage() * image.load("https://storage.googleapis.com/zea-playground-assets/zea-engine/texture.png") * ``` * * **Parameters** * * **PreferredSize(`NumberParameter`):** _todo_ * * **Events:** * * **loaded:** Triggered when image data is loaded. * * **File Types:** jpg, jpeg, png * * @extends FileImage */ declare class LDRImage extends FileImage { /** * Create a LDR image. * @param name - The name value. * @param filePath - The filePath value. * @param params - The params value. */ constructor(name?: string, filePath?: string, params?: Record); } /** * Class representing a LDR (low dynamic range) video. * * ``` * const video = new LDRVideo() * video.load("https://storage.googleapis.com/zea-playground-assets/zea-engine/video.mp4") * ``` * * **Parameters** * * **Mute(`BooleanParameter`):** Mutes video volume. * * **Loop(`BooleanParameter`):** Repeats video over and over again. * * **Gain(`NumberParameter`):** Sets loudness of the video before going through any processing. * * **SpatializeAudio(`BooleanParameter`):** Enables/Disables spatial(Surrounding) audio. * * **refDistance(`NumberParameter`):** _todo_ * * **maxDistance(`NumberParameter`):** _todo_ * * **rolloffFactor(`NumberParameter`):** _todo_ * * **coneInnerAngle(`NumberParameter`):** _todo_ * * **coneOuterAngle(`NumberParameter`):** _todo_ * * **coneOuterGain(`NumberParameter`):** _todo_ * * **File Types:** mp4, ogg * * @extends FileImage */ declare class LDRVideo extends FileImage { protected videoElem: HTMLVideoElement; muteParam: BooleanParameter; loopParam: BooleanParameter; spatializeAudioParam: BooleanParameter; refDistanceParam: NumberParameter; maxDistanceParam: NumberParameter; rolloffFactorParam: NumberParameter; coneInnerAngleParam: NumberParameter; coneOuterAngleParam: NumberParameter; coneOuterGainParam: NumberParameter; gainParam: NumberParameter; /** * Create a LDR video. * @param name - The name value. * @param filePath - The filePath value. * @param params - The params value. */ constructor(name?: string, filePath?: string, params?: Record); getAudioSource(): HTMLVideoElement; /** * Uses the specify url to load an Image element and adds it to the data library. * Sets the state of the current object. * * @param url - The url value. * @param format - The format value. * @return Returns a promise that resolves once the image is loaded. */ load(url: string, format?: string): Promise; /** * The getParams method. * @return - The return value. */ getParams(): ImageParams; } /** * Class representing a GIF image. * * ``` * const image = new GIFImage() * image.load("https://storage.googleapis.com/zea-playground-assets/zea-engine/texture.gif") * ``` * * **Parameters** * * **StreamAtlasDesc:** * * **StreamAtlasIndex:** * * **Events** * * **loaded:** Triggered when the gif data is loaded. * * **File Types:** gif * * @extends FileImage */ declare class GIFImage extends FileImage { protected __streamAtlas: any; protected play: any; protected stop: any; protected __resourcePromise: any; protected __unpackedData: any; streamAtlasDescParam: Vec4Parameter; streamAtlasIndexParam: NumberParameter; /** * Create a GIF image. * @param name - The name value. * @param filePath - The filePath value. * @param params - The params value. */ constructor(name?: string, filePath?: string, params?: {}); /** * The getFrameDelay method. * @param index - The index value. * @return - The return value. */ getFrameDelay(index: number): number; /** * Uses the specify url to load an Image element and adds it to the data library. * Sets the state of the current object. * * @param url - The url value. * @param format - The format value. * @return Returns a promise that resolves once the image is loaded. */ load(url: string, format?: string): Promise; } /** * Represents a 2D label item the scene. * Since displaying text in the scene is not an easy task, * we've abstracted the complicated logic behind this class, transforming any text into a 2D image(`DataImage`). * * **Library List** * * LabelPack * * **Parameters** * * **Library(`StringParameter`):** Library you wan to use for your label, see **Library List** above. * * **Text(`StringParameter`):** * * **FontColor(`ColorParameter`):** * * **Margin(`NumberParameter`):** * * **BorderWidth(`NumberParameter`):** * * **BorderRadius(`NumberParameter`):** * * **Outline(`BooleanParameter`):** * * **OutlineColor(`BooleanParameter`):** * * **Background(`BooleanParameter`):** * * **ColorParameter(`BackgroundColor`):** * * **FillBackground(`BooleanParameter`):** * * **StrokeBackgroundOutline(`BooleanParameter`):** * * **FontSize(`NumberParameter`):** Represents FontSize of the label * * **Font(`StringParameter`):** * * **Events** * * **loaded:** Triggered when label's data is loaded. * * **updated:** Triggered when label's data changes. * * **labelRendered:** Triggered when the text image is rendered. Contains `width`, `height` and data of the image. * * @extends DataImage */ declare class Label extends DataImage { protected needsRender: boolean; protected canvasElem: HTMLCanvasElement; protected requestedReRender: boolean; /** * Creates a label instance. Creating a canvas element that hosts the specified text. * * @param name - The name value. * @param library - The library value. */ marginParam: NumberParameter; borderRadiusParam: NumberParameter; /** * @member libraryParam - Library you wan to use for your label, see **Library List** above. */ libraryParam: StringParameter; /** * @member textParam - text to display on the label */ textParam: StringParameter; /** * @member fontColorParam - TODO */ fontColorParam: ColorParameter; /** * @member - TODO */ fontSizeParam: NumberParameter; /** * @member fontParam - TODO */ fontParam: StringParameter; /** * @member borderWidthParam - Border around the label */ borderWidthParam: NumberParameter; /** * @member outlineParam - TODO */ outlineParam: BooleanParameter; /** * @member outlineColorParam - TODO */ outlineColorParam: ColorParameter; /** * @member backgroundParam - TODO */ backgroundParam: BooleanParameter; /** * @member backgroundColorParam - TODO */ backgroundColorParam: ColorParameter; /** * @member fillBackgroundParam - TODO */ fillBackgroundParam: BooleanParameter; /** * @member strokeBackgroundOutlineParam - TODO */ strokeBackgroundOutlineParam: BooleanParameter; constructor(name?: string, library?: string); /** * This method can be overridden in derived classes * to perform general updates (see GLPass or BaseItem). * * @param event - The event object. * @private */ __parameterValueChanged(event: Record): void; /** * Method in charge of basically do everything, set text, load/update it, get the library, load the font, etc. */ loadLabelData(): void; /** * Renders the label text to a canvas element ready to display. * Here is where all parameters are applied to the canvas containing the text, * then the image data is extracted from the canvas context. */ renderLabelToImage(): void; /** * Returns all parameters and class state values(Including data). * * @return - The return value. */ getParams(): ImageParams; } /** Class representing a 2D video stream image. * @private * @extends BaseImage */ declare class VideoStreamImage2D extends BaseImage { __data: HTMLVideoElement; __intervalId: number; /** * Create a 2D video stream image. */ constructor(); /** * The connectWebcam method. * @param width - The width of the video. * @param height - The height of the video. * @param rearCamera - Boolean determining if it is a rear camera or not. */ connectWebcam(width: number, height: number, rearCamera?: boolean): void; /** * The setVideoStream method. * @param video - The video value. */ setVideoStream(video: HTMLVideoElement): void; /** * The stop method. */ stop(): void; /** * The start method. */ start(): void; /** * The isLoaded method. * @return - The return value. */ isLoaded(): boolean; /** * The getParams method. * @return - The return value. */ getParams(): ImageParams; } declare global { interface Window { XLSX: any; } } /** Class representing a label manager. * @private */ declare class LabelManager extends EventEmitter { protected __language: any; protected __foundLabelLibraries: Record; protected __labelLibraries: Record; /** * Create a label manager. */ constructor(); /** * Load a label library into the manager. * @param name - The name of the library. * @param url- The json data of of the library. */ loadLibrary(name: string, url: string): void; /** * Checks if the library is found. * @param name - The name of the library. * @return - Returns true if the library is found. */ isLibraryFound(name: string): boolean; /** * Checks if the library is loaded. * @param name - The name of the library. * @return - Returns true if the library is loaded. */ isLibraryLoaded(name: string): boolean; /** * The getLabelText method. * @param libraryName - The name of the library. * @param labelName - The name of the label. * @return - The return value. */ getLabelText(libraryName: string, labelName: string): any; /** * The setLabelText method. * @param libraryName - The name of the library. * @param labelName - The name of the label. * @param labelText - The text of the label. */ setLabelText(libraryName: string, labelName: string, labelText: string): void; setLanguage(ln: any): void; } declare const labelManager: LabelManager; declare class FatLinesMaterial extends Material { baseColorParam: MaterialColorParam; opacityParam: NumberParameter; lineThicknessParam: NumberParameter; overlayParam: NumberParameter; constructor(name?: string); isTextured(): boolean; } declare class FatPointsMaterial extends Material { baseColorParam: MaterialColorParam; pointSizeParam: NumberParameter; borderWidthParam: NumberParameter; overlayParam: NumberParameter; constructor(name?: string); /** * The clone method constructs a new material, copies its values * from this item and returns it. * * @param context - The context value. * @return - Returns a new cloned material. */ clone(context?: CloneContext): FatPointsMaterial; } declare class FlatSurfaceMaterial extends Material { baseColorParam: MaterialColorParam; overlayParam: MaterialFloatParam; constructor(name?: string); /** * The clone method constructs a new material, copies its values * from this item and returns it. * * @param context - The context value. * @return - Returns a new cloned material. */ clone(context?: CloneContext): FlatSurfaceMaterial; } declare class LinesMaterial extends Material { baseColorParam: MaterialColorParam; opacityParam: MaterialFloatParam; overlayParam: MaterialFloatParam; constructor(name?: string); /** * The clone method constructs a new material, copies its values * from this item and returns it. * * @param context - The context value. * @return - Returns a new cloned material. */ clone(context?: CloneContext): LinesMaterial; } declare class PointsMaterial extends Material { baseColorParam: MaterialColorParam; pointSizeParam: NumberParameter; overlayParam: MaterialFloatParam; constructor(name?: string); /** * The clone method constructs a new material, copies its values * from this item and returns it. * * @param context - The context value. * @return - Returns a new cloned material. */ clone(context?: CloneContext): PointsMaterial; } declare class ScreenSpaceMaterial extends Material { baseColorParam: MaterialColorParam; constructor(name?: string); /** * The clone method constructs a new material, copies its values * from this item and returns it. * * @param context - The context value. * @return - Returns a new cloned material. */ clone(context?: CloneContext): ScreenSpaceMaterial; } declare class SimpleSurfaceMaterial extends Material { baseColorParam: MaterialColorParam; opacityParam: MaterialFloatParam; emissiveStrengthParam: MaterialFloatParam; constructor(name?: string); /** * The clone method constructs a new material, copies its values * from this item and returns it. * * @param context - The context value. * @return - Returns a new cloned material. */ clone(context?: CloneContext): SimpleSurfaceMaterial; } declare class StandardSurfaceMaterial extends Material { baseColorParam: MaterialColorParam; normalParam: MaterialColorParam; ambientOcclusion: MaterialFloatParam; metallicParam: MaterialFloatParam; roughnessParam: MaterialFloatParam; reflectanceParam: MaterialFloatParam; emissiveStrengthParam: MaterialFloatParam; opacityParam: MaterialFloatParam; edgeWeightParam: MaterialFloatParam; overlayParam: MaterialFloatParam; edgeColorParam: MaterialColorParam; pointColorParam: MaterialColorParam; pointSizeParam: MaterialFloatParam; constructor(name?: string); /** * The clone method constructs a new material, copies its values * from this item and returns it. * * @param context - The context value. * @return - Returns a new cloned material. */ clone(context?: CloneContext): StandardSurfaceMaterial; } declare class VertexColorMaterial extends Material { constructor(name?: string); /** * The clone method constructs a new material, copies its values * from this item and returns it. * * @param context - The context value. * @return - Returns a new cloned material. */ clone(context?: CloneContext): VertexColorMaterial; /** * The supportsInstancing method. * @return - return false for shaders that cannot be rendered in instanced mode. */ static supportsInstancing(): boolean; } declare class MaskMaterial extends SimpleSurfaceMaterial { constructor(name?: string); clone(context?: CloneContext): SimpleSurfaceMaterial; } declare class EnvProjectionMaterial extends Material { projectionCenter: Vec3Parameter; constructor(name?: string); clone(context?: CloneContext): EnvProjectionMaterial; isTextured(): boolean; } /** * TreeItem type of class designed for making duplications of parts of the tree. * * @extends {TreeItem} */ declare class InstanceItem extends TreeItem { protected srcTreePath: Array; protected srcTree: TreeItem | null; /** * Create an instance item. * @param name - The name of the instance item. */ constructor(name?: string); /** * Clones passed in `TreeItem` all the way down and adds it as a child of current item. * * @param treeItem - The treeItem value. */ setSrcTree(treeItem: TreeItem): void; /** * Returns the last `TreeItem` cloned. * * @return - The return value. */ getSrcTree(): TreeItem; /** * Sets state of current Item(Including cloned item) using a binary reader object. * * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context: AssetLoadContext): void; /** * The clone method constructs a new instance item, copies its values * from this item and returns it. * * @param context - The context value. * @return - Returns a new cloned geom item. */ clone(context?: CloneContext): InstanceItem; /** * Copies current TreeItem with all its children. * * @param src - The tree item to copy from. * @param context - The context value. */ copyFrom(src: TreeItem, context?: CloneContext): void; } /** * A special type of TreeItem(Item with hierarchical abilities) class that represents a banner in a 2D dimension. * Can own any type of `BaseImage`. * **Parameters** * * **Image(`ImageParameter`):** Is the BaseImage you want to display on the board. * * **PixelsPerMeter(`NumberParameter`):** Quality and Size of the board. The bigger the number, the smaller the board. * * **Alpha(`NumberParameter`):** Transparency of the board, from 0 to 1. * * **AlignedToCamera(`BooleanParameter`):** Faces or not the board to the camera at all time(Moves with camera movement). * * **DrawOnTop(`BooleanParameter`):** The billboards are rendered overlaid on the scene. * * **FixedSizeOnscreen(`BooleanParameter`):** The billboards are rendered at a fixed size on screen, regardless of the distance to the billboard. * * @extends TreeItem */ declare class BillboardItem extends TreeItem { /** * Creates a billboard item. * * @param name - The name of the billboard item. * @param image - The image value. */ /** * @member imageParam - Is the BaseImage you want to display on the board. */ imageParam: ImageParameter; /** * @member pixelsPerMeterParam - Quality and Size of the board. The bigger the number, the smaller the board. */ pixelsPerMeterParam: NumberParameter; /** * @member alphaParam - Transparency of the board, from 0 to 1. */ alphaParam: NumberParameter; /** * @member colorParam - The color of the billboard */ colorParam: ColorParameter; /** * @member alignedToCameraParam - Faces or not the board to the camera at all time(Moves with camera movement). */ alignedToCameraParam: BooleanParameter; /** * @member drawOnTopParam - The billboards are rendered overlaid on the scene. */ drawOnTopParam: BooleanParameter; /** * @member fixedSizeOnscreenParam - The billboards are rendered at a fixed size on screen, regardless of the distance to the billboard. */ fixedSizeOnscreenParam: BooleanParameter; /** * @member pivotParam - Where the pivot of the billboard is. */ pivotParam: Vec2Parameter; constructor(name?: string, image?: BaseImage); } /** * BaseGroup are a special type of `TreeItem` that allows you to gather/classify/organize/modify * multiple items contained within the group. Items can be added to the group directly, or using * its path. * All parameters set to the group are also set to the children; in other words, it's a faster way * to apply common things to multiple items. * * **Parameters** * * **Items(`ItemSetParameter`):** _todo_ * * @extends TreeItem */ declare class BaseGroup extends TreeItem { /** * @member itemsParam - TODO */ itemsParam: ItemSetParameter; protected itemsEventHandlers: Array>; searchRoot?: TreeItem; /** * Creates an instance of a group. * * @param name - The name of the group. */ constructor(name?: string); /** * The updateVisibility method. * @return - The return value. * @private */ updateVisibility(): boolean; /** * Calculates the new opacity value based on the opacityParam value * and the lowest of the inherited opacity values. */ protected updateOpacity(): void; /** * Adds a highlight to the tree item. * * @param name - The name of the tree item. * @param color - The color of the highlight. * @param propagateToChildren - A boolean indicating whether to propagate to children. */ addHighlight(name: string, color: Color, propagateToChildren?: boolean): void; /** * Removes a highlight to the tree item. * * @param name - The name of the tree item. * @param propagateToChildren - A boolean indicating whether to propagate to children. */ removeHighlight(name: string, propagateToChildren?: boolean): void; /** * sets the root item to be used as the search root. * @param treeItem */ setSearchRoot(treeItem: TreeItem): void; /** * The setOwner method assigns a new owner to the item. The owner of a group becomes its search root unless another search root is already set. * * @param ownerItem - The new owner item. */ setOwner(ownerItem: TreeItem): void; /** * The __bindItem method. * @param item - The item value. * @param index - The index value. * @private */ protected bindItem(item: TreeItem, index: number): void; /** * The unbindItem method. * @param item - The item value. * @param index - The index value. * @private */ protected unbindItem(item: TreeItem, index: number): void; /** * Adds an item to the group(See `Items` parameter). * * @param item - The item value. * @param emit - The emit value. */ addItem(item: TreeItem, emit?: boolean): void; /** * Removes an item from the group(See `Items` parameter). * * @param item - The item value. * @param emit - The emit value. */ removeItem(item: TreeItem, emit?: boolean): void; /** * Removes all items from the group. * * @param emit - `true` triggers `valueChanged` event. */ clearItems(emit?: boolean): void; /** * Returns the list of `TreeItem` objects owned by the group. * * @return - The return value. */ getItems(): Set | undefined; /** * Sets an entire new array of items to the BaseGroup replacing any previous items. * * @param items - List of `TreeItem` you want to add to the group */ setItems(items: Set): void; } /** * @extends BaseGroup */ declare class SelectionSet extends BaseGroup { #private; /** * @member highlightedParam - Whether or not the TreeItem should be highlighted. */ highlightedParam: BooleanParameter; /** * @member highlightColorParam - The color of the highlight. */ highlightColorParam: ColorParameter; /** * @member highlightFillParam - TODO */ highlightFillParam: NumberParameter; /** * Creates an instance of a group. * * @param name - The name of the group. */ constructor(name?: string); /** * The updateHighlight method. * @private */ updateHighlight(): void; /** * Changes selection's state of the group with all items it owns. * * @param sel - Boolean indicating the new selection state. */ setSelected(sel: boolean): void; /** * The __bindItem method. * @param item - The item value. * @param index - The index value. * @private */ bindItem(item: BaseItem, index: number): void; /** * The unbindItem method. * @param item - The item value. * @param index - The index value. * @private */ unbindItem(item: BaseItem, index: number): void; /** * The clone method constructs a new group, * copies its values and returns it. * * @param context - The context value. * @return - Returns a new cloned group. */ clone(context: CloneContext): SelectionSet; } /** An operator for modifying group members by the groups Xfo * @private * @extends Operator * */ declare class GroupMemberXfoOperator extends Operator { #private; groupTransformXfo: XfoOperatorInput; memberGlobalXfo: XfoOperatorOutput; /** * Create a GroupMemberXfoOperator operator. * @param groupTransformXfoParam - The parameter on the Group which defines the displacement to apply to the members. * @param memberXfoGlobalParam - The GlobalXfo param found on the Member. */ constructor(groupTransformXfoParam: XfoParameter, memberXfoGlobalParam: XfoParameter); /** * used to temporarily disable/enable the operator when the Group bind Xfo is being calculated */ disable(): void; /** * used to temporarily disable/enable the operator when the Group bind Xfo is being calculated */ enable(): void; /** * The evaluate method. */ evaluate(): void; /** * When the value on a Parameter is modified by a user by calling 'setValue, * then if any operators are bound, the value of the Parameter cannot be modified * directly as it is the result of a computation. Instead, the Parameter calls * 'backPropagateValue' on the Operator to cause the Operator to handle propagating * the value to one or more of its inputs. * to its inputs. * @param value - The value param. * @return - The modified value. */ backPropagateValue(value: Xfo): Xfo; } declare const GROUP_XFO_MODES: { disabled: number; manual: number; first: number; average: number; globalOri: number; }; /** * The KinematicGroup is used to control the transform of a collection of objects int eh scene. * Objects can be added to a kinematic group and then the group can be transformed, causing each * of the members to be transformed as one. * **Parameters** * **InitialXfoMode(`MultiChoiceParameter`):** _todo_ * **GroupTransform(`XfoParameter`):** _todo_ * * @extends BaseGroup */ declare class KinematicGroup extends BaseGroup { #private; protected calculatingGroupXfo: boolean; protected memberXfoOps: GroupMemberXfoOperator[]; /** * @member initialXfoModeParam - TODO */ initialXfoModeParam: MultiChoiceParameter; /** * @member groupTransformParam - Provides the transformation Xfo that is applied to each Group Member. */ groupTransformParam: XfoParameter; /** * @member highlightedParam - Whether or not the TreeItem should be highlighted. */ highlightedParam: BooleanParameter; /** * @member highlightColorParam - The color of the highlight. */ highlightColorParam: ColorParameter; /** * @member highlightFillParam - TODO */ highlightFillParam: NumberParameter; /** * Creates an instance of a group. * * @param name - The name of the group. */ constructor(name?: string); /** * Returns enum of available xfo modes. * * | Name | Default | * | --- | --- | * | manual | 0 | * | first | 1 | * | average | 2 | * | globalOri | 3 | */ static get INITIAL_XFO_MODES(): { disabled: number; manual: number; first: number; average: number; globalOri: number; }; /** * Returns bind Xfo that is used to compute the groupTransform * Note: The Bind Xfo is determined by the 'GROUP_XFO_MODES' value. */ get bindXfo(): Xfo; /** * Calculate the group Xfo translate. * @private * @return - Returns a new Xfo. */ calcGroupXfo(): void; get editingPivot(): boolean; set editingPivot(value: boolean); /** * The __bindItem method. * @param item - The item value. * @param index - The index value. * @private */ protected bindItem(item: TreeItem, index: number): void; /** * The unbindItem method. * @param item - The item value. * @param index - The index value. * @private */ protected unbindItem(item: TreeItem, index: number): void; /** * Adds an item to the group(See `Items` parameter). * * @param item - The item value. * @param emit - The emit value. */ addItem(item: TreeItem, emit?: boolean): void; /** * Removes an item from the group(See `Items` parameter). * * @param item - The item value. * @param emit - The emit value. */ removeItem(item: TreeItem, emit?: boolean): void; /** * Sets an entire new array of items to the BaseGroup replacing any previous items. * * @param items - List of `TreeItem` you want to add to the group */ setItems(items: Set): void; /** * Removes all items from the group. * * @param emit - `true` triggers `valueChanged` event. */ clearItems(emit?: boolean): void; /** * The clone method constructs a new group, * copies its values and returns it. * * @param context - The context value. * @return - Returns a new cloned group. */ clone(context: CloneContext): KinematicGroup; /** * Encodes the current object as a json object. * * @param context - The context value. * @return - Returns the json object. */ toJSON(context?: Record): Record; /** * Decodes a json object for this type. * * @param json - The json object this item must decode. * @param context - The context value. */ fromJSON(json: Record, context?: Record): void; } /** * * **Parameters** * * **Material(`MaterialParameter`):** _todo_ * * @extends BaseGroup */ declare class MaterialGroup extends BaseGroup { /** * @member materialParam - The Material to use when rendering this GeomItem */ materialParam: MaterialParameter; private __backupMaterials; /** * Creates an instance of a group. * * @param name - The name of the group. */ constructor(name?: string); /** * The updateHighlight method. * @private */ private updateHighlight; /** * The updateHighlight method. * @private */ private updateHighlightHelper; /** * Changes selection's state of the group with all items it owns. * * @param sel - Boolean indicating the new selection state. */ setSelected(sel: boolean): void; /** * The updateOpacity method. */ protected updateOpacity(): void; /** * The updateMaterial method. * @private */ private updateMaterial; /** * The updateMaterial method. * @private */ private updateMaterialHelper; /** * The __bindItem method. * @param item - The item value. * @param index - The index value. * @private */ bindItem(item: BaseItem, index: number): void; /** * The unbindItem method. * @param item - The item value. * @param index - The index value. * @private */ unbindItem(item: BaseItem, index: number): void; /** * The clone method constructs a new group, * copies its values and returns it. * * @param context - The context value. * @return - Returns a new cloned group. */ clone(context: CloneContext): MaterialGroup; } /** * An operator that calculates the delta transform of the group since items were bound to it. * @extends Operator * */ declare class CuttingPlaneOperator extends Operator { groupGlobalXfo: XfoOperatorInput; cuttingPlane: Vec4OperatorOutput; /** * Create a GroupMemberXfoOperator operator. * @param groupGlobalXfoParam - The GlobalXfo param found on the Group. * @param cuttingPlaneParam - The parameter on the Group which defines the displacement to apply to the members. */ constructor(groupGlobalXfoParam: XfoParameter, cuttingPlaneParam: Vec4Parameter); /** * The evaluate method. */ evaluate(): void; } /** * Groups are a special type of `BaseGroup` that allows you to gather/classify/organize/modify * multiple items contained within the group. Items can be added to the group directly, or using * its path. * All parameters set to the group are also set to the children; in other words, it's a faster way * to apply common things to multiple items. * * **Parameters** * * **CutAwayEnabled(`BooleanParameter`):** _todo_ * * **CutPlaneNormal(`Vec3Parameter`):** _todo_ * * **CutPlaneDist(`NumberParameter`):** _todo_ * * @extends BaseGroup */ declare class CuttingPlane extends BaseGroup { cutPlaneOp: CuttingPlaneOperator; cutAwayEnabledParam: BooleanParameter; cutPlaneParam: Vec4Parameter; /** * Creates an instance of a group. * * @param name - The name of the group. */ constructor(name?: string); /** * The updateCutaway method. * @param item - The item in the group. * @private */ updateCutaway(item: TreeItem): void; /** * The __bindItem method. * @param item - The item value. * @param index - The index value. * @private */ bindItem(item: BaseItem, index: number): void; /** * The unbindItem method. * @param item - The item value. * @param index - The index value. * @private */ unbindItem(item: BaseItem, index: number): void; /** * The clone method constructs a new group, * copies its values and returns it. * * @param context - The context value. * @return - Returns a new cloned group. */ clone(context: CloneContext): CuttingPlane; } /** * The GridTreeItem displays a grid of a given size and resolution. The Grid is oriented on the XY plane * and highlights the X and Y axes with Red and Green lines. Grids are useful in displaying scene scale and coordinate system. * The Grid geometry does not return a bounding box and so does not effect the bounding of the scene. * * @extends {TreeItem} */ declare class GridTreeItem extends TreeItem { /** * Creates an instance of GridTree. * * @param gridSize * @param resolution * @param gridColor */ constructor(gridSize?: number, resolution?: number, gridColor?: Color); /** * @private * @return - Reset Bounding Box */ _cleanBoundingBox(): Box3; } /** * Class representing the environment where all the displayed assets live. */ declare class Scene { /** * @member envMapParam - The image displayed and used for the environment map. */ envMapParam: ImageParameter; /** * @member displayEnvMapParam - Boolean that determines whether or not the environment map should be displayed. */ displayEnvMapParam: BooleanParameter; /** * @member envMapLODParam - TODO */ envMapLODParam: NumberParameter; protected root: TreeItem; /** * Create a scene. */ constructor(); /** * Returns the scene's root item(`TreeItem`) that owns every item in the scene. * * @return - The return value. */ getRoot(): TreeItem; /** * Returns resourceLoader object set on class initialization. * * @return - The return value. */ getResourceLoader(): ResourceLoader; /** * Sets Environment Map with the BaseImage you'd like to display in your scene background. * * @param envMap - The envMap value. */ setEnvMap(envMap: EnvMap): void; /** * Sets up and displays the scene grid of a given size and resolution. The Grid is oriented on the XY plane * and highlights the X and Y axes with Red and Green lines. Grids are useful in displaying scene scale and coordinate system. * The Grid geometry does not return a bounding box and so does not effect the bounding of the scene. * The GridTreeItem display a grid of a given size and resolution. The Grid is oriented on the XY plane * and highlights the X and Y axes with Red and Green lines. * * @param gridSize - The size of the grid. * @param resolution - The resolution of the grid. * @param gridColor - The color of the grid. * @return - The return value. */ setupGrid(gridSize?: number, resolution?: number, gridColor?: Color): GridTreeItem; } /** * Class designed to load and handle `.vla` files. * * **Events** * * **loaded:** Triggered once the tree is loaded. Note: the tree bounding box is valid once the tree is loaded. * * **geomsLoaded:** Triggered once all geometries are loaded. * * @extends AssetItem */ declare class VLAAsset extends AssetItem { /** * Create a VLA asset. * @param name - The name value. */ constructor(name?: string); /** * Sets state of current asset using a binary reader object. * * @param reader - The reader value. * @param context - The context value. * @return - The return value. */ readBinary(reader: BinReader, context: AssetLoadContext): number; /** * Loads all the geometries and metadata from the asset file. * @param url - The URL of the asset to load * @param context - The load context object that provides additional data such as the units of the scene we are loading into. * @return - Returns a promise that resolves once the initial load is complete */ load(url: string, context?: AssetLoadContext): Promise; } /** * Class designed to load and handle `.obj` files. * Which define the geometry and other properties for objects. * * **Parameters** * * **splitObjects(`BooleanParameter`):** _todo_ * * **splitGroupsIntoObjects(`BooleanParameter`):** _todo_ * * **loadMtlFile(`BooleanParameter`):** _todo_ * * **unitsConversion(`NumberParameter`):** _todo_ * * **defaultShader(`StringParameter`):** _todo_ * * **Events** * * **loaded:** Triggered once everything is loaded. * * **geomsLoaded:** Triggered once all geometries are loaded. * * @extends AssetItem */ declare class ObjAsset extends AssetItem { splitObjects: BooleanParameter; splitGroupsIntoObjects: BooleanParameter; loadMtlFile: BooleanParameter; unitsConversion: NumberParameter; defaultShader: StringParameter; /** * Create an obj asset. * @param name - The name of the object asset. */ /** * @member splitObjectsParam - TODO */ splitObjectsParam: BooleanParameter; /** * @member splitGroupsIntoObjectsParam - TODO */ splitGroupsIntoObjectsParam: BooleanParameter; /** * @member loadMtlFileParam - TODO */ loadMtlFileParam: BooleanParameter; /** * @member unitsConversionParam - TODO */ unitsConversionParam: NumberParameter; /** * @member defaultShaderParam - The default shader to use. */ defaultShaderParam: StringParameter; constructor(name: string); /** * Loads all the geometries and metadata from the Obj file. * @param url - The URL of the asset to load * @return - Returns a promise that resolves once the initial load is complete */ load(url: string): Promise; } /** * Class for defining and interaction model of the camera. * * The CameraManipulator supports a variety of manipulation modes, and hotkeys/modifier keys * that allow the user to rapidly switch between modes, such as 'turntable' and 'pan'. * A detailed explanation of various camera manipulation modes can be found * here: https://www.mattkeeter.com/projects/rotation/ * * **MANIPULATION_MODES** * * **pan:** Translates the camera sideways according the the camera's current orientation. Activated by the right mouse button, or two fingered touches on mobile. * * **dolly:** Translates the camera forwards and backwards according the the camera's current orientation. Activated by holding the ctrl and alt keys while using the left mouse button, or the mouse wheel, or two fingered touches on mobile. * * **focussing:** Focusses the camera on a specific 3d point in the scene. Activated by double clicking, or double tapping on a geometry in the 3d view. * * **look:** Rotates the camera around its own position. Useful for simulating looking by turning ones head inside a scene. Activated by holding the ctrl key and right mouse button. * * **turntable:** Rotates the camera around the current camera target, using the turntable style manipulation described above. Activated by the left mouse button. * * **tumbler:** Rotates the camera around the current camera target, using the tumbler style manipulation described above. Activated by the left mouse button. * * **trackball:** Rotates the camera around the current camera target, using the trackball style manipulation described above. Activated by the left mouse button. * * The default manipulation mode, is the mode that is active with only the left mouse button. The default manipulation mode is currently 'turntable'. * * To Assign a different default manipulation mode, retrieve the manipulator from the viewport * and set the default mode. * ``` * const cameraManipulator = renderer.getViewport().getManipulator() * cameraManipulator.setDefaultManipulationMode(CameraManipulator.MANIPULATION_MODES.trackball); * ``` * * This class is the default manipulator, and can be replaced with custom manipulators. * * ``` * const customManipulator = new CustomCameraManipulator() * renderer.getViewport().setManipulator(customManipulator); * ``` * * The Camera manipulator can focus the view on a point in the view by various gestures. * A single click or touch tap can cause the view to be focussed or a double click or tap. * This behavior can be configured using the 2 values. * e.g. to disable all focus gestures, set both values to zero. * ``` * // Make the aim focus occur after a single touch or click. * const cameraManipulator = renderer.getViewport().getManipulator() * cameraManipulator.aimFocusOnTouchTap = 1 * cameraManipulator.aimFocusOnMouseClick = 1 * ``` * * **Parameters** * * **OrbitRate(`NumberParameter`):** The rate at which mouse or touch interactions are translated camera orientation changes. * * **DollySpeed(`NumberParameter`):** The rate at which the mouse button or touch interactions are translated camera dolly movement. * * **mouseWheelDollySpeed(`NumberParameter`):** The rate at which the mouse wheel interactions are translated camera dolly movement. * * Note: this value defaults to different values for touch based interfaces to mouse based input. * For mobile devices, the orbit rate defaults to 0.5, and for mouse based interaction, the value defaults to 1. * A value of 1 means that the camera will rotate 180 degrees for a mouse interaction that spans from the left border of the viewport to the right border. * Some applications might require lower, or higher default values * * To set different default values for mobile or desktop set a different value based on the SystemDesc.isMobileDevice flag. * ``` * const cameraManipulator = renderer.getViewport().getManipulator() * cameraManipulator.getParameter('OrbitRate').setValue(SystemDesc.isMobileDevice ? 0.1 : 0.4) * ``` * * **Events** * * **movementFinished:** Emitted when a camera movement is finished. E.g. when the user releases the mouse after a dolly, or after the focussing action has completed. * * **aimingFocus:** Emitted when a camera is being focussed on a target. E.g. when the user double clicks the mouse on a geometry in the view. * * @extends BaseTool */ declare class CameraManipulator extends BaseTool { protected appData: Record; orbitAroundCursor: boolean; zoomTowardGeomUnderCursor: boolean; aimFocusOnTouchTap: number; aimFocusOnMouseClick: number; enabledWASDWalkMode: boolean; defaultManipulationState: number; private prevCursor; private manipulationState; private pointerDown; private dragging; private keyboardMovement; private keysPressed; private velocity; private prevVelocityIntegrationTime; private ongoingTouches; private orbitTarget; private prevMousePos; private focusIntervalId; private mouseWheelMovementDist; private mouseWheelZoomCount; private mouseWheelZoomId; /** * @member orbitRateParam - The rate at which mouse or touch interactions are translated camera orientation changes. */ orbitRateParam: NumberParameter; /** * @member dollySpeedParam - The rate at which the mouse button or touch interactions are translated camera dolly movement. */ dollySpeedParam: NumberParameter; /** * @member mouseWheelDollySpeedParam - The rate at which the mouse wheel interactions are translated camera dolly movement. */ mouseWheelDollySpeedParam: NumberParameter; /** * @member walkSpeedParam - TODO */ walkSpeedParam: NumberParameter; /** * @member walkModeCollisionDetection - TODO */ walkModeCollisionDetection: BooleanParameter; /** * Create a camera, mouse and keyboard * @param appData - The object containing the scene and the renderer. */ constructor(appData: Record); /** * Enables tools usage. */ activateTool(): void; /** * Disables tool usage. */ deactivateTool(): void; /** * Sets default manipulation mode. * The value can be on of the keys in #CameraManipulator.MANIPULATION_MODES * * @param manipulationMode - The manipulation mode value. */ setDefaultManipulationMode(manipulationMode: string | number): void; /** * The look method. * @param event - The event value. * @param dragVec - The drag vector value. */ look(event: Record, dragVec: Vec2): void; /** * Rotates viewport camera about the target. * * @param event - The event value. * @param dragVec - The drag vector value. */ turntable(event: Record, dragVec: Vec2): void; /** * Rotates viewport camera about the target. * * @param event - The event value. * @param dragVec - The drag vector value. */ tumbler(event: Record, dragVec: Vec2): void; /** * Rotates viewport camera about the target. * * @param event - The event value. * @param dragVec - The drag vector value. */ trackball(event: Record, dragVec: Vec2): void; /** * Rotates the camera around its own `X`,`Y` axes. * * @param event - The event value. * @param dragVec - The drag vector value. */ pan(event: Record, dragVec: Vec2): void; /** * Dollying moves the camera forward at a constant speed, not changing the focal distance. * @param event - The event value. * @param dragVec - The drag vector value. */ dolly(event: ZeaPointerEvent, pointerPos: Vec2, dragVec: Vec2): void; /** * Zooms the camera towards the target. * @param event - The event value. * @param dragVec - The drag vector value. */ zoom(event: ZeaPointerEvent, dragStartPos: Vec2, dragVec: Vec2): void; /** * The initDrag method. * * @private * @param event - The event value. */ initDrag(event: ZeaPointerEvent): void; /** * The initDrag method. * * @private * @param event - The event value. */ endDrag(event: Record): void; /** * The aimFocus method. * * @private * @param camera - The camera that we are aiming * @param target - The target to focus on. * @param distance - The distance from the target to get to. * @param duration - The duration in milliseconds to aim the focus. */ aimFocus(camera: Camera, target: Vec3, distance?: number, duration?: number): void; /** * The orientPointOfView method. * * @private * @param camera - The camera that we are orienting * @param position - The target to focus on. * @param target - The target to focus on. * @param distance - The distance to the specified we want the user to be moved to * @param duration - The duration in milliseconds to aim the focus. */ orientPointOfView(camera: Camera, position: Vec3, target: Vec3, distance?: number, duration?: number): void; /** * Invoked when a user double presses a pointer over an element. * * @param event - The pointer event that occurs * @memberof CameraManipulator */ onPointerDoubleClick(event: ZeaPointerEvent): void; /** * Event fired when either the mouse button is pressed, or a touch start event occurs. * * @param event - The mouse event that occurs. */ onPointerDown(event: ZeaPointerEvent): void; /** * Event fired when either the mouse cursor is moved, or a touch point moves. * * @param event - The mouse event that occurs. */ onPointerMove(event: ZeaPointerEvent): void; /** * The event that occurs when the user moves the pointer across a screen. * * @param event -The event value */ _onMouseMove(event: ZeaMouseEvent): void; /** * The event that occurs when the user moves pointer across a touch screen. * * @param event - The touch event that occurs. * @private */ _onTouchMove(event: ZeaTouchEvent): void; /** * Event fired when either the mouse button is released, or a touch end event occurs. * * @param event - The mouse event that occurs. */ onPointerUp(event: ZeaPointerEvent): void; /** * Causes an event to occur when the mouse pointer is moved out of this viewport * @param event - The event that occurs. */ onPointerLeave(event: ZeaPointerEvent): void; /** * Invoked when the mouse wheel is rolled up or down over an element. * * @param event - The wheel event that occurs. */ onWheel(event: ZeaWheelEvent): void; /** * The integrateVelocityChange method. * @param event - The event value. * @private */ integrateVelocityChange(event: Record): void; /** * Invoked when the user is pressing a key on the keyboard. * * @param event - The keyboard event that occurs. */ onKeyDown(event: ZeaKeyboardEvent): void; /** * Invoked when the user releases a key on the keyboard. * * @param event - The event that occurs. */ onKeyUp(event: ZeaKeyboardEvent): void; /** * The __startTouch method. * @param touch - The touch value. * @private */ __startTouch(touch: Touch): void; /** * The __endTouch method. * @param touch - The touch value. * @private */ __endTouch(touch: Touch): void; /** * Invoked when the user touches an element on a touch screen. * @private * @param event - The touch event that occurs. */ _onTouchStart(event: ZeaTouchEvent): void; /** * Invoked when the user removes his/her finger from the touch pad. * * @param event - The touch event that occurs. */ onTouchEnd(event: ZeaTouchEvent): void; /** * Invoked when the touch event gets interrupted. * * @param event - The touch event that occurs. */ onTouchCancel(event: ZeaTouchEvent): void; /** * Returns a dictionary of support manipulation modes. * * @param event - The touch event that occurs. */ static get MANIPULATION_MODES(): Record; } /** ProxyGeometries are pupulated from data unpacked using a webworker while loading zcad files. * These geometries represent readonly geometries with very basic topologies. * @extends EventEmitter * @private */ declare class BaseProxy extends EventEmitter { protected name: string; protected buffers: GeomBuffers; protected boundingBox: Box3; numVertices: number; libraryIndex: number; /** * Create a base proxy. * @param data - The data value. */ constructor(data?: any); get positions(): AttrBuffer; /** * Returns the number of vertex attributes. * * @return - The return value. */ getNumVertices(): number; /** * Returns the bounding box for geometry. * @return - The return value. */ getBoundingBox(): Box3; /** * The genBuffers method. * @return - The return value. */ genBuffers(): GeomBuffers; /** * Once the buffers have been uploaded to the GPU, we are free to release them. * The GLGeomLibrary may call this function to let the geometry know it can release any handles. */ freeBuffers(): void; /** * The toJSON method encodes this type as a json object for persistence. * * @param context - The context value. * @return - Returns the json object. */ toJSON(context?: Record): Record; /** * The fromJSON method decodes a json object for this type. * * @param json - The json object this item must decode. * @param context - The context value. */ fromJSON(json: Record, context?: AssetLoadContext): void; } /** Class representing a points proxy. * @extends BaseProxy * @private */ declare class PointsProxy extends BaseProxy { /** * Create a points proxy. * @param data - The data value. */ constructor(data: any); } /** Class representing a lines proxy. * @extends BaseProxy * @private */ declare class LinesProxy extends BaseProxy { numLineSegments: number; /** * Create a lines proxy. * @param data - The data value. */ constructor(data: any); /** * Returns the number line segments in this lines proxy geometry * * @return - The return value. */ getNumLineSegments(): number; } /** Class representing a mesh proxy. * @extends BaseProxy * @private */ declare class MeshProxy extends BaseProxy { numTriangles: number; /** * Create a mesh proxy. * @param data - The data value. */ constructor(data: any); /** * Returns the number of triangles in this mesh proxy geometry. * * @return - The return value. */ getNumTriangles(): number; } interface StreamInfo { total: number; done: number; } /** Class representing a geometry library. */ declare class GeomLibrary extends EventEmitter { protected assetItem: AssetItem; protected listenerIDs: Record; protected streamInfos: Record; protected genBuffersOpts: Record; protected loadContext?: AssetLoadContext; protected numGeoms: number; protected numGeomFiles: number; protected geoms: Array; protected basePath: string; protected loadedCount: number; /** * Create a geom library. */ constructor(assetItem: AssetItem); /** * The returns true if all the geometries have been loaded and the loaded event has already been emitted. * @return - True if all geometries are already loaded, else false. */ isLoaded(): boolean; /** * Loads a single geometry file for this GeomLibrary. * * @private * * @param geomFileID - The index of the file to load * @param incrementProgress - If true, the progress bar is incremented and decremented. * @return the promise resolves once the file is loaded, but not parsed. */ loadGeomFile(geomFileID: number, incrementProgress?: boolean): Promise; /** * Loads the geometry files for this GeomLibrary. * @param geomLibraryJSON - The json data describing the data needed to be loaded by the geom library * @param basePath - The base path of the file. (this is theURL of the zcad file without its extension.) * @param context - The value param. */ loadGeomFilesStream(geomLibraryJSON: Record, basePath: string, context: AssetLoadContext): void; /** * The setGenBufferOption method. * @param key - The key value. * @param value - The value param. */ setGenBufferOption(key: string, value: any): void; /** * The setNumGeoms method. * @param expectedNumGeoms - The expectedNumGeoms value. */ setNumGeoms(expectedNumGeoms: number): void; /** * Returns the number of geometries the GeomLibrary has, or will have at the end of loading. * @return - The number of geometries. */ getNumGeoms(): number; /** * The getGeom method. * @param index - The index value. * @return - The stored geometry */ getGeom(index: number): BaseProxy; /** * The getGeom method. * @param index - The index value. * @return - The stored geometry */ setGeom(index: number, geom: BaseProxy): void; /** * The readBinaryBuffer method. * @param geomFileID - The key value. * @param buffer - The buffer value. * @param context - The context value. */ readBinaryBuffer(geomFileID: number, buffer: ArrayBuffer, context: AssetLoadContext): void; /** * The receiveGeomDatas method. * @private * @param data - The data received back from the web worker * @return - returns true once all data for this geom library has been loaded. */ receiveGeomDatas(results: object): boolean; /** * The toJSON method encodes this type as a json object for persistence. * @return - Returns the json object. */ toJSON(): Record; /** * The toString method. * @return - The return value. */ toString(): string; /** * */ loadMetadata(data: Uint8Array, context: AssetLoadContext): void; } /** * Represents a TreeItem with rendering and material capabilities. * * @extends TreeItem */ declare class AssetItem extends TreeItem { geomLibrary: GeomLibrary; materialLibrary: MaterialLibrary; loaded: boolean; engineDataVersion?: Version; unitsScale: number; units: string; /** * Create an asset item. * @param name - The name of the asset item. */ constructor(name?: string); /** * Loads all the geometries and metadata from the asset file. * @param url - The URL of the asset to load * @return - Returns a promise that resolves once the initial load is complete */ load(url: string): Promise; /** * Returns the loaded status of current item. * * @return - Returns true if the asset has already loaded its data. */ isLoaded(): boolean; /** * Returns the zea engine version as an array with major, minor, patch order. * * @return - The return value. */ getEngineDataVersion(): Version | undefined; /** * Returns asset `GeomLibrary` that is in charge of rendering geometry data using workers. * * @return - The return value. */ getGeometryLibrary(): GeomLibrary; /** * Returns `MaterialLibrary` that is in charge of storing all materials of current Item. * * @return - The return value. */ getMaterialLibrary(): MaterialLibrary; /** * The readBinary method. * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context: AssetLoadContext): void; /** Checks if this item or its subtree have finished loading their geometries. */ haveGeomsLoaded(): boolean; /** * The toJSON method encodes this type as a json object for persistence. * * @param context - The context value. * @return - Returns the json object. */ toJSON(context?: Record): Record; /** * The fromJSON method decodes a json object for this type. * * @param j - The json object this item must decode. * @param context - The context value. */ fromJSON(j: Record, context?: AssetLoadContext): void; /** * The clone method constructs a new tree item, copies its values * from this item and returns it. * * @param context - The context value. * @return - Returns a new cloned tree item. */ clone(context?: CloneContext): TreeItem; /** * Copies current TreeItem with all its children. * * @param src - The tree item to copy from. * @param context - The context value. */ copyFrom(src: AssetItem, context?: CloneContext): void; } /** * Provides a context for loading assets. This context can provide the units of the loading scene. * E.g. you can specify the scene units as 'millimeters' in the context object. * To load external references, you can also provide a dictionary that maps filenames to URLs that are used * to resolve the URL of an external reference that a given asset is expecting to find. */ declare class CloneContext extends EventEmitter { assetItem: AssetItem; /** * Create a AssetLoadContext * @param context The source context to base this context on. */ constructor(); } /** * Base class for Items in the scene. It can be parameterized and can emit events. * * **Events** * * **nameChanged:** Emitted every time the Item's name is change. mostly in `setName` method. * * **selectedChanged:** Emitted `selected` status changes, mostly in `setSelected` method. * * @extends {EventEmitter} */ declare class BaseItem extends EventEmitter { protected __name: string; protected __ownerItem: BaseItem | undefined; protected __selectable: boolean; protected __selected: boolean; protected __metaData: Record; /** * Create a base item by defining its name. * * @param name - The name of the base item. */ constructor(name?: string); /** * The getNumBaseItems method returns the total number of base items created. * This method is used in debugging memory consumption. * * @return - Returns the total number of base items created. */ static getNumBaseItems(): number; /** * Returns the name of the base item. * * @return - Returns the base item name. */ get name(): string; /** * Sets the name of the base item(Updates path). * * @emits `nameChanged` with `newName` and `oldName` data. * @param name - The base item name. */ set name(value: string); /** * Returns the current path of the item in the tree as an array of names. * * @return - Returns an array. */ get path(): string[]; /** * Returns the name of the base item. * * @return - Returns the base item name. */ getName(): string; /** * Sets the name of the base item(Updates path). * * @emits `nameChanged` with `newName` and `oldName` data. * @param name - The base item name. */ setName(name: string): void; /** * Returns the current path of the item in the tree as an array of names. * * @return - Returns an array. */ getPath(): string[]; /** * The resolvePath method traverses the subtree from this item down * matching each name in the path with a child until it reaches the * end of the path. * * @param path - The path value. * @param index - The index value. * @return - The return value. */ resolvePath(path: string[], index?: number): BaseItem; /** * The getOwner method returns the current owner of the item. * The item is a child of the current owner. * * @return - Returns the current owner. */ getOwner(): BaseItem | undefined; /** * The setOwner method assigns a new owner to the item. * * @param ownerItem - The new owner item. */ setOwner(ownerItem: BaseItem | undefined): void; /** * Returns a boolean indicating if this item is selectable. * * @return - Returns a boolean indicating if the item is selectable. */ isSelectable(): boolean; /** * Modifies the selectability of this item. * * @param val - A boolean indicating the selectability of the item. * @return - Returns true if value changed. */ setSelectable(val: boolean): boolean; /** * The isSelected method. * @return - The return value. */ isSelected(): boolean; /** * Changes the current state of the selection of this item. * * @emits `selectedChanged` with selected state * @param sel - Boolean indicating the new selection state. */ setSelected(sel: boolean): void; /** * Gets Item's meta-data value by passing the `key` string. * * @param key - The key value under which to check for metadata. * @return - Returns the metadata associated with the given key. */ getMetadata(key: string): Record; /** * Checks to see if there is metadata for a given key. * * @param key - The key value under which to check for metadata. * @return - Returns `true` if metadata exists under the given key, otherwise returns `false`. */ hasMetadata(key: string): boolean; /** * Assigns metadata to a given key. * * @param key - The key value under which the metadata is is going to be saved. * @param metaData - The metaData value. */ setMetadata(key: string, metaData: any): void; /** * Removes metadata for a given key. * * @param key - The key value. */ deleteMetadata(key: string): void; /** * Encodes the current object as a json object. * * @param context - The context value. * @return - Returns the json object. */ toJSON(context?: Record): Record; /** * Decodes a json object for this type. * * @param json - The json object this item must decode. * @param context - The context value. */ fromJSON(json: Record, context?: Record): void; /** * Sets state of current Item(Including parameters) using a binary reader object. * * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context: AssetLoadContext): void; /** * Converts object's JSON value and converts it to a string. * @param context * @return - String of object's parameter list state. */ toString(context: Record): string; /** * Clones this base item and returns a new base item. * * **Note:** Each class should implement clone to be clonable. * @param context - The context value. */ clone(context?: CloneContext): BaseItem; /** * When a BaseItem is cloned, initially the constructor is * called to generate a new instance. This instance then copies * its values from the source using this method. * This method copies any relevant data from the source object to * ensure that it represents a valid clone. * Derived classes override this method to copy any relevant * data from the source object. * * @param src - The BaseItem to copy from. * @param context - The context value */ copyFrom(src: BaseItem, context?: CloneContext): void; } /** * Class that allows other classes to be parameterized by `Parameter` type of objects. * Not only hosting parameters, but their events. * * @extends {BaseItem} */ declare class ParameterOwner extends BaseItem { protected paramEventListenerIDs: Record; protected paramMapping: Record; params: Parameter[]; deprecatedParamMapping: Record; /** * Creates an instance of ParameterOwner by initializing parameter hosting mappings and events. * * Every Object has a unique identifier which is based on a counter that is incremented. */ constructor(name?: string); /** * Returns the number of parameters current object has. */ getNumParameters(): number; /** * Returns the number of parameters current object has. */ get numParameters(): number; /** * Returns all the parameters of the object. * * @return - Parameter List */ getParameters(): Parameter[]; /** * Returns the index of a parameter in parameter list. * * @param paramName - Name of the parameter. * @return - Position in the array */ getParameterIndex(paramName: string): number; /** * Returns `Parameter` object in a given index * * @param index - Position of the parameter in the array * @return - Parameter object value */ getParameterByIndex(index: number): Parameter; /** * Validates if the specified parameter exists in the object. * * @param paramName - The parameter name. * @return - The return value. */ hasParameter(paramName: string): boolean; /** * Add a mapping from one name to a new parameter. * This is used to handle migrating parameters to new names. * * @param key - The parameter name. * @param paramName - The parameter name. * @return - The return value. */ addParameterDeprecationMapping(key: string, paramName: string): void; /** * Returns `Parameter` object using the given name * * @param paramName - The parameter name. * @return - Parameter object value */ getParameter(paramName: string): Parameter | null; /** * This method can be overridden in derived classes * to perform general updates (see GLPass or BaseItem). * @param event - The event object emitted by the parameter. * @private */ protected parameterValueChanged(event: Record): void; /** * Adds `Parameter` object to the owner's parameter list. * * @emits `parameterAdded` with the name of the param. * @param param - The parameter to add. * @return - With `owner` and `valueChanged` event set. */ addParameter(param: Parameter): Parameter; /** * Adds `Parameter` object to the owner's parameter list using the index. * It replaces the event in the specified index. * * * @emits `parameterAdded` with the name of the param. * @param param - The parameter to insert. * @param index - The index value. * @return - With `owner` and `valueChanged` event set. */ insertParameter(param: Parameter, index: number): Parameter; /** * Removes `Parameter` from owner, by using parameter's name. * @emits `parameterRemoved` with the name of the param. * @param name - The parameter name. */ removeParameter(name: string): void; /** * Replaces old `Parameter` by passing a new one with the same name. * * @param param - The parameter to replace. * @return - `Parameter` with `valueChanged` event set. */ replaceParameter(param: Parameter): Parameter; /** * The resolvePath method traverses the subtree from this item down * matching each name in the path with a child until it reaches the * end of the path. * * @param path - The path value. * @param index - The index value. * @return - The return value. */ resolvePath(path: string[], index?: number): BaseItem | null; /** * The toJSON method encodes this type as a json object for persistence. * * @param context - The context value. * @return - Returns the json object. */ toJSON(context?: Record): Record; /** * The fromJSON method decodes a json object for this type. * * @param json - The json object this item must decode. * @param context - The context value. */ fromJSON(json: Record, context?: Record): void; /** * Uses passed in BinReader object(containing an Int32 array with all the parameters) to reconstruct all parameters state. * * In each iteration of the array, propType and propName are extracted and * used to build the right `Parameter` class. Then all of them are added to the object. * * @emits `parameterAdded` with the name of the param. * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context: AssetLoadContext): void; private readBinaryParams; /** * Clones this base item and returns a new base item. * * **Note:** Each class should implement clone to be clonable. * @param context - The context value. */ clone(context?: CloneContext): ParameterOwner; /** * Copies Parameters from another `ParameterOwner` to current object. * * @param src - The ParameterOwner copy from. * @param context - The context value */ copyFrom(src: ParameterOwner, context?: CloneContext): void; } /** * Represents a reactive type of attribute that can be owned by a `ParameterOwner` class. * * **Events** * * **nameChanged:** Triggered when the name of the parameter changes. * * **valueChanged:** Triggered when the value of the parameter changes. */ declare abstract class Parameter extends BaseItem { protected dirty: boolean; protected boundInputs: OperatorInput[]; protected boundOutputs: OperatorOutput[]; protected cleaning: boolean; protected dirtyOpIndex: number; protected firstOP_WRITE: number; protected __value: T; protected dataType: string; protected ownerItem?: ParameterOwner; /** * When initializing a new parameter, the passed in value could be anything. * If it is a new type of value, just ensure you register it in the `Registry`. * * How to use it: * * ```javascript * // Creating a parameter object * const param = new Parameter('Title', 'Awesome Parameter Value', 'String') * * // Capturing events * param.on('valueChanged', (...params) => console.log('Value changed!')) * * // Changing parameter's value will cause `valueChanged` event to trigger. * param.setValue('A New Awesome Parameter Value') * // As result the console log code will execute: Value Changed! * ``` * * @param name - The name of the parameter. * @param value - The value of the parameter. * @param dataType - The data type of the parameter. */ constructor(name: string, value: T, dataType: string); /** * Returns the owner item of the current parameter. * * @return - The return value. */ getOwner(): ParameterOwner; /** * Sets the owner item of the current parameter. * * @param ownerItem - The ownerItem value. */ setOwner(ownerItem: ParameterOwner): void; /** * Returns parameter's data type. * * @return - The return value. */ getDataType(): string; /** * When an Operator is reading from a parameter, it must be dirtied when the parameter value * changes. The Parameter maintains a list of bound inputs and will propagate dirty to * them explicitly. * * @param operatorInput - The output that we are unbinding from the Parameter * @param index - The index(optional) that the output is being bound at. * @return - The index of the bound output. */ bindOperatorInput(operatorInput: OperatorInput): void; /** * When an operator is being removed from reading from a Parameter, the Input is removed * This means the operator will no longer receive updates when the operator changes. * * @param operatorInput - The output that we are unbinding from the Parameter * @return - The return value. */ unbindOperatorInput(operatorInput: OperatorInput): void; /** * When an Operator writes to a parameter, it binds its outputs to the parameter at a given * index. Then when the operator is dirtied by one of its inputs, it explicitly dirties * the output parameters. * * @param operatorOutput - The output that we are unbinding from the Parameter * @param index - The index(optional) that the output is being bound at. * @return - The index of the bound output. */ bindOperatorOutput(operatorOutput: OperatorOutput, index?: number): number; /** * When an operator is unbinding from a parameter, it removes its self from the list maintained * by the parameter. * * @param operatorOutput - The output that we are unbinding from the Parameter * @return - The return value. */ unbindOperatorOutput(operatorOutput: OperatorOutput): number; /** * Find the first operator in our stack which writes using an OP_WRITE connection. * All operators before this op can be ignored during dirty propagation. * @private */ private __findFirstOP_WRITE; isDrivenByOperator(): boolean; /** * Dirties this Parameter so subsequent calls to `getValue` will cause an evaluation of its bound operators. * * @param index - Index of the operator * @return - `true` if the Parameter was made dirty, else `false` if it was already dirty. */ setDirty(index: number): boolean; /** * Returns true if this parameter is currently dirty and will evaluate its bound * operators if its value is requested by a call to getValue. * * @return - Returns a boolean. */ isDirty(): boolean; /** * Returns the index of the first 'dirty' binding in the stack. This will be the index of the * first operator that will evaluate when the parameter needs to be cleaned. * * @return - The index of the dirty binding in the binding stack. */ getDirtyBindingIndex(): number; /** * The setCleanFromOp method. * @param value - The computed value to be stored in the Parameter. * @param index - The index of the bound OperatorOutput. */ setCleanFromOp(value: T, index: number): void; /** * During operator evaluation, operators can use this method to retrieve the existing * value of one of their outputs. * @param index - The index of the bound OperatorOutput to evaluate up to. * @return - The return value. */ getValueFromOp(index: number): T | undefined; /** * Cleans the parameter up tp the index of the specified index of the bound OperatorOutput * * @param index - The index of the bound OperatorOutput to evaluate up to. */ _clean(index: number): void; /** * Returns parameter's value. * @return - The return value. */ getValue(): T; /** * Sets value of the parameter. * * @param value - The value param. */ setValue(value: T): void; get value(): T; set value(value: T); /** * The loadValue is used to change the value of a parameter, without triggering a * valueChanges. * * @param value - The context value. */ loadValue(value: T): void; abstract toJSON(context?: Record): Record; abstract fromJSON(j: Record, context?: Record): void; abstract clone(): Parameter; copyFrom(src: Parameter, context?: CloneContext): void; /** * The readBinary method. * * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context?: AssetLoadContext): void; /** * Returns the parameter's path as an array of strings. * Includes owner's path in case it is owned by a `ParameterOwner`. * * @return - The return value. */ getPath(): string[]; resolvePath(path: string[], index?: number): BaseItem | null; /** * The readBinary method. * * @param reader - The reader value. * @param context - The context value. */ destroy(): void; } /** * Represents a specific type of parameter, that only stores `boolean` values. * * i.e.: * ```javascript * const booleanParam = new BooleanParameter('MyBoolean', true) * //'myParameterOwnerItem' is an instance of a 'ParameterOwner' class. * // Remember that only 'ParameterOwner' and classes that extend from it can host 'Parameter' objects. * myParameterOwnerItem.addParameter(booleanParam) * ``` * @extends Parameter */ declare class BooleanParameter extends Parameter implements IBinaryReader { /** * Creates a new parameter with `Boolean` data type. * * @param name - The name of the boolean parameter. * @param value - The value of the parameter. */ constructor(name?: string, value?: boolean); setValue(value: boolean): void; /** * Loads the boolean values from the binary buffer. * * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context?: AssetLoadContext): void; /** * The toJSON method serializes this instance as a JSON. * It can be used for persistence, data transfer, etc. * * @param context - The context value. * @return - Returns the json object. */ toJSON(context?: Record): Record; /** * The fromJSON method takes a JSON and deserializes into an instance of this type. * * @param j - The json object this item must decode. * @param context - The context value. */ fromJSON(j: Record, context?: Record): void; /** * The clone method constructs a new parameter, copies its values * from this parameter and returns it. * * @return - Returns a new cloned parameter. */ clone(): BooleanParameter; } /** * Represents a specific type of parameter, that only stores `Box3` values. * * i.e.: * ```javascript * const boundingBox = new BoundingBoxParameter('MyBBox', new TreeItem()) * //'myParameterOwnerItem' is an instance of a 'ParameterOwner' class. * // Remember that only 'ParameterOwner' and classes that extend from it can host 'Parameter' objects. * myParameterOwnerItem.addParameter(boundingBox) * ``` * @extends Parameter */ declare class BoundingBoxParameter extends Box3Parameter { protected treeItem: TreeItem; protected dirty: boolean; /** * Creates an instance of BoundingBoxParameter. * @param name - Name of the parameter * @param treeItem - `TreeItem` that contains `Box3` representing the Bounding Box */ constructor(name?: string, treeItem?: TreeItem); /** * Makes parameter value be dirty, so when `getValue` is called, * an evaluation is then executed to re-calculate the BoundingBox * * @memberof BoundingBoxParameter */ setDirty(index: number): boolean; /** * Returns bounding box value * * @return - The return value. */ getValue(): Box3; clone(): BoundingBoxParameter; /** * We do not want this parameter serialized. */ isDrivenByOperator(): boolean; /** * The loadValue is used to change the value of a parameter, without triggering a * valueChanges, or setting the USER_EDITED state. * * @param value - The context value. */ loadValue(value: Box3): void; } /** * Class representing an Item in the scene tree with hierarchy capabilities (has children). * It has the capability to add and remove children. * **Parameters** * * **Visible(`BooleanParameter`):** Shows/Hides the item. * * **LocalXfo(`XfoParameter`):** Specifies the offset of this tree item from its parent. * * **GlobalXfo(`XfoParameter`):** Provides the computed world Xfo of this tree item. * * **BoundingBox(`BoundingBox`):** Provides the bounding box for the tree item and all of its children in the 3d scene. * * **Events** * * **globalXfoChanged:** Emitted when the value of GlobalXfo parameter changes. * * **visibilityChanged:** Emitted when the visibility on the tree item changes. * * **highlightChanged:** Emitted when the highlight on the tree item changes. * * **childAdded:** Emitted when a item is added as a child. * * **childRemoved:** Emitted when an item is removed from the child nodes. * * **pointerDown:** Emitted when a pointerDown event happens in an item. * * **pointerUp:** Emitted when a pointerUp event happens in an item. * * **pointerMove:** Emitted when a pointerMove event happens in an item. * * **pointerEnter:** Emitted when a pointerEnter event happens in an item. * * **pointerClick:** Emitted when a pointer is clicked on an item. * * **pointerDoubleClick:** Emitted when a pointer is double-clicked on an item. * * **pointerLongPress:** Emitted when a pointer is clicked and held on an item for a long time. * * * @extends {ParameterOwner} */ declare class TreeItem extends ParameterOwner { disableBoundingBox: boolean; protected __childItems: TreeItem[]; protected __childItemsEventHandlers: Array>; private childItemsMapping; protected childItemsMappingCorrupt: boolean; /** * @member globalXfoParam - Stores the global Xfo for this tree item. * global xfos are calculated from the localXfo and parentXfo. */ globalXfoParam: XfoParameter; /** * @member localXfoParam - Stores the local Xfo for this tree item. * local Xfos are the offset from the parent's coordinate frame. */ localXfoParam: XfoParameter; /** * @member boundingBoxParam - Stores the bounding box for this tree item */ boundingBoxParam: BoundingBoxParameter; /** * @member visibleParam - Whether this tree item is visible or not. * Any given tree item is also is affected by parent's visibility. */ visibleParam: BooleanParameter; /** * @member opacityParam - Controls, in combination with Material transparency, * the opacity of this item and its children. */ opacityParam: NumberParameter; protected highlightMapping: Record; protected highlights: Array; protected __visible: boolean; private visibleCounter; opacity: number; private inheritedOpacityValues; protected globalXfoOp: Operator; /** * Creates a tree item with the specified name. * * @param name - The name of the tree item. It's the identifier of the tree item. * It's an identifier intended to be human readable. * It's included in the path that we use to access a particular item. * It's used to display it in the tree. */ constructor(name?: string); /** * Sets the owner (another TreeItem) of the current TreeItem. * @param parentItem - The parent item. */ setOwner(parentItem: TreeItem): void; /** * Returns the parent of current TreeItem. * * @return - Returns the parent item. */ getParentItem(): TreeItem | undefined; /** * Sets the parent of current TreeItem. * * @param parentItem - The parent item. */ setParentItem(parentItem: TreeItem): void; get parent(): TreeItem | undefined; set parent(treeItem: TreeItem | undefined); /** * Returns visible parameter value for current TreeItem. * * @return - The visible param value. */ isVisible(): boolean; /** * Sets visible parameter value. * * @param val - The val param. */ setVisible(visible: boolean): void; /** * Updates current TreeItem visible state and propagates its value to children elements. * * @param val - The val param. */ propagateVisibility(val: number): void; /** * The updateVisibility method. * @return - Returns a boolean. */ protected updateVisibility(): boolean; /** * Returns the current status of the opacity value. * * @return - Returns true if the opacity value is less than 1. */ isOpaque(): boolean; /** * Set the value of opacity inherited by a given tree item. */ setInheritedOpacity(parent: TreeItem, value: number): void; /** * Calculates the new opacity value based on the opacityParam value * and the lowest of the inherited opacity values. */ protected updateOpacity(): void; /** * Adds a highlight to the tree item. * * @param name - The name of the tree item. * @param color - The color of the highlight. * @param propagateToChildren - A boolean indicating whether to propagate to children. */ addHighlight(name: string, color: Color, propagateToChildren?: boolean): void; /** * Removes a highlight to the tree item. * * @param name - The name of the tree item. * @param propagateToChildren - A boolean indicating whether to propagate to children. */ removeHighlight(name: string, propagateToChildren?: boolean): void; /** * Returns the color of the current highlight. * * @return - The color value. */ getHighlight(): Color; /** * Returns the name of the current highlight. * * @return - The color value. */ getHighlightName(): string; /** * Returns `true` if this items has a highlight color assigned. * * @return - `True` if this item is highlighted. */ isHighlighted(): boolean; /** * The _cleanBoundingBox method. * @param bbox - The bounding box value. * @return - The return value. * @private */ _cleanBoundingBox(): Box3; /** * The setBoundingBoxDirty method. * @private */ protected setBoundingBoxDirty(): void; /** * Returns children list, but children are not required to have hierarchy structure(`TreeItem`). * Meaning that it could be another kind of item than `TreeItem`. * * i.e. **BaseImage** * * @return - List of `TreeItem` owned by current TreeItem. */ getChildren(): TreeItem[]; /** * Returns the number of child tree items. */ getNumChildren(): number; /** * Returns the number of child tree items. */ get numChildren(): number; /** * Apply an index to the name if name exists within this item's children. * * @param name - The name value. * @return - Returns a unique name. */ generateUniqueName(name: string): string; /** * Updates the internal acceleration structure that speeds up looking up children by name. * @param start - The start value. * @private */ protected updateChildNameMapping(start: number): void; /** * When a child's name changed, we update our acceleration structure. * @param event - The start value. * @private */ private childNameChanged; /** * Inserts a child. It accepts all kind of `TreeItem`, not only `TreeItem`. * * @param childItem - The child TreeItem to insert. * @param index - The index to add the child item. * @param maintainXfo - Boolean that determines if the Xfo value is maintained. * @param fixCollisions - Modify the name of the item to avoid name collisions. * If false, an exception wll be thrown instead if a name collision occurs. * @return - The index of the child item in this items children array. */ insertChild(childItem: TreeItem, index: number, maintainXfo?: boolean, fixCollisions?: boolean): TreeItem; /** * Adds a child. * * @param childItem - The child TreeItem to add. * @param maintainXfo - Boolean that determines if * the Global Xfo value is maintained. If true, when moving * items in the hierarchy from one parent to another, the local Xfo * of the item will be modified to maintain and the Global Xfo. * Note: this option defaults to false because we expect that is the * behavior users would expect when manipulating the tree in code. * To be safe and unambiguous, always try to specify this value. * @param fixCollisions - Modify the name of the item to avoid * name collisions with other children of the same parent. * If false, an exception wll be thrown instead if a name collision occurs. * @return childItem - The child TreeItem that was added. */ addChild(childItem: TreeItem, maintainXfo?: boolean, fixCollisions?: boolean): TreeItem; /** * Returns child element in the specified index. * * @param index - The index to remove the child TreeItem. * @return - Return the child TreeItem. */ getChild(index: number): TreeItem; /** * Returns child element with the specified name. * * @param name - The name value. * @return - Return the child TreeItem. */ getChildByName(name: string): TreeItem | null; /** * Returns children names as an array of strings. * * @return - An array of names for each child. */ getChildNames(): string[]; /** * UnBind an item from the group. This method is called * automatically when an item is removed from the group. * @param index - The index value. * @param childItem - item to unbind. * @private */ protected unbindChild(index: number, childItem: TreeItem): void; /** * Removes a child TreeItem by specifying its index. * * @param index - The index value. */ removeChild(index: number): void; /** * Removes a child TreeItem by specifying its name. * * @param name - The name param. * @return - Return the child TreeItem. */ removeChildByName(name: string): void; /** * Removes the provided item from this TreeItem if it is one of its children. * An exception is thrown if the item is not a child of this tree item. * * @param childItem - The child TreeItem to remove. */ removeChildByHandle(childItem: TreeItem): void; /** * Removes all children Items. */ removeAllChildren(): void; /** * Returns index position of the specified item. * * @param childItem - The child TreeItem value. * @return - Child index in children array. */ getChildIndex(childItem: TreeItem): number; /** * The resolvePath method traverses the subtree from this item down * matching each name in the path with a child until it reaches the * end of the path. * * @param path - The path value. * @param index - The index value. * @return - The return value. */ resolvePath(path: string[], index?: number): BaseItem | Parameter | null; /** * Traverse the tree structure from this point down * and fire the callback for each visited item. * Note: Depth only used by selection sets for now. * * @param callback - The callback value. * @param includeThis - Fire the callback for this item. */ traverse(callback: (treeItem: TreeItem, depth: number) => unknown, includeThis?: boolean): void; /** * Called by the Viewport when events are received by the canvas element. * The event is propagated to a TreeItem if it is under the pointer at the time. * The ZeaPointerEvent abstracts the Mouse, touch and our custom XR events. * This method emits the ZeaPointerEvent with the key 'pointerDown', and * propagates it up to the TreeItem's owner. * * @param event - The event value */ onPointerDown(event: ZeaPointerEvent): void; /** * Called by the Viewport when events are received by the canvas element. * The event is propagated to a TreeItem if it is under the pointer at the time. * The ZeaPointerEvent abstracts the Mouse, touch and our custom XR events. * This method emits the ZeaPointerEvent with the key 'pointerDown', and * propagates it up to the TreeItem's owner. * * @param event - The pointer event that was generated from the user interaction */ onPointerUp(event: ZeaPointerEvent): void; /** * Called by the Viewport when events are received by the canvas element. * The event is propagated to a TreeItem if it is under the pointer at the time. * The ZeaPointerEvent abstracts the Mouse, touch and our custom XR events. * This method emits the ZeaPointerEvent with the key 'pointerMove', and * propagates it up to the TreeItem's owner. * * @param event - The pointer event that was generated from the user interaction */ onPointerMove(event: ZeaPointerEvent): void; /** * Called by the Viewport when the mouse or other pointer enters the canvas element. * The event is propagated to a TreeItem if it is under the pointer at the time. * The ZeaPointerEvent abstracts the Mouse, touch and our custom XR events. * This method emits the ZeaPointerEvent with the key 'pointerEnter', and * propagates it up to the TreeItem's owner. * * @param event - The pointer event that was generated from the user interaction */ onPointerEnter(event: ZeaPointerEvent): void; /** * Called by the Viewport when the mouse or other pointer leaves the canvas element. * The event is propagated to a TreeItem if it is under the pointer at the time. * The ZeaPointerEvent abstracts the Mouse, touch and our custom XR events. * This method emits the ZeaPointerEvent with the key 'pointerLeave', and * propagates it up to the TreeItem's owner. * * @param event - The pointer event that was generated from the user interaction */ onPointerLeave(event: ZeaPointerEvent): void; /** * Called by the Viewport when the mouse or other pointer is clicked on this item. * * @param event - The pointer event that was generated from the user interaction */ onPointerClick(event: ZeaPointerEvent): void; /** * Called by the Viewport when the mouse or other pointer is double-clicked on this item. * * @param event - The pointer event that was generated from the user interaction */ onPointerDoubleClick(event: ZeaPointerEvent): void; /** * Called by the Viewport when the mouse or other pointer is double-clicked on this item. * * @param event - The pointer event that was generated from the user interaction */ onPointerLongPress(event: ZeaPointerEvent): void; /** * Called by the Viewport when the mouse wheel event is received by the canvas element. * Emits the ZeaWheelEvent with the key 'mouseWheel', and Propagates is up to the TreeItem's owner. * * @param event - The wheel event that occurs. */ onWheel(event: ZeaWheelEvent): void; /** * Called by the Viewport when the touch cancel event is received by the canvas element. * Emits the ZeaTouchEvent with the key 'touchCancel', and Propagates is up to the TreeItem's owner. * * @param event - The wheel event that occurs. */ onTouchCancel(event: ZeaTouchEvent): void; /** * The toJSON method serializes this instance as a JSON. * It can be used for persistence, data transfer, etc. * * @param context - The context value. * @return - Returns the json object. */ toJSON(context?: Record): Record; /** * The fromJSON method takes a JSON and deserializes into an instance of this type. * * @param j - The json object this item must decode. * @param context - The context value. */ fromJSON(j: Record, context?: Record, onDone?: any): void; /** * Sets state of current Item(Including parameters & children) using a binary reader object. * * @param reader - The reader value. * @param context - The context value. */ readBinary(reader: BinReader, context: AssetLoadContext): void; /** * The clone method constructs a new tree item, copies its values * from this item and returns it. * * @param context - The context value. * @return - Returns a new cloned tree item. */ clone(context?: CloneContext): TreeItem; /** * Copies current TreeItem with all its children. * * @param src - The tree item to copy from. * @param context - The context value. */ copyFrom(src: TreeItem, context?: CloneContext): void; } interface GeomItemAndDist { geomItem: TreeItem; componentId: number; dist: number; } declare class IntersectionData { screenPos?: Vec2; pointerRay: Ray; intersectionPos: Vec3; geomData: Float32Array | Uint8Array; geomItem: TreeItem; componentId: number; dist: number; constructor(screenPos: Vec2, pointerRay: Ray, intersectionPos: Vec3, geomData: Float32Array | Uint8Array, geomItemAndDist: GeomItemAndDist); } declare class ChildAddedEvent extends BaseEvent { index: number; childItem: TreeItem; constructor(index: number, childItem: TreeItem); } declare class ControllerAddedEvent extends BaseEvent { controller: XRController; constructor(controller: XRController); } declare class CountChangedEvent extends BaseEvent { change: number; count: number; constructor(change: number, count: number); } declare class EnvMapAssignedEvent extends BaseEvent { envMap: any; constructor(envMap: any); } declare class IndexEvent extends BaseEvent { index: number; constructor(index: number); } declare class NameChangedEvent extends BaseEvent { oldName: string; newName: string; constructor(oldName: string, newName: string); } declare class OpacityStateChangedEvent extends BaseEvent { isOpaque: boolean; isOpaqueStateChanged: boolean; constructor(isOpaque: boolean, isOpaqueStateChanged: boolean); } declare class ParameterAddedEvent extends BaseEvent { name: string; constructor(name: string); } declare class ParameterRemovedEvent extends BaseEvent { name: string; constructor(name: string); } declare class RangeLoadedEvent extends BaseEvent { range: any[]; constructor(range: any[]); } declare class ResizedEvent extends BaseEvent { width: number; height: number; constructor(newWidth: number, newHeight: number); } declare class SceneSetEvent extends BaseEvent { scene: Scene; constructor(scene: Scene); } declare class SelectabilityChangedEvent extends BaseEvent { value: boolean; constructor(value: boolean); } declare class SelectedEvent extends BaseEvent { selected: boolean; constructor(selected: boolean); } declare class ShaderNameChangedEvent extends BaseEvent { shaderName: string; constructor(shaderName: string); } declare class StateChangedEvent extends BaseEvent { state: boolean; constructor(state: boolean); } declare class StreamFileParsedEvent extends BaseEvent { geomFileID: number; geomCount: number; constructor(geomFileID: number, geomCount: number); } declare class TexturedChangedEvent extends BaseEvent { isTextured: boolean; param: Record; constructor(isTextured: boolean, param: Record); } declare class ViewChangedEvent extends BaseEvent { interfaceType: string; viewXfo: Xfo; viewport?: GLBaseViewport; constructor(interfaceType: string, viewXfo: Xfo); } declare class VisibilityChangedEvent extends BaseEvent { visible: boolean; constructor(visible: boolean); } declare class ProgressEvent extends BaseEvent { percent: number; constructor(percent: number); } declare class XRPointerEvent extends ZeaPointerEvent { xfo: Xfo; xrSelectEvent: any; hitTestResults: any; constructor(viewport: XRViewport, xfo: Xfo, xrSelectEvent: any, hitTestResults: any); stopPropagation(): void; setCapture(item: TreeItem | BaseTool): void; getCapture(): TreeItem | BaseTool; releaseCapture(): void; } declare class XRViewChangedEvent extends ViewChangedEvent { hmd: string; controllers: Array; xrviewport?: XRViewport; constructor(viewXfo: Xfo); } declare class XrViewportEvent extends BaseEvent { xrViewport?: XRViewport; constructor(xrViewport: XRViewport); } declare const libsRegistry: LibsRegistry; export { Allocation1D, Allocator1D, AngleParameter, AssetItem, AssetLoadContext, AttrBuffer, Attribute, BaseClass, BaseEvent, BaseGeom, BaseGeomItem, BaseGroup, BaseImage, BaseItem, BaseProxy, BaseTool, BillboardItem, BillboardShader, BinReader, BinWriter, Bindings, BooleanOperatorInput, BooleanOperatorOutput, BooleanParameter, Box2, Box2Parameter, Box3, Box3Parameter, CADAssembly, CADAsset, CADBody, CADPart, Camera, CameraManipulator, ChildAddedEvent, Circle, Color, ColorAttribute, ColorOperatorInput, ColorOperatorOutput, ColorParameter, ColorRenderState, ColorSpace, CompoundGeom, CompoundGeomMaterialGroup, Cone, ControllerAddedEvent, CountChangedEvent, Cross, Cuboid, CuttingPlane, Cylinder, DataImage, Disc, EnvMap, EnvMapAssignedEvent, EnvMapShader, EnvProjectionMaterial, EnvProjectionShader, EulerAngles, EulerAnglesAxisOrder, EventEmitter, FRAMEBUFFER, FatLinesMaterial, FatLinesShader, FatPoints, FatPointsMaterial, FatPointsShader, FileImage, FileImage2D, FlatSurfaceMaterial, FlatSurfaceShader, Float32, Float32ArrayParameter, Frustum, GIFImage, GLAttrBuffer, GLAttrDesc, GLBaseRenderer, GLBaseViewport, GLBillboardsPass, GLBoundingBoxPass, GLCADPass, GLFbo, GLGeom, GLGeomItem, GLGeomItemChangeType, GLGeomItemFlags, GLGeomItemSet, GLGeomItemSetMultiDraw, GLGeomItemSetMultiDrawCompoundGeom, GLLines, GLLinesItemSet, GLLinesPass, GLMaskGeomsPass, GLMaterial, GLMaterialGeomItemSets, GLMesh, GLMeshItemSet, GLOpaqueGeomsPass, GLOverlayPass, GLPass, GLPoints, GLPointsItemSet, GLRenderTarget, GLRenderer, GLShader, GLShaderGeomSets, GLShaderMaterials, GLStandardGeomsPass, GLTexture2D, GLTransparentGeomsPass, GLViewport, GROUP_XFO_MODES, GeomBuffers, GeomDataRenderState, GeomItem, GeomItemAndDist, GeomLibrary, GeomType, GeometryParameter, GeomsInView, Grid, GridTreeItem, GrowingPacker, HDRImage, HighlightRenderState, IGeomShaderBinding, ImageParameter, ImageParams, IndexDBCache, IndexEvent, InstanceItem, IntersectionData, ItemEvent, ItemSetParameter, JSON, KeyboardEvent, KinematicGroup, LDRImage, LDRVideo, Label, LabelManager, LayoutItem, Lines, LinesCuboid, LinesMaterial, LinesProxy, LinesShader, LinesSphere, ListParameter, Listener, MaskMaterial, Mat3, Mat3OperatorInput, Mat3OperatorOutput, Mat3Parameter, Mat4, Mat4OperatorInput, Mat4OperatorOutput, Mat4Parameter, Material, MaterialColorParam, MaterialFloatParam, MaterialGroup, MaterialLibrary, MaterialParameter, MathFunctions, Mesh, MeshProxy, MultiChoiceParameter, NameChangedEvent, NumberOperatorInput, NumberOperatorOutput, NumberParameter, ObjAsset, OpacityStateChangedEvent, Operator, OperatorInput, OperatorOutput, OperatorOutputMode, PMIItem, PMIView, POINTER_TYPES, Parameter, ParameterAddedEvent, ParameterOwner, ParameterRemovedEvent, PassType, Plane, PlaneType, PointGrid, Points, PointsMaterial, PointsProxy, PointsShader, ProceduralLines, ProceduralMesh, ProceduralPoints, ProgressEvent, Quat, QuatOperatorInput, QuatOperatorOutput, QuatParameter, RGBA, RangeLoadedEvent, Ray, Rect, RefCounted, Registry, RenderState, RendererOptions, ResizedEvent, ResourceLoader, SInt16, SInt32, SInt8, Scene, SceneSetEvent, ScreenQuadShader, ScreenSpaceMaterial, ScreenSpaceShader, SelectabilityChangedEvent, SelectedEvent, SelectionSet, ShaderAttribute, ShaderAttributes, ShaderCompileAttributeAndUniformResult, ShaderCompileResult, ShaderInstanceGeom, ShaderLibrary, ShaderNameChangedEvent, ShaderParseAttribute, ShaderParseResult, ShaderParseUniform, ShaderUniform, ShaderUniforms, Shaderopts, SimpleSurfaceMaterial, SimpleSurfaceShader, Sphere, SphereType, StandardSurfaceMaterial, StandardSurfaceShader, StateChangedEvent, StreamFileParsedEvent, StringFunctions, StringListParameter, StringParameter, StructParameter, SystemDesc, TexturedChangedEvent, Torus, Touch, TreeItem, TreeItemParameter, UInt16, UInt32, UInt8, UnpackHDRShader, VLAAsset, VRController, VRViewport, Vec2, Vec2Attribute, Vec2OperatorInput, Vec2OperatorOutput, Vec2Parameter, Vec3, Vec3Attribute, Vec3OperatorInput, Vec3OperatorOutput, Vec3Parameter, Vec4, Vec4Attribute, Vec4OperatorInput, Vec4OperatorOutput, Vec4Parameter, Version, VertexColorMaterial, VertexColorShader, VideoStreamImage2D, ViewChangedEvent, Viewport, ViewportRenderState, VisibilityChangedEvent, WebGL12RenderingContext, XRController, XRControllerEvent, XRHead, XRPointerEvent, XRPoseEvent, XRViewChangedEvent, XRViewManipulator, XRViewport, XRef, Xfo, XfoOperatorInput, XfoOperatorOutput, XfoParameter, XrViewportEvent, ZeaKeyboardEvent, ZeaMouseEvent, ZeaPointerEvent, ZeaTouchEvent, ZeaUIEvent, ZeaWheelEvent, checkFramebuffer, create3DContext, genDataTypeDesc, generateShaderGeomBinding, getFileFolder, labelManager, libsRegistry, loadBinfile, loadJSONfile, loadTextfile, loadXMLfile, resourceLoader, shaderLibrary };