1 |
- {"ast":null,"code":"/**\n * Configuration needed for prepass-capable materials\n */\nexport class PrePassConfiguration {\n constructor() {\n /**\n * Previous world matrices of meshes carrying this material\n * Used for computing velocity\n */\n this.previousWorldMatrices = {};\n /**\n * Previous bones of meshes carrying this material\n * Used for computing velocity\n */\n this.previousBones = {};\n }\n /**\n * Add the required uniforms to the current list.\n * @param uniforms defines the current uniform list.\n */\n static AddUniforms(uniforms) {\n uniforms.push(\"previousWorld\", \"previousViewProjection\", \"mPreviousBones\");\n }\n /**\n * Add the required samplers to the current list.\n * @param samplers defines the current sampler list.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static AddSamplers(samplers) {\n // pass\n }\n /**\n * Binds the material data.\n * @param effect defines the effect to update\n * @param scene defines the scene the material belongs to.\n * @param mesh The mesh\n * @param world World matrix of this mesh\n * @param isFrozen Is the material frozen\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n bindForSubMesh(effect, scene, mesh, world, isFrozen) {\n if (scene.prePassRenderer && scene.prePassRenderer.enabled && scene.prePassRenderer.currentRTisSceneRT) {\n if (scene.prePassRenderer.getIndex(2) !== -1 || scene.prePassRenderer.getIndex(11) !== -1) {\n if (!this.previousWorldMatrices[mesh.uniqueId]) {\n this.previousWorldMatrices[mesh.uniqueId] = world.clone();\n }\n if (!this.previousViewProjection) {\n this.previousViewProjection = scene.getTransformMatrix().clone();\n this.currentViewProjection = scene.getTransformMatrix().clone();\n }\n const engine = scene.getEngine();\n if (this.currentViewProjection.updateFlag !== scene.getTransformMatrix().updateFlag) {\n // First update of the prepass configuration for this rendering pass\n this._lastUpdateFrameId = engine.frameId;\n this.previousViewProjection.copyFrom(this.currentViewProjection);\n this.currentViewProjection.copyFrom(scene.getTransformMatrix());\n } else if (this._lastUpdateFrameId !== engine.frameId) {\n // The scene transformation did not change from the previous frame (so no camera motion), we must update previousViewProjection accordingly\n this._lastUpdateFrameId = engine.frameId;\n this.previousViewProjection.copyFrom(this.currentViewProjection);\n }\n effect.setMatrix(\"previousWorld\", this.previousWorldMatrices[mesh.uniqueId]);\n effect.setMatrix(\"previousViewProjection\", this.previousViewProjection);\n this.previousWorldMatrices[mesh.uniqueId] = world.clone();\n }\n }\n }\n}","map":{"version":3,"names":["PrePassConfiguration","constructor","previousWorldMatrices","previousBones","AddUniforms","uniforms","push","AddSamplers","samplers","bindForSubMesh","effect","scene","mesh","world","isFrozen","prePassRenderer","enabled","currentRTisSceneRT","getIndex","uniqueId","clone","previousViewProjection","getTransformMatrix","currentViewProjection","engine","getEngine","updateFlag","_lastUpdateFrameId","frameId","copyFrom","setMatrix"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Materials/prePassConfiguration.js"],"sourcesContent":["\n/**\n * Configuration needed for prepass-capable materials\n */\nexport class PrePassConfiguration {\n constructor() {\n /**\n * Previous world matrices of meshes carrying this material\n * Used for computing velocity\n */\n this.previousWorldMatrices = {};\n /**\n * Previous bones of meshes carrying this material\n * Used for computing velocity\n */\n this.previousBones = {};\n }\n /**\n * Add the required uniforms to the current list.\n * @param uniforms defines the current uniform list.\n */\n static AddUniforms(uniforms) {\n uniforms.push(\"previousWorld\", \"previousViewProjection\", \"mPreviousBones\");\n }\n /**\n * Add the required samplers to the current list.\n * @param samplers defines the current sampler list.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static AddSamplers(samplers) {\n // pass\n }\n /**\n * Binds the material data.\n * @param effect defines the effect to update\n * @param scene defines the scene the material belongs to.\n * @param mesh The mesh\n * @param world World matrix of this mesh\n * @param isFrozen Is the material frozen\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n bindForSubMesh(effect, scene, mesh, world, isFrozen) {\n if (scene.prePassRenderer && scene.prePassRenderer.enabled && scene.prePassRenderer.currentRTisSceneRT) {\n if (scene.prePassRenderer.getIndex(2) !== -1 ||\n scene.prePassRenderer.getIndex(11) !== -1) {\n if (!this.previousWorldMatrices[mesh.uniqueId]) {\n this.previousWorldMatrices[mesh.uniqueId] = world.clone();\n }\n if (!this.previousViewProjection) {\n this.previousViewProjection = scene.getTransformMatrix().clone();\n this.currentViewProjection = scene.getTransformMatrix().clone();\n }\n const engine = scene.getEngine();\n if (this.currentViewProjection.updateFlag !== scene.getTransformMatrix().updateFlag) {\n // First update of the prepass configuration for this rendering pass\n this._lastUpdateFrameId = engine.frameId;\n this.previousViewProjection.copyFrom(this.currentViewProjection);\n this.currentViewProjection.copyFrom(scene.getTransformMatrix());\n }\n else if (this._lastUpdateFrameId !== engine.frameId) {\n // The scene transformation did not change from the previous frame (so no camera motion), we must update previousViewProjection accordingly\n this._lastUpdateFrameId = engine.frameId;\n this.previousViewProjection.copyFrom(this.currentViewProjection);\n }\n effect.setMatrix(\"previousWorld\", this.previousWorldMatrices[mesh.uniqueId]);\n effect.setMatrix(\"previousViewProjection\", this.previousViewProjection);\n this.previousWorldMatrices[mesh.uniqueId] = world.clone();\n }\n }\n }\n}\n"],"mappings":"AACA;AACA;AACA;AACA,OAAO,MAAMA,oBAAoB,CAAC;EAC9BC,WAAWA,CAAA,EAAG;IACV;AACR;AACA;AACA;IACQ,IAAI,CAACC,qBAAqB,GAAG,CAAC,CAAC;IAC/B;AACR;AACA;AACA;IACQ,IAAI,CAACC,aAAa,GAAG,CAAC,CAAC;EAC3B;EACA;AACJ;AACA;AACA;EACI,OAAOC,WAAWA,CAACC,QAAQ,EAAE;IACzBA,QAAQ,CAACC,IAAI,CAAC,eAAe,EAAE,wBAAwB,EAAE,gBAAgB,CAAC;EAC9E;EACA;AACJ;AACA;AACA;EACI;EACA,OAAOC,WAAWA,CAACC,QAAQ,EAAE;IACzB;EAAA;EAEJ;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;EACI;EACAC,cAAcA,CAACC,MAAM,EAAEC,KAAK,EAAEC,IAAI,EAAEC,KAAK,EAAEC,QAAQ,EAAE;IACjD,IAAIH,KAAK,CAACI,eAAe,IAAIJ,KAAK,CAACI,eAAe,CAACC,OAAO,IAAIL,KAA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