@hology/webgpu-renderer 0.1.4 → 0.1.5
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 +108 -17
- package/dist/index.js +1 -1
- package/package.json +1 -1
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, Object3D, PerspectiveCamera, OrthographicCamera, Scene
|
|
2
|
+
import { Color, Vector2, Vector3, Vector4, Matrix3, Matrix4, Material, Texture, MaterialParameters, DirectionalLight, Object3D, PerspectiveCamera, OrthographicCamera, 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 {
|
|
@@ -177,6 +177,97 @@ declare class RenderGraph {
|
|
|
177
177
|
private resolveExecutionOrder;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
+
interface TextureResource {
|
|
181
|
+
version: number;
|
|
182
|
+
width: number;
|
|
183
|
+
height: number;
|
|
184
|
+
depthOrArrayLayers: number;
|
|
185
|
+
format: GPUTextureFormat;
|
|
186
|
+
textureDimension: GPUTextureDimension;
|
|
187
|
+
viewDimension: GPUTextureViewDimension;
|
|
188
|
+
sampleType: GPUTextureSampleType;
|
|
189
|
+
samplerBindingType: GPUSamplerBindingType;
|
|
190
|
+
mipLevelCount: number;
|
|
191
|
+
texture: GPUTexture;
|
|
192
|
+
view: GPUTextureView;
|
|
193
|
+
sampler: GPUSampler;
|
|
194
|
+
}
|
|
195
|
+
interface ExtractedLightState {
|
|
196
|
+
ambient: Vector4;
|
|
197
|
+
hemisphere: ExtractedHemisphereLight | null;
|
|
198
|
+
directionals: ExtractedDirectionalLight[];
|
|
199
|
+
points: ExtractedPointLight[];
|
|
200
|
+
spots: ExtractedSpotLight[];
|
|
201
|
+
directional: ExtractedDirectionalLight | null;
|
|
202
|
+
point: ExtractedPointLight | null;
|
|
203
|
+
spot: ExtractedSpotLight | null;
|
|
204
|
+
}
|
|
205
|
+
interface ExtractedHemisphereLight {
|
|
206
|
+
direction: Vector3;
|
|
207
|
+
skyColor: Vector3;
|
|
208
|
+
groundColor: Vector3;
|
|
209
|
+
intensity: number;
|
|
210
|
+
}
|
|
211
|
+
interface ExtractedDirectionalLight {
|
|
212
|
+
sourceLight: DirectionalLight | null;
|
|
213
|
+
position: Vector3;
|
|
214
|
+
target: Vector3;
|
|
215
|
+
direction: Vector3;
|
|
216
|
+
color: Vector3;
|
|
217
|
+
intensity: number;
|
|
218
|
+
volumetricIntensity: number;
|
|
219
|
+
castShadow: boolean;
|
|
220
|
+
shadowBias: number;
|
|
221
|
+
shadowNormalBias: number;
|
|
222
|
+
shadowRadius: number;
|
|
223
|
+
shadowIntensity: number;
|
|
224
|
+
shadowMapSize: number;
|
|
225
|
+
shadowCameraLeft: number;
|
|
226
|
+
shadowCameraRight: number;
|
|
227
|
+
shadowCameraTop: number;
|
|
228
|
+
shadowCameraBottom: number;
|
|
229
|
+
shadowCameraNear: number;
|
|
230
|
+
shadowCameraFar: number;
|
|
231
|
+
}
|
|
232
|
+
interface ExtractedPointLight {
|
|
233
|
+
position: Vector3;
|
|
234
|
+
color: Vector3;
|
|
235
|
+
intensity: number;
|
|
236
|
+
volumetricIntensity: number;
|
|
237
|
+
range: number;
|
|
238
|
+
decay: number;
|
|
239
|
+
castShadow: boolean;
|
|
240
|
+
shadowBias: number;
|
|
241
|
+
shadowNormalBias: number;
|
|
242
|
+
shadowRadius: number;
|
|
243
|
+
shadowIntensity: number;
|
|
244
|
+
shadowMapSize: number;
|
|
245
|
+
shadowCameraNear: number;
|
|
246
|
+
shadowCameraFar: number;
|
|
247
|
+
}
|
|
248
|
+
interface ExtractedSpotLight {
|
|
249
|
+
position: Vector3;
|
|
250
|
+
direction: Vector3;
|
|
251
|
+
color: Vector3;
|
|
252
|
+
intensity: number;
|
|
253
|
+
volumetricIntensity: number;
|
|
254
|
+
range: number;
|
|
255
|
+
angle: number;
|
|
256
|
+
penumbra: number;
|
|
257
|
+
decay: number;
|
|
258
|
+
castShadow: boolean;
|
|
259
|
+
shadowBias: number;
|
|
260
|
+
shadowNormalBias: number;
|
|
261
|
+
shadowRadius: number;
|
|
262
|
+
shadowIntensity: number;
|
|
263
|
+
shadowMapSize: number;
|
|
264
|
+
shadowCameraNear: number;
|
|
265
|
+
shadowCameraFar: number;
|
|
266
|
+
shadowCameraFov: number;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/** Camera-visible lights collected during the renderer's scene extraction. */
|
|
270
|
+
type RendererExtractedLightState = ExtractedLightState;
|
|
180
271
|
/**
|
|
181
272
|
* Resolves a scene-authored Three material to a renderer-native WGSL material
|
|
182
273
|
* without mutating the scene's material slots. Return `undefined` to use the
|
|
@@ -231,6 +322,11 @@ interface RendererGraphBuilderContext {
|
|
|
231
322
|
* extraction. Passing this list to volumetric fog avoids another scene walk.
|
|
232
323
|
*/
|
|
233
324
|
readonly fogVolumeObjects: readonly Object3D[];
|
|
325
|
+
/**
|
|
326
|
+
* Camera-visible lights collected during ordinary scene extraction. The
|
|
327
|
+
* ordering matches the renderer's shadow-array layers.
|
|
328
|
+
*/
|
|
329
|
+
readonly extractedLights: RendererExtractedLightState;
|
|
234
330
|
addDirectionalShadowPass(): void;
|
|
235
331
|
addPointShadowPass(): void;
|
|
236
332
|
addSpotShadowPass(): void;
|
|
@@ -512,6 +608,11 @@ interface VolumetricFogInputs {
|
|
|
512
608
|
* list is authoritative and avoids traversing the scene for volumes.
|
|
513
609
|
*/
|
|
514
610
|
readonly volumeObjects?: readonly Object3D[];
|
|
611
|
+
/**
|
|
612
|
+
* Lights already collected by the renderer. When supplied, this list is
|
|
613
|
+
* authoritative and avoids traversing the scene for lights.
|
|
614
|
+
*/
|
|
615
|
+
readonly lights?: RendererExtractedLightState;
|
|
515
616
|
}
|
|
516
617
|
/**
|
|
517
618
|
* Compute-driven froxel fog. Add it after opaque rendering and before the late
|
|
@@ -533,6 +634,7 @@ declare class VolumetricFogEffect {
|
|
|
533
634
|
private readonly viewProjectionInverse;
|
|
534
635
|
private explicitVolumes;
|
|
535
636
|
private volumeObjects;
|
|
637
|
+
private extractedLights;
|
|
536
638
|
private cascadeDirectionalLights;
|
|
537
639
|
private compositePass;
|
|
538
640
|
private readonly blurPassCache;
|
|
@@ -550,8 +652,11 @@ declare class VolumetricFogEffect {
|
|
|
550
652
|
private writeVolume;
|
|
551
653
|
private lightColor;
|
|
552
654
|
private writeDirectional;
|
|
655
|
+
private writeExtractedDirectional;
|
|
553
656
|
private writePoint;
|
|
657
|
+
private writeExtractedPoint;
|
|
554
658
|
private writeSpot;
|
|
659
|
+
private writeExtractedSpot;
|
|
555
660
|
private getResources;
|
|
556
661
|
}
|
|
557
662
|
/** WGSL appended to a material that calls rendererApplyVolumetricFog(). */
|
|
@@ -559,22 +664,6 @@ declare const VOLUMETRIC_FOG_MATERIAL_WGSL = "\nfn rendererSampleIntegratedFog(u
|
|
|
559
664
|
/** Adds the froxel input; append VOLUMETRIC_FOG_MATERIAL_WGSL and call its helper in fsMain. */
|
|
560
665
|
declare function configureVolumetricFogMaterial(material: WGSLShaderMaterial, resource?: string, boundsResource?: string): WGSLShaderMaterial;
|
|
561
666
|
|
|
562
|
-
interface TextureResource {
|
|
563
|
-
version: number;
|
|
564
|
-
width: number;
|
|
565
|
-
height: number;
|
|
566
|
-
depthOrArrayLayers: number;
|
|
567
|
-
format: GPUTextureFormat;
|
|
568
|
-
textureDimension: GPUTextureDimension;
|
|
569
|
-
viewDimension: GPUTextureViewDimension;
|
|
570
|
-
sampleType: GPUTextureSampleType;
|
|
571
|
-
samplerBindingType: GPUSamplerBindingType;
|
|
572
|
-
mipLevelCount: number;
|
|
573
|
-
texture: GPUTexture;
|
|
574
|
-
view: GPUTextureView;
|
|
575
|
-
sampler: GPUSampler;
|
|
576
|
-
}
|
|
577
|
-
|
|
578
667
|
interface WebGpuPMREMGeneratorContext {
|
|
579
668
|
device: GPUDevice;
|
|
580
669
|
getTextureResource(texture: Texture): TextureResource;
|
|
@@ -719,6 +808,7 @@ declare class WebGpuRenderer {
|
|
|
719
808
|
private readonly colorFormatsValueCache;
|
|
720
809
|
private nextColorFormatsId;
|
|
721
810
|
private readonly renderBundleScratch;
|
|
811
|
+
private readonly indirectMaterialResourcesScratch;
|
|
722
812
|
private readonly directBundleDrawStatsScratch;
|
|
723
813
|
private readonly sortedOpaqueBatchesScratch;
|
|
724
814
|
private readonly opaqueBatchPool;
|
|
@@ -908,6 +998,7 @@ declare class WebGpuRenderer {
|
|
|
908
998
|
private getIndirectStreamKey;
|
|
909
999
|
private getOrCreateStaticIndirectSubmissionStreams;
|
|
910
1000
|
private getOrCreateIndirectForwardBundle;
|
|
1001
|
+
private submitIndirectStreamDirect;
|
|
911
1002
|
private setRetainedIndirectBundleState;
|
|
912
1003
|
private getIndirectBundleHash;
|
|
913
1004
|
private getColorFormatsId;
|