@pirireis/webglobeplugins 1.4.1 → 1.4.3

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": "@pirireis/webglobeplugins",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "main": "index.js",
5
5
  "author": "Toprak Nihat Deniz Ozturk",
6
6
  "license": "MIT",
@@ -55,9 +55,7 @@ ${relativeBBoxPositionRadian}
55
55
 
56
56
 
57
57
  void main() {
58
- float elevation = ${WORLD_RADIUS_3D};
59
- float altitude = 20000.0;
60
- bool hasDemSample = false;
58
+
61
59
 
62
60
  // Always define v_index to avoid undefined varyings when picking is disabled.
63
61
 
@@ -74,6 +72,9 @@ void main() {
74
72
  // Always define v_index to avoid undefined varyings when picking is disabled.
75
73
  v_index = a_index;
76
74
 
75
+
76
+ float elevation = ${WORLD_RADIUS_3D};
77
+ float altitude = 20000.0;
77
78
  if (is3D == true) {
78
79
  for (int i = 0; i < 6; i++) {
79
80
  if( i == u_breakLoopIndex - 1 ) {
@@ -89,35 +89,41 @@ const glProgramCache = (function () {
89
89
  })();
90
90
  const noRegisterGlobeProgramCache = (function () {
91
91
  const cache = new Map();
92
- const keyFunction = (globe, ProgramClass, mode) => `${globe.id}_${ProgramClass.name}_${mode}`;
93
92
  function getProgram(globe, ProgramClass, mode) {
94
- const key = keyFunction(globe, ProgramClass, mode);
95
93
  if (!cache.has(globe)) {
96
94
  cache.set(globe, new Map());
97
95
  }
98
96
  ;
99
- if (!cache.get(globe).has(key)) {
100
- cache.get(globe).set(key, {
97
+ if (!cache.get(globe).has(ProgramClass)) {
98
+ cache.get(globe).set(ProgramClass, new Map());
99
+ }
100
+ ;
101
+ const modeKey = mode !== undefined ? mode : '__default__';
102
+ if (!cache.get(globe).get(ProgramClass).has(modeKey)) {
103
+ cache.get(globe).get(ProgramClass).set(modeKey, {
101
104
  program: new ProgramClass(globe, mode),
102
105
  count: 1
103
106
  });
104
107
  }
105
108
  else {
106
- cache.get(globe).get(key).count++;
109
+ cache.get(globe).get(ProgramClass).get(modeKey).count++;
107
110
  }
108
- return cache.get(globe).get(key).program;
111
+ return cache.get(globe).get(ProgramClass).get(modeKey).program;
109
112
  }
110
113
  ;
111
114
  function releaseProgram(globe, ProgramClass, mode) {
112
- const key = keyFunction(globe, ProgramClass, mode);
113
- if (cache.has(globe) && cache.get(globe).has(key)) {
114
- if (cache.get(globe).get(key).count === 0) {
115
+ const modeKey = mode !== undefined ? mode : '__default__';
116
+ if (cache.has(globe) && cache.get(globe).has(ProgramClass) && cache.get(globe).get(ProgramClass).has(modeKey)) {
117
+ if (cache.get(globe).get(ProgramClass).get(modeKey).count === 0) {
115
118
  throw new Error("The program counter is already 0, cannot release program");
116
119
  }
117
- cache.get(globe).get(key).count--;
118
- if (cache.get(globe).get(key).count === 0) {
119
- cache.get(globe).get(key).program.free();
120
- cache.get(globe).delete(key);
120
+ cache.get(globe).get(ProgramClass).get(modeKey).count--;
121
+ if (cache.get(globe).get(ProgramClass).get(modeKey).count === 0) {
122
+ cache.get(globe).get(ProgramClass).get(modeKey).program.free();
123
+ cache.get(globe).get(ProgramClass).delete(modeKey);
124
+ if (cache.get(globe).get(ProgramClass).size === 0) {
125
+ cache.get(globe).delete(ProgramClass);
126
+ }
121
127
  }
122
128
  }
123
129
  }
@@ -201,7 +201,7 @@ class PointTracksPlugin {
201
201
  flush() {
202
202
  const capacity = 100;
203
203
  this._bufferOrchestrator?.flush({ capacity });
204
- this._StorageManagersMap.forEach(({ bufferManager }) => bufferManager.free());
204
+ this._StorageManagersMap.forEach(({ bufferManager }) => bufferManager.resetWithCapacity(capacity));
205
205
  this._turnOffFocus();
206
206
  this._tracksToPointsMap.clear();
207
207
  this.globe?.DrawRender();