Extend linestring renderer with GLSL and indexed geometries.
This commit is contained in:
@@ -0,0 +1,123 @@
|
||||
// This file is automatically generated, do not edit
|
||||
goog.provide('ol.render.webgl.linestringreplay.shader.Default');
|
||||
goog.provide('ol.render.webgl.linestringreplay.shader.Default.Locations');
|
||||
goog.provide('ol.render.webgl.linestringreplay.shader.DefaultFragment');
|
||||
goog.provide('ol.render.webgl.linestringreplay.shader.DefaultVertex');
|
||||
|
||||
goog.require('ol.webgl.shader');
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.webgl.shader.Fragment}
|
||||
* @struct
|
||||
*/
|
||||
ol.render.webgl.linestringreplay.shader.DefaultFragment = function() {
|
||||
goog.base(this, ol.render.webgl.linestringreplay.shader.DefaultFragment.SOURCE);
|
||||
};
|
||||
goog.inherits(ol.render.webgl.linestringreplay.shader.DefaultFragment, ol.webgl.shader.Fragment);
|
||||
goog.addSingletonGetter(ol.render.webgl.linestringreplay.shader.DefaultFragment);
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
ol.render.webgl.linestringreplay.shader.DefaultFragment.DEBUG_SOURCE = 'precision mediump float;\n\n\n\nuniform float u_opacity;\nuniform vec4 u_color;\n\nvoid main(void) {\n gl_FragColor = u_color;\n float alpha = u_color.a * u_opacity;\n if (alpha == 0.0) {\n discard;\n }\n gl_FragColor.a = alpha;\n}\n';
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
ol.render.webgl.linestringreplay.shader.DefaultFragment.OPTIMIZED_SOURCE = 'precision mediump float;uniform float e;uniform vec4 f;void main(void){gl_FragColor=f;float alpha=f.a*e;if(alpha==0.0){discard;}gl_FragColor.a=alpha;}';
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
ol.render.webgl.linestringreplay.shader.DefaultFragment.SOURCE = goog.DEBUG ?
|
||||
ol.render.webgl.linestringreplay.shader.DefaultFragment.DEBUG_SOURCE :
|
||||
ol.render.webgl.linestringreplay.shader.DefaultFragment.OPTIMIZED_SOURCE;
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.webgl.shader.Vertex}
|
||||
* @struct
|
||||
*/
|
||||
ol.render.webgl.linestringreplay.shader.DefaultVertex = function() {
|
||||
goog.base(this, ol.render.webgl.linestringreplay.shader.DefaultVertex.SOURCE);
|
||||
};
|
||||
goog.inherits(ol.render.webgl.linestringreplay.shader.DefaultVertex, ol.webgl.shader.Vertex);
|
||||
goog.addSingletonGetter(ol.render.webgl.linestringreplay.shader.DefaultVertex);
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
ol.render.webgl.linestringreplay.shader.DefaultVertex.DEBUG_SOURCE = '\n\nattribute vec2 a_position;\n\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\n\nvoid main(void) {\n mat4 offsetMatrix = u_offsetScaleMatrix;\n vec4 offsets = offsetMatrix * vec4(0., 0., 0., 0.);\n gl_Position = u_projectionMatrix * vec4(a_position, 0., 1.) + offsets;\n}\n\n\n';
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
ol.render.webgl.linestringreplay.shader.DefaultVertex.OPTIMIZED_SOURCE = 'attribute vec2 a;uniform mat4 b;uniform mat4 c;uniform mat4 d;void main(void){mat4 offsetMatrix=c;vec4 offsets=offsetMatrix*vec4(0.,0.,0.,0.);gl_Position=b*vec4(a,0.,1.)+offsets;}';
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
ol.render.webgl.linestringreplay.shader.DefaultVertex.SOURCE = goog.DEBUG ?
|
||||
ol.render.webgl.linestringreplay.shader.DefaultVertex.DEBUG_SOURCE :
|
||||
ol.render.webgl.linestringreplay.shader.DefaultVertex.OPTIMIZED_SOURCE;
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {WebGLRenderingContext} gl GL.
|
||||
* @param {WebGLProgram} program Program.
|
||||
* @struct
|
||||
*/
|
||||
ol.render.webgl.linestringreplay.shader.Default.Locations = function(gl, program) {
|
||||
|
||||
/**
|
||||
* @type {WebGLUniformLocation}
|
||||
*/
|
||||
this.u_color = gl.getUniformLocation(
|
||||
program, goog.DEBUG ? 'u_color' : 'f');
|
||||
|
||||
/**
|
||||
* @type {WebGLUniformLocation}
|
||||
*/
|
||||
this.u_offsetRotateMatrix = gl.getUniformLocation(
|
||||
program, goog.DEBUG ? 'u_offsetRotateMatrix' : 'd');
|
||||
|
||||
/**
|
||||
* @type {WebGLUniformLocation}
|
||||
*/
|
||||
this.u_offsetScaleMatrix = gl.getUniformLocation(
|
||||
program, goog.DEBUG ? 'u_offsetScaleMatrix' : 'c');
|
||||
|
||||
/**
|
||||
* @type {WebGLUniformLocation}
|
||||
*/
|
||||
this.u_opacity = gl.getUniformLocation(
|
||||
program, goog.DEBUG ? 'u_opacity' : 'e');
|
||||
|
||||
/**
|
||||
* @type {WebGLUniformLocation}
|
||||
*/
|
||||
this.u_projectionMatrix = gl.getUniformLocation(
|
||||
program, goog.DEBUG ? 'u_projectionMatrix' : 'b');
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.a_position = gl.getAttribLocation(
|
||||
program, goog.DEBUG ? 'a_position' : 'a');
|
||||
};
|
||||
Reference in New Issue
Block a user