@pirireis/webglobeplugins 0.3.6 → 0.3.8

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.
@@ -0,0 +1,331 @@
1
+ /**
2
+ * import programs, buffer orchestrator
3
+ *
4
+ *
5
+ * import dext managers
6
+ *
7
+ * Entities:
8
+ * AcircleLine
9
+ * - circle
10
+ * - line
11
+ *
12
+ * Chain
13
+ user data
14
+ [ {
15
+ chainKey: "Magrib",
16
+ nodes: new Map([
17
+ [ "Tanca", {long, lat, to:"Cebelitarik"}],
18
+ [ "Cebelitarik", {long, lat, to: null}]
19
+ ])
20
+ }]
21
+ implicitly add from keyword for simplicity;
22
+ * # Mouse interations
23
+ */
24
+
25
+ import { LineOnGlobeCache } from '../programs/line-on-globe/naive';
26
+ import { CircleCache } from '../programs/line-on-globe/circle';
27
+ import { BufferOrchestrator } from "../util/account";
28
+ import { ChainListMap } from "./chain-list-map";
29
+ import { keyMethod } from "./util";
30
+ import { buffer } from 'three/tsl';
31
+
32
+ // TODO: Add update buffer and update text mehods on add, delete, update methods
33
+
34
+
35
+ /**
36
+ * Insert info to chain list map (nodes and properties)
37
+ *
38
+ * ask chain list map for text data
39
+ * ask chain list map for buffer data
40
+ *
41
+ */
42
+
43
+ const radian = Math.PI / 180;
44
+
45
+ export class CircleLineChainPlugin {
46
+
47
+ constructor(id, { textContextInjectionMap = new Map() } = {}) {
48
+ this.id = id;
49
+ this._textContextInjectionMap = textContextInjectionMap;
50
+ this._opacity = 1;
51
+ this._chainListMap = new ChainListMap();
52
+ this.bufferOrchestrator = new BufferOrchestrator({ capacity: 10 });
53
+ this._chainListMap
54
+ }
55
+
56
+ // init
57
+
58
+ init(globe, gl) {
59
+ this.gl = gl;
60
+ this.globe = globe
61
+ this._initOrchestrations()
62
+ }
63
+
64
+
65
+ _initOrchestrations() {
66
+ this.lineProgram = LineOnGlobeCache.get(globe);
67
+ this.circleProgram = CircleCache.get(globe);
68
+ {
69
+ // createBuffers
70
+ const bufferType = "DYNAMIC_DRAW";
71
+ const initialCapacity = this.bufferOrchestrator.capacity;
72
+ this.bufferManagersCompMap = new Map(
73
+ [
74
+ ["centerCoords", {
75
+ 'bufferManager': new BufferManager(gl, 2, { bufferType, initialCapacity }),
76
+ 'adaptor': (item) => new Float32Array([radian * item.long, radian * item.lat]),
77
+ }],
78
+ ["targetCoords", {
79
+ 'bufferManager': new BufferManager(gl, 2, { bufferType, initialCapacity }),
80
+ 'adaptor': (item) => new Float32Array([radian * item.targetLong, radian * item.targetLat])
81
+ }],
82
+ ["rgba", {
83
+ 'bufferManager': new BufferManager(gl, 4, { bufferType, initialCapacity }),
84
+ 'adaptor': (item) => new Float32Array(item.rgba)
85
+ }],
86
+ ["bigRadius", {
87
+ 'bufferManager': new BufferManager(gl, 1, { bufferType, initialCapacity }),
88
+ 'adaptor': (item) => new Float32Array([item.bigRadius])
89
+ }],
90
+ ["rgbaMode", {
91
+ 'bufferManager': new BufferManager(gl, 1, { bufferType, initialCapacity }),
92
+ 'adaptor': (item) => new Float32Array([item.rgbaMode])
93
+ }],
94
+ ["dashRatio", {
95
+ 'bufferManager': new BufferManager(gl, 1, { bufferType, initialCapacity }),
96
+ 'adaptor': (item) => new Float32Array([item.dashRatio])
97
+ }],
98
+
99
+ ["dashOpacity", {
100
+ 'bufferManager': new BufferManager(gl, 1, { bufferType, initialCapacity }),
101
+ 'adaptor': (item) => new Float32Array([item.dashOpacity])
102
+ }],
103
+ ["circleDashAngle", {
104
+ 'bufferManager': new BufferManager(gl, 1, { bufferType, initialCapacity }),
105
+ 'adaptor': (item) => new Float32Array([item.circleDashAngle / 360])
106
+ }]
107
+ ]
108
+ );
109
+ // (startPotisionBufferObj, endPositionBufferObj, dashRatioBufferObj, colorBufferObj)
110
+ this.lineVao = this.lineProgram.createVAO(
111
+ ...['centerCoords', 'targetCoords', 'dashRatio', 'dashOpacity', 'rgba'].map(key => obj(this.bufferManagersCompMap.get(key))));
112
+ this.circleVao = this.circleProgram.createVAO(
113
+ ...["centerCoords", "bigRadius", "rgba", "circleDashAngle", "dashOpacity"].map(key => obj(this.bufferManagersCompMap.get(key))));
114
+ }
115
+
116
+ }
117
+
118
+
119
+ // API
120
+
121
+ // -- update bulk family
122
+ /**
123
+ *
124
+ * @param {Array<chain>} data
125
+ * @typedef chain
126
+ * @property {string} chainKey
127
+ * @property {Array<node>} nodes
128
+ *
129
+ * @typedef {Object} node
130
+ * @property {string} key
131
+ * @property {number} long
132
+ * @property {number} lat
133
+ */
134
+ updateCoordinatesBulk(data, textWriterInjectionSubSetIDs = []) {
135
+ // update implicit data structure
136
+ // find keys to update.. (inserted data and the radius of "from")
137
+ // updateBuffers
138
+ // update text
139
+ }
140
+
141
+
142
+
143
+ // ---- insertBulk family
144
+ /**
145
+ *
146
+ * @param {Array<chain>} data
147
+ * @typedef chain
148
+ * @property {string} chainKey
149
+ * @property {[0-1,0-1,0-1,0-1]} rgba
150
+ * @property { 0-1 } dashOpacity
151
+ * @property { 0-1 } dashRatio
152
+ * @property {0-360} circleDashAngle
153
+ * @property {Array<node>} nodes
154
+ *
155
+ * @typedef {Object} node
156
+ * @property {string} key
157
+ * @property {number} long
158
+ * @property {number} lat
159
+ */
160
+ insertBulk(data) {
161
+ // first insert everything to implicit structure,
162
+ // then iterate over data again to update text
163
+ // let _reconstractChainBufferData method interact with data and bufferOrchestrator.
164
+ const chainKeysToConstruct = [];
165
+
166
+ for (const { chainKey, rgba, dashOpacity, dashRatio, circleDashAngle, nodes } of data) {
167
+ this._chainListMap.setChain(chainKey, nodes);
168
+ this._chainListMap.setChainInfo(chainKey, {
169
+ rgba, dashOpacity, dashRatio, circleDashAngle
170
+ });
171
+ chainKeysToConstruct.push(chainKey);
172
+ }
173
+ this._reconstructChains(chainKeysToConstruct);
174
+ }
175
+
176
+ /**
177
+ *
178
+ * @param {*} chainKey
179
+ * @param {*} key // node key
180
+ * @param {*} long
181
+ * @param {*} lat
182
+ * @param {*} theNodeKeyFront | node key of the next node, null places to the last
183
+ */
184
+ addNode(chainKey, key, long, lat, theNodeKeyFront = null) {
185
+ // TODO: if before object is null update the last two elements of the chain only.
186
+ this._chainListMap.addNode({ lat, long, key }, chainKey, theNodeKeyFront);
187
+ this._reconstructChains([chainKey]);
188
+
189
+ }
190
+
191
+
192
+
193
+ updateNodeCoordinates(node, chainKey, textContextIDs) {
194
+ this._chainListMap.updateNode(node, chainKey);
195
+
196
+ {
197
+ const textContexts = textContextIDs.map(v => this._textContextInjectionMap.get(v));
198
+ this._chainListMap.textUpdate(chainKey, textContextIDs,)
199
+ }
200
+
201
+ }
202
+
203
+
204
+
205
+ setOpacity(opacity) {
206
+ this._opacity = opacity;
207
+ }
208
+
209
+
210
+
211
+ getChain(chainKey) {
212
+ this._chainListMap.getChain(chainKey);
213
+ }
214
+
215
+ /**
216
+ *
217
+ * @param {*} chainKey
218
+ * @param {*} nodeKeys
219
+ */
220
+ deleteChain(chainKey) {
221
+ const keys = this._chainListMap.deleteChainAndReturnChainKeys(chainKey)
222
+ this.bufferOrchestrator.deleteBulk(keys, this.bufferManagersCompMap)
223
+ }
224
+
225
+
226
+ /**
227
+ *
228
+ * @param {Map<keys, [nodeKeys]} keysAndNodes
229
+ */
230
+ deleteNodes(keysAndNodes) {
231
+ const bufferKeys = [];
232
+ const chainKeysToReconstuct = [];
233
+ keysAndNodes.forEach((nodeList, chainKey, m) => {
234
+ bufferKeys.push(...this._chainListMap.deleteChainAndReturnChainKeys(chainKey, nodeList));
235
+ chainKeysToReconstuct.push(chainKey);
236
+ })
237
+ this._reconstructChains(chainKeysToReconstuct);
238
+ this.bufferOrchestrator.deleteBulk(bufferKeys, this.bufferManagersCompMap);
239
+ }
240
+
241
+
242
+ deleteNode(chainKey, nodeKey) {
243
+ this._chainListMap.deleteNode(chainKey, nodeKey);
244
+
245
+ }
246
+
247
+ // implicit
248
+
249
+ _updateTextOpacityAll(items) {
250
+ this._textContextInjectionMap.forEach((v) => {
251
+ const { writer } = v
252
+ for (const item of items) {
253
+ if (item.rgba) {
254
+ writer.updateOpacityOfItem(item.key, item.rgba[3])
255
+ }
256
+ }
257
+ });
258
+ }
259
+
260
+
261
+ _insertTexts(item, textWriterInjectionSubSet) {
262
+ //TODO This method can be more performant if it works horizontally, tabular
263
+ textWriterInjectionSubSet.forEach((v) => {
264
+ const { coordsAdaptor, textAdaptor, writer } = v
265
+ const { lat, long } = coordsAdaptor(item);
266
+ const text = textAdaptor(item);
267
+ writer.insertText(item.key, lat, long, text);
268
+ });
269
+ }
270
+
271
+
272
+
273
+ _reconstructChains(chainKeys) {
274
+ const { globe } = globe;
275
+ // this.lineVao = this.lineProgram.createVAO(
276
+ // ...['centerCoords', 'targetCoords', 'dashRatio', 'dashOpacity', 'rgba'].map(key => obj(this.bufferManagersCompMap.get(key))));
277
+ // this.circleVao = this.circleProgram.createVAO(
278
+ // ...["centerCoords", "bigRadius", "rgba", "circleDashAngle", "dashOpacity"].map(key => obj(this.bufferManagersCompMap.get(key))));
279
+ // }
280
+ const radiusM = radiusMethod(globe);
281
+ const callback = (v, i, array, probs) => {
282
+ return {
283
+ rgba: probs.rgba,
284
+ bigRadius: radiusM(v, i, array),
285
+ circleDashAngle: probs.circleDashAngle,
286
+ dashOpacity: probs.dashOpacity,
287
+ dashRatio: probs.dashRatio,
288
+ long: v.long,
289
+ lat: v.lat,
290
+ targetLong: array[i + 1].long,
291
+ targetLat: array[i + 1].lat,
292
+ key: keyMethod(probs.chainKey, v.key)
293
+ }
294
+ }
295
+ const bulkData = [];
296
+ chainKeys.forEach((k) => {
297
+ this._chainListMap.calculateBufferPropertiesChain(k, callback, bulkData);
298
+ })
299
+
300
+ this._insertBulk(bulkData);
301
+ }
302
+
303
+
304
+ _insertBulk(bulkData) {
305
+ this.bufferOrchestrator.insertBulk(bulkData, this.bufferManagersCompMap);
306
+ }
307
+
308
+
309
+ // GLOBE API
310
+ //TODO:
311
+ free() {
312
+ if (this.isFreed) return;
313
+ this.bufferManagersCompMap.forEach(({ bufferManager }) => {
314
+ bufferManager.free();
315
+ })
316
+ LineOnGlobeCache.release(this.globe);
317
+ CircleCache.release(this.globe);
318
+ this.isFreed = true;
319
+ }
320
+
321
+ draw3D() {
322
+ const { gl } = this;
323
+ this.lineProgram.draw(this.lineVao, this.bufferOrchestrator.length, this._opacity);
324
+ }
325
+ }
326
+
327
+
328
+
329
+ const radiusMethod = (globe) => (v, i, array) => {
330
+ return globe.Math.GetDist2D(v.long, v.lat, array[i + 1].endLong, array[i + 1].endLat)
331
+ }
@@ -0,0 +1,57 @@
1
+ # Road Map
2
+
3
+ ## CircleLine
4
+ Atomic unit is the circle-line constructed from a circle and a line with start and end point which indicates the radius.
5
+
6
+ ### Attributes
7
+ Main attributes: StartPoint, EndPoint, Radius
8
+ Other attributes: Color, opacity, dash opacity, dash ratio
9
+
10
+ ### API
11
+ API is the manipulation of above attributes
12
+
13
+ ### Implementation
14
+
15
+ Buffer Orchestrater is enough.
16
+
17
+ ## ChainOfCircleLines
18
+ Composit unit is a chain of circle-lines.
19
+
20
+ ### Attributes
21
+
22
+ Main attributes: one to many relation of a chain and its circle-lines
23
+
24
+
25
+ # API
26
+ - startChain(chainID) //
27
+ - addPointToChain(chainID)
28
+ - editPointOfChain(chainID, pointID) //
29
+ - divideChain(chainID, )
30
+
31
+
32
+
33
+ # Concept Formation
34
+
35
+ Circle-Line has ( startPoint, endPoint )
36
+
37
+ Chain Has [...circle-line] -> [ c0, c1, c2 ...] -> c0.endPoint == c1.startPoint, c1.endPoint == c2.startPoint
38
+
39
+ ## Modes
40
+
41
+ Focus Mod
42
+ - mouse icon hides and edge point icon is displayed
43
+
44
+
45
+ ## interaction points ( this can be a new module)
46
+ changes the mouse icon
47
+ plugin creates them.
48
+ interaction points carryin carries information about how to interact with the plugin.
49
+
50
+ - On Edges
51
+ Updates coordinates on right click and carry
52
+ deletes on right
53
+ - on mid point of a radius line (+)
54
+ Addes an edge to mid points. ( deletes the old one and inserts 2)
55
+
56
+ UserInterface
57
+ - drawNewMethod
@@ -0,0 +1 @@
1
+ export const keyMethod = (chainKey, nodeKey) => `${chainKey}_${nodeKey}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pirireis/webglobeplugins",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
4
  "main": "index.js",
5
5
  "author": "Toprak Nihat Deniz Ozturk",
6
6
  "license": "MIT"
@@ -115,7 +115,6 @@ class BufferManager extends BufferOffsetManager {
115
115
  */
116
116
  insertBulk(items) {
117
117
  if (items.length === 0) return;
118
- console.log(items)
119
118
  this.autoExtendBuffer(items.length);
120
119
  const { gl, buffer } = this;
121
120
  gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
@@ -49,14 +49,14 @@ in float tail_angle; // the rotation of the partial circle
49
49
  in vec4 color;
50
50
  in float radius; // in meter
51
51
  in float color_mode; // 0.0: constant, 1.0: fading, 2.0: hide
52
- flat out int vid;
53
- out float v_phase;
52
+ // flat out int vid;
53
+ // flat out float v_phase;
54
54
  out vec2 v_pos;
55
55
  out vec4 v_color;
56
- flat out float v_angle;
56
+ // flat out float v_angle;
57
57
 
58
58
  void main() {
59
- vid = gl_VertexID;
59
+ // vid = gl_VertexID;
60
60
  if (color_mode == 2.0 || radius == 0.0) { return; }
61
61
  float color_mode_ = color_mode;
62
62
  if ( draw_mode == 0 && color_mode == 1.0) {color_mode_ = 0.0;}
@@ -71,8 +71,7 @@ void main() {
71
71
  vertexID -= 1.0;
72
72
  }
73
73
  float phase = ( vertexID / (edge_count - 1.0) );
74
- v_angle = tail_angle;
75
-
74
+ // v_angle = tail_angle;
76
75
 
77
76
  if ( color_mode_ == 1.0 ) {
78
77
  if ( tail_angle < 0.0 ) {
@@ -111,11 +110,11 @@ void main() {
111
110
 
112
111
  const fragmentShaderSource = `#version 300 es` + POLE + PI + `
