@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,815 +0,0 @@
1
- import { Geometry, type Bounds3 } from "./Geometry";
2
- import { PBRMaterial } from "./PBRMaterial";
3
- import { createProceduralTexture } from "./ProceduralTextureFixtures";
4
- import { Sampler } from "./Sampler";
5
- import { TexturedPBRMaterial } from "./TexturedPBRMaterial";
6
- import { TexturedUnlitMaterial } from "./TexturedUnlitMaterial";
7
- import { UnlitMaterial } from "./UnlitMaterial";
8
- import { createExternalParityEnvironmentLighting } from "./ExternalParityRenderPreset";
9
- import { DirectionalLight } from "@aura3d/scene";
10
- import type { RenderItem, RenderMaterial } from "./ForwardPass";
11
- import type { CollectedLight } from "./LightCollector";
12
- import type { RendererPostProcessOptions, RenderSource } from "./Renderer";
13
-
14
- export type ProductTurntableDirection = "cw" | "ccw";
15
- export type ProductTurntableLightingPreset = "studio" | "soft" | "inspection" | "dramatic" | "neutral";
16
- export type ProductTurntableCaptureFormat = "png" | "jpeg" | "webp";
17
- export type ProductTurntableBatchTaskKind = "thumbnail" | "screenshot" | "360-spin" | "ar-export";
18
-
19
- export interface ProductTurntableFixtureOptions {
20
- readonly elapsedSeconds?: number;
21
- readonly interactionCount?: number;
22
- readonly interactionAgeMs?: number;
23
- readonly canvasWidth?: number;
24
- readonly canvasHeight?: number;
25
- readonly lightingPreset?: ProductTurntableLightingPreset;
26
- readonly captureRequested?: boolean;
27
- readonly exportedBytes?: number;
28
- }
29
-
30
- export interface ProductTurntableHotspot {
31
- readonly id: string;
32
- readonly group: "material" | "controls" | "comfort";
33
- readonly label: string;
34
- readonly content: string;
35
- readonly position: readonly [number, number, number];
36
- readonly screen: {
37
- readonly x: number;
38
- readonly y: number;
39
- readonly visible: boolean;
40
- readonly occluded: false;
41
- };
42
- readonly visibilityThreshold: number;
43
- }
44
-
45
- export interface ProductTurntableLighting {
46
- readonly source: "origin-master-ecommerce-lighting-preset-manager-adapted";
47
- readonly presets: readonly ProductTurntableLightingPreset[];
48
- readonly activePreset: ProductTurntableLightingPreset;
49
- readonly activeLightCount: number;
50
- readonly ambientIntensity: number;
51
- readonly keyIntensity: number;
52
- readonly fillIntensity: number;
53
- readonly rimIntensity: number;
54
- readonly environmentIntensity: number;
55
- readonly shadowEnabled: boolean;
56
- readonly shadowSoftness: number;
57
- readonly transitionSupported: true;
58
- }
59
-
60
- export interface ProductTurntableCapturePlan {
61
- readonly source: "origin-master-ecommerce-capture-batch-export-adapted";
62
- readonly screenshotFormats: readonly ProductTurntableCaptureFormat[];
63
- readonly screenshotViews: readonly string[];
64
- readonly spinFrameCount: number;
65
- readonly spinDurationSeconds: number;
66
- readonly batchTasks: readonly ProductTurntableBatchTaskKind[];
67
- readonly completedBatchTasks: number;
68
- readonly captureRequested: boolean;
69
- readonly exportedBytes: number;
70
- readonly arExportFormats: readonly ["glb"];
71
- readonly blockedExportClaims: readonly string[];
72
- }
73
-
74
- export interface ProductTurntableFixture {
75
- readonly id: "external-product-turntable-fixture";
76
- readonly source: "origin-master-ecommerce-turntable-adapted";
77
- readonly sourceFiles: readonly string[];
78
- readonly autoRotate: true;
79
- readonly speedRadiansPerSecond: number;
80
- readonly direction: ProductTurntableDirection;
81
- readonly pauseOnInteraction: true;
82
- readonly resumeDelayMs: number;
83
- readonly smoothTransition: true;
84
- readonly transitionDurationSeconds: number;
85
- readonly currentSpeedRadiansPerSecond: number;
86
- readonly rotationRadians: number;
87
- readonly pausedByInteraction: boolean;
88
- readonly interactionCount: number;
89
- readonly hotspots: readonly ProductTurntableHotspot[];
90
- readonly visibleHotspotCount: number;
91
- readonly lighting: ProductTurntableLighting;
92
- readonly capture: ProductTurntableCapturePlan;
93
- readonly manifestHash: string;
94
- readonly claimBoundary: string;
95
- }
96
-
97
- export interface ProductTurntableRenderKitOptions extends ProductTurntableFixtureOptions {
98
- readonly includeStage?: boolean;
99
- }
100
-
101
- export interface ProductTurntableRenderKit {
102
- readonly fixture: ProductTurntableFixture;
103
- readonly source: RenderSource;
104
- readonly renderItems: readonly RenderItem[];
105
- readonly geometryLibrary: ReadonlyMap<string, Geometry>;
106
- readonly materialLibrary: ReadonlyMap<string, RenderMaterial>;
107
- readonly bounds: Bounds3;
108
- readonly postprocess: RendererPostProcessOptions;
109
- dispose(): void;
110
- }
111
-
112
- const sourceFiles = [
113
- "master:src/ecommerce/turntable/TurntableController.ts",
114
- "master:src/ecommerce/turntable/HotspotManager.ts",
115
- "master:src/ecommerce/turntable/LightingPresetManager.ts",
116
- "master:src/ecommerce/turntable/CaptureManager.ts",
117
- "master:src/ecommerce/turntable/BatchProcessor.ts",
118
- "master:src/ecommerce/turntable/ARExporter.ts"
119
- ] as const;
120
-
121
- const lightingPresets: Record<ProductTurntableLightingPreset, Omit<ProductTurntableLighting, "source" | "presets" | "activePreset" | "transitionSupported">> = {
122
- studio: {
123
- activeLightCount: 4,
124
- ambientIntensity: 0.2,
125
- keyIntensity: 1.5,
126
- fillIntensity: 0.5,
127
- rimIntensity: 0.8,
128
- environmentIntensity: 1,
129
- shadowEnabled: true,
130
- shadowSoftness: 0.5
131
- },
132
- soft: {
133
- activeLightCount: 4,
134
- ambientIntensity: 0.5,
135
- keyIntensity: 0.8,
136
- fillIntensity: 0.8,
137
- rimIntensity: 0.4,
138
- environmentIntensity: 0.85,
139
- shadowEnabled: false,
140
- shadowSoftness: 1
141
- },
142
- inspection: {
143
- activeLightCount: 3,
144
- ambientIntensity: 0.32,
145
- keyIntensity: 1.15,
146
- fillIntensity: 0.65,
147
- rimIntensity: 0.35,
148
- environmentIntensity: 1.05,
149
- shadowEnabled: true,
150
- shadowSoftness: 0.35
151
- },
152
- dramatic: {
153
- activeLightCount: 3,
154
- ambientIntensity: 0.05,
155
- keyIntensity: 2.5,
156
- fillIntensity: 0.12,
157
- rimIntensity: 1.2,
158
- environmentIntensity: 0.7,
159
- shadowEnabled: true,
160
- shadowSoftness: 0.1
161
- },
162
- neutral: {
163
- activeLightCount: 4,
164
- ambientIntensity: 0.3,
165
- keyIntensity: 1,
166
- fillIntensity: 0.6,
167
- rimIntensity: 0.3,
168
- environmentIntensity: 1,
169
- shadowEnabled: true,
170
- shadowSoftness: 0.5
171
- }
172
- };
173
-
174
- export function createProductTurntableFixture(options: ProductTurntableFixtureOptions = {}): ProductTurntableFixture {
175
- const elapsedSeconds = finiteOrDefault(options.elapsedSeconds, 0, "elapsedSeconds");
176
- const interactionCount = integerOrDefault(options.interactionCount, 0, "interactionCount");
177
- const interactionAgeMs = finiteOrDefault(options.interactionAgeMs, Number.POSITIVE_INFINITY, "interactionAgeMs");
178
- const canvasWidth = Math.max(320, integerOrDefault(options.canvasWidth, 960, "canvasWidth"));
179
- const canvasHeight = Math.max(240, integerOrDefault(options.canvasHeight, 540, "canvasHeight"));
180
- const lightingPreset = options.lightingPreset ?? "studio";
181
- const speedRadiansPerSecond = Math.PI / 8;
182
- const resumeDelayMs = 2_000;
183
- const transitionDurationSeconds = 0.5;
184
- const pausedByInteraction = interactionCount > 0 && interactionAgeMs < resumeDelayMs;
185
- const resumeBlend = pausedByInteraction ? 0 : Math.min(1, Math.max(0, (interactionAgeMs - resumeDelayMs) / (transitionDurationSeconds * 1000)));
186
- const currentSpeedRadiansPerSecond = Number((speedRadiansPerSecond * resumeBlend).toFixed(4));
187
- const rotationRadians = Number(((elapsedSeconds * speedRadiansPerSecond) % (Math.PI * 2)).toFixed(4));
188
- const hotspots = createHotspots(rotationRadians, canvasWidth, canvasHeight);
189
- const visibleHotspotCount = hotspots.filter((hotspot) => hotspot.screen.visible).length;
190
- const capture = createCapturePlan(Boolean(options.captureRequested), Math.max(0, integerOrDefault(options.exportedBytes, 0, "exportedBytes")));
191
- const lighting = createLighting(lightingPreset);
192
- const hash = hashProductTurntable([
193
- rotationRadians,
194
- currentSpeedRadiansPerSecond,
195
- visibleHotspotCount,
196
- lighting.activeLightCount,
197
- lighting.environmentIntensity,
198
- capture.completedBatchTasks,
199
- capture.exportedBytes
200
- ]);
201
-
202
- return {
203
- id: "external-product-turntable-fixture",
204
- source: "origin-master-ecommerce-turntable-adapted",
205
- sourceFiles,
206
- autoRotate: true,
207
- speedRadiansPerSecond,
208
- direction: "cw",
209
- pauseOnInteraction: true,
210
- resumeDelayMs,
211
- smoothTransition: true,
212
- transitionDurationSeconds,
213
- currentSpeedRadiansPerSecond,
214
- rotationRadians,
215
- pausedByInteraction,
216
- interactionCount,
217
- hotspots,
218
- visibleHotspotCount,
219
- lighting,
220
- capture,
221
- manifestHash: hash,
222
- claimBoundary: "This fixture adapts old ecommerce turntable concepts into deterministic external product evidence. It does not claim a complete ecommerce pipeline, native USDZ export, video capture, PIM integration, or AR platform parity."
223
- };
224
- }
225
-
226
- export function createProductTurntableRenderKit(options: ProductTurntableRenderKitOptions = {}): ProductTurntableRenderKit {
227
- const fixture = createProductTurntableFixture(options);
228
- const environment = createExternalParityEnvironmentLighting(productTurntableEnvironmentPreset(fixture.lighting.activePreset));
229
- const sampler = new Sampler({ minFilter: "linear-mipmap-linear", magFilter: "linear", addressU: "repeat", addressV: "repeat" });
230
- const detailSampler = new Sampler({ minFilter: "linear", magFilter: "linear", addressU: "repeat", addressV: "repeat" });
231
- const textures = [
232
- createProceduralTexture("metallic-paint", { width: 128, height: 128 }),
233
- createProceduralTexture("carbon-fiber", { width: 128, height: 128 }),
234
- createProceduralTexture("metallic-roughness-map", { width: 128, height: 128 }),
235
- createProceduralTexture("normal-from-height", { width: 128, height: 128 }),
236
- createProceduralTexture("sci-fi-panel", { width: 128, height: 128 }),
237
- createProceduralTexture("concrete-asphalt", { width: 128, height: 128 }),
238
- createProceduralTexture("racing-stripes", { width: 128, height: 128 })
239
- ];
240
- const [paint, carbon, metallicRoughness, normal, panel, concrete, accentStripes] = textures;
241
- const geometryLibrary = new Map<string, Geometry>([
242
- ["ear-shell", Geometry.capsule({ radius: 0.34, height: 0.9, segments: 64, rings: 16, textured: true })],
243
- ["ear-pad", Geometry.uvSphere(0.42, 64, 32, { textured: true })],
244
- ["headband", Geometry.texturedCube(1)],
245
- ["control", Geometry.texturedCube(1)],
246
- ["accent", Geometry.uvSphere(0.18, 48, 24, { textured: true })],
247
- ["stage", Geometry.texturedCube(1)]
248
- ]);
249
- const materialLibrary = new Map<string, RenderMaterial>([
250
- ["painted-shell", new TexturedPBRMaterial({
251
- name: "turntable-painted-metal-shell",
252
- baseColor: [0.48, 0.5, 0.52, 1],
253
- metallic: 0.62,
254
- roughness: 0.32,
255
- metallicRoughnessTexture: metallicRoughness,
256
- metallicRoughnessSampler: sampler,
257
- normalTexture: normal,
258
- normalSampler: detailSampler,
259
- normalScale: 0.12,
260
- clearcoatFactor: 0.34,
261
- clearcoatRoughnessFactor: 0.22
262
- })],
263
- ["carbon-pad", new TexturedPBRMaterial({
264
- name: "turntable-carbon-cushion",
265
- baseColor: [0.08, 0.09, 0.11, 1],
266
- metallic: 0.08,
267
- roughness: 0.64,
268
- baseColorTexture: carbon,
269
- baseColorSampler: sampler,
270
- normalTexture: normal,
271
- normalSampler: detailSampler,
272
- normalScale: 0.22
273
- })],
274
- ["brushed-trim", new PBRMaterial({
275
- name: "turntable-brushed-trim",
276
- baseColor: [0.86, 0.82, 0.72, 1],
277
- metallic: 1,
278
- roughness: 0.19,
279
- specularFactor: 1
280
- })],
281
- ["control-panel", new TexturedPBRMaterial({
282
- name: "turntable-control-panel",
283
- baseColor: [0.16, 0.42, 0.58, 1],
284
- metallic: 0.18,
285
- roughness: 0.38,
286
- baseColorTexture: panel,
287
- baseColorSampler: sampler,
288
- normalTexture: normal,
289
- normalSampler: detailSampler,
290
- normalScale: 0.16,
291
- emissiveColor: [0.01, 0.12, 0.16],
292
- emissiveStrength: 0.18
293
- })],
294
- ["status-light", new PBRMaterial({
295
- name: "turntable-status-light",
296
- baseColor: [0.18, 0.92, 1, 1],
297
- metallic: 0,
298
- roughness: 0.18,
299
- emissiveColor: [0.06, 0.72, 1],
300
- emissiveStrength: 1.4
301
- })],
302
- ["amber-status-light", new PBRMaterial({
303
- name: "turntable-amber-status-light",
304
- baseColor: [1, 0.62, 0.12, 1],
305
- metallic: 0,
306
- roughness: 0.2,
307
- emissiveColor: [1, 0.36, 0.06],
308
- emissiveStrength: 0.9
309
- })],
310
- ["magenta-status-light", new PBRMaterial({
311
- name: "turntable-magenta-status-light",
312
- baseColor: [0.94, 0.16, 0.86, 1],
313
- metallic: 0,
314
- roughness: 0.2,
315
- emissiveColor: [0.56, 0.04, 0.5],
316
- emissiveStrength: 0.82
317
- })],
318
- ["studio-stage", new TexturedUnlitMaterial({
319
- name: "turntable-studio-stage",
320
- texture: concrete,
321
- sampler,
322
- textureTransform: { scale: [7.5, 3.75] },
323
- color: [0.18, 0.2, 0.22, 1]
324
- })],
325
- ["studio-backdrop", new UnlitMaterial({
326
- name: "turntable-studio-backdrop",
327
- color: [0.018, 0.023, 0.03, 1]
328
- })],
329
- ["studio-accent-stripe", new TexturedUnlitMaterial({
330
- name: "turntable-studio-accent-stripe",
331
- texture: accentStripes,
332
- sampler,
333
- textureTransform: { scale: [2.8, 0.8] },
334
- color: [0.72, 0.62, 0.42, 1]
335
- })],
336
- ["paint-finish-reference", new TexturedUnlitMaterial({
337
- name: "turntable-metallic-paint-finish-reference",
338
- texture: paint,
339
- sampler,
340
- textureTransform: { scale: [2.4, 0.8] },
341
- color: [0.2, 0.12, 0.1, 1]
342
- })],
343
- ["studio-softbox", new UnlitMaterial({
344
- name: "turntable-studio-softbox-panel",
345
- color: [0.1, 0.12, 0.14, 1]
346
- })],
347
- ["dark-detail-line", new UnlitMaterial({
348
- name: "turntable-dark-detail-line",
349
- color: [0.018, 0.022, 0.026, 1]
350
- })],
351
- ["cyan-detail-line", new UnlitMaterial({
352
- name: "turntable-cyan-detail-line",
353
- color: [0.08, 0.34, 0.38, 1]
354
- })],
355
- ["warm-detail-line", new UnlitMaterial({
356
- name: "turntable-warm-detail-line",
357
- color: [0.52, 0.31, 0.18, 1]
358
- })]
359
- ]);
360
- const angle = fixture.rotationRadians;
361
- const includeStage = options.includeStage !== false;
362
- const collectedLights = createProductTurntableCollectedLights();
363
- const renderItems: RenderItem[] = [
364
- item(geometryLibrary, materialLibrary, "left-ear-shell", "ear-shell", "painted-shell", -0.56, 0.1, 0, 0.82, 1.08, 0.64, angle),
365
- item(geometryLibrary, materialLibrary, "right-ear-shell", "ear-shell", "painted-shell", 0.56, 0.1, 0, 0.82, 1.08, 0.64, angle),
366
- item(geometryLibrary, materialLibrary, "left-ear-pad", "ear-pad", "carbon-pad", -0.56, -0.02, 0.08, 0.56, 0.72, 0.26, angle),
367
- item(geometryLibrary, materialLibrary, "right-ear-pad", "ear-pad", "carbon-pad", 0.56, -0.02, 0.08, 0.56, 0.72, 0.26, angle),
368
- item(geometryLibrary, materialLibrary, "outer-headband", "headband", "brushed-trim", 0, 0.75, -0.05, 1.52, 0.14, 0.22, angle),
369
- item(geometryLibrary, materialLibrary, "inner-headband", "headband", "carbon-pad", 0, 0.56, 0.02, 1.16, 0.1, 0.18, angle),
370
- item(geometryLibrary, materialLibrary, "left-yoke", "headband", "brushed-trim", -0.54, 0.45, 0, 0.16, 0.64, 0.16, angle),
371
- item(geometryLibrary, materialLibrary, "right-yoke", "headband", "brushed-trim", 0.54, 0.45, 0, 0.16, 0.64, 0.16, angle),
372
- item(geometryLibrary, materialLibrary, "control-module", "control", "control-panel", 0.82, 0.04, 0.16, 0.18, 0.34, 0.12, angle),
373
- item(geometryLibrary, materialLibrary, "status-light", "accent", "status-light", 0.91, 0.08, 0.28, 0.16, 0.16, 0.16, angle),
374
- item(geometryLibrary, materialLibrary, "left-amber-accent", "accent", "amber-status-light", -0.96, 0.16, 0.24, 0.1, 0.1, 0.1, angle),
375
- item(geometryLibrary, materialLibrary, "right-magenta-accent", "accent", "magenta-status-light", 0.36, -0.34, 0.3, 0.1, 0.1, 0.1, angle)
376
- ];
377
- for (const side of [-1, 1] as const) {
378
- for (let index = 0; index < 5; index += 1) {
379
- renderItems.push(item(
380
- geometryLibrary,
381
- materialLibrary,
382
- `ear-pad-stitch-${side}-${index}`,
383
- "headband",
384
- index % 2 === 0 ? "dark-detail-line" : "cyan-detail-line",
385
- side * 0.56,
386
- -0.24 + index * 0.085,
387
- -0.22,
388
- 0.46,
389
- 0.014,
390
- 0.012,
391
- angle
392
- ));
393
- }
394
- for (let index = 0; index < 7; index += 1) {
395
- renderItems.push(item(
396
- geometryLibrary,
397
- materialLibrary,
398
- `ear-pad-vertical-stitch-${side}-${index}`,
399
- "headband",
400
- index % 2 === 0 ? "dark-detail-line" : "cyan-detail-line",
401
- side * (0.34 + index * 0.075),
402
- -0.04,
403
- -0.235,
404
- 0.012,
405
- 0.43,
406
- 0.012,
407
- angle
408
- ));
409
- }
410
- for (let index = 0; index < 4; index += 1) {
411
- renderItems.push(item(
412
- geometryLibrary,
413
- materialLibrary,
414
- `shell-highlight-strake-${side}-${index}`,
415
- "headband",
416
- index % 2 === 0 ? "warm-detail-line" : "dark-detail-line",
417
- side * (0.56 + index * 0.035),
418
- 0.22 + index * 0.078,
419
- -0.24,
420
- 0.34 - index * 0.035,
421
- 0.012,
422
- 0.012,
423
- angle
424
- ));
425
- }
426
- for (let index = 0; index < 7; index += 1) {
427
- renderItems.push(item(
428
- geometryLibrary,
429
- materialLibrary,
430
- `shell-machined-vertical-${side}-${index}`,
431
- "headband",
432
- index % 2 === 0 ? "warm-detail-line" : "dark-detail-line",
433
- side * (0.31 + index * 0.07),
434
- 0.25,
435
- -0.245,
436
- 0.012,
437
- 0.58,
438
- 0.012,
439
- angle
440
- ));
441
- }
442
- }
443
- for (let index = 0; index < 7; index += 1) {
444
- renderItems.push(item(
445
- geometryLibrary,
446
- materialLibrary,
447
- `headband-machined-groove-${index}`,
448
- "headband",
449
- index % 2 === 0 ? "dark-detail-line" : "cyan-detail-line",
450
- -0.58 + index * 0.19,
451
- 0.78,
452
- -0.24,
453
- 0.08,
454
- 0.016,
455
- 0.012,
456
- angle
457
- ));
458
- }
459
- for (let index = 0; index < 6; index += 1) {
460
- renderItems.push(item(
461
- geometryLibrary,
462
- materialLibrary,
463
- `control-module-ridge-${index}`,
464
- "headband",
465
- index % 2 === 0 ? "cyan-detail-line" : "dark-detail-line",
466
- 0.78,
467
- -0.08 + index * 0.052,
468
- -0.26,
469
- 0.16,
470
- 0.01,
471
- 0.01,
472
- angle
473
- ));
474
- }
475
- for (let index = 0; index < 6; index += 1) {
476
- renderItems.push(item(
477
- geometryLibrary,
478
- materialLibrary,
479
- `control-module-vertical-grille-${index}`,
480
- "headband",
481
- index % 2 === 0 ? "cyan-detail-line" : "dark-detail-line",
482
- 0.72 + index * 0.035,
483
- 0.06,
484
- -0.275,
485
- 0.01,
486
- 0.34,
487
- 0.01,
488
- angle
489
- ));
490
- }
491
- if (includeStage) {
492
- renderItems.push(
493
- item(geometryLibrary, materialLibrary, "full-studio-backdrop", "stage", "studio-backdrop", 0, 0.18, -1.48, 7.8, 4.35, 0.05, 0),
494
- item(geometryLibrary, materialLibrary, "studio-stage", "stage", "studio-stage", 0, -0.62, -0.42, 4.4, 0.08, 0.16, 0),
495
- item(geometryLibrary, materialLibrary, "backdrop", "stage", "studio-backdrop", 0, 0.18, -1.12, 4.4, 2.25, 0.05, 0),
496
- item(geometryLibrary, materialLibrary, "stage-accent-stripe-left", "stage", "studio-accent-stripe", -1.04, -0.51, -0.34, 1.18, 0.035, 0.035, 0),
497
- item(geometryLibrary, materialLibrary, "stage-accent-stripe-right", "stage", "studio-accent-stripe", 1.04, -0.51, -0.34, 1.18, 0.035, 0.035, 0),
498
- item(geometryLibrary, materialLibrary, "left-softbox-panel", "stage", "studio-softbox", -1.78, 0.22, -0.94, 0.12, 1.16, 0.04, 0),
499
- item(geometryLibrary, materialLibrary, "right-softbox-panel", "stage", "studio-softbox", 1.78, 0.22, -0.94, 0.12, 1.16, 0.04, 0),
500
- item(geometryLibrary, materialLibrary, "top-softbox-panel", "stage", "studio-softbox", 0, 1.08, -0.94, 1.52, 0.07, 0.04, 0)
501
- );
502
- appendTurntableStageDetails(renderItems, geometryLibrary, materialLibrary);
503
- }
504
- const postprocess: RendererPostProcessOptions = {
505
- targetFormat: "rgba16f",
506
- toneMapping: {
507
- operator: "filmic",
508
- exposure: fixture.lighting.activePreset === "dramatic" ? 1.32 : 1.12,
509
- gamma: 2.2,
510
- inputColorSpace: "linear",
511
- outputColorSpace: "srgb"
512
- },
513
- colorGrade: {
514
- contrast: 1.1,
515
- saturation: 1.08,
516
- vibrance: 0.16,
517
- vignette: 0.12,
518
- sharpening: 0.28
519
- },
520
- bloom: { threshold: 0.78, intensity: 0.12, radius: 1 },
521
- fxaa: true
522
- };
523
- const source: RenderSource = {
524
- renderItems,
525
- cameraPolicy: "auto-frame",
526
- cameraFrameBounds: { min: [-1.35, -0.52, -0.38], max: [1.35, 1, 0.42] },
527
- collectedLights,
528
- environmentLighting: environment.lighting,
529
- shadow: {
530
- enabled: true,
531
- light: collectedLights[0]?.source,
532
- size: 768,
533
- strength: 0.42,
534
- bias: 0.0025,
535
- slopeBias: 1.2,
536
- filter: "pcf",
537
- pcfRadius: 1.25,
538
- pcfSamples: 9
539
- },
540
- postprocess,
541
- frustumCulling: false
542
- };
543
- return {
544
- fixture,
545
- source,
546
- renderItems,
547
- geometryLibrary,
548
- materialLibrary,
549
- bounds: { min: [-2.2, -0.7, -1.18], max: [2.2, 1.13, 0.44] },
550
- postprocess,
551
- dispose: () => {
552
- for (const geometry of geometryLibrary.values()) geometry.dispose();
553
- for (const texture of textures) texture.dispose();
554
- }
555
- };
556
- }
557
-
558
- function appendTurntableStageDetails(
559
- renderItems: RenderItem[],
560
- geometryLibrary: ReadonlyMap<string, Geometry>,
561
- materialLibrary: ReadonlyMap<string, RenderMaterial>
562
- ): void {
563
- for (let index = 0; index < 5; index += 1) {
564
- renderItems.push(item(
565
- geometryLibrary,
566
- materialLibrary,
567
- `studio-floor-perspective-line-${index}`,
568
- "stage",
569
- "dark-detail-line",
570
- -1.2 + index * 0.6,
571
- -0.62,
572
- -0.305,
573
- 0.006,
574
- 0.58,
575
- 0.009,
576
- 0
577
- ));
578
- }
579
- for (let index = 0; index < 3; index += 1) {
580
- renderItems.push(item(
581
- geometryLibrary,
582
- materialLibrary,
583
- `studio-floor-cross-reference-${index}`,
584
- "stage",
585
- "dark-detail-line",
586
- 0,
587
- -0.74 + index * 0.14,
588
- -0.295,
589
- 1.42,
590
- 0.007,
591
- 0.009,
592
- 0
593
- ));
594
- }
595
- }
596
-
597
- function createProductTurntableCollectedLights(): readonly CollectedLight[] {
598
- const key = new DirectionalLight("turntable-key-shadow");
599
- const fill = new DirectionalLight("turntable-fill");
600
- const rim = new DirectionalLight("turntable-rim");
601
- key.castsShadow = true;
602
- key.color = [1, 0.92, 0.78];
603
- key.intensity = 2.35;
604
- fill.color = [0.5, 0.64, 0.95];
605
- fill.intensity = 0.52;
606
- rim.color = [0.85, 0.92, 1];
607
- rim.intensity = 0.92;
608
- return [
609
- {
610
- kind: "directional",
611
- color: [1, 0.92, 0.78],
612
- intensity: 2.35,
613
- position: [0, 0, 0],
614
- direction: [0.42, -0.64, -0.64],
615
- range: 0,
616
- spotAngle: 0,
617
- penumbra: 0,
618
- castsShadow: true,
619
- layerMask: 0xffffffff,
620
- source: key
621
- },
622
- {
623
- kind: "directional",
624
- color: [0.5, 0.64, 0.95],
625
- intensity: 0.52,
626
- position: [0, 0, 0],
627
- direction: [-0.5, -0.3, -0.82],
628
- range: 0,
629
- spotAngle: 0,
630
- penumbra: 0,
631
- castsShadow: false,
632
- layerMask: 0xffffffff,
633
- source: fill
634
- },
635
- {
636
- kind: "directional",
637
- color: [0.85, 0.92, 1],
638
- intensity: 0.92,
639
- position: [0, 0, 0],
640
- direction: [-0.15, -0.12, 0.98],
641
- range: 0,
642
- spotAngle: 0,
643
- penumbra: 0,
644
- castsShadow: false,
645
- layerMask: 0xffffffff,
646
- source: rim
647
- }
648
- ];
649
- }
650
-
651
- function createHotspots(rotationRadians: number, canvasWidth: number, canvasHeight: number): readonly ProductTurntableHotspot[] {
652
- const anchors = [
653
- {
654
- id: "material-finish",
655
- group: "material" as const,
656
- label: "Metallic shell",
657
- content: "Product finish, carbon accent, and procedural roughness maps are bound through the current renderer.",
658
- position: [-0.3, 0.24, 0.18] as const,
659
- threshold: -0.15
660
- },
661
- {
662
- id: "comfort-band",
663
- group: "comfort" as const,
664
- label: "Comfort band",
665
- content: "Generated multi-part glTF geometry keeps headband and cushion slots independently selectable.",
666
- position: [0, 0.52, 0.1] as const,
667
- threshold: -0.05
668
- },
669
- {
670
- id: "control-module",
671
- group: "controls" as const,
672
- label: "Control module",
673
- content: "The selected controls part is exposed in runtime state for ecommerce hotspot evidence.",
674
- position: [0.38, 0.06, 0.2] as const,
675
- threshold: -0.1
676
- }
677
- ];
678
-
679
- return anchors.map((anchor, index) => {
680
- const projected = projectHotspot(anchor.position, rotationRadians, canvasWidth, canvasHeight, index);
681
- return {
682
- id: anchor.id,
683
- group: anchor.group,
684
- label: anchor.label,
685
- content: anchor.content,
686
- position: anchor.position,
687
- screen: projected,
688
- visibilityThreshold: anchor.threshold
689
- };
690
- });
691
- }
692
-
693
- function productTurntableEnvironmentPreset(preset: ProductTurntableLightingPreset): "studio" | "softbox" | "inspection" | "exhibit" {
694
- if (preset === "soft" || preset === "neutral") return "softbox";
695
- if (preset === "inspection") return "inspection";
696
- if (preset === "dramatic") return "exhibit";
697
- return "studio";
698
- }
699
-
700
- function item(
701
- geometryLibrary: ReadonlyMap<string, Geometry>,
702
- materialLibrary: ReadonlyMap<string, RenderMaterial>,
703
- label: string,
704
- geometryId: string,
705
- materialId: string,
706
- tx: number,
707
- ty: number,
708
- tz: number,
709
- sx: number,
710
- sy: number,
711
- sz: number,
712
- yawRadians: number
713
- ): RenderItem {
714
- const geometry = geometryLibrary.get(geometryId);
715
- const material = materialLibrary.get(materialId);
716
- if (!geometry) throw new Error(`Missing product turntable geometry: ${geometryId}`);
717
- if (!material) throw new Error(`Missing product turntable material: ${materialId}`);
718
- return {
719
- geometry,
720
- material,
721
- label,
722
- modelMatrix: modelMatrix(tx, ty, tz, sx, sy, sz, yawRadians)
723
- };
724
- }
725
-
726
- function modelMatrix(tx: number, ty: number, tz: number, sx: number, sy: number, sz: number, yawRadians: number): Float32Array {
727
- const cos = Math.cos(yawRadians);
728
- const sin = Math.sin(yawRadians);
729
- return new Float32Array([
730
- cos * sx, 0, -sin * sx, 0,
731
- 0, sy, 0, 0,
732
- sin * sz, 0, cos * sz, 0,
733
- tx, ty, tz, 1
734
- ]);
735
- }
736
-
737
- function projectHotspot(
738
- position: readonly [number, number, number],
739
- rotationRadians: number,
740
- canvasWidth: number,
741
- canvasHeight: number,
742
- index: number
743
- ): ProductTurntableHotspot["screen"] {
744
- const cos = Math.cos(rotationRadians);
745
- const sin = Math.sin(rotationRadians);
746
- const x = position[0] * cos - position[2] * sin;
747
- const z = position[0] * sin + position[2] * cos;
748
- const screenX = Math.round(canvasWidth * (0.5 + x * 0.36));
749
- const screenY = Math.round(canvasHeight * (0.5 - position[1] * 0.42 + index * 0.018));
750
- return {
751
- x: screenX,
752
- y: screenY,
753
- visible: z > -0.38 && screenX >= 0 && screenX <= canvasWidth && screenY >= 0 && screenY <= canvasHeight,
754
- occluded: false
755
- };
756
- }
757
-
758
- function createLighting(activePreset: ProductTurntableLightingPreset): ProductTurntableLighting {
759
- const descriptor = lightingPresets[activePreset];
760
- return {
761
- source: "origin-master-ecommerce-lighting-preset-manager-adapted",
762
- presets: ["studio", "soft", "inspection", "dramatic", "neutral"],
763
- activePreset,
764
- transitionSupported: true,
765
- ...descriptor
766
- };
767
- }
768
-
769
- function createCapturePlan(captureRequested: boolean, exportedBytes: number): ProductTurntableCapturePlan {
770
- const completedBatchTasks = captureRequested && exportedBytes > 0 ? 3 : 2;
771
- return {
772
- source: "origin-master-ecommerce-capture-batch-export-adapted",
773
- screenshotFormats: ["png", "jpeg", "webp"],
774
- screenshotViews: ["hero", "front", "detail", "exploded"],
775
- spinFrameCount: 72,
776
- spinDurationSeconds: 4,
777
- batchTasks: ["thumbnail", "screenshot", "360-spin", "ar-export"],
778
- completedBatchTasks,
779
- captureRequested,
780
- exportedBytes,
781
- arExportFormats: ["glb"],
782
- blockedExportClaims: [
783
- "native-USDZ-export",
784
- "browser-video-recording-pipeline",
785
- "AR-Quick-Look-and-Scene-Viewer-platform-parity",
786
- "ecommerce-PIM-or-commerce-platform-integration"
787
- ]
788
- };
789
- }
790
-
791
- function finiteOrDefault(value: number | undefined, fallback: number, name: string): number {
792
- if (value === undefined) return fallback;
793
- if (!Number.isFinite(value) && value !== Number.POSITIVE_INFINITY) throw new RangeError(`${name} must be finite.`);
794
- return value;
795
- }
796
-
797
- function integerOrDefault(value: number | undefined, fallback: number, name: string): number {
798
- if (value === undefined) return fallback;
799
- if (!Number.isInteger(value) || value < 0) throw new RangeError(`${name} must be a non-negative integer.`);
800
- return value;
801
- }
802
-
803
- function hashProductTurntable(values: readonly number[]): string {
804
- let hash = 0x811c9dc5;
805
- for (const value of values) {
806
- const scaled = Math.round(value * 1000);
807
- hash ^= scaled & 0xff;
808
- hash = Math.imul(hash, 0x01000193) >>> 0;
809
- hash ^= (scaled >>> 8) & 0xff;
810
- hash = Math.imul(hash, 0x01000193) >>> 0;
811
- hash ^= (scaled >>> 16) & 0xff;
812
- hash = Math.imul(hash, 0x01000193) >>> 0;
813
- }
814
- return hash.toString(16).padStart(8, "0");
815
- }