Support drawing of basic shapes for debugging the physics and particle systems
Found in Chapter 9, page 532 of the textbook
Examples: 9.1 Rigid Shapes and Bounds, 10.1 Particles- Source:
Methods
(inner) drawCircle(camera, pos, radius, color)
Draw a series of lines that simulate a circle using kDrawNumCircleSides
Parameters:
| Name | Type | Description |
|---|---|---|
camera |
Camera | the Camera to draw to |
pos |
vec2 | X,Y world coordinate position of the circle's center |
radius |
float | the radius of the cirlce |
color |
vec4 | [R,G,B,A] color array for the circle |
- Source:
(inner) drawCrossMarker(camera, p, size, color)
Draw a cross marker
Parameters:
| Name | Type | Description |
|---|---|---|
camera |
Camera | the Camera to draw to |
p |
vec2 | X,Y world coordinate position of the cross's center |
size |
float | the world coordinate radius of the cross |
color |
vec4 | [R,G,B,A] color array for the circle |
- Source:
(inner) drawLine(camera, p1, p2, drawVertex, color)
Draws a LineRenderable from p1 to p2
Parameters:
| Name | Type | Description |
|---|---|---|
camera |
Camera | the Camera to draw to |
p1 |
vec2 | the first X,Y world coordinate vertex |
p2 |
vec2 | the second X,Y world coordinate vertex |
drawVertex |
boolean | true to draw the vertices |
color |
vec4 | [R,G,B,A] color array for the line |
- Source:
(inner) drawRectangle(camera, vertices, color)
Draw a rectangle frame
Parameters:
| Name | Type | Description |
|---|---|---|
camera |
Camera | the Camera to draw to |
vertices |
Array.<vec2> | array with the four vec2(X,Y) world coordinate vertices of the rectangle |
color |
vec4 | [R,G,B,A] color array for the circle |
- Source:
(inner) init()
Initialize the LineRenderable and list of circle points for simple drawing
- Source: