
Sprite batch renderer. Responsible to drawing a batch of sprites with as little draw calls as possible.
Kind: global class
Create the sprites batch.
| Param | Type | Description |
|---|---|---|
| [batchSpritesCount] | Number |
Internal buffers size, in sprites count (sprite = 4 vertices). Bigger value = faster rendering but more RAM. |
| [enableVertexColor] | Boolean |
If true (default) will support vertex color. |
| [enableNormals] | Boolean |
If true (not default) will support vertex normals. |
| [enableBinormals] | Boolean |
If true (not default) will support vertex binormals. |
| [enableTangents] | Boolean |
If true (not default) will support vertex tangents. |
Kind: instance property of SpriteBatch
Push vertices to drawing batch.
Kind: instance method of SpriteBatch
| Param | Type | Description |
|---|---|---|
| texture | TextureAssetBase |
Texture to draw. |
| vertices | Array.<Vertex> |
Vertices to push. Vertices count must be dividable by 4 to keep the batch consistent of quads. |
Add a quad to draw.
Kind: instance method of SpriteBatch
| Param | Type | Description |
|---|---|---|
| texture | TextureAssetBase |
Texture to draw. |
| 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. |
| sourceRectangle | Rectangle |
Source rectangle, or undefined to use the entire texture. |
| color | Color | Array.<Color> | undefined |
Tint 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 sprite. |
| [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 sprites group to this batch.
Kind: instance method of SpriteBatch
| Param | Type | Description |
|---|---|---|
| group | SpritesGroup |
Sprite group to draw. |
| [cullOutOfScreen] | Boolean |
If true, will cull sprites that are not visible in currently set rendering region. |
Add a quad that covers a given destination rectangle.
Kind: instance method of SpriteBatch
| Param | Type | Description |
|---|---|---|
| texture | TextureAssetBase |
Texture to draw. |
| 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 |
Tint color, or undefined to not change color. If array is set, will assign each color to different vertex, starting from top-left. |
| [origin] | Vector2 |
Drawing origin. This will be the point at ‘position’ and rotation origin. |