@next2d/player 1.14.9 → 1.14.13
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/dist/player/index.js +5 -3
- package/dist/player/next2d/display/GraphicsGradientFill.d.ts +1 -1
- package/dist/player/next2d/display/GraphicsGradientFill.js +6 -2
- package/dist/player/next2d/display/Loader.d.ts +1 -1
- package/dist/player/player/Next2D.d.ts +1 -2
- package/dist/player/player/Next2D.js +7 -11
- package/package.json +1 -1
- package/dist/interface/ClassNameMap.d.ts +0 -4
- package/dist/interface/ClassNameMap.js +0 -1
- package/dist/interface/RenderDisplayObjectImpl.d.ts +0 -2
- package/dist/interface/RenderDisplayObjectImpl.js +0 -1
- package/dist/interface/TextFormatImpl.d.ts +0 -16
- package/dist/interface/TextFormatImpl.js +0 -1
- package/dist/interface/TextModeImpl.d.ts +0 -1
- package/dist/interface/TextModeImpl.js +0 -1
- package/dist/renderer/RenderDisplayObject.d.ts +0 -129
- package/dist/renderer/RenderDisplayObject.js +0 -567
- package/dist/renderer/RenderDisplayObjectContainer.d.ts +0 -70
- package/dist/renderer/RenderDisplayObjectContainer.js +0 -670
- package/dist/renderer/RenderGlobal.d.ts +0 -76
- package/dist/renderer/RenderGlobal.js +0 -88
- package/dist/renderer/RenderGraphics.d.ts +0 -90
- package/dist/renderer/RenderGraphics.js +0 -597
- package/dist/renderer/RenderPlayer.d.ts +0 -164
- package/dist/renderer/RenderPlayer.js +0 -421
- package/dist/renderer/RenderShape.d.ts +0 -32
- package/dist/renderer/RenderShape.js +0 -104
- package/dist/renderer/RenderTextField.d.ts +0 -119
- package/dist/renderer/RenderTextField.js +0 -709
- package/dist/renderer/RenderVideo.d.ts +0 -59
- package/dist/renderer/RenderVideo.js +0 -272
|
@@ -1,567 +0,0 @@
|
|
|
1
|
-
import { Rectangle } from "../player/next2d/geom/Rectangle";
|
|
2
|
-
import { BevelFilter } from "../player/next2d/filters/BevelFilter";
|
|
3
|
-
import { BlurFilter } from "../player/next2d/filters/BlurFilter";
|
|
4
|
-
import { ColorMatrixFilter } from "../player/next2d/filters/ColorMatrixFilter";
|
|
5
|
-
import { ConvolutionFilter } from "../player/next2d/filters/ConvolutionFilter";
|
|
6
|
-
import { DisplacementMapFilter } from "../player/next2d/filters/DisplacementMapFilter";
|
|
7
|
-
import { DropShadowFilter } from "../player/next2d/filters/DropShadowFilter";
|
|
8
|
-
import { GlowFilter } from "../player/next2d/filters/GlowFilter";
|
|
9
|
-
import { GradientBevelFilter } from "../player/next2d/filters/GradientBevelFilter";
|
|
10
|
-
import { GradientGlowFilter } from "../player/next2d/filters/GradientGlowFilter";
|
|
11
|
-
import { $renderPlayer } from "./RenderGlobal";
|
|
12
|
-
import { $getBoundsObject, $poolBoundsObject, $getFloat32Array6, $getFloat32Array8, $Math, $multiplicationMatrix, $boundsMatrix, $poolFloat32Array6, $getArray } from "../player/util/RenderUtil";
|
|
13
|
-
/**
|
|
14
|
-
* @class
|
|
15
|
-
*/
|
|
16
|
-
export class RenderDisplayObject {
|
|
17
|
-
_$instanceId;
|
|
18
|
-
_$parentId;
|
|
19
|
-
_$loaderInfoId;
|
|
20
|
-
_$characterId;
|
|
21
|
-
_$clipDepth;
|
|
22
|
-
_$depth;
|
|
23
|
-
_$isMask;
|
|
24
|
-
_$updated;
|
|
25
|
-
_$matrix;
|
|
26
|
-
_$blendMode;
|
|
27
|
-
_$colorTransform;
|
|
28
|
-
_$filters;
|
|
29
|
-
_$visible;
|
|
30
|
-
_$maskId;
|
|
31
|
-
_$maskMatrix;
|
|
32
|
-
_$xMin;
|
|
33
|
-
_$yMin;
|
|
34
|
-
_$xMax;
|
|
35
|
-
_$yMax;
|
|
36
|
-
_$scale9Grid;
|
|
37
|
-
_$matrixBase;
|
|
38
|
-
/**
|
|
39
|
-
* @constructor
|
|
40
|
-
* @public
|
|
41
|
-
*/
|
|
42
|
-
constructor() {
|
|
43
|
-
/**
|
|
44
|
-
* @type {number}
|
|
45
|
-
* @default -1
|
|
46
|
-
* @private
|
|
47
|
-
*/
|
|
48
|
-
this._$instanceId = -1;
|
|
49
|
-
/**
|
|
50
|
-
* @type {number}
|
|
51
|
-
* @default -1
|
|
52
|
-
* @private
|
|
53
|
-
*/
|
|
54
|
-
this._$parentId = -1;
|
|
55
|
-
/**
|
|
56
|
-
* @type {number}
|
|
57
|
-
* @default -1
|
|
58
|
-
* @private
|
|
59
|
-
*/
|
|
60
|
-
this._$loaderInfoId = -1;
|
|
61
|
-
/**
|
|
62
|
-
* @type {number}
|
|
63
|
-
* @default -1
|
|
64
|
-
* @private
|
|
65
|
-
*/
|
|
66
|
-
this._$characterId = -1;
|
|
67
|
-
/**
|
|
68
|
-
* @type {number}
|
|
69
|
-
* @default 0
|
|
70
|
-
* @private
|
|
71
|
-
*/
|
|
72
|
-
this._$clipDepth = 0;
|
|
73
|
-
/**
|
|
74
|
-
* @type {number}
|
|
75
|
-
* @default 0
|
|
76
|
-
* @private
|
|
77
|
-
*/
|
|
78
|
-
this._$depth = 0;
|
|
79
|
-
/**
|
|
80
|
-
* @type {boolean}
|
|
81
|
-
* @default false
|
|
82
|
-
* @private
|
|
83
|
-
*/
|
|
84
|
-
this._$isMask = false;
|
|
85
|
-
/**
|
|
86
|
-
* @type {boolean}
|
|
87
|
-
* @default true
|
|
88
|
-
* @private
|
|
89
|
-
*/
|
|
90
|
-
this._$updated = true;
|
|
91
|
-
/**
|
|
92
|
-
* @type {Float32Array}
|
|
93
|
-
* @private
|
|
94
|
-
*/
|
|
95
|
-
this._$matrix = $getFloat32Array6(1, 0, 0, 1, 0, 0);
|
|
96
|
-
/**
|
|
97
|
-
* @type {Float32Array}
|
|
98
|
-
* @private
|
|
99
|
-
*/
|
|
100
|
-
this._$colorTransform = $getFloat32Array8(1, 1, 1, 1, 0, 0, 0, 0);
|
|
101
|
-
/**
|
|
102
|
-
* @type {string}
|
|
103
|
-
* @default BlendMode.NORMAL
|
|
104
|
-
* @private
|
|
105
|
-
*/
|
|
106
|
-
this._$blendMode = "normal";
|
|
107
|
-
/**
|
|
108
|
-
* @type {array}
|
|
109
|
-
* @default null
|
|
110
|
-
* @private
|
|
111
|
-
*/
|
|
112
|
-
this._$filters = null;
|
|
113
|
-
/**
|
|
114
|
-
* @type {boolean}
|
|
115
|
-
* @default true
|
|
116
|
-
* @private
|
|
117
|
-
*/
|
|
118
|
-
this._$visible = true;
|
|
119
|
-
/**
|
|
120
|
-
* @type {number}
|
|
121
|
-
* @default -1
|
|
122
|
-
* @private
|
|
123
|
-
*/
|
|
124
|
-
this._$maskId = -1;
|
|
125
|
-
/**
|
|
126
|
-
* @type {Float32Array}
|
|
127
|
-
* @default null
|
|
128
|
-
* @private
|
|
129
|
-
*/
|
|
130
|
-
this._$maskMatrix = null;
|
|
131
|
-
/**
|
|
132
|
-
* @type {boolean}
|
|
133
|
-
* @default false
|
|
134
|
-
* @private
|
|
135
|
-
*/
|
|
136
|
-
this._$isMask = false;
|
|
137
|
-
/**
|
|
138
|
-
* @type {number}
|
|
139
|
-
* @default 0
|
|
140
|
-
* @private
|
|
141
|
-
*/
|
|
142
|
-
this._$xMin = 0;
|
|
143
|
-
/**
|
|
144
|
-
* @type {number}
|
|
145
|
-
* @default 0
|
|
146
|
-
* @private
|
|
147
|
-
*/
|
|
148
|
-
this._$yMin = 0;
|
|
149
|
-
/**
|
|
150
|
-
* @type {number}
|
|
151
|
-
* @default 0
|
|
152
|
-
* @private
|
|
153
|
-
*/
|
|
154
|
-
this._$xMax = 0;
|
|
155
|
-
/**
|
|
156
|
-
* @type {number}
|
|
157
|
-
* @default 0
|
|
158
|
-
* @private
|
|
159
|
-
*/
|
|
160
|
-
this._$yMax = 0;
|
|
161
|
-
/**
|
|
162
|
-
* @type {Rectangle|null}
|
|
163
|
-
* @default null
|
|
164
|
-
* @private
|
|
165
|
-
*/
|
|
166
|
-
this._$scale9Grid = null;
|
|
167
|
-
/**
|
|
168
|
-
* @type {Float32Array}
|
|
169
|
-
* @default null
|
|
170
|
-
* @private
|
|
171
|
-
*/
|
|
172
|
-
this._$matrixBase = null;
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* @param {Float32Array} matrix
|
|
176
|
-
* @return {boolean}
|
|
177
|
-
* @method
|
|
178
|
-
* @private
|
|
179
|
-
*/
|
|
180
|
-
_$shouldClip(matrix) {
|
|
181
|
-
const bounds = this._$getBounds(matrix);
|
|
182
|
-
const width = $Math.abs(bounds.xMax - bounds.xMin);
|
|
183
|
-
const height = $Math.abs(bounds.yMax - bounds.yMin);
|
|
184
|
-
$poolBoundsObject(bounds);
|
|
185
|
-
return !(!width || !height);
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* @param {Float32Array} [matrix=null]
|
|
189
|
-
* @returns {object}
|
|
190
|
-
* @private
|
|
191
|
-
*/
|
|
192
|
-
_$getLayerBounds(matrix = null) {
|
|
193
|
-
const baseBounds = this._$getBounds(matrix);
|
|
194
|
-
const filters = this._$filters;
|
|
195
|
-
if (!filters || !filters.length) {
|
|
196
|
-
return baseBounds;
|
|
197
|
-
}
|
|
198
|
-
let rect = new Rectangle(baseBounds.xMin, baseBounds.yMin, baseBounds.xMax - baseBounds.xMin, baseBounds.yMax - baseBounds.yMin);
|
|
199
|
-
$poolBoundsObject(baseBounds);
|
|
200
|
-
for (let idx = 0; idx < filters.length; ++idx) {
|
|
201
|
-
rect = filters[idx]._$generateFilterRect(rect, 0, 0);
|
|
202
|
-
}
|
|
203
|
-
const xMin = rect.x;
|
|
204
|
-
const xMax = rect.x + rect.width;
|
|
205
|
-
const yMin = rect.y;
|
|
206
|
-
const yMax = rect.y + rect.height;
|
|
207
|
-
return $getBoundsObject(xMin, xMax, yMin, yMax);
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* @param {Float32Array} [matrix=null]
|
|
211
|
-
* @returns {object}
|
|
212
|
-
* @method
|
|
213
|
-
* @private
|
|
214
|
-
*/
|
|
215
|
-
_$getBounds(matrix = null) {
|
|
216
|
-
const baseBounds = $getBoundsObject(this._$xMin, this._$xMax, this._$yMin, this._$yMax);
|
|
217
|
-
if (!matrix) {
|
|
218
|
-
return baseBounds;
|
|
219
|
-
}
|
|
220
|
-
let multiMatrix = matrix;
|
|
221
|
-
const rawMatrix = this._$matrix;
|
|
222
|
-
if (rawMatrix[0] !== 1 || rawMatrix[1] !== 0
|
|
223
|
-
|| rawMatrix[2] !== 0 || rawMatrix[3] !== 1
|
|
224
|
-
|| rawMatrix[4] !== 0 || rawMatrix[5] !== 0) {
|
|
225
|
-
multiMatrix = $multiplicationMatrix(matrix, rawMatrix);
|
|
226
|
-
}
|
|
227
|
-
const bounds = $boundsMatrix(baseBounds, multiMatrix);
|
|
228
|
-
$poolBoundsObject(baseBounds);
|
|
229
|
-
if (multiMatrix !== matrix) {
|
|
230
|
-
$poolFloat32Array6(multiMatrix);
|
|
231
|
-
}
|
|
232
|
-
return bounds;
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* @param {CanvasToWebGLContext} context
|
|
236
|
-
* @param {Float32Array} matrix
|
|
237
|
-
* @return {Float32Array|boolean|null}
|
|
238
|
-
* @method
|
|
239
|
-
* @private
|
|
240
|
-
*/
|
|
241
|
-
_$startClip(context, matrix) {
|
|
242
|
-
let clipMatrix = null;
|
|
243
|
-
// ネストしてない初回のマスクだけ実行
|
|
244
|
-
// ネストしてる場合は初回に作られたbufferを流用
|
|
245
|
-
if (!context.cacheAttachment) {
|
|
246
|
-
let multiMatrix = matrix;
|
|
247
|
-
const rawMatrix = this._$matrix;
|
|
248
|
-
if (rawMatrix[0] !== 1 || rawMatrix[1] !== 0
|
|
249
|
-
|| rawMatrix[2] !== 0 || rawMatrix[3] !== 1
|
|
250
|
-
|| rawMatrix[4] !== 0 || rawMatrix[5] !== 0) {
|
|
251
|
-
multiMatrix = $multiplicationMatrix(matrix, rawMatrix);
|
|
252
|
-
}
|
|
253
|
-
const baseBounds = this._$getBounds(null);
|
|
254
|
-
const bounds = $boundsMatrix(baseBounds, multiMatrix);
|
|
255
|
-
$poolBoundsObject(baseBounds);
|
|
256
|
-
clipMatrix = context._$startClip(matrix, bounds);
|
|
257
|
-
$poolBoundsObject(bounds);
|
|
258
|
-
if (multiMatrix !== matrix) {
|
|
259
|
-
$poolFloat32Array6(multiMatrix);
|
|
260
|
-
}
|
|
261
|
-
if (!clipMatrix) {
|
|
262
|
-
return false;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
// start clip
|
|
266
|
-
context._$enterClip();
|
|
267
|
-
// mask start
|
|
268
|
-
context._$beginClipDef();
|
|
269
|
-
let containerClip = false;
|
|
270
|
-
if ("_$children" in this) {
|
|
271
|
-
containerClip = true;
|
|
272
|
-
context._$updateContainerClipFlag(true);
|
|
273
|
-
}
|
|
274
|
-
// @ts-ignore
|
|
275
|
-
this._$clip(context, clipMatrix || matrix);
|
|
276
|
-
this._$updated = false;
|
|
277
|
-
// container clip
|
|
278
|
-
if (containerClip) {
|
|
279
|
-
// update flag
|
|
280
|
-
context._$updateContainerClipFlag(false);
|
|
281
|
-
// execute clip
|
|
282
|
-
context._$drawContainerClip();
|
|
283
|
-
}
|
|
284
|
-
// mask end
|
|
285
|
-
context._$endClipDef();
|
|
286
|
-
return clipMatrix;
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* @description 描画情報を更新
|
|
290
|
-
*
|
|
291
|
-
* @param {object} object
|
|
292
|
-
* @return {void}
|
|
293
|
-
* @method
|
|
294
|
-
* @private
|
|
295
|
-
*/
|
|
296
|
-
_$update(object) {
|
|
297
|
-
this._$updated = true;
|
|
298
|
-
this._$visible = object.visible;
|
|
299
|
-
this._$isMask = object.isMask;
|
|
300
|
-
this._$depth = object.depth;
|
|
301
|
-
this._$clipDepth = object.clipDepth;
|
|
302
|
-
this._$maskId = object.maskId;
|
|
303
|
-
if (this._$maskId > -1 && object.maskMatrix) {
|
|
304
|
-
this._$maskMatrix = object.maskMatrix;
|
|
305
|
-
}
|
|
306
|
-
this._$matrix[0] = "a" in object ? object.a : 1;
|
|
307
|
-
this._$matrix[1] = "b" in object ? object.b : 0;
|
|
308
|
-
this._$matrix[2] = "c" in object ? object.c : 0;
|
|
309
|
-
this._$matrix[3] = "d" in object ? object.d : 1;
|
|
310
|
-
this._$matrix[4] = "tx" in object ? object.tx : 0;
|
|
311
|
-
this._$matrix[5] = "ty" in object ? object.ty : 0;
|
|
312
|
-
this._$colorTransform[0] = "f0" in object ? object.f0 : 1;
|
|
313
|
-
this._$colorTransform[1] = "f1" in object ? object.f1 : 1;
|
|
314
|
-
this._$colorTransform[2] = "f2" in object ? object.f2 : 1;
|
|
315
|
-
this._$colorTransform[3] = "f3" in object ? object.f3 : 1;
|
|
316
|
-
this._$colorTransform[4] = "f4" in object ? object.f4 : 0;
|
|
317
|
-
this._$colorTransform[5] = "f5" in object ? object.f5 : 0;
|
|
318
|
-
this._$colorTransform[6] = "f6" in object ? object.f6 : 0;
|
|
319
|
-
this._$colorTransform[7] = "f7" in object ? object.f7 : 0;
|
|
320
|
-
this._$blendMode = object.blendMode || "normal";
|
|
321
|
-
this._$filters = null;
|
|
322
|
-
if (object.filters && object.filters.length) {
|
|
323
|
-
this._$filters = $getArray();
|
|
324
|
-
for (let idx = 0; idx < object.filters.length; ++idx) {
|
|
325
|
-
const parameters = object.filters[idx];
|
|
326
|
-
const type = parameters.shift();
|
|
327
|
-
switch (type) {
|
|
328
|
-
case 0:
|
|
329
|
-
this._$filters.push(new BevelFilter(...parameters));
|
|
330
|
-
break;
|
|
331
|
-
case 1:
|
|
332
|
-
this._$filters.push(new BlurFilter(...parameters));
|
|
333
|
-
break;
|
|
334
|
-
case 2:
|
|
335
|
-
this._$filters.push(new ColorMatrixFilter(...parameters));
|
|
336
|
-
break;
|
|
337
|
-
case 3:
|
|
338
|
-
this._$filters.push(new ConvolutionFilter(...parameters));
|
|
339
|
-
break;
|
|
340
|
-
case 4:
|
|
341
|
-
this._$filters.push(new DisplacementMapFilter(...parameters));
|
|
342
|
-
break;
|
|
343
|
-
case 5:
|
|
344
|
-
this._$filters.push(new DropShadowFilter(...parameters));
|
|
345
|
-
break;
|
|
346
|
-
case 6:
|
|
347
|
-
this._$filters.push(new GlowFilter(...parameters));
|
|
348
|
-
break;
|
|
349
|
-
case 7:
|
|
350
|
-
this._$filters.push(new GradientBevelFilter(...parameters));
|
|
351
|
-
break;
|
|
352
|
-
case 8:
|
|
353
|
-
this._$filters.push(new GradientGlowFilter(...parameters));
|
|
354
|
-
break;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
if (object.grid) {
|
|
359
|
-
this._$scale9Grid = new Rectangle(object.grid.x, object.grid.y, object.grid.w, object.grid.h);
|
|
360
|
-
if (object.matrixBase) {
|
|
361
|
-
this._$matrixBase = object.matrixBase;
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
/**
|
|
366
|
-
* @param {array} [filters]
|
|
367
|
-
* @return {boolean}
|
|
368
|
-
* @private
|
|
369
|
-
*/
|
|
370
|
-
_$canApply(filters = null) {
|
|
371
|
-
if (filters) {
|
|
372
|
-
for (let idx = 0; idx < filters.length; ++idx) {
|
|
373
|
-
if (filters[idx]._$canApply()) {
|
|
374
|
-
return true;
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
return false;
|
|
379
|
-
}
|
|
380
|
-
/**
|
|
381
|
-
* @description Playerから登録を削除
|
|
382
|
-
*
|
|
383
|
-
* @return {void}
|
|
384
|
-
* @method
|
|
385
|
-
* @private
|
|
386
|
-
*/
|
|
387
|
-
_$remove() {
|
|
388
|
-
const player = $renderPlayer;
|
|
389
|
-
// キャッシュ削除のタイマーをセット
|
|
390
|
-
const cacheStore = player.cacheStore;
|
|
391
|
-
cacheStore.setRemoveTimer(this._$instanceId);
|
|
392
|
-
if (this._$loaderInfoId > -1 && this._$characterId) {
|
|
393
|
-
cacheStore.setRemoveTimer(`${this._$loaderInfoId}@${this._$characterId}`);
|
|
394
|
-
}
|
|
395
|
-
player.instances.delete(this._$instanceId);
|
|
396
|
-
// reset
|
|
397
|
-
this._$instanceId = -1;
|
|
398
|
-
this._$parentId = -1;
|
|
399
|
-
this._$loaderInfoId = -1;
|
|
400
|
-
this._$characterId = -1;
|
|
401
|
-
this._$updated = true;
|
|
402
|
-
this._$blendMode = "normal";
|
|
403
|
-
this._$filters = null;
|
|
404
|
-
this._$visible = true;
|
|
405
|
-
this._$maskId = -1;
|
|
406
|
-
this._$isMask = false;
|
|
407
|
-
this._$depth = 0;
|
|
408
|
-
this._$clipDepth = 0;
|
|
409
|
-
this._$scale9Grid = null;
|
|
410
|
-
}
|
|
411
|
-
/**
|
|
412
|
-
* @return {boolean}
|
|
413
|
-
* @method
|
|
414
|
-
* @private
|
|
415
|
-
*/
|
|
416
|
-
_$isUpdated() {
|
|
417
|
-
return this._$updated;
|
|
418
|
-
}
|
|
419
|
-
/**
|
|
420
|
-
* @param {number} width
|
|
421
|
-
* @param {number} height
|
|
422
|
-
* @param {Float32Array} matrix
|
|
423
|
-
* @param {array} [filters=null]
|
|
424
|
-
* @param {boolean} [can_apply=false]
|
|
425
|
-
* @param {number} [position_x=0]
|
|
426
|
-
* @param {number} [position_y=0]
|
|
427
|
-
* @return {boolean}
|
|
428
|
-
* @private
|
|
429
|
-
*/
|
|
430
|
-
_$isFilterUpdated(width, height, matrix, filters = null, can_apply = false, position_x = 0, position_y = 0) {
|
|
431
|
-
// cache flag
|
|
432
|
-
if (this._$isUpdated()) {
|
|
433
|
-
return true;
|
|
434
|
-
}
|
|
435
|
-
// check filter data
|
|
436
|
-
if (filters && can_apply) {
|
|
437
|
-
for (let idx = 0; idx < filters.length; ++idx) {
|
|
438
|
-
if (!filters[idx]._$isUpdated()) {
|
|
439
|
-
continue;
|
|
440
|
-
}
|
|
441
|
-
return true;
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
// check status
|
|
445
|
-
const cache = $renderPlayer
|
|
446
|
-
.cacheStore
|
|
447
|
-
.get([this._$instanceId, "f"]);
|
|
448
|
-
if (!cache) {
|
|
449
|
-
return true;
|
|
450
|
-
}
|
|
451
|
-
switch (true) {
|
|
452
|
-
case cache.filterState !== can_apply:
|
|
453
|
-
case cache.layerWidth !== $Math.ceil(width):
|
|
454
|
-
case cache.layerHeight !== $Math.ceil(height):
|
|
455
|
-
case cache.matrix !== matrix[0] + "_"
|
|
456
|
-
+ matrix[1] + "_"
|
|
457
|
-
+ matrix[2] + "_"
|
|
458
|
-
+ matrix[3] + "_"
|
|
459
|
-
+ position_x + "_"
|
|
460
|
-
+ position_y:
|
|
461
|
-
return true;
|
|
462
|
-
default:
|
|
463
|
-
return false;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
/**
|
|
467
|
-
* @param {CanvasToWebGLContext} context
|
|
468
|
-
* @param {array} filters
|
|
469
|
-
* @param {WebGLTexture} target_texture
|
|
470
|
-
* @param {Float32Array} matrix
|
|
471
|
-
* @param {number} width
|
|
472
|
-
* @param {number} height
|
|
473
|
-
* @return {WebGLTexture}
|
|
474
|
-
* @private
|
|
475
|
-
*/
|
|
476
|
-
_$applyFilter(context, filters, target_texture, matrix, width, height) {
|
|
477
|
-
const xScale = +$Math.sqrt(matrix[0] * matrix[0]
|
|
478
|
-
+ matrix[1] * matrix[1]);
|
|
479
|
-
const yScale = +$Math.sqrt(matrix[2] * matrix[2]
|
|
480
|
-
+ matrix[3] * matrix[3]);
|
|
481
|
-
const radianX = $Math.atan2(matrix[1], matrix[0]);
|
|
482
|
-
const radianY = $Math.atan2(0 - matrix[2], matrix[3]);
|
|
483
|
-
const parentMatrix = $getFloat32Array6($Math.cos(radianX), $Math.sin(radianX), 0 - $Math.sin(radianY), $Math.cos(radianY), width / 2, height / 2);
|
|
484
|
-
const baseMatrix = $getFloat32Array6(1, 0, 0, 1, 0 - target_texture.width / 2, 0 - target_texture.height / 2);
|
|
485
|
-
const multiMatrix = $multiplicationMatrix(parentMatrix, baseMatrix);
|
|
486
|
-
$poolFloat32Array6(parentMatrix);
|
|
487
|
-
$poolFloat32Array6(baseMatrix);
|
|
488
|
-
const manager = context.frameBuffer;
|
|
489
|
-
const currentAttachment = manager.currentAttachment;
|
|
490
|
-
const attachment = manager
|
|
491
|
-
.createCacheAttachment(width, height);
|
|
492
|
-
context._$bind(attachment);
|
|
493
|
-
context.reset();
|
|
494
|
-
context.setTransform(multiMatrix[0], multiMatrix[1], multiMatrix[2], multiMatrix[3], multiMatrix[4], multiMatrix[5]);
|
|
495
|
-
$poolFloat32Array6(multiMatrix);
|
|
496
|
-
context.drawImage(target_texture, 0, 0, target_texture.width, target_texture.height);
|
|
497
|
-
// init
|
|
498
|
-
context._$offsetX = 0;
|
|
499
|
-
context._$offsetY = 0;
|
|
500
|
-
const filterMatrix = $getFloat32Array6(xScale, 0, 0, yScale, 0, 0);
|
|
501
|
-
let texture = null;
|
|
502
|
-
for (let idx = 0; idx < filters.length; ++idx) {
|
|
503
|
-
texture = filters[idx]._$applyFilter(context, filterMatrix);
|
|
504
|
-
}
|
|
505
|
-
$poolFloat32Array6(filterMatrix);
|
|
506
|
-
if (!texture) {
|
|
507
|
-
return target_texture;
|
|
508
|
-
}
|
|
509
|
-
const offsetX = context._$offsetX;
|
|
510
|
-
const offsetY = context._$offsetY;
|
|
511
|
-
// reset
|
|
512
|
-
context._$offsetX = 0;
|
|
513
|
-
context._$offsetY = 0;
|
|
514
|
-
// set offset
|
|
515
|
-
texture._$offsetX = offsetX;
|
|
516
|
-
texture._$offsetY = offsetY;
|
|
517
|
-
// cache texture
|
|
518
|
-
texture.matrix =
|
|
519
|
-
matrix[0] + "_" + matrix[1] + "_"
|
|
520
|
-
+ matrix[2] + "_" + matrix[3];
|
|
521
|
-
texture.filterState = true;
|
|
522
|
-
texture.layerWidth = width;
|
|
523
|
-
texture.layerHeight = height;
|
|
524
|
-
context._$bind(currentAttachment);
|
|
525
|
-
manager.releaseAttachment(attachment, false);
|
|
526
|
-
return texture;
|
|
527
|
-
}
|
|
528
|
-
/**
|
|
529
|
-
* @param {CanvasToWebGLContext} context
|
|
530
|
-
* @param {WebGLTexture} target_texture
|
|
531
|
-
* @param {Float32Array} matrix
|
|
532
|
-
* @param {array} filters
|
|
533
|
-
* @param {number} width
|
|
534
|
-
* @param {number} height
|
|
535
|
-
* @return {WebGLTexture}
|
|
536
|
-
* @method
|
|
537
|
-
* @private
|
|
538
|
-
*/
|
|
539
|
-
_$drawFilter(context, target_texture, matrix, filters, width, height) {
|
|
540
|
-
const cacheStore = $renderPlayer.cacheStore;
|
|
541
|
-
const cacheKeys = [this._$instanceId, "f"];
|
|
542
|
-
const cache = cacheStore.get(cacheKeys);
|
|
543
|
-
const updated = this._$isFilterUpdated(width, height, matrix, filters, true);
|
|
544
|
-
if (cache && !updated) {
|
|
545
|
-
return cache;
|
|
546
|
-
}
|
|
547
|
-
// cache clear
|
|
548
|
-
if (cache) {
|
|
549
|
-
cacheStore.set(cacheKeys, null);
|
|
550
|
-
cache.layerWidth = 0;
|
|
551
|
-
cache.layerHeight = 0;
|
|
552
|
-
cache._$offsetX = 0;
|
|
553
|
-
cache._$offsetY = 0;
|
|
554
|
-
cache.matrix = null;
|
|
555
|
-
cache.colorTransform = null;
|
|
556
|
-
context
|
|
557
|
-
.frameBuffer
|
|
558
|
-
.releaseTexture(cache);
|
|
559
|
-
}
|
|
560
|
-
if (!cache || updated) {
|
|
561
|
-
const texture = this._$applyFilter(context, filters, target_texture, matrix, width, height);
|
|
562
|
-
cacheStore.set(cacheKeys, texture);
|
|
563
|
-
return texture;
|
|
564
|
-
}
|
|
565
|
-
return cache;
|
|
566
|
-
}
|
|
567
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { RenderGraphics } from "./RenderGraphics";
|
|
2
|
-
import type { CanvasToWebGLContext } from "../webgl/CanvasToWebGLContext";
|
|
3
|
-
import type { PreObjectImpl } from "../interface/PreObjectImpl";
|
|
4
|
-
import type { BoundsImpl } from "../interface/BoundsImpl";
|
|
5
|
-
/**
|
|
6
|
-
* @class
|
|
7
|
-
*/
|
|
8
|
-
export declare class RenderDisplayObjectContainer extends RenderGraphics {
|
|
9
|
-
private readonly _$children;
|
|
10
|
-
/**
|
|
11
|
-
* @constructor
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
constructor();
|
|
15
|
-
/**
|
|
16
|
-
* @param {CanvasToWebGLContext} context
|
|
17
|
-
* @param {Float32Array} matrix
|
|
18
|
-
* @return {void}
|
|
19
|
-
* @method
|
|
20
|
-
* @private
|
|
21
|
-
*/
|
|
22
|
-
_$clip(context: CanvasToWebGLContext, matrix: Float32Array): void;
|
|
23
|
-
/**
|
|
24
|
-
* @param {CanvasToWebGLContext} context
|
|
25
|
-
* @param {Float32Array} matrix
|
|
26
|
-
* @param {Float32Array} color_transform
|
|
27
|
-
* @return {void}
|
|
28
|
-
* @method
|
|
29
|
-
* @private
|
|
30
|
-
*/
|
|
31
|
-
_$draw(context: CanvasToWebGLContext, matrix: Float32Array, color_transform: Float32Array): void;
|
|
32
|
-
/**
|
|
33
|
-
* @param {array} [matrix=null]
|
|
34
|
-
* @return {object}
|
|
35
|
-
* @private
|
|
36
|
-
*/
|
|
37
|
-
_$getLayerBounds(matrix?: null): BoundsImpl;
|
|
38
|
-
/**
|
|
39
|
-
* @param {Float32Array} [matrix=null]
|
|
40
|
-
* @returns {object}
|
|
41
|
-
* @method
|
|
42
|
-
* @private
|
|
43
|
-
*/
|
|
44
|
-
_$getBounds(matrix?: Float32Array | null): BoundsImpl;
|
|
45
|
-
/**
|
|
46
|
-
* @param {CanvasToWebGLContext} context
|
|
47
|
-
* @param {Float32Array} matrix
|
|
48
|
-
* @return {object}
|
|
49
|
-
* @private
|
|
50
|
-
*/
|
|
51
|
-
_$preDraw(context: CanvasToWebGLContext, matrix: Float32Array): PreObjectImpl | null;
|
|
52
|
-
/**
|
|
53
|
-
* @param {CanvasToWebGLContext} context
|
|
54
|
-
* @param {Float32Array} matrix
|
|
55
|
-
* @param {Float32Array} color_transform
|
|
56
|
-
* @param {object} object
|
|
57
|
-
* @return {void}
|
|
58
|
-
* @method
|
|
59
|
-
* @private
|
|
60
|
-
*/
|
|
61
|
-
_$postDraw(context: CanvasToWebGLContext, matrix: Float32Array, color_transform: Float32Array, object: PreObjectImpl): void;
|
|
62
|
-
/**
|
|
63
|
-
* @description Playerから登録を削除
|
|
64
|
-
*
|
|
65
|
-
* @return {void}
|
|
66
|
-
* @method
|
|
67
|
-
* @private
|
|
68
|
-
*/
|
|
69
|
-
_$remove(): void;
|
|
70
|
-
}
|