@galacean/engine-core 1.2.0-alpha.0 → 1.2.0-alpha.1

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.
Files changed (67) hide show
  1. package/dist/main.js +494 -380
  2. package/dist/main.js.map +1 -1
  3. package/dist/miniprogram.js +494 -380
  4. package/dist/module.js +590 -476
  5. package/dist/module.js.map +1 -1
  6. package/package.json +3 -3
  7. package/types/2d/atlas/types.d.ts +2 -0
  8. package/types/2d/text/TextRenderer.d.ts +1 -0
  9. package/types/SystemInfo.d.ts +2 -0
  10. package/types/mesh/PrimitiveMesh.d.ts +22 -0
  11. package/types/xr/XRPose.d.ts +15 -0
  12. package/types/xr/feature/XRFeature.d.ts +16 -0
  13. package/types/xr/feature/XRFeatureManager.d.ts +65 -0
  14. package/types/xr/feature/XRFeatureType.d.ts +13 -0
  15. package/types/xr/feature/camera/XRCameraManager.d.ts +26 -0
  16. package/types/xr/feature/hitTest/TrackableType.d.ts +10 -0
  17. package/types/xr/feature/hitTest/XRHitResult.d.ts +19 -0
  18. package/types/xr/feature/hitTest/XRHitTest.d.ts +39 -0
  19. package/types/xr/feature/hitTest/XRHitTestManager.d.ts +38 -0
  20. package/types/xr/feature/hitTest/XRHitTestType.d.ts +16 -0
  21. package/types/xr/feature/movementTracking/XRMovementTracking.d.ts +18 -0
  22. package/types/xr/feature/movementTracking/XRMovementTrackingManager.d.ts +10 -0
  23. package/types/xr/feature/movementTracking/XRMovementTrackingMode.d.ts +5 -0
  24. package/types/xr/feature/trackable/XRRequestTrackingState.d.ts +11 -0
  25. package/types/xr/feature/trackable/XRTrackableFeature.d.ts +38 -0
  26. package/types/xr/feature/trackable/XRTrackableManager.d.ts +41 -0
  27. package/types/xr/feature/trackable/XRTracked.d.ts +1 -0
  28. package/types/xr/feature/trackable/anchor/XRAnchor.d.ts +6 -0
  29. package/types/xr/feature/trackable/anchor/XRAnchorTracking.d.ts +37 -0
  30. package/types/xr/feature/trackable/anchor/XRAnchorTrackingManager.d.ts +20 -0
  31. package/types/xr/feature/trackable/anchor/XRRequestAnchor.d.ts +15 -0
  32. package/types/xr/feature/trackable/image/XRImageTracking.d.ts +24 -0
  33. package/types/xr/feature/trackable/image/XRImageTrackingManager.d.ts +31 -0
  34. package/types/xr/feature/trackable/image/XRReferenceImage.d.ts +11 -0
  35. package/types/xr/feature/trackable/image/XRRequestImage.d.ts +13 -0
  36. package/types/xr/feature/trackable/image/XRTrackedImage.d.ts +8 -0
  37. package/types/xr/feature/trackable/plane/XRPlaneMode.d.ts +13 -0
  38. package/types/xr/feature/trackable/plane/XRPlaneTracking.d.ts +23 -0
  39. package/types/xr/feature/trackable/plane/XRPlaneTrackingManager.d.ts +11 -0
  40. package/types/xr/feature/trackable/plane/XRRequestPlane.d.ts +12 -0
  41. package/types/xr/feature/trackable/plane/XRTrackedPlane.d.ts +20 -0
  42. package/types/xr/index.d.ts +25 -0
  43. package/types/xr/input/XRCamera.d.ts +15 -0
  44. package/types/xr/input/XRController.d.ts +38 -0
  45. package/types/xr/input/XRControllerPoseMode.d.ts +9 -0
  46. package/types/xr/input/XRInput.d.ts +8 -0
  47. package/types/xr/input/XRInputButton.d.ts +19 -0
  48. package/types/xr/input/XRInputEvent.d.ts +24 -0
  49. package/types/xr/input/XRInputEventType.d.ts +11 -0
  50. package/types/xr/input/XRInputManager.d.ts +31 -0
  51. package/types/xr/input/XRInputType.d.ts +23 -0
  52. package/types/xr/input/XRTargetRayMode.d.ts +12 -0
  53. package/types/xr/input/XRTrackedInputDevice.d.ts +21 -0
  54. package/types/xr/input/XRTrackedUpdateFlag.d.ts +11 -0
  55. package/types/xr/input/XRTrackingState.d.ts +11 -0
  56. package/types/xr/session/XRSessionManager.d.ts +45 -0
  57. package/types/xr/session/XRSessionMode.d.ts +8 -0
  58. package/types/xr/session/XRSessionState.d.ts +13 -0
  59. package/types/RenderPipeline/MeshRenderElement.d.ts +0 -19
  60. package/types/RenderPipeline/SpriteElement.d.ts +0 -15
  61. package/types/RenderPipeline/SpriteMaskElement.d.ts +0 -12
  62. package/types/RenderPipeline/TextRenderElement.d.ts +0 -8
  63. package/types/asset/IRefObject.d.ts +0 -2
  64. package/types/asset/RefObject.d.ts +0 -27
  65. package/types/base/Event.d.ts +0 -24
  66. package/types/base/Util.d.ts +0 -14
  67. /package/types/{2d/data/RenderData2D.d.ts → xr/feature/trackable/XRRequestTracking.d.ts} +0 -0
package/dist/main.js CHANGED
@@ -59,347 +59,6 @@ function _inherits(subClass, superClass) {
59
59
  if (superClass) _set_prototype_of(subClass, superClass);
60
60
  }
61
61
 
