syncUniforms()
    {
        // TODO: Structs....

        // slot 0 is the main texture, additional textures start at 1
        let textureCount = 1;

        const values = this.values;
        const uniforms = this.uniforms;
        const uniformData = this.uniforms.__data;

        for (const k in values)
        {
            if (!uniformData[k]) continue;

            if (uniformData[k].type === 'sampler2D')
            {
                uniforms[k] = textureCount;

                // TextureSource object from the textures plugin
                // or anything that can give me a gl texture really.
                if (values[k].getGlTexture)
                {
                    const tx = values[k].getGlTexture(this.renderer);

                    if (tx) tx.bind(textureCount);
                }
                // Texture object from the textures plugin.
                else if (values[k].source && values[k].source.getGlTexture)
                {
                    const tx = values[k].source.getGlTexture(this.renderer);

                    if (tx) tx.bind(textureCount);
                }
                // RenderTarget, GLFramebuffer, or anything with a GLTexture property.
                else if (values[k].texture)
                {
                    values[k].texture.bind(textureCount);
                }

                textureCount++;
            }
            else if (uniformData[k].type === 'mat3')
            {
                // check if its a matrix object
                if (typeof values[k].a !== 'undefined')
                {
                    uniforms[k] = values[k].toArray(true);
                }
                else
                {
                    uniforms[k] = values[k];
                }
            }
            else if (uniformData[k].type === 'vec2')
            {
                // check if its a vector object
                if (typeof values[k].x !== 'undefined')
                {
                    const val = uniforms[k] || new Float32Array(2);

                    val[0] = values[k].x;
                    val[1] = values[k].y;

                    uniforms[k] = val;
                }
                else
                {
                    uniforms[k] = values[k];
                }
            }
            else
            {
                uniforms[k] = values[k];
            }
        }
    }
/**
     * Should only be called after the filter has been set as the bound shader.
     * Since the FilterRenderSystem calls this for you, there should be almost
     * no situation where you should call this yourself.
     *
     */
Should only be called after the filter has been set as the bound shader.
Since the FilterRenderSystem calls this for you, there should be almost
no situation where you should call this yourself.
Should only be called after the filter has been set as the bound shader . Since the FilterRenderSystem calls this for you there should be almost no situation where you should call this yourself .
syncUniforms()
    {
        let textureCount = 1;
        const values = this.values;
        const uniforms = this.uniforms;
        const uniformData = this.uniforms.__data;
        for (const k in values)
        {
            if (!uniformData[k]) continue;
            if (uniformData[k].type === 'sampler2D')
            {
                uniforms[k] = textureCount;
                if (values[k].getGlTexture)
                {
                    const tx = values[k].getGlTexture(this.renderer);
                    if (tx) tx.bind(textureCount);
                }
                else if (values[k].source && values[k].source.getGlTexture)
                {
                    const tx = values[k].source.getGlTexture(this.renderer);
                    if (tx) tx.bind(textureCount);
                }
                else if (values[k].texture)
                {
                    values[k].texture.bind(textureCount);
                }
                textureCount++;
            }
            else if (uniformData[k].type === 'mat3')
            {
                if (typeof values[k].a !== 'undefined')
                {
                    uniforms[k] = values[k].toArray(true);
                }
                else
                {
                    uniforms[k] = values[k];
                }
            }
            else if (uniformData[k].type === 'vec2')
            {
                if (typeof values[k].x !== 'undefined')
                {
                    const val = uniforms[k] || new Float32Array(2);
                    val[0] = values[k].x;
                    val[1] = values[k].y;
                    uniforms[k] = val;
                }
                else
                {
                    uniforms[k] = values[k];
                }
            }
            else
            {
                uniforms[k] = values[k];
            }
        }
    }
syncUniforms ( ) { let textureCount = 1 ; const values = this . values ; const uniforms = this . uniforms ; const uniformData = this . uniforms . __data ; for ( const k in values ) { if ( ! uniformData [ k ] ) continue ; if ( uniformData [ k ] . type === 'sampler2D' ) { uniforms [ k ] = textureCount ; if ( values [ k ] . getGlTexture ) { const tx = values [ k ] . getGlTexture ( this . renderer ) ; if ( tx ) tx . bind ( textureCount ) ; } else if ( values [ k ] . source && values [ k ] . source . getGlTexture ) { const tx = values [ k ] . source . getGlTexture ( this . renderer ) ; if ( tx ) tx . bind ( textureCount ) ; } else if ( values [ k ] . texture ) { values [ k ] . texture . bind ( textureCount ) ; } textureCount ++ ; } else if ( uniformData [ k ] . type === 'mat3' ) { if ( typeof values [ k ] . a !== 'undefined' ) { uniforms [ k ] = values [ k ] . toArray ( true ) ; } else { uniforms [ k ] = values [ k ] ; } } else if ( uniformData [ k ] . type === 'vec2' ) { if ( typeof values [ k ] . x !== 'undefined' ) { const val = uniforms [ k ] || new Float32Array ( 2 ) ; val [ 0 ] = values [ k ] . x ; val [ 1 ] = values [ k ] . y ; uniforms [ k ] = val ; } else { uniforms [ k ] = values [ k ] ; } } else { uniforms [ k ] = values [ k ] ; } } }
Should only be called after the filter has been set as the bound shader.
Should only be called after the filter has been set as the bound shader .
// TODO: Structs.... // slot 0 is the main texture, additional textures start at 1 // TextureSource object from the textures plugin // or anything that can give me a gl texture really. // Texture object from the textures plugin. // RenderTarget, GLFramebuffer, or anything with a GLTexture property. // check if its a matrix object // check if its a vector object