@aura3d/rendering 1.3.3 → 1.4.1

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.
Files changed (314) hide show
  1. package/dist/ForwardPass.js +7 -1
  2. package/dist/ForwardPass.js.map +1 -1
  3. package/dist/MorphTarget.d.ts +1 -0
  4. package/dist/MorphTarget.d.ts.map +1 -1
  5. package/dist/MorphTarget.js.map +1 -1
  6. package/dist/Renderer.js +7 -1
  7. package/dist/Renderer.js.map +1 -1
  8. package/package.json +38 -4
  9. package/src/ArchitecturalLightingFixtures.ts +0 -241
  10. package/src/ArchitecturalMaterialCatalog.ts +0 -130
  11. package/src/ArchitecturalMeasurementFixtures.ts +0 -155
  12. package/src/BRDFLut.ts +0 -47
  13. package/src/CameraFraming.ts +0 -200
  14. package/src/CanonicalSceneFixtures.ts +0 -95
  15. package/src/CascadedShadowMaps.ts +0 -449
  16. package/src/ColorManagement.ts +0 -127
  17. package/src/CullingFixtures.ts +0 -280
  18. package/src/DecalGeometry.ts +0 -26
  19. package/src/DepthPass.ts +0 -110
  20. package/src/EnvironmentBackgroundPass.ts +0 -194
  21. package/src/EnvironmentBackgroundResources.ts +0 -309
  22. package/src/EnvironmentLighting.ts +0 -96
  23. package/src/EnvironmentMapResources.ts +0 -1026
  24. package/src/EnvironmentPipeline.ts +0 -69
  25. package/src/EnvironmentPlatform.ts +0 -1306
  26. package/src/EnvironmentPreset.ts +0 -155
  27. package/src/Exposure.ts +0 -66
  28. package/src/ExternalParityRenderPreset.ts +0 -725
  29. package/src/ForwardPass.ts +0 -1663
  30. package/src/FrameVisualMetrics.ts +0 -301
  31. package/src/Geometry.ts +0 -461
  32. package/src/GeometryPrimitives.ts +0 -2
  33. package/src/HDRRenderPipeline.ts +0 -94
  34. package/src/IBL.ts +0 -86
  35. package/src/IndexBuffer.ts +0 -57
  36. package/src/InstancedPBRMaterial.ts +0 -186
  37. package/src/InstancedUnlitMaterial.ts +0 -60
  38. package/src/Instancing.ts +0 -19
  39. package/src/LightCollector.ts +0 -82
  40. package/src/LightUniforms.ts +0 -47
  41. package/src/LightingDebug.ts +0 -80
  42. package/src/LightingDefaults.ts +0 -79
  43. package/src/LightingRig.ts +0 -301
  44. package/src/LineGeometry.ts +0 -2
  45. package/src/Material.ts +0 -209
  46. package/src/MaterialBinding.ts +0 -131
  47. package/src/MaterialInstance.ts +0 -59
  48. package/src/MaterialPresets.ts +0 -272
  49. package/src/MorphTarget.ts +0 -123
  50. package/src/MorphTargetPlan.ts +0 -178
  51. package/src/MorphUnlitMaterial.ts +0 -60
  52. package/src/NormalMappedPBRMaterial.ts +0 -188
  53. package/src/OceanFixtures.ts +0 -318
  54. package/src/PBRLightingDefaults.ts +0 -12
  55. package/src/PBRMaterial.ts +0 -442
  56. package/src/PMREM.ts +0 -53
  57. package/src/PbrReference.ts +0 -681
  58. package/src/PostProcessPass.ts +0 -2507
  59. package/src/ProceduralTextureFixtures.ts +0 -393
  60. package/src/ProductTurntableFixtures.ts +0 -815
  61. package/src/Raycaster.ts +0 -21
  62. package/src/ReflectionProbe.ts +0 -13
  63. package/src/ReflectionSurfaces.ts +0 -219
  64. package/src/RenderBackend.ts +0 -43
  65. package/src/RenderDebugViews.ts +0 -138
  66. package/src/RenderDevice.ts +0 -836
  67. package/src/RenderGraph.ts +0 -194
  68. package/src/RenderPass.ts +0 -27
  69. package/src/RenderPipeline.ts +0 -101
  70. package/src/RenderQueue.ts +0 -12
  71. package/src/RenderState.ts +0 -12
  72. package/src/Renderer.ts +0 -2626
  73. package/src/RendererDebugOverlay.ts +0 -80
  74. package/src/RendererFeatureGates.ts +0 -150
  75. package/src/RendererPostprocessPlan.ts +0 -279
  76. package/src/RendererTiming.ts +0 -251
  77. package/src/RendererVisualPipelineReport.ts +0 -836
  78. package/src/ResourceLifecycle.ts +0 -21
  79. package/src/Sampler.ts +0 -37
  80. package/src/SceneOptimization.ts +0 -518
  81. package/src/ShaderChunks.ts +0 -393
  82. package/src/ShaderLibrary.ts +0 -2766
  83. package/src/ShaderModule.ts +0 -36
  84. package/src/ShaderPreprocessor.ts +0 -260
  85. package/src/ShaderReflection.ts +0 -201
  86. package/src/ShadowMap.ts +0 -237
  87. package/src/ShadowPass.ts +0 -198
  88. package/src/ShadowProjection.ts +0 -115
  89. package/src/SkinnedLitMaterial.ts +0 -397
  90. package/src/SkinnedUnlitMaterial.ts +0 -63
  91. package/src/SkinningBounds.ts +0 -131
  92. package/src/SpaceEnvironmentFixtures.ts +0 -200
  93. package/src/SpriteGeometry.ts +0 -21
  94. package/src/StereoCameraRig.ts +0 -127
  95. package/src/StereoEffects.ts +0 -274
  96. package/src/TerrainFixtures.ts +0 -180
  97. package/src/Texture.ts +0 -307
  98. package/src/TextureBinding.ts +0 -91
  99. package/src/TexturedPBRMaterial.ts +0 -1112
  100. package/src/TexturedUnlitMaterial.ts +0 -67
  101. package/src/ToneMapping.ts +0 -105
  102. package/src/UniformBinder.ts +0 -16
  103. package/src/UniformLayout.ts +0 -129
  104. package/src/UnlitMaterial.ts +0 -75
  105. package/src/VegetationFixtures.ts +0 -314
  106. package/src/VertexBuffer.ts +0 -120
  107. package/src/VertexFormat.ts +0 -171
  108. package/src/VoxelWorldFixtures.ts +0 -280
  109. package/src/WeatherFixtures.ts +0 -223
  110. package/src/WebGL2Device.ts +0 -2280
  111. package/src/WebGL2StateCache.ts +0 -330
  112. package/src/WebGPUDevice.ts +0 -2877
  113. package/src/WebGPURenderToTextureProof.ts +0 -139
  114. package/src/advanced-runtime/AdvancedRenderer.ts +0 -73
  115. package/src/advanced-runtime/index.ts +0 -9
  116. package/src/animation/AnimationMaterialStyle.ts +0 -32
  117. package/src/animation/AnimationRenderPreset.ts +0 -45
  118. package/src/animation/AnimationToonMaterial.ts +0 -387
  119. package/src/animation/AnimationVisualQuality.ts +0 -71
  120. package/src/animation/applyAnimationRenderPreset.ts +0 -180
  121. package/src/animation/index.ts +0 -5
  122. package/src/cinematic/BloomPass.ts +0 -26
  123. package/src/cinematic/CinematicDepthComposition.ts +0 -30
  124. package/src/cinematic/CinematicEvidence.ts +0 -123
  125. package/src/cinematic/CinematicLightingRig.ts +0 -144
  126. package/src/cinematic/CinematicMaterialPresets.ts +0 -130
  127. package/src/cinematic/CinematicPostProcess.ts +0 -83
  128. package/src/cinematic/DepthHazePass.ts +0 -30
  129. package/src/cinematic/EmissivePracticalLightSystem.ts +0 -45
  130. package/src/cinematic/FilmGrainPass.ts +0 -24
  131. package/src/cinematic/FogVolumeSystem.ts +0 -30
  132. package/src/cinematic/GlowCardSystem.ts +0 -44
  133. package/src/cinematic/RainParticleSystem.ts +0 -151
  134. package/src/cinematic/VignettePass.ts +0 -25
  135. package/src/cinematic/WetReflectionApproximation.ts +0 -27
  136. package/src/cinematic/index.ts +0 -14
  137. package/src/effects/CollisionModule.ts +0 -64
  138. package/src/effects/ColorModule.ts +0 -60
  139. package/src/effects/ForceModule.ts +0 -25
  140. package/src/effects/GPUParticleBackend.ts +0 -569
  141. package/src/effects/Particle.ts +0 -108
  142. package/src/effects/ParticleDiagnostics.ts +0 -224
  143. package/src/effects/ParticleEffectPresets.ts +0 -147
  144. package/src/effects/ParticleEmitter.ts +0 -326
  145. package/src/effects/ParticleModule.ts +0 -26
  146. package/src/effects/ParticleRenderPass.ts +0 -117
  147. package/src/effects/ParticleRenderer.ts +0 -132
  148. package/src/effects/ParticleSystem.ts +0 -333
  149. package/src/effects/SizeModule.ts +0 -56
  150. package/src/effects/TrailModule.ts +0 -72
  151. package/src/effects/VelocityModule.ts +0 -75
  152. package/src/effects/index.ts +0 -15
  153. package/src/index.ts +0 -925
  154. package/src/materials/AlphaSorting.ts +0 -30
  155. package/src/materials/MaterialExtensions.ts +0 -42
  156. package/src/materials/PhysicalMaterial.ts +0 -133
  157. package/src/materials/TransmissionPass.ts +0 -51
  158. package/src/performance/BVH.ts +0 -18
  159. package/src/performance/Batcher.ts +0 -2
  160. package/src/performance/FrustumCuller.ts +0 -9
  161. package/src/performance/LOD.ts +0 -20
  162. package/src/performance/Octree.ts +0 -10
  163. package/src/performance/RenderItemSorting.ts +0 -170
  164. package/src/performance/RendererStats.ts +0 -43
  165. package/src/performance/ResourceBudget.ts +0 -44
  166. package/src/postprocess/BloomPass.ts +0 -28
  167. package/src/postprocess/CinematicDiagnostics.ts +0 -642
  168. package/src/postprocess/ColorGradingPass.ts +0 -24
  169. package/src/postprocess/DepthOfFieldPass.ts +0 -12
  170. package/src/postprocess/EffectComposer.ts +0 -349
  171. package/src/postprocess/SSAOPass.ts +0 -20
  172. package/src/postprocess/index.ts +0 -34
  173. package/src/production-runtime/AnimationControlsPipeline.ts +0 -77
  174. package/src/production-runtime/PBRHDRPipeline.ts +0 -381
  175. package/src/production-runtime/ProductionEffectsPipeline.ts +0 -85
  176. package/src/production-runtime/ProductionRendererTypes.ts +0 -136
  177. package/src/production-runtime/ProductionRuntimeRenderer.ts +0 -172
  178. package/src/production-runtime/ProductionWebGL2Renderer.ts +0 -313
  179. package/src/production-runtime/ProductionWebGPURenderer.ts +0 -396
  180. package/src/production-runtime/TransmissionBackdropCapture.ts +0 -130
  181. package/src/production-runtime/animation/MorphTargetRenderer.ts +0 -2
  182. package/src/production-runtime/animation/SkinningRenderer.ts +0 -2
  183. package/src/production-runtime/backends/RendererBackend.ts +0 -17
  184. package/src/production-runtime/backends/WebGL2RendererBackend.ts +0 -30
  185. package/src/production-runtime/backends/WebGPURendererBackend.ts +0 -24
  186. package/src/production-runtime/backends/webgl2/WebGL2Buffer.ts +0 -2
  187. package/src/production-runtime/backends/webgl2/WebGL2Capabilities.ts +0 -2
  188. package/src/production-runtime/backends/webgl2/WebGL2RenderTarget.ts +0 -2
  189. package/src/production-runtime/backends/webgl2/WebGL2Shader.ts +0 -2
  190. package/src/production-runtime/backends/webgl2/WebGL2StateCache.ts +0 -1
  191. package/src/production-runtime/backends/webgl2/WebGL2Texture.ts +0 -2
  192. package/src/production-runtime/backends/webgpu/WebGPUBuffer.ts +0 -2
  193. package/src/production-runtime/backends/webgpu/WebGPUCapabilities.ts +0 -2
  194. package/src/production-runtime/backends/webgpu/WebGPURenderTarget.ts +0 -2
  195. package/src/production-runtime/backends/webgpu/WebGPUShader.ts +0 -2
  196. package/src/production-runtime/backends/webgpu/WebGPUTexture.ts +0 -2
  197. package/src/production-runtime/color/ColorManagement.ts +0 -3
  198. package/src/production-runtime/color/ToneMapping.ts +0 -7
  199. package/src/production-runtime/diagnostics/FrameCapture.ts +0 -2
  200. package/src/production-runtime/diagnostics/GPUCapabilities.ts +0 -2
  201. package/src/production-runtime/diagnostics/RendererStats.ts +0 -2
  202. package/src/production-runtime/environment/EnvironmentMap.ts +0 -1
  203. package/src/production-runtime/environment/HDRLoader.ts +0 -57
  204. package/src/production-runtime/environment/PMREMGenerator.ts +0 -713
  205. package/src/production-runtime/framegraph/FrameGraph.ts +0 -18
  206. package/src/production-runtime/framegraph/RenderPass.ts +0 -15
  207. package/src/production-runtime/geometry/ProjectedDecalGeometry.ts +0 -439
  208. package/src/production-runtime/index.ts +0 -127
  209. package/src/production-runtime/lights/LightManager.ts +0 -7
  210. package/src/production-runtime/lights/ShadowMapRenderer.ts +0 -5
  211. package/src/production-runtime/materials/GLTFMaterialAdapter.ts +0 -6
  212. package/src/production-runtime/materials/GLTFPBRMaterialAdapter.ts +0 -2
  213. package/src/production-runtime/materials/MaterialCompiler.ts +0 -7
  214. package/src/production-runtime/materials/MaterialTextureBindings.ts +0 -5
  215. package/src/production-runtime/materials/PBRMaterial.ts +0 -2
  216. package/src/production-runtime/materials/PBRShaderFeatures.ts +0 -2
  217. package/src/production-runtime/passes/ContactShadowPass.ts +0 -184
  218. package/src/production-runtime/passes/DepthPrepass.ts +0 -7
  219. package/src/production-runtime/passes/OpaquePass.ts +0 -7
  220. package/src/production-runtime/passes/ShadowPass.ts +0 -7
  221. package/src/production-runtime/passes/SkyboxPass.ts +0 -7
  222. package/src/production-runtime/passes/ToneMappingPass.ts +0 -7
  223. package/src/production-runtime/passes/TransparentPass.ts +0 -7
  224. package/src/production-runtime/postprocess/BloomPass.ts +0 -51
  225. package/src/production-runtime/postprocess/ColorGradingPass.ts +0 -49
  226. package/src/production-runtime/postprocess/DOFPass.ts +0 -47
  227. package/src/production-runtime/postprocess/FXAAPass.ts +0 -53
  228. package/src/production-runtime/postprocess/ProductionEffectComposer.ts +0 -78
  229. package/src/production-runtime/postprocess/ProductionPostProcessTypes.ts +0 -174
  230. package/src/production-runtime/postprocess/SSAOPass.ts +0 -45
  231. package/src/production-runtime/resources/GPUBuffer.ts +0 -2
  232. package/src/production-runtime/resources/GPUTexture.ts +0 -2
  233. package/src/production-runtime/resources/RenderTarget.ts +0 -3
  234. package/src/production-runtime/resources/ResourceCache.ts +0 -7
  235. package/src/production-runtime/scene/Camera.ts +0 -1
  236. package/src/production-runtime/scene/Lights.ts +0 -2
  237. package/src/production-runtime/scene/RenderableMesh.ts +0 -2
  238. package/src/production-runtime/scene/RenderablePrimitive.ts +0 -1
  239. package/src/production-runtime/scene/RenderableScene.ts +0 -4
  240. package/src/production-runtime/shaders/ShaderProgramLibrary.ts +0 -7
  241. package/src/production-runtime/shaders/chunks/brdf.glsl +0 -2
  242. package/src/production-runtime/shaders/chunks/ibl.glsl +0 -3
  243. package/src/production-runtime/shaders/chunks/pbr.frag.glsl +0 -47
  244. package/src/production-runtime/shaders/chunks/pbr.vert.glsl +0 -8
  245. package/src/production-runtime/shaders/chunks/shadows.glsl +0 -2
  246. package/src/production-runtime/shaders/wgsl/pbr.wgsl +0 -3
  247. package/src/production-runtime/shaders/wgsl/postprocess.wgsl +0 -2
  248. package/src/production-runtime/shaders/wgsl/skybox.wgsl +0 -2
  249. package/src/shaders/depth.frag.glsl +0 -5
  250. package/src/shaders/depth.vert.glsl +0 -8
  251. package/src/shaders/pbr-direct.frag.glsl +0 -687
  252. package/src/shaders/pbr-direct.vert.glsl +0 -18
  253. package/src/shaders/unlit.frag.glsl +0 -18
  254. package/src/shaders/unlit.vert.glsl +0 -13
  255. package/src/shadows/CascadedShadowPipeline.ts +0 -53
  256. package/src/shadows/ContactShadows.ts +0 -106
  257. package/src/shadows/ShadowDebugViews.ts +0 -46
  258. package/src/threejs-compatibility/InstancingSystem.ts +0 -17
  259. package/src/threejs-compatibility/LightingSystem.ts +0 -22
  260. package/src/threejs-compatibility/MaterialSystem.ts +0 -9
  261. package/src/threejs-compatibility/RenderTargetSystem.ts +0 -35
  262. package/src/threejs-compatibility/RendererDiagnostics.ts +0 -61
  263. package/src/threejs-compatibility/SceneRenderer.ts +0 -34
  264. package/src/threejs-compatibility/ShadowSystem.ts +0 -19
  265. package/src/threejs-compatibility/TextureSystem.ts +0 -19
  266. package/src/threejs-compatibility/ThreeCompatRenderer.ts +0 -90
  267. package/src/threejs-compatibility/TransparencySystem.ts +0 -19
  268. package/src/threejs-compatibility/index.ts +0 -29
  269. package/src/threejs-compatibility/performance/BVH.ts +0 -14
  270. package/src/threejs-compatibility/performance/FrustumCulling.ts +0 -10
  271. package/src/threejs-compatibility/performance/Instancing.ts +0 -4
  272. package/src/threejs-compatibility/performance/LODSystem.ts +0 -16
  273. package/src/threejs-compatibility/performance/OcclusionCulling.ts +0 -6
  274. package/src/threejs-compatibility/performance/RaycastAcceleration.ts +0 -12
  275. package/src/threejs-compatibility/performance/RendererProfiler.ts +0 -19
  276. package/src/threejs-compatibility/performance/TextureStreaming.ts +0 -4
  277. package/src/threejs-compatibility/performance/index.ts +0 -12
  278. package/src/threejs-compatibility/postprocess/BloomPass.ts +0 -16
  279. package/src/threejs-compatibility/postprocess/ColorGradingPass.ts +0 -16
  280. package/src/threejs-compatibility/postprocess/DepthOfFieldPass.ts +0 -21
  281. package/src/threejs-compatibility/postprocess/EffectComposer.ts +0 -14
  282. package/src/threejs-compatibility/postprocess/FXAAPass.ts +0 -15
  283. package/src/threejs-compatibility/postprocess/MotionBlurPass.ts +0 -20
  284. package/src/threejs-compatibility/postprocess/OutlinePass.ts +0 -21
  285. package/src/threejs-compatibility/postprocess/PostProcessTypes.ts +0 -169
  286. package/src/threejs-compatibility/postprocess/RenderPass.ts +0 -9
  287. package/src/threejs-compatibility/postprocess/SMAAPass.ts +0 -15
  288. package/src/threejs-compatibility/postprocess/SSAOPass.ts +0 -21
  289. package/src/threejs-compatibility/postprocess/ShaderPass.ts +0 -7
  290. package/src/threejs-compatibility/postprocess/TAAPass.ts +0 -15
  291. package/src/threejs-compatibility/postprocess/VignettePass.ts +0 -16
  292. package/src/threejs-compatibility/postprocess/index.ts +0 -15
  293. package/src/threejs-compatibility/shaders/NodeMaterial.ts +0 -21
  294. package/src/threejs-compatibility/shaders/RawShaderMaterial.ts +0 -6
  295. package/src/threejs-compatibility/shaders/ShaderDiagnostics.ts +0 -17
  296. package/src/threejs-compatibility/shaders/ShaderMaterial.ts +0 -18
  297. package/src/threejs-compatibility/shaders/ThreeCompatShaderChunks.ts +0 -6
  298. package/src/threejs-compatibility/shaders/Uniforms.ts +0 -18
  299. package/src/threejs-compatibility/shaders/index.ts +0 -9
  300. package/src/threejs-compatibility/vfx/GPUPointCloud.ts +0 -7
  301. package/src/threejs-compatibility/vfx/LineRenderer.ts +0 -13
  302. package/src/threejs-compatibility/vfx/ParticleSystem.ts +0 -23
  303. package/src/threejs-compatibility/vfx/SpriteSystem.ts +0 -14
  304. package/src/threejs-compatibility/vfx/TrailRenderer.ts +0 -8
  305. package/src/threejs-compatibility/vfx/VFXDiagnostics.ts +0 -23
  306. package/src/threejs-compatibility/vfx/index.ts +0 -9
  307. package/src/threejs-example-parity/index.ts +0 -205
  308. package/src/webgpu/WebGPUBuffer.ts +0 -1
  309. package/src/webgpu/WebGPUCompute.ts +0 -2
  310. package/src/webgpu/WebGPUPipelineCache.ts +0 -15
  311. package/src/webgpu/WebGPUPostProcess.ts +0 -2
  312. package/src/webgpu/WebGPUTexture.ts +0 -2
  313. package/tsconfig.json +0 -26
  314. package/vitest.config.ts +0 -20