62
- /**
63
- * Common utility methods for math operations.
64
- */ var MathUtil = /*#__PURE__*/ function() {
65
- function MathUtil() {}
66
- /**
67
- * Clamps the specified value.
68
- * @param v - The specified value
69
- * @param min - The min value
70
- * @param max - The max value
71
- * @returns The result of clamping a value between min and max
72
- */ MathUtil.clamp = function clamp(v, min, max) {
73
- return Math.max(min, Math.min(max, v));
74
- };
75
- /**
76
- * Checks if a and b are almost equals.
77
- * The absolute value of the difference between a and b is close to zero.
78
- * @param a - The left value to compare
79
- * @param b - The right value to compare
80
- * @returns True if a almost equal to b, false otherwise
81
- */ MathUtil.equals = function equals(a, b) {
82
- return Math.abs(a - b) <= MathUtil.zeroTolerance;
83
- };
84
- /**
85
- * Determines whether the specified v is pow2.
86
- * @param v - The specified v
87
- * @returns True if the specified v is pow2, false otherwise
88
- */ MathUtil.isPowerOf2 = function isPowerOf2(v) {
89
- return (v & v - 1) === 0;
90
- };
91
- /**
92
- * Modify the specified r from radian to degree.
93
- * @param r - The specified r
94
- * @returns The degree value
95
- */ MathUtil.radianToDegree = function radianToDegree(r) {
96
- return r * MathUtil.radToDegreeFactor;
97
- };
98
- /**
99
- * Modify the specified d from degree to radian.
100
- * @param d - The specified d
101
- * @returns The radian value
102
- */ MathUtil.degreeToRadian = function degreeToRadian(d) {
103
- return d * MathUtil.degreeToRadFactor;
104
- };
105
- return MathUtil;
106
- }();
107
- (function() {
108
- /** The value for which all absolute numbers smaller than are considered equal to zero. */ MathUtil.zeroTolerance = 1e-6;
109
- })();
110
- (function() {
111
- /** The conversion factor that radian to degree. */ MathUtil.radToDegreeFactor = 180 / Math.PI;
112
- })();
113
- (function() {
114
- /** The conversion factor that degree to radian. */ MathUtil.degreeToRadFactor = Math.PI / 180;
115
- })();
116
-
117
- /**
118
- * Describes a color in the from of RGBA (in order: R, G, B, A).
119
- */ var Color = /*#__PURE__*/ function() {
120
- function Color(r, g, b, a) {
121
- if (r === void 0) r = 1;
122
- if (g === void 0) g = 1;
123
- if (b === void 0) b = 1;
124
- if (a === void 0) a = 1;
125
- /** @internal */ this._onValueChanged = null;
126
- this._r = r;
127
- this._g = g;
128
- this._b = b;
129
- this._a = a;
130
- }
131
- var _proto = Color.prototype;
132
- /**
133
- * Set the value of this color.
134
- * @param r - The red component of the color
135
- * @param g - The green component of the color
136
- * @param b - The blue component of the color
137
- * @param a - The alpha component of the color
138
- * @returns This color.
139
- */ _proto.set = function set(r, g, b, a) {
140
- this._r = r;
141
- this._g = g;
142
- this._b = b;
143
- this._a = a;
144
- this._onValueChanged && this._onValueChanged();
145
- return this;
146
- };
147
- /**
148
- * Determines the sum of this color and the specified color.
149
- * @param color - The specified color
150
- * @returns The added color
151
- */ _proto.add = function add(color) {
152
- this._r += color._r;
153
- this._g += color._g;
154
- this._b += color._b;
155
- this._a += color._a;
156
- this._onValueChanged && this._onValueChanged();
157
- return this;
158
- };
159
- /**
160
- * Scale this color by the given value.
161
- * @param s - The amount by which to scale the color
162
- * @returns The scaled color
163
- */ _proto.scale = function scale(s) {
164
- this._r *= s;
165
- this._g *= s;
166
- this._b *= s;
167
- this._a *= s;
168
- this._onValueChanged && this._onValueChanged();
169
- return this;
170
- };
171
- /**
172
- * Creates a clone of this color.
173
- * @returns A clone of this color
174
- */ _proto.clone = function clone() {
175
- var ret = new Color(this._r, this._g, this._b, this._a);
176
- return ret;
177
- };
178
- /**
179
- * Copy from color like object.
180
- * @param source - Color like object.
181
- * @returns This vector
182
- */ _proto.copyFrom = function copyFrom(source) {
183
- this._r = source.r;
184
- this._g = source.g;
185
- this._b = source.b;
186
- this._a = source.a;
187
- this._onValueChanged && this._onValueChanged();
188
- return this;
189
- };
190
- /**
191
- * Copy from array like object.
192
- * @param source - Array like object
193
- * @param offset - The start offset
194
- * @returns This color
195
- */ _proto.copyFromArray = function copyFromArray(source, offset) {
196
- if (offset === void 0) offset = 0;
197
- this._r = source[offset];
198
- this._g = source[offset + 1];
199
- this._b = source[offset + 2];
200
- this._a = source[offset + 3];
201
- this._onValueChanged && this._onValueChanged();
202
- return this;
203
- };
204
- /**
205
- * Copy the value of this color to an array.
206
- * @param out - The color
207
- * @param outOffset - The start offset
208
- */ _proto.copyToArray = function copyToArray(out, outOffset) {
209
- if (outOffset === void 0) outOffset = 0;
210
- out[outOffset] = this._r;
211
- out[outOffset + 1] = this._g;
212
- out[outOffset + 2] = this._b;
213
- out[outOffset + 3] = this._a;
214
- };
215
- /**
216
- * Modify components (r, g, b) of this color from gamma space to linear space.
217
- * @param out - The color in linear space
218
- * @returns The color in linear space
219
- */ _proto.toLinear = function toLinear(out) {
220
- out._r = Color.gammaToLinearSpace(this._r);
221
- out._g = Color.gammaToLinearSpace(this._g);
222
- out._b = Color.gammaToLinearSpace(this._b);
223
- this._onValueChanged && this._onValueChanged();
224
- return out;
225
- };
226
- /**
227
- * Modify components (r, g, b) of this color from linear space to gamma space.
228
- * @param out - The color in gamma space
229
- * @returns The color in gamma space
230
- */ _proto.toGamma = function toGamma(out) {
231
- out._r = Color.linearToGammaSpace(this._r);
232
- out._g = Color.linearToGammaSpace(this._g);
233
- out._b = Color.linearToGammaSpace(this._b);
234
- this._onValueChanged && this._onValueChanged();
235
- return out;
236
- };
237
- /**
238
- * Gets the brightness.
239
- * @returns The Hue-Saturation-Brightness (HSB) saturation for this
240
- */ _proto.getBrightness = function getBrightness() {
241
- var r = this.r;
242
- var g = this.g;
243
- var b = this.b;
244
- var max = r;
245
- var min = r;
246
- if (g > max) max = g;
247
- if (b > max) max = b;
248
- if (g < min) min = g;
249
- if (b < min) min = b;
250
- return (max + min) / 2;
251
- };
252
- /**
253
- * Serialize this color to a JSON representation.
254
- * @return A JSON representation of this color
255
- */ _proto.toJSON = function toJSON() {
256
- return {
257
- r: this._r,
258
- g: this._g,
259
- b: this._b,
260
- a: this._a
261
- };
262
- };
263
- /**
264
- * Modify a value from the gamma space to the linear space.
265
- * @param value - The value in gamma space
266
- * @returns The value in linear space
267
- */ Color.gammaToLinearSpace = function gammaToLinearSpace(value) {
268
- // https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_framebuffer_sRGB.txt
269
- // https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_texture_sRGB_decode.txt
270
- if (value <= 0.0) return 0.0;
271
- else if (value <= 0.04045) return value / 12.92;
272
- else if (value < 1.0) return Math.pow((value + 0.055) / 1.055, 2.4);
273
- else return Math.pow(value, 2.4);
274
- };
275
- /**
276
- * Modify a value from the linear space to the gamma space.
277
- * @param value - The value in linear space
278
- * @returns The value in gamma space
279
- */ Color.linearToGammaSpace = function linearToGammaSpace(value) {
280
- // https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_framebuffer_sRGB.txt
281
- // https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_texture_sRGB_decode.txt
282
- if (value <= 0.0) return 0.0;
283
- else if (value < 0.0031308) return 12.92 * value;
284
- else if (value < 1.0) return 1.055 * Math.pow(value, 0.41666) - 0.055;
285
- else return Math.pow(value, 0.41666);
286
- };
287
- /**
288
- * Determines whether the specified colors are equals.
289
- * @param left - The first color to compare
290
- * @param right - The second color to compare
291
- * @returns True if the specified colors are equals, false otherwise
292
- */ Color.equals = function equals(left, right) {
293
- return MathUtil.equals(left._r, right._r) && MathUtil.equals(left._g, right._g) && MathUtil.equals(left._b, right._b) && MathUtil.equals(left._a, right._a);
294
- };
295
- /**
296
- * Determines the sum of two colors.
297
- * @param left - The first color to add
298
- * @param right - The second color to add
299
- * @param out - The sum of two colors
300
- * @returns The added color
301
- */ Color.add = function add(left, right, out) {
302
- out._r = left._r + right._r;
303
- out._g = left._g + right._g;
304
- out._b = left._b + right._b;
305
- out._a = left._a + right._a;
306
- out._onValueChanged && out._onValueChanged();
307
- return out;
308
- };
309
- /**
310
- * Determines the difference between two colors.
311
- * @param left - The first color to subtract
312
- * @param right - The second color to subtract
313
- * @param out - The difference between two colors
314
- */ Color.subtract = function subtract(left, right, out) {
315
- out._r = left._r - right._r;
316
- out._g = left._g - right._g;
317
- out._b = left._b - right._b;
318
- out._a = left._a - right._a;
319
- out._onValueChanged && out._onValueChanged();
320
- };
321
- /**
322
- * Scale a color by the given value.
323
- * @param left - The color to scale
324
- * @param s - The amount by which to scale the color
325
- * @param out - The scaled color
326
- * @returns The scaled color
327
- */ Color.scale = function scale(left, s, out) {
328
- out._r = left._r * s;
329
- out._g = left._g * s;
330
- out._b = left._b * s;
331
- out._a = left._a * s;
332
- out._onValueChanged && out._onValueChanged();
333
- return out;
334
- };
335
- /**
336
- * Performs a linear interpolation between two color.
337
- * @param start - The first color
338
- * @param end - The second color
339
- * @param t - The blend amount where 0 returns start and 1 end
340
- * @param out - The result of linear blending between two color
341
- */ Color.lerp = function lerp(start, end, t, out) {
342
- var _r = start._r, _g = start._g, _b = start._b, _a = start._a;
343
- out._r = _r + (end._r - _r) * t;
344
- out._g = _g + (end._g - _g) * t;
345
- out._b = _b + (end._b - _b) * t;
346
- out._a = _a + (end._a - _a) * t;
347
- out._onValueChanged && out._onValueChanged();
348
- return out;
349
- };
350
- _create_class(Color, [
351
- {
352
- key: "r",
353
- get: /**
354
- * The red component of the color, 0~1.
355
- */ function get() {
356
- return this._r;
357
- },
358
- set: function set(value) {
359
- this._r = value;
360
- this._onValueChanged && this._onValueChanged();
361
- }
362
- },
363
- {
364
- key: "g",
365
- get: /**
366
- * The green component of the color, 0~1.
367
- */ function get() {
368
- return this._g;
369
- },
370
- set: function set(value) {
371
- this._g = value;
372
- this._onValueChanged && this._onValueChanged();
373
- }
374
- },
375
- {
376
- key: "b",
377
- get: /**
378
- * The blue component of the color, 0~1.
379
- */ function get() {
380
- return this._b;
381
- },
382
- set: function set(value) {
383
- this._b = value;
384
- this._onValueChanged && this._onValueChanged();
385
- }
386
- },
387
- {
388
- key: "a",
389
- get: /**
390
- * The alpha component of the color, 0~1.
391
- */ function get() {
392
- return this._a;
393
- },
394
- set: function set(value) {
395
- this._a = value;
396
- this._onValueChanged && this._onValueChanged();
397
- }
398
- }
399
- ]);
400
- return Color;
401
- }();
402
-
403
62
  /**
404
63
  * Sprite mask interaction.
405
64
  */ exports.SpriteMaskInteraction = void 0;
@@ -2120,20 +1779,28 @@ var ActiveChangeFlag;
2120
1779
  this._enabled = value;
2121
1780
  if (this._entity._isActiveInScene) {
2122
1781
  if (value) {
2123
- this._phasedActiveInScene = true;
2124
- this._onEnableInScene();
1782
+ if (!this._phasedActiveInScene) {
1783
+ this._phasedActiveInScene = true;
1784
+ this._onEnableInScene();
1785
+ }
2125
1786
  } else {
2126
- this._phasedActiveInScene = false;
2127
- this._onDisableInScene();
1787
+ if (this._phasedActiveInScene) {
1788
+ this._phasedActiveInScene = false;
1789
+ this._onDisableInScene();
1790
+ }
2128
1791
  }
2129
1792
  }
2130
1793
  if (this._entity.isActiveInHierarchy) {
2131
1794
  if (value) {
2132
- this._phasedActive = true;
2133
- this._onEnable();
1795
+ if (!this._phasedActive) {
1796
+ this._phasedActive = true;
1797
+ this._onEnable();
1798
+ }
2134
1799
  } else {
2135
- this._phasedActive = false;
2136
- this._onDisable();
1800
+ if (this._phasedActive) {
1801
+ this._phasedActive = false;
1802
+ this._onDisable();
1803
+ }
2137
1804
  }
2138
1805
  }
2139
1806
  }
@@ -9930,6 +9597,10 @@ var VertexElementIndex;
9930
9597
  var sphereInfo = primitiveInfo;
9931
9598
  PrimitiveMesh._setSphereData(this.resource, sphereInfo.radius, sphereInfo.segments, sphereInfo.noLongerAccessible, true, sphereInfo.vertexBuffer);
9932
9599
  break;
9600
+ case 7:
9601
+ var CCSphereInfo = primitiveInfo;
9602
+ PrimitiveMesh._setSubdivisionSurfaceSphereData(this.resource, CCSphereInfo.radius, CCSphereInfo.step, CCSphereInfo.noLongerAccessible, true, CCSphereInfo.vertexBuffer);
9603
+ break;
9933
9604
  case 1:
9934
9605
  var cuboidInfo = primitiveInfo;
9935
9606
  PrimitiveMesh._setCuboidData(this.resource, cuboidInfo.width, cuboidInfo.height, cuboidInfo.depth, cuboidInfo.noLongerAccessible, true, cuboidInfo.vertexBuffer);
@@ -9967,6 +9638,7 @@ var PrimitiveType;
9967
9638
  PrimitiveType[PrimitiveType["Torus"] = 4] = "Torus";
9968
9639
  PrimitiveType[PrimitiveType["Cone"] = 5] = "Cone";
9969
9640
  PrimitiveType[PrimitiveType["Capsule"] = 6] = "Capsule";
9641
+ PrimitiveType[PrimitiveType["CCSphere"] = 7] = "CCSphere";
9970
9642
  })(PrimitiveType || (PrimitiveType = {}));
