@openglobus/og 0.20.3 → 0.21.0

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 (41) hide show
  1. package/README.md +1 -1
  2. package/lib/@openglobus/js/Globe.d.ts +1 -1
  3. package/lib/@openglobus/js/Object3d.d.ts +1 -0
  4. package/lib/@openglobus/js/entity/EntityCollection.d.ts +4 -0
  5. package/lib/@openglobus/js/entity/GeoObject.d.ts +7 -3
  6. package/lib/@openglobus/js/entity/GeoObjectHandler.d.ts +5 -8
  7. package/lib/@openglobus/js/entity/GeometryHandler.d.ts +3 -2
  8. package/lib/@openglobus/js/layer/Vector.d.ts +5 -0
  9. package/lib/@openglobus/js/math/Quat.d.ts +1 -0
  10. package/lib/@openglobus/js/terrain/GlobusTerrain.d.ts +2 -0
  11. package/lib/@openglobus/js/terrain/RgbTerrain.d.ts +9 -0
  12. package/lib/@openglobus/og.esm.js +1 -1
  13. package/lib/@openglobus/og.esm.js.map +1 -1
  14. package/lib/@openglobus/og.umd.js +1 -1
  15. package/lib/@openglobus/og.umd.js.map +1 -1
  16. package/lib/js/Globe.d.ts +1 -1
  17. package/lib/js/Globe.js +8 -2
  18. package/lib/js/Object3d.d.ts +1 -0
  19. package/lib/js/Object3d.js +18 -0
  20. package/lib/js/entity/EntityCollection.d.ts +4 -0
  21. package/lib/js/entity/EntityCollection.js +7 -0
  22. package/lib/js/entity/GeoObject.d.ts +7 -3
  23. package/lib/js/entity/GeoObject.js +31 -16
  24. package/lib/js/entity/GeoObjectHandler.d.ts +5 -8
  25. package/lib/js/entity/GeoObjectHandler.js +34 -63
  26. package/lib/js/entity/GeometryHandler.d.ts +3 -2
  27. package/lib/js/entity/GeometryHandler.js +56 -0
  28. package/lib/js/layer/Bing.js +1 -0
  29. package/lib/js/layer/Vector.d.ts +5 -0
  30. package/lib/js/layer/Vector.js +20 -3
  31. package/lib/js/math/Quat.d.ts +1 -0
  32. package/lib/js/math/Quat.js +4 -0
  33. package/lib/js/renderer/RendererEvents.js +1 -3
  34. package/lib/js/scene/Planet.js +1 -1
  35. package/lib/js/shaders/geoObject.js +22 -71
  36. package/lib/js/terrain/GlobusRgbTerrain.js +2 -2
  37. package/lib/js/terrain/GlobusTerrain.d.ts +2 -0
  38. package/lib/js/terrain/GlobusTerrain.js +2 -0
  39. package/lib/js/terrain/RgbTerrain.d.ts +9 -0
  40. package/lib/js/terrain/RgbTerrain.js +215 -213
  41. package/package.json +14 -14
@@ -682,6 +682,62 @@ class GeometryHandler {
682
682
  h.gl.deleteBuffer(this._lineStrokeColorsBuffer);
683
683
  this._lineStrokeColorsBuffer = h.createArrayBuffer(new Float32Array(this._lineStrokeColors), 4, this._lineStrokeColors.length / 4);
684
684
  }
