if (this.missingUniforms[name] == 2) {
console.log('WARN', 'Uniform', name, 'is null');
}
}
}
else if (this.program.uniforms[name].type == this.gl.SAMPLER_2D || this.program.uniforms[name].type == this.gl.SAMPLER_CUBE) {
this.gl.activeTexture(this.gl.TEXTURE0 + numTextures);
if (this.uniforms[name].width > 0 && this.uniforms[name].height > 0) {
this.gl.bindTexture(this.uniforms[name].target, this.uniforms[name].handle);
this.program.uniforms[name](numTextures);
}
numTextures++;
}
else {
var newValue = this.uniforms[name];
var oldValue = this.prevUniforms[name];
var newHash = null;
if (oldValue !== null) {
if (newValue && newValue.hash) {
newHash = newValue.hash();
if (newHash == oldValue) {
continue;
}
} else if (newValue == oldValue) {
continue;
}
}
this.program.uniforms[name](this.uniforms[name]);
this.prevUniforms[name] = newHash ? newHash : newValue;
}
}
};
module.exports = Material;