sfml.js 1.2.1 → 1.3.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.
Files changed (113) hide show
  1. package/dist/audio/effect-processor.d.ts +1 -0
  2. package/dist/audio/input-sound-file.d.ts +1 -0
  3. package/dist/audio/output-sound-file.d.ts +1 -0
  4. package/dist/audio/output-sound-file.js +1 -0
  5. package/dist/audio/sound-buffer-recorder.d.ts +2 -0
  6. package/dist/audio/sound-buffer-recorder.js +2 -0
  7. package/dist/audio/sound-buffer.d.ts +5 -1
  8. package/dist/audio/sound-file-reader.d.ts +4 -1
  9. package/dist/audio/sound-file-reader.js +0 -9
  10. package/dist/audio/sound-recorder.d.ts +4 -0
  11. package/dist/audio/sound-recorder.js +3 -0
  12. package/dist/audio/sound-source.d.ts +2 -0
  13. package/dist/audio/sound-source.js +1 -0
  14. package/dist/graphics/blend-mode.d.ts +1 -0
  15. package/dist/graphics/boolean-vector.d.ts +6 -0
  16. package/dist/graphics/boolean-vector.js +2 -0
  17. package/dist/graphics/color.d.ts +1 -0
  18. package/dist/graphics/color.js +1 -0
  19. package/dist/graphics/font.d.ts +6 -1
  20. package/dist/graphics/font.js +1 -0
  21. package/dist/graphics/glsl.d.ts +4 -0
  22. package/dist/graphics/glyph.d.ts +1 -0
  23. package/dist/graphics/glyph.js +1 -0
  24. package/dist/graphics/image.d.ts +1 -0
  25. package/dist/graphics/rect.d.ts +4 -0
  26. package/dist/graphics/rect.js +3 -0
  27. package/dist/graphics/render-target.d.ts +2 -0
  28. package/dist/graphics/render-target.js +2 -0
  29. package/dist/graphics/render-texture.d.ts +1 -0
  30. package/dist/graphics/render-window.d.ts +1 -0
  31. package/dist/graphics/shader.d.ts +11 -5
  32. package/dist/graphics/shader.js +1 -0
  33. package/dist/graphics/shape.d.ts +12 -7
  34. package/dist/graphics/shape.js +0 -6
  35. package/dist/graphics/sprite.d.ts +5 -3
  36. package/dist/graphics/text.d.ts +32 -13
  37. package/dist/graphics/text.js +4 -0
  38. package/dist/graphics/texture.d.ts +7 -1
  39. package/dist/graphics/transform.d.ts +3 -0
  40. package/dist/graphics/transform.js +1 -0
  41. package/dist/graphics/vertex-buffer.d.ts +2 -0
  42. package/dist/graphics/vertex.d.ts +1 -0
  43. package/dist/graphics/vertex.js +1 -0
  44. package/dist/index.d.ts +4 -0
  45. package/dist/index.js +6 -3
  46. package/dist/internal/glsl-value.d.ts +3 -0
  47. package/dist/internal/glsl-value.js +3 -0
  48. package/dist/internal/scalar.d.ts +12 -6
  49. package/dist/internal/transformable.d.ts +4 -0
  50. package/dist/internal/value-storage.d.ts +85 -1
  51. package/dist/internal/value-storage.js +4 -0
  52. package/dist/network/common.d.ts +1 -0
  53. package/dist/network/http.d.ts +1 -0
  54. package/dist/network/http.js +1 -0
  55. package/dist/network/sftp.d.ts +3 -2
  56. package/dist/system/angle.d.ts +1 -0
  57. package/dist/system/angle.js +1 -0
  58. package/dist/system/operators.d.ts +8 -0
  59. package/dist/system/vector2.d.ts +6 -3
  60. package/dist/system/vector2.js +2 -0
  61. package/dist/system/vector3.d.ts +5 -3
  62. package/dist/system/vector3.js +2 -0
  63. package/dist/window/context.d.ts +1 -0
  64. package/dist/window/cursor.d.ts +1 -0
  65. package/dist/window/event.d.ts +1 -0
  66. package/dist/window/event.js +3 -1
  67. package/dist/window/window.d.ts +1 -0
  68. package/native/vertex-buffer-binding.cc +4 -4
  69. package/native/window-binding.cc +8 -2
  70. package/package.json +2 -2
  71. package/src/audio/effect-processor.ts +1 -0
  72. package/src/audio/input-sound-file.ts +1 -0
  73. package/src/audio/output-sound-file.ts +1 -0
  74. package/src/audio/sound-buffer-recorder.ts +2 -0
  75. package/src/audio/sound-buffer.ts +5 -2
  76. package/src/audio/sound-file-reader.ts +8 -0
  77. package/src/audio/sound-recorder.ts +4 -0
  78. package/src/audio/sound-source.ts +2 -0
  79. package/src/graphics/blend-mode.ts +1 -0
  80. package/src/graphics/boolean-vector.ts +6 -0
  81. package/src/graphics/color.ts +1 -0
  82. package/src/graphics/font.ts +6 -3
  83. package/src/graphics/glsl.ts +4 -0
  84. package/src/graphics/glyph.ts +1 -0
  85. package/src/graphics/image.ts +1 -0
  86. package/src/graphics/rect.ts +4 -0
  87. package/src/graphics/render-target.ts +2 -0
  88. package/src/graphics/render-texture.ts +1 -0
  89. package/src/graphics/render-window.ts +1 -0
  90. package/src/graphics/shader.ts +22 -6
  91. package/src/graphics/shape.ts +13 -6
  92. package/src/graphics/sprite.ts +5 -3
  93. package/src/graphics/text.ts +37 -13
  94. package/src/graphics/texture.ts +8 -3
  95. package/src/graphics/transform.ts +3 -0
  96. package/src/graphics/vertex-buffer.ts +2 -0
  97. package/src/graphics/vertex.ts +1 -0
  98. package/src/index.ts +4 -0
  99. package/src/internal/glsl-value.ts +3 -0
  100. package/src/internal/scalar.ts +14 -4
  101. package/src/internal/transformable.ts +4 -0
  102. package/src/internal/value-storage.ts +93 -3
  103. package/src/network/common.ts +1 -0
  104. package/src/network/http.ts +1 -0
  105. package/src/network/sftp.ts +2 -2
  106. package/src/system/angle.ts +1 -0
  107. package/src/system/operators.ts +8 -0
  108. package/src/system/vector2.ts +8 -1
  109. package/src/system/vector3.ts +9 -1
  110. package/src/window/context.ts +1 -0
  111. package/src/window/cursor.ts +1 -0
  112. package/src/window/event.ts +4 -1
  113. package/src/window/window.ts +1 -0
