ThreeJS. ThreeJSPlugin

ThreeJS Plugin - Renders a three.js scene behind the LittleJS canvas

Constructor

new ThreeJSPlugin(THREE, cameraFOVopt)

Set up the three.js rendering layer, call in gameInit

Parameters:
NameTypeAttributesDefaultDescription
THREEObject

The three.js module, supplied by the user

cameraFOVnumber<optional>
60

Vertical field of view in degrees

Example
// in gameInit, with three.js loaded by the user
new ThreeJSPlugin(THREE);
threeJS.scene.add(new THREE.AmbientLight);

Members

THREE

Properties
TypeDescription
Object

The three.js module passed into the constructor

camera

Properties
TypeDescription
Object

The three.js perspective camera

cameraAlign2D

Properties
TypeDescription
boolean

Lock the camera to the LittleJS 2D camera so the z=0 plane matches world space

renderer

Properties
TypeDescription
Object

The three.js renderer

scene

Properties
TypeDescription
Object

The three.js scene, add lights and meshes here

Methods

alignCamera2D()

Position the camera so the z=0 plane exactly matches LittleJS world space, called automatically when cameraAlign2D is set

render()

Sync the canvas layout and render the scene, called automatically each frame