@predy-js/render-interface 0.3.0-beta.1 → 0.3.0-beta.100

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../node_modules/tslib/tslib.es6.js","../../src/common/console.ts","../../types/constants.ts","../../types/RenderPass.ts","../../types/Texture.ts","../../types/GPUBuffer.ts","../../src/webgl/constants.ts","../../types/ShaderLibrary.ts","../../src/common/utils.ts","../../src/render/RenderFrameInternal.ts","../../src/render/MarsSemanticMap.ts","../../src/render/MarsRenderFrame.ts","../../types/GPUCapability.ts","../../src/webgl/GLGPUBuffer.ts","../../src/webgl/WebGLState.ts","../../src/common/raf.ts","../../src/webgl/glType.ts","../../src/webgl/GLUniformUtils.ts","../../src/webgl/GLProgram.ts","../../src/webgl/GLShaderLibrary.ts","../../src/common/env.ts","../../src/webgl/GLGPUCapability.ts","../../src/webgl/GLTexture.ts","../../src/webgl/GLGPURenderer.ts","../../src/render/MarsGPUCapability.ts","../../types/Canvas.ts","../../types/native/RendererInternal.ts","../../types/native/ResourceInternal.ts","../../types/native/PredyNativeInternal.ts","../../src/webgl/GLRenderBuffer.ts","../../src/webgl/GLFrameBuffer.ts","../../src/common/request.ts","../../src/webgl/KhronosTextureContainer.ts","../../src/render/MarsTextureFactory.ts","../../src/render/MarsTexture.ts","../../src/render/MarsRenderPassColorAttachment.ts","../../src/render/MarsRenderPass.ts","../../src/webgl/GLMaterial.ts","../../src/render/MarsMaterialDataBlock.ts","../../src/render/MarsMaterial.ts","../../src/webgl/GLVertexArrayObject.ts","../../src/webgl/GLGeometry.ts","../../src/render/MarsGeometry.ts","../../src/render/MarsMesh.ts","../../src/render/MarsExtWrap.ts","../../src/render/MarsRenderer.ts","../../src/render/MarsSharedGeometry.ts","../../src/module.ts","../../src/index.ts"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n};\r\n","const prefix = '[Predy RI]';\n\nexport function consoleLog (msg: string, ...data: any[]) {\n console.info(prefix + msg, ...data);\n}\n\nexport function consoleWarn (msg: string, ...data: any[]) {\n console.warn(prefix + msg, ...data);\n}\nexport function consoleError (msg: string, ...data: any[]) {\n console.error(prefix + msg, ...data);\n}\n","export declare const constants: WebGL2RenderingContext;\n\nexport enum DestroyOptions {\n destroy = 0,\n keep = 1,\n force = destroy,\n}\n","import type {\n Texture, TextureConfigOptions, TextureFormatOptions,\n} from './Texture';\nimport type { Mesh, MeshDestroyOptions } from './Mesh';\nimport type { vec4 } from './type';\nimport type { IGPURenderer, IGPUResource } from './IGPURenderer';\nimport type { GPURenderer } from './Renderer';\nimport type { UniformValue } from './Material';\nimport type { GPUBuffer } from './GPUBuffer';\nimport type { RenderState, SemanticFunc } from './RenderFrame';\nimport type { DestroyOptions } from './constants';\n\nexport enum RenderPassDestroyAttachmentType {\n force = 0,\n keep = 1,\n keepExternal = 2,\n destroy = force\n}\n\nexport const RenderPassPriorityPrepare = 0;\nexport const RenderPassPriorityNormal = 1000;\nexport const RenderPassPriorityPostprocess = 3000;\n\nexport enum TextureLoadAction {\n whatever = 0,\n //preserve previous attachment\n load = 1,\n //clear attachment\n clear = 2,\n}\n\nexport enum TextureStoreAction {\n store = 1,\n clear = 0\n}\n\nexport enum RenderPassAttachmentStorageType {\n none = 0,\n color = 1,\n //stencil 8 render buffer\n stencil_8_opaque = 2,\n //stencil 16 render buffer\n depth_16_opaque = 3,\n //depth 16 & stencil 8 render buffer\n depth_stencil_opaque = 4,\n //depth 16 texture, need gpu.capability.readableDepthStencilTextures\n depth_16_texture = 5,\n //depth 24 texture, need gpu.capability.readableDepthStencilTextures\n depth_24_stencil_8_texture = 6,\n\n}\n\nexport interface RenderPassStorageObject {\n readonly attachment: GLenum,\n readonly format: GLenum,\n readonly size: [width: number, height: number],\n readonly storageType: RenderPassAttachmentStorageType,\n readonly multiSample: number,\n}\n\nexport interface RenderPassColorAttachmentTextureOptions extends TextureFormatOptions, TextureConfigOptions {\n}\n\nexport interface RenderPassColorAttachmentOptions {\n // color storage must be texture or textureOptions\n texture?: Texture | RenderPassColorAttachmentTextureOptions,\n storage?: RenderPassStorageObject,\n}\n\nexport interface RenderPassColorAttachment {\n readonly storageType: RenderPassAttachmentStorageType.color,\n readonly texture: Texture,\n readonly isDestroyed: boolean,\n}\n\nexport interface RenderPassDepthStencilAttachment {\n readonly storageType: RenderPassAttachmentStorageType,\n readonly texture?: Texture,\n readonly storage: RenderPassStorageObject,\n}\n\nexport interface RenderPassDepthStencilAttachmentOptions {\n storageType: RenderPassAttachmentStorageType,\n storage?: RenderPassStorageObject,\n texture?: Texture,\n}\n\nexport interface RenderPassStoreAction {\n depthAction?: TextureStoreAction,\n stencilAction?: TextureStoreAction,\n colorAction?: TextureStoreAction,\n}\n\nexport interface RenderPassLoadAction {\n clearColor?: vec4,\n colorAction?: TextureLoadAction,\n clearDepth?: number,\n depthAction?: TextureLoadAction,\n clearStencil?: number,\n stencilAction?: TextureLoadAction,\n}\n\nexport interface RenderPassAttachmentOptions {\n attachments?: RenderPassColorAttachmentOptions[],\n depthStencilAttachment?: RenderPassDepthStencilAttachmentOptions,\n //if viewport not set,it will use viewportScale\n viewport?: [x: number, y: number, width: number, height: number],\n //default 1 , when renderer resize, this attachment will be resized to same scale\n //todo 增加测试:\n // 1.viewport 提供时,忽略此参数,renderPass的尺寸由viewport决定,无论renderer是否变化尺寸\n // 2.viewportScale 默认为1,renderPass的尺寸由renderer的尺寸决定,renderer尺寸变化时,renderPass的尺寸也会变化\n // 3.renderPass的color/depth_stencil attachment尺寸由\n viewportScale?: number,\n //in webgl2 use multisample renderbuffer\n //default is 0, means disabled\n //only enabled in webgl2\n multiSample?: number,\n}\n\nexport type SemanticGetter = UniformValue | SemanticFunc | GPUBuffer | Texture | Texture[];\n\nexport interface RenderPassOptions extends RenderPassAttachmentOptions {\n name?: string,\n meshes?: Mesh[],\n priority?: number,\n meshOrder?: RenderPassMeshOrder,\n loadAction?: RenderPassLoadAction,\n storeAction?: RenderPassStoreAction,\n semantics?: { [key: string]: SemanticGetter },\n delegate?: RenderPassDelegate,\n}\n\nexport enum RenderPassMeshOrder {\n none = 1,\n ascending = 2,\n descending = 3\n}\n\nexport type RenderPassDestroyOptions = {\n meshes?: MeshDestroyOptions | DestroyOptions.keep,\n depthStencilAttachment?: RenderPassDestroyAttachmentType,\n colorAttachment?: RenderPassDestroyAttachmentType,\n semantics?: DestroyOptions,\n};\n\nexport declare class SemanticMap {\n\n constructor (options?: { [key: string]: SemanticGetter });\n\n setSemantic (name: string, value: SemanticGetter | undefined): void;\n\n getSemanticValue (name: string, state: RenderState): UniformValue | GPUBuffer | null | undefined;\n\n hasSemanticValue (name: string): boolean;\n\n toObject (): Record<string, SemanticGetter>;\n\n destroy (): void;\n\n}\n\nexport interface RenderPassDelegate {\n willBeginRenderPass?: (renderPass: RenderPass, state: RenderState) => void,\n didEndRenderPass?: (renderPass: RenderPass, state: RenderState) => void,\n willRenderMesh?: (mesh: Mesh, state: RenderState) => void,\n didRenderMesh?: (mesh: Mesh, state: RenderState) => void,\n}\n\nexport declare class RenderPass implements IGPUResource {\n\n readonly isDestroyed: boolean;\n\n readonly name: string;\n\n readonly priority: number;\n\n readonly attachments: RenderPassColorAttachment[];\n\n readonly depthAttachment?: RenderPassDepthStencilAttachment;\n\n readonly stencilAttachment?: RenderPassDepthStencilAttachment;\n\n readonly viewport: [x: number, y: number, width: number, height: number];\n\n readonly meshes: Mesh[];\n\n readonly renderer?: IGPURenderer;\n\n readonly semantics: SemanticMap;\n\n readonly storeAction: RenderPassStoreAction;\n\n readonly loadAction: RenderPassLoadAction;\n\n readonly multisample: number;\n\n delegate: RenderPassDelegate;\n\n meshOrder: RenderPassMeshOrder;\n\n constructor (options: RenderPassOptions, renderer?: IGPURenderer);\n\n /**\n * reset color/depth_stencil attachments,\n * if color/depth_stencil texture is external, this will not destroy textures\n * if color/depth_stencil texture is internal created, this will also delete those textures\n * this method will delete previous fbo if exists\n * returns previous options\n **/\n resetAttachments (options: RenderPassAttachmentOptions): RenderPassAttachmentOptions;\n\n setMeshes (meshes: Mesh[]): Mesh[];\n\n addMesh (mesh: Mesh): void;\n\n removeMesh (mesh: Mesh): void;\n\n destroy (options?: RenderPassDestroyOptions): void;\n\n assignRenderer (renderer: GPURenderer): RenderPass;\n\n}\n","import type { IGPURenderer, IGPUResource } from './IGPURenderer';\nimport type { Immutable, TypedArray } from './type';\nimport type { GPURenderer } from './Renderer';\n\n/**\n * 图片解码的格式,默认为 WebGL2RenderingContext['RGBA8']\n * 如果图片解码格式和texture的不一致,在非Web环境下,会产生报错,无法上传数据\n * 一般情况由系统根据图片文件解析出图片的像素格式\n */\nexport type ImageBitmapPixelFormat = WebGL2RenderingContext['RGBA8'] |\nWebGL2RenderingContext['RGBA16F'] |\nWebGL2RenderingContext['RGBA32F'] ;\n\nexport enum TextureSourceType {\n none,\n data = 1,\n image = 2,\n compressed = 3,\n video = 4,\n canvas = 5,\n framebuffer = 6,\n mipmaps = 7\n}\n\nexport interface TextureFactorySource2DFrom {\n type: TextureSourceType.image | TextureSourceType.video,\n url: string,\n target?: WebGLRenderingContext['TEXTURE_2D'],\n}\n\nexport interface TextureFactorySourceFromCompressed {\n type: TextureSourceType.compressed,\n url: string,\n}\n\nexport type TextureFactorySourceCubeFrom = {\n type: TextureSourceType.image,\n map: TextureCubeSourceURLMap | string[],\n target: WebGLRenderingContext['TEXTURE_CUBE_MAP'],\n};\n\ntype DataRange = [start: number, length: number];\n\nexport type TextureFactorySourceCubeBinaryMipmapsFrom = {\n target: WebGLRenderingContext['TEXTURE_CUBE_MAP'],\n type: TextureSourceType.mipmaps,\n bin: string,\n mipmaps: Array<[\n TEXTURE_CUBE_MAP_POSITIVE_X: DataRange,\n TEXTURE_CUBE_MAP_NEGATIVE_X: DataRange,\n TEXTURE_CUBE_MAP_POSITIVE_Y: DataRange,\n TEXTURE_CUBE_MAP_NEGATIVE_Y: DataRange,\n TEXTURE_CUBE_MAP_POSITIVE_Z: DataRange,\n TEXTURE_CUBE_MAP_NEGATIVE_Z: DataRange\n ]>,\n};\n\nexport type TextureFactorySource2DBinaryMipmapsFrom = {\n target?: WebGLRenderingContext['TEXTURE_2D'],\n type: TextureSourceType.mipmaps,\n bin: string,\n mipmaps: Array<DataRange>,\n};\n\nexport interface TextureFactorySourceCubeMipmapsFrom {\n type: TextureSourceType.mipmaps,\n target: WebGLRenderingContext['TEXTURE_CUBE_MAP'],\n maps: TextureCubeSourceURLMap[] | string[][],\n}\n\nexport interface TextureFactorySource2DMipmapsFrom {\n type: TextureSourceType.mipmaps,\n target?: WebGLRenderingContext['TEXTURE_2D'],\n urls: string[],\n}\n\nexport type TextureFactorySourceFrom =\n TextureFactorySource2DBinaryMipmapsFrom\n | TextureFactorySourceCubeBinaryMipmapsFrom\n | TextureFactorySource2DFrom\n | TextureFactorySourceCubeFrom\n | TextureFactorySourceCubeMipmapsFrom\n | TextureFactorySource2DMipmapsFrom\n | TextureFactorySourceFromCompressed;\n\nexport interface TextureFactory {\n /**\n * 通过TextureConfigOptions可以决定图片解码时使用的格式\n * @param options\n * @param config texture的属性\n */\n loadSourceAsync (options: TextureFactorySourceFrom, config?: TextureConfigOptions): Promise<TextureOptions>,\n\n canOffloadTexture (texture: Texture): boolean,\n\n reloadTextureAsync (texture: Texture): Promise<Texture>,\n\n loadCompressedTextureFromArrayBuffer (arrayBuffer: ArrayBuffer, options?: TextureOptions): TextureOptions,\n}\n\nexport declare class Texture implements IGPUResource {\n readonly width: number;\n readonly height: number;\n readonly id: string;\n readonly options: Immutable<TextureOptions>;\n readonly renderer?: IGPURenderer;\n readonly sourceType: TextureSourceType;\n readonly name: string;\n readonly isDestroyed: boolean;\n\n constructor (options: TextureOptions, renderer?: IGPURenderer);\n\n destroy (): void;\n\n updateSource (options: TextureSourceOptions): void;\n\n uploadCurrentVideoFrame (): boolean;\n\n offloadData (): void;\n\n reloadDataAsync (): Promise<Texture>;\n\n assignRenderer (renderer: GPURenderer): Texture;\n\n}\n\ntype ImageSource = ImageBitmap | HTMLImageElement | HTMLCanvasElement;\n\nexport interface ImageData {\n data: TypedArray,\n width: number,\n height: number,\n}\n\nexport type TextureSourceCubeData = [\n TEXTURE_CUBE_MAP_POSITIVE_X: ImageSource | ImageData,\n TEXTURE_CUBE_MAP_NEGATIVE_X: ImageSource | ImageData,\n TEXTURE_CUBE_MAP_POSITIVE_Y: ImageSource | ImageData,\n TEXTURE_CUBE_MAP_NEGATIVE_Y: ImageSource | ImageData,\n TEXTURE_CUBE_MAP_POSITIVE_Z: ImageSource | ImageData,\n TEXTURE_CUBE_MAP_NEGATIVE_Z: ImageSource | ImageData\n];\n\n// 为减少内存消耗,除了video之外,其余的数据内容会在texture生成后被置为undefined\n// const tex = new Texture({image:myImage},renderer)\n// tex.options.image === undefined\n\nexport type TextureSourceOptions = Texture2DSourceOptions | TextureCubeSourceOptions;\n\nexport interface Texture2DSourceOptionsNone extends TextureOptionsBase {\n sourceType: TextureSourceType.none,\n target?: GLenum,\n}\n\nexport interface Texture2DSourceOptionsImage extends TextureOptionsBase {\n sourceType: TextureSourceType.image,\n image: ImageSource,\n target?: WebGLRenderingContext['TEXTURE_2D'],\n generateMipmap?: boolean,\n}\n\nexport interface Texture2DSourceOptionsFrameBuffer extends TextureOptionsBase {\n sourceType: TextureSourceType.framebuffer,\n data?: { width: number, height: number },\n target?: WebGLRenderingContext['TEXTURE_2D'],\n}\n\nexport interface Texture2DSourceOptionsData extends TextureOptionsBase {\n sourceType: TextureSourceType.data,\n data: { data: TypedArray, width: number, height: number },\n target?: WebGLRenderingContext['TEXTURE_2D'],\n}\n\nexport interface Texture2DSourceOptionsVideo extends TextureOptionsBase {\n sourceType: TextureSourceType.video,\n video: HTMLVideoElement,\n target?: WebGLRenderingContext['TEXTURE_2D'],\n generateMipmap?: boolean,\n}\n\nexport interface Texture2DSourceOptionsImageMipmaps extends TextureOptionsBase {\n sourceType: TextureSourceType.mipmaps,\n mipmaps: Array<ImageSource | { data: TypedArray, width: number, height: number }>,\n target?: WebGLRenderingContext['TEXTURE_2D'],\n}\n\nexport interface Texture2DSourceOptionsCompressed extends TextureOptionsBase {\n sourceType: TextureSourceType.compressed,\n mipmaps: Array<{ data: TypedArray, width: number, height: number }>,\n target?: WebGLRenderingContext['TEXTURE_2D'],\n}\n\nexport interface TextureCubeSourceOptionsImage extends TextureOptionsBase {\n sourceType: TextureSourceType.image | TextureSourceType.data,\n target: WebGLRenderingContext['TEXTURE_CUBE_MAP'],\n cube: TextureSourceCubeData,\n generateMipmap?: boolean,\n}\n\nexport interface TextureCubeSourceOptionsImageMipmaps extends TextureOptionsBase {\n sourceType: TextureSourceType.mipmaps,\n mipmaps: Array<TextureSourceCubeData>,\n target: WebGLRenderingContext['TEXTURE_CUBE_MAP'],\n}\n\nexport type TextureCubeSourceURLMap = [\n TEXTURE_CUBE_MAP_POSITIVE_X: string,\n TEXTURE_CUBE_MAP_NEGATIVE_X: string,\n TEXTURE_CUBE_MAP_POSITIVE_Y: string,\n TEXTURE_CUBE_MAP_NEGATIVE_Y: string,\n TEXTURE_CUBE_MAP_POSITIVE_Z: string,\n TEXTURE_CUBE_MAP_NEGATIVE_Z: string\n];\n\nexport interface TextureConfigOptionsBase {\n name?: string,\n wrapS?: GLenum, // GL_CLAMP_TO_EDGE\n wrapT?: GLenum, // GL_CLAMP_TO_EDGE\n magFilter?: GLenum, // GL_NEAREST\n minFilter?: GLenum, // GL_NEAREST\n anisotropic?: number, //0\n flipY?: boolean,\n premultiplyAlpha?: boolean,\n //when use ImageBitMap, the bitmap content will be closed after sent to GPU\n keepImageSource?: boolean,\n}\n\nexport interface TextureConfigOptions extends TextureConfigOptionsBase {\n sourceFrom?: TextureFactorySourceFrom,\n}\n\nexport interface TextureFormatOptions {\n format?: GLenum, // GL_RGBA\n internalFormat?: GLenum, // GL_RGBA\n type?: GLenum, //GL_UNSIGNED_BYTE\n}\n\nexport interface TextureOptionsBase extends TextureConfigOptions, TextureFormatOptions {\n sourceType: TextureSourceType,\n}\n\nexport type TextureCubeSourceOptions = TextureCubeSourceOptionsImage | TextureCubeSourceOptionsImageMipmaps;\n\nexport type Texture2DSourceOptions =\n Texture2DSourceOptionsImage\n | Texture2DSourceOptionsData\n | Texture2DSourceOptionsVideo\n | Texture2DSourceOptionsImageMipmaps\n | Texture2DSourceOptionsCompressed\n | Texture2DSourceOptionsFrameBuffer;\n\nexport type Texture2DOptions = Texture2DSourceOptions;\n\nexport type TextureCubeOptions = TextureCubeSourceOptions;\n\nexport type TextureOptions = Texture2DOptions | TextureCubeOptions;\n","import type { TypedArray } from './type';\nimport type { IGPUResource, IGPURenderer } from './IGPURenderer';\nimport type { GPURenderer } from './Renderer';\nexport const GPUBufferOptionsMemoryShared = 1 << 1;\nexport type GPUBufferTarget =\n | WebGLRenderingContext['ARRAY_BUFFER']\n | WebGLRenderingContext['ELEMENT_ARRAY_BUFFER']\n | WebGL2RenderingContext['COPY_READ_BUFFER']\n | WebGL2RenderingContext['COPY_WRITE_BUFFER']\n | WebGL2RenderingContext['TRANSFORM_FEEDBACK_BUFFER']\n | WebGL2RenderingContext['UNIFORM_BUFFER']\n | WebGL2RenderingContext['PIXEL_PACK_BUFFER']\n | WebGL2RenderingContext['PIXEL_UNPACK_BUFFER'];\n\nexport interface GPUBufferOptions {\n name?: string,\n /**\n * 数据长度,如果提供了data,忽略此参数\n */\n byteLength?: number,\n\n data?: TypedArray,\n\n /**\n * GL需要设置,Vulkan和Metal此属性忽略\n */\n target?: GPUBufferTarget,\n\n /**\n * GL需要设置,Vulkan和Metal此属性忽略\n */\n usage?: WebGLRenderingContext['STATIC_DRAW'] | WebGLRenderingContext['DYNAMIC_DRAW'],\n}\n\n/**\n * GPU的Buffer对象,通过JS ArrayBuffer,可以向其中写入数据\n * JS调用写入数据后,会立即执行GPU写入的操作,此类型不会保存JS的ArrayBuffer对象\n *\n */\nexport declare class GPUBuffer implements IGPUResource {\n readonly renderer?: IGPURenderer;\n\n readonly isDestroyed: boolean;\n\n readonly level: number;\n\n readonly byteLength: number;\n\n readonly target: GPUBufferTarget;\n\n readonly usage?: WebGLRenderingContext['STATIC_DRAW'] | WebGLRenderingContext['DYNAMIC_DRAW'];\n\n constructor (options: GPUBufferOptions, renderer?: IGPURenderer);\n\n getElementCount (bytePerElement: number): number;\n /**\n * 根据TypedArray容量,重新分配Buffer内存\n * @param typedArray\n */\n bufferData (typedArray: TypedArray): void;\n\n /**\n * 更新buffer数据,立即写入GPU中\n * @param elementOffset 从buffer的第几个元素开始\n * @param typedArray 要写入的数据\n */\n\n bufferSubData (elementOffset: number, typedArray: TypedArray): void;\n\n /**\n * 将数据从GPU中读出,写入到传入的typedArray中,只有当level为2时才能成功,webgl下此函数永远不会成功\n * @param elementOffset 从第几个元素开始拷贝,默认为 0\n * @param typedArray 要写入的typedArray\n * @param elementCount 要写入多少个元素,如果不传入,则为typedArray元素长度\n */\n readSubData (elementOffset: number, typedArray: TypedArray, elementCount?: number): boolean;\n\n assignRenderer (renderer: GPURenderer): GPUBuffer;\n\n destroy (): void;\n}\n\n","import type { TypedArray, vec2 } from '../../types/type';\nimport { consoleError } from '../common/console';\n// @ts-expect-error safe to assign\nexport let constants: WebGL2RenderingContext = {};\n\nif (IS_NODE) {\n constants = require('./gl-constants.json');\n} else {\n if (typeof WebGL2RenderingContext === 'function') {\n copy(WebGL2RenderingContext);\n } else if (typeof WebGLRenderingContext !== 'undefined') {\n copy(WebGLRenderingContext);\n copy(WebGLRenderingContext.prototype);\n } else {\n //ios 16 lockdown mode\n consoleError('WebGL not in global');\n }\n}\n// @ts-expect-error set default value\nconstants['HALF_FLOAT'] = 5131;\n\nfunction copy (target: any) {\n for (const name in target) {\n if (/^[A-Z_]/.test(name)) {\n // @ts-expect-error safe to assign\n constants[name] = target[name];\n }\n }\n}\n\nconst map: { [p: number]: Int32ArrayConstructor | Float32ArrayConstructor | Int16ArrayConstructor | Int8ArrayConstructor | Uint8ArrayConstructor | Uint32ArrayConstructor | Uint16ArrayConstructor } = {\n [constants.INT]: Int32Array,\n [constants.FLOAT]: Float32Array,\n [constants.SHORT]: Int16Array,\n [constants.BYTE]: Int8Array,\n [constants.UNSIGNED_BYTE]: Uint8Array,\n [constants.UNSIGNED_INT]: Uint32Array,\n [constants.UNSIGNED_SHORT]: Uint16Array,\n};\n\nexport function createTypedArrayByGLType (type: number, elementCount: number | ArrayBuffer): TypedArray {\n return new (map[type] || Float32Array)(elementCount as number);\n}\n\nexport function getBytesPerElementByGLType (type: number): number {\n return map[type]?.BYTES_PER_ELEMENT || 0;\n}\nconst MatAttrLocPairMap: Record<number, vec2> = {\n [constants.FLOAT_MAT2]:[2, 2],\n [constants.FLOAT_MAT3]:[3, 3],\n [constants.FLOAT_MAT4]:[4, 4],\n};\n\nexport function getMatAttrLocPair (type: number): vec2 {\n return MatAttrLocPairMap[type] || [1, 1];\n}\n","export type Shader = ShaderWithSource | ShaderUseCacheId;\nexport type ShaderWithSource = InstancedShaderWithSource | SharedShaderWithSource;\nexport interface MetalShaderSpec {\n mtlBinary?: ArrayBuffer | string,\n mtlSource?: string,\n mtlVertex?: string,\n mtlFragment?: string,\n}\n\nexport interface ShaderSourceBase extends MetalShaderSpec {\n fragment: string,\n vertex: string,\n name?: string,\n //将es300的shader in/out关键字替换为attribute/varying\n downgrade?: boolean,\n marcos?: ShaderMarcos,\n}\n\nexport interface InstancedShaderWithSource extends ShaderSourceBase {\n shared?: false,\n}\n\nexport interface SharedShaderWithSource extends ShaderSourceBase {\n //相同cacheId的shader会使用同一个GLProgram\n //提供了cacheId就会认为是shared Shader\n cacheId?: string,\n //shared为true时,\n //如果没有提供cacheId,会根据字符串hash计算出 cacheId,\n //字符串相同的shader将会使用同一个GLProgram\n //如果提供了cacheId,cacheId相同的,都会使用同一个GLProgram\n shared: true,\n}\n\nexport interface ShaderUseCacheId {\n cacheId: string,\n}\n\nexport type ShaderMarcos = [key: string, value: string | number | boolean][];\n\nexport enum ShaderCompileResultStatus {\n noShader = 0,\n success = 1,\n fail = 2,\n compiling = 3\n}\n\nexport interface ShaderCompileResult {\n status: ShaderCompileResultStatus,\n cacheId?: string,\n error?: string | null,\n compileTime?: number,\n // deprecated\n shared?: boolean,\n}\n\n/**\n * @example\n * const lib:ShaderLibrary = ...;\n * const shaderCacheId = lib.addShader({fragment:'...',vertex:'...'});\n * lib.compileShader(shaderCacheId);\n * //pre-compiled program\n * const mtl = new Material({\n * shader:{ shaderCacheId }\n * })\n */\nexport interface ShaderLibrary {\n\n readonly cacheIds: string[],\n\n getShaderResult(cacheId: string): ShaderCompileResult | undefined,\n\n /**\n * 添加shader\n * @param shader\n */\n addShader(shader: Shader): string,\n\n /**\n * @param cacheId\n */\n deleteShader(cacheId: string): void,\n\n /**\n * 编译shader\n * @param shaderCacheId\n * @param asyncCallback 如果传入,则会启用异步编译,当所有编译完成后被回调\n */\n compileShader(shaderCacheId: string, asyncCallback?: (result: ShaderCompileResult) => void): ShaderCompileResult,\n\n /***\n * 编译现有的所有shader\n * @param asyncCallback 如果传入,则会启用异步编译,当所有编译完成后被回调\n */\n compileAllShaders(asyncCallback?: (results: ShaderCompileResult[]) => void): void,\n\n destroy(): void,\n}\n\nexport class ShaderLibraryEmpty implements ShaderLibrary {\n\n get cacheIds () {\n return [];\n }\n\n getShaderResult (cacheId: string): ShaderCompileResult | undefined {\n return undefined;\n }\n\n addShader (shader: Shader, marcos?: ShaderMarcos) {\n return '';\n }\n\n compileAllShaders (asyncCallback?: (results: ShaderCompileResult[]) => void) {\n return [];\n }\n\n deleteShader (cacheId: string) {\n }\n\n compileShader (shaderCacheId: string): ShaderCompileResult {\n return { status: ShaderCompileResultStatus.fail };\n }\n\n destroy () {\n }\n}\n","import { RenderPassMeshOrder } from '../../types/RenderPass';\n\nexport function isFunc (val: any): boolean {\n return typeof val === 'function';\n}\n\nexport function isObj (a: any): boolean {\n return (typeof a === 'object') && a;\n}\n\nexport function isStr (a: any, withLength?: boolean) {\n const str = typeof a === 'string';\n\n if (withLength) {\n return str && a.length > 0;\n }\n\n return str;\n}\n\nexport function arrRemove (arr: Array<any>, ele: any): boolean {\n const idx = arr.indexOf(ele);\n\n if (idx > -1) {\n arr.splice(idx, 1);\n\n return true;\n }\n\n return false;\n}\n\nexport function arrAdd<T> (arr: Array<T>, item: T): boolean {\n if (!arr.includes(item)) {\n arr.push(item);\n\n return true;\n }\n\n return false;\n}\n\nexport function strHashCode (...strings: string[]): number {\n let h = 0;\n\n for (let j = 0; j < arguments.length; j++) {\n const s = strings[j];\n\n for (let i = 0; i < s.length; i++) { h = Math.imul(31, h) + s.charCodeAt(i) | 0; }\n }\n\n return h;\n}\n\nexport function arrAddByOrder (arr: Array<any>, item: any, order?: number): boolean {\n const itemOrder = order || RenderPassMeshOrder.ascending;\n\n if (arr.includes(item)) { return true; }\n arr.push(item);\n if (arr.length === 1) { return true; }\n if (itemOrder !== RenderPassMeshOrder.none) {\n //单次插入排序\n let index = arr.length - 1;\n\n if (index) {\n const currentItem = arr[index];\n\n if (itemOrder !== RenderPassMeshOrder.ascending) {\n while (arr[index - 1].priority < currentItem.priority) {\n arr[index] = arr[index - 1];\n index--;\n if (index === 0) {\n break;\n }\n }\n } else {\n while (arr[index - 1].priority > currentItem.priority) {\n arr[index] = arr[index - 1];\n index--;\n if (index === 0) {\n break;\n }\n }\n }\n arr[index] = currentItem;\n }\n }\n\n return false;\n}\n\nfunction fastSort (arr: Array<any>, order: number, start = 0, end = arr.length - 1): Array<any> {\n // 终止条件\n if (start >= end) { return arr; }\n let left = start, right = end;\n const base = arr[start];\n\n while (left < right) {\n if (order === RenderPassMeshOrder.ascending) {\n // 从右向左,寻找第一个小于base的值\n while (arr[right].priority > base.priority && right >= left) { right--; }\n // 从左向右,寻找第一个大于base的值\n while (arr[left].priority <= base.priority && left < right) { left++; }\n } else {\n // 从右向左,寻找第一个大于base的值\n while (arr[right].priority < base.priority && right >= left) { right--; }\n // 从左向右,寻找第一个小于base的值\n while (arr[left].priority >= base.priority && left < right) { left++; }\n }\n // 将两个值交换位置\n [arr[left], arr[right]] = [arr[right], arr[left]];\n }\n // 将最后两个游标相遇的位置的值与base值交换\n [arr[start], arr[left]] = [arr[left], arr[start]];\n fastSort(arr, order, start, left - 1);\n fastSort(arr, order, right + 1, end);\n\n return arr;\n}\n\nexport function sortByOrder (arr: Array<any>, order?: number): Array<any> {\n const itemOrder = order || RenderPassMeshOrder.ascending;\n\n if (arr.length === 0 || arr.length === 1) { return arr; }\n if (itemOrder === RenderPassMeshOrder.none) {\n return arr;\n } else {\n //30个以下的数据用插入排序\n if (arr.length <= 30) {\n const length = arr.length;\n\n for (let i = 1; i < length; i++) {\n const currentItem = arr[i];\n let index = i;\n\n if (itemOrder !== RenderPassMeshOrder.ascending) {\n while (index >= 1 && arr[index - 1].priority < currentItem.priority) {\n arr[index] = arr[index - 1];\n index--;\n if (index === 0) {\n break;\n }\n }\n } else {\n while (index >= 1 && arr[index - 1].priority > currentItem.priority) {\n arr[index] = arr[index - 1];\n index--;\n if (index === 0) {\n break;\n }\n }\n }\n arr[index] = currentItem;\n }\n\n return arr;\n } else {\n return fastSort(arr, itemOrder);\n }\n }\n\n}\n\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\n\nexport function forEach<T> (object: null | undefined | { [key: string]: T }, callback: (val: T, key: string) => void, thisObj?: any) {\n if (isObj(object)) {\n if (thisObj === undefined) {\n thisObj = object;\n }\n for (const name in object) {\n if (hasOwnProperty.call(object, name)) {\n callback.call(thisObj, object[name], name);\n }\n }\n }\n\n return object;\n}\n\nexport function throwDestroyedError () {\n throw Error('destroyed item cannot be used again');\n}\n","import type { MarsRenderFrame } from './MarsRenderFrame';\nimport type { RenderState } from '../../types/RenderFrame';\nimport type {\n RenderPassLoadAction,\n RenderPassStoreAction,\n} from '../../types/RenderPass';\nimport {\n TextureLoadAction,\n} from '../../types/RenderPass';\nimport { constants } from '../webgl/constants';\nimport type { GLGPURenderer } from '../webgl/GLGPURenderer';\nimport type { MarsMesh } from './MarsMesh';\nimport type { MarsGeometry } from './MarsGeometry';\nimport type { MarsRenderPass } from './MarsRenderPass';\nimport type { MarsRenderer } from './MarsRenderer';\nimport { consoleError } from '../common/console';\n\nexport class RenderFrameInternal {\n\n static render (frame: MarsRenderFrame) {\n const passes = frame._renderPasses;\n const renderer = frame.renderer;\n\n if (renderer.isDestroyed) {\n return consoleError('renderer is destroyed', renderer);\n }\n frame.renderer.shaderLibrary.compileAllShaders();\n clear(renderer.internal, frame.loadAction);\n //@ts-expect-error safe to assign\n const renderState: RenderState = {\n currentFrame: frame,\n };\n\n for (let i = 0; i < passes.length; i++) {\n const pass = passes[i];\n const delegate = pass.delegate;\n\n if (pass.isDestroyed) {\n consoleError(`render pass ${pass.name} destroyed`, pass);\n } else {\n delegate.willBeginRenderPass && delegate?.willBeginRenderPass(pass, renderState);\n this.renderRenderPass(renderer, pass as MarsRenderPass, renderState);\n delegate.didEndRenderPass && delegate?.didEndRenderPass(pass, renderState);\n }\n }\n }\n\n static renderRenderPass (renderer: MarsRenderer, pass: MarsRenderPass, renderState: RenderState): void {\n renderState.currentPass = pass;\n setupRenderPass(renderer, pass);\n\n renderMeshes(renderer, renderState);\n endRenderPass(renderer, pass);\n }\n}\n\nfunction endRenderPass (renderer: MarsRenderer, renderPass: MarsRenderPass) {\n if (renderPass.storeAction) {\n clear(renderer.internal, renderPass.storeAction);\n }\n renderPass.unbind();\n}\n\nfunction renderMeshes (renderer: MarsRenderer, state: RenderState) {\n //assume meshes has been sorted\n const sortedMeshes = state.currentPass.meshes;\n const delegate = state.currentPass.delegate;\n\n for (let i = 0; i < sortedMeshes.length; i++) {\n const mesh = sortedMeshes[i];\n\n if (mesh.isDestroyed) {\n consoleError(`mesh ${mesh.name} destroyed`, mesh);\n } else if (!mesh.hide) {\n delegate.willRenderMesh && delegate.willRenderMesh(mesh, state);\n renderMesh(renderer, mesh as MarsMesh, state);\n delegate.didRenderMesh && delegate.didRenderMesh(mesh, state);\n }\n }\n for (let i = 0; i < sortedMeshes.length; i++) {\n const mtl = (sortedMeshes[i] as MarsMesh).material;\n\n if (mtl) {\n mtl.dataBlocks.forEach(d => d.clearFlags());\n }\n }\n}\n\nfunction setupRenderPass (renderer: MarsRenderer, renderPass: MarsRenderPass) {\n renderPass.assignRenderer(renderer);\n loadRenderPassAttachments(renderer.internal, renderPass);\n}\n\nfunction renderMesh (renderer: MarsRenderer, mesh: MarsMesh, state: RenderState) {\n state.currentMesh = mesh;\n mesh.material.assignRenderer(renderer);\n const material = (mesh.material).materialInternal;\n\n if (material) {\n const program = material.getProgram();\n\n if (program) {\n material.setupStates();\n program.setupUniforms(state);\n mesh.geometries.forEach((geometry: MarsGeometry) => {\n geometry.assignRenderer(renderer);\n geometry.flush();\n const vao = program.setupAttributes(geometry.internal);\n\n geometry.internal.draw(state);\n if (vao) {\n vao.unbind();\n }\n });\n }\n }\n}\n\nfunction loadRenderPassAttachments (renderer: GLGPURenderer, renderPass: MarsRenderPass) {\n renderPass.bind();\n if (renderPass.loadAction) {\n clear(renderer, renderPass.loadAction);\n }\n}\n\nfunction clear (renderer: GLGPURenderer, action: RenderPassLoadAction | RenderPassStoreAction) {\n const state = renderer.state;\n let bit = 0;\n\n if (action.colorAction === TextureLoadAction.clear) {\n const clearColor = action.clearColor;\n\n if (clearColor) {\n state.clearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);\n }\n state.colorMask(true, true, true, true);\n bit = constants.COLOR_BUFFER_BIT;\n }\n if (action.stencilAction === TextureLoadAction.clear) {\n state.stencilMask(0xff);\n state.clearStencil(action.clearStencil || 0);\n bit = bit | constants.STENCIL_BUFFER_BIT;\n }\n if (action.depthAction === TextureLoadAction.clear) {\n const depth = action.clearDepth as number;\n\n state.depthMask(true);\n state.clearDepth(Number.isFinite(depth) ? depth : 1);\n bit = bit | constants.DEPTH_BUFFER_BIT;\n }\n if (bit) {\n state.clear(bit);\n }\n}\n","import type {\n GPUBuffer, RenderState, SemanticFunc, UniformValue, SemanticMap, SemanticGetter,\n} from '../../types';\nimport { forEach, isFunc } from '../common/utils';\n\nexport class MarsSemanticMap implements SemanticMap {\n public readonly semantics: Record<string, SemanticGetter>;\n\n constructor (semantics?: Record<string, SemanticGetter>) {\n this.semantics = Object.assign({}, semantics || {});\n }\n\n toObject (): Record<string, SemanticGetter> {\n return Object.assign({}, this.semantics);\n }\n\n setSemantic (name: string, value: SemanticGetter | undefined) {\n if (value === undefined) {\n delete this.semantics[name];\n } else {\n this.semantics[name] = value;\n }\n }\n\n getSemanticValue (name: string, state: RenderState): UniformValue | GPUBuffer | null | undefined {\n const ret = this.semantics[name];\n\n if (isFunc(ret)) {\n return (ret as SemanticFunc)(state);\n }\n\n return ret as UniformValue;\n }\n\n hasSemanticValue (name: string): boolean {\n return name in this.semantics;\n }\n\n destroy () {\n const c = this.semantics;\n\n forEach(c, function (va, name) {\n if (va && isFunc((va as GPUBuffer).destroy)) {\n (va as GPUBuffer).destroy();\n }\n delete c[name];\n });\n }\n}\n","import type {\n RenderFrame,\n RenderFrameDestroyOptions,\n RenderFrameOptions,\n RenderPass,\n RenderPassLoadAction,\n} from '../../types';\nimport {\n arrAddByOrder, arrRemove, sortByOrder, throwDestroyedError,\n} from '../common/utils';\nimport { RenderFrameInternal } from './RenderFrameInternal';\nimport type { MarsRenderer } from './MarsRenderer';\nimport { MarsSemanticMap } from './MarsSemanticMap';\nimport { DestroyOptions } from '../../types/constants';\n\nlet renderFrameSeed = 1;\n\nexport class MarsRenderFrame implements RenderFrame {\n loadAction: RenderPassLoadAction;\n readonly name: string;\n readonly semantics: MarsSemanticMap;\n _renderPasses!: RenderPass[];\n private _renderer!: MarsRenderer;\n private _isDestroyed = false;\n\n get renderPasses () {\n return this._renderPasses.slice();\n }\n\n get isDestroyed () {\n return this._isDestroyed;\n }\n\n get renderer (): MarsRenderer {\n return this._renderer;\n }\n\n constructor (options: RenderFrameOptions, renderer?: MarsRenderer) {\n this.setRenderPasses(options.renderPasses as RenderPass[] || []);\n this.semantics = new MarsSemanticMap(options.semantics);\n this.loadAction = options.loadAction || {};\n this.name = options.name || ('RenderFrame' + renderFrameSeed++);\n if (renderer) {\n this.assignRenderer(renderer);\n }\n }\n\n assignRenderer (renderer: MarsRenderer): MarsRenderFrame {\n if (!this._renderer) {\n this._renderer = renderer;\n }\n\n return this;\n }\n\n destroy (options?: RenderFrameDestroyOptions) {\n if (options?.semantics !== DestroyOptions.keep) {\n this.semantics.destroy();\n }\n const pass = options?.passes ? options.passes : undefined;\n\n if (pass !== DestroyOptions.keep) {\n this._renderPasses.forEach(renderPass => {\n renderPass.destroy(pass);\n });\n }\n this._renderPasses.length = 0;\n this.assignRenderer = throwDestroyedError as unknown as (r: MarsRenderer) => MarsRenderFrame;\n this._isDestroyed = true;\n }\n\n render (): void {\n RenderFrameInternal.render(this);\n }\n\n setRenderPasses (passes: RenderPass[]) {\n this._renderPasses = sortByOrder(passes.slice());\n }\n\n addRenderPass (pass: RenderPass): void {\n arrAddByOrder(this._renderPasses, pass);\n }\n\n removeRenderPass (pass: RenderPass): void {\n arrRemove(this._renderPasses, pass);\n }\n\n forEachRenderPass (callback: (renderPass: RenderPass, index: number, pipeline: MarsRenderFrame) => void) {\n const passes = this._renderPasses;\n\n for (let i = 0; i < passes.length; i++) {\n callback.call(passes, passes[i], i, this);\n }\n }\n}\n","import type { Immutable } from './type';\nexport const COMPRESSED_TEXTURE_NONE = 0;\nexport const COMPRESSED_TEXTURE_PVRTC = 1;\nexport const COMPRESSED_TEXTURE_ASTC = 2;\n\nexport interface GPUCapabilityDetail {\n maxSample: number,\n floatTexture: number,\n halfFloatTexture: number,\n //set currentPass color attachment type FLOAT\n floatColorAttachment?: boolean,\n //set currentPass color attachment type HALF_FLOAT\n halfFloatColorAttachment?: boolean,\n maxVertexUniforms: number,\n maxVertexTextures: number,\n maxFragmentUniforms: number,\n maxFragmentTextures: number,\n maxShaderTexCount: number,\n maxTextureSize: number,\n maxTextureAnisotropy: number,\n compressedTexture: number,\n shaderTextureLod: boolean,\n instanceDraw?: boolean,\n drawBuffers?: boolean,\n asyncShaderCompile?: boolean,\n //draw elements use uint32 Array\n intIndexElementBuffer?: boolean,\n //render pass depth and stencil texture readable\n //in webgl, if not readable,use RenderBuffer which cannot readable\n readableDepthStencilTextures?: boolean,\n writableFragDepth?: boolean,\n}\n\nexport type GPUFramework = 'webgl' | 'webgl2' | 'opengles3' | 'opengles2' | 'node-gl' | 'metal' | 'none';\n\nexport interface GPUCapability {\n type: GPUFramework,\n level: number,\n capability: Immutable<GPUCapabilityDetail>,\n\n setup (gl: WebGLRenderingContext): void,\n}\n\nexport class GPUCapabilityEmpty implements GPUCapability {\n type: GPUFramework;\n level = 0;\n capability = {\n maxSample: 0,\n floatTexture: 0,\n halfFloatTexture: 0,\n maxVertexUniforms: 0,\n maxVertexTextures: 0,\n maxFragmentUniforms: 0,\n maxFragmentTextures: 0,\n maxTextureSize: 0,\n maxShaderTexCount:0,\n maxTextureAnisotropy: 0,\n compressedTexture: 0,\n shaderTextureLod: false,\n };\n\n constructor () {\n this.type = 'none';\n }\n\n setup (gl: WebGLRenderingContext) {\n }\n}\n","import type { GPUBuffer, GPUBufferOptions, GPUBufferTarget } from '../../types/GPUBuffer';\nimport { constants } from './constants';\nimport type { GLGPURenderer } from './GLGPURenderer';\nimport type { TypedArray } from '../../types/type';\nimport type { MarsRenderer } from '../render/MarsRenderer';\nimport { isObj } from '../common/utils';\n\nexport class GLGPUBuffer implements GPUBuffer {\n\n readonly usage: WebGLRenderingContext['STATIC_DRAW'] | WebGLRenderingContext['DYNAMIC_DRAW'] | WebGLRenderingContext['STREAM_DRAW'];\n\n readonly renderer?: GLGPURenderer;\n\n readonly glBuffer: WebGLBuffer | null;\n\n readonly target: GPUBufferTarget;\n\n private _byteLength: number;\n\n private _isDestroyed = false;\n\n readonly name: string;\n\n get byteLength (): number {\n return this._byteLength;\n }\n\n get isBuffer () {\n return true;\n }\n\n get level () {\n return this.renderer?.level || 1;\n }\n\n get isDestroyed (): boolean {\n return this._isDestroyed;\n }\n\n constructor (options: GPUBufferOptions, renderer: GLGPURenderer) {\n this.renderer = renderer;\n this.glBuffer = renderer.createGLBuffer(this, options.name) as WebGLBuffer;\n this.usage = options.usage || constants.STATIC_DRAW;\n this._byteLength = 0;\n this.name = options.name || '';\n this.target = options.target || constants.ARRAY_BUFFER;\n if (options.data) {\n this.bufferData(options.data);\n } else if (options.byteLength) {\n this.bufferData(options.byteLength);\n }\n }\n\n bind () {\n const gl = this.renderer?.gl as WebGLRenderingContext;\n\n gl.bindBuffer(this.target, this.glBuffer);\n }\n\n bufferData (typedArray: TypedArray | number): void {\n const byteLength = Number.isInteger(typedArray) ? typedArray as number : (typedArray as TypedArray).byteLength;\n\n if (this.renderer) {\n this._byteLength = byteLength;\n const gl = this.renderer.gl;\n const target = this.target;\n\n gl.bindBuffer(target, this.glBuffer);\n if (byteLength === 0) {\n // ios 12 13 cause error when byteLength == 0\n gl.bufferData(target, 1, this.usage);\n } else {\n gl.bufferData(target, byteLength, this.usage);\n if (isObj(typedArray)) {\n gl.bufferSubData(target, 0, typedArray as TypedArray);\n }\n }\n gl.bindBuffer(target, null);\n } else {\n this._byteLength = 0;\n }\n }\n\n bufferSubData (elementOffset: number, typedArray: TypedArray): void {\n if (this.renderer) {\n const gl = this.renderer.gl;\n const target = this.target;\n const byteOffset = elementOffset * typedArray.BYTES_PER_ELEMENT;\n\n gl.bindBuffer(target, this.glBuffer);\n const byteLength = byteOffset + typedArray.byteLength;\n\n if (byteLength > this._byteLength) {\n this._byteLength = byteLength;\n gl.bufferData(target, byteLength, this.usage);\n }\n gl.bufferSubData(target, byteOffset, typedArray);\n gl.bindBuffer(target, null);\n } else {\n this._byteLength = 0;\n }\n }\n\n destroy (): void {\n this.renderer?.deleteGPUBuffer(this);\n // @ts-expect-error safe to assign\n this.glBuffer = this.renderer = null;\n this._isDestroyed = true;\n }\n\n readSubData (elementOffset: number, typedArray: TypedArray): boolean {\n if (this.level === 2) {\n const gl = this.renderer?.gl as WebGL2RenderingContext;\n const target = this.target;\n\n if (gl) {\n gl.bindBuffer(target, this.glBuffer);\n gl.getBufferSubData(target, elementOffset * typedArray.BYTES_PER_ELEMENT, typedArray);\n gl.bindBuffer(target, null);\n\n return true;\n }\n }\n\n return false;\n }\n\n getElementCount (bytePerElement: number) {\n return this._byteLength / bytePerElement;\n }\n\n assignRenderer (renderer: MarsRenderer): GLGPUBuffer {\n if (!this.renderer) {\n // @ts-expect-error safe to assign\n this.renderer = renderer.internal;\n }\n\n return this;\n }\n\n}\n","/**\n * webgl的状态切换\n */\nimport { constants } from './constants';\n\nexport class WebGLState {\n\n public noCache = false;\n readonly _gl: WebGLRenderingContext | WebGL2RenderingContext;\n\n private _dict: any;\n\n private _currentFramebuffer!: Record<number, WebGLFramebuffer | null>;\n\n private _currentTextureBinding!: WebGLTexture | null;\n\n private _currentRenderBuffer!: Record<number, WebGLRenderbuffer | null>;\n\n private _activeTextureIndex!: number;\n\n private readonly _maxTextureCount: number;\n\n private _pixelStorei!: { [key: string]: GLenum };\n\n _textureUnitDict!: { [key: string]: WebGLTexture | null };\n\n bindingVAO?: WebGLVertexArrayObject;\n\n constructor (gl: WebGLRenderingContext | WebGL2RenderingContext) {\n this._gl = gl;\n this._maxTextureCount = gl.TEXTURE0 + gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS) - 1;\n this._reset();\n }\n\n destroy () {\n //@ts-expect-error save to assign\n this.gl = null;\n }\n\n private _reset () {\n this._dict = {};\n this._activeTextureIndex = constants.TEXTURE0;\n this._textureUnitDict = {};\n this._currentFramebuffer = {};\n this._pixelStorei = {};\n this._currentRenderBuffer = {};\n }\n\n toggle (capability: GLenum, enable?: boolean) {\n if (enable) {\n this.enable(capability);\n } else {\n this.disable(capability);\n }\n }\n\n /**\n * 对于该上下文开启某种特性\n * @param capability\n * example:\n * gl.enable(gl.DITHER);\n */\n enable (capability: GLenum) {\n const value = this._dict[capability];\n\n if (value !== true) {\n this._dict[capability] = true;\n this._gl.enable(capability);\n }\n }\n\n /**\n * 基于某种上下文关闭特性\n * @param capability\n * example:\n * gl.disable(gl.DITHER);\n */\n disable (capability: GLenum) {\n const value = this._dict[capability];\n\n if (value !== false) {\n this._dict[capability] = false;\n this._gl.disable(capability);\n }\n }\n\n /**\n * 绑定framebuffer webgl2新增: gl.DRAW_FRAMEBUFFER 和 gl.READ_FRAMEBUFFER\n * @param target\n * @param framebuffer\n * example:\n * const framebuffer = gl.createFramebuffer();\n * gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);\n */\n bindFramebuffer (target: GLenum, framebuffer: WebGLFramebuffer | null) {\n if (this._currentFramebuffer[target] !== framebuffer) {\n this._currentFramebuffer[target] = framebuffer;\n this._gl.bindFramebuffer(target, framebuffer);\n }\n }\n\n bindRenderBuffer (target: GLenum, renderBuffer: WebGLRenderbuffer | null) {\n if (this._currentRenderBuffer[target] !== renderBuffer) {\n this._currentRenderBuffer[target] = renderBuffer;\n this._gl.bindRenderbuffer(target, renderBuffer);\n }\n }\n\n /**\n * 绑定系统framebuffer\n */\n bindSystemFramebuffer () {\n this.bindFramebuffer(this._gl.FRAMEBUFFER, null);\n }\n\n /**\n * 将定义好的WebGLProgram 对象添加到当前的渲染状态中。\n * @param program\n * example:\n * gl.useProgram(program);\n * gl.useProgram(null);\n */\n useProgram (program: WebGLProgram | null) {\n this._set1('useProgram', program);\n }\n\n /**\n * 使用预设值来清空缓冲\n * @param mask\n * example:\n * gl.clear(gl.DEPTH_BUFFER_BIT);\n * gl.clear(gl.DEPTH_BUFFER_BIT | gl.COLOR_BUFFER_BIT);\n */\n clear (mask: number) {\n this._gl.clear(mask);\n }\n\n //depth start\n\n /**\n * 设置深度缓冲区的深度清除值\n * @param depth\n * example:\n * gl.clearDepth(0.5);\n */\n clearDepth (depth: GLclampf) {\n this._set1('clearDepth', depth);\n }\n\n /**\n * 指定将输入像素深度与当前深度缓冲区值进行比较的函数。\n * @param func\n * example:\n * gl.enable(gl.DEPTH_TEST);\n * gl.depthFunc(gl.NEVER);\n */\n public depthFunc (func: GLenum) {\n this._set1('depthFunc', func);\n }\n\n /**\n * 设置是否启用写入深度缓冲。\n * @param flag\n * example:\n * gl.depthMask(false);\n */\n depthMask (flag: boolean) {\n this._set1('depthMask', flag);\n }\n\n polygonOffset (factor: number, unit: number) {\n this._set2('polygonOffset', factor, unit);\n }\n\n /**\n * 将 z 值从规范化设备坐标映射到窗口坐标\n * @param zNear\n * @param zFar\n * example:\n * gl.depthRange(0.2, 0.6);\n */\n depthRange (zNear: number, zFar: number) {\n this._set2('depthRange', zNear, zFar);\n }\n\n //depth end\n\n //stencil start\n /**\n * 模版测试设置函数和引用值。\n * @param func\n * @param ref\n * @param mask\n * example:\n * gl.enable(gl.STENCIL_TEST);\n * gl.stencilFunc(gl.LESS, 0, 0b1110011);\n */\n clearStencil (s: GLint) {\n this._set1('clearStencil', s);\n }\n\n /**\n * 控制启用和禁用模板平面中单个位的正面和背面写入\n * @param mask\n * example:\n * gl.stencilMask(0xff);\n */\n stencilMask (mask: number) {\n this.stencilMaskSeparate(this._gl.FRONT, mask);\n this.stencilMaskSeparate(this._gl.BACK, mask);\n }\n\n /**\n * 模版测试设置函数和引用值。\n * @param func\n * @param ref\n * @param mask\n * example:\n * gl.enable(gl.STENCIL_TEST);\n * gl.stencilFunc(gl.LESS, 0, 0b1110011);\n */\n stencilFunc (func: GLenum, ref: GLint, mask: GLuint) {\n this.stencilFuncSeparate(this._gl.FRONT, func, ref, mask);\n this.stencilFuncSeparate(this._gl.BACK, func, ref, mask);\n }\n\n /**\n * 单面模版测试\n * @param face\n * @param func\n * @param ref\n * @param mask\n * example:\n * gl.enable(gl.STENCIL_TEST);\n * gl.stencilFuncSeparate(gl.FRONT, gl.LESS, 0.2, 1110011);\n */\n stencilFuncSeparate (face: GLenum, func: GLenum, ref: GLint, mask: GLuint) {\n this._set4('stencilFuncSeparate', face, func, ref, mask);\n }\n\n /**\n * 单面的mask写入\n * @param face\n * @param mask\n * example:\n * gl.stencilMaskSeparate(gl.FRONT, 110101);\n */\n stencilMaskSeparate (face: GLenum, mask: GLuint) {\n this._set2('stencilMaskSeparate', face, mask);\n }\n\n /**\n * 设置正面和背面模板测试操作\n * @param fail\n * @param zfail\n * @param zpass\n * example:\n * gl.enable(gl.STENCIL_TEST);\n * gl.stencilOp(gl.INCR, gl.DECR, gl.INVERT);\n */\n stencilOp (fail: GLenum, zfail: GLenum, zpass: GLenum) {\n this.stencilOpSeparate(this._gl.FRONT, fail, zfail, zpass);\n this.stencilOpSeparate(this._gl.BACK, fail, zfail, zpass);\n }\n\n /**\n * 设置正面和/或背面模板测试操作\n * @param face\n * @param fail\n * @param zfail\n * @param zpass\n * example:\n * gl.enable(gl.STENCIL_TEST);\n * gl.stencilOpSeparate(gl.FRONT, gl.INCR, gl.DECR, gl.INVERT);\n */\n stencilOpSeparate (face: GLenum, fail: GLenum, zfail: GLenum, zpass: GLenum) {\n this._set4('stencilOpSeparate', face, fail, zfail, zpass);\n }\n\n //stencil end\n\n //face start\n /**\n * 剔除方式\n * @param mode\n * example:\n * gl.enable(gl.CULL_FACE);\n * gl.cullFace(gl.FRONT_AND_BACK);\n */\n cullFace (mode: GLenum) {\n this._set1('cullFace', mode);\n }\n\n /**\n * 设置卷绕方向\n * @param mode\n * example:\n * gl.frontFace(gl.CW);\n */\n frontFace (mode: GLenum) {\n this._set1('frontFace', mode);\n }\n\n //face end\n\n //color start\n /**\n * 设置颜色写入\n * @param red\n * @param green\n * @param blue\n * @param alpha\n * example:\n * gl.colorMask(true, true, true, false);\n */\n clearColor (red: GLclampf, green: GLclampf, blue: GLclampf, alpha: GLclampf) {\n this._set4('clearColor', red, green, blue, alpha);\n }\n\n /**\n * 设置颜色写入\n * @param red\n * @param green\n * @param blue\n * @param alpha\n * example:\n * gl.colorMask(true, true, true, false);\n */\n colorMask (red: boolean, green: boolean, blue: boolean, alpha: boolean) {\n this._set4('colorMask', red, green, blue, alpha);\n }\n\n /**\n * 设置源和目标混合因子\n * @param red\n * @param green\n * @param blue\n * @param alpha\n * example:\n * gl.blendColor(0, 0.5, 1, 1);\n */\n blendColor (red: GLclampf, green: GLclampf, blue: GLclampf, alpha: GLclampf) {\n this._set4('blendColor', red, green, blue, alpha);\n }\n\n /**\n * 用于混合像素算法\n * @param sfactor\n * @param dfactor\n * example:\n * gl.enable(gl.BLEND);\n * gl.blendFunc(gl.SRC_COLOR, gl.DST_COLOR);\n */\n blendFunc (sfactor: GLenum, dfactor: GLenum) {\n this.blendFuncSeparate(sfactor, dfactor, sfactor, dfactor);\n }\n\n /**\n * 分别设置应用在 RGB 和 Alpha 上的 factor\n * @param srcRGB\n * @param dstRGB\n * @param srcAlpha\n * @param dstAlpha\n * example:\n * gl.enable(gl.BLEND);\n * gl.blendFuncSeparate(gl.SRC_COLOR, gl.DST_COLOR, gl.ONE, gl.ZERO);\n */\n blendFuncSeparate (srcRGB: GLenum, dstRGB: GLenum, srcAlpha: GLenum, dstAlpha: GLenum) {\n this._set4('blendFuncSeparate', srcRGB, dstRGB, srcAlpha, dstAlpha);\n }\n\n /**\n * 设置混合模式\n * @param mode\n * example:\n * gl.blendEquation(gl.FUNC_ADD);\n * gl.blendEquation(gl.FUNC_SUBTRACT);\n * gl.blendEquation(gl.FUNC_REVERSE_SUBTRACT);\n */\n public blendEquation (mode: GLenum) {\n this._set1('blendEquation', mode);\n }\n\n /**\n * 可以分别对 RGB 和 Alpha 做不同的操作处理\n * @param modeRGB\n * @param modeAlpha\n * example:\n * gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_SUBTRACT);\n */\n blendEquationSeparate (modeRGB: GLenum, modeAlpha: GLenum) {\n this._set2('blendEquationSeparate', modeRGB, modeAlpha);\n }\n\n //color end\n /**\n * 图像预处理\n * @param pname\n * @param param\n * example:\n * var tex = gl.createTexture();\n * gl.bindTexture(gl.TEXTURE_2D, tex);\n * gl.pixelStorei(gl.PACK_ALIGNMENT, 4);\n */\n pixelStorei (pname: GLenum, param: GLenum) {\n const currentParam = this._pixelStorei[pname];\n\n if (currentParam !== param) {\n this._pixelStorei[pname] = param;\n this._gl.pixelStorei(pname, param);\n }\n }\n\n /**\n * 用来设置视口,即指定从标准设备到窗口坐标的x、y仿射变换。\n * @param x\n * @param y\n * @param width\n * @param height\n * example:\n * gl.viewport(0, 0, width, height);\n */\n viewport (x: number, y: number, width: number, height: number) {\n this._set4('viewport', x, y, width, height);\n }\n\n /**\n * 激活指定的纹理单元\n * @param texture\n * example:\n * gl.activeTexture(gl.TEXTURE1);\n */\n activeTexture (texture: GLenum) {\n texture = Math.min(texture, this._maxTextureCount);\n if (this._activeTextureIndex !== texture || this.noCache) {\n this._activeTextureIndex = texture;\n this._gl.activeTexture(texture);\n }\n }\n\n /**\n * 绑定WebGLTexture\n * @param target\n * @param texture\n * @param force\n * example:\n * var texture = gl.createTexture();\n * gl.bindTexture(gl.TEXTURE_2D, texture)\n */\n bindTexture (target: GLenum, texture: WebGLTexture | null, force?: boolean) {\n if (this._currentTextureBinding !== texture || force || this.noCache) {\n this._gl.bindTexture(target, texture);\n this._currentTextureBinding = texture;\n }\n this._textureUnitDict[this._activeTextureIndex] = texture;\n }\n\n private _set1 (name: string, param: any) {\n const value = this._dict[name];\n\n if (value !== param) {\n this._dict[name] = param;\n //@ts-expect-error save to assign\n this._gl[name](param);\n }\n }\n\n private _set2 (name: string, param0: number, param1: number) {\n let value = this._dict[name];\n\n if (!value) {\n value = this._dict[name] = { x: NaN, y: NaN };\n }\n\n if (value.x !== param0 || value.y !== param1) {\n //@ts-expect-error save to assign\n this._gl[name](value.x = param0, value.y = param1);\n }\n }\n\n private _set3 (name: string, param0: any, param1: any, param2: any) {\n let value = this._dict[name];\n\n if (!value) {\n value = this._dict[name] = { x: NaN, y: NaN, z: NaN };\n }\n\n if (value.x !== param0 || value.y !== param1 || value.z !== param2) {\n //@ts-expect-error safe to assign\n this._gl[name](value.x = param0, value.y = param1, value.z = param2);\n }\n }\n\n private _set4 (name: string, param0: any, param1: any, param2: any, param3: any) {\n let value = this._dict[name];\n\n if (!value) {\n value = this._dict[name] = {\n x: NaN, y: NaN, z: NaN, w: NaN,\n };\n }\n\n if (value.x !== param0 || value.y !== param1 || value.z !== param2 || value.w !== param3) {\n //@ts-expect-error safe to assign\n this._gl[name](value.x = param0, value.y = param1, value.z = param2, value.w = param3);\n }\n }\n\n get (name: string): any {\n return this._dict[name];\n }\n}\n\n","export function requestAnimationFrame (cb: (n: number) => void) {\n return window.requestAnimationFrame(cb);\n}\n\nexport function cancelAnimationFrame (handle: number) {\n return window.cancelIdleCallback(handle);\n}\n","import { constants } from './constants';\nimport type { MarsTexture } from '../render/MarsTexture';\nimport type { ProgramUniformInfo } from './GLProgram';\nimport type { GLGPURenderer } from './GLGPURenderer';\nimport { consoleError, consoleWarn } from '../common/console';\n\nexport const DATA_DICT: {\n [k: string | number]: {\n name: number,\n uniform: (gl: WebGL2RenderingContext | WebGLRenderingContext, info: ProgramUniformInfo, value: any, renderer: GLGPURenderer) => void,\n },\n} = {\n [constants.FLOAT]: {\n name: constants.FLOAT,\n uniform (gl: WebGL2RenderingContext | WebGLRenderingContext, info: ProgramUniformInfo, value: Float32List) {\n if (value.length != undefined) {\n gl.uniform1fv(info.loc, value);\n } else {\n gl.uniform1f(info.loc, (value as any));\n }\n },\n },\n [constants.FLOAT_VEC2]: {\n name: constants.FLOAT_VEC2,\n uniform (gl: WebGL2RenderingContext | WebGLRenderingContext, info: ProgramUniformInfo, value: Float32List) {\n gl.uniform2fv(info.loc, value);\n },\n },\n [constants.FLOAT_VEC3]: {\n name: constants.FLOAT_VEC3,\n uniform (gl: WebGL2RenderingContext | WebGLRenderingContext, info: ProgramUniformInfo, value: Float32List) {\n gl.uniform3fv(info.loc, value);\n },\n },\n [constants.FLOAT_VEC4]: {\n name: constants.FLOAT_VEC4,\n uniform (gl: WebGL2RenderingContext | WebGLRenderingContext, info: ProgramUniformInfo, value: Float32List) {\n gl.uniform4fv(info.loc, value);\n },\n },\n [constants.FLOAT_MAT2]: {\n name: constants.FLOAT_MAT2,\n uniform: (gl: WebGL2RenderingContext | WebGLRenderingContext, info: ProgramUniformInfo, value: Float32List) => {\n gl.uniformMatrix2fv(info.loc, false, value);\n },\n },\n [constants.FLOAT_MAT2x3]: {\n name: constants.FLOAT_MAT2x3,\n uniform: (gl: WebGL2RenderingContext, info: ProgramUniformInfo, value: Float32List) => {\n gl.uniformMatrix2x3fv(info.loc, false, value);\n },\n },\n [constants.FLOAT_MAT2x4]: {\n name: constants.FLOAT_MAT2x4,\n uniform: (gl: WebGL2RenderingContext, info: ProgramUniformInfo, value: Float32List) => {\n gl.uniformMatrix2x3fv(info.loc, false, value);\n },\n },\n [constants.FLOAT_MAT3]: {\n name: constants.FLOAT_MAT3,\n uniform: (gl: WebGL2RenderingContext | WebGLRenderingContext, info: ProgramUniformInfo, value: Float32List) => {\n gl.uniformMatrix3fv(info.loc, false, value);\n },\n },\n [constants.FLOAT_MAT3x2]: {\n name: constants.FLOAT_MAT3x2,\n uniform: (gl: WebGL2RenderingContext, info: ProgramUniformInfo, value: Float32List) => {\n gl.uniformMatrix3x2fv(info.loc, false, value);\n },\n },\n [constants.FLOAT_MAT3x4]: {\n name: constants.FLOAT_MAT3x4,\n uniform: (gl: WebGL2RenderingContext, info: ProgramUniformInfo, value: Float32List) => {\n gl.uniformMatrix3x4fv(info.loc, false, value);\n },\n },\n [constants.FLOAT_MAT4]: {\n name: constants.FLOAT_MAT4,\n uniform: (gl: WebGL2RenderingContext | WebGLRenderingContext, info: ProgramUniformInfo, value: Float32List) => {\n gl.uniformMatrix4fv(info.loc, false, value);\n },\n },\n [constants.FLOAT_MAT4x3]: {\n name: constants.FLOAT_MAT4x3,\n uniform: (gl: WebGL2RenderingContext, info: ProgramUniformInfo, value: Float32List) => {\n gl.uniformMatrix4x3fv(info.loc, false, value);\n },\n },\n [constants.FLOAT_MAT4x2]: {\n name: constants.FLOAT_MAT4x2,\n uniform: (gl: WebGL2RenderingContext, info: ProgramUniformInfo, value: Float32List) => {\n gl.uniformMatrix4x2fv(info.loc, false, value);\n },\n },\n [constants.INT]: {\n name: constants.INT,\n uniform: (gl: WebGL2RenderingContext | WebGLRenderingContext, info: ProgramUniformInfo, value: Int32List) => {\n if (value.length != undefined) {\n gl.uniform1iv(info.loc, value);\n } else {\n gl.uniform1i(info.loc, (value as any));\n }\n },\n },\n [constants.INT_VEC2]: {\n name: constants.INT_VEC2,\n uniform: (gl: WebGL2RenderingContext | WebGLRenderingContext, info: ProgramUniformInfo, value: Int32List) => {\n gl.uniform2iv(info.loc, value);\n },\n },\n [constants.INT_VEC3]: {\n name: constants.INT_VEC3,\n uniform: (gl: WebGL2RenderingContext | WebGLRenderingContext, info: ProgramUniformInfo, value: Int32List) => {\n gl.uniform3iv(info.loc, value);\n },\n },\n [constants.INT_VEC4]: {\n name: constants.INT_VEC4,\n uniform: (gl: WebGL2RenderingContext | WebGLRenderingContext, info: ProgramUniformInfo, value: Int32List) => {\n gl.uniform4iv(info.loc, value);\n },\n },\n [constants.UNSIGNED_INT]: {\n name: constants.UNSIGNED_INT,\n uniform: (gl: WebGL2RenderingContext, info: ProgramUniformInfo, value: Uint32Array | ArrayLike<number>) => {\n gl.uniform1uiv(info.loc, value);\n },\n },\n [constants.UNSIGNED_INT_VEC2]: {\n name: constants.UNSIGNED_INT_VEC2,\n uniform: (gl: WebGL2RenderingContext, info: ProgramUniformInfo, value: Uint32Array | ArrayLike<number>) => {\n gl.uniform2uiv(info.loc, value);\n },\n },\n [constants.UNSIGNED_INT_VEC3]: {\n name: constants.UNSIGNED_INT_VEC3,\n uniform: (gl: WebGL2RenderingContext, info: ProgramUniformInfo, value: Uint32Array | ArrayLike<number>) => {\n gl.uniform3uiv(info.loc, value);\n },\n },\n [constants.UNSIGNED_INT_VEC4]: {\n name: constants.UNSIGNED_INT_VEC4,\n uniform: (gl: WebGL2RenderingContext, info: ProgramUniformInfo, value: Uint32Array | ArrayLike<number>) => {\n gl.uniform4uiv(info.loc, value);\n },\n },\n [constants.BOOL]: {\n name: constants.BOOL,\n uniform: (gl: WebGLRenderingContext | WebGL2RenderingContext, info: ProgramUniformInfo, value: Int32List) => {\n if (value.length != undefined) {\n gl.uniform1iv(info.loc, value);\n } else {\n gl.uniform1f(info.loc, (value as any));\n }\n },\n },\n [constants.BOOL_VEC2]: {\n name: constants.BOOL_VEC2,\n uniform: (gl: WebGLRenderingContext | WebGL2RenderingContext, info: ProgramUniformInfo, value: Int32List) => {\n gl.uniform2iv(info.loc, value);\n },\n },\n [constants.BOOL_VEC4]: {\n name: constants.BOOL_VEC4,\n uniform: (gl: WebGLRenderingContext | WebGL2RenderingContext, info: ProgramUniformInfo, value: Int32List) => {\n gl.uniform4iv(info.loc, value);\n },\n },\n [constants.BOOL_VEC3]: {\n name: constants.BOOL_VEC3,\n uniform: (gl: WebGLRenderingContext | WebGL2RenderingContext, info: ProgramUniformInfo, value: Int32List) => {\n gl.uniform3iv(info.loc, value);\n },\n },\n [constants.SAMPLER_2D]: {\n name: constants.SAMPLER_2D,\n uniform: assignTexUniform,\n },\n [constants.SAMPLER_CUBE]: {\n name: constants.SAMPLER_CUBE,\n uniform: assignTexUniform,\n },\n};\n\nfunction assignTexUniform (gl: WebGL2RenderingContext | WebGLRenderingContext, info: ProgramUniformInfo, value: MarsTexture | MarsTexture[], renderer: GLGPURenderer) {\n if (value) {\n if (info.size > 1) {\n if (Array.isArray(value)) {\n value.forEach(function (tex, index) {\n assignTextureLoc(gl, info, tex, renderer, index);\n });\n } else {\n consoleError(`${info.name}[${info.size}] expect texture arrays`);\n }\n } else {\n assignTextureLoc(gl, info, value as MarsTexture, renderer, 0);\n }\n }\n}\n\nfunction assignTextureLoc (gl: WebGLRenderingContext | WebGL2RenderingContext, info: ProgramUniformInfo, value: MarsTexture, renderer: GLGPURenderer, index: number) {\n if (value) {\n if (value.isDestroyed) {\n return consoleError(`texture ${value.name} destroyed `, value);\n }\n renderer.state.activeTexture(gl.TEXTURE0 + info.textureIndex + index);\n const glTex = value.internal;\n\n if (glTex) {\n renderer.state.bindTexture(glTex.target, glTex.glHandle as WebGLTexture, true);\n } else {\n consoleWarn('texture not assigned to gl');\n }\n }\n}\n","import { constants } from './constants';\nimport type { GLGPURenderer } from './GLGPURenderer';\nimport type { TypedArray, UniformValue, vec2 } from '../../types';\nimport { GLGPUBuffer } from './GLGPUBuffer';\nimport { forEach, strHashCode } from '../common/utils';\n\ntype TypedArrayCtrl =\n Float32ArrayConstructor\n | Int8ArrayConstructor\n | Int32ArrayConstructor\n | Int16ArrayConstructor\n | Uint32ArrayConstructor\n | Uint16ArrayConstructor\n | Uint8ArrayConstructor;\n\nexport interface UniformBlockSpec {\n index: number,\n usedByVertexShader: boolean,\n usedByFragmentShader: boolean,\n size: number,\n uniformIndices: number[],\n used: boolean,\n name: string,\n uniforms: Record<string, BlockUniformInfo>,\n id: string,\n}\n\ntype BlockUniformInfo = [\n type: number,\n offset: number,\n size: number,\n blockIndex: number,\n arrayStride: number,\n maxStride: number,\n rowMajor: number,\n index: number,\n byteLength: number,\n];\n\nconst BlockUniformInfoOffset = 1;\nconst BlockUniformInfoByteLength = 8;\nconst BlockUniformInfoType = 0;\nconst BlockUniformInfoArrayStride = 4;\nconst BlockUniformInfoArraySize = 2;\nconst BlockUniformInfoRowStride = 5;\n\nfunction getUboHash (spec: UniformBlockSpec) {\n const ret = Object.keys(spec.uniforms).map(name => name + '[' + spec.uniforms[name].join(':') + ']').join('+');\n\n return strHashCode(spec.name + '+', spec.size + '+', spec.uniformIndices.length + '+', ret);\n}\n\nexport function createUniformBlockSpecsFromProgram (gl: WebGL2RenderingContext, program: WebGLProgram, blockUniformNames: string[]): UniformBlockSpec[] {\n const blockSpecs: UniformBlockSpec[] = [];\n const numUniformBlocks = gl.getProgramParameter(program, gl.ACTIVE_UNIFORM_BLOCKS);\n\n for (let ii = 0; ii < numUniformBlocks; ++ii) {\n const name = gl.getActiveUniformBlockName(program, ii) as string;\n const blockSpec: UniformBlockSpec = {\n index: gl.getUniformBlockIndex(program, name),\n usedByVertexShader: gl.getActiveUniformBlockParameter(program, ii, gl.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),\n usedByFragmentShader: gl.getActiveUniformBlockParameter(program, ii, gl.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),\n size: gl.getActiveUniformBlockParameter(program, ii, gl.UNIFORM_BLOCK_DATA_SIZE),\n uniformIndices: gl.getActiveUniformBlockParameter(program, ii, gl.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES),\n used: false,\n uniforms: {},\n name: name,\n id: '',\n };\n\n blockSpec.used = blockSpec.usedByVertexShader || blockSpec.usedByFragmentShader;\n blockSpecs[ii] = blockSpec;\n const indices = blockSpec.uniformIndices;\n const uniformNames: string[] = [];\n\n for (let i = 0; i < indices.length; i++) {\n const name = gl.getActiveUniform(program, indices[i])!.name.replace('[0]', '');\n\n blockSpec.uniforms[name] = [0, 0, 0, 0, 0, 0, 0, i, 0];\n uniformNames[i] = name;\n blockUniformNames.push(name);\n }\n [gl.UNIFORM_TYPE, gl.UNIFORM_OFFSET, gl.UNIFORM_SIZE, gl.UNIFORM_BLOCK_INDEX, gl.UNIFORM_ARRAY_STRIDE, gl.UNIFORM_MATRIX_STRIDE, gl.UNIFORM_IS_ROW_MAJOR].forEach(function (param, pi) {\n gl.getActiveUniforms(program, indices, param).forEach(function (value: number, idx: number) {\n const name = uniformNames[idx];\n\n blockSpec.uniforms[name][pi] = +value;\n });\n });\n for (let i = 0; i < uniformNames.length; i++) {\n const uniform = blockSpec.uniforms[uniformNames[i]];\n const nextUniform = blockSpec.uniforms[uniformNames[i + 1]];\n const size = nextUniform ? nextUniform[1] : blockSpec.size;\n\n uniform[8] = size - uniform[1];\n }\n blockSpec.id = getUboHash(blockSpec) + '';\n }\n\n return blockSpecs;\n}\n\nfunction numberSetter (type: TypedArrayCtrl) {\n return function (value: number | number[], info: BlockUniformInfo, name: string, range: vec2): UBODirtyFlag {\n const flag: UBODirtyFlag = {\n start: info[BlockUniformInfoOffset],\n dirty: true,\n };\n const arrSize = info[BlockUniformInfoArraySize];\n\n if (arrSize > 1) {\n const values = value as number[];\n\n if (values.length) {\n const eleCount = range[1] || values.length;\n const vecLen = info[BlockUniformInfoArrayStride] / type.BYTES_PER_ELEMENT;\n const buffer = flag.buffer = new type(eleCount * vecLen);\n const start = range[0] || 0;\n\n for (let i = 0; i < eleCount; i++) {\n buffer[i * vecLen] = values[i + start];\n }\n flag.start += start * vecLen;\n }\n } else {\n flag.buffer = new type([value] as number[]);\n }\n\n return flag;\n };\n}\n\nconst arrSetter = (type: TypedArrayCtrl) => function setArray (value: number[], info: BlockUniformInfo, name: string, range: vec2): UBODirtyFlag {\n const blockByteLen = info[BlockUniformInfoByteLength];\n const arrSize = info[BlockUniformInfoArraySize];\n const rowStride = info[BlockUniformInfoRowStride];\n const entryStride = arrSize === 1 ? blockByteLen : info[BlockUniformInfoArrayStride];\n const entryRowCount = rowStride ? entryStride / rowStride : 1;\n const rowNumPadding = entryStride / type.BYTES_PER_ELEMENT / entryRowCount;\n const maxRowCount = blockByteLen / type.BYTES_PER_ELEMENT / rowNumPadding;\n //set array\n const numPerEntry = ItemPerValueMap[info[BlockUniformInfoType]];\n const numPerRow = numPerEntry / entryRowCount;\n const valueStartIndex = (range[0] || 0) * numPerEntry;\n const totalRow = range[1] ? entryRowCount * range[1] : maxRowCount;\n const buffer = new type(rowNumPadding * totalRow);\n const flag: UBODirtyFlag = {\n start: info[BlockUniformInfoOffset] + entryStride * (range[0] || 0),\n dirty: true,\n buffer,\n };\n\n for (let i = 0, bufferTarget = 0, sourceIndex = valueStartIndex; i < totalRow; i++) {\n for (let j = 0; j < numPerRow; j++) {\n buffer[bufferTarget + j] = value[sourceIndex + j];\n }\n bufferTarget += rowNumPadding;\n sourceIndex += numPerRow;\n }\n\n return flag;\n};\n\nconst setFloat32Array = arrSetter(Float32Array);\nconst setInt32Array = arrSetter(Int32Array);\nconst setUInt8Array = arrSetter(Uint8Array);\n\nconst MemorySetter: Record<string, (value: any, info: BlockUniformInfo, name: string, range: vec2) => UBODirtyFlag> = {\n [constants.FLOAT]: numberSetter(Float32Array),\n [constants.INT]: numberSetter(Int32Array),\n [constants.UNSIGNED_INT]: numberSetter(Uint32Array),\n [constants.SHORT]: numberSetter(Int16Array),\n [constants.BOOL]: numberSetter(Uint8Array),\n [constants.UNSIGNED_SHORT]: numberSetter(Uint16Array),\n [constants.FLOAT_VEC2]: setFloat32Array,\n [constants.FLOAT_VEC3]: setFloat32Array,\n [constants.FLOAT_VEC4]: setFloat32Array,\n [constants.FLOAT_MAT2]: setFloat32Array,\n [constants.FLOAT_MAT3]: setFloat32Array,\n [constants.FLOAT_MAT4]: setFloat32Array,\n [constants.FLOAT_MAT2x3]: setFloat32Array,\n [constants.FLOAT_MAT2x4]: setFloat32Array,\n [constants.FLOAT_MAT4x3]: setFloat32Array,\n [constants.FLOAT_MAT4x2]: setFloat32Array,\n [constants.FLOAT_MAT3x4]: setFloat32Array,\n [constants.FLOAT_MAT3x2]: setFloat32Array,\n [constants.INT_VEC2]: setInt32Array,\n [constants.INT_VEC3]: setInt32Array,\n [constants.INT_VEC4]: setInt32Array,\n [constants.UNSIGNED_INT_VEC2]: setInt32Array,\n [constants.UNSIGNED_INT_VEC3]: setInt32Array,\n [constants.UNSIGNED_INT_VEC4]: setInt32Array,\n [constants.BOOL_VEC2]: setUInt8Array,\n [constants.BOOL_VEC3]: setUInt8Array,\n [constants.BOOL_VEC4]: setUInt8Array,\n};\n\nconst ItemPerValueMap: Record<number, number> = {\n [constants.FLOAT]: 1,\n [constants.INT]: 1,\n [constants.UNSIGNED_INT]: 1,\n [constants.SHORT]: 1,\n [constants.BOOL]: 1,\n [constants.UNSIGNED_SHORT]: 1,\n [constants.FLOAT_VEC2]: 2,\n [constants.FLOAT_VEC3]: 3,\n [constants.FLOAT_VEC4]: 4,\n [constants.FLOAT_MAT2]: 4,\n [constants.FLOAT_MAT3]: 9,\n [constants.FLOAT_MAT4]: 16,\n [constants.FLOAT_MAT2x3]: 6,\n [constants.FLOAT_MAT2x4]: 8,\n [constants.FLOAT_MAT4x3]: 12,\n [constants.FLOAT_MAT4x2]: 8,\n [constants.FLOAT_MAT3x4]: 12,\n [constants.FLOAT_MAT3x2]: 6,\n [constants.INT_VEC2]: 2,\n [constants.INT_VEC3]: 3,\n [constants.INT_VEC4]: 4,\n [constants.UNSIGNED_INT_VEC2]: 2,\n [constants.UNSIGNED_INT_VEC3]: 3,\n [constants.UNSIGNED_INT_VEC4]: 4,\n [constants.BOOL_VEC2]: 2,\n [constants.BOOL_VEC3]: 3,\n [constants.BOOL_VEC4]: 4,\n};\n\nconst fullRange = [0, 0];\n\ninterface UBODirtyFlag {\n start: number,\n dirty: boolean,\n buffer?: TypedArray,\n}\n\nexport class UniformBlockBuffer {\n buffer?: GLGPUBuffer;\n info: UniformBlockSpec;\n dirtyFlags: Record<string, UBODirtyFlag>;\n keepData: boolean;//for debug use\n\n constructor (renderer: GLGPURenderer, info: UniformBlockSpec) {\n this.buffer = new GLGPUBuffer({\n target: constants.UNIFORM_BUFFER,\n name: info.name,\n byteLength: info.size,\n }, renderer);\n this.dirtyFlags = {};\n this.info = info;\n }\n\n setValues (uniformValues: Record<string, UniformValue>, dirtyFlags: Record<string, boolean>, uniformValueOffsets: Record<string, vec2>) {\n forEach(uniformValues, (value, name) => {\n const uniformInfo: BlockUniformInfo = this.info.uniforms[name];\n\n if (uniformInfo && dirtyFlags[name]) {\n const range = uniformValueOffsets[name] || fullRange;\n const setter = MemorySetter[uniformInfo[BlockUniformInfoType]];\n\n this.dirtyFlags[name] = setter(value, uniformInfo, name, range);\n }\n });\n\n }\n\n bind (gl: WebGL2RenderingContext, program: WebGLProgram, bufferBindIndex: number) {\n const buffer = this.buffer;\n\n if (buffer) {\n buffer.bind();\n forEach(this.dirtyFlags, (flag, name) => {\n if (flag.dirty) {\n buffer.bufferSubData(flag.start, new Uint8Array(flag.buffer!.buffer));\n if (!this.keepData) {\n delete flag.buffer;\n }\n flag.dirty = false;\n }\n });\n gl.uniformBlockBinding(program, bufferBindIndex, bufferBindIndex);\n gl.bindBufferRange(gl.UNIFORM_BUFFER, bufferBindIndex, buffer.glBuffer, 0, this.info.size);\n }\n\n }\n\n destroy () {\n if (this.buffer) {\n this.buffer.destroy();\n this.buffer = undefined;\n }\n }\n}\n\n","import type { GLGPURenderer } from './GLGPURenderer';\nimport { arrAdd, forEach } from '../common/utils';\nimport type { GLGeometry } from './GLGeometry';\nimport type { RenderState } from '../../types/RenderFrame';\nimport { DATA_DICT } from './glType';\nimport { consoleError, consoleWarn } from '../common/console';\nimport type { MarsMaterial } from '../render/MarsMaterial';\nimport type { GLVertexArrayObject } from './GLVertexArrayObject';\nimport type { UniformBlockSpec } from './GLUniformUtils';\nimport { createUniformBlockSpecsFromProgram } from './GLUniformUtils';\nimport type { MarsMaterialDataBlock } from '../render/MarsMaterialDataBlock';\nimport { getBytesPerElementByGLType, getMatAttrLocPair } from './constants';\nimport type { UniformValue } from '../../types';\n\nexport interface ProgramAttributeInfo {\n readonly name: string,\n readonly size: number,\n readonly type: number,\n readonly loc: number,\n}\n\nexport interface ProgramUniformInfo {\n readonly loc: WebGLUniformLocation,\n readonly subInfos: ProgramUniformInfo[],\n readonly name: string,\n readonly size: number,\n readonly type: number,\n readonly textureIndex: number,\n readonly isTexture: boolean,\n}\n\nconst temArr: Set<MarsMaterialDataBlock> = new Set<MarsMaterialDataBlock>();\n\nexport class GLProgram {\n readonly glHandle: WebGLProgram;\n readonly renderer: GLGPURenderer;\n readonly shared: boolean;\n readonly id: string;\n readonly _vaos: GLVertexArrayObject[];\n readonly uniformBlockMap: Record<string, UniformBlockSpec>;\n attrInfoMap!: { [key: string]: ProgramAttributeInfo };\n uniformInfoMap!: { [key: string]: ProgramUniformInfo };\n private _uniformBlocks!: UniformBlockSpec[];\n\n constructor (renderer: GLGPURenderer, program: WebGLProgram, shared: boolean, id: string) {\n this.glHandle = program;\n this.renderer = renderer;\n this.shared = shared;\n this.uniformBlockMap = {};\n this.id = id;\n this.init(renderer, program);\n this._vaos = [];\n }\n\n init (renderer: GLGPURenderer, program: WebGLProgram) {\n const gl = renderer.gl;\n\n renderer.state.useProgram(program);\n let num = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);\n const attrMap: { [key: string]: ProgramAttributeInfo } = {};\n\n for (let i = 0; i < num; i++) {\n const { name, type, size } = gl.getActiveAttrib(program, i) as WebGLActiveInfo;\n const loc = gl.getAttribLocation(program, name);\n\n attrMap[name] = {\n type, name, size, loc,\n };\n }\n\n this.attrInfoMap = attrMap;\n\n const uniformMap: { [key: string]: ProgramUniformInfo } = {};\n\n num = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n let textureIndex = 0;\n const emptyTexture2D = renderer.emptyTexture2D;\n const emptyTextureCube = renderer.emptyTextureCube;\n const blockUniformNames: string[] = [];\n\n if (renderer.level === 2) {\n this._uniformBlocks = createUniformBlockSpecsFromProgram(gl as WebGL2RenderingContext, program, blockUniformNames);\n this._uniformBlocks.forEach(b => this.uniformBlockMap[b.name] = b);\n } else {\n this._uniformBlocks = [];\n }\n for (let i = 0; i < num; i++) {\n const info = gl.getActiveUniform(program, i) as WebGLActiveInfo;\n const { size, type } = gl.getActiveUniform(program, i) as WebGLActiveInfo;\n let name = info.name;\n let location = null;\n\n // BUG, webgl and node gl use different name\n if (/\\[0\\]$/.test(name)) {\n location = gl.getUniformLocation(program, name);\n }\n name = name.replace(/\\[0\\]$/, '');\n if (!location) {\n location = gl.getUniformLocation(program, name);\n }\n if (!location) {\n if (!blockUniformNames.includes(name)) {\n consoleWarn(`get uniform ${name} loc fail`);\n }\n continue;\n }\n this.renderer._assignInspectorName(location, name);\n let locTexIndex = -1;\n\n if (type === gl.SAMPLER_2D || type === gl.SAMPLER_CUBE) {\n locTexIndex = textureIndex;\n for (let k = 0; k < size; k++) {\n const subLoc = k > 0 ? gl.getUniformLocation(program, `${name}[${k}]`) : location;\n const activeIndex = textureIndex + k;\n\n if (activeIndex < renderer.gpu.capability.maxShaderTexCount) {\n gl.activeTexture(gl.TEXTURE0 + activeIndex);\n if (type === gl.SAMPLER_2D) {\n gl.bindTexture(gl.TEXTURE_2D, emptyTexture2D.glHandle as WebGLTexture);\n } else {\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, emptyTextureCube.glHandle as WebGLTexture);\n }\n gl.uniform1i(subLoc, activeIndex);\n } else {\n consoleError(`texture index ${activeIndex} overflows max ${renderer.gpu.capability.maxShaderTexCount}`);\n }\n }\n textureIndex += size;\n }\n\n const subInfos: ProgramUniformInfo[] = [];\n\n for (let j = 0; j < size; ++j) {\n const fullName = name + '[' + j + ']';\n const loc = gl.getUniformLocation(program, fullName);\n\n if (loc !== null) {\n subInfos.push({\n name: fullName,\n loc: loc,\n subInfos: [],\n type: type,\n size: 1,\n textureIndex: locTexIndex,\n isTexture: locTexIndex > -1,\n });\n }\n }\n\n uniformMap[name] = {\n name,\n loc: location,\n subInfos: subInfos,\n type,\n size,\n textureIndex: locTexIndex,\n isTexture: locTexIndex > -1,\n };\n }\n\n renderer.state.useProgram(null);\n gl.activeTexture(gl.TEXTURE0);\n renderer.state.activeTexture(gl.TEXTURE0);\n renderer.state.bindTexture(gl.TEXTURE_2D, emptyTexture2D.glHandle as WebGLTexture, true);\n this.uniformInfoMap = uniformMap;\n }\n\n bind () {\n const renderer = this.renderer;\n\n if (renderer) {\n renderer.state.useProgram(this.glHandle);\n }\n\n }\n\n getSemanticValue (state: RenderState, semanticName: string) {\n const renderPassSemantics = state.currentPass.semantics;\n const renderFrameSemantics = state.currentFrame.semantics;\n\n if (renderPassSemantics.hasSemanticValue(semanticName)) {\n return renderPassSemantics.getSemanticValue(semanticName, state);\n } else if (renderFrameSemantics.hasSemanticValue(semanticName)) {\n return renderFrameSemantics.getSemanticValue(semanticName, state);\n }\n }\n\n setupUniforms (state: RenderState) {\n this.bind();\n const material = state.currentMesh.material as MarsMaterial;\n const gl = this.renderer.gl;\n const blocks = material._dataBlocks;\n const shared = this.shared;\n\n temArr.clear();\n\n forEach(this.uniformBlockMap, (uboInfo, name) => {\n if (uboInfo) {\n\n const block = material.getDataBlockByName(uboInfo.name);\n\n if (block) {\n forEach(block.uniformSemantics, (semanticName, uniformName: string)=> {\n if (uniformName in uboInfo.uniforms && !block.hasUniformValue(uniformName)) {\n const val = this.getSemanticValue(state, semanticName) as UniformValue;\n\n if (val || val === 0) {\n block.setUniformValue(uniformName, val, true);\n }\n\n }\n });\n const uboBuffer = block.createUboBuffer(uboInfo);\n\n if (uboBuffer) {\n block.setUboBuffer(uboBuffer);\n temArr.add(block);\n\n return uboBuffer.bind(gl as WebGL2RenderingContext, this.glHandle, uboInfo.index);\n }\n }\n }\n });\n\n forEach(this.uniformInfoMap, (info: ProgramUniformInfo, name) => {\n let val;\n\n for (let i = 0; i < blocks.length; i++) {\n const block = blocks[i];\n const semanticName = block.uniformSemantics[name];\n\n if (info.isTexture) {\n if (block.hasUniformValue(name)) {\n val = block.getUniformTexture(name);\n } else if (semanticName) {\n val = this.getSemanticValue(state, semanticName);\n }\n } else if (temArr.has(block)) {\n continue;\n } else if (block.hasUniformValue(name)) {\n if (!shared && !block._uniformFlags[name] && info.textureIndex === -1) {\n //not dirty, don't assign\n return;\n }\n val = block.getUniformValue(name);\n } else if (semanticName) {\n val = this.getSemanticValue(state, semanticName);\n }\n if (val !== undefined && val !== null) {\n return this.setGLUniformValue(name, val, info, gl);\n }\n }\n if (!info.isTexture) {\n consoleWarn(`mesh ${state.currentMesh.name} uniform ${name} value unset`);\n }\n });\n\n }\n\n setGLUniformValue (name: string, value: any, info: ProgramUniformInfo, gl: WebGL2RenderingContext | WebGLRenderingContext) {\n const uniformInfo = DATA_DICT[info.type];\n const subInfos = info.subInfos;\n\n if (subInfos.length > 0 && Array.isArray(value) && Array.isArray(value[0])) {\n for (let i = 0; i < subInfos.length && i < value.length; ++i) {\n const subInfo = subInfos[i];\n\n uniformInfo.uniform(gl, subInfo, value[i], this.renderer);\n }\n\n return;\n }\n uniformInfo.uniform(gl, info, value, this.renderer);\n }\n\n setupAttributes (geometry: GLGeometry): GLVertexArrayObject {\n const gl = this.renderer.gl as WebGLRenderingContext;\n const vao = geometry.createVao(this.id);\n const gpu = this.renderer.gpu;\n\n if (vao) {\n vao.bind();\n if (vao.ready) {\n return vao;\n } else {\n arrAdd(this._vaos, vao);\n }\n }\n forEach(this.attrInfoMap, function (attrInfo, name) {\n const attribute = geometry.attributes[name];\n\n if (attribute) {\n const buffer = geometry.getGPUBuffer(attribute.dataSource);\n\n if (!buffer) {\n throw Error(`no buffer named ${attribute.dataSource || name}`);\n }\n buffer.bind();\n if (attribute.size > 4) {\n const [row, col] = getMatAttrLocPair(attrInfo.type);\n const bytesPerRow = getBytesPerElementByGLType(attribute.type) * col;\n const stride = row * bytesPerRow;\n\n for (let i = 0; i < row; i++) {\n const loc = attrInfo.loc + i;\n\n gl.enableVertexAttribArray(loc);\n gl.vertexAttribPointer(loc, col, attribute.type, attribute.normalize as boolean, stride, i * bytesPerRow);\n if (attribute.instanceDivisor && gpu.capability.instanceDraw) {\n gpu.vertexAttribDivisor(gl, loc, attribute.instanceDivisor);\n }\n }\n } else {\n gl.enableVertexAttribArray(attrInfo.loc);\n gl.vertexAttribPointer(attrInfo.loc, attribute.size, attribute.type, attribute.normalize as boolean, attribute.stride || 0, attribute.offset || 0);\n if (attribute.instanceDivisor && gpu.capability.instanceDraw) {\n gpu.vertexAttribDivisor(gl, attrInfo.loc, attribute.instanceDivisor);\n }\n }\n\n }\n });\n geometry._indexBuffer?.bind();\n if (vao) {\n vao.ready = true;\n }\n\n return vao;\n }\n\n destroy () {\n if (this.renderer) {\n this._vaos.forEach(vao => vao.destroy());\n this._vaos.length = 0;\n this.renderer.gl.deleteProgram(this.glHandle);\n //@ts-expect-error safe to assign\n this.renderer = null;\n }\n }\n}\n","import type {\n ShaderCompileResult,\n ShaderLibrary,\n ShaderMarcos,\n ShaderWithSource,\n SharedShaderWithSource,\n} from '../../types/ShaderLibrary';\nimport {\n ShaderCompileResultStatus,\n} from '../../types/ShaderLibrary';\nimport type { GLGPURenderer } from './GLGPURenderer';\nimport { arrAdd, forEach, strHashCode } from '../common/utils';\nimport { requestAnimationFrame } from '../common/raf';\nimport { GLProgram } from './GLProgram';\nimport { consoleError } from '../common/console';\n\ninterface GLShaderCompileResult extends ShaderCompileResult {\n program?: WebGLProgram,\n}\n\nenum ShaderType {\n vertex = 0,\n fragment = 1\n}\n\nconst downgradeKeywords: Record<string, Record<string, string>> = {\n [ShaderType.vertex]: {\n in: 'attribute',\n out: 'varying',\n },\n [ShaderType.fragment]: {\n in: 'varying',\n },\n};\nlet shaderSeed = 1;\n\nexport class GLShaderLibrary implements ShaderLibrary {\n readonly renderer: GLGPURenderer;\n private readonly shaderResults: { [p: string]: ShaderCompileResult };\n\n private _shaderMap: { [key: string]: ShaderWithSource };\n private _programMap: { [key: string]: GLProgram };\n\n private _glVertShaderMap: Map<number, WebGLShader>;\n private _glFragShaderMap: Map<number, WebGLShader>;\n\n private readonly _glAsyncCompileExt?: { COMPLETION_STATUS_KHR: number };\n private _shaderAllDone = false;\n\n constructor (renderer: GLGPURenderer) {\n this.renderer = renderer;\n this._shaderMap = {};\n this.shaderResults = {};\n this._programMap = {};\n this._glVertShaderMap = new Map<number, WebGLShader>();\n this._glFragShaderMap = new Map<number, WebGLShader>();\n const gl = this.renderer.gl as WebGLRenderingContext;\n\n this._glAsyncCompileExt = gl.getExtension('KHR_parallel_shader_compile') as { COMPLETION_STATUS_KHR: number };\n }\n\n get cacheIds (): string[] {\n return Object.keys(this.shaderResults);\n }\n getShaderResult (cacheId: string): ShaderCompileResult | undefined {\n if (this.shaderResults) {\n return this.shaderResults[cacheId];\n }\n }\n\n compileAllShaders (asyncCallback?: (results: ShaderCompileResult[]) => void) {\n if (!this._shaderAllDone) {\n const res = this.shaderResults;\n const pendings: string[] = [];\n\n forEach(this._shaderMap, (result, id) => {\n if (!res[id]) {\n arrAdd(pendings, id);\n }\n });\n\n if (asyncCallback) {\n if (pendings.length) {\n Promise.all<Promise<ShaderCompileResult>[]>(\n pendings.map(id => new Promise(resolve => this.compileShader(id, resolve)))\n )\n .then(asyncCallback)\n .catch(() => 0);\n } else {\n asyncCallback([]);\n }\n } else {\n pendings.map(id => this.compileShader(id));\n }\n this._shaderAllDone = true;\n } else if (asyncCallback) {\n asyncCallback([]);\n }\n }\n\n getProgram (shaderCacheId: string): GLProgram | null {\n if (this._programMap[shaderCacheId] == undefined) {\n if (this._shaderMap[shaderCacheId] !== undefined) {\n this.compileShader(shaderCacheId);\n }\n }\n\n return this._programMap[shaderCacheId];\n }\n\n addMarcosHeader (header: string, shader: string, type: ShaderType, downgrade?: boolean): string {\n const versionTag = /#version\\s+\\b\\d{3}\\b\\s*(es)?/;\n const GLV = `WEBGL${this.renderer.level}`;\n\n if (downgrade) {\n header = header + `\n#ifndef ${GLV}\n#define ${GLV}\n#endif`;\n }\n let fullShader = header + '\\n' + shader;\n const match = fullShader.match(versionTag);\n const version = match ? match[0] : '';\n let realVersion = version;\n\n if (version && version.includes('300') && this.renderer.level === 1 && downgrade) {\n realVersion = '';\n fullShader = fullShader.replace(/\\b(in|out)\\b/g, function (str) {\n return downgradeKeywords[type][str] || str;\n });\n }\n\n return realVersion + '\\n' + fullShader.replace(version, '\\n');\n }\n\n addShader (shader: ShaderWithSource): string {\n const marcosHead = shader.marcos ? combineMaterialMarcos(shader.marcos) : '';\n const vertex = shader.vertex ? this.addMarcosHeader(marcosHead, shader.vertex, ShaderType.vertex, shader.downgrade) : '';\n const fragment = shader.fragment ? this.addMarcosHeader(marcosHead, shader.fragment, ShaderType.fragment, shader.downgrade) : '';\n let shaderCacheId: string;\n let shared = false;\n\n if (shader.shared || (shader as unknown as SharedShaderWithSource).cacheId) {\n shaderCacheId = (shader as SharedShaderWithSource).cacheId || `shared_${strHashCode(vertex, fragment)}`;\n shared = true;\n } else {\n shaderCacheId = 'instanced_' + shaderSeed++;\n }\n if (!this._shaderMap[shaderCacheId]) {\n this._shaderAllDone = false;\n this._shaderMap[shaderCacheId] = {\n vertex,\n fragment,\n name: shader.name || shaderCacheId,\n shared,\n };\n }\n\n return shaderCacheId;\n }\n\n compileShader (shaderCacheId: string, asyncCallback?: (result: ShaderCompileResult) => void): ShaderCompileResult {\n const shaderResult = this.shaderResults[shaderCacheId];\n\n if (!shaderResult) {\n const shader = this._shaderMap[shaderCacheId];\n\n if (!shader) {\n return {\n status: ShaderCompileResultStatus.noShader,\n };\n }\n const gl = this.renderer.gl as WebGLRenderingContext;\n const result: GLShaderCompileResult = { shared: shader.shared, status: ShaderCompileResultStatus.compiling };\n const linkProgram = this.createProgram(gl, shader.vertex, shader.fragment, result);\n const ext = this._glAsyncCompileExt;\n const startTime = Date.now();\n const checkComplete = () => {\n const shouldLink = !asyncCallback || !ext || (ext && gl.getProgramParameter(result.program as GLProgram, ext.COMPLETION_STATUS_KHR) == true);\n const program = shouldLink && linkProgram();\n\n if (program) {\n if (result.status !== ShaderCompileResultStatus.fail) {\n this.renderer._assignInspectorName(program, shader.name);\n const glProgram = new GLProgram(this.renderer, program, !!shader.shared, shaderCacheId);\n\n gl.validateProgram(program);\n const valid = gl.getProgramParameter(program, gl.VALIDATE_STATUS);\n\n if (!valid) {\n result.status = ShaderCompileResultStatus.fail;\n } else {\n result.status = ShaderCompileResultStatus.success;\n result.compileTime = Date.now() - startTime;\n this._programMap[shaderCacheId] = glProgram;\n }\n }\n if (result.status === ShaderCompileResultStatus.fail) {\n const error = gl.getProgramInfoLog(program);\n\n result.error = error;\n consoleError('compileProgramError: ' + error, '\\nvertex:\\n', shader.vertex, '\\nfragment:\\n', shader.fragment);\n gl.deleteProgram(program);\n }\n if (asyncCallback) {\n asyncCallback(result);\n }\n } else if (asyncCallback) {\n requestAnimationFrame(checkComplete);\n }\n };\n\n this.shaderResults[shaderCacheId] = result;\n checkComplete();\n } else if (asyncCallback) {\n asyncCallback(shaderResult);\n }\n\n return this.shaderResults[shaderCacheId];\n }\n\n createProgram (gl: WebGLRenderingContext, vs: string, fs: string, result: GLShaderCompileResult): () => (WebGLProgram | null) {\n const program = gl.createProgram();\n const vertexShader = this.createShader(gl, gl.VERTEX_SHADER, vs);\n const fragShader = this.createShader(gl, gl.FRAGMENT_SHADER, fs);\n\n if (program && vertexShader && fragShader) {\n gl.attachShader(program, vertexShader);\n gl.attachShader(program, fragShader);\n gl.linkProgram(program);\n result.program = program;\n result.status = ShaderCompileResultStatus.compiling;\n\n return function () {\n delete result.program;\n let error!: string | null;\n const linked = !error && gl.getProgramParameter(program, gl.LINK_STATUS);\n\n if (!linked) {\n checkShader(vertexShader, 'vertex', vs);\n checkShader(fragShader, 'fragment', fs);\n result.status = ShaderCompileResultStatus.fail;\n\n return program;\n }\n\n return program;\n };\n }\n result.status = ShaderCompileResultStatus.fail;\n\n return () => null;\n function checkShader (shader: WebGLShader, type: string, code: string) {\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\n const error = gl.getShaderInfoLog(shader);\n\n consoleError(\n 'compile ' + (type) + ' error: ' + error,\n code\n .split('\\n')\n .map((line, index) => `${index + 1} ${line}`)\n .join('\\n'),\n );\n result.error = error;\n result.status = ShaderCompileResultStatus.fail;\n }\n }\n }\n\n createShader (gl: WebGLRenderingContext, shaderType: GLenum, code: string): WebGLShader | null {\n const map = shaderType === gl.VERTEX_SHADER ? this._glVertShaderMap : this._glFragShaderMap;\n const strHash = strHashCode(code);\n const ret = map.get(strHash);\n\n if (ret) {\n return ret;\n }\n const shader = gl.createShader(shaderType);\n\n if (shader) {\n gl.shaderSource(shader, code);\n gl.compileShader(shader);\n map.set(strHash, shader);\n }\n\n return shader;\n }\n\n deleteShader (cacheId: string): void {\n const program = this._programMap[cacheId];\n\n if (program !== undefined) {\n program.destroy();\n delete this._programMap[cacheId];\n }\n const result = this.shaderResults[cacheId];\n\n if (result !== undefined) {\n delete this.shaderResults[cacheId];\n }\n }\n\n destroy (): void {\n this._shaderMap = {};\n forEach(this._programMap, function (program: GLProgram) {\n program.destroy();\n });\n this._programMap = {};\n if (this.renderer) {\n const gl = this.renderer.gl;\n\n this._glFragShaderMap.forEach(function (shader) {\n gl.deleteShader(shader);\n });\n this._glVertShaderMap.forEach(function (shader) {\n gl.deleteShader(shader);\n });\n this._glVertShaderMap = new Map<number, WebGLShader>();\n this._glFragShaderMap = new Map<number, WebGLShader>();\n }\n // @ts-expect-error safe to assign\n this['renderer'] = null;\n }\n}\n\nfunction combineMaterialMarcos (marcos?: ShaderMarcos) {\n const ret: string[] = [];\n\n if (marcos) {\n marcos.forEach(function ([key, value]) {\n if (value === true) {\n ret.push(`#define ${key}`);\n } else if (Number.isFinite(value)) {\n ret.push(`#define ${key} ${value}`);\n }\n });\n\n return ret.length ? (ret.join('\\n') + '\\n') : '';\n }\n\n return '';\n}\n\n","export function isAndroid (): boolean {\n if (IS_NODE) {\n return false;\n } else {\n return /\\b[Aa]ndroid\\b/.test(navigator.userAgent);\n }\n}\n","import type {\n GPUCapability,\n GPUCapabilityDetail,\n} from '../../types/GPUCapability';\nimport {\n COMPRESSED_TEXTURE_ASTC,\n COMPRESSED_TEXTURE_PVRTC,\n} from '../../types/GPUCapability';\nimport type { Immutable } from '../../types/type';\nimport { isAndroid } from '../common/env';\nimport { consoleError, consoleWarn } from '../common/console';\n\nlet textureMaxAnisotropyExt: number;\n\ninterface GLGPUCapabilityDetail extends GPUCapabilityDetail {\n vao: boolean,\n standardDerivatives: boolean,\n halfFloatLinear: boolean,\n floatLinear: boolean,\n maxShaderTexCount: number,\n instanceDraw: boolean,\n}\n\nconst webGL2ConstructorAvailable = typeof WebGL2RenderingContext === 'function';\n\nconst TYPE_WEBGL = 'webgl';\nconst TYPE_WEBGL2 = 'webgl2';\n\nexport class GLGPUCapability implements GPUCapability {\n readonly capability!: Immutable<GLGPUCapabilityDetail>;\n readonly level!: number;\n readonly type!: 'webgl' | 'webgl2' | 'node-gl' | 'none';\n\n drawBufferExtension: any;\n vaoExt: any;\n\n UNSIGNED_INT_24_8!: number;\n\n internalFormatDepth16!: number;\n internalFormatDepth24_stencil8!: number;\n\n instanceDrawExt?: ANGLE_instanced_arrays;\n\n constructor (opt: { glType?: 'webgl' | 'webgl2', gl?: WebGLRenderingContext | WebGL2RenderingContext }) {\n let gl = opt.gl;\n let type = 'none';\n\n opt = opt || {};\n let canvas;\n\n if (IS_NODE) {\n gl = require('gl')(1, 1);\n type = 'node-gl';\n } else {\n if (!gl) {\n let prefix = TYPE_WEBGL;\n\n if (!isAndroid() && webGL2ConstructorAvailable) {\n prefix = opt.glType || TYPE_WEBGL2;\n }\n canvas = document.createElement('canvas');\n gl = canvas.getContext(prefix) as WebGLRenderingContext;\n if (!gl) {\n prefix = 'webgl';\n gl = canvas.getContext(prefix) as WebGLRenderingContext;\n }\n }\n if (gl) {\n type = (webGL2ConstructorAvailable && (gl instanceof WebGL2RenderingContext)) ? TYPE_WEBGL2 : TYPE_WEBGL;\n }\n }\n this._setupCapability(gl);\n // @ts-expect-error safe to assign\n this.type = type;\n if (canvas && gl) {\n gl.getExtension('WEBGL_lose_context')?.loseContext();\n }\n }\n\n _setupCapability (gl?: WebGLRenderingContext | WebGL2RenderingContext) {\n if (gl) {\n // @ts-expect-error safe to assign\n this['level'] = (webGL2ConstructorAvailable && gl instanceof WebGL2RenderingContext) ? 2 : 1;\n const level2 = this.level === 2;\n const textureAnisotropicExt = gl.getExtension('EXT_texture_filter_anisotropic') || gl.getExtension('WEBKIT_EXT_texture_filter_anisotropic');\n\n if (!level2) {\n this.vaoExt = gl.getExtension('OES_vertex_array_object');\n } else {\n this.UNSIGNED_INT_24_8 = (gl as WebGL2RenderingContext).UNSIGNED_INT_24_8;\n }\n this.drawBufferExtension = gl.getExtension('WEBGL_draw_buffers');\n const depthTextureExtension = gl.getExtension('WEBGL_depth_texture');\n\n if (depthTextureExtension) {\n this.UNSIGNED_INT_24_8 = depthTextureExtension.UNSIGNED_INT_24_8_WEBGL;\n }\n let halfFloatLinear = !!gl.getExtension('OES_texture_half_float_linear');\n\n if (level2 && !halfFloatLinear) {\n halfFloatLinear = this.checkLinearTextureFilter(gl as WebGL2RenderingContext, (gl as WebGL2RenderingContext).HALF_FLOAT);\n }\n let floatLinear = !!gl.getExtension('OES_texture_float_linear');\n\n if (level2 && !floatLinear) {\n floatLinear = this.checkLinearTextureFilter(gl as WebGL2RenderingContext, (gl as WebGL2RenderingContext).FLOAT);\n }\n this.internalFormatDepth16 = level2 ? (gl as WebGL2RenderingContext).DEPTH_COMPONENT16 : gl.DEPTH_COMPONENT;\n this.internalFormatDepth24_stencil8 = level2 ? (gl as WebGL2RenderingContext).DEPTH24_STENCIL8 : gl.DEPTH_STENCIL;\n this.instanceDrawExt = gl.getExtension('ANGLE_instanced_arrays')!;\n const floatTexture = (level2 || gl.getExtension('OES_texture_float')) ? gl.FLOAT : 0;\n const halfFloatTexture = level2 ? WebGL2RenderingContext.HALF_FLOAT : (gl.getExtension('OES_texture_half_float')?.HALF_FLOAT_OES || 0);\n const detail: GLGPUCapabilityDetail = {\n floatTexture,\n halfFloatTexture,\n maxSample: level2 ? gl.getParameter((gl as WebGL2RenderingContext).MAX_SAMPLES) : 1,\n maxVertexUniforms: gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS),\n maxVertexTextures: gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),\n maxFragmentUniforms: gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS),\n maxFragmentTextures: gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS),\n floatColorAttachment: level2 ? !!gl.getExtension('EXT_color_buffer_float') : (floatTexture > 0 && !!gl.getExtension('WEBGL_color_buffer_float')),\n halfFloatColorAttachment: level2 ? !!gl.getExtension('EXT_color_buffer_float') : (halfFloatTexture > 0 && !!gl.getExtension('EXT_color_buffer_half_float')),\n maxTextureSize: gl.getParameter(gl.MAX_TEXTURE_SIZE),\n maxShaderTexCount: gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),\n compressedTexture: registerCompressedTexture(gl),\n halfFloatLinear,\n floatLinear,\n maxTextureAnisotropy: textureAnisotropicExt ? gl.getParameter(textureAnisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 0,\n shaderTextureLod: level2 || !!gl.getExtension('EXT_shader_texture_lod'),\n instanceDraw: level2 || !!this.instanceDrawExt,\n drawBuffers: level2 || !!this.drawBufferExtension,\n asyncShaderCompile: !!gl.getExtension('KHR_parallel_shader_compile'),\n intIndexElementBuffer: !!gl.getExtension('OES_element_index_uint'),\n standardDerivatives: level2 || !!gl.getExtension('OES_standard_derivatives'),\n readableDepthStencilTextures: level2 || !!depthTextureExtension,\n vao: level2 || !!this.vaoExt,\n writableFragDepth: level2 || !!gl.getExtension('EXT_frag_depth'),\n };\n\n // @ts-expect-error safe to assign\n this['capability'] = detail;\n if (textureAnisotropicExt) {\n textureMaxAnisotropyExt = textureAnisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT;\n }\n // @ts-expect-error safe to assign\n this['type'] = 'webgl' + (level2 ? '2' : '');\n } else {\n // @ts-expect-error safe to assign\n this['capability'] = {};\n }\n }\n\n checkLinearTextureFilter (gl: WebGL2RenderingContext, type: number): boolean {\n let ret = false;\n const tex = gl.createTexture();\n\n gl.getError();\n gl.bindTexture(gl.TEXTURE_2D, tex);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.R16F, 1, 1, 0, gl.RED, type, null);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n if (!gl.getError()) {\n ret = true;\n }\n gl.deleteTexture(tex);\n\n return ret;\n }\n\n framebufferTexture2D (gl: WebGLRenderingContext | WebGL2RenderingContext, target: GLenum, index: number, textarget: number, texture: WebGLTexture) {\n const ext = this.drawBufferExtension;\n\n if (this.level === 1 && !ext && index > 0) {\n throw Error('draw multiple color buffers not available');\n }\n // @ts-expect-error safe to assign\n const attachment = ext ? ext[`COLOR_ATTACHMENT${index}_WEBGL`] : gl['COLOR_ATTACHMENT' + index];\n\n if (attachment) {\n gl.framebufferTexture2D(target, attachment, textarget, texture, 0);\n } else {\n consoleError('invalid color attachment index:' + index);\n }\n }\n\n vertexAttribDivisor (gl: WebGLRenderingContext | WebGL2RenderingContext, loc: number, divisor: number) {\n if (this.level === 2) {\n (gl as WebGL2RenderingContext).vertexAttribDivisor(loc, divisor);\n } else if (this.instanceDrawExt) {\n this.instanceDrawExt.vertexAttribDivisorANGLE(loc, divisor);\n } else {\n consoleWarn('instance draw not support');\n }\n }\n\n drawElementsInstanced (gl: WebGLRenderingContext | WebGL2RenderingContext, mode: GLenum, count: GLsizei, type: GLenum, offset: GLintptr, instanceCount: GLsizei) {\n if (this.level === 2) {\n (gl as WebGL2RenderingContext).drawElementsInstanced(mode, count, type, offset, instanceCount);\n } else if (this.instanceDrawExt) {\n this.instanceDrawExt.drawElementsInstancedANGLE(mode, count, type, offset, instanceCount);\n } else {\n consoleWarn('instance draw not support');\n }\n\n }\n\n drawArraysInstanced (gl: WebGLRenderingContext | WebGL2RenderingContext, mode: GLenum, first: GLint, count: GLsizei, instanceCount: GLsizei) {\n if (this.level === 2) {\n (gl as WebGL2RenderingContext).drawArraysInstanced(mode, first, count, instanceCount);\n } else if (this.instanceDrawExt) {\n this.instanceDrawExt.drawArraysInstancedANGLE(mode, first, count, instanceCount);\n } else {\n consoleWarn('instance draw not support');\n }\n\n }\n\n drawBuffers (gl: WebGLRenderingContext | WebGL2RenderingContext, bufferStates: boolean[]) {\n const ext = this.drawBufferExtension;\n\n if (this.level === 1 && !ext) {\n if (bufferStates.length > 1) {\n throw Error('draw buffers not available');\n } else {\n return;\n }\n }\n const buffers = bufferStates.map(function (enabled, index) {\n if (enabled) {\n // @ts-expect-error safe to assign\n return ext ? ext[`COLOR_ATTACHMENT${index}_WEBGL`] : (gl as WebGL2RenderingContext)['COLOR_ATTACHMENT' + index];\n }\n\n return gl.NONE;\n });\n\n if (ext) {\n ext.drawBuffersWEBGL(buffers);\n } else {\n (gl as WebGL2RenderingContext).drawBuffers(buffers);\n }\n }\n\n setTextureAnisotropic (gl: WebGLRenderingContext | WebGL2RenderingContext, target: GLenum, level: number) {\n const max = this.capability.maxTextureAnisotropy;\n\n if (max) {\n gl.texParameterf(target, textureMaxAnisotropyExt, Math.min(max, level || 4));\n }\n }\n\n setup (gl: WebGLRenderingContext): void {\n this._setupCapability(gl);\n }\n\n}\n\nexport function registerCompressedTexture (gl: WebGLRenderingContext | WebGL2RenderingContext): number {\n if (gl.getExtension('WEBGL_compressed_texture_astc')) {\n return COMPRESSED_TEXTURE_ASTC;\n }\n if (gl.getExtension('WEBGL_compressed_texture_pvrtc') || gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc')) {\n return COMPRESSED_TEXTURE_PVRTC;\n }\n\n return 0;\n}\n","import type {\n Texture2DSourceOptionsCompressed,\n Texture2DSourceOptionsData,\n Texture2DSourceOptionsFrameBuffer,\n Texture2DSourceOptionsImage,\n Texture2DSourceOptionsImageMipmaps,\n Texture2DSourceOptionsVideo,\n TextureConfigOptions,\n TextureCubeSourceOptionsImage,\n TextureCubeSourceOptionsImageMipmaps,\n TextureOptions,\n TextureSourceOptions,\n} from '../../types/Texture';\nimport {\n TextureSourceType,\n} from '../../types/Texture';\nimport type { GLGPURenderer } from './GLGPURenderer';\nimport type { TypedArray, vec2 } from '../../types/type';\nimport { constants } from './constants';\nimport { consoleError, consoleWarn } from '../common/console';\n\ntype HTMLImageLike = ImageBitmap | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement;\ntype GLContext = WebGLRenderingContext | WebGL2RenderingContext;\n\nlet flipCanvas: HTMLCanvasElement;\n\nexport const imageBitMapAvailable = typeof ImageBitmap === 'function' && typeof createImageBitmap == 'function';\n\nexport class GLTexture {\n readonly renderer?: GLGPURenderer;\n readonly glHandle: WebGLTexture | null;\n readonly options: TextureOptions;\n readonly target: GLenum;\n readonly gpuInfo: [format: number, type: number, target: number, mipmaps: vec2[]];\n width!: number;\n height!: number;\n _mipmapUsed = false;\n constructor (option: TextureOptions, renderer: GLGPURenderer) {\n const gl = renderer.gl;\n\n this.renderer = renderer;\n this.gpuInfo = [0, 0, 0, []];\n this.glHandle = renderer.createGLTexture(this, option.name) as WebGLTexture;\n this.options = option;\n this.target = option.target || gl.TEXTURE_2D;\n this.update(option);\n }\n\n setInspectorName (name: string) {\n this.renderer?._assignInspectorName(this.glHandle, name);\n }\n\n errorLog () {\n consoleError('this this texture has been destroyed');\n }\n\n update (source: TextureSourceOptions) {\n const renderer = this.renderer;\n const handle = this.glHandle;\n const target = this.target;\n const options = this.options;\n\n if (renderer && handle) {\n let width = 0;\n let height = 0;\n const gl = renderer.gl;\n\n renderer.state.bindTexture(target, handle);\n const { sourceType, flipY } = options;\n let format = options.format as GLenum;\n let type = options.type as GLenum;\n let internalFormat = options.internalFormat as GLenum;\n\n if (type === constants.HALF_FLOAT) {\n type = renderer.gpu.capability.halfFloatTexture;\n if (!type) {\n consoleError('half float texture is not support');\n }\n if (renderer.gpu.level === 2 && internalFormat === format) {\n if (format === constants.LUMINANCE) {\n format = constants.RED;\n }\n internalFormat = FORMAT_HALF_FLOAT[format];\n }\n if (!renderer.gpu.capability.halfFloatLinear) {\n options.minFilter = options.magFilter = gl.NEAREST;\n consoleWarn('half float linear not support,change to NEAREST');\n }\n } else if (type === gl.FLOAT) {\n type = renderer.gpu.capability.floatTexture;\n if (!type) {\n consoleError('float texture is not support');\n }\n if (renderer.gpu.level === 2 && internalFormat === format) {\n if (format === constants.LUMINANCE) {\n format = constants.RED;\n }\n internalFormat = FORMAT_FLOAT[format];\n }\n if (!renderer.gpu.capability.floatLinear) {\n options.minFilter = options.magFilter = gl.NEAREST;\n consoleWarn('float linear not support,change to NEAREST');\n }\n }\n const gpuInfo = this.gpuInfo;\n\n gpuInfo[0] = internalFormat;\n gpuInfo[1] = type;\n gpuInfo[2] = target;\n const pma = gl.getParameter(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL);\n\n //fucking pma conflicts for other webgl engine\n if (pma != options.premultiplyAlpha) {\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, options.premultiplyAlpha ? 1 : 0);\n }\n // renderer.state.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, options.premultiplyAlpha ? 1 : 0);\n renderer.state.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipY ? 1 : 0);\n if (sourceType === TextureSourceType.framebuffer) {\n const data = (source as Texture2DSourceOptionsFrameBuffer).data;\n\n if (data) {\n width = data.width || 0;\n height = data.height || 0;\n if (width && height && (this.width !== width || this.height !== height)) {\n gl.texImage2D(target, 0, internalFormat, width, height, 0, format, type, null);\n }\n }\n } else if (sourceType === TextureSourceType.data) {\n if (target === gl.TEXTURE_CUBE_MAP) {\n let ret;\n const cubeData = (source as TextureCubeSourceOptionsImage).cube;\n\n cubeData.forEach((data, key) => {\n ret = this.texImage2DData(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + key, 0, internalFormat, format, type, data as { data: TypedArray, width: number, height: number });\n width = Math.max(ret[0], width);\n height = Math.max(ret[1], height);\n });\n } else {\n [width, height] = this.texImage2DData(gl, target, 0, internalFormat, format, type, (source as Texture2DSourceOptionsData).data);\n }\n } else if (sourceType === TextureSourceType.image || sourceType === TextureSourceType.video) {\n if (target === gl.TEXTURE_CUBE_MAP) {\n let ret;\n\n (source as TextureCubeSourceOptionsImage).cube.forEach((image, key) => {\n ret = this.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + key, 0, internalFormat, format, type, image as HTMLImageElement);\n width = Math.max(ret[0], width);\n height = Math.max(ret[1], height);\n });\n } else if (target === gl.TEXTURE_2D) {\n const image = (source as Texture2DSourceOptionsImage).image || (source as Texture2DSourceOptionsVideo).video;\n\n [width, height] = this.texImage2D(gl, target, 0, internalFormat, format, type, image);\n }\n if ((options as Texture2DSourceOptionsImage).generateMipmap) {\n if ((isPowerOfTwo(width) && isPowerOfTwo(height)) || renderer.level == 2) {\n gl.generateMipmap(target);\n const mipmapSizes: vec2[] = [[width, height]];\n let startWidth = width / 2;\n let startHeight = height / 2;\n\n while (startWidth >= 2 && startHeight >= 2) {\n mipmapSizes.push([startWidth, startHeight]);\n startWidth = Math.round(startWidth / 2);\n startHeight = Math.round(startHeight / 2);\n }\n mipmapSizes.push([1, 1]);\n this.gpuInfo[3] = mipmapSizes;\n this._mipmapUsed = true;\n }\n }\n } else if (sourceType === TextureSourceType.mipmaps) {\n let ret;\n\n if (target === gl.TEXTURE_2D) {\n const mipmaps = (source as Texture2DSourceOptionsImageMipmaps).mipmaps;\n const gpuMipmaps = this.gpuInfo[3];\n\n mipmaps.forEach((mipmap, level) => {\n if ('data' in mipmap) {\n ret = this.texImage2DData(gl, target, level, internalFormat, format, type, mipmap);\n } else {\n ret = this.texImage2D(gl, target, level, internalFormat, format, type, mipmap);\n }\n gpuMipmaps[level] = [ret[0], ret[1]];\n if (level === 0) {\n [width, height] = ret;\n }\n });\n this._mipmapUsed = mipmaps.length > 1;\n } else if (target === gl.TEXTURE_CUBE_MAP) {\n const mipmaps = (source as TextureCubeSourceOptionsImageMipmaps).mipmaps;\n const gpuMipmaps = this.gpuInfo[3];\n\n mipmaps.forEach((mipmap, level) => {\n mipmap.forEach((face, key) => {\n if ('data' in face) {\n ret = this.texImage2DData(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + key, level, internalFormat, format, type, face);\n } else {\n ret = this.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + key, level, internalFormat, format, type, face);\n }\n gpuMipmaps[level] = [ret[0], ret[1]];\n if (level === 0) {\n [width, height] = ret;\n }\n });\n });\n this._mipmapUsed = mipmaps.length > 1;\n }\n } else if (sourceType === TextureSourceType.compressed) {\n const mipmaps = (source as Texture2DSourceOptionsCompressed).mipmaps;\n\n if (mipmaps) {\n const gpuMipmaps = this.gpuInfo[3];\n\n width = mipmaps[0].width;\n height = mipmaps[0].height;\n for (let miplevel = 0; miplevel < mipmaps.length; miplevel++) {\n const mipmap = mipmaps[miplevel];\n\n gpuMipmaps[miplevel] = [mipmap.width, mipmap.height];\n gl.compressedTexImage2D(\n target,\n miplevel,\n internalFormat,\n mipmap.width,\n mipmap.height,\n 0,\n mipmap.data);\n }\n this._mipmapUsed = mipmaps.length > 1;\n }\n }\n if (!this._mipmapUsed) {\n this.gpuInfo[3] = [[width, height]];\n }\n if (pma != options.premultiplyAlpha) {\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, pma);\n }\n this.width = width;\n this.height = height;\n this.setTextureFilters(gl, target, options);\n } else {\n this.width = this.height = 0;\n }\n }\n\n setTextureFilters (gl: GLContext, target: GLenum, options: TextureConfigOptions) {\n if (this.target === gl.TEXTURE_2D) {\n this.renderer?.gpu.setTextureAnisotropic(gl, this.target, options.anisotropic || 4);\n }\n const isPot = this.renderer?.level == 2 || (isPowerOfTwo(this.width) && isPowerOfTwo(this.height));\n const minFiler = isPot ? (options.minFilter || gl.NEAREST) : gl.NEAREST;\n const magFilter = isPot ? (options.magFilter || gl.NEAREST) : gl.NEAREST;\n\n gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, minFiler);\n gl.texParameteri(target, gl.TEXTURE_MAG_FILTER, magFilter);\n gl.texParameteri(target, gl.TEXTURE_WRAP_S, isPot ? (options.wrapS || gl.CLAMP_TO_EDGE) : gl.CLAMP_TO_EDGE);\n gl.texParameteri(target, gl.TEXTURE_WRAP_T, isPot ? (options.wrapT || gl.CLAMP_TO_EDGE) : gl.CLAMP_TO_EDGE);\n }\n\n texImage2D (gl: GLContext, target: GLenum, level: number, internalformat: GLenum, format: GLenum, type: GLenum, image: HTMLImageLike): vec2 {\n const options = this.options;\n const maxSize = this.renderer?.gpu.capability.maxTextureSize || 2048;\n let img = image;\n\n if (options.sourceType !== TextureSourceType.video) {\n let shouldResize = options.minFilter !== gl.NEAREST || options.magFilter !== gl.NEAREST || options.wrapS !== gl.CLAMP_TO_EDGE || options.wrapT !== gl.CLAMP_TO_EDGE;\n\n shouldResize = shouldResize || image.width > maxSize || image.height > maxSize;\n if (shouldResize) {\n img = this.resizeImage(image);\n }\n if (imageBitMapAvailable && img instanceof ImageBitmap && options.flipY) {\n img = this.flipImageBitmap(img);\n }\n }\n gl.texImage2D(target, level, internalformat, format, type, img);\n const size: vec2 = [img.width, img.height];\n\n if (flipCanvas) {\n flipCanvas.width = flipCanvas.height = 1;\n }\n\n return options.sourceType === TextureSourceType.video ? [(image as HTMLVideoElement).videoWidth, (image as HTMLVideoElement).videoHeight] : size;\n }\n\n flipImageBitmap (bitmap: ImageBitmap): HTMLCanvasElement {\n if (!flipCanvas) {\n flipCanvas = document.createElement('canvas');\n }\n const width = flipCanvas.width = bitmap.width;\n const height = flipCanvas.height = bitmap.height;\n const ctx = flipCanvas.getContext('2d') as CanvasRenderingContext2D;\n\n ctx.clearRect(0, 0, width, height);\n ctx.fillStyle = 'rgba(255,255,255,0.0039)';\n ctx.fillRect(0, 0, width, height);\n ctx.drawImage(bitmap, 0, 0);\n\n return flipCanvas;\n }\n\n texImage2DData (gl: GLContext, target: GLenum, level: number, internalformat: GLenum, format: GLenum, type: GLenum, data: { data: TypedArray, width: number, height: number }): vec2 {\n const bufferView = data.data;\n // Uint8ClampedArray is incompatible in android\n const neoBuffer = type === gl.UNSIGNED_BYTE ? new Uint8Array(bufferView.buffer, bufferView.byteOffset, bufferView.byteLength / bufferView.BYTES_PER_ELEMENT) : bufferView;\n const channel = Math.round(neoBuffer.length / (data.width * data.height));\n\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, channel);\n gl.texImage2D(target, level, internalformat, data.width, data.height, 0, format, type, neoBuffer);\n if (gl.getError()) {\n consoleError('texImage2D failed');\n }\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, 4);\n\n return [data.width, data.height];\n }\n\n resizeImage (image: HTMLImageLike, targetWidth?: number, targetHeight?: number): HTMLCanvasElement | HTMLImageElement {\n const maxSize = this.renderer?.gpu.capability.maxTextureSize || 2048;\n\n if (this.renderer?.level === 2 && (image.width < maxSize && image.height < maxSize)) {\n return image as HTMLImageElement;\n }\n if (image) {\n const width = image.width;\n const height = image.height;\n const nw = Math.min(maxSize, targetWidth || nearestPowerOfTwo(width));\n const nh = Math.min(maxSize, targetHeight || nearestPowerOfTwo(height));\n\n if (nh !== height || nw !== width) {\n const canvas = document.createElement('canvas');\n\n canvas.width = nw;\n canvas.height = nh;\n const ctx = canvas.getContext('2d') as CanvasRenderingContext2D;\n\n ctx.drawImage(image, 0, 0, image.width, image.height, 0, 0, nw, nh);\n consoleWarn(`image resize from ${width}x${height} to ${nw}x${nh}`);\n\n return canvas;\n }\n }\n\n return image as HTMLImageElement;\n }\n\n offloadData () {\n const renderer = this.renderer;\n const target = this.target;\n\n if (renderer && this.glHandle) {\n const gl = renderer.gl;\n\n renderer.state.bindTexture(target, this.glHandle);\n const data = new Uint8Array([255]);\n const info = this.gpuInfo;\n\n info[3] = [[1, 1]];\n info[0] = gl.LUMINANCE;\n info[1] = gl.UNSIGNED_BYTE;\n info[2] = target;\n if (target === gl.TEXTURE_2D) {\n gl.texImage2D(target, 0, gl.LUMINANCE, 1, 1, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, data);\n\n } else if (target === gl.TEXTURE_CUBE_MAP) {\n const faces = [\n gl.TEXTURE_CUBE_MAP_NEGATIVE_X,\n gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,\n gl.TEXTURE_CUBE_MAP_NEGATIVE_Z,\n gl.TEXTURE_CUBE_MAP_POSITIVE_X,\n gl.TEXTURE_CUBE_MAP_POSITIVE_Y,\n gl.TEXTURE_CUBE_MAP_POSITIVE_Z,\n ];\n\n for (let i = 0; i < faces.length; i++) {\n gl.texImage2D(faces[i], 0, gl.LUMINANCE, 1, 1, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, data);\n }\n }\n //rewrite mipmap\n gl.generateMipmap(target);\n this.width = this.height = 1;\n }\n }\n\n destroy (): void {\n if (this.renderer) {\n this.renderer.deleteGLTexture(this);\n //@ts-expect-error safe to assign\n this.renderer = this.options = this.glHandle = null;\n\n this.update = this.destroy = this.errorLog;\n }\n }\n\n _assignRenderer (renderer: GLGPURenderer): void {\n throw new Error('Method not implemented.');\n }\n\n}\n\nexport function nearestPowerOfTwo (value: number): number {\n return 2 ** Math.round(Math.log(value) / Math.LN2);\n}\n\nexport function isPowerOfTwo (value: number) {\n return (value & (value - 1)) === 0 && value !== 0;\n}\n\nconst FORMAT_HALF_FLOAT = {\n [constants.RGBA]: 34842, //RGBA16F\n [constants.RGB]: 34843, //RGB16F\n [constants.ALPHA]: 33325, //R16F\n [constants.RED]: 33325, //R16F\n [constants.LUMINANCE_ALPHA]: 33327, //RG16F\n [constants.LUMINANCE]: 33325,\n};\nconst FORMAT_FLOAT = {\n [constants.RGBA]: 34836, //RGBA32F\n [constants.RGB]: 34837, //RGB32F\n [constants.ALPHA]: 33326, //R32F\n [constants.RED]: 33326, //R32F\n [constants.LUMINANCE_ALPHA]: 33328, //RG32F,\n [constants.LUMINANCE]: 33326, //R32F\n};\n","import { GLGPUBuffer } from './GLGPUBuffer';\nimport { WebGLState } from './WebGLState';\nimport { GLShaderLibrary } from './GLShaderLibrary';\nimport type { GPURenderer, RendererExtensions } from '../../types';\nimport type { GPUBufferOptions } from '../../types/GPUBuffer';\nimport type { RenderFrame, RenderFrameOptions } from '../../types/RenderFrame';\nimport { GLGPUCapability } from './GLGPUCapability';\nimport { GLTexture } from './GLTexture';\nimport { arrAdd, arrRemove } from '../common/utils';\nimport { TextureSourceType } from '../../types/Texture';\nimport type { GLRenderBuffer } from './GLRenderBuffer';\nimport type { GLFrameBuffer } from './GLFrameBuffer';\nimport { consoleError } from '../common/console';\n\nconst GL_LOST_EVENT = 'webglcontextlost';\n\nexport class GLGPURenderer implements GPURenderer {\n readonly gl: WebGLRenderingContext | WebGL2RenderingContext;\n readonly level: number;\n readonly gpu: GLGPUCapability;\n readonly state: WebGLState;\n readonly shaderLibrary: GLShaderLibrary;\n readonly emptyTexture2D: GLTexture;\n readonly emptyTextureCube: GLTexture;\n\n readonly _buffers: GLGPUBuffer[];\n readonly _textures: GLTexture[];\n readonly _renderBuffers: GLRenderBuffer[];\n readonly _frameBuffers: GLFrameBuffer[];\n readonly _vaos: WebGLVertexArrayObject[];\n private _sourceFbo!: WebGLFramebuffer | null;\n private _targetFbo!: WebGLFramebuffer | null;\n private _isDestroyed = false;\n extension: RendererExtensions = {};\n\n constructor (gl: WebGLRenderingContext | WebGL2RenderingContext) {\n this.gl = gl;\n this.state = new WebGLState(gl);\n this.level = typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext ? 2 : 1;\n this._buffers = [];\n this._textures = [];\n this._vaos = [];\n this._renderBuffers = [];\n this._frameBuffers = [];\n this.shaderLibrary = new GLShaderLibrary(this);\n this.gpu = new GLGPUCapability({ gl });\n const d = { width: 1, height: 1, data: new Uint8Array([255]) };\n\n this.emptyTexture2D = new GLTexture({\n data: d,\n sourceType: TextureSourceType.data,\n format: gl.LUMINANCE,\n internalFormat: gl.LUMINANCE,\n type: gl.UNSIGNED_BYTE,\n }, this);\n this.emptyTextureCube = new GLTexture({\n target: gl.TEXTURE_CUBE_MAP,\n cube: [d, d, d, d, d, d],\n sourceType: TextureSourceType.data,\n format: gl.LUMINANCE,\n internalFormat: gl.LUMINANCE,\n type: gl.UNSIGNED_BYTE,\n }, this);\n this.bindVertexArray = this.level === 2 ? this._bindVertexArray : this._bindVertexArrayOES;\n if (gl.canvas) {\n gl.canvas.addEventListener(GL_LOST_EVENT, this.onContextLose);\n }\n }\n\n requestAnimationFrame (cb: FrameRequestCallback): number {\n return window.requestAnimationFrame(cb);\n }\n cancelAnimationFrame (id: number): void {\n return window.cancelAnimationFrame(id);\n }\n\n get isDestroyed () {\n return this._isDestroyed;\n }\n\n onContextLose = (e: Event) => {\n consoleError('gl lost, destroy renderer by default', e.target);\n this.destroy();\n if (e.target) {\n e.target.removeEventListener(GL_LOST_EVENT, this.onContextLose);\n }\n };\n\n copy2 (source: GLTexture, target: GLTexture) {\n const gl = this.gl as WebGL2RenderingContext;\n\n if (gl) {\n if (!this._sourceFbo) {\n this._sourceFbo = gl.createFramebuffer();\n }\n if (!this._targetFbo) {\n this._targetFbo = gl.createFramebuffer();\n }\n const state = this.state;\n const COLOR_ATTACHMENT0 = gl.COLOR_ATTACHMENT0;\n\n state.bindFramebuffer(gl.FRAMEBUFFER, this._sourceFbo);\n gl.framebufferTexture2D(gl.FRAMEBUFFER, COLOR_ATTACHMENT0, gl.TEXTURE_2D, source.glHandle as GLTexture, 0);\n state.bindFramebuffer(gl.FRAMEBUFFER, this._targetFbo);\n gl.framebufferTexture2D(gl.FRAMEBUFFER, COLOR_ATTACHMENT0, gl.TEXTURE_2D, target.glHandle as GLTexture, 0);\n state.bindFramebuffer(gl.READ_FRAMEBUFFER, this._sourceFbo);\n state.bindFramebuffer(gl.DRAW_FRAMEBUFFER, this._targetFbo);\n const filter = source.width === source.height && target.width == target.height ? gl.NEAREST : gl.LINEAR;\n\n gl.blitFramebuffer(0, 0, source.width, source.height, 0, 0, target.width, target.height, gl.COLOR_BUFFER_BIT, filter);\n state.bindFramebuffer(gl.FRAMEBUFFER, null);\n state.bindFramebuffer(gl.READ_FRAMEBUFFER, null);\n state.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null);\n }\n }\n\n resetColorAttachments (rp: GLFrameBuffer, colors: GLTexture[]) {\n rp.bind();\n rp.resetColorTextures(colors);\n }\n\n createGLRenderBuffer (renderbuffer: GLRenderBuffer): WebGLRenderbuffer | null {\n const rb = this.gl.createRenderbuffer();\n\n if (rb) {\n arrAdd(this._renderBuffers, renderbuffer);\n }\n\n return rb;\n }\n\n createPipeline (options?: RenderFrameOptions): RenderFrame {\n throw new Error('Method not implemented.');\n }\n\n createBuffer (options: GPUBufferOptions): GLGPUBuffer {\n return new GLGPUBuffer(options, this);\n }\n\n resize (width: number, height: number): void {\n const gl = this.gl;\n\n if (gl && gl.drawingBufferWidth !== width || gl.drawingBufferHeight !== height) {\n gl.canvas.width = width;\n gl.canvas.height = height;\n gl.viewport(0, 0, width, height);\n this._frameBuffers.forEach(frameBuffer => {\n const viewport = frameBuffer.viewport;\n\n if (!frameBuffer.isCustomViewport) {\n frameBuffer.resize(viewport[0], viewport[1], width * frameBuffer.viewportScale, height * frameBuffer.viewportScale);\n }\n });\n }\n }\n\n _assignInspectorName (obj: any, name?: string, id?: string) {\n if (name) {\n obj.__SPECTOR_Metadata = { name };\n if (obj.__SPECTOR_Object_TAG) {\n obj.__SPECTOR_Object_TAG.displayText = name;\n if (id) {\n obj.__SPECTOR_Object_TAG.id = id;\n }\n } else {\n obj.__SPECTOR_Object_TAG = {\n displayText: name,\n id: '',\n };\n }\n }\n }\n\n createGLFrameBuffer (frameBuffer: GLFrameBuffer, name?: string): WebGLFramebuffer | null {\n const fbo = this.gl.createFramebuffer();\n\n if (fbo) {\n arrAdd(this._frameBuffers, frameBuffer);\n this._assignInspectorName(fbo, name, name);\n }\n\n return fbo;\n }\n\n createGLTexture (texture: GLTexture, name?: string): WebGLTexture | null {\n const tex = this.gl.createTexture();\n\n if (tex) {\n arrAdd(this._textures, texture);\n this._assignInspectorName(tex, name);\n }\n\n return tex;\n }\n\n createGLBuffer (gpuBuffer: GLGPUBuffer, name?: string): WebGLBuffer | null {\n const buffer = this.gl.createBuffer();\n\n if (buffer) {\n arrAdd(this._buffers, gpuBuffer);\n this._assignInspectorName(buffer, name);\n }\n\n return buffer;\n }\n\n deleteGLTexture (texture: GLTexture) {\n if (texture.glHandle && !this._isDestroyed) {\n this.gl.deleteTexture(texture.glHandle);\n arrRemove(this._textures, texture);\n //@ts-expect-error safe to assign\n delete texture.glHandle;\n }\n }\n\n deleteGPUBuffer (buffer: GLGPUBuffer | null) {\n if (buffer && !this._isDestroyed) {\n arrRemove(this._buffers, buffer);\n const handle = buffer.glBuffer;\n\n this.gl.deleteBuffer(handle);\n if (handle) {\n //@ts-expect-error safe to assign\n handle._isDestroyed = true;\n }\n //@ts-expect-error safe to assign\n delete buffer.glBuffer;\n }\n }\n\n deleteGLFrameBuffer (frameBuffer: GLFrameBuffer) {\n if (frameBuffer && !this._isDestroyed) {\n const gl = this.gl;\n\n gl.deleteFramebuffer(frameBuffer.fbo!);\n gl.deleteFramebuffer(frameBuffer.multisampleFbo!);\n frameBuffer.multisampleRbs.forEach(rb=>rb.destroy());\n arrRemove(this._frameBuffers, frameBuffer);\n delete frameBuffer.fbo;\n }\n }\n\n deleteGLRenderBuffer (renderbuffer: GLRenderBuffer) {\n if (renderbuffer && !this._isDestroyed) {\n this.gl.deleteRenderbuffer(renderbuffer.glHandle);\n arrRemove(this._renderBuffers, renderbuffer);\n //@ts-expect-error safe to assign\n delete renderbuffer.glHandle;\n }\n }\n\n createVertexArray (name?: string): WebGLVertexArrayObject | undefined {\n let vao;\n\n if (this.level === 2) {\n vao = (this.gl as WebGL2RenderingContext).createVertexArray() as WebGLVertexArrayObject;\n }\n if (!vao) {\n vao = this.gpu.vaoExt?.createVertexArrayOES();\n }\n if (vao) {\n arrAdd(this._vaos, vao);\n this._assignInspectorName(vao, name);\n }\n\n return vao;\n }\n\n _bindVertexArray (vao: WebGLVertexArrayObject | null) {\n (this.gl as WebGL2RenderingContext).bindVertexArray(vao || null);\n }\n\n _bindVertexArrayOES (vao: WebGLVertexArrayObject | null) {\n this.gpu.vaoExt?.bindVertexArrayOES(vao as WebGLVertexArrayObjectOES);\n }\n\n bindVertexArray (vao: WebGLVertexArrayObject | null) {\n throw Error('xxx');\n }\n\n deleteVertexArray (vao: WebGLVertexArrayObject) {\n if (!this._isDestroyed) {\n if (this.level === 2) {\n (this.gl as WebGL2RenderingContext).deleteVertexArray(vao);\n } else {\n this.gpu.vaoExt?.deleteVertexArrayOES(vao as WebGLVertexArrayObjectOES);\n }\n arrRemove(this._vaos, vao);\n }\n }\n\n destroy (haltGL?: boolean) {\n const gl = this.gl;\n\n if (gl) {\n gl.deleteFramebuffer(this._sourceFbo);\n gl.deleteFramebuffer(this._targetFbo);\n this._buffers.forEach(buffer => this.deleteGPUBuffer(buffer));\n this._buffers.length = 0;\n this.state.destroy();\n this.shaderLibrary.destroy();\n this._vaos.forEach(vao => this.deleteVertexArray(vao));\n this.emptyTexture2D.destroy();\n this.emptyTextureCube.destroy();\n this._vaos.length = 0;\n this._frameBuffers.forEach(fb => this.deleteGLFrameBuffer(fb));\n this._frameBuffers.length = 0;\n this._renderBuffers.forEach(rb => this.deleteGLRenderBuffer(rb));\n this._renderBuffers.length = 0;\n this._textures.forEach(tex=>this.deleteGLTexture(tex));\n this._textures.length = 0;\n gl.canvas.removeEventListener(GL_LOST_EVENT, this.onContextLose);\n if (haltGL) {\n const ex = gl.getExtension('WEBGL_lose_context');\n\n ex?.loseContext();\n }\n // @ts-expect-error safe to assign\n this.emptyTexture2D = this.shaderLibrary = this.state = this.gpu = this.gl = null;\n // @ts-expect-error safe to assign\n this.emptyTextureCube = null;\n }\n this._isDestroyed = true;\n }\n\n get height () {\n return this.gl?.drawingBufferHeight;\n }\n\n get width () {\n return this.gl?.drawingBufferWidth;\n }\n\n get canvas () {\n return this.gl.canvas;\n }\n\n createRenderFrame (options?: RenderFrameOptions): RenderFrame {\n throw Error();\n }\n}\n","import type { GPUCapability } from '../../types/GPUCapability';\nimport { GLGPUCapability } from '../webgl/GLGPUCapability';\n\nlet g: GLGPUCapability;\n\nexport function getDefaultGPUCapability (): GPUCapability {\n if (!g) {\n g = new GLGPUCapability({});\n }\n\n return g;\n}\n","export interface Canvas {\n width: number,\n height: number,\n addEventListener(name: string, handler: Function): void,\n\n removeEventListener(name: string, handler: Function): void,\n\n}\n\nexport class CanvasEmpty implements Canvas {\n width = 0;\n height = 0;\n style = {};\n addEventListener (name: string, handler: Function) {\n }\n\n removeEventListener (name: string, handler: Function) {\n }\n}\n","import type { ResourceInternal, ResourcePlatform } from './ResourceInternal';\nimport type { GPUBufferInternal, GPUBufferInternalOptions } from './GPUBufferInternal';\nimport type { GeometryInternal, GeometryInternalOptions } from './GeometryInternal';\nimport type { ShaderLibraryInternal } from './ShaderLibraryInternal';\nimport type { DataBlockInternal, DataBlockInternalOptions } from './DataBlockInternal';\nimport type { MaterialInternal, MaterialInternalOptions } from './MaterialInternal';\nimport type { MeshInternal, MeshInternalOptions } from './MeshInternal';\nimport type { RenderPassInternal, RenderPassOptionsInternal } from './RenderPassInternal';\nimport type { RenderFrameInternal, RenderFrameInternalOptions } from './RenderFrameInternal';\nimport type { GPUCapability } from '../GPUCapability';\nimport type { TextureInternal, TextureInternalConstructOptions } from './TextureInternal';\nimport type { AndGLContext } from './AndGLContext';\nimport type { MetalInternal } from './MetalInternal';\n\n/**\n * renderer 内部创建的对象,用来统计信息,排查资源泄漏的问题\n */\nexport interface InternalResInfo {\n buffer: number,\n geometry: number,\n material: number,\n texture: number,\n dataBlock: number,\n mesh: number,\n renderPass: number,\n frame: number,\n}\n\nexport interface RendererInternalCompleteInfo {\n //gpu耗时,单位ms\n gpuTime?: number,\n //渲染了多少个frame\n frame: number,\n //cpu耗时\n cpuTime?: number,\n}\n\nexport enum RendererLostReason {\n unknown = 0,\n removeByParent = 1,\n glContextLost = 2,\n}\n\nexport abstract class RendererInternal implements ResourceInternal {\n readonly isDestroyed: boolean;\n readonly platform: ResourcePlatform;\n readonly gpu: GPUCapability;\n readonly shaderLibrary: ShaderLibraryInternal;\n readonly width: number;\n readonly height: number;\n /**\n * 用于Android的GL上下文, 用于测试, 不会在RI中使用\n */\n readonly gl?: AndGLContext;\n\n //todo lilong\n /**\n * metal相关设置\n */\n readonly metal?: MetalInternal;\n\n abstract destroy (): void;\n\n /**\n * 需要进行重新渲染\n */\n abstract invalid (): void;\n\n abstract createBuffer (options: GPUBufferInternalOptions): GPUBufferInternal;\n\n abstract createGeometry (options: GeometryInternalOptions): GeometryInternal;\n\n abstract createDataBlock (options: DataBlockInternalOptions): DataBlockInternal;\n\n abstract createMaterial (options: MaterialInternalOptions): MaterialInternal;\n\n abstract createMesh (options: MeshInternalOptions): MeshInternal;\n\n abstract createRenderPass (options: RenderPassOptionsInternal): RenderPassInternal;\n\n abstract createRenderFrame (options: RenderFrameInternalOptions): RenderFrameInternal;\n\n abstract createTexture (options: TextureInternalConstructOptions): TextureInternal;\n\n abstract getResourceInfo (): InternalResInfo;\n\n abstract requestAnimationFrame (callback: FrameRequestCallback): number;\n\n abstract cancelAnimationFrame (id: number): void;\n\n /**\n * 当view被从客户端移除时,会触发此回调\n * 如果丢失GL Context也会触发此函数\n * 当此函数发生时,需要立刻销毁Renderer对象\n * 如果renderer已经被销毁了,这个回调不会被调用\n * @param callback\n */\n abstract setRendererLostCallback (callback: (reason: RendererLostReason) => void): void;\n\n /**\n * 下一帧渲染完成后的回调,在调用removeRenderCompleteCallback前,不需要重复注册\n */\n abstract addRenderCompleteCallback (callback: (info: RendererInternalCompleteInfo) => void): number;\n\n abstract removeRenderCompleteCallback (id: number): void;\n /**\n * 获取错误信息,目前支持最大获取5条,\n * 每次调用此函数后,清空错误队列\n */\n abstract getErrors (): string[];\n\n abstract resize (width: number, height: number): void;\n}\n\n","/**\n * 客户端创建对象,iOS和android\n */\nexport enum ResourcePlatform {\n iOS = 1,\n android = 2\n}\n\nexport interface ResourceInternal {\n readonly isDestroyed: boolean,\n destroy(): void,\n}\n","import type { ImageBitmapCallback, ImageBitmapConstructor } from './ImageBitmapInternal';\nimport type { TypedArray } from '../type';\nimport type { GPUCapability } from '../GPUCapability';\nimport type { PredyResizeTemplate, SDFImageOptions, SDFImage } from '@predy-js/specification';\nimport type { ImageBitmapInternal } from './ImageBitmapInternal';\nexport interface PredyRequestOptions {\n url: string,\n //用于测试缓存,生产中不要使用\n disableCache?: boolean,\n //默认5S\n timeout?: number,\n\n responseType?: 'text' | 'arraybuffer',\n\n //使用系统网络库(仅用于试验)\n useSystemNetwork?: boolean,\n}\nexport enum PredyResourceCacheStatus {\n noCache = 0, // 没有缓存,走网络请求\n cached = 1, // 命中缓存,如果请求同一个url,在关闭APP之前,一定会命中缓存,关闭APP后,清理时间由系统决定\n preloaded = 2, // 命中预推\n}\n\nexport interface PredyRequestResponse {\n data: ArrayBuffer | string,\n cacheStatus: PredyResourceCacheStatus,\n time: number,\n}\n\nexport type PredyRequestCallback = (err: string | undefined, res: PredyRequestResponse) => void;\n\nexport interface PredyNativeInternal {\n webpDisabled?: boolean,\n\n createImageBitmap (data: TypedArray | string, //图片文件的数据\n options: ImageBitmapConstructor, callback: ImageBitmapCallback): void,\n\n getDefaultGPUCapability (): GPUCapability,\n\n requestWithCache (options: PredyRequestOptions, callback: PredyRequestCallback): void,\n\n /**\n * decode utf8 text from data\n * @param data\n */\n decodeText(data: Uint8Array): string,\n /**\n * 将图片绘制到画布上,同时替换文案,绘制的顺序如下\n * 创建template.size尺寸的画布, 接下来的绘制均应用 template.offset\n * 将images绘制到画布上,images的尺寸由image.frame决定\n * 将数据模板content绘制到画布上,使用variables替换文案\n * @param template\n */\n renderImageTemplate (template: PredyResizeTemplate): ImageBitmapInternal,\n\n /**\n * 异步绘制图片的模板\n * @param options\n * @param callback 如果传入callback就是异步绘制,否则会直接返回结果\n */\n generateSDFImage (options: SDFImageOptions, callback?: renderSDFImageCallback): SDFImage | undefined,\n\n /**\n * 下载并且执行脚本文件,此方法会缓存https的脚本内容\n * 对于http的请求(开发环境),每次都重新请求\n * @param url\n * @param callback\n */\n evaluateScriptURL (url: string, callback: (err: Error, result: any) => void): void,\n}\n\ntype renderSDFImageCallback = (img: SDFImage) => void;\n","import type {\n RenderPassStorageObject,\n RenderPassAttachmentStorageType,\n} from '../../types/RenderPass';\nimport type { GLGPURenderer } from './GLGPURenderer';\nimport { consoleError } from '../common/console';\n\ninterface GLRenderBufferOptions {\n storageType: RenderPassAttachmentStorageType,\n format: GLenum,\n attachment: GLenum,\n multisample?: number,\n}\n\nexport class GLRenderBuffer implements RenderPassStorageObject {\n readonly renderer: GLGPURenderer;\n readonly storageType: RenderPassAttachmentStorageType;\n readonly internalFormat: GLenum;\n readonly glHandle: WebGLRenderbuffer;\n readonly size: [x: number, y: number];\n readonly ready!: boolean;\n readonly format: GLenum;\n readonly attachment: GLenum;\n readonly multiSample: number;\n\n constructor (renderer: GLGPURenderer, options: GLRenderBufferOptions) {\n this.storageType = options.storageType;\n this.renderer = renderer;\n this.glHandle = renderer.createGLRenderBuffer(this) as WebGLRenderbuffer;\n this.internalFormat = this.format = options.format;\n this.attachment = options.attachment;\n this.size = [0, 0];\n this.multiSample = options.multisample ?? 0;\n }\n\n setSize (width: number, height: number): GLRenderBuffer {\n if (width !== this.size[0] || height !== this.size[1]) {\n const internalFormat = this.internalFormat;\n const state = this.renderer.state;\n const gl = this.renderer.gl;\n\n state.bindRenderBuffer(gl.RENDERBUFFER, this.glHandle);\n if (width && height) {\n gl.renderbufferStorage(gl.RENDERBUFFER, internalFormat, this.size[0] = width, this.size[1] = height);\n if (this.multiSample > 1) {\n const if2 = internalFormat === gl.DEPTH_STENCIL ? (gl as WebGL2RenderingContext).DEPTH24_STENCIL8 : internalFormat;\n\n (gl as WebGL2RenderingContext).renderbufferStorageMultisample(gl.RENDERBUFFER, this.multiSample, if2, width, height);\n }\n } else {\n consoleError(`invalid render buffer size ${width}x${height}`);\n }\n }\n\n return this;\n }\n\n destroy () {\n if (this.renderer) {\n this.renderer.deleteGLRenderBuffer(this);\n //@ts-expect-error safe to assign\n this.renderer = this.glHandle = this.ready = null;\n }\n }\n}\n","import type { GLGPURenderer } from './GLGPURenderer';\nimport type {\n RenderPassDepthStencilAttachmentOptions,\n RenderPassStorageObject,\n RenderPassStoreAction,\n} from '../../types/RenderPass';\nimport {\n RenderPassAttachmentStorageType,\n RenderPassDestroyAttachmentType,\n TextureStoreAction,\n} from '../../types/RenderPass';\nimport { GLRenderBuffer } from './GLRenderBuffer';\nimport { constants } from './constants';\nimport { GLTexture } from './GLTexture';\nimport { TextureSourceType } from '../../types/Texture';\nimport { arrAdd, forEach } from '../common/utils';\nimport type { MarsTexture } from '../render/MarsTexture';\n\nexport interface GLFrameBufferOptions {\n attachments: GLTexture[],\n depthStencilAttachment?: RenderPassDepthStencilAttachmentOptions,\n isCustomViewport?: boolean,\n viewport: [x: number, y: number, width: number, height: number],\n viewportScale?: number,\n storeAction: RenderPassStoreAction,\n name?: string,\n multisample?: number,\n}\n\nlet seed = 1;\n\nexport class GLFrameBuffer {\n\n readonly renderer: GLGPURenderer;\n\n readonly viewport: [x: number, y: number, width: number, height: number];\n\n readonly ready!: boolean;\n\n readonly depthStencilStorageType: RenderPassAttachmentStorageType;\n\n readonly name: string;\n\n externalStorage!: boolean;\n\n storeAction: RenderPassStoreAction;\n\n storeInvalidAttachments?: GLenum[];\n\n isCustomViewport: boolean;\n\n depthStencilRenderBuffer?: GLRenderBuffer;\n\n depthTexture?: GLTexture;\n\n stencilTexture?: GLTexture;\n\n colorTextures!: GLTexture[];\n\n fbo?: WebGLFramebuffer;\n\n multisampleFbo?: WebGLFramebuffer;\n\n multisampleRbs: GLRenderBuffer[] = [];\n\n viewportScale: number;\n\n readonly multisample: number;\n\n readonly _attachmentHandles: WebGLTexture[];\n\n constructor (options: GLFrameBufferOptions, renderer: GLGPURenderer) {\n this.renderer = renderer;\n this.depthStencilStorageType = options.depthStencilAttachment?.storageType || RenderPassAttachmentStorageType.none;\n this.viewport = options.viewport;\n this.isCustomViewport = !!options.isCustomViewport;\n this.viewportScale = options.viewportScale || 1;\n this.name = options.name || ('GLFrameBuffer' + seed++);\n this.storeAction = options.storeAction;\n this._attachmentHandles = [];\n this.multisample = renderer.level > 1 ? options.multisample || 0 : 0;\n this.checkOptions(options);\n }\n\n get stencilStorage (): RenderPassStorageObject | undefined {\n const storageType = this.depthStencilStorageType;\n\n if (storageType !== RenderPassAttachmentStorageType.depth_16_opaque) {\n return this.depthStencilRenderBuffer;\n }\n }\n\n get depthStorage (): RenderPassStorageObject | undefined {\n if (this.depthStencilStorageType !== RenderPassAttachmentStorageType.stencil_8_opaque) {\n return this.depthStencilRenderBuffer;\n }\n }\n\n _getHandles () {\n const handles = this._attachmentHandles;\n\n handles.length = 0;\n this.colorTextures.forEach(c => arrAdd(handles, c.glHandle));\n if (this.stencilTexture) {\n arrAdd(handles, this.stencilTexture.glHandle);\n }\n if (this.depthTexture) {\n arrAdd(handles, this.depthTexture.glHandle);\n }\n }\n\n checkOptions (options: GLFrameBufferOptions) {\n const renderer = this.renderer;\n const capability = renderer.gpu.capability;\n const depthStencilAttachment = options.depthStencilAttachment || { storageType: RenderPassAttachmentStorageType.none };\n const willUseFbo = options.attachments.length > 0;\n const willMultisample = this.multisample > 1 ;\n\n this.externalStorage = false;\n let separateDepthStencil = true;\n\n if (options.attachments.length > 1 && !capability.drawBuffers) {\n throw Error('multiple color attachments not support');\n }\n const optDepthStencilTex: GLTexture | undefined = (options.depthStencilAttachment?.texture as MarsTexture)?.internal;\n\n const readableDepthStencilTextures = capability.readableDepthStencilTextures;\n\n this.colorTextures = options.attachments.slice();\n if (!willUseFbo && depthStencilAttachment.storageType !== RenderPassAttachmentStorageType.none) {\n throw Error('use depth stencil attachment without color attachments');\n }\n if (willUseFbo) {\n this.fbo = renderer.createGLFrameBuffer(this, this.name)!;\n }\n if (willMultisample) {\n this.multisampleFbo = renderer.createGLFrameBuffer(this, this.name + '_multisample')!;\n }\n const storageType = depthStencilAttachment.storageType;\n\n if (storageType === RenderPassAttachmentStorageType.depth_stencil_opaque) {\n if (depthStencilAttachment.storage) {\n if (depthStencilAttachment.storage instanceof GLRenderBuffer) {\n if (this.multisample !== depthStencilAttachment.storage.multiSample && this.multisample > 1) {\n throw Error('fbo multisample not eql depth stencil attachment');\n }\n this.depthStencilRenderBuffer = depthStencilAttachment.storage;\n this.externalStorage = true;\n } else {\n throw Error('invalid depth stencil attachment storage');\n }\n } else {\n this.depthStencilRenderBuffer = new GLRenderBuffer(renderer, {\n format: constants.DEPTH_STENCIL,\n attachment: constants.DEPTH_STENCIL_ATTACHMENT,\n multisample:this.multisample,\n storageType,\n });\n }\n separateDepthStencil = false;\n } else if (storageType === RenderPassAttachmentStorageType.depth_16_opaque) {\n if (depthStencilAttachment.storage) {\n if (this.multisample !== depthStencilAttachment.storage.multiSample && this.multisample > 1) {\n throw Error('fbo multisample not eql depth attachment');\n }\n if (depthStencilAttachment.storage instanceof GLRenderBuffer) {\n this.depthStencilRenderBuffer = depthStencilAttachment.storage;\n this.externalStorage = true;\n } else {\n throw Error('invalid depth attachment storage');\n }\n } else {\n this.depthStencilRenderBuffer = new GLRenderBuffer(renderer, {\n attachment: constants.DEPTH_ATTACHMENT,\n multisample:this.multisample,\n format: constants.DEPTH_COMPONENT16,\n storageType,\n });\n }\n } else if (storageType === RenderPassAttachmentStorageType.stencil_8_opaque) {\n if (depthStencilAttachment.storage) {\n if (depthStencilAttachment.storage instanceof GLRenderBuffer) {\n if (this.multisample !== depthStencilAttachment.storage.multiSample && this.multisample > 1) {\n throw Error('fbo multisample not eql stencil attachment');\n }\n this.depthStencilRenderBuffer = depthStencilAttachment.storage;\n this.externalStorage = true;\n } else {\n throw Error('invalid stencil attachment storage');\n }\n } else {\n this.depthStencilRenderBuffer = new GLRenderBuffer(renderer, {\n attachment: constants.STENCIL_ATTACHMENT,\n format: constants.STENCIL_INDEX8,\n multisample: this.multisample,\n storageType,\n });\n }\n } else if (storageType === RenderPassAttachmentStorageType.depth_16_texture) {\n if (!readableDepthStencilTextures) {\n throw Error('depth texture is not support in framebuffer');\n }\n this.depthTexture = optDepthStencilTex || new GLTexture({\n sourceType: TextureSourceType.framebuffer,\n format: constants.DEPTH_COMPONENT,\n internalFormat: renderer.gpu.internalFormatDepth16,\n type: constants.UNSIGNED_SHORT,\n name: `${this.name}##depthTex`,\n }, renderer);\n } else if (storageType === RenderPassAttachmentStorageType.depth_24_stencil_8_texture) {\n if (!readableDepthStencilTextures) {\n throw Error('depth stencil texture is not support in framebuffer');\n }\n this.depthTexture = this.stencilTexture = optDepthStencilTex || new GLTexture({\n sourceType: TextureSourceType.framebuffer,\n format: constants.DEPTH_STENCIL,\n internalFormat: renderer.gpu.internalFormatDepth24_stencil8,\n type: renderer.gpu.UNSIGNED_INT_24_8,\n name: `${this.name}##dpthStclTex`,\n }, renderer);\n separateDepthStencil = true;\n }\n this.storeInvalidAttachments = this.getStoreAttachments(this.storeAction, separateDepthStencil);\n this._getHandles();\n }\n\n getStoreAttachments (storeAction: RenderPassStoreAction, separateDepthStencil: boolean): GLenum[] | undefined {\n const gl = this.renderer.gl as WebGL2RenderingContext;\n const colorLen = this.colorTextures.length;\n\n if (storeAction && this.renderer.gpu.level == 2 && colorLen > 0) {\n const attachments: GLenum[] = [];\n\n if (storeAction.depthAction === TextureStoreAction.clear && this.depthStorage) {\n arrAdd(attachments, separateDepthStencil ? gl.DEPTH_ATTACHMENT : gl.DEPTH_STENCIL_ATTACHMENT);\n }\n if (storeAction.stencilAction === TextureStoreAction.clear && this.stencilStorage) {\n arrAdd(attachments, separateDepthStencil ? gl.STENCIL_ATTACHMENT : gl.DEPTH_STENCIL_ATTACHMENT);\n }\n if (storeAction.colorAction === TextureStoreAction.clear) {\n for (let i = 0; i < colorLen; i++) {\n arrAdd(attachments, (gl as unknown as Record<string, GLenum>)[`COLOR_ATTACHMENT${i}`]);\n }\n }\n\n return attachments;\n }\n }\n\n unbind () {\n const att = this.storeInvalidAttachments;\n\n this.resolveMultiSample();\n if (att && att.length) {\n const gl = this.renderer.gl as WebGL2RenderingContext;\n\n gl.invalidateFramebuffer(gl.FRAMEBUFFER, att);\n }\n const state = this.renderer.state;\n\n state.bindSystemFramebuffer();\n }\n\n bind () {\n const gl = this.renderer.gl;\n const state = this.renderer.state;\n const FRAMEBUFFER = gl.FRAMEBUFFER;\n const viewport = this.viewport;\n const multisampleFbo = this.multisampleFbo;\n\n if (multisampleFbo) {\n\n state.bindFramebuffer(FRAMEBUFFER, multisampleFbo);\n state.viewport(viewport[0], viewport[1], viewport[2], viewport[3]);\n } else if (this.fbo) {\n\n state.bindFramebuffer(FRAMEBUFFER, this.fbo);\n state.viewport(viewport[0], viewport[1], viewport[2], viewport[3]);\n const r = this.renderer.emptyTexture2D.glHandle;\n const handles = this._attachmentHandles;\n\n //in case frame texture loop\n forEach(state._textureUnitDict, function (t, unit) {\n if (t !== r && handles.includes(t as WebGLTexture)) {\n state.activeTexture(+unit);\n state.bindTexture(constants.TEXTURE_2D, r, true);\n }\n });\n }\n if (!this.ready) {\n const { depthStencilRenderBuffer, depthTexture, stencilTexture } = this;\n\n state.activeTexture(gl.TEXTURE0);\n if (depthStencilRenderBuffer) {\n depthStencilRenderBuffer.setSize(viewport[2], viewport[3]);\n gl.framebufferRenderbuffer(FRAMEBUFFER, depthStencilRenderBuffer.attachment, gl.RENDERBUFFER, depthStencilRenderBuffer.glHandle);\n } else if (depthTexture) {\n if (multisampleFbo) {\n let attachment = gl.DEPTH_ATTACHMENT;\n let format = gl.DEPTH_COMPONENT16;\n\n if (this.depthStencilStorageType === RenderPassAttachmentStorageType.depth_24_stencil_8_texture) {\n attachment = gl.DEPTH_STENCIL_ATTACHMENT;\n format = (gl as WebGL2RenderingContext).DEPTH24_STENCIL8;\n }\n const renderBuffer = new GLRenderBuffer(this.renderer, {\n storageType:this.depthStencilStorageType,\n attachment,\n format,\n multisample:this.multisample,\n });\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, multisampleFbo);\n this.multisampleRbs.push(renderBuffer);\n renderBuffer.setSize(viewport[2], viewport[3]);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, renderBuffer.glHandle);\n gl.bindFramebuffer(gl.FRAMEBUFFER, this.fbo!);\n }\n depthTexture.update({\n sourceType: TextureSourceType.framebuffer,\n data: { width: viewport[2], height: viewport[3] },\n });\n const attachment = depthTexture && stencilTexture ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;\n\n gl.framebufferTexture2D(FRAMEBUFFER, attachment, gl.TEXTURE_2D, depthTexture.glHandle as WebGLTexture, 0);\n }\n this.resetColorTextures(this.colorTextures);\n [multisampleFbo, this.fbo].forEach(function (fbo) {\n if (fbo) {\n gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);\n const status = gl.checkFramebufferStatus(FRAMEBUFFER);\n\n if (status !== gl.FRAMEBUFFER_COMPLETE) {\n const error = gl.getError();\n\n throw Error(`framebuffer failed status ${status} error:${error}`);\n }\n }\n });\n\n //@ts-expect-error safe to assign\n this.ready = true;\n }\n }\n\n resolveMultiSample () {\n const multisampleFbo = this.multisampleFbo;\n const fbo = this.fbo;\n\n if (multisampleFbo && fbo) {\n const gl = this.renderer.gl as WebGL2RenderingContext;\n\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, multisampleFbo);\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, fbo);\n const vp = this.viewport;\n let bit = gl.COLOR_BUFFER_BIT;\n\n if (this.depthTexture) {\n bit = bit | gl.DEPTH_BUFFER_BIT;\n }\n gl.blitFramebuffer(\n 0, 0, vp[2], vp[3], // Source region\n 0, 0, vp[2], vp[3], // Destination region\n bit, gl.LINEAR // Buffer mask and filter\n );\n gl.bindFramebuffer(gl.FRAMEBUFFER, multisampleFbo);\n }\n }\n\n resetColorTextures (colors?: GLTexture[]) {\n const gl: WebGLRenderingContext = this.renderer.gl;\n const gpu = this.renderer.gpu;\n const viewport = this.viewport;\n const data = { width: viewport[2], height: viewport[3] };\n const buffers: boolean[] = [];\n\n if (colors) {\n this.colorTextures = colors.slice();\n }\n this.renderer.state.activeTexture(gl.TEXTURE0);\n const multisampleFBO = this.multisampleFbo;\n\n this.colorTextures.forEach((tex, index) => {\n tex.update({ sourceType: TextureSourceType.framebuffer, data });\n if (multisampleFBO) {\n gl.bindFramebuffer(gl.FRAMEBUFFER, multisampleFBO);\n\n const renderBuffer = new GLRenderBuffer(this.renderer, {\n format:(gl as WebGL2RenderingContext).RGBA8,\n attachment: gl.COLOR_ATTACHMENT0 + index,\n storageType: RenderPassAttachmentStorageType.color,\n multisample:this.multisample,\n });\n\n this.multisampleRbs.push(renderBuffer);\n renderBuffer.setSize(tex.width, tex.height);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + index, gl.RENDERBUFFER, renderBuffer.glHandle);\n }\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, this.fbo!);\n gpu.framebufferTexture2D(gl, gl.FRAMEBUFFER, index, gl.TEXTURE_2D, tex.glHandle as WebGLTexture);\n buffers.push(true);\n });\n gpu.drawBuffers(gl, buffers);\n this._getHandles();\n }\n\n destroy (opt?: { depthStencilAttachment?: RenderPassDestroyAttachmentType }) {\n const renderer = this.renderer;\n\n if (renderer) {\n renderer.deleteGLFrameBuffer(this);\n delete this.fbo;\n const clearAttachment = opt?.depthStencilAttachment ? opt.depthStencilAttachment : RenderPassDestroyAttachmentType.force;\n\n if (clearAttachment === RenderPassDestroyAttachmentType.force || (clearAttachment === RenderPassDestroyAttachmentType.keepExternal && !this.externalStorage)) {\n this.depthStencilRenderBuffer?.destroy();\n this.depthTexture?.destroy();\n }\n //@ts-expect-error safe to assign\n this.renderer = this.depthStencilRenderBuffer = null;\n }\n }\n\n resize (x: number, y: number, width: number, height: number) {\n const vp = this.viewport;\n\n if (vp[0] !== x || vp[1] !== y || vp[2] !== width || vp[3] !== height) {\n //@ts-expect-error safe to assign\n this.viewport = [x, y, width, height];\n //@ts-expect-error safe to assign\n this.ready = false;\n this.bind();\n }\n }\n}\n","export interface RequestOptions {\n method?: 'get' | 'post',\n responseType?: 'json' | 'blob' | 'arraybuffer',\n data?: XMLHttpRequestBodyInit | null,\n}\n\n// const imageBitMapAvailable = typeof ImageBitmap === 'function' && typeof createImageBitmap == 'function';\nconst imageBitMapAvailable = false;//never use imagebitmap because its dark edge\n\nexport function requestAsync (url: string, options?: RequestOptions): Promise<any> {\n const opt: RequestOptions = options || {};\n\n return new Promise(function (resolve, reject) {\n const xhr = new XMLHttpRequest();\n\n xhr.responseType = opt.responseType || 'json';\n xhr.addEventListener('load', () => resolve(xhr.response));\n xhr.addEventListener('error', reject);\n xhr.open(opt.method || 'get', url);\n xhr.send(opt.data);\n });\n}\n\nexport function loadImageAsync (imgOrURL: string | HTMLImageElement | Blob, options?: { asImageBitMap?: boolean, revokeURL?: boolean }): Promise<HTMLImageElement | ImageBitmap> {\n let img: HTMLImageElement;\n let revoke = options?.revokeURL;\n\n if (typeof imgOrURL === 'string') {\n if (options?.asImageBitMap && imageBitMapAvailable) {\n return requestAsync(imgOrURL, { responseType: 'blob' }).then(blob => createImageBitmap(blob));\n }\n const src = imgOrURL;\n\n img = new Image();\n if (!/^data:/.test(src)) {\n img.crossOrigin = '*';\n }\n img.src = src;\n } else {\n img = imgOrURL as HTMLImageElement;\n if (options?.asImageBitMap && imageBitMapAvailable) {\n return createImageBitmap(img);\n }\n if (imgOrURL instanceof Blob) {\n img = new Image();\n img.src = URL.createObjectURL(imgOrURL);\n revoke = true;\n }\n }\n if (img.complete) {\n return Promise.resolve(img);\n }\n\n return new Promise(function (resolve, reject) {\n img.onload = () => {\n img.onload = null;\n if (revoke) {\n URL.revokeObjectURL(img.src);\n }\n\n return resolve(img);\n };\n img.onerror = err => {\n img.onerror = null;\n if (revoke) {\n URL.revokeObjectURL(img.src);\n }\n\n return reject(err);\n };\n });\n}\n","import type { TextureOptions, TypedArray } from '../../types';\nimport { TextureSourceType } from '../../types/Texture';\nimport { constants } from './constants';\nimport { consoleWarn } from '../common/console';\n\nconst HEADER_LEN = 12 + 13 * 4; // identifier + header elements (not including key value meta-data pairs)\nconst COMPRESSED_2D = 0; // uses a gl.compressedTexImage2D()\n//const COMPRESSED_3D = 1; // uses a gl.compressedTexImage3D()\nconst TEX_2D = 2; // uses a gl.texImage2D()\n\n//const TEX_3D = 3; // uses a gl.texImage3D()\nexport class KhronosTextureContainer {\n arrayBuffer: ArrayBuffer;\n baseOffset: number;\n glType: number;\n glTypeSize: number;\n glFormat: number;\n glInternalFormat: number;\n glBaseInternalFormat: number;\n pixelWidth: number;\n pixelHeight: number;\n loadType!: number;\n pixelDepth: number;\n numberOfArrayElements: number;\n numberOfFaces: number;\n numberOfMipmapLevels: number;\n bytesOfKeyValueData: number;\n\n constructor (arrayBuffer: ArrayBuffer, facesExpected: number, baseOffset = 0) {\n this.arrayBuffer = arrayBuffer;\n this.baseOffset = baseOffset;\n\n // Test that it is a ktx formatted file, based on the first 12 bytes, character representation is:\n // '´', 'K', 'T', 'X', ' ', '1', '1', 'ª', '\\r', '\\n', '\\x1A', '\\n'\n // 0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A\n const identifier = new Uint8Array(this.arrayBuffer, this.baseOffset, 12);\n\n if (\n identifier[0] !== 0xab ||\n identifier[1] !== 0x4b ||\n identifier[2] !== 0x54 ||\n identifier[3] !== 0x58 ||\n identifier[4] !== 0x20 ||\n identifier[5] !== 0x31 ||\n identifier[6] !== 0x31 ||\n identifier[7] !== 0xbb ||\n identifier[8] !== 0x0d ||\n identifier[9] !== 0x0a ||\n identifier[10] !== 0x1a ||\n identifier[11] !== 0x0a\n ) {\n throw Error('texture missing KTX identifier');\n }\n\n // load the reset of the header in native-ri 32 bit uint\n const dataSize = Uint32Array.BYTES_PER_ELEMENT;\n const headerDataView = new DataView(this.arrayBuffer, this.baseOffset + 12, 13 * dataSize);\n const endianness = headerDataView.getUint32(0, true);\n const littleEndian = endianness === 0x04030201;\n\n this.glType = headerDataView.getUint32(1 * dataSize, littleEndian); // must be 0 for compressed textures\n this.glTypeSize = headerDataView.getUint32(2 * dataSize, littleEndian); // must be 1 for compressed textures\n this.glFormat = headerDataView.getUint32(3 * dataSize, littleEndian); // must be 0 for compressed textures\n this.glInternalFormat = headerDataView.getUint32(4 * dataSize, littleEndian); // the value of arg passed to gl.compressedTexImage2D(,,x,,,,)\n this.glBaseInternalFormat = headerDataView.getUint32(5 * dataSize, littleEndian); // specify GL_RGB, GL_RGBA, GL_ALPHA, etc (un-compressed only)\n this.pixelWidth = headerDataView.getUint32(6 * dataSize, littleEndian); // level 0 value of arg passed to gl.compressedTexImage2D(,,,x,,,)\n this.pixelHeight = headerDataView.getUint32(7 * dataSize, littleEndian); // level 0 value of arg passed to gl.compressedTexImage2D(,,,,x,,)\n this.pixelDepth = headerDataView.getUint32(8 * dataSize, littleEndian); // level 0 value of arg passed to gl.compressedTexImage3D(,,,,,x,,)\n this.numberOfArrayElements = headerDataView.getUint32(9 * dataSize, littleEndian); // used for texture arrays\n this.numberOfFaces = headerDataView.getUint32(10 * dataSize, littleEndian); // used for cubemap textures, should either be 1 or 6\n this.numberOfMipmapLevels = headerDataView.getUint32(11 * dataSize, littleEndian); // number of levels; disregard possibility of 0 for compressed textures\n this.bytesOfKeyValueData = headerDataView.getUint32(12 * dataSize, littleEndian); // the amount of space after the header for meta-data\n\n // value of zero is an indication to generate mipmaps @ runtime. Not usually allowed for compressed, so disregard.\n this.numberOfMipmapLevels = Math.max(1, this.numberOfMipmapLevels);\n\n if (this.pixelHeight === 0 || this.pixelDepth !== 0) {\n consoleWarn('only 2D textures currently supported');\n\n return;\n }\n if (this.numberOfArrayElements !== 0) {\n consoleWarn('texture arrays not currently supported');\n\n return;\n }\n if (this.numberOfFaces !== facesExpected) {\n consoleWarn('number of faces expected' + facesExpected + ', but found ' + this.numberOfFaces);\n\n return;\n }\n // we now have a completely validated file, so could use existence of loadType as success\n // would need to make this more elaborate & adjust checks above to support more than one load type\n if (this.glType === 0) {\n this.loadType = COMPRESSED_2D;\n } else {\n this.loadType = TEX_2D;\n }\n }\n\n mipmaps (loadMipmaps: boolean): Array<{ data: TypedArray, width: number, height: number }> {\n const mipmaps: Array<{ data: TypedArray, width: number, height: number }> = [];\n\n // initialize width & height for level 1\n let dataOffset = HEADER_LEN + this.bytesOfKeyValueData;\n let width = this.pixelWidth;\n let height = this.pixelHeight;\n const mipmapCount = loadMipmaps ? this.numberOfMipmapLevels : 1;\n\n for (let level = 0; level < mipmapCount; level++) {\n const imageSize = new Int32Array(this.arrayBuffer, this.baseOffset + dataOffset, 1)[0]; // size per face, since not supporting array cubemaps\n\n for (let face = 0; face < this.numberOfFaces; face++) {\n const byteArray = new Uint8Array(this.arrayBuffer, this.baseOffset + dataOffset + 4, imageSize);\n\n mipmaps.push({\n data: byteArray,\n width,\n height,\n });\n\n dataOffset += imageSize + 4; // size of the image + 4 for the imageSize field\n dataOffset += 3 - ((imageSize + 3) % 4); // add padding for odd sized image\n }\n width = Math.max(1.0, width * 0.5);\n height = Math.max(1.0, height * 0.5);\n }\n\n return mipmaps;\n }\n}\n\nexport function getCompressedTextureOptions (data: ArrayBuffer): TextureOptions {\n const ktx = new KhronosTextureContainer(data, 1);\n const useMipmaps = ktx.numberOfMipmapLevels >= Math.floor(Math.log2(Math.max(ktx.pixelWidth, ktx.pixelHeight)) + 1);\n\n return {\n sourceType: TextureSourceType.compressed,\n type: ktx.glType,\n target: ktx.numberOfFaces === 6 ? constants.TEXTURE_CUBE_MAP : constants.TEXTURE_2D,\n internalFormat: ktx.glInternalFormat,\n format: ktx.glFormat,\n mipmaps: ktx.mipmaps(useMipmaps),\n };\n}\n","import type {\n Texture,\n Texture2DOptions,\n TextureConfigOptions,\n TextureCubeOptions,\n TextureCubeSourceURLMap,\n TextureFactory,\n TextureFactorySource2DBinaryMipmapsFrom,\n TextureFactorySource2DFrom,\n TextureFactorySource2DMipmapsFrom,\n TextureFactorySourceCubeBinaryMipmapsFrom,\n TextureFactorySourceCubeFrom,\n TextureFactorySourceCubeMipmapsFrom,\n TextureFactorySourceFrom,\n TextureOptions,\n TextureSourceCubeData,\n} from '../../types/Texture';\nimport {\n TextureSourceType,\n} from '../../types/Texture';\nimport { loadImageAsync, requestAsync } from '../common/request';\nimport { getCompressedTextureOptions } from '../webgl/KhronosTextureContainer';\nimport { isObj, isStr } from '../common/utils';\nimport { constants } from '../webgl/constants';\nimport { imageBitMapAvailable } from '../webgl/GLTexture';\nimport type { TypedArray, vec2 } from '../../types';\n\nconst loadOptions = { asImageBitMap: true };\n\nexport class MarsTextureFactory implements TextureFactory {\n reloadPending: { [key: string]: Promise<Texture> };\n\n constructor () {\n this.reloadPending = {};\n }\n\n loadMipmapImagesAsync (pointers: vec2[], bin: ArrayBuffer) {\n return Promise.all(pointers.map(function (pointer) {\n const blob = new Blob([new Uint8Array(bin, pointer[0], pointer[1])]);\n\n return loadImageAsync(blob, { asImageBitMap: true });\n }));\n }\n\n loadImageAsync (url: string | HTMLImageElement | Blob): Promise<HTMLImageElement | ImageBitmap> {\n return loadImageAsync(url, loadOptions);\n }\n\n requestBinaryAsync (url: string): Promise<ArrayBuffer> {\n return requestAsync(url, { responseType: 'arraybuffer' });\n }\n\n loadImageBinaryAsync (binary: ArrayBuffer | TypedArray | Blob, mime?: string): Promise<HTMLImageElement | ImageBitmap> {\n let blob = binary as Blob;\n\n if (!(binary instanceof Blob)) {\n blob = new Blob([binary], { type: mime || 'image/png' });\n }\n if (imageBitMapAvailable) {\n return createImageBitmap(blob);\n }\n const url = URL.createObjectURL(blob);\n\n return loadImageAsync(url, { revokeURL: true });\n }\n\n canOffloadTexture (texture: Texture): boolean {\n const data = texture.options.sourceFrom;\n\n if (data) {\n const type = data.type;\n\n if (type === TextureSourceType.compressed || type === TextureSourceType.image) {\n if ((data as TextureFactorySourceCubeFrom).target === constants.TEXTURE_CUBE_MAP) {\n return isObj((data as TextureFactorySourceCubeFrom).map);\n }\n\n return isStr((data as TextureFactorySource2DFrom).url, true);\n }\n if (type === TextureSourceType.mipmaps) {\n if ((data as TextureFactorySourceCubeBinaryMipmapsFrom).bin) {\n return (data as TextureFactorySourceCubeBinaryMipmapsFrom).mipmaps.length > 0;\n }\n if ((data as TextureFactorySourceCubeMipmapsFrom).target === constants.TEXTURE_CUBE_MAP) {\n return (data as TextureFactorySourceCubeMipmapsFrom).maps.every(map => isObj(map));\n }\n\n return (data as TextureFactorySource2DMipmapsFrom).urls.every(url => isStr(url, true));\n }\n }\n\n return false;\n }\n\n loadSourceAsync (sourceFrom: TextureFactorySourceFrom, config?: TextureConfigOptions): Promise<TextureOptions> {\n // cube without mipmap\n if ((sourceFrom as TextureFactorySourceCubeFrom).target === constants.TEXTURE_CUBE_MAP && sourceFrom.type !== TextureSourceType.mipmaps) {\n return this._loadCubeMapAsync((sourceFrom as TextureFactorySourceCubeFrom).map).then(function (cube) {\n return Object.assign({}, config, {\n sourceType: TextureSourceType.image,\n cube,\n sourceFrom: {\n type: TextureSourceType.image,\n map: Object.assign({}, (sourceFrom as TextureFactorySourceCubeFrom).map),\n target: constants.TEXTURE_CUBE_MAP,\n },\n target: constants.TEXTURE_CUBE_MAP,\n }) as TextureCubeOptions;\n }, catchError);\n } else if (sourceFrom.type === TextureSourceType.image) {\n // image without mipmap\n return this.loadImageAsync((sourceFrom as TextureFactorySource2DFrom).url).then(image => Object.assign({}, config, {\n image,\n sourceType: TextureSourceType.image,\n sourceFrom: {\n url: (sourceFrom as TextureFactorySource2DFrom).url,\n type: sourceFrom.type,\n target: constants.TEXTURE_2D,\n },\n }) as Texture2DOptions, catchError);\n } else if (sourceFrom.type === TextureSourceType.video) {\n return this._loadVideoAsync((sourceFrom).url).then(video => Object.assign({}, config, {\n video,\n sourceType: TextureSourceType.video,\n }) as Texture2DOptions, catchError);\n } else if (sourceFrom.type === TextureSourceType.compressed) {\n return this.requestBinaryAsync(sourceFrom.url).then(function (arrayBuffer: ArrayBuffer) {\n return Object.assign(getCompressedTextureOptions(arrayBuffer), config, {\n sourceFrom: { url: sourceFrom.url, type: TextureSourceType.compressed },\n });\n }, catchError);\n } else if (sourceFrom.type === TextureSourceType.mipmaps) {\n const target = sourceFrom.target;\n\n if ((sourceFrom as TextureFactorySourceCubeBinaryMipmapsFrom).bin) {\n return requestAsync((sourceFrom as TextureFactorySourceCubeBinaryMipmapsFrom).bin, { responseType: 'arraybuffer' })\n .then((data: ArrayBuffer): Promise<Array<ImageBitmap | HTMLImageElement> | Array<ImageBitmap | HTMLImageElement>[]> => {\n if (sourceFrom.target === constants.TEXTURE_CUBE_MAP) {\n const source = sourceFrom as TextureFactorySourceCubeBinaryMipmapsFrom;\n\n return Promise.all(source.mipmaps.map(mipmaps => this.loadMipmapImagesAsync(mipmaps, data)));\n } else {\n const source = sourceFrom as TextureFactorySource2DBinaryMipmapsFrom;\n\n return this.loadMipmapImagesAsync(source.mipmaps, data);\n }\n }).then(function (mipmaps) {\n const target = sourceFrom.target || constants.TEXTURE_2D;\n const mipmapsSource = (sourceFrom as TextureFactorySourceCubeBinaryMipmapsFrom).mipmaps;\n const source = {\n mipmaps,\n target,\n sourceType: TextureSourceType.mipmaps,\n sourceFrom: {\n bin: (sourceFrom as TextureFactorySourceCubeBinaryMipmapsFrom).bin,\n mipmaps: target === constants.TEXTURE_2D ? mipmapsSource.slice() : mipmapsSource.map(s => s.slice()),\n target,\n type: TextureSourceType.mipmaps,\n },\n } as TextureOptions;\n\n return Object.assign({}, config, source);\n });\n }\n if (target === constants.TEXTURE_2D || !target) {\n const urls = (sourceFrom as TextureFactorySource2DMipmapsFrom).urls;\n\n return Promise.all(urls.map(url => this.loadImageAsync(url))).then(mipmaps => {\n return Object.assign({}, config, {\n target: constants.TEXTURE_2D,\n sourceType: TextureSourceType.mipmaps,\n mipmaps,\n sourceFrom: {\n type: sourceFrom.type,\n urls: urls.slice(),\n target: constants.TEXTURE_2D,\n },\n }) as Texture2DOptions;\n }, catchError);\n } else if (target === constants.TEXTURE_CUBE_MAP) {\n const maps = (sourceFrom as TextureFactorySourceCubeMipmapsFrom).maps;\n\n return Promise.all(maps.map(map => this._loadCubeMapAsync(map))).then(mipmaps => {\n return Object.assign({}, config, {\n sourceType: TextureSourceType.mipmaps,\n target: constants.TEXTURE_CUBE_MAP,\n mipmaps,\n sourceFrom: {\n target: constants.TEXTURE_CUBE_MAP,\n type: sourceFrom.type,\n maps: (sourceFrom as TextureFactorySourceCubeMipmapsFrom).maps.map(map => Object.assign({}, map)),\n },\n }) as TextureCubeOptions;\n }, catchError);\n }\n }\n\n return Promise.reject(new Error('invalid resource type:' + sourceFrom.type));\n\n function catchError (error: Error): TextureOptions {\n throw Error('loadFail:' + JSON.stringify(config));\n }\n }\n\n _loadVideoAsync (url: string | null | MediaProvider): Promise<HTMLVideoElement> {\n if (IS_NODE) {\n return Promise.reject('video not support');\n }\n const video = document.createElement('video');\n\n video.setAttribute('renderer', 'standard');\n if (isObj(url)) {\n video.srcObject = url as MediaProvider;\n } else {\n video.src = url as string;\n }\n video.crossOrigin = 'anonymous';\n video.muted = true;\n video.setAttribute('playsinline', 'playsinline');\n const p = video.play();\n\n return p ? p.then(() => video) : new Promise(function (resolve, reject) {\n video.addEventListener('loadeddata', function h () {\n resolve(video);\n video.removeEventListener('loadeddata', h);\n }, true);\n video.addEventListener('error', function (e) {\n reject(e);\n });\n });\n }\n\n _loadCubeMapAsync (map: TextureCubeSourceURLMap | string[]): Promise<TextureSourceCubeData> {\n return Promise.all(map.map(key => this.loadImageAsync(key))) as Promise<TextureSourceCubeData>;\n }\n\n loadCompressedTextureFromArrayBuffer (arrayBuffer: ArrayBuffer, options?: TextureOptions): TextureOptions {\n return Object.assign(getCompressedTextureOptions(arrayBuffer), options);\n }\n\n reloadTextureAsync (texture: Texture): Promise<Texture> {\n const id = texture.id;\n const o = this.reloadPending[id];\n\n if (o) {\n return o;\n }\n if (texture.options.sourceFrom) {\n return this.reloadPending[id] = this.loadSourceAsync(texture.options.sourceFrom as TextureFactorySourceFrom).then(opt => {\n texture.updateSource(opt);\n delete this.reloadPending[id];\n\n return texture;\n }).catch(ex => {\n delete this.reloadPending[id];\n throw ex;\n });\n }\n\n return Promise.reject('no source from');\n }\n\n}\n\nlet g: TextureFactory;\n\nexport function getDefaultTextureFactory (): TextureFactory {\n if (!g) {\n g = new MarsTextureFactory();\n }\n\n return g;\n}\n\nexport function setDefaultTextureFactory (factory: TextureFactory) {\n g = factory;\n}\n","import type {\n Texture,\n Texture2DSourceOptionsData,\n Texture2DSourceOptionsImage,\n Texture2DSourceOptionsNone,\n Texture2DSourceOptionsVideo,\n TextureCubeSourceOptionsImage,\n TextureOptions,\n TextureSourceOptions } from '../../types/Texture';\nimport {\n TextureSourceType,\n} from '../../types/Texture';\nimport type { GLGPURenderer } from '../webgl/GLGPURenderer';\nimport { GLTexture, imageBitMapAvailable } from '../webgl/GLTexture';\nimport type { Immutable } from '../../types/type';\nimport { getDefaultTextureFactory } from './MarsTextureFactory';\nimport { constants } from '../webgl/constants';\nimport type { MarsRenderer } from './MarsRenderer';\nimport { forEach, isObj, throwDestroyedError } from '../common/utils';\n\nexport function closeImageBitMap (img: any) {\n if (imageBitMapAvailable) {\n if (img instanceof ImageBitmap) {\n img.close();\n } else if (img instanceof Array) {\n img.forEach(closeImageBitMap);\n } else if (isObj(img)) {\n forEach(img, closeImageBitMap);\n }\n }\n}\n\nlet seed = 1;\n\nexport class MarsTexture implements Texture {\n readonly id: string;\n readonly options: Immutable<TextureOptions>;\n readonly sourceType: TextureSourceType;\n readonly name: string;\n readonly renderer?: MarsRenderer;\n readonly internal?: GLTexture;\n private _offloaded!: boolean;\n\n private _isDestroyed = false;\n\n get isDestroyed (): boolean {\n return this._isDestroyed;\n }\n\n constructor (options: TextureOptions | GLTexture, renderer?: MarsRenderer) {\n this.id = 'Tex' + seed++;\n\n if (options instanceof GLTexture) {\n this.sourceType = options.options.sourceType as TextureSourceType;\n this.options = options.options as Immutable<TextureOptions>;\n if (!renderer) {\n throw Error('copy texture should assign renderer');\n }\n this.internal = options;\n this.renderer = renderer;\n this.name = '';\n } else {\n const opt = this.checkOptions(options);\n\n this.sourceType = opt.sourceType as TextureSourceType;\n this.options = opt;\n this.name = options.name || '';\n if (renderer) {\n this.assignRenderer(renderer);\n }\n }\n }\n\n checkOptions (options: TextureOptions): Immutable<TextureOptions> {\n const opt = Object.assign({\n minFilter: constants.NEAREST,\n magFilter: constants.NEAREST,\n wrapS: constants.CLAMP_TO_EDGE,\n wrapT: constants.CLAMP_TO_EDGE,\n target: options.target || constants.TEXTURE_2D,\n format: constants.RGBA,\n internalFormat: options.format || constants.RGBA,\n type: constants.UNSIGNED_BYTE,\n }, options) as TextureOptions;\n\n if (!opt.sourceType) {\n if ((opt as Texture2DSourceOptionsImage).image) {\n (opt as Texture2DSourceOptionsImage).sourceType = TextureSourceType.image;\n } else if ((opt as Texture2DSourceOptionsData).data) {\n (opt as Texture2DSourceOptionsData).sourceType = TextureSourceType.data;\n } else if ((opt as Texture2DSourceOptionsVideo).video) {\n (opt as Texture2DSourceOptionsVideo).sourceType = TextureSourceType.video;\n } else {\n (opt as Texture2DSourceOptionsNone).sourceType = TextureSourceType.none;\n }\n }\n if (!opt.sourceType) {\n throw Error('invalid source type');\n }\n\n return opt as Immutable<TextureOptions>;\n }\n\n get width () {\n return this.internal?.width || 0;\n }\n\n get height () {\n return this.internal?.height || 0;\n }\n\n assignRenderer (renderer: MarsRenderer): MarsTexture {\n // @ts-expect-error safe to assign\n this['renderer'] = renderer;\n this._assignRenderer(renderer.internal);\n\n return this;\n }\n\n _assignRenderer (renderer: GLGPURenderer): void {\n if (!this.internal) {\n const option = this.options as TextureOptions;\n\n // @ts-expect-error safe to assign\n this['internal'] = new GLTexture(option, renderer);\n const releaseImageSource = !option.keepImageSource;\n\n if (option.sourceType === TextureSourceType.image) {\n if (releaseImageSource) {\n closeImageBitMap((option as Texture2DSourceOptionsImage).image);\n closeImageBitMap((option as TextureCubeSourceOptionsImage).cube);\n }\n //@ts-expect-error delete image memory\n delete (option as Texture2DSourceOptionsImage).image;\n //@ts-expect-error delete image memory\n delete (option as TextureCubeSourceOptionsImage).cube;\n } else if (option.sourceType === TextureSourceType.data) {\n //@ts-expect-error delete image memory\n delete (option as Texture2DSourceOptionsData).data;\n } else if (option.sourceType === TextureSourceType.compressed) {\n //@ts-expect-error delete image memory\n delete option.mipmaps;\n } else if (option.sourceType === TextureSourceType.mipmaps) {\n //@ts-expect-error delete image memory\n delete option.mipmaps;\n if (releaseImageSource) {\n closeImageBitMap(option.mipmaps);\n }\n }\n }\n }\n\n uploadCurrentVideoFrame () {\n if (this.options.sourceType === TextureSourceType.video && this.options.video && this.internal) {\n this.internal.update({ sourceType: TextureSourceType.video, video: this.options.video as HTMLVideoElement });\n\n return true;\n }\n\n return false;\n }\n\n destroy (): void {\n if (this.internal) {\n this.internal?.destroy();\n //@ts-expect-error safe to assign\n this['internal'] = this['renderer'] = undefined;\n }\n this._isDestroyed = true;\n this._assignRenderer = throwDestroyedError;\n }\n\n reloadDataAsync (): Promise<Texture> {\n if (this._offloaded) {\n return getDefaultTextureFactory().reloadTextureAsync(this);\n }\n\n return Promise.resolve(this);\n }\n\n offloadData (): void {\n if (this.internal && getDefaultTextureFactory().canOffloadTexture(this)) {\n this.internal?.offloadData();\n this._offloaded = true;\n }\n }\n\n updateSource (options: TextureSourceOptions): void {\n // @ts-expect-error safe to assign\n this['options'] = this.checkOptions(Object.assign(this.options, options));\n // @ts-expect-error safe to assign\n this['sourceType'] = this.options.sourceType;\n this.internal?.update(this.options as TextureSourceOptions);\n }\n\n}\n","import type {\n RenderPassColorAttachment,\n RenderPassColorAttachmentOptions, RenderPassColorAttachmentTextureOptions,\n} from '../../types/RenderPass';\nimport {\n RenderPassAttachmentStorageType,\n} from '../../types/RenderPass';\nimport { MarsTexture } from './MarsTexture';\nimport { TextureSourceType } from '../../types/Texture';\nimport type { MarsRenderer } from './MarsRenderer';\nimport { constants } from '../webgl/constants';\nimport { throwDestroyedError } from '../common/utils';\n\ninterface MarsRenderPassColorAttachmentOptions extends RenderPassColorAttachmentOptions {\n size?: [x: number, y: number],\n name?: string,\n}\n\ninterface MarsRenderPassColorAttachmentTextureOptions extends RenderPassColorAttachmentTextureOptions {\n size?: [x: number, y: number],\n}\n\nexport class MarsRenderPassColorAttachment implements RenderPassColorAttachment {\n readonly readable: boolean;\n texture!: MarsTexture;\n readonly externalTexture: boolean;\n textureOptions?: MarsRenderPassColorAttachmentTextureOptions;\n private _isDestroyed: boolean;\n multisample: number;\n readonly storageType = RenderPassAttachmentStorageType.color;\n get isDestroyed () {\n return this._isDestroyed;\n }\n\n constructor (options: MarsRenderPassColorAttachmentOptions) {\n if (options.texture instanceof MarsTexture) {\n this.texture = options.texture;\n this.externalTexture = true;\n } else if (options.texture) {\n const texOpt = options.texture as RenderPassColorAttachmentTextureOptions;\n\n this.externalTexture = false;\n this.textureOptions = {\n size: options.size,\n format: texOpt.format || constants.RGBA,\n type: texOpt.type || constants.UNSIGNED_BYTE,\n internalFormat: texOpt.internalFormat || texOpt.format || constants.RGBA,\n wrapT: texOpt.wrapT,\n wrapS: texOpt.wrapS,\n minFilter: texOpt.minFilter,\n magFilter: texOpt.magFilter,\n name: options.name,\n };\n } else {\n throw Error('color attachment must use texture');\n }\n this._isDestroyed = false;\n this.readable = true;\n }\n\n get size (): [x: number, y: number] {\n const tex = this.texture;\n\n return tex ? [tex.width, tex.height] : [0, 0];\n }\n\n get width (): number {\n return this.texture?.width || 0;\n }\n\n get height (): number {\n return this.texture?.height || 0;\n }\n\n assignRenderer (renderer: MarsRenderer): MarsRenderPassColorAttachment {\n if (this.textureOptions) {\n const size: [x: number, y: number] = this.textureOptions.size || [renderer.width, renderer.height];\n\n this.texture = new MarsTexture({\n ...this.textureOptions,\n sourceType: TextureSourceType.framebuffer,\n data: { width: size[0], height: size[1] },\n });\n }\n if (this.texture) {\n this.texture.assignRenderer(renderer);\n }\n if (this.multisample > 1) {\n this.multisample = Math.min(renderer.gpu.capability.maxSample, this.multisample);\n }\n\n return this;\n }\n\n destroy (): void {\n this.texture?.destroy();\n this.assignRenderer = throwDestroyedError as unknown as (r: MarsRenderer) => MarsRenderPassColorAttachment;\n this._isDestroyed = true;\n }\n\n}\n","import type {\n RenderPass,\n RenderPassAttachmentOptions,\n RenderPassLoadAction,\n RenderPassDelegate,\n RenderPassDepthStencilAttachment,\n RenderPassDestroyOptions,\n RenderPassOptions,\n RenderPassStorageObject,\n RenderPassStoreAction,\n} from '../../types/RenderPass';\nimport {\n RenderPassAttachmentStorageType,\n RenderPassDestroyAttachmentType,\n RenderPassMeshOrder, TextureLoadAction,\n TextureStoreAction,\n} from '../../types/RenderPass';\nimport type { MarsMesh } from './MarsMesh';\nimport type { MarsRenderer } from './MarsRenderer';\nimport { GLFrameBuffer } from '../webgl/GLFrameBuffer';\nimport { MarsRenderPassColorAttachment } from './MarsRenderPassColorAttachment';\nimport { MarsTexture } from './MarsTexture';\nimport type { GLTexture } from '../webgl/GLTexture';\nimport {\n arrAddByOrder, arrRemove, sortByOrder, throwDestroyedError,\n} from '../common/utils';\nimport type { vec4 } from '../../types';\nimport { TextureSourceType } from '../../types';\nimport { MarsSemanticMap } from './MarsSemanticMap';\nimport { DestroyOptions } from '../../types/constants';\n\nlet seed = 1;\n\nconst defStoreAction: RenderPassStoreAction = {\n colorAction: TextureStoreAction.store,\n depthAction: TextureStoreAction.store,\n stencilAction: TextureStoreAction.store,\n};\n\nconst defLoadAction: RenderPassLoadAction = {\n colorAction:TextureLoadAction.load,\n depthAction:TextureLoadAction.load,\n stencilAction:TextureLoadAction.load,\n};\n\nexport class MarsRenderPass implements RenderPass {\n delegate: RenderPassDelegate;\n readonly name: string;\n readonly priority: number;\n readonly meshes: MarsMesh[];\n readonly options: RenderPassAttachmentOptions;\n readonly renderer!: MarsRenderer;\n readonly frameBuffer?: GLFrameBuffer;\n\n readonly depthStencilType: RenderPassAttachmentStorageType;\n readonly loadAction: RenderPassLoadAction;\n readonly storeAction: RenderPassStoreAction;\n readonly semantics: MarsSemanticMap;\n\n private _isDestroyed = false;\n\n private _depthTexture?: MarsTexture;\n private _stencilTexture?: MarsTexture;\n private _attachments: MarsRenderPassColorAttachment[];\n\n get isDestroyed (): boolean {\n return this._isDestroyed;\n }\n\n get multisample () {\n return this.frameBuffer?.multisample || 0;\n }\n get attachments () {\n return this._attachments;\n }\n\n public viewportScale!: number;\n private _isCustomViewport!: boolean;\n private _customViewport?: [x: number, y: number, width: number, height: number];\n //todo reorder meshes if changed\n meshOrder: RenderPassMeshOrder;\n\n constructor (options: RenderPassOptions, renderer?: MarsRenderer) {\n this.name = options.name || ('MarsRenderPass_' + seed++);\n this.priority = options.priority || 0;\n this.meshOrder = options.meshOrder || RenderPassMeshOrder.ascending;\n this.meshes = (options.meshes as MarsMesh[] || []).slice();\n sortByOrder(this.meshes, this.meshOrder);\n this.options = options;\n this.loadAction = Object.assign({}, defLoadAction, options.loadAction);\n this._attachments = [];\n this.semantics = new MarsSemanticMap(options.semantics);\n this.depthStencilType = options.depthStencilAttachment?.storageType || RenderPassAttachmentStorageType.none;\n this._setViewportOptions(options);\n if (renderer) {\n this.assignRenderer(renderer);\n }\n this.delegate = options.delegate || {};\n\n this.storeAction = Object.assign({}, defStoreAction, options.storeAction);\n }\n\n get viewport (): vec4 {\n const ret = this.frameBuffer?.viewport || this._customViewport;\n\n if (ret) {\n return ret;\n }\n const renderer = this.renderer;\n const vs = this.viewportScale;\n\n return renderer ? [0, 0, renderer.width * vs, renderer.height * vs] : [0, 0, 0, 0];\n }\n\n get stencilAttachment (): RenderPassDepthStencilAttachment | undefined {\n const frameBuffer = this.frameBuffer;\n\n if (frameBuffer) {\n return {\n storageType: frameBuffer.depthStencilStorageType,\n storage: frameBuffer.stencilStorage as RenderPassStorageObject,\n texture: frameBuffer.stencilTexture ? this._getStencilTexture(frameBuffer.stencilTexture, frameBuffer.externalStorage) : undefined,\n };\n }\n }\n\n get depthAttachment (): RenderPassDepthStencilAttachment | undefined {\n const frameBuffer = this.frameBuffer;\n\n if (frameBuffer) {\n return {\n storageType: frameBuffer.depthStencilStorageType,\n storage: frameBuffer.depthStorage as RenderPassStorageObject,\n texture: frameBuffer.depthTexture ? this._getDepthTexture(frameBuffer.depthTexture, frameBuffer.externalStorage) : undefined,\n };\n }\n }\n\n bind () {\n if (this.frameBuffer) {\n this.frameBuffer.bind();\n } else {\n const state = this.renderer.internal.state;\n //在绑定的时候renderpass进行viewport的动态改变\n const vp = this.viewport;\n\n state.viewport(vp[0], vp[1], vp[2], vp[3]);\n }\n }\n\n private _getDepthTexture (texture: GLTexture, external: boolean): MarsTexture {\n if (!this._depthTexture) {\n const outTex = this.options.depthStencilAttachment?.texture as MarsTexture;\n const tex = texture === outTex?.internal ? outTex : new MarsTexture(texture, this.renderer);\n\n if (!external) {\n this._depthTexture = tex;\n }\n\n return tex;\n }\n\n return this._depthTexture;\n }\n\n private _getStencilTexture (texture: GLTexture, external: boolean): MarsTexture {\n if (!this._stencilTexture) {\n const outTex = this.options.depthStencilAttachment?.texture as MarsTexture;\n const tex = texture === outTex?.internal ? outTex : new MarsTexture(texture, this.renderer);\n\n if (!external) {\n this._stencilTexture = tex;\n }\n\n return tex;\n }\n\n return this._stencilTexture;\n }\n\n private _setViewportOptions (options: RenderPassAttachmentOptions) {\n if (options.viewport) {\n this._isCustomViewport = true;\n this.viewportScale = 1;\n this._customViewport = options.viewport.slice(0, 4) as [x: number, y: number, width: number, height: number];\n if (this.frameBuffer) {\n const vp = this._customViewport;\n\n this.frameBuffer.isCustomViewport = false;\n this.frameBuffer.resize(vp[0], vp[1], vp[2], vp[3]);\n }\n } else {\n this._isCustomViewport = false;\n this.viewportScale = options.viewportScale || 1;\n if (this.frameBuffer) {\n this.frameBuffer.isCustomViewport = true;\n this.frameBuffer.viewportScale = this.viewportScale;\n }\n }\n }\n\n resetColorAttachments (colors: MarsTexture[]) {\n if (!colors.length) {\n this.resetAttachments({ attachments: [] });\n }\n if (!this.attachments.length) {\n this.resetAttachments({ attachments: colors.map(t => ({ texture: t })) });\n } else {\n const attachments = colors.map(texture => {\n texture.updateSource({ sourceType: TextureSourceType.framebuffer });\n\n return new MarsRenderPassColorAttachment({ texture: texture.assignRenderer(this.renderer) });\n });\n\n this._attachments.forEach(att => !att.externalTexture && att.destroy());\n this._attachments = attachments;\n if (this.frameBuffer) {\n this.frameBuffer.bind();\n this.frameBuffer.resetColorTextures(colors.map(color => color.internal as GLTexture));\n }\n }\n }\n\n resetAttachments (options: RenderPassAttachmentOptions) {\n const ret = this.options;\n\n //@ts-expect-error safe to assign\n this.options = options;\n this._setViewportOptions(options);\n if (this.renderer) {\n this._resetAttachments();\n }\n\n return ret;\n }\n\n private _resetAttachments () {\n const renderer = this.renderer;\n const options = this.options;\n\n if (this._attachments.length) {\n this._attachments.forEach(att => !att.externalTexture && att.destroy());\n this._attachments.length = 0;\n this.frameBuffer?.destroy({ depthStencilAttachment: RenderPassDestroyAttachmentType.keepExternal });\n //@ts-expect-error safe to assign\n this.frameBuffer = null;\n }\n const vs = this.viewportScale;\n //renderpass的viewport相关参数都需要动态的修改\n const viewport = (this._isCustomViewport ? this._customViewport : [0, 0, renderer.width * vs, renderer.height * vs]) as vec4;\n\n const size: [x: number, y: number] = [viewport[2], viewport[3]];\n const name = this.name;\n\n if (options.attachments?.length) {\n const attachments = options.attachments.map(function (att, index) {\n return new MarsRenderPassColorAttachment(Object.assign({\n size,\n name: att.texture?.name || `${name}##color_${index}`,\n }, att)).assignRenderer(renderer);\n });\n\n this._attachments = attachments;\n const framebuffer = new GLFrameBuffer({\n storeAction: this.storeAction,\n name,\n viewport,\n multisample: options.multiSample,\n viewportScale: this.viewportScale,\n isCustomViewport: this._isCustomViewport,\n attachments: attachments.map(att => (att.texture).internal as GLTexture),\n depthStencilAttachment: options.depthStencilAttachment || { storageType: RenderPassAttachmentStorageType.none },\n }, renderer.internal);\n\n framebuffer.bind();\n framebuffer.unbind();\n //@ts-expect-error safe to assign\n this.frameBuffer = framebuffer;\n } else {\n this._attachments.length = 0;\n }\n }\n\n unbind () {\n const state = this.renderer.internal.state;\n\n if (this.frameBuffer) {\n this.frameBuffer.unbind();\n } else {\n state.bindSystemFramebuffer();\n }\n }\n\n assignRenderer (renderer: MarsRenderer): MarsRenderPass {\n if (!this.renderer) {\n //@ts-expect-error safe to assign\n this.renderer = renderer;\n this._resetAttachments();\n }\n\n return this;\n }\n\n destroy (options?: RenderPassDestroyOptions) {\n const destroyMeshOption = options?.meshes || undefined;\n\n if (destroyMeshOption !== DestroyOptions.keep) {\n this.meshes.forEach(mesh => {\n mesh.destroy(destroyMeshOption);\n });\n }\n this.meshes.length = 0;\n\n const colorOpt = options?.colorAttachment ? options.colorAttachment : RenderPassDestroyAttachmentType.force;\n\n this._attachments.forEach(att => {\n const keep = (att.externalTexture && colorOpt === RenderPassDestroyAttachmentType.keepExternal) || colorOpt === RenderPassDestroyAttachmentType.keep;\n\n if (!keep) {\n att.destroy();\n }\n });\n this._attachments.length = 0;\n if (options?.semantics !== DestroyOptions.keep) {\n this.semantics.destroy();\n }\n\n const depthStencilOpt = options?.depthStencilAttachment ? options.depthStencilAttachment : RenderPassDestroyAttachmentType.force;\n const fbo = this.frameBuffer;\n\n if (fbo) {\n fbo.destroy({ depthStencilAttachment: depthStencilOpt });\n const keep = (fbo.externalStorage && depthStencilOpt === RenderPassDestroyAttachmentType.keepExternal) || depthStencilOpt === RenderPassDestroyAttachmentType.keep;\n\n if (!keep) {\n this._stencilTexture?.destroy();\n this._depthTexture?.destroy();\n }\n }\n\n //@ts-expect-error safe to assign\n this.options = this.renderer = null;\n this.assignRenderer = throwDestroyedError as unknown as (r: MarsRenderer) => MarsRenderPass;\n this._isDestroyed = true;\n }\n\n addMesh (mesh: MarsMesh): void {\n arrAddByOrder(this.meshes, mesh, this.meshOrder);\n }\n\n removeMesh (mesh: MarsMesh): void {\n arrRemove(this.meshes, mesh);\n }\n\n setMeshes (meshes: MarsMesh[]): MarsMesh[] {\n this.meshes.length = 0;\n this.meshes.splice(0, 0, ...meshes);\n\n return sortByOrder(this.meshes, this.meshOrder);\n }\n}\n","import type { MaterialRenderStates } from '../../types/Material';\nimport type { GLGPURenderer } from './GLGPURenderer';\nimport type { MarsMaterial } from '../render/MarsMaterial';\nimport type { Immutable, vec3, vec4 } from '../../types/type';\nimport { constants } from './constants';\nimport type { GLProgram } from './GLProgram';\n\nexport class GLMaterial {\n\n readonly renderer: GLGPURenderer;\n\n readonly shaderCacheId: string;\n\n readonly states: Immutable<MaterialRenderStates>;\n\n readonly material: MarsMaterial;\n\n constructor (renderer: GLGPURenderer, material: MarsMaterial) {\n this.renderer = renderer;\n this.shaderCacheId = material.shaderCacheId;\n this.states = material.states;\n this.material = material;\n }\n\n setupStates () {\n const webGLState = this.renderer.state;\n const currentState = this.states;\n\n //在之前已经给过默认值 这里就不用再判断undefined和null了\n webGLState.toggle(constants.SAMPLE_ALPHA_TO_COVERAGE, currentState.sampleAlphaToCoverage);\n webGLState.toggle(constants.BLEND, currentState.blending);\n webGLState.toggle(constants.DEPTH_TEST, currentState.depthTest);\n webGLState.toggle(constants.STENCIL_TEST, currentState.stencilTest);\n webGLState.toggle(constants.CULL_FACE, currentState.cullFaceEnabled);\n webGLState.toggle(constants.POLYGON_OFFSET_FILL, currentState.polygonOffsetFill);\n if (currentState.stencilTest) {\n //stencil\n webGLState.stencilMaskSeparate(constants.BACK, currentState.stencilMaskBack as number);\n webGLState.stencilMaskSeparate(constants.FRONT, currentState.stencilMaskFront as number);\n const stencilBackFunc = currentState.stencilFuncBack as vec3;\n\n webGLState.stencilFuncSeparate(constants.BACK, stencilBackFunc[0], stencilBackFunc[1], stencilBackFunc[2]);\n const stencilFrontFunc = currentState.stencilFuncFront as vec3;\n\n webGLState.stencilFuncSeparate(constants.FRONT, stencilFrontFunc[0], stencilFrontFunc[1], stencilFrontFunc[2]);\n const stencilOpBack = currentState.stencilOpBack as vec3;\n\n webGLState.stencilOpSeparate(constants.BACK, stencilOpBack[0], stencilOpBack[1], stencilOpBack[2]);\n const stencilOpFront = currentState.stencilOpFront as vec3;\n\n webGLState.stencilOpSeparate(constants.FRONT, stencilOpFront[0], stencilOpFront[1], stencilOpFront[2]);\n }\n\n if (currentState.blending) {\n //blend\n const blendColor = currentState.blendColor as vec4;\n\n webGLState.blendColor(blendColor[0], blendColor[1], blendColor[2], blendColor[3]);\n webGLState.blendEquationSeparate(currentState.blendEquationRGB as number, currentState.blendEquationAlpha as number);\n webGLState.blendFuncSeparate(currentState.blendSrc as number, currentState.blendDst as number, currentState.blendSrcAlpha as number, currentState.blendDstAlpha as number);\n }\n\n //color depth\n const colorMask = currentState.colorMask as [r: boolean, g: boolean, b: boolean, a: boolean];\n\n webGLState.colorMask(colorMask[0], colorMask[1], colorMask[2], colorMask[3]);\n if (currentState.depthTest) {\n webGLState.depthMask(currentState.depthMask as boolean);\n webGLState.depthFunc(currentState.depthFunc as number);\n webGLState.depthRange(currentState.depthRange?.[0] as number, currentState.depthRange?.[1] as number);\n }\n\n if (currentState.cullFaceEnabled) {\n //face\n webGLState.cullFace(currentState.cullFace as number);\n webGLState.frontFace(currentState.frontFace as number);\n }\n\n if (currentState.polygonOffsetFill) {\n const polygonOffset = currentState.polygonOffset || [0, 0];\n\n webGLState.polygonOffset(polygonOffset[0], polygonOffset[1]);\n }\n\n // set gl states\n\n }\n\n getProgram (): GLProgram | null {\n return this.renderer.shaderLibrary.getProgram(this.shaderCacheId);\n }\n\n destroy () {\n const lib = this.renderer?.shaderLibrary;\n\n if (lib) {\n const shader = lib.getShaderResult(this.shaderCacheId);\n\n if (shader && !shader.shared) {\n lib.deleteShader(this.shaderCacheId);\n }\n }\n //@ts-expect-error safe to assign\n this.renderer = null;\n }\n}\n","import type {\n MaterialDataBlock,\n MaterialDataBlockDestroyOptions,\n MaterialDataBlockOptions, UniformSemantic, UniformStruct,\n UniformValue, vec2,\n Texture,\n} from '../../types';\nimport type { MarsRenderer } from './MarsRenderer';\nimport { forEach, isObj, throwDestroyedError } from '../common/utils';\nimport { MarsTexture } from './MarsTexture';\nimport { DestroyOptions } from '../../types/constants';\nimport type { UniformBlockSpec } from '../webgl/GLUniformUtils';\nimport { UniformBlockBuffer } from '../webgl/GLUniformUtils';\n\nfunction isUniformStruct (value: UniformValue) {\n return (isObj(value)) && ((value as any).length === undefined);\n}\n\nfunction isUniformStructArray (value: UniformValue) {\n return (value) && ((value as Array<number>).length !== undefined) && isUniformStruct((value as Array<number>)[0]);\n}\n\nexport class MarsMaterialDataBlock implements MaterialDataBlock {\n readonly _uniformValues: Record<string, UniformValue>;\n readonly _uniformTextures: Record<string, MarsTexture | MarsTexture[]>;\n readonly _uniformFlags: Record<string, boolean>;\n readonly _uniformValueRanges: Record<string, vec2>;\n readonly name: string;\n readonly uniformSemantics: { [key: string]: UniformSemantic };\n readonly renderer?: MarsRenderer;\n readonly uboBufferMap: Record<string, UniformBlockBuffer>;\n protected _isDestroyed = false;\n private _uniformPrivate: Record<string, boolean>;\n private readonly _keepUboData: boolean;\n\n constructor (props: MaterialDataBlockOptions & { keepUboData?: boolean }, renderer?: MarsRenderer) {\n this._isDestroyed = false;\n this.name = props.name || 'defDataBlock';\n this._uniformValues = {};\n this._uniformFlags = {};\n this.uboBufferMap = {};\n this._uniformTextures = {};\n this._uniformValueRanges = {};\n this._keepUboData = !!props.keepUboData;\n this.uniformSemantics = props.uniformSemantics || {};\n this._uniformPrivate = {};\n if (props.uniformValues) {\n this.setUniformValues(props.uniformValues);\n }\n forEach(props.uniformTextures, (tex, name)=>this.setUniformTexture(name, tex as MarsTexture));\n if (renderer) {\n this.assignRenderer(renderer);\n }\n }\n\n _assignUniformValueRenderer (value: MarsTexture | MarsTexture[], renderer?: MarsRenderer) {\n if (renderer) {\n const assign = (value: MarsTexture) => isObj(value) && (value as any).assignRenderer && (value as any).assignRenderer(renderer);\n\n if (value instanceof Array) {\n value.forEach(assign);\n } else {\n assign(value);\n }\n }\n }\n\n invalidAllFlags () {\n const f = this._uniformFlags;\n const range = this._uniformValueRanges;\n\n forEach(this._uniformValues, function (val, key) {\n f[key] = true;\n range[key] = [0, 0];\n });\n }\n\n clearFlags () {\n // @ts-expect-error safe to assign\n this._uniformFlags = {};\n }\n\n isDirty (shaderCacheId: string, name: string): boolean {\n return this._uniformFlags[name] === true;\n }\n\n get isDestroyed () {\n return this._isDestroyed;\n }\n\n setUniformTexture (uniformName: string, texture: MarsTexture | MarsTexture[] | undefined) {\n if (texture) {\n this._uniformTextures[uniformName] = texture;\n this._assignUniformValueRenderer(texture, this.renderer);\n this._uniformPrivate[uniformName] = true;\n } else {\n delete this._uniformTextures[uniformName];\n delete this._uniformPrivate[uniformName];\n }\n }\n\n getUniformTexture <T extends (Texture | Texture[]) = MarsTexture> (uniformName: string): T | undefined {\n return this._uniformTextures[uniformName] as unknown as T;\n }\n\n assignRenderer (renderer: MarsRenderer): MaterialDataBlock {\n if (this.renderer && renderer !== this.renderer) {\n throw Error('assign different renderer');\n }\n if (renderer && !this.renderer) {\n // @ts-expect-error safe to assign\n this.renderer = renderer;\n\n forEach(this._uniformTextures, value => {\n this._assignUniformValueRenderer(value, renderer);\n });\n }\n\n return this;\n }\n\n createUboBuffer (spec: UniformBlockSpec): UniformBlockBuffer | undefined {\n if (!this.uboBufferMap[spec.id] && this.renderer && this.name === spec.name) {\n const ubo = this.uboBufferMap[spec.id] = new UniformBlockBuffer(this.renderer.internal, spec);\n\n ubo.keepData = this._keepUboData;\n }\n\n return this.uboBufferMap[spec.id];\n }\n\n setUboBuffer (uboBuffer: UniformBlockBuffer) {\n uboBuffer.setValues(this._uniformValues, this._uniformFlags, this._uniformValueRanges);\n }\n\n updateUniformSubData (name: string, start: number, count: number) {\n throw Error('this method has been deprecated');\n const range = this._uniformValueRanges[name];\n\n if (!this._uniformValueRanges[name]) {\n this._uniformValueRanges[name] = [start, count];\n } else {\n const end = Math.max(range[0] + range[1], start + count);\n const s = Math.min(start, range[0]);\n\n this._uniformValueRanges[name] = [s, end - s];\n }\n this._uniformFlags[name] = true;\n }\n\n hasUniformValue (name: string): boolean {\n return !!this._uniformPrivate[name];\n }\n\n destroy (options?: MaterialDataBlockDestroyOptions): void {\n if (options?.textures !== DestroyOptions.keep) {\n forEach(this._uniformTextures, uniform => {\n if (uniform instanceof MarsTexture) {\n uniform.destroy();\n }\n });\n }\n forEach(this.uboBufferMap, ubo => {\n ubo?.destroy();\n });\n // @ts-expect-error safe to assign\n this.uboBufferMap = {};\n\n this._uniformPrivate = {};\n\n // @ts-expect-error safe to assign\n this._uniformFlags = {};\n // @ts-expect-error safe to assign\n this._uniformValues = {};\n // @ts-expect-error safe to assign\n this._uniformTextures = {};\n // @ts-expect-error safe to assign\n this.uniformSemantics = {};\n this.assignRenderer = throwDestroyedError as unknown as (r: MarsRenderer) => MarsMaterialDataBlock;\n\n this._isDestroyed = true;\n }\n\n getUniformValue (name: string): UniformValue {\n return this._uniformValues[name];\n }\n\n getUniformValues (): { [p: string]: UniformValue } {\n return this._uniformValues;\n }\n\n setUniformValue (name: string, value: UniformValue | undefined, isSemantic?: boolean): boolean {\n if (value === undefined) {\n const originValue = this._uniformValues[name];\n\n if (isUniformStruct(originValue)) {\n forEach(originValue as UniformStruct, (data, key) => {\n const nameInStruct = name + '.' + key;\n\n delete this._uniformPrivate[nameInStruct];\n });\n } else if (isUniformStructArray(originValue)) {\n (originValue as UniformStruct[]).forEach((valueData, i) => {\n forEach(valueData, (valueInStruct: UniformValue, key) => {\n const nameInStruct = name + '[' + i + ']' + '.' + key;\n\n delete this._uniformPrivate[nameInStruct];\n });\n });\n }\n delete this._uniformValues[name];\n this._uniformFlags[name] = false;\n delete this._uniformPrivate[name];\n } else if (value instanceof MarsTexture) {\n throw Error('setUniformValue not accept texture:' + name);\n } else {\n this._uniformPrivate[name] = !isSemantic;\n if (isUniformStruct(value)) {\n forEach(value as UniformStruct, (data, key) => {\n const nameInStruct = name + '.' + key;\n\n this._uniformValues[nameInStruct] = data;\n this._uniformFlags[nameInStruct] = true;\n this._uniformPrivate[nameInStruct] = true;\n });\n // 只是用来保存结构体对象\n this._uniformValues[name] = value;\n this._uniformFlags[name] = false;\n } else if (isUniformStructArray(value)) {\n (value as UniformStruct[]).forEach((valueData, i) => {\n forEach(valueData, (valueInStruct: UniformValue, key) => {\n const nameInStruct = name + '[' + i + ']' + '.' + key;\n\n this._uniformValues[nameInStruct] = valueInStruct;\n this._uniformFlags[nameInStruct] = true;\n this._uniformPrivate[nameInStruct] = true;\n });\n });\n // 只是用来保存结构体对象\n this._uniformValues[name] = value;\n this._uniformFlags[name] = false;\n } else {\n this._uniformValues[name] = value;\n this._uniformFlags[name] = true;\n }\n }\n\n return true;\n }\n\n setUniformValues (map: { [p: string]: UniformValue }): void {\n forEach(map, (val, key) => {\n this.setUniformValue(key, val);\n });\n }\n\n setUniformSemantic (name: string, semantic: string | undefined) {\n if (semantic) {\n this.uniformSemantics[name] = semantic;\n } else {\n delete this.uniformSemantics[name];\n }\n }\n\n clone (name: string): MarsMaterialDataBlock {\n return new MarsMaterialDataBlock({\n name,\n uniformValues: { ...this._uniformValues },\n uniformTextures: { ...this._uniformTextures },\n uniformSemantics: { ...this.uniformSemantics },\n keepUboData: this._keepUboData,\n }, this.renderer);\n }\n\n}\n","import type {\n Material, MaterialDestroyOptions, MaterialOptions, MaterialRenderStates,\n} from '../../types';\nimport { MaterialRenderType } from '../../types/Material';\nimport type { Immutable } from '../../types/type';\nimport { GLMaterial } from '../webgl/GLMaterial';\nimport { constants } from '../webgl/constants';\nimport type { MarsRenderer } from './MarsRenderer';\nimport { MarsMaterialDataBlock } from './MarsMaterialDataBlock';\nimport { arrAdd, arrRemove, throwDestroyedError } from '../common/utils';\nimport { DestroyOptions } from '../../types/constants';\n\nlet seed = 1;\n\nexport class MarsMaterial implements Material {\n readonly shaderCacheId!: string;\n readonly options!: Immutable<MaterialOptions>;\n readonly materialInternal?: GLMaterial;\n readonly name: string;\n public readonly _dataBlocks: MarsMaterialDataBlock[];\n readonly renderType: MaterialRenderType;\n readonly states: Immutable<MaterialRenderStates>;\n readonly renderer?: MarsRenderer;\n private _dbMap: Record<string, MarsMaterialDataBlock>;\n private _isDestroyed = false;\n\n get isDestroyed (): boolean {\n return this._isDestroyed;\n }\n\n get dataBlocks (): MarsMaterialDataBlock[] {\n return this._dataBlocks;\n }\n\n get defaultDataBlock (): MarsMaterialDataBlock {\n return this._dataBlocks[0];\n }\n\n constructor (options: MaterialOptions) {\n this.name = options.name || ('Material' + seed++);\n this._dataBlocks = (options.dataBlocks || []).map(b => (b instanceof MarsMaterialDataBlock) ? b : new MarsMaterialDataBlock(b));\n this.renderType = MaterialRenderType.normal;\n this.states = this.createMaterialStates(options.states);\n this.options = options;\n this._dbMap = {};\n if (!this._dataBlocks.length) {\n this._dataBlocks[0] = new MarsMaterialDataBlock({ name: 'main' });\n }\n }\n\n createMaterialStates (states: MaterialRenderStates): Immutable<MaterialRenderStates> {\n const ret: MaterialRenderStates = {\n blending: !!states.blending,\n sampleAlphaToCoverage: !!states.sampleAlphaToCoverage,\n depthTest: !!states.depthTest,\n stencilTest: !!states.stencilTest,\n cullFaceEnabled: !!states.cullFaceEnabled,\n polygonOffsetFill: !!states.polygonOffsetFill,\n };\n\n if (states.stencilMask === undefined || states.stencilMask === null) {\n ret.stencilMaskBack = valIfUndefined(states.stencilMaskBack, 0xff);\n ret.stencilMaskFront = valIfUndefined(states.stencilMaskFront, 0xff);\n } else {\n const stencilMaskBack = valIfUndefined(states.stencilMaskBack, states.stencilMask);\n\n ret.stencilMaskBack = valIfUndefined(stencilMaskBack, 0xff);\n const stencilMaskFront = valIfUndefined(states.stencilMaskFront, states.stencilMask);\n\n ret.stencilMaskFront = valIfUndefined(stencilMaskFront, 0xff);\n }\n\n if (states.stencilFunc === undefined || states.stencilFunc === null) {\n ret.stencilFuncBack = valIfUndefined(states.stencilFuncBack, [constants.ALWAYS, 0, 0xff]);\n ret.stencilFuncFront = valIfUndefined(states.stencilFuncFront, [constants.ALWAYS, 0, 0xff]);\n } else {\n const stencilFuncFront = valIfUndefined(states.stencilFuncFront, states.stencilFunc);\n\n ret.stencilFuncFront = valIfUndefined(stencilFuncFront, [constants.ALWAYS, 0, 0xff]);\n const stencilFuncBack = valIfUndefined(states.stencilFuncBack, states.stencilFunc);\n\n ret.stencilFuncBack = valIfUndefined(stencilFuncBack, [constants.ALWAYS, 0, 0xff]);\n }\n\n if (states.stencilOp === undefined || states.stencilOp === null) {\n ret.stencilOpFront = valIfUndefined(states.stencilOpFront, [constants.KEEP, constants.KEEP, constants.KEEP]);\n ret.stencilOpBack = valIfUndefined(states.stencilOpBack, [constants.KEEP, constants.KEEP, constants.KEEP]);\n } else {\n const stencilOpFront = valIfUndefined(states.stencilOpFront, states.stencilOp);\n\n ret.stencilOpFront = valIfUndefined(stencilOpFront, [constants.KEEP, constants.KEEP, constants.KEEP]);\n const stencilOpBack = valIfUndefined(states.stencilOpBack, states.stencilOp);\n\n ret.stencilOpBack = valIfUndefined(stencilOpBack, [constants.KEEP, constants.KEEP, constants.KEEP]);\n }\n //blend\n ret.blendSrc = valIfUndefined(states.blendSrc, constants.ONE);\n ret.blendSrcAlpha = valIfUndefined(states.blendSrcAlpha, ret.blendSrc);\n ret.blendDst = valIfUndefined(states.blendDst, constants.ZERO);\n ret.blendDstAlpha = valIfUndefined(states.blendDstAlpha, ret.blendDst);\n ret.blendEquationRGB = valIfUndefined(states.blendEquationRGB, constants.FUNC_ADD);\n ret.blendEquationAlpha = valIfUndefined(states.blendEquationAlpha, ret.blendEquationRGB);\n ret.blendColor = valIfUndefined(states.blendColor, [0, 0, 0, 0]);\n //color\n ret.colorMask = valIfUndefined(states.colorMask, [true, true, true, true]);\n //depth\n ret.depthMask = valIfUndefined(states.depthMask, true);\n ret.depthFunc = valIfUndefined(states.depthFunc, constants.LESS);\n ret.depthRange = valIfUndefined(states.depthRange, [0, 1]);\n ret.cullFace = valIfUndefined(states.cullFace, constants.BACK);\n ret.frontFace = valIfUndefined(states.frontFace, constants.CCW);\n ret.polygonOffset = states.polygonOffset || [0, 0];\n\n //ret\n return Object.freeze(ret);\n }\n\n addDataBlock (b: MarsMaterialDataBlock) {\n if (this.getDataBlockByName(b.name)) {\n throw Error('dataBlock with same name:' + b.name);\n }\n if (arrAdd(this._dataBlocks, b)) {\n b.invalidAllFlags();\n const r = this.renderer;\n\n if (r) {\n b.assignRenderer(r);\n }\n\n }\n }\n\n getDataBlockByName (name: string) {\n const cache = this._dbMap[name];\n\n if (!cache) {\n const db = this._dataBlocks.find(db=> db.name === name);\n\n if (db) {\n return this._dbMap[name] = db;\n }\n }\n\n return cache;\n }\n\n removeDataBlock (b: MarsMaterialDataBlock) {\n arrRemove(this._dataBlocks, b);\n delete this._dbMap[b.name];\n }\n\n assignRenderer (renderer: MarsRenderer): MarsMaterial {\n if (!this.materialInternal) {\n const shader = this.options.shader;\n\n // @ts-expect-error safe to assign\n this.shaderCacheId = renderer.internal.shaderLibrary.addShader(shader);\n // @ts-expect-error safe to assign\n this.materialInternal = new GLMaterial(renderer.internal, this);\n // @ts-expect-error safe to assign\n this['renderer'] = renderer;\n this._dataBlocks.forEach(d => d.assignRenderer(renderer));\n }\n\n return this;\n }\n\n destroy (options?: MaterialDestroyOptions): void {\n if (options?.blocks !== DestroyOptions.keep) {\n this._dataBlocks.forEach(b => b.destroy({ textures: options?.textures }));\n }\n this.materialInternal?.destroy();\n this.assignRenderer = throwDestroyedError as unknown as (r: MarsRenderer) => MarsMaterial;\n this._isDestroyed = true;\n }\n}\n\nfunction valIfUndefined<T> (val: any, def: T): T {\n if (val === undefined || val === null) {\n return def;\n }\n\n return val;\n}\n","import type { GLGPURenderer } from './GLGPURenderer';\n\nexport function createVAO (renderer: GLGPURenderer, name?: string): GLVertexArrayObject | undefined {\n if (renderer.gpu.capability.vao) {\n const ret = new GLVertexArrayObject(renderer, name);\n\n if (ret.vao) {\n return ret;\n }\n }\n}\n\nexport class GLVertexArrayObject {\n readonly renderer: GLGPURenderer;\n\n readonly vao: WebGLVertexArrayObject;\n\n ready = false;\n\n constructor (renderer: GLGPURenderer, name?: string) {\n this.renderer = renderer;\n this.vao = renderer.createVertexArray(name) as WebGLVertexArrayObject;\n }\n\n destroy () {\n if (this.vao) {\n const renderer = this.renderer;\n\n if (renderer.state.bindingVAO == this.vao) {\n renderer.state.bindingVAO = undefined;\n renderer.bindVertexArray(null);\n }\n renderer.deleteVertexArray(this.vao);\n //@ts-expect-error safe to assign\n this.vao = this.renderer = null;\n }\n }\n\n bind () {\n const renderer = this.renderer;\n\n if (this.vao && renderer.state.bindingVAO !== this.vao) {\n renderer.state.bindingVAO = this.vao;\n renderer.bindVertexArray(this.vao);\n }\n }\n\n unbind () {\n const renderer = this.renderer;\n\n renderer.bindVertexArray(null);\n renderer.state.bindingVAO = undefined;\n }\n}\n","import type { AttributeWithType } from '../../types/Geometry';\nimport type { GPUBuffer, GPUBufferOptions } from '../../types/GPUBuffer';\nimport { GLGPUBuffer } from './GLGPUBuffer';\nimport type { GLGPURenderer } from './GLGPURenderer';\nimport type { RenderState } from '../../types/RenderFrame';\nimport { constants } from './constants';\nimport { forEach } from '../common/utils';\nimport type { GLVertexArrayObject } from './GLVertexArrayObject';\nimport { createVAO } from './GLVertexArrayObject';\nimport type { InstancedMesh } from '../../types';\n\nexport const INDEX_TYPE_MAP = {\n [Uint16Array.BYTES_PER_ELEMENT]: constants.UNSIGNED_SHORT,\n [Uint32Array.BYTES_PER_ELEMENT]: constants.UNSIGNED_INT,\n};\n\nexport const TYPE_BYTE_MAP = {\n [constants.UNSIGNED_SHORT]: Uint16Array.BYTES_PER_ELEMENT,\n [constants.UNSIGNED_INT]: Uint32Array.BYTES_PER_ELEMENT,\n};\n\nexport type GLGeometryOptions = {\n drawStart: number,\n drawCount: number,\n attributes: { [key: string]: AttributeWithType },\n buffers: { [key: string]: GPUBufferOptions },\n mode: GLenum,\n index?: GPUBufferOptions,\n name: string,\n vaoMap?: Record<string, GLVertexArrayObject | undefined>,\n};\n\n/**\n * GLGeometry对象,保存GLGPUBuffer对象。\n *\n */\nexport class GLGeometry {\n\n name?: string;\n\n renderer?: GLGPURenderer | undefined;\n\n drawStart: number;\n\n drawCount: number;\n\n mode: GLenum;\n\n indexBufferType: GLenum;\n\n // 记录顶点属性信息用于GLProgram绑定顶点属性\n attributes: { [key: string]: AttributeWithType };\n\n // 记录了顶点属性与GPUBuffer对应关系\n _buffersMap: { [key: string]: GLGPUBuffer };\n\n // 索引缓冲区\n _indexBuffer?: GLGPUBuffer;\n\n readonly vaoMap: Record<string, GLVertexArrayObject | undefined>;\n\n constructor (option: GLGeometryOptions | GLGeometry, renderer: GLGPURenderer) {\n\n this.renderer = renderer;\n\n this.drawStart = option.drawStart;\n\n this.drawCount = option.drawCount;\n\n this.mode = isNaN(option.mode) ? constants.TRIANGLES : option.mode;\n\n this.name = option.name;\n\n const buffers: { [key: string]: GLGPUBuffer } = {};\n\n const inAttributes = option.attributes;\n const attributes: { [key: string]: AttributeWithType } = {};\n\n if (option instanceof GLGeometry) {\n forEach(option._buffersMap, function (buffer, name) {\n buffers[name] = buffer;\n });\n } else {\n // 创建GPUBuffer\n forEach(option.buffers, function (opt, name) {\n buffers[name] = new GLGPUBuffer(opt, renderer);\n });\n if (option.index && option.index.data) {\n const ret = this.createIndexBuffer(option.index.data as Uint16Array, renderer);\n\n this.setIndexBuffer(ret[0], ret[1]);\n }\n }\n\n this._buffersMap = buffers;\n // 记录顶点属性\n forEach(inAttributes, function (attribute, name) {\n attributes[name] = attribute;\n });\n this.attributes = attributes;\n\n this.vaoMap = {};\n }\n\n createVao (name: string) {\n if (!this.vaoMap[name]) {\n this.vaoMap[name] = createVAO(this.renderer as GLGPURenderer, `${this.name}-${name}`);\n }\n\n return this.vaoMap[name] as GLVertexArrayObject;\n }\n\n destroyVao (name: string) {\n this.vaoMap[name]?.destroy();\n this.vaoMap[name] = undefined;\n }\n\n setIndexBuffer (buffer: GLGPUBuffer, indexBufferType: GLenum) {\n this._indexBuffer = buffer;\n this.indexBufferType = indexBufferType;\n }\n\n createIndexBuffer (data: Uint16Array | Uint32Array | Uint8Array, renderer: GLGPURenderer): [buffer: GLGPUBuffer, type: GLenum] {\n const type = INDEX_TYPE_MAP[data.BYTES_PER_ELEMENT];\n const indexOption: GPUBufferOptions = {\n data,\n target: constants.ELEMENT_ARRAY_BUFFER,\n name: `${this.name}##index`,\n };\n\n return [new GLGPUBuffer(indexOption, renderer), type];\n }\n\n getGPUBuffer (name: string | number): GLGPUBuffer | null {\n return this._buffersMap[name];\n }\n\n destroy (): void {\n if (this.renderer) {\n forEach(this._buffersMap, function (buffer) {\n buffer.destroy();\n });\n this._buffersMap = {};\n this._indexBuffer?.destroy();\n const m = this.vaoMap;\n\n forEach(m, function (vao, key) {\n vao?.destroy();\n m[key] = undefined;\n });\n }\n this.attributes = {};\n this._indexBuffer = undefined;\n this.renderer = undefined;\n }\n\n setAttributeBuffer (name: string, buffer: GPUBuffer): void {\n this._buffersMap[name] = buffer as GLGPUBuffer;\n // update vao bind\n }\n\n getAttributeBuffer (name: string): GPUBuffer | null {\n if (this._buffersMap != undefined) {\n return this._buffersMap[name];\n }\n\n return null;\n }\n\n draw (state: RenderState) {\n const index = this._indexBuffer;\n const gl = this.renderer?.gl as WebGL2RenderingContext;\n const gpu = this.renderer?.gpu;\n const useInstancedDraw = gpu?.capability.instanceDraw && (state.currentMesh as InstancedMesh).instanceCount > 0;\n\n if (gl && gpu) {\n const drawCount = this.drawCount;\n\n if (index) {\n const type = this.indexBufferType;\n //bind by vao\n //this._indexBuffer?.bind();\n const dc = isNaN(drawCount) ? index.getElementCount(TYPE_BYTE_MAP[type]) : drawCount;\n\n if (dc > 0) {\n if (useInstancedDraw) {\n gpu.drawElementsInstanced(gl, this.mode, dc, type, this.drawStart || 0, (state.currentMesh as InstancedMesh).instanceCount);\n } else {\n gl.drawElements(this.mode, dc, type, this.drawStart || 0);\n }\n }\n } else if (drawCount > 0) {\n if (useInstancedDraw) {\n gpu.drawArraysInstanced(gl, this.mode, this.drawStart, this.drawCount, (state.currentMesh as InstancedMesh).instanceCount);\n } else {\n gl.drawArrays(this.mode, this.drawStart, this.drawCount);\n }\n }\n }\n }\n}\n","import type { Immutable, TypedArray } from '../../types/type';\nimport type {\n Geometry,\n GeometryOptions,\n AttributeWithData,\n AttributeWithType,\n Attribute,\n} from '../../types/Geometry';\nimport type { GPUBuffer, GPUBufferOptions } from '../../types/GPUBuffer';\nimport { GLGeometry } from '../webgl/GLGeometry';\nimport { constants } from '../webgl/constants';\nimport { forEach, throwDestroyedError } from '../common/utils';\nimport type { GLGPUBuffer } from '../webgl/GLGPUBuffer';\nimport type { MarsRenderer } from './MarsRenderer';\n\nconst BYTES_TYPE_MAP = {\n [constants.FLOAT]: Float32Array.BYTES_PER_ELEMENT,\n [constants.INT]: Int32Array.BYTES_PER_ELEMENT,\n [constants.SHORT]: Int16Array.BYTES_PER_ELEMENT,\n [constants.BYTE]: Int8Array.BYTES_PER_ELEMENT,\n};\n\ntype BufferDirtyFlag = {\n dirty: boolean,\n discard?: boolean,\n start?: number,\n end?: number,\n};\n\nfunction isIndexDataType (data: any): boolean {\n const result = (data instanceof Uint8Array) || (data instanceof Uint16Array) ||\n (data instanceof Uint32Array);\n\n return result;\n}\n\nfunction attributeData2GLType (data: Float32Array | Int32Array | Int16Array | Uint16Array | Uint32Array | unknown): number {\n if (data instanceof Float32Array) {\n return constants.FLOAT;\n } else {\n return constants.INT;\n }\n}\n\nfunction emptyTypedArrayByGLType (type: number): Float32Array | Int32Array | Int16Array {\n if (type === constants.INT) {\n return new Int32Array(0);\n }\n if (type === constants.SHORT) {\n return new Int16Array(0);\n }\n\n return new Float32Array(0);\n}\n\n// 根据attribute的datasource获取js端buffer\nfunction getAttributeBufferOption (geom: MarsGeometry, name: string): GPUBufferOptions | undefined {\n const attribute = geom._attributes[name];\n\n if (attribute) {\n return geom._buffers[attribute.dataSource];\n }\n\n return undefined;\n}\n\nlet seed = 1;\n\n/**\n * 应用层Geometry对象,本身不直接保存GPU资源而是通过geometryInternal成员保存GPU资源。\n *\n */\nexport class MarsGeometry implements Geometry {\n\n renderer?: MarsRenderer;\n\n // JS端记录数据,用于flush\n _buffers: { [key: string]: GPUBufferOptions };\n\n // 用于创建internal geometry\n _attributes: Record<string, AttributeWithType>;\n\n _attributesReleasable: { [key: string]: boolean };\n\n _attributesName: string[] = [];\n\n // 记录SubData的变更范围\n _dirtyFlags: { [key: string]: BufferDirtyFlag };\n\n _index?: Uint16Array | Uint32Array;\n _indexReleasable = false;\n\n // 与底层图形相关的Geometry对象\n readonly internal!: GLGeometry;\n\n readonly options?: GeometryOptions;\n\n readonly name: string;\n protected _drawCount: number;\n protected _drawStart: number;\n protected _mode: number;\n protected _isDestroyed = false;\n\n indexDataType: Geometry['indexDataType'];\n\n get isDestroyed (): boolean {\n return this._isDestroyed;\n }\n\n get mode (): number {\n return this._mode;\n }\n\n set mode (n: number) {\n this._mode = n;\n if (this.internal) {\n this.internal.mode = n;\n }\n }\n\n get attributes (): Immutable<{ [key: string]: Attribute }> {\n return this._attributes;\n }\n\n get drawCount (): number {\n return this._drawCount;\n }\n\n set drawCount (n: number | undefined) {\n this._drawCount = +(n as number);\n if (this.internal) {\n this.internal.drawCount = +(n as number);\n }\n }\n\n get drawStart () {\n return this._drawStart;\n }\n\n set drawStart (n: number) {\n this._drawStart = n;\n if (this.internal) {\n this.internal.drawStart = n;\n }\n }\n\n constructor (option: GeometryOptions) {\n this._drawStart = option.drawStart ? option.drawStart : 0;\n this._drawCount = isNaN(+(option.drawCount as number)) ? NaN : (option.drawCount as number);\n this._mode = (isNaN(option.mode as number) ? constants.TRIANGLES : option.mode) as number;\n this.name = option.name || ('MarsGeometry:' + seed++);\n const usage = option.bufferUsage || constants.STATIC_DRAW;\n\n this.options = option;\n // 记录顶点属性,需要与Shader中attribute进行关联\n const buffers: { [key: string]: GPUBufferOptions } = {};\n const attributesName: string[] = [];\n const attributes: { [key: string]: AttributeWithType } = {};\n // key为buffer的名字\n const dirtyFlags: { [key: string]: BufferDirtyFlag } = {};\n const attributesReleasable: { [key: string]: boolean } = {};\n\n forEach(option.attributes, function (attr, name) {\n let data = (attr as AttributeWithData).data;\n const type = attr.type || constants.FLOAT;\n const releasable = (attr as AttributeWithData).releasable;\n\n if (type && !(attr as AttributeWithType).dataSource && !data) {\n data = emptyTypedArrayByGLType(type);\n }\n if (data) {\n // 使用AttributeWithData构造的attribute\n buffers[name] = {\n data, usage, name,\n };\n const gltype = attributeData2GLType(data);\n\n attributes[name] = {\n size: attr.size,\n stride: attr.stride,\n offset: attr.offset,\n type: type || gltype,\n normalize: !!attr.normalize,\n dataSource: (name),\n instanceDivisor:attr.instanceDivisor,\n };\n attributesReleasable[name] = releasable || false;\n dirtyFlags[name] = {\n dirty: true,\n discard: true,\n start: Number.POSITIVE_INFINITY,\n end: 0,\n };\n } else {\n // 使用AttributeWithType构造的attribute\n const datasource = (attr as AttributeWithType).dataSource;\n\n if (datasource) {\n // 属性共享buffer\n attributes[name] = {\n size: attr.size,\n stride: attr.stride,\n offset: attr.offset,\n type: type,\n dataSource: datasource,\n normalize: !!attr.normalize,\n };\n }\n }\n attributesName.push(name);\n });\n\n // 顶点索引\n this._index = option.index?.data;\n if ((this._index as any) instanceof Uint8Array) {\n throw Error('Uint8 Index not support');\n }\n dirtyFlags['index'] = {\n dirty: true,\n discard: true,\n start: Number.POSITIVE_INFINITY,\n end: 0,\n };\n\n this._indexReleasable = option.index?.releasable === true;\n\n this._buffers = buffers;\n this._attributes = attributes;\n this._attributesName = attributesName;\n this._attributesReleasable = attributesReleasable;\n this._dirtyFlags = dirtyFlags;\n }\n\n destroy (): void {\n this.drawStart = 0;\n this.drawCount = NaN;\n // @ts-expect-error destroyed set null\n this._buffers = undefined;\n\n // @ts-expect-error destroyed set null\n this.options = undefined;\n\n this._attributes = {};\n this._attributesName = [];\n\n if (this.internal) {\n this.internal.destroy();\n // @ts-expect-error destroyed set null\n this['internal'] = undefined;\n this.renderer = undefined;\n }\n this.assignRenderer = throwDestroyedError as unknown as (r: MarsRenderer) => MarsGeometry;\n this._isDestroyed = true;\n }\n\n // 出入GPUBuffer对象,\n setAttributeBuffer (name: string, buffer: GPUBuffer): void {\n if (this.internal == undefined) { return; }\n const gpuBuffers = this.internal._buffersMap;\n const gpuBufferName = this._attributes[name].dataSource;\n\n if (gpuBuffers[gpuBufferName]) {\n gpuBuffers[gpuBufferName] = buffer as GLGPUBuffer;\n } else {\n // to do\n }\n }\n\n getAttributeBuffer (name: string): GPUBuffer | undefined {\n if (this.internal == undefined) { return undefined; }\n const gpuBuffers = this.internal._buffersMap;\n const gpuBufferName = this._attributes[name].dataSource;\n\n return gpuBuffers[gpuBufferName];\n }\n\n setAttributeData (name: string, data: TypedArray): void {\n const buffers = this._buffers;\n\n if (buffers == undefined) { return; }\n\n const gpuBufferOption = getAttributeBufferOption(this, name);\n const gpuBufferName = this._attributes[name].dataSource;\n\n if (gpuBufferOption) {\n const option: GPUBufferOptions = {\n data: data,\n usage: gpuBufferOption.usage,\n target: gpuBufferOption.target,\n };\n\n buffers[gpuBufferName] = option;\n this._dirtyFlags[gpuBufferName].discard = true;\n this._dirtyFlags[gpuBufferName].dirty = true;\n }\n }\n\n getAttributeData (name: string): TypedArray | undefined {\n const buffers = this._buffers;\n\n if (buffers == undefined) { return; }\n\n const gpuBufferOption = getAttributeBufferOption(this, name);\n\n if (gpuBufferOption) {\n return gpuBufferOption.data;\n }\n\n return undefined;\n }\n\n setAttributeSubData (name: string, offset: number, data: TypedArray): void {\n const buffers = this._buffers;\n\n if (buffers == undefined) { return; }\n\n const gpuBufferOption = getAttributeBufferOption(this, name);\n\n if (gpuBufferOption) {\n const attribute = gpuBufferOption;\n\n if (attribute.data != undefined) {\n const start = offset;\n const length = offset + data.length;\n\n // this._dirtyFlags[name].discard = false;\n if (attribute.data.length < length) {\n // @ts-expect-error safe to use\n const newData = new data.constructor(length);\n\n newData.set(attribute.data);\n attribute.data = newData;\n this._dirtyFlags[name].discard = true;\n } else if (!this._dirtyFlags[name].discard) {\n const dirtyFlag = this._dirtyFlags[name];\n\n dirtyFlag.start = Math.min(dirtyFlag.start as number, start);\n dirtyFlag.end = Math.max(dirtyFlag.end as number, length - 1);\n }\n (attribute.data as TypedArray).set(data, start);\n this._dirtyFlags[name].dirty = true;\n }\n } else {\n // to do\n }\n }\n\n getIndexData (): Uint16Array | Uint32Array | undefined {\n return this._index;\n }\n\n setIndexData (data: Uint16Array | Uint32Array | undefined): void {\n if (isIndexDataType(data)) {\n this._index = data as any;\n this._dirtyFlags['index'].discard = true;\n this._dirtyFlags['index'].dirty = true;\n }\n }\n\n setIndexSubData (offset: number, data: TypedArray): void {\n if (this._index) {\n // this._dirtyFlags['index'].discard = false;\n const start = offset;\n const length = offset + data.length;\n\n if (this._index.length < length) {\n // @ts-expect-error safe to use\n const newData = new data.constructor(end);\n\n newData.set(this._index);\n this._index = newData;\n this._dirtyFlags['index'].discard = true;\n } else if (!this._dirtyFlags['index'].discard) {\n const dirtyFlag = this._dirtyFlags['index'];\n\n dirtyFlag.start = Math.min(dirtyFlag.start as number, start);\n dirtyFlag.end = Math.max(dirtyFlag.end as number, length - 1);\n }\n this._index?.set(data, start);\n this._dirtyFlags['index'].dirty = true;\n }\n }\n\n getAttributeStride (name: string): number {\n const attr = this._attributes[name];\n\n if (attr.stride) {\n return attr.stride;\n }\n\n return attr.size * BYTES_TYPE_MAP[attr.type];\n }\n\n getAttributeDataLength (name: string): number {\n if (this._buffers) {\n const gpuBufferOption = getAttributeBufferOption(this, name);\n\n if (gpuBufferOption) {\n return gpuBufferOption.data?.length as number;\n }\n }\n\n return 0;\n }\n\n getAttributeNames (): string[] {\n return this._attributesName;\n }\n\n assignRenderer (renderer: MarsRenderer): MarsGeometry {\n if (!this.internal) {\n // 索引缓冲区参数\n let indexBufferOption: GPUBufferOptions | undefined = undefined;\n\n if (this._index) {\n const data = this._index;\n\n indexBufferOption = {\n data: data,\n usage: constants.STATIC_DRAW,\n };\n if (data instanceof Uint16Array) {\n this.indexDataType = constants.UNSIGNED_SHORT;\n } else if (data instanceof Uint32Array) {\n this.indexDataType = constants.UNSIGNED_INT;\n }\n }\n\n // 顶点属性参数\n const options = {\n drawStart: this.drawStart,\n drawCount: this.drawCount,\n // 传给GLGeometry用于绑定顶点属性\n attributes: this._attributes,\n buffers: this._buffers,\n mode: this.mode,\n index: indexBufferOption,\n indexDataType:this.indexDataType,\n name: this.name,\n };\n\n //@ts-expect-error safe to set\n this['internal'] = new GLGeometry(options, renderer.internal);\n this.renderer = renderer;\n this.flush();\n //@ts-expect-error safe to set\n this.options = undefined;\n }\n\n return this;\n }\n\n flush (): boolean {\n const internal = this.internal;\n\n if (internal) {\n const attributes = this._attributes;\n const attributesBuffer = this._buffers;\n const indexBuffer = this._index;\n\n forEach(this._dirtyFlags, function (flag, name) {\n let gpuBuffer;\n let data;\n\n if (name == 'index') {\n gpuBuffer = internal._indexBuffer;\n data = indexBuffer;\n } else {\n const bufferName = attributes[name].dataSource;\n\n gpuBuffer = internal.getGPUBuffer(bufferName) as GLGPUBuffer;\n data = attributesBuffer[bufferName].data;\n }\n\n if ((flag.dirty || flag.discard) && gpuBuffer && data) {\n if (flag.discard) {\n gpuBuffer.bufferData(data);\n } else {\n const offset = (flag.start as number) * data.BYTES_PER_ELEMENT + data.byteOffset;\n const length = (flag.end as number) - (flag.start as number) + 1;\n // @ts-expect-error safe to use\n const subData = new data.constructor(data.buffer, offset, length);\n\n gpuBuffer.bufferSubData(flag.start as number, subData);\n }\n flag.start = Number.POSITIVE_INFINITY;\n flag.end = 0;\n flag.dirty = flag.discard = false;\n }\n });\n\n // 需要释放的attributes数据\n forEach(this._attributesReleasable, function (releasable, name) {\n const bufferName = attributes[name].dataSource;\n\n if (attributesBuffer[bufferName] && releasable) {\n attributesBuffer[bufferName].data = undefined;\n }\n });\n\n // 释放indexbuffer\n if (this._indexReleasable) {\n this._index = undefined;\n }\n }\n\n return false;\n }\n}\n","import type {\n GeometriesMeshOptions, GeometryMeshOptions, InstancedMeshOptions, Mesh, MeshDestroyOptions, MeshOptions,\n} from '../../types/Mesh';\nimport { MarsMaterial } from './MarsMaterial';\nimport { MarsGeometry } from './MarsGeometry';\nimport type { GeometryOptions } from '../../types/Geometry';\nimport type { Material, MaterialDestroyOptions, MaterialOptions } from '../../types/Material';\nimport type { MarsRenderer } from './MarsRenderer';\nimport { DestroyOptions } from '../../types/constants';\nimport { consoleError } from '../common/console';\nimport { throwDestroyedError } from '../common/utils';\nimport type { InstancedMesh } from '../../types/Mesh';\n\nlet seed = 1;\n\nexport class MarsMesh implements Mesh {\n\n readonly material: MarsMaterial;\n\n readonly geometries: MarsGeometry[];\n\n readonly name: string;\n\n public priority: number;\n\n public hide: boolean;\n\n public renderer?: MarsRenderer;\n\n private _isDestroyed = false;\n\n get isDestroyed (): boolean {\n return this._isDestroyed;\n }\n\n get geometry () {\n return this.geometries[0];\n }\n\n constructor (options: MeshOptions, renderer?: MarsRenderer) {\n this.material = options.material instanceof MarsMaterial ? options.material : new MarsMaterial(options.material as MaterialOptions);\n const geo = (options as GeometryMeshOptions).geometry;\n\n if (geo) {\n this.geometries = [geo instanceof MarsGeometry ? geo : new MarsGeometry(geo as GeometryOptions)];\n } else if ((options as GeometriesMeshOptions).geometries) {\n this.geometries = (options as GeometriesMeshOptions).geometries.map(geo => geo instanceof MarsGeometry ? geo : new MarsGeometry(geo as GeometryOptions));\n } else {\n this.geometries = [];\n }\n this.name = options.name || ('MarsMesh_' + seed++);\n this.priority = options.priority || 0;\n this.hide = false;\n if (renderer) {\n this.assignRenderer(renderer);\n }\n }\n\n setMaterial (mtl: Material | MaterialOptions, destroyMtl?: MaterialDestroyOptions | DestroyOptions.keep) {\n if (destroyMtl !== DestroyOptions.keep) {\n this.material.destroy(destroyMtl);\n }\n //@ts-expect-error set from internal safely\n this.material = mtl instanceof MarsMaterial ? mtl : new MarsMaterial(mtl as MaterialOptions);\n if (this.renderer) {\n this.material.assignRenderer(this.renderer);\n }\n }\n\n setGeometries (geos: MarsGeometry[], destroyGeometries?: DestroyOptions) {\n const arr = this.geometries;\n\n if (destroyGeometries !== DestroyOptions.keep) {\n arr.forEach(g => g.destroy());\n }\n arr.length = 0;\n const r = this.renderer;\n\n geos.forEach(g => {\n if (r) {\n g.assignRenderer(r);\n }\n arr.push(g);\n });\n }\n\n destroy (options?: MeshDestroyOptions) {\n if (this._isDestroyed) {\n consoleError('call mesh.destroy multiple times', this);\n }\n if (options?.geometries !== DestroyOptions.keep) {\n this.geometries.forEach(element => {\n element.destroy();\n });\n }\n this.geometries.length = 0;\n const materialDestroyOption = options?.material;\n\n if (materialDestroyOption !== DestroyOptions.keep && this.material) {\n this.material.destroy(materialDestroyOption);\n // @ts-expect-error safe to assign\n this['material'] = undefined;\n }\n this.assignRenderer = throwDestroyedError as unknown as (r: MarsRenderer) => MarsMesh;\n this._isDestroyed = true;\n }\n\n assignRenderer (renderer: MarsRenderer): MarsMesh {\n this.geometries.forEach(element => {\n element.assignRenderer(renderer);\n });\n\n if (!this.material.materialInternal) {\n this.material.assignRenderer(renderer);\n }\n this.renderer = renderer;\n\n return this;\n }\n}\n\nexport class MarsInstancedMesh extends MarsMesh implements InstancedMesh {\n instanceCount: number;\n constructor (options: InstancedMeshOptions, renderer?: MarsRenderer) {\n super(options, renderer);\n this.instanceCount = options.instanceCount;\n }\n}\n","import type {\n RendererExtensions, RenderPass, RenderState, SharedShaderWithSource, Texture,\n} from '../../types';\nimport {\n TextureLoadAction, TextureSourceType,\n} from '../../types';\nimport type { MarsTexture } from './MarsTexture';\nimport type { MarsRenderer } from './MarsRenderer';\nimport { MarsRenderPass } from './MarsRenderPass';\nimport type { GLFrameBuffer } from '../webgl/GLFrameBuffer';\nimport type { GLTexture } from '../webgl/GLTexture';\nimport { RenderFrameInternal } from './RenderFrameInternal';\nimport { constants } from '../webgl/constants';\nimport { MarsMesh } from './MarsMesh';\n\nconst copyShaderId = '$mri-internal-copy';\n\nexport class MarsExtWrap implements RendererExtensions {\n _copyRenderPass?: MarsRenderPass;\n renderer?: MarsRenderer;\n\n constructor (renderer: MarsRenderer) {\n this.renderer = renderer;\n if (renderer?.gpu.level === 1) {\n this._copyRenderPass = this._createCopyRenderPass().assignRenderer(renderer);\n const shader = this._copyRenderPass.meshes[0].material.options.shader;\n\n renderer.shaderLibrary.addShader(shader as SharedShaderWithSource);\n renderer.shaderLibrary.compileShader(copyShaderId);\n }\n }\n\n resetColorAttachments (rp: RenderPass, colorTextures: Texture[]) {\n const r = this.renderer;\n\n if (r) {\n (rp as MarsRenderPass).resetColorAttachments(colorTextures as MarsTexture[]);\n }\n }\n\n copyTexture (source: Texture, tex: Texture): void {\n const renderer = this.renderer;\n\n if (renderer) {\n source.assignRenderer(renderer);\n tex.assignRenderer(renderer);\n tex.updateSource({\n sourceType: TextureSourceType.framebuffer,\n data: {\n width: tex.width || source.width,\n height: tex.height || source.height,\n },\n });\n if (renderer.gpu.level === 2) {\n this.copy2(source as MarsTexture, tex as MarsTexture);\n } else {\n this.copy1(source as MarsTexture, tex as MarsTexture);\n }\n }\n\n }\n\n copy2 (source: MarsTexture, target: MarsTexture) {\n this.renderer?.internal.copy2(source.internal as GLTexture, target.internal as GLTexture);\n }\n\n copy1 (source: MarsTexture, target: MarsTexture) {\n const rp = this._copyRenderPass;\n\n if (rp) {\n const renderer = this.renderer;\n\n if (renderer) {\n const fb = rp.frameBuffer as GLFrameBuffer;\n\n fb.viewport[2] = target.width || source.width;\n fb.viewport[3] = target.height || source.height;\n renderer.internal.resetColorAttachments(fb, [target.internal as GLTexture]);\n const mesh = rp.meshes[0];\n\n mesh.material.defaultDataBlock.setUniformTexture('uTex', source);\n RenderFrameInternal.renderRenderPass(renderer, rp, { currentFrame: {} } as RenderState);\n }\n }\n }\n\n _createCopyRenderPass (): MarsRenderPass {\n const name = 'mri-copy-mesh';\n\n return new MarsRenderPass({\n name: 'mri-copy-rp',\n loadAction: {\n colorAction: TextureLoadAction.whatever,\n },\n attachments: [{ texture: { format: constants.RGBA } }],\n meshes: [new MarsMesh({\n name,\n priority: 0,\n geometry: {\n name,\n mode: constants.TRIANGLE_STRIP,\n attributes: {\n aPos: {\n type: constants.FLOAT,\n size: 2,\n data: new Float32Array([-1, 1, -1, -1, 1, 1, 1, -1]),\n },\n },\n drawCount: 4,\n },\n material: {\n states: {\n depthTest: false,\n cullFaceEnabled: false,\n stencilTest: false,\n },\n name,\n shader: {\n cacheId: copyShaderId,\n name,\n vertex: `precision highp float;\n attribute vec2 aPos;varying vec2 vTex;\n void main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.))/2.;\n }\n `,\n fragment: ` precision highp float;\n varying vec2 vTex;\n uniform sampler2D uTex;\n void main(){gl_FragColor = texture2D(uTex,vTex);}\n `,\n },\n },\n })],\n });\n }\n\n destroy () {\n if (this.renderer) {\n this._copyRenderPass?.meshes[0].material.defaultDataBlock.setUniformValue('uTex', undefined);\n this._copyRenderPass?.destroy();\n this.renderer = undefined;\n }\n }\n}\n","import type {\n GPUBuffer,\n GPUBufferOptions,\n GPUCapability,\n GPURenderer,\n RendererOptions,\n RenderFrameOptions,\n ShaderLibrary,\n} from '../../types';\nimport { GPUCapabilityEmpty } from '../../types/GPUCapability';\nimport { ShaderLibraryEmpty } from '../../types/ShaderLibrary';\nimport { GLGPURenderer } from '../webgl/GLGPURenderer';\nimport { GLGPUBuffer } from '../webgl/GLGPUBuffer';\nimport { MarsRenderFrame } from './MarsRenderFrame';\nimport { getDefaultGPUCapability } from './MarsGPUCapability';\nimport { GLGPUCapability } from '../webgl/GLGPUCapability';\nimport type { Canvas } from '../../types/Canvas';\nimport { CanvasEmpty } from '../../types/Canvas';\nimport { MarsExtWrap } from './MarsExtWrap';\nimport { consoleError } from '../common/console';\n\nconst ERR_EXP = 'WebGL not available';\n\nexport class MarsRenderer implements GPURenderer {\n readonly gpu: GPUCapability;\n readonly shaderLibrary: ShaderLibrary;\n readonly internal!: GLGPURenderer;\n readonly canvas!: Canvas;\n readonly extension: MarsExtWrap;\n\n get isDestroyed () {\n const internal = this.internal;\n\n return internal ? internal.isDestroyed : true;\n }\n\n get height () {\n return this.internal?.height || 0;\n }\n\n get width () {\n return this.internal?.width || 0;\n }\n\n constructor (options: RendererOptions) {\n let gl: WebGLRenderingContext | WebGL2RenderingContext = options.gl as WebGLRenderingContext | WebGL2RenderingContext;\n\n if (!gl) {\n const webglOptions = {\n preserveDrawingBuffer: options.willCaptureImage,\n alpha: true,\n stencil: true,\n antialias: true,\n depth: true,\n premultipliedAlpha: true,\n };\n const canvas = options.canvas;\n\n if (canvas) {\n const frameworks = options.frameworks || [getDefaultGPUCapability().type as 'webgl'];\n\n for (let i = 0; i < frameworks.length; i++) {\n gl = canvas?.getContext(frameworks[i], webglOptions) as WebGLRenderingContext;\n if (gl) {\n break;\n }\n }\n }\n }\n if (gl) {\n this.gpu = new GLGPUCapability({ gl });\n this.internal = new GLGPURenderer(gl);\n this.shaderLibrary = this.internal.shaderLibrary;\n this.canvas = gl.canvas;\n } else {\n this.gpu = new GPUCapabilityEmpty();\n this.shaderLibrary = new ShaderLibraryEmpty();\n this.canvas = new CanvasEmpty();\n consoleError(ERR_EXP);\n }\n this.extension = new MarsExtWrap(this);\n }\n\n createBuffer (options: GPUBufferOptions): GPUBuffer {\n const internal = this.internal;\n\n if (!internal) {\n throw Error(ERR_EXP);\n }\n\n return new GLGPUBuffer(options, internal);\n }\n\n createRenderFrame (options?: RenderFrameOptions): MarsRenderFrame {\n return new MarsRenderFrame(options || {}, this);\n }\n\n destroy (haltGL?: boolean): void {\n this.extension.destroy();\n this.internal?.destroy(haltGL);\n // @ts-expect-error safe to assign\n this.gpu = new GPUCapabilityEmpty();\n // @ts-expect-error safe to assign\n this.shaderLibrary = new ShaderLibraryEmpty();\n }\n\n resize (width: number, height: number): void {\n const internal = this.internal;\n\n if (internal) {\n if (this.width !== width || this.height !== height) {\n internal.resize(width, height);\n }\n }\n }\n\n cancelAnimationFrame (id: number): void {\n return window.cancelAnimationFrame(id);\n }\n\n getErrors (): string[] {\n const gl = this.internal.gl;\n const err = gl.getError();\n\n if (err) {\n return ['webgl error:' + err];\n }\n\n return [];\n }\n\n invalid () {\n }\n\n requestAnimationFrame (cb: FrameRequestCallback): number {\n return window.requestAnimationFrame(cb);\n }\n}\n","import { MarsGeometry } from './MarsGeometry';\nimport type { GeometryOptions, SharedGeometry, SharedGeometryOptions } from '../../types';\nimport { GLGeometry } from '../webgl/GLGeometry';\nimport type { MarsRenderer } from './MarsRenderer';\nimport { forEach } from '../common/utils';\n\nexport class MarsSharedGeometry extends MarsGeometry implements SharedGeometry {\n private readonly _source: MarsGeometry;\n\n renderer!: MarsRenderer;\n\n constructor (opt: SharedGeometryOptions, renderer?: MarsRenderer) {\n super(Object.assign({ attributes: {} }, opt) as GeometryOptions);\n let indexData = opt.index ? opt.index.data : opt.geometry.getIndexData();\n\n if (indexData) {\n //@ts-expect-error safe to assign\n indexData = new indexData.constructor(indexData) as Uint16Array;\n }\n this._index = indexData;\n this._source = opt.geometry as MarsGeometry;\n this._drawCount = opt.drawCount || 0;\n this._drawStart = opt.drawStart || 0;\n this._mode = opt.mode || 0;\n forEach(this._source._attributes, (attr, name) => {\n this._attributes[name] = Object.assign({}, attr);\n });\n if (renderer) {\n this.assignRenderer(renderer);\n }\n }\n\n assignRenderer (renderer: MarsRenderer): MarsSharedGeometry {\n if (!this.renderer) {\n const geometry = this._source;\n\n geometry.assignRenderer(renderer);\n const internal = geometry.internal;\n const glgeo = new GLGeometry(internal, renderer.internal);\n\n glgeo.drawCount = this.drawCount;\n glgeo.drawStart = this.drawStart;\n glgeo.mode = this.mode;\n if (this._index) {\n const ret = glgeo.createIndexBuffer(this._index, renderer.internal);\n\n glgeo.setIndexBuffer(ret[0], ret[1]);\n }\n //@ts-expect-error safe to assign\n this.internal = glgeo;\n this.renderer = geometry.renderer as MarsRenderer;\n }\n\n return this;\n }\n\n getAttributeNames (): string[] {\n return this._source.getAttributeNames();\n }\n\n getAttributeDataLength (name: string): number {\n if (this._buffers[name]) {\n return super.getAttributeDataLength(name);\n }\n\n return this._source.getAttributeDataLength(name);\n }\n\n flush (): boolean {\n this._source.flush();\n\n return super.flush();\n }\n\n destroy () {\n if (this.internal) {\n //@ts-expect-error safe to assign\n this.internal.vaoMap = {};\n }\n super.destroy();\n }\n\n}\n","import { consoleLog } from './common/console';\n\nexport * from '../types/constants';\nexport * from '../types/RenderPass';\nexport * from '../types/Texture';\nexport * from '../types/GPUBuffer';\nexport { constants } from './webgl/constants';\nexport * from '../types/ShaderLibrary';\nexport { MarsRenderFrame as RenderFrame } from './render/MarsRenderFrame';\nexport { MarsRenderer as Renderer } from './render/MarsRenderer';\nexport { MarsMesh as Mesh, MarsInstancedMesh as InstancedMesh } from './render/MarsMesh';\nexport { MarsGeometry as Geometry } from './render/MarsGeometry';\nexport { MarsRenderPass as RenderPass } from './render/MarsRenderPass';\nexport { MarsTexture as Texture } from './render/MarsTexture';\nexport { MarsMaterial as Material } from './render/MarsMaterial';\nexport { MarsMaterialDataBlock as MaterialDataBlock } from './render/MarsMaterialDataBlock';\nexport { MarsSharedGeometry as SharedGeometry } from './render/MarsSharedGeometry';\nexport { getDefaultGPUCapability } from './render/MarsGPUCapability';\nexport { getDefaultTextureFactory, setDefaultTextureFactory, MarsTextureFactory } from './render/MarsTextureFactory';\n\nconsoleLog('version: ' + __VERSION__);\n\nexport const ModuleMsg = 'RI Package: @predy-js/render-interface';\n","import * as RI from './module';\nexport * from './module';\n\nif (typeof window === 'object') {\n (window as any).PredyRI = RI;\n} else if (typeof global === 'object') {\n (global as any).PredyRI = RI;\n}\n"],"names":["DestroyOptions","RenderPassDestroyAttachmentType","TextureLoadAction","TextureStoreAction","RenderPassAttachmentStorageType","RenderPassMeshOrder","TextureSourceType","_a","_b","ShaderCompileResultStatus","imageBitMapAvailable","g","seed"],"mappings":";;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,aAAa,GAAG,SAAS,CAAC,EAAE,C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AAC,IAAI,CAAC,EAAE;AACvB,YAAA,OAAO,MAAM,CAAA,SAAA,CAAA,sBAAsB,CAAC,IAAA,CAAA,IAAA,EAAA,IAAI,CAAC,CAAC;AAC3C,SAAA;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;KAClD,CAAA;AAED,IAAA,kBAAA,CAAA,SAAA,CAAA,KAAK,GAAL,YAAA;AACE,QAAA,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QAErB,OAAO,MAAA,CAAA,SAAA,CAAM,KAAK,CAAA,IAAA,CAAA,IAAA,CAAE,CAAC;KACtB,CAAA;AAED,IAAA,kBAAA,CAAA,SAAA,CAAA,OAAO,GAAP,YAAA;QACE,IAAI,IAAI,CAAC,QAAQ,EAAE;;AAEjB,YAAA,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,EAAE,CAAC;AAC3B,SAAA;QACD,MAAM,CAAA,SAAA,CAAA,OAAO,WAAE,CAAC;KACjB,CAAA;IAEH,OAAC,kBAAA,CAAA;AAAD,CA5EA,CAAwC,YAAY,CA4EnD;;AC9DD,UAAU,CAAC,WAAW,GAAG,cAAW,CAAC,CAAC;AAE/B,IAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACnBzB,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;AAC7B,IAAA,MAAc,CAAC,OAAO,GAAG,EAAE,CAAC;AAC9B,CAAA;AAAM,KAAA,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;AACpC,IAAA,MAAc,CAAC,OAAO,GAAG,EAAE,CAAC;AAC9B;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../node_modules/tslib/tslib.es6.js","../../src/common/console.ts","../../types/constants.ts","../../types/RenderPass.ts","../../types/Texture.ts","../../types/GPUBuffer.ts","../../src/webgl/constants.ts","../../types/ShaderLibrary.ts","../../src/common/utils.ts","../../src/render/RenderFrameInternal.ts","../../src/render/MarsSemanticMap.ts","../../src/render/MarsRenderFrame.ts","../../types/GPUCapability.ts","../../src/webgl/GLGPUBuffer.ts","../../src/webgl/WebGLState.ts","../../src/common/raf.ts","../../src/webgl/glType.ts","../../src/webgl/GLUniformUtils.ts","../../src/webgl/GLProgram.ts","../../src/webgl/GLShaderLibrary.ts","../../src/common/env.ts","../../src/webgl/GLGPUCapability.ts","../../src/webgl/GLTexture.ts","../../src/webgl/GLGPURenderer.ts","../../src/render/MarsGPUCapability.ts","../../types/Canvas.ts","../../types/native/RendererInternal.ts","../../types/native/ResourceInternal.ts","../../types/native/PredyNativeInternal.ts","../../src/webgl/GLRenderBuffer.ts","../../src/webgl/GLFrameBuffer.ts","../../src/common/request.ts","../../src/webgl/KhronosTextureContainer.ts","../../src/render/MarsTextureFactory.ts","../../src/render/MarsTexture.ts","../../src/render/MarsRenderPassColorAttachment.ts","../../src/render/MarsRenderPass.ts","../../src/webgl/GLMaterial.ts","../../src/render/MarsMaterialDataBlock.ts","../../src/render/MarsMaterial.ts","../../src/webgl/GLVertexArrayObject.ts","../../src/webgl/GLGeometry.ts","../../src/render/MarsGeometry.ts","../../src/render/MarsMesh.ts","../../src/render/MarsExtWrap.ts","../../src/render/MarsRenderer.ts","../../src/render/MarsSharedGeometry.ts","../../src/module.ts","../../src/index.ts"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n};\r\n","const prefix = '[Predy RI]';\n\nexport function consoleLog (msg: string, ...data: any[]) {\n console.info(prefix + msg, ...data);\n}\n\nexport function consoleWarn (msg: string, ...data: any[]) {\n console.warn(prefix + msg, ...data);\n}\nexport function consoleError (msg: string, ...data: any[]) {\n console.error(prefix + msg, ...data);\n}\n","export declare const constants: WebGL2RenderingContext;\n\nexport enum DestroyOptions {\n destroy = 0,\n keep = 1,\n force = destroy,\n}\n","import type {\n Texture, TextureConfigOptions, TextureFormatOptions,\n} from './Texture';\nimport type { Mesh, MeshDestroyOptions } from './Mesh';\nimport type { vec4 } from './type';\nimport type { IGPURenderer, IGPUResource } from './IGPURenderer';\nimport type { GPURenderer } from './Renderer';\nimport type { UniformValue } from './Material';\nimport type { GPUBuffer } from './GPUBuffer';\nimport type { RenderState, SemanticFunc } from './RenderFrame';\nimport type { DestroyOptions } from './constants';\n\nexport enum RenderPassDestroyAttachmentType {\n force = 0,\n keep = 1,\n keepExternal = 2,\n destroy = force\n}\n\nexport const RenderPassPriorityPrepare = 0;\nexport const RenderPassPriorityNormal = 1000;\nexport const RenderPassPriorityPostprocess = 3000;\n\nexport enum TextureLoadAction {\n whatever = 0,\n //preserve previous attachment\n load = 1,\n //clear attachment\n clear = 2,\n}\n\nexport enum TextureStoreAction {\n store = 1,\n clear = 0\n}\n\nexport enum RenderPassAttachmentStorageType {\n none = 0,\n color = 1,\n //stencil 8 render buffer\n stencil_8_opaque = 2,\n //stencil 16 render buffer\n depth_16_opaque = 3,\n //depth 16 & stencil 8 render buffer\n depth_stencil_opaque = 4,\n //depth 16 texture, need gpu.capability.readableDepthStencilTextures\n depth_16_texture = 5,\n //depth 24 texture, need gpu.capability.readableDepthStencilTextures\n depth_24_stencil_8_texture = 6,\n\n}\n\nexport interface RenderPassStorageObject {\n readonly attachment: GLenum,\n readonly format: GLenum,\n readonly size: [width: number, height: number],\n readonly storageType: RenderPassAttachmentStorageType,\n readonly multiSample: number,\n}\n\nexport interface RenderPassColorAttachmentTextureOptions extends TextureFormatOptions, TextureConfigOptions {\n}\n\nexport interface RenderPassColorAttachmentOptions {\n // color storage must be texture or textureOptions\n texture?: Texture | RenderPassColorAttachmentTextureOptions,\n storage?: RenderPassStorageObject,\n}\n\nexport interface RenderPassColorAttachment {\n readonly storageType: RenderPassAttachmentStorageType.color,\n readonly texture: Texture,\n readonly isDestroyed: boolean,\n}\n\nexport interface RenderPassDepthStencilAttachment {\n readonly storageType: RenderPassAttachmentStorageType,\n readonly texture?: Texture,\n readonly storage: RenderPassStorageObject,\n}\n\nexport interface RenderPassDepthStencilAttachmentOptions {\n storageType: RenderPassAttachmentStorageType,\n storage?: RenderPassStorageObject,\n texture?: Texture,\n}\n\nexport interface RenderPassStoreAction {\n depthAction?: TextureStoreAction,\n stencilAction?: TextureStoreAction,\n colorAction?: TextureStoreAction,\n}\n\nexport interface RenderPassLoadAction {\n clearColor?: vec4,\n colorAction?: TextureLoadAction,\n clearDepth?: number,\n depthAction?: TextureLoadAction,\n clearStencil?: number,\n stencilAction?: TextureLoadAction,\n}\n\nexport interface RenderPassAttachmentOptions {\n attachments?: RenderPassColorAttachmentOptions[],\n depthStencilAttachment?: RenderPassDepthStencilAttachmentOptions,\n //if viewport not set,it will use viewportScale\n viewport?: [x: number, y: number, width: number, height: number],\n //default 1 , when renderer resize, this attachment will be resized to same scale\n //todo 增加测试:\n // 1.viewport 提供时,忽略此参数,renderPass的尺寸由viewport决定,无论renderer是否变化尺寸\n // 2.viewportScale 默认为1,renderPass的尺寸由renderer的尺寸决定,renderer尺寸变化时,renderPass的尺寸也会变化\n // 3.renderPass的color/depth_stencil attachment尺寸由\n viewportScale?: number,\n //in webgl2 use multisample renderbuffer\n //default is 0, means disabled\n //only enabled in webgl2\n multiSample?: number,\n}\n\nexport type SemanticGetter = UniformValue | SemanticFunc | GPUBuffer | Texture | Texture[];\n\nexport interface RenderPassOptions extends RenderPassAttachmentOptions {\n name?: string,\n meshes?: Mesh[],\n priority?: number,\n meshOrder?: RenderPassMeshOrder,\n loadAction?: RenderPassLoadAction,\n storeAction?: RenderPassStoreAction,\n semantics?: { [key: string]: SemanticGetter },\n delegate?: RenderPassDelegate,\n}\n\nexport enum RenderPassMeshOrder {\n none = 1,\n ascending = 2,\n descending = 3\n}\n\nexport type RenderPassDestroyOptions = {\n meshes?: MeshDestroyOptions | DestroyOptions.keep,\n depthStencilAttachment?: RenderPassDestroyAttachmentType,\n colorAttachment?: RenderPassDestroyAttachmentType,\n semantics?: DestroyOptions,\n};\n\nexport declare class SemanticMap {\n\n constructor (options?: { [key: string]: SemanticGetter });\n\n setSemantic (name: string, value: SemanticGetter | undefined): void;\n\n getSemanticValue (name: string, state: RenderState): UniformValue | GPUBuffer | null | undefined;\n\n hasSemanticValue (name: string): boolean;\n\n toObject (): Record<string, SemanticGetter>;\n\n destroy (): void;\n\n}\n\nexport interface RenderPassDelegate {\n willBeginRenderPass?: (renderPass: RenderPass, state: RenderState) => void,\n didEndRenderPass?: (renderPass: RenderPass, state: RenderState) => void,\n willRenderMesh?: (mesh: Mesh, state: RenderState) => void,\n didRenderMesh?: (mesh: Mesh, state: RenderState) => void,\n}\n\nexport declare class RenderPass implements IGPUResource {\n\n readonly isDestroyed: boolean;\n\n readonly name: string;\n\n readonly priority: number;\n\n readonly attachments: RenderPassColorAttachment[];\n\n readonly depthAttachment?: RenderPassDepthStencilAttachment;\n\n readonly stencilAttachment?: RenderPassDepthStencilAttachment;\n\n readonly viewport: [x: number, y: number, width: number, height: number];\n\n readonly meshes: Mesh[];\n\n readonly renderer?: IGPURenderer;\n\n readonly semantics: SemanticMap;\n\n readonly storeAction: RenderPassStoreAction;\n\n readonly loadAction: RenderPassLoadAction;\n\n readonly multisample: number;\n\n delegate: RenderPassDelegate;\n\n meshOrder: RenderPassMeshOrder;\n\n constructor (options: RenderPassOptions, renderer?: IGPURenderer);\n\n /**\n * reset color/depth_stencil attachments,\n * if color/depth_stencil texture is external, this will not destroy textures\n * if color/depth_stencil texture is internal created, this will also delete those textures\n * this method will delete previous fbo if exists\n * returns previous options\n **/\n resetAttachments (options: RenderPassAttachmentOptions): RenderPassAttachmentOptions;\n\n setMeshes (meshes: Mesh[]): Mesh[];\n\n addMesh (mesh: Mesh): void;\n\n removeMesh (mesh: Mesh): void;\n\n destroy (options?: RenderPassDestroyOptions): void;\n\n assignRenderer (renderer: GPURenderer): RenderPass;\n\n}\n","import type { IGPURenderer, IGPUResource } from './IGPURenderer';\nimport type { Immutable, TypedArray } from './type';\nimport type { GPURenderer } from './Renderer';\n\n/**\n * 图片解码的格式,默认为 WebGL2RenderingContext['RGBA8']\n * 如果图片解码格式和texture的不一致,在非Web环境下,会产生报错,无法上传数据\n * 一般情况由系统根据图片文件解析出图片的像素格式\n */\nexport type ImageBitmapPixelFormat = WebGL2RenderingContext['RGBA8'] |\nWebGL2RenderingContext['RGBA16F'] |\nWebGL2RenderingContext['RGBA32F'] ;\n\nexport enum TextureSourceType {\n none,\n data = 1,\n image = 2,\n compressed = 3,\n video = 4,\n canvas = 5,\n framebuffer = 6,\n mipmaps = 7\n}\n\nexport interface TextureFactorySource2DFrom {\n type: TextureSourceType.image | TextureSourceType.video,\n url: string,\n target?: WebGLRenderingContext['TEXTURE_2D'],\n}\n\nexport interface TextureFactorySourceFromCompressed {\n type: TextureSourceType.compressed,\n url: string,\n}\n\nexport type TextureFactorySourceCubeFrom = {\n type: TextureSourceType.image,\n map: TextureCubeSourceURLMap | string[],\n target: WebGLRenderingContext['TEXTURE_CUBE_MAP'],\n};\n\ntype DataRange = [start: number, length: number];\n\nexport type TextureFactorySourceCubeBinaryMipmapsFrom = {\n target: WebGLRenderingContext['TEXTURE_CUBE_MAP'],\n type: TextureSourceType.mipmaps,\n bin: string,\n mipmaps: Array<[\n TEXTURE_CUBE_MAP_POSITIVE_X: DataRange,\n TEXTURE_CUBE_MAP_NEGATIVE_X: DataRange,\n TEXTURE_CUBE_MAP_POSITIVE_Y: DataRange,\n TEXTURE_CUBE_MAP_NEGATIVE_Y: DataRange,\n TEXTURE_CUBE_MAP_POSITIVE_Z: DataRange,\n TEXTURE_CUBE_MAP_NEGATIVE_Z: DataRange\n ]>,\n};\n\nexport type TextureFactorySource2DBinaryMipmapsFrom = {\n target?: WebGLRenderingContext['TEXTURE_2D'],\n type: TextureSourceType.mipmaps,\n bin: string,\n mipmaps: Array<DataRange>,\n};\n\nexport interface TextureFactorySourceCubeMipmapsFrom {\n type: TextureSourceType.mipmaps,\n target: WebGLRenderingContext['TEXTURE_CUBE_MAP'],\n maps: TextureCubeSourceURLMap[] | string[][],\n}\n\nexport interface TextureFactorySource2DMipmapsFrom {\n type: TextureSourceType.mipmaps,\n target?: WebGLRenderingContext['TEXTURE_2D'],\n urls: string[],\n}\n\nexport type TextureFactorySourceFrom =\n TextureFactorySource2DBinaryMipmapsFrom\n | TextureFactorySourceCubeBinaryMipmapsFrom\n | TextureFactorySource2DFrom\n | TextureFactorySourceCubeFrom\n | TextureFactorySourceCubeMipmapsFrom\n | TextureFactorySource2DMipmapsFrom\n | TextureFactorySourceFromCompressed;\n\nexport interface TextureFactory {\n /**\n * 通过TextureConfigOptions可以决定图片解码时使用的格式\n * @param options\n * @param config texture的属性\n */\n loadSourceAsync (options: TextureFactorySourceFrom, config?: TextureConfigOptions): Promise<TextureOptions>,\n\n canOffloadTexture (texture: Texture): boolean,\n\n reloadTextureAsync (texture: Texture): Promise<Texture>,\n\n loadCompressedTextureFromArrayBuffer (arrayBuffer: ArrayBuffer, options?: TextureOptions): TextureOptions,\n}\n\nexport declare class Texture implements IGPUResource {\n readonly width: number;\n readonly height: number;\n readonly id: string;\n readonly options: Immutable<TextureOptions>;\n readonly renderer?: IGPURenderer;\n readonly sourceType: TextureSourceType;\n readonly name: string;\n readonly isDestroyed: boolean;\n\n constructor (options: TextureOptions, renderer?: IGPURenderer);\n\n destroy (): void;\n\n updateSource (options: TextureSourceOptions): void;\n\n uploadCurrentVideoFrame (): boolean;\n\n offloadData (): void;\n\n reloadDataAsync (): Promise<Texture>;\n\n assignRenderer (renderer: GPURenderer): Texture;\n\n}\n\ntype ImageSource = ImageBitmap | HTMLImageElement | HTMLCanvasElement;\n\nexport interface ImageData {\n data: TypedArray,\n width: number,\n height: number,\n}\n\nexport type TextureSourceCubeData = [\n TEXTURE_CUBE_MAP_POSITIVE_X: ImageSource | ImageData,\n TEXTURE_CUBE_MAP_NEGATIVE_X: ImageSource | ImageData,\n TEXTURE_CUBE_MAP_POSITIVE_Y: ImageSource | ImageData,\n TEXTURE_CUBE_MAP_NEGATIVE_Y: ImageSource | ImageData,\n TEXTURE_CUBE_MAP_POSITIVE_Z: ImageSource | ImageData,\n TEXTURE_CUBE_MAP_NEGATIVE_Z: ImageSource | ImageData\n];\n\n// 为减少内存消耗,除了video之外,其余的数据内容会在texture生成后被置为undefined\n// const tex = new Texture({image:myImage},renderer)\n// tex.options.image === undefined\n\nexport type TextureSourceOptions = Texture2DSourceOptions | TextureCubeSourceOptions;\n\nexport interface Texture2DSourceOptionsNone extends TextureOptionsBase {\n sourceType: TextureSourceType.none,\n target?: GLenum,\n}\n\nexport interface Texture2DSourceOptionsImage extends TextureOptionsBase {\n sourceType: TextureSourceType.image,\n image: ImageSource,\n target?: WebGLRenderingContext['TEXTURE_2D'],\n generateMipmap?: boolean,\n}\n\nexport interface Texture2DSourceOptionsFrameBuffer extends TextureOptionsBase {\n sourceType: TextureSourceType.framebuffer,\n data?: { width: number, height: number },\n target?: WebGLRenderingContext['TEXTURE_2D'],\n}\n\nexport interface Texture2DSourceOptionsData extends TextureOptionsBase {\n sourceType: TextureSourceType.data,\n data: { data: TypedArray, width: number, height: number },\n target?: WebGLRenderingContext['TEXTURE_2D'],\n}\n\nexport interface Texture2DSourceOptionsVideo extends TextureOptionsBase {\n sourceType: TextureSourceType.video,\n video: HTMLVideoElement,\n target?: WebGLRenderingContext['TEXTURE_2D'],\n generateMipmap?: boolean,\n}\n\nexport interface Texture2DSourceOptionsImageMipmaps extends TextureOptionsBase {\n sourceType: TextureSourceType.mipmaps,\n mipmaps: Array<ImageSource | { data: TypedArray, width: number, height: number }>,\n target?: WebGLRenderingContext['TEXTURE_2D'],\n}\n\nexport interface Texture2DSourceOptionsCompressed extends TextureOptionsBase {\n sourceType: TextureSourceType.compressed,\n mipmaps: Array<{ data: TypedArray, width: number, height: number }>,\n target?: WebGLRenderingContext['TEXTURE_2D'],\n}\n\nexport interface TextureCubeSourceOptionsImage extends TextureOptionsBase {\n sourceType: TextureSourceType.image | TextureSourceType.data,\n target: WebGLRenderingContext['TEXTURE_CUBE_MAP'],\n cube: TextureSourceCubeData,\n generateMipmap?: boolean,\n}\n\nexport interface TextureCubeSourceOptionsImageMipmaps extends TextureOptionsBase {\n sourceType: TextureSourceType.mipmaps,\n mipmaps: Array<TextureSourceCubeData>,\n target: WebGLRenderingContext['TEXTURE_CUBE_MAP'],\n}\n\nexport type TextureCubeSourceURLMap = [\n TEXTURE_CUBE_MAP_POSITIVE_X: string,\n TEXTURE_CUBE_MAP_NEGATIVE_X: string,\n TEXTURE_CUBE_MAP_POSITIVE_Y: string,\n TEXTURE_CUBE_MAP_NEGATIVE_Y: string,\n TEXTURE_CUBE_MAP_POSITIVE_Z: string,\n TEXTURE_CUBE_MAP_NEGATIVE_Z: string\n];\n\nexport interface TextureConfigOptionsBase {\n name?: string,\n wrapS?: GLenum, // GL_CLAMP_TO_EDGE\n wrapT?: GLenum, // GL_CLAMP_TO_EDGE\n magFilter?: GLenum, // GL_NEAREST\n minFilter?: GLenum, // GL_NEAREST\n anisotropic?: number, //0\n flipY?: boolean,\n premultiplyAlpha?: boolean,\n //when use ImageBitMap, the bitmap content will be closed after sent to GPU\n keepImageSource?: boolean,\n}\n\nexport interface TextureConfigOptions extends TextureConfigOptionsBase {\n sourceFrom?: TextureFactorySourceFrom,\n}\n\nexport interface TextureFormatOptions {\n format?: GLenum, // GL_RGBA\n internalFormat?: GLenum, // GL_RGBA\n type?: GLenum, //GL_UNSIGNED_BYTE\n}\n\nexport interface TextureOptionsBase extends TextureConfigOptions, TextureFormatOptions {\n sourceType: TextureSourceType,\n}\n\nexport type TextureCubeSourceOptions = TextureCubeSourceOptionsImage | TextureCubeSourceOptionsImageMipmaps;\n\nexport type Texture2DSourceOptions =\n Texture2DSourceOptionsImage\n | Texture2DSourceOptionsData\n | Texture2DSourceOptionsVideo\n | Texture2DSourceOptionsImageMipmaps\n | Texture2DSourceOptionsCompressed\n | Texture2DSourceOptionsFrameBuffer;\n\nexport type Texture2DOptions = Texture2DSourceOptions;\n\nexport type TextureCubeOptions = TextureCubeSourceOptions;\n\nexport type TextureOptions = Texture2DOptions | TextureCubeOptions;\n","import type { TypedArray } from './type';\nimport type { IGPUResource, IGPURenderer } from './IGPURenderer';\nimport type { GPURenderer } from './Renderer';\nexport const GPUBufferOptionsMemoryShared = 1 << 1;\nexport type GPUBufferTarget =\n | WebGLRenderingContext['ARRAY_BUFFER']\n | WebGLRenderingContext['ELEMENT_ARRAY_BUFFER']\n | WebGL2RenderingContext['COPY_READ_BUFFER']\n | WebGL2RenderingContext['COPY_WRITE_BUFFER']\n | WebGL2RenderingContext['TRANSFORM_FEEDBACK_BUFFER']\n | WebGL2RenderingContext['UNIFORM_BUFFER']\n | WebGL2RenderingContext['PIXEL_PACK_BUFFER']\n | WebGL2RenderingContext['PIXEL_UNPACK_BUFFER'];\n\nexport interface GPUBufferOptions {\n name?: string,\n /**\n * 数据长度,如果提供了data,忽略此参数\n */\n byteLength?: number,\n\n data?: TypedArray,\n\n /**\n * GL需要设置,Vulkan和Metal此属性忽略\n */\n target?: GPUBufferTarget,\n\n /**\n * GL需要设置,Vulkan和Metal此属性忽略\n */\n usage?: WebGLRenderingContext['STATIC_DRAW'] | WebGLRenderingContext['DYNAMIC_DRAW'],\n}\n\n/**\n * GPU的Buffer对象,通过JS ArrayBuffer,可以向其中写入数据\n * JS调用写入数据后,会立即执行GPU写入的操作,此类型不会保存JS的ArrayBuffer对象\n *\n */\nexport declare class GPUBuffer implements IGPUResource {\n readonly renderer?: IGPURenderer;\n\n readonly isDestroyed: boolean;\n\n readonly level: number;\n\n readonly byteLength: number;\n\n readonly target: GPUBufferTarget;\n\n readonly usage?: WebGLRenderingContext['STATIC_DRAW'] | WebGLRenderingContext['DYNAMIC_DRAW'];\n\n constructor (options: GPUBufferOptions, renderer?: IGPURenderer);\n\n getElementCount (bytePerElement: number): number;\n /**\n * 根据TypedArray容量,重新分配Buffer内存\n * @param typedArray\n */\n bufferData (typedArray: TypedArray): void;\n\n /**\n * 更新buffer数据,立即写入GPU中\n * @param elementOffset 从buffer的第几个元素开始\n * @param typedArray 要写入的数据\n */\n\n bufferSubData (elementOffset: number, typedArray: TypedArray): void;\n\n /**\n * 将数据从GPU中读出,写入到传入的typedArray中,只有当level为2时才能成功,webgl下此函数永远不会成功\n * @param elementOffset 从第几个元素开始拷贝,默认为 0\n * @param typedArray 要写入的typedArray\n * @param elementCount 要写入多少个元素,如果不传入,则为typedArray元素长度\n */\n readSubData (elementOffset: number, typedArray: TypedArray, elementCount?: number): boolean;\n\n assignRenderer (renderer: GPURenderer): GPUBuffer;\n\n destroy (): void;\n}\n\n","import type { TypedArray, vec2 } from '../../types/type';\nimport { consoleError } from '../common/console';\n// @ts-expect-error safe to assign\nexport let constants: WebGL2RenderingContext = {};\n\nif (IS_NODE) {\n constants = require('./gl-constants.json');\n} else {\n if (typeof WebGL2RenderingContext === 'function') {\n copy(WebGL2RenderingContext);\n } else if (typeof WebGLRenderingContext !== 'undefined') {\n copy(WebGLRenderingContext);\n copy(WebGLRenderingContext.prototype);\n } else {\n //ios 16 lockdown mode\n consoleError('WebGL not in global');\n }\n}\n// @ts-expect-error set default value\nconstants['HALF_FLOAT'] = 5131;\n\nfunction copy (target: any) {\n for (const name in target) {\n if (/^[A-Z_]/.test(name)) {\n // @ts-expect-error safe to assign\n constants[name] = target[name];\n }\n }\n}\n\nconst map: { [p: number]: Int32ArrayConstructor | Float32ArrayConstructor | Int16ArrayConstructor | Int8ArrayConstructor | Uint8ArrayConstructor | Uint32ArrayConstructor | Uint16ArrayConstructor } = {\n [constants.INT]: Int32Array,\n [constants.FLOAT]: Float32Array,\n [constants.SHORT]: Int16Array,\n [constants.BYTE]: Int8Array,\n [constants.UNSIGNED_BYTE]: Uint8Array,\n [constants.UNSIGNED_INT]: Uint32Array,\n [constants.UNSIGNED_SHORT]: Uint16Array,\n};\n\nexport function createTypedArrayByGLType (type: number, elementCount: number | ArrayBuffer): TypedArray {\n return new (map[type] || Float32Array)(elementCount as number);\n}\n\nexport function getBytesPerElementByGLType (type: number): number {\n return map[type]?.BYTES_PER_ELEMENT || 0;\n}\nconst MatAttrLocPairMap: Record<number, vec2> = {\n [constants.FLOAT_MAT2]:[2, 2],\n [constants.FLOAT_MAT3]:[3, 3],\n [constants.FLOAT_MAT4]:[4, 4],\n};\n\nexport function getMatAttrLocPair (type: number): vec2 {\n return MatAttrLocPairMap[type] || [1, 1];\n}\n","export type Shader = ShaderWithSource | ShaderUseCacheId;\nexport type ShaderWithSource = InstancedShaderWithSource | SharedShaderWithSource;\nexport interface MetalShaderSpec {\n mtlBinary?: ArrayBuffer | string,\n mtlSource?: string,\n mtlVertex?: string,\n mtlFragment?: string,\n}\n\nexport interface ShaderSourceBase extends MetalShaderSpec {\n fragment: string,\n vertex: string,\n name?: string,\n //将es300的shader in/out关键字替换为attribute/varying\n downgrade?: boolean,\n marcos?: ShaderMarcos,\n}\n\nexport interface InstancedShaderWithSource extends ShaderSourceBase {\n shared?: false,\n}\n\nexport interface SharedShaderWithSource extends ShaderSourceBase {\n //相同cacheId的shader会使用同一个GLProgram\n //提供了cacheId就会认为是shared Shader\n cacheId?: string,\n //shared为true时,\n //如果没有提供cacheId,会根据字符串hash计算出 cacheId,\n //字符串相同的shader将会使用同一个GLProgram\n //如果提供了cacheId,cacheId相同的,都会使用同一个GLProgram\n shared: true,\n}\n\nexport interface ShaderUseCacheId {\n cacheId: string,\n}\n\nexport type ShaderMarcos = [key: string, value: string | number | boolean][];\n\nexport enum ShaderCompileResultStatus {\n noShader = 0,\n success = 1,\n fail = 2,\n compiling = 3\n}\n\nexport interface ShaderCompileResult {\n status: ShaderCompileResultStatus,\n cacheId?: string,\n error?: string | null,\n compileTime?: number,\n // deprecated\n shared?: boolean,\n}\n\n/**\n * @example\n * const lib:ShaderLibrary = ...;\n * const shaderCacheId = lib.addShader({fragment:'...',vertex:'...'});\n * lib.compileShader(shaderCacheId);\n * //pre-compiled program\n * const mtl = new Material({\n * shader:{ shaderCacheId }\n * })\n */\nexport interface ShaderLibrary {\n\n readonly cacheIds: string[],\n\n getShaderResult(cacheId: string): ShaderCompileResult | undefined,\n\n /**\n * 添加shader\n * @param shader\n */\n addShader(shader: Shader): string,\n\n /**\n * @param cacheId\n */\n deleteShader(cacheId: string): void,\n\n /**\n * 编译shader\n * @param shaderCacheId\n * @param asyncCallback 如果传入,则会启用异步编译,当所有编译完成后被回调\n */\n compileShader(shaderCacheId: string, asyncCallback?: (result: ShaderCompileResult) => void): ShaderCompileResult,\n\n /***\n * 编译现有的所有shader\n * @param asyncCallback 如果传入,则会启用异步编译,当所有编译完成后被回调\n */\n compileAllShaders(asyncCallback?: (results: ShaderCompileResult[]) => void): void,\n\n destroy(): void,\n}\n\nexport class ShaderLibraryEmpty implements ShaderLibrary {\n\n get cacheIds () {\n return [];\n }\n\n getShaderResult (cacheId: string): ShaderCompileResult | undefined {\n return undefined;\n }\n\n addShader (shader: Shader, marcos?: ShaderMarcos) {\n return '';\n }\n\n compileAllShaders (asyncCallback?: (results: ShaderCompileResult[]) => void) {\n return [];\n }\n\n deleteShader (cacheId: string) {\n }\n\n compileShader (shaderCacheId: string): ShaderCompileResult {\n return { status: ShaderCompileResultStatus.fail };\n }\n\n destroy () {\n }\n}\n","import { RenderPassMeshOrder } from '../../types/RenderPass';\n\nexport function isFunc (val: any): boolean {\n return typeof val === 'function';\n}\n\nexport function isObj (a: any): boolean {\n return (typeof a === 'object') && a;\n}\n\nexport function isStr (a: any, withLength?: boolean) {\n const str = typeof a === 'string';\n\n if (withLength) {\n return str && a.length > 0;\n }\n\n return str;\n}\n\nexport function arrRemove (arr: Array<any>, ele: any): boolean {\n const idx = arr.indexOf(ele);\n\n if (idx > -1) {\n arr.splice(idx, 1);\n\n return true;\n }\n\n return false;\n}\n\nexport function arrAdd<T> (arr: Array<T>, item: T): boolean {\n if (!arr.includes(item)) {\n arr.push(item);\n\n return true;\n }\n\n return false;\n}\n\nexport function strHashCode (...strings: string[]): number {\n let h = 0;\n\n for (let j = 0; j < arguments.length; j++) {\n const s = strings[j];\n\n for (let i = 0; i < s.length; i++) { h = Math.imul(31, h) + s.charCodeAt(i) | 0; }\n }\n\n return h;\n}\n\nexport function arrAddByOrder (arr: Array<any>, item: any, order?: number): boolean {\n const itemOrder = order || RenderPassMeshOrder.ascending;\n\n if (arr.includes(item)) { return true; }\n arr.push(item);\n if (arr.length === 1) { return true; }\n if (itemOrder !== RenderPassMeshOrder.none) {\n //单次插入排序\n let index = arr.length - 1;\n\n if (index) {\n const currentItem = arr[index];\n\n if (itemOrder !== RenderPassMeshOrder.ascending) {\n while (arr[index - 1].priority < currentItem.priority) {\n arr[index] = arr[index - 1];\n index--;\n if (index === 0) {\n break;\n }\n }\n } else {\n while (arr[index - 1].priority > currentItem.priority) {\n arr[index] = arr[index - 1];\n index--;\n if (index === 0) {\n break;\n }\n }\n }\n arr[index] = currentItem;\n }\n }\n\n return false;\n}\n\nfunction fastSort (arr: Array<any>, order: number, start = 0, end = arr.length - 1): Array<any> {\n // 终止条件\n if (start >= end) { return arr; }\n let left = start, right = end;\n const base = arr[start];\n\n while (left < right) {\n if (order === RenderPassMeshOrder.ascending) {\n // 从右向左,寻找第一个小于base的值\n while (arr[right].priority > base.priority && right >= left) { right--; }\n // 从左向右,寻找第一个大于base的值\n while (arr[left].priority <= base.priority && left < right) { left++; }\n } else {\n // 从右向左,寻找第一个大于base的值\n while (arr[right].priority < base.priority && right >= left) { right--; }\n // 从左向右,寻找第一个小于base的值\n while (arr[left].priority >= base.priority && left < right) { left++; }\n }\n // 将两个值交换位置\n [arr[left], arr[right]] = [arr[right], arr[left]];\n }\n // 将最后两个游标相遇的位置的值与base值交换\n [arr[start], arr[left]] = [arr[left], arr[start]];\n fastSort(arr, order, start, left - 1);\n fastSort(arr, order, right + 1, end);\n\n return arr;\n}\n\nexport function sortByOrder (arr: Array<any>, order?: number): Array<any> {\n const itemOrder = order || RenderPassMeshOrder.ascending;\n\n if (arr.length === 0 || arr.length === 1) { return arr; }\n if (itemOrder === RenderPassMeshOrder.none) {\n return arr;\n } else {\n //30个以下的数据用插入排序\n if (arr.length <= 30) {\n const length = arr.length;\n\n for (let i = 1; i < length; i++) {\n const currentItem = arr[i];\n let index = i;\n\n if (itemOrder !== RenderPassMeshOrder.ascending) {\n while (index >= 1 && arr[index - 1].priority < currentItem.priority) {\n arr[index] = arr[index - 1];\n index--;\n if (index === 0) {\n break;\n }\n }\n } else {\n while (index >= 1 && arr[index - 1].priority > currentItem.priority) {\n arr[index] = arr[index - 1];\n index--;\n if (index === 0) {\n break;\n }\n }\n }\n arr[index] = currentItem;\n }\n\n return arr;\n } else {\n return fastSort(arr, itemOrder);\n }\n }\n\n}\n\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\n\nexport function forEach<T> (object: null | undefined | { [key: string]: T }, callback: (val: T, key: string) => void, thisObj?: any) {\n if (isObj(object)) {\n if (thisObj === undefined) {\n thisObj = object;\n }\n for (const name in object) {\n if (hasOwnProperty.call(object, name)) {\n callback.call(thisObj, object[name], name);\n }\n }\n }\n\n return object;\n}\n\nexport function throwDestroyedError () {\n throw Error('destroyed item cannot be used again');\n}\n","import type { MarsRenderFrame } from './MarsRenderFrame';\nimport type { RenderState } from '../../types/RenderFrame';\nimport type {\n RenderPassLoadAction,\n RenderPassStoreAction,\n} from '../../types/RenderPass';\nimport {\n TextureLoadAction,\n} from '../../types/RenderPass';\nimport { constants } from '../webgl/constants';\nimport type { GLGPURenderer } from '../webgl/GLGPURenderer';\nimport type { MarsMesh } from './MarsMesh';\nimport type { MarsGeometry } from './MarsGeometry';\nimport type { MarsRenderPass } from './MarsRenderPass';\nimport type { MarsRenderer } from './MarsRenderer';\nimport { consoleError } from '../common/console';\n\nexport class RenderFrameInternal {\n\n static render (frame: MarsRenderFrame) {\n const passes = frame._renderPasses;\n const renderer = frame.renderer;\n\n if (renderer.isDestroyed) {\n return consoleError('renderer is destroyed', renderer);\n }\n frame.renderer.shaderLibrary.compileAllShaders();\n clear(renderer.internal, frame.loadAction);\n //@ts-expect-error safe to assign\n const renderState: RenderState = {\n currentFrame: frame,\n };\n\n for (let i = 0; i < passes.length; i++) {\n const pass = passes[i];\n const delegate = pass.delegate;\n\n if (pass.isDestroyed) {\n consoleError(`render pass ${pass.name} destroyed`, pass);\n } else {\n delegate.willBeginRenderPass && delegate?.willBeginRenderPass(pass, renderState);\n this.renderRenderPass(renderer, pass as MarsRenderPass, renderState);\n delegate.didEndRenderPass && delegate?.didEndRenderPass(pass, renderState);\n }\n }\n }\n\n static renderRenderPass (renderer: MarsRenderer, pass: MarsRenderPass, renderState: RenderState): void {\n renderState.currentPass = pass;\n setupRenderPass(renderer, pass);\n\n renderMeshes(renderer, renderState);\n endRenderPass(renderer, pass);\n }\n}\n\nfunction endRenderPass (renderer: MarsRenderer, renderPass: MarsRenderPass) {\n if (renderPass.storeAction) {\n clear(renderer.internal, renderPass.storeAction);\n }\n renderPass.unbind();\n}\n\nfunction renderMeshes (renderer: MarsRenderer, state: RenderState) {\n //assume meshes has been sorted\n const sortedMeshes = state.currentPass.meshes;\n const delegate = state.currentPass.delegate;\n\n for (let i = 0; i < sortedMeshes.length; i++) {\n const mesh = sortedMeshes[i];\n\n if (mesh.isDestroyed) {\n consoleError(`mesh ${mesh.name} destroyed`, mesh);\n } else if (!mesh.hide) {\n delegate.willRenderMesh && delegate.willRenderMesh(mesh, state);\n renderMesh(renderer, mesh as MarsMesh, state);\n delegate.didRenderMesh && delegate.didRenderMesh(mesh, state);\n }\n }\n for (let i = 0; i < sortedMeshes.length; i++) {\n const mtl = (sortedMeshes[i] as MarsMesh).material;\n\n if (mtl) {\n mtl.dataBlocks.forEach(d => d.clearFlags());\n }\n }\n}\n\nfunction setupRenderPass (renderer: MarsRenderer, renderPass: MarsRenderPass) {\n renderPass.assignRenderer(renderer);\n loadRenderPassAttachments(renderer.internal, renderPass);\n}\n\nfunction renderMesh (renderer: MarsRenderer, mesh: MarsMesh, state: RenderState) {\n state.currentMesh = mesh;\n mesh.material.assignRenderer(renderer);\n const material = (mesh.material).materialInternal;\n\n if (material) {\n const program = material.getProgram();\n\n if (program) {\n material.setupStates();\n program.setupUniforms(state);\n mesh.geometries.forEach((geometry: MarsGeometry) => {\n geometry.assignRenderer(renderer);\n geometry.flush();\n const vao = program.setupAttributes(geometry.internal);\n\n geometry.internal.draw(state);\n if (vao) {\n vao.unbind();\n }\n });\n }\n }\n}\n\nfunction loadRenderPassAttachments (renderer: GLGPURenderer, renderPass: MarsRenderPass) {\n renderPass.bind();\n if (renderPass.loadAction) {\n clear(renderer, renderPass.loadAction);\n }\n}\n\nfunction clear (renderer: GLGPURenderer, action: RenderPassLoadAction | RenderPassStoreAction) {\n const state = renderer.state;\n let bit = 0;\n\n if (action.colorAction === TextureLoadAction.clear) {\n const clearColor = action.clearColor;\n\n if (clearColor) {\n state.clearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);\n }\n state.colorMask(true, true, true, true);\n bit = constants.COLOR_BUFFER_BIT;\n }\n if (action.stencilAction === TextureLoadAction.clear) {\n state.stencilMask(0xff);\n state.clearStencil(action.clearStencil || 0);\n bit = bit | constants.STENCIL_BUFFER_BIT;\n }\n if (action.depthAction === TextureLoadAction.clear) {\n const depth = action.clearDepth as number;\n\n state.depthMask(true);\n state.clearDepth(Number.isFinite(depth) ? depth : 1);\n bit = bit | constants.DEPTH_BUFFER_BIT;\n }\n if (bit) {\n state.clear(bit);\n }\n}\n","import type {\n GPUBuffer, RenderState, SemanticFunc, UniformValue, SemanticMap, SemanticGetter,\n} from '../../types';\nimport { forEach, isFunc } from '../common/utils';\n\nexport class MarsSemanticMap implements SemanticMap {\n public readonly semantics: Record<string, SemanticGetter>;\n\n constructor (semantics?: Record<string, SemanticGetter>) {\n this.semantics = Object.assign({}, semantics || {});\n }\n\n toObject (): Record<string, SemanticGetter> {\n return Object.assign({}, this.semantics);\n }\n\n setSemantic (name: string, value: SemanticGetter | undefined) {\n if (value === undefined) {\n delete this.semantics[name];\n } else {\n this.semantics[name] = value;\n }\n }\n\n getSemanticValue (name: string, state: RenderState): UniformValue | GPUBuffer | null | undefined {\n const ret = this.semantics[name];\n\n if (isFunc(ret)) {\n return (ret as SemanticFunc)(state);\n }\n\n return ret as UniformValue;\n }\n\n hasSemanticValue (name: string): boolean {\n return name in this.semantics;\n }\n\n destroy () {\n const c = this.semantics;\n\n forEach(c, function (va, name) {\n if (va && isFunc((va as GPUBuffer).destroy)) {\n (va as GPUBuffer).destroy();\n }\n delete c[name];\n });\n }\n}\n","import type {\n RenderFrame,\n RenderFrameDestroyOptions,\n RenderFrameOptions,\n RenderPass,\n RenderPassLoadAction,\n} from '../../types';\nimport {\n arrAddByOrder, arrRemove, sortByOrder, throwDestroyedError,\n} from '../common/utils';\nimport { RenderFrameInternal } from './RenderFrameInternal';\nimport type { MarsRenderer } from './MarsRenderer';\nimport { MarsSemanticMap } from './MarsSemanticMap';\nimport { DestroyOptions } from '../../types/constants';\n\nlet renderFrameSeed = 1;\n\nexport class MarsRenderFrame implements RenderFrame {\n loadAction: RenderPassLoadAction;\n readonly name: string;\n readonly semantics: MarsSemanticMap;\n _renderPasses!: RenderPass[];\n private _renderer!: MarsRenderer;\n private _isDestroyed = false;\n\n get renderPasses () {\n return this._renderPasses.slice();\n }\n\n get isDestroyed () {\n return this._isDestroyed;\n }\n\n get renderer (): MarsRenderer {\n return this._renderer;\n }\n\n constructor (options: RenderFrameOptions, renderer?: MarsRenderer) {\n this.setRenderPasses(options.renderPasses as RenderPass[] || []);\n this.semantics = new MarsSemanticMap(options.semantics);\n this.loadAction = options.loadAction || {};\n this.name = options.name || ('RenderFrame' + renderFrameSeed++);\n if (renderer) {\n this.assignRenderer(renderer);\n }\n }\n\n assignRenderer (renderer: MarsRenderer): MarsRenderFrame {\n if (!this._renderer) {\n this._renderer = renderer;\n }\n\n return this;\n }\n\n destroy (options?: RenderFrameDestroyOptions) {\n if (options?.semantics !== DestroyOptions.keep) {\n this.semantics.destroy();\n }\n const pass = options?.passes ? options.passes : undefined;\n\n if (pass !== DestroyOptions.keep) {\n this._renderPasses.forEach(renderPass => {\n renderPass.destroy(pass);\n });\n }\n this._renderPasses.length = 0;\n this.assignRenderer = throwDestroyedError as unknown as (r: MarsRenderer) => MarsRenderFrame;\n this._isDestroyed = true;\n }\n\n render (): void {\n RenderFrameInternal.render(this);\n }\n\n setRenderPasses (passes: RenderPass[]) {\n this._renderPasses = sortByOrder(passes.slice());\n }\n\n addRenderPass (pass: RenderPass): void {\n arrAddByOrder(this._renderPasses, pass);\n }\n\n removeRenderPass (pass: RenderPass): void {\n arrRemove(this._renderPasses, pass);\n }\n\n forEachRenderPass (callback: (renderPass: RenderPass, index: number, pipeline: MarsRenderFrame) => void) {\n const passes = this._renderPasses;\n\n for (let i = 0; i < passes.length; i++) {\n callback.call(passes, passes[i], i, this);\n }\n }\n}\n","import type { Immutable } from './type';\nexport const COMPRESSED_TEXTURE_NONE = 0;\nexport const COMPRESSED_TEXTURE_PVRTC = 1;\nexport const COMPRESSED_TEXTURE_ASTC = 2;\n\nexport interface GPUCapabilityDetail {\n maxSample: number,\n floatTexture: number,\n halfFloatTexture: number,\n //set currentPass color attachment type FLOAT\n floatColorAttachment?: boolean,\n //set currentPass color attachment type HALF_FLOAT\n halfFloatColorAttachment?: boolean,\n maxVertexUniforms: number,\n maxVertexTextures: number,\n maxFragmentUniforms: number,\n maxFragmentTextures: number,\n maxShaderTexCount: number,\n maxTextureSize: number,\n maxTextureAnisotropy: number,\n compressedTexture: number,\n shaderTextureLod: boolean,\n instanceDraw?: boolean,\n drawBuffers?: boolean,\n asyncShaderCompile?: boolean,\n //draw elements use uint32 Array\n intIndexElementBuffer?: boolean,\n //render pass depth and stencil texture readable\n //in webgl, if not readable,use RenderBuffer which cannot readable\n readableDepthStencilTextures?: boolean,\n writableFragDepth?: boolean,\n}\n\nexport type GPUFramework = 'webgl' | 'webgl2' | 'opengles3' | 'opengles2' | 'node-gl' | 'metal' | 'none';\n\nexport interface GPUCapability {\n type: GPUFramework,\n level: number,\n capability: Immutable<GPUCapabilityDetail>,\n\n setup (gl: WebGLRenderingContext): void,\n}\n\nexport class GPUCapabilityEmpty implements GPUCapability {\n type: GPUFramework;\n level = 0;\n capability = {\n maxSample: 0,\n floatTexture: 0,\n halfFloatTexture: 0,\n maxVertexUniforms: 0,\n maxVertexTextures: 0,\n maxFragmentUniforms: 0,\n maxFragmentTextures: 0,\n maxTextureSize: 0,\n maxShaderTexCount:0,\n maxTextureAnisotropy: 0,\n compressedTexture: 0,\n shaderTextureLod: false,\n };\n\n constructor () {\n this.type = 'none';\n }\n\n setup (gl: WebGLRenderingContext) {\n }\n}\n","import type { GPUBuffer, GPUBufferOptions, GPUBufferTarget } from '../../types/GPUBuffer';\nimport { constants } from './constants';\nimport type { GLGPURenderer } from './GLGPURenderer';\nimport type { TypedArray } from '../../types/type';\nimport type { MarsRenderer } from '../render/MarsRenderer';\nimport { isObj } from '../common/utils';\n\nexport class GLGPUBuffer implements GPUBuffer {\n\n readonly usage: WebGLRenderingContext['STATIC_DRAW'] | WebGLRenderingContext['DYNAMIC_DRAW'] | WebGLRenderingContext['STREAM_DRAW'];\n\n readonly renderer?: GLGPURenderer;\n\n readonly glBuffer: WebGLBuffer | null;\n\n readonly target: GPUBufferTarget;\n\n private _byteLength: number;\n\n private _isDestroyed = false;\n\n readonly name: string;\n\n get byteLength (): number {\n return this._byteLength;\n }\n\n get isBuffer () {\n return true;\n }\n\n get level () {\n return this.renderer?.level || 1;\n }\n\n get isDestroyed (): boolean {\n return this._isDestroyed;\n }\n\n constructor (options: GPUBufferOptions, renderer: GLGPURenderer) {\n this.renderer = renderer;\n this.glBuffer = renderer.createGLBuffer(this, options.name) as WebGLBuffer;\n this.usage = options.usage || constants.STATIC_DRAW;\n this._byteLength = 0;\n this.name = options.name || '';\n this.target = options.target || constants.ARRAY_BUFFER;\n if (options.data) {\n this.bufferData(options.data);\n } else if (options.byteLength) {\n this.bufferData(options.byteLength);\n }\n }\n\n bind () {\n const gl = this.renderer?.gl as WebGLRenderingContext;\n\n gl.bindBuffer(this.target, this.glBuffer);\n }\n\n bufferData (typedArray: TypedArray | number): void {\n const byteLength = Number.isInteger(typedArray) ? typedArray as number : (typedArray as TypedArray).byteLength;\n\n if (this.renderer) {\n this._byteLength = byteLength;\n const gl = this.renderer.gl;\n const target = this.target;\n\n gl.bindBuffer(target, this.glBuffer);\n if (byteLength === 0) {\n // ios 12 13 cause error when byteLength == 0\n gl.bufferData(target, 1, this.usage);\n } else {\n gl.bufferData(target, byteLength, this.usage);\n if (isObj(typedArray)) {\n gl.bufferSubData(target, 0, typedArray as TypedArray);\n }\n }\n gl.bindBuffer(target, null);\n } else {\n this._byteLength = 0;\n }\n }\n\n bufferSubData (elementOffset: number, typedArray: TypedArray): void {\n if (this.renderer) {\n const gl = this.renderer.gl;\n const target = this.target;\n const byteOffset = elementOffset * typedArray.BYTES_PER_ELEMENT;\n\n gl.bindBuffer(target, this.glBuffer);\n const byteLength = byteOffset + typedArray.byteLength;\n\n if (byteLength > this._byteLength) {\n this._byteLength = byteLength;\n gl.bufferData(target, byteLength, this.usage);\n }\n gl.bufferSubData(target, byteOffset, typedArray);\n gl.bindBuffer(target, null);\n } else {\n this._byteLength = 0;\n }\n }\n\n destroy (): void {\n this.renderer?.deleteGPUBuffer(this);\n // @ts-expect-error safe to assign\n this.glBuffer = this.renderer = null;\n this._isDestroyed = true;\n }\n\n readSubData (elementOffset: number, typedArray: TypedArray): boolean {\n if (this.level === 2) {\n const gl = this.renderer?.gl as WebGL2RenderingContext;\n const target = this.target;\n\n if (gl) {\n gl.bindBuffer(target, this.glBuffer);\n gl.getBufferSubData(target, elementOffset * typedArray.BYTES_PER_ELEMENT, typedArray);\n gl.bindBuffer(target, null);\n\n return true;\n }\n }\n\n return false;\n }\n\n getElementCount (bytePerElement: number) {\n return this._byteLength / bytePerElement;\n }\n\n assignRenderer (renderer: MarsRenderer): GLGPUBuffer {\n if (!this.renderer) {\n // @ts-expect-error safe to assign\n this.renderer = renderer.internal;\n }\n\n return this;\n }\n\n}\n","/**\n * webgl的状态切换\n */\nimport { constants } from './constants';\n\nexport class WebGLState {\n\n public noCache = false;\n readonly _gl: WebGLRenderingContext | WebGL2RenderingContext;\n\n private _dict: any;\n\n private _currentFramebuffer!: Record<number, WebGLFramebuffer | null>;\n\n private _currentTextureBinding!: WebGLTexture | null;\n\n private _currentRenderBuffer!: Record<number, WebGLRenderbuffer | null>;\n\n private _activeTextureIndex!: number;\n\n private readonly _maxTextureCount: number;\n\n private _pixelStorei!: { [key: string]: GLenum };\n\n _textureUnitDict!: { [key: string]: WebGLTexture | null };\n\n bindingVAO?: WebGLVertexArrayObject;\n\n constructor (gl: WebGLRenderingContext | WebGL2RenderingContext) {\n this._gl = gl;\n this._maxTextureCount = gl.TEXTURE0 + gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS) - 1;\n this._reset();\n }\n\n destroy () {\n //@ts-expect-error save to assign\n this.gl = null;\n }\n\n private _reset () {\n this._dict = {};\n this._activeTextureIndex = constants.TEXTURE0;\n this._textureUnitDict = {};\n this._currentFramebuffer = {};\n this._pixelStorei = {};\n this._currentRenderBuffer = {};\n }\n\n toggle (capability: GLenum, enable?: boolean) {\n if (enable) {\n this.enable(capability);\n } else {\n this.disable(capability);\n }\n }\n\n /**\n * 对于该上下文开启某种特性\n * @param capability\n * example:\n * gl.enable(gl.DITHER);\n */\n enable (capability: GLenum) {\n const value = this._dict[capability];\n\n if (value !== true) {\n this._dict[capability] = true;\n this._gl.enable(capability);\n }\n }\n\n /**\n * 基于某种上下文关闭特性\n * @param capability\n * example:\n * gl.disable(gl.DITHER);\n */\n disable (capability: GLenum) {\n const value = this._dict[capability];\n\n if (value !== false) {\n this._dict[capability] = false;\n this._gl.disable(capability);\n }\n }\n\n /**\n * 绑定framebuffer webgl2新增: gl.DRAW_FRAMEBUFFER 和 gl.READ_FRAMEBUFFER\n * @param target\n * @param framebuffer\n * example:\n * const framebuffer = gl.createFramebuffer();\n * gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);\n */\n bindFramebuffer (target: GLenum, framebuffer: WebGLFramebuffer | null) {\n if (this._currentFramebuffer[target] !== framebuffer) {\n this._currentFramebuffer[target] = framebuffer;\n this._gl.bindFramebuffer(target, framebuffer);\n }\n }\n\n bindRenderBuffer (target: GLenum, renderBuffer: WebGLRenderbuffer | null) {\n if (this._currentRenderBuffer[target] !== renderBuffer) {\n this._currentRenderBuffer[target] = renderBuffer;\n this._gl.bindRenderbuffer(target, renderBuffer);\n }\n }\n\n /**\n * 绑定系统framebuffer\n */\n bindSystemFramebuffer () {\n this.bindFramebuffer(this._gl.FRAMEBUFFER, null);\n }\n\n /**\n * 将定义好的WebGLProgram 对象添加到当前的渲染状态中。\n * @param program\n * example:\n * gl.useProgram(program);\n * gl.useProgram(null);\n */\n useProgram (program: WebGLProgram | null) {\n this._set1('useProgram', program);\n }\n\n /**\n * 使用预设值来清空缓冲\n * @param mask\n * example:\n * gl.clear(gl.DEPTH_BUFFER_BIT);\n * gl.clear(gl.DEPTH_BUFFER_BIT | gl.COLOR_BUFFER_BIT);\n */\n clear (mask: number) {\n this._gl.clear(mask);\n }\n\n //depth start\n\n /**\n * 设置深度缓冲区的深度清除值\n * @param depth\n * example:\n * gl.clearDepth(0.5);\n */\n clearDepth (depth: GLclampf) {\n this._set1('clearDepth', depth);\n }\n\n /**\n * 指定将输入像素深度与当前深度缓冲区值进行比较的函数。\n * @param func\n * example:\n * gl.enable(gl.DEPTH_TEST);\n * gl.depthFunc(gl.NEVER);\n */\n public depthFunc (func: GLenum) {\n this._set1('depthFunc', func);\n }\n\n /**\n * 设置是否启用写入深度缓冲。\n * @param flag\n * example:\n * gl.depthMask(false);\n */\n depthMask (flag: boolean) {\n this._set1('depthMask', flag);\n }\n\n polygonOffset (factor: number, unit: number) {\n this._set2('polygonOffset', factor, unit);\n }\n\n /**\n * 将 z 值从规范化设备坐标映射到窗口坐标\n * @param zNear\n * @param zFar\n * example:\n * gl.depthRange(0.2, 0.6);\n */\n depthRange (zNear: number, zFar: number) {\n this._set2('depthRange', zNear, zFar);\n }\n\n //depth end\n\n //stencil start\n /**\n * 模版测试设置函数和引用值。\n * @param func\n * @param ref\n * @param mask\n * example:\n * gl.enable(gl.STENCIL_TEST);\n * gl.stencilFunc(gl.LESS, 0, 0b1110011);\n */\n clearStencil (s: GLint) {\n this._set1('clearStencil', s);\n }\n\n /**\n * 控制启用和禁用模板平面中单个位的正面和背面写入\n * @param mask\n * example:\n * gl.stencilMask(0xff);\n */\n stencilMask (mask: number) {\n this.stencilMaskSeparate(this._gl.FRONT, mask);\n this.stencilMaskSeparate(this._gl.BACK, mask);\n }\n\n /**\n * 模版测试设置函数和引用值。\n * @param func\n * @param ref\n * @param mask\n * example:\n * gl.enable(gl.STENCIL_TEST);\n * gl.stencilFunc(gl.LESS, 0, 0b1110011);\n */\n stencilFunc (func: GLenum, ref: GLint, mask: GLuint) {\n this.stencilFuncSeparate(this._gl.FRONT, func, ref, mask);\n this.stencilFuncSeparate(this._gl.BACK, func, ref, mask);\n }\n\n /**\n * 单面模版测试\n * @param face\n * @param func\n * @param ref\n * @param mask\n * example:\n * gl.enable(gl.STENCIL_TEST);\n * gl.stencilFuncSeparate(gl.FRONT, gl.LESS, 0.2, 1110011);\n */\n stencilFuncSeparate (face: GLenum, func: GLenum, ref: GLint, mask: GLuint) {\n this._set4('stencilFuncSeparate', face, func, ref, mask);\n }\n\n /**\n * 单面的mask写入\n * @param face\n * @param mask\n * example:\n * gl.stencilMaskSeparate(gl.FRONT, 110101);\n */\n stencilMaskSeparate (face: GLenum, mask: GLuint) {\n this._set2('stencilMaskSeparate', face, mask);\n }\n\n /**\n * 设置正面和背面模板测试操作\n * @param fail\n * @param zfail\n * @param zpass\n * example:\n * gl.enable(gl.STENCIL_TEST);\n * gl.stencilOp(gl.INCR, gl.DECR, gl.INVERT);\n */\n stencilOp (fail: GLenum, zfail: GLenum, zpass: GLenum) {\n this.stencilOpSeparate(this._gl.FRONT, fail, zfail, zpass);\n this.stencilOpSeparate(this._gl.BACK, fail, zfail, zpass);\n }\n\n /**\n * 设置正面和/或背面模板测试操作\n * @param face\n * @param fail\n * @param zfail\n * @param zpass\n * example:\n * gl.enable(gl.STENCIL_TEST);\n * gl.stencilOpSeparate(gl.FRONT, gl.INCR, gl.DECR, gl.INVERT);\n */\n stencilOpSeparate (face: GLenum, fail: GLenum, zfail: GLenum, zpass: GLenum) {\n this._set4('stencilOpSeparate', face, fail, zfail, zpass);\n }\n\n //stencil end\n\n //face start\n /**\n * 剔除方式\n * @param mode\n * example:\n * gl.enable(gl.CULL_FACE);\n * gl.cullFace(gl.FRONT_AND_BACK);\n */\n cullFace (mode: GLenum) {\n this._set1('cullFace', mode);\n }\n\n /**\n * 设置卷绕方向\n * @param mode\n * example:\n * gl.frontFace(gl.CW);\n */\n frontFace (mode: GLenum) {\n this._set1('frontFace', mode);\n }\n\n //face end\n\n //color start\n /**\n * 设置颜色写入\n * @param red\n * @param green\n * @param blue\n * @param alpha\n * example:\n * gl.colorMask(true, true, true, false);\n */\n clearColor (red: GLclampf, green: GLclampf, blue: GLclampf, alpha: GLclampf) {\n this._set4('clearColor', red, green, blue, alpha);\n }\n\n /**\n * 设置颜色写入\n * @param red\n * @param green\n * @param blue\n * @param alpha\n * example:\n * gl.colorMask(true, true, true, false);\n */\n colorMask (red: boolean, green: boolean, blue: boolean, alpha: boolean) {\n this._set4('colorMask', red, green, blue, alpha);\n }\n\n /**\n * 设置源和目标混合因子\n * @param red\n * @param green\n * @param blue\n * @param alpha\n * example:\n * gl.blendColor(0, 0.5, 1, 1);\n */\n blendColor (red: GLclampf, green: GLclampf, blue: GLclampf, alpha: GLclampf) {\n this._set4('blendColor', red, green, blue, alpha);\n }\n\n /**\n * 用于混合像素算法\n * @param sfactor\n * @param dfactor\n * example:\n * gl.enable(gl.BLEND);\n * gl.blendFunc(gl.SRC_COLOR, gl.DST_COLOR);\n */\n blendFunc (sfactor: GLenum, dfactor: GLenum) {\n this.blendFuncSeparate(sfactor, dfactor, sfactor, dfactor);\n }\n\n /**\n * 分别设置应用在 RGB 和 Alpha 上的 factor\n * @param srcRGB\n * @param dstRGB\n * @param srcAlpha\n * @param dstAlpha\n * example:\n * gl.enable(gl.BLEND);\n * gl.blendFuncSeparate(gl.SRC_COLOR, gl.DST_COLOR, gl.ONE, gl.ZERO);\n */\n blendFuncSeparate (srcRGB: GLenum, dstRGB: GLenum, srcAlpha: GLenum, dstAlpha: GLenum) {\n this._set4('blendFuncSeparate', srcRGB, dstRGB, srcAlpha, dstAlpha);\n }\n\n /**\n * 设置混合模式\n * @param mode\n * example:\n * gl.blendEquation(gl.FUNC_ADD);\n * gl.blendEquation(gl.FUNC_SUBTRACT);\n * gl.blendEquation(gl.FUNC_REVERSE_SUBTRACT);\n */\n public blendEquation (mode: GLenum) {\n this._set1('blendEquation', mode);\n }\n\n /**\n * 可以分别对 RGB 和 Alpha 做不同的操作处理\n * @param modeRGB\n * @param modeAlpha\n * example:\n * gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_SUBTRACT);\n */\n blendEquationSeparate (modeRGB: GLenum, modeAlpha: GLenum) {\n this._set2('blendEquationSeparate', modeRGB, modeAlpha);\n }\n\n //color end\n /**\n * 图像预处理\n * @param pname\n * @param param\n * example:\n * var tex = gl.createTexture();\n * gl.bindTexture(gl.TEXTURE_2D, tex);\n * gl.pixelStorei(gl.PACK_ALIGNMENT, 4);\n */\n pixelStorei (pname: GLenum, param: GLenum) {\n const currentParam = this._pixelStorei[pname];\n\n if (currentParam !== param) {\n this._pixelStorei[pname] = param;\n this._gl.pixelStorei(pname, param);\n }\n }\n\n /**\n * 用来设置视口,即指定从标准设备到窗口坐标的x、y仿射变换。\n * @param x\n * @param y\n * @param width\n * @param height\n * example:\n * gl.viewport(0, 0, width, height);\n */\n viewport (x: number, y: number, width: number, height: number) {\n this._set4('viewport', x, y, width, height);\n }\n\n /**\n * 激活指定的纹理单元\n * @param texture\n * example:\n * gl.activeTexture(gl.TEXTURE1);\n */\n activeTexture (texture: GLenum) {\n texture = Math.min(texture, this._maxTextureCount);\n if (this._activeTextureIndex !== texture || this.noCache) {\n this._activeTextureIndex = texture;\n this._gl.activeTexture(texture);\n }\n }\n\n /**\n * 绑定WebGLTexture\n * @param target\n * @param texture\n * @param force\n * example:\n * var texture = gl.createTexture();\n * gl.bindTexture(gl.TEXTURE_2D, texture)\n */\n bindTexture (target: GLenum, texture: WebGLTexture | null, force?: boolean) {\n if (this._currentTextureBinding !== texture || force || this.noCache) {\n this._gl.bindTexture(target, texture);\n this._currentTextureBinding = texture;\n }\n this._textureUnitDict[this._activeTextureIndex] = texture;\n }\n\n private _set1 (name: string, param: any) {\n const value = this._dict[name];\n\n if (value !== param) {\n this._dict[name] = param;\n //@ts-expect-error save to assign\n this._gl[name](param);\n }\n }\n\n private _set2 (name: string, param0: number, param1: number) {\n let value = this._dict[name];\n\n if (!value) {\n value = this._dict[name] = { x: NaN, y: NaN };\n }\n\n if (value.x !== param0 || value.y !== param1) {\n //@ts-expect-error save to assign\n this._gl[name](value.x = param0, value.y = param1);\n }\n }\n\n private _set3 (name: string, param0: any, param1: any, param2: any) {\n let value = this._dict[name];\n\n if (!value) {\n value = this._dict[name] = { x: NaN, y: NaN, z: NaN };\n }\n\n if (value.x !== param0 || value.y !== param1 || value.z !== param2) {\n //@ts-expect-error safe to assign\n this._gl[name](value.x = param0, value.y = param1, value.z = param2);\n }\n }\n\n private _set4 (name: string, param0: any, param1: any, param2: any, param3: any) {\n let value = this._dict[name];\n\n if (!value) {\n value = this._dict[name] = {\n x: NaN, y: NaN, z: NaN, w: NaN,\n };\n }\n\n if (value.x !== param0 || value.y !== param1 || value.z !== param2 || value.w !== param3) {\n //@ts-expect-error safe to assign\n this._gl[name](value.x = param0, value.y = param1, value.z = param2, value.w = param3);\n }\n }\n\n get (name: string): any {\n return this._dict[name];\n }\n}\n\n","export function requestAnimationFrame (cb: (n: number) => void) {\n return window.requestAnimationFrame(cb);\n}\n\nexport function cancelAnimationFrame (handle: number) {\n return window.cancelIdleCallback(handle);\n}\n","import { constants } from './constants';\nimport type { MarsTexture } from '../render/MarsTexture';\nimport type { ProgramUniformInfo } from './GLProgram';\nimport type { GLGPURenderer } from './GLGPURenderer';\nimport { consoleError, consoleWarn } from '../common/console';\n\nexport const DATA_DICT: {\n [k: string | number]: {\n name: number,\n uniform: (gl: WebGL2RenderingContext | WebGLRenderingContext, info: ProgramUniformInfo, value: any, renderer: GLGPURenderer) => void,\n },\n} = {\n [constants.FLOAT]: {\n name: constants.FLOAT,\n uniform (gl: WebGL2RenderingContext | WebGLRenderingContext, info: ProgramUniformInfo, value: Float32List) {\n if (value.length != undefined) {\n gl.uniform1fv(info.loc, value);\n } else {\n gl.uniform1f(info.loc, (value as any));\n }\n },\n },\n [constants.FLOAT_VEC2]: {\n name: constants.FLOAT_VEC2,\n uniform (gl: WebGL2RenderingContext | WebGLRenderingContext, info: ProgramUniformInfo, value: Float32List) {\n gl.uniform2fv(info.loc, value);\n },\n },\n [constants.FLOAT_VEC3]: {\n name: constants.FLOAT_VEC3,\n uniform (gl: WebGL2RenderingContext | WebGLRenderingContext, info: ProgramUniformInfo, value: Float32List) {\n gl.uniform3fv(info.loc, value);\n },\n },\n [constants.FLOAT_VEC4]: {\n name: constants.FLOAT_VEC4,\n uniform (gl: WebGL2RenderingContext | WebGLRenderingContext, info: ProgramUniformInfo, value: Float32List) {\n gl.uniform4fv(info.loc, value);\n },\n },\n [constants.FLOAT_MAT2]: {\n name: constants.FLOAT_MAT2,\n uniform: (gl: WebGL2RenderingContext | WebGLRenderingContext, info: ProgramUniformInfo, value: Float32List) => {\n gl.uniformMatrix2fv(info.loc, false, value);\n },\n },\n [constants.FLOAT_MAT2x3]: {\n name: constants.FLOAT_MAT2x3,\n uniform: (gl: WebGL2RenderingContext, info: ProgramUniformInfo, value: Float32List) => {\n gl.uniformMatrix2x3fv(info.loc, false, value);\n },\n },\n [constants.FLOAT_MAT2x4]: {\n name: constants.FLOAT_MAT2x4,\n uniform: (gl: WebGL2RenderingContext, info: ProgramUniformInfo, value: Float32List) => {\n gl.uniformMatrix2x3fv(info.loc, false, value);\n },\n },\n [constants.FLOAT_MAT3]: {\n name: constants.FLOAT_MAT3,\n uniform: (gl: WebGL2RenderingContext | WebGLRenderingContext, info: ProgramUniformInfo, value: Float32List) => {\n gl.uniformMatrix3fv(info.loc, false, value);\n },\n },\n [constants.FLOAT_MAT3x2]: {\n name: constants.FLOAT_MAT3x2,\n uniform: (gl: WebGL2RenderingContext, info: ProgramUniformInfo, value: Float32List) => {\n gl.uniformMatrix3x2fv(info.loc, false, value);\n },\n },\n [constants.FLOAT_MAT3x4]: {\n name: constants.FLOAT_MAT3x4,\n uniform: (gl: WebGL2RenderingContext, info: ProgramUniformInfo, value: Float32List) => {\n gl.uniformMatrix3x4fv(info.loc, false, value);\n },\n },\n [constants.FLOAT_MAT4]: {\n name: constants.FLOAT_MAT4,\n uniform: (gl: WebGL2RenderingContext | WebGLRenderingContext, info: ProgramUniformInfo, value: Float32List) => {\n gl.uniformMatrix4fv(info.loc, false, value);\n },\n },\n [constants.FLOAT_MAT4x3]: {\n name: constants.FLOAT_MAT4x3,\n uniform: (gl: WebGL2RenderingContext, info: ProgramUniformInfo, value: Float32List) => {\n gl.uniformMatrix4x3fv(info.loc, false, value);\n },\n },\n [constants.FLOAT_MAT4x2]: {\n name: constants.FLOAT_MAT4x2,\n uniform: (gl: WebGL2RenderingContext, info: ProgramUniformInfo, value: Float32List) => {\n gl.uniformMatrix4x2fv(info.loc, false, value);\n },\n },\n [constants.INT]: {\n name: constants.INT,\n uniform: (gl: WebGL2RenderingContext | WebGLRenderingContext, info: ProgramUniformInfo, value: Int32List) => {\n if (value.length != undefined) {\n gl.uniform1iv(info.loc, value);\n } else {\n gl.uniform1i(info.loc, (value as any));\n }\n },\n },\n [constants.INT_VEC2]: {\n name: constants.INT_VEC2,\n uniform: (gl: WebGL2RenderingContext | WebGLRenderingContext, info: ProgramUniformInfo, value: Int32List) => {\n gl.uniform2iv(info.loc, value);\n },\n },\n [constants.INT_VEC3]: {\n name: constants.INT_VEC3,\n uniform: (gl: WebGL2RenderingContext | WebGLRenderingContext, info: ProgramUniformInfo, value: Int32List) => {\n gl.uniform3iv(info.loc, value);\n },\n },\n [constants.INT_VEC4]: {\n name: constants.INT_VEC4,\n uniform: (gl: WebGL2RenderingContext | WebGLRenderingContext, info: ProgramUniformInfo, value: Int32List) => {\n gl.uniform4iv(info.loc, value);\n },\n },\n [constants.UNSIGNED_INT]: {\n name: constants.UNSIGNED_INT,\n uniform: (gl: WebGL2RenderingContext, info: ProgramUniformInfo, value: Uint32Array | ArrayLike<number>) => {\n gl.uniform1uiv(info.loc, value);\n },\n },\n [constants.UNSIGNED_INT_VEC2]: {\n name: constants.UNSIGNED_INT_VEC2,\n uniform: (gl: WebGL2RenderingContext, info: ProgramUniformInfo, value: Uint32Array | ArrayLike<number>) => {\n gl.uniform2uiv(info.loc, value);\n },\n },\n [constants.UNSIGNED_INT_VEC3]: {\n name: constants.UNSIGNED_INT_VEC3,\n uniform: (gl: WebGL2RenderingContext, info: ProgramUniformInfo, value: Uint32Array | ArrayLike<number>) => {\n gl.uniform3uiv(info.loc, value);\n },\n },\n [constants.UNSIGNED_INT_VEC4]: {\n name: constants.UNSIGNED_INT_VEC4,\n uniform: (gl: WebGL2RenderingContext, info: ProgramUniformInfo, value: Uint32Array | ArrayLike<number>) => {\n gl.uniform4uiv(info.loc, value);\n },\n },\n [constants.BOOL]: {\n name: constants.BOOL,\n uniform: (gl: WebGLRenderingContext | WebGL2RenderingContext, info: ProgramUniformInfo, value: Int32List) => {\n if (value.length != undefined) {\n gl.uniform1iv(info.loc, value);\n } else {\n gl.uniform1f(info.loc, (value as any));\n }\n },\n },\n [constants.BOOL_VEC2]: {\n name: constants.BOOL_VEC2,\n uniform: (gl: WebGLRenderingContext | WebGL2RenderingContext, info: ProgramUniformInfo, value: Int32List) => {\n gl.uniform2iv(info.loc, value);\n },\n },\n [constants.BOOL_VEC4]: {\n name: constants.BOOL_VEC4,\n uniform: (gl: WebGLRenderingContext | WebGL2RenderingContext, info: ProgramUniformInfo, value: Int32List) => {\n gl.uniform4iv(info.loc, value);\n },\n },\n [constants.BOOL_VEC3]: {\n name: constants.BOOL_VEC3,\n uniform: (gl: WebGLRenderingContext | WebGL2RenderingContext, info: ProgramUniformInfo, value: Int32List) => {\n gl.uniform3iv(info.loc, value);\n },\n },\n [constants.SAMPLER_2D]: {\n name: constants.SAMPLER_2D,\n uniform: assignTexUniform,\n },\n [constants.SAMPLER_CUBE]: {\n name: constants.SAMPLER_CUBE,\n uniform: assignTexUniform,\n },\n};\n\nfunction assignTexUniform (gl: WebGL2RenderingContext | WebGLRenderingContext, info: ProgramUniformInfo, value: MarsTexture | MarsTexture[], renderer: GLGPURenderer) {\n if (value) {\n if (info.size > 1) {\n if (Array.isArray(value)) {\n value.forEach(function (tex, index) {\n assignTextureLoc(gl, info, tex, renderer, index);\n });\n } else {\n consoleError(`${info.name}[${info.size}] expect texture arrays`);\n }\n } else {\n assignTextureLoc(gl, info, value as MarsTexture, renderer, 0);\n }\n }\n}\n\nfunction assignTextureLoc (gl: WebGLRenderingContext | WebGL2RenderingContext, info: ProgramUniformInfo, value: MarsTexture, renderer: GLGPURenderer, index: number) {\n if (value) {\n if (value.isDestroyed) {\n return consoleError(`texture ${value.name} destroyed `, value);\n }\n renderer.state.activeTexture(gl.TEXTURE0 + info.textureIndex + index);\n const glTex = value.internal;\n\n if (glTex) {\n renderer.state.bindTexture(glTex.target, glTex.glHandle as WebGLTexture, true);\n } else {\n consoleWarn('texture not assigned to gl');\n }\n }\n}\n","import { constants } from './constants';\nimport type { GLGPURenderer } from './GLGPURenderer';\nimport type { TypedArray, UniformValue, vec2 } from '../../types';\nimport { GLGPUBuffer } from './GLGPUBuffer';\nimport { forEach, strHashCode } from '../common/utils';\n\ntype TypedArrayCtrl =\n Float32ArrayConstructor\n | Int8ArrayConstructor\n | Int32ArrayConstructor\n | Int16ArrayConstructor\n | Uint32ArrayConstructor\n | Uint16ArrayConstructor\n | Uint8ArrayConstructor;\n\nexport interface UniformBlockSpec {\n index: number,\n usedByVertexShader: boolean,\n usedByFragmentShader: boolean,\n size: number,\n uniformIndices: number[],\n used: boolean,\n name: string,\n uniforms: Record<string, BlockUniformInfo>,\n id: string,\n}\n\ntype BlockUniformInfo = [\n type: number,\n offset: number,\n size: number,\n blockIndex: number,\n arrayStride: number,\n maxStride: number,\n rowMajor: number,\n index: number,\n byteLength: number,\n];\n\nconst BlockUniformInfoOffset = 1;\nconst BlockUniformInfoByteLength = 8;\nconst BlockUniformInfoType = 0;\nconst BlockUniformInfoArrayStride = 4;\nconst BlockUniformInfoArraySize = 2;\nconst BlockUniformInfoRowStride = 5;\n\nfunction getUboHash (spec: UniformBlockSpec) {\n const ret = Object.keys(spec.uniforms).map(name => name + '[' + spec.uniforms[name].join(':') + ']').join('+');\n\n return strHashCode(spec.name + '+', spec.size + '+', spec.uniformIndices.length + '+', ret);\n}\n\nexport function createUniformBlockSpecsFromProgram (gl: WebGL2RenderingContext, program: WebGLProgram, blockUniformNames: string[]): UniformBlockSpec[] {\n const blockSpecs: UniformBlockSpec[] = [];\n const numUniformBlocks = gl.getProgramParameter(program, gl.ACTIVE_UNIFORM_BLOCKS);\n\n for (let ii = 0; ii < numUniformBlocks; ++ii) {\n const name = gl.getActiveUniformBlockName(program, ii) as string;\n const blockSpec: UniformBlockSpec = {\n index: gl.getUniformBlockIndex(program, name),\n usedByVertexShader: gl.getActiveUniformBlockParameter(program, ii, gl.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),\n usedByFragmentShader: gl.getActiveUniformBlockParameter(program, ii, gl.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),\n size: gl.getActiveUniformBlockParameter(program, ii, gl.UNIFORM_BLOCK_DATA_SIZE),\n uniformIndices: gl.getActiveUniformBlockParameter(program, ii, gl.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES),\n used: false,\n uniforms: {},\n name: name,\n id: '',\n };\n\n blockSpec.used = blockSpec.usedByVertexShader || blockSpec.usedByFragmentShader;\n blockSpecs[ii] = blockSpec;\n const indices = blockSpec.uniformIndices;\n const uniformNames: string[] = [];\n\n for (let i = 0; i < indices.length; i++) {\n const name = gl.getActiveUniform(program, indices[i])!.name.replace('[0]', '');\n\n blockSpec.uniforms[name] = [0, 0, 0, 0, 0, 0, 0, i, 0];\n uniformNames[i] = name;\n blockUniformNames.push(name);\n }\n [gl.UNIFORM_TYPE, gl.UNIFORM_OFFSET, gl.UNIFORM_SIZE, gl.UNIFORM_BLOCK_INDEX, gl.UNIFORM_ARRAY_STRIDE, gl.UNIFORM_MATRIX_STRIDE, gl.UNIFORM_IS_ROW_MAJOR].forEach(function (param, pi) {\n gl.getActiveUniforms(program, indices, param).forEach(function (value: number, idx: number) {\n const name = uniformNames[idx];\n\n blockSpec.uniforms[name][pi] = +value;\n });\n });\n for (let i = 0; i < uniformNames.length; i++) {\n const uniform = blockSpec.uniforms[uniformNames[i]];\n const nextUniform = blockSpec.uniforms[uniformNames[i + 1]];\n const size = nextUniform ? nextUniform[1] : blockSpec.size;\n\n uniform[8] = size - uniform[1];\n }\n blockSpec.id = getUboHash(blockSpec) + '';\n }\n\n return blockSpecs;\n}\n\nfunction numberSetter (type: TypedArrayCtrl) {\n return function (value: number | number[], info: BlockUniformInfo, name: string, range: vec2): UBODirtyFlag {\n const flag: UBODirtyFlag = {\n start: info[BlockUniformInfoOffset],\n dirty: true,\n };\n const arrSize = info[BlockUniformInfoArraySize];\n\n if (arrSize > 1) {\n const values = value as number[];\n\n if (values.length) {\n const eleCount = range[1] || values.length;\n const vecLen = info[BlockUniformInfoArrayStride] / type.BYTES_PER_ELEMENT;\n const buffer = flag.buffer = new type(eleCount * vecLen);\n const start = range[0] || 0;\n\n for (let i = 0; i < eleCount; i++) {\n buffer[i * vecLen] = values[i + start];\n }\n flag.start += start * vecLen;\n }\n } else {\n flag.buffer = new type([value] as number[]);\n }\n\n return flag;\n };\n}\n\nconst arrSetter = (type: TypedArrayCtrl) => function setArray (value: number[], info: BlockUniformInfo, name: string, range: vec2): UBODirtyFlag {\n const blockByteLen = info[BlockUniformInfoByteLength];\n const arrSize = info[BlockUniformInfoArraySize];\n const rowStride = info[BlockUniformInfoRowStride];\n const entryStride = arrSize === 1 ? blockByteLen : info[BlockUniformInfoArrayStride];\n const entryRowCount = rowStride ? entryStride / rowStride : 1;\n const rowNumPadding = entryStride / type.BYTES_PER_ELEMENT / entryRowCount;\n const maxRowCount = blockByteLen / type.BYTES_PER_ELEMENT / rowNumPadding;\n //set array\n const numPerEntry = ItemPerValueMap[info[BlockUniformInfoType]];\n const numPerRow = numPerEntry / entryRowCount;\n const valueStartIndex = (range[0] || 0) * numPerEntry;\n const totalRow = range[1] ? entryRowCount * range[1] : maxRowCount;\n const buffer = new type(rowNumPadding * totalRow);\n const flag: UBODirtyFlag = {\n start: info[BlockUniformInfoOffset] + entryStride * (range[0] || 0),\n dirty: true,\n buffer,\n };\n\n for (let i = 0, bufferTarget = 0, sourceIndex = valueStartIndex; i < totalRow; i++) {\n for (let j = 0; j < numPerRow; j++) {\n buffer[bufferTarget + j] = value[sourceIndex + j];\n }\n bufferTarget += rowNumPadding;\n sourceIndex += numPerRow;\n }\n\n return flag;\n};\n\nconst setFloat32Array = arrSetter(Float32Array);\nconst setInt32Array = arrSetter(Int32Array);\nconst setUInt8Array = arrSetter(Uint8Array);\n\nconst MemorySetter: Record<string, (value: any, info: BlockUniformInfo, name: string, range: vec2) => UBODirtyFlag> = {\n [constants.FLOAT]: numberSetter(Float32Array),\n [constants.INT]: numberSetter(Int32Array),\n [constants.UNSIGNED_INT]: numberSetter(Uint32Array),\n [constants.SHORT]: numberSetter(Int16Array),\n [constants.BOOL]: numberSetter(Uint8Array),\n [constants.UNSIGNED_SHORT]: numberSetter(Uint16Array),\n [constants.FLOAT_VEC2]: setFloat32Array,\n [constants.FLOAT_VEC3]: setFloat32Array,\n [constants.FLOAT_VEC4]: setFloat32Array,\n [constants.FLOAT_MAT2]: setFloat32Array,\n [constants.FLOAT_MAT3]: setFloat32Array,\n [constants.FLOAT_MAT4]: setFloat32Array,\n [constants.FLOAT_MAT2x3]: setFloat32Array,\n [constants.FLOAT_MAT2x4]: setFloat32Array,\n [constants.FLOAT_MAT4x3]: setFloat32Array,\n [constants.FLOAT_MAT4x2]: setFloat32Array,\n [constants.FLOAT_MAT3x4]: setFloat32Array,\n [constants.FLOAT_MAT3x2]: setFloat32Array,\n [constants.INT_VEC2]: setInt32Array,\n [constants.INT_VEC3]: setInt32Array,\n [constants.INT_VEC4]: setInt32Array,\n [constants.UNSIGNED_INT_VEC2]: setInt32Array,\n [constants.UNSIGNED_INT_VEC3]: setInt32Array,\n [constants.UNSIGNED_INT_VEC4]: setInt32Array,\n [constants.BOOL_VEC2]: setUInt8Array,\n [constants.BOOL_VEC3]: setUInt8Array,\n [constants.BOOL_VEC4]: setUInt8Array,\n};\n\nconst ItemPerValueMap: Record<number, number> = {\n [constants.FLOAT]: 1,\n [constants.INT]: 1,\n [constants.UNSIGNED_INT]: 1,\n [constants.SHORT]: 1,\n [constants.BOOL]: 1,\n [constants.UNSIGNED_SHORT]: 1,\n [constants.FLOAT_VEC2]: 2,\n [constants.FLOAT_VEC3]: 3,\n [constants.FLOAT_VEC4]: 4,\n [constants.FLOAT_MAT2]: 4,\n [constants.FLOAT_MAT3]: 9,\n [constants.FLOAT_MAT4]: 16,\n [constants.FLOAT_MAT2x3]: 6,\n [constants.FLOAT_MAT2x4]: 8,\n [constants.FLOAT_MAT4x3]: 12,\n [constants.FLOAT_MAT4x2]: 8,\n [constants.FLOAT_MAT3x4]: 12,\n [constants.FLOAT_MAT3x2]: 6,\n [constants.INT_VEC2]: 2,\n [constants.INT_VEC3]: 3,\n [constants.INT_VEC4]: 4,\n [constants.UNSIGNED_INT_VEC2]: 2,\n [constants.UNSIGNED_INT_VEC3]: 3,\n [constants.UNSIGNED_INT_VEC4]: 4,\n [constants.BOOL_VEC2]: 2,\n [constants.BOOL_VEC3]: 3,\n [constants.BOOL_VEC4]: 4,\n};\n\nconst fullRange = [0, 0];\n\ninterface UBODirtyFlag {\n start: number,\n dirty: boolean,\n buffer?: TypedArray,\n}\n\nexport class UniformBlockBuffer {\n buffer?: GLGPUBuffer;\n info: UniformBlockSpec;\n dirtyFlags: Record<string, UBODirtyFlag>;\n keepData: boolean;//for debug use\n\n constructor (renderer: GLGPURenderer, info: UniformBlockSpec) {\n this.buffer = new GLGPUBuffer({\n target: constants.UNIFORM_BUFFER,\n name: info.name,\n byteLength: info.size,\n }, renderer);\n this.dirtyFlags = {};\n this.info = info;\n }\n\n setValues (uniformValues: Record<string, UniformValue>, dirtyFlags: Record<string, boolean>, uniformValueOffsets: Record<string, vec2>) {\n forEach(uniformValues, (value, name) => {\n const uniformInfo: BlockUniformInfo = this.info.uniforms[name];\n\n if (uniformInfo && dirtyFlags[name]) {\n const range = uniformValueOffsets[name] || fullRange;\n const setter = MemorySetter[uniformInfo[BlockUniformInfoType]];\n\n this.dirtyFlags[name] = setter(value, uniformInfo, name, range);\n }\n });\n\n }\n\n bind (gl: WebGL2RenderingContext, program: WebGLProgram, bufferBindIndex: number) {\n const buffer = this.buffer;\n\n if (buffer) {\n buffer.bind();\n forEach(this.dirtyFlags, (flag, name) => {\n if (flag.dirty) {\n buffer.bufferSubData(flag.start, new Uint8Array(flag.buffer!.buffer));\n if (!this.keepData) {\n delete flag.buffer;\n }\n flag.dirty = false;\n }\n });\n gl.uniformBlockBinding(program, bufferBindIndex, bufferBindIndex);\n gl.bindBufferRange(gl.UNIFORM_BUFFER, bufferBindIndex, buffer.glBuffer, 0, this.info.size);\n }\n\n }\n\n destroy () {\n if (this.buffer) {\n this.buffer.destroy();\n this.buffer = undefined;\n }\n }\n}\n\n","import type { GLGPURenderer } from './GLGPURenderer';\nimport { arrAdd, forEach } from '../common/utils';\nimport type { GLGeometry } from './GLGeometry';\nimport type { RenderState } from '../../types/RenderFrame';\nimport { DATA_DICT } from './glType';\nimport { consoleError, consoleWarn } from '../common/console';\nimport type { MarsMaterial } from '../render/MarsMaterial';\nimport type { GLVertexArrayObject } from './GLVertexArrayObject';\nimport type { UniformBlockSpec } from './GLUniformUtils';\nimport { createUniformBlockSpecsFromProgram } from './GLUniformUtils';\nimport type { MarsMaterialDataBlock } from '../render/MarsMaterialDataBlock';\nimport { getBytesPerElementByGLType, getMatAttrLocPair } from './constants';\nimport type { UniformValue } from '../../types';\n\nexport interface ProgramAttributeInfo {\n readonly name: string,\n readonly size: number,\n readonly type: number,\n readonly loc: number,\n}\n\nexport interface ProgramUniformInfo {\n readonly loc: WebGLUniformLocation,\n readonly subInfos: ProgramUniformInfo[],\n readonly name: string,\n readonly size: number,\n readonly type: number,\n readonly textureIndex: number,\n readonly isTexture: boolean,\n}\n\nconst temArr: Set<MarsMaterialDataBlock> = new Set<MarsMaterialDataBlock>();\n\nexport class GLProgram {\n readonly glHandle: WebGLProgram;\n readonly renderer: GLGPURenderer;\n readonly shared: boolean;\n readonly id: string;\n readonly _vaos: GLVertexArrayObject[];\n readonly uniformBlockMap: Record<string, UniformBlockSpec>;\n attrInfoMap!: { [key: string]: ProgramAttributeInfo };\n uniformInfoMap!: { [key: string]: ProgramUniformInfo };\n private _uniformBlocks!: UniformBlockSpec[];\n\n constructor (renderer: GLGPURenderer, program: WebGLProgram, shared: boolean, id: string) {\n this.glHandle = program;\n this.renderer = renderer;\n this.shared = shared;\n this.uniformBlockMap = {};\n this.id = id;\n this.init(renderer, program);\n this._vaos = [];\n }\n\n init (renderer: GLGPURenderer, program: WebGLProgram) {\n const gl = renderer.gl;\n\n renderer.state.useProgram(program);\n let num = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);\n const attrMap: { [key: string]: ProgramAttributeInfo } = {};\n\n for (let i = 0; i < num; i++) {\n const { name, type, size } = gl.getActiveAttrib(program, i) as WebGLActiveInfo;\n const loc = gl.getAttribLocation(program, name);\n\n attrMap[name] = {\n type, name, size, loc,\n };\n }\n\n this.attrInfoMap = attrMap;\n\n const uniformMap: { [key: string]: ProgramUniformInfo } = {};\n\n num = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n let textureIndex = 0;\n const emptyTexture2D = renderer.emptyTexture2D;\n const emptyTextureCube = renderer.emptyTextureCube;\n const blockUniformNames: string[] = [];\n\n if (renderer.level === 2) {\n this._uniformBlocks = createUniformBlockSpecsFromProgram(gl as WebGL2RenderingContext, program, blockUniformNames);\n this._uniformBlocks.forEach(b => this.uniformBlockMap[b.name] = b);\n } else {\n this._uniformBlocks = [];\n }\n for (let i = 0; i < num; i++) {\n const info = gl.getActiveUniform(program, i) as WebGLActiveInfo;\n const { size, type } = gl.getActiveUniform(program, i) as WebGLActiveInfo;\n let name = info.name;\n let location = null;\n\n // BUG, webgl and node gl use different name\n if (/\\[0\\]$/.test(name)) {\n location = gl.getUniformLocation(program, name);\n }\n name = name.replace(/\\[0\\]$/, '');\n if (!location) {\n location = gl.getUniformLocation(program, name);\n }\n if (!location) {\n if (!blockUniformNames.includes(name)) {\n consoleWarn(`get uniform ${name} loc fail`);\n }\n continue;\n }\n this.renderer._assignInspectorName(location, name);\n let locTexIndex = -1;\n\n if (type === gl.SAMPLER_2D || type === gl.SAMPLER_CUBE) {\n locTexIndex = textureIndex;\n for (let k = 0; k < size; k++) {\n const subLoc = k > 0 ? gl.getUniformLocation(program, `${name}[${k}]`) : location;\n const activeIndex = textureIndex + k;\n\n if (activeIndex < renderer.gpu.capability.maxShaderTexCount) {\n gl.activeTexture(gl.TEXTURE0 + activeIndex);\n if (type === gl.SAMPLER_2D) {\n gl.bindTexture(gl.TEXTURE_2D, emptyTexture2D.glHandle as WebGLTexture);\n } else {\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, emptyTextureCube.glHandle as WebGLTexture);\n }\n gl.uniform1i(subLoc, activeIndex);\n } else {\n consoleError(`texture index ${activeIndex} overflows max ${renderer.gpu.capability.maxShaderTexCount}`);\n }\n }\n textureIndex += size;\n }\n\n const subInfos: ProgramUniformInfo[] = [];\n\n for (let j = 0; j < size; ++j) {\n const fullName = name + '[' + j + ']';\n const loc = gl.getUniformLocation(program, fullName);\n\n if (loc !== null) {\n subInfos.push({\n name: fullName,\n loc: loc,\n subInfos: [],\n type: type,\n size: 1,\n textureIndex: locTexIndex,\n isTexture: locTexIndex > -1,\n });\n }\n }\n\n uniformMap[name] = {\n name,\n loc: location,\n subInfos: subInfos,\n type,\n size,\n textureIndex: locTexIndex,\n isTexture: locTexIndex > -1,\n };\n }\n\n renderer.state.useProgram(null);\n gl.activeTexture(gl.TEXTURE0);\n renderer.state.activeTexture(gl.TEXTURE0);\n renderer.state.bindTexture(gl.TEXTURE_2D, emptyTexture2D.glHandle as WebGLTexture, true);\n this.uniformInfoMap = uniformMap;\n }\n\n bind () {\n const renderer = this.renderer;\n\n if (renderer) {\n renderer.state.useProgram(this.glHandle);\n }\n\n }\n\n getSemanticValue (state: RenderState, semanticName: string) {\n const renderPassSemantics = state.currentPass.semantics;\n const renderFrameSemantics = state.currentFrame.semantics;\n\n if (renderPassSemantics.hasSemanticValue(semanticName)) {\n return renderPassSemantics.getSemanticValue(semanticName, state);\n } else if (renderFrameSemantics.hasSemanticValue(semanticName)) {\n return renderFrameSemantics.getSemanticValue(semanticName, state);\n }\n }\n\n setupUniforms (state: RenderState) {\n this.bind();\n const material = state.currentMesh.material as MarsMaterial;\n const gl = this.renderer.gl;\n const blocks = material._dataBlocks;\n const shared = this.shared;\n\n temArr.clear();\n\n forEach(this.uniformBlockMap, (uboInfo, name) => {\n if (uboInfo) {\n\n const block = material.getDataBlockByName(uboInfo.name);\n\n if (block) {\n forEach(block.uniformSemantics, (semanticName, uniformName: string)=> {\n if (uniformName in uboInfo.uniforms && !block.hasUniformValue(uniformName)) {\n const val = this.getSemanticValue(state, semanticName) as UniformValue;\n\n if (val || val === 0) {\n block.setUniformValue(uniformName, val, true);\n }\n\n }\n });\n const uboBuffer = block.createUboBuffer(uboInfo);\n\n if (uboBuffer) {\n block.setUboBuffer(uboBuffer);\n temArr.add(block);\n\n return uboBuffer.bind(gl as WebGL2RenderingContext, this.glHandle, uboInfo.index);\n }\n }\n }\n });\n\n forEach(this.uniformInfoMap, (info: ProgramUniformInfo, name) => {\n let val;\n\n for (let i = 0; i < blocks.length; i++) {\n const block = blocks[i];\n const semanticName = block.uniformSemantics[name];\n\n if (info.isTexture) {\n if (block.hasUniformValue(name)) {\n val = block.getUniformTexture(name);\n } else if (semanticName) {\n val = this.getSemanticValue(state, semanticName);\n }\n } else if (temArr.has(block)) {\n continue;\n } else if (block.hasUniformValue(name)) {\n if (!shared && !block._uniformFlags[name] && info.textureIndex === -1) {\n //not dirty, don't assign\n return;\n }\n val = block.getUniformValue(name);\n } else if (semanticName) {\n val = this.getSemanticValue(state, semanticName);\n }\n if (val !== undefined && val !== null) {\n return this.setGLUniformValue(name, val, info, gl);\n }\n }\n if (!info.isTexture) {\n consoleWarn(`mesh ${state.currentMesh.name} uniform ${name} value unset`);\n }\n });\n\n }\n\n setGLUniformValue (name: string, value: any, info: ProgramUniformInfo, gl: WebGL2RenderingContext | WebGLRenderingContext) {\n const uniformInfo = DATA_DICT[info.type];\n const subInfos = info.subInfos;\n\n if (subInfos.length > 0 && Array.isArray(value) && Array.isArray(value[0])) {\n for (let i = 0; i < subInfos.length && i < value.length; ++i) {\n const subInfo = subInfos[i];\n\n uniformInfo.uniform(gl, subInfo, value[i], this.renderer);\n }\n\n return;\n }\n uniformInfo.uniform(gl, info, value, this.renderer);\n }\n\n setupAttributes (geometry: GLGeometry): GLVertexArrayObject {\n const gl = this.renderer.gl as WebGLRenderingContext;\n const vao = geometry.createVao(this.id);\n const gpu = this.renderer.gpu;\n\n if (vao) {\n vao.bind();\n if (vao.ready) {\n return vao;\n } else {\n arrAdd(this._vaos, vao);\n }\n }\n forEach(this.attrInfoMap, function (attrInfo, name) {\n const attribute = geometry.attributes[name];\n\n if (attribute) {\n const buffer = geometry.getGPUBuffer(attribute.dataSource);\n\n if (!buffer) {\n throw Error(`no buffer named ${attribute.dataSource || name}`);\n }\n buffer.bind();\n if (attribute.size > 4) {\n const [row, col] = getMatAttrLocPair(attrInfo.type);\n const bytesPerRow = getBytesPerElementByGLType(attribute.type) * col;\n const stride = row * bytesPerRow;\n\n for (let i = 0; i < row; i++) {\n const loc = attrInfo.loc + i;\n\n gl.enableVertexAttribArray(loc);\n gl.vertexAttribPointer(loc, col, attribute.type, attribute.normalize as boolean, stride, i * bytesPerRow);\n if (attribute.instanceDivisor && gpu.capability.instanceDraw) {\n gpu.vertexAttribDivisor(gl, loc, attribute.instanceDivisor);\n }\n }\n } else {\n gl.enableVertexAttribArray(attrInfo.loc);\n gl.vertexAttribPointer(attrInfo.loc, attribute.size, attribute.type, attribute.normalize as boolean, attribute.stride || 0, attribute.offset || 0);\n if (attribute.instanceDivisor && gpu.capability.instanceDraw) {\n gpu.vertexAttribDivisor(gl, attrInfo.loc, attribute.instanceDivisor);\n }\n }\n\n }\n });\n geometry._indexBuffer?.bind();\n if (vao) {\n vao.ready = true;\n }\n\n return vao;\n }\n\n destroy () {\n if (this.renderer) {\n this._vaos.forEach(vao => vao.destroy());\n this._vaos.length = 0;\n this.renderer.gl.deleteProgram(this.glHandle);\n //@ts-expect-error safe to assign\n this.renderer = null;\n }\n }\n}\n","import type {\n ShaderCompileResult,\n ShaderLibrary,\n ShaderMarcos,\n ShaderWithSource,\n SharedShaderWithSource,\n} from '../../types/ShaderLibrary';\nimport {\n ShaderCompileResultStatus,\n} from '../../types/ShaderLibrary';\nimport type { GLGPURenderer } from './GLGPURenderer';\nimport { arrAdd, forEach, strHashCode } from '../common/utils';\nimport { requestAnimationFrame } from '../common/raf';\nimport { GLProgram } from './GLProgram';\nimport { consoleError } from '../common/console';\n\ninterface GLShaderCompileResult extends ShaderCompileResult {\n program?: WebGLProgram,\n}\n\nenum ShaderType {\n vertex = 0,\n fragment = 1\n}\n\nconst downgradeKeywords: Record<string, Record<string, string>> = {\n [ShaderType.vertex]: {\n in: 'attribute',\n out: 'varying',\n },\n [ShaderType.fragment]: {\n in: 'varying',\n },\n};\nlet shaderSeed = 1;\n\nexport class GLShaderLibrary implements ShaderLibrary {\n readonly renderer: GLGPURenderer;\n private readonly shaderResults: { [p: string]: ShaderCompileResult };\n\n private _shaderMap: { [key: string]: ShaderWithSource };\n private _programMap: { [key: string]: GLProgram };\n\n private _glVertShaderMap: Map<number, WebGLShader>;\n private _glFragShaderMap: Map<number, WebGLShader>;\n\n private readonly _glAsyncCompileExt?: { COMPLETION_STATUS_KHR: number };\n private _shaderAllDone = false;\n\n constructor (renderer: GLGPURenderer) {\n this.renderer = renderer;\n this._shaderMap = {};\n this.shaderResults = {};\n this._programMap = {};\n this._glVertShaderMap = new Map<number, WebGLShader>();\n this._glFragShaderMap = new Map<number, WebGLShader>();\n const gl = this.renderer.gl as WebGLRenderingContext;\n\n this._glAsyncCompileExt = gl.getExtension('KHR_parallel_shader_compile') as { COMPLETION_STATUS_KHR: number };\n }\n\n get cacheIds (): string[] {\n return Object.keys(this.shaderResults);\n }\n getShaderResult (cacheId: string): ShaderCompileResult | undefined {\n if (this.shaderResults) {\n return this.shaderResults[cacheId];\n }\n }\n\n compileAllShaders (asyncCallback?: (results: ShaderCompileResult[]) => void) {\n if (!this._shaderAllDone) {\n const res = this.shaderResults;\n const pendings: string[] = [];\n\n forEach(this._shaderMap, (result, id) => {\n if (!res[id]) {\n arrAdd(pendings, id);\n }\n });\n\n if (asyncCallback) {\n if (pendings.length) {\n Promise.all<Promise<ShaderCompileResult>[]>(\n pendings.map(id => new Promise(resolve => this.compileShader(id, resolve)))\n )\n .then(asyncCallback)\n .catch(() => 0);\n } else {\n asyncCallback([]);\n }\n } else {\n pendings.map(id => this.compileShader(id));\n }\n this._shaderAllDone = true;\n } else if (asyncCallback) {\n asyncCallback([]);\n }\n }\n\n getProgram (shaderCacheId: string): GLProgram | null {\n if (this._programMap[shaderCacheId] == undefined) {\n if (this._shaderMap[shaderCacheId] !== undefined) {\n this.compileShader(shaderCacheId);\n }\n }\n\n return this._programMap[shaderCacheId];\n }\n\n addMarcosHeader (header: string, shader: string, type: ShaderType, downgrade?: boolean): string {\n const versionTag = /#version\\s+\\b\\d{3}\\b\\s*(es)?/;\n const GLV = `WEBGL${this.renderer.level}`;\n\n if (downgrade) {\n header = header + `\n#ifndef ${GLV}\n#define ${GLV}\n#endif`;\n }\n let fullShader = header + '\\n' + shader;\n const match = fullShader.match(versionTag);\n const version = match ? match[0] : '';\n let realVersion = version;\n\n if (version && version.includes('300') && this.renderer.level === 1 && downgrade) {\n realVersion = '';\n fullShader = fullShader.replace(/\\b(in|out)\\b/g, function (str) {\n return downgradeKeywords[type][str] || str;\n });\n }\n\n return realVersion + '\\n' + fullShader.replace(version, '\\n');\n }\n\n addShader (shader: ShaderWithSource): string {\n const marcosHead = shader.marcos ? combineMaterialMarcos(shader.marcos) : '';\n const vertex = shader.vertex ? this.addMarcosHeader(marcosHead, shader.vertex, ShaderType.vertex, shader.downgrade) : '';\n const fragment = shader.fragment ? this.addMarcosHeader(marcosHead, shader.fragment, ShaderType.fragment, shader.downgrade) : '';\n let shaderCacheId: string;\n let shared = false;\n\n if (shader.shared || (shader as unknown as SharedShaderWithSource).cacheId) {\n shaderCacheId = (shader as SharedShaderWithSource).cacheId || `shared_${strHashCode(vertex, fragment)}`;\n shared = true;\n } else {\n shaderCacheId = 'instanced_' + shaderSeed++;\n }\n if (!this._shaderMap[shaderCacheId]) {\n this._shaderAllDone = false;\n this._shaderMap[shaderCacheId] = {\n vertex,\n fragment,\n name: shader.name || shaderCacheId,\n shared,\n };\n }\n\n return shaderCacheId;\n }\n\n compileShader (shaderCacheId: string, asyncCallback?: (result: ShaderCompileResult) => void): ShaderCompileResult {\n const shaderResult = this.shaderResults[shaderCacheId];\n\n if (!shaderResult) {\n const shader = this._shaderMap[shaderCacheId];\n\n if (!shader) {\n return {\n status: ShaderCompileResultStatus.noShader,\n };\n }\n const gl = this.renderer.gl as WebGLRenderingContext;\n const result: GLShaderCompileResult = { shared: shader.shared, status: ShaderCompileResultStatus.compiling };\n const linkProgram = this.createProgram(gl, shader.vertex, shader.fragment, result);\n const ext = this._glAsyncCompileExt;\n const startTime = Date.now();\n const checkComplete = () => {\n const shouldLink = !asyncCallback || !ext || (ext && gl.getProgramParameter(result.program as GLProgram, ext.COMPLETION_STATUS_KHR) == true);\n const program = shouldLink && linkProgram();\n\n if (program) {\n if (result.status !== ShaderCompileResultStatus.fail) {\n this.renderer._assignInspectorName(program, shader.name);\n const glProgram = new GLProgram(this.renderer, program, !!shader.shared, shaderCacheId);\n\n gl.validateProgram(program);\n const valid = gl.getProgramParameter(program, gl.VALIDATE_STATUS);\n\n if (!valid) {\n result.status = ShaderCompileResultStatus.fail;\n } else {\n result.status = ShaderCompileResultStatus.success;\n result.compileTime = Date.now() - startTime;\n this._programMap[shaderCacheId] = glProgram;\n }\n }\n if (result.status === ShaderCompileResultStatus.fail) {\n const error = gl.getProgramInfoLog(program);\n\n result.error = error;\n consoleError('compileProgramError: ' + error, '\\nvertex:\\n', shader.vertex, '\\nfragment:\\n', shader.fragment);\n gl.deleteProgram(program);\n }\n if (asyncCallback) {\n asyncCallback(result);\n }\n } else if (asyncCallback) {\n requestAnimationFrame(checkComplete);\n }\n };\n\n this.shaderResults[shaderCacheId] = result;\n checkComplete();\n } else if (asyncCallback) {\n asyncCallback(shaderResult);\n }\n\n return this.shaderResults[shaderCacheId];\n }\n\n createProgram (gl: WebGLRenderingContext, vs: string, fs: string, result: GLShaderCompileResult): () => (WebGLProgram | null) {\n const program = gl.createProgram();\n const vertexShader = this.createShader(gl, gl.VERTEX_SHADER, vs);\n const fragShader = this.createShader(gl, gl.FRAGMENT_SHADER, fs);\n\n if (program && vertexShader && fragShader) {\n gl.attachShader(program, vertexShader);\n gl.attachShader(program, fragShader);\n gl.linkProgram(program);\n result.program = program;\n result.status = ShaderCompileResultStatus.compiling;\n\n return function () {\n delete result.program;\n let error!: string | null;\n const linked = !error && gl.getProgramParameter(program, gl.LINK_STATUS);\n\n if (!linked) {\n checkShader(vertexShader, 'vertex', vs);\n checkShader(fragShader, 'fragment', fs);\n result.status = ShaderCompileResultStatus.fail;\n\n return program;\n }\n\n return program;\n };\n }\n result.status = ShaderCompileResultStatus.fail;\n\n return () => null;\n function checkShader (shader: WebGLShader, type: string, code: string) {\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\n const error = gl.getShaderInfoLog(shader);\n\n consoleError(\n 'compile ' + (type) + ' error: ' + error,\n code\n .split('\\n')\n .map((line, index) => `${index + 1} ${line}`)\n .join('\\n'),\n );\n result.error = error;\n result.status = ShaderCompileResultStatus.fail;\n }\n }\n }\n\n createShader (gl: WebGLRenderingContext, shaderType: GLenum, code: string): WebGLShader | null {\n const map = shaderType === gl.VERTEX_SHADER ? this._glVertShaderMap : this._glFragShaderMap;\n const strHash = strHashCode(code);\n const ret = map.get(strHash);\n\n if (ret) {\n return ret;\n }\n const shader = gl.createShader(shaderType);\n\n if (shader) {\n gl.shaderSource(shader, code);\n gl.compileShader(shader);\n map.set(strHash, shader);\n }\n\n return shader;\n }\n\n deleteShader (cacheId: string): void {\n const program = this._programMap[cacheId];\n\n if (program !== undefined) {\n program.destroy();\n delete this._programMap[cacheId];\n }\n const result = this.shaderResults[cacheId];\n\n if (result !== undefined) {\n delete this.shaderResults[cacheId];\n }\n }\n\n destroy (): void {\n this._shaderMap = {};\n forEach(this._programMap, function (program: GLProgram) {\n program.destroy();\n });\n this._programMap = {};\n if (this.renderer) {\n const gl = this.renderer.gl;\n\n this._glFragShaderMap.forEach(function (shader) {\n gl.deleteShader(shader);\n });\n this._glVertShaderMap.forEach(function (shader) {\n gl.deleteShader(shader);\n });\n this._glVertShaderMap = new Map<number, WebGLShader>();\n this._glFragShaderMap = new Map<number, WebGLShader>();\n }\n // @ts-expect-error safe to assign\n this['renderer'] = null;\n }\n}\n\nfunction combineMaterialMarcos (marcos?: ShaderMarcos) {\n const ret: string[] = [];\n\n if (marcos) {\n marcos.forEach(function ([key, value]) {\n if (value === true) {\n ret.push(`#define ${key}`);\n } else if (Number.isFinite(value)) {\n ret.push(`#define ${key} ${value}`);\n }\n });\n\n return ret.length ? (ret.join('\\n') + '\\n') : '';\n }\n\n return '';\n}\n\n","export function isAndroid (): boolean {\n if (IS_NODE) {\n return false;\n } else {\n return /\\b[Aa]ndroid\\b/.test(navigator.userAgent);\n }\n}\n","import type {\n GPUCapability,\n GPUCapabilityDetail,\n} from '../../types/GPUCapability';\nimport {\n COMPRESSED_TEXTURE_ASTC,\n COMPRESSED_TEXTURE_PVRTC,\n} from '../../types/GPUCapability';\nimport type { Immutable } from '../../types/type';\nimport { isAndroid } from '../common/env';\nimport { consoleError, consoleWarn } from '../common/console';\n\nlet textureMaxAnisotropyExt: number;\n\ninterface GLGPUCapabilityDetail extends GPUCapabilityDetail {\n vao: boolean,\n standardDerivatives: boolean,\n halfFloatLinear: boolean,\n floatLinear: boolean,\n maxShaderTexCount: number,\n instanceDraw: boolean,\n}\n\nconst webGL2ConstructorAvailable = typeof WebGL2RenderingContext === 'function';\n\nconst TYPE_WEBGL = 'webgl';\nconst TYPE_WEBGL2 = 'webgl2';\n\nexport class GLGPUCapability implements GPUCapability {\n readonly capability!: Immutable<GLGPUCapabilityDetail>;\n readonly level!: number;\n readonly type!: 'webgl' | 'webgl2' | 'node-gl' | 'none';\n\n drawBufferExtension: any;\n vaoExt: any;\n\n UNSIGNED_INT_24_8!: number;\n\n internalFormatDepth16!: number;\n internalFormatDepth24_stencil8!: number;\n\n instanceDrawExt?: ANGLE_instanced_arrays;\n\n constructor (opt: { glType?: 'webgl' | 'webgl2', gl?: WebGLRenderingContext | WebGL2RenderingContext }) {\n let gl = opt.gl;\n let type = 'none';\n\n opt = opt || {};\n let canvas;\n\n if (IS_NODE) {\n gl = require('gl')(1, 1);\n type = 'node-gl';\n } else {\n if (!gl) {\n let prefix = TYPE_WEBGL;\n\n if (!isAndroid() && webGL2ConstructorAvailable) {\n prefix = opt.glType || TYPE_WEBGL2;\n }\n canvas = document.createElement('canvas');\n gl = canvas.getContext(prefix) as WebGLRenderingContext;\n if (!gl) {\n prefix = 'webgl';\n gl = canvas.getContext(prefix) as WebGLRenderingContext;\n }\n }\n if (gl) {\n type = (webGL2ConstructorAvailable && (gl instanceof WebGL2RenderingContext)) ? TYPE_WEBGL2 : TYPE_WEBGL;\n }\n }\n this._setupCapability(gl);\n // @ts-expect-error safe to assign\n this.type = type;\n if (canvas && gl) {\n gl.getExtension('WEBGL_lose_context')?.loseContext();\n }\n }\n\n _setupCapability (gl?: WebGLRenderingContext | WebGL2RenderingContext) {\n if (gl) {\n // @ts-expect-error safe to assign\n this['level'] = (webGL2ConstructorAvailable && gl instanceof WebGL2RenderingContext) ? 2 : 1;\n const level2 = this.level === 2;\n const textureAnisotropicExt = gl.getExtension('EXT_texture_filter_anisotropic') || gl.getExtension('WEBKIT_EXT_texture_filter_anisotropic');\n\n if (!level2) {\n this.vaoExt = gl.getExtension('OES_vertex_array_object');\n } else {\n this.UNSIGNED_INT_24_8 = (gl as WebGL2RenderingContext).UNSIGNED_INT_24_8;\n }\n this.drawBufferExtension = gl.getExtension('WEBGL_draw_buffers');\n const depthTextureExtension = gl.getExtension('WEBGL_depth_texture');\n\n if (depthTextureExtension) {\n this.UNSIGNED_INT_24_8 = depthTextureExtension.UNSIGNED_INT_24_8_WEBGL;\n }\n let halfFloatLinear = !!gl.getExtension('OES_texture_half_float_linear');\n\n if (level2 && !halfFloatLinear) {\n halfFloatLinear = this.checkLinearTextureFilter(gl as WebGL2RenderingContext, (gl as WebGL2RenderingContext).HALF_FLOAT);\n }\n let floatLinear = !!gl.getExtension('OES_texture_float_linear');\n\n if (level2 && !floatLinear) {\n floatLinear = this.checkLinearTextureFilter(gl as WebGL2RenderingContext, (gl as WebGL2RenderingContext).FLOAT);\n }\n this.internalFormatDepth16 = level2 ? (gl as WebGL2RenderingContext).DEPTH_COMPONENT16 : gl.DEPTH_COMPONENT;\n this.internalFormatDepth24_stencil8 = level2 ? (gl as WebGL2RenderingContext).DEPTH24_STENCIL8 : gl.DEPTH_STENCIL;\n this.instanceDrawExt = gl.getExtension('ANGLE_instanced_arrays')!;\n const floatTexture = (level2 || gl.getExtension('OES_texture_float')) ? gl.FLOAT : 0;\n const halfFloatTexture = level2 ? WebGL2RenderingContext.HALF_FLOAT : (gl.getExtension('OES_texture_half_float')?.HALF_FLOAT_OES || 0);\n const detail: GLGPUCapabilityDetail = {\n floatTexture,\n halfFloatTexture,\n maxSample: level2 ? gl.getParameter((gl as WebGL2RenderingContext).MAX_SAMPLES) : 1,\n maxVertexUniforms: gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS),\n maxVertexTextures: gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),\n maxFragmentUniforms: gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS),\n maxFragmentTextures: gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS),\n floatColorAttachment: level2 ? !!gl.getExtension('EXT_color_buffer_float') : (floatTexture > 0 && !!gl.getExtension('WEBGL_color_buffer_float')),\n halfFloatColorAttachment: level2 ? !!gl.getExtension('EXT_color_buffer_float') : (halfFloatTexture > 0 && !!gl.getExtension('EXT_color_buffer_half_float')),\n maxTextureSize: gl.getParameter(gl.MAX_TEXTURE_SIZE),\n maxShaderTexCount: gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),\n compressedTexture: registerCompressedTexture(gl),\n halfFloatLinear,\n floatLinear,\n maxTextureAnisotropy: textureAnisotropicExt ? gl.getParameter(textureAnisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 0,\n shaderTextureLod: level2 || !!gl.getExtension('EXT_shader_texture_lod'),\n instanceDraw: level2 || !!this.instanceDrawExt,\n drawBuffers: level2 || !!this.drawBufferExtension,\n asyncShaderCompile: !!gl.getExtension('KHR_parallel_shader_compile'),\n intIndexElementBuffer: !!gl.getExtension('OES_element_index_uint'),\n standardDerivatives: level2 || !!gl.getExtension('OES_standard_derivatives'),\n readableDepthStencilTextures: level2 || !!depthTextureExtension,\n vao: level2 || !!this.vaoExt,\n writableFragDepth: level2 || !!gl.getExtension('EXT_frag_depth'),\n };\n\n // @ts-expect-error safe to assign\n this['capability'] = detail;\n if (textureAnisotropicExt) {\n textureMaxAnisotropyExt = textureAnisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT;\n }\n // @ts-expect-error safe to assign\n this['type'] = 'webgl' + (level2 ? '2' : '');\n } else {\n // @ts-expect-error safe to assign\n this['capability'] = {};\n }\n }\n\n checkLinearTextureFilter (gl: WebGL2RenderingContext, type: number): boolean {\n let ret = false;\n const tex = gl.createTexture();\n\n gl.getError();\n gl.bindTexture(gl.TEXTURE_2D, tex);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.R16F, 1, 1, 0, gl.RED, type, null);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n if (!gl.getError()) {\n ret = true;\n }\n gl.deleteTexture(tex);\n\n return ret;\n }\n\n framebufferTexture2D (gl: WebGLRenderingContext | WebGL2RenderingContext, target: GLenum, index: number, textarget: number, texture: WebGLTexture) {\n const ext = this.drawBufferExtension;\n\n if (this.level === 1 && !ext && index > 0) {\n throw Error('draw multiple color buffers not available');\n }\n // @ts-expect-error safe to assign\n const attachment = ext ? ext[`COLOR_ATTACHMENT${index}_WEBGL`] : gl['COLOR_ATTACHMENT' + index];\n\n if (attachment) {\n gl.framebufferTexture2D(target, attachment, textarget, texture, 0);\n } else {\n consoleError('invalid color attachment index:' + index);\n }\n }\n\n vertexAttribDivisor (gl: WebGLRenderingContext | WebGL2RenderingContext, loc: number, divisor: number) {\n if (this.level === 2) {\n (gl as WebGL2RenderingContext).vertexAttribDivisor(loc, divisor);\n } else if (this.instanceDrawExt) {\n this.instanceDrawExt.vertexAttribDivisorANGLE(loc, divisor);\n } else {\n consoleWarn('instance draw not support');\n }\n }\n\n drawElementsInstanced (gl: WebGLRenderingContext | WebGL2RenderingContext, mode: GLenum, count: GLsizei, type: GLenum, offset: GLintptr, instanceCount: GLsizei) {\n if (this.level === 2) {\n (gl as WebGL2RenderingContext).drawElementsInstanced(mode, count, type, offset, instanceCount);\n } else if (this.instanceDrawExt) {\n this.instanceDrawExt.drawElementsInstancedANGLE(mode, count, type, offset, instanceCount);\n } else {\n consoleWarn('instance draw not support');\n }\n\n }\n\n drawArraysInstanced (gl: WebGLRenderingContext | WebGL2RenderingContext, mode: GLenum, first: GLint, count: GLsizei, instanceCount: GLsizei) {\n if (this.level === 2) {\n (gl as WebGL2RenderingContext).drawArraysInstanced(mode, first, count, instanceCount);\n } else if (this.instanceDrawExt) {\n this.instanceDrawExt.drawArraysInstancedANGLE(mode, first, count, instanceCount);\n } else {\n consoleWarn('instance draw not support');\n }\n\n }\n\n drawBuffers (gl: WebGLRenderingContext | WebGL2RenderingContext, bufferStates: boolean[]) {\n const ext = this.drawBufferExtension;\n\n if (this.level === 1 && !ext) {\n if (bufferStates.length > 1) {\n throw Error('draw buffers not available');\n } else {\n return;\n }\n }\n const buffers = bufferStates.map(function (enabled, index) {\n if (enabled) {\n // @ts-expect-error safe to assign\n return ext ? ext[`COLOR_ATTACHMENT${index}_WEBGL`] : (gl as WebGL2RenderingContext)['COLOR_ATTACHMENT' + index];\n }\n\n return gl.NONE;\n });\n\n if (ext) {\n ext.drawBuffersWEBGL(buffers);\n } else {\n (gl as WebGL2RenderingContext).drawBuffers(buffers);\n }\n }\n\n setTextureAnisotropic (gl: WebGLRenderingContext | WebGL2RenderingContext, target: GLenum, level: number) {\n const max = this.capability.maxTextureAnisotropy;\n\n if (max) {\n gl.texParameterf(target, textureMaxAnisotropyExt, Math.min(max, level || 4));\n }\n }\n\n setup (gl: WebGLRenderingContext): void {\n this._setupCapability(gl);\n }\n\n}\n\nexport function registerCompressedTexture (gl: WebGLRenderingContext | WebGL2RenderingContext): number {\n if (gl.getExtension('WEBGL_compressed_texture_astc')) {\n return COMPRESSED_TEXTURE_ASTC;\n }\n if (gl.getExtension('WEBGL_compressed_texture_pvrtc') || gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc')) {\n return COMPRESSED_TEXTURE_PVRTC;\n }\n\n return 0;\n}\n","import type {\n Texture2DSourceOptionsCompressed,\n Texture2DSourceOptionsData,\n Texture2DSourceOptionsFrameBuffer,\n Texture2DSourceOptionsImage,\n Texture2DSourceOptionsImageMipmaps,\n Texture2DSourceOptionsVideo,\n TextureConfigOptions,\n TextureCubeSourceOptionsImage,\n TextureCubeSourceOptionsImageMipmaps,\n TextureOptions,\n TextureSourceOptions,\n} from '../../types/Texture';\nimport {\n TextureSourceType,\n} from '../../types/Texture';\nimport type { GLGPURenderer } from './GLGPURenderer';\nimport type { TypedArray, vec2 } from '../../types/type';\nimport { constants } from './constants';\nimport { consoleError, consoleWarn } from '../common/console';\n\ntype HTMLImageLike = ImageBitmap | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement;\ntype GLContext = WebGLRenderingContext | WebGL2RenderingContext;\n\nlet flipCanvas: HTMLCanvasElement;\n\nexport const imageBitMapAvailable = typeof ImageBitmap === 'function' && typeof createImageBitmap == 'function';\n\nexport class GLTexture {\n readonly renderer?: GLGPURenderer;\n readonly glHandle: WebGLTexture | null;\n readonly options: TextureOptions;\n readonly target: GLenum;\n readonly gpuInfo: [format: number, type: number, target: number, mipmaps: vec2[]];\n width!: number;\n height!: number;\n _mipmapUsed = false;\n constructor (option: TextureOptions, renderer: GLGPURenderer) {\n const gl = renderer.gl;\n\n this.renderer = renderer;\n this.gpuInfo = [0, 0, 0, []];\n this.glHandle = renderer.createGLTexture(this, option.name) as WebGLTexture;\n this.options = option;\n this.target = option.target || gl.TEXTURE_2D;\n this.update(option);\n }\n\n setInspectorName (name: string) {\n this.renderer?._assignInspectorName(this.glHandle, name);\n }\n\n errorLog () {\n consoleError('this this texture has been destroyed');\n }\n\n update (source: TextureSourceOptions) {\n const renderer = this.renderer;\n const handle = this.glHandle;\n const target = this.target;\n const options = this.options;\n\n if (renderer && handle) {\n let width = 0;\n let height = 0;\n const gl = renderer.gl;\n\n renderer.state.bindTexture(target, handle);\n const { sourceType, flipY } = options;\n let format = options.format as GLenum;\n let type = options.type as GLenum;\n let internalFormat = options.internalFormat as GLenum;\n\n if (type === constants.HALF_FLOAT) {\n type = renderer.gpu.capability.halfFloatTexture;\n if (!type) {\n consoleError('half float texture is not support');\n }\n if (renderer.gpu.level === 2 && internalFormat === format) {\n if (format === constants.LUMINANCE) {\n format = constants.RED;\n }\n internalFormat = FORMAT_HALF_FLOAT[format];\n }\n if (!renderer.gpu.capability.halfFloatLinear) {\n options.minFilter = options.magFilter = gl.NEAREST;\n consoleWarn('half float linear not support,change to NEAREST');\n }\n } else if (type === gl.FLOAT) {\n type = renderer.gpu.capability.floatTexture;\n if (!type) {\n consoleError('float texture is not support');\n }\n if (renderer.gpu.level === 2 && internalFormat === format) {\n if (format === constants.LUMINANCE) {\n format = constants.RED;\n }\n internalFormat = FORMAT_FLOAT[format];\n }\n if (!renderer.gpu.capability.floatLinear) {\n options.minFilter = options.magFilter = gl.NEAREST;\n consoleWarn('float linear not support,change to NEAREST');\n }\n }\n const gpuInfo = this.gpuInfo;\n\n gpuInfo[0] = internalFormat;\n gpuInfo[1] = type;\n gpuInfo[2] = target;\n const pma = gl.getParameter(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL);\n\n //fucking pma conflicts for other webgl engine\n if (pma != options.premultiplyAlpha) {\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, options.premultiplyAlpha ? 1 : 0);\n }\n // renderer.state.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, options.premultiplyAlpha ? 1 : 0);\n renderer.state.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipY ? 1 : 0);\n if (sourceType === TextureSourceType.framebuffer) {\n const data = (source as Texture2DSourceOptionsFrameBuffer).data;\n\n if (data) {\n width = data.width || 0;\n height = data.height || 0;\n if (width && height && (this.width !== width || this.height !== height)) {\n gl.texImage2D(target, 0, internalFormat, width, height, 0, format, type, null);\n }\n }\n } else if (sourceType === TextureSourceType.data) {\n if (target === gl.TEXTURE_CUBE_MAP) {\n let ret;\n const cubeData = (source as TextureCubeSourceOptionsImage).cube;\n\n cubeData.forEach((data, key) => {\n ret = this.texImage2DData(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + key, 0, internalFormat, format, type, data as { data: TypedArray, width: number, height: number });\n width = Math.max(ret[0], width);\n height = Math.max(ret[1], height);\n });\n } else {\n [width, height] = this.texImage2DData(gl, target, 0, internalFormat, format, type, (source as Texture2DSourceOptionsData).data);\n }\n } else if (sourceType === TextureSourceType.image || sourceType === TextureSourceType.video) {\n if (target === gl.TEXTURE_CUBE_MAP) {\n let ret;\n\n (source as TextureCubeSourceOptionsImage).cube.forEach((image, key) => {\n ret = this.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + key, 0, internalFormat, format, type, image as HTMLImageElement);\n width = Math.max(ret[0], width);\n height = Math.max(ret[1], height);\n });\n } else if (target === gl.TEXTURE_2D) {\n const image = (source as Texture2DSourceOptionsImage).image || (source as Texture2DSourceOptionsVideo).video;\n\n [width, height] = this.texImage2D(gl, target, 0, internalFormat, format, type, image);\n }\n if ((options as Texture2DSourceOptionsImage).generateMipmap) {\n if ((isPowerOfTwo(width) && isPowerOfTwo(height)) || renderer.level == 2) {\n gl.generateMipmap(target);\n const mipmapSizes: vec2[] = [[width, height]];\n let startWidth = width / 2;\n let startHeight = height / 2;\n\n while (startWidth >= 2 && startHeight >= 2) {\n mipmapSizes.push([startWidth, startHeight]);\n startWidth = Math.round(startWidth / 2);\n startHeight = Math.round(startHeight / 2);\n }\n mipmapSizes.push([1, 1]);\n this.gpuInfo[3] = mipmapSizes;\n this._mipmapUsed = true;\n }\n }\n } else if (sourceType === TextureSourceType.mipmaps) {\n let ret;\n\n if (target === gl.TEXTURE_2D) {\n const mipmaps = (source as Texture2DSourceOptionsImageMipmaps).mipmaps;\n const gpuMipmaps = this.gpuInfo[3];\n\n mipmaps.forEach((mipmap, level) => {\n if ('data' in mipmap) {\n ret = this.texImage2DData(gl, target, level, internalFormat, format, type, mipmap);\n } else {\n ret = this.texImage2D(gl, target, level, internalFormat, format, type, mipmap);\n }\n gpuMipmaps[level] = [ret[0], ret[1]];\n if (level === 0) {\n [width, height] = ret;\n }\n });\n this._mipmapUsed = mipmaps.length > 1;\n } else if (target === gl.TEXTURE_CUBE_MAP) {\n const mipmaps = (source as TextureCubeSourceOptionsImageMipmaps).mipmaps;\n const gpuMipmaps = this.gpuInfo[3];\n\n mipmaps.forEach((mipmap, level) => {\n mipmap.forEach((face, key) => {\n if ('data' in face) {\n ret = this.texImage2DData(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + key, level, internalFormat, format, type, face);\n } else {\n ret = this.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + key, level, internalFormat, format, type, face);\n }\n gpuMipmaps[level] = [ret[0], ret[1]];\n if (level === 0) {\n [width, height] = ret;\n }\n });\n });\n this._mipmapUsed = mipmaps.length > 1;\n }\n } else if (sourceType === TextureSourceType.compressed) {\n const mipmaps = (source as Texture2DSourceOptionsCompressed).mipmaps;\n\n if (mipmaps) {\n const gpuMipmaps = this.gpuInfo[3];\n\n width = mipmaps[0].width;\n height = mipmaps[0].height;\n for (let miplevel = 0; miplevel < mipmaps.length; miplevel++) {\n const mipmap = mipmaps[miplevel];\n\n gpuMipmaps[miplevel] = [mipmap.width, mipmap.height];\n gl.compressedTexImage2D(\n target,\n miplevel,\n internalFormat,\n mipmap.width,\n mipmap.height,\n 0,\n mipmap.data);\n }\n this._mipmapUsed = mipmaps.length > 1;\n }\n }\n if (!this._mipmapUsed) {\n this.gpuInfo[3] = [[width, height]];\n }\n if (pma != options.premultiplyAlpha) {\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, pma);\n }\n this.width = width;\n this.height = height;\n this.setTextureFilters(gl, target, options);\n } else {\n this.width = this.height = 0;\n }\n }\n\n setTextureFilters (gl: GLContext, target: GLenum, options: TextureConfigOptions) {\n if (this.target === gl.TEXTURE_2D) {\n this.renderer?.gpu.setTextureAnisotropic(gl, this.target, options.anisotropic || 4);\n }\n const isPot = this.renderer?.level == 2 || (isPowerOfTwo(this.width) && isPowerOfTwo(this.height));\n const minFiler = isPot ? (options.minFilter || gl.NEAREST) : gl.NEAREST;\n const magFilter = isPot ? (options.magFilter || gl.NEAREST) : gl.NEAREST;\n\n gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, minFiler);\n gl.texParameteri(target, gl.TEXTURE_MAG_FILTER, magFilter);\n gl.texParameteri(target, gl.TEXTURE_WRAP_S, isPot ? (options.wrapS || gl.CLAMP_TO_EDGE) : gl.CLAMP_TO_EDGE);\n gl.texParameteri(target, gl.TEXTURE_WRAP_T, isPot ? (options.wrapT || gl.CLAMP_TO_EDGE) : gl.CLAMP_TO_EDGE);\n }\n\n texImage2D (gl: GLContext, target: GLenum, level: number, internalformat: GLenum, format: GLenum, type: GLenum, image: HTMLImageLike): vec2 {\n const options = this.options;\n const maxSize = this.renderer?.gpu.capability.maxTextureSize || 2048;\n let img = image;\n\n if (options.sourceType !== TextureSourceType.video) {\n let shouldResize = options.minFilter !== gl.NEAREST || options.magFilter !== gl.NEAREST || options.wrapS !== gl.CLAMP_TO_EDGE || options.wrapT !== gl.CLAMP_TO_EDGE;\n\n shouldResize = shouldResize || image.width > maxSize || image.height > maxSize;\n if (shouldResize) {\n img = this.resizeImage(image);\n }\n if (imageBitMapAvailable && img instanceof ImageBitmap && options.flipY) {\n img = this.flipImageBitmap(img);\n }\n }\n gl.texImage2D(target, level, internalformat, format, type, img);\n const size: vec2 = [img.width, img.height];\n\n if (flipCanvas) {\n flipCanvas.width = flipCanvas.height = 1;\n }\n\n return options.sourceType === TextureSourceType.video ? [(image as HTMLVideoElement).videoWidth, (image as HTMLVideoElement).videoHeight] : size;\n }\n\n flipImageBitmap (bitmap: ImageBitmap): HTMLCanvasElement {\n if (!flipCanvas) {\n flipCanvas = document.createElement('canvas');\n }\n const width = flipCanvas.width = bitmap.width;\n const height = flipCanvas.height = bitmap.height;\n const ctx = flipCanvas.getContext('2d') as CanvasRenderingContext2D;\n\n ctx.clearRect(0, 0, width, height);\n ctx.fillStyle = 'rgba(255,255,255,0.0039)';\n ctx.fillRect(0, 0, width, height);\n ctx.drawImage(bitmap, 0, 0);\n\n return flipCanvas;\n }\n\n texImage2DData (gl: GLContext, target: GLenum, level: number, internalformat: GLenum, format: GLenum, type: GLenum, data: { data: TypedArray, width: number, height: number }): vec2 {\n const bufferView = data.data;\n // Uint8ClampedArray is incompatible in android\n const neoBuffer = type === gl.UNSIGNED_BYTE ? new Uint8Array(bufferView.buffer, bufferView.byteOffset, bufferView.byteLength / bufferView.BYTES_PER_ELEMENT) : bufferView;\n const channel = Math.round(neoBuffer.length / (data.width * data.height));\n\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, channel);\n gl.texImage2D(target, level, internalformat, data.width, data.height, 0, format, type, neoBuffer);\n if (gl.getError()) {\n consoleError('texImage2D failed');\n }\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, 4);\n\n return [data.width, data.height];\n }\n\n resizeImage (image: HTMLImageLike, targetWidth?: number, targetHeight?: number): HTMLCanvasElement | HTMLImageElement {\n const maxSize = this.renderer?.gpu.capability.maxTextureSize || 2048;\n\n if (this.renderer?.level === 2 && (image.width < maxSize && image.height < maxSize)) {\n return image as HTMLImageElement;\n }\n if (image) {\n const width = image.width;\n const height = image.height;\n const nw = Math.min(maxSize, targetWidth || nearestPowerOfTwo(width));\n const nh = Math.min(maxSize, targetHeight || nearestPowerOfTwo(height));\n\n if (nh !== height || nw !== width) {\n const canvas = document.createElement('canvas');\n\n canvas.width = nw;\n canvas.height = nh;\n const ctx = canvas.getContext('2d') as CanvasRenderingContext2D;\n\n ctx.drawImage(image, 0, 0, image.width, image.height, 0, 0, nw, nh);\n consoleWarn(`image resize from ${width}x${height} to ${nw}x${nh}`);\n\n return canvas;\n }\n }\n\n return image as HTMLImageElement;\n }\n\n offloadData () {\n const renderer = this.renderer;\n const target = this.target;\n\n if (renderer && this.glHandle) {\n const gl = renderer.gl;\n\n renderer.state.bindTexture(target, this.glHandle);\n const data = new Uint8Array([255]);\n const info = this.gpuInfo;\n\n info[3] = [[1, 1]];\n info[0] = gl.LUMINANCE;\n info[1] = gl.UNSIGNED_BYTE;\n info[2] = target;\n if (target === gl.TEXTURE_2D) {\n gl.texImage2D(target, 0, gl.LUMINANCE, 1, 1, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, data);\n\n } else if (target === gl.TEXTURE_CUBE_MAP) {\n const faces = [\n gl.TEXTURE_CUBE_MAP_NEGATIVE_X,\n gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,\n gl.TEXTURE_CUBE_MAP_NEGATIVE_Z,\n gl.TEXTURE_CUBE_MAP_POSITIVE_X,\n gl.TEXTURE_CUBE_MAP_POSITIVE_Y,\n gl.TEXTURE_CUBE_MAP_POSITIVE_Z,\n ];\n\n for (let i = 0; i < faces.length; i++) {\n gl.texImage2D(faces[i], 0, gl.LUMINANCE, 1, 1, 0, gl.LUMINANCE, gl.UNSIGNED_BYTE, data);\n }\n }\n //rewrite mipmap\n gl.generateMipmap(target);\n this.width = this.height = 1;\n }\n }\n\n destroy (): void {\n if (this.renderer) {\n this.renderer.deleteGLTexture(this);\n //@ts-expect-error safe to assign\n this.renderer = this.options = this.glHandle = null;\n\n this.update = this.destroy = this.errorLog;\n }\n }\n\n _assignRenderer (renderer: GLGPURenderer): void {\n throw new Error('Method not implemented.');\n }\n\n}\n\nexport function nearestPowerOfTwo (value: number): number {\n return 2 ** Math.round(Math.log(value) / Math.LN2);\n}\n\nexport function isPowerOfTwo (value: number) {\n return (value & (value - 1)) === 0 && value !== 0;\n}\n\nconst FORMAT_HALF_FLOAT = {\n [constants.RGBA]: 34842, //RGBA16F\n [constants.RGB]: 34843, //RGB16F\n [constants.ALPHA]: 33325, //R16F\n [constants.RED]: 33325, //R16F\n [constants.LUMINANCE_ALPHA]: 33327, //RG16F\n [constants.LUMINANCE]: 33325,\n};\nconst FORMAT_FLOAT = {\n [constants.RGBA]: 34836, //RGBA32F\n [constants.RGB]: 34837, //RGB32F\n [constants.ALPHA]: 33326, //R32F\n [constants.RED]: 33326, //R32F\n [constants.LUMINANCE_ALPHA]: 33328, //RG32F,\n [constants.LUMINANCE]: 33326, //R32F\n};\n","import { GLGPUBuffer } from './GLGPUBuffer';\nimport { WebGLState } from './WebGLState';\nimport { GLShaderLibrary } from './GLShaderLibrary';\nimport type { GPURenderer, RendererExtensions } from '../../types';\nimport type { GPUBufferOptions } from '../../types/GPUBuffer';\nimport type { RenderFrame, RenderFrameOptions } from '../../types/RenderFrame';\nimport { GLGPUCapability } from './GLGPUCapability';\nimport { GLTexture } from './GLTexture';\nimport { arrAdd, arrRemove } from '../common/utils';\nimport { TextureSourceType } from '../../types/Texture';\nimport type { GLRenderBuffer } from './GLRenderBuffer';\nimport type { GLFrameBuffer } from './GLFrameBuffer';\nimport { consoleError } from '../common/console';\n\nconst GL_LOST_EVENT = 'webglcontextlost';\n\nexport class GLGPURenderer implements GPURenderer {\n readonly gl: WebGLRenderingContext | WebGL2RenderingContext;\n readonly level: number;\n readonly gpu: GLGPUCapability;\n readonly state: WebGLState;\n readonly shaderLibrary: GLShaderLibrary;\n readonly emptyTexture2D: GLTexture;\n readonly emptyTextureCube: GLTexture;\n\n readonly _buffers: GLGPUBuffer[];\n readonly _textures: GLTexture[];\n readonly _renderBuffers: GLRenderBuffer[];\n readonly _frameBuffers: GLFrameBuffer[];\n readonly _vaos: WebGLVertexArrayObject[];\n private _sourceFbo!: WebGLFramebuffer | null;\n private _targetFbo!: WebGLFramebuffer | null;\n private _isDestroyed = false;\n extension: RendererExtensions = {};\n\n constructor (gl: WebGLRenderingContext | WebGL2RenderingContext) {\n this.gl = gl;\n this.state = new WebGLState(gl);\n this.level = typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext ? 2 : 1;\n this._buffers = [];\n this._textures = [];\n this._vaos = [];\n this._renderBuffers = [];\n this._frameBuffers = [];\n this.shaderLibrary = new GLShaderLibrary(this);\n this.gpu = new GLGPUCapability({ gl });\n const d = { width: 1, height: 1, data: new Uint8Array([255]) };\n\n this.emptyTexture2D = new GLTexture({\n data: d,\n sourceType: TextureSourceType.data,\n format: gl.LUMINANCE,\n internalFormat: gl.LUMINANCE,\n type: gl.UNSIGNED_BYTE,\n }, this);\n this.emptyTextureCube = new GLTexture({\n target: gl.TEXTURE_CUBE_MAP,\n cube: [d, d, d, d, d, d],\n sourceType: TextureSourceType.data,\n format: gl.LUMINANCE,\n internalFormat: gl.LUMINANCE,\n type: gl.UNSIGNED_BYTE,\n }, this);\n this.bindVertexArray = this.level === 2 ? this._bindVertexArray : this._bindVertexArrayOES;\n if (gl.canvas) {\n gl.canvas.addEventListener(GL_LOST_EVENT, this.onContextLose);\n }\n }\n\n requestAnimationFrame (cb: FrameRequestCallback): number {\n return window.requestAnimationFrame(cb);\n }\n cancelAnimationFrame (id: number): void {\n return window.cancelAnimationFrame(id);\n }\n\n get isDestroyed () {\n return this._isDestroyed;\n }\n\n onContextLose = (e: Event) => {\n consoleError('gl lost, destroy renderer by default', e.target);\n this.destroy();\n if (e.target) {\n e.target.removeEventListener(GL_LOST_EVENT, this.onContextLose);\n }\n };\n\n copy2 (source: GLTexture, target: GLTexture) {\n const gl = this.gl as WebGL2RenderingContext;\n\n if (gl) {\n if (!this._sourceFbo) {\n this._sourceFbo = gl.createFramebuffer();\n }\n if (!this._targetFbo) {\n this._targetFbo = gl.createFramebuffer();\n }\n const state = this.state;\n const COLOR_ATTACHMENT0 = gl.COLOR_ATTACHMENT0;\n\n state.bindFramebuffer(gl.FRAMEBUFFER, this._sourceFbo);\n gl.framebufferTexture2D(gl.FRAMEBUFFER, COLOR_ATTACHMENT0, gl.TEXTURE_2D, source.glHandle as GLTexture, 0);\n state.bindFramebuffer(gl.FRAMEBUFFER, this._targetFbo);\n gl.framebufferTexture2D(gl.FRAMEBUFFER, COLOR_ATTACHMENT0, gl.TEXTURE_2D, target.glHandle as GLTexture, 0);\n state.bindFramebuffer(gl.READ_FRAMEBUFFER, this._sourceFbo);\n state.bindFramebuffer(gl.DRAW_FRAMEBUFFER, this._targetFbo);\n const filter = source.width === source.height && target.width == target.height ? gl.NEAREST : gl.LINEAR;\n\n gl.blitFramebuffer(0, 0, source.width, source.height, 0, 0, target.width, target.height, gl.COLOR_BUFFER_BIT, filter);\n state.bindFramebuffer(gl.FRAMEBUFFER, null);\n state.bindFramebuffer(gl.READ_FRAMEBUFFER, null);\n state.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null);\n }\n }\n\n resetColorAttachments (rp: GLFrameBuffer, colors: GLTexture[]) {\n rp.bind();\n rp.resetColorTextures(colors);\n }\n\n createGLRenderBuffer (renderbuffer: GLRenderBuffer): WebGLRenderbuffer | null {\n const rb = this.gl.createRenderbuffer();\n\n if (rb) {\n arrAdd(this._renderBuffers, renderbuffer);\n }\n\n return rb;\n }\n\n createPipeline (options?: RenderFrameOptions): RenderFrame {\n throw new Error('Method not implemented.');\n }\n\n createBuffer (options: GPUBufferOptions): GLGPUBuffer {\n return new GLGPUBuffer(options, this);\n }\n\n resize (width: number, height: number): void {\n const gl = this.gl;\n\n if (gl && gl.drawingBufferWidth !== width || gl.drawingBufferHeight !== height) {\n gl.canvas.width = width;\n gl.canvas.height = height;\n gl.viewport(0, 0, width, height);\n this._frameBuffers.forEach(frameBuffer => {\n const viewport = frameBuffer.viewport;\n\n if (!frameBuffer.isCustomViewport) {\n frameBuffer.resize(viewport[0], viewport[1], width * frameBuffer.viewportScale, height * frameBuffer.viewportScale);\n }\n });\n }\n }\n\n _assignInspectorName (obj: any, name?: string, id?: string) {\n if (name) {\n obj.__SPECTOR_Metadata = { name };\n if (obj.__SPECTOR_Object_TAG) {\n obj.__SPECTOR_Object_TAG.displayText = name;\n if (id) {\n obj.__SPECTOR_Object_TAG.id = id;\n }\n } else {\n obj.__SPECTOR_Object_TAG = {\n displayText: name,\n id: '',\n };\n }\n }\n }\n\n createGLFrameBuffer (frameBuffer: GLFrameBuffer, name?: string): WebGLFramebuffer | null {\n const fbo = this.gl.createFramebuffer();\n\n if (fbo) {\n arrAdd(this._frameBuffers, frameBuffer);\n this._assignInspectorName(fbo, name, name);\n }\n\n return fbo;\n }\n\n createGLTexture (texture: GLTexture, name?: string): WebGLTexture | null {\n const tex = this.gl.createTexture();\n\n if (tex) {\n arrAdd(this._textures, texture);\n this._assignInspectorName(tex, name);\n }\n\n return tex;\n }\n\n createGLBuffer (gpuBuffer: GLGPUBuffer, name?: string): WebGLBuffer | null {\n const buffer = this.gl.createBuffer();\n\n if (buffer) {\n arrAdd(this._buffers, gpuBuffer);\n this._assignInspectorName(buffer, name);\n }\n\n return buffer;\n }\n\n deleteGLTexture (texture: GLTexture) {\n if (texture.glHandle && !this._isDestroyed) {\n this.gl.deleteTexture(texture.glHandle);\n arrRemove(this._textures, texture);\n //@ts-expect-error safe to assign\n delete texture.glHandle;\n }\n }\n\n deleteGPUBuffer (buffer: GLGPUBuffer | null) {\n if (buffer && !this._isDestroyed) {\n arrRemove(this._buffers, buffer);\n const handle = buffer.glBuffer;\n\n this.gl.deleteBuffer(handle);\n if (handle) {\n //@ts-expect-error safe to assign\n handle._isDestroyed = true;\n }\n //@ts-expect-error safe to assign\n delete buffer.glBuffer;\n }\n }\n\n deleteGLFrameBuffer (frameBuffer: GLFrameBuffer) {\n if (frameBuffer && !this._isDestroyed) {\n const gl = this.gl;\n\n gl.deleteFramebuffer(frameBuffer.fbo!);\n gl.deleteFramebuffer(frameBuffer.multisampleFbo!);\n frameBuffer.multisampleRbs.forEach(rb=>rb.destroy());\n arrRemove(this._frameBuffers, frameBuffer);\n delete frameBuffer.fbo;\n }\n }\n\n deleteGLRenderBuffer (renderbuffer: GLRenderBuffer) {\n if (renderbuffer && !this._isDestroyed) {\n this.gl.deleteRenderbuffer(renderbuffer.glHandle);\n arrRemove(this._renderBuffers, renderbuffer);\n //@ts-expect-error safe to assign\n delete renderbuffer.glHandle;\n }\n }\n\n createVertexArray (name?: string): WebGLVertexArrayObject | undefined {\n let vao;\n\n if (this.level === 2) {\n vao = (this.gl as WebGL2RenderingContext).createVertexArray() as WebGLVertexArrayObject;\n }\n if (!vao) {\n vao = this.gpu.vaoExt?.createVertexArrayOES();\n }\n if (vao) {\n arrAdd(this._vaos, vao);\n this._assignInspectorName(vao, name);\n }\n\n return vao;\n }\n\n _bindVertexArray (vao: WebGLVertexArrayObject | null) {\n (this.gl as WebGL2RenderingContext).bindVertexArray(vao || null);\n }\n\n _bindVertexArrayOES (vao: WebGLVertexArrayObject | null) {\n this.gpu.vaoExt?.bindVertexArrayOES(vao as WebGLVertexArrayObjectOES);\n }\n\n bindVertexArray (vao: WebGLVertexArrayObject | null) {\n throw Error('xxx');\n }\n\n deleteVertexArray (vao: WebGLVertexArrayObject) {\n if (!this._isDestroyed) {\n if (this.level === 2) {\n (this.gl as WebGL2RenderingContext).deleteVertexArray(vao);\n } else {\n this.gpu.vaoExt?.deleteVertexArrayOES(vao as WebGLVertexArrayObjectOES);\n }\n arrRemove(this._vaos, vao);\n }\n }\n\n destroy (haltGL?: boolean) {\n const gl = this.gl;\n\n if (gl) {\n gl.deleteFramebuffer(this._sourceFbo);\n gl.deleteFramebuffer(this._targetFbo);\n this._buffers.forEach(buffer => this.deleteGPUBuffer(buffer));\n this._buffers.length = 0;\n this.state.destroy();\n this.shaderLibrary.destroy();\n this._vaos.forEach(vao => this.deleteVertexArray(vao));\n this.emptyTexture2D.destroy();\n this.emptyTextureCube.destroy();\n this._vaos.length = 0;\n this._frameBuffers.forEach(fb => this.deleteGLFrameBuffer(fb));\n this._frameBuffers.length = 0;\n this._renderBuffers.forEach(rb => this.deleteGLRenderBuffer(rb));\n this._renderBuffers.length = 0;\n this._textures.forEach(tex=>this.deleteGLTexture(tex));\n this._textures.length = 0;\n gl.canvas.removeEventListener(GL_LOST_EVENT, this.onContextLose);\n if (haltGL) {\n const ex = gl.getExtension('WEBGL_lose_context');\n\n ex?.loseContext();\n }\n // @ts-expect-error safe to assign\n this.emptyTexture2D = this.shaderLibrary = this.state = this.gpu = this.gl = null;\n // @ts-expect-error safe to assign\n this.emptyTextureCube = null;\n }\n this._isDestroyed = true;\n }\n\n get height () {\n return this.gl?.drawingBufferHeight;\n }\n\n get width () {\n return this.gl?.drawingBufferWidth;\n }\n\n get canvas () {\n return this.gl.canvas;\n }\n\n createRenderFrame (options?: RenderFrameOptions): RenderFrame {\n throw Error();\n }\n}\n","import type { GPUCapability } from '../../types/GPUCapability';\nimport { GLGPUCapability } from '../webgl/GLGPUCapability';\n\nlet g: GLGPUCapability;\n\nexport function getDefaultGPUCapability (): GPUCapability {\n if (!g) {\n g = new GLGPUCapability({});\n }\n\n return g;\n}\n","export interface Canvas {\n width: number,\n height: number,\n addEventListener(name: string, handler: Function): void,\n\n removeEventListener(name: string, handler: Function): void,\n\n}\n\nexport class CanvasEmpty implements Canvas {\n width = 0;\n height = 0;\n style = {};\n addEventListener (name: string, handler: Function) {\n }\n\n removeEventListener (name: string, handler: Function) {\n }\n}\n","import type { ResourceInternal, ResourcePlatform } from './ResourceInternal';\nimport type { GPUBufferInternal, GPUBufferInternalOptions } from './GPUBufferInternal';\nimport type { GeometryInternal, GeometryInternalOptions } from './GeometryInternal';\nimport type { ShaderLibraryInternal } from './ShaderLibraryInternal';\nimport type { DataBlockInternal, DataBlockInternalOptions } from './DataBlockInternal';\nimport type { MaterialInternal, MaterialInternalOptions } from './MaterialInternal';\nimport type { MeshInternal, MeshInternalOptions } from './MeshInternal';\nimport type { RenderPassInternal, RenderPassOptionsInternal } from './RenderPassInternal';\nimport type { RenderFrameInternal, RenderFrameInternalOptions } from './RenderFrameInternal';\nimport type { GPUCapability } from '../GPUCapability';\nimport type { TextureInternal, TextureInternalConstructOptions } from './TextureInternal';\nimport type { AndGLContext } from './AndGLContext';\nimport type { MetalInternal } from './MetalInternal';\n\n/**\n * renderer 内部创建的对象,用来统计信息,排查资源泄漏的问题\n */\nexport interface InternalResInfo {\n buffer: number,\n geometry: number,\n material: number,\n texture: number,\n dataBlock: number,\n mesh: number,\n renderPass: number,\n frame: number,\n}\n\nexport interface RendererInternalCompleteInfo {\n //gpu耗时,单位ms\n gpuTime?: number,\n //渲染了多少个frame\n frame: number,\n //cpu耗时\n cpuTime?: number,\n}\n\nexport enum RendererLostReason {\n unknown = 0,\n removeByParent = 1,\n glContextLost = 2,\n}\n\nexport abstract class RendererInternal implements ResourceInternal {\n readonly isDestroyed: boolean;\n readonly platform: ResourcePlatform;\n readonly gpu: GPUCapability;\n readonly shaderLibrary: ShaderLibraryInternal;\n readonly width: number;\n readonly height: number;\n /**\n * 用于Android的GL上下文, 用于测试, 不会在RI中使用\n */\n readonly gl?: AndGLContext;\n\n //todo lilong\n /**\n * metal相关设置\n */\n readonly metal?: MetalInternal;\n\n abstract destroy (): void;\n\n /**\n * 需要进行重新渲染\n */\n abstract invalid (): void;\n\n abstract createBuffer (options: GPUBufferInternalOptions): GPUBufferInternal;\n\n abstract createGeometry (options: GeometryInternalOptions): GeometryInternal;\n\n abstract createDataBlock (options: DataBlockInternalOptions): DataBlockInternal;\n\n abstract createMaterial (options: MaterialInternalOptions): MaterialInternal;\n\n abstract createMesh (options: MeshInternalOptions): MeshInternal;\n\n abstract createRenderPass (options: RenderPassOptionsInternal): RenderPassInternal;\n\n abstract createRenderFrame (options: RenderFrameInternalOptions): RenderFrameInternal;\n\n abstract createTexture (options: TextureInternalConstructOptions): TextureInternal;\n\n abstract getResourceInfo (): InternalResInfo;\n\n abstract requestAnimationFrame (callback: FrameRequestCallback): number;\n\n abstract cancelAnimationFrame (id: number): void;\n\n /**\n * 当view被从客户端移除时,会触发此回调\n * 如果丢失GL Context也会触发此函数\n * 当此函数发生时,需要立刻销毁Renderer对象\n * 如果renderer已经被销毁了,这个回调不会被调用\n * @param callback\n */\n abstract setRendererLostCallback (callback: (reason: RendererLostReason) => void): void;\n\n /**\n * 下一帧渲染完成后的回调,在调用removeRenderCompleteCallback前,不需要重复注册\n */\n abstract addRenderCompleteCallback (callback: (info: RendererInternalCompleteInfo) => void): number;\n\n abstract removeRenderCompleteCallback (id: number): void;\n /**\n * 获取错误信息,目前支持最大获取5条,\n * 每次调用此函数后,清空错误队列\n */\n abstract getErrors (): string[];\n\n abstract resize (width: number, height: number): void;\n}\n\n","/**\n * 客户端创建对象,iOS和android\n */\nexport enum ResourcePlatform {\n iOS = 1,\n android = 2\n}\n\nexport interface ResourceInternal {\n readonly isDestroyed: boolean,\n destroy(): void,\n}\n","import type { ImageBitmapCallback, ImageBitmapConstructor } from './ImageBitmapInternal';\nimport type { TypedArray } from '../type';\nimport type { GPUCapability } from '../GPUCapability';\nimport type { PredyResizeTemplate, SDFImageOptions, SDFImage } from '@predy-js/specification';\nimport type { ImageBitmapInternal } from './ImageBitmapInternal';\nexport interface PredyRequestOptions {\n url: string,\n //用于测试缓存,生产中不要使用\n disableCache?: boolean,\n //默认5S\n timeout?: number,\n\n responseType?: 'text' | 'arraybuffer',\n\n //使用系统网络库(仅用于试验)\n useSystemNetwork?: boolean,\n}\nexport enum PredyResourceCacheStatus {\n noCache = 0, // 没有缓存,走网络请求\n cached = 1, // 命中缓存,如果请求同一个url,在关闭APP之前,一定会命中缓存,关闭APP后,清理时间由系统决定\n preloaded = 2, // 命中预推\n}\n\nexport interface PredyRequestResponse {\n data: ArrayBuffer | string,\n cacheStatus: PredyResourceCacheStatus,\n time: number,\n}\n\nexport type PredyRequestCallback = (err: string | undefined, res: PredyRequestResponse) => void;\n\nexport interface PredyNativeInternal {\n webpDisabled?: boolean,\n\n createImageBitmap (data: TypedArray | string, //图片文件的数据\n options: ImageBitmapConstructor, callback: ImageBitmapCallback): void,\n\n getDefaultGPUCapability (): GPUCapability,\n\n requestWithCache (options: PredyRequestOptions, callback: PredyRequestCallback): void,\n\n /**\n * decode utf8 text from data\n * @param data\n */\n decodeText(data: Uint8Array): string,\n /**\n * 将图片绘制到画布上,同时替换文案,绘制的顺序如下\n * 创建template.size尺寸的画布, 接下来的绘制均应用 template.offset\n * 将images绘制到画布上,images的尺寸由image.frame决定\n * 将数据模板content绘制到画布上,使用variables替换文案\n * @param template\n */\n renderImageTemplate (template: PredyResizeTemplate): ImageBitmapInternal,\n\n /**\n * 异步绘制图片的模板\n * @param options\n * @param callback 如果传入callback就是异步绘制,否则会直接返回结果\n */\n generateSDFImage (options: SDFImageOptions, callback?: renderSDFImageCallback): SDFImage | undefined,\n\n /**\n * 下载并且执行脚本文件,此方法会缓存https的脚本内容\n * 对于http的请求(开发环境),每次都重新请求\n * @param url\n * @param callback\n */\n evaluateScriptURL (url: string, callback: (err: Error, result: any) => void): void,\n}\n\ntype renderSDFImageCallback = (img: SDFImage) => void;\n","import type {\n RenderPassStorageObject,\n RenderPassAttachmentStorageType,\n} from '../../types/RenderPass';\nimport type { GLGPURenderer } from './GLGPURenderer';\nimport { consoleError } from '../common/console';\n\ninterface GLRenderBufferOptions {\n storageType: RenderPassAttachmentStorageType,\n format: GLenum,\n attachment: GLenum,\n multisample?: number,\n}\n\nexport class GLRenderBuffer implements RenderPassStorageObject {\n readonly renderer: GLGPURenderer;\n readonly storageType: RenderPassAttachmentStorageType;\n readonly internalFormat: GLenum;\n readonly glHandle: WebGLRenderbuffer;\n readonly size: [x: number, y: number];\n readonly ready!: boolean;\n readonly format: GLenum;\n readonly attachment: GLenum;\n readonly multiSample: number;\n\n constructor (renderer: GLGPURenderer, options: GLRenderBufferOptions) {\n this.storageType = options.storageType;\n this.renderer = renderer;\n this.glHandle = renderer.createGLRenderBuffer(this) as WebGLRenderbuffer;\n this.internalFormat = this.format = options.format;\n this.attachment = options.attachment;\n this.size = [0, 0];\n this.multiSample = options.multisample ?? 0;\n }\n\n setSize (width: number, height: number): GLRenderBuffer {\n if (width !== this.size[0] || height !== this.size[1]) {\n const internalFormat = this.internalFormat;\n const state = this.renderer.state;\n const gl = this.renderer.gl;\n\n state.bindRenderBuffer(gl.RENDERBUFFER, this.glHandle);\n if (width && height) {\n gl.renderbufferStorage(gl.RENDERBUFFER, internalFormat, this.size[0] = width, this.size[1] = height);\n if (this.multiSample > 1) {\n const if2 = internalFormat === gl.DEPTH_STENCIL ? (gl as WebGL2RenderingContext).DEPTH24_STENCIL8 : internalFormat;\n\n (gl as WebGL2RenderingContext).renderbufferStorageMultisample(gl.RENDERBUFFER, this.multiSample, if2, width, height);\n }\n } else {\n consoleError(`invalid render buffer size ${width}x${height}`);\n }\n }\n\n return this;\n }\n\n destroy () {\n if (this.renderer) {\n this.renderer.deleteGLRenderBuffer(this);\n //@ts-expect-error safe to assign\n this.renderer = this.glHandle = this.ready = null;\n }\n }\n}\n","import type { GLGPURenderer } from './GLGPURenderer';\nimport type {\n RenderPassDepthStencilAttachmentOptions,\n RenderPassStorageObject,\n RenderPassStoreAction,\n} from '../../types/RenderPass';\nimport {\n RenderPassAttachmentStorageType,\n RenderPassDestroyAttachmentType,\n TextureStoreAction,\n} from '../../types/RenderPass';\nimport { GLRenderBuffer } from './GLRenderBuffer';\nimport { constants } from './constants';\nimport { GLTexture } from './GLTexture';\nimport { TextureSourceType } from '../../types/Texture';\nimport { arrAdd, forEach } from '../common/utils';\nimport type { MarsTexture } from '../render/MarsTexture';\n\nexport interface GLFrameBufferOptions {\n attachments: GLTexture[],\n depthStencilAttachment?: RenderPassDepthStencilAttachmentOptions,\n isCustomViewport?: boolean,\n viewport: [x: number, y: number, width: number, height: number],\n viewportScale?: number,\n storeAction: RenderPassStoreAction,\n name?: string,\n multisample?: number,\n}\n\nlet seed = 1;\n\nexport class GLFrameBuffer {\n\n readonly renderer: GLGPURenderer;\n\n readonly viewport: [x: number, y: number, width: number, height: number];\n\n readonly ready!: boolean;\n\n readonly depthStencilStorageType: RenderPassAttachmentStorageType;\n\n readonly name: string;\n\n externalStorage!: boolean;\n\n storeAction: RenderPassStoreAction;\n\n storeInvalidAttachments?: GLenum[];\n\n isCustomViewport: boolean;\n\n depthStencilRenderBuffer?: GLRenderBuffer;\n\n depthTexture?: GLTexture;\n\n stencilTexture?: GLTexture;\n\n colorTextures!: GLTexture[];\n\n fbo?: WebGLFramebuffer;\n\n multisampleFbo?: WebGLFramebuffer;\n\n multisampleRbs: GLRenderBuffer[] = [];\n\n viewportScale: number;\n\n readonly multisample: number;\n\n readonly _attachmentHandles: WebGLTexture[];\n\n constructor (options: GLFrameBufferOptions, renderer: GLGPURenderer) {\n this.renderer = renderer;\n this.depthStencilStorageType = options.depthStencilAttachment?.storageType || RenderPassAttachmentStorageType.none;\n this.viewport = options.viewport;\n this.isCustomViewport = !!options.isCustomViewport;\n this.viewportScale = options.viewportScale || 1;\n this.name = options.name || ('GLFrameBuffer' + seed++);\n this.storeAction = options.storeAction;\n this._attachmentHandles = [];\n this.multisample = renderer.level > 1 ? options.multisample || 0 : 0;\n this.checkOptions(options);\n }\n\n get stencilStorage (): RenderPassStorageObject | undefined {\n const storageType = this.depthStencilStorageType;\n\n if (storageType !== RenderPassAttachmentStorageType.depth_16_opaque) {\n return this.depthStencilRenderBuffer;\n }\n }\n\n get depthStorage (): RenderPassStorageObject | undefined {\n if (this.depthStencilStorageType !== RenderPassAttachmentStorageType.stencil_8_opaque) {\n return this.depthStencilRenderBuffer;\n }\n }\n\n _getHandles () {\n const handles = this._attachmentHandles;\n\n handles.length = 0;\n this.colorTextures.forEach(c => arrAdd(handles, c.glHandle));\n if (this.stencilTexture) {\n arrAdd(handles, this.stencilTexture.glHandle);\n }\n if (this.depthTexture) {\n arrAdd(handles, this.depthTexture.glHandle);\n }\n }\n\n checkOptions (options: GLFrameBufferOptions) {\n const renderer = this.renderer;\n const capability = renderer.gpu.capability;\n const depthStencilAttachment = options.depthStencilAttachment || { storageType: RenderPassAttachmentStorageType.none };\n const willUseFbo = options.attachments.length > 0;\n const willMultisample = this.multisample > 1 ;\n\n this.externalStorage = false;\n let separateDepthStencil = true;\n\n if (options.attachments.length > 1 && !capability.drawBuffers) {\n throw Error('multiple color attachments not support');\n }\n const optDepthStencilTex: GLTexture | undefined = (options.depthStencilAttachment?.texture as MarsTexture)?.internal;\n\n const readableDepthStencilTextures = capability.readableDepthStencilTextures;\n\n this.colorTextures = options.attachments.slice();\n if (!willUseFbo && depthStencilAttachment.storageType !== RenderPassAttachmentStorageType.none) {\n throw Error('use depth stencil attachment without color attachments');\n }\n if (willUseFbo) {\n this.fbo = renderer.createGLFrameBuffer(this, this.name)!;\n }\n if (willMultisample) {\n this.multisampleFbo = renderer.createGLFrameBuffer(this, this.name + '_multisample')!;\n }\n const storageType = depthStencilAttachment.storageType;\n\n if (storageType === RenderPassAttachmentStorageType.depth_stencil_opaque) {\n if (depthStencilAttachment.storage) {\n if (depthStencilAttachment.storage instanceof GLRenderBuffer) {\n if (this.multisample !== depthStencilAttachment.storage.multiSample && this.multisample > 1) {\n throw Error('fbo multisample not eql depth stencil attachment');\n }\n this.depthStencilRenderBuffer = depthStencilAttachment.storage;\n this.externalStorage = true;\n } else {\n throw Error('invalid depth stencil attachment storage');\n }\n } else {\n this.depthStencilRenderBuffer = new GLRenderBuffer(renderer, {\n format: constants.DEPTH_STENCIL,\n attachment: constants.DEPTH_STENCIL_ATTACHMENT,\n multisample:this.multisample,\n storageType,\n });\n }\n separateDepthStencil = false;\n } else if (storageType === RenderPassAttachmentStorageType.depth_16_opaque) {\n if (depthStencilAttachment.storage) {\n if (this.multisample !== depthStencilAttachment.storage.multiSample && this.multisample > 1) {\n throw Error('fbo multisample not eql depth attachment');\n }\n if (depthStencilAttachment.storage instanceof GLRenderBuffer) {\n this.depthStencilRenderBuffer = depthStencilAttachment.storage;\n this.externalStorage = true;\n } else {\n throw Error('invalid depth attachment storage');\n }\n } else {\n this.depthStencilRenderBuffer = new GLRenderBuffer(renderer, {\n attachment: constants.DEPTH_ATTACHMENT,\n multisample:this.multisample,\n format: constants.DEPTH_COMPONENT16,\n storageType,\n });\n }\n } else if (storageType === RenderPassAttachmentStorageType.stencil_8_opaque) {\n if (depthStencilAttachment.storage) {\n if (depthStencilAttachment.storage instanceof GLRenderBuffer) {\n if (this.multisample !== depthStencilAttachment.storage.multiSample && this.multisample > 1) {\n throw Error('fbo multisample not eql stencil attachment');\n }\n this.depthStencilRenderBuffer = depthStencilAttachment.storage;\n this.externalStorage = true;\n } else {\n throw Error('invalid stencil attachment storage');\n }\n } else {\n this.depthStencilRenderBuffer = new GLRenderBuffer(renderer, {\n attachment: constants.STENCIL_ATTACHMENT,\n format: constants.STENCIL_INDEX8,\n multisample: this.multisample,\n storageType,\n });\n }\n } else if (storageType === RenderPassAttachmentStorageType.depth_16_texture) {\n if (!readableDepthStencilTextures) {\n throw Error('depth texture is not support in framebuffer');\n }\n this.depthTexture = optDepthStencilTex || new GLTexture({\n sourceType: TextureSourceType.framebuffer,\n format: constants.DEPTH_COMPONENT,\n internalFormat: renderer.gpu.internalFormatDepth16,\n type: constants.UNSIGNED_SHORT,\n name: `${this.name}##depthTex`,\n }, renderer);\n } else if (storageType === RenderPassAttachmentStorageType.depth_24_stencil_8_texture) {\n if (!readableDepthStencilTextures) {\n throw Error('depth stencil texture is not support in framebuffer');\n }\n this.depthTexture = this.stencilTexture = optDepthStencilTex || new GLTexture({\n sourceType: TextureSourceType.framebuffer,\n format: constants.DEPTH_STENCIL,\n internalFormat: renderer.gpu.internalFormatDepth24_stencil8,\n type: renderer.gpu.UNSIGNED_INT_24_8,\n name: `${this.name}##dpthStclTex`,\n }, renderer);\n separateDepthStencil = true;\n }\n this.storeInvalidAttachments = this.getStoreAttachments(this.storeAction, separateDepthStencil);\n this._getHandles();\n }\n\n getStoreAttachments (storeAction: RenderPassStoreAction, separateDepthStencil: boolean): GLenum[] | undefined {\n const gl = this.renderer.gl as WebGL2RenderingContext;\n const colorLen = this.colorTextures.length;\n\n if (storeAction && this.renderer.gpu.level == 2 && colorLen > 0) {\n const attachments: GLenum[] = [];\n\n if (storeAction.depthAction === TextureStoreAction.clear && this.depthStorage) {\n arrAdd(attachments, separateDepthStencil ? gl.DEPTH_ATTACHMENT : gl.DEPTH_STENCIL_ATTACHMENT);\n }\n if (storeAction.stencilAction === TextureStoreAction.clear && this.stencilStorage) {\n arrAdd(attachments, separateDepthStencil ? gl.STENCIL_ATTACHMENT : gl.DEPTH_STENCIL_ATTACHMENT);\n }\n if (storeAction.colorAction === TextureStoreAction.clear) {\n for (let i = 0; i < colorLen; i++) {\n arrAdd(attachments, (gl as unknown as Record<string, GLenum>)[`COLOR_ATTACHMENT${i}`]);\n }\n }\n\n return attachments;\n }\n }\n\n unbind () {\n const att = this.storeInvalidAttachments;\n\n this.resolveMultiSample();\n if (att && att.length) {\n const gl = this.renderer.gl as WebGL2RenderingContext;\n\n gl.invalidateFramebuffer(gl.FRAMEBUFFER, att);\n }\n const state = this.renderer.state;\n\n state.bindSystemFramebuffer();\n }\n\n bind () {\n const gl = this.renderer.gl;\n const state = this.renderer.state;\n const FRAMEBUFFER = gl.FRAMEBUFFER;\n const viewport = this.viewport;\n const multisampleFbo = this.multisampleFbo;\n\n if (multisampleFbo) {\n\n state.bindFramebuffer(FRAMEBUFFER, multisampleFbo);\n state.viewport(viewport[0], viewport[1], viewport[2], viewport[3]);\n } else if (this.fbo) {\n\n state.bindFramebuffer(FRAMEBUFFER, this.fbo);\n state.viewport(viewport[0], viewport[1], viewport[2], viewport[3]);\n const r = this.renderer.emptyTexture2D.glHandle;\n const handles = this._attachmentHandles;\n\n //in case frame texture loop\n forEach(state._textureUnitDict, function (t, unit) {\n if (t !== r && handles.includes(t as WebGLTexture)) {\n state.activeTexture(+unit);\n state.bindTexture(constants.TEXTURE_2D, r, true);\n }\n });\n }\n if (!this.ready) {\n const { depthStencilRenderBuffer, depthTexture, stencilTexture } = this;\n\n state.activeTexture(gl.TEXTURE0);\n if (depthStencilRenderBuffer) {\n depthStencilRenderBuffer.setSize(viewport[2], viewport[3]);\n gl.framebufferRenderbuffer(FRAMEBUFFER, depthStencilRenderBuffer.attachment, gl.RENDERBUFFER, depthStencilRenderBuffer.glHandle);\n } else if (depthTexture) {\n if (multisampleFbo) {\n let attachment = gl.DEPTH_ATTACHMENT;\n let format = gl.DEPTH_COMPONENT16;\n\n if (this.depthStencilStorageType === RenderPassAttachmentStorageType.depth_24_stencil_8_texture) {\n attachment = gl.DEPTH_STENCIL_ATTACHMENT;\n format = (gl as WebGL2RenderingContext).DEPTH24_STENCIL8;\n }\n const renderBuffer = new GLRenderBuffer(this.renderer, {\n storageType:this.depthStencilStorageType,\n attachment,\n format,\n multisample:this.multisample,\n });\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, multisampleFbo);\n this.multisampleRbs.push(renderBuffer);\n renderBuffer.setSize(viewport[2], viewport[3]);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, attachment, gl.RENDERBUFFER, renderBuffer.glHandle);\n gl.bindFramebuffer(gl.FRAMEBUFFER, this.fbo!);\n }\n depthTexture.update({\n sourceType: TextureSourceType.framebuffer,\n data: { width: viewport[2], height: viewport[3] },\n });\n const attachment = depthTexture && stencilTexture ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;\n\n gl.framebufferTexture2D(FRAMEBUFFER, attachment, gl.TEXTURE_2D, depthTexture.glHandle as WebGLTexture, 0);\n }\n this.resetColorTextures(this.colorTextures);\n [multisampleFbo, this.fbo].forEach(function (fbo) {\n if (fbo) {\n gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);\n const status = gl.checkFramebufferStatus(FRAMEBUFFER);\n\n if (status !== gl.FRAMEBUFFER_COMPLETE) {\n const error = gl.getError();\n\n throw Error(`framebuffer failed status ${status} error:${error}`);\n }\n }\n });\n\n //@ts-expect-error safe to assign\n this.ready = true;\n }\n }\n\n resolveMultiSample () {\n const multisampleFbo = this.multisampleFbo;\n const fbo = this.fbo;\n\n if (multisampleFbo && fbo) {\n const gl = this.renderer.gl as WebGL2RenderingContext;\n\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, multisampleFbo);\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, fbo);\n const vp = this.viewport;\n let bit = gl.COLOR_BUFFER_BIT;\n\n if (this.depthTexture) {\n bit = bit | gl.DEPTH_BUFFER_BIT;\n }\n gl.blitFramebuffer(\n 0, 0, vp[2], vp[3], // Source region\n 0, 0, vp[2], vp[3], // Destination region\n bit, gl.LINEAR // Buffer mask and filter\n );\n gl.bindFramebuffer(gl.FRAMEBUFFER, multisampleFbo);\n }\n }\n\n resetColorTextures (colors?: GLTexture[]) {\n const gl: WebGLRenderingContext = this.renderer.gl;\n const gpu = this.renderer.gpu;\n const viewport = this.viewport;\n const data = { width: viewport[2], height: viewport[3] };\n const buffers: boolean[] = [];\n\n if (colors) {\n this.colorTextures = colors.slice();\n }\n this.renderer.state.activeTexture(gl.TEXTURE0);\n const multisampleFBO = this.multisampleFbo;\n\n this.colorTextures.forEach((tex, index) => {\n tex.update({ sourceType: TextureSourceType.framebuffer, data });\n if (multisampleFBO) {\n gl.bindFramebuffer(gl.FRAMEBUFFER, multisampleFBO);\n\n const renderBuffer = new GLRenderBuffer(this.renderer, {\n format:(gl as WebGL2RenderingContext).RGBA8,\n attachment: gl.COLOR_ATTACHMENT0 + index,\n storageType: RenderPassAttachmentStorageType.color,\n multisample:this.multisample,\n });\n\n this.multisampleRbs.push(renderBuffer);\n renderBuffer.setSize(tex.width, tex.height);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + index, gl.RENDERBUFFER, renderBuffer.glHandle);\n }\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, this.fbo!);\n gpu.framebufferTexture2D(gl, gl.FRAMEBUFFER, index, gl.TEXTURE_2D, tex.glHandle as WebGLTexture);\n buffers.push(true);\n });\n gpu.drawBuffers(gl, buffers);\n this._getHandles();\n }\n\n destroy (opt?: { depthStencilAttachment?: RenderPassDestroyAttachmentType }) {\n const renderer = this.renderer;\n\n if (renderer) {\n renderer.deleteGLFrameBuffer(this);\n delete this.fbo;\n const clearAttachment = opt?.depthStencilAttachment ? opt.depthStencilAttachment : RenderPassDestroyAttachmentType.force;\n\n if (clearAttachment === RenderPassDestroyAttachmentType.force || (clearAttachment === RenderPassDestroyAttachmentType.keepExternal && !this.externalStorage)) {\n this.depthStencilRenderBuffer?.destroy();\n this.depthTexture?.destroy();\n }\n //@ts-expect-error safe to assign\n this.renderer = this.depthStencilRenderBuffer = null;\n }\n }\n\n resize (x: number, y: number, width: number, height: number) {\n const vp = this.viewport;\n\n if (vp[0] !== x || vp[1] !== y || vp[2] !== width || vp[3] !== height) {\n //@ts-expect-error safe to assign\n this.viewport = [x, y, width, height];\n //@ts-expect-error safe to assign\n this.ready = false;\n this.bind();\n }\n }\n}\n","export interface RequestOptions {\n method?: 'get' | 'post',\n responseType?: 'json' | 'blob' | 'arraybuffer',\n data?: XMLHttpRequestBodyInit | null,\n}\n\n// const imageBitMapAvailable = typeof ImageBitmap === 'function' && typeof createImageBitmap == 'function';\nconst imageBitMapAvailable = false;//never use imagebitmap because its dark edge\n\nexport function requestAsync (url: string, options?: RequestOptions): Promise<any> {\n const opt: RequestOptions = options || {};\n\n return new Promise(function (resolve, reject) {\n const xhr = new XMLHttpRequest();\n\n xhr.responseType = opt.responseType || 'json';\n xhr.addEventListener('load', () => resolve(xhr.response));\n xhr.addEventListener('error', reject);\n xhr.open(opt.method || 'get', url);\n xhr.send(opt.data);\n });\n}\n\nexport function loadImageAsync (imgOrURL: string | HTMLImageElement | Blob, options?: { asImageBitMap?: boolean, revokeURL?: boolean }): Promise<HTMLImageElement | ImageBitmap> {\n let img: HTMLImageElement;\n let revoke = options?.revokeURL;\n\n if (typeof imgOrURL === 'string') {\n if (options?.asImageBitMap && imageBitMapAvailable) {\n return requestAsync(imgOrURL, { responseType: 'blob' }).then(blob => createImageBitmap(blob));\n }\n const src = imgOrURL;\n\n img = new Image();\n if (!/^data:/.test(src)) {\n img.crossOrigin = '*';\n }\n img.src = src;\n } else {\n img = imgOrURL as HTMLImageElement;\n if (options?.asImageBitMap && imageBitMapAvailable) {\n return createImageBitmap(img);\n }\n if (imgOrURL instanceof Blob) {\n img = new Image();\n img.src = URL.createObjectURL(imgOrURL);\n revoke = true;\n }\n }\n if (img.complete) {\n return Promise.resolve(img);\n }\n\n return new Promise(function (resolve, reject) {\n img.onload = () => {\n img.onload = null;\n if (revoke) {\n URL.revokeObjectURL(img.src);\n }\n\n return resolve(img);\n };\n img.onerror = err => {\n img.onerror = null;\n if (revoke) {\n URL.revokeObjectURL(img.src);\n }\n\n return reject(err);\n };\n });\n}\n","import type { TextureOptions, TypedArray } from '../../types';\nimport { TextureSourceType } from '../../types/Texture';\nimport { constants } from './constants';\nimport { consoleWarn } from '../common/console';\n\nconst HEADER_LEN = 12 + 13 * 4; // identifier + header elements (not including key value meta-data pairs)\nconst COMPRESSED_2D = 0; // uses a gl.compressedTexImage2D()\n//const COMPRESSED_3D = 1; // uses a gl.compressedTexImage3D()\nconst TEX_2D = 2; // uses a gl.texImage2D()\n\n//const TEX_3D = 3; // uses a gl.texImage3D()\nexport class KhronosTextureContainer {\n arrayBuffer: ArrayBuffer;\n baseOffset: number;\n glType: number;\n glTypeSize: number;\n glFormat: number;\n glInternalFormat: number;\n glBaseInternalFormat: number;\n pixelWidth: number;\n pixelHeight: number;\n loadType!: number;\n pixelDepth: number;\n numberOfArrayElements: number;\n numberOfFaces: number;\n numberOfMipmapLevels: number;\n bytesOfKeyValueData: number;\n\n constructor (arrayBuffer: ArrayBuffer, facesExpected: number, baseOffset = 0) {\n this.arrayBuffer = arrayBuffer;\n this.baseOffset = baseOffset;\n\n // Test that it is a ktx formatted file, based on the first 12 bytes, character representation is:\n // '´', 'K', 'T', 'X', ' ', '1', '1', 'ª', '\\r', '\\n', '\\x1A', '\\n'\n // 0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A\n const identifier = new Uint8Array(this.arrayBuffer, this.baseOffset, 12);\n\n if (\n identifier[0] !== 0xab ||\n identifier[1] !== 0x4b ||\n identifier[2] !== 0x54 ||\n identifier[3] !== 0x58 ||\n identifier[4] !== 0x20 ||\n identifier[5] !== 0x31 ||\n identifier[6] !== 0x31 ||\n identifier[7] !== 0xbb ||\n identifier[8] !== 0x0d ||\n identifier[9] !== 0x0a ||\n identifier[10] !== 0x1a ||\n identifier[11] !== 0x0a\n ) {\n throw Error('texture missing KTX identifier');\n }\n\n // load the reset of the header in native-ri 32 bit uint\n const dataSize = Uint32Array.BYTES_PER_ELEMENT;\n const headerDataView = new DataView(this.arrayBuffer, this.baseOffset + 12, 13 * dataSize);\n const endianness = headerDataView.getUint32(0, true);\n const littleEndian = endianness === 0x04030201;\n\n this.glType = headerDataView.getUint32(1 * dataSize, littleEndian); // must be 0 for compressed textures\n this.glTypeSize = headerDataView.getUint32(2 * dataSize, littleEndian); // must be 1 for compressed textures\n this.glFormat = headerDataView.getUint32(3 * dataSize, littleEndian); // must be 0 for compressed textures\n this.glInternalFormat = headerDataView.getUint32(4 * dataSize, littleEndian); // the value of arg passed to gl.compressedTexImage2D(,,x,,,,)\n this.glBaseInternalFormat = headerDataView.getUint32(5 * dataSize, littleEndian); // specify GL_RGB, GL_RGBA, GL_ALPHA, etc (un-compressed only)\n this.pixelWidth = headerDataView.getUint32(6 * dataSize, littleEndian); // level 0 value of arg passed to gl.compressedTexImage2D(,,,x,,,)\n this.pixelHeight = headerDataView.getUint32(7 * dataSize, littleEndian); // level 0 value of arg passed to gl.compressedTexImage2D(,,,,x,,)\n this.pixelDepth = headerDataView.getUint32(8 * dataSize, littleEndian); // level 0 value of arg passed to gl.compressedTexImage3D(,,,,,x,,)\n this.numberOfArrayElements = headerDataView.getUint32(9 * dataSize, littleEndian); // used for texture arrays\n this.numberOfFaces = headerDataView.getUint32(10 * dataSize, littleEndian); // used for cubemap textures, should either be 1 or 6\n this.numberOfMipmapLevels = headerDataView.getUint32(11 * dataSize, littleEndian); // number of levels; disregard possibility of 0 for compressed textures\n this.bytesOfKeyValueData = headerDataView.getUint32(12 * dataSize, littleEndian); // the amount of space after the header for meta-data\n\n // value of zero is an indication to generate mipmaps @ runtime. Not usually allowed for compressed, so disregard.\n this.numberOfMipmapLevels = Math.max(1, this.numberOfMipmapLevels);\n\n if (this.pixelHeight === 0 || this.pixelDepth !== 0) {\n consoleWarn('only 2D textures currently supported');\n\n return;\n }\n if (this.numberOfArrayElements !== 0) {\n consoleWarn('texture arrays not currently supported');\n\n return;\n }\n if (this.numberOfFaces !== facesExpected) {\n consoleWarn('number of faces expected' + facesExpected + ', but found ' + this.numberOfFaces);\n\n return;\n }\n // we now have a completely validated file, so could use existence of loadType as success\n // would need to make this more elaborate & adjust checks above to support more than one load type\n if (this.glType === 0) {\n this.loadType = COMPRESSED_2D;\n } else {\n this.loadType = TEX_2D;\n }\n }\n\n mipmaps (loadMipmaps: boolean): Array<{ data: TypedArray, width: number, height: number }> {\n const mipmaps: Array<{ data: TypedArray, width: number, height: number }> = [];\n\n // initialize width & height for level 1\n let dataOffset = HEADER_LEN + this.bytesOfKeyValueData;\n let width = this.pixelWidth;\n let height = this.pixelHeight;\n const mipmapCount = loadMipmaps ? this.numberOfMipmapLevels : 1;\n\n for (let level = 0; level < mipmapCount; level++) {\n const imageSize = new Int32Array(this.arrayBuffer, this.baseOffset + dataOffset, 1)[0]; // size per face, since not supporting array cubemaps\n\n for (let face = 0; face < this.numberOfFaces; face++) {\n const byteArray = new Uint8Array(this.arrayBuffer, this.baseOffset + dataOffset + 4, imageSize);\n\n mipmaps.push({\n data: byteArray,\n width,\n height,\n });\n\n dataOffset += imageSize + 4; // size of the image + 4 for the imageSize field\n dataOffset += 3 - ((imageSize + 3) % 4); // add padding for odd sized image\n }\n width = Math.max(1.0, width * 0.5);\n height = Math.max(1.0, height * 0.5);\n }\n\n return mipmaps;\n }\n}\n\nexport function getCompressedTextureOptions (data: ArrayBuffer): TextureOptions {\n const ktx = new KhronosTextureContainer(data, 1);\n const useMipmaps = ktx.numberOfMipmapLevels >= Math.floor(Math.log2(Math.max(ktx.pixelWidth, ktx.pixelHeight)) + 1);\n\n return {\n sourceType: TextureSourceType.compressed,\n type: ktx.glType,\n target: ktx.numberOfFaces === 6 ? constants.TEXTURE_CUBE_MAP : constants.TEXTURE_2D,\n internalFormat: ktx.glInternalFormat,\n format: ktx.glFormat,\n mipmaps: ktx.mipmaps(useMipmaps),\n };\n}\n","import type {\n Texture,\n Texture2DOptions,\n TextureConfigOptions,\n TextureCubeOptions,\n TextureCubeSourceURLMap,\n TextureFactory,\n TextureFactorySource2DBinaryMipmapsFrom,\n TextureFactorySource2DFrom,\n TextureFactorySource2DMipmapsFrom,\n TextureFactorySourceCubeBinaryMipmapsFrom,\n TextureFactorySourceCubeFrom,\n TextureFactorySourceCubeMipmapsFrom,\n TextureFactorySourceFrom,\n TextureOptions,\n TextureSourceCubeData,\n} from '../../types/Texture';\nimport {\n TextureSourceType,\n} from '../../types/Texture';\nimport { loadImageAsync, requestAsync } from '../common/request';\nimport { getCompressedTextureOptions } from '../webgl/KhronosTextureContainer';\nimport { isObj, isStr } from '../common/utils';\nimport { constants } from '../webgl/constants';\nimport { imageBitMapAvailable } from '../webgl/GLTexture';\nimport type { TypedArray, vec2 } from '../../types';\n\nconst loadOptions = { asImageBitMap: true };\n\nexport class MarsTextureFactory implements TextureFactory {\n reloadPending: { [key: string]: Promise<Texture> };\n\n constructor () {\n this.reloadPending = {};\n }\n\n loadMipmapImagesAsync (pointers: vec2[], bin: ArrayBuffer) {\n return Promise.all(pointers.map(function (pointer) {\n const blob = new Blob([new Uint8Array(bin, pointer[0], pointer[1])]);\n\n return loadImageAsync(blob, { asImageBitMap: true });\n }));\n }\n\n loadImageAsync (url: string | HTMLImageElement | Blob): Promise<HTMLImageElement | ImageBitmap> {\n return loadImageAsync(url, loadOptions);\n }\n\n requestBinaryAsync (url: string): Promise<ArrayBuffer> {\n return requestAsync(url, { responseType: 'arraybuffer' });\n }\n\n loadImageBinaryAsync (binary: ArrayBuffer | TypedArray | Blob, mime?: string): Promise<HTMLImageElement | ImageBitmap> {\n let blob = binary as Blob;\n\n if (!(binary instanceof Blob)) {\n blob = new Blob([binary], { type: mime || 'image/png' });\n }\n if (imageBitMapAvailable) {\n return createImageBitmap(blob);\n }\n const url = URL.createObjectURL(blob);\n\n return loadImageAsync(url, { revokeURL: true });\n }\n\n canOffloadTexture (texture: Texture): boolean {\n const data = texture.options.sourceFrom;\n\n if (data) {\n const type = data.type;\n\n if (type === TextureSourceType.compressed || type === TextureSourceType.image) {\n if ((data as TextureFactorySourceCubeFrom).target === constants.TEXTURE_CUBE_MAP) {\n return isObj((data as TextureFactorySourceCubeFrom).map);\n }\n\n return isStr((data as TextureFactorySource2DFrom).url, true);\n }\n if (type === TextureSourceType.mipmaps) {\n if ((data as TextureFactorySourceCubeBinaryMipmapsFrom).bin) {\n return (data as TextureFactorySourceCubeBinaryMipmapsFrom).mipmaps.length > 0;\n }\n if ((data as TextureFactorySourceCubeMipmapsFrom).target === constants.TEXTURE_CUBE_MAP) {\n return (data as TextureFactorySourceCubeMipmapsFrom).maps.every(map => isObj(map));\n }\n\n return (data as TextureFactorySource2DMipmapsFrom).urls.every(url => isStr(url, true));\n }\n }\n\n return false;\n }\n\n loadSourceAsync (sourceFrom: TextureFactorySourceFrom, config?: TextureConfigOptions): Promise<TextureOptions> {\n // cube without mipmap\n if ((sourceFrom as TextureFactorySourceCubeFrom).target === constants.TEXTURE_CUBE_MAP && sourceFrom.type !== TextureSourceType.mipmaps) {\n return this._loadCubeMapAsync((sourceFrom as TextureFactorySourceCubeFrom).map).then(function (cube) {\n return Object.assign({}, config, {\n sourceType: TextureSourceType.image,\n cube,\n sourceFrom: {\n type: TextureSourceType.image,\n map: Object.assign({}, (sourceFrom as TextureFactorySourceCubeFrom).map),\n target: constants.TEXTURE_CUBE_MAP,\n },\n target: constants.TEXTURE_CUBE_MAP,\n }) as TextureCubeOptions;\n }, catchError);\n } else if (sourceFrom.type === TextureSourceType.image) {\n // image without mipmap\n return this.loadImageAsync((sourceFrom as TextureFactorySource2DFrom).url).then(image => Object.assign({}, config, {\n image,\n sourceType: TextureSourceType.image,\n sourceFrom: {\n url: (sourceFrom as TextureFactorySource2DFrom).url,\n type: sourceFrom.type,\n target: constants.TEXTURE_2D,\n },\n }) as Texture2DOptions, catchError);\n } else if (sourceFrom.type === TextureSourceType.video) {\n return this._loadVideoAsync((sourceFrom).url).then(video => Object.assign({}, config, {\n video,\n sourceType: TextureSourceType.video,\n }) as Texture2DOptions, catchError);\n } else if (sourceFrom.type === TextureSourceType.compressed) {\n return this.requestBinaryAsync(sourceFrom.url).then(function (arrayBuffer: ArrayBuffer) {\n return Object.assign(getCompressedTextureOptions(arrayBuffer), config, {\n sourceFrom: { url: sourceFrom.url, type: TextureSourceType.compressed },\n });\n }, catchError);\n } else if (sourceFrom.type === TextureSourceType.mipmaps) {\n const target = sourceFrom.target;\n\n if ((sourceFrom as TextureFactorySourceCubeBinaryMipmapsFrom).bin) {\n return requestAsync((sourceFrom as TextureFactorySourceCubeBinaryMipmapsFrom).bin, { responseType: 'arraybuffer' })\n .then((data: ArrayBuffer): Promise<Array<ImageBitmap | HTMLImageElement> | Array<ImageBitmap | HTMLImageElement>[]> => {\n if (sourceFrom.target === constants.TEXTURE_CUBE_MAP) {\n const source = sourceFrom as TextureFactorySourceCubeBinaryMipmapsFrom;\n\n return Promise.all(source.mipmaps.map(mipmaps => this.loadMipmapImagesAsync(mipmaps, data)));\n } else {\n const source = sourceFrom as TextureFactorySource2DBinaryMipmapsFrom;\n\n return this.loadMipmapImagesAsync(source.mipmaps, data);\n }\n }).then(function (mipmaps) {\n const target = sourceFrom.target || constants.TEXTURE_2D;\n const mipmapsSource = (sourceFrom as TextureFactorySourceCubeBinaryMipmapsFrom).mipmaps;\n const source = {\n mipmaps,\n target,\n sourceType: TextureSourceType.mipmaps,\n sourceFrom: {\n bin: (sourceFrom as TextureFactorySourceCubeBinaryMipmapsFrom).bin,\n mipmaps: target === constants.TEXTURE_2D ? mipmapsSource.slice() : mipmapsSource.map(s => s.slice()),\n target,\n type: TextureSourceType.mipmaps,\n },\n } as TextureOptions;\n\n return Object.assign({}, config, source);\n });\n }\n if (target === constants.TEXTURE_2D || !target) {\n const urls = (sourceFrom as TextureFactorySource2DMipmapsFrom).urls;\n\n return Promise.all(urls.map(url => this.loadImageAsync(url))).then(mipmaps => {\n return Object.assign({}, config, {\n target: constants.TEXTURE_2D,\n sourceType: TextureSourceType.mipmaps,\n mipmaps,\n sourceFrom: {\n type: sourceFrom.type,\n urls: urls.slice(),\n target: constants.TEXTURE_2D,\n },\n }) as Texture2DOptions;\n }, catchError);\n } else if (target === constants.TEXTURE_CUBE_MAP) {\n const maps = (sourceFrom as TextureFactorySourceCubeMipmapsFrom).maps;\n\n return Promise.all(maps.map(map => this._loadCubeMapAsync(map))).then(mipmaps => {\n return Object.assign({}, config, {\n sourceType: TextureSourceType.mipmaps,\n target: constants.TEXTURE_CUBE_MAP,\n mipmaps,\n sourceFrom: {\n target: constants.TEXTURE_CUBE_MAP,\n type: sourceFrom.type,\n maps: (sourceFrom as TextureFactorySourceCubeMipmapsFrom).maps.map(map => Object.assign({}, map)),\n },\n }) as TextureCubeOptions;\n }, catchError);\n }\n }\n\n return Promise.reject(new Error('invalid resource type:' + sourceFrom.type));\n\n function catchError (error: Error): TextureOptions {\n throw Error('loadFail:' + JSON.stringify(config));\n }\n }\n\n _loadVideoAsync (url: string | null | MediaProvider): Promise<HTMLVideoElement> {\n if (IS_NODE) {\n return Promise.reject('video not support');\n }\n const video = document.createElement('video');\n\n video.setAttribute('renderer', 'standard');\n if (isObj(url)) {\n video.srcObject = url as MediaProvider;\n } else {\n video.src = url as string;\n }\n video.crossOrigin = 'anonymous';\n video.muted = true;\n video.setAttribute('playsinline', 'playsinline');\n const p = video.play();\n\n return p ? p.then(() => video) : new Promise(function (resolve, reject) {\n video.addEventListener('loadeddata', function h () {\n resolve(video);\n video.removeEventListener('loadeddata', h);\n }, true);\n video.addEventListener('error', function (e) {\n reject(e);\n });\n });\n }\n\n _loadCubeMapAsync (map: TextureCubeSourceURLMap | string[]): Promise<TextureSourceCubeData> {\n return Promise.all(map.map(key => this.loadImageAsync(key))) as Promise<TextureSourceCubeData>;\n }\n\n loadCompressedTextureFromArrayBuffer (arrayBuffer: ArrayBuffer, options?: TextureOptions): TextureOptions {\n return Object.assign(getCompressedTextureOptions(arrayBuffer), options);\n }\n\n reloadTextureAsync (texture: Texture): Promise<Texture> {\n const id = texture.id;\n const o = this.reloadPending[id];\n\n if (o) {\n return o;\n }\n if (texture.options.sourceFrom) {\n return this.reloadPending[id] = this.loadSourceAsync(texture.options.sourceFrom as TextureFactorySourceFrom).then(opt => {\n texture.updateSource(opt);\n delete this.reloadPending[id];\n\n return texture;\n }).catch(ex => {\n delete this.reloadPending[id];\n throw ex;\n });\n }\n\n return Promise.reject('no source from');\n }\n\n}\n\nlet g: TextureFactory;\n\nexport function getDefaultTextureFactory (): TextureFactory {\n if (!g) {\n g = new MarsTextureFactory();\n }\n\n return g;\n}\n\nexport function setDefaultTextureFactory (factory: TextureFactory) {\n g = factory;\n}\n","import type {\n Texture,\n Texture2DSourceOptionsData,\n Texture2DSourceOptionsImage,\n Texture2DSourceOptionsNone,\n Texture2DSourceOptionsVideo,\n TextureCubeSourceOptionsImage,\n TextureOptions,\n TextureSourceOptions } from '../../types/Texture';\nimport {\n TextureSourceType,\n} from '../../types/Texture';\nimport type { GLGPURenderer } from '../webgl/GLGPURenderer';\nimport { GLTexture, imageBitMapAvailable } from '../webgl/GLTexture';\nimport type { Immutable } from '../../types/type';\nimport { getDefaultTextureFactory } from './MarsTextureFactory';\nimport { constants } from '../webgl/constants';\nimport type { MarsRenderer } from './MarsRenderer';\nimport { forEach, isObj, throwDestroyedError } from '../common/utils';\n\nexport function closeImageBitMap (img: any) {\n if (imageBitMapAvailable) {\n if (img instanceof ImageBitmap) {\n img.close();\n } else if (img instanceof Array) {\n img.forEach(closeImageBitMap);\n } else if (isObj(img)) {\n forEach(img, closeImageBitMap);\n }\n }\n}\n\nlet seed = 1;\n\nexport class MarsTexture implements Texture {\n readonly id: string;\n readonly options: Immutable<TextureOptions>;\n readonly sourceType: TextureSourceType;\n readonly name: string;\n readonly renderer?: MarsRenderer;\n readonly internal?: GLTexture;\n private _offloaded!: boolean;\n\n private _isDestroyed = false;\n\n get isDestroyed (): boolean {\n return this._isDestroyed;\n }\n\n constructor (options: TextureOptions | GLTexture, renderer?: MarsRenderer) {\n this.id = 'Tex' + seed++;\n\n if (options instanceof GLTexture) {\n this.sourceType = options.options.sourceType as TextureSourceType;\n this.options = options.options as Immutable<TextureOptions>;\n if (!renderer) {\n throw Error('copy texture should assign renderer');\n }\n this.internal = options;\n this.renderer = renderer;\n this.name = '';\n } else {\n const opt = this.checkOptions(options);\n\n this.sourceType = opt.sourceType as TextureSourceType;\n this.options = opt;\n this.name = options.name || '';\n if (renderer) {\n this.assignRenderer(renderer);\n }\n }\n }\n\n checkOptions (options: TextureOptions): Immutable<TextureOptions> {\n const opt = Object.assign({\n minFilter: constants.NEAREST,\n magFilter: constants.NEAREST,\n wrapS: constants.CLAMP_TO_EDGE,\n wrapT: constants.CLAMP_TO_EDGE,\n target: options.target || constants.TEXTURE_2D,\n format: constants.RGBA,\n internalFormat: options.format || constants.RGBA,\n type: constants.UNSIGNED_BYTE,\n }, options) as TextureOptions;\n\n if (!opt.sourceType) {\n if ((opt as Texture2DSourceOptionsImage).image) {\n (opt as Texture2DSourceOptionsImage).sourceType = TextureSourceType.image;\n } else if ((opt as Texture2DSourceOptionsData).data) {\n (opt as Texture2DSourceOptionsData).sourceType = TextureSourceType.data;\n } else if ((opt as Texture2DSourceOptionsVideo).video) {\n (opt as Texture2DSourceOptionsVideo).sourceType = TextureSourceType.video;\n } else {\n (opt as Texture2DSourceOptionsNone).sourceType = TextureSourceType.none;\n }\n }\n if (!opt.sourceType) {\n throw Error('invalid source type');\n }\n\n return opt as Immutable<TextureOptions>;\n }\n\n get width () {\n return this.internal?.width || 0;\n }\n\n get height () {\n return this.internal?.height || 0;\n }\n\n assignRenderer (renderer: MarsRenderer): MarsTexture {\n // @ts-expect-error safe to assign\n this['renderer'] = renderer;\n this._assignRenderer(renderer.internal);\n\n return this;\n }\n\n _assignRenderer (renderer: GLGPURenderer): void {\n if (!this.internal) {\n const option = this.options as TextureOptions;\n\n // @ts-expect-error safe to assign\n this['internal'] = new GLTexture(option, renderer);\n const releaseImageSource = !option.keepImageSource;\n\n if (option.sourceType === TextureSourceType.image) {\n if (releaseImageSource) {\n closeImageBitMap((option as Texture2DSourceOptionsImage).image);\n closeImageBitMap((option as TextureCubeSourceOptionsImage).cube);\n }\n //@ts-expect-error delete image memory\n delete (option as Texture2DSourceOptionsImage).image;\n //@ts-expect-error delete image memory\n delete (option as TextureCubeSourceOptionsImage).cube;\n } else if (option.sourceType === TextureSourceType.data) {\n //@ts-expect-error delete image memory\n delete (option as Texture2DSourceOptionsData).data;\n } else if (option.sourceType === TextureSourceType.compressed) {\n //@ts-expect-error delete image memory\n delete option.mipmaps;\n } else if (option.sourceType === TextureSourceType.mipmaps) {\n //@ts-expect-error delete image memory\n delete option.mipmaps;\n if (releaseImageSource) {\n closeImageBitMap(option.mipmaps);\n }\n }\n }\n }\n\n uploadCurrentVideoFrame () {\n if (this.options.sourceType === TextureSourceType.video && this.options.video && this.internal) {\n this.internal.update({ sourceType: TextureSourceType.video, video: this.options.video as HTMLVideoElement });\n\n return true;\n }\n\n return false;\n }\n\n destroy (): void {\n if (this.internal) {\n this.internal?.destroy();\n //@ts-expect-error safe to assign\n this['internal'] = this['renderer'] = undefined;\n }\n this._isDestroyed = true;\n this._assignRenderer = throwDestroyedError;\n }\n\n reloadDataAsync (): Promise<Texture> {\n if (this._offloaded) {\n return getDefaultTextureFactory().reloadTextureAsync(this);\n }\n\n return Promise.resolve(this);\n }\n\n offloadData (): void {\n if (this.internal && getDefaultTextureFactory().canOffloadTexture(this)) {\n this.internal?.offloadData();\n this._offloaded = true;\n }\n }\n\n updateSource (options: TextureSourceOptions): void {\n // @ts-expect-error safe to assign\n this['options'] = this.checkOptions(Object.assign(this.options, options));\n // @ts-expect-error safe to assign\n this['sourceType'] = this.options.sourceType;\n this.internal?.update(this.options as TextureSourceOptions);\n }\n\n}\n","import type {\n RenderPassColorAttachment,\n RenderPassColorAttachmentOptions, RenderPassColorAttachmentTextureOptions,\n} from '../../types/RenderPass';\nimport {\n RenderPassAttachmentStorageType,\n} from '../../types/RenderPass';\nimport { MarsTexture } from './MarsTexture';\nimport { TextureSourceType } from '../../types/Texture';\nimport type { MarsRenderer } from './MarsRenderer';\nimport { constants } from '../webgl/constants';\nimport { throwDestroyedError } from '../common/utils';\n\ninterface MarsRenderPassColorAttachmentOptions extends RenderPassColorAttachmentOptions {\n size?: [x: number, y: number],\n name?: string,\n}\n\ninterface MarsRenderPassColorAttachmentTextureOptions extends RenderPassColorAttachmentTextureOptions {\n size?: [x: number, y: number],\n}\n\nexport class MarsRenderPassColorAttachment implements RenderPassColorAttachment {\n readonly readable: boolean;\n texture!: MarsTexture;\n readonly externalTexture: boolean;\n textureOptions?: MarsRenderPassColorAttachmentTextureOptions;\n private _isDestroyed: boolean;\n multisample: number;\n readonly storageType = RenderPassAttachmentStorageType.color;\n get isDestroyed () {\n return this._isDestroyed;\n }\n\n constructor (options: MarsRenderPassColorAttachmentOptions) {\n if (options.texture instanceof MarsTexture) {\n this.texture = options.texture;\n this.externalTexture = true;\n } else if (options.texture) {\n const texOpt = options.texture as RenderPassColorAttachmentTextureOptions;\n\n this.externalTexture = false;\n this.textureOptions = {\n size: options.size,\n format: texOpt.format || constants.RGBA,\n type: texOpt.type || constants.UNSIGNED_BYTE,\n internalFormat: texOpt.internalFormat || texOpt.format || constants.RGBA,\n wrapT: texOpt.wrapT,\n wrapS: texOpt.wrapS,\n minFilter: texOpt.minFilter,\n magFilter: texOpt.magFilter,\n name: options.name,\n };\n } else {\n throw Error('color attachment must use texture');\n }\n this._isDestroyed = false;\n this.readable = true;\n }\n\n get size (): [x: number, y: number] {\n const tex = this.texture;\n\n return tex ? [tex.width, tex.height] : [0, 0];\n }\n\n get width (): number {\n return this.texture?.width || 0;\n }\n\n get height (): number {\n return this.texture?.height || 0;\n }\n\n assignRenderer (renderer: MarsRenderer): MarsRenderPassColorAttachment {\n if (this.textureOptions) {\n const size: [x: number, y: number] = this.textureOptions.size || [renderer.width, renderer.height];\n\n this.texture = new MarsTexture({\n ...this.textureOptions,\n sourceType: TextureSourceType.framebuffer,\n data: { width: size[0], height: size[1] },\n });\n }\n if (this.texture) {\n this.texture.assignRenderer(renderer);\n }\n if (this.multisample > 1) {\n this.multisample = Math.min(renderer.gpu.capability.maxSample, this.multisample);\n }\n\n return this;\n }\n\n destroy (): void {\n this.texture?.destroy();\n this.assignRenderer = throwDestroyedError as unknown as (r: MarsRenderer) => MarsRenderPassColorAttachment;\n this._isDestroyed = true;\n }\n\n}\n","import type {\n RenderPass,\n RenderPassAttachmentOptions,\n RenderPassLoadAction,\n RenderPassDelegate,\n RenderPassDepthStencilAttachment,\n RenderPassDestroyOptions,\n RenderPassOptions,\n RenderPassStorageObject,\n RenderPassStoreAction,\n} from '../../types/RenderPass';\nimport {\n RenderPassAttachmentStorageType,\n RenderPassDestroyAttachmentType,\n RenderPassMeshOrder, TextureLoadAction,\n TextureStoreAction,\n} from '../../types/RenderPass';\nimport type { MarsMesh } from './MarsMesh';\nimport type { MarsRenderer } from './MarsRenderer';\nimport { GLFrameBuffer } from '../webgl/GLFrameBuffer';\nimport { MarsRenderPassColorAttachment } from './MarsRenderPassColorAttachment';\nimport { MarsTexture } from './MarsTexture';\nimport type { GLTexture } from '../webgl/GLTexture';\nimport {\n arrAddByOrder, arrRemove, sortByOrder, throwDestroyedError,\n} from '../common/utils';\nimport type { vec4 } from '../../types';\nimport { TextureSourceType } from '../../types';\nimport { MarsSemanticMap } from './MarsSemanticMap';\nimport { DestroyOptions } from '../../types/constants';\n\nlet seed = 1;\n\nconst defStoreAction: RenderPassStoreAction = {\n colorAction: TextureStoreAction.store,\n depthAction: TextureStoreAction.store,\n stencilAction: TextureStoreAction.store,\n};\n\nconst defLoadAction: RenderPassLoadAction = {\n colorAction:TextureLoadAction.load,\n depthAction:TextureLoadAction.load,\n stencilAction:TextureLoadAction.load,\n};\n\nexport class MarsRenderPass implements RenderPass {\n delegate: RenderPassDelegate;\n readonly name: string;\n readonly priority: number;\n readonly meshes: MarsMesh[];\n readonly options: RenderPassAttachmentOptions;\n readonly renderer!: MarsRenderer;\n readonly frameBuffer?: GLFrameBuffer;\n\n readonly depthStencilType: RenderPassAttachmentStorageType;\n readonly loadAction: RenderPassLoadAction;\n readonly storeAction: RenderPassStoreAction;\n readonly semantics: MarsSemanticMap;\n\n private _isDestroyed = false;\n\n private _depthTexture?: MarsTexture;\n private _stencilTexture?: MarsTexture;\n private _attachments: MarsRenderPassColorAttachment[];\n\n get isDestroyed (): boolean {\n return this._isDestroyed;\n }\n\n get multisample () {\n return this.frameBuffer?.multisample || 0;\n }\n get attachments () {\n return this._attachments;\n }\n\n public viewportScale!: number;\n private _isCustomViewport!: boolean;\n private _customViewport?: [x: number, y: number, width: number, height: number];\n //todo reorder meshes if changed\n meshOrder: RenderPassMeshOrder;\n\n constructor (options: RenderPassOptions, renderer?: MarsRenderer) {\n this.name = options.name || ('MarsRenderPass_' + seed++);\n this.priority = options.priority || 0;\n this.meshOrder = options.meshOrder || RenderPassMeshOrder.ascending;\n this.meshes = (options.meshes as MarsMesh[] || []).slice();\n sortByOrder(this.meshes, this.meshOrder);\n this.options = options;\n this.loadAction = Object.assign({}, defLoadAction, options.loadAction);\n this._attachments = [];\n this.semantics = new MarsSemanticMap(options.semantics);\n this.depthStencilType = options.depthStencilAttachment?.storageType || RenderPassAttachmentStorageType.none;\n this._setViewportOptions(options);\n if (renderer) {\n this.assignRenderer(renderer);\n }\n this.delegate = options.delegate || {};\n\n this.storeAction = Object.assign({}, defStoreAction, options.storeAction);\n }\n\n get viewport (): vec4 {\n const ret = this.frameBuffer?.viewport || this._customViewport;\n\n if (ret) {\n return ret;\n }\n const renderer = this.renderer;\n const vs = this.viewportScale;\n\n return renderer ? [0, 0, renderer.width * vs, renderer.height * vs] : [0, 0, 0, 0];\n }\n\n get stencilAttachment (): RenderPassDepthStencilAttachment | undefined {\n const frameBuffer = this.frameBuffer;\n\n if (frameBuffer) {\n return {\n storageType: frameBuffer.depthStencilStorageType,\n storage: frameBuffer.stencilStorage as RenderPassStorageObject,\n texture: frameBuffer.stencilTexture ? this._getStencilTexture(frameBuffer.stencilTexture, frameBuffer.externalStorage) : undefined,\n };\n }\n }\n\n get depthAttachment (): RenderPassDepthStencilAttachment | undefined {\n const frameBuffer = this.frameBuffer;\n\n if (frameBuffer) {\n return {\n storageType: frameBuffer.depthStencilStorageType,\n storage: frameBuffer.depthStorage as RenderPassStorageObject,\n texture: frameBuffer.depthTexture ? this._getDepthTexture(frameBuffer.depthTexture, frameBuffer.externalStorage) : undefined,\n };\n }\n }\n\n bind () {\n if (this.frameBuffer) {\n this.frameBuffer.bind();\n } else {\n const state = this.renderer.internal.state;\n //在绑定的时候renderpass进行viewport的动态改变\n const vp = this.viewport;\n\n state.viewport(vp[0], vp[1], vp[2], vp[3]);\n }\n }\n\n private _getDepthTexture (texture: GLTexture, external: boolean): MarsTexture {\n if (!this._depthTexture) {\n const outTex = this.options.depthStencilAttachment?.texture as MarsTexture;\n const tex = texture === outTex?.internal ? outTex : new MarsTexture(texture, this.renderer);\n\n if (!external) {\n this._depthTexture = tex;\n }\n\n return tex;\n }\n\n return this._depthTexture;\n }\n\n private _getStencilTexture (texture: GLTexture, external: boolean): MarsTexture {\n if (!this._stencilTexture) {\n const outTex = this.options.depthStencilAttachment?.texture as MarsTexture;\n const tex = texture === outTex?.internal ? outTex : new MarsTexture(texture, this.renderer);\n\n if (!external) {\n this._stencilTexture = tex;\n }\n\n return tex;\n }\n\n return this._stencilTexture;\n }\n\n private _setViewportOptions (options: RenderPassAttachmentOptions) {\n if (options.viewport) {\n this._isCustomViewport = true;\n this.viewportScale = 1;\n this._customViewport = options.viewport.slice(0, 4) as [x: number, y: number, width: number, height: number];\n if (this.frameBuffer) {\n const vp = this._customViewport;\n\n this.frameBuffer.isCustomViewport = false;\n this.frameBuffer.resize(vp[0], vp[1], vp[2], vp[3]);\n }\n } else {\n this._isCustomViewport = false;\n this.viewportScale = options.viewportScale || 1;\n if (this.frameBuffer) {\n this.frameBuffer.isCustomViewport = true;\n this.frameBuffer.viewportScale = this.viewportScale;\n }\n }\n }\n\n resetColorAttachments (colors: MarsTexture[]) {\n if (!colors.length) {\n this.resetAttachments({ attachments: [] });\n }\n if (!this.attachments.length) {\n this.resetAttachments({ attachments: colors.map(t => ({ texture: t })) });\n } else {\n const attachments = colors.map(texture => {\n texture.updateSource({ sourceType: TextureSourceType.framebuffer });\n\n return new MarsRenderPassColorAttachment({ texture: texture.assignRenderer(this.renderer) });\n });\n\n this._attachments.forEach(att => !att.externalTexture && att.destroy());\n this._attachments = attachments;\n if (this.frameBuffer) {\n this.frameBuffer.bind();\n this.frameBuffer.resetColorTextures(colors.map(color => color.internal as GLTexture));\n }\n }\n }\n\n resetAttachments (options: RenderPassAttachmentOptions) {\n const ret = this.options;\n\n //@ts-expect-error safe to assign\n this.options = options;\n this._setViewportOptions(options);\n if (this.renderer) {\n this._resetAttachments();\n }\n\n return ret;\n }\n\n private _resetAttachments () {\n const renderer = this.renderer;\n const options = this.options;\n\n if (this._attachments.length) {\n this._attachments.forEach(att => !att.externalTexture && att.destroy());\n this._attachments.length = 0;\n this.frameBuffer?.destroy({ depthStencilAttachment: RenderPassDestroyAttachmentType.keepExternal });\n //@ts-expect-error safe to assign\n this.frameBuffer = null;\n }\n const vs = this.viewportScale;\n //renderpass的viewport相关参数都需要动态的修改\n const viewport = (this._isCustomViewport ? this._customViewport : [0, 0, renderer.width * vs, renderer.height * vs]) as vec4;\n\n const size: [x: number, y: number] = [viewport[2], viewport[3]];\n const name = this.name;\n\n if (options.attachments?.length) {\n const attachments = options.attachments.map(function (att, index) {\n return new MarsRenderPassColorAttachment(Object.assign({\n size,\n name: att.texture?.name || `${name}##color_${index}`,\n }, att)).assignRenderer(renderer);\n });\n\n this._attachments = attachments;\n const framebuffer = new GLFrameBuffer({\n storeAction: this.storeAction,\n name,\n viewport,\n multisample: options.multiSample,\n viewportScale: this.viewportScale,\n isCustomViewport: this._isCustomViewport,\n attachments: attachments.map(att => (att.texture).internal as GLTexture),\n depthStencilAttachment: options.depthStencilAttachment || { storageType: RenderPassAttachmentStorageType.none },\n }, renderer.internal);\n\n framebuffer.bind();\n framebuffer.unbind();\n //@ts-expect-error safe to assign\n this.frameBuffer = framebuffer;\n } else {\n this._attachments.length = 0;\n }\n }\n\n unbind () {\n const state = this.renderer.internal.state;\n\n if (this.frameBuffer) {\n this.frameBuffer.unbind();\n } else {\n state.bindSystemFramebuffer();\n }\n }\n\n assignRenderer (renderer: MarsRenderer): MarsRenderPass {\n if (!this.renderer) {\n //@ts-expect-error safe to assign\n this.renderer = renderer;\n this._resetAttachments();\n }\n\n return this;\n }\n\n destroy (options?: RenderPassDestroyOptions) {\n const destroyMeshOption = options?.meshes || undefined;\n\n if (destroyMeshOption !== DestroyOptions.keep) {\n this.meshes.forEach(mesh => {\n mesh.destroy(destroyMeshOption);\n });\n }\n this.meshes.length = 0;\n\n const colorOpt = options?.colorAttachment ? options.colorAttachment : RenderPassDestroyAttachmentType.force;\n\n this._attachments.forEach(att => {\n const keep = (att.externalTexture && colorOpt === RenderPassDestroyAttachmentType.keepExternal) || colorOpt === RenderPassDestroyAttachmentType.keep;\n\n if (!keep) {\n att.destroy();\n }\n });\n this._attachments.length = 0;\n if (options?.semantics !== DestroyOptions.keep) {\n this.semantics.destroy();\n }\n\n const depthStencilOpt = options?.depthStencilAttachment ? options.depthStencilAttachment : RenderPassDestroyAttachmentType.force;\n const fbo = this.frameBuffer;\n\n if (fbo) {\n fbo.destroy({ depthStencilAttachment: depthStencilOpt });\n const keep = (fbo.externalStorage && depthStencilOpt === RenderPassDestroyAttachmentType.keepExternal) || depthStencilOpt === RenderPassDestroyAttachmentType.keep;\n\n if (!keep) {\n this._stencilTexture?.destroy();\n this._depthTexture?.destroy();\n }\n }\n\n //@ts-expect-error safe to assign\n this.options = this.renderer = null;\n this.assignRenderer = throwDestroyedError as unknown as (r: MarsRenderer) => MarsRenderPass;\n this._isDestroyed = true;\n }\n\n addMesh (mesh: MarsMesh): void {\n arrAddByOrder(this.meshes, mesh, this.meshOrder);\n }\n\n removeMesh (mesh: MarsMesh): void {\n arrRemove(this.meshes, mesh);\n }\n\n setMeshes (meshes: MarsMesh[]): MarsMesh[] {\n this.meshes.length = 0;\n this.meshes.splice(0, 0, ...meshes);\n\n return sortByOrder(this.meshes, this.meshOrder);\n }\n}\n","import type { MaterialRenderStates } from '../../types/Material';\nimport type { GLGPURenderer } from './GLGPURenderer';\nimport type { MarsMaterial } from '../render/MarsMaterial';\nimport type { Immutable, vec3, vec4 } from '../../types/type';\nimport { constants } from './constants';\nimport type { GLProgram } from './GLProgram';\n\nexport class GLMaterial {\n\n readonly renderer: GLGPURenderer;\n\n readonly shaderCacheId: string;\n\n readonly states: Immutable<MaterialRenderStates>;\n\n readonly material: MarsMaterial;\n\n constructor (renderer: GLGPURenderer, material: MarsMaterial) {\n this.renderer = renderer;\n this.shaderCacheId = material.shaderCacheId;\n this.states = material.states;\n this.material = material;\n }\n\n setupStates () {\n const webGLState = this.renderer.state;\n const currentState = this.states;\n\n //在之前已经给过默认值 这里就不用再判断undefined和null了\n webGLState.toggle(constants.SAMPLE_ALPHA_TO_COVERAGE, currentState.sampleAlphaToCoverage);\n webGLState.toggle(constants.BLEND, currentState.blending);\n webGLState.toggle(constants.DEPTH_TEST, currentState.depthTest);\n webGLState.toggle(constants.STENCIL_TEST, currentState.stencilTest);\n webGLState.toggle(constants.CULL_FACE, currentState.cullFaceEnabled);\n webGLState.toggle(constants.POLYGON_OFFSET_FILL, currentState.polygonOffsetFill);\n if (currentState.stencilTest) {\n //stencil\n webGLState.stencilMaskSeparate(constants.BACK, currentState.stencilMaskBack as number);\n webGLState.stencilMaskSeparate(constants.FRONT, currentState.stencilMaskFront as number);\n const stencilBackFunc = currentState.stencilFuncBack as vec3;\n\n webGLState.stencilFuncSeparate(constants.BACK, stencilBackFunc[0], stencilBackFunc[1], stencilBackFunc[2]);\n const stencilFrontFunc = currentState.stencilFuncFront as vec3;\n\n webGLState.stencilFuncSeparate(constants.FRONT, stencilFrontFunc[0], stencilFrontFunc[1], stencilFrontFunc[2]);\n const stencilOpBack = currentState.stencilOpBack as vec3;\n\n webGLState.stencilOpSeparate(constants.BACK, stencilOpBack[0], stencilOpBack[1], stencilOpBack[2]);\n const stencilOpFront = currentState.stencilOpFront as vec3;\n\n webGLState.stencilOpSeparate(constants.FRONT, stencilOpFront[0], stencilOpFront[1], stencilOpFront[2]);\n }\n\n if (currentState.blending) {\n //blend\n const blendColor = currentState.blendColor as vec4;\n\n webGLState.blendColor(blendColor[0], blendColor[1], blendColor[2], blendColor[3]);\n webGLState.blendEquationSeparate(currentState.blendEquationRGB as number, currentState.blendEquationAlpha as number);\n webGLState.blendFuncSeparate(currentState.blendSrc as number, currentState.blendDst as number, currentState.blendSrcAlpha as number, currentState.blendDstAlpha as number);\n }\n\n //color depth\n const colorMask = currentState.colorMask as [r: boolean, g: boolean, b: boolean, a: boolean];\n\n webGLState.colorMask(colorMask[0], colorMask[1], colorMask[2], colorMask[3]);\n if (currentState.depthTest) {\n webGLState.depthMask(currentState.depthMask as boolean);\n webGLState.depthFunc(currentState.depthFunc as number);\n webGLState.depthRange(currentState.depthRange?.[0] as number, currentState.depthRange?.[1] as number);\n }\n\n if (currentState.cullFaceEnabled) {\n //face\n webGLState.cullFace(currentState.cullFace as number);\n webGLState.frontFace(currentState.frontFace as number);\n }\n\n if (currentState.polygonOffsetFill) {\n const polygonOffset = currentState.polygonOffset || [0, 0];\n\n webGLState.polygonOffset(polygonOffset[0], polygonOffset[1]);\n }\n\n // set gl states\n\n }\n\n getProgram (): GLProgram | null {\n return this.renderer.shaderLibrary.getProgram(this.shaderCacheId);\n }\n\n destroy () {\n const lib = this.renderer?.shaderLibrary;\n\n if (lib) {\n const shader = lib.getShaderResult(this.shaderCacheId);\n\n if (shader && !shader.shared) {\n lib.deleteShader(this.shaderCacheId);\n }\n }\n //@ts-expect-error safe to assign\n this.renderer = null;\n }\n}\n","import type {\n MaterialDataBlock,\n MaterialDataBlockDestroyOptions,\n MaterialDataBlockOptions, UniformSemantic, UniformStruct,\n UniformValue, vec2,\n Texture,\n} from '../../types';\nimport type { MarsRenderer } from './MarsRenderer';\nimport { forEach, isObj, throwDestroyedError } from '../common/utils';\nimport { MarsTexture } from './MarsTexture';\nimport { DestroyOptions } from '../../types/constants';\nimport type { UniformBlockSpec } from '../webgl/GLUniformUtils';\nimport { UniformBlockBuffer } from '../webgl/GLUniformUtils';\n\nfunction isUniformStruct (value: UniformValue) {\n return (isObj(value)) && ((value as any).length === undefined);\n}\n\nfunction isUniformStructArray (value: UniformValue) {\n return (value) && ((value as Array<number>).length !== undefined) && isUniformStruct((value as Array<number>)[0]);\n}\n\nexport class MarsMaterialDataBlock implements MaterialDataBlock {\n readonly _uniformValues: Record<string, UniformValue>;\n readonly _uniformTextures: Record<string, MarsTexture | MarsTexture[]>;\n readonly _uniformFlags: Record<string, boolean>;\n readonly _uniformValueRanges: Record<string, vec2>;\n readonly name: string;\n readonly uniformSemantics: { [key: string]: UniformSemantic };\n readonly renderer?: MarsRenderer;\n readonly uboBufferMap: Record<string, UniformBlockBuffer>;\n protected _isDestroyed = false;\n private _uniformPrivate: Record<string, boolean>;\n private readonly _keepUboData: boolean;\n\n constructor (props: MaterialDataBlockOptions & { keepUboData?: boolean }, renderer?: MarsRenderer) {\n this._isDestroyed = false;\n this.name = props.name || 'defDataBlock';\n this._uniformValues = {};\n this._uniformFlags = {};\n this.uboBufferMap = {};\n this._uniformTextures = {};\n this._uniformValueRanges = {};\n this._keepUboData = !!props.keepUboData;\n this.uniformSemantics = props.uniformSemantics || {};\n this._uniformPrivate = {};\n if (props.uniformValues) {\n this.setUniformValues(props.uniformValues);\n }\n forEach(props.uniformTextures, (tex, name)=>this.setUniformTexture(name, tex as MarsTexture));\n if (renderer) {\n this.assignRenderer(renderer);\n }\n }\n\n _assignUniformValueRenderer (value: MarsTexture | MarsTexture[], renderer?: MarsRenderer) {\n if (renderer) {\n const assign = (value: MarsTexture) => isObj(value) && (value as any).assignRenderer && (value as any).assignRenderer(renderer);\n\n if (value instanceof Array) {\n value.forEach(assign);\n } else {\n assign(value);\n }\n }\n }\n\n invalidAllFlags () {\n const f = this._uniformFlags;\n const range = this._uniformValueRanges;\n\n forEach(this._uniformValues, function (val, key) {\n f[key] = true;\n range[key] = [0, 0];\n });\n }\n\n clearFlags () {\n // @ts-expect-error safe to assign\n this._uniformFlags = {};\n }\n\n isDirty (shaderCacheId: string, name: string): boolean {\n return this._uniformFlags[name] === true;\n }\n\n get isDestroyed () {\n return this._isDestroyed;\n }\n\n setUniformTexture (uniformName: string, texture: MarsTexture | MarsTexture[] | undefined) {\n if (texture) {\n this._uniformTextures[uniformName] = texture;\n this._assignUniformValueRenderer(texture, this.renderer);\n this._uniformPrivate[uniformName] = true;\n } else {\n delete this._uniformTextures[uniformName];\n delete this._uniformPrivate[uniformName];\n }\n }\n\n getUniformTexture <T extends (Texture | Texture[]) = MarsTexture> (uniformName: string): T | undefined {\n return this._uniformTextures[uniformName] as unknown as T;\n }\n\n assignRenderer (renderer: MarsRenderer): MaterialDataBlock {\n if (this.renderer && renderer !== this.renderer) {\n throw Error('assign different renderer');\n }\n if (renderer && !this.renderer) {\n // @ts-expect-error safe to assign\n this.renderer = renderer;\n\n forEach(this._uniformTextures, value => {\n this._assignUniformValueRenderer(value, renderer);\n });\n }\n\n return this;\n }\n\n createUboBuffer (spec: UniformBlockSpec): UniformBlockBuffer | undefined {\n if (!this.uboBufferMap[spec.id] && this.renderer && this.name === spec.name) {\n const ubo = this.uboBufferMap[spec.id] = new UniformBlockBuffer(this.renderer.internal, spec);\n\n ubo.keepData = this._keepUboData;\n }\n\n return this.uboBufferMap[spec.id];\n }\n\n setUboBuffer (uboBuffer: UniformBlockBuffer) {\n uboBuffer.setValues(this._uniformValues, this._uniformFlags, this._uniformValueRanges);\n }\n\n updateUniformSubData (name: string, start: number, count: number) {\n throw Error('this method has been deprecated');\n const range = this._uniformValueRanges[name];\n\n if (!this._uniformValueRanges[name]) {\n this._uniformValueRanges[name] = [start, count];\n } else {\n const end = Math.max(range[0] + range[1], start + count);\n const s = Math.min(start, range[0]);\n\n this._uniformValueRanges[name] = [s, end - s];\n }\n this._uniformFlags[name] = true;\n }\n\n hasUniformValue (name: string): boolean {\n return !!this._uniformPrivate[name];\n }\n\n destroy (options?: MaterialDataBlockDestroyOptions): void {\n if (options?.textures !== DestroyOptions.keep) {\n forEach(this._uniformTextures, uniform => {\n if (uniform instanceof MarsTexture) {\n uniform.destroy();\n }\n });\n }\n forEach(this.uboBufferMap, ubo => {\n ubo?.destroy();\n });\n // @ts-expect-error safe to assign\n this.uboBufferMap = {};\n\n this._uniformPrivate = {};\n\n // @ts-expect-error safe to assign\n this._uniformFlags = {};\n // @ts-expect-error safe to assign\n this._uniformValues = {};\n // @ts-expect-error safe to assign\n this._uniformTextures = {};\n // @ts-expect-error safe to assign\n this.uniformSemantics = {};\n this.assignRenderer = throwDestroyedError as unknown as (r: MarsRenderer) => MarsMaterialDataBlock;\n\n this._isDestroyed = true;\n }\n\n getUniformValue (name: string): UniformValue {\n return this._uniformValues[name];\n }\n\n getUniformValues (): { [p: string]: UniformValue } {\n return this._uniformValues;\n }\n\n setUniformValue (name: string, value: UniformValue | undefined, isSemantic?: boolean): boolean {\n if (value === undefined) {\n const originValue = this._uniformValues[name];\n\n if (isUniformStruct(originValue)) {\n forEach(originValue as UniformStruct, (data, key) => {\n const nameInStruct = name + '.' + key;\n\n delete this._uniformPrivate[nameInStruct];\n });\n } else if (isUniformStructArray(originValue)) {\n (originValue as UniformStruct[]).forEach((valueData, i) => {\n forEach(valueData, (valueInStruct: UniformValue, key) => {\n const nameInStruct = name + '[' + i + ']' + '.' + key;\n\n delete this._uniformPrivate[nameInStruct];\n });\n });\n }\n delete this._uniformValues[name];\n this._uniformFlags[name] = false;\n delete this._uniformPrivate[name];\n } else if (value instanceof MarsTexture) {\n throw Error('setUniformValue not accept texture:' + name);\n } else {\n this._uniformPrivate[name] = !isSemantic;\n if (isUniformStruct(value)) {\n forEach(value as UniformStruct, (data, key) => {\n const nameInStruct = name + '.' + key;\n\n this._uniformValues[nameInStruct] = data;\n this._uniformFlags[nameInStruct] = true;\n this._uniformPrivate[nameInStruct] = true;\n });\n // 只是用来保存结构体对象\n this._uniformValues[name] = value;\n this._uniformFlags[name] = false;\n } else if (isUniformStructArray(value)) {\n (value as UniformStruct[]).forEach((valueData, i) => {\n forEach(valueData, (valueInStruct: UniformValue, key) => {\n const nameInStruct = name + '[' + i + ']' + '.' + key;\n\n this._uniformValues[nameInStruct] = valueInStruct;\n this._uniformFlags[nameInStruct] = true;\n this._uniformPrivate[nameInStruct] = true;\n });\n });\n // 只是用来保存结构体对象\n this._uniformValues[name] = value;\n this._uniformFlags[name] = false;\n } else {\n this._uniformValues[name] = value;\n this._uniformFlags[name] = true;\n }\n }\n\n return true;\n }\n\n setUniformValues (map: { [p: string]: UniformValue }): void {\n forEach(map, (val, key) => {\n this.setUniformValue(key, val);\n });\n }\n\n setUniformSemantic (name: string, semantic: string | undefined) {\n if (semantic) {\n this.uniformSemantics[name] = semantic;\n } else {\n delete this.uniformSemantics[name];\n }\n }\n\n clone (name: string): MarsMaterialDataBlock {\n return new MarsMaterialDataBlock({\n name,\n uniformValues: { ...this._uniformValues },\n uniformTextures: { ...this._uniformTextures },\n uniformSemantics: { ...this.uniformSemantics },\n keepUboData: this._keepUboData,\n }, this.renderer);\n }\n\n}\n","import type {\n Material, MaterialDestroyOptions, MaterialOptions, MaterialRenderStates,\n} from '../../types';\nimport { MaterialRenderType } from '../../types/Material';\nimport type { Immutable } from '../../types/type';\nimport { GLMaterial } from '../webgl/GLMaterial';\nimport { constants } from '../webgl/constants';\nimport type { MarsRenderer } from './MarsRenderer';\nimport { MarsMaterialDataBlock } from './MarsMaterialDataBlock';\nimport { arrAdd, arrRemove, throwDestroyedError } from '../common/utils';\nimport { DestroyOptions } from '../../types/constants';\n\nlet seed = 1;\n\nexport class MarsMaterial implements Material {\n readonly shaderCacheId!: string;\n readonly options!: Immutable<MaterialOptions>;\n readonly materialInternal?: GLMaterial;\n readonly name: string;\n public readonly _dataBlocks: MarsMaterialDataBlock[];\n readonly renderType: MaterialRenderType;\n readonly states: Immutable<MaterialRenderStates>;\n readonly renderer?: MarsRenderer;\n private _dbMap: Record<string, MarsMaterialDataBlock>;\n private _isDestroyed = false;\n\n get isDestroyed (): boolean {\n return this._isDestroyed;\n }\n\n get dataBlocks (): MarsMaterialDataBlock[] {\n return this._dataBlocks;\n }\n\n get defaultDataBlock (): MarsMaterialDataBlock {\n return this._dataBlocks[0];\n }\n\n constructor (options: MaterialOptions) {\n this.name = options.name || ('Material' + seed++);\n this._dataBlocks = (options.dataBlocks || []).map(b => (b instanceof MarsMaterialDataBlock) ? b : new MarsMaterialDataBlock(b));\n this.renderType = MaterialRenderType.normal;\n this.states = this.createMaterialStates(options.states);\n this.options = options;\n this._dbMap = {};\n if (!this._dataBlocks.length) {\n this._dataBlocks[0] = new MarsMaterialDataBlock({ name: 'main' });\n }\n }\n\n createMaterialStates (states: MaterialRenderStates): Immutable<MaterialRenderStates> {\n const ret: MaterialRenderStates = {\n blending: !!states.blending,\n sampleAlphaToCoverage: !!states.sampleAlphaToCoverage,\n depthTest: !!states.depthTest,\n stencilTest: !!states.stencilTest,\n cullFaceEnabled: !!states.cullFaceEnabled,\n polygonOffsetFill: !!states.polygonOffsetFill,\n };\n\n if (states.stencilMask === undefined || states.stencilMask === null) {\n ret.stencilMaskBack = valIfUndefined(states.stencilMaskBack, 0xff);\n ret.stencilMaskFront = valIfUndefined(states.stencilMaskFront, 0xff);\n } else {\n const stencilMaskBack = valIfUndefined(states.stencilMaskBack, states.stencilMask);\n\n ret.stencilMaskBack = valIfUndefined(stencilMaskBack, 0xff);\n const stencilMaskFront = valIfUndefined(states.stencilMaskFront, states.stencilMask);\n\n ret.stencilMaskFront = valIfUndefined(stencilMaskFront, 0xff);\n }\n\n if (states.stencilFunc === undefined || states.stencilFunc === null) {\n ret.stencilFuncBack = valIfUndefined(states.stencilFuncBack, [constants.ALWAYS, 0, 0xff]);\n ret.stencilFuncFront = valIfUndefined(states.stencilFuncFront, [constants.ALWAYS, 0, 0xff]);\n } else {\n const stencilFuncFront = valIfUndefined(states.stencilFuncFront, states.stencilFunc);\n\n ret.stencilFuncFront = valIfUndefined(stencilFuncFront, [constants.ALWAYS, 0, 0xff]);\n const stencilFuncBack = valIfUndefined(states.stencilFuncBack, states.stencilFunc);\n\n ret.stencilFuncBack = valIfUndefined(stencilFuncBack, [constants.ALWAYS, 0, 0xff]);\n }\n\n if (states.stencilOp === undefined || states.stencilOp === null) {\n ret.stencilOpFront = valIfUndefined(states.stencilOpFront, [constants.KEEP, constants.KEEP, constants.KEEP]);\n ret.stencilOpBack = valIfUndefined(states.stencilOpBack, [constants.KEEP, constants.KEEP, constants.KEEP]);\n } else {\n const stencilOpFront = valIfUndefined(states.stencilOpFront, states.stencilOp);\n\n ret.stencilOpFront = valIfUndefined(stencilOpFront, [constants.KEEP, constants.KEEP, constants.KEEP]);\n const stencilOpBack = valIfUndefined(states.stencilOpBack, states.stencilOp);\n\n ret.stencilOpBack = valIfUndefined(stencilOpBack, [constants.KEEP, constants.KEEP, constants.KEEP]);\n }\n //blend\n ret.blendSrc = valIfUndefined(states.blendSrc, constants.ONE);\n ret.blendSrcAlpha = valIfUndefined(states.blendSrcAlpha, ret.blendSrc);\n ret.blendDst = valIfUndefined(states.blendDst, constants.ZERO);\n ret.blendDstAlpha = valIfUndefined(states.blendDstAlpha, ret.blendDst);\n ret.blendEquationRGB = valIfUndefined(states.blendEquationRGB, constants.FUNC_ADD);\n ret.blendEquationAlpha = valIfUndefined(states.blendEquationAlpha, ret.blendEquationRGB);\n ret.blendColor = valIfUndefined(states.blendColor, [0, 0, 0, 0]);\n //color\n ret.colorMask = valIfUndefined(states.colorMask, [true, true, true, true]);\n //depth\n ret.depthMask = valIfUndefined(states.depthMask, true);\n ret.depthFunc = valIfUndefined(states.depthFunc, constants.LESS);\n ret.depthRange = valIfUndefined(states.depthRange, [0, 1]);\n ret.cullFace = valIfUndefined(states.cullFace, constants.BACK);\n ret.frontFace = valIfUndefined(states.frontFace, constants.CCW);\n ret.polygonOffset = states.polygonOffset || [0, 0];\n\n //ret\n return Object.freeze(ret);\n }\n\n addDataBlock (b: MarsMaterialDataBlock) {\n if (this.getDataBlockByName(b.name)) {\n throw Error('dataBlock with same name:' + b.name);\n }\n if (arrAdd(this._dataBlocks, b)) {\n b.invalidAllFlags();\n const r = this.renderer;\n\n if (r) {\n b.assignRenderer(r);\n }\n\n }\n }\n\n getDataBlockByName (name: string) {\n const cache = this._dbMap[name];\n\n if (!cache) {\n const db = this._dataBlocks.find(db=> db.name === name);\n\n if (db) {\n return this._dbMap[name] = db;\n }\n }\n\n return cache;\n }\n\n removeDataBlock (b: MarsMaterialDataBlock) {\n arrRemove(this._dataBlocks, b);\n delete this._dbMap[b.name];\n }\n\n assignRenderer (renderer: MarsRenderer): MarsMaterial {\n if (!this.materialInternal) {\n const shader = this.options.shader;\n\n // @ts-expect-error safe to assign\n this.shaderCacheId = renderer.internal.shaderLibrary.addShader(shader);\n // @ts-expect-error safe to assign\n this.materialInternal = new GLMaterial(renderer.internal, this);\n // @ts-expect-error safe to assign\n this['renderer'] = renderer;\n this._dataBlocks.forEach(d => d.assignRenderer(renderer));\n }\n\n return this;\n }\n\n destroy (options?: MaterialDestroyOptions): void {\n if (options?.blocks !== DestroyOptions.keep) {\n this._dataBlocks.forEach(b => b.destroy({ textures: options?.textures }));\n }\n this.materialInternal?.destroy();\n this.assignRenderer = throwDestroyedError as unknown as (r: MarsRenderer) => MarsMaterial;\n this._isDestroyed = true;\n }\n}\n\nfunction valIfUndefined<T> (val: any, def: T): T {\n if (val === undefined || val === null) {\n return def;\n }\n\n return val;\n}\n","import type { GLGPURenderer } from './GLGPURenderer';\n\nexport function createVAO (renderer: GLGPURenderer, name?: string): GLVertexArrayObject | undefined {\n if (renderer.gpu.capability.vao) {\n const ret = new GLVertexArrayObject(renderer, name);\n\n if (ret.vao) {\n return ret;\n }\n }\n}\n\nexport class GLVertexArrayObject {\n readonly renderer: GLGPURenderer;\n\n readonly vao: WebGLVertexArrayObject;\n\n ready = false;\n\n constructor (renderer: GLGPURenderer, name?: string) {\n this.renderer = renderer;\n this.vao = renderer.createVertexArray(name) as WebGLVertexArrayObject;\n }\n\n destroy () {\n if (this.vao) {\n const renderer = this.renderer;\n\n if (renderer.state.bindingVAO == this.vao) {\n renderer.state.bindingVAO = undefined;\n renderer.bindVertexArray(null);\n }\n renderer.deleteVertexArray(this.vao);\n //@ts-expect-error safe to assign\n this.vao = this.renderer = null;\n }\n }\n\n bind () {\n const renderer = this.renderer;\n\n if (this.vao && renderer.state.bindingVAO !== this.vao) {\n renderer.state.bindingVAO = this.vao;\n renderer.bindVertexArray(this.vao);\n }\n }\n\n unbind () {\n const renderer = this.renderer;\n\n renderer.bindVertexArray(null);\n renderer.state.bindingVAO = undefined;\n }\n}\n","import type { AttributeWithType } from '../../types/Geometry';\nimport type { GPUBuffer, GPUBufferOptions } from '../../types/GPUBuffer';\nimport { GLGPUBuffer } from './GLGPUBuffer';\nimport type { GLGPURenderer } from './GLGPURenderer';\nimport type { RenderState } from '../../types/RenderFrame';\nimport { constants } from './constants';\nimport { forEach } from '../common/utils';\nimport type { GLVertexArrayObject } from './GLVertexArrayObject';\nimport { createVAO } from './GLVertexArrayObject';\nimport type { InstancedMesh } from '../../types';\n\nexport const INDEX_TYPE_MAP = {\n [Uint16Array.BYTES_PER_ELEMENT]: constants.UNSIGNED_SHORT,\n [Uint32Array.BYTES_PER_ELEMENT]: constants.UNSIGNED_INT,\n};\n\nexport const TYPE_BYTE_MAP = {\n [constants.UNSIGNED_SHORT]: Uint16Array.BYTES_PER_ELEMENT,\n [constants.UNSIGNED_INT]: Uint32Array.BYTES_PER_ELEMENT,\n};\n\nexport type GLGeometryOptions = {\n drawStart: number,\n drawCount: number,\n attributes: { [key: string]: AttributeWithType },\n buffers: { [key: string]: GPUBufferOptions },\n mode: GLenum,\n index?: GPUBufferOptions,\n name: string,\n vaoMap?: Record<string, GLVertexArrayObject | undefined>,\n};\n\n/**\n * GLGeometry对象,保存GLGPUBuffer对象。\n *\n */\nexport class GLGeometry {\n\n name?: string;\n\n renderer?: GLGPURenderer | undefined;\n\n drawStart: number;\n\n drawCount: number;\n\n mode: GLenum;\n\n indexBufferType: GLenum;\n\n // 记录顶点属性信息用于GLProgram绑定顶点属性\n attributes: { [key: string]: AttributeWithType };\n\n // 记录了顶点属性与GPUBuffer对应关系\n _buffersMap: { [key: string]: GLGPUBuffer };\n\n // 索引缓冲区\n _indexBuffer?: GLGPUBuffer;\n\n readonly vaoMap: Record<string, GLVertexArrayObject | undefined>;\n\n constructor (option: GLGeometryOptions | GLGeometry, renderer: GLGPURenderer) {\n\n this.renderer = renderer;\n\n this.drawStart = option.drawStart;\n\n this.drawCount = option.drawCount;\n\n this.mode = isNaN(option.mode) ? constants.TRIANGLES : option.mode;\n\n this.name = option.name;\n\n const buffers: { [key: string]: GLGPUBuffer } = {};\n\n const inAttributes = option.attributes;\n const attributes: { [key: string]: AttributeWithType } = {};\n\n if (option instanceof GLGeometry) {\n forEach(option._buffersMap, function (buffer, name) {\n buffers[name] = buffer;\n });\n } else {\n // 创建GPUBuffer\n forEach(option.buffers, function (opt, name) {\n buffers[name] = new GLGPUBuffer(opt, renderer);\n });\n if (option.index && option.index.data) {\n const ret = this.createIndexBuffer(option.index.data as Uint16Array, renderer);\n\n this.setIndexBuffer(ret[0], ret[1]);\n }\n }\n\n this._buffersMap = buffers;\n // 记录顶点属性\n forEach(inAttributes, function (attribute, name) {\n attributes[name] = attribute;\n });\n this.attributes = attributes;\n\n this.vaoMap = {};\n }\n\n createVao (name: string) {\n if (!this.vaoMap[name]) {\n this.vaoMap[name] = createVAO(this.renderer as GLGPURenderer, `${this.name}-${name}`);\n }\n\n return this.vaoMap[name] as GLVertexArrayObject;\n }\n\n destroyVao (name: string) {\n this.vaoMap[name]?.destroy();\n this.vaoMap[name] = undefined;\n }\n\n setIndexBuffer (buffer: GLGPUBuffer, indexBufferType: GLenum) {\n this._indexBuffer = buffer;\n this.indexBufferType = indexBufferType;\n }\n\n createIndexBuffer (data: Uint16Array | Uint32Array | Uint8Array, renderer: GLGPURenderer): [buffer: GLGPUBuffer, type: GLenum] {\n const type = INDEX_TYPE_MAP[data.BYTES_PER_ELEMENT];\n const indexOption: GPUBufferOptions = {\n data,\n target: constants.ELEMENT_ARRAY_BUFFER,\n name: `${this.name}##index`,\n };\n\n return [new GLGPUBuffer(indexOption, renderer), type];\n }\n\n getGPUBuffer (name: string | number): GLGPUBuffer | null {\n return this._buffersMap[name];\n }\n\n destroy (): void {\n if (this.renderer) {\n forEach(this._buffersMap, function (buffer) {\n buffer.destroy();\n });\n this._buffersMap = {};\n this._indexBuffer?.destroy();\n const m = this.vaoMap;\n\n forEach(m, function (vao, key) {\n vao?.destroy();\n m[key] = undefined;\n });\n }\n this.attributes = {};\n this._indexBuffer = undefined;\n this.renderer = undefined;\n }\n\n setAttributeBuffer (name: string, buffer: GPUBuffer): void {\n this._buffersMap[name] = buffer as GLGPUBuffer;\n // update vao bind\n }\n\n getAttributeBuffer (name: string): GPUBuffer | null {\n if (this._buffersMap != undefined) {\n return this._buffersMap[name];\n }\n\n return null;\n }\n\n draw (state: RenderState) {\n const index = this._indexBuffer;\n const gl = this.renderer?.gl as WebGL2RenderingContext;\n const gpu = this.renderer?.gpu;\n const useInstancedDraw = gpu?.capability.instanceDraw && (state.currentMesh as InstancedMesh).instanceCount > 0;\n\n if (gl && gpu) {\n const drawCount = this.drawCount;\n\n if (index) {\n const type = this.indexBufferType;\n //bind by vao\n //this._indexBuffer?.bind();\n const dc = isNaN(drawCount) ? index.getElementCount(TYPE_BYTE_MAP[type]) : drawCount;\n\n if (dc > 0) {\n if (useInstancedDraw) {\n gpu.drawElementsInstanced(gl, this.mode, dc, type, this.drawStart || 0, (state.currentMesh as InstancedMesh).instanceCount);\n } else {\n gl.drawElements(this.mode, dc, type, this.drawStart || 0);\n }\n }\n } else if (drawCount > 0) {\n if (useInstancedDraw) {\n gpu.drawArraysInstanced(gl, this.mode, this.drawStart, this.drawCount, (state.currentMesh as InstancedMesh).instanceCount);\n } else {\n gl.drawArrays(this.mode, this.drawStart, this.drawCount);\n }\n }\n }\n }\n}\n","import type { Immutable, TypedArray } from '../../types/type';\nimport type {\n Geometry,\n GeometryOptions,\n AttributeWithData,\n AttributeWithType,\n Attribute,\n} from '../../types/Geometry';\nimport type { GPUBuffer, GPUBufferOptions } from '../../types/GPUBuffer';\nimport { GLGeometry } from '../webgl/GLGeometry';\nimport { constants } from '../webgl/constants';\nimport { forEach, throwDestroyedError } from '../common/utils';\nimport type { GLGPUBuffer } from '../webgl/GLGPUBuffer';\nimport type { MarsRenderer } from './MarsRenderer';\n\nconst BYTES_TYPE_MAP = {\n [constants.FLOAT]: Float32Array.BYTES_PER_ELEMENT,\n [constants.INT]: Int32Array.BYTES_PER_ELEMENT,\n [constants.SHORT]: Int16Array.BYTES_PER_ELEMENT,\n [constants.BYTE]: Int8Array.BYTES_PER_ELEMENT,\n};\n\ntype BufferDirtyFlag = {\n dirty: boolean,\n discard?: boolean,\n start?: number,\n end?: number,\n};\n\nfunction isIndexDataType (data: any): boolean {\n const result = (data instanceof Uint8Array) || (data instanceof Uint16Array) ||\n (data instanceof Uint32Array);\n\n return result;\n}\n\nfunction attributeData2GLType (data: Float32Array | Int32Array | Int16Array | Uint16Array | Uint32Array | unknown): number {\n if (data instanceof Float32Array) {\n return constants.FLOAT;\n } else {\n return constants.INT;\n }\n}\n\nfunction emptyTypedArrayByGLType (type: number): Float32Array | Int32Array | Int16Array {\n if (type === constants.INT) {\n return new Int32Array(0);\n }\n if (type === constants.SHORT) {\n return new Int16Array(0);\n }\n\n return new Float32Array(0);\n}\n\n// 根据attribute的datasource获取js端buffer\nfunction getAttributeBufferOption (geom: MarsGeometry, name: string): GPUBufferOptions | undefined {\n const attribute = geom._attributes[name];\n\n if (attribute) {\n return geom._buffers[attribute.dataSource];\n }\n\n return undefined;\n}\n\nlet seed = 1;\n\n/**\n * 应用层Geometry对象,本身不直接保存GPU资源而是通过geometryInternal成员保存GPU资源。\n *\n */\nexport class MarsGeometry implements Geometry {\n\n renderer?: MarsRenderer;\n\n // JS端记录数据,用于flush\n _buffers: { [key: string]: GPUBufferOptions };\n\n // 用于创建internal geometry\n _attributes: Record<string, AttributeWithType>;\n\n _attributesReleasable: { [key: string]: boolean };\n\n _attributesName: string[] = [];\n\n // 记录SubData的变更范围\n _dirtyFlags: { [key: string]: BufferDirtyFlag };\n\n _index?: Uint16Array | Uint32Array;\n _indexReleasable = false;\n\n // 与底层图形相关的Geometry对象\n readonly internal!: GLGeometry;\n\n readonly options?: GeometryOptions;\n\n readonly name: string;\n protected _drawCount: number;\n protected _drawStart: number;\n protected _mode: number;\n protected _isDestroyed = false;\n\n indexDataType: Geometry['indexDataType'];\n\n get isDestroyed (): boolean {\n return this._isDestroyed;\n }\n\n get mode (): number {\n return this._mode;\n }\n\n set mode (n: number) {\n this._mode = n;\n if (this.internal) {\n this.internal.mode = n;\n }\n }\n\n get attributes (): Immutable<{ [key: string]: Attribute }> {\n return this._attributes;\n }\n\n get drawCount (): number {\n return this._drawCount;\n }\n\n set drawCount (n: number | undefined) {\n this._drawCount = +(n as number);\n if (this.internal) {\n this.internal.drawCount = +(n as number);\n }\n }\n\n get drawStart () {\n return this._drawStart;\n }\n\n set drawStart (n: number) {\n this._drawStart = n;\n if (this.internal) {\n this.internal.drawStart = n;\n }\n }\n\n constructor (option: GeometryOptions) {\n this._drawStart = option.drawStart ? option.drawStart : 0;\n this._drawCount = isNaN(+(option.drawCount as number)) ? NaN : (option.drawCount as number);\n this._mode = (isNaN(option.mode as number) ? constants.TRIANGLES : option.mode) as number;\n this.name = option.name || ('MarsGeometry:' + seed++);\n const usage = option.bufferUsage || constants.STATIC_DRAW;\n\n this.options = option;\n // 记录顶点属性,需要与Shader中attribute进行关联\n const buffers: { [key: string]: GPUBufferOptions } = {};\n const attributesName: string[] = [];\n const attributes: { [key: string]: AttributeWithType } = {};\n // key为buffer的名字\n const dirtyFlags: { [key: string]: BufferDirtyFlag } = {};\n const attributesReleasable: { [key: string]: boolean } = {};\n\n forEach(option.attributes, function (attr, name) {\n let data = (attr as AttributeWithData).data;\n const type = attr.type || constants.FLOAT;\n const releasable = (attr as AttributeWithData).releasable;\n\n if (type && !(attr as AttributeWithType).dataSource && !data) {\n data = emptyTypedArrayByGLType(type);\n }\n if (data) {\n // 使用AttributeWithData构造的attribute\n buffers[name] = {\n data, usage, name,\n };\n const gltype = attributeData2GLType(data);\n\n attributes[name] = {\n size: attr.size,\n stride: attr.stride,\n offset: attr.offset,\n type: type || gltype,\n normalize: !!attr.normalize,\n dataSource: (name),\n instanceDivisor:attr.instanceDivisor,\n };\n attributesReleasable[name] = releasable || false;\n dirtyFlags[name] = {\n dirty: true,\n discard: true,\n start: Number.POSITIVE_INFINITY,\n end: 0,\n };\n } else {\n // 使用AttributeWithType构造的attribute\n const datasource = (attr as AttributeWithType).dataSource;\n\n if (datasource) {\n // 属性共享buffer\n attributes[name] = {\n size: attr.size,\n stride: attr.stride,\n offset: attr.offset,\n type: type,\n dataSource: datasource,\n normalize: !!attr.normalize,\n };\n }\n }\n attributesName.push(name);\n });\n\n // 顶点索引\n this._index = option.index?.data;\n if ((this._index as any) instanceof Uint8Array) {\n throw Error('Uint8 Index not support');\n }\n dirtyFlags['index'] = {\n dirty: true,\n discard: true,\n start: Number.POSITIVE_INFINITY,\n end: 0,\n };\n\n this._indexReleasable = option.index?.releasable === true;\n\n this._buffers = buffers;\n this._attributes = attributes;\n this._attributesName = attributesName;\n this._attributesReleasable = attributesReleasable;\n this._dirtyFlags = dirtyFlags;\n }\n\n destroy (): void {\n this.drawStart = 0;\n this.drawCount = NaN;\n // @ts-expect-error destroyed set null\n this._buffers = undefined;\n\n // @ts-expect-error destroyed set null\n this.options = undefined;\n\n this._attributes = {};\n this._attributesName = [];\n\n if (this.internal) {\n this.internal.destroy();\n // @ts-expect-error destroyed set null\n this['internal'] = undefined;\n this.renderer = undefined;\n }\n this.assignRenderer = throwDestroyedError as unknown as (r: MarsRenderer) => MarsGeometry;\n this._isDestroyed = true;\n }\n\n // 出入GPUBuffer对象,\n setAttributeBuffer (name: string, buffer: GPUBuffer): void {\n if (this.internal == undefined) { return; }\n const gpuBuffers = this.internal._buffersMap;\n const gpuBufferName = this._attributes[name].dataSource;\n\n if (gpuBuffers[gpuBufferName]) {\n gpuBuffers[gpuBufferName] = buffer as GLGPUBuffer;\n } else {\n // to do\n }\n }\n\n getAttributeBuffer (name: string): GPUBuffer | undefined {\n if (this.internal == undefined) { return undefined; }\n const gpuBuffers = this.internal._buffersMap;\n const gpuBufferName = this._attributes[name].dataSource;\n\n return gpuBuffers[gpuBufferName];\n }\n\n setAttributeData (name: string, data: TypedArray): void {\n const buffers = this._buffers;\n\n if (buffers == undefined) { return; }\n\n const gpuBufferOption = getAttributeBufferOption(this, name);\n const gpuBufferName = this._attributes[name].dataSource;\n\n if (gpuBufferOption) {\n const option: GPUBufferOptions = {\n data: data,\n usage: gpuBufferOption.usage,\n target: gpuBufferOption.target,\n };\n\n buffers[gpuBufferName] = option;\n this._dirtyFlags[gpuBufferName].discard = true;\n this._dirtyFlags[gpuBufferName].dirty = true;\n }\n }\n\n getAttributeData (name: string): TypedArray | undefined {\n const buffers = this._buffers;\n\n if (buffers == undefined) { return; }\n\n const gpuBufferOption = getAttributeBufferOption(this, name);\n\n if (gpuBufferOption) {\n return gpuBufferOption.data;\n }\n\n return undefined;\n }\n\n setAttributeSubData (name: string, offset: number, data: TypedArray): void {\n const buffers = this._buffers;\n\n if (buffers == undefined) { return; }\n\n const gpuBufferOption = getAttributeBufferOption(this, name);\n\n if (gpuBufferOption) {\n const attribute = gpuBufferOption;\n\n if (attribute.data != undefined) {\n const start = offset;\n const length = offset + data.length;\n\n // this._dirtyFlags[name].discard = false;\n if (attribute.data.length < length) {\n // @ts-expect-error safe to use\n const newData = new data.constructor(length);\n\n newData.set(attribute.data);\n attribute.data = newData;\n this._dirtyFlags[name].discard = true;\n } else if (!this._dirtyFlags[name].discard) {\n const dirtyFlag = this._dirtyFlags[name];\n\n dirtyFlag.start = Math.min(dirtyFlag.start as number, start);\n dirtyFlag.end = Math.max(dirtyFlag.end as number, length - 1);\n }\n (attribute.data as TypedArray).set(data, start);\n this._dirtyFlags[name].dirty = true;\n }\n } else {\n // to do\n }\n }\n\n getIndexData (): Uint16Array | Uint32Array | undefined {\n return this._index;\n }\n\n setIndexData (data: Uint16Array | Uint32Array | undefined): void {\n if (isIndexDataType(data)) {\n this._index = data as any;\n this._dirtyFlags['index'].discard = true;\n this._dirtyFlags['index'].dirty = true;\n }\n }\n\n setIndexSubData (offset: number, data: TypedArray): void {\n if (this._index) {\n // this._dirtyFlags['index'].discard = false;\n const start = offset;\n const length = offset + data.length;\n\n if (this._index.length < length) {\n // @ts-expect-error safe to use\n const newData = new data.constructor(end);\n\n newData.set(this._index);\n this._index = newData;\n this._dirtyFlags['index'].discard = true;\n } else if (!this._dirtyFlags['index'].discard) {\n const dirtyFlag = this._dirtyFlags['index'];\n\n dirtyFlag.start = Math.min(dirtyFlag.start as number, start);\n dirtyFlag.end = Math.max(dirtyFlag.end as number, length - 1);\n }\n this._index?.set(data, start);\n this._dirtyFlags['index'].dirty = true;\n }\n }\n\n getAttributeStride (name: string): number {\n const attr = this._attributes[name];\n\n if (attr.stride) {\n return attr.stride;\n }\n\n return attr.size * BYTES_TYPE_MAP[attr.type];\n }\n\n getAttributeDataLength (name: string): number {\n if (this._buffers) {\n const gpuBufferOption = getAttributeBufferOption(this, name);\n\n if (gpuBufferOption) {\n return gpuBufferOption.data?.length as number;\n }\n }\n\n return 0;\n }\n\n getAttributeNames (): string[] {\n return this._attributesName;\n }\n\n assignRenderer (renderer: MarsRenderer): MarsGeometry {\n if (!this.internal) {\n // 索引缓冲区参数\n let indexBufferOption: GPUBufferOptions | undefined = undefined;\n\n if (this._index) {\n const data = this._index;\n\n indexBufferOption = {\n data: data,\n usage: constants.STATIC_DRAW,\n };\n if (data instanceof Uint16Array) {\n this.indexDataType = constants.UNSIGNED_SHORT;\n } else if (data instanceof Uint32Array) {\n this.indexDataType = constants.UNSIGNED_INT;\n }\n }\n\n // 顶点属性参数\n const options = {\n drawStart: this.drawStart,\n drawCount: this.drawCount,\n // 传给GLGeometry用于绑定顶点属性\n attributes: this._attributes,\n buffers: this._buffers,\n mode: this.mode,\n index: indexBufferOption,\n indexDataType:this.indexDataType,\n name: this.name,\n };\n\n //@ts-expect-error safe to set\n this['internal'] = new GLGeometry(options, renderer.internal);\n this.renderer = renderer;\n this.flush();\n //@ts-expect-error safe to set\n this.options = undefined;\n }\n\n return this;\n }\n\n flush (): boolean {\n const internal = this.internal;\n\n if (internal) {\n const attributes = this._attributes;\n const attributesBuffer = this._buffers;\n const indexBuffer = this._index;\n\n forEach(this._dirtyFlags, function (flag, name) {\n let gpuBuffer;\n let data;\n\n if (name == 'index') {\n gpuBuffer = internal._indexBuffer;\n data = indexBuffer;\n } else {\n const bufferName = attributes[name].dataSource;\n\n gpuBuffer = internal.getGPUBuffer(bufferName) as GLGPUBuffer;\n data = attributesBuffer[bufferName].data;\n }\n\n if ((flag.dirty || flag.discard) && gpuBuffer && data) {\n if (flag.discard) {\n gpuBuffer.bufferData(data);\n } else {\n const offset = (flag.start as number) * data.BYTES_PER_ELEMENT + data.byteOffset;\n const length = (flag.end as number) - (flag.start as number) + 1;\n // @ts-expect-error safe to use\n const subData = new data.constructor(data.buffer, offset, length);\n\n gpuBuffer.bufferSubData(flag.start as number, subData);\n }\n flag.start = Number.POSITIVE_INFINITY;\n flag.end = 0;\n flag.dirty = flag.discard = false;\n }\n });\n\n // 需要释放的attributes数据\n forEach(this._attributesReleasable, function (releasable, name) {\n const bufferName = attributes[name].dataSource;\n\n if (attributesBuffer[bufferName] && releasable) {\n attributesBuffer[bufferName].data = undefined;\n }\n });\n\n // 释放indexbuffer\n if (this._indexReleasable) {\n this._index = undefined;\n }\n }\n\n return false;\n }\n}\n","import type {\n GeometriesMeshOptions, GeometryMeshOptions, InstancedMeshOptions, Mesh, MeshDestroyOptions, MeshOptions,\n} from '../../types/Mesh';\nimport { MarsMaterial } from './MarsMaterial';\nimport { MarsGeometry } from './MarsGeometry';\nimport type { GeometryOptions } from '../../types/Geometry';\nimport type { Material, MaterialDestroyOptions, MaterialOptions } from '../../types/Material';\nimport type { MarsRenderer } from './MarsRenderer';\nimport { DestroyOptions } from '../../types/constants';\nimport { consoleError } from '../common/console';\nimport { throwDestroyedError } from '../common/utils';\nimport type { InstancedMesh } from '../../types/Mesh';\n\nlet seed = 1;\n\nexport class MarsMesh implements Mesh {\n\n readonly material: MarsMaterial;\n\n readonly geometries: MarsGeometry[];\n\n readonly name: string;\n\n public priority: number;\n\n public hide: boolean;\n\n public renderer?: MarsRenderer;\n\n private _isDestroyed = false;\n\n get isDestroyed (): boolean {\n return this._isDestroyed;\n }\n\n get geometry () {\n return this.geometries[0];\n }\n\n constructor (options: MeshOptions, renderer?: MarsRenderer) {\n this.material = options.material instanceof MarsMaterial ? options.material : new MarsMaterial(options.material as MaterialOptions);\n const geo = (options as GeometryMeshOptions).geometry;\n\n if (geo) {\n this.geometries = [geo instanceof MarsGeometry ? geo : new MarsGeometry(geo as GeometryOptions)];\n } else if ((options as GeometriesMeshOptions).geometries) {\n this.geometries = (options as GeometriesMeshOptions).geometries.map(geo => geo instanceof MarsGeometry ? geo : new MarsGeometry(geo as GeometryOptions));\n } else {\n this.geometries = [];\n }\n this.name = options.name || ('MarsMesh_' + seed++);\n this.priority = options.priority || 0;\n this.hide = false;\n if (renderer) {\n this.assignRenderer(renderer);\n }\n }\n\n setMaterial (mtl: Material | MaterialOptions, destroyMtl?: MaterialDestroyOptions | DestroyOptions.keep) {\n if (destroyMtl !== DestroyOptions.keep) {\n this.material.destroy(destroyMtl);\n }\n //@ts-expect-error set from internal safely\n this.material = mtl instanceof MarsMaterial ? mtl : new MarsMaterial(mtl as MaterialOptions);\n if (this.renderer) {\n this.material.assignRenderer(this.renderer);\n }\n }\n\n setGeometries (geos: MarsGeometry[], destroyGeometries?: DestroyOptions) {\n const arr = this.geometries;\n\n if (destroyGeometries !== DestroyOptions.keep) {\n arr.forEach(g => g.destroy());\n }\n arr.length = 0;\n const r = this.renderer;\n\n geos.forEach(g => {\n if (r) {\n g.assignRenderer(r);\n }\n arr.push(g);\n });\n }\n\n destroy (options?: MeshDestroyOptions) {\n if (this._isDestroyed) {\n consoleError('call mesh.destroy multiple times', this);\n }\n if (options?.geometries !== DestroyOptions.keep) {\n this.geometries.forEach(element => {\n element.destroy();\n });\n }\n this.geometries.length = 0;\n const materialDestroyOption = options?.material;\n\n if (materialDestroyOption !== DestroyOptions.keep && this.material) {\n this.material.destroy(materialDestroyOption);\n // @ts-expect-error safe to assign\n this['material'] = undefined;\n }\n this.assignRenderer = throwDestroyedError as unknown as (r: MarsRenderer) => MarsMesh;\n this._isDestroyed = true;\n }\n\n assignRenderer (renderer: MarsRenderer): MarsMesh {\n this.geometries.forEach(element => {\n element.assignRenderer(renderer);\n });\n\n if (!this.material.materialInternal) {\n this.material.assignRenderer(renderer);\n }\n this.renderer = renderer;\n\n return this;\n }\n}\n\nexport class MarsInstancedMesh extends MarsMesh implements InstancedMesh {\n instanceCount: number;\n constructor (options: InstancedMeshOptions, renderer?: MarsRenderer) {\n super(options, renderer);\n this.instanceCount = options.instanceCount;\n }\n}\n","import type {\n RendererExtensions, RenderPass, RenderState, SharedShaderWithSource, Texture,\n} from '../../types';\nimport {\n TextureLoadAction, TextureSourceType,\n} from '../../types';\nimport type { MarsTexture } from './MarsTexture';\nimport type { MarsRenderer } from './MarsRenderer';\nimport { MarsRenderPass } from './MarsRenderPass';\nimport type { GLFrameBuffer } from '../webgl/GLFrameBuffer';\nimport type { GLTexture } from '../webgl/GLTexture';\nimport { RenderFrameInternal } from './RenderFrameInternal';\nimport { constants } from '../webgl/constants';\nimport { MarsMesh } from './MarsMesh';\n\nconst copyShaderId = '$mri-internal-copy';\n\nexport class MarsExtWrap implements RendererExtensions {\n _copyRenderPass?: MarsRenderPass;\n renderer?: MarsRenderer;\n\n constructor (renderer: MarsRenderer) {\n this.renderer = renderer;\n if (renderer?.gpu.level === 1) {\n this._copyRenderPass = this._createCopyRenderPass().assignRenderer(renderer);\n const shader = this._copyRenderPass.meshes[0].material.options.shader;\n\n renderer.shaderLibrary.addShader(shader as SharedShaderWithSource);\n renderer.shaderLibrary.compileShader(copyShaderId);\n }\n }\n\n resetColorAttachments (rp: RenderPass, colorTextures: Texture[]) {\n const r = this.renderer;\n\n if (r) {\n (rp as MarsRenderPass).resetColorAttachments(colorTextures as MarsTexture[]);\n }\n }\n\n copyTexture (source: Texture, tex: Texture): void {\n const renderer = this.renderer;\n\n if (renderer) {\n source.assignRenderer(renderer);\n tex.assignRenderer(renderer);\n tex.updateSource({\n sourceType: TextureSourceType.framebuffer,\n data: {\n width: tex.width || source.width,\n height: tex.height || source.height,\n },\n });\n if (renderer.gpu.level === 2) {\n this.copy2(source as MarsTexture, tex as MarsTexture);\n } else {\n this.copy1(source as MarsTexture, tex as MarsTexture);\n }\n }\n\n }\n\n copy2 (source: MarsTexture, target: MarsTexture) {\n this.renderer?.internal.copy2(source.internal as GLTexture, target.internal as GLTexture);\n }\n\n copy1 (source: MarsTexture, target: MarsTexture) {\n const rp = this._copyRenderPass;\n\n if (rp) {\n const renderer = this.renderer;\n\n if (renderer) {\n const fb = rp.frameBuffer as GLFrameBuffer;\n\n fb.viewport[2] = target.width || source.width;\n fb.viewport[3] = target.height || source.height;\n renderer.internal.resetColorAttachments(fb, [target.internal as GLTexture]);\n const mesh = rp.meshes[0];\n\n mesh.material.defaultDataBlock.setUniformTexture('uTex', source);\n RenderFrameInternal.renderRenderPass(renderer, rp, { currentFrame: {} } as RenderState);\n }\n }\n }\n\n _createCopyRenderPass (): MarsRenderPass {\n const name = 'mri-copy-mesh';\n\n return new MarsRenderPass({\n name: 'mri-copy-rp',\n loadAction: {\n colorAction: TextureLoadAction.whatever,\n },\n attachments: [{ texture: { format: constants.RGBA } }],\n meshes: [new MarsMesh({\n name,\n priority: 0,\n geometry: {\n name,\n mode: constants.TRIANGLE_STRIP,\n attributes: {\n aPos: {\n type: constants.FLOAT,\n size: 2,\n data: new Float32Array([-1, 1, -1, -1, 1, 1, 1, -1]),\n },\n },\n drawCount: 4,\n },\n material: {\n states: {\n depthTest: false,\n cullFaceEnabled: false,\n stencilTest: false,\n },\n name,\n shader: {\n cacheId: copyShaderId,\n name,\n vertex: `precision highp float;\n attribute vec2 aPos;varying vec2 vTex;\n void main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.))/2.;\n }\n `,\n fragment: ` precision highp float;\n varying vec2 vTex;\n uniform sampler2D uTex;\n void main(){gl_FragColor = texture2D(uTex,vTex);}\n `,\n },\n },\n })],\n });\n }\n\n destroy () {\n if (this.renderer) {\n this._copyRenderPass?.meshes[0].material.defaultDataBlock.setUniformValue('uTex', undefined);\n this._copyRenderPass?.destroy();\n this.renderer = undefined;\n }\n }\n}\n","import type {\n GPUBuffer,\n GPUBufferOptions,\n GPUCapability,\n GPURenderer,\n RendererOptions,\n RenderFrameOptions,\n ShaderLibrary,\n} from '../../types';\nimport { GPUCapabilityEmpty } from '../../types/GPUCapability';\nimport { ShaderLibraryEmpty } from '../../types/ShaderLibrary';\nimport { GLGPURenderer } from '../webgl/GLGPURenderer';\nimport { GLGPUBuffer } from '../webgl/GLGPUBuffer';\nimport { MarsRenderFrame } from './MarsRenderFrame';\nimport { getDefaultGPUCapability } from './MarsGPUCapability';\nimport { GLGPUCapability } from '../webgl/GLGPUCapability';\nimport type { Canvas } from '../../types/Canvas';\nimport { CanvasEmpty } from '../../types/Canvas';\nimport { MarsExtWrap } from './MarsExtWrap';\nimport { consoleError } from '../common/console';\n\nconst ERR_EXP = 'WebGL not available';\n\nexport class MarsRenderer implements GPURenderer {\n readonly gpu: GPUCapability;\n readonly shaderLibrary: ShaderLibrary;\n readonly internal!: GLGPURenderer;\n readonly canvas!: Canvas;\n readonly extension: MarsExtWrap;\n\n get isDestroyed () {\n const internal = this.internal;\n\n return internal ? internal.isDestroyed : true;\n }\n\n get height () {\n return this.internal?.height || 0;\n }\n\n get width () {\n return this.internal?.width || 0;\n }\n\n constructor (options: RendererOptions) {\n let gl: WebGLRenderingContext | WebGL2RenderingContext = options.gl as WebGLRenderingContext | WebGL2RenderingContext;\n\n if (!gl) {\n const webglOptions = {\n preserveDrawingBuffer: options.willCaptureImage,\n alpha: true,\n stencil: true,\n antialias: true,\n depth: true,\n premultipliedAlpha: true,\n };\n const canvas = options.canvas;\n\n if (canvas) {\n const frameworks = options.frameworks || [getDefaultGPUCapability().type as 'webgl'];\n\n for (let i = 0; i < frameworks.length; i++) {\n gl = canvas?.getContext(frameworks[i], webglOptions) as WebGLRenderingContext;\n if (gl) {\n break;\n }\n }\n }\n }\n if (gl) {\n this.gpu = new GLGPUCapability({ gl });\n this.internal = new GLGPURenderer(gl);\n this.shaderLibrary = this.internal.shaderLibrary;\n this.canvas = gl.canvas;\n } else {\n this.gpu = new GPUCapabilityEmpty();\n this.shaderLibrary = new ShaderLibraryEmpty();\n this.canvas = new CanvasEmpty();\n consoleError(ERR_EXP);\n }\n this.extension = new MarsExtWrap(this);\n }\n\n createBuffer (options: GPUBufferOptions): GPUBuffer {\n const internal = this.internal;\n\n if (!internal) {\n throw Error(ERR_EXP);\n }\n\n return new GLGPUBuffer(options, internal);\n }\n\n createRenderFrame (options?: RenderFrameOptions): MarsRenderFrame {\n return new MarsRenderFrame(options || {}, this);\n }\n\n destroy (haltGL?: boolean): void {\n this.extension.destroy();\n this.internal?.destroy(haltGL);\n // @ts-expect-error safe to assign\n this.gpu = new GPUCapabilityEmpty();\n // @ts-expect-error safe to assign\n this.shaderLibrary = new ShaderLibraryEmpty();\n }\n\n resize (width: number, height: number): void {\n const internal = this.internal;\n\n if (internal) {\n if (this.width !== width || this.height !== height) {\n internal.resize(width, height);\n }\n }\n }\n\n cancelAnimationFrame (id: number): void {\n return window.cancelAnimationFrame(id);\n }\n\n getErrors (): string[] {\n const gl = this.internal.gl;\n const err = gl.getError();\n\n if (err) {\n return ['webgl error:' + err];\n }\n\n return [];\n }\n\n invalid () {\n }\n\n requestAnimationFrame (cb: FrameRequestCallback): number {\n return window.requestAnimationFrame(cb);\n }\n}\n","import { MarsGeometry } from './MarsGeometry';\nimport type { GeometryOptions, SharedGeometry, SharedGeometryOptions } from '../../types';\nimport { GLGeometry } from '../webgl/GLGeometry';\nimport type { MarsRenderer } from './MarsRenderer';\nimport { forEach } from '../common/utils';\n\nexport class MarsSharedGeometry extends MarsGeometry implements SharedGeometry {\n private readonly _source: MarsGeometry;\n\n renderer!: MarsRenderer;\n\n constructor (opt: SharedGeometryOptions, renderer?: MarsRenderer) {\n super(Object.assign({ attributes: {} }, opt) as GeometryOptions);\n let indexData = opt.index ? opt.index.data : opt.geometry.getIndexData();\n\n if (indexData) {\n //@ts-expect-error safe to assign\n indexData = new indexData.constructor(indexData) as Uint16Array;\n }\n this._index = indexData;\n this._source = opt.geometry as MarsGeometry;\n this._drawCount = opt.drawCount || 0;\n this._drawStart = opt.drawStart || 0;\n this._mode = opt.mode || 0;\n forEach(this._source._attributes, (attr, name) => {\n this._attributes[name] = Object.assign({}, attr);\n });\n if (renderer) {\n this.assignRenderer(renderer);\n }\n }\n\n assignRenderer (renderer: MarsRenderer): MarsSharedGeometry {\n if (!this.renderer) {\n const geometry = this._source;\n\n geometry.assignRenderer(renderer);\n const internal = geometry.internal;\n const glgeo = new GLGeometry(internal, renderer.internal);\n\n glgeo.drawCount = this.drawCount;\n glgeo.drawStart = this.drawStart;\n glgeo.mode = this.mode;\n if (this._index) {\n const ret = glgeo.createIndexBuffer(this._index, renderer.internal);\n\n glgeo.setIndexBuffer(ret[0], ret[1]);\n }\n //@ts-expect-error safe to assign\n this.internal = glgeo;\n this.renderer = geometry.renderer as MarsRenderer;\n }\n\n return this;\n }\n\n getAttributeNames (): string[] {\n return this._source.getAttributeNames();\n }\n\n getAttributeDataLength (name: string): number {\n if (this._buffers[name]) {\n return super.getAttributeDataLength(name);\n }\n\n return this._source.getAttributeDataLength(name);\n }\n\n flush (): boolean {\n this._source.flush();\n\n return super.flush();\n }\n\n destroy () {\n if (this.internal) {\n //@ts-expect-error safe to assign\n this.internal.vaoMap = {};\n }\n super.destroy();\n }\n\n}\n","import { consoleLog } from './common/console';\n\nexport * from '../types/constants';\nexport * from '../types/RenderPass';\nexport * from '../types/Texture';\nexport * from '../types/GPUBuffer';\nexport { constants } from './webgl/constants';\nexport * from '../types/ShaderLibrary';\nexport { MarsRenderFrame as RenderFrame } from './render/MarsRenderFrame';\nexport { MarsRenderer as Renderer } from './render/MarsRenderer';\nexport { MarsMesh as Mesh, MarsInstancedMesh as InstancedMesh } from './render/MarsMesh';\nexport { MarsGeometry as Geometry } from './render/MarsGeometry';\nexport { MarsRenderPass as RenderPass } from './render/MarsRenderPass';\nexport { MarsTexture as Texture } from './render/MarsTexture';\nexport { MarsMaterial as Material } from './render/MarsMaterial';\nexport { MarsMaterialDataBlock as MaterialDataBlock } from './render/MarsMaterialDataBlock';\nexport { MarsSharedGeometry as SharedGeometry } from './render/MarsSharedGeometry';\nexport { getDefaultGPUCapability } from './render/MarsGPUCapability';\nexport { getDefaultTextureFactory, setDefaultTextureFactory, MarsTextureFactory } from './render/MarsTextureFactory';\n\nconsoleLog('version: ' + __VERSION__);\n\nexport const ModuleMsg = 'RI Package: @predy-js/render-interface';\n","import * as RI from './module';\nexport * from './module';\n\nif (typeof window === 'object') {\n (window as any).PredyRI = RI;\n} else if (typeof global === 'object') {\n (global as any).PredyRI = RI;\n}\n"],"names":["DestroyOptions","RenderPassDestroyAttachmentType","TextureLoadAction","TextureStoreAction","RenderPassAttachmentStorageType","RenderPassMeshOrder","TextureSourceType","_a","_b","ShaderCompileResultStatus","imageBitMapAvailable","g","seed"],"mappings":";;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC,EAAE;AACnC,IAAI,aAAa,GAAG,MAAM,CAAC,cAAc;AACzC,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,KAAK,IAAI,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC;AACpF,QAAQ,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC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