@openglobus/og 0.10.4 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/css/og.css +1 -1
  2. package/package.json +11 -9
  3. package/src/og/Extent.js +274 -273
  4. package/src/og/Globe.js +11 -3
  5. package/src/og/LonLat.js +152 -146
  6. package/src/og/Popup.js +2 -1
  7. package/src/og/camera/PlanetCamera.js +112 -38
  8. package/src/og/control/EarthNavigation.js +259 -0
  9. package/src/og/control/MouseNavigation.js +68 -40
  10. package/src/og/entity/EntityCollection.js +1 -1
  11. package/src/og/entity/LabelHandler.js +366 -74
  12. package/src/og/entity/Polyline.js +3 -2
  13. package/src/og/layer/CanvasTiles.js +32 -30
  14. package/src/og/layer/KML.js +159 -0
  15. package/src/og/layer/Vector.js +5 -0
  16. package/src/og/layer/index.js +2 -1
  17. package/src/og/math/Vec2.js +448 -448
  18. package/src/og/math/Vec3.js +759 -757
  19. package/src/og/math/Vec4.js +216 -215
  20. package/src/og/quadTree/Node.js +67 -13
  21. package/src/og/renderer/RendererEvents.js +21 -16
  22. package/src/og/scene/Planet.js +25 -10
  23. package/src/og/segment/Segment.js +3 -3
  24. package/src/og/segment/SegmentLonLat.js +7 -0
  25. package/src/og/terrain/GlobusTerrain.js +4 -0
  26. package/src/og/utils/FontAtlas.js +1 -0
  27. package/src/og/utils/GeoImageCreator.js +123 -121
  28. package/src/og/utils/Loader.js +81 -80
  29. package/src/og/utils/NormalMapCreator.js +320 -318
  30. package/src/og/utils/VectorTileCreator.js +251 -250
  31. package/src/og/webgl/Framebuffer.js +265 -264
  32. package/src/og/webgl/Handler.js +1022 -1001
  33. package/src/og/webgl/Multisample.js +169 -168
  34. package/src/og/webgl/ProgramController.js +113 -112
  35. package/types/Clock.d.ts +90 -0
  36. package/types/Deferred.d.ts +6 -0
  37. package/types/Events.d.ts +73 -0
  38. package/types/Extent.d.ts +162 -0
  39. package/types/Globe.d.ts +80 -0
  40. package/types/ImageCanvas.d.ts +121 -0
  41. package/types/Lock.d.ts +12 -0
  42. package/types/LonLat.d.ts +108 -0
  43. package/types/Popup.d.ts +38 -0
  44. package/types/QueueArray.d.ts +15 -0
  45. package/types/Rectangle.d.ts +74 -0
  46. package/types/Stack.d.ts +15 -0
  47. package/types/ajax.d.ts +24 -0
  48. package/types/arial.d.ts +48 -0
  49. package/types/astro/astro.d.ts +38 -0
  50. package/types/astro/earth.d.ts +6 -0
  51. package/types/astro/jd.d.ts +254 -0
  52. package/types/bv/Box.d.ts +25 -0
  53. package/types/bv/Sphere.d.ts +32 -0
  54. package/types/bv/index.d.ts +3 -0
  55. package/types/camera/Camera.d.ts +303 -0
  56. package/types/camera/Frustum.d.ts +129 -0
  57. package/types/camera/PlanetCamera.d.ts +222 -0
  58. package/types/camera/index.d.ts +3 -0
  59. package/types/cons.d.ts +40 -0
  60. package/types/control/CompassButton.d.ts +17 -0
  61. package/types/control/Control.d.ts +101 -0
  62. package/types/control/DebugInfo.d.ts +16 -0
  63. package/types/control/EarthCoordinates.d.ts +47 -0
  64. package/types/control/GeoImageDragControl.d.ts +6 -0
  65. package/types/control/KeyboardNavigation.d.ts +22 -0
  66. package/types/control/LayerSwitcher.d.ts +23 -0
  67. package/types/control/Lighting.d.ts +16 -0
  68. package/types/control/ScaleControl.d.ts +22 -0
  69. package/types/control/ShowFps.d.ts +12 -0
  70. package/types/control/SimpleNavigation.d.ts +28 -0
  71. package/types/control/Sun.d.ts +52 -0
  72. package/types/control/ToggleWireframe.d.ts +12 -0
  73. package/types/control/ZoomControl.d.ts +28 -0
  74. package/types/control/index.d.ts +15 -0
  75. package/types/ellipsoid/Ellipsoid.d.ts +142 -0
  76. package/types/ellipsoid/index.d.ts +3 -0
  77. package/types/ellipsoid/wgs84.d.ts +5 -0
  78. package/types/entity/BaseBillboard.d.ts +208 -0
  79. package/types/entity/Billboard.d.ts +94 -0
  80. package/types/entity/BillboardHandler.d.ts +74 -0
  81. package/types/entity/Entity.d.ts +330 -0
  82. package/types/entity/EntityCollection.d.ts +303 -0
  83. package/types/entity/Geometry.d.ts +72 -0
  84. package/types/entity/GeometryHandler.d.ts +76 -0
  85. package/types/entity/Label.d.ts +194 -0
  86. package/types/entity/LabelHandler.d.ts +24 -0
  87. package/types/entity/PointCloud.d.ts +174 -0
  88. package/types/entity/PointCloudHandler.d.ts +38 -0
  89. package/types/entity/Polyline.d.ts +303 -0
  90. package/types/entity/PolylineHandler.d.ts +18 -0
  91. package/types/entity/Ray.d.ts +123 -0
  92. package/types/entity/RayHandler.d.ts +67 -0
  93. package/types/entity/ShapeHandler.d.ts +22 -0
  94. package/types/entity/Strip.d.ts +118 -0
  95. package/types/entity/StripHandler.d.ts +38 -0
  96. package/types/entity/index.d.ts +8 -0
  97. package/types/index.core.d.ts +65 -0
  98. package/types/index.d.ts +45 -0
  99. package/types/index.webgl.d.ts +7 -0
  100. package/types/inherits.d.ts +4 -0
  101. package/types/input/input.d.ts +34 -0
  102. package/types/layer/BaseGeoImage.d.ts +106 -0
  103. package/types/layer/CanvasTiles.d.ts +75 -0
  104. package/types/layer/GeoImage.d.ts +65 -0
  105. package/types/layer/GeoTexture2d.d.ts +8 -0
  106. package/types/layer/GeoVideo.d.ts +80 -0
  107. package/types/layer/KML.d.ts +58 -0
  108. package/types/layer/WMS.d.ts +66 -0
  109. package/types/layer/XYZ.d.ts +126 -0
  110. package/types/layer/index.d.ts +10 -0
  111. package/types/light/LightSource.d.ts +177 -0
  112. package/types/math/Mat3.d.ts +53 -0
  113. package/types/math/Mat4.d.ts +157 -0
  114. package/types/math/Plane.d.ts +17 -0
  115. package/types/math/Vec2.d.ts +308 -0
  116. package/types/math/Vec3.d.ts +459 -0
  117. package/types/math/Vec4.d.ts +161 -0
  118. package/types/math/coder.d.ts +42 -0
  119. package/types/math/index.d.ts +11 -0
  120. package/types/math.d.ts +261 -0
  121. package/types/mercator.d.ts +92 -0
  122. package/types/proj/EPSG3857.d.ts +5 -0
  123. package/types/proj/EPSG4326.d.ts +5 -0
  124. package/types/quadTree/quadTree.d.ts +40 -0
  125. package/types/renderer/RendererEvents.d.ts +230 -0
  126. package/types/res/images.d.ts +3 -0
  127. package/types/scene/Axes.d.ts +11 -0
  128. package/types/scene/BaseNode.d.ts +60 -0
  129. package/types/scene/Planet.d.ts +572 -0
  130. package/types/scene/RenderNode.d.ts +143 -0
  131. package/types/scene/SkyBox.d.ts +10 -0
  132. package/types/scene/index.d.ts +4 -0
  133. package/types/segment/segmentHelper.d.ts +13 -0
  134. package/types/shaders/billboard.d.ts +3 -0
  135. package/types/shaders/depth.d.ts +2 -0
  136. package/types/shaders/drawnode.d.ts +7 -0
  137. package/types/shaders/label.d.ts +4 -0
  138. package/types/shaders/pointCloud.d.ts +2 -0
  139. package/types/shaders/polyline.d.ts +3 -0
  140. package/types/shaders/ray.d.ts +2 -0
  141. package/types/shaders/screenFrame.d.ts +2 -0
  142. package/types/shaders/shape.d.ts +4 -0
  143. package/types/shaders/skybox.d.ts +2 -0
  144. package/types/shaders/toneMapping.d.ts +2 -0
  145. package/types/shapes/BaseShape.d.ts +247 -0
  146. package/types/shapes/Sphere.d.ts +41 -0
  147. package/types/terrain/BilTerrain.d.ts +8 -0
  148. package/types/terrain/EmptyTerrain.d.ts +72 -0
  149. package/types/terrain/Geoid.d.ts +26 -0
  150. package/types/terrain/GlobusTerrain.d.ts +153 -0
  151. package/types/terrain/MapboxTerrain.d.ts +8 -0
  152. package/types/terrain/index.d.ts +5 -0
  153. package/types/utils/FontAtlas.d.ts +14 -0
  154. package/types/utils/GeoImageCreator.d.ts +29 -0
  155. package/types/utils/ImagesCacheManager.d.ts +10 -0
  156. package/types/utils/Loader.d.ts +25 -0
  157. package/types/utils/NormalMapCreator.d.ts +39 -0
  158. package/types/utils/PlainSegmentWorker.d.ts +10 -0
  159. package/types/utils/TerrainWorker.d.ts +9 -0
  160. package/types/utils/TextureAtlas.d.ts +111 -0
  161. package/types/utils/VectorTileCreator.d.ts +16 -0
  162. package/types/utils/colorTable.d.ts +143 -0
  163. package/types/utils/earcut.d.ts +6 -0
  164. package/types/utils/shared.d.ts +230 -0
  165. package/types/webgl/Framebuffer.d.ts +135 -0
  166. package/types/webgl/Handler.d.ts +372 -0
  167. package/types/webgl/Multisample.d.ts +89 -0
  168. package/types/webgl/Program.d.ts +155 -0
  169. package/types/webgl/ProgramController.d.ts +84 -0
  170. package/types/webgl/callbacks.d.ts +1 -0
  171. package/types/webgl/index.d.ts +6 -0
  172. package/types/webgl/types.d.ts +2 -0