9971
9643
  /**
9972
9644
  * @internal
@@ -9988,6 +9660,19 @@ var PrimitiveType;
9988
9660
  }
9989
9661
  return SphereRestoreInfo;
9990
9662
  }(PrimitiveRestoreInfo);
9663
+ /**
9664
+ * @internal
9665
+ */ var SubdivisionSurfaceSphereRestoreInfo = /*#__PURE__*/ function(PrimitiveRestoreInfo) {
9666
+ _inherits(SubdivisionSurfaceSphereRestoreInfo, PrimitiveRestoreInfo);
9667
+ function SubdivisionSurfaceSphereRestoreInfo(radius, step, vertexBuffer, noLongerAccessible) {
9668
+ var _this;
9669
+ _this = PrimitiveRestoreInfo.call(this, 7, vertexBuffer, noLongerAccessible) || this;
9670
+ _this.radius = radius;
9671
+ _this.step = step;
9672
+ return _this;
9673
+ }
9674
+ return SubdivisionSurfaceSphereRestoreInfo;
9675
+ }(PrimitiveRestoreInfo);
9991
9676
  /**
9992
9677
  * @internal
9993
9678
  */ var CuboidRestoreInfo = /*#__PURE__*/ function(PrimitiveRestoreInfo) {
@@ -10102,6 +9787,24 @@ var PrimitiveType;
10102
9787
  return sphereMesh;
10103
9788
  };
10104
9789
  /**
9790
+ * Create a sphere mesh by implementing Catmull-Clark Surface Subdivision Algorithm.
9791
+ * Max step is limited to 6.
9792
+ * @param engine - Engine
9793
+ * @param radius - Sphere radius
9794
+ * @param step - Number of subdiv steps
9795
+ * @param noLongerAccessible - No longer access the vertices of the mesh after creation
9796
+ * @returns Sphere model mesh
9797
+ */ PrimitiveMesh.createSubdivisionSurfaceSphere = function createSubdivisionSurfaceSphere(engine, radius, step, noLongerAccessible) {
9798
+ if (radius === void 0) radius = 0.5;
9799
+ if (step === void 0) step = 3;
9800
+ if (noLongerAccessible === void 0) noLongerAccessible = true;
9801
+ var sphereMesh = new ModelMesh(engine);
9802
+ PrimitiveMesh._setSubdivisionSurfaceSphereData(sphereMesh, radius, step, noLongerAccessible, false);
9803
+ var vertexBuffer = sphereMesh.vertexBufferBindings[0].buffer;
9804
+ engine.resourceManager.addContentRestorer(new PrimitiveMeshRestorer(sphereMesh, new SubdivisionSurfaceSphereRestoreInfo(radius, step, vertexBuffer, noLongerAccessible)));
9805
+ return sphereMesh;
9806
+ };
9807
+ /**
10105
9808
  * Create a cuboid mesh.
10106
9809
  * @param engine - Engine
10107
9810
  * @param width - Cuboid width
@@ -10231,6 +9934,90 @@ var PrimitiveType;
10231
9934
  };
10232
9935
  /**
10233
9936
  * @internal
9937
+ */ PrimitiveMesh._setSubdivisionSurfaceSphereData = function _setSubdivisionSurfaceSphereData(sphereMesh, radius, step, noLongerAccessible, isRestoreMode, restoreVertexBuffer) {
9938
+ // Max step is limited to 6. Because 7 step will generate a single mesh with over 98306 vertices
9939
+ step = engineMath.MathUtil.clamp(Math.floor(step), 1, 6);
9940
+ var positions = new Float32Array(3 * (6 * Math.pow(4, step) + 2));
9941
+ var cells = new Float32Array(24 * Math.pow(4, step));
9942
+ PrimitiveMesh._subdiveCatmullClark(step, positions, cells);
9943
+ var positionCount = positions.length / 3;
9944
+ var cellsCount = cells.length / 4;
9945
+ var poleOffset = positionCount + Math.pow(2, step + 1) - 1;
9946
+ // 16 extra vertices for pole uv
9947
+ // 2 vertices at each pole are idle
9948
+ var vertexCount = poleOffset + 16;
9949
+ var vertices = new Float32Array(vertexCount * 8);
9950
+ var indices = PrimitiveMesh._generateIndices(sphereMesh.engine, positionCount, cellsCount * 6);
9951
+ var seamCount = 0;
9952
+ var seamVertices = {};
9953
+ // Get normals, uvs, and scale to radius
9954
+ for(var i = 0; i < positionCount; i++){
9955
+ var offset = 3 * i;
9956
+ var x = positions[offset];
9957
+ var y = positions[offset + 1];
9958
+ var z = positions[offset + 2];
9959
+ var reciprocalLength = 1 / Math.sqrt(x * x + y * y + z * z);
9960
+ x *= reciprocalLength;
9961
+ y *= reciprocalLength;
9962
+ z *= reciprocalLength;
9963
+ offset = 8 * i;
9964
+ vertices[offset] = x * radius;
9965
+ vertices[offset + 1] = y * radius;
9966
+ vertices[offset + 2] = z * radius;
9967
+ vertices[offset + 3] = x;
9968
+ vertices[offset + 4] = y;
9969
+ vertices[offset + 5] = z;
9970
+ vertices[offset + 6] = (Math.PI - Math.atan2(z, x)) / (2 * Math.PI);
9971
+ vertices[offset + 7] = Math.acos(y) / Math.PI;
9972
+ if (vertices[offset + 6] === 0) {
9973
+ // Generate seam vertex
9974
+ var seamOffset = 8 * (positionCount + seamCount++);
9975
+ vertices.set(vertices.subarray(offset, offset + 8), seamOffset);
9976
+ vertices[seamOffset + 6] = 1.0;
9977
+ // Cache seam vertex
9978
+ seamVertices[offset / 8] = seamOffset / 8;
9979
+ }
9980
+ }
9981
+ // Get indices
9982
+ var offset1 = 0;
9983
+ this._spherePoleIdx = 0;
9984
+ for(var i1 = 0; i1 < cellsCount; i1++){
9985
+ var idx = 4 * i1;
9986
+ var indexA = cells[idx];
9987
+ var indexB = cells[idx + 1];
9988
+ var indexC = cells[idx + 2];
9989
+ var indexD = cells[idx + 3];
9990
+ // Handle seam by replacing vertex index to seam vertex index if necessary
9991
+ var floatIndexA = 8 * indexA;
9992
+ var floatIndexB = 8 * indexB;
9993
+ var floatIndexC = 8 * indexC;
9994
+ var floatIndexD = 8 * indexD;
9995
+ // If center Z is negative
9996
+ if (vertices[floatIndexA + 2] + vertices[floatIndexB + 2] + vertices[floatIndexC + 2] < 0) {
9997
+ vertices[floatIndexA + 6] === 0 && (indexA = seamVertices[indexA]);
9998
+ vertices[floatIndexB + 6] === 0 && (indexB = seamVertices[indexB]);
9999
+ vertices[floatIndexC + 6] === 0 && (indexC = seamVertices[indexC]);
10000
+ vertices[floatIndexD + 6] === 0 && (indexD = seamVertices[indexD]);
10001
+ }
10002
+ indices[offset1] = indexA;
10003
+ indices[offset1 + 1] = indexB;
10004
+ indices[offset1 + 2] = indexC;
10005
+ this._generateAndReplacePoleUV(indices, vertices, offset1, poleOffset);
10006
+ indices[offset1 + 3] = indexA;
10007
+ indices[offset1 + 4] = indexC;
10008
+ indices[offset1 + 5] = indexD;
10009
+ this._generateAndReplacePoleUV(indices, vertices, offset1 + 3, poleOffset);
10010
+ offset1 += 6;
10011
+ }
10012
+ if (!isRestoreMode) {
10013
+ var bounds = sphereMesh.bounds;
10014
+ bounds.min.set(-radius, -radius, -radius);
10015
+ bounds.max.set(radius, radius, radius);
10016
+ }
10017
+ PrimitiveMesh._initialize(sphereMesh, vertices, indices, noLongerAccessible, isRestoreMode, restoreVertexBuffer);
10018
+ };
10019
+ /**
10020
+ * @internal
10234
10021
  */ PrimitiveMesh._setSphereData = function _setSphereData(sphereMesh, radius, segments, noLongerAccessible, isRestoreMode, restoreVertexBuffer) {
10235
10022
  segments = Math.max(2, Math.floor(segments));
10236
10023
  var count = segments + 1;
@@ -10291,6 +10078,135 @@ var PrimitiveType;
10291
10078
  };
