Constructor
new Renderer(handler, paramsopt)
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
handler | Handler | | WebGL handler instance or canvas target selector/element. | ||
params | IRendererParams | <optional> | {} | Renderer parameters: - controls: Control instances to add to the renderer - msaa: MSAA (Multi-Sample Anti-Aliasing) level - autoActivate: Start rendering automatically after creation - fontsSrc: Path to font resources - gamma: Gamma correction value - exposure: HDR exposure value - dpi: Device pixel ratio - clearColor: RGBA clear color array |
- Source
- event:draw - Triggered before each frame is rendered.
- event:resize - Triggered when the canvas is resized.
- event:mousemove - Triggered when the mouse moves over the canvas.
- event:mousestop - Triggered when the mouse stops moving.
- event:lclick - Triggered on left mouse button click.
- event:rclick - Triggered on right mouse button click.
- event:mclick - Triggered on middle mouse button click.
- event:ldblclick - Triggered on left mouse button double-click.
- event:rdblclick - Triggered on right mouse button double-click.
- event:mdblclick - Triggered on middle mouse button double-click.
- event:lup - Triggered when the left mouse button is released.
- event:rup - Triggered when the right mouse button is released.
- event:mup - Triggered when the middle mouse button is released.
- event:ldown - Triggered when the left mouse button is pressed.
- event:rdown - Triggered when the right mouse button is pressed.
- event:mdown - Triggered when the middle mouse button is pressed.
- event:lhold - Triggered while the left mouse button is held.
- event:rhold - Triggered while the right mouse button is held.
- event:mhold - Triggered while the middle mouse button is held.
- event:mousewheel - Triggered on mouse wheel scroll.
- event:touchstart - Triggered on touch start.
- event:touchend - Triggered on touch end.
- event:touchcancel - Triggered on touch cancel.
- event:touchmove - Triggered on touch move.
- event:doubletouch - Triggered on double touch.
- event:touchleave - Triggered when touch leaves the canvas.
- event:touchenter - Triggered when touch enters the canvas.
Members
billboardsTextureAtlas :TextureAtlas
Texture atlas for the billboards images.
- Source
fontAtlas :FontAtlas
Texture font atlas for the font families and styles.
- FontAtlas
- Source
strokeTextureAtlas :TextureAtlas
Texture atlas for the rays, polylines and strips.
- Source
Methods
addControl(control)
Adds a control to the renderer.
| Name | Type | Description |
|---|---|---|
control | Control | Control. |
- Source
addControls(cArr)
Adds an array of controls to the renderer.
| Name | Type | Description |
|---|---|---|
cArr | Array.<Control> | Control array. |
- Source
addNode(renderNode)
Adds render node to the renderer.
| Name | Type | Description |
|---|---|---|
renderNode | RenderNode | Render node. |
- Source
addNodeBefore(renderNode, renderNodeBefore)
Adds render node to the renderer before specific node.
| Name | Type | Description |
|---|---|---|
renderNode | RenderNode | Render node. |
renderNodeBefore | RenderNode | Insert before the renderNodeBefore node. |
- Source
addNodes(nodesArr)
Adds render nodes array to the renderer.
| Name | Type | Description |
|---|---|---|
nodesArr | Array.<RenderNode> | Render nodes array. |
- Source
addPickingCallback(sender, callback) → {number}
Adds a picking render callback.
| Name | Type | Description |
|---|---|---|
sender | any | Callback context. |
callback | function | Render callback function. |
- Source
Callback ID.
- Type:
- number
applyDepthForCamera()
Sets depth compare and clear value for the camera (reverse-Z vs classic). Pass null to restore classic depth state: depthFunc(LESS), clearDepth(1), and clip-control NEGATIVE_ONE_TO_ONE.
- Source
assignPickingColor(obj)
Assigns a picking color to an object.
| Name | Type | Description |
|---|---|---|
obj | Object | Object that receives a picking color. |
- Source
clearPickingColor(obj)
Removes the picking color from an object.
| Name | Type | Description |
|---|---|---|
obj | Object | Object to clear the picking color from. |
- Source
draw()
Draw nodes.
- Source
enqueueEntityCollectionsToDraw()
TODO: replace with cache friendly linked list by BillboardHandler, LabelHandler etc.
- Source
getCartesianFromPixel(px) → {Vec3|undefined}
Returns 3d coordinates from screen coordinates
| Name | Type | Description |
|---|---|---|
px | Vec2 | | Screen coordinates. |
- Source
- Type:
- Vec3 |
undefined
getDistanceFromPixel(px) → {number|undefined}
Returns the distance from the active (screen) camera to the 3d-surface using the defined screen coordinates
| Name | Type | Description |
|---|---|---|
px | Vec2 | | Screen coordinates. |
- Source
- Type:
- number |
undefined
getHeight() → {number}
Returns the canvas client height.
- Source
- Type:
- number
getViewportCenter() → {Vec2}
Returns the canvas viewport center.
- Source
- Type:
- Vec2
getWidth() → {number}
Returns the canvas client width.
- Source
- Type:
- number
initialize()
Renderer initialization.
- Source
markForDepthRefresh()
Forces the depth buffer to be refreshed in the next frame. Has effect for terrain altitude estimate precision.
- Source
removeControl(control)
Removes a control from the renderer.
| Name | Type | Description |
|---|---|---|
control | Control | Control. |
- Source
removePickingCallback(id)
Removes a picking render callback.
| Name | Type | Description |
|---|---|---|
id | number | Callback ID to remove. |
- Source
setEventsActivity(activity)
Enables or disables renderer events.
| Name | Type | Description |
|---|---|---|
activity | boolean | Events activity flag. |
- Source
start()
Function starts renderer
- Source