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.
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 |
- Source:
Methods
addControls(CustomControls) → {CustomControls}
Add a new plugin for user interaction controls.
See ViewportControls.js for more information.
Parameters:
Name | Type | Description |
---|---|---|
CustomControls |
ViewportControls | A constructor that implements the controls interface. |
- Source:
Returns:
The new instance
- Type
- CustomControls
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
getSelection() → {THREE.Object3D}
Get the currently selected geometry
- Source:
Returns:
Current selection
- Type
- THREE.Object3D
homeCamera()
Restore the camera to a default location
- 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:
setSelection(object)
set the currently selected geometry
Parameters:
Name | Type | Description |
---|---|---|
object |
THREE.Object3D | New selection |
- Source:
setSelectionMaterial(data)
Define the material that is applied on selected objects
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | Flux json description of a material |
- 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)
Set which camera view to use (ex perspective, top etc.).
Parameters:
Name | Type | Description |
---|---|---|
view |
FluxCameras.VIEWS | 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