Tools

Tools

Description

class Tools

Members

static BaseUrl : string

static CorsBehavior : string

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 UseFallbackTexture : boolean

static RegisteredExternalClasses : { [key: string]: Object }

Use this object to register external classes like custom textures or material

to allow the laoders to instantiate them

static fallbackTexture : string

Methods

static Mix(a, b, alpha) number

Interpolates between a and b via alpha

@return The mixed value

Parameters

Name Type Description
a number The lower value (returned when alpha = 0)
b number The upper value (returned when alpha = 1)
alpha number The interpolation-factor

static Instantiate(className) any

Parameters

Name Type Description
className string

static SetImmediate(action) void

Parameters

Name Type Description
action

static IsExponentOfTwo(value) boolean

Parameters

Name Type Description
value number

static CeilingPOT(x) number

Find the next highest power of two.

@return Next highest power of two.

Parameters

Name Type Description
x number Number to start search from.

static FloorPOT(x) number

Find the next lowest power of two.

@return Next lowest power of two.

Parameters

Name Type Description
x number Number to start search from.

static NearestPOT(x) number

Find the nearest power of two.

@return Next nearest power of two.

Parameters

Name Type Description
x number Number to start search from.

static GetExponentOfTwo(value, max, mode) number

Parameters

Name Type Description
value number
max number
optional mode number

static GetFilename(path) string

Parameters

Name Type Description
path string

static GetFolderPath(uri) string

Parameters

Name Type Description
uri string

static GetDOMTextContent(element) string

Parameters

Name Type Description
element HTMLElement

static ToDegrees(angle) number

Parameters

Name Type Description
angle number

static ToRadians(angle) number

Parameters

Name Type Description
angle number

static EncodeArrayBufferTobase64(buffer) string

Parameters

Name Type Description
buffer ArrayBuffer

static ExtractMinAndMaxIndexed(positions, indices, indexStart, indexCount, bias) { minimum: Vector3, maximum: Vector3 }

Parameters

Name Type Description
positions FloatArray
indices IndicesArray
indexStart number
indexCount number

static ExtractMinAndMax(positions, start, count, bias, stride) { minimum: Vector3, maximum: Vector3 }

Parameters

Name Type Description
positions FloatArray
start number
count number
optional bias Nullable<Vector2>

static Vector2ArrayFeeder(array, : number) => Nullable<Vector2>

Parameters

Name Type Description
array Array<Vector2> or Float32Array

static ExtractMinAndMaxVector2(feeder, bias) { minimum: Vector2, maximum: Vector2 }

Parameters

Name Type Description
feeder index number

|

static MakeArray(obj, allowsNullUndefined) Nullable<Array<any>>

Parameters

Name Type Description
obj any
optional allowsNullUndefined boolean

static GetPointerPrefix() string

static QueueNewFrame(func, requester) number

Parameters

Name Type Description
func - the function to be called
optional requester any - the object that will request the next frame. Falls back to window.

static RequestFullscreen(element) void

Parameters

Name Type Description
element HTMLElement

static ExitFullscreen() void

static SetCorsBehavior(url, string, element) (url, string, element)

Parameters

Name Type Description
url string or string
element { crossOrigin: string }