@openglobus/og 0.13.0 → 0.13.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openglobus/og",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "[OpenGlobus](http://www.openglobus.org/) is a javascript library designed to display interactive 3d maps and planets with map tiles, imagery and vector data, markers and 3d objects. It uses the WebGL technology, open source and completely free.",
5
5
  "directories": {
6
6
  "example": "./sandbox"
@@ -302,12 +302,11 @@ export function label_screen() {
302
302
  attribute vec4 a_rgba;
303
303
  attribute float a_fontIndex;
304
304
 
305
+ varying float v_outline;
306
+ varying float v_isOutlinePass;
305
307
  varying vec2 v_uv;
306
308
  varying vec4 v_rgba;
307
309
  varying float v_fontIndex;
308
- varying vec4 v_outlineColor;
309
- varying float v_outline;
310
- varying float v_isOutlinePass;
311
310
 
312
311
  uniform vec2 viewport;
313
312
  uniform mat4 viewMatrix;
@@ -338,12 +337,12 @@ export function label_screen() {
338
337
 
339
338
  v_outline = a_outline;
340
339
  v_isOutlinePass = float(isOutlinePass);
341
-
342
- v_fontIndex = a_fontIndex;
343
340
  v_uv = vec2(a_texCoord.xy);
341
+ v_rgba = a_rgba;
342
+ v_fontIndex = a_fontIndex;
343
+
344
344
  vec3 look = a_positions - cameraPos;
345
345
  float lookDist = length(look);
346
- v_rgba = a_rgba;
347
346
 
348
347
  if(opacity * step(lookDist, sqrt(dot(cameraPos,cameraPos) - planetRadius) + sqrt(dot(a_positions,a_positions) - planetRadius)) == 0.0){
349
348
  return;
@@ -393,15 +392,13 @@ export function label_screen() {
393
392
  uniform sampler2D fontTextureArr[MAX_SIZE];
394
393
  uniform vec4 sdfParamsArr[MAX_SIZE];
395
394
 
395
+ varying float v_outline;
396
396
  varying float v_isOutlinePass;
397
-
398
- varying float v_fontIndex;
399
397
  varying vec2 v_uv;
400
398
  varying vec4 v_rgba;
401
-
402
- varying float v_outline;
403
-
404
- varying vec3 v_pickingColor;
399
+ varying float v_fontIndex;
400
+
401
+ float fontIndex;
405
402
 
406
403
  float median(float r, float g, float b) {
407
404
  return max(min(r, g), min(max(r, g), b));
@@ -409,27 +406,27 @@ export function label_screen() {
409
406
 
410
407
  float getDistance() {
411
408
  vec3 msdf;
412
- if(v_fontIndex >= 0.0 && v_fontIndex < 1.0) {
409
+ if(fontIndex >= 0.0 && fontIndex < 1.0) {
413
410
  msdf = texture2D(fontTextureArr[0], v_uv).rgb;
414
- } else if(v_fontIndex >= 1.0 && v_fontIndex < 2.0){
411
+ } else if(fontIndex >= 1.0 && fontIndex < 2.0){
415
412
  msdf = texture2D(fontTextureArr[1], v_uv).rgb;
416
- } else if(v_fontIndex >= 2.0 && v_fontIndex < 3.0){
413
+ } else if(fontIndex >= 2.0 && fontIndex < 3.0){
417
414
  msdf = texture2D(fontTextureArr[2], v_uv).rgb;
418
- } else if(v_fontIndex >= 3.0 && v_fontIndex < 4.0){
415
+ } else if(fontIndex >= 3.0 && fontIndex < 4.0){
419
416
  msdf = texture2D(fontTextureArr[3], v_uv).rgb;
420
- } else if(v_fontIndex >= 4.0 && v_fontIndex < 5.0){
417
+ } else if(fontIndex >= 4.0 && fontIndex < 5.0){
421
418
  msdf = texture2D(fontTextureArr[4], v_uv).rgb;
422
- } else if(v_fontIndex >= 5.0 && v_fontIndex < 6.0){
419
+ } else if(fontIndex >= 5.0 && fontIndex < 6.0){
423
420
  msdf = texture2D(fontTextureArr[5], v_uv).rgb;
424
- } else if(v_fontIndex >= 6.0 && v_fontIndex < 7.0){
421
+ } else if(fontIndex >= 6.0 && fontIndex < 7.0){
425
422
  msdf = texture2D(fontTextureArr[6], v_uv).rgb;
426
- } else if(v_fontIndex >= 7.0 && v_fontIndex < 8.0){
423
+ } else if(fontIndex >= 7.0 && fontIndex < 8.0){
427
424
  msdf = texture2D(fontTextureArr[7], v_uv).rgb;
428
- } else if(v_fontIndex >= 8.0 && v_fontIndex < 9.0){
425
+ } else if(fontIndex >= 8.0 && fontIndex < 9.0){
429
426
  msdf = texture2D(fontTextureArr[8], v_uv).rgb;
430
- } else if(v_fontIndex >= 9.0 && v_fontIndex < 10.0){
427
+ } else if(fontIndex >= 9.0 && fontIndex < 10.0){
431
428
  msdf = texture2D(fontTextureArr[9], v_uv).rgb;
432
- } else if(v_fontIndex >= 10.0 && v_fontIndex < 11.0){
429
+ } else if(fontIndex >= 10.0 && fontIndex < 11.0){
433
430
  msdf = texture2D(fontTextureArr[10], v_uv).rgb;
434
431
  }
435
432
  return median(msdf.r, msdf.g, msdf.b);
@@ -437,33 +434,35 @@ export function label_screen() {
437
434
 
438
435
 
439
436
  vec4 getSDFParams() {
440
- if(v_fontIndex >= 0.0 && v_fontIndex < 1.0) {
437
+ if(fontIndex >= 0.0 && fontIndex < 1.0) {
441
438
  return sdfParamsArr[0];
442
- } else if(v_fontIndex >= 1.0 && v_fontIndex < 2.0){
439
+ } else if(fontIndex >= 1.0 && fontIndex < 2.0){
443
440
  return sdfParamsArr[1];
444
- } else if(v_fontIndex >= 2.0 && v_fontIndex < 3.0){
441
+ } else if(fontIndex >= 2.0 && fontIndex < 3.0){
445
442
  return sdfParamsArr[2];
446
- } else if(v_fontIndex >= 3.0 && v_fontIndex < 4.0){
443
+ } else if(fontIndex >= 3.0 && fontIndex < 4.0){
447
444
  return sdfParamsArr[3];
448
- } else if(v_fontIndex >= 4.0 && v_fontIndex < 5.0){
445
+ } else if(fontIndex >= 4.0 && fontIndex < 5.0){
449
446
  return sdfParamsArr[4];
450
- } else if(v_fontIndex >= 5.0 && v_fontIndex < 6.0){
447
+ } else if(fontIndex >= 5.0 && fontIndex < 6.0){
451
448
  return sdfParamsArr[5];
452
- } else if(v_fontIndex >= 6.0 && v_fontIndex < 7.0){
449
+ } else if(fontIndex >= 6.0 && fontIndex < 7.0){
453
450
  return sdfParamsArr[6];
454
- } else if(v_fontIndex >= 7.0 && v_fontIndex < 8.0){
451
+ } else if(fontIndex >= 7.0 && fontIndex < 8.0){
455
452
  return sdfParamsArr[7];
456
- } else if(v_fontIndex >= 8.0 && v_fontIndex < 9.0){
453
+ } else if(fontIndex >= 8.0 && fontIndex < 9.0){
457
454
  return sdfParamsArr[8];
458
- } else if(v_fontIndex >= 9.0 && v_fontIndex < 10.0){
455
+ } else if(fontIndex >= 9.0 && fontIndex < 10.0){
459
456
  return sdfParamsArr[9];
460
- } else if(v_fontIndex >= 10.0 && v_fontIndex < 11.0){
457
+ } else if(fontIndex >= 10.0 && fontIndex < 11.0){
461
458
  return sdfParamsArr[10];
462
459
  }
463
460
  }
464
461
 
465
462
  void main () {
466
463
 
464
+ fontIndex = v_fontIndex + 0.1;
465
+
467
466
  vec4 sdfParams = getSDFParams();
468
467
 
469
468
  vec2 dxdy = fwidth(v_uv) * sdfParams.xy;