@hology/webgpu-renderer 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +61 -5
- package/dist/index.js +1 -1
- package/package.json +42 -42
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as three from 'three';
|
|
2
|
-
import { Color, Vector2, Vector3, Vector4, Matrix3, Matrix4, Material, Texture, MaterialParameters, DirectionalLight, Object3D, PerspectiveCamera, OrthographicCamera, Scene } from 'three';
|
|
2
|
+
import { Color, Vector2, Vector3, Vector4, Matrix3, Matrix4, Material, Texture, MaterialParameters, DirectionalLight, PointLight, SpotLight, Object3D, PerspectiveCamera, OrthographicCamera, BufferGeometry, Scene } from 'three';
|
|
3
3
|
export { AmbientLight, BackSide, BatchedMesh, Bone, BoxGeometry, BufferAttribute, BufferGeometry, CanvasTexture, Color, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedArrayTexture as CompressedTextureArray, CubeTexture, Data3DTexture, DataArrayTexture, DataTexture, DepthTexture, DirectionalLight, DoubleSide, FrontSide, Group, HemisphereLight, InstancedMesh, MathUtils, Matrix4, Mesh, Object3D, OrthographicCamera, PerspectiveCamera, PlaneGeometry, PointLight, RepeatWrapping, Scene, Skeleton, SkinnedMesh, SphereGeometry, SpotLight, Texture, Vector2, Vector3, Vector4 } from 'three';
|
|
4
4
|
|
|
5
5
|
interface ComputeKernelDescriptor {
|
|
@@ -137,6 +137,8 @@ declare class WGSLShaderMaterial extends Material {
|
|
|
137
137
|
customProgramCacheKey(): string;
|
|
138
138
|
getTexturesList(): readonly Texture[];
|
|
139
139
|
usesSceneTextures(): boolean;
|
|
140
|
+
usesSceneColor(): boolean;
|
|
141
|
+
usesSceneDepth(): boolean;
|
|
140
142
|
getGraphTextureInputs(): Record<string, WGSLGraphTextureInput>;
|
|
141
143
|
requiresLatePass(): boolean;
|
|
142
144
|
getUniformValueHash(): number;
|
|
@@ -177,6 +179,9 @@ declare class RenderGraph {
|
|
|
177
179
|
private resolveExecutionOrder;
|
|
178
180
|
}
|
|
179
181
|
|
|
182
|
+
/** Shared renderer lighting ABI for procedural particle geometry. */
|
|
183
|
+
declare function buildParticleLightingShaderHeader(receiveShadow?: boolean, modelMatrixBody?: string): string;
|
|
184
|
+
|
|
180
185
|
interface TextureResource {
|
|
181
186
|
version: number;
|
|
182
187
|
width: number;
|
|
@@ -230,10 +235,12 @@ interface ExtractedDirectionalLight {
|
|
|
230
235
|
shadowCameraFar: number;
|
|
231
236
|
}
|
|
232
237
|
interface ExtractedPointLight {
|
|
238
|
+
sourceLight: PointLight;
|
|
233
239
|
position: Vector3;
|
|
234
240
|
color: Vector3;
|
|
235
241
|
intensity: number;
|
|
236
242
|
volumetricIntensity: number;
|
|
243
|
+
distance: number;
|
|
237
244
|
range: number;
|
|
238
245
|
decay: number;
|
|
239
246
|
castShadow: boolean;
|
|
@@ -246,6 +253,7 @@ interface ExtractedPointLight {
|
|
|
246
253
|
shadowCameraFar: number;
|
|
247
254
|
}
|
|
248
255
|
interface ExtractedSpotLight {
|
|
256
|
+
sourceLight: SpotLight;
|
|
249
257
|
position: Vector3;
|
|
250
258
|
direction: Vector3;
|
|
251
259
|
color: Vector3;
|
|
@@ -308,6 +316,12 @@ interface RendererOptions {
|
|
|
308
316
|
interface StaticDrawSetOptions {
|
|
309
317
|
label?: string;
|
|
310
318
|
onUnsupported?: "throw" | "skip";
|
|
319
|
+
/**
|
|
320
|
+
* Admit transparent and scene-texture materials and render them, in their
|
|
321
|
+
* stable recorded order, during the late pass. No camera-depth sorting is
|
|
322
|
+
* performed inside the set.
|
|
323
|
+
*/
|
|
324
|
+
allowUnsortedLateDraws?: boolean;
|
|
311
325
|
}
|
|
312
326
|
interface StaticDrawSet {
|
|
313
327
|
readonly label: string;
|
|
@@ -337,7 +351,10 @@ interface RendererGraphBuilderContext {
|
|
|
337
351
|
defineTextureTarget(name: string, descriptor?: RendererTextureTargetDescriptor): void;
|
|
338
352
|
addForwardPass(output?: string): void;
|
|
339
353
|
addOpaquePass(output?: string): void;
|
|
340
|
-
addSceneTextureCopyPass(source?: string
|
|
354
|
+
addSceneTextureCopyPass(source?: string, requirements?: {
|
|
355
|
+
readonly sceneColor?: boolean;
|
|
356
|
+
readonly sceneDepth?: boolean;
|
|
357
|
+
}): void;
|
|
341
358
|
addLatePass(output?: string): void;
|
|
342
359
|
addHiZHistoryPass(dependsOn?: string): void;
|
|
343
360
|
addMaterialPass(descriptor?: RendererMaterialPassDescriptor): void;
|
|
@@ -363,6 +380,8 @@ interface RendererMaterialPassDescriptor {
|
|
|
363
380
|
readonly drawStage?: "all" | "opaque" | "late";
|
|
364
381
|
/** Preserve existing attachment contents instead of clearing them. */
|
|
365
382
|
readonly loadColor?: boolean;
|
|
383
|
+
/** Color used when clearing the attachments. Defaults to the renderer clear color. */
|
|
384
|
+
readonly clearColor?: readonly [number, number, number, number];
|
|
366
385
|
/** Preserve depth written by an earlier pass. Defaults to clear. */
|
|
367
386
|
readonly loadDepth?: boolean;
|
|
368
387
|
/** Draw only objects accepted by this predicate. Intended for selection/mask passes. */
|
|
@@ -405,13 +424,18 @@ interface RendererCustomPassContext {
|
|
|
405
424
|
view: GPUTextureView;
|
|
406
425
|
sampler: GPUSampler;
|
|
407
426
|
};
|
|
427
|
+
/** Resolves the current renderer-owned vertex buffer for a geometry. */
|
|
428
|
+
getGeometryVertexBuffer(geometry: BufferGeometry, attribute: "position" | "normal"): GPUBuffer;
|
|
408
429
|
getColorFormat(name: string): GPUTextureFormat;
|
|
409
430
|
getShadowMapDebugInfo(): RendererShadowMapDebugInfo;
|
|
410
431
|
/** Shared light uniforms and shadow arrays used by the forward renderer. */
|
|
411
432
|
getSceneLightingResources(): RendererSceneLightingResources;
|
|
412
433
|
}
|
|
413
434
|
interface RendererSceneLightingResources {
|
|
435
|
+
readonly cameraBuffer: GPUBuffer;
|
|
414
436
|
readonly lightBuffer: GPUBuffer;
|
|
437
|
+
readonly shadowSampler: GPUSampler;
|
|
438
|
+
readonly linearSampler: GPUSampler;
|
|
415
439
|
readonly directionalShadowView: GPUTextureView;
|
|
416
440
|
readonly pointShadowView: GPUTextureView;
|
|
417
441
|
readonly spotShadowView: GPUTextureView;
|
|
@@ -507,6 +531,7 @@ interface FrameGraphMaterialPassDescriptor {
|
|
|
507
531
|
readonly outputs?: FrameGraphTextureHandle | readonly FrameGraphTextureHandle[];
|
|
508
532
|
readonly drawStage?: "all" | "opaque" | "late";
|
|
509
533
|
readonly loadColor?: boolean;
|
|
534
|
+
readonly clearColor?: readonly [number, number, number, number];
|
|
510
535
|
readonly loadDepth?: boolean;
|
|
511
536
|
readonly objectFilter?: (object: Object3D | null) => boolean;
|
|
512
537
|
readonly overrideMaterial?: WGSLShaderMaterial | ((source: WGSLShaderMaterial, skinned: boolean) => WGSLShaderMaterial);
|
|
@@ -528,7 +553,10 @@ declare class FrameGraphBuilder {
|
|
|
528
553
|
addVisibilityPass(): void;
|
|
529
554
|
addForwardPass(output?: FrameGraphTextureHandle): void;
|
|
530
555
|
addOpaquePass(output?: FrameGraphTextureHandle): void;
|
|
531
|
-
addSceneTextureCopyPass(source?: FrameGraphTextureHandle
|
|
556
|
+
addSceneTextureCopyPass(source?: FrameGraphTextureHandle, requirements?: {
|
|
557
|
+
readonly sceneColor?: boolean;
|
|
558
|
+
readonly sceneDepth?: boolean;
|
|
559
|
+
}): void;
|
|
532
560
|
addLatePass(output?: FrameGraphTextureHandle): void;
|
|
533
561
|
addHiZHistoryPass(dependsOn?: string): void;
|
|
534
562
|
addMaterialPass(descriptor?: FrameGraphMaterialPassDescriptor): void;
|
|
@@ -648,6 +676,22 @@ declare class VolumetricFogEffect {
|
|
|
648
676
|
private readonly uniformIntegers;
|
|
649
677
|
private readonly volumeData;
|
|
650
678
|
private readonly lightData;
|
|
679
|
+
private readonly selectedPointIndices;
|
|
680
|
+
private readonly selectedPointScores;
|
|
681
|
+
private readonly selectedSpotIndices;
|
|
682
|
+
private readonly selectedSpotScores;
|
|
683
|
+
private readonly collectedVolumes;
|
|
684
|
+
private readonly collectedDirectionals;
|
|
685
|
+
private readonly collectedPoints;
|
|
686
|
+
private readonly collectedSpots;
|
|
687
|
+
private volumeCount;
|
|
688
|
+
private directionalCount;
|
|
689
|
+
private pointCount;
|
|
690
|
+
private spotCount;
|
|
691
|
+
private collectionCamera;
|
|
692
|
+
private readonly collectVolumeObject;
|
|
693
|
+
private readonly collectLightObject;
|
|
694
|
+
private readonly executeFroxelPass;
|
|
651
695
|
private readonly projectionInverse;
|
|
652
696
|
private readonly viewProjectionInverse;
|
|
653
697
|
private readonly previousTemporalViewProjection;
|
|
@@ -679,8 +723,9 @@ declare class VolumetricFogEffect {
|
|
|
679
723
|
dispose(): void;
|
|
680
724
|
private executeFroxels;
|
|
681
725
|
private collectSceneData;
|
|
726
|
+
/** Selects the nearest local lights without depending on camera rotation. */
|
|
727
|
+
private selectClosestLights;
|
|
682
728
|
private writeVolume;
|
|
683
|
-
private lightColor;
|
|
684
729
|
private writeDirectional;
|
|
685
730
|
private writeExtractedDirectional;
|
|
686
731
|
private writePoint;
|
|
@@ -828,6 +873,8 @@ declare class WebGpuRenderer {
|
|
|
828
873
|
private readonly standardVertexAttributeCache;
|
|
829
874
|
private readonly geometryVertexBufferFastCache;
|
|
830
875
|
private readonly vertexAttributeGroupCache;
|
|
876
|
+
private readonly materialVertexAttributeCache;
|
|
877
|
+
private readonly vertexBufferBindingPlanCache;
|
|
831
878
|
private readonly vertexAttributeGroupBufferKeyCache;
|
|
832
879
|
private readonly compileDrawScratch;
|
|
833
880
|
private readonly dynamicIndirectSubmissionCache;
|
|
@@ -911,6 +958,7 @@ declare class WebGpuRenderer {
|
|
|
911
958
|
private hasRenderCallbacks;
|
|
912
959
|
initialize(): Promise<void>;
|
|
913
960
|
createComputeKernel(descriptor: ComputeKernelDescriptor): ComputeKernel;
|
|
961
|
+
getDevice(): GPUDevice | null;
|
|
914
962
|
setRenderGraphBuilder(builder: RendererGraphBuilder): void;
|
|
915
963
|
/**
|
|
916
964
|
* Associates the first directional shadow layers with cascaded-shadow-map
|
|
@@ -1083,6 +1131,8 @@ declare class WebGpuRenderer {
|
|
|
1083
1131
|
private clearSpotShadow;
|
|
1084
1132
|
private drawDepthLike;
|
|
1085
1133
|
private getGeometryResource;
|
|
1134
|
+
/** Upload changed standard BufferAttributes without replacing their buffers. */
|
|
1135
|
+
private updateDynamicGeometryAttributes;
|
|
1086
1136
|
private getSkinnedGeometryResource;
|
|
1087
1137
|
private getSkinningPalette;
|
|
1088
1138
|
private refreshSkinningPalette;
|
|
@@ -1107,6 +1157,8 @@ declare class WebGpuRenderer {
|
|
|
1107
1157
|
private getInterleavedGeometryVertexBuffer;
|
|
1108
1158
|
private ensureWireframeIndex;
|
|
1109
1159
|
private bindGeometryVertexBuffers;
|
|
1160
|
+
private getStandardVertexAttribute;
|
|
1161
|
+
private prepareDrawGeometryVertexBuffers;
|
|
1110
1162
|
private getDefaultInstanceAttributeBuffer;
|
|
1111
1163
|
private getMeshExtractionCacheEntry;
|
|
1112
1164
|
private getInstancedMeshExtractionCacheEntry;
|
|
@@ -1572,6 +1624,8 @@ interface OutlineOptions {
|
|
|
1572
1624
|
readonly edgeStrength?: number;
|
|
1573
1625
|
/** Outline radius in physical render pixels. */
|
|
1574
1626
|
readonly edgeThickness?: number;
|
|
1627
|
+
/** Width of the outline's antialiased falloff in physical render pixels. */
|
|
1628
|
+
readonly edgeSoftness?: number;
|
|
1575
1629
|
readonly targetPrefix?: string;
|
|
1576
1630
|
}
|
|
1577
1631
|
interface OutlineInputs {
|
|
@@ -1593,6 +1647,7 @@ declare class OutlineEffect {
|
|
|
1593
1647
|
visibleEdgeColor: [number, number, number];
|
|
1594
1648
|
edgeStrength: number;
|
|
1595
1649
|
edgeThickness: number;
|
|
1650
|
+
edgeSoftness: number;
|
|
1596
1651
|
readonly selectedObjects: Set<Object3D<three.Object3DEventMap>>;
|
|
1597
1652
|
readonly selectedInstances: OutlineInstanceSelection[];
|
|
1598
1653
|
private readonly targetPrefix;
|
|
@@ -1604,7 +1659,8 @@ declare class OutlineEffect {
|
|
|
1604
1659
|
setSelectedObjects(objects: Iterable<Object3D>): void;
|
|
1605
1660
|
setSelectedInstances(selections: Iterable<OutlineInstanceSelection>): void;
|
|
1606
1661
|
addPass(graph: FrameGraphBuilder, source: FrameGraphTextureHandle): FrameGraphTextureHandle;
|
|
1662
|
+
private addCachedPass;
|
|
1607
1663
|
dispose(): void;
|
|
1608
1664
|
}
|
|
1609
1665
|
|
|
1610
|
-
export { type BloomCompositeOptions, BloomEffect, type BloomOptions, ColorGradingEffect, type ColorGradingOptions, type ColorGradingRange, type ColorGradingVector, type CompiledNodeFullscreenShader, ComputeKernel, type ComputeKernelDescriptor, DEFAULT_WGSL_VERTEX_ATTRIBUTES, DepthOfFieldEffect, type DepthOfFieldOptions, type FXAACompositeOptions, FXAAEffect, type FXAAOptions, FrameGraphBuilder, type FrameGraphFullscreenPassDescriptor, type FrameGraphMaterialPassDescriptor, type FrameGraphNodeFullscreenPassDescriptor, type FrameGraphPassDescriptor, type FrameGraphTextureHandle, type GTAOCompositeOptions, type GTAODenoiseOptions, GTAOEffect, type GTAOInputs, type GTAOOptions, type GTAOQuality, type GTAOTemporalOptions, GTAO_PRESETS, MOTION_BLUR_PRESETS, MotionBlurEffect, MotionBlurMode, type MotionBlurOptions, type MotionBlurOverride, type MotionBlurOverrideHandle, type MotionBlurQuality, OutlineEffect, type OutlineInputs, type OutlineInstanceSelection, type OutlineOptions, RenderGraph, type RenderGraphContext, type RenderGraphExecutionObserver, type RenderGraphPass, type RendererColorTargetDescriptor, type RendererCustomPassContext, type RendererCustomPassDescriptor, type RendererFrameProfile, type RendererGraphBuilder, type RendererGraphBuilderContext, type RendererMaterialPassDescriptor, type RendererMaterialResolver, type RendererOptions, type RendererPassProfile, type RendererShadowMapDebugInfo, type RendererShadowMapDebugTextureInfo, type RendererTextureTargetDescriptor, type RendererVisibilityProfile, type SMAACompositeOptions, type SMAAEdgeDetectionMode, SMAAEffect, type SMAAOptions, type SMAAQualityPreset, SSREffect, type SSRInputs, type SSROptions, type ShaderDefineValue, type ShaderDefines, type StaticDrawSet, type StaticDrawSetOptions, TemporalAAEffect, type TemporalAAOptions, type ToneMappingMode, type ToonOutlineParameters, type UniformDefinition, type UniformType, type UniformValue, VOLUMETRIC_FOG_MATERIAL_WGSL, VOLUMETRIC_FOG_PRESETS, type VolumetricFogBlurOptions, VolumetricFogEffect, type VolumetricFogInputs, type VolumetricFogOptions, type VolumetricFogQuality, type VolumetricFogScatteringMode, type VolumetricFogTemporalOptions, VolumetricFogVolumeObject, type VolumetricFogVolumeSettings, type WGSLGraphTextureDimension, type WGSLGraphTextureInput, type WGSLSceneTextureSemantic, WGSLShaderMaterial, type WGSLShaderMaterialParameters, type WGSLShaderMaterialUniform, type WGSLShaderMaterialUniformInput, type WGSLStorageBufferBinding, type WGSLStorageBufferVisibility, type WGSLSupportedVertexFormat, type WGSLVertexAttributeBinding, WebGpuPMREMGenerator, WebGpuRenderer, configureVolumetricFogMaterial };
|
|
1666
|
+
export { type BloomCompositeOptions, BloomEffect, type BloomOptions, ColorGradingEffect, type ColorGradingOptions, type ColorGradingRange, type ColorGradingVector, type CompiledNodeFullscreenShader, ComputeKernel, type ComputeKernelDescriptor, DEFAULT_WGSL_VERTEX_ATTRIBUTES, DepthOfFieldEffect, type DepthOfFieldOptions, type FXAACompositeOptions, FXAAEffect, type FXAAOptions, FrameGraphBuilder, type FrameGraphFullscreenPassDescriptor, type FrameGraphMaterialPassDescriptor, type FrameGraphNodeFullscreenPassDescriptor, type FrameGraphPassDescriptor, type FrameGraphTextureHandle, type GTAOCompositeOptions, type GTAODenoiseOptions, GTAOEffect, type GTAOInputs, type GTAOOptions, type GTAOQuality, type GTAOTemporalOptions, GTAO_PRESETS, MOTION_BLUR_PRESETS, MotionBlurEffect, MotionBlurMode, type MotionBlurOptions, type MotionBlurOverride, type MotionBlurOverrideHandle, type MotionBlurQuality, OutlineEffect, type OutlineInputs, type OutlineInstanceSelection, type OutlineOptions, RenderGraph, type RenderGraphContext, type RenderGraphExecutionObserver, type RenderGraphPass, type RendererColorTargetDescriptor, type RendererCustomPassContext, type RendererCustomPassDescriptor, type RendererFrameProfile, type RendererGraphBuilder, type RendererGraphBuilderContext, type RendererMaterialPassDescriptor, type RendererMaterialResolver, type RendererOptions, type RendererPassProfile, type RendererShadowMapDebugInfo, type RendererShadowMapDebugTextureInfo, type RendererTextureTargetDescriptor, type RendererVisibilityProfile, type SMAACompositeOptions, type SMAAEdgeDetectionMode, SMAAEffect, type SMAAOptions, type SMAAQualityPreset, SSREffect, type SSRInputs, type SSROptions, type ShaderDefineValue, type ShaderDefines, type StaticDrawSet, type StaticDrawSetOptions, TemporalAAEffect, type TemporalAAOptions, type ToneMappingMode, type ToonOutlineParameters, type UniformDefinition, type UniformType, type UniformValue, VOLUMETRIC_FOG_MATERIAL_WGSL, VOLUMETRIC_FOG_PRESETS, type VolumetricFogBlurOptions, VolumetricFogEffect, type VolumetricFogInputs, type VolumetricFogOptions, type VolumetricFogQuality, type VolumetricFogScatteringMode, type VolumetricFogTemporalOptions, VolumetricFogVolumeObject, type VolumetricFogVolumeSettings, type WGSLGraphTextureDimension, type WGSLGraphTextureInput, type WGSLSceneTextureSemantic, WGSLShaderMaterial, type WGSLShaderMaterialParameters, type WGSLShaderMaterialUniform, type WGSLShaderMaterialUniformInput, type WGSLStorageBufferBinding, type WGSLStorageBufferVisibility, type WGSLSupportedVertexFormat, type WGSLVertexAttributeBinding, WebGpuPMREMGenerator, WebGpuRenderer, buildParticleLightingShaderHeader, configureVolumetricFogMaterial };
|