Class: Renderable

Renderable() → {Renderable}

Defualt constructor creates a renderable instance of a white square. Encapsulate the Shader and vertexBuffer into the same object (and will include other attributes later) to represent a Renderable object on the game screen.

Found in Chapter 3, page 71 of the textbook

Example: 3.1 Renderable Objects

Constructor

new Renderable() → {Renderable}

Source:
Returns:
a new instance of Renderable
Type
Renderable

Methods

_setShader(s)

Sets the Renderable's Shader
Parameters:
Name Type Description
s Shader Shader to set for the Renderable
Source:

draw(Camera)

Draws the Renderable to the screen in the Camera viewport
Parameters:
Name Type Description
Camera Camera object to draw to
Source:

getColor() → {Array.<float>}

Returns the color of this Renderable
Source:
Returns:
mColor - the current color array of this Renderable
Type
Array.<float>

getXform() → {Transform}

Returns the Transform object of this Renderable
Source:
Returns:
- the Transform object of this Renderable
Type
Transform

setColor(color)

Sets the constant color of this Renderable
Parameters:
Name Type Description
color Array.<float> the new color formatted as RGBA
Source:

swapShader(s) → {Shader}

Sets the shader this Renderable uses and returns the previous shader
Parameters:
Name Type Description
s Shader the new shader for this Renderable to use
Source:
Returns:
out - the previous shader
Type
Shader

update()

Update method called on Gameloop
Source: