dist/claygl.es.js
function(shader, keepStatus) {
        var originalUniforms = this.uniforms;

        // Ignore if uniform can use in shader.
        this.uniforms = shader.createUniforms();
        this.shader = shader;

        var uniforms = this.uniforms;
        this._enabledUniforms = Object.keys(uniforms);
        // Make sure uniforms are set in same order to avoid texture slot wrong
        this._enabledUniforms.sort();
        this._textureUniforms = this._enabledUniforms.filter(function (uniformName) {
            var type = this.uniforms[uniformName].type;
            return type === 't' || type === 'tv';
        }, this);

        var originalVertexDefines = this.vertexDefines;
        var originalFragmentDefines = this.fragmentDefines;

        this.vertexDefines = util$1.clone(shader.vertexDefines);
        this.fragmentDefines = util$1.clone(shader.fragmentDefines);

        if (keepStatus) {
            for (var symbol in originalUniforms) {
                if (uniforms[symbol]) {
                    uniforms[symbol].value = originalUniforms[symbol].value;
                }
            }

            util$1.defaults(this.vertexDefines, originalVertexDefines);
            util$1.defaults(this.fragmentDefines, originalFragmentDefines);
        }

        var textureStatus = {};
        for (var key in shader.textures) {
            textureStatus[key] = {
                shaderType: shader.textures[key].shaderType,
                type: shader.textures[key].type,
                enabled: (keepStatus && this._textureStatus[key]) ? this._textureStatus[key].enabled : false
            };
        }

        this._textureStatus = textureStatus;

        this._programKey = '';
    }
function(shader, keepStatus) {
        var originalUniforms = this.uniforms;

        // Ignore if uniform can use in shader.
        this.uniforms = shader.createUniforms();
        this.shader = shader;

        var uniforms = this.uniforms;
        this._enabledUniforms = Object.keys(uniforms);
        // Make sure uniforms are set in same order to avoid texture slot wrong
        this._enabledUniforms.sort();
        this._textureUniforms = this._enabledUniforms.filter(function (uniformName) {
            var type = this.uniforms[uniformName].type;
            return type === 't' || type === 'tv';
        }, this);

        var originalVertexDefines = this.vertexDefines;
        var originalFragmentDefines = this.fragmentDefines;

        this.vertexDefines = util$1.clone(shader.vertexDefines);
        this.fragmentDefines = util$1.clone(shader.fragmentDefines);

        if (keepStatus) {
            for (var symbol in originalUniforms) {
                if (uniforms[symbol]) {
                    uniforms[symbol].value = originalUniforms[symbol].value;
                }
            }

            util$1.defaults(this.vertexDefines, originalVertexDefines);
            util$1.defaults(this.fragmentDefines, originalFragmentDefines);
        }

        var textureStatus = {};
        for (var key in shader.textures) {
            textureStatus[key] = {
                shaderType: shader.textures[key].shaderType,
                type: shader.textures[key].type,
                enabled: (keepStatus && this._textureStatus[key]) ? this._textureStatus[key].enabled : false
            };
        }

        this._textureStatus = textureStatus;

        this._programKey = '';
    }
function ( shader , keepStatus ) { var originalUniforms = this . uniforms ; // Ignore if uniform can use in shader. this . uniforms = shader . createUniforms ( ) ; this . shader = shader ; var uniforms = this . uniforms ; this . _enabledUniforms = Object . keys ( uniforms ) ; // Make sure uniforms are set in same order to avoid texture slot wrong this . _enabledUniforms . sort ( ) ; this . _textureUniforms = this . _enabledUniforms . filter ( function ( uniformName ) { var type = this . uniforms [ uniformName ] . type ; return type === 't' || type === 'tv' ; } , this ) ; var originalVertexDefines = this . vertexDefines ; var originalFragmentDefines = this . fragmentDefines ; this . vertexDefines = util$1 . clone ( shader . vertexDefines ) ; this . fragmentDefines = util$1 . clone ( shader . fragmentDefines ) ; if ( keepStatus ) { for ( var symbol in originalUniforms ) { if ( uniforms [ symbol ] ) { uniforms [ symbol ] . value = originalUniforms [ symbol ] . value ; } } util$1 . defaults ( this . vertexDefines , originalVertexDefines ) ; util$1 . defaults ( this . fragmentDefines , originalFragmentDefines ) ; } var textureStatus = { } ; for ( var key in shader . textures ) { textureStatus [ key ] = { shaderType : shader . textures [ key ] . shaderType , type : shader . textures [ key ] . type , enabled : ( keepStatus && this . _textureStatus [ key ] ) ? this . _textureStatus [ key ] . enabled : false } ; } this . _textureStatus = textureStatus ; this . _programKey = '' ; }
Attach a shader instance
@param  {clay.Shader} shader
@param  {boolean} keepStatus If try to keep uniform and texture
Attach a shader instance