2.0.4 • Published 10 years ago

kami-batch v2.0.4

Weekly downloads
1
License
MIT
Repository
github
Last release
10 years ago

kami-batch

unstable

A fast and efficient 2D sprite batcher based loosely on LibGDX's implementation.

Usage

NPM

See examples folder for details. A full program could look like this:

//setup a canvas
var gl = require('webgl-context')({
    width: 512,
    height: 512
});

//an opaque white texture, useful for tinting lines and rectangles
var tex = require('kami-white-texture')(gl);

//create a sprite batcher
var batch = require('kami-batch')(gl);

batch.begin();

//tint the vertex attributes
batch.setColor(1,0,0);

//draw some sprites
batch.draw(tex, 0, 0, 256, 256);
batch.draw(tex, 5, 5, 12, 51);

//submit to GPU
batch.end();

//add to DOM
document.body.appendChild( gl.canvas );

Planned Changes

  • use projection matrices instead of a vector
  • support rotation on the fly

License

MIT, see LICENSE.md for details.

2.0.4

10 years ago

2.0.3

10 years ago

2.0.2

10 years ago

2.0.1

10 years ago

2.0.0

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago