@hology/webgpu-renderer 0.1.22 → 0.1.23
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 +90 -3
- package/dist/index.js +1 -1
- package/package.json +5 -1
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,14 @@ interface ResolvedDetailCulling {
|
|
|
32
32
|
declare function setObjectDetailCulling(object: Object3D, settings: DetailCullingSettings): void;
|
|
33
33
|
declare function resolveDetailCulling(object: Object3D | null, registration?: DetailCullingSettings): ResolvedDetailCulling;
|
|
34
34
|
|
|
35
|
+
interface StaticSpatialObject {
|
|
36
|
+
/** Refresh after geometry, inherited transforms, or detail policy changes. */
|
|
37
|
+
update(): void;
|
|
38
|
+
/** Edited objects temporarily return to ordinary scene traversal. */
|
|
39
|
+
setEditing(editing: boolean): void;
|
|
40
|
+
dispose(): void;
|
|
41
|
+
}
|
|
42
|
+
|
|
35
43
|
type ShaderDefineValue = string | number | boolean;
|
|
36
44
|
type ShaderDefines = Record<string, ShaderDefineValue | null | undefined>;
|
|
37
45
|
|
|
@@ -347,6 +355,34 @@ interface RendererMaterialPassDescriptor {
|
|
|
347
355
|
/** Replace each accepted draw's material while preserving its geometry and instance data. */
|
|
348
356
|
readonly overrideMaterial?: WGSLShaderMaterial | ((source: WGSLShaderMaterial, skinned: boolean) => WGSLShaderMaterial);
|
|
349
357
|
}
|
|
358
|
+
interface RendererSceneCaptureOptions {
|
|
359
|
+
/** Exclude objects/subtrees. Static snapshots without a source object pass null. */
|
|
360
|
+
readonly objectFilter?: (object: Object3D | null) => boolean;
|
|
361
|
+
readonly clearColor?: readonly [number, number, number, number];
|
|
362
|
+
/** Defaults to true. Disable point and spot lights for a consistent map view. */
|
|
363
|
+
readonly includeLocalLights?: boolean;
|
|
364
|
+
/** Optional final pass. Must write display-sRGB color into targetView. */
|
|
365
|
+
readonly postProcess?: (context: RendererSceneCapturePostProcessContext) => void;
|
|
366
|
+
}
|
|
367
|
+
interface RendererSceneCapturePostProcessContext {
|
|
368
|
+
readonly device: GPUDevice;
|
|
369
|
+
readonly encoder: GPUCommandEncoder;
|
|
370
|
+
readonly colorView: GPUTextureView;
|
|
371
|
+
readonly depthView: GPUTextureView;
|
|
372
|
+
readonly sampler: GPUSampler;
|
|
373
|
+
readonly targetView: GPUTextureView;
|
|
374
|
+
readonly targetFormat: GPUTextureFormat;
|
|
375
|
+
readonly width: number;
|
|
376
|
+
readonly height: number;
|
|
377
|
+
readonly camera: PerspectiveCamera | OrthographicCamera;
|
|
378
|
+
}
|
|
379
|
+
/** Non-temporal, unshadowed scene view sharing the renderer's GPU resources. */
|
|
380
|
+
interface RendererSceneCapture {
|
|
381
|
+
/** Persistent display-space output when created without a canvas. Owned by the capture. */
|
|
382
|
+
readonly textureView?: GPUTextureView;
|
|
383
|
+
capture(scene: three.Scene, camera: PerspectiveCamera | OrthographicCamera, options?: RendererSceneCaptureOptions): void;
|
|
384
|
+
dispose(): void;
|
|
385
|
+
}
|
|
350
386
|
interface RendererShadowMapDebugTextureInfo {
|
|
351
387
|
readonly view: GPUTextureView | null;
|
|
352
388
|
readonly size: number;
|
|
@@ -437,6 +473,12 @@ interface RendererFrameProfile {
|
|
|
437
473
|
gpuIndirectDraws?: number;
|
|
438
474
|
};
|
|
439
475
|
frameIndex: number;
|
|
476
|
+
/** Internal scene attachment dimensions in physical pixels. */
|
|
477
|
+
renderWidth?: number;
|
|
478
|
+
renderHeight?: number;
|
|
479
|
+
/** Presentation dimensions before any internal resolution scaling. */
|
|
480
|
+
presentationWidth?: number;
|
|
481
|
+
presentationHeight?: number;
|
|
440
482
|
cpuTimeMs: number;
|
|
441
483
|
gpuTimeMs: number | null;
|
|
442
484
|
drawCallCount: number;
|
|
@@ -919,11 +961,14 @@ declare class WebGpuRenderer {
|
|
|
919
961
|
private sampleCount;
|
|
920
962
|
private renderScale;
|
|
921
963
|
private hiZOcclusionCullingEnabled;
|
|
964
|
+
private frameHiZOcclusionCullingNeeded;
|
|
922
965
|
private multiDrawIndirectEnabled;
|
|
923
966
|
private dynamicBatchingEnabled;
|
|
924
967
|
private multiDrawIndirectSupported;
|
|
925
968
|
private tiledPointLights;
|
|
926
969
|
private tiledLightingEnabled;
|
|
970
|
+
private readonly transientPointLightsScratch;
|
|
971
|
+
private readonly transientPointScoresScratch;
|
|
927
972
|
private renderGraphProfilingEnabled;
|
|
928
973
|
private indirectFirstInstanceSupported;
|
|
929
974
|
private timestampQuerySupported;
|
|
@@ -988,7 +1033,7 @@ declare class WebGpuRenderer {
|
|
|
988
1033
|
* `instance_index`. Keep shared default buffers large enough for the packed
|
|
989
1034
|
* renderer instance range instead of binding one value at index zero.
|
|
990
1035
|
*/
|
|
991
|
-
private readonly
|
|
1036
|
+
private readonly defaultVertexAttributeBuffers;
|
|
992
1037
|
private readonly textureManager;
|
|
993
1038
|
private readonly renderGraph;
|
|
994
1039
|
private readonly nativePostSubmit;
|
|
@@ -1018,6 +1063,7 @@ declare class WebGpuRenderer {
|
|
|
1018
1063
|
private readonly geometryVertexBufferFastCache;
|
|
1019
1064
|
private readonly vertexAttributeGroupCache;
|
|
1020
1065
|
private readonly materialVertexAttributeCache;
|
|
1066
|
+
private readonly sharedVertexAttributeLayouts;
|
|
1021
1067
|
private readonly vertexBufferBindingPlanCache;
|
|
1022
1068
|
private readonly preparedVertexBufferCache;
|
|
1023
1069
|
private readonly vertexAttributeGroupBufferKeyCache;
|
|
@@ -1094,6 +1140,23 @@ declare class WebGpuRenderer {
|
|
|
1094
1140
|
private readonly objectMotionHistory;
|
|
1095
1141
|
private readonly cameraFrustumPlanesScratch;
|
|
1096
1142
|
private readonly objectTraversalStackScratch;
|
|
1143
|
+
private readonly staticSceneSpatialIndex;
|
|
1144
|
+
private readonly staticMeshDraws;
|
|
1145
|
+
private readonly spatialShadowPlanes;
|
|
1146
|
+
private spatialShadowCount;
|
|
1147
|
+
private readonly spatialLocalShadowSpheres;
|
|
1148
|
+
private spatialLocalShadowCount;
|
|
1149
|
+
private readonly spatialShadowMatrix;
|
|
1150
|
+
private spatialIncludeOffscreen;
|
|
1151
|
+
private spatialCameraLayers;
|
|
1152
|
+
private readonly testSpatialCamera;
|
|
1153
|
+
private readonly testSpatialScene;
|
|
1154
|
+
private readonly filterSpatialCaptureObject;
|
|
1155
|
+
private readonly pushSpatialRoot;
|
|
1156
|
+
private readonly collectSpatialMesh;
|
|
1157
|
+
private readonly isSpatialSphereVisible;
|
|
1158
|
+
private isSpatialShadowSphereVisible;
|
|
1159
|
+
private readonly collectSpatialRoot;
|
|
1097
1160
|
private readonly shadowDrawsScratch;
|
|
1098
1161
|
private extractingCaster;
|
|
1099
1162
|
private readonly cameraDetailHistory;
|
|
@@ -1106,6 +1169,10 @@ declare class WebGpuRenderer {
|
|
|
1106
1169
|
private readonly temporalVisibilityPreviousCameraPosition;
|
|
1107
1170
|
private readonly shadowViewProjScratch;
|
|
1108
1171
|
private extractionVersion;
|
|
1172
|
+
private motionHistoryExtractionVersion;
|
|
1173
|
+
private sceneCaptureOptions;
|
|
1174
|
+
private readonly sceneCaptureDisposers;
|
|
1175
|
+
private readonly captureMotionHistory;
|
|
1109
1176
|
private graphBuilder;
|
|
1110
1177
|
private createExtractedDirectionalLightScratch;
|
|
1111
1178
|
private createExtractedHemisphereLightScratch;
|
|
@@ -1179,6 +1246,11 @@ declare class WebGpuRenderer {
|
|
|
1179
1246
|
setHiZOcclusionCullingEnabled(enabled: boolean): void;
|
|
1180
1247
|
getHiZOcclusionCullingEnabled(): boolean;
|
|
1181
1248
|
getHiZOcclusionCullingActive(): boolean;
|
|
1249
|
+
/** Captures and shadow views must not inherit the primary camera's culling. */
|
|
1250
|
+
private isStaticDrawSetCameraVisible;
|
|
1251
|
+
private getCameraStaticDrawSets;
|
|
1252
|
+
private queryStaticShadowResources;
|
|
1253
|
+
private updateVisibilityWorkload;
|
|
1182
1254
|
setMultiDrawIndirectEnabled(enabled: boolean): void;
|
|
1183
1255
|
getMultiDrawIndirectEnabled(): boolean;
|
|
1184
1256
|
/** Toggle without recompiling materials, for scene-specific GPU comparisons. */
|
|
@@ -1191,6 +1263,12 @@ declare class WebGpuRenderer {
|
|
|
1191
1263
|
setClearColor(color: readonly [number, number, number, number]): void;
|
|
1192
1264
|
render(scene: Scene, camera: PerspectiveCamera | OrthographicCamera, timeSeconds?: number): void;
|
|
1193
1265
|
renderAsync(scene: Scene, camera: PerspectiveCamera | OrthographicCamera, timeSeconds?: number): Promise<void>;
|
|
1266
|
+
/**
|
|
1267
|
+
* Creates an independent canvas or sampleable texture view on the same device.
|
|
1268
|
+
* Call capture between frames, before render(): it reuses extraction scratch and
|
|
1269
|
+
* upload buffers, but never advances gameplay motion/visibility history.
|
|
1270
|
+
*/
|
|
1271
|
+
createSceneCapture(canvas: HTMLCanvasElement | null, width?: number, height?: number): RendererSceneCapture;
|
|
1194
1272
|
compile(scene: Scene, camera: PerspectiveCamera | OrthographicCamera): void;
|
|
1195
1273
|
compileAsync(scene: Scene, camera: PerspectiveCamera | OrthographicCamera): Promise<void>;
|
|
1196
1274
|
/**
|
|
@@ -1208,6 +1286,8 @@ declare class WebGpuRenderer {
|
|
|
1208
1286
|
*/
|
|
1209
1287
|
initTexture(texture: Texture): void;
|
|
1210
1288
|
createStaticDrawSet(root: Object3D, options?: StaticDrawSetOptions): StaticDrawSet;
|
|
1289
|
+
/** Register immutable ordinary meshes without changing their authored parents. */
|
|
1290
|
+
registerStaticSpatialObject(root: Object3D): StaticSpatialObject;
|
|
1211
1291
|
private disposeStaticDrawSetResource;
|
|
1212
1292
|
private renderFrame;
|
|
1213
1293
|
private recordPresentationOverlay;
|
|
@@ -1232,6 +1312,7 @@ declare class WebGpuRenderer {
|
|
|
1232
1312
|
private transparentDraws;
|
|
1233
1313
|
private opaqueBatches;
|
|
1234
1314
|
private acquireDrawCall;
|
|
1315
|
+
private createDrawCall;
|
|
1235
1316
|
private acquireOpaqueBatchBuilder;
|
|
1236
1317
|
private populateDrawCall;
|
|
1237
1318
|
private populateDynamicDrawCall;
|
|
@@ -1241,6 +1322,9 @@ declare class WebGpuRenderer {
|
|
|
1241
1322
|
private getToonOutlineMaterial;
|
|
1242
1323
|
private pushToonOutlineDraw;
|
|
1243
1324
|
private updateTransparentDrawSortDepths;
|
|
1325
|
+
/** Bounded importance selection; stable light IDs break exact ties. */
|
|
1326
|
+
private selectTransientPointLight;
|
|
1327
|
+
private extractPointLight;
|
|
1244
1328
|
private extractScene;
|
|
1245
1329
|
private collectLine;
|
|
1246
1330
|
/**
|
|
@@ -1337,6 +1421,7 @@ declare class WebGpuRenderer {
|
|
|
1337
1421
|
private getGeometryAttributeBufferKey;
|
|
1338
1422
|
private getGeometryAttributeGroupBufferKey;
|
|
1339
1423
|
private getMaterialVertexAttributes;
|
|
1424
|
+
private getSharedVertexAttributeLayout;
|
|
1340
1425
|
private getGeometryVertexBuffer;
|
|
1341
1426
|
private cacheGeometryVertexBufferFast;
|
|
1342
1427
|
private readonly packedVertexGroups;
|
|
@@ -1346,7 +1431,7 @@ declare class WebGpuRenderer {
|
|
|
1346
1431
|
private prepareGeometryVertexBuffers;
|
|
1347
1432
|
private getStandardVertexAttribute;
|
|
1348
1433
|
private prepareDrawGeometryVertexBuffers;
|
|
1349
|
-
private
|
|
1434
|
+
private getDefaultVertexAttributeBuffer;
|
|
1350
1435
|
private getMeshExtractionCacheEntry;
|
|
1351
1436
|
private getInstancedMeshExtractionCacheEntry;
|
|
1352
1437
|
private getBatchedMeshExtractionCacheEntry;
|
|
@@ -1842,6 +1927,8 @@ declare class OutlineEffect {
|
|
|
1842
1927
|
edgeThickness: number;
|
|
1843
1928
|
edgeSoftness: number;
|
|
1844
1929
|
readonly selectedObjects: Set<Object3D<three.Object3DEventMap>>;
|
|
1930
|
+
private readonly selectionMembers;
|
|
1931
|
+
private readonly addSelectionMember;
|
|
1845
1932
|
readonly selectedInstances: OutlineInstanceSelection[];
|
|
1846
1933
|
private readonly targetPrefix;
|
|
1847
1934
|
private readonly maskMaterial;
|
|
@@ -1856,4 +1943,4 @@ declare class OutlineEffect {
|
|
|
1856
1943
|
dispose(): void;
|
|
1857
1944
|
}
|
|
1858
1945
|
|
|
1859
|
-
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 DetailCullingSettings, type DirectionalShadowUpdateOptions, 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, type PipelineDiagnosticOrigin, 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, SCENE_COLOR_FORMAT, 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, createComputePipelineAsync, createRenderPipelineAsync, registerPipelineDiagnosticOrigin, resolveDetailCulling, setObjectDetailCulling, setPipelineDiagnosticLoading };
|
|
1946
|
+
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 DetailCullingSettings, type DirectionalShadowUpdateOptions, 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, type PipelineDiagnosticOrigin, 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 RendererSceneCapture, type RendererSceneCaptureOptions, type RendererSceneCapturePostProcessContext, type RendererShadowMapDebugInfo, type RendererShadowMapDebugTextureInfo, type RendererTextureTargetDescriptor, type RendererVisibilityProfile, SCENE_COLOR_FORMAT, type SMAACompositeOptions, type SMAAEdgeDetectionMode, SMAAEffect, type SMAAOptions, type SMAAQualityPreset, SSREffect, type SSRInputs, type SSROptions, type ShaderDefineValue, type ShaderDefines, type StaticDrawSet, type StaticDrawSetOptions, type StaticSpatialObject, 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, createComputePipelineAsync, createRenderPipelineAsync, registerPipelineDiagnosticOrigin, resolveDetailCulling, setObjectDetailCulling, setPipelineDiagnosticLoading };
|