Class: LineRenderable

LineRenderable(x1, y1, x2, y2)

Renderable class for line segments

Not discussed in the textbook

Example: 7.6 Line Support

Constructor

new LineRenderable(x1, y1, x2, y2)

Parameters:
Name Type Description
x1 float X world coordinate of first vertext
y1 float Y world coordinate of first vertext
x2 float X world coordinate of second vertext
y2 float Y world coordinate of second vertext
Source:

Extends

Methods

_setShader(s)

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

draw(camera)

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

getColor() → {Array.<float>}

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

getXform() → {Transform}

Returns the Transform object of this Renderable
Inherited From:
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
Inherited From:
Source:

setDrawVertices(s)

Set whether points at the vertices are drawn
Parameters:
Name Type Description
s boolean true to draw vertices
Source:

setFirstVertex(x1, y1)

Set world coordinates for the first vertex of this LineRenderable
Parameters:
Name Type Description
x1 float X world coordinate of first vertext
y1 float Y world coordinate of first vertext
Source:

setPointSize(s)

Set the pixel diameter of the vertex points
Parameters:
Name Type Description
s float the diameter of the point in pixels
Source:

setSecondVertex(x1, y1)

Set world coordinates for the second vertex of this LineRenderable
Parameters:
Name Type Description
x1 float X world coordinate of second vertext
y1 float Y world coordinate of second vertext
Source:

setShowLine(s)

Set whether the line between the vertices is drawn
Parameters:
Name Type Description
s boolean true to draw the line
Source:

setVertices(x1, y1, x2, y2)

Set world coordinates for both vertices of this LineRenderable
Parameters:
Name Type Description
x1 float X world coordinate of first vertext
y1 float Y world coordinate of first vertext
x2 float X world coordinate of second vertext
y2 float Y world coordinate of second vertext
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
Inherited From:
Source:
Returns:
out - the previous shader
Type
Shader

update()

Update method called on Gameloop
Inherited From:
Source: