d0874dbfac97529dedaf7b4c014fa8d5b106c616d7e6045d341a9b0472a18b71.json 9.7 KB

1
  1. {"ast":null,"code":"import { ThinEngine } from \"../../Engines/thinEngine.js\";\nimport { WebGLDataBuffer } from \"../../Meshes/WebGL/webGLDataBuffer.js\";\nThinEngine.prototype.createUniformBuffer = function (elements, _label) {\n const ubo = this._gl.createBuffer();\n if (!ubo) {\n throw new Error(\"Unable to create uniform buffer\");\n }\n const result = new WebGLDataBuffer(ubo);\n this.bindUniformBuffer(result);\n if (elements instanceof Float32Array) {\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, elements, this._gl.STATIC_DRAW);\n } else {\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, new Float32Array(elements), this._gl.STATIC_DRAW);\n }\n this.bindUniformBuffer(null);\n result.references = 1;\n return result;\n};\nThinEngine.prototype.createDynamicUniformBuffer = function (elements, _label) {\n const ubo = this._gl.createBuffer();\n if (!ubo) {\n throw new Error(\"Unable to create dynamic uniform buffer\");\n }\n const result = new WebGLDataBuffer(ubo);\n this.bindUniformBuffer(result);\n if (elements instanceof Float32Array) {\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, elements, this._gl.DYNAMIC_DRAW);\n } else {\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, new Float32Array(elements), this._gl.DYNAMIC_DRAW);\n }\n this.bindUniformBuffer(null);\n result.references = 1;\n return result;\n};\nThinEngine.prototype.updateUniformBuffer = function (uniformBuffer, elements, offset, count) {\n this.bindUniformBuffer(uniformBuffer);\n if (offset === undefined) {\n offset = 0;\n }\n if (count === undefined) {\n if (elements instanceof Float32Array) {\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, offset, elements);\n } else {\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, offset, new Float32Array(elements));\n }\n } else {\n if (elements instanceof Float32Array) {\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, 0, elements.subarray(offset, offset + count));\n } else {\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, 0, new Float32Array(elements).subarray(offset, offset + count));\n }\n }\n this.bindUniformBuffer(null);\n};\nThinEngine.prototype.bindUniformBuffer = function (buffer) {\n this._gl.bindBuffer(this._gl.UNIFORM_BUFFER, buffer ? buffer.underlyingResource : null);\n};\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nThinEngine.prototype.bindUniformBufferBase = function (buffer, location, name) {\n this._gl.bindBufferBase(this._gl.UNIFORM_BUFFER, location, buffer ? buffer.underlyingResource : null);\n};\nThinEngine.prototype.bindUniformBlock = function (pipelineContext, blockName, index) {\n const program = pipelineContext.program;\n const uniformLocation = this._gl.getUniformBlockIndex(program, blockName);\n if (uniformLocation !== 0xffffffff) {\n this._gl.uniformBlockBinding(program, uniformLocation, index);\n }\n};","map":{"version":3,"names":["ThinEngine","WebGLDataBuffer","prototype","createUniformBuffer","elements","_label","ubo","_gl","createBuffer","Error","result","bindUniformBuffer","Float32Array","bufferData","UNIFORM_BUFFER","STATIC_DRAW","references","createDynamicUniformBuffer","DYNAMIC_DRAW","updateUniformBuffer","uniformBuffer","offset","count","undefined","bufferSubData","subarray","buffer","bindBuffer","underlyingResource","bindUniformBufferBase","location","name","bindBufferBase","bindUniformBlock","pipelineContext","blockName","index","program","uniformLocation","getUniformBlockIndex","uniformBlockBinding"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Engines/Extensions/engine.uniformBuffer.js"],"sourcesContent":["import { ThinEngine } from \"../../Engines/thinEngine.js\";\nimport { WebGLDataBuffer } from \"../../Meshes/WebGL/webGLDataBuffer.js\";\nThinEngine.prototype.createUniformBuffer = function (elements, _label) {\n const ubo = this._gl.createBuffer();\n if (!ubo) {\n throw new Error(\"Unable to create uniform buffer\");\n }\n const result = new WebGLDataBuffer(ubo);\n this.bindUniformBuffer(result);\n if (elements instanceof Float32Array) {\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, elements, this._gl.STATIC_DRAW);\n }\n else {\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, new Float32Array(elements), this._gl.STATIC_DRAW);\n }\n this.bindUniformBuffer(null);\n result.references = 1;\n return result;\n};\nThinEngine.prototype.createDynamicUniformBuffer = function (elements, _label) {\n const ubo = this._gl.createBuffer();\n if (!ubo) {\n throw new Error(\"Unable to create dynamic uniform buffer\");\n }\n const result = new WebGLDataBuffer(ubo);\n this.bindUniformBuffer(result);\n if (elements instanceof Float32Array) {\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, elements, this._gl.DYNAMIC_DRAW);\n }\n else {\n this._gl.bufferData(this._gl.UNIFORM_BUFFER, new Float32Array(elements), this._gl.DYNAMIC_DRAW);\n }\n this.bindUniformBuffer(null);\n result.references = 1;\n return result;\n};\nThinEngine.prototype.updateUniformBuffer = function (uniformBuffer, elements, offset, count) {\n this.bindUniformBuffer(uniformBuffer);\n if (offset === undefined) {\n offset = 0;\n }\n if (count === undefined) {\n if (elements instanceof Float32Array) {\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, offset, elements);\n }\n else {\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, offset, new Float32Array(elements));\n }\n }\n else {\n if (elements instanceof Float32Array) {\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, 0, elements.subarray(offset, offset + count));\n }\n else {\n this._gl.bufferSubData(this._gl.UNIFORM_BUFFER, 0, new Float32Array(elements).subarray(offset, offset + count));\n }\n }\n this.bindUniformBuffer(null);\n};\nThinEngine.prototype.bindUniformBuffer = function (buffer) {\n this._gl.bindBuffer(this._gl.UNIFORM_BUFFER, buffer ? buffer.underlyingResource : null);\n};\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nThinEngine.prototype.bindUniformBufferBase = function (buffer, location, name) {\n this._gl.bindBufferBase(this._gl.UNIFORM_BUFFER, location, buffer ? buffer.underlyingResource : null);\n};\nThinEngine.prototype.bindUniformBlock = function (pipelineContext, blockName, index) {\n const program = pipelineContext.program;\n const uniformLocation = this._gl.getUniformBlockIndex(program, blockName);\n if (uniformLocation !== 0xffffffff) {\n this._gl.uniformBlockBinding(program, uniformLocation, index);\n }\n};\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,6BAA6B;AACxD,SAASC,eAAe,QAAQ,uCAAuC;AACvED,UAAU,CAACE,SAAS,CAACC,mBAAmB,GAAG,UAAUC,QAAQ,EAAEC,MAAM,EAAE;EACnE,MAAMC,GAAG,GAAG,IAAI,CAACC,GAAG,CAACC,YAAY,CAAC,CAAC;EACnC,IAAI,CAACF,GAAG,EAAE;IACN,MAAM,IAAIG,KAAK,CAAC,iCAAiC,CAAC;EACtD;EACA,MAAMC,MAAM,GAAG,IAAIT,eAAe,CAACK,GAAG,CAAC;EACvC,IAAI,CAACK,iBAAiB,CAACD,MAAM,CAAC;EAC9B,IAAIN,QAAQ,YAAYQ,YAAY,EAAE;IAClC,IAAI,CAACL,GAAG,CAACM,UAAU,CAAC,IAAI,CAACN,GAAG,CAACO,cAAc,EAAEV,QAAQ,EAAE,IAAI,CAACG,GAAG,CAACQ,WAAW,CAAC;EAChF,CAAC,MACI;IACD,IAAI,CAACR,GAAG,CAACM,UAAU,CAAC,IAAI,CAACN,GAAG,CAACO,cAAc,EAAE,IAAIF,YAAY,CAACR,QAAQ,CAAC,EAAE,IAAI,CAACG,GAAG,CAACQ,WAAW,CAAC;EAClG;EACA,IAAI,CAACJ,iBAAiB,CAAC,IAAI,CAAC;EAC5BD,MAAM,CAACM,UAAU,GAAG,CAAC;EACrB,OAAON,MAAM;AACjB,CAAC;AACDV,UAAU,CAACE,SAAS,CAACe,0BAA0B,GAAG,UAAUb,QAAQ,EAAEC,MAAM,EAAE;EAC1E,MAAMC,GAAG,GAAG,IAAI,CAACC,GAAG,CAACC,YAAY,CAAC,CAAC;EACnC,IAAI,CAACF,GAAG,EAAE;IACN,MAAM,IAAIG,KAAK,CAAC,yCAAyC,CAAC;EAC9D;EACA,MAAMC,MAAM,GAAG,IAAIT,eAAe,CAACK,GAAG,CAAC;EACvC,IAAI,CAAC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