Class vxlView

the class that manages what it is rendered the HTML5 canvas on the web page

Constructor

vxlView(canvasID, scene, handleLayout)
Each HTML5 canvas is assigned a view object (vxlView) in Voxelent's Nucleo.A vxlView provides the code to handle cameras, interaction and rendering capabilities, plus actor handling on the HTML5 canvas that otherwise would need to be written over and over for each applicationif you were writing a WebGL app from scratch.Luckily this is not the case. You have the awesome vxlView who takes care of all these little details for you.
Author: Diego Cantor.

Parameters:

String canvasID

id of the canvas in the DOM tree. That's all we need to setup a vxlView for you

vxlScene scene

if this view is sharing a scene, this parameter corresponds to the scene being shared.

Boolean handleLayout

if true or absent, the canvas will be resized dynamically

Methods

.clear()
Clears the scene. Delegates this task to the renderer.
.disableFullScreen()
Forbids this view from going to Full Screen mode
.enableFullScreen()
Enables this view to go to Full Screen mode. Fullscreen mode is available by default.
.fullscreen(flag)
Handles HTML5 Full screen for this view

Parameters:

Type Name Description
Boolean flag

set flag to true if fullscreen is wanted. Set it to false to exit fullscreen.

.getFPS()
Get FPS metric from the view renderer
.handleEvent(event, source)
Handles the events to which a view is subscribed in Voxelent's Nucleo

Parameters:

Type Name Description
String event

the name of the event

Object source

the origin of the event. Useful to do callbacks if necessary

.refresh()
Refresh the view

See:

vxlRenderer#render
.reset()
Resets the view
.resize()
Resizes the canvas so it fits its parent node in the DOM tree
.setAutoResize(flag)
Enables automatic resizing of the view when the browser window is resized

Parameters:

Type Name Description
flag

enbles automatic resizing if true, disables it if false

.setBackgroundColor(r, g, b)
Sets the view's background color

Parameters:

Type Name Description
Number|Array|vec3 r

it can be the red component, a 3-dimensional Array or a vec3 (glMatrix)

Number g

if r is a number, then this parameter corresponds to the green component

Number b

if r is a number, then this parameter corresponds to the blue component

See:

vxlRenderer#clearColor
.setClearDepth(d)
Sets the clear depth

Parameters:

Type Name Description
Number d

the new depth

See:

vxlRenderer#clearDepth
.setDragAndDrop(flag)
Sets the drag and drop flag

Parameters:

Type Name Description
Boolean flag

.setInteractor(interactor)
Uses the interactor passed as parameter to handle user gestures

Parameters:

Type Name Description
vxlViewInteractor interactor

an instance of a vxlViewInteractor

.start()
Starts the view
.stop()
Stops the view