Rename location shader classes

And remove the now unneeded NAMESPACE variable
This commit is contained in:
Frederic Junod
2018-02-08 15:13:20 +01:00
parent 83d530e181
commit e25e61c3b7
24 changed files with 34 additions and 49 deletions

View File

@@ -8,7 +8,7 @@ import {intersects} from '../../extent.js';
import {isEmpty} from '../../obj.js'; import {isEmpty} from '../../obj.js';
import _ol_geom_flat_transform_ from '../../geom/flat/transform.js'; import _ol_geom_flat_transform_ from '../../geom/flat/transform.js';
import {fragment, vertex} from '../webgl/circlereplay/defaultshader.js'; import {fragment, vertex} from '../webgl/circlereplay/defaultshader.js';
import _ol_render_webgl_circlereplay_defaultshader_Locations_ from '../webgl/circlereplay/defaultshader/Locations.js'; import Locations from '../webgl/circlereplay/defaultshader/Locations.js';
import WebGLReplay from '../webgl/Replay.js'; import WebGLReplay from '../webgl/Replay.js';
import _ol_render_webgl_ from '../webgl.js'; import _ol_render_webgl_ from '../webgl.js';
import _ol_webgl_ from '../../webgl.js'; import _ol_webgl_ from '../../webgl.js';
@@ -203,7 +203,7 @@ WebGLCircleReplay.prototype.setUpProgram = function(gl, context, size, pixelRati
// get the locations // get the locations
let locations; let locations;
if (!this.defaultLocations_) { if (!this.defaultLocations_) {
locations = new _ol_render_webgl_circlereplay_defaultshader_Locations_(gl, program); locations = new Locations(gl, program);
this.defaultLocations_ = locations; this.defaultLocations_ = locations;
} else { } else {
locations = this.defaultLocations_; locations = this.defaultLocations_;

View File

@@ -12,7 +12,7 @@ import {isEmpty} from '../../obj.js';
import _ol_render_webgl_ from '../webgl.js'; import _ol_render_webgl_ from '../webgl.js';
import WebGLReplay from '../webgl/Replay.js'; import WebGLReplay from '../webgl/Replay.js';
import {fragment, vertex} from '../webgl/linestringreplay/defaultshader.js'; import {fragment, vertex} from '../webgl/linestringreplay/defaultshader.js';
import _ol_render_webgl_linestringreplay_defaultshader_Locations_ from '../webgl/linestringreplay/defaultshader/Locations.js'; import Locations from '../webgl/linestringreplay/defaultshader/Locations.js';
import _ol_webgl_ from '../../webgl.js'; import _ol_webgl_ from '../../webgl.js';
import WebGLBuffer from '../../webgl/Buffer.js'; import WebGLBuffer from '../../webgl/Buffer.js';
@@ -446,7 +446,7 @@ WebGLLineStringReplay.prototype.setUpProgram = function(gl, context, size, pixel
// get the locations // get the locations
let locations; let locations;
if (!this.defaultLocations_) { if (!this.defaultLocations_) {
locations = new _ol_render_webgl_linestringreplay_defaultshader_Locations_(gl, program); locations = new Locations(gl, program);
this.defaultLocations_ = locations; this.defaultLocations_ = locations;
} else { } else {
locations = this.defaultLocations_; locations = this.defaultLocations_;

View File

@@ -10,7 +10,7 @@ import {linearRingContainsXY} from '../../geom/flat/contains.js';
import _ol_geom_flat_orient_ from '../../geom/flat/orient.js'; import _ol_geom_flat_orient_ from '../../geom/flat/orient.js';
import _ol_geom_flat_transform_ from '../../geom/flat/transform.js'; import _ol_geom_flat_transform_ from '../../geom/flat/transform.js';
import {fragment, vertex} from '../webgl/polygonreplay/defaultshader.js'; import {fragment, vertex} from '../webgl/polygonreplay/defaultshader.js';
import _ol_render_webgl_polygonreplay_defaultshader_Locations_ from '../webgl/polygonreplay/defaultshader/Locations.js'; import Locations from '../webgl/polygonreplay/defaultshader/Locations.js';
import WebGLLineStringReplay from '../webgl/LineStringReplay.js'; import WebGLLineStringReplay from '../webgl/LineStringReplay.js';
import WebGLReplay from '../webgl/Replay.js'; import WebGLReplay from '../webgl/Replay.js';
import _ol_render_webgl_ from '../webgl.js'; import _ol_render_webgl_ from '../webgl.js';
@@ -880,7 +880,7 @@ WebGLPolygonReplay.prototype.setUpProgram = function(gl, context, size, pixelRat
// get the locations // get the locations
let locations; let locations;
if (!this.defaultLocations_) { if (!this.defaultLocations_) {
locations = new _ol_render_webgl_polygonreplay_defaultshader_Locations_(gl, program); locations = new Locations(gl, program);
this.defaultLocations_ = locations; this.defaultLocations_ = locations;
} else { } else {
locations = this.defaultLocations_; locations = this.defaultLocations_;

View File

@@ -5,7 +5,7 @@ import {getUid, inherits} from '../../index.js';
import {intersects} from '../../extent.js'; import {intersects} from '../../extent.js';
import {isEmpty} from '../../obj.js'; import {isEmpty} from '../../obj.js';
import {fragment, vertex} from '../webgl/texturereplay/defaultshader.js'; import {fragment, vertex} from '../webgl/texturereplay/defaultshader.js';
import _ol_render_webgl_texturereplay_defaultshader_Locations_ from '../webgl/texturereplay/defaultshader/Locations.js'; import Locations from '../webgl/texturereplay/defaultshader/Locations.js';
import WebGLReplay from '../webgl/Replay.js'; import WebGLReplay from '../webgl/Replay.js';
import _ol_webgl_ from '../../webgl.js'; import _ol_webgl_ from '../../webgl.js';
import WebGLContext from '../../webgl/Context.js'; import WebGLContext from '../../webgl/Context.js';
@@ -278,7 +278,7 @@ WebGLTextureReplay.prototype.setUpProgram = function(gl, context, size, pixelRat
// get the locations // get the locations
let locations; let locations;
if (!this.defaultLocations) { if (!this.defaultLocations) {
locations = new _ol_render_webgl_texturereplay_defaultshader_Locations_(gl, program); locations = new Locations(gl, program);
this.defaultLocations = locations; this.defaultLocations = locations;
} else { } else {
locations = this.defaultLocations; locations = this.defaultLocations;

View File

@@ -1,4 +1,3 @@
//! NAMESPACE=_ol_render_webgl_circlereplay_defaultshader_
//! MODULE=ol/render/webgl/circlereplay/defaultshader //! MODULE=ol/render/webgl/circlereplay/defaultshader

View File

@@ -12,7 +12,7 @@ import {DEBUG_WEBGL} from '../../../../index.js';
* @param {WebGLProgram} program Program. * @param {WebGLProgram} program Program.
* @struct * @struct
*/ */
const _ol_render_webgl_circlereplay_defaultshader_Locations_ = function(gl, program) { const Locations = function(gl, program) {
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
@@ -87,4 +87,4 @@ const _ol_render_webgl_circlereplay_defaultshader_Locations_ = function(gl, prog
program, DEBUG_WEBGL ? 'a_radius' : 'g'); program, DEBUG_WEBGL ? 'a_radius' : 'g');
}; };
export default _ol_render_webgl_circlereplay_defaultshader_Locations_; export default Locations;

View File

@@ -1,4 +1,3 @@
//! NAMESPACE=_ol_render_webgl_linestringreplay_defaultshader_
//! MODULE=ol/render/webgl/linestringreplay/defaultshader //! MODULE=ol/render/webgl/linestringreplay/defaultshader

View File

@@ -12,7 +12,7 @@ import {DEBUG_WEBGL} from '../../../../index.js';
* @param {WebGLProgram} program Program. * @param {WebGLProgram} program Program.
* @struct * @struct
*/ */
const _ol_render_webgl_linestringreplay_defaultshader_Locations_ = function(gl, program) { const Locations = function(gl, program) {
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
@@ -93,4 +93,4 @@ const _ol_render_webgl_linestringreplay_defaultshader_Locations_ = function(gl,
program, DEBUG_WEBGL ? 'a_direction' : 'g'); program, DEBUG_WEBGL ? 'a_direction' : 'g');
}; };
export default _ol_render_webgl_linestringreplay_defaultshader_Locations_; export default Locations;

View File

@@ -1,4 +1,3 @@
//! NAMESPACE=_ol_render_webgl_polygonreplay_defaultshader_
//! MODULE=ol/render/webgl/polygonreplay/defaultshader //! MODULE=ol/render/webgl/polygonreplay/defaultshader

View File

@@ -12,7 +12,7 @@ import {DEBUG_WEBGL} from '../../../../index.js';
* @param {WebGLProgram} program Program. * @param {WebGLProgram} program Program.
* @struct * @struct
*/ */
const _ol_render_webgl_polygonreplay_defaultshader_Locations_ = function(gl, program) { const Locations = function(gl, program) {
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
@@ -51,4 +51,4 @@ const _ol_render_webgl_polygonreplay_defaultshader_Locations_ = function(gl, pro
program, DEBUG_WEBGL ? 'a_position' : 'a'); program, DEBUG_WEBGL ? 'a_position' : 'a');
}; };
export default _ol_render_webgl_polygonreplay_defaultshader_Locations_; export default Locations;

View File

@@ -1,4 +1,3 @@
//! NAMESPACE=_ol_render_webgl_texturereplay_defaultshader_
//! MODULE=ol/render/webgl/texturereplay/defaultshader //! MODULE=ol/render/webgl/texturereplay/defaultshader

View File

@@ -12,7 +12,7 @@ import {DEBUG_WEBGL} from '../../../../index.js';
* @param {WebGLProgram} program Program. * @param {WebGLProgram} program Program.
* @struct * @struct
*/ */
const _ol_render_webgl_texturereplay_defaultshader_Locations_ = function(gl, program) { const Locations = function(gl, program) {
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
@@ -75,4 +75,4 @@ const _ol_render_webgl_texturereplay_defaultshader_Locations_ = function(gl, pro
program, DEBUG_WEBGL ? 'a_rotateWithView' : 'g'); program, DEBUG_WEBGL ? 'a_rotateWithView' : 'g');
}; };
export default _ol_render_webgl_texturereplay_defaultshader_Locations_; export default Locations;

View File

@@ -7,7 +7,7 @@ import RenderEventType from '../../render/EventType.js';
import _ol_render_webgl_Immediate_ from '../../render/webgl/Immediate.js'; import _ol_render_webgl_Immediate_ from '../../render/webgl/Immediate.js';
import LayerRenderer from '../Layer.js'; import LayerRenderer from '../Layer.js';
import {fragment, vertex} from '../webgl/defaultmapshader.js'; import {fragment, vertex} from '../webgl/defaultmapshader.js';
import _ol_renderer_webgl_defaultmapshader_Locations_ from '../webgl/defaultmapshader/Locations.js'; import Locations from '../webgl/defaultmapshader/Locations.js';
import _ol_transform_ from '../../transform.js'; import _ol_transform_ from '../../transform.js';
import {create, fromTransform} from '../../vec/mat4.js'; import {create, fromTransform} from '../../vec/mat4.js';
import _ol_webgl_ from '../../webgl.js'; import _ol_webgl_ from '../../webgl.js';
@@ -155,7 +155,7 @@ WebGLLayerRenderer.prototype.composeFrame = function(frameState, layerState, con
let locations; let locations;
if (!this.defaultLocations_) { if (!this.defaultLocations_) {
locations = new _ol_renderer_webgl_defaultmapshader_Locations_(gl, program); locations = new Locations(gl, program);
this.defaultLocations_ = locations; this.defaultLocations_ = locations;
} else { } else {
locations = this.defaultLocations_; locations = this.defaultLocations_;

View File

@@ -14,7 +14,7 @@ import {roundUpToPowerOfTwo} from '../../math.js';
import RendererType from '../Type.js'; import RendererType from '../Type.js';
import WebGLLayerRenderer from '../webgl/Layer.js'; import WebGLLayerRenderer from '../webgl/Layer.js';
import {fragment, vertex} from '../webgl/tilelayershader.js'; import {fragment, vertex} from '../webgl/tilelayershader.js';
import _ol_renderer_webgl_tilelayershader_Locations_ from '../webgl/tilelayershader/Locations.js'; import Locations from '../webgl/tilelayershader/Locations.js';
import {toSize} from '../../size.js'; import {toSize} from '../../size.js';
import _ol_transform_ from '../../transform.js'; import _ol_transform_ from '../../transform.js';
import _ol_webgl_ from '../../webgl.js'; import _ol_webgl_ from '../../webgl.js';
@@ -223,7 +223,7 @@ WebGLTileLayerRenderer.prototype.prepareFrame = function(frameState, layerState,
const program = context.getProgram(this.fragmentShader_, this.vertexShader_); const program = context.getProgram(this.fragmentShader_, this.vertexShader_);
context.useProgram(program); context.useProgram(program);
if (!this.locations_) { if (!this.locations_) {
this.locations_ = new _ol_renderer_webgl_tilelayershader_Locations_(gl, program); this.locations_ = new Locations(gl, program);
} }
context.bindBuffer(_ol_webgl_.ARRAY_BUFFER, this.renderArrayBuffer_); context.bindBuffer(_ol_webgl_.ARRAY_BUFFER, this.renderArrayBuffer_);

View File

@@ -1,4 +1,3 @@
//! NAMESPACE=_ol_renderer_webgl_defaultmapshader_
//! MODULE=ol/renderer/webgl/defaultmapshader //! MODULE=ol/renderer/webgl/defaultmapshader

View File

@@ -12,7 +12,7 @@ import {DEBUG_WEBGL} from '../../../index.js';
* @param {WebGLProgram} program Program. * @param {WebGLProgram} program Program.
* @struct * @struct
*/ */
const _ol_renderer_webgl_defaultmapshader_Locations_ = function(gl, program) { const Locations = function(gl, program) {
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
@@ -51,4 +51,4 @@ const _ol_renderer_webgl_defaultmapshader_Locations_ = function(gl, program) {
program, DEBUG_WEBGL ? 'a_texCoord' : 'c'); program, DEBUG_WEBGL ? 'a_texCoord' : 'c');
}; };
export default _ol_renderer_webgl_defaultmapshader_Locations_; export default Locations;

View File

@@ -1,4 +1,3 @@
//! NAMESPACE=_ol_renderer_webgl_tilelayershader_
//! MODULE=ol/renderer/webgl/tilelayershader //! MODULE=ol/renderer/webgl/tilelayershader

View File

@@ -12,7 +12,7 @@ import {DEBUG_WEBGL} from '../../../index.js';
* @param {WebGLProgram} program Program. * @param {WebGLProgram} program Program.
* @struct * @struct
*/ */
const _ol_renderer_webgl_tilelayershader_Locations_ = function(gl, program) { const Locations = function(gl, program) {
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
@@ -39,4 +39,4 @@ const _ol_renderer_webgl_tilelayershader_Locations_ = function(gl, program) {
program, DEBUG_WEBGL ? 'a_texCoord' : 'c'); program, DEBUG_WEBGL ? 'a_texCoord' : 'c');
}; };
export default _ol_renderer_webgl_tilelayershader_Locations_; export default Locations;

View File

@@ -12,7 +12,7 @@ import {DEBUG_WEBGL} from '../../../../index.js';
* @param {WebGLProgram} program Program. * @param {WebGLProgram} program Program.
* @struct * @struct
*/ */
const {{namespace}}Locations_ = function(gl, program) { const Locations = function(gl, program) {
{{#uniforms}} {{#uniforms}}
/** /**
@@ -31,4 +31,4 @@ const {{namespace}}Locations_ = function(gl, program) {
{{/attributes}} {{/attributes}}
}; };
export default {{namespace}}Locations_; export default Locations;

View File

@@ -62,11 +62,6 @@ function main(argv) {
let m, shortName; let m, shortName;
lines.forEach(function(line, i) { lines.forEach(function(line, i) {
if (line.indexOf('//!') == 0) { if (line.indexOf('//!') == 0) {
m = line.match(/\/\/!\s+NAMESPACE=(\S+)\s*$/);
if (m) {
json.namespace = m[1];
return;
}
m = line.match(/\/\/!\s+MODULE=(\S+)\s*$/); m = line.match(/\/\/!\s+MODULE=(\S+)\s*$/);
if (m) { if (m) {
json.module = m[1]; json.module = m[1];

View File

@@ -3,7 +3,7 @@ import Feature from '../../../../../src/ol/Feature.js';
import Circle from '../../../../../src/ol/geom/Circle.js'; import Circle from '../../../../../src/ol/geom/Circle.js';
import WebGLCircleReplay from '../../../../../src/ol/render/webgl/CircleReplay.js'; import WebGLCircleReplay from '../../../../../src/ol/render/webgl/CircleReplay.js';
import {fragment, vertex} from '../../../../../src/ol/render/webgl/circlereplay/defaultshader.js'; import {fragment, vertex} from '../../../../../src/ol/render/webgl/circlereplay/defaultshader.js';
import _ol_render_webgl_circlereplay_defaultshader_Locations_ from '../../../../../src/ol/render/webgl/circlereplay/defaultshader/Locations.js'; import Locations from '../../../../../src/ol/render/webgl/circlereplay/defaultshader/Locations.js';
import Fill from '../../../../../src/ol/style/Fill.js'; import Fill from '../../../../../src/ol/style/Fill.js';
import Stroke from '../../../../../src/ol/style/Stroke.js'; import Stroke from '../../../../../src/ol/style/Stroke.js';
@@ -115,8 +115,7 @@ describe('ol.render.webgl.CircleReplay', function() {
it('returns the locations used by the shaders', function() { it('returns the locations used by the shaders', function() {
const locations = replay.setUpProgram(gl, context, [2, 2], 1); const locations = replay.setUpProgram(gl, context, [2, 2], 1);
expect(locations).to.be.a( expect(locations).to.be.a(Locations);
_ol_render_webgl_circlereplay_defaultshader_Locations_);
}); });
it('gets and compiles the shaders', function() { it('gets and compiles the shaders', function() {

View File

@@ -4,7 +4,7 @@ import LineString from '../../../../../src/ol/geom/LineString.js';
import MultiLineString from '../../../../../src/ol/geom/MultiLineString.js'; import MultiLineString from '../../../../../src/ol/geom/MultiLineString.js';
import WebGLLineStringReplay from '../../../../../src/ol/render/webgl/LineStringReplay.js'; import WebGLLineStringReplay from '../../../../../src/ol/render/webgl/LineStringReplay.js';
import {fragment, vertex} from '../../../../../src/ol/render/webgl/linestringreplay/defaultshader.js'; import {fragment, vertex} from '../../../../../src/ol/render/webgl/linestringreplay/defaultshader.js';
import _ol_render_webgl_linestringreplay_defaultshader_Locations_ from '../../../../../src/ol/render/webgl/linestringreplay/defaultshader/Locations.js'; import Locations from '../../../../../src/ol/render/webgl/linestringreplay/defaultshader/Locations.js';
import Stroke from '../../../../../src/ol/style/Stroke.js'; import Stroke from '../../../../../src/ol/style/Stroke.js';
describe('ol.render.webgl.LineStringReplay', function() { describe('ol.render.webgl.LineStringReplay', function() {
@@ -216,8 +216,7 @@ describe('ol.render.webgl.LineStringReplay', function() {
it('returns the locations used by the shaders', function() { it('returns the locations used by the shaders', function() {
const locations = replay.setUpProgram(gl, context, [2, 2], 1); const locations = replay.setUpProgram(gl, context, [2, 2], 1);
expect(locations).to.be.a( expect(locations).to.be.a(Locations);
_ol_render_webgl_linestringreplay_defaultshader_Locations_);
}); });
it('gets and compiles the shaders', function() { it('gets and compiles the shaders', function() {

View File

@@ -4,7 +4,7 @@ import MultiPolygon from '../../../../../src/ol/geom/MultiPolygon.js';
import Polygon from '../../../../../src/ol/geom/Polygon.js'; import Polygon from '../../../../../src/ol/geom/Polygon.js';
import WebGLPolygonReplay from '../../../../../src/ol/render/webgl/PolygonReplay.js'; import WebGLPolygonReplay from '../../../../../src/ol/render/webgl/PolygonReplay.js';
import {fragment, vertex} from '../../../../../src/ol/render/webgl/polygonreplay/defaultshader.js'; import {fragment, vertex} from '../../../../../src/ol/render/webgl/polygonreplay/defaultshader.js';
import _ol_render_webgl_polygonreplay_defaultshader_Locations_ from '../../../../../src/ol/render/webgl/polygonreplay/defaultshader/Locations.js'; import Locations from '../../../../../src/ol/render/webgl/polygonreplay/defaultshader/Locations.js';
import LinkedList from '../../../../../src/ol/structs/LinkedList.js'; import LinkedList from '../../../../../src/ol/structs/LinkedList.js';
import RBush from '../../../../../src/ol/structs/RBush.js'; import RBush from '../../../../../src/ol/structs/RBush.js';
import Fill from '../../../../../src/ol/style/Fill.js'; import Fill from '../../../../../src/ol/style/Fill.js';
@@ -337,8 +337,7 @@ describe('ol.render.webgl.PolygonReplay', function() {
it('returns the locations used by the shaders', function() { it('returns the locations used by the shaders', function() {
const locations = replay.setUpProgram(gl, context, [2, 2], 1); const locations = replay.setUpProgram(gl, context, [2, 2], 1);
expect(locations).to.be.a( expect(locations).to.be.a(Locations);
_ol_render_webgl_polygonreplay_defaultshader_Locations_);
}); });
it('gets and compiles the shaders', function() { it('gets and compiles the shaders', function() {

View File

@@ -1,6 +1,6 @@
import WebGLTextureReplay from '../../../../../src/ol/render/webgl/TextureReplay.js'; import WebGLTextureReplay from '../../../../../src/ol/render/webgl/TextureReplay.js';
import {fragment, vertex} from '../../../../../src/ol/render/webgl/texturereplay/defaultshader.js'; import {fragment, vertex} from '../../../../../src/ol/render/webgl/texturereplay/defaultshader.js';
import _ol_render_webgl_texturereplay_defaultshader_Locations_ from '../../../../../src/ol/render/webgl/texturereplay/defaultshader/Locations.js'; import Locations from '../../../../../src/ol/render/webgl/texturereplay/defaultshader/Locations.js';
describe('ol.render.webgl.TextureReplay', function() { describe('ol.render.webgl.TextureReplay', function() {
let replay; let replay;
@@ -30,8 +30,7 @@ describe('ol.render.webgl.TextureReplay', function() {
it('returns the locations used by the shaders', function() { it('returns the locations used by the shaders', function() {
const locations = replay.setUpProgram(gl, context, [2, 2], 1); const locations = replay.setUpProgram(gl, context, [2, 2], 1);
expect(locations).to.be.a( expect(locations).to.be.a(Locations);
_ol_render_webgl_texturereplay_defaultshader_Locations_);
}); });
it('gets and compiles the shaders', function() { it('gets and compiles the shaders', function() {