API Docs for: 0.2.0
Show:

Scene Class

Defined in: src\scenes\Scene.js:1
Module: LE

The Scene class contains the objects that are rendered with the WebGLRenderer

Constructor

Scene

(
  • [parameters]
)

Parameters:

  • [parameters] Object optional

    Parameters is an object that contains the Scenes properties

    • [ambientLight=new LE.AmbientLight(new LE.Colour(255, 255, 255, 255))] AmbientLight optional

      Default value is an ambient light with maximum brightness.

Methods

addLight

(
  • light
)

Adds a PointLight, DirectionalLight or RadialPointLight to the scene

Parameters:

  • light Object

addObject

(
  • object
)

Adds a Polygon or Texture to the scene. This object will not cast shadows

Parameters:

  • object Object

addShadowObject

(
  • object
)

Adds a Polygon or Texture to the scene. This object will cast shadows

Parameters:

  • object Object

assignTextureIndices

(
  • array
  • i
)
private

Assigns a texture index to an object

Parameters:

  • array Array
  • i Number

    Index in the given array

comparePolygons

(
  • object1
  • object2
)
private

Checks if a given polygon is equal to another polygon

Parameters:

  • object1 Object
  • object2 Object

handleLoadedTexture

(
  • texture
)
private

Prepares the loaded texture for WebGL use

Parameters:

  • texture Object

init

(
  • gl
)
private

Initialise the scene with a WebGL context

Parameters:

  • gl Object

initBuffers

(
  • gl
)
private

Initialise all buffers, this includes object, texture and light buffers

Parameters:

  • gl Object

initLightBuffer

(
  • array
  • i
)
private

Initialise a light buffer

Parameters:

  • array Array
  • i Number

    Index in the given array

initPolygonBuffer

(
  • array
  • i
)
private

Initialise a polygon buffer

Parameters:

  • array Array
  • i Number

    Index in the given array

initTextureBuffer

(
  • array
  • i
)
private

Initialise a texture buffer

Parameters:

  • array Array
  • i Number

    Index in the given array

initTextures

() private

Initialises all textures

removeLight

(
  • light
)

Removes a PointLight, DirectionalLight or RadialPointLight from the scene

Parameters:

  • light Object

removeObject

(
  • object
)

Removes a Polygon or Texture from the scene. This object does not cast shadows

Parameters:

  • object Object

removeShadowObject

(
  • object
)

Removes a Polygon or Texture from the scene. This object casts shadows

Parameters:

  • object Object

Properties

ambientLight

AmbientLight

Stores the ambient light

Default: new LE.AmbientLight(new LE.Colour(255, 255, 255, 255))

gl

Object private

Stores a reference to the WebGL canvas context

lightBuffers

Array private

Stores all the WebGL light vertex buffers

lights

Array private

Stores the lights

objectBuffers

Array private

Stores all the WebGL vertex buffers

objectColourBuffers

Array private

Stores all the WebGL colour vertex buffers

objectIndexBuffers

Array private

Stores all the WebGL object indices

objects

Array private

Stores the objects that do not cast shadows

objectTextureBuffers

Array private

Stores all the WebGL texture vertex buffers

shadowBuffers

Array private

Stores all the WebGL shadow vertex buffers

shadowColourBuffers

Array private

Stores all the WebGL shadow colour vertex buffers

shadowObjects

Array private

Stores the objects that cast shadows

textures

Array private

Stores all the texture data to be rendered by WebGL