Renderer

Lore. Renderer

A class representing the WebGL renderer.

Constructor

new Renderer(targetId, options)

Source:
Properties:
Name Type Description
opts Object

An object containing options.

camera Lore.CameraBase

The camera associated with this renderer.

controls Lore.ControlsBase

The controls associated with this renderer.

Creates an instance of Renderer.

Parameters:
Name Type Description
targetId String

The id of a canvas element.

options any

The options.

Methods

animate()

Source:

The main rendering loop.

createGeometry(name, shaderName) → {Lore.Geometry}

Source:

Creates and adds a geometry to the scene graph.

Parameters:
Name Type Description
name String

The name of the geometry.

shaderName String

The name of the shader used to render the geometry.

Returns:

The created geometry.

Type
Lore.Geometry

disableContextMenu()

Source:

Disables the context menu on the canvas element.

getDevicePixelRatio() → {Number}

Source:

Get the device pixel ratio.

Returns:

The device pixel ratio.

Type
Number

getHeight() → {Number}

Source:

Get the actual height of the canvas.

Returns:

The height of the canvas.

Type
Number

getWidth() → {Number}

Source:

Get the actual width of the canvas.

Returns:

The width of the canvas.

Type
Number

init()

Source:

Initialize and start the renderer.

setClearColor(color)

Source:

Sets the clear color of this renderer.

Parameters:
Name Type Description
color Lore.Color

The clear color.

setMaxFps(fps)

Source:

Set the maximum frames per second of this renderer.

Parameters:
Name Type Description
fps Number

Maximum frames per second.

updateViewport(x, y, width, height)

Source:

Update the viewport. Should be called when the canvas is resized.

Parameters:
Name Type Description
x Number

The horizontal offset of the viewport.

y Number

The vertical offset of the viewport.

width Number

The width of the viewport.

height Number

The height of the viewport.