@zephyr3d/device 0.1.0 → 0.1.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/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # @zephyr3d
2
+
3
+ Zephyr3d is a set of API for 3D rendering within the browser.
4
+
5
+ Zephyr3d is released as ES6 modules and requires npm for installation. It is designed to be used in conjunction with front-end build tools such as Webpack or Vite for development.
6
+
7
+ ## Installation
8
+
9
+ - @zephyr3d/base
10
+
11
+ The basic module includes a math library and content commonly used in other modules.
12
+
13
+ ```npm install --save @zephyr3d/base```
14
+
15
+ - @zephyr3d/device
16
+
17
+ Includes the basic definitions and abstract interfaces of the rendering API.
18
+
19
+ ```npm install --save @zephyr3d/device```
20
+
21
+ - @zephyr3d/backend-webgl
22
+
23
+ WebGL backend, WebGL/WebGL2 rendering.
24
+
25
+ ```npm install --save @zephyr3d/backend-webgl```
26
+
27
+ - @zephyr3d/backend-webgpu
28
+
29
+ WebGPU backend.
30
+
31
+ ```npm install --save @zephyr3d/backend-webgpu```
32
+
33
+ - @zephyr3d/scene
34
+
35
+ The SceneAPI module, built on top of the DeviceAPI module, facilitates rapid development of rendering projects.
36
+
37
+ ```npm install --save @zephyr3d/scene```
38
+
39
+ - @zephyr3d/imgui
40
+
41
+ To render a GUI, you can install the ImGui binding module.
42
+
43
+ ```npm install --save @zephyr3d/imgui```
44
+
45
+
46
+
@@ -21,28 +21,28 @@ const COMPRESSED_FORMAT_SHIFT = 24;
21
21
  const COMPRESSION_FORMAT_BC1 = 1 << COMPRESSED_FORMAT_SHIFT;
22
22
  const COMPRESSION_FORMAT_BC2 = 2 << COMPRESSED_FORMAT_SHIFT;
23
23
  const COMPRESSION_FORMAT_BC3 = 3 << COMPRESSED_FORMAT_SHIFT;
24
- /*
25
- const COMPRESSION_FORMAT_BC4 = 4 << COMPRESSED_FORMAT_SHIFT;
26
- const COMPRESSION_FORMAT_BC5 = 5 << COMPRESSED_FORMAT_SHIFT;
27
- const COMPRESSION_FORMAT_BC6 = 6 << COMPRESSED_FORMAT_SHIFT;
28
- const COMPRESSION_FORMAT_BC7 = 7 << COMPRESSED_FORMAT_SHIFT;
29
- const COMPRESSION_FORMAT_ETC2_RGB8 = 8 << COMPRESSED_FORMAT_SHIFT;
30
- const COMPRESSION_FORMAT_ETC2_RGB8_A1 = 9 << COMPRESSED_FORMAT_SHIFT;
31
- const COMPRESSION_FORMAT_ETC2_RGBA8 = 10 << COMPRESSED_FORMAT_SHIFT;
32
- const COMPRESSION_FORMAT_ASTC_4x4 = 11 << COMPRESSED_FORMAT_SHIFT;
33
- const COMPRESSION_FORMAT_ASTC_5x4 = 12 << COMPRESSED_FORMAT_SHIFT;
34
- const COMPRESSION_FORMAT_ASTC_5x5 = 13 << COMPRESSED_FORMAT_SHIFT;
35
- const COMPRESSION_FORMAT_ASTC_6x5 = 14 << COMPRESSED_FORMAT_SHIFT;
36
- const COMPRESSION_FORMAT_ASTC_6x6 = 15 << COMPRESSED_FORMAT_SHIFT;
37
- const COMPRESSION_FORMAT_ASTC_8x5 = 16 << COMPRESSED_FORMAT_SHIFT;
38
- const COMPRESSION_FORMAT_ASTC_8x6 = 17 << COMPRESSED_FORMAT_SHIFT;
39
- const COMPRESSION_FORMAT_ASTC_8x8 = 18 << COMPRESSED_FORMAT_SHIFT;
40
- const COMPRESSION_FORMAT_ASTC_10x5 = 19 << COMPRESSED_FORMAT_SHIFT;
41
- const COMPRESSION_FORMAT_ASTC_10x6 = 20 << COMPRESSED_FORMAT_SHIFT;
42
- const COMPRESSION_FORMAT_ASTC_10x8 = 21 << COMPRESSED_FORMAT_SHIFT;
43
- const COMPRESSION_FORMAT_ASTC_10x10 = 22 << COMPRESSED_FORMAT_SHIFT;
44
- const COMPRESSION_FORMAT_ASTC_12x10 = 23 << COMPRESSED_FORMAT_SHIFT;
45
- const COMPRESSION_FORMAT_ASTC_12x12 = 24 << COMPRESSED_FORMAT_SHIFT;
24
+ /*
25
+ const COMPRESSION_FORMAT_BC4 = 4 << COMPRESSED_FORMAT_SHIFT;
26
+ const COMPRESSION_FORMAT_BC5 = 5 << COMPRESSED_FORMAT_SHIFT;
27
+ const COMPRESSION_FORMAT_BC6 = 6 << COMPRESSED_FORMAT_SHIFT;
28
+ const COMPRESSION_FORMAT_BC7 = 7 << COMPRESSED_FORMAT_SHIFT;
29
+ const COMPRESSION_FORMAT_ETC2_RGB8 = 8 << COMPRESSED_FORMAT_SHIFT;
30
+ const COMPRESSION_FORMAT_ETC2_RGB8_A1 = 9 << COMPRESSED_FORMAT_SHIFT;
31
+ const COMPRESSION_FORMAT_ETC2_RGBA8 = 10 << COMPRESSED_FORMAT_SHIFT;
32
+ const COMPRESSION_FORMAT_ASTC_4x4 = 11 << COMPRESSED_FORMAT_SHIFT;
33
+ const COMPRESSION_FORMAT_ASTC_5x4 = 12 << COMPRESSED_FORMAT_SHIFT;
34
+ const COMPRESSION_FORMAT_ASTC_5x5 = 13 << COMPRESSED_FORMAT_SHIFT;
35
+ const COMPRESSION_FORMAT_ASTC_6x5 = 14 << COMPRESSED_FORMAT_SHIFT;
36
+ const COMPRESSION_FORMAT_ASTC_6x6 = 15 << COMPRESSED_FORMAT_SHIFT;
37
+ const COMPRESSION_FORMAT_ASTC_8x5 = 16 << COMPRESSED_FORMAT_SHIFT;
38
+ const COMPRESSION_FORMAT_ASTC_8x6 = 17 << COMPRESSED_FORMAT_SHIFT;
39
+ const COMPRESSION_FORMAT_ASTC_8x8 = 18 << COMPRESSED_FORMAT_SHIFT;
40
+ const COMPRESSION_FORMAT_ASTC_10x5 = 19 << COMPRESSED_FORMAT_SHIFT;
41
+ const COMPRESSION_FORMAT_ASTC_10x6 = 20 << COMPRESSED_FORMAT_SHIFT;
42
+ const COMPRESSION_FORMAT_ASTC_10x8 = 21 << COMPRESSED_FORMAT_SHIFT;
43
+ const COMPRESSION_FORMAT_ASTC_10x10 = 22 << COMPRESSED_FORMAT_SHIFT;
44
+ const COMPRESSION_FORMAT_ASTC_12x10 = 23 << COMPRESSED_FORMAT_SHIFT;
45
+ const COMPRESSION_FORMAT_ASTC_12x12 = 24 << COMPRESSED_FORMAT_SHIFT;
46
46
  */ const COMPRESSION_FORMAT_BITMASK = 0x1f << COMPRESSED_FORMAT_SHIFT;
