@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.
Files changed (308) hide show
  1. package/package.json +38 -4
  2. package/AGENTS.md +0 -46
  3. package/src/ArchitecturalLightingFixtures.ts +0 -241
  4. package/src/ArchitecturalMaterialCatalog.ts +0 -130
  5. package/src/ArchitecturalMeasurementFixtures.ts +0 -155
  6. package/src/BRDFLut.ts +0 -47
  7. package/src/CameraFraming.ts +0 -200
  8. package/src/CanonicalSceneFixtures.ts +0 -95
  9. package/src/CascadedShadowMaps.ts +0 -449
  10. package/src/ColorManagement.ts +0 -127
  11. package/src/CullingFixtures.ts +0 -280
  12. package/src/DecalGeometry.ts +0 -26
  13. package/src/DepthPass.ts +0 -110
  14. package/src/EnvironmentBackgroundPass.ts +0 -194
  15. package/src/EnvironmentBackgroundResources.ts +0 -309
  16. package/src/EnvironmentLighting.ts +0 -96
  17. package/src/EnvironmentMapResources.ts +0 -1026
  18. package/src/EnvironmentPipeline.ts +0 -69
  19. package/src/EnvironmentPlatform.ts +0 -1306
  20. package/src/EnvironmentPreset.ts +0 -155
  21. package/src/Exposure.ts +0 -66
  22. package/src/ExternalParityRenderPreset.ts +0 -725
  23. package/src/ForwardPass.ts +0 -1668
  24. package/src/FrameVisualMetrics.ts +0 -301
  25. package/src/Geometry.ts +0 -461
  26. package/src/GeometryPrimitives.ts +0 -2
  27. package/src/HDRRenderPipeline.ts +0 -94
  28. package/src/IBL.ts +0 -86
  29. package/src/IndexBuffer.ts +0 -57
  30. package/src/InstancedPBRMaterial.ts +0 -186
  31. package/src/InstancedUnlitMaterial.ts +0 -60
  32. package/src/Instancing.ts +0 -19
  33. package/src/LightCollector.ts +0 -82
  34. package/src/LightUniforms.ts +0 -47
  35. package/src/LightingDebug.ts +0 -80
  36. package/src/LightingDefaults.ts +0 -79
  37. package/src/LightingRig.ts +0 -301
  38. package/src/LineGeometry.ts +0 -2
  39. package/src/Material.ts +0 -209
  40. package/src/MaterialBinding.ts +0 -131
  41. package/src/MaterialInstance.ts +0 -59
  42. package/src/MaterialPresets.ts +0 -272
  43. package/src/MorphTarget.ts +0 -124
  44. package/src/MorphTargetPlan.ts +0 -178
  45. package/src/MorphUnlitMaterial.ts +0 -60
  46. package/src/NormalMappedPBRMaterial.ts +0 -188
  47. package/src/OceanFixtures.ts +0 -318
  48. package/src/PBRLightingDefaults.ts +0 -12
  49. package/src/PBRMaterial.ts +0 -442
  50. package/src/PMREM.ts +0 -53
  51. package/src/PbrReference.ts +0 -681
  52. package/src/PostProcessPass.ts +0 -2507
  53. package/src/ProceduralTextureFixtures.ts +0 -393
  54. package/src/ProductTurntableFixtures.ts +0 -815
  55. package/src/Raycaster.ts +0 -21
  56. package/src/ReflectionProbe.ts +0 -13
  57. package/src/ReflectionSurfaces.ts +0 -219
  58. package/src/RenderBackend.ts +0 -43
  59. package/src/RenderDebugViews.ts +0 -138
  60. package/src/RenderDevice.ts +0 -836
  61. package/src/RenderGraph.ts +0 -194
  62. package/src/RenderPass.ts +0 -27
  63. package/src/RenderPipeline.ts +0 -101
  64. package/src/RenderQueue.ts +0 -12
  65. package/src/RenderState.ts +0 -12
  66. package/src/Renderer.ts +0 -2631
  67. package/src/RendererDebugOverlay.ts +0 -80
  68. package/src/RendererFeatureGates.ts +0 -150
  69. package/src/RendererPostprocessPlan.ts +0 -279
  70. package/src/RendererTiming.ts +0 -251
  71. package/src/RendererVisualPipelineReport.ts +0 -836
  72. package/src/ResourceLifecycle.ts +0 -21
  73. package/src/Sampler.ts +0 -37
  74. package/src/SceneOptimization.ts +0 -518
  75. package/src/ShaderChunks.ts +0 -393
  76. package/src/ShaderLibrary.ts +0 -2766
  77. package/src/ShaderModule.ts +0 -36
  78. package/src/ShaderPreprocessor.ts +0 -260
  79. package/src/ShaderReflection.ts +0 -201
  80. package/src/ShadowMap.ts +0 -237
  81. package/src/ShadowPass.ts +0 -198
  82. package/src/ShadowProjection.ts +0 -115
  83. package/src/SkinnedLitMaterial.ts +0 -397
  84. package/src/SkinnedUnlitMaterial.ts +0 -63
  85. package/src/SkinningBounds.ts +0 -131
  86. package/src/SpaceEnvironmentFixtures.ts +0 -200
  87. package/src/SpriteGeometry.ts +0 -21
  88. package/src/StereoCameraRig.ts +0 -127
  89. package/src/StereoEffects.ts +0 -274
  90. package/src/TerrainFixtures.ts +0 -180
  91. package/src/Texture.ts +0 -307
  92. package/src/TextureBinding.ts +0 -91
  93. package/src/TexturedPBRMaterial.ts +0 -1112
  94. package/src/TexturedUnlitMaterial.ts +0 -67
  95. package/src/ToneMapping.ts +0 -105
  96. package/src/UniformBinder.ts +0 -16
  97. package/src/UniformLayout.ts +0 -129
  98. package/src/UnlitMaterial.ts +0 -75
  99. package/src/VegetationFixtures.ts +0 -314
  100. package/src/VertexBuffer.ts +0 -120
  101. package/src/VertexFormat.ts +0 -171
  102. package/src/VoxelWorldFixtures.ts +0 -280
  103. package/src/WeatherFixtures.ts +0 -223
  104. package/src/WebGL2Device.ts +0 -2280
  105. package/src/WebGL2StateCache.ts +0 -330
  106. package/src/WebGPUDevice.ts +0 -2877
  107. package/src/WebGPURenderToTextureProof.ts +0 -139
  108. package/src/advanced-runtime/AdvancedRenderer.ts +0 -73
  109. package/src/advanced-runtime/index.ts +0 -9
  110. package/src/animation/AnimationMaterialStyle.ts +0 -32
  111. package/src/animation/AnimationRenderPreset.ts +0 -45
  112. package/src/animation/AnimationToonMaterial.ts +0 -387
  113. package/src/animation/AnimationVisualQuality.ts +0 -71
  114. package/src/animation/applyAnimationRenderPreset.ts +0 -180
  115. package/src/animation/index.ts +0 -5
  116. package/src/cinematic/BloomPass.ts +0 -26
  117. package/src/cinematic/CinematicDepthComposition.ts +0 -30
  118. package/src/cinematic/CinematicEvidence.ts +0 -123
  119. package/src/cinematic/CinematicLightingRig.ts +0 -144
  120. package/src/cinematic/CinematicMaterialPresets.ts +0 -130
  121. package/src/cinematic/CinematicPostProcess.ts +0 -83
  122. package/src/cinematic/DepthHazePass.ts +0 -30
  123. package/src/cinematic/EmissivePracticalLightSystem.ts +0 -45
  124. package/src/cinematic/FilmGrainPass.ts +0 -24
  125. package/src/cinematic/FogVolumeSystem.ts +0 -30
  126. package/src/cinematic/GlowCardSystem.ts +0 -44
  127. package/src/cinematic/RainParticleSystem.ts +0 -151
  128. package/src/cinematic/VignettePass.ts +0 -25
  129. package/src/cinematic/WetReflectionApproximation.ts +0 -27
  130. package/src/cinematic/index.ts +0 -14
  131. package/src/effects/CollisionModule.ts +0 -64
  132. package/src/effects/ColorModule.ts +0 -60
  133. package/src/effects/ForceModule.ts +0 -25
  134. package/src/effects/GPUParticleBackend.ts +0 -569
  135. package/src/effects/Particle.ts +0 -108
  136. package/src/effects/ParticleDiagnostics.ts +0 -224
  137. package/src/effects/ParticleEffectPresets.ts +0 -147
  138. package/src/effects/ParticleEmitter.ts +0 -326
  139. package/src/effects/ParticleModule.ts +0 -26
  140. package/src/effects/ParticleRenderPass.ts +0 -117
  141. package/src/effects/ParticleRenderer.ts +0 -132
  142. package/src/effects/ParticleSystem.ts +0 -333
  143. package/src/effects/SizeModule.ts +0 -56
  144. package/src/effects/TrailModule.ts +0 -72
  145. package/src/effects/VelocityModule.ts +0 -75
  146. package/src/effects/index.ts +0 -15
  147. package/src/index.ts +0 -925
  148. package/src/materials/AlphaSorting.ts +0 -30
  149. package/src/materials/MaterialExtensions.ts +0 -42
  150. package/src/materials/PhysicalMaterial.ts +0 -133
  151. package/src/materials/TransmissionPass.ts +0 -51
  152. package/src/performance/BVH.ts +0 -18
  153. package/src/performance/Batcher.ts +0 -2
  154. package/src/performance/FrustumCuller.ts +0 -9
  155. package/src/performance/LOD.ts +0 -20
  156. package/src/performance/Octree.ts +0 -10
  157. package/src/performance/RenderItemSorting.ts +0 -170
  158. package/src/performance/RendererStats.ts +0 -43
  159. package/src/performance/ResourceBudget.ts +0 -44
  160. package/src/postprocess/BloomPass.ts +0 -28
  161. package/src/postprocess/CinematicDiagnostics.ts +0 -642
  162. package/src/postprocess/ColorGradingPass.ts +0 -24
  163. package/src/postprocess/DepthOfFieldPass.ts +0 -12
  164. package/src/postprocess/EffectComposer.ts +0 -349
  165. package/src/postprocess/SSAOPass.ts +0 -20
  166. package/src/postprocess/index.ts +0 -34
  167. package/src/production-runtime/AnimationControlsPipeline.ts +0 -77
  168. package/src/production-runtime/PBRHDRPipeline.ts +0 -381
  169. package/src/production-runtime/ProductionEffectsPipeline.ts +0 -85
  170. package/src/production-runtime/ProductionRendererTypes.ts +0 -136
  171. package/src/production-runtime/ProductionRuntimeRenderer.ts +0 -172
  172. package/src/production-runtime/ProductionWebGL2Renderer.ts +0 -313
  173. package/src/production-runtime/ProductionWebGPURenderer.ts +0 -396
  174. package/src/production-runtime/TransmissionBackdropCapture.ts +0 -130
  175. package/src/production-runtime/animation/MorphTargetRenderer.ts +0 -2
  176. package/src/production-runtime/animation/SkinningRenderer.ts +0 -2
  177. package/src/production-runtime/backends/RendererBackend.ts +0 -17
  178. package/src/production-runtime/backends/WebGL2RendererBackend.ts +0 -30
  179. package/src/production-runtime/backends/WebGPURendererBackend.ts +0 -24
  180. package/src/production-runtime/backends/webgl2/WebGL2Buffer.ts +0 -2
  181. package/src/production-runtime/backends/webgl2/WebGL2Capabilities.ts +0 -2
  182. package/src/production-runtime/backends/webgl2/WebGL2RenderTarget.ts +0 -2
  183. package/src/production-runtime/backends/webgl2/WebGL2Shader.ts +0 -2
  184. package/src/production-runtime/backends/webgl2/WebGL2StateCache.ts +0 -1
  185. package/src/production-runtime/backends/webgl2/WebGL2Texture.ts +0 -2
  186. package/src/production-runtime/backends/webgpu/WebGPUBuffer.ts +0 -2
  187. package/src/production-runtime/backends/webgpu/WebGPUCapabilities.ts +0 -2
  188. package/src/production-runtime/backends/webgpu/WebGPURenderTarget.ts +0 -2
  189. package/src/production-runtime/backends/webgpu/WebGPUShader.ts +0 -2
  190. package/src/production-runtime/backends/webgpu/WebGPUTexture.ts +0 -2
  191. package/src/production-runtime/color/ColorManagement.ts +0 -3
  192. package/src/production-runtime/color/ToneMapping.ts +0 -7
  193. package/src/production-runtime/diagnostics/FrameCapture.ts +0 -2
  194. package/src/production-runtime/diagnostics/GPUCapabilities.ts +0 -2
  195. package/src/production-runtime/diagnostics/RendererStats.ts +0 -2
  196. package/src/production-runtime/environment/EnvironmentMap.ts +0 -1
  197. package/src/production-runtime/environment/HDRLoader.ts +0 -57
  198. package/src/production-runtime/environment/PMREMGenerator.ts +0 -713
  199. package/src/production-runtime/framegraph/FrameGraph.ts +0 -18
  200. package/src/production-runtime/framegraph/RenderPass.ts +0 -15
  201. package/src/production-runtime/geometry/ProjectedDecalGeometry.ts +0 -439
  202. package/src/production-runtime/index.ts +0 -127
  203. package/src/production-runtime/lights/LightManager.ts +0 -7
  204. package/src/production-runtime/lights/ShadowMapRenderer.ts +0 -5
  205. package/src/production-runtime/materials/GLTFMaterialAdapter.ts +0 -6
  206. package/src/production-runtime/materials/GLTFPBRMaterialAdapter.ts +0 -2
  207. package/src/production-runtime/materials/MaterialCompiler.ts +0 -7
  208. package/src/production-runtime/materials/MaterialTextureBindings.ts +0 -5
  209. package/src/production-runtime/materials/PBRMaterial.ts +0 -2
  210. package/src/production-runtime/materials/PBRShaderFeatures.ts +0 -2
  211. package/src/production-runtime/passes/ContactShadowPass.ts +0 -184
  212. package/src/production-runtime/passes/DepthPrepass.ts +0 -7
  213. package/src/production-runtime/passes/OpaquePass.ts +0 -7
  214. package/src/production-runtime/passes/ShadowPass.ts +0 -7
  215. package/src/production-runtime/passes/SkyboxPass.ts +0 -7
  216. package/src/production-runtime/passes/ToneMappingPass.ts +0 -7
  217. package/src/production-runtime/passes/TransparentPass.ts +0 -7
  218. package/src/production-runtime/postprocess/BloomPass.ts +0 -51
  219. package/src/production-runtime/postprocess/ColorGradingPass.ts +0 -49
  220. package/src/production-runtime/postprocess/DOFPass.ts +0 -47
  221. package/src/production-runtime/postprocess/FXAAPass.ts +0 -53
  222. package/src/production-runtime/postprocess/ProductionEffectComposer.ts +0 -78
  223. package/src/production-runtime/postprocess/ProductionPostProcessTypes.ts +0 -174
  224. package/src/production-runtime/postprocess/SSAOPass.ts +0 -45
  225. package/src/production-runtime/resources/GPUBuffer.ts +0 -2
  226. package/src/production-runtime/resources/GPUTexture.ts +0 -2
  227. package/src/production-runtime/resources/RenderTarget.ts +0 -3
  228. package/src/production-runtime/resources/ResourceCache.ts +0 -7
  229. package/src/production-runtime/scene/Camera.ts +0 -1
  230. package/src/production-runtime/scene/Lights.ts +0 -2
  231. package/src/production-runtime/scene/RenderableMesh.ts +0 -2
  232. package/src/production-runtime/scene/RenderablePrimitive.ts +0 -1
  233. package/src/production-runtime/scene/RenderableScene.ts +0 -4
  234. package/src/production-runtime/shaders/ShaderProgramLibrary.ts +0 -7
  235. package/src/production-runtime/shaders/chunks/brdf.glsl +0 -2
  236. package/src/production-runtime/shaders/chunks/ibl.glsl +0 -3
  237. package/src/production-runtime/shaders/chunks/pbr.frag.glsl +0 -47
  238. package/src/production-runtime/shaders/chunks/pbr.vert.glsl +0 -8
  239. package/src/production-runtime/shaders/chunks/shadows.glsl +0 -2
  240. package/src/production-runtime/shaders/wgsl/pbr.wgsl +0 -3
  241. package/src/production-runtime/shaders/wgsl/postprocess.wgsl +0 -2
  242. package/src/production-runtime/shaders/wgsl/skybox.wgsl +0 -2
  243. package/src/shaders/depth.frag.glsl +0 -5
  244. package/src/shaders/depth.vert.glsl +0 -8
  245. package/src/shaders/pbr-direct.frag.glsl +0 -687
  246. package/src/shaders/pbr-direct.vert.glsl +0 -18
  247. package/src/shaders/unlit.frag.glsl +0 -18
  248. package/src/shaders/unlit.vert.glsl +0 -13
  249. package/src/shadows/CascadedShadowPipeline.ts +0 -53
  250. package/src/shadows/ContactShadows.ts +0 -106
  251. package/src/shadows/ShadowDebugViews.ts +0 -46
  252. package/src/threejs-compatibility/InstancingSystem.ts +0 -17
  253. package/src/threejs-compatibility/LightingSystem.ts +0 -22
  254. package/src/threejs-compatibility/MaterialSystem.ts +0 -9
  255. package/src/threejs-compatibility/RenderTargetSystem.ts +0 -35
  256. package/src/threejs-compatibility/RendererDiagnostics.ts +0 -61
  257. package/src/threejs-compatibility/SceneRenderer.ts +0 -34
  258. package/src/threejs-compatibility/ShadowSystem.ts +0 -19
  259. package/src/threejs-compatibility/TextureSystem.ts +0 -19
  260. package/src/threejs-compatibility/ThreeCompatRenderer.ts +0 -90
  261. package/src/threejs-compatibility/TransparencySystem.ts +0 -19
  262. package/src/threejs-compatibility/index.ts +0 -29
  263. package/src/threejs-compatibility/performance/BVH.ts +0 -14
  264. package/src/threejs-compatibility/performance/FrustumCulling.ts +0 -10
  265. package/src/threejs-compatibility/performance/Instancing.ts +0 -4
  266. package/src/threejs-compatibility/performance/LODSystem.ts +0 -16
  267. package/src/threejs-compatibility/performance/OcclusionCulling.ts +0 -6
  268. package/src/threejs-compatibility/performance/RaycastAcceleration.ts +0 -12
  269. package/src/threejs-compatibility/performance/RendererProfiler.ts +0 -19
  270. package/src/threejs-compatibility/performance/TextureStreaming.ts +0 -4
  271. package/src/threejs-compatibility/performance/index.ts +0 -12
  272. package/src/threejs-compatibility/postprocess/BloomPass.ts +0 -16
  273. package/src/threejs-compatibility/postprocess/ColorGradingPass.ts +0 -16
  274. package/src/threejs-compatibility/postprocess/DepthOfFieldPass.ts +0 -21
  275. package/src/threejs-compatibility/postprocess/EffectComposer.ts +0 -14
  276. package/src/threejs-compatibility/postprocess/FXAAPass.ts +0 -15
  277. package/src/threejs-compatibility/postprocess/MotionBlurPass.ts +0 -20
  278. package/src/threejs-compatibility/postprocess/OutlinePass.ts +0 -21
  279. package/src/threejs-compatibility/postprocess/PostProcessTypes.ts +0 -169
  280. package/src/threejs-compatibility/postprocess/RenderPass.ts +0 -9
  281. package/src/threejs-compatibility/postprocess/SMAAPass.ts +0 -15
  282. package/src/threejs-compatibility/postprocess/SSAOPass.ts +0 -21
  283. package/src/threejs-compatibility/postprocess/ShaderPass.ts +0 -7
  284. package/src/threejs-compatibility/postprocess/TAAPass.ts +0 -15
  285. package/src/threejs-compatibility/postprocess/VignettePass.ts +0 -16
  286. package/src/threejs-compatibility/postprocess/index.ts +0 -15
  287. package/src/threejs-compatibility/shaders/NodeMaterial.ts +0 -21
  288. package/src/threejs-compatibility/shaders/RawShaderMaterial.ts +0 -6
  289. package/src/threejs-compatibility/shaders/ShaderDiagnostics.ts +0 -17
  290. package/src/threejs-compatibility/shaders/ShaderMaterial.ts +0 -18
  291. package/src/threejs-compatibility/shaders/ThreeCompatShaderChunks.ts +0 -6
  292. package/src/threejs-compatibility/shaders/Uniforms.ts +0 -18
  293. package/src/threejs-compatibility/shaders/index.ts +0 -9
  294. package/src/threejs-compatibility/vfx/GPUPointCloud.ts +0 -7
  295. package/src/threejs-compatibility/vfx/LineRenderer.ts +0 -13
  296. package/src/threejs-compatibility/vfx/ParticleSystem.ts +0 -23
  297. package/src/threejs-compatibility/vfx/SpriteSystem.ts +0 -14
  298. package/src/threejs-compatibility/vfx/TrailRenderer.ts +0 -8
  299. package/src/threejs-compatibility/vfx/VFXDiagnostics.ts +0 -23
  300. package/src/threejs-compatibility/vfx/index.ts +0 -9
  301. package/src/threejs-example-parity/index.ts +0 -205
  302. package/src/webgpu/WebGPUBuffer.ts +0 -1
  303. package/src/webgpu/WebGPUCompute.ts +0 -2
  304. package/src/webgpu/WebGPUPipelineCache.ts +0 -15
  305. package/src/webgpu/WebGPUPostProcess.ts +0 -2
  306. package/src/webgpu/WebGPUTexture.ts +0 -2
  307. package/tsconfig.json +0 -26
  308. package/vitest.config.ts +0 -20
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aura3d/rendering",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -11,8 +11,42 @@
11
11
  "main": "./dist/index.js",
