@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/module.js CHANGED
@@ -1,4 +1,4 @@
1
- import { MathUtil as MathUtil$1, Vector2, BoundingBox, Rect, Vector4, Quaternion, Vector3, Matrix3x3, Matrix, Color as Color$1, Ray, Plane, BoundingSphere, FrustumFace, CollisionUtil, BoundingFrustum, Rand } from '@galacean/engine-math';
1
+ import { MathUtil, Vector2, BoundingBox, Rect, Vector4, Quaternion, Vector3, Matrix3x3, Matrix, Color, Ray, Plane, BoundingSphere, FrustumFace, CollisionUtil, BoundingFrustum, Rand } from '@galacean/engine-math';
2
2
 
3
3
  /**
4
4
  * The platform (including operating system and hardware) is running on.
@@ -55,347 +55,6 @@ function _inherits(subClass, superClass) {
55
55
  if (superClass) _set_prototype_of(subClass, superClass);
56
56
  }
57
57
 
58
- /**
59
- * Common utility methods for math operations.
60
- */ var MathUtil = /*#__PURE__*/ function() {
61
- function MathUtil() {}
62
- /**
63
- * Clamps the specified value.
64
- * @param v - The specified value
65
- * @param min - The min value
66
- * @param max - The max value
67
- * @returns The result of clamping a value between min and max
68
- */ MathUtil.clamp = function clamp(v, min, max) {
69
- return Math.max(min, Math.min(max, v));
70
- };
71
- /**
72
- * Checks if a and b are almost equals.
73
- * The absolute value of the difference between a and b is close to zero.
74
- * @param a - The left value to compare
75
- * @param b - The right value to compare
76
- * @returns True if a almost equal to b, false otherwise
77
- */ MathUtil.equals = function equals(a, b) {
78
- return Math.abs(a - b) <= MathUtil.zeroTolerance;
79
- };
80
- /**
81
- * Determines whether the specified v is pow2.
82
- * @param v - The specified v
83
- * @returns True if the specified v is pow2, false otherwise
84
- */ MathUtil.isPowerOf2 = function isPowerOf2(v) {
85
- return (v & v - 1) === 0;
86
- };
87
- /**
88
- * Modify the specified r from radian to degree.
89
- * @param r - The specified r
90
- * @returns The degree value
91
- */ MathUtil.radianToDegree = function radianToDegree(r) {
92
- return r * MathUtil.radToDegreeFactor;
93
- };
94
- /**
95
- * Modify the specified d from degree to radian.
96
- * @param d - The specified d
97
- * @returns The radian value
98
- */ MathUtil.degreeToRadian = function degreeToRadian(d) {
99
- return d * MathUtil.degreeToRadFactor;
100
- };
101
- return MathUtil;
102
- }();
103
- (function() {
104
- /** The value for which all absolute numbers smaller than are considered equal to zero. */ MathUtil.zeroTolerance = 1e-6;
105
- })();
106
- (function() {
107
- /** The conversion factor that radian to degree. */ MathUtil.radToDegreeFactor = 180 / Math.PI;
108
- })();
109
- (function() {
110
- /** The conversion factor that degree to radian. */ MathUtil.degreeToRadFactor = Math.PI / 180;
111
- })();
112
-
113
- /**
114
- * Describes a color in the from of RGBA (in order: R, G, B, A).
115
- */ var Color = /*#__PURE__*/ function() {
116
- function Color(r, g, b, a) {
117
- if (r === void 0) r = 1;
118
- if (g === void 0) g = 1;
119
- if (b === void 0) b = 1;
120
- if (a === void 0) a = 1;
121
- /** @internal */ this._onValueChanged = null;
122
- this._r = r;
123
- this._g = g;
124
- this._b = b;
125
- this._a = a;
126
- }
127
- var _proto = Color.prototype;
128
- /**
129
- * Set the value of this color.
130
- * @param r - The red component of the color
131
- * @param g - The green component of the color
132
- * @param b - The blue component of the color
133
- * @param a - The alpha component of the color
134
- * @returns This color.
135
- */ _proto.set = function set(r, g, b, a) {
136
- this._r = r;
137
- this._g = g;
138
- this._b = b;
139
- this._a = a;
140
- this._onValueChanged && this._onValueChanged();
141
- return this;
142
- };
143
- /**
144
- * Determines the sum of this color and the specified color.
145
- * @param color - The specified color
146
- * @returns The added color
147
- */ _proto.add = function add(color) {
148
- this._r += color._r;
149
- this._g += color._g;
150
- this._b += color._b;
151
- this._a += color._a;
152
- this._onValueChanged && this._onValueChanged();
153
- return this;
154
- };
155
- /**
156
- * Scale this color by the given value.
157
- * @param s - The amount by which to scale the color
158
- * @returns The scaled color
159
- */ _proto.scale = function scale(s) {
160
- this._r *= s;
161
- this._g *= s;
162
- this._b *= s;
163
- this._a *= s;
164
- this._onValueChanged && this._onValueChanged();
165
- return this;
166
- };
167
- /**
168
- * Creates a clone of this color.
169
- * @returns A clone of this color
170
- */ _proto.clone = function clone() {
171
- var ret = new Color(this._r, this._g, this._b, this._a);
172
- return ret;
173
- };
174
- /**
175
- * Copy from color like object.
176
- * @param source - Color like object.
177
- * @returns This vector
178
- */ _proto.copyFrom = function copyFrom(source) {
179
- this._r = source.r;
180
- this._g = source.g;
181
- this._b = source.b;
182
- this._a = source.a;
183
- this._onValueChanged && this._onValueChanged();
184
- return this;
185
- };
186
- /**
187
- * Copy from array like object.
188
- * @param source - Array like object
189
- * @param offset - The start offset
190
- * @returns This color
191
- */ _proto.copyFromArray = function copyFromArray(source, offset) {
192
- if (offset === void 0) offset = 0;
193
- this._r = source[offset];
194
- this._g = source[offset + 1];
195
- this._b = source[offset + 2];
196
- this._a = source[offset + 3];
197
- this._onValueChanged && this._onValueChanged();
198
- return this;
199
- };
200
- /**
201
- * Copy the value of this color to an array.
202
- * @param out - The color
203
- * @param outOffset - The start offset
204
- */ _proto.copyToArray = function copyToArray(out, outOffset) {
205
- if (outOffset === void 0) outOffset = 0;
206
- out[outOffset] = this._r;
207
- out[outOffset + 1] = this._g;
208
- out[outOffset + 2] = this._b;
209
- out[outOffset + 3] = this._a;
210
- };
211
- /**
212
- * Modify components (r, g, b) of this color from gamma space to linear space.
213
- * @param out - The color in linear space
214
- * @returns The color in linear space
215
- */ _proto.toLinear = function toLinear(out) {
216
- out._r = Color.gammaToLinearSpace(this._r);
217
- out._g = Color.gammaToLinearSpace(this._g);
218
- out._b = Color.gammaToLinearSpace(this._b);
219
- this._onValueChanged && this._onValueChanged();
220
- return out;
221
- };
222
- /**
223
- * Modify components (r, g, b) of this color from linear space to gamma space.
224
- * @param out - The color in gamma space
225
- * @returns The color in gamma space
226
- */ _proto.toGamma = function toGamma(out) {
227
- out._r = Color.linearToGammaSpace(this._r);
228
- out._g = Color.linearToGammaSpace(this._g);
229
- out._b = Color.linearToGammaSpace(this._b);
230
- this._onValueChanged && this._onValueChanged();
231
- return out;
232
- };
233
- /**
234
- * Gets the brightness.
235
- * @returns The Hue-Saturation-Brightness (HSB) saturation for this
236
- */ _proto.getBrightness = function getBrightness() {
237
- var r = this.r;
238
- var g = this.g;
239
- var b = this.b;
240
- var max = r;
241
- var min = r;
242
- if (g > max) max = g;
243
- if (b > max) max = b;
244
- if (g < min) min = g;
245
- if (b < min) min = b;
246
- return (max + min) / 2;
247
- };
248
- /**
249
- * Serialize this color to a JSON representation.
250
- * @return A JSON representation of this color
251
- */ _proto.toJSON = function toJSON() {
252
- return {
253
- r: this._r,
254
- g: this._g,
255
- b: this._b,
256
- a: this._a
257
- };
258
- };
259
- /**
260
- * Modify a value from the gamma space to the linear space.
261
- * @param value - The value in gamma space
262
- * @returns The value in linear space
263
- */ Color.gammaToLinearSpace = function gammaToLinearSpace(value) {
264
- // https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_framebuffer_sRGB.txt
265
- // https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_texture_sRGB_decode.txt
266
- if (value <= 0.0) return 0.0;
267
- else if (value <= 0.04045) return value / 12.92;
268
- else if (value < 1.0) return Math.pow((value + 0.055) / 1.055, 2.4);
269
- else return Math.pow(value, 2.4);
270
- };
271
- /**
272
- * Modify a value from the linear space to the gamma space.
273
- * @param value - The value in linear space
274
- * @returns The value in gamma space
275
- */ Color.linearToGammaSpace = function linearToGammaSpace(value) {
276
- // https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_framebuffer_sRGB.txt
277
- // https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_texture_sRGB_decode.txt
278
- if (value <= 0.0) return 0.0;
279
- else if (value < 0.0031308) return 12.92 * value;
280
- else if (value < 1.0) return 1.055 * Math.pow(value, 0.41666) - 0.055;
281
- else return Math.pow(value, 0.41666);
282
- };
283
- /**
284
- * Determines whether the specified colors are equals.
285
- * @param left - The first color to compare
286
- * @param right - The second color to compare
287
- * @returns True if the specified colors are equals, false otherwise
288
- */ Color.equals = function equals(left, right) {
289
- 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);
290
- };
291
- /**
292
- * Determines the sum of two colors.
293
- * @param left - The first color to add
294
- * @param right - The second color to add
295
- * @param out - The sum of two colors
296
- * @returns The added color
297
- */ Color.add = function add(left, right, out) {
298
- out._r = left._r + right._r;
299
- out._g = left._g + right._g;
300
- out._b = left._b + right._b;
301
- out._a = left._a + right._a;
302
- out._onValueChanged && out._onValueChanged();
303
- return out;
304
- };
305
- /**
306
- * Determines the difference between two colors.
307
- * @param left - The first color to subtract
308
- * @param right - The second color to subtract
309
- * @param out - The difference between two colors
310
- */ Color.subtract = function subtract(left, right, out) {
311
- out._r = left._r - right._r;
312
- out._g = left._g - right._g;
313
- out._b = left._b - right._b;
314
- out._a = left._a - right._a;
315
- out._onValueChanged && out._onValueChanged();
316
- };
317
- /**
318
- * Scale a color by the given value.
319
- * @param left - The color to scale
320
- * @param s - The amount by which to scale the color
321
- * @param out - The scaled color
322
- * @returns The scaled color
323
- */ Color.scale = function scale(left, s, out) {
324
- out._r = left._r * s;
325
- out._g = left._g * s;
326
- out._b = left._b * s;
327
- out._a = left._a * s;
328
- out._onValueChanged && out._onValueChanged();
329
- return out;
330
- };
331
- /**
332
- * Performs a linear interpolation between two color.
333
- * @param start - The first color
334
- * @param end - The second color
335
- * @param t - The blend amount where 0 returns start and 1 end
336
- * @param out - The result of linear blending between two color
337
- */ Color.lerp = function lerp(start, end, t, out) {
338
- var _r = start._r, _g = start._g, _b = start._b, _a = start._a;
339
- out._r = _r + (end._r - _r) * t;
340
- out._g = _g + (end._g - _g) * t;
341
- out._b = _b + (end._b - _b) * t;
342
- out._a = _a + (end._a - _a) * t;
343
- out._onValueChanged && out._onValueChanged();
344
- return out;
345
- };
346
- _create_class(Color, [
347
- {
348
- key: "r",
349
- get: /**
350
- * The red component of the color, 0~1.
351
- */ function get() {
352
- return this._r;
353
- },
354
- set: function set(value) {
355
- this._r = value;
356
- this._onValueChanged && this._onValueChanged();
357
- }
358
- },
359
- {
360
- key: "g",
361
- get: /**
362
- * The green component of the color, 0~1.
363
- */ function get() {
364
- return this._g;
365
- },
366
- set: function set(value) {
367
- this._g = value;
368
- this._onValueChanged && this._onValueChanged();
369
- }
370
- },
371
- {
372
- key: "b",
373
- get: /**
374
- * The blue component of the color, 0~1.
375
- */ function get() {
376
- return this._b;
377
- },
378
- set: function set(value) {
379
- this._b = value;
380
- this._onValueChanged && this._onValueChanged();
381
- }
382
- },
383
- {
384
- key: "a",
385
- get: /**
386
- * The alpha component of the color, 0~1.
387
- */ function get() {
388
- return this._a;
389
- },
390
- set: function set(value) {
391
- this._a = value;
392
- this._onValueChanged && this._onValueChanged();
393
- }
394
- }
395
- ]);
396
- return Color;
397
- }();
398
-
399
58
  /**
400
59
  * Sprite mask interaction.
401
60
  */ var SpriteMaskInteraction;
