@babylonjs/core 5.45.2 → 5.46.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/Actions/condition.js +23 -23
- package/Actions/condition.js.map +1 -1
- package/Animations/animatable.js +48 -48
- package/Animations/animatable.js.map +1 -1
- package/Animations/animation.js +53 -53
- package/Animations/animation.js.map +1 -1
- package/Animations/animationGroup.js +53 -53
- package/Animations/animationGroup.js.map +1 -1
- package/Animations/runtimeAnimation.js +36 -36
- package/Animations/runtimeAnimation.js.map +1 -1
- package/Audio/audioEngine.js +14 -14
- package/Audio/audioEngine.js.map +1 -1
- package/Audio/audioSceneComponent.js +14 -14
- package/Audio/audioSceneComponent.js.map +1 -1
- package/Audio/sound.js +47 -47
- package/Audio/sound.js.map +1 -1
- package/Behaviors/Meshes/baseSixDofDragBehavior.d.ts +1 -1
- package/Behaviors/Meshes/fadeInOutBehavior.js +11 -11
- package/Behaviors/Meshes/fadeInOutBehavior.js.map +1 -1
- package/Behaviors/Meshes/pointerDragBehavior.js +34 -34
- package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
- package/Bones/bone.js +15 -15
- package/Bones/bone.js.map +1 -1
- package/Bones/boneIKController.js +9 -9
- package/Bones/boneIKController.js.map +1 -1
- package/Bones/boneLookController.js +50 -50
- package/Bones/boneLookController.js.map +1 -1
- package/Bones/skeleton.js +35 -35
- package/Bones/skeleton.js.map +1 -1
- package/Buffers/buffer.js +14 -14
- package/Buffers/buffer.js.map +1 -1
- package/Buffers/dataBuffer.js +6 -6
- package/Buffers/dataBuffer.js.map +1 -1
- package/Cameras/Inputs/freeCameraDeviceOrientationInput.js +42 -42
- package/Cameras/Inputs/freeCameraDeviceOrientationInput.js.map +1 -1
- package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js +18 -18
- package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js.map +1 -1
- package/Cameras/VR/vrExperienceHelper.js +178 -178
- package/Cameras/VR/vrExperienceHelper.js.map +1 -1
- package/Cameras/arcRotateCamera.js +176 -176
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Cameras/camera.js +90 -90
- package/Cameras/camera.js.map +1 -1
- package/Cameras/flyCamera.js +82 -82
- package/Cameras/flyCamera.js.map +1 -1
- package/Cameras/freeCamera.js +54 -54
- package/Cameras/freeCamera.js.map +1 -1
- package/Compute/computeShader.js +12 -12
- package/Compute/computeShader.js.map +1 -1
- package/Culling/ray.d.ts +1 -1
- package/Debug/axesViewer.js +12 -12
- package/Debug/axesViewer.js.map +1 -1
- package/Debug/debugLayer.js +21 -21
- package/Debug/debugLayer.js.map +1 -1
- package/Debug/directionalLightFrustumViewer.js +20 -20
- package/Debug/directionalLightFrustumViewer.js.map +1 -1
- package/Debug/rayHelper.js +10 -10
- package/Debug/rayHelper.js.map +1 -1
- package/Debug/skeletonViewer.js +81 -81
- package/Debug/skeletonViewer.js.map +1 -1
- package/DeviceInput/InputDevices/deviceSource.d.ts +1 -1
- package/DeviceInput/InputDevices/deviceSourceManager.js +31 -31
- package/DeviceInput/InputDevices/deviceSourceManager.js.map +1 -1
- package/DeviceInput/InputDevices/deviceTypes.d.ts +1 -1
- package/DeviceInput/internalDeviceSourceManager.d.ts +2 -2
- package/Engines/Extensions/engine.computeShader.d.ts +3 -3
- package/Engines/Extensions/engine.multiRender.js +1 -1
- package/Engines/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/Extensions/engine.query.d.ts +1 -1
- package/Engines/Extensions/engine.renderTarget.d.ts +1 -1
- package/Engines/Extensions/engine.renderTarget.js +1 -1
- package/Engines/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/Native/nativeDataStream.d.ts +1 -1
- package/Engines/Native/nativeHardwareTexture.js +3 -3
- package/Engines/Native/nativeHardwareTexture.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +5 -5
- package/Engines/Native/nativePipelineContext.js +7 -7
- package/Engines/Native/nativePipelineContext.js.map +1 -1
- package/Engines/Native/nativeRenderTargetWrapper.js +6 -6
- package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -1
- package/Engines/Processors/shaderCodeInliner.js +4 -4
- package/Engines/Processors/shaderCodeInliner.js.map +1 -1
- package/Engines/Processors/shaderProcessingOptions.d.ts +1 -1
- package/Engines/WebGL/webGLHardwareTexture.js +3 -3
- package/Engines/WebGL/webGLHardwareTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuBufferManager.js +3 -3
- package/Engines/WebGPU/webgpuBufferManager.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheBindGroups.js +6 -6
- package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipelineTree.js +5 -5
- package/Engines/WebGPU/webgpuCacheRenderPipelineTree.js.map +1 -1
- package/Engines/WebGPU/webgpuClearQuad.js +11 -11
- package/Engines/WebGPU/webgpuClearQuad.js.map +1 -1
- package/Engines/WebGPU/webgpuComputeContext.js +7 -7
- package/Engines/WebGPU/webgpuComputeContext.js.map +1 -1
- package/Engines/WebGPU/webgpuComputePipelineContext.js +4 -4
- package/Engines/WebGPU/webgpuComputePipelineContext.js.map +1 -1
- package/Engines/WebGPU/webgpuDrawContext.js +7 -7
- package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
- package/Engines/WebGPU/webgpuHardwareTexture.js +9 -9
- package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuMaterialContext.js +5 -5
- package/Engines/WebGPU/webgpuMaterialContext.js.map +1 -1
- package/Engines/WebGPU/webgpuOcclusionQuery.js +10 -10
- package/Engines/WebGPU/webgpuOcclusionQuery.js.map +1 -1
- package/Engines/WebGPU/webgpuPipelineContext.js +6 -6
- package/Engines/WebGPU/webgpuPipelineContext.js.map +1 -1
- package/Engines/WebGPU/webgpuQuerySet.js +3 -3
- package/Engines/WebGPU/webgpuQuerySet.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessingContext.js +3 -3
- package/Engines/WebGPU/webgpuShaderProcessingContext.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.js +3 -3
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/WebGPU/webgpuTimestampQuery.js +3 -3
- package/Engines/WebGPU/webgpuTimestampQuery.js.map +1 -1
- package/Engines/engine.js +134 -134
- package/Engines/engine.js.map +1 -1
- package/Engines/nativeEngine.js +6 -6
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.js +25 -25
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/renderTargetWrapper.js +25 -25
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/thinEngine.js +243 -243
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +132 -132
- package/Engines/webgpuEngine.js.map +1 -1
- package/Events/keyboardEvents.js +10 -10
- package/Events/keyboardEvents.js.map +1 -1
- package/Events/pointerEvents.js +9 -9
- package/Events/pointerEvents.js.map +1 -1
- package/Gamepads/Controllers/poseEnabledController.js +9 -9
- package/Gamepads/Controllers/poseEnabledController.js.map +1 -1
- package/Gamepads/Controllers/webVRController.js +13 -13
- package/Gamepads/Controllers/webVRController.js.map +1 -1
- package/Gamepads/gamepad.js +20 -20
- package/Gamepads/gamepad.js.map +1 -1
- package/Gizmos/axisDragGizmo.js +45 -45
- package/Gizmos/axisDragGizmo.js.map +1 -1
- package/Gizmos/axisScaleGizmo.js +12 -12
- package/Gizmos/axisScaleGizmo.js.map +1 -1
- package/Gizmos/boundingBoxGizmo.js +74 -74
- package/Gizmos/boundingBoxGizmo.js.map +1 -1
- package/Gizmos/gizmo.js +34 -34
- package/Gizmos/gizmo.js.map +1 -1
- package/Gizmos/gizmoManager.js +40 -40
- package/Gizmos/gizmoManager.js.map +1 -1
- package/Gizmos/planeDragGizmo.js +23 -23
- package/Gizmos/planeDragGizmo.js.map +1 -1
- package/Gizmos/planeRotationGizmo.js +12 -12
- package/Gizmos/planeRotationGizmo.js.map +1 -1
- package/Gizmos/positionGizmo.js +40 -40
- package/Gizmos/positionGizmo.js.map +1 -1
- package/Gizmos/rotationGizmo.js +47 -47
- package/Gizmos/rotationGizmo.js.map +1 -1
- package/Gizmos/scaleGizmo.js +41 -41
- package/Gizmos/scaleGizmo.js.map +1 -1
- package/Helpers/environmentHelper.js +18 -18
- package/Helpers/environmentHelper.js.map +1 -1
- package/Helpers/textureDome.js +96 -96
- package/Helpers/textureDome.js.map +1 -1
- package/IAccessibilityTag.d.ts +2 -2
- package/Instrumentation/engineInstrumentation.js +21 -21
- package/Instrumentation/engineInstrumentation.js.map +1 -1
- package/Instrumentation/sceneInstrumentation.js +90 -90
- package/Instrumentation/sceneInstrumentation.js.map +1 -1
- package/Layers/effectLayer.js +48 -48
- package/Layers/effectLayer.js.map +1 -1
- package/Layers/glowLayer.js +32 -32
- package/Layers/glowLayer.js.map +1 -1
- package/Layers/highlightLayer.js +26 -26
- package/Layers/highlightLayer.js.map +1 -1
- package/Layers/layer.js +40 -40
- package/Layers/layer.js.map +1 -1
- package/LensFlares/lensFlare.js +15 -15
- package/LensFlares/lensFlare.js.map +1 -1
- package/LensFlares/lensFlareSystem.js +4 -4
- package/LensFlares/lensFlareSystem.js.map +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js +18 -18
- package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +115 -115
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Lights/directionalLight.js +31 -31
- package/Lights/directionalLight.js.map +1 -1
- package/Lights/light.js +72 -72
- package/Lights/light.js.map +1 -1
- package/Lights/pointLight.js +18 -18
- package/Lights/pointLight.js.map +1 -1
- package/Lights/spotLight.js +30 -30
- package/Lights/spotLight.js.map +1 -1
- package/Loading/sceneLoader.d.ts +1 -1
- package/Materials/Background/backgroundMaterial.js +124 -124
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js +8 -8
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.js +14 -14
- package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +9 -9
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/textureBlock.js +26 -26
- package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Input/inputBlock.js +34 -34
- package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +14 -14
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/reflectionBlock.js +16 -16
- package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/customBlock.js +7 -7
- package/Materials/Node/Blocks/customBlock.js.map +1 -1
- package/Materials/Node/Blocks/gradientBlock.js +13 -13
- package/Materials/Node/Blocks/gradientBlock.js.map +1 -1
- package/Materials/Node/Blocks/triPlanarBlock.js +30 -30
- package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +1 -1
- package/Materials/Node/nodeMaterial.js +60 -60
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBlock.js +35 -35
- package/Materials/Node/nodeMaterialBlock.js.map +1 -1
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js +50 -50
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
- package/Materials/PBR/pbrAnisotropicConfiguration.js +5 -5
- package/Materials/PBR/pbrAnisotropicConfiguration.js.map +1 -1
- package/Materials/PBR/pbrBRDFConfiguration.js +4 -4
- package/Materials/PBR/pbrBRDFConfiguration.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +52 -52
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/PBR/pbrBaseSimpleMaterial.js +17 -17
- package/Materials/PBR/pbrBaseSimpleMaterial.js.map +1 -1
- package/Materials/PBR/pbrClearCoatConfiguration.js +5 -5
- package/Materials/PBR/pbrClearCoatConfiguration.js.map +1 -1
- package/Materials/PBR/pbrIridescenceConfiguration.js +5 -5
- package/Materials/PBR/pbrIridescenceConfiguration.js.map +1 -1
- package/Materials/PBR/pbrMaterial.js +209 -209
- package/Materials/PBR/pbrMaterial.js.map +1 -1
- package/Materials/PBR/pbrSheenConfiguration.js +5 -5
- package/Materials/PBR/pbrSheenConfiguration.js.map +1 -1
- package/Materials/PBR/pbrSpecularGlossinessMaterial.js +6 -6
- package/Materials/PBR/pbrSpecularGlossinessMaterial.js.map +1 -1
- package/Materials/PBR/pbrSubSurfaceConfiguration.js +51 -51
- package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
- package/Materials/Textures/baseTexture.js +99 -99
- package/Materials/Textures/baseTexture.js.map +1 -1
- package/Materials/Textures/cubeTexture.js +61 -61
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Materials/Textures/externalTexture.js +16 -16
- package/Materials/Textures/externalTexture.js.map +1 -1
- package/Materials/Textures/hdrCubeTexture.js +44 -44
- package/Materials/Textures/hdrCubeTexture.js.map +1 -1
- package/Materials/Textures/internalTexture.js +31 -31
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/Textures/mirrorTexture.js +73 -73
- package/Materials/Textures/mirrorTexture.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.js +47 -47
- package/Materials/Textures/multiRenderTarget.js.map +1 -1
- package/Materials/Textures/rawTexture2DArray.js +6 -6
- package/Materials/Textures/rawTexture2DArray.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.js +142 -142
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/texture.d.ts +1 -1
- package/Materials/Textures/texture.js +26 -26
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/Textures/textureCreationOptions.d.ts +1 -1
- package/Materials/Textures/textureSampler.js +20 -20
- package/Materials/Textures/textureSampler.js.map +1 -1
- package/Materials/Textures/thinRenderTargetTexture.js +6 -6
- package/Materials/Textures/thinRenderTargetTexture.js.map +1 -1
- package/Materials/Textures/thinTexture.js +39 -39
- package/Materials/Textures/thinTexture.js.map +1 -1
- package/Materials/Textures/videoTexture.js +40 -40
- package/Materials/Textures/videoTexture.js.map +1 -1
- package/Materials/drawWrapper.js +6 -6
- package/Materials/drawWrapper.js.map +1 -1
- package/Materials/effect.js +18 -18
- package/Materials/effect.js.map +1 -1
- package/Materials/effectRenderer.js +9 -9
- package/Materials/effectRenderer.js.map +1 -1
- package/Materials/fresnelParameters.d.ts +2 -2
- package/Materials/fresnelParameters.js +13 -13
- package/Materials/fresnelParameters.js.map +1 -1
- package/Materials/material.detailMapConfiguration.js +5 -5
- package/Materials/material.detailMapConfiguration.js.map +1 -1
- package/Materials/material.js +223 -223
- package/Materials/material.js.map +1 -1
- package/Materials/materialPluginBase.js +5 -5
- package/Materials/materialPluginBase.js.map +1 -1
- package/Materials/materialPluginEvent.d.ts +14 -14
- package/Materials/materialPluginManager.d.ts +1 -1
- package/Materials/multiMaterial.js +16 -16
- package/Materials/multiMaterial.js.map +1 -1
- package/Materials/shadowDepthWrapper.js +14 -14
- package/Materials/shadowDepthWrapper.js.map +1 -1
- package/Materials/standardMaterial.js +100 -100
- package/Materials/standardMaterial.js.map +1 -1
- package/Materials/uniformBufferEffectCommonAccessor.js +3 -3
- package/Materials/uniformBufferEffectCommonAccessor.js.map +1 -1
- package/Maths/math.functions.js +2 -0
- package/Maths/math.functions.js.map +1 -1
- package/Maths/math.path.js +11 -11
- package/Maths/math.path.js.map +1 -1
- package/Maths/math.vector.d.ts +6 -7
- package/Maths/math.vector.js +48 -48
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Builders/goldbergBuilder.d.ts +2 -2
- package/Meshes/Compression/dracoCompression.js +23 -23
- package/Meshes/Compression/dracoCompression.js.map +1 -1
- package/Meshes/Compression/meshoptCompression.js +9 -9
- package/Meshes/Compression/meshoptCompression.js.map +1 -1
- package/Meshes/abstractMesh.js +179 -179
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/geometry.js +32 -32
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/goldbergMesh.d.ts +1 -1
- package/Meshes/linesMesh.js +3 -3
- package/Meshes/linesMesh.js.map +1 -1
- package/Meshes/mesh.js +165 -165
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/mesh.vertexData.js.map +1 -1
- package/Meshes/polygonMesh.js +5 -5
- package/Meshes/polygonMesh.js.map +1 -1
- package/Meshes/subMesh.js +59 -59
- package/Meshes/subMesh.js.map +1 -1
- package/Meshes/transformNode.js +52 -52
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/PerformanceViewer/performanceViewerCollectionStrategies.d.ts +1 -1
- package/Misc/PerformanceViewer/performanceViewerCollector.js +12 -12
- package/Misc/PerformanceViewer/performanceViewerCollector.js.map +1 -1
- package/Misc/arrayTools.d.ts +1 -1
- package/Misc/copyTextureToTexture.js +3 -3
- package/Misc/copyTextureToTexture.js.map +1 -1
- package/Misc/coroutine.d.ts +5 -5
- package/Misc/deferred.js +9 -9
- package/Misc/deferred.js.map +1 -1
- package/Misc/depthReducer.js +7 -7
- package/Misc/depthReducer.js.map +1 -1
- package/Misc/environmentTextureTools.d.ts +1 -1
- package/Misc/error.d.ts +1 -1
- package/Misc/fileTools.d.ts +5 -5
- package/Misc/filesInput.js +6 -6
- package/Misc/filesInput.js.map +1 -1
- package/Misc/khronosTextureContainer2.js +9 -9
- package/Misc/khronosTextureContainer2.js.map +1 -1
- package/Misc/observable.js +12 -12
- package/Misc/observable.js.map +1 -1
- package/Misc/perfCounter.js +16 -16
- package/Misc/perfCounter.js.map +1 -1
- package/Misc/sceneOptimizer.js +76 -76
- package/Misc/sceneOptimizer.js.map +1 -1
- package/Misc/stringDictionary.d.ts +1 -1
- package/Misc/trajectoryClassifier.js +67 -67
- package/Misc/trajectoryClassifier.js.map +1 -1
- package/Misc/videoRecorder.js +15 -15
- package/Misc/videoRecorder.js.map +1 -1
- package/Misc/virtualJoystick.js +12 -12
- package/Misc/virtualJoystick.js.map +1 -1
- package/Morph/morphTarget.js +28 -28
- package/Morph/morphTarget.js.map +1 -1
- package/Morph/morphTargetManager.js +18 -18
- package/Morph/morphTargetManager.js.map +1 -1
- package/Offline/database.js +12 -12
- package/Offline/database.js.map +1 -1
- package/Particles/EmitterTypes/coneParticleEmitter.js +25 -25
- package/Particles/EmitterTypes/coneParticleEmitter.js.map +1 -1
- package/Particles/EmitterTypes/meshParticleEmitter.js +20 -20
- package/Particles/EmitterTypes/meshParticleEmitter.js.map +1 -1
- package/Particles/baseParticleSystem.js +232 -232
- package/Particles/baseParticleSystem.js.map +1 -1
- package/Particles/cloudPoint.js +9 -9
- package/Particles/cloudPoint.js.map +1 -1
- package/Particles/gpuParticleSystem.js +123 -123
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particleSystem.js +102 -102
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/pointsCloudSystem.js +18 -18
- package/Particles/pointsCloudSystem.js.map +1 -1
- package/Particles/solidParticle.js +23 -23
- package/Particles/solidParticle.js.map +1 -1
- package/Physics/v1/physicsEngine.js +14 -14
- package/Physics/v1/physicsEngine.js.map +1 -1
- package/Physics/v1/physicsImpostor.js +149 -149
- package/Physics/v1/physicsImpostor.js.map +1 -1
- package/Physics/v2/physicsEngine.js +14 -14
- package/Physics/v2/physicsEngine.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +129 -129
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +68 -68
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js +6 -6
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js +226 -225
- package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js +10 -10
- package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js.map +1 -1
- package/PostProcesses/anaglyphPostProcess.js +7 -7
- package/PostProcesses/anaglyphPostProcess.js.map +1 -1
- package/PostProcesses/blackAndWhitePostProcess.js +7 -7
- package/PostProcesses/blackAndWhitePostProcess.js.map +1 -1
- package/PostProcesses/bloomEffect.js +28 -28
- package/PostProcesses/bloomEffect.js.map +1 -1
- package/PostProcesses/bloomMergePostProcess.js +7 -7
- package/PostProcesses/bloomMergePostProcess.js.map +1 -1
- package/PostProcesses/blurPostProcess.js +32 -32
- package/PostProcesses/blurPostProcess.js.map +1 -1
- package/PostProcesses/chromaticAberrationPostProcess.js +7 -7
- package/PostProcesses/chromaticAberrationPostProcess.js.map +1 -1
- package/PostProcesses/circleOfConfusionPostProcess.js +7 -7
- package/PostProcesses/circleOfConfusionPostProcess.js.map +1 -1
- package/PostProcesses/colorCorrectionPostProcess.js +7 -7
- package/PostProcesses/colorCorrectionPostProcess.js.map +1 -1
- package/PostProcesses/convolutionPostProcess.js +7 -7
- package/PostProcesses/convolutionPostProcess.js.map +1 -1
- package/PostProcesses/depthOfFieldBlurPostProcess.js +7 -7
- package/PostProcesses/depthOfFieldBlurPostProcess.js.map +1 -1
- package/PostProcesses/depthOfFieldEffect.js +36 -36
- package/PostProcesses/depthOfFieldEffect.js.map +1 -1
- package/PostProcesses/depthOfFieldMergePostProcess.js +7 -7
- package/PostProcesses/depthOfFieldMergePostProcess.js.map +1 -1
- package/PostProcesses/extractHighlightsPostProcess.js +7 -7
- package/PostProcesses/extractHighlightsPostProcess.js.map +1 -1
- package/PostProcesses/filterPostProcess.js +7 -7
- package/PostProcesses/filterPostProcess.js.map +1 -1
- package/PostProcesses/grainPostProcess.js +7 -7
- package/PostProcesses/grainPostProcess.js.map +1 -1
- package/PostProcesses/imageProcessingPostProcess.js +42 -42
- package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
- package/PostProcesses/motionBlurPostProcess.js +41 -41
- package/PostProcesses/motionBlurPostProcess.js.map +1 -1
- package/PostProcesses/passPostProcess.js +15 -15
- package/PostProcesses/passPostProcess.js.map +1 -1
- package/PostProcesses/postProcess.d.ts +2 -2
- package/PostProcesses/postProcess.js +123 -123
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/refractionPostProcess.js +21 -21
- package/PostProcesses/refractionPostProcess.js.map +1 -1
- package/PostProcesses/screenSpaceCurvaturePostProcess.js +7 -7
- package/PostProcesses/screenSpaceCurvaturePostProcess.js.map +1 -1
- package/PostProcesses/screenSpaceReflectionPostProcess.js +19 -19
- package/PostProcesses/screenSpaceReflectionPostProcess.js.map +1 -1
- package/PostProcesses/sharpenPostProcess.js +7 -7
- package/PostProcesses/sharpenPostProcess.js.map +1 -1
- package/PostProcesses/stereoscopicInterlacePostProcess.js +14 -14
- package/PostProcesses/stereoscopicInterlacePostProcess.js.map +1 -1
- package/PostProcesses/tonemapPostProcess.js +7 -7
- package/PostProcesses/tonemapPostProcess.js.map +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.js +11 -11
- package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
- package/PostProcesses/vrDistortionCorrectionPostProcess.js +7 -7
- package/PostProcesses/vrDistortionCorrectionPostProcess.js.map +1 -1
- package/Rendering/depthPeelingRenderer.js +36 -36
- package/Rendering/depthPeelingRenderer.js.map +1 -1
- package/Rendering/depthRenderer.js +8 -8
- package/Rendering/depthRenderer.js.map +1 -1
- package/Rendering/edgesRenderer.js +34 -34
- package/Rendering/edgesRenderer.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderer.js +8 -8
- package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.js +3 -3
- package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObject.js +19 -19
- package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js +12 -12
- package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js +18 -18
- package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js +68 -68
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingTextures.js +29 -29
- package/Rendering/fluidRenderer/fluidRenderingTextures.js.map +1 -1
- package/Rendering/geometryBufferRenderer.js +44 -44
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Rendering/prePassRenderer.js +51 -51
- package/Rendering/prePassRenderer.js.map +1 -1
- package/Rendering/renderingGroup.js +25 -25
- package/Rendering/renderingGroup.js.map +1 -1
- package/Rendering/renderingManager.js +21 -21
- package/Rendering/renderingManager.js.map +1 -1
- package/Rendering/subSurfaceConfiguration.js +18 -18
- package/Rendering/subSurfaceConfiguration.js.map +1 -1
- package/Rendering/utilityLayerRenderer.js +76 -76
- package/Rendering/utilityLayerRenderer.js.map +1 -1
- package/Sprites/sprite.js +16 -16
- package/Sprites/sprite.js.map +1 -1
- package/Sprites/spriteManager.js +81 -81
- package/Sprites/spriteManager.js.map +1 -1
- package/Sprites/spriteMap.js +32 -32
- package/Sprites/spriteMap.js.map +1 -1
- package/Sprites/spriteRenderer.js +6 -6
- package/Sprites/spriteRenderer.js.map +1 -1
- package/Sprites/thinSprite.js +22 -22
- package/Sprites/thinSprite.js.map +1 -1
- package/States/stencilStateComposer.js +10 -10
- package/States/stencilStateComposer.js.map +1 -1
- package/XR/features/WebXRAnchorSystem.js +7 -7
- package/XR/features/WebXRAnchorSystem.js.map +1 -1
- package/XR/features/WebXRControllerMovement.d.ts +3 -3
- package/XR/features/WebXRControllerMovement.js +97 -97
- package/XR/features/WebXRControllerMovement.js.map +1 -1
- package/XR/features/WebXRControllerPhysics.js +24 -24
- package/XR/features/WebXRControllerPhysics.js.map +1 -1
- package/XR/features/WebXRControllerTeleportation.js +26 -26
- package/XR/features/WebXRControllerTeleportation.js.map +1 -1
- package/XR/features/WebXRDOMOverlay.d.ts +1 -1
- package/XR/features/WebXRFeaturePointSystem.js +6 -6
- package/XR/features/WebXRFeaturePointSystem.js.map +1 -1
- package/XR/features/WebXRHandTracking.d.ts +1 -1
- package/XR/features/WebXRHandTracking.js +95 -95
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/XR/features/WebXRWalkingLocomotion.js +21 -21
- package/XR/features/WebXRWalkingLocomotion.js.map +1 -1
- package/XR/motionController/webXRAbstractMotionController.d.ts +3 -3
- package/XR/motionController/webXRMotionControllerManager.d.ts +1 -1
- package/XR/native/nativeXRFrame.js +3 -3
- package/XR/native/nativeXRFrame.js.map +1 -1
- package/XR/webXRFeaturesManager.d.ts +1 -1
- package/XR/webXRLayerWrapper.d.ts +2 -2
- package/XR/webXRLayerWrapper.js +17 -17
- package/XR/webXRLayerWrapper.js.map +1 -1
- package/abstractScene.d.ts +2 -2
- package/node.d.ts +1 -1
- package/node.js +71 -71
- package/node.js.map +1 -1
- package/package.json +1 -1
- package/scene.js +777 -777
- package/scene.js.map +1 -1
- package/sceneComponent.d.ts +12 -12
- package/types.d.ts +11 -11
package/Lights/pointLight.js
CHANGED
|
@@ -14,24 +14,6 @@ Node.AddNodeConstructor("Light_Type_0", (name, scene) => {
|
|
|
14
14
|
* Documentation: https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction
|
|
15
15
|
*/
|
|
16
16
|
export class PointLight extends ShadowLight {
|
|
17
|
-
/**
|
|
18
|
-
* Creates a PointLight object from the passed name and position (Vector3) and adds it in the scene.
|
|
19
|
-
* A PointLight emits the light in every direction.
|
|
20
|
-
* It can cast shadows.
|
|
21
|
-
* If the scene camera is already defined and you want to set your PointLight at the camera position, just set it :
|
|
22
|
-
* ```javascript
|
|
23
|
-
* var pointLight = new PointLight("pl", camera.position, scene);
|
|
24
|
-
* ```
|
|
25
|
-
* Documentation : https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction
|
|
26
|
-
* @param name The light friendly name
|
|
27
|
-
* @param position The position of the point light in the scene
|
|
28
|
-
* @param scene The scene the lights belongs to
|
|
29
|
-
*/
|
|
30
|
-
constructor(name, position, scene) {
|
|
31
|
-
super(name, scene);
|
|
32
|
-
this._shadowAngle = Math.PI / 2;
|
|
33
|
-
this.position = position;
|
|
34
|
-
}
|
|
35
17
|
/**
|
|
36
18
|
* Getter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback
|
|
37
19
|
* This specifies what angle the shadow will use to be created.
|
|
@@ -72,6 +54,24 @@ export class PointLight extends ShadowLight {
|
|
|
72
54
|
}
|
|
73
55
|
}
|
|
74
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Creates a PointLight object from the passed name and position (Vector3) and adds it in the scene.
|
|
59
|
+
* A PointLight emits the light in every direction.
|
|
60
|
+
* It can cast shadows.
|
|
61
|
+
* If the scene camera is already defined and you want to set your PointLight at the camera position, just set it :
|
|
62
|
+
* ```javascript
|
|
63
|
+
* var pointLight = new PointLight("pl", camera.position, scene);
|
|
64
|
+
* ```
|
|
65
|
+
* Documentation : https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction
|
|
66
|
+
* @param name The light friendly name
|
|
67
|
+
* @param position The position of the point light in the scene
|
|
68
|
+
* @param scene The scene the lights belongs to
|
|
69
|
+
*/
|
|
70
|
+
constructor(name, position, scene) {
|
|
71
|
+
super(name, scene);
|
|
72
|
+
this._shadowAngle = Math.PI / 2;
|
|
73
|
+
this.position = position;
|
|
74
|
+
}
|
|
75
75
|
/**
|
|
76
76
|
* Returns the string "PointLight"
|
|
77
77
|
* @returns the class name
|
package/Lights/pointLight.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pointLight.js","sourceRoot":"","sources":["../../../../lts/core/generated/Lights/pointLight.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;IACpD,OAAO,GAAG,EAAE,CAAC,IAAI,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;AAC7D,CAAC,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,OAAO,UAAW,SAAQ,WAAW;IA8CvC;;;;;;;;;;;;OAYG;IACH,YAAY,IAAY,EAAE,QAAiB,EAAE,KAAY;QACrD,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QA3Df,iBAAY,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QA4D/B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;IA5DD;;;;;OAKG;IAEH,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IACD;;;;;OAKG;IACH,IAAW,WAAW,CAAC,KAAa;QAChC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,4BAA4B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AAC,CAAC;QAC3G,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,4BAA4B,CAAC,MAAc,EAAE,oBAA4B;QAC5E,IAAI,IAAI,CAAC,6BAA6B,EAAE,EAAE;YACtC,MAAM,CAAC,SAAS,CAAC,oBAAoB,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;SAC9H;aAAM;YACH,MAAM,CAAC,SAAS,CAAC,oBAAoB,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;SAC7F;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACI,2BAA2B,CAAC,OAAY,EAAE,UAAkB;QAC/D,OAAO,CAAC,YAAY,GAAG,UAAU,CAAC,GAAG,IAAI,CAAC;IAC9C,CAAC;CACJ;AA5LG;IADC,SAAS,EAAE;6CAGX","sourcesContent":["import { serialize } from \"../Misc/decorators\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Matrix, Vector3 } from \"../Maths/math.vector\";\r\nimport { Node } from \"../node\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Light } from \"./light\";\r\nimport { ShadowLight } from \"./shadowLight\";\r\nimport type { Effect } from \"../Materials/effect\";\r\n\r\nNode.AddNodeConstructor(\"Light_Type_0\", (name, scene) => {\r\n return () => new PointLight(name, Vector3.Zero(), scene);\r\n});\r\n\r\n/**\r\n * A point light is a light defined by an unique point in world space.\r\n * The light is emitted in every direction from this point.\r\n * A good example of a point light is a standard light bulb.\r\n * Documentation: https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\r\n */\r\nexport class PointLight extends ShadowLight {\r\n private _shadowAngle = Math.PI / 2;\r\n /**\r\n * Getter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n * This specifies what angle the shadow will use to be created.\r\n *\r\n * It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.\r\n */\r\n @serialize()\r\n public get shadowAngle(): number {\r\n return this._shadowAngle;\r\n }\r\n /**\r\n * Setter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n * This specifies what angle the shadow will use to be created.\r\n *\r\n * It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.\r\n */\r\n public set shadowAngle(value: number) {\r\n this._shadowAngle = value;\r\n this.forceProjectionMatrixCompute();\r\n }\r\n\r\n /**\r\n * Gets the direction if it has been set.\r\n * In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n */\r\n public get direction(): Vector3 {\r\n return this._direction;\r\n }\r\n\r\n /**\r\n * In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n */\r\n public set direction(value: Vector3) {\r\n const previousNeedCube = this.needCube();\r\n this._direction = value;\r\n if (this.needCube() !== previousNeedCube && this._shadowGenerators) {\r\n const iterator = this._shadowGenerators.values();\r\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\r\n const shadowGenerator = key.value;\r\n shadowGenerator.recreateShadowMap();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Creates a PointLight object from the passed name and position (Vector3) and adds it in the scene.\r\n * A PointLight emits the light in every direction.\r\n * It can cast shadows.\r\n * If the scene camera is already defined and you want to set your PointLight at the camera position, just set it :\r\n * ```javascript\r\n * var pointLight = new PointLight(\"pl\", camera.position, scene);\r\n * ```\r\n * Documentation : https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\r\n * @param name The light friendly name\r\n * @param position The position of the point light in the scene\r\n * @param scene The scene the lights belongs to\r\n */\r\n constructor(name: string, position: Vector3, scene: Scene) {\r\n super(name, scene);\r\n this.position = position;\r\n }\r\n\r\n /**\r\n * Returns the string \"PointLight\"\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"PointLight\";\r\n }\r\n\r\n /**\r\n * Returns the integer 0.\r\n * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n public getTypeID(): number {\r\n return Light.LIGHTTYPEID_POINTLIGHT;\r\n }\r\n\r\n /**\r\n * Specifies whether or not the shadowmap should be a cube texture.\r\n * @returns true if the shadowmap needs to be a cube texture.\r\n */\r\n public needCube(): boolean {\r\n return !this.direction;\r\n }\r\n\r\n /**\r\n * Returns a new Vector3 aligned with the PointLight cube system according to the passed cube face index (integer).\r\n * @param faceIndex The index of the face we are computed the direction to generate shadow\r\n * @returns The set direction in 2d mode otherwise the direction to the cubemap face if needCube() is true\r\n */\r\n public getShadowDirection(faceIndex?: number): Vector3 {\r\n if (this.direction) {\r\n return super.getShadowDirection(faceIndex);\r\n } else {\r\n switch (faceIndex) {\r\n case 0:\r\n return new Vector3(1.0, 0.0, 0.0);\r\n case 1:\r\n return new Vector3(-1.0, 0.0, 0.0);\r\n case 2:\r\n return new Vector3(0.0, -1.0, 0.0);\r\n case 3:\r\n return new Vector3(0.0, 1.0, 0.0);\r\n case 4:\r\n return new Vector3(0.0, 0.0, 1.0);\r\n case 5:\r\n return new Vector3(0.0, 0.0, -1.0);\r\n }\r\n }\r\n\r\n return Vector3.Zero();\r\n }\r\n\r\n /**\r\n * Sets the passed matrix \"matrix\" as a left-handed perspective projection matrix with the following settings :\r\n * - fov = PI / 2\r\n * - aspect ratio : 1.0\r\n * - z-near and far equal to the active camera minZ and maxZ.\r\n * Returns the PointLight.\r\n * @param matrix\r\n * @param viewMatrix\r\n * @param renderList\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _setDefaultShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void {\r\n const activeCamera = this.getScene().activeCamera;\r\n\r\n if (!activeCamera) {\r\n return;\r\n }\r\n\r\n const minZ = this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ;\r\n const maxZ = this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ;\r\n\r\n const useReverseDepthBuffer = this.getScene().getEngine().useReverseDepthBuffer;\r\n\r\n Matrix.PerspectiveFovLHToRef(\r\n this.shadowAngle,\r\n 1.0,\r\n useReverseDepthBuffer ? maxZ : minZ,\r\n useReverseDepthBuffer ? minZ : maxZ,\r\n matrix,\r\n true,\r\n this._scene.getEngine().isNDCHalfZRange,\r\n undefined,\r\n useReverseDepthBuffer\r\n );\r\n }\r\n\r\n protected _buildUniformLayout(): void {\r\n this._uniformBuffer.addUniform(\"vLightData\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\r\n this._uniformBuffer.addUniform(\"vLightSpecular\", 4);\r\n this._uniformBuffer.addUniform(\"vLightFalloff\", 4);\r\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\r\n this._uniformBuffer.addUniform(\"depthValues\", 2);\r\n this._uniformBuffer.create();\r\n }\r\n\r\n /**\r\n * Sets the passed Effect \"effect\" with the PointLight transformed position (or position, if none) and passed name (string).\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The point light\r\n */\r\n public transferToEffect(effect: Effect, lightIndex: string): PointLight {\r\n if (this.computeTransformedInformation()) {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, 0.0, lightIndex);\r\n } else {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.position.x, this.position.y, this.position.z, 0, lightIndex);\r\n }\r\n\r\n this._uniformBuffer.updateFloat4(\"vLightFalloff\", this.range, this._inverseSquaredRange, 0, 0, lightIndex);\r\n return this;\r\n }\r\n\r\n public transferToNodeMaterialEffect(effect: Effect, lightDataUniformName: string) {\r\n if (this.computeTransformedInformation()) {\r\n effect.setFloat3(lightDataUniformName, this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z);\r\n } else {\r\n effect.setFloat3(lightDataUniformName, this.position.x, this.position.y, this.position.z);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Prepares the list of defines specific to the light type.\r\n * @param defines the list of defines\r\n * @param lightIndex defines the index of the light for the effect\r\n */\r\n public prepareLightSpecificDefines(defines: any, lightIndex: number): void {\r\n defines[\"POINTLIGHT\" + lightIndex] = true;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"pointLight.js","sourceRoot":"","sources":["../../../../lts/core/generated/Lights/pointLight.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;IACpD,OAAO,GAAG,EAAE,CAAC,IAAI,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;AAC7D,CAAC,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,OAAO,UAAW,SAAQ,WAAW;IAEvC;;;;;OAKG;IAEH,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IACD;;;;;OAKG;IACH,IAAW,WAAW,CAAC,KAAa;QAChC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,4BAA4B,EAAE,CAAC;IACxC,CAAC;IAED;;;OAGG;IACH,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,SAAS,CAAC,KAAc;QAC/B,MAAM,gBAAgB,GAAG,IAAI,C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C,oBAAoB,EAAE,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC;QAC3G,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,4BAA4B,CAAC,MAAc,EAAE,oBAA4B;QAC5E,IAAI,IAAI,CAAC,6BAA6B,EAAE,EAAE;YACtC,MAAM,CAAC,SAAS,CAAC,oBAAoB,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;SAC9H;aAAM;YACH,MAAM,CAAC,SAAS,CAAC,oBAAoB,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;SAC7F;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACI,2BAA2B,CAAC,OAAY,EAAE,UAAkB;QAC/D,OAAO,CAAC,YAAY,GAAG,UAAU,CAAC,GAAG,IAAI,CAAC;IAC9C,CAAC;CACJ;AA5LG;IADC,SAAS,EAAE;6CAGX","sourcesContent":["import { serialize } from \"../Misc/decorators\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Matrix, Vector3 } from \"../Maths/math.vector\";\r\nimport { Node } from \"../node\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Light } from \"./light\";\r\nimport { ShadowLight } from \"./shadowLight\";\r\nimport type { Effect } from \"../Materials/effect\";\r\n\r\nNode.AddNodeConstructor(\"Light_Type_0\", (name, scene) => {\r\n return () => new PointLight(name, Vector3.Zero(), scene);\r\n});\r\n\r\n/**\r\n * A point light is a light defined by an unique point in world space.\r\n * The light is emitted in every direction from this point.\r\n * A good example of a point light is a standard light bulb.\r\n * Documentation: https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\r\n */\r\nexport class PointLight extends ShadowLight {\r\n private _shadowAngle = Math.PI / 2;\r\n /**\r\n * Getter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n * This specifies what angle the shadow will use to be created.\r\n *\r\n * It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.\r\n */\r\n @serialize()\r\n public get shadowAngle(): number {\r\n return this._shadowAngle;\r\n }\r\n /**\r\n * Setter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n * This specifies what angle the shadow will use to be created.\r\n *\r\n * It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.\r\n */\r\n public set shadowAngle(value: number) {\r\n this._shadowAngle = value;\r\n this.forceProjectionMatrixCompute();\r\n }\r\n\r\n /**\r\n * Gets the direction if it has been set.\r\n * In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n */\r\n public get direction(): Vector3 {\r\n return this._direction;\r\n }\r\n\r\n /**\r\n * In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback\r\n */\r\n public set direction(value: Vector3) {\r\n const previousNeedCube = this.needCube();\r\n this._direction = value;\r\n if (this.needCube() !== previousNeedCube && this._shadowGenerators) {\r\n const iterator = this._shadowGenerators.values();\r\n for (let key = iterator.next(); key.done !== true; key = iterator.next()) {\r\n const shadowGenerator = key.value;\r\n shadowGenerator.recreateShadowMap();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Creates a PointLight object from the passed name and position (Vector3) and adds it in the scene.\r\n * A PointLight emits the light in every direction.\r\n * It can cast shadows.\r\n * If the scene camera is already defined and you want to set your PointLight at the camera position, just set it :\r\n * ```javascript\r\n * var pointLight = new PointLight(\"pl\", camera.position, scene);\r\n * ```\r\n * Documentation : https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\r\n * @param name The light friendly name\r\n * @param position The position of the point light in the scene\r\n * @param scene The scene the lights belongs to\r\n */\r\n constructor(name: string, position: Vector3, scene: Scene) {\r\n super(name, scene);\r\n this.position = position;\r\n }\r\n\r\n /**\r\n * Returns the string \"PointLight\"\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"PointLight\";\r\n }\r\n\r\n /**\r\n * Returns the integer 0.\r\n * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n public getTypeID(): number {\r\n return Light.LIGHTTYPEID_POINTLIGHT;\r\n }\r\n\r\n /**\r\n * Specifies whether or not the shadowmap should be a cube texture.\r\n * @returns true if the shadowmap needs to be a cube texture.\r\n */\r\n public needCube(): boolean {\r\n return !this.direction;\r\n }\r\n\r\n /**\r\n * Returns a new Vector3 aligned with the PointLight cube system according to the passed cube face index (integer).\r\n * @param faceIndex The index of the face we are computed the direction to generate shadow\r\n * @returns The set direction in 2d mode otherwise the direction to the cubemap face if needCube() is true\r\n */\r\n public getShadowDirection(faceIndex?: number): Vector3 {\r\n if (this.direction) {\r\n return super.getShadowDirection(faceIndex);\r\n } else {\r\n switch (faceIndex) {\r\n case 0:\r\n return new Vector3(1.0, 0.0, 0.0);\r\n case 1:\r\n return new Vector3(-1.0, 0.0, 0.0);\r\n case 2:\r\n return new Vector3(0.0, -1.0, 0.0);\r\n case 3:\r\n return new Vector3(0.0, 1.0, 0.0);\r\n case 4:\r\n return new Vector3(0.0, 0.0, 1.0);\r\n case 5:\r\n return new Vector3(0.0, 0.0, -1.0);\r\n }\r\n }\r\n\r\n return Vector3.Zero();\r\n }\r\n\r\n /**\r\n * Sets the passed matrix \"matrix\" as a left-handed perspective projection matrix with the following settings :\r\n * - fov = PI / 2\r\n * - aspect ratio : 1.0\r\n * - z-near and far equal to the active camera minZ and maxZ.\r\n * Returns the PointLight.\r\n * @param matrix\r\n * @param viewMatrix\r\n * @param renderList\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _setDefaultShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void {\r\n const activeCamera = this.getScene().activeCamera;\r\n\r\n if (!activeCamera) {\r\n return;\r\n }\r\n\r\n const minZ = this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ;\r\n const maxZ = this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ;\r\n\r\n const useReverseDepthBuffer = this.getScene().getEngine().useReverseDepthBuffer;\r\n\r\n Matrix.PerspectiveFovLHToRef(\r\n this.shadowAngle,\r\n 1.0,\r\n useReverseDepthBuffer ? maxZ : minZ,\r\n useReverseDepthBuffer ? minZ : maxZ,\r\n matrix,\r\n true,\r\n this._scene.getEngine().isNDCHalfZRange,\r\n undefined,\r\n useReverseDepthBuffer\r\n );\r\n }\r\n\r\n protected _buildUniformLayout(): void {\r\n this._uniformBuffer.addUniform(\"vLightData\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\r\n this._uniformBuffer.addUniform(\"vLightSpecular\", 4);\r\n this._uniformBuffer.addUniform(\"vLightFalloff\", 4);\r\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\r\n this._uniformBuffer.addUniform(\"depthValues\", 2);\r\n this._uniformBuffer.create();\r\n }\r\n\r\n /**\r\n * Sets the passed Effect \"effect\" with the PointLight transformed position (or position, if none) and passed name (string).\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The point light\r\n */\r\n public transferToEffect(effect: Effect, lightIndex: string): PointLight {\r\n if (this.computeTransformedInformation()) {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, 0.0, lightIndex);\r\n } else {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.position.x, this.position.y, this.position.z, 0, lightIndex);\r\n }\r\n\r\n this._uniformBuffer.updateFloat4(\"vLightFalloff\", this.range, this._inverseSquaredRange, 0, 0, lightIndex);\r\n return this;\r\n }\r\n\r\n public transferToNodeMaterialEffect(effect: Effect, lightDataUniformName: string) {\r\n if (this.computeTransformedInformation()) {\r\n effect.setFloat3(lightDataUniformName, this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z);\r\n } else {\r\n effect.setFloat3(lightDataUniformName, this.position.x, this.position.y, this.position.z);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Prepares the list of defines specific to the light type.\r\n * @param defines the list of defines\r\n * @param lightIndex defines the index of the light for the effect\r\n */\r\n public prepareLightSpecificDefines(defines: any, lightIndex: number): void {\r\n defines[\"POINTLIGHT\" + lightIndex] = true;\r\n }\r\n}\r\n"]}
|
package/Lights/spotLight.js
CHANGED
|
@@ -16,36 +16,6 @@ Node.AddNodeConstructor("Light_Type_2", (name, scene) => {
|
|
|
16
16
|
* Documentation: https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction
|
|
17
17
|
*/
|
|
18
18
|
export class SpotLight extends ShadowLight {
|
|
19
|
-
/**
|
|
20
|
-
* Creates a SpotLight object in the scene. A spot light is a simply light oriented cone.
|
|
21
|
-
* It can cast shadows.
|
|
22
|
-
* Documentation : https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction
|
|
23
|
-
* @param name The light friendly name
|
|
24
|
-
* @param position The position of the spot light in the scene
|
|
25
|
-
* @param direction The direction of the light in the scene
|
|
26
|
-
* @param angle The cone angle of the light in Radians
|
|
27
|
-
* @param exponent The light decay speed with the distance from the emission spot
|
|
28
|
-
* @param scene The scene the lights belongs to
|
|
29
|
-
*/
|
|
30
|
-
constructor(name, position, direction, angle, exponent, scene) {
|
|
31
|
-
super(name, scene);
|
|
32
|
-
this._innerAngle = 0;
|
|
33
|
-
this._projectionTextureMatrix = Matrix.Zero();
|
|
34
|
-
this._projectionTextureLightNear = 1e-6;
|
|
35
|
-
this._projectionTextureLightFar = 1000.0;
|
|
36
|
-
this._projectionTextureUpDirection = Vector3.Up();
|
|
37
|
-
this._projectionTextureViewLightDirty = true;
|
|
38
|
-
this._projectionTextureProjectionLightDirty = true;
|
|
39
|
-
this._projectionTextureDirty = true;
|
|
40
|
-
this._projectionTextureViewTargetVector = Vector3.Zero();
|
|
41
|
-
this._projectionTextureViewLightMatrix = Matrix.Zero();
|
|
42
|
-
this._projectionTextureProjectionLightMatrix = Matrix.Zero();
|
|
43
|
-
this._projectionTextureScalingMatrix = Matrix.FromValues(0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0);
|
|
44
|
-
this.position = position;
|
|
45
|
-
this.direction = direction;
|
|
46
|
-
this.angle = angle;
|
|
47
|
-
this.exponent = exponent;
|
|
48
|
-
}
|
|
49
19
|
/**
|
|
50
20
|
* Gets the cone angle of the spot light in Radians.
|
|
51
21
|
*/
|
|
@@ -182,6 +152,36 @@ export class SpotLight extends ShadowLight {
|
|
|
182
152
|
this._projectionTextureProjectionLightDirty = false;
|
|
183
153
|
this._projectionTextureDirty = true;
|
|
184
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* Creates a SpotLight object in the scene. A spot light is a simply light oriented cone.
|
|
157
|
+
* It can cast shadows.
|
|
158
|
+
* Documentation : https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction
|
|
159
|
+
* @param name The light friendly name
|
|
160
|
+
* @param position The position of the spot light in the scene
|
|
161
|
+
* @param direction The direction of the light in the scene
|
|
162
|
+
* @param angle The cone angle of the light in Radians
|
|
163
|
+
* @param exponent The light decay speed with the distance from the emission spot
|
|
164
|
+
* @param scene The scene the lights belongs to
|
|
165
|
+
*/
|
|
166
|
+
constructor(name, position, direction, angle, exponent, scene) {
|
|
167
|
+
super(name, scene);
|
|
168
|
+
this._innerAngle = 0;
|
|
169
|
+
this._projectionTextureMatrix = Matrix.Zero();
|
|
170
|
+
this._projectionTextureLightNear = 1e-6;
|
|
171
|
+
this._projectionTextureLightFar = 1000.0;
|
|
172
|
+
this._projectionTextureUpDirection = Vector3.Up();
|
|
173
|
+
this._projectionTextureViewLightDirty = true;
|
|
174
|
+
this._projectionTextureProjectionLightDirty = true;
|
|
175
|
+
this._projectionTextureDirty = true;
|
|
176
|
+
this._projectionTextureViewTargetVector = Vector3.Zero();
|
|
177
|
+
this._projectionTextureViewLightMatrix = Matrix.Zero();
|
|
178
|
+
this._projectionTextureProjectionLightMatrix = Matrix.Zero();
|
|
179
|
+
this._projectionTextureScalingMatrix = Matrix.FromValues(0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0);
|
|
180
|
+
this.position = position;
|
|
181
|
+
this.direction = direction;
|
|
182
|
+
this.angle = angle;
|
|
183
|
+
this.exponent = exponent;
|
|
184
|
+
}
|
|
185
185
|
/**
|
|
186
186
|
* Returns the string "SpotLight".
|
|
187
187
|
* @returns the class name
|
package/Lights/spotLight.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spotLight.js","sourceRoot":"","sources":["../../../../lts/core/generated/Lights/spotLight.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGnE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAI/B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAIxD,IAAI,CAAC,kBAAkB,CAAC,cAAc,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;IACpD,OAAO,GAAG,EAAE,CAAC,IAAI,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;AAClF,CAAC,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,OAAO,SAAU,SAAQ,WAAW;IAqMtC;;;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IAAI,CAAC;IAC9H,CAAC;IAED;;;;OAIG;IACI,YAAY,CAAC,YAAoB;QACpC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;QACvC,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC;QAEjF,OAAO,MAAM,CAAC,qBAAqB,IAAI,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7E,CAAC;IAED;;;;OAIG;IACI,2BAA2B,CAAC,OAAY,EAAE,UAAkB;QAC/D,OAAO,CAAC,WAAW,GAAG,UAAU,CAAC,GAAG,IAAI,CAAC;QACzC,OAAO,CAAC,uBAAuB,GAAG,UAAU,CAAC,GAAG,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IAC9H,CAAC;CACJ;AAzaG;IADC,SAAS,EAAE;sCAGX;AAkBD;IADC,SAAS,EAAE;2CAGX;AAgBD;IADC,SAAS,EAAE;iDAGX;AAaD;IADC,SAAS,EAAE;2CACY;AAexB;IADC,SAAS,EAAE;2DAGX;AAcD;IADC,SAAS,EAAE;0DAGX;AAcD;IADC,SAAS,EAAE;6DAGX;AAUD;IADC,kBAAkB,CAAC,uBAAuB,CAAC;qDACM","sourcesContent":["import { serialize, serializeAsTexture } from \"../Misc/decorators\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Matrix, Vector3 } from \"../Maths/math.vector\";\r\nimport { Node } from \"../node\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport { Light } from \"./light\";\r\nimport { ShadowLight } from \"./shadowLight\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport type { ProceduralTexture } from \"../Materials/Textures/Procedurals/proceduralTexture\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\n\r\nNode.AddNodeConstructor(\"Light_Type_2\", (name, scene) => {\r\n return () => new SpotLight(name, Vector3.Zero(), Vector3.Zero(), 0, 0, scene);\r\n});\r\n\r\n/**\r\n * A spot light is defined by a position, a direction, an angle, and an exponent.\r\n * These values define a cone of light starting from the position, emitting toward the direction.\r\n * The angle, in radians, defines the size (field of illumination) of the spotlight's conical beam,\r\n * and the exponent defines the speed of the decay of the light with distance (reach).\r\n * Documentation: https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\r\n */\r\nexport class SpotLight extends ShadowLight {\r\n /*\r\n upVector , rightVector and direction will form the coordinate system for this spot light.\r\n These three vectors will be used as projection matrix when doing texture projection.\r\n\r\n Also we have the following rules always holds:\r\n direction cross up = right\r\n right cross direction = up\r\n up cross right = forward\r\n\r\n light_near and light_far will control the range of the texture projection. If a plane is\r\n out of the range in spot light space, there is no texture projection.\r\n */\r\n\r\n private _angle: number;\r\n private _innerAngle: number = 0;\r\n private _cosHalfAngle: number;\r\n\r\n private _lightAngleScale: number;\r\n private _lightAngleOffset: number;\r\n\r\n /**\r\n * Gets the cone angle of the spot light in Radians.\r\n */\r\n @serialize()\r\n public get angle(): number {\r\n return this._angle;\r\n }\r\n /**\r\n * Sets the cone angle of the spot light in Radians.\r\n */\r\n public set angle(value: number) {\r\n this._angle = value;\r\n this._cosHalfAngle = Math.cos(value * 0.5);\r\n this._projectionTextureProjectionLightDirty = true;\r\n this.forceProjectionMatrixCompute();\r\n this._computeAngleValues();\r\n }\r\n\r\n /**\r\n * Only used in gltf falloff mode, this defines the angle where\r\n * the directional falloff will start before cutting at angle which could be seen\r\n * as outer angle.\r\n */\r\n @serialize()\r\n public get innerAngle(): number {\r\n return this._innerAngle;\r\n }\r\n /**\r\n * Only used in gltf falloff mode, this defines the angle where\r\n * the directional falloff will start before cutting at angle which could be seen\r\n * as outer angle.\r\n */\r\n public set innerAngle(value: number) {\r\n this._innerAngle = value;\r\n this._computeAngleValues();\r\n }\r\n\r\n private _shadowAngleScale: number;\r\n /**\r\n * Allows scaling the angle of the light for shadow generation only.\r\n */\r\n @serialize()\r\n public get shadowAngleScale(): number {\r\n return this._shadowAngleScale;\r\n }\r\n /**\r\n * Allows scaling the angle of the light for shadow generation only.\r\n */\r\n public set shadowAngleScale(value: number) {\r\n this._shadowAngleScale = value;\r\n this.forceProjectionMatrixCompute();\r\n }\r\n\r\n /**\r\n * The light decay speed with the distance from the emission spot.\r\n */\r\n @serialize()\r\n public exponent: number;\r\n\r\n private _projectionTextureMatrix = Matrix.Zero();\r\n /**\r\n * Allows reading the projection texture\r\n */\r\n public get projectionTextureMatrix(): Matrix {\r\n return this._projectionTextureMatrix;\r\n }\r\n\r\n protected _projectionTextureLightNear: number = 1e-6;\r\n /**\r\n * Gets the near clip of the Spotlight for texture projection.\r\n */\r\n @serialize()\r\n public get projectionTextureLightNear(): number {\r\n return this._projectionTextureLightNear;\r\n }\r\n /**\r\n * Sets the near clip of the Spotlight for texture projection.\r\n */\r\n public set projectionTextureLightNear(value: number) {\r\n this._projectionTextureLightNear = value;\r\n this._projectionTextureProjectionLightDirty = true;\r\n }\r\n\r\n protected _projectionTextureLightFar: number = 1000.0;\r\n /**\r\n * Gets the far clip of the Spotlight for texture projection.\r\n */\r\n @serialize()\r\n public get projectionTextureLightFar(): number {\r\n return this._projectionTextureLightFar;\r\n }\r\n /**\r\n * Sets the far clip of the Spotlight for texture projection.\r\n */\r\n public set projectionTextureLightFar(value: number) {\r\n this._projectionTextureLightFar = value;\r\n this._projectionTextureProjectionLightDirty = true;\r\n }\r\n\r\n protected _projectionTextureUpDirection: Vector3 = Vector3.Up();\r\n /**\r\n * Gets the Up vector of the Spotlight for texture projection.\r\n */\r\n @serialize()\r\n public get projectionTextureUpDirection(): Vector3 {\r\n return this._projectionTextureUpDirection;\r\n }\r\n /**\r\n * Sets the Up vector of the Spotlight for texture projection.\r\n */\r\n public set projectionTextureUpDirection(value: Vector3) {\r\n this._projectionTextureUpDirection = value;\r\n this._projectionTextureProjectionLightDirty = true;\r\n }\r\n\r\n @serializeAsTexture(\"projectedLightTexture\")\r\n private _projectionTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Gets the projection texture of the light.\r\n */\r\n public get projectionTexture(): Nullable<BaseTexture> {\r\n return this._projectionTexture;\r\n }\r\n /**\r\n * Sets the projection texture of the light.\r\n */\r\n public set projectionTexture(value: Nullable<BaseTexture>) {\r\n if (this._projectionTexture === value) {\r\n return;\r\n }\r\n this._projectionTexture = value;\r\n this._projectionTextureDirty = true;\r\n if (this._projectionTexture && !this._projectionTexture.isReady()) {\r\n if (SpotLight._IsProceduralTexture(this._projectionTexture)) {\r\n this._projectionTexture.getEffect().executeWhenCompiled(() => {\r\n this._markMeshesAsLightDirty();\r\n });\r\n } else if (SpotLight._IsTexture(this._projectionTexture)) {\r\n this._projectionTexture.onLoadObservable.addOnce(() => {\r\n this._markMeshesAsLightDirty();\r\n });\r\n }\r\n }\r\n }\r\n\r\n private static _IsProceduralTexture(texture: BaseTexture): texture is ProceduralTexture {\r\n return (texture as ProceduralTexture).onGeneratedObservable !== undefined;\r\n }\r\n\r\n private static _IsTexture(texture: BaseTexture): texture is Texture {\r\n return (texture as Texture).onLoadObservable !== undefined;\r\n }\r\n\r\n private _projectionTextureViewLightDirty = true;\r\n private _projectionTextureProjectionLightDirty = true;\r\n private _projectionTextureDirty = true;\r\n private _projectionTextureViewTargetVector = Vector3.Zero();\r\n private _projectionTextureViewLightMatrix = Matrix.Zero();\r\n\r\n private _projectionTextureProjectionLightMatrix = Matrix.Zero();\r\n /**\r\n * Gets or sets the light projection matrix as used by the projection texture\r\n */\r\n public get projectionTextureProjectionLightMatrix(): Matrix {\r\n return this._projectionTextureProjectionLightMatrix;\r\n }\r\n\r\n public set projectionTextureProjectionLightMatrix(projection: Matrix) {\r\n this._projectionTextureProjectionLightMatrix = projection;\r\n this._projectionTextureProjectionLightDirty = false;\r\n this._projectionTextureDirty = true;\r\n }\r\n\r\n private _projectionTextureScalingMatrix = Matrix.FromValues(0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0);\r\n\r\n /**\r\n * Creates a SpotLight object in the scene. A spot light is a simply light oriented cone.\r\n * It can cast shadows.\r\n * Documentation : https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\r\n * @param name The light friendly name\r\n * @param position The position of the spot light in the scene\r\n * @param direction The direction of the light in the scene\r\n * @param angle The cone angle of the light in Radians\r\n * @param exponent The light decay speed with the distance from the emission spot\r\n * @param scene The scene the lights belongs to\r\n */\r\n constructor(name: string, position: Vector3, direction: Vector3, angle: number, exponent: number, scene: Scene) {\r\n super(name, scene);\r\n\r\n this.position = position;\r\n this.direction = direction;\r\n this.angle = angle;\r\n this.exponent = exponent;\r\n }\r\n\r\n /**\r\n * Returns the string \"SpotLight\".\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"SpotLight\";\r\n }\r\n\r\n /**\r\n * Returns the integer 2.\r\n * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n public getTypeID(): number {\r\n return Light.LIGHTTYPEID_SPOTLIGHT;\r\n }\r\n\r\n /**\r\n * Overrides the direction setter to recompute the projection texture view light Matrix.\r\n * @param value\r\n */\r\n protected _setDirection(value: Vector3) {\r\n super._setDirection(value);\r\n this._projectionTextureViewLightDirty = true;\r\n }\r\n\r\n /**\r\n * Overrides the position setter to recompute the projection texture view light Matrix.\r\n * @param value\r\n */\r\n protected _setPosition(value: Vector3) {\r\n super._setPosition(value);\r\n this._projectionTextureViewLightDirty = true;\r\n }\r\n\r\n /**\r\n * Sets the passed matrix \"matrix\" as perspective projection matrix for the shadows and the passed view matrix with the fov equal to the SpotLight angle and and aspect ratio of 1.0.\r\n * Returns the SpotLight.\r\n * @param matrix\r\n * @param viewMatrix\r\n * @param renderList\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _setDefaultShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void {\r\n const activeCamera = this.getScene().activeCamera;\r\n\r\n if (!activeCamera) {\r\n return;\r\n }\r\n\r\n this._shadowAngleScale = this._shadowAngleScale || 1;\r\n const angle = this._shadowAngleScale * this._angle;\r\n\r\n const minZ = this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ;\r\n const maxZ = this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ;\r\n\r\n const useReverseDepthBuffer = this.getScene().getEngine().useReverseDepthBuffer;\r\n\r\n Matrix.PerspectiveFovLHToRef(\r\n angle,\r\n 1.0,\r\n useReverseDepthBuffer ? maxZ : minZ,\r\n useReverseDepthBuffer ? minZ : maxZ,\r\n matrix,\r\n true,\r\n this._scene.getEngine().isNDCHalfZRange,\r\n undefined,\r\n useReverseDepthBuffer\r\n );\r\n }\r\n\r\n protected _computeProjectionTextureViewLightMatrix(): void {\r\n this._projectionTextureViewLightDirty = false;\r\n this._projectionTextureDirty = true;\r\n\r\n this.position.addToRef(this.direction, this._projectionTextureViewTargetVector);\r\n Matrix.LookAtLHToRef(this.position, this._projectionTextureViewTargetVector, this._projectionTextureUpDirection, this._projectionTextureViewLightMatrix);\r\n }\r\n\r\n protected _computeProjectionTextureProjectionLightMatrix(): void {\r\n this._projectionTextureProjectionLightDirty = false;\r\n this._projectionTextureDirty = true;\r\n\r\n const lightFar = this.projectionTextureLightFar;\r\n const lightNear = this.projectionTextureLightNear;\r\n\r\n const P = lightFar / (lightFar - lightNear);\r\n const Q = -P * lightNear;\r\n const S = 1.0 / Math.tan(this._angle / 2.0);\r\n const A = 1.0;\r\n\r\n Matrix.FromValuesToRef(S / A, 0.0, 0.0, 0.0, 0.0, S, 0.0, 0.0, 0.0, 0.0, P, 1.0, 0.0, 0.0, Q, 0.0, this._projectionTextureProjectionLightMatrix);\r\n }\r\n\r\n /**\r\n * Main function for light texture projection matrix computing.\r\n */\r\n protected _computeProjectionTextureMatrix(): void {\r\n this._projectionTextureDirty = false;\r\n\r\n this._projectionTextureViewLightMatrix.multiplyToRef(this._projectionTextureProjectionLightMatrix, this._projectionTextureMatrix);\r\n if (this._projectionTexture instanceof Texture) {\r\n const u = this._projectionTexture.uScale / 2.0;\r\n const v = this._projectionTexture.vScale / 2.0;\r\n Matrix.FromValuesToRef(u, 0.0, 0.0, 0.0, 0.0, v, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0, this._projectionTextureScalingMatrix);\r\n }\r\n this._projectionTextureMatrix.multiplyToRef(this._projectionTextureScalingMatrix, this._projectionTextureMatrix);\r\n }\r\n\r\n protected _buildUniformLayout(): void {\r\n this._uniformBuffer.addUniform(\"vLightData\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\r\n this._uniformBuffer.addUniform(\"vLightSpecular\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDirection\", 3);\r\n this._uniformBuffer.addUniform(\"vLightFalloff\", 4);\r\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\r\n this._uniformBuffer.addUniform(\"depthValues\", 2);\r\n this._uniformBuffer.create();\r\n }\r\n\r\n private _computeAngleValues(): void {\r\n this._lightAngleScale = 1.0 / Math.max(0.001, Math.cos(this._innerAngle * 0.5) - this._cosHalfAngle);\r\n this._lightAngleOffset = -this._cosHalfAngle * this._lightAngleScale;\r\n }\r\n\r\n /**\r\n * Sets the passed Effect \"effect\" with the Light textures.\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The light\r\n */\r\n public transferTexturesToEffect(effect: Effect, lightIndex: string): Light {\r\n if (this.projectionTexture && this.projectionTexture.isReady()) {\r\n if (this._projectionTextureViewLightDirty) {\r\n this._computeProjectionTextureViewLightMatrix();\r\n }\r\n if (this._projectionTextureProjectionLightDirty) {\r\n this._computeProjectionTextureProjectionLightMatrix();\r\n }\r\n if (this._projectionTextureDirty) {\r\n this._computeProjectionTextureMatrix();\r\n }\r\n effect.setMatrix(\"textureProjectionMatrix\" + lightIndex, this._projectionTextureMatrix);\r\n effect.setTexture(\"projectionLightSampler\" + lightIndex, this.projectionTexture);\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the passed Effect object with the SpotLight transformed position (or position if not parented) and normalized direction.\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The spot light\r\n */\r\n public transferToEffect(effect: Effect, lightIndex: string): SpotLight {\r\n let normalizeDirection;\r\n\r\n if (this.computeTransformedInformation()) {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, this.exponent, lightIndex);\r\n\r\n normalizeDirection = Vector3.Normalize(this.transformedDirection);\r\n } else {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.position.x, this.position.y, this.position.z, this.exponent, lightIndex);\r\n\r\n normalizeDirection = Vector3.Normalize(this.direction);\r\n }\r\n\r\n this._uniformBuffer.updateFloat4(\"vLightDirection\", normalizeDirection.x, normalizeDirection.y, normalizeDirection.z, this._cosHalfAngle, lightIndex);\r\n\r\n this._uniformBuffer.updateFloat4(\"vLightFalloff\", this.range, this._inverseSquaredRange, this._lightAngleScale, this._lightAngleOffset, lightIndex);\r\n return this;\r\n }\r\n\r\n public transferToNodeMaterialEffect(effect: Effect, lightDataUniformName: string) {\r\n let normalizeDirection;\r\n\r\n if (this.computeTransformedInformation()) {\r\n normalizeDirection = Vector3.Normalize(this.transformedDirection);\r\n } else {\r\n normalizeDirection = Vector3.Normalize(this.direction);\r\n }\r\n\r\n if (this.getScene().useRightHandedSystem) {\r\n effect.setFloat3(lightDataUniformName, -normalizeDirection.x, -normalizeDirection.y, -normalizeDirection.z);\r\n } else {\r\n effect.setFloat3(lightDataUniformName, normalizeDirection.x, normalizeDirection.y, normalizeDirection.z);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Disposes the light and the associated resources.\r\n */\r\n public dispose(): void {\r\n super.dispose();\r\n if (this._projectionTexture) {\r\n this._projectionTexture.dispose();\r\n }\r\n }\r\n\r\n /**\r\n * Gets the minZ used for shadow according to both the scene and the light.\r\n * @param activeCamera The camera we are returning the min for\r\n * @returns the depth min z\r\n */\r\n public getDepthMinZ(activeCamera: Camera): number {\r\n const engine = this._scene.getEngine();\r\n const minZ = this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ;\r\n\r\n return engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? minZ : this._scene.getEngine().isNDCHalfZRange ? 0 : minZ;\r\n }\r\n\r\n /**\r\n * Gets the maxZ used for shadow according to both the scene and the light.\r\n * @param activeCamera The camera we are returning the max for\r\n * @returns the depth max z\r\n */\r\n public getDepthMaxZ(activeCamera: Camera): number {\r\n const engine = this._scene.getEngine();\r\n const maxZ = this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ;\r\n\r\n return engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : maxZ;\r\n }\r\n\r\n /**\r\n * Prepares the list of defines specific to the light type.\r\n * @param defines the list of defines\r\n * @param lightIndex defines the index of the light for the effect\r\n */\r\n public prepareLightSpecificDefines(defines: any, lightIndex: number): void {\r\n defines[\"SPOTLIGHT\" + lightIndex] = true;\r\n defines[\"PROJECTEDLIGHTTEXTURE\" + lightIndex] = this.projectionTexture && this.projectionTexture.isReady() ? true : false;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"spotLight.js","sourceRoot":"","sources":["../../../../lts/core/generated/Lights/spotLight.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGnE,OAAO,EAAE,MAAM,EA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;IAC9H,CAAC;CACJ;AAzaG;IADC,SAAS,EAAE;sCAGX;AAkBD;IADC,SAAS,EAAE;2CAGX;AAgBD;IADC,SAAS,EAAE;iDAGX;AAaD;IADC,SAAS,EAAE;2CACY;AAexB;IADC,SAAS,EAAE;2DAGX;AAcD;IADC,SAAS,EAAE;0DAGX;AAcD;IADC,SAAS,EAAE;6DAGX;AAUD;IADC,kBAAkB,CAAC,uBAAuB,CAAC;qDACM","sourcesContent":["import { serialize, serializeAsTexture } from \"../Misc/decorators\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Scene } from \"../scene\";\r\nimport { Matrix, Vector3 } from \"../Maths/math.vector\";\r\nimport { Node } from \"../node\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport { Light } from \"./light\";\r\nimport { ShadowLight } from \"./shadowLight\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport type { ProceduralTexture } from \"../Materials/Textures/Procedurals/proceduralTexture\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\n\r\nNode.AddNodeConstructor(\"Light_Type_2\", (name, scene) => {\r\n return () => new SpotLight(name, Vector3.Zero(), Vector3.Zero(), 0, 0, scene);\r\n});\r\n\r\n/**\r\n * A spot light is defined by a position, a direction, an angle, and an exponent.\r\n * These values define a cone of light starting from the position, emitting toward the direction.\r\n * The angle, in radians, defines the size (field of illumination) of the spotlight's conical beam,\r\n * and the exponent defines the speed of the decay of the light with distance (reach).\r\n * Documentation: https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\r\n */\r\nexport class SpotLight extends ShadowLight {\r\n /*\r\n upVector , rightVector and direction will form the coordinate system for this spot light.\r\n These three vectors will be used as projection matrix when doing texture projection.\r\n\r\n Also we have the following rules always holds:\r\n direction cross up = right\r\n right cross direction = up\r\n up cross right = forward\r\n\r\n light_near and light_far will control the range of the texture projection. If a plane is\r\n out of the range in spot light space, there is no texture projection.\r\n */\r\n\r\n private _angle: number;\r\n private _innerAngle: number = 0;\r\n private _cosHalfAngle: number;\r\n\r\n private _lightAngleScale: number;\r\n private _lightAngleOffset: number;\r\n\r\n /**\r\n * Gets the cone angle of the spot light in Radians.\r\n */\r\n @serialize()\r\n public get angle(): number {\r\n return this._angle;\r\n }\r\n /**\r\n * Sets the cone angle of the spot light in Radians.\r\n */\r\n public set angle(value: number) {\r\n this._angle = value;\r\n this._cosHalfAngle = Math.cos(value * 0.5);\r\n this._projectionTextureProjectionLightDirty = true;\r\n this.forceProjectionMatrixCompute();\r\n this._computeAngleValues();\r\n }\r\n\r\n /**\r\n * Only used in gltf falloff mode, this defines the angle where\r\n * the directional falloff will start before cutting at angle which could be seen\r\n * as outer angle.\r\n */\r\n @serialize()\r\n public get innerAngle(): number {\r\n return this._innerAngle;\r\n }\r\n /**\r\n * Only used in gltf falloff mode, this defines the angle where\r\n * the directional falloff will start before cutting at angle which could be seen\r\n * as outer angle.\r\n */\r\n public set innerAngle(value: number) {\r\n this._innerAngle = value;\r\n this._computeAngleValues();\r\n }\r\n\r\n private _shadowAngleScale: number;\r\n /**\r\n * Allows scaling the angle of the light for shadow generation only.\r\n */\r\n @serialize()\r\n public get shadowAngleScale(): number {\r\n return this._shadowAngleScale;\r\n }\r\n /**\r\n * Allows scaling the angle of the light for shadow generation only.\r\n */\r\n public set shadowAngleScale(value: number) {\r\n this._shadowAngleScale = value;\r\n this.forceProjectionMatrixCompute();\r\n }\r\n\r\n /**\r\n * The light decay speed with the distance from the emission spot.\r\n */\r\n @serialize()\r\n public exponent: number;\r\n\r\n private _projectionTextureMatrix = Matrix.Zero();\r\n /**\r\n * Allows reading the projection texture\r\n */\r\n public get projectionTextureMatrix(): Matrix {\r\n return this._projectionTextureMatrix;\r\n }\r\n\r\n protected _projectionTextureLightNear: number = 1e-6;\r\n /**\r\n * Gets the near clip of the Spotlight for texture projection.\r\n */\r\n @serialize()\r\n public get projectionTextureLightNear(): number {\r\n return this._projectionTextureLightNear;\r\n }\r\n /**\r\n * Sets the near clip of the Spotlight for texture projection.\r\n */\r\n public set projectionTextureLightNear(value: number) {\r\n this._projectionTextureLightNear = value;\r\n this._projectionTextureProjectionLightDirty = true;\r\n }\r\n\r\n protected _projectionTextureLightFar: number = 1000.0;\r\n /**\r\n * Gets the far clip of the Spotlight for texture projection.\r\n */\r\n @serialize()\r\n public get projectionTextureLightFar(): number {\r\n return this._projectionTextureLightFar;\r\n }\r\n /**\r\n * Sets the far clip of the Spotlight for texture projection.\r\n */\r\n public set projectionTextureLightFar(value: number) {\r\n this._projectionTextureLightFar = value;\r\n this._projectionTextureProjectionLightDirty = true;\r\n }\r\n\r\n protected _projectionTextureUpDirection: Vector3 = Vector3.Up();\r\n /**\r\n * Gets the Up vector of the Spotlight for texture projection.\r\n */\r\n @serialize()\r\n public get projectionTextureUpDirection(): Vector3 {\r\n return this._projectionTextureUpDirection;\r\n }\r\n /**\r\n * Sets the Up vector of the Spotlight for texture projection.\r\n */\r\n public set projectionTextureUpDirection(value: Vector3) {\r\n this._projectionTextureUpDirection = value;\r\n this._projectionTextureProjectionLightDirty = true;\r\n }\r\n\r\n @serializeAsTexture(\"projectedLightTexture\")\r\n private _projectionTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Gets the projection texture of the light.\r\n */\r\n public get projectionTexture(): Nullable<BaseTexture> {\r\n return this._projectionTexture;\r\n }\r\n /**\r\n * Sets the projection texture of the light.\r\n */\r\n public set projectionTexture(value: Nullable<BaseTexture>) {\r\n if (this._projectionTexture === value) {\r\n return;\r\n }\r\n this._projectionTexture = value;\r\n this._projectionTextureDirty = true;\r\n if (this._projectionTexture && !this._projectionTexture.isReady()) {\r\n if (SpotLight._IsProceduralTexture(this._projectionTexture)) {\r\n this._projectionTexture.getEffect().executeWhenCompiled(() => {\r\n this._markMeshesAsLightDirty();\r\n });\r\n } else if (SpotLight._IsTexture(this._projectionTexture)) {\r\n this._projectionTexture.onLoadObservable.addOnce(() => {\r\n this._markMeshesAsLightDirty();\r\n });\r\n }\r\n }\r\n }\r\n\r\n private static _IsProceduralTexture(texture: BaseTexture): texture is ProceduralTexture {\r\n return (texture as ProceduralTexture).onGeneratedObservable !== undefined;\r\n }\r\n\r\n private static _IsTexture(texture: BaseTexture): texture is Texture {\r\n return (texture as Texture).onLoadObservable !== undefined;\r\n }\r\n\r\n private _projectionTextureViewLightDirty = true;\r\n private _projectionTextureProjectionLightDirty = true;\r\n private _projectionTextureDirty = true;\r\n private _projectionTextureViewTargetVector = Vector3.Zero();\r\n private _projectionTextureViewLightMatrix = Matrix.Zero();\r\n\r\n private _projectionTextureProjectionLightMatrix = Matrix.Zero();\r\n /**\r\n * Gets or sets the light projection matrix as used by the projection texture\r\n */\r\n public get projectionTextureProjectionLightMatrix(): Matrix {\r\n return this._projectionTextureProjectionLightMatrix;\r\n }\r\n\r\n public set projectionTextureProjectionLightMatrix(projection: Matrix) {\r\n this._projectionTextureProjectionLightMatrix = projection;\r\n this._projectionTextureProjectionLightDirty = false;\r\n this._projectionTextureDirty = true;\r\n }\r\n\r\n private _projectionTextureScalingMatrix = Matrix.FromValues(0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0);\r\n\r\n /**\r\n * Creates a SpotLight object in the scene. A spot light is a simply light oriented cone.\r\n * It can cast shadows.\r\n * Documentation : https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction\r\n * @param name The light friendly name\r\n * @param position The position of the spot light in the scene\r\n * @param direction The direction of the light in the scene\r\n * @param angle The cone angle of the light in Radians\r\n * @param exponent The light decay speed with the distance from the emission spot\r\n * @param scene The scene the lights belongs to\r\n */\r\n constructor(name: string, position: Vector3, direction: Vector3, angle: number, exponent: number, scene: Scene) {\r\n super(name, scene);\r\n\r\n this.position = position;\r\n this.direction = direction;\r\n this.angle = angle;\r\n this.exponent = exponent;\r\n }\r\n\r\n /**\r\n * Returns the string \"SpotLight\".\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"SpotLight\";\r\n }\r\n\r\n /**\r\n * Returns the integer 2.\r\n * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x\r\n */\r\n public getTypeID(): number {\r\n return Light.LIGHTTYPEID_SPOTLIGHT;\r\n }\r\n\r\n /**\r\n * Overrides the direction setter to recompute the projection texture view light Matrix.\r\n * @param value\r\n */\r\n protected _setDirection(value: Vector3) {\r\n super._setDirection(value);\r\n this._projectionTextureViewLightDirty = true;\r\n }\r\n\r\n /**\r\n * Overrides the position setter to recompute the projection texture view light Matrix.\r\n * @param value\r\n */\r\n protected _setPosition(value: Vector3) {\r\n super._setPosition(value);\r\n this._projectionTextureViewLightDirty = true;\r\n }\r\n\r\n /**\r\n * Sets the passed matrix \"matrix\" as perspective projection matrix for the shadows and the passed view matrix with the fov equal to the SpotLight angle and and aspect ratio of 1.0.\r\n * Returns the SpotLight.\r\n * @param matrix\r\n * @param viewMatrix\r\n * @param renderList\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n protected _setDefaultShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void {\r\n const activeCamera = this.getScene().activeCamera;\r\n\r\n if (!activeCamera) {\r\n return;\r\n }\r\n\r\n this._shadowAngleScale = this._shadowAngleScale || 1;\r\n const angle = this._shadowAngleScale * this._angle;\r\n\r\n const minZ = this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ;\r\n const maxZ = this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ;\r\n\r\n const useReverseDepthBuffer = this.getScene().getEngine().useReverseDepthBuffer;\r\n\r\n Matrix.PerspectiveFovLHToRef(\r\n angle,\r\n 1.0,\r\n useReverseDepthBuffer ? maxZ : minZ,\r\n useReverseDepthBuffer ? minZ : maxZ,\r\n matrix,\r\n true,\r\n this._scene.getEngine().isNDCHalfZRange,\r\n undefined,\r\n useReverseDepthBuffer\r\n );\r\n }\r\n\r\n protected _computeProjectionTextureViewLightMatrix(): void {\r\n this._projectionTextureViewLightDirty = false;\r\n this._projectionTextureDirty = true;\r\n\r\n this.position.addToRef(this.direction, this._projectionTextureViewTargetVector);\r\n Matrix.LookAtLHToRef(this.position, this._projectionTextureViewTargetVector, this._projectionTextureUpDirection, this._projectionTextureViewLightMatrix);\r\n }\r\n\r\n protected _computeProjectionTextureProjectionLightMatrix(): void {\r\n this._projectionTextureProjectionLightDirty = false;\r\n this._projectionTextureDirty = true;\r\n\r\n const lightFar = this.projectionTextureLightFar;\r\n const lightNear = this.projectionTextureLightNear;\r\n\r\n const P = lightFar / (lightFar - lightNear);\r\n const Q = -P * lightNear;\r\n const S = 1.0 / Math.tan(this._angle / 2.0);\r\n const A = 1.0;\r\n\r\n Matrix.FromValuesToRef(S / A, 0.0, 0.0, 0.0, 0.0, S, 0.0, 0.0, 0.0, 0.0, P, 1.0, 0.0, 0.0, Q, 0.0, this._projectionTextureProjectionLightMatrix);\r\n }\r\n\r\n /**\r\n * Main function for light texture projection matrix computing.\r\n */\r\n protected _computeProjectionTextureMatrix(): void {\r\n this._projectionTextureDirty = false;\r\n\r\n this._projectionTextureViewLightMatrix.multiplyToRef(this._projectionTextureProjectionLightMatrix, this._projectionTextureMatrix);\r\n if (this._projectionTexture instanceof Texture) {\r\n const u = this._projectionTexture.uScale / 2.0;\r\n const v = this._projectionTexture.vScale / 2.0;\r\n Matrix.FromValuesToRef(u, 0.0, 0.0, 0.0, 0.0, v, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0, this._projectionTextureScalingMatrix);\r\n }\r\n this._projectionTextureMatrix.multiplyToRef(this._projectionTextureScalingMatrix, this._projectionTextureMatrix);\r\n }\r\n\r\n protected _buildUniformLayout(): void {\r\n this._uniformBuffer.addUniform(\"vLightData\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\r\n this._uniformBuffer.addUniform(\"vLightSpecular\", 4);\r\n this._uniformBuffer.addUniform(\"vLightDirection\", 3);\r\n this._uniformBuffer.addUniform(\"vLightFalloff\", 4);\r\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\r\n this._uniformBuffer.addUniform(\"depthValues\", 2);\r\n this._uniformBuffer.create();\r\n }\r\n\r\n private _computeAngleValues(): void {\r\n this._lightAngleScale = 1.0 / Math.max(0.001, Math.cos(this._innerAngle * 0.5) - this._cosHalfAngle);\r\n this._lightAngleOffset = -this._cosHalfAngle * this._lightAngleScale;\r\n }\r\n\r\n /**\r\n * Sets the passed Effect \"effect\" with the Light textures.\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The light\r\n */\r\n public transferTexturesToEffect(effect: Effect, lightIndex: string): Light {\r\n if (this.projectionTexture && this.projectionTexture.isReady()) {\r\n if (this._projectionTextureViewLightDirty) {\r\n this._computeProjectionTextureViewLightMatrix();\r\n }\r\n if (this._projectionTextureProjectionLightDirty) {\r\n this._computeProjectionTextureProjectionLightMatrix();\r\n }\r\n if (this._projectionTextureDirty) {\r\n this._computeProjectionTextureMatrix();\r\n }\r\n effect.setMatrix(\"textureProjectionMatrix\" + lightIndex, this._projectionTextureMatrix);\r\n effect.setTexture(\"projectionLightSampler\" + lightIndex, this.projectionTexture);\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Sets the passed Effect object with the SpotLight transformed position (or position if not parented) and normalized direction.\r\n * @param effect The effect to update\r\n * @param lightIndex The index of the light in the effect to update\r\n * @returns The spot light\r\n */\r\n public transferToEffect(effect: Effect, lightIndex: string): SpotLight {\r\n let normalizeDirection;\r\n\r\n if (this.computeTransformedInformation()) {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.transformedPosition.x, this.transformedPosition.y, this.transformedPosition.z, this.exponent, lightIndex);\r\n\r\n normalizeDirection = Vector3.Normalize(this.transformedDirection);\r\n } else {\r\n this._uniformBuffer.updateFloat4(\"vLightData\", this.position.x, this.position.y, this.position.z, this.exponent, lightIndex);\r\n\r\n normalizeDirection = Vector3.Normalize(this.direction);\r\n }\r\n\r\n this._uniformBuffer.updateFloat4(\"vLightDirection\", normalizeDirection.x, normalizeDirection.y, normalizeDirection.z, this._cosHalfAngle, lightIndex);\r\n\r\n this._uniformBuffer.updateFloat4(\"vLightFalloff\", this.range, this._inverseSquaredRange, this._lightAngleScale, this._lightAngleOffset, lightIndex);\r\n return this;\r\n }\r\n\r\n public transferToNodeMaterialEffect(effect: Effect, lightDataUniformName: string) {\r\n let normalizeDirection;\r\n\r\n if (this.computeTransformedInformation()) {\r\n normalizeDirection = Vector3.Normalize(this.transformedDirection);\r\n } else {\r\n normalizeDirection = Vector3.Normalize(this.direction);\r\n }\r\n\r\n if (this.getScene().useRightHandedSystem) {\r\n effect.setFloat3(lightDataUniformName, -normalizeDirection.x, -normalizeDirection.y, -normalizeDirection.z);\r\n } else {\r\n effect.setFloat3(lightDataUniformName, normalizeDirection.x, normalizeDirection.y, normalizeDirection.z);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Disposes the light and the associated resources.\r\n */\r\n public dispose(): void {\r\n super.dispose();\r\n if (this._projectionTexture) {\r\n this._projectionTexture.dispose();\r\n }\r\n }\r\n\r\n /**\r\n * Gets the minZ used for shadow according to both the scene and the light.\r\n * @param activeCamera The camera we are returning the min for\r\n * @returns the depth min z\r\n */\r\n public getDepthMinZ(activeCamera: Camera): number {\r\n const engine = this._scene.getEngine();\r\n const minZ = this.shadowMinZ !== undefined ? this.shadowMinZ : activeCamera.minZ;\r\n\r\n return engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? minZ : this._scene.getEngine().isNDCHalfZRange ? 0 : minZ;\r\n }\r\n\r\n /**\r\n * Gets the maxZ used for shadow according to both the scene and the light.\r\n * @param activeCamera The camera we are returning the max for\r\n * @returns the depth max z\r\n */\r\n public getDepthMaxZ(activeCamera: Camera): number {\r\n const engine = this._scene.getEngine();\r\n const maxZ = this.shadowMaxZ !== undefined ? this.shadowMaxZ : activeCamera.maxZ;\r\n\r\n return engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : maxZ;\r\n }\r\n\r\n /**\r\n * Prepares the list of defines specific to the light type.\r\n * @param defines the list of defines\r\n * @param lightIndex defines the index of the light for the effect\r\n */\r\n public prepareLightSpecificDefines(defines: any, lightIndex: number): void {\r\n defines[\"SPOTLIGHT\" + lightIndex] = true;\r\n defines[\"PROJECTEDLIGHTTEXTURE\" + lightIndex] = this.projectionTexture && this.projectionTexture.isReady() ? true : false;\r\n }\r\n}\r\n"]}
|
package/Loading/sceneLoader.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ import type { Light } from "../Lights/light";
|
|
|
16
16
|
/**
|
|
17
17
|
* Type used for the success callback of ImportMesh
|
|
18
18
|
*/
|
|
19
|
-
export
|
|
19
|
+
export type SceneLoaderSuccessCallback = (meshes: AbstractMesh[], particleSystems: IParticleSystem[], skeletons: Skeleton[], animationGroups: AnimationGroup[], transformNodes: TransformNode[], geometries: Geometry[], lights: Light[]) => void;
|
|
20
20
|
/**
|
|
21
21
|
* Interface used for the result of ImportMeshAsync
|
|
22
22
|
*/
|
|
@@ -154,130 +154,6 @@ class BackgroundMaterialDefines extends MaterialDefines {
|
|
|
154
154
|
* Background material used to create an efficient environment around your scene.
|
|
155
155
|
*/
|
|
156
156
|
export class BackgroundMaterial extends PushMaterial {
|
|
157
|
-
/**
|
|
158
|
-
* Instantiates a Background Material in the given scene
|
|
159
|
-
* @param name The friendly name of the material
|
|
160
|
-
* @param scene The scene to add the material to
|
|
161
|
-
*/
|
|
162
|
-
constructor(name, scene) {
|
|
163
|
-
super(name, scene);
|
|
164
|
-
/**
|
|
165
|
-
* Key light Color (multiply against the environment texture)
|
|
166
|
-
*/
|
|
167
|
-
this.primaryColor = Color3.White();
|
|
168
|
-
this._primaryColorShadowLevel = 0;
|
|
169
|
-
this._primaryColorHighlightLevel = 0;
|
|
170
|
-
/**
|
|
171
|
-
* Reflection Texture used in the material.
|
|
172
|
-
* Should be author in a specific way for the best result (refer to the documentation).
|
|
173
|
-
*/
|
|
174
|
-
this.reflectionTexture = null;
|
|
175
|
-
/**
|
|
176
|
-
* Reflection Texture level of blur.
|
|
177
|
-
*
|
|
178
|
-
* Can be use to reuse an existing HDR Texture and target a specific LOD to prevent authoring the
|
|
179
|
-
* texture twice.
|
|
180
|
-
*/
|
|
181
|
-
this.reflectionBlur = 0;
|
|
182
|
-
/**
|
|
183
|
-
* Diffuse Texture used in the material.
|
|
184
|
-
* Should be author in a specific way for the best result (refer to the documentation).
|
|
185
|
-
*/
|
|
186
|
-
this.diffuseTexture = null;
|
|
187
|
-
this._shadowLights = null;
|
|
188
|
-
/**
|
|
189
|
-
* Specify the list of lights casting shadow on the material.
|
|
190
|
-
* All scene shadow lights will be included if null.
|
|
191
|
-
*/
|
|
192
|
-
this.shadowLights = null;
|
|
193
|
-
/**
|
|
194
|
-
* Helps adjusting the shadow to a softer level if required.
|
|
195
|
-
* 0 means black shadows and 1 means no shadows.
|
|
196
|
-
*/
|
|
197
|
-
this.shadowLevel = 0;
|
|
198
|
-
/**
|
|
199
|
-
* In case of opacity Fresnel or reflection falloff, this is use as a scene center.
|
|
200
|
-
* It is usually zero but might be interesting to modify according to your setup.
|
|
201
|
-
*/
|
|
202
|
-
this.sceneCenter = Vector3.Zero();
|
|
203
|
-
/**
|
|
204
|
-
* This helps specifying that the material is falling off to the sky box at grazing angle.
|
|
205
|
-
* This helps ensuring a nice transition when the camera goes under the ground.
|
|
206
|
-
*/
|
|
207
|
-
this.opacityFresnel = true;
|
|
208
|
-
/**
|
|
209
|
-
* This helps specifying that the material is falling off from diffuse to the reflection texture at grazing angle.
|
|
210
|
-
* This helps adding a mirror texture on the ground.
|
|
211
|
-
*/
|
|
212
|
-
this.reflectionFresnel = false;
|
|
213
|
-
/**
|
|
214
|
-
* This helps specifying the falloff radius off the reflection texture from the sceneCenter.
|
|
215
|
-
* This helps adding a nice falloff effect to the reflection if used as a mirror for instance.
|
|
216
|
-
*/
|
|
217
|
-
this.reflectionFalloffDistance = 0.0;
|
|
218
|
-
/**
|
|
219
|
-
* This specifies the weight of the reflection against the background in case of reflection Fresnel.
|
|
220
|
-
*/
|
|
221
|
-
this.reflectionAmount = 1.0;
|
|
222
|
-
/**
|
|
223
|
-
* This specifies the weight of the reflection at grazing angle.
|
|
224
|
-
*/
|
|
225
|
-
this.reflectionReflectance0 = 0.05;
|
|
226
|
-
/**
|
|
227
|
-
* This specifies the weight of the reflection at a perpendicular point of view.
|
|
228
|
-
*/
|
|
229
|
-
this.reflectionReflectance90 = 0.5;
|
|
230
|
-
/**
|
|
231
|
-
* Helps to directly use the maps channels instead of their level.
|
|
232
|
-
*/
|
|
233
|
-
this.useRGBColor = true;
|
|
234
|
-
/**
|
|
235
|
-
* This helps reducing the banding effect that could occur on the background.
|
|
236
|
-
*/
|
|
237
|
-
this.enableNoise = false;
|
|
238
|
-
this._fovMultiplier = 1.0;
|
|
239
|
-
/**
|
|
240
|
-
* Enable the FOV adjustment feature controlled by fovMultiplier.
|
|
241
|
-
*/
|
|
242
|
-
this.useEquirectangularFOV = false;
|
|
243
|
-
this._maxSimultaneousLights = 4;
|
|
244
|
-
/**
|
|
245
|
-
* Number of Simultaneous lights allowed on the material.
|
|
246
|
-
*/
|
|
247
|
-
this.maxSimultaneousLights = 4;
|
|
248
|
-
this._shadowOnly = false;
|
|
249
|
-
/**
|
|
250
|
-
* Make the material only render shadows
|
|
251
|
-
*/
|
|
252
|
-
this.shadowOnly = false;
|
|
253
|
-
/**
|
|
254
|
-
* Keep track of the image processing observer to allow dispose and replace.
|
|
255
|
-
*/
|
|
256
|
-
this._imageProcessingObserver = null;
|
|
257
|
-
/**
|
|
258
|
-
* Due to a bug in iOS10, video tags (which are using the background material) are in BGR and not RGB.
|
|
259
|
-
* Setting this flag to true (not done automatically!) will convert it back to RGB.
|
|
260
|
-
*/
|
|
261
|
-
this.switchToBGR = false;
|
|
262
|
-
// Temp values kept as cache in the material.
|
|
263
|
-
this._renderTargets = new SmartArray(16);
|
|
264
|
-
this._reflectionControls = Vector4.Zero();
|
|
265
|
-
this._white = Color3.White();
|
|
266
|
-
this._primaryShadowColor = Color3.Black();
|
|
267
|
-
this._primaryHighlightColor = Color3.Black();
|
|
268
|
-
// Setup the default processing configuration to the scene.
|
|
269
|
-
this._attachImageProcessingConfiguration(null);
|
|
270
|
-
this.getRenderTargetTextures = () => {
|
|
271
|
-
this._renderTargets.reset();
|
|
272
|
-
if (this._diffuseTexture && this._diffuseTexture.isRenderTarget) {
|
|
273
|
-
this._renderTargets.push(this._diffuseTexture);
|
|
274
|
-
}
|
|
275
|
-
if (this._reflectionTexture && this._reflectionTexture.isRenderTarget) {
|
|
276
|
-
this._renderTargets.push(this._reflectionTexture);
|
|
277
|
-
}
|
|
278
|
-
return this._renderTargets;
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
157
|
/**
|
|
282
158
|
* Experimental Internal Use Only.
|
|
283
159
|
*
|
|
@@ -488,6 +364,130 @@ export class BackgroundMaterial extends PushMaterial {
|
|
|
488
364
|
set cameraColorCurves(value) {
|
|
489
365
|
this.imageProcessingConfiguration.colorCurves = value;
|
|
490
366
|
}
|
|
367
|
+
/**
|
|
368
|
+
* Instantiates a Background Material in the given scene
|
|
369
|
+
* @param name The friendly name of the material
|
|
370
|
+
* @param scene The scene to add the material to
|
|
371
|
+
*/
|
|
372
|
+
constructor(name, scene) {
|
|
373
|
+
super(name, scene);
|
|
374
|
+
/**
|
|
375
|
+
* Key light Color (multiply against the environment texture)
|
|
376
|
+
*/
|
|
377
|
+
this.primaryColor = Color3.White();
|
|
378
|
+
this._primaryColorShadowLevel = 0;
|
|
379
|
+
this._primaryColorHighlightLevel = 0;
|
|
380
|
+
/**
|
|
381
|
+
* Reflection Texture used in the material.
|
|
382
|
+
* Should be author in a specific way for the best result (refer to the documentation).
|
|
383
|
+
*/
|
|
384
|
+
this.reflectionTexture = null;
|
|
385
|
+
/**
|
|
386
|
+
* Reflection Texture level of blur.
|
|
387
|
+
*
|
|
388
|
+
* Can be use to reuse an existing HDR Texture and target a specific LOD to prevent authoring the
|
|
389
|
+
* texture twice.
|
|
390
|
+
*/
|
|
391
|
+
this.reflectionBlur = 0;
|
|
392
|
+
/**
|
|
393
|
+
* Diffuse Texture used in the material.
|
|
394
|
+
* Should be author in a specific way for the best result (refer to the documentation).
|
|
395
|
+
*/
|
|
396
|
+
this.diffuseTexture = null;
|
|
397
|
+
this._shadowLights = null;
|
|
398
|
+
/**
|
|
399
|
+
* Specify the list of lights casting shadow on the material.
|
|
400
|
+
* All scene shadow lights will be included if null.
|
|
401
|
+
*/
|
|
402
|
+
this.shadowLights = null;
|
|
403
|
+
/**
|
|
404
|
+
* Helps adjusting the shadow to a softer level if required.
|
|
405
|
+
* 0 means black shadows and 1 means no shadows.
|
|
406
|
+
*/
|
|
407
|
+
this.shadowLevel = 0;
|
|
408
|
+
/**
|
|
409
|
+
* In case of opacity Fresnel or reflection falloff, this is use as a scene center.
|
|
410
|
+
* It is usually zero but might be interesting to modify according to your setup.
|
|
411
|
+
*/
|
|
412
|
+
this.sceneCenter = Vector3.Zero();
|
|
413
|
+
/**
|
|
414
|
+
* This helps specifying that the material is falling off to the sky box at grazing angle.
|
|
415
|
+
* This helps ensuring a nice transition when the camera goes under the ground.
|
|
416
|
+
*/
|
|
417
|
+
this.opacityFresnel = true;
|
|
418
|
+
/**
|
|
419
|
+
* This helps specifying that the material is falling off from diffuse to the reflection texture at grazing angle.
|
|
420
|
+
* This helps adding a mirror texture on the ground.
|
|
421
|
+
*/
|
|
422
|
+
this.reflectionFresnel = false;
|
|
423
|
+
/**
|
|
424
|
+
* This helps specifying the falloff radius off the reflection texture from the sceneCenter.
|
|
425
|
+
* This helps adding a nice falloff effect to the reflection if used as a mirror for instance.
|
|
426
|
+
*/
|
|
427
|
+
this.reflectionFalloffDistance = 0.0;
|
|
428
|
+
/**
|
|
429
|
+
* This specifies the weight of the reflection against the background in case of reflection Fresnel.
|
|
430
|
+
*/
|
|
431
|
+
this.reflectionAmount = 1.0;
|
|
432
|
+
/**
|
|
433
|
+
* This specifies the weight of the reflection at grazing angle.
|
|
434
|
+
*/
|
|
435
|
+
this.reflectionReflectance0 = 0.05;
|
|
436
|
+
/**
|
|
437
|
+
* This specifies the weight of the reflection at a perpendicular point of view.
|
|
438
|
+
*/
|
|
439
|
+
this.reflectionReflectance90 = 0.5;
|
|
440
|
+
/**
|
|
441
|
+
* Helps to directly use the maps channels instead of their level.
|
|
442
|
+
*/
|
|
443
|
+
this.useRGBColor = true;
|
|
444
|
+
/**
|
|
445
|
+
* This helps reducing the banding effect that could occur on the background.
|
|
446
|
+
*/
|
|
447
|
+
this.enableNoise = false;
|
|
448
|
+
this._fovMultiplier = 1.0;
|
|
449
|
+
/**
|
|
450
|
+
* Enable the FOV adjustment feature controlled by fovMultiplier.
|
|
451
|
+
*/
|
|
452
|
+
this.useEquirectangularFOV = false;
|
|
453
|
+
this._maxSimultaneousLights = 4;
|
|
454
|
+
/**
|
|
455
|
+
* Number of Simultaneous lights allowed on the material.
|
|
456
|
+
*/
|
|
457
|
+
this.maxSimultaneousLights = 4;
|
|
458
|
+
this._shadowOnly = false;
|
|
459
|
+
/**
|
|
460
|
+
* Make the material only render shadows
|
|
461
|
+
*/
|
|
462
|
+
this.shadowOnly = false;
|
|
463
|
+
/**
|
|
464
|
+
* Keep track of the image processing observer to allow dispose and replace.
|
|
465
|
+
*/
|
|
466
|
+
this._imageProcessingObserver = null;
|
|
467
|
+
/**
|
|
468
|
+
* Due to a bug in iOS10, video tags (which are using the background material) are in BGR and not RGB.
|
|
469
|
+
* Setting this flag to true (not done automatically!) will convert it back to RGB.
|
|
470
|
+
*/
|
|
471
|
+
this.switchToBGR = false;
|
|
472
|
+
// Temp values kept as cache in the material.
|
|
473
|
+
this._renderTargets = new SmartArray(16);
|
|
474
|
+
this._reflectionControls = Vector4.Zero();
|
|
475
|
+
this._white = Color3.White();
|
|
476
|
+
this._primaryShadowColor = Color3.Black();
|
|
477
|
+
this._primaryHighlightColor = Color3.Black();
|
|
478
|
+
// Setup the default processing configuration to the scene.
|
|
479
|
+
this._attachImageProcessingConfiguration(null);
|
|
480
|
+
this.getRenderTargetTextures = () => {
|
|
481
|
+
this._renderTargets.reset();
|
|
482
|
+
if (this._diffuseTexture && this._diffuseTexture.isRenderTarget) {
|
|
483
|
+
this._renderTargets.push(this._diffuseTexture);
|
|
484
|
+
}
|
|
485
|
+
if (this._reflectionTexture && this._reflectionTexture.isRenderTarget) {
|
|
486
|
+
this._renderTargets.push(this._reflectionTexture);
|
|
487
|
+
}
|
|
488
|
+
return this._renderTargets;
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
491
|
/**
|
|
492
492
|
* Gets a boolean indicating that current material needs to register RTT
|
|
493
493
|
*/
|