Shaku

Shaku JS

Back To Table of Content

Sprite Batch Base

SpriteBatchBase

Base class for sprite-based rendering, ie vertices with textures.

Kind: global class

new SpriteBatchBase([batchSpritesCount], [enableVertexColor], [enableNormals], [enableBinormals], [enableTangents])

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.

spriteBatchBase.isDestroyed

Kind: instance property of SpriteBatchBase

spriteBatchBase.supportVertexColor ⇒ Boolean

Get if this sprite batch support vertex color.

Kind: instance property of SpriteBatchBase
Returns: Boolean - True if support vertex color.

spriteBatchBase.defaultEffect

Kind: instance property of SpriteBatchBase

spriteBatchBase.quadsInBatch ⇒ Number

Get how many quads are currently in batch.

Kind: instance property of SpriteBatchBase
Returns: Number - Quads in batch count.

spriteBatchBase.maxQuadsCount ⇒ Number

Get how many quads this sprite batch can contain.

Kind: instance property of SpriteBatchBase
Returns: Number - Max quads count.

spriteBatchBase.isFull ⇒ Boolean

Check if this batch is full.

Kind: instance property of SpriteBatchBase
Returns: Boolean - True if batch is full.

spriteBatchBase.destroy()

Kind: instance method of SpriteBatchBase

spriteBatchBase.clear()

Kind: instance method of SpriteBatchBase

spriteBatchBase.drawSprite(sprites, [transform], [cullOutOfScreen])

Add sprite or sprites to batch.

Kind: instance method of SpriteBatchBase

Param Type Description
sprites Sprite | Array.<Sprite> Sprite or multiple sprites to draw.
[transform] Matrix Optional transformations to apply on sprite vertices. Won’t apply on static sprites.
[cullOutOfScreen] Boolean If true, will cull sprites that are not visible in currently set rendering region.