@@ -1400,9 +1059,9 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
1400
1059
  var _this = this, region = _this._region;
1401
1060
  // @ts-ignore
1402
1061
  region._onValueChanged = null;
1403
- var x = MathUtil$1.clamp(region.x, 0, 1);
1404
- var y = MathUtil$1.clamp(region.y, 0, 1);
1405
- region.set(x, y, MathUtil$1.clamp(region.width, 0, 1 - x), MathUtil$1.clamp(region.height, 0, 1 - y));
1062
+ var x = MathUtil.clamp(region.x, 0, 1);
1063
+ var y = MathUtil.clamp(region.y, 0, 1);
1064
+ region.set(x, y, MathUtil.clamp(region.width, 0, 1 - x), MathUtil.clamp(region.height, 0, 1 - y));
1406
1065
  this._dispatchSpriteChange(SpriteModifyFlags.region);
1407
1066
  if (this._customWidth === undefined || this._customHeight === undefined) {
1408
1067
  this._dispatchSpriteChange(SpriteModifyFlags.size);
@@ -1417,9 +1076,9 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
1417
1076
  var _this = this, border = _this._border;
1418
1077
  // @ts-ignore
1419
1078
  border._onValueChanged = null;
1420
- var x = MathUtil$1.clamp(border.x, 0, 1);
1421
- var y = MathUtil$1.clamp(border.y, 0, 1);
1422
- border.set(x, y, MathUtil$1.clamp(border.z, 0, 1 - x), MathUtil$1.clamp(border.w, 0, 1 - y));
1079
+ var x = MathUtil.clamp(border.x, 0, 1);
1080
+ var y = MathUtil.clamp(border.y, 0, 1);
1081
+ border.set(x, y, MathUtil.clamp(border.z, 0, 1 - x), MathUtil.clamp(border.w, 0, 1 - y));
1423
1082
  this._dispatchSpriteChange(SpriteModifyFlags.border);
1424
1083
  // @ts-ignore
1425
1084
  border._onValueChanged = this._onBorderChange;
@@ -1509,9 +1168,9 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
1509
1168
  return this._atlasRegion;
1510
1169
  },
