ShaderBuilder / refactoring to use an actual builder pattern

There is now a ShaderBuilder class with chainable methods
to specify more easily the contents of the final shaders.
This is to avoid passing around large objects to different functions,
and allow for a richer API.

The documentation has also been corrected and clarified.
This commit is contained in:
Olivier Guyot
2019-10-22 11:12:04 +02:00
parent bcdb191de2
commit 9ee93cd2cf
3 changed files with 402 additions and 249 deletions
+3 -3
View File
@@ -3,7 +3,7 @@
*/
import {assign} from '../obj.js';
import WebGLPointsLayerRenderer from '../renderer/webgl/PointsLayer.js';
import {getSymbolFragmentShader, getSymbolVertexShader, parseSymbolStyle} from '../webgl/ShaderBuilder.js';
import {parseSymbolStyle} from '../webgl/ShaderBuilder.js';
import Layer from './Layer.js';
@@ -82,8 +82,8 @@ class WebGLPointsLayer extends Layer {
*/
createRenderer() {
return new WebGLPointsLayerRenderer(this, {
vertexShader: getSymbolVertexShader(this.parseResult_.params),
fragmentShader: getSymbolFragmentShader(this.parseResult_.params),
vertexShader: this.parseResult_.builder.getSymbolVertexShader(),
fragmentShader: this.parseResult_.builder.getSymbolFragmentShader(),
uniforms: this.parseResult_.uniforms,
attributes: this.parseResult_.attributes
});