@meimu/mutracer 0.1.5 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSES/Classroom-CC0.txt +121 -0
- package/README.md +10 -7
- package/THIRD_PARTY_NOTICES.md +13 -8
- package/dist/assets/bvh.worker.js +1 -1
- package/dist/mutracer.umd.js +12316 -9228
- package/docs/api.md +232 -21
- package/docs/caustics.md +80 -0
- package/docs/denoising.md +30 -15
- package/docs/materials.md +6 -5
- package/docs/performance.md +5 -2
- package/docs/progressive-rendering.md +73 -1
- package/docs/technical/continuous-spectrum.md +93 -0
- package/docs/threejs.md +14 -5
- package/docs/updates.md +46 -2
- package/docs/viewer-checklist.md +65 -0
- package/docs/viewer.md +15 -8
- package/lib/Display.d.ts +13 -2
- package/lib/Display.js +28 -7
- package/lib/Display.js.map +1 -1
- package/lib/Engine.d.ts +4 -0
- package/lib/Engine.js +99 -37
- package/lib/Engine.js.map +1 -1
- package/lib/Render.d.ts +98 -15
- package/lib/Render.js +275 -27
- package/lib/Render.js.map +1 -1
- package/lib/RenderLoop.d.ts +11 -1
- package/lib/RenderLoop.js +120 -15
- package/lib/RenderLoop.js.map +1 -1
- package/lib/main.d.ts +6 -3
- package/lib/main.js +1 -0
- package/lib/main.js.map +1 -1
- package/lib/math/access.d.ts +4 -0
- package/lib/math/access.js +10 -0
- package/lib/math/access.js.map +1 -0
- package/lib/math/mat3.d.ts +4 -0
- package/lib/math/mat3.js +54 -0
- package/lib/math/mat3.js.map +1 -0
- package/lib/math/mat4.d.ts +19 -0
- package/lib/math/mat4.js +413 -0
- package/lib/math/mat4.js.map +1 -0
- package/lib/math/storage.d.ts +6 -0
- package/lib/math/storage.js +22 -0
- package/lib/math/storage.js.map +1 -0
- package/lib/math/types.d.ts +3 -0
- package/lib/math/types.js +2 -0
- package/lib/math/types.js.map +1 -0
- package/lib/math/vec2.d.ts +13 -0
- package/lib/math/vec2.js +52 -0
- package/lib/math/vec2.js.map +1 -0
- package/lib/math/vec3.d.ts +23 -0
- package/lib/math/vec3.js +139 -0
- package/lib/math/vec3.js.map +1 -0
- package/lib/math.d.ts +5 -17
- package/lib/math.js +5 -55
- package/lib/math.js.map +1 -1
- package/lib/oidn.d.ts +1 -1
- package/lib/oidn.js +4 -2
- package/lib/oidn.js.map +1 -1
- package/lib/oidnBundledWeights.cdn.d.ts +2 -2
- package/lib/renderer/AovPrimitiveCache.d.ts +10 -0
- package/lib/renderer/AovPrimitiveCache.js +48 -0
- package/lib/renderer/AovPrimitiveCache.js.map +1 -0
- package/lib/renderer/Box3.d.ts +5 -0
- package/lib/renderer/Box3.js +9 -0
- package/lib/renderer/Box3.js.map +1 -0
- package/lib/renderer/GPUTraceQueue.d.ts +11 -0
- package/lib/renderer/GPUTraceQueue.js +33 -0
- package/lib/renderer/GPUTraceQueue.js.map +1 -0
- package/lib/renderer/MaterialData.d.ts +15 -0
- package/lib/renderer/MaterialData.js +61 -0
- package/lib/renderer/MaterialData.js.map +1 -0
- package/lib/renderer/MaterialTable.d.ts +11 -98
- package/lib/renderer/MaterialTable.js +34 -412
- package/lib/renderer/MaterialTable.js.map +1 -1
- package/lib/renderer/RenderingPipeline.d.ts +36 -13
- package/lib/renderer/RenderingPipeline.js +1 -17
- package/lib/renderer/RenderingPipeline.js.map +1 -1
- package/lib/renderer/TileRender.d.ts +0 -1
- package/lib/renderer/TileRender.js +14 -1
- package/lib/renderer/TileRender.js.map +1 -1
- package/lib/renderer/WGPUAov.d.ts +39 -0
- package/lib/renderer/WGPUAov.js +239 -0
- package/lib/renderer/WGPUAov.js.map +1 -0
- package/lib/renderer/WGPUBindlessMaterialData.d.ts +17 -0
- package/lib/renderer/WGPUBindlessMaterialData.js +48 -0
- package/lib/renderer/WGPUBindlessMaterialData.js.map +1 -0
- package/lib/renderer/WGPUBindlessTextures.d.ts +47 -0
- package/lib/renderer/WGPUBindlessTextures.js +180 -0
- package/lib/renderer/WGPUBindlessTextures.js.map +1 -0
- package/lib/renderer/WGPUBloomPass.js +17 -97
- package/lib/renderer/WGPUBloomPass.js.map +1 -1
- package/lib/renderer/WGPUCausticLightPass.d.ts +48 -0
- package/lib/renderer/WGPUCausticLightPass.js +217 -0
- package/lib/renderer/WGPUCausticLightPass.js.map +1 -0
- package/lib/renderer/WGPUComputePass.d.ts +1 -1
- package/lib/renderer/WGPUComputePass.js.map +1 -1
- package/lib/renderer/WGPUEnvMapDistribution.d.ts +12 -0
- package/lib/renderer/WGPUEnvMapDistribution.js +150 -0
- package/lib/renderer/WGPUEnvMapDistribution.js.map +1 -0
- package/lib/renderer/WGPUFullQuadPass.js +10 -9
- package/lib/renderer/WGPUFullQuadPass.js.map +1 -1
- package/lib/renderer/WGPUJNLMDenoiser.d.ts +1 -20
- package/lib/renderer/WGPUJNLMDenoiser.js +4 -267
- package/lib/renderer/WGPUJNLMDenoiser.js.map +1 -1
- package/lib/renderer/WGPUPhotonMap.d.ts +37 -0
- package/lib/renderer/WGPUPhotonMap.js +191 -0
- package/lib/renderer/WGPUPhotonMap.js.map +1 -0
- package/lib/renderer/WGPURayTraceOutput.d.ts +13 -1
- package/lib/renderer/WGPURayTraceOutput.js +132 -29
- package/lib/renderer/WGPURayTraceOutput.js.map +1 -1
- package/lib/renderer/WGPURayTracePass.d.ts +83 -56
- package/lib/renderer/WGPURayTracePass.js +884 -837
- package/lib/renderer/WGPURayTracePass.js.map +1 -1
- package/lib/renderer/WGPURenderingPipeline.d.ts +5 -3
- package/lib/renderer/WGPURenderingPipeline.js +297 -82
- package/lib/renderer/WGPURenderingPipeline.js.map +1 -1
- package/lib/renderer/WGPUShaderCache.d.ts +2 -2
- package/lib/renderer/WGPUShaderCache.js +10 -5
- package/lib/renderer/WGPUShaderCache.js.map +1 -1
- package/lib/renderer/WGPUShaderCapabilities.d.ts +10 -0
- package/lib/renderer/WGPUShaderCapabilities.js +54 -0
- package/lib/renderer/WGPUShaderCapabilities.js.map +1 -0
- package/lib/renderer/WGPUSkyBaker.d.ts +13 -0
- package/lib/renderer/WGPUSkyBaker.js +85 -0
- package/lib/renderer/WGPUSkyBaker.js.map +1 -0
- package/lib/renderer/WebGLAov.d.ts +41 -0
- package/lib/renderer/WebGLAov.js +106 -0
- package/lib/renderer/WebGLAov.js.map +1 -0
- package/lib/renderer/WebGLFullQuadPass.d.ts +7 -4
- package/lib/renderer/WebGLFullQuadPass.js +22 -2
- package/lib/renderer/WebGLFullQuadPass.js.map +1 -1
- package/lib/renderer/WebGLJNLMDenoiser.d.ts +1 -1
- package/lib/renderer/WebGLJNLMDenoiser.js +83 -74
- package/lib/renderer/WebGLJNLMDenoiser.js.map +1 -1
- package/lib/renderer/WebGLRayTraceOutputPass.js +7 -4
- package/lib/renderer/WebGLRayTraceOutputPass.js.map +1 -1
- package/lib/renderer/WebGLRayTracePass.d.ts +18 -3
- package/lib/renderer/WebGLRayTracePass.js +121 -9
- package/lib/renderer/WebGLRayTracePass.js.map +1 -1
- package/lib/renderer/WebGLRenderingPipeline.js +126 -22
- package/lib/renderer/WebGLRenderingPipeline.js.map +1 -1
- package/lib/renderer/WebGLSkyBaker.d.ts +39 -0
- package/lib/renderer/WebGLSkyBaker.js +422 -0
- package/lib/renderer/WebGLSkyBaker.js.map +1 -0
- package/lib/renderer/WebGLSkySource.d.ts +9 -0
- package/lib/renderer/WebGLSkySource.js +28 -0
- package/lib/renderer/WebGLSkySource.js.map +1 -0
- package/lib/renderer/accumulationTarget.d.ts +6 -0
- package/lib/renderer/accumulationTarget.js.map +1 -1
- package/lib/renderer/aov.d.ts +42 -0
- package/lib/renderer/aov.js +50 -0
- package/lib/renderer/aov.js.map +1 -0
- package/lib/renderer/aovDisplay.d.ts +14 -0
- package/lib/renderer/aovDisplay.js +32 -0
- package/lib/renderer/aovDisplay.js.map +1 -0
- package/lib/renderer/aovScene.d.ts +21 -0
- package/lib/renderer/aovScene.js +139 -0
- package/lib/renderer/aovScene.js.map +1 -0
- package/lib/renderer/binnedSahBvh.js +2 -1
- package/lib/renderer/binnedSahBvh.js.map +1 -1
- package/lib/renderer/bvhAccel.d.ts +20 -10
- package/lib/renderer/bvhAccel.js +168 -58
- package/lib/renderer/bvhAccel.js.map +1 -1
- package/lib/renderer/bvhWorkerBuild.d.ts +1 -0
- package/lib/renderer/cameraSnapshot.js +2 -1
- package/lib/renderer/cameraSnapshot.js.map +1 -1
- package/lib/renderer/cameraUniform.d.ts +2 -0
- package/lib/renderer/cameraUniform.js +12 -0
- package/lib/renderer/cameraUniform.js.map +1 -0
- package/lib/renderer/causticDiagnostics.d.ts +31 -0
- package/lib/renderer/causticDiagnostics.js +5 -0
- package/lib/renderer/causticDiagnostics.js.map +1 -0
- package/lib/renderer/causticEmission.d.ts +10 -0
- package/lib/renderer/causticEmission.js +40 -0
- package/lib/renderer/causticEmission.js.map +1 -0
- package/lib/renderer/causticUniform.d.ts +12 -0
- package/lib/renderer/causticUniform.js +22 -0
- package/lib/renderer/causticUniform.js.map +1 -0
- package/lib/renderer/caustics.d.ts +16 -0
- package/lib/renderer/caustics.js +93 -0
- package/lib/renderer/caustics.js.map +1 -0
- package/lib/renderer/committedScene.js +4 -0
- package/lib/renderer/committedScene.js.map +1 -1
- package/lib/renderer/denoiser.d.ts +3 -11
- package/lib/renderer/denoiser.js.map +1 -1
- package/lib/renderer/depthQuery.js +4 -1
- package/lib/renderer/depthQuery.js.map +1 -1
- package/lib/renderer/displacementPreparation.d.ts +11 -0
- package/lib/renderer/displacementPreparation.js +351 -0
- package/lib/renderer/displacementPreparation.js.map +1 -0
- package/lib/renderer/displacementRange.d.ts +1 -0
- package/lib/renderer/displacementRange.js +9 -0
- package/lib/renderer/displacementRange.js.map +1 -0
- package/lib/renderer/displayParityDiagnostics.d.ts +11 -0
- package/lib/renderer/displayParityDiagnostics.js +2 -0
- package/lib/renderer/displayParityDiagnostics.js.map +1 -0
- package/lib/renderer/envMapCreation.d.ts +9 -8
- package/lib/renderer/envMapCreation.js +36 -12
- package/lib/renderer/envMapCreation.js.map +1 -1
- package/lib/renderer/envMapDistribution.d.ts +12 -2
- package/lib/renderer/envMapDistribution.js +43 -34
- package/lib/renderer/envMapDistribution.js.map +1 -1
- package/lib/renderer/geometryBvhBounds.d.ts +4 -0
- package/lib/renderer/geometryBvhBounds.js +82 -0
- package/lib/renderer/geometryBvhBounds.js.map +1 -0
- package/lib/renderer/geometryUpdateState.d.ts +32 -0
- package/lib/renderer/geometryUpdateState.js +2 -0
- package/lib/renderer/geometryUpdateState.js.map +1 -0
- package/lib/renderer/geometryUpdates.d.ts +17 -9
- package/lib/renderer/geometryUpdates.js +92 -33
- package/lib/renderer/geometryUpdates.js.map +1 -1
- package/lib/renderer/glsl/aovDisplay.frag.d.ts +3 -0
- package/lib/renderer/glsl/aovDisplay.frag.js +54 -0
- package/lib/renderer/glsl/aovDisplay.frag.js.map +1 -0
- package/lib/renderer/glsl/aovReflectance.glsl.d.ts +2 -0
- package/lib/renderer/glsl/aovReflectance.glsl.js +87 -0
- package/lib/renderer/glsl/aovReflectance.glsl.js.map +1 -0
- package/lib/renderer/glsl/aovReflectanceSamples.glsl.d.ts +2 -0
- package/lib/renderer/glsl/aovReflectanceSamples.glsl.js +135 -0
- package/lib/renderer/glsl/aovReflectanceSamples.glsl.js.map +1 -0
- package/lib/renderer/glsl/aovTrace.frag.d.ts +2 -0
- package/lib/renderer/glsl/aovTrace.frag.js +121 -0
- package/lib/renderer/glsl/aovTrace.frag.js.map +1 -0
- package/lib/renderer/glsl/chunks/cameraRay.glsl.js +12 -12
- package/lib/renderer/glsl/chunks/emissiveLight.glsl.d.ts +2 -0
- package/lib/renderer/glsl/chunks/emissiveLight.glsl.js +35 -0
- package/lib/renderer/glsl/chunks/emissiveLight.glsl.js.map +1 -0
- package/lib/renderer/glsl/chunks/envMap.glsl.js +73 -67
- package/lib/renderer/glsl/chunks/envMap.glsl.js.map +1 -1
- package/lib/renderer/glsl/chunks/intersect.glsl.js +432 -434
- package/lib/renderer/glsl/chunks/intersect.glsl.js.map +1 -1
- package/lib/renderer/glsl/chunks/materialBuffer.glsl.d.ts +1 -0
- package/lib/renderer/glsl/chunks/materialBuffer.glsl.js +160 -157
- package/lib/renderer/glsl/chunks/materialBuffer.glsl.js.map +1 -1
- package/lib/renderer/glsl/chunks/openPbrBsdf.glsl.js +802 -802
- package/lib/renderer/glsl/chunks/rand.glsl.js +3 -3
- package/lib/renderer/glsl/chunks/random.glsl.js +6 -6
- package/lib/renderer/glsl/chunks/rayTraceCore.glsl.d.ts +1 -0
- package/lib/renderer/glsl/chunks/rayTraceCore.glsl.js +72 -67
- package/lib/renderer/glsl/chunks/rayTraceCore.glsl.js.map +1 -1
- package/lib/renderer/glsl/chunks/sampleLight.glsl.js +94 -76
- package/lib/renderer/glsl/chunks/sampleLight.glsl.js.map +1 -1
- package/lib/renderer/glsl/chunks/sampleMaterial.glsl.d.ts +1 -0
- package/lib/renderer/glsl/chunks/sampleMaterial.glsl.js +143 -120
- package/lib/renderer/glsl/chunks/sampleMaterial.glsl.js.map +1 -1
- package/lib/renderer/glsl/chunks/sampleShadowCatcher.glsl.js +21 -18
- package/lib/renderer/glsl/chunks/sampleShadowCatcher.glsl.js.map +1 -1
- package/lib/renderer/glsl/chunks/sampling.glsl.js +91 -94
- package/lib/renderer/glsl/chunks/sampling.glsl.js.map +1 -1
- package/lib/renderer/glsl/chunks/sobol.glsl.js +79 -79
- package/lib/renderer/glsl/chunks/textureLinear.glsl.js +5 -5
- package/lib/renderer/glsl/chunks/uvProjection.glsl.js +12 -12
- package/lib/renderer/glsl/chunks/uvProjection.glsl.js.map +1 -1
- package/lib/renderer/glsl/depthQuery.frag.js +7 -7
- package/lib/renderer/glsl/normalizeRayTraceOutput.frag.js +17 -9
- package/lib/renderer/glsl/normalizeRayTraceOutput.frag.js.map +1 -1
- package/lib/renderer/glsl/rayTrace.frag.d.ts +1 -1
- package/lib/renderer/glsl/rayTrace.frag.js +271 -248
- package/lib/renderer/glsl/rayTrace.frag.js.map +1 -1
- package/lib/renderer/glsl/shadowCatcher.frag.js +37 -32
- package/lib/renderer/glsl/shadowCatcher.frag.js.map +1 -1
- package/lib/renderer/glsl/webglPipeline.frag.js +65 -60
- package/lib/renderer/glsl/webglPipeline.frag.js.map +1 -1
- package/lib/renderer/lightConstants.d.ts +10 -0
- package/lib/renderer/lightConstants.js +11 -0
- package/lib/renderer/lightConstants.js.map +1 -0
- package/lib/renderer/lightCore.d.ts +12 -0
- package/lib/renderer/lightCore.js +13 -0
- package/lib/renderer/lightCore.js.map +1 -0
- package/lib/renderer/lightSampling.d.ts +22 -18
- package/lib/renderer/lightSampling.js +135 -62
- package/lib/renderer/lightSampling.js.map +1 -1
- package/lib/renderer/lightsData.d.ts +21 -0
- package/lib/renderer/lightsData.js +192 -0
- package/lib/renderer/lightsData.js.map +1 -0
- package/lib/renderer/lightsUtil.d.ts +3 -26
- package/lib/renderer/lightsUtil.js +3 -153
- package/lib/renderer/lightsUtil.js.map +1 -1
- package/lib/renderer/materialBufferData.d.ts +70 -0
- package/lib/renderer/materialBufferData.js +2 -0
- package/lib/renderer/materialBufferData.js.map +1 -0
- package/lib/renderer/materialConstants.d.ts +11 -0
- package/lib/renderer/materialConstants.js +11 -0
- package/lib/renderer/materialConstants.js.map +1 -1
- package/lib/renderer/materialCore.d.ts +8 -0
- package/lib/renderer/materialCore.js +9 -0
- package/lib/renderer/materialCore.js.map +1 -0
- package/lib/renderer/materialEmission.d.ts +2 -2
- package/lib/renderer/materialEmission.js +3 -3
- package/lib/renderer/materialEmission.js.map +1 -1
- package/lib/renderer/materialLayout.d.ts +2 -101
- package/lib/renderer/materialLayout.js +110 -172
- package/lib/renderer/materialLayout.js.map +1 -1
- package/lib/renderer/materialLayoutSchema.d.ts +26 -0
- package/lib/renderer/materialLayoutSchema.js +172 -0
- package/lib/renderer/materialLayoutSchema.js.map +1 -0
- package/lib/renderer/materialParams.d.ts +69 -0
- package/lib/renderer/materialParams.js +272 -0
- package/lib/renderer/materialParams.js.map +1 -0
- package/lib/renderer/materialTextureSlots.d.ts +14 -324
- package/lib/renderer/materialTextureSlots.js +21 -8
- package/lib/renderer/materialTextureSlots.js.map +1 -1
- package/lib/renderer/materialTextures.d.ts +6 -0
- package/lib/renderer/{texturesFromMaterials.js → materialTextures.js} +1 -2
- package/lib/renderer/materialTextures.js.map +1 -0
- package/lib/renderer/mergeMeshesToGeometry.js +6 -147
- package/lib/renderer/mergeMeshesToGeometry.js.map +1 -1
- package/lib/renderer/meshInstances.d.ts +4 -21
- package/lib/renderer/meshInstances.js +10 -56
- package/lib/renderer/meshInstances.js.map +1 -1
- package/lib/renderer/oidnNetwork.d.ts +2 -2
- package/lib/renderer/oidnNetwork.js +1 -1
- package/lib/renderer/oidnNetwork.js.map +1 -1
- package/lib/renderer/openPbrEnergyLut.js +850 -846
- package/lib/renderer/openPbrEnergyLut.js.map +1 -1
- package/lib/renderer/ownedDenoiser.d.ts +9 -0
- package/lib/renderer/ownedDenoiser.js +2 -0
- package/lib/renderer/ownedDenoiser.js.map +1 -0
- package/lib/renderer/packedMeshInstances.d.ts +23 -0
- package/lib/renderer/packedMeshInstances.js +80 -0
- package/lib/renderer/packedMeshInstances.js.map +1 -0
- package/lib/renderer/prepareMeshBVH.d.ts +12 -47
- package/lib/renderer/prepareMeshBVH.js +21 -642
- package/lib/renderer/prepareMeshBVH.js.map +1 -1
- package/lib/renderer/proceduralEnvironmentPower.d.ts +3 -0
- package/lib/renderer/proceduralEnvironmentPower.js +8 -0
- package/lib/renderer/proceduralEnvironmentPower.js.map +1 -0
- package/lib/renderer/progressiveScheduler.d.ts +1 -0
- package/lib/renderer/progressiveScheduler.js +7 -3
- package/lib/renderer/progressiveScheduler.js.map +1 -1
- package/lib/renderer/renderPipeline.d.ts +4 -1
- package/lib/renderer/renderPipeline.js.map +1 -1
- package/lib/renderer/renderingLimits.d.ts +9 -0
- package/lib/renderer/renderingLimits.js +18 -0
- package/lib/renderer/renderingLimits.js.map +1 -0
- package/lib/renderer/researchTransport.d.ts +31 -0
- package/lib/renderer/researchTransport.js +5 -0
- package/lib/renderer/researchTransport.js.map +1 -0
- package/lib/renderer/sceneAssembly.d.ts +73 -0
- package/lib/renderer/sceneAssembly.js +109 -0
- package/lib/renderer/sceneAssembly.js.map +1 -0
- package/lib/renderer/sceneChangeCore.d.ts +39 -0
- package/lib/renderer/sceneChangeCore.js +307 -0
- package/lib/renderer/sceneChangeCore.js.map +1 -0
- package/lib/renderer/sceneChangeDetector.d.ts +3 -6
- package/lib/renderer/sceneChangeDetector.js +24 -150
- package/lib/renderer/sceneChangeDetector.js.map +1 -1
- package/lib/renderer/sceneLayoutSchema.d.ts +119 -0
- package/lib/renderer/sceneLayoutSchema.js +111 -0
- package/lib/renderer/sceneLayoutSchema.js.map +1 -0
- package/lib/renderer/sceneLightChanges.d.ts +3 -3
- package/lib/renderer/sceneLightChanges.js.map +1 -1
- package/lib/renderer/scenePreparation.d.ts +55 -0
- package/lib/renderer/scenePreparation.js +360 -0
- package/lib/renderer/scenePreparation.js.map +1 -0
- package/lib/renderer/scratchSampling.js +18 -18
- package/lib/renderer/scratchSampling.js.map +1 -1
- package/lib/renderer/shader.d.ts +2 -0
- package/lib/renderer/shader.js +2 -0
- package/lib/renderer/shader.js.map +1 -1
- package/lib/renderer/shaderCapabilities.d.ts +23 -0
- package/lib/renderer/shaderCapabilities.js +55 -0
- package/lib/renderer/shaderCapabilities.js.map +1 -0
- package/lib/renderer/shaderCapacity.d.ts +2 -0
- package/lib/renderer/shaderCapacity.js +5 -0
- package/lib/renderer/shaderCapacity.js.map +1 -0
- package/lib/renderer/skyModel.d.ts +9 -0
- package/lib/renderer/skyModel.js +10 -0
- package/lib/renderer/skyModel.js.map +1 -0
- package/lib/renderer/spectrum.d.ts +21 -0
- package/lib/renderer/spectrum.js +154 -0
- package/lib/renderer/spectrum.js.map +1 -0
- package/lib/renderer/textureAtlas.d.ts +60 -0
- package/lib/renderer/textureAtlas.js +145 -0
- package/lib/renderer/textureAtlas.js.map +1 -0
- package/lib/renderer/textureAtlasPixels.d.ts +7 -0
- package/lib/renderer/textureAtlasPixels.js +68 -0
- package/lib/renderer/textureAtlasPixels.js.map +1 -0
- package/lib/renderer/util.d.ts +1 -1
- package/lib/renderer/util.js.map +1 -1
- package/lib/renderer/webgl.d.ts +9 -2
- package/lib/renderer/webgl.js +54 -9
- package/lib/renderer/webgl.js.map +1 -1
- package/lib/renderer/webglLightSampling.d.ts +39 -0
- package/lib/renderer/webglLightSampling.js +15 -0
- package/lib/renderer/webglLightSampling.js.map +1 -0
- package/lib/renderer/wgpuBindless.d.ts +26 -0
- package/lib/renderer/wgpuBindless.js +95 -0
- package/lib/renderer/wgpuBindless.js.map +1 -0
- package/lib/renderer/wgpuBindlessSource.d.ts +2 -0
- package/lib/renderer/wgpuBindlessSource.js +51 -0
- package/lib/renderer/wgpuBindlessSource.js.map +1 -0
- package/lib/renderer/wgpuMaterialConstants.d.ts +4 -0
- package/lib/renderer/wgpuMaterialConstants.js +52 -0
- package/lib/renderer/wgpuMaterialConstants.js.map +1 -0
- package/lib/renderer/wgpuSceneUniform.d.ts +42 -0
- package/lib/renderer/wgpuSceneUniform.js +125 -0
- package/lib/renderer/wgpuSceneUniform.js.map +1 -0
- package/lib/renderer/wgpuShaderSource.d.ts +22 -0
- package/lib/renderer/wgpuShaderSource.js +33 -0
- package/lib/renderer/wgpuShaderSource.js.map +1 -0
- package/lib/renderer/wgsl/aovDisplay.wgsl.d.ts +1 -0
- package/lib/renderer/wgsl/aovDisplay.wgsl.js +70 -0
- package/lib/renderer/wgsl/aovDisplay.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/aovReflectance.wgsl.d.ts +2 -0
- package/lib/renderer/wgsl/aovReflectance.wgsl.js +98 -0
- package/lib/renderer/wgsl/aovReflectance.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/aovReflectanceSamples.wgsl.d.ts +2 -0
- package/lib/renderer/wgsl/aovReflectanceSamples.wgsl.js +135 -0
- package/lib/renderer/wgsl/aovReflectanceSamples.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/aovResolve.wgsl.d.ts +5 -0
- package/lib/renderer/wgsl/aovResolve.wgsl.js +38 -0
- package/lib/renderer/wgsl/aovResolve.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/aovSnapshot.wgsl.d.ts +4 -0
- package/lib/renderer/wgsl/aovSnapshot.wgsl.js +21 -0
- package/lib/renderer/wgsl/aovSnapshot.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/aovTrace.wgsl.d.ts +2 -0
- package/lib/renderer/wgsl/aovTrace.wgsl.js +115 -0
- package/lib/renderer/wgsl/aovTrace.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/bloom.wgsl.d.ts +13 -0
- package/lib/renderer/wgsl/bloom.wgsl.js +92 -0
- package/lib/renderer/wgsl/bloom.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/causticLight.compute.d.ts +6 -0
- package/lib/renderer/wgsl/causticLight.compute.js +537 -0
- package/lib/renderer/wgsl/causticLight.compute.js.map +1 -0
- package/lib/renderer/wgsl/chunks/background.wgsl.d.ts +2 -0
- package/lib/renderer/wgsl/chunks/background.wgsl.js +102 -0
- package/lib/renderer/wgsl/chunks/background.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/chunks/causticAdjoint.wgsl.d.ts +2 -0
- package/lib/renderer/wgsl/chunks/causticAdjoint.wgsl.js +12 -0
- package/lib/renderer/wgsl/chunks/causticAdjoint.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/chunks/causticAtomic.wgsl.d.ts +2 -0
- package/lib/renderer/wgsl/chunks/causticAtomic.wgsl.js +16 -0
- package/lib/renderer/wgsl/chunks/causticAtomic.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/chunks/caustics.wgsl.d.ts +1 -0
- package/lib/renderer/wgsl/chunks/caustics.wgsl.js +62 -0
- package/lib/renderer/wgsl/chunks/caustics.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/chunks/common.wgsl.js +4 -4
- package/lib/renderer/wgsl/chunks/envMap.wgsl.d.ts +1 -1
- package/lib/renderer/wgsl/chunks/envMap.wgsl.js +41 -35
- package/lib/renderer/wgsl/chunks/envMap.wgsl.js.map +1 -1
- package/lib/renderer/wgsl/chunks/intersect.wgsl.d.ts +13 -1
- package/lib/renderer/wgsl/chunks/intersect.wgsl.js +747 -704
- package/lib/renderer/wgsl/chunks/intersect.wgsl.js.map +1 -1
- package/lib/renderer/wgsl/chunks/intersectionAlpha.wgsl.js +16 -16
- package/lib/renderer/wgsl/chunks/intersectionAlpha.wgsl.js.map +1 -1
- package/lib/renderer/wgsl/chunks/materialBuffer.wgsl.d.ts +4 -1
- package/lib/renderer/wgsl/chunks/materialBuffer.wgsl.js +83 -79
- package/lib/renderer/wgsl/chunks/materialBuffer.wgsl.js.map +1 -1
- package/lib/renderer/wgsl/chunks/openPbrBsdf.wgsl.js +855 -857
- package/lib/renderer/wgsl/chunks/openPbrBsdf.wgsl.js.map +1 -1
- package/lib/renderer/wgsl/chunks/pdm_displacement.wgsl.js +137 -137
- package/lib/renderer/wgsl/chunks/rand.wgsl.js +3 -3
- package/lib/renderer/wgsl/chunks/rayTraceCore.wgsl.d.ts +3 -1
- package/lib/renderer/wgsl/chunks/rayTraceCore.wgsl.js +52 -32
- package/lib/renderer/wgsl/chunks/rayTraceCore.wgsl.js.map +1 -1
- package/lib/renderer/wgsl/chunks/sampleLight.wgsl.d.ts +1 -1
- package/lib/renderer/wgsl/chunks/sampleLight.wgsl.js +152 -144
- package/lib/renderer/wgsl/chunks/sampleLight.wgsl.js.map +1 -1
- package/lib/renderer/wgsl/chunks/sampleMaterial.wgsl.d.ts +1 -1
- package/lib/renderer/wgsl/chunks/sampleMaterial.wgsl.js +269 -245
- package/lib/renderer/wgsl/chunks/sampleMaterial.wgsl.js.map +1 -1
- package/lib/renderer/wgsl/chunks/sampleShadowCatcher.wgsl.d.ts +1 -1
- package/lib/renderer/wgsl/chunks/sampleShadowCatcher.wgsl.js +27 -14
- package/lib/renderer/wgsl/chunks/sampleShadowCatcher.wgsl.js.map +1 -1
- package/lib/renderer/wgsl/chunks/sampling.wgsl.d.ts +1 -1
- package/lib/renderer/wgsl/chunks/sampling.wgsl.js +91 -95
- package/lib/renderer/wgsl/chunks/sampling.wgsl.js.map +1 -1
- package/lib/renderer/wgsl/chunks/shadowCatcherAccumulation.wgsl.d.ts +1 -1
- package/lib/renderer/wgsl/chunks/shadowCatcherAccumulation.wgsl.js +1 -0
- package/lib/renderer/wgsl/chunks/shadowCatcherAccumulation.wgsl.js.map +1 -1
- package/lib/renderer/wgsl/chunks/sobol.wgsl.js +83 -83
- package/lib/renderer/wgsl/chunks/uvProjection.wgsl.js +12 -12
- package/lib/renderer/wgsl/chunks/uvProjection.wgsl.js.map +1 -1
- package/lib/renderer/wgsl/compose.frag.wgsl.d.ts +8 -3
- package/lib/renderer/wgsl/compose.frag.wgsl.js +143 -118
- package/lib/renderer/wgsl/compose.frag.wgsl.js.map +1 -1
- package/lib/renderer/wgsl/customDenoise.wgsl.js +10 -10
- package/lib/renderer/wgsl/depthQuery.wgsl.js +7 -7
- package/lib/renderer/wgsl/jnlm.compute.d.ts +25 -0
- package/lib/renderer/wgsl/jnlm.compute.js +315 -0
- package/lib/renderer/wgsl/jnlm.compute.js.map +1 -0
- package/lib/renderer/wgsl/offlineAdaptive.compute.js +28 -28
- package/lib/renderer/wgsl/oidnAuxiliary.wgsl.d.ts +1 -0
- package/lib/renderer/wgsl/oidnAuxiliary.wgsl.js +17 -0
- package/lib/renderer/wgsl/oidnAuxiliary.wgsl.js.map +1 -0
- package/lib/renderer/wgsl/photonMap.compute.d.ts +29 -0
- package/lib/renderer/wgsl/photonMap.compute.js +352 -0
- package/lib/renderer/wgsl/photonMap.compute.js.map +1 -0
- package/lib/renderer/wgsl/proceduralSky.compute.d.ts +1 -0
- package/lib/renderer/wgsl/proceduralSky.compute.js +198 -0
- package/lib/renderer/wgsl/proceduralSky.compute.js.map +1 -0
- package/lib/renderer/wgsl/rayTrace.compute.d.ts +25 -1
- package/lib/renderer/wgsl/rayTrace.compute.js +645 -500
- package/lib/renderer/wgsl/rayTrace.compute.js.map +1 -1
- package/lib/scene/Camera.js +7 -3
- package/lib/scene/Camera.js.map +1 -1
- package/lib/scene/EnvironmentLight.d.ts +5 -9
- package/lib/scene/EnvironmentLight.js +4 -14
- package/lib/scene/EnvironmentLight.js.map +1 -1
- package/lib/scene/EnvironmentLightState.d.ts +18 -0
- package/lib/scene/EnvironmentLightState.js +19 -0
- package/lib/scene/EnvironmentLightState.js.map +1 -0
- package/lib/scene/Geometry.d.ts +12 -6
- package/lib/scene/Geometry.js +37 -13
- package/lib/scene/Geometry.js.map +1 -1
- package/lib/scene/InstanceState.d.ts +39 -0
- package/lib/scene/InstanceState.js +77 -0
- package/lib/scene/InstanceState.js.map +1 -0
- package/lib/scene/InstancedMesh.d.ts +1 -1
- package/lib/scene/InstancedMesh.js +3 -0
- package/lib/scene/InstancedMesh.js.map +1 -1
- package/lib/scene/MaterialState.d.ts +209 -0
- package/lib/scene/MaterialState.js +231 -0
- package/lib/scene/MaterialState.js.map +1 -0
- package/lib/scene/Mesh.d.ts +4 -6
- package/lib/scene/Mesh.js +3 -11
- package/lib/scene/Mesh.js.map +1 -1
- package/lib/scene/MeshState.d.ts +20 -0
- package/lib/scene/MeshState.js +35 -0
- package/lib/scene/MeshState.js.map +1 -0
- package/lib/scene/OpenPBRMaterial.d.ts +6 -168
- package/lib/scene/OpenPBRMaterial.js +5 -223
- package/lib/scene/OpenPBRMaterial.js.map +1 -1
- package/lib/scene/PixelTexture.d.ts +6 -0
- package/lib/scene/PixelTexture.js +10 -0
- package/lib/scene/PixelTexture.js.map +1 -0
- package/lib/scene/ProceduralSky.d.ts +24 -0
- package/lib/scene/ProceduralSky.js +40 -0
- package/lib/scene/ProceduralSky.js.map +1 -0
- package/lib/scene/RectLight.d.ts +2 -13
- package/lib/scene/RectLight.js +3 -21
- package/lib/scene/RectLight.js.map +1 -1
- package/lib/scene/RectLightState.d.ts +31 -0
- package/lib/scene/RectLightState.js +26 -0
- package/lib/scene/RectLightState.js.map +1 -0
- package/lib/scene/Scene.d.ts +15 -4
- package/lib/scene/Scene.js.map +1 -1
- package/lib/scene/SceneNode.js +7 -6
- package/lib/scene/SceneNode.js.map +1 -1
- package/lib/scene/Texture.d.ts +10 -41
- package/lib/scene/Texture.js +4 -33
- package/lib/scene/Texture.js.map +1 -1
- package/lib/scene/TextureState.d.ts +35 -0
- package/lib/scene/TextureState.js +35 -0
- package/lib/scene/TextureState.js.map +1 -0
- package/lib/scene/attributeData.d.ts +4 -0
- package/lib/scene/attributeData.js +10 -0
- package/lib/scene/attributeData.js.map +1 -0
- package/lib/scene/lightState.d.ts +8 -0
- package/lib/scene/lightState.js +2 -0
- package/lib/scene/lightState.js.map +1 -0
- package/lib/scene/openPbrSchema.d.ts +7 -12
- package/lib/scene/openPbrSchema.js +273 -28
- package/lib/scene/openPbrSchema.js.map +1 -1
- package/lib/scene/skyParameters.d.ts +20 -0
- package/lib/scene/skyParameters.js +28 -0
- package/lib/scene/skyParameters.js.map +1 -0
- package/lib/scene/textureData.d.ts +9 -0
- package/lib/scene/textureData.js +2 -0
- package/lib/scene/textureData.js.map +1 -0
- package/lib/scene/texturePixels.d.ts +6 -0
- package/lib/scene/texturePixels.js +10 -0
- package/lib/scene/texturePixels.js.map +1 -0
- package/lib/settings/display.d.ts +33 -0
- package/lib/settings/display.js +7 -0
- package/lib/settings/display.js.map +1 -1
- package/lib/settings/render.d.ts +36 -3
- package/lib/settings/render.js +4 -1
- package/lib/settings/render.js.map +1 -1
- package/lib/tinybvh/tinybvh.wasm +0 -0
- package/lib/util/commonGeometry.js +7 -7
- package/lib/util/commonGeometry.js.map +1 -1
- package/lib/util/fromTHREE.d.ts +4 -1
- package/lib/util/fromTHREE.js +20 -7
- package/lib/util/fromTHREE.js.map +1 -1
- package/lib/util/geometry.js +42 -29
- package/lib/util/geometry.js.map +1 -1
- package/lib/util/loadRGBE.js +3 -4
- package/lib/util/loadRGBE.js.map +1 -1
- package/lib/util/studioLighting.d.ts +18 -0
- package/lib/util/studioLighting.js +36 -0
- package/lib/util/studioLighting.js.map +1 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/llms.txt +5 -0
- package/package.json +33 -7
- package/lib/renderer/texturesFromMaterials.d.ts +0 -6
- package/lib/renderer/texturesFromMaterials.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenPBRMaterial.js","sourceRoot":"","sources":["../../src/scene/OpenPBRMaterial.ts"],"names":[],"mappings":"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","sourcesContent":["import type { Vec2 } from '../types.js';\nimport { ColorRGB } from '../types.js';\nimport type Texture from './Texture.js';\nimport type { ThinFilmMapChannel } from './thinFilmParameters.js';\nimport { materialDefault, applyMaterialParams } from './openPbrSchema.js';\n\nexport type UVProjection = 'none' | 'triplanar' | 'spherical' | 'cylindrical';\nexport type MaterialAlphaMode = 'auto' | 'opaque' | 'mask' | 'blend';\n\nexport type { MaterialTextureName } from './materialTextureNames.js';\n\n/**\n * OpenPBR 1.1 surface material.\n *\n * Property names are camelCase OpenPBR inputs plus documented compatibility names\n * (https://academysoftwarefoundation.github.io/OpenPBR/). Colors are linear\n * RGB. Length-valued inputs (`transmissionDepth`, `subsurfaceRadius`) use\n * scene units; `thinFilmThickness` is in micrometres as in OpenPBR.\n *\n * ```ts\n * const gold = new OpenPBRMaterial({\n * baseColor: [1.0, 0.78, 0.34], baseMetalness: 1, specularRoughness: 0.2\n * });\n * ```\n *\n * Edit parameters in place; the next `engine.update()` detects the changes.\n */\nexport default class OpenPBRMaterial {\n /** Creates a material. Omitted properties use their documented defaults. */\n constructor(params: OpenPBRMaterialParams = {}) {\n applyMaterialParams(this, params);\n }\n\n // Base\n /** Multiplier of diffuse reflection and metallic normal-incidence color; does not scale dielectric specular, transmission or subsurface. Default `1`. */\n baseWeight: number = materialDefault('baseWeight');\n /** Diffuse/metal color. Default `[0.8, 0.8, 0.8]`. */\n baseColor: ColorRGB = materialDefault('baseColor');\n /** Oren-Nayar style roughness of the diffuse lobe. Default `0`. */\n baseDiffuseRoughness: number = materialDefault('baseDiffuseRoughness');\n /** `0` dielectric, `1` metal. Default `0`. */\n baseMetalness: number = materialDefault('baseMetalness');\n\n // Specular\n /** Dielectric specular strength (via IOR) and overall metallic Fresnel multiplier. Default `1`. */\n specularWeight: number = materialDefault('specularWeight');\n /** Dielectric specular tint and metallic F82 near-grazing tint. Default `[1, 1, 1]`. */\n specularColor: ColorRGB = materialDefault('specularColor');\n /** Microfacet roughness, `0` mirror to `1` rough; retains source perceptual roughness in `gltf` anisotropy mode. Default `0.3`. */\n specularRoughness: number = materialDefault('specularRoughness');\n /** Index of refraction. Default `1.5`. */\n specularIor: number = materialDefault('specularIor');\n /**\n * GGX anisotropy strength, 0 to 1 (requires tangents); native OpenPBR or source glTF strength according to specularAnisotropyModel. Default `0`.\n * @deprecated Use specularRoughnessAnisotropy.\n */\n specularAnisotropy: number = materialDefault('specularAnisotropy');\n\n // Transmission\n /** `1` makes the dielectric base fully transmissive (glass). Default `0`. */\n transmissionWeight: number = materialDefault('transmissionWeight');\n /** Transmission tint, or the medium color at `transmissionDepth`. Default `[1, 1, 1]`. */\n transmissionColor: ColorRGB = materialDefault('transmissionColor');\n /** Depth at which `transmissionColor` is reached; `0` tints at the surface. Default `0`. */\n transmissionDepth: number = materialDefault('transmissionDepth');\n /** Volume scattering color of the transmissive medium. Default `[0, 0, 0]`. */\n transmissionScatter: ColorRGB = materialDefault('transmissionScatter');\n /** Henyey-Greenstein anisotropy of the medium, -1 to 1. Default `0`. */\n transmissionScatterAnisotropy: number = materialDefault('transmissionScatterAnisotropy');\n /** Dispersion strength; `> 0` enables spectral rendering. Default `0`. */\n transmissionDispersionScale: number = materialDefault('transmissionDispersionScale');\n /** Abbe number controlling dispersion. Default `20`. */\n transmissionDispersionAbbeNumber: number = materialDefault('transmissionDispersionAbbeNumber');\n\n // Subsurface\n /** Subsurface scattering weight. Default `0`. */\n subsurfaceWeight: number = materialDefault('subsurfaceWeight');\n /** Subsurface color. Default `[0.8, 0.8, 0.8]`. */\n subsurfaceColor: ColorRGB = materialDefault('subsurfaceColor');\n /** Mean free path in scene units. Default `1`. */\n subsurfaceRadius: number = materialDefault('subsurfaceRadius');\n /** Per-channel multiplier of `subsurfaceRadius`. Default `[1, 0.5, 0.25]`. */\n subsurfaceRadiusScale: ColorRGB = materialDefault('subsurfaceRadiusScale');\n /**\n * Scattering anisotropy, -1 to 1. Default `0`.\n * @deprecated Use subsurfaceScatterAnisotropy.\n */\n subsurfaceAnisotropy: number = materialDefault('subsurfaceAnisotropy');\n\n // Fuzz (sheen)\n /** Fuzz (sheen) layer weight. Default `0`. */\n fuzzWeight: number = materialDefault('fuzzWeight');\n /** Fuzz reflection color; substrate attenuation uses white fuzz albedo. Default `[1, 1, 1]`. */\n fuzzColor: ColorRGB = materialDefault('fuzzColor');\n /** Fuzz roughness; imported from Three.js `sheenRoughness`. Default `0.5`. */\n fuzzRoughness: number = materialDefault('fuzzRoughness');\n\n // Coat\n /** Clear coat weight. Default `0`. */\n coatWeight: number = materialDefault('coatWeight');\n /** Squared coat transmittance at normal incidence; colors the base and emission, not coat reflection. Default `[1, 1, 1]`. */\n coatColor: ColorRGB = materialDefault('coatColor');\n /** Coat roughness. Default `0`. */\n coatRoughness: number = materialDefault('coatRoughness');\n /**\n * OpenPBR GGX coat anisotropy, 0 to 1; uses the base geometry tangent. Default `0`.\n * @deprecated Use coatRoughnessAnisotropy.\n */\n coatAnisotropy: number = materialDefault('coatAnisotropy');\n /** Coat index of refraction. Default `1.6`. */\n coatIor: number = materialDefault('coatIor');\n /** Internal-reflection darkening: 0 compensates darkening, 1 is physical; absorption remains at 0. Default `1`. */\n coatDarkening: number = materialDefault('coatDarkening');\n\n // Thin film\n /** Thin-film interference weight (iridescence). Default `0`. */\n thinFilmWeight: number = materialDefault('thinFilmWeight');\n /** Film thickness in micrometres; maximum endpoint when thinFilmMap is present. Default `0.5`. */\n thinFilmThickness: number = materialDefault('thinFilmThickness');\n /** Film index of refraction. Default `1.4`. */\n thinFilmIor: number = materialDefault('thinFilmIor');\n\n /** Thickness at a thinFilmMap sample of zero, in micrometres; ignored without a map. May exceed thinFilmThickness. Default `0`. */\n thinFilmThicknessMinimum: number = materialDefault('thinFilmThicknessMinimum');\n /** Linear channel sampled by thinFilmMap. Default `r`. */\n thinFilmMapChannel: ThinFilmMapChannel = materialDefault('thinFilmMapChannel');\n\n // Emission and geometry\n /** Emission color. Default `[1, 1, 1]`. */\n emissionColor: ColorRGB = materialDefault('emissionColor');\n /** Emitted radiance scale; `0` disables emission. Default `0`. */\n emissionLuminance: number = materialDefault('emissionLuminance');\n /**\n * Coverage, `1` opaque. See `alphaMode`. Default `1`.\n * @deprecated Use geometryOpacity.\n */\n opacity: number = materialDefault('opacity');\n /**\n * Treat the surface as an infinitely thin shell (leaves, paper). Default `false`.\n * @deprecated Use geometryThinWalled.\n */\n thinWalled: boolean = materialDefault('thinWalled');\n /** Disables geometric back-face culling for this material. Default `false`. */\n doubleSided: boolean = materialDefault('doubleSided');\n\n // Textures\n /** Base color texture, multiplied with `baseColor` using Texture color encoding. Default `undefined`. */\n map?: Texture;\n /** Standalone opacity texture sampled from its green channel, matching Three.js. Default `undefined`. */\n alphaMap?: Texture;\n /**\n * Coverage for surface and shadow rays: `opaque` ignores alpha inputs,\n * `mask` uses binary alpha testing, `blend` retains fractional coverage.\n * `auto` derives the mode from the alpha inputs. Default `auto`.\n */\n alphaMode: MaterialAlphaMode = materialDefault('alphaMode');\n /** Alpha-test threshold for `mask` mode; equality is fully covered. Default `0`. */\n alphaCutoff: number = materialDefault('alphaCutoff');\n /** Emission texture multiplied with `emissionColor`. Default `undefined`. */\n emissiveMap?: Texture;\n /** Tangent-space normal map. */\n normalMap?: Texture;\n /** Normal map strength per axis. Default `[1, 1]`. */\n normalScale: Vec2 = materialDefault('normalScale');\n /** glTF-compatible B=metalness, G=specular roughness texture. Default `undefined`. */\n metallicRoughnessMap?: Texture;\n /** Standalone roughness texture sampled from its green channel. Default `undefined`. */\n roughnessMap?: Texture;\n /** Standalone metalness texture sampled from its blue channel. Default `undefined`. */\n metalnessMap?: Texture;\n /** Multiplies transmission weight using the texture's red channel. Default `undefined`. */\n transmissionMap?: Texture;\n /** Linear thickness-range texture; R and zero minimum preserve multiplication semantics. Default `undefined`. */\n thinFilmMap?: Texture;\n\n /** Multiplies coatWeight by the linear red channel. Default `undefined`. */\n coatWeightMap?: Texture;\n /** Multiplies coatRoughness by the linear green channel. Default `undefined`. */\n coatRoughnessMap?: Texture;\n /** Multiplies fuzzColor by RGB channels using Texture color encoding. Default `undefined`. */\n fuzzColorMap?: Texture;\n /** Multiplies fuzzRoughness by the linear alpha channel. Default `undefined`. */\n fuzzRoughnessMap?: Texture;\n /** Multiplies specularWeight by the linear alpha channel. Default `undefined`. */\n specularWeightMap?: Texture;\n /** Multiplies specularColor by RGB channels using Texture color encoding. Default `undefined`. */\n specularColorMap?: Texture;\n\n\n /** Source convention for base specular anisotropy. `gltf` converts textured roughness and strength before coat roughening; `openpbr` uses native parameters. Default `openpbr`. */\n specularAnisotropyModel: 'openpbr' | 'gltf' = 'openpbr';\n /** Linear RG tangent direction and B strength multiplier for the base specular layer. Default `undefined`. */\n anisotropyMap?: Texture;\n /** Independent tangent-space coat normal in linear RGB. Without a map, coat uses the surface normal before base normal mapping. Default `undefined`. */\n coatNormalMap?: Texture;\n /** XY strength of coatNormalMap; independent of normalScale. Default `[1, 1]`. */\n coatNormalScale: Vec2 = materialDefault('coatNormalScale');\n /** Base direction rotation in radians, counter-clockwise in tangent/bitangent space after RG decoding. Default `0`. */\n specularAnisotropyRotation: number = 0;\n /** Coat direction rotation in radians relative to the geometry tangent. Default `0`. */\n coatAnisotropyRotation: number = 0;\n\n /** GGX roughness anisotropy in [0, 1]; native OpenPBR or source glTF strength according to specularAnisotropyModel. Requires tangents. Default `0`. */\n get specularRoughnessAnisotropy(): number { return this.specularAnisotropy; }\n set specularRoughnessAnisotropy(value: number) { this.specularAnisotropy = value; }\n\n /** OpenPBR coat GGX roughness anisotropy in [0, 1]. Default `0`. */\n get coatRoughnessAnisotropy(): number { return this.coatAnisotropy; }\n set coatRoughnessAnisotropy(value: number) { this.coatAnisotropy = value; }\n\n /** Subsurface scattering anisotropy in [-1, 1]. Default `0`. */\n get subsurfaceScatterAnisotropy(): number { return this.subsurfaceAnisotropy; }\n set subsurfaceScatterAnisotropy(value: number) { this.subsurfaceAnisotropy = value; }\n\n /** Surface coverage; alphaMode controls testing and blending. Default `1`. */\n get geometryOpacity(): number { return this.opacity; }\n set geometryOpacity(value: number) { this.opacity = value; }\n\n /** Treat the surface as an infinitely thin shell. Default `false`. */\n get geometryThinWalled(): boolean { return this.thinWalled; }\n set geometryThinWalled(value: boolean) { this.thinWalled = value; }\n\n // Renderer extensions\n /**\n * Invisible ground that only receives shadows, composited over the\n * background. Default `false`.\n */\n shadowCatcher: boolean = materialDefault('shadowCatcher');\n /** Displays emission without scattering or illuminating other surfaces. Default `false`. */\n unlit: boolean = materialDefault('unlit');\n /** Radius of rounded-edge shading (shader bevel) in scene units. `0` disables it. Default `0`. */\n bevelSize: number = materialDefault('bevelSize');\n /** How map alpha is used: ignored, opacity or transmission. Default `opaque`. */\n mapAlphaUsage: 'opaque' | 'alpha' | 'transmission' = materialDefault('mapAlphaUsage');\n /** Procedural UV projection for textures without (good) UVs. Default `none`. */\n uvProjection: UVProjection = materialDefault('uvProjection');\n /** UV scale used with `uvProjection`. Default `[1, 1]`. */\n uvProjectionScale: Vec2 = materialDefault('uvProjectionScale');\n\n // Displacement\n /** Height texture (red channel) for displacement. Default `undefined`. */\n displacementMap?: Texture;\n /** Procedural UV projection for the displacement map. Default `none`. */\n displacementUvProjection: UVProjection = materialDefault('displacementUvProjection');\n /** UV scale used with `displacementUvProjection`. Default `1`. */\n displacementUvProjectionScale: number = materialDefault('displacementUvProjectionScale');\n /** Height multiplier in mesh-local units; 0 removes height variation. Default `0.1`. */\n displacementScale: number = materialDefault('displacementScale');\n /** Offset added after scaling the height map, along the normal in mesh-local units; requires a displacement map. Default `0`. */\n displacementBias: number = materialDefault('displacementBias');\n /** Ray-marching step in mesh-local units; 0 automatically uses abs(displacementScale) / 32. Default `0`. */\n displacementStepSize: number = materialDefault('displacementStepSize');\n\n}\nexport const materialAlphaModeConstants = {\n opaque: 0,\n mask: 1,\n blend: 2\n} as const;\n\nexport type ResolvedMaterialAlphaMode = Exclude<MaterialAlphaMode, 'auto'>;\n\nexport function resolveMaterialAlphaMode(\n material: OpenPBRMaterial\n): ResolvedMaterialAlphaMode {\n if (material.alphaMode !== 'auto') return material.alphaMode;\n if (material.alphaCutoff > 0) return 'mask';\n if (\n material.opacity < 1 ||\n material.mapAlphaUsage === \"alpha\" ||\n material.alphaMap\n ) {\n return 'blend';\n }\n return 'opaque';\n}\n\nexport { materialKeys, materialTextureKeys, materialGeometryKeys, materialParamKeys, getMaterialHashKey, resetMaterialTextureId } from './openPbrSchema.js';\n\n/** Optional material properties; defaults are documented on OpenPBRMaterial. */\nexport type OpenPBRMaterialParams = Partial<OpenPBRMaterial>;\n"]}
|
|
1
|
+
{"version":3,"file":"OpenPBRMaterial.js","sourceRoot":"","sources":["../../src/scene/OpenPBRMaterial.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAI/C,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,iBAAiB,EACjF,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEzE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,aAAa;IACxD,4EAA4E;IAC5E,YAAY,SAAgC,EAAE,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;CAsCnE","sourcesContent":["import MaterialState from './MaterialState.js';\nimport type Texture from './Texture.js';\nexport type { UVProjection, MaterialAlphaMode, ResolvedMaterialAlphaMode } from './MaterialState.js';\nexport type { MaterialTextureName } from './materialTextureNames.js';\nexport { materialAlphaModeConstants, resolveMaterialAlphaMode } from './MaterialState.js';\nexport { materialKeys, materialTextureKeys, materialGeometryKeys, materialParamKeys,\n getMaterialHashKey, resetMaterialTextureId } from './openPbrSchema.js';\n\n/**\n * OpenPBR 1.1 surface material.\n *\n * Property names are camelCase OpenPBR inputs plus documented compatibility names\n * (https://academysoftwarefoundation.github.io/OpenPBR/). Colors are linear\n * RGB. Length-valued inputs (`transmissionDepth`, `subsurfaceRadius`) use\n * scene units; `thinFilmThickness` is in micrometres as in OpenPBR.\n *\n * ```ts\n * const gold = new OpenPBRMaterial({\n * baseColor: [1.0, 0.78, 0.34], baseMetalness: 1, specularRoughness: 0.2\n * });\n * ```\n *\n * Edit parameters in place; the next `engine.update()` detects the changes.\n */\nexport default class OpenPBRMaterial extends MaterialState {\n /** Creates a material. Omitted properties use their documented defaults. */\n constructor(params: OpenPBRMaterialParams = {}) { super(params); }\n\n /** Base color texture, multiplied with `baseColor` using Texture color encoding. Default `undefined`. */\n declare map?: Texture;\n /** Standalone opacity texture sampled from its green channel, matching Three.js. Default `undefined`. */\n declare alphaMap?: Texture;\n /** Emission texture multiplied with `emissionColor`. Default `undefined`. */\n declare emissiveMap?: Texture;\n /** Tangent-space normal map. Default `undefined`. */\n declare normalMap?: Texture;\n /** glTF-compatible B=metalness, G=specular roughness texture. Default `undefined`. */\n declare metallicRoughnessMap?: Texture;\n /** Standalone roughness texture sampled from its green channel. Default `undefined`. */\n declare roughnessMap?: Texture;\n /** Standalone metalness texture sampled from its blue channel. Default `undefined`. */\n declare metalnessMap?: Texture;\n /** Multiplies transmission weight using the texture's red channel. Default `undefined`. */\n declare transmissionMap?: Texture;\n /** Linear thickness-range texture; R and zero minimum preserve multiplication semantics. Default `undefined`. */\n declare thinFilmMap?: Texture;\n /** Multiplies coatWeight by the linear red channel. Default `undefined`. */\n declare coatWeightMap?: Texture;\n /** Multiplies coatRoughness by the linear green channel. Default `undefined`. */\n declare coatRoughnessMap?: Texture;\n /** Multiplies fuzzColor by RGB channels using Texture color encoding. Default `undefined`. */\n declare fuzzColorMap?: Texture;\n /** Multiplies fuzzRoughness by the linear alpha channel. Default `undefined`. */\n declare fuzzRoughnessMap?: Texture;\n /** Multiplies specularWeight by the linear alpha channel. Default `undefined`. */\n declare specularWeightMap?: Texture;\n /** Multiplies specularColor by RGB channels using Texture color encoding. Default `undefined`. */\n declare specularColorMap?: Texture;\n /** Linear RG tangent direction and B strength multiplier for the base specular layer. Default `undefined`. */\n declare anisotropyMap?: Texture;\n /** Independent tangent-space coat normal in linear RGB. Without a map, coat uses the surface normal before base normal mapping. Default `undefined`. */\n declare coatNormalMap?: Texture;\n /** Height texture (red channel) for displacement. Default `undefined`. */\n declare displacementMap?: Texture;\n}\n\n/** Optional material properties; defaults are documented on OpenPBRMaterial. */\nexport type OpenPBRMaterialParams = Partial<OpenPBRMaterial>;\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import TextureState from './TextureState.js';
|
|
2
|
+
// Separate native pixel ownership from the portable image-dimension record.
|
|
3
|
+
export default class PixelTexture extends TextureState {
|
|
4
|
+
pixels;
|
|
5
|
+
constructor(pixels) {
|
|
6
|
+
super({ width: pixels.width, height: pixels.height });
|
|
7
|
+
this.pixels = pixels;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=PixelTexture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PixelTexture.js","sourceRoot":"","sources":["../../src/scene/PixelTexture.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAG7C,4EAA4E;AAC5E,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,YAAY;IAC3C,MAAM,CAAoB;IACnC,YAAY,MAAyB;QACnC,KAAK,CAAC,EAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAC,CAAC,CAAC;QACpD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF","sourcesContent":["import TextureState from './TextureState.js';\nimport type { TextureDataSource } from './textureData.js';\n\n// Separate native pixel ownership from the portable image-dimension record.\nexport default class PixelTexture extends TextureState {\n readonly pixels: TextureDataSource;\n constructor(pixels: TextureDataSource) {\n super({width: pixels.width, height: pixels.height});\n this.pixels = pixels;\n }\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import Texture from './Texture.js';
|
|
2
|
+
import { type ProceduralSkyImage } from './skyParameters.js';
|
|
3
|
+
/** Settings for a clear Earth sky, with local solar time on an equinox at latitude 40°. */
|
|
4
|
+
export interface ProceduralSkyOptions {
|
|
5
|
+
/** Equirectangular pixel width and height, positive integers. Default `[2048, 1024]`; limited by the active device. */
|
|
6
|
+
resolution?: readonly [number, number];
|
|
7
|
+
/** Local solar time in hours, from `0` to `24`. Default `15`. Night has no stars, moon or artificial light. */
|
|
8
|
+
time?: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Clear-sky HDR environment for EnvironmentLight.map and scene backgrounds.
|
|
12
|
+
* Change time or resolution, then call engine.update(). Supports environments
|
|
13
|
+
* and backgrounds only; cannot be used in material texture slots.
|
|
14
|
+
*/
|
|
15
|
+
export default class ProceduralSky extends Texture {
|
|
16
|
+
image: ProceduralSkyImage;
|
|
17
|
+
constructor(options?: ProceduralSkyOptions);
|
|
18
|
+
/** Local solar time in hours, `0`–`24`. Default `15`; edits take effect on engine.update(). */
|
|
19
|
+
get time(): number;
|
|
20
|
+
set time(value: number);
|
|
21
|
+
/** Equirectangular pixel dimensions. Default `[2048, 1024]`; resizing discards accumulated samples. */
|
|
22
|
+
get resolution(): readonly [number, number];
|
|
23
|
+
set resolution(value: readonly [number, number]);
|
|
24
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import Texture from './Texture.js';
|
|
2
|
+
import { DEFAULT_SKY_TIME } from './skyParameters.js';
|
|
3
|
+
/**
|
|
4
|
+
* Clear-sky HDR environment for EnvironmentLight.map and scene backgrounds.
|
|
5
|
+
* Change time or resolution, then call engine.update(). Supports environments
|
|
6
|
+
* and backgrounds only; cannot be used in material texture slots.
|
|
7
|
+
*/
|
|
8
|
+
export default class ProceduralSky extends Texture {
|
|
9
|
+
constructor(options = {}) {
|
|
10
|
+
const [width, height] = validResolution(options.resolution ?? [2048, 1024]);
|
|
11
|
+
super({ type: 'ProceduralSky', width, height, time: validTime(options.time ?? DEFAULT_SKY_TIME) });
|
|
12
|
+
this.colorSpace = 'linear';
|
|
13
|
+
}
|
|
14
|
+
/** Local solar time in hours, `0`–`24`. Default `15`; edits take effect on engine.update(). */
|
|
15
|
+
get time() { return this.image.time; }
|
|
16
|
+
set time(value) {
|
|
17
|
+
const time = validTime(value);
|
|
18
|
+
if (time !== this.time)
|
|
19
|
+
this.image = { ...this.image, time };
|
|
20
|
+
}
|
|
21
|
+
/** Equirectangular pixel dimensions. Default `[2048, 1024]`; resizing discards accumulated samples. */
|
|
22
|
+
get resolution() { return [this.image.width, this.image.height]; }
|
|
23
|
+
set resolution(value) {
|
|
24
|
+
const [width, height] = validResolution(value);
|
|
25
|
+
if (width !== this.image.width || height !== this.image.height)
|
|
26
|
+
this.image = { ...this.image, width, height };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function validTime(time) {
|
|
30
|
+
if (!Number.isFinite(time) || time < 0 || time > 24)
|
|
31
|
+
throw new RangeError('ProceduralSky time must be between 0 and 24 hours.');
|
|
32
|
+
return time;
|
|
33
|
+
}
|
|
34
|
+
function validResolution(value) {
|
|
35
|
+
if (value.length !== 2 || !value.every(size => Number.isSafeInteger(size) && size > 0)) {
|
|
36
|
+
throw new RangeError('ProceduralSky resolution must contain two positive integers.');
|
|
37
|
+
}
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=ProceduralSky.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProceduralSky.js","sourceRoot":"","sources":["../../src/scene/ProceduralSky.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAA2B,MAAM,oBAAoB,CAAC;AAU/E;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,OAAO;IAGhD,YAAY,UAAgC,EAAE;QAC5C,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,eAAe,CAAC,OAAO,CAAC,UAAU,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QAC5E,KAAK,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,IAAI,IAAI,gBAAgB,CAAC,EAAE,CAAC,CAAC;QACnG,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAED,+FAA+F;IAC/F,IAAI,IAAI,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IACtC,IAAI,IAAI,CAAC,KAAa;QACpB,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;QAC9B,IAAI,IAAI,KAAK,IAAI,CAAC,IAAI;YAAE,IAAI,CAAC,KAAK,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC;IAC/D,CAAC;IAED,uGAAuG;IACvG,IAAI,UAAU,KAAgC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC7F,IAAI,UAAU,CAAC,KAAgC;QAC7C,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;QAC/C,IAAI,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,MAAM,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM;YAAE,IAAI,CAAC,KAAK,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAChH,CAAC;CACF;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,EAAE;QAAE,MAAM,IAAI,UAAU,CAAC,oDAAoD,CAAC,CAAC;IAChI,OAAO,IAAI,CAAC;AACd,CAAC;AACD,SAAS,eAAe,CAAC,KAAgC;IACvD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC;QACvF,MAAM,IAAI,UAAU,CAAC,8DAA8D,CAAC,CAAC;IACvF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import Texture from './Texture.js';\nimport { DEFAULT_SKY_TIME, type ProceduralSkyImage } from './skyParameters.js';\n\n/** Settings for a clear Earth sky, with local solar time on an equinox at latitude 40°. */\nexport interface ProceduralSkyOptions {\n /** Equirectangular pixel width and height, positive integers. Default `[2048, 1024]`; limited by the active device. */\n resolution?: readonly [number, number];\n /** Local solar time in hours, from `0` to `24`. Default `15`. Night has no stars, moon or artificial light. */\n time?: number;\n}\n\n/**\n * Clear-sky HDR environment for EnvironmentLight.map and scene backgrounds.\n * Change time or resolution, then call engine.update(). Supports environments\n * and backgrounds only; cannot be used in material texture slots.\n */\nexport default class ProceduralSky extends Texture {\n declare image: ProceduralSkyImage;\n\n constructor(options: ProceduralSkyOptions = {}) {\n const [width, height] = validResolution(options.resolution ?? [2048, 1024]);\n super({ type: 'ProceduralSky', width, height, time: validTime(options.time ?? DEFAULT_SKY_TIME) });\n this.colorSpace = 'linear';\n }\n\n /** Local solar time in hours, `0`–`24`. Default `15`; edits take effect on engine.update(). */\n get time() { return this.image.time; }\n set time(value: number) {\n const time = validTime(value);\n if (time !== this.time) this.image = { ...this.image, time };\n }\n\n /** Equirectangular pixel dimensions. Default `[2048, 1024]`; resizing discards accumulated samples. */\n get resolution(): readonly [number, number] { return [this.image.width, this.image.height]; }\n set resolution(value: readonly [number, number]) {\n const [width, height] = validResolution(value);\n if (width !== this.image.width || height !== this.image.height) this.image = { ...this.image, width, height };\n }\n}\n\nfunction validTime(time: number) {\n if (!Number.isFinite(time) || time < 0 || time > 24) throw new RangeError('ProceduralSky time must be between 0 and 24 hours.');\n return time;\n}\nfunction validResolution(value: readonly [number, number]) {\n if (value.length !== 2 || !value.every(size => Number.isSafeInteger(size) && size > 0)) {\n throw new RangeError('ProceduralSky resolution must contain two positive integers.');\n }\n return value;\n}\n"]}
|
package/lib/scene/RectLight.d.ts
CHANGED
|
@@ -1,21 +1,10 @@
|
|
|
1
|
+
import RectLightState from './RectLightState.js';
|
|
1
2
|
import type { ColorRGB, Vec2 } from '../types.js';
|
|
2
|
-
import SceneNode from './SceneNode.js';
|
|
3
3
|
import type Texture from './Texture.js';
|
|
4
4
|
/** Analytic light placed with transform; local -Z is the emission direction and local +X is the IES reference. */
|
|
5
|
-
export default class RectLight extends
|
|
6
|
-
/** Light discriminator. */
|
|
7
|
-
readonly type: "RectLight";
|
|
8
|
-
/** Width and height; transform scale is ignored. Default `[1, 1]`. */
|
|
9
|
-
size: Vec2;
|
|
10
|
-
/** Linear RGB color. Default `[1, 1, 1]`. */
|
|
11
|
-
color: ColorRGB;
|
|
12
|
-
/** Emitted radiance multiplier. Default `1`. */
|
|
13
|
-
intensity: number;
|
|
5
|
+
export default class RectLight extends RectLightState {
|
|
14
6
|
/** Emission texture. Default `undefined`. */
|
|
15
7
|
texture: Texture | undefined;
|
|
16
|
-
/** Angular spread from 0 (collimated) to 1 (hemisphere). Default `1`. */
|
|
17
|
-
spread: number;
|
|
18
|
-
/** Creates a light; omitted options retain the field defaults. */
|
|
19
8
|
constructor(params?: {
|
|
20
9
|
/** Width and height; transform scale is ignored. Default `[1, 1]`. */
|
|
21
10
|
size?: Vec2;
|
package/lib/scene/RectLight.js
CHANGED
|
@@ -1,26 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import RectLightState from './RectLightState.js';
|
|
2
2
|
/** Analytic light placed with transform; local -Z is the emission direction and local +X is the IES reference. */
|
|
3
|
-
export default class RectLight extends
|
|
4
|
-
/** Light discriminator. */
|
|
5
|
-
type = 'RectLight';
|
|
6
|
-
/** Width and height; transform scale is ignored. Default `[1, 1]`. */
|
|
7
|
-
size = [1, 1];
|
|
8
|
-
/** Linear RGB color. Default `[1, 1, 1]`. */
|
|
9
|
-
color = [1, 1, 1];
|
|
10
|
-
/** Emitted radiance multiplier. Default `1`. */
|
|
11
|
-
intensity = 1;
|
|
12
|
-
/** Emission texture. Default `undefined`. */
|
|
13
|
-
texture = undefined;
|
|
14
|
-
/** Angular spread from 0 (collimated) to 1 (hemisphere). Default `1`. */
|
|
15
|
-
spread = 1;
|
|
16
|
-
/** Creates a light; omitted options retain the field defaults. */
|
|
3
|
+
export default class RectLight extends RectLightState {
|
|
17
4
|
constructor(params = {}) {
|
|
18
|
-
super();
|
|
19
|
-
this.size = params.size ?? [1, 1];
|
|
20
|
-
this.color = params.color ?? [1, 1, 1];
|
|
21
|
-
this.intensity = params.intensity ?? 1;
|
|
22
|
-
this.texture = params.texture ?? undefined;
|
|
23
|
-
this.spread = params.spread ?? 1;
|
|
5
|
+
super(params);
|
|
24
6
|
}
|
|
25
7
|
}
|
|
26
8
|
//# sourceMappingURL=RectLight.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RectLight.js","sourceRoot":"","sources":["../../src/scene/RectLight.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RectLight.js","sourceRoot":"","sources":["../../src/scene/RectLight.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,qBAAqB,CAAC;AAIjD,kHAAkH;AAClH,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,cAAc;IAGnD,YAAY,SAWR,EAAE;QACJ,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;CACF","sourcesContent":["import RectLightState from './RectLightState.js';\nimport type { ColorRGB, Vec2 } from '../types.js';\nimport type Texture from './Texture.js';\n\n/** Analytic light placed with transform; local -Z is the emission direction and local +X is the IES reference. */\nexport default class RectLight extends RectLightState {\n /** Emission texture. Default `undefined`. */\n declare texture: Texture | undefined;\n constructor(params: {\n /** Width and height; transform scale is ignored. Default `[1, 1]`. */\n size?: Vec2;\n /** Linear RGB color. Default `[1, 1, 1]`. */\n color?: ColorRGB;\n /** Emitted radiance multiplier. Default `1`. */\n intensity?: number;\n /** Emission texture. Default `undefined`. */\n texture?: Texture | undefined;\n /** Angular spread from 0 (collimated) to 1 (hemisphere). Default `1`. */\n spread?: number;\n } = {}) {\n super(params);\n }\n}\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ColorRGB, Vec2 } from '../types.js';
|
|
2
|
+
import SceneNode from './SceneNode.js';
|
|
3
|
+
import type TextureState from './TextureState.js';
|
|
4
|
+
/** Analytic light placed with transform; local -Z is the emission direction and local +X is the IES reference. */
|
|
5
|
+
export default class RectLightState extends SceneNode {
|
|
6
|
+
/** Light discriminator. */
|
|
7
|
+
readonly type: "RectLight";
|
|
8
|
+
/** Width and height; transform scale is ignored. Default `[1, 1]`. */
|
|
9
|
+
size: Vec2;
|
|
10
|
+
/** Linear RGB color. Default `[1, 1, 1]`. */
|
|
11
|
+
color: ColorRGB;
|
|
12
|
+
/** Emitted radiance multiplier. Default `1`. */
|
|
13
|
+
intensity: number;
|
|
14
|
+
/** Emission texture. Default `undefined`. */
|
|
15
|
+
texture: TextureState | undefined;
|
|
16
|
+
/** Angular spread from 0 (collimated) to 1 (hemisphere). Default `1`. */
|
|
17
|
+
spread: number;
|
|
18
|
+
/** Creates a light; omitted options retain the field defaults. */
|
|
19
|
+
constructor(params?: {
|
|
20
|
+
/** Width and height; transform scale is ignored. Default `[1, 1]`. */
|
|
21
|
+
size?: Vec2;
|
|
22
|
+
/** Linear RGB color. Default `[1, 1, 1]`. */
|
|
23
|
+
color?: ColorRGB;
|
|
24
|
+
/** Emitted radiance multiplier. Default `1`. */
|
|
25
|
+
intensity?: number;
|
|
26
|
+
/** Emission texture. Default `undefined`. */
|
|
27
|
+
texture?: TextureState | undefined;
|
|
28
|
+
/** Angular spread from 0 (collimated) to 1 (hemisphere). Default `1`. */
|
|
29
|
+
spread?: number;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import SceneNode from './SceneNode.js';
|
|
2
|
+
/** Analytic light placed with transform; local -Z is the emission direction and local +X is the IES reference. */
|
|
3
|
+
export default class RectLightState extends SceneNode {
|
|
4
|
+
/** Light discriminator. */
|
|
5
|
+
type = 'RectLight';
|
|
6
|
+
/** Width and height; transform scale is ignored. Default `[1, 1]`. */
|
|
7
|
+
size = [1, 1];
|
|
8
|
+
/** Linear RGB color. Default `[1, 1, 1]`. */
|
|
9
|
+
color = [1, 1, 1];
|
|
10
|
+
/** Emitted radiance multiplier. Default `1`. */
|
|
11
|
+
intensity = 1;
|
|
12
|
+
/** Emission texture. Default `undefined`. */
|
|
13
|
+
texture = undefined;
|
|
14
|
+
/** Angular spread from 0 (collimated) to 1 (hemisphere). Default `1`. */
|
|
15
|
+
spread = 1;
|
|
16
|
+
/** Creates a light; omitted options retain the field defaults. */
|
|
17
|
+
constructor(params = {}) {
|
|
18
|
+
super();
|
|
19
|
+
this.size = params.size ?? [1, 1];
|
|
20
|
+
this.color = params.color ?? [1, 1, 1];
|
|
21
|
+
this.intensity = params.intensity ?? 1;
|
|
22
|
+
this.texture = params.texture ?? undefined;
|
|
23
|
+
this.spread = params.spread ?? 1;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=RectLightState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RectLightState.js","sourceRoot":"","sources":["../../src/scene/RectLightState.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AAGvC,kHAAkH;AAClH,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,SAAS;IACnD,2BAA2B;IAClB,IAAI,GAAG,WAAoB,CAAC;IACrC,sEAAsE;IACtE,IAAI,GAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACpB,6CAA6C;IAC7C,KAAK,GAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5B,gDAAgD;IAChD,SAAS,GAAW,CAAC,CAAC;IACtB,6CAA6C;IAC7C,OAAO,GAA6B,SAAS,CAAC;IAC9C,yEAAyE;IACzE,MAAM,GAAW,CAAC,CAAC;IAEnB,kEAAkE;IAClE,YAAY,SAWR,EAAE;QACJ,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAClC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACvC,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,SAAS,CAAC;QAC3C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC;IACnC,CAAC;CACF","sourcesContent":["import type { ColorRGB, Vec2 } from '../types.js';\nimport SceneNode from './SceneNode.js';\nimport type TextureState from './TextureState.js';\n\n/** Analytic light placed with transform; local -Z is the emission direction and local +X is the IES reference. */\nexport default class RectLightState extends SceneNode {\n /** Light discriminator. */\n readonly type = 'RectLight' as const;\n /** Width and height; transform scale is ignored. Default `[1, 1]`. */\n size: Vec2 = [1, 1];\n /** Linear RGB color. Default `[1, 1, 1]`. */\n color: ColorRGB = [1, 1, 1];\n /** Emitted radiance multiplier. Default `1`. */\n intensity: number = 1;\n /** Emission texture. Default `undefined`. */\n texture: TextureState | undefined = undefined;\n /** Angular spread from 0 (collimated) to 1 (hemisphere). Default `1`. */\n spread: number = 1;\n\n /** Creates a light; omitted options retain the field defaults. */\n constructor(params: {\n /** Width and height; transform scale is ignored. Default `[1, 1]`. */\n size?: Vec2;\n /** Linear RGB color. Default `[1, 1, 1]`. */\n color?: ColorRGB;\n /** Emitted radiance multiplier. Default `1`. */\n intensity?: number;\n /** Emission texture. Default `undefined`. */\n texture?: TextureState | undefined;\n /** Angular spread from 0 (collimated) to 1 (hemisphere). Default `1`. */\n spread?: number;\n } = {}) {\n super();\n this.size = params.size ?? [1, 1];\n this.color = params.color ?? [1, 1, 1];\n this.intensity = params.intensity ?? 1;\n this.texture = params.texture ?? undefined;\n this.spread = params.spread ?? 1;\n }\n}\n"]}
|
package/lib/scene/Scene.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ColorRGBA } from '../types.js';
|
|
1
|
+
import type { ColorRGBA, Mat4 } from '../types.js';
|
|
2
2
|
import AmbientLight from './AmbientLight.js';
|
|
3
3
|
import DirectionalLight from './DirectionalLight.js';
|
|
4
4
|
import EnvironmentLight from './EnvironmentLight.js';
|
|
@@ -12,6 +12,17 @@ import Texture from './Texture.js';
|
|
|
12
12
|
export type AnalyticLight = RectLight | SphereLight | SpotLight | DirectionalLight;
|
|
13
13
|
/** Any light that can be placed in {@link Scene.lights}. */
|
|
14
14
|
export type SceneLight = AmbientLight | EnvironmentLight | AnalyticLight;
|
|
15
|
+
/** An equirectangular camera background with independent orientation. */
|
|
16
|
+
export interface EquirectBackground {
|
|
17
|
+
/** Equirectangular background discriminator; always `Equirect`. */
|
|
18
|
+
type: 'Equirect';
|
|
19
|
+
/** Required equirectangular texture. */
|
|
20
|
+
map: Texture;
|
|
21
|
+
/** Map-to-world rotation, column-major. Default identity; translation and positive axis scale are ignored. */
|
|
22
|
+
transform?: Mat4;
|
|
23
|
+
/** Nonnegative background RGB multiplier. Default `1`; lighting and alpha are unchanged. */
|
|
24
|
+
intensity?: number;
|
|
25
|
+
}
|
|
15
26
|
/**
|
|
16
27
|
* Environment map projected onto a ground plane and sky dome, so objects
|
|
17
28
|
* appear to stand on the photographed ground.
|
|
@@ -36,10 +47,10 @@ export interface GroundedSkyboxBackground {
|
|
|
36
47
|
}
|
|
37
48
|
/**
|
|
38
49
|
* What camera rays that miss the scene show: a linear RGBA color (alpha 0
|
|
39
|
-
* for a transparent canvas), an equirectangular texture,
|
|
40
|
-
* skybox. When omitted, the environment light is shown.
|
|
50
|
+
* for a transparent canvas), an equirectangular texture, an `EquirectBackground`
|
|
51
|
+
* with independent rotation, or a grounded skybox. When omitted, the environment light is shown.
|
|
41
52
|
*/
|
|
42
|
-
export type SceneBackground = ColorRGBA | Texture | GroundedSkyboxBackground;
|
|
53
|
+
export type SceneBackground = ColorRGBA | Texture | EquirectBackground | GroundedSkyboxBackground;
|
|
43
54
|
/**
|
|
44
55
|
* Everything the renderer draws. A plain object; mesh and light membership,
|
|
45
56
|
* mesh transforms, material parameters, resource references, light parameters and background
|
package/lib/scene/Scene.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Scene.js","sourceRoot":"","sources":["../../src/scene/Scene.ts"],"names":[],"mappings":"","sourcesContent":["import { ColorRGBA } from '../types.js';\nimport AmbientLight from './AmbientLight.js';\nimport DirectionalLight from './DirectionalLight.js';\nimport EnvironmentLight from './EnvironmentLight.js';\nimport Mesh from './Mesh.js';\nimport InstancedMesh from './InstancedMesh.js';\nimport RectLight from './RectLight.js';\nimport SphereLight from './SphereLight.js';\nimport SpotLight from './SpotLight.js';\nimport Texture from './Texture.js';\n\n/** Lights with an analytic shape. */\nexport type AnalyticLight = RectLight | SphereLight | SpotLight | DirectionalLight;\n/** Any light that can be placed in {@link Scene.lights}. */\nexport type SceneLight = AmbientLight | EnvironmentLight | AnalyticLight;\n\n/**\n * Environment map projected onto a ground plane and sky dome, so objects\n * appear to stand on the photographed ground.\n */\nexport interface GroundedSkyboxBackground {\n /** Ground projection discriminator; always `GroundedSkybox`. */\n type: 'GroundedSkybox';\n /** Required equirectangular environment texture. */\n map: Texture;\n /** Required capture height above ground in scene units. */\n height: number;\n /** Required projected sky-dome radius in scene units. */\n radius: number;\n /** Ground plane Y in scene units. Default `0`. */\n groundHeight?: number;\n /** Capture X/Z center in scene units. Default `[0, 0]`. */\n center?: [number, number];\n /** Background rotation around +Y in radians, about the capture center. Default `0`; ground stays level. */\n rotation?: number;\n /** Nonnegative background RGB multiplier. Default `1`; lighting and alpha are unchanged. */\n intensity?: number;\n}\n\n/**\n * What camera rays that miss the scene show: a linear RGBA color (alpha 0\n * for a transparent canvas), an equirectangular texture, or a grounded
|
|
1
|
+
{"version":3,"file":"Scene.js","sourceRoot":"","sources":["../../src/scene/Scene.ts"],"names":[],"mappings":"","sourcesContent":["import type { ColorRGBA, Mat4 } from '../types.js';\nimport AmbientLight from './AmbientLight.js';\nimport DirectionalLight from './DirectionalLight.js';\nimport EnvironmentLight from './EnvironmentLight.js';\nimport Mesh from './Mesh.js';\nimport InstancedMesh from './InstancedMesh.js';\nimport RectLight from './RectLight.js';\nimport SphereLight from './SphereLight.js';\nimport SpotLight from './SpotLight.js';\nimport Texture from './Texture.js';\n\n/** Lights with an analytic shape. */\nexport type AnalyticLight = RectLight | SphereLight | SpotLight | DirectionalLight;\n/** Any light that can be placed in {@link Scene.lights}. */\nexport type SceneLight = AmbientLight | EnvironmentLight | AnalyticLight;\n\n/** An equirectangular camera background with independent orientation. */\nexport interface EquirectBackground {\n /** Equirectangular background discriminator; always `Equirect`. */\n type: 'Equirect';\n /** Required equirectangular texture. */\n map: Texture;\n /** Map-to-world rotation, column-major. Default identity; translation and positive axis scale are ignored. */\n transform?: Mat4;\n /** Nonnegative background RGB multiplier. Default `1`; lighting and alpha are unchanged. */\n intensity?: number;\n}\n\n/**\n * Environment map projected onto a ground plane and sky dome, so objects\n * appear to stand on the photographed ground.\n */\nexport interface GroundedSkyboxBackground {\n /** Ground projection discriminator; always `GroundedSkybox`. */\n type: 'GroundedSkybox';\n /** Required equirectangular environment texture. */\n map: Texture;\n /** Required capture height above ground in scene units. */\n height: number;\n /** Required projected sky-dome radius in scene units. */\n radius: number;\n /** Ground plane Y in scene units. Default `0`. */\n groundHeight?: number;\n /** Capture X/Z center in scene units. Default `[0, 0]`. */\n center?: [number, number];\n /** Background rotation around +Y in radians, about the capture center. Default `0`; ground stays level. */\n rotation?: number;\n /** Nonnegative background RGB multiplier. Default `1`; lighting and alpha are unchanged. */\n intensity?: number;\n}\n\n/**\n * What camera rays that miss the scene show: a linear RGBA color (alpha 0\n * for a transparent canvas), an equirectangular texture, an `EquirectBackground`\n * with independent rotation, or a grounded skybox. When omitted, the environment light is shown.\n */\nexport type SceneBackground = ColorRGBA | Texture | EquirectBackground | GroundedSkyboxBackground;\n/**\n * Everything the renderer draws. A plain object; mesh and light membership,\n * mesh transforms, material parameters, resource references, light parameters and background\n * values are detected automatically, including edits within existing arrays.\n * Call `markUpdated()` on a Geometry after attribute edits, and a Texture\n * after pixel or UV-array element edits.\n * InstancedMesh matrix/color elements require markUpdated() or the dedicated\n * markTransformsUpdated()/markColorsUpdated() notifications.\n */\nexport interface Scene {\n /** Required mesh instances; use an empty array for an empty scene. */\n meshes: (Mesh | InstancedMesh)[];\n /** Required lights; use an empty array for an unlit scene. */\n lights: SceneLight[];\n /** Camera-ray background; defaults to the environment light when omitted. */\n background?: SceneBackground;\n\n}\n"]}
|
package/lib/scene/SceneNode.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { read, write } from '../math/access.js';
|
|
1
2
|
import { mat4 } from '../math.js';
|
|
2
3
|
/** Base class of objects positioned by a local-to-world transform. */
|
|
3
4
|
export default class SceneNode {
|
|
@@ -10,19 +11,19 @@ export default class SceneNode {
|
|
|
10
11
|
transform = mat4.create();
|
|
11
12
|
/** Reads a copy of the translation, or writes it into transform. Default `[0, 0, 0]`. */
|
|
12
13
|
get position() {
|
|
13
|
-
return [this.transform
|
|
14
|
+
return [read(this.transform, 12), read(this.transform, 13), read(this.transform, 14)];
|
|
14
15
|
}
|
|
15
16
|
set position(value) {
|
|
16
|
-
this.transform
|
|
17
|
-
this.transform
|
|
18
|
-
this.transform
|
|
17
|
+
write(this.transform, 12, read(value, 0));
|
|
18
|
+
write(this.transform, 13, read(value, 1));
|
|
19
|
+
write(this.transform, 14, read(value, 2));
|
|
19
20
|
}
|
|
20
21
|
/** Points local -Z at target, preserving position and scale. Default up `[0, 1, 0]`. */
|
|
21
22
|
lookAt(target, up = [0, 1, 0]) {
|
|
22
23
|
const scale = mat4.getScaling(new Float32Array(3), this.transform);
|
|
23
24
|
const position = this.position;
|
|
24
|
-
const direction = [target
|
|
25
|
-
const cross = [direction[1] * up
|
|
25
|
+
const direction = [read(target, 0) - read(position, 0), read(target, 1) - read(position, 1), read(target, 2) - read(position, 2)];
|
|
26
|
+
const cross = [direction[1] * read(up, 2) - direction[2] * read(up, 1), direction[2] * read(up, 0) - direction[0] * read(up, 2), direction[0] * read(up, 1) - direction[1] * read(up, 0)];
|
|
26
27
|
const effectiveUp = Math.hypot(...cross) > 1e-8 ? up
|
|
27
28
|
: Math.abs(direction[2]) < Math.hypot(...direction) * .99 ? [0, 0, -1] : [1, 0, 0];
|
|
28
29
|
mat4.targetTo(this.transform, position, target, effectiveUp);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SceneNode.js","sourceRoot":"","sources":["../../src/scene/SceneNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,sEAAsE;AACtE,MAAM,CAAC,OAAO,OAAgB,SAAS;IACrC,kDAAkD;IAClD,IAAI,GAAG,EAAE,CAAC;IACV;;;OAGG;IACH,SAAS,GAAS,IAAI,CAAC,MAAM,EAAE,CAAC;IAEhC,yFAAyF;IACzF,IAAI,QAAQ;QACV,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"SceneNode.js","sourceRoot":"","sources":["../../src/scene/SceneNode.ts"],"names":[],"mappings":"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","sourcesContent":["import type { Mat4, Vec3 } from '../types.js';\nimport { read, write } from '../math/access.js';\nimport { mat4 } from '../math.js';\n\n/** Base class of objects positioned by a local-to-world transform. */\nexport default abstract class SceneNode {\n /** Optional object name. Default empty string. */\n name = '';\n /**\n * Local-to-world transform: column-major 4×4 (gl-matrix layout). Default identity.\n * Edits, including in-place element edits, are detected on the next render.\n */\n transform: Mat4 = mat4.create();\n\n /** Reads a copy of the translation, or writes it into transform. Default `[0, 0, 0]`. */\n get position(): Vec3 {\n return [read(this.transform, 12), read(this.transform, 13), read(this.transform, 14)];\n }\n set position(value: Vec3) {\n write(this.transform, 12, read(value, 0));\n write(this.transform, 13, read(value, 1));\n write(this.transform, 14, read(value, 2));\n }\n\n /** Points local -Z at target, preserving position and scale. Default up `[0, 1, 0]`. */\n lookAt(target: Vec3, up: Vec3 = [0, 1, 0]): this {\n const scale = mat4.getScaling(new Float32Array(3), this.transform);\n const position = this.position;\n const direction = [read(target, 0) - read(position, 0), read(target, 1) - read(position, 1), read(target, 2) - read(position, 2)];\n const cross = [direction[1]*read(up, 2)-direction[2]*read(up, 1), direction[2]*read(up, 0)-direction[0]*read(up, 2), direction[0]*read(up, 1)-direction[1]*read(up, 0)];\n const effectiveUp: Vec3 = Math.hypot(...cross) > 1e-8 ? up\n : Math.abs(direction[2]) < Math.hypot(...direction) * .99 ? [0, 0, -1] : [1, 0, 0];\n mat4.targetTo(this.transform, position, target, effectiveUp);\n mat4.scale(this.transform, this.transform, scale);\n return this;\n }\n}\n"]}
|
package/lib/scene/Texture.d.ts
CHANGED
|
@@ -1,49 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/** Required pixel height. */
|
|
8
|
-
height: number;
|
|
9
|
-
}
|
|
10
|
-
/** Transfer function for material color slots; data-map channels remain linear. */
|
|
11
|
-
export type TextureColorSpace = 'srgb' | 'linear';
|
|
12
|
-
/** Addressing of coordinates outside a material texture's [0, 1] range. */
|
|
13
|
-
export type TextureWrapMode = 'repeat' | 'clamp-to-edge' | 'mirrored-repeat';
|
|
14
|
-
export declare function textureWrapIndex(mode: TextureWrapMode): number;
|
|
1
|
+
import type { ProceduralSkyImage } from './skyParameters.js';
|
|
2
|
+
import TextureState from './TextureState.js';
|
|
3
|
+
export type { TextureColorSpace, TextureWrapMode } from './TextureState.js';
|
|
4
|
+
export { textureWrapIndex } from './TextureState.js';
|
|
5
|
+
import type { TextureDataSource } from './textureData.js';
|
|
6
|
+
export type { TextureDataSource } from './textureData.js';
|
|
15
7
|
/**
|
|
16
8
|
* Image used by materials, lights and backgrounds. Material color slots default
|
|
17
9
|
* to sRGB for images/bytes and linear for float data; colorSpace overrides this.
|
|
18
10
|
*/
|
|
19
|
-
export default class Texture {
|
|
20
|
-
/**
|
|
21
|
-
image: HTMLImageElement | HTMLCanvasElement | ImageBitmap | OffscreenCanvas | TextureDataSource;
|
|
11
|
+
export default class Texture extends TextureState {
|
|
12
|
+
/** Texture source supplied to the constructor; no default. */
|
|
13
|
+
image: HTMLImageElement | HTMLCanvasElement | ImageBitmap | OffscreenCanvas | TextureDataSource | ProceduralSkyImage;
|
|
22
14
|
/** Optional stable identity of the texture in an adapter such as Three.js. */
|
|
23
15
|
source?: object;
|
|
24
|
-
|
|
25
|
-
version: number;
|
|
26
|
-
/** Flip the image vertically when uploading. Default `false`. */
|
|
27
|
-
flipY: boolean;
|
|
28
|
-
/** UV repeat applied before sampling this texture. Default `[1, 1]`. */
|
|
29
|
-
uvScale: [number, number];
|
|
30
|
-
/** UV translation applied after repeat and before wrapping. Default `[0, 0]`. */
|
|
31
|
-
uvOffset: [number, number];
|
|
32
|
-
/** Horizontal material-texture addressing after UV scale/offset. Default `'repeat'`. */
|
|
33
|
-
wrapS: TextureWrapMode;
|
|
34
|
-
/** Vertical material-texture addressing after UV scale/offset. Default `'repeat'`. */
|
|
35
|
-
wrapT: TextureWrapMode;
|
|
36
|
-
/** Material color encoding. Default undefined: sRGB for images/bytes, linear for float/integer HDR data. Data-map channels ignore this option. */
|
|
37
|
-
colorSpace?: TextureColorSpace;
|
|
38
|
-
/** Geometry UV set used by this texture (Three.js Texture.channel). Default `0`. */
|
|
39
|
-
uvChannel: 0 | 1;
|
|
40
|
-
constructor(image: HTMLImageElement | HTMLCanvasElement | ImageBitmap | OffscreenCanvas | TextureDataSource);
|
|
41
|
-
/**
|
|
42
|
-
* Call after editing image pixels or UV array elements in place. Increments
|
|
43
|
-
* version so the next render refreshes all materials, lights and backgrounds
|
|
44
|
-
* using this texture. Assigning a new image, UV array, flipY, wrapS, wrapT, colorSpace or
|
|
45
|
-
* uvChannel is detected automatically.
|
|
46
|
-
*/
|
|
47
|
-
markUpdated(): this;
|
|
16
|
+
constructor(image: HTMLImageElement | HTMLCanvasElement | ImageBitmap | OffscreenCanvas | TextureDataSource | ProceduralSkyImage);
|
|
48
17
|
}
|
|
49
18
|
export declare function isTextureDataSource(image: unknown): image is TextureDataSource;
|
package/lib/scene/Texture.js
CHANGED
|
@@ -1,43 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}
|
|
1
|
+
import TextureState from './TextureState.js';
|
|
2
|
+
export { textureWrapIndex } from './TextureState.js';
|
|
4
3
|
/**
|
|
5
4
|
* Image used by materials, lights and backgrounds. Material color slots default
|
|
6
5
|
* to sRGB for images/bytes and linear for float data; colorSpace overrides this.
|
|
7
6
|
*/
|
|
8
|
-
export default class Texture {
|
|
9
|
-
/** Image or raw RGBA pixels supplied to the constructor; no default. */
|
|
10
|
-
image;
|
|
7
|
+
export default class Texture extends TextureState {
|
|
11
8
|
/** Optional stable identity of the texture in an adapter such as Three.js. */
|
|
12
9
|
source;
|
|
13
|
-
/** Incremented by `markUpdated()`. */
|
|
14
|
-
version = 0;
|
|
15
|
-
/** Flip the image vertically when uploading. Default `false`. */
|
|
16
|
-
flipY = false;
|
|
17
|
-
/** UV repeat applied before sampling this texture. Default `[1, 1]`. */
|
|
18
|
-
uvScale = [1, 1];
|
|
19
|
-
/** UV translation applied after repeat and before wrapping. Default `[0, 0]`. */
|
|
20
|
-
uvOffset = [0, 0];
|
|
21
|
-
/** Horizontal material-texture addressing after UV scale/offset. Default `'repeat'`. */
|
|
22
|
-
wrapS = 'repeat';
|
|
23
|
-
/** Vertical material-texture addressing after UV scale/offset. Default `'repeat'`. */
|
|
24
|
-
wrapT = 'repeat';
|
|
25
|
-
/** Material color encoding. Default undefined: sRGB for images/bytes, linear for float/integer HDR data. Data-map channels ignore this option. */
|
|
26
|
-
colorSpace;
|
|
27
|
-
/** Geometry UV set used by this texture (Three.js Texture.channel). Default `0`. */
|
|
28
|
-
uvChannel = 0;
|
|
29
10
|
constructor(image) {
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Call after editing image pixels or UV array elements in place. Increments
|
|
34
|
-
* version so the next render refreshes all materials, lights and backgrounds
|
|
35
|
-
* using this texture. Assigning a new image, UV array, flipY, wrapS, wrapT, colorSpace or
|
|
36
|
-
* uvChannel is detected automatically.
|
|
37
|
-
*/
|
|
38
|
-
markUpdated() {
|
|
39
|
-
this.version++;
|
|
40
|
-
return this;
|
|
11
|
+
super(image);
|
|
41
12
|
}
|
|
42
13
|
}
|
|
43
14
|
export function isTextureDataSource(image) {
|
package/lib/scene/Texture.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Texture.js","sourceRoot":"","sources":["../../src/scene/Texture.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Texture.js","sourceRoot":"","sources":["../../src/scene/Texture.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,YAAY;IAG/C,8EAA8E;IAC9E,MAAM,CAAU;IAChB,YAAY,KAAoH;QAC9H,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;CACF;AAED,MAAM,UAAU,mBAAmB,CACjC,KAAc;IAEd,OAAO,CAAC,CAAC,CAAC,KAAK,IAAK,KAA2B,CAAC,IAAI,CAAC,CAAC;AACxD,CAAC","sourcesContent":["import type { ProceduralSkyImage } from './skyParameters.js';\nimport TextureState from './TextureState.js';\nexport type { TextureColorSpace, TextureWrapMode } from './TextureState.js';\nexport { textureWrapIndex } from './TextureState.js';\nimport type { TextureDataSource } from './textureData.js';\nexport type { TextureDataSource } from './textureData.js';\n\n/**\n * Image used by materials, lights and backgrounds. Material color slots default\n * to sRGB for images/bytes and linear for float data; colorSpace overrides this.\n */\nexport default class Texture extends TextureState {\n /** Texture source supplied to the constructor; no default. */\n declare image: HTMLImageElement | HTMLCanvasElement | ImageBitmap | OffscreenCanvas | TextureDataSource | ProceduralSkyImage;\n /** Optional stable identity of the texture in an adapter such as Three.js. */\n source?: object;\n constructor(image: HTMLImageElement | HTMLCanvasElement | ImageBitmap | OffscreenCanvas | TextureDataSource | ProceduralSkyImage) {\n super(image);\n }\n}\n\nexport function isTextureDataSource(\n image: unknown\n): image is TextureDataSource {\n return !!(image && (image as TextureDataSource).data);\n}\n\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Transfer function for material color slots; data-map channels remain linear. */
|
|
2
|
+
export type TextureColorSpace = 'srgb' | 'linear';
|
|
3
|
+
/** Addressing of coordinates outside a material texture's [0, 1] range. */
|
|
4
|
+
export type TextureWrapMode = 'repeat' | 'clamp-to-edge' | 'mirrored-repeat';
|
|
5
|
+
export declare function textureWrapIndex(mode: TextureWrapMode): number;
|
|
6
|
+
export interface TextureImageSize {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
}
|
|
10
|
+
export default class TextureState {
|
|
11
|
+
image: TextureImageSize;
|
|
12
|
+
version: number;
|
|
13
|
+
/** Flip the image vertically when uploading. Default `false`. */
|
|
14
|
+
flipY: boolean;
|
|
15
|
+
/** UV repeat applied before sampling this texture. Default `[1, 1]`. */
|
|
16
|
+
uvScale: [number, number];
|
|
17
|
+
/** UV translation applied after repeat and before wrapping. Default `[0, 0]`. */
|
|
18
|
+
uvOffset: [number, number];
|
|
19
|
+
/** Horizontal material-texture addressing after UV scale/offset. Default `'repeat'`. */
|
|
20
|
+
wrapS: TextureWrapMode;
|
|
21
|
+
/** Vertical material-texture addressing after UV scale/offset. Default `'repeat'`. */
|
|
22
|
+
wrapT: TextureWrapMode;
|
|
23
|
+
/** Material color encoding. Default undefined: sRGB for images/bytes, linear for float/integer HDR data. Data-map channels ignore this option. */
|
|
24
|
+
colorSpace?: TextureColorSpace;
|
|
25
|
+
/** Geometry UV set used by this texture (Three.js Texture.channel). Default `0`. */
|
|
26
|
+
uvChannel: 0 | 1;
|
|
27
|
+
constructor(image: TextureImageSize);
|
|
28
|
+
/**
|
|
29
|
+
* Call after editing image pixels or UV array elements in place. Increments
|
|
30
|
+
* version so the next render refreshes all materials, lights and backgrounds
|
|
31
|
+
* using this texture. Assigning a new image, UV array, flipY, wrapS, wrapT, colorSpace or
|
|
32
|
+
* uvChannel is detected automatically.
|
|
33
|
+
*/
|
|
34
|
+
markUpdated(): this;
|
|
35
|
+
}
|