declare module "babylonjs/types" { /** Alias type for value that can be null */ export type Nullable = T | null; /** * Alias type for number that are floats * @ignorenaming */ export type float = number; /** * Alias type for number that are doubles. * @ignorenaming */ export type double = number; /** * Alias type for number that are integer * @ignorenaming */ export type int = number; /** Alias type for number array or Float32Array */ export type FloatArray = number[] | Float32Array; /** Alias type for number array or Float32Array or Int32Array or Uint32Array or Uint16Array */ export type IndicesArray = number[] | Int32Array | Uint32Array | Uint16Array; /** * Alias for types that can be used by a Buffer or VertexBuffer. */ export type DataArray = number[] | ArrayBuffer | ArrayBufferView; /** * Alias type for primitive types * @ignorenaming */ type Primitive = undefined | null | boolean | string | number | Function; /** * Type modifier to make all the properties of an object Readonly */ export type Immutable = T extends Primitive ? T : T extends Array ? ReadonlyArray : DeepImmutable; /** * Type modifier to make all the properties of an object Readonly recursively */ export type DeepImmutable = T extends Primitive ? T : T extends Array ? DeepImmutableArray : DeepImmutableObject; /** @hidden */ interface DeepImmutableArray extends ReadonlyArray> { } /** @hidden */ /** @hidden */ type DeepImmutableObject = { readonly [K in keyof T]: DeepImmutable; }; } declare module "babylonjs/Misc/arrayTools" { /** * Class containing a set of static utilities functions for arrays. */ export class ArrayTools { /** * Returns an array of the given size filled with element built from the given constructor and the paramters * @param size the number of element to construct and put in the array * @param itemBuilder a callback responsible for creating new instance of item. Called once per array entry. * @returns a new array filled with new objects */ static BuildArray(size: number, itemBuilder: () => T): Array; } } declare module "babylonjs/Maths/math.scalar" { /** * Scalar computation library */ export class Scalar { /** * Two pi constants convenient for computation. */ static TwoPi: number; /** * Boolean : true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45) * @param a number * @param b number * @param epsilon (default = 1.401298E-45) * @returns true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45) */ static WithinEpsilon(a: number, b: number, epsilon?: number): boolean; /** * Returns a string : the upper case translation of the number i to hexadecimal. * @param i number * @returns the upper case translation of the number i to hexadecimal. */ static ToHex(i: number): string; /** * Returns -1 if value is negative and +1 is value is positive. * @param value the value * @returns the value itself if it's equal to zero. */ static Sign(value: number): number; /** * Returns the value itself if it's between min and max. * Returns min if the value is lower than min. * Returns max if the value is greater than max. * @param value the value to clmap * @param min the min value to clamp to (default: 0) * @param max the max value to clamp to (default: 1) * @returns the clamped value */ static Clamp(value: number, min?: number, max?: number): number; /** * the log2 of value. * @param value the value to compute log2 of * @returns the log2 of value. */ static Log2(value: number): number; /** * Loops the value, so that it is never larger than length and never smaller than 0. * * This is similar to the modulo operator but it works with floating point numbers. * For example, using 3.0 for t and 2.5 for length, the result would be 0.5. * With t = 5 and length = 2.5, the result would be 0.0. * Note, however, that the behaviour is not defined for negative numbers as it is for the modulo operator * @param value the value * @param length the length * @returns the looped value */ static Repeat(value: number, length: number): number; /** * Normalize the value between 0.0 and 1.0 using min and max values * @param value value to normalize * @param min max to normalize between * @param max min to normalize between * @returns the normalized value */ static Normalize(value: number, min: number, max: number): number; /** * Denormalize the value from 0.0 and 1.0 using min and max values * @param normalized value to denormalize * @param min max to denormalize between * @param max min to denormalize between * @returns the denormalized value */ static Denormalize(normalized: number, min: number, max: number): number; /** * Calculates the shortest difference between two given angles given in degrees. * @param current current angle in degrees * @param target target angle in degrees * @returns the delta */ static DeltaAngle(current: number, target: number): number; /** * PingPongs the value t, so that it is never larger than length and never smaller than 0. * @param tx value * @param length length * @returns The returned value will move back and forth between 0 and length */ static PingPong(tx: number, length: number): number; /** * Interpolates between min and max with smoothing at the limits. * * This function interpolates between min and max in a similar way to Lerp. However, the interpolation will gradually speed up * from the start and slow down toward the end. This is useful for creating natural-looking animation, fading and other transitions. * @param from from * @param to to * @param tx value * @returns the smooth stepped value */ static SmoothStep(from: number, to: number, tx: number): number; /** * Moves a value current towards target. * * This is essentially the same as Mathf.Lerp but instead the function will ensure that the speed never exceeds maxDelta. * Negative values of maxDelta pushes the value away from target. * @param current current value * @param target target value * @param maxDelta max distance to move * @returns resulting value */ static MoveTowards(current: number, target: number, maxDelta: number): number; /** * Same as MoveTowards but makes sure the values interpolate correctly when they wrap around 360 degrees. * * Variables current and target are assumed to be in degrees. For optimization reasons, negative values of maxDelta * are not supported and may cause oscillation. To push current away from a target angle, add 180 to that angle instead. * @param current current value * @param target target value * @param maxDelta max distance to move * @returns resulting angle */ static MoveTowardsAngle(current: number, target: number, maxDelta: number): number; /** * Creates a new scalar with values linearly interpolated of "amount" between the start scalar and the end scalar. * @param start start value * @param end target value * @param amount amount to lerp between * @returns the lerped value */ static Lerp(start: number, end: number, amount: number): number; /** * Same as Lerp but makes sure the values interpolate correctly when they wrap around 360 degrees. * The parameter t is clamped to the range [0, 1]. Variables a and b are assumed to be in degrees. * @param start start value * @param end target value * @param amount amount to lerp between * @returns the lerped value */ static LerpAngle(start: number, end: number, amount: number): number; /** * Calculates the linear parameter t that produces the interpolant value within the range [a, b]. * @param a start value * @param b target value * @param value value between a and b * @returns the inverseLerp value */ static InverseLerp(a: number, b: number, value: number): number; /** * Returns a new scalar located for "amount" (float) on the Hermite spline defined by the scalars "value1", "value3", "tangent1", "tangent2". * @see http://mathworld.wolfram.com/HermitePolynomial.html * @param value1 spline value * @param tangent1 spline value * @param value2 spline value * @param tangent2 spline value * @param amount input value * @returns hermite result */ static Hermite(value1: number, tangent1: number, value2: number, tangent2: number, amount: number): number; /** * Returns a random float number between and min and max values * @param min min value of random * @param max max value of random * @returns random value */ static RandomRange(min: number, max: number): number; /** * This function returns percentage of a number in a given range. * * RangeToPercent(40,20,60) will return 0.5 (50%) * RangeToPercent(34,0,100) will return 0.34 (34%) * @param number to convert to percentage * @param min min range * @param max max range * @returns the percentage */ static RangeToPercent(number: number, min: number, max: number): number; /** * This function returns number that corresponds to the percentage in a given range. * * PercentToRange(0.34,0,100) will return 34. * @param percent to convert to number * @param min min range * @param max max range * @returns the number */ static PercentToRange(percent: number, min: number, max: number): number; /** * Returns the angle converted to equivalent value between -Math.PI and Math.PI radians. * @param angle The angle to normalize in radian. * @return The converted angle. */ static NormalizeRadians(angle: number): number; } } declare module "babylonjs/Maths/math" { import { DeepImmutable, Nullable, FloatArray, float } from "babylonjs/types"; /** * Constant used to convert a value to gamma space * @ignorenaming */ export const ToGammaSpace: number; /** * Constant used to convert a value to linear space * @ignorenaming */ export const ToLinearSpace = 2.2; /** * Constant used to define the minimal number value in Babylon.js * @ignorenaming */ let Epsilon: number; export { Epsilon }; /** * Class used to hold a RBG color */ export class Color3 { /** * Defines the red component (between 0 and 1, default is 0) */ r: number; /** * Defines the green component (between 0 and 1, default is 0) */ g: number; /** * Defines the blue component (between 0 and 1, default is 0) */ b: number; /** * Creates a new Color3 object from red, green, blue values, all between 0 and 1 * @param r defines the red component (between 0 and 1, default is 0) * @param g defines the green component (between 0 and 1, default is 0) * @param b defines the blue component (between 0 and 1, default is 0) */ constructor( /** * Defines the red component (between 0 and 1, default is 0) */ r?: number, /** * Defines the green component (between 0 and 1, default is 0) */ g?: number, /** * Defines the blue component (between 0 and 1, default is 0) */ b?: number); /** * Creates a string with the Color3 current values * @returns the string representation of the Color3 object */ toString(): string; /** * Returns the string "Color3" * @returns "Color3" */ getClassName(): string; /** * Compute the Color3 hash code * @returns an unique number that can be used to hash Color3 objects */ getHashCode(): number; /** * Stores in the given array from the given starting index the red, green, blue values as successive elements * @param array defines the array where to store the r,g,b components * @param index defines an optional index in the target array to define where to start storing values * @returns the current Color3 object */ toArray(array: FloatArray, index?: number): Color3; /** * Returns a new Color4 object from the current Color3 and the given alpha * @param alpha defines the alpha component on the new Color4 object (default is 1) * @returns a new Color4 object */ toColor4(alpha?: number): Color4; /** * Returns a new array populated with 3 numeric elements : red, green and blue values * @returns the new array */ asArray(): number[]; /** * Returns the luminance value * @returns a float value */ toLuminance(): number; /** * Multiply each Color3 rgb values by the given Color3 rgb values in a new Color3 object * @param otherColor defines the second operand * @returns the new Color3 object */ multiply(otherColor: DeepImmutable): Color3; /** * Multiply the rgb values of the Color3 and the given Color3 and stores the result in the object "result" * @param otherColor defines the second operand * @param result defines the Color3 object where to store the result * @returns the current Color3 */ multiplyToRef(otherColor: DeepImmutable, result: Color3): Color3; /** * Determines equality between Color3 objects * @param otherColor defines the second operand * @returns true if the rgb values are equal to the given ones */ equals(otherColor: DeepImmutable): boolean; /** * Determines equality between the current Color3 object and a set of r,b,g values * @param r defines the red component to check * @param g defines the green component to check * @param b defines the blue component to check * @returns true if the rgb values are equal to the given ones */ equalsFloats(r: number, g: number, b: number): boolean; /** * Multiplies in place each rgb value by scale * @param scale defines the scaling factor * @returns the updated Color3 */ scale(scale: number): Color3; /** * Multiplies the rgb values by scale and stores the result into "result" * @param scale defines the scaling factor * @param result defines the Color3 object where to store the result * @returns the unmodified current Color3 */ scaleToRef(scale: number, result: Color3): Color3; /** * Scale the current Color3 values by a factor and add the result to a given Color3 * @param scale defines the scale factor * @param result defines color to store the result into * @returns the unmodified current Color3 */ scaleAndAddToRef(scale: number, result: Color3): Color3; /** * Clamps the rgb values by the min and max values and stores the result into "result" * @param min defines minimum clamping value (default is 0) * @param max defines maximum clamping value (default is 1) * @param result defines color to store the result into * @returns the original Color3 */ clampToRef(min: number | undefined, max: number | undefined, result: Color3): Color3; /** * Creates a new Color3 set with the added values of the current Color3 and of the given one * @param otherColor defines the second operand * @returns the new Color3 */ add(otherColor: DeepImmutable): Color3; /** * Stores the result of the addition of the current Color3 and given one rgb values into "result" * @param otherColor defines the second operand * @param result defines Color3 object to store the result into * @returns the unmodified current Color3 */ addToRef(otherColor: DeepImmutable, result: Color3): Color3; /** * Returns a new Color3 set with the subtracted values of the given one from the current Color3 * @param otherColor defines the second operand * @returns the new Color3 */ subtract(otherColor: DeepImmutable): Color3; /** * Stores the result of the subtraction of given one from the current Color3 rgb values into "result" * @param otherColor defines the second operand * @param result defines Color3 object to store the result into * @returns the unmodified current Color3 */ subtractToRef(otherColor: DeepImmutable, result: Color3): Color3; /** * Copy the current object * @returns a new Color3 copied the current one */ clone(): Color3; /** * Copies the rgb values from the source in the current Color3 * @param source defines the source Color3 object * @returns the updated Color3 object */ copyFrom(source: DeepImmutable): Color3; /** * Updates the Color3 rgb values from the given floats * @param r defines the red component to read from * @param g defines the green component to read from * @param b defines the blue component to read from * @returns the current Color3 object */ copyFromFloats(r: number, g: number, b: number): Color3; /** * Updates the Color3 rgb values from the given floats * @param r defines the red component to read from * @param g defines the green component to read from * @param b defines the blue component to read from * @returns the current Color3 object */ set(r: number, g: number, b: number): Color3; /** * Compute the Color3 hexadecimal code as a string * @returns a string containing the hexadecimal representation of the Color3 object */ toHexString(): string; /** * Computes a new Color3 converted from the current one to linear space * @returns a new Color3 object */ toLinearSpace(): Color3; /** * Converts current color in rgb space to HSV values * @returns a new color3 representing the HSV values */ toHSV(): Color3; /** * Converts current color in rgb space to HSV values * @param result defines the Color3 where to store the HSV values */ toHSVToRef(result: Color3): void; /** * Converts the Color3 values to linear space and stores the result in "convertedColor" * @param convertedColor defines the Color3 object where to store the linear space version * @returns the unmodified Color3 */ toLinearSpaceToRef(convertedColor: Color3): Color3; /** * Computes a new Color3 converted from the current one to gamma space * @returns a new Color3 object */ toGammaSpace(): Color3; /** * Converts the Color3 values to gamma space and stores the result in "convertedColor" * @param convertedColor defines the Color3 object where to store the gamma space version * @returns the unmodified Color3 */ toGammaSpaceToRef(convertedColor: Color3): Color3; private static _BlackReadOnly; /** * Convert Hue, saturation and value to a Color3 (RGB) * @param hue defines the hue * @param saturation defines the saturation * @param value defines the value * @param result defines the Color3 where to store the RGB values */ static HSVtoRGBToRef(hue: number, saturation: number, value: number, result: Color3): void; /** * Creates a new Color3 from the string containing valid hexadecimal values * @param hex defines a string containing valid hexadecimal values * @returns a new Color3 object */ static FromHexString(hex: string): Color3; /** * Creates a new Color3 from the starting index of the given array * @param array defines the source array * @param offset defines an offset in the source array * @returns a new Color3 object */ static FromArray(array: DeepImmutable>, offset?: number): Color3; /** * Creates a new Color3 from integer values (< 256) * @param r defines the red component to read from (value between 0 and 255) * @param g defines the green component to read from (value between 0 and 255) * @param b defines the blue component to read from (value between 0 and 255) * @returns a new Color3 object */ static FromInts(r: number, g: number, b: number): Color3; /** * Creates a new Color3 with values linearly interpolated of "amount" between the start Color3 and the end Color3 * @param start defines the start Color3 value * @param end defines the end Color3 value * @param amount defines the gradient value between start and end * @returns a new Color3 object */ static Lerp(start: DeepImmutable, end: DeepImmutable, amount: number): Color3; /** * Creates a new Color3 with values linearly interpolated of "amount" between the start Color3 and the end Color3 * @param left defines the start value * @param right defines the end value * @param amount defines the gradient factor * @param result defines the Color3 object where to store the result */ static LerpToRef(left: DeepImmutable, right: DeepImmutable, amount: number, result: Color3): void; /** * Returns a Color3 value containing a red color * @returns a new Color3 object */ static Red(): Color3; /** * Returns a Color3 value containing a green color * @returns a new Color3 object */ static Green(): Color3; /** * Returns a Color3 value containing a blue color * @returns a new Color3 object */ static Blue(): Color3; /** * Returns a Color3 value containing a black color * @returns a new Color3 object */ static Black(): Color3; /** * Gets a Color3 value containing a black color that must not be updated */ static readonly BlackReadOnly: DeepImmutable; /** * Returns a Color3 value containing a white color * @returns a new Color3 object */ static White(): Color3; /** * Returns a Color3 value containing a purple color * @returns a new Color3 object */ static Purple(): Color3; /** * Returns a Color3 value containing a magenta color * @returns a new Color3 object */ static Magenta(): Color3; /** * Returns a Color3 value containing a yellow color * @returns a new Color3 object */ static Yellow(): Color3; /** * Returns a Color3 value containing a gray color * @returns a new Color3 object */ static Gray(): Color3; /** * Returns a Color3 value containing a teal color * @returns a new Color3 object */ static Teal(): Color3; /** * Returns a Color3 value containing a random color * @returns a new Color3 object */ static Random(): Color3; } /** * Class used to hold a RBGA color */ export class Color4 { /** * Defines the red component (between 0 and 1, default is 0) */ r: number; /** * Defines the green component (between 0 and 1, default is 0) */ g: number; /** * Defines the blue component (between 0 and 1, default is 0) */ b: number; /** * Defines the alpha component (between 0 and 1, default is 1) */ a: number; /** * Creates a new Color4 object from red, green, blue values, all between 0 and 1 * @param r defines the red component (between 0 and 1, default is 0) * @param g defines the green component (between 0 and 1, default is 0) * @param b defines the blue component (between 0 and 1, default is 0) * @param a defines the alpha component (between 0 and 1, default is 1) */ constructor( /** * Defines the red component (between 0 and 1, default is 0) */ r?: number, /** * Defines the green component (between 0 and 1, default is 0) */ g?: number, /** * Defines the blue component (between 0 and 1, default is 0) */ b?: number, /** * Defines the alpha component (between 0 and 1, default is 1) */ a?: number); /** * Adds in place the given Color4 values to the current Color4 object * @param right defines the second operand * @returns the current updated Color4 object */ addInPlace(right: DeepImmutable): Color4; /** * Creates a new array populated with 4 numeric elements : red, green, blue, alpha values * @returns the new array */ asArray(): number[]; /** * Stores from the starting index in the given array the Color4 successive values * @param array defines the array where to store the r,g,b components * @param index defines an optional index in the target array to define where to start storing values * @returns the current Color4 object */ toArray(array: number[], index?: number): Color4; /** * Determines equality between Color4 objects * @param otherColor defines the second operand * @returns true if the rgba values are equal to the given ones */ equals(otherColor: DeepImmutable): boolean; /** * Creates a new Color4 set with the added values of the current Color4 and of the given one * @param right defines the second operand * @returns a new Color4 object */ add(right: DeepImmutable): Color4; /** * Creates a new Color4 set with the subtracted values of the given one from the current Color4 * @param right defines the second operand * @returns a new Color4 object */ subtract(right: DeepImmutable): Color4; /** * Subtracts the given ones from the current Color4 values and stores the results in "result" * @param right defines the second operand * @param result defines the Color4 object where to store the result * @returns the current Color4 object */ subtractToRef(right: DeepImmutable, result: Color4): Color4; /** * Creates a new Color4 with the current Color4 values multiplied by scale * @param scale defines the scaling factor to apply * @returns a new Color4 object */ scale(scale: number): Color4; /** * Multiplies the current Color4 values by scale and stores the result in "result" * @param scale defines the scaling factor to apply * @param result defines the Color4 object where to store the result * @returns the current unmodified Color4 */ scaleToRef(scale: number, result: Color4): Color4; /** * Scale the current Color4 values by a factor and add the result to a given Color4 * @param scale defines the scale factor * @param result defines the Color4 object where to store the result * @returns the unmodified current Color4 */ scaleAndAddToRef(scale: number, result: Color4): Color4; /** * Clamps the rgb values by the min and max values and stores the result into "result" * @param min defines minimum clamping value (default is 0) * @param max defines maximum clamping value (default is 1) * @param result defines color to store the result into. * @returns the cuurent Color4 */ clampToRef(min: number | undefined, max: number | undefined, result: Color4): Color4; /** * Multipy an Color4 value by another and return a new Color4 object * @param color defines the Color4 value to multiply by * @returns a new Color4 object */ multiply(color: Color4): Color4; /** * Multipy a Color4 value by another and push the result in a reference value * @param color defines the Color4 value to multiply by * @param result defines the Color4 to fill the result in * @returns the result Color4 */ multiplyToRef(color: Color4, result: Color4): Color4; /** * Creates a string with the Color4 current values * @returns the string representation of the Color4 object */ toString(): string; /** * Returns the string "Color4" * @returns "Color4" */ getClassName(): string; /** * Compute the Color4 hash code * @returns an unique number that can be used to hash Color4 objects */ getHashCode(): number; /** * Creates a new Color4 copied from the current one * @returns a new Color4 object */ clone(): Color4; /** * Copies the given Color4 values into the current one * @param source defines the source Color4 object * @returns the current updated Color4 object */ copyFrom(source: Color4): Color4; /** * Copies the given float values into the current one * @param r defines the red component to read from * @param g defines the green component to read from * @param b defines the blue component to read from * @param a defines the alpha component to read from * @returns the current updated Color4 object */ copyFromFloats(r: number, g: number, b: number, a: number): Color4; /** * Copies the given float values into the current one * @param r defines the red component to read from * @param g defines the green component to read from * @param b defines the blue component to read from * @param a defines the alpha component to read from * @returns the current updated Color4 object */ set(r: number, g: number, b: number, a: number): Color4; /** * Compute the Color4 hexadecimal code as a string * @returns a string containing the hexadecimal representation of the Color4 object */ toHexString(): string; /** * Computes a new Color4 converted from the current one to linear space * @returns a new Color4 object */ toLinearSpace(): Color4; /** * Converts the Color4 values to linear space and stores the result in "convertedColor" * @param convertedColor defines the Color4 object where to store the linear space version * @returns the unmodified Color4 */ toLinearSpaceToRef(convertedColor: Color4): Color4; /** * Computes a new Color4 converted from the current one to gamma space * @returns a new Color4 object */ toGammaSpace(): Color4; /** * Converts the Color4 values to gamma space and stores the result in "convertedColor" * @param convertedColor defines the Color4 object where to store the gamma space version * @returns the unmodified Color4 */ toGammaSpaceToRef(convertedColor: Color4): Color4; /** * Creates a new Color4 from the string containing valid hexadecimal values * @param hex defines a string containing valid hexadecimal values * @returns a new Color4 object */ static FromHexString(hex: string): Color4; /** * Creates a new Color4 object set with the linearly interpolated values of "amount" between the left Color4 object and the right Color4 object * @param left defines the start value * @param right defines the end value * @param amount defines the gradient factor * @returns a new Color4 object */ static Lerp(left: DeepImmutable, right: DeepImmutable, amount: number): Color4; /** * Set the given "result" with the linearly interpolated values of "amount" between the left Color4 object and the right Color4 object * @param left defines the start value * @param right defines the end value * @param amount defines the gradient factor * @param result defines the Color4 object where to store data */ static LerpToRef(left: DeepImmutable, right: DeepImmutable, amount: number, result: Color4): void; /** * Creates a new Color4 from a Color3 and an alpha value * @param color3 defines the source Color3 to read from * @param alpha defines the alpha component (1.0 by default) * @returns a new Color4 object */ static FromColor3(color3: DeepImmutable, alpha?: number): Color4; /** * Creates a new Color4 from the starting index element of the given array * @param array defines the source array to read from * @param offset defines the offset in the source array * @returns a new Color4 object */ static FromArray(array: DeepImmutable>, offset?: number): Color4; /** * Creates a new Color3 from integer values (< 256) * @param r defines the red component to read from (value between 0 and 255) * @param g defines the green component to read from (value between 0 and 255) * @param b defines the blue component to read from (value between 0 and 255) * @param a defines the alpha component to read from (value between 0 and 255) * @returns a new Color3 object */ static FromInts(r: number, g: number, b: number, a: number): Color4; /** * Check the content of a given array and convert it to an array containing RGBA data * If the original array was already containing count * 4 values then it is returned directly * @param colors defines the array to check * @param count defines the number of RGBA data to expect * @returns an array containing count * 4 values (RGBA) */ static CheckColors4(colors: number[], count: number): number[]; } /** * Class representing a vector containing 2 coordinates */ export class Vector2 { /** defines the first coordinate */ x: number; /** defines the second coordinate */ y: number; /** * Creates a new Vector2 from the given x and y coordinates * @param x defines the first coordinate * @param y defines the second coordinate */ constructor( /** defines the first coordinate */ x?: number, /** defines the second coordinate */ y?: number); /** * Gets a string with the Vector2 coordinates * @returns a string with the Vector2 coordinates */ toString(): string; /** * Gets class name * @returns the string "Vector2" */ getClassName(): string; /** * Gets current vector hash code * @returns the Vector2 hash code as a number */ getHashCode(): number; /** * Sets the Vector2 coordinates in the given array or Float32Array from the given index. * @param array defines the source array * @param index defines the offset in source array * @returns the current Vector2 */ toArray(array: FloatArray, index?: number): Vector2; /** * Copy the current vector to an array * @returns a new array with 2 elements: the Vector2 coordinates. */ asArray(): number[]; /** * Sets the Vector2 coordinates with the given Vector2 coordinates * @param source defines the source Vector2 * @returns the current updated Vector2 */ copyFrom(source: DeepImmutable): Vector2; /** * Sets the Vector2 coordinates with the given floats * @param x defines the first coordinate * @param y defines the second coordinate * @returns the current updated Vector2 */ copyFromFloats(x: number, y: number): Vector2; /** * Sets the Vector2 coordinates with the given floats * @param x defines the first coordinate * @param y defines the second coordinate * @returns the current updated Vector2 */ set(x: number, y: number): Vector2; /** * Add another vector with the current one * @param otherVector defines the other vector * @returns a new Vector2 set with the addition of the current Vector2 and the given one coordinates */ add(otherVector: DeepImmutable): Vector2; /** * Sets the "result" coordinates with the addition of the current Vector2 and the given one coordinates * @param otherVector defines the other vector * @param result defines the target vector * @returns the unmodified current Vector2 */ addToRef(otherVector: DeepImmutable, result: Vector2): Vector2; /** * Set the Vector2 coordinates by adding the given Vector2 coordinates * @param otherVector defines the other vector * @returns the current updated Vector2 */ addInPlace(otherVector: DeepImmutable): Vector2; /** * Gets a new Vector2 by adding the current Vector2 coordinates to the given Vector3 x, y coordinates * @param otherVector defines the other vector * @returns a new Vector2 */ addVector3(otherVector: Vector3): Vector2; /** * Gets a new Vector2 set with the subtracted coordinates of the given one from the current Vector2 * @param otherVector defines the other vector * @returns a new Vector2 */ subtract(otherVector: Vector2): Vector2; /** * Sets the "result" coordinates with the subtraction of the given one from the current Vector2 coordinates. * @param otherVector defines the other vector * @param result defines the target vector * @returns the unmodified current Vector2 */ subtractToRef(otherVector: DeepImmutable, result: Vector2): Vector2; /** * Sets the current Vector2 coordinates by subtracting from it the given one coordinates * @param otherVector defines the other vector * @returns the current updated Vector2 */ subtractInPlace(otherVector: DeepImmutable): Vector2; /** * Multiplies in place the current Vector2 coordinates by the given ones * @param otherVector defines the other vector * @returns the current updated Vector2 */ multiplyInPlace(otherVector: DeepImmutable): Vector2; /** * Returns a new Vector2 set with the multiplication of the current Vector2 and the given one coordinates * @param otherVector defines the other vector * @returns a new Vector2 */ multiply(otherVector: DeepImmutable): Vector2; /** * Sets "result" coordinates with the multiplication of the current Vector2 and the given one coordinates * @param otherVector defines the other vector * @param result defines the target vector * @returns the unmodified current Vector2 */ multiplyToRef(otherVector: DeepImmutable, result: Vector2): Vector2; /** * Gets a new Vector2 set with the Vector2 coordinates multiplied by the given floats * @param x defines the first coordinate * @param y defines the second coordinate * @returns a new Vector2 */ multiplyByFloats(x: number, y: number): Vector2; /** * Returns a new Vector2 set with the Vector2 coordinates divided by the given one coordinates * @param otherVector defines the other vector * @returns a new Vector2 */ divide(otherVector: Vector2): Vector2; /** * Sets the "result" coordinates with the Vector2 divided by the given one coordinates * @param otherVector defines the other vector * @param result defines the target vector * @returns the unmodified current Vector2 */ divideToRef(otherVector: DeepImmutable, result: Vector2): Vector2; /** * Divides the current Vector2 coordinates by the given ones * @param otherVector defines the other vector * @returns the current updated Vector2 */ divideInPlace(otherVector: DeepImmutable): Vector2; /** * Gets a new Vector2 with current Vector2 negated coordinates * @returns a new Vector2 */ negate(): Vector2; /** * Multiply the Vector2 coordinates by scale * @param scale defines the scaling factor * @returns the current updated Vector2 */ scaleInPlace(scale: number): Vector2; /** * Returns a new Vector2 scaled by "scale" from the current Vector2 * @param scale defines the scaling factor * @returns a new Vector2 */ scale(scale: number): Vector2; /** * Scale the current Vector2 values by a factor to a given Vector2 * @param scale defines the scale factor * @param result defines the Vector2 object where to store the result * @returns the unmodified current Vector2 */ scaleToRef(scale: number, result: Vector2): Vector2; /** * Scale the current Vector2 values by a factor and add the result to a given Vector2 * @param scale defines the scale factor * @param result defines the Vector2 object where to store the result * @returns the unmodified current Vector2 */ scaleAndAddToRef(scale: number, result: Vector2): Vector2; /** * Gets a boolean if two vectors are equals * @param otherVector defines the other vector * @returns true if the given vector coordinates strictly equal the current Vector2 ones */ equals(otherVector: DeepImmutable): boolean; /** * Gets a boolean if two vectors are equals (using an epsilon value) * @param otherVector defines the other vector * @param epsilon defines the minimal distance to consider equality * @returns true if the given vector coordinates are close to the current ones by a distance of epsilon. */ equalsWithEpsilon(otherVector: DeepImmutable, epsilon?: number): boolean; /** * Gets a new Vector2 from current Vector2 floored values * @returns a new Vector2 */ floor(): Vector2; /** * Gets a new Vector2 from current Vector2 floored values * @returns a new Vector2 */ fract(): Vector2; /** * Gets the length of the vector * @returns the vector length (float) */ length(): number; /** * Gets the vector squared length * @returns the vector squared length (float) */ lengthSquared(): number; /** * Normalize the vector * @returns the current updated Vector2 */ normalize(): Vector2; /** * Gets a new Vector2 copied from the Vector2 * @returns a new Vector2 */ clone(): Vector2; /** * Gets a new Vector2(0, 0) * @returns a new Vector2 */ static Zero(): Vector2; /** * Gets a new Vector2(1, 1) * @returns a new Vector2 */ static One(): Vector2; /** * Gets a new Vector2 set from the given index element of the given array * @param array defines the data source * @param offset defines the offset in the data source * @returns a new Vector2 */ static FromArray(array: DeepImmutable>, offset?: number): Vector2; /** * Sets "result" from the given index element of the given array * @param array defines the data source * @param offset defines the offset in the data source * @param result defines the target vector */ static FromArrayToRef(array: DeepImmutable>, offset: number, result: Vector2): void; /** * Gets a new Vector2 located for "amount" (float) on the CatmullRom spline defined by the given four Vector2 * @param value1 defines 1st point of control * @param value2 defines 2nd point of control * @param value3 defines 3rd point of control * @param value4 defines 4th point of control * @param amount defines the interpolation factor * @returns a new Vector2 */ static CatmullRom(value1: DeepImmutable, value2: DeepImmutable, value3: DeepImmutable, value4: DeepImmutable, amount: number): Vector2; /** * Returns a new Vector2 set with same the coordinates than "value" ones if the vector "value" is in the square defined by "min" and "max". * If a coordinate of "value" is lower than "min" coordinates, the returned Vector2 is given this "min" coordinate. * If a coordinate of "value" is greater than "max" coordinates, the returned Vector2 is given this "max" coordinate * @param value defines the value to clamp * @param min defines the lower limit * @param max defines the upper limit * @returns a new Vector2 */ static Clamp(value: DeepImmutable, min: DeepImmutable, max: DeepImmutable): Vector2; /** * Returns a new Vector2 located for "amount" (float) on the Hermite spline defined by the vectors "value1", "value3", "tangent1", "tangent2" * @param value1 defines the 1st control point * @param tangent1 defines the outgoing tangent * @param value2 defines the 2nd control point * @param tangent2 defines the incoming tangent * @param amount defines the interpolation factor * @returns a new Vector2 */ static Hermite(value1: DeepImmutable, tangent1: DeepImmutable, value2: DeepImmutable, tangent2: DeepImmutable, amount: number): Vector2; /** * Returns a new Vector2 located for "amount" (float) on the linear interpolation between the vector "start" adn the vector "end". * @param start defines the start vector * @param end defines the end vector * @param amount defines the interpolation factor * @returns a new Vector2 */ static Lerp(start: DeepImmutable, end: DeepImmutable, amount: number): Vector2; /** * Gets the dot product of the vector "left" and the vector "right" * @param left defines first vector * @param right defines second vector * @returns the dot product (float) */ static Dot(left: DeepImmutable, right: DeepImmutable): number; /** * Returns a new Vector2 equal to the normalized given vector * @param vector defines the vector to normalize * @returns a new Vector2 */ static Normalize(vector: DeepImmutable): Vector2; /** * Gets a new Vector2 set with the minimal coordinate values from the "left" and "right" vectors * @param left defines 1st vector * @param right defines 2nd vector * @returns a new Vector2 */ static Minimize(left: DeepImmutable, right: DeepImmutable): Vector2; /** * Gets a new Vecto2 set with the maximal coordinate values from the "left" and "right" vectors * @param left defines 1st vector * @param right defines 2nd vector * @returns a new Vector2 */ static Maximize(left: DeepImmutable, right: DeepImmutable): Vector2; /** * Gets a new Vector2 set with the transformed coordinates of the given vector by the given transformation matrix * @param vector defines the vector to transform * @param transformation defines the matrix to apply * @returns a new Vector2 */ static Transform(vector: DeepImmutable, transformation: DeepImmutable): Vector2; /** * Transforms the given vector coordinates by the given transformation matrix and stores the result in the vector "result" coordinates * @param vector defines the vector to transform * @param transformation defines the matrix to apply * @param result defines the target vector */ static TransformToRef(vector: DeepImmutable, transformation: DeepImmutable, result: Vector2): void; /** * Determines if a given vector is included in a triangle * @param p defines the vector to test * @param p0 defines 1st triangle point * @param p1 defines 2nd triangle point * @param p2 defines 3rd triangle point * @returns true if the point "p" is in the triangle defined by the vertors "p0", "p1", "p2" */ static PointInTriangle(p: DeepImmutable, p0: DeepImmutable, p1: DeepImmutable, p2: DeepImmutable): boolean; /** * Gets the distance between the vectors "value1" and "value2" * @param value1 defines first vector * @param value2 defines second vector * @returns the distance between vectors */ static Distance(value1: DeepImmutable, value2: DeepImmutable): number; /** * Returns the squared distance between the vectors "value1" and "value2" * @param value1 defines first vector * @param value2 defines second vector * @returns the squared distance between vectors */ static DistanceSquared(value1: DeepImmutable, value2: DeepImmutable): number; /** * Gets a new Vector2 located at the center of the vectors "value1" and "value2" * @param value1 defines first vector * @param value2 defines second vector * @returns a new Vector2 */ static Center(value1: DeepImmutable, value2: DeepImmutable): Vector2; /** * Gets the shortest distance (float) between the point "p" and the segment defined by the two points "segA" and "segB". * @param p defines the middle point * @param segA defines one point of the segment * @param segB defines the other point of the segment * @returns the shortest distance */ static DistanceOfPointFromSegment(p: DeepImmutable, segA: DeepImmutable, segB: DeepImmutable): number; } /** * Classed used to store (x,y,z) vector representation * A Vector3 is the main object used in 3D geometry * It can represent etiher the coordinates of a point the space, either a direction * Reminder: js uses a left handed forward facing system */ export class Vector3 { /** * Defines the first coordinates (on X axis) */ x: number; /** * Defines the second coordinates (on Y axis) */ y: number; /** * Defines the third coordinates (on Z axis) */ z: number; private static _UpReadOnly; private static _ZeroReadOnly; /** * Creates a new Vector3 object from the given x, y, z (floats) coordinates. * @param x defines the first coordinates (on X axis) * @param y defines the second coordinates (on Y axis) * @param z defines the third coordinates (on Z axis) */ constructor( /** * Defines the first coordinates (on X axis) */ x?: number, /** * Defines the second coordinates (on Y axis) */ y?: number, /** * Defines the third coordinates (on Z axis) */ z?: number); /** * Creates a string representation of the Vector3 * @returns a string with the Vector3 coordinates. */ toString(): string; /** * Gets the class name * @returns the string "Vector3" */ getClassName(): string; /** * Creates the Vector3 hash code * @returns a number which tends to be unique between Vector3 instances */ getHashCode(): number; /** * Creates an array containing three elements : the coordinates of the Vector3 * @returns a new array of numbers */ asArray(): number[]; /** * Populates the given array or Float32Array from the given index with the successive coordinates of the Vector3 * @param array defines the destination array * @param index defines the offset in the destination array * @returns the current Vector3 */ toArray(array: FloatArray, index?: number): Vector3; /** * Converts the current Vector3 into a quaternion (considering that the Vector3 contains Euler angles representation of a rotation) * @returns a new Quaternion object, computed from the Vector3 coordinates */ toQuaternion(): Quaternion; /** * Adds the given vector to the current Vector3 * @param otherVector defines the second operand * @returns the current updated Vector3 */ addInPlace(otherVector: DeepImmutable): Vector3; /** * Adds the given coordinates to the current Vector3 * @param x defines the x coordinate of the operand * @param y defines the y coordinate of the operand * @param z defines the z coordinate of the operand * @returns the current updated Vector3 */ addInPlaceFromFloats(x: number, y: number, z: number): Vector3; /** * Gets a new Vector3, result of the addition the current Vector3 and the given vector * @param otherVector defines the second operand * @returns the resulting Vector3 */ add(otherVector: DeepImmutable): Vector3; /** * Adds the current Vector3 to the given one and stores the result in the vector "result" * @param otherVector defines the second operand * @param result defines the Vector3 object where to store the result * @returns the current Vector3 */ addToRef(otherVector: DeepImmutable, result: Vector3): Vector3; /** * Subtract the given vector from the current Vector3 * @param otherVector defines the second operand * @returns the current updated Vector3 */ subtractInPlace(otherVector: DeepImmutable): Vector3; /** * Returns a new Vector3, result of the subtraction of the given vector from the current Vector3 * @param otherVector defines the second operand * @returns the resulting Vector3 */ subtract(otherVector: DeepImmutable): Vector3; /** * Subtracts the given vector from the current Vector3 and stores the result in the vector "result". * @param otherVector defines the second operand * @param result defines the Vector3 object where to store the result * @returns the current Vector3 */ subtractToRef(otherVector: DeepImmutable, result: Vector3): Vector3; /** * Returns a new Vector3 set with the subtraction of the given floats from the current Vector3 coordinates * @param x defines the x coordinate of the operand * @param y defines the y coordinate of the operand * @param z defines the z coordinate of the operand * @returns the resulting Vector3 */ subtractFromFloats(x: number, y: number, z: number): Vector3; /** * Subtracts the given floats from the current Vector3 coordinates and set the given vector "result" with this result * @param x defines the x coordinate of the operand * @param y defines the y coordinate of the operand * @param z defines the z coordinate of the operand * @param result defines the Vector3 object where to store the result * @returns the current Vector3 */ subtractFromFloatsToRef(x: number, y: number, z: number, result: Vector3): Vector3; /** * Gets a new Vector3 set with the current Vector3 negated coordinates * @returns a new Vector3 */ negate(): Vector3; /** * Multiplies the Vector3 coordinates by the float "scale" * @param scale defines the multiplier factor * @returns the current updated Vector3 */ scaleInPlace(scale: number): Vector3; /** * Returns a new Vector3 set with the current Vector3 coordinates multiplied by the float "scale" * @param scale defines the multiplier factor * @returns a new Vector3 */ scale(scale: number): Vector3; /** * Multiplies the current Vector3 coordinates by the float "scale" and stores the result in the given vector "result" coordinates * @param scale defines the multiplier factor * @param result defines the Vector3 object where to store the result * @returns the current Vector3 */ scaleToRef(scale: number, result: Vector3): Vector3; /** * Scale the current Vector3 values by a factor and add the result to a given Vector3 * @param scale defines the scale factor * @param result defines the Vector3 object where to store the result * @returns the unmodified current Vector3 */ scaleAndAddToRef(scale: number, result: Vector3): Vector3; /** * Returns true if the current Vector3 and the given vector coordinates are strictly equal * @param otherVector defines the second operand * @returns true if both vectors are equals */ equals(otherVector: DeepImmutable): boolean; /** * Returns true if the current Vector3 and the given vector coordinates are distant less than epsilon * @param otherVector defines the second operand * @param epsilon defines the minimal distance to define values as equals * @returns true if both vectors are distant less than epsilon */ equalsWithEpsilon(otherVector: DeepImmutable, epsilon?: number): boolean; /** * Returns true if the current Vector3 coordinates equals the given floats * @param x defines the x coordinate of the operand * @param y defines the y coordinate of the operand * @param z defines the z coordinate of the operand * @returns true if both vectors are equals */ equalsToFloats(x: number, y: number, z: number): boolean; /** * Multiplies the current Vector3 coordinates by the given ones * @param otherVector defines the second operand * @returns the current updated Vector3 */ multiplyInPlace(otherVector: DeepImmutable): Vector3; /** * Returns a new Vector3, result of the multiplication of the current Vector3 by the given vector * @param otherVector defines the second operand * @returns the new Vector3 */ multiply(otherVector: DeepImmutable): Vector3; /** * Multiplies the current Vector3 by the given one and stores the result in the given vector "result" * @param otherVector defines the second operand * @param result defines the Vector3 object where to store the result * @returns the current Vector3 */ multiplyToRef(otherVector: DeepImmutable, result: Vector3): Vector3; /** * Returns a new Vector3 set with the result of the mulliplication of the current Vector3 coordinates by the given floats * @param x defines the x coordinate of the operand * @param y defines the y coordinate of the operand * @param z defines the z coordinate of the operand * @returns the new Vector3 */ multiplyByFloats(x: number, y: number, z: number): Vector3; /** * Returns a new Vector3 set with the result of the division of the current Vector3 coordinates by the given ones * @param otherVector defines the second operand * @returns the new Vector3 */ divide(otherVector: DeepImmutable): Vector3; /** * Divides the current Vector3 coordinates by the given ones and stores the result in the given vector "result" * @param otherVector defines the second operand * @param result defines the Vector3 object where to store the result * @returns the current Vector3 */ divideToRef(otherVector: DeepImmutable, result: Vector3): Vector3; /** * Divides the current Vector3 coordinates by the given ones. * @param otherVector defines the second operand * @returns the current updated Vector3 */ divideInPlace(otherVector: Vector3): Vector3; /** * Updates the current Vector3 with the minimal coordinate values between its and the given vector ones * @param other defines the second operand * @returns the current updated Vector3 */ minimizeInPlace(other: DeepImmutable): Vector3; /** * Updates the current Vector3 with the maximal coordinate values between its and the given vector ones. * @param other defines the second operand * @returns the current updated Vector3 */ maximizeInPlace(other: DeepImmutable): Vector3; /** * Updates the current Vector3 with the minimal coordinate values between its and the given coordinates * @param x defines the x coordinate of the operand * @param y defines the y coordinate of the operand * @param z defines the z coordinate of the operand * @returns the current updated Vector3 */ minimizeInPlaceFromFloats(x: number, y: number, z: number): Vector3; /** * Updates the current Vector3 with the maximal coordinate values between its and the given coordinates. * @param x defines the x coordinate of the operand * @param y defines the y coordinate of the operand * @param z defines the z coordinate of the operand * @returns the current updated Vector3 */ maximizeInPlaceFromFloats(x: number, y: number, z: number): Vector3; /** * Due to float precision, scale of a mesh could be uniform but float values are off by a small fraction * Check if is non uniform within a certain amount of decimal places to account for this * @param epsilon the amount the values can differ * @returns if the the vector is non uniform to a certain number of decimal places */ isNonUniformWithinEpsilon(epsilon: number): boolean; /** * Gets a boolean indicating that the vector is non uniform meaning x, y or z are not all the same */ readonly isNonUniform: boolean; /** * Gets a new Vector3 from current Vector3 floored values * @returns a new Vector3 */ floor(): Vector3; /** * Gets a new Vector3 from current Vector3 floored values * @returns a new Vector3 */ fract(): Vector3; /** * Gets the length of the Vector3 * @returns the length of the Vector3 */ length(): number; /** * Gets the squared length of the Vector3 * @returns squared length of the Vector3 */ lengthSquared(): number; /** * Normalize the current Vector3. * Please note that this is an in place operation. * @returns the current updated Vector3 */ normalize(): Vector3; /** * Reorders the x y z properties of the vector in place * @param order new ordering of the properties (eg. for vector 1,2,3 with "ZYX" will produce 3,2,1) * @returns the current updated vector */ reorderInPlace(order: string): this; /** * Rotates the vector around 0,0,0 by a quaternion * @param quaternion the rotation quaternion * @param result vector to store the result * @returns the resulting vector */ rotateByQuaternionToRef(quaternion: Quaternion, result: Vector3): Vector3; /** * Rotates a vector around a given point * @param quaternion the rotation quaternion * @param point the point to rotate around * @param result vector to store the result * @returns the resulting vector */ rotateByQuaternionAroundPointToRef(quaternion: Quaternion, point: Vector3, result: Vector3): Vector3; /** * Normalize the current Vector3 with the given input length. * Please note that this is an in place operation. * @param len the length of the vector * @returns the current updated Vector3 */ normalizeFromLength(len: number): Vector3; /** * Normalize the current Vector3 to a new vector * @returns the new Vector3 */ normalizeToNew(): Vector3; /** * Normalize the current Vector3 to the reference * @param reference define the Vector3 to update * @returns the updated Vector3 */ normalizeToRef(reference: DeepImmutable): Vector3; /** * Creates a new Vector3 copied from the current Vector3 * @returns the new Vector3 */ clone(): Vector3; /** * Copies the given vector coordinates to the current Vector3 ones * @param source defines the source Vector3 * @returns the current updated Vector3 */ copyFrom(source: DeepImmutable): Vector3; /** * Copies the given floats to the current Vector3 coordinates * @param x defines the x coordinate of the operand * @param y defines the y coordinate of the operand * @param z defines the z coordinate of the operand * @returns the current updated Vector3 */ copyFromFloats(x: number, y: number, z: number): Vector3; /** * Copies the given floats to the current Vector3 coordinates * @param x defines the x coordinate of the operand * @param y defines the y coordinate of the operand * @param z defines the z coordinate of the operand * @returns the current updated Vector3 */ set(x: number, y: number, z: number): Vector3; /** * Copies the given float to the current Vector3 coordinates * @param v defines the x, y and z coordinates of the operand * @returns the current updated Vector3 */ setAll(v: number): Vector3; /** * Get the clip factor between two vectors * @param vector0 defines the first operand * @param vector1 defines the second operand * @param axis defines the axis to use * @param size defines the size along the axis * @returns the clip factor */ static GetClipFactor(vector0: DeepImmutable, vector1: DeepImmutable, axis: DeepImmutable, size: number): number; /** * Get angle between two vectors * @param vector0 angle between vector0 and vector1 * @param vector1 angle between vector0 and vector1 * @param normal direction of the normal * @return the angle between vector0 and vector1 */ static GetAngleBetweenVectors(vector0: DeepImmutable, vector1: DeepImmutable, normal: DeepImmutable): number; /** * Returns a new Vector3 set from the index "offset" of the given array * @param array defines the source array * @param offset defines the offset in the source array * @returns the new Vector3 */ static FromArray(array: DeepImmutable>, offset?: number): Vector3; /** * Returns a new Vector3 set from the index "offset" of the given Float32Array * This function is deprecated. Use FromArray instead * @param array defines the source array * @param offset defines the offset in the source array * @returns the new Vector3 */ static FromFloatArray(array: DeepImmutable, offset?: number): Vector3; /** * Sets the given vector "result" with the element values from the index "offset" of the given array * @param array defines the source array * @param offset defines the offset in the source array * @param result defines the Vector3 where to store the result */ static FromArrayToRef(array: DeepImmutable>, offset: number, result: Vector3): void; /** * Sets the given vector "result" with the element values from the index "offset" of the given Float32Array * This function is deprecated. Use FromArrayToRef instead. * @param array defines the source array * @param offset defines the offset in the source array * @param result defines the Vector3 where to store the result */ static FromFloatArrayToRef(array: DeepImmutable, offset: number, result: Vector3): void; /** * Sets the given vector "result" with the given floats. * @param x defines the x coordinate of the source * @param y defines the y coordinate of the source * @param z defines the z coordinate of the source * @param result defines the Vector3 where to store the result */ static FromFloatsToRef(x: number, y: number, z: number, result: Vector3): void; /** * Returns a new Vector3 set to (0.0, 0.0, 0.0) * @returns a new empty Vector3 */ static Zero(): Vector3; /** * Returns a new Vector3 set to (1.0, 1.0, 1.0) * @returns a new unit Vector3 */ static One(): Vector3; /** * Returns a new Vector3 set to (0.0, 1.0, 0.0) * @returns a new up Vector3 */ static Up(): Vector3; /** * Gets a up Vector3 that must not be updated */ static readonly UpReadOnly: DeepImmutable; /** * Gets a zero Vector3 that must not be updated */ static readonly ZeroReadOnly: DeepImmutable; /** * Returns a new Vector3 set to (0.0, -1.0, 0.0) * @returns a new down Vector3 */ static Down(): Vector3; /** * Returns a new Vector3 set to (0.0, 0.0, 1.0) * @returns a new forward Vector3 */ static Forward(): Vector3; /** * Returns a new Vector3 set to (0.0, 0.0, -1.0) * @returns a new forward Vector3 */ static Backward(): Vector3; /** * Returns a new Vector3 set to (1.0, 0.0, 0.0) * @returns a new right Vector3 */ static Right(): Vector3; /** * Returns a new Vector3 set to (-1.0, 0.0, 0.0) * @returns a new left Vector3 */ static Left(): Vector3; /** * Returns a new Vector3 set with the result of the transformation by the given matrix of the given vector. * This method computes tranformed coordinates only, not transformed direction vectors (ie. it takes translation in account) * @param vector defines the Vector3 to transform * @param transformation defines the transformation matrix * @returns the transformed Vector3 */ static TransformCoordinates(vector: DeepImmutable, transformation: DeepImmutable): Vector3; /** * Sets the given vector "result" coordinates with the result of the transformation by the given matrix of the given vector * This method computes tranformed coordinates only, not transformed direction vectors (ie. it takes translation in account) * @param vector defines the Vector3 to transform * @param transformation defines the transformation matrix * @param result defines the Vector3 where to store the result */ static TransformCoordinatesToRef(vector: DeepImmutable, transformation: DeepImmutable, result: Vector3): void; /** * Sets the given vector "result" coordinates with the result of the transformation by the given matrix of the given floats (x, y, z) * This method computes tranformed coordinates only, not transformed direction vectors * @param x define the x coordinate of the source vector * @param y define the y coordinate of the source vector * @param z define the z coordinate of the source vector * @param transformation defines the transformation matrix * @param result defines the Vector3 where to store the result */ static TransformCoordinatesFromFloatsToRef(x: number, y: number, z: number, transformation: DeepImmutable, result: Vector3): void; /** * Returns a new Vector3 set with the result of the normal transformation by the given matrix of the given vector * This methods computes transformed normalized direction vectors only (ie. it does not apply translation) * @param vector defines the Vector3 to transform * @param transformation defines the transformation matrix * @returns the new Vector3 */ static TransformNormal(vector: DeepImmutable, transformation: DeepImmutable): Vector3; /** * Sets the given vector "result" with the result of the normal transformation by the given matrix of the given vector * This methods computes transformed normalized direction vectors only (ie. it does not apply translation) * @param vector defines the Vector3 to transform * @param transformation defines the transformation matrix * @param result defines the Vector3 where to store the result */ static TransformNormalToRef(vector: DeepImmutable, transformation: DeepImmutable, result: Vector3): void; /** * Sets the given vector "result" with the result of the normal transformation by the given matrix of the given floats (x, y, z) * This methods computes transformed normalized direction vectors only (ie. it does not apply translation) * @param x define the x coordinate of the source vector * @param y define the y coordinate of the source vector * @param z define the z coordinate of the source vector * @param transformation defines the transformation matrix * @param result defines the Vector3 where to store the result */ static TransformNormalFromFloatsToRef(x: number, y: number, z: number, transformation: DeepImmutable, result: Vector3): void; /** * Returns a new Vector3 located for "amount" on the CatmullRom interpolation spline defined by the vectors "value1", "value2", "value3", "value4" * @param value1 defines the first control point * @param value2 defines the second control point * @param value3 defines the third control point * @param value4 defines the fourth control point * @param amount defines the amount on the spline to use * @returns the new Vector3 */ static CatmullRom(value1: DeepImmutable, value2: DeepImmutable, value3: DeepImmutable, value4: DeepImmutable, amount: number): Vector3; /** * Returns a new Vector3 set with the coordinates of "value", if the vector "value" is in the cube defined by the vectors "min" and "max" * If a coordinate value of "value" is lower than one of the "min" coordinate, then this "value" coordinate is set with the "min" one * If a coordinate value of "value" is greater than one of the "max" coordinate, then this "value" coordinate is set with the "max" one * @param value defines the current value * @param min defines the lower range value * @param max defines the upper range value * @returns the new Vector3 */ static Clamp(value: DeepImmutable, min: DeepImmutable, max: DeepImmutable): Vector3; /** * Sets the given vector "result" with the coordinates of "value", if the vector "value" is in the cube defined by the vectors "min" and "max" * If a coordinate value of "value" is lower than one of the "min" coordinate, then this "value" coordinate is set with the "min" one * If a coordinate value of "value" is greater than one of the "max" coordinate, then this "value" coordinate is set with the "max" one * @param value defines the current value * @param min defines the lower range value * @param max defines the upper range value * @param result defines the Vector3 where to store the result */ static ClampToRef(value: DeepImmutable, min: DeepImmutable, max: DeepImmutable, result: Vector3): void; /** * Returns a new Vector3 located for "amount" (float) on the Hermite interpolation spline defined by the vectors "value1", "tangent1", "value2", "tangent2" * @param value1 defines the first control point * @param tangent1 defines the first tangent vector * @param value2 defines the second control point * @param tangent2 defines the second tangent vector * @param amount defines the amount on the interpolation spline (between 0 and 1) * @returns the new Vector3 */ static Hermite(value1: DeepImmutable, tangent1: DeepImmutable, value2: DeepImmutable, tangent2: DeepImmutable, amount: number): Vector3; /** * Returns a new Vector3 located for "amount" (float) on the linear interpolation between the vectors "start" and "end" * @param start defines the start value * @param end defines the end value * @param amount max defines amount between both (between 0 and 1) * @returns the new Vector3 */ static Lerp(start: DeepImmutable, end: DeepImmutable, amount: number): Vector3; /** * Sets the given vector "result" with the result of the linear interpolation from the vector "start" for "amount" to the vector "end" * @param start defines the start value * @param end defines the end value * @param amount max defines amount between both (between 0 and 1) * @param result defines the Vector3 where to store the result */ static LerpToRef(start: DeepImmutable, end: DeepImmutable, amount: number, result: Vector3): void; /** * Returns the dot product (float) between the vectors "left" and "right" * @param left defines the left operand * @param right defines the right operand * @returns the dot product */ static Dot(left: DeepImmutable, right: DeepImmutable): number; /** * Returns a new Vector3 as the cross product of the vectors "left" and "right" * The cross product is then orthogonal to both "left" and "right" * @param left defines the left operand * @param right defines the right operand * @returns the cross product */ static Cross(left: DeepImmutable, right: DeepImmutable): Vector3; /** * Sets the given vector "result" with the cross product of "left" and "right" * The cross product is then orthogonal to both "left" and "right" * @param left defines the left operand * @param right defines the right operand * @param result defines the Vector3 where to store the result */ static CrossToRef(left: Vector3, right: Vector3, result: Vector3): void; /** * Returns a new Vector3 as the normalization of the given vector * @param vector defines the Vector3 to normalize * @returns the new Vector3 */ static Normalize(vector: DeepImmutable): Vector3; /** * Sets the given vector "result" with the normalization of the given first vector * @param vector defines the Vector3 to normalize * @param result defines the Vector3 where to store the result */ static NormalizeToRef(vector: DeepImmutable, result: Vector3): void; /** * Project a Vector3 onto screen space * @param vector defines the Vector3 to project * @param world defines the world matrix to use * @param transform defines the transform (view x projection) matrix to use * @param viewport defines the screen viewport to use * @returns the new Vector3 */ static Project(vector: DeepImmutable, world: DeepImmutable, transform: DeepImmutable, viewport: DeepImmutable): Vector3; /** @hidden */ static _UnprojectFromInvertedMatrixToRef(source: DeepImmutable, matrix: DeepImmutable, result: Vector3): void; /** * Unproject from screen space to object space * @param source defines the screen space Vector3 to use * @param viewportWidth defines the current width of the viewport * @param viewportHeight defines the current height of the viewport * @param world defines the world matrix to use (can be set to Identity to go to world space) * @param transform defines the transform (view x projection) matrix to use * @returns the new Vector3 */ static UnprojectFromTransform(source: Vector3, viewportWidth: number, viewportHeight: number, world: DeepImmutable, transform: DeepImmutable): Vector3; /** * Unproject from screen space to object space * @param source defines the screen space Vector3 to use * @param viewportWidth defines the current width of the viewport * @param viewportHeight defines the current height of the viewport * @param world defines the world matrix to use (can be set to Identity to go to world space) * @param view defines the view matrix to use * @param projection defines the projection matrix to use * @returns the new Vector3 */ static Unproject(source: DeepImmutable, viewportWidth: number, viewportHeight: number, world: DeepImmutable, view: DeepImmutable, projection: DeepImmutable): Vector3; /** * Unproject from screen space to object space * @param source defines the screen space Vector3 to use * @param viewportWidth defines the current width of the viewport * @param viewportHeight defines the current height of the viewport * @param world defines the world matrix to use (can be set to Identity to go to world space) * @param view defines the view matrix to use * @param projection defines the projection matrix to use * @param result defines the Vector3 where to store the result */ static UnprojectToRef(source: DeepImmutable, viewportWidth: number, viewportHeight: number, world: DeepImmutable, view: DeepImmutable, projection: DeepImmutable, result: Vector3): void; /** * Unproject from screen space to object space * @param sourceX defines the screen space x coordinate to use * @param sourceY defines the screen space y coordinate to use * @param sourceZ defines the screen space z coordinate to use * @param viewportWidth defines the current width of the viewport * @param viewportHeight defines the current height of the viewport * @param world defines the world matrix to use (can be set to Identity to go to world space) * @param view defines the view matrix to use * @param projection defines the projection matrix to use * @param result defines the Vector3 where to store the result */ static UnprojectFloatsToRef(sourceX: float, sourceY: float, sourceZ: float, viewportWidth: number, viewportHeight: number, world: DeepImmutable, view: DeepImmutable, projection: DeepImmutable, result: Vector3): void; /** * Gets the minimal coordinate values between two Vector3 * @param left defines the first operand * @param right defines the second operand * @returns the new Vector3 */ static Minimize(left: DeepImmutable, right: DeepImmutable): Vector3; /** * Gets the maximal coordinate values between two Vector3 * @param left defines the first operand * @param right defines the second operand * @returns the new Vector3 */ static Maximize(left: DeepImmutable, right: DeepImmutable): Vector3; /** * Returns the distance between the vectors "value1" and "value2" * @param value1 defines the first operand * @param value2 defines the second operand * @returns the distance */ static Distance(value1: DeepImmutable, value2: DeepImmutable): number; /** * Returns the squared distance between the vectors "value1" and "value2" * @param value1 defines the first operand * @param value2 defines the second operand * @returns the squared distance */ static DistanceSquared(value1: DeepImmutable, value2: DeepImmutable): number; /** * Returns a new Vector3 located at the center between "value1" and "value2" * @param value1 defines the first operand * @param value2 defines the second operand * @returns the new Vector3 */ static Center(value1: DeepImmutable, value2: DeepImmutable): Vector3; /** * Given three orthogonal normalized left-handed oriented Vector3 axis in space (target system), * RotationFromAxis() returns the rotation Euler angles (ex : rotation.x, rotation.y, rotation.z) to apply * to something in order to rotate it from its local system to the given target system * Note: axis1, axis2 and axis3 are normalized during this operation * @param axis1 defines the first axis * @param axis2 defines the second axis * @param axis3 defines the third axis * @returns a new Vector3 */ static RotationFromAxis(axis1: DeepImmutable, axis2: DeepImmutable, axis3: DeepImmutable): Vector3; /** * The same than RotationFromAxis but updates the given ref Vector3 parameter instead of returning a new Vector3 * @param axis1 defines the first axis * @param axis2 defines the second axis * @param axis3 defines the third axis * @param ref defines the Vector3 where to store the result */ static RotationFromAxisToRef(axis1: DeepImmutable, axis2: DeepImmutable, axis3: DeepImmutable, ref: Vector3): void; } /** * Vector4 class created for EulerAngle class conversion to Quaternion */ export class Vector4 { /** x value of the vector */ x: number; /** y value of the vector */ y: number; /** z value of the vector */ z: number; /** w value of the vector */ w: number; /** * Creates a Vector4 object from the given floats. * @param x x value of the vector * @param y y value of the vector * @param z z value of the vector * @param w w value of the vector */ constructor( /** x value of the vector */ x: number, /** y value of the vector */ y: number, /** z value of the vector */ z: number, /** w value of the vector */ w: number); /** * Returns the string with the Vector4 coordinates. * @returns a string containing all the vector values */ toString(): string; /** * Returns the string "Vector4". * @returns "Vector4" */ getClassName(): string; /** * Returns the Vector4 hash code. * @returns a unique hash code */ getHashCode(): number; /** * Returns a new array populated with 4 elements : the Vector4 coordinates. * @returns the resulting array */ asArray(): number[]; /** * Populates the given array from the given index with the Vector4 coordinates. * @param array array to populate * @param index index of the array to start at (default: 0) * @returns the Vector4. */ toArray(array: FloatArray, index?: number): Vector4; /** * Adds the given vector to the current Vector4. * @param otherVector the vector to add * @returns the updated Vector4. */ addInPlace(otherVector: DeepImmutable): Vector4; /** * Returns a new Vector4 as the result of the addition of the current Vector4 and the given one. * @param otherVector the vector to add * @returns the resulting vector */ add(otherVector: DeepImmutable): Vector4; /** * Updates the given vector "result" with the result of the addition of the current Vector4 and the given one. * @param otherVector the vector to add * @param result the vector to store the result * @returns the current Vector4. */ addToRef(otherVector: DeepImmutable, result: Vector4): Vector4; /** * Subtract in place the given vector from the current Vector4. * @param otherVector the vector to subtract * @returns the updated Vector4. */ subtractInPlace(otherVector: DeepImmutable): Vector4; /** * Returns a new Vector4 with the result of the subtraction of the given vector from the current Vector4. * @param otherVector the vector to add * @returns the new vector with the result */ subtract(otherVector: DeepImmutable): Vector4; /** * Sets the given vector "result" with the result of the subtraction of the given vector from the current Vector4. * @param otherVector the vector to subtract * @param result the vector to store the result * @returns the current Vector4. */ subtractToRef(otherVector: DeepImmutable, result: Vector4): Vector4; /** * Returns a new Vector4 set with the result of the subtraction of the given floats from the current Vector4 coordinates. */ /** * Returns a new Vector4 set with the result of the subtraction of the given floats from the current Vector4 coordinates. * @param x value to subtract * @param y value to subtract * @param z value to subtract * @param w value to subtract * @returns new vector containing the result */ subtractFromFloats(x: number, y: number, z: number, w: number): Vector4; /** * Sets the given vector "result" set with the result of the subtraction of the given floats from the current Vector4 coordinates. * @param x value to subtract * @param y value to subtract * @param z value to subtract * @param w value to subtract * @param result the vector to store the result in * @returns the current Vector4. */ subtractFromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): Vector4; /** * Returns a new Vector4 set with the current Vector4 negated coordinates. * @returns a new vector with the negated values */ negate(): Vector4; /** * Multiplies the current Vector4 coordinates by scale (float). * @param scale the number to scale with * @returns the updated Vector4. */ scaleInPlace(scale: number): Vector4; /** * Returns a new Vector4 set with the current Vector4 coordinates multiplied by scale (float). * @param scale the number to scale with * @returns a new vector with the result */ scale(scale: number): Vector4; /** * Sets the given vector "result" with the current Vector4 coordinates multiplied by scale (float). * @param scale the number to scale with * @param result a vector to store the result in * @returns the current Vector4. */ scaleToRef(scale: number, result: Vector4): Vector4; /** * Scale the current Vector4 values by a factor and add the result to a given Vector4 * @param scale defines the scale factor * @param result defines the Vector4 object where to store the result * @returns the unmodified current Vector4 */ scaleAndAddToRef(scale: number, result: Vector4): Vector4; /** * Boolean : True if the current Vector4 coordinates are stricly equal to the given ones. * @param otherVector the vector to compare against * @returns true if they are equal */ equals(otherVector: DeepImmutable): boolean; /** * Boolean : True if the current Vector4 coordinates are each beneath the distance "epsilon" from the given vector ones. * @param otherVector vector to compare against * @param epsilon (Default: very small number) * @returns true if they are equal */ equalsWithEpsilon(otherVector: DeepImmutable, epsilon?: number): boolean; /** * Boolean : True if the given floats are strictly equal to the current Vector4 coordinates. * @param x x value to compare against * @param y y value to compare against * @param z z value to compare against * @param w w value to compare against * @returns true if equal */ equalsToFloats(x: number, y: number, z: number, w: number): boolean; /** * Multiplies in place the current Vector4 by the given one. * @param otherVector vector to multiple with * @returns the updated Vector4. */ multiplyInPlace(otherVector: Vector4): Vector4; /** * Returns a new Vector4 set with the multiplication result of the current Vector4 and the given one. * @param otherVector vector to multiple with * @returns resulting new vector */ multiply(otherVector: DeepImmutable): Vector4; /** * Updates the given vector "result" with the multiplication result of the current Vector4 and the given one. * @param otherVector vector to multiple with * @param result vector to store the result * @returns the current Vector4. */ multiplyToRef(otherVector: DeepImmutable, result: Vector4): Vector4; /** * Returns a new Vector4 set with the multiplication result of the given floats and the current Vector4 coordinates. * @param x x value multiply with * @param y y value multiply with * @param z z value multiply with * @param w w value multiply with * @returns resulting new vector */ multiplyByFloats(x: number, y: number, z: number, w: number): Vector4; /** * Returns a new Vector4 set with the division result of the current Vector4 by the given one. * @param otherVector vector to devide with * @returns resulting new vector */ divide(otherVector: DeepImmutable): Vector4; /** * Updates the given vector "result" with the division result of the current Vector4 by the given one. * @param otherVector vector to devide with * @param result vector to store the result * @returns the current Vector4. */ divideToRef(otherVector: DeepImmutable, result: Vector4): Vector4; /** * Divides the current Vector3 coordinates by the given ones. * @param otherVector vector to devide with * @returns the updated Vector3. */ divideInPlace(otherVector: DeepImmutable): Vector4; /** * Updates the Vector4 coordinates with the minimum values between its own and the given vector ones * @param other defines the second operand * @returns the current updated Vector4 */ minimizeInPlace(other: DeepImmutable): Vector4; /** * Updates the Vector4 coordinates with the maximum values between its own and the given vector ones * @param other defines the second operand * @returns the current updated Vector4 */ maximizeInPlace(other: DeepImmutable): Vector4; /** * Gets a new Vector4 from current Vector4 floored values * @returns a new Vector4 */ floor(): Vector4; /** * Gets a new Vector4 from current Vector3 floored values * @returns a new Vector4 */ fract(): Vector4; /** * Returns the Vector4 length (float). * @returns the length */ length(): number; /** * Returns the Vector4 squared length (float). * @returns the length squared */ lengthSquared(): number; /** * Normalizes in place the Vector4. * @returns the updated Vector4. */ normalize(): Vector4; /** * Returns a new Vector3 from the Vector4 (x, y, z) coordinates. * @returns this converted to a new vector3 */ toVector3(): Vector3; /** * Returns a new Vector4 copied from the current one. * @returns the new cloned vector */ clone(): Vector4; /** * Updates the current Vector4 with the given one coordinates. * @param source the source vector to copy from * @returns the updated Vector4. */ copyFrom(source: DeepImmutable): Vector4; /** * Updates the current Vector4 coordinates with the given floats. * @param x float to copy from * @param y float to copy from * @param z float to copy from * @param w float to copy from * @returns the updated Vector4. */ copyFromFloats(x: number, y: number, z: number, w: number): Vector4; /** * Updates the current Vector4 coordinates with the given floats. * @param x float to set from * @param y float to set from * @param z float to set from * @param w float to set from * @returns the updated Vector4. */ set(x: number, y: number, z: number, w: number): Vector4; /** * Copies the given float to the current Vector3 coordinates * @param v defines the x, y, z and w coordinates of the operand * @returns the current updated Vector3 */ setAll(v: number): Vector4; /** * Returns a new Vector4 set from the starting index of the given array. * @param array the array to pull values from * @param offset the offset into the array to start at * @returns the new vector */ static FromArray(array: DeepImmutable>, offset?: number): Vector4; /** * Updates the given vector "result" from the starting index of the given array. * @param array the array to pull values from * @param offset the offset into the array to start at * @param result the vector to store the result in */ static FromArrayToRef(array: DeepImmutable>, offset: number, result: Vector4): void; /** * Updates the given vector "result" from the starting index of the given Float32Array. * @param array the array to pull values from * @param offset the offset into the array to start at * @param result the vector to store the result in */ static FromFloatArrayToRef(array: DeepImmutable, offset: number, result: Vector4): void; /** * Updates the given vector "result" coordinates from the given floats. * @param x float to set from * @param y float to set from * @param z float to set from * @param w float to set from * @param result the vector to the floats in */ static FromFloatsToRef(x: number, y: number, z: number, w: number, result: Vector4): void; /** * Returns a new Vector4 set to (0.0, 0.0, 0.0, 0.0) * @returns the new vector */ static Zero(): Vector4; /** * Returns a new Vector4 set to (1.0, 1.0, 1.0, 1.0) * @returns the new vector */ static One(): Vector4; /** * Returns a new normalized Vector4 from the given one. * @param vector the vector to normalize * @returns the vector */ static Normalize(vector: DeepImmutable): Vector4; /** * Updates the given vector "result" from the normalization of the given one. * @param vector the vector to normalize * @param result the vector to store the result in */ static NormalizeToRef(vector: DeepImmutable, result: Vector4): void; /** * Returns a vector with the minimum values from the left and right vectors * @param left left vector to minimize * @param right right vector to minimize * @returns a new vector with the minimum of the left and right vector values */ static Minimize(left: DeepImmutable, right: DeepImmutable): Vector4; /** * Returns a vector with the maximum values from the left and right vectors * @param left left vector to maximize * @param right right vector to maximize * @returns a new vector with the maximum of the left and right vector values */ static Maximize(left: DeepImmutable, right: DeepImmutable): Vector4; /** * Returns the distance (float) between the vectors "value1" and "value2". * @param value1 value to calulate the distance between * @param value2 value to calulate the distance between * @return the distance between the two vectors */ static Distance(value1: DeepImmutable, value2: DeepImmutable): number; /** * Returns the squared distance (float) between the vectors "value1" and "value2". * @param value1 value to calulate the distance between * @param value2 value to calulate the distance between * @return the distance between the two vectors squared */ static DistanceSquared(value1: DeepImmutable, value2: DeepImmutable): number; /** * Returns a new Vector4 located at the center between the vectors "value1" and "value2". * @param value1 value to calulate the center between * @param value2 value to calulate the center between * @return the center between the two vectors */ static Center(value1: DeepImmutable, value2: DeepImmutable): Vector4; /** * Returns a new Vector4 set with the result of the normal transformation by the given matrix of the given vector. * This methods computes transformed normalized direction vectors only. * @param vector the vector to transform * @param transformation the transformation matrix to apply * @returns the new vector */ static TransformNormal(vector: DeepImmutable, transformation: DeepImmutable): Vector4; /** * Sets the given vector "result" with the result of the normal transformation by the given matrix of the given vector. * This methods computes transformed normalized direction vectors only. * @param vector the vector to transform * @param transformation the transformation matrix to apply * @param result the vector to store the result in */ static TransformNormalToRef(vector: DeepImmutable, transformation: DeepImmutable, result: Vector4): void; /** * Sets the given vector "result" with the result of the normal transformation by the given matrix of the given floats (x, y, z, w). * This methods computes transformed normalized direction vectors only. * @param x value to transform * @param y value to transform * @param z value to transform * @param w value to transform * @param transformation the transformation matrix to apply * @param result the vector to store the results in */ static TransformNormalFromFloatsToRef(x: number, y: number, z: number, w: number, transformation: DeepImmutable, result: Vector4): void; /** * Creates a new Vector4 from a Vector3 * @param source defines the source data * @param w defines the 4th component (default is 0) * @returns a new Vector4 */ static FromVector3(source: Vector3, w?: number): Vector4; } /** * Interface for the size containing width and height */ export interface ISize { /** * Width */ width: number; /** * Heighht */ height: number; } /** * Size containing widht and height */ export class Size implements ISize { /** * Width */ width: number; /** * Height */ height: number; /** * Creates a Size object from the given width and height (floats). * @param width width of the new size * @param height height of the new size */ constructor(width: number, height: number); /** * Returns a string with the Size width and height * @returns a string with the Size width and height */ toString(): string; /** * "Size" * @returns the string "Size" */ getClassName(): string; /** * Returns the Size hash code. * @returns a hash code for a unique width and height */ getHashCode(): number; /** * Updates the current size from the given one. * @param src the given size */ copyFrom(src: Size): void; /** * Updates in place the current Size from the given floats. * @param width width of the new size * @param height height of the new size * @returns the updated Size. */ copyFromFloats(width: number, height: number): Size; /** * Updates in place the current Size from the given floats. * @param width width to set * @param height height to set * @returns the updated Size. */ set(width: number, height: number): Size; /** * Multiplies the width and height by numbers * @param w factor to multiple the width by * @param h factor to multiple the height by * @returns a new Size set with the multiplication result of the current Size and the given floats. */ multiplyByFloats(w: number, h: number): Size; /** * Clones the size * @returns a new Size copied from the given one. */ clone(): Size; /** * True if the current Size and the given one width and height are strictly equal. * @param other the other size to compare against * @returns True if the current Size and the given one width and height are strictly equal. */ equals(other: Size): boolean; /** * The surface of the Size : width * height (float). */ readonly surface: number; /** * Create a new size of zero * @returns a new Size set to (0.0, 0.0) */ static Zero(): Size; /** * Sums the width and height of two sizes * @param otherSize size to add to this size * @returns a new Size set as the addition result of the current Size and the given one. */ add(otherSize: Size): Size; /** * Subtracts the width and height of two * @param otherSize size to subtract to this size * @returns a new Size set as the subtraction result of the given one from the current Size. */ subtract(otherSize: Size): Size; /** * Creates a new Size set at the linear interpolation "amount" between "start" and "end" * @param start starting size to lerp between * @param end end size to lerp between * @param amount amount to lerp between the start and end values * @returns a new Size set at the linear interpolation "amount" between "start" and "end" */ static Lerp(start: Size, end: Size, amount: number): Size; } /** * Class used to store quaternion data * @see https://en.wikipedia.org/wiki/Quaternion * @see http://doc.babylonjs.com/features/position,_rotation,_scaling */ export class Quaternion { /** defines the first component (0 by default) */ x: number; /** defines the second component (0 by default) */ y: number; /** defines the third component (0 by default) */ z: number; /** defines the fourth component (1.0 by default) */ w: number; /** * Creates a new Quaternion from the given floats * @param x defines the first component (0 by default) * @param y defines the second component (0 by default) * @param z defines the third component (0 by default) * @param w defines the fourth component (1.0 by default) */ constructor( /** defines the first component (0 by default) */ x?: number, /** defines the second component (0 by default) */ y?: number, /** defines the third component (0 by default) */ z?: number, /** defines the fourth component (1.0 by default) */ w?: number); /** * Gets a string representation for the current quaternion * @returns a string with the Quaternion coordinates */ toString(): string; /** * Gets the class name of the quaternion * @returns the string "Quaternion" */ getClassName(): string; /** * Gets a hash code for this quaternion * @returns the quaternion hash code */ getHashCode(): number; /** * Copy the quaternion to an array * @returns a new array populated with 4 elements from the quaternion coordinates */ asArray(): number[]; /** * Check if two quaternions are equals * @param otherQuaternion defines the second operand * @return true if the current quaternion and the given one coordinates are strictly equals */ equals(otherQuaternion: DeepImmutable): boolean; /** * Clone the current quaternion * @returns a new quaternion copied from the current one */ clone(): Quaternion; /** * Copy a quaternion to the current one * @param other defines the other quaternion * @returns the updated current quaternion */ copyFrom(other: DeepImmutable): Quaternion; /** * Updates the current quaternion with the given float coordinates * @param x defines the x coordinate * @param y defines the y coordinate * @param z defines the z coordinate * @param w defines the w coordinate * @returns the updated current quaternion */ copyFromFloats(x: number, y: number, z: number, w: number): Quaternion; /** * Updates the current quaternion from the given float coordinates * @param x defines the x coordinate * @param y defines the y coordinate * @param z defines the z coordinate * @param w defines the w coordinate * @returns the updated current quaternion */ set(x: number, y: number, z: number, w: number): Quaternion; /** * Adds two quaternions * @param other defines the second operand * @returns a new quaternion as the addition result of the given one and the current quaternion */ add(other: DeepImmutable): Quaternion; /** * Add a quaternion to the current one * @param other defines the quaternion to add * @returns the current quaternion */ addInPlace(other: DeepImmutable): Quaternion; /** * Subtract two quaternions * @param other defines the second operand * @returns a new quaternion as the subtraction result of the given one from the current one */ subtract(other: Quaternion): Quaternion; /** * Multiplies the current quaternion by a scale factor * @param value defines the scale factor * @returns a new quaternion set by multiplying the current quaternion coordinates by the float "scale" */ scale(value: number): Quaternion; /** * Scale the current quaternion values by a factor and stores the result to a given quaternion * @param scale defines the scale factor * @param result defines the Quaternion object where to store the result * @returns the unmodified current quaternion */ scaleToRef(scale: number, result: Quaternion): Quaternion; /** * Multiplies in place the current quaternion by a scale factor * @param value defines the scale factor * @returns the current modified quaternion */ scaleInPlace(value: number): Quaternion; /** * Scale the current quaternion values by a factor and add the result to a given quaternion * @param scale defines the scale factor * @param result defines the Quaternion object where to store the result * @returns the unmodified current quaternion */ scaleAndAddToRef(scale: number, result: Quaternion): Quaternion; /** * Multiplies two quaternions * @param q1 defines the second operand * @returns a new quaternion set as the multiplication result of the current one with the given one "q1" */ multiply(q1: DeepImmutable): Quaternion; /** * Sets the given "result" as the the multiplication result of the current one with the given one "q1" * @param q1 defines the second operand * @param result defines the target quaternion * @returns the current quaternion */ multiplyToRef(q1: DeepImmutable, result: Quaternion): Quaternion; /** * Updates the current quaternion with the multiplication of itself with the given one "q1" * @param q1 defines the second operand * @returns the currentupdated quaternion */ multiplyInPlace(q1: DeepImmutable): Quaternion; /** * Conjugates (1-q) the current quaternion and stores the result in the given quaternion * @param ref defines the target quaternion * @returns the current quaternion */ conjugateToRef(ref: Quaternion): Quaternion; /** * Conjugates in place (1-q) the current quaternion * @returns the current updated quaternion */ conjugateInPlace(): Quaternion; /** * Conjugates in place (1-q) the current quaternion * @returns a new quaternion */ conjugate(): Quaternion; /** * Gets length of current quaternion * @returns the quaternion length (float) */ length(): number; /** * Normalize in place the current quaternion * @returns the current updated quaternion */ normalize(): Quaternion; /** * Returns a new Vector3 set with the Euler angles translated from the current quaternion * @param order is a reserved parameter and is ignore for now * @returns a new Vector3 containing the Euler angles */ toEulerAngles(order?: string): Vector3; /** * Sets the given vector3 "result" with the Euler angles translated from the current quaternion * @param result defines the vector which will be filled with the Euler angles * @param order is a reserved parameter and is ignore for now * @returns the current unchanged quaternion */ toEulerAnglesToRef(result: Vector3): Quaternion; /** * Updates the given rotation matrix with the current quaternion values * @param result defines the target matrix * @returns the current unchanged quaternion */ toRotationMatrix(result: Matrix): Quaternion; /** * Updates the current quaternion from the given rotation matrix values * @param matrix defines the source matrix * @returns the current updated quaternion */ fromRotationMatrix(matrix: DeepImmutable): Quaternion; /** * Creates a new quaternion from a rotation matrix * @param matrix defines the source matrix * @returns a new quaternion created from the given rotation matrix values */ static FromRotationMatrix(matrix: DeepImmutable): Quaternion; /** * Updates the given quaternion with the given rotation matrix values * @param matrix defines the source matrix * @param result defines the target quaternion */ static FromRotationMatrixToRef(matrix: DeepImmutable, result: Quaternion): void; /** * Returns the dot product (float) between the quaternions "left" and "right" * @param left defines the left operand * @param right defines the right operand * @returns the dot product */ static Dot(left: DeepImmutable, right: DeepImmutable): number; /** * Checks if the two quaternions are close to each other * @param quat0 defines the first quaternion to check * @param quat1 defines the second quaternion to check * @returns true if the two quaternions are close to each other */ static AreClose(quat0: DeepImmutable, quat1: DeepImmutable): boolean; /** * Creates an empty quaternion * @returns a new quaternion set to (0.0, 0.0, 0.0) */ static Zero(): Quaternion; /** * Inverse a given quaternion * @param q defines the source quaternion * @returns a new quaternion as the inverted current quaternion */ static Inverse(q: DeepImmutable): Quaternion; /** * Inverse a given quaternion * @param q defines the source quaternion * @param result the quaternion the result will be stored in * @returns the result quaternion */ static InverseToRef(q: Quaternion, result: Quaternion): Quaternion; /** * Creates an identity quaternion * @returns the identity quaternion */ static Identity(): Quaternion; /** * Gets a boolean indicating if the given quaternion is identity * @param quaternion defines the quaternion to check * @returns true if the quaternion is identity */ static IsIdentity(quaternion: DeepImmutable): boolean; /** * Creates a quaternion from a rotation around an axis * @param axis defines the axis to use * @param angle defines the angle to use * @returns a new quaternion created from the given axis (Vector3) and angle in radians (float) */ static RotationAxis(axis: DeepImmutable, angle: number): Quaternion; /** * Creates a rotation around an axis and stores it into the given quaternion * @param axis defines the axis to use * @param angle defines the angle to use * @param result defines the target quaternion * @returns the target quaternion */ static RotationAxisToRef(axis: DeepImmutable, angle: number, result: Quaternion): Quaternion; /** * Creates a new quaternion from data stored into an array * @param array defines the data source * @param offset defines the offset in the source array where the data starts * @returns a new quaternion */ static FromArray(array: DeepImmutable>, offset?: number): Quaternion; /** * Create a quaternion from Euler rotation angles * @param x Pitch * @param y Yaw * @param z Roll * @returns the new Quaternion */ static FromEulerAngles(x: number, y: number, z: number): Quaternion; /** * Updates a quaternion from Euler rotation angles * @param x Pitch * @param y Yaw * @param z Roll * @param result the quaternion to store the result * @returns the updated quaternion */ static FromEulerAnglesToRef(x: number, y: number, z: number, result: Quaternion): Quaternion; /** * Create a quaternion from Euler rotation vector * @param vec the Euler vector (x Pitch, y Yaw, z Roll) * @returns the new Quaternion */ static FromEulerVector(vec: DeepImmutable): Quaternion; /** * Updates a quaternion from Euler rotation vector * @param vec the Euler vector (x Pitch, y Yaw, z Roll) * @param result the quaternion to store the result * @returns the updated quaternion */ static FromEulerVectorToRef(vec: DeepImmutable, result: Quaternion): Quaternion; /** * Creates a new quaternion from the given Euler float angles (y, x, z) * @param yaw defines the rotation around Y axis * @param pitch defines the rotation around X axis * @param roll defines the rotation around Z axis * @returns the new quaternion */ static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Quaternion; /** * Creates a new rotation from the given Euler float angles (y, x, z) and stores it in the target quaternion * @param yaw defines the rotation around Y axis * @param pitch defines the rotation around X axis * @param roll defines the rotation around Z axis * @param result defines the target quaternion */ static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Quaternion): void; /** * Creates a new quaternion from the given Euler float angles expressed in z-x-z orientation * @param alpha defines the rotation around first axis * @param beta defines the rotation around second axis * @param gamma defines the rotation around third axis * @returns the new quaternion */ static RotationAlphaBetaGamma(alpha: number, beta: number, gamma: number): Quaternion; /** * Creates a new quaternion from the given Euler float angles expressed in z-x-z orientation and stores it in the target quaternion * @param alpha defines the rotation around first axis * @param beta defines the rotation around second axis * @param gamma defines the rotation around third axis * @param result defines the target quaternion */ static RotationAlphaBetaGammaToRef(alpha: number, beta: number, gamma: number, result: Quaternion): void; /** * Creates a new quaternion containing the rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system (axis1, axis2 and axis3 are normalized during this operation) * @param axis1 defines the first axis * @param axis2 defines the second axis * @param axis3 defines the third axis * @returns the new quaternion */ static RotationQuaternionFromAxis(axis1: DeepImmutable, axis2: DeepImmutable, axis3: DeepImmutable): Quaternion; /** * Creates a rotation value to reach the target (axis1, axis2, axis3) orientation as a rotated XYZ system (axis1, axis2 and axis3 are normalized during this operation) and stores it in the target quaternion * @param axis1 defines the first axis * @param axis2 defines the second axis * @param axis3 defines the third axis * @param ref defines the target quaternion */ static RotationQuaternionFromAxisToRef(axis1: DeepImmutable, axis2: DeepImmutable, axis3: DeepImmutable, ref: Quaternion): void; /** * Interpolates between two quaternions * @param left defines first quaternion * @param right defines second quaternion * @param amount defines the gradient to use * @returns the new interpolated quaternion */ static Slerp(left: DeepImmutable, right: DeepImmutable, amount: number): Quaternion; /** * Interpolates between two quaternions and stores it into a target quaternion * @param left defines first quaternion * @param right defines second quaternion * @param amount defines the gradient to use * @param result defines the target quaternion */ static SlerpToRef(left: DeepImmutable, right: DeepImmutable, amount: number, result: Quaternion): void; /** * Interpolate between two quaternions using Hermite interpolation * @param value1 defines first quaternion * @param tangent1 defines the incoming tangent * @param value2 defines second quaternion * @param tangent2 defines the outgoing tangent * @param amount defines the target quaternion * @returns the new interpolated quaternion */ static Hermite(value1: DeepImmutable, tangent1: DeepImmutable, value2: DeepImmutable, tangent2: DeepImmutable, amount: number): Quaternion; } /** * Class used to store matrix data (4x4) */ export class Matrix { private static _updateFlagSeed; private static _identityReadOnly; private _isIdentity; private _isIdentityDirty; private _isIdentity3x2; private _isIdentity3x2Dirty; /** * Gets the update flag of the matrix which is an unique number for the matrix. * It will be incremented every time the matrix data change. * You can use it to speed the comparison between two versions of the same matrix. */ updateFlag: number; private readonly _m; /** * Gets the internal data of the matrix */ readonly m: DeepImmutable; /** @hidden */ _markAsUpdated(): void; /** @hidden */ private _updateIdentityStatus; /** * Creates an empty matrix (filled with zeros) */ constructor(); /** * Check if the current matrix is identity * @returns true is the matrix is the identity matrix */ isIdentity(): boolean; /** * Check if the current matrix is identity as a texture matrix (3x2 store in 4x4) * @returns true is the matrix is the identity matrix */ isIdentityAs3x2(): boolean; /** * Gets the determinant of the matrix * @returns the matrix determinant */ determinant(): number; /** * Returns the matrix as a Float32Array * @returns the matrix underlying array */ toArray(): DeepImmutable; /** * Returns the matrix as a Float32Array * @returns the matrix underlying array. */ asArray(): DeepImmutable; /** * Inverts the current matrix in place * @returns the current inverted matrix */ invert(): Matrix; /** * Sets all the matrix elements to zero * @returns the current matrix */ reset(): Matrix; /** * Adds the current matrix with a second one * @param other defines the matrix to add * @returns a new matrix as the addition of the current matrix and the given one */ add(other: DeepImmutable): Matrix; /** * Sets the given matrix "result" to the addition of the current matrix and the given one * @param other defines the matrix to add * @param result defines the target matrix * @returns the current matrix */ addToRef(other: DeepImmutable, result: Matrix): Matrix; /** * Adds in place the given matrix to the current matrix * @param other defines the second operand * @returns the current updated matrix */ addToSelf(other: DeepImmutable): Matrix; /** * Sets the given matrix to the current inverted Matrix * @param other defines the target matrix * @returns the unmodified current matrix */ invertToRef(other: Matrix): Matrix; /** * add a value at the specified position in the current Matrix * @param index the index of the value within the matrix. between 0 and 15. * @param value the value to be added * @returns the current updated matrix */ addAtIndex(index: number, value: number): Matrix; /** * mutiply the specified position in the current Matrix by a value * @param index the index of the value within the matrix. between 0 and 15. * @param value the value to be added * @returns the current updated matrix */ multiplyAtIndex(index: number, value: number): Matrix; /** * Inserts the translation vector (using 3 floats) in the current matrix * @param x defines the 1st component of the translation * @param y defines the 2nd component of the translation * @param z defines the 3rd component of the translation * @returns the current updated matrix */ setTranslationFromFloats(x: number, y: number, z: number): Matrix; /** * Adds the translation vector (using 3 floats) in the current matrix * @param x defines the 1st component of the translation * @param y defines the 2nd component of the translation * @param z defines the 3rd component of the translation * @returns the current updated matrix */ addTranslationFromFloats(x: number, y: number, z: number): Matrix; /** * Inserts the translation vector in the current matrix * @param vector3 defines the translation to insert * @returns the current updated matrix */ setTranslation(vector3: DeepImmutable): Matrix; /** * Gets the translation value of the current matrix * @returns a new Vector3 as the extracted translation from the matrix */ getTranslation(): Vector3; /** * Fill a Vector3 with the extracted translation from the matrix * @param result defines the Vector3 where to store the translation * @returns the current matrix */ getTranslationToRef(result: Vector3): Matrix; /** * Remove rotation and scaling part from the matrix * @returns the updated matrix */ removeRotationAndScaling(): Matrix; /** * Multiply two matrices * @param other defines the second operand * @returns a new matrix set with the multiplication result of the current Matrix and the given one */ multiply(other: DeepImmutable): Matrix; /** * Copy the current matrix from the given one * @param other defines the source matrix * @returns the current updated matrix */ copyFrom(other: DeepImmutable): Matrix; /** * Populates the given array from the starting index with the current matrix values * @param array defines the target array * @param offset defines the offset in the target array where to start storing values * @returns the current matrix */ copyToArray(array: Float32Array, offset?: number): Matrix; /** * Sets the given matrix "result" with the multiplication result of the current Matrix and the given one * @param other defines the second operand * @param result defines the matrix where to store the multiplication * @returns the current matrix */ multiplyToRef(other: DeepImmutable, result: Matrix): Matrix; /** * Sets the Float32Array "result" from the given index "offset" with the multiplication of the current matrix and the given one * @param other defines the second operand * @param result defines the array where to store the multiplication * @param offset defines the offset in the target array where to start storing values * @returns the current matrix */ multiplyToArray(other: DeepImmutable, result: Float32Array, offset: number): Matrix; /** * Check equality between this matrix and a second one * @param value defines the second matrix to compare * @returns true is the current matrix and the given one values are strictly equal */ equals(value: DeepImmutable): boolean; /** * Clone the current matrix * @returns a new matrix from the current matrix */ clone(): Matrix; /** * Returns the name of the current matrix class * @returns the string "Matrix" */ getClassName(): string; /** * Gets the hash code of the current matrix * @returns the hash code */ getHashCode(): number; /** * Decomposes the current Matrix into a translation, rotation and scaling components * @param scale defines the scale vector3 given as a reference to update * @param rotation defines the rotation quaternion given as a reference to update * @param translation defines the translation vector3 given as a reference to update * @returns true if operation was successful */ decompose(scale?: Vector3, rotation?: Quaternion, translation?: Vector3): boolean; /** * Gets specific row of the matrix * @param index defines the number of the row to get * @returns the index-th row of the current matrix as a new Vector4 */ getRow(index: number): Nullable; /** * Sets the index-th row of the current matrix to the vector4 values * @param index defines the number of the row to set * @param row defines the target vector4 * @returns the updated current matrix */ setRow(index: number, row: Vector4): Matrix; /** * Compute the transpose of the matrix * @returns the new transposed matrix */ transpose(): Matrix; /** * Compute the transpose of the matrix and store it in a given matrix * @param result defines the target matrix * @returns the current matrix */ transposeToRef(result: Matrix): Matrix; /** * Sets the index-th row of the current matrix with the given 4 x float values * @param index defines the row index * @param x defines the x component to set * @param y defines the y component to set * @param z defines the z component to set * @param w defines the w component to set * @returns the updated current matrix */ setRowFromFloats(index: number, x: number, y: number, z: number, w: number): Matrix; /** * Compute a new matrix set with the current matrix values multiplied by scale (float) * @param scale defines the scale factor * @returns a new matrix */ scale(scale: number): Matrix; /** * Scale the current matrix values by a factor to a given result matrix * @param scale defines the scale factor * @param result defines the matrix to store the result * @returns the current matrix */ scaleToRef(scale: number, result: Matrix): Matrix; /** * Scale the current matrix values by a factor and add the result to a given matrix * @param scale defines the scale factor * @param result defines the Matrix to store the result * @returns the current matrix */ scaleAndAddToRef(scale: number, result: Matrix): Matrix; /** * Writes to the given matrix a normal matrix, computed from this one (using values from identity matrix for fourth row and column). * @param ref matrix to store the result */ toNormalMatrix(ref: Matrix): void; /** * Gets only rotation part of the current matrix * @returns a new matrix sets to the extracted rotation matrix from the current one */ getRotationMatrix(): Matrix; /** * Extracts the rotation matrix from the current one and sets it as the given "result" * @param result defines the target matrix to store data to * @returns the current matrix */ getRotationMatrixToRef(result: Matrix): Matrix; /** * Toggles model matrix from being right handed to left handed in place and vice versa */ toggleModelMatrixHandInPlace(): void; /** * Toggles projection matrix from being right handed to left handed in place and vice versa */ toggleProjectionMatrixHandInPlace(): void; /** * Creates a matrix from an array * @param array defines the source array * @param offset defines an offset in the source array * @returns a new Matrix set from the starting index of the given array */ static FromArray(array: DeepImmutable>, offset?: number): Matrix; /** * Copy the content of an array into a given matrix * @param array defines the source array * @param offset defines an offset in the source array * @param result defines the target matrix */ static FromArrayToRef(array: DeepImmutable>, offset: number, result: Matrix): void; /** * Stores an array into a matrix after having multiplied each component by a given factor * @param array defines the source array * @param offset defines the offset in the source array * @param scale defines the scaling factor * @param result defines the target matrix */ static FromFloat32ArrayToRefScaled(array: DeepImmutable, offset: number, scale: number, result: Matrix): void; /** * Gets an identity matrix that must not be updated */ static readonly IdentityReadOnly: DeepImmutable; /** * Stores a list of values (16) inside a given matrix * @param initialM11 defines 1st value of 1st row * @param initialM12 defines 2nd value of 1st row * @param initialM13 defines 3rd value of 1st row * @param initialM14 defines 4th value of 1st row * @param initialM21 defines 1st value of 2nd row * @param initialM22 defines 2nd value of 2nd row * @param initialM23 defines 3rd value of 2nd row * @param initialM24 defines 4th value of 2nd row * @param initialM31 defines 1st value of 3rd row * @param initialM32 defines 2nd value of 3rd row * @param initialM33 defines 3rd value of 3rd row * @param initialM34 defines 4th value of 3rd row * @param initialM41 defines 1st value of 4th row * @param initialM42 defines 2nd value of 4th row * @param initialM43 defines 3rd value of 4th row * @param initialM44 defines 4th value of 4th row * @param result defines the target matrix */ static FromValuesToRef(initialM11: number, initialM12: number, initialM13: number, initialM14: number, initialM21: number, initialM22: number, initialM23: number, initialM24: number, initialM31: number, initialM32: number, initialM33: number, initialM34: number, initialM41: number, initialM42: number, initialM43: number, initialM44: number, result: Matrix): void; /** * Creates new matrix from a list of values (16) * @param initialM11 defines 1st value of 1st row * @param initialM12 defines 2nd value of 1st row * @param initialM13 defines 3rd value of 1st row * @param initialM14 defines 4th value of 1st row * @param initialM21 defines 1st value of 2nd row * @param initialM22 defines 2nd value of 2nd row * @param initialM23 defines 3rd value of 2nd row * @param initialM24 defines 4th value of 2nd row * @param initialM31 defines 1st value of 3rd row * @param initialM32 defines 2nd value of 3rd row * @param initialM33 defines 3rd value of 3rd row * @param initialM34 defines 4th value of 3rd row * @param initialM41 defines 1st value of 4th row * @param initialM42 defines 2nd value of 4th row * @param initialM43 defines 3rd value of 4th row * @param initialM44 defines 4th value of 4th row * @returns the new matrix */ static FromValues(initialM11: number, initialM12: number, initialM13: number, initialM14: number, initialM21: number, initialM22: number, initialM23: number, initialM24: number, initialM31: number, initialM32: number, initialM33: number, initialM34: number, initialM41: number, initialM42: number, initialM43: number, initialM44: number): Matrix; /** * Creates a new matrix composed by merging scale (vector3), rotation (quaternion) and translation (vector3) * @param scale defines the scale vector3 * @param rotation defines the rotation quaternion * @param translation defines the translation vector3 * @returns a new matrix */ static Compose(scale: DeepImmutable, rotation: DeepImmutable, translation: DeepImmutable): Matrix; /** * Sets a matrix to a value composed by merging scale (vector3), rotation (quaternion) and translation (vector3) * @param scale defines the scale vector3 * @param rotation defines the rotation quaternion * @param translation defines the translation vector3 * @param result defines the target matrix */ static ComposeToRef(scale: DeepImmutable, rotation: DeepImmutable, translation: DeepImmutable, result: Matrix): void; /** * Creates a new identity matrix * @returns a new identity matrix */ static Identity(): Matrix; /** * Creates a new identity matrix and stores the result in a given matrix * @param result defines the target matrix */ static IdentityToRef(result: Matrix): void; /** * Creates a new zero matrix * @returns a new zero matrix */ static Zero(): Matrix; /** * Creates a new rotation matrix for "angle" radians around the X axis * @param angle defines the angle (in radians) to use * @return the new matrix */ static RotationX(angle: number): Matrix; /** * Creates a new matrix as the invert of a given matrix * @param source defines the source matrix * @returns the new matrix */ static Invert(source: DeepImmutable): Matrix; /** * Creates a new rotation matrix for "angle" radians around the X axis and stores it in a given matrix * @param angle defines the angle (in radians) to use * @param result defines the target matrix */ static RotationXToRef(angle: number, result: Matrix): void; /** * Creates a new rotation matrix for "angle" radians around the Y axis * @param angle defines the angle (in radians) to use * @return the new matrix */ static RotationY(angle: number): Matrix; /** * Creates a new rotation matrix for "angle" radians around the Y axis and stores it in a given matrix * @param angle defines the angle (in radians) to use * @param result defines the target matrix */ static RotationYToRef(angle: number, result: Matrix): void; /** * Creates a new rotation matrix for "angle" radians around the Z axis * @param angle defines the angle (in radians) to use * @return the new matrix */ static RotationZ(angle: number): Matrix; /** * Creates a new rotation matrix for "angle" radians around the Z axis and stores it in a given matrix * @param angle defines the angle (in radians) to use * @param result defines the target matrix */ static RotationZToRef(angle: number, result: Matrix): void; /** * Creates a new rotation matrix for "angle" radians around the given axis * @param axis defines the axis to use * @param angle defines the angle (in radians) to use * @return the new matrix */ static RotationAxis(axis: DeepImmutable, angle: number): Matrix; /** * Creates a new rotation matrix for "angle" radians around the given axis and stores it in a given matrix * @param axis defines the axis to use * @param angle defines the angle (in radians) to use * @param result defines the target matrix */ static RotationAxisToRef(axis: DeepImmutable, angle: number, result: Matrix): void; /** * Takes normalised vectors and returns a rotation matrix to align "from" with "to". * Taken from http://www.iquilezles.org/www/articles/noacos/noacos.htm * @param from defines the vector to align * @param to defines the vector to align to * @param result defines the target matrix */ static RotationAlignToRef(from: DeepImmutable, to: DeepImmutable, result: Matrix): void; /** * Creates a rotation matrix * @param yaw defines the yaw angle in radians (Y axis) * @param pitch defines the pitch angle in radians (X axis) * @param roll defines the roll angle in radians (X axis) * @returns the new rotation matrix */ static RotationYawPitchRoll(yaw: number, pitch: number, roll: number): Matrix; /** * Creates a rotation matrix and stores it in a given matrix * @param yaw defines the yaw angle in radians (Y axis) * @param pitch defines the pitch angle in radians (X axis) * @param roll defines the roll angle in radians (X axis) * @param result defines the target matrix */ static RotationYawPitchRollToRef(yaw: number, pitch: number, roll: number, result: Matrix): void; /** * Creates a scaling matrix * @param x defines the scale factor on X axis * @param y defines the scale factor on Y axis * @param z defines the scale factor on Z axis * @returns the new matrix */ static Scaling(x: number, y: number, z: number): Matrix; /** * Creates a scaling matrix and stores it in a given matrix * @param x defines the scale factor on X axis * @param y defines the scale factor on Y axis * @param z defines the scale factor on Z axis * @param result defines the target matrix */ static ScalingToRef(x: number, y: number, z: number, result: Matrix): void; /** * Creates a translation matrix * @param x defines the translation on X axis * @param y defines the translation on Y axis * @param z defines the translationon Z axis * @returns the new matrix */ static Translation(x: number, y: number, z: number): Matrix; /** * Creates a translation matrix and stores it in a given matrix * @param x defines the translation on X axis * @param y defines the translation on Y axis * @param z defines the translationon Z axis * @param result defines the target matrix */ static TranslationToRef(x: number, y: number, z: number, result: Matrix): void; /** * Returns a new Matrix whose values are the interpolated values for "gradient" (float) between the ones of the matrices "startValue" and "endValue". * @param startValue defines the start value * @param endValue defines the end value * @param gradient defines the gradient factor * @returns the new matrix */ static Lerp(startValue: DeepImmutable, endValue: DeepImmutable, gradient: number): Matrix; /** * Set the given matrix "result" as the interpolated values for "gradient" (float) between the ones of the matrices "startValue" and "endValue". * @param startValue defines the start value * @param endValue defines the end value * @param gradient defines the gradient factor * @param result defines the Matrix object where to store data */ static LerpToRef(startValue: DeepImmutable, endValue: DeepImmutable, gradient: number, result: Matrix): void; /** * Builds a new matrix whose values are computed by: * * decomposing the the "startValue" and "endValue" matrices into their respective scale, rotation and translation matrices * * interpolating for "gradient" (float) the values between each of these decomposed matrices between the start and the end * * recomposing a new matrix from these 3 interpolated scale, rotation and translation matrices * @param startValue defines the first matrix * @param endValue defines the second matrix * @param gradient defines the gradient between the two matrices * @returns the new matrix */ static DecomposeLerp(startValue: DeepImmutable, endValue: DeepImmutable, gradient: number): Matrix; /** * Update a matrix to values which are computed by: * * decomposing the the "startValue" and "endValue" matrices into their respective scale, rotation and translation matrices * * interpolating for "gradient" (float) the values between each of these decomposed matrices between the start and the end * * recomposing a new matrix from these 3 interpolated scale, rotation and translation matrices * @param startValue defines the first matrix * @param endValue defines the second matrix * @param gradient defines the gradient between the two matrices * @param result defines the target matrix */ static DecomposeLerpToRef(startValue: DeepImmutable, endValue: DeepImmutable, gradient: number, result: Matrix): void; /** * Gets a new rotation matrix used to rotate an entity so as it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like "up" * This function works in left handed mode * @param eye defines the final position of the entity * @param target defines where the entity should look at * @param up defines the up vector for the entity * @returns the new matrix */ static LookAtLH(eye: DeepImmutable, target: DeepImmutable, up: DeepImmutable): Matrix; /** * Sets the given "result" Matrix to a rotation matrix used to rotate an entity so that it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like "up". * This function works in left handed mode * @param eye defines the final position of the entity * @param target defines where the entity should look at * @param up defines the up vector for the entity * @param result defines the target matrix */ static LookAtLHToRef(eye: DeepImmutable, target: DeepImmutable, up: DeepImmutable, result: Matrix): void; /** * Gets a new rotation matrix used to rotate an entity so as it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like "up" * This function works in right handed mode * @param eye defines the final position of the entity * @param target defines where the entity should look at * @param up defines the up vector for the entity * @returns the new matrix */ static LookAtRH(eye: DeepImmutable, target: DeepImmutable, up: DeepImmutable): Matrix; /** * Sets the given "result" Matrix to a rotation matrix used to rotate an entity so that it looks at the target vector3, from the eye vector3 position, the up vector3 being oriented like "up". * This function works in right handed mode * @param eye defines the final position of the entity * @param target defines where the entity should look at * @param up defines the up vector for the entity * @param result defines the target matrix */ static LookAtRHToRef(eye: DeepImmutable, target: DeepImmutable, up: DeepImmutable, result: Matrix): void; /** * Create a left-handed orthographic projection matrix * @param width defines the viewport width * @param height defines the viewport height * @param znear defines the near clip plane * @param zfar defines the far clip plane * @returns a new matrix as a left-handed orthographic projection matrix */ static OrthoLH(width: number, height: number, znear: number, zfar: number): Matrix; /** * Store a left-handed orthographic projection to a given matrix * @param width defines the viewport width * @param height defines the viewport height * @param znear defines the near clip plane * @param zfar defines the far clip plane * @param result defines the target matrix */ static OrthoLHToRef(width: number, height: number, znear: number, zfar: number, result: Matrix): void; /** * Create a left-handed orthographic projection matrix * @param left defines the viewport left coordinate * @param right defines the viewport right coordinate * @param bottom defines the viewport bottom coordinate * @param top defines the viewport top coordinate * @param znear defines the near clip plane * @param zfar defines the far clip plane * @returns a new matrix as a left-handed orthographic projection matrix */ static OrthoOffCenterLH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix; /** * Stores a left-handed orthographic projection into a given matrix * @param left defines the viewport left coordinate * @param right defines the viewport right coordinate * @param bottom defines the viewport bottom coordinate * @param top defines the viewport top coordinate * @param znear defines the near clip plane * @param zfar defines the far clip plane * @param result defines the target matrix */ static OrthoOffCenterLHToRef(left: number, right: number, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void; /** * Creates a right-handed orthographic projection matrix * @param left defines the viewport left coordinate * @param right defines the viewport right coordinate * @param bottom defines the viewport bottom coordinate * @param top defines the viewport top coordinate * @param znear defines the near clip plane * @param zfar defines the far clip plane * @returns a new matrix as a right-handed orthographic projection matrix */ static OrthoOffCenterRH(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): Matrix; /** * Stores a right-handed orthographic projection into a given matrix * @param left defines the viewport left coordinate * @param right defines the viewport right coordinate * @param bottom defines the viewport bottom coordinate * @param top defines the viewport top coordinate * @param znear defines the near clip plane * @param zfar defines the far clip plane * @param result defines the target matrix */ static OrthoOffCenterRHToRef(left: number, right: number, bottom: number, top: number, znear: number, zfar: number, result: Matrix): void; /** * Creates a left-handed perspective projection matrix * @param width defines the viewport width * @param height defines the viewport height * @param znear defines the near clip plane * @param zfar defines the far clip plane * @returns a new matrix as a left-handed perspective projection matrix */ static PerspectiveLH(width: number, height: number, znear: number, zfar: number): Matrix; /** * Creates a left-handed perspective projection matrix * @param fov defines the horizontal field of view * @param aspect defines the aspect ratio * @param znear defines the near clip plane * @param zfar defines the far clip plane * @returns a new matrix as a left-handed perspective projection matrix */ static PerspectiveFovLH(fov: number, aspect: number, znear: number, zfar: number): Matrix; /** * Stores a left-handed perspective projection into a given matrix * @param fov defines the horizontal field of view * @param aspect defines the aspect ratio * @param znear defines the near clip plane * @param zfar defines the far clip plane * @param result defines the target matrix * @param isVerticalFovFixed defines it the fov is vertically fixed (default) or horizontally */ static PerspectiveFovLHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix, isVerticalFovFixed?: boolean): void; /** * Creates a right-handed perspective projection matrix * @param fov defines the horizontal field of view * @param aspect defines the aspect ratio * @param znear defines the near clip plane * @param zfar defines the far clip plane * @returns a new matrix as a right-handed perspective projection matrix */ static PerspectiveFovRH(fov: number, aspect: number, znear: number, zfar: number): Matrix; /** * Stores a right-handed perspective projection into a given matrix * @param fov defines the horizontal field of view * @param aspect defines the aspect ratio * @param znear defines the near clip plane * @param zfar defines the far clip plane * @param result defines the target matrix * @param isVerticalFovFixed defines it the fov is vertically fixed (default) or horizontally */ static PerspectiveFovRHToRef(fov: number, aspect: number, znear: number, zfar: number, result: Matrix, isVerticalFovFixed?: boolean): void; /** * Stores a perspective projection for WebVR info a given matrix * @param fov defines the field of view * @param znear defines the near clip plane * @param zfar defines the far clip plane * @param result defines the target matrix * @param rightHanded defines if the matrix must be in right-handed mode (false by default) */ static PerspectiveFovWebVRToRef(fov: { upDegrees: number; downDegrees: number; leftDegrees: number; rightDegrees: number; }, znear: number, zfar: number, result: Matrix, rightHanded?: boolean): void; /** * Computes a complete transformation matrix * @param viewport defines the viewport to use * @param world defines the world matrix * @param view defines the view matrix * @param projection defines the projection matrix * @param zmin defines the near clip plane * @param zmax defines the far clip plane * @returns the transformation matrix */ static GetFinalMatrix(viewport: DeepImmutable, world: DeepImmutable, view: DeepImmutable, projection: DeepImmutable, zmin: number, zmax: number): Matrix; /** * Extracts a 2x2 matrix from a given matrix and store the result in a Float32Array * @param matrix defines the matrix to use * @returns a new Float32Array array with 4 elements : the 2x2 matrix extracted from the given matrix */ static GetAsMatrix2x2(matrix: DeepImmutable): Float32Array; /** * Extracts a 3x3 matrix from a given matrix and store the result in a Float32Array * @param matrix defines the matrix to use * @returns a new Float32Array array with 9 elements : the 3x3 matrix extracted from the given matrix */ static GetAsMatrix3x3(matrix: DeepImmutable): Float32Array; /** * Compute the transpose of a given matrix * @param matrix defines the matrix to transpose * @returns the new matrix */ static Transpose(matrix: DeepImmutable): Matrix; /** * Compute the transpose of a matrix and store it in a target matrix * @param matrix defines the matrix to transpose * @param result defines the target matrix */ static TransposeToRef(matrix: DeepImmutable, result: Matrix): void; /** * Computes a reflection matrix from a plane * @param plane defines the reflection plane * @returns a new matrix */ static Reflection(plane: DeepImmutable): Matrix; /** * Computes a reflection matrix from a plane * @param plane defines the reflection plane * @param result defines the target matrix */ static ReflectionToRef(plane: DeepImmutable, result: Matrix): void; /** * Sets the given matrix as a rotation matrix composed from the 3 left handed axes * @param xaxis defines the value of the 1st axis * @param yaxis defines the value of the 2nd axis * @param zaxis defines the value of the 3rd axis * @param result defines the target matrix */ static FromXYZAxesToRef(xaxis: DeepImmutable, yaxis: DeepImmutable, zaxis: DeepImmutable, result: Matrix): void; /** * Creates a rotation matrix from a quaternion and stores it in a target matrix * @param quat defines the quaternion to use * @param result defines the target matrix */ static FromQuaternionToRef(quat: DeepImmutable, result: Matrix): void; } /** * Represens a plane by the equation ax + by + cz + d = 0 */ export class Plane { /** * Normal of the plane (a,b,c) */ normal: Vector3; /** * d component of the plane */ d: number; /** * Creates a Plane object according to the given floats a, b, c, d and the plane equation : ax + by + cz + d = 0 * @param a a component of the plane * @param b b component of the plane * @param c c component of the plane * @param d d component of the plane */ constructor(a: number, b: number, c: number, d: number); /** * @returns the plane coordinates as a new array of 4 elements [a, b, c, d]. */ asArray(): number[]; /** * @returns a new plane copied from the current Plane. */ clone(): Plane; /** * @returns the string "Plane". */ getClassName(): string; /** * @returns the Plane hash code. */ getHashCode(): number; /** * Normalize the current Plane in place. * @returns the updated Plane. */ normalize(): Plane; /** * Applies a transformation the plane and returns the result * @param transformation the transformation matrix to be applied to the plane * @returns a new Plane as the result of the transformation of the current Plane by the given matrix. */ transform(transformation: DeepImmutable): Plane; /** * Calcualtte the dot product between the point and the plane normal * @param point point to calculate the dot product with * @returns the dot product (float) of the point coordinates and the plane normal. */ dotCoordinate(point: DeepImmutable): number; /** * Updates the current Plane from the plane defined by the three given points. * @param point1 one of the points used to contruct the plane * @param point2 one of the points used to contruct the plane * @param point3 one of the points used to contruct the plane * @returns the updated Plane. */ copyFromPoints(point1: DeepImmutable, point2: DeepImmutable, point3: DeepImmutable): Plane; /** * Checks if the plane is facing a given direction * @param direction the direction to check if the plane is facing * @param epsilon value the dot product is compared against (returns true if dot <= epsilon) * @returns True is the vector "direction" is the same side than the plane normal. */ isFrontFacingTo(direction: DeepImmutable, epsilon: number): boolean; /** * Calculates the distance to a point * @param point point to calculate distance to * @returns the signed distance (float) from the given point to the Plane. */ signedDistanceTo(point: DeepImmutable): number; /** * Creates a plane from an array * @param array the array to create a plane from * @returns a new Plane from the given array. */ static FromArray(array: DeepImmutable>): Plane; /** * Creates a plane from three points * @param point1 point used to create the plane * @param point2 point used to create the plane * @param point3 point used to create the plane * @returns a new Plane defined by the three given points. */ static FromPoints(point1: DeepImmutable, point2: DeepImmutable, point3: DeepImmutable): Plane; /** * Creates a plane from an origin point and a normal * @param origin origin of the plane to be constructed * @param normal normal of the plane to be constructed * @returns a new Plane the normal vector to this plane at the given origin point. * Note : the vector "normal" is updated because normalized. */ static FromPositionAndNormal(origin: DeepImmutable, normal: DeepImmutable): Plane; /** * Calculates the distance from a plane and a point * @param origin origin of the plane to be constructed * @param normal normal of the plane to be constructed * @param point point to calculate distance to * @returns the signed distance between the plane defined by the normal vector at the "origin"" point and the given other point. */ static SignedDistanceToPlaneFromPositionAndNormal(origin: DeepImmutable, normal: DeepImmutable, point: DeepImmutable): number; } /** * Class used to represent a viewport on screen */ export class Viewport { /** viewport left coordinate */ x: number; /** viewport top coordinate */ y: number; /**viewport width */ width: number; /** viewport height */ height: number; /** * Creates a Viewport object located at (x, y) and sized (width, height) * @param x defines viewport left coordinate * @param y defines viewport top coordinate * @param width defines the viewport width * @param height defines the viewport height */ constructor( /** viewport left coordinate */ x: number, /** viewport top coordinate */ y: number, /**viewport width */ width: number, /** viewport height */ height: number); /** * Creates a new viewport using absolute sizing (from 0-> width, 0-> height instead of 0->1) * @param renderWidth defines the rendering width * @param renderHeight defines the rendering height * @returns a new Viewport */ toGlobal(renderWidth: number, renderHeight: number): Viewport; /** * Stores absolute viewport value into a target viewport (from 0-> width, 0-> height instead of 0->1) * @param renderWidth defines the rendering width * @param renderHeight defines the rendering height * @param ref defines the target viewport * @returns the current viewport */ toGlobalToRef(renderWidth: number, renderHeight: number, ref: Viewport): Viewport; /** * Returns a new Viewport copied from the current one * @returns a new Viewport */ clone(): Viewport; } /** * Reprasents a camera frustum */ export class Frustum { /** * Gets the planes representing the frustum * @param transform matrix to be applied to the returned planes * @returns a new array of 6 Frustum planes computed by the given transformation matrix. */ static GetPlanes(transform: DeepImmutable): Plane[]; /** * Gets the near frustum plane transformed by the transform matrix * @param transform transformation matrix to be applied to the resulting frustum plane * @param frustumPlane the resuling frustum plane */ static GetNearPlaneToRef(transform: DeepImmutable, frustumPlane: Plane): void; /** * Gets the far frustum plane transformed by the transform matrix * @param transform transformation matrix to be applied to the resulting frustum plane * @param frustumPlane the resuling frustum plane */ static GetFarPlaneToRef(transform: DeepImmutable, frustumPlane: Plane): void; /** * Gets the left frustum plane transformed by the transform matrix * @param transform transformation matrix to be applied to the resulting frustum plane * @param frustumPlane the resuling frustum plane */ static GetLeftPlaneToRef(transform: DeepImmutable, frustumPlane: Plane): void; /** * Gets the right frustum plane transformed by the transform matrix * @param transform transformation matrix to be applied to the resulting frustum plane * @param frustumPlane the resuling frustum plane */ static GetRightPlaneToRef(transform: DeepImmutable, frustumPlane: Plane): void; /** * Gets the top frustum plane transformed by the transform matrix * @param transform transformation matrix to be applied to the resulting frustum plane * @param frustumPlane the resuling frustum plane */ static GetTopPlaneToRef(transform: DeepImmutable, frustumPlane: Plane): void; /** * Gets the bottom frustum plane transformed by the transform matrix * @param transform transformation matrix to be applied to the resulting frustum plane * @param frustumPlane the resuling frustum plane */ static GetBottomPlaneToRef(transform: DeepImmutable, frustumPlane: Plane): void; /** * Sets the given array "frustumPlanes" with the 6 Frustum planes computed by the given transformation matrix. * @param transform transformation matrix to be applied to the resulting frustum planes * @param frustumPlanes the resuling frustum planes */ static GetPlanesToRef(transform: DeepImmutable, frustumPlanes: Plane[]): void; } /** Defines supported spaces */ export enum Space { /** Local (object) space */ LOCAL = 0, /** World space */ WORLD = 1, /** Bone space */ BONE = 2 } /** Defines the 3 main axes */ export class Axis { /** X axis */ static X: Vector3; /** Y axis */ static Y: Vector3; /** Z axis */ static Z: Vector3; } /** Class used to represent a Bezier curve */ export class BezierCurve { /** * Returns the cubic Bezier interpolated value (float) at "t" (float) from the given x1, y1, x2, y2 floats * @param t defines the time * @param x1 defines the left coordinate on X axis * @param y1 defines the left coordinate on Y axis * @param x2 defines the right coordinate on X axis * @param y2 defines the right coordinate on Y axis * @returns the interpolated value */ static Interpolate(t: number, x1: number, y1: number, x2: number, y2: number): number; } /** * Defines potential orientation for back face culling */ export enum Orientation { /** * Clockwise */ CW = 0, /** Counter clockwise */ CCW = 1 } /** * Defines angle representation */ export class Angle { private _radians; /** * Creates an Angle object of "radians" radians (float). * @param radians the angle in radians */ constructor(radians: number); /** * Get value in degrees * @returns the Angle value in degrees (float) */ degrees(): number; /** * Get value in radians * @returns the Angle value in radians (float) */ radians(): number; /** * Gets a new Angle object valued with the angle value in radians between the two given vectors * @param a defines first vector * @param b defines second vector * @returns a new Angle */ static BetweenTwoPoints(a: DeepImmutable, b: DeepImmutable): Angle; /** * Gets a new Angle object from the given float in radians * @param radians defines the angle value in radians * @returns a new Angle */ static FromRadians(radians: number): Angle; /** * Gets a new Angle object from the given float in degrees * @param degrees defines the angle value in degrees * @returns a new Angle */ static FromDegrees(degrees: number): Angle; } /** * This represents an arc in a 2d space. */ export class Arc2 { /** Defines the start point of the arc */ startPoint: Vector2; /** Defines the mid point of the arc */ midPoint: Vector2; /** Defines the end point of the arc */ endPoint: Vector2; /** * Defines the center point of the arc. */ centerPoint: Vector2; /** * Defines the radius of the arc. */ radius: number; /** * Defines the angle of the arc (from mid point to end point). */ angle: Angle; /** * Defines the start angle of the arc (from start point to middle point). */ startAngle: Angle; /** * Defines the orientation of the arc (clock wise/counter clock wise). */ orientation: Orientation; /** * Creates an Arc object from the three given points : start, middle and end. * @param startPoint Defines the start point of the arc * @param midPoint Defines the midlle point of the arc * @param endPoint Defines the end point of the arc */ constructor( /** Defines the start point of the arc */ startPoint: Vector2, /** Defines the mid point of the arc */ midPoint: Vector2, /** Defines the end point of the arc */ endPoint: Vector2); } /** * Represents a 2D path made up of multiple 2D points */ export class Path2 { private _points; private _length; /** * If the path start and end point are the same */ closed: boolean; /** * Creates a Path2 object from the starting 2D coordinates x and y. * @param x the starting points x value * @param y the starting points y value */ constructor(x: number, y: number); /** * Adds a new segment until the given coordinates (x, y) to the current Path2. * @param x the added points x value * @param y the added points y value * @returns the updated Path2. */ addLineTo(x: number, y: number): Path2; /** * Adds _numberOfSegments_ segments according to the arc definition (middle point coordinates, end point coordinates, the arc start point being the current Path2 last point) to the current Path2. * @param midX middle point x value * @param midY middle point y value * @param endX end point x value * @param endY end point y value * @param numberOfSegments (default: 36) * @returns the updated Path2. */ addArcTo(midX: number, midY: number, endX: number, endY: number, numberOfSegments?: number): Path2; /** * Closes the Path2. * @returns the Path2. */ close(): Path2; /** * Gets the sum of the distance between each sequential point in the path * @returns the Path2 total length (float). */ length(): number; /** * Gets the points which construct the path * @returns the Path2 internal array of points. */ getPoints(): Vector2[]; /** * Retreives the point at the distance aways from the starting point * @param normalizedLengthPosition the length along the path to retreive the point from * @returns a new Vector2 located at a percentage of the Path2 total length on this path. */ getPointAtLengthPosition(normalizedLengthPosition: number): Vector2; /** * Creates a new path starting from an x and y position * @param x starting x value * @param y starting y value * @returns a new Path2 starting at the coordinates (x, y). */ static StartingAt(x: number, y: number): Path2; } /** * Represents a 3D path made up of multiple 3D points */ export class Path3D { /** * an array of Vector3, the curve axis of the Path3D */ path: Vector3[]; private _curve; private _distances; private _tangents; private _normals; private _binormals; private _raw; /** * new Path3D(path, normal, raw) * Creates a Path3D. A Path3D is a logical math object, so not a mesh. * please read the description in the tutorial : https://doc.babylonjs.com/how_to/how_to_use_path3d * @param path an array of Vector3, the curve axis of the Path3D * @param firstNormal (options) Vector3, the first wanted normal to the curve. Ex (0, 1, 0) for a vertical normal. * @param raw (optional, default false) : boolean, if true the returned Path3D isn't normalized. Useful to depict path acceleration or speed. */ constructor( /** * an array of Vector3, the curve axis of the Path3D */ path: Vector3[], firstNormal?: Nullable, raw?: boolean); /** * Returns the Path3D array of successive Vector3 designing its curve. * @returns the Path3D array of successive Vector3 designing its curve. */ getCurve(): Vector3[]; /** * Returns an array populated with tangent vectors on each Path3D curve point. * @returns an array populated with tangent vectors on each Path3D curve point. */ getTangents(): Vector3[]; /** * Returns an array populated with normal vectors on each Path3D curve point. * @returns an array populated with normal vectors on each Path3D curve point. */ getNormals(): Vector3[]; /** * Returns an array populated with binormal vectors on each Path3D curve point. * @returns an array populated with binormal vectors on each Path3D curve point. */ getBinormals(): Vector3[]; /** * Returns an array populated with distances (float) of the i-th point from the first curve point. * @returns an array populated with distances (float) of the i-th point from the first curve point. */ getDistances(): number[]; /** * Forces the Path3D tangent, normal, binormal and distance recomputation. * @param path path which all values are copied into the curves points * @param firstNormal which should be projected onto the curve * @returns the same object updated. */ update(path: Vector3[], firstNormal?: Nullable): Path3D; private _compute; private _getFirstNonNullVector; private _getLastNonNullVector; private _normalVector; } /** * A Curve3 object is a logical object, so not a mesh, to handle curves in the 3D geometric space. * A Curve3 is designed from a series of successive Vector3. * @see https://doc.babylonjs.com/how_to/how_to_use_curve3 */ export class Curve3 { private _points; private _length; /** * Returns a Curve3 object along a Quadratic Bezier curve : https://doc.babylonjs.com/how_to/how_to_use_curve3#quadratic-bezier-curve * @param v0 (Vector3) the origin point of the Quadratic Bezier * @param v1 (Vector3) the control point * @param v2 (Vector3) the end point of the Quadratic Bezier * @param nbPoints (integer) the wanted number of points in the curve * @returns the created Curve3 */ static CreateQuadraticBezier(v0: DeepImmutable, v1: DeepImmutable, v2: DeepImmutable, nbPoints: number): Curve3; /** * Returns a Curve3 object along a Cubic Bezier curve : https://doc.babylonjs.com/how_to/how_to_use_curve3#cubic-bezier-curve * @param v0 (Vector3) the origin point of the Cubic Bezier * @param v1 (Vector3) the first control point * @param v2 (Vector3) the second control point * @param v3 (Vector3) the end point of the Cubic Bezier * @param nbPoints (integer) the wanted number of points in the curve * @returns the created Curve3 */ static CreateCubicBezier(v0: DeepImmutable, v1: DeepImmutable, v2: DeepImmutable, v3: DeepImmutable, nbPoints: number): Curve3; /** * Returns a Curve3 object along a Hermite Spline curve : https://doc.babylonjs.com/how_to/how_to_use_curve3#hermite-spline * @param p1 (Vector3) the origin point of the Hermite Spline * @param t1 (Vector3) the tangent vector at the origin point * @param p2 (Vector3) the end point of the Hermite Spline * @param t2 (Vector3) the tangent vector at the end point * @param nbPoints (integer) the wanted number of points in the curve * @returns the created Curve3 */ static CreateHermiteSpline(p1: DeepImmutable, t1: DeepImmutable, p2: DeepImmutable, t2: DeepImmutable, nbPoints: number): Curve3; /** * Returns a Curve3 object along a CatmullRom Spline curve : * @param points (array of Vector3) the points the spline must pass through. At least, four points required * @param nbPoints (integer) the wanted number of points between each curve control points * @param closed (boolean) optional with default false, when true forms a closed loop from the points * @returns the created Curve3 */ static CreateCatmullRomSpline(points: DeepImmutable, nbPoints: number, closed?: boolean): Curve3; /** * A Curve3 object is a logical object, so not a mesh, to handle curves in the 3D geometric space. * A Curve3 is designed from a series of successive Vector3. * Tuto : https://doc.babylonjs.com/how_to/how_to_use_curve3#curve3-object * @param points points which make up the curve */ constructor(points: Vector3[]); /** * @returns the Curve3 stored array of successive Vector3 */ getPoints(): Vector3[]; /** * @returns the computed length (float) of the curve. */ length(): number; /** * Returns a new instance of Curve3 object : var curve = curveA.continue(curveB); * This new Curve3 is built by translating and sticking the curveB at the end of the curveA. * curveA and curveB keep unchanged. * @param curve the curve to continue from this curve * @returns the newly constructed curve */ continue(curve: DeepImmutable): Curve3; private _computeLength; } /** * Contains position and normal vectors for a vertex */ export class PositionNormalVertex { /** the position of the vertex (defaut: 0,0,0) */ position: Vector3; /** the normal of the vertex (defaut: 0,1,0) */ normal: Vector3; /** * Creates a PositionNormalVertex * @param position the position of the vertex (defaut: 0,0,0) * @param normal the normal of the vertex (defaut: 0,1,0) */ constructor( /** the position of the vertex (defaut: 0,0,0) */ position?: Vector3, /** the normal of the vertex (defaut: 0,1,0) */ normal?: Vector3); /** * Clones the PositionNormalVertex * @returns the cloned PositionNormalVertex */ clone(): PositionNormalVertex; } /** * Contains position, normal and uv vectors for a vertex */ export class PositionNormalTextureVertex { /** the position of the vertex (defaut: 0,0,0) */ position: Vector3; /** the normal of the vertex (defaut: 0,1,0) */ normal: Vector3; /** the uv of the vertex (default: 0,0) */ uv: Vector2; /** * Creates a PositionNormalTextureVertex * @param position the position of the vertex (defaut: 0,0,0) * @param normal the normal of the vertex (defaut: 0,1,0) * @param uv the uv of the vertex (default: 0,0) */ constructor( /** the position of the vertex (defaut: 0,0,0) */ position?: Vector3, /** the normal of the vertex (defaut: 0,1,0) */ normal?: Vector3, /** the uv of the vertex (default: 0,0) */ uv?: Vector2); /** * Clones the PositionNormalTextureVertex * @returns the cloned PositionNormalTextureVertex */ clone(): PositionNormalTextureVertex; } /** * @hidden */ export class Tmp { static Color3: Color3[]; static Color4: Color4[]; static Vector2: Vector2[]; static Vector3: Vector3[]; static Vector4: Vector4[]; static Quaternion: Quaternion[]; static Matrix: Matrix[]; } } declare module "babylonjs/Offline/IOfflineProvider" { /** * Class used to enable access to offline support * @see http://doc.babylonjs.com/how_to/caching_resources_in_indexeddb */ export interface IOfflineProvider { /** * Gets a boolean indicating if scene must be saved in the database */ enableSceneOffline: boolean; /** * Gets a boolean indicating if textures must be saved in the database */ enableTexturesOffline: boolean; /** * Open the offline support and make it available * @param successCallback defines the callback to call on success * @param errorCallback defines the callback to call on error */ open(successCallback: () => void, errorCallback: () => void): void; /** * Loads an image from the offline support * @param url defines the url to load from * @param image defines the target DOM image */ loadImage(url: string, image: HTMLImageElement): void; /** * Loads a file from offline support * @param url defines the URL to load from * @param sceneLoaded defines a callback to call on success * @param progressCallBack defines a callback to call when progress changed * @param errorCallback defines a callback to call on error * @param useArrayBuffer defines a boolean to use array buffer instead of text string */ loadFile(url: string, sceneLoaded: (data: any) => void, progressCallBack?: (data: any) => void, errorCallback?: () => void, useArrayBuffer?: boolean): void; } } declare module "babylonjs/Misc/observable" { import { Nullable } from "babylonjs/types"; /** * A class serves as a medium between the observable and its observers */ export class EventState { /** * Create a new EventState * @param mask defines the mask associated with this state * @param skipNextObservers defines a flag which will instruct the observable to skip following observers when set to true * @param target defines the original target of the state * @param currentTarget defines the current target of the state */ constructor(mask: number, skipNextObservers?: boolean, target?: any, currentTarget?: any); /** * Initialize the current event state * @param mask defines the mask associated with this state * @param skipNextObservers defines a flag which will instruct the observable to skip following observers when set to true * @param target defines the original target of the state * @param currentTarget defines the current target of the state * @returns the current event state */ initalize(mask: number, skipNextObservers?: boolean, target?: any, currentTarget?: any): EventState; /** * An Observer can set this property to true to prevent subsequent observers of being notified */ skipNextObservers: boolean; /** * Get the mask value that were used to trigger the event corresponding to this EventState object */ mask: number; /** * The object that originally notified the event */ target?: any; /** * The current object in the bubbling phase */ currentTarget?: any; /** * This will be populated with the return value of the last function that was executed. * If it is the first function in the callback chain it will be the event data. */ lastReturnValue?: any; } /** * Represent an Observer registered to a given Observable object. */ export class Observer { /** * Defines the callback to call when the observer is notified */ callback: (eventData: T, eventState: EventState) => void; /** * Defines the mask of the observer (used to filter notifications) */ mask: number; /** * Defines the current scope used to restore the JS context */ scope: any; /** @hidden */ _willBeUnregistered: boolean; /** * Gets or sets a property defining that the observer as to be unregistered after the next notification */ unregisterOnNextCall: boolean; /** * Creates a new observer * @param callback defines the callback to call when the observer is notified * @param mask defines the mask of the observer (used to filter notifications) * @param scope defines the current scope used to restore the JS context */ constructor( /** * Defines the callback to call when the observer is notified */ callback: (eventData: T, eventState: EventState) => void, /** * Defines the mask of the observer (used to filter notifications) */ mask: number, /** * Defines the current scope used to restore the JS context */ scope?: any); } /** * Represent a list of observers registered to multiple Observables object. */ export class MultiObserver { private _observers; private _observables; /** * Release associated resources */ dispose(): void; /** * Raise a callback when one of the observable will notify * @param observables defines a list of observables to watch * @param callback defines the callback to call on notification * @param mask defines the mask used to filter notifications * @param scope defines the current scope used to restore the JS context * @returns the new MultiObserver */ static Watch(observables: Observable[], callback: (eventData: T, eventState: EventState) => void, mask?: number, scope?: any): MultiObserver; } /** * The Observable class is a simple implementation of the Observable pattern. * * There's one slight particularity though: a given Observable can notify its observer using a particular mask value, only the Observers registered with this mask value will be notified. * This enable a more fine grained execution without having to rely on multiple different Observable objects. * For instance you may have a given Observable that have four different types of notifications: Move (mask = 0x01), Stop (mask = 0x02), Turn Right (mask = 0X04), Turn Left (mask = 0X08). * A given observer can register itself with only Move and Stop (mask = 0x03), then it will only be notified when one of these two occurs and will never be for Turn Left/Right. */ export class Observable { private _observers; private _eventState; private _onObserverAdded; /** * Creates a new observable * @param onObserverAdded defines a callback to call when a new observer is added */ constructor(onObserverAdded?: (observer: Observer) => void); /** * Create a new Observer with the specified callback * @param callback the callback that will be executed for that Observer * @param mask the mask used to filter observers * @param insertFirst if true the callback will be inserted at the first position, hence executed before the others ones. If false (default behavior) the callback will be inserted at the last position, executed after all the others already present. * @param scope optional scope for the callback to be called from * @param unregisterOnFirstCall defines if the observer as to be unregistered after the next notification * @returns the new observer created for the callback */ add(callback: (eventData: T, eventState: EventState) => void, mask?: number, insertFirst?: boolean, scope?: any, unregisterOnFirstCall?: boolean): Nullable>; /** * Create a new Observer with the specified callback and unregisters after the next notification * @param callback the callback that will be executed for that Observer * @returns the new observer created for the callback */ addOnce(callback: (eventData: T, eventState: EventState) => void): Nullable>; /** * Remove an Observer from the Observable object * @param observer the instance of the Observer to remove * @returns false if it doesn't belong to this Observable */ remove(observer: Nullable>): boolean; /** * Remove a callback from the Observable object * @param callback the callback to remove * @param scope optional scope. If used only the callbacks with this scope will be removed * @returns false if it doesn't belong to this Observable */ removeCallback(callback: (eventData: T, eventState: EventState) => void, scope?: any): boolean; private _deferUnregister; private _remove; /** * Moves the observable to the top of the observer list making it get called first when notified * @param observer the observer to move */ makeObserverTopPriority(observer: Observer): void; /** * Moves the observable to the bottom of the observer list making it get called last when notified * @param observer the observer to move */ makeObserverBottomPriority(observer: Observer): void; /** * Notify all Observers by calling their respective callback with the given data * Will return true if all observers were executed, false if an observer set skipNextObservers to true, then prevent the subsequent ones to execute * @param eventData defines the data to send to all observers * @param mask defines the mask of the current notification (observers with incompatible mask (ie mask & observer.mask === 0) will not be notified) * @param target defines the original target of the state * @param currentTarget defines the current target of the state * @returns false if the complete observer chain was not processed (because one observer set the skipNextObservers to true) */ notifyObservers(eventData: T, mask?: number, target?: any, currentTarget?: any): boolean; /** * Calling this will execute each callback, expecting it to be a promise or return a value. * If at any point in the chain one function fails, the promise will fail and the execution will not continue. * This is useful when a chain of events (sometimes async events) is needed to initialize a certain object * and it is crucial that all callbacks will be executed. * The order of the callbacks is kept, callbacks are not executed parallel. * * @param eventData The data to be sent to each callback * @param mask is used to filter observers defaults to -1 * @param target defines the callback target (see EventState) * @param currentTarget defines he current object in the bubbling phase * @returns {Promise} will return a Promise than resolves when all callbacks executed successfully. */ notifyObserversWithPromise(eventData: T, mask?: number, target?: any, currentTarget?: any): Promise; /** * Notify a specific observer * @param observer defines the observer to notify * @param eventData defines the data to be sent to each callback * @param mask is used to filter observers defaults to -1 */ notifyObserver(observer: Observer, eventData: T, mask?: number): void; /** * Gets a boolean indicating if the observable has at least one observer * @returns true is the Observable has at least one Observer registered */ hasObservers(): boolean; /** * Clear the list of observers */ clear(): void; /** * Clone the current observable * @returns a new observable */ clone(): Observable; /** * Does this observable handles observer registered with a given mask * @param mask defines the mask to be tested * @return whether or not one observer registered with the given mask is handeled **/ hasSpecificMask(mask?: number): boolean; } } declare module "babylonjs/Misc/filesInputStore" { /** * Class used to help managing file picking and drag'n'drop * File Storage */ export class FilesInputStore { /** * List of files ready to be loaded */ static FilesToLoad: { [key: string]: File; }; } } declare module "babylonjs/Engines/constants" { /** Defines the cross module used constants to avoid circular dependncies */ export class Constants { /** Defines that alpha blending is disabled */ static readonly ALPHA_DISABLE: number; /** Defines that alpha blending to SRC ALPHA * SRC + DEST */ static readonly ALPHA_ADD: number; /** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC ALPHA) * DEST */ static readonly ALPHA_COMBINE: number; /** Defines that alpha blending to DEST - SRC * DEST */ static readonly ALPHA_SUBTRACT: number; /** Defines that alpha blending to SRC * DEST */ static readonly ALPHA_MULTIPLY: number; /** Defines that alpha blending to SRC ALPHA * SRC + (1 - SRC) * DEST */ static readonly ALPHA_MAXIMIZED: number; /** Defines that alpha blending to SRC + DEST */ static readonly ALPHA_ONEONE: number; /** Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST */ static readonly ALPHA_PREMULTIPLIED: number; /** * Defines that alpha blending to SRC + (1 - SRC ALPHA) * DEST * Alpha will be set to (1 - SRC ALPHA) * DEST ALPHA */ static readonly ALPHA_PREMULTIPLIED_PORTERDUFF: number; /** Defines that alpha blending to CST * SRC + (1 - CST) * DEST */ static readonly ALPHA_INTERPOLATE: number; /** * Defines that alpha blending to SRC + (1 - SRC) * DEST * Alpha will be set to SRC ALPHA + (1 - SRC ALPHA) * DEST ALPHA */ static readonly ALPHA_SCREENMODE: number; /** Defines that the ressource is not delayed*/ static readonly DELAYLOADSTATE_NONE: number; /** Defines that the ressource was successfully delay loaded */ static readonly DELAYLOADSTATE_LOADED: number; /** Defines that the ressource is currently delay loading */ static readonly DELAYLOADSTATE_LOADING: number; /** Defines that the ressource is delayed and has not started loading */ static readonly DELAYLOADSTATE_NOTLOADED: number; /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will never pass. i.e. Nothing will be drawn */ static readonly NEVER: number; /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will always pass. i.e. Pixels will be drawn in the order they are drawn */ static readonly ALWAYS: number; /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than the stored value */ static readonly LESS: number; /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is equals to the stored value */ static readonly EQUAL: number; /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is less than or equal to the stored value */ static readonly LEQUAL: number; /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than the stored value */ static readonly GREATER: number; /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is greater than or equal to the stored value */ static readonly GEQUAL: number; /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will pass if the new depth value is not equal to the stored value */ static readonly NOTEQUAL: number; /** Passed to stencilOperation to specify that stencil value must be kept */ static readonly KEEP: number; /** Passed to stencilOperation to specify that stencil value must be replaced */ static readonly REPLACE: number; /** Passed to stencilOperation to specify that stencil value must be incremented */ static readonly INCR: number; /** Passed to stencilOperation to specify that stencil value must be decremented */ static readonly DECR: number; /** Passed to stencilOperation to specify that stencil value must be inverted */ static readonly INVERT: number; /** Passed to stencilOperation to specify that stencil value must be incremented with wrapping */ static readonly INCR_WRAP: number; /** Passed to stencilOperation to specify that stencil value must be decremented with wrapping */ static readonly DECR_WRAP: number; /** Texture is not repeating outside of 0..1 UVs */ static readonly TEXTURE_CLAMP_ADDRESSMODE: number; /** Texture is repeating outside of 0..1 UVs */ static readonly TEXTURE_WRAP_ADDRESSMODE: number; /** Texture is repeating and mirrored */ static readonly TEXTURE_MIRROR_ADDRESSMODE: number; /** ALPHA */ static readonly TEXTUREFORMAT_ALPHA: number; /** LUMINANCE */ static readonly TEXTUREFORMAT_LUMINANCE: number; /** LUMINANCE_ALPHA */ static readonly TEXTUREFORMAT_LUMINANCE_ALPHA: number; /** RGB */ static readonly TEXTUREFORMAT_RGB: number; /** RGBA */ static readonly TEXTUREFORMAT_RGBA: number; /** RED */ static readonly TEXTUREFORMAT_RED: number; /** RED (2nd reference) */ static readonly TEXTUREFORMAT_R: number; /** RG */ static readonly TEXTUREFORMAT_RG: number; /** RED_INTEGER */ static readonly TEXTUREFORMAT_RED_INTEGER: number; /** RED_INTEGER (2nd reference) */ static readonly TEXTUREFORMAT_R_INTEGER: number; /** RG_INTEGER */ static readonly TEXTUREFORMAT_RG_INTEGER: number; /** RGB_INTEGER */ static readonly TEXTUREFORMAT_RGB_INTEGER: number; /** RGBA_INTEGER */ static readonly TEXTUREFORMAT_RGBA_INTEGER: number; /** UNSIGNED_BYTE */ static readonly TEXTURETYPE_UNSIGNED_BYTE: number; /** UNSIGNED_BYTE (2nd reference) */ static readonly TEXTURETYPE_UNSIGNED_INT: number; /** FLOAT */ static readonly TEXTURETYPE_FLOAT: number; /** HALF_FLOAT */ static readonly TEXTURETYPE_HALF_FLOAT: number; /** BYTE */ static readonly TEXTURETYPE_BYTE: number; /** SHORT */ static readonly TEXTURETYPE_SHORT: number; /** UNSIGNED_SHORT */ static readonly TEXTURETYPE_UNSIGNED_SHORT: number; /** INT */ static readonly TEXTURETYPE_INT: number; /** UNSIGNED_INT */ static readonly TEXTURETYPE_UNSIGNED_INTEGER: number; /** UNSIGNED_SHORT_4_4_4_4 */ static readonly TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4: number; /** UNSIGNED_SHORT_5_5_5_1 */ static readonly TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1: number; /** UNSIGNED_SHORT_5_6_5 */ static readonly TEXTURETYPE_UNSIGNED_SHORT_5_6_5: number; /** UNSIGNED_INT_2_10_10_10_REV */ static readonly TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV: number; /** UNSIGNED_INT_24_8 */ static readonly TEXTURETYPE_UNSIGNED_INT_24_8: number; /** UNSIGNED_INT_10F_11F_11F_REV */ static readonly TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV: number; /** UNSIGNED_INT_5_9_9_9_REV */ static readonly TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV: number; /** FLOAT_32_UNSIGNED_INT_24_8_REV */ static readonly TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV: number; /** nearest is mag = nearest and min = nearest and mip = linear */ static readonly TEXTURE_NEAREST_SAMPLINGMODE: number; /** Bilinear is mag = linear and min = linear and mip = nearest */ static readonly TEXTURE_BILINEAR_SAMPLINGMODE: number; /** Trilinear is mag = linear and min = linear and mip = linear */ static readonly TEXTURE_TRILINEAR_SAMPLINGMODE: number; /** nearest is mag = nearest and min = nearest and mip = linear */ static readonly TEXTURE_NEAREST_NEAREST_MIPLINEAR: number; /** Bilinear is mag = linear and min = linear and mip = nearest */ static readonly TEXTURE_LINEAR_LINEAR_MIPNEAREST: number; /** Trilinear is mag = linear and min = linear and mip = linear */ static readonly TEXTURE_LINEAR_LINEAR_MIPLINEAR: number; /** mag = nearest and min = nearest and mip = nearest */ static readonly TEXTURE_NEAREST_NEAREST_MIPNEAREST: number; /** mag = nearest and min = linear and mip = nearest */ static readonly TEXTURE_NEAREST_LINEAR_MIPNEAREST: number; /** mag = nearest and min = linear and mip = linear */ static readonly TEXTURE_NEAREST_LINEAR_MIPLINEAR: number; /** mag = nearest and min = linear and mip = none */ static readonly TEXTURE_NEAREST_LINEAR: number; /** mag = nearest and min = nearest and mip = none */ static readonly TEXTURE_NEAREST_NEAREST: number; /** mag = linear and min = nearest and mip = nearest */ static readonly TEXTURE_LINEAR_NEAREST_MIPNEAREST: number; /** mag = linear and min = nearest and mip = linear */ static readonly TEXTURE_LINEAR_NEAREST_MIPLINEAR: number; /** mag = linear and min = linear and mip = none */ static readonly TEXTURE_LINEAR_LINEAR: number; /** mag = linear and min = nearest and mip = none */ static readonly TEXTURE_LINEAR_NEAREST: number; /** Explicit coordinates mode */ static readonly TEXTURE_EXPLICIT_MODE: number; /** Spherical coordinates mode */ static readonly TEXTURE_SPHERICAL_MODE: number; /** Planar coordinates mode */ static readonly TEXTURE_PLANAR_MODE: number; /** Cubic coordinates mode */ static readonly TEXTURE_CUBIC_MODE: number; /** Projection coordinates mode */ static readonly TEXTURE_PROJECTION_MODE: number; /** Skybox coordinates mode */ static readonly TEXTURE_SKYBOX_MODE: number; /** Inverse Cubic coordinates mode */ static readonly TEXTURE_INVCUBIC_MODE: number; /** Equirectangular coordinates mode */ static readonly TEXTURE_EQUIRECTANGULAR_MODE: number; /** Equirectangular Fixed coordinates mode */ static readonly TEXTURE_FIXED_EQUIRECTANGULAR_MODE: number; /** Equirectangular Fixed Mirrored coordinates mode */ static readonly TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE: number; /** Defines that texture rescaling will use a floor to find the closer power of 2 size */ static readonly SCALEMODE_FLOOR: number; /** Defines that texture rescaling will look for the nearest power of 2 size */ static readonly SCALEMODE_NEAREST: number; /** Defines that texture rescaling will use a ceil to find the closer power of 2 size */ static readonly SCALEMODE_CEILING: number; /** * The dirty texture flag value */ static readonly MATERIAL_TextureDirtyFlag: number; /** * The dirty light flag value */ static readonly MATERIAL_LightDirtyFlag: number; /** * The dirty fresnel flag value */ static readonly MATERIAL_FresnelDirtyFlag: number; /** * The dirty attribute flag value */ static readonly MATERIAL_AttributesDirtyFlag: number; /** * The dirty misc flag value */ static readonly MATERIAL_MiscDirtyFlag: number; /** * The all dirty flag value */ static readonly MATERIAL_AllDirtyFlag: number; /** * Returns the triangle fill mode */ static readonly MATERIAL_TriangleFillMode: number; /** * Returns the wireframe mode */ static readonly MATERIAL_WireFrameFillMode: number; /** * Returns the point fill mode */ static readonly MATERIAL_PointFillMode: number; /** * Returns the point list draw mode */ static readonly MATERIAL_PointListDrawMode: number; /** * Returns the line list draw mode */ static readonly MATERIAL_LineListDrawMode: number; /** * Returns the line loop draw mode */ static readonly MATERIAL_LineLoopDrawMode: number; /** * Returns the line strip draw mode */ static readonly MATERIAL_LineStripDrawMode: number; /** * Returns the triangle strip draw mode */ static readonly MATERIAL_TriangleStripDrawMode: number; /** * Returns the triangle fan draw mode */ static readonly MATERIAL_TriangleFanDrawMode: number; /** * Stores the clock-wise side orientation */ static readonly MATERIAL_ClockWiseSideOrientation: number; /** * Stores the counter clock-wise side orientation */ static readonly MATERIAL_CounterClockWiseSideOrientation: number; /** * Nothing * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers */ static readonly ACTION_NothingTrigger: number; /** * On pick * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers */ static readonly ACTION_OnPickTrigger: number; /** * On left pick * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers */ static readonly ACTION_OnLeftPickTrigger: number; /** * On right pick * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers */ static readonly ACTION_OnRightPickTrigger: number; /** * On center pick * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers */ static readonly ACTION_OnCenterPickTrigger: number; /** * On pick down * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers */ static readonly ACTION_OnPickDownTrigger: number; /** * On double pick * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers */ static readonly ACTION_OnDoublePickTrigger: number; /** * On pick up * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers */ static readonly ACTION_OnPickUpTrigger: number; /** * On pick out. * This trigger will only be raised if you also declared a OnPickDown * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers */ static readonly ACTION_OnPickOutTrigger: number; /** * On long press * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers */ static readonly ACTION_OnLongPressTrigger: number; /** * On pointer over * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers */ static readonly ACTION_OnPointerOverTrigger: number; /** * On pointer out * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers */ static readonly ACTION_OnPointerOutTrigger: number; /** * On every frame * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers */ static readonly ACTION_OnEveryFrameTrigger: number; /** * On intersection enter * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers */ static readonly ACTION_OnIntersectionEnterTrigger: number; /** * On intersection exit * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers */ static readonly ACTION_OnIntersectionExitTrigger: number; /** * On key down * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers */ static readonly ACTION_OnKeyDownTrigger: number; /** * On key up * @see http://doc.babylonjs.com/how_to/how_to_use_actions#triggers */ static readonly ACTION_OnKeyUpTrigger: number; /** * Billboard mode will only apply to Y axis */ static readonly PARTICLES_BILLBOARDMODE_Y: number; /** * Billboard mode will apply to all axes */ static readonly PARTICLES_BILLBOARDMODE_ALL: number; /** * Special billboard mode where the particle will be biilboard to the camera but rotated to align with direction */ static readonly PARTICLES_BILLBOARDMODE_STRETCHED: number; /** * Gets or sets base Assets URL */ static PARTICLES_BaseAssetsUrl: string; /** Default culling strategy : this is an exclusion test and it's the more accurate. * Test order : * Is the bounding sphere outside the frustum ? * If not, are the bounding box vertices outside the frustum ? * It not, then the cullable object is in the frustum. */ static readonly MESHES_CULLINGSTRATEGY_STANDARD: number; /** Culling strategy : Bounding Sphere Only. * This is an exclusion test. It's faster than the standard strategy because the bounding box is not tested. * It's also less accurate than the standard because some not visible objects can still be selected. * Test : is the bounding sphere outside the frustum ? * If not, then the cullable object is in the frustum. */ static readonly MESHES_CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY: number; /** Culling strategy : Optimistic Inclusion. * This in an inclusion test first, then the standard exclusion test. * This can be faster when a cullable object is expected to be almost always in the camera frustum. * This could also be a little slower than the standard test when the tested object center is not the frustum but one of its bounding box vertex is still inside. * Anyway, it's as accurate as the standard strategy. * Test : * Is the cullable object bounding sphere center in the frustum ? * If not, apply the default culling strategy. */ static readonly MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION: number; /** Culling strategy : Optimistic Inclusion then Bounding Sphere Only. * This in an inclusion test first, then the bounding sphere only exclusion test. * This can be the fastest test when a cullable object is expected to be almost always in the camera frustum. * This could also be a little slower than the BoundingSphereOnly strategy when the tested object center is not in the frustum but its bounding sphere still intersects it. * It's less accurate than the standard strategy and as accurate as the BoundingSphereOnly strategy. * Test : * Is the cullable object bounding sphere center in the frustum ? * If not, apply the Bounding Sphere Only strategy. No Bounding Box is tested here. */ static readonly MESHES_CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY: number; /** * No logging while loading */ static readonly SCENELOADER_NO_LOGGING: number; /** * Minimal logging while loading */ static readonly SCENELOADER_MINIMAL_LOGGING: number; /** * Summary logging while loading */ static readonly SCENELOADER_SUMMARY_LOGGING: number; /** * Detailled logging while loading */ static readonly SCENELOADER_DETAILED_LOGGING: number; } } declare module "babylonjs/Misc/domManagement" { /** * Sets of helpers dealing with the DOM and some of the recurrent functions needed in * Babylon.js */ export class DomManagement { /** * Checks if the window object exists * @returns true if the window object exists */ static IsWindowObjectExist(): boolean; /** * Extracts text content from a DOM element hierarchy * @param element defines the root element * @returns a string */ static GetDOMTextContent(element: HTMLElement): string; } } declare module "babylonjs/Misc/logger" { /** * Logger used througouht the application to allow configuration of * the log level required for the messages. */ export class Logger { /** * No log */ static readonly NoneLogLevel: number; /** * Only message logs */ static readonly MessageLogLevel: number; /** * Only warning logs */ static readonly WarningLogLevel: number; /** * Only error logs */ static readonly ErrorLogLevel: number; /** * All logs */ static readonly AllLogLevel: number; private static _LogCache; /** * Gets a value indicating the number of loading errors * @ignorenaming */ static errorsCount: number; /** * Callback called when a new log is added */ static OnNewCacheEntry: (entry: string) => void; private static _AddLogEntry; private static _FormatMessage; private static _LogDisabled; private static _LogEnabled; private static _WarnDisabled; private static _WarnEnabled; private static _ErrorDisabled; private static _ErrorEnabled; /** * Log a message to the console */ static Log: (message: string) => void; /** * Write a warning message to the console */ static Warn: (message: string) => void; /** * Write an error message to the console */ static Error: (message: string) => void; /** * Gets current log cache (list of logs) */ static readonly LogCache: string; /** * Clears the log cache */ static ClearLogCache(): void; /** * Sets the current log level (MessageLogLevel / WarningLogLevel / ErrorLogLevel) */ static LogLevels: number; } } declare module "babylonjs/Misc/typeStore" { /** @hidden */ export class _TypeStore { /** @hidden */ static RegisteredTypes: { [key: string]: Object; }; /** @hidden */ static GetClass(fqdn: string): any; } } declare module "babylonjs/Misc/deepCopier" { /** * Class containing a set of static utilities functions for deep copy. */ export class DeepCopier { /** * Tries to copy an object by duplicating every property * @param source defines the source object * @param destination defines the target object * @param doNotCopyList defines a list of properties to avoid * @param mustCopyList defines a list of properties to copy (even if they start with _) */ static DeepCopy(source: any, destination: any, doNotCopyList?: string[], mustCopyList?: string[]): void; } } declare module "babylonjs/Misc/precisionDate" { /** * Class containing a set of static utilities functions for precision date */ export class PrecisionDate { /** * Gets either window.performance.now() if supported or Date.now() else */ static readonly Now: number; } } declare module "babylonjs/Misc/devTools" { /** @hidden */ export class _DevTools { static WarnImport(name: string): string; } } declare module "babylonjs/Misc/webRequest" { /** * Extended version of XMLHttpRequest with support for customizations (headers, ...) */ export class WebRequest { private _xhr; /** * Custom HTTP Request Headers to be sent with XMLHttpRequests * i.e. when loading files, where the server/service expects an Authorization header */ static CustomRequestHeaders: { [key: string]: string; }; /** * Add callback functions in this array to update all the requests before they get sent to the network */ static CustomRequestModifiers: ((request: XMLHttpRequest) => void)[]; private _injectCustomRequestHeaders; /** * Gets or sets a function to be called when loading progress changes */ onprogress: ((this: XMLHttpRequest, ev: ProgressEvent) => any) | null; /** * Returns client's state */ readonly readyState: number; /** * Returns client's status */ readonly status: number; /** * Returns client's status as a text */ readonly statusText: string; /** * Returns client's response */ readonly response: any; /** * Returns client's response url */ readonly responseURL: string; /** * Returns client's response as text */ readonly responseText: string; /** * Gets or sets the expected response type */ responseType: XMLHttpRequestResponseType; /** @hidden */ addEventListener(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; /** @hidden */ removeEventListener(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, options?: boolean | EventListenerOptions): void; /** * Cancels any network activity */ abort(): void; /** * Initiates the request. The optional argument provides the request body. The argument is ignored if request method is GET or HEAD * @param body defines an optional request body */ send(body?: Document | BodyInit | null): void; /** * Sets the request method, request URL * @param method defines the method to use (GET, POST, etc..) * @param url defines the url to connect with */ open(method: string, url: string): void; } } declare module "babylonjs/Misc/andOrNotEvaluator" { /** * Class used to evalaute queries containing `and` and `or` operators */ export class AndOrNotEvaluator { /** * Evaluate a query * @param query defines the query to evaluate * @param evaluateCallback defines the callback used to filter result * @returns true if the query matches */ static Eval(query: string, evaluateCallback: (val: any) => boolean): boolean; private static _HandleParenthesisContent; private static _SimplifyNegation; } } declare module "babylonjs/Misc/tags" { /** * Class used to store custom tags */ export class Tags { /** * Adds support for tags on the given object * @param obj defines the object to use */ static EnableFor(obj: any): void; /** * Removes tags support * @param obj defines the object to use */ static DisableFor(obj: any): void; /** * Gets a boolean indicating if the given object has tags * @param obj defines the object to use * @returns a boolean */ static HasTags(obj: any): boolean; /** * Gets the tags available on a given object * @param obj defines the object to use * @param asString defines if the tags must be returned as a string instead of an array of strings * @returns the tags */ static GetTags(obj: any, asString?: boolean): any; /** * Adds tags to an object * @param obj defines the object to use * @param tagsString defines the tag string. The tags 'true' and 'false' are reserved and cannot be used as tags. * A tag cannot start with '||', '&&', and '!'. It cannot contain whitespaces */ static AddTagsTo(obj: any, tagsString: string): void; /** * @hidden */ static _AddTagTo(obj: any, tag: string): void; /** * Removes specific tags from a specific object * @param obj defines the object to use * @param tagsString defines the tags to remove */ static RemoveTagsFrom(obj: any, tagsString: string): void; /** * @hidden */ static _RemoveTagFrom(obj: any, tag: string): void; /** * Defines if tags hosted on an object match a given query * @param obj defines the object to use * @param tagsQuery defines the tag query * @returns a boolean */ static MatchesQuery(obj: any, tagsQuery: string): boolean; } } declare module "babylonjs/Materials/materialDefines" { /** * Manages the defines for the Material */ export class MaterialDefines { /** @hidden */ protected _keys: string[]; private _isDirty; /** @hidden */ _renderId: number; /** @hidden */ _areLightsDirty: boolean; /** @hidden */ _areAttributesDirty: boolean; /** @hidden */ _areTexturesDirty: boolean; /** @hidden */ _areFresnelDirty: boolean; /** @hidden */ _areMiscDirty: boolean; /** @hidden */ _areImageProcessingDirty: boolean; /** @hidden */ _normals: boolean; /** @hidden */ _uvs: boolean; /** @hidden */ _needNormals: boolean; /** @hidden */ _needUVs: boolean; [id: string]: any; /** * Specifies if the material needs to be re-calculated */ readonly isDirty: boolean; /** * Marks the material to indicate that it has been re-calculated */ markAsProcessed(): void; /** * Marks the material to indicate that it needs to be re-calculated */ markAsUnprocessed(): void; /** * Marks the material to indicate all of its defines need to be re-calculated */ markAllAsDirty(): void; /** * Marks the material to indicate that image processing needs to be re-calculated */ markAsImageProcessingDirty(): void; /** * Marks the material to indicate the lights need to be re-calculated */ markAsLightDirty(): void; /** * Marks the attribute state as changed */ markAsAttributesDirty(): void; /** * Marks the texture state as changed */ markAsTexturesDirty(): void; /** * Marks the fresnel state as changed */ markAsFresnelDirty(): void; /** * Marks the misc state as changed */ markAsMiscDirty(): void; /** * Rebuilds the material defines */ rebuild(): void; /** * Specifies if two material defines are equal * @param other - A material define instance to compare to * @returns - Boolean indicating if the material defines are equal (true) or not (false) */ isEqual(other: MaterialDefines): boolean; /** * Clones this instance's defines to another instance * @param other - material defines to clone values to */ cloneTo(other: MaterialDefines): void; /** * Resets the material define values */ reset(): void; /** * Converts the material define values to a string * @returns - String of material define information */ toString(): string; } } declare module "babylonjs/Engines/IPipelineContext" { /** * Class used to store and describe the pipeline context associated with an effect */ export interface IPipelineContext { /** * Gets a boolean indicating that this pipeline context is supporting asynchronous creating */ isAsync: boolean; /** * Gets a boolean indicating that the context is ready to be used (like shaders / pipelines are compiled and ready for instance) */ isReady: boolean; /** @hidden */ _handlesSpectorRebuildCallback(onCompiled: (compiledObject: any) => void): void; } } declare module "babylonjs/Meshes/dataBuffer" { /** * Class used to store gfx data (like WebGLBuffer) */ export class DataBuffer { /** * Gets or sets the number of objects referencing this buffer */ references: number; /** Gets or sets the size of the underlying buffer */ capacity: number; /** * Gets or sets a boolean indicating if the buffer contains 32bits indices */ is32Bits: boolean; /** * Gets the underlying buffer */ readonly underlyingResource: any; } } declare module "babylonjs/Engines/Processors/iShaderProcessor" { /** @hidden */ export interface IShaderProcessor { attributeProcessor?: (attribute: string) => string; varyingProcessor?: (varying: string, isFragment: boolean) => string; uniformProcessor?: (uniform: string, isFragment: boolean) => string; uniformBufferProcessor?: (uniformBuffer: string, isFragment: boolean) => string; endOfUniformBufferProcessor?: (closingBracketLine: string, isFragment: boolean) => string; lineProcessor?: (line: string, isFragment: boolean) => string; preProcessor?: (code: string, defines: string[], isFragment: boolean) => string; postProcessor?: (code: string, defines: string[], isFragment: boolean) => string; } } declare module "babylonjs/Engines/Processors/shaderProcessingOptions" { import { IShaderProcessor } from "babylonjs/Engines/Processors/iShaderProcessor"; /** @hidden */ export interface ProcessingOptions { defines: string[]; indexParameters: any; isFragment: boolean; shouldUseHighPrecisionShader: boolean; supportsUniformBuffers: boolean; shadersRepository: string; includesShadersStore: { [key: string]: string; }; processor?: IShaderProcessor; version: string; platformName: string; lookForClosingBracketForUniformBuffer?: boolean; } } declare module "babylonjs/Engines/Processors/shaderCodeNode" { import { ProcessingOptions } from "babylonjs/Engines/Processors/shaderProcessingOptions"; /** @hidden */ export class ShaderCodeNode { line: string; children: ShaderCodeNode[]; additionalDefineKey?: string; additionalDefineValue?: string; isValid(preprocessors: { [key: string]: string; }): boolean; process(preprocessors: { [key: string]: string; }, options: ProcessingOptions): string; } } declare module "babylonjs/Engines/Processors/shaderCodeCursor" { /** @hidden */ export class ShaderCodeCursor { private _lines; lineIndex: number; readonly currentLine: string; readonly canRead: boolean; lines: string[]; } } declare module "babylonjs/Engines/Processors/shaderCodeConditionNode" { import { ShaderCodeNode } from "babylonjs/Engines/Processors/shaderCodeNode"; import { ProcessingOptions } from "babylonjs/Engines/Processors/shaderProcessingOptions"; /** @hidden */ export class ShaderCodeConditionNode extends ShaderCodeNode { process(preprocessors: { [key: string]: string; }, options: ProcessingOptions): string; } } declare module "babylonjs/Engines/Processors/Expressions/shaderDefineExpression" { /** @hidden */ export class ShaderDefineExpression { isTrue(preprocessors: { [key: string]: string; }): boolean; } } declare module "babylonjs/Engines/Processors/shaderCodeTestNode" { import { ShaderCodeNode } from "babylonjs/Engines/Processors/shaderCodeNode"; import { ShaderDefineExpression } from "babylonjs/Engines/Processors/Expressions/shaderDefineExpression"; /** @hidden */ export class ShaderCodeTestNode extends ShaderCodeNode { testExpression: ShaderDefineExpression; isValid(preprocessors: { [key: string]: string; }): boolean; } } declare module "babylonjs/Engines/Processors/Expressions/Operators/shaderDefineIsDefinedOperator" { import { ShaderDefineExpression } from "babylonjs/Engines/Processors/Expressions/shaderDefineExpression"; /** @hidden */ export class ShaderDefineIsDefinedOperator extends ShaderDefineExpression { define: string; not: boolean; constructor(define: string, not?: boolean); isTrue(preprocessors: { [key: string]: string; }): boolean; } } declare module "babylonjs/Engines/Processors/Expressions/Operators/shaderDefineOrOperator" { import { ShaderDefineExpression } from "babylonjs/Engines/Processors/Expressions/shaderDefineExpression"; /** @hidden */ export class ShaderDefineOrOperator extends ShaderDefineExpression { leftOperand: ShaderDefineExpression; rightOperand: ShaderDefineExpression; isTrue(preprocessors: { [key: string]: string; }): boolean; } } declare module "babylonjs/Engines/Processors/Expressions/Operators/shaderDefineAndOperator" { import { ShaderDefineExpression } from "babylonjs/Engines/Processors/Expressions/shaderDefineExpression"; /** @hidden */ export class ShaderDefineAndOperator extends ShaderDefineExpression { leftOperand: ShaderDefineExpression; rightOperand: ShaderDefineExpression; isTrue(preprocessors: { [key: string]: string; }): boolean; } } declare module "babylonjs/Engines/Processors/Expressions/Operators/shaderDefineArithmeticOperator" { import { ShaderDefineExpression } from "babylonjs/Engines/Processors/Expressions/shaderDefineExpression"; /** @hidden */ export class ShaderDefineArithmeticOperator extends ShaderDefineExpression { define: string; operand: string; testValue: string; constructor(define: string, operand: string, testValue: string); isTrue(preprocessors: { [key: string]: string; }): boolean; } } declare module "babylonjs/Engines/Processors/shaderProcessor" { import { ProcessingOptions } from "babylonjs/Engines/Processors/shaderProcessingOptions"; /** @hidden */ export class ShaderProcessor { static Process(sourceCode: string, options: ProcessingOptions, callback: (migratedCode: string) => void): void; private static _ProcessPrecision; private static _ExtractOperation; private static _BuildSubExpression; private static _BuildExpression; private static _MoveCursorWithinIf; private static _MoveCursor; private static _EvaluatePreProcessors; private static _PreparePreProcessors; private static _ProcessShaderConversion; private static _ProcessIncludes; } } declare module "babylonjs/Misc/performanceMonitor" { /** * Performance monitor tracks rolling average frame-time and frame-time variance over a user defined sliding-window */ export class PerformanceMonitor { private _enabled; private _rollingFrameTime; private _lastFrameTimeMs; /** * constructor * @param frameSampleSize The number of samples required to saturate the sliding window */ constructor(frameSampleSize?: number); /** * Samples current frame * @param timeMs A timestamp in milliseconds of the current frame to compare with other frames */ sampleFrame(timeMs?: number): void; /** * Returns the average frame time in milliseconds over the sliding window (or the subset of frames sampled so far) */ readonly averageFrameTime: number; /** * Returns the variance frame time in milliseconds over the sliding window (or the subset of frames sampled so far) */ readonly averageFrameTimeVariance: number; /** * Returns the frame time of the most recent frame */ readonly instantaneousFrameTime: number; /** * Returns the average framerate in frames per second over the sliding window (or the subset of frames sampled so far) */ readonly averageFPS: number; /** * Returns the average framerate in frames per second using the most recent frame time */ readonly instantaneousFPS: number; /** * Returns true if enough samples have been taken to completely fill the sliding window */ readonly isSaturated: boolean; /** * Enables contributions to the sliding window sample set */ enable(): void; /** * Disables contributions to the sliding window sample set * Samples will not be interpolated over the disabled period */ disable(): void; /** * Returns true if sampling is enabled */ readonly isEnabled: boolean; /** * Resets performance monitor */ reset(): void; } /** * RollingAverage * * Utility to efficiently compute the rolling average and variance over a sliding window of samples */ export class RollingAverage { /** * Current average */ average: number; /** * Current variance */ variance: number; protected _samples: Array; protected _sampleCount: number; protected _pos: number; protected _m2: number; /** * constructor * @param length The number of samples required to saturate the sliding window */ constructor(length: number); /** * Adds a sample to the sample set * @param v The sample value */ add(v: number): void; /** * Returns previously added values or null if outside of history or outside the sliding window domain * @param i Index in history. For example, pass 0 for the most recent value and 1 for the value before that * @return Value previously recorded with add() or null if outside of range */ history(i: number): number; /** * Returns true if enough samples have been taken to completely fill the sliding window * @return true if sample-set saturated */ isSaturated(): boolean; /** * Resets the rolling average (equivalent to 0 samples taken so far) */ reset(): void; /** * Wraps a value around the sample range boundaries * @param i Position in sample range, for example if the sample length is 5, and i is -3, then 2 will be returned. * @return Wrapped position in sample range */ protected _wrapPosition(i: number): number; } } declare module "babylonjs/Misc/stringDictionary" { import { Nullable } from "babylonjs/types"; /** * This class implement a typical dictionary using a string as key and the generic type T as value. * The underlying implementation relies on an associative array to ensure the best performances. * The value can be anything including 'null' but except 'undefined' */ export class StringDictionary { /** * This will clear this dictionary and copy the content from the 'source' one. * If the T value is a custom object, it won't be copied/cloned, the same object will be used * @param source the dictionary to take the content from and copy to this dictionary */ copyFrom(source: StringDictionary): void; /** * Get a value based from its key * @param key the given key to get the matching value from * @return the value if found, otherwise undefined is returned */ get(key: string): T | undefined; /** * Get a value from its key or add it if it doesn't exist. * This method will ensure you that a given key/data will be present in the dictionary. * @param key the given key to get the matching value from * @param factory the factory that will create the value if the key is not present in the dictionary. * The factory will only be invoked if there's no data for the given key. * @return the value corresponding to the key. */ getOrAddWithFactory(key: string, factory: (key: string) => T): T; /** * Get a value from its key if present in the dictionary otherwise add it * @param key the key to get the value from * @param val if there's no such key/value pair in the dictionary add it with this value * @return the value corresponding to the key */ getOrAdd(key: string, val: T): T; /** * Check if there's a given key in the dictionary * @param key the key to check for * @return true if the key is present, false otherwise */ contains(key: string): boolean; /** * Add a new key and its corresponding value * @param key the key to add * @param value the value corresponding to the key * @return true if the operation completed successfully, false if we couldn't insert the key/value because there was already this key in the dictionary */ add(key: string, value: T): boolean; /** * Update a specific value associated to a key * @param key defines the key to use * @param value defines the value to store * @returns true if the value was updated (or false if the key was not found) */ set(key: string, value: T): boolean; /** * Get the element of the given key and remove it from the dictionary * @param key defines the key to search * @returns the value associated with the key or null if not found */ getAndRemove(key: string): Nullable; /** * Remove a key/value from the dictionary. * @param key the key to remove * @return true if the item was successfully deleted, false if no item with such key exist in the dictionary */ remove(key: string): boolean; /** * Clear the whole content of the dictionary */ clear(): void; /** * Gets the current count */ readonly count: number; /** * Execute a callback on each key/val of the dictionary. * Note that you can remove any element in this dictionary in the callback implementation * @param callback the callback to execute on a given key/value pair */ forEach(callback: (key: string, val: T) => void): void; /** * Execute a callback on every occurrence of the dictionary until it returns a valid TRes object. * If the callback returns null or undefined the method will iterate to the next key/value pair * Note that you can remove any element in this dictionary in the callback implementation * @param callback the callback to execute, if it return a valid T instanced object the enumeration will stop and the object will be returned * @returns the first item */ first(callback: (key: string, val: T) => TRes): TRes | null; private _count; private _data; } } declare module "babylonjs/Misc/promise" { /** * Helper class that provides a small promise polyfill */ export class PromisePolyfill { /** * Static function used to check if the polyfill is required * If this is the case then the function will inject the polyfill to window.Promise * @param force defines a boolean used to force the injection (mostly for testing purposes) */ static Apply(force?: boolean): void; } } declare module "babylonjs/Meshes/buffer" { import { Nullable, DataArray } from "babylonjs/types"; import { DataBuffer } from "babylonjs/Meshes/dataBuffer"; /** * Class used to store data that will be store in GPU memory */ export class Buffer { private _engine; private _buffer; /** @hidden */ _data: Nullable; private _updatable; private _instanced; /** * Gets the byte stride. */ readonly byteStride: number; /** * Constructor * @param engine the engine * @param data the data to use for this buffer * @param updatable whether the data is updatable * @param stride the stride (optional) * @param postponeInternalCreation whether to postpone creating the internal WebGL buffer (optional) * @param instanced whether the buffer is instanced (optional) * @param useBytes set to true if the stride in in bytes (optional) */ constructor(engine: any, data: DataArray, updatable: boolean, stride?: number, postponeInternalCreation?: boolean, instanced?: boolean, useBytes?: boolean); /** * Create a new VertexBuffer based on the current buffer * @param kind defines the vertex buffer kind (position, normal, etc.) * @param offset defines offset in the buffer (0 by default) * @param size defines the size in floats of attributes (position is 3 for instance) * @param stride defines the stride size in floats in the buffer (the offset to apply to reach next value when data is interleaved) * @param instanced defines if the vertex buffer contains indexed data * @param useBytes defines if the offset and stride are in bytes * @returns the new vertex buffer */ createVertexBuffer(kind: string, offset: number, size: number, stride?: number, instanced?: boolean, useBytes?: boolean): VertexBuffer; /** * Gets a boolean indicating if the Buffer is updatable? * @returns true if the buffer is updatable */ isUpdatable(): boolean; /** * Gets current buffer's data * @returns a DataArray or null */ getData(): Nullable; /** * Gets underlying native buffer * @returns underlying native buffer */ getBuffer(): Nullable; /** * Gets the stride in float32 units (i.e. byte stride / 4). * May not be an integer if the byte stride is not divisible by 4. * DEPRECATED. Use byteStride instead. * @returns the stride in float32 units */ getStrideSize(): number; /** * Store data into the buffer. If the buffer was already used it will be either recreated or updated depending on isUpdatable property * @param data defines the data to store */ create(data?: Nullable): void; /** @hidden */ _rebuild(): void; /** * Update current buffer data * @param data defines the data to store */ update(data: DataArray): void; /** * Updates the data directly. * @param data the new data * @param offset the new offset * @param vertexCount the vertex count (optional) * @param useBytes set to true if the offset is in bytes */ updateDirectly(data: DataArray, offset: number, vertexCount?: number, useBytes?: boolean): void; /** * Release all resources */ dispose(): void; } /** * Specialized buffer used to store vertex data */ export class VertexBuffer { /** @hidden */ _buffer: Buffer; private _kind; private _size; private _ownsBuffer; private _instanced; private _instanceDivisor; /** * The byte type. */ static readonly BYTE: number; /** * The unsigned byte type. */ static readonly UNSIGNED_BYTE: number; /** * The short type. */ static readonly SHORT: number; /** * The unsigned short type. */ static readonly UNSIGNED_SHORT: number; /** * The integer type. */ static readonly INT: number; /** * The unsigned integer type. */ static readonly UNSIGNED_INT: number; /** * The float type. */ static readonly FLOAT: number; /** * Gets or sets the instance divisor when in instanced mode */ instanceDivisor: number; /** * Gets the byte stride. */ readonly byteStride: number; /** * Gets the byte offset. */ readonly byteOffset: number; /** * Gets whether integer data values should be normalized into a certain range when being casted to a float. */ readonly normalized: boolean; /** * Gets the data type of each component in the array. */ readonly type: number; /** * Constructor * @param engine the engine * @param data the data to use for this vertex buffer * @param kind the vertex buffer kind * @param updatable whether the data is updatable * @param postponeInternalCreation whether to postpone creating the internal WebGL buffer (optional) * @param stride the stride (optional) * @param instanced whether the buffer is instanced (optional) * @param offset the offset of the data (optional) * @param size the number of components (optional) * @param type the type of the component (optional) * @param normalized whether the data contains normalized data (optional) * @param useBytes set to true if stride and offset are in bytes (optional) */ constructor(engine: any, data: DataArray | Buffer, kind: string, updatable: boolean, postponeInternalCreation?: boolean, stride?: number, instanced?: boolean, offset?: number, size?: number, type?: number, normalized?: boolean, useBytes?: boolean); /** @hidden */ _rebuild(): void; /** * Returns the kind of the VertexBuffer (string) * @returns a string */ getKind(): string; /** * Gets a boolean indicating if the VertexBuffer is updatable? * @returns true if the buffer is updatable */ isUpdatable(): boolean; /** * Gets current buffer's data * @returns a DataArray or null */ getData(): Nullable; /** * Gets underlying native buffer * @returns underlying native buffer */ getBuffer(): Nullable; /** * Gets the stride in float32 units (i.e. byte stride / 4). * May not be an integer if the byte stride is not divisible by 4. * DEPRECATED. Use byteStride instead. * @returns the stride in float32 units */ getStrideSize(): number; /** * Returns the offset as a multiple of the type byte length. * DEPRECATED. Use byteOffset instead. * @returns the offset in bytes */ getOffset(): number; /** * Returns the number of components per vertex attribute (integer) * @returns the size in float */ getSize(): number; /** * Gets a boolean indicating is the internal buffer of the VertexBuffer is instanced * @returns true if this buffer is instanced */ getIsInstanced(): boolean; /** * Returns the instancing divisor, zero for non-instanced (integer). * @returns a number */ getInstanceDivisor(): number; /** * Store data into the buffer. If the buffer was already used it will be either recreated or updated depending on isUpdatable property * @param data defines the data to store */ create(data?: DataArray): void; /** * Updates the underlying buffer according to the passed numeric array or Float32Array. * This function will create a new buffer if the current one is not updatable * @param data defines the data to store */ update(data: DataArray): void; /** * Updates directly the underlying WebGLBuffer according to the passed numeric array or Float32Array. * Returns the directly updated WebGLBuffer. * @param data the new data * @param offset the new offset * @param useBytes set to true if the offset is in bytes */ updateDirectly(data: DataArray, offset: number, useBytes?: boolean): void; /** * Disposes the VertexBuffer and the underlying WebGLBuffer. */ dispose(): void; /** * Enumerates each value of this vertex buffer as numbers. * @param count the number of values to enumerate * @param callback the callback function called for each value */ forEach(count: number, callback: (value: number, index: number) => void): void; /** * Positions */ static readonly PositionKind: string; /** * Normals */ static readonly NormalKind: string; /** * Tangents */ static readonly TangentKind: string; /** * Texture coordinates */ static readonly UVKind: string; /** * Texture coordinates 2 */ static readonly UV2Kind: string; /** * Texture coordinates 3 */ static readonly UV3Kind: string; /** * Texture coordinates 4 */ static readonly UV4Kind: string; /** * Texture coordinates 5 */ static readonly UV5Kind: string; /** * Texture coordinates 6 */ static readonly UV6Kind: string; /** * Colors */ static readonly ColorKind: string; /** * Matrix indices (for bones) */ static readonly MatricesIndicesKind: string; /** * Matrix weights (for bones) */ static readonly MatricesWeightsKind: string; /** * Additional matrix indices (for bones) */ static readonly MatricesIndicesExtraKind: string; /** * Additional matrix weights (for bones) */ static readonly MatricesWeightsExtraKind: string; /** * Deduces the stride given a kind. * @param kind The kind string to deduce * @returns The deduced stride */ static DeduceStride(kind: string): number; /** * Gets the byte length of the given type. * @param type the type * @returns the number of bytes */ static GetTypeByteLength(type: number): number; /** * Enumerates each value of the given parameters as numbers. * @param data the data to enumerate * @param byteOffset the byte offset of the data * @param byteStride the byte stride of the data * @param componentCount the number of components per element * @param componentType the type of the component * @param count the number of values to enumerate * @param normalized whether the data is normalized * @param callback the callback function called for each value */ static ForEach(data: DataArray, byteOffset: number, byteStride: number, componentCount: number, componentType: number, count: number, normalized: boolean, callback: (value: number, index: number) => void): void; private static _GetFloatValue; } } declare module "babylonjs/Maths/sphericalPolynomial" { import { Vector3, Color3 } from "babylonjs/Maths/math"; /** * Class representing spherical harmonics coefficients to the 3rd degree */ export class SphericalHarmonics { /** * Defines whether or not the harmonics have been prescaled for rendering. */ preScaled: boolean; /** * The l0,0 coefficients of the spherical harmonics */ l00: Vector3; /** * The l1,-1 coefficients of the spherical harmonics */ l1_1: Vector3; /** * The l1,0 coefficients of the spherical harmonics */ l10: Vector3; /** * The l1,1 coefficients of the spherical harmonics */ l11: Vector3; /** * The l2,-2 coefficients of the spherical harmonics */ l2_2: Vector3; /** * The l2,-1 coefficients of the spherical harmonics */ l2_1: Vector3; /** * The l2,0 coefficients of the spherical harmonics */ l20: Vector3; /** * The l2,1 coefficients of the spherical harmonics */ l21: Vector3; /** * The l2,2 coefficients of the spherical harmonics */ l22: Vector3; /** * Adds a light to the spherical harmonics * @param direction the direction of the light * @param color the color of the light * @param deltaSolidAngle the delta solid angle of the light */ addLight(direction: Vector3, color: Color3, deltaSolidAngle: number): void; /** * Scales the spherical harmonics by the given amount * @param scale the amount to scale */ scaleInPlace(scale: number): void; /** * Convert from incident radiance (Li) to irradiance (E) by applying convolution with the cosine-weighted hemisphere. * * ``` * E_lm = A_l * L_lm * ``` * * In spherical harmonics this convolution amounts to scaling factors for each frequency band. * This corresponds to equation 5 in "An Efficient Representation for Irradiance Environment Maps", where * the scaling factors are given in equation 9. */ convertIncidentRadianceToIrradiance(): void; /** * Convert from irradiance to outgoing radiance for Lambertian BDRF, suitable for efficient shader evaluation. * * ``` * L = (1/pi) * E * rho * ``` * * This is done by an additional scale by 1/pi, so is a fairly trivial operation but important conceptually. */ convertIrradianceToLambertianRadiance(): void; /** * Integrates the reconstruction coefficients directly in to the SH preventing further * required operations at run time. * * This is simply done by scaling back the SH with Ylm constants parameter. * The trigonometric part being applied by the shader at run time. */ preScaleForRendering(): void; /** * Constructs a spherical harmonics from an array. * @param data defines the 9x3 coefficients (l00, l1-1, l10, l11, l2-2, l2-1, l20, l21, l22) * @returns the spherical harmonics */ static FromArray(data: ArrayLike>): SphericalHarmonics; /** * Gets the spherical harmonics from polynomial * @param polynomial the spherical polynomial * @returns the spherical harmonics */ static FromPolynomial(polynomial: SphericalPolynomial): SphericalHarmonics; } /** * Class representing spherical polynomial coefficients to the 3rd degree */ export class SphericalPolynomial { private _harmonics; /** * The spherical harmonics used to create the polynomials. */ readonly preScaledHarmonics: SphericalHarmonics; /** * The x coefficients of the spherical polynomial */ x: Vector3; /** * The y coefficients of the spherical polynomial */ y: Vector3; /** * The z coefficients of the spherical polynomial */ z: Vector3; /** * The xx coefficients of the spherical polynomial */ xx: Vector3; /** * The yy coefficients of the spherical polynomial */ yy: Vector3; /** * The zz coefficients of the spherical polynomial */ zz: Vector3; /** * The xy coefficients of the spherical polynomial */ xy: Vector3; /** * The yz coefficients of the spherical polynomial */ yz: Vector3; /** * The zx coefficients of the spherical polynomial */ zx: Vector3; /** * Adds an ambient color to the spherical polynomial * @param color the color to add */ addAmbient(color: Color3): void; /** * Scales the spherical polynomial by the given amount * @param scale the amount to scale */ scaleInPlace(scale: number): void; /** * Gets the spherical polynomial from harmonics * @param harmonics the spherical harmonics * @returns the spherical polynomial */ static FromHarmonics(harmonics: SphericalHarmonics): SphericalPolynomial; /** * Constructs a spherical polynomial from an array. * @param data defines the 9x3 coefficients (x, y, z, xx, yy, zz, yz, zx, xy) * @returns the spherical polynomial */ static FromArray(data: ArrayLike>): SphericalPolynomial; } } declare module "babylonjs/Misc/HighDynamicRange/panoramaToCubemap" { import { Nullable } from "babylonjs/types"; /** * CubeMap information grouping all the data for each faces as well as the cubemap size. */ export interface CubeMapInfo { /** * The pixel array for the front face. * This is stored in format, left to right, up to down format. */ front: Nullable; /** * The pixel array for the back face. * This is stored in format, left to right, up to down format. */ back: Nullable; /** * The pixel array for the left face. * This is stored in format, left to right, up to down format. */ left: Nullable; /** * The pixel array for the right face. * This is stored in format, left to right, up to down format. */ right: Nullable; /** * The pixel array for the up face. * This is stored in format, left to right, up to down format. */ up: Nullable; /** * The pixel array for the down face. * This is stored in format, left to right, up to down format. */ down: Nullable; /** * The size of the cubemap stored. * * Each faces will be size * size pixels. */ size: number; /** * The format of the texture. * * RGBA, RGB. */ format: number; /** * The type of the texture data. * * UNSIGNED_INT, FLOAT. */ type: number; /** * Specifies whether the texture is in gamma space. */ gammaSpace: boolean; } /** * Helper class useful to convert panorama picture to their cubemap representation in 6 faces. */ export class PanoramaToCubeMapTools { private static FACE_FRONT; private static FACE_BACK; private static FACE_RIGHT; private static FACE_LEFT; private static FACE_DOWN; private static FACE_UP; /** * Converts a panorma stored in RGB right to left up to down format into a cubemap (6 faces). * * @param float32Array The source data. * @param inputWidth The width of the input panorama. * @param inputHeight The height of the input panorama. * @param size The willing size of the generated cubemap (each faces will be size * size pixels) * @return The cubemap data */ static ConvertPanoramaToCubemap(float32Array: Float32Array, inputWidth: number, inputHeight: number, size: number): CubeMapInfo; private static CreateCubemapTexture; private static CalcProjectionSpherical; } } declare module "babylonjs/Misc/HighDynamicRange/cubemapToSphericalPolynomial" { import { SphericalPolynomial } from "babylonjs/Maths/sphericalPolynomial"; import { BaseTexture } from "babylonjs/Materials/Textures/baseTexture"; import { CubeMapInfo } from "babylonjs/Misc/HighDynamicRange/panoramaToCubemap"; /** * Helper class dealing with the extraction of spherical polynomial dataArray * from a cube map. */ export class CubeMapToSphericalPolynomialTools { private static FileFaces; /** * Converts a texture to the according Spherical Polynomial data. * This extracts the first 3 orders only as they are the only one used in the lighting. * * @param texture The texture to extract the information from. * @return The Spherical Polynomial data. */ static ConvertCubeMapTextureToSphericalPolynomial(texture: BaseTexture): SphericalPolynomial | null; /** * Converts a cubemap to the according Spherical Polynomial data. * This extracts the first 3 orders only as they are the only one used in the lighting. * * @param cubeInfo The Cube map to extract the information from. * @return The Spherical Polynomial data. */ static ConvertCubeMapToSphericalPolynomial(cubeInfo: CubeMapInfo): SphericalPolynomial; } } declare module "babylonjs/Engines/engineStore" { import { Nullable } from "babylonjs/types"; import { Engine } from "babylonjs/Engines/engine"; import { Scene } from "babylonjs/scene"; /** * The engine store class is responsible to hold all the instances of Engine and Scene created * during the life time of the application. */ export class EngineStore { /** Gets the list of created engines */ static Instances: import("babylonjs/Engines/engine").Engine[]; /** @hidden */ static _LastCreatedScene: Nullable; /** * Gets the latest created engine */ static readonly LastCreatedEngine: Nullable; /** * Gets the latest created scene */ static readonly LastCreatedScene: Nullable; } } declare module "babylonjs/Materials/Textures/renderTargetCreationOptions" { /** * Define options used to create a render target texture */ export class RenderTargetCreationOptions { /** * Specifies is mipmaps must be generated */ generateMipMaps?: boolean; /** Specifies whether or not a depth should be allocated in the texture (true by default) */ generateDepthBuffer?: boolean; /** Specifies whether or not a stencil should be allocated in the texture (false by default)*/ generateStencilBuffer?: boolean; /** Defines texture type (int by default) */ type?: number; /** Defines sampling mode (trilinear by default) */ samplingMode?: number; /** Defines format (RGBA by default) */ format?: number; } } declare module "babylonjs/States/alphaCullingState" { /** * @hidden **/ export class _AlphaState { private _isAlphaBlendDirty; private _isBlendFunctionParametersDirty; private _isBlendEquationParametersDirty; private _isBlendConstantsDirty; private _alphaBlend; private _blendFunctionParameters; private _blendEquationParameters; private _blendConstants; /** * Initializes the state. */ constructor(); readonly isDirty: boolean; alphaBlend: boolean; setAlphaBlendConstants(r: number, g: number, b: number, a: number): void; setAlphaBlendFunctionParameters(value0: number, value1: number, value2: number, value3: number): void; setAlphaEquationParameters(rgb: number, alpha: number): void; reset(): void; apply(gl: WebGLRenderingContext): void; } } declare module "babylonjs/States/depthCullingState" { import { Nullable } from "babylonjs/types"; /** * @hidden **/ export class _DepthCullingState { private _isDepthTestDirty; private _isDepthMaskDirty; private _isDepthFuncDirty; private _isCullFaceDirty; private _isCullDirty; private _isZOffsetDirty; private _isFrontFaceDirty; private _depthTest; private _depthMask; private _depthFunc; private _cull; private _cullFace; private _zOffset; private _frontFace; /** * Initializes the state. */ constructor(); readonly isDirty: boolean; zOffset: number; cullFace: Nullable; cull: Nullable; depthFunc: Nullable; depthMask: boolean; depthTest: boolean; frontFace: Nullable; reset(): void; apply(gl: WebGLRenderingContext): void; } } declare module "babylonjs/States/stencilState" { /** * @hidden **/ export class _StencilState { /** Passed to depthFunction or stencilFunction to specify depth or stencil tests will always pass. i.e. Pixels will be drawn in the order they are drawn */ static readonly ALWAYS: number; /** Passed to stencilOperation to specify that stencil value must be kept */ static readonly KEEP: number; /** Passed to stencilOperation to specify that stencil value must be replaced */ static readonly REPLACE: number; private _isStencilTestDirty; private _isStencilMaskDirty; private _isStencilFuncDirty; private _isStencilOpDirty; private _stencilTest; private _stencilMask; private _stencilFunc; private _stencilFuncRef; private _stencilFuncMask; private _stencilOpStencilFail; private _stencilOpDepthFail; private _stencilOpStencilDepthPass; readonly isDirty: boolean; stencilFunc: number; stencilFuncRef: number; stencilFuncMask: number; stencilOpStencilFail: number; stencilOpDepthFail: number; stencilOpStencilDepthPass: number; stencilMask: number; stencilTest: boolean; constructor(); reset(): void; apply(gl: WebGLRenderingContext): void; } } declare module "babylonjs/States/index" { export * from "babylonjs/States/alphaCullingState"; export * from "babylonjs/States/depthCullingState"; export * from "babylonjs/States/stencilState"; } declare module "babylonjs/Instrumentation/timeToken" { import { Nullable } from "babylonjs/types"; /** * @hidden **/ export class _TimeToken { _startTimeQuery: Nullable; _endTimeQuery: Nullable; _timeElapsedQuery: Nullable; _timeElapsedQueryEnded: boolean; } } declare module "babylonjs/Materials/Textures/internalTexture" { import { Observable } from "babylonjs/Misc/observable"; import { Nullable, int } from "babylonjs/types"; import { SphericalPolynomial } from "babylonjs/Maths/sphericalPolynomial"; import { Engine } from "babylonjs/Engines/engine"; import { BaseTexture } from "babylonjs/Materials/Textures/baseTexture"; /** * Class used to store data associated with WebGL texture data for the engine * This class should not be used directly */ export class InternalTexture { /** @hidden */ static _UpdateRGBDAsync: (internalTexture: InternalTexture, data: ArrayBufferView[][], sphericalPolynomial: SphericalPolynomial | null, lodScale: number, lodOffset: number) => Promise; /** * The source of the texture data is unknown */ static DATASOURCE_UNKNOWN: number; /** * Texture data comes from an URL */ static DATASOURCE_URL: number; /** * Texture data is only used for temporary storage */ static DATASOURCE_TEMP: number; /** * Texture data comes from raw data (ArrayBuffer) */ static DATASOURCE_RAW: number; /** * Texture content is dynamic (video or dynamic texture) */ static DATASOURCE_DYNAMIC: number; /** * Texture content is generated by rendering to it */ static DATASOURCE_RENDERTARGET: number; /** * Texture content is part of a multi render target process */ static DATASOURCE_MULTIRENDERTARGET: number; /** * Texture data comes from a cube data file */ static DATASOURCE_CUBE: number; /** * Texture data comes from a raw cube data */ static DATASOURCE_CUBERAW: number; /** * Texture data come from a prefiltered cube data file */ static DATASOURCE_CUBEPREFILTERED: number; /** * Texture content is raw 3D data */ static DATASOURCE_RAW3D: number; /** * Texture content is a depth texture */ static DATASOURCE_DEPTHTEXTURE: number; /** * Texture data comes from a raw cube data encoded with RGBD */ static DATASOURCE_CUBERAW_RGBD: number; /** * Defines if the texture is ready */ isReady: boolean; /** * Defines if the texture is a cube texture */ isCube: boolean; /** * Defines if the texture contains 3D data */ is3D: boolean; /** * Defines if the texture contains multiview data */ isMultiview: boolean; /** * Gets the URL used to load this texture */ url: string; /** * Gets the sampling mode of the texture */ samplingMode: number; /** * Gets a boolean indicating if the texture needs mipmaps generation */ generateMipMaps: boolean; /** * Gets the number of samples used by the texture (WebGL2+ only) */ samples: number; /** * Gets the type of the texture (int, float...) */ type: number; /** * Gets the format of the texture (RGB, RGBA...) */ format: number; /** * Observable called when the texture is loaded */ onLoadedObservable: Observable; /** * Gets the width of the texture */ width: number; /** * Gets the height of the texture */ height: number; /** * Gets the depth of the texture */ depth: number; /** * Gets the initial width of the texture (It could be rescaled if the current system does not support non power of two textures) */ baseWidth: number; /** * Gets the initial height of the texture (It could be rescaled if the current system does not support non power of two textures) */ baseHeight: number; /** * Gets the initial depth of the texture (It could be rescaled if the current system does not support non power of two textures) */ baseDepth: number; /** * Gets a boolean indicating if the texture is inverted on Y axis */ invertY: boolean; /** @hidden */ _invertVScale: boolean; /** @hidden */ _associatedChannel: number; /** @hidden */ _dataSource: number; /** @hidden */ _buffer: Nullable; /** @hidden */ _bufferView: Nullable; /** @hidden */ _bufferViewArray: Nullable; /** @hidden */ _bufferViewArrayArray: Nullable; /** @hidden */ _size: number; /** @hidden */ _extension: string; /** @hidden */ _files: Nullable; /** @hidden */ _workingCanvas: Nullable; /** @hidden */ _workingContext: Nullable; /** @hidden */ _framebuffer: Nullable; /** @hidden */ _depthStencilBuffer: Nullable; /** @hidden */ _MSAAFramebuffer: Nullable; /** @hidden */ _MSAARenderBuffer: Nullable; /** @hidden */ _attachments: Nullable; /** @hidden */ _cachedCoordinatesMode: Nullable; /** @hidden */ _cachedWrapU: Nullable; /** @hidden */ _cachedWrapV: Nullable; /** @hidden */ _cachedWrapR: Nullable; /** @hidden */ _cachedAnisotropicFilteringLevel: Nullable; /** @hidden */ _isDisabled: boolean; /** @hidden */ _compression: Nullable; /** @hidden */ _generateStencilBuffer: boolean; /** @hidden */ _generateDepthBuffer: boolean; /** @hidden */ _comparisonFunction: number; /** @hidden */ _sphericalPolynomial: Nullable; /** @hidden */ _lodGenerationScale: number; /** @hidden */ _lodGenerationOffset: number; /** @hidden */ _colorTextureArray: Nullable; /** @hidden */ _depthStencilTextureArray: Nullable; /** @hidden */ _lodTextureHigh: Nullable; /** @hidden */ _lodTextureMid: Nullable; /** @hidden */ _lodTextureLow: Nullable; /** @hidden */ _isRGBD: boolean; /** @hidden */ _linearSpecularLOD: boolean; /** @hidden */ _irradianceTexture: Nullable; /** @hidden */ _webGLTexture: Nullable; /** @hidden */ _references: number; private _engine; /** * Gets the Engine the texture belongs to. * @returns The babylon engine */ getEngine(): Engine; /** * Gets the data source type of the texture (can be one of the InternalTexture.DATASOURCE_XXXX) */ readonly dataSource: number; /** * Creates a new InternalTexture * @param engine defines the engine to use * @param dataSource defines the type of data that will be used * @param delayAllocation if the texture allocation should be delayed (default: false) */ constructor(engine: Engine, dataSource: number, delayAllocation?: boolean); /** * Increments the number of references (ie. the number of Texture that point to it) */ incrementReferences(): void; /** * Change the size of the texture (not the size of the content) * @param width defines the new width * @param height defines the new height * @param depth defines the new depth (1 by default) */ updateSize(width: int, height: int, depth?: int): void; /** @hidden */ _rebuild(): void; /** @hidden */ _swapAndDie(target: InternalTexture): void; /** * Dispose the current allocated resources */ dispose(): void; } } declare module "babylonjs/Animations/easing" { /** * This represents the main contract an easing function should follow. * Easing functions are used throughout the animation system. * @see http://doc.babylonjs.com/babylon101/animations#easing-functions */ export interface IEasingFunction { /** * Given an input gradient between 0 and 1, this returns the corrseponding value * of the easing function. * The link below provides some of the most common examples of easing functions. * @see https://easings.net/ * @param gradient Defines the value between 0 and 1 we want the easing value for * @returns the corresponding value on the curve defined by the easing function */ ease(gradient: number): number; } /** * Base class used for every default easing function. * @see http://doc.babylonjs.com/babylon101/animations#easing-functions */ export class EasingFunction implements IEasingFunction { /** * Interpolation follows the mathematical formula associated with the easing function. */ static readonly EASINGMODE_EASEIN: number; /** * Interpolation follows 100% interpolation minus the output of the formula associated with the easing function. */ static readonly EASINGMODE_EASEOUT: number; /** * Interpolation uses EaseIn for the first half of the animation and EaseOut for the second half. */ static readonly EASINGMODE_EASEINOUT: number; private _easingMode; /** * Sets the easing mode of the current function. * @param easingMode Defines the willing mode (EASINGMODE_EASEIN, EASINGMODE_EASEOUT or EASINGMODE_EASEINOUT) */ setEasingMode(easingMode: number): void; /** * Gets the current easing mode. * @returns the easing mode */ getEasingMode(): number; /** * @hidden */ easeInCore(gradient: number): number; /** * Given an input gradient between 0 and 1, this returns the corrseponding value * of the easing function. * @param gradient Defines the value between 0 and 1 we want the easing value for * @returns the corresponding value on the curve defined by the easing function */ ease(gradient: number): number; } /** * Easing function with a circle shape (see link below). * @see https://easings.net/#easeInCirc * @see http://doc.babylonjs.com/babylon101/animations#easing-functions */ export class CircleEase extends EasingFunction implements IEasingFunction { /** @hidden */ easeInCore(gradient: number): number; } /** * Easing function with a ease back shape (see link below). * @see https://easings.net/#easeInBack * @see http://doc.babylonjs.com/babylon101/animations#easing-functions */ export class BackEase extends EasingFunction implements IEasingFunction { /** Defines the amplitude of the function */ amplitude: number; /** * Instantiates a back ease easing * @see https://easings.net/#easeInBack * @param amplitude Defines the amplitude of the function */ constructor( /** Defines the amplitude of the function */ amplitude?: number); /** @hidden */ easeInCore(gradient: number): number; } /** * Easing function with a bouncing shape (see link below). * @see https://easings.net/#easeInBounce * @see http://doc.babylonjs.com/babylon101/animations#easing-functions */ export class BounceEase extends EasingFunction implements IEasingFunction { /** Defines the number of bounces */ bounces: number; /** Defines the amplitude of the bounce */ bounciness: number; /** * Instantiates a bounce easing * @see https://easings.net/#easeInBounce * @param bounces Defines the number of bounces * @param bounciness Defines the amplitude of the bounce */ constructor( /** Defines the number of bounces */ bounces?: number, /** Defines the amplitude of the bounce */ bounciness?: number); /** @hidden */ easeInCore(gradient: number): number; } /** * Easing function with a power of 3 shape (see link below). * @see https://easings.net/#easeInCubic * @see http://doc.babylonjs.com/babylon101/animations#easing-functions */ export class CubicEase extends EasingFunction implements IEasingFunction { /** @hidden */ easeInCore(gradient: number): number; } /** * Easing function with an elastic shape (see link below). * @see https://easings.net/#easeInElastic * @see http://doc.babylonjs.com/babylon101/animations#easing-functions */ export class ElasticEase extends EasingFunction implements IEasingFunction { /** Defines the number of oscillations*/ oscillations: number; /** Defines the amplitude of the oscillations*/ springiness: number; /** * Instantiates an elastic easing function * @see https://easings.net/#easeInElastic * @param oscillations Defines the number of oscillations * @param springiness Defines the amplitude of the oscillations */ constructor( /** Defines the number of oscillations*/ oscillations?: number, /** Defines the amplitude of the oscillations*/ springiness?: number); /** @hidden */ easeInCore(gradient: number): number; } /** * Easing function with an exponential shape (see link below). * @see https://easings.net/#easeInExpo * @see http://doc.babylonjs.com/babylon101/animations#easing-functions */ export class ExponentialEase extends EasingFunction implements IEasingFunction { /** Defines the exponent of the function */ exponent: number; /** * Instantiates an exponential easing function * @see https://easings.net/#easeInExpo * @param exponent Defines the exponent of the function */ constructor( /** Defines the exponent of the function */ exponent?: number); /** @hidden */ easeInCore(gradient: number): number; } /** * Easing function with a power shape (see link below). * @see https://easings.net/#easeInQuad * @see http://doc.babylonjs.com/babylon101/animations#easing-functions */ export class PowerEase extends EasingFunction implements IEasingFunction { /** Defines the power of the function */ power: number; /** * Instantiates an power base easing function * @see https://easings.net/#easeInQuad * @param power Defines the power of the function */ constructor( /** Defines the power of the function */ power?: number); /** @hidden */ easeInCore(gradient: number): number; } /** * Easing function with a power of 2 shape (see link below). * @see https://easings.net/#easeInQuad * @see http://doc.babylonjs.com/babylon101/animations#easing-functions */ export class QuadraticEase extends EasingFunction implements IEasingFunction { /** @hidden */ easeInCore(gradient: number): number; } /** * Easing function with a power of 4 shape (see link below). * @see https://easings.net/#easeInQuart * @see http://doc.babylonjs.com/babylon101/animations#easing-functions */ export class QuarticEase extends EasingFunction implements IEasingFunction { /** @hidden */ easeInCore(gradient: number): number; } /** * Easing function with a power of 5 shape (see link below). * @see https://easings.net/#easeInQuint * @see http://doc.babylonjs.com/babylon101/animations#easing-functions */ export class QuinticEase extends EasingFunction implements IEasingFunction { /** @hidden */ easeInCore(gradient: number): number; } /** * Easing function with a sin shape (see link below). * @see https://easings.net/#easeInSine * @see http://doc.babylonjs.com/babylon101/animations#easing-functions */ export class SineEase extends EasingFunction implements IEasingFunction { /** @hidden */ easeInCore(gradient: number): number; } /** * Easing function with a bezier shape (see link below). * @see http://cubic-bezier.com/#.17,.67,.83,.67 * @see http://doc.babylonjs.com/babylon101/animations#easing-functions */ export class BezierCurveEase extends EasingFunction implements IEasingFunction { /** Defines the x component of the start tangent in the bezier curve */ x1: number; /** Defines the y component of the start tangent in the bezier curve */ y1: number; /** Defines the x component of the end tangent in the bezier curve */ x2: number; /** Defines the y component of the end tangent in the bezier curve */ y2: number; /** * Instantiates a bezier function * @see http://cubic-bezier.com/#.17,.67,.83,.67 * @param x1 Defines the x component of the start tangent in the bezier curve * @param y1 Defines the y component of the start tangent in the bezier curve * @param x2 Defines the x component of the end tangent in the bezier curve * @param y2 Defines the y component of the end tangent in the bezier curve */ constructor( /** Defines the x component of the start tangent in the bezier curve */ x1?: number, /** Defines the y component of the start tangent in the bezier curve */ y1?: number, /** Defines the x component of the end tangent in the bezier curve */ x2?: number, /** Defines the y component of the end tangent in the bezier curve */ y2?: number); /** @hidden */ easeInCore(gradient: number): number; } } declare module "babylonjs/Animations/animationKey" { /** * Defines an interface which represents an animation key frame */ export interface IAnimationKey { /** * Frame of the key frame */ frame: number; /** * Value at the specifies key frame */ value: any; /** * The input tangent for the cubic hermite spline */ inTangent?: any; /** * The output tangent for the cubic hermite spline */ outTangent?: any; /** * The animation interpolation type */ interpolation?: AnimationKeyInterpolation; } /** * Enum for the animation key frame interpolation type */ export enum AnimationKeyInterpolation { /** * Do not interpolate between keys and use the start key value only. Tangents are ignored */ STEP = 1 } } declare module "babylonjs/Animations/animationRange" { /** * Represents the range of an animation */ export class AnimationRange { /**The name of the animation range**/ name: string; /**The starting frame of the animation */ from: number; /**The ending frame of the animation*/ to: number; /** * Initializes the range of an animation * @param name The name of the animation range * @param from The starting frame of the animation * @param to The ending frame of the animation */ constructor( /**The name of the animation range**/ name: string, /**The starting frame of the animation */ from: number, /**The ending frame of the animation*/ to: number); /** * Makes a copy of the animation range * @returns A copy of the animation range */ clone(): AnimationRange; } } declare module "babylonjs/Animations/animationEvent" { /** * Composed of a frame, and an action function */ export class AnimationEvent { /** The frame for which the event is triggered **/ frame: number; /** The event to perform when triggered **/ action: (currentFrame: number) => void; /** Specifies if the event should be triggered only once**/ onlyOnce?: boolean | undefined; /** * Specifies if the animation event is done */ isDone: boolean; /** * Initializes the animation event * @param frame The frame for which the event is triggered * @param action The event to perform when triggered * @param onlyOnce Specifies if the event should be triggered only once */ constructor( /** The frame for which the event is triggered **/ frame: number, /** The event to perform when triggered **/ action: (currentFrame: number) => void, /** Specifies if the event should be triggered only once**/ onlyOnce?: boolean | undefined); /** @hidden */ _clone(): AnimationEvent; } } declare module "babylonjs/Behaviors/behavior" { import { Nullable } from "babylonjs/types"; /** * Interface used to define a behavior */ export interface Behavior { /** gets or sets behavior's name */ name: string; /** * Function called when the behavior needs to be initialized (after attaching it to a target) */ init(): void; /** * Called when the behavior is attached to a target * @param target defines the target where the behavior is attached to */ attach(target: T): void; /** * Called when the behavior is detached from its target */ detach(): void; } /** * Interface implemented by classes supporting behaviors */ export interface IBehaviorAware { /** * Attach a behavior * @param behavior defines the behavior to attach * @returns the current host */ addBehavior(behavior: Behavior): T; /** * Remove a behavior from the current object * @param behavior defines the behavior to detach * @returns the current host */ removeBehavior(behavior: Behavior): T; /** * Gets a behavior using its name to search * @param name defines the name to search * @returns the behavior or null if not found */ getBehaviorByName(name: string): Nullable>; } } declare module "babylonjs/Collisions/intersectionInfo" { import { Nullable } from "babylonjs/types"; /** * @hidden */ export class IntersectionInfo { bu: Nullable; bv: Nullable; distance: number; faceId: number; subMeshId: number; constructor(bu: Nullable, bv: Nullable, distance: number); } } declare module "babylonjs/Culling/boundingSphere" { import { DeepImmutable } from "babylonjs/types"; import { Matrix, Vector3, Plane } from "babylonjs/Maths/math"; /** * Class used to store bounding sphere information */ export class BoundingSphere { /** * Gets the center of the bounding sphere in local space */ readonly center: Vector3; /** * Radius of the bounding sphere in local space */ radius: number; /** * Gets the center of the bounding sphere in world space */ readonly centerWorld: Vector3; /** * Radius of the bounding sphere in world space */ radiusWorld: number; /** * Gets the minimum vector in local space */ readonly minimum: Vector3; /** * Gets the maximum vector in local space */ readonly maximum: Vector3; private _worldMatrix; private static readonly TmpVector3; /** * Creates a new bounding sphere * @param min defines the minimum vector (in local space) * @param max defines the maximum vector (in local space) * @param worldMatrix defines the new world matrix */ constructor(min: DeepImmutable, max: DeepImmutable, worldMatrix?: DeepImmutable); /** * Recreates the entire bounding sphere from scratch as if we call the constructor in place * @param min defines the new minimum vector (in local space) * @param max defines the new maximum vector (in local space) * @param worldMatrix defines the new world matrix */ reConstruct(min: DeepImmutable, max: DeepImmutable, worldMatrix?: DeepImmutable): void; /** * Scale the current bounding sphere by applying a scale factor * @param factor defines the scale factor to apply * @returns the current bounding box */ scale(factor: number): BoundingSphere; /** * Gets the world matrix of the bounding box * @returns a matrix */ getWorldMatrix(): DeepImmutable; /** @hidden */ _update(worldMatrix: DeepImmutable): void; /** * Tests if the bounding sphere is intersecting the frustum planes * @param frustumPlanes defines the frustum planes to test * @returns true if there is an intersection */ isInFrustum(frustumPlanes: Array>): boolean; /** * Tests if the bounding sphere center is in between the frustum planes. * Used for optimistic fast inclusion. * @param frustumPlanes defines the frustum planes to test * @returns true if the sphere center is in between the frustum planes */ isCenterInFrustum(frustumPlanes: Array>): boolean; /** * Tests if a point is inside the bounding sphere * @param point defines the point to test * @returns true if the point is inside the bounding sphere */ intersectsPoint(point: DeepImmutable): boolean; /** * Checks if two sphere intersct * @param sphere0 sphere 0 * @param sphere1 sphere 1 * @returns true if the speres intersect */ static Intersects(sphere0: DeepImmutable, sphere1: DeepImmutable): boolean; } } declare module "babylonjs/Culling/boundingBox" { import { DeepImmutable } from "babylonjs/types"; import { Matrix, Vector3, Plane } from "babylonjs/Maths/math"; import { BoundingSphere } from "babylonjs/Culling/boundingSphere"; import { ICullable } from "babylonjs/Culling/boundingInfo"; /** * Class used to store bounding box information */ export class BoundingBox implements ICullable { /** * Gets the 8 vectors representing the bounding box in local space */ readonly vectors: Vector3[]; /** * Gets the center of the bounding box in local space */ readonly center: Vector3; /** * Gets the center of the bounding box in world space */ readonly centerWorld: Vector3; /** * Gets the extend size in local space */ readonly extendSize: Vector3; /** * Gets the extend size in world space */ readonly extendSizeWorld: Vector3; /** * Gets the OBB (object bounding box) directions */ readonly directions: Vector3[]; /** * Gets the 8 vectors representing the bounding box in world space */ readonly vectorsWorld: Vector3[]; /** * Gets the minimum vector in world space */ readonly minimumWorld: Vector3; /** * Gets the maximum vector in world space */ readonly maximumWorld: Vector3; /** * Gets the minimum vector in local space */ readonly minimum: Vector3; /** * Gets the maximum vector in local space */ readonly maximum: Vector3; private _worldMatrix; private static readonly TmpVector3; /** * @hidden */ _tag: number; /** * Creates a new bounding box * @param min defines the minimum vector (in local space) * @param max defines the maximum vector (in local space) * @param worldMatrix defines the new world matrix */ constructor(min: DeepImmutable, max: DeepImmutable, worldMatrix?: DeepImmutable); /** * Recreates the entire bounding box from scratch as if we call the constructor in place * @param min defines the new minimum vector (in local space) * @param max defines the new maximum vector (in local space) * @param worldMatrix defines the new world matrix */ reConstruct(min: DeepImmutable, max: DeepImmutable, worldMatrix?: DeepImmutable): void; /** * Scale the current bounding box by applying a scale factor * @param factor defines the scale factor to apply * @returns the current bounding box */ scale(factor: number): BoundingBox; /** * Gets the world matrix of the bounding box * @returns a matrix */ getWorldMatrix(): DeepImmutable; /** @hidden */ _update(world: DeepImmutable): void; /** * Tests if the bounding box is intersecting the frustum planes * @param frustumPlanes defines the frustum planes to test * @returns true if there is an intersection */ isInFrustum(frustumPlanes: Array>): boolean; /** * Tests if the bounding box is entirely inside the frustum planes * @param frustumPlanes defines the frustum planes to test * @returns true if there is an inclusion */ isCompletelyInFrustum(frustumPlanes: Array>): boolean; /** * Tests if a point is inside the bounding box * @param point defines the point to test * @returns true if the point is inside the bounding box */ intersectsPoint(point: DeepImmutable): boolean; /** * Tests if the bounding box intersects with a bounding sphere * @param sphere defines the sphere to test * @returns true if there is an intersection */ intersectsSphere(sphere: DeepImmutable): boolean; /** * Tests if the bounding box intersects with a box defined by a min and max vectors * @param min defines the min vector to use * @param max defines the max vector to use * @returns true if there is an intersection */ intersectsMinMax(min: DeepImmutable, max: DeepImmutable): boolean; /** * Tests if two bounding boxes are intersections * @param box0 defines the first box to test * @param box1 defines the second box to test * @returns true if there is an intersection */ static Intersects(box0: DeepImmutable, box1: DeepImmutable): boolean; /** * Tests if a bounding box defines by a min/max vectors intersects a sphere * @param minPoint defines the minimum vector of the bounding box * @param maxPoint defines the maximum vector of the bounding box * @param sphereCenter defines the sphere center * @param sphereRadius defines the sphere radius * @returns true if there is an intersection */ static IntersectsSphere(minPoint: DeepImmutable, maxPoint: DeepImmutable, sphereCenter: DeepImmutable, sphereRadius: number): boolean; /** * Tests if a bounding box defined with 8 vectors is entirely inside frustum planes * @param boundingVectors defines an array of 8 vectors representing a bounding box * @param frustumPlanes defines the frustum planes to test * @return true if there is an inclusion */ static IsCompletelyInFrustum(boundingVectors: Array>, frustumPlanes: Array>): boolean; /** * Tests if a bounding box defined with 8 vectors intersects frustum planes * @param boundingVectors defines an array of 8 vectors representing a bounding box * @param frustumPlanes defines the frustum planes to test * @return true if there is an intersection */ static IsInFrustum(boundingVectors: Array>, frustumPlanes: Array>): boolean; } } declare module "babylonjs/Collisions/collider" { import { Nullable, IndicesArray } from "babylonjs/types"; import { Vector3, Plane } from "babylonjs/Maths/math"; import { AbstractMesh } from "babylonjs/Meshes/abstractMesh"; /** @hidden */ export class Collider { /** Define if a collision was found */ collisionFound: boolean; /** * Define last intersection point in local space */ intersectionPoint: Vector3; /** * Define last collided mesh */ collidedMesh: Nullable; private _collisionPoint; private _planeIntersectionPoint; private _tempVector; private _tempVector2; private _tempVector3; private _tempVector4; private _edge; private _baseToVertex; private _destinationPoint; private _slidePlaneNormal; private _displacementVector; /** @hidden */ _radius: Vector3; /** @hidden */ _retry: number; private _velocity; private _basePoint; private _epsilon; /** @hidden */ _velocityWorldLength: number; /** @hidden */ _basePointWorld: Vector3; private _velocityWorld; private _normalizedVelocity; /** @hidden */ _initialVelocity: Vector3; /** @hidden */ _initialPosition: Vector3; private _nearestDistance; private _collisionMask; collisionMask: number; /** * Gets the plane normal used to compute the sliding response (in local space) */ readonly slidePlaneNormal: Vector3; /** @hidden */ _initialize(source: Vector3, dir: Vector3, e: number): void; /** @hidden */ _checkPointInTriangle(point: Vector3, pa: Vector3, pb: Vector3, pc: Vector3, n: Vector3): boolean; /** @hidden */ _canDoCollision(sphereCenter: Vector3, sphereRadius: number, vecMin: Vector3, vecMax: Vector3): boolean; /** @hidden */ _testTriangle(faceIndex: number, trianglePlaneArray: Array, p1: Vector3, p2: Vector3, p3: Vector3, hasMaterial: boolean): void; /** @hidden */ _collide(trianglePlaneArray: Array, pts: Vector3[], indices: IndicesArray, indexStart: number, indexEnd: number, decal: number, hasMaterial: boolean): void; /** @hidden */ _getResponse(pos: Vector3, vel: Vector3): void; } } declare module "babylonjs/Culling/boundingInfo" { import { DeepImmutable } from "babylonjs/types"; import { Matrix, Vector3, Plane } from "babylonjs/Maths/math"; import { BoundingBox } from "babylonjs/Culling/boundingBox"; import { BoundingSphere } from "babylonjs/Culling/boundingSphere"; import { Collider } from "babylonjs/Collisions/collider"; /** * Interface for cullable objects * @see https://doc.babylonjs.com/babylon101/materials#back-face-culling */ export interface ICullable { /** * Checks if the object or part of the object is in the frustum * @param frustumPlanes Camera near/planes * @returns true if the object is in frustum otherwise false */ isInFrustum(frustumPlanes: Plane[]): boolean; /** * Checks if a cullable object (mesh...) is in the camera frustum * Unlike isInFrustum this cheks the full bounding box * @param frustumPlanes Camera near/planes * @returns true if the object is in frustum otherwise false */ isCompletelyInFrustum(frustumPlanes: Plane[]): boolean; } /** * Info for a bounding data of a mesh */ export class BoundingInfo implements ICullable { /** * Bounding box for the mesh */ readonly boundingBox: BoundingBox; /** * Bounding sphere for the mesh */ readonly boundingSphere: BoundingSphere; private _isLocked; private static readonly TmpVector3; /** * Constructs bounding info * @param minimum min vector of the bounding box/sphere * @param maximum max vector of the bounding box/sphere * @param worldMatrix defines the new world matrix */ constructor(minimum: DeepImmutable, maximum: DeepImmutable, worldMatrix?: DeepImmutable); /** * Recreates the entire bounding info from scratch as if we call the constructor in place * @param min defines the new minimum vector (in local space) * @param max defines the new maximum vector (in local space) * @param worldMatrix defines the new world matrix */ reConstruct(min: DeepImmutable, max: DeepImmutable, worldMatrix?: DeepImmutable): void; /** * min vector of the bounding box/sphere */ readonly minimum: Vector3; /** * max vector of the bounding box/sphere */ readonly maximum: Vector3; /** * If the info is locked and won't be updated to avoid perf overhead */ isLocked: boolean; /** * Updates the bounding sphere and box * @param world world matrix to be used to update */ update(world: DeepImmutable): void; /** * Recreate the bounding info to be centered around a specific point given a specific extend. * @param center New center of the bounding info * @param extend New extend of the bounding info * @returns the current bounding info */ centerOn(center: DeepImmutable, extend: DeepImmutable): BoundingInfo; /** * Scale the current bounding info by applying a scale factor * @param factor defines the scale factor to apply * @returns the current bounding info */ scale(factor: number): BoundingInfo; /** * Returns `true` if the bounding info is within the frustum defined by the passed array of planes. * @param frustumPlanes defines the frustum to test * @param strategy defines the strategy to use for the culling (default is BABYLON.AbstractMesh.CULLINGSTRATEGY_STANDARD) * @returns true if the bounding info is in the frustum planes */ isInFrustum(frustumPlanes: Array>, strategy?: number): boolean; /** * Gets the world distance between the min and max points of the bounding box */ readonly diagonalLength: number; /** * Checks if a cullable object (mesh...) is in the camera frustum * Unlike isInFrustum this cheks the full bounding box * @param frustumPlanes Camera near/planes * @returns true if the object is in frustum otherwise false */ isCompletelyInFrustum(frustumPlanes: Array>): boolean; /** @hidden */ _checkCollision(collider: Collider): boolean; /** * Checks if a point is inside the bounding box and bounding sphere or the mesh * @see https://doc.babylonjs.com/babylon101/intersect_collisions_-_mesh * @param point the point to check intersection with * @returns if the point intersects */ intersectsPoint(point: DeepImmutable): boolean; /** * Checks if another bounding info intersects the bounding box and bounding sphere or the mesh * @see https://doc.babylonjs.com/babylon101/intersect_collisions_-_mesh * @param boundingInfo the bounding info to check intersection with * @param precise if the intersection should be done using OBB * @returns if the bounding info intersects */ intersects(boundingInfo: DeepImmutable, precise: boolean): boolean; } } declare module "babylonjs/Misc/smartArray" { /** * Defines an array and its length. * It can be helpfull to group result from both Arrays and smart arrays in one structure. */ export interface ISmartArrayLike { /** * The data of the array. */ data: Array; /** * The active length of the array. */ length: number; } /** * Defines an GC Friendly array where the backfield array do not shrink to prevent over allocations. */ export class SmartArray implements ISmartArrayLike { /** * The full set of data from the array. */ data: Array; /** * The active length of the array. */ length: number; protected _id: number; /** * Instantiates a Smart Array. * @param capacity defines the default capacity of the array. */ constructor(capacity: number); /** * Pushes a value at the end of the active data. * @param value defines the object to push in the array. */ push(value: T): void; /** * Iterates over the active data and apply the lambda to them. * @param func defines the action to apply on each value. */ forEach(func: (content: T) => void): void; /** * Sorts the full sets of data. * @param compareFn defines the comparison function to apply. */ sort(compareFn: (a: T, b: T) => number): void; /** * Resets the active data to an empty array. */ reset(): void; /** * Releases all the data from the array as well as the array. */ dispose(): void; /** * Concats the active data with a given array. * @param array defines the data to concatenate with. */ concat(array: any): void; /** * Returns the position of a value in the active data. * @param value defines the value to find the index for * @returns the index if found in the active data otherwise -1 */ indexOf(value: T): number; /** * Returns whether an element is part of the active data. * @param value defines the value to look for * @returns true if found in the active data otherwise false */ contains(value: T): boolean; private static _GlobalId; } /** * Defines an GC Friendly array where the backfield array do not shrink to prevent over allocations. * The data in this array can only be present once */ export class SmartArrayNoDuplicate extends SmartArray { private _duplicateId; /** * Pushes a value at the end of the active data. * THIS DOES NOT PREVENT DUPPLICATE DATA * @param value defines the object to push in the array. */ push(value: T): void; /** * Pushes a value at the end of the active data. * If the data is already present, it won t be added again * @param value defines the object to push in the array. * @returns true if added false if it was already present */ pushNoDuplicate(value: T): boolean; /** * Resets the active data to an empty array. */ reset(): void; /** * Concats the active data with a given array. * This ensures no dupplicate will be present in the result. * @param array defines the data to concatenate with. */ concatWithNoDuplicate(array: any): void; } } declare module "babylonjs/Misc/iInspectable" { /** * Enum that determines the text-wrapping mode to use. */ export enum InspectableType { /** * Checkbox for booleans */ Checkbox = 0, /** * Sliders for numbers */ Slider = 1, /** * Vector3 */ Vector3 = 2, /** * Quaternions */ Quaternion = 3, /** * Color3 */ Color3 = 4 } /** * Interface used to define custom inspectable properties. * This interface is used by the inspector to display custom property grids * @see https://doc.babylonjs.com/how_to/debug_layer#extensibility */ export interface IInspectable { /** * Gets the label to display */ label: string; /** * Gets the name of the property to edit */ propertyName: string; /** * Gets the type of the editor to use */ type: InspectableType; /** * Gets the minimum value of the property when using in "slider" mode */ min?: number; /** * Gets the maximum value of the property when using in "slider" mode */ max?: number; /** * Gets the setp to use when using in "slider" mode */ step?: number; } } declare module "babylonjs/Materials/Textures/internalTextureLoader" { import { Nullable } from "babylonjs/types"; import { InternalTexture } from "babylonjs/Materials/Textures/internalTexture"; /** * This represents the required contract to create a new type of texture loader. */ export interface IInternalTextureLoader { /** * Defines wether the loader supports cascade loading the different faces. */ supportCascades: boolean; /** * This returns if the loader support the current file information. * @param extension defines the file extension of the file being loaded * @param textureFormatInUse defines the current compressed format in use iun the engine * @param fallback defines the fallback internal texture if any * @param isBase64 defines whether the texture is encoded as a base64 * @param isBuffer defines whether the texture data are stored as a buffer * @returns true if the loader can load the specified file */ canLoad(extension: string, textureFormatInUse: Nullable, fallback: Nullable, isBase64: boolean, isBuffer: boolean): boolean; /** * Transform the url before loading if required. * @param rootUrl the url of the texture * @param textureFormatInUse defines the current compressed format in use iun the engine * @returns the transformed texture */ transformUrl(rootUrl: string, textureFormatInUse: Nullable): string; /** * Gets the fallback url in case the load fail. This can return null to allow the default fallback mecanism to work * @param rootUrl the url of the texture * @param textureFormatInUse defines the current compressed format in use iun the engine * @returns the fallback texture */ getFallbackTextureUrl(rootUrl: string, textureFormatInUse: Nullable): Nullable; /** * Uploads the cube texture data to the WebGl Texture. It has alreday been bound. * @param data contains the texture data * @param texture defines the BabylonJS internal texture * @param createPolynomials will be true if polynomials have been requested * @param onLoad defines the callback to trigger once the texture is ready * @param onError defines the callback to trigger in case of error */ loadCubeData(data: string | ArrayBuffer | (string | ArrayBuffer)[], texture: InternalTexture, createPolynomials: boolean, onLoad: Nullable<(data?: any) => void>, onError: Nullable<(message?: string, exception?: any) => void>): void; /** * Uploads the 2D texture data to the WebGl Texture. It has alreday been bound once in the callback. * @param data contains the texture data * @param texture defines the BabylonJS internal texture * @param callback defines the method to call once ready to upload */ loadData(data: ArrayBuffer, texture: InternalTexture, callback: (width: number, height: number, loadMipmap: boolean, isCompressed: boolean, done: () => void, loadFailed?: boolean) => void): void; } } declare module "babylonjs/Engines/Extensions/engine.cubeTexture" { import { InternalTexture } from "babylonjs/Materials/Textures/internalTexture"; import { Nullable } from "babylonjs/types"; import { Scene } from "babylonjs/scene"; import { IInternalTextureLoader } from "babylonjs/Materials/Textures/internalTextureLoader"; module "babylonjs/Engines/engine" { interface Engine { /** * Creates a depth stencil cube texture. * This is only available in WebGL 2. * @param size The size of face edge in the cube texture. * @param options The options defining the cube texture. * @returns The cube texture */ _createDepthStencilCubeTexture(size: number, options: DepthTextureCreationOptions): InternalTexture; /** * Creates a cube texture * @param rootUrl defines the url where the files to load is located * @param scene defines the current scene * @param files defines the list of files to load (1 per face) * @param noMipmap defines a boolean indicating that no mipmaps shall be generated (false by default) * @param onLoad defines an optional callback raised when the texture is loaded * @param onError defines an optional callback raised if there is an issue to load the texture * @param format defines the format of the data * @param forcedExtension defines the extension to use to pick the right loader * @param createPolynomials if a polynomial sphere should be created for the cube texture * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness * @param fallback defines texture to use while falling back when (compressed) texture file not found. * @param excludeLoaders array of texture loaders that should be excluded when picking a loader for the texture (defualt: empty array) * @returns the cube texture as an InternalTexture */ createCubeTexture(rootUrl: string, scene: Nullable, files: Nullable, noMipmap: boolean | undefined, onLoad: Nullable<(data?: any) => void>, onError: Nullable<(message?: string, exception?: any) => void>, format: number | undefined, forcedExtension: any, createPolynomials: boolean, lodScale: number, lodOffset: number, fallback: Nullable, excludeLoaders: Array): InternalTexture; /** * Creates a cube texture * @param rootUrl defines the url where the files to load is located * @param scene defines the current scene * @param files defines the list of files to load (1 per face) * @param noMipmap defines a boolean indicating that no mipmaps shall be generated (false by default) * @param onLoad defines an optional callback raised when the texture is loaded * @param onError defines an optional callback raised if there is an issue to load the texture * @param format defines the format of the data * @param forcedExtension defines the extension to use to pick the right loader * @returns the cube texture as an InternalTexture */ createCubeTexture(rootUrl: string, scene: Nullable, files: Nullable, noMipmap: boolean, onLoad: Nullable<(data?: any) => void>, onError: Nullable<(message?: string, exception?: any) => void>, format: number | undefined, forcedExtension: any): InternalTexture; /** * Creates a cube texture * @param rootUrl defines the url where the files to load is located * @param scene defines the current scene * @param files defines the list of files to load (1 per face) * @param noMipmap defines a boolean indicating that no mipmaps shall be generated (false by default) * @param onLoad defines an optional callback raised when the texture is loaded * @param onError defines an optional callback raised if there is an issue to load the texture * @param format defines the format of the data * @param forcedExtension defines the extension to use to pick the right loader * @param createPolynomials if a polynomial sphere should be created for the cube texture * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness * @returns the cube texture as an InternalTexture */ createCubeTexture(rootUrl: string, scene: Nullable, files: Nullable, noMipmap: boolean, onLoad: Nullable<(data?: any) => void>, onError: Nullable<(message?: string, exception?: any) => void>, format: number | undefined, forcedExtension: any, createPolynomials: boolean, lodScale: number, lodOffset: number): InternalTexture; /** @hidden */ _partialLoadFile(url: string, index: number, loadedFiles: (string | ArrayBuffer)[], onfinish: (files: (string | ArrayBuffer)[]) => void, onErrorCallBack: Nullable<(message?: string, exception?: any) => void>): void; /** @hidden */ _cascadeLoadFiles(scene: Nullable, onfinish: (images: (string | ArrayBuffer)[]) => void, files: string[], onError: Nullable<(message?: string, exception?: any) => void>): void; /** @hidden */ _cascadeLoadImgs(scene: Nullable, onfinish: (images: HTMLImageElement[]) => void, files: string[], onError: Nullable<(message?: string, exception?: any) => void>): void; /** @hidden */ _partialLoadImg(url: string, index: number, loadedImages: HTMLImageElement[], scene: Nullable, onfinish: (images: HTMLImageElement[]) => void, onErrorCallBack: Nullable<(message?: string, exception?: any) => void>): void; } } } declare module "babylonjs/Materials/Textures/cubeTexture" { import { Nullable } from "babylonjs/types"; import { Scene } from "babylonjs/scene"; import { Matrix, Vector3 } from "babylonjs/Maths/math"; import { BaseTexture } from "babylonjs/Materials/Textures/baseTexture"; import "babylonjs/Engines/Extensions/engine.cubeTexture"; /** * Class for creating a cube texture */ export class CubeTexture extends BaseTexture { private _delayedOnLoad; /** * The url of the texture */ url: string; /** * Gets or sets the center of the bounding box associated with the cube texture. * It must define where the camera used to render the texture was set * @see http://doc.babylonjs.com/how_to/reflect#using-local-cubemap-mode */ boundingBoxPosition: Vector3; private _boundingBoxSize; /** * Gets or sets the size of the bounding box associated with the cube texture * When defined, the cubemap will switch to local mode * @see https://community.arm.com/graphics/b/blog/posts/reflections-based-on-local-cubemaps-in-unity * @example https://www.babylonjs-playground.com/#RNASML */ /** * Returns the bounding box size * @see http://doc.babylonjs.com/how_to/reflect#using-local-cubemap-mode */ boundingBoxSize: Vector3; protected _rotationY: number; /** * Sets texture matrix rotation angle around Y axis in radians. */ /** * Gets texture matrix rotation angle around Y axis radians. */ rotationY: number; /** * Are mip maps generated for this texture or not. */ readonly noMipmap: boolean; private _noMipmap; private _files; private _extensions; private _textureMatrix; private _format; private _createPolynomials; /** @hidden */ _prefiltered: boolean; /** * Creates a cube texture from an array of image urls * @param files defines an array of image urls * @param scene defines the hosting scene * @param noMipmap specifies if mip maps are not used * @returns a cube texture */ static CreateFromImages(files: string[], scene: Scene, noMipmap?: boolean): CubeTexture; /** * Creates and return a texture created from prefilterd data by tools like IBL Baker or Lys. * @param url defines the url of the prefiltered texture * @param scene defines the scene the texture is attached to * @param forcedExtension defines the extension of the file if different from the url * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary * @return the prefiltered texture */ static CreateFromPrefilteredData(url: string, scene: Scene, forcedExtension?: any, createPolynomials?: boolean): CubeTexture; /** * Creates a cube texture to use with reflection for instance. It can be based upon dds or six images as well * as prefiltered data. * @param rootUrl defines the url of the texture or the root name of the six images * @param scene defines the scene the texture is attached to * @param extensions defines the suffixes add to the picture name in case six images are in use like _px.jpg... * @param noMipmap defines if mipmaps should be created or not * @param files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz * @param onLoad defines a callback triggered at the end of the file load if no errors occured * @param onError defines a callback triggered in case of error during load * @param format defines the internal format to use for the texture once loaded * @param prefiltered defines whether or not the texture is created from prefiltered data * @param forcedExtension defines the extensions to use (force a special type of file to load) in case it is different from the file name * @param createPolynomials defines whether or not to create polynomial harmonics from the texture data if necessary * @param lodScale defines the scale applied to environment texture. This manages the range of LOD level used for IBL according to the roughness * @param lodOffset defines the offset applied to environment texture. This manages first LOD level used for IBL according to the roughness * @return the cube texture */ constructor(rootUrl: string, scene: Scene, extensions?: Nullable, noMipmap?: boolean, files?: Nullable, onLoad?: Nullable<() => void>, onError?: Nullable<(message?: string, exception?: any) => void>, format?: number, prefiltered?: boolean, forcedExtension?: any, createPolynomials?: boolean, lodScale?: number, lodOffset?: number); /** * Gets a boolean indicating if the cube texture contains prefiltered mips (used to simulate roughness with PBR) */ readonly isPrefiltered: boolean; /** * Get the current class name of the texture useful for serialization or dynamic coding. * @returns "CubeTexture" */ getClassName(): string; /** * Update the url (and optional buffer) of this texture if url was null during construction. * @param url the url of the texture * @param forcedExtension defines the extension to use * @param onLoad callback called when the texture is loaded (defaults to null) */ updateURL(url: string, forcedExtension?: string, onLoad?: () => void): void; /** * Delays loading of the cube texture * @param forcedExtension defines the extension to use */ delayLoad(forcedExtension?: string): void; /** * Returns the reflection texture matrix * @returns the reflection texture matrix */ getReflectionTextureMatrix(): Matrix; /** * Sets the reflection texture matrix * @param value Reflection texture matrix */ setReflectionTextureMatrix(value: Matrix): void; /** * Parses text to create a cube texture * @param parsedTexture define the serialized text to read from * @param scene defines the hosting scene * @param rootUrl defines the root url of the cube texture * @returns a cube texture */ static Parse(parsedTexture: any, scene: Scene, rootUrl: string): CubeTexture; /** * Makes a clone, or deep copy, of the cube texture * @returns a new cube texture */ clone(): CubeTexture; } } declare module "babylonjs/Shaders/postprocess.vertex" { /** @hidden */ export var postprocessVertexShader: { name: string; shader: string; }; } declare module "babylonjs/Cameras/targetCamera" { import { Nullable } from "babylonjs/types"; import { Camera } from "babylonjs/Cameras/camera"; import { Scene } from "babylonjs/scene"; import { Quaternion, Matrix, Vector3, Vector2 } from "babylonjs/Maths/math"; /** * A target camera takes a mesh or position as a target and continues to look at it while it moves. * This is the base of the follow, arc rotate cameras and Free camera * @see http://doc.babylonjs.com/features/cameras */ export class TargetCamera extends Camera { private static _RigCamTransformMatrix; private static _TargetTransformMatrix; private static _TargetFocalPoint; /** * Define the current direction the camera is moving to */ cameraDirection: Vector3; /** * Define the current rotation the camera is rotating to */ cameraRotation: Vector2; /** * When set, the up vector of the camera will be updated by the rotation of the camera */ updateUpVectorFromRotation: boolean; private _tmpQuaternion; /** * Define the current rotation of the camera */ rotation: Vector3; /** * Define the current rotation of the camera as a quaternion to prevent Gimbal lock */ rotationQuaternion: Quaternion; /** * Define the current speed of the camera */ speed: number; /** * Add cconstraint to the camera to prevent it to move freely in all directions and * around all axis. */ noRotationConstraint: boolean; /** * Define the current target of the camera as an object or a position. */ lockedTarget: any; /** @hidden */ _currentTarget: Vector3; /** @hidden */ _initialFocalDistance: number; /** @hidden */ _viewMatrix: Matrix; /** @hidden */ _camMatrix: Matrix; /** @hidden */ _cameraTransformMatrix: Matrix; /** @hidden */ _cameraRotationMatrix: Matrix; /** @hidden */ _referencePoint: Vector3; /** @hidden */ _transformedReferencePoint: Vector3; protected _globalCurrentTarget: Vector3; protected _globalCurrentUpVector: Vector3; /** @hidden */ _reset: () => void; private _defaultUp; /** * Instantiates a target camera that takes a meshor position as a target and continues to look at it while it moves. * This is the base of the follow, arc rotate cameras and Free camera * @see http://doc.babylonjs.com/features/cameras * @param name Defines the name of the camera in the scene * @param position Defines the start position of the camera in the scene * @param scene Defines the scene the camera belongs to * @param setActiveOnSceneIfNoneActive Defines wheter the camera should be marked as active if not other active cameras have been defined */ constructor(name: string, position: Vector3, scene: Scene, setActiveOnSceneIfNoneActive?: boolean); /** * Gets the position in front of the camera at a given distance. * @param distance The distance from the camera we want the position to be * @returns the position */ getFrontPosition(distance: number): Vector3; /** @hidden */ _getLockedTargetPosition(): Nullable; private _storedPosition; private _storedRotation; private _storedRotationQuaternion; /** * Store current camera state of the camera (fov, position, rotation, etc..) * @returns the camera */ storeState(): Camera; /** * Restored camera state. You must call storeState() first * @returns whether it was successful or not * @hidden */ _restoreStateValues(): boolean; /** @hidden */ _initCache(): void; /** @hidden */ _updateCache(ignoreParentClass?: boolean): void; /** @hidden */ _isSynchronizedViewMatrix(): boolean; /** @hidden */ _computeLocalCameraSpeed(): number; /** * Defines the target the camera should look at. * This will automatically adapt alpha beta and radius to fit within the new target. * @param target Defines the new target as a Vector or a mesh */ setTarget(target: Vector3): void; /** * Return the current target position of the camera. This value is expressed in local space. * @returns the target position */ getTarget(): Vector3; /** @hidden */ _decideIfNeedsToMove(): boolean; /** @hidden */ _updatePosition(): void; /** @hidden */ _checkInputs(): void; protected _updateCameraRotationMatrix(): void; /** * Update the up vector to apply the rotation of the camera (So if you changed the camera rotation.z this will let you update the up vector as well) * @returns the current camera */ private _rotateUpVectorWithCameraRotationMatrix; private _cachedRotationZ; private _cachedQuaternionRotationZ; /** @hidden */ _getViewMatrix(): Matrix; protected _computeViewMatrix(position: Vector3, target: Vector3, up: Vector3): void; /** * @hidden */ createRigCamera(name: string, cameraIndex: number): Nullable; /** * @hidden */ _updateRigCameras(): void; private _getRigCamPositionAndTarget; /** * Gets the current object class name. * @return the class name */ getClassName(): string; } } declare module "babylonjs/Cameras/cameraInputsManager" { import { Nullable } from "babylonjs/types"; import { Camera } from "babylonjs/Cameras/camera"; /** * @ignore * This is a list of all the different input types that are available in the application. * Fo instance: ArcRotateCameraGamepadInput... */ export var CameraInputTypes: {}; /** * This is the contract to implement in order to create a new input class. * Inputs are dealing with listening to user actions and moving the camera accordingly. */ export interface ICameraInput { /** * Defines the camera the input is attached to. */ camera: Nullable; /** * Gets the class name of the current intput. * @returns the class name */ getClassName(): string; /** * Get the friendly name associated with the input class. * @returns the input friendly name */ getSimpleName(): string; /** * Attach the input controls to a specific dom element to get the input from. * @param element Defines the element the controls should be listened from * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault) */ attachControl(element: HTMLElement, noPreventDefault?: boolean): void; /** * Detach the current controls from the specified dom element. * @param element Defines the element to stop listening the inputs from */ detachControl(element: Nullable): void; /** * Update the current camera state depending on the inputs that have been used this frame. * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop. */ checkInputs?: () => void; } /** * Represents a map of input types to input instance or input index to input instance. */ export interface CameraInputsMap { /** * Accessor to the input by input type. */ [name: string]: ICameraInput; /** * Accessor to the input by input index. */ [idx: number]: ICameraInput; } /** * This represents the input manager used within a camera. * It helps dealing with all the different kind of input attached to a camera. * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs */ export class CameraInputsManager { /** * Defines the list of inputs attahed to the camera. */ attached: CameraInputsMap; /** * Defines the dom element the camera is collecting inputs from. * This is null if the controls have not been attached. */ attachedElement: Nullable; /** * Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault) */ noPreventDefault: boolean; /** * Defined the camera the input manager belongs to. */ camera: TCamera; /** * Update the current camera state depending on the inputs that have been used this frame. * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop. */ checkInputs: () => void; /** * Instantiate a new Camera Input Manager. * @param camera Defines the camera the input manager blongs to */ constructor(camera: TCamera); /** * Add an input method to a camera * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs * @param input camera input method */ add(input: ICameraInput): void; /** * Remove a specific input method from a camera * example: camera.inputs.remove(camera.inputs.attached.mouse); * @param inputToRemove camera input method */ remove(inputToRemove: ICameraInput): void; /** * Remove a specific input type from a camera * example: camera.inputs.remove("ArcRotateCameraGamepadInput"); * @param inputType the type of the input to remove */ removeByType(inputType: string): void; private _addCheckInputs; /** * Attach the input controls to the currently attached dom element to listen the events from. * @param input Defines the input to attach */ attachInput(input: ICameraInput): void; /** * Attach the current manager inputs controls to a specific dom element to listen the events from. * @param element Defines the dom element to collect the events from * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault) */ attachElement(element: HTMLElement, noPreventDefault?: boolean): void; /** * Detach the current manager inputs controls from a specific dom element. * @param element Defines the dom element to collect the events from * @param disconnect Defines whether the input should be removed from the current list of attached inputs */ detachElement(element: HTMLElement, disconnect?: boolean): void; /** * Rebuild the dynamic inputCheck function from the current list of * defined inputs in the manager. */ rebuildInputCheck(): void; /** * Remove all attached input methods from a camera */ clear(): void; /** * Serialize the current input manager attached to a camera. * This ensures than once parsed, * the input associated to the camera will be identical to the current ones * @param serializedCamera Defines the camera serialization JSON the input serialization should write to */ serialize(serializedCamera: any): void; /** * Parses an input manager serialized JSON to restore the previous list of inputs * and states associated to a camera. * @param parsedCamera Defines the JSON to parse */ parse(parsedCamera: any): void; } } declare module "babylonjs/Events/keyboardEvents" { /** * Gather the list of keyboard event types as constants. */ export class KeyboardEventTypes { /** * The keydown event is fired when a key becomes active (pressed). */ static readonly KEYDOWN: number; /** * The keyup event is fired when a key has been released. */ static readonly KEYUP: number; } /** * This class is used to store keyboard related info for the onKeyboardObservable event. */ export class KeyboardInfo { /** * Defines the type of event (KeyboardEventTypes) */ type: number; /** * Defines the related dom event */ event: KeyboardEvent; /** * Instantiates a new keyboard info. * This class is used to store keyboard related info for the onKeyboardObservable event. * @param type Defines the type of event (KeyboardEventTypes) * @param event Defines the related dom event */ constructor( /** * Defines the type of event (KeyboardEventTypes) */ type: number, /** * Defines the related dom event */ event: KeyboardEvent); } /** * This class is used to store keyboard related info for the onPreKeyboardObservable event. * Set the skipOnKeyboardObservable property to true if you want the engine to stop any process after this event is triggered, even not calling onKeyboardObservable */ export class KeyboardInfoPre extends KeyboardInfo { /** * Defines the type of event (KeyboardEventTypes) */ type: number; /** * Defines the related dom event */ event: KeyboardEvent; /** * Defines whether the engine should skip the next onKeyboardObservable associated to this pre. */ skipOnPointerObservable: boolean; /** * Instantiates a new keyboard pre info. * This class is used to store keyboard related info for the onPreKeyboardObservable event. * @param type Defines the type of event (KeyboardEventTypes) * @param event Defines the related dom event */ constructor( /** * Defines the type of event (KeyboardEventTypes) */ type: number, /** * Defines the related dom event */ event: KeyboardEvent); } } declare module "babylonjs/Cameras/Inputs/freeCameraKeyboardMoveInput" { import { Nullable } from "babylonjs/types"; import { ICameraInput } from "babylonjs/Cameras/cameraInputsManager"; import { FreeCamera } from "babylonjs/Cameras/freeCamera"; /** * Manage the keyboard inputs to control the movement of a free camera. * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs */ export class FreeCameraKeyboardMoveInput implements ICameraInput { /** * Defines the camera the input is attached to. */ camera: FreeCamera; /** * Gets or Set the list of keyboard keys used to control the forward move of the camera. */ keysUp: number[]; /** * Gets or Set the list of keyboard keys used to control the backward move of the camera. */ keysDown: number[]; /** * Gets or Set the list of keyboard keys used to control the left strafe move of the camera. */ keysLeft: number[]; /** * Gets or Set the list of keyboard keys used to control the right strafe move of the camera. */ keysRight: number[]; private _keys; private _onCanvasBlurObserver; private _onKeyboardObserver; private _engine; private _scene; /** * Attach the input controls to a specific dom element to get the input from. * @param element Defines the element the controls should be listened from * @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault) */ attachControl(element: HTMLElement, noPreventDefault?: boolean): void; /** * Detach the current controls from the specified dom element. * @param element Defines the element to stop listening the inputs from */ detachControl(element: Nullable): void; /** * Update the current camera state depending on the inputs that have been used this frame. * This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop. */ checkInputs(): void; /** * Gets the class name of the current intput. * @returns the class name */ getClassName(): string; /** @hidden */ _onLostFocus(): void; /** * Get the friendly name associated with the input class. * @returns the input friendly name */ getSimpleName(): string; } } declare module "babylonjs/Materials/multiMaterial" { import { Nullable } from "babylonjs/types"; import { Scene } from "babylonjs/scene"; import { AbstractMesh } from "babylonjs/Meshes/abstractMesh"; import { BaseSubMesh } from "babylonjs/Meshes/subMesh"; import { BaseTexture } from "babylonjs/Materials/Textures/baseTexture"; import { Material } from "babylonjs/Materials/material"; /** * A multi-material is used to apply different materials to different parts of the same object without the need of * separate meshes. This can be use to improve performances. * @see http://doc.babylonjs.com/how_to/multi_materials */ export class MultiMaterial extends Material { private _subMaterials; /** * Gets or Sets the list of Materials used within the multi material. * They need to be ordered according to the submeshes order in the associated mesh */ subMaterials: Nullable[]; /** * Function used to align with Node.getChildren() * @returns the list of Materials used within the multi material */ getChildren(): Nullable[]; /** * Instantiates a new Multi Material * A multi-material is used to apply different materials to different parts of the same object without the need of * separate meshes. This can be use to improve performances. * @see http://doc.babylonjs.com/how_to/multi_materials * @param name Define the name in the scene * @param scene Define the scene the material belongs to */ constructor(name: string, scene: Scene); private _hookArray; /** * Get one of the submaterial by its index in the submaterials array * @param index The index to look the sub material at * @returns The Material if the index has been defined */ getSubMaterial(index: number): Nullable; /** * Get the list of active textures for the whole sub materials list. * @returns All the textures that will be used during the rendering */ getActiveTextures(): BaseTexture[]; /** * Gets the current class name of the material e.g. "MultiMaterial" * Mainly use in serialization. * @returns the class name */ getClassName(): string; /** * Checks if the material is ready to render the requested sub mesh * @param mesh Define the mesh the submesh belongs to * @param subMesh Define the sub mesh to look readyness for * @param useInstances Define whether or not the material is used with instances * @returns true if ready, otherwise false */ isReadyForSubMesh(mesh: AbstractMesh, subMesh: BaseSubMesh, useInstances?: boolean): boolean; /** * Clones the current material and its related sub materials * @param name Define the name of the newly cloned material * @param cloneChildren Define if submaterial will be cloned or shared with the parent instance * @returns the cloned material */ clone(name: string, cloneChildren?: boolean): MultiMaterial; /** * Serializes the materials into a JSON representation. * @returns the JSON representation */ serialize(): any; /** * Dispose the material and release its associated resources * @param forceDisposeEffect Define if we want to force disposing the associated effect (if false the shader is not released and could be reuse later on) * @param forceDisposeTextures Define if we want to force disposing the associated textures (if false, they will not be disposed and can still be use elsewhere in the app) * @param forceDisposeChildren Define if we want to force disposing the associated submaterials (if false, they will not be disposed and can still be use elsewhere in the app) */ dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean, forceDisposeChildren?: boolean): void; /** * Creates a MultiMaterial from parsed MultiMaterial data. * @param parsedMultiMaterial defines parsed MultiMaterial data. * @param scene defines the hosting scene * @returns a new MultiMaterial */ static ParseMultiMaterial(parsedMultiMaterial: any, scene: Scene): MultiMaterial; } } declare module "babylonjs/Loading/sceneLoaderFlags" { /** * Class used to represent data loading progression */ export class SceneLoaderFlags { private static _ForceFullSceneLoadingForIncremental; private static _ShowLoadingScreen; private static _CleanBoneMatrixWeights; private static _loggingLevel; /** * Gets or sets a boolean indicating if entire scene must be loaded even if scene contains incremental data */ static ForceFullSceneLoadingForIncremental: boolean; /** * Gets or sets a boolean indicating if loading screen must be displayed while loading a scene */ static ShowLoadingScreen: boolean; /** * Defines the current logging level (while loading the scene) * @ignorenaming */ static loggingLevel: number; /** * Gets or set a boolean indicating if matrix weights must be cleaned upon loading */ static CleanBoneMatrixWeights: boolean; } } declare module "babylonjs/Meshes/transformNode" { import { DeepImmutable } from "babylonjs/types"; import { Observable } from "babylonjs/Misc/observable"; import { Nullable } from "babylonjs/types"; import { Camera } from "babylonjs/Cameras/camera"; import { Scene } from "babylonjs/scene"; import { Quaternion, Matrix, Vector3, Space } from "babylonjs/Maths/math"; import { Node } from "babylonjs/node"; import { Bone } from "babylonjs/Bones/bone"; import { AbstractMesh } from "babylonjs/Meshes/abstractMesh"; /** * A TransformNode is an object that is not rendered but can be used as a center of transformation. This can decrease memory usage and increase rendering speed compared to using an empty mesh as a parent and is less complicated than using a pivot matrix. * @see https://doc.babylonjs.com/how_to/transformnode */ export class TransformNode extends Node { /** * Object will not rotate to face the camera */ static BILLBOARDMODE_NONE: number; /** * Object will rotate to face the camera but only on the x axis */ static BILLBOARDMODE_X: number; /** * Object will rotate to face the camera but only on the y axis */ static BILLBOARDMODE_Y: number; /** * Object will rotate to face the camera but only on the z axis */ static BILLBOARDMODE_Z: number; /** * Object will rotate to face the camera */ static BILLBOARDMODE_ALL: number; private _forward; private _forwardInverted; private _up; private _right; private _rightInverted; private _position; private _rotation; private _rotationQuaternion; protected _scaling: Vector3; protected _isDirty: boolean; private _transformToBoneReferal; private _billboardMode; /** * Gets or sets the billboard mode. Default is 0. * * | Value | Type | Description | * | --- | --- | --- | * | 0 | BILLBOARDMODE_NONE | | * | 1 | BILLBOARDMODE_X | | * | 2 | BILLBOARDMODE_Y | | * | 4 | BILLBOARDMODE_Z | | * | 7 | BILLBOARDMODE_ALL | | * */ billboardMode: number; private _preserveParentRotationForBillboard; /** * Gets or sets a boolean indicating that parent rotation should be preserved when using billboards. * This could be useful for glTF objects where parent rotation helps converting from right handed to left handed */ preserveParentRotationForBillboard: boolean; /** * Multiplication factor on scale x/y/z when computing the world matrix. Eg. for a 1x1x1 cube setting this to 2 will make it a 2x2x2 cube */ scalingDeterminant: number; private _infiniteDistance; /** * Gets or sets the distance of the object to max, often used by skybox */ infiniteDistance: boolean; /** * Gets or sets a boolean indicating that non uniform scaling (when at least one component is different from others) should be ignored. * By default the system will update normals to compensate */ ignoreNonUniformScaling: boolean; /** * Gets or sets a boolean indicating that even if rotationQuaternion is defined, you can keep updating rotation property and Babylon.js will just mix both */ reIntegrateRotationIntoRotationQuaternion: boolean; /** @hidden */ _poseMatrix: Nullable; /** @hidden */ _localMatrix: Matrix; private _usePivotMatrix; private _absolutePosition; private _pivotMatrix; private _pivotMatrixInverse; protected _postMultiplyPivotMatrix: boolean; protected _isWorldMatrixFrozen: boolean; /** @hidden */ _indexInSceneTransformNodesArray: number; /** * An event triggered after the world matrix is updated */ onAfterWorldMatrixUpdateObservable: Observable; constructor(name: string, scene?: Nullable, isPure?: boolean); /** * Gets a string identifying the name of the class * @returns "TransformNode" string */ getClassName(): string; /** * Gets or set the node position (default is (0.0, 0.0, 0.0)) */ position: Vector3; /** * Gets or sets the rotation property : a Vector3 defining the rotation value in radians around each local axis X, Y, Z (default is (0.0, 0.0, 0.0)). * If rotation quaternion is set, this Vector3 will be ignored and copy from the quaternion */ rotation: Vector3; /** * Gets or sets the scaling property : a Vector3 defining the node scaling along each local axis X, Y, Z (default is (0.0, 0.0, 0.0)). */ scaling: Vector3; /** * Gets or sets the rotation Quaternion property : this a Quaternion object defining the node rotation by using a unit quaternion (undefined by default, but can be null). * If set, only the rotationQuaternion is then used to compute the node rotation (ie. node.rotation will be ignored) */ rotationQuaternion: Nullable; /** * The forward direction of that transform in world space. */ readonly forward: Vector3; /** * The up direction of that transform in world space. */ readonly up: Vector3; /** * The right direction of that transform in world space. */ readonly right: Vector3; /** * Copies the parameter passed Matrix into the mesh Pose matrix. * @param matrix the matrix to copy the pose from * @returns this TransformNode. */ updatePoseMatrix(matrix: Matrix): TransformNode; /** * Returns the mesh Pose matrix. * @returns the pose matrix */ getPoseMatrix(): Matrix; /** @hidden */ _isSynchronized(): boolean; /** @hidden */ _initCache(): void; /** * Flag the transform node as dirty (Forcing it to update everything) * @param property if set to "rotation" the objects rotationQuaternion will be set to null * @returns this transform node */ markAsDirty(property: string): TransformNode; /** * Returns the current mesh absolute position. * Returns a Vector3. */ readonly absolutePosition: Vector3; /** * Sets a new matrix to apply before all other transformation * @param matrix defines the transform matrix * @returns the current TransformNode */ setPreTransformMatrix(matrix: Matrix): TransformNode; /** * Sets a new pivot matrix to the current node * @param matrix defines the new pivot matrix to use * @param postMultiplyPivotMatrix defines if the pivot matrix must be cancelled in the world matrix. When this parameter is set to true (default), the inverse of the pivot matrix is also applied at the end to cancel the transformation effect * @returns the current TransformNode */ setPivotMatrix(matrix: DeepImmutable, postMultiplyPivotMatrix?: boolean): TransformNode; /** * Returns the mesh pivot matrix. * Default : Identity. * @returns the matrix */ getPivotMatrix(): Matrix; /** * Prevents the World matrix to be computed any longer. * @returns the TransformNode. */ freezeWorldMatrix(): TransformNode; /** * Allows back the World matrix computation. * @returns the TransformNode. */ unfreezeWorldMatrix(): this; /** * True if the World matrix has been frozen. */ readonly isWorldMatrixFrozen: boolean; /** * Retuns the mesh absolute position in the World. * @returns a Vector3. */ getAbsolutePosition(): Vector3; /** * Sets the mesh absolute position in the World from a Vector3 or an Array(3). * @param absolutePosition the absolute position to set * @returns the TransformNode. */ setAbsolutePosition(absolutePosition: Vector3): TransformNode; /** * Sets the mesh position in its local space. * @param vector3 the position to set in localspace * @returns the TransformNode. */ setPositionWithLocalVector(vector3: Vector3): TransformNode; /** * Returns the mesh position in the local space from the current World matrix values. * @returns a new Vector3. */ getPositionExpressedInLocalSpace(): Vector3; /** * Translates the mesh along the passed Vector3 in its local space. * @param vector3 the distance to translate in localspace * @returns the TransformNode. */ locallyTranslate(vector3: Vector3): TransformNode; private static _lookAtVectorCache; /** * Orients a mesh towards a target point. Mesh must be drawn facing user. * @param targetPoint the position (must be in same space as current mesh) to look at * @param yawCor optional yaw (y-axis) correction in radians * @param pitchCor optional pitch (x-axis) correction in radians * @param rollCor optional roll (z-axis) correction in radians * @param space the choosen space of the target * @returns the TransformNode. */ lookAt(targetPoint: Vector3, yawCor?: number, pitchCor?: number, rollCor?: number, space?: Space): TransformNode; /** * Returns a new Vector3 that is the localAxis, expressed in the mesh local space, rotated like the mesh. * This Vector3 is expressed in the World space. * @param localAxis axis to rotate * @returns a new Vector3 that is the localAxis, expressed in the mesh local space, rotated like the mesh. */ getDirection(localAxis: Vector3): Vector3; /** * Sets the Vector3 "result" as the rotated Vector3 "localAxis" in the same rotation than the mesh. * localAxis is expressed in the mesh local space. * result is computed in the Wordl space from the mesh World matrix. * @param localAxis axis to rotate * @param result the resulting transformnode * @returns this TransformNode. */ getDirectionToRef(localAxis: Vector3, result: Vector3): TransformNode; /** * Sets this transform node rotation to the given local axis. * @param localAxis the axis in local space * @param yawCor optional yaw (y-axis) correction in radians * @param pitchCor optional pitch (x-axis) correction in radians * @param rollCor optional roll (z-axis) correction in radians * @returns this TransformNode */ setDirection(localAxis: Vector3, yawCor?: number, pitchCor?: number, rollCor?: number): TransformNode; /** * Sets a new pivot point to the current node * @param point defines the new pivot point to use * @param space defines if the point is in world or local space (local by default) * @returns the current TransformNode */ setPivotPoint(point: Vector3, space?: Space): TransformNode; /** * Returns a new Vector3 set with the mesh pivot point coordinates in the local space. * @returns the pivot point */ getPivotPoint(): Vector3; /** * Sets the passed Vector3 "result" with the coordinates of the mesh pivot point in the local space. * @param result the vector3 to store the result * @returns this TransformNode. */ getPivotPointToRef(result: Vector3): TransformNode; /** * Returns a new Vector3 set with the mesh pivot point World coordinates. * @returns a new Vector3 set with the mesh pivot point World coordinates. */ getAbsolutePivotPoint(): Vector3; /** * Sets the Vector3 "result" coordinates with the mesh pivot point World coordinates. * @param result vector3 to store the result * @returns this TransformNode. */ getAbsolutePivotPointToRef(result: Vector3): TransformNode; /** * Defines the passed node as the parent of the current node. * The node will remain exactly where it is and its position / rotation will be updated accordingly * @see https://doc.babylonjs.com/how_to/parenting * @param node the node ot set as the parent * @returns this TransformNode. */ setParent(node: Nullable): TransformNode; private _nonUniformScaling; /** * True if the scaling property of this object is non uniform eg. (1,2,1) */ readonly nonUniformScaling: boolean; /** @hidden */ _updateNonUniformScalingState(value: boolean): boolean; /** * Attach the current TransformNode to another TransformNode associated with a bone * @param bone Bone affecting the TransformNode * @param affectedTransformNode TransformNode associated with the bone * @returns this object */ attachToBone(bone: Bone, affectedTransformNode: TransformNode): TransformNode; /** * Detach the transform node if its associated with a bone * @returns this object */ detachFromBone(): TransformNode; private static _rotationAxisCache; /** * Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in the given space. * space (default LOCAL) can be either Space.LOCAL, either Space.WORLD. * Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used. * The passed axis is also normalized. * @param axis the axis to rotate around * @param amount the amount to rotate in radians * @param space Space to rotate in (Default: local) * @returns the TransformNode. */ rotate(axis: Vector3, amount: number, space?: Space): TransformNode; /** * Rotates the mesh around the axis vector for the passed angle (amount) expressed in radians, in world space. * Note that the property `rotationQuaternion` is then automatically updated and the property `rotation` is set to (0,0,0) and no longer used. * The passed axis is also normalized. . * Method is based on http://www.euclideanspace.com/maths/geometry/affine/aroundPoint/index.htm * @param point the point to rotate around * @param axis the axis to rotate around * @param amount the amount to rotate in radians * @returns the TransformNode */ rotateAround(point: Vector3, axis: Vector3, amount: number): TransformNode; /** * Translates the mesh along the axis vector for the passed distance in the given space. * space (default LOCAL) can be either Space.LOCAL, either Space.WORLD. * @param axis the axis to translate in * @param distance the distance to translate * @param space Space to rotate in (Default: local) * @returns the TransformNode. */ translate(axis: Vector3, distance: number, space?: Space): TransformNode; /** * Adds a rotation step to the mesh current rotation. * x, y, z are Euler angles expressed in radians. * This methods updates the current mesh rotation, either mesh.rotation, either mesh.rotationQuaternion if it's set. * This means this rotation is made in the mesh local space only. * It's useful to set a custom rotation order different from the BJS standard one YXZ. * Example : this rotates the mesh first around its local X axis, then around its local Z axis, finally around its local Y axis. * ```javascript * mesh.addRotation(x1, 0, 0).addRotation(0, 0, z2).addRotation(0, 0, y3); * ``` * Note that `addRotation()` accumulates the passed rotation values to the current ones and computes the .rotation or .rotationQuaternion updated values. * Under the hood, only quaternions are used. So it's a little faster is you use .rotationQuaternion because it doesn't need to translate them back to Euler angles. * @param x Rotation to add * @param y Rotation to add * @param z Rotation to add * @returns the TransformNode. */ addRotation(x: number, y: number, z: number): TransformNode; /** * @hidden */ protected _getEffectiveParent(): Nullable; /** * Computes the world matrix of the node * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch * @returns the world matrix */ computeWorldMatrix(force?: boolean): Matrix; protected _afterComputeWorldMatrix(): void; /** * If you'd like to be called back after the mesh position, rotation or scaling has been updated. * @param func callback function to add * * @returns the TransformNode. */ registerAfterWorldMatrixUpdate(func: (mesh: TransformNode) => void): TransformNode; /** * Removes a registered callback function. * @param func callback function to remove * @returns the TransformNode. */ unregisterAfterWorldMatrixUpdate(func: (mesh: TransformNode) => void): TransformNode; /** * Gets the position of the current mesh in camera space * @param camera defines the camera to use * @returns a position */ getPositionInCameraSpace(camera?: Nullable): Vector3; /** * Returns the distance from the mesh to the active camera * @param camera defines the camera to use * @returns the distance */ getDistanceToCamera(camera?: Nullable): number; /** * Clone the current transform node * @param name Name of the new clone * @param newParent New parent for the clone * @param doNotCloneChildren Do not clone children hierarchy * @returns the new transform node */ clone(name: string, newParent: Node, doNotCloneChildren?: boolean): Nullable; /** * Serializes the objects information. * @param currentSerializationObject defines the object to serialize in * @returns the serialized object */ serialize(currentSerializationObject?: any): any; /** * Returns a new TransformNode object parsed from the source provided. * @param parsedTransformNode is the source. * @param scene the scne the object belongs to * @param rootUrl is a string, it's the root URL to prefix the `delayLoadingFile` property with * @returns a new TransformNode object parsed from the source provided. */ static Parse(parsedTransformNode: any, scene: Scene, rootUrl: string): TransformNode; /** * Get all child-transformNodes of this node * @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered * @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored * @returns an array of TransformNode */ getChildTransformNodes(directDescendantsOnly?: boolean, predicate?: (node: Node) => boolean): TransformNode[]; /** * Releases resources associated with this transform node. * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default) * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default) */ dispose(doNotRecurse?: boolean, disposeMaterialAndTextures?: boolean): void; /** * Uniformly scales the mesh to fit inside of a unit cube (1 X 1 X 1 units) * @param includeDescendants Use the hierarchy's bounding box instead of the mesh's bounding box. Default is false * @param ignoreRotation ignore rotation when computing the scale (ie. object will be axis aligned). Default is false * @param predicate predicate that is passed in to getHierarchyBoundingVectors when selecting which object should be included when scaling * @returns the current mesh */ normalizeToUnitCube(includeDescendants?: boolean, ignoreRotation?: boolean, predicate?: Nullable<(node: AbstractMesh) => boolean>): TransformNode; } } declare module "babylonjs/Animations/animationPropertiesOverride" { /** * Class used to override all child animations of a given target */ export class AnimationPropertiesOverride { /** * Gets or sets a value indicating if animation blending must be used */ enableBlending: boolean; /** * Gets or sets the blending speed to use when enableBlending is true */ blendingSpeed: number; /** * Gets or sets the default loop mode to use */ loopMode: number; } } declare module "babylonjs/Bones/bone" { import { Skeleton } from "babylonjs/Bones/skeleton"; import { Vector3, Quaternion, Matrix, Space } from "babylonjs/Maths/math"; import { Nullable } from "babylonjs/types"; import { AbstractMesh } from "babylonjs/Meshes/abstractMesh"; import { TransformNode } from "babylonjs/Meshes/transformNode"; import { Node } from "babylonjs/node"; import { AnimationPropertiesOverride } from "babylonjs/Animations/animationPropertiesOverride"; /** * Class used to store bone information * @see http://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons */ export class Bone extends Node { /** * defines the bone name */ name: string; private static _tmpVecs; private static _tmpQuat; private static _tmpMats; /** * Gets the list of child bones */ children: Bone[]; /** Gets the animations associated with this bone */ animations: import("babylonjs/Animations/animation").Animation[]; /** * Gets or sets bone length */ length: number; /** * @hidden Internal only * Set this value to map this bone to a different index in the transform matrices * Set this value to -1 to exclude the bone from the transform matrices */ _index: Nullable; private _skeleton; private _localMatrix; private _restPose; private _baseMatrix; private _absoluteTransform; private _invertedAbsoluteTransform; private _parent; private _scalingDeterminant; private _worldTransform; private _localScaling; private _localRotation; private _localPosition; private _needToDecompose; private _needToCompose; /** @hidden */ _linkedTransformNode: Nullable; /** @hidden */ _waitingTransformNodeId: Nullable; /** @hidden */ /** @hidden */ _matrix: Matrix; /** * Create a new bone * @param name defines the bone name * @param skeleton defines the parent skeleton * @param parentBone defines the parent (can be null if the bone is the root) * @param localMatrix defines the local matrix * @param restPose defines the rest pose matrix * @param baseMatrix defines the base matrix * @param index defines index of the bone in the hiearchy */ constructor( /** * defines the bone name */ name: string, skeleton: Skeleton, parentBone?: Nullable, localMatrix?: Nullable, restPose?: Nullable, baseMatrix?: Nullable, index?: Nullable); /** * Gets the current object class name. * @return the class name */ getClassName(): string; /** * Gets the parent skeleton * @returns a skeleton */ getSkeleton(): Skeleton; /** * Gets parent bone * @returns a bone or null if the bone is the root of the bone hierarchy */ getParent(): Nullable; /** * Returns an array containing the root bones * @returns an array containing the root bones */ getChildren(): Array; /** * Sets the parent bone * @param parent defines the parent (can be null if the bone is the root) * @param updateDifferenceMatrix defines if the difference matrix must be updated */ setParent(parent: Nullable, updateDifferenceMatrix?: boolean): void; /** * Gets the local matrix * @returns a matrix */ getLocalMatrix(): Matrix; /** * Gets the base matrix (initial matrix which remains unchanged) * @returns a matrix */ getBaseMatrix(): Matrix; /** * Gets the rest pose matrix * @returns a matrix */ getRestPose(): Matrix; /** * Gets a matrix used to store world matrix (ie. the matrix sent to shaders) */ getWorldMatrix(): Matrix; /** * Sets the local matrix to rest pose matrix */ returnToRest(): void; /** * Gets the inverse of the absolute transform matrix. * This matrix will be multiplied by local matrix to get the difference matrix (ie. the difference between original state and current state) * @returns a matrix */ getInvertedAbsoluteTransform(): Matrix; /** * Gets the absolute transform matrix (ie base matrix * parent world matrix) * @returns a matrix */ getAbsoluteTransform(): Matrix; /** * Links with the given transform node. * The local matrix of this bone is copied from the transform node every frame. * @param transformNode defines the transform node to link to */ linkTransformNode(transformNode: Nullable): void; /** Gets or sets current position (in local space) */ position: Vector3; /** Gets or sets current rotation (in local space) */ rotation: Vector3; /** Gets or sets current rotation quaternion (in local space) */ rotationQuaternion: Quaternion; /** Gets or sets current scaling (in local space) */ scaling: Vector3; /** * Gets the animation properties override */ readonly animationPropertiesOverride: Nullable; private _decompose; private _compose; /** * Update the base and local matrices * @param matrix defines the new base or local matrix * @param updateDifferenceMatrix defines if the difference matrix must be updated * @param updateLocalMatrix defines if the local matrix should be updated */ updateMatrix(matrix: Matrix, updateDifferenceMatrix?: boolean, updateLocalMatrix?: boolean): void; /** @hidden */ _updateDifferenceMatrix(rootMatrix?: Matrix, updateChildren?: boolean): void; /** * Flag the bone as dirty (Forcing it to update everything) */ markAsDirty(): void; /** @hidden */ _markAsDirtyAndCompose(): void; private _markAsDirtyAndDecompose; /** * Translate the bone in local or world space * @param vec The amount to translate the bone * @param space The space that the translation is in * @param mesh The mesh that this bone is attached to. This is only used in world space */ translate(vec: Vector3, space?: Space, mesh?: AbstractMesh): void; /** * Set the postion of the bone in local or world space * @param position The position to set the bone * @param space The space that the position is in * @param mesh The mesh that this bone is attached to. This is only used in world space */ setPosition(position: Vector3, space?: Space, mesh?: AbstractMesh): void; /** * Set the absolute position of the bone (world space) * @param position The position to set the bone * @param mesh The mesh that this bone is attached to */ setAbsolutePosition(position: Vector3, mesh?: AbstractMesh): void; /** * Scale the bone on the x, y and z axes (in local space) * @param x The amount to scale the bone on the x axis * @param y The amount to scale the bone on the y axis * @param z The amount to scale the bone on the z axis * @param scaleChildren sets this to true if children of the bone should be scaled as well (false by default) */ scale(x: number, y: number, z: number, scaleChildren?: boolean): void; /** * Set the bone scaling in local space * @param scale defines the scaling vector */ setScale(scale: Vector3): void; /** * Gets the current scaling in local space * @returns the current scaling vector */ getScale(): Vector3; /** * Gets the current scaling in local space and stores it in a target vector * @param result defines the target vector */ getScaleToRef(result: Vector3): void; /** * Set the yaw, pitch, and roll of the bone in local or world space * @param yaw The rotation of the bone on the y axis * @param pitch The rotation of the bone on the x axis * @param roll The rotation of the bone on the z axis * @param space The space that the axes of rotation are in * @param mesh The mesh that this bone is attached to. This is only used in world space */ setYawPitchRoll(yaw: number, pitch: number, roll: number, space?: Space, mesh?: AbstractMesh): void; /** * Add a rotation to the bone on an axis in local or world space * @param axis The axis to rotate the bone on * @param amount The amount to rotate the bone * @param space The space that the axis is in * @param mesh The mesh that this bone is attached to. This is only used in world space */ rotate(axis: Vector3, amount: number, space?: Space, mesh?: AbstractMesh): void; /** * Set the rotation of the bone to a particular axis angle in local or world space * @param axis The axis to rotate the bone on * @param angle The angle that the bone should be rotated to * @param space The space that the axis is in * @param mesh The mesh that this bone is attached to. This is only used in world space */ setAxisAngle(axis: Vector3, angle: number, space?: Space, mesh?: AbstractMesh): void; /** * Set the euler rotation of the bone in local of world space * @param rotation The euler rotation that the bone should be set to * @param space The space that the rotation is in * @param mesh The mesh that this bone is attached to. This is only used in world space */ setRotation(rotation: Vector3, space?: Space, mesh?: AbstractMesh): void; /** * Set the quaternion rotation of the bone in local of world space * @param quat The quaternion rotation that the bone should be set to * @param space The space that the rotation is in * @param mesh The mesh that this bone is attached to. This is only used in world space */ setRotationQuaternion(quat: Quaternion, space?: Space, mesh?: AbstractMesh): void; /** * Set the rotation matrix of the bone in local of world space * @param rotMat The rotation matrix that the bone should be set to * @param space The space that the rotation is in * @param mesh The mesh that this bone is attached to. This is only used in world space */ setRotationMatrix(rotMat: Matrix, space?: Space, mesh?: AbstractMesh): void; private _rotateWithMatrix; private _getNegativeRotationToRef; /** * Get the position of the bone in local or world space * @param space The space that the returned position is in * @param mesh The mesh that this bone is attached to. This is only used in world space * @returns The position of the bone */ getPosition(space?: Space, mesh?: Nullable): Vector3; /** * Copy the position of the bone to a vector3 in local or world space * @param space The space that the returned position is in * @param mesh The mesh that this bone is attached to. This is only used in world space * @param result The vector3 to copy the position to */ getPositionToRef(space: Space | undefined, mesh: Nullable, result: Vector3): void; /** * Get the absolute position of the bone (world space) * @param mesh The mesh that this bone is attached to * @returns The absolute position of the bone */ getAbsolutePosition(mesh?: Nullable): Vector3; /** * Copy the absolute position of the bone (world space) to the result param * @param mesh The mesh that this bone is attached to * @param result The vector3 to copy the absolute position to */ getAbsolutePositionToRef(mesh: AbstractMesh, result: Vector3): void; /** * Compute the absolute transforms of this bone and its children */ computeAbsoluteTransforms(): void; /** * Get the world direction from an axis that is in the local space of the bone * @param localAxis The local direction that is used to compute the world direction * @param mesh The mesh that this bone is attached to * @returns The world direction */ getDirection(localAxis: Vector3, mesh?: Nullable): Vector3; /** * Copy the world direction to a vector3 from an axis that is in the local space of the bone * @param localAxis The local direction that is used to compute the world direction * @param mesh The mesh that this bone is attached to * @param result The vector3 that the world direction will be copied to */ getDirectionToRef(localAxis: Vector3, mesh: AbstractMesh | null | undefined, result: Vector3): void; /** * Get the euler rotation of the bone in local or world space * @param space The space that the rotation should be in * @param mesh The mesh that this bone is attached to. This is only used in world space * @returns The euler rotation */ getRotation(space?: Space, mesh?: Nullable): Vector3; /** * Copy the euler rotation of the bone to a vector3. The rotation can be in either local or world space * @param space The space that the rotation should be in * @param mesh The mesh that this bone is attached to. This is only used in world space * @param result The vector3 that the rotation should be copied to */ getRotationToRef(space: Space | undefined, mesh: AbstractMesh | null | undefined, result: Vector3): void; /** * Get the quaternion rotation of the bone in either local or world space * @param space The space that the rotation should be in * @param mesh The mesh that this bone is attached to. This is only used in world space * @returns The quaternion rotation */ getRotationQuaternion(space?: Space, mesh?: Nullable): Quaternion; /** * Copy the quaternion rotation of the bone to a quaternion. The rotation can be in either local or world space * @param space The space that the rotation should be in * @param mesh The mesh that this bone is attached to. This is only used in world space * @param result The quaternion that the rotation should be copied to */ getRotationQuaternionToRef(space: Space | undefined, mesh: AbstractMesh | null | undefined, result: Quaternion): void; /** * Get the rotation matrix of the bone in local or world space * @param space The space that the rotation should be in * @param mesh The mesh that this bone is attached to. This is only used in world space * @returns The rotation matrix */ getRotationMatrix(space: Space | undefined, mesh: AbstractMesh): Matrix; /** * Copy the rotation matrix of the bone to a matrix. The rotation can be in either local or world space * @param space The space that the rotation should be in * @param mesh The mesh that this bone is attached to. This is only used in world space * @param result The quaternion that the rotation should be copied to */ getRotationMatrixToRef(space: Space | undefined, mesh: AbstractMesh, result: Matrix): void; /** * Get the world position of a point that is in the local space of the bone * @param position The local position * @param mesh The mesh that this bone is attached to * @returns The world position */ getAbsolutePositionFromLocal(position: Vector3, mesh?: Nullable): Vector3; /** * Get the world position of a point that is in the local space of the bone and copy it to the result param * @param position The local position * @param mesh The mesh that this bone is attached to * @param result The vector3 that the world position should be copied to */ getAbsolutePositionFromLocalToRef(position: Vector3, mesh: AbstractMesh | null | undefined, result: Vector3): void; /** * Get the local position of a point that is in world space * @param position The world position * @param mesh The mesh that this bone is attached to * @returns The local position */ getLocalPositionFromAbsolute(position: Vector3, mesh?: Nullable): Vector3; /** * Get the local position of a point that is in world space and copy it to the result param * @param position The world position * @param mesh The mesh that this bone is attached to * @param result The vector3 that the local position should be copied to */ getLocalPositionFromAbsoluteToRef(position: Vector3, mesh: AbstractMesh | null | undefined, result: Vector3): void; } } declare module "babylonjs/Engines/Extensions/engine.rawTexture" { import { Nullable } from "babylonjs/types"; import { InternalTexture } from "babylonjs/Materials/Textures/internalTexture"; import { Scene } from "babylonjs/scene"; module "babylonjs/Engines/engine" { interface Engine { /** * Creates a raw texture * @param data defines the data to store in the texture * @param width defines the width of the texture * @param height defines the height of the texture * @param format defines the format of the data * @param generateMipMaps defines if the engine should generate the mip levels * @param invertY defines if data must be stored with Y axis inverted * @param samplingMode defines the required sampling mode (Texture.NEAREST_SAMPLINGMODE by default) * @param compression defines the compression used (null by default) * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default) * @returns the raw texture inside an InternalTexture */ createRawTexture(data: Nullable, width: number, height: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression: Nullable, type: number): InternalTexture; /** * Update a raw texture * @param texture defines the texture to update * @param data defines the data to store in the texture * @param format defines the format of the data * @param invertY defines if data must be stored with Y axis inverted */ updateRawTexture(texture: Nullable, data: Nullable, format: number, invertY: boolean): void; /** * Update a raw texture * @param texture defines the texture to update * @param data defines the data to store in the texture * @param format defines the format of the data * @param invertY defines if data must be stored with Y axis inverted * @param compression defines the compression used (null by default) * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default) */ updateRawTexture(texture: Nullable, data: Nullable, format: number, invertY: boolean, compression: Nullable, type: number): void; /** * Creates a new raw cube texture * @param data defines the array of data to use to create each face * @param size defines the size of the textures * @param format defines the format of the data * @param type defines the type of the data (like Engine.TEXTURETYPE_UNSIGNED_INT) * @param generateMipMaps defines if the engine should generate the mip levels * @param invertY defines if data must be stored with Y axis inverted * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE) * @param compression defines the compression used (null by default) * @returns the cube texture as an InternalTexture */ createRawCubeTexture(data: Nullable, size: number, format: number, type: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression: Nullable): InternalTexture; /** * Update a raw cube texture * @param texture defines the texture to udpdate * @param data defines the data to store * @param format defines the data format * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default) * @param invertY defines if data must be stored with Y axis inverted */ updateRawCubeTexture(texture: InternalTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean): void; /** * Update a raw cube texture * @param texture defines the texture to udpdate * @param data defines the data to store * @param format defines the data format * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default) * @param invertY defines if data must be stored with Y axis inverted * @param compression defines the compression used (null by default) */ updateRawCubeTexture(texture: InternalTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean, compression: Nullable): void; /** * Update a raw cube texture * @param texture defines the texture to udpdate * @param data defines the data to store * @param format defines the data format * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default) * @param invertY defines if data must be stored with Y axis inverted * @param compression defines the compression used (null by default) * @param level defines which level of the texture to update */ updateRawCubeTexture(texture: InternalTexture, data: ArrayBufferView[], format: number, type: number, invertY: boolean, compression: Nullable, level: number): void; /** * Creates a new raw cube texture from a specified url * @param url defines the url where the data is located * @param scene defines the current scene * @param size defines the size of the textures * @param format defines the format of the data * @param type defines the type fo the data (like Engine.TEXTURETYPE_UNSIGNED_INT) * @param noMipmap defines if the engine should avoid generating the mip levels * @param callback defines a callback used to extract texture data from loaded data * @param mipmapGenerator defines to provide an optional tool to generate mip levels * @param onLoad defines a callback called when texture is loaded * @param onError defines a callback called if there is an error * @returns the cube texture as an InternalTexture */ createRawCubeTextureFromUrl(url: string, scene: Scene, size: number, format: number, type: number, noMipmap: boolean, callback: (ArrayBuffer: ArrayBuffer) => Nullable, mipmapGenerator: Nullable<((faces: ArrayBufferView[]) => ArrayBufferView[][])>, onLoad: Nullable<() => void>, onError: Nullable<(message?: string, exception?: any) => void>): InternalTexture; /** * Creates a new raw cube texture from a specified url * @param url defines the url where the data is located * @param scene defines the current scene * @param size defines the size of the textures * @param format defines the format of the data * @param type defines the type fo the data (like Engine.TEXTURETYPE_UNSIGNED_INT) * @param noMipmap defines if the engine should avoid generating the mip levels * @param callback defines a callback used to extract texture data from loaded data * @param mipmapGenerator defines to provide an optional tool to generate mip levels * @param onLoad defines a callback called when texture is loaded * @param onError defines a callback called if there is an error * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE) * @param invertY defines if data must be stored with Y axis inverted * @returns the cube texture as an InternalTexture */ createRawCubeTextureFromUrl(url: string, scene: Scene, size: number, format: number, type: number, noMipmap: boolean, callback: (ArrayBuffer: ArrayBuffer) => Nullable, mipmapGenerator: Nullable<((faces: ArrayBufferView[]) => ArrayBufferView[][])>, onLoad: Nullable<() => void>, onError: Nullable<(message?: string, exception?: any) => void>, samplingMode: number, invertY: boolean): InternalTexture; /** * Creates a new raw 3D texture * @param data defines the data used to create the texture * @param width defines the width of the texture * @param height defines the height of the texture * @param depth defines the depth of the texture * @param format defines the format of the texture * @param generateMipMaps defines if the engine must generate mip levels * @param invertY defines if data must be stored with Y axis inverted * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE) * @param compression defines the compressed used (can be null) * @param textureType defines the compressed used (can be null) * @returns a new raw 3D texture (stored in an InternalTexture) */ createRawTexture3D(data: Nullable, width: number, height: number, depth: number, format: number, generateMipMaps: boolean, invertY: boolean, samplingMode: number, compression: Nullable, textureType: number): InternalTexture; /** * Update a raw 3D texture * @param texture defines the texture to update * @param data defines the data to store * @param format defines the data format * @param invertY defines if data must be stored with Y axis inverted */ updateRawTexture3D(texture: InternalTexture, data: Nullable, format: number, invertY: boolean): void; /** * Update a raw 3D texture * @param texture defines the texture to update * @param data defines the data to store * @param format defines the data format * @param invertY defines if data must be stored with Y axis inverted * @param compression defines the used compression (can be null) * @param textureType defines the texture Type (Engine.TEXTURETYPE_UNSIGNED_INT, Engine.TEXTURETYPE_FLOAT...) */ updateRawTexture3D(texture: InternalTexture, data: Nullable, format: number, invertY: boolean, compression: Nullable, textureType: number): void; } } } declare module "babylonjs/Materials/Textures/rawTexture" { import { Scene } from "babylonjs/scene"; import { Texture } from "babylonjs/Materials/Textures/texture"; import "babylonjs/Engines/Extensions/engine.rawTexture"; /** * Raw texture can help creating a texture directly from an array of data. * This can be super useful if you either get the data from an uncompressed source or * if you wish to create your texture pixel by pixel. */ export class RawTexture extends Texture { /** * Define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx) */ format: number; private _engine; /** * Instantiates a new RawTexture. * Raw texture can help creating a texture directly from an array of data. * This can be super useful if you either get the data from an uncompressed source or * if you wish to create your texture pixel by pixel. * @param data define the array of data to use to create the texture * @param width define the width of the texture * @param height define the height of the texture * @param format define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx) * @param scene define the scene the texture belongs to * @param generateMipMaps define whether mip maps should be generated or not * @param invertY define if the data should be flipped on Y when uploaded to the GPU * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE) * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx) */ constructor(data: ArrayBufferView, width: number, height: number, /** * Define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx) */ format: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number, type?: number); /** * Updates the texture underlying data. * @param data Define the new data of the texture */ update(data: ArrayBufferView): void; /** * Creates a luminance texture from some data. * @param data Define the texture data * @param width Define the width of the texture * @param height Define the height of the texture * @param scene Define the scene the texture belongs to * @param generateMipMaps Define whether or not to create mip maps for the texture * @param invertY define if the data should be flipped on Y when uploaded to the GPU * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE) * @returns the luminance texture */ static CreateLuminanceTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; /** * Creates a luminance alpha texture from some data. * @param data Define the texture data * @param width Define the width of the texture * @param height Define the height of the texture * @param scene Define the scene the texture belongs to * @param generateMipMaps Define whether or not to create mip maps for the texture * @param invertY define if the data should be flipped on Y when uploaded to the GPU * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE) * @returns the luminance alpha texture */ static CreateLuminanceAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; /** * Creates an alpha texture from some data. * @param data Define the texture data * @param width Define the width of the texture * @param height Define the height of the texture * @param scene Define the scene the texture belongs to * @param generateMipMaps Define whether or not to create mip maps for the texture * @param invertY define if the data should be flipped on Y when uploaded to the GPU * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE) * @returns the alpha texture */ static CreateAlphaTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number): RawTexture; /** * Creates a RGB texture from some data. * @param data Define the texture data * @param width Define the width of the texture * @param height Define the height of the texture * @param scene Define the scene the texture belongs to * @param generateMipMaps Define whether or not to create mip maps for the texture * @param invertY define if the data should be flipped on Y when uploaded to the GPU * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE) * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx) * @returns the RGB alpha texture */ static CreateRGBTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number, type?: number): RawTexture; /** * Creates a RGBA texture from some data. * @param data Define the texture data * @param width Define the width of the texture * @param height Define the height of the texture * @param scene Define the scene the texture belongs to * @param generateMipMaps Define whether or not to create mip maps for the texture * @param invertY define if the data should be flipped on Y when uploaded to the GPU * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE) * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx) * @returns the RGBA texture */ static CreateRGBATexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number, type?: number): RawTexture; /** * Creates a R texture from some data. * @param data Define the texture data * @param width Define the width of the texture * @param height Define the height of the texture * @param scene Define the scene the texture belongs to * @param generateMipMaps Define whether or not to create mip maps for the texture * @param invertY define if the data should be flipped on Y when uploaded to the GPU * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE) * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx) * @returns the R texture */ static CreateRTexture(data: ArrayBufferView, width: number, height: number, scene: Scene, generateMipMaps?: boolean, invertY?: boolean, samplingMode?: number, type?: number): RawTexture; } } declare module "babylonjs/Animations/runtimeAnimation" { import { Animation, _IAnimationState } from "babylonjs/Animations/animation"; import { Animatable } from "babylonjs/Animations/animatable"; import { Scene } from "babylonjs/scene"; /** * Defines a runtime animation */ export class RuntimeAnimation { private _events; /** * The current frame of the runtime animation */ private _currentFrame; /** * The animation used by the runtime animation */ private _animation; /** * The target of the runtime animation */ private _target; /** * The initiating animatable */ private _host; /** * The original value of the runtime animation */ private _originalValue; /** * The original blend value of the runtime animation */ private _originalBlendValue; /** * The offsets cache of the runtime animation */ private _offsetsCache; /** * The high limits cache of the runtime animation */ private _highLimitsCache; /** * Specifies if the runtime animation has been stopped */ private _stopped; /** * The blending factor of the runtime animation */ private _blendingFactor; /** * The BabylonJS scene */ private _scene; /** * The current value of the runtime animation */ private _currentValue; /** @hidden */ _animationState: _IAnimationState; /** * The active target of the runtime animation */ private _activeTargets; private _currentActiveTarget; private _directTarget; /** * The target path of the runtime animation */ private _targetPath; /** * The weight of the runtime animation */ private _weight; /** * The ratio offset of the runtime animation */ private _ratioOffset; /** * The previous delay of the runtime animation */ private _previousDelay; /** * The previous ratio of the runtime animation */ private _previousRatio; private _enableBlending; private _keys; private _minFrame; private _maxFrame; private _minValue; private _maxValue; private _targetIsArray; /** * Gets the current frame of the runtime animation */ readonly currentFrame: number; /** * Gets the weight of the runtime animation */ readonly weight: number; /** * Gets the current value of the runtime animation */ readonly currentValue: any; /** * Gets the target path of the runtime animation */ readonly targetPath: string; /** * Gets the actual target of the runtime animation */ readonly target: any; /** @hidden */ _onLoop: () => void; /** * Create a new RuntimeAnimation object * @param target defines the target of the animation * @param animation defines the source animation object * @param scene defines the hosting scene * @param host defines the initiating Animatable */ constructor(target: any, animation: Animation, scene: Scene, host: Animatable); private _preparePath; /** * Gets the animation from the runtime animation */ readonly animation: Animation; /** * Resets the runtime animation to the beginning * @param restoreOriginal defines whether to restore the target property to the original value */ reset(restoreOriginal?: boolean): void; /** * Specifies if the runtime animation is stopped * @returns Boolean specifying if the runtime animation is stopped */ isStopped(): boolean; /** * Disposes of the runtime animation */ dispose(): void; /** * Apply the interpolated value to the target * @param currentValue defines the value computed by the animation * @param weight defines the weight to apply to this value (Defaults to 1.0) */ setValue(currentValue: any, weight: number): void; private _getOriginalValues; private _setValue; /** * Gets the loop pmode of the runtime animation * @returns Loop Mode */ private _getCorrectLoopMode; /** * Move the current animation to a given frame * @param frame defines the frame to move to */ goToFrame(frame: number): void; /** * @hidden Internal use only */ _prepareForSpeedRatioChange(newSpeedRatio: number): void; /** * Execute the current animation * @param delay defines the delay to add to the current frame * @param from defines the lower bound of the animation range * @param to defines the upper bound of the animation range * @param loop defines if the current animation must loop * @param speedRatio defines the current speed ratio * @param weight defines the weight of the animation (default is -1 so no weight) * @param onLoop optional callback called when animation loops * @returns a boolean indicating if the animation is running */ animate(delay: number, from: number, to: number, loop: boolean, speedRatio: number, weight?: number): boolean; } } declare module "babylonjs/Animations/animatable" { import { Animation } from "babylonjs/Animations/animation"; import { RuntimeAnimation } from "babylonjs/Animations/runtimeAnimation"; import { Nullable } from "babylonjs/types"; import { Observable } from "babylonjs/Misc/observable"; import { Scene } from "babylonjs/scene"; import { Matrix, Quaternion, Vector3 } from "babylonjs/Maths/math"; import { Node } from "babylonjs/node"; /** * Class used to store an actual running animation */ export class Animatable { /** defines the target object */ target: any; /** defines the starting frame number (default is 0) */ fromFrame: number; /** defines the ending frame number (default is 100) */ toFrame: number; /** defines if the animation must loop (default is false) */ loopAnimation: boolean; /** defines a callback to call when animation ends if it is not looping */ onAnimationEnd?: (() => void) | null | undefined; /** defines a callback to call when animation loops */ onAnimationLoop?: (() => void) | null | undefined; private _localDelayOffset; private _pausedDelay; private _runtimeAnimations; private _paused; private _scene; private _speedRatio; private _weight; private _syncRoot; /** * Gets or sets a boolean indicating if the animatable must be disposed and removed at the end of the animation. * This will only apply for non looping animation (default is true) */ disposeOnEnd: boolean; /** * Gets a boolean indicating if the animation has started */ animationStarted: boolean; /** * Observer raised when the animation ends */ onAnimationEndObservable: Observable; /** * Observer raised when the animation loops */ onAnimationLoopObservable: Observable; /** * Gets the root Animatable used to synchronize and normalize animations */ readonly syncRoot: Nullable; /** * Gets the current frame of the first RuntimeAnimation * Used to synchronize Animatables */ readonly masterFrame: number; /** * Gets or sets the animatable weight (-1.0 by default meaning not weighted) */ weight: number; /** * Gets or sets the speed ratio to apply to the animatable (1.0 by default) */ speedRatio: number; /** * Creates a new Animatable * @param scene defines the hosting scene * @param target defines the target object * @param fromFrame defines the starting frame number (default is 0) * @param toFrame defines the ending frame number (default is 100) * @param loopAnimation defines if the animation must loop (default is false) * @param speedRatio defines the factor to apply to animation speed (default is 1) * @param onAnimationEnd defines a callback to call when animation ends if it is not looping * @param animations defines a group of animation to add to the new Animatable * @param onAnimationLoop defines a callback to call when animation loops */ constructor(scene: Scene, /** defines the target object */ target: any, /** defines the starting frame number (default is 0) */ fromFrame?: number, /** defines the ending frame number (default is 100) */ toFrame?: number, /** defines if the animation must loop (default is false) */ loopAnimation?: boolean, speedRatio?: number, /** defines a callback to call when animation ends if it is not looping */ onAnimationEnd?: (() => void) | null | undefined, animations?: Animation[], /** defines a callback to call when animation loops */ onAnimationLoop?: (() => void) | null | undefined); /** * Synchronize and normalize current Animatable with a source Animatable * This is useful when using animation weights and when animations are not of the same length * @param root defines the root Animatable to synchronize with * @returns the current Animatable */ syncWith(root: Animatable): Animatable; /** * Gets the list of runtime animations * @returns an array of RuntimeAnimation */ getAnimations(): RuntimeAnimation[]; /** * Adds more animations to the current animatable * @param target defines the target of the animations * @param animations defines the new animations to add */ appendAnimations(target: any, animations: Animation[]): void; /** * Gets the source animation for a specific property * @param property defines the propertyu to look for * @returns null or the source animation for the given property */ getAnimationByTargetProperty(property: string): Nullable; /** * Gets the runtime animation for a specific property * @param property defines the propertyu to look for * @returns null or the runtime animation for the given property */ getRuntimeAnimationByTargetProperty(property: string): Nullable; /** * Resets the animatable to its original state */ reset(): void; /** * Allows the animatable to blend with current running animations * @see http://doc.babylonjs.com/babylon101/animations#animation-blending * @param blendingSpeed defines the blending speed to use */ enableBlending(blendingSpeed: number): void; /** * Disable animation blending * @see http://doc.babylonjs.com/babylon101/animations#animation-blending */ disableBlending(): void; /** * Jump directly to a given frame * @param frame defines the frame to jump to */ goToFrame(frame: number): void; /** * Pause the animation */ pause(): void; /** * Restart the animation */ restart(): void; private _raiseOnAnimationEnd; /** * Stop and delete the current animation * @param animationName defines a string used to only stop some of the runtime animations instead of all * @param targetMask - a function that determines if the animation should be stopped based on its target (all animations will be stopped if both this and animationName are empty) */ stop(animationName?: string, targetMask?: (target: any) => boolean): void; /** * Wait asynchronously for the animation to end * @returns a promise which will be fullfilled when the animation ends */ waitAsync(): Promise; /** @hidden */ _animate(delay: number): boolean; } module "babylonjs/scene" { interface Scene { /** @hidden */ _registerTargetForLateAnimationBinding(runtimeAnimation: RuntimeAnimation, originalValue: any): void; /** @hidden */ _processLateAnimationBindingsForMatrices(holder: { totalWeight: number; animations: RuntimeAnimation[]; originalValue: Matrix; }): any; /** @hidden */ _processLateAnimationBindingsForQuaternions(holder: { totalWeight: number; animations: RuntimeAnimation[]; originalValue: Quaternion; }, refQuaternion: Quaternion): Quaternion; /** @hidden */ _processLateAnimationBindings(): void; /** * Will start the animation sequence of a given target * @param target defines the target * @param from defines from which frame should animation start * @param to defines until which frame should animation run. * @param weight defines the weight to apply to the animation (1.0 by default) * @param loop defines if the animation loops * @param speedRatio defines the speed in which to run the animation (1.0 by default) * @param onAnimationEnd defines the function to be executed when the animation ends * @param animatable defines an animatable object. If not provided a new one will be created from the given params * @param targetMask defines if the target should be animated if animations are present (this is called recursively on descendant animatables regardless of return value) * @param onAnimationLoop defines the callback to call when an animation loops * @returns the animatable object created for this animation */ beginWeightedAnimation(target: any, from: number, to: number, weight: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void, animatable?: Animatable, targetMask?: (target: any) => boolean, onAnimationLoop?: () => void): Animatable; /** * Will start the animation sequence of a given target * @param target defines the target * @param from defines from which frame should animation start * @param to defines until which frame should animation run. * @param loop defines if the animation loops * @param speedRatio defines the speed in which to run the animation (1.0 by default) * @param onAnimationEnd defines the function to be executed when the animation ends * @param animatable defines an animatable object. If not provided a new one will be created from the given params * @param stopCurrent defines if the current animations must be stopped first (true by default) * @param targetMask defines if the target should be animate if animations are present (this is called recursively on descendant animatables regardless of return value) * @param onAnimationLoop defines the callback to call when an animation loops * @returns the animatable object created for this animation */ beginAnimation(target: any, from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void, animatable?: Animatable, stopCurrent?: boolean, targetMask?: (target: any) => boolean, onAnimationLoop?: () => void): Animatable; /** * Will start the animation sequence of a given target and its hierarchy * @param target defines the target * @param directDescendantsOnly if true only direct descendants will be used, if false direct and also indirect (children of children, an so on in a recursive manner) descendants will be used. * @param from defines from which frame should animation start * @param to defines until which frame should animation run. * @param loop defines if the animation loops * @param speedRatio defines the speed in which to run the animation (1.0 by default) * @param onAnimationEnd defines the function to be executed when the animation ends * @param animatable defines an animatable object. If not provided a new one will be created from the given params * @param stopCurrent defines if the current animations must be stopped first (true by default) * @param targetMask defines if the target should be animated if animations are present (this is called recursively on descendant animatables regardless of return value) * @param onAnimationLoop defines the callback to call when an animation loops * @returns the list of created animatables */ beginHierarchyAnimation(target: any, directDescendantsOnly: boolean, from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void, animatable?: Animatable, stopCurrent?: boolean, targetMask?: (target: any) => boolean, onAnimationLoop?: () => void): Animatable[]; /** * Begin a new animation on a given node * @param target defines the target where the animation will take place * @param animations defines the list of animations to start * @param from defines the initial value * @param to defines the final value * @param loop defines if you want animation to loop (off by default) * @param speedRatio defines the speed ratio to apply to all animations * @param onAnimationEnd defines the callback to call when an animation ends (will be called once per node) * @param onAnimationLoop defines the callback to call when an animation loops * @returns the list of created animatables */ beginDirectAnimation(target: any, animations: Animation[], from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void, onAnimationLoop?: () => void): Animatable; /** * Begin a new animation on a given node and its hierarchy * @param target defines the root node where the animation will take place * @param directDescendantsOnly if true only direct descendants will be used, if false direct and also indirect (children of children, an so on in a recursive manner) descendants will be used. * @param animations defines the list of animations to start * @param from defines the initial value * @param to defines the final value * @param loop defines if you want animation to loop (off by default) * @param speedRatio defines the speed ratio to apply to all animations * @param onAnimationEnd defines the callback to call when an animation ends (will be called once per node) * @param onAnimationLoop defines the callback to call when an animation loops * @returns the list of animatables created for all nodes */ beginDirectHierarchyAnimation(target: Node, directDescendantsOnly: boolean, animations: Animation[], from: number, to: number, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void, onAnimationLoop?: () => void): Animatable[]; /** * Gets the animatable associated with a specific target * @param target defines the target of the animatable * @returns the required animatable if found */ getAnimatableByTarget(target: any): Nullable; /** * Gets all animatables associated with a given target * @param target defines the target to look animatables for * @returns an array of Animatables */ getAllAnimatablesByTarget(target: any): Array; /** * Stops and removes all animations that have been applied to the scene */ stopAllAnimations(): void; } } module "babylonjs/Bones/bone" { interface Bone { /** * Copy an animation range from another bone * @param source defines the source bone * @param rangeName defines the range name to copy * @param frameOffset defines the frame offset * @param rescaleAsRequired defines if rescaling must be applied if required * @param skelDimensionsRatio defines the scaling ratio * @returns true if operation was successful */ copyAnimationRange(source: Bone, rangeName: string, frameOffset: number, rescaleAsRequired: boolean, skelDimensionsRatio: Nullable): boolean; } } } declare module "babylonjs/Bones/skeleton" { import { Bone } from "babylonjs/Bones/bone"; import { IAnimatable } from "babylonjs/Misc/tools"; import { Observable } from "babylonjs/Misc/observable"; import { Vector3, Matrix } from "babylonjs/Maths/math"; import { Scene } from "babylonjs/scene"; import { Nullable } from "babylonjs/types"; import { AbstractMesh } from "babylonjs/Meshes/abstractMesh"; import { RawTexture } from "babylonjs/Materials/Textures/rawTexture"; import { Animatable } from "babylonjs/Animations/animatable"; import { AnimationPropertiesOverride } from "babylonjs/Animations/animationPropertiesOverride"; import { Animation } from "babylonjs/Animations/animation"; import { AnimationRange } from "babylonjs/Animations/animationRange"; import { IInspectable } from "babylonjs/Misc/iInspectable"; /** * Class used to handle skinning animations * @see http://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons */ export class Skeleton implements IAnimatable { /** defines the skeleton name */ name: string; /** defines the skeleton Id */ id: string; /** * Defines the list of child bones */ bones: Bone[]; /** * Defines an estimate of the dimension of the skeleton at rest */ dimensionsAtRest: Vector3; /** * Defines a boolean indicating if the root matrix is provided by meshes or by the current skeleton (this is the default value) */ needInitialSkinMatrix: boolean; /** * Defines a mesh that override the matrix used to get the world matrix (null by default). */ overrideMesh: Nullable; /** * Gets the list of animations attached to this skeleton */ animations: Array; private _scene; private _isDirty; private _transformMatrices; private _transformMatrixTexture; private _meshesWithPoseMatrix; private _animatables; private _identity; private _synchronizedWithMesh; private _ranges; private _lastAbsoluteTransformsUpdateId; private _canUseTextureForBones; private _uniqueId; /** @hidden */ _numBonesWithLinkedTransformNode: number; /** @hidden */ _hasWaitingData: Nullable; /** * Specifies if the skeleton should be serialized */ doNotSerialize: boolean; private _useTextureToStoreBoneMatrices; /** * Gets or sets a boolean indicating that bone matrices should be stored as a texture instead of using shader uniforms (default is true). * Please note that this option is not available when needInitialSkinMatrix === true or if the hardware does not support it */ useTextureToStoreBoneMatrices: boolean; private _animationPropertiesOverride; /** * Gets or sets the animation properties override */ animationPropertiesOverride: Nullable; /** * List of inspectable custom properties (used by the Inspector) * @see https://doc.babylonjs.com/how_to/debug_layer#extensibility */ inspectableCustomProperties: IInspectable[]; /** * An observable triggered before computing the skeleton's matrices */ onBeforeComputeObservable: Observable; /** * Gets a boolean indicating that the skeleton effectively stores matrices into a texture */ readonly isUsingTextureForMatrices: boolean; /** * Gets the unique ID of this skeleton */ readonly uniqueId: number; /** * Creates a new skeleton * @param name defines the skeleton name * @param id defines the skeleton Id * @param scene defines the hosting scene */ constructor( /** defines the skeleton name */ name: string, /** defines the skeleton Id */ id: string, scene: Scene); /** * Gets the current object class name. * @return the class name */ getClassName(): string; /** * Returns an array containing the root bones * @returns an array containing the root bones */ getChildren(): Array; /** * Gets the list of transform matrices to send to shaders (one matrix per bone) * @param mesh defines the mesh to use to get the root matrix (if needInitialSkinMatrix === true) * @returns a Float32Array containing matrices data */ getTransformMatrices(mesh: AbstractMesh): Float32Array; /** * Gets the list of transform matrices to send to shaders inside a texture (one matrix per bone) * @returns a raw texture containing the data */ getTransformMatrixTexture(): Nullable; /** * Gets the current hosting scene * @returns a scene object */ getScene(): Scene; /** * Gets a string representing the current skeleton data * @param fullDetails defines a boolean indicating if we want a verbose version * @returns a string representing the current skeleton data */ toString(fullDetails?: boolean): string; /** * Get bone's index searching by name * @param name defines bone's name to search for * @return the indice of the bone. Returns -1 if not found */ getBoneIndexByName(name: string): number; /** * Creater a new animation range * @param name defines the name of the range * @param from defines the start key * @param to defines the end key */ createAnimationRange(name: string, from: number, to: number): void; /** * Delete a specific animation range * @param name defines the name of the range * @param deleteFrames defines if frames must be removed as well */ deleteAnimationRange(name: string, deleteFrames?: boolean): void; /** * Gets a specific animation range * @param name defines the name of the range to look for * @returns the requested animation range or null if not found */ getAnimationRange(name: string): Nullable; /** * Gets the list of all animation ranges defined on this skeleton * @returns an array */ getAnimationRanges(): Nullable[]; /** * Copy animation range from a source skeleton. * This is not for a complete retargeting, only between very similar skeleton's with only possible bone length differences * @param source defines the source skeleton * @param name defines the name of the range to copy * @param rescaleAsRequired defines if rescaling must be applied if required * @returns true if operation was successful */ copyAnimationRange(source: Skeleton, name: string, rescaleAsRequired?: boolean): boolean; /** * Forces the skeleton to go to rest pose */ returnToRest(): void; private _getHighestAnimationFrame; /** * Begin a specific animation range * @param name defines the name of the range to start * @param loop defines if looping must be turned on (false by default) * @param speedRatio defines the speed ratio to apply (1 by default) * @param onAnimationEnd defines a callback which will be called when animation will end * @returns a new animatable */ beginAnimation(name: string, loop?: boolean, speedRatio?: number, onAnimationEnd?: () => void): Nullable; /** @hidden */ _markAsDirty(): void; /** @hidden */ _registerMeshWithPoseMatrix(mesh: AbstractMesh): void; /** @hidden */ _unregisterMeshWithPoseMatrix(mesh: AbstractMesh): void; private _computeTransformMatrices; /** * Build all resources required to render a skeleton */ prepare(): void; /** * Gets the list of animatables currently running for this skeleton * @returns an array of animatables */ getAnimatables(): IAnimatable[]; /** * Clone the current skeleton * @param name defines the name of the new skeleton * @param id defines the id of the new skeleton * @returns the new skeleton */ clone(name: string, id: string): Skeleton; /** * Enable animation blending for this skeleton * @param blendingSpeed defines the blending speed to apply * @see http://doc.babylonjs.com/babylon101/animations#animation-blending */ enableBlending(blendingSpeed?: number): void; /** * Releases all resources associated with the current skeleton */ dispose(): void; /** * Serialize the skeleton in a JSON object * @returns a JSON object */ serialize(): any; /** * Creates a new skeleton from serialized data * @param parsedSkeleton defines the serialized data * @param scene defines the hosting scene * @returns a new skeleton */ static Parse(parsedSkeleton: any, scene: Scene): Skeleton; /** * Compute all node absolute transforms * @param forceUpdate defines if computation must be done even if cache is up to date */ computeAbsoluteTransforms(forceUpdate?: boolean): void; /** * Gets the root pose matrix * @returns a matrix */ getPoseMatrix(): Nullable; /** * Sorts bones per internal index */ sortBones(): void; private _sortBones; } } declare module "babylonjs/Morph/morphTarget" { import { IAnimatable } from "babylonjs/Misc/tools"; import { Observable } from "babylonjs/Misc/observable"; import { Nullable, FloatArray } from "babylonjs/types"; import { Scene } from "babylonjs/scene"; import { AbstractMesh } from "babylonjs/Meshes/abstractMesh"; import { AnimationPropertiesOverride } from "babylonjs/Animations/animationPropertiesOverride"; /** * Defines a target to use with MorphTargetManager * @see http://doc.babylonjs.com/how_to/how_to_use_morphtargets */ export class MorphTarget implements IAnimatable { /** defines the name of the target */ name: string; /** * Gets or sets the list of animations */ animations: import("babylonjs/Animations/animation").Animation[]; private _scene; private _positions; private _normals; private _tangents; private _influence; /** * Observable raised when the influence changes */ onInfluenceChanged: Observable; /** @hidden */ _onDataLayoutChanged: Observable; /** * Gets or sets the influence of this target (ie. its weight in the overall morphing) */ influence: number; /** * Gets or sets the id of the morph Target */ id: string; private _animationPropertiesOverride; /** * Gets or sets the animation properties override */ animationPropertiesOverride: Nullable; /** * Creates a new MorphTarget * @param name defines the name of the target * @param influence defines the influence to use * @param scene defines the scene the morphtarget belongs to */ constructor( /** defines the name of the target */ name: string, influence?: number, scene?: Nullable); /** * Gets a boolean defining if the target contains position data */ readonly hasPositions: boolean; /** * Gets a boolean defining if the target contains normal data */ readonly hasNormals: boolean; /** * Gets a boolean defining if the target contains tangent data */ readonly hasTangents: boolean; /** * Affects position data to this target * @param data defines the position data to use */ setPositions(data: Nullable): void; /** * Gets the position data stored in this target * @returns a FloatArray containing the position data (or null if not present) */ getPositions(): Nullable; /** * Affects normal data to this target * @param data defines the normal data to use */ setNormals(data: Nullable): void; /** * Gets the normal data stored in this target * @returns a FloatArray containing the normal data (or null if not present) */ getNormals(): Nullable; /** * Affects tangent data to this target * @param data defines the tangent data to use */ setTangents(data: Nullable): void; /** * Gets the tangent data stored in this target * @returns a FloatArray containing the tangent data (or null if not present) */ getTangents(): Nullable; /** * Serializes the current target into a Serialization object * @returns the serialized object */ serialize(): any; /** * Returns the string "MorphTarget" * @returns "MorphTarget" */ getClassName(): string; /** * Creates a new target from serialized data * @param serializationObject defines the serialized data to use * @returns a new MorphTarget */ static Parse(serializationObject: any): MorphTarget; /** * Creates a MorphTarget from mesh data * @param mesh defines the source mesh * @param name defines the name to use for the new target * @param influence defines the influence to attach to the target * @returns a new MorphTarget */ static FromMesh(mesh: AbstractMesh, name?: string, influence?: number): MorphTarget; } } declare module "babylonjs/Morph/morphTargetManager" { import { Nullable } from "babylonjs/types"; import { Scene } from "babylonjs/scene"; import { MorphTarget } from "babylonjs/Morph/morphTarget"; /** * This class is used to deform meshes using morphing between different targets * @see http://doc.babylonjs.com/how_to/how_to_use_morphtargets */ export class MorphTargetManager { private _targets; private _targetInfluenceChangedObservers; private _targetDataLayoutChangedObservers; private _activeTargets; private _scene; private _influences; private _supportsNormals; private _supportsTangents; private _vertexCount; private _uniqueId; private _tempInfluences; /** * Creates a new MorphTargetManager * @param scene defines the current scene */ constructor(scene?: Nullable); /** * Gets the unique ID of this manager */ readonly uniqueId: number; /** * Gets the number of vertices handled by this manager */ readonly vertexCount: number; /** * Gets a boolean indicating if this manager supports morphing of normals */ readonly supportsNormals: boolean; /** * Gets a boolean indicating if this manager supports morphing of tangents */ readonly supportsTangents: boolean; /** * Gets the number of targets stored in this manager */ readonly numTargets: number; /** * Gets the number of influencers (ie. the number of targets with influences > 0) */ readonly numInfluencers: number; /** * Gets the list of influences (one per target) */ readonly influences: Float32Array; /** * Gets the active target at specified index. An active target is a target with an influence > 0 * @param index defines the index to check * @returns the requested target */ getActiveTarget(index: number): MorphTarget; /** * Gets the target at specified index * @param index defines the index to check * @returns the requested target */ getTarget(index: number): MorphTarget; /** * Add a new target to this manager * @param target defines the target to add */ addTarget(target: MorphTarget): void; /** * Removes a target from the manager * @param target defines the target to remove */ removeTarget(target: MorphTarget): void; /** * Serializes the current manager into a Serialization object * @returns the serialized object */ serialize(): any; private _syncActiveTargets; /** * Syncrhonize the targets with all the meshes using this morph target manager */ synchronize(): void; /** * Creates a new MorphTargetManager from serialized data * @param serializationObject defines the serialized data * @param scene defines the hosting scene * @returns the new MorphTargetManager */ static Parse(serializationObject: any, scene: Scene): MorphTargetManager; } } declare module "babylonjs/sceneComponent" { import { Scene } from "babylonjs/scene"; import { AbstractMesh } from "babylonjs/Meshes/abstractMesh"; import { SubMesh } from "babylonjs/Meshes/subMesh"; import { _InstancesBatch } from "babylonjs/Meshes/mesh"; import { SmartArrayNoDuplicate } from "babylonjs/Misc/smartArray"; import { Nullable } from "babylonjs/types"; import { Camera } from "babylonjs/Cameras/camera"; import { RenderTargetTexture } from "babylonjs/Materials/Textures/renderTargetTexture"; import { PickingInfo } from "babylonjs/Collisions/pickingInfo"; import { AbstractScene } from "babylonjs/abstractScene"; /** * Groups all the scene component constants in one place to ease maintenance. * @hidden */ export class SceneComponentConstants { static readonly NAME_EFFECTLAYER: string; static readonly NAME_LAYER: string; static readonly NAME_LENSFLARESYSTEM: string; static readonly NAME_BOUNDINGBOXRENDERER: string; static readonly NAME_PARTICLESYSTEM: string; static readonly NAME_GAMEPAD: string; static readonly NAME_SIMPLIFICATIONQUEUE: string; static readonly NAME_GEOMETRYBUFFERRENDERER: string; static readonly NAME_DEPTHRENDERER: string; static readonly NAME_POSTPROCESSRENDERPIPELINEMANAGER: string; static readonly NAME_SPRITE: string; static readonly NAME_OUTLINERENDERER: string; static readonly NAME_PROCEDURALTEXTURE: string; static readonly NAME_SHADOWGENERATOR: string; static readonly NAME_OCTREE: string; static readonly NAME_PHYSICSENGINE: string; static readonly NAME_AUDIO: string; static readonly STEP_ISREADYFORMESH_EFFECTLAYER: number; static readonly STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER: number; static readonly STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER: number; static readonly STEP_ACTIVEMESH_BOUNDINGBOXRENDERER: number; static readonly STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER: number; static readonly STEP_BEFORECAMERADRAW_EFFECTLAYER: number; static readonly STEP_BEFORECAMERADRAW_LAYER: number; static readonly STEP_BEFORERENDERTARGETDRAW_LAYER: number; static readonly STEP_BEFORERENDERINGMESH_OUTLINE: number; static readonly STEP_AFTERRENDERINGMESH_OUTLINE: number; static readonly STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW: number; static readonly STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER: number; static readonly STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE: number; static readonly STEP_BEFORECAMERAUPDATE_GAMEPAD: number; static readonly STEP_BEFORECLEAR_PROCEDURALTEXTURE: number; static readonly STEP_AFTERRENDERTARGETDRAW_LAYER: number; static readonly STEP_AFTERCAMERADRAW_EFFECTLAYER: number; static readonly STEP_AFTERCAMERADRAW_LENSFLARESYSTEM: number; static readonly STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW: number; static readonly STEP_AFTERCAMERADRAW_LAYER: number; static readonly STEP_AFTERRENDER_AUDIO: number; static readonly STEP_GATHERRENDERTARGETS_SHADOWGENERATOR: number; static readonly STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER: number; static readonly STEP_GATHERRENDERTARGETS_DEPTHRENDERER: number; static readonly STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER: number; static readonly STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER: number; static readonly STEP_POINTERMOVE_SPRITE: number; static readonly STEP_POINTERDOWN_SPRITE: number; static readonly STEP_POINTERUP_SPRITE: number; } /** * This represents a scene component. * * This is used to decouple the dependency the scene is having on the different workloads like * layers, post processes... */ export interface ISceneComponent { /** * The name of the component. Each component must have a unique name. */ name: string; /** * The scene the component belongs to. */ scene: Scene; /** * Register the component to one instance of a scene. */ register(): void; /** * Rebuilds the elements related to this component in case of * context lost for instance. */ rebuild(): void; /** * Disposes the component and the associated ressources. */ dispose(): void; } /** * This represents a SERIALIZABLE scene component. * * This extends Scene Component to add Serialization methods on top. */ export interface ISceneSerializableComponent extends ISceneComponent { /** * Adds all the elements from the container to the scene * @param container the container holding the elements */ addFromContainer(container: AbstractScene): void; /** * Removes all the elements in the container from the scene * @param container contains the elements to remove * @param dispose if the removed element should be disposed (default: false) */ removeFromContainer(container: AbstractScene, dispose?: boolean): void; /** * Serializes the component data to the specified json object * @param serializationObject The object to serialize to */ serialize(serializationObject: any): void; } /** * Strong typing of a Mesh related stage step action */ export type MeshStageAction = (mesh: AbstractMesh, hardwareInstancedRendering: boolean) => boolean; /** * Strong typing of a Evaluate Sub Mesh related stage step action */ export type EvaluateSubMeshStageAction = (mesh: AbstractMesh, subMesh: SubMesh) => void; /** * Strong typing of a Active Mesh related stage step action */ export type ActiveMeshStageAction = (sourceMesh: AbstractMesh, mesh: AbstractMesh) => void; /** * Strong typing of a Camera related stage step action */ export type CameraStageAction = (camera: Camera) => void; /** * Strong typing of a Camera Frame buffer related stage step action */ export type CameraStageFrameBufferAction = (camera: Camera) => boolean; /** * Strong typing of a Render Target related stage step action */ export type RenderTargetStageAction = (renderTarget: RenderTargetTexture) => void; /** * Strong typing of a RenderingGroup related stage step action */ export type RenderingGroupStageAction = (renderingGroupId: number) => void; /** * Strong typing of a Mesh Render related stage step action */ export type RenderingMeshStageAction = (mesh: AbstractMesh, subMesh: SubMesh, batch: _InstancesBatch) => void; /** * Strong typing of a simple stage step action */ export type SimpleStageAction = () => void; /** * Strong typing of a render target action. */ export type RenderTargetsStageAction = (renderTargets: SmartArrayNoDuplicate) => void; /** * Strong typing of a pointer move action. */ export type PointerMoveStageAction = (unTranslatedPointerX: number, unTranslatedPointerY: number, pickResult: Nullable, isMeshPicked: boolean, canvas: HTMLCanvasElement) => Nullable; /** * Strong typing of a pointer up/down action. */ export type PointerUpDownStageAction = (unTranslatedPointerX: number, unTranslatedPointerY: number, pickResult: Nullable, evt: PointerEvent) => Nullable; /** * Repressentation of a stage in the scene (Basically a list of ordered steps) * @hidden */ export class Stage extends Array<{ index: number; component: ISceneComponent; action: T; }> { /** * Hide ctor from the rest of the world. * @param items The items to add. */ private constructor(); /** * Creates a new Stage. * @returns A new instance of a Stage */ static Create(): Stage; /** * Registers a step in an ordered way in the targeted stage. * @param index Defines the position to register the step in * @param component Defines the component attached to the step * @param action Defines the action to launch during the step */ registerStep(index: number, component: ISceneComponent, action: T): void; /** * Clears all the steps from the stage. */ clear(): void; } } declare module "babylonjs/Meshes/meshLODLevel" { import { Mesh } from "babylonjs/Meshes/mesh"; import { Nullable } from "babylonjs/types"; /** * Class used to represent a specific level of detail of a mesh * @see http://doc.babylonjs.com/how_to/how_to_use_lod */ export class MeshLODLevel { /** Defines the distance where this level should star being displayed */ distance: number; /** Defines the mesh to use to render this level */ mesh: Nullable; /** * Creates a new LOD level * @param distance defines the distance where this level should star being displayed * @param mesh defines the mesh to use to render this level */ constructor( /** Defines the distance where this level should star being displayed */ distance: number, /** Defines the mesh to use to render this level */ mesh: Nullable); } } declare module "babylonjs/Lights/shadowLight" { import { Camera } from "babylonjs/Cameras/camera"; import { Scene } from "babylonjs/scene"; import { Matrix, Vector3 } from "babylonjs/Maths/math"; import { AbstractMesh } from "babylonjs/Meshes/abstractMesh"; import { Light } from "babylonjs/Lights/light"; /** * Interface describing all the common properties and methods a shadow light needs to implement. * This helps both the shadow generator and materials to genrate the corresponding shadow maps * as well as binding the different shadow properties to the effects. */ export interface IShadowLight extends Light { /** * The light id in the scene (used in scene.findLighById for instance) */ id: string; /** * The position the shdow will be casted from. */ position: Vector3; /** * In 2d mode (needCube being false), the direction used to cast the shadow. */ direction: Vector3; /** * The transformed position. Position of the light in world space taking parenting in account. */ transformedPosition: Vector3; /** * The transformed direction. Direction of the light in world space taking parenting in account. */ transformedDirection: Vector3; /** * The friendly name of the light in the scene. */ name: string; /** * Defines the shadow projection clipping minimum z value. */ shadowMinZ: number; /** * Defines the shadow projection clipping maximum z value. */ shadowMaxZ: number; /** * Computes the transformed information (transformedPosition and transformedDirection in World space) of the current light * @returns true if the information has been computed, false if it does not need to (no parenting) */ computeTransformedInformation(): boolean; /** * Gets the scene the light belongs to. * @returns The scene */ getScene(): Scene; /** * Callback defining a custom Projection Matrix Builder. * This can be used to override the default projection matrix computation. */ customProjectionMatrixBuilder: (viewMatrix: Matrix, renderList: Array, result: Matrix) => void; /** * Sets the shadow projection matrix in parameter to the generated projection matrix. * @param matrix The materix to updated with the projection information * @param viewMatrix The transform matrix of the light * @param renderList The list of mesh to render in the map * @returns The current light */ setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array): IShadowLight; /** * Gets the current depth scale used in ESM. * @returns The scale */ getDepthScale(): number; /** * Returns whether or not the shadow generation require a cube texture or a 2d texture. * @returns true if a cube texture needs to be use */ needCube(): boolean; /** * Detects if the projection matrix requires to be recomputed this frame. * @returns true if it requires to be recomputed otherwise, false. */ needProjectionMatrixCompute(): boolean; /** * Forces the shadow generator to recompute the projection matrix even if position and direction did not changed. */ forceProjectionMatrixCompute(): void; /** * Get the direction to use to render the shadow map. In case of cube texture, the face index can be passed. * @param faceIndex The index of the face we are computed the direction to generate shadow * @returns The set direction in 2d mode otherwise the direction to the cubemap face if needCube() is true */ getShadowDirection(faceIndex?: number): Vector3; /** * Gets the minZ used for shadow according to both the scene and the light. * @param activeCamera The camera we are returning the min for * @returns the depth min z */ getDepthMinZ(activeCamera: Camera): number; /** * Gets the maxZ used for shadow according to both the scene and the light. * @param activeCamera The camera we are returning the max for * @returns the depth max z */ getDepthMaxZ(activeCamera: Camera): number; } /** * Base implementation IShadowLight * It groups all the common behaviour in order to reduce dupplication and better follow the DRY pattern. */ export abstract class ShadowLight extends Light implements IShadowLight { protected abstract _setDefaultShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array): void; protected _position: Vector3; protected _setPosition(value: Vector3): void; /** * Sets the position the shadow will be casted from. Also use as the light position for both * point and spot lights. */ /** * Sets the position the shadow will be casted from. Also use as the light position for both * point and spot lights. */ position: Vector3; protected _direction: Vector3; protected _setDirection(value: Vector3): void; /** * In 2d mode (needCube being false), gets the direction used to cast the shadow. * Also use as the light direction on spot and directional lights. */ /** * In 2d mode (needCube being false), sets the direction used to cast the shadow. * Also use as the light direction on spot and directional lights. */ direction: Vector3; private _shadowMinZ; /** * Gets the shadow projection clipping minimum z value. */ /** * Sets the shadow projection clipping minimum z value. */ shadowMinZ: number; private _shadowMaxZ; /** * Sets the shadow projection clipping maximum z value. */ /** * Gets the shadow projection clipping maximum z value. */ shadowMaxZ: number; /** * Callback defining a custom Projection Matrix Builder. * This can be used to override the default projection matrix computation. */ customProjectionMatrixBuilder: (viewMatrix: Matrix, renderList: Array, result: Matrix) => void; /** * The transformed position. Position of the light in world space taking parenting in account. */ transformedPosition: Vector3; /** * The transformed direction. Direction of the light in world space taking parenting in account. */ transformedDirection: Vector3; private _needProjectionMatrixCompute; /** * Computes the transformed information (transformedPosition and transformedDirection in World space) of the current light * @returns true if the information has been computed, false if it does not need to (no parenting) */ computeTransformedInformation(): boolean; /** * Return the depth scale used for the shadow map. * @returns the depth scale. */ getDepthScale(): number; /** * Get the direction to use to render the shadow map. In case of cube texture, the face index can be passed. * @param faceIndex The index of the face we are computed the direction to generate shadow * @returns The set direction in 2d mode otherwise the direction to the cubemap face if needCube() is true */ getShadowDirection(faceIndex?: number): Vector3; /** * Returns the ShadowLight absolute position in the World. * @returns the position vector in world space */ getAbsolutePosition(): Vector3; /** * Sets the ShadowLight direction toward the passed target. * @param target The point to target in local space * @returns the updated ShadowLight direction */ setDirectionToTarget(target: Vector3): Vector3; /** * Returns the light rotation in euler definition. * @returns the x y z rotation in local space. */ getRotation(): Vector3; /** * Returns whether or not the shadow generation require a cube texture or a 2d texture. * @returns true if a cube texture needs to be use */ needCube(): boolean; /** * Detects if the projection matrix requires to be recomputed this frame. * @returns true if it requires to be recomputed otherwise, false. */ needProjectionMatrixCompute(): boolean; /** * Forces the shadow generator to recompute the projection matrix even if position and direction did not changed. */ forceProjectionMatrixCompute(): void; /** @hidden */ _initCache(): void; /** @hidden */ _isSynchronized(): boolean; /** * Computes the world matrix of the node * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch * @returns the world matrix */ computeWorldMatrix(force?: boolean): Matrix; /** * Gets the minZ used for shadow according to both the scene and the light. * @param activeCamera The camera we are returning the min for * @returns the depth min z */ getDepthMinZ(activeCamera: Camera): number; /** * Gets the maxZ used for shadow according to both the scene and the light. * @param activeCamera The camera we are returning the max for * @returns the depth max z */ getDepthMaxZ(activeCamera: Camera): number; /** * Sets the shadow projection matrix in parameter to the generated projection matrix. * @param matrix The materix to updated with the projection information * @param viewMatrix The transform matrix of the light * @param renderList The list of mesh to render in the map * @returns The current light */ setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array): IShadowLight; } } declare module "babylonjs/Materials/materialHelper" { import { Nullable } from "babylonjs/types"; import { Scene } from "babylonjs/scene"; import { Engine } from "babylonjs/Engines/engine"; import { AbstractMesh } from "babylonjs/Meshes/abstractMesh"; import { Light } from "babylonjs/Lights/light"; import { UniformBuffer } from "babylonjs/Materials/uniformBuffer"; import { Effect, EffectFallbacks, EffectCreationOptions } from "babylonjs/Materials/effect"; import { BaseTexture } from "babylonjs/Materials/Textures/baseTexture"; import { MaterialDefines } from "babylonjs/Materials/materialDefines"; /** * "Static Class" containing the most commonly used helper while dealing with material for * rendering purpose. * * It contains the basic tools to help defining defines, binding uniform for the common part of the materials. * * This works by convention in BabylonJS but is meant to be use only with shader following the in place naming rules and conventions. */ export class MaterialHelper { /** * Bind the current view position to an effect. * @param effect The effect to be bound * @param scene The scene the eyes position is used from */ static BindEyePosition(effect: Effect, scene: Scene): void; /** * Helps preparing the defines values about the UVs in used in the effect. * UVs are shared as much as we can accross channels in the shaders. * @param texture The texture we are preparing the UVs for * @param defines The defines to update * @param key The channel key "diffuse", "specular"... used in the shader */ static PrepareDefinesForMergedUV(texture: BaseTexture, defines: any, key: string): void; /** * Binds a texture matrix value to its corrsponding uniform * @param texture The texture to bind the matrix for * @param uniformBuffer The uniform buffer receivin the data * @param key The channel key "diffuse", "specular"... used in the shader */ static BindTextureMatrix(texture: BaseTexture, uniformBuffer: UniformBuffer, key: string): void; /** * Gets the current status of the fog (should it be enabled?) * @param mesh defines the mesh to evaluate for fog support * @param scene defines the hosting scene * @returns true if fog must be enabled */ static GetFogState(mesh: AbstractMesh, scene: Scene): boolean; /** * Helper used to prepare the list of defines associated with misc. values for shader compilation * @param mesh defines the current mesh * @param scene defines the current scene * @param useLogarithmicDepth defines if logarithmic depth has to be turned on * @param pointsCloud defines if point cloud rendering has to be turned on * @param fogEnabled defines if fog has to be turned on * @param alphaTest defines if alpha testing has to be turned on * @param defines defines the current list of defines */ static PrepareDefinesForMisc(mesh: AbstractMesh, scene: Scene, useLogarithmicDepth: boolean, pointsCloud: boolean, fogEnabled: boolean, alphaTest: boolean, defines: any): void; /** * Helper used to prepare the list of defines associated with frame values for shader compilation * @param scene defines the current scene * @param engine defines the current engine * @param defines specifies the list of active defines * @param useInstances defines if instances have to be turned on * @param useClipPlane defines if clip plane have to be turned on */ static PrepareDefinesForFrameBoundValues(scene: Scene, engine: Engine, defines: any, useInstances: boolean, useClipPlane?: Nullable): void; /** * Prepares the defines for bones * @param mesh The mesh containing the geometry data we will draw * @param defines The defines to update */ static PrepareDefinesForBones(mesh: AbstractMesh, defines: any): void; /** * Prepares the defines for morph targets * @param mesh The mesh containing the geometry data we will draw * @param defines The defines to update */ static PrepareDefinesForMorphTargets(mesh: AbstractMesh, defines: any): void; /** * Prepares the defines used in the shader depending on the attributes data available in the mesh * @param mesh The mesh containing the geometry data we will draw * @param defines The defines to update * @param useVertexColor Precise whether vertex colors should be used or not (override mesh info) * @param useBones Precise whether bones should be used or not (override mesh info) * @param useMorphTargets Precise whether morph targets should be used or not (override mesh info) * @param useVertexAlpha Precise whether vertex alpha should be used or not (override mesh info) * @returns false if defines are considered not dirty and have not been checked */ static PrepareDefinesForAttributes(mesh: AbstractMesh, defines: any, useVertexColor: boolean, useBones: boolean, useMorphTargets?: boolean, useVertexAlpha?: boolean): boolean; /** * Prepares the defines related to multiview * @param scene The scene we are intending to draw * @param defines The defines to update */ static PrepareDefinesForMultiview(scene: Scene, defines: any): void; /** * Prepares the defines related to the light information passed in parameter * @param scene The scene we are intending to draw * @param mesh The mesh the effect is compiling for * @param defines The defines to update * @param specularSupported Specifies whether specular is supported or not (override lights data) * @param maxSimultaneousLights Specfies how manuy lights can be added to the effect at max * @param disableLighting Specifies whether the lighting is disabled (override scene and light) * @returns true if normals will be required for the rest of the effect */ static PrepareDefinesForLights(scene: Scene, mesh: AbstractMesh, defines: any, specularSupported: boolean, maxSimultaneousLights?: number, disableLighting?: boolean): boolean; /** * Prepares the uniforms and samplers list to be used in the effect. This can automatically remove from the list uniforms * that won t be acctive due to defines being turned off. * @param uniformsListOrOptions The uniform names to prepare or an EffectCreationOptions containing the liist and extra information * @param samplersList The samplers list * @param defines The defines helping in the list generation * @param maxSimultaneousLights The maximum number of simultanous light allowed in the effect */ static PrepareUniformsAndSamplersList(uniformsListOrOptions: string[] | EffectCreationOptions, samplersList?: string[], defines?: any, maxSimultaneousLights?: number): void; /** * This helps decreasing rank by rank the shadow quality (0 being the highest rank and quality) * @param defines The defines to update while falling back * @param fallbacks The authorized effect fallbacks * @param maxSimultaneousLights The maximum number of lights allowed * @param rank the current rank of the Effect * @returns The newly affected rank */ static HandleFallbacksForShadows(defines: any, fallbacks: EffectFallbacks, maxSimultaneousLights?: number, rank?: number): number; /** * Prepares the list of attributes required for morph targets according to the effect defines. * @param attribs The current list of supported attribs * @param mesh The mesh to prepare the morph targets attributes for * @param defines The current Defines of the effect */ static PrepareAttributesForMorphTargets(attribs: string[], mesh: AbstractMesh, defines: any): void; /** * Prepares the list of attributes required for bones according to the effect defines. * @param attribs The current list of supported attribs * @param mesh The mesh to prepare the bones attributes for * @param defines The current Defines of the effect * @param fallbacks The current efffect fallback strategy */ static PrepareAttributesForBones(attribs: string[], mesh: AbstractMesh, defines: any, fallbacks: EffectFallbacks): void; /** * Check and prepare the list of attributes required for instances according to the effect defines. * @param attribs The current list of supported attribs * @param defines The current MaterialDefines of the effect */ static PrepareAttributesForInstances(attribs: string[], defines: MaterialDefines): void; /** * Add the list of attributes required for instances to the attribs array. * @param attribs The current list of supported attribs */ static PushAttributesForInstances(attribs: string[]): void; /** * Binds the light shadow information to the effect for the given mesh. * @param light The light containing the generator * @param scene The scene the lights belongs to * @param mesh The mesh we are binding the information to render * @param lightIndex The light index in the effect used to render the mesh * @param effect The effect we are binding the data to */ static BindLightShadow(light: Light, mesh: AbstractMesh, lightIndex: string, effect: Effect): void; /** * Binds the light information to the effect. * @param light The light containing the generator * @param effect The effect we are binding the data to * @param lightIndex The light index in the effect used to render */ static BindLightProperties(light: Light, effect: Effect, lightIndex: number): void; /** * Binds the lights information from the scene to the effect for the given mesh. * @param scene The scene the lights belongs to * @param mesh The mesh we are binding the information to render * @param effect The effect we are binding the data to * @param defines The generated defines for the effect * @param maxSimultaneousLights The maximum number of light that can be bound to the effect * @param usePhysicalLightFalloff Specifies whether the light falloff is defined physically or not */ static BindLights(scene: Scene, mesh: AbstractMesh, effect: Effect, defines: any, maxSimultaneousLights?: number, usePhysicalLightFalloff?: boolean): void; private static _tempFogColor; /** * Binds the fog information from the scene to the effect for the given mesh. * @param scene The scene the lights belongs to * @param mesh The mesh we are binding the information to render * @param effect The effect we are binding the data to * @param linearSpace Defines if the fog effect is applied in linear space */ static BindFogParameters(scene: Scene, mesh: AbstractMesh, effect: Effect, linearSpace?: boolean): void; /** * Binds the bones information from the mesh to the effect. * @param mesh The mesh we are binding the information to render * @param effect The effect we are binding the data to */ static BindBonesParameters(mesh?: AbstractMesh, effect?: Effect): void; /** * Binds the morph targets information from the mesh to the effect. * @param abstractMesh The mesh we are binding the information to render * @param effect The effect we are binding the data to */ static BindMorphTargetParameters(abstractMesh: AbstractMesh, effect: Effect): void; /** * Binds the logarithmic depth information from the scene to the effect for the given defines. * @param defines The generated defines used in the effect * @param effect The effect we are binding the data to * @param scene The scene we are willing to render with logarithmic scale for */ static BindLogDepth(defines: any, effect: Effect, scene: Scene): void; /** * Binds the clip plane information from the scene to the effect. * @param scene The scene the clip plane information are extracted from * @param effect The effect we are binding the data to */ static BindClipPlane(effect: Effect, scene: Scene): void; } } declare module "babylonjs/Shaders/shadowMap.fragment" { /** @hidden */ export var shadowMapPixelShader: { name: string; shader: string; }; } declare module "babylonjs/Shaders/ShadersInclude/bonesDeclaration" { /** @hidden */ export var bonesDeclaration: { name: string; shader: string; }; } declare module "babylonjs/Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration" { /** @hidden */ export var morphTargetsVertexGlobalDeclaration: { name: string; shader: string; }; } declare module "babylonjs/Shaders/ShadersInclude/morphTargetsVertexDeclaration" { /** @hidden */ export var morphTargetsVertexDeclaration: { name: string; shader: string; }; } declare module "babylonjs/Shaders/ShadersInclude/instancesDeclaration" { /** @hidden */ export var instancesDeclaration: { name: string; shader: string; }; } declare module "babylonjs/Shaders/ShadersInclude/helperFunctions" { /** @hidden */ export var helperFunctions: { name: string; shader: string; }; } declare module "babylonjs/Shaders/ShadersInclude/morphTargetsVertex" { /** @hidden */ export var morphTargetsVertex: { name: string; shader: string; }; } declare module "babylonjs/Shaders/ShadersInclude/instancesVertex" { /** @hidden */ export var instancesVertex: { name: string; shader: string; }; } declare module "babylonjs/Shaders/ShadersInclude/bonesVertex" { /** @hidden */ export var bonesVertex: { name: string; shader: string; }; } declare module "babylonjs/Shaders/shadowMap.vertex" { import "babylonjs/Shaders/ShadersInclude/bonesDeclaration"; import "babylonjs/Shaders/ShadersInclude/morphTargetsVertexGlobalDeclaration"; import "babylonjs/Shaders/ShadersInclude/morphTargetsVertexDeclaration"; import "babylonjs/Shaders/ShadersInclude/instancesDeclaration"; import "babylonjs/Shaders/ShadersInclude/helperFunctions"; import "babylonjs/Shaders/ShadersInclude/morphTargetsVertex"; import "babylonjs/Shaders/ShadersInclude/instancesVertex"; import "babylonjs/Shaders/ShadersInclude/bonesVertex"; /** @hidden */ export var shadowMapVertexShader: { name: string; shader: string; }; } declare module "babylonjs/Shaders/depthBoxBlur.fragment" { /** @hidden */ export var depthBoxBlurPixelShader: { name: string; shader: string; }; } declare module "babylonjs/Lights/Shadows/shadowGenerator" { import { Nullable } from "babylonjs/types"; import { Scene } from "babylonjs/scene"; import { Matrix } from "babylonjs/Maths/math"; import { SubMesh } from "babylonjs/Meshes/subMesh"; import { AbstractMesh } from "babylonjs/Meshes/abstractMesh"; import { Mesh } from "babylonjs/Meshes/mesh"; import { IShadowLight } from "babylonjs/Lights/shadowLight"; import { MaterialDefines } from "babylonjs/Materials/materialDefines"; import { Effect } from "babylonjs/Materials/effect"; import { RenderTargetTexture } from "babylonjs/Materials/Textures/renderTargetTexture"; import "babylonjs/Shaders/shadowMap.fragment"; import "babylonjs/Shaders/shadowMap.vertex"; import "babylonjs/Shaders/depthBoxBlur.fragment"; import { Observable } from "babylonjs/Misc/observable"; /** * Defines the options associated with the creation of a custom shader for a shadow generator. */ export interface ICustomShaderOptions { /** * Gets or sets the custom shader name to use */ shaderName: string; /** * The list of attribute names used in the shader */ attributes?: string[]; /** * The list of unifrom names used in the shader */ uniforms?: string[]; /** * The list of sampler names used in the shader */ samplers?: string[]; /** * The list of defines used in the shader */ defines?: string[]; } /** * Interface to implement to create a shadow generator compatible with BJS. */ export interface IShadowGenerator { /** * Gets the main RTT containing the shadow map (usually storing depth from the light point of view). * @returns The render target texture if present otherwise, null */ getShadowMap(): Nullable; /** * Gets the RTT used during rendering (can be a blurred version of the shadow map or the shadow map itself). * @returns The render target texture if the shadow map is present otherwise, null */ getShadowMapForRendering(): Nullable; /** * Determine wheter the shadow generator is ready or not (mainly all effects and related post processes needs to be ready). * @param subMesh The submesh we want to render in the shadow map * @param useInstances Defines wether will draw in the map using instances * @returns true if ready otherwise, false */ isReady(subMesh: SubMesh, useInstances: boolean): boolean; /** * Prepare all the defines in a material relying on a shadow map at the specified light index. * @param defines Defines of the material we want to update * @param lightIndex Index of the light in the enabled light list of the material */ prepareDefines(defines: MaterialDefines, lightIndex: number): void; /** * Binds the shadow related information inside of an effect (information like near, far, darkness... * defined in the generator but impacting the effect). * It implies the unifroms available on the materials are the standard BJS ones. * @param lightIndex Index of the light in the enabled light list of the material owning the effect * @param effect The effect we are binfing the information for */ bindShadowLight(lightIndex: string, effect: Effect): void; /** * Gets the transformation matrix used to project the meshes into the map from the light point of view. * (eq to shadow prjection matrix * light transform matrix) * @returns The transform matrix used to create the shadow map */ getTransformMatrix(): Matrix; /** * Recreates the shadow map dependencies like RTT and post processes. This can be used during the switch between * Cube and 2D textures for instance. */ recreateShadowMap(): void; /** * Forces all the attached effect to compile to enable rendering only once ready vs. lazyly compiling effects. * @param onCompiled Callback triggered at the and of the effects compilation * @param options Sets of optional options forcing the compilation with different modes */ forceCompilation(onCompiled?: (generator: ShadowGenerator) => void, options?: Partial<{ useInstances: boolean; }>): void; /** * Forces all the attached effect to compile to enable rendering only once ready vs. lazyly compiling effects. * @param options Sets of optional options forcing the compilation with different modes * @returns A promise that resolves when the compilation completes */ forceCompilationAsync(options?: Partial<{ useInstances: boolean; }>): Promise; /** * Serializes the shadow generator setup to a json object. * @returns The serialized JSON object */ serialize(): any; /** * Disposes the Shadow map and related Textures and effects. */ dispose(): void; } /** * Default implementation IShadowGenerator. * This is the main object responsible of generating shadows in the framework. * Documentation: https://doc.babylonjs.com/babylon101/shadows */ export class ShadowGenerator implements IShadowGenerator { /** * Shadow generator mode None: no filtering applied. */ static readonly FILTER_NONE: number; /** * Shadow generator mode ESM: Exponential Shadow Mapping. * (http://developer.download.nvidia.com/presentations/2008/GDC/GDC08_SoftShadowMapping.pdf) */ static readonly FILTER_EXPONENTIALSHADOWMAP: number; /** * Shadow generator mode Poisson Sampling: Percentage Closer Filtering. * (Multiple Tap around evenly distributed around the pixel are used to evaluate the shadow strength) */ static readonly FILTER_POISSONSAMPLING: number; /** * Shadow generator mode ESM: Blurred Exponential Shadow Mapping. * (http://developer.download.nvidia.com/presentations/2008/GDC/GDC08_SoftShadowMapping.pdf) */ static readonly FILTER_BLUREXPONENTIALSHADOWMAP: number; /** * Shadow generator mode ESM: Exponential Shadow Mapping using the inverse of the exponential preventing * edge artifacts on steep falloff. * (http://developer.download.nvidia.com/presentations/2008/GDC/GDC08_SoftShadowMapping.pdf) */ static readonly FILTER_CLOSEEXPONENTIALSHADOWMAP: number; /** * Shadow generator mode ESM: Blurred Exponential Shadow Mapping using the inverse of the exponential preventing * edge artifacts on steep falloff. * (http://developer.download.nvidia.com/presentations/2008/GDC/GDC08_SoftShadowMapping.pdf) */ static readonly FILTER_BLURCLOSEEXPONENTIALSHADOWMAP: number; /** * Shadow generator mode PCF: Percentage Closer Filtering * benefits from Webgl 2 shadow samplers. Fallback to Poisson Sampling in Webgl 1 * (https://developer.nvidia.com/gpugems/GPUGems/gpugems_ch11.html) */ static readonly FILTER_PCF: number; /** * Shadow generator mode PCSS: Percentage Closering Soft Shadow. * benefits from Webgl 2 shadow samplers. Fallback to Poisson Sampling in Webgl 1 * Contact Hardening */ static readonly FILTER_PCSS: number; /** * Reserved for PCF and PCSS * Highest Quality. * * Execute PCF on a 5*5 kernel improving a lot the shadow aliasing artifacts. * * Execute PCSS with 32 taps blocker search and 64 taps PCF. */ static readonly QUALITY_HIGH: number; /** * Reserved for PCF and PCSS * Good tradeoff for quality/perf cross devices * * Execute PCF on a 3*3 kernel. * * Execute PCSS with 16 taps blocker search and 32 taps PCF. */ static readonly QUALITY_MEDIUM: number; /** * Reserved for PCF and PCSS * The lowest quality but the fastest. * * Execute PCF on a 1*1 kernel. * * Execute PCSS with 16 taps blocker search and 16 taps PCF. */ static readonly QUALITY_LOW: number; /** Gets or sets the custom shader name to use */ customShaderOptions: ICustomShaderOptions; /** * Observable triggered before the shadow is rendered. Can be used to update internal effect state */ onBeforeShadowMapRenderObservable: Observable; /** * Observable triggered after the shadow is rendered. Can be used to restore internal effect state */ onAfterShadowMapRenderObservable: Observable; /** * Observable triggered before a mesh is rendered in the shadow map. * Can be used to update internal effect state (that you can get from the onBeforeShadowMapRenderObservable) */ onBeforeShadowMapRenderMeshObservable: Observable; /** * Observable triggered after a mesh is rendered in the shadow map. * Can be used to update internal effect state (that you can get from the onAfterShadowMapRenderObservable) */ onAfterShadowMapRenderMeshObservable: Observable; private _bias; /** * Gets the bias: offset applied on the depth preventing acnea (in light direction). */ /** * Sets the bias: offset applied on the depth preventing acnea (in light direction). */ bias: number; private _normalBias; /** * Gets the normalBias: offset applied on the depth preventing acnea (along side the normal direction and proportinal to the light/normal angle). */ /** * Sets the normalBias: offset applied on the depth preventing acnea (along side the normal direction and proportinal to the light/normal angle). */ normalBias: number; private _blurBoxOffset; /** * Gets the blur box offset: offset applied during the blur pass. * Only useful if useKernelBlur = false */ /** * Sets the blur box offset: offset applied during the blur pass. * Only useful if useKernelBlur = false */ blurBoxOffset: number; private _blurScale; /** * Gets the blur scale: scale of the blurred texture compared to the main shadow map. * 2 means half of the size. */ /** * Sets the blur scale: scale of the blurred texture compared to the main shadow map. * 2 means half of the size. */ blurScale: number; private _blurKernel; /** * Gets the blur kernel: kernel size of the blur pass. * Only useful if useKernelBlur = true */ /** * Sets the blur kernel: kernel size of the blur pass. * Only useful if useKernelBlur = true */ blurKernel: number; private _useKernelBlur; /** * Gets whether the blur pass is a kernel blur (if true) or box blur. * Only useful in filtered mode (useBlurExponentialShadowMap...) */ /** * Sets whether the blur pass is a kernel blur (if true) or box blur. * Only useful in filtered mode (useBlurExponentialShadowMap...) */ useKernelBlur: boolean; private _depthScale; /** * Gets the depth scale used in ESM mode. */ /** * Sets the depth scale used in ESM mode. * This can override the scale stored on the light. */ depthScale: number; private _filter; /** * Gets the current mode of the shadow generator (normal, PCF, ESM...). * The returned value is a number equal to one of the available mode defined in ShadowMap.FILTER_x like _FILTER_NONE */ /** * Sets the current mode of the shadow generator (normal, PCF, ESM...). * The returned value is a number equal to one of the available mode defined in ShadowMap.FILTER_x like _FILTER_NONE */ filter: number; /** * Gets if the current filter is set to Poisson Sampling. */ /** * Sets the current filter to Poisson Sampling. */ usePoissonSampling: boolean; /** * Gets if the current filter is set to ESM. */ /** * Sets the current filter is to ESM. */ useExponentialShadowMap: boolean; /** * Gets if the current filter is set to filtered ESM. */ /** * Gets if the current filter is set to filtered ESM. */ useBlurExponentialShadowMap: boolean; /** * Gets if the current filter is set to "close ESM" (using the inverse of the * exponential to prevent steep falloff artifacts). */ /** * Sets the current filter to "close ESM" (using the inverse of the * exponential to prevent steep falloff artifacts). */ useCloseExponentialShadowMap: boolean; /** * Gets if the current filter is set to filtered "close ESM" (using the inverse of the * exponential to prevent steep falloff artifacts). */ /** * Sets the current filter to filtered "close ESM" (using the inverse of the * exponential to prevent steep falloff artifacts). */ useBlurCloseExponentialShadowMap: boolean; /** * Gets if the current filter is set to "PCF" (percentage closer filtering). */ /** * Sets the current filter to "PCF" (percentage closer filtering). */ usePercentageCloserFiltering: boolean; private _filteringQuality; /** * Gets the PCF or PCSS Quality. * Only valid if usePercentageCloserFiltering or usePercentageCloserFiltering is true. */ /** * Sets the PCF or PCSS Quality. * Only valid if usePercentageCloserFiltering or usePercentageCloserFiltering is true. */ filteringQuality: number; /** * Gets if the current filter is set to "PCSS" (contact hardening). */ /** * Sets the current filter to "PCSS" (contact hardening). */ useContactHardeningShadow: boolean; private _contactHardeningLightSizeUVRatio; /** * Gets the Light Size (in shadow map uv unit) used in PCSS to determine the blocker search area and the penumbra size. * Using a ratio helps keeping shape stability independently of the map size. * * It does not account for the light projection as it was having too much * instability during the light setup or during light position changes. * * Only valid if useContactHardeningShadow is true. */ /** * Sets the Light Size (in shadow map uv unit) used in PCSS to determine the blocker search area and the penumbra size. * Using a ratio helps keeping shape stability independently of the map size. * * It does not account for the light projection as it was having too much * instability during the light setup or during light position changes. * * Only valid if useContactHardeningShadow is true. */ contactHardeningLightSizeUVRatio: number; private _darkness; /** Gets or sets the actual darkness of a shadow */ darkness: number; /** * Returns the darkness value (float). This can only decrease the actual darkness of a shadow. * 0 means strongest and 1 would means no shadow. * @returns the darkness. */ getDarkness(): number; /** * Sets the darkness value (float). This can only decrease the actual darkness of a shadow. * @param darkness The darkness value 0 means strongest and 1 would means no shadow. * @returns the shadow generator allowing fluent coding. */ setDarkness(darkness: number): ShadowGenerator; private _transparencyShadow; /** Gets or sets the ability to have transparent shadow */ transparencyShadow: boolean; /** * Sets the ability to have transparent shadow (boolean). * @param transparent True if transparent else False * @returns the shadow generator allowing fluent coding */ setTransparencyShadow(transparent: boolean): ShadowGenerator; private _shadowMap; private _shadowMap2; /** * Gets the main RTT containing the shadow map (usually storing depth from the light point of view). * @returns The render target texture if present otherwise, null */ getShadowMap(): Nullable; /** * Gets the RTT used during rendering (can be a blurred version of the shadow map or the shadow map itself). * @returns The render target texture if the shadow map is present otherwise, null */ getShadowMapForRendering(): Nullable; /** * Gets the class name of that object * @returns "ShadowGenerator" */ getClassName(): string; /** * Helper function to add a mesh and its descendants to the list of shadow casters. * @param mesh Mesh to add * @param includeDescendants boolean indicating if the descendants should be added. Default to true * @returns the Shadow Generator itself */ addShadowCaster(mesh: AbstractMesh, includeDescendants?: boolean): ShadowGenerator; /** * Helper function to remove a mesh and its descendants from the list of shadow casters * @param mesh Mesh to remove * @param includeDescendants boolean indicating if the descendants should be removed. Default to true * @returns the Shadow Generator itself */ removeShadowCaster(mesh: AbstractMesh, includeDescendants?: boolean): ShadowGenerator; /** * Controls the extent to which the shadows fade out at the edge of the frustum * Used only by directionals and spots */ frustumEdgeFalloff: number; private _light; /** * Returns the associated light object. * @returns the light generating the shadow */ getLight(): IShadowLight; /** * If true the shadow map is generated by rendering the back face of the mesh instead of the front face. * This can help with self-shadowing as the geometry making up the back of objects is slightly offset. * It might on the other hand introduce peter panning. */ forceBackFacesOnly: boolean; private _scene; private _lightDirection; private _effect; private _viewMatrix; private _projectionMatrix; private _transformMatrix; private _cachedPosition; private _cachedDirection; private _cachedDefines; private _currentRenderID; private _boxBlurPostprocess; private _kernelBlurXPostprocess; private _kernelBlurYPostprocess; private _blurPostProcesses; private _mapSize; private _currentFaceIndex; private _currentFaceIndexCache; private _textureType; private _defaultTextureMatrix; /** @hidden */ static _SceneComponentInitialization: (scene: Scene) => void; /** * Creates a ShadowGenerator object. * A ShadowGenerator is the required tool to use the shadows. * Each light casting shadows needs to use its own ShadowGenerator. * Documentation : https://doc.babylonjs.com/babylon101/shadows * @param mapSize The size of the texture what stores the shadows. Example : 1024. * @param light The light object generating the shadows. * @param usefulFloatFirst By default the generator will try to use half float textures but if you need precision (for self shadowing for instance), you can use this option to enforce full float texture. */ constructor(mapSize: number, light: IShadowLight, usefulFloatFirst?: boolean); private _initializeGenerator; private _initializeShadowMap; private _initializeBlurRTTAndPostProcesses; private _renderForShadowMap; private _renderSubMeshForShadowMap; private _applyFilterValues; /** * Forces all the attached effect to compile to enable rendering only once ready vs. lazyly compiling effects. * @param onCompiled Callback triggered at the and of the effects compilation * @param options Sets of optional options forcing the compilation with different modes */ forceCompilation(onCompiled?: (generator: ShadowGenerator) => void, options?: Partial<{ useInstances: boolean; }>): void; /** * Forces all the attached effect to compile to enable rendering only once ready vs. lazyly compiling effects. * @param options Sets of optional options forcing the compilation with different modes * @returns A promise that resolves when the compilation completes */ forceCompilationAsync(options?: Partial<{ useInstances: boolean; }>): Promise; /** * Determine wheter the shadow generator is ready or not (mainly all effects and related post processes needs to be ready). * @param subMesh The submesh we want to render in the shadow map * @param useInstances Defines wether will draw in the map using instances * @returns true if ready otherwise, false */ isReady(subMesh: SubMesh, useInstances: boolean): boolean; /** * Prepare all the defines in a material relying on a shadow map at the specified light index. * @param defines Defines of the material we want to update * @param lightIndex Index of the light in the enabled light list of the material */ prepareDefines(defines: any, lightIndex: number): void; /** * Binds the shadow related information inside of an effect (information like near, far, darkness... * defined in the generator but impacting the effect). * @param lightIndex Index of the light in the enabled light list of the material owning the effect * @param effect The effect we are binfing the information for */ bindShadowLight(lightIndex: string, effect: Effect): void; /** * Gets the transformation matrix used to project the meshes into the map from the light point of view. * (eq to shadow prjection matrix * light transform matrix) * @returns The transform matrix used to create the shadow map */ getTransformMatrix(): Matrix; /** * Recreates the shadow map dependencies like RTT and post processes. This can be used during the switch between * Cube and 2D textures for instance. */ recreateShadowMap(): void; private _disposeBlurPostProcesses; private _disposeRTTandPostProcesses; /** * Disposes the ShadowGenerator. * Returns nothing. */ dispose(): void; /** * Serializes the shadow generator setup to a json object. * @returns The serialized JSON object */ serialize(): any; /** * Parses a serialized ShadowGenerator and returns a new ShadowGenerator. * @param parsedShadowGenerator The JSON object to parse * @param scene The scene to create the shadow map for * @returns The parsed shadow generator */ static Parse(parsedShadowGenerator: any, scene: Scene): ShadowGenerator; } } declare module "babylonjs/Lights/light" { import { Nullable } from "babylonjs/types"; import { Scene } from "babylonjs/scene"; import { Vector3, Color3 } from "babylonjs/Maths/math"; import { Node } from "babylonjs/node"; import { AbstractMesh } from "babylonjs/Meshes/abstractMesh"; import { Effect } from "babylonjs/Materials/effect"; import { UniformBuffer } from "babylonjs/Materials/uniformBuffer"; import { IShadowGenerator } from "babylonjs/Lights/Shadows/shadowGenerator"; /** * Base class of all the lights in Babylon. It groups all the generic information about lights. * Lights are used, as you would expect, to affect how meshes are seen, in terms of both illumination and colour. * All meshes allow light to pass through them unless shadow generation is activated. The default number of lights allowed is four but this can be increased. */ export abstract class Light extends Node { /** * Falloff Default: light is falling off following the material specification: * standard material is using standard falloff whereas pbr material can request special falloff per materials. */ static readonly FALLOFF_DEFAULT: number; /** * Falloff Physical: light is falling off following the inverse squared distance law. */ static readonly FALLOFF_PHYSICAL: number; /** * Falloff gltf: light is falling off as described in the gltf moving to PBR document * to enhance interoperability with other engines. */ static readonly FALLOFF_GLTF: number; /** * Falloff Standard: light is falling off like in the standard material * to enhance interoperability with other materials. */ static readonly FALLOFF_STANDARD: number; /** * If every light affecting the material is in this lightmapMode, * material.lightmapTexture adds or multiplies * (depends on material.useLightmapAsShadowmap) * after every other light calculations. */ static readonly LIGHTMAP_DEFAULT: number; /** * material.lightmapTexture as only diffuse lighting from this light * adds only specular lighting from this light * adds dynamic shadows */ static readonly LIGHTMAP_SPECULAR: number; /** * material.lightmapTexture as only lighting * no light calculation from this light * only adds dynamic shadows from this light */ static readonly LIGHTMAP_SHADOWSONLY: number; /** * Each light type uses the default quantity according to its type: * point/spot lights use luminous intensity * directional lights use illuminance */ static readonly INTENSITYMODE_AUTOMATIC: number; /** * lumen (lm) */ static readonly INTENSITYMODE_LUMINOUSPOWER: number; /** * candela (lm/sr) */ static readonly INTENSITYMODE_LUMINOUSINTENSITY: number; /** * lux (lm/m^2) */ static readonly INTENSITYMODE_ILLUMINANCE: number; /** * nit (cd/m^2) */ static readonly INTENSITYMODE_LUMINANCE: number; /** * Light type const id of the point light. */ static readonly LIGHTTYPEID_POINTLIGHT: number; /** * Light type const id of the directional light. */ static readonly LIGHTTYPEID_DIRECTIONALLIGHT: number; /** * Light type const id of the spot light. */ static readonly LIGHTTYPEID_SPOTLIGHT: number; /** * Light type const id of the hemispheric light. */ static readonly LIGHTTYPEID_HEMISPHERICLIGHT: number; /** * Diffuse gives the basic color to an object. */ diffuse: Color3; /** * Specular produces a highlight color on an object. * Note: This is note affecting PBR materials. */ specular: Color3; /** * Defines the falloff type for this light. This lets overrriding how punctual light are * falling off base on range or angle. * This can be set to any values in Light.FALLOFF_x. * * Note: This is only useful for PBR Materials at the moment. This could be extended if required to * other types of materials. */ falloffType: number; /** * Strength of the light. * Note: By default it is define in the framework own unit. * Note: In PBR materials the intensityMode can be use to chose what unit the intensity is defined in. */ intensity: number; private _range; protected _inverseSquaredRange: number; /** * Defines how far from the source the light is impacting in scene units. * Note: Unused in PBR material as the distance light falloff is defined following the inverse squared falloff. */ /** * Defines how far from the source the light is impacting in scene units. * Note: Unused in PBR material as the distance light falloff is defined following the inverse squared falloff. */ range: number; /** * Cached photometric scale default to 1.0 as the automatic intensity mode defaults to 1.0 for every type * of light. */ private _photometricScale; private _intensityMode; /** * Gets the photometric scale used to interpret the intensity. * This is only relevant with PBR Materials where the light intensity can be defined in a physical way. */ /** * Sets the photometric scale used to interpret the intensity. * This is only relevant with PBR Materials where the light intensity can be defined in a physical way. */ intensityMode: number; private _radius; /** * Gets the light radius used by PBR Materials to simulate soft area lights. */ /** * sets the light radius used by PBR Materials to simulate soft area lights. */ radius: number; private _renderPriority; /** * Defines the rendering priority of the lights. It can help in case of fallback or number of lights * exceeding the number allowed of the materials. */ renderPriority: number; private _shadowEnabled; /** * Gets wether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching * the current shadow generator. */ /** * Sets wether or not the shadows are enabled for this light. This can help turning off/on shadow without detaching * the current shadow generator. */ shadowEnabled: boolean; private _includedOnlyMeshes; /** * Gets the only meshes impacted by this light. */ /** * Sets the only meshes impacted by this light. */ includedOnlyMeshes: AbstractMesh[]; private _excludedMeshes; /** * Gets the meshes not impacted by this light. */ /** * Sets the meshes not impacted by this light. */ excludedMeshes: AbstractMesh[]; private _excludeWithLayerMask; /** * Gets the layer id use to find what meshes are not impacted by the light. * Inactive if 0 */ /** * Sets the layer id use to find what meshes are not impacted by the light. * Inactive if 0 */ excludeWithLayerMask: number; private _includeOnlyWithLayerMask; /** * Gets the layer id use to find what meshes are impacted by the light. * Inactive if 0 */ /** * Sets the layer id use to find what meshes are impacted by the light. * Inactive if 0 */ includeOnlyWithLayerMask: number; private _lightmapMode; /** * Gets the lightmap mode of this light (should be one of the constants defined by Light.LIGHTMAP_x) */ /** * Sets the lightmap mode of this light (should be one of the constants defined by Light.LIGHTMAP_x) */ lightmapMode: number; /** * Shadow generator associted to the light. * @hidden Internal use only. */ _shadowGenerator: Nullable; /** * @hidden Internal use only. */ _excludedMeshesIds: string[]; /** * @hidden Internal use only. */ _includedOnlyMeshesIds: string[]; /** * The current light unifom buffer. * @hidden Internal use only. */ _uniformBuffer: UniformBuffer; /** * Creates a Light object in the scene. * Documentation : https://doc.babylonjs.com/babylon101/lights * @param name The firendly name of the light * @param scene The scene the light belongs too */ constructor(name: string, scene: Scene); protected abstract _buildUniformLayout(): void; /** * Sets the passed Effect "effect" with the Light information. * @param effect The effect to update * @param lightIndex The index of the light in the effect to update * @returns The light */ abstract transferToEffect(effect: Effect, lightIndex: string): Light; /** * Returns the string "Light". * @returns the class name */ getClassName(): string; /** @hidden */ readonly _isLight: boolean; /** * Converts the light information to a readable string for debug purpose. * @param fullDetails Supports for multiple levels of logging within scene loading * @returns the human readable light info */ toString(fullDetails?: boolean): string; /** @hidden */ protected _syncParentEnabledState(): void; /** * Set the enabled state of this node. * @param value - the new enabled state */ setEnabled(value: boolean): void; /** * Returns the Light associated shadow generator if any. * @return the associated shadow generator. */ getShadowGenerator(): Nullable; /** * Returns a Vector3, the absolute light position in the World. * @returns the world space position of the light */ getAbsolutePosition(): Vector3; /** * Specifies if the light will affect the passed mesh. * @param mesh The mesh to test against the light * @return true the mesh is affected otherwise, false. */ canAffectMesh(mesh: AbstractMesh): boolean; /** * Sort function to order lights for rendering. * @param a First Light object to compare to second. * @param b Second Light object to compare first. * @return -1 to reduce's a's index relative to be, 0 for no change, 1 to increase a's index relative to b. */ static CompareLightsPriority(a: Light, b: Light): number; /** * Releases resources associated with this node. * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default) * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default) */ dispose(doNotRecurse?: boolean, disposeMaterialAndTextures?: boolean): void; /** * Returns the light type ID (integer). * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x */ getTypeID(): number; /** * Returns the intensity scaled by the Photometric Scale according to the light type and intensity mode. * @returns the scaled intensity in intensity mode unit */ getScaledIntensity(): number; /** * Returns a new Light object, named "name", from the current one. * @param name The name of the cloned light * @returns the new created light */ clone(name: string): Nullable; /** * Serializes the current light into a Serialization object. * @returns the serialized object. */ serialize(): any; /** * Creates a new typed light from the passed type (integer) : point light = 0, directional light = 1, spot light = 2, hemispheric light = 3. * This new light is named "name" and added to the passed scene. * @param type Type according to the types available in Light.LIGHTTYPEID_x * @param name The friendly name of the light * @param scene The scene the new light will belong to * @returns the constructor function */ static GetConstructorFromName(type: number, name: string, scene: Scene): Nullable<() => Light>; /** * Parses the passed "parsedLight" and returns a new instanced Light from this parsing. * @param parsedLight The JSON representation of the light * @param scene The scene to create the parsed light in * @returns the created light after parsing */ static Parse(parsedLight: any, scene: Scene): Nullable; private _hookArrayForExcluded; private _hookArrayForIncludedOnly; private _resyncMeshes; /** * Forces the meshes to update their light related information in their rendering used effects * @hidden Internal Use Only */ _markMeshesAsLightDirty(): void; /** * Recomputes the cached photometric scale if needed. */ private _computePhotometricScale; /** * Returns the Photometric Scale according to the light type and intensity mode. */ private _getPhotometricScale; /** * Reorder the light in the scene according to their defined priority. * @hidden Internal Use Only */ _reorderLightsInScene(): void; /** * Prepares the list of defines specific to the light type. * @param defines the list of defines * @param lightIndex defines the index of the light for the effect */ abstract prepareLightSpecificDefines(defines: any, lightIndex: number): void; } } declare module "babylonjs/Meshes/instancedMesh" { import { Nullable, FloatArray, IndicesArray } from "babylonjs/types"; import { Vector3, Matrix } from "babylonjs/Maths/math"; import { Camera } from "babylonjs/Cameras/camera"; import { Node } from "babylonjs/node"; import { AbstractMesh } from "babylonjs/Meshes/abstractMesh"; import { Mesh } from "babylonjs/Meshes/mesh"; import { Material } from "babylonjs/Materials/material"; import { Skeleton } from "babylonjs/Bones/skeleton"; import { Light } from "babylonjs/Lights/light"; /** * Creates an instance based on a source mesh. */ export class InstancedMesh extends AbstractMesh { private _sourceMesh; private _currentLOD; /** @hidden */ _indexInSourceMeshInstanceArray: number; constructor(name: string, source: Mesh); /** * Returns the string "InstancedMesh". */ getClassName(): string; /** Gets the list of lights affecting that mesh */ readonly lightSources: Light[]; _resyncLightSources(): void; _resyncLighSource(light: Light): void; _removeLightSource(light: Light): void; /** * If the source mesh receives shadows */ readonly receiveShadows: boolean; /** * The material of the source mesh */ readonly material: Nullable; /** * Visibility of the source mesh */ readonly visibility: number; /** * Skeleton of the source mesh */ readonly skeleton: Nullable; /** * Rendering ground id of the source mesh */ renderingGroupId: number; /** * Returns the total number of vertices (integer). */ getTotalVertices(): number; /** * Returns a positive integer : the total number of indices in this mesh geometry. * @returns the numner of indices or zero if the mesh has no geometry. */ getTotalIndices(): number; /** * The source mesh of the instance */ readonly sourceMesh: Mesh; /** * Is this node ready to be used/rendered * @param completeCheck defines if a complete check (including materials and lights) has to be done (false by default) * @return {boolean} is it ready */ isReady(completeCheck?: boolean): boolean; /** * Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices. * @param kind kind of verticies to retreive (eg. positons, normals, uvs, etc.) * @param copyWhenShared If true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one. * @returns a float array or a Float32Array of the requested kind of data : positons, normals, uvs, etc. */ getVerticesData(kind: string, copyWhenShared?: boolean): Nullable; /** * Sets the vertex data of the mesh geometry for the requested `kind`. * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data. * The `data` are either a numeric array either a Float32Array. * The parameter `updatable` is passed as is to the underlying Geometry object constructor (if initianilly none) or updater. * The parameter `stride` is an optional positive integer, it is usually automatically deducted from the `kind` (3 for positions or normals, 2 for UV, etc). * Note that a new underlying VertexBuffer object is created each call. * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed. * * Possible `kind` values : * - VertexBuffer.PositionKind * - VertexBuffer.UVKind * - VertexBuffer.UV2Kind * - VertexBuffer.UV3Kind * - VertexBuffer.UV4Kind * - VertexBuffer.UV5Kind * - VertexBuffer.UV6Kind * - VertexBuffer.ColorKind * - VertexBuffer.MatricesIndicesKind * - VertexBuffer.MatricesIndicesExtraKind * - VertexBuffer.MatricesWeightsKind * - VertexBuffer.MatricesWeightsExtraKind * * Returns the Mesh. */ setVerticesData(kind: string, data: FloatArray, updatable?: boolean, stride?: number): Mesh; /** * Updates the existing vertex data of the mesh geometry for the requested `kind`. * If the mesh has no geometry, it is simply returned as it is. * The `data` are either a numeric array either a Float32Array. * No new underlying VertexBuffer object is created. * If the `kind` is the `PositionKind` and if `updateExtends` is true, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed. * If the parameter `makeItUnique` is true, a new global geometry is created from this positions and is set to the mesh. * * Possible `kind` values : * - VertexBuffer.PositionKind * - VertexBuffer.UVKind * - VertexBuffer.UV2Kind * - VertexBuffer.UV3Kind * - VertexBuffer.UV4Kind * - VertexBuffer.UV5Kind * - VertexBuffer.UV6Kind * - VertexBuffer.ColorKind * - VertexBuffer.MatricesIndicesKind * - VertexBuffer.MatricesIndicesExtraKind * - VertexBuffer.MatricesWeightsKind * - VertexBuffer.MatricesWeightsExtraKind * * Returns the Mesh. */ updateVerticesData(kind: string, data: FloatArray, updateExtends?: boolean, makeItUnique?: boolean): Mesh; /** * Sets the mesh indices. * Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array). * If the mesh has no geometry, a new Geometry object is created and set to the mesh. * This method creates a new index buffer each call. * Returns the Mesh. */ setIndices(indices: IndicesArray, totalVertices?: Nullable): Mesh; /** * Boolean : True if the mesh owns the requested kind of data. */ isVerticesDataPresent(kind: string): boolean; /** * Returns an array of indices (IndicesArray). */ getIndices(): Nullable; readonly _positions: Nullable; /** * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked. * This means the mesh underlying bounding box and sphere are recomputed. * @param applySkeleton defines whether to apply the skeleton before computing the bounding info * @returns the current mesh */ refreshBoundingInfo(applySkeleton?: boolean): InstancedMesh; /** @hidden */ _preActivate(): InstancedMesh; /** @hidden */ _activate(renderId: number, intermediateRendering: boolean): boolean; /** @hidden */ _postActivate(): void; getWorldMatrix(): Matrix; readonly isAnInstance: boolean; /** * Returns the current associated LOD AbstractMesh. */ getLOD(camera: Camera): AbstractMesh; /** @hidden */ _syncSubMeshes(): InstancedMesh; /** @hidden */ _generatePointsArray(): boolean; /** * Creates a new InstancedMesh from the current mesh. * - name (string) : the cloned mesh name * - newParent (optional Node) : the optional Node to parent the clone to. * - doNotCloneChildren (optional boolean, default `false`) : if `true` the model children aren't cloned. * * Returns the clone. */ clone(name: string, newParent: Node, doNotCloneChildren?: boolean): InstancedMesh; /** * Disposes the InstancedMesh. * Returns nothing. */ dispose(doNotRecurse?: boolean, disposeMaterialAndTextures?: boolean): void; } } declare module "babylonjs/Materials/shaderMaterial" { import { Scene } from "babylonjs/scene"; import { Matrix, Vector3, Vector2, Color3, Color4, Vector4 } from "babylonjs/Maths/math"; import { AbstractMesh } from "babylonjs/Meshes/abstractMesh"; import { Mesh } from "babylonjs/Meshes/mesh"; import { BaseSubMesh } from "babylonjs/Meshes/subMesh"; import { BaseTexture } from "babylonjs/Materials/Textures/baseTexture"; import { Texture } from "babylonjs/Materials/Textures/texture"; import { Material } from "babylonjs/Materials/material"; /** * Defines the options associated with the creation of a shader material. */ export interface IShaderMaterialOptions { /** * Does the material work in alpha blend mode */ needAlphaBlending: boolean; /** * Does the material work in alpha test mode */ needAlphaTesting: boolean; /** * The list of attribute names used in the shader */ attributes: string[]; /** * The list of unifrom names used in the shader */ uniforms: string[]; /** * The list of UBO names used in the shader */ uniformBuffers: string[]; /** * The list of sampler names used in the shader */ samplers: string[]; /** * The list of defines used in the shader */ defines: string[]; } /** * The ShaderMaterial object has the necessary methods to pass data from your scene to the Vertex and Fragment Shaders and returns a material that can be applied to any mesh. * * This returned material effects how the mesh will look based on the code in the shaders. * * @see http://doc.babylonjs.com/how_to/shader_material */ export class ShaderMaterial extends Material { private _shaderPath; private _options; private _textures; private _textureArrays; private _floats; private _ints; private _floatsArrays; private _colors3; private _colors3Arrays; private _colors4; private _vectors2; private _vectors3; private _vectors4; private _matrices; private _matrices3x3; private _matrices2x2; private _vectors2Arrays; private _vectors3Arrays; private _cachedWorldViewMatrix; private _cachedWorldViewProjectionMatrix; private _renderId; /** * Instantiate a new shader material. * The ShaderMaterial object has the necessary methods to pass data from your scene to the Vertex and Fragment Shaders and returns a material that can be applied to any mesh. * This returned material effects how the mesh will look based on the code in the shaders. * @see http://doc.babylonjs.com/how_to/shader_material * @param name Define the name of the material in the scene * @param scene Define the scene the material belongs to * @param shaderPath Defines the route to the shader code in one of three ways: * - object - { vertex: "custom", fragment: "custom" }, used with Effect.ShadersStore["customVertexShader"] and Effect.ShadersStore["customFragmentShader"] * - object - { vertexElement: "vertexShaderCode", fragmentElement: "fragmentShaderCode" }, used with shader code in