LittleJS 1.28.0

ThreeJS

ThreeJSPlugin

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

Constructor

new ThreeJSPlugin(THREE, cameraFOV)threejs.js:30

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

THREE Object

The three.js module, supplied by the user

cameraFOV number optional, default 60

Vertical field of view in degrees

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

Members

Methods

Members

camera : Objectthreejs.js:50

The three.js perspective camera

cameraAlign2D : booleanthreejs.js:52

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

cameraFar : number|undefinedthreejs.js:60

Far plane of the aligned camera before any zoom out, from camera.far on the first aligned frame; while aligned, change this rather than camera.far

cameraNear : number|undefinedthreejs.js:56

Near plane of the aligned camera before any zoom out, from camera.near on the first aligned frame; while aligned, change this rather than camera.near

renderer : Objectthreejs.js:46

The three.js renderer

scene : Objectthreejs.js:48

The three.js scene, add lights and meshes here

THREE : Objectthreejs.js:44

The three.js module passed into the constructor

Methods

alignCamera2D()threejs.js:77

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

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