1 |
- {"ast":null,"code":"import { ThinEngine } from \"../../Engines/thinEngine.js\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nThinEngine.prototype.updateDynamicIndexBuffer = function (indexBuffer, indices, offset = 0) {\n // Force cache update\n this._currentBoundBuffer[this._gl.ELEMENT_ARRAY_BUFFER] = null;\n this.bindIndexBuffer(indexBuffer);\n let view;\n if (indexBuffer.is32Bits) {\n // anything else than Uint32Array needs to be converted to Uint32Array\n view = indices instanceof Uint32Array ? indices : new Uint32Array(indices);\n } else {\n // anything else than Uint16Array needs to be converted to Uint16Array\n view = indices instanceof Uint16Array ? indices : new Uint16Array(indices);\n }\n this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, view, this._gl.DYNAMIC_DRAW);\n this._resetIndexBufferBinding();\n};\nThinEngine.prototype.updateDynamicVertexBuffer = function (vertexBuffer, data, byteOffset, byteLength) {\n this.bindArrayBuffer(vertexBuffer);\n if (byteOffset === undefined) {\n byteOffset = 0;\n }\n const dataLength = data.byteLength || data.length;\n if (byteLength === undefined || byteLength >= dataLength && byteOffset === 0) {\n if (data instanceof Array) {\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, byteOffset, new Float32Array(data));\n } else {\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, byteOffset, data);\n }\n } else {\n if (data instanceof Array) {\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, new Float32Array(data).subarray(byteOffset, byteOffset + byteLength));\n } else {\n if (data instanceof ArrayBuffer) {\n data = new Uint8Array(data, byteOffset, byteLength);\n } else {\n data = new Uint8Array(data.buffer, data.byteOffset + byteOffset, byteLength);\n }\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data);\n }\n }\n this._resetVertexBufferBinding();\n};","map":{"version":3,"names":["ThinEngine","prototype","updateDynamicIndexBuffer","indexBuffer","indices","offset","_currentBoundBuffer","_gl","ELEMENT_ARRAY_BUFFER","bindIndexBuffer","view","is32Bits","Uint32Array","Uint16Array","bufferData","DYNAMIC_DRAW","_resetIndexBufferBinding","updateDynamicVertexBuffer","vertexBuffer","data","byteOffset","byteLength","bindArrayBuffer","undefined","dataLength","length","Array","bufferSubData","ARRAY_BUFFER","Float32Array","subarray","ArrayBuffer","Uint8Array","buffer","_resetVertexBufferBinding"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Engines/Extensions/engine.dynamicBuffer.js"],"sourcesContent":["import { ThinEngine } from \"../../Engines/thinEngine.js\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nThinEngine.prototype.updateDynamicIndexBuffer = function (indexBuffer, indices, offset = 0) {\n // Force cache update\n this._currentBoundBuffer[this._gl.ELEMENT_ARRAY_BUFFER] = null;\n this.bindIndexBuffer(indexBuffer);\n let view;\n if (indexBuffer.is32Bits) {\n // anything else than Uint32Array needs to be converted to Uint32Array\n view = indices instanceof Uint32Array ? indices : new Uint32Array(indices);\n }\n else {\n // anything else than Uint16Array needs to be converted to Uint16Array\n view = indices instanceof Uint16Array ? indices : new Uint16Array(indices);\n }\n this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, view, this._gl.DYNAMIC_DRAW);\n this._resetIndexBufferBinding();\n};\nThinEngine.prototype.updateDynamicVertexBuffer = function (vertexBuffer, data, byteOffset, byteLength) {\n this.bindArrayBuffer(vertexBuffer);\n if (byteOffset === undefined) {\n byteOffset = 0;\n }\n const dataLength = data.byteLength || data.length;\n if (byteLength === undefined || (byteLength >= dataLength && byteOffset === 0)) {\n if (data instanceof Array) {\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, byteOffset, new Float32Array(data));\n }\n else {\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, byteOffset, data);\n }\n }\n else {\n if (data instanceof Array) {\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, new Float32Array(data).subarray(byteOffset, byteOffset + byteLength));\n }\n else {\n if (data instanceof ArrayBuffer) {\n data = new Uint8Array(data, byteOffset, byteLength);\n }\n else {\n data = new Uint8Array(data.buffer, data.byteOffset + byteOffset, byteLength);\n }\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data);\n }\n }\n this._resetVertexBufferBinding();\n};\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,6BAA6B;AACxD;AACAA,UAAU,CAACC,SAAS,CAACC,wBAAwB,GAAG,UAAUC,WAAW,EAAEC,OAAO,EAAEC,MAAM,GAAG,CAAC,EAAE;EACxF;EACA,IAAI,CAACC,mBAAmB,CAAC,IAAI,CAACC,GAAG,CAACC,oBAAoB,CAAC,GAAG,IAAI;EAC9D,IAAI,CAACC,eAAe,CAACN,WAAW,CAAC;EACjC,IAAIO,IAAI;EACR,IAAIP,WAAW,CAACQ,QAAQ,EAAE;IACtB;IACAD,IAAI,GAAGN,OAAO,YAAYQ,WAAW,GAAGR,OAAO,GAAG,IAAIQ,WAAW,CAACR,OAAO,CAAC;EAC9E,CAAC,MACI;IACD;IACAM,IAAI,GAAGN,OAAO,YAAYS,WAAW,GAAGT,OAAO,GAAG,IAAIS,WAAW,CAACT,OAAO,CAAC;EAC9E;EACA,IAAI,CAACG,GAAG,CAACO,UAAU,CAAC,IAAI,CAACP,GAAG,CAACC,oBAAoB,EAAEE,IAAI,EAAE,IAAI,CAACH,GAAG,CAACQ,YAAY,CAAC;EAC/E,IAAI,CAACC,wBAAwB,CAAC,CAAC;AACnC,CAAC;AACDhB,UAAU,CAACC,SAAS,CAACgB,yBAAyB,GAAG,UAAUC,YAAY,EAAEC,IAAI,EAAEC,UAAU,EAAEC,UAAU,EAAE;EACnG,IAAI,CAACC,eAAe,CAACJ,YAAY,CAAC;EAClC,IAAIE,UAAU,KAAKG,SAAS,EAAE;IAC1BH,UAAU,GAAG,CAAC;EAClB;EACA,MAAMI,UAAU,GAAGL,IAAI,CAACE,UAAU,IAAIF,IAAI,CAACM,MAAM;EACjD,IAAIJ,UAAU,KAAKE,SAAS,IAAKF,UAAU,IAAIG,UAAU,IAAIJ,UAAU,KAAK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