Colored lines renderer. Responsible to drawing a batch of line segments or strips.
Kind: global class
Number
Number
Boolean
Create the sprites batch.
Param | Type | Description |
---|---|---|
[lineSegmentsCount] | Number |
Internal buffers size, in line segments count (line segment = 3 vertices). Bigger value = faster rendering but more RAM. |
Kind: instance property of LinesBatch
Kind: instance property of LinesBatch
Number
Get how many line segments are currently in batch.
Kind: instance property of LinesBatch
Returns: Number
- Line segments in batch count.
Number
Get how many line segments this batch can contain.
Kind: instance property of LinesBatch
Returns: Number
- Max line segments count.
Boolean
Check if this batch is full.
Kind: instance property of LinesBatch
Returns: Boolean
- True if batch is full.
Kind: instance method of LinesBatch
Kind: instance method of LinesBatch
Push vertices to drawing batch.
Kind: instance method of LinesBatch
Param | Type | Description |
---|---|---|
vertices | Array.<Vertex> |
Vertices to push. Vertices count must be dividable by 3 to keep the batch consistent of polygons. |
Add a rectangle to draw.
Kind: instance method of LinesBatch
Param | Type | Description |
---|---|---|
position | Vector2 | Vector3 |
Drawing position (at origin). If vector3 is provided, will pass z value to the shader code position attribute. |
size | Vector2 | Vector3 | Number |
Drawing size. If vector3 is provided, will pass z value to the shader code position attribute for the bottom vertices, as position.z + size.z. |
color | Color | Array.<Color> | undefined |
Rectangle color, or undefined to not change color. If array is set, will assign each color to different vertex, starting from top-left. |
[rotation] | Number |
Rotate rectangle. |
[origin] | Vector2 |
Drawing origin. This will be the point at ‘position’ and rotation origin. |
[skew] | Vector2 |
Skew the drawing corners on X and Y axis, around the origin point. |
Add a rectangle that covers a given destination rectangle.
Kind: instance method of LinesBatch
Param | Type | Description |
---|---|---|
destRect | Rectangle | Vector2 |
Destination rectangle to draw on. If vector is provided, will draw from 0,0 with vector as size. |
[sourceRect] | Rectangle |
Source rectangle, or undefined to use the entire texture. |
color | Color | Array.<Color> | undefined |
Rectangle color, or undefined to not change color. If array is set, will assign each color to different vertex, starting from top-left. |
[rotation] | Number |
Rotate rectangle. |
[origin] | Vector2 |
Drawing origin. This will be the point at ‘position’ and rotation origin. |
Draw a colored circle.
Kind: instance method of LinesBatch
Param | Type | Description |
---|---|---|
circle | Circle |
Circle to draw. |
color | Color |
Circle fill color. |
[segmentsCount] | Number |
How many segments to build the circle from (more segments = smoother circle). |
ratio | Number | Vector2 |
If procided, will scale the circle on X and Y axis to turn it into an oval. If a number is provided, will use this number to scale Y axis. |
[rotation] | Number |
If provided will rotate the oval / circle. |