Repository

RendererThree

Extends:

Component → RendererThree

Constructor Summary

Public Constructor
public

Renderer3D is a Three.js based simple renderer.

Member Summary

Public Members
public

alpha: *

public
public

cameras: *[]

public

canvas: *

public
public

fog: *

public
public

objects: *[]

public
public
public
public

scene: *

public

scenes: {}

Method Summary

Public Methods
public

Adds a camera to the current context

public

Adds on object to the current scene

public

clears this renderer buffers

public

erases this renderer contents : remove all cameras and scene objects

public

Returns the current canvas

public

Returns the current canvas'height divided by 2

public

Returns the current canvas'width divided by 2

public

Returns the current canvas'height

public

Get the canvas position as {x, y}

public

Returns the current canvas'size as {width, height}

public

Returns the current canvas'width

public
public

getInfo(): *

public

Avoid Infinite Logs coming from browser shader bad compilation

public
public

Removes the camera from the current context

public

Remove from the current scene

public

Renders all the camera in the context

public

saveImageAs(name: String, format: String)

Saves the current frame to an image file.

public

setClearColor(color: *)

change the clearcolor of this renderer color buffers

public

Tells the context to use this scene (defined by a string) or create it and switch to it.

public

Activates the rendering of projected shadows

public

setFog(type: String, color: Color)

Defines the type and color of the fog to be used for rendering the scene

public

Defines the fog color

public

Defines the density of the exponential fog.

public

Defines the far distance of the linear fog.

public

Defines the near distance of the linear fog.

public
public

Update the canvas position in screen

Inherited Summary

From class Component
public
public
public

events: *

public

id: *

public

name: *

private

_nexts: *[]

private
public
public

chain(component: Component)

Adds a component to this chained component array

public

Returns the array of attached children components

public

off()

Deactivate the component

public

on()

Activate the component A call to this method calls the setup method if it has not been run yet

public

Run code after the update of all components is run This empty method is usually overriden to perform post-update actions for the component It is called periodically by an internal Mobilizing mechanism

public

preLoad the component This empty method is usually overriden to perform preLoad actions for the component.

public

Run code before the update of all components is run This empty method is usually overriden to perform pre-update actions for the component It is called once per component by an internal Mobilizing mechanism

public

prepare the component This empty method is usually overriden to perform preparation actions for the component, from external process as a server.

public

Set's up the component This empty method is usually overriden to perform setup actions for the component This is where all the initialization (such as adding event listeners)should be done It is called automatically by an internal Mobilizing mechanism and should thus not be called directly

public

Update the component This empty method is usually overriden to perform update actions for the component It is called periodically by an internal Mobilizing mechanism

Public Constructors

public constructor(params: Object) source

Renderer3D is a Three.js based simple renderer.

Override:

Component#constructor

Params:

NameTypeAttributeDescription
paramsObject

Parameters object, given by the constructor.

params.canvasCanvas

the canvas to draw to

params.alphaBoolean

alpha channel in the webgl canvas

params.antialiasBoolean

global antialiasing

params.preserveDrawingBufferBoolean
params.powerPreferenceString

"high-performance", "low-power" or "default"

Example:

    //to do

Public Members

public alpha: * source

public antialias: * source

public cameras: *[] source

public canvas: * source

public canvasPosition: * source

public fog: * source

public isFullscreen: boolean source

public objects: *[] source

public powerPreference: * source

public preserveDrawingBuffer: * source

public renderer: * source

public scene: * source

public scenes: {} source

Public Methods

public addCamera(cam: Camera) source

Adds a camera to the current context

Params:

NameTypeAttributeDescription
camCamera

the camera to add

public addToCurrentScene(object: Object) source

Adds on object to the current scene

Params:

NameTypeAttributeDescription
objectObject

A Mesh or Light to add the scene

public clear() source

clears this renderer buffers

public erase() source

erases this renderer contents : remove all cameras and scene objects

public getCanvas(): Object source

Returns the current canvas

Return:

Object

the canvas

public getCanvasHalfHeight(): Number source

Returns the current canvas'height divided by 2

Return:

Number

the half height of the canvas

public getCanvasHalfWidth(): Number source

Returns the current canvas'width divided by 2

Return:

Number

the half width of the canvas

public getCanvasHeight(): Number source

Returns the current canvas'height

Return:

Number

the height of the canvas

public getCanvasPosition(): Object source

Get the canvas position as {x, y}

Return:

Object

the position of the canvas as {x, y}

public getCanvasSize(): Object source

Returns the current canvas'size as {width, height}

Return:

Object

the size of the canvas as {width, height}

public getCanvasWidth(): Number source

Returns the current canvas'width

Return:

Number

the width of the canvas

public getCurrentScene(): String source

Return:

String

the current scene's name

public getInfo(): * source

Return:

*

public killShaderInfoLog() source

Avoid Infinite Logs coming from browser shader bad compilation

public onWindowResize() source

public removeCamera(cam: Camera) source

Removes the camera from the current context

Params:

NameTypeAttributeDescription
camCamera

public removeFromCurrentScene(object: Object) source

Remove from the current scene

Params:

NameTypeAttributeDescription
objectObject

the object to remove

public render() source

Renders all the camera in the context

public saveImageAs(name: String, format: String) source

Saves the current frame to an image file. Note that the preserveFrameBuffer must be "true" on renderer construction

Params:

NameTypeAttributeDescription
nameString

the image file name

formatString

the format of the image (jpg, png, gif)

public setClearColor(color: *) source

change the clearcolor of this renderer color buffers

Params:

NameTypeAttributeDescription
color*

public setCurrentScene(name: String) source

Tells the context to use this scene (defined by a string) or create it and switch to it.

Params:

NameTypeAttributeDescription
nameString

public setEnableShadowMap(state: Boolean) source

Activates the rendering of projected shadows

Params:

NameTypeAttributeDescription
stateBoolean

public setFog(type: String, color: Color) source

Defines the type and color of the fog to be used for rendering the scene

Params:

NameTypeAttributeDescription
typeString

one of "linear", "exp"

colorColor

the fog color

public setFogColor(color: Color) source

Defines the fog color

Params:

NameTypeAttributeDescription
colorColor

public setFogDensity(density: Number) source

Defines the density of the exponential fog. Default is 0.00025.

Params:

NameTypeAttributeDescription
densityNumber

public setFogFar(far: Number) source

Defines the far distance of the linear fog. Default is 1000.

Params:

NameTypeAttributeDescription
farNumber

public setFogNear(near: Number) source

Defines the near distance of the linear fog. Default is 1.

Params:

NameTypeAttributeDescription
nearNumber

public update() source

Update the component This empty method is usually overriden to perform update actions for the component It is called periodically by an internal Mobilizing mechanism

Override:

Component#update

public updateCanvasPosition() source

Update the canvas position in screen