Tools

Hierarchy

  • Tools

Index

Properties

Static AllLogLevel

AllLogLevel: number

Static BaseUrl

BaseUrl: string

Static CorsBehavior

CorsBehavior: string | function

Default behaviour for cors in the application. It can be a string if the expected behavior is identical in the entire app. Or a callback to be able to set it per url or on a group of them (in case of Video source for instance)

Static DefaultRetryStrategy

DefaultRetryStrategy: function

Type declaration

    • (url: string, request: XMLHttpRequest, retryIndex: number): number
    • Parameters

      • url: string
      • request: XMLHttpRequest
      • retryIndex: number

      Returns number

Static EndPerformanceCounter

EndPerformanceCounter: function

Type declaration

    • (counterName: string, condition?: boolean): void
    • Parameters

      • counterName: string
      • Optional condition: boolean

      Returns void

Static Error

Error: function

Type declaration

    • (message: string): void
    • Parameters

      • message: string

      Returns void

Static ErrorLogLevel

ErrorLogLevel: number

Static Log

Log: function

Type declaration

    • (message: string): void
    • Parameters

      • message: string

      Returns void

Static LogCache

LogCache: string

Static LogLevels

LogLevels: number

Static MessageLogLevel

MessageLogLevel: number

Static NoneLogLevel

NoneLogLevel: number

Static Now

Now: number

Static OnNewCacheEntry

OnNewCacheEntry: function

Type declaration

    • (entry: string): void
    • Parameters

      • entry: string

      Returns void

Static PerformanceConsoleLogLevel

PerformanceConsoleLogLevel: number

Static PerformanceLogLevel

PerformanceLogLevel: number

Static PerformanceNoneLogLevel

PerformanceNoneLogLevel: number

Static PerformanceUserMarkLogLevel

PerformanceUserMarkLogLevel: number

Static PreprocessUrl

PreprocessUrl: function

Type declaration

    • (url: string): string
    • Parameters

      • url: string

      Returns string

Static RegisteredExternalClasses

RegisteredExternalClasses: object

Use this object to register external classes like custom textures or material to allow the laoders to instantiate them

Type declaration

  • [key: string]: Object

Static StartPerformanceCounter

StartPerformanceCounter: function

Type declaration

    • (counterName: string, condition?: boolean): void
    • Parameters

      • counterName: string
      • Optional condition: boolean

      Returns void

Static UseFallbackTexture

UseFallbackTexture: boolean

Static Warn

Warn: function

Type declaration

    • (message: string): void
    • Parameters

      • message: string

      Returns void

Static WarningLogLevel

WarningLogLevel: number

Static errorsCount

errorsCount: number

Static fallbackTexture

fallbackTexture: string

Methods

Static CeilingPOT

  • CeilingPOT(x: number): number
  • Find the next highest power of two.

    Parameters

    • x: number

      Number to start search from.

    Returns number

    Next highest power of two.

Static CheckExtends

Static CleanUrl

  • CleanUrl(url: string): string
  • Parameters

    • url: string

    Returns string

Static ClearLogCache

  • ClearLogCache(): void
  • Returns void

Static CreateScreenshot

  • CreateScreenshot(engine: Engine, camera: Camera, size: any, successCallback?: function, mimeType?: string): void
  • Parameters

    • engine: Engine
    • camera: Camera
    • size: any
    • Optional successCallback: function
        • (data: string): void
        • Parameters

          • data: string

          Returns void

    • Optional mimeType: string

    Returns void

Static CreateScreenshotUsingRenderTarget

  • CreateScreenshotUsingRenderTarget(engine: Engine, camera: Camera, size: any, successCallback?: function, mimeType?: string, samples?: number, antialiasing?: boolean, fileName?: string): void
  • Generates an image screenshot from the specified camera.

    constructor

    Parameters

    • engine: Engine

      The engine to use for rendering

    • camera: Camera

      The camera to use for rendering

    • size: any

      This parameter can be set to a single number or to an object with the following (optional) properties: precision, width, height. If a single number is passed, it will be used for both width and height. If an object is passed, the screenshot size will be derived from the parameters. The precision property is a multiplier allowing rendering at a higher or lower resolution.

    • Optional successCallback: function

      The callback receives a single parameter which contains the screenshot as a string of base64-encoded characters. This string can be assigned to the src parameter of an to display it.

        • (data: string): void
        • Parameters

          • data: string

          Returns void

    • Optional mimeType: string

      The MIME type of the screenshot image (default: image/png). Check your browser for supported MIME types.

    • Optional samples: number

      Texture samples (default: 1)

    • Optional antialiasing: boolean

      Whether antialiasing should be turned on or not (default: false)

    • Optional fileName: string

      A name for for the downloaded file.

    Returns void

