Scene Class
The Scene class contains the objects that are rendered with the WebGLRenderer
Constructor
Scene
-
[parameters]
Parameters:
-
[parameters]
Object optionalParameters is an object that contains the Scenes properties
-
[ambientLight=new LE.AmbientLight(new LE.Colour(255, 255, 255, 255))]
AmbientLight optionalDefault value is an ambient light with maximum brightness.
-
Item Index
Methods
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
Assigns a texture index to an object
Parameters:
-
array
Array -
i
NumberIndex in the given array
comparePolygons
-
object1
-
object2
Checks if a given polygon is equal to another polygon
Parameters:
-
object1
Object -
object2
Object
handleLoadedTexture
-
texture
Prepares the loaded texture for WebGL use
Parameters:
-
texture
Object
init
-
gl
Initialise the scene with a WebGL context
Parameters:
-
gl
Object
initBuffers
-
gl
Initialise all buffers, this includes object, texture and light buffers
Parameters:
-
gl
Object
initLightBuffer
-
array
-
i
Initialise a light buffer
Parameters:
-
array
Array -
i
NumberIndex in the given array
initPolygonBuffer
-
array
-
i
Initialise a polygon buffer
Parameters:
-
array
Array -
i
NumberIndex in the given array
initTextureBuffer
-
array
-
i
Initialise a texture buffer
Parameters:
-
array
Array -
i
NumberIndex 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