Allow WebGL tile layer style to be updated

This commit is contained in:
Tim Schaub
2021-11-18 09:48:26 -07:00
parent d95e507af3
commit c2fc800fc1
4 changed files with 68 additions and 7 deletions

View File

@@ -340,7 +340,6 @@ class WebGLHelper extends Disposable {
* @type {WebGLRenderingContext}
*/
this.gl_ = getContext(this.canvas_);
const gl = this.getGL();
/**
* @private
@@ -407,14 +406,11 @@ class WebGLHelper extends Disposable {
*/
this.uniforms_ = [];
if (options.uniforms) {
for (const name in options.uniforms) {
this.uniforms_.push({
name: name,
value: options.uniforms[name],
});
}
this.setUniforms(options.uniforms);
}
const gl = this.getGL();
/**
* An array of PostProcessingPass objects is kept in this variable, built from the steps provided in the
* options. If no post process was given, a default one is used (so as not to have to make an exception to
@@ -447,6 +443,20 @@ class WebGLHelper extends Disposable {
this.startTime_ = Date.now();
}
/**
* @param {Object<string, UniformValue>} uniforms Uniform definitions.
*/
setUniforms(uniforms) {
this.uniforms_ = [];
for (const name in uniforms) {
this.uniforms_.push({
name: name,
value: uniforms[name],
});
}
this.uniformLocations_ = {};
}
/**
* @param {string} canvasCacheKey The canvas cache key.
* @return {boolean} The provided key matches the one this helper was constructed with.