Class: X3DCanvas

x3dom. X3DCanvas

Inheritance

  • X3DCanvas

Constructor

X3DCanvas(x3dElement, canvasIdx)

The canvas object wraps the HTML canvas x3dom draws

Parameters:
Name Type Argument Description
x3dElement Object <optional>
x3d element rendering into the canvas
canvasIdx String <optional>
id of HTML canvas


Properties

Access Name Type Inheritance Description
showStat STATS VIEWER STUFF TODO MOVE IT TO MAIN.JS


Methods

_createHTMLCanvas(x3dElem) → {HTMLCanvas}

Creates the HTML canvas used as render target

Parameters:
Name Type Description
x3dElem HTMLNode the X3D root node

Returns:
- the created canvas

_createInitFailedDiv(x3dElem)

Creates a div to inform the user that the initialization failed

Parameters:
Name Type Description
x3dElem String the X3D element

_createProgressDiv()

Creates the div for progression visualization

_initContext(canvas, forbidMobileShaders, forceMobileShaders, forceFlashForIE, tryWebGL2) → {WebGLContext}

Creates the WebGL context and returns it

Parameters:
Name Type Description
canvas HTMLCanvas
forbidMobileShaders Boolean no mobile shaders allowed
forceMobileShaders Boolean force mobile shaders
forceFlashForIE Boolean force flash backend for internet explorer
tryWebGL2 Boolean try to retrieve a WebGL2 context

Returns:
gl

_watchForResize()

Watches for a resize of the canvas and sets the current dimensions

appendParam(node, name, value)

Creates a param node and adds it to the target node's children

Parameters:
Name Type Description
node String the target node
name String the name for the parameter
value String the value for the parameter

load(uri, sceneElemPos, settings)

Loads the given @p uri.

Parameters:
Name Type Description
uri can be a uri or an X3D node
sceneElemPos
settings properties

mousePosition()

Helper that converts a point from node coordinates to page coordinates FIXME: does NOT work when x3dom.css is not included so that x3d element is not floating

tick()

Is called in the main loop after every frame