@@ -4,53 +4,55 @@
4
4
 
5
5
  'use strict';
6
6
 
7
+ import { doubleToTwoFloats2 } from '../math/coder.js';
7
8
  import * as quadTree from '../quadTree/quadTree.js';
8
9
  import { Framebuffer } from '../webgl/Framebuffer.js';
9
10
  import { Program } from '../webgl/Program.js';
10
- import { doubleToTwoFloats2 } from '../math/coder.js';
11
11
 
12
12
  let tempArr = new Float32Array(2);
13
13
 
14
- const VectorTileCreator = function (planet, maxFrames, width, height) {
15
-
16
- this._width = width || 256;
17
- this._height = height || 256;
18
- this._handler = planet.renderer.handler;
19
- this._planet = planet;
20
- this._framebuffer = null;
21
- this.MAX_FRAMES = maxFrames || 5;
22
- this._currentFrame = 0;
23
- this._queue = [];
24
- this._initialize();
25
- };
26
-
27
- VectorTileCreator.prototype._initialize = function () {
28
-
29
- //Line
30
- if (!this._handler.programs.vectorTileLineRasterization) {
31
- this._handler.addProgram(new Program("vectorTileLineRasterization", {
32
- uniforms: {
33
- 'viewport': "vec2",
34
- 'thicknessOutline': "float",
35
- 'alpha': "float",
36
- 'extentParamsHigh': "vec4",
37
- 'extentParamsLow': "vec4"
38
- },
39
- attributes: {
40
- 'prevHigh': "vec2",
41
- 'currentHigh': "vec2",
42
- 'nextHigh': "vec2",
43
-
44
- 'prevLow': "vec2",
45
- 'currentLow': "vec2",
46
- 'nextLow': "vec2",
47
-
48
- 'order': "float",
49
- 'color': "vec4",
50
- 'thickness': "float"
51
- },
52
- vertexShader:
53
- `attribute vec2 prevHigh;
14
+ export class VectorTileCreator {
15
+
16
+ constructor(planet, maxFrames, width, height) {
17
+
18
+ this._width = width || 256;
19
+ this._height = height || 256;
20
+ this._handler = planet.renderer.handler;
21
+ this._planet = planet;
22
+ this._framebuffer = null;
23
+ this.MAX_FRAMES = maxFrames || 5;
24
+ this._currentFrame = 0;
25
+ this._queue = [];
26
+ this._initialize();
27
+ };
28
+
29
+ _initialize() {
30
+
31
+ //Line
32
+ if (!this._handler.programs.vectorTileLineRasterization) {
33
+ this._handler.addProgram(new Program("vectorTileLineRasterization", {
34
+ uniforms: {
35
+ 'viewport': "vec2",
36
+ 'thicknessOutline': "float",
37
+ 'alpha': "float",
38
+ 'extentParamsHigh': "vec4",
39
+ 'extentParamsLow': "vec4"
40
+ },
41
+ attributes: {
42
+ 'prevHigh': "vec2",
43
+ 'currentHigh': "vec2",
44
+ 'nextHigh': "vec2",
45
+
46
+ 'prevLow': "vec2",
47
+ 'currentLow': "vec2",
48
+ 'nextLow': "vec2",
49
+
50
+ 'order': "float",
51
+ 'color': "vec4",
52
+ 'thickness': "float"
53
+ },
54
+ vertexShader:
55
+ `attribute vec2 prevHigh;
54
56
  attribute vec2 currentHigh;
55
57
  attribute vec2 nextHigh;
56
58
 
@@ -133,29 +135,29 @@ VectorTileCreator.prototype._initialize = function () {
133
135
  }
134
136
  gl_Position = vec4(m.x, m.y, 0.0, 1.0);
135
137
  }`,
136
- fragmentShader: `precision highp float;
138
+ fragmentShader: `precision highp float;
137
139
  uniform float alpha;
138
140
  varying vec4 vColor;
139
141
  void main() {
140
142
  gl_FragColor = vec4(vColor.rgb, alpha * vColor.a);
141
143
  }`
142
- }));
143
- }
144
-
145
- //Polygon
146
- if (!this._handler.programs.vectorTilePolygonRasterization) {
147
- this._handler.addProgram(new Program("vectorTilePolygonRasterization", {
148
- uniforms: {
149
- 'extentParamsHigh': "vec4",
150
- 'extentParamsLow': "vec4"
151
- },
152
- attributes: {
153
- 'coordinatesHigh': "vec2",
154
- 'coordinatesLow': "vec2",
155
- 'colors': "vec4"
156
- },
157
- vertexShader:
158
- `attribute vec2 coordinatesHigh;
144
+ }));
145
+ }
146
+
147
+ //Polygon
148
+ if (!this._handler.programs.vectorTilePolygonRasterization) {
149
+ this._handler.addProgram(new Program("vectorTilePolygonRasterization", {
150
+ uniforms: {
151
+ 'extentParamsHigh': "vec4",
152
+ 'extentParamsLow': "vec4"
153
+ },
154
+ attributes: {
155
+ 'coordinatesHigh': "vec2",
156
+ 'coordinatesLow': "vec2",
157
+ 'colors': "vec4"
158
+ },
159
+ vertexShader:
160
+ `attribute vec2 coordinatesHigh;
159
161
  attribute vec2 coordinatesLow;
160
162
  attribute vec4 colors;
161
163
  uniform vec4 extentParamsHigh;
@@ -172,244 +174,243 @@ VectorTileCreator.prototype._initialize = function () {
172
174
  color = colors;
173
175
  gl_Position = vec4(proj(coordinatesHigh, coordinatesLow), 0.0, 1.0);
174
176
  }`,
175
- fragmentShader:
176
- `precision highp float;
177
+ fragmentShader:
178
+ `precision highp float;
177
179
  varying vec4 color;
178
180
  void main () {
179
181
  gl_FragColor = color;
180
182
  }`
181
- }));
182
- }
183
+ }));
184
+ }
183
185
 
184
- this._framebuffer = new Framebuffer(this._handler, {
185
- width: this._width,
186
- height: this._height,
187
- useDepth: false
188
- });
189
- this._framebuffer.init();
190
- };
186
+ this._framebuffer = new Framebuffer(this._handler, {
187
+ width: this._width,
188
+ height: this._height,
189
+ useDepth: false
190
+ });
191
+ this._framebuffer.init();
192
+ };
191
193
 
192
- VectorTileCreator.prototype.frame = function () {
193
- if (this._planet.layerLock.isFree() && this._queue.length) {
194
- var h = this._handler,
195
- gl = h.gl;
194
+ frame() {
195
+ if (this._planet.layerLock.isFree() && this._queue.length) {
196
+ var h = this._handler,
197
+ gl = h.gl;
196
198
 
197
- gl.disable(gl.CULL_FACE);
198
- gl.disable(gl.DEPTH_TEST);
199
- gl.enable(gl.BLEND);
200
- gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD);
201
- gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
199
+ gl.disable(gl.CULL_FACE);
200
+ gl.disable(gl.DEPTH_TEST);
201
+ gl.enable(gl.BLEND);
202
+ gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD);
203
+ gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
202
204
 
203
- var hLine = h.programs.vectorTileLineRasterization,
204
- hPoly = h.programs.vectorTilePolygonRasterization;
205
+ var hLine = h.programs.vectorTileLineRasterization,
206
+ hPoly = h.programs.vectorTilePolygonRasterization;
205
207
 
206
- var _w = this._width,
207
- _h = this._height,
208
- width = _w,
209
- height = _h,
210
- _w2 = width << 1,
211
- _h2 = height << 1;
208
+ var _w = this._width,
209
+ _h = this._height,
210
+ width = _w,
211
+ height = _h,
212
+ _w2 = width << 1,
213
+ _h2 = height << 1;
212
214
 
213
- var pickingMask = null,
214
- texture = null;
215
+ var pickingMask = null,
216
+ texture = null;
215
217
 
216
- // var prevLayerId = -1;
218
+ // var prevLayerId = -1;
217
219
 
218
- var extentParams = new Float32Array(4);
220
+ var extentParams = new Float32Array(4);
219
221
 
220
- var extentParamsHigh = new Float32Array(4);
221
- var extentParamsLow = new Float32Array(4);
222
+ var extentParamsHigh = new Float32Array(4);
223
+ var extentParamsLow = new Float32Array(4);
222
224
 
223
- var f = this._framebuffer.activate();
225
+ var f = this._framebuffer.activate();
224
226
 
225
- var deltaTime = 0,
226
- startTime = window.performance.now();
227
+ var deltaTime = 0,
228
+ startTime = window.performance.now();
227
229
 
228
- while (this._planet.layerLock.isFree() && this._queue.length && deltaTime < 0.25) {
229
- var material = this._queue.shift();
230
- if (material.isLoading && material.segment.node.getState() === quadTree.RENDERING) {
230
+ while (this._planet.layerLock.isFree() && this._queue.length && deltaTime < 0.25) {
231
+ var material = this._queue.shift();
232
+ if (material.isLoading && material.segment.node.getState() === quadTree.RENDERING) {
231
233
 
232
- if (material.segment.tileZoom <= 3) {
233
- width = _w2;
234
- height = _h2;
235
- } else {
236
- width = _w;
237
- height = _h;
238
- }
234
+ if (material.segment.tileZoom <= 3) {
235
+ width = _w2;
236
+ height = _h2;
237
+ } else {
238
+ width = _w;
239
+ height = _h;
240
+ }
239
241
 
240
- texture = (material._updateTexture && material._updateTexture) || h.createEmptyTexture_l(width, height);
242
+ texture = (material._updateTexture && material._updateTexture) || h.createEmptyTexture_l(width, height);
241
243
 
242
- f.setSize(width, height);
244
+ f.setSize(width, height);
243
245
 
244
- f.bindOutputTexture(texture);
246
+ f.bindOutputTexture(texture);
245
247
 
246
- gl.clearColor(1.0, 1.0, 1.0, 0.0);
247
- gl.clear(gl.COLOR_BUFFER_BIT);
248
+ gl.clearColor(1.0, 1.0, 1.0, 0.0);
249
+ gl.clear(gl.COLOR_BUFFER_BIT);
248
250
 
249
- var extent = material.segment.getExtentMerc();
251
+ var extent = material.segment.getExtentMerc();
250
252
 
251
- doubleToTwoFloats2(extent.southWest.lon, tempArr);
252
- extentParamsHigh[0] = tempArr[0];
253
- extentParamsLow[0] = tempArr[1];
253
+ doubleToTwoFloats2(extent.southWest.lon, tempArr);
254
+ extentParamsHigh[0] = tempArr[0];
255
+ extentParamsLow[0] = tempArr[1];
254
256
 
255
- doubleToTwoFloats2(extent.southWest.lat, tempArr);
256
- extentParamsHigh[1] = tempArr[0];
257
- extentParamsLow[1] = tempArr[1];
257
+ doubleToTwoFloats2(extent.southWest.lat, tempArr);
258
+ extentParamsHigh[1] = tempArr[0];
259
+ extentParamsLow[1] = tempArr[1];
258
260
 
259
- extentParamsHigh[2] = 2.0 / extent.getWidth();
260
- extentParamsHigh[3] = 2.0 / extent.getHeight();
261
+ extentParamsHigh[2] = 2.0 / extent.getWidth();
262
+ extentParamsHigh[3] = 2.0 / extent.getHeight();
261
263
 
262
- hPoly.activate();
263
- var sh = hPoly._program;
264
- var sha = sh.attributes,
265
- shu = sh.uniforms;
264
+ hPoly.activate();
265
+ var sh = hPoly._program;
266
+ var sha = sh.attributes,
267
+ shu = sh.uniforms;
268
+
269
+ var geomHandler = material.layer._geometryHandler;
266
270
 
267
- var geomHandler = material.layer._geometryHandler;
271
+ //=========================================
272
+ //Polygon rendering
273
+ //=========================================
274
+ gl.uniform4fv(shu.extentParamsHigh, extentParamsHigh);
275
+ gl.uniform4fv(shu.extentParamsLow, extentParamsLow);
268
276
 
269
- //=========================================
270
- //Polygon rendering
271
- //=========================================
272
- gl.uniform4fv(shu.extentParamsHigh, extentParamsHigh);
273
- gl.uniform4fv(shu.extentParamsLow, extentParamsLow);
277
+ gl.bindBuffer(gl.ARRAY_BUFFER, geomHandler._polyVerticesHighBufferMerc);
278
+ gl.vertexAttribPointer(sha.coordinatesHigh, geomHandler._polyVerticesHighBufferMerc.itemSize, gl.FLOAT, false, 0, 0);
274
279
 
275
- gl.bindBuffer(gl.ARRAY_BUFFER, geomHandler._polyVerticesHighBufferMerc);
276
- gl.vertexAttribPointer(sha.coordinatesHigh, geomHandler._polyVerticesHighBufferMerc.itemSize, gl.FLOAT, false, 0, 0);
280
+ gl.bindBuffer(gl.ARRAY_BUFFER, geomHandler._polyVerticesLowBufferMerc);
281
+ gl.vertexAttribPointer(sha.coordinatesLow, geomHandler._polyVerticesLowBufferMerc.itemSize, gl.FLOAT, false, 0, 0);
277
282
 
278
- gl.bindBuffer(gl.ARRAY_BUFFER, geomHandler._polyVerticesLowBufferMerc);
279
- gl.vertexAttribPointer(sha.coordinatesLow, geomHandler._polyVerticesLowBufferMerc.itemSize, gl.FLOAT, false, 0, 0);
283
+ gl.bindBuffer(gl.ARRAY_BUFFER, geomHandler._polyColorsBuffer);
284
+ gl.vertexAttribPointer(sha.colors, geomHandler._polyColorsBuffer.itemSize, gl.FLOAT, false, 0, 0);
280
285
 
281
- gl.bindBuffer(gl.ARRAY_BUFFER, geomHandler._polyColorsBuffer);
282
- gl.vertexAttribPointer(sha.colors, geomHandler._polyColorsBuffer.itemSize, gl.FLOAT, false, 0, 0);
286
+ gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, geomHandler._polyIndexesBuffer);
283
287
 
284
- gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, geomHandler._polyIndexesBuffer);
288
+ gl.drawElements(gl.TRIANGLES, geomHandler._polyIndexesBuffer.numItems, gl.UNSIGNED_INT, 0);
285
289
 
286
- gl.drawElements(gl.TRIANGLES, geomHandler._polyIndexesBuffer.numItems, gl.UNSIGNED_INT, 0);
290
+ //Polygon picking PASS
291
+ if (material.layer._pickingEnabled) {
292
+ if (!material.pickingReady) {
293
+ if (material._updatePickingMask) {
294
+ pickingMask = material._updatePickingMask;
295
+ } else {
296
+ pickingMask = h.createEmptyTexture_n(width, height);
297
+ }
298
+
299
+ f.bindOutputTexture(pickingMask);
300
+
301
+ gl.clearColor(0.0, 0.0, 0.0, 0.0);
302
+ gl.clear(gl.COLOR_BUFFER_BIT);
287
303
 
288
- //Polygon picking PASS
289
- if (material.layer._pickingEnabled) {
290
- if (!material.pickingReady) {
291
- if (material._updatePickingMask) {
292
- pickingMask = material._updatePickingMask;
304
+ gl.bindBuffer(gl.ARRAY_BUFFER, geomHandler._polyPickingColorsBuffer);
305
+ gl.vertexAttribPointer(sha.colors, geomHandler._polyPickingColorsBuffer.itemSize, gl.FLOAT, false, 0, 0);
306
+
307
+ gl.drawElements(gl.TRIANGLES, geomHandler._polyIndexesBuffer.numItems, gl.UNSIGNED_INT, 0);
293
308
  } else {
294
- pickingMask = h.createEmptyTexture_n(width, height);
309
+ pickingMask = material.pickingMask;
295
310
  }
311
+ }
296
312
 
297
- f.bindOutputTexture(pickingMask);
313
+ //=========================================
314
+ //Strokes and linestrings rendering
315
+ //=========================================
316
+ f.bindOutputTexture(texture);
298
317
 
299
- gl.clearColor(0.0, 0.0, 0.0, 0.0);
300
- gl.clear(gl.COLOR_BUFFER_BIT);
318
+ hLine.activate();
319
+ sh = hLine._program;
320
+ sha = sh.attributes;
321
+ shu = sh.uniforms;
301
322
 
302
- gl.bindBuffer(gl.ARRAY_BUFFER, geomHandler._polyPickingColorsBuffer);
303
- gl.vertexAttribPointer(sha.colors, geomHandler._polyPickingColorsBuffer.itemSize, gl.FLOAT, false, 0, 0);
323
+ gl.uniform2fv(shu.viewport, [width, height]);
304
324
 
305
- gl.drawElements(gl.TRIANGLES, geomHandler._polyIndexesBuffer.numItems, gl.UNSIGNED_INT, 0);
306
- } else {
307
- pickingMask = material.pickingMask;
308
- }
309
- }
325
+ gl.uniform4fv(shu.extentParamsHigh, extentParamsHigh);
326
+ gl.uniform4fv(shu.extentParamsLow, extentParamsLow);
327
+
328
+ //vertex
329
+ var mb = geomHandler._lineVerticesHighBufferMerc;
330
+ gl.bindBuffer(gl.ARRAY_BUFFER, mb);
310
331
 
311
- //=========================================
312
- //Strokes and linestrings rendering
313
- //=========================================
314
- f.bindOutputTexture(texture);
315
-
316
- hLine.activate();
317
- sh = hLine._program;
318
- sha = sh.attributes;
319
- shu = sh.uniforms;
320
-
321
- gl.uniform2fv(shu.viewport, [width, height]);
322
-
323
- gl.uniform4fv(shu.extentParamsHigh, extentParamsHigh);
324
- gl.uniform4fv(shu.extentParamsLow, extentParamsLow);
325
-
326
- //vertex
327
- var mb = geomHandler._lineVerticesHighBufferMerc;
328
- gl.bindBuffer(gl.ARRAY_BUFFER, mb);
329
-
330
- gl.vertexAttribPointer(sha.prevHigh, mb.itemSize, gl.FLOAT, false, 8, 0);
331
- gl.vertexAttribPointer(sha.currentHigh, mb.itemSize, gl.FLOAT, false, 8, 32);
332
- gl.vertexAttribPointer(sha.nextHigh, mb.itemSize, gl.FLOAT, false, 8, 64);
333
-
334
- mb = geomHandler._lineVerticesLowBufferMerc;
335
- gl.bindBuffer(gl.ARRAY_BUFFER, mb);
336
-
337
- gl.vertexAttribPointer(sha.prevLow, mb.itemSize, gl.FLOAT, false, 8, 0);
338
- gl.vertexAttribPointer(sha.currentLow, mb.itemSize, gl.FLOAT, false, 8, 32);
339
- gl.vertexAttribPointer(sha.nextLow, mb.itemSize, gl.FLOAT, false, 8, 64);
340
-
341
- //order
342
- gl.bindBuffer(gl.ARRAY_BUFFER, geomHandler._lineOrdersBuffer);
343
- gl.vertexAttribPointer(sha.order, geomHandler._lineOrdersBuffer.itemSize, gl.FLOAT, false, 4, 0);
344
-
345
- gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, geomHandler._lineIndexesBuffer);
346
-
347
- //PASS - stroke
348
- gl.bindBuffer(gl.ARRAY_BUFFER, geomHandler._lineStrokesBuffer);
349
- gl.vertexAttribPointer(sha.thickness, geomHandler._lineStrokesBuffer.itemSize, gl.FLOAT, false, 0, 0);
350
-
351
- gl.bindBuffer(gl.ARRAY_BUFFER, geomHandler._lineStrokeColorsBuffer);
352
- gl.vertexAttribPointer(sha.color, geomHandler._lineStrokeColorsBuffer.itemSize, gl.FLOAT, false, 0, 0);
353
-
354
- //Antialias pass
355
- gl.uniform1f(shu.thicknessOutline, 2);
356
- gl.uniform1f(shu.alpha, 0.54);
357
- gl.drawElements(gl.TRIANGLE_STRIP, geomHandler._lineIndexesBuffer.numItems, gl.UNSIGNED_INT, 0);
358
- //
359
- //Aliased pass
360
- gl.uniform1f(shu.thicknessOutline, 1);
361
- gl.uniform1f(shu.alpha, 1.0);
362
- gl.drawElements(gl.TRIANGLE_STRIP, geomHandler._lineIndexesBuffer.numItems, gl.UNSIGNED_INT, 0);
363
-
364
- //PASS - inside line
365
- gl.bindBuffer(gl.ARRAY_BUFFER, geomHandler._lineThicknessBuffer);
366
- gl.vertexAttribPointer(sha.thickness, geomHandler._lineThicknessBuffer.itemSize, gl.FLOAT, false, 0, 0);
367
-
368
- gl.bindBuffer(gl.ARRAY_BUFFER, geomHandler._lineColorsBuffer);
369
- gl.vertexAttribPointer(sha.color, geomHandler._lineColorsBuffer.itemSize, gl.FLOAT, false, 0, 0);
370
-
371
- //Antialias pass
372
- gl.uniform1f(shu.thicknessOutline, 2);
373
- gl.uniform1f(shu.alpha, 0.54);
374
- gl.drawElements(gl.TRIANGLE_STRIP, geomHandler._lineIndexesBuffer.numItems, gl.UNSIGNED_INT, 0);
375
- //
376
- //Aliased pass
377
- gl.uniform1f(shu.thicknessOutline, 1);
378
- gl.uniform1f(shu.alpha, 1.0);
379
- gl.drawElements(gl.TRIANGLE_STRIP, geomHandler._lineIndexesBuffer.numItems, gl.UNSIGNED_INT, 0);
380
-
381
- if (material.layer._pickingEnabled && !material.pickingReady) {
382
- f.bindOutputTexture(pickingMask);
383
- gl.uniform1f(shu.thicknessOutline, 8);
384
- gl.bindBuffer(gl.ARRAY_BUFFER, geomHandler._linePickingColorsBuffer);
385
- gl.vertexAttribPointer(sha.color, geomHandler._linePickingColorsBuffer.itemSize, gl.FLOAT, false, 0, 0);
332
+ gl.vertexAttribPointer(sha.prevHigh, mb.itemSize, gl.FLOAT, false, 8, 0);
333
+ gl.vertexAttribPointer(sha.currentHigh, mb.itemSize, gl.FLOAT, false, 8, 32);
334
+ gl.vertexAttribPointer(sha.nextHigh, mb.itemSize, gl.FLOAT, false, 8, 64);
335
+
336
+ mb = geomHandler._lineVerticesLowBufferMerc;
337
+ gl.bindBuffer(gl.ARRAY_BUFFER, mb);
338
+
339
+ gl.vertexAttribPointer(sha.prevLow, mb.itemSize, gl.FLOAT, false, 8, 0);
340
+ gl.vertexAttribPointer(sha.currentLow, mb.itemSize, gl.FLOAT, false, 8, 32);
341
+ gl.vertexAttribPointer(sha.nextLow, mb.itemSize, gl.FLOAT, false, 8, 64);
342
+
343
+ //order
344
+ gl.bindBuffer(gl.ARRAY_BUFFER, geomHandler._lineOrdersBuffer);
345
+ gl.vertexAttribPointer(sha.order, geomHandler._lineOrdersBuffer.itemSize, gl.FLOAT, false, 4, 0);
346
+
347
+ gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, geomHandler._lineIndexesBuffer);
348
+
349
+ //PASS - stroke
350
+ gl.bindBuffer(gl.ARRAY_BUFFER, geomHandler._lineStrokesBuffer);
351
+ gl.vertexAttribPointer(sha.thickness, geomHandler._lineStrokesBuffer.itemSize, gl.FLOAT, false, 0, 0);
352
+
353
+ gl.bindBuffer(gl.ARRAY_BUFFER, geomHandler._lineStrokeColorsBuffer);
354
+ gl.vertexAttribPointer(sha.color, geomHandler._lineStrokeColorsBuffer.itemSize, gl.FLOAT, false, 0, 0);
355
+
356
+ //Antialias pass
357
+ gl.uniform1f(shu.thicknessOutline, 2);
358
+ gl.uniform1f(shu.alpha, 0.54);
359
+ gl.drawElements(gl.TRIANGLE_STRIP, geomHandler._lineIndexesBuffer.numItems, gl.UNSIGNED_INT, 0);
360
+ //
361
+ //Aliased pass
362
+ gl.uniform1f(shu.thicknessOutline, 1);
363
+ gl.uniform1f(shu.alpha, 1.0);
386
364
  gl.drawElements(gl.TRIANGLE_STRIP, geomHandler._lineIndexesBuffer.numItems, gl.UNSIGNED_INT, 0);
387
- }
388
365
 
389
- material.applyTexture(texture, pickingMask);
366
+ //PASS - inside line
367
+ gl.bindBuffer(gl.ARRAY_BUFFER, geomHandler._lineThicknessBuffer);
368
+ gl.vertexAttribPointer(sha.thickness, geomHandler._lineThicknessBuffer.itemSize, gl.FLOAT, false, 0, 0);
390
369
 
391
- } else {
392
- material.isLoading = false;
393
- }
370
+ gl.bindBuffer(gl.ARRAY_BUFFER, geomHandler._lineColorsBuffer);
371
+ gl.vertexAttribPointer(sha.color, geomHandler._lineColorsBuffer.itemSize, gl.FLOAT, false, 0, 0);
394
372
 
395
- deltaTime = window.performance.now() - startTime;
396
- // prevLayerId = material.layer._id;
397
- }
373
+ //Antialias pass
374
+ gl.uniform1f(shu.thicknessOutline, 2);
375
+ gl.uniform1f(shu.alpha, 0.54);
376
+ gl.drawElements(gl.TRIANGLE_STRIP, geomHandler._lineIndexesBuffer.numItems, gl.UNSIGNED_INT, 0);
377
+ //
378
+ //Aliased pass
379
+ gl.uniform1f(shu.thicknessOutline, 1);
380
+ gl.uniform1f(shu.alpha, 1.0);
381
+ gl.drawElements(gl.TRIANGLE_STRIP, geomHandler._lineIndexesBuffer.numItems, gl.UNSIGNED_INT, 0);
398
382
 
399
- gl.disable(gl.BLEND);
400
- gl.enable(gl.DEPTH_TEST);
401
- gl.enable(gl.CULL_FACE);
383
+ if (material.layer._pickingEnabled && !material.pickingReady) {
384
+ f.bindOutputTexture(pickingMask);
385
+ gl.uniform1f(shu.thicknessOutline, 8);
386
+ gl.bindBuffer(gl.ARRAY_BUFFER, geomHandler._linePickingColorsBuffer);
387
+ gl.vertexAttribPointer(sha.color, geomHandler._linePickingColorsBuffer.itemSize, gl.FLOAT, false, 0, 0);
388
+ gl.drawElements(gl.TRIANGLE_STRIP, geomHandler._lineIndexesBuffer.numItems, gl.UNSIGNED_INT, 0);
389
+ }
402
390
 
403
- f.deactivate();
404
- }
405
- };
391
+ material.applyTexture(texture, pickingMask);
406
392
 
407
- VectorTileCreator.prototype.add = function (material) {
408
- this._queue.push(material);
409
- };
393
+ } else {
394
+ material.isLoading = false;
395
+ }
396
+
397
+ deltaTime = window.performance.now() - startTime;
398
+ // prevLayerId = material.layer._id;
399
+ }
400
+
401
+ gl.disable(gl.BLEND);
402
+ gl.enable(gl.DEPTH_TEST);
403
+ gl.enable(gl.CULL_FACE);
404
+
405
+ f.deactivate();
406
+ }
407
+ };
410
408
 
411
- VectorTileCreator.prototype.remove = function (material) {
412
- //...
413
- };
409
+ add(material) {
410
+ this._queue.push(material);
411
+ };
414
412
 
415
- export { VectorTileCreator };
413
+ remove(material) {
414
+ //...
415
+ };
416
+ }