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

assetLoader

reference to AssetLoader singleton
Source:

canAR

AR availability
Source:

canVR

VR availability
Source:

contentBase

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

debug

debug output enabled
Source:

fps

frames per second
Source:

guiManager

babylon GUI manager - multiple instances may cause issues with transparency
Source:

hud

Head-up display
Source:
vrspace.org logo mesh
Source:

logoFile

Logo file name, defaults to logo.glb
Source:

logoPath

Path to logo, null defaults to contentBase+/babylon (vrspace.org logo)
Source:

portal

portal mesh
Source:

portalFile

Portal file name, defaults to scene.gltf
Source:

portalPath

Path to logo, null defaults to contentBase+/babylon/portal
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)

Creates asset loader, preloads vrspace.org logo and portal for later use.
Parameters:
Name Type Description
scene babylon.js scene to operate with.
Source:

listCharacters(dir, callback)

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

listDirectory(dir, callback, suffix)

List files in a server folder
Parameters:
Name Type Description
dir directory to list
callback receives string array with urls
suffix optional suffix of listed files
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, receives ServerFolder list as argument
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:

logoDir()

Used in init, return logPath if exists, or default path to vrspace.org logo
Source:

optimizeScene()

Optimize the scene for better frame rate
Source:

portalDir()

Returns portalPath if exists, defaults to contentBase+/babylon/portal
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:

saveFile(filename, content)

Utility method to save a file with given name and file content.
Parameters:
Name Type Description
filename to save
content of the file, typically some JSON string
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 Quaternion
to Quaternion
Source:

updateQuaternionAnimationFromVec(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: