Fix provide/require structure for autogenerated shader files

This commit is contained in:
Andreas Hocevar
2017-08-29 21:51:27 +02:00
parent 5cfb1e4099
commit cf8c72c992
28 changed files with 482 additions and 909 deletions

View File

@@ -1,106 +1,15 @@
// This file is automatically generated, do not edit
/* eslint openlayers-internal/no-missing-requires: 0 */
goog.provide('{{namespace}}');
goog.require('ol');
goog.require('ol.webgl.Fragment');
goog.require('ol.webgl.Vertex');
/**
* @constructor
* @extends {ol.webgl.Fragment}
* @struct
*/
{{className}}.Fragment = function() {
ol.webgl.Fragment.call(this, {{className}}.Fragment.SOURCE);
};
ol.inherits({{className}}.Fragment, ol.webgl.Fragment);
{{namespace}}.fragment = new ol.webgl.Fragment(ol.DEBUG_WEBGL ?
'precision mediump float;\n{{{originalFragmentSource}}}' :
'precision mediump float;{{{fragmentSource}}}');
/**
* @const
* @type {string}
*/
{{className}}.Fragment.DEBUG_SOURCE = 'precision mediump float;\n{{{getOriginalFragmentSource}}}';
/**
* @const
* @type {string}
*/
{{className}}.Fragment.OPTIMIZED_SOURCE = 'precision mediump float;{{{getFragmentSource}}}';
/**
* @const
* @type {string}
*/
{{className}}.Fragment.SOURCE = ol.DEBUG_WEBGL ?
{{className}}.Fragment.DEBUG_SOURCE :
{{className}}.Fragment.OPTIMIZED_SOURCE;
{{className}}.fragment = new {{className}}.Fragment();
/**
* @constructor
* @extends {ol.webgl.Vertex}
* @struct
*/
{{className}}.Vertex = function() {
ol.webgl.Vertex.call(this, {{className}}.Vertex.SOURCE);
};
ol.inherits({{className}}.Vertex, ol.webgl.Vertex);
/**
* @const
* @type {string}
*/
{{className}}.Vertex.DEBUG_SOURCE = '{{{getOriginalVertexSource}}}';
/**
* @const
* @type {string}
*/
{{className}}.Vertex.OPTIMIZED_SOURCE = '{{{getVertexSource}}}';
/**
* @const
* @type {string}
*/
{{className}}.Vertex.SOURCE = ol.DEBUG_WEBGL ?
{{className}}.Vertex.DEBUG_SOURCE :
{{className}}.Vertex.OPTIMIZED_SOURCE;
{{className}}.vertex = new {{className}}.Vertex();
/**
* @constructor
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
* @struct
*/
{{namespace}}.Locations = function(gl, program) {
{{#getUniforms}}
/**
* @type {WebGLUniformLocation}
*/
this.{{originalName}} = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? '{{originalName}}' : '{{shortName}}');
{{/getUniforms}}
{{#getAttributes}}
/**
* @type {number}
*/
this.{{originalName}} = gl.getAttribLocation(
program, ol.DEBUG_WEBGL ? '{{originalName}}' : '{{shortName}}');
{{/getAttributes}}
};
{{namespace}}.vertex = new ol.webgl.Vertex(ol.DEBUG_WEBGL ?
'{{{originalVertexSource}}}' :
'{{{vertexSource}}}');

View File

@@ -0,0 +1,30 @@
// This file is automatically generated, do not edit
goog.provide('{{namespace}}.Locations');
goog.require('ol');
/**
* @constructor
* @param {WebGLRenderingContext} gl GL.
* @param {WebGLProgram} program Program.
* @struct
*/
{{namespace}}.Locations = function(gl, program) {
{{#uniforms}}
/**
* @type {WebGLUniformLocation}
*/
this.{{originalName}} = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? '{{originalName}}' : '{{shortName}}');
{{/uniforms}}
{{#attributes}}
/**
* @type {number}
*/
this.{{originalName}} = gl.getAttribLocation(
program, ol.DEBUG_WEBGL ? '{{originalName}}' : '{{shortName}}');
{{/attributes}}
};