10292
10079
  /**
10293
10080
  * @internal
10081
+ */ PrimitiveMesh._subdiveCatmullClark = function _subdiveCatmullClark(step, positions, cells) {
10082
+ var edges = new Map();
10083
+ var faces = new Array();
10084
+ positions.set(PrimitiveMesh._sphereSeedPositions);
10085
+ cells.set(PrimitiveMesh._sphereSeedCells);
10086
+ for(var i = 0; i < step; i++){
10087
+ var cellCount = 6 * Math.pow(4, i);
10088
+ var positionCount = 4 * cellCount + 2;
10089
+ edges.clear();
10090
+ faces.length = 0;
10091
+ // Get cell face's facePoint
10092
+ for(var j = 0; j < cellCount; j++){
10093
+ var face = faces[j] = {
10094
+ facePoint: new engineMath.Vector3(),
10095
+ adjacentEdges: new Array(4)
10096
+ };
10097
+ // Get cell's edgePoint
10098
+ for(var k = 0; k < 4; k++){
10099
+ var offset = 3 * cells[4 * j + k];
10100
+ face.facePoint.x += 0.25 * positions[offset];
10101
+ face.facePoint.y += 0.25 * positions[offset + 1];
10102
+ face.facePoint.z += 0.25 * positions[offset + 2];
10103
+ }
10104
+ // Get cell edges
10105
+ for(var k1 = 0; k1 < 4; k1++){
10106
+ var vertexIdxA = cells[4 * j + k1];
10107
+ var vertexIdxB = cells[4 * j + (k1 + 1) % 4];
10108
+ var edgeIdxKey = Math.min(vertexIdxA, vertexIdxB) * positionCount + Math.max(vertexIdxA, vertexIdxB);
10109
+ if (!edges.has(edgeIdxKey)) {
10110
+ var edge = {
10111
+ edgePoint: new engineMath.Vector3(),
10112
+ edgePointIndex: undefined
10113
+ };
10114
+ var offsetA = 3 * vertexIdxA;
10115
+ var offsetB = 3 * vertexIdxB;
10116
+ edge.edgePoint.set(0.25 * (positions[offsetA] + positions[offsetB]), 0.25 * (positions[offsetA + 1] + positions[offsetB + 1]), 0.25 * (positions[offsetA + 2] + positions[offsetB + 2]));
10117
+ edges.set(edgeIdxKey, edge);
10118
+ }
10119
+ var edge1 = edges.get(edgeIdxKey);
10120
+ face.adjacentEdges[k1] = edge1;
10121
+ var edgePoint = edge1.edgePoint;
10122
+ var facePoint = face.facePoint;
10123
+ edgePoint.x += 0.25 * facePoint.x;
10124
+ edgePoint.y += 0.25 * facePoint.y;
10125
+ edgePoint.z += 0.25 * facePoint.z;
10126
+ }
10127
+ }
10128
+ var prePointCount = cellCount + 2;
10129
+ var edgePointOffset = prePointCount + cellCount;
10130
+ var pointIdx = 0;
10131
+ this._sphereEdgeIdx = 0;
10132
+ var preCells = cells.slice(0, 4 * cellCount);
10133
+ // Get New positions, which consists of updated positions of existing points, face points and edge points
10134
+ for(var j1 = 0; j1 < cellCount; j1++){
10135
+ // Add face point to new positions
10136
+ var face1 = faces[j1];
10137
+ face1.facePoint.copyToArray(positions, 3 * (prePointCount + j1));
10138
+ // Get the face point index
10139
+ var ic = prePointCount + j1;
10140
+ var id = void 0, ib = void 0, temp = void 0;
10141
+ // ia -- id -- ia
10142
+ // | | |
10143
+ // ib -- ic -- ib
10144
+ // | | |
10145
+ // ia -- id -- ia
10146
+ for(var k2 = 0; k2 < 4; k2++){
10147
+ // Get the updated existing point index
10148
+ var ia = preCells[pointIdx++];
10149
+ // ib and id share four edge points in one cell
10150
+ switch(k2){
10151
+ case 0:
10152
+ {
10153
+ var edgeB = face1.adjacentEdges[k2 % 4];
10154
+ var edgeD = face1.adjacentEdges[(k2 + 3) % 4];
10155
+ ib = this._calculateEdgeIndex(positions, edgeB, edgePointOffset);
10156
+ id = this._calculateEdgeIndex(positions, edgeD, edgePointOffset);
10157
+ temp = id;
10158
+ break;
10159
+ }
10160
+ case 1:
10161
+ case 2:
10162
+ {
10163
+ var edgeB1 = face1.adjacentEdges[k2 % 4];
10164
+ id = ib;
10165
+ ib = this._calculateEdgeIndex(positions, edgeB1, edgePointOffset);
10166
+ break;
10167
+ }
10168
+ case 3:
10169
+ {
10170
+ id = ib;
10171
+ ib = temp;
10172
+ break;
10173
+ }
10174
+ }
10175
+ var idx = 4 * (4 * j1 + k2);
10176
+ cells[idx] = ia;
10177
+ cells[idx + 1] = ib;
10178
+ cells[idx + 2] = ic;
10179
+ cells[idx + 3] = id;
10180
+ }
10181
+ }
10182
+ }
10183
+ };
10184
+ /**
10185
+ * Duplicate vertices at the poles and adjust their UV coordinates.
10186
+ */ PrimitiveMesh._generateAndReplacePoleUV = function _generateAndReplacePoleUV(indices, vertices, idx, poleOffset) {
10187
+ var v = vertices[8 * indices[idx] + 7];
10188
+ if (v === 0 || v === 1) {
10189
+ var offset = 8 * indices[idx];
10190
+ var addedOffset = 8 * (poleOffset + this._spherePoleIdx);
10191
+ vertices.set(vertices.subarray(offset, offset + 8), addedOffset);
10192
+ vertices[addedOffset + 6] = 0.5 * (vertices[offset + 6] + vertices[8 * indices[idx + 1] + 6] + vertices[8 * indices[idx + 2] + 6] - 0.5);
10193
+ indices[idx] = poleOffset + this._spherePoleIdx++;
10194
+ }
10195
+ };
10196
+ /**
10197
+ * Get edge point index for subdivision surface sphere.
10198
+ */ PrimitiveMesh._calculateEdgeIndex = function _calculateEdgeIndex(positions, edge, offset) {
10199
+ if (edge.edgePointIndex !== undefined) {
10200
+ return edge.edgePointIndex;
10201
+ } else {
10202
+ edge.edgePoint.copyToArray(positions, 3 * (offset + PrimitiveMesh._sphereEdgeIdx));
10203
+ var index = offset + PrimitiveMesh._sphereEdgeIdx++;
10204
+ edge.edgePointIndex = index;
10205
+ return index;
10206
+ }
10207
+ };
10208
+ /**
10209
+ * @internal
10294
10210
  */ PrimitiveMesh._setCuboidData = function _setCuboidData(cuboidMesh, width, height, depth, noLongerAccessible, isRestoreMode, restoreVertexBuffer) {
10295
10211
  var halfWidth = width / 2;
10296
10212
  var halfHeight = height / 2;
@@ -10920,6 +10836,68 @@ var PrimitiveType;
10920
10836
  (function() {
10921
10837
  PrimitiveMesh._tempVec30 = new engineMath.Vector3();
10922
10838
  })();
10839
+ (function() {
10840
+ PrimitiveMesh._sphereSeedPositions = new Float32Array([
10841
+ -1,
10842
+ 1,
10843
+ 1,
10844
+ -1,
10845
+ -1,
10846
+ 1,
10847
+ 1,
10848
+ -1,
10849
+ 1,
10850
+ 1,
10851
+ 1,
10852
+ 1,
10853
+ 1,
10854
+ -1,
10855
+ -1,
10856
+ 1,
10857
+ 1,
10858
+ -1,
10859
+ -1,
10860
+ -1,
10861
+ -1,
10862
+ -1,
10863
+ 1,
10864
+ -1
10865
+ ]);
10866
+ })();
10867
+ (function() {
10868
+ PrimitiveMesh._sphereSeedCells = new Float32Array([
10869
+ 0,
10870
+ 1,
10871
+ 2,
10872
+ 3,
10873
+ 3,
10874
+ 2,
10875
+ 4,
10876
+ 5,
10877
+ 5,
10878
+ 4,
10879
+ 6,
10880
+ 7,
10881
+ 7,
10882
+ 0,
10883
+ 3,
10884
+ 5,
10885
+ 7,
10886
+ 6,
10887
+ 1,
10888
+ 0,
10889
+ 6,
10890
+ 4,
10891
+ 2,
10892
+ 1
10893
+ ]);
10894
+ })();
10895
+ (function() {
10896
+ PrimitiveMesh._sphereEdgeIdx = 0;
10897
+ })();
10898
+ (function() {
10899
+ PrimitiveMesh._spherePoleIdx = 0;
10900
+ })();
10923
10901
 
10924
10902
  /**
10925
10903
  * Mesh skin data, equal glTF skins define
@@ -11464,8 +11442,10 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
11464
11442
  }
11465
11443
  mesh.addSubMesh(this._getSubMeshFromPool(vertexStartIndex, vertexCount));
11466
11444
  batchedQueue[curMeshIndex] = preElement;
11467
- this._vertexBuffers[_flushId].setData(vertices, 0, 0, vertexIndex);
11468
- this._indiceBuffers[_flushId].setData(indices, 0, 0, indiceIndex);
11445
+ // Set data option use Discard, or will resulted in performance slowdown when open antialias and cross-rendering of 3D and 2D elements.
11446
+ // Device: iphone X(16.7.2)、iphone 15 pro max(17.1.1)、iphone XR(17.1.2) etc.
11447
+ this._vertexBuffers[_flushId].setData(vertices, 0, 0, vertexIndex, exports.SetDataOptions.Discard);
11448
+ this._indiceBuffers[_flushId].setData(indices, 0, 0, indiceIndex, exports.SetDataOptions.Discard);
11469
11449
  };
11470
11450
  _proto._getSubMeshFromPool = function _getSubMeshFromPool(start, count) {
11471
11451
  var subMesh = this._subMeshPool.getFromPool();
@@ -12495,6 +12475,9 @@ var /**
12495
12475
  __decorate([
12496
12476
  assignmentClone
12497
12477
  ], SpriteMask.prototype, "influenceLayers", void 0);
12478
+ __decorate([
12479
+ ignoreClone
12480
+ ], SpriteMask.prototype, "_verticesData", void 0);
12498
12481
  __decorate([
12499
12482
  ignoreClone
12500
12483
  ], SpriteMask.prototype, "_sprite", void 0);
@@ -12778,8 +12761,8 @@ var /**
12778
12761
  } else {
12779
12762
  word += char;
12780
12763
  wordWidth += charInfo.xAdvance;
12781
- wordMaxAscent = lineMaxAscent = Math.max(wordMaxAscent, ascent);
12782
- wordMaxDescent = lineMaxDescent = Math.max(wordMaxDescent, descent);
12764
+ wordMaxAscent = Math.max(wordMaxAscent, ascent);
12765
+ wordMaxDescent = Math.max(wordMaxDescent, descent);
12783
12766
  }
12784
12767
  }
12785
12768
  }
@@ -13010,13 +12993,15 @@ var /**
13010
12993
  ];
13011
12994
  })();
13012
12995
  (function() {
13013
- /** These characters are all tall to help calculate the height required for text. */ TextUtils._measureString = "|\xc9q\xc5";
12996
+ // _heightMultiplier used to measure the height of text, but in miniprogram performance is different from h5.
12997
+ // so can set _heightMultiplier to adapt miniprogram, the larger the value, the worse the performance.
12998
+ /** @internal */ TextUtils._heightMultiplier = 2;
13014
12999
  })();
