Class: BatchPluginFactory

PIXI.BatchPluginFactory

Members

PIXI.BatchPluginFactory.defaultFragmentTemplate string staticconstant

默认片段着色器源

PIXI.BatchPluginFactory.defaultVertexSrc string staticconstant

默认的顶点着色器源

Methods

PIXI.BatchPluginFactory.create (options)* static

为Renderer创建一个新的BatchRenderer插件。 这种便利可以提供一种简便的方法来扩展BatchRenderer的所有必要部分。

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

顶点着色器源

fragment string PIXI.BatchPluginFactory.defaultFragmentTemplate optional

片段着色器模板

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';