Automatically generate uniform and attribute locations
This commit is contained in:
@@ -103,3 +103,45 @@ ol.renderer.webgl.map.shader.attribute.a_position =
|
||||
*/
|
||||
ol.renderer.webgl.map.shader.attribute.a_texCoord =
|
||||
goog.DEBUG ? 'a_texCoord' : 'e';
|
||||
/**
|
||||
* @constructor
|
||||
* @param {WebGLRenderingContext} gl GL.
|
||||
* @param {WebGLProgram} program Program.
|
||||
*/
|
||||
ol.renderer.webgl.map.shader.Locations = function(gl, program) {
|
||||
/**
|
||||
* @type {WebGLUniformLocation}
|
||||
*/
|
||||
this.u_texCoordMatrix = gl.getUniformLocation(program,
|
||||
ol.renderer.webgl.map.shader.uniform.u_texCoordMatrix);
|
||||
/**
|
||||
* @type {WebGLUniformLocation}
|
||||
*/
|
||||
this.u_projectionMatrix = gl.getUniformLocation(program,
|
||||
ol.renderer.webgl.map.shader.uniform.u_projectionMatrix);
|
||||
/**
|
||||
* @type {WebGLUniformLocation}
|
||||
*/
|
||||
this.u_colorMatrix = gl.getUniformLocation(program,
|
||||
ol.renderer.webgl.map.shader.uniform.u_colorMatrix);
|
||||
/**
|
||||
* @type {WebGLUniformLocation}
|
||||
*/
|
||||
this.u_opacity = gl.getUniformLocation(program,
|
||||
ol.renderer.webgl.map.shader.uniform.u_opacity);
|
||||
/**
|
||||
* @type {WebGLUniformLocation}
|
||||
*/
|
||||
this.u_texture = gl.getUniformLocation(program,
|
||||
ol.renderer.webgl.map.shader.uniform.u_texture);
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.a_position = gl.getAttribLocation(program,
|
||||
ol.renderer.webgl.map.shader.attribute.a_position);
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.a_texCoord = gl.getAttribLocation(program,
|
||||
ol.renderer.webgl.map.shader.attribute.a_texCoord);
|
||||
};
|
||||
|
||||
@@ -85,3 +85,30 @@ ol.renderer.webgl.tilelayer.shader.attribute.a_position =
|
||||
*/
|
||||
ol.renderer.webgl.tilelayer.shader.attribute.a_texCoord =
|
||||
goog.DEBUG ? 'a_texCoord' : 'd';
|
||||
/**
|
||||
* @constructor
|
||||
* @param {WebGLRenderingContext} gl GL.
|
||||
* @param {WebGLProgram} program Program.
|
||||
*/
|
||||
ol.renderer.webgl.tilelayer.shader.Locations = function(gl, program) {
|
||||
/**
|
||||
* @type {WebGLUniformLocation}
|
||||
*/
|
||||
this.u_tileOffset = gl.getUniformLocation(program,
|
||||
ol.renderer.webgl.tilelayer.shader.uniform.u_tileOffset);
|
||||
/**
|
||||
* @type {WebGLUniformLocation}
|
||||
*/
|
||||
this.u_texture = gl.getUniformLocation(program,
|
||||
ol.renderer.webgl.tilelayer.shader.uniform.u_texture);
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.a_position = gl.getAttribLocation(program,
|
||||
ol.renderer.webgl.tilelayer.shader.attribute.a_position);
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.a_texCoord = gl.getAttribLocation(program,
|
||||
ol.renderer.webgl.tilelayer.shader.attribute.a_texCoord);
|
||||
};
|
||||
|
||||
@@ -104,3 +104,28 @@ goog.addSingletonGetter({{className}}Vertex);
|
||||
{{namespace}}.attribute.{{originalName}} =
|
||||
goog.DEBUG ? '{{originalName}}' : '{{shortName}}';
|
||||
{{/getAttributes}}
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {WebGLRenderingContext} gl GL.
|
||||
* @param {WebGLProgram} program Program.
|
||||
*/
|
||||
{{namespace}}.Locations = function(gl, program) {
|
||||
{{#getUniforms}}
|
||||
|
||||
/**
|
||||
* @type {WebGLUniformLocation}
|
||||
*/
|
||||
this.{{originalName}} = gl.getUniformLocation(program,
|
||||
{{namespace}}.uniform.{{originalName}});
|
||||
{{/getUniforms}}
|
||||
{{#getAttributes}}
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.{{originalName}} = gl.getAttribLocation(program,
|
||||
{{namespace}}.attribute.{{originalName}});
|
||||
{{/getAttributes}}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user