47
47
  const RED_BITMASK = 1 << RED_SHIFT;
48
48
  const GREEN_BITMASK = 1 << GREEN_SHIFT;
@@ -116,11 +116,11 @@ const textureFormatMap = {
116
116
  'dxt5': makeTextureFormat(COMPRESSION_FORMAT_BC3, true, true, true, true, false, false, false, false, false, false, false, 4, 4, 16),
117
117
  'dxt5-srgb': makeTextureFormat(COMPRESSION_FORMAT_BC3, true, true, true, true, false, false, false, false, false, true, false, 4, 4, 16)
118
118
  };
119
- /**
120
- * Converts a non-sRGB texture format to the corresponding sRGB texture format
121
- * @param format - The texture format to be converted
122
- * @returns The sRGB texture format
123
- * @public
119
+ /**
120
+ * Converts a non-sRGB texture format to the corresponding sRGB texture format
121
+ * @param format - The texture format to be converted
122
+ * @returns The sRGB texture format
123
+ * @public
124
124
  */ function linearTextureFormatToSRGB(format) {
125
125
  switch(format){
126
126
  case 'rgba8unorm':
@@ -137,115 +137,115 @@ const textureFormatMap = {
137
137
  return format;
138
138
  }
139
139
  }
140
- /**
141
- * Check if a given texture format contains an alpha channel.
142
- * @param format - The texture format to be checked.
143
- * @returns true if the texture format contains an alpha channel, otherwise false
144
- * @public
140
+ /**
141
+ * Check if a given texture format contains an alpha channel.
142
+ * @param format - The texture format to be checked.
143
+ * @returns true if the texture format contains an alpha channel, otherwise false
144
+ * @public
145
145
  */ function hasAlphaChannel(format) {
146
146
  return !!(textureFormatMap[format] & ALPHA_BITMASK);
147
147
  }
148
- /**
149
- * Check if a given texture format contains a red channel.
150
- * @param format - The texture format to be checked.
151
- * @returns true if the texture format contains a red channel, otherwise false
152
- * @public
148
+ /**
149
+ * Check if a given texture format contains a red channel.
150
+ * @param format - The texture format to be checked.
151
+ * @returns true if the texture format contains a red channel, otherwise false
152
+ * @public
153
153
  */ function hasRedChannel(format) {
154
154
  return !!(textureFormatMap[format] & RED_BITMASK);
155
155
  }
156
- /**
157
- * Check if a given texture format contains a green channel.
158
- * @param format - The texture format to be checked.
159
- * @returns true if the texture format contains a green channel, otherwise false
160
- * @public
156
+ /**
157
+ * Check if a given texture format contains a green channel.
158
+ * @param format - The texture format to be checked.
159
+ * @returns true if the texture format contains a green channel, otherwise false
160
+ * @public
161
161
  */ function hasGreenChannel(format) {
162
162
  return !!(textureFormatMap[format] & GREEN_BITMASK);
163
163
  }
164
- /**
165
- * Check if a given texture format contains a blue channel.
166
- * @param format - The texture format to be checked.
167
- * @returns true if the texture format contains a blue channel, otherwise false
168
- * @public
164
+ /**
165
+ * Check if a given texture format contains a blue channel.
166
+ * @param format - The texture format to be checked.
167
+ * @returns true if the texture format contains a blue channel, otherwise false
168
+ * @public
169
169
  */ function hasBlueChannel(format) {
170
170
  return !!(textureFormatMap[format] & BLUE_BITMASK);
171
171
  }
172
- /**
173
- * Check if a given texture format contains a depth channel.
174
- * @param format - The texture format to be checked.
175
- * @returns true if the texture format contains a depth channel, otherwise false
176
- * @public
172
+ /**
173
+ * Check if a given texture format contains a depth channel.
174
+ * @param format - The texture format to be checked.
175
+ * @returns true if the texture format contains a depth channel, otherwise false
176
+ * @public
177
177
  */ function hasDepthChannel(format) {
178
178
  return !!(textureFormatMap[format] & DEPTH_BITMASK);
179
179
  }
180
- /**
181
- * Check if a given texture format contains a stencil channel.
182
- * @param format - The texture format to be checked.
183
- * @returns true if the texture format contains a stencil channel, otherwise false
184
- * @public
180
+ /**
181
+ * Check if a given texture format contains a stencil channel.
182
+ * @param format - The texture format to be checked.
183
+ * @returns true if the texture format contains a stencil channel, otherwise false
184
+ * @public
185
185
  */ function hasStencilChannel(format) {
186
186
  return !!(textureFormatMap[format] & STENCIL_BITMASK);
187
187
  }
188
- /**
189
- * Check whether a given texture format is floating-point.
190
- * @param format - The texture format to be checked.
191
- * @returns true if the texture format is floating-point, otherwise false
192
- * @public
188
+ /**
189
+ * Check whether a given texture format is floating-point.
190
+ * @param format - The texture format to be checked.
191
+ * @returns true if the texture format is floating-point, otherwise false
192
+ * @public
193
193
  */ function isFloatTextureFormat(format) {
194
194
  return !!(textureFormatMap[format] & FLOAT_BITMASK);
195
195
  }
196
- /**
197
- * Check whether a given texture format is integer.
198
- * @param format - The texture format to be checked.
199
- * @returns true if the texture format is integer, otherwise false
200
- * @public
196
+ /**
197
+ * Check whether a given texture format is integer.
198
+ * @param format - The texture format to be checked.
199
+ * @returns true if the texture format is integer, otherwise false
200
+ * @public
201
201
  */ function isIntegerTextureFormat(format) {
202
202
  return !!(textureFormatMap[format] & INTEGER_BITMASK);
203
203
  }
204
- /**
205
- * Check whether a given texture format is signed.
206
- * @param format - The texture format to be checked.
207
- * @returns true if the texture format is signed, otherwise false
208
- * @public
204
+ /**
205
+ * Check whether a given texture format is signed.
206
+ * @param format - The texture format to be checked.
207
+ * @returns true if the texture format is signed, otherwise false
208
+ * @public
209
209
  */ function isSignedTextureFormat(format) {
210
210
  return !!(textureFormatMap[format] & SIGNED_BITMASK);
211
211
  }
212
- /**
213
- * Check whether a given texture format is a compressed format.
214
- * @param format - The texture format to be checked.
215
- * @returns true if the texture format is a compressed format, otherwise false
216
- * @public
212
+ /**
213
+ * Check whether a given texture format is a compressed format.
214
+ * @param format - The texture format to be checked.
215
+ * @returns true if the texture format is a compressed format, otherwise false
216
+ * @public
217
217
  */ function isCompressedTextureFormat(format) {
218
218
  return !!(textureFormatMap[format] & COMPRESSION_FORMAT_BITMASK);
219
219
  }
220
- /**
221
- * Check whether a given texture format is sRGB format.
222
- * @param format - The texture format to be checked.
223
- * @returns true if the texture format is sRGB format, otherwise false
224
- * @public
220
+ /**
221
+ * Check whether a given texture format is sRGB format.
222
+ * @param format - The texture format to be checked.
223
+ * @returns true if the texture format is sRGB format, otherwise false
224
+ * @public
225
225
  */ function isSRGBTextureFormat(format) {
226
226
  return !!(textureFormatMap[format] & SRGB_BITMASK);
227
227
  }
228
- /**
229
- * Get block size of given texture format
230
- * @param format - The texture format
231
- * @returns The block size
232
- * @public
228
+ /**
229
+ * Get block size of given texture format
230
+ * @param format - The texture format
231
+ * @returns The block size
232
+ * @public
233
233
  */ function getTextureFormatBlockSize(format) {
234
234
  return (textureFormatMap[format] & BLOCK_SIZE_MASK) >> BLOCK_SIZE_SHIFT;
235
235
  }
236
- /**
237
- * Get block width of given texture format
238
- * @param format - The texture format
239
- * @returns The block width
240
- * @public
236
+ /**
237
+ * Get block width of given texture format
238
+ * @param format - The texture format
239
+ * @returns The block width
240
+ * @public
241
241
  */ function getTextureFormatBlockWidth(format) {
242
242
  return (textureFormatMap[format] & BLOCK_WIDTH_MASK) >> BLOCK_WIDTH_SHIFT;
243
243
  }
244
- /**
245
- * Get block height of given texture format
246
- * @param format - The texture format
247
- * @returns The block height
248
- * @public
244
+ /**
245
+ * Get block height of given texture format
246
+ * @param format - The texture format
247
+ * @returns The block height
248
+ * @public
249
249
  */ function getTextureFormatBlockHeight(format) {
250
250
  return (textureFormatMap[format] & BLOCK_HEIGHT_MASK) >> BLOCK_HEIGHT_SHIFT;
251
251
  }
@@ -535,23 +535,23 @@ var ShaderType;
535
535
  ShaderType[ShaderType["Fragment"] = 2] = "Fragment";
536
536
  ShaderType[ShaderType["Compute"] = 4] = "Compute";
537
537
  })(ShaderType || (ShaderType = {}));
