@pirireis/webglobeplugins 1.2.19 → 1.2.21
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
|
@@ -298,6 +298,8 @@ export class TerrainPolygonSemiPlugin {
|
|
|
298
298
|
if (this._options.pickable === false) {
|
|
299
299
|
throw new Error("TerrainPolygonSemiPlugin is not pickable. Set pickable option to true on construction to enable picking.");
|
|
300
300
|
}
|
|
301
|
+
if (this._useDepth())
|
|
302
|
+
return null;
|
|
301
303
|
return this._lastPickedPolygon;
|
|
302
304
|
}
|
|
303
305
|
getPolygon(key) {
|
|
@@ -396,11 +398,22 @@ export class TerrainPolygonSemiPlugin {
|
|
|
396
398
|
this._pickerDisplayer?.resize();
|
|
397
399
|
}
|
|
398
400
|
}
|
|
399
|
-
|
|
400
|
-
const gl = this.globe.gl;
|
|
401
|
+
_useDepth() {
|
|
401
402
|
const { Tilt } = this.globe.api_GetCurrentLookInfo();
|
|
402
403
|
const useDepth = Tilt > DEPTH_START_ANGLE;
|
|
403
|
-
|
|
404
|
+
if (this._lastPickedPolygon !== null && useDepth) {
|
|
405
|
+
this._lastPickedPolygon = null;
|
|
406
|
+
this.globe.DrawRender();
|
|
407
|
+
this._uboHandler.updateSingle("private_pickedIndex", new Float32Array([IndexAttributeEscapeValue]));
|
|
408
|
+
}
|
|
409
|
+
return useDepth;
|
|
410
|
+
}
|
|
411
|
+
getDepthStartAngle() {
|
|
412
|
+
return DEPTH_START_ANGLE;
|
|
413
|
+
}
|
|
414
|
+
draw3D() {
|
|
415
|
+
const gl = this.globe.gl;
|
|
416
|
+
const useDepth = this._useDepth();
|
|
404
417
|
gl.enable(gl.BLEND);
|
|
405
418
|
defaultblendfunction(gl);
|
|
406
419
|
// Use LEQUAL. Since Poly didn't write depth, lines test against Terrain.
|
|
@@ -434,6 +447,9 @@ export class TerrainPolygonSemiPlugin {
|
|
|
434
447
|
prevDepthMask = gl.getParameter(gl.DEPTH_WRITEMASK);
|
|
435
448
|
gl.depthMask(false);
|
|
436
449
|
}
|
|
450
|
+
else {
|
|
451
|
+
gl.disable(gl.DEPTH_TEST);
|
|
452
|
+
}
|
|
437
453
|
this._program.draw(this._attributeLoader, this._drawRangeIndexParams, this._uboHandler);
|
|
438
454
|
// Restore states
|
|
439
455
|
// --- FIX END ---
|
|
@@ -500,26 +516,6 @@ function inputCheck(input) {
|
|
|
500
516
|
}
|
|
501
517
|
return true;
|
|
502
518
|
}
|
|
503
|
-
function getGlStates(gl) {
|
|
504
|
-
return {
|
|
505
|
-
depthTest: gl.isEnabled(gl.DEPTH_TEST),
|
|
506
|
-
cullFace: gl.isEnabled(gl.CULL_FACE),
|
|
507
|
-
blend: gl.isEnabled(gl.BLEND),
|
|
508
|
-
scissorTest: gl.isEnabled(gl.SCISSOR_TEST),
|
|
509
|
-
depthMask: gl.getParameter(gl.DEPTH_WRITEMASK),
|
|
510
|
-
colorMask: gl.getParameter(gl.COLOR_WRITEMASK),
|
|
511
|
-
frontFace: gl.getParameter(gl.FRONT_FACE),
|
|
512
|
-
viewport: gl.getParameter(gl.VIEWPORT),
|
|
513
|
-
scissorBox: gl.getParameter(gl.SCISSOR_BOX),
|
|
514
|
-
currentProgram: gl.getParameter(gl.CURRENT_PROGRAM),
|
|
515
|
-
vao: gl.getParameter(gl.VERTEX_ARRAY_BINDING),
|
|
516
|
-
arrayBuffer: gl.getParameter(gl.ARRAY_BUFFER_BINDING),
|
|
517
|
-
elementArrayBuffer: gl.getParameter(gl.ELEMENT_ARRAY_BUFFER_BINDING),
|
|
518
|
-
framebuffer: gl.getParameter(gl.FRAMEBUFFER_BINDING),
|
|
519
|
-
activeTexture: gl.getParameter(gl.ACTIVE_TEXTURE),
|
|
520
|
-
texture2DArray: gl.getParameter(gl.TEXTURE_BINDING_2D_ARRAY),
|
|
521
|
-
};
|
|
522
|
-
}
|
|
523
519
|
function roundTo6(n) {
|
|
524
520
|
// Keep at most 6 digits after the decimal (degrees), then quantize to float32
|
|
525
521
|
// to match GPU attribute precision and make identity comparisons stable.
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* add implicit texture display program for color
|
|
3
|
-
* add fence on query return and return id.
|
|
4
|
-
* support R32I, R32F, R16UI, R32UI
|
|
5
|
-
*/
|
|
6
1
|
import { textureOnCanvasProgramCache } from "../programs/draw-texture-on-canvas";
|
|
7
2
|
import { fence } from "./fence";
|
|
8
3
|
const ESCAPE_VALUE = -1;
|