API Docs for:
Show:

RD.Renderer Class

Renderer in charge of rendering a Scene Valid options: all LiteGL context creation options (canvas, WebGL Flags, etc), plus: assets_folder, autoload_assets, shaders_file

Constructor

RD.Renderer

()

Methods

clear

(
  • color
)

clear color and depth buffer

Parameters:

  • color Vec4

    clear color

loadMesh

(
  • name
  • on_complete
)

Loads one mesh and stores inside the meshes object to be reused in the future, if it is already loaded it skips the loading

Parameters:

  • name String

    name (and url) of the mesh

  • on_complete Function

    callback

loadShaders

(
  • url
  • on_complete
)

Loads a shaders file in the Atlas file format (check GL.loadFileAtlas in litegl)

Parameters:

  • url String

    url to text file containing all the shader files

  • on_complete Function

    callback

loadTexture

(
  • name
  • options
  • on_complete
)

Loads one texture and stores inside the textures object to be reused in the future, if it is already loaded it skips the loading

Parameters:

  • name String

    name (and url) of the texture

  • options Object

    texture options as in litegl (option.name is used to store it with a different name)

  • on_complete Function

    callback

render

(
  • scene
  • camera
  • nodes
)

renders once scene from one camera

Parameters:

  • scene RD.Scene
  • camera RD.Camera
  • nodes Array

    [Optional] array with nodes to render, otherwise all nodes will be rendered

setDataFolder

(
  • path
)

whats the data folder where all data should be fetch

Parameters:

  • path String

Properties

meshes

Object

container with all the registered meshes (same as gl.meshes)

shaders

Object

container with all the registered shaders (same as gl.shaders)

textures

Object

container with all the registered textures (same as gl.textures)