@pirireis/webglobeplugins 0.13.0-alpha → 0.14.0-alpha
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/Math/arc-cdf-points.js +20 -0
- package/Math/arc-generate-points copy.js +1 -0
- package/Math/arc.js +21 -8
- package/Math/circle.js +35 -16
- package/Math/templete-shapes/grid-visually-equal.js +66 -0
- package/altitude-locator/plugin.js +3 -2
- package/bearing-line/plugin.js +1 -2
- package/circle-line-chain/plugin.js +4 -7
- package/compass-rose/compass-rose-padding-flat.js +12 -0
- package/package.json +1 -1
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +1 -1
- package/programs/line-on-globe/linestrip/linestrip.js +5 -3
- package/programs/line-on-globe/naive-accurate-flexible.js +23 -16
- package/programs/picking/pickable-renderer.js +1 -2
- package/programs/rings/partial-ring/piece-of-pie copy.js +286 -0
- package/programs/rings/partial-ring/piece-of-pie.js +26 -13
- package/programs/totems/camerauniformblock.js +1 -1
- package/programs/totems/index.js +1 -1
- package/range-tools-on-terrain/bearing-line/adapters.js +111 -0
- package/range-tools-on-terrain/bearing-line/plugin.js +360 -0
- package/range-tools-on-terrain/circle-line-chain/adapters.js +83 -0
- package/range-tools-on-terrain/circle-line-chain/chain-list-map.js +351 -0
- package/range-tools-on-terrain/circle-line-chain/plugin.js +389 -0
- package/range-tools-on-terrain/circle-line-chain/types.js +1 -0
- package/range-tools-on-terrain/range-ring/adapters.js +25 -0
- package/range-tools-on-terrain/range-ring/plugin.js +31 -0
- package/range-tools-on-terrain/range-ring/types.js +1 -0
- package/rangerings/plugin.js +7 -11
- package/semiplugins/lightweight/line-plugin.js +195 -0
- package/semiplugins/lightweight/piece-of-pie-plugin.js +175 -0
- package/semiplugins/shape-on-terrain/arc-plugin.js +368 -0
- package/{shape-on-terrain/circle/plugin.js → semiplugins/shape-on-terrain/circle-plugin.js} +67 -38
- package/semiplugins/shape-on-terrain/derived/padding-plugin.js +96 -0
- package/semiplugins/type.js +1 -0
- package/types.js +0 -11
- package/util/account/create-buffermap-orchastration.js +39 -0
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +14 -3
- package/util/check/typecheck.js +15 -1
- package/util/geometry/index.js +3 -2
- package/util/gl-util/buffer/attribute-loader.js +2 -5
- package/util/gl-util/draw-options/methods.js +4 -5
- package/util/webglobjectbuilders.js +4 -9
- package/write-text/context-text3.js +17 -0
- package/write-text/context-text3old.js +152 -0
- package/programs/line-on-globe/circle-accurate.js +0 -176
- package/programs/line-on-globe/circle.js +0 -166
- package/programs/line-on-globe/to-the-surface.js +0 -111
- package/programs/totems/canvas-webglobe-info1.js +0 -106
- package/shape-on-terrain/arc/naive/plugin.js +0 -250
- package/util/check/get.js +0 -14
- package/util/gl-util/buffer/types.js +0 -1
- package/util/gl-util/draw-options/types.js +0 -15
- package/util/webglobjectbuilders1.js +0 -219
- /package/{shape-on-terrain/type.js → range-tools-on-terrain/bearing-line/types.js} +0 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { LineOnGlobeCache } from "../../programs/line-on-globe/naive-accurate-flexible";
|
|
2
|
+
import { BufferMapOrchestrator } from "../../util/account/create-buffermap-orchastration";
|
|
3
|
+
import { sphereCoord } from "../../util/geometry/index";
|
|
4
|
+
import { constraintFloat } from "../../util/check/typecheck";
|
|
5
|
+
export class LinePlugin {
|
|
6
|
+
id;
|
|
7
|
+
globe = null;
|
|
8
|
+
gl = null;
|
|
9
|
+
program = null;
|
|
10
|
+
vao = null;
|
|
11
|
+
_options;
|
|
12
|
+
_uboHandler = null;
|
|
13
|
+
_bufferOrchestrator = null;
|
|
14
|
+
_freed = false;
|
|
15
|
+
constructor(id, { flatViewOn = true, globeViewOn = true, variativeColorsOn = false, defaultColor = [1, 1, 1, 1], dashedLineOpacityVariativeOn = false, dashedLineRatioVariativeOn = false, bufferType = "DYNAMIC_DRAW", opacity = 1.0 } = {}) {
|
|
16
|
+
this.id = id;
|
|
17
|
+
this._options = {
|
|
18
|
+
flatViewOn,
|
|
19
|
+
globeViewOn,
|
|
20
|
+
variativeColorsOn,
|
|
21
|
+
defaultColor,
|
|
22
|
+
dashedLineOpacityVariativeOn,
|
|
23
|
+
dashedLineRatioVariativeOn,
|
|
24
|
+
bufferType,
|
|
25
|
+
opacity
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
init(globe, gl) {
|
|
29
|
+
this.globe = globe;
|
|
30
|
+
this.gl = gl;
|
|
31
|
+
this.program = LineOnGlobeCache.get(globe);
|
|
32
|
+
this._uboHandler = this.program.createUBO();
|
|
33
|
+
this._bufferOrchestrator = new BufferMapOrchestrator(gl, this._createBufferDetailsMap(), 10 // initial capacity
|
|
34
|
+
);
|
|
35
|
+
this.vao = this.program.createVAO(...this._createSelectBufferNames().map((key) => {
|
|
36
|
+
if (key === null) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
const bufferManagerComp = this._bufferOrchestrator?.bufferManagersMap.get(key);
|
|
40
|
+
if (bufferManagerComp === undefined) {
|
|
41
|
+
throw new Error(`Buffer key ${key} does not exist in bufferManagersMap`);
|
|
42
|
+
}
|
|
43
|
+
const { bufferManager } = bufferManagerComp;
|
|
44
|
+
return {
|
|
45
|
+
stride: 0,
|
|
46
|
+
offset: 0,
|
|
47
|
+
buffer: bufferManager.buffer
|
|
48
|
+
};
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
// PLUGIN INTERFACE METHODS
|
|
52
|
+
insertBulk(items) {
|
|
53
|
+
const { _bufferOrchestrator, globe } = this;
|
|
54
|
+
if (!_bufferOrchestrator || !globe) {
|
|
55
|
+
throw new Error("Buffer orchestrator or globe is not initialized.");
|
|
56
|
+
}
|
|
57
|
+
_bufferOrchestrator.insertBulk(items);
|
|
58
|
+
this.globe?.DrawRender();
|
|
59
|
+
}
|
|
60
|
+
deleteBulk(keys) {
|
|
61
|
+
const { _bufferOrchestrator, globe } = this;
|
|
62
|
+
if (!_bufferOrchestrator || !globe) {
|
|
63
|
+
throw new Error("Buffer orchestrator or globe is not initialized.");
|
|
64
|
+
}
|
|
65
|
+
_bufferOrchestrator.deleteBulk(keys);
|
|
66
|
+
this.globe?.DrawRender();
|
|
67
|
+
}
|
|
68
|
+
setPluginOpacity(opacity) {
|
|
69
|
+
constraintFloat(opacity, 0, 1);
|
|
70
|
+
this._options.opacity = opacity;
|
|
71
|
+
this.globe?.DrawRender();
|
|
72
|
+
}
|
|
73
|
+
setPluginDashedLineRatio(ratio) {
|
|
74
|
+
constraintFloat(ratio, 0, 1);
|
|
75
|
+
this._uboHandler?.updateSingle("dashed_line_ratio", new Float32Array([ratio]));
|
|
76
|
+
this.globe?.DrawRender();
|
|
77
|
+
}
|
|
78
|
+
setPluginDashLineOpacity(opacity) {
|
|
79
|
+
constraintFloat(opacity, 0, 1);
|
|
80
|
+
this._options.dashedLineOpacityVariativeOn = true;
|
|
81
|
+
this._options.defaultColor[3] = opacity; // Update the default color's alpha channel
|
|
82
|
+
this.globe?.DrawRender();
|
|
83
|
+
}
|
|
84
|
+
// GLOBE INTERACTION METHODS
|
|
85
|
+
draw3D() {
|
|
86
|
+
if (this._freed) {
|
|
87
|
+
console.warn("Plugin has been freed, cannot draw.");
|
|
88
|
+
}
|
|
89
|
+
;
|
|
90
|
+
if (!this.globe || !this.gl || !this.program || !this.vao) {
|
|
91
|
+
throw new Error("Globe, GL context or program is not initialized.");
|
|
92
|
+
}
|
|
93
|
+
const { _bufferOrchestrator, _options, _uboHandler, vao } = this;
|
|
94
|
+
if (!_bufferOrchestrator || !_bufferOrchestrator || !_uboHandler) {
|
|
95
|
+
throw new Error("Buffer orchestrator is not initialized.");
|
|
96
|
+
}
|
|
97
|
+
const { bufferOrchestrator } = _bufferOrchestrator;
|
|
98
|
+
const { flatViewOn, globeViewOn, opacity } = _options;
|
|
99
|
+
const drawOptions = {
|
|
100
|
+
drawRange: {
|
|
101
|
+
first: 0,
|
|
102
|
+
count: bufferOrchestrator.length
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
this.gl.disable(this.gl.DEPTH_TEST); // Disable depth test for lines
|
|
106
|
+
const currentGeometry = this.globe.api_GetCurrentGeometry();
|
|
107
|
+
if (currentGeometry === 0 && globeViewOn) {
|
|
108
|
+
// @ts-ignore
|
|
109
|
+
this.program.draw(vao, drawOptions, opacity, _uboHandler);
|
|
110
|
+
}
|
|
111
|
+
else if (currentGeometry === 1 && flatViewOn) {
|
|
112
|
+
// @ts-ignore
|
|
113
|
+
this.program.draw(vao, drawOptions, opacity, _uboHandler);
|
|
114
|
+
}
|
|
115
|
+
this.gl.enable(this.gl.DEPTH_TEST); // Re-enable depth test after drawing
|
|
116
|
+
}
|
|
117
|
+
free() {
|
|
118
|
+
if (this._freed)
|
|
119
|
+
return;
|
|
120
|
+
// TODO: FILL
|
|
121
|
+
this._bufferOrchestrator?.free();
|
|
122
|
+
this._uboHandler?.free();
|
|
123
|
+
LineOnGlobeCache.release(this.globe);
|
|
124
|
+
this._freed = true;
|
|
125
|
+
}
|
|
126
|
+
// IMPLICIT INTERFACE METHODS
|
|
127
|
+
_createBufferDetailsMap() {
|
|
128
|
+
const globe = this.globe;
|
|
129
|
+
const { flatViewOn, globeViewOn, variativeColorsOn, dashedLineOpacityVariativeOn, dashedLineRatioVariativeOn, bufferType = "DYNAMIC_DRAW" } = this._options;
|
|
130
|
+
const m = new Map();
|
|
131
|
+
if (flatViewOn) {
|
|
132
|
+
m.set("start_position", {
|
|
133
|
+
itemSize: 2,
|
|
134
|
+
bufferType: bufferType, // TODO: Ask User?
|
|
135
|
+
buffer: null,
|
|
136
|
+
adaptor: (item) => {
|
|
137
|
+
const result = new Float32Array(globe.api_GetMercator2DPoint(item.start[0], item.start[1]));
|
|
138
|
+
return result;
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
m.set("end_position", {
|
|
142
|
+
itemSize: 2,
|
|
143
|
+
bufferType: bufferType,
|
|
144
|
+
buffer: null,
|
|
145
|
+
adaptor: (item) => new Float32Array(globe.api_GetMercator2DPoint(item.end[0], item.end[1]))
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
if (globeViewOn) {
|
|
149
|
+
m.set("start_position_3d", {
|
|
150
|
+
itemSize: 3,
|
|
151
|
+
bufferType: bufferType,
|
|
152
|
+
adaptor: (item) => sphereCoord(item.start[0], item.start[1], globe, item.start_altitude || 0)
|
|
153
|
+
});
|
|
154
|
+
m.set("end_position_3d", {
|
|
155
|
+
itemSize: 3,
|
|
156
|
+
bufferType: bufferType,
|
|
157
|
+
adaptor: (item) => sphereCoord(item.end[0], item.end[1], globe, item.end_altitude || 0)
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
if (variativeColorsOn) {
|
|
161
|
+
m.set("color", {
|
|
162
|
+
itemSize: 4,
|
|
163
|
+
bufferType: bufferType,
|
|
164
|
+
adaptor: (item) => new Float32Array(item.color !== undefined ? item.color : [-1, -1, -1, -1])
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
if (dashedLineOpacityVariativeOn) {
|
|
168
|
+
m.set("dashed_line_opacity", {
|
|
169
|
+
itemSize: 1,
|
|
170
|
+
bufferType: bufferType,
|
|
171
|
+
adaptor: (item) => new Float32Array(item.dashed_line_opacity !== undefined ? [item.dashed_line_opacity] : [-1])
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
if (dashedLineRatioVariativeOn) {
|
|
175
|
+
m.set("dashed_line_ratio", {
|
|
176
|
+
itemSize: 1,
|
|
177
|
+
bufferType: bufferType,
|
|
178
|
+
adaptor: (item) => new Float32Array(item.dashed_line_ratio !== undefined ? [item.dashed_line_ratio] : [-1])
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
return m;
|
|
182
|
+
}
|
|
183
|
+
_createSelectBufferNames() {
|
|
184
|
+
const { flatViewOn, globeViewOn, variativeColorsOn, dashedLineOpacityVariativeOn, dashedLineRatioVariativeOn } = this._options;
|
|
185
|
+
return [
|
|
186
|
+
flatViewOn ? "start_position" : null,
|
|
187
|
+
globeViewOn ? "start_position_3d" : null,
|
|
188
|
+
flatViewOn ? "end_position" : null,
|
|
189
|
+
globeViewOn ? "end_position_3d" : null,
|
|
190
|
+
dashedLineOpacityVariativeOn ? "dashed_line_opacity" : null,
|
|
191
|
+
dashedLineRatioVariativeOn ? "dashed_line_ratio" : null,
|
|
192
|
+
variativeColorsOn ? "color" : null
|
|
193
|
+
];
|
|
194
|
+
}
|
|
195
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { PieceOfPieProgramCache } from "../../programs/rings/partial-ring/piece-of-pie";
|
|
2
|
+
import { BufferManager, BufferOrchestrator } from "../../util/account/single-attribute-buffer-management/index";
|
|
3
|
+
import { sphereCoord } from "../../util/geometry/index";
|
|
4
|
+
import { opacityCheck } from "../../util/check/typecheck";
|
|
5
|
+
const INITIAL_CAPACITY = 10; // Initial capacity for the buffer orchestrator
|
|
6
|
+
const EDGE_COUNT = 100; // Number of edges for the pie chart
|
|
7
|
+
const Radians = Math.PI / 180; // Conversion factor from degrees to radians
|
|
8
|
+
export class PieceOfPiePlugin {
|
|
9
|
+
id;
|
|
10
|
+
_isFreed = false;
|
|
11
|
+
globe = null;
|
|
12
|
+
gl = null;
|
|
13
|
+
program = null;
|
|
14
|
+
vao = null;
|
|
15
|
+
bufferManagersMap = null;
|
|
16
|
+
bufferOrchestrator = new BufferOrchestrator({ capacity: INITIAL_CAPACITY });
|
|
17
|
+
drawMode = "BOTH";
|
|
18
|
+
opacity = 1;
|
|
19
|
+
_pluginOptions = {
|
|
20
|
+
bufferType: "STATIC_DRAW",
|
|
21
|
+
initialCapacity: INITIAL_CAPACITY,
|
|
22
|
+
defaultAltitude: 0, // Default altitude is ground level
|
|
23
|
+
};
|
|
24
|
+
constructor(id, options = {}) {
|
|
25
|
+
this.id = id;
|
|
26
|
+
options.bufferType && (this._pluginOptions.bufferType = options.bufferType);
|
|
27
|
+
options.initialCapacity && (this._pluginOptions.initialCapacity = options.initialCapacity);
|
|
28
|
+
options.defaultAltitude && (this._pluginOptions.defaultAltitude = options.defaultAltitude);
|
|
29
|
+
}
|
|
30
|
+
insertBulk(items) {
|
|
31
|
+
this.bufferOrchestrator.insertBulk(items, this.bufferManagersMap);
|
|
32
|
+
this.globe?.DrawRender();
|
|
33
|
+
}
|
|
34
|
+
deleteBulk(keys) {
|
|
35
|
+
this.bufferOrchestrator.deleteBulk(keys, this.bufferManagersMap);
|
|
36
|
+
this.globe?.DrawRender();
|
|
37
|
+
}
|
|
38
|
+
setPluginOpacity(opacity) {
|
|
39
|
+
opacityCheck(opacity);
|
|
40
|
+
this.opacity = opacity;
|
|
41
|
+
this.globe?.DrawRender();
|
|
42
|
+
}
|
|
43
|
+
setDrawMode(drawMode) {
|
|
44
|
+
if (drawMode !== "TRIANGLE_FAN" && drawMode !== "LINE_STRIP" && drawMode !== "BOTH") {
|
|
45
|
+
throw new Error("Invalid draw mode. Use 'TRIANGLE_FAN' or 'LINE_STRIP'.");
|
|
46
|
+
}
|
|
47
|
+
this.drawMode = drawMode;
|
|
48
|
+
this.globe?.DrawRender();
|
|
49
|
+
}
|
|
50
|
+
_createBufferManagersMap() {
|
|
51
|
+
const { gl, globe, _pluginOptions } = this;
|
|
52
|
+
const { bufferType, initialCapacity } = _pluginOptions;
|
|
53
|
+
if (!gl || !globe) {
|
|
54
|
+
throw new Error("Globe and WebGL context must be initialized before creating buffer management map.");
|
|
55
|
+
}
|
|
56
|
+
const bufferManagersMap = new Map([
|
|
57
|
+
["centerCoords2d", {
|
|
58
|
+
bufferManager: new BufferManager(this.gl, 2, { bufferType: bufferType, initialCapacity }),
|
|
59
|
+
adaptor: (item) => new Float32Array(globe.api_GetMercator2DPoint(item.center[0], item.center[1])),
|
|
60
|
+
}],
|
|
61
|
+
["centerCoords3d", {
|
|
62
|
+
bufferManager: new BufferManager(gl, 3, { bufferType, initialCapacity }),
|
|
63
|
+
adaptor: (item) => sphereCoord(item.center[0], item.center[1], globe, (item.altitude ?? this._pluginOptions.defaultAltitude) / 1000)
|
|
64
|
+
}],
|
|
65
|
+
["startAngle2d", {
|
|
66
|
+
bufferManager: new BufferManager(gl, 1, { bufferType, initialCapacity }),
|
|
67
|
+
adaptor: (item) => {
|
|
68
|
+
if (item.startAngle2D === undefined) {
|
|
69
|
+
return new Float32Array([0]); // Default angle if not provided
|
|
70
|
+
}
|
|
71
|
+
return new Float32Array([(item.startAngle2D) * Radians]);
|
|
72
|
+
}
|
|
73
|
+
}],
|
|
74
|
+
["tailAngle2d", {
|
|
75
|
+
bufferManager: new BufferManager(gl, 1, { bufferType, initialCapacity }),
|
|
76
|
+
adaptor: (item) => {
|
|
77
|
+
if (item.coverAngle2D === undefined) {
|
|
78
|
+
return new Float32Array([0]); // Default angle if not provided
|
|
79
|
+
}
|
|
80
|
+
return new Float32Array([item.coverAngle2D * Radians]);
|
|
81
|
+
}
|
|
82
|
+
}],
|
|
83
|
+
["startAngle3d", {
|
|
84
|
+
bufferManager: new BufferManager(gl, 1, { bufferType, initialCapacity }),
|
|
85
|
+
adaptor: (item) => {
|
|
86
|
+
if (item.startAngle3D === undefined) {
|
|
87
|
+
return new Float32Array([0]); // Default angle if not provided
|
|
88
|
+
}
|
|
89
|
+
return new Float32Array([item.startAngle3D * Radians]);
|
|
90
|
+
}
|
|
91
|
+
}],
|
|
92
|
+
["tailAngle3d", {
|
|
93
|
+
bufferManager: new BufferManager(gl, 1, { bufferType, initialCapacity }),
|
|
94
|
+
adaptor: (item) => {
|
|
95
|
+
if (item.coverAngle3D === undefined) {
|
|
96
|
+
return new Float32Array([0]); // Default angle if not provided
|
|
97
|
+
}
|
|
98
|
+
return new Float32Array([item.coverAngle3D * Radians]);
|
|
99
|
+
}
|
|
100
|
+
}],
|
|
101
|
+
["fillingMode", {
|
|
102
|
+
bufferManager: new BufferManager(gl, 1, { bufferType, initialCapacity }),
|
|
103
|
+
adaptor: (item) => new Float32Array([item.fillingMode ?? 0])
|
|
104
|
+
}],
|
|
105
|
+
["rgba", {
|
|
106
|
+
bufferManager: new BufferManager(gl, 4, { bufferType, initialCapacity }),
|
|
107
|
+
adaptor: (item) => {
|
|
108
|
+
if (!item.color || item.color.length === 0) {
|
|
109
|
+
return new Float32Array([1, 1, 1, 1]); // Default color if none provided
|
|
110
|
+
}
|
|
111
|
+
return new Float32Array(item.color);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
],
|
|
115
|
+
["radius", {
|
|
116
|
+
bufferManager: new BufferManager(gl, 1, { bufferType, initialCapacity }),
|
|
117
|
+
adaptor: (item) => new Float32Array([item.radius])
|
|
118
|
+
}],
|
|
119
|
+
]);
|
|
120
|
+
this.bufferManagersMap = bufferManagersMap;
|
|
121
|
+
}
|
|
122
|
+
init(globe, gl) {
|
|
123
|
+
this.globe = globe;
|
|
124
|
+
this.gl = gl;
|
|
125
|
+
this.program = PieceOfPieProgramCache.get(globe);
|
|
126
|
+
this._createBufferManagersMap();
|
|
127
|
+
this.vao = this.program.createVAO(
|
|
128
|
+
//@ts-ignore
|
|
129
|
+
...['centerCoords2d',
|
|
130
|
+
'centerCoords3d',
|
|
131
|
+
'startAngle2d',
|
|
132
|
+
'tailAngle2d',
|
|
133
|
+
'startAngle3d',
|
|
134
|
+
'tailAngle3d',
|
|
135
|
+
'rgba',
|
|
136
|
+
'radius',
|
|
137
|
+
'fillingMode'].map((name) => {
|
|
138
|
+
const buffer = this.bufferManagersMap?.get(name)?.bufferManager.buffer;
|
|
139
|
+
return {
|
|
140
|
+
buffer: buffer,
|
|
141
|
+
stride: 0,
|
|
142
|
+
offset: 0,
|
|
143
|
+
};
|
|
144
|
+
}));
|
|
145
|
+
}
|
|
146
|
+
draw3D() {
|
|
147
|
+
if (!this.gl || !this.program || !this.vao || !this.globe) {
|
|
148
|
+
console.warn("PieChartPlugin is not initialized properly.");
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const length = this.bufferOrchestrator.length;
|
|
152
|
+
console.log("Drawing PieChartPlugin with length:", length);
|
|
153
|
+
this.gl.disable(this.gl.DEPTH_TEST);
|
|
154
|
+
if (this.drawMode === "BOTH") {
|
|
155
|
+
this.program?.draw(length, this.vao, EDGE_COUNT, this.opacity, "LINE_STRIP");
|
|
156
|
+
this.program?.draw(length, this.vao, EDGE_COUNT, this.opacity, "TRIANGLE_FAN");
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
this.program?.draw(length, this.vao, EDGE_COUNT, this.opacity, this.drawMode);
|
|
160
|
+
}
|
|
161
|
+
this.gl.enable(this.gl.DEPTH_TEST);
|
|
162
|
+
}
|
|
163
|
+
free() {
|
|
164
|
+
if (this._isFreed) {
|
|
165
|
+
console.warn("PieChartPlugin is already freed.");
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
PieceOfPieProgramCache.release(this.globe);
|
|
169
|
+
this.gl?.deleteVertexArray(this.vao);
|
|
170
|
+
this._isFreed = true;
|
|
171
|
+
this.globe = null;
|
|
172
|
+
this.gl = null;
|
|
173
|
+
this.program = null;
|
|
174
|
+
}
|
|
175
|
+
}
|