@babylonjs/core 5.27.0 → 5.28.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/Animations/animatable.js +2 -1
- package/Animations/animatable.js.map +1 -1
- package/Animations/runtimeAnimation.js +1 -1
- package/Animations/runtimeAnimation.js.map +1 -1
- package/Audio/audioSceneComponent.js +2 -1
- package/Audio/audioSceneComponent.js.map +1 -1
- package/Audio/sound.js +70 -45
- package/Audio/sound.js.map +1 -1
- package/Audio/soundTrack.js +12 -6
- package/Audio/soundTrack.js.map +1 -1
- package/BakedVertexAnimation/bakedVertexAnimationManager.js +2 -1
- package/BakedVertexAnimation/bakedVertexAnimationManager.js.map +1 -1
- package/Behaviors/Cameras/autoRotationBehavior.js +1 -1
- package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
- package/Behaviors/Meshes/followBehavior.js +2 -1
- package/Behaviors/Meshes/followBehavior.js.map +1 -1
- package/Behaviors/Meshes/handConstraintBehavior.js +6 -6
- package/Behaviors/Meshes/handConstraintBehavior.js.map +1 -1
- package/Bones/bone.js +2 -1
- package/Bones/bone.js.map +1 -1
- package/Bones/skeleton.js +3 -2
- package/Bones/skeleton.js.map +1 -1
- package/Cameras/Inputs/BaseCameraPointersInput.js +2 -2
- package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js +5 -3
- package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/flyCameraMouseInput.js +2 -2
- package/Cameras/Inputs/flyCameraMouseInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraMouseInput.js +2 -2
- package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
- package/Cameras/arcRotateCamera.js +2 -1
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Cameras/camera.js +6 -4
- package/Cameras/camera.js.map +1 -1
- package/Compute/computeEffect.js +8 -5
- package/Compute/computeEffect.js.map +1 -1
- package/Compute/computeShader.js +12 -11
- package/Compute/computeShader.js.map +1 -1
- package/Culling/Octrees/octreeSceneComponent.js +2 -1
- package/Culling/Octrees/octreeSceneComponent.js.map +1 -1
- package/Culling/boundingBox.js +3 -2
- package/Culling/boundingBox.js.map +1 -1
- package/Culling/ray.js +2 -1
- package/Culling/ray.js.map +1 -1
- package/Debug/directionalLightFrustumViewer.js +9 -7
- package/Debug/directionalLightFrustumViewer.js.map +1 -1
- package/Debug/rayHelper.js +2 -1
- package/Debug/rayHelper.js.map +1 -1
- package/Debug/skeletonViewer.js +29 -24
- package/Debug/skeletonViewer.js.map +1 -1
- package/DeviceInput/InputDevices/deviceSourceManager.js +5 -3
- package/DeviceInput/InputDevices/deviceSourceManager.js.map +1 -1
- package/DeviceInput/internalDeviceSourceManager.js +2 -1
- package/DeviceInput/internalDeviceSourceManager.js.map +1 -1
- package/DeviceInput/webDeviceInputSystem.js +12 -9
- package/DeviceInput/webDeviceInputSystem.js.map +1 -1
- package/Engines/Extensions/engine.rawTexture.js +4 -4
- package/Engines/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/Extensions/engine.readTexture.js +3 -2
- package/Engines/Extensions/engine.readTexture.js.map +1 -1
- package/Engines/Extensions/engine.views.js +2 -1
- package/Engines/Extensions/engine.views.js.map +1 -1
- package/Engines/Processors/shaderProcessor.js +11 -6
- package/Engines/Processors/shaderProcessor.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.cubeTexture.js +1 -1
- package/Engines/WebGPU/Extensions/engine.cubeTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.dynamicTexture.js +2 -1
- package/Engines/WebGPU/Extensions/engine.dynamicTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.js +2 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.query.js +4 -2
- package/Engines/WebGPU/Extensions/engine.query.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.rawTexture.js +4 -4
- package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js +2 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.storageBuffer.js +3 -2
- package/Engines/WebGPU/Extensions/engine.storageBuffer.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.textureSampler.js +2 -1
- package/Engines/WebGPU/Extensions/engine.textureSampler.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.videoTexture.js +2 -1
- package/Engines/WebGPU/Extensions/engine.videoTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheBindGroups.js +7 -6
- package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +18 -14
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheSampler.js +4 -3
- package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
- package/Engines/WebGPU/webgpuClearQuad.js +3 -2
- package/Engines/WebGPU/webgpuClearQuad.js.map +1 -1
- package/Engines/WebGPU/webgpuComputePipelineContext.js +2 -1
- package/Engines/WebGPU/webgpuComputePipelineContext.js.map +1 -1
- package/Engines/WebGPU/webgpuDepthCullingState.js +2 -2
- package/Engines/WebGPU/webgpuDepthCullingState.js.map +1 -1
- package/Engines/WebGPU/webgpuDrawContext.js +2 -1
- package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
- package/Engines/WebGPU/webgpuHardwareTexture.js +4 -3
- package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuMaterialContext.js +5 -4
- package/Engines/WebGPU/webgpuMaterialContext.js.map +1 -1
- package/Engines/WebGPU/webgpuOcclusionQuery.js +5 -3
- package/Engines/WebGPU/webgpuOcclusionQuery.js.map +1 -1
- package/Engines/WebGPU/webgpuPipelineContext.js +4 -2
- package/Engines/WebGPU/webgpuPipelineContext.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessingContext.js +4 -2
- package/Engines/WebGPU/webgpuShaderProcessingContext.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js +2 -1
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
- package/Engines/WebGPU/webgpuSnapshotRendering.js +3 -2
- package/Engines/WebGPU/webgpuSnapshotRendering.js.map +1 -1
- package/Engines/WebGPU/webgpuStencilStateComposer.js +2 -1
- package/Engines/WebGPU/webgpuStencilStateComposer.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.js +40 -38
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/engine.d.ts +898 -273
- package/Engines/engine.js +5 -3
- package/Engines/engine.js.map +1 -1
- package/Engines/nativeEngine.js +7 -5
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.d.ts +7 -0
- package/Engines/nullEngine.js +42 -0
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/renderTargetWrapper.js +14 -9
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/thinEngine.js +25 -16
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +87 -61
- package/Engines/webgpuEngine.js.map +1 -1
- package/Gamepads/gamepadManager.js +1 -1
- package/Gamepads/gamepadManager.js.map +1 -1
- package/Gizmos/axisDragGizmo.js +4 -2
- package/Gizmos/axisDragGizmo.js.map +1 -1
- package/Gizmos/axisScaleGizmo.js +6 -4
- package/Gizmos/axisScaleGizmo.js.map +1 -1
- package/Gizmos/gizmo.js +21 -6
- package/Gizmos/gizmo.js.map +1 -1
- package/Gizmos/gizmoManager.js +3 -2
- package/Gizmos/gizmoManager.js.map +1 -1
- package/Gizmos/planeDragGizmo.js +4 -2
- package/Gizmos/planeDragGizmo.js.map +1 -1
- package/Gizmos/planeRotationGizmo.js +4 -2
- package/Gizmos/planeRotationGizmo.js.map +1 -1
- package/Helpers/videoDome.js +2 -1
- package/Helpers/videoDome.js.map +1 -1
- package/Layers/effectLayer.js +5 -3
- package/Layers/effectLayer.js.map +1 -1
- package/Layers/glowLayer.js +4 -3
- package/Layers/glowLayer.js.map +1 -1
- package/Layers/highlightLayer.js +2 -1
- package/Layers/highlightLayer.js.map +1 -1
- package/LensFlares/lensFlareSystem.js +2 -1
- package/LensFlares/lensFlareSystem.js.map +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js +25 -21
- package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +13 -8
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js +2 -1
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Loading/sceneLoader.d.ts +1 -1
- package/Loading/sceneLoader.js +3 -3
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js +2 -1
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +2 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/textureBlock.js +10 -6
- package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/TBNBlock.js +3 -2
- package/Materials/Node/Blocks/Fragment/TBNBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +2 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +2 -1
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
- package/Materials/Node/Blocks/Input/inputBlock.js +2 -1
- package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js +26 -24
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/iridescenceBlock.js +3 -3
- package/Materials/Node/Blocks/PBR/iridescenceBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +48 -44
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/reflectionBlock.js +2 -1
- package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/refractionBlock.js +2 -1
- package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/sheenBlock.js +13 -13
- package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +27 -26
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/instancesBlock.js +2 -2
- package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +6 -6
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
- package/Materials/Node/Blocks/cloudBlock.js +3 -2
- package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
- package/Materials/Node/Blocks/colorMergerBlock.js +5 -4
- package/Materials/Node/Blocks/colorMergerBlock.js.map +1 -1
- package/Materials/Node/Blocks/customBlock.js +4 -3
- package/Materials/Node/Blocks/customBlock.js.map +1 -1
- package/Materials/Node/Blocks/vectorMergerBlock.js +5 -4
- package/Materials/Node/Blocks/vectorMergerBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +7 -6
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBlock.js +4 -3
- package/Materials/Node/nodeMaterialBlock.js.map +1 -1
- package/Materials/Node/nodeMaterialDecorator.js +1 -1
- package/Materials/Node/nodeMaterialDecorator.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +25 -19
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/PBR/pbrClearCoatConfiguration.js +9 -6
- package/Materials/PBR/pbrClearCoatConfiguration.js.map +1 -1
- package/Materials/PBR/pbrIridescenceConfiguration.js +7 -4
- package/Materials/PBR/pbrIridescenceConfiguration.js.map +1 -1
- package/Materials/PBR/pbrSheenConfiguration.js +7 -4
- package/Materials/PBR/pbrSheenConfiguration.js.map +1 -1
- package/Materials/Textures/Loaders/envTextureLoader.js +2 -2
- package/Materials/Textures/Loaders/envTextureLoader.js.map +1 -1
- package/Materials/Textures/Packer/packer.js +14 -13
- package/Materials/Textures/Packer/packer.js.map +1 -1
- package/Materials/Textures/Procedurals/customProceduralTexture.d.ts +2 -1
- package/Materials/Textures/Procedurals/customProceduralTexture.js.map +1 -1
- package/Materials/Textures/Procedurals/noiseProceduralTexture.js +2 -1
- package/Materials/Textures/Procedurals/noiseProceduralTexture.js.map +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js +7 -4
- package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
- package/Materials/Textures/baseTexture.d.ts +5 -4
- package/Materials/Textures/baseTexture.js +1 -0
- package/Materials/Textures/baseTexture.js.map +1 -1
- package/Materials/Textures/cubeTexture.js +8 -4
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Materials/Textures/hdrCubeTexture.js +4 -2
- package/Materials/Textures/hdrCubeTexture.js.map +1 -1
- package/Materials/Textures/internalTexture.js +4 -2
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/Textures/mirrorTexture.js +6 -3
- package/Materials/Textures/mirrorTexture.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.js +6 -4
- package/Materials/Textures/multiRenderTarget.js.map +1 -1
- package/Materials/Textures/rawTexture.js +1 -1
- package/Materials/Textures/rawTexture.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.js +26 -15
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/texture.js +16 -13
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/Textures/thinRenderTargetTexture.js +4 -2
- package/Materials/Textures/thinRenderTargetTexture.js.map +1 -1
- package/Materials/Textures/thinTexture.d.ts +3 -3
- package/Materials/Textures/thinTexture.js.map +1 -1
- package/Materials/Textures/videoTexture.js +3 -3
- package/Materials/Textures/videoTexture.js.map +1 -1
- package/Materials/drawWrapper.js +4 -2
- package/Materials/drawWrapper.js.map +1 -1
- package/Materials/effect.js +15 -10
- package/Materials/effect.js.map +1 -1
- package/Materials/material.d.ts +14 -0
- package/Materials/material.detailMapConfiguration.js +2 -1
- package/Materials/material.detailMapConfiguration.js.map +1 -1
- package/Materials/material.js +35 -3
- package/Materials/material.js.map +1 -1
- package/Materials/materialDefines.js +6 -5
- package/Materials/materialDefines.js.map +1 -1
- package/Materials/materialHelper.js +1 -1
- package/Materials/materialHelper.js.map +1 -1
- package/Materials/materialPluginManager.js +3 -2
- package/Materials/materialPluginManager.js.map +1 -1
- package/Materials/multiMaterial.js +2 -1
- package/Materials/multiMaterial.js.map +1 -1
- package/Materials/shaderMaterial.js +12 -9
- package/Materials/shaderMaterial.js.map +1 -1
- package/Materials/shadowDepthWrapper.js +13 -8
- package/Materials/shadowDepthWrapper.js.map +1 -1
- package/Materials/standardMaterial.js +12 -10
- package/Materials/standardMaterial.js.map +1 -1
- package/Materials/uniformBuffer.js +1 -1
- package/Materials/uniformBuffer.js.map +1 -1
- package/Maths/math.vector.d.ts +7 -6
- package/Maths/math.vector.js +10 -8
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Builders/groundBuilder.js +1 -1
- package/Meshes/Builders/groundBuilder.js.map +1 -1
- package/Meshes/abstractMesh.js +8 -5
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/csg.js +2 -1
- package/Meshes/csg.js.map +1 -1
- package/Meshes/instancedMesh.js +2 -1
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +1 -1
- package/Meshes/mesh.js +23 -13
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/mesh.vertexData.js +4 -3
- package/Meshes/mesh.vertexData.js.map +1 -1
- package/Meshes/subMesh.js +14 -8
- package/Meshes/subMesh.js.map +1 -1
- package/Meshes/thinInstanceMesh.js +18 -12
- package/Meshes/thinInstanceMesh.js.map +1 -1
- package/Meshes/transformNode.d.ts +7 -1
- package/Meshes/transformNode.js +15 -4
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js +2 -1
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
- package/Misc/PerformanceViewer/performanceViewerCollectionStrategies.js +12 -8
- package/Misc/PerformanceViewer/performanceViewerCollectionStrategies.js.map +1 -1
- package/Misc/PerformanceViewer/performanceViewerCollector.js +3 -2
- package/Misc/PerformanceViewer/performanceViewerCollector.js.map +1 -1
- package/Misc/arrayTools.js +1 -1
- package/Misc/arrayTools.js.map +1 -1
- package/Misc/assetsManager.d.ts +22 -4
- package/Misc/assetsManager.js +20 -8
- package/Misc/assetsManager.js.map +1 -1
- package/Misc/computePressure.js +9 -6
- package/Misc/computePressure.js.map +1 -1
- package/Misc/dataStorage.js +1 -1
- package/Misc/dataStorage.js.map +1 -1
- package/Misc/dds.js +1 -1
- package/Misc/dds.js.map +1 -1
- package/Misc/environmentTextureTools.js +3 -2
- package/Misc/environmentTextureTools.js.map +1 -1
- package/Misc/fileTools.js +31 -8
- package/Misc/fileTools.js.map +1 -1
- package/Misc/logger.js +2 -1
- package/Misc/logger.js.map +1 -1
- package/Misc/minMaxReducer.js +3 -2
- package/Misc/minMaxReducer.js.map +1 -1
- package/Misc/sceneRecorder.js +1 -1
- package/Misc/sceneRecorder.js.map +1 -1
- package/Misc/textureTools.js +3 -3
- package/Misc/textureTools.js.map +1 -1
- package/Misc/timer.js +5 -3
- package/Misc/timer.js.map +1 -1
- package/Misc/tools.js +4 -4
- package/Misc/tools.js.map +1 -1
- package/Misc/trajectoryClassifier.js +3 -3
- package/Misc/trajectoryClassifier.js.map +1 -1
- package/Particles/EmitterTypes/meshParticleEmitter.js +2 -1
- package/Particles/EmitterTypes/meshParticleEmitter.js.map +1 -1
- package/Particles/computeShaderParticleSystem.js +6 -3
- package/Particles/computeShaderParticleSystem.js.map +1 -1
- package/Particles/gpuParticleSystem.js +13 -8
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particleSystem.js +22 -14
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/particleSystemComponent.js +2 -1
- package/Particles/particleSystemComponent.js.map +1 -1
- package/Particles/pointsCloudSystem.js +7 -4
- package/Particles/pointsCloudSystem.js.map +1 -1
- package/Particles/solidParticleSystem.js +2 -2
- package/Particles/solidParticleSystem.js.map +1 -1
- package/Particles/webgl2ParticleSystem.js +2 -1
- package/Particles/webgl2ParticleSystem.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +5 -4
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/postProcessRenderPipeline.d.ts +4 -2
- package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js.map +1 -1
- package/PostProcesses/colorCorrectionPostProcess.js +1 -1
- package/PostProcesses/colorCorrectionPostProcess.js.map +1 -1
- package/PostProcesses/postProcess.js +8 -5
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/postProcessManager.js +6 -4
- package/PostProcesses/postProcessManager.js.map +1 -1
- package/PostProcesses/screenSpaceReflectionPostProcess.js +1 -1
- package/PostProcesses/screenSpaceReflectionPostProcess.js.map +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.js +7 -4
- package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.js +1 -1
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.js.map +1 -1
- package/Probes/reflectionProbe.js +4 -2
- package/Probes/reflectionProbe.js.map +1 -1
- package/Rendering/boundingBoxRenderer.js +3 -2
- package/Rendering/boundingBoxRenderer.js.map +1 -1
- package/Rendering/depthPeelingRenderer.d.ts +12 -0
- package/Rendering/depthPeelingRenderer.js +30 -6
- package/Rendering/depthPeelingRenderer.js.map +1 -1
- package/Rendering/depthPeelingSceneComponent.js +4 -2
- package/Rendering/depthPeelingSceneComponent.js.map +1 -1
- package/Rendering/depthRenderer.js +10 -6
- package/Rendering/depthRenderer.js.map +1 -1
- package/Rendering/edgesRenderer.js +11 -8
- package/Rendering/edgesRenderer.js.map +1 -1
- package/Rendering/outlineRenderer.js +2 -2
- package/Rendering/outlineRenderer.js.map +1 -1
- package/Rendering/prePassRenderer.js +4 -2
- package/Rendering/prePassRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/shadowsFragmentFunctions.js +3 -3
- package/Shaders/ShadersInclude/shadowsFragmentFunctions.js.map +1 -1
- package/Shaders/pbr.fragment.js +4 -1
- package/Shaders/pbr.fragment.js.map +1 -1
- package/Sprites/spriteManager.js +2 -1
- package/Sprites/spriteManager.js.map +1 -1
- package/Sprites/spriteRenderer.js +2 -1
- package/Sprites/spriteRenderer.js.map +1 -1
- package/States/stencilStateComposer.js +4 -2
- package/States/stencilStateComposer.js.map +1 -1
- package/XR/features/WebXRAnchorSystem.js +2 -1
- package/XR/features/WebXRAnchorSystem.js.map +1 -1
- package/XR/features/WebXRControllerMovement.js +7 -6
- package/XR/features/WebXRControllerMovement.js.map +1 -1
- package/XR/features/WebXRControllerPhysics.js +6 -4
- package/XR/features/WebXRControllerPhysics.js.map +1 -1
- package/XR/features/WebXRControllerPointerSelection.js +2 -1
- package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
- package/XR/features/WebXRHandTracking.d.ts +3 -3
- package/XR/features/WebXRHandTracking.js +126 -118
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/XR/features/WebXRHitTest.js.map +1 -1
- package/XR/features/WebXRLayers.js +1 -1
- package/XR/features/WebXRLayers.js.map +1 -1
- package/XR/features/WebXRLightEstimation.js +7 -4
- package/XR/features/WebXRLightEstimation.js.map +1 -1
- package/XR/features/WebXRMeshDetector.js +2 -1
- package/XR/features/WebXRMeshDetector.js.map +1 -1
- package/XR/features/WebXRNearInteraction.js +7 -4
- package/XR/features/WebXRNearInteraction.js.map +1 -1
- package/XR/features/WebXRPlaneDetector.js +2 -1
- package/XR/features/WebXRPlaneDetector.js.map +1 -1
- package/XR/native/nativeXRFrame.js +2 -1
- package/XR/native/nativeXRFrame.js.map +1 -1
- package/XR/webXRCamera.js +2 -1
- package/XR/webXRCamera.js.map +1 -1
- package/XR/webXRExperienceHelper.js +7 -5
- package/XR/webXRExperienceHelper.js.map +1 -1
- package/XR/webXRInput.js.map +1 -1
- package/XR/webXRInputSource.js +2 -1
- package/XR/webXRInputSource.js.map +1 -1
- package/XR/webXRManagedOutputCanvas.js +0 -1
- package/XR/webXRManagedOutputCanvas.js.map +1 -1
- package/XR/webXRSessionManager.js +27 -14
- package/XR/webXRSessionManager.js.map +1 -1
- package/XR/webXRWebGLLayer.js +3 -0
- package/XR/webXRWebGLLayer.js.map +1 -1
- package/package.json +1 -1
- package/scene.js +17 -11
- package/scene.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mirrorTexture.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Materials/Textures/mirrorTexture.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAEnF,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,EA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C,WAAW,CAAC,KAAK,EAAE,CAAC;QAClD,IAAI,IAAI,CAAC,UAAU,EAAE;YACjB,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACpD;QAED,OAAO,UAAU,CAAC;IACtB,CAAC;IAED;;;OAGG;IACI,SAAS;QACZ,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YACZ,OAAO,IAAI,CAAC;SACf;QAED,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAE9C,mBAAmB,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QAE7D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;OAEG;IACI,OAAO;QACV,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE9B,IAAI,KAAK,EAAE;YACP,KAAK,CAAC,4BAA4B,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;SAC3G;QACD,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,CAAC;IAC9B,CAAC;CACJ;AAED,OAAO,CAAC,aAAa,GAAG,CAAC,IAAY,EAAE,gBAAwB,EAAE,KAAY,EAAE,eAAwB,EAAiB,EAAE;IACtH,OAAO,IAAI,aAAa,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC;AAC7E,CAAC,CAAC","sourcesContent":["import type { Observer } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Camera } from \"../../Cameras/camera\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Matrix, Vector3, Vector2 } from \"../../Maths/math.vector\";\r\nimport { Texture } from \"../../Materials/Textures/texture\";\r\nimport { RenderTargetTexture } from \"../../Materials/Textures/renderTargetTexture\";\r\nimport type { ImageProcessingConfiguration } from \"../../Materials/imageProcessingConfiguration\";\r\nimport { BlurPostProcess } from \"../../PostProcesses/blurPostProcess\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { Plane } from \"../../Maths/math.plane\";\r\nimport type { UniformBuffer } from \"../uniformBuffer\";\r\n/**\r\n * Mirror texture can be used to simulate the view from a mirror in a scene.\r\n * It will dynamically be rendered every frame to adapt to the camera point of view.\r\n * You can then easily use it as a reflectionTexture on a flat surface.\r\n * In case the surface is not a plane, please consider relying on reflection probes.\r\n * @see https://doc.babylonjs.com/how_to/reflect#mirrors\r\n */\r\nexport class MirrorTexture extends RenderTargetTexture {\r\n /**\r\n * Define the reflection plane we want to use. The mirrorPlane is usually set to the constructed reflector.\r\n * It is possible to directly set the mirrorPlane by directly using a Plane(a, b, c, d) where a, b and c give the plane normal vector (a, b, c) and d is a scalar displacement from the mirrorPlane to the origin. However in all but the very simplest of situations it is more straight forward to set it to the reflector as stated in the doc.\r\n * @see https://doc.babylonjs.com/how_to/reflect#mirrors\r\n */\r\n public mirrorPlane = new Plane(0, 1, 0, 1);\r\n\r\n /**\r\n * Define the blur ratio used to blur the reflection if needed.\r\n */\r\n public set blurRatio(value: number) {\r\n if (this._blurRatio === value) {\r\n return;\r\n }\r\n\r\n this._blurRatio = value;\r\n this._preparePostProcesses();\r\n }\r\n\r\n public get blurRatio(): number {\r\n return this._blurRatio;\r\n }\r\n\r\n /**\r\n * Define the adaptive blur kernel used to blur the reflection if needed.\r\n * This will autocompute the closest best match for the `blurKernel`\r\n */\r\n public set adaptiveBlurKernel(value: number) {\r\n this._adaptiveBlurKernel = value;\r\n this._autoComputeBlurKernel();\r\n }\r\n\r\n /**\r\n * Define the blur kernel used to blur the reflection if needed.\r\n * Please consider using `adaptiveBlurKernel` as it could find the closest best value for you.\r\n */\r\n public set blurKernel(value: number) {\r\n this.blurKernelX = value;\r\n this.blurKernelY = value;\r\n }\r\n\r\n /**\r\n * Define the blur kernel on the X Axis used to blur the reflection if needed.\r\n * Please consider using `adaptiveBlurKernel` as it could find the closest best value for you.\r\n */\r\n public set blurKernelX(value: number) {\r\n if (this._blurKernelX === value) {\r\n return;\r\n }\r\n\r\n this._blurKernelX = value;\r\n this._preparePostProcesses();\r\n }\r\n\r\n public get blurKernelX(): number {\r\n return this._blurKernelX;\r\n }\r\n\r\n /**\r\n * Define the blur kernel on the Y Axis used to blur the reflection if needed.\r\n * Please consider using `adaptiveBlurKernel` as it could find the closest best value for you.\r\n */\r\n public set blurKernelY(value: number) {\r\n if (this._blurKernelY === value) {\r\n return;\r\n }\r\n\r\n this._blurKernelY = value;\r\n this._preparePostProcesses();\r\n }\r\n\r\n public get blurKernelY(): number {\r\n return this._blurKernelY;\r\n }\r\n\r\n private _autoComputeBlurKernel(): void {\r\n const engine = this.getScene()!.getEngine();\r\n\r\n const dw = this.getRenderWidth() / engine.getRenderWidth();\r\n const dh = this.getRenderHeight() / engine.getRenderHeight();\r\n this.blurKernelX = this._adaptiveBlurKernel * dw;\r\n this.blurKernelY = this._adaptiveBlurKernel * dh;\r\n }\r\n\r\n protected _onRatioRescale(): void {\r\n if (this._sizeRatio) {\r\n this.resize(this._initialSizeParameter);\r\n if (!this._adaptiveBlurKernel) {\r\n this._preparePostProcesses();\r\n }\r\n }\r\n\r\n if (this._adaptiveBlurKernel) {\r\n this._autoComputeBlurKernel();\r\n }\r\n }\r\n\r\n private _updateGammaSpace() {\r\n const scene = this.getScene();\r\n\r\n if (!scene) {\r\n return;\r\n }\r\n\r\n this.gammaSpace = !scene.imageProcessingConfiguration.isEnabled || !scene.imageProcessingConfiguration.applyByPostProcess;\r\n }\r\n\r\n private _imageProcessingConfigChangeObserver: Nullable<Observer<ImageProcessingConfiguration>>;\r\n\r\n private _transformMatrix = Matrix.Zero();\r\n private _mirrorMatrix = Matrix.Zero();\r\n\r\n private _blurX: Nullable<BlurPostProcess>;\r\n private _blurY: Nullable<BlurPostProcess>;\r\n private _adaptiveBlurKernel = 0;\r\n private _blurKernelX = 0;\r\n private _blurKernelY = 0;\r\n private _blurRatio = 1.0;\r\n private _sceneUBO: UniformBuffer;\r\n private _currentSceneUBO: UniformBuffer;\r\n\r\n /**\r\n * Instantiates a Mirror Texture.\r\n * Mirror texture can be used to simulate the view from a mirror in a scene.\r\n * It will dynamically be rendered every frame to adapt to the camera point of view.\r\n * You can then easily use it as a reflectionTexture on a flat surface.\r\n * In case the surface is not a plane, please consider relying on reflection probes.\r\n * @see https://doc.babylonjs.com/how_to/reflect#mirrors\r\n * @param name\r\n * @param size\r\n * @param scene\r\n * @param generateMipMaps\r\n * @param type\r\n * @param samplingMode\r\n * @param generateDepthBuffer\r\n */\r\n constructor(\r\n name: string,\r\n size: number | { width: number; height: number } | { ratio: number },\r\n scene?: Scene,\r\n generateMipMaps?: boolean,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n samplingMode = Texture.BILINEAR_SAMPLINGMODE,\r\n generateDepthBuffer = true\r\n ) {\r\n super(name, size, scene, generateMipMaps, true, type, false, samplingMode, generateDepthBuffer);\r\n\r\n scene = <Scene>this.getScene();\r\n\r\n if (!scene) {\r\n return this;\r\n }\r\n this.ignoreCameraViewport = true;\r\n\r\n this._updateGammaSpace();\r\n this._imageProcessingConfigChangeObserver = scene.imageProcessingConfiguration.onUpdateParameters.add(() => {\r\n this._updateGammaSpace();\r\n });\r\n\r\n const engine = scene.getEngine();\r\n\r\n if (engine.supportsUniformBuffers) {\r\n this._sceneUBO = scene.createSceneUniformBuffer(`Scene for Mirror Texture (name \"${name}\")`);\r\n }\r\n\r\n this.onBeforeBindObservable.add(() => {\r\n engine._debugPushGroup?.(`mirror generation for ${name}`, 1);\r\n });\r\n\r\n this.onAfterUnbindObservable.add(() => {\r\n engine._debugPopGroup?.(1);\r\n });\r\n\r\n let saveClipPlane: Nullable<Plane>;\r\n\r\n this.onBeforeRenderObservable.add(() => {\r\n if (this._sceneUBO) {\r\n this._currentSceneUBO = scene!.getSceneUniformBuffer();\r\n scene!.setSceneUniformBuffer(this._sceneUBO);\r\n scene!.getSceneUniformBuffer().unbindEffect();\r\n }\r\n\r\n Matrix.ReflectionToRef(this.mirrorPlane, this._mirrorMatrix);\r\n this._mirrorMatrix.multiplyToRef(scene!.getViewMatrix(), this._transformMatrix);\r\n\r\n scene!.setTransformMatrix(this._transformMatrix, scene!.getProjectionMatrix());\r\n\r\n saveClipPlane = scene!.clipPlane;\r\n scene!.clipPlane = this.mirrorPlane;\r\n\r\n scene!.getEngine().cullBackFaces = false;\r\n\r\n scene!._mirroredCameraPosition = Vector3.TransformCoordinates((<Camera>scene!.activeCamera).globalPosition, this._mirrorMatrix);\r\n });\r\n\r\n this.onAfterRenderObservable.add(() => {\r\n if (this._sceneUBO) {\r\n scene!.setSceneUniformBuffer(this._currentSceneUBO);\r\n }\r\n scene!.updateTransformMatrix();\r\n scene!.getEngine().cullBackFaces = null;\r\n scene!._mirroredCameraPosition = null;\r\n\r\n scene!.clipPlane = saveClipPlane;\r\n });\r\n }\r\n\r\n private _preparePostProcesses(): void {\r\n this.clearPostProcesses(true);\r\n\r\n if (this._blurKernelX && this._blurKernelY) {\r\n const engine = (<Scene>this.getScene()).getEngine();\r\n\r\n const textureType =\r\n engine.getCaps().textureFloatRender && engine.getCaps().textureFloatLinearFiltering ? Constants.TEXTURETYPE_FLOAT : Constants.TEXTURETYPE_HALF_FLOAT;\r\n\r\n this._blurX = new BlurPostProcess(\r\n \"horizontal blur\",\r\n new Vector2(1.0, 0),\r\n this._blurKernelX,\r\n this._blurRatio,\r\n null,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n engine,\r\n false,\r\n textureType\r\n );\r\n this._blurX.autoClear = false;\r\n\r\n if (this._blurRatio === 1 && this.samples < 2 && this._texture) {\r\n this._blurX.inputTexture = this._renderTarget!;\r\n } else {\r\n this._blurX.alwaysForcePOT = true;\r\n }\r\n\r\n this._blurY = new BlurPostProcess(\r\n \"vertical blur\",\r\n new Vector2(0, 1.0),\r\n this._blurKernelY,\r\n this._blurRatio,\r\n null,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n engine,\r\n false,\r\n textureType\r\n );\r\n this._blurY.autoClear = false;\r\n this._blurY.alwaysForcePOT = this._blurRatio !== 1;\r\n\r\n this.addPostProcess(this._blurX);\r\n this.addPostProcess(this._blurY);\r\n } else {\r\n if (this._blurY) {\r\n this.removePostProcess(this._blurY);\r\n this._blurY.dispose();\r\n this._blurY = null;\r\n }\r\n if (this._blurX) {\r\n this.removePostProcess(this._blurX);\r\n this._blurX.dispose();\r\n this._blurX = null;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clone the mirror texture.\r\n * @returns the cloned texture\r\n */\r\n public clone(): MirrorTexture {\r\n const scene = this.getScene();\r\n\r\n if (!scene) {\r\n return this;\r\n }\r\n\r\n const textureSize = this.getSize();\r\n const newTexture = new MirrorTexture(\r\n this.name,\r\n textureSize.width,\r\n scene,\r\n this._renderTargetOptions.generateMipMaps,\r\n this._renderTargetOptions.type,\r\n this._renderTargetOptions.samplingMode,\r\n this._renderTargetOptions.generateDepthBuffer\r\n );\r\n\r\n // Base texture\r\n newTexture.hasAlpha = this.hasAlpha;\r\n newTexture.level = this.level;\r\n\r\n // Mirror Texture\r\n newTexture.mirrorPlane = this.mirrorPlane.clone();\r\n if (this.renderList) {\r\n newTexture.renderList = this.renderList.slice(0);\r\n }\r\n\r\n return newTexture;\r\n }\r\n\r\n /**\r\n * Serialize the texture to a JSON representation you could use in Parse later on\r\n * @returns the serialized JSON representation\r\n */\r\n public serialize(): any {\r\n if (!this.name) {\r\n return null;\r\n }\r\n\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.mirrorPlane = this.mirrorPlane.asArray();\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n public dispose() {\r\n super.dispose();\r\n const scene = this.getScene();\r\n\r\n if (scene) {\r\n scene.imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingConfigChangeObserver);\r\n }\r\n this._sceneUBO?.dispose();\r\n }\r\n}\r\n\r\nTexture._CreateMirror = (name: string, renderTargetSize: number, scene: Scene, generateMipMaps: boolean): MirrorTexture => {\r\n return new MirrorTexture(name, renderTargetSize, scene, generateMipMaps);\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"mirrorTexture.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Materials/Textures/mirrorTexture.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAEnF,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,OAAO,aAAc,SAAQ,mBAAmB;IA0HlD;;;;;;;;;;;;;;OAcG;IACH,YACI,IAAY,EACZ,IAAoE,EACpE,KAAa,EACb,eAAyB,EACzB,OAAe,SAAS,CAAC,wBAAwB,EACjD,YAAY,GAAG,OAAO,CAAC,qBAAqB,EAC5C,mBAAmB,GAAG,IAAI;QAE1B,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,mBAAmB,CAAC,CAAC;QAjJpG;;;;WAIG;QACI,gBAAW,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAwGnC,qBAAgB,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;QACjC,kBAAa,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;QAI9B,wBAAmB,GAAG,CAAC,CAAC;QACxB,iBAAY,GAAG,CAA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I,CAAC,oCAAoC,CAAC,CAAC;SAC3G;QACD,MAAA,IAAI,CAAC,SAAS,0CAAE,OAAO,EAAE,CAAC;IAC9B,CAAC;CACJ;AAED,OAAO,CAAC,aAAa,GAAG,CAAC,IAAY,EAAE,gBAAwB,EAAE,KAAY,EAAE,eAAwB,EAAiB,EAAE;IACtH,OAAO,IAAI,aAAa,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC;AAC7E,CAAC,CAAC","sourcesContent":["import type { Observer } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Camera } from \"../../Cameras/camera\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Matrix, Vector3, Vector2 } from \"../../Maths/math.vector\";\r\nimport { Texture } from \"../../Materials/Textures/texture\";\r\nimport { RenderTargetTexture } from \"../../Materials/Textures/renderTargetTexture\";\r\nimport type { ImageProcessingConfiguration } from \"../../Materials/imageProcessingConfiguration\";\r\nimport { BlurPostProcess } from \"../../PostProcesses/blurPostProcess\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport { Plane } from \"../../Maths/math.plane\";\r\nimport type { UniformBuffer } from \"../uniformBuffer\";\r\n/**\r\n * Mirror texture can be used to simulate the view from a mirror in a scene.\r\n * It will dynamically be rendered every frame to adapt to the camera point of view.\r\n * You can then easily use it as a reflectionTexture on a flat surface.\r\n * In case the surface is not a plane, please consider relying on reflection probes.\r\n * @see https://doc.babylonjs.com/how_to/reflect#mirrors\r\n */\r\nexport class MirrorTexture extends RenderTargetTexture {\r\n /**\r\n * Define the reflection plane we want to use. The mirrorPlane is usually set to the constructed reflector.\r\n * It is possible to directly set the mirrorPlane by directly using a Plane(a, b, c, d) where a, b and c give the plane normal vector (a, b, c) and d is a scalar displacement from the mirrorPlane to the origin. However in all but the very simplest of situations it is more straight forward to set it to the reflector as stated in the doc.\r\n * @see https://doc.babylonjs.com/how_to/reflect#mirrors\r\n */\r\n public mirrorPlane = new Plane(0, 1, 0, 1);\r\n\r\n /**\r\n * Define the blur ratio used to blur the reflection if needed.\r\n */\r\n public set blurRatio(value: number) {\r\n if (this._blurRatio === value) {\r\n return;\r\n }\r\n\r\n this._blurRatio = value;\r\n this._preparePostProcesses();\r\n }\r\n\r\n public get blurRatio(): number {\r\n return this._blurRatio;\r\n }\r\n\r\n /**\r\n * Define the adaptive blur kernel used to blur the reflection if needed.\r\n * This will autocompute the closest best match for the `blurKernel`\r\n */\r\n public set adaptiveBlurKernel(value: number) {\r\n this._adaptiveBlurKernel = value;\r\n this._autoComputeBlurKernel();\r\n }\r\n\r\n /**\r\n * Define the blur kernel used to blur the reflection if needed.\r\n * Please consider using `adaptiveBlurKernel` as it could find the closest best value for you.\r\n */\r\n public set blurKernel(value: number) {\r\n this.blurKernelX = value;\r\n this.blurKernelY = value;\r\n }\r\n\r\n /**\r\n * Define the blur kernel on the X Axis used to blur the reflection if needed.\r\n * Please consider using `adaptiveBlurKernel` as it could find the closest best value for you.\r\n */\r\n public set blurKernelX(value: number) {\r\n if (this._blurKernelX === value) {\r\n return;\r\n }\r\n\r\n this._blurKernelX = value;\r\n this._preparePostProcesses();\r\n }\r\n\r\n public get blurKernelX(): number {\r\n return this._blurKernelX;\r\n }\r\n\r\n /**\r\n * Define the blur kernel on the Y Axis used to blur the reflection if needed.\r\n * Please consider using `adaptiveBlurKernel` as it could find the closest best value for you.\r\n */\r\n public set blurKernelY(value: number) {\r\n if (this._blurKernelY === value) {\r\n return;\r\n }\r\n\r\n this._blurKernelY = value;\r\n this._preparePostProcesses();\r\n }\r\n\r\n public get blurKernelY(): number {\r\n return this._blurKernelY;\r\n }\r\n\r\n private _autoComputeBlurKernel(): void {\r\n const engine = this.getScene()!.getEngine();\r\n\r\n const dw = this.getRenderWidth() / engine.getRenderWidth();\r\n const dh = this.getRenderHeight() / engine.getRenderHeight();\r\n this.blurKernelX = this._adaptiveBlurKernel * dw;\r\n this.blurKernelY = this._adaptiveBlurKernel * dh;\r\n }\r\n\r\n protected _onRatioRescale(): void {\r\n if (this._sizeRatio) {\r\n this.resize(this._initialSizeParameter);\r\n if (!this._adaptiveBlurKernel) {\r\n this._preparePostProcesses();\r\n }\r\n }\r\n\r\n if (this._adaptiveBlurKernel) {\r\n this._autoComputeBlurKernel();\r\n }\r\n }\r\n\r\n private _updateGammaSpace() {\r\n const scene = this.getScene();\r\n\r\n if (!scene) {\r\n return;\r\n }\r\n\r\n this.gammaSpace = !scene.imageProcessingConfiguration.isEnabled || !scene.imageProcessingConfiguration.applyByPostProcess;\r\n }\r\n\r\n private _imageProcessingConfigChangeObserver: Nullable<Observer<ImageProcessingConfiguration>>;\r\n\r\n private _transformMatrix = Matrix.Zero();\r\n private _mirrorMatrix = Matrix.Zero();\r\n\r\n private _blurX: Nullable<BlurPostProcess>;\r\n private _blurY: Nullable<BlurPostProcess>;\r\n private _adaptiveBlurKernel = 0;\r\n private _blurKernelX = 0;\r\n private _blurKernelY = 0;\r\n private _blurRatio = 1.0;\r\n private _sceneUBO: UniformBuffer;\r\n private _currentSceneUBO: UniformBuffer;\r\n\r\n /**\r\n * Instantiates a Mirror Texture.\r\n * Mirror texture can be used to simulate the view from a mirror in a scene.\r\n * It will dynamically be rendered every frame to adapt to the camera point of view.\r\n * You can then easily use it as a reflectionTexture on a flat surface.\r\n * In case the surface is not a plane, please consider relying on reflection probes.\r\n * @see https://doc.babylonjs.com/how_to/reflect#mirrors\r\n * @param name\r\n * @param size\r\n * @param scene\r\n * @param generateMipMaps\r\n * @param type\r\n * @param samplingMode\r\n * @param generateDepthBuffer\r\n */\r\n constructor(\r\n name: string,\r\n size: number | { width: number; height: number } | { ratio: number },\r\n scene?: Scene,\r\n generateMipMaps?: boolean,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n samplingMode = Texture.BILINEAR_SAMPLINGMODE,\r\n generateDepthBuffer = true\r\n ) {\r\n super(name, size, scene, generateMipMaps, true, type, false, samplingMode, generateDepthBuffer);\r\n\r\n scene = <Scene>this.getScene();\r\n\r\n if (!scene) {\r\n return this;\r\n }\r\n this.ignoreCameraViewport = true;\r\n\r\n this._updateGammaSpace();\r\n this._imageProcessingConfigChangeObserver = scene.imageProcessingConfiguration.onUpdateParameters.add(() => {\r\n this._updateGammaSpace();\r\n });\r\n\r\n const engine = scene.getEngine();\r\n\r\n if (engine.supportsUniformBuffers) {\r\n this._sceneUBO = scene.createSceneUniformBuffer(`Scene for Mirror Texture (name \"${name}\")`);\r\n }\r\n\r\n this.onBeforeBindObservable.add(() => {\r\n engine._debugPushGroup?.(`mirror generation for ${name}`, 1);\r\n });\r\n\r\n this.onAfterUnbindObservable.add(() => {\r\n engine._debugPopGroup?.(1);\r\n });\r\n\r\n let saveClipPlane: Nullable<Plane>;\r\n\r\n this.onBeforeRenderObservable.add(() => {\r\n if (this._sceneUBO) {\r\n this._currentSceneUBO = scene!.getSceneUniformBuffer();\r\n scene!.setSceneUniformBuffer(this._sceneUBO);\r\n scene!.getSceneUniformBuffer().unbindEffect();\r\n }\r\n\r\n Matrix.ReflectionToRef(this.mirrorPlane, this._mirrorMatrix);\r\n this._mirrorMatrix.multiplyToRef(scene!.getViewMatrix(), this._transformMatrix);\r\n\r\n scene!.setTransformMatrix(this._transformMatrix, scene!.getProjectionMatrix());\r\n\r\n saveClipPlane = scene!.clipPlane;\r\n scene!.clipPlane = this.mirrorPlane;\r\n\r\n scene!.getEngine().cullBackFaces = false;\r\n\r\n scene!._mirroredCameraPosition = Vector3.TransformCoordinates((<Camera>scene!.activeCamera).globalPosition, this._mirrorMatrix);\r\n });\r\n\r\n this.onAfterRenderObservable.add(() => {\r\n if (this._sceneUBO) {\r\n scene!.setSceneUniformBuffer(this._currentSceneUBO);\r\n }\r\n scene!.updateTransformMatrix();\r\n scene!.getEngine().cullBackFaces = null;\r\n scene!._mirroredCameraPosition = null;\r\n\r\n scene!.clipPlane = saveClipPlane;\r\n });\r\n }\r\n\r\n private _preparePostProcesses(): void {\r\n this.clearPostProcesses(true);\r\n\r\n if (this._blurKernelX && this._blurKernelY) {\r\n const engine = (<Scene>this.getScene()).getEngine();\r\n\r\n const textureType =\r\n engine.getCaps().textureFloatRender && engine.getCaps().textureFloatLinearFiltering ? Constants.TEXTURETYPE_FLOAT : Constants.TEXTURETYPE_HALF_FLOAT;\r\n\r\n this._blurX = new BlurPostProcess(\r\n \"horizontal blur\",\r\n new Vector2(1.0, 0),\r\n this._blurKernelX,\r\n this._blurRatio,\r\n null,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n engine,\r\n false,\r\n textureType\r\n );\r\n this._blurX.autoClear = false;\r\n\r\n if (this._blurRatio === 1 && this.samples < 2 && this._texture) {\r\n this._blurX.inputTexture = this._renderTarget!;\r\n } else {\r\n this._blurX.alwaysForcePOT = true;\r\n }\r\n\r\n this._blurY = new BlurPostProcess(\r\n \"vertical blur\",\r\n new Vector2(0, 1.0),\r\n this._blurKernelY,\r\n this._blurRatio,\r\n null,\r\n Texture.BILINEAR_SAMPLINGMODE,\r\n engine,\r\n false,\r\n textureType\r\n );\r\n this._blurY.autoClear = false;\r\n this._blurY.alwaysForcePOT = this._blurRatio !== 1;\r\n\r\n this.addPostProcess(this._blurX);\r\n this.addPostProcess(this._blurY);\r\n } else {\r\n if (this._blurY) {\r\n this.removePostProcess(this._blurY);\r\n this._blurY.dispose();\r\n this._blurY = null;\r\n }\r\n if (this._blurX) {\r\n this.removePostProcess(this._blurX);\r\n this._blurX.dispose();\r\n this._blurX = null;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clone the mirror texture.\r\n * @returns the cloned texture\r\n */\r\n public clone(): MirrorTexture {\r\n const scene = this.getScene();\r\n\r\n if (!scene) {\r\n return this;\r\n }\r\n\r\n const textureSize = this.getSize();\r\n const newTexture = new MirrorTexture(\r\n this.name,\r\n textureSize.width,\r\n scene,\r\n this._renderTargetOptions.generateMipMaps,\r\n this._renderTargetOptions.type,\r\n this._renderTargetOptions.samplingMode,\r\n this._renderTargetOptions.generateDepthBuffer\r\n );\r\n\r\n // Base texture\r\n newTexture.hasAlpha = this.hasAlpha;\r\n newTexture.level = this.level;\r\n\r\n // Mirror Texture\r\n newTexture.mirrorPlane = this.mirrorPlane.clone();\r\n if (this.renderList) {\r\n newTexture.renderList = this.renderList.slice(0);\r\n }\r\n\r\n return newTexture;\r\n }\r\n\r\n /**\r\n * Serialize the texture to a JSON representation you could use in Parse later on\r\n * @returns the serialized JSON representation\r\n */\r\n public serialize(): any {\r\n if (!this.name) {\r\n return null;\r\n }\r\n\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.mirrorPlane = this.mirrorPlane.asArray();\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Dispose the texture and release its associated resources.\r\n */\r\n public dispose() {\r\n super.dispose();\r\n const scene = this.getScene();\r\n\r\n if (scene) {\r\n scene.imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingConfigChangeObserver);\r\n }\r\n this._sceneUBO?.dispose();\r\n }\r\n}\r\n\r\nTexture._CreateMirror = (name: string, renderTargetSize: number, scene: Scene, generateMipMaps: boolean): MirrorTexture => {\r\n return new MirrorTexture(name, renderTargetSize, scene, generateMipMaps);\r\n};\r\n"]}
|
|
@@ -62,7 +62,8 @@ export class MultiRenderTarget extends RenderTargetTexture {
|
|
|
62
62
|
* Get if draw buffers are currently supported by the used hardware and browser.
|
|
63
63
|
*/
|
|
64
64
|
get isSupported() {
|
|
65
|
-
|
|
65
|
+
var _a, _b;
|
|
66
|
+
return (_b = (_a = this._engine) === null || _a === void 0 ? void 0 : _a.getCaps().drawBuffersExtension) !== null && _b !== void 0 ? _b : false;
|
|
66
67
|
}
|
|
67
68
|
/**
|
|
68
69
|
* Get the list of textures generated by the multi render target.
|
|
@@ -165,7 +166,7 @@ export class MultiRenderTarget extends RenderTargetTexture {
|
|
|
165
166
|
this._textures = [];
|
|
166
167
|
for (let i = 0; i < internalTextures.length; i++) {
|
|
167
168
|
const texture = new Texture(null, this.getScene());
|
|
168
|
-
if (textureNames
|
|
169
|
+
if (textureNames === null || textureNames === void 0 ? void 0 : textureNames[i]) {
|
|
169
170
|
texture.name = textureNames[i];
|
|
170
171
|
}
|
|
171
172
|
texture._texture = internalTextures[i];
|
|
@@ -270,14 +271,15 @@ export class MultiRenderTarget extends RenderTargetTexture {
|
|
|
270
271
|
* Release all the underlying texture used as draw buffers.
|
|
271
272
|
*/
|
|
272
273
|
releaseInternalTextures() {
|
|
273
|
-
|
|
274
|
+
var _a, _b;
|
|
275
|
+
const internalTextures = (_a = this._renderTarget) === null || _a === void 0 ? void 0 : _a.textures;
|
|
274
276
|
if (!internalTextures) {
|
|
275
277
|
return;
|
|
276
278
|
}
|
|
277
279
|
for (let i = internalTextures.length - 1; i >= 0; i--) {
|
|
278
280
|
this._textures[i]._texture = null;
|
|
279
281
|
}
|
|
280
|
-
this._renderTarget
|
|
282
|
+
(_b = this._renderTarget) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
281
283
|
this._renderTarget = null;
|
|
282
284
|
}
|
|
283
285
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiRenderTarget.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Materials/Textures/multiRenderTarget.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,6CAA6C,CAAC;AAyDrD;;;;;GAKG;AACH,MAAM,OAAO,iBAAkB,SAAQ,mBAAmB;IA0DtD;;;;;;;;;;;;OAYG;IACH,YAAY,IAAY,EAAE,IAAS,EAAE,KAAa,EAAE,KAAa,EAAE,OAAmC,EAAE,YAAuB;QAC3H,MAAM,eAAe,GAAG,OAAO,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC;QA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C,OAAO,EAAE,CAAC;IACpB,CAAC;IAED;;OAEG;IACI,uBAAuB;QAC1B,MAAM,gBAAgB,GAAG,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC;QAEtD,IAAI,CAAC,gBAAgB,EAAE;YACnB,OAAO;SACV;QAED,KAAK,IAAI,CAAC,GAAG,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;YACnD,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,IAAI,CAAC;SACrC;QAED,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,CAAC;QAC9B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAC9B,CAAC;CACJ","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport type { Engine } from \"../../Engines/engine\";\r\nimport { Texture } from \"../../Materials/Textures/texture\";\r\nimport { RenderTargetTexture } from \"../../Materials/Textures/renderTargetTexture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\n\r\nimport \"../../Engines/Extensions/engine.multiRender\";\r\nimport type { InternalTexture } from \"./internalTexture\";\r\n\r\n/**\r\n * Creation options of the multi render target texture.\r\n */\r\nexport interface IMultiRenderTargetOptions {\r\n /**\r\n * Define if the texture needs to create mip maps after render.\r\n */\r\n generateMipMaps?: boolean;\r\n /**\r\n * Define the types of all the draw buffers we want to create\r\n */\r\n types?: number[];\r\n /**\r\n * Define the sampling modes of all the draw buffers we want to create\r\n */\r\n samplingModes?: number[];\r\n /**\r\n * Define if sRGB format should be used for each of the draw buffers we want to create\r\n */\r\n useSRGBBuffers?: boolean[];\r\n /**\r\n * Define if a depth buffer is required\r\n */\r\n generateDepthBuffer?: boolean;\r\n /**\r\n * Define if a stencil buffer is required\r\n */\r\n generateStencilBuffer?: boolean;\r\n /**\r\n * Define if a depth texture is required instead of a depth buffer\r\n */\r\n generateDepthTexture?: boolean;\r\n /**\r\n * Define depth texture format to use\r\n */\r\n depthTextureFormat?: number;\r\n /**\r\n * Define the number of desired draw buffers\r\n */\r\n textureCount?: number;\r\n /**\r\n * Define if aspect ratio should be adapted to the texture or stay the scene one\r\n */\r\n doNotChangeAspectRatio?: boolean;\r\n /**\r\n * Define the default type of the buffers we are creating\r\n */\r\n defaultType?: number;\r\n /**\r\n * Define the default type of the buffers we are creating\r\n */\r\n drawOnlyOnFirstAttachmentByDefault?: boolean;\r\n}\r\n\r\n/**\r\n * A multi render target, like a render target provides the ability to render to a texture.\r\n * Unlike the render target, it can render to several draw buffers in one draw.\r\n * This is specially interesting in deferred rendering or for any effects requiring more than\r\n * just one color from a single pass.\r\n */\r\nexport class MultiRenderTarget extends RenderTargetTexture {\r\n private _textures: Texture[];\r\n private _multiRenderTargetOptions: IMultiRenderTargetOptions;\r\n private _count: number;\r\n private _drawOnlyOnFirstAttachmentByDefault: boolean;\r\n\r\n /**\r\n * Get if draw buffers are currently supported by the used hardware and browser.\r\n */\r\n public get isSupported(): boolean {\r\n return this._engine?.getCaps().drawBuffersExtension ?? false;\r\n }\r\n\r\n /**\r\n * Get the list of textures generated by the multi render target.\r\n */\r\n public get textures(): Texture[] {\r\n return this._textures;\r\n }\r\n\r\n /**\r\n * Gets the number of textures in this MRT. This number can be different from `_textures.length` in case a depth texture is generated.\r\n */\r\n public get count(): number {\r\n return this._count;\r\n }\r\n\r\n /**\r\n * Get the depth texture generated by the multi render target if options.generateDepthTexture has been set\r\n */\r\n public get depthTexture(): Texture {\r\n return this._textures[this._textures.length - 1];\r\n }\r\n\r\n /**\r\n * Set the wrapping mode on U of all the textures we are rendering to.\r\n * Can be any of the Texture. (CLAMP_ADDRESSMODE, MIRROR_ADDRESSMODE or WRAP_ADDRESSMODE)\r\n */\r\n public set wrapU(wrap: number) {\r\n if (this._textures) {\r\n for (let i = 0; i < this._textures.length; i++) {\r\n this._textures[i].wrapU = wrap;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Set the wrapping mode on V of all the textures we are rendering to.\r\n * Can be any of the Texture. (CLAMP_ADDRESSMODE, MIRROR_ADDRESSMODE or WRAP_ADDRESSMODE)\r\n */\r\n public set wrapV(wrap: number) {\r\n if (this._textures) {\r\n for (let i = 0; i < this._textures.length; i++) {\r\n this._textures[i].wrapV = wrap;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Instantiate a new multi render target texture.\r\n * A multi render target, like a render target provides the ability to render to a texture.\r\n * Unlike the render target, it can render to several draw buffers in one draw.\r\n * This is specially interesting in deferred rendering or for any effects requiring more than\r\n * just one color from a single pass.\r\n * @param name Define the name of the texture\r\n * @param size Define the size of the buffers to render to\r\n * @param count Define the number of target we are rendering into\r\n * @param scene Define the scene the texture belongs to\r\n * @param options Define the options used to create the multi render target\r\n * @param textureNames Define the names to set to the textures (if count > 0 - optional)\r\n */\r\n constructor(name: string, size: any, count: number, scene?: Scene, options?: IMultiRenderTargetOptions, textureNames?: string[]) {\r\n const generateMipMaps = options && options.generateMipMaps ? options.generateMipMaps : false;\r\n const generateDepthTexture = options && options.generateDepthTexture ? options.generateDepthTexture : false;\r\n const depthTextureFormat = options && options.depthTextureFormat ? options.depthTextureFormat : Constants.TEXTUREFORMAT_DEPTH16;\r\n const doNotChangeAspectRatio = !options || options.doNotChangeAspectRatio === undefined ? true : options.doNotChangeAspectRatio;\r\n const drawOnlyOnFirstAttachmentByDefault = options && options.drawOnlyOnFirstAttachmentByDefault ? options.drawOnlyOnFirstAttachmentByDefault : false;\r\n super(name, size, scene, generateMipMaps, doNotChangeAspectRatio, undefined, undefined, undefined, undefined, undefined, undefined, undefined, true);\r\n\r\n if (!this.isSupported) {\r\n this.dispose();\r\n return;\r\n }\r\n\r\n const types: number[] = [];\r\n const samplingModes: number[] = [];\r\n const useSRGBBuffers: boolean[] = [];\r\n this._initTypes(count, types, samplingModes, useSRGBBuffers, options);\r\n\r\n const generateDepthBuffer = !options || options.generateDepthBuffer === undefined ? true : options.generateDepthBuffer;\r\n const generateStencilBuffer = !options || options.generateStencilBuffer === undefined ? false : options.generateStencilBuffer;\r\n\r\n this._size = size;\r\n this._multiRenderTargetOptions = {\r\n samplingModes: samplingModes,\r\n generateMipMaps: generateMipMaps,\r\n generateDepthBuffer: generateDepthBuffer,\r\n generateStencilBuffer: generateStencilBuffer,\r\n generateDepthTexture: generateDepthTexture,\r\n depthTextureFormat: depthTextureFormat,\r\n types: types,\r\n textureCount: count,\r\n useSRGBBuffers: useSRGBBuffers,\r\n };\r\n\r\n this._count = count;\r\n this._drawOnlyOnFirstAttachmentByDefault = drawOnlyOnFirstAttachmentByDefault;\r\n\r\n if (count > 0) {\r\n this._createInternalTextures();\r\n this._createTextures(textureNames);\r\n }\r\n }\r\n\r\n private _initTypes(count: number, types: number[], samplingModes: number[], useSRGBBuffers: boolean[], options?: IMultiRenderTargetOptions) {\r\n for (let i = 0; i < count; i++) {\r\n if (options && options.types && options.types[i] !== undefined) {\r\n types.push(options.types[i]);\r\n } else {\r\n types.push(options && options.defaultType ? options.defaultType : Constants.TEXTURETYPE_UNSIGNED_INT);\r\n }\r\n\r\n if (options && options.samplingModes && options.samplingModes[i] !== undefined) {\r\n samplingModes.push(options.samplingModes[i]);\r\n } else {\r\n samplingModes.push(Texture.BILINEAR_SAMPLINGMODE);\r\n }\r\n\r\n if (options && options.useSRGBBuffers && options.useSRGBBuffers[i] !== undefined) {\r\n useSRGBBuffers.push(options.useSRGBBuffers[i]);\r\n } else {\r\n useSRGBBuffers.push(false);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _rebuild(forceFullRebuild: boolean = false, textureNames?: string[]): void {\r\n if (this._count < 1) {\r\n return;\r\n }\r\n\r\n this.releaseInternalTextures();\r\n this._createInternalTextures();\r\n\r\n if (forceFullRebuild) {\r\n this._releaseTextures();\r\n this._createTextures(textureNames);\r\n }\r\n\r\n const internalTextures = this._renderTarget!.textures!;\r\n for (let i = 0; i < internalTextures.length; i++) {\r\n const texture = this._textures[i];\r\n texture._texture = internalTextures[i];\r\n }\r\n\r\n if (this.samples !== 1) {\r\n this._renderTarget!.setSamples(this.samples, !this._drawOnlyOnFirstAttachmentByDefault, true);\r\n }\r\n }\r\n\r\n private _createInternalTextures(): void {\r\n this._renderTarget = this._getEngine()!.createMultipleRenderTarget(this._size, this._multiRenderTargetOptions, !this._drawOnlyOnFirstAttachmentByDefault);\r\n this._texture = this._renderTarget.texture;\r\n }\r\n\r\n private _releaseTextures(): void {\r\n if (this._textures) {\r\n for (let i = 0; i < this._textures.length; i++) {\r\n this._textures[i]._texture = null; // internal textures are released by a call to releaseInternalTextures()\r\n this._textures[i].dispose();\r\n }\r\n }\r\n }\r\n\r\n private _createTextures(textureNames?: string[]): void {\r\n const internalTextures = this._renderTarget!.textures!;\r\n this._textures = [];\r\n for (let i = 0; i < internalTextures.length; i++) {\r\n const texture = new Texture(null, this.getScene());\r\n if (textureNames?.[i]) {\r\n texture.name = textureNames[i];\r\n }\r\n texture._texture = internalTextures[i];\r\n this._textures.push(texture);\r\n }\r\n }\r\n\r\n /**\r\n * Replaces an internal texture within the MRT. Useful to share textures between MultiRenderTarget.\r\n * @param texture The new texture to set in the MRT\r\n * @param index The index of the texture to replace\r\n * @param disposePrevious Set to true if the previous internal texture should be disposed\r\n */\r\n public setInternalTexture(texture: InternalTexture, index: number, disposePrevious: boolean = true) {\r\n if (!this.renderTarget) {\r\n return;\r\n }\r\n\r\n if (index === 0) {\r\n this._texture = texture;\r\n }\r\n\r\n this.renderTarget.setTexture(texture, index, disposePrevious);\r\n\r\n if (!this.textures[index]) {\r\n this.textures[index] = new Texture(null, this.getScene());\r\n }\r\n this.textures[index]._texture = texture;\r\n\r\n this._count = this.renderTarget.textures ? this.renderTarget.textures.length : 0;\r\n\r\n if (this._multiRenderTargetOptions.types) {\r\n this._multiRenderTargetOptions.types[index] = texture.type;\r\n }\r\n if (this._multiRenderTargetOptions.samplingModes) {\r\n this._multiRenderTargetOptions.samplingModes[index] = texture.samplingMode;\r\n }\r\n if (this._multiRenderTargetOptions.useSRGBBuffers) {\r\n this._multiRenderTargetOptions.useSRGBBuffers[index] = texture._useSRGBBuffer;\r\n }\r\n }\r\n\r\n /**\r\n * Define the number of samples used if MSAA is enabled.\r\n */\r\n public get samples(): number {\r\n return this._samples;\r\n }\r\n\r\n public set samples(value: number) {\r\n if (this._renderTarget) {\r\n this._samples = this._renderTarget.setSamples(value);\r\n } else {\r\n // In case samples are set with 0 textures created, we must save the desired samples value\r\n this._samples = value;\r\n }\r\n }\r\n\r\n /**\r\n * Resize all the textures in the multi render target.\r\n * Be careful as it will recreate all the data in the new texture.\r\n * @param size Define the new size\r\n */\r\n public resize(size: any) {\r\n this._size = size;\r\n this._rebuild();\r\n }\r\n\r\n /**\r\n * Changes the number of render targets in this MRT\r\n * Be careful as it will recreate all the data in the new texture.\r\n * @param count new texture count\r\n * @param options Specifies texture types and sampling modes for new textures\r\n * @param textureNames Specifies the names of the textures (optional)\r\n */\r\n public updateCount(count: number, options?: IMultiRenderTargetOptions, textureNames?: string[]) {\r\n this._multiRenderTargetOptions.textureCount = count;\r\n this._count = count;\r\n\r\n const types: number[] = [];\r\n const samplingModes: number[] = [];\r\n const useSRGBBuffers: boolean[] = [];\r\n\r\n this._initTypes(count, types, samplingModes, useSRGBBuffers, options);\r\n this._multiRenderTargetOptions.types = types;\r\n this._multiRenderTargetOptions.samplingModes = samplingModes;\r\n this._multiRenderTargetOptions.useSRGBBuffers = useSRGBBuffers;\r\n this._rebuild(true, textureNames);\r\n }\r\n\r\n protected _unbindFrameBuffer(engine: Engine, faceIndex: number): void {\r\n if (this._renderTarget) {\r\n engine.unBindMultiColorAttachmentFramebuffer(this._renderTarget, this.isCube, () => {\r\n this.onAfterRenderObservable.notifyObservers(faceIndex);\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the render targets and their associated resources\r\n * @param doNotDisposeInternalTextures\r\n */\r\n public dispose(doNotDisposeInternalTextures = false): void {\r\n this._releaseTextures();\r\n if (!doNotDisposeInternalTextures) {\r\n this.releaseInternalTextures();\r\n } else {\r\n // Prevent internal texture dispose in super.dispose\r\n this._texture = null;\r\n }\r\n super.dispose();\r\n }\r\n\r\n /**\r\n * Release all the underlying texture used as draw buffers.\r\n */\r\n public releaseInternalTextures(): void {\r\n const internalTextures = this._renderTarget?.textures;\r\n\r\n if (!internalTextures) {\r\n return;\r\n }\r\n\r\n for (let i = internalTextures.length - 1; i >= 0; i--) {\r\n this._textures[i]._texture = null;\r\n }\r\n\r\n this._renderTarget?.dispose();\r\n this._renderTarget = null;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"multiRenderTarget.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Materials/Textures/multiRenderTarget.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,6CAA6C,CAAC;AAyDrD;;;;;GAKG;AACH,MAAM,OAAO,iBAAkB,SAAQ,mBAAmB;IA0DtD;;;;;;;;;;;;OAYG;IACH,YAAY,IAAY,EAAE,IAAS,EAAE,KAAa,EAAE,KAAa,EAAE,OAAmC,EAAE,YAAuB;QAC3H,MAAM,eAAe,GAAG,OAAO,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC;QAC7F,MAAM,oBAAoB,GAAG,OAAO,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC;QAC5G,MAAM,kBAAkB,GAAG,OAAO,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS,CAAC,qBAAqB,CAAC;QAChI,MAAM,sBAAsB,GAAG,CAAC,OAAO,IAAI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AE,EAAE;YACnD,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,IAAI,CAAC;SACrC;QAED,MAAA,IAAI,CAAC,aAAa,0CAAE,OAAO,EAAE,CAAC;QAC9B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAC9B,CAAC;CACJ","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport type { Engine } from \"../../Engines/engine\";\r\nimport { Texture } from \"../../Materials/Textures/texture\";\r\nimport { RenderTargetTexture } from \"../../Materials/Textures/renderTargetTexture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\n\r\nimport \"../../Engines/Extensions/engine.multiRender\";\r\nimport type { InternalTexture } from \"./internalTexture\";\r\n\r\n/**\r\n * Creation options of the multi render target texture.\r\n */\r\nexport interface IMultiRenderTargetOptions {\r\n /**\r\n * Define if the texture needs to create mip maps after render.\r\n */\r\n generateMipMaps?: boolean;\r\n /**\r\n * Define the types of all the draw buffers we want to create\r\n */\r\n types?: number[];\r\n /**\r\n * Define the sampling modes of all the draw buffers we want to create\r\n */\r\n samplingModes?: number[];\r\n /**\r\n * Define if sRGB format should be used for each of the draw buffers we want to create\r\n */\r\n useSRGBBuffers?: boolean[];\r\n /**\r\n * Define if a depth buffer is required\r\n */\r\n generateDepthBuffer?: boolean;\r\n /**\r\n * Define if a stencil buffer is required\r\n */\r\n generateStencilBuffer?: boolean;\r\n /**\r\n * Define if a depth texture is required instead of a depth buffer\r\n */\r\n generateDepthTexture?: boolean;\r\n /**\r\n * Define depth texture format to use\r\n */\r\n depthTextureFormat?: number;\r\n /**\r\n * Define the number of desired draw buffers\r\n */\r\n textureCount?: number;\r\n /**\r\n * Define if aspect ratio should be adapted to the texture or stay the scene one\r\n */\r\n doNotChangeAspectRatio?: boolean;\r\n /**\r\n * Define the default type of the buffers we are creating\r\n */\r\n defaultType?: number;\r\n /**\r\n * Define the default type of the buffers we are creating\r\n */\r\n drawOnlyOnFirstAttachmentByDefault?: boolean;\r\n}\r\n\r\n/**\r\n * A multi render target, like a render target provides the ability to render to a texture.\r\n * Unlike the render target, it can render to several draw buffers in one draw.\r\n * This is specially interesting in deferred rendering or for any effects requiring more than\r\n * just one color from a single pass.\r\n */\r\nexport class MultiRenderTarget extends RenderTargetTexture {\r\n private _textures: Texture[];\r\n private _multiRenderTargetOptions: IMultiRenderTargetOptions;\r\n private _count: number;\r\n private _drawOnlyOnFirstAttachmentByDefault: boolean;\r\n\r\n /**\r\n * Get if draw buffers are currently supported by the used hardware and browser.\r\n */\r\n public get isSupported(): boolean {\r\n return this._engine?.getCaps().drawBuffersExtension ?? false;\r\n }\r\n\r\n /**\r\n * Get the list of textures generated by the multi render target.\r\n */\r\n public get textures(): Texture[] {\r\n return this._textures;\r\n }\r\n\r\n /**\r\n * Gets the number of textures in this MRT. This number can be different from `_textures.length` in case a depth texture is generated.\r\n */\r\n public get count(): number {\r\n return this._count;\r\n }\r\n\r\n /**\r\n * Get the depth texture generated by the multi render target if options.generateDepthTexture has been set\r\n */\r\n public get depthTexture(): Texture {\r\n return this._textures[this._textures.length - 1];\r\n }\r\n\r\n /**\r\n * Set the wrapping mode on U of all the textures we are rendering to.\r\n * Can be any of the Texture. (CLAMP_ADDRESSMODE, MIRROR_ADDRESSMODE or WRAP_ADDRESSMODE)\r\n */\r\n public set wrapU(wrap: number) {\r\n if (this._textures) {\r\n for (let i = 0; i < this._textures.length; i++) {\r\n this._textures[i].wrapU = wrap;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Set the wrapping mode on V of all the textures we are rendering to.\r\n * Can be any of the Texture. (CLAMP_ADDRESSMODE, MIRROR_ADDRESSMODE or WRAP_ADDRESSMODE)\r\n */\r\n public set wrapV(wrap: number) {\r\n if (this._textures) {\r\n for (let i = 0; i < this._textures.length; i++) {\r\n this._textures[i].wrapV = wrap;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Instantiate a new multi render target texture.\r\n * A multi render target, like a render target provides the ability to render to a texture.\r\n * Unlike the render target, it can render to several draw buffers in one draw.\r\n * This is specially interesting in deferred rendering or for any effects requiring more than\r\n * just one color from a single pass.\r\n * @param name Define the name of the texture\r\n * @param size Define the size of the buffers to render to\r\n * @param count Define the number of target we are rendering into\r\n * @param scene Define the scene the texture belongs to\r\n * @param options Define the options used to create the multi render target\r\n * @param textureNames Define the names to set to the textures (if count > 0 - optional)\r\n */\r\n constructor(name: string, size: any, count: number, scene?: Scene, options?: IMultiRenderTargetOptions, textureNames?: string[]) {\r\n const generateMipMaps = options && options.generateMipMaps ? options.generateMipMaps : false;\r\n const generateDepthTexture = options && options.generateDepthTexture ? options.generateDepthTexture : false;\r\n const depthTextureFormat = options && options.depthTextureFormat ? options.depthTextureFormat : Constants.TEXTUREFORMAT_DEPTH16;\r\n const doNotChangeAspectRatio = !options || options.doNotChangeAspectRatio === undefined ? true : options.doNotChangeAspectRatio;\r\n const drawOnlyOnFirstAttachmentByDefault = options && options.drawOnlyOnFirstAttachmentByDefault ? options.drawOnlyOnFirstAttachmentByDefault : false;\r\n super(name, size, scene, generateMipMaps, doNotChangeAspectRatio, undefined, undefined, undefined, undefined, undefined, undefined, undefined, true);\r\n\r\n if (!this.isSupported) {\r\n this.dispose();\r\n return;\r\n }\r\n\r\n const types: number[] = [];\r\n const samplingModes: number[] = [];\r\n const useSRGBBuffers: boolean[] = [];\r\n this._initTypes(count, types, samplingModes, useSRGBBuffers, options);\r\n\r\n const generateDepthBuffer = !options || options.generateDepthBuffer === undefined ? true : options.generateDepthBuffer;\r\n const generateStencilBuffer = !options || options.generateStencilBuffer === undefined ? false : options.generateStencilBuffer;\r\n\r\n this._size = size;\r\n this._multiRenderTargetOptions = {\r\n samplingModes: samplingModes,\r\n generateMipMaps: generateMipMaps,\r\n generateDepthBuffer: generateDepthBuffer,\r\n generateStencilBuffer: generateStencilBuffer,\r\n generateDepthTexture: generateDepthTexture,\r\n depthTextureFormat: depthTextureFormat,\r\n types: types,\r\n textureCount: count,\r\n useSRGBBuffers: useSRGBBuffers,\r\n };\r\n\r\n this._count = count;\r\n this._drawOnlyOnFirstAttachmentByDefault = drawOnlyOnFirstAttachmentByDefault;\r\n\r\n if (count > 0) {\r\n this._createInternalTextures();\r\n this._createTextures(textureNames);\r\n }\r\n }\r\n\r\n private _initTypes(count: number, types: number[], samplingModes: number[], useSRGBBuffers: boolean[], options?: IMultiRenderTargetOptions) {\r\n for (let i = 0; i < count; i++) {\r\n if (options && options.types && options.types[i] !== undefined) {\r\n types.push(options.types[i]);\r\n } else {\r\n types.push(options && options.defaultType ? options.defaultType : Constants.TEXTURETYPE_UNSIGNED_INT);\r\n }\r\n\r\n if (options && options.samplingModes && options.samplingModes[i] !== undefined) {\r\n samplingModes.push(options.samplingModes[i]);\r\n } else {\r\n samplingModes.push(Texture.BILINEAR_SAMPLINGMODE);\r\n }\r\n\r\n if (options && options.useSRGBBuffers && options.useSRGBBuffers[i] !== undefined) {\r\n useSRGBBuffers.push(options.useSRGBBuffers[i]);\r\n } else {\r\n useSRGBBuffers.push(false);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _rebuild(forceFullRebuild: boolean = false, textureNames?: string[]): void {\r\n if (this._count < 1) {\r\n return;\r\n }\r\n\r\n this.releaseInternalTextures();\r\n this._createInternalTextures();\r\n\r\n if (forceFullRebuild) {\r\n this._releaseTextures();\r\n this._createTextures(textureNames);\r\n }\r\n\r\n const internalTextures = this._renderTarget!.textures!;\r\n for (let i = 0; i < internalTextures.length; i++) {\r\n const texture = this._textures[i];\r\n texture._texture = internalTextures[i];\r\n }\r\n\r\n if (this.samples !== 1) {\r\n this._renderTarget!.setSamples(this.samples, !this._drawOnlyOnFirstAttachmentByDefault, true);\r\n }\r\n }\r\n\r\n private _createInternalTextures(): void {\r\n this._renderTarget = this._getEngine()!.createMultipleRenderTarget(this._size, this._multiRenderTargetOptions, !this._drawOnlyOnFirstAttachmentByDefault);\r\n this._texture = this._renderTarget.texture;\r\n }\r\n\r\n private _releaseTextures(): void {\r\n if (this._textures) {\r\n for (let i = 0; i < this._textures.length; i++) {\r\n this._textures[i]._texture = null; // internal textures are released by a call to releaseInternalTextures()\r\n this._textures[i].dispose();\r\n }\r\n }\r\n }\r\n\r\n private _createTextures(textureNames?: string[]): void {\r\n const internalTextures = this._renderTarget!.textures!;\r\n this._textures = [];\r\n for (let i = 0; i < internalTextures.length; i++) {\r\n const texture = new Texture(null, this.getScene());\r\n if (textureNames?.[i]) {\r\n texture.name = textureNames[i];\r\n }\r\n texture._texture = internalTextures[i];\r\n this._textures.push(texture);\r\n }\r\n }\r\n\r\n /**\r\n * Replaces an internal texture within the MRT. Useful to share textures between MultiRenderTarget.\r\n * @param texture The new texture to set in the MRT\r\n * @param index The index of the texture to replace\r\n * @param disposePrevious Set to true if the previous internal texture should be disposed\r\n */\r\n public setInternalTexture(texture: InternalTexture, index: number, disposePrevious: boolean = true) {\r\n if (!this.renderTarget) {\r\n return;\r\n }\r\n\r\n if (index === 0) {\r\n this._texture = texture;\r\n }\r\n\r\n this.renderTarget.setTexture(texture, index, disposePrevious);\r\n\r\n if (!this.textures[index]) {\r\n this.textures[index] = new Texture(null, this.getScene());\r\n }\r\n this.textures[index]._texture = texture;\r\n\r\n this._count = this.renderTarget.textures ? this.renderTarget.textures.length : 0;\r\n\r\n if (this._multiRenderTargetOptions.types) {\r\n this._multiRenderTargetOptions.types[index] = texture.type;\r\n }\r\n if (this._multiRenderTargetOptions.samplingModes) {\r\n this._multiRenderTargetOptions.samplingModes[index] = texture.samplingMode;\r\n }\r\n if (this._multiRenderTargetOptions.useSRGBBuffers) {\r\n this._multiRenderTargetOptions.useSRGBBuffers[index] = texture._useSRGBBuffer;\r\n }\r\n }\r\n\r\n /**\r\n * Define the number of samples used if MSAA is enabled.\r\n */\r\n public get samples(): number {\r\n return this._samples;\r\n }\r\n\r\n public set samples(value: number) {\r\n if (this._renderTarget) {\r\n this._samples = this._renderTarget.setSamples(value);\r\n } else {\r\n // In case samples are set with 0 textures created, we must save the desired samples value\r\n this._samples = value;\r\n }\r\n }\r\n\r\n /**\r\n * Resize all the textures in the multi render target.\r\n * Be careful as it will recreate all the data in the new texture.\r\n * @param size Define the new size\r\n */\r\n public resize(size: any) {\r\n this._size = size;\r\n this._rebuild();\r\n }\r\n\r\n /**\r\n * Changes the number of render targets in this MRT\r\n * Be careful as it will recreate all the data in the new texture.\r\n * @param count new texture count\r\n * @param options Specifies texture types and sampling modes for new textures\r\n * @param textureNames Specifies the names of the textures (optional)\r\n */\r\n public updateCount(count: number, options?: IMultiRenderTargetOptions, textureNames?: string[]) {\r\n this._multiRenderTargetOptions.textureCount = count;\r\n this._count = count;\r\n\r\n const types: number[] = [];\r\n const samplingModes: number[] = [];\r\n const useSRGBBuffers: boolean[] = [];\r\n\r\n this._initTypes(count, types, samplingModes, useSRGBBuffers, options);\r\n this._multiRenderTargetOptions.types = types;\r\n this._multiRenderTargetOptions.samplingModes = samplingModes;\r\n this._multiRenderTargetOptions.useSRGBBuffers = useSRGBBuffers;\r\n this._rebuild(true, textureNames);\r\n }\r\n\r\n protected _unbindFrameBuffer(engine: Engine, faceIndex: number): void {\r\n if (this._renderTarget) {\r\n engine.unBindMultiColorAttachmentFramebuffer(this._renderTarget, this.isCube, () => {\r\n this.onAfterRenderObservable.notifyObservers(faceIndex);\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the render targets and their associated resources\r\n * @param doNotDisposeInternalTextures\r\n */\r\n public dispose(doNotDisposeInternalTextures = false): void {\r\n this._releaseTextures();\r\n if (!doNotDisposeInternalTextures) {\r\n this.releaseInternalTextures();\r\n } else {\r\n // Prevent internal texture dispose in super.dispose\r\n this._texture = null;\r\n }\r\n super.dispose();\r\n }\r\n\r\n /**\r\n * Release all the underlying texture used as draw buffers.\r\n */\r\n public releaseInternalTextures(): void {\r\n const internalTextures = this._renderTarget?.textures;\r\n\r\n if (!internalTextures) {\r\n return;\r\n }\r\n\r\n for (let i = internalTextures.length - 1; i >= 0; i--) {\r\n this._textures[i]._texture = null;\r\n }\r\n\r\n this._renderTarget?.dispose();\r\n this._renderTarget = null;\r\n }\r\n}\r\n"]}
|
|
@@ -40,7 +40,7 @@ export class RawTexture extends Texture {
|
|
|
40
40
|
if (!this._engine._caps.textureHalfFloatLinearFiltering && type === 2) {
|
|
41
41
|
samplingMode = 1;
|
|
42
42
|
}
|
|
43
|
-
this._texture = this._engine.createRawTexture(data, width, height, format, generateMipMaps, invertY, samplingMode, null, type, creationFlags
|
|
43
|
+
this._texture = this._engine.createRawTexture(data, width, height, format, generateMipMaps, invertY, samplingMode, null, type, creationFlags !== null && creationFlags !== void 0 ? creationFlags : 0, useSRGBBuffer !== null && useSRGBBuffer !== void 0 ? useSRGBBuffer : false);
|
|
44
44
|
this.wrapU = Texture.CLAMP_ADDRESSMODE;
|
|
45
45
|
this.wrapV = Texture.CLAMP_ADDRESSMODE;
|
|
46
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rawTexture.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Materials/Textures/rawTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,4CAA4C,CAAC;AAMpD;;;;GAIG;AACH,MAAM,OAAO,UAAW,SAAQ,OAAO;IACnC;;;;;;;;;;;;;;;;OAgBG;IACH,YACI,IAA+B,EAC/B,KAAa,EACb,MAAc;IACd;;OAEG;IACI,MAAc,EACrB,aAA2C,EAC3C,kBAA2B,IAAI,EAC/B,UAAmB,KAAK,EACxB,eAAuB,SAAS,CAAC,8BAA8B,EAC/D,OAAe,SAAS,CAAC,wBAAwB,EACjD,aAAsB,EACtB,aAAuB;QAEvB,KAAK,CAAC,IAAI,EAAE,aAAa,EAAE,CAAC,eAAe,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EA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AAM,EAAE,SAAS,CAAC,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;IACvI,CAAC;IAED;;;;;;;;;;;OAWG;IACI,MAAM,CAAC,qBAAqB,CAC/B,IAA+B,EAC/B,KAAa,EACb,MAAc,EACd,aAA2C,EAC3C,kBAA2B,IAAI,EAC/B,UAAmB,KAAK,EACxB,eAAuB,OAAO,CAAC,sBAAsB,EACrD,OAAe,SAAS,CAAC,iBAAiB;QAE1C,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,CAAC,4BAA4B,CAAC,CAAC;IAC/K,CAAC;CACJ","sourcesContent":["import { Texture } from \"./texture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport \"../../Engines/Extensions/engine.rawTexture\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { ThinEngine } from \"../../Engines/thinEngine\";\r\n\r\ndeclare type Scene = import(\"../../scene\").Scene;\r\n\r\n/**\r\n * Raw texture can help creating a texture directly from an array of data.\r\n * This can be super useful if you either get the data from an uncompressed source or\r\n * if you wish to create your texture pixel by pixel.\r\n */\r\nexport class RawTexture extends Texture {\r\n /**\r\n * Instantiates a new RawTexture.\r\n * Raw texture can help creating a texture directly from an array of data.\r\n * This can be super useful if you either get the data from an uncompressed source or\r\n * if you wish to create your texture pixel by pixel.\r\n * @param data define the array of data to use to create the texture (null to create an empty texture)\r\n * @param width define the width of the texture\r\n * @param height define the height of the texture\r\n * @param format define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx)\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps define whether mip maps should be generated or not\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n */\r\n constructor(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n /**\r\n * Define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx)\r\n */\r\n public format: number,\r\n sceneOrEngine: Nullable<Scene | ThinEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n creationFlags?: number,\r\n useSRGBBuffer?: boolean\r\n ) {\r\n super(null, sceneOrEngine, !generateMipMaps, invertY, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, creationFlags);\r\n\r\n if (!this._engine) {\r\n return;\r\n }\r\n\r\n if (!this._engine._caps.textureFloatLinearFiltering && type === Constants.TEXTURETYPE_FLOAT) {\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n if (!this._engine._caps.textureHalfFloatLinearFiltering && type === Constants.TEXTURETYPE_HALF_FLOAT) {\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n\r\n this._texture = this._engine.createRawTexture(data, width, height, format, generateMipMaps, invertY, samplingMode, null, type, creationFlags ?? 0, useSRGBBuffer ?? false);\r\n\r\n this.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n }\r\n\r\n /**\r\n * Updates the texture underlying data.\r\n * @param data Define the new data of the texture\r\n */\r\n public update(data: ArrayBufferView): void {\r\n this._getEngine()!.updateRawTexture(this._texture, data, this._texture!.format, this._texture!.invertY, null, this._texture!.type, this._texture!._useSRGBBuffer);\r\n }\r\n\r\n /**\r\n * Creates a luminance texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @returns the luminance texture\r\n */\r\n public static CreateLuminanceTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | ThinEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_LUMINANCE, sceneOrEngine, generateMipMaps, invertY, samplingMode);\r\n }\r\n\r\n /**\r\n * Creates a luminance alpha texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @returns the luminance alpha texture\r\n */\r\n public static CreateLuminanceAlphaTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | ThinEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_LUMINANCE_ALPHA, sceneOrEngine, generateMipMaps, invertY, samplingMode);\r\n }\r\n\r\n /**\r\n * Creates an alpha texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @returns the alpha texture\r\n */\r\n public static CreateAlphaTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | ThinEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_ALPHA, sceneOrEngine, generateMipMaps, invertY, samplingMode);\r\n }\r\n\r\n /**\r\n * Creates a RGB texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n * @returns the RGB alpha texture\r\n */\r\n public static CreateRGBTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | ThinEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n creationFlags: number = 0,\r\n useSRGBBuffer: boolean = false\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_RGB, sceneOrEngine, generateMipMaps, invertY, samplingMode, type, creationFlags, useSRGBBuffer);\r\n }\r\n\r\n /**\r\n * Creates a RGBA texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n * @returns the RGBA texture\r\n */\r\n public static CreateRGBATexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | ThinEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n creationFlags: number = 0,\r\n useSRGBBuffer: boolean = false\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_RGBA, sceneOrEngine, generateMipMaps, invertY, samplingMode, type, creationFlags, useSRGBBuffer);\r\n }\r\n\r\n /**\r\n * Creates a RGBA storage texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n * @returns the RGBA texture\r\n */\r\n public static CreateRGBAStorageTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | ThinEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n useSRGBBuffer: boolean = false\r\n ): RawTexture {\r\n return new RawTexture(\r\n data,\r\n width,\r\n height,\r\n Constants.TEXTUREFORMAT_RGBA,\r\n sceneOrEngine,\r\n generateMipMaps,\r\n invertY,\r\n samplingMode,\r\n type,\r\n Constants.TEXTURE_CREATIONFLAG_STORAGE,\r\n useSRGBBuffer\r\n );\r\n }\r\n\r\n /**\r\n * Creates a R texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @returns the R texture\r\n */\r\n public static CreateRTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | ThinEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,\r\n type: number = Constants.TEXTURETYPE_FLOAT\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_R, sceneOrEngine, generateMipMaps, invertY, samplingMode, type);\r\n }\r\n\r\n /**\r\n * Creates a R storage texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @returns the R texture\r\n */\r\n public static CreateRStorageTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | ThinEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,\r\n type: number = Constants.TEXTURETYPE_FLOAT\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_R, sceneOrEngine, generateMipMaps, invertY, samplingMode, type, Constants.TEXTURE_CREATIONFLAG_STORAGE);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"rawTexture.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Materials/Textures/rawTexture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,4CAA4C,CAAC;AAMpD;;;;GAIG;AACH,MAAM,OAAO,UAAW,SAAQ,OAAO;IACnC;;;;;;;;;;;;;;;;OAgBG;IACH,YACI,IAA+B,EAC/B,KAAa,EACb,MAAc;IACd;;OAEG;IACI,MAAc,EACrB,aAA2C,EAC3C,kBAA2B,IAAI,EAC/B,UAAmB,KAAK,EACxB,eAAuB,SAAS,CAAC,8BAA8B,EAC/D,OAAe,SAAS,CAAC,wBAAwB,EACjD,aAAsB,EACtB,aAAuB;QAEvB,KAAK,CAAC,IAAI,EAAE,aAAa,EAAE,CAAC,eAAe,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAA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AAsB,EACrD,OAAe,SAAS,CAAC,iBAAiB;QAE1C,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;IACvI,CAAC;IAED;;;;;;;;;;;OAWG;IACI,MAAM,CAAC,qBAAqB,CAC/B,IAA+B,EAC/B,KAAa,EACb,MAAc,EACd,aAA2C,EAC3C,kBAA2B,IAAI,EAC/B,UAAmB,KAAK,EACxB,eAAuB,OAAO,CAAC,sBAAsB,EACrD,OAAe,SAAS,CAAC,iBAAiB;QAE1C,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,CAAC,4BAA4B,CAAC,CAAC;IAC/K,CAAC;CACJ","sourcesContent":["import { Texture } from \"./texture\";\r\nimport { Constants } from \"../../Engines/constants\";\r\nimport \"../../Engines/Extensions/engine.rawTexture\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { ThinEngine } from \"../../Engines/thinEngine\";\r\n\r\ndeclare type Scene = import(\"../../scene\").Scene;\r\n\r\n/**\r\n * Raw texture can help creating a texture directly from an array of data.\r\n * This can be super useful if you either get the data from an uncompressed source or\r\n * if you wish to create your texture pixel by pixel.\r\n */\r\nexport class RawTexture extends Texture {\r\n /**\r\n * Instantiates a new RawTexture.\r\n * Raw texture can help creating a texture directly from an array of data.\r\n * This can be super useful if you either get the data from an uncompressed source or\r\n * if you wish to create your texture pixel by pixel.\r\n * @param data define the array of data to use to create the texture (null to create an empty texture)\r\n * @param width define the width of the texture\r\n * @param height define the height of the texture\r\n * @param format define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx)\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps define whether mip maps should be generated or not\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n */\r\n constructor(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n /**\r\n * Define the format of the data (RGB, RGBA... Engine.TEXTUREFORMAT_xxx)\r\n */\r\n public format: number,\r\n sceneOrEngine: Nullable<Scene | ThinEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n creationFlags?: number,\r\n useSRGBBuffer?: boolean\r\n ) {\r\n super(null, sceneOrEngine, !generateMipMaps, invertY, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, creationFlags);\r\n\r\n if (!this._engine) {\r\n return;\r\n }\r\n\r\n if (!this._engine._caps.textureFloatLinearFiltering && type === Constants.TEXTURETYPE_FLOAT) {\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n if (!this._engine._caps.textureHalfFloatLinearFiltering && type === Constants.TEXTURETYPE_HALF_FLOAT) {\r\n samplingMode = Constants.TEXTURE_NEAREST_SAMPLINGMODE;\r\n }\r\n\r\n this._texture = this._engine.createRawTexture(data, width, height, format, generateMipMaps, invertY, samplingMode, null, type, creationFlags ?? 0, useSRGBBuffer ?? false);\r\n\r\n this.wrapU = Texture.CLAMP_ADDRESSMODE;\r\n this.wrapV = Texture.CLAMP_ADDRESSMODE;\r\n }\r\n\r\n /**\r\n * Updates the texture underlying data.\r\n * @param data Define the new data of the texture\r\n */\r\n public update(data: ArrayBufferView): void {\r\n this._getEngine()!.updateRawTexture(this._texture, data, this._texture!.format, this._texture!.invertY, null, this._texture!.type, this._texture!._useSRGBBuffer);\r\n }\r\n\r\n /**\r\n * Creates a luminance texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @returns the luminance texture\r\n */\r\n public static CreateLuminanceTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | ThinEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_LUMINANCE, sceneOrEngine, generateMipMaps, invertY, samplingMode);\r\n }\r\n\r\n /**\r\n * Creates a luminance alpha texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @returns the luminance alpha texture\r\n */\r\n public static CreateLuminanceAlphaTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | ThinEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_LUMINANCE_ALPHA, sceneOrEngine, generateMipMaps, invertY, samplingMode);\r\n }\r\n\r\n /**\r\n * Creates an alpha texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @returns the alpha texture\r\n */\r\n public static CreateAlphaTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | ThinEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_ALPHA, sceneOrEngine, generateMipMaps, invertY, samplingMode);\r\n }\r\n\r\n /**\r\n * Creates a RGB texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n * @returns the RGB alpha texture\r\n */\r\n public static CreateRGBTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | ThinEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n creationFlags: number = 0,\r\n useSRGBBuffer: boolean = false\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_RGB, sceneOrEngine, generateMipMaps, invertY, samplingMode, type, creationFlags, useSRGBBuffer);\r\n }\r\n\r\n /**\r\n * Creates a RGBA texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @param creationFlags specific flags to use when creating the texture (Constants.TEXTURE_CREATIONFLAG_STORAGE for storage textures, for eg)\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n * @returns the RGBA texture\r\n */\r\n public static CreateRGBATexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | ThinEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n creationFlags: number = 0,\r\n useSRGBBuffer: boolean = false\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_RGBA, sceneOrEngine, generateMipMaps, invertY, samplingMode, type, creationFlags, useSRGBBuffer);\r\n }\r\n\r\n /**\r\n * Creates a RGBA storage texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @param useSRGBBuffer defines if the texture must be loaded in a sRGB GPU buffer (if supported by the GPU).\r\n * @returns the RGBA texture\r\n */\r\n public static CreateRGBAStorageTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | ThinEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Constants.TEXTURE_TRILINEAR_SAMPLINGMODE,\r\n type: number = Constants.TEXTURETYPE_UNSIGNED_INT,\r\n useSRGBBuffer: boolean = false\r\n ): RawTexture {\r\n return new RawTexture(\r\n data,\r\n width,\r\n height,\r\n Constants.TEXTUREFORMAT_RGBA,\r\n sceneOrEngine,\r\n generateMipMaps,\r\n invertY,\r\n samplingMode,\r\n type,\r\n Constants.TEXTURE_CREATIONFLAG_STORAGE,\r\n useSRGBBuffer\r\n );\r\n }\r\n\r\n /**\r\n * Creates a R texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @returns the R texture\r\n */\r\n public static CreateRTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | ThinEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,\r\n type: number = Constants.TEXTURETYPE_FLOAT\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_R, sceneOrEngine, generateMipMaps, invertY, samplingMode, type);\r\n }\r\n\r\n /**\r\n * Creates a R storage texture from some data.\r\n * @param data Define the texture data\r\n * @param width Define the width of the texture\r\n * @param height Define the height of the texture\r\n * @param sceneOrEngine defines the scene or engine the texture will belong to\r\n * @param generateMipMaps Define whether or not to create mip maps for the texture\r\n * @param invertY define if the data should be flipped on Y when uploaded to the GPU\r\n * @param samplingMode define the texture sampling mode (Texture.xxx_SAMPLINGMODE)\r\n * @param type define the format of the data (int, float... Engine.TEXTURETYPE_xxx)\r\n * @returns the R texture\r\n */\r\n public static CreateRStorageTexture(\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n sceneOrEngine: Nullable<Scene | ThinEngine>,\r\n generateMipMaps: boolean = true,\r\n invertY: boolean = false,\r\n samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE,\r\n type: number = Constants.TEXTURETYPE_FLOAT\r\n ): RawTexture {\r\n return new RawTexture(data, width, height, Constants.TEXTUREFORMAT_R, sceneOrEngine, generateMipMaps, invertY, samplingMode, type, Constants.TEXTURE_CREATIONFLAG_STORAGE);\r\n }\r\n}\r\n"]}
|
|
@@ -37,12 +37,14 @@ export class RenderTargetTexture extends Texture {
|
|
|
37
37
|
* @param useSRGBBuffer True to create a SRGB texture
|
|
38
38
|
*/
|
|
39
39
|
constructor(name, size, scene, generateMipMaps, doNotChangeAspectRatio = true, type = 0, isCube = false, samplingMode = Texture.TRILINEAR_SAMPLINGMODE, generateDepthBuffer = true, generateStencilBuffer = false, isMulti = false, format = 5, delayAllocation = false, samples, creationFlags, noColorTarget = false, useSRGBBuffer = false) {
|
|
40
|
+
var _a;
|
|
40
41
|
super(null, scene, !generateMipMaps, undefined, samplingMode, undefined, undefined, undefined, undefined, format);
|
|
41
42
|
this._unObserveRenderList = null;
|
|
42
43
|
this._renderListHasChanged = (_functionName, previousLength) => {
|
|
44
|
+
var _a;
|
|
43
45
|
const newLength = this._renderList ? this._renderList.length : 0;
|
|
44
46
|
if ((previousLength === 0 && newLength > 0) || newLength === 0) {
|
|
45
|
-
this.getScene()
|
|
47
|
+
(_a = this.getScene()) === null || _a === void 0 ? void 0 : _a.meshes.forEach((mesh) => {
|
|
46
48
|
mesh._markSubMeshesAsLightDirty();
|
|
47
49
|
});
|
|
48
50
|
}
|
|
@@ -125,7 +127,7 @@ export class RenderTargetTexture extends Texture {
|
|
|
125
127
|
this._renderTargetOptions = {
|
|
126
128
|
generateMipMaps: generateMipMaps,
|
|
127
129
|
type: type,
|
|
128
|
-
format: this._format
|
|
130
|
+
format: (_a = this._format) !== null && _a !== void 0 ? _a : undefined,
|
|
129
131
|
samplingMode: this.samplingMode,
|
|
130
132
|
generateDepthBuffer: generateDepthBuffer,
|
|
131
133
|
generateStencilBuffer: generateStencilBuffer,
|
|
@@ -292,7 +294,8 @@ export class RenderTargetTexture extends Texture {
|
|
|
292
294
|
* Otherwise, return null.
|
|
293
295
|
*/
|
|
294
296
|
get depthStencilTexture() {
|
|
295
|
-
|
|
297
|
+
var _a, _b;
|
|
298
|
+
return (_b = (_a = this._renderTarget) === null || _a === void 0 ? void 0 : _a._depthStencilTexture) !== null && _b !== void 0 ? _b : null;
|
|
296
299
|
}
|
|
297
300
|
/**
|
|
298
301
|
* Creates a depth stencil texture.
|
|
@@ -304,7 +307,8 @@ export class RenderTargetTexture extends Texture {
|
|
|
304
307
|
* @param format format of the depth texture (default: 14)
|
|
305
308
|
*/
|
|
306
309
|
createDepthStencilTexture(comparisonFunction = 0, bilinearFiltering = true, generateStencil = false, samples = 1, format = 14) {
|
|
307
|
-
|
|
310
|
+
var _a;
|
|
311
|
+
(_a = this._renderTarget) === null || _a === void 0 ? void 0 : _a.createDepthStencilTexture(comparisonFunction, bilinearFiltering, generateStencil, samples, format);
|
|
308
312
|
}
|
|
309
313
|
_releaseRenderPassId() {
|
|
310
314
|
if (this._scene) {
|
|
@@ -342,7 +346,8 @@ export class RenderTargetTexture extends Texture {
|
|
|
342
346
|
* It defaults to one meaning no MSAA has been enabled.
|
|
343
347
|
*/
|
|
344
348
|
get samples() {
|
|
345
|
-
|
|
349
|
+
var _a, _b;
|
|
350
|
+
return (_b = (_a = this._renderTarget) === null || _a === void 0 ? void 0 : _a.samples) !== null && _b !== void 0 ? _b : this._samples;
|
|
346
351
|
}
|
|
347
352
|
set samples(value) {
|
|
348
353
|
if (this._renderTarget) {
|
|
@@ -506,8 +511,9 @@ export class RenderTargetTexture extends Texture {
|
|
|
506
511
|
* - or an object containing a ratio { ratio: number }
|
|
507
512
|
*/
|
|
508
513
|
resize(size) {
|
|
514
|
+
var _a;
|
|
509
515
|
const wasCube = this.isCube;
|
|
510
|
-
this._renderTarget
|
|
516
|
+
(_a = this._renderTarget) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
511
517
|
this._renderTarget = null;
|
|
512
518
|
const scene = this.getScene();
|
|
513
519
|
if (!scene) {
|
|
@@ -544,6 +550,7 @@ export class RenderTargetTexture extends Texture {
|
|
|
544
550
|
return this._render(false, false, true);
|
|
545
551
|
}
|
|
546
552
|
_render(useCameraPostProcess = false, dumpForDebug = false, checkReadiness = false) {
|
|
553
|
+
var _a;
|
|
547
554
|
const scene = this.getScene();
|
|
548
555
|
if (!scene) {
|
|
549
556
|
return checkReadiness;
|
|
@@ -587,7 +594,7 @@ export class RenderTargetTexture extends Texture {
|
|
|
587
594
|
this.onBeforeBindObservable.notifyObservers(this);
|
|
588
595
|
// Set custom projection.
|
|
589
596
|
// Needs to be before binding to prevent changing the aspect ratio.
|
|
590
|
-
const camera = this.activeCamera
|
|
597
|
+
const camera = (_a = this.activeCamera) !== null && _a !== void 0 ? _a : scene.activeCamera;
|
|
591
598
|
const sceneCamera = scene.activeCamera;
|
|
592
599
|
if (camera) {
|
|
593
600
|
if (camera !== scene.activeCamera) {
|
|
@@ -785,12 +792,13 @@ export class RenderTargetTexture extends Texture {
|
|
|
785
792
|
}
|
|
786
793
|
}
|
|
787
794
|
_renderToTarget(faceIndex, useCameraPostProcess, dumpForDebug, layer = 0, camera = null) {
|
|
795
|
+
var _a, _b, _c, _d, _e, _f;
|
|
788
796
|
const scene = this.getScene();
|
|
789
797
|
if (!scene) {
|
|
790
798
|
return;
|
|
791
799
|
}
|
|
792
800
|
const engine = scene.getEngine();
|
|
793
|
-
engine._debugPushGroup
|
|
801
|
+
(_a = engine._debugPushGroup) === null || _a === void 0 ? void 0 : _a.call(engine, `render to face #${faceIndex} layer #${layer}`, 1);
|
|
794
802
|
// Bind
|
|
795
803
|
this._prepareFrame(scene, faceIndex, layer, useCameraPostProcess);
|
|
796
804
|
if (this.is2DArray) {
|
|
@@ -849,17 +857,17 @@ export class RenderTargetTexture extends Texture {
|
|
|
849
857
|
for (const step of scene._afterRenderTargetDrawStage) {
|
|
850
858
|
step.action(this, faceIndex, layer);
|
|
851
859
|
}
|
|
852
|
-
const saveGenerateMipMaps = this._texture
|
|
860
|
+
const saveGenerateMipMaps = (_c = (_b = this._texture) === null || _b === void 0 ? void 0 : _b.generateMipMaps) !== null && _c !== void 0 ? _c : false;
|
|
853
861
|
if (this._texture) {
|
|
854
862
|
this._texture.generateMipMaps = false; // if left true, the mipmaps will be generated (if this._texture.generateMipMaps = true) when the first post process binds its own RTT: by doing so it will unbind the current RTT,
|
|
855
863
|
// which will trigger a mipmap generation. We don't want this because it's a wasted work, we will do an unbind of the current RTT at the end of the process (see unbindFrameBuffer) which will
|
|
856
864
|
// trigger the generation of the final mipmaps
|
|
857
865
|
}
|
|
858
866
|
if (this._postProcessManager) {
|
|
859
|
-
this._postProcessManager._finalizeFrame(false, this._renderTarget
|
|
867
|
+
this._postProcessManager._finalizeFrame(false, (_d = this._renderTarget) !== null && _d !== void 0 ? _d : undefined, faceIndex, this._postProcesses, this.ignoreCameraViewport);
|
|
860
868
|
}
|
|
861
869
|
else if (useCameraPostProcess) {
|
|
862
|
-
scene.postProcessManager._finalizeFrame(false, this._renderTarget
|
|
870
|
+
scene.postProcessManager._finalizeFrame(false, (_e = this._renderTarget) !== null && _e !== void 0 ? _e : undefined, faceIndex);
|
|
863
871
|
}
|
|
864
872
|
for (const step of scene._afterRenderTargetPostProcessStage) {
|
|
865
873
|
step.action(this, faceIndex, layer);
|
|
@@ -891,7 +899,7 @@ export class RenderTargetTexture extends Texture {
|
|
|
891
899
|
if (this._texture && this.isCube && faceIndex === 5) {
|
|
892
900
|
engine.generateMipMapsForCubemap(this._texture);
|
|
893
901
|
}
|
|
894
|
-
engine._debugPopGroup
|
|
902
|
+
(_f = engine._debugPopGroup) === null || _f === void 0 ? void 0 : _f.call(engine, 1);
|
|
895
903
|
}
|
|
896
904
|
/**
|
|
897
905
|
* Overrides the default sort function applied in the rendering group to prepare the meshes.
|
|
@@ -954,19 +962,22 @@ export class RenderTargetTexture extends Texture {
|
|
|
954
962
|
* This will remove the attached framebuffer objects. The texture will not be able to be used as render target anymore
|
|
955
963
|
*/
|
|
956
964
|
disposeFramebufferObjects() {
|
|
957
|
-
|
|
965
|
+
var _a;
|
|
966
|
+
(_a = this._renderTarget) === null || _a === void 0 ? void 0 : _a.dispose(true);
|
|
958
967
|
}
|
|
959
968
|
/**
|
|
960
969
|
* Release and destroy the underlying lower level texture aka internalTexture.
|
|
961
970
|
*/
|
|
962
971
|
releaseInternalTexture() {
|
|
963
|
-
|
|
972
|
+
var _a;
|
|
973
|
+
(_a = this._renderTarget) === null || _a === void 0 ? void 0 : _a.releaseTextures();
|
|
964
974
|
this._texture = null;
|
|
965
975
|
}
|
|
966
976
|
/**
|
|
967
977
|
* Dispose the texture and release its associated resources.
|
|
968
978
|
*/
|
|
969
979
|
dispose() {
|
|
980
|
+
var _a;
|
|
970
981
|
this.onResizeObservable.clear();
|
|
971
982
|
this.onClearObservable.clear();
|
|
972
983
|
this.onAfterRenderObservable.clear();
|
|
@@ -1002,7 +1013,7 @@ export class RenderTargetTexture extends Texture {
|
|
|
1002
1013
|
camera.customRenderTargets.splice(index, 1);
|
|
1003
1014
|
}
|
|
1004
1015
|
}
|
|
1005
|
-
this._renderTarget
|
|
1016
|
+
(_a = this._renderTarget) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
1006
1017
|
this._renderTarget = null;
|
|
1007
1018
|
this._texture = null;
|
|
1008
1019
|
super.dispose();
|