Class: VRSpaceUI

VRSpaceUI()

Main UI class, provides utility methods and basic UI elements.

Constructor

new VRSpaceUI()

Creates UI with default LoadProgressIndicator
Source:

Classes

VRSpaceUI

Members

contentBase

content base (prefix), default empty (same host)
Source:

debug

debug output enabled
Source:

fps

frames per second
Source:
vrspace.org logo mesh
Source:

portal

portal mesh
Source:

scene

babylon scene
Source:

scriptLoader

Script loader
Source:

VRSPACE

reference to VRSpace singleton
Source:

Methods

copyMesh(mesh, parent, replaceParent)

Utility method to instantiate if possible, or otherwise clone a mesh, including all children recursivelly.
Parameters:
Name Type Description
mesh to instantiate/clone
parent optional, copy will have this parent
replaceParent optional
Source:
Returns:
copied mesh

createAnimation(mesh, field, fps)

Utility method - create x,y,z animation of a mesh field.
Parameters:
Name Type Description
mesh to animate
field name of field to animate, e.g. "position" or "rotation"
fps frames per second, defaults to fps field value
Source:
Returns:
babylonjs AnimationGroup

createQuaternionAnimation(mesh, field, fps)

Utility method - create quaternion animation of a mesh field
Parameters:
Name Type Description
mesh to animate
field name of field to animate, e.g. "rotationQuaternion"
fps frames per second, defaults to fps field value
Source:
Returns:
babylonjs AnimationGroup

findRootNode()

Utility method - returns the top parent node in hierarchy
Source:

(async) init(scene)

Preloads vrspace.org logo and portal for later use
Parameters:
Name Type Description
scene
Source:

listCharacters(dir, callback)

list character folders and their fix files
Parameters:
Name Type Description
dir directory to list
callback to call
Source:

listFiles(theUrl, callback)

lists files on a server directory
Parameters:
Name Type Description
theUrl url to load from
callback to call load, passing it XMLHttpRequest
Source:

listMatchingFiles(dir, callback, suffix)

list server folders along with their matching files i.e. files with the same name, plus given suffix
Parameters:
Name Type Description
dir directory to list
callback to call
suffix of related file
Source:

listThumbnails(dir, callback)

list folders with their jpg thumbnails (files ending with .jpg)
Parameters:
Name Type Description
dir directory to list
callback to call
Source:

(async) loadPortal(scene)

loads the portal
Parameters:
Name Type Description
scene
Source:

loadProgressIndicator()

Pointer to function, defaults to this.loadProgressIndiciatorFactory
Source:

loadProgressIndicatorFactory(scene, camera)

Creates default LoadProgressIndicator bound to given camera, if one does not already exist.
Parameters:
Name Type Description
scene
camera
Source:
Returns:
load progress indicator

(async) loadScriptsToDocument(urls, parallel)

Utility method - load a script and append it to document head
Parameters:
Name Type Description
urls array containing URLs of scripts
parallel optionally load in parallel
Source:

log(something)

Logs to js console if debug is enabled
Parameters:
Name Type Description
something to log
Source:

optimizeScene()

Optimize the scene for better frame rate
Source:

receiveShadows(node, shadows)

Utility method, should a node and its children receive shadows.
Parameters:
Name Type Description
node a babylonjs node
shadows true ofr false
Source:

updateAnimation(group, from, to)

Utility method - update x,y,z animation of a mesh field. If the animation group is playing, it is stopped first. After the update, starts to play, not looping.
Parameters:
Name Type Description
group AnimationGroup to update
from Vector3
to Vector3
Source:

updateQuaternionAnimation(group, from, to)

Utility method - update quaternion animation of a mesh field around Y axis.
Parameters:
Name Type Description
group AnimationGroup to update
from Vector3
to Vector3
Source: