Class: Sceneshot

Sceneshot()

Save and load the scene with this class. Addesses existing issues with babylon.js serialization: 1) technical: gltf serialization doesn't support transparency, json serialization fails with with js errors 2) generated json files may be huge 3) intelectual property violation - even with open source models, we must comply with the license So we take mixed approach to serialize everything - some custom and some babylon. Most important is not copying everything, use URL of the model whenever possible.

Constructor

new Sceneshot()

Source:

Methods

(async, static) loadFile(engine, file)

Load a world from a json file: fetch the file and call loadWorld
Parameters:
Name Type Default Description
engine babylon.js engine created elsewhere
file scene.json file name, defaults to scene.json
Source:

(async, static) loadString(engine, text)

Load a world from a json string: parse the string and call loadWorld
Parameters:
Name Type Description
engine babylon.js engine created elsewhere
text json source
Source:

(async, static) loadWorld(engine, worldInfo)

Load the world. Creates new World object, and the Scene then loads - sky box - ground - cameras - lights - shadow generator - scene meshes - button groups - logo room (that's only for avatar selection) - terrain - portals - general VRObjects (e.g. created by world editor) - humanoid avatars - mesh avatars - video avatars (without video obviously) - scripted objects So everything except HUD and forms. TODO: make loading these elements optional.
Parameters:
Name Type Description
engine babylon.js engine
worldInfo serialized world object
Source:

(async, static) saveHtml(world)

Serialize the world as json, generate html that creates the scene and loads json, and save the html file. Calls serializeWorld, then VRSPACEUI.saveFile.
Parameters:
Name Type Description
world World
Source:

(async, static) saveJson(world)

Serialize the world as json, and save the file. Calls serializeWorld, then VRSPACEUI.saveFile.
Parameters:
Name Type Description
world World
Source:

(async, static) serializeWorld()

Save the world: - all dynamically loaded assets - skybox - ground - camera(s) - light(s) - terrain - shadow generator - physics - portal(s) TODO: make loading these elements optional.
Source:
Returns:
world object