# 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:
  - FluxRenderer.js, line 11

### Members

#### (static) CHANGE_EVENT :String

Name of the event fired when the camera changes

##### Type:

- String

Source:
  - FluxRenderer.js, line 99

### 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:
  - FluxRenderer.js, line 450

#### addShadows()

Add the shadows for everything in the current model

Source:
  - FluxRenderer.js, line 438

#### anyValidPrims() → {Boolean}

Say whether there are any objects to render in the model

Source:
  - FluxRenderer.js, line 418

##### Returns:

True if there are objects to render

Type
  Boolean

#### detach()

Destructor to prevent future rendering after being unloaded

Source:
  - FluxRenderer.js, line 227

#### doRender()

Render the scene with its geometry.

Source:
  - FluxRenderer.js, line 399

#### focus(object)

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 | Description
--- | --- | ---
`object` | THREE.Object3D | The scene object to focus on.

Source:
  - FluxRenderer.js, line 188

#### 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:
  - FluxRenderer.js, line 547

#### getGlCanvas() → {Canvas}

Get the canvas for use in QA scripts

Source:
  - FluxRenderer.js, line 479

##### Returns:

WebGL canvas dom element

Type
  Canvas

#### homeCamera()

Restore the camera to a default location

Source:
  - FluxRenderer.js, line 179

#### removeShadow(mesh)

Remove a shadow from the scene.

##### Parameters:

Name | Type | Description
--- | --- | ---
`mesh` | THREE.Mesh | The mesh of the shadow to remove

Source:
  - FluxRenderer.js, line 459

#### setClearColor(color)

Set the clear color (background) for WebGL canvas

##### Parameters:

Name | Type | Description
--- | --- | ---
`color` | String | Number | Hexadecimal or a CSS-style string

Source:
  - FluxRenderer.js, line 198

#### 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:
  - FluxRenderer.js, line 157

#### setLights(lights)

Set the lights used to illuminate the scene.

##### Parameters:

Name | Type | Description
--- | --- | ---
`lights` | THREE.Object3D | Object with lights as children

Source:
  - FluxRenderer.js, line 105

#### setModel(model)

Set the object to render Replaces old render contents

##### Parameters:

Name | Type | Description
--- | --- | ---
`model` | THREE.Object3D | What to render

Source:
  - FluxRenderer.js, line 139

#### setShadowLight(light)

Set the light that is casting shadows.

##### Parameters:

Name | Type | Description
--- | --- | ---
`light` | THREE.Light | light object, position is saved

Source:
  - FluxRenderer.js, line 426

#### 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:
  - FluxRenderer.js, line 518

#### setView(view)

Change the camera view

##### Parameters:

Name | Type | Description
--- | --- | ---
`view` | String | The new view mode

Source:
  - FluxRenderer.js, line 237

#### toJSON() → {Object}

Make serializable by pruning all references and building an object property tree

Source:
  - FluxRenderer.js, line 535

##### Returns:

Data to stringify

Type
  Object