Class: BatchPluginFactory

PIXI.BatchPluginFactory

new PIXI.BatchPluginFactory

Members

PIXI.BatchPluginFactory.defaultFragmentTemplate string static

The default fragment shader source

PIXI.BatchPluginFactory.defaultVertexSrc string static

The default vertex shader source

Methods

PIXI.BatchPluginFactory.create (options) unknown static

BatchPluginFactory.ts:25

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

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

Vertex shader source

options.fragment string <optional>
PIXI.BatchPluginFactory.defaultFragmentTemplate

Fragment shader template

options.vertexSize number <optional>
6

Vertex size

options.geometryClass object <optional>
PIXI.BatchGeometry
Returns:
Type Description
unknown 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';