FluxRenderer

FluxRenderer

new FluxRenderer(domParent, width, height, selection)

Class wrapping the three.js renderer with more build in functionality. Context swapping lets a single OpenGL context and canvas be used for multiple renderers.
Source:
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
selection Enumeration Whether to enable user selection

Methods

_updateClipping()

Update scene data for current clipping state after something changes.
Source:

activateClipping(n, dist)

Enable renderer clipping to reveal inside of geometry
Source:
Parameters:
Name Type Description
n THREE.Vector3 The clipping plane normal
dist Number Distance from origin to clipping plane along normal

activateShadows()

Enable shadows on the renderer, lights and objects. This causes objects to cast shadow on their environment.
Source:

addControls(CustomControls) → {CustomControls}

Add a new plugin for user interaction controls. See ViewportControls.js for more information.
Source:
Parameters:
Name Type Description
CustomControls ViewportControls A constructor that implements the controls interface.
Returns:
Type:
CustomControls
The new instance

anyValidPrims() → {Boolean}

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

deactivateClipping()

Turn of clipping so that all geometry will be rendered
Source:

deactivateShadows()

Enable shadows on the renderer, lights and objects. This causes objects to cast shadow on their environment.
Source:

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.
Source:
Parameters:
Name Type Attributes Description
obj THREE.Object3D <optional>
The scene object to focus on.

fromJSON(state)

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

getGlCanvas() → {Canvas}

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

getSelection() → {THREE.Object3D}

Get the currently selected geometry
Source:
Returns:
Type:
THREE.Object3D
Current selection

homeCamera()

Restore the camera to a default location
Source:

setClearColor(color, alpha)

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

setEdgesMode(mode)

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

setHelpersVisible(visible)

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

setLights(lights)

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

setModel(model)

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

setSelection(object)

set the currently selected geometry
Source:
Parameters:
Name Type Description
object THREE.Object3D New selection

setSelectionMaterial(data)

Define the material that is applied on selected objects
Source:
Parameters:
Name Type Description
data Object Flux json description of a material

setSize(width, height)

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

setView(view)

Set which camera view to use (ex perspective, top etc.).
Source:
Parameters:
Name Type Description
view FluxCameras.VIEWS The new view mode

toJSON() → {Object}

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