@pirireis/webglobeplugins 1.1.9 → 1.1.11
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
|
@@ -162,6 +162,18 @@ export class TerrainPolygonSemiPlugin {
|
|
|
162
162
|
this.globe.DrawRender();
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
+
getPickedPolygon() {
|
|
166
|
+
if (this._options.pickable === false) {
|
|
167
|
+
throw new Error("TerrainPolygonSemiPlugin is not pickable. Set pickable option to true on construction to enable picking.");
|
|
168
|
+
}
|
|
169
|
+
return this._lastPickedPolygon;
|
|
170
|
+
}
|
|
171
|
+
getPolygon(key) {
|
|
172
|
+
const index = this._indexPolygonMap['_polygonKeyMap'].get(key);
|
|
173
|
+
if (index === undefined)
|
|
174
|
+
return null;
|
|
175
|
+
return this._indexPolygonMap.get(index);
|
|
176
|
+
}
|
|
165
177
|
setBuffers(data) {
|
|
166
178
|
const gl = this.globe.gl;
|
|
167
179
|
const posVertexCount = Math.floor(data.vec3s.length / 3);
|
|
@@ -175,26 +187,28 @@ export class TerrainPolygonSemiPlugin {
|
|
|
175
187
|
}
|
|
176
188
|
// Guard against invalid indices referencing beyond uploaded attribute buffers.
|
|
177
189
|
// This prevents ANGLE "Vertex buffer is not big enough for the draw call" errors.
|
|
178
|
-
let maxTriangleIndex = -1;
|
|
179
|
-
for (let i = 0; i < data.indices.length; i++) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
190
|
+
// let maxTriangleIndex = -1;
|
|
191
|
+
// // for (let i = 0; i < data.indices.length; i++) {
|
|
192
|
+
// // const v = data.indices[i];
|
|
193
|
+
// // if (v > maxTriangleIndex) maxTriangleIndex = v;
|
|
194
|
+
// // }
|
|
195
|
+
// const trianglesInvalid = safeVertexCount === 0 || maxTriangleIndex >= safeVertexCount;
|
|
196
|
+
// if (trianglesInvalid) {
|
|
197
|
+
// console.warn(
|
|
198
|
+
// "TerrainPolygonSemiPlugin: skipping draw due to invalid vertex/index sizing",
|
|
199
|
+
// {
|
|
200
|
+
// posVertexCount,
|
|
201
|
+
// xyVertexCount,
|
|
202
|
+
// safeVertexCount,
|
|
203
|
+
// indicesLength: data.indices.length,
|
|
204
|
+
// maxTriangleIndex,
|
|
205
|
+
// pickIndicesLength: data.pickIndices?.length ?? null,
|
|
206
|
+
// variativeColorsLength: data.variativeColors?.length ?? null,
|
|
207
|
+
// }
|
|
208
|
+
// );
|
|
209
|
+
// this._drawRangeIndexParams.drawRange.count = 0;
|
|
210
|
+
// this._drawPointsRangeIndexParams.drawRange.count = 0;
|
|
211
|
+
// }
|
|
198
212
|
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._elementArrayBuffer);
|
|
199
213
|
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, data.indices, gl.STREAM_DRAW);
|
|
200
214
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._vec3Buffer);
|
|
@@ -240,12 +254,6 @@ export class TerrainPolygonSemiPlugin {
|
|
|
240
254
|
this._drawPointsRangeIndexParams.drawRange.count = data.indices.length;
|
|
241
255
|
this.globe.DrawRender();
|
|
242
256
|
}
|
|
243
|
-
getPickedPolygon() {
|
|
244
|
-
if (this._options.pickable === false) {
|
|
245
|
-
throw new Error("TerrainPolygonSemiPlugin is not pickable. Set pickable option to true on construction to enable picking.");
|
|
246
|
-
}
|
|
247
|
-
return this._lastPickedPolygon;
|
|
248
|
-
}
|
|
249
257
|
_selfSelect() {
|
|
250
258
|
const { globe, _pickerDisplayer } = this;
|
|
251
259
|
const pos = globe.api_GetMousePos();
|