eed4f8ec737183f1364b395ec1ca53d374251ec6d99d21d6a6d25ed5d61f6160.json 16 KB

1
  1. {"ast":null,"code":"import { _WarnImport } from \"../Misc/devTools.js\";\nimport { IsDocumentAvailable } from \"../Misc/domManagement.js\";\nexport const EngineFunctionContext = {};\n/**\n * @internal\n */\nexport function _ConcatenateShader(source, defines, shaderVersion = \"\") {\n return shaderVersion + (defines ? defines + \"\\n\" : \"\") + source;\n}\n/**\n * @internal\n */\nexport function _loadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError, injectedLoadFile) {\n const loadFile = injectedLoadFile || EngineFunctionContext.loadFile;\n if (loadFile) {\n const request = loadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError);\n return request;\n }\n throw _WarnImport(\"FileTools\");\n}\n/**\n * Gets host document\n * @param renderingCanvas if provided, the canvas' owner document will be returned\n * @returns the host document object\n */\nexport function getHostDocument(renderingCanvas = null) {\n if (renderingCanvas && renderingCanvas.ownerDocument) {\n return renderingCanvas.ownerDocument;\n }\n return IsDocumentAvailable() ? document : null;\n}\n/** @internal */\nexport function _getGlobalDefines(defines, isNDCHalfZRange, useReverseDepthBuffer, useExactSrgbConversions) {\n if (defines) {\n if (isNDCHalfZRange) {\n defines[\"IS_NDC_HALF_ZRANGE\"] = \"\";\n } else {\n delete defines[\"IS_NDC_HALF_ZRANGE\"];\n }\n if (useReverseDepthBuffer) {\n defines[\"USE_REVERSE_DEPTHBUFFER\"] = \"\";\n } else {\n delete defines[\"USE_REVERSE_DEPTHBUFFER\"];\n }\n if (useExactSrgbConversions) {\n defines[\"USE_EXACT_SRGB_CONVERSIONS\"] = \"\";\n } else {\n delete defines[\"USE_EXACT_SRGB_CONVERSIONS\"];\n }\n return;\n } else {\n let s = \"\";\n if (isNDCHalfZRange) {\n s += \"#define IS_NDC_HALF_ZRANGE\";\n }\n if (useReverseDepthBuffer) {\n if (s) {\n s += \"\\n\";\n }\n s += \"#define USE_REVERSE_DEPTHBUFFER\";\n }\n if (useExactSrgbConversions) {\n if (s) {\n s += \"\\n\";\n }\n s += \"#define USE_EXACT_SRGB_CONVERSIONS\";\n }\n return s;\n }\n}\n/**\n * Allocate a typed array depending on a texture type. Optionally can copy existing data in the buffer.\n * @param type type of the texture\n * @param sizeOrDstBuffer size of the array OR an existing buffer that will be used as the destination of the copy (if copyBuffer is provided)\n * @param sizeInBytes true if the size of the array is given in bytes, false if it is the number of elements of the array\n * @param copyBuffer if provided, buffer to copy into the destination buffer (either a newly allocated buffer if sizeOrDstBuffer is a number or use sizeOrDstBuffer as the destination buffer otherwise)\n * @returns the allocated buffer or sizeOrDstBuffer if the latter is an ArrayBuffer\n */\nexport function allocateAndCopyTypedBuffer(type, sizeOrDstBuffer, sizeInBytes = false, copyBuffer) {\n switch (type) {\n case 3:\n {\n const buffer = sizeOrDstBuffer instanceof ArrayBuffer ? new Int8Array(sizeOrDstBuffer) : new Int8Array(sizeOrDstBuffer);\n if (copyBuffer) {\n buffer.set(new Int8Array(copyBuffer));\n }\n return buffer;\n }\n case 0:\n {\n const buffer = sizeOrDstBuffer instanceof ArrayBuffer ? new Uint8Array(sizeOrDstBuffer) : new Uint8Array(sizeOrDstBuffer);\n if (copyBuffer) {\n buffer.set(new Uint8Array(copyBuffer));\n }\n return buffer;\n }\n case 4:\n {\n const buffer = sizeOrDstBuffer instanceof ArrayBuffer ? new Int16Array(sizeOrDstBuffer) : new Int16Array(sizeInBytes ? sizeOrDstBuffer / 2 : sizeOrDstBuffer);\n if (copyBuffer) {\n buffer.set(new Int16Array(copyBuffer));\n }\n return buffer;\n }\n case 5:\n case 8:\n case 9:\n case 10:\n case 2:\n {\n const buffer = sizeOrDstBuffer instanceof ArrayBuffer ? new Uint16Array(sizeOrDstBuffer) : new Uint16Array(sizeInBytes ? sizeOrDstBuffer / 2 : sizeOrDstBuffer);\n if (copyBuffer) {\n buffer.set(new Uint16Array(copyBuffer));\n }\n return buffer;\n }\n case 6:\n {\n const buffer = sizeOrDstBuffer instanceof ArrayBuffer ? new Int32Array(sizeOrDstBuffer) : new Int32Array(sizeInBytes ? sizeOrDstBuffer / 4 : sizeOrDstBuffer);\n if (copyBuffer) {\n buffer.set(new Int32Array(copyBuffer));\n }\n return buffer;\n }\n case 7:\n case 11:\n case 12:\n case 13:\n case 14:\n case 15:\n {\n const buffer = sizeOrDstBuffer instanceof ArrayBuffer ? new Uint32Array(sizeOrDstBuffer) : new Uint32Array(sizeInBytes ? sizeOrDstBuffer / 4 : sizeOrDstBuffer);\n if (copyBuffer) {\n buffer.set(new Uint32Array(copyBuffer));\n }\n return buffer;\n }\n case 1:\n {\n const buffer = sizeOrDstBuffer instanceof ArrayBuffer ? new Float32Array(sizeOrDstBuffer) : new Float32Array(sizeInBytes ? sizeOrDstBuffer / 4 : sizeOrDstBuffer);\n if (copyBuffer) {\n buffer.set(new Float32Array(copyBuffer));\n }\n return buffer;\n }\n }\n const buffer = sizeOrDstBuffer instanceof ArrayBuffer ? new Uint8Array(sizeOrDstBuffer) : new Uint8Array(sizeOrDstBuffer);\n if (copyBuffer) {\n buffer.set(new Uint8Array(copyBuffer));\n }\n return buffer;\n}","map":{"version":3,"names":["_WarnImport","IsDocumentAvailable","EngineFunctionContext","_ConcatenateShader","source","defines","shaderVersion","_loadFile","url","onSuccess","onProgress","offlineProvider","useArrayBuffer","onError","injectedLoadFile","loadFile","request","getHostDocument","renderingCanvas","ownerDocument","document","_getGlobalDefines","isNDCHalfZRange","useReverseDepthBuffer","useExactSrgbConversions","s","allocateAndCopyTypedBuffer","type","sizeOrDstBuffer","sizeInBytes","copyBuffer","buffer","ArrayBuffer","Int8Array","set","Uint8Array","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Engines/abstractEngine.functions.js"],"sourcesContent":["import { _WarnImport } from \"../Misc/devTools.js\";\nimport { IsDocumentAvailable } from \"../Misc/domManagement.js\";\n\nexport const EngineFunctionContext = {};\n/**\n * @internal\n */\nexport function _ConcatenateShader(source, defines, shaderVersion = \"\") {\n return shaderVersion + (defines ? defines + \"\\n\" : \"\") + source;\n}\n/**\n * @internal\n */\nexport function _loadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError, injectedLoadFile) {\n const loadFile = injectedLoadFile || EngineFunctionContext.loadFile;\n if (loadFile) {\n const request = loadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError);\n return request;\n }\n throw _WarnImport(\"FileTools\");\n}\n/**\n * Gets host document\n * @param renderingCanvas if provided, the canvas' owner document will be returned\n * @returns the host document object\n */\nexport function getHostDocument(renderingCanvas = null) {\n if (renderingCanvas && renderingCanvas.ownerDocument) {\n return renderingCanvas.ownerDocument;\n }\n return IsDocumentAvailable() ? document : null;\n}\n/** @internal */\nexport function _getGlobalDefines(defines, isNDCHalfZRange, useReverseDepthBuffer, useExactSrgbConversions) {\n if (defines) {\n if (isNDCHalfZRange) {\n defines[\"IS_NDC_HALF_ZRANGE\"] = \"\";\n }\n else {\n delete defines[\"IS_NDC_HALF_ZRANGE\"];\n }\n if (useReverseDepthBuffer) {\n defines[\"USE_REVERSE_DEPTHBUFFER\"] = \"\";\n }\n else {\n delete defines[\"USE_REVERSE_DEPTHBUFFER\"];\n }\n if (useExactSrgbConversions) {\n defines[\"USE_EXACT_SRGB_CONVERSIONS\"] = \"\";\n }\n else {\n delete defines[\"USE_EXACT_SRGB_CONVERSIONS\"];\n }\n return;\n }\n else {\n let s = \"\";\n if (isNDCHalfZRange) {\n s += \"#define IS_NDC_HALF_ZRANGE\";\n }\n if (useReverseDepthBuffer) {\n if (s) {\n s += \"\\n\";\n }\n s += \"#define USE_REVERSE_DEPTHBUFFER\";\n }\n if (useExactSrgbConversions) {\n if (s) {\n s += \"\\n\";\n }\n s += \"#define USE_EXACT_SRGB_CONVERSIONS\";\n }\n return s;\n }\n}\n/**\n * Allocate a typed array depending on a texture type. Optionally can copy existing data in the buffer.\n * @param type type of the texture\n * @param sizeOrDstBuffer size of the array OR an existing buffer that will be used as the destination of the copy (if copyBuffer is provided)\n * @param sizeInBytes true if the size of the array is given in bytes, false if it is the number of elements of the array\n * @param copyBuffer if provided, buffer to copy into the destination buffer (either a newly allocated buffer if sizeOrDstBuffer is a number or use sizeOrDstBuffer as the destination buffer otherwise)\n * @returns the allocated buffer or sizeOrDstBuffer if the latter is an ArrayBuffer\n */\nexport function allocateAndCopyTypedBuffer(type, sizeOrDstBuffer, sizeInBytes = false, copyBuffer) {\n switch (type) {\n case 3: {\n const buffer = sizeOrDstBuffer instanceof ArrayBuffer ? new Int8Array(sizeOrDstBuffer) : new Int8Array(sizeOrDstBuffer);\n if (copyBuffer) {\n buffer.set(new Int8Array(copyBuffer));\n }\n return buffer;\n }\n case 0: {\n const buffer = sizeOrDstBuffer instanceof ArrayBuffer ? new Uint8Array(sizeOrDstBuffer) : new Uint8Array(sizeOrDstBuffer);\n if (copyBuffer) {\n buffer.set(new Uint8Array(copyBuffer));\n }\n return buffer;\n }\n case 4: {\n const buffer = sizeOrDstBuffer instanceof ArrayBuffer ? new Int16Array(sizeOrDstBuffer) : new Int16Array(sizeInBytes ? sizeOrDstBuffer / 2 : sizeOrDstBuffer);\n if (copyBuffer) {\n buffer.set(new Int16Array(copyBuffer));\n }\n return buffer;\n }\n case 5:\n case 8:\n case 9:\n case 10:\n case 2: {\n const buffer = sizeOrDstBuffer instanceof ArrayBuffer ? new Uint16Array(sizeOrDstBuffer) : new Uint16Array(sizeInBytes ? sizeOrDstBuffer / 2 : sizeOrDstBuffer);\n if (copyBuffer) {\n buffer.set(new Uint16Array(copyBuffer));\n }\n return buffer;\n }\n case 6: {\n const buffer = sizeOrDstBuffer instanceof ArrayBuffer ? new Int32Array(sizeOrDstBuffer) : new Int32Array(sizeInBytes ? sizeOrDstBuffer / 4 : sizeOrDstBuffer);\n if (copyBuffer) {\n buffer.set(new Int32Array(copyBuffer));\n }\n return buffer;\n }\n case 7:\n case 11:\n case 12:\n case 13:\n case 14:\n case 15: {\n const buffer = sizeOrDstBuffer instanceof ArrayBuffer ? new Uint32Array(sizeOrDstBuffer) : new Uint32Array(sizeInBytes ? sizeOrDstBuffer / 4 : sizeOrDstBuffer);\n if (copyBuffer) {\n buffer.set(new Uint32Array(copyBuffer));\n }\n return buffer;\n }\n case 1: {\n const buffer = sizeOrDstBuffer instanceof ArrayBuffer ? new Float32Array(sizeOrDstBuffer) : new Float32Array(sizeInBytes ? sizeOrDstBuffer / 4 : sizeOrDstBuffer);\n if (copyBuffer) {\n buffer.set(new Float32Array(copyBuffer));\n }\n return buffer;\n }\n }\n const buffer = sizeOrDstBuffer instanceof ArrayBuffer ? new Uint8Array(sizeOrDstBuffer) : new Uint8Array(sizeOrDstBuffer);\n if (copyBuffer) {\n buffer.set(new Uint8Array(copyBuffer));\n }\n return buffer;\n}\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,qBAAqB;AACjD,SAASC,mBAAmB,QAAQ,0BAA0B;AAE9D,OAAO,MAAMC,qBAAqB,GAAG,CAAC,CAAC;AACvC;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAACC,MAAM,EAAEC,OAAO,EAAEC,aAAa,GAAG,EAAE,EAAE;EACpE,OAAOA,aAAa,IAAID,OAAO,GAAGA,OAAO,GAAG,IAAI,GAAG,EAAE,CAAC,GAAGD,MAAM;AACnE;AACA;AACA;AACA;AACA,OAAO,SAASG,SAASA,CAACC,GAAG,EAAEC,SAAS,EAAEC,UAAU,EAAEC,eAAe,EAAEC,cAAc,EAAEC,OAAO,EAAEC,gBAAgB,EAAE;EAC9G,MAAMC,QAAQ,GAAGD,gBAAgB,IAAIZ,qBAAqB,CAACa,QAAQ;EACnE,IAAIA,QAAQ,EAAE;IACV,MAAMC,OAAO,GAAGD,QAAQ,CAACP,GAAG,EAAEC,SAAS,EAAEC,UAAU,EAAEC,eAAe,EAAEC,cAAc,EAAEC,OAAO,CAAC;IAC9F,OAAOG,OAAO;EAClB;EACA,MAAMhB,WAAW,CAAC,WAAW,CA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