13015
13000
  (function() {
13016
- TextUtils._measureBaseline = "M";
13001
+ /** These characters are all tall to help calculate the height required for text. */ TextUtils._measureString = "|\xc9q\xc5";
13017
13002
  })();
13018
13003
  (function() {
13019
- TextUtils._heightMultiplier = 2;
13004
+ TextUtils._measureBaseline = "M";
13020
13005
  })();
13021
13006
  (function() {
13022
13007
  TextUtils._baselineMultiplier = 1.4;
@@ -13099,7 +13084,8 @@ var /**
13099
13084
  _proto._createFontAtlas = function _createFontAtlas() {
13100
13085
  var _this = this, engine = _this._engine;
13101
13086
  var fontAtlas = new FontAtlas(engine);
13102
- var texture = new Texture2D(engine, 256, 256);
13087
+ var texture = new Texture2D(engine, 256, 256, exports.TextureFormat.R8G8B8A8, false);
13088
+ texture.filterMode = exports.TextureFilterMode.Bilinear;
13103
13089
  fontAtlas.texture = texture;
13104
13090
  fontAtlas.isGCIgnored = texture.isGCIgnored = true;
13105
13091
  this._fontAtlases.push(fontAtlas);
@@ -13337,7 +13323,7 @@ var /**
13337
13323
  /**
13338
13324
  * @internal
13339
13325
  */ _proto._render = function _render(context) {
13340
- if (this._text === "" || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0) {
13326
+ if (this._isTextNoVisible()) {
13341
13327
  return;
13342
13328
  }
13343
13329
  if (this._isContainDirtyFlag(0x10)) {
@@ -13429,8 +13415,8 @@ var /**
13429
13415
  }
13430
13416
  };
13431
13417
  _proto._updateLocalData = function _updateLocalData() {
13432
- var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
13433
13418
  var _this__localBounds = this._localBounds, min = _this__localBounds.min, max = _this__localBounds.max;
13419
+ var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
13434
13420
  var textMetrics = this.enableWrapping ? TextUtils.measureTextWithWrap(this) : TextUtils.measureTextWithoutWrap(this);
13435
13421
  var height = textMetrics.height, lines = textMetrics.lines, lineWidths = textMetrics.lineWidths, lineHeight = textMetrics.lineHeight, lineMaxSizes = textMetrics.lineMaxSizes;
13436
13422
  var charRenderDataPool = TextRenderer._charRenderDataPool;
@@ -13498,7 +13484,7 @@ var /**
13498
13484
  var left = startX * pixelsPerUnitReciprocal;
13499
13485
  var right = (startX + w) * pixelsPerUnitReciprocal;
13500
13486
  var top = (startY + ascent) * pixelsPerUnitReciprocal;
13501
- var bottom = (startY - descent + 1) * pixelsPerUnitReciprocal;
13487
+ var bottom = (startY - descent) * pixelsPerUnitReciprocal;
13502
13488
  localPositions.set(left, top, right, bottom);
13503
13489
  i === firstLine && (maxY = Math.max(maxY, top));
13504
13490
  minY = Math.min(minY, bottom);
@@ -13539,6 +13525,9 @@ var /**
13539
13525
  Renderer1.prototype._onTransformChanged.call(this, bit);
13540
13526
  this._setDirtyFlagTrue(0x4 | 0x8);
13541
13527
  };
13528
+ _proto._isTextNoVisible = function _isTextNoVisible() {
13529
+ return this._text === "" || this._fontSize === 0 || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0;
13530
+ };
13542
13531
  _create_class(TextRenderer, [
13543
13532
  {
13544
13533
  key: "color",
@@ -13741,6 +13730,16 @@ var /**
13741
13730
  get: /**
13742
13731
  * The bounding volume of the TextRenderer.
13743
13732
  */ function get() {
13733
+ if (this._isTextNoVisible()) {
13734
+ if (this._isContainDirtyFlag(0x8)) {
13735
+ var localBounds = this._localBounds;
13736
+ localBounds.min.set(0, 0, 0);
13737
+ localBounds.max.set(0, 0, 0);
13738
+ this._updateBounds(this._bounds);
13739
+ this._setDirtyFlagFalse(0x8);
13740
+ }
13741
+ return this._bounds;
13742
+ }
13744
13743
  this._isContainDirtyFlag(0x1) && this._resetSubFont();
13745
13744
  this._isContainDirtyFlag(0x2) && this._updateLocalData();
13746
13745
  this._isContainDirtyFlag(0x4) && this._updatePosition();
@@ -15729,6 +15728,66 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
15729
15728
  }
15730
15729
  }
15731
15730
  };
15731
+ /**
15732
+ * @internal
15733
+ */ SystemInfo._detectSIMDSupported = function _detectSIMDSupported() {
15734
+ if (this._simdSupported === null) {
15735
+ this._simdSupported = WebAssembly.validate(new Uint8Array([
15736
+ 0,
15737
+ 97,
15738
+ 115,
15739
+ 109,
15740
+ 1,
15741
+ 0,
15742
+ 0,
15743
+ 0,
15744
+ 1,
15745
+ 4,
15746
+ 1,
15747
+ 96,
15748
+ 0,
15749
+ 0,
15750
+ 3,
15751
+ 3,
15752
+ 2,
15753
+ 0,
15754
+ 0,
15755
+ 5,
15756
+ 3,
15757
+ 1,
15758
+ 0,
15759
+ 1,
15760
+ 12,
15761
+ 1,
15762
+ 0,
15763
+ 10,
15764
+ 22,
15765
+ 2,
15766
+ 12,
15767
+ 0,
15768
+ 65,
15769
+ 0,
15770
+ 65,
15771
+ 0,
15772
+ 65,
15773
+ 0,
15774
+ 252,
15775
+ 10,
15776
+ 0,
15777
+ 0,
15778
+ 11,
15779
+ 7,
15780
+ 0,
15781
+ 65,
15782
+ 0,
15783
+ 253,
15784
+ 15,
15785
+ 26,
15786
+ 11
15787
+ ]));
15788
+ }
15789
+ return this._simdSupported;
15790
+ };
15732
15791
  _create_class(SystemInfo, null, [
15733
15792
  {
15734
15793
  key: "devicePixelRatio",
@@ -15747,6 +15806,9 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
15747
15806
  (function() {
15748
15807
  /** The operating system is running on. */ SystemInfo.operatingSystem = "";
15749
15808
  })();
15809
+ (function() {
15810
+ /** Whether the system support SIMD. */ SystemInfo._simdSupported = null;
15811
+ })();
15750
15812
  SystemInfo._initialize();
15751
15813
 
15752
15814
  /**
@@ -18580,6 +18642,8 @@ __decorate([
18580
18642
  _this = ReferResource1.call(this, engine) || this;
18581
18643
  /** @internal */ _this._renderStates = [] // todo: later will as a part of shaderData when shader effect frame is OK, that is more powerful and flexible.
18582
18644
  ;
18645
+ /** @internal */ _this._priority = 0 // todo: temporary resolution of submesh rendering order issue.
18646
+ ;
18583
18647
  _this._shaderData = new ShaderData(ShaderDataGroup.Material);
18584
18648
  _this.shader = shader;
18585
18649
  return _this;
@@ -19049,11 +19113,11 @@ ShaderPool.init();
19049
19113
  }
19050
19114
  var meshMagentaMaterial = new Material(_assert_this_initialized(_this), Shader.find("unlit"));
19051
19115
  meshMagentaMaterial.isGCIgnored = true;
19052
- meshMagentaMaterial.shaderData.setColor("material_BaseColor", new Color(1.0, 0.0, 1.01, 1.0));
19116
+ meshMagentaMaterial.shaderData.setColor("material_BaseColor", new engineMath.Color(1.0, 0.0, 1.01, 1.0));
19053
19117
  _this._meshMagentaMaterial = meshMagentaMaterial;
19054
19118
  var particleMagentaMaterial = new Material(_assert_this_initialized(_this), Shader.find("particle-shader"));
19055
19119
  particleMagentaMaterial.isGCIgnored = true;
19056
- particleMagentaMaterial.shaderData.setColor("material_BaseColor", new Color(1.0, 0.0, 1.01, 1.0));
19120
+ particleMagentaMaterial.shaderData.setColor("material_BaseColor", new engineMath.Color(1.0, 0.0, 1.01, 1.0));
19057
19121
  _this._particleMagentaMaterial = particleMagentaMaterial;
19058
19122
  var innerSettings = _this._settings;
19059
19123
  var colorSpace = configuration.colorSpace || exports.ColorSpace.Linear;
@@ -21869,12 +21933,38 @@ var passNum = 0;
21869
21933
  /**
21870
21934
  * @internal
21871
21935
  */ RenderQueue._compareFromNearToFar = function _compareFromNearToFar(a, b) {
21872
- return a.data.component.priority - b.data.component.priority || a.data.component._distanceForSort - b.data.component._distanceForSort;
21936
+ var dataA = a.data;
21937
+ var dataB = b.data;
21938
+ var componentA = dataA.component;
21939
+ var componentB = dataB.component;
21940
+ var priorityOrder = componentA.priority - componentB.priority;
21941
+ if (priorityOrder !== 0) {
21942
+ return priorityOrder;
21943
+ }
21944
+ // make suer from the same renderer.
21945
+ if (componentA.instanceId === componentB.instanceId) {
21946
+ return dataA.material._priority - dataB.material._priority || componentA._distanceForSort - componentB._distanceForSort;
21947
+ } else {
21948
+ return componentA._distanceForSort - componentB._distanceForSort;
21949
+ }
21873
21950
  };
21874
21951
  /**
21875
21952
  * @internal
21876
21953
  */ RenderQueue._compareFromFarToNear = function _compareFromFarToNear(a, b) {
21877
- return a.data.component.priority - b.data.component.priority || b.data.component._distanceForSort - a.data.component._distanceForSort;
21954
+ var dataA = a.data;
21955
+ var dataB = b.data;
21956
+ var componentA = dataA.component;
21957
+ var componentB = dataB.component;
21958
+ var priorityOrder = componentA.priority - componentB.priority;
21959
+ if (priorityOrder !== 0) {
21960
+ return priorityOrder;
21961
+ }
21962
+ // make suer from the same renderer.
21963
+ if (componentA.instanceId === componentB.instanceId) {
21964
+ return dataA.material._priority - dataB.material._priority || componentB._distanceForSort - componentA._distanceForSort;
21965
+ } else {
21966
+ return componentB._distanceForSort - componentA._distanceForSort;
21967
+ }
21878
21968
  };
21879
21969
  return RenderQueue;
21880
21970
  }();
@@ -25245,6 +25335,7 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
25245
25335
  _this = EngineObject1.call(this, null) || this;
25246
25336
  _this.name = name;
25247
25337
  _this./** @internal */ _curveBindings = [];
25338
+ _this./** @internal */ _updateFlagManager = new UpdateFlagManager();
25248
25339
  _this._length = 0;
25249
25340
  _this._events = [];
25250
25341
  return _this;
@@ -25272,11 +25363,13 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
25272
25363
  while(--index >= 0 && eventTime < events[index].time);
25273
25364
  events.splice(index + 1, 0, newEvent);
25274
25365
  }
25366
+ this._updateFlagManager.dispatch();
25275
25367
  };
25276
25368
  /**
25277
25369
  * Clears all events from the clip.
25278
25370
  */ _proto.clearEvents = function clearEvents() {
25279
25371
  this._events.length = 0;
25372
+ this._updateFlagManager.dispatch();
25280
25373
  };
25281
25374
  _proto.addCurveBinding = function addCurveBinding(entityPath, componentType, propertyOrSetPropertyPathOrComponentIndex, curveOrSetPropertyPathOrGetPropertyPath, curveOrGetPropertyPath, curve) {
25282
25375
  var curveBinding = new AnimationClipCurveBinding();
@@ -26833,26 +26926,31 @@ exports.AnimatorLayerBlendingMode = void 0;
26833
26926
  }
26834
26927
  };
26835
26928
  _proto._saveAnimatorEventHandlers = function _saveAnimatorEventHandlers(state, animatorStateData) {
26929
+ var _this = this;
26836
26930
  var eventHandlerPool = this._animationEventHandlerPool;
26837
26931
  var scripts = [];
26838
- this._entity.getComponents(Script, scripts);
26839
- var scriptCount = scripts.length;
26840
26932
  var eventHandlers = animatorStateData.eventHandlers;
26841
- var events = state.clip.events;
26842
- eventHandlers.length = 0;
26843
- for(var i = 0, n = events.length; i < n; i++){
26844
- var event = events[i];
26845
- var eventHandler = eventHandlerPool.getFromPool();
26846
- var funcName = event.functionName;
26847
- var handlers = eventHandler.handlers;
26848
- eventHandler.event = event;
26849
- handlers.length = 0;
26850
- for(var j = scriptCount - 1; j >= 0; j--){
26851
- var handler = scripts[j][funcName];
26852
- handler && handlers.push(handler);
26933
+ var clipChangedListener = function() {
26934
+ _this._entity.getComponents(Script, scripts);
26935
+ var scriptCount = scripts.length;
26936
+ var events = state.clip.events;
26937
+ eventHandlers.length = 0;
26938
+ for(var i = 0, n = events.length; i < n; i++){
26939
+ var event = events[i];
26940
+ var eventHandler = eventHandlerPool.getFromPool();
26941
+ var funcName = event.functionName;
26942
+ var handlers = eventHandler.handlers;
26943
+ eventHandler.event = event;
26944
+ handlers.length = 0;
26945
+ for(var j = scriptCount - 1; j >= 0; j--){
26946
+ var handler = scripts[j][funcName];
26947
+ handler && handlers.push(handler);
26948
+ }
26949
+ eventHandlers.push(eventHandler);
26853
26950
  }
26854
- eventHandlers.push(eventHandler);
26855
- }
26951
+ };
26952
+ clipChangedListener();
26953
+ state._updateFlagManager.addListener(clipChangedListener);
26856
26954
  };
26857
26955
  _proto._clearCrossData = function _clearCrossData(animatorLayerData) {
26858
26956
  animatorLayerData.crossCurveMark++;
@@ -27463,9 +27561,11 @@ __decorate([
27463
27561
  this./** @internal */ _onStateEnterScripts = [];
27464
27562
  this./** @internal */ _onStateUpdateScripts = [];
27465
27563
  this./** @internal */ _onStateExitScripts = [];
27564
+ this./** @internal */ _updateFlagManager = new UpdateFlagManager();
27466
27565
  this._clipStartTime = 0;
27467
27566
  this._clipEndTime = 1;
27468
27567
  this._transitions = [];
27568
+ this._onClipChanged = this._onClipChanged.bind(this);
27469
27569
  }
27470
27570
  var _proto = AnimatorState.prototype;
27471
27571
  /**
@@ -27539,6 +27639,11 @@ __decorate([
27539
27639
  index2 !== -1 && this._onStateExitScripts.splice(index2, 1);
27540
27640
  }
27541
27641
  };
27642
+ /**
27643
+ * @internal
27644
+ */ _proto._onClipChanged = function _onClipChanged() {
27645
+ this._updateFlagManager.dispatch();
27646
+ };
27542
27647
  _create_class(AnimatorState, [
27543
27648
  {
27544
27649
  key: "transitions",
@@ -27556,8 +27661,17 @@ __decorate([
27556
27661
  return this._clip;
27557
27662
  },
27558
27663
  set: function set(clip) {
27664
+ var lastClip = this._clip;
27665
+ if (lastClip === clip) {
27666
+ return;
27667
+ }
27668
+ if (lastClip) {
27669
+ lastClip._updateFlagManager.removeListener(this._onClipChanged);
27670
+ }
27559
27671
  this._clip = clip;
27560
27672
  this._clipEndTime = Math.min(this._clipEndTime, 1);
27673
+ this._onClipChanged();
27674
+ clip._updateFlagManager.addListener(this._onClipChanged);
27561
27675
  }
27562
27676
  },
27563
27677
  {