Class: ThreeRendererBridge

Kekule.Render. ThreeRendererBridge

new ThreeRendererBridge()

Render bridge class of three.js. In this bridge, context is a Kekule.Render.ThreeContext object, thus we can handle both scene and camera at the same time.
Source:

Methods

(static) isSupported() → {Bool}

Check if current environment supports Three.js drawing.
Source:
Returns:
Type
Bool

canModifyGraphic(context) → {Bool}

Indicate whether this bridge and context can change glyph content or position after drawing it. Raphael is a typical environment of this type while canvas should returns false.
Parameters:
Name Type Description
context Object
Source:
Returns:
Type
Bool

clearContext(context)

Clear the whole context.
Parameters:
Name Type Description
context Object
Source:

createContext(parentElem, width, height) → {Object}

Create a context element for drawing.
Parameters:
Name Type Description
parentElem Element
width Int Width of context, in px.
height Int Height of context, in px.
Source:
Returns:
Context used for drawing.
Type
Object

getCameraProps(context) → {Hash}

Returns properties of current camera, including position(coord), fov, aspect and so on.
Parameters:
Name Type Description
context Object
Source:
Returns:
Type
Hash

getContextDimension(context) → {Hash}

Get width and height of context.
Parameters:
Name Type Description
context Object
Source:
Returns:
{width, height}
Type
Hash

getContextElem(context)

Get context related element.
Parameters:
Name Type Description
context Object
Source:

getLightCount(context) → {Int}

Returns count of lights in context.
Parameters:
Name Type Description
context Object
Source:
Returns:
Type
Int

getLightProps(context, lightIndex) → {Hash}

Get properties of light at index.
Parameters:
Name Type Description
context Object
lightIndex Int
Source:
Returns:
Type
Hash

releaseContext(context)

Destroy context created.
Parameters:
Name Type Description
context Object
Source:

setCameraProps(context, props)

Set properties of current camera, including position(coord), fov, aspect, lookAtVector and so on.
Parameters:
Name Type Description
context Object
props Hash
Source:

setContextDimension(context, width, height)

Set new width and height of context. Note in canvas, the content should be redrawn after resizing.
Parameters:
Name Type Description
context Object
width Int
height Int
Source:

setLightProps(context, lightIndex, props)

Get properties of light at index.
Parameters:
Name Type Description
context Object
lightIndex Int
props Hash
Source:

transformContextCoordToScreen(context, coord) → {Hash}

Transform a context based coord to screen based one (usually in pixel).
Parameters:
Name Type Description
context Object
coord Hash
Source:
Returns:
Type
Hash

transformContextCoordToScreen(context, coord) → {Hash}

Transform a 3D context based coord to screen based one (usually 2D in pixel).
Parameters:
Name Type Description
context Object
coord Hash
Source:
Returns:
Type
Hash

transformScreenCoordToContext(context, coord) → {Hash}

Transform a screen based coord to context based one.
Parameters:
Name Type Description
context Object
coord Hash
Source:
Returns:
Type
Hash

Kekule.Render. ThreeRendererBridge

new ThreeRendererBridge()

Source:

Methods

(static) isSupported() → {Bool}

Check if current environment supports Three.js drawing.
Source:
Returns:
Type
Bool

canModifyGraphic(context) → {Bool}

Indicate whether this bridge and context can change glyph content or position after drawing it. Raphael is a typical environment of this type while canvas should returns false.
Parameters:
Name Type Description
context Object
Source:
Returns:
Type
Bool

clearContext(context)

Clear the whole context.
Parameters:
Name Type Description
context Object
Source:

createContext(parentElem, width, height) → {Object}

Create a context element for drawing.
Parameters:
Name Type Description
parentElem Element
width Int Width of context, in px.
height Int Height of context, in px.
Source:
Returns:
Context used for drawing.
Type
Object

getCameraProps(context) → {Hash}

Returns properties of current camera, including position(coord), fov, aspect and so on.
Parameters:
Name Type Description
context Object
Source:
Returns:
Type
Hash

getContextDimension(context) → {Hash}

Get width and height of context.
Parameters:
Name Type Description
context Object
Source:
Returns:
{width, height}
Type
Hash

getContextElem(context)

Get context related element.
Parameters:
Name Type Description
context Object
Source:

getLightCount(context) → {Int}

Returns count of lights in context.
Parameters:
Name Type Description
context Object
Source:
Returns:
Type
Int

getLightProps(context, lightIndex) → {Hash}

Get properties of light at index.
Parameters:
Name Type Description
context Object
lightIndex Int
Source:
Returns:
Type
Hash

releaseContext(context)

Destroy context created.
Parameters:
Name Type Description
context Object
Source:

setCameraProps(context, props)

Set properties of current camera, including position(coord), fov, aspect, lookAtVector and so on.
Parameters:
Name Type Description
context Object
props Hash
Source:

setContextDimension(context, width, height)

Set new width and height of context. Note in canvas, the content should be redrawn after resizing.
Parameters:
Name Type Description
context Object
width Int
height Int
Source:

setLightProps(context, lightIndex, props)

Get properties of light at index.
Parameters:
Name Type Description
context Object
lightIndex Int
props Hash
Source:

transformContextCoordToScreen(context, coord) → {Hash}

Transform a context based coord to screen based one (usually in pixel).
Parameters:
Name Type Description
context Object
coord Hash
Source:
Returns:
Type
Hash

transformContextCoordToScreen(context, coord) → {Hash}

Transform a 3D context based coord to screen based one (usually 2D in pixel).
Parameters:
Name Type Description
context Object
coord Hash
Source:
Returns:
Type
Hash

transformScreenCoordToContext(context, coord) → {Hash}

Transform a screen based coord to context based one.
Parameters:
Name Type Description
context Object
coord Hash
Source:
Returns:
Type
Hash