Class: LightRenderable

LightRenderable(myTexture) → {LightRenderable}

Defines a SpriteAnimatedRenderable with a list of lights

Found in Chapter 8, page 419 of the textbook

Examples: 8.2 Simple Light Shader, 8.3 Multiple Lights, 8.6 Directional and Spot Lights

Constructor

new LightRenderable(myTexture) → {LightRenderable}

Parameters:
Name Type Description
myTexture string path to the image file to use as texture
Source:
Returns:
a new LightRenderable instance
Type
LightRenderable

Extends

Methods

addLight(l)

Add a Light object to this LightRenderable's list
Parameters:
Name Type Description
l Light the Light object to add
Source:

draw(camera)

Draw this LightRenderable to the Camera
Parameters:
Name Type Description
camera Camera the Camera to draw to
Overrides:
Source:

getElementUVCoordinateArray() → {Array.<float>}

Returns a one dimensional array with UV coordinates of the corners of the sprite region for this SpriteRenderable
Inherited From:
Source:
Returns:
top-right: [0][1], top-left: [2][3], bottom-right: [4][5], bottom-left: [6][7]
Type
Array.<float>

getLightAt(index) → {Light}

Returns the Light at the specified index in this LightRenderable's light list
Parameters:
Name Type Description
index integer the array index to access
Source:
Returns:
the Light object at the index
Type
Light

getNumLights() → {integer}

Returns the number of lights this LightRenderable has
Source:
Returns:
the length of the light list
Type
integer

incAnimationSpeed(deltaInterval)

Add a value to the animation advancement interval
Parameters:
Name Type Description
deltaInterval integer the value to add to the advancement interval
Inherited From:
Source:

setAnimationSpeed(tickInterval)

Set how many update calls before advancing the animation of this SpriteAnimateRenderable
Parameters:
Name Type Description
tickInterval integer animation advancement interval
Inherited From:
Source:

setAnimationType(animationType)

Set the animation type for this SpriteAnimateRenderable and restart the animation
Parameters:
Name Type Description
animationType eAnimationType methodology for moving through the sprite sequence
Inherited From:
Source:

setElementPixelPositions(left, right, bottom, top)

Set the sprite element bounds in pixel coordinates (between 0 to image resolutions) for this Sprite Renderable
Parameters:
Name Type Description
left integer leftmost pixel position
right integer rightmost pixel position
bottom integer bottommost pixel position
top integer topmost pixel position
Inherited From:
Source:

setElementUVCoordinate(left, right, bottom, top)

Set the sprite element bounds in UV texture coordinate (0-1) for this Sprite Renderable
Parameters:
Name Type Description
left float leftmost U coordinate
right float rightmost U coordinate
bottom float bottommost V coordinate
top float topmost V coordinate
Inherited From:
Source:

setSpriteSequence(topPixel, leftPixel, elmWidthInPixel, elmHeightInPixel, numElements, wPaddingInPixel)

Set the sequence of sprite elements that make up the animation for this SpriteAnimateRenderable
Parameters:
Name Type Description
topPixel integer vertical pixel offset from the top-left of the sprite sheet
leftPixel integer horizontal pixel offset from the top-left of the sprite sheet
elmWidthInPixel integer pixel width of an individual sprite element in the sequence
elmHeightInPixel integer pixel height of an individual sprite element in the sequence
numElements integer number of sprites in the animation sequence
wPaddingInPixel integer number of horizontal padding pixels between elements
Inherited From:
Source:

updateAnimation()

Update this SpriteAnimatedRenderable, advancing the current sprite element if the update interval has passed
Inherited From:
Source: