@idetik/core 0.5.1 → 0.6.1
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/dist/index.d.ts +3 -0
- package/dist/index.js +24 -6
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/dist/types/src/core/layer.d.ts +1 -0
- package/dist/types/src/core/layer.d.ts.map +1 -1
- package/dist/types/src/layers/chunked_image_layer.d.ts +1 -0
- package/dist/types/src/layers/chunked_image_layer.d.ts.map +1 -1
- package/dist/types/src/renderers/WebGLState.d.ts +1 -0
- package/dist/types/src/renderers/WebGLState.d.ts.map +1 -1
- package/dist/types/src/renderers/webgl_renderer.d.ts +1 -0
- package/dist/types/src/renderers/webgl_renderer.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -434,6 +434,7 @@ declare abstract class Layer {
|
|
|
434
434
|
get state(): LayerState;
|
|
435
435
|
addStateChangeCallback(callback: StateChangeCallback): void;
|
|
436
436
|
removeStateChangeCallback(callback: StateChangeCallback): void;
|
|
437
|
+
hasMultipleLODs(): boolean;
|
|
437
438
|
protected setState(newState: LayerState): void;
|
|
438
439
|
protected addObject(object: RenderableObject): void;
|
|
439
440
|
protected removeObject(object: RenderableObject): void;
|
|
@@ -685,6 +686,7 @@ declare class WebGLRenderer extends Renderer {
|
|
|
685
686
|
textures: number;
|
|
686
687
|
totalBytes: number;
|
|
687
688
|
};
|
|
689
|
+
private initStencil;
|
|
688
690
|
private renderLayer;
|
|
689
691
|
protected renderObject(layer: Layer, objectIndex: number, camera: Camera): void;
|
|
690
692
|
private drawGeometry;
|
|
@@ -820,6 +822,7 @@ declare class ChunkedImageLayer extends Layer implements ChannelsEnabled {
|
|
|
820
822
|
onDetached(_context: IdetikContext): void;
|
|
821
823
|
update(context?: RenderContext): void;
|
|
822
824
|
private updateChunks;
|
|
825
|
+
hasMultipleLODs(): boolean;
|
|
823
826
|
get lastPresentationTimeCoord(): number | undefined;
|
|
824
827
|
private isPresentationStale;
|
|
825
828
|
private resliceIfZChanged;
|
package/dist/index.js
CHANGED
|
@@ -1799,6 +1799,9 @@ class pQ {
|
|
|
1799
1799
|
this.currentCullingMode_ = A;
|
|
1800
1800
|
}
|
|
1801
1801
|
}
|
|
1802
|
+
setStencilTest(A) {
|
|
1803
|
+
A ? this.enable(this.gl_.STENCIL_TEST) : this.disable(this.gl_.STENCIL_TEST);
|
|
1804
|
+
}
|
|
1802
1805
|
}
|
|
1803
1806
|
const mQ = DQ(AA(), [1, -1, 1]);
|
|
1804
1807
|
class uQ extends OB {
|
|
@@ -1812,14 +1815,15 @@ class uQ extends OB {
|
|
|
1812
1815
|
super(A);
|
|
1813
1816
|
const I = this.canvas.getContext("webgl2", {
|
|
1814
1817
|
depth: !0,
|
|
1815
|
-
antialias: !0
|
|
1818
|
+
antialias: !0,
|
|
1819
|
+
stencil: !0
|
|
1816
1820
|
});
|
|
1817
1821
|
if (!I)
|
|
1818
1822
|
throw new Error("Failed to initialize WebGL2 context");
|
|
1819
1823
|
this.gl_ = I, U.info(
|
|
1820
1824
|
"WebGLRenderer",
|
|
1821
1825
|
`WebGL version ${I.getParameter(I.VERSION)}`
|
|
1822
|
-
), this.programs_ = new EQ(I), this.bindings_ = new lQ(I), this.textures_ = new fQ(I), this.state_ = new pQ(I), this.resize(this.canvas.width, this.canvas.height);
|
|
1826
|
+
), this.programs_ = new EQ(I), this.bindings_ = new lQ(I), this.textures_ = new fQ(I), this.state_ = new pQ(I), this.initStencil(), this.resize(this.canvas.width, this.canvas.height);
|
|
1823
1827
|
}
|
|
1824
1828
|
render(A) {
|
|
1825
1829
|
const I = A.getBoxRelativeTo(this.canvas), B = new z(
|
|
@@ -1851,9 +1855,14 @@ class uQ extends OB {
|
|
|
1851
1855
|
get textureInfo() {
|
|
1852
1856
|
return this.textures_.textureInfo;
|
|
1853
1857
|
}
|
|
1858
|
+
initStencil() {
|
|
1859
|
+
this.gl_.clearStencil(0), this.gl_.stencilMask(255), this.gl_.stencilFunc(this.gl_.EQUAL, 0, 255), this.gl_.stencilOp(this.gl_.KEEP, this.gl_.KEEP, this.gl_.INCR);
|
|
1860
|
+
}
|
|
1854
1861
|
renderLayer(A, I, B) {
|
|
1855
|
-
this.state_.setBlendingMode(A.transparent ? A.blendMode : "none")
|
|
1856
|
-
|
|
1862
|
+
this.state_.setBlendingMode(A.transparent ? A.blendMode : "none");
|
|
1863
|
+
const Q = A.objects.length > 0 && A.hasMultipleLODs();
|
|
1864
|
+
this.state_.setStencilTest(Q), Q && this.gl_.clear(this.gl_.STENCIL_BUFFER_BIT), A.objects.forEach((C, E) => {
|
|
1865
|
+
B.intersectsWithBox3(C.boundingBox) && (this.renderObject(A, E, I), this.renderedObjectsPerFrame_ += 1);
|
|
1857
1866
|
});
|
|
1858
1867
|
}
|
|
1859
1868
|
renderObject(A, I, B) {
|
|
@@ -2050,9 +2059,12 @@ class bQ {
|
|
|
2050
2059
|
const I = this.store_.getTimeIndex(A), B = this.store_.getChunksAtTime(I), Q = B.filter(
|
|
2051
2060
|
(i) => i.lod === this.currentLOD_ && this.chunkViewStates_.get(i)?.visible === !0 && i.state === "loaded"
|
|
2052
2061
|
), C = this.store_.getLowestResLOD();
|
|
2053
|
-
|
|
2062
|
+
if (this.currentLOD_ === C)
|
|
2063
|
+
return Q;
|
|
2064
|
+
const E = B.filter(
|
|
2054
2065
|
(i) => i.lod === C && this.chunkViewStates_.get(i)?.visible === !0 && i.state === "loaded"
|
|
2055
|
-
)
|
|
2066
|
+
);
|
|
2067
|
+
return [...Q, ...E];
|
|
2056
2068
|
}
|
|
2057
2069
|
updateChunkStates(A, I) {
|
|
2058
2070
|
const B = I.camera;
|
|
@@ -3353,6 +3365,9 @@ class GA {
|
|
|
3353
3365
|
throw new Error(`Callback to remove could not be found: ${A}`);
|
|
3354
3366
|
this.callbacks_.splice(I, 1);
|
|
3355
3367
|
}
|
|
3368
|
+
hasMultipleLODs() {
|
|
3369
|
+
return !1;
|
|
3370
|
+
}
|
|
3356
3371
|
setState(A) {
|
|
3357
3372
|
const I = this.state_;
|
|
3358
3373
|
this.state_ = A, this.callbacks_.forEach((B) => B(A, I));
|
|
@@ -3974,6 +3989,9 @@ class NB extends GA {
|
|
|
3974
3989
|
this.visibleChunks_.set(Q, C), this.addObject(C);
|
|
3975
3990
|
}
|
|
3976
3991
|
}
|
|
3992
|
+
hasMultipleLODs() {
|
|
3993
|
+
return this.chunkStoreView_ ? this.chunkStoreView_.lodCount > 1 : !1;
|
|
3994
|
+
}
|
|
3977
3995
|
get lastPresentationTimeCoord() {
|
|
3978
3996
|
return this.lastPresentationTimeCoord_;
|
|
3979
3997
|
}
|