Class: BatchPluginFactory

PIXI.BatchPluginFactory

new PIXI.BatchPluginFactory ()

Members

PIXI.BatchPluginFactory.defaultFragmentTemplate string staticconstant

The default fragment shader source

PIXI.BatchPluginFactory.defaultVertexSrc string staticconstant

The default vertex shader source

Methods

PIXI.BatchPluginFactory.create (options)* static

Create a new BatchRenderer plugin for Renderer. this convenience can provide an easy way to extend BatchRenderer with all the necessary pieces.

Name Type Description
options object optional
Name Type Default Description
vertex string PIXI.BatchPluginFactory.defaultVertexSrc optional

Vertex shader source

fragment string PIXI.BatchPluginFactory.defaultFragmentTemplate optional

Fragment shader template

vertexSize number 6 optional

Vertex size

geometryClass object PIXI.BatchGeometry optional
Returns:
Type Description
* New batch renderer plugin
Example
const fragment = `
varying vec2 vTextureCoord;
varying vec4 vColor;
varying float vTextureId;
uniform sampler2D uSamplers[%count%];

void main(void){
    vec4 color;
    %forloop%
    gl_FragColor = vColor * vec4(color.a - color.rgb, color.a);
}
`;
const InvertBatchRenderer = PIXI.BatchPluginFactory.create({ fragment });
PIXI.Renderer.registerPlugin('invert', InvertBatchRenderer);
const sprite = new PIXI.Sprite();
sprite.pluginName = 'invert';