@haiyue/extensions 0.1.0 → 0.2.0
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 +25 -0
- package/dist/animation/Animation2DComponent.d.ts +18 -0
- package/dist/animation/Animation2DExtensionRegistry.d.ts +7 -0
- package/dist/animation/Animation2DRenderSystem.d.ts +6 -0
- package/dist/animation/Animation2DRuntime.d.ts +6 -2
- package/dist/animation/AnimationTextRasterizer.d.ts +4 -0
- package/dist/animation/AnimationVisual2D.d.ts +58 -2
- package/dist/animation/interaction/InteractionRuntime.d.ts +83 -0
- package/dist/animation/interaction/runtime-types.d.ts +257 -0
- package/dist/animation.d.ts +3 -1
- package/dist/animation.js +551 -59
- package/dist/animation3d.js +1 -1
- package/dist/canvas-text.js +1 -1
- package/dist/chunks/2d-ui-animation-2d.generated-FpziAeGJ.js +4 -0
- package/dist/chunks/2d-ui-indexed-sprite.generated-DmKR0CC3.js +4 -0
- package/dist/chunks/Animation2DStateMachine-BHcA6Cu3.js +18212 -0
- package/dist/chunks/{AnimationStateMachineController-BIcAh-sT.js → AnimationStateMachineController-4sKaqh9E.js} +2 -2
- package/dist/chunks/AnimationVisual2D-8y3qp0_U.js +230 -0
- package/dist/chunks/{RenderSystem2DBase-DDT61dAu.js → RenderSystem2DBase-CF2s00vg.js} +2 -2
- package/dist/controls/VirtualJoystickControls.d.ts +46 -0
- package/dist/controls/contracts.d.ts +91 -0
- package/dist/controls.d.ts +2 -0
- package/dist/controls.js +358 -0
- package/dist/deformable-animation/runtime/DeformableMesh2DRuntimeExtension.d.ts +11 -0
- package/dist/deformable-animation/runtime/DeformableMesh2DSampler.d.ts +11 -0
- package/dist/deformable-animation.d.ts +5 -0
- package/dist/deformable-animation.js +316 -0
- package/dist/experimental-indexed-sprite.d.ts +5 -0
- package/dist/experimental-indexed-sprite.js +482 -0
- package/dist/gltf-worker-runtime.js +9 -9
- package/dist/hya-state-machine.js +3 -2
- package/dist/index.js +1 -1
- package/dist/indexed-sprite/AtlasLayout.d.ts +2 -0
- package/dist/indexed-sprite/IndexedSpriteRenderer.d.ts +23 -0
- package/dist/indexed-sprite/contracts.d.ts +89 -0
- package/dist/internal/2d-ui-shader-artifact.js +232 -23
- package/dist/ray-tracing/acceleration/bvh.d.ts +37 -0
- package/dist/ray-tracing/acceleration/index.d.ts +6 -0
- package/dist/ray-tracing/acceleration/pack.d.ts +152 -0
- package/dist/ray-tracing/acceleration/query.d.ts +4 -0
- package/dist/ray-tracing/acceleration/runtime.d.ts +30 -0
- package/dist/ray-tracing/acceleration/tlas.d.ts +4 -0
- package/dist/ray-tracing/acceleration/types.d.ts +165 -0
- package/dist/ray-tracing/denoise/index.d.ts +3 -0
- package/dist/ray-tracing/denoise/layout.d.ts +9 -0
- package/dist/ray-tracing/denoise/runtime.d.ts +23 -0
- package/dist/ray-tracing/denoise/types.d.ts +28 -0
- package/dist/ray-tracing/hybrid/contract.d.ts +2 -0
- package/dist/ray-tracing/hybrid/index.d.ts +5 -0
- package/dist/ray-tracing/hybrid/layout.d.ts +17 -0
- package/dist/ray-tracing/hybrid/plan.d.ts +2 -0
- package/dist/ray-tracing/hybrid/runtime.d.ts +31 -0
- package/dist/ray-tracing/hybrid/shaders/hybrid-artifact.generated.d.ts +625 -0
- package/dist/ray-tracing/hybrid/types.d.ts +144 -0
- package/dist/ray-tracing/lifecycle/device-recovery.d.ts +31 -0
- package/dist/ray-tracing/lifecycle/index.d.ts +2 -0
- package/dist/ray-tracing/lifecycle/types.d.ts +37 -0
- package/dist/ray-tracing/material/index.d.ts +2 -0
- package/dist/ray-tracing/material/pack.d.ts +5 -0
- package/dist/ray-tracing/material/types.d.ts +63 -0
- package/dist/ray-tracing/reference/index.d.ts +122 -0
- package/dist/ray-tracing/renderer/index.d.ts +7 -0
- package/dist/ray-tracing/renderer/layout.d.ts +20 -0
- package/dist/ray-tracing/renderer/plan.d.ts +2 -0
- package/dist/ray-tracing/renderer/reference.d.ts +17 -0
- package/dist/ray-tracing/renderer/runtime.d.ts +39 -0
- package/dist/ray-tracing/renderer/scene.d.ts +4 -0
- package/dist/ray-tracing/renderer/types.d.ts +115 -0
- package/dist/ray-tracing/sampling/index.d.ts +8 -0
- package/dist/ray-tracing/sampling/layout.d.ts +12 -0
- package/dist/ray-tracing/sampling/plan.d.ts +5 -0
- package/dist/ray-tracing/sampling/revision.d.ts +15 -0
- package/dist/ray-tracing/sampling/runtime.d.ts +44 -0
- package/dist/ray-tracing/sampling/sequence.d.ts +2 -0
- package/dist/ray-tracing/sampling/types.d.ts +96 -0
- package/dist/ray-tracing/scene/index.d.ts +41 -0
- package/dist/ray-tracing/traversal/index.d.ts +4 -0
- package/dist/ray-tracing/traversal/layout.d.ts +16 -0
- package/dist/ray-tracing/traversal/plan.d.ts +2 -0
- package/dist/ray-tracing/traversal/runtime.d.ts +25 -0
- package/dist/ray-tracing/traversal/types.d.ts +79 -0
- package/dist/ray-tracing/worker/client.d.ts +25 -0
- package/dist/ray-tracing/worker/index.d.ts +5 -0
- package/dist/ray-tracing/worker/runtime.d.ts +11 -0
- package/dist/ray-tracing/worker/serialization.d.ts +16 -0
- package/dist/ray-tracing/worker/source.d.ts +1 -0
- package/dist/ray-tracing/worker/types.d.ts +91 -0
- package/dist/ray-tracing.d.ts +17 -0
- package/dist/ray-tracing.js +7666 -0
- package/dist/spine.js +1 -1
- package/dist/tilemap.js +1 -1
- package/package.json +26 -23
- package/dist/animation/Animation2DStateMachineVisualRuntime.d.ts +0 -27
- package/dist/animation/Particle2DDescriptorAdapter.d.ts +0 -5
- package/dist/animation3d/Animation3DResource.d.ts +0 -28
- package/dist/animation3d/hya/HyaAnimation3DStateMachineRuntime.d.ts +0 -65
- package/dist/animation3d/hya/index.d.ts +0 -4
- package/dist/animation3d/runtime/integration/Animation3DStateMachineMixerAdapter.d.ts +0 -81
- package/dist/animation3d/runtime/integration/Animation3DStateMachineMixerIntegration.d.ts +0 -39
- package/dist/animation3d/runtime/integration/index.d.ts +0 -2
- package/dist/animation3d/runtime/mixer/Action.d.ts +0 -150
- package/dist/animation3d/runtime/mixer/Animation3DMixerRuntimeStore.d.ts +0 -6
- package/dist/animation3d/runtime/mixer/Mixer.d.ts +0 -59
- package/dist/animation3d/runtime/mixer/PoseBuffer.d.ts +0 -1
- package/dist/animation3d/runtime/mixer/TrackSampler.d.ts +0 -24
- package/dist/animation3d/runtime/mixer/index.d.ts +0 -4
- package/dist/animation3d/runtime/state-machine/Animation3DBlendTreeWeights.d.ts +0 -1
- package/dist/animation3d/runtime/state-machine/Animation3DStateMachineCompiler.d.ts +0 -1
- package/dist/animation3d/runtime/state-machine/Animation3DStateMachineController.d.ts +0 -1
- package/dist/animation3d/runtime/state-machine/Animation3DStateMachineMixerPort.d.ts +0 -1
- package/dist/animation3d/runtime/state-machine/index.d.ts +0 -6
- package/dist/benchmark.d.ts +0 -30
- package/dist/chunks/2d-ui-animation-2d.generated-D4aHzFU2.js +0 -4
- package/dist/chunks/Animation2DStateMachine-9IonguNa.js +0 -3245
- package/dist/gltf/GltfAccessorReader.d.ts +0 -7
- package/dist/gltf/GltfDracoDecoder.d.ts +0 -4
- package/dist/gltf/GltfLoaderErrors.d.ts +0 -4
- package/dist/gltf/GltfMaterialDescriptor.d.ts +0 -23
- package/dist/gltf/GltfMaterialLoader.d.ts +0 -6
- package/dist/gltf-worker-runtime.d.ts +0 -7
- package/dist/plugins/pluginUtils.d.ts +0 -20
- package/dist/plugins.d.ts +0 -6
- package/dist/shaders/generated/2d-ui-artifact.generated.d.ts +0 -658
- package/dist/spine/Spine2DGpuRenderer.d.ts +0 -65
- package/dist/spine/Spine2DRuntime.d.ts +0 -103
- package/dist/spine/SpineAnimationBoneTimelines.d.ts +0 -8
- package/dist/spine/SpineFloatBuilder.d.ts +0 -15
- package/dist/spine/SpinePathConstraintSolver.d.ts +0 -32
- package/dist/spine/SpineSkeletonRuntime.d.ts +0 -185
- package/dist/spine/SpineSlotAnimation.d.ts +0 -17
- package/dist/spine/SpineTimelineRuntime.d.ts +0 -25
- package/dist/spine/SpineVertexBuilder.d.ts +0 -61
- package/dist/tilemap/Tilemap2DRenderer.d.ts +0 -24
- package/dist/utils/arrayAccess.d.ts +0 -4
- package/dist/utils/camera2d.d.ts +0 -12
- package/src/animation/Animation2DComponent.ts +0 -135
- package/src/animation/Animation2DExtensionRegistry.ts +0 -52
- package/src/animation/Animation2DRenderSystem.ts +0 -1026
- package/src/animation/Animation2DRuntime.ts +0 -1326
- package/src/animation/Animation2DStateMachine.ts +0 -39
- package/src/animation/Animation2DStateMachineComponent.ts +0 -228
- package/src/animation/Animation2DStateMachineRuntime.ts +0 -141
- package/src/animation/Animation2DStateMachineSystem.ts +0 -60
- package/src/animation/Animation2DStateMachineVisualRuntime.ts +0 -282
- package/src/animation/Animation2DSystem.ts +0 -72
- package/src/animation/AnimationAssetLoader.ts +0 -84
- package/src/animation/AnimationAudioClip.ts +0 -140
- package/src/animation/AnimationPathTessellator.ts +0 -691
- package/src/animation/AnimationTextRasterizer.ts +0 -340
- package/src/animation/AnimationVisual2D.ts +0 -153
- package/src/animation/HyaAnimation2DClipAdapter.ts +0 -845
- package/src/animation/Particle2DDescriptorAdapter.ts +0 -35
- package/src/animation/runtime/mixer/Action.ts +0 -876
- package/src/animation/runtime/mixer/Mixer.ts +0 -505
- package/src/animation/runtime/mixer/PoseBuffer.ts +0 -105
- package/src/animation/runtime/mixer/Sampler.ts +0 -252
- package/src/animation/runtime/mixer/Types.ts +0 -138
- package/src/animation/runtime/mixer/index.ts +0 -31
- package/src/animation-state-machine/AnimationStateMachine.ts +0 -146
- package/src/animation-state-machine/AnimationStateMachineChannels.ts +0 -116
- package/src/animation-state-machine/runtime/Animation2DStateMachineMixerAdapter.ts +0 -197
- package/src/animation-state-machine/runtime/AnimationStateMachineBlendTreeWeights.ts +0 -503
- package/src/animation-state-machine/runtime/AnimationStateMachineCompiler.ts +0 -763
- package/src/animation-state-machine/runtime/AnimationStateMachineController.ts +0 -987
- package/src/animation-state-machine/runtime/AnimationStateMachineMixerPort.ts +0 -54
- package/src/animation-state-machine/runtime/index.ts +0 -47
- package/src/animation.ts +0 -33
- package/src/animation3d/Animation3DAction.ts +0 -73
- package/src/animation3d/Animation3DBinding.ts +0 -116
- package/src/animation3d/Animation3DClip.ts +0 -22
- package/src/animation3d/Animation3DError.ts +0 -34
- package/src/animation3d/Animation3DMixer.ts +0 -82
- package/src/animation3d/Animation3DPose.ts +0 -100
- package/src/animation3d/Animation3DPoseBuffer.ts +0 -85
- package/src/animation3d/Animation3DResource.ts +0 -49
- package/src/animation3d/Animation3DStateMachine.ts +0 -126
- package/src/animation3d/Animation3DStateMachineRuntime.ts +0 -191
- package/src/animation3d/Animation3DTrack.ts +0 -29
- package/src/animation3d/hya/HyaAnimation3DRuntime.ts +0 -756
- package/src/animation3d/hya/HyaAnimation3DStateMachineRuntime.ts +0 -618
- package/src/animation3d/hya/HyaAnimation3DTypes.ts +0 -168
- package/src/animation3d/hya/index.ts +0 -10
- package/src/animation3d/index.ts +0 -76
- package/src/animation3d/runtime/integration/Animation3DStateMachineMixerAdapter.ts +0 -325
- package/src/animation3d/runtime/integration/Animation3DStateMachineMixerIntegration.ts +0 -158
- package/src/animation3d/runtime/integration/index.ts +0 -9
- package/src/animation3d/runtime/mixer/Action.ts +0 -833
- package/src/animation3d/runtime/mixer/Animation3DMixerRuntimeStore.ts +0 -26
- package/src/animation3d/runtime/mixer/Mixer.ts +0 -562
- package/src/animation3d/runtime/mixer/PoseBuffer.ts +0 -1
- package/src/animation3d/runtime/mixer/TrackSampler.ts +0 -399
- package/src/animation3d/runtime/mixer/index.ts +0 -8
- package/src/animation3d/runtime/state-machine/Animation3DBlendTreeWeights.ts +0 -4
- package/src/animation3d/runtime/state-machine/Animation3DStateMachineCompiler.ts +0 -1
- package/src/animation3d/runtime/state-machine/Animation3DStateMachineController.ts +0 -1
- package/src/animation3d/runtime/state-machine/Animation3DStateMachineMixerPort.ts +0 -1
- package/src/animation3d/runtime/state-machine/index.ts +0 -45
- package/src/animation3d.ts +0 -5
- package/src/benchmark.ts +0 -168
- package/src/canvas-text/CanvasText2DRenderSystem.ts +0 -292
- package/src/canvas-text/CanvasTextComponent.ts +0 -47
- package/src/canvas-text.ts +0 -4
- package/src/experimental-gltf-worker.ts +0 -18
- package/src/experimental-spine-worker.ts +0 -9
- package/src/gltf/GltfAccessorReader.ts +0 -271
- package/src/gltf/GltfAnimation3DAdapter.ts +0 -680
- package/src/gltf/GltfAnimationRuntime.ts +0 -392
- package/src/gltf/GltfAssetWorkerClient.ts +0 -136
- package/src/gltf/GltfCompatibilityReport.ts +0 -214
- package/src/gltf/GltfConservativeBounds.ts +0 -219
- package/src/gltf/GltfDracoDecoder.ts +0 -251
- package/src/gltf/GltfExtensionAdapter.ts +0 -340
- package/src/gltf/GltfLoaderContract.ts +0 -333
- package/src/gltf/GltfLoaderErrors.ts +0 -59
- package/src/gltf/GltfMaterialDescriptor.ts +0 -134
- package/src/gltf/GltfMaterialEncoder.ts +0 -173
- package/src/gltf/GltfMaterialLoader.ts +0 -293
- package/src/gltf/GltfModelComponent.ts +0 -115
- package/src/gltf/GltfModelSystem.ts +0 -208
- package/src/gltf/GltfPlugin.ts +0 -84
- package/src/gltf/GltfSchema.ts +0 -229
- package/src/gltf/GltfUvSemanticPlanner.ts +0 -166
- package/src/gltf/gltfLoader.ts +0 -910
- package/src/gltf-animation3d.ts +0 -10
- package/src/gltf-worker-runtime.ts +0 -10
- package/src/gltf.ts +0 -56
- package/src/grid/Grid2DComponent.ts +0 -69
- package/src/grid.ts +0 -2
- package/src/hya-state-machine.ts +0 -19
- package/src/index.ts +0 -2
- package/src/plugins/pluginUtils.ts +0 -50
- package/src/plugins.ts +0 -6
- package/src/shaders/generated/2d-ui-animation-2d.generated.wgsl +0 -242
- package/src/shaders/generated/2d-ui-artifact.generated.ts +0 -867
- package/src/shaders/generated/2d-ui-canvas-text-2d.generated.wgsl +0 -38
- package/src/shaders/generated/2d-ui-spine2d.generated.wgsl +0 -41
- package/src/shaders/generated/2d-ui-tilemap2d.generated.wgsl +0 -36
- package/src/spine/Spine2DComponent.ts +0 -168
- package/src/spine/Spine2DGpuRenderer.ts +0 -449
- package/src/spine/Spine2DRenderSystem.ts +0 -199
- package/src/spine/Spine2DRuntime.ts +0 -1529
- package/src/spine/SpineAnimationBoneTimelines.ts +0 -30
- package/src/spine/SpineAssetParser.ts +0 -20
- package/src/spine/SpineAssetWorkerClient.ts +0 -112
- package/src/spine/SpineAssetWorkerContract.ts +0 -4
- package/src/spine/SpineAtlasParser.ts +0 -127
- package/src/spine/SpineFloatBuilder.ts +0 -66
- package/src/spine/SpinePathConstraintSolver.ts +0 -582
- package/src/spine/SpinePlugin.ts +0 -76
- package/src/spine/SpineSkeletonRuntime.ts +0 -521
- package/src/spine/SpineSlotAnimation.ts +0 -195
- package/src/spine/SpineTimelineRuntime.ts +0 -453
- package/src/spine/SpineVertexBuilder.ts +0 -686
- package/src/spine.ts +0 -7
- package/src/tilemap/Tilemap2DComponent.ts +0 -232
- package/src/tilemap/Tilemap2DRenderSystem.ts +0 -58
- package/src/tilemap/Tilemap2DRenderer.ts +0 -289
- package/src/tilemap/TilemapPlugin.ts +0 -75
- package/src/tilemap.ts +0 -6
- package/src/tween/Tween2DComponent.ts +0 -83
- package/src/tween/Tween2DSystem.ts +0 -78
- package/src/tween.ts +0 -4
- package/src/types/earcut.d.ts +0 -7
- package/src/types/wgsl.d.ts +0 -4
- package/src/utils/RenderSystem2DBase.ts +0 -164
- package/src/utils/arrayAccess.ts +0 -17
- package/src/utils/camera2d.ts +0 -68
- package/src/utils/render2dGpu.ts +0 -132
- package/test/fixtures/gltf/animation-characterization.gltf +0 -344
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type { RayPackedAcceleration } from '../acceleration/index.js';
|
|
2
|
+
export type RayHybridEffect = 'shadow' | 'reflection' | 'ao';
|
|
3
|
+
export type RayHybridResolution = 'full' | 'half';
|
|
4
|
+
export type RayHybridDebugView = 'composite' | RayHybridEffect;
|
|
5
|
+
export type RayHybridPhase = 'admission' | 'plan' | 'upload' | 'shadow' | 'reflection' | 'ao' | 'composite' | 'lifecycle';
|
|
6
|
+
export interface RayHybridDiagnostic {
|
|
7
|
+
readonly phase: RayHybridPhase;
|
|
8
|
+
readonly severity: 'info' | 'warning' | 'error';
|
|
9
|
+
readonly code: string;
|
|
10
|
+
readonly message: string;
|
|
11
|
+
readonly context: Readonly<Record<string, string | number | boolean | null>>;
|
|
12
|
+
}
|
|
13
|
+
export interface RayHybridTemporalOptions {
|
|
14
|
+
readonly enabled?: boolean;
|
|
15
|
+
readonly feedback?: number;
|
|
16
|
+
}
|
|
17
|
+
interface BaseEffectOptions {
|
|
18
|
+
readonly enabled?: boolean;
|
|
19
|
+
readonly resolution?: RayHybridResolution;
|
|
20
|
+
readonly raysPerPixel?: 1 | 2 | 4;
|
|
21
|
+
readonly maxRaysPerFrame?: number;
|
|
22
|
+
readonly bias?: number;
|
|
23
|
+
readonly strength?: number;
|
|
24
|
+
readonly temporal?: RayHybridTemporalOptions;
|
|
25
|
+
}
|
|
26
|
+
export interface RayHybridShadowOptions extends BaseEffectOptions {
|
|
27
|
+
readonly maxDistance?: number;
|
|
28
|
+
readonly angularRadius?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface RayHybridReflectionOptions extends BaseEffectOptions {
|
|
31
|
+
readonly maxDistance?: number;
|
|
32
|
+
readonly maxRoughness?: number;
|
|
33
|
+
}
|
|
34
|
+
export interface RayHybridAoOptions extends BaseEffectOptions {
|
|
35
|
+
readonly radius?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface RayHybridOptions {
|
|
38
|
+
readonly shadow?: RayHybridShadowOptions;
|
|
39
|
+
readonly reflection?: RayHybridReflectionOptions;
|
|
40
|
+
readonly ao?: RayHybridAoOptions;
|
|
41
|
+
readonly debugView?: RayHybridDebugView;
|
|
42
|
+
readonly transparentPolicy?: 'skip';
|
|
43
|
+
readonly sceneColorSpace?: 'linear' | 'srgb';
|
|
44
|
+
readonly coexistence?: {
|
|
45
|
+
readonly shadowMap?: 'multiply';
|
|
46
|
+
readonly ssao?: 'multiply';
|
|
47
|
+
readonly reflection?: 'additive-clamped' | 'prefer-existing';
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export interface RayHybridExistingEffects {
|
|
51
|
+
readonly shadowMap?: boolean;
|
|
52
|
+
readonly ssao?: boolean;
|
|
53
|
+
readonly planarReflection?: boolean;
|
|
54
|
+
readonly ssr?: boolean;
|
|
55
|
+
}
|
|
56
|
+
export interface RayHybridFrameRevision {
|
|
57
|
+
readonly scene: string;
|
|
58
|
+
readonly camera: string;
|
|
59
|
+
readonly depth: string;
|
|
60
|
+
readonly normal: string;
|
|
61
|
+
readonly material: string;
|
|
62
|
+
readonly sceneColor: string;
|
|
63
|
+
}
|
|
64
|
+
export interface RayHybridFrameInputs {
|
|
65
|
+
readonly viewId: string;
|
|
66
|
+
readonly width: number;
|
|
67
|
+
readonly height: number;
|
|
68
|
+
readonly acceleration: RayPackedAcceleration;
|
|
69
|
+
/** Borrowed raster resources. This runtime never destroys them. */
|
|
70
|
+
readonly depth: GPUTexture;
|
|
71
|
+
readonly normal: GPUTexture;
|
|
72
|
+
readonly material: GPUTexture;
|
|
73
|
+
readonly sceneColor: GPUTexture;
|
|
74
|
+
readonly inverseViewProjection: readonly number[];
|
|
75
|
+
readonly viewProjection: readonly number[];
|
|
76
|
+
readonly cameraOrigin: readonly [number, number, number];
|
|
77
|
+
readonly directionalLight: readonly [number, number, number];
|
|
78
|
+
readonly environmentColor?: readonly [number, number, number];
|
|
79
|
+
readonly revision: RayHybridFrameRevision;
|
|
80
|
+
readonly existingEffects?: RayHybridExistingEffects;
|
|
81
|
+
}
|
|
82
|
+
export interface RayHybridResolvedEffect {
|
|
83
|
+
readonly effect: RayHybridEffect;
|
|
84
|
+
readonly enabled: boolean;
|
|
85
|
+
readonly resolution: RayHybridResolution;
|
|
86
|
+
readonly width: number;
|
|
87
|
+
readonly height: number;
|
|
88
|
+
readonly raysPerPixel: 1 | 2 | 4;
|
|
89
|
+
readonly rayCount: number;
|
|
90
|
+
readonly maxRaysPerFrame: number;
|
|
91
|
+
readonly temporalEnabled: boolean;
|
|
92
|
+
readonly temporalFeedback: number;
|
|
93
|
+
readonly historyKey: string;
|
|
94
|
+
readonly parameters: Readonly<Record<string, number>>;
|
|
95
|
+
}
|
|
96
|
+
export interface RayHybridFrameContract {
|
|
97
|
+
readonly status: 'ready' | 'bypassed' | 'failed';
|
|
98
|
+
readonly width: number;
|
|
99
|
+
readonly height: number;
|
|
100
|
+
readonly effects: Readonly<Record<RayHybridEffect, RayHybridResolvedEffect>>;
|
|
101
|
+
readonly debugView: RayHybridDebugView;
|
|
102
|
+
readonly sceneColorSpace: 'linear' | 'srgb';
|
|
103
|
+
readonly diagnostics: readonly RayHybridDiagnostic[];
|
|
104
|
+
}
|
|
105
|
+
export interface RayHybridPass {
|
|
106
|
+
readonly kind: 'upload' | RayHybridEffect | 'composite' | 'consumer';
|
|
107
|
+
readonly label: string;
|
|
108
|
+
readonly enabled: boolean;
|
|
109
|
+
}
|
|
110
|
+
export interface RayHybridCounters {
|
|
111
|
+
readonly rays: number;
|
|
112
|
+
readonly tlasNodes: number;
|
|
113
|
+
readonly blasNodes: number;
|
|
114
|
+
readonly primitiveTests: number;
|
|
115
|
+
readonly hits: number;
|
|
116
|
+
readonly misses: number;
|
|
117
|
+
readonly transparentSkips: number;
|
|
118
|
+
readonly stackOverflows: number;
|
|
119
|
+
readonly invalidAccesses: number;
|
|
120
|
+
}
|
|
121
|
+
export interface RayHybridEffectStatistics {
|
|
122
|
+
readonly enabled: boolean;
|
|
123
|
+
readonly width: number;
|
|
124
|
+
readonly height: number;
|
|
125
|
+
readonly rayCount: number;
|
|
126
|
+
readonly historySamples: number;
|
|
127
|
+
readonly historyReset: boolean;
|
|
128
|
+
readonly gpuTimeNs: number | null;
|
|
129
|
+
readonly gpuTimeKind: 'timestamp-query' | 'unavailable';
|
|
130
|
+
readonly ownedBytes: number;
|
|
131
|
+
readonly counters: RayHybridCounters;
|
|
132
|
+
}
|
|
133
|
+
export interface RayHybridRenderResult {
|
|
134
|
+
readonly status: 'ok' | 'bypassed' | 'failed';
|
|
135
|
+
readonly outputTexture: GPUTexture | null;
|
|
136
|
+
readonly outputOwnership: 'borrowed-raster' | 'hybrid-runtime' | 'none';
|
|
137
|
+
readonly effects: Readonly<Record<RayHybridEffect, RayHybridEffectStatistics>>;
|
|
138
|
+
readonly diagnostics: readonly RayHybridDiagnostic[];
|
|
139
|
+
}
|
|
140
|
+
export interface RayHybridCreateResult {
|
|
141
|
+
readonly renderer: import('./runtime.js').RayHybridRenderer | null;
|
|
142
|
+
readonly diagnostics: readonly RayHybridDiagnostic[];
|
|
143
|
+
}
|
|
144
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { RayDeviceRecoveryOwnerOptions, RayDeviceRecoveryResult, RayRecoveryDiagnostic } from './types.js';
|
|
2
|
+
export declare class RayDeviceRecoveryOwner<TSource> {
|
|
3
|
+
private readonly options;
|
|
4
|
+
private device;
|
|
5
|
+
private source;
|
|
6
|
+
private bundle;
|
|
7
|
+
private controller;
|
|
8
|
+
private generationValue;
|
|
9
|
+
private destroyedValue;
|
|
10
|
+
private recoveryTask;
|
|
11
|
+
private lastRecoveryResult;
|
|
12
|
+
private readonly diagnosticValues;
|
|
13
|
+
private readonly maxRecoveryAttempts;
|
|
14
|
+
constructor(options: RayDeviceRecoveryOwnerOptions<TSource>);
|
|
15
|
+
get destroyed(): boolean;
|
|
16
|
+
get generation(): number;
|
|
17
|
+
get liveResourceCount(): number;
|
|
18
|
+
get ownedBytes(): number;
|
|
19
|
+
get diagnostics(): readonly RayRecoveryDiagnostic[];
|
|
20
|
+
initialize(device: GPUDevice, source: TSource): Promise<RayDeviceRecoveryResult>;
|
|
21
|
+
replaceSource(source: TSource): Promise<RayDeviceRecoveryResult>;
|
|
22
|
+
recoverWith(device: GPUDevice): Promise<RayDeviceRecoveryResult>;
|
|
23
|
+
awaitIdle(): Promise<RayDeviceRecoveryResult | null>;
|
|
24
|
+
destroy(): void;
|
|
25
|
+
private install;
|
|
26
|
+
private observeLoss;
|
|
27
|
+
private recoverAutomatically;
|
|
28
|
+
private releaseBundle;
|
|
29
|
+
private emit;
|
|
30
|
+
private result;
|
|
31
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type RayRecoveryDiagnosticCode = 'RAY_DEVICE_LOST' | 'RAY_DEVICE_RECOVERY_REQUIRED' | 'RAY_DEVICE_RECOVERY_STARTED' | 'RAY_DEVICE_RECOVERY_COMPLETED' | 'RAY_DEVICE_RECOVERY_FAILED' | 'RAY_DEVICE_RECOVERY_EXHAUSTED' | 'RAY_DEVICE_STALE_RESOURCE_DISPOSED' | 'RAY_DEVICE_OWNER_DISPOSED';
|
|
2
|
+
export interface RayRecoveryDiagnostic {
|
|
3
|
+
readonly phase: 'device-loss' | 'device-recovery' | 'lifecycle';
|
|
4
|
+
readonly severity: 'info' | 'warning' | 'error';
|
|
5
|
+
readonly code: RayRecoveryDiagnosticCode;
|
|
6
|
+
readonly message: string;
|
|
7
|
+
readonly context: Readonly<Record<string, string | number | boolean | null>>;
|
|
8
|
+
}
|
|
9
|
+
export interface RayOwnedRecoverableResource {
|
|
10
|
+
readonly label: string;
|
|
11
|
+
readonly liveResourceCount: number;
|
|
12
|
+
readonly ownedBytes?: number;
|
|
13
|
+
destroy(): void;
|
|
14
|
+
}
|
|
15
|
+
export interface RayRecoveryResourceBundle {
|
|
16
|
+
readonly resources: readonly RayOwnedRecoverableResource[];
|
|
17
|
+
/** History generation is diagnostic evidence and must equal the active device generation. */
|
|
18
|
+
readonly historyGeneration: number;
|
|
19
|
+
}
|
|
20
|
+
export interface RayDeviceRecoveryOwnerOptions<TSource> {
|
|
21
|
+
readonly label: string;
|
|
22
|
+
readonly create: (device: GPUDevice, source: TSource, context: {
|
|
23
|
+
readonly generation: number;
|
|
24
|
+
readonly signal: AbortSignal;
|
|
25
|
+
}) => Promise<RayRecoveryResourceBundle>;
|
|
26
|
+
readonly acquireDevice?: (context: {
|
|
27
|
+
readonly attempt: number;
|
|
28
|
+
readonly lost: GPUDeviceLostInfo;
|
|
29
|
+
}) => Promise<GPUDevice>;
|
|
30
|
+
readonly maxRecoveryAttempts?: number;
|
|
31
|
+
readonly onDiagnostic?: (diagnostic: RayRecoveryDiagnostic) => void;
|
|
32
|
+
}
|
|
33
|
+
export interface RayDeviceRecoveryResult {
|
|
34
|
+
readonly status: 'ready' | 'failed' | 'stale' | 'destroyed';
|
|
35
|
+
readonly generation: number;
|
|
36
|
+
readonly diagnostics: readonly RayRecoveryDiagnostic[];
|
|
37
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { packRayPbrMaterialScene } from './pack.js';
|
|
2
|
+
export type { RayMaterialDiagnostic, RayMaterialPackOptions, RayMaterialPackResult, RayMaterialPhase, RayMaterialSeverity, RayPackedMaterialBuffer, RayPackedMaterialScene, RayPackedSurfaceBuffer, RayPackedTextureAtlas, RayTexturePixels, RayTextureResolver, } from './types.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { World } from '@haiyue/engine/ecs';
|
|
2
|
+
import type { Scene } from '@haiyue/engine/scene';
|
|
3
|
+
import type { RayPackedAcceleration } from '../acceleration/index.js';
|
|
4
|
+
import type { RayMaterialPackOptions, RayMaterialPackResult } from './types.js';
|
|
5
|
+
export declare function packRayPbrMaterialScene(source: Scene | World, acceleration: RayPackedAcceleration, options?: RayMaterialPackOptions): RayMaterialPackResult;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { MaterialTextureSource, PbrTextureSlot } from '@haiyue/engine/material';
|
|
2
|
+
import type { RayPackedAcceleration } from '../acceleration/index.js';
|
|
3
|
+
export type RayMaterialSeverity = 'info' | 'warning' | 'error';
|
|
4
|
+
export type RayMaterialPhase = 'extract' | 'material-pack' | 'texture-pack' | 'surface-pack';
|
|
5
|
+
export interface RayMaterialDiagnostic {
|
|
6
|
+
readonly phase: RayMaterialPhase;
|
|
7
|
+
readonly severity: RayMaterialSeverity;
|
|
8
|
+
readonly code: string;
|
|
9
|
+
readonly message: string;
|
|
10
|
+
readonly context: Readonly<Record<string, string | number | boolean | null>>;
|
|
11
|
+
}
|
|
12
|
+
export interface RayTexturePixels {
|
|
13
|
+
readonly identity: string;
|
|
14
|
+
readonly revision: number;
|
|
15
|
+
readonly width: number;
|
|
16
|
+
readonly height: number;
|
|
17
|
+
/** Tightly packed RGBA8 texels in the source slot's declared color space. */
|
|
18
|
+
readonly data: Uint8Array | Uint8ClampedArray;
|
|
19
|
+
}
|
|
20
|
+
export type RayTextureResolver = (source: MaterialTextureSource, slot: PbrTextureSlot, materialIdentity: string) => RayTexturePixels | null;
|
|
21
|
+
export interface RayPackedTextureAtlas {
|
|
22
|
+
readonly width: number;
|
|
23
|
+
readonly height: number;
|
|
24
|
+
readonly layerCount: number;
|
|
25
|
+
readonly bytesPerRow: number;
|
|
26
|
+
readonly data: Uint8Array;
|
|
27
|
+
readonly identities: readonly string[];
|
|
28
|
+
readonly fingerprint: string;
|
|
29
|
+
}
|
|
30
|
+
export interface RayPackedMaterialBuffer {
|
|
31
|
+
readonly stride: 128;
|
|
32
|
+
readonly count: number;
|
|
33
|
+
readonly data: ArrayBuffer;
|
|
34
|
+
}
|
|
35
|
+
export interface RayPackedSurfaceBuffer {
|
|
36
|
+
readonly stride: 128;
|
|
37
|
+
readonly count: number;
|
|
38
|
+
readonly data: ArrayBuffer;
|
|
39
|
+
}
|
|
40
|
+
export interface RayPackedMaterialScene {
|
|
41
|
+
readonly schemaVersion: 1;
|
|
42
|
+
readonly accelerationFingerprint: string;
|
|
43
|
+
readonly revision: string;
|
|
44
|
+
readonly fingerprint: string;
|
|
45
|
+
readonly materials: RayPackedMaterialBuffer;
|
|
46
|
+
readonly surfaces: RayPackedSurfaceBuffer;
|
|
47
|
+
readonly textures: RayPackedTextureAtlas;
|
|
48
|
+
readonly materialIdentities: readonly string[];
|
|
49
|
+
readonly diagnostics: readonly RayMaterialDiagnostic[];
|
|
50
|
+
readonly unsupportedFeatures: readonly string[];
|
|
51
|
+
}
|
|
52
|
+
export interface RayMaterialPackOptions {
|
|
53
|
+
readonly textureResolver?: RayTextureResolver;
|
|
54
|
+
readonly maxTextureDimension?: number;
|
|
55
|
+
readonly maxTextureLayers?: number;
|
|
56
|
+
}
|
|
57
|
+
export interface RayMaterialPackResult {
|
|
58
|
+
readonly packed: RayPackedMaterialScene | null;
|
|
59
|
+
readonly diagnostics: readonly RayMaterialDiagnostic[];
|
|
60
|
+
}
|
|
61
|
+
export interface RayMaterialSourceContext {
|
|
62
|
+
readonly acceleration: RayPackedAcceleration;
|
|
63
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/** GPU-independent ray/hit semantics used as the M04 correctness oracle. */
|
|
2
|
+
export type RayVec3 = readonly [number, number, number];
|
|
3
|
+
export type RayBarycentric = readonly [number, number, number];
|
|
4
|
+
export type RayMatrix4 = readonly number[];
|
|
5
|
+
export declare const RAY_REFERENCE_SEMANTICS: Readonly<{
|
|
6
|
+
readonly schemaVersion: 1;
|
|
7
|
+
readonly directionLengthEpsilon: 1e-12;
|
|
8
|
+
readonly parallelRelativeEpsilon: 1e-12;
|
|
9
|
+
readonly degenerateRelativeEpsilon: 1e-24;
|
|
10
|
+
readonly rangeEpsilon: 1e-12;
|
|
11
|
+
readonly tieRelativeEpsilon: 1e-9;
|
|
12
|
+
readonly faceRule: "front when dot(ray.direction, windingNormal) < 0";
|
|
13
|
+
readonly barycentricOrder: "[vertex0, vertex1, vertex2]";
|
|
14
|
+
readonly normalRule: "inverse-transpose, aligned to the world-space winding normal";
|
|
15
|
+
readonly tieBreak: "instanceId, geometryId, geometryRevision, primitiveIndex, entityId";
|
|
16
|
+
}>;
|
|
17
|
+
export type RayDiagnosticSeverity = 'info' | 'warning' | 'error';
|
|
18
|
+
export interface RayDiagnostic {
|
|
19
|
+
readonly phase: 'reference' | 'scene-extraction';
|
|
20
|
+
readonly severity: RayDiagnosticSeverity;
|
|
21
|
+
readonly code: string;
|
|
22
|
+
readonly message: string;
|
|
23
|
+
readonly context: Readonly<Record<string, string | number | boolean | null>>;
|
|
24
|
+
}
|
|
25
|
+
export interface RayInput {
|
|
26
|
+
readonly origin: RayVec3;
|
|
27
|
+
readonly direction: RayVec3;
|
|
28
|
+
readonly tMin?: number;
|
|
29
|
+
readonly tMax?: number;
|
|
30
|
+
}
|
|
31
|
+
export interface CanonicalRay {
|
|
32
|
+
readonly origin: RayVec3;
|
|
33
|
+
readonly direction: RayVec3;
|
|
34
|
+
readonly tMin: number;
|
|
35
|
+
readonly tMax: number;
|
|
36
|
+
}
|
|
37
|
+
export interface RayPrimitiveIdentity {
|
|
38
|
+
readonly instanceId: string;
|
|
39
|
+
readonly entityId: string;
|
|
40
|
+
readonly geometryId: string;
|
|
41
|
+
readonly geometryRevision: number;
|
|
42
|
+
readonly primitiveIndex: number;
|
|
43
|
+
}
|
|
44
|
+
export interface RaySceneTriangleGeometry {
|
|
45
|
+
readonly kind: 'triangle-mesh';
|
|
46
|
+
readonly geometryId: string;
|
|
47
|
+
readonly revision: number;
|
|
48
|
+
readonly positions: readonly number[];
|
|
49
|
+
readonly normals: readonly number[] | null;
|
|
50
|
+
readonly indices: readonly number[] | null;
|
|
51
|
+
readonly primitiveCount: number;
|
|
52
|
+
}
|
|
53
|
+
export interface RaySceneInstance {
|
|
54
|
+
readonly instanceId: string;
|
|
55
|
+
readonly entityId: string;
|
|
56
|
+
readonly geometryId: string;
|
|
57
|
+
readonly geometryRevision: number;
|
|
58
|
+
readonly transform: RayMatrix4;
|
|
59
|
+
}
|
|
60
|
+
export interface RaySceneAnalyticSphere {
|
|
61
|
+
readonly kind: 'sphere';
|
|
62
|
+
readonly identity: RayPrimitiveIdentity;
|
|
63
|
+
readonly center: RayVec3;
|
|
64
|
+
readonly radius: number;
|
|
65
|
+
readonly transform: RayMatrix4;
|
|
66
|
+
}
|
|
67
|
+
export interface RayReferenceScene {
|
|
68
|
+
readonly geometries: readonly RaySceneTriangleGeometry[];
|
|
69
|
+
readonly instances: readonly RaySceneInstance[];
|
|
70
|
+
readonly analyticPrimitives: readonly RaySceneAnalyticSphere[];
|
|
71
|
+
}
|
|
72
|
+
export interface RayHit {
|
|
73
|
+
readonly primitiveKind: 'triangle' | 'sphere';
|
|
74
|
+
readonly identity: RayPrimitiveIdentity;
|
|
75
|
+
readonly t: number;
|
|
76
|
+
readonly position: RayVec3;
|
|
77
|
+
readonly barycentric: RayBarycentric | null;
|
|
78
|
+
readonly frontFace: boolean;
|
|
79
|
+
/** World-space normal from primitive winding/implicit surface, never face-flipped. */
|
|
80
|
+
readonly geometricNormal: RayVec3;
|
|
81
|
+
/** Inverse-transpose normal aligned to geometricNormal, never face-flipped. */
|
|
82
|
+
readonly shadingNormal: RayVec3;
|
|
83
|
+
/** shadingNormal oriented against the incoming ray. */
|
|
84
|
+
readonly facingNormal: RayVec3;
|
|
85
|
+
}
|
|
86
|
+
export interface RayTraceResult {
|
|
87
|
+
readonly ray: CanonicalRay | null;
|
|
88
|
+
readonly hit: RayHit | null;
|
|
89
|
+
readonly diagnostics: readonly RayDiagnostic[];
|
|
90
|
+
readonly testedPrimitiveCount: number;
|
|
91
|
+
}
|
|
92
|
+
export interface RayHitExpectation {
|
|
93
|
+
readonly primitiveKind?: RayHit['primitiveKind'];
|
|
94
|
+
readonly identity?: Partial<RayPrimitiveIdentity>;
|
|
95
|
+
readonly t?: number;
|
|
96
|
+
readonly position?: RayVec3;
|
|
97
|
+
readonly barycentric?: RayBarycentric | null;
|
|
98
|
+
readonly frontFace?: boolean;
|
|
99
|
+
readonly geometricNormal?: RayVec3;
|
|
100
|
+
readonly shadingNormal?: RayVec3;
|
|
101
|
+
readonly facingNormal?: RayVec3;
|
|
102
|
+
}
|
|
103
|
+
export interface RayReferenceCorpusCase {
|
|
104
|
+
readonly id: string;
|
|
105
|
+
readonly scene: RayReferenceScene;
|
|
106
|
+
readonly ray: RayInput;
|
|
107
|
+
readonly expected: RayHitExpectation | null;
|
|
108
|
+
readonly tolerance: number;
|
|
109
|
+
}
|
|
110
|
+
export declare function traceRayBruteForce(scene: RayReferenceScene, input: RayInput): RayTraceResult;
|
|
111
|
+
export declare function compareRayHit(expected: RayHitExpectation | null, actual: RayHit | null, tolerance?: number): readonly string[];
|
|
112
|
+
export declare function formatRayHitMismatch(caseId: string, mismatches: readonly string[]): string;
|
|
113
|
+
export declare function replayRayReferenceCorpus(): Readonly<{
|
|
114
|
+
passed: boolean;
|
|
115
|
+
cases: readonly Readonly<{
|
|
116
|
+
id: string;
|
|
117
|
+
passed: boolean;
|
|
118
|
+
message: string;
|
|
119
|
+
result: RayTraceResult;
|
|
120
|
+
}>[];
|
|
121
|
+
}>;
|
|
122
|
+
export declare const RAY_REFERENCE_CORPUS: readonly RayReferenceCorpusCase[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createRayPathBindGroupLayouts, RAY_PATH_LAYOUT } from './layout.js';
|
|
2
|
+
export { createRayPathRenderPlan } from './plan.js';
|
|
3
|
+
export { createRayPathPrimaryRay, evaluateRayPbrDirectReference, toneMapRayColor } from './reference.js';
|
|
4
|
+
export type { RayPbrSurfaceReference } from './reference.js';
|
|
5
|
+
export { RayPathTracingRenderer } from './runtime.js';
|
|
6
|
+
export { extractRayPathSceneFacts } from './scene.js';
|
|
7
|
+
export type { RayPathCamera, RayPathCounters, RayPathDiagnostic, RayPathDiagnosticPhase, RayPathDiagnosticSeverity, RayPathEnvironment, RayPathLight, RayPathMemory, RayPathRendererCreateResult, RayPathRenderOptions, RayPathRenderPlan, RayPathRenderPlanPass, RayPathRenderResult, RayPathSceneExtractionOptions, RayPathSceneExtractionResult, RayPathSceneFacts, RayToneMapping, } from './types.js';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const RAY_PATH_LAYOUT: Readonly<{
|
|
2
|
+
artifactFormat: "haiyue-precompiled-shader-artifact";
|
|
3
|
+
artifactVersion: 2;
|
|
4
|
+
artifactHash: "6154b14932ab083ad96da72fcf762c6da5d4a5f368717bb15e1a5671bdf5d8b2";
|
|
5
|
+
compilerVersion: "shader-language-ray-path-tracing-v1";
|
|
6
|
+
tracePassId: "ray-path-tracing";
|
|
7
|
+
tonePassId: "ray-tone-mapping";
|
|
8
|
+
workgroupSizeX: 8;
|
|
9
|
+
workgroupSizeY: 8;
|
|
10
|
+
materialStride: 128;
|
|
11
|
+
surfaceStride: 128;
|
|
12
|
+
parameterBytes: 128;
|
|
13
|
+
lightBytes: 512;
|
|
14
|
+
diagnosticBytes: 48;
|
|
15
|
+
maxLights: 8;
|
|
16
|
+
maxBounces: 8;
|
|
17
|
+
requiredStorageBuffersPerShaderStage: 8;
|
|
18
|
+
requiredBindingsPerBindGroup: 15;
|
|
19
|
+
}>;
|
|
20
|
+
export declare function createRayPathBindGroupLayouts(device: GPUDevice): readonly [GPUBindGroupLayout, GPUBindGroupLayout];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { RayVec3 } from '../reference/index.js';
|
|
2
|
+
import type { RayPathCamera, RayToneMapping } from './types.js';
|
|
3
|
+
export interface RayPbrSurfaceReference {
|
|
4
|
+
readonly baseColor: RayVec3;
|
|
5
|
+
readonly metallic: number;
|
|
6
|
+
readonly roughness: number;
|
|
7
|
+
readonly ior: number;
|
|
8
|
+
readonly specularFactor: number;
|
|
9
|
+
readonly specularColor: RayVec3;
|
|
10
|
+
readonly normal: RayVec3;
|
|
11
|
+
}
|
|
12
|
+
export declare function createRayPathPrimaryRay(camera: RayPathCamera, width: number, height: number, x: number, y: number): Readonly<{
|
|
13
|
+
origin: RayVec3;
|
|
14
|
+
direction: RayVec3;
|
|
15
|
+
}>;
|
|
16
|
+
export declare function evaluateRayPbrDirectReference(surface: RayPbrSurfaceReference, viewDirection: RayVec3, lightDirection: RayVec3, radiance: RayVec3): RayVec3;
|
|
17
|
+
export declare function toneMapRayColor(linear: RayVec3, exposure?: number, operator?: RayToneMapping): RayVec3;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { RayPackedAcceleration } from '../acceleration/index.js';
|
|
2
|
+
import type { RayPackedMaterialScene } from '../material/index.js';
|
|
3
|
+
import type { RayPathRendererCreateResult, RayPathRenderOptions, RayPathRenderResult, RayPathSceneFacts } from './types.js';
|
|
4
|
+
export declare class RayPathTracingRenderer {
|
|
5
|
+
readonly artifactHash: "6154b14932ab083ad96da72fcf762c6da5d4a5f368717bb15e1a5671bdf5d8b2";
|
|
6
|
+
readonly accelerationFingerprint: string;
|
|
7
|
+
readonly materialFingerprint: string;
|
|
8
|
+
private readonly _device;
|
|
9
|
+
private readonly _acceleration;
|
|
10
|
+
private readonly _materials;
|
|
11
|
+
private readonly _buffers;
|
|
12
|
+
private _layouts;
|
|
13
|
+
private _tracePipeline;
|
|
14
|
+
private _tonePipeline;
|
|
15
|
+
private _materialTexture;
|
|
16
|
+
private _defaultEnvironment;
|
|
17
|
+
private _materialSampler;
|
|
18
|
+
private _environmentSampler;
|
|
19
|
+
private _hdrTexture;
|
|
20
|
+
private _outputTexture;
|
|
21
|
+
private _width;
|
|
22
|
+
private _height;
|
|
23
|
+
private _destroyed;
|
|
24
|
+
private _rendering;
|
|
25
|
+
private _generation;
|
|
26
|
+
private _lostMessage;
|
|
27
|
+
private readonly _uncapturedErrors;
|
|
28
|
+
private readonly _uncapturedHandler;
|
|
29
|
+
private constructor();
|
|
30
|
+
static create(device: GPUDevice, acceleration: RayPackedAcceleration, materials: RayPackedMaterialScene): Promise<RayPathRendererCreateResult>;
|
|
31
|
+
get destroyed(): boolean;
|
|
32
|
+
get outputTexture(): GPUTexture | null;
|
|
33
|
+
get liveResourceCount(): number;
|
|
34
|
+
render(facts: RayPathSceneFacts, options: RayPathRenderOptions): Promise<RayPathRenderResult>;
|
|
35
|
+
destroy(): void;
|
|
36
|
+
private resize;
|
|
37
|
+
private staticBytes;
|
|
38
|
+
private memory;
|
|
39
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { World } from '@haiyue/engine/ecs';
|
|
2
|
+
import type { Scene } from '@haiyue/engine/scene';
|
|
3
|
+
import type { RayPathSceneExtractionOptions, RayPathSceneExtractionResult } from './types.js';
|
|
4
|
+
export declare function extractRayPathSceneFacts(source: Scene | World, options?: RayPathSceneExtractionOptions): RayPathSceneExtractionResult;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { RayVec3 } from '../reference/index.js';
|
|
2
|
+
export type RayPathDiagnosticPhase = 'extract' | 'upload' | 'path-tracing' | 'tone-mapping' | 'readback' | 'lifecycle';
|
|
3
|
+
export type RayPathDiagnosticSeverity = 'info' | 'warning' | 'error';
|
|
4
|
+
export type RayToneMapping = 'linear' | 'reinhard' | 'aces';
|
|
5
|
+
export interface RayPathDiagnostic {
|
|
6
|
+
readonly phase: RayPathDiagnosticPhase;
|
|
7
|
+
readonly severity: RayPathDiagnosticSeverity;
|
|
8
|
+
readonly code: string;
|
|
9
|
+
readonly message: string;
|
|
10
|
+
readonly context: Readonly<Record<string, string | number | boolean | null>>;
|
|
11
|
+
}
|
|
12
|
+
export interface RayPathCamera {
|
|
13
|
+
readonly projection: 'perspective' | 'orthographic';
|
|
14
|
+
readonly origin: RayVec3;
|
|
15
|
+
readonly right: RayVec3;
|
|
16
|
+
readonly up: RayVec3;
|
|
17
|
+
/** Normalized world-space viewing direction. */
|
|
18
|
+
readonly forward: RayVec3;
|
|
19
|
+
readonly verticalFov: number;
|
|
20
|
+
readonly orthographicHeight: number;
|
|
21
|
+
readonly near: number;
|
|
22
|
+
readonly far: number;
|
|
23
|
+
readonly revision: string;
|
|
24
|
+
}
|
|
25
|
+
export interface RayPathLight {
|
|
26
|
+
readonly identity: string;
|
|
27
|
+
readonly type: 'ambient' | 'directional' | 'point';
|
|
28
|
+
readonly color: RayVec3;
|
|
29
|
+
readonly intensity: number;
|
|
30
|
+
/** Direction the directional light travels. */
|
|
31
|
+
readonly direction: RayVec3;
|
|
32
|
+
readonly position: RayVec3;
|
|
33
|
+
readonly range: number;
|
|
34
|
+
readonly revision: string;
|
|
35
|
+
}
|
|
36
|
+
export interface RayPathEnvironment {
|
|
37
|
+
readonly color: RayVec3;
|
|
38
|
+
readonly intensity: number;
|
|
39
|
+
readonly rotation: number;
|
|
40
|
+
/** Borrowed Engine texture. The renderer never destroys it. */
|
|
41
|
+
readonly texture: GPUTexture | null;
|
|
42
|
+
readonly textureVersion: number;
|
|
43
|
+
readonly revision: string;
|
|
44
|
+
}
|
|
45
|
+
export interface RayPathSceneFacts {
|
|
46
|
+
readonly camera: RayPathCamera;
|
|
47
|
+
readonly lights: readonly RayPathLight[];
|
|
48
|
+
readonly environment: RayPathEnvironment;
|
|
49
|
+
readonly revision: string;
|
|
50
|
+
readonly diagnostics: readonly RayPathDiagnostic[];
|
|
51
|
+
}
|
|
52
|
+
export interface RayPathSceneExtractionOptions {
|
|
53
|
+
readonly cameraEntityId?: number;
|
|
54
|
+
readonly maxLights?: number;
|
|
55
|
+
}
|
|
56
|
+
export interface RayPathSceneExtractionResult {
|
|
57
|
+
readonly facts: RayPathSceneFacts | null;
|
|
58
|
+
readonly diagnostics: readonly RayPathDiagnostic[];
|
|
59
|
+
}
|
|
60
|
+
export interface RayPathRenderOptions {
|
|
61
|
+
readonly width: number;
|
|
62
|
+
readonly height: number;
|
|
63
|
+
readonly maxBounces?: number;
|
|
64
|
+
readonly seed?: number;
|
|
65
|
+
readonly exposure?: number;
|
|
66
|
+
readonly toneMapping?: RayToneMapping;
|
|
67
|
+
readonly readback?: boolean;
|
|
68
|
+
}
|
|
69
|
+
export interface RayPathCounters {
|
|
70
|
+
readonly pixels: number;
|
|
71
|
+
readonly rays: number;
|
|
72
|
+
readonly bounces: number;
|
|
73
|
+
readonly hits: number;
|
|
74
|
+
readonly misses: number;
|
|
75
|
+
readonly shadowRays: number;
|
|
76
|
+
readonly emissiveHits: number;
|
|
77
|
+
readonly stackOverflows: number;
|
|
78
|
+
readonly invalidAccesses: number;
|
|
79
|
+
}
|
|
80
|
+
export interface RayPathMemory {
|
|
81
|
+
readonly accelerationBytes: number;
|
|
82
|
+
readonly materialBytes: number;
|
|
83
|
+
readonly textureBytes: number;
|
|
84
|
+
readonly outputBytes: number;
|
|
85
|
+
readonly diagnosticBytes: number;
|
|
86
|
+
readonly readbackBytes: number;
|
|
87
|
+
readonly peakBytes: number;
|
|
88
|
+
readonly liveResourceCount: number;
|
|
89
|
+
}
|
|
90
|
+
export interface RayPathRenderResult {
|
|
91
|
+
readonly status: 'ok' | 'failed';
|
|
92
|
+
readonly width: number;
|
|
93
|
+
readonly height: number;
|
|
94
|
+
readonly revision: string;
|
|
95
|
+
readonly outputTexture: GPUTexture | null;
|
|
96
|
+
readonly pixels: Uint8Array | null;
|
|
97
|
+
readonly counters: RayPathCounters;
|
|
98
|
+
readonly gpuTimeNs: number | null;
|
|
99
|
+
readonly gpuTimeKind: 'timestamp-query' | 'unavailable';
|
|
100
|
+
readonly memory: RayPathMemory;
|
|
101
|
+
readonly diagnostics: readonly RayPathDiagnostic[];
|
|
102
|
+
}
|
|
103
|
+
export interface RayPathRendererCreateResult {
|
|
104
|
+
readonly renderer: import('./runtime.js').RayPathTracingRenderer | null;
|
|
105
|
+
readonly diagnostics: readonly RayPathDiagnostic[];
|
|
106
|
+
}
|
|
107
|
+
export interface RayPathRenderPlanPass {
|
|
108
|
+
readonly kind: 'upload' | 'path-tracing' | 'tone-mapping' | 'consumer';
|
|
109
|
+
readonly label: string;
|
|
110
|
+
}
|
|
111
|
+
export interface RayPathRenderPlan {
|
|
112
|
+
readonly width: number;
|
|
113
|
+
readonly height: number;
|
|
114
|
+
readonly passes: readonly RayPathRenderPlanPass[];
|
|
115
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { RAY_PROGRESSIVE_LAYOUT } from './layout.js';
|
|
2
|
+
export { createRayProgressiveRenderPlan } from './plan.js';
|
|
3
|
+
export type { RayProgressivePlanPass } from './plan.js';
|
|
4
|
+
export { classifyRayProgressiveReset, createRayProgressiveAccumulationKey, createRayProgressiveFrameRevision } from './revision.js';
|
|
5
|
+
export { RayProgressiveRenderer } from './runtime.js';
|
|
6
|
+
export { createRayProgressiveSequenceSample } from './sequence.js';
|
|
7
|
+
export { RAY_ACCUMULATION_FORMAT, RAY_PROGRESSIVE_SEQUENCE_ID, } from './types.js';
|
|
8
|
+
export type { RayProgressiveAccumulationKey, RayProgressiveCreateResult, RayProgressiveDiagnostic, RayProgressiveFrame, RayProgressiveFrameRevision, RayProgressiveMemory, RayProgressiveOptions, RayProgressiveRenderResult, RayProgressiveResetEvent, RayProgressiveResetReason, RayProgressiveSequenceSample, RayProgressiveStageTiming, RayProgressiveStatistics, RayProgressiveView, } from './types.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const RAY_PROGRESSIVE_LAYOUT: Readonly<{
|
|
2
|
+
artifactHash: "68dbd34a27343815b6b1af275d7909c28b21bd0558b9a0aea6bc8cd54c5bc060";
|
|
3
|
+
accumulatePassId: "ray-progressive-accumulate";
|
|
4
|
+
presentPassId: "ray-progressive-present";
|
|
5
|
+
parameterBytes: 64;
|
|
6
|
+
diagnosticBytes: 16;
|
|
7
|
+
workgroupSizeX: 8;
|
|
8
|
+
workgroupSizeY: 8;
|
|
9
|
+
requiredStorageTextures: 4;
|
|
10
|
+
requiredBindings: 9;
|
|
11
|
+
}>;
|
|
12
|
+
export declare function createRayProgressiveLayouts(device: GPUDevice): readonly [GPUBindGroupLayout, GPUBindGroupLayout];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export interface RayProgressivePlanPass {
|
|
2
|
+
readonly kind: 'sample' | 'accumulate' | 'denoise-temporal' | 'denoise-spatial' | 'present';
|
|
3
|
+
readonly label: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function createRayProgressiveRenderPlan(denoise: boolean): readonly RayProgressivePlanPass[];
|