FluxRenderer

FluxRenderer

new FluxRenderer(domParent, width, height)

Class wrapping the renderer with custom passes and context swapping. Multipass rendering uses GPU shaders to accomplish ambient obscurance and stencil buffer shadows. Context swapping lets a single OpenGL context and canvas be used for multiple renderers.
Parameters:
Name Type Description
domParent Element The div container for the canvas
width Number The width of the canvas
height Number The height of the canvas
Source:

Members

(static) CHANGE_EVENT :String

Name of the event fired when the camera changes
Type:
  • String
Source:

Methods

addShadow(mesh)

Add a shadow to the scene.
Parameters:
Name Type Description
mesh THREE.Mesh The mesh of the object casting a shadow
Source:

addShadows()

Add the shadows for everything in the current model
Source:

anyValidPrims() → {Boolean}

Say whether there are any objects to render in the model
Source:
Returns:
True if there are objects to render
Type
Boolean

detach()

Destructor to prevent future rendering after being unloaded
Source:

doRender()

Render the scene with its geometry.
Source:

focus(objopt)

Focus the controls' current camera on an object. This function will focus on the union of object and all of it's visible children.
Parameters:
Name Type Attributes Description
obj THREE.Object3D <optional>
The scene object to focus on.
Source:

fromJSON(state)

Take a data object and use it to update the internal state
Parameters:
Name Type Description
state Object The properties to set
Source:

getGlCanvas() → {Canvas}

Get the canvas for use in QA scripts
Source:
Returns:
WebGL canvas dom element
Type
Canvas

homeCamera()

Restore the camera to a default location
Source:

removeShadow(mesh)

Remove a shadow from the scene.
Parameters:
Name Type Description
mesh THREE.Mesh The mesh of the shadow to remove
Source:

setClearColor(color, alpha)

Set the clear color (background) for WebGL canvas
Parameters:
Name Type Description
color String | Number Hexadecimal or a CSS-style string
alpha Number Opacity
Source:

setEdgesMode(mode)

Set the edges rendering mode for hidden line rendering
Parameters:
Name Type Description
mode EdgesHelper.EDGES_MODES Whether to render front, back, both or none
Source:

setHelpersVisible(visible)

Whether to draw helpers (axis and grid)
Parameters:
Name Type Description
visible Boolean False to hide them
Source:

setLights(lights)

Set the lights used to illuminate the scene.
Parameters:
Name Type Description
lights THREE.Object3D Object with lights as children
Source:

setModel(model)

Set the object to render Replaces old render contents
Parameters:
Name Type Description
model THREE.Object3D What to render
Source:

setShadowLight(light)

Set the light that is casting shadows.
Parameters:
Name Type Description
light THREE.Light light object, position is saved
Source:

setSize(width, height)

Set the size of things that are per viewport.
Parameters:
Name Type Description
width Number The canvas width in pixels
height Number The canvas height in pixels
Source:

setView(view)

Change the camera view
Parameters:
Name Type Description
view String The new view mode
Source:

toJSON() → {Object}

Make serializable by pruning all references and building an object property tree
Source:
Returns:
Data to stringify
Type
Object