12
12
  "types": "./dist/index.d.ts",
13
13
  "dependencies": {
14
- "@aura3d/math": "1.4.0",
15
- "@aura3d/scene": "1.4.0"
14
+ "@aura3d/math": "1.4.2",
15
+ "@aura3d/scene": "1.4.2"
16
16
  },
17
- "sideEffects": false
17
+ "sideEffects": false,
18
+ "description": "Render-device abstraction, WebGL2/mock backends, buffers, textures, shader modules, materials, render graphs, lighting, shadows, and particle rendering for Aura3D.",
19
+ "keywords": [
20
+ "aura3d",
21
+ "3d",
22
+ "browser-3d",
23
+ "web-3d",
24
+ "typescript",
25
+ "rendering",
26
+ "webgl2",
27
+ "webgpu",
28
+ "renderer",
29
+ "shader",
30
+ "pbr",
31
+ "render-graph",
32
+ "particles",
33
+ "postprocess"
34
+ ],
35
+ "homepage": "https://aura3d.auraone.ai",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "git+https://github.com/auraoneai/aura3d.git",
39
+ "directory": "packages/rendering"
40
+ },
41
+ "bugs": {
42
+ "url": "https://github.com/auraoneai/aura3d/issues"
43
+ },
44
+ "license": "MIT",
45
+ "publishConfig": {
46
+ "access": "public"
47
+ },
48
+ "files": [
49
+ "README.md",
50
+ "dist"
51
+ ]
18
52
  }
package/AGENTS.md DELETED
@@ -1,46 +0,0 @@
1
- # RENDERING PACKAGE KNOWLEDGE BASE
2
-
3
- **Scope:** `packages/rendering/`
4
- **Generated:** 2026-06-20T14:38:27-0700
5
- **Score:** 19 - largest editable package, renderer internals.
6
-
7
- ## OVERVIEW
8
-
9
- This is the renderer/internal proof layer. It may legitimately contain
10
- low-level rendering and compatibility code, but those results are not automatic
11
- root `createAuraApp` claims.
12
-
13
- ## WHERE TO LOOK
14
-
15
- | Task | Location | Notes |
16
- | --- | --- | --- |
17
- | Renderer core | `src/Renderer.ts`, `src/ForwardPass.ts` | Draw path and diagnostics. |
18
- | Production runtime | `src/production-runtime/` | WebGL/WebGPU proof and runtime labels. |
19
- | Advanced runtime | `src/advanced-runtime/` | Advanced/internal capabilities. |
20
- | Effects/postprocess | `src/effects/`, `src/threejs-compatibility/postprocess/` | Pixel-backed claims required. |
21
- | Morph/skinning | `src/MorphTarget.ts`, related tests | Do not claim root support without browser proof. |
22
- | Parity helpers | `src/threejs-compatibility/` | Migration/comparison scope, not public-safe example scope. |
23
-
24
- ## CONVENTIONS
25
-
26
- - Renderer internals can discuss `rendering` or `production-runtime` labels;
27
- public docs must not collapse them into root safe API support.
28
- - Every visual feature needs a test that checks pixels, diagnostics, or both.
29
- - Keep diagnostic summaries honest: fallback, mock, canvas2d, and zero draw-call
30
- states must remain visible in reports.
31
- - Compatibility with Three.js belongs in `threejs-compatibility` and docs must
32
- label it as migration/parity work.
33
- - Do not patch built output in `dist/rendering`; edit `src/` and tests.
34
-
35
- ## ANTI-PATTERNS
36
-
37
- - Do not use a renderer-internal demo as public `createAuraApp` evidence.
38
- - Do not hide fallbacks or missing features to make a route look production.
39
- - Do not replace pixel checks with DOM-only assertions.
40
- - Do not describe WebGPU, PBR parity, postprocess, skinned animation, or morph
41
- targets as public root features unless root-only browser tests prove them.
42
-
43
- ## VERIFY
44
-
45
- Run the focused renderer unit tests under `tests/unit/rendering`, then the
46
- feature browser spec or readiness command named in root `package.json`.
@@ -1,241 +0,0 @@
1
- export type ArchitecturalLightingPresetId =
2
- | "sunrise"
3
- | "morning"
4
- | "noon"
5
- | "afternoon"
6
- | "golden-hour"
7
- | "sunset"
8
- | "dusk"
9
- | "night";
10
-
11
- export type ArchitecturalLightType = "point" | "spot" | "area";
12
- export type ArchitecturalRgb = readonly [number, number, number];
13
- export type ArchitecturalVector3 = readonly [number, number, number];
14
-
15
- export interface ArchitecturalLightingFixtureOptions {
16
- readonly preset?: ArchitecturalLightingPresetId;
17
- readonly interiorLightsEnabled?: boolean;
18
- }
19
-
20
- export interface ArchitecturalInteriorLight {
21
- readonly id: string;
22
- readonly type: ArchitecturalLightType;
23
- readonly position: ArchitecturalVector3;
24
- readonly color: ArchitecturalRgb;
25
- readonly intensityLumens: number;
26
- readonly rangeMeters: number;
27
- readonly enabled: boolean;
28
- readonly temperatureKelvin: number;
29
- }
30
-
31
- export interface ArchitecturalLightingFixture {
32
- readonly id: "external-parity-old-branch-architectural-lighting-fixture";
33
- readonly source: "origin-master-arch-viz-lighting-controller-adapted";
34
- readonly preset: ArchitecturalLightingPresetId;
35
- readonly presetLabel: string;
36
- readonly timeOfDayHours: number;
37
- readonly sunDirection: ArchitecturalVector3;
38
- readonly sunColor: ArchitecturalRgb;
39
- readonly skyColor: ArchitecturalRgb;
40
- readonly sunIntensity: number;
41
- readonly ambientIntensity: number;
42
- readonly interiorLightsEnabled: boolean;
43
- readonly interiorLights: readonly ArchitecturalInteriorLight[];
44
- readonly activeInteriorLightCount: number;
45
- readonly kelvinRange: readonly [number, number];
46
- readonly supportedCurrentRendererLights: readonly ArchitecturalLightType[];
47
- readonly blockedLightClaims: readonly string[];
48
- readonly hash: string;
49
- readonly claimBoundary: string;
50
- }
51
-
52
- const presetDescriptors: Record<ArchitecturalLightingPresetId, {
53
- readonly label: string;
54
- readonly timeOfDayHours: number;
55
- readonly sunIntensity: number;
56
- readonly sunColor: ArchitecturalRgb;
57
- readonly skyColor: ArchitecturalRgb;
58
- readonly ambientIntensity: number;
59
- readonly interiorLightsOn: boolean;
60
- }> = {
61
- sunrise: {
62
- label: "Sunrise",
63
- timeOfDayHours: 6,
64
- sunIntensity: 1.5,
65
- sunColor: [1, 0.7, 0.4],
66
- skyColor: [0.95, 0.7, 0.6],
67
- ambientIntensity: 0.15,
68
- interiorLightsOn: true
69
- },
70
- morning: {
71
- label: "Morning",
72
- timeOfDayHours: 9,
73
- sunIntensity: 2.8,
74
- sunColor: [1, 0.95, 0.88],
75
- skyColor: [0.6, 0.85, 0.95],
76
- ambientIntensity: 0.25,
77
- interiorLightsOn: false
78
- },
79
- noon: {
80
- label: "Noon",
81
- timeOfDayHours: 12,
82
- sunIntensity: 4.5,
83
- sunColor: [1, 0.98, 0.95],
84
- skyColor: [0.53, 0.81, 0.92],
85
- ambientIntensity: 0.35,
86
- interiorLightsOn: false
87
- },
88
- afternoon: {
89
- label: "Afternoon",
90
- timeOfDayHours: 15,
91
- sunIntensity: 3.2,
92
- sunColor: [1, 0.94, 0.85],
93
- skyColor: [0.58, 0.83, 0.93],
94
- ambientIntensity: 0.28,
95
- interiorLightsOn: false
96
- },
97
- "golden-hour": {
98
- label: "Golden Hour",
99
- timeOfDayHours: 18,
100
- sunIntensity: 2,
101
- sunColor: [1, 0.75, 0.5],
102
- skyColor: [0.95, 0.75, 0.6],
103
- ambientIntensity: 0.2,
104
- interiorLightsOn: true
105
- },
106
- sunset: {
107
- label: "Sunset",
108
- timeOfDayHours: 19.5,
109
- sunIntensity: 1.2,
110
- sunColor: [1, 0.5, 0.3],
111
- skyColor: [0.9, 0.5, 0.4],
112
- ambientIntensity: 0.15,
113
- interiorLightsOn: true
114
- },
115
- dusk: {
116
- label: "Dusk",
117
- timeOfDayHours: 20.5,
118
- sunIntensity: 0.3,
119
- sunColor: [0.7, 0.6, 0.9],
120
- skyColor: [0.25, 0.35, 0.65],
121
- ambientIntensity: 0.08,
122
- interiorLightsOn: true
123
- },
124
- night: {
125
- label: "Night",
126
- timeOfDayHours: 23,
127
- sunIntensity: 0.15,
128
- sunColor: [0.7, 0.75, 0.9],
129
- skyColor: [0.02, 0.03, 0.08],
130
- ambientIntensity: 0.05,
131
- interiorLightsOn: true
132
- }
133
- };
134
-
135
- const interiorLightDescriptors: readonly Omit<ArchitecturalInteriorLight, "color" | "enabled">[] = [
136
- { id: "living-ceiling-1", type: "point", position: [0, 2.7, -2], intensityLumens: 800, rangeMeters: 5, temperatureKelvin: 3000 },
137
- { id: "living-ceiling-2", type: "point", position: [0, 2.7, 2], intensityLumens: 800, rangeMeters: 5, temperatureKelvin: 3000 },
138
- { id: "kitchen-task-1", type: "spot", position: [-3, 2.5, -1], intensityLumens: 1200, rangeMeters: 4, temperatureKelvin: 4000 },
139
- { id: "kitchen-task-2", type: "spot", position: [-3, 2.5, 1], intensityLumens: 1200, rangeMeters: 4, temperatureKelvin: 4000 },
140
- { id: "bedroom-ambient", type: "point", position: [4, 2.6, 0], intensityLumens: 600, rangeMeters: 6, temperatureKelvin: 2700 },
141
- { id: "study-desk", type: "spot", position: [3.5, 1.2, -2.5], intensityLumens: 400, rangeMeters: 2.5, temperatureKelvin: 4500 },
142
- { id: "hallway-1", type: "point", position: [0, 2.5, 5], intensityLumens: 500, rangeMeters: 4, temperatureKelvin: 3500 },
143
- { id: "hallway-2", type: "point", position: [0, 2.5, -5], intensityLumens: 500, rangeMeters: 4, temperatureKelvin: 3500 },
144
- { id: "bathroom-main", type: "area", position: [-4, 2.4, 3], intensityLumens: 900, rangeMeters: 3, temperatureKelvin: 5000 },
145
- { id: "accent-wall", type: "spot", position: [-5.5, 1.5, 0], intensityLumens: 300, rangeMeters: 3, temperatureKelvin: 3200 }
146
- ];
147
-
148
- export function createArchitecturalLightingFixture(options: ArchitecturalLightingFixtureOptions = {}): ArchitecturalLightingFixture {
149
- const preset = options.preset ?? "noon";
150
- const descriptor = presetDescriptors[preset];
151
- const interiorLightsEnabled = options.interiorLightsEnabled ?? descriptor.interiorLightsOn;
152
- const interiorLights = interiorLightDescriptors.map((light) => ({
153
- ...light,
154
- color: kelvinToRgb(light.temperatureKelvin),
155
- enabled: interiorLightsEnabled
156
- }));
157
- const enabledLights = interiorLights.filter((light) => light.enabled);
158
- const kelvinValues = interiorLights.map((light) => light.temperatureKelvin);
159
- const sunDirection = directionForTimeOfDay(descriptor.timeOfDayHours);
160
- return {
161
- id: "external-parity-old-branch-architectural-lighting-fixture",
162
- source: "origin-master-arch-viz-lighting-controller-adapted",
163
- preset,
164
- presetLabel: descriptor.label,
165
- timeOfDayHours: descriptor.timeOfDayHours,
166
- sunDirection,
167
- sunColor: descriptor.sunColor,
168
- skyColor: descriptor.skyColor,
169
- sunIntensity: descriptor.sunIntensity,
170
- ambientIntensity: descriptor.ambientIntensity,
171
- interiorLightsEnabled,
172
- interiorLights,
173
- activeInteriorLightCount: enabledLights.length,
174
- kelvinRange: [Math.min(...kelvinValues), Math.max(...kelvinValues)],
175
- supportedCurrentRendererLights: ["point", "spot"],
176
- blockedLightClaims: [
177
- "physically accurate global illumination",
178
- "photometric area-light shading parity",
179
- "Unity/Unreal architectural lighting workflow parity"
180
- ],
181
- hash: hashLighting(preset, sunDirection, descriptor, interiorLights),
182
- claimBoundary: "Deterministic time-of-day sun, Kelvin interior-light metadata, and bounded current-renderer point/spot light evidence adapted from the old arch-viz LightingController; this does not claim GI, baked lighting, photometric area-light, or Unity/Unreal lighting-workflow parity."
183
- };
184
- }
185
-
186
- function directionForTimeOfDay(timeOfDayHours: number): ArchitecturalVector3 {
187
- const hourAngle = (timeOfDayHours - 6) * 15;
188
- const elevation = Math.sin(hourAngle * Math.PI / 180) * 60;
189
- const azimuth = (hourAngle - 90) * Math.PI / 180;
190
- const x = Math.cos(azimuth) * 50;
191
- const y = Math.max(elevation, -10);
192
- const z = Math.sin(azimuth) * 50;
193
- const length = Math.hypot(x, y, z) || 1;
194
- return [
195
- Number((-x / length).toFixed(4)),
196
- Number((-y / length).toFixed(4)),
197
- Number((-z / length).toFixed(4))
198
- ];
199
- }
200
-
201
- function kelvinToRgb(kelvin: number): ArchitecturalRgb {
202
- const temp = kelvin / 100;
203
- const red = temp <= 66 ? 255 : clamp(329.698727446 * Math.pow(temp - 60, -0.1332047592), 0, 255);
204
- const green = temp <= 66
205
- ? clamp(99.4708025861 * Math.log(temp) - 161.1195681661, 0, 255)
206
- : clamp(288.1221695283 * Math.pow(temp - 60, -0.0755148492), 0, 255);
207
- const blue = temp >= 66 ? 255 : temp <= 19 ? 0 : clamp(138.5177312231 * Math.log(temp - 10) - 305.0447927307, 0, 255);
208
- return [roundColor(red / 255), roundColor(green / 255), roundColor(blue / 255)];
209
- }
210
-
211
- function hashLighting(
212
- preset: ArchitecturalLightingPresetId,
213
- sunDirection: ArchitecturalVector3,
214
- descriptor: (typeof presetDescriptors)[ArchitecturalLightingPresetId],
215
- lights: readonly ArchitecturalInteriorLight[]
216
- ): string {
217
- let hash = 0x811c9dc5;
218
- for (const value of [
219
- preset.length,
220
- descriptor.timeOfDayHours,
221
- descriptor.sunIntensity,
222
- descriptor.ambientIntensity,
223
- ...sunDirection,
224
- ...lights.flatMap((light) => [light.intensityLumens, light.rangeMeters, light.temperatureKelvin, light.enabled ? 1 : 0])
225
- ]) {
226
- const scaled = Math.round(value * 10_000);
227
- hash ^= scaled & 0xff;
228
- hash = Math.imul(hash, 0x01000193) >>> 0;
229
- hash ^= (scaled >>> 8) & 0xff;
230
- hash = Math.imul(hash, 0x01000193) >>> 0;
231
- }
232
- return hash.toString(16).padStart(8, "0");
233
- }
234
-
235
- function roundColor(value: number): number {
236
- return Number(clamp(value, 0, 1).toFixed(4));
237
- }
238
-
239
- function clamp(value: number, min: number, max: number): number {
240
- return Math.max(min, Math.min(max, value));
241
- }
@@ -1,130 +0,0 @@
1
- import { PBRMaterial } from "./PBRMaterial";
2
- import { TexturedPBRMaterial } from "./TexturedPBRMaterial";
3
- import { type ProceduralTextureFixtureKind, createProceduralTexture } from "./ProceduralTextureFixtures";
4
-
5
- export type ArchitecturalMaterialCategory = "wood" | "stone" | "metal" | "fabric" | "glass" | "ceramic";
6
-
7
- export interface ArchitecturalMaterialDescriptor {
8
- readonly id: string;
9
- readonly label: string;
10
- readonly category: ArchitecturalMaterialCategory;
11
- readonly baseColor: readonly [number, number, number, number];
12
- readonly roughness: number;
13
- readonly metallic: number;
14
- readonly normalStrength: number;
15
- readonly ambientOcclusion: number;
16
- readonly alpha?: number;
17
- readonly textureFixture?: ProceduralTextureFixtureKind;
18
- readonly knownLimits: readonly string[];
19
- }
20
-
21
- export interface ArchitecturalMaterialCatalogSummary {
22
- readonly materialCount: number;
23
- readonly categories: readonly ArchitecturalMaterialCategory[];
24
- readonly categoryCounts: Readonly<Record<ArchitecturalMaterialCategory, number>>;
25
- readonly texturedMaterialCount: number;
26
- readonly source: "origin-master-examples-arch-viz-material-library-adapted";
27
- readonly claimBoundary: string;
28
- }
29
-
30
- const knownLimits = [
31
- "Adapted from the old arch-viz material library as deterministic current-engine PBR presets.",
32
- "These are procedural/local material presets, not scanned production material assets or Unity/Unreal physical material parity evidence."
33
- ] as const;
34
-
35
- const catalog = [
36
- material("oak", "Oak Wood", "wood", [0.545, 0.396, 0.259, 1], 0.65, 0, 0.8, 0.85, "wood-plank"),
37
- material("walnut", "Walnut Wood", "wood", [0.361, 0.239, 0.176, 1], 0.6, 0, 0.75, 0.8, "wood-plank"),
38
- material("pine", "Pine Wood", "wood", [0.816, 0.694, 0.502, 1], 0.7, 0, 0.6, 0.9, "wood-plank"),
39
- material("mahogany", "Mahogany Wood", "wood", [0.502, 0.227, 0.145, 1], 0.55, 0, 0.7, 0.82, "wood-plank"),
40
- material("birch", "Birch Wood", "wood", [0.937, 0.878, 0.737, 1], 0.68, 0, 0.5, 0.92, "wood-plank"),
41
- material("teak", "Teak Wood", "wood", [0.682, 0.478, 0.278, 1], 0.5, 0, 0.65, 0.88, "wood-plank"),
42
- material("marble-carrara", "Carrara Marble", "stone", [0.94, 0.93, 0.91, 1], 0.25, 0, 0.4, 0.95, "marble"),
43
- material("granite-black", "Black Granite", "stone", [0.12, 0.12, 0.13, 1], 0.15, 0, 0.3, 0.7, "marble"),
44
- material("limestone", "Limestone", "stone", [0.847, 0.812, 0.729, 1], 0.75, 0, 0.6, 0.85, "concrete-asphalt"),
45
- material("concrete", "Polished Concrete", "stone", [0.502, 0.502, 0.502, 1], 0.6, 0, 0.5, 0.8, "concrete-asphalt"),
46
- material("slate", "Slate Stone", "stone", [0.259, 0.275, 0.29, 1], 0.7, 0, 0.7, 0.75, "concrete-asphalt"),
47
- material("sandstone", "Sandstone", "stone", [0.761, 0.643, 0.467, 1], 0.8, 0, 0.65, 0.83, "concrete-asphalt"),
48
- material("chrome", "Polished Chrome", "metal", [0.549, 0.556, 0.554, 1], 0.05, 1, 0.1, 1),
49
- material("steel-brushed", "Brushed Steel", "metal", [0.651, 0.651, 0.651, 1], 0.3, 1, 0.4, 0.95, "sci-fi-panel"),
50
- material("copper", "Polished Copper", "metal", [0.955, 0.637, 0.538, 1], 0.2, 1, 0.2, 0.98),
51
- material("brass", "Polished Brass", "metal", [0.875, 0.78, 0.455, 1], 0.25, 1, 0.15, 0.97),
52
- material("aluminum", "Brushed Aluminum", "metal", [0.913, 0.921, 0.925, 1], 0.35, 1, 0.3, 0.96, "sci-fi-panel"),
53
- material("metal-black", "Matte Black Metal", "metal", [0.02, 0.02, 0.02, 1], 0.6, 1, 0.2, 0.75),
54
- material("cotton", "Cotton Fabric", "fabric", [0.863, 0.859, 0.847, 1], 0.85, 0, 0.6, 0.88),
55
- material("velvet", "Velvet Fabric", "fabric", [0.122, 0.161, 0.267, 1], 0.9, 0, 0.8, 0.7),
56
- material("leather", "Leather", "fabric", [0.435, 0.286, 0.184, 1], 0.55, 0, 0.5, 0.82),
57
- material("linen", "Linen Fabric", "fabric", [0.906, 0.878, 0.831, 1], 0.88, 0, 0.7, 0.86),
58
- material("wool", "Wool Fabric", "fabric", [0.584, 0.541, 0.494, 1], 0.92, 0, 0.75, 0.84),
59
- material("glass-clear", "Clear Glass", "glass", [0.95, 0.95, 0.95, 0.38], 0.05, 0, 0.1, 1),
60
- material("glass-frosted", "Frosted Glass", "glass", [0.9, 0.9, 0.9, 0.62], 0.4, 0, 0.6, 0.95),
61
- material("glass-tinted", "Tinted Glass", "glass", [0.651, 0.753, 0.769, 0.58], 0.08, 0, 0.1, 0.98),
62
- material("glass-smoked", "Smoked Glass", "glass", [0.275, 0.275, 0.275, 0.52], 0.1, 0, 0.1, 0.85),
63
- material("ceramic-white", "White Ceramic", "ceramic", [0.961, 0.961, 0.961, 1], 0.15, 0, 0.2, 0.98),
64
- material("terracotta", "Terracotta", "ceramic", [0.729, 0.376, 0.278, 1], 0.7, 0, 0.5, 0.85),
65
- material("tile-glazed", "Glazed Tile", "ceramic", [0.847, 0.831, 0.804, 1], 0.12, 0, 0.15, 0.96),
66
- material("porcelain", "Porcelain", "ceramic", [0.941, 0.933, 0.922, 1], 0.18, 0, 0.25, 0.97)
67
- ] as const satisfies readonly ArchitecturalMaterialDescriptor[];
68
-
69
- export function createArchitecturalMaterialCatalog(): readonly ArchitecturalMaterialDescriptor[] {
70
- return catalog;
71
- }
72
-
73
- export function architecturalMaterialCatalogSummary(): ArchitecturalMaterialCatalogSummary {
74
- const categories = ["wood", "stone", "metal", "fabric", "glass", "ceramic"] as const;
75
- return {
76
- materialCount: catalog.length,
77
- categories,
78
- categoryCounts: Object.fromEntries(categories.map((category) => [
79
- category,
80
- catalog.filter((entry) => entry.category === category).length
81
- ])) as Readonly<Record<ArchitecturalMaterialCategory, number>>,
82
- texturedMaterialCount: catalog.filter((entry) => entry.textureFixture).length,
83
- source: "origin-master-examples-arch-viz-material-library-adapted",
84
- claimBoundary: "Catalog proves a deterministic local architectural material taxonomy for browser examples; it does not prove scanned material, Unity, or Unreal parity."
85
- };
86
- }
87
-
88
- export function architecturalMaterialDescriptor(id: string): ArchitecturalMaterialDescriptor {
89
- const descriptor = catalog.find((entry) => entry.id === id);
90
- if (!descriptor) throw new RangeError(`Unknown architectural material preset: ${id}`);
91
- return descriptor;
92
- }
93
-
94
- export function createArchitecturalMaterial(id: string): PBRMaterial | TexturedPBRMaterial {
95
- const descriptor = architecturalMaterialDescriptor(id);
96
- const renderState = descriptor.category === "glass"
97
- ? { cullMode: "none" as const, blend: true, depthWrite: false }
98
- : { cullMode: "none" as const };
99
- if (descriptor.textureFixture) {
100
- return new TexturedPBRMaterial({
101
- name: `architectural-${descriptor.id}`,
102
- baseColor: descriptor.baseColor,
103
- baseColorTexture: createProceduralTexture(descriptor.textureFixture, { width: 96, height: 96, label: `architectural-${descriptor.id}-texture` }),
104
- roughness: descriptor.roughness,
105
- metallic: descriptor.metallic,
106
- renderState
107
- });
108
- }
109
- return new PBRMaterial({
110
- name: `architectural-${descriptor.id}`,
111
- baseColor: descriptor.baseColor,
112
- roughness: descriptor.roughness,
113
- metallic: descriptor.metallic,
114
- renderState
115
- });
116
- }
117
-
118
- function material(
119
- id: string,
120
- label: string,
121
- category: ArchitecturalMaterialCategory,
122
- baseColor: readonly [number, number, number, number],
123
- roughness: number,
124
- metallic: number,
125
- normalStrength: number,
126
- ambientOcclusion: number,
127
- textureFixture?: ProceduralTextureFixtureKind
128
- ): ArchitecturalMaterialDescriptor {
129
- return { id, label, category, baseColor, roughness, metallic, normalStrength, ambientOcclusion, textureFixture, knownLimits };
130
- }
@@ -1,155 +0,0 @@
1
- export type ArchitecturalMeasurementType = "distance" | "area" | "angle" | "height";
2
- export type ArchitecturalMeasurementUnit = "metric" | "imperial";
3
- export type ArchitecturalPoint3 = readonly [number, number, number];
4
-
5
- export interface ArchitecturalMeasurementOptions {
6
- readonly unit?: ArchitecturalMeasurementUnit;
7
- readonly precision?: number;
8
- readonly snapTolerance?: number;
9
- }
10
-
11
- export interface ArchitecturalMeasurementResult {
12
- readonly type: ArchitecturalMeasurementType;
13
- readonly value: number;
14
- readonly unit: string;
15
- readonly label: string;
16
- readonly points: readonly ArchitecturalPoint3[];
17
- }
18
-
19
- export interface ArchitecturalMeasurementFixture {
20
- readonly id: "external-parity-old-branch-architectural-measurement-fixture";
21
- readonly source: "origin-master-arch-viz-measurement-tool-adapted";
22
- readonly snapEnabled: boolean;
23
- readonly snapTolerance: number;
24
- readonly snapPointCount: number;
25
- readonly distance: ArchitecturalMeasurementResult;
26
- readonly area: ArchitecturalMeasurementResult;
27
- readonly angle: ArchitecturalMeasurementResult;
28
- readonly height: ArchitecturalMeasurementResult;
29
- readonly hash: string;
30
- readonly claimBoundary: string;
31
- }
32
-
33
- const defaultSnapPoints: readonly ArchitecturalPoint3[] = [
34
- [-6, 0, -6], [6, 0, -6], [6, 0, 6], [-6, 0, 6],
35
- [-6, 3, -6], [6, 3, -6], [6, 3, 6], [-6, 3, 6],
36
- [0, 0, -6], [0, 0, 6], [-6, 0, 0], [6, 0, 0],
37
- [0, 0, 0],
38
- [-3, 0, -6], [-3, 2.1, -6], [3, 1, 6], [3, 2.5, 6]
39
- ] as const;
40
-
41
- export function createArchitecturalMeasurementFixture(options: ArchitecturalMeasurementOptions = {}): ArchitecturalMeasurementFixture {
42
- const unit = options.unit ?? "metric";
43
- const precision = Math.max(0, Math.min(4, Math.floor(options.precision ?? 2)));
44
- const snapTolerance = finiteNonNegative(options.snapTolerance ?? 0.12, "snapTolerance");
45
- const distancePoints = snapPoints([[-6.04, 0, -6.03], [6.02, 0, -6.01]], snapTolerance);
46
- const areaPoints = snapPoints([[-6, 0, -6], [6, 0, -6], [6, 0, 6], [-6, 0, 6]], snapTolerance);
47
- const anglePoints = snapPoints([[6, 0, -6], [0.02, 0, -5.98], [0.01, 0, 0.03]], snapTolerance);
48
- const heightPoints = snapPoints([[-3.02, 0.01, -6], [-3.01, 2.09, -6.01]], snapTolerance);
49
- const distance = measurement("distance", distancePoints, unit, precision);
50
- const area = measurement("area", areaPoints, unit, precision);
51
- const angle = measurement("angle", anglePoints, unit, precision);
52
- const height = measurement("height", heightPoints, unit, precision);
53
- return {
54
- id: "external-parity-old-branch-architectural-measurement-fixture",
55
- source: "origin-master-arch-viz-measurement-tool-adapted",
56
- snapEnabled: true,
57
- snapTolerance,
58
- snapPointCount: defaultSnapPoints.length,
59
- distance,
60
- area,
61
- angle,
62
- height,
63
- hash: hashMeasurements([distance, area, angle, height]),
64
- claimBoundary: "Deterministic snap-point distance, area, angle, and height measurement math adapted from the old arch-viz measurement tool; this is architectural workflow evidence, not CAD/BIM dimensioning, IFC import, triangle picking, or legal measurement accuracy."
65
- };
66
- }
67
-
68
- function measurement(type: ArchitecturalMeasurementType, points: readonly ArchitecturalPoint3[], unit: ArchitecturalMeasurementUnit, precision: number): ArchitecturalMeasurementResult {
69
- const value = type === "distance"
70
- ? distance(points[0]!, points[1]!)
71
- : type === "area"
72
- ? polygonAreaXZ(points)
73
- : type === "angle"
74
- ? angleDegrees(points[0]!, points[1]!, points[2]!)
75
- : Math.abs((points[1]?.[1] ?? 0) - (points[0]?.[1] ?? 0));
76
- return {
77
- type,
78
- value: Number(value.toFixed(4)),
79
- unit: type === "angle" ? "deg" : unit === "metric" ? type === "area" ? "m2" : "m" : type === "area" ? "ft2" : "ft",
80
- label: type === "angle" ? `${value.toFixed(precision)} deg` : type === "area" ? formatArea(value, unit, precision) : formatDistance(value, unit, precision),
81
- points
82
- };
83
- }
84
-
85
- function snapPoints(points: readonly ArchitecturalPoint3[], tolerance: number): readonly ArchitecturalPoint3[] {
86
- return points.map((point) => {
87
- let nearest = point;
88
- let nearestDistance = tolerance;
89
- for (const snap of defaultSnapPoints) {
90
- const d = distance(point, snap);
91
- if (d < nearestDistance) {
92
- nearest = snap;
93
- nearestDistance = d;
94
- }
95
- }
96
- return nearest;
97
- });
98
- }
99
-
100
- function distance(left: ArchitecturalPoint3, right: ArchitecturalPoint3): number {
101
- return Math.hypot(right[0] - left[0], right[1] - left[1], right[2] - left[2]);
102
- }
103
-
104
- function polygonAreaXZ(points: readonly ArchitecturalPoint3[]): number {
105
- let area = 0;
106
- for (let index = 0; index < points.length; index += 1) {
107
- const current = points[index]!;
108
- const next = points[(index + 1) % points.length]!;
109
- area += current[0] * next[2] - next[0] * current[2];
110
- }
111
- return Math.abs(area) / 2;
112
- }
113
-
114
- function angleDegrees(left: ArchitecturalPoint3, vertex: ArchitecturalPoint3, right: ArchitecturalPoint3): number {
115
- const a = normalize([left[0] - vertex[0], left[1] - vertex[1], left[2] - vertex[2]]);
116
- const b = normalize([right[0] - vertex[0], right[1] - vertex[1], right[2] - vertex[2]]);
117
- const dot = Math.max(-1, Math.min(1, a[0] * b[0] + a[1] * b[1] + a[2] * b[2]));
118
- return Math.acos(dot) * 180 / Math.PI;
119
- }
120
-
121
- function normalize(value: ArchitecturalPoint3): ArchitecturalPoint3 {
122
- const length = Math.hypot(value[0], value[1], value[2]) || 1;
123
- return [value[0] / length, value[1] / length, value[2] / length];
124
- }
125
-
126
- function formatDistance(meters: number, unit: ArchitecturalMeasurementUnit, precision: number): string {
127
- if (unit === "metric") return meters < 1 ? `${(meters * 100).toFixed(precision)} cm` : `${meters.toFixed(precision)} m`;
128
- const feet = meters * 3.28084;
129
- const wholeFeet = Math.floor(feet);
130
- const inches = (feet % 1) * 12;
131
- return wholeFeet === 0 ? `${inches.toFixed(precision)} in` : `${wholeFeet} ft ${inches.toFixed(precision)} in`;
132
- }
133
-
134
- function formatArea(squareMeters: number, unit: ArchitecturalMeasurementUnit, precision: number): string {
135
- return unit === "metric" ? `${squareMeters.toFixed(precision)} m2` : `${(squareMeters * 10.7639).toFixed(precision)} ft2`;
136
- }
137
-
138
- function hashMeasurements(measurements: readonly ArchitecturalMeasurementResult[]): string {
139
- let hash = 0x811c9dc5;
140
- for (const result of measurements) {
141
- const scaled = Math.round(result.value * 10_000);
142
- hash ^= scaled & 0xff;
143
- hash = Math.imul(hash, 0x01000193) >>> 0;
144
- hash ^= (scaled >>> 8) & 0xff;
145
- hash = Math.imul(hash, 0x01000193) >>> 0;
146
- hash ^= result.type.charCodeAt(0);
147
- hash = Math.imul(hash, 0x01000193) >>> 0;
148
- }
149
- return hash.toString(16).padStart(8, "0");
150
- }
151
-
152
- function finiteNonNegative(value: number, label: string): number {
153
- if (!Number.isFinite(value) || value < 0) throw new RangeError(`Architectural measurement ${label} must be finite and non-negative.`);
154
- return value;
155
- }
package/src/BRDFLut.ts DELETED
@@ -1,47 +0,0 @@
1
- import { generateApproximateBrdfLutPixels, type Rgba8EnvironmentMapSource } from "./EnvironmentMapResources";
2
-
3
- export interface ExternalParityBrdfLut {
4
- readonly width: number;
5
- readonly height: number;
6
- readonly data: Uint8Array;
7
- readonly textureLabel: string;
8
- readonly diagnostics: {
9
- readonly byteLength: number;
10
- readonly nonZeroPixels: number;
11
- readonly monotonicRoughnessTrend: boolean;
12
- };
13
- }
14
-
15
- export function createExternalParityBrdfLut(size = 64): ExternalParityBrdfLut {
16
- if (!Number.isInteger(size) || size < 16) {
17
- throw new RangeError("ExternalParity BRDF LUT size must be an integer >= 16.");
18
- }
19
- const source = generateApproximateBrdfLutPixels({ width: size, height: size });
20
- return {
21
- width: source.width,
22
- height: source.height,
23
- data: new Uint8Array(source.data),
24
- textureLabel: "external-parity-brdf-lut",
25
- diagnostics: {
26
- byteLength: source.data.byteLength,
27
- nonZeroPixels: countNonZeroPixels(source),
28
- monotonicRoughnessTrend: roughnessTrend(source)
29
- }
30
- };
31
- }
32
-
33
- function countNonZeroPixels(source: Rgba8EnvironmentMapSource): number {
34
- let count = 0;
35
- for (let index = 0; index < source.data.length; index += 4) {
36
- if ((source.data[index] ?? 0) + (source.data[index + 1] ?? 0) + (source.data[index + 2] ?? 0) > 0) count += 1;
37
- }
38
- return count;
39
- }
40
-
41
- function roughnessTrend(source: Rgba8EnvironmentMapSource): boolean {
42
- const sampleX = Math.max(0, Math.min(source.width - 1, Math.floor(source.width * 0.5)));
43
- const firstRow = source.data[sampleX * 4] ?? 0;
44
- const lastRowOffset = ((source.height - 1) * source.width + sampleX) * 4;
45
- const lastRow = source.data[lastRowOffset] ?? 0;
46
- return firstRow !== lastRow;
47
- }