538
- /**
539
- * Event that will be fired when device is lost
540
- * @public
538
+ /**
539
+ * Event that will be fired when device is lost
540
+ * @public
541
541
  */ class DeviceLostEvent {
542
542
  /** The event name */ static NAME = 'devicelost';
543
543
  type = DeviceLostEvent.NAME;
544
544
  }
545
- /**
546
- * Event that will be fired when device has just been restored
547
- * @public
545
+ /**
546
+ * Event that will be fired when device has just been restored
547
+ * @public
548
548
  */ class DeviceRestoreEvent {
549
549
  /** The event name */ static NAME = 'devicerestored';
550
550
  type = DeviceRestoreEvent.NAME;
551
551
  }
552
- /**
553
- * Event that will be fired when size of back buffer has changed
554
- * @public
552
+ /**
553
+ * Event that will be fired when size of back buffer has changed
554
+ * @public
555
555
  */ class DeviceResizeEvent {
556
556
  /** The event name */ static NAME = 'resize';
557
557
  width;
@@ -562,9 +562,9 @@ var ShaderType;
562
562
  this.height = height;
563
563
  }
564
564
  }
565
- /**
566
- * Event that will be fired when any gpu object is created
567
- * @public
565
+ /**
566
+ * Event that will be fired when any gpu object is created
567
+ * @public
568
568
  */ class DeviceGPUObjectAddedEvent {
569
569
  /** the event name */ static NAME = 'gpuobject_added';
570
570
  object;
@@ -573,9 +573,9 @@ var ShaderType;
573
573
  this.object = obj;
574
574
  }
575
575
  }
576
- /**
577
- * Event that will be fired when any gpu object is disposed
578
- * @public
576
+ /**
577
+ * Event that will be fired when any gpu object is disposed
578
+ * @public
579
579
  */ class DeviceGPUObjectRemovedEvent {
580
580
  /** The event name */ static NAME = 'gpuobject_removed';
581
581
  object;
@@ -584,9 +584,9 @@ var ShaderType;
584
584
  this.object = obj;
585
585
  }
586
586
  }
