LittleJS 1.30.1

ThreeJS

ThreeJSPlugin

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

Constructor

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

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

THREE ThreeModule

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

The three.js perspective camera

cameraAlign2D : booleanthreejs.js:83

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

cameraFar : number|undefinedthreejs.js:91

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:87

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

The three.js renderer

The three.js scene, add lights and meshes here

The three.js module passed into the constructor

Methods

alignCamera2D()threejs.js:109

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