sfml.js 1.0.0 → 1.1.0
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/README.ja.md +10 -9
- package/README.ko.md +10 -9
- package/README.md +10 -9
- package/README.zh-CN.md +10 -9
- package/binding.gyp +23 -16
- package/dist/audio/effect-processor.js +9 -3
- package/dist/audio/input-sound-file.js +41 -15
- package/dist/audio/listener.js +33 -11
- package/dist/audio/music.js +41 -18
- package/dist/audio/output-sound-file.js +4 -2
- package/dist/audio/playback-device.js +11 -3
- package/dist/audio/sound-buffer-recorder.js +8 -5
- package/dist/audio/sound-buffer.js +40 -17
- package/dist/audio/sound-file-factory.js +21 -9
- package/dist/audio/sound-file-reader.js +21 -7
- package/dist/audio/sound-recorder.js +36 -15
- package/dist/audio/sound-source.js +117 -40
- package/dist/audio/sound-stream.js +14 -5
- package/dist/audio/sound.js +9 -4
- package/dist/audio/value.js +42 -16
- package/dist/graphics/blend-mode.js +2 -1
- package/dist/graphics/boolean-vector.d.ts +1 -2
- package/dist/graphics/boolean-vector.js +19 -9
- package/dist/graphics/color.js +2 -1
- package/dist/graphics/convex-shape.js +7 -3
- package/dist/graphics/font.js +52 -23
- package/dist/graphics/glsl-matrix.js +8 -3
- package/dist/graphics/glsl.js +47 -16
- package/dist/graphics/glyph.js +27 -10
- package/dist/graphics/image.js +30 -14
- package/dist/graphics/rect.js +15 -8
- package/dist/graphics/render-states.js +18 -9
- package/dist/graphics/render-target.js +49 -23
- package/dist/graphics/render-texture.js +24 -12
- package/dist/graphics/render-window.js +6 -3
- package/dist/graphics/shader.js +67 -32
- package/dist/graphics/shape.js +25 -13
- package/dist/graphics/sprite.js +19 -9
- package/dist/graphics/stencil-mode.js +10 -6
- package/dist/graphics/swap.js +2 -1
- package/dist/graphics/text.js +123 -48
- package/dist/graphics/texture.js +48 -24
- package/dist/graphics/transform.js +29 -13
- package/dist/graphics/transformable.js +2 -1
- package/dist/graphics/vertex-array.js +40 -18
- package/dist/graphics/vertex-buffer.js +39 -19
- package/dist/graphics/vertex.js +6 -3
- package/dist/graphics/view.js +30 -14
- package/dist/index.d.ts +4 -4
- package/dist/internal/audio-codec-registry.js +12 -6
- package/dist/internal/audio-input-stream.js +2 -1
- package/dist/internal/audio-music-pump.js +58 -24
- package/dist/internal/audio-recorder-session.js +17 -7
- package/dist/internal/audio-worker-session.js +28 -10
- package/dist/internal/audio-worker.js +40 -21
- package/dist/internal/glsl-value.d.ts +3 -1
- package/dist/internal/glsl-value.js +18 -8
- package/dist/internal/graphics-state.js +29 -15
- package/dist/internal/input-stream.d.ts +3 -1
- package/dist/internal/input-stream.js +16 -7
- package/dist/internal/numeric-properties.js +2 -1
- package/dist/internal/render-states.js +2 -1
- package/dist/internal/scalar.js +22 -13
- package/dist/internal/shaped-glyph.d.ts +3 -1
- package/dist/internal/shaped-glyph.js +12 -4
- package/dist/internal/struct-view.d.ts +3 -1
- package/dist/internal/struct-view.js +3 -1
- package/dist/internal/transformable.js +2 -1
- package/dist/network/common.js +23 -11
- package/dist/network/dns.js +25 -17
- package/dist/network/ftp.js +43 -18
- package/dist/network/http.js +126 -56
- package/dist/network/ip-address.js +50 -25
- package/dist/network/packet.js +63 -25
- package/dist/network/sftp.js +175 -74
- package/dist/network/socket-selector.js +28 -14
- package/dist/network/socket.js +71 -30
- package/dist/network/tcp-listener.js +42 -19
- package/dist/network/tcp-socket.js +111 -53
- package/dist/network/tls-material.js +2 -1
- package/dist/network/udp-socket.js +68 -33
- package/dist/system/angle.js +2 -1
- package/dist/system/clock.js +4 -2
- package/dist/system/err.js +5 -2
- package/dist/system/file-input-stream.js +8 -4
- package/dist/system/input-stream.js +6 -3
- package/dist/system/operators.d.ts +1 -1
- package/dist/system/operators.js +90 -50
- package/dist/system/sleep.js +4 -2
- package/dist/system/time.js +12 -6
- package/dist/system/vector2.js +6 -7
- package/dist/system/vector3.js +11 -6
- package/dist/window/clipboard.js +2 -1
- package/dist/window/context.js +10 -5
- package/dist/window/cursor.js +2 -1
- package/dist/window/event.js +9 -5
- package/dist/window/mouse.js +4 -2
- package/dist/window/video-mode.js +2 -1
- package/dist/window/window.js +19 -12
- package/native/addon.cc +25 -12
- package/native/audio-binding.cc +266 -126
- package/native/audio-codec-binding.cc +147 -77
- package/native/audio-device-binding.cc +76 -49
- package/native/audio-file-binding.cc +116 -67
- package/native/audio-recorder-binding.cc +147 -98
- package/native/audio-recorder.h +1 -1
- package/native/audio-state.h +53 -30
- package/native/audio-stream-binding.cc +148 -94
- package/native/audio-stream.h +5 -4
- package/native/audio-worker-binding.cc +163 -81
- package/native/audio-worker.h +35 -19
- package/native/batch-drawable.cc +29 -16
- package/native/batch-drawable.h +11 -8
- package/native/context-binding.cc +40 -27
- package/native/context-settings.h +15 -8
- package/native/deferred-delete.cc +9 -6
- package/native/deferred-delete.h +7 -8
- package/native/error-stream-binding.cc +42 -28
- package/native/font-binding.cc +89 -48
- package/native/graphics-binding.cc +122 -72
- package/native/graphics-state.h +50 -36
- package/native/image-binding.cc +38 -24
- package/native/image-state.h +26 -18
- package/native/input-binding.cc +42 -27
- package/native/render-window-binding.cc +38 -23
- package/native/shader-binding.cc +115 -50
- package/native/shape-binding.cc +94 -49
- package/native/shape-state.h +18 -9
- package/native/shaped-glyph-storage.h +9 -5
- package/native/stream-binding.cc +143 -117
- package/native/system-binding.cc +17 -12
- package/native/text-binding.cc +68 -35
- package/native/text-state.h +25 -18
- package/native/texture-binding.cc +42 -33
- package/native/texture-resource.h +20 -12
- package/native/time-value.h +3 -1
- package/native/transformable-binding.cc +12 -6
- package/native/transformable-state.h +6 -6
- package/native/value-binding.h +46 -28
- package/native/value-layout.h +10 -10
- package/native/values-binding.cc +29 -23
- package/native/vertex-binding.cc +18 -12
- package/native/vertex-buffer-binding.cc +38 -24
- package/native/vertex-storage.h +2 -2
- package/native/view-data.h +4 -3
- package/native/window-binding.cc +75 -45
- package/native/window-event.h +20 -11
- package/native/window-owner.h +15 -12
- package/package.json +40 -48
- package/src/audio/effect-processor.ts +9 -3
- package/src/audio/input-sound-file.ts +108 -36
- package/src/audio/listener.ts +39 -13
- package/src/audio/music.ts +112 -47
- package/src/audio/output-sound-file.ts +40 -11
- package/src/audio/playback-device.ts +23 -8
- package/src/audio/sound-buffer-recorder.ts +35 -13
- package/src/audio/sound-buffer.ts +166 -58
- package/src/audio/sound-file-factory.ts +127 -49
- package/src/audio/sound-file-reader.ts +49 -15
- package/src/audio/sound-recorder.ts +100 -34
- package/src/audio/sound-source.ts +142 -45
- package/src/audio/sound-stream.ts +15 -5
- package/src/audio/sound.ts +12 -4
- package/src/audio/value.ts +89 -26
- package/src/graphics/blend-mode.ts +3 -1
- package/src/graphics/boolean-vector.ts +56 -26
- package/src/graphics/color.ts +3 -1
- package/src/graphics/convex-shape.ts +10 -3
- package/src/graphics/font.ts +171 -50
- package/src/graphics/glsl-matrix.ts +9 -3
- package/src/graphics/glsl.ts +81 -35
- package/src/graphics/glyph.ts +67 -26
- package/src/graphics/image.ts +119 -45
- package/src/graphics/rect.ts +56 -24
- package/src/graphics/render-states.ts +31 -14
- package/src/graphics/render-target.ts +197 -81
- package/src/graphics/render-texture.ts +36 -12
- package/src/graphics/render-window.ts +9 -3
- package/src/graphics/shader.ts +186 -61
- package/src/graphics/shape.ts +93 -35
- package/src/graphics/sprite.ts +64 -25
- package/src/graphics/stencil-mode.ts +12 -6
- package/src/graphics/swap.ts +3 -2
- package/src/graphics/text.ts +229 -74
- package/src/graphics/texture.ts +180 -61
- package/src/graphics/transform.ts +132 -47
- package/src/graphics/transformable.ts +3 -1
- package/src/graphics/vertex-array.ts +87 -35
- package/src/graphics/vertex-buffer.ts +97 -33
- package/src/graphics/vertex.ts +9 -3
- package/src/graphics/view.ts +59 -21
- package/src/index.ts +101 -23
- package/src/internal/audio-codec-registry.ts +18 -6
- package/src/internal/audio-input-stream.ts +6 -2
- package/src/internal/audio-music-pump.ts +116 -41
- package/src/internal/audio-native.ts +249 -96
- package/src/internal/audio-recorder-session.ts +68 -24
- package/src/internal/audio-worker-session.ts +65 -21
- package/src/internal/audio-worker.ts +85 -41
- package/src/internal/glsl-value.ts +26 -11
- package/src/internal/graphics-state.ts +57 -20
- package/src/internal/input-stream.ts +23 -10
- package/src/internal/native.ts +252 -99
- package/src/internal/numeric-properties.ts +2 -1
- package/src/internal/render-states.ts +3 -1
- package/src/internal/scalar.ts +33 -14
- package/src/internal/shaped-glyph.ts +25 -12
- package/src/internal/struct-view.ts +40 -13
- package/src/internal/transformable.ts +3 -1
- package/src/network/common.ts +35 -11
- package/src/network/dns.ts +95 -38
- package/src/network/ftp.ts +129 -47
- package/src/network/http.ts +232 -77
- package/src/network/ip-address.ts +118 -48
- package/src/network/packet.ts +161 -54
- package/src/network/sftp.ts +498 -168
- package/src/network/socket-selector.ts +66 -26
- package/src/network/socket.ts +133 -46
- package/src/network/tcp-listener.ts +78 -29
- package/src/network/tcp-socket.ts +240 -95
- package/src/network/tls-material.ts +6 -2
- package/src/network/udp-socket.ts +147 -53
- package/src/system/angle.ts +3 -1
- package/src/system/clock.ts +12 -4
- package/src/system/err.ts +5 -2
- package/src/system/file-input-stream.ts +12 -4
- package/src/system/input-stream.ts +9 -3
- package/src/system/operators.ts +290 -115
- package/src/system/sleep.ts +6 -2
- package/src/system/time.ts +18 -6
- package/src/system/timeout-with-predicate.ts +19 -8
- package/src/system/vector2.ts +101 -49
- package/src/system/vector3.ts +85 -36
- package/src/window/clipboard.ts +3 -1
- package/src/window/context.ts +15 -5
- package/src/window/cursor.ts +3 -1
- package/src/window/event.ts +26 -12
- package/src/window/mouse.ts +6 -2
- package/src/window/video-mode.ts +3 -1
- package/src/window/window.ts +119 -37
- package/test/native/audio-probes.cc +74 -36
- package/test/native/deferred-delete-probes.cc +17 -11
- package/test/native/drawable-probes.cc +70 -36
- package/test/native/exception-probes.cc +14 -9
- package/test/native/image-probes.cc +20 -10
- package/test/native/matrix-probes.cc +8 -4
- package/test/native/network-oracle.cc +17 -11
- package/test/native/render-texture-probes.cc +33 -24
- package/test/native/shader-probes.cc +9 -9
- package/test/native/shape-probes.cc +37 -23
- package/test/native/sprite-probes.cc +41 -25
- package/test/native/system-probes.cc +58 -35
- package/test/native/text-probes.cc +77 -44
- package/test/native/texture-probes.cc +43 -26
- package/test/native/time-probes.cc +18 -12
- package/test/native/transform-probes.cc +15 -10
- package/test/native/transformable-probes.cc +23 -17
- package/test/native/value-oracle.h +9 -4
- package/test/native/value-probes.cc +31 -23
- package/test/native/vertex-array-probes.cc +22 -14
- package/test/native/vertex-buffer-probes.cc +28 -17
- package/test/native/view-probes.cc +29 -17
- package/test/native/window-probes.cc +66 -33
- package/tools/ensure-sfml.cjs +9 -0
- package/tools/generate-network-constants.cjs +11 -6
- package/tools/generate-window-constants.cjs +31 -12
- package/docs/README.ja.md +0 -30
- package/docs/README.ko.md +0 -30
- package/docs/README.md +0 -30
- package/docs/README.zh-CN.md +0 -30
- package/docs/api.ja.md +0 -84
- package/docs/api.ko.md +0 -84
- package/docs/api.md +0 -81
- package/docs/api.zh-CN.md +0 -81
- package/docs/audio.ja.md +0 -249
- package/docs/audio.ko.md +0 -251
- package/docs/audio.md +0 -252
- package/docs/audio.zh-CN.md +0 -252
- package/docs/concepts.ja.md +0 -130
- package/docs/concepts.ko.md +0 -130
- package/docs/concepts.md +0 -131
- package/docs/concepts.zh-CN.md +0 -131
- package/docs/development.ja.md +0 -144
- package/docs/development.ko.md +0 -144
- package/docs/development.md +0 -146
- package/docs/development.zh-CN.md +0 -146
- package/docs/getting-started.ja.md +0 -154
- package/docs/getting-started.ko.md +0 -154
- package/docs/getting-started.md +0 -156
- package/docs/getting-started.zh-CN.md +0 -156
- package/docs/graphics.ja.md +0 -256
- package/docs/graphics.ko.md +0 -254
- package/docs/graphics.md +0 -255
- package/docs/graphics.zh-CN.md +0 -257
- package/docs/network.ja.md +0 -214
- package/docs/network.ko.md +0 -216
- package/docs/network.md +0 -218
- package/docs/network.zh-CN.md +0 -218
- package/docs/system.ja.md +0 -169
- package/docs/system.ko.md +0 -171
- package/docs/system.md +0 -173
- package/docs/system.zh-CN.md +0 -173
- package/docs/window.ja.md +0 -138
- package/docs/window.ko.md +0 -140
- package/docs/window.md +0 -141
- package/docs/window.zh-CN.md +0 -141
- package/native/exception-boundary.h +0 -97
- package/native/numeric-fields.h +0 -96
- package/native/shared-handle.h +0 -107
- package/test/tsconfig.json +0 -8
- package/tools/configure-lsp.cjs +0 -23
- package/tools/lib_downloader.cjs +0 -92
- package/tools/lib_downloader_urls.cjs +0 -23
package/src/graphics/sprite.ts
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import { native, type NativeGraphicsHandle } from '../internal/native';
|
|
2
2
|
import {
|
|
3
|
-
dispatchDrawable,
|
|
4
|
-
|
|
3
|
+
dispatchDrawable,
|
|
4
|
+
graphicsContext,
|
|
5
|
+
graphicsNative,
|
|
6
|
+
recordSprite,
|
|
7
|
+
spriteState,
|
|
8
|
+
textureId,
|
|
9
|
+
type SpriteData,
|
|
5
10
|
} from '../internal/graphics-state';
|
|
6
11
|
import {
|
|
7
|
-
withTransformable,
|
|
12
|
+
withTransformable,
|
|
13
|
+
transformableState,
|
|
14
|
+
type TransformableState,
|
|
8
15
|
} from '../internal/transformable';
|
|
9
16
|
import {
|
|
10
|
-
mutableValue,
|
|
17
|
+
mutableValue,
|
|
18
|
+
rectStorage,
|
|
19
|
+
type ReadonlyValue as R,
|
|
11
20
|
} from '../internal/value-storage';
|
|
12
21
|
import { LazyValue } from '../internal/lazy-value';
|
|
13
22
|
import { Vector2f } from '../system/vector2';
|
|
@@ -44,24 +53,36 @@ class SpriteResource extends Drawable {
|
|
|
44
53
|
constructor(source: ReadonlyTexture | R<Sprite>, rectangle?: R<IntRect>) {
|
|
45
54
|
super();
|
|
46
55
|
const copy = source instanceof SpriteResource ? source : undefined;
|
|
47
|
-
const texture = copy
|
|
48
|
-
|
|
56
|
+
const texture = copy
|
|
57
|
+
? copy[spriteState].texture
|
|
58
|
+
: (source as ReadonlyTexture);
|
|
59
|
+
if (!(texture instanceof Texture)) {
|
|
60
|
+
throw new TypeError('Expected a Texture');
|
|
61
|
+
}
|
|
49
62
|
if (rectangle !== undefined && !(rectangle instanceof IntRect)) {
|
|
50
63
|
throw new TypeError('Expected an IntRect');
|
|
51
64
|
}
|
|
52
65
|
if (copy && rectangle !== undefined) {
|
|
53
|
-
throw new TypeError(
|
|
66
|
+
throw new TypeError(
|
|
67
|
+
'Sprite copy construction only accepts its source',
|
|
68
|
+
);
|
|
54
69
|
}
|
|
55
|
-
const { handle, transformable, id, buffer, appearance } =
|
|
56
|
-
|
|
57
|
-
|
|
70
|
+
const { handle, transformable, id, buffer, appearance } =
|
|
71
|
+
native.createSprite(
|
|
72
|
+
graphicsContext(),
|
|
73
|
+
texture[graphicsNative],
|
|
74
|
+
texture[textureId],
|
|
75
|
+
);
|
|
58
76
|
this[graphicsNative] = handle;
|
|
59
77
|
this[spriteState] = {
|
|
60
|
-
id,
|
|
61
|
-
|
|
78
|
+
id,
|
|
79
|
+
words: new Uint32Array(appearance),
|
|
80
|
+
rectangle: new Int32Array(appearance, 4, 4),
|
|
81
|
+
texture,
|
|
62
82
|
};
|
|
63
83
|
this[transformableState] = {
|
|
64
|
-
handle: transformable,
|
|
84
|
+
handle: transformable,
|
|
85
|
+
values: new Float32Array(buffer),
|
|
65
86
|
};
|
|
66
87
|
if (copy) {
|
|
67
88
|
this[spriteState].words.set(copy[spriteState].words);
|
|
@@ -79,14 +100,22 @@ class SpriteResource extends Drawable {
|
|
|
79
100
|
* @ko 텍스처 참조를 교체합니다. resetRect가 true이면 텍스처 영역을 전체 텍스처로 초기화합니다.
|
|
80
101
|
*/
|
|
81
102
|
setTexture(
|
|
82
|
-
this: SpriteResource,
|
|
103
|
+
this: SpriteResource,
|
|
104
|
+
texture: ReadonlyTexture,
|
|
105
|
+
resetRect = false,
|
|
83
106
|
): void {
|
|
84
|
-
if (!(texture instanceof Texture))
|
|
85
|
-
|
|
107
|
+
if (!(texture instanceof Texture)) {
|
|
108
|
+
throw new TypeError('Expected a Texture');
|
|
109
|
+
}
|
|
110
|
+
if (typeof resetRect !== 'boolean') {
|
|
111
|
+
throw new TypeError('Expected a boolean');
|
|
112
|
+
}
|
|
86
113
|
const state = this[spriteState];
|
|
87
114
|
if (texture !== state.texture) {
|
|
88
115
|
native.setSpriteTexture(
|
|
89
|
-
this[graphicsNative],
|
|
116
|
+
this[graphicsNative],
|
|
117
|
+
texture[graphicsNative],
|
|
118
|
+
texture[textureId],
|
|
90
119
|
);
|
|
91
120
|
state.texture = texture;
|
|
92
121
|
}
|
|
@@ -114,7 +143,9 @@ class SpriteResource extends Drawable {
|
|
|
114
143
|
* @ko 텍스처 픽셀 영역을 복사합니다. 너비와 높이는 스프라이트 로컬 크기를 결정하며 음수 값으로 텍스처를 반전할 수 있습니다.
|
|
115
144
|
*/
|
|
116
145
|
setTextureRect(this: SpriteResource, rectangle: R<IntRect>): void {
|
|
117
|
-
if (!(rectangle instanceof IntRect))
|
|
146
|
+
if (!(rectangle instanceof IntRect)) {
|
|
147
|
+
throw new TypeError('Expected an IntRect');
|
|
148
|
+
}
|
|
118
149
|
this[spriteState].rectangle.set(rectangle[rectStorage]);
|
|
119
150
|
}
|
|
120
151
|
|
|
@@ -127,9 +158,11 @@ class SpriteResource extends Drawable {
|
|
|
127
158
|
getTextureRect(): R<IntRect> {
|
|
128
159
|
if (!this.rectangleView) {
|
|
129
160
|
const handle = this[graphicsNative];
|
|
130
|
-
this.rectangleView = intRectFromState(
|
|
131
|
-
this[spriteState].rectangle, () =>
|
|
132
|
-
|
|
161
|
+
this.rectangleView = intRectFromState(
|
|
162
|
+
new LazyValue(this[spriteState].rectangle, () =>
|
|
163
|
+
native.spriteTextureRect(handle),
|
|
164
|
+
),
|
|
165
|
+
);
|
|
133
166
|
}
|
|
134
167
|
return this.rectangleView;
|
|
135
168
|
}
|
|
@@ -142,7 +175,9 @@ class SpriteResource extends Drawable {
|
|
|
142
175
|
* @ko 텍스처와 채널별로 곱할 색상을 설정합니다. Alpha로 전체 불투명도를 제어할 수 있습니다.
|
|
143
176
|
*/
|
|
144
177
|
setColor(this: SpriteResource, color: R<Color>): void {
|
|
145
|
-
if (!(color instanceof Color))
|
|
178
|
+
if (!(color instanceof Color)) {
|
|
179
|
+
throw new TypeError('Expected a Color');
|
|
180
|
+
}
|
|
146
181
|
this[spriteState].words[5] = color.toInteger();
|
|
147
182
|
}
|
|
148
183
|
|
|
@@ -164,9 +199,13 @@ class SpriteResource extends Drawable {
|
|
|
164
199
|
*/
|
|
165
200
|
getLocalBounds(): FloatRect {
|
|
166
201
|
const rectangle = this[spriteState].rectangle;
|
|
167
|
-
return new FloatRect(
|
|
168
|
-
|
|
169
|
-
|
|
202
|
+
return new FloatRect(
|
|
203
|
+
new Vector2f(),
|
|
204
|
+
new Vector2f(
|
|
205
|
+
Math.abs(Math.fround(rectangle[2])),
|
|
206
|
+
Math.abs(Math.fround(rectangle[3])),
|
|
207
|
+
),
|
|
208
|
+
);
|
|
170
209
|
}
|
|
171
210
|
|
|
172
211
|
protected draw(target: RenderTarget, states: RenderStates): void {
|
|
@@ -140,8 +140,12 @@ export class StencilValue {
|
|
|
140
140
|
*/
|
|
141
141
|
constructor(value: number | Readonly<StencilValue>) {
|
|
142
142
|
const input = value instanceof StencilValue ? value.value : value;
|
|
143
|
-
if (
|
|
144
|
-
|
|
143
|
+
if (
|
|
144
|
+
!Number.isInteger(input) ||
|
|
145
|
+
typeof input !== 'number' ||
|
|
146
|
+
input < -0x80000000 ||
|
|
147
|
+
input > 0xffffffff
|
|
148
|
+
) {
|
|
145
149
|
throw new RangeError('Expected a 32-bit stencil value');
|
|
146
150
|
}
|
|
147
151
|
numericProperties(this, {
|
|
@@ -246,11 +250,13 @@ export class StencilMode {
|
|
|
246
250
|
constructor(source: StencilModeOptions = {}) {
|
|
247
251
|
numericProperties(this, {
|
|
248
252
|
stencilComparison: StencilComparison.Always,
|
|
249
|
-
stencilUpdateOperation: StencilUpdateOperation.Keep,
|
|
253
|
+
stencilUpdateOperation: StencilUpdateOperation.Keep,
|
|
254
|
+
stencilOnly: false,
|
|
250
255
|
});
|
|
251
|
-
this.stencilComparison =
|
|
252
|
-
|
|
253
|
-
|
|
256
|
+
this.stencilComparison =
|
|
257
|
+
source.stencilComparison ?? StencilComparison.Always;
|
|
258
|
+
this.stencilUpdateOperation =
|
|
259
|
+
source.stencilUpdateOperation ?? StencilUpdateOperation.Keep;
|
|
254
260
|
this.stencilReference = new StencilValue(source.stencilReference ?? 0);
|
|
255
261
|
this.stencilMask = new StencilValue(source.stencilMask ?? 0xffffffff);
|
|
256
262
|
this.stencilOnly = source.stencilOnly ?? false;
|
package/src/graphics/swap.ts
CHANGED
|
@@ -19,8 +19,9 @@ export function swap(left: VertexBuffer, right: VertexBuffer): void;
|
|
|
19
19
|
export function swap(
|
|
20
20
|
left: Texture | VertexBuffer, right: Texture | VertexBuffer,
|
|
21
21
|
): void {
|
|
22
|
-
if (left instanceof Texture && right instanceof Texture)
|
|
23
|
-
|
|
22
|
+
if (left instanceof Texture && right instanceof Texture) {
|
|
23
|
+
left.swap(right);
|
|
24
|
+
} else if (left instanceof VertexBuffer && right instanceof VertexBuffer) {
|
|
24
25
|
left.swap(right);
|
|
25
26
|
} else {
|
|
26
27
|
throw new TypeError('Expected two Textures or two VertexBuffers');
|