@plasius/gpu-renderer 0.1.14 → 0.1.15
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/CHANGELOG.md +26 -0
- package/README.md +13 -0
- package/dist/index.cjs +392 -76
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +392 -76
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.d.ts +66 -1
- package/src/wavefront-compute.js +404 -73
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -209,6 +209,42 @@ export interface WavefrontEmissiveTriangleIndexSource {
|
|
|
209
209
|
readonly recordBytes: 4;
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
+
export type WavefrontEnvironmentPortalMode =
|
|
213
|
+
| 0
|
|
214
|
+
| 1
|
|
215
|
+
| 2
|
|
216
|
+
| "disabled"
|
|
217
|
+
| "guide"
|
|
218
|
+
| "guide-and-gate"
|
|
219
|
+
| "gate";
|
|
220
|
+
|
|
221
|
+
export interface WavefrontEnvironmentPortalInput {
|
|
222
|
+
readonly kind?: "rectangle";
|
|
223
|
+
readonly shape?: "rectangle";
|
|
224
|
+
readonly position?: readonly [number, number, number] | readonly number[];
|
|
225
|
+
readonly center?: readonly [number, number, number] | readonly number[];
|
|
226
|
+
readonly normal?: readonly [number, number, number] | readonly number[];
|
|
227
|
+
readonly tangent?: readonly [number, number, number] | readonly number[];
|
|
228
|
+
readonly width?: number;
|
|
229
|
+
readonly height?: number;
|
|
230
|
+
readonly halfWidth?: number;
|
|
231
|
+
readonly halfHeight?: number;
|
|
232
|
+
readonly radianceScale?: number;
|
|
233
|
+
readonly intensity?: number;
|
|
234
|
+
readonly color?: readonly [number, number, number, number?] | readonly number[];
|
|
235
|
+
readonly twoSided?: boolean;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export interface WavefrontEnvironmentPortalRecord {
|
|
239
|
+
readonly kind: 1;
|
|
240
|
+
readonly flags: number;
|
|
241
|
+
readonly position: readonly [number, number, number, number] | readonly number[];
|
|
242
|
+
readonly normal: readonly [number, number, number, number] | readonly number[];
|
|
243
|
+
readonly tangent: readonly [number, number, number, number] | readonly number[];
|
|
244
|
+
readonly bitangent: readonly [number, number, number, number] | readonly number[];
|
|
245
|
+
readonly color: readonly [number, number, number, number] | readonly number[];
|
|
246
|
+
}
|
|
247
|
+
|
|
212
248
|
export interface WavefrontPathTracingComputeConfig {
|
|
213
249
|
readonly width: number;
|
|
214
250
|
readonly height: number;
|
|
@@ -226,6 +262,10 @@ export interface WavefrontPathTracingComputeConfig {
|
|
|
226
262
|
readonly emissiveTriangleIndices: WavefrontEmissiveTriangleIndexSource;
|
|
227
263
|
readonly emissiveTriangleCount: number;
|
|
228
264
|
readonly emissiveTriangleCapacity: number;
|
|
265
|
+
readonly environmentPortals: readonly WavefrontEnvironmentPortalRecord[];
|
|
266
|
+
readonly environmentPortalCount: number;
|
|
267
|
+
readonly environmentPortalCapacity: number;
|
|
268
|
+
readonly environmentPortalMode: 0 | 1 | 2;
|
|
229
269
|
readonly triangleCount: number;
|
|
230
270
|
readonly triangleCapacity: number;
|
|
231
271
|
readonly bvhNodeCount: number;
|
|
@@ -262,6 +302,8 @@ export interface WavefrontEnvironmentLightingInput {
|
|
|
262
302
|
readonly intensity?: number;
|
|
263
303
|
readonly mode?: number;
|
|
264
304
|
readonly exposure?: number;
|
|
305
|
+
readonly environmentPortals?: readonly WavefrontEnvironmentPortalInput[];
|
|
306
|
+
readonly environmentPortalMode?: WavefrontEnvironmentPortalMode;
|
|
265
307
|
}
|
|
266
308
|
|
|
267
309
|
export interface WavefrontEnvironmentLightingConfig {
|
|
@@ -286,6 +328,7 @@ export interface WavefrontPathTracingMemoryEstimate {
|
|
|
286
328
|
readonly bvhNodeBytes: number;
|
|
287
329
|
readonly bvhLeafReferenceBytes: number;
|
|
288
330
|
readonly emissiveTriangleMetadataBytes: number;
|
|
331
|
+
readonly environmentPortalBytes: number;
|
|
289
332
|
readonly configBytes: number;
|
|
290
333
|
readonly counterBytes: number;
|
|
291
334
|
readonly totalHotBufferBytes: number;
|
|
@@ -295,6 +338,8 @@ export interface CreateWavefrontPathTracingComputeRendererOptions {
|
|
|
295
338
|
readonly canvas?: HTMLCanvasElement | string;
|
|
296
339
|
readonly navigator?: Navigator | { gpu?: GPU };
|
|
297
340
|
readonly document?: Document;
|
|
341
|
+
readonly deviceDescriptor?: GPUDeviceDescriptor;
|
|
342
|
+
readonly requiredLimits?: Partial<Record<string, number>>;
|
|
298
343
|
readonly powerPreference?: GPUPowerPreference;
|
|
299
344
|
readonly alpha?: boolean;
|
|
300
345
|
readonly format?: GPUTextureFormat;
|
|
@@ -312,6 +357,11 @@ export interface CreateWavefrontPathTracingComputeRendererOptions {
|
|
|
312
357
|
readonly bvhNodeCapacity?: number;
|
|
313
358
|
readonly bvhLeafSortCapacity?: number;
|
|
314
359
|
readonly emissiveTriangleCapacity?: number;
|
|
360
|
+
readonly environmentPortalCapacity?: number;
|
|
361
|
+
readonly environmentPortals?: readonly WavefrontEnvironmentPortalInput[];
|
|
362
|
+
readonly environmentLightPortals?: readonly WavefrontEnvironmentPortalInput[];
|
|
363
|
+
readonly environmentPortalMode?: WavefrontEnvironmentPortalMode;
|
|
364
|
+
readonly portalMode?: WavefrontEnvironmentPortalMode;
|
|
315
365
|
readonly accelerationBuildMode?: WavefrontAccelerationBuildMode;
|
|
316
366
|
readonly camera?: WavefrontCameraOptions;
|
|
317
367
|
readonly environmentColor?: readonly [number, number, number, number?] | readonly number[];
|
|
@@ -341,10 +391,17 @@ export interface WavefrontPathTracingComputeRenderer {
|
|
|
341
391
|
sceneObjectCount: number;
|
|
342
392
|
triangleCount: number;
|
|
343
393
|
emissiveTriangleCount: number;
|
|
394
|
+
environmentPortalCount: number;
|
|
395
|
+
environmentPortalMode: 0 | 1 | 2;
|
|
344
396
|
bvhNodeCount: number;
|
|
345
397
|
displayQuality: boolean;
|
|
346
398
|
accelerationBuildMode: WavefrontAccelerationBuildMode;
|
|
347
399
|
gpuAccelerationBuildRequired: boolean;
|
|
400
|
+
accelerationBuildSubmitted: boolean;
|
|
401
|
+
accelerationBuilt: boolean;
|
|
402
|
+
accelerationBuildCount: number;
|
|
403
|
+
commandSubmissions: number;
|
|
404
|
+
frameConfigSlots: number;
|
|
348
405
|
memory: WavefrontPathTracingMemoryEstimate;
|
|
349
406
|
}>;
|
|
350
407
|
readOutputProbe(options?: { x?: number; y?: number }): Promise<
|
|
@@ -367,10 +424,15 @@ export interface WavefrontPathTracingComputeRenderer {
|
|
|
367
424
|
sceneObjectCount: number;
|
|
368
425
|
triangleCount: number;
|
|
369
426
|
emissiveTriangleCount: number;
|
|
427
|
+
environmentPortalCount: number;
|
|
428
|
+
environmentPortalMode: 0 | 1 | 2;
|
|
370
429
|
bvhNodeCount: number;
|
|
371
430
|
displayQuality: boolean;
|
|
372
431
|
accelerationBuildMode: WavefrontAccelerationBuildMode;
|
|
373
432
|
gpuAccelerationBuildRequired: boolean;
|
|
433
|
+
accelerationBuilt: boolean;
|
|
434
|
+
accelerationBuildCount: number;
|
|
435
|
+
frameConfigSlots: number;
|
|
374
436
|
memory: WavefrontPathTracingMemoryEstimate;
|
|
375
437
|
}>;
|
|
376
438
|
destroy(): void;
|
|
@@ -465,13 +527,16 @@ export function createWavefrontPathTracingComputeRenderer(
|
|
|
465
527
|
export const wavefrontPathTracingComputeLimits: Readonly<{
|
|
466
528
|
workgroupSize: 64;
|
|
467
529
|
rayRecordBytes: 80;
|
|
468
|
-
hitRecordBytes:
|
|
530
|
+
hitRecordBytes: 208;
|
|
469
531
|
sceneObjectRecordBytes: 96;
|
|
470
532
|
meshVertexRecordBytes: 48;
|
|
471
533
|
meshRangeRecordBytes: 96;
|
|
472
534
|
triangleRecordBytes: 208;
|
|
473
535
|
bvhNodeRecordBytes: 48;
|
|
474
536
|
bvhLeafReferenceRecordBytes: 16;
|
|
537
|
+
emissiveTriangleIndexBytes: 4;
|
|
538
|
+
emissiveTriangleMetadataRecordBytes: 48;
|
|
539
|
+
environmentPortalRecordBytes: 96;
|
|
475
540
|
accumulationRecordBytes: 16;
|
|
476
541
|
}>;
|
|
477
542
|
export const wavefrontSceneObjectKinds: Readonly<{
|