How to use the @pixi/core.Shader.from function in @pixi/core

To help you get started, we’ve selected a few @pixi/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pixijs / pixi.js / packages / particles / src / ParticleRenderer.js View on Github external
attributeName: 'aTextureCoord',
                size: 2,
                uploadFunction: this.uploadUvs,
                offset: 0,
            },
            // tintData
            {
                attributeName: 'aColor',
                size: 1,
                type: TYPES.UNSIGNED_BYTE,
                uploadFunction: this.uploadTint,
                offset: 0,
            },
        ];

        this.shader = Shader.from(vertex, fragment, {});

        /**
         * The WebGL state in which this renderer will work.
         *
         * @member {PIXI.State}
         * @readonly
         */
        this.state = State.for2d();
    }
github pixijs / pixi.js / packages / sprite / src / generateMultiTextureShader.js View on Github external
for (let i = 0; i < maxTextures; i++)
    {
        sampleValues[i] = i;
    }

    const uniforms = {
        default: UniformGroup.from({ uSamplers: sampleValues }, true),
    };

    let fragmentSrc = fragTemplate;

    fragmentSrc = fragmentSrc.replace(/%count%/gi, maxTextures);
    fragmentSrc = fragmentSrc.replace(/%forloop%/gi, generateSampleSrc(maxTextures));

    const shader = Shader.from(vertex, fragmentSrc, uniforms);

    return shader;
}
github pixijs / pixi.js / packages / sprite-tiling / src / TilingSpriteRenderer.js View on Github external
constructor(renderer)
    {
        super(renderer);

        const uniforms = { globals: this.renderer.globalUniforms };

        this.shader = Shader.from(vertex, fragment, uniforms);

        this.simpleShader = Shader.from(vertex, fragmentSimple, uniforms);

        this.quad = new QuadUv();

        /**
         * The WebGL state in which this renderer will work.
         *
         * @member {PIXI.State}
         * @readonly
         */
        this.state = State.for2d();
    }
github pixijs / pixi.js / packages / sprite-tiling / src / TilingSpriteRenderer.js View on Github external
constructor(renderer)
    {
        super(renderer);

        const uniforms = { globals: this.renderer.globalUniforms };

        this.shader = Shader.from(vertex, fragment, uniforms);

        this.simpleShader = Shader.from(vertex, fragmentSimple, uniforms);

        this.quad = new QuadUv();

        /**
         * The WebGL state in which this renderer will work.
         *
         * @member {PIXI.State}
         * @readonly
         */
        this.state = State.for2d();
    }