1511
1170
  set: function set(value) {
1512
- var x = MathUtil$1.clamp(value.x, 0, 1);
1513
- var y = MathUtil$1.clamp(value.y, 0, 1);
1514
- this._atlasRegion.set(x, y, MathUtil$1.clamp(value.width, 0, 1 - x), MathUtil$1.clamp(value.height, 0, 1 - y));
1171
+ var x = MathUtil.clamp(value.x, 0, 1);
1172
+ var y = MathUtil.clamp(value.y, 0, 1);
1173
+ this._atlasRegion.set(x, y, MathUtil.clamp(value.width, 0, 1 - x), MathUtil.clamp(value.height, 0, 1 - y));
1515
1174
  this._dispatchSpriteChange(SpriteModifyFlags.atlasRegion);
1516
1175
  if (this._customWidth === undefined || this._customHeight === undefined) {
1517
1176
  this._dispatchSpriteChange(SpriteModifyFlags.size);
@@ -1526,9 +1185,9 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
1526
1185
  return this._atlasRegionOffset;
1527
1186
  },
1528
1187
  set: function set(value) {
1529
- var x = MathUtil$1.clamp(value.x, 0, 1);
1530
- var y = MathUtil$1.clamp(value.y, 0, 1);
1531
- this._atlasRegionOffset.set(x, y, MathUtil$1.clamp(value.z, 0, 1 - x), MathUtil$1.clamp(value.w, 0, 1 - y));
1188
+ var x = MathUtil.clamp(value.x, 0, 1);
1189
+ var y = MathUtil.clamp(value.y, 0, 1);
1190
+ this._atlasRegionOffset.set(x, y, MathUtil.clamp(value.z, 0, 1 - x), MathUtil.clamp(value.w, 0, 1 - y));
1532
1191
  this._dispatchSpriteChange(SpriteModifyFlags.atlasRegionOffset);
1533
1192
  if (this._customWidth === undefined || this._customHeight === undefined) {
1534
1193
  this._dispatchSpriteChange(SpriteModifyFlags.size);
@@ -2116,20 +1775,28 @@ var ActiveChangeFlag;
2116
1775
  this._enabled = value;
2117
1776
  if (this._entity._isActiveInScene) {
2118
1777
  if (value) {
2119
- this._phasedActiveInScene = true;
2120
- this._onEnableInScene();
1778
+ if (!this._phasedActiveInScene) {
1779
+ this._phasedActiveInScene = true;
1780
+ this._onEnableInScene();
1781
+ }
2121
1782
  } else {
2122
- this._phasedActiveInScene = false;
2123
- this._onDisableInScene();
1783
+ if (this._phasedActiveInScene) {
1784
+ this._phasedActiveInScene = false;
1785
+ this._onDisableInScene();
1786
+ }
2124
1787
  }
2125
1788
  }
2126
1789
  if (this._entity.isActiveInHierarchy) {
2127
1790
  if (value) {
2128
- this._phasedActive = true;
2129
- this._onEnable();
1791
+ if (!this._phasedActive) {
1792
+ this._phasedActive = true;
1793
+ this._onEnable();
1794
+ }
2130
1795
  } else {
2131
- this._phasedActive = false;
2132
- this._onDisable();
1796
+ if (this._phasedActive) {
1797
+ this._phasedActive = false;
1798
+ this._onDisable();
1799
+ }
2133
1800
  }
2134
1801
  }
2135
1802
  }
@@ -2442,7 +2109,7 @@ var DependentMode;
2442
2109
  * @param relativeToLocal = `true` - Relative to local space
2443
2110
  */ _proto.rotateByAxis = function rotateByAxis(axis, angle, relativeToLocal) {
2444
2111
  if (relativeToLocal === void 0) relativeToLocal = true;
2445
- var rad = angle * MathUtil$1.degreeToRadFactor;
2112
+ var rad = angle * MathUtil.degreeToRadFactor;
2446
2113
  Quaternion.rotationAxisAngle(axis, rad, Transform._tempQuat0);
2447
2114
  this._rotateByQuat(Transform._tempQuat0, relativeToLocal);
2448
2115
  };
@@ -2454,7 +2121,7 @@ var DependentMode;
2454
2121
  var zAxis = Transform._tempVec30;
2455
2122
  Vector3.subtract(this.worldPosition, targetPosition, zAxis);
2456
2123
  var axisLen = zAxis.length();
2457
- if (axisLen <= MathUtil$1.zeroTolerance) {
2124
+ if (axisLen <= MathUtil.zeroTolerance) {
2458
2125
  // The current position and the target position are almost the same.
2459
2126
  return;
2460
2127
  }
@@ -2466,7 +2133,7 @@ var DependentMode;
2466
2133
  xAxis.set(zAxis.z, 0, -zAxis.x);
2467
2134
  }
2468
2135
  axisLen = xAxis.length();
2469
- if (axisLen <= MathUtil$1.zeroTolerance) {
2136
+ if (axisLen <= MathUtil.zeroTolerance) {
2470
2137
  // @todo:
2471
2138
  // 1.worldUp is(0,0,0)
2472
2139
  // 2.worldUp is parallel to zAxis
@@ -2673,7 +2340,7 @@ var DependentMode;
2673
2340
  };
2674
2341
  _proto._rotateXYZ = function _rotateXYZ(x, y, z, relativeToLocal) {
2675
2342
  if (relativeToLocal === void 0) relativeToLocal = true;
2676
- var radFactor = MathUtil$1.degreeToRadFactor;
2343
+ var radFactor = MathUtil.degreeToRadFactor;
2677
2344
  var rotQuat = Transform._tempQuat0;
2678
2345
  Quaternion.rotationEuler(x * radFactor, y * radFactor, z * radFactor, rotQuat);
2679
2346
  this._rotateByQuat(rotQuat, relativeToLocal);
@@ -2700,7 +2367,7 @@ var DependentMode;
2700
2367
  };
2701
2368
  _proto._onWorldRotationChanged = function _onWorldRotationChanged() {
2702
2369
  var worldRotation = this._worldRotation;
2703
- Quaternion.rotationEuler(MathUtil$1.degreeToRadian(worldRotation.x), MathUtil$1.degreeToRadian(worldRotation.y), MathUtil$1.degreeToRadian(worldRotation.z), this._worldRotationQuaternion);
2370
+ Quaternion.rotationEuler(MathUtil.degreeToRadian(worldRotation.x), MathUtil.degreeToRadian(worldRotation.y), MathUtil.degreeToRadian(worldRotation.z), this._worldRotationQuaternion);
2704
2371
  this._setDirtyFlagFalse(0x8);
2705
2372
  };
2706
2373
  _proto._onRotationQuaternionChanged = function _onRotationQuaternionChanged() {
@@ -2775,7 +2442,7 @@ var DependentMode;
2775
2442
  //@ts-ignore
2776
2443
  rotation._onValueChanged = null;
2777
2444
  this._rotationQuaternion.toEuler(rotation);
2778
- rotation.scale(MathUtil$1.radToDegreeFactor); // radians to degrees
2445
+ rotation.scale(MathUtil.radToDegreeFactor); // radians to degrees
2779
2446
  //@ts-ignore
2780
2447
  rotation._onValueChanged = this._onRotationChanged;
2781
2448
  this._setDirtyFlagFalse(0x1);
@@ -2799,7 +2466,7 @@ var DependentMode;
2799
2466
  //@ts-ignore
2800
2467
  worldRotation._onValueChanged = null;
2801
2468
  this.worldRotationQuaternion.toEuler(worldRotation);
2802
- worldRotation.scale(MathUtil$1.radToDegreeFactor); // Radian to angle
2469
+ worldRotation.scale(MathUtil.radToDegreeFactor); // Radian to angle
2803
2470
  //@ts-ignore
2804
2471
  worldRotation._onValueChanged = this._onWorldRotationChanged;
2805
2472
  this._setDirtyFlagFalse(0x8);
@@ -2821,7 +2488,7 @@ var DependentMode;
2821
2488
  if (this._isContainDirtyFlag(0x2)) {
2822
2489
  //@ts-ignore
2823
2490
  rotationQuaternion._onValueChanged = null;
2824
- Quaternion.rotationEuler(MathUtil$1.degreeToRadian(this._rotation.x), MathUtil$1.degreeToRadian(this._rotation.y), MathUtil$1.degreeToRadian(this._rotation.z), rotationQuaternion);
2491
+ Quaternion.rotationEuler(MathUtil.degreeToRadian(this._rotation.x), MathUtil.degreeToRadian(this._rotation.y), MathUtil.degreeToRadian(this._rotation.z), rotationQuaternion);
2825
2492
  //@ts-ignore
2826
2493
  rotationQuaternion._onValueChanged = this._onRotationQuaternionChanged;
2827
2494
  this._setDirtyFlagFalse(0x2);
@@ -3890,7 +3557,7 @@ var ShaderFactory = /*#__PURE__*/ function() {
3890
3557
  if (value.r !== undefined) {
3891
3558
  if (cacheValue.x !== value.r || cacheValue.y !== value.g) {
3892
3559
  if (this._colorSpace === ColorSpace.Linear) {
3893
- this._gl.uniform2f(shaderUniform.location, Color$1.gammaToLinearSpace(value.r), Color$1.gammaToLinearSpace(value.g));
3560
+ this._gl.uniform2f(shaderUniform.location, Color.gammaToLinearSpace(value.r), Color.gammaToLinearSpace(value.g));
3894
3561
  } else {
3895
3562
  this._gl.uniform2f(shaderUniform.location, value.r, value.g);
3896
3563
  }
@@ -3913,7 +3580,7 @@ var ShaderFactory = /*#__PURE__*/ function() {
3913
3580
  if (value.r !== undefined) {
3914
3581
  if (cacheValue.x !== value.r || cacheValue.y !== value.g || cacheValue.z !== value.b) {
3915
3582
  if (this._colorSpace === ColorSpace.Linear) {
3916
- this._gl.uniform3f(shaderUniform.location, Color$1.gammaToLinearSpace(value.r), Color$1.gammaToLinearSpace(value.g), Color$1.gammaToLinearSpace(value.b));
3583
+ this._gl.uniform3f(shaderUniform.location, Color.gammaToLinearSpace(value.r), Color.gammaToLinearSpace(value.g), Color.gammaToLinearSpace(value.b));
3917
3584
  } else {
3918
3585
  this._gl.uniform3f(shaderUniform.location, value.r, value.g, value.b);
3919
3586
  }
@@ -3938,7 +3605,7 @@ var ShaderFactory = /*#__PURE__*/ function() {
3938
3605
  if (value.r !== undefined) {
3939
3606
  if (cacheValue.x !== value.r || cacheValue.y !== value.g || cacheValue.z !== value.b || cacheValue.w !== value.a) {
3940
3607
  if (this._colorSpace === ColorSpace.Linear) {
3941
- this._gl.uniform4f(shaderUniform.location, Color$1.gammaToLinearSpace(value.r), Color$1.gammaToLinearSpace(value.g), Color$1.gammaToLinearSpace(value.b), value.a);
3608
+ this._gl.uniform4f(shaderUniform.location, Color.gammaToLinearSpace(value.r), Color.gammaToLinearSpace(value.g), Color.gammaToLinearSpace(value.b), value.a);
3942
3609
  } else {
3943
3610
  this._gl.uniform4f(shaderUniform.location, value.r, value.g, value.b, value.a);
3944
3611
  }
@@ -4589,7 +4256,7 @@ var ShaderFactory = /*#__PURE__*/ function() {
4589
4256
  */ var BlendState = /*#__PURE__*/ function() {
4590
4257
  function BlendState() {
4591
4258
  /** The blend state of the render target. */ this.targetBlendState = new RenderTargetBlendState();
4592
- /** Constant blend color. */ this.blendColor = new Color$1(0, 0, 0, 0);
4259
+ /** Constant blend color. */ this.blendColor = new Color(0, 0, 0, 0);
4593
4260
  /** Whether to use (Alpha-to-Coverage) technology. */ this.alphaToCoverage = false;
4594
4261
  }
4595
4262
  var _proto = BlendState.prototype;
@@ -4683,7 +4350,7 @@ var ShaderFactory = /*#__PURE__*/ function() {
4683
4350
  }
4684
4351
  // apply blend color.
4685
4352
  var blendColor = this.blendColor;
4686
- if (!Color$1.equals(lastState.blendColor, blendColor)) {
4353
+ if (!Color.equals(lastState.blendColor, blendColor)) {
4687
4354
  gl.blendColor(blendColor.r, blendColor.g, blendColor.b, blendColor.a);
4688
4355
  lastState.blendColor.copyFrom(blendColor);
4689
4356
  }
@@ -9438,7 +9105,7 @@ var /**
9438
9105
  };
9439
9106
  _proto._readColorVertexData = function _readColorVertexData(attributeType) {
9440
9107
  return this._readVertexData(attributeType, function(dataReader, offset) {
9441
- return new Color$1(dataReader[offset], dataReader[offset + 1], dataReader[offset + 2], dataReader[offset + 3]);
9108
+ return new Color(dataReader[offset], dataReader[offset + 1], dataReader[offset + 2], dataReader[offset + 3]);
9442
9109
  });
9443
9110
  };
9444
9111
  _proto._readVertexData = function _readVertexData(attributeType, onVertexParse) {
@@ -9926,6 +9593,10 @@ var VertexElementIndex;
9926
9593
  var sphereInfo = primitiveInfo;
9927
9594
  PrimitiveMesh._setSphereData(this.resource, sphereInfo.radius, sphereInfo.segments, sphereInfo.noLongerAccessible, true, sphereInfo.vertexBuffer);
9928
9595
  break;
9596
+ case 7:
9597
+ var CCSphereInfo = primitiveInfo;
9598
+ PrimitiveMesh._setSubdivisionSurfaceSphereData(this.resource, CCSphereInfo.radius, CCSphereInfo.step, CCSphereInfo.noLongerAccessible, true, CCSphereInfo.vertexBuffer);
9599
+ break;
9929
9600
  case 1:
9930
9601
  var cuboidInfo = primitiveInfo;
9931
9602
  PrimitiveMesh._setCuboidData(this.resource, cuboidInfo.width, cuboidInfo.height, cuboidInfo.depth, cuboidInfo.noLongerAccessible, true, cuboidInfo.vertexBuffer);
@@ -9963,6 +9634,7 @@ var PrimitiveType;
9963
9634
  PrimitiveType[PrimitiveType["Torus"] = 4] = "Torus";
9964
9635
  PrimitiveType[PrimitiveType["Cone"] = 5] = "Cone";
9965
9636
  PrimitiveType[PrimitiveType["Capsule"] = 6] = "Capsule";
9637
+ PrimitiveType[PrimitiveType["CCSphere"] = 7] = "CCSphere";
9966
9638
  })(PrimitiveType || (PrimitiveType = {}));
9967
9639
  /**
9968
9640
  * @internal
@@ -9984,6 +9656,19 @@ var PrimitiveType;
9984
9656
  }
9985
9657
  return SphereRestoreInfo;
9986
9658
  }(PrimitiveRestoreInfo);
9659
+ /**
9660
+ * @internal
9661
+ */ var SubdivisionSurfaceSphereRestoreInfo = /*#__PURE__*/ function(PrimitiveRestoreInfo) {
9662
+ _inherits(SubdivisionSurfaceSphereRestoreInfo, PrimitiveRestoreInfo);
9663
+ function SubdivisionSurfaceSphereRestoreInfo(radius, step, vertexBuffer, noLongerAccessible) {
9664
+ var _this;
9665
+ _this = PrimitiveRestoreInfo.call(this, 7, vertexBuffer, noLongerAccessible) || this;
9666
+ _this.radius = radius;
9667
+ _this.step = step;
9668
+ return _this;
9669
+ }
9670
+ return SubdivisionSurfaceSphereRestoreInfo;
9671
+ }(PrimitiveRestoreInfo);
9987
9672
  /**
9988
9673
  * @internal
9989
9674
  */ var CuboidRestoreInfo = /*#__PURE__*/ function(PrimitiveRestoreInfo) {
@@ -10098,6 +9783,24 @@ var PrimitiveType;
10098
9783
  return sphereMesh;
10099
9784
  };
10100
9785
  /**
9786
+ * Create a sphere mesh by implementing Catmull-Clark Surface Subdivision Algorithm.
9787
+ * Max step is limited to 6.
9788
+ * @param engine - Engine
9789
+ * @param radius - Sphere radius
9790
+ * @param step - Number of subdiv steps
9791
+ * @param noLongerAccessible - No longer access the vertices of the mesh after creation
9792
+ * @returns Sphere model mesh
9793
+ */ PrimitiveMesh.createSubdivisionSurfaceSphere = function createSubdivisionSurfaceSphere(engine, radius, step, noLongerAccessible) {
9794
+ if (radius === void 0) radius = 0.5;
9795
+ if (step === void 0) step = 3;
9796
+ if (noLongerAccessible === void 0) noLongerAccessible = true;
9797
+ var sphereMesh = new ModelMesh(engine);
9798
+ PrimitiveMesh._setSubdivisionSurfaceSphereData(sphereMesh, radius, step, noLongerAccessible, false);
9799
+ var vertexBuffer = sphereMesh.vertexBufferBindings[0].buffer;
9800
+ engine.resourceManager.addContentRestorer(new PrimitiveMeshRestorer(sphereMesh, new SubdivisionSurfaceSphereRestoreInfo(radius, step, vertexBuffer, noLongerAccessible)));
9801
+ return sphereMesh;
9802
+ };
9803
+ /**
10101
9804
  * Create a cuboid mesh.
10102
9805
  * @param engine - Engine
10103
9806
  * @param width - Cuboid width
@@ -10227,6 +9930,90 @@ var PrimitiveType;
10227
9930
  };
10228
9931
  /**
10229
9932
  * @internal
9933
+ */ PrimitiveMesh._setSubdivisionSurfaceSphereData = function _setSubdivisionSurfaceSphereData(sphereMesh, radius, step, noLongerAccessible, isRestoreMode, restoreVertexBuffer) {
9934
+ // Max step is limited to 6. Because 7 step will generate a single mesh with over 98306 vertices
9935
+ step = MathUtil.clamp(Math.floor(step), 1, 6);
9936
+ var positions = new Float32Array(3 * (6 * Math.pow(4, step) + 2));
9937
+ var cells = new Float32Array(24 * Math.pow(4, step));
9938
+ PrimitiveMesh._subdiveCatmullClark(step, positions, cells);
9939
+ var positionCount = positions.length / 3;
9940
+ var cellsCount = cells.length / 4;
9941
+ var poleOffset = positionCount + Math.pow(2, step + 1) - 1;
9942
+ // 16 extra vertices for pole uv
9943
+ // 2 vertices at each pole are idle
9944
+ var vertexCount = poleOffset + 16;
9945
+ var vertices = new Float32Array(vertexCount * 8);
9946
+ var indices = PrimitiveMesh._generateIndices(sphereMesh.engine, positionCount, cellsCount * 6);
9947
+ var seamCount = 0;
9948
+ var seamVertices = {};
9949
+ // Get normals, uvs, and scale to radius
9950
+ for(var i = 0; i < positionCount; i++){
9951
+ var offset = 3 * i;
9952
+ var x = positions[offset];
9953
+ var y = positions[offset + 1];
9954
+ var z = positions[offset + 2];
9955
+ var reciprocalLength = 1 / Math.sqrt(x * x + y * y + z * z);
9956
+ x *= reciprocalLength;
9957
+ y *= reciprocalLength;
9958
+ z *= reciprocalLength;
9959
+ offset = 8 * i;
9960
+ vertices[offset] = x * radius;
9961
+ vertices[offset + 1] = y * radius;
9962
+ vertices[offset + 2] = z * radius;
9963
+ vertices[offset + 3] = x;
9964
+ vertices[offset + 4] = y;
9965
+ vertices[offset + 5] = z;
9966
+ vertices[offset + 6] = (Math.PI - Math.atan2(z, x)) / (2 * Math.PI);
9967
+ vertices[offset + 7] = Math.acos(y) / Math.PI;
9968
+ if (vertices[offset + 6] === 0) {
9969
+ // Generate seam vertex
9970
+ var seamOffset = 8 * (positionCount + seamCount++);
9971
+ vertices.set(vertices.subarray(offset, offset + 8), seamOffset);
9972
+ vertices[seamOffset + 6] = 1.0;
9973
+ // Cache seam vertex
9974
+ seamVertices[offset / 8] = seamOffset / 8;
9975
+ }
9976
+ }
9977
+ // Get indices
9978
+ var offset1 = 0;
9979
+ this._spherePoleIdx = 0;
9980
+ for(var i1 = 0; i1 < cellsCount; i1++){
9981
+ var idx = 4 * i1;
9982
+ var indexA = cells[idx];
9983
+ var indexB = cells[idx + 1];
9984
+ var indexC = cells[idx + 2];
9985
+ var indexD = cells[idx + 3];
9986
+ // Handle seam by replacing vertex index to seam vertex index if necessary
9987
+ var floatIndexA = 8 * indexA;
9988
+ var floatIndexB = 8 * indexB;
9989
+ var floatIndexC = 8 * indexC;
9990
+ var floatIndexD = 8 * indexD;
9991
+ // If center Z is negative
9992
+ if (vertices[floatIndexA + 2] + vertices[floatIndexB + 2] + vertices[floatIndexC + 2] < 0) {
9993
+ vertices[floatIndexA + 6] === 0 && (indexA = seamVertices[indexA]);
9994
+ vertices[floatIndexB + 6] === 0 && (indexB = seamVertices[indexB]);
9995
+ vertices[floatIndexC + 6] === 0 && (indexC = seamVertices[indexC]);
9996
+ vertices[floatIndexD + 6] === 0 && (indexD = seamVertices[indexD]);
9997
+ }
9998
+ indices[offset1] = indexA;
9999
+ indices[offset1 + 1] = indexB;
10000
+ indices[offset1 + 2] = indexC;
10001
+ this._generateAndReplacePoleUV(indices, vertices, offset1, poleOffset);
10002
+ indices[offset1 + 3] = indexA;
10003
+ indices[offset1 + 4] = indexC;
10004
+ indices[offset1 + 5] = indexD;
10005
+ this._generateAndReplacePoleUV(indices, vertices, offset1 + 3, poleOffset);
10006
+ offset1 += 6;
10007
+ }
10008
+ if (!isRestoreMode) {
10009
+ var bounds = sphereMesh.bounds;
10010
+ bounds.min.set(-radius, -radius, -radius);
10011
+ bounds.max.set(radius, radius, radius);
10012
+ }
10013
+ PrimitiveMesh._initialize(sphereMesh, vertices, indices, noLongerAccessible, isRestoreMode, restoreVertexBuffer);
10014
+ };
10015
+ /**
10016
+ * @internal
10230
10017
  */ PrimitiveMesh._setSphereData = function _setSphereData(sphereMesh, radius, segments, noLongerAccessible, isRestoreMode, restoreVertexBuffer) {
10231
10018
  segments = Math.max(2, Math.floor(segments));
10232
10019
  var count = segments + 1;
@@ -10287,6 +10074,135 @@ var PrimitiveType;
10287
10074
  };
10288
10075
  /**
10289
10076
  * @internal
10077
+ */ PrimitiveMesh._subdiveCatmullClark = function _subdiveCatmullClark(step, positions, cells) {
10078
+ var edges = new Map();
10079
+ var faces = new Array();
10080
+ positions.set(PrimitiveMesh._sphereSeedPositions);
10081
+ cells.set(PrimitiveMesh._sphereSeedCells);
10082
+ for(var i = 0; i < step; i++){
10083
+ var cellCount = 6 * Math.pow(4, i);
10084
+ var positionCount = 4 * cellCount + 2;
10085
+ edges.clear();
10086
+ faces.length = 0;
10087
+ // Get cell face's facePoint
10088
+ for(var j = 0; j < cellCount; j++){
10089
+ var face = faces[j] = {
10090
+ facePoint: new Vector3(),
10091
+ adjacentEdges: new Array(4)
10092
+ };
10093
+ // Get cell's edgePoint
10094
+ for(var k = 0; k < 4; k++){
10095
+ var offset = 3 * cells[4 * j + k];
10096
+ face.facePoint.x += 0.25 * positions[offset];
10097
+ face.facePoint.y += 0.25 * positions[offset + 1];
10098
+ face.facePoint.z += 0.25 * positions[offset + 2];
10099
+ }
10100
+ // Get cell edges
10101
+ for(var k1 = 0; k1 < 4; k1++){
10102
+ var vertexIdxA = cells[4 * j + k1];
10103
+ var vertexIdxB = cells[4 * j + (k1 + 1) % 4];
10104
+ var edgeIdxKey = Math.min(vertexIdxA, vertexIdxB) * positionCount + Math.max(vertexIdxA, vertexIdxB);
10105
+ if (!edges.has(edgeIdxKey)) {
10106
+ var edge = {
10107
+ edgePoint: new Vector3(),
10108
+ edgePointIndex: undefined
10109
+ };
10110
+ var offsetA = 3 * vertexIdxA;
10111
+ var offsetB = 3 * vertexIdxB;
10112
+ 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]));
10113
+ edges.set(edgeIdxKey, edge);
10114
+ }
10115
+ var edge1 = edges.get(edgeIdxKey);
10116
+ face.adjacentEdges[k1] = edge1;
10117
+ var edgePoint = edge1.edgePoint;
10118
+ var facePoint = face.facePoint;
10119
+ edgePoint.x += 0.25 * facePoint.x;
10120
+ edgePoint.y += 0.25 * facePoint.y;
10121
+ edgePoint.z += 0.25 * facePoint.z;
10122
+ }
10123
+ }
10124
+ var prePointCount = cellCount + 2;
10125
+ var edgePointOffset = prePointCount + cellCount;
10126
+ var pointIdx = 0;
10127
+ this._sphereEdgeIdx = 0;
10128
+ var preCells = cells.slice(0, 4 * cellCount);
10129
+ // Get New positions, which consists of updated positions of existing points, face points and edge points
10130
+ for(var j1 = 0; j1 < cellCount; j1++){
10131
+ // Add face point to new positions
10132
+ var face1 = faces[j1];
10133
+ face1.facePoint.copyToArray(positions, 3 * (prePointCount + j1));
10134
+ // Get the face point index
10135
+ var ic = prePointCount + j1;
10136
+ var id = void 0, ib = void 0, temp = void 0;
10137
+ // ia -- id -- ia
10138
+ // | | |
10139
+ // ib -- ic -- ib
10140
+ // | | |
10141
+ // ia -- id -- ia
10142
+ for(var k2 = 0; k2 < 4; k2++){
10143
+ // Get the updated existing point index
10144
+ var ia = preCells[pointIdx++];
10145
+ // ib and id share four edge points in one cell
10146
+ switch(k2){
10147
+ case 0:
10148
+ {
10149
+ var edgeB = face1.adjacentEdges[k2 % 4];
10150
+ var edgeD = face1.adjacentEdges[(k2 + 3) % 4];
10151
+ ib = this._calculateEdgeIndex(positions, edgeB, edgePointOffset);
10152
+ id = this._calculateEdgeIndex(positions, edgeD, edgePointOffset);
10153
+ temp = id;
10154
+ break;
10155
+ }
10156
+ case 1:
10157
+ case 2:
10158
+ {
10159
+ var edgeB1 = face1.adjacentEdges[k2 % 4];
10160
+ id = ib;
10161
+ ib = this._calculateEdgeIndex(positions, edgeB1, edgePointOffset);
10162
+ break;
10163
+ }
10164
+ case 3:
10165
+ {
10166
+ id = ib;
10167
+ ib = temp;
10168
+ break;
10169
+ }
10170
+ }
10171
+ var idx = 4 * (4 * j1 + k2);
10172
+ cells[idx] = ia;
10173
+ cells[idx + 1] = ib;
10174
+ cells[idx + 2] = ic;
10175
+ cells[idx + 3] = id;
10176
+ }
10177
+ }
10178
+ }
10179
+ };
10180
+ /**
10181
+ * Duplicate vertices at the poles and adjust their UV coordinates.
10182
+ */ PrimitiveMesh._generateAndReplacePoleUV = function _generateAndReplacePoleUV(indices, vertices, idx, poleOffset) {
10183
+ var v = vertices[8 * indices[idx] + 7];
10184
+ if (v === 0 || v === 1) {
10185
+ var offset = 8 * indices[idx];
10186
+ var addedOffset = 8 * (poleOffset + this._spherePoleIdx);
10187
+ vertices.set(vertices.subarray(offset, offset + 8), addedOffset);
10188
+ vertices[addedOffset + 6] = 0.5 * (vertices[offset + 6] + vertices[8 * indices[idx + 1] + 6] + vertices[8 * indices[idx + 2] + 6] - 0.5);
10189
+ indices[idx] = poleOffset + this._spherePoleIdx++;
10190
+ }
10191
+ };
10192
+ /**
10193
+ * Get edge point index for subdivision surface sphere.
10194
+ */ PrimitiveMesh._calculateEdgeIndex = function _calculateEdgeIndex(positions, edge, offset) {
10195
+ if (edge.edgePointIndex !== undefined) {
10196
+ return edge.edgePointIndex;
10197
+ } else {
10198
+ edge.edgePoint.copyToArray(positions, 3 * (offset + PrimitiveMesh._sphereEdgeIdx));
10199
+ var index = offset + PrimitiveMesh._sphereEdgeIdx++;
10200
+ edge.edgePointIndex = index;
10201
+ return index;
10202
+ }
10203
+ };
10204
+ /**
10205
+ * @internal
10290
10206
  */ PrimitiveMesh._setCuboidData = function _setCuboidData(cuboidMesh, width, height, depth, noLongerAccessible, isRestoreMode, restoreVertexBuffer) {
10291
10207
  var halfWidth = width / 2;
10292
10208
  var halfHeight = height / 2;
@@ -10916,6 +10832,68 @@ var PrimitiveType;
10916
10832
  (function() {
10917
10833
  PrimitiveMesh._tempVec30 = new Vector3();
10918
10834
  })();
10835
+ (function() {
10836
+ PrimitiveMesh._sphereSeedPositions = new Float32Array([
10837
+ -1,
10838
+ 1,
10839
+ 1,
10840
+ -1,
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
+ ]);
10862
+ })();
10863
+ (function() {
10864
+ PrimitiveMesh._sphereSeedCells = new Float32Array([
10865
+ 0,
10866
+ 1,
10867
+ 2,
10868
+ 3,
10869
+ 3,
10870
+ 2,
10871
+ 4,
10872
+ 5,
10873
+ 5,
10874
+ 4,
10875
+ 6,
10876
+ 7,
10877
+ 7,
10878
+ 0,
10879
+ 3,
10880
+ 5,
10881
+ 7,
10882
+ 6,
10883
+ 1,
10884
+ 0,
10885
+ 6,
10886
+ 4,
10887
+ 2,
10888
+ 1
10889
+ ]);
10890
+ })();
10891
+ (function() {
10892
+ PrimitiveMesh._sphereEdgeIdx = 0;
10893
+ })();
10894
+ (function() {
10895
+ PrimitiveMesh._spherePoleIdx = 0;
10896
+ })();
10919
10897
 
10920
10898
  /**
10921
10899
  * Mesh skin data, equal glTF skins define
@@ -11460,8 +11438,10 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
11460
11438
  }
11461
11439
  mesh.addSubMesh(this._getSubMeshFromPool(vertexStartIndex, vertexCount));
11462
11440
  batchedQueue[curMeshIndex] = preElement;
11463
- this._vertexBuffers[_flushId].setData(vertices, 0, 0, vertexIndex);
11464
- this._indiceBuffers[_flushId].setData(indices, 0, 0, indiceIndex);
11441
+ // Set data option use Discard, or will resulted in performance slowdown when open antialias and cross-rendering of 3D and 2D elements.
11442
+ // Device: iphone X(16.7.2)、iphone 15 pro max(17.1.1)、iphone XR(17.1.2) etc.
11443
+ this._vertexBuffers[_flushId].setData(vertices, 0, 0, vertexIndex, SetDataOptions.Discard);
11444
+ this._indiceBuffers[_flushId].setData(indices, 0, 0, indiceIndex, SetDataOptions.Discard);
11465
11445
  };
11466
11446
  _proto._getSubMeshFromPool = function _getSubMeshFromPool(start, count) {
11467
11447
  var subMesh = this._subMeshPool.getFromPool();
@@ -11608,7 +11588,7 @@ var TiledSpriteAssembler = (_TiledSpriteAssembler = /*#__PURE__*/ function() {
11608
11588
  rVertCount = 3;
11609
11589
  rType = 0;
11610
11590
  } else {
11611
- if (fixedCW > MathUtil$1.zeroTolerance) {
11591
+ if (fixedCW > MathUtil.zeroTolerance) {
11612
11592
  rRepeatCount = (width - fixedLR) / fixedCW;
11613
11593
  rRepeatCount = rRepeatCount % 1 >= threshold ? Math.ceil(rRepeatCount) : Math.floor(rRepeatCount);
11614
11594
  rVertCount = 4 + rRepeatCount - 1;
@@ -11622,7 +11602,7 @@ var TiledSpriteAssembler = (_TiledSpriteAssembler = /*#__PURE__*/ function() {
11622
11602
  cVertCount = 3;
11623
11603
  cType = 0;
11624
11604
  } else {
11625
- if (fixedCH > MathUtil$1.zeroTolerance) {
11605
+ if (fixedCH > MathUtil.zeroTolerance) {
11626
11606
  cRepeatCount = (height - fixedTB) / fixedCH;
11627
11607
  cRepeatCount = cRepeatCount % 1 >= threshold ? Math.ceil(cRepeatCount) : Math.floor(cRepeatCount);
11628
11608
  cVertCount = 4 + cRepeatCount - 1;
@@ -11713,7 +11693,7 @@ var TiledSpriteAssembler = (_TiledSpriteAssembler = /*#__PURE__*/ function() {
11713
11693
  rVertCount = 3;
11714
11694
  rType = 0;
11715
11695
  } else {
11716
- if (fixedCW > MathUtil$1.zeroTolerance) {
11696
+ if (fixedCW > MathUtil.zeroTolerance) {
11717
11697
  rRepeatCount = (width - fixedLR) / fixedCW;
11718
11698
  rVertCount = 4 + (rRepeatCount | 0);
11719
11699
  rType = 2;
@@ -11726,7 +11706,7 @@ var TiledSpriteAssembler = (_TiledSpriteAssembler = /*#__PURE__*/ function() {
11726
11706
  cVertCount = 3;
11727
11707
  cType = 0;
11728
11708
  } else {
11729
- if (fixedCH > MathUtil$1.zeroTolerance) {
11709
+ if (fixedCH > MathUtil.zeroTolerance) {
11730
11710
  cRepeatCount = (height - fixedTB) / fixedCH;
11731
11711
  cVertCount = 4 + (cRepeatCount | 0);
11732
11712
  cType = 2;
@@ -11839,7 +11819,7 @@ var TiledType;
11839
11819
  _this = Renderer1.call(this, entity) || this;
11840
11820
  _this._tileMode = SpriteTileMode.Continuous;
11841
11821
  _this._tiledAdaptiveThreshold = 0.5;
11842
- _this._color = new Color$1(1, 1, 1, 1);
11822
+ _this._color = new Color(1, 1, 1, 1);
11843
11823
  _this._sprite = null;
11844
11824
  _this._automaticWidth = 0;
11845
11825
  _this._automaticHeight = 0;
@@ -12039,7 +12019,7 @@ var TiledType;
12039
12019
  },
12040
12020
  set: function set(value) {
12041
12021
  if (value !== this._tiledAdaptiveThreshold) {
12042
- value = MathUtil$1.clamp(value, 0, 1);
12022
+ value = MathUtil.clamp(value, 0, 1);
12043
12023
  this._tiledAdaptiveThreshold = value;
12044
12024
  if (this.drawMode === SpriteDrawMode.Tiled) {
12045
12025
  this._dirtyUpdateFlag |= 0x3;
@@ -12491,6 +12471,9 @@ var /**
12491
12471
  __decorate([
12492
12472
  assignmentClone
12493
12473
  ], SpriteMask.prototype, "influenceLayers", void 0);
12474
+ __decorate([
12475
+ ignoreClone
12476
+ ], SpriteMask.prototype, "_verticesData", void 0);
12494
12477
  __decorate([
12495
12478
  ignoreClone
12496
12479
  ], SpriteMask.prototype, "_sprite", void 0);
@@ -12774,8 +12757,8 @@ var /**
12774
12757
  } else {
12775
12758
  word += char;
12776
12759
  wordWidth += charInfo.xAdvance;
12777
- wordMaxAscent = lineMaxAscent = Math.max(wordMaxAscent, ascent);
12778
- wordMaxDescent = lineMaxDescent = Math.max(wordMaxDescent, descent);
12760
+ wordMaxAscent = Math.max(wordMaxAscent, ascent);
12761
+ wordMaxDescent = Math.max(wordMaxDescent, descent);
12779
12762
  }
12780
12763
  }
12781
12764
  }
@@ -13006,13 +12989,15 @@ var /**
13006
12989
  ];
13007
12990
  })();
13008
12991
  (function() {
13009
- /** These characters are all tall to help calculate the height required for text. */ TextUtils._measureString = "|\xc9q\xc5";
12992
+ // _heightMultiplier used to measure the height of text, but in miniprogram performance is different from h5.
12993
+ // so can set _heightMultiplier to adapt miniprogram, the larger the value, the worse the performance.
12994
+ /** @internal */ TextUtils._heightMultiplier = 2;
13010
12995
  })();
13011
12996
  (function() {
13012
- TextUtils._measureBaseline = "M";
12997
+ /** These characters are all tall to help calculate the height required for text. */ TextUtils._measureString = "|\xc9q\xc5";
13013
12998
  })();
13014
12999
  (function() {
13015
- TextUtils._heightMultiplier = 2;
13000
+ TextUtils._measureBaseline = "M";
13016
13001
  })();
13017
13002
  (function() {
13018
13003
  TextUtils._baselineMultiplier = 1.4;
@@ -13095,7 +13080,8 @@ var /**
13095
13080
  _proto._createFontAtlas = function _createFontAtlas() {
13096
13081
  var _this = this, engine = _this._engine;
13097
13082
  var fontAtlas = new FontAtlas(engine);
13098
- var texture = new Texture2D(engine, 256, 256);
13083
+ var texture = new Texture2D(engine, 256, 256, TextureFormat.R8G8B8A8, false);
13084
+ texture.filterMode = TextureFilterMode.Bilinear;
13099
13085
  fontAtlas.texture = texture;
13100
13086
  fontAtlas.isGCIgnored = texture.isGCIgnored = true;
13101
13087
  this._fontAtlases.push(fontAtlas);
@@ -13253,7 +13239,7 @@ var /**
13253
13239
  /** @internal */ _this._subFont = null;
13254
13240
  /** @internal */ _this._charRenderDatas = [];
13255
13241
  _this._dirtyFlag = 15;
13256
- _this._color = new Color$1(1, 1, 1, 1);
13242
+ _this._color = new Color(1, 1, 1, 1);
13257
13243
  _this._text = "";
13258
13244
  _this._width = 0;
13259
13245
  _this._height = 0;
@@ -13333,7 +13319,7 @@ var /**
13333
13319
  /**
13334
13320
  * @internal
13335
13321
  */ _proto._render = function _render(context) {
13336
- if (this._text === "" || this.enableWrapping && this.width <= 0 || this.overflowMode === OverflowMode.Truncate && this.height <= 0) {
13322
+ if (this._isTextNoVisible()) {
13337
13323
  return;
13338
13324
  }
13339
13325
  if (this._isContainDirtyFlag(0x10)) {
@@ -13425,8 +13411,8 @@ var /**
13425
13411
  }
13426
13412
  };
13427
13413
  _proto._updateLocalData = function _updateLocalData() {
13428
- var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
13429
13414
  var _this__localBounds = this._localBounds, min = _this__localBounds.min, max = _this__localBounds.max;
13415
+ var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
13430
13416
  var textMetrics = this.enableWrapping ? TextUtils.measureTextWithWrap(this) : TextUtils.measureTextWithoutWrap(this);
13431
13417
  var height = textMetrics.height, lines = textMetrics.lines, lineWidths = textMetrics.lineWidths, lineHeight = textMetrics.lineHeight, lineMaxSizes = textMetrics.lineMaxSizes;
13432
13418
  var charRenderDataPool = TextRenderer._charRenderDataPool;
@@ -13494,7 +13480,7 @@ var /**
13494
13480
  var left = startX * pixelsPerUnitReciprocal;
13495
13481
  var right = (startX + w) * pixelsPerUnitReciprocal;
13496
13482
  var top = (startY + ascent) * pixelsPerUnitReciprocal;
13497
- var bottom = (startY - descent + 1) * pixelsPerUnitReciprocal;
13483
+ var bottom = (startY - descent) * pixelsPerUnitReciprocal;
13498
13484
  localPositions.set(left, top, right, bottom);
13499
13485
  i === firstLine && (maxY = Math.max(maxY, top));
13500
13486
  minY = Math.min(minY, bottom);
@@ -13535,6 +13521,9 @@ var /**
13535
13521
  Renderer1.prototype._onTransformChanged.call(this, bit);
13536
13522
  this._setDirtyFlagTrue(0x4 | 0x8);
13537
13523
  };
13524
+ _proto._isTextNoVisible = function _isTextNoVisible() {
13525
+ return this._text === "" || this._fontSize === 0 || this.enableWrapping && this.width <= 0 || this.overflowMode === OverflowMode.Truncate && this.height <= 0;
13526
+ };
13538
13527
  _create_class(TextRenderer, [
13539
13528
  {
13540
13529
  key: "color",
@@ -13737,6 +13726,16 @@ var /**
13737
13726
  get: /**
13738
13727
  * The bounding volume of the TextRenderer.
13739
13728
  */ function get() {
13729
+ if (this._isTextNoVisible()) {
13730
+ if (this._isContainDirtyFlag(0x8)) {
13731
+ var localBounds = this._localBounds;
13732
+ localBounds.min.set(0, 0, 0);
13733
+ localBounds.max.set(0, 0, 0);
13734
+ this._updateBounds(this._bounds);
13735
+ this._setDirtyFlagFalse(0x8);
13736
+ }
13737
+ return this._bounds;
13738
+ }
13740
13739
  this._isContainDirtyFlag(0x1) && this._resetSubFont();
13741
13740
  this._isContainDirtyFlag(0x2) && this._updateLocalData();
13742
13741
  this._isContainDirtyFlag(0x4) && this._updatePosition();
@@ -15725,6 +15724,66 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
15725
15724
  }
15726
15725
  }
15727
15726
  };
15727
+ /**
15728
+ * @internal
15729
+ */ SystemInfo._detectSIMDSupported = function _detectSIMDSupported() {
15730
+ if (this._simdSupported === null) {
15731
+ this._simdSupported = WebAssembly.validate(new Uint8Array([
15732
+ 0,
15733
+ 97,
15734
+ 115,
15735
+ 109,
15736
+ 1,
15737
+ 0,
15738
+ 0,
15739
+ 0,
15740
+ 1,
15741
+ 4,
15742
+ 1,
15743
+ 96,
15744
+ 0,
15745
+ 0,
15746
+ 3,
15747
+ 3,
15748
+ 2,
15749
+ 0,
15750
+ 0,
15751
+ 5,
15752
+ 3,
15753
+ 1,
15754
+ 0,
15755
+ 1,
15756
+ 12,
15757
+ 1,
15758
+ 0,
15759
+ 10,
15760
+ 22,
15761
+ 2,
15762
+ 12,
15763
+ 0,
15764
+ 65,
15765
+ 0,
15766
+ 65,
15767
+ 0,
15768
+ 65,
15769
+ 0,
15770
+ 252,
15771
+ 10,
15772
+ 0,
15773
+ 0,
15774
+ 11,
15775
+ 7,
15776
+ 0,
15777
+ 65,
15778
+ 0,
15779
+ 253,
15780
+ 15,
15781
+ 26,
15782
+ 11
15783
+ ]));
15784
+ }
15785
+ return this._simdSupported;
15786
+ };
15728
15787
  _create_class(SystemInfo, null, [
15729
15788
  {
15730
15789
  key: "devicePixelRatio",
@@ -15743,6 +15802,9 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
15743
15802
  (function() {
15744
15803
  /** The operating system is running on. */ SystemInfo.operatingSystem = "";
15745
15804
  })();
15805
+ (function() {
15806
+ /** Whether the system support SIMD. */ SystemInfo._simdSupported = null;
15807
+ })();
15746
15808
  SystemInfo._initialize();
15747
15809
 
15748
15810
  /**
@@ -16533,7 +16595,7 @@ var Collision = function Collision() {
16533
16595
  return this._fixedTimeStep;
16534
16596
  },
16535
16597
  set: function set(value) {
16536
- this._fixedTimeStep = Math.max(value, MathUtil$1.zeroTolerance);
16598
+ this._fixedTimeStep = Math.max(value, MathUtil.zeroTolerance);
16537
16599
  }
16538
16600
  }
16539
16601
  ]);
@@ -18576,6 +18638,8 @@ __decorate([
18576
18638
  _this = ReferResource1.call(this, engine) || this;
18577
18639
  /** @internal */ _this._renderStates = [] // todo: later will as a part of shaderData when shader effect frame is OK, that is more powerful and flexible.
18578
18640
  ;
18641
+ /** @internal */ _this._priority = 0 // todo: temporary resolution of submesh rendering order issue.
18642
+ ;
18579
18643
  _this._shaderData = new ShaderData(ShaderDataGroup.Material);
18580
18644
  _this.shader = shader;
18581
18645
  return _this;
@@ -19652,7 +19716,7 @@ ShaderPool.init();
19652
19716
  var e = viewProjMatrix.elements;
19653
19717
  e[12] = e[13] = e[14] = 0;
19654
19718
  // epsilon-infinity projection matrix http://terathon.com/gdc07_lengyel.pdf
19655
- var f = 1.0 / Math.tan(MathUtil$1.degreeToRadian(fieldOfView) / 2);
19719
+ var f = 1.0 / Math.tan(MathUtil.degreeToRadian(fieldOfView) / 2);
19656
19720
  projectionMatrix.elements[0] = f / aspectRatio;
19657
19721
  projectionMatrix.elements[5] = f;
19658
19722
  // view-proj matrix
@@ -19733,7 +19797,7 @@ ShaderPool.init();
19733
19797
  * Background solid color.
19734
19798
  * @defaultValue `new Color(0.25, 0.25, 0.25, 1.0)`
19735
19799
  * @remarks When `mode` is `BackgroundMode.SolidColor`, the property will take effects.
19736
- */ solidColor = new Color$1(0.25, 0.25, 0.25, 1.0);
19800
+ */ solidColor = new Color(0.25, 0.25, 0.25, 1.0);
19737
19801
  this.sky = new Sky();
19738
19802
  this./** @internal */ _textureFillMode = BackgroundTextureFillMode.AspectFitHeight;
19739
19803
  this._texture = null;
@@ -20094,7 +20158,7 @@ ShaderPool.init();
20094
20158
  function AmbientLight(engine) {
20095
20159
  var _this;
20096
20160
  _this = ReferResource1.call(this, engine) || this;
20097
- _this._diffuseSolidColor = new Color$1(0.212, 0.227, 0.259);
20161
+ _this._diffuseSolidColor = new Color(0.212, 0.227, 0.259);
20098
20162
  _this._diffuseIntensity = 1.0;
20099
20163
  _this._specularIntensity = 1.0;
20100
20164
  _this._diffuseMode = DiffuseMode.SolidColor;
@@ -20391,8 +20455,8 @@ ShaderPool.init();
20391
20455
  /** Near plane value to use for shadow frustums. */ _this.shadowNearPlane = 0.1;
20392
20456
  /** Shadow intensity, the larger the value, the clearer and darker the shadow. */ _this.shadowStrength = 1.0;
20393
20457
  /** @internal */ _this._lightIndex = -1;
20394
- /** @internal */ _this._lightColor = new Color$1();
20395
- _this._color = new Color$1(1, 1, 1, 1);
20458
+ /** @internal */ _this._lightColor = new Color();
20459
+ _this._color = new Color(1, 1, 1, 1);
20396
20460
  return _this;
20397
20461
  }
20398
20462
  var _proto = Light.prototype;
@@ -20470,9 +20534,9 @@ __decorate([
20470
20534
  data.cullingMask[cullingMaskStart] = cullingMask & 65535;
20471
20535
  data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
20472
20536
  if (this.engine.settings.colorSpace === ColorSpace.Linear) {
20473
- data.color[colorStart] = Color$1.gammaToLinearSpace(lightColor.r);
20474
- data.color[colorStart + 1] = Color$1.gammaToLinearSpace(lightColor.g);
20475
- data.color[colorStart + 2] = Color$1.gammaToLinearSpace(lightColor.b);
20537
+ data.color[colorStart] = Color.gammaToLinearSpace(lightColor.r);
20538
+ data.color[colorStart + 1] = Color.gammaToLinearSpace(lightColor.g);
20539
+ data.color[colorStart + 2] = Color.gammaToLinearSpace(lightColor.b);
20476
20540
  } else {
20477
20541
  data.color[colorStart] = lightColor.r;
20478
20542
  data.color[colorStart + 1] = lightColor.g;
@@ -20562,9 +20626,9 @@ __decorate([
20562
20626
  data.cullingMask[cullingMaskStart] = cullingMask & 65535;
20563
20627
  data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
20564
20628
  if (this.engine.settings.colorSpace === ColorSpace.Linear) {
20565
- data.color[colorStart] = Color$1.gammaToLinearSpace(lightColor.r);
20566
- data.color[colorStart + 1] = Color$1.gammaToLinearSpace(lightColor.g);
20567
- data.color[colorStart + 2] = Color$1.gammaToLinearSpace(lightColor.b);
20629
+ data.color[colorStart] = Color.gammaToLinearSpace(lightColor.r);
20630
+ data.color[colorStart + 1] = Color.gammaToLinearSpace(lightColor.g);
20631
+ data.color[colorStart + 2] = Color.gammaToLinearSpace(lightColor.b);
20568
20632
  } else {
20569
20633
  data.color[colorStart] = lightColor.r;
20570
20634
  data.color[colorStart + 1] = lightColor.g;
@@ -20658,9 +20722,9 @@ __decorate([
20658
20722
  data.cullingMask[cullingMaskStart] = cullingMask & 65535;
20659
20723
  data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
20660
20724
  if (this.engine.settings.colorSpace === ColorSpace.Linear) {
20661
- data.color[colorStart] = Color$1.gammaToLinearSpace(lightColor.r);
20662
- data.color[colorStart + 1] = Color$1.gammaToLinearSpace(lightColor.g);
20663
- data.color[colorStart + 2] = Color$1.gammaToLinearSpace(lightColor.b);
20725
+ data.color[colorStart] = Color.gammaToLinearSpace(lightColor.r);
20726
+ data.color[colorStart + 1] = Color.gammaToLinearSpace(lightColor.g);
20727
+ data.color[colorStart + 2] = Color.gammaToLinearSpace(lightColor.b);
20664
20728
  } else {
20665
20729
  data.color[colorStart] = lightColor.r;
20666
20730
  data.color[colorStart + 1] = lightColor.g;
@@ -20949,7 +21013,7 @@ __decorate([
20949
21013
  _this._shaderData = new ShaderData(ShaderDataGroup.Scene);
20950
21014
  _this._shadowCascades = ShadowCascadesMode.NoCascades;
20951
21015
  _this._fogMode = FogMode.None;
20952
- _this._fogColor = new Color$1(0.5, 0.5, 0.5, 1.0);
21016
+ _this._fogColor = new Color(0.5, 0.5, 0.5, 1.0);
20953
21017
  _this._fogStart = 0;
20954
21018
  _this._fogEnd = 300;
20955
21019
  _this._fogDensity = 0.01;
@@ -21865,12 +21929,38 @@ var passNum = 0;
21865
21929
  /**
21866
21930
  * @internal
21867
21931
  */ RenderQueue._compareFromNearToFar = function _compareFromNearToFar(a, b) {
21868
- return a.data.component.priority - b.data.component.priority || a.data.component._distanceForSort - b.data.component._distanceForSort;
21932
+ var dataA = a.data;
21933
+ var dataB = b.data;
21934
+ var componentA = dataA.component;
21935
+ var componentB = dataB.component;
21936
+ var priorityOrder = componentA.priority - componentB.priority;
21937
+ if (priorityOrder !== 0) {
21938
+ return priorityOrder;
21939
+ }
21940
+ // make suer from the same renderer.
21941
+ if (componentA.instanceId === componentB.instanceId) {
21942
+ return dataA.material._priority - dataB.material._priority || componentA._distanceForSort - componentB._distanceForSort;
21943
+ } else {
21944
+ return componentA._distanceForSort - componentB._distanceForSort;
21945
+ }
21869
21946
  };
21870
21947
  /**
21871
21948
  * @internal
21872
21949
  */ RenderQueue._compareFromFarToNear = function _compareFromFarToNear(a, b) {
21873
- return a.data.component.priority - b.data.component.priority || b.data.component._distanceForSort - a.data.component._distanceForSort;
21950
+ var dataA = a.data;
21951
+ var dataB = b.data;
21952
+ var componentA = dataA.component;
21953
+ var componentB = dataB.component;
21954
+ var priorityOrder = componentA.priority - componentB.priority;
21955
+ if (priorityOrder !== 0) {
21956
+ return priorityOrder;
21957
+ }
21958
+ // make suer from the same renderer.
21959
+ if (componentA.instanceId === componentB.instanceId) {
21960
+ return dataA.material._priority - dataB.material._priority || componentB._distanceForSort - componentA._distanceForSort;
21961
+ } else {
21962
+ return componentB._distanceForSort - componentA._distanceForSort;
21963
+ }
21874
21964
  };
21875
21965
  return RenderQueue;
21876
21966
  }();
@@ -22025,7 +22115,7 @@ var /**
22025
22115
  // https://lxjk.github.io/2017/04/15/Calculate-Minimal-Bounding-Sphere-of-Frustum.html
22026
22116
  var centerZ;
22027
22117
  var radius;
22028
- var k = Math.sqrt(1.0 + aspectRatio * aspectRatio) * Math.tan(MathUtil$1.degreeToRadian(fieldOfView) / 2.0);
22118
+ var k = Math.sqrt(1.0 + aspectRatio * aspectRatio) * Math.tan(MathUtil.degreeToRadian(fieldOfView) / 2.0);
22029
22119
  var k2 = k * k;
22030
22120
  var farSNear = far - near;
22031
22121
  var farANear = far + near;
@@ -22607,7 +22697,7 @@ var /**
22607
22697
  var _this__camera = this._camera, nearClipPlane = _this__camera.nearClipPlane, aspectRatio = _this__camera.aspectRatio, fieldOfView = _this__camera.fieldOfView;
22608
22698
  cascadesSplitDistance[0] = nearClipPlane;
22609
22699
  var range = shadowFar - nearClipPlane;
22610
- var tFov = Math.tan(MathUtil$1.degreeToRadian(fieldOfView) * 0.5);
22700
+ var tFov = Math.tan(MathUtil.degreeToRadian(fieldOfView) * 0.5);
22611
22701
  var denominator = 1.0 + tFov * tFov * (aspectRatio * aspectRatio + 1.0);
22612
22702
  switch(shadowCascades){
22613
22703
  case ShadowCascadesMode.NoCascades:
@@ -22710,7 +22800,7 @@ var /**
22710
22800
  CascadedShadowCasterPass._viewport = new Vector4(0, 0, 1, 1);
22711
22801
  })();
22712
22802
  (function() {
22713
- CascadedShadowCasterPass._clearColor = new Color$1(1, 1, 1, 1);
22803
+ CascadedShadowCasterPass._clearColor = new Color(1, 1, 1, 1);
22714
22804
  })();
22715
22805
  (function() {
22716
22806
  CascadedShadowCasterPass._tempVector = new Vector3();
@@ -23170,7 +23260,7 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component1) {
23170
23260
  // Use the intersection of the near clipping plane as the origin point.
23171
23261
  var origin = this._innerViewportToWorldPoint(point.x, point.y, 0.0, invViewProjMat, out.origin);
23172
23262
  // Use the intersection of the far clipping plane as the origin point.
23173
- var direction = this._innerViewportToWorldPoint(point.x, point.y, 1 - MathUtil$1.zeroTolerance, invViewProjMat, out.direction);
23263
+ var direction = this._innerViewportToWorldPoint(point.x, point.y, 1 - MathUtil.zeroTolerance, invViewProjMat, out.direction);
23174
23264
  Vector3.subtract(direction, origin, direction);
23175
23265
  direction.normalize();
23176
23266
  return out;
@@ -23533,7 +23623,7 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component1) {
23533
23623
  this._isProjectionDirty = false;
23534
23624
  var aspectRatio = this.aspectRatio;
23535
23625
  if (!virtualCamera.isOrthographic) {
23536
- Matrix.perspective(MathUtil$1.degreeToRadian(this._fieldOfView), aspectRatio, this._nearClipPlane, this._farClipPlane, projectionMatrix);
23626
+ Matrix.perspective(MathUtil.degreeToRadian(this._fieldOfView), aspectRatio, this._nearClipPlane, this._farClipPlane, projectionMatrix);
23537
23627
  } else {
23538
23628
  var width = this._orthographicSize * aspectRatio;
23539
23629
  var height = this._orthographicSize;
@@ -24084,9 +24174,9 @@ var BaseMaterial = /*#__PURE__*/ function(Material1) {
24084
24174
  var shaderData = _this.shaderData;
24085
24175
  shaderData.enableMacro("MATERIAL_NEED_WORLD_POS");
24086
24176
  shaderData.enableMacro("MATERIAL_NEED_TILING_OFFSET");
24087
- shaderData.setColor(BlinnPhongMaterial._baseColorProp, new Color$1(1, 1, 1, 1));
24088
- shaderData.setColor(BlinnPhongMaterial._specularColorProp, new Color$1(1, 1, 1, 1));
24089
- shaderData.setColor(BlinnPhongMaterial._emissiveColorProp, new Color$1(0, 0, 0, 1));
24177
+ shaderData.setColor(BlinnPhongMaterial._baseColorProp, new Color(1, 1, 1, 1));
24178
+ shaderData.setColor(BlinnPhongMaterial._specularColorProp, new Color(1, 1, 1, 1));
24179
+ shaderData.setColor(BlinnPhongMaterial._emissiveColorProp, new Color(0, 0, 0, 1));
24090
24180
  shaderData.setVector4(BlinnPhongMaterial._tilingOffsetProp, new Vector4(1, 1, 0, 0));
24091
24181
  shaderData.setFloat(BlinnPhongMaterial._shininessProp, 16);
24092
24182
  shaderData.setFloat(BlinnPhongMaterial._normalIntensityProp, 1);
@@ -24278,8 +24368,8 @@ var BaseMaterial = /*#__PURE__*/ function(Material1) {
24278
24368
  var shaderData = _this.shaderData;
24279
24369
  shaderData.enableMacro("MATERIAL_NEED_WORLD_POS");
24280
24370
  shaderData.enableMacro("MATERIAL_NEED_TILING_OFFSET");
24281
- shaderData.setColor(PBRBaseMaterial._baseColorProp, new Color$1(1, 1, 1, 1));
24282
- shaderData.setColor(PBRBaseMaterial._emissiveColorProp, new Color$1(0, 0, 0, 1));
24371
+ shaderData.setColor(PBRBaseMaterial._baseColorProp, new Color(1, 1, 1, 1));
24372
+ shaderData.setColor(PBRBaseMaterial._emissiveColorProp, new Color(0, 0, 0, 1));
24283
24373
  shaderData.setVector4(PBRBaseMaterial._tilingOffsetProp, new Vector4(1, 1, 0, 0));
24284
24374
  shaderData.setFloat(PBRBaseMaterial._normalIntensityProp, 1);
24285
24375
  shaderData.setFloat(PBRBaseMaterial._occlusionTextureIntensityProp, 1);
@@ -24646,7 +24736,7 @@ var BaseMaterial = /*#__PURE__*/ function(Material1) {
24646
24736
  if (this._anisotropyRotation !== value) {
24647
24737
  this._anisotropyRotation = value;
24648
24738
  var anisotropyInfo = this.shaderData.getVector3(PBRMaterial._anisotropyInfoProp);
24649
- var rad = MathUtil$1.degreeToRadFactor * value;
24739
+ var rad = MathUtil.degreeToRadFactor * value;
24650
24740
  anisotropyInfo.x = Math.cos(rad);
24651
24741
  anisotropyInfo.y = Math.sin(rad);
24652
24742
  }
@@ -24700,7 +24790,7 @@ var BaseMaterial = /*#__PURE__*/ function(Material1) {
24700
24790
  function PBRSpecularMaterial(engine) {
24701
24791
  var _this;
24702
24792
  _this = PBRBaseMaterial1.call(this, engine, Shader.find("pbr-specular")) || this;
24703
- _this.shaderData.setColor(PBRSpecularMaterial._specularColorProp, new Color$1(1, 1, 1, 1));
24793
+ _this.shaderData.setColor(PBRSpecularMaterial._specularColorProp, new Color(1, 1, 1, 1));
24704
24794
  _this.shaderData.setFloat(PBRSpecularMaterial._glossinessProp, 1.0);
24705
24795
  return _this;
24706
24796
  }
@@ -24781,7 +24871,7 @@ var BaseMaterial = /*#__PURE__*/ function(Material1) {
24781
24871
  var shaderData = _this.shaderData;
24782
24872
  shaderData.enableMacro("MATERIAL_OMIT_NORMAL");
24783
24873
  shaderData.enableMacro("MATERIAL_NEED_TILING_OFFSET");
24784
- shaderData.setColor(UnlitMaterial._baseColorProp, new Color$1(1, 1, 1, 1));
24874
+ shaderData.setColor(UnlitMaterial._baseColorProp, new Color(1, 1, 1, 1));
24785
24875
  shaderData.setVector4(UnlitMaterial._tilingOffsetProp, new Vector4(1, 1, 0, 0));
24786
24876
  return _this;
24787
24877
  }
@@ -25241,6 +25331,7 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
25241
25331
  _this = EngineObject1.call(this, null) || this;
25242
25332
  _this.name = name;
25243
25333
  _this./** @internal */ _curveBindings = [];
25334
+ _this./** @internal */ _updateFlagManager = new UpdateFlagManager();
25244
25335
  _this._length = 0;
25245
25336
  _this._events = [];
25246
25337
  return _this;
@@ -25268,11 +25359,13 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
25268
25359
  while(--index >= 0 && eventTime < events[index].time);
25269
25360
  events.splice(index + 1, 0, newEvent);
25270
25361
  }
25362
+ this._updateFlagManager.dispatch();
25271
25363
  };
25272
25364
  /**
25273
25365
  * Clears all events from the clip.
25274
25366
  */ _proto.clearEvents = function clearEvents() {
25275
25367
  this._events.length = 0;
25368
+ this._updateFlagManager.dispatch();
25276
25369
  };
25277
25370
  _proto.addCurveBinding = function addCurveBinding(entityPath, componentType, propertyOrSetPropertyPathOrComponentIndex, curveOrSetPropertyPathOrGetPropertyPath, curveOrGetPropertyPath, curve) {
25278
25371
  var curveBinding = new AnimationClipCurveBinding();
@@ -25669,32 +25762,32 @@ var AnimationColorCurve = (_AnimationColorCurve = /*#__PURE__*/ function(Animati
25669
25762
  function AnimationColorCurve() {
25670
25763
  var _this;
25671
25764
  _this = AnimationCurve1.call(this) || this;
25672
- _this._evaluateData.value = new Color$1();
25765
+ _this._evaluateData.value = new Color();
25673
25766
  return _this;
25674
25767
  }
25675
25768
  /**
25676
25769
  * @internal
25677
25770
  */ AnimationColorCurve._initializeOwner = function _initializeOwner(owner) {
25678
- owner.defaultValue = new Color$1();
25679
- owner.fixedPoseValue = new Color$1();
25680
- owner.baseEvaluateData.value = new Color$1();
25681
- owner.crossEvaluateData.value = new Color$1();
25771
+ owner.defaultValue = new Color();
25772
+ owner.fixedPoseValue = new Color();
25773
+ owner.baseEvaluateData.value = new Color();
25774
+ owner.crossEvaluateData.value = new Color();
25682
25775
  };
25683
25776
  /**
25684
25777
  * @internal
25685
25778
  */ AnimationColorCurve._initializeLayerOwner = function _initializeLayerOwner(owner) {
25686
- owner.finalValue = new Color$1();
25779
+ owner.finalValue = new Color();
25687
25780
  };
25688
25781
  /**
25689
25782
  * @internal
25690
25783
  */ AnimationColorCurve._lerpValue = function _lerpValue(srcValue, destValue, weight, out) {
25691
- Color$1.lerp(srcValue, destValue, weight, out);
25784
+ Color.lerp(srcValue, destValue, weight, out);
25692
25785
  return out;
25693
25786
  };
25694
25787
  /**
25695
25788
  * @internal
25696
25789
  */ AnimationColorCurve._subtractValue = function _subtractValue(src, base, out) {
25697
- Color$1.subtract(src, base, out);
25790
+ Color.subtract(src, base, out);
25698
25791
  return out;
25699
25792
  };
25700
25793
  /**
@@ -25706,8 +25799,8 @@ var AnimationColorCurve = (_AnimationColorCurve = /*#__PURE__*/ function(Animati
25706
25799
  /**
25707
25800
  * @internal
25708
25801
  */ AnimationColorCurve._additiveValue = function _additiveValue(value, weight, out) {
25709
- Color$1.scale(value, weight, value);
25710
- Color$1.add(out, value, out);
25802
+ Color.scale(value, weight, value);
25803
+ Color.add(out, value, out);
25711
25804
  return out;
25712
25805
  };
25713
25806
  /**
@@ -26829,26 +26922,31 @@ var AnimatorLayerBlendingMode;
26829
26922
  }
26830
26923
  };
26831
26924
  _proto._saveAnimatorEventHandlers = function _saveAnimatorEventHandlers(state, animatorStateData) {
26925
+ var _this = this;
26832
26926
  var eventHandlerPool = this._animationEventHandlerPool;
26833
26927
  var scripts = [];
26834
- this._entity.getComponents(Script, scripts);
26835
- var scriptCount = scripts.length;
26836
26928
  var eventHandlers = animatorStateData.eventHandlers;
26837
- var events = state.clip.events;
26838
- eventHandlers.length = 0;
26839
- for(var i = 0, n = events.length; i < n; i++){
26840
- var event = events[i];
26841
- var eventHandler = eventHandlerPool.getFromPool();
26842
- var funcName = event.functionName;
26843
- var handlers = eventHandler.handlers;
26844
- eventHandler.event = event;
26845
- handlers.length = 0;
26846
- for(var j = scriptCount - 1; j >= 0; j--){
26847
- var handler = scripts[j][funcName];
26848
- handler && handlers.push(handler);
26929
+ var clipChangedListener = function() {
26930
+ _this._entity.getComponents(Script, scripts);
26931
+ var scriptCount = scripts.length;
26932
+ var events = state.clip.events;
26933
+ eventHandlers.length = 0;
26934
+ for(var i = 0, n = events.length; i < n; i++){
26935
+ var event = events[i];
26936
+ var eventHandler = eventHandlerPool.getFromPool();
26937
+ var funcName = event.functionName;
26938
+ var handlers = eventHandler.handlers;
26939
+ eventHandler.event = event;
26940
+ handlers.length = 0;
26941
+ for(var j = scriptCount - 1; j >= 0; j--){
26942
+ var handler = scripts[j][funcName];
26943
+ handler && handlers.push(handler);
26944
+ }
26945
+ eventHandlers.push(eventHandler);
26849
26946
  }
26850
- eventHandlers.push(eventHandler);
26851
- }
26947
+ };
26948
+ clipChangedListener();
26949
+ state._updateFlagManager.addListener(clipChangedListener);
26852
26950
  };
26853
26951
  _proto._clearCrossData = function _clearCrossData(animatorLayerData) {
26854
26952
  animatorLayerData.crossCurveMark++;
@@ -27459,9 +27557,11 @@ __decorate([
27459
27557
  this./** @internal */ _onStateEnterScripts = [];
27460
27558
  this./** @internal */ _onStateUpdateScripts = [];
27461
27559
  this./** @internal */ _onStateExitScripts = [];
27560
+ this./** @internal */ _updateFlagManager = new UpdateFlagManager();
27462
27561
  this._clipStartTime = 0;
27463
27562
  this._clipEndTime = 1;
27464
27563
  this._transitions = [];
27564
+ this._onClipChanged = this._onClipChanged.bind(this);
27465
27565
  }
27466
27566
  var _proto = AnimatorState.prototype;
27467
27567
  /**
@@ -27535,6 +27635,11 @@ __decorate([
27535
27635
  index2 !== -1 && this._onStateExitScripts.splice(index2, 1);
27536
27636
  }
27537
27637
  };
27638
+ /**
27639
+ * @internal
27640
+ */ _proto._onClipChanged = function _onClipChanged() {
27641
+ this._updateFlagManager.dispatch();
27642
+ };
27538
27643
  _create_class(AnimatorState, [
27539
27644
  {
27540
27645
  key: "transitions",
@@ -27552,8 +27657,17 @@ __decorate([
27552
27657
  return this._clip;
27553
27658
  },
27554
27659
  set: function set(clip) {
27660
+ var lastClip = this._clip;
27661
+ if (lastClip === clip) {
27662
+ return;
27663
+ }
27664
+ if (lastClip) {
27665
+ lastClip._updateFlagManager.removeListener(this._onClipChanged);
27666
+ }
27555
27667
  this._clip = clip;
27556
27668
  this._clipEndTime = Math.min(this._clipEndTime, 1);
27669
+ this._onClipChanged();
27670
+ clip._updateFlagManager.addListener(this._onClipChanged);
27557
27671
  }
27558
27672
  },
27559
27673
  {
@@ -27764,7 +27878,7 @@ var AnimatorConditionMode;
27764
27878
  var _this;
27765
27879
  _this = Material1.call(this, engine, Shader.find("skybox")) || this;
27766
27880
  _this._textureDecodeRGBM = false;
27767
- _this._tintColor = new Color$1(1, 1, 1, 1);
27881
+ _this._tintColor = new Color(1, 1, 1, 1);
27768
27882
  _this.renderState.rasterState.cullMode = CullMode.Off;
27769
27883
  _this.renderState.depthState.compareFunction = CompareFunction.LessEqual;
27770
27884
  _this.shaderData.setFloat(SkyBoxMaterial._rotationProp, 0);
@@ -27877,8 +27991,8 @@ var SunMode;
27877
27991
  _this.sunSize = 0.04;
27878
27992
  _this.sunSizeConvergence = 5;
27879
27993
  _this.atmosphereThickness = 1.0;
27880
- _this.skyTint = new Color$1(0.5, 0.5, 0.5, 1.0);
27881
- _this.groundTint = new Color$1(0.369, 0.349, 0.341, 1.0);
27994
+ _this.skyTint = new Color(0.5, 0.5, 0.5, 1.0);
27995
+ _this.groundTint = new Color(0.369, 0.349, 0.341, 1.0);
27882
27996
  _this.exposure = 1.3;
27883
27997
  _this.renderState.rasterState.cullMode = CullMode.Off;
27884
27998
  _this.renderState.depthState.compareFunction = CompareFunction.LessEqual;
@@ -28358,9 +28472,9 @@ __decorate([
28358
28472
  typeArray[offset] = key.time;
28359
28473
  var color = key.color;
28360
28474
  if (colorSpace === ColorSpace.Linear) {
28361
- typeArray[offset + 1] = Color$1.gammaToLinearSpace(color.r);
28362
- typeArray[offset + 2] = Color$1.gammaToLinearSpace(color.g);
28363
- typeArray[offset + 3] = Color$1.gammaToLinearSpace(color.b);
28475
+ typeArray[offset + 1] = Color.gammaToLinearSpace(color.r);
28476
+ typeArray[offset + 2] = Color.gammaToLinearSpace(color.g);
28477
+ typeArray[offset + 3] = Color.gammaToLinearSpace(color.b);
28364
28478
  } else {
28365
28479
  typeArray[offset + 1] = color.r;
28366
28480
  typeArray[offset + 2] = color.g;
@@ -28445,7 +28559,7 @@ __decorate([
28445
28559
  */ var GradientColorKey = /*#__PURE__*/ function() {
28446
28560
  function GradientColorKey(time, color) {
28447
28561
  /** @internal */ this._onValueChanged = null;
28448
- this._color = new Color$1();
28562
+ this._color = new Color();
28449
28563
  this._time = time;
28450
28564
  color && this._color.copyFrom(color);
28451
28565
  // @ts-ignore
@@ -28522,11 +28636,11 @@ __decorate([
28522
28636
  */ var ParticleCompositeGradient = /*#__PURE__*/ function() {
28523
28637
  function ParticleCompositeGradient(constantOrGradient, constantMaxOrGradientMax) {
28524
28638
  /** The gradient mode. */ this.mode = ParticleGradientMode.Constant;
28525
- /* The min constant color used by the gradient if mode is set to `TwoConstants`. */ this.constantMin = new Color$1();
28526
- /* The max constant color used by the gradient if mode is set to `TwoConstants`. */ this.constantMax = new Color$1();
28639
+ /* The min constant color used by the gradient if mode is set to `TwoConstants`. */ this.constantMin = new Color();
28640
+ /* The max constant color used by the gradient if mode is set to `TwoConstants`. */ this.constantMax = new Color();
28527
28641
  /** The min gradient used by the gradient if mode is set to `Gradient`. */ this.gradientMin = new ParticleGradient();
28528
28642
  /** The max gradient used by the gradient if mode is set to `Gradient`. */ this.gradientMax = new ParticleGradient();
28529
- if (constantOrGradient.constructor === Color$1) {
28643
+ if (constantOrGradient.constructor === Color) {
28530
28644
  if (constantMaxOrGradientMax) {
28531
28645
  this.constantMin.copyFrom(constantOrGradient);
28532
28646
  this.constantMax.copyFrom(constantMaxOrGradientMax);
@@ -28558,7 +28672,7 @@ __decorate([
28558
28672
  out.copyFrom(this.constant);
28559
28673
  break;
28560
28674
  case ParticleGradientMode.TwoConstants:
28561
- Color$1.lerp(this.constantMin, this.constantMax, lerpFactor, out);
28675
+ Color.lerp(this.constantMin, this.constantMax, lerpFactor, out);
28562
28676
  break;
28563
28677
  }
28564
28678
  };
@@ -28630,8 +28744,8 @@ __decorate([
28630
28744
  var _this;
28631
28745
  _this = ParticleGeneratorModule1.apply(this, arguments) || this;
28632
28746
  /** Color gradient over lifetime. */ _this.color = new ParticleCompositeGradient(new ParticleGradient([
28633
- new GradientColorKey(0.0, new Color$1(1, 1, 1)),
28634
- new GradientColorKey(1.0, new Color$1(1, 1, 1))
28747
+ new GradientColorKey(0.0, new Color(1, 1, 1)),
28748
+ new GradientColorKey(1.0, new Color(1, 1, 1))
28635
28749
  ], [
28636
28750
  new GradientAlphaKey(0, 1),
28637
28751
  new GradientAlphaKey(1, 1)
@@ -28961,7 +29075,7 @@ var MainModule = /*#__PURE__*/ function() {
28961
29075
  /** The initial rotation of particles around the y-axis when emitted. */ this.startRotationY = new ParticleCompositeCurve(0);
28962
29076
  /** The initial rotation of particles around the z-axis when emitted. */ this.startRotationZ = new ParticleCompositeCurve(0);
28963
29077
  /** Makes some particles spin in the opposite direction. */ this.flipRotation = 0;
28964
- /** The mode of start color */ this.startColor = new ParticleCompositeGradient(new Color$1(1, 1, 1, 1));
29078
+ /** The mode of start color */ this.startColor = new ParticleCompositeGradient(new Color(1, 1, 1, 1));
28965
29079
  /** A scale that this Particle Generator applies to gravity, defined by Physics.gravity. */ this.gravityModifier = new ParticleCompositeCurve(0);
28966
29080
  /** This selects the space in which to simulate particles. It can be either world or local space. */ this.simulationSpace = ParticleSimulationSpace.Local;
28967
29081
  /** Override the default playback speed of the Particle Generator. */ this.simulationSpeed = 1.0;
@@ -29206,11 +29320,11 @@ __decorate([
29206
29320
  isCurveMacro = RotationOverLifetimeModule._curveModeMacro;
29207
29321
  } else {
29208
29322
  var constantMax = this._rotationMaxConstant;
29209
- constantMax.set(MathUtil$1.degreeToRadian(rotationX.constantMax), MathUtil$1.degreeToRadian(rotationY.constantMax), MathUtil$1.degreeToRadian(rotationZ.constantMax));
29323
+ constantMax.set(MathUtil.degreeToRadian(rotationX.constantMax), MathUtil.degreeToRadian(rotationY.constantMax), MathUtil.degreeToRadian(rotationZ.constantMax));
29210
29324
  shaderData.setVector3(RotationOverLifetimeModule._maxConstantProperty, constantMax);
29211
29325
  if (separateAxes ? rotationX.mode === ParticleCurveMode.TwoConstants && rotationY.mode === ParticleCurveMode.TwoConstants && rotationZ.mode === ParticleCurveMode.TwoConstants : rotationZ.mode === ParticleCurveMode.TwoConstants) {
29212
29326
  var constantMin = this._rotationMinConstant;
29213
- constantMin.set(MathUtil$1.degreeToRadian(rotationX.constantMin), MathUtil$1.degreeToRadian(rotationY.constantMin), MathUtil$1.degreeToRadian(rotationZ.constantMin));
29327
+ constantMin.set(MathUtil.degreeToRadian(rotationX.constantMin), MathUtil.degreeToRadian(rotationY.constantMin), MathUtil.degreeToRadian(rotationZ.constantMin));
29214
29328
  shaderData.setVector3(RotationOverLifetimeModule._minConstantProperty, constantMin);
29215
29329
  isRandomTwoMacro = RotationOverLifetimeModule._isRandomTwoMacro;
29216
29330
  }
@@ -30094,11 +30208,11 @@ __decorate([
30094
30208
  // Start rotation
30095
30209
  var startRotationRand = main._startRotationRand;
30096
30210
  if (main.startRotation3D) {
30097
- instanceVertices[offset + 15] = MathUtil$1.degreeToRadian(main.startRotationX.evaluate(undefined, startRotationRand.random()));
30098
- instanceVertices[offset + 16] = MathUtil$1.degreeToRadian(main.startRotationY.evaluate(undefined, startRotationRand.random()));
30099
- instanceVertices[offset + 17] = MathUtil$1.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
30211
+ instanceVertices[offset + 15] = MathUtil.degreeToRadian(main.startRotationX.evaluate(undefined, startRotationRand.random()));
30212
+ instanceVertices[offset + 16] = MathUtil.degreeToRadian(main.startRotationY.evaluate(undefined, startRotationRand.random()));
30213
+ instanceVertices[offset + 17] = MathUtil.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
30100
30214
  } else {
30101
- instanceVertices[offset + 15] = MathUtil$1.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
30215
+ instanceVertices[offset + 15] = MathUtil.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
30102
30216
  }
30103
30217
  // Start speed
30104
30218
  instanceVertices[offset + 18] = startSpeed;
@@ -30261,7 +30375,7 @@ __decorate([
30261
30375
  /** @internal */ ParticleGenerator._tempVector31 = new Vector3();
30262
30376
  })();
30263
30377
  (function() {
30264
- /** @internal */ ParticleGenerator._tempColor0 = new Color$1();
30378
+ /** @internal */ ParticleGenerator._tempColor0 = new Color();
30265
30379
  })();
30266
30380
  (function() {
30267
30381
  /** @internal */ ParticleGenerator._tempParticleRenderers = new Array();
@@ -30341,7 +30455,7 @@ __decorate([
30341
30455
  var _this;
30342
30456
  _this = BaseMaterial1.call(this, engine, Shader.find("particle-shader")) || this;
30343
30457
  var shaderData = _this.shaderData;
30344
- shaderData.setColor(BaseMaterial._baseColorProp, new Color$1(1, 1, 1, 1));
30458
+ shaderData.setColor(BaseMaterial._baseColorProp, new Color(1, 1, 1, 1));
30345
30459
  _this.isTransparent = true;
30346
30460
  return _this;
30347
30461
  }
@@ -30536,12 +30650,12 @@ __decorate([
30536
30650
  switch(this.arcMode){
30537
30651
  case ParticleShapeArcMode.Loop:
30538
30652
  var normalizedEmitTime = emitTime * this.arcSpeed * (360 / this.arc) % 1;
30539
- var radian = MathUtil$1.degreeToRadian(this.arc * normalizedEmitTime);
30653
+ var radian = MathUtil.degreeToRadian(this.arc * normalizedEmitTime);
30540
30654
  positionPoint.set(Math.cos(radian), Math.sin(radian));
30541
30655
  positionPoint.scale(rand.random());
30542
30656
  break;
30543
30657
  case ParticleShapeArcMode.Random:
30544
- ShapeUtils.randomPointInsideUnitArcCircle(MathUtil$1.degreeToRadian(this.arc), positionPoint, rand);
30658
+ ShapeUtils.randomPointInsideUnitArcCircle(MathUtil.degreeToRadian(this.arc), positionPoint, rand);
30545
30659
  break;
30546
30660
  }
30547
30661
  position.set(positionPoint.x, positionPoint.y, 0);
@@ -30574,7 +30688,7 @@ __decorate([
30574
30688
  * @internal
30575
30689
  */ _proto._generatePositionAndDirection = function _generatePositionAndDirection(rand, emitTime, position, direction) {
30576
30690
  var unitPosition = ConeShape._tempVector20;
30577
- var radian = MathUtil$1.degreeToRadian(this.angle);
30691
+ var radian = MathUtil.degreeToRadian(this.angle);
30578
30692
  var dirSinA = Math.sin(radian);
30579
30693
  var dirCosA = Math.cos(radian);
30580
30694
  switch(this.emitType){