Static DecodeBase64

  • DecodeBase64(uri: string): ArrayBuffer
  • Decode the given base64 uri.

    Parameters

    • uri: string

      The uri to decode

    Returns ArrayBuffer

    The decoded base64 data.

Static DeepCopy

  • DeepCopy(source: any, destination: any, doNotCopyList?: string[], mustCopyList?: string[]): void
  • Parameters

    • source: any
    • destination: any
    • Optional doNotCopyList: string[]
    • Optional mustCopyList: string[]

    Returns void

Static DelayAsync

  • DelayAsync(delay: number): Promise<void>
  • Returns a promise that resolves after the given amount of time.

    Parameters

    • delay: number

      Number of milliseconds to delay

    Returns Promise<void>

    Promise that resolves after the given amount of time

Static DumpFramebuffer

  • DumpFramebuffer(width: number, height: number, engine: Engine, successCallback?: function, mimeType?: string, fileName?: string): void
  • Parameters

    • width: number
    • height: number
    • engine: Engine
    • Optional successCallback: function
        • (data: string): void
        • Parameters

          • data: string

          Returns void

    • Optional mimeType: string
    • Optional fileName: string

    Returns void

Static EncodeArrayBufferTobase64

  • EncodeArrayBufferTobase64(buffer: ArrayBuffer): string
  • Parameters

    • buffer: ArrayBuffer

    Returns string

Static EncodeScreenshotCanvasData

  • EncodeScreenshotCanvasData(successCallback?: function, mimeType?: string, fileName?: string): void
  • Parameters

    • Optional successCallback: function
        • (data: string): void
        • Parameters

          • data: string

          Returns void

    • Optional mimeType: string
    • Optional fileName: string

    Returns void

Static ExitFullscreen

  • ExitFullscreen(): void
  • Returns void

Static ExtractMinAndMax

Static ExtractMinAndMaxIndexed

Static ExtractMinAndMaxVector2

  • ExtractMinAndMaxVector2(feeder: function, bias?: Nullable<Vector2>): object

Static FileAsURL

  • FileAsURL(content: string): string
  • Parameters

    • content: string

    Returns string

Static First

  • First<T>(array: Array<T>, predicate: function): Nullable<T>
  • Type parameters

    • T

    Parameters

    • array: Array<T>
    • predicate: function
        • (item: T): boolean
        • Parameters

          • item: T

          Returns boolean

    Returns Nullable<T>

Static FloatRound

  • FloatRound(value: number): number
  • Returns the nearest 32-bit single precision float representation of a Number

    Parameters

    • value: number

      A Number. If the parameter is of a different type, it will get converted to a number or to NaN if it cannot be converted

    Returns number

    number

Static FloorPOT

  • FloorPOT(x: number): number
  • Find the next lowest power of two.

    Parameters

    • x: number

      Number to start search from.

    Returns number

    Next lowest power of two.

Static Format

  • Format(value: number, decimals?: number): string
  • Parameters

    • value: number
    • Optional decimals: number

    Returns string

Static GetClassName

  • GetClassName(object: any, isType?: boolean): string
  • This method will return the name of the class used to create the instance of the given object. It will works only on Javascript basic data types (number, string, ...) and instance of class declared with the @className decorator.

    Parameters

    • object: any

      the object to get the class name from

    • Optional isType: boolean

    Returns string

    the name of the class, will be "object" for a custom data type not using the @className decorator

Static GetDOMTextContent

  • GetDOMTextContent(element: HTMLElement): string
  • Parameters

    • element: HTMLElement

    Returns string

Static GetExponentOfTwo

  • GetExponentOfTwo(value: number, max: number, mode?: number): number
  • Parameters

    • value: number
    • max: number
    • Optional mode: number

    Returns number

