@galacean/engine-core 0.0.0-experimental-2.0-migrate.4 → 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 +432 -365
- package/dist/main.js.map +1 -1
- package/dist/module.js +433 -366
- 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 -9
- package/types/asset/ResourceManager.d.ts +16 -0
- package/types/base/DataObject.d.ts +2 -3
- package/types/clone/{CloneManager.d.ts → CloneDecorators.d.ts} +5 -4
- 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/enums/CloneMode.d.ts +0 -15
package/dist/main.js
CHANGED
|
@@ -131,61 +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
|
+
/** @internal */ var defaultCloneModeKey = Symbol("defaultCloneMode");
|
|
135
|
+
/** @internal */ var fieldCloneModesKey = Symbol("fieldCloneModes");
|
|
134
136
|
/**
|
|
135
|
-
*
|
|
137
|
+
* @internal
|
|
136
138
|
*/ var CloneMode = /*#__PURE__*/ function(CloneMode) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
* state keeps the clone's own.
|
|
143
|
-
*/ 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";
|
|
144
144
|
return CloneMode;
|
|
145
145
|
}({});
|
|
146
|
-
|
|
147
146
|
/**
|
|
148
147
|
* Property decorator — deep clone this field's whole subtree, overriding the value type's default
|
|
149
|
-
* clone mode (field-level decorators have the highest priority). The deep intent carries into
|
|
150
|
-
* field
|
|
151
|
-
*
|
|
152
|
-
*
|
|
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
153
|
*/ function deepClone(target, propertyKey) {
|
|
154
|
-
|
|
154
|
+
CloneMetadata.registerFieldMode(target, propertyKey, 4);
|
|
155
155
|
}
|
|
156
156
|
/**
|
|
157
157
|
* Property decorator — assign (share the reference) this field, overriding the value type's default clone mode.
|
|
158
158
|
*/ function assignmentClone(target, propertyKey) {
|
|
159
|
-
|
|
159
|
+
CloneMetadata.registerFieldMode(target, propertyKey, 1);
|
|
160
160
|
}
|
|
161
161
|
/**
|
|
162
162
|
* Property decorator — ignore this field when cloning; keep the clone's own constructor-built value.
|
|
163
163
|
*/ function ignoreClone(target, propertyKey) {
|
|
164
|
-
|
|
164
|
+
CloneMetadata.registerFieldMode(target, propertyKey, 0);
|
|
165
165
|
}
|
|
166
166
|
/**
|
|
167
167
|
* @internal
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
var _target__fieldModes;
|
|
181
|
-
Object.defineProperty(target, "_fieldModes", {
|
|
182
|
-
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),
|
|
183
180
|
configurable: true
|
|
184
181
|
});
|
|
185
182
|
}
|
|
186
|
-
target
|
|
183
|
+
target[fieldCloneModesKey][propertyKey] = mode;
|
|
187
184
|
};
|
|
188
|
-
return
|
|
185
|
+
return CloneMetadata;
|
|
189
186
|
}();
|
|
190
187
|
|
|
191
188
|
/**
|
|
@@ -342,6 +339,7 @@ __decorate([
|
|
|
342
339
|
]);
|
|
343
340
|
return ReferResource;
|
|
344
341
|
}(EngineObject);
|
|
342
|
+
registerDefaultCloneMode(ReferResource, CloneMode.Assignment);
|
|
345
343
|
|
|
346
344
|
/**
|
|
347
345
|
* ContentRestorer is a base class for all content restore info classes.
|
|
@@ -3634,11 +3632,11 @@ Time._elapsedTimeProperty = ShaderProperty.getByName("scene_ElapsedTime");
|
|
|
3634
3632
|
Time._deltaTimeProperty = ShaderProperty.getByName("scene_DeltaTime");
|
|
3635
3633
|
|
|
3636
3634
|
/**
|
|
3637
|
-
* Base class
|
|
3638
|
-
*
|
|
3639
|
-
* 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.
|
|
3640
3637
|
*/ var DataObject = function DataObject() {
|
|
3641
3638
|
};
|
|
3639
|
+
registerDefaultCloneMode(DataObject, CloneMode.Deep);
|
|
3642
3640
|
|
|
3643
3641
|
var Utils = /*#__PURE__*/ function() {
|
|
3644
3642
|
function Utils() {}
|
|
@@ -3708,10 +3706,16 @@ var Utils = /*#__PURE__*/ function() {
|
|
|
3708
3706
|
if (Utils.isAbsoluteUrl(baseUrl)) {
|
|
3709
3707
|
return relativeUrl ? new URL(relativeUrl, baseUrl).href : baseUrl;
|
|
3710
3708
|
}
|
|
3711
|
-
|
|
3712
|
-
|
|
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(/^\/+/, ""));
|
|
3713
3716
|
var encodedRelativeUrl = this._encodePathComponents(relativeUrl);
|
|
3714
|
-
|
|
3717
|
+
var resolvedPath = decodeURIComponent(new URL(encodedRelativeUrl, encodedBaseUrl).href.slice(head.length));
|
|
3718
|
+
return resolvedHasLeadingSlash ? "/" + resolvedPath : resolvedPath;
|
|
3715
3719
|
};
|
|
3716
3720
|
/**
|
|
3717
3721
|
* @internal
|
|
@@ -4048,6 +4052,7 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
4048
4052
|
]);
|
|
4049
4053
|
return DisorderedArray;
|
|
4050
4054
|
}();
|
|
4055
|
+
registerDefaultCloneMode(DisorderedArray, CloneMode.Ignore);
|
|
4051
4056
|
|
|
4052
4057
|
/**
|
|
4053
4058
|
* Sprite's tiling mode enumeration.
|
|
@@ -4958,6 +4963,7 @@ function _extends() {
|
|
|
4958
4963
|
};
|
|
4959
4964
|
return UpdateFlagManager;
|
|
4960
4965
|
}();
|
|
4966
|
+
registerDefaultCloneMode(UpdateFlagManager, CloneMode.Ignore);
|
|
4961
4967
|
|
|
4962
4968
|
/**
|
|
4963
4969
|
* Buffer usage.
|
|
@@ -5288,6 +5294,7 @@ __decorate([
|
|
|
5288
5294
|
__decorate([
|
|
5289
5295
|
ignoreClone
|
|
5290
5296
|
], Component.prototype, "_phasedActive", void 0);
|
|
5297
|
+
registerDefaultCloneMode(Component, CloneMode.Remap);
|
|
5291
5298
|
|
|
5292
5299
|
/**
|
|
5293
5300
|
* @internal
|
|
@@ -5417,6 +5424,7 @@ function dependentComponents(componentOrComponents, dependentMode) {
|
|
|
5417
5424
|
};
|
|
5418
5425
|
return UpdateFlag;
|
|
5419
5426
|
}();
|
|
5427
|
+
registerDefaultCloneMode(UpdateFlag, CloneMode.Ignore);
|
|
5420
5428
|
|
|
5421
5429
|
/**
|
|
5422
5430
|
* Bool update flag.
|
|
@@ -5610,8 +5618,8 @@ function dependentComponents(componentOrComponents, dependentMode) {
|
|
|
5610
5618
|
return this._frontFaceInvert;
|
|
5611
5619
|
};
|
|
5612
5620
|
/**
|
|
5613
|
-
* @
|
|
5614
|
-
*/ _proto.
|
|
5621
|
+
* @inheritdoc
|
|
5622
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
5615
5623
|
var position = target._position, rotation = target._rotation, scale = target._scale;
|
|
5616
5624
|
// @ts-ignore
|
|
5617
5625
|
position._onValueChanged = rotation._onValueChanged = scale._onValueChanged = null;
|
|
@@ -6437,15 +6445,15 @@ function _construct(Parent, args, Class) {
|
|
|
6437
6445
|
return Layer;
|
|
6438
6446
|
}({});
|
|
6439
6447
|
|
|
6440
|
-
|
|
6448
|
+
/**
|
|
6449
|
+
* @internal
|
|
6450
|
+
* Clones component fields and runs the component's post-clone hook.
|
|
6451
|
+
*/ var ComponentCloner = /*#__PURE__*/ function() {
|
|
6441
6452
|
function ComponentCloner() {}
|
|
6442
6453
|
/**
|
|
6443
|
-
*
|
|
6444
|
-
* @param source - Clone source
|
|
6445
|
-
* @param target - Clone target
|
|
6446
|
-
* @param cloneMap - Identity map of the cloned subtree (source object → clone)
|
|
6454
|
+
* @internal
|
|
6447
6455
|
*/ ComponentCloner.cloneComponent = function cloneComponent(source, target, cloneMap) {
|
|
6448
|
-
var fieldModes = source
|
|
6456
|
+
var fieldModes = source[fieldCloneModesKey];
|
|
6449
6457
|
var keys = Object.keys(source);
|
|
6450
6458
|
for(var i = 0, n = keys.length; i < n; i++){
|
|
6451
6459
|
var k = keys[i];
|
|
@@ -6453,10 +6461,10 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
6453
6461
|
if (fieldMode === CloneMode.Ignore) continue;
|
|
6454
6462
|
var sourceValue = source[k];
|
|
6455
6463
|
var preset = target[k];
|
|
6456
|
-
var cloned = target[k] = CloneUtil.
|
|
6464
|
+
var cloned = target[k] = CloneUtil._cloneFieldValue(sourceValue, preset, cloneMap, fieldMode);
|
|
6457
6465
|
CloneUtil._transferSlotOwnership(cloned, sourceValue, preset);
|
|
6458
6466
|
}
|
|
6459
|
-
source.
|
|
6467
|
+
source._onClone == null ? void 0 : source._onClone.call(source, target, cloneMap);
|
|
6460
6468
|
};
|
|
6461
6469
|
return ComponentCloner;
|
|
6462
6470
|
}();
|
|
@@ -7131,211 +7139,160 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
7131
7139
|
return Entity;
|
|
7132
7140
|
}(EngineObject);
|
|
7133
7141
|
/** @internal */ Entity._tempComponentConstructors = [];
|
|
7134
|
-
|
|
7135
|
-
var SafeLoopArray = /*#__PURE__*/ function() {
|
|
7136
|
-
function SafeLoopArray() {
|
|
7137
|
-
this._array = [];
|
|
7138
|
-
this._loopArray = [];
|
|
7139
|
-
this._loopArrayDirty = false;
|
|
7140
|
-
}
|
|
7141
|
-
var _proto = SafeLoopArray.prototype;
|
|
7142
|
-
/**
|
|
7143
|
-
* Push item to the array.
|
|
7144
|
-
* @param item - The item which want to be pushed
|
|
7145
|
-
*/ _proto.push = function push(item) {
|
|
7146
|
-
this._array.push(item);
|
|
7147
|
-
this._loopArrayDirty = true;
|
|
7148
|
-
};
|
|
7149
|
-
/**
|
|
7150
|
-
* Add item to the array.
|
|
7151
|
-
* @param index - The index of the array
|
|
7152
|
-
* @param item - The item which want to be added
|
|
7153
|
-
*/ _proto.add = function add(index, item) {
|
|
7154
|
-
this._array.splice(index, 0, item);
|
|
7155
|
-
this._loopArrayDirty = true;
|
|
7156
|
-
};
|
|
7157
|
-
/**
|
|
7158
|
-
* Remove item from the array.
|
|
7159
|
-
* @param index - The index of the array
|
|
7160
|
-
*/ _proto.removeByIndex = function removeByIndex(index) {
|
|
7161
|
-
this._array.splice(index, 1);
|
|
7162
|
-
this._loopArrayDirty = true;
|
|
7163
|
-
};
|
|
7164
|
-
/**
|
|
7165
|
-
* Remove item from array that pass the specified comparison function.
|
|
7166
|
-
* @param filter - The comparison function
|
|
7167
|
-
*/ _proto.findAndRemove = function findAndRemove(filter) {
|
|
7168
|
-
var array = this._array;
|
|
7169
|
-
for(var i = array.length - 1; i >= 0; i--){
|
|
7170
|
-
filter(array[i]) && this.removeByIndex(i);
|
|
7171
|
-
}
|
|
7172
|
-
};
|
|
7173
|
-
/**
|
|
7174
|
-
* The index of the item.
|
|
7175
|
-
* @param item - The item which want to get the index
|
|
7176
|
-
* @returns Index of the item
|
|
7177
|
-
*/ _proto.indexOf = function indexOf(item) {
|
|
7178
|
-
return this._array.indexOf(item);
|
|
7179
|
-
};
|
|
7180
|
-
/**
|
|
7181
|
-
* Get the array.
|
|
7182
|
-
* @returns The array
|
|
7183
|
-
*/ _proto.getArray = function getArray() {
|
|
7184
|
-
return this._array;
|
|
7185
|
-
};
|
|
7186
|
-
/**
|
|
7187
|
-
* Get the array use for loop.
|
|
7188
|
-
* @returns The array use for loop
|
|
7189
|
-
*/ _proto.getLoopArray = function getLoopArray() {
|
|
7190
|
-
var loopArray = this._loopArray;
|
|
7191
|
-
if (this._loopArrayDirty) {
|
|
7192
|
-
var array = this._array;
|
|
7193
|
-
var count = array.length;
|
|
7194
|
-
loopArray.length = count;
|
|
7195
|
-
for(var i = 0; i < count; i++){
|
|
7196
|
-
loopArray[i] = array[i];
|
|
7197
|
-
}
|
|
7198
|
-
this._loopArrayDirty = false;
|
|
7199
|
-
}
|
|
7200
|
-
return loopArray;
|
|
7201
|
-
};
|
|
7202
|
-
_create_class(SafeLoopArray, [
|
|
7203
|
-
{
|
|
7204
|
-
key: "length",
|
|
7205
|
-
get: /**
|
|
7206
|
-
* Get the length of the array.
|
|
7207
|
-
*/ function get() {
|
|
7208
|
-
return this._array.length;
|
|
7209
|
-
}
|
|
7210
|
-
}
|
|
7211
|
-
]);
|
|
7212
|
-
return SafeLoopArray;
|
|
7213
|
-
}();
|
|
7142
|
+
registerDefaultCloneMode(Entity, CloneMode.Remap);
|
|
7214
7143
|
|
|
7215
7144
|
/**
|
|
7216
7145
|
* @internal
|
|
7217
|
-
* Split from `CloneManager`, which must stay free of engine imports.
|
|
7218
7146
|
*/ var CloneUtil = /*#__PURE__*/ function() {
|
|
7219
7147
|
function CloneUtil() {}
|
|
7220
7148
|
/**
|
|
7221
7149
|
* @internal
|
|
7222
|
-
*/ CloneUtil.
|
|
7223
|
-
if (
|
|
7224
|
-
var fieldModes = source
|
|
7150
|
+
*/ CloneUtil._cloneObjectFields = function _cloneObjectFields(source, target, cloneMap, deepCloneSubtree) {
|
|
7151
|
+
if (deepCloneSubtree === void 0) deepCloneSubtree = false;
|
|
7152
|
+
var fieldModes = source[fieldCloneModesKey];
|
|
7225
7153
|
var keys = Object.keys(source);
|
|
7226
7154
|
for(var i = 0, n = keys.length; i < n; i++){
|
|
7227
7155
|
var k = keys[i];
|
|
7228
7156
|
var fieldMode = fieldModes == null ? void 0 : fieldModes[k];
|
|
7229
7157
|
if (fieldMode === CloneMode.Ignore) continue;
|
|
7230
|
-
target[k] = CloneUtil.
|
|
7158
|
+
target[k] = CloneUtil._cloneFieldValue(source[k], target[k], cloneMap, fieldMode, deepCloneSubtree);
|
|
7231
7159
|
}
|
|
7232
7160
|
};
|
|
7233
7161
|
/**
|
|
7234
7162
|
* @internal
|
|
7235
|
-
*/ CloneUtil.
|
|
7236
|
-
if (
|
|
7163
|
+
*/ CloneUtil._cloneFieldValue = function _cloneFieldValue(source, preset, cloneMap, fieldMode, deepCloneSubtree) {
|
|
7164
|
+
if (deepCloneSubtree === void 0) deepCloneSubtree = false;
|
|
7237
7165
|
if (fieldMode === CloneMode.Assignment) return source;
|
|
7238
|
-
if (fieldMode === CloneMode.Deep)
|
|
7239
|
-
|
|
7240
|
-
forceDeepClone = true;
|
|
7241
|
-
}
|
|
7242
|
-
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);
|
|
7243
7168
|
};
|
|
7244
7169
|
/**
|
|
7245
7170
|
* @internal
|
|
7246
|
-
*/ CloneUtil.
|
|
7247
|
-
if (
|
|
7248
|
-
if (
|
|
7249
|
-
|
|
7250
|
-
|
|
7251
|
-
|
|
7252
|
-
|
|
7253
|
-
if (
|
|
7254
|
-
|
|
7255
|
-
if (Array.isArray(source)) return CloneUtil._deepCloneArray(source, preset, cloneMap, forceDeepClone);
|
|
7256
|
-
if (_instanceof(source, Map)) return CloneUtil._deepCloneMap(source, preset, cloneMap, forceDeepClone);
|
|
7257
|
-
if (_instanceof(source, Set)) return CloneUtil._deepCloneSet(source, preset, cloneMap, forceDeepClone);
|
|
7258
|
-
if (_instanceof(source, DisorderedArray) || _instanceof(source, SafeLoopArray)) {
|
|
7259
|
-
if (!forceDeepClone) return preset;
|
|
7260
|
-
var existing = cloneMap.get(source);
|
|
7261
|
-
if (existing) return existing;
|
|
7262
|
-
var dst = CloneUtil._createCloneTarget(source, preset, cloneMap);
|
|
7263
|
-
CloneUtil._deepCloneObject(source, dst, cloneMap, true);
|
|
7264
|
-
return dst;
|
|
7265
|
-
}
|
|
7266
|
-
var ctor = source.constructor;
|
|
7267
|
-
if (ctor && ctor !== Object && typeof source.copyFrom === "function") {
|
|
7268
|
-
var existing1 = cloneMap.get(source);
|
|
7269
|
-
if (existing1) return existing1;
|
|
7270
|
-
var dst1 = CloneUtil._createCloneTarget(source, preset, cloneMap);
|
|
7271
|
-
dst1.copyFrom(source);
|
|
7272
|
-
source._cloneTo == null ? void 0 : source._cloneTo.call(source, dst1, cloneMap);
|
|
7273
|
-
return dst1;
|
|
7274
|
-
}
|
|
7275
|
-
if (_instanceof(source, DataObject) || ctor === Object || ctor === undefined || forceDeepClone) {
|
|
7276
|
-
var existing2 = cloneMap.get(source);
|
|
7277
|
-
if (existing2) return existing2;
|
|
7278
|
-
var dst2 = CloneUtil._createCloneTarget(source, preset, cloneMap);
|
|
7279
|
-
CloneUtil._deepCloneObject(source, dst2, cloneMap, forceDeepClone);
|
|
7280
|
-
source._cloneTo == null ? void 0 : source._cloneTo.call(source, dst2, cloneMap);
|
|
7281
|
-
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);
|
|
7282
7180
|
}
|
|
7283
|
-
return source;
|
|
7284
7181
|
};
|
|
7285
|
-
|
|
7286
|
-
* @internal
|
|
7287
|
-
*/ CloneUtil._assertDeepCloneable = function _assertDeepCloneable(source) {
|
|
7182
|
+
CloneUtil._cloneValueForDeepField = function _cloneValueForDeepField(source, preset, cloneMap) {
|
|
7288
7183
|
if (typeof source === "function") {
|
|
7289
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.");
|
|
7290
7185
|
}
|
|
7291
7186
|
if (_instanceof(source, Entity) || _instanceof(source, Component)) {
|
|
7292
|
-
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.");
|
|
7293
7188
|
}
|
|
7294
7189
|
if (_instanceof(source, ReferResource)) {
|
|
7295
|
-
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.");
|
|
7296
7191
|
}
|
|
7297
7192
|
if (_instanceof(source, UpdateFlagManager) || _instanceof(source, UpdateFlag)) {
|
|
7298
|
-
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);
|
|
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);
|
|
7299
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);
|
|
7300
7218
|
};
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
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;
|
|
7306
7275
|
var dst;
|
|
7307
7276
|
if (reusable) {
|
|
7308
7277
|
dst = reusable;
|
|
7309
7278
|
} else {
|
|
7310
|
-
|
|
7279
|
+
var ctor = proto == null ? void 0 : proto.constructor;
|
|
7280
|
+
if (typeof ctor === "function") {
|
|
7311
7281
|
try {
|
|
7312
7282
|
dst = new ctor();
|
|
7313
|
-
} catch (
|
|
7314
|
-
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
|
+
});
|
|
7315
7287
|
}
|
|
7316
7288
|
} else {
|
|
7317
|
-
dst = Object.create(
|
|
7289
|
+
dst = Object.create(proto);
|
|
7318
7290
|
}
|
|
7319
7291
|
}
|
|
7320
7292
|
cloneMap.set(source, dst);
|
|
7321
7293
|
return dst;
|
|
7322
7294
|
};
|
|
7323
|
-
|
|
7324
|
-
* @internal
|
|
7325
|
-
*/ CloneUtil._transferSlotOwnership = function _transferSlotOwnership(cloned, source, preset) {
|
|
7326
|
-
if (cloned === preset) return;
|
|
7327
|
-
if (_instanceof(preset, ReferResource)) {
|
|
7328
|
-
var presetRefCount = preset.refCount;
|
|
7329
|
-
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).");
|
|
7330
|
-
preset._addReferCount(-1);
|
|
7331
|
-
}
|
|
7332
|
-
if (cloned === source && _instanceof(cloned, ReferResource)) {
|
|
7333
|
-
cloned._addReferCount(1);
|
|
7334
|
-
}
|
|
7335
|
-
};
|
|
7336
|
-
/**
|
|
7337
|
-
* @internal
|
|
7338
|
-
*/ CloneUtil._deepCloneArrayBuffer = function _deepCloneArrayBuffer(source, preset, cloneMap) {
|
|
7295
|
+
CloneUtil._deepCloneArrayBufferView = function _deepCloneArrayBufferView(source, preset, cloneMap) {
|
|
7339
7296
|
var existing = cloneMap.get(source);
|
|
7340
7297
|
if (existing) return existing;
|
|
7341
7298
|
var dst;
|
|
@@ -7358,23 +7315,19 @@ var SafeLoopArray = /*#__PURE__*/ function() {
|
|
|
7358
7315
|
cloneMap.set(source, dst);
|
|
7359
7316
|
return dst;
|
|
7360
7317
|
};
|
|
7361
|
-
|
|
7362
|
-
|
|
7363
|
-
*/ CloneUtil._deepCloneArray = function _deepCloneArray(source, preset, cloneMap, forceDeepClone) {
|
|
7364
|
-
if (forceDeepClone === void 0) forceDeepClone = false;
|
|
7318
|
+
CloneUtil._cloneArray = function _cloneArray(source, preset, cloneMap, deepCloneSubtree) {
|
|
7319
|
+
if (deepCloneSubtree === void 0) deepCloneSubtree = false;
|
|
7365
7320
|
var existing = cloneMap.get(source);
|
|
7366
7321
|
if (existing) return existing;
|
|
7367
7322
|
var dst = preset !== source && Array.isArray(preset) && preset.constructor === source.constructor && preset.length === source.length ? preset : new Array(source.length);
|
|
7368
7323
|
cloneMap.set(source, dst);
|
|
7369
7324
|
for(var i = 0, n = source.length; i < n; i++){
|
|
7370
|
-
dst[i] = CloneUtil.
|
|
7325
|
+
dst[i] = CloneUtil._cloneValueByDefault(source[i], undefined, cloneMap, deepCloneSubtree);
|
|
7371
7326
|
}
|
|
7372
7327
|
return dst;
|
|
7373
7328
|
};
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
*/ CloneUtil._deepCloneMap = function _deepCloneMap(source, preset, cloneMap, forceDeepClone) {
|
|
7377
|
-
if (forceDeepClone === void 0) forceDeepClone = false;
|
|
7329
|
+
CloneUtil._cloneMap = function _cloneMap(source, preset, cloneMap, deepCloneSubtree) {
|
|
7330
|
+
if (deepCloneSubtree === void 0) deepCloneSubtree = false;
|
|
7378
7331
|
var existing = cloneMap.get(source);
|
|
7379
7332
|
if (existing) return existing;
|
|
7380
7333
|
var dst;
|
|
@@ -7387,14 +7340,12 @@ var SafeLoopArray = /*#__PURE__*/ function() {
|
|
|
7387
7340
|
cloneMap.set(source, dst);
|
|
7388
7341
|
for(var _iterator = _create_for_of_iterator_helper_loose(source), _step; !(_step = _iterator()).done;){
|
|
7389
7342
|
var entry = _step.value;
|
|
7390
|
-
dst.set(CloneUtil.
|
|
7343
|
+
dst.set(CloneUtil._cloneValueByDefault(entry[0], undefined, cloneMap, deepCloneSubtree), CloneUtil._cloneValueByDefault(entry[1], undefined, cloneMap, deepCloneSubtree));
|
|
7391
7344
|
}
|
|
7392
7345
|
return dst;
|
|
7393
7346
|
};
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
*/ CloneUtil._deepCloneSet = function _deepCloneSet(source, preset, cloneMap, forceDeepClone) {
|
|
7397
|
-
if (forceDeepClone === void 0) forceDeepClone = false;
|
|
7347
|
+
CloneUtil._cloneSet = function _cloneSet(source, preset, cloneMap, deepCloneSubtree) {
|
|
7348
|
+
if (deepCloneSubtree === void 0) deepCloneSubtree = false;
|
|
7398
7349
|
var existing = cloneMap.get(source);
|
|
7399
7350
|
if (existing) return existing;
|
|
7400
7351
|
var dst;
|
|
@@ -7407,12 +7358,45 @@ var SafeLoopArray = /*#__PURE__*/ function() {
|
|
|
7407
7358
|
cloneMap.set(source, dst);
|
|
7408
7359
|
for(var _iterator = _create_for_of_iterator_helper_loose(source), _step; !(_step = _iterator()).done;){
|
|
7409
7360
|
var v = _step.value;
|
|
7410
|
-
dst.add(CloneUtil.
|
|
7361
|
+
dst.add(CloneUtil._cloneValueByDefault(v, undefined, cloneMap, deepCloneSubtree));
|
|
7411
7362
|
}
|
|
7412
7363
|
return dst;
|
|
7413
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
|
+
};
|
|
7414
7379
|
return CloneUtil;
|
|
7415
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
|
+
}
|
|
7416
7400
|
|
|
7417
7401
|
/**
|
|
7418
7402
|
* Shader data collection,Correspondence includes shader properties data and macros data.
|
|
@@ -7584,12 +7568,8 @@ var SafeLoopArray = /*#__PURE__*/ function() {
|
|
|
7584
7568
|
return shaderData;
|
|
7585
7569
|
};
|
|
7586
7570
|
_proto.cloneTo = function cloneTo(target) {
|
|
7587
|
-
CloneUtil.
|
|
7588
|
-
|
|
7589
|
-
for(var key in targetMacroMap){
|
|
7590
|
-
delete targetMacroMap[key];
|
|
7591
|
-
}
|
|
7592
|
-
Object.assign(targetMacroMap, this._macroMap);
|
|
7571
|
+
CloneUtil._cloneObjectFields(this._macroCollection, target._macroCollection, new Map());
|
|
7572
|
+
Object.assign(target._macroMap, this._macroMap);
|
|
7593
7573
|
var referCount = target._getReferCount();
|
|
7594
7574
|
var propertyValueMap = this._propertyValueMap;
|
|
7595
7575
|
var targetPropertyValueMap = target._propertyValueMap;
|
|
@@ -7621,8 +7601,8 @@ var SafeLoopArray = /*#__PURE__*/ function() {
|
|
|
7621
7601
|
}
|
|
7622
7602
|
};
|
|
7623
7603
|
/**
|
|
7624
|
-
* @
|
|
7625
|
-
*/ _proto.
|
|
7604
|
+
* @inheritdoc
|
|
7605
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
7626
7606
|
this.cloneTo(target);
|
|
7627
7607
|
};
|
|
7628
7608
|
/**
|
|
@@ -7867,8 +7847,8 @@ exports.Renderer = /*#__PURE__*/ function(Component) {
|
|
|
7867
7847
|
ShaderMacroCollection.unionCollection(context.camera._globalShaderMacro, this.shaderData._macroCollection, this._globalShaderMacro);
|
|
7868
7848
|
};
|
|
7869
7849
|
/**
|
|
7870
|
-
* @
|
|
7871
|
-
*/ _proto.
|
|
7850
|
+
* @inheritdoc
|
|
7851
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
7872
7852
|
var materials = this._materials;
|
|
7873
7853
|
for(var i = 0, n = materials.length; i < n; i++){
|
|
7874
7854
|
target._setMaterial(i, materials[i]);
|
|
@@ -11129,7 +11109,7 @@ SpriteMaskUtils._u32Buffer4 = new Uint32Array(4);
|
|
|
11129
11109
|
};
|
|
11130
11110
|
/**
|
|
11131
11111
|
* @internal
|
|
11132
|
-
* Clone mask data to target. Called from subclass
|
|
11112
|
+
* Clone mask data to target. Called from subclass _onClone.
|
|
11133
11113
|
*/ _proto._cloneMaskData = function _cloneMaskData(target) {
|
|
11134
11114
|
target.sprite = this._sprite;
|
|
11135
11115
|
};
|
|
@@ -11744,9 +11724,9 @@ __decorate([
|
|
|
11744
11724
|
this._updateWorldSpaceTransformShaderData(context, onlyMVP);
|
|
11745
11725
|
};
|
|
11746
11726
|
/**
|
|
11747
|
-
* @
|
|
11748
|
-
*/ _proto.
|
|
11749
|
-
_MaskRenderable.prototype.
|
|
11727
|
+
* @inheritdoc
|
|
11728
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
11729
|
+
_MaskRenderable.prototype._onClone.call(this, target);
|
|
11750
11730
|
this._cloneMaskData(target);
|
|
11751
11731
|
};
|
|
11752
11732
|
/**
|
|
@@ -11890,9 +11870,9 @@ __decorate([
|
|
|
11890
11870
|
this._updateWorldSpaceTransformShaderData(context, onlyMVP);
|
|
11891
11871
|
};
|
|
11892
11872
|
/**
|
|
11893
|
-
* @
|
|
11894
|
-
*/ _proto.
|
|
11895
|
-
Renderer.prototype.
|
|
11873
|
+
* @inheritdoc
|
|
11874
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
11875
|
+
Renderer.prototype._onClone.call(this, target);
|
|
11896
11876
|
target.sprite = this._sprite;
|
|
11897
11877
|
target.drawMode = this._drawMode;
|
|
11898
11878
|
};
|
|
@@ -12390,7 +12370,9 @@ __decorate([
|
|
|
12390
12370
|
this._textChunks = null;
|
|
12391
12371
|
this._subFont && (this._subFont = null);
|
|
12392
12372
|
};
|
|
12393
|
-
|
|
12373
|
+
/**
|
|
12374
|
+
* @internal
|
|
12375
|
+
*/ _proto._isContainDirtyFlag = function _isContainDirtyFlag(type) {
|
|
12394
12376
|
return (this._dirtyFlag & type) != 0;
|
|
12395
12377
|
};
|
|
12396
12378
|
/**
|
|
@@ -15333,9 +15315,9 @@ var BlendShapeFrameDirty = /*#__PURE__*/ function(BlendShapeFrameDirty) {
|
|
|
15333
15315
|
Renderer.prototype._onDestroy.call(this);
|
|
15334
15316
|
};
|
|
15335
15317
|
/**
|
|
15336
|
-
* @
|
|
15337
|
-
*/ _proto.
|
|
15338
|
-
Renderer.prototype.
|
|
15318
|
+
* @inheritdoc
|
|
15319
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
15320
|
+
Renderer.prototype._onClone.call(this, target);
|
|
15339
15321
|
target.mesh = this._mesh;
|
|
15340
15322
|
};
|
|
15341
15323
|
/**
|
|
@@ -18357,9 +18339,9 @@ var SkinUpdateFlag = /*#__PURE__*/ function(SkinUpdateFlag) {
|
|
|
18357
18339
|
this._jointTexture = null;
|
|
18358
18340
|
};
|
|
18359
18341
|
/**
|
|
18360
|
-
* @
|
|
18361
|
-
*/ _proto.
|
|
18362
|
-
MeshRenderer.prototype.
|
|
18342
|
+
* @inheritdoc
|
|
18343
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
18344
|
+
MeshRenderer.prototype._onClone.call(this, target);
|
|
18363
18345
|
if (this._jointTexture) {
|
|
18364
18346
|
target.shaderData.setTexture(SkinnedMeshRenderer._jointSamplerProperty, null);
|
|
18365
18347
|
}
|
|
@@ -19410,6 +19392,87 @@ RenderContext._flipYViewProjectionMatrix = new engineMath.Matrix();
|
|
|
19410
19392
|
return AssetType;
|
|
19411
19393
|
}({});
|
|
19412
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
|
+
|
|
19413
19476
|
/**
|
|
19414
19477
|
* Scene manager.
|
|
19415
19478
|
*/ var SceneManager = /*#__PURE__*/ function() {
|
|
@@ -19742,7 +19805,7 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
19742
19805
|
this._graphicResourcePool = Object.create(null);
|
|
19743
19806
|
this._contentRestorerPool = Object.create(null);
|
|
19744
19807
|
this._subAssetPromiseCallbacks = {};
|
|
19745
|
-
this
|
|
19808
|
+
this.// Virtual resource mapping
|
|
19746
19809
|
/** @internal */ _objectPool = Object.create(null);
|
|
19747
19810
|
this./** @internal */ _virtualPathResourceMap = Object.create(null);
|
|
19748
19811
|
}
|
|
@@ -19856,21 +19919,6 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
19856
19919
|
};
|
|
19857
19920
|
/**
|
|
19858
19921
|
* @internal
|
|
19859
|
-
*/ _proto._onSubAssetFail = function _onSubAssetFail(assetBaseURL, assetSubPath, value) {
|
|
19860
|
-
var _this__subAssetPromiseCallbacks_assetBaseURL;
|
|
19861
|
-
var subPromiseCallback = (_this__subAssetPromiseCallbacks_assetBaseURL = this._subAssetPromiseCallbacks[assetBaseURL]) == null ? void 0 : _this__subAssetPromiseCallbacks_assetBaseURL[assetSubPath];
|
|
19862
|
-
if (subPromiseCallback) {
|
|
19863
|
-
subPromiseCallback.reject(value);
|
|
19864
|
-
} else {
|
|
19865
|
-
var // Pending
|
|
19866
|
-
_this__subAssetPromiseCallbacks, _assetBaseURL;
|
|
19867
|
-
((_this__subAssetPromiseCallbacks = this._subAssetPromiseCallbacks)[_assetBaseURL = assetBaseURL] || (_this__subAssetPromiseCallbacks[_assetBaseURL] = {}))[assetSubPath] = {
|
|
19868
|
-
rejectedValue: value
|
|
19869
|
-
};
|
|
19870
|
-
}
|
|
19871
|
-
};
|
|
19872
|
-
/**
|
|
19873
|
-
* @internal
|
|
19874
19922
|
*/ _proto._addAsset = function _addAsset(path, asset) {
|
|
19875
19923
|
this._assetPool[asset.instanceId] = path;
|
|
19876
19924
|
this._assetUrlPool[path] = asset;
|
|
@@ -19979,11 +20027,13 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
19979
20027
|
// Get remote asset base url
|
|
19980
20028
|
var virtualResourceEntry = this._virtualPathResourceMap[assetBaseURL];
|
|
19981
20029
|
this._resolveLoadItemOptions(item, virtualResourceEntry);
|
|
19982
|
-
//
|
|
19983
|
-
|
|
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;
|
|
19984
20035
|
var _virtualResourceEntry_path;
|
|
19985
|
-
var remoteAssetBaseURL = (_virtualResourceEntry_path = virtualResourceEntry == null ? void 0 : virtualResourceEntry.path) != null ? _virtualResourceEntry_path :
|
|
19986
|
-
item.resolvedUrl = remoteAssetBaseURL;
|
|
20036
|
+
var remoteAssetBaseURL = (_virtualResourceEntry_path = virtualResourceEntry == null ? void 0 : virtualResourceEntry.path) != null ? _virtualResourceEntry_path : loadItemUrl;
|
|
19987
20037
|
// Check cache
|
|
19988
20038
|
var cacheObject = this._assetUrlPool[remoteAssetBaseURL];
|
|
19989
20039
|
if (cacheObject) {
|
|
@@ -20022,10 +20072,7 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
20022
20072
|
if (queryPath) {
|
|
20023
20073
|
// Check whether load main asset
|
|
20024
20074
|
var mainPromise = loadingPromises[remoteAssetBaseURL] || this._loadSubpackageAndMainAsset(loader, item, remoteAssetBaseURL, subpackageName);
|
|
20025
|
-
|
|
20026
|
-
_this._onSubAssetFail(remoteAssetBaseURL, queryPath, e);
|
|
20027
|
-
});
|
|
20028
|
-
return this._createSubAssetPromiseCallback(remoteAssetBaseURL, remoteAssetURL, queryPath);
|
|
20075
|
+
return this._createSubAssetPromiseCallback(remoteAssetBaseURL, remoteAssetURL, queryPath, mainPromise);
|
|
20029
20076
|
}
|
|
20030
20077
|
return this._loadSubpackageAndMainAsset(loader, item, remoteAssetBaseURL, subpackageName);
|
|
20031
20078
|
};
|
|
@@ -20050,30 +20097,33 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
20050
20097
|
});
|
|
20051
20098
|
return promise;
|
|
20052
20099
|
};
|
|
20053
|
-
_proto._createSubAssetPromiseCallback = function _createSubAssetPromiseCallback(remoteAssetBaseURL, remoteAssetURL, assetSubPath) {
|
|
20100
|
+
_proto._createSubAssetPromiseCallback = function _createSubAssetPromiseCallback(remoteAssetBaseURL, remoteAssetURL, assetSubPath, mainPromise) {
|
|
20054
20101
|
var _this = this;
|
|
20055
20102
|
var _this__subAssetPromiseCallbacks_remoteAssetBaseURL;
|
|
20056
20103
|
var loadingPromises = this._loadingPromises;
|
|
20057
20104
|
var subPromiseCallback = (_this__subAssetPromiseCallbacks_remoteAssetBaseURL = this._subAssetPromiseCallbacks[remoteAssetBaseURL]) == null ? void 0 : _this__subAssetPromiseCallbacks_remoteAssetBaseURL[assetSubPath];
|
|
20058
20105
|
var resolvedValue = subPromiseCallback == null ? void 0 : subPromiseCallback.resolvedValue;
|
|
20059
|
-
|
|
20060
|
-
|
|
20061
|
-
|
|
20062
|
-
return new AssetPromise(function(resolve, reject) {
|
|
20063
|
-
if (resolvedValue) {
|
|
20064
|
-
resolve(resolvedValue);
|
|
20065
|
-
} else if (rejectedValue) {
|
|
20066
|
-
reject(rejectedValue);
|
|
20067
|
-
}
|
|
20068
|
-
});
|
|
20106
|
+
// Already resolved
|
|
20107
|
+
if (resolvedValue) {
|
|
20108
|
+
return AssetPromise.resolve(resolvedValue);
|
|
20069
20109
|
}
|
|
20070
20110
|
// Pending
|
|
20071
|
-
var promise = new AssetPromise(function(resolve, reject) {
|
|
20111
|
+
var promise = new AssetPromise(function(resolve, reject, setTaskCompleteProgress, setTaskDetailProgress) {
|
|
20072
20112
|
var _this__subAssetPromiseCallbacks, _remoteAssetBaseURL;
|
|
20073
20113
|
((_this__subAssetPromiseCallbacks = _this._subAssetPromiseCallbacks)[_remoteAssetBaseURL = remoteAssetBaseURL] || (_this__subAssetPromiseCallbacks[_remoteAssetBaseURL] = {}))[assetSubPath] = {
|
|
20074
20114
|
resolve: resolve,
|
|
20075
20115
|
reject: reject
|
|
20076
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);
|
|
20077
20127
|
});
|
|
20078
20128
|
loadingPromises[remoteAssetURL] = promise;
|
|
20079
20129
|
promise.then(function() {
|
|
@@ -20097,7 +20147,10 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
20097
20147
|
if (paths) {
|
|
20098
20148
|
for(var i = 0, n = paths.length; i < n; i++){
|
|
20099
20149
|
var path = paths[i];
|
|
20100
|
-
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
|
+
}
|
|
20101
20154
|
}
|
|
20102
20155
|
}
|
|
20103
20156
|
return subResource;
|
|
@@ -20143,6 +20196,16 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
20143
20196
|
delete this._subAssetPromiseCallbacks[assetBaseURL];
|
|
20144
20197
|
};
|
|
20145
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
|
+
/**
|
|
20146
20209
|
* @internal
|
|
20147
20210
|
* @beta Just for internal editor, not recommended for developers.
|
|
20148
20211
|
*/ _proto.getResourceByRef = function getResourceByRef(ref) {
|
|
@@ -20171,18 +20234,6 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
20171
20234
|
};
|
|
20172
20235
|
/**
|
|
20173
20236
|
* @internal
|
|
20174
|
-
* @beta Just for internal editor, not recommended for developers.
|
|
20175
|
-
*/ _proto.initVirtualResources = function initVirtualResources(config) {
|
|
20176
|
-
var _this = this;
|
|
20177
|
-
config.forEach(function(element) {
|
|
20178
|
-
_this._virtualPathResourceMap[element.virtualPath] = element;
|
|
20179
|
-
if (element.dependentAssetMap) {
|
|
20180
|
-
_this._virtualPathResourceMap[element.virtualPath].dependentAssetMap = element.dependentAssetMap;
|
|
20181
|
-
}
|
|
20182
|
-
});
|
|
20183
|
-
};
|
|
20184
|
-
/**
|
|
20185
|
-
* @internal
|
|
20186
20237
|
*/ ResourceManager._addLoader = function _addLoader(type, loader, extNames) {
|
|
20187
20238
|
this._loaders[type] = loader;
|
|
20188
20239
|
for(var i = 0, len = extNames.length; i < len; i++){
|
|
@@ -20757,8 +20808,8 @@ exports.Collider = /*#__PURE__*/ function(Component) {
|
|
|
20757
20808
|
if (oldCollider) {
|
|
20758
20809
|
oldCollider.removeShape(shape);
|
|
20759
20810
|
}
|
|
20760
|
-
this._shapes.push(shape);
|
|
20761
20811
|
this._addNativeShape(shape);
|
|
20812
|
+
this._shapes.push(shape);
|
|
20762
20813
|
this._handleShapesChanged(ColliderShapeChangeFlag.Count);
|
|
20763
20814
|
}
|
|
20764
20815
|
};
|
|
@@ -20821,8 +20872,8 @@ exports.Collider = /*#__PURE__*/ function(Component) {
|
|
|
20821
20872
|
this.scene.physics._removeCollider(this);
|
|
20822
20873
|
};
|
|
20823
20874
|
/**
|
|
20824
|
-
* @
|
|
20825
|
-
*/ _proto.
|
|
20875
|
+
* @inheritdoc
|
|
20876
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
20826
20877
|
target._syncNative();
|
|
20827
20878
|
target._pendingReenterTeleport = true;
|
|
20828
20879
|
};
|
|
@@ -20833,6 +20884,20 @@ exports.Collider = /*#__PURE__*/ function(Component) {
|
|
|
20833
20884
|
this._setCollisionLayer();
|
|
20834
20885
|
}
|
|
20835
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
|
+
};
|
|
20836
20901
|
_proto._syncNative = function _syncNative() {
|
|
20837
20902
|
for(var i = 0, n = this.shapes.length; i < n; i++){
|
|
20838
20903
|
this._addNativeShape(this.shapes[i]);
|
|
@@ -20875,24 +20940,13 @@ exports.Collider = /*#__PURE__*/ function(Component) {
|
|
|
20875
20940
|
this._nativeCollider.destroy();
|
|
20876
20941
|
};
|
|
20877
20942
|
_proto._addNativeShape = function _addNativeShape(shape) {
|
|
20943
|
+
this._setNativeShapeAttached(shape, true);
|
|
20878
20944
|
shape._collider = this;
|
|
20879
|
-
this._attachNativeShape(shape);
|
|
20880
20945
|
};
|
|
20881
20946
|
_proto._removeNativeShape = function _removeNativeShape(shape) {
|
|
20882
|
-
this.
|
|
20947
|
+
this._setNativeShapeAttached(shape, false);
|
|
20883
20948
|
shape._collider = null;
|
|
20884
20949
|
};
|
|
20885
|
-
/** @internal */ _proto._attachNativeShape = function _attachNativeShape(shape) {
|
|
20886
|
-
if (shape._nativeShape && !shape._isShapeAttached) {
|
|
20887
|
-
shape._nativeShape.setWorldScale(this.entity.transform.lossyWorldScale);
|
|
20888
|
-
shape._attachToCollider();
|
|
20889
|
-
}
|
|
20890
|
-
};
|
|
20891
|
-
/** @internal */ _proto._detachNativeShape = function _detachNativeShape(shape) {
|
|
20892
|
-
if (shape._nativeShape && shape._isShapeAttached) {
|
|
20893
|
-
shape._detachFromCollider();
|
|
20894
|
-
}
|
|
20895
|
-
};
|
|
20896
20950
|
_proto._setCollisionLayer = function _setCollisionLayer() {
|
|
20897
20951
|
this._nativeCollider.setCollisionLayer(this._collisionLayerIndex);
|
|
20898
20952
|
};
|
|
@@ -21138,7 +21192,7 @@ __decorate([
|
|
|
21138
21192
|
};
|
|
21139
21193
|
/**
|
|
21140
21194
|
* @internal
|
|
21141
|
-
*/ _proto.
|
|
21195
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
21142
21196
|
target._syncNative();
|
|
21143
21197
|
};
|
|
21144
21198
|
/**
|
|
@@ -21273,8 +21327,8 @@ __decorate([
|
|
|
21273
21327
|
return Math.sqrt(distance);
|
|
21274
21328
|
};
|
|
21275
21329
|
/**
|
|
21276
|
-
* @
|
|
21277
|
-
*/ _proto.
|
|
21330
|
+
* @inheritdoc
|
|
21331
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
21278
21332
|
target._syncNative();
|
|
21279
21333
|
};
|
|
21280
21334
|
/**
|
|
@@ -21286,18 +21340,6 @@ __decorate([
|
|
|
21286
21340
|
}
|
|
21287
21341
|
delete Engine._physicalObjectsMap[this._id];
|
|
21288
21342
|
};
|
|
21289
|
-
/**
|
|
21290
|
-
* @internal
|
|
21291
|
-
*/ _proto._attachToCollider = function _attachToCollider() {
|
|
21292
|
-
this._collider._nativeCollider.addShape(this._nativeShape);
|
|
21293
|
-
this._isShapeAttached = true;
|
|
21294
|
-
};
|
|
21295
|
-
/**
|
|
21296
|
-
* @internal
|
|
21297
|
-
*/ _proto._detachFromCollider = function _detachFromCollider() {
|
|
21298
|
-
this._collider._nativeCollider.removeShape(this._nativeShape);
|
|
21299
|
-
this._isShapeAttached = false;
|
|
21300
|
-
};
|
|
21301
21343
|
_proto._syncNative = function _syncNative() {
|
|
21302
21344
|
var _this__collider;
|
|
21303
21345
|
if (!this._nativeShape) return;
|
|
@@ -21419,6 +21461,9 @@ __decorate([
|
|
|
21419
21461
|
return ColliderShape;
|
|
21420
21462
|
}(DataObject);
|
|
21421
21463
|
ColliderShape._idGenerator = 0;
|
|
21464
|
+
__decorate([
|
|
21465
|
+
ignoreClone
|
|
21466
|
+
], ColliderShape.prototype, "_collider", void 0);
|
|
21422
21467
|
__decorate([
|
|
21423
21468
|
ignoreClone
|
|
21424
21469
|
], ColliderShape.prototype, "_isShapeAttached", void 0);
|
|
@@ -21455,10 +21500,10 @@ __decorate([
|
|
|
21455
21500
|
return ColliderShape.prototype.getClosestPoint.call(this, point, outClosestPoint);
|
|
21456
21501
|
};
|
|
21457
21502
|
/**
|
|
21458
|
-
* @
|
|
21459
|
-
*/ _proto.
|
|
21503
|
+
* @inheritdoc
|
|
21504
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
21460
21505
|
target.mesh = this._mesh;
|
|
21461
|
-
ColliderShape.prototype.
|
|
21506
|
+
ColliderShape.prototype._onClone.call(this, target);
|
|
21462
21507
|
};
|
|
21463
21508
|
/**
|
|
21464
21509
|
* @internal
|
|
@@ -21477,7 +21522,7 @@ __decorate([
|
|
|
21477
21522
|
_proto._destroyNativeShape = function _destroyNativeShape() {
|
|
21478
21523
|
if (this._nativeShape) {
|
|
21479
21524
|
var _this__collider;
|
|
21480
|
-
(_this__collider = this._collider) == null ? void 0 : _this__collider.
|
|
21525
|
+
(_this__collider = this._collider) == null ? void 0 : _this__collider._setNativeShapeAttached(this, false);
|
|
21481
21526
|
this._nativeShape.destroy();
|
|
21482
21527
|
this._nativeShape = null;
|
|
21483
21528
|
}
|
|
@@ -21505,17 +21550,17 @@ __decorate([
|
|
|
21505
21550
|
return true;
|
|
21506
21551
|
};
|
|
21507
21552
|
_proto._updateNativeShapeData = function _updateNativeShapeData() {
|
|
21508
|
-
|
|
21553
|
+
var succeeded = this._nativeShape.setMeshData(this._positions, this._indices, this._isConvex, this._cookingFlags);
|
|
21554
|
+
if (succeeded) {
|
|
21509
21555
|
var _this__collider;
|
|
21510
|
-
(_this__collider = this._collider) == null ? void 0 : _this__collider.
|
|
21511
|
-
return true;
|
|
21556
|
+
(_this__collider = this._collider) == null ? void 0 : _this__collider._setNativeShapeAttached(this, true);
|
|
21512
21557
|
}
|
|
21513
|
-
return
|
|
21558
|
+
return succeeded;
|
|
21514
21559
|
};
|
|
21515
|
-
_proto._createNativeShape = function _createNativeShape(
|
|
21516
|
-
|
|
21560
|
+
_proto._createNativeShape = function _createNativeShape() {
|
|
21561
|
+
var _this__collider;
|
|
21517
21562
|
// Non-convex MeshColliderShape is only supported on StaticCollider or kinematic DynamicCollider
|
|
21518
|
-
if (
|
|
21563
|
+
if (!this._isConvex && _instanceof(this._collider, DynamicCollider) && !this._collider.isKinematic) {
|
|
21519
21564
|
console.error("MeshColliderShape: Non-convex mesh is not supported on non-kinematic DynamicCollider.");
|
|
21520
21565
|
return false;
|
|
21521
21566
|
}
|
|
@@ -21526,10 +21571,7 @@ __decorate([
|
|
|
21526
21571
|
this._nativeShape = nativeShape;
|
|
21527
21572
|
// Sync base class properties (position, rotation, contactOffset, isTrigger, material)
|
|
21528
21573
|
ColliderShape.prototype._syncNative.call(this);
|
|
21529
|
-
|
|
21530
|
-
if (attachToCollider && this._collider) {
|
|
21531
|
-
this._collider._attachNativeShape(this);
|
|
21532
|
-
}
|
|
21574
|
+
(_this__collider = this._collider) == null ? void 0 : _this__collider._setNativeShapeAttached(this, true);
|
|
21533
21575
|
return true;
|
|
21534
21576
|
};
|
|
21535
21577
|
_create_class(MeshColliderShape, [
|
|
@@ -21760,8 +21802,8 @@ __decorate([
|
|
|
21760
21802
|
this._updateFlag.flag = false;
|
|
21761
21803
|
};
|
|
21762
21804
|
/**
|
|
21763
|
-
* @
|
|
21764
|
-
*/ _proto.
|
|
21805
|
+
* @inheritdoc
|
|
21806
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
21765
21807
|
target._linearVelocity.copyFrom(this.linearVelocity);
|
|
21766
21808
|
target._angularVelocity.copyFrom(this.angularVelocity);
|
|
21767
21809
|
if (!this._automaticCenterOfMass) {
|
|
@@ -21770,8 +21812,7 @@ __decorate([
|
|
|
21770
21812
|
if (!this._automaticInertiaTensor) {
|
|
21771
21813
|
target._inertiaTensor.copyFrom(this.inertiaTensor);
|
|
21772
21814
|
}
|
|
21773
|
-
|
|
21774
|
-
Collider.prototype._cloneTo.call(this, target);
|
|
21815
|
+
Collider.prototype._onClone.call(this, target);
|
|
21775
21816
|
};
|
|
21776
21817
|
/**
|
|
21777
21818
|
* @internal
|
|
@@ -21782,6 +21823,8 @@ __decorate([
|
|
|
21782
21823
|
}
|
|
21783
21824
|
};
|
|
21784
21825
|
_proto._syncNative = function _syncNative() {
|
|
21826
|
+
// Non-convex triangle meshes require a kinematic native actor before attachment
|
|
21827
|
+
this._nativeCollider.setIsKinematic(this._isKinematic);
|
|
21785
21828
|
Collider.prototype._syncNative.call(this);
|
|
21786
21829
|
this._nativeCollider.setLinearDamping(this._linearDamping);
|
|
21787
21830
|
this._nativeCollider.setAngularDamping(this._angularDamping);
|
|
@@ -21801,7 +21844,6 @@ __decorate([
|
|
|
21801
21844
|
}
|
|
21802
21845
|
this._nativeCollider.setSolverIterations(this._solverIterations);
|
|
21803
21846
|
this._nativeCollider.setUseGravity(this._useGravity);
|
|
21804
|
-
this._nativeCollider.setIsKinematic(this._isKinematic);
|
|
21805
21847
|
this._nativeCollider.setConstraints(this._constraints);
|
|
21806
21848
|
this._nativeCollider.setCollisionDetectionMode(this._collisionDetectionMode);
|
|
21807
21849
|
};
|
|
@@ -30998,7 +31040,7 @@ Scene._prefilterdDFGProperty = ShaderProperty.getByName("scene_PrefilteredDFG");
|
|
|
30998
31040
|
_inherits(Signal, DataObject);
|
|
30999
31041
|
function Signal() {
|
|
31000
31042
|
var _this;
|
|
31001
|
-
_this = DataObject.apply(this, arguments) || this, // Rebuilt by `
|
|
31043
|
+
_this = DataObject.apply(this, arguments) || this, // Rebuilt by `_onClone`; must survive even a propagated @deepClone.
|
|
31002
31044
|
_this._listeners = new SafeLoopArray();
|
|
31003
31045
|
return _this;
|
|
31004
31046
|
}
|
|
@@ -31091,8 +31133,8 @@ Scene._prefilterdDFGProperty = ShaderProperty.getByName("scene_PrefilteredDFG");
|
|
|
31091
31133
|
for(var i = 0, n = listeners.length; i < n; i++)_this = this, _loop(i);
|
|
31092
31134
|
};
|
|
31093
31135
|
/**
|
|
31094
|
-
* @
|
|
31095
|
-
*/ _proto.
|
|
31136
|
+
* @inheritdoc
|
|
31137
|
+
*/ _proto._onClone = function _onClone(target, cloneMap) {
|
|
31096
31138
|
var listeners = this._listeners.getLoopArray();
|
|
31097
31139
|
for(var i = 0, n = listeners.length; i < n; i++){
|
|
31098
31140
|
var listener = listeners[i];
|
|
@@ -33399,8 +33441,8 @@ var AnimatorLayerBlendingMode = /*#__PURE__*/ function(AnimatorLayerBlendingMode
|
|
|
33399
33441
|
}
|
|
33400
33442
|
};
|
|
33401
33443
|
/**
|
|
33402
|
-
* @
|
|
33403
|
-
*/ _proto.
|
|
33444
|
+
* @inheritdoc
|
|
33445
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
33404
33446
|
var animatorController = target._animatorController;
|
|
33405
33447
|
if (animatorController) {
|
|
33406
33448
|
target._controllerUpdateFlag = animatorController._registerChangeFlag();
|
|
@@ -35469,9 +35511,9 @@ var ParticleStopMode = /*#__PURE__*/ function(ParticleStopMode) {
|
|
|
35469
35511
|
this.generator._destroy();
|
|
35470
35512
|
};
|
|
35471
35513
|
/**
|
|
35472
|
-
* @
|
|
35473
|
-
*/ _proto.
|
|
35474
|
-
Renderer.prototype.
|
|
35514
|
+
* @inheritdoc
|
|
35515
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
35516
|
+
Renderer.prototype._onClone.call(this, target);
|
|
35475
35517
|
target.mesh = this._mesh;
|
|
35476
35518
|
target.renderMode = this._renderMode;
|
|
35477
35519
|
};
|
|
@@ -36892,6 +36934,11 @@ CustomDataModule._zeroVector4 = new engineMath.Vector4(0, 0, 0, 0);
|
|
|
36892
36934
|
};
|
|
36893
36935
|
/**
|
|
36894
36936
|
* @internal
|
|
36937
|
+
*/ _proto._isRandomCurveMode = function _isRandomCurveMode() {
|
|
36938
|
+
return this._mode === ParticleCurveMode.TwoCurves;
|
|
36939
|
+
};
|
|
36940
|
+
/**
|
|
36941
|
+
* @internal
|
|
36895
36942
|
*/ _proto._registerOnValueChanged = function _registerOnValueChanged(listener) {
|
|
36896
36943
|
this._updateManager.addListener(listener);
|
|
36897
36944
|
};
|
|
@@ -37946,8 +37993,8 @@ var MainModule = /*#__PURE__*/ function(DataObject) {
|
|
|
37946
37993
|
shaderData.setInt(MainModule._scaleMode, this.scalingMode);
|
|
37947
37994
|
};
|
|
37948
37995
|
/**
|
|
37949
|
-
* @
|
|
37950
|
-
*/ _proto.
|
|
37996
|
+
* @inheritdoc
|
|
37997
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
37951
37998
|
if (target._simulationSpace === ParticleSimulationSpace.World) {
|
|
37952
37999
|
target._generator._generateTransformedBounds();
|
|
37953
38000
|
}
|
|
@@ -38454,7 +38501,7 @@ __decorate([
|
|
|
38454
38501
|
_inherits(SizeOverLifetimeModule, ParticleGeneratorModule);
|
|
38455
38502
|
function SizeOverLifetimeModule(generator) {
|
|
38456
38503
|
var _this;
|
|
38457
|
-
_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;
|
|
38458
38505
|
_this.sizeX = new ParticleCompositeCurve(new ParticleCurve(new CurveKey(0, 0), new CurveKey(1, 1)));
|
|
38459
38506
|
_this.sizeY = new ParticleCompositeCurve(new ParticleCurve(new CurveKey(0, 0), new CurveKey(1, 1)));
|
|
38460
38507
|
_this.sizeZ = new ParticleCompositeCurve(new ParticleCurve(new CurveKey(0, 0), new CurveKey(1, 1)));
|
|
@@ -38472,8 +38519,8 @@ __decorate([
|
|
|
38472
38519
|
var sizeY = this.sizeY;
|
|
38473
38520
|
var sizeZ = this.sizeZ;
|
|
38474
38521
|
var separateAxes = this.separateAxes;
|
|
38475
|
-
var isRandomCurveMode =
|
|
38476
|
-
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);
|
|
38477
38524
|
if (isCurveMode) {
|
|
38478
38525
|
shaderData.setFloatArray(SizeOverLifetimeModule._maxCurveXProperty, sizeX.curveMax._getTypeArray());
|
|
38479
38526
|
if (separateAxes) {
|
|
@@ -38498,6 +38545,17 @@ __decorate([
|
|
|
38498
38545
|
this._isCurveMacro = this._enableMacro(shaderData, this._isCurveMacro, isCurveMacro);
|
|
38499
38546
|
this._isRandomTwoMacro = this._enableMacro(shaderData, this._isRandomTwoMacro, isRandomTwoMacro);
|
|
38500
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
|
+
};
|
|
38501
38559
|
_create_class(SizeOverLifetimeModule, [
|
|
38502
38560
|
{
|
|
38503
38561
|
key: "separateAxes",
|
|
@@ -38581,6 +38639,9 @@ SizeOverLifetimeModule._minCurveZProperty = ShaderProperty.getByName("renderer_S
|
|
|
38581
38639
|
SizeOverLifetimeModule._maxCurveXProperty = ShaderProperty.getByName("renderer_SOLMaxCurveX");
|
|
38582
38640
|
SizeOverLifetimeModule._maxCurveYProperty = ShaderProperty.getByName("renderer_SOLMaxCurveY");
|
|
38583
38641
|
SizeOverLifetimeModule._maxCurveZProperty = ShaderProperty.getByName("renderer_SOLMaxCurveZ");
|
|
38642
|
+
__decorate([
|
|
38643
|
+
ignoreClone
|
|
38644
|
+
], SizeOverLifetimeModule.prototype, "_sizeRand", void 0);
|
|
38584
38645
|
__decorate([
|
|
38585
38646
|
ignoreClone
|
|
38586
38647
|
], SizeOverLifetimeModule.prototype, "_enableSeparateMacro", void 0);
|
|
@@ -39883,6 +39944,7 @@ __decorate([
|
|
|
39883
39944
|
this.velocityOverLifetime._resetRandomSeed(seed);
|
|
39884
39945
|
this.forceOverLifetime._resetRandomSeed(seed);
|
|
39885
39946
|
this.limitVelocityOverLifetime._resetRandomSeed(seed);
|
|
39947
|
+
this.sizeOverLifetime._resetRandomSeed(seed);
|
|
39886
39948
|
this.rotationOverLifetime._resetRandomSeed(seed);
|
|
39887
39949
|
this.colorOverLifetime._resetRandomSeed(seed);
|
|
39888
39950
|
this.noise._resetRandomSeed(seed);
|
|
@@ -39944,8 +40006,8 @@ __decorate([
|
|
|
39944
40006
|
}
|
|
39945
40007
|
};
|
|
39946
40008
|
/**
|
|
39947
|
-
* @
|
|
39948
|
-
*/ _proto.
|
|
40009
|
+
* @inheritdoc
|
|
40010
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
39949
40011
|
target._setTransformFeedback();
|
|
39950
40012
|
};
|
|
39951
40013
|
/**
|
|
@@ -40140,8 +40202,13 @@ __decorate([
|
|
|
40140
40202
|
if (colorOverLifetime.enabled && colorOverLifetime.color.mode === ParticleGradientMode.TwoGradients) {
|
|
40141
40203
|
instanceVertices[offset + 20] = colorOverLifetime._colorGradientRand.random();
|
|
40142
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;
|
|
40143
40208
|
if (this.noise.enabled) {
|
|
40144
40209
|
instanceVertices[offset + 21] = this.noise._noiseRand.random();
|
|
40210
|
+
} else if (sizeOverLifetime.enabled && sizeOverLifetime._isRandomCurveMode()) {
|
|
40211
|
+
instanceVertices[offset + 21] = sizeOverLifetime._sizeRand.random();
|
|
40145
40212
|
}
|
|
40146
40213
|
var rotationOverLifetime = this.rotationOverLifetime;
|
|
40147
40214
|
if (rotationOverLifetime.enabled && rotationOverLifetime.rotationZ.mode === ParticleCurveMode.TwoConstants) {
|
|
@@ -41700,8 +41767,8 @@ __decorate([
|
|
|
41700
41767
|
}
|
|
41701
41768
|
};
|
|
41702
41769
|
/**
|
|
41703
|
-
* @
|
|
41704
|
-
*/ _proto.
|
|
41770
|
+
* @inheritdoc
|
|
41771
|
+
*/ _proto._onClone = function _onClone(target) {
|
|
41705
41772
|
target.mesh = this._mesh;
|
|
41706
41773
|
};
|
|
41707
41774
|
_create_class(MeshShape, [
|