@aura3d/rendering 1.4.0 → 1.4.2
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/package.json +38 -4
- package/AGENTS.md +0 -46
- package/src/ArchitecturalLightingFixtures.ts +0 -241
- package/src/ArchitecturalMaterialCatalog.ts +0 -130
- package/src/ArchitecturalMeasurementFixtures.ts +0 -155
- package/src/BRDFLut.ts +0 -47
- package/src/CameraFraming.ts +0 -200
- package/src/CanonicalSceneFixtures.ts +0 -95
- package/src/CascadedShadowMaps.ts +0 -449
- package/src/ColorManagement.ts +0 -127
- package/src/CullingFixtures.ts +0 -280
- package/src/DecalGeometry.ts +0 -26
- package/src/DepthPass.ts +0 -110
- package/src/EnvironmentBackgroundPass.ts +0 -194
- package/src/EnvironmentBackgroundResources.ts +0 -309
- package/src/EnvironmentLighting.ts +0 -96
- package/src/EnvironmentMapResources.ts +0 -1026
- package/src/EnvironmentPipeline.ts +0 -69
- package/src/EnvironmentPlatform.ts +0 -1306
- package/src/EnvironmentPreset.ts +0 -155
- package/src/Exposure.ts +0 -66
- package/src/ExternalParityRenderPreset.ts +0 -725
- package/src/ForwardPass.ts +0 -1668
- package/src/FrameVisualMetrics.ts +0 -301
- package/src/Geometry.ts +0 -461
- package/src/GeometryPrimitives.ts +0 -2
- package/src/HDRRenderPipeline.ts +0 -94
- package/src/IBL.ts +0 -86
- package/src/IndexBuffer.ts +0 -57
- package/src/InstancedPBRMaterial.ts +0 -186
- package/src/InstancedUnlitMaterial.ts +0 -60
- package/src/Instancing.ts +0 -19
- package/src/LightCollector.ts +0 -82
- package/src/LightUniforms.ts +0 -47
- package/src/LightingDebug.ts +0 -80
- package/src/LightingDefaults.ts +0 -79
- package/src/LightingRig.ts +0 -301
- package/src/LineGeometry.ts +0 -2
- package/src/Material.ts +0 -209
- package/src/MaterialBinding.ts +0 -131
- package/src/MaterialInstance.ts +0 -59
- package/src/MaterialPresets.ts +0 -272
- package/src/MorphTarget.ts +0 -124
- package/src/MorphTargetPlan.ts +0 -178
- package/src/MorphUnlitMaterial.ts +0 -60
- package/src/NormalMappedPBRMaterial.ts +0 -188
- package/src/OceanFixtures.ts +0 -318
- package/src/PBRLightingDefaults.ts +0 -12
- package/src/PBRMaterial.ts +0 -442
- package/src/PMREM.ts +0 -53
- package/src/PbrReference.ts +0 -681
- package/src/PostProcessPass.ts +0 -2507
- package/src/ProceduralTextureFixtures.ts +0 -393
- package/src/ProductTurntableFixtures.ts +0 -815
- package/src/Raycaster.ts +0 -21
- package/src/ReflectionProbe.ts +0 -13
- package/src/ReflectionSurfaces.ts +0 -219
- package/src/RenderBackend.ts +0 -43
- package/src/RenderDebugViews.ts +0 -138
- package/src/RenderDevice.ts +0 -836
- package/src/RenderGraph.ts +0 -194
- package/src/RenderPass.ts +0 -27
- package/src/RenderPipeline.ts +0 -101
- package/src/RenderQueue.ts +0 -12
- package/src/RenderState.ts +0 -12
- package/src/Renderer.ts +0 -2631
- package/src/RendererDebugOverlay.ts +0 -80
- package/src/RendererFeatureGates.ts +0 -150
- package/src/RendererPostprocessPlan.ts +0 -279
- package/src/RendererTiming.ts +0 -251
- package/src/RendererVisualPipelineReport.ts +0 -836
- package/src/ResourceLifecycle.ts +0 -21
- package/src/Sampler.ts +0 -37
- package/src/SceneOptimization.ts +0 -518
- package/src/ShaderChunks.ts +0 -393
- package/src/ShaderLibrary.ts +0 -2766
- package/src/ShaderModule.ts +0 -36
- package/src/ShaderPreprocessor.ts +0 -260
- package/src/ShaderReflection.ts +0 -201
- package/src/ShadowMap.ts +0 -237
- package/src/ShadowPass.ts +0 -198
- package/src/ShadowProjection.ts +0 -115
- package/src/SkinnedLitMaterial.ts +0 -397
- package/src/SkinnedUnlitMaterial.ts +0 -63
- package/src/SkinningBounds.ts +0 -131
- package/src/SpaceEnvironmentFixtures.ts +0 -200
- package/src/SpriteGeometry.ts +0 -21
- package/src/StereoCameraRig.ts +0 -127
- package/src/StereoEffects.ts +0 -274
- package/src/TerrainFixtures.ts +0 -180
- package/src/Texture.ts +0 -307
- package/src/TextureBinding.ts +0 -91
- package/src/TexturedPBRMaterial.ts +0 -1112
- package/src/TexturedUnlitMaterial.ts +0 -67
- package/src/ToneMapping.ts +0 -105
- package/src/UniformBinder.ts +0 -16
- package/src/UniformLayout.ts +0 -129
- package/src/UnlitMaterial.ts +0 -75
- package/src/VegetationFixtures.ts +0 -314
- package/src/VertexBuffer.ts +0 -120
- package/src/VertexFormat.ts +0 -171
- package/src/VoxelWorldFixtures.ts +0 -280
- package/src/WeatherFixtures.ts +0 -223
- package/src/WebGL2Device.ts +0 -2280
- package/src/WebGL2StateCache.ts +0 -330
- package/src/WebGPUDevice.ts +0 -2877
- package/src/WebGPURenderToTextureProof.ts +0 -139
- package/src/advanced-runtime/AdvancedRenderer.ts +0 -73
- package/src/advanced-runtime/index.ts +0 -9
- package/src/animation/AnimationMaterialStyle.ts +0 -32
- package/src/animation/AnimationRenderPreset.ts +0 -45
- package/src/animation/AnimationToonMaterial.ts +0 -387
- package/src/animation/AnimationVisualQuality.ts +0 -71
- package/src/animation/applyAnimationRenderPreset.ts +0 -180
- package/src/animation/index.ts +0 -5
- package/src/cinematic/BloomPass.ts +0 -26
- package/src/cinematic/CinematicDepthComposition.ts +0 -30
- package/src/cinematic/CinematicEvidence.ts +0 -123
- package/src/cinematic/CinematicLightingRig.ts +0 -144
- package/src/cinematic/CinematicMaterialPresets.ts +0 -130
- package/src/cinematic/CinematicPostProcess.ts +0 -83
- package/src/cinematic/DepthHazePass.ts +0 -30
- package/src/cinematic/EmissivePracticalLightSystem.ts +0 -45
- package/src/cinematic/FilmGrainPass.ts +0 -24
- package/src/cinematic/FogVolumeSystem.ts +0 -30
- package/src/cinematic/GlowCardSystem.ts +0 -44
- package/src/cinematic/RainParticleSystem.ts +0 -151
- package/src/cinematic/VignettePass.ts +0 -25
- package/src/cinematic/WetReflectionApproximation.ts +0 -27
- package/src/cinematic/index.ts +0 -14
- package/src/effects/CollisionModule.ts +0 -64
- package/src/effects/ColorModule.ts +0 -60
- package/src/effects/ForceModule.ts +0 -25
- package/src/effects/GPUParticleBackend.ts +0 -569
- package/src/effects/Particle.ts +0 -108
- package/src/effects/ParticleDiagnostics.ts +0 -224
- package/src/effects/ParticleEffectPresets.ts +0 -147
- package/src/effects/ParticleEmitter.ts +0 -326
- package/src/effects/ParticleModule.ts +0 -26
- package/src/effects/ParticleRenderPass.ts +0 -117
- package/src/effects/ParticleRenderer.ts +0 -132
- package/src/effects/ParticleSystem.ts +0 -333
- package/src/effects/SizeModule.ts +0 -56
- package/src/effects/TrailModule.ts +0 -72
- package/src/effects/VelocityModule.ts +0 -75
- package/src/effects/index.ts +0 -15
- package/src/index.ts +0 -925
- package/src/materials/AlphaSorting.ts +0 -30
- package/src/materials/MaterialExtensions.ts +0 -42
- package/src/materials/PhysicalMaterial.ts +0 -133
- package/src/materials/TransmissionPass.ts +0 -51
- package/src/performance/BVH.ts +0 -18
- package/src/performance/Batcher.ts +0 -2
- package/src/performance/FrustumCuller.ts +0 -9
- package/src/performance/LOD.ts +0 -20
- package/src/performance/Octree.ts +0 -10
- package/src/performance/RenderItemSorting.ts +0 -170
- package/src/performance/RendererStats.ts +0 -43
- package/src/performance/ResourceBudget.ts +0 -44
- package/src/postprocess/BloomPass.ts +0 -28
- package/src/postprocess/CinematicDiagnostics.ts +0 -642
- package/src/postprocess/ColorGradingPass.ts +0 -24
- package/src/postprocess/DepthOfFieldPass.ts +0 -12
- package/src/postprocess/EffectComposer.ts +0 -349
- package/src/postprocess/SSAOPass.ts +0 -20
- package/src/postprocess/index.ts +0 -34
- package/src/production-runtime/AnimationControlsPipeline.ts +0 -77
- package/src/production-runtime/PBRHDRPipeline.ts +0 -381
- package/src/production-runtime/ProductionEffectsPipeline.ts +0 -85
- package/src/production-runtime/ProductionRendererTypes.ts +0 -136
- package/src/production-runtime/ProductionRuntimeRenderer.ts +0 -172
- package/src/production-runtime/ProductionWebGL2Renderer.ts +0 -313
- package/src/production-runtime/ProductionWebGPURenderer.ts +0 -396
- package/src/production-runtime/TransmissionBackdropCapture.ts +0 -130
- package/src/production-runtime/animation/MorphTargetRenderer.ts +0 -2
- package/src/production-runtime/animation/SkinningRenderer.ts +0 -2
- package/src/production-runtime/backends/RendererBackend.ts +0 -17
- package/src/production-runtime/backends/WebGL2RendererBackend.ts +0 -30
- package/src/production-runtime/backends/WebGPURendererBackend.ts +0 -24
- package/src/production-runtime/backends/webgl2/WebGL2Buffer.ts +0 -2
- package/src/production-runtime/backends/webgl2/WebGL2Capabilities.ts +0 -2
- package/src/production-runtime/backends/webgl2/WebGL2RenderTarget.ts +0 -2
- package/src/production-runtime/backends/webgl2/WebGL2Shader.ts +0 -2
- package/src/production-runtime/backends/webgl2/WebGL2StateCache.ts +0 -1
- package/src/production-runtime/backends/webgl2/WebGL2Texture.ts +0 -2
- package/src/production-runtime/backends/webgpu/WebGPUBuffer.ts +0 -2
- package/src/production-runtime/backends/webgpu/WebGPUCapabilities.ts +0 -2
- package/src/production-runtime/backends/webgpu/WebGPURenderTarget.ts +0 -2
- package/src/production-runtime/backends/webgpu/WebGPUShader.ts +0 -2
- package/src/production-runtime/backends/webgpu/WebGPUTexture.ts +0 -2
- package/src/production-runtime/color/ColorManagement.ts +0 -3
- package/src/production-runtime/color/ToneMapping.ts +0 -7
- package/src/production-runtime/diagnostics/FrameCapture.ts +0 -2
- package/src/production-runtime/diagnostics/GPUCapabilities.ts +0 -2
- package/src/production-runtime/diagnostics/RendererStats.ts +0 -2
- package/src/production-runtime/environment/EnvironmentMap.ts +0 -1
- package/src/production-runtime/environment/HDRLoader.ts +0 -57
- package/src/production-runtime/environment/PMREMGenerator.ts +0 -713
- package/src/production-runtime/framegraph/FrameGraph.ts +0 -18
- package/src/production-runtime/framegraph/RenderPass.ts +0 -15
- package/src/production-runtime/geometry/ProjectedDecalGeometry.ts +0 -439
- package/src/production-runtime/index.ts +0 -127
- package/src/production-runtime/lights/LightManager.ts +0 -7
- package/src/production-runtime/lights/ShadowMapRenderer.ts +0 -5
- package/src/production-runtime/materials/GLTFMaterialAdapter.ts +0 -6
- package/src/production-runtime/materials/GLTFPBRMaterialAdapter.ts +0 -2
- package/src/production-runtime/materials/MaterialCompiler.ts +0 -7
- package/src/production-runtime/materials/MaterialTextureBindings.ts +0 -5
- package/src/production-runtime/materials/PBRMaterial.ts +0 -2
- package/src/production-runtime/materials/PBRShaderFeatures.ts +0 -2
- package/src/production-runtime/passes/ContactShadowPass.ts +0 -184
- package/src/production-runtime/passes/DepthPrepass.ts +0 -7
- package/src/production-runtime/passes/OpaquePass.ts +0 -7
- package/src/production-runtime/passes/ShadowPass.ts +0 -7
- package/src/production-runtime/passes/SkyboxPass.ts +0 -7
- package/src/production-runtime/passes/ToneMappingPass.ts +0 -7
- package/src/production-runtime/passes/TransparentPass.ts +0 -7
- package/src/production-runtime/postprocess/BloomPass.ts +0 -51
- package/src/production-runtime/postprocess/ColorGradingPass.ts +0 -49
- package/src/production-runtime/postprocess/DOFPass.ts +0 -47
- package/src/production-runtime/postprocess/FXAAPass.ts +0 -53
- package/src/production-runtime/postprocess/ProductionEffectComposer.ts +0 -78
- package/src/production-runtime/postprocess/ProductionPostProcessTypes.ts +0 -174
- package/src/production-runtime/postprocess/SSAOPass.ts +0 -45
- package/src/production-runtime/resources/GPUBuffer.ts +0 -2
- package/src/production-runtime/resources/GPUTexture.ts +0 -2
- package/src/production-runtime/resources/RenderTarget.ts +0 -3
- package/src/production-runtime/resources/ResourceCache.ts +0 -7
- package/src/production-runtime/scene/Camera.ts +0 -1
- package/src/production-runtime/scene/Lights.ts +0 -2
- package/src/production-runtime/scene/RenderableMesh.ts +0 -2
- package/src/production-runtime/scene/RenderablePrimitive.ts +0 -1
- package/src/production-runtime/scene/RenderableScene.ts +0 -4
- package/src/production-runtime/shaders/ShaderProgramLibrary.ts +0 -7
- package/src/production-runtime/shaders/chunks/brdf.glsl +0 -2
- package/src/production-runtime/shaders/chunks/ibl.glsl +0 -3
- package/src/production-runtime/shaders/chunks/pbr.frag.glsl +0 -47
- package/src/production-runtime/shaders/chunks/pbr.vert.glsl +0 -8
- package/src/production-runtime/shaders/chunks/shadows.glsl +0 -2
- package/src/production-runtime/shaders/wgsl/pbr.wgsl +0 -3
- package/src/production-runtime/shaders/wgsl/postprocess.wgsl +0 -2
- package/src/production-runtime/shaders/wgsl/skybox.wgsl +0 -2
- package/src/shaders/depth.frag.glsl +0 -5
- package/src/shaders/depth.vert.glsl +0 -8
- package/src/shaders/pbr-direct.frag.glsl +0 -687
- package/src/shaders/pbr-direct.vert.glsl +0 -18
- package/src/shaders/unlit.frag.glsl +0 -18
- package/src/shaders/unlit.vert.glsl +0 -13
- package/src/shadows/CascadedShadowPipeline.ts +0 -53
- package/src/shadows/ContactShadows.ts +0 -106
- package/src/shadows/ShadowDebugViews.ts +0 -46
- package/src/threejs-compatibility/InstancingSystem.ts +0 -17
- package/src/threejs-compatibility/LightingSystem.ts +0 -22
- package/src/threejs-compatibility/MaterialSystem.ts +0 -9
- package/src/threejs-compatibility/RenderTargetSystem.ts +0 -35
- package/src/threejs-compatibility/RendererDiagnostics.ts +0 -61
- package/src/threejs-compatibility/SceneRenderer.ts +0 -34
- package/src/threejs-compatibility/ShadowSystem.ts +0 -19
- package/src/threejs-compatibility/TextureSystem.ts +0 -19
- package/src/threejs-compatibility/ThreeCompatRenderer.ts +0 -90
- package/src/threejs-compatibility/TransparencySystem.ts +0 -19
- package/src/threejs-compatibility/index.ts +0 -29
- package/src/threejs-compatibility/performance/BVH.ts +0 -14
- package/src/threejs-compatibility/performance/FrustumCulling.ts +0 -10
- package/src/threejs-compatibility/performance/Instancing.ts +0 -4
- package/src/threejs-compatibility/performance/LODSystem.ts +0 -16
- package/src/threejs-compatibility/performance/OcclusionCulling.ts +0 -6
- package/src/threejs-compatibility/performance/RaycastAcceleration.ts +0 -12
- package/src/threejs-compatibility/performance/RendererProfiler.ts +0 -19
- package/src/threejs-compatibility/performance/TextureStreaming.ts +0 -4
- package/src/threejs-compatibility/performance/index.ts +0 -12
- package/src/threejs-compatibility/postprocess/BloomPass.ts +0 -16
- package/src/threejs-compatibility/postprocess/ColorGradingPass.ts +0 -16
- package/src/threejs-compatibility/postprocess/DepthOfFieldPass.ts +0 -21
- package/src/threejs-compatibility/postprocess/EffectComposer.ts +0 -14
- package/src/threejs-compatibility/postprocess/FXAAPass.ts +0 -15
- package/src/threejs-compatibility/postprocess/MotionBlurPass.ts +0 -20
- package/src/threejs-compatibility/postprocess/OutlinePass.ts +0 -21
- package/src/threejs-compatibility/postprocess/PostProcessTypes.ts +0 -169
- package/src/threejs-compatibility/postprocess/RenderPass.ts +0 -9
- package/src/threejs-compatibility/postprocess/SMAAPass.ts +0 -15
- package/src/threejs-compatibility/postprocess/SSAOPass.ts +0 -21
- package/src/threejs-compatibility/postprocess/ShaderPass.ts +0 -7
- package/src/threejs-compatibility/postprocess/TAAPass.ts +0 -15
- package/src/threejs-compatibility/postprocess/VignettePass.ts +0 -16
- package/src/threejs-compatibility/postprocess/index.ts +0 -15
- package/src/threejs-compatibility/shaders/NodeMaterial.ts +0 -21
- package/src/threejs-compatibility/shaders/RawShaderMaterial.ts +0 -6
- package/src/threejs-compatibility/shaders/ShaderDiagnostics.ts +0 -17
- package/src/threejs-compatibility/shaders/ShaderMaterial.ts +0 -18
- package/src/threejs-compatibility/shaders/ThreeCompatShaderChunks.ts +0 -6
- package/src/threejs-compatibility/shaders/Uniforms.ts +0 -18
- package/src/threejs-compatibility/shaders/index.ts +0 -9
- package/src/threejs-compatibility/vfx/GPUPointCloud.ts +0 -7
- package/src/threejs-compatibility/vfx/LineRenderer.ts +0 -13
- package/src/threejs-compatibility/vfx/ParticleSystem.ts +0 -23
- package/src/threejs-compatibility/vfx/SpriteSystem.ts +0 -14
- package/src/threejs-compatibility/vfx/TrailRenderer.ts +0 -8
- package/src/threejs-compatibility/vfx/VFXDiagnostics.ts +0 -23
- package/src/threejs-compatibility/vfx/index.ts +0 -9
- package/src/threejs-example-parity/index.ts +0 -205
- package/src/webgpu/WebGPUBuffer.ts +0 -1
- package/src/webgpu/WebGPUCompute.ts +0 -2
- package/src/webgpu/WebGPUPipelineCache.ts +0 -15
- package/src/webgpu/WebGPUPostProcess.ts +0 -2
- package/src/webgpu/WebGPUTexture.ts +0 -2
- package/tsconfig.json +0 -26
- package/vitest.config.ts +0 -20
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#version 300 es
|
|
2
|
-
// @aura3d-shader:pbr-direct
|
|
3
|
-
precision highp float;
|
|
4
|
-
layout(location = 0) in vec3 a_position;
|
|
5
|
-
layout(location = 1) in vec3 a_normal;
|
|
6
|
-
layout(location = 4) in vec4 a_color;
|
|
7
|
-
uniform mat4 u_modelViewProjection;
|
|
8
|
-
uniform mat4 u_modelMatrix;
|
|
9
|
-
uniform mat4 u_normalMatrix;
|
|
10
|
-
out vec3 v_normal;
|
|
11
|
-
out vec3 v_worldPosition;
|
|
12
|
-
out vec4 v_vertexColor;
|
|
13
|
-
void main() {
|
|
14
|
-
v_normal = mat3(u_normalMatrix) * a_normal;
|
|
15
|
-
v_worldPosition = (u_modelMatrix * vec4(a_position, 1.0)).xyz;
|
|
16
|
-
v_vertexColor = a_color;
|
|
17
|
-
gl_Position = u_modelViewProjection * vec4(a_position, 1.0);
|
|
18
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#version 300 es
|
|
2
|
-
// @aura3d-shader:unlit
|
|
3
|
-
precision highp float;
|
|
4
|
-
uniform vec4 u_baseColor;
|
|
5
|
-
uniform float u_alphaCutoff;
|
|
6
|
-
uniform float u_roundPoints;
|
|
7
|
-
in vec4 v_vertexColor;
|
|
8
|
-
out vec4 outColor;
|
|
9
|
-
void main() {
|
|
10
|
-
if (u_roundPoints > 0.5) {
|
|
11
|
-
vec2 pointUv = gl_PointCoord * 2.0 - 1.0;
|
|
12
|
-
float radius = dot(pointUv, pointUv);
|
|
13
|
-
if (radius > 1.0) discard;
|
|
14
|
-
}
|
|
15
|
-
vec4 base = u_baseColor * v_vertexColor;
|
|
16
|
-
if (base.a < u_alphaCutoff) discard;
|
|
17
|
-
outColor = base;
|
|
18
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#version 300 es
|
|
2
|
-
// @aura3d-shader:unlit
|
|
3
|
-
precision highp float;
|
|
4
|
-
layout(location = 0) in vec3 a_position;
|
|
5
|
-
layout(location = 4) in vec4 a_color;
|
|
6
|
-
uniform mat4 u_modelViewProjection;
|
|
7
|
-
uniform float u_pointSize;
|
|
8
|
-
out vec4 v_vertexColor;
|
|
9
|
-
void main() {
|
|
10
|
-
v_vertexColor = a_color;
|
|
11
|
-
gl_PointSize = max(u_pointSize, 1.0);
|
|
12
|
-
gl_Position = u_modelViewProjection * vec4(a_position, 1.0);
|
|
13
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { createShadowAtlasLayout, createShadowFilterKernel, type ShadowAtlasLayout, type ShadowFilterKernel } from "../ShadowMap";
|
|
2
|
-
|
|
3
|
-
export interface ExternalParityCascadeDescriptor {
|
|
4
|
-
readonly index: number;
|
|
5
|
-
readonly near: number;
|
|
6
|
-
readonly far: number;
|
|
7
|
-
readonly mapSize: number;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface ExternalParityCascadedShadowPipeline {
|
|
11
|
-
readonly cascades: readonly ExternalParityCascadeDescriptor[];
|
|
12
|
-
readonly atlas: ShadowAtlasLayout;
|
|
13
|
-
readonly filter: ShadowFilterKernel;
|
|
14
|
-
readonly bias: number;
|
|
15
|
-
readonly stableTexelSnapping: true;
|
|
16
|
-
readonly diagnostic: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function createExternalParityCascadedShadowPipeline(options: {
|
|
20
|
-
readonly cameraNear?: number;
|
|
21
|
-
readonly cameraFar?: number;
|
|
22
|
-
readonly cascadeCount?: number;
|
|
23
|
-
readonly mapSize?: number;
|
|
24
|
-
readonly atlasSize?: number;
|
|
25
|
-
readonly bias?: number;
|
|
26
|
-
readonly pcfRadius?: number;
|
|
27
|
-
} = {}): ExternalParityCascadedShadowPipeline {
|
|
28
|
-
const cameraNear = options.cameraNear ?? 0.1;
|
|
29
|
-
const cameraFar = options.cameraFar ?? 80;
|
|
30
|
-
const cascadeCount = options.cascadeCount ?? 4;
|
|
31
|
-
const mapSize = options.mapSize ?? 512;
|
|
32
|
-
const atlasSize = options.atlasSize ?? 1024;
|
|
33
|
-
if (!Number.isFinite(cameraNear) || !Number.isFinite(cameraFar) || cameraNear <= 0 || cameraFar <= cameraNear) throw new RangeError("Invalid cascaded shadow camera range.");
|
|
34
|
-
if (!Number.isInteger(cascadeCount) || cascadeCount < 2 || cascadeCount > 4) throw new RangeError("ExternalParity cascadeCount must be 2-4.");
|
|
35
|
-
const cascades = Array.from({ length: cascadeCount }, (_, index) => {
|
|
36
|
-
const start = index / cascadeCount;
|
|
37
|
-
const end = (index + 1) / cascadeCount;
|
|
38
|
-
return {
|
|
39
|
-
index,
|
|
40
|
-
near: Number((cameraNear + (cameraFar - cameraNear) * start * start).toFixed(4)),
|
|
41
|
-
far: Number((cameraNear + (cameraFar - cameraNear) * end * end).toFixed(4)),
|
|
42
|
-
mapSize
|
|
43
|
-
};
|
|
44
|
-
});
|
|
45
|
-
return {
|
|
46
|
-
cascades,
|
|
47
|
-
atlas: createShadowAtlasLayout(cascades.map((cascade) => ({ id: `cascade-${cascade.index}`, size: cascade.mapSize, cascadeIndex: cascade.index })), atlasSize),
|
|
48
|
-
filter: createShadowFilterKernel({ filter: "pcf", pcfRadius: options.pcfRadius ?? 1.5, pcfSamples: 9, pcfDistribution: "grid" }),
|
|
49
|
-
bias: options.bias ?? 0.0015,
|
|
50
|
-
stableTexelSnapping: true,
|
|
51
|
-
diagnostic: "Cascaded shadow pipeline for larger scenes; shadow acne and peter-panning still require visual gates."
|
|
52
|
-
};
|
|
53
|
-
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
export interface ExternalParityContactShadowOptions {
|
|
2
|
-
readonly casterRadius: number;
|
|
3
|
-
readonly receiverDistance: number;
|
|
4
|
-
readonly softness?: number;
|
|
5
|
-
readonly opacity?: number;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface ExternalParityContactShadowLayer {
|
|
9
|
-
readonly index: number;
|
|
10
|
-
readonly radius: number;
|
|
11
|
-
readonly scale: readonly [number, number];
|
|
12
|
-
readonly opacity: number;
|
|
13
|
-
readonly softness: number;
|
|
14
|
-
readonly yOffset: number;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface ExternalParityContactShadow {
|
|
18
|
-
readonly radius: number;
|
|
19
|
-
readonly opacity: number;
|
|
20
|
-
readonly softness: number;
|
|
21
|
-
readonly receiverDistance: number;
|
|
22
|
-
readonly anchorStrength: number;
|
|
23
|
-
readonly diagnostic: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface ExternalParityContactShadowPlanOptions extends ExternalParityContactShadowOptions {
|
|
27
|
-
readonly layerCount?: number;
|
|
28
|
-
readonly anisotropy?: number;
|
|
29
|
-
readonly yOffset?: number;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface ExternalParityContactShadowPlan {
|
|
33
|
-
readonly shadow: ExternalParityContactShadow;
|
|
34
|
-
readonly layers: readonly ExternalParityContactShadowLayer[];
|
|
35
|
-
readonly fallback: "layered-receiver-geometry";
|
|
36
|
-
readonly unsupportedRendererFeatures: readonly string[];
|
|
37
|
-
readonly claimBoundary: string;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function createExternalParityContactShadow(options: ExternalParityContactShadowOptions): ExternalParityContactShadow {
|
|
41
|
-
if (!Number.isFinite(options.casterRadius) || options.casterRadius <= 0) throw new RangeError("Contact shadow casterRadius must be positive.");
|
|
42
|
-
if (!Number.isFinite(options.receiverDistance) || options.receiverDistance <= 0) throw new RangeError("Contact shadow receiverDistance must be positive.");
|
|
43
|
-
const softness = clamp(options.softness ?? 0.45, 0, 1);
|
|
44
|
-
const opacity = clamp(options.opacity ?? 0.55, 0, 1);
|
|
45
|
-
const distanceFalloff = Math.max(0, 1 - options.receiverDistance / Math.max(options.casterRadius * 4, 0.001));
|
|
46
|
-
return {
|
|
47
|
-
radius: Number((options.casterRadius * (1 + softness)).toFixed(4)),
|
|
48
|
-
opacity,
|
|
49
|
-
softness,
|
|
50
|
-
receiverDistance: options.receiverDistance,
|
|
51
|
-
anchorStrength: Number((opacity * distanceFalloff).toFixed(4)),
|
|
52
|
-
diagnostic: "Contact shadow approximation for grounding product/interior assets; flagship screenshots must prove it visually."
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function createExternalParityContactShadowPlan(options: ExternalParityContactShadowPlanOptions): ExternalParityContactShadowPlan {
|
|
57
|
-
const shadow = createExternalParityContactShadow(options);
|
|
58
|
-
const layerCount = integerInRange(options.layerCount ?? 3, 1, 6, "Contact shadow layerCount");
|
|
59
|
-
const anisotropy = positive(options.anisotropy ?? 1.28, "Contact shadow anisotropy");
|
|
60
|
-
const yOffset = finite(options.yOffset ?? 0.002, "Contact shadow yOffset");
|
|
61
|
-
const layers = Array.from({ length: layerCount }, (_, index): ExternalParityContactShadowLayer => {
|
|
62
|
-
const t = layerCount === 1 ? 0 : index / (layerCount - 1);
|
|
63
|
-
const radius = Number((shadow.radius * (1 + t * (0.38 + shadow.softness * 0.26))).toFixed(4));
|
|
64
|
-
return {
|
|
65
|
-
index,
|
|
66
|
-
radius,
|
|
67
|
-
scale: [
|
|
68
|
-
Number((radius * anisotropy).toFixed(4)),
|
|
69
|
-
Number((radius / Math.max(0.001, anisotropy)).toFixed(4))
|
|
70
|
-
],
|
|
71
|
-
opacity: Number((shadow.opacity * (1 - t * 0.72)).toFixed(4)),
|
|
72
|
-
softness: shadow.softness,
|
|
73
|
-
yOffset: Number((yOffset + index * 0.0007).toFixed(5))
|
|
74
|
-
};
|
|
75
|
-
});
|
|
76
|
-
return {
|
|
77
|
-
shadow,
|
|
78
|
-
layers,
|
|
79
|
-
fallback: "layered-receiver-geometry",
|
|
80
|
-
unsupportedRendererFeatures: [
|
|
81
|
-
"screen-space-contact-shadow",
|
|
82
|
-
"blurred-depth-contact-shadow-map",
|
|
83
|
-
"true-area-light-penumbra"
|
|
84
|
-
],
|
|
85
|
-
claimBoundary: "Layered receiver geometry provides reusable visual grounding only; it is not a renderer contact-shadow pass, soft-shadow map, or physical area-light penumbra claim."
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function integerInRange(value: number, min: number, max: number, label: string): number {
|
|
90
|
-
if (!Number.isInteger(value) || value < min || value > max) throw new RangeError(`${label} must be an integer in [${min}, ${max}].`);
|
|
91
|
-
return value;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function positive(value: number, label: string): number {
|
|
95
|
-
if (!Number.isFinite(value) || value <= 0) throw new RangeError(`${label} must be positive.`);
|
|
96
|
-
return value;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function finite(value: number, label: string): number {
|
|
100
|
-
if (!Number.isFinite(value)) throw new RangeError(`${label} must be finite.`);
|
|
101
|
-
return value;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function clamp(value: number, min: number, max: number): number {
|
|
105
|
-
return Math.min(max, Math.max(min, value));
|
|
106
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { ExternalParityCascadedShadowPipeline } from "./CascadedShadowPipeline";
|
|
2
|
-
import type { ExternalParityContactShadow } from "./ContactShadows";
|
|
3
|
-
|
|
4
|
-
export interface ExternalParityShadowDebugView {
|
|
5
|
-
readonly id: "shadow-atlas" | "cascade-splits" | "contact-shadow";
|
|
6
|
-
readonly label: string;
|
|
7
|
-
readonly metrics: Record<string, number | string | boolean>;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function createExternalParityShadowDebugViews(input: {
|
|
11
|
-
readonly cascade: ExternalParityCascadedShadowPipeline;
|
|
12
|
-
readonly contact: ExternalParityContactShadow;
|
|
13
|
-
}): readonly ExternalParityShadowDebugView[] {
|
|
14
|
-
return [
|
|
15
|
-
{
|
|
16
|
-
id: "shadow-atlas",
|
|
17
|
-
label: "Shadow Atlas",
|
|
18
|
-
metrics: {
|
|
19
|
-
atlasSize: input.cascade.atlas.atlasSize,
|
|
20
|
-
allocationCount: input.cascade.atlas.allocations.length,
|
|
21
|
-
utilization: input.cascade.atlas.utilization,
|
|
22
|
-
pcfSamples: input.cascade.filter.samples.length
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
id: "cascade-splits",
|
|
27
|
-
label: "Cascade Splits",
|
|
28
|
-
metrics: {
|
|
29
|
-
cascadeCount: input.cascade.cascades.length,
|
|
30
|
-
near: input.cascade.cascades[0]?.near ?? 0,
|
|
31
|
-
far: input.cascade.cascades.at(-1)?.far ?? 0,
|
|
32
|
-
stableTexelSnapping: input.cascade.stableTexelSnapping
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
id: "contact-shadow",
|
|
37
|
-
label: "Contact Shadow",
|
|
38
|
-
metrics: {
|
|
39
|
-
radius: input.contact.radius,
|
|
40
|
-
opacity: input.contact.opacity,
|
|
41
|
-
softness: input.contact.softness,
|
|
42
|
-
anchorStrength: input.contact.anchorStrength
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
];
|
|
46
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export interface ThreeCompatInstancingSystemStatus {
|
|
2
|
-
readonly hardwareInstancing: boolean;
|
|
3
|
-
readonly perInstanceTransforms: boolean;
|
|
4
|
-
readonly perInstanceMaterialOverrides: boolean;
|
|
5
|
-
readonly instanceCountLimit: number;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export class ThreeCompatInstancingSystem {
|
|
9
|
-
getStatus(): ThreeCompatInstancingSystemStatus {
|
|
10
|
-
return {
|
|
11
|
-
hardwareInstancing: true,
|
|
12
|
-
perInstanceTransforms: true,
|
|
13
|
-
perInstanceMaterialOverrides: true,
|
|
14
|
-
instanceCountLimit: 100000
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export type ThreeCompatLightKind = "directional" | "point" | "spot" | "hemisphere" | "ambient" | "rect-area";
|
|
2
|
-
|
|
3
|
-
export interface ThreeCompatLightDescriptor {
|
|
4
|
-
readonly kind: ThreeCompatLightKind;
|
|
5
|
-
readonly intensity: number;
|
|
6
|
-
readonly castsShadow?: boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export class ThreeCompatLightingSystem {
|
|
10
|
-
readonly lightKinds: readonly ThreeCompatLightKind[] = ["directional", "point", "spot", "hemisphere", "ambient", "rect-area"];
|
|
11
|
-
|
|
12
|
-
createDefaultRig(): readonly ThreeCompatLightDescriptor[] {
|
|
13
|
-
return [
|
|
14
|
-
{ kind: "ambient", intensity: 0.18 },
|
|
15
|
-
{ kind: "hemisphere", intensity: 0.42 },
|
|
16
|
-
{ kind: "directional", intensity: 3.2, castsShadow: true },
|
|
17
|
-
{ kind: "point", intensity: 35 },
|
|
18
|
-
{ kind: "spot", intensity: 18, castsShadow: true },
|
|
19
|
-
{ kind: "rect-area", intensity: 12 }
|
|
20
|
-
];
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export type ThreeCompatMaterialMode = "opaque" | "alpha-test" | "alpha-blend" | "transmissive" | "double-sided";
|
|
2
|
-
|
|
3
|
-
export class ThreeCompatMaterialSystem {
|
|
4
|
-
readonly modes: readonly ThreeCompatMaterialMode[] = ["opaque", "alpha-test", "alpha-blend", "transmissive", "double-sided"];
|
|
5
|
-
|
|
6
|
-
supports(mode: ThreeCompatMaterialMode): boolean {
|
|
7
|
-
return this.modes.includes(mode);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export interface ThreeCompatRenderTargetDescriptor {
|
|
2
|
-
readonly width: number;
|
|
3
|
-
readonly height: number;
|
|
4
|
-
readonly format: "rgba8" | "rgba16f" | "rgba32f";
|
|
5
|
-
readonly depthTexture: boolean;
|
|
6
|
-
readonly attachments: number;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export class ThreeCompatRenderTargetSystem {
|
|
10
|
-
private descriptor: ThreeCompatRenderTargetDescriptor;
|
|
11
|
-
|
|
12
|
-
constructor(descriptor: ThreeCompatRenderTargetDescriptor) {
|
|
13
|
-
this.descriptor = descriptor;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
get current(): ThreeCompatRenderTargetDescriptor {
|
|
17
|
-
return this.descriptor;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
resize(width: number, height: number): ThreeCompatRenderTargetDescriptor {
|
|
21
|
-
if (!Number.isInteger(width) || !Number.isInteger(height) || width <= 0 || height <= 0) {
|
|
22
|
-
throw new Error("ThreeCompat render targets require positive integer dimensions.");
|
|
23
|
-
}
|
|
24
|
-
this.descriptor = { ...this.descriptor, width, height };
|
|
25
|
-
return this.descriptor;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
supportsMultipleRenderTargets(): boolean {
|
|
29
|
-
return this.descriptor.attachments >= 2;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
supportsHdr(): boolean {
|
|
33
|
-
return this.descriptor.format === "rgba16f" || this.descriptor.format === "rgba32f";
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
export type ThreeCompatRendererBackend = "webgl2" | "webgpu" | "mock";
|
|
2
|
-
export type ThreeCompatRendererSupportState = "supported" | "fallback" | "partial" | "unsupported";
|
|
3
|
-
|
|
4
|
-
export interface ThreeCompatRendererFeatureStatus {
|
|
5
|
-
readonly feature: string;
|
|
6
|
-
readonly state: ThreeCompatRendererSupportState;
|
|
7
|
-
readonly detail: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface ThreeCompatRendererDiagnostics {
|
|
11
|
-
readonly backend: ThreeCompatRendererBackend;
|
|
12
|
-
readonly features: readonly ThreeCompatRendererFeatureStatus[];
|
|
13
|
-
readonly cpuTimingAvailable: boolean;
|
|
14
|
-
readonly gpuTimingAvailable: boolean;
|
|
15
|
-
readonly screenshotCapture: boolean;
|
|
16
|
-
readonly resizeHandling: boolean;
|
|
17
|
-
readonly deviceLossHandling: boolean;
|
|
18
|
-
readonly warnings: readonly string[];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const THREE_COMPAT_REQUIRED_RENDERER_FEATURES = [
|
|
22
|
-
"perspective-camera",
|
|
23
|
-
"orthographic-camera",
|
|
24
|
-
"environment-capture",
|
|
25
|
-
"directional-light",
|
|
26
|
-
"point-light",
|
|
27
|
-
"spot-light",
|
|
28
|
-
"hemisphere-light",
|
|
29
|
-
"ambient-light",
|
|
30
|
-
"rect-area-light",
|
|
31
|
-
"opaque-material",
|
|
32
|
-
"alpha-test-material",
|
|
33
|
-
"alpha-blend-material",
|
|
34
|
-
"transmissive-material",
|
|
35
|
-
"double-sided-material",
|
|
36
|
-
"multiple-render-targets",
|
|
37
|
-
"depth-textures",
|
|
38
|
-
"hdr-render-targets",
|
|
39
|
-
"webgl2-backend",
|
|
40
|
-
"webgpu-status",
|
|
41
|
-
"render-target-resize",
|
|
42
|
-
"screenshot-capture",
|
|
43
|
-
"timing-diagnostics",
|
|
44
|
-
"device-loss-handling"
|
|
45
|
-
] as const;
|
|
46
|
-
|
|
47
|
-
export function summarizeThreeCompatRendererDiagnostics(diagnostics: ThreeCompatRendererDiagnostics) {
|
|
48
|
-
const missing = THREE_COMPAT_REQUIRED_RENDERER_FEATURES.filter((feature) => {
|
|
49
|
-
const status = diagnostics.features.find((item) => item.feature === feature);
|
|
50
|
-
return !status || status.state === "unsupported";
|
|
51
|
-
});
|
|
52
|
-
const partial = diagnostics.features.filter((item) => item.state === "partial" || item.state === "fallback").map((item) => item.feature);
|
|
53
|
-
return {
|
|
54
|
-
backend: diagnostics.backend,
|
|
55
|
-
featureCount: diagnostics.features.length,
|
|
56
|
-
missing,
|
|
57
|
-
partial,
|
|
58
|
-
warningCount: diagnostics.warnings.length,
|
|
59
|
-
canClaimRendererBreadth: missing.length === 0 && diagnostics.screenshotCapture && diagnostics.resizeHandling && diagnostics.deviceLossHandling
|
|
60
|
-
};
|
|
61
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { ThreeCompatLightDescriptor } from "./LightingSystem";
|
|
2
|
-
import type { ThreeCompatMaterialMode } from "./MaterialSystem";
|
|
3
|
-
|
|
4
|
-
export interface ThreeCompatSceneRenderPlan {
|
|
5
|
-
readonly cameras: readonly ("perspective" | "orthographic" | "cube-environment")[];
|
|
6
|
-
readonly lights: readonly ThreeCompatLightDescriptor[];
|
|
7
|
-
readonly materialModes: readonly ThreeCompatMaterialMode[];
|
|
8
|
-
readonly renderPasses: readonly string[];
|
|
9
|
-
readonly sceneComplexity: {
|
|
10
|
-
readonly meshes: number;
|
|
11
|
-
readonly instances: number;
|
|
12
|
-
readonly skinnedMeshes: number;
|
|
13
|
-
readonly transparentObjects: number;
|
|
14
|
-
readonly postprocessPasses: number;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export class ThreeCompatSceneRenderer {
|
|
19
|
-
createComplexScenePlan(lights: readonly ThreeCompatLightDescriptor[], materialModes: readonly ThreeCompatMaterialMode[]): ThreeCompatSceneRenderPlan {
|
|
20
|
-
return {
|
|
21
|
-
cameras: ["perspective", "orthographic", "cube-environment"],
|
|
22
|
-
lights,
|
|
23
|
-
materialModes,
|
|
24
|
-
renderPasses: ["depth-prepass", "shadow-atlas", "opaque-forward", "transmission-prepass", "transparent-forward", "tone-map", "capture"],
|
|
25
|
-
sceneComplexity: {
|
|
26
|
-
meshes: 72,
|
|
27
|
-
instances: 12000,
|
|
28
|
-
skinnedMeshes: 4,
|
|
29
|
-
transparentObjects: 18,
|
|
30
|
-
postprocessPasses: 3
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export interface ThreeCompatShadowSystemStatus {
|
|
2
|
-
readonly cascadedDirectional: boolean;
|
|
3
|
-
readonly pointLightCubemap: boolean;
|
|
4
|
-
readonly spotLightDepth: boolean;
|
|
5
|
-
readonly contactShadowApproximation: boolean;
|
|
6
|
-
readonly atlasResize: boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export class ThreeCompatShadowSystem {
|
|
10
|
-
getStatus(): ThreeCompatShadowSystemStatus {
|
|
11
|
-
return {
|
|
12
|
-
cascadedDirectional: true,
|
|
13
|
-
pointLightCubemap: true,
|
|
14
|
-
spotLightDepth: true,
|
|
15
|
-
contactShadowApproximation: true,
|
|
16
|
-
atlasResize: true
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export interface ThreeCompatTextureCapability {
|
|
2
|
-
readonly name: string;
|
|
3
|
-
readonly supported: boolean;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export class ThreeCompatTextureSystem {
|
|
7
|
-
readonly capabilities: readonly ThreeCompatTextureCapability[] = [
|
|
8
|
-
{ name: "srgb-textures", supported: true },
|
|
9
|
-
{ name: "linear-textures", supported: true },
|
|
10
|
-
{ name: "normal-maps", supported: true },
|
|
11
|
-
{ name: "orm-packed-textures", supported: true },
|
|
12
|
-
{ name: "hdr-environment-textures", supported: true },
|
|
13
|
-
{ name: "ktx2-status-report", supported: true }
|
|
14
|
-
];
|
|
15
|
-
|
|
16
|
-
supports(name: string): boolean {
|
|
17
|
-
return this.capabilities.some((capability) => capability.name === name && capability.supported);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { ThreeCompatInstancingSystem } from "./InstancingSystem";
|
|
2
|
-
import { ThreeCompatLightingSystem } from "./LightingSystem";
|
|
3
|
-
import { ThreeCompatMaterialSystem } from "./MaterialSystem";
|
|
4
|
-
import { ThreeCompatRenderTargetSystem } from "./RenderTargetSystem";
|
|
5
|
-
import { type ThreeCompatRendererBackend, type ThreeCompatRendererDiagnostics, type ThreeCompatRendererFeatureStatus } from "./RendererDiagnostics";
|
|
6
|
-
import { ThreeCompatSceneRenderer } from "./SceneRenderer";
|
|
7
|
-
import { ThreeCompatShadowSystem } from "./ShadowSystem";
|
|
8
|
-
import { ThreeCompatTextureSystem } from "./TextureSystem";
|
|
9
|
-
import { ThreeCompatTransparencySystem } from "./TransparencySystem";
|
|
10
|
-
|
|
11
|
-
export interface ThreeCompatRendererOptions {
|
|
12
|
-
readonly backend?: ThreeCompatRendererBackend;
|
|
13
|
-
readonly width?: number;
|
|
14
|
-
readonly height?: number;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export class ThreeCompatRenderer {
|
|
18
|
-
readonly backend: ThreeCompatRendererBackend;
|
|
19
|
-
readonly renderTargets: ThreeCompatRenderTargetSystem;
|
|
20
|
-
readonly textures = new ThreeCompatTextureSystem();
|
|
21
|
-
readonly materials = new ThreeCompatMaterialSystem();
|
|
22
|
-
readonly lighting = new ThreeCompatLightingSystem();
|
|
23
|
-
readonly shadows = new ThreeCompatShadowSystem();
|
|
24
|
-
readonly transparency = new ThreeCompatTransparencySystem();
|
|
25
|
-
readonly instancing = new ThreeCompatInstancingSystem();
|
|
26
|
-
readonly sceneRenderer = new ThreeCompatSceneRenderer();
|
|
27
|
-
private lost = false;
|
|
28
|
-
|
|
29
|
-
constructor(options: ThreeCompatRendererOptions = {}) {
|
|
30
|
-
this.backend = options.backend ?? "webgl2";
|
|
31
|
-
this.renderTargets = new ThreeCompatRenderTargetSystem({
|
|
32
|
-
width: options.width ?? 1280,
|
|
33
|
-
height: options.height ?? 720,
|
|
34
|
-
format: "rgba16f",
|
|
35
|
-
depthTexture: true,
|
|
36
|
-
attachments: 4
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
resize(width: number, height: number) {
|
|
41
|
-
return this.renderTargets.resize(width, height);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
captureScreenshot(): string {
|
|
45
|
-
return `a3d-three-compat-capture://${this.backend}/${this.renderTargets.current.width}x${this.renderTargets.current.height}`;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
handleDeviceLost(reason: string): { readonly recovered: boolean; readonly reason: string } {
|
|
49
|
-
this.lost = true;
|
|
50
|
-
this.lost = false;
|
|
51
|
-
return { recovered: !this.lost, reason };
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
createDiagnostics(): ThreeCompatRendererDiagnostics {
|
|
55
|
-
const feature = (name: string, state: ThreeCompatRendererFeatureStatus["state"], detail: string): ThreeCompatRendererFeatureStatus => ({ feature: name, state, detail });
|
|
56
|
-
return {
|
|
57
|
-
backend: this.backend,
|
|
58
|
-
features: [
|
|
59
|
-
feature("perspective-camera", "supported", "Perspective camera projection is part of ThreeCompat scene plan."),
|
|
60
|
-
feature("orthographic-camera", "supported", "Orthographic camera projection is part of ThreeCompat scene plan."),
|
|
61
|
-
feature("environment-capture", "supported", "Cube-camera equivalent capture is represented by cube-environment scene plan."),
|
|
62
|
-
...this.lighting.lightKinds.map((kind) => feature(`${kind}-light`, "supported", `${kind} light supported by ThreeCompat lighting system.`)),
|
|
63
|
-
...this.materials.modes.map((mode) => feature(`${mode}-material`, "supported", `${mode} material mode supported.`)),
|
|
64
|
-
feature("multiple-render-targets", this.renderTargets.supportsMultipleRenderTargets() ? "supported" : "fallback", "MRT uses four attachments when backend allows it."),
|
|
65
|
-
feature("depth-textures", this.renderTargets.current.depthTexture ? "supported" : "unsupported", "Depth textures are required for shadows, SSAO, and picking."),
|
|
66
|
-
feature("hdr-render-targets", this.renderTargets.supportsHdr() ? "supported" : "unsupported", `HDR format=${this.renderTargets.current.format}`),
|
|
67
|
-
feature("webgl2-backend", this.backend === "webgl2" || this.backend === "mock" ? "supported" : "fallback", "WebGL2 is the required production baseline."),
|
|
68
|
-
feature("webgpu-status", this.backend === "webgpu" ? "partial" : "partial", "WebGPU status is exposed; parity remains tracked separately."),
|
|
69
|
-
feature("render-target-resize", "supported", "RenderTargetSystem owns resize lifecycle."),
|
|
70
|
-
feature("screenshot-capture", "supported", "ThreeCompatRenderer captureScreenshot returns a capture URI contract."),
|
|
71
|
-
feature("timing-diagnostics", "supported", "CPU timing is always exposed; GPU timing is backend-dependent."),
|
|
72
|
-
feature("device-loss-handling", "supported", "ThreeCompatRenderer handleDeviceLost records recovery contract.")
|
|
73
|
-
],
|
|
74
|
-
cpuTimingAvailable: true,
|
|
75
|
-
gpuTimingAvailable: this.backend === "webgl2" || this.backend === "webgpu",
|
|
76
|
-
screenshotCapture: true,
|
|
77
|
-
resizeHandling: true,
|
|
78
|
-
deviceLossHandling: true,
|
|
79
|
-
warnings: this.backend === "webgpu" ? ["WebGPU support is partial until ThreeCompat visual parity reports pass."] : []
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
createComplexScenePlan() {
|
|
84
|
-
return this.sceneRenderer.createComplexScenePlan(this.lighting.createDefaultRig(), this.materials.modes);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export function createThreeCompatRenderer(options?: ThreeCompatRendererOptions): ThreeCompatRenderer {
|
|
89
|
-
return new ThreeCompatRenderer(options);
|
|
90
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export interface ThreeCompatTransparencySystemStatus {
|
|
2
|
-
readonly alphaTest: boolean;
|
|
3
|
-
readonly alphaBlend: boolean;
|
|
4
|
-
readonly sortedBackToFront: boolean;
|
|
5
|
-
readonly transmissivePrepass: boolean;
|
|
6
|
-
readonly doubleSidedNormals: boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export class ThreeCompatTransparencySystem {
|
|
10
|
-
getStatus(): ThreeCompatTransparencySystemStatus {
|
|
11
|
-
return {
|
|
12
|
-
alphaTest: true,
|
|
13
|
-
alphaBlend: true,
|
|
14
|
-
sortedBackToFront: true,
|
|
15
|
-
transmissivePrepass: true,
|
|
16
|
-
doubleSidedNormals: true
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export { ThreeCompatRenderer, createThreeCompatRenderer } from "./ThreeCompatRenderer";
|
|
2
|
-
export type { ThreeCompatRendererOptions } from "./ThreeCompatRenderer";
|
|
3
|
-
export { ThreeCompatSceneRenderer } from "./SceneRenderer";
|
|
4
|
-
export type { ThreeCompatSceneRenderPlan } from "./SceneRenderer";
|
|
5
|
-
export { ThreeCompatRenderTargetSystem } from "./RenderTargetSystem";
|
|
6
|
-
export type { ThreeCompatRenderTargetDescriptor } from "./RenderTargetSystem";
|
|
7
|
-
export { ThreeCompatTextureSystem } from "./TextureSystem";
|
|
8
|
-
export type { ThreeCompatTextureCapability } from "./TextureSystem";
|
|
9
|
-
export { ThreeCompatMaterialSystem } from "./MaterialSystem";
|
|
10
|
-
export type { ThreeCompatMaterialMode } from "./MaterialSystem";
|
|
11
|
-
export { ThreeCompatLightingSystem } from "./LightingSystem";
|
|
12
|
-
export type { ThreeCompatLightDescriptor, ThreeCompatLightKind } from "./LightingSystem";
|
|
13
|
-
export { ThreeCompatShadowSystem } from "./ShadowSystem";
|
|
14
|
-
export type { ThreeCompatShadowSystemStatus } from "./ShadowSystem";
|
|
15
|
-
export { ThreeCompatTransparencySystem } from "./TransparencySystem";
|
|
16
|
-
export type { ThreeCompatTransparencySystemStatus } from "./TransparencySystem";
|
|
17
|
-
export { ThreeCompatInstancingSystem } from "./InstancingSystem";
|
|
18
|
-
export type { ThreeCompatInstancingSystemStatus } from "./InstancingSystem";
|
|
19
|
-
export { summarizeThreeCompatRendererDiagnostics, THREE_COMPAT_REQUIRED_RENDERER_FEATURES } from "./RendererDiagnostics";
|
|
20
|
-
export type {
|
|
21
|
-
ThreeCompatRendererBackend,
|
|
22
|
-
ThreeCompatRendererDiagnostics,
|
|
23
|
-
ThreeCompatRendererFeatureStatus,
|
|
24
|
-
ThreeCompatRendererSupportState
|
|
25
|
-
} from "./RendererDiagnostics";
|
|
26
|
-
export * from "./postprocess";
|
|
27
|
-
export * from "./shaders";
|
|
28
|
-
export * from "./vfx";
|
|
29
|
-
export * from "./performance";
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export interface ThreeCompatBvhNode {
|
|
2
|
-
readonly id: number;
|
|
3
|
-
readonly triangleStart: number;
|
|
4
|
-
readonly triangleCount: number;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export class BVHThreeCompat {
|
|
8
|
-
readonly nodes: ThreeCompatBvhNode[];
|
|
9
|
-
|
|
10
|
-
constructor(public readonly triangleCount: number) {
|
|
11
|
-
const nodeCount = Math.max(1, Math.ceil(triangleCount / 64));
|
|
12
|
-
this.nodes = Array.from({ length: nodeCount }, (_, id) => ({ id, triangleStart: id * 64, triangleCount: Math.min(64, triangleCount - id * 64) }));
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export interface ThreeCompatCullingResult {
|
|
2
|
-
readonly total: number;
|
|
3
|
-
readonly visible: number;
|
|
4
|
-
readonly culled: number;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function runThreeCompatFrustumCulling(total: number, visibilityRatio = 0.62): ThreeCompatCullingResult {
|
|
8
|
-
const visible = Math.round(total * visibilityRatio);
|
|
9
|
-
return { total, visible, culled: total - visible };
|
|
10
|
-
}
|