Static GetFilename

  • GetFilename(path: string): string
  • Parameters

    • path: string

    Returns string

Static GetFolderPath

  • GetFolderPath(uri: string, returnUnchangedIfNoSlash?: boolean): string
  • Extracts the "folder" part of a path (everything before the filename).

    Parameters

    • uri: string

      The URI to extract the info from

    • Optional returnUnchangedIfNoSlash: boolean

      Do not touch the URI if no slashes are present

    Returns string

    The "folder" part of the path

Static GetPointerPrefix

  • GetPointerPrefix(): string
  • Returns string

Static Instantiate

  • Instantiate(className: string): any
  • Parameters

    • className: string

    Returns any

Static IsBase64

  • IsBase64(uri: string): boolean
  • Test if the given uri is a base64 string.

    Parameters

    • uri: string

      The uri to test

    Returns boolean

    True if the uri is a base64 string or false otherwise.

Static IsEmpty

  • IsEmpty(obj: any): boolean
  • Parameters

    • obj: any

    Returns boolean

Static IsExponentOfTwo

  • IsExponentOfTwo(value: number): boolean
  • Parameters

    • value: number

    Returns boolean

Static IsWindowObjectExist

  • IsWindowObjectExist(): boolean
  • Returns boolean

Static LoadFile

  • LoadFile(url: string, onSuccess: function, onProgress?: function, database?: Database, useArrayBuffer?: boolean, onError?: function): IFileRequest
  • Parameters

    • url: string
    • onSuccess: function
        • (data: string | ArrayBuffer, responseURL?: string): void
        • Parameters

          • data: string | ArrayBuffer
          • Optional responseURL: string

          Returns void

    • Optional onProgress: function
        • (data: any): void
        • Parameters

          • data: any

          Returns void

    • Optional database: Database
    • Optional useArrayBuffer: boolean
    • Optional onError: function
        • (request?: XMLHttpRequest, exception?: any): void
        • Parameters

          • Optional request: XMLHttpRequest
          • Optional exception: any

          Returns void

    Returns IFileRequest

Static LoadImage

  • LoadImage(input: string | ArrayBuffer | Blob, onLoad: function, onError: function, database: Nullable<Database>): HTMLImageElement
  • Loads an image as an HTMLImageElement.

    Parameters

    • input: string | ArrayBuffer | Blob

      url string, ArrayBuffer, or Blob to load

    • onLoad: function

      callback called when the image successfully loads

        • (img: HTMLImageElement): void
        • Parameters

          • img: HTMLImageElement

          Returns void

    • onError: function

      callback called when the image fails to load

        • (message?: string, exception?: any): void
        • Parameters

          • Optional message: string
          • Optional exception: any

          Returns void

    • database: Nullable<Database>

      database for caching

    Returns HTMLImageElement

    the HTMLImageElement of the loaded image

Static LoadScript

  • LoadScript(scriptUrl: string, onSuccess: function, onError?: function): void
  • Load a script (identified by an url). When the url returns, the content of this file is added into a new script element, attached to the DOM (body element)

    Parameters

    • scriptUrl: string
    • onSuccess: function
        • (): void
        • Returns void

    • Optional onError: function
        • (message?: string, exception?: any): void
        • Parameters

          • Optional message: string
          • Optional exception: any

          Returns void

    Returns void

Static MakeArray

  • MakeArray(obj: any, allowsNullUndefined?: boolean): Nullable<Array<any>>
  • Parameters

    • obj: any
    • Optional allowsNullUndefined: boolean

    Returns Nullable<Array<any>>

Static Mix

  • Mix(a: number, b: number, alpha: number): number
  • Interpolates between a and b via alpha

    Parameters

    • a: number

      The lower value (returned when alpha = 0)

    • b: number

      The upper value (returned when alpha = 1)

    • alpha: number

      The interpolation-factor

    Returns number

    The mixed value

Static NearestPOT

  • NearestPOT(x: number): number
  • Find the nearest power of two.

    Parameters

    • x: number

      Number to start search from.

    Returns number

    Next nearest power of two.