113
112
  precision highp float;
114
- flat in int vid;
113
+ // flat in int vid;
115
114
  in vec4 v_color;
116
115
  in vec2 v_pos;
117
- flat in float v_phase;
118
- in float v_angle;
116
+ // flat in float v_phase;
117
+ // in float v_angle;
119
118
  out vec4 outColor;
120
119
  void main() {
121
120
  // if( vid % 2 == 0 ) { discard; }
@@ -137,7 +136,6 @@ export class Logic {
137
136
  this._lastAlphaMultiplier = 1.0;
138
137
 
139
138
  this.program = createProgram(this.gl, vertexShaderSource, fragmentShaderSource);
140
-
141
139
  const { gl, program } = this;
142
140
  { // set attributes locations
143
141
  gl.bindAttribLocation(program, 0, 'center');
@@ -36,7 +36,6 @@ ${circleLimpFromLongLatRadCenterMercatorRealDistance}
36
36
  uniform float edge_count;
37
37
 
38
38
  in vec2 center_position;
39
- in float start_angle;
40
39
  in float radius;
41
40
  in vec4 color;
42
41
  in float dash_ratio;
@@ -112,11 +111,10 @@ class Logic {
112
111
 
113
112
  { // assign attribute locations
114
113
  gl.bindAttribLocation(program, 0, "center_position");
115
- gl.bindAttribLocation(program, 1, "start_angle");
116
- gl.bindAttribLocation(program, 2, "radius");
117
- gl.bindAttribLocation(program, 3, "color");
118
- gl.bindAttribLocation(program, 4, "dash_ratio");
119
- gl.bindAttribLocation(program, 5, "dash_opacity");
114
+ gl.bindAttribLocation(program, 1, "radius");
115
+ gl.bindAttribLocation(program, 2, "color");
116
+ gl.bindAttribLocation(program, 3, "dash_ratio");
117
+ gl.bindAttribLocation(program, 4, "dash_opacity");
120
118
  }
121
119
 
122
120
  this.cameraBindingPoint = 0;
@@ -125,7 +123,7 @@ class Logic {
125
123
  gl.uniformBlockBinding(program, cameraBlockLocation, this.cameraBindingPoint);
126
124
  }
127
125
 
128
- createVAO(centerObj, startAngleObj, radiusObj, colorObj, dashRatioObj, dashOpacityObj) {
126
+ createVAO(centerObj, radiusObj, colorObj, dashRatioObj, dashOpacityObj) {
129
127
  const { gl } = this;
130
128
  const vao = gl.createVertexArray();
131
129
  const divisor = 1;
@@ -134,25 +132,21 @@ class Logic {
134
132
  const { buffer, stride = 0, offset = 0 } = centerObj;
135
133
  vaoAttributeLoader(gl, buffer, 0, 2, stride, offset, divisor);
136
134
  }
137
- {
138
- const { buffer, stride = 0, offset = 0 } = startAngleObj;
139
- vaoAttributeLoader(gl, buffer, 1, 1, stride, offset, divisor);
140
- }
141
135
  {
142
136
  const { buffer, stride = 0, offset = 0 } = radiusObj;
143
- vaoAttributeLoader(gl, buffer, 2, 1, stride, offset, divisor);
137
+ vaoAttributeLoader(gl, buffer, 1, 1, stride, offset, divisor);
144
138
  }
145
139
  {
146
140
  const { buffer, stride = 0, offset = 0 } = colorObj;
147
- vaoAttributeLoader(gl, buffer, 3, 4, stride, offset, divisor);
141
+ vaoAttributeLoader(gl, buffer, 2, 4, stride, offset, divisor);
148
142
  }
149
143
  {
150
144
  const { buffer, stride = 0, offset = 0 } = dashRatioObj;
151
- vaoAttributeLoader(gl, buffer, 4, 1, stride, offset, divisor);
145
+ vaoAttributeLoader(gl, buffer, 3, 1, stride, offset, divisor);
152
146
  }
153
147
  {
154
148
  const { buffer, stride = 0, offset = 0 } = dashOpacityObj;
155
- vaoAttributeLoader(gl, buffer, 5, 1, stride, offset, divisor);
149
+ vaoAttributeLoader(gl, buffer, 4, 1, stride, offset, divisor);
156
150
  }
157
151
  gl.bindVertexArray(null);
158
152
  gl.bindVertexArray(null);
@@ -21,10 +21,12 @@ in vec2 start_position;
21
21
  in vec2 end_position;
22
22
  in float dash_ratio;
23
23
  in vec4 color;
24
+ in float dash_opacity;
24
25
  out vec4 v_color;
25
26
  out vec2 v_limp;
26
27
  out float interpolation;
27
28
  out float v_dash_ratio;
29
+ out float v_dash_opacity;
28
30
 
29
31
 
30
32
  void main() {
@@ -50,6 +52,7 @@ void main() {
50
52
  // else {v_color = vec4(0.0, 0.0, 0.0, 0.0);}
51
53
  v_color = color;
52
54
  v_dash_ratio = dash_ratio;
55
+ v_dash_opacity = dash_opacity;
53
56
  }
54
57
  `;
55
58
 
@@ -62,13 +65,14 @@ out vec4 color;
62
65
  in float interpolation;
63
66
  in float v_dash_ratio;
64
67
  in vec2 v_limp;
68
+ in float v_dash_opacity;
65
69
  void main() {
66
70
  if (v_limp.x < -POLE || v_limp.x > POLE || v_limp.y < -POLE || v_limp.y > POLE) { discard; }
67
71
  color = v_color;
68
72
  color.a *= opacity;
69
73
  if ( v_dash_ratio >= 1.0 ) { return; }
70
74
  if (interpolation > 0.95) { return; }
71
- if (fract(interpolation / (2.0 * v_dash_ratio)) < 0.5) { color.a /= 4.0; }
75
+ if (fract(interpolation / (2.0 * v_dash_ratio)) < 0.5) { color.a *= v_dash_opacity; }
72
76
 
73
77
  }
74
78
  `;
@@ -88,6 +92,7 @@ class Logic {
88
92
  gl.bindAttribLocation(program, 1, "end_position");
89
93
  gl.bindAttribLocation(program, 2, "dash_ratio");
90
94
  gl.bindAttribLocation(program, 3, "color");
95
+ gl.bindAttribLocation(program, 4, "dash_opacity");
91
96
  }
92
97
 
93
98
  {
@@ -133,7 +138,7 @@ class Logic {
133
138
 
134
139
 
135
140
  //
136
- createVAO(startPotisionBufferObj, endPositionBufferObj, dashRatioBufferObj, colorBufferObj) {
141
+ createVAO(startPotisionBufferObj, endPositionBufferObj, dashRatioBufferObj, dashOpacityBufferObj, colorBufferObj) {
137
142
  const { gl } = this;
138
143
  const vao = gl.createVertexArray();
139
144
  gl.bindVertexArray(vao);
@@ -168,6 +173,15 @@ class Logic {
168
173
  gl.vertexAttribPointer(3, 4, gl.FLOAT, false, stride, offset);
169
174
  gl.vertexAttribDivisor(3, 1);
170
175
  }
176
+
177
+ {
178
+ const { buffer, stride = 0, offset = 0 } = dashOpacityBufferObj;
179
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
180
+ gl.enableVertexAttribArray(4);
181
+ gl.vertexAttribPointer(4, 1, gl.FLOAT, false, stride, offset);
182
+ gl.vertexAttribDivisor(4, 1);
183
+ }
184
+
171
185
  gl.bindVertexArray(null);
172
186
  gl.bindBuffer(gl.ARRAY_BUFFER, null);
173
187
  return vao;
@@ -220,9 +220,9 @@ export class BufferManager extends BufferOffsetManager {
220
220
  }
221
221
  const requiredSpace = this.__requiredSpaceForBulk(data);
222
222
  const spaceLeft = this.spaceLeft;
223
- console.log("space left:", spaceLeft, "required space:", requiredSpace);
223
+ // console.log("space left:", spaceLeft, "required space:", requiredSpace);
224
224
  if (requiredSpace > spaceLeft) {
225
- console.log("new capacity:", this.capacity + requiredSpace - spaceLeft)
225
+ // console.log("new capacity:", this.capacity + requiredSpace - spaceLeft)
226
226
  this.extendBuffer(this.capacity + requiredSpace - spaceLeft);
227
227
  }
228
228
 
@@ -114,16 +114,16 @@ class Logic {
114
114
  // draw instanced
115
115
  if (padCount !== this._padCount) {
116
116
  this._padCount = padCount;
117
- console.log("padCount", padCount);
117
+ // console.log("padCount", padCount);
118
118
  gl.uniform1f(_padCountLocation, padCount);
119
119
  }
120
120
  if (compass !== this._compassMode) {
121
- console.log("compass", compass);
121
+ // console.log("compass", compass);
122
122
  gl.uniform1i(_compassLocation, compass);
123
123
  this._compassMode = compass;
124
124
  }
125
125
  if (opacity !== this._opacity) {
126
- console.log("opacity", opacity);
126
+ // console.log("opacity", opacity);
127
127
  this._opacity = opacity;
128
128
  gl.uniform1f(this._opacityLocation, opacity);
129
129
  }
@@ -87,7 +87,6 @@ export default class {
87
87
  const { circleFlatProgram, paddyFlatProgram, paddingFreeAngleProgram, bufferManager, compass, gl, circleEdgeCount, paddingBufferManager, _opacity } = this;
88
88
  if (this.bufferManager !== null && bufferManager.length > 0) {
89
89
  gl.disable(gl.DEPTH_TEST);
90
- console.log("the opacity", _opacity);
91
90
  circleFlatProgram.draw(bufferManager, compass, circleEdgeCount, _opacity);
92
91
  if (this._onedegreepaddingOn) paddyFlatProgram.draw(bufferManager, 360, compass, _opacity);
93
92
  paddingFreeAngleProgram.draw(paddingBufferManager, compass, _opacity);
@@ -67,12 +67,12 @@ export class BufferManager {
67
67
 
68
68
  const newArray = new Float32Array(newCapacity * itemSize);
69
69
  const bufferData = this._getBufferData(occupiedCapacity);
70
- console.log("bufferData", bufferData);
70
+ // console.log("bufferData", bufferData);
71
71
  let newOffset = 0;
72
72
  for (const offset of offsetValues) {
73
73
  const itemOffset = offset * itemSize;
74
74
  newArray.set(bufferData.slice(itemOffset, itemOffset + itemSize), newOffset);
75
- console.log("oldOffset", itemOffset, "newOffset", newOffset);
75
+ // console.log("oldOffset", itemOffset, "newOffset", newOffset);
76
76
  newOffset += itemSize;
77
77
  }
78
78
 
@@ -87,7 +87,7 @@ export class BufferManager {
87
87
  const { gl, buffer, bufferType } = this;
88
88
  const itemSize = this.itemSize;
89
89
  const bufferData = this._getBufferData(occupiedCapacity);
90
- console.log("extending buffer from", occupiedCapacity, "to", newCapacity, 'item size', itemSize);
90
+ // console.log("extending buffer from", occupiedCapacity, "to", newCapacity, 'item size', itemSize);
91
91
  gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
92
92
  gl.bufferData(gl.ARRAY_BUFFER, newCapacity * itemSize * 4, gl[bufferType]);
93
93
  gl.bufferSubData(gl.ARRAY_BUFFER, 0, bufferData);
@@ -96,9 +96,9 @@ export class BufferManager {
96
96
 
97
97
  _getBufferData(occupiedCapacity) {
98
98
  const { gl, buffer } = this;
99
- console.log(occupiedCapacity, this.itemSize)
99
+ // console.log(occupiedCapacity, this.itemSize)
100
100
  const size = occupiedCapacity * this.itemSize;
101
- console.log("size", size);
101
+ // console.log("size", size);
102
102
  const bufferData = new Float32Array(size);
103
103
  gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
104
104
  gl.getBufferSubData(gl.ARRAY_BUFFER, 0, bufferData);