685
+ clear() {
686
+ this._geometries = [];
687
+ this._polyVerticesHighMerc = [];
688
+ this._polyVerticesLowMerc = [];
689
+ this._polyIndexes = [];
690
+ this._polyColors = [];
691
+ this._polyPickingColors = [];
692
+ this._lineVerticesHighMerc = [];
693
+ this._lineVerticesLowMerc = [];
694
+ this._lineOrders = [];
695
+ this._lineIndexes = [];
696
+ this._lineColors = [];
697
+ this._linePickingColors = [];
698
+ this._lineThickness = [];
699
+ this._lineStrokeColors = [];
700
+ this._lineStrokes = [];
701
+ this._deleteBuffers();
702
+ this._polyVerticesHighBufferMerc = null;
703
+ this._polyVerticesLowBufferMerc = null;
704
+ this._polyIndexesBuffer = null;
705
+ this._polyColorsBuffer = null;
706
+ this._polyPickingColorsBuffer = null;
707
+ this._lineVerticesHighBufferMerc = null;
708
+ this._lineVerticesLowBufferMerc = null;
709
+ this._lineIndexesBuffer = null;
710
+ this._lineOrdersBuffer = null;
711
+ this._lineColorsBuffer = null;
712
+ this._linePickingColorsBuffer = null;
713
+ this._lineThicknessBuffer = null;
714
+ this._lineStrokeColorsBuffer = null;
715
+ this._lineStrokesBuffer = null;
716
+ this._updatedGeometryArr = [];
717
+ this._updatedGeometry = {};
718
+ this._removeGeometryExtentArr = [];
719
+ this._removeGeometryExtents = {};
720
+ this.refresh();
721
+ }
722
+ _deleteBuffers() {
723
+ if (this._layer._planet && this._layer._planet.renderer) {
724
+ let h = this._layer._planet.renderer.handler, gl = h.gl;
725
+ gl.deleteBuffer(this._polyVerticesHighBufferMerc);
726
+ gl.deleteBuffer(this._polyVerticesLowBufferMerc);
727
+ gl.deleteBuffer(this._polyIndexesBuffer);
728
+ gl.deleteBuffer(this._polyColorsBuffer);
729
+ gl.deleteBuffer(this._polyPickingColorsBuffer);
730
+ gl.deleteBuffer(this._lineVerticesHighBufferMerc);
731
+ gl.deleteBuffer(this._lineVerticesLowBufferMerc);
732
+ gl.deleteBuffer(this._lineIndexesBuffer);
733
+ gl.deleteBuffer(this._lineOrdersBuffer);
734
+ gl.deleteBuffer(this._lineColorsBuffer);
735
+ gl.deleteBuffer(this._linePickingColorsBuffer);
736
+ gl.deleteBuffer(this._lineThicknessBuffer);
737
+ gl.deleteBuffer(this._lineStrokeColorsBuffer);
738
+ gl.deleteBuffer(this._lineStrokesBuffer);
739
+ }
740
+ }
685
741
  }
686
742
  GeometryHandler.__counter__ = 0;
687
743
  export { GeometryHandler };
