@galacean/engine-core 0.0.0-experimental-2.0-migrate.5 → 0.0.0-experimental-2.0-migrate.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +447 -385
- package/dist/main.js.map +1 -1
- package/dist/module.js +448 -386
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/2d/sprite/SpriteMask.d.ts +4 -0
- package/types/2d/sprite/SpriteRenderer.d.ts +4 -0
- package/types/2d/text/TextRenderer.d.ts +0 -1
- package/types/Renderer.d.ts +6 -1
- package/types/Signal.d.ts +6 -1
- package/types/Transform.d.ts +6 -1
- package/types/animation/Animator.d.ts +6 -1
- package/types/asset/LoadItem.d.ts +2 -1
- package/types/asset/ResourceManager.d.ts +16 -0
- package/types/base/DataObject.d.ts +2 -3
- package/types/clone/CloneDecorators.d.ts +17 -0
- package/types/clone/ComponentCloner.d.ts +1 -15
- package/types/clone/ICloneHook.d.ts +12 -0
- package/types/index.d.ts +3 -2
- package/types/mesh/MeshRenderer.d.ts +4 -0
- package/types/mesh/SkinnedMeshRenderer.d.ts +4 -0
- package/types/particle/ParticleGenerator.d.ts +6 -1
- package/types/particle/ParticleRenderer.d.ts +4 -0
- package/types/particle/modules/MainModule.d.ts +6 -2
- package/types/particle/modules/shape/MeshShape.d.ts +6 -1
- package/types/physics/Collider.d.ts +6 -2
- package/types/physics/DynamicCollider.d.ts +4 -0
- package/types/physics/shape/ColliderShape.d.ts +6 -2
- package/types/physics/shape/MeshColliderShape.d.ts +4 -0
- package/types/shader/ShaderData.d.ts +6 -1
- package/types/clone/CloneManager.d.ts +0 -35
- package/types/clone/enums/CloneMode.d.ts +0 -15
package/dist/main.js
CHANGED
|
@@ -131,73 +131,58 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
131
131
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
132
132
|
};
|
|
133
133
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
138
|
-
}
|
|
139
|
-
|
|
134
|
+
/** @internal */ var defaultCloneModeKey = Symbol("defaultCloneMode");
|
|
135
|
+
/** @internal */ var fieldCloneModesKey = Symbol("fieldCloneModes");
|
|
140
136
|
/**
|
|
141
|
-
*
|
|
137
|
+
* @internal
|
|
142
138
|
*/ var CloneMode = /*#__PURE__*/ function(CloneMode) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
* state keeps the clone's own.
|
|
149
|
-
*/ CloneMode[CloneMode["Deep"] = 2] = "Deep";
|
|
139
|
+
CloneMode[CloneMode["Ignore"] = 0] = "Ignore";
|
|
140
|
+
CloneMode[CloneMode["Assignment"] = 1] = "Assignment";
|
|
141
|
+
CloneMode[CloneMode["Remap"] = 2] = "Remap";
|
|
142
|
+
CloneMode[CloneMode["Copy"] = 3] = "Copy";
|
|
143
|
+
CloneMode[CloneMode["Deep"] = 4] = "Deep";
|
|
150
144
|
return CloneMode;
|
|
151
145
|
}({});
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
if (propertyKeyOrContext.kind !== "field") return;
|
|
162
|
-
propertyKeyOrContext.addInitializer(function() {
|
|
163
|
-
CloneManager._registerFieldMode(this, propertyKeyOrContext.name, mode);
|
|
164
|
-
});
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
CloneManager._registerFieldMode(targetOrValue, propertyKeyOrContext, mode);
|
|
168
|
-
}
|
|
169
|
-
function deepClone(targetOrValue, propertyKeyOrContext) {
|
|
170
|
-
_registerDecoratorFieldMode(targetOrValue, propertyKeyOrContext, CloneMode.Deep);
|
|
146
|
+
/**
|
|
147
|
+
* Property decorator — deep clone this field's whole subtree, overriding the value type's default
|
|
148
|
+
* clone mode (field-level decorators have the highest priority). The deep intent carries into
|
|
149
|
+
* field-cloneable members; engine-bound and platform objects keep their defaults. A decorator is
|
|
150
|
+
* an explicit intent: if the decorated value itself can't be deep cloned (an entity reference,
|
|
151
|
+
* asset, function, or object with opaque internal state), cloning throws rather than falling back.
|
|
152
|
+
* Field-cloned classes reproduce only their own enumerable string-keyed properties.
|
|
153
|
+
*/ function deepClone(target, propertyKey) {
|
|
154
|
+
CloneMetadata.registerFieldMode(target, propertyKey, 4);
|
|
171
155
|
}
|
|
172
|
-
|
|
173
|
-
|
|
156
|
+
/**
|
|
157
|
+
* Property decorator — assign (share the reference) this field, overriding the value type's default clone mode.
|
|
158
|
+
*/ function assignmentClone(target, propertyKey) {
|
|
159
|
+
CloneMetadata.registerFieldMode(target, propertyKey, 1);
|
|
174
160
|
}
|
|
175
|
-
|
|
176
|
-
|
|
161
|
+
/**
|
|
162
|
+
* Property decorator — ignore this field when cloning; keep the clone's own constructor-built value.
|
|
163
|
+
*/ function ignoreClone(target, propertyKey) {
|
|
164
|
+
CloneMetadata.registerFieldMode(target, propertyKey, 0);
|
|
177
165
|
}
|
|
178
166
|
/**
|
|
179
167
|
* @internal
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
var _target__fieldModes;
|
|
193
|
-
Object.defineProperty(target, "_fieldModes", {
|
|
194
|
-
value: Object.create((_target__fieldModes = target._fieldModes) != null ? _target__fieldModes : null),
|
|
168
|
+
*/ function registerDefaultCloneMode(target, mode) {
|
|
169
|
+
Object.defineProperty(target.prototype, defaultCloneModeKey, {
|
|
170
|
+
value: mode
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
var CloneMetadata = /*#__PURE__*/ function() {
|
|
174
|
+
function CloneMetadata() {}
|
|
175
|
+
CloneMetadata.registerFieldMode = function registerFieldMode(target, propertyKey, mode) {
|
|
176
|
+
if (!Object.prototype.hasOwnProperty.call(target, fieldCloneModesKey)) {
|
|
177
|
+
var _target_fieldCloneModesKey;
|
|
178
|
+
Object.defineProperty(target, fieldCloneModesKey, {
|
|
179
|
+
value: Object.create((_target_fieldCloneModesKey = target[fieldCloneModesKey]) != null ? _target_fieldCloneModesKey : null),
|
|
195
180
|
configurable: true
|
|
196
181
|
});
|
|
197
182
|
}
|
|
198
|
-
target
|
|
183
|
+
target[fieldCloneModesKey][propertyKey] = mode;
|
|
199
184
|
};
|
|
200
|
-
return
|
|
185
|
+
return CloneMetadata;
|
|
201
186
|
}();
|
|
202
187
|
|
|
203
188
|
/**
|
|
@@ -354,6 +339,7 @@ __decorate([
|
|
|
354
339
|
]);
|
|
355
340
|
return ReferResource;
|
|
356
341
|
}(EngineObject);
|
|
342
|
+
registerDefaultCloneMode(ReferResource, CloneMode.Assignment);
|
|
357
343
|
|
|
358
344
|
/**
|
|
359
345
|
* ContentRestorer is a base class for all content restore info classes.
|
|
@@ -3646,11 +3632,11 @@ Time._elapsedTimeProperty = ShaderProperty.getByName("scene_ElapsedTime");
|
|
|
3646
3632
|
Time._deltaTimeProperty = ShaderProperty.getByName("scene_DeltaTime");
|
|
3647
3633
|
|
|
3648
3634
|
/**
|
|
3649
|
-
* Base class
|
|
3650
|
-
*
|
|
3651
|
-
* constructible without arguments; a preset-less copy is created bare, then populated.
|
|
3635
|
+
* Base class for objects whose own enumerable string-keyed properties are structurally cloned by default.
|
|
3636
|
+
* Subclasses must support argument-less construction when no compatible preset exists.
|
|
3652
3637
|
*/ var DataObject = function DataObject() {
|
|
3653
3638
|
};
|
|
3639
|
+
registerDefaultCloneMode(DataObject, CloneMode.Deep);
|
|
3654
3640
|
|
|
3655
3641
|
var Utils = /*#__PURE__*/ function() {
|
|
3656
3642
|
function Utils() {}
|
|
@@ -3720,10 +3706,16 @@ var Utils = /*#__PURE__*/ function() {
|
|
|
3720
3706
|
if (Utils.isAbsoluteUrl(baseUrl)) {
|
|
3721
3707
|
return relativeUrl ? new URL(relativeUrl, baseUrl).href : baseUrl;
|
|
3722
3708
|
}
|
|
3723
|
-
|
|
3724
|
-
|
|
3709
|
+
// A relative virtual asset path (for example `SpriteAtlas/...`) must be
|
|
3710
|
+
// treated as a path, not as the host portion of a file URL. The latter
|
|
3711
|
+
// lowercases the first segment and breaks case-sensitive virtual-resource
|
|
3712
|
+
// lookup in Editor previews
|
|
3713
|
+
var resolvedHasLeadingSlash = baseUrl.startsWith("/") || relativeUrl.startsWith("/");
|
|
3714
|
+
var head = "file:///";
|
|
3715
|
+
var encodedBaseUrl = head + this._encodePathComponents(baseUrl.replace(/^\/+/, ""));
|
|
3725
3716
|
var encodedRelativeUrl = this._encodePathComponents(relativeUrl);
|
|
3726
|
-
|
|
3717
|
+
var resolvedPath = decodeURIComponent(new URL(encodedRelativeUrl, encodedBaseUrl).href.slice(head.length));
|
|
3718
|
+
return resolvedHasLeadingSlash ? "/" + resolvedPath : resolvedPath;
|
|
3727
3719
|
};
|
|
3728
3720
|
/**
|
|
3729
3721
|
* @internal
|
|
@@ -4060,6 +4052,7 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
4060
4052
|
]);
|
|
4061
4053
|
return DisorderedArray;
|
|
4062
4054
|
}();
|
|
4055
|
+
registerDefaultCloneMode(DisorderedArray, CloneMode.Ignore);
|
|
4063
4056
|
|
|
4064
4057
|
/**
|
|
4065
4058
|
* Sprite's tiling mode enumeration.
|
|
@@ -4970,6 +4963,7 @@ function _extends() {
|
|
|
4970
4963
|
};
|
|
4971
4964
|
return UpdateFlagManager;
|
|
4972
4965
|
}();
|
|
4966
|
+
registerDefaultCloneMode(UpdateFlagManager, CloneMode.Ignore);
|
|
4973
4967
|
|
|
4974
4968
|
/**
|
|
4975
4969
|
* Buffer usage.
|
|
@@ -5300,6 +5294,7 @@ __decorate([
|
|
|
5300
5294
|
__decorate([
|
|
5301
5295
|
ignoreClone
|
|
5302
5296
|
], Component.prototype, "_phasedActive", void 0);
|
|
5297
|
+
registerDefaultCloneMode(Component, CloneMode.Remap);
|
|
5303
5298
|
|
|
5304
5299
|
/**
|
|
5305
5300
|
* @internal
|
|
@@ -5429,6 +5424,7 @@ function dependentComponents(componentOrComponents, dependentMode) {
|
|
|
5429
5424
|
};
|
|
5430
5425
|
return UpdateFlag;
|
|
5431
5426
|
}();
|
|
5427
|
+
registerDefaultCloneMode(UpdateFlag, CloneMode.Ignore);
|
|
5432
5428
|
|
|
5433
5429
|
/**
|
|
5434
5430
|
* Bool update flag.
|
|
@@ -5622,8 +5618,8 @@ function dependentComponents(componentOrComponents, dependentMode) {
|
|
|
5622
5618
|
return this._frontFaceInvert;
|
|
5623
5619
|
};
|
|
5624
5620
|
/**
|
|
5625
|
-
* @
|
|
5626
|
-
*/ _proto.
|
|
5621
|
+
* @inheritdoc
|
|
5622
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
5627
5623
|
var position = target._position, rotation = target._rotation, scale = target._scale;
|
|
5628
5624
|
// @ts-ignore
|
|
5629
5625
|
position._onValueChanged = rotation._onValueChanged = scale._onValueChanged = null;
|
|
@@ -6331,6 +6327,12 @@ __decorate([
|
|
|
6331
6327
|
return SpriteMaskLayer;
|
|
6332
6328
|
}({});
|
|
6333
6329
|
|
|
6330
|
+
function _type_of(obj) {
|
|
6331
|
+
"@swc/helpers - typeof";
|
|
6332
|
+
|
|
6333
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
6334
|
+
}
|
|
6335
|
+
|
|
6334
6336
|
function _array_like_to_array(arr, len) {
|
|
6335
6337
|
if (len == null || len > arr.length) len = arr.length;
|
|
6336
6338
|
|
|
@@ -6443,15 +6445,15 @@ function _construct(Parent, args, Class) {
|
|
|
6443
6445
|
return Layer;
|
|
6444
6446
|
}({});
|
|
6445
6447
|
|
|
6446
|
-
|
|
6448
|
+
/**
|
|
6449
|
+
* @internal
|
|
6450
|
+
* Clones component fields and runs the component's post-clone hook.
|
|
6451
|
+
*/ var ComponentCloner = /*#__PURE__*/ function() {
|
|
6447
6452
|
function ComponentCloner() {}
|
|
6448
6453
|
/**
|
|
6449
|
-
*
|
|
6450
|
-
* @param source - Clone source
|
|
6451
|
-
* @param target - Clone target
|
|
6452
|
-
* @param cloneMap - Identity map of the cloned subtree (source object → clone)
|
|
6454
|
+
* @internal
|
|
6453
6455
|
*/ ComponentCloner.cloneComponent = function cloneComponent(source, target, cloneMap) {
|
|
6454
|
-
var fieldModes = source
|
|
6456
|
+
var fieldModes = source[fieldCloneModesKey];
|
|
6455
6457
|
var keys = Object.keys(source);
|
|
6456
6458
|
for(var i = 0, n = keys.length; i < n; i++){
|
|
6457
6459
|
var k = keys[i];
|
|
@@ -6459,10 +6461,10 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
6459
6461
|
if (fieldMode === CloneMode.Ignore) continue;
|
|
6460
6462
|
var sourceValue = source[k];
|
|
6461
6463
|
var preset = target[k];
|
|
6462
|
-
var cloned = target[k] = CloneUtil.
|
|
6464
|
+
var cloned = target[k] = CloneUtil._cloneFieldValue(sourceValue, preset, cloneMap, fieldMode);
|
|
6463
6465
|
CloneUtil._transferSlotOwnership(cloned, sourceValue, preset);
|
|
6464
6466
|
}
|
|
6465
|
-
source.
|
|
6467
|
+
source._onClone == null ? void 0 : source._onClone.call(source, target, cloneMap);
|
|
6466
6468
|
};
|
|
6467
6469
|
return ComponentCloner;
|
|
6468
6470
|
}();
|
|
@@ -7137,211 +7139,160 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
7137
7139
|
return Entity;
|
|
7138
7140
|
}(EngineObject);
|
|
7139
7141
|
/** @internal */ Entity._tempComponentConstructors = [];
|
|
7140
|
-
|
|
7141
|
-
var SafeLoopArray = /*#__PURE__*/ function() {
|
|
7142
|
-
function SafeLoopArray() {
|
|
7143
|
-
this._array = [];
|
|
7144
|
-
this._loopArray = [];
|
|
7145
|
-
this._loopArrayDirty = false;
|
|
7146
|
-
}
|
|
7147
|
-
var _proto = SafeLoopArray.prototype;
|
|
7148
|
-
/**
|
|
7149
|
-
* Push item to the array.
|
|
7150
|
-
* @param item - The item which want to be pushed
|
|
7151
|
-
*/ _proto.push = function push(item) {
|
|
7152
|
-
this._array.push(item);
|
|
7153
|
-
this._loopArrayDirty = true;
|
|
7154
|
-
};
|
|
7155
|
-
/**
|
|
7156
|
-
* Add item to the array.
|
|
7157
|
-
* @param index - The index of the array
|
|
7158
|
-
* @param item - The item which want to be added
|
|
7159
|
-
*/ _proto.add = function add(index, item) {
|
|
7160
|
-
this._array.splice(index, 0, item);
|
|
7161
|
-
this._loopArrayDirty = true;
|
|
7162
|
-
};
|
|
7163
|
-
/**
|
|
7164
|
-
* Remove item from the array.
|
|
7165
|
-
* @param index - The index of the array
|
|
7166
|
-
*/ _proto.removeByIndex = function removeByIndex(index) {
|
|
7167
|
-
this._array.splice(index, 1);
|
|
7168
|
-
this._loopArrayDirty = true;
|
|
7169
|
-
};
|
|
7170
|
-
/**
|
|
7171
|
-
* Remove item from array that pass the specified comparison function.
|
|
7172
|
-
* @param filter - The comparison function
|
|
7173
|
-
*/ _proto.findAndRemove = function findAndRemove(filter) {
|
|
7174
|
-
var array = this._array;
|
|
7175
|
-
for(var i = array.length - 1; i >= 0; i--){
|
|
7176
|
-
filter(array[i]) && this.removeByIndex(i);
|
|
7177
|
-
}
|
|
7178
|
-
};
|
|
7179
|
-
/**
|
|
7180
|
-
* The index of the item.
|
|
7181
|
-
* @param item - The item which want to get the index
|
|
7182
|
-
* @returns Index of the item
|
|
7183
|
-
*/ _proto.indexOf = function indexOf(item) {
|
|
7184
|
-
return this._array.indexOf(item);
|
|
7185
|
-
};
|
|
7186
|
-
/**
|
|
7187
|
-
* Get the array.
|
|
7188
|
-
* @returns The array
|
|
7189
|
-
*/ _proto.getArray = function getArray() {
|
|
7190
|
-
return this._array;
|
|
7191
|
-
};
|
|
7192
|
-
/**
|
|
7193
|
-
* Get the array use for loop.
|
|
7194
|
-
* @returns The array use for loop
|
|
7195
|
-
*/ _proto.getLoopArray = function getLoopArray() {
|
|
7196
|
-
var loopArray = this._loopArray;
|
|
7197
|
-
if (this._loopArrayDirty) {
|
|
7198
|
-
var array = this._array;
|
|
7199
|
-
var count = array.length;
|
|
7200
|
-
loopArray.length = count;
|
|
7201
|
-
for(var i = 0; i < count; i++){
|
|
7202
|
-
loopArray[i] = array[i];
|
|
7203
|
-
}
|
|
7204
|
-
this._loopArrayDirty = false;
|
|
7205
|
-
}
|
|
7206
|
-
return loopArray;
|
|
7207
|
-
};
|
|
7208
|
-
_create_class(SafeLoopArray, [
|
|
7209
|
-
{
|
|
7210
|
-
key: "length",
|
|
7211
|
-
get: /**
|
|
7212
|
-
* Get the length of the array.
|
|
7213
|
-
*/ function get() {
|
|
7214
|
-
return this._array.length;
|
|
7215
|
-
}
|
|
7216
|
-
}
|
|
7217
|
-
]);
|
|
7218
|
-
return SafeLoopArray;
|
|
7219
|
-
}();
|
|
7142
|
+
registerDefaultCloneMode(Entity, CloneMode.Remap);
|
|
7220
7143
|
|
|
7221
7144
|
/**
|
|
7222
7145
|
* @internal
|
|
7223
|
-
* Split from `CloneManager`, which must stay free of engine imports.
|
|
7224
7146
|
*/ var CloneUtil = /*#__PURE__*/ function() {
|
|
7225
7147
|
function CloneUtil() {}
|
|
7226
7148
|
/**
|
|
7227
7149
|
* @internal
|
|
7228
|
-
*/ CloneUtil.
|
|
7229
|
-
if (
|
|
7230
|
-
var fieldModes = source
|
|
7150
|
+
*/ CloneUtil._cloneObjectFields = function _cloneObjectFields(source, target, cloneMap, deepCloneSubtree) {
|
|
7151
|
+
if (deepCloneSubtree === void 0) deepCloneSubtree = false;
|
|
7152
|
+
var fieldModes = source[fieldCloneModesKey];
|
|
7231
7153
|
var keys = Object.keys(source);
|
|
7232
7154
|
for(var i = 0, n = keys.length; i < n; i++){
|
|
7233
7155
|
var k = keys[i];
|
|
7234
7156
|
var fieldMode = fieldModes == null ? void 0 : fieldModes[k];
|
|
7235
7157
|
if (fieldMode === CloneMode.Ignore) continue;
|
|
7236
|
-
target[k] = CloneUtil.
|
|
7158
|
+
target[k] = CloneUtil._cloneFieldValue(source[k], target[k], cloneMap, fieldMode, deepCloneSubtree);
|
|
7237
7159
|
}
|
|
7238
7160
|
};
|
|
7239
7161
|
/**
|
|
7240
7162
|
* @internal
|
|
7241
|
-
*/ CloneUtil.
|
|
7242
|
-
if (
|
|
7163
|
+
*/ CloneUtil._cloneFieldValue = function _cloneFieldValue(source, preset, cloneMap, fieldMode, deepCloneSubtree) {
|
|
7164
|
+
if (deepCloneSubtree === void 0) deepCloneSubtree = false;
|
|
7243
7165
|
if (fieldMode === CloneMode.Assignment) return source;
|
|
7244
|
-
if (fieldMode === CloneMode.Deep)
|
|
7245
|
-
|
|
7246
|
-
forceDeepClone = true;
|
|
7247
|
-
}
|
|
7248
|
-
return CloneUtil._cloneByDefault(source, preset, cloneMap, forceDeepClone);
|
|
7166
|
+
if (fieldMode === CloneMode.Deep) return CloneUtil._cloneValueForDeepField(source, preset, cloneMap);
|
|
7167
|
+
return CloneUtil._cloneValueByDefault(source, preset, cloneMap, deepCloneSubtree);
|
|
7249
7168
|
};
|
|
7250
7169
|
/**
|
|
7251
7170
|
* @internal
|
|
7252
|
-
*/ CloneUtil.
|
|
7253
|
-
if (
|
|
7254
|
-
if (
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
if (
|
|
7260
|
-
|
|
7261
|
-
if (Array.isArray(source)) return CloneUtil._deepCloneArray(source, preset, cloneMap, forceDeepClone);
|
|
7262
|
-
if (_instanceof(source, Map)) return CloneUtil._deepCloneMap(source, preset, cloneMap, forceDeepClone);
|
|
7263
|
-
if (_instanceof(source, Set)) return CloneUtil._deepCloneSet(source, preset, cloneMap, forceDeepClone);
|
|
7264
|
-
if (_instanceof(source, DisorderedArray) || _instanceof(source, SafeLoopArray)) {
|
|
7265
|
-
if (!forceDeepClone) return preset;
|
|
7266
|
-
var existing = cloneMap.get(source);
|
|
7267
|
-
if (existing) return existing;
|
|
7268
|
-
var dst = CloneUtil._createCloneTarget(source, preset, cloneMap);
|
|
7269
|
-
CloneUtil._deepCloneObject(source, dst, cloneMap, true);
|
|
7270
|
-
return dst;
|
|
7271
|
-
}
|
|
7272
|
-
var ctor = source.constructor;
|
|
7273
|
-
if (ctor && ctor !== Object && typeof source.copyFrom === "function") {
|
|
7274
|
-
var existing1 = cloneMap.get(source);
|
|
7275
|
-
if (existing1) return existing1;
|
|
7276
|
-
var dst1 = CloneUtil._createCloneTarget(source, preset, cloneMap);
|
|
7277
|
-
dst1.copyFrom(source);
|
|
7278
|
-
source._cloneTo == null ? void 0 : source._cloneTo.call(source, dst1, cloneMap);
|
|
7279
|
-
return dst1;
|
|
7280
|
-
}
|
|
7281
|
-
if (_instanceof(source, DataObject) || ctor === Object || ctor === undefined || forceDeepClone) {
|
|
7282
|
-
var existing2 = cloneMap.get(source);
|
|
7283
|
-
if (existing2) return existing2;
|
|
7284
|
-
var dst2 = CloneUtil._createCloneTarget(source, preset, cloneMap);
|
|
7285
|
-
CloneUtil._deepCloneObject(source, dst2, cloneMap, forceDeepClone);
|
|
7286
|
-
source._cloneTo == null ? void 0 : source._cloneTo.call(source, dst2, cloneMap);
|
|
7287
|
-
return dst2;
|
|
7171
|
+
*/ CloneUtil._transferSlotOwnership = function _transferSlotOwnership(cloned, source, preset) {
|
|
7172
|
+
if (cloned === preset) return;
|
|
7173
|
+
if (_instanceof(preset, ReferResource)) {
|
|
7174
|
+
var presetRefCount = preset.refCount;
|
|
7175
|
+
presetRefCount !== undefined && presetRefCount <= 0 && Logger.error("CloneUtil: the clone's preset " + preset.constructor.name + " holds no owned reference; " + "a constructor presetting a ref-counted resource must acquire it (assign via its setter or an explicit +1).");
|
|
7176
|
+
preset._addReferCount(-1);
|
|
7177
|
+
}
|
|
7178
|
+
if (cloned === source && _instanceof(cloned, ReferResource)) {
|
|
7179
|
+
cloned._addReferCount(1);
|
|
7288
7180
|
}
|
|
7289
|
-
return source;
|
|
7290
7181
|
};
|
|
7291
|
-
|
|
7292
|
-
* @internal
|
|
7293
|
-
*/ CloneUtil._assertDeepCloneable = function _assertDeepCloneable(source) {
|
|
7182
|
+
CloneUtil._cloneValueForDeepField = function _cloneValueForDeepField(source, preset, cloneMap) {
|
|
7294
7183
|
if (typeof source === "function") {
|
|
7295
7184
|
throw new Error("CloneUtil: @deepClone cannot deep clone a function — code is not a cloneable graph. " + "Remove @deepClone to keep the clone's own binding.");
|
|
7296
7185
|
}
|
|
7297
7186
|
if (_instanceof(source, Entity) || _instanceof(source, Component)) {
|
|
7298
|
-
throw new Error('CloneUtil: @deepClone cannot deep clone "' + source
|
|
7187
|
+
throw new Error('CloneUtil: @deepClone cannot deep clone "' + CloneUtil._getTypeName(source) + '" — Entity / Component ' + "references are engine-bound. Remove @deepClone to remap the reference by default.");
|
|
7299
7188
|
}
|
|
7300
7189
|
if (_instanceof(source, ReferResource)) {
|
|
7301
|
-
throw new Error('CloneUtil: @deepClone cannot deep clone "' + source
|
|
7190
|
+
throw new Error('CloneUtil: @deepClone cannot deep clone "' + CloneUtil._getTypeName(source) + '" — assets are engine-bound ' + "and shared by reference. Remove @deepClone to share it, or copy it via the asset's own clone() API.");
|
|
7302
7191
|
}
|
|
7303
7192
|
if (_instanceof(source, UpdateFlagManager) || _instanceof(source, UpdateFlag)) {
|
|
7304
|
-
throw new Error('CloneUtil: @deepClone cannot deep clone "' + source
|
|
7193
|
+
throw new Error('CloneUtil: @deepClone cannot deep clone "' + CloneUtil._getTypeName(source) + '" — a flag and its manager hold ' + "each other, and a field copy resolves neither side, leaving the pair inconsistent. Remove " + "@deepClone to keep the clone's own.");
|
|
7194
|
+
}
|
|
7195
|
+
if (source === null || (typeof source === "undefined" ? "undefined" : _type_of(source)) !== "object") return source;
|
|
7196
|
+
switch(source[defaultCloneModeKey]){
|
|
7197
|
+
case CloneMode.Copy:
|
|
7198
|
+
return CloneUtil._cloneCopyFromValue(source, preset, cloneMap);
|
|
7199
|
+
case CloneMode.Deep:
|
|
7200
|
+
return CloneUtil._cloneObjectByFields(source, preset, cloneMap, true);
|
|
7305
7201
|
}
|
|
7202
|
+
if (ArrayBuffer.isView(source)) {
|
|
7203
|
+
return CloneUtil._deepCloneArrayBufferView(source, preset, cloneMap);
|
|
7204
|
+
}
|
|
7205
|
+
if (Array.isArray(source)) {
|
|
7206
|
+
return CloneUtil._cloneArray(source, preset, cloneMap, true);
|
|
7207
|
+
}
|
|
7208
|
+
if (_instanceof(source, Map)) {
|
|
7209
|
+
return CloneUtil._cloneMap(source, preset, cloneMap, true);
|
|
7210
|
+
}
|
|
7211
|
+
if (_instanceof(source, Set)) {
|
|
7212
|
+
return CloneUtil._cloneSet(source, preset, cloneMap, true);
|
|
7213
|
+
}
|
|
7214
|
+
if (!CloneUtil._hasOrdinaryObjectTag(source)) {
|
|
7215
|
+
throw new Error('CloneUtil: @deepClone cannot deep clone "' + CloneUtil._getTypeName(source) + '" — its internal state ' + "cannot be reproduced by cloning enumerable fields. Remove @deepClone to share it, or wrap the value " + "in a field-cloneable type.");
|
|
7216
|
+
}
|
|
7217
|
+
return CloneUtil._cloneObjectByFields(source, preset, cloneMap, true);
|
|
7306
7218
|
};
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7219
|
+
CloneUtil._cloneValueByDefault = function _cloneValueByDefault(source, preset, cloneMap, deepCloneSubtree) {
|
|
7220
|
+
if (deepCloneSubtree === void 0) deepCloneSubtree = false;
|
|
7221
|
+
if (typeof source === "function") {
|
|
7222
|
+
return deepCloneSubtree ? source : typeof preset === "function" ? preset : source;
|
|
7223
|
+
}
|
|
7224
|
+
if (source === null || (typeof source === "undefined" ? "undefined" : _type_of(source)) !== "object") return source;
|
|
7225
|
+
switch(source[defaultCloneModeKey]){
|
|
7226
|
+
case CloneMode.Ignore:
|
|
7227
|
+
return preset;
|
|
7228
|
+
case CloneMode.Assignment:
|
|
7229
|
+
return source;
|
|
7230
|
+
case CloneMode.Remap:
|
|
7231
|
+
var _cloneMap_get;
|
|
7232
|
+
return (_cloneMap_get = cloneMap.get(source)) != null ? _cloneMap_get : source;
|
|
7233
|
+
case CloneMode.Copy:
|
|
7234
|
+
return CloneUtil._cloneCopyFromValue(source, preset, cloneMap);
|
|
7235
|
+
case CloneMode.Deep:
|
|
7236
|
+
return CloneUtil._cloneObjectByFields(source, preset, cloneMap, deepCloneSubtree);
|
|
7237
|
+
}
|
|
7238
|
+
if (ArrayBuffer.isView(source)) {
|
|
7239
|
+
return CloneUtil._deepCloneArrayBufferView(source, preset, cloneMap);
|
|
7240
|
+
}
|
|
7241
|
+
if (Array.isArray(source)) {
|
|
7242
|
+
return CloneUtil._cloneArray(source, preset, cloneMap, deepCloneSubtree);
|
|
7243
|
+
}
|
|
7244
|
+
if (_instanceof(source, Map)) {
|
|
7245
|
+
return CloneUtil._cloneMap(source, preset, cloneMap, deepCloneSubtree);
|
|
7246
|
+
}
|
|
7247
|
+
if (_instanceof(source, Set)) {
|
|
7248
|
+
return CloneUtil._cloneSet(source, preset, cloneMap, deepCloneSubtree);
|
|
7249
|
+
}
|
|
7250
|
+
if (CloneUtil._isPlainObject(source) || deepCloneSubtree && CloneUtil._hasOrdinaryObjectTag(source)) {
|
|
7251
|
+
return CloneUtil._cloneObjectByFields(source, preset, cloneMap, deepCloneSubtree);
|
|
7252
|
+
}
|
|
7253
|
+
return source;
|
|
7254
|
+
};
|
|
7255
|
+
CloneUtil._cloneCopyFromValue = function _cloneCopyFromValue(source, preset, cloneMap) {
|
|
7256
|
+
var existing = cloneMap.get(source);
|
|
7257
|
+
if (existing) return existing;
|
|
7258
|
+
var dst = CloneUtil._createCloneTarget(source, preset, cloneMap);
|
|
7259
|
+
dst.copyFrom(source);
|
|
7260
|
+
source._onClone == null ? void 0 : source._onClone.call(source, dst, cloneMap);
|
|
7261
|
+
return dst;
|
|
7262
|
+
};
|
|
7263
|
+
CloneUtil._cloneObjectByFields = function _cloneObjectByFields(source, preset, cloneMap, deepCloneSubtree) {
|
|
7264
|
+
if (deepCloneSubtree === void 0) deepCloneSubtree = false;
|
|
7265
|
+
var existing = cloneMap.get(source);
|
|
7266
|
+
if (existing) return existing;
|
|
7267
|
+
var dst = CloneUtil._createCloneTarget(source, preset, cloneMap);
|
|
7268
|
+
CloneUtil._cloneObjectFields(source, dst, cloneMap, deepCloneSubtree);
|
|
7269
|
+
source._onClone == null ? void 0 : source._onClone.call(source, dst, cloneMap);
|
|
7270
|
+
return dst;
|
|
7271
|
+
};
|
|
7272
|
+
CloneUtil._createCloneTarget = function _createCloneTarget(source, preset, cloneMap) {
|
|
7273
|
+
var proto = Object.getPrototypeOf(source);
|
|
7274
|
+
var reusable = preset && preset !== source && Object.getPrototypeOf(preset) === proto && preset;
|
|
7312
7275
|
var dst;
|
|
7313
7276
|
if (reusable) {
|
|
7314
7277
|
dst = reusable;
|
|
7315
7278
|
} else {
|
|
7316
|
-
|
|
7279
|
+
var ctor = proto == null ? void 0 : proto.constructor;
|
|
7280
|
+
if (typeof ctor === "function") {
|
|
7317
7281
|
try {
|
|
7318
7282
|
dst = new ctor();
|
|
7319
|
-
} catch (
|
|
7320
|
-
throw new Error('CloneUtil: failed to bare-construct "' + ctor.name + '" — a type cloned deep must support ' + "argument-less construction (the gate creates preset-less instances bare, then populates fields). " + ("Cause: " +
|
|
7283
|
+
} catch (error) {
|
|
7284
|
+
throw new Error('CloneUtil: failed to bare-construct "' + ctor.name + '" — a type cloned deep must support ' + "argument-less construction (the gate creates preset-less instances bare, then populates fields). " + ("Cause: " + error), {
|
|
7285
|
+
cause: error
|
|
7286
|
+
});
|
|
7321
7287
|
}
|
|
7322
7288
|
} else {
|
|
7323
|
-
dst = Object.create(
|
|
7289
|
+
dst = Object.create(proto);
|
|
7324
7290
|
}
|
|
7325
7291
|
}
|
|
7326
7292
|
cloneMap.set(source, dst);
|
|
7327
7293
|
return dst;
|
|
7328
7294
|
};
|
|
7329
|
-
|
|
7330
|
-
* @internal
|
|
7331
|
-
*/ CloneUtil._transferSlotOwnership = function _transferSlotOwnership(cloned, source, preset) {
|
|
7332
|
-
if (cloned === preset) return;
|
|
7333
|
-
if (_instanceof(preset, ReferResource)) {
|
|
7334
|
-
var presetRefCount = preset.refCount;
|
|
7335
|
-
presetRefCount !== undefined && presetRefCount <= 0 && Logger.error("CloneUtil: the clone's preset " + preset.constructor.name + " holds no owned reference; " + "a constructor presetting a ref-counted resource must acquire it (assign via its setter or an explicit +1).");
|
|
7336
|
-
preset._addReferCount(-1);
|
|
7337
|
-
}
|
|
7338
|
-
if (cloned === source && _instanceof(cloned, ReferResource)) {
|
|
7339
|
-
cloned._addReferCount(1);
|
|
7340
|
-
}
|
|
7341
|
-
};
|
|
7342
|
-
/**
|
|
7343
|
-
* @internal
|
|
7344
|
-
*/ CloneUtil._deepCloneArrayBuffer = function _deepCloneArrayBuffer(source, preset, cloneMap) {
|
|
7295
|
+
CloneUtil._deepCloneArrayBufferView = function _deepCloneArrayBufferView(source, preset, cloneMap) {
|
|
7345
7296
|
var existing = cloneMap.get(source);
|
|
7346
7297
|
if (existing) return existing;
|
|
7347
7298
|
var dst;
|
|
@@ -7364,23 +7315,19 @@ var SafeLoopArray = /*#__PURE__*/ function() {
|
|
|
7364
7315
|
cloneMap.set(source, dst);
|
|
7365
7316
|
return dst;
|
|
7366
7317
|
};
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
*/ CloneUtil._deepCloneArray = function _deepCloneArray(source, preset, cloneMap, forceDeepClone) {
|
|
7370
|
-
if (forceDeepClone === void 0) forceDeepClone = false;
|
|
7318
|
+
CloneUtil._cloneArray = function _cloneArray(source, preset, cloneMap, deepCloneSubtree) {
|
|
7319
|
+
if (deepCloneSubtree === void 0) deepCloneSubtree = false;
|
|
7371
7320
|
var existing = cloneMap.get(source);
|
|
7372
7321
|
if (existing) return existing;
|
|
7373
7322
|
var dst = preset !== source && Array.isArray(preset) && preset.constructor === source.constructor && preset.length === source.length ? preset : new Array(source.length);
|
|
7374
7323
|
cloneMap.set(source, dst);
|
|
7375
7324
|
for(var i = 0, n = source.length; i < n; i++){
|
|
7376
|
-
dst[i] = CloneUtil.
|
|
7325
|
+
dst[i] = CloneUtil._cloneValueByDefault(source[i], undefined, cloneMap, deepCloneSubtree);
|
|
7377
7326
|
}
|
|
7378
7327
|
return dst;
|
|
7379
7328
|
};
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
*/ CloneUtil._deepCloneMap = function _deepCloneMap(source, preset, cloneMap, forceDeepClone) {
|
|
7383
|
-
if (forceDeepClone === void 0) forceDeepClone = false;
|
|
7329
|
+
CloneUtil._cloneMap = function _cloneMap(source, preset, cloneMap, deepCloneSubtree) {
|
|
7330
|
+
if (deepCloneSubtree === void 0) deepCloneSubtree = false;
|
|
7384
7331
|
var existing = cloneMap.get(source);
|
|
7385
7332
|
if (existing) return existing;
|
|
7386
7333
|
var dst;
|
|
@@ -7393,14 +7340,12 @@ var SafeLoopArray = /*#__PURE__*/ function() {
|
|
|
7393
7340
|
cloneMap.set(source, dst);
|
|
7394
7341
|
for(var _iterator = _create_for_of_iterator_helper_loose(source), _step; !(_step = _iterator()).done;){
|
|
7395
7342
|
var entry = _step.value;
|
|
7396
|
-
dst.set(CloneUtil.
|
|
7343
|
+
dst.set(CloneUtil._cloneValueByDefault(entry[0], undefined, cloneMap, deepCloneSubtree), CloneUtil._cloneValueByDefault(entry[1], undefined, cloneMap, deepCloneSubtree));
|
|
7397
7344
|
}
|
|
7398
7345
|
return dst;
|
|
7399
7346
|
};
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
*/ CloneUtil._deepCloneSet = function _deepCloneSet(source, preset, cloneMap, forceDeepClone) {
|
|
7403
|
-
if (forceDeepClone === void 0) forceDeepClone = false;
|
|
7347
|
+
CloneUtil._cloneSet = function _cloneSet(source, preset, cloneMap, deepCloneSubtree) {
|
|
7348
|
+
if (deepCloneSubtree === void 0) deepCloneSubtree = false;
|
|
7404
7349
|
var existing = cloneMap.get(source);
|
|
7405
7350
|
if (existing) return existing;
|
|
7406
7351
|
var dst;
|
|
@@ -7413,12 +7358,45 @@ var SafeLoopArray = /*#__PURE__*/ function() {
|
|
|
7413
7358
|
cloneMap.set(source, dst);
|
|
7414
7359
|
for(var _iterator = _create_for_of_iterator_helper_loose(source), _step; !(_step = _iterator()).done;){
|
|
7415
7360
|
var v = _step.value;
|
|
7416
|
-
dst.add(CloneUtil.
|
|
7361
|
+
dst.add(CloneUtil._cloneValueByDefault(v, undefined, cloneMap, deepCloneSubtree));
|
|
7417
7362
|
}
|
|
7418
7363
|
return dst;
|
|
7419
7364
|
};
|
|
7365
|
+
CloneUtil._isPlainObject = function _isPlainObject(value) {
|
|
7366
|
+
var proto = Object.getPrototypeOf(value);
|
|
7367
|
+
if (proto === null || proto === Object.prototype) return true;
|
|
7368
|
+
var ctor = Object.getPrototypeOf(proto) === null && proto.constructor;
|
|
7369
|
+
return typeof ctor === "function" && ctor.name === "Object";
|
|
7370
|
+
};
|
|
7371
|
+
CloneUtil._hasOrdinaryObjectTag = function _hasOrdinaryObjectTag(value) {
|
|
7372
|
+
return Object.prototype.toString.call(value) === "[object Object]";
|
|
7373
|
+
};
|
|
7374
|
+
CloneUtil._getTypeName = function _getTypeName(value) {
|
|
7375
|
+
var _Object_getPrototypeOf_constructor, _Object_getPrototypeOf;
|
|
7376
|
+
var _Object_getPrototypeOf_constructor_name;
|
|
7377
|
+
return (_Object_getPrototypeOf_constructor_name = (_Object_getPrototypeOf = Object.getPrototypeOf(value)) == null ? void 0 : (_Object_getPrototypeOf_constructor = _Object_getPrototypeOf.constructor) == null ? void 0 : _Object_getPrototypeOf_constructor.name) != null ? _Object_getPrototypeOf_constructor_name : "Object";
|
|
7378
|
+
};
|
|
7420
7379
|
return CloneUtil;
|
|
7421
7380
|
}();
|
|
7381
|
+
var copyFromCloneTypes = [
|
|
7382
|
+
engineMath.BoundingBox,
|
|
7383
|
+
engineMath.BoundingFrustum,
|
|
7384
|
+
engineMath.BoundingSphere,
|
|
7385
|
+
engineMath.Color,
|
|
7386
|
+
engineMath.Matrix,
|
|
7387
|
+
engineMath.Matrix3x3,
|
|
7388
|
+
engineMath.Plane,
|
|
7389
|
+
engineMath.Quaternion,
|
|
7390
|
+
engineMath.Ray,
|
|
7391
|
+
engineMath.Rect,
|
|
7392
|
+
engineMath.SphericalHarmonics3,
|
|
7393
|
+
engineMath.Vector2,
|
|
7394
|
+
engineMath.Vector3,
|
|
7395
|
+
engineMath.Vector4
|
|
7396
|
+
];
|
|
7397
|
+
for(var i = 0, n = copyFromCloneTypes.length; i < n; i++){
|
|
7398
|
+
registerDefaultCloneMode(copyFromCloneTypes[i], CloneMode.Copy);
|
|
7399
|
+
}
|
|
7422
7400
|
|
|
7423
7401
|
/**
|
|
7424
7402
|
* Shader data collection,Correspondence includes shader properties data and macros data.
|
|
@@ -7590,12 +7568,8 @@ var SafeLoopArray = /*#__PURE__*/ function() {
|
|
|
7590
7568
|
return shaderData;
|
|
7591
7569
|
};
|
|
7592
7570
|
_proto.cloneTo = function cloneTo(target) {
|
|
7593
|
-
CloneUtil.
|
|
7594
|
-
|
|
7595
|
-
for(var key in targetMacroMap){
|
|
7596
|
-
delete targetMacroMap[key];
|
|
7597
|
-
}
|
|
7598
|
-
Object.assign(targetMacroMap, this._macroMap);
|
|
7571
|
+
CloneUtil._cloneObjectFields(this._macroCollection, target._macroCollection, new Map());
|
|
7572
|
+
Object.assign(target._macroMap, this._macroMap);
|
|
7599
7573
|
var referCount = target._getReferCount();
|
|
7600
7574
|
var propertyValueMap = this._propertyValueMap;
|
|
7601
7575
|
var targetPropertyValueMap = target._propertyValueMap;
|
|
@@ -7627,8 +7601,8 @@ var SafeLoopArray = /*#__PURE__*/ function() {
|
|
|
7627
7601
|
}
|
|
7628
7602
|
};
|
|
7629
7603
|
/**
|
|
7630
|
-
* @
|
|
7631
|
-
*/ _proto.
|
|
7604
|
+
* @inheritdoc
|
|
7605
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
7632
7606
|
this.cloneTo(target);
|
|
7633
7607
|
};
|
|
7634
7608
|
/**
|
|
@@ -7873,8 +7847,8 @@ exports.Renderer = /*#__PURE__*/ function(Component) {
|
|
|
7873
7847
|
ShaderMacroCollection.unionCollection(context.camera._globalShaderMacro, this.shaderData._macroCollection, this._globalShaderMacro);
|
|
7874
7848
|
};
|
|
7875
7849
|
/**
|
|
7876
|
-
* @
|
|
7877
|
-
*/ _proto.
|
|
7850
|
+
* @inheritdoc
|
|
7851
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
7878
7852
|
var materials = this._materials;
|
|
7879
7853
|
for(var i = 0, n = materials.length; i < n; i++){
|
|
7880
7854
|
target._setMaterial(i, materials[i]);
|
|
@@ -11135,7 +11109,7 @@ SpriteMaskUtils._u32Buffer4 = new Uint32Array(4);
|
|
|
11135
11109
|
};
|
|
11136
11110
|
/**
|
|
11137
11111
|
* @internal
|
|
11138
|
-
* Clone mask data to target. Called from subclass
|
|
11112
|
+
* Clone mask data to target. Called from subclass _onClone.
|
|
11139
11113
|
*/ _proto._cloneMaskData = function _cloneMaskData(target) {
|
|
11140
11114
|
target.sprite = this._sprite;
|
|
11141
11115
|
};
|
|
@@ -11750,9 +11724,9 @@ __decorate([
|
|
|
11750
11724
|
this._updateWorldSpaceTransformShaderData(context, onlyMVP);
|
|
11751
11725
|
};
|
|
11752
11726
|
/**
|
|
11753
|
-
* @
|
|
11754
|
-
*/ _proto.
|
|
11755
|
-
_MaskRenderable.prototype.
|
|
11727
|
+
* @inheritdoc
|
|
11728
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
11729
|
+
_MaskRenderable.prototype._onClone.call(this, target);
|
|
11756
11730
|
this._cloneMaskData(target);
|
|
11757
11731
|
};
|
|
11758
11732
|
/**
|
|
@@ -11896,9 +11870,9 @@ __decorate([
|
|
|
11896
11870
|
this._updateWorldSpaceTransformShaderData(context, onlyMVP);
|
|
11897
11871
|
};
|
|
11898
11872
|
/**
|
|
11899
|
-
* @
|
|
11900
|
-
*/ _proto.
|
|
11901
|
-
Renderer.prototype.
|
|
11873
|
+
* @inheritdoc
|
|
11874
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
11875
|
+
Renderer.prototype._onClone.call(this, target);
|
|
11902
11876
|
target.sprite = this._sprite;
|
|
11903
11877
|
target.drawMode = this._drawMode;
|
|
11904
11878
|
};
|
|
@@ -12396,7 +12370,9 @@ __decorate([
|
|
|
12396
12370
|
this._textChunks = null;
|
|
12397
12371
|
this._subFont && (this._subFont = null);
|
|
12398
12372
|
};
|
|
12399
|
-
|
|
12373
|
+
/**
|
|
12374
|
+
* @internal
|
|
12375
|
+
*/ _proto._isContainDirtyFlag = function _isContainDirtyFlag(type) {
|
|
12400
12376
|
return (this._dirtyFlag & type) != 0;
|
|
12401
12377
|
};
|
|
12402
12378
|
/**
|
|
@@ -15339,9 +15315,9 @@ var BlendShapeFrameDirty = /*#__PURE__*/ function(BlendShapeFrameDirty) {
|
|
|
15339
15315
|
Renderer.prototype._onDestroy.call(this);
|
|
15340
15316
|
};
|
|
15341
15317
|
/**
|
|
15342
|
-
* @
|
|
15343
|
-
*/ _proto.
|
|
15344
|
-
Renderer.prototype.
|
|
15318
|
+
* @inheritdoc
|
|
15319
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
15320
|
+
Renderer.prototype._onClone.call(this, target);
|
|
15345
15321
|
target.mesh = this._mesh;
|
|
15346
15322
|
};
|
|
15347
15323
|
/**
|
|
@@ -18363,9 +18339,9 @@ var SkinUpdateFlag = /*#__PURE__*/ function(SkinUpdateFlag) {
|
|
|
18363
18339
|
this._jointTexture = null;
|
|
18364
18340
|
};
|
|
18365
18341
|
/**
|
|
18366
|
-
* @
|
|
18367
|
-
*/ _proto.
|
|
18368
|
-
MeshRenderer.prototype.
|
|
18342
|
+
* @inheritdoc
|
|
18343
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
18344
|
+
MeshRenderer.prototype._onClone.call(this, target);
|
|
18369
18345
|
if (this._jointTexture) {
|
|
18370
18346
|
target.shaderData.setTexture(SkinnedMeshRenderer._jointSamplerProperty, null);
|
|
18371
18347
|
}
|
|
@@ -19416,6 +19392,87 @@ RenderContext._flipYViewProjectionMatrix = new engineMath.Matrix();
|
|
|
19416
19392
|
return AssetType;
|
|
19417
19393
|
}({});
|
|
19418
19394
|
|
|
19395
|
+
var SafeLoopArray = /*#__PURE__*/ function() {
|
|
19396
|
+
function SafeLoopArray() {
|
|
19397
|
+
this._array = [];
|
|
19398
|
+
this._loopArray = [];
|
|
19399
|
+
this._loopArrayDirty = false;
|
|
19400
|
+
}
|
|
19401
|
+
var _proto = SafeLoopArray.prototype;
|
|
19402
|
+
/**
|
|
19403
|
+
* Push item to the array.
|
|
19404
|
+
* @param item - The item which want to be pushed
|
|
19405
|
+
*/ _proto.push = function push(item) {
|
|
19406
|
+
this._array.push(item);
|
|
19407
|
+
this._loopArrayDirty = true;
|
|
19408
|
+
};
|
|
19409
|
+
/**
|
|
19410
|
+
* Add item to the array.
|
|
19411
|
+
* @param index - The index of the array
|
|
19412
|
+
* @param item - The item which want to be added
|
|
19413
|
+
*/ _proto.add = function add(index, item) {
|
|
19414
|
+
this._array.splice(index, 0, item);
|
|
19415
|
+
this._loopArrayDirty = true;
|
|
19416
|
+
};
|
|
19417
|
+
/**
|
|
19418
|
+
* Remove item from the array.
|
|
19419
|
+
* @param index - The index of the array
|
|
19420
|
+
*/ _proto.removeByIndex = function removeByIndex(index) {
|
|
19421
|
+
this._array.splice(index, 1);
|
|
19422
|
+
this._loopArrayDirty = true;
|
|
19423
|
+
};
|
|
19424
|
+
/**
|
|
19425
|
+
* Remove item from array that pass the specified comparison function.
|
|
19426
|
+
* @param filter - The comparison function
|
|
19427
|
+
*/ _proto.findAndRemove = function findAndRemove(filter) {
|
|
19428
|
+
var array = this._array;
|
|
19429
|
+
for(var i = array.length - 1; i >= 0; i--){
|
|
19430
|
+
filter(array[i]) && this.removeByIndex(i);
|
|
19431
|
+
}
|
|
19432
|
+
};
|
|
19433
|
+
/**
|
|
19434
|
+
* The index of the item.
|
|
19435
|
+
* @param item - The item which want to get the index
|
|
19436
|
+
* @returns Index of the item
|
|
19437
|
+
*/ _proto.indexOf = function indexOf(item) {
|
|
19438
|
+
return this._array.indexOf(item);
|
|
19439
|
+
};
|
|
19440
|
+
/**
|
|
19441
|
+
* Get the array.
|
|
19442
|
+
* @returns The array
|
|
19443
|
+
*/ _proto.getArray = function getArray() {
|
|
19444
|
+
return this._array;
|
|
19445
|
+
};
|
|
19446
|
+
/**
|
|
19447
|
+
* Get the array use for loop.
|
|
19448
|
+
* @returns The array use for loop
|
|
19449
|
+
*/ _proto.getLoopArray = function getLoopArray() {
|
|
19450
|
+
var loopArray = this._loopArray;
|
|
19451
|
+
if (this._loopArrayDirty) {
|
|
19452
|
+
var array = this._array;
|
|
19453
|
+
var count = array.length;
|
|
19454
|
+
loopArray.length = count;
|
|
19455
|
+
for(var i = 0; i < count; i++){
|
|
19456
|
+
loopArray[i] = array[i];
|
|
19457
|
+
}
|
|
19458
|
+
this._loopArrayDirty = false;
|
|
19459
|
+
}
|
|
19460
|
+
return loopArray;
|
|
19461
|
+
};
|
|
19462
|
+
_create_class(SafeLoopArray, [
|
|
19463
|
+
{
|
|
19464
|
+
key: "length",
|
|
19465
|
+
get: /**
|
|
19466
|
+
* Get the length of the array.
|
|
19467
|
+
*/ function get() {
|
|
19468
|
+
return this._array.length;
|
|
19469
|
+
}
|
|
19470
|
+
}
|
|
19471
|
+
]);
|
|
19472
|
+
return SafeLoopArray;
|
|
19473
|
+
}();
|
|
19474
|
+
registerDefaultCloneMode(SafeLoopArray, CloneMode.Ignore);
|
|
19475
|
+
|
|
19419
19476
|
/**
|
|
19420
19477
|
* Scene manager.
|
|
19421
19478
|
*/ var SceneManager = /*#__PURE__*/ function() {
|
|
@@ -19748,7 +19805,7 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
19748
19805
|
this._graphicResourcePool = Object.create(null);
|
|
19749
19806
|
this._contentRestorerPool = Object.create(null);
|
|
19750
19807
|
this._subAssetPromiseCallbacks = {};
|
|
19751
|
-
this
|
|
19808
|
+
this.// Virtual resource mapping
|
|
19752
19809
|
/** @internal */ _objectPool = Object.create(null);
|
|
19753
19810
|
this./** @internal */ _virtualPathResourceMap = Object.create(null);
|
|
19754
19811
|
}
|
|
@@ -19862,21 +19919,6 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
19862
19919
|
};
|
|
19863
19920
|
/**
|
|
19864
19921
|
* @internal
|
|
19865
|
-
*/ _proto._onSubAssetFail = function _onSubAssetFail(assetBaseURL, assetSubPath, value) {
|
|
19866
|
-
var _this__subAssetPromiseCallbacks_assetBaseURL;
|
|
19867
|
-
var subPromiseCallback = (_this__subAssetPromiseCallbacks_assetBaseURL = this._subAssetPromiseCallbacks[assetBaseURL]) == null ? void 0 : _this__subAssetPromiseCallbacks_assetBaseURL[assetSubPath];
|
|
19868
|
-
if (subPromiseCallback) {
|
|
19869
|
-
subPromiseCallback.reject(value);
|
|
19870
|
-
} else {
|
|
19871
|
-
var // Pending
|
|
19872
|
-
_this__subAssetPromiseCallbacks, _assetBaseURL;
|
|
19873
|
-
((_this__subAssetPromiseCallbacks = this._subAssetPromiseCallbacks)[_assetBaseURL = assetBaseURL] || (_this__subAssetPromiseCallbacks[_assetBaseURL] = {}))[assetSubPath] = {
|
|
19874
|
-
rejectedValue: value
|
|
19875
|
-
};
|
|
19876
|
-
}
|
|
19877
|
-
};
|
|
19878
|
-
/**
|
|
19879
|
-
* @internal
|
|
19880
19922
|
*/ _proto._addAsset = function _addAsset(path, asset) {
|
|
19881
19923
|
this._assetPool[asset.instanceId] = path;
|
|
19882
19924
|
this._assetUrlPool[path] = asset;
|
|
@@ -19985,10 +20027,13 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
19985
20027
|
// Get remote asset base url
|
|
19986
20028
|
var virtualResourceEntry = this._virtualPathResourceMap[assetBaseURL];
|
|
19987
20029
|
this._resolveLoadItemOptions(item, virtualResourceEntry);
|
|
19988
|
-
//
|
|
19989
|
-
|
|
20030
|
+
// Keep a virtual resource's logical identity so loaders can resolve its
|
|
20031
|
+
// sibling resources through the virtual-resource map. `baseUrl` only
|
|
20032
|
+
// resolves ordinary relative transport URLs
|
|
20033
|
+
var loadItemUrl = virtualResourceEntry !== undefined || Utils.isAbsoluteUrl(assetBaseURL) || !this.baseUrl ? assetBaseURL : Utils.resolveAbsoluteUrl(this.baseUrl, assetBaseURL);
|
|
20034
|
+
item.url = loadItemUrl;
|
|
19990
20035
|
var _virtualResourceEntry_path;
|
|
19991
|
-
var remoteAssetBaseURL = (_virtualResourceEntry_path = virtualResourceEntry == null ? void 0 : virtualResourceEntry.path) != null ? _virtualResourceEntry_path :
|
|
20036
|
+
var remoteAssetBaseURL = (_virtualResourceEntry_path = virtualResourceEntry == null ? void 0 : virtualResourceEntry.path) != null ? _virtualResourceEntry_path : loadItemUrl;
|
|
19992
20037
|
// Check cache
|
|
19993
20038
|
var cacheObject = this._assetUrlPool[remoteAssetBaseURL];
|
|
19994
20039
|
if (cacheObject) {
|
|
@@ -20027,10 +20072,7 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
20027
20072
|
if (queryPath) {
|
|
20028
20073
|
// Check whether load main asset
|
|
20029
20074
|
var mainPromise = loadingPromises[remoteAssetBaseURL] || this._loadSubpackageAndMainAsset(loader, item, remoteAssetBaseURL, subpackageName);
|
|
20030
|
-
|
|
20031
|
-
_this._onSubAssetFail(remoteAssetBaseURL, queryPath, e);
|
|
20032
|
-
});
|
|
20033
|
-
return this._createSubAssetPromiseCallback(remoteAssetBaseURL, remoteAssetURL, queryPath);
|
|
20075
|
+
return this._createSubAssetPromiseCallback(remoteAssetBaseURL, remoteAssetURL, queryPath, mainPromise);
|
|
20034
20076
|
}
|
|
20035
20077
|
return this._loadSubpackageAndMainAsset(loader, item, remoteAssetBaseURL, subpackageName);
|
|
20036
20078
|
};
|
|
@@ -20055,30 +20097,33 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
20055
20097
|
});
|
|
20056
20098
|
return promise;
|
|
20057
20099
|
};
|
|
20058
|
-
_proto._createSubAssetPromiseCallback = function _createSubAssetPromiseCallback(remoteAssetBaseURL, remoteAssetURL, assetSubPath) {
|
|
20100
|
+
_proto._createSubAssetPromiseCallback = function _createSubAssetPromiseCallback(remoteAssetBaseURL, remoteAssetURL, assetSubPath, mainPromise) {
|
|
20059
20101
|
var _this = this;
|
|
20060
20102
|
var _this__subAssetPromiseCallbacks_remoteAssetBaseURL;
|
|
20061
20103
|
var loadingPromises = this._loadingPromises;
|
|
20062
20104
|
var subPromiseCallback = (_this__subAssetPromiseCallbacks_remoteAssetBaseURL = this._subAssetPromiseCallbacks[remoteAssetBaseURL]) == null ? void 0 : _this__subAssetPromiseCallbacks_remoteAssetBaseURL[assetSubPath];
|
|
20063
20105
|
var resolvedValue = subPromiseCallback == null ? void 0 : subPromiseCallback.resolvedValue;
|
|
20064
|
-
|
|
20065
|
-
|
|
20066
|
-
|
|
20067
|
-
return new AssetPromise(function(resolve, reject) {
|
|
20068
|
-
if (resolvedValue) {
|
|
20069
|
-
resolve(resolvedValue);
|
|
20070
|
-
} else if (rejectedValue) {
|
|
20071
|
-
reject(rejectedValue);
|
|
20072
|
-
}
|
|
20073
|
-
});
|
|
20106
|
+
// Already resolved
|
|
20107
|
+
if (resolvedValue) {
|
|
20108
|
+
return AssetPromise.resolve(resolvedValue);
|
|
20074
20109
|
}
|
|
20075
20110
|
// Pending
|
|
20076
|
-
var promise = new AssetPromise(function(resolve, reject) {
|
|
20111
|
+
var promise = new AssetPromise(function(resolve, reject, setTaskCompleteProgress, setTaskDetailProgress) {
|
|
20077
20112
|
var _this__subAssetPromiseCallbacks, _remoteAssetBaseURL;
|
|
20078
20113
|
((_this__subAssetPromiseCallbacks = _this._subAssetPromiseCallbacks)[_remoteAssetBaseURL = remoteAssetBaseURL] || (_this__subAssetPromiseCallbacks[_remoteAssetBaseURL] = {}))[assetSubPath] = {
|
|
20079
20114
|
resolve: resolve,
|
|
20080
20115
|
reject: reject
|
|
20081
20116
|
};
|
|
20117
|
+
// A loader may finish the main asset before its eager sub-asset notification reaches this callback.
|
|
20118
|
+
// Always resolve from the completed main asset as the authoritative fallback so callback cleanup cannot
|
|
20119
|
+
// strand a sub-asset request.
|
|
20120
|
+
mainPromise.onProgress(setTaskCompleteProgress, setTaskDetailProgress).then(function(resource) {
|
|
20121
|
+
try {
|
|
20122
|
+
resolve(_this._getResolveResource(resource, _this._parseQueryPath(assetSubPath)));
|
|
20123
|
+
} catch (error) {
|
|
20124
|
+
reject(error);
|
|
20125
|
+
}
|
|
20126
|
+
}, reject);
|
|
20082
20127
|
});
|
|
20083
20128
|
loadingPromises[remoteAssetURL] = promise;
|
|
20084
20129
|
promise.then(function() {
|
|
@@ -20102,7 +20147,10 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
20102
20147
|
if (paths) {
|
|
20103
20148
|
for(var i = 0, n = paths.length; i < n; i++){
|
|
20104
20149
|
var path = paths[i];
|
|
20105
|
-
subResource = subResource[path];
|
|
20150
|
+
subResource = subResource == null ? void 0 : subResource[path];
|
|
20151
|
+
if (subResource === undefined) {
|
|
20152
|
+
throw new Error("Sub-asset path does not exist: " + paths.join("."));
|
|
20153
|
+
}
|
|
20106
20154
|
}
|
|
20107
20155
|
}
|
|
20108
20156
|
return subResource;
|
|
@@ -20148,6 +20196,16 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
20148
20196
|
delete this._subAssetPromiseCallbacks[assetBaseURL];
|
|
20149
20197
|
};
|
|
20150
20198
|
/**
|
|
20199
|
+
* Register virtual asset paths and their load descriptors.
|
|
20200
|
+
* @remarks References inside runtime scenes and Prefabs can keep stable virtual paths while the backing URLs
|
|
20201
|
+
* are generated dynamically, such as object URLs created from a resource package.
|
|
20202
|
+
*/ _proto.registerVirtualResources = function registerVirtualResources(resources) {
|
|
20203
|
+
var _this = this;
|
|
20204
|
+
resources.forEach(function(resource) {
|
|
20205
|
+
_this._virtualPathResourceMap[resource.virtualPath] = resource;
|
|
20206
|
+
});
|
|
20207
|
+
};
|
|
20208
|
+
/**
|
|
20151
20209
|
* @internal
|
|
20152
20210
|
* @beta Just for internal editor, not recommended for developers.
|
|
20153
20211
|
*/ _proto.getResourceByRef = function getResourceByRef(ref) {
|
|
@@ -20176,18 +20234,6 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
20176
20234
|
};
|
|
20177
20235
|
/**
|
|
20178
20236
|
* @internal
|
|
20179
|
-
* @beta Just for internal editor, not recommended for developers.
|
|
20180
|
-
*/ _proto.initVirtualResources = function initVirtualResources(config) {
|
|
20181
|
-
var _this = this;
|
|
20182
|
-
config.forEach(function(element) {
|
|
20183
|
-
_this._virtualPathResourceMap[element.virtualPath] = element;
|
|
20184
|
-
if (element.dependentAssetMap) {
|
|
20185
|
-
_this._virtualPathResourceMap[element.virtualPath].dependentAssetMap = element.dependentAssetMap;
|
|
20186
|
-
}
|
|
20187
|
-
});
|
|
20188
|
-
};
|
|
20189
|
-
/**
|
|
20190
|
-
* @internal
|
|
20191
20237
|
*/ ResourceManager._addLoader = function _addLoader(type, loader, extNames) {
|
|
20192
20238
|
this._loaders[type] = loader;
|
|
20193
20239
|
for(var i = 0, len = extNames.length; i < len; i++){
|
|
@@ -20762,8 +20808,8 @@ exports.Collider = /*#__PURE__*/ function(Component) {
|
|
|
20762
20808
|
if (oldCollider) {
|
|
20763
20809
|
oldCollider.removeShape(shape);
|
|
20764
20810
|
}
|
|
20765
|
-
this._shapes.push(shape);
|
|
20766
20811
|
this._addNativeShape(shape);
|
|
20812
|
+
this._shapes.push(shape);
|
|
20767
20813
|
this._handleShapesChanged(ColliderShapeChangeFlag.Count);
|
|
20768
20814
|
}
|
|
20769
20815
|
};
|
|
@@ -20826,8 +20872,8 @@ exports.Collider = /*#__PURE__*/ function(Component) {
|
|
|
20826
20872
|
this.scene.physics._removeCollider(this);
|
|
20827
20873
|
};
|
|
20828
20874
|
/**
|
|
20829
|
-
* @
|
|
20830
|
-
*/ _proto.
|
|
20875
|
+
* @inheritdoc
|
|
20876
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
20831
20877
|
target._syncNative();
|
|
20832
20878
|
target._pendingReenterTeleport = true;
|
|
20833
20879
|
};
|
|
@@ -20838,6 +20884,20 @@ exports.Collider = /*#__PURE__*/ function(Component) {
|
|
|
20838
20884
|
this._setCollisionLayer();
|
|
20839
20885
|
}
|
|
20840
20886
|
};
|
|
20887
|
+
/**
|
|
20888
|
+
* @internal
|
|
20889
|
+
*/ _proto._setNativeShapeAttached = function _setNativeShapeAttached(shape, attached) {
|
|
20890
|
+
var nativeShape = shape._nativeShape;
|
|
20891
|
+
if (nativeShape && shape._isShapeAttached !== attached) {
|
|
20892
|
+
if (attached) {
|
|
20893
|
+
nativeShape.setWorldScale(this.entity.transform.lossyWorldScale);
|
|
20894
|
+
this._nativeCollider.addShape(nativeShape);
|
|
20895
|
+
} else {
|
|
20896
|
+
this._nativeCollider.removeShape(nativeShape);
|
|
20897
|
+
}
|
|
20898
|
+
shape._isShapeAttached = attached;
|
|
20899
|
+
}
|
|
20900
|
+
};
|
|
20841
20901
|
_proto._syncNative = function _syncNative() {
|
|
20842
20902
|
for(var i = 0, n = this.shapes.length; i < n; i++){
|
|
20843
20903
|
this._addNativeShape(this.shapes[i]);
|
|
@@ -20880,24 +20940,13 @@ exports.Collider = /*#__PURE__*/ function(Component) {
|
|
|
20880
20940
|
this._nativeCollider.destroy();
|
|
20881
20941
|
};
|
|
20882
20942
|
_proto._addNativeShape = function _addNativeShape(shape) {
|
|
20943
|
+
this._setNativeShapeAttached(shape, true);
|
|
20883
20944
|
shape._collider = this;
|
|
20884
|
-
this._attachNativeShape(shape);
|
|
20885
20945
|
};
|
|
20886
20946
|
_proto._removeNativeShape = function _removeNativeShape(shape) {
|
|
20887
|
-
this.
|
|
20947
|
+
this._setNativeShapeAttached(shape, false);
|
|
20888
20948
|
shape._collider = null;
|
|
20889
20949
|
};
|
|
20890
|
-
/** @internal */ _proto._attachNativeShape = function _attachNativeShape(shape) {
|
|
20891
|
-
if (shape._nativeShape && !shape._isShapeAttached) {
|
|
20892
|
-
shape._nativeShape.setWorldScale(this.entity.transform.lossyWorldScale);
|
|
20893
|
-
shape._attachToCollider();
|
|
20894
|
-
}
|
|
20895
|
-
};
|
|
20896
|
-
/** @internal */ _proto._detachNativeShape = function _detachNativeShape(shape) {
|
|
20897
|
-
if (shape._nativeShape && shape._isShapeAttached) {
|
|
20898
|
-
shape._detachFromCollider();
|
|
20899
|
-
}
|
|
20900
|
-
};
|
|
20901
20950
|
_proto._setCollisionLayer = function _setCollisionLayer() {
|
|
20902
20951
|
this._nativeCollider.setCollisionLayer(this._collisionLayerIndex);
|
|
20903
20952
|
};
|
|
@@ -21143,7 +21192,7 @@ __decorate([
|
|
|
21143
21192
|
};
|
|
21144
21193
|
/**
|
|
21145
21194
|
* @internal
|
|
21146
|
-
*/ _proto.
|
|
21195
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
21147
21196
|
target._syncNative();
|
|
21148
21197
|
};
|
|
21149
21198
|
/**
|
|
@@ -21278,8 +21327,8 @@ __decorate([
|
|
|
21278
21327
|
return Math.sqrt(distance);
|
|
21279
21328
|
};
|
|
21280
21329
|
/**
|
|
21281
|
-
* @
|
|
21282
|
-
*/ _proto.
|
|
21330
|
+
* @inheritdoc
|
|
21331
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
21283
21332
|
target._syncNative();
|
|
21284
21333
|
};
|
|
21285
21334
|
/**
|
|
@@ -21291,18 +21340,6 @@ __decorate([
|
|
|
21291
21340
|
}
|
|
21292
21341
|
delete Engine._physicalObjectsMap[this._id];
|
|
21293
21342
|
};
|
|
21294
|
-
/**
|
|
21295
|
-
* @internal
|
|
21296
|
-
*/ _proto._attachToCollider = function _attachToCollider() {
|
|
21297
|
-
this._collider._nativeCollider.addShape(this._nativeShape);
|
|
21298
|
-
this._isShapeAttached = true;
|
|
21299
|
-
};
|
|
21300
|
-
/**
|
|
21301
|
-
* @internal
|
|
21302
|
-
*/ _proto._detachFromCollider = function _detachFromCollider() {
|
|
21303
|
-
this._collider._nativeCollider.removeShape(this._nativeShape);
|
|
21304
|
-
this._isShapeAttached = false;
|
|
21305
|
-
};
|
|
21306
21343
|
_proto._syncNative = function _syncNative() {
|
|
21307
21344
|
var _this__collider;
|
|
21308
21345
|
if (!this._nativeShape) return;
|
|
@@ -21424,6 +21461,9 @@ __decorate([
|
|
|
21424
21461
|
return ColliderShape;
|
|
21425
21462
|
}(DataObject);
|
|
21426
21463
|
ColliderShape._idGenerator = 0;
|
|
21464
|
+
__decorate([
|
|
21465
|
+
ignoreClone
|
|
21466
|
+
], ColliderShape.prototype, "_collider", void 0);
|
|
21427
21467
|
__decorate([
|
|
21428
21468
|
ignoreClone
|
|
21429
21469
|
], ColliderShape.prototype, "_isShapeAttached", void 0);
|
|
@@ -21460,10 +21500,10 @@ __decorate([
|
|
|
21460
21500
|
return ColliderShape.prototype.getClosestPoint.call(this, point, outClosestPoint);
|
|
21461
21501
|
};
|
|
21462
21502
|
/**
|
|
21463
|
-
* @
|
|
21464
|
-
*/ _proto.
|
|
21503
|
+
* @inheritdoc
|
|
21504
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
21465
21505
|
target.mesh = this._mesh;
|
|
21466
|
-
ColliderShape.prototype.
|
|
21506
|
+
ColliderShape.prototype._onClone.call(this, target);
|
|
21467
21507
|
};
|
|
21468
21508
|
/**
|
|
21469
21509
|
* @internal
|
|
@@ -21482,7 +21522,7 @@ __decorate([
|
|
|
21482
21522
|
_proto._destroyNativeShape = function _destroyNativeShape() {
|
|
21483
21523
|
if (this._nativeShape) {
|
|
21484
21524
|
var _this__collider;
|
|
21485
|
-
(_this__collider = this._collider) == null ? void 0 : _this__collider.
|
|
21525
|
+
(_this__collider = this._collider) == null ? void 0 : _this__collider._setNativeShapeAttached(this, false);
|
|
21486
21526
|
this._nativeShape.destroy();
|
|
21487
21527
|
this._nativeShape = null;
|
|
21488
21528
|
}
|
|
@@ -21510,17 +21550,17 @@ __decorate([
|
|
|
21510
21550
|
return true;
|
|
21511
21551
|
};
|
|
21512
21552
|
_proto._updateNativeShapeData = function _updateNativeShapeData() {
|
|
21513
|
-
|
|
21553
|
+
var succeeded = this._nativeShape.setMeshData(this._positions, this._indices, this._isConvex, this._cookingFlags);
|
|
21554
|
+
if (succeeded) {
|
|
21514
21555
|
var _this__collider;
|
|
21515
|
-
(_this__collider = this._collider) == null ? void 0 : _this__collider.
|
|
21516
|
-
return true;
|
|
21556
|
+
(_this__collider = this._collider) == null ? void 0 : _this__collider._setNativeShapeAttached(this, true);
|
|
21517
21557
|
}
|
|
21518
|
-
return
|
|
21558
|
+
return succeeded;
|
|
21519
21559
|
};
|
|
21520
|
-
_proto._createNativeShape = function _createNativeShape(
|
|
21521
|
-
|
|
21560
|
+
_proto._createNativeShape = function _createNativeShape() {
|
|
21561
|
+
var _this__collider;
|
|
21522
21562
|
// Non-convex MeshColliderShape is only supported on StaticCollider or kinematic DynamicCollider
|
|
21523
|
-
if (
|
|
21563
|
+
if (!this._isConvex && _instanceof(this._collider, DynamicCollider) && !this._collider.isKinematic) {
|
|
21524
21564
|
console.error("MeshColliderShape: Non-convex mesh is not supported on non-kinematic DynamicCollider.");
|
|
21525
21565
|
return false;
|
|
21526
21566
|
}
|
|
@@ -21531,10 +21571,7 @@ __decorate([
|
|
|
21531
21571
|
this._nativeShape = nativeShape;
|
|
21532
21572
|
// Sync base class properties (position, rotation, contactOffset, isTrigger, material)
|
|
21533
21573
|
ColliderShape.prototype._syncNative.call(this);
|
|
21534
|
-
|
|
21535
|
-
if (attachToCollider && this._collider) {
|
|
21536
|
-
this._collider._attachNativeShape(this);
|
|
21537
|
-
}
|
|
21574
|
+
(_this__collider = this._collider) == null ? void 0 : _this__collider._setNativeShapeAttached(this, true);
|
|
21538
21575
|
return true;
|
|
21539
21576
|
};
|
|
21540
21577
|
_create_class(MeshColliderShape, [
|
|
@@ -21765,8 +21802,8 @@ __decorate([
|
|
|
21765
21802
|
this._updateFlag.flag = false;
|
|
21766
21803
|
};
|
|
21767
21804
|
/**
|
|
21768
|
-
* @
|
|
21769
|
-
*/ _proto.
|
|
21805
|
+
* @inheritdoc
|
|
21806
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
21770
21807
|
target._linearVelocity.copyFrom(this.linearVelocity);
|
|
21771
21808
|
target._angularVelocity.copyFrom(this.angularVelocity);
|
|
21772
21809
|
if (!this._automaticCenterOfMass) {
|
|
@@ -21775,8 +21812,7 @@ __decorate([
|
|
|
21775
21812
|
if (!this._automaticInertiaTensor) {
|
|
21776
21813
|
target._inertiaTensor.copyFrom(this.inertiaTensor);
|
|
21777
21814
|
}
|
|
21778
|
-
|
|
21779
|
-
Collider.prototype._cloneTo.call(this, target);
|
|
21815
|
+
Collider.prototype._onClone.call(this, target);
|
|
21780
21816
|
};
|
|
21781
21817
|
/**
|
|
21782
21818
|
* @internal
|
|
@@ -21787,6 +21823,8 @@ __decorate([
|
|
|
21787
21823
|
}
|
|
21788
21824
|
};
|
|
21789
21825
|
_proto._syncNative = function _syncNative() {
|
|
21826
|
+
// Non-convex triangle meshes require a kinematic native actor before attachment
|
|
21827
|
+
this._nativeCollider.setIsKinematic(this._isKinematic);
|
|
21790
21828
|
Collider.prototype._syncNative.call(this);
|
|
21791
21829
|
this._nativeCollider.setLinearDamping(this._linearDamping);
|
|
21792
21830
|
this._nativeCollider.setAngularDamping(this._angularDamping);
|
|
@@ -21806,7 +21844,6 @@ __decorate([
|
|
|
21806
21844
|
}
|
|
21807
21845
|
this._nativeCollider.setSolverIterations(this._solverIterations);
|
|
21808
21846
|
this._nativeCollider.setUseGravity(this._useGravity);
|
|
21809
|
-
this._nativeCollider.setIsKinematic(this._isKinematic);
|
|
21810
21847
|
this._nativeCollider.setConstraints(this._constraints);
|
|
21811
21848
|
this._nativeCollider.setCollisionDetectionMode(this._collisionDetectionMode);
|
|
21812
21849
|
};
|
|
@@ -31003,7 +31040,7 @@ Scene._prefilterdDFGProperty = ShaderProperty.getByName("scene_PrefilteredDFG");
|
|
|
31003
31040
|
_inherits(Signal, DataObject);
|
|
31004
31041
|
function Signal() {
|
|
31005
31042
|
var _this;
|
|
31006
|
-
_this = DataObject.apply(this, arguments) || this, // Rebuilt by `
|
|
31043
|
+
_this = DataObject.apply(this, arguments) || this, // Rebuilt by `_onClone`; must survive even a propagated @deepClone.
|
|
31007
31044
|
_this._listeners = new SafeLoopArray();
|
|
31008
31045
|
return _this;
|
|
31009
31046
|
}
|
|
@@ -31096,8 +31133,8 @@ Scene._prefilterdDFGProperty = ShaderProperty.getByName("scene_PrefilteredDFG");
|
|
|
31096
31133
|
for(var i = 0, n = listeners.length; i < n; i++)_this = this, _loop(i);
|
|
31097
31134
|
};
|
|
31098
31135
|
/**
|
|
31099
|
-
* @
|
|
31100
|
-
*/ _proto.
|
|
31136
|
+
* @inheritdoc
|
|
31137
|
+
*/ _proto._onClone = function _onClone(target, cloneMap) {
|
|
31101
31138
|
var listeners = this._listeners.getLoopArray();
|
|
31102
31139
|
for(var i = 0, n = listeners.length; i < n; i++){
|
|
31103
31140
|
var listener = listeners[i];
|
|
@@ -33404,8 +33441,8 @@ var AnimatorLayerBlendingMode = /*#__PURE__*/ function(AnimatorLayerBlendingMode
|
|
|
33404
33441
|
}
|
|
33405
33442
|
};
|
|
33406
33443
|
/**
|
|
33407
|
-
* @
|
|
33408
|
-
*/ _proto.
|
|
33444
|
+
* @inheritdoc
|
|
33445
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
33409
33446
|
var animatorController = target._animatorController;
|
|
33410
33447
|
if (animatorController) {
|
|
33411
33448
|
target._controllerUpdateFlag = animatorController._registerChangeFlag();
|
|
@@ -35474,9 +35511,9 @@ var ParticleStopMode = /*#__PURE__*/ function(ParticleStopMode) {
|
|
|
35474
35511
|
this.generator._destroy();
|
|
35475
35512
|
};
|
|
35476
35513
|
/**
|
|
35477
|
-
* @
|
|
35478
|
-
*/ _proto.
|
|
35479
|
-
Renderer.prototype.
|
|
35514
|
+
* @inheritdoc
|
|
35515
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
35516
|
+
Renderer.prototype._onClone.call(this, target);
|
|
35480
35517
|
target.mesh = this._mesh;
|
|
35481
35518
|
target.renderMode = this._renderMode;
|
|
35482
35519
|
};
|
|
@@ -36897,6 +36934,11 @@ CustomDataModule._zeroVector4 = new engineMath.Vector4(0, 0, 0, 0);
|
|
|
36897
36934
|
};
|
|
36898
36935
|
/**
|
|
36899
36936
|
* @internal
|
|
36937
|
+
*/ _proto._isRandomCurveMode = function _isRandomCurveMode() {
|
|
36938
|
+
return this._mode === ParticleCurveMode.TwoCurves;
|
|
36939
|
+
};
|
|
36940
|
+
/**
|
|
36941
|
+
* @internal
|
|
36900
36942
|
*/ _proto._registerOnValueChanged = function _registerOnValueChanged(listener) {
|
|
36901
36943
|
this._updateManager.addListener(listener);
|
|
36902
36944
|
};
|
|
@@ -37951,8 +37993,8 @@ var MainModule = /*#__PURE__*/ function(DataObject) {
|
|
|
37951
37993
|
shaderData.setInt(MainModule._scaleMode, this.scalingMode);
|
|
37952
37994
|
};
|
|
37953
37995
|
/**
|
|
37954
|
-
* @
|
|
37955
|
-
*/ _proto.
|
|
37996
|
+
* @inheritdoc
|
|
37997
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
37956
37998
|
if (target._simulationSpace === ParticleSimulationSpace.World) {
|
|
37957
37999
|
target._generator._generateTransformedBounds();
|
|
37958
38000
|
}
|
|
@@ -38459,7 +38501,7 @@ __decorate([
|
|
|
38459
38501
|
_inherits(SizeOverLifetimeModule, ParticleGeneratorModule);
|
|
38460
38502
|
function SizeOverLifetimeModule(generator) {
|
|
38461
38503
|
var _this;
|
|
38462
|
-
_this = ParticleGeneratorModule.call(this, generator) || this, _this._separateAxes = false;
|
|
38504
|
+
_this = ParticleGeneratorModule.call(this, generator) || this, /** @internal */ _this._sizeRand = new engineMath.Rand(0, ParticleRandomSubSeeds.SizeOverLifetime), _this._separateAxes = false;
|
|
38463
38505
|
_this.sizeX = new ParticleCompositeCurve(new ParticleCurve(new CurveKey(0, 0), new CurveKey(1, 1)));
|
|
38464
38506
|
_this.sizeY = new ParticleCompositeCurve(new ParticleCurve(new CurveKey(0, 0), new CurveKey(1, 1)));
|
|
38465
38507
|
_this.sizeZ = new ParticleCompositeCurve(new ParticleCurve(new CurveKey(0, 0), new CurveKey(1, 1)));
|
|
@@ -38477,8 +38519,8 @@ __decorate([
|
|
|
38477
38519
|
var sizeY = this.sizeY;
|
|
38478
38520
|
var sizeZ = this.sizeZ;
|
|
38479
38521
|
var separateAxes = this.separateAxes;
|
|
38480
|
-
var isRandomCurveMode =
|
|
38481
|
-
var isCurveMode = isRandomCurveMode || separateAxes ? sizeX.mode === ParticleCurveMode.Curve && sizeY.mode === ParticleCurveMode.Curve && sizeZ.mode === ParticleCurveMode.Curve : sizeX.mode === ParticleCurveMode.Curve;
|
|
38522
|
+
var isRandomCurveMode = this._isRandomCurveMode();
|
|
38523
|
+
var isCurveMode = isRandomCurveMode || (separateAxes ? sizeX.mode === ParticleCurveMode.Curve && sizeY.mode === ParticleCurveMode.Curve && sizeZ.mode === ParticleCurveMode.Curve : sizeX.mode === ParticleCurveMode.Curve);
|
|
38482
38524
|
if (isCurveMode) {
|
|
38483
38525
|
shaderData.setFloatArray(SizeOverLifetimeModule._maxCurveXProperty, sizeX.curveMax._getTypeArray());
|
|
38484
38526
|
if (separateAxes) {
|
|
@@ -38503,6 +38545,17 @@ __decorate([
|
|
|
38503
38545
|
this._isCurveMacro = this._enableMacro(shaderData, this._isCurveMacro, isCurveMacro);
|
|
38504
38546
|
this._isRandomTwoMacro = this._enableMacro(shaderData, this._isRandomTwoMacro, isRandomTwoMacro);
|
|
38505
38547
|
};
|
|
38548
|
+
/**
|
|
38549
|
+
* @internal
|
|
38550
|
+
*/ _proto._isRandomCurveMode = function _isRandomCurveMode() {
|
|
38551
|
+
var _this = this, sizeX = _this.sizeX, sizeY = _this.sizeY, sizeZ = _this.sizeZ, separateAxes = _this.separateAxes;
|
|
38552
|
+
return separateAxes ? sizeX._isRandomCurveMode() && sizeY._isRandomCurveMode() && sizeZ._isRandomCurveMode() : sizeX._isRandomCurveMode();
|
|
38553
|
+
};
|
|
38554
|
+
/**
|
|
38555
|
+
* @internal
|
|
38556
|
+
*/ _proto._resetRandomSeed = function _resetRandomSeed(seed) {
|
|
38557
|
+
this._sizeRand.reset(seed, ParticleRandomSubSeeds.SizeOverLifetime);
|
|
38558
|
+
};
|
|
38506
38559
|
_create_class(SizeOverLifetimeModule, [
|
|
38507
38560
|
{
|
|
38508
38561
|
key: "separateAxes",
|
|
@@ -38586,6 +38639,9 @@ SizeOverLifetimeModule._minCurveZProperty = ShaderProperty.getByName("renderer_S
|
|
|
38586
38639
|
SizeOverLifetimeModule._maxCurveXProperty = ShaderProperty.getByName("renderer_SOLMaxCurveX");
|
|
38587
38640
|
SizeOverLifetimeModule._maxCurveYProperty = ShaderProperty.getByName("renderer_SOLMaxCurveY");
|
|
38588
38641
|
SizeOverLifetimeModule._maxCurveZProperty = ShaderProperty.getByName("renderer_SOLMaxCurveZ");
|
|
38642
|
+
__decorate([
|
|
38643
|
+
ignoreClone
|
|
38644
|
+
], SizeOverLifetimeModule.prototype, "_sizeRand", void 0);
|
|
38589
38645
|
__decorate([
|
|
38590
38646
|
ignoreClone
|
|
38591
38647
|
], SizeOverLifetimeModule.prototype, "_enableSeparateMacro", void 0);
|
|
@@ -39888,6 +39944,7 @@ __decorate([
|
|
|
39888
39944
|
this.velocityOverLifetime._resetRandomSeed(seed);
|
|
39889
39945
|
this.forceOverLifetime._resetRandomSeed(seed);
|
|
39890
39946
|
this.limitVelocityOverLifetime._resetRandomSeed(seed);
|
|
39947
|
+
this.sizeOverLifetime._resetRandomSeed(seed);
|
|
39891
39948
|
this.rotationOverLifetime._resetRandomSeed(seed);
|
|
39892
39949
|
this.colorOverLifetime._resetRandomSeed(seed);
|
|
39893
39950
|
this.noise._resetRandomSeed(seed);
|
|
@@ -39949,8 +40006,8 @@ __decorate([
|
|
|
39949
40006
|
}
|
|
39950
40007
|
};
|
|
39951
40008
|
/**
|
|
39952
|
-
* @
|
|
39953
|
-
*/ _proto.
|
|
40009
|
+
* @inheritdoc
|
|
40010
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
39954
40011
|
target._setTransformFeedback();
|
|
39955
40012
|
};
|
|
39956
40013
|
/**
|
|
@@ -40145,8 +40202,13 @@ __decorate([
|
|
|
40145
40202
|
if (colorOverLifetime.enabled && colorOverLifetime.color.mode === ParticleGradientMode.TwoGradients) {
|
|
40146
40203
|
instanceVertices[offset + 20] = colorOverLifetime._colorGradientRand.random();
|
|
40147
40204
|
}
|
|
40205
|
+
// Noise and size-over-lifetime temporarily share slot 21 (a_Random0.z), so noise takes precedence
|
|
40206
|
+
// Track independent module randomness and instance layout optimization in #3075
|
|
40207
|
+
var sizeOverLifetime = this.sizeOverLifetime;
|
|
40148
40208
|
if (this.noise.enabled) {
|
|
40149
40209
|
instanceVertices[offset + 21] = this.noise._noiseRand.random();
|
|
40210
|
+
} else if (sizeOverLifetime.enabled && sizeOverLifetime._isRandomCurveMode()) {
|
|
40211
|
+
instanceVertices[offset + 21] = sizeOverLifetime._sizeRand.random();
|
|
40150
40212
|
}
|
|
40151
40213
|
var rotationOverLifetime = this.rotationOverLifetime;
|
|
40152
40214
|
if (rotationOverLifetime.enabled && rotationOverLifetime.rotationZ.mode === ParticleCurveMode.TwoConstants) {
|
|
@@ -41705,8 +41767,8 @@ __decorate([
|
|
|
41705
41767
|
}
|
|
41706
41768
|
};
|
|
41707
41769
|
/**
|
|
41708
|
-
* @
|
|
41709
|
-
*/ _proto.
|
|
41770
|
+
* @inheritdoc
|
|
41771
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
41710
41772
|
target.mesh = this._mesh;
|
|
41711
41773
|
};
|
|
41712
41774
|
_create_class(MeshShape, [
|