@idetik/core 0.22.1 → 0.22.2
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
CHANGED
|
@@ -375,7 +375,6 @@ type LayerState = "initialized" | "loading" | "ready";
|
|
|
375
375
|
type BlendMode = "none" | "normal" | "additive" | "subtractive" | "multiply" | "premultiplied";
|
|
376
376
|
type StateChangeCallback = (newState: LayerState, prevState?: LayerState) => void;
|
|
377
377
|
interface LayerOptions {
|
|
378
|
-
transparent?: boolean;
|
|
379
378
|
opacity?: number;
|
|
380
379
|
blendMode?: BlendMode;
|
|
381
380
|
}
|
|
@@ -387,10 +386,9 @@ declare abstract class Layer {
|
|
|
387
386
|
private objects_;
|
|
388
387
|
private state_;
|
|
389
388
|
private readonly callbacks_;
|
|
390
|
-
transparent: boolean;
|
|
391
389
|
private opacity_;
|
|
392
390
|
blendMode: BlendMode;
|
|
393
|
-
constructor({
|
|
391
|
+
constructor({ opacity, blendMode }?: LayerOptions);
|
|
394
392
|
get opacity(): number;
|
|
395
393
|
set opacity(value: number);
|
|
396
394
|
abstract update(context?: RenderContext): void;
|
package/dist/index.js
CHANGED
|
@@ -1676,7 +1676,7 @@ class sC extends eQ {
|
|
|
1676
1676
|
}
|
|
1677
1677
|
renderLayer(A, I, g) {
|
|
1678
1678
|
if (A.objects.length === 0) return;
|
|
1679
|
-
this.state_.setBlendingMode(A.
|
|
1679
|
+
this.state_.setBlendingMode(A.blendMode);
|
|
1680
1680
|
const B = A.hasMultipleLODs();
|
|
1681
1681
|
this.state_.setStencilTest(B), B && this.gl_.clear(this.gl_.STENCIL_BUFFER_BIT), A.objects.forEach((Q, E) => {
|
|
1682
1682
|
g.intersectsWithBox3(Q.boundingBox) && (this.renderObject(A, E, I), this.renderedObjectsPerFrame_ += 1);
|
|
@@ -8316,7 +8316,7 @@ class Ro extends eQ {
|
|
|
8316
8316
|
const E = this.device_.createCommandEncoder();
|
|
8317
8317
|
this.passEncoder_ = this.beginRenderPass(E);
|
|
8318
8318
|
const { x: i, y: o, width: s, height: t } = B.floor().toRect();
|
|
8319
|
-
this.passEncoder_.setViewport(i, o, s, t, 0, 1), Q && this.passEncoder_.setScissorRect(i, o, s, t), this.currentStencil_ = A.hasMultipleLODs(), this.currentStencil_ && this.passEncoder_.setStencilReference(0), this.currentBlendMode_ = A.
|
|
8319
|
+
this.passEncoder_.setViewport(i, o, s, t, 0, 1), Q && this.passEncoder_.setScissorRect(i, o, s, t), this.currentStencil_ = A.hasMultipleLODs(), this.currentStencil_ && this.passEncoder_.setStencilReference(0), this.currentBlendMode_ = A.blendMode, this.currentOpacity_ = A.opacity, A.objects.forEach((a, r) => {
|
|
8320
8320
|
g.intersectsWithBox3(a.boundingBox) && (this.renderObject(A, r, I), this.renderedObjectsPerFrame_ += 1);
|
|
8321
8321
|
}), this.passEncoder_.end(), this.device_.queue.submit([E.finish()]), this.passEncoder_ = null;
|
|
8322
8322
|
}
|
|
@@ -9173,7 +9173,7 @@ class uo {
|
|
|
9173
9173
|
partitionLayers() {
|
|
9174
9174
|
const A = [], I = [];
|
|
9175
9175
|
for (const g of this.layers)
|
|
9176
|
-
g.
|
|
9176
|
+
g.blendMode === "none" ? A.push(g) : I.push(g);
|
|
9177
9177
|
return { opaque: A, transparent: I };
|
|
9178
9178
|
}
|
|
9179
9179
|
add(A) {
|
|
@@ -10101,18 +10101,13 @@ class Rg {
|
|
|
10101
10101
|
objects_ = [];
|
|
10102
10102
|
state_ = "initialized";
|
|
10103
10103
|
callbacks_ = [];
|
|
10104
|
-
transparent;
|
|
10105
10104
|
opacity_;
|
|
10106
10105
|
blendMode;
|
|
10107
|
-
constructor({
|
|
10108
|
-
|
|
10109
|
-
opacity: I = 1,
|
|
10110
|
-
blendMode: g = "normal"
|
|
10111
|
-
} = {}) {
|
|
10112
|
-
(I < 0 || I > 1) && u.warn(
|
|
10106
|
+
constructor({ opacity: A = 1, blendMode: I = "none" } = {}) {
|
|
10107
|
+
(A < 0 || A > 1) && u.warn(
|
|
10113
10108
|
"Layer",
|
|
10114
|
-
`Layer opacity out of bounds: ${
|
|
10115
|
-
), this.
|
|
10109
|
+
`Layer opacity out of bounds: ${A} — clamping to [0.0, 1.0]`
|
|
10110
|
+
), this.opacity_ = XA(A, 0, 1), this.blendMode = I;
|
|
10116
10111
|
}
|
|
10117
10112
|
get opacity() {
|
|
10118
10113
|
return this.opacity_;
|
|
@@ -10994,7 +10989,7 @@ class ra extends Rg {
|
|
|
10994
10989
|
this.channelChangeCallbacks_.splice(I, 1);
|
|
10995
10990
|
}
|
|
10996
10991
|
constructor({ source: A, sliceCoords: I, policy: g, channelProps: B }) {
|
|
10997
|
-
super({
|
|
10992
|
+
super({ blendMode: "premultiplied" }), this.source_ = A, this.sliceCoords_ = I, this.sourcePolicy_ = g, this.initialChannelProps_ = B, this.channelProps_ = B, this.setState("initialized");
|
|
10998
10993
|
}
|
|
10999
10994
|
getOrCreateVolume(A, I) {
|
|
11000
10995
|
const g = this.currentVolumes_.get(A);
|