587
- /**
588
- * Event that will be fired when any gpu object name is changed
589
- * @public
587
+ /**
588
+ * Event that will be fired when any gpu object name is changed
589
+ * @public
590
590
  */ class DeviceGPUObjectRenameEvent {
591
591
  /** The event name */ static NAME = 'gpuobject_rename';
592
592
  object;
@@ -812,12 +812,12 @@ function unbracket(e) {
812
812
  throw new Error(`no matching overload function found for type ${this.type.toTypeName('webgl2')}`);
813
813
  }
814
814
  toWGSL(indent, ctx) {
815
- /*
816
- console.assert(
817
- this.type.isConstructible(),
818
- `type '${this.type.toTypeName('webgpu')}' is not constructible`,
819
- true
820
- );
815
+ /*
816
+ console.assert(
817
+ this.type.isConstructible(),
818
+ `type '${this.type.toTypeName('webgpu')}' is not constructible`,
819
+ true
820
+ );
821
821
  */ const overloads = this.type.getConstructorOverloads('webgpu');
822
822
  for (const overload of overloads){
823
823
  const convertedArgs = convertArgs(this.args, overload);
@@ -1719,10 +1719,10 @@ function unbracket(e) {
1719
1719
  break;
1720
1720
  case DeclareType.DECLARE_TYPE_UNIFORM:
1721
1721
  if (valueType.isStructType()) {
1722
- /*
1723
- if (valueType.layout !== 'std140') {
1724
- throw new errors.PBASTError(this, 'uniform buffer layout must be std140');
1725
- }
1722
+ /*
1723
+ if (valueType.layout !== 'std140') {
1724
+ throw new errors.PBASTError(this, 'uniform buffer layout must be std140');
1725
+ }
1726
1726
  */ return `${indent}layout(std140) uniform ${this.blockName} { ${valueType.structName} ${this.value.name}; };\n`;
1727
1727
  } else {
1728
1728
  valueType = ctx.typeReplacement?.get(this.value.value) || valueType;
@@ -2031,13 +2031,13 @@ function unbracket(e) {
2031
2031
  str += super.toWGSL(indent + ' ', ctx);
2032
2032
  str += `${indent}}\n`;
2033
2033
  return str;
2034
- /*
2035
- let str = `${indent}loop {\n`;
2036
- const newIndent = indent + ' ';
2037
- str += `${newIndent}if (!(${unbracket(this.condition.toWGSL(indent, ctx))})) { break; }\n`;
2038
- str += super.toWGSL(newIndent, ctx);
2039
- str += `${indent}}\n`;
2040
- return str;
2034
+ /*
2035
+ let str = `${indent}loop {\n`;
2036
+ const newIndent = indent + ' ';
2037
+ str += `${newIndent}if (!(${unbracket(this.condition.toWGSL(indent, ctx))})) { break; }\n`;
2038
+ str += super.toWGSL(newIndent, ctx);
2039
+ str += `${indent}}\n`;
2040
+ return str;
2041
2041
  */ }
2042
2042
  }
2043
2043
  /** @internal */ class ASTStructDefine extends ShaderAST {
@@ -59,9 +59,9 @@ const constructorCache = new Map();
59
59
  });
60
60
  return wrappedTypeFunc;
61
61
  }
62
- /**
63
- * Base class for proxiable object
64
- * @public
62
+ /**
63
+ * Base class for proxiable object
64
+ * @public
65
65
  */ class Proxiable {
66
66
  /** @internal */ proxy;
67
67
  constructor(){
@@ -80,9 +80,9 @@ const constructorCache = new Map();
80
80
  }
81
81
  }
82
82
  let uidExp = 0;
83
- /**
84
- * Base class for a expression in the shader
85
- * @public
83
+ /**
84
+ * Base class for a expression in the shader
85
+ * @public
86
86
  */ class PBShaderExp extends Proxiable {
87
87
  /** @internal */ $uid;
88
88
  /** @internal */ $str;
@@ -143,20 +143,20 @@ let uidExp = 0;
143
143
  debugger;
144
144
  }
145
145
  }
146
- /**
147
- * Point out that the variable should be in uniform address space
148
- * @param group - The bind group index
149
- * @returns self
146
+ /**
147
+ * Point out that the variable should be in uniform address space
148
+ * @param group - The bind group index
149
+ * @returns self
150
150
  */ uniform(group) {
151
151
  this.$declareType = DeclareType.DECLARE_TYPE_UNIFORM;
152
152
  this.$group = group;
153
153
  this.$isBuffer = false;
154
154
  return this;
155
155
  }
156
- /**
157
- * Point out that the variable should be an uniform buffer
158
- * @param group - The bind group index
159
- * @returns self
156
+ /**
157
+ * Point out that the variable should be an uniform buffer
158
+ * @param group - The bind group index
159
+ * @returns self
160
160
  */ uniformBuffer(group) {
161
161
  if (!this.$typeinfo.isPrimitiveType() && !this.$typeinfo.isArrayType() && !this.$typeinfo.isStructType()) {
162
162
  throw new PBASTError(this.$ast, 'only primitive type, array type or structure type can be set as uniform buffer');
@@ -166,21 +166,21 @@ let uidExp = 0;
166
166
  this.$isBuffer = true;
167
167
  return this;
168
168
  }
169
- /**
170
- * Point out that the variable should be in workgroup address space
171
- *
172
- * @remarks
173
- * WebGPU device only
174
- *
175
- * @returns self
169
+ /**
170
+ * Point out that the variable should be in workgroup address space
171
+ *
172
+ * @remarks
173
+ * WebGPU device only
174
+ *
175
+ * @returns self
176
176
  */ workgroup() {
177
177
  this.$declareType = DeclareType.DECLARE_TYPE_WORKGROUP;
178
178
  return this;
179
179
  }
180
- /**
181
- * Point out that the variable should be in storage address space
182
- * @param group - The bind group index
183
- * @returns self
180
+ /**
181
+ * Point out that the variable should be in storage address space
182
+ * @param group - The bind group index
183
+ * @returns self
184
184
  */ storage(group) {
185
185
  if (!this.$typeinfo.isHostSharable()) {
186
186
  throw new PBASTError(this.$ast, 'type cannot be declared in storage address space');
@@ -190,10 +190,10 @@ let uidExp = 0;
190
190
  this.$isBuffer = false;
191
191
  return this;
192
192
  }
193
- /**
194
- * Point out that the variable should be a storage buffer
195
- * @param group - The bind group index
196
- * @returns self
193
+ /**
194
+ * Point out that the variable should be a storage buffer
195
+ * @param group - The bind group index
196
+ * @returns self
197
197
  */ storageBuffer(group) {
198
198
  if (!this.$typeinfo.isPrimitiveType() && !this.$typeinfo.isArrayType() && !this.$typeinfo.isStructType()) {
199
199
  throw new PBASTError(this.$ast, 'only primitive type, array type or structure type can be set as storage buffer');
@@ -211,19 +211,19 @@ let uidExp = 0;
211
211
  this.$inout = 'out';
212
212
  return this;
213
213
  }
214
- /**
215
- * Point out that the variable is a input vertex attribute
216
- * @param attr - The vertex semantic
217
- * @returns self
214
+ /**
215
+ * Point out that the variable is a input vertex attribute
216
+ * @param attr - The vertex semantic
217
+ * @returns self
218
218
  */ attrib(attr) {
219
219
  this.$declareType = DeclareType.DECLARE_TYPE_IN;
220
220
  this.$attrib = attr;
221
221
  return this;
222
222
  }
223
- /**
224
- * Create tags for the variable
225
- * @param args - tags
226
- * @returns self
223
+ /**
224
+ * Create tags for the variable
225
+ * @param args - tags
226
+ * @returns self
227
227
  */ tag(...args) {
228
228
  args.forEach((val)=>{
229
229
  if (this.$tags.indexOf(val) < 0) {
@@ -232,20 +232,20 @@ let uidExp = 0;
232
232
  });
233
233
  return this;
234
234
  }
235
- /**
236
- * Set sample type for the variable if the variable is of type texture
237
- * @param type - sample type
238
- * @returns self
235
+ /**
236
+ * Set sample type for the variable if the variable is of type texture
237
+ * @param type - sample type
238
+ * @returns self
239
239
  */ sampleType(type) {
240
240
  if (type) {
241
241
  this.$sampleType = type;
242
242
  }
243
243
  return this;
244
244
  }
245
- /**
246
- * Get element in the array by index
247
- * @param index - index of the element
248
- * @returns the element variable
245
+ /**
246
+ * Get element in the array by index
247
+ * @param index - index of the element
248
+ * @returns the element variable
249
249
  */ at(index) {
250
250
  const varType = this.$ast.getType();
251
251
  if (!varType.isArrayType() && (!varType.isPrimitiveType() || !varType.isVectorType() && !varType.isMatrixType())) {
@@ -285,10 +285,10 @@ let uidExp = 0;
285
285
  }
286
286
  return result;
287
287
  }
288
- /**
289
- * Set element in the array by index
290
- * @param index - index of the element
291
- * @param val - value to set
288
+ /**
289
+ * Set element in the array by index
290
+ * @param index - index of the element
291
+ * @param val - value to set
292
292
  */ setAt(index, val) {
293
293
  const varType = this.$ast.getType();
294
294
  if (!varType.isArrayType()) {
@@ -304,44 +304,44 @@ let uidExp = 0;
304
304
  }
305
305
  currentProgramBuilder.getCurrentScope().$ast.statements.push(new ASTAssignment(new ASTLValueArray(new ASTLValueScalar(this.$ast), typeof index === 'number' ? new ASTScalar(index, typeI32) : index.$ast, varType.elementType), val instanceof PBShaderExp ? val.$ast : val));
306
306
  }
307
- /**
308
- * Point out that the variable should be in high precision
309
- * @returns self
307
+ /**
308
+ * Point out that the variable should be in high precision
309
+ * @returns self
310
310
  */ highp() {
311
311
  this.$precision = ShaderPrecisionType.HIGH;
312
312
  return this;
313
313
  }
314
- /**
315
- * Points out that the variable should be in medium precision
316
- * @returns self
314
+ /**
315
+ * Points out that the variable should be in medium precision
316
+ * @returns self
317
317
  */ mediump() {
318
318
  this.$precision = ShaderPrecisionType.MEDIUM;
319
319
  return this;
320
320
  }
321
- /**
322
- * Points out that the variable should be in low precision
323
- * @returns self
321
+ /**
322
+ * Points out that the variable should be in low precision
323
+ * @returns self
324
324
  */ lowp() {
325
325
  this.$precision = ShaderPrecisionType.LOW;
326
326
  return this;
327
327
  }
328
- /**
329
- * Determine if this variable is of vector type
330
- * @returns true if the variable is of vector type, otherwise false
328
+ /**
329
+ * Determine if this variable is of vector type
330
+ * @returns true if the variable is of vector type, otherwise false
331
331
  */ isVector() {
332
332
  const varType = this.$ast.getType();
333
333
  return varType.isPrimitiveType() && varType.isVectorType();
334
334
  }
335
- /**
336
- * Get vector component count of the variable if this variable is of vector type
337
- * @returns the vector component count
335
+ /**
336
+ * Get vector component count of the variable if this variable is of vector type
337
+ * @returns the vector component count
338
338
  */ numComponents() {
339
339
  const varType = this.$ast.getType();
340
340
  return varType.isPrimitiveType() ? varType.cols : 0;
341
341
  }
342
- /**
343
- * Get type name of this variable
344
- * @returns The type name of this variable
342
+ /**
343
+ * Get type name of this variable
344
+ * @returns The type name of this variable
345
345
  */ getTypeName() {
346
346
  return this.$ast.getType().toTypeName(currentProgramBuilder.getDevice().type);
347
347
  }
package/dist/device.js CHANGED
@@ -7,9 +7,9 @@ import { DeviceGPUObjectAddedEvent, DeviceGPUObjectRemovedEvent, DeviceResizeEve
7
7
  import '@zephyr3d/base';
8
8
  import { DrawText } from './helpers/drawtext.js';
9
9
 
10
- /**
11
- * Base class for rendering device
12
- * @public
10
+ /**
11
+ * Base class for rendering device
12
+ * @public
13
13
  */ class BaseDevice {
14
14
  _canvas;
15
15
  _canvasClientWidth;
package/dist/gpuobject.js CHANGED
@@ -1844,31 +1844,31 @@ var GPUResourceUsageFlags;
1844
1844
  GPUResourceUsageFlags[GPUResourceUsageFlags["DYNAMIC"] = 2048] = "DYNAMIC";
1845
1845
  GPUResourceUsageFlags[GPUResourceUsageFlags["MANAGED"] = 4096] = "MANAGED";
1846
1846
  })(GPUResourceUsageFlags || (GPUResourceUsageFlags = {}));
1847
- /**
1848
- * Get vertex attribute index by semantic
1849
- * @internal
1847
+ /**
1848
+ * Get vertex attribute index by semantic
1849
+ * @internal
1850
1850
  */ function getVertexAttribByName(name) {
1851
1851
  return vertexAttribNameMap[name];
1852
1852
  }
1853
- /**
1854
- * Get vertex semantic by attribute index
1855
- * @internal
1853
+ /**
1854
+ * Get vertex semantic by attribute index
1855
+ * @internal
1856
1856
  */ function getVertexAttribName(attrib) {
1857
1857
  return vertexAttribNameRevMap[attrib];
1858
1858
  }
1859
- /**
1860
- * Get byte size of specified vertex format
1861
- * @internal
1859
+ /**
1860
+ * Get byte size of specified vertex format
1861
+ * @internal
1862
1862
  */ function getVertexFormatSize(fmt) {
1863
1863
  return vertexAttribFormatMap[fmt][2];
1864
1864
  }
1865
- /**
1866
- * Get vertex format by semantic and component type and component count
1867
- * @param semantic - The vertex semantic
1868
- * @param type - Data type of vertex component
1869
- * @param count - The count of vertex components
1870
- * @returns Vertex format
1871
- * @public
1865
+ /**
1866
+ * Get vertex format by semantic and component type and component count
1867
+ * @param semantic - The vertex semantic
1868
+ * @param type - Data type of vertex component
1869
+ * @param count - The count of vertex components
1870
+ * @returns Vertex format
1871
+ * @public
1872
1872
  */ function getVertexAttribFormat(semantic, type, count) {
1873
1873
  const loc = getVertexAttribByName(semantic);
1874
1874
  for(const k in vertexAttribFormatMap){
@@ -1879,19 +1879,19 @@ var GPUResourceUsageFlags;
1879
1879
  }
1880
1880
  return null;
1881
1881
  }
1882
- /**
1883
- * Get the length of a vertex buffer by specified structure type of the vertex buffer
1884
- * @param vertexBufferType - The structure type of the vertex buffer
1885
- * @returns The length of the vertex buffer
1886
- * @public
1882
+ /**
1883
+ * Get the length of a vertex buffer by specified structure type of the vertex buffer
1884
+ * @param vertexBufferType - The structure type of the vertex buffer
1885
+ * @returns The length of the vertex buffer
1886
+ * @public
1887
1887
  */ function getVertexBufferLength(vertexBufferType) {
1888
1888
  return vertexBufferType.structMembers[0].type.dimension;
1889
1889
  }
1890
- /**
1891
- * Get byte stride of a vertex buffer by specified structure type of the vertex buffer
1892
- * @param vertexBufferType - The structure type of the vertex buffer
1893
- * @returns The byte stride of the vertex buffer
1894
- * @public
1890
+ /**
1891
+ * Get byte stride of a vertex buffer by specified structure type of the vertex buffer
1892
+ * @param vertexBufferType - The structure type of the vertex buffer
1893
+ * @returns The byte stride of the vertex buffer
1894
+ * @public
1895
1895
  */ function getVertexBufferStride(vertexBufferType) {
1896
1896
  const vertexType = vertexBufferType.structMembers[0].type.elementType;
1897
1897
  if (vertexType.isStructType()) {
@@ -1904,12 +1904,12 @@ var GPUResourceUsageFlags;
1904
1904
  return vertexType.getSize();
1905
1905
  }
1906
1906
  }
1907
- /**
1908
- * Get primitive type of a vertex attribute by specified vertex semantic
1909
- * @param vertexBufferType - The structure type of the vertex buffer
1910
- * @param semantic - The vertex semantic
1911
- * @returns - The primitive type of the vertex attribute
1912
- * @public
1907
+ /**
1908
+ * Get primitive type of a vertex attribute by specified vertex semantic
1909
+ * @param vertexBufferType - The structure type of the vertex buffer
1910
+ * @param semantic - The vertex semantic
1911
+ * @returns - The primitive type of the vertex attribute
1912
+ * @public
1913
1913
  */ function getVertexBufferAttribTypeBySemantic(vertexBufferType, semantic) {
1914
1914
  const k = vertexBufferType.structMembers[0];
1915
1915
  const vertexType = k.type.elementType;
@@ -1924,12 +1924,12 @@ var GPUResourceUsageFlags;
1924
1924
  return k.name === semantic ? vertexType : null;
1925
1925
  }
1926
1926
  }
1927
- /**
1928
- * Get primitive type of a vertex attribute by specified vertex attribute index
1929
- * @param vertexBufferType - The structure type of the vertex buffer
1930
- * @param semantic - The vertex attribute index
1931
- * @returns - The primitive type of the vertex attribute
1932
- * @public
1927
+ /**
1928
+ * Get primitive type of a vertex attribute by specified vertex attribute index
1929
+ * @param vertexBufferType - The structure type of the vertex buffer
1930
+ * @param semantic - The vertex attribute index
1931
+ * @returns - The primitive type of the vertex attribute
1932
+ * @public
1933
1933
  */ function getVertexBufferAttribType(vertexBufferType, attrib) {
1934
1934
  const attribName = getVertexAttribName(attrib);
1935
1935
  if (!attribName) {
@@ -1937,12 +1937,12 @@ var GPUResourceUsageFlags;
1937
1937
  }
1938
1938
  return getVertexBufferAttribTypeBySemantic(vertexBufferType, attribName);
1939
1939
  }
1940
- /**
1941
- * Get the structure type of a vertex buffer by specified vertex attribute formats and the length of the vertex buffer
1942
- * @param length - The length of the vertex buffer
1943
- * @param attributes - The vertex attributes
1944
- * @returns The structure type of the vertex buffer
1945
- * @public
1940
+ /**
1941
+ * Get the structure type of a vertex buffer by specified vertex attribute formats and the length of the vertex buffer
1942
+ * @param length - The length of the vertex buffer
1943
+ * @param attributes - The vertex attributes
1944
+ * @returns The structure type of the vertex buffer
1945
+ * @public
1946
1946
  */ function makeVertexBufferType(length, ...attributes) {
1947
1947
  if (attributes.length === 0) {
1948
1948
  return null;
@@ -1968,9 +1968,9 @@ var GPUResourceUsageFlags;
1968
1968
  ]);
1969
1969
  }
1970
1970
  }
1971
- /**
1972
- * Vertex semantic list
1973
- * @public
1971
+ /**
1972
+ * Vertex semantic list
1973
+ * @public
1974
1974
  */ const semanticList = function() {
1975
1975
  const list = [];
1976
1976
  for(let i = 0; i < MAX_VERTEX_ATTRIBUTES; i++){
@@ -2012,11 +2012,11 @@ var GPUResourceUsageFlags;
2012
2012
  return null;
2013
2013
  }
2014
2014
  }
2015
- /**
2016
- * Creates the default name for the type of given gpu object
2017
- * @param obj - The gpu object
2018
- * @returns The default name
2019
- * @public
2015
+ /**
2016
+ * Creates the default name for the type of given gpu object
2017
+ * @param obj - The gpu object
2018
+ * @returns The default name
2019
+ * @public
2020
2020
  */ function genDefaultName(obj) {
2021
2021
  if (obj.isTexture2D()) {
2022
2022
  return 'texture_2d';
@@ -35,9 +35,9 @@
35
35
  }
36
36
  }
37
37
  }
38
- /**
39
- * The font class
40
- * @public
38
+ /**
39
+ * The font class
40
+ * @public
41
41
  */ class Font {
42
42
  /** @internal */ static fontCache = {};
43
43
  /** @internal */ _name;
@@ -50,10 +50,10 @@
50
50
  /** @internal */ _topScaled;
51
51
  /** @internal */ _bottomScaled;
52
52
  /** @internal */ _div;
53
- /**
54
- * Creates a instance of font class from font name and the scale value
55
- * @param name - The font name
56
- * @param scale - The scale value
53
+ /**
54
+ * Creates a instance of font class from font name and the scale value
55
+ * @param name - The font name
56
+ * @param scale - The scale value
57
57
  */ constructor(name, scale){
58
58
  this._top = 0;
59
59
  this._bottom = 0;
@@ -69,11 +69,11 @@
69
69
  this._normalizeFont();
70
70
  }
71
71
  }
72
- /**
73
- * Fetch a font from cache
74
- * @param name - The font name
75
- * @param scale - The scale value
76
- * @returns The font object
72
+ /**
73
+ * Fetch a font from cache
74
+ * @param name - The font name
75
+ * @param scale - The scale value
76
+ * @returns The font object
77
77
  */ static fetchFont(name, scale) {
78
78
  let fontlist = this.fontCache[name];
79
79
  if (!fontlist) {
@@ -1,8 +1,8 @@
1
1
  import { RectsPacker } from '@zephyr3d/base';
2
2
 
3
- /**
4
- * Texture atlas manager
5
- * @public
3
+ /**
4
+ * Texture atlas manager
5
+ * @public
6
6
  */ class TextureAtlasManager {
7
7
  /** @internal */ static ATLAS_WIDTH = 1024;
8
8
  /** @internal */ static ATLAS_HEIGHT = 1024;
@@ -15,13 +15,13 @@ import { RectsPacker } from '@zephyr3d/base';
15
15
  /** @internal */ _atlasList;
16
16
  /** @internal */ _atlasInfoMap;
17
17
  /** @internal */ _atlasRestoreHandler;
18
- /**
19
- * Creates a new texture atlas manager instance
20
- * @param device - The render device
21
- * @param binWidth - Width of an atlas bin
22
- * @param binHeight - Height of an atlas bin
23
- * @param rectBorderWidth - Border width of an atlas
24
- * @param linearSpace - true if the texture space is linear
18
+ /**
19
+ * Creates a new texture atlas manager instance
20
+ * @param device - The render device
21
+ * @param binWidth - Width of an atlas bin
22
+ * @param binHeight - Height of an atlas bin
23
+ * @param rectBorderWidth - Border width of an atlas
24
+ * @param linearSpace - true if the texture space is linear
25
25
  */ constructor(device, binWidth, binHeight, rectBorderWidth, linearSpace){
26
26
  this._device = device;
27
27
  this._binWidth = binWidth;
@@ -33,37 +33,37 @@ import { RectsPacker } from '@zephyr3d/base';
33
33
  this._atlasInfoMap = {};
34
34
  this._atlasRestoreHandler = null;
35
35
  }
36
- /**
37
- * The texture restore handler callback function
38
- * This callback function will be called whenever the device has been restored
36
+ /**
37
+ * The texture restore handler callback function
38
+ * This callback function will be called whenever the device has been restored
39
39
  */ get atlasTextureRestoreHandler() {
40
40
  return this._atlasRestoreHandler;
41
41
  }
42
42
  set atlasTextureRestoreHandler(f) {
43
43
  this._atlasRestoreHandler = f;
44
44
  }
45
- /**
46
- * Gets the atlas texture of a given index
47
- * @param index - Index of the atlas bin
48
- * @returns Atlas texture for given index
45
+ /**
46
+ * Gets the atlas texture of a given index
47
+ * @param index - Index of the atlas bin
48
+ * @returns Atlas texture for given index
49
49
  */ getAtlasTexture(index) {
50
50
  return this._atlasList[index];
51
51
  }
52
- /**
53
- * Gets the information about specified atlas
54
- * @param key - Key of the atlas
55
- * @returns Information of the atlas
52
+ /**
53
+ * Gets the information about specified atlas
54
+ * @param key - Key of the atlas
55
+ * @returns Information of the atlas
56
56
  */ getAtlasInfo(key) {
57
57
  return this._atlasInfoMap[key] || null;
58
58
  }
59
- /**
60
- * Check if no atlas has been created
61
- * @returns true if no atlas has been created
59
+ /**
60
+ * Check if no atlas has been created
61
+ * @returns true if no atlas has been created
62
62
  */ isEmpty() {
63
63
  return this._atlasList.length === 0;
64
64
  }
65
- /**
66
- * Removes all created atlases
65
+ /**
66
+ * Removes all created atlases
67
67
  */ clear() {
68
68
  this._packer.clear();
69
69
  for (const tex of this._atlasList){
@@ -72,15 +72,15 @@ import { RectsPacker } from '@zephyr3d/base';
72
72
  this._atlasList = [];
73
73
  this._atlasInfoMap = {};
74
74
  }
75
- /**
76
- * Inserts a rectangle of a canvas to the atlas texture
77
- * @param key - Key of the atlas
78
- * @param ctx - The canvas context
79
- * @param x - x offset of the rectangle
80
- * @param y - y offset of the rectangle
81
- * @param w - width of the rectangle
82
- * @param h - height of the rectangle
83
- * @returns The atals info or null if insert failed
75
+ /**
76
+ * Inserts a rectangle of a canvas to the atlas texture
77
+ * @param key - Key of the atlas
78
+ * @param ctx - The canvas context
79
+ * @param x - x offset of the rectangle
80
+ * @param y - y offset of the rectangle
81
+ * @param w - width of the rectangle
82
+ * @param h - height of the rectangle
83
+ * @returns The atals info or null if insert failed
84
84
  */ pushCanvas(key, ctx, x, y, w, h) {
85
85
  const rc = this._packer.insert(w + 2 * this._rectBorderWidth, h + 2 * this._rectBorderWidth);
86
86
  if (rc) {
@@ -101,11 +101,11 @@ import { RectsPacker } from '@zephyr3d/base';
101
101
  }
102
102
  return null;
103
103
  }
104
- /**
105
- * Inserts a bitmap to the atlas texture
106
- * @param key - Key of the atlas
107
- * @param bitmap - The bitmap object
108
- * @returns The atals info or null if insert failed
104
+ /**
105
+ * Inserts a bitmap to the atlas texture
106
+ * @param key - Key of the atlas
107
+ * @param bitmap - The bitmap object
108
+ * @returns The atals info or null if insert failed
109
109
  */ pushBitmap(key, bitmap) {
110
110
  const rc = this._packer.insert(bitmap.width + 2 * this._rectBorderWidth, bitmap.height + 2 * this._rectBorderWidth);
111
111
  if (rc) {
package/package.json CHANGED
@@ -1,69 +1,69 @@
1
- {
2
- "name": "@zephyr3d/device",
3
- "version": "0.1.0",
4
- "description": "base system for zephyr3d library",
5
- "homepage": "https://github.com/gavinyork/zephyr3d#readme",
6
- "type": "module",
7
- "main": "./dist/index.js",
8
- "module": "./dist/index.js",
9
- "types": "./dist/index.d.ts",
10
- "files": [
11
- "**/*.js",
12
- "**/*.d.ts",
13
- "**/*.js.map"
14
- ],
15
- "sideEffects": false,
16
- "repository": {
17
- "type": "git",
18
- "url": "git+https://github.com/gavinyork/zephyr3d.git"
19
- },
20
- "scripts": {
21
- "clean": "shx rm -rf ./dist .tsbuildinfo",
22
- "tsc": "tsc -p . --noEmit",
23
- "build": "cross-env NODE_OPTIONS=--max_old_space_size=8192 rollup -c --silent"
24
- },
25
- "keywords": [
26
- "javascript",
27
- "3d",
28
- "rendering",
29
- "engine",
30
- "webgl",
31
- "webgpu",
32
- "canvas",
33
- "zephyr3d",
34
- "device"
35
- ],
36
- "license": "MIT",
37
- "bugs": {
38
- "url": "https://github.com/gavinyork/zephyr3d/issues"
39
- },
40
- "engines": {
41
- "node": ">=16.18.0"
42
- },
43
- "devDependencies": {
44
- "@babel/core": "^7.20.12",
45
- "@babel/preset-env": "^7.20.2",
46
- "@rollup/plugin-babel": "^6.0.3",
47
- "@rollup/plugin-node-resolve": "^15.0.1",
48
- "@rollup/plugin-strip": "^3.0.2",
49
- "@rollup/plugin-terser": "^0.4.0",
50
- "@rollup/pluginutils": "^5.0.2",
51
- "rollup": "^3.15.0",
52
- "rollup-plugin-dts": "^5.2.0",
53
- "rollup-plugin-copy": "^3.4.0",
54
- "rollup-plugin-typescript2": "^0.34.1",
55
- "@swc/core": "^1.3.62",
56
- "rollup-plugin-swc3": "^0.8.2",
57
- "shx": "^0.3.4",
58
- "cross-env": "^7.0.3",
59
- "typescript": "^5.1.3",
60
- "@zephyr3d/base": "workspace:^0.1.0"
61
- },
62
- "peerDependencies": {
63
- "@zephyr3d/base": "workspace:^0.1.0"
64
- },
65
- "dependencies": {
66
- "@webgpu/types": "^0.1.31",
67
- "@types/node": "^18.13.0"
68
- }
69
- }
1
+ {
2
+ "name": "@zephyr3d/device",
3
+ "version": "0.1.2",
4
+ "description": "base system for zephyr3d library",
5
+ "homepage": "https://github.com/gavinyork/zephyr3d#readme",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "module": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "files": [
11
+ "**/*.js",
12
+ "**/*.d.ts",
13
+ "**/*.js.map"
14
+ ],
15
+ "sideEffects": false,
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/gavinyork/zephyr3d.git"
19
+ },
20
+ "keywords": [
21
+ "javascript",
22
+ "3d",
23
+ "rendering",
24
+ "engine",
25
+ "webgl",
26
+ "webgpu",
27
+ "canvas",
28
+ "zephyr3d",
29
+ "device"
30
+ ],
31
+ "license": "MIT",
32
+ "bugs": {
33
+ "url": "https://github.com/gavinyork/zephyr3d/issues"
34
+ },
35
+ "engines": {
36
+ "node": ">=16.18.0"
37
+ },
38
+ "devDependencies": {
39
+ "@babel/core": "^7.20.12",
40
+ "@babel/preset-env": "^7.20.2",
41
+ "@rollup/plugin-babel": "^6.0.3",
42
+ "@rollup/plugin-node-resolve": "^15.0.1",
43
+ "@rollup/plugin-strip": "^3.0.2",
44
+ "@rollup/plugin-terser": "^0.4.0",
45
+ "@rollup/pluginutils": "^5.0.2",
46
+ "@swc/core": "^1.3.62",
47
+ "@zephyr3d/base": "^0.1.2",
48
+ "cross-env": "^7.0.3",
49
+ "rollup": "^3.15.0",
50
+ "rollup-plugin-copy": "^3.4.0",
51
+ "rollup-plugin-dts": "^5.2.0",
52
+ "rollup-plugin-swc3": "^0.8.2",
53
+ "rollup-plugin-typescript2": "^0.34.1",
54
+ "shx": "^0.3.4",
55
+ "typescript": "^5.1.3"
56
+ },
57
+ "peerDependencies": {
58
+ "@zephyr3d/base": "^0.1.2"
59
+ },
60
+ "dependencies": {
61
+ "@types/node": "^18.13.0",
62
+ "@webgpu/types": "^0.1.31"
63
+ },
64
+ "scripts": {
65
+ "clean": "shx rm -rf ./dist .tsbuildinfo",
66
+ "tsc": "tsc -p . --noEmit",
67
+ "build": "cross-env NODE_OPTIONS=--max_old_space_size=8192 rollup -c --silent"
68
+ }
69
+ }