@@ -55,6 +55,7 @@ type VectorEquality = Intersect<{
55
55
  (left: R<Vector3<T>>, right: R<Vector3<T>>): boolean;
56
56
  };
57
57
  }[ScalarType]>;
58
+ /** Same-type addition signatures, returning independent values. @inline */
58
59
  interface Addition extends VectorAddition {
59
60
  (left: R<Bvec2>, right: R<Bvec2>): Bvec2;
60
61
  (left: R<Bvec3>, right: R<Bvec3>): Bvec3;
@@ -62,6 +63,7 @@ interface Addition extends VectorAddition {
62
63
  (left: R<Color>, right: R<Color>): Color;
63
64
  (left: R<Angle>, right: R<Angle>): Angle;
64
65
  }
66
+ /** Same-type addition signatures that mutate the left operand. @inline */
65
67
  interface AdditionAssign extends VectorAdditionAssign {
66
68
  (left: Bvec2, right: R<Bvec2>): Bvec2;
67
69
  (left: Bvec3, right: R<Bvec3>): Bvec3;
@@ -69,30 +71,35 @@ interface AdditionAssign extends VectorAdditionAssign {
69
71
  (left: Color, right: R<Color>): Color;
70
72
  (left: Angle, right: R<Angle>): Angle;
71
73
  }
74
+ /** Unary negation signatures, returning independent values. @inline */
72
75
  interface Negation extends VectorNegation {
73
76
  (value: R<Bvec2>): Bvec2;
74
77
  (value: R<Bvec3>): Bvec3;
75
78
  (value: R<Time>): Time;
76
79
  (value: R<Angle>): Angle;
77
80
  }
81
+ /** Right-scalar multiplication and division signatures. @inline */
78
82
  interface Scale extends VectorScale {
79
83
  (left: R<Bvec2>, right: boolean): Bvec2;
80
84
  (left: R<Bvec3>, right: boolean): Bvec3;
81
85
  (left: R<Time>, right: number | bigint): Time;
82
86
  (left: R<Angle>, right: number): Angle;
83
87
  }
88
+ /** Right-scalar signatures that mutate the left operand. @inline */
84
89
  interface ScaleAssign extends VectorScaleAssign {
85
90
  (left: Bvec2, right: boolean): Bvec2;
86
91
  (left: Bvec3, right: boolean): Bvec3;
87
92
  (left: Time, right: number | bigint): Time;
88
93
  (left: Angle, right: number): Angle;
89
94
  }
95
+ /** Left-scalar multiplication signatures. @inline */
90
96
  interface LeftScale extends VectorLeftScale {
91
97
  (left: boolean, right: R<Bvec2>): Bvec2;
92
98
  (left: boolean, right: R<Bvec3>): Bvec3;
93
99
  (left: number | bigint, right: R<Time>): Time;
94
100
  (left: number, right: R<Angle>): Angle;
95
101
  }
102
+ /** Exact same-type equality and inequality signatures. @inline */
96
103
  interface Equality extends VectorEquality {
97
104
  (left: IpAddress, right: IpAddress): boolean;
98
105
  (left: Readonly<VideoMode>, right: Readonly<VideoMode>): boolean;
@@ -247,6 +254,7 @@ export declare const equal: Equality;
247
254
  * @ko 같은 타입의 피연산자가 값으로 같지 않은지 반환한다.
248
255
  */
249
256
  export declare const notEqual: Equality;
257
+ /** Ordering signatures for address, mode, duration and angle. @inline */
250
258
  interface Ordering {
251
259
  (left: IpAddress, right: IpAddress): boolean;
252
260
  (left: Readonly<VideoMode>, right: Readonly<VideoMode>): boolean;
@@ -3,10 +3,11 @@ import { LazyValue } from '../internal/lazy-value';
3
3
  import { Angle } from './angle';
4
4
  import type { Bvec2 } from '../graphics/boolean-vector';
5
5
  import { vector2Storage, vector2Native, type ReadonlyValue, mutableValue } from '../internal/value-storage';
6
- import { type ScalarType, type Scalar, type ScalarArray, type NumberScalar, type FloatScalar } from '../internal/scalar';
6
+ import { type ScalarType, type Scalar, type ScalarArray, type FloatScalar } from '../internal/scalar';
7
7
  export type { ScalarType } from '../internal/scalar';
8
+ /** Two-dimensional numeric or boolean source for conversion. @inline */
8
9
  type Vector2Source = ReadonlyValue<Vector2<ScalarType>> | ReadonlyValue<Bvec2>;
9
- type Vector2Arguments<T extends ScalarType = NumberScalar> = [] | [x: Scalar<T>, y: Scalar<T>] | [source: Vector2Source];
10
+ /** Radius and direction for floating-point polar construction. @inline */
10
11
  type PolarArguments = [r: number, phi: ReadonlyValue<Angle>];
11
12
  type Vector2State = LazyValue<'vector2', ScalarArray>;
12
13
  /**
@@ -40,7 +41,7 @@ export declare class Vector2<T extends ScalarType> {
40
41
  * @ko args - x, y 성분 또는 원본 벡터. 부동소수점 타입은 반지름과 Angle로
41
42
  * 표현한 극좌표도 지원한다.
42
43
  */
43
- constructor(scalarType: T, ...args: Vector2Arguments<T> | (T extends FloatScalar ? PolarArguments : never));
44
+ constructor(scalarType: T, ...args: [] | [x: Scalar<T>, y: Scalar<T>] | [source: Vector2Source] | (T extends FloatScalar ? PolarArguments : never));
44
45
  /**
45
46
  * Copy the vector and its scalar type with independent storage.
46
47
  * @zh 复制向量及其标量类型,副本拥有独立存储。
@@ -55,7 +56,9 @@ export declare class Vector2<T extends ScalarType> {
55
56
  * @ko 성분에 사용되는 스칼라 저장 타입.
56
57
  */
57
58
  get scalarType(): T;
59
+ /** Shared component storage for native operations. @internal */
58
60
  get [vector2Storage](): ScalarArray<T>;
61
+ /** Native view bound to the shared component storage. @internal */
59
62
  get [vector2Native](): NativeValueHandle<'vector2'>;
60
63
  /**
61
64
  * The X component; writes follow the TypedArray conversion rules for
@@ -58,9 +58,11 @@ class Vector2 {
58
58
  get scalarType() {
59
59
  return this.type;
60
60
  }
61
+ /** Shared component storage for native operations. @internal */
61
62
  get [(_a = value_storage_1.mutableValue, value_storage_1.vector2Storage)]() {
62
63
  return this.state.values;
63
64
  }
65
+ /** Native view bound to the shared component storage. @internal */
64
66
  get [value_storage_1.vector2Native]() {
65
67
  return (0, lazy_value_1.nativeValue)(this, value_storage_1.vector2Native, this.state);
66
68
  }
@@ -1,9 +1,9 @@
1
1
  import { type NativeValueHandle } from '../internal/native';
2
2
  import type { Bvec3 } from '../graphics/boolean-vector';
3
3
  import { vector3Storage, vector3Native, mutableValue, type ReadonlyValue } from '../internal/value-storage';
4
- import { type ScalarType, type Scalar, type ScalarArray, type NumberScalar, type FloatScalar } from '../internal/scalar';
4
+ import { type ScalarType, type Scalar, type ScalarArray, type FloatScalar } from '../internal/scalar';
5
+ /** Three-dimensional numeric or boolean source for conversion. @inline */
5
6
  type Vector3Source = ReadonlyValue<Vector3<ScalarType>> | ReadonlyValue<Bvec3>;
6
- type Vector3Arguments<T extends ScalarType = NumberScalar> = [] | [x: Scalar<T>, y: Scalar<T>, z: Scalar<T>] | [source: Vector3Source];
7
7
  /**
8
8
  * sf::Vector3<T>, stored as three consecutive values of its scalar type.
9
9
  * @zh sf::Vector3<T>,以其标量类型的三个连续值存储。
@@ -32,7 +32,7 @@ export declare class Vector3<T extends ScalarType> {
32
32
  * @ko args - x, y, z 성분 또는 변환하여 복사할 원본 벡터.
33
33
  * 생략하면 영벡터를 생성한다.
34
34
  */
35
- constructor(scalarType: T, ...args: Vector3Arguments<T>);
35
+ constructor(scalarType: T, ...args: [] | [x: Scalar<T>, y: Scalar<T>, z: Scalar<T>] | [source: Vector3Source]);
36
36
  /**
37
37
  * Copy the vector and its scalar type with independent storage.
38
38
  * @zh 复制向量及其标量类型,副本拥有独立存储。
@@ -47,7 +47,9 @@ export declare class Vector3<T extends ScalarType> {
47
47
  * @ko 성분에 사용되는 스칼라 저장 타입.
48
48
  */
49
49
  get scalarType(): T;
50
+ /** Shared component storage for native operations. @internal */
50
51
  get [vector3Storage](): ScalarArray<T>;
52
+ /** Native view bound to the shared component storage. @internal */
51
53
  get [vector3Native](): NativeValueHandle<'vector3'>;
52
54
  /**
53
55
  * The X component; writes follow the TypedArray conversion rules for
@@ -49,9 +49,11 @@ class Vector3 {
49
49
  get scalarType() {
50
50
  return this.type;
51
51
  }
52
+ /** Shared component storage for native operations. @internal */
52
53
  get [(_a = value_storage_1.mutableValue, value_storage_1.vector3Storage)]() {
53
54
  return this.state.values;
54
55
  }
56
+ /** Native view bound to the shared component storage. @internal */
55
57
  get [value_storage_1.vector3Native]() {
56
58
  return (0, lazy_value_1.nativeValue)(this, value_storage_1.vector3Native, this.state);
57
59
  }
@@ -17,6 +17,7 @@ export type ReadonlyContext = Readonly<Pick<Context, 'getSettings'>>;
17
17
  * @ko 네이티브 측이 소유한 OpenGL 컨텍스트. 활성화는 네이티브 스레드별로 유지된다.
18
18
  */
19
19
  export declare class Context {
20
+ /** Native OpenGL context capability. @internal */
20
21
  readonly [graphicsNative]: NativeContextMapping['handle'];
21
22
  private readonly settings;
22
23
  /**
@@ -17,6 +17,7 @@ export declare class Cursor {
17
17
  * @ko 시스템 커서 모양 열거형.
18
18
  */
19
19
  static readonly Type: typeof CursorType;
20
+ /** Native cursor capability. @internal */
20
21
  readonly [graphicsNative]: NativeGraphicsHandle<'cursor'>;
21
22
  /**
22
23
  * Create a system cursor; throw SFMLError if unsupported by the platform.
@@ -1,6 +1,7 @@
1
1
  import { Vector2, Vector2i, Vector2u } from '../system/vector2';
2
2
  import { Vector3f } from '../system/vector3';
3
3
  import type { KeyboardKey, KeyboardScancode, MouseButton, MouseWheel, JoystickAxis, SensorType } from './gen/constants';
4
+ /** Key code, scan code and modifier snapshot for a keyboard event. @inline */
4
5
  interface KeyEvent {
5
6
  /**
6
7
  * A logical key code affected by the keyboard layout.
@@ -70,7 +70,9 @@ class Event {
70
70
  }
71
71
  exports.Event = Event;
72
72
  function windowEvent(raw) {
73
- const data = { ...raw };
73
+ // Preserve the native snapshot's private provenance owner while replacing
74
+ // serialized vector fields. Public Event construction still copies data.
75
+ const data = raw;
74
76
  if (data.kind === 'Resized') {
75
77
  data.size = new vector2_1.Vector2u(...raw.size);
76
78
  }
@@ -62,6 +62,7 @@ export declare function registerMixedWindow(window: Window): void;
62
62
  * @ko OpenGL 컨텍스트가 있는 OS 윈도우. Texture.update()에서 사용할 수 있다.
63
63
  */
64
64
  export declare class Window {
65
+ /** Native window capability. @internal */
65
66
  readonly [graphicsNative]: NativeGraphicsHandle<'window'>;
66
67
  static [Symbol.hasInstance](value: unknown): boolean;
67
68
  /**
@@ -22,17 +22,17 @@ using State = sfmljs::VertexBufferState;
22
22
  using Handle = sfmljs::SharedHandle<State>;
23
23
  using ContextHandle = sfmljs::SharedHandle<sfmljs::GraphicsContext>;
24
24
 
25
- // Work performed in SFML's transient context must be submitted before that
26
- // context is released, so a subsequently activated render target sees uploads.
25
+ // Uploads must be submitted even in an explicit context: the next recorded
26
+ // draw may activate another shared context. Match SFML texture uploads without
27
+ // waiting for GPU completion.
27
28
  struct GlAccess : sf::GlResource {
28
29
  using Lock = TransientContextLock;
29
30
  };
30
31
 
31
32
  struct UploadContext {
32
- const bool transient = sf::Context::getActiveContextId() == 0;
33
33
  const GlAccess::Lock lock;
34
34
  ~UploadContext() {
35
- if (transient) glFlush();
35
+ glFlush();
36
36
  }
37
37
  };
38
38
 
@@ -1,3 +1,5 @@
1
+ #include <window-event-source.h>
2
+
1
3
  #include <limits>
2
4
  #include <string>
3
5
  #include <type_traits>
@@ -263,7 +265,9 @@ NAN_METHOD(PollWindowEvent) {
263
265
  auto* window = WindowHandle::From(info[0]);
264
266
  if (!window) return;
265
267
  if (auto event = window->owner()->pollEvent()) {
266
- info.GetReturnValue().Set(sfmljs::WindowEvent(*event));
268
+ auto result = sfmljs::WindowEvent(*event);
269
+ sfmljs::interop::AttachWindowEventSource(result, *event);
270
+ info.GetReturnValue().Set(result);
267
271
  }
268
272
  }
269
273
 
@@ -273,7 +277,9 @@ NAN_METHOD(WaitWindowEvent) {
273
277
  sf::Time timeout;
274
278
  if (!sfmljs::ReadTime(info[1], timeout)) return;
275
279
  if (auto event = window->owner()->waitEvent(timeout)) {
276
- info.GetReturnValue().Set(sfmljs::WindowEvent(*event));
280
+ auto result = sfmljs::WindowEvent(*event);
281
+ sfmljs::interop::AttachWindowEventSource(result, *event);
282
+ info.GetReturnValue().Set(result);
277
283
  }
278
284
  }
279
285
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sfml.js",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "description": "SFML's Node.js binding.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -48,7 +48,7 @@
48
48
  "nan": "2.29.0",
49
49
  "node-gyp": "11.5.0",
50
50
  "ssh2": "1.17.0",
51
- "sfml.js-interop": "^1.2.1"
51
+ "sfml.js-interop": "^1.3.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/node": "20.19.0",
@@ -31,6 +31,7 @@ export interface EffectProcessorOptions extends AudioWorkerOptions {
31
31
  * 언더플로 시 무음을 출력합니다.
32
32
  */
33
33
  export class EffectProcessor {
34
+ /** Native worker capability. @internal */
34
35
  readonly [audioHandle]: AudioHandle<'worker'>;
35
36
  /**
36
37
  * Initialization result of the Worker effect factory.
@@ -25,6 +25,7 @@ export const cancelAudioInput: unique symbol = Symbol('Audio.cancelInput');
25
25
  * @ko 호출 순서대로 16비트 인터리브 PCM을 비동기로 읽는 탐색 가능한 오디오 디코더입니다.
26
26
  */
27
27
  export class InputSoundFile {
28
+ /** Native input decoder capability. @internal */
28
29
  readonly [audioHandle]: AudioHandle<'input'>;
29
30
  private readonly queue = new AudioQueue();
30
31
  private u64: BigUint64Array;
@@ -18,6 +18,7 @@ import type { SoundFileWriter } from './sound-file-writer';
18
18
  * 형식은 파일 확장자로 결정됩니다.
19
19
  */
20
20
  export class OutputSoundFile {
21
+ /** Native output encoder capability. @internal */
21
22
  readonly [audioHandle] = audioNative.createAudioOutput();
22
23
  private readonly queue = new AudioQueue();
23
24
  private writer?: SoundFileWriter;
@@ -118,6 +118,7 @@ export class SoundBufferRecorder extends SoundRecorder {
118
118
  * @ko 콜백을 재정의한 하위 클래스만 큐를 활성화하며,
119
119
  * 일반 인스턴스는 Native 고속 경로를 유지합니다.
120
120
  */
121
+ /** Selects the native-buffer recording path. @internal */
121
122
  protected recorderCallbacks(): AudioRecorderCallbacks | undefined {
122
123
  if (
123
124
  this.onStart === SoundBufferRecorder.prototype.onStart &&
@@ -157,6 +158,7 @@ export class SoundBufferRecorder extends SoundRecorder {
157
158
  * @ko 독립적인 Native 버퍼를 받습니다.
158
159
  * 이후 녹음은 이미 반환한 SoundBuffer를 수정하지 않습니다.
159
160
  */
161
+ /** Adopts the native recording result. @internal */
160
162
  protected onBuffer(buffer: AudioHandle<'bufferData'>): void {
161
163
  this.buffer = SoundBuffer[adoptAudioBuffer](buffer);
162
164
  }
@@ -50,7 +50,6 @@ function view(mapping: AudioBufferMapping) {
50
50
  export type ReadonlySoundBuffer = Readonly<
51
51
  Pick<
52
52
  SoundBuffer,
53
- | typeof audioHandle
54
53
  | 'getSamples'
55
54
  | 'getSampleCount'
56
55
  | 'getSampleRate'
@@ -59,7 +58,10 @@ SoundBuffer,
59
58
  | 'getDuration'
60
59
  | 'saveToFile'
61
60
  >
62
- >;
61
+ > & SoundBufferIdentity;
62
+
63
+ /** Native buffer identity retained by const references. @inline */
64
+ type SoundBufferIdentity = Pick<SoundBuffer, typeof audioHandle>;
63
65
 
64
66
  export const adoptAudioBuffer: unique symbol = Symbol('Audio.adoptBuffer');
65
67
 
@@ -70,6 +72,7 @@ export const adoptAudioBuffer: unique symbol = Symbol('Audio.adoptBuffer');
70
72
  * @ko 뷰는 자신을 얻은 원래 네이티브 메모리 할당을 그대로 유지합니다.
71
73
  */
72
74
  export class SoundBuffer {
75
+ /** Native audio buffer capability. @internal */
73
76
  readonly [audioHandle]: AudioHandle<'buffer'>;
74
77
  private state: ReturnType<typeof view>;
75
78
  private readonly queue = new AudioQueue();
@@ -55,6 +55,7 @@ export interface SoundFileReaderInfoInput {
55
55
  * @ko 스칼라 필드가 직접 매핑된 sf::SoundFileReader::Info입니다.
56
56
  */
57
57
  export class SoundFileReaderInfo {
58
+ /** Native reader information capability. @internal */
58
59
  readonly [audioHandle]: AudioHandle<'readerInfo'>;
59
60
  private readonly count: BigUint64Array;
60
61
  private readonly channels: Uint32Array;
@@ -69,6 +70,13 @@ export class SoundFileReaderInfo {
69
70
  * @ko 빈 형식 정보를 생성하거나 value를 복사합니다.
70
71
  * mapping은 네이티브 디코더의 내부 매핑용입니다.
71
72
  */
73
+ constructor(value?: SoundFileReaderInfoInput);
74
+
75
+ /** Maps a native decoder result without copying its storage. @internal */
76
+ constructor(
77
+ value: SoundFileReaderInfoInput | undefined,
78
+ mapping: AudioReaderInfoMapping,
79
+ );
72
80
  constructor(
73
81
  value?: SoundFileReaderInfoInput,
74
82
  mapping: AudioReaderInfoMapping = audioNative.createAudioReaderInfo(),
@@ -35,7 +35,9 @@ const cleanup = new FinalizationRegistry<AudioRecorderSession>(session => {
35
35
  * @ko 장치 오디오를 캡처하고 Node Worker에서 16비트 인터리브 PCM을 처리합니다.
36
36
  */
37
37
  export class SoundRecorder {
38
+ /** Native recorder capability. @internal */
38
39
  readonly [audioHandle]: AudioHandle<'recorder'>;
40
+ /** Serializes asynchronous recorder operations. @internal */
39
41
  protected readonly queue = new AudioQueue();
40
42
  private readonly values: Uint32Array;
41
43
  private readonly options?: AudioWorkerOptions;
@@ -360,6 +362,7 @@ export class SoundRecorder {
360
362
  * @ko 필요에 따라 소속 JS 스레드의 녹음 콜백을 활성화합니다.
361
363
  * 일반 Worker 녹음기는 이 파이프라인을 사용하지 않습니다.
362
364
  */
365
+ /** Retrieves the internal recording-session callbacks. @internal */
363
366
  protected recorderCallbacks(): AudioRecorderCallbacks | undefined {
364
367
  return undefined;
365
368
  }
@@ -369,6 +372,7 @@ export class SoundRecorder {
369
372
  * @ja 完成した Native 録音バッファーを受け取ります。
370
373
  * @ko 완성된 Native 녹음 버퍼를 받습니다.
371
374
  */
375
+ /** Adopts the completed native recording buffer. @internal */
372
376
  protected onBuffer(buffer: AudioHandle<'bufferData'>): void {
373
377
  void buffer;
374
378
  }
@@ -41,11 +41,13 @@ export abstract class SoundSource {
41
41
  * @ko 지향성 원뿔 설정 타입입니다.
42
42
  */
43
43
  static readonly Cone = Cone;
44
+ /** Native audio source capability. @internal */
44
45
  readonly [audioHandle]: AudioHandle<'source'>;
45
46
  protected readonly values: Float32Array;
46
47
  protected readonly times: BigInt64Array;
47
48
  private effect?: EffectProcessor;
48
49
 
50
+ /** Initializes a native-created source mapping. @internal */
49
51
  protected constructor(mapping: AudioSourceMapping) {
50
52
  this[audioHandle] = mapping.handle;
51
53
  this.values = new Float32Array(mapping.values);
@@ -123,6 +123,7 @@ export enum BlendEquation {
123
123
  Max,
124
124
  }
125
125
 
126
+ /** Default, copy, shared-factor and separate-factor construction. @inline */
126
127
  type Arguments = [] | [source: Readonly<BlendMode>] |
127
128
  [source: BlendFactor, destination: BlendFactor, equation?: BlendEquation] |
128
129
  [
@@ -14,6 +14,7 @@ import type { ScalarType } from '../internal/scalar';
14
14
  export abstract class BooleanVector<
15
15
  K extends 'vector2' | 'vector3',
16
16
  > extends BooleanComponents<K> {
17
+ /** Checks dimensions before native boolean arithmetic. @internal */
17
18
  protected checkPair(rhs: R<BooleanVector<K>>): void {
18
19
  if (
19
20
  !(rhs instanceof BooleanVector) ||
@@ -53,6 +54,7 @@ export abstract class BooleanVector<
53
54
  return this.dot(this);
54
55
  }
55
56
 
57
+ /** Rejects a zero component before division. @internal */
56
58
  protected checkDivisor(rhs: R<BooleanVector<K>>): void {
57
59
  this.checkPair(rhs);
58
60
  if (rhs[glslStorage].includes(0)) {
@@ -61,7 +63,9 @@ export abstract class BooleanVector<
61
63
  }
62
64
  }
63
65
 
66
+ /** Two-dimensional source converted component by component. @inline */
64
67
  type Source2 = R<Bvec2> | R<Vector2<ScalarType>>;
68
+ /** Default, component and copy construction. @inline */
65
69
  type Arguments2 = [] | [x: boolean, y: boolean] | [source: Source2];
66
70
 
67
71
  /**
@@ -150,7 +154,9 @@ export class Bvec2 extends BooleanVector<'vector2'> {
150
154
  }
151
155
  }
152
156
 
157
+ /** Three-dimensional source converted component by component. @inline */
153
158
  type Source3 = R<Bvec3> | R<Vector3<ScalarType>>;
159
+ /** Default, component and copy construction. @inline */
154
160
  type Arguments3 =
155
161
  | []
156
162
  | [x: boolean, y: boolean, z: boolean]
@@ -122,6 +122,7 @@ export class Color {
122
122
  return this.state.values;
123
123
  }
124
124
 
125
+ /** Native view of the shared RGBA bytes. @internal */
125
126
  get [colorNative](): NativeValueHandle<'color'> {
126
127
  return nativeValue(this, colorNative, this.state);
127
128
  }
@@ -63,8 +63,6 @@ export const fontRevision: unique symbol = Symbol('Font.revision');
63
63
  export type ReadonlyFont = Readonly<
64
64
  Pick<
65
65
  Font,
66
- | typeof graphicsNative
67
- | typeof fontRevision
68
66
  | 'getInfo'
69
67
  | 'getGlyph'
70
68
  | 'getGlyphById'
@@ -78,7 +76,10 @@ Font,
78
76
  | 'getTexture'
79
77
  | 'isSmooth'
80
78
  >
81
- >;
79
+ > & FontIdentity;
80
+
81
+ /** Native identity retained by const font references. @inline */
82
+ type FontIdentity = Pick<Font, typeof graphicsNative | typeof fontRevision>;
82
83
 
83
84
  export function fontUnsigned(value: number, maximum = 0xffffffff): number {
84
85
  if (!Number.isInteger(value) || value < 0 || value > maximum) {
@@ -125,7 +126,9 @@ function fontViews(mapping: NativeFontMapping) {
125
126
  * @ko 네이티브가 소유하는 글꼴 페이스와 입력 저장 공간 및 유지되는 글리프 아틀라스입니다.
126
127
  */
127
128
  export class Font {
129
+ /** Native resource identity. @internal */
128
130
  readonly [graphicsNative]: NativeGraphicsHandle<'font'>;
131
+ /** Invalidates cached glyph geometry after font replacement. @internal */
129
132
  [fontRevision] = 0;
130
133
  private state: ReturnType<typeof fontViews>;
131
134
  private readonly textures = new Map<number, ReadonlyTexture>();
@@ -9,10 +9,13 @@ import { Color } from './color';
9
9
 
10
10
  export { Vector2f as Vec2, Vector2i as Ivec2 } from '../system/vector2';
11
11
  export { Vector3f as Vec3, Vector3i as Ivec3 } from '../system/vector3';
12
+ export type { BooleanVector } from './boolean-vector';
12
13
  export { Bvec2, Bvec3 } from './boolean-vector';
13
14
  export { Mat3, Mat4 } from './glsl-matrix';
14
15
 
16
+ /** Four-dimensional source for component conversion. @inline */
15
17
  type Source4 = R<Vec4> | R<Ivec4> | R<Bvec4>;
18
+ /** Default, numeric component, color and vector construction. @inline */
16
19
  type NumericArguments =
17
20
  | []
18
21
  | [x: number, y: number, z: number, w: number]
@@ -194,6 +197,7 @@ export class Ivec4 extends Vector4<'i32'> {
194
197
  }
195
198
  }
196
199
 
200
+ /** Default, boolean component and vector construction. @inline */
197
201
  type BooleanArguments =
198
202
  | []
199
203
  | [x: boolean, y: boolean, z: boolean, w: boolean]
@@ -95,6 +95,7 @@ export class Glyph {
95
95
  get [glyphStorage](): Uint8Array {
96
96
  return this.state.values;
97
97
  }
98
+ /** Native view of the shared glyph metadata. @internal */
98
99
  get [glyphNative](): NativeValueHandle<'glyph'> {
99
100
  return nativeValue(this, glyphNative, this.state);
100
101
  }
@@ -78,6 +78,7 @@ export let imageFromMapping: (mapping: NativeImageResource) => Image;
78
78
  * @ko 비동기 파일 및 코덱 연산을 지원하는 네이티브 소유 RGBA8 픽셀입니다.
79
79
  */
80
80
  export class Image {
81
+ /** Native image capability. @internal */
81
82
  readonly [graphicsNative]: NativeGraphicsHandle<'image'>;
82
83
  /**
83
84
  * Native image metadata and RGBA pixel view.
@@ -19,6 +19,7 @@ import {
19
19
  vector2FromState,
20
20
  } from '../system/vector2';
21
21
 
22
+ /** Integer or floating-point rectangle coordinates. @inline */
22
23
  type RectScalar = 'i32' | 'f32';
23
24
  type RectArguments<T extends RectScalar> =
24
25
  | []
@@ -66,6 +67,7 @@ export class Rect<T extends RectScalar> {
66
67
  */
67
68
  private sizeView?: Vector2<T>;
68
69
 
70
+ /** Initializes the native rectangle representation. @internal */
69
71
  protected constructor(type: T, ...args: RectArguments<T>) {
70
72
  this.type = type;
71
73
  this.state = new LazyValue(new scalarArrays[type](4), buffer =>
@@ -101,6 +103,7 @@ export class Rect<T extends RectScalar> {
101
103
  return this.state.values;
102
104
  }
103
105
 
106
+ /** Native view of the shared rectangle coordinates. @internal */
104
107
  get [rectNative](): NativeValueHandle<'rect'> {
105
108
  return nativeValue(this, rectNative, this.state);
106
109
  }
@@ -239,6 +242,7 @@ export class Rect<T extends RectScalar> {
239
242
  ) as Vector2<T>;
240
243
  }
241
244
 
245
+ /** Allocates an independent rectangle of the same scalar type. @internal */
242
246
  protected createResult(): Rect<T> {
243
247
  return new Rect(this.type);
244
248
  }
@@ -468,6 +468,7 @@ export abstract class RenderTarget {
468
468
  return this.pendingShapes;
469
469
  }
470
470
 
471
+ /** Records native shape appearance at draw time. @internal */
471
472
  [recordShape](shape: ShapeCommandSource, states: RenderStates): void {
472
473
  validateRenderStates(states);
473
474
  const appearance = shape[shapeState];
@@ -488,6 +489,7 @@ export abstract class RenderTarget {
488
489
  }
489
490
  }
490
491
 
492
+ /** Records native sprite appearance at draw time. @internal */
491
493
  [recordSprite](sprite: SpriteCommandSource, states: RenderStates): void {
492
494
  // Validation precedes reservation so a rejected call leaves no command.
493
495
  validateRenderStates(states);
@@ -40,6 +40,7 @@ function flag(value: boolean): void {
40
40
  * @ko sf::RenderTexture: clear/draw를 기록하고 display 호출 시 제출합니다.
41
41
  */
42
42
  export class RenderTexture extends RenderTarget {
43
+ /** Native offscreen render-target capability. @internal */
43
44
  readonly [graphicsNative]: NativeGraphicsHandle<'renderTexture'>;
44
45
  private readonly state: Readonly<NativeTextureInfo>;
45
46
  private readonly targetInfo: Readonly<{ sRgb: boolean }>;
@@ -30,6 +30,7 @@ export interface RenderWindow extends Window {}
30
30
  */
31
31
  // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
32
32
  export class RenderWindow extends RenderTarget {
33
+ /** Native window render-target capability. @internal */
33
34
  readonly [graphicsNative]: NativeGraphicsHandle<'window'>;
34
35
  /**
35
36
  * Native render window target handle, distinct from the Window handle.