@onerjs/core 8.47.1 → 8.47.3
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/animation.js +2 -2
- package/Animations/animation.js.map +1 -1
- package/Animations/animationGroup.js +1 -1
- package/Animations/animationGroup.js.map +1 -1
- package/Animations/animatorAvatar.js +13 -12
- package/Animations/animatorAvatar.js.map +1 -1
- package/Animations/easing.js +1 -1
- package/Animations/easing.js.map +1 -1
- package/Animations/pathCursor.js +1 -2
- package/Animations/pathCursor.js.map +1 -1
- package/Cameras/geospatialCameraMovement.js +4 -5
- package/Cameras/geospatialCameraMovement.js.map +1 -1
- package/Layers/selectionOutlineLayer.d.ts +7 -0
- package/Layers/selectionOutlineLayer.js +18 -1
- package/Layers/selectionOutlineLayer.js.map +1 -1
- package/Layers/thinSelectionOutlineLayer.d.ts +1 -0
- package/Layers/thinSelectionOutlineLayer.js +31 -6
- package/Layers/thinSelectionOutlineLayer.js.map +1 -1
- package/Lights/Clustered/clusteredLightContainer.d.ts +6 -0
- package/Lights/Clustered/clusteredLightContainer.js +42 -0
- package/Lights/Clustered/clusteredLightContainer.js.map +1 -1
- package/Lights/light.d.ts +7 -0
- package/Lights/light.js +10 -0
- package/Lights/light.js.map +1 -1
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js +13 -3
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
- package/Materials/Textures/cubeTexture.js +10 -0
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +8 -1
- package/Meshes/abstractMesh.js +9 -2
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/mesh.js +31 -4
- package/Meshes/mesh.js.map +1 -1
- package/Misc/greasedLineTools.js +5 -0
- package/Misc/greasedLineTools.js.map +1 -1
- package/Particles/EmitterTypes/coneParticleEmitter.js +2 -4
- package/Particles/EmitterTypes/coneParticleEmitter.js.map +1 -1
- package/Physics/v2/characterController.d.ts +5 -0
- package/Physics/v2/characterController.js +6 -0
- package/Physics/v2/characterController.js.map +1 -1
- package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js +1 -1
- package/Shaders/ShadersInclude/pbrClusteredLightingFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
- package/XR/webXRSessionManager.js +7 -5
- package/XR/webXRSessionManager.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thinSelectionOutlineLayer.js","sourceRoot":"","sources":["../../../../dev/core/src/Layers/thinSelectionOutlineLayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,iCAAiC,EAAE,MAAM,sCAAsC,CAAC;AAE9H,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,0CAA0C,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAG/K,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAOrD,OAAO,EAAgC,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAyBlF;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,eAAe;IAmD1D;;;;;;OAMG;IACH,YAAmB,IAAY,EAAE,KAAa,EAAE,OAAoD,EAAE,gBAAgB,GAAG,KAAK;QAC1H,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC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IAAI,CAAC,kBAAkB,CAAC,yBAAyB,CAAC,gCAAgC,CAAC,CAAC;YACxF,CAAC;iBAAM,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBAC9B,IAAa,CAAC,qBAAqB,CAAC,yBAAyB,CAAC,gCAAgC,EAAE,IAAI,CAAC,CAAC;YAC3G,CAAC;YAED,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACzB,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;YAC/B,CAAC;QACL,CAAC;IACL,CAAC;IAED;;OAEG;IACa,OAAO;QACnB,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QAEvB,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;;AA/xBD;;GAEG;AACoB,oCAAU,GAAG,uBAAuB,AAA1B,CAA2B;AAE5D;;;GAGG;AACoB,0DAAgC,GAAG,qBAAqB,AAAxB,CAAyB","sourcesContent":["import { VertexBuffer } from \"../Buffers/buffer\";\nimport { Camera } from \"../Cameras/camera\";\nimport { Constants } from \"../Engines/constants\";\nimport { type ThinEngine } from \"../Engines/thinEngine\";\nimport { AddClipPlaneUniforms, BindClipPlane, PrepareStringDefinesForClipPlanes } from \"../Materials/clipPlaneMaterialHelper\";\nimport { type Effect, type IEffectCreationOptions } from \"../Materials/effect\";\nimport { EffectFallbacks } from \"../Materials/effectFallbacks\";\nimport { Material } from \"../Materials/material\";\nimport { BindBonesParameters, BindMorphTargetParameters, PrepareDefinesAndAttributesForMorphTargets, PushAttributesForInstances } from \"../Materials/materialHelper.functions\";\nimport { ShaderLanguage } from \"../Materials/shaderLanguage\";\nimport { type BaseTexture } from \"../Materials/Textures/baseTexture\";\nimport { Color3, Color4 } from \"../Maths/math.color\";\nimport { type AbstractMesh } from \"../Meshes/abstractMesh\";\nimport { type InstancedMesh } from \"../Meshes/instancedMesh\";\nimport { type Mesh } from \"../Meshes/mesh\";\nimport { type SubMesh } from \"../Meshes/subMesh\";\nimport { type Scene } from \"../scene\";\nimport { type Nullable } from \"../types\";\nimport { type IThinEffectLayerOptions, ThinEffectLayer } from \"./thinEffectLayer\";\n\n/**\n * Selection outline layer options. This helps customizing the behaviour\n * of the selection outline layer.\n */\nexport interface IThinSelectionOutlineLayerOptions extends IThinEffectLayerOptions {\n /**\n * Use the GLSL code generation for the shader (even on WebGPU). Default is false\n */\n forceGLSL?: boolean;\n\n /**\n * Specifies whether the depth stored is the Z coordinate in camera space.\n */\n storeCameraSpaceZ?: boolean;\n\n /**\n * Outline method to use (default: Constants.OUTLINELAYER_SAMPLING_TRIDIRECTIONAL)\n *\n * @see {@link Constants.OUTLINELAYER_SAMPLING_TRIDIRECTIONAL}\n */\n outlineMethod?: number;\n}\n\n/**\n * @internal\n */\nexport class ThinSelectionOutlineLayer extends ThinEffectLayer {\n /**\n * Effect Name of the layer.\n */\n public static readonly EffectName = \"SelectionOutlineLayer\";\n\n /**\n * Name of the instance selection ID attribute\n * @internal\n */\n public static readonly InstanceSelectionIdAttributeName = \"instanceSelectionId\";\n\n /**\n * The outline color\n */\n public outlineColor: Color3 = new Color3(1, 0.5, 0);\n\n /**\n * The thickness of the edges\n */\n public outlineThickness: number = 2.0;\n\n /**\n * The strength of the occlusion effect (default: 0.8)\n */\n public occlusionStrength: number = 0.8;\n\n /**\n * The occlusion threshold (default: 0.0001)\n */\n public occlusionThreshold: number = 0.0001;\n\n /**\n * The width of the source texture\n */\n public textureWidth: number = 0;\n\n /**\n * The height of the source texture\n */\n public textureHeight: number = 0;\n\n /** @internal */\n public override _options: Required<IThinSelectionOutlineLayerOptions>;\n\n /** @internal */\n public readonly _meshUniqueIdToSelectionId: number[] = [];\n /** @internal */\n public _selection: Nullable<AbstractMesh[]> = [];\n private _nextSelectionId = 1;\n\n /**\n * Instantiates a new selection outline Layer and references it to the scene..\n * @param name The name of the layer\n * @param scene The scene to use the layer in\n * @param options Sets of none mandatory options to use with the layer (see IThinSelectionOutlineLayerOptions for more information)\n * @param dontCheckIfReady Specifies if the layer should disable checking whether all the post processes are ready (default: false). To save performance, this should be set to true and you should call `isReady` manually before rendering to the layer.\n */\n public constructor(name: string, scene?: Scene, options?: Partial<IThinSelectionOutlineLayerOptions>, dontCheckIfReady = false) {\n super(name, scene, options !== undefined ? !!options.forceGLSL : false);\n\n // Adapt options\n this._options = {\n mainTextureRatio: 1.0,\n mainTextureFixedSize: 0,\n alphaBlendingMode: Constants.ALPHA_COMBINE,\n camera: null,\n renderingGroupId: -1,\n forceGLSL: false,\n mainTextureType: Constants.TEXTURETYPE_FLOAT,\n mainTextureFormat: Constants.TEXTUREFORMAT_RG,\n storeCameraSpaceZ: false,\n outlineMethod: Constants.OUTLINELAYER_SAMPLING_TRIDIRECTIONAL,\n ...options,\n };\n\n // Fall back to a supported mask texture type if the device doesn't support rendering to float framebuffers\n // or linear filtering of float textures (e.g. OES_texture_float_linear missing on some iOS versions)\n if (this._options.mainTextureType === Constants.TEXTURETYPE_FLOAT && !(this._engine.getCaps().textureFloatRender && this._engine.getCaps().textureFloatLinearFiltering)) {\n this._options.mainTextureType = Constants.TEXTURETYPE_HALF_FLOAT;\n }\n if (\n this._options.mainTextureType === Constants.TEXTURETYPE_HALF_FLOAT &&\n !(this._engine.getCaps().textureHalfFloatRender && this._engine.getCaps().textureHalfFloatLinearFiltering)\n ) {\n this._options.mainTextureType = Constants.TEXTURETYPE_UNSIGNED_BYTE;\n }\n\n // When using an 8-bit render target, we cannot reliably store camera-space Z in the mask texture:\n // depth would be clamped/quantized, breaking occlusion comparisons. In that case, force-disable\n // storeCameraSpaceZ so the layer falls back to the supported behavior.\n if (this._options.storeCameraSpaceZ && this._options.mainTextureType === Constants.TEXTURETYPE_UNSIGNED_BYTE) {\n this._options.storeCameraSpaceZ = false;\n }\n // set clear color\n this.neutralColor = new Color4(0.0, this._options.storeCameraSpaceZ ? 0.0 : 1.0, 0.0, 1.0);\n\n // Initialize the layer\n this._init(this._options);\n\n // Do not render as long as no meshes have been added\n this._shouldRender = false;\n\n if (dontCheckIfReady) {\n // When dontCheckIfReady is true, we are in the new ThinXXX layer mode, so we must call _createTextureAndPostProcesses ourselves (it is called by EffectLayer otherwise)\n this._createTextureAndPostProcesses();\n }\n }\n\n /**\n * Gets the class name of the effect layer\n * @returns the string with the class name of the effect layer\n */\n public getClassName(): string {\n return \"SelectionOutlineLayer\";\n }\n\n private _isDef(val: any) {\n return val !== void 0 && val !== null;\n }\n\n /** @internal */\n public override _internalIsSubMeshReady(subMesh: SubMesh, useInstances: boolean, _emissiveTexture: Nullable<BaseTexture>): boolean {\n const engine = this._scene.getEngine();\n const mesh = subMesh.getMesh();\n\n const renderingMaterial = mesh._internalAbstractMeshDataInfo._materialForRenderPass?.[engine.currentRenderPassId];\n\n if (renderingMaterial) {\n return renderingMaterial.isReadyForSubMesh(mesh, subMesh, useInstances);\n }\n\n const material = subMesh.getMaterial();\n\n if (!material) {\n return false;\n }\n\n // selection outline layer is not compatible with custom materials\n // if (this._useMeshMaterial(subMesh.getRenderingMesh())) {\n // return material.isReadyForSubMesh(subMesh.getMesh(), subMesh, useInstances);\n // }\n\n const defines: string[] = [];\n\n const attribs = [VertexBuffer.PositionKind];\n\n let uv1 = false;\n let uv2 = false;\n const color = false;\n\n // Alpha test\n if (material.needAlphaTestingForMesh(mesh)) {\n defines.push(\"#define ALPHATEST\");\n if (mesh.isVerticesDataPresent(VertexBuffer.UVKind)) {\n attribs.push(VertexBuffer.UVKind);\n defines.push(\"#define UV1\");\n uv1 = true;\n }\n if (mesh.isVerticesDataPresent(VertexBuffer.UV2Kind)) {\n attribs.push(VertexBuffer.UV2Kind);\n defines.push(\"#define UV2\");\n uv2 = true;\n }\n }\n\n // Bones\n const fallbacks = new EffectFallbacks();\n if (mesh.useBones && mesh.computeBonesUsingShaders) {\n attribs.push(VertexBuffer.MatricesIndicesKind);\n attribs.push(VertexBuffer.MatricesWeightsKind);\n if (mesh.numBoneInfluencers > 4) {\n attribs.push(VertexBuffer.MatricesIndicesExtraKind);\n attribs.push(VertexBuffer.MatricesWeightsExtraKind);\n }\n\n defines.push(\"#define NUM_BONE_INFLUENCERS \" + mesh.numBoneInfluencers);\n\n const skeleton = mesh.skeleton;\n if (skeleton && skeleton.isUsingTextureForMatrices) {\n defines.push(\"#define BONETEXTURE\");\n } else {\n defines.push(\"#define BonesPerMesh \" + (skeleton ? skeleton.bones.length + 1 : 0));\n }\n\n if (mesh.numBoneInfluencers > 0) {\n fallbacks.addCPUSkinningFallback(0, mesh);\n }\n } else {\n defines.push(\"#define NUM_BONE_INFLUENCERS 0\");\n }\n\n // Morph targets\n const numMorphInfluencers = mesh.morphTargetManager\n ? PrepareDefinesAndAttributesForMorphTargets(\n mesh.morphTargetManager,\n defines,\n attribs,\n mesh,\n true, // usePositionMorph\n false, // useNormalMorph\n false, // useTangentMorph\n uv1, // useUVMorph\n uv2, // useUV2Morph\n color // useColorMorph\n )\n : 0;\n\n // Instances\n if (useInstances) {\n defines.push(\"#define INSTANCES\");\n PushAttributesForInstances(attribs);\n if (subMesh.getRenderingMesh().hasThinInstances) {\n defines.push(\"#define THIN_INSTANCES\");\n }\n }\n\n // Baked vertex animations\n const bvaManager = mesh.bakedVertexAnimationManager;\n if (bvaManager && bvaManager.isEnabled) {\n defines.push(\"#define BAKED_VERTEX_ANIMATION_TEXTURE\");\n if (useInstances) {\n attribs.push(\"bakedVertexAnimationSettingsInstanced\");\n }\n }\n\n // ClipPlanes\n PrepareStringDefinesForClipPlanes(material, this._scene, defines);\n\n // Selection ID\n if (useInstances) {\n attribs.push(ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName);\n }\n\n this._addCustomEffectDefines(defines);\n\n // Get correct effect\n const drawWrapper = subMesh._getDrawWrapper(undefined, true)!;\n const cachedDefines = drawWrapper.defines as string;\n const join = defines.join(\"\\n\");\n if (cachedDefines !== join) {\n const uniforms = [\n \"world\",\n \"mBones\",\n \"viewProjection\",\n \"view\",\n \"morphTargetInfluences\",\n \"morphTargetCount\",\n \"boneTextureInfo\",\n \"diffuseMatrix\",\n \"morphTargetTextureInfo\",\n \"morphTargetTextureIndices\",\n \"bakedVertexAnimationSettings\",\n \"bakedVertexAnimationTextureSizeInverted\",\n \"bakedVertexAnimationTime\",\n \"bakedVertexAnimationTexture\",\n \"depthValues\",\n \"selectionId\",\n ];\n\n AddClipPlaneUniforms(uniforms);\n\n drawWrapper.setEffect(\n this._engine.createEffect(\n \"selection\",\n <IEffectCreationOptions>{\n attributes: attribs,\n uniformsNames: uniforms,\n uniformBuffersNames: [],\n samplers: [\"diffuseSampler\", \"boneSampler\", \"morphTargets\", \"bakedVertexAnimationTexture\"],\n defines: join,\n fallbacks: fallbacks,\n onCompiled: null,\n onError: null,\n indexParameters: { maxSimultaneousMorphTargets: numMorphInfluencers },\n shaderLanguage: this._shaderLanguage,\n extraInitializationsAsync: this._shadersLoaded\n ? undefined\n : async () => {\n await this._importShadersAsync();\n this._shadersLoaded = true;\n },\n },\n this._engine\n ),\n join\n );\n }\n\n const effectIsReady = drawWrapper.effect!.isReady();\n\n return effectIsReady && (this._dontCheckIfReady || (!this._dontCheckIfReady && this.isLayerReady()));\n }\n\n protected override async _importShadersAsync(): Promise<void> {\n if (this._shaderLanguage === ShaderLanguage.WGSL) {\n await Promise.all([\n import(\"../ShadersWGSL/selection.vertex\"),\n import(\"../ShadersWGSL/selection.fragment\"),\n import(\"../ShadersWGSL/glowMapMerge.vertex\"),\n import(\"../ShadersWGSL/selectionOutline.fragment\"),\n ]);\n } else {\n await Promise.all([\n import(\"../Shaders/selection.vertex\"),\n import(\"../Shaders/selection.fragment\"),\n import(\"../Shaders/glowMapMerge.vertex\"),\n import(\"../Shaders/selectionOutline.fragment\"),\n ]);\n }\n\n await super._importShadersAsync();\n }\n\n /**\n * Get the effect name of the layer.\n * @returns The effect name\n */\n public override getEffectName(): string {\n return ThinSelectionOutlineLayer.EffectName;\n }\n\n /** @internal */\n public override _createMergeEffect(): Effect {\n const defines: string[] = [];\n switch (this._options.outlineMethod) {\n case Constants.OUTLINELAYER_SAMPLING_TRIDIRECTIONAL:\n defines.push(\"#define OUTLINELAYER_SAMPLING_TRIDIRECTIONAL\");\n break;\n case Constants.OUTLINELAYER_SAMPLING_OCTADIRECTIONAL:\n defines.push(\"#define OUTLINELAYER_SAMPLING_OCTADIRECTIONAL\");\n break;\n }\n const join = defines.join(\"\\n\");\n\n return this._engine.createEffect(\n {\n // glowMapMerge vertex is just a basic vertex shader for drawing a quad. so we reuse it here\n vertex: \"glowMapMerge\",\n // selection outline fragment does computation of outline with alpha channel for blending\n fragment: \"selectionOutline\",\n },\n <IEffectCreationOptions>{\n attributes: [VertexBuffer.PositionKind],\n uniformsNames: [\"screenSize\", \"outlineColor\", \"outlineThickness\", \"occlusionStrength\", \"occlusionThreshold\"],\n samplers: [\"maskSampler\", \"depthSampler\"],\n defines: join,\n fallbacks: null,\n onCompiled: null,\n onError: null,\n shaderLanguage: this._shaderLanguage,\n extraInitializationsAsync: this._shadersLoaded\n ? undefined\n : async () => {\n await this._importShadersAsync();\n this._shadersLoaded = true;\n },\n },\n this._engine\n );\n }\n\n /** @internal */\n public override _createTextureAndPostProcesses(): void {\n // we don't need to create a texture for this layer. since all computation is done in the merge effect\n }\n\n /**\n * Checks for the readiness of the element composing the layer.\n * @param subMesh the mesh to check for\n * @param useInstances specify whether or not to use instances to render the mesh\n * @returns true if ready otherwise, false\n */\n public override isReady(subMesh: SubMesh, useInstances: boolean): boolean {\n const material = subMesh.getMaterial();\n const mesh = subMesh.getRenderingMesh();\n\n if (!material || !mesh || !this._selection) {\n return false;\n }\n\n return super._isSubMeshReady(subMesh, useInstances, null);\n }\n\n /** @internal */\n public override _canRenderMesh(_mesh: AbstractMesh, _material: Material): boolean {\n return true;\n }\n\n protected override _renderSubMesh(subMesh: SubMesh, enableAlphaMode: boolean = false): void {\n if (!this._internalShouldRender()) {\n return;\n }\n\n const material = subMesh.getMaterial();\n const ownerMesh = subMesh.getMesh();\n const replacementMesh = subMesh.getReplacementMesh();\n const renderingMesh = subMesh.getRenderingMesh();\n const effectiveMesh = subMesh.getEffectiveMesh();\n const scene = this._scene;\n const engine = scene.getEngine();\n\n effectiveMesh._internalAbstractMeshDataInfo._isActiveIntermediate = false;\n\n if (!material) {\n return;\n }\n\n // Do not block in blend mode.\n if (!this._canRenderMesh(renderingMesh, material)) {\n return;\n }\n\n // Culling\n let sideOrientation = material._getEffectiveOrientation(renderingMesh);\n const mainDeterminant = effectiveMesh._getWorldMatrixDeterminant();\n if (mainDeterminant < 0) {\n sideOrientation = sideOrientation === Material.ClockWiseSideOrientation ? Material.CounterClockWiseSideOrientation : Material.ClockWiseSideOrientation;\n }\n\n const reverse = sideOrientation === Material.ClockWiseSideOrientation;\n engine.setState(material.backFaceCulling, material.zOffset, undefined, reverse, material.cullBackFaces, undefined, material.zOffsetUnits);\n\n // Managing instances\n const batch = renderingMesh._getInstancesRenderList(subMesh._id, !!replacementMesh);\n if (batch.mustReturn) {\n return;\n }\n\n // Early Exit per mesh\n if (!this._shouldRenderMesh(renderingMesh)) {\n return;\n }\n\n const hardwareInstancedRendering =\n batch.hardwareInstancedRendering[subMesh._id] ||\n renderingMesh.hasThinInstances ||\n (!!renderingMesh._userInstancedBuffersStorage &&\n ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName in renderingMesh._userInstancedBuffersStorage.vertexBuffers);\n\n this._setEmissiveTextureAndColor(renderingMesh, subMesh, material);\n\n this.onBeforeRenderMeshToEffect.notifyObservers(ownerMesh);\n\n // selection outline layer is not compatible with custom materials\n // if (this._useMeshMaterial(renderingMesh)) {\n // subMesh.getMaterial()!._glowModeEnabled = true;\n // renderingMesh.render(subMesh, enableAlphaMode, replacementMesh || undefined);\n // subMesh.getMaterial()!._glowModeEnabled = false;\n // } else\n if (this._isSubMeshReady(subMesh, hardwareInstancedRendering, this._emissiveTextureAndColor.texture)) {\n const renderingMaterial = effectiveMesh._internalAbstractMeshDataInfo._materialForRenderPass?.[engine.currentRenderPassId];\n\n let drawWrapper = subMesh._getDrawWrapper();\n if (!drawWrapper && renderingMaterial) {\n drawWrapper = renderingMaterial._getDrawWrapper();\n }\n\n if (!drawWrapper) {\n return;\n }\n\n const effect = drawWrapper.effect!;\n\n engine.enableEffect(drawWrapper);\n if (!hardwareInstancedRendering) {\n renderingMesh._bind(subMesh, effect, material.fillMode);\n }\n\n if (!renderingMaterial) {\n effect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\n if (this._options.storeCameraSpaceZ) {\n effect.setMatrix(\"view\", scene.getViewMatrix());\n } else {\n const camera = this.camera || scene.activeCamera;\n if (camera) {\n const cameraIsOrtho = camera.mode === Camera.ORTHOGRAPHIC_CAMERA;\n\n let minZ: number, maxZ: number;\n\n if (cameraIsOrtho) {\n minZ = !engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : 1;\n maxZ = engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : 1;\n } else {\n minZ = engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? camera.minZ : engine.isNDCHalfZRange ? 0 : camera.minZ;\n maxZ = engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : camera.maxZ;\n }\n\n effect.setFloat2(\"depthValues\", minZ, minZ + maxZ);\n }\n }\n effect.setMatrix(\"world\", effectiveMesh.getWorldMatrix());\n } else {\n renderingMaterial.bindForSubMesh(effectiveMesh.getWorldMatrix(), effectiveMesh as Mesh, subMesh);\n }\n\n if (!renderingMaterial) {\n // Alpha test\n if (material && material.needAlphaTestingForMesh(effectiveMesh)) {\n const alphaTexture = material.getAlphaTestTexture();\n if (alphaTexture) {\n effect.setTexture(\"diffuseSampler\", alphaTexture);\n effect.setMatrix(\"diffuseMatrix\", alphaTexture.getTextureMatrix());\n }\n }\n\n // Bones\n BindBonesParameters(renderingMesh, effect);\n\n // Morph targets\n BindMorphTargetParameters(renderingMesh, effect);\n if (renderingMesh.morphTargetManager && renderingMesh.morphTargetManager.isUsingTextureForTargets) {\n renderingMesh.morphTargetManager._bind(effect);\n }\n\n // Baked vertex animations\n const bvaManager = subMesh.getMesh().bakedVertexAnimationManager;\n if (bvaManager && bvaManager.isEnabled) {\n bvaManager.bind(effect, hardwareInstancedRendering);\n }\n\n // Alpha mode\n if (enableAlphaMode) {\n engine.setAlphaMode(material.alphaMode);\n }\n\n // Clip planes\n BindClipPlane(effect, material, scene);\n\n // Selection ID\n let selectionId = this._meshUniqueIdToSelectionId[renderingMesh.uniqueId];\n // When using LOD, the rendering mesh is the LOD mesh, not the source mesh.\n // Look up the selection ID from the master (source) mesh.\n if (selectionId === undefined && renderingMesh._masterMesh) {\n selectionId = this._meshUniqueIdToSelectionId[renderingMesh._masterMesh.uniqueId];\n if (selectionId === undefined) {\n selectionId = renderingMesh._masterMesh.instancedBuffers?.[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName];\n }\n }\n if (!renderingMesh.hasInstances && !renderingMesh.hasThinInstances && !renderingMesh.isAnInstance && selectionId !== undefined) {\n effect.setFloat(\"selectionId\", selectionId);\n }\n }\n\n // Draw\n renderingMesh._processRendering(effectiveMesh, subMesh, effect, material.fillMode, batch, hardwareInstancedRendering, (isInstance, world) =>\n effect.setMatrix(\"world\", world)\n );\n } else {\n // Need to reset refresh rate of the main map\n this._objectRenderer.resetRefreshCounter();\n }\n\n this.onAfterRenderMeshToEffect.notifyObservers(ownerMesh);\n }\n\n /** @internal */\n public override _internalCompose(effect: Effect, _renderIndex: number): void {\n // Texture\n this.bindTexturesForCompose(effect);\n effect.setFloat2(\"screenSize\", this.textureWidth, this.textureHeight);\n effect.setColor3(\"outlineColor\", this.outlineColor);\n effect.setFloat(\"outlineThickness\", this.outlineThickness);\n effect.setFloat(\"occlusionStrength\", this.occlusionStrength);\n effect.setFloat(\"occlusionThreshold\", this.occlusionThreshold);\n\n // Cache\n const engine = this._engine;\n const previousStencilBuffer = engine.getStencilBuffer();\n\n // Draw order\n engine.setStencilBuffer(false);\n\n engine.drawElementsType(Material.TriangleFillMode, 0, 6);\n\n // Draw order\n engine.setStencilBuffer(previousStencilBuffer);\n }\n\n /** @internal */\n public override _setEmissiveTextureAndColor(_mesh: Mesh, _subMesh: SubMesh, _material: Material): void {\n // we don't use emissive texture or color for this layer\n }\n\n /**\n * Returns true if the layer contains information to display, otherwise false.\n * @returns true if the glow layer should be rendered\n */\n public override shouldRender(): boolean {\n return this._selection && super.shouldRender() ? true : false;\n }\n\n /** @internal */\n public override _shouldRenderMesh(mesh: Mesh): boolean {\n // Use the base class check (renderingGroupId) rather than this.hasMesh,\n // because LOD meshes won't be in _selection but still need to render.\n return super.hasMesh(mesh);\n }\n\n /** @internal */\n public override _addCustomEffectDefines(defines: string[]): void {\n if (this._options.storeCameraSpaceZ) {\n defines.push(\"#define STORE_CAMERASPACE_Z\");\n }\n }\n\n /**\n * Determine if a given mesh will be used in the current effect.\n * @param mesh mesh to test\n * @returns true if the mesh will be used\n */\n public override hasMesh(mesh: AbstractMesh): boolean {\n if (!super.hasMesh(mesh) || !this._selection) {\n return false;\n }\n return this._selection.indexOf(mesh) !== -1;\n }\n\n /** @internal */\n public override _useMeshMaterial(_mesh: AbstractMesh): boolean {\n return false;\n }\n\n private _clearMeshSelection(mesh: Mesh): void {\n if (mesh._userInstancedBuffersStorage) {\n const kind = ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName;\n\n // Dispose per-pass VBOs for this layer's own render passes only (WebGPU)\n if (mesh._userInstancedBuffersStorage.renderPasses) {\n for (const passId of this._objectRenderer.renderPassIds) {\n const passVBOs = mesh._userInstancedBuffersStorage.renderPasses[passId];\n if (passVBOs?.[kind]) {\n passVBOs[kind]!.dispose();\n delete passVBOs[kind];\n }\n }\n }\n\n mesh._userInstancedBuffersStorage.vertexBuffers[kind]?.dispose();\n\n const vao = mesh._userInstancedBuffersStorage.vertexArrayObjects?.[kind];\n if (vao) {\n // invalidate VAO is very important to keep sync between VAO and vertex buffers\n (this._engine as ThinEngine).releaseVertexArrayObject(vao);\n delete mesh._userInstancedBuffersStorage.vertexArrayObjects![kind];\n }\n\n delete mesh._userInstancedBuffersStorage.data[kind];\n delete mesh._userInstancedBuffersStorage.vertexBuffers[kind];\n delete mesh._userInstancedBuffersStorage.strides[kind];\n delete mesh._userInstancedBuffersStorage.sizes[kind];\n\n if (Object.keys(mesh._userInstancedBuffersStorage.vertexBuffers).length === 0) {\n mesh._userInstancedBuffersStorage = undefined!;\n }\n }\n if (this._isDef(mesh.instancedBuffers?.[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName])) {\n delete mesh.instancedBuffers[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName];\n }\n if (this._selection) {\n const index = this._selection.indexOf(mesh);\n if (~index) {\n this._selection.splice(index, 1);\n }\n }\n }\n\n /**\n * Remove all the meshes currently referenced in the selection outline layer\n */\n public clearSelection(): void {\n if (!this._selection) {\n return;\n }\n\n for (let index = 0; index < this._selection.length; ++index) {\n const mesh = this._selection[index] as Mesh;\n this._clearMeshSelection(mesh);\n if (this._isDef(mesh.instancedBuffers?.[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName])) {\n delete mesh.instancedBuffers[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName];\n }\n }\n this._selection.length = 0;\n this._meshUniqueIdToSelectionId.length = 0;\n\n this._nextSelectionId = 1;\n\n this._shouldRender = false;\n }\n\n /**\n * Adds mesh or group of mesh to the current selection\n *\n * If a group of meshes is provided, they will outline as a single unit\n * @param meshOrGroup Meshes to add to the selection\n */\n public addSelection(meshOrGroup: AbstractMesh | AbstractMesh[]): void {\n if (!this._selection) {\n return;\n }\n\n const nextId = this._nextSelectionId;\n\n const group = Array.isArray(meshOrGroup) ? meshOrGroup : [meshOrGroup];\n if (group.length === 0) {\n return;\n }\n\n for (let meshIndex = 0; meshIndex < group.length; ++meshIndex) {\n const mesh = group[meshIndex];\n\n this._selection.push(mesh); // add to render list\n\n if (mesh.hasInstances || mesh.isAnInstance) {\n const sourceMesh = (mesh as InstancedMesh).sourceMesh ?? (mesh as Mesh);\n\n if (!this._isDef(sourceMesh.instancedBuffers?.[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName])) {\n sourceMesh.registerInstancedBuffer(ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName, 1);\n }\n\n mesh.instancedBuffers[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName] = nextId;\n } else if (mesh.hasThinInstances) {\n const thinInstanceCount = (mesh as Mesh).thinInstanceCount;\n const selectionIdData = new Float32Array(thinInstanceCount);\n for (let i = 0; i < thinInstanceCount; i++) {\n selectionIdData[i] = nextId;\n }\n (mesh as Mesh).thinInstanceSetBuffer(ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName, selectionIdData, 1);\n } else {\n this._meshUniqueIdToSelectionId[mesh.uniqueId] = nextId;\n }\n }\n this._nextSelectionId += 1;\n\n this._shouldRender = true;\n }\n\n /**\n * Adds mesh or group of mesh to the current selection\n * @param meshOrGroup Meshes to remove from the selection\n */\n\n public removeSelection(meshOrGroup: AbstractMesh | AbstractMesh[]) {\n if (!this._selection) {\n return;\n }\n const group = Array.isArray(meshOrGroup) ? meshOrGroup : [meshOrGroup];\n if (group.length === 0) {\n return;\n }\n for (let i = 0; i < group.length; i++) {\n const mesh = group[i] as Mesh;\n this._clearMeshSelection(mesh);\n delete this._meshUniqueIdToSelectionId[mesh.uniqueId];\n }\n if (!this._selection || !this._selection.length) {\n this._meshUniqueIdToSelectionId.length = 0;\n\n this._nextSelectionId = 1;\n\n this._shouldRender = false;\n }\n }\n\n /**\n * Free any resources and references associated to a mesh.\n * Internal use\n * @param mesh The mesh to free.\n * @internal\n */\n public _disposeMesh(mesh: Mesh): void {\n const selection = this._selection;\n if (!selection) {\n return;\n }\n\n const index = selection.indexOf(mesh);\n if (index !== -1) {\n selection.splice(index, 1);\n\n if (mesh.hasInstances) {\n mesh.removeVerticesData(ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName);\n } else if (mesh.hasThinInstances) {\n (mesh as Mesh).thinInstanceSetBuffer(ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName, null);\n }\n\n if (selection.length === 0) {\n this._shouldRender = false;\n }\n }\n }\n\n /**\n * Dispose the effect layer and free resources.\n */\n public override dispose(): void {\n this.clearSelection();\n this._selection = null;\n\n super.dispose();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"thinSelectionOutlineLayer.js","sourceRoot":"","sources":["../../../../dev/core/src/Layers/thinSelectionOutlineLayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,iCAAiC,EAAE,MAAM,sCAAsC,CAAC;AAE9H,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,0CAA0C,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAG/K,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAOrD,OAAO,EAAgC,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAyBlF;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,eAAe;IAoD1D;;;;;;OAMG;IACH,YAAmB,IAAY,EAAE,KAAa,EAAE,OAAoD,EAAE,gBAAgB,GAAG,KAAK;QAC1H,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAhD5E;;WAEG;QACI,iBAAY,GAAW,IAAI,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;Q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G,uBAAuB,AAA1B,CAA2B;AAE5D;;;GAGG;AACoB,0DAAgC,GAAG,qBAAqB,AAAxB,CAAyB","sourcesContent":["import { VertexBuffer } from \"../Buffers/buffer\";\nimport { Camera } from \"../Cameras/camera\";\nimport { Constants } from \"../Engines/constants\";\nimport { type ThinEngine } from \"../Engines/thinEngine\";\nimport { AddClipPlaneUniforms, BindClipPlane, PrepareStringDefinesForClipPlanes } from \"../Materials/clipPlaneMaterialHelper\";\nimport { type Effect, type IEffectCreationOptions } from \"../Materials/effect\";\nimport { EffectFallbacks } from \"../Materials/effectFallbacks\";\nimport { Material } from \"../Materials/material\";\nimport { BindBonesParameters, BindMorphTargetParameters, PrepareDefinesAndAttributesForMorphTargets, PushAttributesForInstances } from \"../Materials/materialHelper.functions\";\nimport { ShaderLanguage } from \"../Materials/shaderLanguage\";\nimport { type BaseTexture } from \"../Materials/Textures/baseTexture\";\nimport { Color3, Color4 } from \"../Maths/math.color\";\nimport { type AbstractMesh } from \"../Meshes/abstractMesh\";\nimport { type InstancedMesh } from \"../Meshes/instancedMesh\";\nimport { type Mesh } from \"../Meshes/mesh\";\nimport { type SubMesh } from \"../Meshes/subMesh\";\nimport { type Scene } from \"../scene\";\nimport { type Nullable } from \"../types\";\nimport { type IThinEffectLayerOptions, ThinEffectLayer } from \"./thinEffectLayer\";\n\n/**\n * Selection outline layer options. This helps customizing the behaviour\n * of the selection outline layer.\n */\nexport interface IThinSelectionOutlineLayerOptions extends IThinEffectLayerOptions {\n /**\n * Use the GLSL code generation for the shader (even on WebGPU). Default is false\n */\n forceGLSL?: boolean;\n\n /**\n * Specifies whether the depth stored is the Z coordinate in camera space.\n */\n storeCameraSpaceZ?: boolean;\n\n /**\n * Outline method to use (default: Constants.OUTLINELAYER_SAMPLING_TRIDIRECTIONAL)\n *\n * @see {@link Constants.OUTLINELAYER_SAMPLING_TRIDIRECTIONAL}\n */\n outlineMethod?: number;\n}\n\n/**\n * @internal\n */\nexport class ThinSelectionOutlineLayer extends ThinEffectLayer {\n /**\n * Effect Name of the layer.\n */\n public static readonly EffectName = \"SelectionOutlineLayer\";\n\n /**\n * Name of the instance selection ID attribute\n * @internal\n */\n public static readonly InstanceSelectionIdAttributeName = \"instanceSelectionId\";\n\n /**\n * The outline color\n */\n public outlineColor: Color3 = new Color3(1, 0.5, 0);\n\n /**\n * The thickness of the edges\n */\n public outlineThickness: number = 2.0;\n\n /**\n * The strength of the occlusion effect (default: 0.8)\n */\n public occlusionStrength: number = 0.8;\n\n /**\n * The occlusion threshold (default: 0.0001)\n */\n public occlusionThreshold: number = 0.0001;\n\n /**\n * The width of the source texture\n */\n public textureWidth: number = 0;\n\n /**\n * The height of the source texture\n */\n public textureHeight: number = 0;\n\n /** @internal */\n public override _options: Required<IThinSelectionOutlineLayerOptions>;\n\n /** @internal */\n public readonly _meshUniqueIdToSelectionId: number[] = [];\n /** @internal */\n public _selection: Nullable<AbstractMesh[]> = [];\n private _instancedBufferSources: Set<Mesh> = new Set();\n private _nextSelectionId = 1;\n\n /**\n * Instantiates a new selection outline Layer and references it to the scene..\n * @param name The name of the layer\n * @param scene The scene to use the layer in\n * @param options Sets of none mandatory options to use with the layer (see IThinSelectionOutlineLayerOptions for more information)\n * @param dontCheckIfReady Specifies if the layer should disable checking whether all the post processes are ready (default: false). To save performance, this should be set to true and you should call `isReady` manually before rendering to the layer.\n */\n public constructor(name: string, scene?: Scene, options?: Partial<IThinSelectionOutlineLayerOptions>, dontCheckIfReady = false) {\n super(name, scene, options !== undefined ? !!options.forceGLSL : false);\n\n // Adapt options\n this._options = {\n mainTextureRatio: 1.0,\n mainTextureFixedSize: 0,\n alphaBlendingMode: Constants.ALPHA_COMBINE,\n camera: null,\n renderingGroupId: -1,\n forceGLSL: false,\n mainTextureType: Constants.TEXTURETYPE_FLOAT,\n mainTextureFormat: Constants.TEXTUREFORMAT_RG,\n storeCameraSpaceZ: false,\n outlineMethod: Constants.OUTLINELAYER_SAMPLING_TRIDIRECTIONAL,\n ...options,\n };\n\n // Fall back to a supported mask texture type if the device doesn't support rendering to float framebuffers\n // or linear filtering of float textures (e.g. OES_texture_float_linear missing on some iOS versions)\n if (this._options.mainTextureType === Constants.TEXTURETYPE_FLOAT && !(this._engine.getCaps().textureFloatRender && this._engine.getCaps().textureFloatLinearFiltering)) {\n this._options.mainTextureType = Constants.TEXTURETYPE_HALF_FLOAT;\n }\n if (\n this._options.mainTextureType === Constants.TEXTURETYPE_HALF_FLOAT &&\n !(this._engine.getCaps().textureHalfFloatRender && this._engine.getCaps().textureHalfFloatLinearFiltering)\n ) {\n this._options.mainTextureType = Constants.TEXTURETYPE_UNSIGNED_BYTE;\n }\n\n // When using an 8-bit render target, we cannot reliably store camera-space Z in the mask texture:\n // depth would be clamped/quantized, breaking occlusion comparisons. In that case, force-disable\n // storeCameraSpaceZ so the layer falls back to the supported behavior.\n if (this._options.storeCameraSpaceZ && this._options.mainTextureType === Constants.TEXTURETYPE_UNSIGNED_BYTE) {\n this._options.storeCameraSpaceZ = false;\n }\n // set clear color\n this.neutralColor = new Color4(0.0, this._options.storeCameraSpaceZ ? 0.0 : 1.0, 0.0, 1.0);\n\n // Initialize the layer\n this._init(this._options);\n\n // Do not render as long as no meshes have been added\n this._shouldRender = false;\n\n if (dontCheckIfReady) {\n // When dontCheckIfReady is true, we are in the new ThinXXX layer mode, so we must call _createTextureAndPostProcesses ourselves (it is called by EffectLayer otherwise)\n this._createTextureAndPostProcesses();\n }\n }\n\n /**\n * Gets the class name of the effect layer\n * @returns the string with the class name of the effect layer\n */\n public getClassName(): string {\n return \"SelectionOutlineLayer\";\n }\n\n private _isDef(val: any) {\n return val !== void 0 && val !== null;\n }\n\n /** @internal */\n public override _internalIsSubMeshReady(subMesh: SubMesh, useInstances: boolean, _emissiveTexture: Nullable<BaseTexture>): boolean {\n const engine = this._scene.getEngine();\n const mesh = subMesh.getMesh();\n\n const renderingMaterial = mesh._internalAbstractMeshDataInfo._materialForRenderPass?.[engine.currentRenderPassId];\n\n if (renderingMaterial) {\n return renderingMaterial.isReadyForSubMesh(mesh, subMesh, useInstances);\n }\n\n const material = subMesh.getMaterial();\n\n if (!material) {\n return false;\n }\n\n // selection outline layer is not compatible with custom materials\n // if (this._useMeshMaterial(subMesh.getRenderingMesh())) {\n // return material.isReadyForSubMesh(subMesh.getMesh(), subMesh, useInstances);\n // }\n\n const defines: string[] = [];\n\n const attribs = [VertexBuffer.PositionKind];\n\n let uv1 = false;\n let uv2 = false;\n const color = false;\n\n // Alpha test\n if (material.needAlphaTestingForMesh(mesh)) {\n defines.push(\"#define ALPHATEST\");\n if (mesh.isVerticesDataPresent(VertexBuffer.UVKind)) {\n attribs.push(VertexBuffer.UVKind);\n defines.push(\"#define UV1\");\n uv1 = true;\n }\n if (mesh.isVerticesDataPresent(VertexBuffer.UV2Kind)) {\n attribs.push(VertexBuffer.UV2Kind);\n defines.push(\"#define UV2\");\n uv2 = true;\n }\n }\n\n // Bones\n const fallbacks = new EffectFallbacks();\n if (mesh.useBones && mesh.computeBonesUsingShaders) {\n attribs.push(VertexBuffer.MatricesIndicesKind);\n attribs.push(VertexBuffer.MatricesWeightsKind);\n if (mesh.numBoneInfluencers > 4) {\n attribs.push(VertexBuffer.MatricesIndicesExtraKind);\n attribs.push(VertexBuffer.MatricesWeightsExtraKind);\n }\n\n defines.push(\"#define NUM_BONE_INFLUENCERS \" + mesh.numBoneInfluencers);\n\n const skeleton = mesh.skeleton;\n if (skeleton && skeleton.isUsingTextureForMatrices) {\n defines.push(\"#define BONETEXTURE\");\n } else {\n defines.push(\"#define BonesPerMesh \" + (skeleton ? skeleton.bones.length + 1 : 0));\n }\n\n if (mesh.numBoneInfluencers > 0) {\n fallbacks.addCPUSkinningFallback(0, mesh);\n }\n } else {\n defines.push(\"#define NUM_BONE_INFLUENCERS 0\");\n }\n\n // Morph targets\n const numMorphInfluencers = mesh.morphTargetManager\n ? PrepareDefinesAndAttributesForMorphTargets(\n mesh.morphTargetManager,\n defines,\n attribs,\n mesh,\n true, // usePositionMorph\n false, // useNormalMorph\n false, // useTangentMorph\n uv1, // useUVMorph\n uv2, // useUV2Morph\n color // useColorMorph\n )\n : 0;\n\n // Instances\n if (useInstances) {\n defines.push(\"#define INSTANCES\");\n PushAttributesForInstances(attribs);\n if (subMesh.getRenderingMesh().hasThinInstances) {\n defines.push(\"#define THIN_INSTANCES\");\n }\n }\n\n // Baked vertex animations\n const bvaManager = mesh.bakedVertexAnimationManager;\n if (bvaManager && bvaManager.isEnabled) {\n defines.push(\"#define BAKED_VERTEX_ANIMATION_TEXTURE\");\n if (useInstances) {\n attribs.push(\"bakedVertexAnimationSettingsInstanced\");\n }\n }\n\n // ClipPlanes\n PrepareStringDefinesForClipPlanes(material, this._scene, defines);\n\n // Selection ID\n if (useInstances) {\n attribs.push(ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName);\n }\n\n this._addCustomEffectDefines(defines);\n\n // Get correct effect\n const drawWrapper = subMesh._getDrawWrapper(undefined, true)!;\n const cachedDefines = drawWrapper.defines as string;\n const join = defines.join(\"\\n\");\n if (cachedDefines !== join) {\n const uniforms = [\n \"world\",\n \"mBones\",\n \"viewProjection\",\n \"view\",\n \"morphTargetInfluences\",\n \"morphTargetCount\",\n \"boneTextureInfo\",\n \"diffuseMatrix\",\n \"morphTargetTextureInfo\",\n \"morphTargetTextureIndices\",\n \"bakedVertexAnimationSettings\",\n \"bakedVertexAnimationTextureSizeInverted\",\n \"bakedVertexAnimationTime\",\n \"bakedVertexAnimationTexture\",\n \"depthValues\",\n \"selectionId\",\n ];\n\n AddClipPlaneUniforms(uniforms);\n\n drawWrapper.setEffect(\n this._engine.createEffect(\n \"selection\",\n <IEffectCreationOptions>{\n attributes: attribs,\n uniformsNames: uniforms,\n uniformBuffersNames: [],\n samplers: [\"diffuseSampler\", \"boneSampler\", \"morphTargets\", \"bakedVertexAnimationTexture\"],\n defines: join,\n fallbacks: fallbacks,\n onCompiled: null,\n onError: null,\n indexParameters: { maxSimultaneousMorphTargets: numMorphInfluencers },\n shaderLanguage: this._shaderLanguage,\n extraInitializationsAsync: this._shadersLoaded\n ? undefined\n : async () => {\n await this._importShadersAsync();\n this._shadersLoaded = true;\n },\n },\n this._engine\n ),\n join\n );\n }\n\n const effectIsReady = drawWrapper.effect!.isReady();\n\n return effectIsReady && (this._dontCheckIfReady || (!this._dontCheckIfReady && this.isLayerReady()));\n }\n\n protected override async _importShadersAsync(): Promise<void> {\n if (this._shaderLanguage === ShaderLanguage.WGSL) {\n await Promise.all([\n import(\"../ShadersWGSL/selection.vertex\"),\n import(\"../ShadersWGSL/selection.fragment\"),\n import(\"../ShadersWGSL/glowMapMerge.vertex\"),\n import(\"../ShadersWGSL/selectionOutline.fragment\"),\n ]);\n } else {\n await Promise.all([\n import(\"../Shaders/selection.vertex\"),\n import(\"../Shaders/selection.fragment\"),\n import(\"../Shaders/glowMapMerge.vertex\"),\n import(\"../Shaders/selectionOutline.fragment\"),\n ]);\n }\n\n await super._importShadersAsync();\n }\n\n /**\n * Get the effect name of the layer.\n * @returns The effect name\n */\n public override getEffectName(): string {\n return ThinSelectionOutlineLayer.EffectName;\n }\n\n /** @internal */\n public override _createMergeEffect(): Effect {\n const defines: string[] = [];\n switch (this._options.outlineMethod) {\n case Constants.OUTLINELAYER_SAMPLING_TRIDIRECTIONAL:\n defines.push(\"#define OUTLINELAYER_SAMPLING_TRIDIRECTIONAL\");\n break;\n case Constants.OUTLINELAYER_SAMPLING_OCTADIRECTIONAL:\n defines.push(\"#define OUTLINELAYER_SAMPLING_OCTADIRECTIONAL\");\n break;\n }\n const join = defines.join(\"\\n\");\n\n return this._engine.createEffect(\n {\n // glowMapMerge vertex is just a basic vertex shader for drawing a quad. so we reuse it here\n vertex: \"glowMapMerge\",\n // selection outline fragment does computation of outline with alpha channel for blending\n fragment: \"selectionOutline\",\n },\n <IEffectCreationOptions>{\n attributes: [VertexBuffer.PositionKind],\n uniformsNames: [\"screenSize\", \"outlineColor\", \"outlineThickness\", \"occlusionStrength\", \"occlusionThreshold\"],\n samplers: [\"maskSampler\", \"depthSampler\"],\n defines: join,\n fallbacks: null,\n onCompiled: null,\n onError: null,\n shaderLanguage: this._shaderLanguage,\n extraInitializationsAsync: this._shadersLoaded\n ? undefined\n : async () => {\n await this._importShadersAsync();\n this._shadersLoaded = true;\n },\n },\n this._engine\n );\n }\n\n /** @internal */\n public override _createTextureAndPostProcesses(): void {\n // we don't need to create a texture for this layer. since all computation is done in the merge effect\n }\n\n /**\n * Checks for the readiness of the element composing the layer.\n * @param subMesh the mesh to check for\n * @param useInstances specify whether or not to use instances to render the mesh\n * @returns true if ready otherwise, false\n */\n public override isReady(subMesh: SubMesh, useInstances: boolean): boolean {\n const material = subMesh.getMaterial();\n const mesh = subMesh.getRenderingMesh();\n\n if (!material || !mesh || !this._selection) {\n return false;\n }\n\n return super._isSubMeshReady(subMesh, useInstances, null);\n }\n\n /** @internal */\n public override _canRenderMesh(_mesh: AbstractMesh, _material: Material): boolean {\n return true;\n }\n\n protected override _renderSubMesh(subMesh: SubMesh, enableAlphaMode: boolean = false): void {\n if (!this._internalShouldRender()) {\n return;\n }\n\n const material = subMesh.getMaterial();\n const ownerMesh = subMesh.getMesh();\n const replacementMesh = subMesh.getReplacementMesh();\n const renderingMesh = subMesh.getRenderingMesh();\n const effectiveMesh = subMesh.getEffectiveMesh();\n const scene = this._scene;\n const engine = scene.getEngine();\n\n effectiveMesh._internalAbstractMeshDataInfo._isActiveIntermediate = false;\n\n if (!material) {\n return;\n }\n\n // Do not block in blend mode.\n if (!this._canRenderMesh(renderingMesh, material)) {\n return;\n }\n\n // Culling\n let sideOrientation = material._getEffectiveOrientation(renderingMesh);\n const mainDeterminant = effectiveMesh._getWorldMatrixDeterminant();\n if (mainDeterminant < 0) {\n sideOrientation = sideOrientation === Material.ClockWiseSideOrientation ? Material.CounterClockWiseSideOrientation : Material.ClockWiseSideOrientation;\n }\n\n const reverse = sideOrientation === Material.ClockWiseSideOrientation;\n engine.setState(material.backFaceCulling, material.zOffset, undefined, reverse, material.cullBackFaces, undefined, material.zOffsetUnits);\n\n // Managing instances\n const batch = renderingMesh._getInstancesRenderList(subMesh._id, !!replacementMesh);\n if (batch.mustReturn) {\n return;\n }\n\n // Early Exit per mesh\n if (!this._shouldRenderMesh(renderingMesh)) {\n return;\n }\n\n const hardwareInstancedRendering =\n batch.hardwareInstancedRendering[subMesh._id] ||\n renderingMesh.hasThinInstances ||\n (!!renderingMesh._userInstancedBuffersStorage &&\n ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName in renderingMesh._userInstancedBuffersStorage.vertexBuffers);\n\n this._setEmissiveTextureAndColor(renderingMesh, subMesh, material);\n\n this.onBeforeRenderMeshToEffect.notifyObservers(ownerMesh);\n\n // selection outline layer is not compatible with custom materials\n // if (this._useMeshMaterial(renderingMesh)) {\n // subMesh.getMaterial()!._glowModeEnabled = true;\n // renderingMesh.render(subMesh, enableAlphaMode, replacementMesh || undefined);\n // subMesh.getMaterial()!._glowModeEnabled = false;\n // } else\n if (this._isSubMeshReady(subMesh, hardwareInstancedRendering, this._emissiveTextureAndColor.texture)) {\n const renderingMaterial = effectiveMesh._internalAbstractMeshDataInfo._materialForRenderPass?.[engine.currentRenderPassId];\n\n let drawWrapper = subMesh._getDrawWrapper();\n if (!drawWrapper && renderingMaterial) {\n drawWrapper = renderingMaterial._getDrawWrapper();\n }\n\n if (!drawWrapper) {\n return;\n }\n\n const effect = drawWrapper.effect!;\n\n engine.enableEffect(drawWrapper);\n if (!hardwareInstancedRendering) {\n renderingMesh._bind(subMesh, effect, material.fillMode);\n }\n\n if (!renderingMaterial) {\n effect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\n if (this._options.storeCameraSpaceZ) {\n effect.setMatrix(\"view\", scene.getViewMatrix());\n } else {\n const camera = this.camera || scene.activeCamera;\n if (camera) {\n const cameraIsOrtho = camera.mode === Camera.ORTHOGRAPHIC_CAMERA;\n\n let minZ: number, maxZ: number;\n\n if (cameraIsOrtho) {\n minZ = !engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : 1;\n maxZ = engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : 1;\n } else {\n minZ = engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? camera.minZ : engine.isNDCHalfZRange ? 0 : camera.minZ;\n maxZ = engine.useReverseDepthBuffer && engine.isNDCHalfZRange ? 0 : camera.maxZ;\n }\n\n effect.setFloat2(\"depthValues\", minZ, minZ + maxZ);\n }\n }\n effect.setMatrix(\"world\", effectiveMesh.getWorldMatrix());\n } else {\n renderingMaterial.bindForSubMesh(effectiveMesh.getWorldMatrix(), effectiveMesh as Mesh, subMesh);\n }\n\n if (!renderingMaterial) {\n // Alpha test\n if (material && material.needAlphaTestingForMesh(effectiveMesh)) {\n const alphaTexture = material.getAlphaTestTexture();\n if (alphaTexture) {\n effect.setTexture(\"diffuseSampler\", alphaTexture);\n effect.setMatrix(\"diffuseMatrix\", alphaTexture.getTextureMatrix());\n }\n }\n\n // Bones\n BindBonesParameters(renderingMesh, effect);\n\n // Morph targets\n BindMorphTargetParameters(renderingMesh, effect);\n if (renderingMesh.morphTargetManager && renderingMesh.morphTargetManager.isUsingTextureForTargets) {\n renderingMesh.morphTargetManager._bind(effect);\n }\n\n // Baked vertex animations\n const bvaManager = subMesh.getMesh().bakedVertexAnimationManager;\n if (bvaManager && bvaManager.isEnabled) {\n bvaManager.bind(effect, hardwareInstancedRendering);\n }\n\n // Alpha mode\n if (enableAlphaMode) {\n engine.setAlphaMode(material.alphaMode);\n }\n\n // Clip planes\n BindClipPlane(effect, material, scene);\n\n // Selection ID\n let selectionId = this._meshUniqueIdToSelectionId[renderingMesh.uniqueId];\n // When using LOD, the rendering mesh is the LOD mesh, not the source mesh.\n // Look up the selection ID from the master (source) mesh.\n if (selectionId === undefined && renderingMesh._masterMesh) {\n selectionId = this._meshUniqueIdToSelectionId[renderingMesh._masterMesh.uniqueId];\n if (selectionId === undefined) {\n selectionId = renderingMesh._masterMesh.instancedBuffers?.[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName];\n }\n }\n if (!renderingMesh.hasInstances && !renderingMesh.hasThinInstances && !renderingMesh.isAnInstance && selectionId !== undefined) {\n effect.setFloat(\"selectionId\", selectionId);\n }\n }\n\n // Draw\n renderingMesh._processRendering(effectiveMesh, subMesh, effect, material.fillMode, batch, hardwareInstancedRendering, (isInstance, world) =>\n effect.setMatrix(\"world\", world)\n );\n } else {\n // Need to reset refresh rate of the main map\n this._objectRenderer.resetRefreshCounter();\n }\n\n this.onAfterRenderMeshToEffect.notifyObservers(ownerMesh);\n }\n\n /** @internal */\n public override _internalCompose(effect: Effect, _renderIndex: number): void {\n // Texture\n this.bindTexturesForCompose(effect);\n effect.setFloat2(\"screenSize\", this.textureWidth, this.textureHeight);\n effect.setColor3(\"outlineColor\", this.outlineColor);\n effect.setFloat(\"outlineThickness\", this.outlineThickness);\n effect.setFloat(\"occlusionStrength\", this.occlusionStrength);\n effect.setFloat(\"occlusionThreshold\", this.occlusionThreshold);\n\n // Cache\n const engine = this._engine;\n const previousStencilBuffer = engine.getStencilBuffer();\n\n // Draw order\n engine.setStencilBuffer(false);\n\n engine.drawElementsType(Material.TriangleFillMode, 0, 6);\n\n // Draw order\n engine.setStencilBuffer(previousStencilBuffer);\n }\n\n /** @internal */\n public override _setEmissiveTextureAndColor(_mesh: Mesh, _subMesh: SubMesh, _material: Material): void {\n // we don't use emissive texture or color for this layer\n }\n\n /**\n * Returns true if the layer contains information to display, otherwise false.\n * @returns true if the glow layer should be rendered\n */\n public override shouldRender(): boolean {\n return this._selection && super.shouldRender() ? true : false;\n }\n\n /** @internal */\n public override _shouldRenderMesh(mesh: Mesh): boolean {\n // Use the base class check (renderingGroupId) rather than this.hasMesh,\n // because LOD meshes won't be in _selection but still need to render.\n return super.hasMesh(mesh);\n }\n\n /** @internal */\n public override _addCustomEffectDefines(defines: string[]): void {\n if (this._options.storeCameraSpaceZ) {\n defines.push(\"#define STORE_CAMERASPACE_Z\");\n }\n }\n\n /**\n * Determine if a given mesh will be used in the current effect.\n * @param mesh mesh to test\n * @returns true if the mesh will be used\n */\n public override hasMesh(mesh: AbstractMesh): boolean {\n if (!super.hasMesh(mesh) || !this._selection) {\n return false;\n }\n return this._selection.indexOf(mesh) !== -1;\n }\n\n /** @internal */\n public override _useMeshMaterial(_mesh: AbstractMesh): boolean {\n return false;\n }\n\n private _clearMeshSelection(mesh: Mesh): void {\n if (mesh._userInstancedBuffersStorage) {\n const kind = ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName;\n\n // Dispose per-pass VBOs for ALL render passes (WebGPU).\n // _processInstancedBuffers creates per-pass VBOs for every render pass\n // that renders this mesh (main scene, depth renderer, etc.), not just\n // this layer's own passes. We must clean them all up to avoid using\n // a destroyed GPU buffer on the next submit.\n if (mesh._userInstancedBuffersStorage.renderPasses) {\n for (const passId in mesh._userInstancedBuffersStorage.renderPasses) {\n const renderPassId = Number(passId);\n const passVBOs = mesh._userInstancedBuffersStorage.renderPasses[renderPassId];\n if (passVBOs?.[kind]) {\n passVBOs[kind]!.dispose();\n delete passVBOs[kind];\n }\n }\n }\n\n mesh._userInstancedBuffersStorage.vertexBuffers[kind]?.dispose();\n\n const vao = mesh._userInstancedBuffersStorage.vertexArrayObjects?.[kind];\n if (vao) {\n // invalidate VAO is very important to keep sync between VAO and vertex buffers\n (this._engine as ThinEngine).releaseVertexArrayObject(vao);\n delete mesh._userInstancedBuffersStorage.vertexArrayObjects![kind];\n }\n\n delete mesh._userInstancedBuffersStorage.data[kind];\n delete mesh._userInstancedBuffersStorage.vertexBuffers[kind];\n delete mesh._userInstancedBuffersStorage.strides[kind];\n delete mesh._userInstancedBuffersStorage.sizes[kind];\n\n if (Object.keys(mesh._userInstancedBuffersStorage.vertexBuffers).length === 0) {\n mesh._userInstancedBuffersStorage = undefined!;\n }\n }\n if (this._isDef(mesh.instancedBuffers?.[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName])) {\n delete mesh.instancedBuffers[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName];\n }\n\n // In WebGPU non-compat mode, cached render bundles (fastBundle) bake\n // vertex-buffer GPU handles at record time. Because the new VBO has\n // the same format (and thus the same hashCode), the pipeline cache\n // won't detect the change and would replay the stale bundle.\n // Resetting the draw cache forces new bundles to be recorded.\n if (this._engine.isWebGPU && !this._engine.compatibilityMode) {\n mesh.resetDrawCache();\n }\n if (this._selection) {\n const index = this._selection.indexOf(mesh);\n if (~index) {\n this._selection.splice(index, 1);\n }\n }\n }\n\n /**\n * Remove all the meshes currently referenced in the selection outline layer\n */\n public clearSelection(): void {\n if (!this._selection) {\n return;\n }\n\n for (let index = 0; index < this._selection.length; ++index) {\n const mesh = this._selection[index] as Mesh;\n this._clearMeshSelection(mesh);\n }\n\n // addSelection registers instanceSelectionId on the source mesh\n // (via sourceMesh.registerInstancedBuffer), but _selection contains\n // the instance, not the source. Clean up source meshes separately.\n this._instancedBufferSources.forEach((sourceMesh) => this._clearMeshSelection(sourceMesh));\n this._instancedBufferSources.clear();\n this._selection.length = 0;\n this._meshUniqueIdToSelectionId.length = 0;\n\n this._nextSelectionId = 1;\n\n this._shouldRender = false;\n }\n\n /**\n * Adds mesh or group of mesh to the current selection\n *\n * If a group of meshes is provided, they will outline as a single unit\n * @param meshOrGroup Meshes to add to the selection\n */\n public addSelection(meshOrGroup: AbstractMesh | AbstractMesh[]): void {\n if (!this._selection) {\n return;\n }\n\n const nextId = this._nextSelectionId;\n\n const group = Array.isArray(meshOrGroup) ? meshOrGroup : [meshOrGroup];\n if (group.length === 0) {\n return;\n }\n\n for (let meshIndex = 0; meshIndex < group.length; ++meshIndex) {\n const mesh = group[meshIndex];\n\n this._selection.push(mesh); // add to render list\n\n if (mesh.hasInstances || mesh.isAnInstance) {\n const sourceMesh = (mesh as InstancedMesh).sourceMesh ?? (mesh as Mesh);\n\n if (!this._isDef(sourceMesh.instancedBuffers?.[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName])) {\n sourceMesh.registerInstancedBuffer(ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName, 1);\n }\n this._instancedBufferSources.add(sourceMesh);\n\n mesh.instancedBuffers[ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName] = nextId;\n } else if (mesh.hasThinInstances) {\n const thinInstanceCount = (mesh as Mesh).thinInstanceCount;\n const selectionIdData = new Float32Array(thinInstanceCount);\n for (let i = 0; i < thinInstanceCount; i++) {\n selectionIdData[i] = nextId;\n }\n (mesh as Mesh).thinInstanceSetBuffer(ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName, selectionIdData, 1);\n } else {\n this._meshUniqueIdToSelectionId[mesh.uniqueId] = nextId;\n }\n }\n this._nextSelectionId += 1;\n\n this._shouldRender = true;\n }\n\n /**\n * Adds mesh or group of mesh to the current selection\n * @param meshOrGroup Meshes to remove from the selection\n */\n\n public removeSelection(meshOrGroup: AbstractMesh | AbstractMesh[]) {\n if (!this._selection) {\n return;\n }\n const group = Array.isArray(meshOrGroup) ? meshOrGroup : [meshOrGroup];\n if (group.length === 0) {\n return;\n }\n for (let i = 0; i < group.length; i++) {\n const mesh = group[i] as Mesh;\n this._clearMeshSelection(mesh);\n delete this._meshUniqueIdToSelectionId[mesh.uniqueId];\n }\n if (!this._selection || !this._selection.length) {\n this._meshUniqueIdToSelectionId.length = 0;\n\n this._nextSelectionId = 1;\n\n this._shouldRender = false;\n }\n }\n\n /**\n * Free any resources and references associated to a mesh.\n * Internal use\n * @param mesh The mesh to free.\n * @internal\n */\n public _disposeMesh(mesh: Mesh): void {\n const selection = this._selection;\n if (!selection) {\n return;\n }\n\n const index = selection.indexOf(mesh);\n if (index !== -1) {\n selection.splice(index, 1);\n\n if (mesh.hasInstances) {\n mesh.removeVerticesData(ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName);\n } else if (mesh.hasThinInstances) {\n (mesh as Mesh).thinInstanceSetBuffer(ThinSelectionOutlineLayer.InstanceSelectionIdAttributeName, null);\n }\n\n if (mesh.isAnInstance) {\n const sourceMesh = (mesh as unknown as InstancedMesh).sourceMesh;\n // Only remove the source from tracking if no other selected\n // instance shares it, to avoid leaking its GPU resources.\n if (sourceMesh && !selection.some((m) => m !== mesh && m.isAnInstance && (m as unknown as InstancedMesh).sourceMesh === sourceMesh)) {\n this._instancedBufferSources.delete(sourceMesh);\n }\n }\n\n if (selection.length === 0) {\n this._shouldRender = false;\n }\n }\n }\n\n /**\n * Dispose the effect layer and free resources.\n */\n public override dispose(): void {\n this.clearSelection();\n this._selection = null;\n\n super.dispose();\n }\n}\n"]}
|
|
@@ -102,4 +102,10 @@ export declare class ClusteredLightContainer extends Light {
|
|
|
102
102
|
transferToNodeMaterialEffect(_effect: Effect): Light;
|
|
103
103
|
prepareLightSpecificDefines(defines: any, lightIndex: number): void;
|
|
104
104
|
_isReady(): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Serializes the ClusteredLightContainer to a JSON object, including all child lights.
|
|
107
|
+
* @returns the serialized object
|
|
108
|
+
*/
|
|
109
|
+
serialize(): any;
|
|
110
|
+
protected _onParsed(parsedLight: any, scene: Scene): void;
|
|
105
111
|
}
|
|
@@ -492,6 +492,45 @@ export class ClusteredLightContainer extends Light {
|
|
|
492
492
|
this._updateBatches();
|
|
493
493
|
return this._proxyMesh.isReady(true, true);
|
|
494
494
|
}
|
|
495
|
+
/**
|
|
496
|
+
* Serializes the ClusteredLightContainer to a JSON object, including all child lights.
|
|
497
|
+
* @returns the serialized object
|
|
498
|
+
*/
|
|
499
|
+
serialize() {
|
|
500
|
+
const serializationObject = super.serialize();
|
|
501
|
+
// Serialize child lights inline so they round-trip with the container.
|
|
502
|
+
// Child lights are removed from scene.lights by addLight(), so the scene
|
|
503
|
+
// serializer would not reach them on its own.
|
|
504
|
+
serializationObject.clusteredLights = [];
|
|
505
|
+
for (const light of this._lights) {
|
|
506
|
+
if (!light.doNotSerialize) {
|
|
507
|
+
serializationObject.clusteredLights.push(light.serialize());
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
return serializationObject;
|
|
511
|
+
}
|
|
512
|
+
_onParsed(parsedLight, scene) {
|
|
513
|
+
if (parsedLight.clusteredLights) {
|
|
514
|
+
// Parse child lights first, but defer addLight() until after the loader
|
|
515
|
+
// fixup passes (parent resolution, excluded/included mesh resolution)
|
|
516
|
+
// have run on scene.lights. addLight() removes lights from scene.lights,
|
|
517
|
+
// which would cause those fixups to miss the child lights.
|
|
518
|
+
const parsedChildLights = [];
|
|
519
|
+
for (const parsedChildLight of parsedLight.clusteredLights) {
|
|
520
|
+
const childLight = Light.Parse(parsedChildLight, scene);
|
|
521
|
+
if (childLight) {
|
|
522
|
+
parsedChildLights.push(childLight);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
if (parsedChildLights.length > 0) {
|
|
526
|
+
scene.onDataLoadedObservable.addOnce(() => {
|
|
527
|
+
for (const childLight of parsedChildLights) {
|
|
528
|
+
this.addLight(childLight);
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
495
534
|
}
|
|
496
535
|
/** @internal */
|
|
497
536
|
ClusteredLightContainer._SceneComponentInitialization = () => {
|
|
@@ -503,6 +542,9 @@ __decorate([
|
|
|
503
542
|
__decorate([
|
|
504
543
|
serialize()
|
|
505
544
|
], ClusteredLightContainer.prototype, "verticalTiles", null);
|
|
545
|
+
__decorate([
|
|
546
|
+
serialize()
|
|
547
|
+
], ClusteredLightContainer.prototype, "depthSlices", null);
|
|
506
548
|
__decorate([
|
|
507
549
|
serialize()
|
|
508
550
|
], ClusteredLightContainer.prototype, "maxRange", null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clusteredLightContainer.js","sourceRoot":"","sources":["../../../../../dev/core/src/Lights/Clustered/clusteredLightContainer.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAInD,OAA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AAG,IAAI,CAAC,YAAY,CAAC;IACrD,CAAC;IAEe,QAAQ;QACpB,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC/C,CAAC;;AApfD,gBAAgB;AACF,qDAA6B,GAA2B,GAAG,EAAE;IACvE,MAAM,WAAW,CAAC,iCAAiC,CAAC,CAAC;AACzD,CAAC,AAF0C,CAEzC;AAsCF;IADC,SAAS,EAAE;8DAGX;AAiBD;IADC,SAAS,EAAE;4DAGX;AAmDD;IADC,SAAS,EAAE;uDAGX;AAoYL,sBAAsB;AACtB,aAAa,CAAC,iCAAiC,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["import { StorageBuffer } from \"core/Buffers/storageBuffer\";\nimport { type Camera } from \"core/Cameras/camera\";\nimport { type AbstractEngine } from \"core/Engines/abstractEngine\";\nimport { Constants } from \"core/Engines/constants\";\nimport { type WebGPUEngine } from \"core/Engines/webgpuEngine\";\nimport { type Effect } from \"core/Materials/effect\";\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\nimport { ShaderMaterial } from \"core/Materials/shaderMaterial\";\nimport { RawTexture } from \"core/Materials/Textures/rawTexture\";\nimport { RenderTargetTexture } from \"core/Materials/Textures/renderTargetTexture\";\nimport { UniformBuffer } from \"core/Materials/uniformBuffer\";\nimport { TmpColors } from \"core/Maths/math.color\";\nimport { TmpVectors, Vector3 } from \"core/Maths/math.vector\";\nimport { CreatePlane } from \"core/Meshes/Builders/planeBuilder\";\nimport { type Mesh } from \"core/Meshes/mesh\";\nimport { serialize } from \"core/Misc/decorators\";\nimport { _WarnImport } from \"core/Misc/devTools\";\nimport { Logger } from \"core/Misc/logger\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport { Node } from \"core/node\";\nimport { type Scene } from \"core/scene\";\nimport { type Nullable } from \"core/types\";\n\nimport { Light } from \"../light\";\nimport { LightConstants } from \"../lightConstants\";\nimport { type PointLight } from \"../pointLight\";\nimport { type SpotLight } from \"../spotLight\";\nimport { type RenderTargetWrapper } from \"../../Engines/renderTargetWrapper\";\n\nimport \"core/Meshes/thinInstanceMesh\";\n\nNode.AddNodeConstructor(\"Light_Type_5\", (name, scene) => {\n return () => new ClusteredLightContainer(name, [], scene);\n});\n\nconst DefaultDepthSlices = 16;\nconst MobileClusteredLightBatchSize = 8;\n\n/**\n * A special light that renders all its associated spot or point lights using a clustered or forward+ system.\n */\nexport class ClusteredLightContainer extends Light {\n private static _GetEngineBatchSize(engine: AbstractEngine): number {\n const caps = engine._caps;\n if (!caps.texelFetch) {\n return 0;\n } else if (engine.isWebGPU) {\n // On WebGPU we use atomic writes to storage textures\n return 32;\n } else if (engine.version > 1) {\n // On WebGL 2 we use additive float blending as the light mask\n if (!caps.colorBufferFloat || !caps.blendFloat) {\n return 0;\n }\n // Due to the use of floats we want to limit lights to the precision of floats\n // The reduced precision for mobiles is because some devices (like Samsung Galaxy) report support for R32F but actually create the texture with less precision.\n return engine.hostInformation.isMobile ? MobileClusteredLightBatchSize : caps.shaderFloatPrecision;\n } else {\n // WebGL 1 is not supported due to lack of dynamic for loops\n return 0;\n }\n }\n\n /**\n * Checks if the clustered lighting system supports the given light with its current parameters.\n * This will also check if the light's associated engine supports clustered lighting.\n *\n * @param light The light to test\n * @returns true if the light and its engine is supported\n */\n public static IsLightSupported(light: Light): boolean {\n if (ClusteredLightContainer._GetEngineBatchSize(light.getEngine()) === 0) {\n return false;\n }\n\n if (light.shadowEnabled && light._scene.shadowsEnabled && light.getShadowGenerators()) {\n // Shadows are not supported\n return false;\n }\n\n if (light.falloffType !== Light.FALLOFF_DEFAULT) {\n // Only the default falloff is supported\n return false;\n }\n\n if (light.getTypeID() === LightConstants.LIGHTTYPEID_POINTLIGHT) {\n return true;\n }\n\n if (light.getTypeID() === LightConstants.LIGHTTYPEID_SPOTLIGHT) {\n // Extra texture bindings per light are not supported\n return !(<SpotLight>light).projectionTexture && !(<SpotLight>light).iesProfileTexture;\n }\n\n // Currently only point and spot lights are supported\n return false;\n }\n\n /** @internal */\n public static _SceneComponentInitialization: (scene: Scene) => void = () => {\n throw _WarnImport(\"ClusteredLightingSceneComponent\");\n };\n\n private readonly _batchSize: number;\n\n /**\n * True if clustered lighting is supported.\n */\n public get isSupported(): boolean {\n return this._batchSize > 0;\n }\n\n private readonly _lights: Light[] = [];\n /**\n * Gets the current list of lights added to this clustering system.\n */\n public get lights(): readonly Light[] {\n return this._lights;\n }\n\n private _camera: Nullable<Camera> = null;\n\n // The lights sorted by depth\n private readonly _sortedLights: (PointLight | SpotLight)[] = [];\n\n private _lightDataBuffer: Float32Array;\n private _lightDataTexture: RawTexture;\n private _lightDataRenderId = -1;\n\n private _tileMaskBatches = -1;\n private _tileMaskTexture: RenderTargetTexture;\n private _tileMaskBuffer: Nullable<StorageBuffer>;\n\n private _horizontalTiles = 64;\n /**\n * The number of tiles in the horizontal direction to cluster lights into.\n * A lower value will reduce memory and make the clustering step faster, while a higher value increases memory and makes the rendering step faster.\n */\n @serialize()\n public get horizontalTiles(): number {\n return this._horizontalTiles;\n }\n\n public set horizontalTiles(horizontal: number) {\n if (this._horizontalTiles === horizontal) {\n return;\n }\n this._horizontalTiles = horizontal;\n // Force the batch data to be recreated\n this._tileMaskBatches = -1;\n }\n\n private _verticalTiles = 64;\n /**\n * The number of tiles in the vertical direction to cluster lights into.\n * A lower value will reduce memory and make the clustering step faster, while a higher value increases memory and makes the rendering step faster.\n */\n @serialize()\n public get verticalTiles(): number {\n return this._verticalTiles;\n }\n\n public set verticalTiles(vertical: number) {\n if (this._verticalTiles === vertical) {\n return;\n }\n this._verticalTiles = vertical;\n // Force the batch data to be recreated\n this._tileMaskBatches = -1;\n }\n\n private _sliceScale = 0;\n private _sliceBias = 0;\n // List of vec2's that keep track of the min and max index per slice\n private _sliceRanges: Float32Array<ArrayBuffer>;\n\n private _depthSlices = DefaultDepthSlices;\n /**\n * The number of slices to split the depth range by and cluster lights into.\n */\n public get depthSlices(): number {\n return this._depthSlices;\n }\n\n public set depthSlices(slices: number) {\n if (this._depthSlices === slices) {\n return;\n }\n this._depthSlices = slices;\n this._sliceRanges = new Float32Array(slices * 2);\n\n // UBO size depends on the number of depth slices\n this._uniformBuffer.dispose();\n this._uniformBuffer = new UniformBuffer(this.getEngine(), undefined, undefined, this.name);\n this._buildUniformLayout();\n\n // CLUSTLIGHT_SLICES is a shader define that sizes the vSliceRanges array in the UBO.\n // Materials must recompile when depthSlices changes so the shader layout matches the rebuilt UBO.\n // Otherwise, if depthSlices is reduced, the rebuilt UBO can be smaller than what the previously compiled shader expects, causing rendering to fail.\n this._markMeshesAsLightDirty();\n }\n\n private readonly _proxyMaterial: ShaderMaterial;\n private readonly _proxyMesh: Mesh;\n\n private _maxRange = 16383;\n private _minInverseSquaredRange = 1 / (this._maxRange * this._maxRange);\n /**\n * This limits the range of all the added lights, so even lights with extreme ranges will still have bounds for clustering.\n */\n @serialize()\n public get maxRange(): number {\n return this._maxRange;\n }\n\n public set maxRange(range: number) {\n if (this._maxRange === range) {\n return;\n }\n this._maxRange = range;\n this._minInverseSquaredRange = 1 / (range * range);\n }\n\n /**\n * Creates a new clustered light system with an initial set of lights.\n *\n * @param name The name of the clustered light container\n * @param lights The initial set of lights to add\n * @param scene The scene the clustered light container belongs to\n */\n constructor(name: string, lights: Light[] = [], scene?: Scene) {\n super(name, scene);\n const engine = this.getEngine();\n this._batchSize = ClusteredLightContainer._GetEngineBatchSize(engine);\n\n const proxyShader = { vertex: \"lightProxy\", fragment: \"lightProxy\" };\n const defines = [`CLUSTLIGHT_BATCH ${this._batchSize}`];\n if (this._scene.useRightHandedSystem) {\n defines.push(\"#define RIGHT_HANDED\");\n }\n this._proxyMaterial = new ShaderMaterial(\"ProxyMaterial\", this._scene, proxyShader, {\n attributes: [\"position\"],\n uniforms: [\"view\", \"projection\", \"tileMaskResolution\"],\n samplers: [\"lightDataTexture\"],\n uniformBuffers: [\"Scene\"],\n storageBuffers: [\"tileMaskBuffer\"],\n defines,\n shaderLanguage: engine.isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\n extraInitializationsAsync: async () => {\n if (engine.isWebGPU) {\n await Promise.all([import(\"../../ShadersWGSL/lightProxy.vertex\"), import(\"../../ShadersWGSL/lightProxy.fragment\")]);\n } else {\n await Promise.all([import(\"../../Shaders/lightProxy.vertex\"), import(\"../../Shaders/lightProxy.fragment\")]);\n }\n },\n });\n\n // Additive blending is for merging masks on WebGL\n this._proxyMaterial.transparencyMode = ShaderMaterial.MATERIAL_ALPHABLEND;\n this._proxyMaterial.alphaMode = Constants.ALPHA_ADD;\n this._proxyMaterial.sideOrientation = Constants.MATERIAL_CounterClockWiseSideOrientation;\n\n this._proxyMesh = CreatePlane(\"ProxyMesh\", { size: 2 }, this._scene);\n // Make sure it doesn't render for the default scene\n this._scene.removeMesh(this._proxyMesh);\n this._proxyMesh.material = this._proxyMaterial;\n\n this._updateBatches();\n\n this._sliceRanges = new Float32Array(this._depthSlices * 2);\n\n if (this._batchSize > 0) {\n ClusteredLightContainer._SceneComponentInitialization(this._scene);\n for (const light of lights) {\n this.addLight(light);\n }\n }\n }\n\n public override getClassName(): string {\n return \"ClusteredLightContainer\";\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n public override getTypeID(): number {\n return LightConstants.LIGHTTYPEID_CLUSTERED_CONTAINER;\n }\n\n /** @internal */\n public _updateBatches(camera: Nullable<Camera> = null): RenderTargetTexture {\n this._camera = camera;\n this._proxyMesh.isVisible = this._sortedLights.length > 0;\n\n // Ensure space for atleast 1 batch\n const batches = Math.max(Math.ceil(this._sortedLights.length / this._batchSize), 1);\n if (this._tileMaskBatches >= batches) {\n this._proxyMesh.thinInstanceCount = this._sortedLights.length;\n return this._tileMaskTexture;\n }\n const engine = this.getEngine();\n // Round up to a batch size so we don't have to reallocate as often\n const maxLights = batches * this._batchSize;\n\n this._lightDataBuffer = new Float32Array(20 * maxLights);\n this._lightDataTexture?.dispose();\n this._lightDataTexture = new RawTexture(\n this._lightDataBuffer,\n 5,\n maxLights,\n Constants.TEXTUREFORMAT_RGBA,\n this._scene,\n false,\n false,\n Constants.TEXTURE_NEAREST_SAMPLINGMODE,\n Constants.TEXTURETYPE_FLOAT\n );\n this._lightDataTexture.name = \"LightDataTexture_clustered_\" + this.name;\n this._proxyMaterial.setTexture(\"lightDataTexture\", this._lightDataTexture);\n\n this._tileMaskTexture?.dispose();\n const textureSize = { width: this._horizontalTiles, height: this._verticalTiles };\n if (!engine.isWebGPU) {\n // In WebGL we shift the light proxy by the batch number\n textureSize.height *= batches;\n }\n this._tileMaskTexture = new RenderTargetTexture(\"TileMaskTexture\", textureSize, this._scene, {\n // We don't write anything on WebGPU so make it as small as possible\n type: engine.isWebGPU ? Constants.TEXTURETYPE_UNSIGNED_BYTE : Constants.TEXTURETYPE_FLOAT,\n format: Constants.TEXTUREFORMAT_RED,\n generateDepthBuffer: false,\n });\n\n this._tileMaskTexture.renderParticles = false;\n this._tileMaskTexture.renderSprites = false;\n this._tileMaskTexture.noPrePassRenderer = true;\n this._tileMaskTexture.renderList = [this._proxyMesh];\n\n let currentRenderTarget: Nullable<RenderTargetWrapper> = null;\n\n this._tileMaskTexture.onBeforeBindObservable.add(() => {\n currentRenderTarget = engine._currentRenderTarget;\n this._updateLightData();\n });\n\n this._tileMaskTexture.onAfterUnbindObservable.add(() => {\n if (engine._currentRenderTarget !== currentRenderTarget) {\n if (!currentRenderTarget) {\n engine.restoreDefaultFramebuffer();\n } else {\n engine.bindFramebuffer(currentRenderTarget);\n }\n }\n });\n\n this._tileMaskTexture.onClearObservable.add(() => {\n if (engine.isWebGPU) {\n // Clear the storage buffer for WebGPU\n this._tileMaskBuffer?.clear();\n } else {\n // Only clear the texture on WebGL\n engine.clear({ r: 0, g: 0, b: 0, a: 1 }, true, false);\n }\n });\n\n if (engine.isWebGPU) {\n // WebGPU also needs a storage buffer to write to\n this._tileMaskBuffer?.dispose();\n const bufferSize = this._horizontalTiles * this._verticalTiles * batches * 4;\n this._tileMaskBuffer = new StorageBuffer(<WebGPUEngine>engine, bufferSize);\n this._proxyMaterial.setStorageBuffer(\"tileMaskBuffer\", this._tileMaskBuffer);\n }\n\n this._proxyMaterial.setVector3(\"tileMaskResolution\", new Vector3(this._horizontalTiles, this.verticalTiles, batches));\n\n // We don't actually use the matrix data but we need enough capacity for the lights\n this._proxyMesh.thinInstanceSetBuffer(\"matrix\", new Float32Array(maxLights * 16));\n this._proxyMesh.thinInstanceCount = this._sortedLights.length;\n this._tileMaskBatches = batches;\n return this._tileMaskTexture;\n }\n\n private _getSliceIndex(camera: Camera, depth: number): number {\n if (depth < camera.minZ) {\n // Prevent calling log on small or negative values\n return -1;\n }\n return Math.floor(Math.log(depth) * this._sliceScale + this._sliceBias);\n }\n\n private _updateLightData(): void {\n const camera = this._camera || this._scene.activeCamera;\n const renderId = this._scene.getRenderId();\n if (!camera || this._lightDataRenderId === renderId) {\n return;\n }\n this._lightDataRenderId = renderId;\n\n // Resort lights based on distance from camera\n const view = camera.getViewMatrix();\n for (const light of this._sortedLights) {\n const position = light.computeTransformedInformation() ? light.transformedPosition : light.position;\n const viewPosition = Vector3.TransformCoordinatesToRef(position, view, TmpVectors.Vector3[0]);\n light._currentViewDepth = this._scene.useRightHandedSystem ? -viewPosition.z : viewPosition.z;\n }\n this._sortedLights.sort((a, b) => a._currentViewDepth - b._currentViewDepth);\n\n // DOOM 2016 subdivision scheme, copied from: https://www.aortiz.me/2018/12/21/CG.html\n const logFarNear = Math.log(camera.maxZ / camera.minZ);\n this._sliceScale = this._depthSlices / logFarNear;\n this._sliceBias = -(this._depthSlices * Math.log(camera.minZ)) / logFarNear;\n\n this._sliceRanges.fill(0);\n // Last slice which had had its min index updated\n let minSlice = -1;\n\n const buf = this._lightDataBuffer;\n const offset = this._scene.floatingOriginOffset;\n\n for (let i = 0; i < this._sortedLights.length; i += 1) {\n const light = this._sortedLights[i];\n const off = i * 20;\n const computed = light.computeTransformedInformation();\n const scaledIntensity = light.getScaledIntensity();\n\n const position = computed ? light.transformedPosition : light.position;\n const diffuse = light.diffuse.scaleToRef(scaledIntensity, TmpColors.Color3[0]);\n const specular = light.specular.scaleToRef(scaledIntensity, TmpColors.Color3[1]);\n const range = Math.min(light.range, this.maxRange);\n const inverseSquaredRange = Math.max(light._inverseSquaredRange, this._minInverseSquaredRange);\n\n // vLightData\n buf[off + 0] = position.x - offset.x;\n buf[off + 1] = position.y - offset.y;\n buf[off + 2] = position.z - offset.z;\n buf[off + 3] = 0;\n // vLightDiffuse\n buf[off + 4] = diffuse.r;\n buf[off + 5] = diffuse.g;\n buf[off + 6] = diffuse.b;\n buf[off + 7] = range;\n // vLightSpecular\n buf[off + 8] = specular.r;\n buf[off + 9] = specular.g;\n buf[off + 10] = specular.b;\n buf[off + 11] = light.radius;\n // vLightDirection\n buf[off + 12] = 0;\n buf[off + 13] = 0;\n buf[off + 14] = 0;\n buf[off + 15] = -1;\n // vLightFalloff\n buf[off + 16] = range;\n buf[off + 17] = inverseSquaredRange;\n buf[off + 18] = 0;\n buf[off + 19] = 0;\n\n if (light.getTypeID() === LightConstants.LIGHTTYPEID_SPOTLIGHT) {\n const spotLight = <SpotLight>light;\n const direction = Vector3.NormalizeToRef(computed ? spotLight.transformedDirection : spotLight.direction, TmpVectors.Vector3[0]);\n\n // vLightData.a\n buf[off + 3] = spotLight.exponent;\n // vLightDirection\n buf[off + 12] = direction.x;\n buf[off + 13] = direction.y;\n buf[off + 14] = direction.z;\n buf[off + 15] = spotLight._cosHalfAngle;\n // vLightFalloff.zw\n buf[off + 18] = spotLight._lightAngleScale;\n buf[off + 19] = spotLight._lightAngleOffset;\n }\n\n // Update the depth slices that include this light\n const firstSlice = this._getSliceIndex(camera, light._currentViewDepth - range);\n const lastSlice = this._getSliceIndex(camera, light._currentViewDepth + range);\n for (let j = firstSlice; j <= lastSlice; j += 1) {\n if (j < 0 || j >= this._depthSlices) {\n continue;\n } else if (j > minSlice) {\n // Update min index\n this._sliceRanges[j * 2] = i;\n minSlice = j;\n }\n // Update max index\n this._sliceRanges[j * 2 + 1] = i;\n }\n }\n\n const engine = this.getEngine();\n if (engine.isWebGPU) {\n // Whenever the light data changes we have to flush pending WebGPU command buffers so that\n // previous render passes use the old data and later render passes use the new data.\n engine.flushFramebuffer();\n }\n this._lightDataTexture.update(this._lightDataBuffer);\n }\n\n public override dispose(doNotRecurse?: boolean, disposeMaterialAndTextures?: boolean): void {\n for (const light of this._lights) {\n light.dispose(doNotRecurse, disposeMaterialAndTextures);\n }\n this._lightDataTexture.dispose();\n this._tileMaskTexture.dispose();\n this._tileMaskBuffer?.dispose();\n this._proxyMesh.dispose(doNotRecurse, disposeMaterialAndTextures);\n super.dispose(doNotRecurse, disposeMaterialAndTextures);\n }\n\n /**\n * Adds a light to the clustering system.\n * @param light The light to add\n */\n public addLight(light: Light): void {\n if (!ClusteredLightContainer.IsLightSupported(light)) {\n Logger.Warn(\"Attempting to add a light to cluster that does not support clustering\");\n return;\n }\n this._scene.removeLight(light);\n this._lights.push(light);\n this._sortedLights.push(<PointLight | SpotLight>light);\n\n this._proxyMesh.isVisible = true;\n this._proxyMesh.thinInstanceCount = this._sortedLights.length;\n }\n\n /**\n * Removes a light from the clustering system.\n * @param light The light to remove\n * @returns the index where the light was in the light list\n */\n public removeLight(light: Light): number {\n // Convert to `Light` array without cast so `indexOf` has correct typing\n const sortedLights: Light[] = this._sortedLights;\n const sortedIndex = sortedLights.indexOf(light);\n if (sortedIndex !== -1) {\n sortedLights.splice(sortedIndex, 1);\n\n this._proxyMesh.thinInstanceCount = sortedLights.length;\n if (sortedLights.length === 0) {\n this._proxyMesh.isVisible = false;\n }\n }\n\n const index = this._lights.indexOf(light);\n if (index !== -1) {\n this._lights.splice(index, 1);\n // We treat the unsorted array as the \"real\" one so only add back to the scene if it was found in that\n this._scene.addLight(light);\n }\n return index;\n }\n\n protected override _buildUniformLayout(): void {\n this._uniformBuffer.addUniform(\"vLightData\", 4);\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\n this._uniformBuffer.addUniform(\"vLightSpecular\", 4);\n this._uniformBuffer.addUniform(\"vSliceData\", 2);\n // _depthSlices might not be initialized yet\n this._uniformBuffer.addUniform(\"vSliceRanges\", 2, this._depthSlices ?? DefaultDepthSlices);\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\n this._uniformBuffer.addUniform(\"depthValues\", 2);\n this._uniformBuffer.create();\n }\n\n public override transferToEffect(effect: Effect, lightIndex: string): Light {\n const engine = this.getEngine();\n const hscale = this._horizontalTiles / engine.getRenderWidth();\n const vscale = this._verticalTiles / engine.getRenderHeight();\n this._uniformBuffer.updateFloat4(\"vLightData\", hscale, vscale, this._verticalTiles, this._tileMaskBatches, lightIndex);\n this._uniformBuffer.updateFloat2(\"vSliceData\", this._sliceScale, this._sliceBias, lightIndex);\n this._uniformBuffer.updateFloatArray(\"vSliceRanges\", this._sliceRanges, lightIndex);\n return this;\n }\n\n public override transferTexturesToEffect(effect: Effect, lightIndex: string): Light {\n const engine = this.getEngine();\n effect.setTexture(\"lightDataTexture\" + lightIndex, this._lightDataTexture);\n if (engine.isWebGPU) {\n (<WebGPUEngine>engine).setStorageBuffer(\"tileMaskBuffer\" + lightIndex, this._tileMaskBuffer);\n } else {\n effect.setTexture(\"tileMaskTexture\" + lightIndex, this._tileMaskTexture);\n }\n return this;\n }\n\n public override transferToNodeMaterialEffect(_effect: Effect): Light {\n return this;\n }\n\n public override prepareLightSpecificDefines(defines: any, lightIndex: number): void {\n defines[\"CLUSTLIGHT\" + lightIndex] = true;\n defines[\"CLUSTLIGHT_BATCH\"] = this._batchSize;\n defines[\"CLUSTLIGHT_SLICES\"] = this._depthSlices;\n }\n\n public override _isReady(): boolean {\n this._updateBatches();\n return this._proxyMesh.isReady(true, true);\n }\n}\n\n// Register Class Name\nRegisterClass(\"BABYLON.ClusteredLightContainer\", ClusteredLightContainer);\n"]}
|
|
1
|
+
{"version":3,"file":"clusteredLightContainer.js","s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AiB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC/B,KAAK,CAAC,sBAAsB,CAAC,OAAO,CAAC,GAAG,EAAE;oBACtC,KAAK,MAAM,UAAU,IAAI,iBAAiB,EAAE,CAAC;wBACzC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;oBAC9B,CAAC;gBACL,CAAC,CAAC,CAAC;YACP,CAAC;QACL,CAAC;IACL,CAAC;;AAjiBD,gBAAgB;AACF,qDAA6B,GAA2B,GAAG,EAAE;IACvE,MAAM,WAAW,CAAC,iCAAiC,CAAC,CAAC;AACzD,CAAC,AAF0C,CAEzC;AAsCF;IADC,SAAS,EAAE;8DAGX;AAiBD;IADC,SAAS,EAAE;4DAGX;AAqBD;IADC,SAAS,EAAE;0DAGX;AA6BD;IADC,SAAS,EAAE;uDAGX;AAgbL,sBAAsB;AACtB,aAAa,CAAC,iCAAiC,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["import { StorageBuffer } from \"core/Buffers/storageBuffer\";\nimport { type Camera } from \"core/Cameras/camera\";\nimport { type AbstractEngine } from \"core/Engines/abstractEngine\";\nimport { Constants } from \"core/Engines/constants\";\nimport { type WebGPUEngine } from \"core/Engines/webgpuEngine\";\nimport { type Effect } from \"core/Materials/effect\";\nimport { ShaderLanguage } from \"core/Materials/shaderLanguage\";\nimport { ShaderMaterial } from \"core/Materials/shaderMaterial\";\nimport { RawTexture } from \"core/Materials/Textures/rawTexture\";\nimport { RenderTargetTexture } from \"core/Materials/Textures/renderTargetTexture\";\nimport { UniformBuffer } from \"core/Materials/uniformBuffer\";\nimport { TmpColors } from \"core/Maths/math.color\";\nimport { TmpVectors, Vector3 } from \"core/Maths/math.vector\";\nimport { CreatePlane } from \"core/Meshes/Builders/planeBuilder\";\nimport { type Mesh } from \"core/Meshes/mesh\";\nimport { serialize } from \"core/Misc/decorators\";\nimport { _WarnImport } from \"core/Misc/devTools\";\nimport { Logger } from \"core/Misc/logger\";\nimport { RegisterClass } from \"core/Misc/typeStore\";\nimport { Node } from \"core/node\";\nimport { type Scene } from \"core/scene\";\nimport { type Nullable } from \"core/types\";\n\nimport { Light } from \"../light\";\nimport { LightConstants } from \"../lightConstants\";\nimport { type PointLight } from \"../pointLight\";\nimport { type SpotLight } from \"../spotLight\";\nimport { type RenderTargetWrapper } from \"../../Engines/renderTargetWrapper\";\n\nimport \"core/Meshes/thinInstanceMesh\";\n\nNode.AddNodeConstructor(\"Light_Type_5\", (name, scene) => {\n return () => new ClusteredLightContainer(name, [], scene);\n});\n\nconst DefaultDepthSlices = 16;\nconst MobileClusteredLightBatchSize = 8;\n\n/**\n * A special light that renders all its associated spot or point lights using a clustered or forward+ system.\n */\nexport class ClusteredLightContainer extends Light {\n private static _GetEngineBatchSize(engine: AbstractEngine): number {\n const caps = engine._caps;\n if (!caps.texelFetch) {\n return 0;\n } else if (engine.isWebGPU) {\n // On WebGPU we use atomic writes to storage textures\n return 32;\n } else if (engine.version > 1) {\n // On WebGL 2 we use additive float blending as the light mask\n if (!caps.colorBufferFloat || !caps.blendFloat) {\n return 0;\n }\n // Due to the use of floats we want to limit lights to the precision of floats\n // The reduced precision for mobiles is because some devices (like Samsung Galaxy) report support for R32F but actually create the texture with less precision.\n return engine.hostInformation.isMobile ? MobileClusteredLightBatchSize : caps.shaderFloatPrecision;\n } else {\n // WebGL 1 is not supported due to lack of dynamic for loops\n return 0;\n }\n }\n\n /**\n * Checks if the clustered lighting system supports the given light with its current parameters.\n * This will also check if the light's associated engine supports clustered lighting.\n *\n * @param light The light to test\n * @returns true if the light and its engine is supported\n */\n public static IsLightSupported(light: Light): boolean {\n if (ClusteredLightContainer._GetEngineBatchSize(light.getEngine()) === 0) {\n return false;\n }\n\n if (light.shadowEnabled && light._scene.shadowsEnabled && light.getShadowGenerators()) {\n // Shadows are not supported\n return false;\n }\n\n if (light.falloffType !== Light.FALLOFF_DEFAULT) {\n // Only the default falloff is supported\n return false;\n }\n\n if (light.getTypeID() === LightConstants.LIGHTTYPEID_POINTLIGHT) {\n return true;\n }\n\n if (light.getTypeID() === LightConstants.LIGHTTYPEID_SPOTLIGHT) {\n // Extra texture bindings per light are not supported\n return !(<SpotLight>light).projectionTexture && !(<SpotLight>light).iesProfileTexture;\n }\n\n // Currently only point and spot lights are supported\n return false;\n }\n\n /** @internal */\n public static _SceneComponentInitialization: (scene: Scene) => void = () => {\n throw _WarnImport(\"ClusteredLightingSceneComponent\");\n };\n\n private readonly _batchSize: number;\n\n /**\n * True if clustered lighting is supported.\n */\n public get isSupported(): boolean {\n return this._batchSize > 0;\n }\n\n private readonly _lights: Light[] = [];\n /**\n * Gets the current list of lights added to this clustering system.\n */\n public get lights(): readonly Light[] {\n return this._lights;\n }\n\n private _camera: Nullable<Camera> = null;\n\n // The lights sorted by depth\n private readonly _sortedLights: (PointLight | SpotLight)[] = [];\n\n private _lightDataBuffer: Float32Array;\n private _lightDataTexture: RawTexture;\n private _lightDataRenderId = -1;\n\n private _tileMaskBatches = -1;\n private _tileMaskTexture: RenderTargetTexture;\n private _tileMaskBuffer: Nullable<StorageBuffer>;\n\n private _horizontalTiles = 64;\n /**\n * The number of tiles in the horizontal direction to cluster lights into.\n * A lower value will reduce memory and make the clustering step faster, while a higher value increases memory and makes the rendering step faster.\n */\n @serialize()\n public get horizontalTiles(): number {\n return this._horizontalTiles;\n }\n\n public set horizontalTiles(horizontal: number) {\n if (this._horizontalTiles === horizontal) {\n return;\n }\n this._horizontalTiles = horizontal;\n // Force the batch data to be recreated\n this._tileMaskBatches = -1;\n }\n\n private _verticalTiles = 64;\n /**\n * The number of tiles in the vertical direction to cluster lights into.\n * A lower value will reduce memory and make the clustering step faster, while a higher value increases memory and makes the rendering step faster.\n */\n @serialize()\n public get verticalTiles(): number {\n return this._verticalTiles;\n }\n\n public set verticalTiles(vertical: number) {\n if (this._verticalTiles === vertical) {\n return;\n }\n this._verticalTiles = vertical;\n // Force the batch data to be recreated\n this._tileMaskBatches = -1;\n }\n\n private _sliceScale = 0;\n private _sliceBias = 0;\n // List of vec2's that keep track of the min and max index per slice\n private _sliceRanges: Float32Array<ArrayBuffer>;\n\n private _depthSlices = DefaultDepthSlices;\n /**\n * The number of slices to split the depth range by and cluster lights into.\n */\n @serialize()\n public get depthSlices(): number {\n return this._depthSlices;\n }\n\n public set depthSlices(slices: number) {\n if (this._depthSlices === slices) {\n return;\n }\n this._depthSlices = slices;\n this._sliceRanges = new Float32Array(slices * 2);\n\n // UBO size depends on the number of depth slices\n this._uniformBuffer.dispose();\n this._uniformBuffer = new UniformBuffer(this.getEngine(), undefined, undefined, this.name);\n this._buildUniformLayout();\n\n // CLUSTLIGHT_SLICES is a shader define that sizes the vSliceRanges array in the UBO.\n // Materials must recompile when depthSlices changes so the shader layout matches the rebuilt UBO.\n // Otherwise, if depthSlices is reduced, the rebuilt UBO can be smaller than what the previously compiled shader expects, causing rendering to fail.\n this._markMeshesAsLightDirty();\n }\n\n private readonly _proxyMaterial: ShaderMaterial;\n private readonly _proxyMesh: Mesh;\n\n private _maxRange = 16383;\n private _minInverseSquaredRange = 1 / (this._maxRange * this._maxRange);\n /**\n * This limits the range of all the added lights, so even lights with extreme ranges will still have bounds for clustering.\n */\n @serialize()\n public get maxRange(): number {\n return this._maxRange;\n }\n\n public set maxRange(range: number) {\n if (this._maxRange === range) {\n return;\n }\n this._maxRange = range;\n this._minInverseSquaredRange = 1 / (range * range);\n }\n\n /**\n * Creates a new clustered light system with an initial set of lights.\n *\n * @param name The name of the clustered light container\n * @param lights The initial set of lights to add\n * @param scene The scene the clustered light container belongs to\n */\n constructor(name: string, lights: Light[] = [], scene?: Scene) {\n super(name, scene);\n const engine = this.getEngine();\n this._batchSize = ClusteredLightContainer._GetEngineBatchSize(engine);\n\n const proxyShader = { vertex: \"lightProxy\", fragment: \"lightProxy\" };\n const defines = [`CLUSTLIGHT_BATCH ${this._batchSize}`];\n if (this._scene.useRightHandedSystem) {\n defines.push(\"#define RIGHT_HANDED\");\n }\n this._proxyMaterial = new ShaderMaterial(\"ProxyMaterial\", this._scene, proxyShader, {\n attributes: [\"position\"],\n uniforms: [\"view\", \"projection\", \"tileMaskResolution\"],\n samplers: [\"lightDataTexture\"],\n uniformBuffers: [\"Scene\"],\n storageBuffers: [\"tileMaskBuffer\"],\n defines,\n shaderLanguage: engine.isWebGPU ? ShaderLanguage.WGSL : ShaderLanguage.GLSL,\n extraInitializationsAsync: async () => {\n if (engine.isWebGPU) {\n await Promise.all([import(\"../../ShadersWGSL/lightProxy.vertex\"), import(\"../../ShadersWGSL/lightProxy.fragment\")]);\n } else {\n await Promise.all([import(\"../../Shaders/lightProxy.vertex\"), import(\"../../Shaders/lightProxy.fragment\")]);\n }\n },\n });\n\n // Additive blending is for merging masks on WebGL\n this._proxyMaterial.transparencyMode = ShaderMaterial.MATERIAL_ALPHABLEND;\n this._proxyMaterial.alphaMode = Constants.ALPHA_ADD;\n this._proxyMaterial.sideOrientation = Constants.MATERIAL_CounterClockWiseSideOrientation;\n\n this._proxyMesh = CreatePlane(\"ProxyMesh\", { size: 2 }, this._scene);\n // Make sure it doesn't render for the default scene\n this._scene.removeMesh(this._proxyMesh);\n this._proxyMesh.material = this._proxyMaterial;\n\n this._updateBatches();\n\n this._sliceRanges = new Float32Array(this._depthSlices * 2);\n\n if (this._batchSize > 0) {\n ClusteredLightContainer._SceneComponentInitialization(this._scene);\n for (const light of lights) {\n this.addLight(light);\n }\n }\n }\n\n public override getClassName(): string {\n return \"ClusteredLightContainer\";\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n public override getTypeID(): number {\n return LightConstants.LIGHTTYPEID_CLUSTERED_CONTAINER;\n }\n\n /** @internal */\n public _updateBatches(camera: Nullable<Camera> = null): RenderTargetTexture {\n this._camera = camera;\n this._proxyMesh.isVisible = this._sortedLights.length > 0;\n\n // Ensure space for atleast 1 batch\n const batches = Math.max(Math.ceil(this._sortedLights.length / this._batchSize), 1);\n if (this._tileMaskBatches >= batches) {\n this._proxyMesh.thinInstanceCount = this._sortedLights.length;\n return this._tileMaskTexture;\n }\n const engine = this.getEngine();\n // Round up to a batch size so we don't have to reallocate as often\n const maxLights = batches * this._batchSize;\n\n this._lightDataBuffer = new Float32Array(20 * maxLights);\n this._lightDataTexture?.dispose();\n this._lightDataTexture = new RawTexture(\n this._lightDataBuffer,\n 5,\n maxLights,\n Constants.TEXTUREFORMAT_RGBA,\n this._scene,\n false,\n false,\n Constants.TEXTURE_NEAREST_SAMPLINGMODE,\n Constants.TEXTURETYPE_FLOAT\n );\n this._lightDataTexture.name = \"LightDataTexture_clustered_\" + this.name;\n this._proxyMaterial.setTexture(\"lightDataTexture\", this._lightDataTexture);\n\n this._tileMaskTexture?.dispose();\n const textureSize = { width: this._horizontalTiles, height: this._verticalTiles };\n if (!engine.isWebGPU) {\n // In WebGL we shift the light proxy by the batch number\n textureSize.height *= batches;\n }\n this._tileMaskTexture = new RenderTargetTexture(\"TileMaskTexture\", textureSize, this._scene, {\n // We don't write anything on WebGPU so make it as small as possible\n type: engine.isWebGPU ? Constants.TEXTURETYPE_UNSIGNED_BYTE : Constants.TEXTURETYPE_FLOAT,\n format: Constants.TEXTUREFORMAT_RED,\n generateDepthBuffer: false,\n });\n\n this._tileMaskTexture.renderParticles = false;\n this._tileMaskTexture.renderSprites = false;\n this._tileMaskTexture.noPrePassRenderer = true;\n this._tileMaskTexture.renderList = [this._proxyMesh];\n\n let currentRenderTarget: Nullable<RenderTargetWrapper> = null;\n\n this._tileMaskTexture.onBeforeBindObservable.add(() => {\n currentRenderTarget = engine._currentRenderTarget;\n this._updateLightData();\n });\n\n this._tileMaskTexture.onAfterUnbindObservable.add(() => {\n if (engine._currentRenderTarget !== currentRenderTarget) {\n if (!currentRenderTarget) {\n engine.restoreDefaultFramebuffer();\n } else {\n engine.bindFramebuffer(currentRenderTarget);\n }\n }\n });\n\n this._tileMaskTexture.onClearObservable.add(() => {\n if (engine.isWebGPU) {\n // Clear the storage buffer for WebGPU\n this._tileMaskBuffer?.clear();\n } else {\n // Only clear the texture on WebGL\n engine.clear({ r: 0, g: 0, b: 0, a: 1 }, true, false);\n }\n });\n\n if (engine.isWebGPU) {\n // WebGPU also needs a storage buffer to write to\n this._tileMaskBuffer?.dispose();\n const bufferSize = this._horizontalTiles * this._verticalTiles * batches * 4;\n this._tileMaskBuffer = new StorageBuffer(<WebGPUEngine>engine, bufferSize);\n this._proxyMaterial.setStorageBuffer(\"tileMaskBuffer\", this._tileMaskBuffer);\n }\n\n this._proxyMaterial.setVector3(\"tileMaskResolution\", new Vector3(this._horizontalTiles, this.verticalTiles, batches));\n\n // We don't actually use the matrix data but we need enough capacity for the lights\n this._proxyMesh.thinInstanceSetBuffer(\"matrix\", new Float32Array(maxLights * 16));\n this._proxyMesh.thinInstanceCount = this._sortedLights.length;\n this._tileMaskBatches = batches;\n return this._tileMaskTexture;\n }\n\n private _getSliceIndex(camera: Camera, depth: number): number {\n if (depth < camera.minZ) {\n // Prevent calling log on small or negative values\n return -1;\n }\n return Math.floor(Math.log(depth) * this._sliceScale + this._sliceBias);\n }\n\n private _updateLightData(): void {\n const camera = this._camera || this._scene.activeCamera;\n const renderId = this._scene.getRenderId();\n if (!camera || this._lightDataRenderId === renderId) {\n return;\n }\n this._lightDataRenderId = renderId;\n\n // Resort lights based on distance from camera\n const view = camera.getViewMatrix();\n for (const light of this._sortedLights) {\n const position = light.computeTransformedInformation() ? light.transformedPosition : light.position;\n const viewPosition = Vector3.TransformCoordinatesToRef(position, view, TmpVectors.Vector3[0]);\n light._currentViewDepth = this._scene.useRightHandedSystem ? -viewPosition.z : viewPosition.z;\n }\n this._sortedLights.sort((a, b) => a._currentViewDepth - b._currentViewDepth);\n\n // DOOM 2016 subdivision scheme, copied from: https://www.aortiz.me/2018/12/21/CG.html\n const logFarNear = Math.log(camera.maxZ / camera.minZ);\n this._sliceScale = this._depthSlices / logFarNear;\n this._sliceBias = -(this._depthSlices * Math.log(camera.minZ)) / logFarNear;\n\n this._sliceRanges.fill(0);\n // Last slice which had had its min index updated\n let minSlice = -1;\n\n const buf = this._lightDataBuffer;\n const offset = this._scene.floatingOriginOffset;\n\n for (let i = 0; i < this._sortedLights.length; i += 1) {\n const light = this._sortedLights[i];\n const off = i * 20;\n const computed = light.computeTransformedInformation();\n const scaledIntensity = light.getScaledIntensity();\n\n const position = computed ? light.transformedPosition : light.position;\n const diffuse = light.diffuse.scaleToRef(scaledIntensity, TmpColors.Color3[0]);\n const specular = light.specular.scaleToRef(scaledIntensity, TmpColors.Color3[1]);\n const range = Math.min(light.range, this.maxRange);\n const inverseSquaredRange = Math.max(light._inverseSquaredRange, this._minInverseSquaredRange);\n\n // vLightData\n buf[off + 0] = position.x - offset.x;\n buf[off + 1] = position.y - offset.y;\n buf[off + 2] = position.z - offset.z;\n buf[off + 3] = 0;\n // vLightDiffuse\n buf[off + 4] = diffuse.r;\n buf[off + 5] = diffuse.g;\n buf[off + 6] = diffuse.b;\n buf[off + 7] = range;\n // vLightSpecular\n buf[off + 8] = specular.r;\n buf[off + 9] = specular.g;\n buf[off + 10] = specular.b;\n buf[off + 11] = light.radius;\n // vLightDirection\n buf[off + 12] = 0;\n buf[off + 13] = 0;\n buf[off + 14] = 0;\n buf[off + 15] = -1;\n // vLightFalloff\n buf[off + 16] = range;\n buf[off + 17] = inverseSquaredRange;\n buf[off + 18] = 0;\n buf[off + 19] = 0;\n\n if (light.getTypeID() === LightConstants.LIGHTTYPEID_SPOTLIGHT) {\n const spotLight = <SpotLight>light;\n const direction = Vector3.NormalizeToRef(computed ? spotLight.transformedDirection : spotLight.direction, TmpVectors.Vector3[0]);\n\n // vLightData.a\n buf[off + 3] = spotLight.exponent;\n // vLightDirection\n buf[off + 12] = direction.x;\n buf[off + 13] = direction.y;\n buf[off + 14] = direction.z;\n buf[off + 15] = spotLight._cosHalfAngle;\n // vLightFalloff.zw\n buf[off + 18] = spotLight._lightAngleScale;\n buf[off + 19] = spotLight._lightAngleOffset;\n }\n\n // Update the depth slices that include this light\n const firstSlice = this._getSliceIndex(camera, light._currentViewDepth - range);\n const lastSlice = this._getSliceIndex(camera, light._currentViewDepth + range);\n for (let j = firstSlice; j <= lastSlice; j += 1) {\n if (j < 0 || j >= this._depthSlices) {\n continue;\n } else if (j > minSlice) {\n // Update min index\n this._sliceRanges[j * 2] = i;\n minSlice = j;\n }\n // Update max index\n this._sliceRanges[j * 2 + 1] = i;\n }\n }\n\n const engine = this.getEngine();\n if (engine.isWebGPU) {\n // Whenever the light data changes we have to flush pending WebGPU command buffers so that\n // previous render passes use the old data and later render passes use the new data.\n engine.flushFramebuffer();\n }\n this._lightDataTexture.update(this._lightDataBuffer);\n }\n\n public override dispose(doNotRecurse?: boolean, disposeMaterialAndTextures?: boolean): void {\n for (const light of this._lights) {\n light.dispose(doNotRecurse, disposeMaterialAndTextures);\n }\n this._lightDataTexture.dispose();\n this._tileMaskTexture.dispose();\n this._tileMaskBuffer?.dispose();\n this._proxyMesh.dispose(doNotRecurse, disposeMaterialAndTextures);\n super.dispose(doNotRecurse, disposeMaterialAndTextures);\n }\n\n /**\n * Adds a light to the clustering system.\n * @param light The light to add\n */\n public addLight(light: Light): void {\n if (!ClusteredLightContainer.IsLightSupported(light)) {\n Logger.Warn(\"Attempting to add a light to cluster that does not support clustering\");\n return;\n }\n this._scene.removeLight(light);\n this._lights.push(light);\n this._sortedLights.push(<PointLight | SpotLight>light);\n\n this._proxyMesh.isVisible = true;\n this._proxyMesh.thinInstanceCount = this._sortedLights.length;\n }\n\n /**\n * Removes a light from the clustering system.\n * @param light The light to remove\n * @returns the index where the light was in the light list\n */\n public removeLight(light: Light): number {\n // Convert to `Light` array without cast so `indexOf` has correct typing\n const sortedLights: Light[] = this._sortedLights;\n const sortedIndex = sortedLights.indexOf(light);\n if (sortedIndex !== -1) {\n sortedLights.splice(sortedIndex, 1);\n\n this._proxyMesh.thinInstanceCount = sortedLights.length;\n if (sortedLights.length === 0) {\n this._proxyMesh.isVisible = false;\n }\n }\n\n const index = this._lights.indexOf(light);\n if (index !== -1) {\n this._lights.splice(index, 1);\n // We treat the unsorted array as the \"real\" one so only add back to the scene if it was found in that\n this._scene.addLight(light);\n }\n return index;\n }\n\n protected override _buildUniformLayout(): void {\n this._uniformBuffer.addUniform(\"vLightData\", 4);\n this._uniformBuffer.addUniform(\"vLightDiffuse\", 4);\n this._uniformBuffer.addUniform(\"vLightSpecular\", 4);\n this._uniformBuffer.addUniform(\"vSliceData\", 2);\n // _depthSlices might not be initialized yet\n this._uniformBuffer.addUniform(\"vSliceRanges\", 2, this._depthSlices ?? DefaultDepthSlices);\n this._uniformBuffer.addUniform(\"shadowsInfo\", 3);\n this._uniformBuffer.addUniform(\"depthValues\", 2);\n this._uniformBuffer.create();\n }\n\n public override transferToEffect(effect: Effect, lightIndex: string): Light {\n const engine = this.getEngine();\n const hscale = this._horizontalTiles / engine.getRenderWidth();\n const vscale = this._verticalTiles / engine.getRenderHeight();\n this._uniformBuffer.updateFloat4(\"vLightData\", hscale, vscale, this._verticalTiles, this._tileMaskBatches, lightIndex);\n this._uniformBuffer.updateFloat2(\"vSliceData\", this._sliceScale, this._sliceBias, lightIndex);\n this._uniformBuffer.updateFloatArray(\"vSliceRanges\", this._sliceRanges, lightIndex);\n return this;\n }\n\n public override transferTexturesToEffect(effect: Effect, lightIndex: string): Light {\n const engine = this.getEngine();\n effect.setTexture(\"lightDataTexture\" + lightIndex, this._lightDataTexture);\n if (engine.isWebGPU) {\n (<WebGPUEngine>engine).setStorageBuffer(\"tileMaskBuffer\" + lightIndex, this._tileMaskBuffer);\n } else {\n effect.setTexture(\"tileMaskTexture\" + lightIndex, this._tileMaskTexture);\n }\n return this;\n }\n\n public override transferToNodeMaterialEffect(_effect: Effect): Light {\n return this;\n }\n\n public override prepareLightSpecificDefines(defines: any, lightIndex: number): void {\n defines[\"CLUSTLIGHT\" + lightIndex] = true;\n defines[\"CLUSTLIGHT_BATCH\"] = this._batchSize;\n defines[\"CLUSTLIGHT_SLICES\"] = this._depthSlices;\n }\n\n public override _isReady(): boolean {\n this._updateBatches();\n return this._proxyMesh.isReady(true, true);\n }\n\n /**\n * Serializes the ClusteredLightContainer to a JSON object, including all child lights.\n * @returns the serialized object\n */\n public override serialize(): any {\n const serializationObject = super.serialize();\n\n // Serialize child lights inline so they round-trip with the container.\n // Child lights are removed from scene.lights by addLight(), so the scene\n // serializer would not reach them on its own.\n serializationObject.clusteredLights = [];\n for (const light of this._lights) {\n if (!light.doNotSerialize) {\n serializationObject.clusteredLights.push(light.serialize());\n }\n }\n\n return serializationObject;\n }\n\n protected override _onParsed(parsedLight: any, scene: Scene): void {\n if (parsedLight.clusteredLights) {\n // Parse child lights first, but defer addLight() until after the loader\n // fixup passes (parent resolution, excluded/included mesh resolution)\n // have run on scene.lights. addLight() removes lights from scene.lights,\n // which would cause those fixups to miss the child lights.\n const parsedChildLights: Light[] = [];\n for (const parsedChildLight of parsedLight.clusteredLights) {\n const childLight = Light.Parse(parsedChildLight, scene);\n if (childLight) {\n parsedChildLights.push(childLight);\n }\n }\n\n if (parsedChildLights.length > 0) {\n scene.onDataLoadedObservable.addOnce(() => {\n for (const childLight of parsedChildLights) {\n this.addLight(childLight);\n }\n });\n }\n }\n }\n}\n\n// Register Class Name\nRegisterClass(\"BABYLON.ClusteredLightContainer\", ClusteredLightContainer);\n"]}
|
package/Lights/light.d.ts
CHANGED
|
@@ -395,6 +395,13 @@ export declare abstract class Light extends Node implements ISortableLight {
|
|
|
395
395
|
* @returns the created light after parsing
|
|
396
396
|
*/
|
|
397
397
|
static Parse(parsedLight: any, scene: Scene): Nullable<Light>;
|
|
398
|
+
/**
|
|
399
|
+
* Called after the light has been fully parsed and all base properties have been set.
|
|
400
|
+
* Override in subclasses to handle custom serialized data.
|
|
401
|
+
* @param _parsedLight The JSON representation of the light
|
|
402
|
+
* @param _scene The scene the light belongs to
|
|
403
|
+
*/
|
|
404
|
+
protected _onParsed(_parsedLight: any, _scene: Scene): void;
|
|
398
405
|
private _hookArrayForExcluded;
|
|
399
406
|
private _hookArrayForIncludedOnly;
|
|
400
407
|
private _resyncMeshes;
|
package/Lights/light.js
CHANGED
|
@@ -569,8 +569,18 @@ export class Light extends Node {
|
|
|
569
569
|
if (parsedLight.isEnabled !== undefined) {
|
|
570
570
|
light.setEnabled(parsedLight.isEnabled);
|
|
571
571
|
}
|
|
572
|
+
light._onParsed(parsedLight, scene);
|
|
572
573
|
return light;
|
|
573
574
|
}
|
|
575
|
+
/**
|
|
576
|
+
* Called after the light has been fully parsed and all base properties have been set.
|
|
577
|
+
* Override in subclasses to handle custom serialized data.
|
|
578
|
+
* @param _parsedLight The JSON representation of the light
|
|
579
|
+
* @param _scene The scene the light belongs to
|
|
580
|
+
*/
|
|
581
|
+
_onParsed(_parsedLight, _scene) {
|
|
582
|
+
// Override in subclasses
|
|
583
|
+
}
|
|
574
584
|
_hookArrayForExcluded(array) {
|
|
575
585
|
const oldPush = array.push;
|
|
576
586
|
array.push = (...items) => {
|