@@ -1,18 +0,0 @@
1
- import type { RenderPass } from './RenderPass';
2
-
3
- export class FrameGraph {
4
- private readonly passes: RenderPass[] = [];
5
-
6
- addPass(pass: RenderPass): this {
7
- this.passes.push(pass);
8
- return this;
9
- }
10
-
11
- getPasses(): readonly RenderPass[] {
12
- return this.passes;
13
- }
14
-
15
- compile(): readonly RenderPass[] {
16
- return [...this.passes].sort((a, b) => a.kind.localeCompare(b.kind));
17
- }
18
- }
@@ -1,15 +0,0 @@
1
- export type RenderPassKind = 'depth' | 'shadow' | 'opaque' | 'transparent' | 'skybox' | 'postprocess';
2
-
3
- export interface RenderPassExecutionContext {
4
- readonly frameIndex: number;
5
- readonly width: number;
6
- readonly height: number;
7
- }
8
-
9
- export interface RenderPass {
10
- readonly id: string;
11
- readonly kind: RenderPassKind;
12
- readonly reads: readonly string[];
13
- readonly writes: readonly string[];
14
- execute?(context: RenderPassExecutionContext): void;
15
- }
@@ -1,439 +0,0 @@
1
- import { Geometry } from "../../Geometry";
2
- import { IndexBuffer } from "../../IndexBuffer";
3
- import { VertexBuffer } from "../../VertexBuffer";
4
- import { VertexFormat } from "../../VertexFormat";
5
-
6
- export interface ProjectedDecalTriangleMesh {
7
- readonly positions: readonly (readonly [number, number, number])[];
8
- readonly normals?: readonly (readonly [number, number, number])[];
9
- readonly indices?: readonly number[];
10
- }
11
-
12
- export interface ProjectedDecalBox {
13
- readonly center: readonly [number, number, number];
14
- readonly size: readonly [number, number, number];
15
- readonly basis?: ProjectedDecalBasis;
16
- readonly normalOffset?: number;
17
- readonly shape?: ProjectedDecalShape;
18
- readonly ellipseSegments?: number;
19
- }
20
-
21
- export interface ProjectedDecalBasis {
22
- readonly right: readonly [number, number, number];
23
- readonly up: readonly [number, number, number];
24
- readonly normal: readonly [number, number, number];
25
- }
26
-
27
- export interface ProjectedDecalRay {
28
- readonly origin: readonly [number, number, number];
29
- readonly direction: readonly [number, number, number];
30
- }
31
-
32
- export interface ProjectedDecalGeometryResult {
33
- readonly geometry: Geometry;
34
- readonly sourceTriangleCount: number;
35
- readonly clippedTriangleCount: number;
36
- readonly vertexCount: number;
37
- }
38
-
39
- export interface ProjectedDecalRaycastOptions {
40
- readonly size: readonly [number, number, number];
41
- readonly normalOffset?: number;
42
- readonly maxDistance?: number;
43
- readonly includeBackfaces?: boolean;
44
- readonly upHint?: readonly [number, number, number];
45
- readonly shape?: ProjectedDecalShape;
46
- readonly ellipseSegments?: number;
47
- }
48
-
49
- export interface ProjectedDecalRaycastHit {
50
- readonly position: readonly [number, number, number];
51
- readonly normal: readonly [number, number, number];
52
- readonly distance: number;
53
- readonly triangleIndex: number;
54
- }
55
-
56
- export interface ProjectedDecalRaycastResult extends ProjectedDecalGeometryResult {
57
- readonly hit: ProjectedDecalRaycastHit;
58
- readonly box: ProjectedDecalBox;
59
- }
60
-
61
- interface DecalVertex {
62
- readonly position: [number, number, number];
63
- readonly normal: [number, number, number];
64
- }
65
-
66
- interface ClipPlane {
67
- readonly axis: 0 | 1 | 2;
68
- readonly sign: -1 | 1;
69
- }
70
-
71
- export type ProjectedDecalShape = "box" | "ellipse";
72
-
73
- const CLIP_PLANES: readonly ClipPlane[] = [
74
- { axis: 0, sign: 1 },
75
- { axis: 0, sign: -1 },
76
- { axis: 1, sign: 1 },
77
- { axis: 1, sign: -1 },
78
- { axis: 2, sign: 1 },
79
- { axis: 2, sign: -1 }
80
- ];
81
-
82
- export function createProjectedDecalGeometry(mesh: ProjectedDecalTriangleMesh, box: ProjectedDecalBox): ProjectedDecalGeometryResult {
83
- validateBox(box);
84
- const triangles = triangleIndices(mesh);
85
- const vertices: DecalVertex[] = [];
86
- const indices: number[] = [];
87
- const half: [number, number, number] = [box.size[0] / 2, box.size[1] / 2, box.size[2] / 2];
88
- const basis = normalizeBasis(box.basis);
89
- const normalOffset = box.normalOffset ?? 0.0025;
90
- const shape = box.shape ?? "box";
91
- const ellipseSegments = validateEllipseSegments(box.ellipseSegments ?? 32);
92
- let clippedTriangleCount = 0;
93
-
94
- for (let triangle = 0; triangle < triangles.length; triangle += 3) {
95
- const polygon = [0, 1, 2].map((offset) => {
96
- const index = triangles[triangle + offset]!;
97
- const position = mesh.positions[index];
98
- if (!position) {
99
- throw new Error(`Projected decal triangle references missing vertex ${index}.`);
100
- }
101
- return {
102
- position: [position[0], position[1], position[2]] as [number, number, number],
103
- normal: normalizeVec3(mesh.normals?.[index] ?? [0, 0, 1])
104
- };
105
- });
106
- const clipped = shape === "ellipse"
107
- ? clipPolygonToEllipse(clipPolygonToBox(polygon, box.center, half, basis), box.center, half, basis, ellipseSegments)
108
- : clipPolygonToBox(polygon, box.center, half, basis);
109
- if (clipped.length < 3) continue;
110
- const start = vertices.length;
111
- for (const vertex of clipped) {
112
- vertices.push({
113
- position: [
114
- vertex.position[0] + vertex.normal[0] * normalOffset,
115
- vertex.position[1] + vertex.normal[1] * normalOffset,
116
- vertex.position[2] + vertex.normal[2] * normalOffset
117
- ],
118
- normal: vertex.normal
119
- });
120
- }
121
- for (let i = 1; i < clipped.length - 1; i += 1) {
122
- indices.push(start, start + i, start + i + 1);
123
- clippedTriangleCount += 1;
124
- }
125
- }
126
-
127
- if (vertices.length === 0 || indices.length === 0) {
128
- throw new Error("Projected decal did not intersect the source mesh.");
129
- }
130
-
131
- const vertexBuffer = new VertexBuffer(VertexFormat.P3N3T2, vertices.length);
132
- vertices.forEach((vertex, index) => {
133
- const local = toBoxLocal(vertex.position, box.center, half, basis);
134
- vertexBuffer.setAttribute(index, "position", vertex.position);
135
- vertexBuffer.setAttribute(index, "normal", vertex.normal);
136
- vertexBuffer.setAttribute(index, "uv", [
137
- Math.max(0, Math.min(1, local[0] * 0.5 + 0.5)),
138
- Math.max(0, Math.min(1, 1 - (local[1] * 0.5 + 0.5)))
139
- ]);
140
- });
141
-
142
- return {
143
- geometry: new Geometry(vertexBuffer, new IndexBuffer(indices, vertices.length)),
144
- sourceTriangleCount: triangles.length / 3,
145
- clippedTriangleCount,
146
- vertexCount: vertices.length
147
- };
148
- }
149
-
150
- export function createRaycastProjectedDecalGeometry(
151
- mesh: ProjectedDecalTriangleMesh,
152
- ray: ProjectedDecalRay,
153
- options: ProjectedDecalRaycastOptions
154
- ): ProjectedDecalRaycastResult {
155
- validateRay(ray);
156
- validateBox({ center: ray.origin, size: options.size });
157
- const hit = raycastProjectedDecalMesh(mesh, ray, options);
158
- if (!hit) {
159
- throw new Error("Projected decal ray did not hit the source mesh.");
160
- }
161
- const basis = createProjectorBasis(hit.normal, options.upHint ?? [0, 1, 0]);
162
- const box: ProjectedDecalBox = {
163
- center: hit.position,
164
- size: options.size,
165
- basis,
166
- ...(options.normalOffset === undefined ? {} : { normalOffset: options.normalOffset }),
167
- ...(options.shape === undefined ? {} : { shape: options.shape }),
168
- ...(options.ellipseSegments === undefined ? {} : { ellipseSegments: options.ellipseSegments })
169
- };
170
- return {
171
- ...createProjectedDecalGeometry(mesh, box),
172
- hit,
173
- box
174
- };
175
- }
176
-
177
- export function raycastProjectedDecalMesh(
178
- mesh: ProjectedDecalTriangleMesh,
179
- ray: ProjectedDecalRay,
180
- options: Pick<ProjectedDecalRaycastOptions, "maxDistance" | "includeBackfaces"> = {}
181
- ): ProjectedDecalRaycastHit | undefined {
182
- validateRay(ray);
183
- const triangles = triangleIndices(mesh);
184
- const direction = normalizeVec3(ray.direction);
185
- const maxDistance = options.maxDistance ?? Number.POSITIVE_INFINITY;
186
- if ((maxDistance !== Number.POSITIVE_INFINITY && !Number.isFinite(maxDistance)) || maxDistance <= 0) {
187
- throw new Error("Projected decal ray maxDistance must be finite positive or omitted.");
188
- }
189
- let closest: ProjectedDecalRaycastHit | undefined;
190
- for (let offset = 0; offset < triangles.length; offset += 3) {
191
- const ia = triangles[offset]!;
192
- const ib = triangles[offset + 1]!;
193
- const ic = triangles[offset + 2]!;
194
- const a = mesh.positions[ia];
195
- const b = mesh.positions[ib];
196
- const c = mesh.positions[ic];
197
- if (!a || !b || !c) {
198
- throw new Error("Projected decal raycast triangle references a missing vertex.");
199
- }
200
- const hit = intersectTriangle(ray.origin, direction, a, b, c, options.includeBackfaces === true);
201
- if (!hit || hit.distance > maxDistance || (closest && hit.distance >= closest.distance)) continue;
202
- const geometricNormal = triangleNormal(a, b, c);
203
- const na = mesh.normals?.[ia] ?? geometricNormal;
204
- const nb = mesh.normals?.[ib] ?? geometricNormal;
205
- const nc = mesh.normals?.[ic] ?? geometricNormal;
206
- closest = {
207
- position: hit.position,
208
- normal: normalizeVec3([
209
- na[0] * hit.barycentric[0] + nb[0] * hit.barycentric[1] + nc[0] * hit.barycentric[2],
210
- na[1] * hit.barycentric[0] + nb[1] * hit.barycentric[1] + nc[1] * hit.barycentric[2],
211
- na[2] * hit.barycentric[0] + nb[2] * hit.barycentric[1] + nc[2] * hit.barycentric[2]
212
- ]),
213
- distance: hit.distance,
214
- triangleIndex: offset / 3
215
- };
216
- }
217
- return closest;
218
- }
219
-
220
- function triangleIndices(mesh: ProjectedDecalTriangleMesh): readonly number[] {
221
- if (mesh.indices) {
222
- if (mesh.indices.length === 0 || mesh.indices.length % 3 !== 0) {
223
- throw new Error("Projected decal source indices must contain triangles.");
224
- }
225
- return mesh.indices;
226
- }
227
- if (mesh.positions.length === 0 || mesh.positions.length % 3 !== 0) {
228
- throw new Error("Projected decal source positions must contain unindexed triangles.");
229
- }
230
- return mesh.positions.map((_position, index) => index);
231
- }
232
-
233
- function clipPolygonToBox(polygon: readonly DecalVertex[], center: readonly [number, number, number], half: readonly [number, number, number], basis: ProjectedDecalBasis): readonly DecalVertex[] {
234
- let clipped = [...polygon];
235
- for (const plane of CLIP_PLANES) {
236
- clipped = clipPolygonToPlane(clipped, center, half, basis, plane);
237
- if (clipped.length === 0) break;
238
- }
239
- return clipped;
240
- }
241
-
242
- function clipPolygonToEllipse(polygon: readonly DecalVertex[], center: readonly [number, number, number], half: readonly [number, number, number], basis: ProjectedDecalBasis, segments: number): readonly DecalVertex[] {
243
- let clipped = [...polygon];
244
- const apothem = Math.cos(Math.PI / segments);
245
- for (let segment = 0; segment < segments; segment += 1) {
246
- const angle = ((segment + 0.5) / segments) * Math.PI * 2;
247
- clipped = clipPolygonToLocalPlane(clipped, center, half, basis, Math.cos(angle), Math.sin(angle), apothem);
248
- if (clipped.length === 0) break;
249
- }
250
- return clipped;
251
- }
252
-
253
- function clipPolygonToPlane(polygon: readonly DecalVertex[], center: readonly [number, number, number], half: readonly [number, number, number], basis: ProjectedDecalBasis, plane: ClipPlane): DecalVertex[] {
254
- const output: DecalVertex[] = [];
255
- for (let index = 0; index < polygon.length; index += 1) {
256
- const current = polygon[index]!;
257
- const previous = polygon[(index + polygon.length - 1) % polygon.length]!;
258
- const currentDistance = signedPlaneDistance(current.position, center, half, basis, plane);
259
- const previousDistance = signedPlaneDistance(previous.position, center, half, basis, plane);
260
- const currentInside = currentDistance <= 0;
261
- const previousInside = previousDistance <= 0;
262
- if (currentInside !== previousInside) {
263
- const denominator = previousDistance - currentDistance;
264
- const t = denominator === 0 ? 0 : previousDistance / denominator;
265
- output.push(interpolateVertex(previous, current, t));
266
- }
267
- if (currentInside) {
268
- output.push(current);
269
- }
270
- }
271
- return output;
272
- }
273
-
274
- function clipPolygonToLocalPlane(polygon: readonly DecalVertex[], center: readonly [number, number, number], half: readonly [number, number, number], basis: ProjectedDecalBasis, normalX: number, normalY: number, limit: number): DecalVertex[] {
275
- const output: DecalVertex[] = [];
276
- for (let index = 0; index < polygon.length; index += 1) {
277
- const current = polygon[index]!;
278
- const previous = polygon[(index + polygon.length - 1) % polygon.length]!;
279
- const currentDistance = localPlaneDistance(current.position, center, half, basis, normalX, normalY, limit);
280
- const previousDistance = localPlaneDistance(previous.position, center, half, basis, normalX, normalY, limit);
281
- const currentInside = currentDistance <= 0;
282
- const previousInside = previousDistance <= 0;
283
- if (currentInside !== previousInside) {
284
- const denominator = previousDistance - currentDistance;
285
- const t = denominator === 0 ? 0 : previousDistance / denominator;
286
- output.push(interpolateVertex(previous, current, t));
287
- }
288
- if (currentInside) {
289
- output.push(current);
290
- }
291
- }
292
- return output;
293
- }
294
-
295
- function signedPlaneDistance(position: readonly [number, number, number], center: readonly [number, number, number], half: readonly [number, number, number], basis: ProjectedDecalBasis, plane: ClipPlane): number {
296
- const local = toBoxLocal(position, center, half, basis)[plane.axis];
297
- return plane.sign === 1 ? local - 1 : -local - 1;
298
- }
299
-
300
- function localPlaneDistance(position: readonly [number, number, number], center: readonly [number, number, number], half: readonly [number, number, number], basis: ProjectedDecalBasis, normalX: number, normalY: number, limit: number): number {
301
- const local = toBoxLocal(position, center, half, basis);
302
- return local[0] * normalX + local[1] * normalY - limit;
303
- }
304
-
305
- function interpolateVertex(a: DecalVertex, b: DecalVertex, t: number): DecalVertex {
306
- return {
307
- position: [
308
- a.position[0] + (b.position[0] - a.position[0]) * t,
309
- a.position[1] + (b.position[1] - a.position[1]) * t,
310
- a.position[2] + (b.position[2] - a.position[2]) * t
311
- ],
312
- normal: normalizeVec3([
313
- a.normal[0] + (b.normal[0] - a.normal[0]) * t,
314
- a.normal[1] + (b.normal[1] - a.normal[1]) * t,
315
- a.normal[2] + (b.normal[2] - a.normal[2]) * t
316
- ])
317
- };
318
- }
319
-
320
- function toBoxLocal(position: readonly [number, number, number], center: readonly [number, number, number], half: readonly [number, number, number], basis: ProjectedDecalBasis): [number, number, number] {
321
- const delta: [number, number, number] = [
322
- position[0] - center[0],
323
- position[1] - center[1],
324
- position[2] - center[2]
325
- ];
326
- return [
327
- dot(delta, basis.right) / half[0],
328
- dot(delta, basis.up) / half[1],
329
- dot(delta, basis.normal) / half[2]
330
- ];
331
- }
332
-
333
- function normalizeBasis(basis: ProjectedDecalBasis | undefined): ProjectedDecalBasis {
334
- if (!basis) {
335
- return { right: [1, 0, 0], up: [0, 1, 0], normal: [0, 0, 1] };
336
- }
337
- return createProjectorBasis(basis.normal, basis.up);
338
- }
339
-
340
- function createProjectorBasis(normalInput: readonly [number, number, number], upHintInput: readonly [number, number, number]): ProjectedDecalBasis {
341
- const normal = normalizeVec3(normalInput);
342
- let upHint = normalizeVec3(upHintInput);
343
- if (Math.abs(dot(normal, upHint)) > 0.98) {
344
- upHint = Math.abs(normal[1]) < 0.98 ? [0, 1, 0] : [1, 0, 0];
345
- }
346
- const right = normalizeVec3(cross(upHint, normal));
347
- const up = normalizeVec3(cross(normal, right));
348
- return { right, up, normal };
349
- }
350
-
351
- function intersectTriangle(
352
- origin: readonly [number, number, number],
353
- direction: readonly [number, number, number],
354
- a: readonly [number, number, number],
355
- b: readonly [number, number, number],
356
- c: readonly [number, number, number],
357
- includeBackfaces: boolean
358
- ): { readonly position: [number, number, number]; readonly distance: number; readonly barycentric: [number, number, number] } | undefined {
359
- const edge1 = sub(b, a);
360
- const edge2 = sub(c, a);
361
- const p = cross(direction, edge2);
362
- const determinant = dot(edge1, p);
363
- if (includeBackfaces ? Math.abs(determinant) < 1e-8 : determinant < 1e-8) return undefined;
364
- const invDet = 1 / determinant;
365
- const tvec = sub(origin, a);
366
- const u = dot(tvec, p) * invDet;
367
- if (u < 0 || u > 1) return undefined;
368
- const q = cross(tvec, edge1);
369
- const v = dot(direction, q) * invDet;
370
- if (v < 0 || u + v > 1) return undefined;
371
- const distance = dot(edge2, q) * invDet;
372
- if (distance < 0) return undefined;
373
- return {
374
- position: [
375
- origin[0] + direction[0] * distance,
376
- origin[1] + direction[1] * distance,
377
- origin[2] + direction[2] * distance
378
- ],
379
- distance,
380
- barycentric: [1 - u - v, u, v]
381
- };
382
- }
383
-
384
- function triangleNormal(a: readonly [number, number, number], b: readonly [number, number, number], c: readonly [number, number, number]): [number, number, number] {
385
- return normalizeVec3(cross(sub(b, a), sub(c, a)));
386
- }
387
-
388
- function sub(a: readonly [number, number, number], b: readonly [number, number, number]): [number, number, number] {
389
- return [a[0] - b[0], a[1] - b[1], a[2] - b[2]];
390
- }
391
-
392
- function dot(a: readonly [number, number, number], b: readonly [number, number, number]): number {
393
- return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
394
- }
395
-
396
- function cross(a: readonly [number, number, number], b: readonly [number, number, number]): [number, number, number] {
397
- return [
398
- a[1] * b[2] - a[2] * b[1],
399
- a[2] * b[0] - a[0] * b[2],
400
- a[0] * b[1] - a[1] * b[0]
401
- ];
402
- }
403
-
404
- function normalizeVec3(value: readonly [number, number, number]): [number, number, number] {
405
- const length = Math.hypot(value[0], value[1], value[2]);
406
- if (!Number.isFinite(length) || length <= 1e-8) return [0, 0, 1];
407
- return [value[0] / length, value[1] / length, value[2] / length];
408
- }
409
-
410
- function validateRay(ray: ProjectedDecalRay): void {
411
- if (ray.origin.length !== 3 || ray.direction.length !== 3 || [...ray.origin, ...ray.direction].some((component) => !Number.isFinite(component))) {
412
- throw new Error("Projected decal ray origin and direction must be finite vec3 values.");
413
- }
414
- if (Math.hypot(ray.direction[0], ray.direction[1], ray.direction[2]) <= 1e-8) {
415
- throw new Error("Projected decal ray direction must be non-zero.");
416
- }
417
- }
418
-
419
- function validateBox(box: ProjectedDecalBox): void {
420
- for (const [label, value] of [["center", box.center], ["size", box.size]] as const) {
421
- if (value.length !== 3 || value.some((component) => !Number.isFinite(component))) {
422
- throw new Error(`Projected decal ${label} must be a finite vec3.`);
423
- }
424
- }
425
- if (box.size.some((component) => component <= 0)) {
426
- throw new Error("Projected decal size components must be positive.");
427
- }
428
- if (box.shape !== undefined && box.shape !== "box" && box.shape !== "ellipse") {
429
- throw new Error("Projected decal shape must be box or ellipse.");
430
- }
431
- if (box.ellipseSegments !== undefined) validateEllipseSegments(box.ellipseSegments);
432
- }
433
-
434
- function validateEllipseSegments(segments: number): number {
435
- if (!Number.isInteger(segments) || segments < 8 || segments > 128) {
436
- throw new Error("Projected decal ellipseSegments must be an integer from 8 to 128.");
437
- }
438
- return segments;
439
- }
@@ -1,127 +0,0 @@
1
- export {
2
- ProductionWebGL2Renderer,
3
- analyzePixels,
4
- summarizeProductionProductionProof,
5
- summarizeProductionWebGL2Proof
6
- } from "./ProductionWebGL2Renderer";
7
- export type { ProductionWebGL2RendererOptions } from "./ProductionWebGL2Renderer";
8
- export {
9
- createProductionEnvironmentLightingResources,
10
- createProductionPbrHdrPipelineFromRadiance,
11
- createProductionToneMappingPolicy,
12
- parseProductionRadianceHDR
13
- } from "./PBRHDRPipeline";
14
- export {
15
- createProductionEffectsRenderSource,
16
- summarizeProductionEffectsProof
17
- } from "./ProductionEffectsPipeline";
18
- export {
19
- ProductionWebGPURenderer,
20
- createProductionWebGPUReport,
21
- createProductionWebGPUReadinessReport
22
- } from "./ProductionWebGPURenderer";
23
- export {
24
- createProductionOrbitControlPreset,
25
- summarizeProductionAnimationWorkflow
26
- } from "./AnimationControlsPipeline";
27
- export type {
28
- ProductionEnvironmentLightingResources,
29
- ProductionPbrHdrPipeline,
30
- ProductionPbrHdrPipelineOptions,
31
- ProductionRadianceHDR,
32
- ProductionToneMappingOperator,
33
- ProductionToneMappingPolicy
34
- } from "./PBRHDRPipeline";
35
- export type {
36
- ProductionEffectsOptions,
37
- ProductionEffectsSummary
38
- } from "./ProductionEffectsPipeline";
39
- export type {
40
- ProductionWebGPUAdapterLike,
41
- ProductionWebGPULike,
42
- ProductionWebGPUReport,
43
- ProductionWebGPUStatus,
44
- ProductionWebGPUReadinessItem,
45
- ProductionWebGPUReadinessReport,
46
- ProductionWebGPURendererOptions
47
- } from "./ProductionWebGPURenderer";
48
- export type {
49
- ProductionAnimationMetadataInput,
50
- ProductionAnimationWorkflowSummary,
51
- ProductionOrbitControlPreset
52
- } from "./AnimationControlsPipeline";
53
- export {
54
- PRODUCTION_WEBGL2_REQUIRED_FEATURES,
55
- RUNTIME_PARITY_WEBGPU_REQUIRED_FEATURES
56
- } from "./ProductionRendererTypes";
57
- export type {
58
- ProductionImportedAssetRenderMetadata,
59
- ProductionPixelMetrics,
60
- ProductionProductionRenderer,
61
- ProductionRenderProof,
62
- ProductionRendererBackend,
63
- ProductionRendererFeature,
64
- ProductionRendererFeatureState,
65
- ProductionRendererInput,
66
- RuntimeParityFrameRenderResult
67
- } from "./ProductionRendererTypes";
68
- export * from "./ProductionRuntimeRenderer";
69
- export * from "./backends/RendererBackend";
70
- export * from "./backends/WebGL2RendererBackend";
71
- export * from "./backends/WebGPURendererBackend";
72
- export * from "./framegraph/FrameGraph";
73
- export * from "./framegraph/RenderPass";
74
- export * from "./resources/GPUBuffer";
75
- export * from "./resources/GPUTexture";
76
- export * from "./resources/RenderTarget";
77
- export * from "./resources/ResourceCache";
78
- export * from "./scene/RenderableScene";
79
- export * from "./scene/RenderableMesh";
80
- export * from "./scene/RenderablePrimitive";
81
- export * from "./scene/Camera";
82
- export * from "./scene/Lights";
83
- export * from "./materials/PBRMaterial";
84
- export * from "./materials/PBRShaderFeatures";
85
- export * from "./materials/MaterialCompiler";
86
- export * from "./materials/MaterialTextureBindings";
87
- export * from "./materials/GLTFMaterialAdapter";
88
- export * from "./materials/GLTFPBRMaterialAdapter";
89
- export * from "./shaders/ShaderProgramLibrary";
90
- export * from "./environment/HDRLoader";
91
- export * from "./environment/PMREMGenerator";
92
- export * from "./environment/EnvironmentMap";
93
- export * from "./geometry/ProjectedDecalGeometry";
94
- export * from "./passes/DepthPrepass";
95
- export * from "./passes/ShadowPass";
96
- export * from "./passes/ContactShadowPass";
97
- export * from "./passes/OpaquePass";
98
- export * from "./passes/TransparentPass";
99
- export * from "./passes/SkyboxPass";
100
- export * from "./passes/ToneMappingPass";
101
- export * from "./postprocess/ProductionEffectComposer";
102
- export * from "./postprocess/ProductionPostProcessTypes";
103
- export * from "./postprocess/BloomPass";
104
- export * from "./postprocess/SSAOPass";
105
- export * from "./postprocess/DOFPass";
106
- export * from "./postprocess/FXAAPass";
107
- export * from "./postprocess/ColorGradingPass";
108
- export * from "./animation/SkinningRenderer";
109
- export * from "./animation/MorphTargetRenderer";
110
- export * from "./diagnostics/FrameCapture";
111
- export * from "./diagnostics/RendererStats";
112
- export * from "./diagnostics/GPUCapabilities";
113
- export * from "./lights/LightManager";
114
- export * from "./lights/ShadowMapRenderer";
115
- export * from "./color/ColorManagement";
116
- export * from "./color/ToneMapping";
117
- export * from "./backends/webgl2/WebGL2Shader";
118
- export * from "./backends/webgl2/WebGL2Buffer";
119
- export * from "./backends/webgl2/WebGL2Texture";
120
- export * from "./backends/webgl2/WebGL2RenderTarget";
121
- export * from "./backends/webgl2/WebGL2StateCache";
122
- export * from "./backends/webgl2/WebGL2Capabilities";
123
- export * from "./backends/webgpu/WebGPUShader";
124
- export * from "./backends/webgpu/WebGPUBuffer";
125
- export * from "./backends/webgpu/WebGPUTexture";
126
- export * from "./backends/webgpu/WebGPURenderTarget";
127
- export * from "./backends/webgpu/WebGPUCapabilities";
@@ -1,7 +0,0 @@
1
- import type { Light } from '../scene/Lights';
2
- export class LightManager {
3
- private readonly lights = new Map<string, Light>();
4
- add(light: Light): void { this.lights.set(light.id, light); }
5
- list(): readonly Light[] { return [...this.lights.values()]; }
6
- get shadowCastingCount(): number { return this.list().filter((light) => light.castsShadow).length; }
7
- }
@@ -1,5 +0,0 @@
1
- import type { Light } from '../scene/Lights';
2
- export interface ShadowMapPlan { readonly lightId: string; readonly resolution: number; readonly bias: number; }
3
- export function createShadowMapPlans(lights: readonly Light[], resolution = 2048): readonly ShadowMapPlan[] {
4
- return lights.filter((light) => light.castsShadow).map((light) => ({ lightId: light.id, resolution, bias: light.type === 'directional' ? 0.0008 : 0.002 }));
5
- }
@@ -1,6 +0,0 @@
1
- import type { PBRMaterial } from './PBRMaterial';
2
- export interface GLTFMaterialLike { readonly name?: string; readonly alphaMode?: 'OPAQUE' | 'MASK' | 'BLEND'; readonly doubleSided?: boolean; readonly extensions?: Record<string, unknown>; readonly pbrMetallicRoughness?: { readonly baseColorFactor?: readonly number[]; readonly metallicFactor?: number; readonly roughnessFactor?: number }; }
3
- export function adaptGLTFMaterial(material: GLTFMaterialLike, id = material.name ?? 'gltf-material'): PBRMaterial {
4
- const factor = material.pbrMetallicRoughness?.baseColorFactor ?? [1, 1, 1, 1];
5
- return { id, name: material.name ?? id, baseColorFactor: [Number(factor[0] ?? 1), Number(factor[1] ?? 1), Number(factor[2] ?? 1), Number(factor[3] ?? 1)], metallicFactor: material.pbrMetallicRoughness?.metallicFactor ?? 1, roughnessFactor: material.pbrMetallicRoughness?.roughnessFactor ?? 1, alphaMode: material.alphaMode ?? 'OPAQUE', doubleSided: material.doubleSided ?? false, textures: {}, extensions: Object.keys(material.extensions ?? {}) };
6
- }
@@ -1,2 +0,0 @@
1
- export { adaptGLTFMaterial as adaptGLTFPBRMaterial } from './GLTFMaterialAdapter';
2
- export type { GLTFMaterialLike } from './GLTFMaterialAdapter';
@@ -1,7 +0,0 @@
1
- import type { PBRMaterial } from './PBRMaterial';
2
- import type { PBRShaderFeatures } from './PBRShaderFeatures';
3
- export interface CompiledMaterialProgram { readonly key: string; readonly defines: readonly string[]; readonly material: PBRMaterial; }
4
- export function compilePBRMaterial(material: PBRMaterial, features: Partial<PBRShaderFeatures> = {}): CompiledMaterialProgram {
5
- const defines = Object.entries(features).filter(([, enabled]) => enabled).map(([name]) => 'USE_' + name.replace(/[A-Z]/g, (c) => '_' + c).toUpperCase());
6
- return { key: [material.id, ...defines].join('|'), defines, material };
7
- }
@@ -1,5 +0,0 @@
1
- import type { PBRMaterial } from './PBRMaterial';
2
- export interface MaterialTextureBinding { readonly slot: keyof PBRMaterial['textures']; readonly textureId: string; readonly colorSpace: 'srgb' | 'linear' | 'hdr'; }
3
- export function collectMaterialTextureBindings(material: PBRMaterial): readonly MaterialTextureBinding[] {
4
- return Object.entries(material.textures).map(([slot, textureId]) => ({ slot: slot as keyof PBRMaterial['textures'], textureId: String(textureId), colorSpace: slot === 'baseColor' || slot === 'emissive' ? 'srgb' : 'linear' }));
5
- }
@@ -1,2 +0,0 @@
1
- export interface PBRMaterialTextureSlots { readonly baseColor?: string; readonly metallicRoughness?: string; readonly normal?: string; readonly occlusion?: string; readonly emissive?: string; readonly transmission?: string; readonly sheen?: string; readonly clearcoat?: string; readonly specular?: string; }
2
- export interface PBRMaterial { readonly id: string; readonly name: string; readonly baseColorFactor: readonly [number, number, number, number]; readonly metallicFactor: number; readonly roughnessFactor: number; readonly alphaMode: 'OPAQUE' | 'MASK' | 'BLEND'; readonly doubleSided: boolean; readonly textures: PBRMaterialTextureSlots; readonly extensions: readonly string[]; }
@@ -1,2 +0,0 @@
1
- export interface PBRShaderFeatures { readonly normalMap: boolean; readonly occlusionMap: boolean; readonly emissiveMap: boolean; readonly clearcoat: boolean; readonly sheen: boolean; readonly specular: boolean; readonly transmission: boolean; readonly skinning: boolean; readonly morphTargets: boolean; }
2
- export const PRODUCTION_PBR_SHADER_FEATURES: PBRShaderFeatures = { normalMap: true, occlusionMap: true, emissiveMap: true, clearcoat: true, sheen: true, specular: true, transmission: true, skinning: true, morphTargets: true };