|
@@ -491,210 +491,6 @@ declare module BABYLON {
|
|
|
}
|
|
|
declare module BABYLON {
|
|
|
/**
|
|
|
- * 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<number>;
|
|
|
- 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 BABYLON {
|
|
|
- /**
|
|
|
- * 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<T> {
|
|
|
- /**
|
|
|
- * 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<T>): 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<T>;
|
|
|
- /**
|
|
|
- * 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<TRes>(callback: (key: string, val: T) => TRes): TRes | null;
|
|
|
- private _count;
|
|
|
- private _data;
|
|
|
- }
|
|
|
-}
|
|
|
-declare module BABYLON {
|
|
|
- /**
|
|
|
* Class used to store gfx data (like WebGLBuffer)
|
|
|
*/
|
|
|
export class DataBuffer {
|
|
@@ -29033,6 +28829,47 @@ declare module BABYLON {
|
|
|
}
|
|
|
declare module BABYLON {
|
|
|
/**
|
|
|
+ * Interface for performance monitor tracks rolling average frame-time and frame-time variance over a user defined sliding-window
|
|
|
+ */
|
|
|
+ export interface IPerformanceMonitor {
|
|
|
+ /**
|
|
|
+ * 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;
|
|
|
+ /**
|
|
|
+ * 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)
|
|
|
+ */
|
|
|
+ averageFrameTime: number;
|
|
|
+ /**
|
|
|
+ * Returns the variance frame time in milliseconds over the sliding window (or the subset of frames sampled so far)
|
|
|
+ */
|
|
|
+ averageFrameTimeVariance: number;
|
|
|
+ /**
|
|
|
+ * Returns the frame time of the most recent frame
|
|
|
+ */
|
|
|
+ instantaneousFrameTime: number;
|
|
|
+ /**
|
|
|
+ * Returns the average framerate in frames per second over the sliding window (or the subset of frames sampled so far)
|
|
|
+ */
|
|
|
+ averageFPS: number;
|
|
|
+ /**
|
|
|
+ * Returns the average framerate in frames per second using the most recent frame time
|
|
|
+ */
|
|
|
+ instantaneousFPS: number;
|
|
|
+ }
|
|
|
+}
|
|
|
+declare module BABYLON {
|
|
|
+ /**
|
|
|
* Settings for finer control over video usage
|
|
|
*/
|
|
|
export interface VideoTextureSettings {
|
|
@@ -29380,195 +29217,12 @@ declare module BABYLON {
|
|
|
* @param predicate defines a predicate used to filter which materials should be affected
|
|
|
*/
|
|
|
static MarkAllMaterialsAsDirty(flag: number, predicate?: (mat: Material) => boolean): void;
|
|
|
- /** @hidden */
private static _TextureLoaders: IInternalTextureLoader[];
|
|
|
- /** 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
|
|
|
+ * Factory used to create the performance monitor
|
|
|
+ * @returns a new PerformanceMonitor
|
|
|
*/
|
|
|
- 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;
|
|
|
+ static DefaultPerformanceMonitorFactory(): IPerformanceMonitor;
|
|
|
+ /** @hidden */
private static _TextureLoaders: IInternalTextureLoader[];
|
|
|
/**
|
|
|
* Returns the current npm package of the sdk
|
|
|
*/
|
|
@@ -29764,18 +29418,18 @@ declare module BABYLON {
|
|
|
* @see http://doc.babylonjs.com/how_to/optimizing_your_scene#handling-webgl-context-lost
|
|
|
*/
|
|
|
doNotHandleContextLost: boolean;
|
|
|
- private _performanceMonitor;
|
|
|
private _fps;
|
|
|
private _deltaTime;
|
|
|
/**
|
|
|
* Turn this value on if you want to pause FPS computation when in background
|
|
|
*/
|
|
|
disablePerformanceMonitorInBackground: boolean;
|
|
|
+ private _performanceMonitor;
|
|
|
/**
|
|
|
* Gets the performance monitor attached to this engine
|
|
|
* @see http://doc.babylonjs.com/how_to/optimizing_your_scene#engineinstrumentation
|
|
|
*/
|
|
|
- readonly performanceMonitor: PerformanceMonitor;
|
|
|
+ readonly performanceMonitor: IPerformanceMonitor;
|
|
|
/**
|
|
|
* Gets or sets a boolean indicating that vertex array object must be disabled even if they are supported
|
|
|
*/
|
|
@@ -29826,7 +29480,6 @@ declare module BABYLON {
|
|
|
/** @hidden */
private _workingContext: Nullable<CanvasRenderingContext2D>;
|
|
|
private _rescalePostProcess;
|
|
|
private _dummyFramebuffer;
|
|
|
- private _externalData;
|
|
|
/** @hidden */
private _bindedRenderFunction: any;
|
|
|
private _vaoRecordInProgress;
|
|
|
private _mustWipeVertexAttributes;
|
|
@@ -30309,6 +29962,7 @@ declare module BABYLON {
|
|
|
* @returns the new WebGL static buffer
|
|
|
*/
|
|
|
createVertexBuffer(data: DataArray): DataBuffer;
|
|
|
+ private _createVertexBuffer;
|
|
|
/**
|
|
|
* Creates a dynamic vertex buffer
|
|
|
* @param data the data for the dynamic vertex buffer
|
|
@@ -31004,34 +30658,6 @@ declare module BABYLON {
|
|
|
*/
|
|
|
readPixels(x: number, y: number, width: number, height: number): Uint8Array;
|
|
|
/**
|
|
|
- * Add an externaly attached data from its key.
|
|
|
- * This method call will fail and return false, if such key already exists.
|
|
|
- * If you don't care and just want to get the data no matter what, use the more convenient getOrAddExternalDataWithFactory() method.
|
|
|
- * @param key the unique key that identifies the data
|
|
|
- * @param data the data object to associate to the key for this Engine instance
|
|
|
- * @return true if no such key were already present and the data was added successfully, false otherwise
|
|
|
- */
|
|
|
- addExternalData<T>(key: string, data: T): boolean;
|
|
|
- /**
|
|
|
- * Get an externaly attached data from its key
|
|
|
- * @param key the unique key that identifies the data
|
|
|
- * @return the associated data, if present (can be null), or undefined if not present
|
|
|
- */
|
|
|
- getExternalData<T>(key: string): T;
|
|
|
- /**
|
|
|
- * Get an externaly attached data from its key, create it using a factory if it's not already present
|
|
|
- * @param key the unique key that identifies the data
|
|
|
- * @param factory the factory that will be called to create the instance if and only if it doesn't exists
|
|
|
- * @return the associated data, can be null if the factory returned null.
|
|
|
- */
|
|
|
- getOrAddExternalDataWithFactory<T>(key: string, factory: (k: string) => T): T;
|
|
|
- /**
|
|
|
- * Remove an externaly attached data from the Engine instance
|
|
|
- * @param key the unique key that identifies the data
|
|
|
- * @return true if the data was successfully removed, false if it doesn't exist
|
|
|
- */
|
|
|
- removeExternalData(key: string): boolean;
|
|
|
- /**
|
|
|
* Unbind all vertex attributes from the webGL context
|
|
|
*/
|
|
|
unbindAllAttributes(): void;
|
|
@@ -31840,6 +31466,99 @@ declare module BABYLON {
|
|
|
}
|
|
|
}
|
|
|
declare module BABYLON {
|
|
|
+ /**
|
|
|
+ * 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<T> {
|
|
|
+ /**
|
|
|
+ * 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<T>): 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<T>;
|
|
|
+ /**
|
|
|
+ * 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<TRes>(callback: (key: string, val: T) => TRes): TRes | null;
|
|
|
+ private _count;
|
|
|
+ private _data;
|
|
|
+ }
|
|
|
+}
|
|
|
+declare module BABYLON {
|
|
|
/** @hidden */
|
|
|
export interface ICollisionCoordinator {
|
|
|
createCollider(): Collider;
|
|
@@ -43456,7 +43175,7 @@ declare module BABYLON {
|
|
|
setAlphaConstants(r: number, g: number, b: number, a: number): void;
|
|
|
/**
|
|
|
* Sets the current alpha mode
|
|
|
- * @param mode defines the mode to use (one of the BABYLON.Engine.ALPHA_XXX)
|
|
|
+ * @param mode defines the mode to use (one of the BABYLON.Constants.ALPHA_XXX)
|
|
|
* @param noDepthWriteChange defines if depth writing state should remains unchanged (false by default)
|
|
|
* @see http://doc.babylonjs.com/resources/transparency_and_how_meshes_are_rendered
|
|
|
*/
|
|
@@ -60816,6 +60535,117 @@ declare module BABYLON {
|
|
|
}
|
|
|
declare module BABYLON {
|
|
|
/**
|
|
|
+ * Performance monitor tracks rolling average frame-time and frame-time variance over a user defined sliding-window
|
|
|
+ */
|
|
|
+ export class PerformanceMonitor implements IPerformanceMonitor {
|
|
|
+ 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<number>;
|
|
|
+ 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 BABYLON {
|
|
|
+ /**
|
|
|
* Defines the root class used to create scene optimization to use with SceneOptimizer
|
|
|
* @description More details at http://doc.babylonjs.com/how_to/how_to_use_sceneoptimizer
|
|
|
*/
|