@vunk/plus 1.6.8 → 1.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/SendOutlined.mjs +8 -6
- package/components/SharedSystems.mjs +290 -72
- package/components/WebGLRenderer.mjs +32 -20
- package/components/WebGPURenderer.mjs +48 -10
- package/components/agent-chat-provider/index.d.ts +7 -0
- package/components/agent-chat-provider/index.mjs +6 -3
- package/components/agent-chat-provider/src/api.d.ts +3 -0
- package/components/agent-chat-provider/src/const-roles.d.ts +8 -0
- package/components/agent-chat-provider/src/const.d.ts +1 -0
- package/components/agent-chat-provider/src/index.vue.d.ts +22 -0
- package/components/agent-chat-provider/src/types.d.ts +50 -0
- package/components/agent-chat-provider/src/use.d.ts +5 -0
- package/components/avatar/index.d.ts +4 -0
- package/components/avatar/index.mjs +2 -2
- package/components/avatar/src/ctx.d.ts +6 -0
- package/components/avatar/src/index.vue.d.ts +180 -0
- package/components/avatar/src/types.d.ts +1 -0
- package/components/broadcasting-markdown/index.d.ts +7 -0
- package/components/broadcasting-markdown/index.mjs +78 -158
- package/components/broadcasting-markdown/src/const.d.ts +13 -0
- package/components/broadcasting-markdown/src/ctx.d.ts +129 -0
- package/components/broadcasting-markdown/src/howler-speech.vue.d.ts +104 -0
- package/components/broadcasting-markdown/src/index.vue.d.ts +439 -0
- package/components/broadcasting-markdown/src/paragraph.vue.d.ts +79 -0
- package/components/broadcasting-markdown/src/speech-error.vue.d.ts +67 -0
- package/components/broadcasting-markdown/src/types.d.ts +26 -0
- package/components/broadcasting-markdown/src/use.d.ts +21 -0
- package/components/browserAll.mjs +333 -562
- package/components/bubble-list/index.d.ts +5 -0
- package/components/bubble-list/index.mjs +91 -72
- package/components/bubble-list/src/ctx.d.ts +32 -0
- package/components/bubble-list/src/index.vue.d.ts +810 -0
- package/components/bubble-list/src/types.d.ts +4 -0
- package/components/bubble-templates/index.d.ts +4 -0
- package/components/bubble-templates/index.mjs +83 -68
- package/components/bubble-templates/src/index.vue.d.ts +595 -0
- package/components/bubble-templates/src/types.d.ts +40 -0
- package/components/chat-independent/index.d.ts +4 -0
- package/components/chat-independent/index.mjs +136 -115
- package/components/chat-independent/src/const.d.ts +13 -0
- package/components/chat-independent/src/ctx.d.ts +21 -0
- package/components/chat-independent/src/index.vue.d.ts +2429 -0
- package/components/chat-independent/src/types.d.ts +13 -0
- package/components/colorToUniform.mjs +2 -0
- package/components/index.d.ts +0 -0
- package/components/index2.mjs +11896 -8381
- package/components/init.mjs +1724 -998
- package/components/lottie-animation/index.d.ts +4 -0
- package/components/lottie-animation/index.mjs +2 -2
- package/components/lottie-animation/src/ctx.d.ts +10 -0
- package/components/lottie-animation/src/index.vue.d.ts +21 -0
- package/components/lottie-animation/src/types.d.ts +4 -0
- package/components/metahuman-broadcasting/index.d.ts +5 -0
- package/components/metahuman-broadcasting/index.mjs +57 -40
- package/components/metahuman-broadcasting/src/ctx.d.ts +57 -0
- package/components/metahuman-broadcasting/src/index.vue.d.ts +885 -0
- package/components/metahuman-broadcasting/src/types.d.ts +1 -0
- package/components/monaco-editor/index.d.ts +5 -0
- package/components/monaco-editor/index.mjs +2 -2
- package/components/monaco-editor/src/ctx.d.ts +23 -0
- package/components/monaco-editor/src/index.vue.d.ts +40 -0
- package/components/monaco-editor/src/types.d.ts +1 -0
- package/components/monaco-environment/index.d.ts +4 -0
- package/components/monaco-environment/index.mjs +1 -1
- package/components/monaco-environment/src/ctx.d.ts +8 -0
- package/components/monaco-environment/src/index.vue.d.ts +2 -0
- package/components/monaco-environment/src/types.d.ts +1 -0
- package/components/pixi-frame/index.d.ts +11 -0
- package/components/pixi-frame/index.mjs +2 -2
- package/components/pixi-frame/src/apng.vue.d.ts +161 -0
- package/components/pixi-frame/src/bitmap.vue.d.ts +158 -0
- package/components/pixi-frame/src/core.vue.d.ts +173 -0
- package/components/pixi-frame/src/ctx.d.ts +55 -0
- package/components/pixi-frame/src/index.vue.d.ts +591 -0
- package/components/pixi-frame/src/provider.vue.d.ts +2 -0
- package/components/pixi-frame/src/types.d.ts +17 -0
- package/components/pixi-frame/src/use.d.ts +16 -0
- package/components/pixi-frame/src/useSprite.d.ts +12 -0
- package/components/pixi-frame/src/video.vue.d.ts +159 -0
- package/components/pixi-frame/src/view.vue.d.ts +29 -0
- package/components/recorder-button/index.d.ts +4 -0
- package/components/recorder-button/index.mjs +2 -2
- package/components/recorder-button/src/ctx.d.ts +41 -0
- package/components/recorder-button/src/index.vue.d.ts +333 -0
- package/components/recorder-button/src/speech-to-text.d.ts +1 -0
- package/components/recorder-button/src/types.d.ts +7 -0
- package/components/routes-menu-content/index.d.ts +4 -0
- package/components/routes-menu-content/index.mjs +5 -5
- package/components/routes-menu-content/src/ctx.d.ts +17 -0
- package/components/routes-menu-content/src/index.vue.d.ts +350 -0
- package/components/routes-menu-content/src/item/core/ctx.d.ts +18 -0
- package/components/routes-menu-content/src/item/core/index.vue.d.ts +185 -0
- package/components/routes-menu-content/src/item/ctx.d.ts +14 -0
- package/components/routes-menu-content/src/item/index.vue.d.ts +316 -0
- package/components/routes-menu-content/src/types.d.ts +1 -0
- package/components/sender/index.d.ts +4 -0
- package/components/sender/index.mjs +180 -86
- package/components/sender/src/SenderHeader.vue.d.ts +270 -0
- package/components/sender/src/ctx.d.ts +64 -0
- package/components/sender/src/index.vue.d.ts +779 -0
- package/components/sender/src/types.d.ts +1 -0
- package/components/speech-button/index.d.ts +4 -0
- package/components/speech-button/index.mjs +13 -6
- package/components/speech-button/src/LoadingIcon.vue.d.ts +2 -0
- package/components/speech-button/src/RecordingIcon.vue.d.ts +2 -0
- package/components/speech-button/src/ctx.d.ts +10 -0
- package/components/speech-button/src/index.vue.d.ts +22 -0
- package/components/speech-button/src/types.d.ts +1 -0
- package/components/table-columns/index.d.ts +5 -0
- package/components/table-columns/index.mjs +6 -3
- package/components/table-columns/src/ctx.d.ts +59 -0
- package/components/table-columns/src/el-ctx.d.ts +57 -0
- package/components/table-columns/src/index.vue.d.ts +266 -0
- package/components/table-columns/src/types.d.ts +21 -0
- package/components/tables-v1/index.d.ts +5 -0
- package/components/tables-v1/index.mjs +3 -3
- package/components/tables-v1/src/ctx.d.ts +280 -0
- package/components/tables-v1/src/el-ctx.d.ts +262 -0
- package/components/tables-v1/src/index.vue.d.ts +3054 -0
- package/components/tables-v1/src/types.d.ts +3 -0
- package/components/tables-v1-checkbox/index.d.ts +5 -0
- package/components/tables-v1-checkbox/index.mjs +33 -269
- package/components/tables-v1-checkbox/src/ctx.d.ts +313 -0
- package/components/tables-v1-checkbox/src/index.vue.d.ts +3831 -0
- package/components/tables-v1-checkbox/src/types.d.ts +1 -0
- package/components/text/index.d.ts +4 -0
- package/components/text/index.mjs +52 -42
- package/components/text/src/ctx.d.ts +341 -0
- package/components/text/src/index.vue.d.ts +4593 -0
- package/components/text/src/types.d.ts +1 -0
- package/components/typing-markdown/index.d.ts +4 -0
- package/components/typing-markdown/index.mjs +2 -2
- package/components/typing-markdown/src/core.d.ts +2 -0
- package/components/typing-markdown/src/ctx.d.ts +41 -0
- package/components/typing-markdown/src/index.vue.d.ts +75 -0
- package/components/typing-markdown/src/types.d.ts +1 -0
- package/components/vditor/index.d.ts +5 -0
- package/components/vditor/index.mjs +9 -5
- package/components/vditor/src/ctx.d.ts +38 -0
- package/components/vditor/src/handle-fullscreen.vue.d.ts +18 -0
- package/components/vditor/src/handle-value.vue.d.ts +18 -0
- package/components/vditor/src/index.vue.d.ts +143 -0
- package/components/vditor/src/types.d.ts +9 -0
- package/components/vditor/src/use.d.ts +4 -0
- package/components/webworkerAll.mjs +1 -1
- package/composables/el-breakpoints/index.d.ts +5 -5
- package/composables/recorder/index.mjs +191 -288
- package/icons/end/index.mjs +3 -3
- package/icons/end/src/avatar.d.ts +2 -11
- package/icons/end/src/icon.d.ts +2 -56
- package/icons/keyboard/index.mjs +3 -3
- package/icons/keyboard/src/avatar.d.ts +2 -11
- package/icons/keyboard/src/icon.d.ts +2 -56
- package/icons/start/index.mjs +3 -3
- package/icons/start/src/avatar.d.ts +2 -11
- package/icons/start/src/icon.d.ts +2 -56
- package/icons/voice/index.mjs +2 -2
- package/icons/voice/src/avatar.d.ts +2 -11
- package/icons/voice/src/icon.d.ts +2 -56
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { inject, ref,
|
|
1
|
+
import { inject, ref, getCurrentInstance, nextTick, h, reactive, defineComponent, createVNode } from 'vue';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Take input from [0, n] and return it as [0, 1]
|
|
@@ -1227,7 +1227,7 @@ Icon.getTwoToneColor = getTwoToneColor;
|
|
|
1227
1227
|
Icon.setTwoToneColor = setTwoToneColor;
|
|
1228
1228
|
|
|
1229
1229
|
// This icon file is generated automatically.
|
|
1230
|
-
var AudioMutedOutlined$
|
|
1230
|
+
var AudioMutedOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "defs", "attrs": {}, "children": [{ "tag": "style", "attrs": {} }] }, { "tag": "path", "attrs": { "d": "M682 455V311l-76 76v68c-.1 50.7-42 92.1-94 92a95.8 95.8 0 01-52-15l-54 55c29.1 22.4 65.9 36 106 36 93.8 0 170-75.1 170-168z" } }, { "tag": "path", "attrs": { "d": "M833 446h-60c-4.4 0-8 3.6-8 8 0 140.3-113.7 254-254 254-63 0-120.7-23-165-61l-54 54a334.01 334.01 0 00179 81v102H326c-13.9 0-24.9 14.3-25 32v36c.1 4.4 2.9 8 6 8h408c3.2 0 6-3.6 6-8v-36c0-17.7-11-32-25-32H547V782c165.3-17.9 294-157.9 294-328 0-4.4-3.6-8-8-8zm13.1-377.7l-43.5-41.9a8 8 0 00-11.2.1l-129 129C634.3 101.2 577 64 511 64c-93.9 0-170 75.3-170 168v224c0 6.7.4 13.3 1.2 19.8l-68 68A252.33 252.33 0 01258 454c-.2-4.4-3.8-8-8-8h-60c-4.4 0-8 3.6-8 8 0 53 12.5 103 34.6 147.4l-137 137a8.03 8.03 0 000 11.3l42.7 42.7c3.1 3.1 8.2 3.1 11.3 0L846.2 79.8l.1-.1c3.1-3.2 3-8.3-.2-11.4zM417 401V232c0-50.6 41.9-92 94-92 46 0 84.1 32.3 92.3 74.7L417 401z" } }] }, "name": "audio-muted", "theme": "outlined" };
|
|
1231
1231
|
|
|
1232
1232
|
function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$5(target, key, source[key]); }); } return target; }
|
|
1233
1233
|
|
|
@@ -1237,15 +1237,16 @@ var AudioMutedOutlined = function AudioMutedOutlined(props, context) {
|
|
|
1237
1237
|
var p = _objectSpread$5({}, props, context.attrs);
|
|
1238
1238
|
|
|
1239
1239
|
return createVNode(Icon, _objectSpread$5({}, p, {
|
|
1240
|
-
"icon": AudioMutedOutlined$
|
|
1240
|
+
"icon": AudioMutedOutlined$2
|
|
1241
1241
|
}), null);
|
|
1242
1242
|
};
|
|
1243
1243
|
|
|
1244
1244
|
AudioMutedOutlined.displayName = 'AudioMutedOutlined';
|
|
1245
1245
|
AudioMutedOutlined.inheritAttrs = false;
|
|
1246
|
+
var AudioMutedOutlined$1 = AudioMutedOutlined;
|
|
1246
1247
|
|
|
1247
1248
|
// This icon file is generated automatically.
|
|
1248
|
-
var AudioOutlined$
|
|
1249
|
+
var AudioOutlined$2 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M842 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 140.3-113.7 254-254 254S258 594.3 258 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 168.7 126.6 307.9 290 327.6V884H326.7c-13.7 0-24.7 14.3-24.7 32v36c0 4.4 2.8 8 6.2 8h407.6c3.4 0 6.2-3.6 6.2-8v-36c0-17.7-11-32-24.7-32H548V782.1c165.3-18 294-158 294-328.1zM512 624c93.9 0 170-75.2 170-168V232c0-92.8-76.1-168-170-168s-170 75.2-170 168v224c0 92.8 76.1 168 170 168zm-94-392c0-50.6 41.9-92 94-92s94 41.4 94 92v224c0 50.6-41.9 92-94 92s-94-41.4-94-92V232z" } }] }, "name": "audio", "theme": "outlined" };
|
|
1249
1250
|
|
|
1250
1251
|
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty$4(target, key, source[key]); }); } return target; }
|
|
1251
1252
|
|
|
@@ -1255,12 +1256,13 @@ var AudioOutlined = function AudioOutlined(props, context) {
|
|
|
1255
1256
|
var p = _objectSpread$4({}, props, context.attrs);
|
|
1256
1257
|
|
|
1257
1258
|
return createVNode(Icon, _objectSpread$4({}, p, {
|
|
1258
|
-
"icon": AudioOutlined$
|
|
1259
|
+
"icon": AudioOutlined$2
|
|
1259
1260
|
}), null);
|
|
1260
1261
|
};
|
|
1261
1262
|
|
|
1262
1263
|
AudioOutlined.displayName = 'AudioOutlined';
|
|
1263
1264
|
AudioOutlined.inheritAttrs = false;
|
|
1265
|
+
var AudioOutlined$1 = AudioOutlined;
|
|
1264
1266
|
|
|
1265
1267
|
// This icon file is generated automatically.
|
|
1266
1268
|
var CloseOutlined$1 = { "icon": { "tag": "svg", "attrs": { "fill-rule": "evenodd", "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z" } }] }, "name": "close", "theme": "outlined" };
|
|
@@ -1334,4 +1336,4 @@ var SendOutlined = function SendOutlined(props, context) {
|
|
|
1334
1336
|
SendOutlined.displayName = 'SendOutlined';
|
|
1335
1337
|
SendOutlined.inheritAttrs = false;
|
|
1336
1338
|
|
|
1337
|
-
export { AudioMutedOutlined as A, CloseOutlined as C, LinkOutlined as L, SendOutlined as S, CloudUploadOutlined as a, AudioOutlined as b };
|
|
1339
|
+
export { AudioMutedOutlined$1 as A, CloseOutlined as C, LinkOutlined as L, SendOutlined as S, CloudUploadOutlined as a, AudioOutlined$1 as b };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { q as Shader, G as GpuProgram, t as GlProgram, u as TextureMatrix, k as UniformGroup, M as Matrix, E as ExtensionType, e as extensions, v as DefaultBatcher, x as BigPool, y as getGlobalBounds, z as TexturePool, R as RendererType, F as Bounds, H as FilterEffect, I as Sprite, s as Texture, S as STENCIL_MODES, h as CLEAR, w as warn, J as getAttributeInfoFromFormat, K as unsafeEvalSupported, b as Buffer, B as BufferUsage, i as CanvasSource, L as uid$1, j as TextureSource, N as Rectangle, O as SystemRunner, a as EventEmitter, C as Container, Q as multiplyColors, V as UPDATE_COLOR, W as UPDATE_BLEND, X as UPDATE_VISIBLE, Y as Color, Z as getLocalBounds, P as Point, c as BindGroup, T as Ticker, D as DOMAdapter, _ as VERSION, $ as deprecation, a0 as v8_0_0, a1 as RendererInitHook } from './index2.mjs';
|
|
2
2
|
import { S as State, B as BatchableSprite, c as color32BitToUniform } from './colorToUniform.mjs';
|
|
3
3
|
|
|
4
4
|
const _Filter = class _Filter extends Shader {
|
|
@@ -13,7 +13,6 @@ const _Filter = class _Filter extends Shader {
|
|
|
13
13
|
/**
|
|
14
14
|
* The gpu state the filter requires to render.
|
|
15
15
|
* @internal
|
|
16
|
-
* @ignore
|
|
17
16
|
*/
|
|
18
17
|
this._state = State.for2d();
|
|
19
18
|
this.blendMode = options.blendMode;
|
|
@@ -71,10 +70,7 @@ const _Filter = class _Filter extends Shader {
|
|
|
71
70
|
});
|
|
72
71
|
}
|
|
73
72
|
};
|
|
74
|
-
/**
|
|
75
|
-
* The default filter settings
|
|
76
|
-
* @static
|
|
77
|
-
*/
|
|
73
|
+
/** The default filter settings */
|
|
78
74
|
_Filter.defaultOptions = {
|
|
79
75
|
blendMode: "normal",
|
|
80
76
|
resolution: 1,
|
|
@@ -162,7 +158,9 @@ const _BatcherPipe = class _BatcherPipe {
|
|
|
162
158
|
let batchers = this._batchersByInstructionSet[instructionSet.uid];
|
|
163
159
|
if (!batchers) {
|
|
164
160
|
batchers = this._batchersByInstructionSet[instructionSet.uid] = /* @__PURE__ */ Object.create(null);
|
|
165
|
-
batchers.default || (batchers.default = new DefaultBatcher(
|
|
161
|
+
batchers.default || (batchers.default = new DefaultBatcher({
|
|
162
|
+
maxTextures: this.renderer.limits.maxBatchableTextures
|
|
163
|
+
}));
|
|
166
164
|
}
|
|
167
165
|
this._activeBatches = batchers;
|
|
168
166
|
this._activeBatch = this._activeBatches.default;
|
|
@@ -267,7 +265,7 @@ const textureBit = {
|
|
|
267
265
|
@group(2) @binding(0) var uTexture: texture_2d<f32>;
|
|
268
266
|
@group(2) @binding(1) var uSampler: sampler;
|
|
269
267
|
|
|
270
|
-
|
|
268
|
+
|
|
271
269
|
`
|
|
272
270
|
),
|
|
273
271
|
main: (
|
|
@@ -300,7 +298,7 @@ const textureBitGl = {
|
|
|
300
298
|
`
|
|
301
299
|
uniform sampler2D uTexture;
|
|
302
300
|
|
|
303
|
-
|
|
301
|
+
|
|
304
302
|
`
|
|
305
303
|
),
|
|
306
304
|
main: (
|
|
@@ -721,11 +719,11 @@ GpuStencilModesToPixi[STENCIL_MODES.INVERSE_MASK_ACTIVE] = {
|
|
|
721
719
|
stencilWriteMask: 0,
|
|
722
720
|
stencilFront: {
|
|
723
721
|
compare: "not-equal",
|
|
724
|
-
passOp: "
|
|
722
|
+
passOp: "keep"
|
|
725
723
|
},
|
|
726
724
|
stencilBack: {
|
|
727
725
|
compare: "not-equal",
|
|
728
|
-
passOp: "
|
|
726
|
+
passOp: "keep"
|
|
729
727
|
}
|
|
730
728
|
};
|
|
731
729
|
|
|
@@ -1157,7 +1155,6 @@ const _RenderTarget = class _RenderTarget {
|
|
|
1157
1155
|
* This will ensure a depthStencil texture is created for this render target.
|
|
1158
1156
|
* Most likely called by the mask system to make sure we have stencil buffer added.
|
|
1159
1157
|
* @internal
|
|
1160
|
-
* @ignore
|
|
1161
1158
|
*/
|
|
1162
1159
|
ensureDepthStencilTexture() {
|
|
1163
1160
|
if (!this.depthStencilTexture) {
|
|
@@ -1482,7 +1479,7 @@ class RenderTargetSystem {
|
|
|
1482
1479
|
renderTarget = new RenderTarget({
|
|
1483
1480
|
colorTextures: [renderSurface]
|
|
1484
1481
|
});
|
|
1485
|
-
if (
|
|
1482
|
+
if (renderSurface.source instanceof CanvasSource) {
|
|
1486
1483
|
renderTarget.isRoot = true;
|
|
1487
1484
|
}
|
|
1488
1485
|
renderSurface.once("destroy", () => {
|
|
@@ -1529,25 +1526,21 @@ class BufferResource extends EventEmitter {
|
|
|
1529
1526
|
/**
|
|
1530
1527
|
* a resource type, used to identify how to handle it when its in a bind group / shader resource
|
|
1531
1528
|
* @internal
|
|
1532
|
-
* @ignore
|
|
1533
1529
|
*/
|
|
1534
1530
|
this._resourceType = "bufferResource";
|
|
1535
1531
|
/**
|
|
1536
1532
|
* used internally to know if a uniform group was used in the last render pass
|
|
1537
1533
|
* @internal
|
|
1538
|
-
* @ignore
|
|
1539
1534
|
*/
|
|
1540
1535
|
this._touched = 0;
|
|
1541
1536
|
/**
|
|
1542
1537
|
* the resource id used internally by the renderer to build bind group keys
|
|
1543
1538
|
* @internal
|
|
1544
|
-
* @ignore
|
|
1545
1539
|
*/
|
|
1546
1540
|
this._resourceId = uid$1("resource");
|
|
1547
1541
|
/**
|
|
1548
1542
|
* A cheeky hint to the GL renderer to let it know this is a BufferResource
|
|
1549
1543
|
* @internal
|
|
1550
|
-
* @ignore
|
|
1551
1544
|
*/
|
|
1552
1545
|
this._bufferResource = true;
|
|
1553
1546
|
/**
|
|
@@ -1974,10 +1967,7 @@ RenderGroupSystem.extension = {
|
|
|
1974
1967
|
|
|
1975
1968
|
class SpritePipe {
|
|
1976
1969
|
constructor(renderer) {
|
|
1977
|
-
this._gpuSpriteHash = /* @__PURE__ */ Object.create(null);
|
|
1978
|
-
this._destroyRenderableBound = this.destroyRenderable.bind(this);
|
|
1979
1970
|
this._renderer = renderer;
|
|
1980
|
-
this._renderer.renderableGC.addManagedHash(this, "_gpuSpriteHash");
|
|
1981
1971
|
}
|
|
1982
1972
|
addRenderable(sprite, instructionSet) {
|
|
1983
1973
|
const gpuSprite = this._getGpuSprite(sprite);
|
|
@@ -1986,7 +1976,7 @@ class SpritePipe {
|
|
|
1986
1976
|
this._renderer.renderPipes.batch.addToBatch(gpuSprite, instructionSet);
|
|
1987
1977
|
}
|
|
1988
1978
|
updateRenderable(sprite) {
|
|
1989
|
-
const gpuSprite = this.
|
|
1979
|
+
const gpuSprite = this._getGpuSprite(sprite);
|
|
1990
1980
|
if (sprite.didViewUpdate)
|
|
1991
1981
|
this._updateBatchableSprite(sprite, gpuSprite);
|
|
1992
1982
|
gpuSprite._batcher.updateElement(gpuSprite);
|
|
@@ -1998,35 +1988,24 @@ class SpritePipe {
|
|
|
1998
1988
|
sprite._texture
|
|
1999
1989
|
);
|
|
2000
1990
|
}
|
|
2001
|
-
destroyRenderable(sprite) {
|
|
2002
|
-
const batchableSprite = this._gpuSpriteHash[sprite.uid];
|
|
2003
|
-
BigPool.return(batchableSprite);
|
|
2004
|
-
this._gpuSpriteHash[sprite.uid] = null;
|
|
2005
|
-
sprite.off("destroyed", this._destroyRenderableBound);
|
|
2006
|
-
}
|
|
2007
1991
|
_updateBatchableSprite(sprite, batchableSprite) {
|
|
2008
1992
|
batchableSprite.bounds = sprite.visualBounds;
|
|
2009
1993
|
batchableSprite.texture = sprite._texture;
|
|
2010
1994
|
}
|
|
2011
1995
|
_getGpuSprite(sprite) {
|
|
2012
|
-
return
|
|
1996
|
+
return sprite._gpuData[this._renderer.uid] || this._initGPUSprite(sprite);
|
|
2013
1997
|
}
|
|
2014
1998
|
_initGPUSprite(sprite) {
|
|
2015
|
-
const batchableSprite =
|
|
1999
|
+
const batchableSprite = new BatchableSprite();
|
|
2016
2000
|
batchableSprite.renderable = sprite;
|
|
2017
2001
|
batchableSprite.transform = sprite.groupTransform;
|
|
2018
2002
|
batchableSprite.texture = sprite._texture;
|
|
2019
2003
|
batchableSprite.bounds = sprite.visualBounds;
|
|
2020
2004
|
batchableSprite.roundPixels = this._renderer._roundPixels | sprite._roundPixels;
|
|
2021
|
-
|
|
2022
|
-
sprite.on("destroyed", this._destroyRenderableBound);
|
|
2005
|
+
sprite._gpuData[this._renderer.uid] = batchableSprite;
|
|
2023
2006
|
return batchableSprite;
|
|
2024
2007
|
}
|
|
2025
2008
|
destroy() {
|
|
2026
|
-
for (const i in this._gpuSpriteHash) {
|
|
2027
|
-
BigPool.return(this._gpuSpriteHash[i]);
|
|
2028
|
-
}
|
|
2029
|
-
this._gpuSpriteHash = null;
|
|
2030
2009
|
this._renderer = null;
|
|
2031
2010
|
}
|
|
2032
2011
|
}
|
|
@@ -2063,6 +2042,12 @@ const _BackgroundSystem = class _BackgroundSystem {
|
|
|
2063
2042
|
return this._backgroundColor;
|
|
2064
2043
|
}
|
|
2065
2044
|
set color(value) {
|
|
2045
|
+
const incoming = Color.shared.setValue(value);
|
|
2046
|
+
if (incoming.alpha < 1 && this._backgroundColor.alpha === 1) {
|
|
2047
|
+
warn(
|
|
2048
|
+
"Cannot set a transparent background on an opaque canvas. To enable transparency, set backgroundAlpha < 1 when initializing your Application."
|
|
2049
|
+
);
|
|
2050
|
+
}
|
|
2066
2051
|
this._backgroundColor.setValue(value);
|
|
2067
2052
|
}
|
|
2068
2053
|
/** The background color alpha. Setting this to 0 will make the canvas transparent. */
|
|
@@ -2079,7 +2064,6 @@ const _BackgroundSystem = class _BackgroundSystem {
|
|
|
2079
2064
|
/**
|
|
2080
2065
|
* destroys the background system
|
|
2081
2066
|
* @internal
|
|
2082
|
-
* @ignore
|
|
2083
2067
|
*/
|
|
2084
2068
|
destroy() {
|
|
2085
2069
|
}
|
|
@@ -2190,7 +2174,6 @@ class BlendModePipe {
|
|
|
2190
2174
|
/**
|
|
2191
2175
|
* called when the instruction build process is starting this will reset internally to the default blend mode
|
|
2192
2176
|
* @internal
|
|
2193
|
-
* @ignore
|
|
2194
2177
|
*/
|
|
2195
2178
|
buildStart() {
|
|
2196
2179
|
this._isAdvanced = false;
|
|
@@ -2200,17 +2183,13 @@ class BlendModePipe {
|
|
|
2200
2183
|
* active, we add the final render instructions added to the instruction set
|
|
2201
2184
|
* @param instructionSet - The instruction set we are adding to
|
|
2202
2185
|
* @internal
|
|
2203
|
-
* @ignore
|
|
2204
2186
|
*/
|
|
2205
2187
|
buildEnd(instructionSet) {
|
|
2206
2188
|
if (this._isAdvanced) {
|
|
2207
2189
|
this._endAdvancedBlendMode(instructionSet);
|
|
2208
2190
|
}
|
|
2209
2191
|
}
|
|
2210
|
-
/**
|
|
2211
|
-
* @internal
|
|
2212
|
-
* @ignore
|
|
2213
|
-
*/
|
|
2192
|
+
/** @internal */
|
|
2214
2193
|
destroy() {
|
|
2215
2194
|
this._renderer = null;
|
|
2216
2195
|
this._renderableList = null;
|
|
@@ -2253,9 +2232,35 @@ const _ExtractSystem = class _ExtractSystem {
|
|
|
2253
2232
|
};
|
|
2254
2233
|
}
|
|
2255
2234
|
/**
|
|
2256
|
-
*
|
|
2257
|
-
* @param options -
|
|
2258
|
-
* @returns
|
|
2235
|
+
* Creates an HTMLImageElement from a display object or texture.
|
|
2236
|
+
* @param options - Options for creating the image, or the target to extract
|
|
2237
|
+
* @returns Promise that resolves with the generated HTMLImageElement
|
|
2238
|
+
* @example
|
|
2239
|
+
* ```ts
|
|
2240
|
+
* // Basic usage with a sprite
|
|
2241
|
+
* const sprite = new Sprite(texture);
|
|
2242
|
+
* const image = await renderer.extract.image(sprite);
|
|
2243
|
+
* document.body.appendChild(image);
|
|
2244
|
+
*
|
|
2245
|
+
* // Advanced usage with options
|
|
2246
|
+
* const image = await renderer.extract.image({
|
|
2247
|
+
* target: container,
|
|
2248
|
+
* format: 'webp',
|
|
2249
|
+
* quality: 0.8,
|
|
2250
|
+
* frame: new Rectangle(0, 0, 100, 100),
|
|
2251
|
+
* resolution: 2,
|
|
2252
|
+
* clearColor: '#ff0000',
|
|
2253
|
+
* antialias: true
|
|
2254
|
+
* });
|
|
2255
|
+
*
|
|
2256
|
+
* // Extract directly from a texture
|
|
2257
|
+
* const texture = Texture.from('myTexture.png');
|
|
2258
|
+
* const image = await renderer.extract.image(texture);
|
|
2259
|
+
* ```
|
|
2260
|
+
* @see {@link ExtractImageOptions} For detailed options
|
|
2261
|
+
* @see {@link ExtractSystem.base64} For base64 string output
|
|
2262
|
+
* @see {@link ExtractSystem.canvas} For canvas output
|
|
2263
|
+
* @category rendering
|
|
2259
2264
|
*/
|
|
2260
2265
|
async image(options) {
|
|
2261
2266
|
const image = new Image();
|
|
@@ -2263,9 +2268,36 @@ const _ExtractSystem = class _ExtractSystem {
|
|
|
2263
2268
|
return image;
|
|
2264
2269
|
}
|
|
2265
2270
|
/**
|
|
2266
|
-
*
|
|
2267
|
-
*
|
|
2268
|
-
*
|
|
2271
|
+
* Converts the target into a base64 encoded string.
|
|
2272
|
+
*
|
|
2273
|
+
* This method works by first creating
|
|
2274
|
+
* a canvas using `Extract.canvas` and then converting it to a base64 string.
|
|
2275
|
+
* @param options - The options for creating the base64 string, or the target to extract
|
|
2276
|
+
* @returns Promise that resolves with the base64 encoded string
|
|
2277
|
+
* @example
|
|
2278
|
+
* ```ts
|
|
2279
|
+
* // Basic usage with a sprite
|
|
2280
|
+
* const sprite = new Sprite(texture);
|
|
2281
|
+
* const base64 = await renderer.extract.base64(sprite);
|
|
2282
|
+
* console.log(base64); // data:image/png;base64,...
|
|
2283
|
+
*
|
|
2284
|
+
* // Advanced usage with options
|
|
2285
|
+
* const base64 = await renderer.extract.base64({
|
|
2286
|
+
* target: container,
|
|
2287
|
+
* format: 'webp',
|
|
2288
|
+
* quality: 0.8,
|
|
2289
|
+
* frame: new Rectangle(0, 0, 100, 100),
|
|
2290
|
+
* resolution: 2
|
|
2291
|
+
* });
|
|
2292
|
+
* ```
|
|
2293
|
+
* @throws Will throw an error if the platform doesn't support any of:
|
|
2294
|
+
* - ICanvas.toDataURL
|
|
2295
|
+
* - ICanvas.toBlob
|
|
2296
|
+
* - ICanvas.convertToBlob
|
|
2297
|
+
* @see {@link ExtractImageOptions} For detailed options
|
|
2298
|
+
* @see {@link ExtractSystem.canvas} For canvas output
|
|
2299
|
+
* @see {@link ExtractSystem.image} For HTMLImage output
|
|
2300
|
+
* @category rendering
|
|
2269
2301
|
*/
|
|
2270
2302
|
async base64(options) {
|
|
2271
2303
|
options = this._normalizeOptions(
|
|
@@ -2303,9 +2335,44 @@ const _ExtractSystem = class _ExtractSystem {
|
|
|
2303
2335
|
throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented");
|
|
2304
2336
|
}
|
|
2305
2337
|
/**
|
|
2306
|
-
* Creates a Canvas element, renders
|
|
2338
|
+
* Creates a Canvas element, renders the target to it and returns it.
|
|
2339
|
+
* This method is useful for creating static images or when you need direct canvas access.
|
|
2307
2340
|
* @param options - The options for creating the canvas, or the target to extract
|
|
2308
|
-
* @returns
|
|
2341
|
+
* @returns A Canvas element with the texture rendered on
|
|
2342
|
+
* @example
|
|
2343
|
+
* ```ts
|
|
2344
|
+
* // Basic canvas extraction from a sprite
|
|
2345
|
+
* const sprite = new Sprite(texture);
|
|
2346
|
+
* const canvas = renderer.extract.canvas(sprite);
|
|
2347
|
+
* document.body.appendChild(canvas);
|
|
2348
|
+
*
|
|
2349
|
+
* // Extract with custom region
|
|
2350
|
+
* const canvas = renderer.extract.canvas({
|
|
2351
|
+
* target: container,
|
|
2352
|
+
* frame: new Rectangle(0, 0, 100, 100)
|
|
2353
|
+
* });
|
|
2354
|
+
*
|
|
2355
|
+
* // Extract with high resolution
|
|
2356
|
+
* const canvas = renderer.extract.canvas({
|
|
2357
|
+
* target: sprite,
|
|
2358
|
+
* resolution: 2,
|
|
2359
|
+
* clearColor: '#ff0000'
|
|
2360
|
+
* });
|
|
2361
|
+
*
|
|
2362
|
+
* // Extract directly from a texture
|
|
2363
|
+
* const texture = Texture.from('myTexture.png');
|
|
2364
|
+
* const canvas = renderer.extract.canvas(texture);
|
|
2365
|
+
*
|
|
2366
|
+
* // Extract with anti-aliasing
|
|
2367
|
+
* const canvas = renderer.extract.canvas({
|
|
2368
|
+
* target: graphics,
|
|
2369
|
+
* antialias: true
|
|
2370
|
+
* });
|
|
2371
|
+
* ```
|
|
2372
|
+
* @see {@link ExtractOptions} For detailed options
|
|
2373
|
+
* @see {@link ExtractSystem.image} For HTMLImage output
|
|
2374
|
+
* @see {@link ExtractSystem.pixels} For raw pixel data
|
|
2375
|
+
* @category rendering
|
|
2309
2376
|
*/
|
|
2310
2377
|
canvas(options) {
|
|
2311
2378
|
options = this._normalizeOptions(options);
|
|
@@ -2320,10 +2387,34 @@ const _ExtractSystem = class _ExtractSystem {
|
|
|
2320
2387
|
return canvas;
|
|
2321
2388
|
}
|
|
2322
2389
|
/**
|
|
2323
|
-
*
|
|
2324
|
-
*
|
|
2390
|
+
* Returns a one-dimensional array containing the pixel data of the entire texture in RGBA order,
|
|
2391
|
+
* with integer values between 0 and 255 (inclusive).
|
|
2392
|
+
* > [!NOE] The returned array is a flat Uint8Array where every 4 values represent RGBA
|
|
2325
2393
|
* @param options - The options for extracting the image, or the target to extract
|
|
2326
|
-
* @returns
|
|
2394
|
+
* @returns One-dimensional Uint8Array containing the pixel data in RGBA format
|
|
2395
|
+
* @example
|
|
2396
|
+
* ```ts
|
|
2397
|
+
* // Basic pixel extraction
|
|
2398
|
+
* const sprite = new Sprite(texture);
|
|
2399
|
+
* const pixels = renderer.extract.pixels(sprite);
|
|
2400
|
+
* console.log(pixels[0], pixels[1], pixels[2], pixels[3]); // R,G,B,A values
|
|
2401
|
+
*
|
|
2402
|
+
* // Extract with custom region
|
|
2403
|
+
* const pixels = renderer.extract.pixels({
|
|
2404
|
+
* target: sprite,
|
|
2405
|
+
* frame: new Rectangle(0, 0, 100, 100)
|
|
2406
|
+
* });
|
|
2407
|
+
*
|
|
2408
|
+
* // Extract with high resolution
|
|
2409
|
+
* const pixels = renderer.extract.pixels({
|
|
2410
|
+
* target: sprite,
|
|
2411
|
+
* resolution: 2
|
|
2412
|
+
* });
|
|
2413
|
+
* ```
|
|
2414
|
+
* @see {@link ExtractOptions} For detailed options
|
|
2415
|
+
* @see {@link ExtractSystem.canvas} For canvas output
|
|
2416
|
+
* @see {@link ExtractSystem.image} For image output
|
|
2417
|
+
* @category rendering
|
|
2327
2418
|
*/
|
|
2328
2419
|
pixels(options) {
|
|
2329
2420
|
options = this._normalizeOptions(options);
|
|
@@ -2337,9 +2428,47 @@ const _ExtractSystem = class _ExtractSystem {
|
|
|
2337
2428
|
return pixelInfo;
|
|
2338
2429
|
}
|
|
2339
2430
|
/**
|
|
2340
|
-
*
|
|
2431
|
+
* Creates a texture from a display object or existing texture.
|
|
2432
|
+
*
|
|
2433
|
+
* This is useful for creating
|
|
2434
|
+
* reusable textures from rendered content or making copies of existing textures.
|
|
2435
|
+
* > [!NOTE] The returned texture should be destroyed when no longer needed
|
|
2341
2436
|
* @param options - The options for creating the texture, or the target to extract
|
|
2342
|
-
* @returns
|
|
2437
|
+
* @returns A new texture containing the extracted content
|
|
2438
|
+
* @example
|
|
2439
|
+
* ```ts
|
|
2440
|
+
* // Basic texture extraction from a sprite
|
|
2441
|
+
* const sprite = new Sprite(texture);
|
|
2442
|
+
* const extractedTexture = renderer.extract.texture(sprite);
|
|
2443
|
+
*
|
|
2444
|
+
* // Extract with custom region
|
|
2445
|
+
* const regionTexture = renderer.extract.texture({
|
|
2446
|
+
* target: container,
|
|
2447
|
+
* frame: new Rectangle(0, 0, 100, 100)
|
|
2448
|
+
* });
|
|
2449
|
+
*
|
|
2450
|
+
* // Extract with high resolution
|
|
2451
|
+
* const hiResTexture = renderer.extract.texture({
|
|
2452
|
+
* target: sprite,
|
|
2453
|
+
* resolution: 2,
|
|
2454
|
+
* clearColor: '#ff0000'
|
|
2455
|
+
* });
|
|
2456
|
+
*
|
|
2457
|
+
* // Create a new sprite from extracted texture
|
|
2458
|
+
* const newSprite = new Sprite(
|
|
2459
|
+
* renderer.extract.texture({
|
|
2460
|
+
* target: graphics,
|
|
2461
|
+
* antialias: true
|
|
2462
|
+
* })
|
|
2463
|
+
* );
|
|
2464
|
+
*
|
|
2465
|
+
* // Clean up when done
|
|
2466
|
+
* extractedTexture.destroy(true);
|
|
2467
|
+
* ```
|
|
2468
|
+
* @see {@link ExtractOptions} For detailed options
|
|
2469
|
+
* @see {@link Texture} For texture management
|
|
2470
|
+
* @see {@link GenerateTextureSystem} For texture generation
|
|
2471
|
+
* @category rendering
|
|
2343
2472
|
*/
|
|
2344
2473
|
texture(options) {
|
|
2345
2474
|
options = this._normalizeOptions(options);
|
|
@@ -2348,8 +2477,48 @@ const _ExtractSystem = class _ExtractSystem {
|
|
|
2348
2477
|
return this._renderer.textureGenerator.generateTexture(options);
|
|
2349
2478
|
}
|
|
2350
2479
|
/**
|
|
2351
|
-
*
|
|
2480
|
+
* Extracts and downloads content from the renderer as an image file.
|
|
2481
|
+
* This is a convenient way to save screenshots or export rendered content.
|
|
2482
|
+
* > [!NOTE] The download will use PNG format regardless of the filename extension
|
|
2352
2483
|
* @param options - The options for downloading and extracting the image, or the target to extract
|
|
2484
|
+
* @example
|
|
2485
|
+
* ```ts
|
|
2486
|
+
* // Basic download with default filename
|
|
2487
|
+
* const sprite = new Sprite(texture);
|
|
2488
|
+
* renderer.extract.download(sprite); // Downloads as 'image.png'
|
|
2489
|
+
*
|
|
2490
|
+
* // Download with custom filename
|
|
2491
|
+
* renderer.extract.download({
|
|
2492
|
+
* target: sprite,
|
|
2493
|
+
* filename: 'screenshot.png'
|
|
2494
|
+
* });
|
|
2495
|
+
*
|
|
2496
|
+
* // Download with custom region
|
|
2497
|
+
* renderer.extract.download({
|
|
2498
|
+
* target: container,
|
|
2499
|
+
* filename: 'region.png',
|
|
2500
|
+
* frame: new Rectangle(0, 0, 100, 100)
|
|
2501
|
+
* });
|
|
2502
|
+
*
|
|
2503
|
+
* // Download with high resolution and background
|
|
2504
|
+
* renderer.extract.download({
|
|
2505
|
+
* target: stage,
|
|
2506
|
+
* filename: 'hd-screenshot.png',
|
|
2507
|
+
* resolution: 2,
|
|
2508
|
+
* clearColor: '#ff0000'
|
|
2509
|
+
* });
|
|
2510
|
+
*
|
|
2511
|
+
* // Download with anti-aliasing
|
|
2512
|
+
* renderer.extract.download({
|
|
2513
|
+
* target: graphics,
|
|
2514
|
+
* filename: 'smooth.png',
|
|
2515
|
+
* antialias: true
|
|
2516
|
+
* });
|
|
2517
|
+
* ```
|
|
2518
|
+
* @see {@link ExtractDownloadOptions} For detailed options
|
|
2519
|
+
* @see {@link ExtractSystem.image} For creating images without download
|
|
2520
|
+
* @see {@link ExtractSystem.canvas} For canvas output
|
|
2521
|
+
* @category rendering
|
|
2353
2522
|
*/
|
|
2354
2523
|
download(options) {
|
|
2355
2524
|
options = this._normalizeOptions(options);
|
|
@@ -2363,7 +2532,19 @@ const _ExtractSystem = class _ExtractSystem {
|
|
|
2363
2532
|
}
|
|
2364
2533
|
/**
|
|
2365
2534
|
* Logs the target to the console as an image. This is a useful way to debug what's happening in the renderer.
|
|
2535
|
+
* The image will be displayed in the browser's console using CSS background images.
|
|
2366
2536
|
* @param options - The options for logging the image, or the target to log
|
|
2537
|
+
* @param options.width - The width of the logged image preview in the console (in pixels)
|
|
2538
|
+
* @example
|
|
2539
|
+
* ```ts
|
|
2540
|
+
* // Basic usage
|
|
2541
|
+
* const sprite = new Sprite(texture);
|
|
2542
|
+
* renderer.extract.log(sprite);
|
|
2543
|
+
* ```
|
|
2544
|
+
* @see {@link ExtractSystem.canvas} For getting raw canvas output
|
|
2545
|
+
* @see {@link ExtractSystem.pixels} For raw pixel data
|
|
2546
|
+
* @category rendering
|
|
2547
|
+
* @advanced
|
|
2367
2548
|
*/
|
|
2368
2549
|
log(options) {
|
|
2369
2550
|
const width = options.width ?? 200;
|
|
@@ -2391,11 +2572,20 @@ _ExtractSystem.extension = {
|
|
|
2391
2572
|
],
|
|
2392
2573
|
name: "extract"
|
|
2393
2574
|
};
|
|
2394
|
-
/**
|
|
2575
|
+
/**
|
|
2576
|
+
* Default options for image extraction.
|
|
2577
|
+
* @example
|
|
2578
|
+
* ```ts
|
|
2579
|
+
* // Customize default options
|
|
2580
|
+
* ExtractSystem.defaultImageOptions.format = 'webp';
|
|
2581
|
+
* ExtractSystem.defaultImageOptions.quality = 0.8;
|
|
2582
|
+
*
|
|
2583
|
+
* // Use defaults
|
|
2584
|
+
* const image = await renderer.extract.image(sprite);
|
|
2585
|
+
* ```
|
|
2586
|
+
*/
|
|
2395
2587
|
_ExtractSystem.defaultImageOptions = {
|
|
2396
|
-
/** The format of the image. */
|
|
2397
2588
|
format: "png",
|
|
2398
|
-
/** The quality of the image. */
|
|
2399
2589
|
quality: 1
|
|
2400
2590
|
};
|
|
2401
2591
|
let ExtractSystem = _ExtractSystem;
|
|
@@ -2427,15 +2617,40 @@ class GenerateTextureSystem {
|
|
|
2427
2617
|
this._renderer = renderer;
|
|
2428
2618
|
}
|
|
2429
2619
|
/**
|
|
2430
|
-
*
|
|
2431
|
-
* This
|
|
2432
|
-
* @param
|
|
2433
|
-
* @
|
|
2434
|
-
* @
|
|
2435
|
-
*
|
|
2436
|
-
*
|
|
2437
|
-
*
|
|
2438
|
-
*
|
|
2620
|
+
* Creates a texture from a display object that can be used for creating sprites and other textures.
|
|
2621
|
+
* This is particularly useful for optimizing performance when a complex container needs to be reused.
|
|
2622
|
+
* @param options - Generate texture options or a container to convert to texture
|
|
2623
|
+
* @returns A new RenderTexture containing the rendered display object
|
|
2624
|
+
* @example
|
|
2625
|
+
* ```ts
|
|
2626
|
+
* // Basic usage with a container
|
|
2627
|
+
* const container = new Container();
|
|
2628
|
+
* container.addChild(
|
|
2629
|
+
* new Graphics()
|
|
2630
|
+
* .circle(0, 0, 50)
|
|
2631
|
+
* .fill('red')
|
|
2632
|
+
* );
|
|
2633
|
+
*
|
|
2634
|
+
* const texture = renderer.textureGenerator.generateTexture(container);
|
|
2635
|
+
*
|
|
2636
|
+
* // Advanced usage with options
|
|
2637
|
+
* const texture = renderer.textureGenerator.generateTexture({
|
|
2638
|
+
* target: container,
|
|
2639
|
+
* frame: new Rectangle(0, 0, 100, 100), // Specific region
|
|
2640
|
+
* resolution: 2, // High DPI
|
|
2641
|
+
* clearColor: '#ff0000', // Red background
|
|
2642
|
+
* antialias: true // Smooth edges
|
|
2643
|
+
* });
|
|
2644
|
+
*
|
|
2645
|
+
* // Create a sprite from the generated texture
|
|
2646
|
+
* const sprite = new Sprite(texture);
|
|
2647
|
+
*
|
|
2648
|
+
* // Clean up when done
|
|
2649
|
+
* texture.destroy(true);
|
|
2650
|
+
* ```
|
|
2651
|
+
* @see {@link GenerateTextureOptions} For detailed texture generation options
|
|
2652
|
+
* @see {@link RenderTexture} For the type of texture created
|
|
2653
|
+
* @category rendering
|
|
2439
2654
|
*/
|
|
2440
2655
|
generateTexture(options) {
|
|
2441
2656
|
if (options instanceof Container) {
|
|
@@ -2523,6 +2738,7 @@ class GlobalUniformSystem {
|
|
|
2523
2738
|
}) {
|
|
2524
2739
|
const renderTarget = this._renderer.renderTarget.renderTarget;
|
|
2525
2740
|
const currentGlobalUniformData = this._stackIndex ? this._globalUniformDataStack[this._stackIndex - 1] : {
|
|
2741
|
+
projectionData: renderTarget,
|
|
2526
2742
|
worldTransformMatrix: new Matrix(),
|
|
2527
2743
|
worldColor: 4294967295,
|
|
2528
2744
|
offset: new Point()
|
|
@@ -2671,7 +2887,6 @@ class SchedulerSystem {
|
|
|
2671
2887
|
/**
|
|
2672
2888
|
* Destroys the scheduler system and removes all tasks.
|
|
2673
2889
|
* @internal
|
|
2674
|
-
* @ignore
|
|
2675
2890
|
*/
|
|
2676
2891
|
destroy() {
|
|
2677
2892
|
Ticker.system.remove(this._update, this);
|
|
@@ -3046,7 +3261,7 @@ _TextureGCSystem.defaultOptions = {
|
|
|
3046
3261
|
textureGCActive: true,
|
|
3047
3262
|
/**
|
|
3048
3263
|
* @deprecated since 8.3.0
|
|
3049
|
-
* @see {@link
|
|
3264
|
+
* @see {@link TextureGCSystemOptions.textureGCMaxIdle}
|
|
3050
3265
|
*/
|
|
3051
3266
|
textureGCAMaxIdle: null,
|
|
3052
3267
|
/**
|
|
@@ -3066,7 +3281,7 @@ const _ViewSystem = class _ViewSystem {
|
|
|
3066
3281
|
/**
|
|
3067
3282
|
* Whether CSS dimensions of canvas view should be resized to screen dimensions automatically.
|
|
3068
3283
|
* This is only supported for HTMLCanvasElement and will be ignored if the canvas is an OffscreenCanvas.
|
|
3069
|
-
* @
|
|
3284
|
+
* @type {boolean}
|
|
3070
3285
|
*/
|
|
3071
3286
|
get autoDensity() {
|
|
3072
3287
|
return this.texture.source.autoDensity;
|
|
@@ -3124,7 +3339,10 @@ const _ViewSystem = class _ViewSystem {
|
|
|
3124
3339
|
/**
|
|
3125
3340
|
* Destroys this System and optionally removes the canvas from the dom.
|
|
3126
3341
|
* @param {options | false} options - The options for destroying the view, or "false".
|
|
3127
|
-
* @
|
|
3342
|
+
* @example
|
|
3343
|
+
* viewSystem.destroy();
|
|
3344
|
+
* viewSystem.destroy(true);
|
|
3345
|
+
* viewSystem.destroy({ removeView: true });
|
|
3128
3346
|
*/
|
|
3129
3347
|
destroy(options = false) {
|
|
3130
3348
|
const removeView = typeof options === "boolean" ? options : !!options?.removeView;
|