@@ -20,6 +20,7 @@ export class Bing extends XYZ {
20
20
  subdomains: ['t0', 't1', 't2', 't3'],
21
21
  url: "https://ecn.{s}.tiles.virtualearth.net/tiles/a{quad}.jpeg?n=z&g=7146",
22
22
  isBaseLayer: true,
23
+ textureFilter: "LINEAR",
23
24
  maxNativeZoom: 17,
24
25
  defaultTextures: [{ color: "#001522" }, { color: "#E4E6F3" }],
25
26
  attribution: `<div style="transform: scale(0.8); margin-top:-2px;"><a href="https://www.bing.com" target="_blank"><img style="position: relative; top: 2px;" title="Bing Imagery" src="https://sandcastle.cesium.com/CesiumUnminified/Assets/Images/bing_maps_credit.png"></a> © 2021 Microsoft Corporation</div>`,
@@ -19,6 +19,7 @@ export interface IVectorParams extends ILayerParams {
19
19
  pickingScale?: number;
20
20
  scaleByDistance?: NumberArray3;
21
21
  labelMaxLetters?: number;
22
+ useLighting?: boolean;
22
23
  }
23
24
  type VectorEventsList = [
24
25
  "draw",
@@ -44,6 +45,7 @@ export type VectorEventsType = EventsHandler<VectorEventsList> & EventsHandler<L
44
45
  * First index - near distance to the entity, after entity becomes full scale.
45
46
  * Second index - far distance to the entity, when entity becomes zero scale.
46
47
  * Third index - far distance to the entity, when entity becomes invisible.
48
+ * Use [1.0, 1.0, 1.0] for real sized objects
47
49
  * @param {number} [options.nodeCapacity=30] - Maximum entities quantity in the tree node. Rendering optimization parameter. 30 is default.
48
50
  * @param {boolean} [options.async=true] - Asynchronous vector data handling before rendering. True for optimization huge data.
49
51
  * @param {boolean} [options.clampToGround = false] - Clamp vector data to the ground.
@@ -121,7 +123,10 @@ declare class Vector extends Layer {
121
123
  polygonOffsetUnits: number;
122
124
  _secondPASS: EntityCollectionNode[];
123
125
  protected _labelMaxLetters: number;
126
+ protected _useLighting: boolean;
124
127
  constructor(name?: string | null, options?: IVectorParams);
128
+ get useLighting(): boolean;
129
+ set useLighting(f: boolean);
125
130
  get labelMaxLetters(): number;
126
131
  get instanceName(): string;
127
132
  protected _bindPicking(): void;
@@ -45,6 +45,7 @@ function _entitiesConstructor(entities) {
45
45
  * First index - near distance to the entity, after entity becomes full scale.
46
46
  * Second index - far distance to the entity, when entity becomes zero scale.
47
47
  * Third index - far distance to the entity, when entity becomes invisible.
48
+ * Use [1.0, 1.0, 1.0] for real sized objects
48
49
  * @param {number} [options.nodeCapacity=30] - Maximum entities quantity in the tree node. Rendering optimization parameter. 30 is default.
49
50
  * @param {boolean} [options.async=true] - Asynchronous vector data handling before rendering. True for optimization huge data.
50
51
  * @param {boolean} [options.clampToGround = false] - Clamp vector data to the ground.
@@ -67,6 +68,7 @@ class Vector extends Layer {
67
68
  this.isVector = true;
68
69
  this._hasImageryTiles = false;
69
70
  this.scaleByDistance = options.scaleByDistance || [math.MAX32, math.MAX32, math.MAX32];
71
+ this._useLighting = options.useLighting !== undefined ? options.useLighting : true;
70
72
  this.pickingScale = options.pickingScale || 1;
71
73
  this.async = options.async !== undefined ? options.async : true;
72
74
  this.clampToGround = options.clampToGround || false;
@@ -83,7 +85,8 @@ class Vector extends Layer {
83
85
  });
84
86
  this._bindEventsDefault(this._polylineEntityCollection);
85
87
  this._geoObjectEntityCollection = new EntityCollection({
86
- pickingEnabled: this.pickingEnabled
88
+ pickingEnabled: this.pickingEnabled,
89
+ useLighting: this._useLighting
87
90
  });
88
91
  this._bindEventsDefault(this._geoObjectEntityCollection);
89
92
  this._geometryHandler = new GeometryHandler(this);
@@ -101,6 +104,15 @@ class Vector extends Layer {
101
104
  this.pickingEnabled = this._pickingEnabled;
102
105
  this._secondPASS = [];
103
106
  }
107
+ get useLighting() {
108
+ return this._useLighting;
109
+ }
110
+ set useLighting(f) {
111
+ if (f !== this._useLighting) {
112
+ this._geoObjectEntityCollection.useLighting = f;
113
+ this._useLighting = f;
114
+ }
115
+ }
104
116
  get labelMaxLetters() {
105
117
  return this._labelMaxLetters;
106
118
  }
@@ -329,6 +341,9 @@ class Vector extends Layer {
329
341
  this._stripEntityCollection.setPickingEnabled(picking);
330
342
  this._polylineEntityCollection.setPickingEnabled(picking);
331
343
  this._geoObjectEntityCollection.setPickingEnabled(picking);
344
+ /**
345
+ * todo: it must be in the quadtree strategy
346
+ */
332
347
  this._entityCollectionsTree && this._entityCollectionsTree.traverseTree((node) => {
333
348
  node.entityCollection.setPickingEnabled(picking);
334
349
  });
@@ -373,6 +388,7 @@ class Vector extends Layer {
373
388
  * @public
374
389
  */
375
390
  clear() {
391
+ super.clear();
376
392
  let temp = new Array(this._entities.length);
377
393
  for (let i = 0; i < temp.length; i++) {
378
394
  temp[i] = this._entities[i];
@@ -389,6 +405,7 @@ class Vector extends Layer {
389
405
  this._entityCollectionsTree = null;
390
406
  this._entityCollectionsTreeNorth = null;
391
407
  this._entityCollectionsTreeSouth = null;
408
+ this._geometryHandler.clear();
392
409
  }
393
410
  /**
394
411
  * Safety entities loop.
@@ -708,7 +725,7 @@ class Vector extends Layer {
708
725
  }
709
726
  _execDeferredNode(node) {
710
727
  this._counter++;
711
- setTimeout(() => {
728
+ requestAnimationFrame(() => {
712
729
  node.applyCollection();
713
730
  this._counter--;
714
731
  if (this._deferredEntitiesPendingQueue.length && this._counter < 1) {
@@ -721,7 +738,7 @@ class Vector extends Layer {
721
738
  }
722
739
  }
723
740
  }
724
- }, 0);
741
+ });
725
742
  }
726
743
  /**
727
744
  * Start to load tile material.
@@ -118,6 +118,7 @@ export declare class Quat {
118
118
  * @returns {Quat} -
119
119
  */
120
120
  static getRotationBetweenVectorsUp(source: Vec3, dest: Vec3, up: Vec3): Quat;
121
+ static setFromEulerAngles(pitch: number, yaw: number, roll: number): Quat;
121
122
  /**
122
123
  * Returns true if the components are zero.
123
124
  * @public
@@ -166,6 +166,10 @@ export class Quat {
166
166
  let rotAxis = source.cross(dest).normalize();
167
167
  return Quat.axisAngleToQuat(rotAxis, rotAngle);
168
168
  }
169
+ static setFromEulerAngles(pitch, yaw, roll) {
170
+ let res = new Quat();
171
+ return res.setFromEulerAngles(pitch, yaw, roll);
172
+ }
169
173
  /**
170
174
  * Returns true if the components are zero.
171
175
  * @public
@@ -663,9 +663,7 @@ class RendererEvents extends Events {
663
663
  }
664
664
  if (ts.touchStart) {
665
665
  let r = this.renderer;
666
- r.pickingFramebuffer.activate();
667
- r.pickingFramebuffer.readPixels(_currPickingColor, ts.nx, 1.0 - ts.ny, 1);
668
- r.pickingFramebuffer.deactivate();
666
+ r.readPickingColor(ts.nx, 1 - ts.ny, _currPickingColor);
669
667
  let co = r.getPickingObjectArr(_currPickingColor);
670
668
  tpo = ts.pickingObject = co;
671
669
  if (tpo) {
@@ -1075,7 +1075,7 @@ export class Planet extends RenderNode {
1075
1075
  let transparentSegments = [];
1076
1076
  let isEq = this.terrain.equalizeVertices;
1077
1077
  let i = renderedNodes.length;
1078
- if (cam.slope > 0.8 /*|| cam.getAltitude() > 10000*/) {
1078
+ if (cam.slope > 0.8 || !this.terrain || this.terrain.isEmpty /*|| cam.getAltitude() > 10000*/) {
1079
1079
  while (i--) {
1080
1080
  let ri = renderedNodes[i];
1081
1081
  let s = ri.segment;
@@ -1,4 +1,7 @@
1
1
  import { Program } from "../webgl/Program";
2
+ const QROT = `vec3 qRotate(vec4 q, vec3 v){
3
+ return v + 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v);
4
+ }`;
2
5
  export const geo_object = () => new Program("geo_object", {
3
6
  uniforms: {
4
7
  viewMatrix: "mat4",
@@ -10,7 +13,8 @@ export const geo_object = () => new Program("geo_object", {
10
13
  lightsParamsv: "vec3",
11
14
  lightsParamsf: "float",
12
15
  uTexture: "sampler2d",
13
- uUseTexture: "float"
16
+ uUseTexture: "float",
17
+ useLighting: "float"
14
18
  },
15
19
  attributes: {
16
20
  aVertexPosition: "vec3",
@@ -18,11 +22,10 @@ export const geo_object = () => new Program("geo_object", {
18
22
  aTexCoord: "vec2",
19
23
  aPositionHigh: { type: "vec3", divisor: 1 },
20
24
  aPositionLow: { type: "vec3", divisor: 1 },
21
- aDirection: { type: "vec3", divisor: 1 },
22
- aPitchRoll: { type: "vec2", divisor: 1 },
23
25
  aColor: { type: "vec4", divisor: 1 },
24
26
  aScale: { type: "vec3", divisor: 1 },
25
- aDispose: { type: "float", divisor: 1 }
27
+ aDispose: { type: "float", divisor: 1 },
28
+ qRot: { type: "vec4", divisor: 1 }
26
29
  },
27
30
  vertexShader: `precision highp float;
28
31
 
@@ -30,13 +33,12 @@ export const geo_object = () => new Program("geo_object", {
30
33
  attribute vec3 aVertexNormal;
31
34
  attribute vec3 aPositionHigh;
32
35
  attribute vec3 aPositionLow;
33
- attribute vec3 aDirection;
34
- attribute vec2 aPitchRoll;
35
36
  attribute vec4 aColor;
36
37
  attribute vec3 aScale;
37
38
  attribute float aDispose;
38
39
  attribute float aUseTexture;
39
40
  attribute vec2 aTexCoord;
41
+ attribute vec4 qRot;
40
42
 
41
43
  uniform vec3 uScaleByDistance;
42
44
  uniform mat4 projectionMatrix;
@@ -51,11 +53,8 @@ export const geo_object = () => new Program("geo_object", {
51
53
  varying vec4 vColor;
52
54
  varying float vDispose;
53
55
  varying vec2 vTexCoords;
54
- //varying float useLighting;
55
56
 
56
- const float PI = 3.141592653589793;
57
-
58
- const float RADIANS = PI / 180.0;
57
+ ${QROT}
59
58
 
60
59
  void main(void) {
61
60
 
@@ -69,43 +68,16 @@ export const geo_object = () => new Program("geo_object", {
69
68
  vec3 look = cameraPosition - position;
70
69
  float lookLength = length(look);
71
70
 
72
- // useLighting = 1.0;
73
- // if(lookLength > 2000000.0){
74
- // useLighting = 0.0;
75
- // }
76
-
77
-
78
71
  vColor = aColor;
79
72
  vTexCoords = aTexCoord;
80
73
 
81
- float cos_roll = cos(aPitchRoll.y);
82
- float sin_roll = sin(aPitchRoll.y);
83
-
84
- mat3 rotZ = mat3(
85
- vec3(cos_roll, sin_roll, 0.0),
86
- vec3(-sin_roll, cos_roll, 0.0),
87
- vec3(0.0, 0.0, 1.0)
88
- );
89
-
90
- float cos_pitch = cos(aPitchRoll.x);
91
- float sin_pitch = sin(aPitchRoll.x);
92
-
93
- mat3 rotX = mat3(
94
- vec3(1.0, 0.0, 0.0),
95
- vec3(0.0, cos_pitch, sin_pitch),
96
- vec3(0.0, -sin_pitch, cos_pitch)
97
- );
98
-
99
- vec3 r = cross(normalize(-position), aDirection);
100
- mat3 modelMatrix = mat3(r, normalize(position), -aDirection) * rotX * rotZ;
101
-
102
74
  mat4 viewMatrixRTE = viewMatrix;
103
75
  viewMatrixRTE[3] = vec4(0.0, 0.0, 0.0, 1.0);
104
76
 
105
77
  vec3 highDiff = aPositionHigh - eyePositionHigh;
106
78
  vec3 lowDiff = aPositionLow - eyePositionLow;
107
79
 
108
- vNormal = modelMatrix * aVertexNormal;
80
+ vNormal = qRotate(qRot, aVertexNormal);
109
81
 
110
82
  // if(lookLength > uScaleByDistance[1])
111
83
  // {
@@ -116,9 +88,10 @@ export const geo_object = () => new Program("geo_object", {
116
88
  // scd = lookLength / uScaleByDistance[0];
117
89
  // }
118
90
  // ... is the same math
91
+ // use scaleByDistance: [1.0, 1.0, 1.0] for real sized objects
119
92
  float scd = uScaleByDistance[2] * clamp(lookLength, uScaleByDistance[0], uScaleByDistance[1]) / uScaleByDistance[0];
120
93
 
121
- vec3 vert = modelMatrix * (aVertexPosition * aScale) * scd;
94
+ vec3 vert = qRotate(qRot, (aVertexPosition * aScale)) * scd;
122
95
 
123
96
  vert += lowDiff;
124
97
 
@@ -135,19 +108,19 @@ export const geo_object = () => new Program("geo_object", {
135
108
  uniform float lightsParamsf[MAX_POINT_LIGHTS];
136
109
  uniform sampler2D uTexture;
137
110
  uniform float uUseTexture;
111
+ uniform float useLighting;
138
112
 
139
113
  varying vec3 cameraPosition;
140
114
  varying vec3 v_vertex;
141
115
  varying vec4 vColor;
142
116
  varying vec3 vNormal;
143
117
  varying vec2 vTexCoords;
144
- //varying float useLighting;
145
118
 
146
119
  void main(void) {
147
120
 
148
121
  vec3 lightWeighting = vec3(1.0);
149
122
 
150
- //if(useLighting != 0.0){
123
+ if(useLighting != 0.0){
151
124
  vec3 normal = normalize(vNormal);
152
125
  vec3 lightDir = normalize(lightsPositions[0]);
153
126
  vec3 viewDir = normalize(cameraPosition - v_vertex);
@@ -156,7 +129,7 @@ export const geo_object = () => new Program("geo_object", {
156
129
  float specularLightWeighting = pow( reflection, lightsParamsf[0]);
157
130
  float diffuseLightWeighting = max(dot(normal, lightDir), 0.0);
158
131
  lightWeighting = lightsParamsv[0] + lightsParamsv[1] * diffuseLightWeighting + lightsParamsv[2] * specularLightWeighting;
159
- //}
132
+ }
160
133
 
161
134
  if(uUseTexture > 0.0) {
162
135
  vec4 tColor = texture2D(uTexture, vTexCoords);
@@ -179,22 +152,20 @@ export const geo_object_picking = () => new Program("geo_object_picking", {
179
152
  aVertexPosition: "vec3",
180
153
  aPositionHigh: { type: "vec3", divisor: 1 },
181
154
  aPositionLow: { type: "vec3", divisor: 1 },
182
- aDirection: { type: "vec3", divisor: 1 },
183
- aPitchRoll: { type: "vec2", divisor: 1 },
184
155
  aPickingColor: { type: "vec3", divisor: 1 },
185
156
  aScale: { type: "vec3", divisor: 1 },
186
- aDispose: { type: "float", divisor: 1 }
157
+ aDispose: { type: "float", divisor: 1 },
158
+ qRot: { type: "vec4", divisor: 1 }
187
159
  },
188
160
  vertexShader: `precision highp float;
189
161
 
190
162
  attribute vec3 aVertexPosition;
191
163
  attribute vec3 aPositionHigh;
192
- attribute vec3 aPositionLow;
193
- attribute vec3 aDirection;
194
- attribute vec3 aPickingColor;
195
- attribute vec2 aPitchRoll;
164
+ attribute vec3 aPositionLow;
165
+ attribute vec3 aPickingColor;
196
166
  attribute vec3 aScale;
197
167
  attribute float aDispose;
168
+ attribute vec4 qRot;
198
169
 
199
170
  uniform vec3 eyePositionHigh;
200
171
  uniform vec3 eyePositionLow;
@@ -205,7 +176,7 @@ export const geo_object_picking = () => new Program("geo_object_picking", {
205
176
 
206
177
  varying vec3 vColor;
207
178
 
208
- const float RADIANS = 3.141592653589793 / 180.0;
179
+ ${QROT}
209
180
 
210
181
  void main(void) {
211
182
 
@@ -214,29 +185,9 @@ export const geo_object_picking = () => new Program("geo_object_picking", {
214
185
  }
215
186
 
216
187
  vColor = aPickingColor;
217
-
218
- float cos_roll = cos(aPitchRoll.y);
219
- float sin_roll = sin(aPitchRoll.y);
220
188
 
221
- mat3 rotZ = mat3(
222
- vec3(cos_roll, sin_roll, 0.0),
223
- vec3(-sin_roll, cos_roll, 0.0),
224
- vec3(0.0, 0.0, 1.0)
225
- );
226
-
227
- float cos_pitch = cos(aPitchRoll.x);
228
- float sin_pitch = sin(aPitchRoll.x);
229
-
230
- mat3 rotX = mat3(
231
- vec3(1.0, 0.0, 0.0),
232
- vec3(0.0, cos_pitch, sin_pitch),
233
- vec3(0.0, -sin_pitch, cos_pitch)
234
- );
235
-
236
189
  vec3 position = aPositionHigh + aPositionLow;
237
190
  vec3 cameraPosition = eyePositionHigh + eyePositionLow;
238
- vec3 r = cross(normalize(-position), aDirection);
239
- mat3 modelMatrix = mat3(r, normalize(position), -aDirection) * rotX * rotZ;
240
191
 
241
192
  mat4 viewMatrixRTE = viewMatrix;
242
193
  viewMatrixRTE[3] = vec4(0.0, 0.0, 0.0, 1.0);
@@ -261,7 +212,7 @@ export const geo_object_picking = () => new Program("geo_object_picking", {
261
212
  // tays in the vert above it affects on Mac Safari jitter
262
213
  float scd = pickingScale * uScaleByDistance[2] * clamp(lookLength, uScaleByDistance[0], uScaleByDistance[1]) / uScaleByDistance[0];
263
214
 
264
- vec3 vert = modelMatrix * (aVertexPosition * aScale) * scd;
215
+ vec3 vert = qRotate(qRot, (aVertexPosition * aScale)) * scd;
265
216
 
266
217
  vert += lowDiff;
267
218
 
@@ -7,14 +7,14 @@ const urlPref = {
7
7
  const urlRewriteFunc = (tileX, tileY, tileZoom, tileGroup) => {
8
8
  let g = urlPref[tileGroup];
9
9
  if (g)
10
- return `https://terrain.openglobus.org/public/poles/${g}/${tileZoom}/${tileX}/${tileY}.png`;
10
+ return `https://terrain.openglobus.org/poles/${g}/${tileZoom}/${tileX}/${tileY}.png`;
11
11
  };
12
12
  export class GlobusRgbTerrain extends RgbTerrain {
13
13
  constructor(name, options) {
14
14
  super(name || "GlobusEarthRgb", {
15
15
  maxNativeZoom: 6,
16
16
  maxZoom: 17,
17
- url: "https://{s}.terrain.openglobus.org/public/all/{z}/{x}/{y}.png",
17
+ url: "https://{s}.terrain.openglobus.org/all/{z}/{x}/{y}.png",
18
18
  urlRewrite: urlRewriteFunc,
19
19
  ...options
20
20
  });
@@ -19,6 +19,8 @@ type TileData = {
19
19
  extent: Extent | null;
20
20
  };
21
21
  /**
22
+ * @deprecated
23
+ * Use GlobusRgbTerrain
22
24
  * Class that loads segment elevation data, converts it to the array and passes it to the planet segment.
23
25
  * @class
24
26
  * @extends {GlobusTerrain}
@@ -12,6 +12,8 @@ import { TILEGROUP_COMMON } from "../segment/Segment";
12
12
  import { Ray } from "../math/Ray";
13
13
  import { Vec3 } from "../math/Vec3";
14
14
  /**
15
+ * @deprecated
16
+ * Use GlobusRgbTerrain
15
17
  * Class that loads segment elevation data, converts it to the array and passes it to the planet segment.
16
18
  * @class
17
19
  * @extends {GlobusTerrain}
@@ -7,16 +7,25 @@ export interface IRgbTerrainParams extends IGlobusTerrainParams {
7
7
  equalizeNormals?: boolean;
8
8
  key?: string;
9
9
  imageSize?: number;
10
+ minHeight?: number;
11
+ resolution?: number;
10
12
  }
11
13
  declare class RgbTerrain extends GlobusTerrain {
12
14
  protected _imageSize: number;
13
15
  protected _ctx: CanvasRenderingContext2D;
14
16
  protected _imageDataCache: Record<string, Uint8ClampedArray>;
17
+ protected _minHeight: number;
18
+ protected _resolution: number;
15
19
  constructor(name: string | null, options?: IRgbTerrainParams);
16
20
  static checkNoDataValue(noDataValues: number[] | TypedArray, value: number): boolean;
21
+ rgb2Height(r: number, g: number, b: number): number;
17
22
  isBlur(segment: Segment): boolean;
18
23
  protected _createTemporalCanvas(size: number): CanvasRenderingContext2D;
19
24
  protected _createHeights(data: HTMLImageElement | ImageBitmap, segment: Segment | null, tileGroup: number, tileX: number, tileY: number, tileZoom: number, extent: Extent, preventChildren: boolean): TypedArray | number[];
20
25
  getHeightAsync(lonLat: LonLat, callback: (h: number) => void, zoom?: number): boolean;
26
+ extractElevationSimple(rgbaData: number[] | TypedArray, noDataValues: number[] | TypedArray, availableParentData: (TypedArray | number[] | null) | undefined, availableParentOffsetX: number, availableParentOffsetY: number, availableZoomDiff: number, skipPositiveHeights: boolean, outCurrenElevations: number[] | TypedArray, heightFactor: number | undefined, imageSize: number): void;
27
+ extractElevationTilesRgbNonPowerOfTwo(rgbaData: number[] | TypedArray, outCurrenElevations: number[] | TypedArray, heightFactor?: number): void;
28
+ extractElevationTilesRgb(rgbaData: number[] | TypedArray, heightFactor: number, noDataValues: number[] | TypedArray, availableParentData: (TypedArray | number[] | null) | undefined, availableParentTileX: number, availableParentTileY: number, availableParentTileZoom: number, currentTileX: number, currentTileY: number, currentTileZoom: number, skipPositiveHeights: boolean, outCurrenElevations: number[] | TypedArray, outChildrenElevations: number[][][] | TypedArray[][]): void;
29
+ extractElevationTilesRgbNoChildren(rgbaData: number[] | TypedArray, heightFactor: number, noDataValues: number[] | TypedArray, availableParentData: (TypedArray | number[] | null) | undefined, availableParentTileX: number, availableParentTileY: number, availableParentTileZoom: number, currentTileX: number, currentTileY: number, currentTileZoom: number, skipPositiveHeights: boolean, outCurrenElevations: number[] | TypedArray): void;
21
30
  }
22
31
  export { RgbTerrain };