Static QueueNewFrame

  • QueueNewFrame(func: function, requester?: any): number
  • Parameters

    • func: function

      the function to be called

        • (): void
        • Returns void

    • Optional requester: any

      the object that will request the next frame. Falls back to window.

    Returns number

Static RandomId

  • RandomId(): string

Static ReadFile

  • ReadFile(fileToLoad: File, callback: function, progressCallBack?: function, useArrayBuffer?: boolean): IFileRequest
  • Parameters

    • fileToLoad: File
    • callback: function
        • (data: any): void
        • Parameters

          • data: any

          Returns void

    • Optional progressCallBack: function
        • (ev: ProgressEvent): any
        • Parameters

          • ev: ProgressEvent

          Returns any

    • Optional useArrayBuffer: boolean

    Returns IFileRequest

Static ReadFileAsDataURL

  • ReadFileAsDataURL(fileToLoad: Blob, callback: function, progressCallback: function): IFileRequest
  • Parameters

    • fileToLoad: Blob
    • callback: function
        • (data: any): void
        • Parameters

          • data: any

          Returns void

    • progressCallback: function
        • (ev: ProgressEvent): any
        • Parameters

          • ev: ProgressEvent

          Returns any

    Returns IFileRequest

Static RegisterTopRootEvents

  • RegisterTopRootEvents(events: object[]): void
  • Parameters

    • events: object[]

    Returns void

Static RequestFullscreen

  • RequestFullscreen(element: HTMLElement): void
  • Parameters

    • element: HTMLElement

    Returns void

Static SetCorsBehavior

  • SetCorsBehavior(url: string | string[], element: object): void
  • Parameters

    • url: string | string[]
    • element: object
      • crossOrigin: string | null

    Returns void

Static SetImmediate

  • SetImmediate(action: function): void
  • Parameters

    • action: function
        • (): void
        • Returns void

    Returns void

Static Slice

  • Slice<T>(data: T, start?: number, end?: number): T
  • Provides a slice function that will work even on IE

    Type parameters

    • T

    Parameters

    • data: T

      defines the array to slice

    • Optional start: number

      defines the start of the data (optional)

    • Optional end: number

      defines the end of the data (optional)

    Returns T

    the new sliced array

Static ToDegrees

  • ToDegrees(angle: number): number
  • Parameters

    • angle: number

    Returns number

Static ToRadians

  • ToRadians(angle: number): number
  • Parameters

    • angle: number

    Returns number

Static UnregisterTopRootEvents

  • UnregisterTopRootEvents(events: object[]): void
  • Parameters

    • events: object[]

    Returns void

Static ValidateXHRData

  • ValidateXHRData(xhr: XMLHttpRequest, dataType?: number): boolean
  • Parameters

    • xhr: XMLHttpRequest
    • Optional dataType: number

    Returns boolean

Static Vector2ArrayFeeder

  • Vector2ArrayFeeder(array: Array<Vector2> | Float32Array): function

Static arrayOrStringFeeder

  • arrayOrStringFeeder(array: any): function
  • This method can be used with hashCodeFromStream when your input is an array of values that are either: number, string, boolean or custom type implementing the getHashCode():number method.

    Parameters

    • array: any

    Returns function

      • (i: number): number
      • Parameters

        • i: number

        Returns number

Static getFullClassName

  • getFullClassName(object: any, isType?: boolean): Nullable<string>
  • This method will return the name of the full name of the class, including its owning module (if any). It will works only on Javascript basic data types (number, string, ...) and instance of class declared with the @className decorator or implementing a method getClassName():string (in which case the module won't be specified).

    Parameters

    • object: any

      the object to get the class name from

    • Optional isType: boolean

    Returns Nullable<string>

    a string that can have two forms: "moduleName.className" if module was specified when the class' Name was registered or "className" if there was not module specified.

Static hashCodeFromStream

  • hashCodeFromStream(feeder: function): number
  • Compute the hashCode of a stream of number To compute the HashCode on a string or an Array of data types implementing the getHashCode() method, use the arrayOrStringFeeder method.

    Parameters

    • feeder: function

      a callback that will be called until it returns null, each valid returned values will be used to compute the hash code.

        • (index: number): number
        • Parameters

          • index: number

          Returns number

    Returns number

    the hash code computed

Generated using TypeDoc