engine3d

engine2d manages all of the graphics rendered in 2D. It uses Babylonjs 4.1 for rendering. engine2d uses Babylonjs as a base and builds off of it to automatically interact with the rest of the engine, as well as adding custom functions for added features and ease of use for the already existing ones.

virtuosity.engine3d

Classes

Objects

Methods


Classes

Box*

A procedurally generated engine3d box

Sphere*

A procedurally generated engine3d sphere

Plane*

A procedurally generated engine3d plane

Mesh*

A procedurally generated engine3d plane

Light

engine3d point light source



Objects

load

load assets into engine3d cache

virtuosity.engine3d.load

add

add engine3d entities

virtuosity.engine3d.add

get

get engine2d entites

virtuosity.engine3d.get

performance

get statistics on the performance

virtuosity.engine3d.performance

update

update function

virtuosity.engine3d.update

render

render function

virtuosity.engine3d.render

ambientLight

control the ambient light of a scene

virtuosity.engine3d.ambientLight


Methods

newCanvas

creates a new engine 2d canvas

virtuosity.engine3d.newCanvas(name, config);


Parameter Type Description
name String unique name of the canvas
config Object options to configure the canvas

newCanvas > config

Properties to configure the canvas. All properties are optional.



Parameter Type Description Default
resolution Int height resolution of the canvas actual client screen resolution
defaultResolution Int sets the resolution for auto scaling. Common practise is to use the screen resolution used in development actual client screen resolution
antialias Boolean whether to use antialiasing true
shadowResolution Int resolution of the shadow map 4096
poll Int Polling rate of the update function. The update function will run this many times per second 64
vsync Boolean use vsync or not true
fpsBuffer Int sets the maximum samples used to calculate average FPS 1000
preload Function function to run when loading assets. Assets can be loaded and unloaded later if you want, but main assets should be loaded here.
create Function function to run while creating the scene
update Function update function which runs at a constant polling rate set by the poll property
render Function render function which runs as fast as possible and is tied to framerate

zIndex

get / set the zIndex of a canvas

virtuosity.engine3d.zIndex(canvas, zIndex);


Parameter Type Description
canvas String name of the canvas
zIndex Int (Optional) the value to set the z index

expose

interact with the Babylonjs render engine directly

virtuosity.engine3d.expose();