@galacean/engine-core 2.0.0-alpha.14 → 2.0.0-alpha.16
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 +1229 -1071
- package/dist/main.js.map +1 -1
- package/dist/module.js +1228 -1072
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/Renderer.d.ts +1 -2
- package/types/Signal.d.ts +58 -0
- package/types/clone/CloneUtils.d.ts +1 -0
- package/types/clone/ComponentCloner.d.ts +0 -2
- package/types/index.d.ts +2 -0
- package/types/mesh/Skin.d.ts +1 -2
package/dist/module.js
CHANGED
|
@@ -216,74 +216,69 @@ function _instanceof(left, right) {
|
|
|
216
216
|
return cloneModes;
|
|
217
217
|
};
|
|
218
218
|
CloneManager.cloneProperty = function cloneProperty(source, target, k, cloneMode, srcRoot, targetRoot, deepInstanceMap) {
|
|
219
|
-
|
|
219
|
+
var sourceProperty = source[k];
|
|
220
|
+
// Remappable references (Entity/Component) are always remapped, regardless of clone decorator
|
|
221
|
+
if (_instanceof(sourceProperty, Object) && sourceProperty._remap) {
|
|
222
|
+
target[k] = sourceProperty._remap(srcRoot, targetRoot);
|
|
220
223
|
return;
|
|
221
224
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
225
|
+
if (cloneMode === CloneMode.Ignore) return;
|
|
226
|
+
// Primitives, undecorated, or @assignmentClone: direct assign
|
|
227
|
+
if (!_instanceof(sourceProperty, Object) || cloneMode === undefined || cloneMode === CloneMode.Assignment) {
|
|
228
|
+
target[k] = sourceProperty;
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
// @shallowClone / @deepClone: deep copy complex objects
|
|
232
|
+
var type = sourceProperty.constructor;
|
|
233
|
+
switch(type){
|
|
234
|
+
case Uint8Array:
|
|
235
|
+
case Uint16Array:
|
|
236
|
+
case Uint32Array:
|
|
237
|
+
case Int8Array:
|
|
238
|
+
case Int16Array:
|
|
239
|
+
case Int32Array:
|
|
240
|
+
case Float32Array:
|
|
241
|
+
case Float64Array:
|
|
242
|
+
var targetPropertyT = target[k];
|
|
243
|
+
if (targetPropertyT == null || targetPropertyT.length !== sourceProperty.length) {
|
|
244
|
+
target[k] = sourceProperty.slice();
|
|
245
|
+
} else {
|
|
246
|
+
targetPropertyT.set(sourceProperty);
|
|
247
|
+
}
|
|
248
|
+
break;
|
|
249
|
+
case Array:
|
|
250
|
+
var targetPropertyA = target[k];
|
|
251
|
+
var length = sourceProperty.length;
|
|
252
|
+
if (targetPropertyA == null) {
|
|
253
|
+
target[k] = targetPropertyA = new Array(length);
|
|
254
|
+
} else {
|
|
255
|
+
targetPropertyA.length = length;
|
|
256
|
+
}
|
|
257
|
+
for(var i = 0; i < length; i++){
|
|
258
|
+
CloneManager.cloneProperty(sourceProperty, targetPropertyA, i, cloneMode, srcRoot, targetRoot, deepInstanceMap);
|
|
259
|
+
}
|
|
260
|
+
break;
|
|
261
|
+
default:
|
|
262
|
+
var targetProperty = target[k];
|
|
263
|
+
// If the target property is undefined, create new instance and keep reference sharing like the source
|
|
264
|
+
if (!targetProperty) {
|
|
265
|
+
targetProperty = deepInstanceMap.get(sourceProperty);
|
|
260
266
|
if (!targetProperty) {
|
|
261
|
-
targetProperty =
|
|
262
|
-
|
|
263
|
-
targetProperty = new sourceProperty.constructor();
|
|
264
|
-
deepInstanceMap.set(sourceProperty, targetProperty);
|
|
265
|
-
}
|
|
266
|
-
target[k] = targetProperty;
|
|
267
|
+
targetProperty = new sourceProperty.constructor();
|
|
268
|
+
deepInstanceMap.set(sourceProperty, targetProperty);
|
|
267
269
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
-
// Custom incremental clone
|
|
278
|
-
if (sourceProperty._cloneTo) {
|
|
279
|
-
sourceProperty._cloneTo(targetProperty, srcRoot, targetRoot);
|
|
280
|
-
}
|
|
270
|
+
target[k] = targetProperty;
|
|
271
|
+
}
|
|
272
|
+
if (sourceProperty.copyFrom) {
|
|
273
|
+
targetProperty.copyFrom(sourceProperty);
|
|
274
|
+
} else {
|
|
275
|
+
var cloneModes = CloneManager.getCloneMode(sourceProperty.constructor);
|
|
276
|
+
for(var _$k in sourceProperty){
|
|
277
|
+
CloneManager.cloneProperty(sourceProperty, targetProperty, _$k, cloneModes[_$k], srcRoot, targetRoot, deepInstanceMap);
|
|
281
278
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
// null, undefined, primitive type, function
|
|
286
|
-
target[k] = sourceProperty;
|
|
279
|
+
sourceProperty._cloneTo == null ? void 0 : sourceProperty._cloneTo.call(sourceProperty, targetProperty, srcRoot, targetRoot);
|
|
280
|
+
}
|
|
281
|
+
break;
|
|
287
282
|
}
|
|
288
283
|
};
|
|
289
284
|
CloneManager.deepCloneObject = function deepCloneObject(source, target, deepInstanceMap) {
|
|
@@ -7390,6 +7385,45 @@ Sky._projectionMatrix = new Matrix(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, Sky._epsilon -
|
|
|
7390
7385
|
}();
|
|
7391
7386
|
/** @internal */ Background._premultiplySolidColor = new Color();
|
|
7392
7387
|
|
|
7388
|
+
/**
|
|
7389
|
+
* @internal
|
|
7390
|
+
* Utility functions for remapping Entity/Component references during cloning.
|
|
7391
|
+
*/ var CloneUtils = /*#__PURE__*/ function() {
|
|
7392
|
+
function CloneUtils() {}
|
|
7393
|
+
CloneUtils.remapEntity = function remapEntity(srcRoot, targetRoot, entity) {
|
|
7394
|
+
var path = CloneUtils._tempRemapPath;
|
|
7395
|
+
if (!CloneUtils._getEntityHierarchyPath(srcRoot, entity, path)) return entity;
|
|
7396
|
+
return CloneUtils._getEntityByHierarchyPath(targetRoot, path);
|
|
7397
|
+
};
|
|
7398
|
+
CloneUtils.remapComponent = function remapComponent(srcRoot, targetRoot, component) {
|
|
7399
|
+
var path = CloneUtils._tempRemapPath;
|
|
7400
|
+
var srcEntity = component.entity;
|
|
7401
|
+
if (!CloneUtils._getEntityHierarchyPath(srcRoot, srcEntity, path)) return component;
|
|
7402
|
+
return CloneUtils._getEntityByHierarchyPath(targetRoot, path)._components[srcEntity._components.indexOf(component)];
|
|
7403
|
+
};
|
|
7404
|
+
CloneUtils._getEntityHierarchyPath = function _getEntityHierarchyPath(rootEntity, searchEntity, inversePath) {
|
|
7405
|
+
inversePath.length = 0;
|
|
7406
|
+
while(searchEntity !== rootEntity){
|
|
7407
|
+
var parent = searchEntity.parent;
|
|
7408
|
+
if (!parent) {
|
|
7409
|
+
return false;
|
|
7410
|
+
}
|
|
7411
|
+
inversePath.push(searchEntity.siblingIndex);
|
|
7412
|
+
searchEntity = parent;
|
|
7413
|
+
}
|
|
7414
|
+
return true;
|
|
7415
|
+
};
|
|
7416
|
+
CloneUtils._getEntityByHierarchyPath = function _getEntityByHierarchyPath(rootEntity, inversePath) {
|
|
7417
|
+
var entity = rootEntity;
|
|
7418
|
+
for(var i = inversePath.length - 1; i >= 0; i--){
|
|
7419
|
+
entity = entity.children[inversePath[i]];
|
|
7420
|
+
}
|
|
7421
|
+
return entity;
|
|
7422
|
+
};
|
|
7423
|
+
return CloneUtils;
|
|
7424
|
+
}();
|
|
7425
|
+
CloneUtils._tempRemapPath = [];
|
|
7426
|
+
|
|
7393
7427
|
var ActiveChangeFlag = /*#__PURE__*/ function(ActiveChangeFlag) {
|
|
7394
7428
|
ActiveChangeFlag[ActiveChangeFlag["None"] = 0] = "None";
|
|
7395
7429
|
ActiveChangeFlag[ActiveChangeFlag["Scene"] = 1] = "Scene";
|
|
@@ -7465,6 +7499,11 @@ var ActiveChangeFlag = /*#__PURE__*/ function(ActiveChangeFlag) {
|
|
|
7465
7499
|
}
|
|
7466
7500
|
}
|
|
7467
7501
|
};
|
|
7502
|
+
/**
|
|
7503
|
+
* @internal
|
|
7504
|
+
*/ _proto._remap = function _remap(srcRoot, targetRoot) {
|
|
7505
|
+
return CloneUtils.remapComponent(srcRoot, targetRoot, this);
|
|
7506
|
+
};
|
|
7468
7507
|
_proto._addResourceReferCount = function _addResourceReferCount(resource, count) {
|
|
7469
7508
|
this._entity._isTemplate || resource._addReferCount(count);
|
|
7470
7509
|
};
|
|
@@ -7538,9 +7577,6 @@ var ActiveChangeFlag = /*#__PURE__*/ function(ActiveChangeFlag) {
|
|
|
7538
7577
|
]);
|
|
7539
7578
|
return Component;
|
|
7540
7579
|
}(EngineObject);
|
|
7541
|
-
__decorate([
|
|
7542
|
-
ignoreClone
|
|
7543
|
-
], Component.prototype, "_entity", void 0);
|
|
7544
7580
|
__decorate([
|
|
7545
7581
|
ignoreClone
|
|
7546
7582
|
], Component.prototype, "_awoken", void 0);
|
|
@@ -7909,7 +7945,7 @@ function dependentComponents(componentOrComponents, dependentMode) {
|
|
|
7909
7945
|
};
|
|
7910
7946
|
/**
|
|
7911
7947
|
* @internal
|
|
7912
|
-
*/ _proto._cloneTo = function _cloneTo(target
|
|
7948
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
7913
7949
|
var position = target._position, rotation = target._rotation, scale = target._scale;
|
|
7914
7950
|
// @ts-ignore
|
|
7915
7951
|
position._onValueChanged = rotation._onValueChanged = scale._onValueChanged = null;
|
|
@@ -8521,9 +8557,6 @@ __decorate([
|
|
|
8521
8557
|
__decorate([
|
|
8522
8558
|
ignoreClone
|
|
8523
8559
|
], Transform.prototype, "_isParentDirty", void 0);
|
|
8524
|
-
__decorate([
|
|
8525
|
-
ignoreClone
|
|
8526
|
-
], Transform.prototype, "_parentTransformCache", void 0);
|
|
8527
8560
|
__decorate([
|
|
8528
8561
|
ignoreClone
|
|
8529
8562
|
], Transform.prototype, "_dirtyFlag", void 0);
|
|
@@ -8993,7 +9026,7 @@ var Camera = /*#__PURE__*/ function(Component) {
|
|
|
8993
9026
|
};
|
|
8994
9027
|
/**
|
|
8995
9028
|
* @internal
|
|
8996
|
-
*/ _proto._cloneTo = function _cloneTo(target
|
|
9029
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
8997
9030
|
var _this__renderTarget;
|
|
8998
9031
|
(_this__renderTarget = this._renderTarget) == null ? void 0 : _this__renderTarget._addReferCount(1);
|
|
8999
9032
|
};
|
|
@@ -12229,9 +12262,6 @@ __decorate([
|
|
|
12229
12262
|
return ColliderShape;
|
|
12230
12263
|
}();
|
|
12231
12264
|
ColliderShape._idGenerator = 0;
|
|
12232
|
-
__decorate([
|
|
12233
|
-
ignoreClone
|
|
12234
|
-
], ColliderShape.prototype, "_collider", void 0);
|
|
12235
12265
|
__decorate([
|
|
12236
12266
|
ignoreClone
|
|
12237
12267
|
], ColliderShape.prototype, "_nativeShape", void 0);
|
|
@@ -16667,7 +16697,7 @@ var Renderer = /*#__PURE__*/ function(Component) {
|
|
|
16667
16697
|
};
|
|
16668
16698
|
/**
|
|
16669
16699
|
* @internal
|
|
16670
|
-
*/ _proto._cloneTo = function _cloneTo(target
|
|
16700
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
16671
16701
|
var materials = this._materials;
|
|
16672
16702
|
for(var i = 0, n = materials.length; i < n; i++){
|
|
16673
16703
|
target._setMaterial(i, materials[i]);
|
|
@@ -16922,9 +16952,6 @@ __decorate([
|
|
|
16922
16952
|
__decorate([
|
|
16923
16953
|
ignoreClone
|
|
16924
16954
|
], Renderer.prototype, "_bounds", void 0);
|
|
16925
|
-
__decorate([
|
|
16926
|
-
ignoreClone
|
|
16927
|
-
], Renderer.prototype, "_transformEntity", void 0);
|
|
16928
16955
|
__decorate([
|
|
16929
16956
|
deepClone
|
|
16930
16957
|
], Renderer.prototype, "_shaderData", void 0);
|
|
@@ -16984,8 +17011,8 @@ var RendererUpdateFlags = /*#__PURE__*/ function(RendererUpdateFlags) {
|
|
|
16984
17011
|
};
|
|
16985
17012
|
/**
|
|
16986
17013
|
* @internal
|
|
16987
|
-
*/ _proto._cloneTo = function _cloneTo(target
|
|
16988
|
-
Renderer.prototype._cloneTo.call(this, target
|
|
17014
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
17015
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
16989
17016
|
target.sprite = this._sprite;
|
|
16990
17017
|
};
|
|
16991
17018
|
/**
|
|
@@ -17296,8 +17323,8 @@ __decorate([
|
|
|
17296
17323
|
};
|
|
17297
17324
|
/**
|
|
17298
17325
|
* @internal
|
|
17299
|
-
*/ _proto._cloneTo = function _cloneTo(target
|
|
17300
|
-
Renderer.prototype._cloneTo.call(this, target
|
|
17326
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
17327
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
17301
17328
|
target.sprite = this._sprite;
|
|
17302
17329
|
target.drawMode = this._drawMode;
|
|
17303
17330
|
};
|
|
@@ -17720,8 +17747,8 @@ __decorate([
|
|
|
17720
17747
|
};
|
|
17721
17748
|
/**
|
|
17722
17749
|
* @internal
|
|
17723
|
-
*/ _proto._cloneTo = function _cloneTo(target
|
|
17724
|
-
Renderer.prototype._cloneTo.call(this, target
|
|
17750
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
17751
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
17725
17752
|
target.font = this._font;
|
|
17726
17753
|
target._subFont = this._subFont;
|
|
17727
17754
|
};
|
|
@@ -19423,8 +19450,8 @@ var BlendShapeFrameDirty = /*#__PURE__*/ function(BlendShapeFrameDirty) {
|
|
|
19423
19450
|
};
|
|
19424
19451
|
/**
|
|
19425
19452
|
* @internal
|
|
19426
|
-
*/ _proto._cloneTo = function _cloneTo(target
|
|
19427
|
-
Renderer.prototype._cloneTo.call(this, target
|
|
19453
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
19454
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
19428
19455
|
target.mesh = this._mesh;
|
|
19429
19456
|
};
|
|
19430
19457
|
/**
|
|
@@ -22290,227 +22317,867 @@ PrimitiveMesh._sphereSeedCells = new Float32Array([
|
|
|
22290
22317
|
PrimitiveMesh._sphereEdgeIdx = 0;
|
|
22291
22318
|
PrimitiveMesh._spherePoleIdx = 0;
|
|
22292
22319
|
|
|
22293
|
-
|
|
22294
|
-
|
|
22295
|
-
|
|
22296
|
-
|
|
22297
|
-
|
|
22298
|
-
|
|
22299
|
-
|
|
22300
|
-
|
|
22301
|
-
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
22302
|
-
} catch (_) {}
|
|
22303
|
-
return (_is_native_reflect_construct = function() {
|
|
22304
|
-
return !!result;
|
|
22305
|
-
})();
|
|
22306
|
-
}
|
|
22307
|
-
|
|
22308
|
-
function _construct(Parent, args, Class) {
|
|
22309
|
-
if (_is_native_reflect_construct()) _construct = Reflect.construct;
|
|
22310
|
-
else {
|
|
22311
|
-
_construct = function construct(Parent, args, Class) {
|
|
22312
|
-
var a = [null];
|
|
22313
|
-
a.push.apply(a, args);
|
|
22314
|
-
var Constructor = Function.bind.apply(Parent, a);
|
|
22315
|
-
var instance = new Constructor();
|
|
22316
|
-
|
|
22317
|
-
if (Class) _set_prototype_of(instance, Class.prototype);
|
|
22318
|
-
|
|
22319
|
-
return instance;
|
|
22320
|
-
};
|
|
22320
|
+
/**
|
|
22321
|
+
* Skin used for skinned mesh renderer.
|
|
22322
|
+
*/ var Skin = /*#__PURE__*/ function(EngineObject) {
|
|
22323
|
+
_inherits(Skin, EngineObject);
|
|
22324
|
+
function Skin(name) {
|
|
22325
|
+
var _this;
|
|
22326
|
+
_this = EngineObject.call(this, null) || this, _this.name = name, _this.inverseBindMatrices = new Array(), _this._updatedManager = new UpdateFlagManager(), _this._bones = new Array(), _this._updateMark = -1, _this.joints = [];
|
|
22327
|
+
return _this;
|
|
22321
22328
|
}
|
|
22322
|
-
|
|
22323
|
-
return _construct.apply(null, arguments);
|
|
22324
|
-
}
|
|
22325
|
-
|
|
22326
|
-
var ComponentCloner = /*#__PURE__*/ function() {
|
|
22327
|
-
function ComponentCloner() {}
|
|
22329
|
+
var _proto = Skin.prototype;
|
|
22328
22330
|
/**
|
|
22329
|
-
*
|
|
22330
|
-
|
|
22331
|
-
|
|
22332
|
-
|
|
22333
|
-
var cloneModes = CloneManager.getCloneMode(source.constructor);
|
|
22334
|
-
for(var k in source){
|
|
22335
|
-
CloneManager.cloneProperty(source, target, k, cloneModes[k], srcRoot, targetRoot, deepInstanceMap);
|
|
22331
|
+
* @internal
|
|
22332
|
+
*/ _proto._updateSkinMatrices = function _updateSkinMatrices(renderer) {
|
|
22333
|
+
if (this._updateMark === renderer.engine.time.frameCount) {
|
|
22334
|
+
return;
|
|
22336
22335
|
}
|
|
22337
|
-
|
|
22338
|
-
|
|
22336
|
+
var _this = this, bones = _this.bones, bindMatrices = _this.inverseBindMatrices, skinMatrices = _this._skinMatrices;
|
|
22337
|
+
var _this_rootBone;
|
|
22338
|
+
var worldToLocal = ((_this_rootBone = this.rootBone) != null ? _this_rootBone : renderer.entity).getInvModelMatrix();
|
|
22339
|
+
for(var i = bones.length - 1; i >= 0; i--){
|
|
22340
|
+
var bone = bones[i];
|
|
22341
|
+
var offset = i * 16;
|
|
22342
|
+
if (bone) {
|
|
22343
|
+
Utils._floatMatrixMultiply(bone.transform.worldMatrix, bindMatrices[i].elements, 0, skinMatrices, offset);
|
|
22344
|
+
} else {
|
|
22345
|
+
skinMatrices.set(bindMatrices[i].elements, offset);
|
|
22346
|
+
}
|
|
22347
|
+
Utils._floatMatrixMultiply(worldToLocal, skinMatrices, offset, skinMatrices, offset);
|
|
22339
22348
|
}
|
|
22349
|
+
this._updateMark = renderer.engine.time.frameCount;
|
|
22340
22350
|
};
|
|
22341
|
-
|
|
22342
|
-
|
|
22343
|
-
|
|
22344
|
-
/**
|
|
22345
|
-
|
|
22346
|
-
|
|
22347
|
-
|
|
22348
|
-
|
|
22349
|
-
|
|
22351
|
+
_create_class(Skin, [
|
|
22352
|
+
{
|
|
22353
|
+
key: "rootBone",
|
|
22354
|
+
get: /**
|
|
22355
|
+
* Root bone.
|
|
22356
|
+
*/ function get() {
|
|
22357
|
+
return this._rootBone;
|
|
22358
|
+
},
|
|
22359
|
+
set: function set(value) {
|
|
22360
|
+
if (this._rootBone !== value) {
|
|
22361
|
+
this._updatedManager.dispatch(1, value);
|
|
22362
|
+
this._rootBone = value;
|
|
22363
|
+
}
|
|
22364
|
+
}
|
|
22365
|
+
},
|
|
22366
|
+
{
|
|
22367
|
+
key: "bones",
|
|
22368
|
+
get: /**
|
|
22369
|
+
* Bones of the skin.
|
|
22370
|
+
*/ function get() {
|
|
22371
|
+
return this._bones;
|
|
22372
|
+
},
|
|
22373
|
+
set: function set(value) {
|
|
22374
|
+
var bones = this._bones;
|
|
22375
|
+
var _value_length;
|
|
22376
|
+
var boneCount = (_value_length = value == null ? void 0 : value.length) != null ? _value_length : 0;
|
|
22377
|
+
var lastBoneCount = bones.length;
|
|
22378
|
+
bones.length = boneCount;
|
|
22379
|
+
for(var i = 0; i < boneCount; i++){
|
|
22380
|
+
bones[i] = value[i];
|
|
22381
|
+
}
|
|
22382
|
+
if (lastBoneCount !== boneCount) {
|
|
22383
|
+
this._skinMatrices = new Float32Array(boneCount * 16);
|
|
22384
|
+
this._updatedManager.dispatch(0, boneCount);
|
|
22385
|
+
}
|
|
22386
|
+
}
|
|
22387
|
+
},
|
|
22388
|
+
{
|
|
22389
|
+
key: "skeleton",
|
|
22390
|
+
get: /** @deprecated Please use `rootBone` instead. */ function get() {
|
|
22391
|
+
var _this_rootBone;
|
|
22392
|
+
return (_this_rootBone = this.rootBone) == null ? void 0 : _this_rootBone.name;
|
|
22393
|
+
},
|
|
22394
|
+
set: function set(value) {
|
|
22395
|
+
var rootBone = this._rootBone;
|
|
22396
|
+
if (rootBone) {
|
|
22397
|
+
rootBone.name = value;
|
|
22398
|
+
}
|
|
22399
|
+
}
|
|
22400
|
+
}
|
|
22401
|
+
]);
|
|
22402
|
+
return Skin;
|
|
22403
|
+
}(EngineObject);
|
|
22404
|
+
__decorate([
|
|
22405
|
+
deepClone
|
|
22406
|
+
], Skin.prototype, "inverseBindMatrices", void 0);
|
|
22407
|
+
__decorate([
|
|
22408
|
+
ignoreClone
|
|
22409
|
+
], Skin.prototype, "_skinMatrices", void 0);
|
|
22410
|
+
__decorate([
|
|
22411
|
+
ignoreClone
|
|
22412
|
+
], Skin.prototype, "_updatedManager", void 0);
|
|
22413
|
+
__decorate([
|
|
22414
|
+
deepClone
|
|
22415
|
+
], Skin.prototype, "_bones", void 0);
|
|
22416
|
+
__decorate([
|
|
22417
|
+
ignoreClone
|
|
22418
|
+
], Skin.prototype, "_updateMark", void 0);
|
|
22419
|
+
var SkinUpdateFlag = /*#__PURE__*/ function(SkinUpdateFlag) {
|
|
22420
|
+
SkinUpdateFlag[SkinUpdateFlag["BoneCountChanged"] = 0] = "BoneCountChanged";
|
|
22421
|
+
SkinUpdateFlag[SkinUpdateFlag["RootBoneChanged"] = 1] = "RootBoneChanged";
|
|
22422
|
+
return SkinUpdateFlag;
|
|
22350
22423
|
}({});
|
|
22351
22424
|
|
|
22352
22425
|
/**
|
|
22353
|
-
*
|
|
22354
|
-
*/ var
|
|
22355
|
-
_inherits(
|
|
22356
|
-
function
|
|
22357
|
-
for(var _len = arguments.length, components = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
|
|
22358
|
-
components[_key - 2] = arguments[_key];
|
|
22359
|
-
}
|
|
22426
|
+
* SkinnedMeshRenderer.
|
|
22427
|
+
*/ var SkinnedMeshRenderer = /*#__PURE__*/ function(MeshRenderer) {
|
|
22428
|
+
_inherits(SkinnedMeshRenderer, MeshRenderer);
|
|
22429
|
+
function SkinnedMeshRenderer(entity) {
|
|
22360
22430
|
var _this;
|
|
22361
|
-
_this =
|
|
22362
|
-
_this.
|
|
22363
|
-
|
|
22364
|
-
|
|
22365
|
-
|
|
22366
|
-
|
|
22367
|
-
|
|
22368
|
-
|
|
22431
|
+
_this = MeshRenderer.call(this, entity) || this, _this._localBounds = new BoundingBox(), _this._jointDataCreateCache = new Vector2(-1, -1);
|
|
22432
|
+
_this._skin = null;
|
|
22433
|
+
var rhi = _this.entity.engine._hardwareRenderer;
|
|
22434
|
+
var maxVertexUniformVectors = rhi.renderStates.getParameter(rhi.gl.MAX_VERTEX_UNIFORM_VECTORS);
|
|
22435
|
+
// Limit size to 256 to avoid some problem:
|
|
22436
|
+
// For renderer is "Apple GPU", when uniform is large than 256 the skeleton matrix array access in shader very slow in Safari or WKWebview. This may be a apple bug, Chrome and Firefox is OK!
|
|
22437
|
+
// For renderer is "ANGLE (AMD, AMD Radeon(TM) Graphics Direct3011 vs_5_0 ps_5_0, D3011)", compile shader si very slow because of max uniform is 4096.
|
|
22438
|
+
maxVertexUniformVectors = Math.min(maxVertexUniformVectors, rhi._options._maxAllowSkinUniformVectorCount);
|
|
22439
|
+
_this._maxVertexUniformVectors = maxVertexUniformVectors;
|
|
22440
|
+
_this._onLocalBoundsChanged = _this._onLocalBoundsChanged.bind(_this);
|
|
22441
|
+
_this._onSkinUpdated = _this._onSkinUpdated.bind(_this);
|
|
22442
|
+
var localBounds = _this._localBounds;
|
|
22443
|
+
// @ts-ignore
|
|
22444
|
+
localBounds.min._onValueChanged = _this._onLocalBoundsChanged;
|
|
22445
|
+
// @ts-ignore
|
|
22446
|
+
localBounds.max._onValueChanged = _this._onLocalBoundsChanged;
|
|
22369
22447
|
return _this;
|
|
22370
22448
|
}
|
|
22371
|
-
var _proto =
|
|
22449
|
+
var _proto = SkinnedMeshRenderer.prototype;
|
|
22372
22450
|
/**
|
|
22373
|
-
*
|
|
22374
|
-
|
|
22375
|
-
|
|
22376
|
-
|
|
22377
|
-
|
|
22378
|
-
|
|
22379
|
-
|
|
22380
|
-
|
|
22381
|
-
|
|
22382
|
-
|
|
22383
|
-
this
|
|
22384
|
-
], args));
|
|
22385
|
-
this._components.push(component);
|
|
22386
|
-
// @todo: temporary solution
|
|
22387
|
-
if (_instanceof(component, Transform)) this._setTransform(component);
|
|
22388
|
-
component._setActive(true, ActiveChangeFlag.All);
|
|
22389
|
-
return component;
|
|
22451
|
+
* @internal
|
|
22452
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
22453
|
+
var _this__jointTexture;
|
|
22454
|
+
MeshRenderer.prototype._onDestroy.call(this);
|
|
22455
|
+
this._jointDataCreateCache = null;
|
|
22456
|
+
this._skin = null;
|
|
22457
|
+
this._blendShapeWeights = null;
|
|
22458
|
+
this._localBounds = null;
|
|
22459
|
+
(_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
|
|
22460
|
+
this._jointTexture = null;
|
|
22390
22461
|
};
|
|
22391
22462
|
/**
|
|
22392
|
-
*
|
|
22393
|
-
|
|
22394
|
-
|
|
22395
|
-
|
|
22396
|
-
|
|
22397
|
-
for(var i = 0, n = components.length; i < n; i++){
|
|
22398
|
-
var component = components[i];
|
|
22399
|
-
if (_instanceof(component, type)) {
|
|
22400
|
-
return component;
|
|
22401
|
-
}
|
|
22463
|
+
* @internal
|
|
22464
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
22465
|
+
MeshRenderer.prototype._cloneTo.call(this, target);
|
|
22466
|
+
if (this.skin) {
|
|
22467
|
+
target._applySkin(null, target.skin);
|
|
22402
22468
|
}
|
|
22403
|
-
|
|
22469
|
+
this._blendShapeWeights && (target._blendShapeWeights = this._blendShapeWeights.slice());
|
|
22404
22470
|
};
|
|
22405
|
-
|
|
22406
|
-
|
|
22407
|
-
|
|
22408
|
-
|
|
22409
|
-
|
|
22410
|
-
|
|
22411
|
-
|
|
22412
|
-
var
|
|
22413
|
-
|
|
22414
|
-
|
|
22415
|
-
|
|
22416
|
-
|
|
22471
|
+
_proto._update = function _update(context) {
|
|
22472
|
+
var skin = this.skin;
|
|
22473
|
+
if ((skin == null ? void 0 : skin.bones.length) > 0) {
|
|
22474
|
+
skin._updateSkinMatrices(this);
|
|
22475
|
+
}
|
|
22476
|
+
var shaderData = this.shaderData;
|
|
22477
|
+
var mesh = this.mesh;
|
|
22478
|
+
var blendShapeManager = mesh._blendShapeManager;
|
|
22479
|
+
blendShapeManager._updateShaderData(shaderData, this);
|
|
22480
|
+
var bones = skin == null ? void 0 : skin.bones;
|
|
22481
|
+
if (bones) {
|
|
22482
|
+
var bsUniformOccupiesCount = blendShapeManager._uniformOccupiesCount;
|
|
22483
|
+
var boneCount = bones.length;
|
|
22484
|
+
var boneDataCreateCache = this._jointDataCreateCache;
|
|
22485
|
+
var boneCountChange = boneCount !== boneDataCreateCache.x;
|
|
22486
|
+
if (boneCountChange || bsUniformOccupiesCount !== boneDataCreateCache.y) {
|
|
22487
|
+
// directly use max joint count to avoid shader recompile
|
|
22488
|
+
var remainUniformJointCount = Math.ceil((this._maxVertexUniformVectors - (SkinnedMeshRenderer._baseVertexUniformVectorCount + bsUniformOccupiesCount)) / 4);
|
|
22489
|
+
if (boneCount > remainUniformJointCount) {
|
|
22490
|
+
var engine = this.engine;
|
|
22491
|
+
if (engine._hardwareRenderer.canIUseMoreJoints) {
|
|
22492
|
+
if (boneCountChange) {
|
|
22493
|
+
var _this__jointTexture;
|
|
22494
|
+
(_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
|
|
22495
|
+
this._jointTexture = new Texture2D(engine, 4, boneCount, TextureFormat.R32G32B32A32, false, false);
|
|
22496
|
+
this._jointTexture.filterMode = TextureFilterMode.Point;
|
|
22497
|
+
this._jointTexture.isGCIgnored = true;
|
|
22498
|
+
}
|
|
22499
|
+
shaderData.disableMacro("RENDERER_JOINTS_NUM");
|
|
22500
|
+
shaderData.enableMacro("RENDERER_USE_JOINT_TEXTURE");
|
|
22501
|
+
shaderData.setTexture(SkinnedMeshRenderer._jointSamplerProperty, this._jointTexture);
|
|
22502
|
+
} else {
|
|
22503
|
+
Logger.error("component's joints count(" + boneCount + ") greater than device's MAX_VERTEX_UNIFORM_VECTORS number " + this._maxVertexUniformVectors + ", and don't support jointTexture in this device. suggest joint count less than " + remainUniformJointCount + ".", this);
|
|
22504
|
+
}
|
|
22505
|
+
} else {
|
|
22506
|
+
var _this__jointTexture1;
|
|
22507
|
+
(_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
|
|
22508
|
+
shaderData.disableMacro("RENDERER_USE_JOINT_TEXTURE");
|
|
22509
|
+
shaderData.enableMacro("RENDERER_JOINTS_NUM", remainUniformJointCount.toString());
|
|
22510
|
+
shaderData.setFloatArray(SkinnedMeshRenderer._jointMatrixProperty, skin._skinMatrices);
|
|
22511
|
+
}
|
|
22512
|
+
boneDataCreateCache.set(boneCount, bsUniformOccupiesCount);
|
|
22513
|
+
}
|
|
22514
|
+
if (this._jointTexture) {
|
|
22515
|
+
this._jointTexture.setPixelBuffer(skin._skinMatrices);
|
|
22417
22516
|
}
|
|
22418
22517
|
}
|
|
22419
|
-
|
|
22518
|
+
MeshRenderer.prototype._update.call(this, context);
|
|
22420
22519
|
};
|
|
22421
22520
|
/**
|
|
22422
|
-
*
|
|
22423
|
-
|
|
22424
|
-
|
|
22425
|
-
|
|
22426
|
-
|
|
22427
|
-
|
|
22428
|
-
this._getComponentsInChildren(type, results);
|
|
22429
|
-
return results;
|
|
22430
|
-
};
|
|
22431
|
-
_proto.addChild = function addChild(indexOrChild, child) {
|
|
22432
|
-
var index;
|
|
22433
|
-
if (typeof indexOrChild === "number") {
|
|
22434
|
-
index = indexOrChild;
|
|
22521
|
+
* @internal
|
|
22522
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
22523
|
+
var _this_skin;
|
|
22524
|
+
var rootBone = (_this_skin = this.skin) == null ? void 0 : _this_skin.rootBone;
|
|
22525
|
+
if (rootBone) {
|
|
22526
|
+
BoundingBox.transform(this._localBounds, this._transformEntity.transform.worldMatrix, worldBounds);
|
|
22435
22527
|
} else {
|
|
22436
|
-
|
|
22437
|
-
child = indexOrChild;
|
|
22528
|
+
MeshRenderer.prototype._updateBounds.call(this, worldBounds);
|
|
22438
22529
|
}
|
|
22439
|
-
child._setParent(this, index);
|
|
22440
|
-
};
|
|
22441
|
-
/**
|
|
22442
|
-
* Remove child entity.
|
|
22443
|
-
* @param child - The child entity which want to be removed
|
|
22444
|
-
*/ _proto.removeChild = function removeChild(child) {
|
|
22445
|
-
if (child._parent !== this) return;
|
|
22446
|
-
child._setParent(null);
|
|
22447
22530
|
};
|
|
22448
|
-
|
|
22449
|
-
|
|
22450
|
-
|
|
22451
|
-
|
|
22452
|
-
|
|
22453
|
-
|
|
22454
|
-
|
|
22455
|
-
|
|
22456
|
-
|
|
22457
|
-
|
|
22458
|
-
|
|
22459
|
-
|
|
22460
|
-
|
|
22461
|
-
|
|
22462
|
-
|
|
22463
|
-
|
|
22464
|
-
var children = this._children;
|
|
22465
|
-
for(var i = 0, n = children.length; i < n; i++){
|
|
22466
|
-
var target = children[i].findByName(name);
|
|
22467
|
-
if (target) {
|
|
22468
|
-
return target;
|
|
22531
|
+
_proto._checkBlendShapeWeightLength = function _checkBlendShapeWeightLength() {
|
|
22532
|
+
var mesh = this._mesh;
|
|
22533
|
+
var newBlendShapeCount = mesh ? mesh.blendShapeCount : 0;
|
|
22534
|
+
var lastBlendShapeWeights = this._blendShapeWeights;
|
|
22535
|
+
if (lastBlendShapeWeights) {
|
|
22536
|
+
var lastBlendShapeWeightsCount = lastBlendShapeWeights.length;
|
|
22537
|
+
if (lastBlendShapeWeightsCount !== newBlendShapeCount) {
|
|
22538
|
+
var newBlendShapeWeights = new Float32Array(newBlendShapeCount);
|
|
22539
|
+
if (newBlendShapeCount > lastBlendShapeWeightsCount) {
|
|
22540
|
+
newBlendShapeWeights.set(lastBlendShapeWeights);
|
|
22541
|
+
} else {
|
|
22542
|
+
for(var i = 0; i < newBlendShapeCount; i++){
|
|
22543
|
+
newBlendShapeWeights[i] = lastBlendShapeWeights[i];
|
|
22544
|
+
}
|
|
22545
|
+
}
|
|
22546
|
+
this._blendShapeWeights = newBlendShapeWeights;
|
|
22469
22547
|
}
|
|
22548
|
+
} else {
|
|
22549
|
+
this._blendShapeWeights = new Float32Array(newBlendShapeCount);
|
|
22470
22550
|
}
|
|
22471
|
-
return null;
|
|
22472
22551
|
};
|
|
22473
|
-
|
|
22474
|
-
|
|
22475
|
-
* @param path - The path of the entity eg: /entity
|
|
22476
|
-
* @returns The component which be found
|
|
22477
|
-
*/ _proto.findByPath = function findByPath(path) {
|
|
22478
|
-
var splits = path.split("/").filter(Boolean);
|
|
22479
|
-
if (!splits.length) {
|
|
22480
|
-
return this;
|
|
22481
|
-
}
|
|
22482
|
-
return Entity._findChildByName(this, 0, splits, 0);
|
|
22552
|
+
_proto._onLocalBoundsChanged = function _onLocalBoundsChanged() {
|
|
22553
|
+
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
22483
22554
|
};
|
|
22484
|
-
|
|
22485
|
-
|
|
22486
|
-
|
|
22487
|
-
|
|
22488
|
-
|
|
22489
|
-
|
|
22490
|
-
|
|
22491
|
-
|
|
22492
|
-
|
|
22493
|
-
|
|
22555
|
+
_proto._onSkinUpdated = function _onSkinUpdated(type, value) {
|
|
22556
|
+
switch(type){
|
|
22557
|
+
case SkinUpdateFlag.BoneCountChanged:
|
|
22558
|
+
var shaderData = this.shaderData;
|
|
22559
|
+
if (value > 0) {
|
|
22560
|
+
shaderData.enableMacro("RENDERER_HAS_SKIN");
|
|
22561
|
+
shaderData.setInt(SkinnedMeshRenderer._jointCountProperty, value);
|
|
22562
|
+
} else {
|
|
22563
|
+
shaderData.disableMacro("RENDERER_HAS_SKIN");
|
|
22564
|
+
}
|
|
22565
|
+
break;
|
|
22566
|
+
case SkinUpdateFlag.RootBoneChanged:
|
|
22567
|
+
this._setTransformEntity(value);
|
|
22568
|
+
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
22569
|
+
break;
|
|
22570
|
+
}
|
|
22494
22571
|
};
|
|
22495
|
-
|
|
22496
|
-
|
|
22497
|
-
|
|
22498
|
-
var
|
|
22499
|
-
|
|
22500
|
-
|
|
22501
|
-
|
|
22502
|
-
|
|
22503
|
-
|
|
22504
|
-
|
|
22505
|
-
|
|
22506
|
-
|
|
22572
|
+
_proto._applySkin = function _applySkin(lastSkin, value) {
|
|
22573
|
+
var _lastSkin_bones, _value_bones;
|
|
22574
|
+
var _lastSkin_bones_length;
|
|
22575
|
+
var lastSkinBoneCount = (_lastSkin_bones_length = lastSkin == null ? void 0 : (_lastSkin_bones = lastSkin.bones) == null ? void 0 : _lastSkin_bones.length) != null ? _lastSkin_bones_length : 0;
|
|
22576
|
+
var _lastSkin_rootBone;
|
|
22577
|
+
var lastRootBone = (_lastSkin_rootBone = lastSkin == null ? void 0 : lastSkin.rootBone) != null ? _lastSkin_rootBone : this.entity;
|
|
22578
|
+
lastSkin == null ? void 0 : lastSkin._updatedManager.removeListener(this._onSkinUpdated);
|
|
22579
|
+
var _value_bones_length;
|
|
22580
|
+
var skinBoneCount = (_value_bones_length = value == null ? void 0 : (_value_bones = value.bones) == null ? void 0 : _value_bones.length) != null ? _value_bones_length : 0;
|
|
22581
|
+
var _value_rootBone;
|
|
22582
|
+
var rootBone = (_value_rootBone = value == null ? void 0 : value.rootBone) != null ? _value_rootBone : this.entity;
|
|
22583
|
+
value == null ? void 0 : value._updatedManager.addListener(this._onSkinUpdated);
|
|
22584
|
+
if (lastSkinBoneCount !== skinBoneCount) {
|
|
22585
|
+
this._onSkinUpdated(SkinUpdateFlag.BoneCountChanged, skinBoneCount);
|
|
22586
|
+
}
|
|
22587
|
+
if (lastRootBone !== rootBone) {
|
|
22588
|
+
this._onSkinUpdated(SkinUpdateFlag.RootBoneChanged, rootBone);
|
|
22507
22589
|
}
|
|
22508
|
-
children.length = 0;
|
|
22509
22590
|
};
|
|
22510
|
-
|
|
22511
|
-
|
|
22512
|
-
|
|
22513
|
-
|
|
22591
|
+
_create_class(SkinnedMeshRenderer, [
|
|
22592
|
+
{
|
|
22593
|
+
key: "skin",
|
|
22594
|
+
get: /**
|
|
22595
|
+
* Skin of the SkinnedMeshRenderer.
|
|
22596
|
+
*/ function get() {
|
|
22597
|
+
return this._skin;
|
|
22598
|
+
},
|
|
22599
|
+
set: function set(value) {
|
|
22600
|
+
var lastSkin = this._skin;
|
|
22601
|
+
if (lastSkin !== value) {
|
|
22602
|
+
this._applySkin(lastSkin, value);
|
|
22603
|
+
this._skin = value;
|
|
22604
|
+
}
|
|
22605
|
+
}
|
|
22606
|
+
},
|
|
22607
|
+
{
|
|
22608
|
+
key: "blendShapeWeights",
|
|
22609
|
+
get: /**
|
|
22610
|
+
* The weights of the BlendShapes.
|
|
22611
|
+
* @remarks Array index is BlendShape index.
|
|
22612
|
+
*/ function get() {
|
|
22613
|
+
this._checkBlendShapeWeightLength();
|
|
22614
|
+
return this._blendShapeWeights;
|
|
22615
|
+
},
|
|
22616
|
+
set: function set(value) {
|
|
22617
|
+
this._checkBlendShapeWeightLength();
|
|
22618
|
+
var blendShapeWeights = this._blendShapeWeights;
|
|
22619
|
+
if (value.length <= blendShapeWeights.length) {
|
|
22620
|
+
blendShapeWeights.set(value);
|
|
22621
|
+
} else {
|
|
22622
|
+
for(var i = 0, n = blendShapeWeights.length; i < n; i++){
|
|
22623
|
+
blendShapeWeights[i] = value[i];
|
|
22624
|
+
}
|
|
22625
|
+
}
|
|
22626
|
+
}
|
|
22627
|
+
},
|
|
22628
|
+
{
|
|
22629
|
+
key: "localBounds",
|
|
22630
|
+
get: /**
|
|
22631
|
+
* Local bounds.
|
|
22632
|
+
*/ function get() {
|
|
22633
|
+
return this._localBounds;
|
|
22634
|
+
},
|
|
22635
|
+
set: function set(value) {
|
|
22636
|
+
if (this._localBounds !== value) {
|
|
22637
|
+
this._localBounds.copyFrom(value);
|
|
22638
|
+
}
|
|
22639
|
+
}
|
|
22640
|
+
},
|
|
22641
|
+
{
|
|
22642
|
+
key: "rootBone",
|
|
22643
|
+
get: /**
|
|
22644
|
+
* @deprecated use {@link SkinnedMeshRenderer.skin.rootBone} instead.
|
|
22645
|
+
*/ function get() {
|
|
22646
|
+
return this.skin.rootBone;
|
|
22647
|
+
},
|
|
22648
|
+
set: function set(value) {
|
|
22649
|
+
this.skin.rootBone = value;
|
|
22650
|
+
}
|
|
22651
|
+
},
|
|
22652
|
+
{
|
|
22653
|
+
key: "bones",
|
|
22654
|
+
get: /**
|
|
22655
|
+
* @deprecated use {@link SkinnedMeshRenderer.skin.bones} instead.
|
|
22656
|
+
*/ function get() {
|
|
22657
|
+
return this.skin.bones;
|
|
22658
|
+
},
|
|
22659
|
+
set: function set(value) {
|
|
22660
|
+
this.skin.bones = value;
|
|
22661
|
+
}
|
|
22662
|
+
}
|
|
22663
|
+
]);
|
|
22664
|
+
return SkinnedMeshRenderer;
|
|
22665
|
+
}(MeshRenderer);
|
|
22666
|
+
// @TODO: different shader type should use different count, not always 48
|
|
22667
|
+
/** @internal */ SkinnedMeshRenderer._baseVertexUniformVectorCount = 48;
|
|
22668
|
+
SkinnedMeshRenderer._jointCountProperty = ShaderProperty.getByName("renderer_JointCount");
|
|
22669
|
+
SkinnedMeshRenderer._jointSamplerProperty = ShaderProperty.getByName("renderer_JointSampler");
|
|
22670
|
+
SkinnedMeshRenderer._jointMatrixProperty = ShaderProperty.getByName("renderer_JointMatrix");
|
|
22671
|
+
__decorate([
|
|
22672
|
+
ignoreClone
|
|
22673
|
+
], SkinnedMeshRenderer.prototype, "_condensedBlendShapeWeights", void 0);
|
|
22674
|
+
__decorate([
|
|
22675
|
+
deepClone
|
|
22676
|
+
], SkinnedMeshRenderer.prototype, "_localBounds", void 0);
|
|
22677
|
+
__decorate([
|
|
22678
|
+
ignoreClone
|
|
22679
|
+
], SkinnedMeshRenderer.prototype, "_jointDataCreateCache", void 0);
|
|
22680
|
+
__decorate([
|
|
22681
|
+
ignoreClone
|
|
22682
|
+
], SkinnedMeshRenderer.prototype, "_blendShapeWeights", void 0);
|
|
22683
|
+
__decorate([
|
|
22684
|
+
ignoreClone
|
|
22685
|
+
], SkinnedMeshRenderer.prototype, "_maxVertexUniformVectors", void 0);
|
|
22686
|
+
__decorate([
|
|
22687
|
+
ignoreClone
|
|
22688
|
+
], SkinnedMeshRenderer.prototype, "_jointTexture", void 0);
|
|
22689
|
+
__decorate([
|
|
22690
|
+
deepClone
|
|
22691
|
+
], SkinnedMeshRenderer.prototype, "_skin", void 0);
|
|
22692
|
+
__decorate([
|
|
22693
|
+
ignoreClone
|
|
22694
|
+
], SkinnedMeshRenderer.prototype, "_onLocalBoundsChanged", null);
|
|
22695
|
+
__decorate([
|
|
22696
|
+
ignoreClone
|
|
22697
|
+
], SkinnedMeshRenderer.prototype, "_onSkinUpdated", null);
|
|
22698
|
+
|
|
22699
|
+
/**
|
|
22700
|
+
* @internal
|
|
22701
|
+
*/ var BasicResources = /*#__PURE__*/ function() {
|
|
22702
|
+
function BasicResources(engine) {
|
|
22703
|
+
this.engine = engine;
|
|
22704
|
+
// prettier-ignore
|
|
22705
|
+
var vertices = new Float32Array([
|
|
22706
|
+
-1,
|
|
22707
|
+
-1,
|
|
22708
|
+
0,
|
|
22709
|
+
1,
|
|
22710
|
+
3,
|
|
22711
|
+
-1,
|
|
22712
|
+
2,
|
|
22713
|
+
1,
|
|
22714
|
+
-1,
|
|
22715
|
+
3,
|
|
22716
|
+
0,
|
|
22717
|
+
-1
|
|
22718
|
+
]); // left-top
|
|
22719
|
+
// prettier-ignore
|
|
22720
|
+
var flipYVertices = new Float32Array([
|
|
22721
|
+
3,
|
|
22722
|
+
-1,
|
|
22723
|
+
2,
|
|
22724
|
+
0,
|
|
22725
|
+
-1,
|
|
22726
|
+
-1,
|
|
22727
|
+
0,
|
|
22728
|
+
0,
|
|
22729
|
+
-1,
|
|
22730
|
+
3,
|
|
22731
|
+
0,
|
|
22732
|
+
2
|
|
22733
|
+
]); // left-top
|
|
22734
|
+
var blitMaterial = new Material(engine, Shader.find("blit"));
|
|
22735
|
+
blitMaterial._addReferCount(1);
|
|
22736
|
+
blitMaterial.renderState.depthState.enabled = false;
|
|
22737
|
+
blitMaterial.renderState.depthState.writeEnabled = false;
|
|
22738
|
+
var blitScreenMaterial = new Material(engine, Shader.find("blit-screen"));
|
|
22739
|
+
blitScreenMaterial._addReferCount(1);
|
|
22740
|
+
blitScreenMaterial.renderState.depthState.enabled = false;
|
|
22741
|
+
blitScreenMaterial.renderState.depthState.writeEnabled = false;
|
|
22742
|
+
this.blitMaterial = blitMaterial;
|
|
22743
|
+
this.blitScreenMaterial = blitScreenMaterial;
|
|
22744
|
+
this.blitMesh = this._createBlitMesh(engine, vertices);
|
|
22745
|
+
this.flipYBlitMesh = this._createBlitMesh(engine, flipYVertices);
|
|
22746
|
+
// Create white and magenta textures
|
|
22747
|
+
var whitePixel = new Uint8Array([
|
|
22748
|
+
255,
|
|
22749
|
+
255,
|
|
22750
|
+
255,
|
|
22751
|
+
255
|
|
22752
|
+
]);
|
|
22753
|
+
this.whiteTexture2D = this._create1x1Texture(engine, 0, TextureFormat.R8G8B8A8, whitePixel, true);
|
|
22754
|
+
this.whiteTextureCube = this._create1x1Texture(engine, 1, TextureFormat.R8G8B8A8, whitePixel, true);
|
|
22755
|
+
var isWebGL2 = engine._hardwareRenderer.isWebGL2;
|
|
22756
|
+
if (isWebGL2) {
|
|
22757
|
+
this.whiteTexture2DArray = this._create1x1Texture(engine, 2, TextureFormat.R8G8B8A8, whitePixel, true);
|
|
22758
|
+
var whitePixel32 = new Uint32Array([
|
|
22759
|
+
255,
|
|
22760
|
+
255,
|
|
22761
|
+
255,
|
|
22762
|
+
255
|
|
22763
|
+
]);
|
|
22764
|
+
this.uintWhiteTexture2D = this._create1x1Texture(engine, 0, TextureFormat.R32G32B32A32_UInt, whitePixel32, false);
|
|
22765
|
+
}
|
|
22766
|
+
this.spriteDefaultMaterial = this._create2DMaterial(engine, Shader.find("Sprite"));
|
|
22767
|
+
this.textDefaultMaterial = this._create2DMaterial(engine, Shader.find("Text"));
|
|
22768
|
+
this.spriteMaskDefaultMaterial = this._createSpriteMaskMaterial(engine);
|
|
22769
|
+
this.meshMagentaMaterial = this._createMagentaMaterial(engine, "unlit");
|
|
22770
|
+
this.particleMagentaMaterial = this._createMagentaMaterial(engine, "particle-shader");
|
|
22771
|
+
}
|
|
22772
|
+
var _proto = BasicResources.prototype;
|
|
22773
|
+
/**
|
|
22774
|
+
* @internal
|
|
22775
|
+
*/ _proto._getBlinnPhongMaterial = function _getBlinnPhongMaterial() {
|
|
22776
|
+
return this._blinnPhongMaterial || (this._blinnPhongMaterial = new BlinnPhongMaterial(this.engine));
|
|
22777
|
+
};
|
|
22778
|
+
/**
|
|
22779
|
+
* @internal
|
|
22780
|
+
*/ _proto._initialize = function _initialize() {
|
|
22781
|
+
var _this = this;
|
|
22782
|
+
return new Promise(function(resolve, reject) {
|
|
22783
|
+
PrefilteredDFG.create(_this.engine).then(function(texture) {
|
|
22784
|
+
_this._prefilteredDFGTexture = texture;
|
|
22785
|
+
resolve(_this);
|
|
22786
|
+
}).catch(reject);
|
|
22787
|
+
});
|
|
22788
|
+
};
|
|
22789
|
+
_proto._createBlitMesh = function _createBlitMesh(engine, vertices) {
|
|
22790
|
+
var mesh = new ModelMesh(engine);
|
|
22791
|
+
mesh._addReferCount(1);
|
|
22792
|
+
mesh.setVertexElements([
|
|
22793
|
+
new VertexElement("POSITION_UV", 0, VertexElementFormat.Vector4, 0)
|
|
22794
|
+
]);
|
|
22795
|
+
var buffer = new Buffer(engine, BufferBindFlag.VertexBuffer, vertices, BufferUsage.Static, true);
|
|
22796
|
+
mesh.setVertexBufferBinding(buffer, 16);
|
|
22797
|
+
mesh.addSubMesh(0, 3, MeshTopology.Triangles);
|
|
22798
|
+
engine.resourceManager.addContentRestorer(new (/*#__PURE__*/ function(ContentRestorer) {
|
|
22799
|
+
_inherits(_class, ContentRestorer);
|
|
22800
|
+
function _class() {
|
|
22801
|
+
return ContentRestorer.call(this, mesh) || this;
|
|
22802
|
+
}
|
|
22803
|
+
var _proto = _class.prototype;
|
|
22804
|
+
_proto.restoreContent = function restoreContent() {
|
|
22805
|
+
buffer.setData(buffer.data);
|
|
22806
|
+
};
|
|
22807
|
+
return _class;
|
|
22808
|
+
}(ContentRestorer))());
|
|
22809
|
+
return mesh;
|
|
22810
|
+
};
|
|
22811
|
+
_proto._create1x1Texture = function _create1x1Texture(engine, type, format, pixel, isSRGBColorSpace) {
|
|
22812
|
+
var texture;
|
|
22813
|
+
switch(type){
|
|
22814
|
+
case 0:
|
|
22815
|
+
var texture2D = new Texture2D(engine, 1, 1, format, false, isSRGBColorSpace);
|
|
22816
|
+
texture2D.setPixelBuffer(pixel);
|
|
22817
|
+
texture = texture2D;
|
|
22818
|
+
break;
|
|
22819
|
+
case 2:
|
|
22820
|
+
var texture2DArray = new Texture2DArray(engine, 1, 1, 1, format, false, isSRGBColorSpace);
|
|
22821
|
+
texture2DArray.setPixelBuffer(0, pixel);
|
|
22822
|
+
texture = texture2DArray;
|
|
22823
|
+
break;
|
|
22824
|
+
case 1:
|
|
22825
|
+
var textureCube = new TextureCube(engine, 1, format, false, isSRGBColorSpace);
|
|
22826
|
+
for(var i = 0; i < 6; i++){
|
|
22827
|
+
textureCube.setPixelBuffer(TextureCubeFace.PositiveX + i, pixel);
|
|
22828
|
+
}
|
|
22829
|
+
texture = textureCube;
|
|
22830
|
+
break;
|
|
22831
|
+
default:
|
|
22832
|
+
throw "Invalid texture type";
|
|
22833
|
+
}
|
|
22834
|
+
texture.isGCIgnored = true;
|
|
22835
|
+
engine.resourceManager.addContentRestorer(new (/*#__PURE__*/ function(ContentRestorer) {
|
|
22836
|
+
_inherits(_class, ContentRestorer);
|
|
22837
|
+
function _class() {
|
|
22838
|
+
return ContentRestorer.call(this, texture) || this;
|
|
22839
|
+
}
|
|
22840
|
+
var _proto = _class.prototype;
|
|
22841
|
+
_proto.restoreContent = function restoreContent() {
|
|
22842
|
+
switch(type){
|
|
22843
|
+
case 0:
|
|
22844
|
+
this.resource.setPixelBuffer(pixel);
|
|
22845
|
+
break;
|
|
22846
|
+
case 2:
|
|
22847
|
+
this.resource.setPixelBuffer(0, pixel);
|
|
22848
|
+
break;
|
|
22849
|
+
case 1:
|
|
22850
|
+
for(var i = 0; i < 6; i++){
|
|
22851
|
+
this.resource.setPixelBuffer(TextureCubeFace.PositiveX + i, pixel);
|
|
22852
|
+
}
|
|
22853
|
+
break;
|
|
22854
|
+
}
|
|
22855
|
+
};
|
|
22856
|
+
return _class;
|
|
22857
|
+
}(ContentRestorer))());
|
|
22858
|
+
return texture;
|
|
22859
|
+
};
|
|
22860
|
+
_proto._create2DMaterial = function _create2DMaterial(engine, shader) {
|
|
22861
|
+
var material = new Material(engine, shader);
|
|
22862
|
+
var renderState = material.renderState;
|
|
22863
|
+
var target = renderState.blendState.targetBlendState;
|
|
22864
|
+
target.enabled = true;
|
|
22865
|
+
target.sourceColorBlendFactor = BlendFactor.SourceAlpha;
|
|
22866
|
+
target.destinationColorBlendFactor = BlendFactor.OneMinusSourceAlpha;
|
|
22867
|
+
target.sourceAlphaBlendFactor = BlendFactor.One;
|
|
22868
|
+
target.destinationAlphaBlendFactor = BlendFactor.OneMinusSourceAlpha;
|
|
22869
|
+
target.colorBlendOperation = target.alphaBlendOperation = BlendOperation.Add;
|
|
22870
|
+
renderState.depthState.writeEnabled = false;
|
|
22871
|
+
renderState.rasterState.cullMode = CullMode.Off;
|
|
22872
|
+
renderState.renderQueueType = RenderQueueType.Transparent;
|
|
22873
|
+
material.isGCIgnored = true;
|
|
22874
|
+
return material;
|
|
22875
|
+
};
|
|
22876
|
+
_proto._createMagentaMaterial = function _createMagentaMaterial(engine, shaderName) {
|
|
22877
|
+
var material = new Material(engine, Shader.find(shaderName));
|
|
22878
|
+
material.isGCIgnored = true;
|
|
22879
|
+
material.shaderData.setColor("material_BaseColor", new Color(1.0, 0.0, 1.01, 1.0));
|
|
22880
|
+
return material;
|
|
22881
|
+
};
|
|
22882
|
+
_proto._createSpriteMaskMaterial = function _createSpriteMaskMaterial(engine) {
|
|
22883
|
+
var material = new Material(engine, Shader.find("SpriteMask"));
|
|
22884
|
+
material.isGCIgnored = true;
|
|
22885
|
+
return material;
|
|
22886
|
+
};
|
|
22887
|
+
BasicResources.getMaskInteractionRenderStates = function getMaskInteractionRenderStates(maskInteraction) {
|
|
22888
|
+
var visibleInsideMask = maskInteraction === SpriteMaskInteraction.VisibleInsideMask;
|
|
22889
|
+
var renderStates;
|
|
22890
|
+
var compareFunction;
|
|
22891
|
+
if (visibleInsideMask) {
|
|
22892
|
+
renderStates = BasicResources._maskReadInsideRenderStates;
|
|
22893
|
+
if (renderStates) {
|
|
22894
|
+
return renderStates;
|
|
22895
|
+
}
|
|
22896
|
+
BasicResources._maskReadInsideRenderStates = renderStates = {};
|
|
22897
|
+
compareFunction = CompareFunction.LessEqual;
|
|
22898
|
+
} else {
|
|
22899
|
+
renderStates = BasicResources._maskReadOutsideRenderStates;
|
|
22900
|
+
if (renderStates) {
|
|
22901
|
+
return renderStates;
|
|
22902
|
+
}
|
|
22903
|
+
BasicResources._maskReadOutsideRenderStates = renderStates = {};
|
|
22904
|
+
compareFunction = CompareFunction.Greater;
|
|
22905
|
+
}
|
|
22906
|
+
renderStates[RenderStateElementKey.StencilStateEnabled] = true;
|
|
22907
|
+
renderStates[RenderStateElementKey.StencilStateWriteMask] = 0x00;
|
|
22908
|
+
renderStates[RenderStateElementKey.StencilStateReferenceValue] = 1;
|
|
22909
|
+
renderStates[RenderStateElementKey.StencilStateCompareFunctionFront] = compareFunction;
|
|
22910
|
+
renderStates[RenderStateElementKey.StencilStateCompareFunctionBack] = compareFunction;
|
|
22911
|
+
return renderStates;
|
|
22912
|
+
};
|
|
22913
|
+
BasicResources.getMaskTypeRenderStates = function getMaskTypeRenderStates(maskType) {
|
|
22914
|
+
var isIncrement = maskType === RenderQueueMaskType.Increment;
|
|
22915
|
+
var renderStates;
|
|
22916
|
+
var passOperation;
|
|
22917
|
+
if (isIncrement) {
|
|
22918
|
+
renderStates = BasicResources._maskWriteIncrementRenderStates;
|
|
22919
|
+
if (renderStates) {
|
|
22920
|
+
return renderStates;
|
|
22921
|
+
}
|
|
22922
|
+
BasicResources._maskWriteIncrementRenderStates = renderStates = {};
|
|
22923
|
+
passOperation = StencilOperation.IncrementSaturate;
|
|
22924
|
+
} else {
|
|
22925
|
+
renderStates = BasicResources._maskWriteDecrementRenderStates;
|
|
22926
|
+
if (renderStates) {
|
|
22927
|
+
return renderStates;
|
|
22928
|
+
}
|
|
22929
|
+
BasicResources._maskWriteDecrementRenderStates = renderStates = {};
|
|
22930
|
+
passOperation = StencilOperation.DecrementSaturate;
|
|
22931
|
+
}
|
|
22932
|
+
renderStates[RenderStateElementKey.StencilStateEnabled] = true;
|
|
22933
|
+
renderStates[RenderStateElementKey.StencilStatePassOperationFront] = passOperation;
|
|
22934
|
+
renderStates[RenderStateElementKey.StencilStatePassOperationBack] = passOperation;
|
|
22935
|
+
renderStates[RenderStateElementKey.StencilStateCompareFunctionFront] = CompareFunction.Always;
|
|
22936
|
+
renderStates[RenderStateElementKey.StencilStateCompareFunctionBack] = CompareFunction.Always;
|
|
22937
|
+
var failStencilOperation = StencilOperation.Keep;
|
|
22938
|
+
renderStates[RenderStateElementKey.StencilStateFailOperationFront] = failStencilOperation;
|
|
22939
|
+
renderStates[RenderStateElementKey.StencilStateFailOperationBack] = failStencilOperation;
|
|
22940
|
+
renderStates[RenderStateElementKey.StencilStateZFailOperationFront] = failStencilOperation;
|
|
22941
|
+
renderStates[RenderStateElementKey.StencilStateZFailOperationBack] = failStencilOperation;
|
|
22942
|
+
renderStates[RenderStateElementKey.BlendStateColorWriteMask0] = ColorWriteMask.None;
|
|
22943
|
+
renderStates[RenderStateElementKey.DepthStateEnabled] = false;
|
|
22944
|
+
renderStates[RenderStateElementKey.RasterStateCullMode] = CullMode.Off;
|
|
22945
|
+
return renderStates;
|
|
22946
|
+
};
|
|
22947
|
+
_create_class(BasicResources, [
|
|
22948
|
+
{
|
|
22949
|
+
key: "prefilteredDFGTexture",
|
|
22950
|
+
get: function get() {
|
|
22951
|
+
return this._prefilteredDFGTexture;
|
|
22952
|
+
}
|
|
22953
|
+
}
|
|
22954
|
+
]);
|
|
22955
|
+
return BasicResources;
|
|
22956
|
+
}();
|
|
22957
|
+
BasicResources._maskReadInsideRenderStates = null;
|
|
22958
|
+
BasicResources._maskReadOutsideRenderStates = null;
|
|
22959
|
+
BasicResources._maskWriteIncrementRenderStates = null;
|
|
22960
|
+
BasicResources._maskWriteDecrementRenderStates = null;
|
|
22961
|
+
|
|
22962
|
+
function _is_native_reflect_construct() {
|
|
22963
|
+
// Since Reflect.construct can't be properly polyfilled, some
|
|
22964
|
+
// implementations (e.g. core-js@2) don't set the correct internal slots.
|
|
22965
|
+
// Those polyfills don't allow us to subclass built-ins, so we need to
|
|
22966
|
+
// use our fallback implementation.
|
|
22967
|
+
try {
|
|
22968
|
+
// If the internal slots aren't set, this throws an error similar to
|
|
22969
|
+
// TypeError: this is not a Boolean object.
|
|
22970
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
22971
|
+
} catch (_) {}
|
|
22972
|
+
return (_is_native_reflect_construct = function() {
|
|
22973
|
+
return !!result;
|
|
22974
|
+
})();
|
|
22975
|
+
}
|
|
22976
|
+
|
|
22977
|
+
function _construct(Parent, args, Class) {
|
|
22978
|
+
if (_is_native_reflect_construct()) _construct = Reflect.construct;
|
|
22979
|
+
else {
|
|
22980
|
+
_construct = function construct(Parent, args, Class) {
|
|
22981
|
+
var a = [null];
|
|
22982
|
+
a.push.apply(a, args);
|
|
22983
|
+
var Constructor = Function.bind.apply(Parent, a);
|
|
22984
|
+
var instance = new Constructor();
|
|
22985
|
+
|
|
22986
|
+
if (Class) _set_prototype_of(instance, Class.prototype);
|
|
22987
|
+
|
|
22988
|
+
return instance;
|
|
22989
|
+
};
|
|
22990
|
+
}
|
|
22991
|
+
|
|
22992
|
+
return _construct.apply(null, arguments);
|
|
22993
|
+
}
|
|
22994
|
+
|
|
22995
|
+
var ComponentCloner = /*#__PURE__*/ function() {
|
|
22996
|
+
function ComponentCloner() {}
|
|
22997
|
+
/**
|
|
22998
|
+
* Clone component.
|
|
22999
|
+
* @param source - Clone source
|
|
23000
|
+
* @param target - Clone target
|
|
23001
|
+
*/ ComponentCloner.cloneComponent = function cloneComponent(source, target, srcRoot, targetRoot, deepInstanceMap) {
|
|
23002
|
+
var cloneModes = CloneManager.getCloneMode(source.constructor);
|
|
23003
|
+
for(var k in source){
|
|
23004
|
+
CloneManager.cloneProperty(source, target, k, cloneModes[k], srcRoot, targetRoot, deepInstanceMap);
|
|
23005
|
+
}
|
|
23006
|
+
source._cloneTo == null ? void 0 : source._cloneTo.call(source, target, srcRoot, targetRoot);
|
|
23007
|
+
};
|
|
23008
|
+
return ComponentCloner;
|
|
23009
|
+
}();
|
|
23010
|
+
|
|
23011
|
+
/**
|
|
23012
|
+
* The entity modify flags.
|
|
23013
|
+
*/ var EntityModifyFlags = /*#__PURE__*/ function(EntityModifyFlags) {
|
|
23014
|
+
/** The parent changes. */ EntityModifyFlags[EntityModifyFlags["Parent"] = 1] = "Parent";
|
|
23015
|
+
/** The child changes. */ EntityModifyFlags[EntityModifyFlags["Child"] = 2] = "Child";
|
|
23016
|
+
return EntityModifyFlags;
|
|
23017
|
+
}({});
|
|
23018
|
+
|
|
23019
|
+
/**
|
|
23020
|
+
* Entity, be used as components container.
|
|
23021
|
+
*/ var Entity = /*#__PURE__*/ function(EngineObject) {
|
|
23022
|
+
_inherits(Entity, EngineObject);
|
|
23023
|
+
function Entity(engine, name) {
|
|
23024
|
+
for(var _len = arguments.length, components = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
|
|
23025
|
+
components[_key - 2] = arguments[_key];
|
|
23026
|
+
}
|
|
23027
|
+
var _this;
|
|
23028
|
+
_this = EngineObject.call(this, engine) || this, /** The layer the entity belongs to. */ _this.layer = Layer.Layer0, /** @internal */ _this._isActiveInHierarchy = false, /** @internal */ _this._isActiveInScene = false, /** @internal */ _this._components = [], /** @internal */ _this._scripts = new DisorderedArray(), /** @internal */ _this._children = [], /** @internal */ _this._isRoot = false, /** @internal */ _this._isActive = true, /** @internal */ _this._siblingIndex = -1, /** @internal */ _this._isTemplate = false, /** @internal */ _this._updateFlagManager = new UpdateFlagManager(), _this._parent = null, //--------------------------------------------------------------deprecated----------------------------------------------------------------
|
|
23029
|
+
_this._invModelMatrix = new Matrix();
|
|
23030
|
+
_this.name = name != null ? name : "Entity";
|
|
23031
|
+
for(var i = 0, n = components.length; i < n; i++){
|
|
23032
|
+
_this.addComponent(components[i]);
|
|
23033
|
+
}
|
|
23034
|
+
!_this._transform && _this.addComponent(Transform);
|
|
23035
|
+
_this._inverseWorldMatFlag = _this.registerWorldChangeFlag();
|
|
23036
|
+
return _this;
|
|
23037
|
+
}
|
|
23038
|
+
var _proto = Entity.prototype;
|
|
23039
|
+
/**
|
|
23040
|
+
* Add component based on the component type.
|
|
23041
|
+
* @param type - The type of the component
|
|
23042
|
+
* @param args - The arguments of the component
|
|
23043
|
+
* @returns The component which has been added
|
|
23044
|
+
*/ _proto.addComponent = function addComponent(type) {
|
|
23045
|
+
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
23046
|
+
args[_key - 1] = arguments[_key];
|
|
23047
|
+
}
|
|
23048
|
+
ComponentsDependencies._addCheck(this, type);
|
|
23049
|
+
var component = _construct(type, [].concat([
|
|
23050
|
+
this
|
|
23051
|
+
], args));
|
|
23052
|
+
this._components.push(component);
|
|
23053
|
+
// @todo: temporary solution
|
|
23054
|
+
if (_instanceof(component, Transform)) this._setTransform(component);
|
|
23055
|
+
component._setActive(true, ActiveChangeFlag.All);
|
|
23056
|
+
return component;
|
|
23057
|
+
};
|
|
23058
|
+
/**
|
|
23059
|
+
* Get component which match the type.
|
|
23060
|
+
* @param type - The type of the component
|
|
23061
|
+
* @returns The first component which match type
|
|
23062
|
+
*/ _proto.getComponent = function getComponent(type) {
|
|
23063
|
+
var components = this._components;
|
|
23064
|
+
for(var i = 0, n = components.length; i < n; i++){
|
|
23065
|
+
var component = components[i];
|
|
23066
|
+
if (_instanceof(component, type)) {
|
|
23067
|
+
return component;
|
|
23068
|
+
}
|
|
23069
|
+
}
|
|
23070
|
+
return null;
|
|
23071
|
+
};
|
|
23072
|
+
/**
|
|
23073
|
+
* Get components which match the type.
|
|
23074
|
+
* @param type - The type of the component
|
|
23075
|
+
* @param results - The components which match type
|
|
23076
|
+
* @returns The components which match type
|
|
23077
|
+
*/ _proto.getComponents = function getComponents(type, results) {
|
|
23078
|
+
results.length = 0;
|
|
23079
|
+
var components = this._components;
|
|
23080
|
+
for(var i = 0, n = components.length; i < n; i++){
|
|
23081
|
+
var component = components[i];
|
|
23082
|
+
if (_instanceof(component, type)) {
|
|
23083
|
+
results.push(component);
|
|
23084
|
+
}
|
|
23085
|
+
}
|
|
23086
|
+
return results;
|
|
23087
|
+
};
|
|
23088
|
+
/**
|
|
23089
|
+
* Get the components which match the type of the entity and it's children.
|
|
23090
|
+
* @param type - The component type
|
|
23091
|
+
* @param results - The components collection
|
|
23092
|
+
* @returns The components collection which match the type
|
|
23093
|
+
*/ _proto.getComponentsIncludeChildren = function getComponentsIncludeChildren(type, results) {
|
|
23094
|
+
results.length = 0;
|
|
23095
|
+
this._getComponentsInChildren(type, results);
|
|
23096
|
+
return results;
|
|
23097
|
+
};
|
|
23098
|
+
_proto.addChild = function addChild(indexOrChild, child) {
|
|
23099
|
+
var index;
|
|
23100
|
+
if (typeof indexOrChild === "number") {
|
|
23101
|
+
index = indexOrChild;
|
|
23102
|
+
} else {
|
|
23103
|
+
index = undefined;
|
|
23104
|
+
child = indexOrChild;
|
|
23105
|
+
}
|
|
23106
|
+
child._setParent(this, index);
|
|
23107
|
+
};
|
|
23108
|
+
/**
|
|
23109
|
+
* Remove child entity.
|
|
23110
|
+
* @param child - The child entity which want to be removed
|
|
23111
|
+
*/ _proto.removeChild = function removeChild(child) {
|
|
23112
|
+
if (child._parent !== this) return;
|
|
23113
|
+
child._setParent(null);
|
|
23114
|
+
};
|
|
23115
|
+
/**
|
|
23116
|
+
* @deprecated Please use `children` property instead.
|
|
23117
|
+
* Find child entity by index.
|
|
23118
|
+
* @param index - The index of the child entity
|
|
23119
|
+
* @returns The component which be found
|
|
23120
|
+
*/ _proto.getChild = function getChild(index) {
|
|
23121
|
+
return this._children[index];
|
|
23122
|
+
};
|
|
23123
|
+
/**
|
|
23124
|
+
* Find entity by name.
|
|
23125
|
+
* @param name - The name of the entity which want to be found
|
|
23126
|
+
* @returns The component which be found
|
|
23127
|
+
*/ _proto.findByName = function findByName(name) {
|
|
23128
|
+
if (name === this.name) {
|
|
23129
|
+
return this;
|
|
23130
|
+
}
|
|
23131
|
+
var children = this._children;
|
|
23132
|
+
for(var i = 0, n = children.length; i < n; i++){
|
|
23133
|
+
var target = children[i].findByName(name);
|
|
23134
|
+
if (target) {
|
|
23135
|
+
return target;
|
|
23136
|
+
}
|
|
23137
|
+
}
|
|
23138
|
+
return null;
|
|
23139
|
+
};
|
|
23140
|
+
/**
|
|
23141
|
+
* Find the entity by path.
|
|
23142
|
+
* @param path - The path of the entity eg: /entity
|
|
23143
|
+
* @returns The component which be found
|
|
23144
|
+
*/ _proto.findByPath = function findByPath(path) {
|
|
23145
|
+
var splits = path.split("/").filter(Boolean);
|
|
23146
|
+
if (!splits.length) {
|
|
23147
|
+
return this;
|
|
23148
|
+
}
|
|
23149
|
+
return Entity._findChildByName(this, 0, splits, 0);
|
|
23150
|
+
};
|
|
23151
|
+
/**
|
|
23152
|
+
* Create child entity.
|
|
23153
|
+
* @param name - The child entity's name
|
|
23154
|
+
* @returns The child entity
|
|
23155
|
+
*/ _proto.createChild = function createChild(name) {
|
|
23156
|
+
var transform = this._transform;
|
|
23157
|
+
var child = transform ? new Entity(this.engine, name, transform.constructor) : new Entity(this.engine, name);
|
|
23158
|
+
child.layer = this.layer;
|
|
23159
|
+
child.parent = this;
|
|
23160
|
+
return child;
|
|
23161
|
+
};
|
|
23162
|
+
/**
|
|
23163
|
+
* Clear children entities.
|
|
23164
|
+
*/ _proto.clearChildren = function clearChildren() {
|
|
23165
|
+
var children = this._children;
|
|
23166
|
+
for(var i = children.length - 1; i >= 0; i--){
|
|
23167
|
+
var child = children[i];
|
|
23168
|
+
child._parent = null;
|
|
23169
|
+
var activeChangeFlag = ActiveChangeFlag.None;
|
|
23170
|
+
child._isActiveInHierarchy && (activeChangeFlag |= ActiveChangeFlag.Hierarchy);
|
|
23171
|
+
child._isActiveInScene && (activeChangeFlag |= ActiveChangeFlag.Scene);
|
|
23172
|
+
activeChangeFlag && child._processInActive(activeChangeFlag);
|
|
23173
|
+
Entity._traverseSetOwnerScene(child, null); // Must after child._processInActive().
|
|
23174
|
+
}
|
|
23175
|
+
children.length = 0;
|
|
23176
|
+
};
|
|
23177
|
+
/**
|
|
23178
|
+
* Clone this entity include children and components.
|
|
23179
|
+
* @returns Cloned entity
|
|
23180
|
+
*/ _proto.clone = function clone() {
|
|
22514
23181
|
var cloneEntity = this._createCloneEntity();
|
|
22515
23182
|
this._parseCloneEntity(this, cloneEntity, this, cloneEntity, new Map());
|
|
22516
23183
|
return cloneEntity;
|
|
@@ -22523,6 +23190,11 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
22523
23190
|
};
|
|
22524
23191
|
/**
|
|
22525
23192
|
* @internal
|
|
23193
|
+
*/ _proto._remap = function _remap(srcRoot, targetRoot) {
|
|
23194
|
+
return CloneUtils.remapEntity(srcRoot, targetRoot, this);
|
|
23195
|
+
};
|
|
23196
|
+
/**
|
|
23197
|
+
* @internal
|
|
22526
23198
|
*/ _proto._markAsTemplate = function _markAsTemplate(templateResource) {
|
|
22527
23199
|
this._isTemplate = true;
|
|
22528
23200
|
this._templateResource = templateResource;
|
|
@@ -22834,834 +23506,143 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
22834
23506
|
};
|
|
22835
23507
|
/**
|
|
22836
23508
|
* @internal
|
|
22837
|
-
*/ Entity.
|
|
22838
|
-
|
|
22839
|
-
|
|
22840
|
-
var
|
|
22841
|
-
|
|
22842
|
-
|
|
22843
|
-
}
|
|
22844
|
-
inversePath.push(searchEntity.siblingIndex);
|
|
22845
|
-
searchEntity = parent;
|
|
22846
|
-
}
|
|
22847
|
-
return true;
|
|
22848
|
-
};
|
|
22849
|
-
/**
|
|
22850
|
-
* @internal
|
|
22851
|
-
*/ Entity._getEntityByHierarchyPath = function _getEntityByHierarchyPath(rootEntity, inversePath) {
|
|
22852
|
-
var entity = rootEntity;
|
|
22853
|
-
for(var i = inversePath.length - 1; i >= 0; i--){
|
|
22854
|
-
entity = entity.children[inversePath[i]];
|
|
22855
|
-
}
|
|
22856
|
-
return entity;
|
|
22857
|
-
};
|
|
22858
|
-
/**
|
|
22859
|
-
* @internal
|
|
22860
|
-
*/ Entity._removeFromChildren = function _removeFromChildren(children, entity) {
|
|
22861
|
-
var count = children.length - 1;
|
|
22862
|
-
for(var i = entity._siblingIndex; i < count; i++){
|
|
22863
|
-
var child = children[i + 1];
|
|
22864
|
-
children[i] = child;
|
|
22865
|
-
child._siblingIndex = i;
|
|
22866
|
-
}
|
|
22867
|
-
children.length = count;
|
|
22868
|
-
entity._siblingIndex = -1;
|
|
22869
|
-
};
|
|
22870
|
-
/**
|
|
22871
|
-
* @internal
|
|
22872
|
-
*/ Entity._addToChildren = function _addToChildren(children, entity, index) {
|
|
22873
|
-
var childCount = children.length;
|
|
22874
|
-
children.length = childCount + 1;
|
|
22875
|
-
if (index === undefined) {
|
|
22876
|
-
children[childCount] = entity;
|
|
22877
|
-
entity._siblingIndex = childCount;
|
|
22878
|
-
} else {
|
|
22879
|
-
if (index < 0 || index > childCount) {
|
|
22880
|
-
throw "The index " + index + " is out of child list bounds " + childCount;
|
|
22881
|
-
}
|
|
22882
|
-
for(var i = childCount; i > index; i--){
|
|
22883
|
-
var swapChild = children[i - 1];
|
|
22884
|
-
swapChild._siblingIndex = i;
|
|
22885
|
-
children[i] = swapChild;
|
|
22886
|
-
}
|
|
22887
|
-
entity._siblingIndex = index;
|
|
22888
|
-
children[index] = entity;
|
|
22889
|
-
}
|
|
22890
|
-
};
|
|
22891
|
-
_create_class(Entity, [
|
|
22892
|
-
{
|
|
22893
|
-
key: "transform",
|
|
22894
|
-
get: /**
|
|
22895
|
-
* The transform of this entity.
|
|
22896
|
-
*/ function get() {
|
|
22897
|
-
return this._transform;
|
|
22898
|
-
}
|
|
22899
|
-
},
|
|
22900
|
-
{
|
|
22901
|
-
key: "isActive",
|
|
22902
|
-
get: /**
|
|
22903
|
-
* Whether to activate locally.
|
|
22904
|
-
*/ function get() {
|
|
22905
|
-
return this._isActive;
|
|
22906
|
-
},
|
|
22907
|
-
set: function set(value) {
|
|
22908
|
-
if (value !== this._isActive) {
|
|
22909
|
-
this._isActive = value;
|
|
22910
|
-
if (value) {
|
|
22911
|
-
var parent = this._parent;
|
|
22912
|
-
var activeChangeFlag = ActiveChangeFlag.None;
|
|
22913
|
-
if (this._isRoot && this._scene._isActiveInEngine) {
|
|
22914
|
-
activeChangeFlag |= ActiveChangeFlag.All;
|
|
22915
|
-
} else {
|
|
22916
|
-
(parent == null ? void 0 : parent._isActiveInHierarchy) && (activeChangeFlag |= ActiveChangeFlag.Hierarchy);
|
|
22917
|
-
(parent == null ? void 0 : parent._isActiveInScene) && (activeChangeFlag |= ActiveChangeFlag.Scene);
|
|
22918
|
-
}
|
|
22919
|
-
activeChangeFlag && this._processActive(activeChangeFlag);
|
|
22920
|
-
} else {
|
|
22921
|
-
var activeChangeFlag1 = ActiveChangeFlag.None;
|
|
22922
|
-
this._isActiveInHierarchy && (activeChangeFlag1 |= ActiveChangeFlag.Hierarchy);
|
|
22923
|
-
this._isActiveInScene && (activeChangeFlag1 |= ActiveChangeFlag.Scene);
|
|
22924
|
-
activeChangeFlag1 && this._processInActive(activeChangeFlag1);
|
|
22925
|
-
}
|
|
22926
|
-
}
|
|
22927
|
-
}
|
|
22928
|
-
},
|
|
22929
|
-
{
|
|
22930
|
-
key: "isActiveInHierarchy",
|
|
22931
|
-
get: /**
|
|
22932
|
-
* Whether it is active in the hierarchy.
|
|
22933
|
-
*/ function get() {
|
|
22934
|
-
return this._isActiveInHierarchy;
|
|
22935
|
-
}
|
|
22936
|
-
},
|
|
22937
|
-
{
|
|
22938
|
-
key: "parent",
|
|
22939
|
-
get: /**
|
|
22940
|
-
* The parent entity.
|
|
22941
|
-
*/ function get() {
|
|
22942
|
-
return this._parent;
|
|
22943
|
-
},
|
|
22944
|
-
set: function set(value) {
|
|
22945
|
-
this._setParent(value);
|
|
22946
|
-
}
|
|
22947
|
-
},
|
|
22948
|
-
{
|
|
22949
|
-
key: "children",
|
|
22950
|
-
get: /**
|
|
22951
|
-
* The children entities
|
|
22952
|
-
*/ function get() {
|
|
22953
|
-
return this._children;
|
|
22954
|
-
}
|
|
22955
|
-
},
|
|
22956
|
-
{
|
|
22957
|
-
key: "childCount",
|
|
22958
|
-
get: /**
|
|
22959
|
-
* @deprecated Please use `children.length` property instead.
|
|
22960
|
-
* Number of the children entities
|
|
22961
|
-
*/ function get() {
|
|
22962
|
-
return this._children.length;
|
|
22963
|
-
}
|
|
22964
|
-
},
|
|
22965
|
-
{
|
|
22966
|
-
key: "scene",
|
|
22967
|
-
get: /**
|
|
22968
|
-
* The scene the entity belongs to.
|
|
22969
|
-
*/ function get() {
|
|
22970
|
-
return this._scene;
|
|
22971
|
-
}
|
|
22972
|
-
},
|
|
22973
|
-
{
|
|
22974
|
-
key: "siblingIndex",
|
|
22975
|
-
get: /**
|
|
22976
|
-
* The sibling index.
|
|
22977
|
-
*/ function get() {
|
|
22978
|
-
return this._siblingIndex;
|
|
22979
|
-
},
|
|
22980
|
-
set: function set(value) {
|
|
22981
|
-
if (this._siblingIndex === -1) {
|
|
22982
|
-
throw "The entity " + this.name + " is not in the hierarchy";
|
|
22983
|
-
}
|
|
22984
|
-
if (this._isRoot) {
|
|
22985
|
-
this._setSiblingIndex(this._scene._rootEntities, value);
|
|
22986
|
-
} else {
|
|
22987
|
-
var parent = this._parent;
|
|
22988
|
-
this._setSiblingIndex(parent._children, value);
|
|
22989
|
-
parent._dispatchModify(EntityModifyFlags.Child, parent);
|
|
22990
|
-
}
|
|
22991
|
-
}
|
|
22992
|
-
}
|
|
22993
|
-
]);
|
|
22994
|
-
return Entity;
|
|
22995
|
-
}(EngineObject);
|
|
22996
|
-
/** @internal */ Entity._tempComponentConstructors = [];
|
|
22997
|
-
|
|
22998
|
-
/**
|
|
22999
|
-
* Skin used for skinned mesh renderer.
|
|
23000
|
-
*/ var Skin = /*#__PURE__*/ function(EngineObject) {
|
|
23001
|
-
_inherits(Skin, EngineObject);
|
|
23002
|
-
function Skin(name) {
|
|
23003
|
-
var _this;
|
|
23004
|
-
_this = EngineObject.call(this, null) || this, _this.name = name, _this.inverseBindMatrices = new Array(), _this._updatedManager = new UpdateFlagManager(), _this._bones = new Array(), _this._updateMark = -1, _this.joints = [];
|
|
23005
|
-
return _this;
|
|
23006
|
-
}
|
|
23007
|
-
var _proto = Skin.prototype;
|
|
23008
|
-
/**
|
|
23009
|
-
* @internal
|
|
23010
|
-
*/ _proto._updateSkinMatrices = function _updateSkinMatrices(renderer) {
|
|
23011
|
-
if (this._updateMark === renderer.engine.time.frameCount) {
|
|
23012
|
-
return;
|
|
23013
|
-
}
|
|
23014
|
-
var _this = this, bones = _this.bones, bindMatrices = _this.inverseBindMatrices, skinMatrices = _this._skinMatrices;
|
|
23015
|
-
var _this_rootBone;
|
|
23016
|
-
var worldToLocal = ((_this_rootBone = this.rootBone) != null ? _this_rootBone : renderer.entity).getInvModelMatrix();
|
|
23017
|
-
for(var i = bones.length - 1; i >= 0; i--){
|
|
23018
|
-
var bone = bones[i];
|
|
23019
|
-
var offset = i * 16;
|
|
23020
|
-
if (bone) {
|
|
23021
|
-
Utils._floatMatrixMultiply(bone.transform.worldMatrix, bindMatrices[i].elements, 0, skinMatrices, offset);
|
|
23022
|
-
} else {
|
|
23023
|
-
skinMatrices.set(bindMatrices[i].elements, offset);
|
|
23024
|
-
}
|
|
23025
|
-
Utils._floatMatrixMultiply(worldToLocal, skinMatrices, offset, skinMatrices, offset);
|
|
23026
|
-
}
|
|
23027
|
-
this._updateMark = renderer.engine.time.frameCount;
|
|
23028
|
-
};
|
|
23029
|
-
/**
|
|
23030
|
-
* @internal
|
|
23031
|
-
*/ _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
|
|
23032
|
-
var paths = new Array();
|
|
23033
|
-
// Clone rootBone
|
|
23034
|
-
var rootBone = this.rootBone;
|
|
23035
|
-
if (rootBone) {
|
|
23036
|
-
var success = Entity._getEntityHierarchyPath(srcRoot, rootBone, paths);
|
|
23037
|
-
target.rootBone = success ? Entity._getEntityByHierarchyPath(targetRoot, paths) : rootBone;
|
|
23038
|
-
}
|
|
23039
|
-
// Clone bones
|
|
23040
|
-
var bones = this.bones;
|
|
23041
|
-
if (bones.length > 0) {
|
|
23042
|
-
var boneCount = bones.length;
|
|
23043
|
-
var destBones = new Array(boneCount);
|
|
23044
|
-
for(var i = 0; i < boneCount; i++){
|
|
23045
|
-
var bone = bones[i];
|
|
23046
|
-
var success1 = Entity._getEntityHierarchyPath(srcRoot, bone, paths);
|
|
23047
|
-
destBones[i] = success1 ? Entity._getEntityByHierarchyPath(targetRoot, paths) : bone;
|
|
23048
|
-
}
|
|
23049
|
-
target.bones = destBones;
|
|
23050
|
-
}
|
|
23051
|
-
};
|
|
23052
|
-
_create_class(Skin, [
|
|
23053
|
-
{
|
|
23054
|
-
key: "rootBone",
|
|
23055
|
-
get: /**
|
|
23056
|
-
* Root bone.
|
|
23057
|
-
*/ function get() {
|
|
23058
|
-
return this._rootBone;
|
|
23059
|
-
},
|
|
23060
|
-
set: function set(value) {
|
|
23061
|
-
if (this._rootBone !== value) {
|
|
23062
|
-
this._updatedManager.dispatch(1, value);
|
|
23063
|
-
this._rootBone = value;
|
|
23064
|
-
}
|
|
23065
|
-
}
|
|
23066
|
-
},
|
|
23067
|
-
{
|
|
23068
|
-
key: "bones",
|
|
23069
|
-
get: /**
|
|
23070
|
-
* Bones of the skin.
|
|
23071
|
-
*/ function get() {
|
|
23072
|
-
return this._bones;
|
|
23073
|
-
},
|
|
23074
|
-
set: function set(value) {
|
|
23075
|
-
var bones = this._bones;
|
|
23076
|
-
var _value_length;
|
|
23077
|
-
var boneCount = (_value_length = value == null ? void 0 : value.length) != null ? _value_length : 0;
|
|
23078
|
-
var lastBoneCount = bones.length;
|
|
23079
|
-
bones.length = boneCount;
|
|
23080
|
-
for(var i = 0; i < boneCount; i++){
|
|
23081
|
-
bones[i] = value[i];
|
|
23082
|
-
}
|
|
23083
|
-
if (lastBoneCount !== boneCount) {
|
|
23084
|
-
this._skinMatrices = new Float32Array(boneCount * 16);
|
|
23085
|
-
this._updatedManager.dispatch(0, boneCount);
|
|
23086
|
-
}
|
|
23087
|
-
}
|
|
23088
|
-
},
|
|
23089
|
-
{
|
|
23090
|
-
key: "skeleton",
|
|
23091
|
-
get: /** @deprecated Please use `rootBone` instead. */ function get() {
|
|
23092
|
-
var _this_rootBone;
|
|
23093
|
-
return (_this_rootBone = this.rootBone) == null ? void 0 : _this_rootBone.name;
|
|
23094
|
-
},
|
|
23095
|
-
set: function set(value) {
|
|
23096
|
-
var rootBone = this._rootBone;
|
|
23097
|
-
if (rootBone) {
|
|
23098
|
-
rootBone.name = value;
|
|
23099
|
-
}
|
|
23100
|
-
}
|
|
23101
|
-
}
|
|
23102
|
-
]);
|
|
23103
|
-
return Skin;
|
|
23104
|
-
}(EngineObject);
|
|
23105
|
-
__decorate([
|
|
23106
|
-
deepClone
|
|
23107
|
-
], Skin.prototype, "inverseBindMatrices", void 0);
|
|
23108
|
-
__decorate([
|
|
23109
|
-
ignoreClone
|
|
23110
|
-
], Skin.prototype, "_skinMatrices", void 0);
|
|
23111
|
-
__decorate([
|
|
23112
|
-
ignoreClone
|
|
23113
|
-
], Skin.prototype, "_updatedManager", void 0);
|
|
23114
|
-
__decorate([
|
|
23115
|
-
ignoreClone
|
|
23116
|
-
], Skin.prototype, "_rootBone", void 0);
|
|
23117
|
-
__decorate([
|
|
23118
|
-
ignoreClone
|
|
23119
|
-
], Skin.prototype, "_bones", void 0);
|
|
23120
|
-
__decorate([
|
|
23121
|
-
ignoreClone
|
|
23122
|
-
], Skin.prototype, "_updateMark", void 0);
|
|
23123
|
-
var SkinUpdateFlag = /*#__PURE__*/ function(SkinUpdateFlag) {
|
|
23124
|
-
SkinUpdateFlag[SkinUpdateFlag["BoneCountChanged"] = 0] = "BoneCountChanged";
|
|
23125
|
-
SkinUpdateFlag[SkinUpdateFlag["RootBoneChanged"] = 1] = "RootBoneChanged";
|
|
23126
|
-
return SkinUpdateFlag;
|
|
23127
|
-
}({});
|
|
23128
|
-
|
|
23129
|
-
/**
|
|
23130
|
-
* SkinnedMeshRenderer.
|
|
23131
|
-
*/ var SkinnedMeshRenderer = /*#__PURE__*/ function(MeshRenderer) {
|
|
23132
|
-
_inherits(SkinnedMeshRenderer, MeshRenderer);
|
|
23133
|
-
function SkinnedMeshRenderer(entity) {
|
|
23134
|
-
var _this;
|
|
23135
|
-
_this = MeshRenderer.call(this, entity) || this, _this._localBounds = new BoundingBox(), _this._jointDataCreateCache = new Vector2(-1, -1);
|
|
23136
|
-
_this._skin = null;
|
|
23137
|
-
var rhi = _this.entity.engine._hardwareRenderer;
|
|
23138
|
-
var maxVertexUniformVectors = rhi.renderStates.getParameter(rhi.gl.MAX_VERTEX_UNIFORM_VECTORS);
|
|
23139
|
-
// Limit size to 256 to avoid some problem:
|
|
23140
|
-
// For renderer is "Apple GPU", when uniform is large than 256 the skeleton matrix array access in shader very slow in Safari or WKWebview. This may be a apple bug, Chrome and Firefox is OK!
|
|
23141
|
-
// For renderer is "ANGLE (AMD, AMD Radeon(TM) Graphics Direct3011 vs_5_0 ps_5_0, D3011)", compile shader si very slow because of max uniform is 4096.
|
|
23142
|
-
maxVertexUniformVectors = Math.min(maxVertexUniformVectors, rhi._options._maxAllowSkinUniformVectorCount);
|
|
23143
|
-
_this._maxVertexUniformVectors = maxVertexUniformVectors;
|
|
23144
|
-
_this._onLocalBoundsChanged = _this._onLocalBoundsChanged.bind(_this);
|
|
23145
|
-
_this._onSkinUpdated = _this._onSkinUpdated.bind(_this);
|
|
23146
|
-
var localBounds = _this._localBounds;
|
|
23147
|
-
// @ts-ignore
|
|
23148
|
-
localBounds.min._onValueChanged = _this._onLocalBoundsChanged;
|
|
23149
|
-
// @ts-ignore
|
|
23150
|
-
localBounds.max._onValueChanged = _this._onLocalBoundsChanged;
|
|
23151
|
-
return _this;
|
|
23152
|
-
}
|
|
23153
|
-
var _proto = SkinnedMeshRenderer.prototype;
|
|
23154
|
-
/**
|
|
23155
|
-
* @internal
|
|
23156
|
-
*/ _proto._onDestroy = function _onDestroy() {
|
|
23157
|
-
var _this__jointTexture;
|
|
23158
|
-
MeshRenderer.prototype._onDestroy.call(this);
|
|
23159
|
-
this._jointDataCreateCache = null;
|
|
23160
|
-
this._skin = null;
|
|
23161
|
-
this._blendShapeWeights = null;
|
|
23162
|
-
this._localBounds = null;
|
|
23163
|
-
(_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
|
|
23164
|
-
this._jointTexture = null;
|
|
23165
|
-
};
|
|
23166
|
-
/**
|
|
23167
|
-
* @internal
|
|
23168
|
-
*/ _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
|
|
23169
|
-
MeshRenderer.prototype._cloneTo.call(this, target, srcRoot, targetRoot);
|
|
23170
|
-
if (this.skin) {
|
|
23171
|
-
target._applySkin(null, target.skin);
|
|
23172
|
-
}
|
|
23173
|
-
this._blendShapeWeights && (target._blendShapeWeights = this._blendShapeWeights.slice());
|
|
23174
|
-
};
|
|
23175
|
-
_proto._update = function _update(context) {
|
|
23176
|
-
var skin = this.skin;
|
|
23177
|
-
if ((skin == null ? void 0 : skin.bones.length) > 0) {
|
|
23178
|
-
skin._updateSkinMatrices(this);
|
|
23179
|
-
}
|
|
23180
|
-
var shaderData = this.shaderData;
|
|
23181
|
-
var mesh = this.mesh;
|
|
23182
|
-
var blendShapeManager = mesh._blendShapeManager;
|
|
23183
|
-
blendShapeManager._updateShaderData(shaderData, this);
|
|
23184
|
-
var bones = skin == null ? void 0 : skin.bones;
|
|
23185
|
-
if (bones) {
|
|
23186
|
-
var bsUniformOccupiesCount = blendShapeManager._uniformOccupiesCount;
|
|
23187
|
-
var boneCount = bones.length;
|
|
23188
|
-
var boneDataCreateCache = this._jointDataCreateCache;
|
|
23189
|
-
var boneCountChange = boneCount !== boneDataCreateCache.x;
|
|
23190
|
-
if (boneCountChange || bsUniformOccupiesCount !== boneDataCreateCache.y) {
|
|
23191
|
-
// directly use max joint count to avoid shader recompile
|
|
23192
|
-
var remainUniformJointCount = Math.ceil((this._maxVertexUniformVectors - (SkinnedMeshRenderer._baseVertexUniformVectorCount + bsUniformOccupiesCount)) / 4);
|
|
23193
|
-
if (boneCount > remainUniformJointCount) {
|
|
23194
|
-
var engine = this.engine;
|
|
23195
|
-
if (engine._hardwareRenderer.canIUseMoreJoints) {
|
|
23196
|
-
if (boneCountChange) {
|
|
23197
|
-
var _this__jointTexture;
|
|
23198
|
-
(_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
|
|
23199
|
-
this._jointTexture = new Texture2D(engine, 4, boneCount, TextureFormat.R32G32B32A32, false, false);
|
|
23200
|
-
this._jointTexture.filterMode = TextureFilterMode.Point;
|
|
23201
|
-
this._jointTexture.isGCIgnored = true;
|
|
23202
|
-
}
|
|
23203
|
-
shaderData.disableMacro("RENDERER_JOINTS_NUM");
|
|
23204
|
-
shaderData.enableMacro("RENDERER_USE_JOINT_TEXTURE");
|
|
23205
|
-
shaderData.setTexture(SkinnedMeshRenderer._jointSamplerProperty, this._jointTexture);
|
|
23206
|
-
} else {
|
|
23207
|
-
Logger.error("component's joints count(" + boneCount + ") greater than device's MAX_VERTEX_UNIFORM_VECTORS number " + this._maxVertexUniformVectors + ", and don't support jointTexture in this device. suggest joint count less than " + remainUniformJointCount + ".", this);
|
|
23208
|
-
}
|
|
23209
|
-
} else {
|
|
23210
|
-
var _this__jointTexture1;
|
|
23211
|
-
(_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
|
|
23212
|
-
shaderData.disableMacro("RENDERER_USE_JOINT_TEXTURE");
|
|
23213
|
-
shaderData.enableMacro("RENDERER_JOINTS_NUM", remainUniformJointCount.toString());
|
|
23214
|
-
shaderData.setFloatArray(SkinnedMeshRenderer._jointMatrixProperty, skin._skinMatrices);
|
|
23215
|
-
}
|
|
23216
|
-
boneDataCreateCache.set(boneCount, bsUniformOccupiesCount);
|
|
23217
|
-
}
|
|
23218
|
-
if (this._jointTexture) {
|
|
23219
|
-
this._jointTexture.setPixelBuffer(skin._skinMatrices);
|
|
23220
|
-
}
|
|
23221
|
-
}
|
|
23222
|
-
MeshRenderer.prototype._update.call(this, context);
|
|
23223
|
-
};
|
|
23224
|
-
/**
|
|
23225
|
-
* @internal
|
|
23226
|
-
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
23227
|
-
var _this_skin;
|
|
23228
|
-
var rootBone = (_this_skin = this.skin) == null ? void 0 : _this_skin.rootBone;
|
|
23229
|
-
if (rootBone) {
|
|
23230
|
-
BoundingBox.transform(this._localBounds, this._transformEntity.transform.worldMatrix, worldBounds);
|
|
23231
|
-
} else {
|
|
23232
|
-
MeshRenderer.prototype._updateBounds.call(this, worldBounds);
|
|
23233
|
-
}
|
|
23234
|
-
};
|
|
23235
|
-
_proto._checkBlendShapeWeightLength = function _checkBlendShapeWeightLength() {
|
|
23236
|
-
var mesh = this._mesh;
|
|
23237
|
-
var newBlendShapeCount = mesh ? mesh.blendShapeCount : 0;
|
|
23238
|
-
var lastBlendShapeWeights = this._blendShapeWeights;
|
|
23239
|
-
if (lastBlendShapeWeights) {
|
|
23240
|
-
var lastBlendShapeWeightsCount = lastBlendShapeWeights.length;
|
|
23241
|
-
if (lastBlendShapeWeightsCount !== newBlendShapeCount) {
|
|
23242
|
-
var newBlendShapeWeights = new Float32Array(newBlendShapeCount);
|
|
23243
|
-
if (newBlendShapeCount > lastBlendShapeWeightsCount) {
|
|
23244
|
-
newBlendShapeWeights.set(lastBlendShapeWeights);
|
|
23245
|
-
} else {
|
|
23246
|
-
for(var i = 0; i < newBlendShapeCount; i++){
|
|
23247
|
-
newBlendShapeWeights[i] = lastBlendShapeWeights[i];
|
|
23248
|
-
}
|
|
23249
|
-
}
|
|
23250
|
-
this._blendShapeWeights = newBlendShapeWeights;
|
|
23251
|
-
}
|
|
23252
|
-
} else {
|
|
23253
|
-
this._blendShapeWeights = new Float32Array(newBlendShapeCount);
|
|
23254
|
-
}
|
|
23255
|
-
};
|
|
23256
|
-
_proto._onLocalBoundsChanged = function _onLocalBoundsChanged() {
|
|
23257
|
-
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
23258
|
-
};
|
|
23259
|
-
_proto._onSkinUpdated = function _onSkinUpdated(type, value) {
|
|
23260
|
-
switch(type){
|
|
23261
|
-
case SkinUpdateFlag.BoneCountChanged:
|
|
23262
|
-
var shaderData = this.shaderData;
|
|
23263
|
-
if (value > 0) {
|
|
23264
|
-
shaderData.enableMacro("RENDERER_HAS_SKIN");
|
|
23265
|
-
shaderData.setInt(SkinnedMeshRenderer._jointCountProperty, value);
|
|
23266
|
-
} else {
|
|
23267
|
-
shaderData.disableMacro("RENDERER_HAS_SKIN");
|
|
23268
|
-
}
|
|
23269
|
-
break;
|
|
23270
|
-
case SkinUpdateFlag.RootBoneChanged:
|
|
23271
|
-
this._setTransformEntity(value);
|
|
23272
|
-
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
23273
|
-
break;
|
|
23509
|
+
*/ Entity._removeFromChildren = function _removeFromChildren(children, entity) {
|
|
23510
|
+
var count = children.length - 1;
|
|
23511
|
+
for(var i = entity._siblingIndex; i < count; i++){
|
|
23512
|
+
var child = children[i + 1];
|
|
23513
|
+
children[i] = child;
|
|
23514
|
+
child._siblingIndex = i;
|
|
23274
23515
|
}
|
|
23516
|
+
children.length = count;
|
|
23517
|
+
entity._siblingIndex = -1;
|
|
23275
23518
|
};
|
|
23276
|
-
|
|
23277
|
-
|
|
23278
|
-
|
|
23279
|
-
var
|
|
23280
|
-
|
|
23281
|
-
|
|
23282
|
-
|
|
23283
|
-
|
|
23284
|
-
|
|
23285
|
-
|
|
23286
|
-
|
|
23287
|
-
|
|
23288
|
-
|
|
23289
|
-
|
|
23290
|
-
|
|
23291
|
-
|
|
23292
|
-
|
|
23519
|
+
/**
|
|
23520
|
+
* @internal
|
|
23521
|
+
*/ Entity._addToChildren = function _addToChildren(children, entity, index) {
|
|
23522
|
+
var childCount = children.length;
|
|
23523
|
+
children.length = childCount + 1;
|
|
23524
|
+
if (index === undefined) {
|
|
23525
|
+
children[childCount] = entity;
|
|
23526
|
+
entity._siblingIndex = childCount;
|
|
23527
|
+
} else {
|
|
23528
|
+
if (index < 0 || index > childCount) {
|
|
23529
|
+
throw "The index " + index + " is out of child list bounds " + childCount;
|
|
23530
|
+
}
|
|
23531
|
+
for(var i = childCount; i > index; i--){
|
|
23532
|
+
var swapChild = children[i - 1];
|
|
23533
|
+
swapChild._siblingIndex = i;
|
|
23534
|
+
children[i] = swapChild;
|
|
23535
|
+
}
|
|
23536
|
+
entity._siblingIndex = index;
|
|
23537
|
+
children[index] = entity;
|
|
23293
23538
|
}
|
|
23294
23539
|
};
|
|
23295
|
-
_create_class(
|
|
23540
|
+
_create_class(Entity, [
|
|
23296
23541
|
{
|
|
23297
|
-
key: "
|
|
23542
|
+
key: "transform",
|
|
23298
23543
|
get: /**
|
|
23299
|
-
*
|
|
23544
|
+
* The transform of this entity.
|
|
23300
23545
|
*/ function get() {
|
|
23301
|
-
return this.
|
|
23302
|
-
},
|
|
23303
|
-
set: function set(value) {
|
|
23304
|
-
var lastSkin = this._skin;
|
|
23305
|
-
if (lastSkin !== value) {
|
|
23306
|
-
this._applySkin(lastSkin, value);
|
|
23307
|
-
this._skin = value;
|
|
23308
|
-
}
|
|
23546
|
+
return this._transform;
|
|
23309
23547
|
}
|
|
23310
23548
|
},
|
|
23311
23549
|
{
|
|
23312
|
-
key: "
|
|
23550
|
+
key: "isActive",
|
|
23313
23551
|
get: /**
|
|
23314
|
-
*
|
|
23315
|
-
* @remarks Array index is BlendShape index.
|
|
23552
|
+
* Whether to activate locally.
|
|
23316
23553
|
*/ function get() {
|
|
23317
|
-
this.
|
|
23318
|
-
return this._blendShapeWeights;
|
|
23554
|
+
return this._isActive;
|
|
23319
23555
|
},
|
|
23320
23556
|
set: function set(value) {
|
|
23321
|
-
this.
|
|
23322
|
-
|
|
23323
|
-
|
|
23324
|
-
|
|
23325
|
-
|
|
23326
|
-
|
|
23327
|
-
|
|
23557
|
+
if (value !== this._isActive) {
|
|
23558
|
+
this._isActive = value;
|
|
23559
|
+
if (value) {
|
|
23560
|
+
var parent = this._parent;
|
|
23561
|
+
var activeChangeFlag = ActiveChangeFlag.None;
|
|
23562
|
+
if (this._isRoot && this._scene._isActiveInEngine) {
|
|
23563
|
+
activeChangeFlag |= ActiveChangeFlag.All;
|
|
23564
|
+
} else {
|
|
23565
|
+
(parent == null ? void 0 : parent._isActiveInHierarchy) && (activeChangeFlag |= ActiveChangeFlag.Hierarchy);
|
|
23566
|
+
(parent == null ? void 0 : parent._isActiveInScene) && (activeChangeFlag |= ActiveChangeFlag.Scene);
|
|
23567
|
+
}
|
|
23568
|
+
activeChangeFlag && this._processActive(activeChangeFlag);
|
|
23569
|
+
} else {
|
|
23570
|
+
var activeChangeFlag1 = ActiveChangeFlag.None;
|
|
23571
|
+
this._isActiveInHierarchy && (activeChangeFlag1 |= ActiveChangeFlag.Hierarchy);
|
|
23572
|
+
this._isActiveInScene && (activeChangeFlag1 |= ActiveChangeFlag.Scene);
|
|
23573
|
+
activeChangeFlag1 && this._processInActive(activeChangeFlag1);
|
|
23328
23574
|
}
|
|
23329
23575
|
}
|
|
23330
23576
|
}
|
|
23331
23577
|
},
|
|
23332
23578
|
{
|
|
23333
|
-
key: "
|
|
23579
|
+
key: "isActiveInHierarchy",
|
|
23334
23580
|
get: /**
|
|
23335
|
-
*
|
|
23581
|
+
* Whether it is active in the hierarchy.
|
|
23336
23582
|
*/ function get() {
|
|
23337
|
-
return this.
|
|
23338
|
-
},
|
|
23339
|
-
set: function set(value) {
|
|
23340
|
-
if (this._localBounds !== value) {
|
|
23341
|
-
this._localBounds.copyFrom(value);
|
|
23342
|
-
}
|
|
23583
|
+
return this._isActiveInHierarchy;
|
|
23343
23584
|
}
|
|
23344
23585
|
},
|
|
23345
23586
|
{
|
|
23346
|
-
key: "
|
|
23587
|
+
key: "parent",
|
|
23347
23588
|
get: /**
|
|
23348
|
-
*
|
|
23589
|
+
* The parent entity.
|
|
23349
23590
|
*/ function get() {
|
|
23350
|
-
return this.
|
|
23591
|
+
return this._parent;
|
|
23351
23592
|
},
|
|
23352
23593
|
set: function set(value) {
|
|
23353
|
-
this.
|
|
23594
|
+
this._setParent(value);
|
|
23354
23595
|
}
|
|
23355
23596
|
},
|
|
23356
23597
|
{
|
|
23357
|
-
key: "
|
|
23598
|
+
key: "children",
|
|
23358
23599
|
get: /**
|
|
23359
|
-
*
|
|
23600
|
+
* The children entities
|
|
23360
23601
|
*/ function get() {
|
|
23361
|
-
return this.
|
|
23362
|
-
},
|
|
23363
|
-
set: function set(value) {
|
|
23364
|
-
this.skin.bones = value;
|
|
23365
|
-
}
|
|
23366
|
-
}
|
|
23367
|
-
]);
|
|
23368
|
-
return SkinnedMeshRenderer;
|
|
23369
|
-
}(MeshRenderer);
|
|
23370
|
-
// @TODO: different shader type should use different count, not always 48
|
|
23371
|
-
/** @internal */ SkinnedMeshRenderer._baseVertexUniformVectorCount = 48;
|
|
23372
|
-
SkinnedMeshRenderer._jointCountProperty = ShaderProperty.getByName("renderer_JointCount");
|
|
23373
|
-
SkinnedMeshRenderer._jointSamplerProperty = ShaderProperty.getByName("renderer_JointSampler");
|
|
23374
|
-
SkinnedMeshRenderer._jointMatrixProperty = ShaderProperty.getByName("renderer_JointMatrix");
|
|
23375
|
-
__decorate([
|
|
23376
|
-
ignoreClone
|
|
23377
|
-
], SkinnedMeshRenderer.prototype, "_condensedBlendShapeWeights", void 0);
|
|
23378
|
-
__decorate([
|
|
23379
|
-
deepClone
|
|
23380
|
-
], SkinnedMeshRenderer.prototype, "_localBounds", void 0);
|
|
23381
|
-
__decorate([
|
|
23382
|
-
ignoreClone
|
|
23383
|
-
], SkinnedMeshRenderer.prototype, "_jointDataCreateCache", void 0);
|
|
23384
|
-
__decorate([
|
|
23385
|
-
ignoreClone
|
|
23386
|
-
], SkinnedMeshRenderer.prototype, "_blendShapeWeights", void 0);
|
|
23387
|
-
__decorate([
|
|
23388
|
-
ignoreClone
|
|
23389
|
-
], SkinnedMeshRenderer.prototype, "_maxVertexUniformVectors", void 0);
|
|
23390
|
-
__decorate([
|
|
23391
|
-
ignoreClone
|
|
23392
|
-
], SkinnedMeshRenderer.prototype, "_jointTexture", void 0);
|
|
23393
|
-
__decorate([
|
|
23394
|
-
deepClone
|
|
23395
|
-
], SkinnedMeshRenderer.prototype, "_skin", void 0);
|
|
23396
|
-
__decorate([
|
|
23397
|
-
ignoreClone
|
|
23398
|
-
], SkinnedMeshRenderer.prototype, "_onLocalBoundsChanged", null);
|
|
23399
|
-
__decorate([
|
|
23400
|
-
ignoreClone
|
|
23401
|
-
], SkinnedMeshRenderer.prototype, "_onSkinUpdated", null);
|
|
23402
|
-
|
|
23403
|
-
/**
|
|
23404
|
-
* @internal
|
|
23405
|
-
*/ var BasicResources = /*#__PURE__*/ function() {
|
|
23406
|
-
function BasicResources(engine) {
|
|
23407
|
-
this.engine = engine;
|
|
23408
|
-
// prettier-ignore
|
|
23409
|
-
var vertices = new Float32Array([
|
|
23410
|
-
-1,
|
|
23411
|
-
-1,
|
|
23412
|
-
0,
|
|
23413
|
-
1,
|
|
23414
|
-
3,
|
|
23415
|
-
-1,
|
|
23416
|
-
2,
|
|
23417
|
-
1,
|
|
23418
|
-
-1,
|
|
23419
|
-
3,
|
|
23420
|
-
0,
|
|
23421
|
-
-1
|
|
23422
|
-
]); // left-top
|
|
23423
|
-
// prettier-ignore
|
|
23424
|
-
var flipYVertices = new Float32Array([
|
|
23425
|
-
3,
|
|
23426
|
-
-1,
|
|
23427
|
-
2,
|
|
23428
|
-
0,
|
|
23429
|
-
-1,
|
|
23430
|
-
-1,
|
|
23431
|
-
0,
|
|
23432
|
-
0,
|
|
23433
|
-
-1,
|
|
23434
|
-
3,
|
|
23435
|
-
0,
|
|
23436
|
-
2
|
|
23437
|
-
]); // left-top
|
|
23438
|
-
var blitMaterial = new Material(engine, Shader.find("blit"));
|
|
23439
|
-
blitMaterial._addReferCount(1);
|
|
23440
|
-
blitMaterial.renderState.depthState.enabled = false;
|
|
23441
|
-
blitMaterial.renderState.depthState.writeEnabled = false;
|
|
23442
|
-
var blitScreenMaterial = new Material(engine, Shader.find("blit-screen"));
|
|
23443
|
-
blitScreenMaterial._addReferCount(1);
|
|
23444
|
-
blitScreenMaterial.renderState.depthState.enabled = false;
|
|
23445
|
-
blitScreenMaterial.renderState.depthState.writeEnabled = false;
|
|
23446
|
-
this.blitMaterial = blitMaterial;
|
|
23447
|
-
this.blitScreenMaterial = blitScreenMaterial;
|
|
23448
|
-
this.blitMesh = this._createBlitMesh(engine, vertices);
|
|
23449
|
-
this.flipYBlitMesh = this._createBlitMesh(engine, flipYVertices);
|
|
23450
|
-
// Create white and magenta textures
|
|
23451
|
-
var whitePixel = new Uint8Array([
|
|
23452
|
-
255,
|
|
23453
|
-
255,
|
|
23454
|
-
255,
|
|
23455
|
-
255
|
|
23456
|
-
]);
|
|
23457
|
-
this.whiteTexture2D = this._create1x1Texture(engine, 0, TextureFormat.R8G8B8A8, whitePixel, true);
|
|
23458
|
-
this.whiteTextureCube = this._create1x1Texture(engine, 1, TextureFormat.R8G8B8A8, whitePixel, true);
|
|
23459
|
-
var isWebGL2 = engine._hardwareRenderer.isWebGL2;
|
|
23460
|
-
if (isWebGL2) {
|
|
23461
|
-
this.whiteTexture2DArray = this._create1x1Texture(engine, 2, TextureFormat.R8G8B8A8, whitePixel, true);
|
|
23462
|
-
var whitePixel32 = new Uint32Array([
|
|
23463
|
-
255,
|
|
23464
|
-
255,
|
|
23465
|
-
255,
|
|
23466
|
-
255
|
|
23467
|
-
]);
|
|
23468
|
-
this.uintWhiteTexture2D = this._create1x1Texture(engine, 0, TextureFormat.R32G32B32A32_UInt, whitePixel32, false);
|
|
23469
|
-
}
|
|
23470
|
-
this.spriteDefaultMaterial = this._create2DMaterial(engine, Shader.find("Sprite"));
|
|
23471
|
-
this.textDefaultMaterial = this._create2DMaterial(engine, Shader.find("Text"));
|
|
23472
|
-
this.spriteMaskDefaultMaterial = this._createSpriteMaskMaterial(engine);
|
|
23473
|
-
this.meshMagentaMaterial = this._createMagentaMaterial(engine, "unlit");
|
|
23474
|
-
this.particleMagentaMaterial = this._createMagentaMaterial(engine, "particle-shader");
|
|
23475
|
-
}
|
|
23476
|
-
var _proto = BasicResources.prototype;
|
|
23477
|
-
/**
|
|
23478
|
-
* @internal
|
|
23479
|
-
*/ _proto._getBlinnPhongMaterial = function _getBlinnPhongMaterial() {
|
|
23480
|
-
return this._blinnPhongMaterial || (this._blinnPhongMaterial = new BlinnPhongMaterial(this.engine));
|
|
23481
|
-
};
|
|
23482
|
-
/**
|
|
23483
|
-
* @internal
|
|
23484
|
-
*/ _proto._initialize = function _initialize() {
|
|
23485
|
-
var _this = this;
|
|
23486
|
-
return new Promise(function(resolve, reject) {
|
|
23487
|
-
PrefilteredDFG.create(_this.engine).then(function(texture) {
|
|
23488
|
-
_this._prefilteredDFGTexture = texture;
|
|
23489
|
-
resolve(_this);
|
|
23490
|
-
}).catch(reject);
|
|
23491
|
-
});
|
|
23492
|
-
};
|
|
23493
|
-
_proto._createBlitMesh = function _createBlitMesh(engine, vertices) {
|
|
23494
|
-
var mesh = new ModelMesh(engine);
|
|
23495
|
-
mesh._addReferCount(1);
|
|
23496
|
-
mesh.setVertexElements([
|
|
23497
|
-
new VertexElement("POSITION_UV", 0, VertexElementFormat.Vector4, 0)
|
|
23498
|
-
]);
|
|
23499
|
-
var buffer = new Buffer(engine, BufferBindFlag.VertexBuffer, vertices, BufferUsage.Static, true);
|
|
23500
|
-
mesh.setVertexBufferBinding(buffer, 16);
|
|
23501
|
-
mesh.addSubMesh(0, 3, MeshTopology.Triangles);
|
|
23502
|
-
engine.resourceManager.addContentRestorer(new (/*#__PURE__*/ function(ContentRestorer) {
|
|
23503
|
-
_inherits(_class, ContentRestorer);
|
|
23504
|
-
function _class() {
|
|
23505
|
-
return ContentRestorer.call(this, mesh) || this;
|
|
23506
|
-
}
|
|
23507
|
-
var _proto = _class.prototype;
|
|
23508
|
-
_proto.restoreContent = function restoreContent() {
|
|
23509
|
-
buffer.setData(buffer.data);
|
|
23510
|
-
};
|
|
23511
|
-
return _class;
|
|
23512
|
-
}(ContentRestorer))());
|
|
23513
|
-
return mesh;
|
|
23514
|
-
};
|
|
23515
|
-
_proto._create1x1Texture = function _create1x1Texture(engine, type, format, pixel, isSRGBColorSpace) {
|
|
23516
|
-
var texture;
|
|
23517
|
-
switch(type){
|
|
23518
|
-
case 0:
|
|
23519
|
-
var texture2D = new Texture2D(engine, 1, 1, format, false, isSRGBColorSpace);
|
|
23520
|
-
texture2D.setPixelBuffer(pixel);
|
|
23521
|
-
texture = texture2D;
|
|
23522
|
-
break;
|
|
23523
|
-
case 2:
|
|
23524
|
-
var texture2DArray = new Texture2DArray(engine, 1, 1, 1, format, false, isSRGBColorSpace);
|
|
23525
|
-
texture2DArray.setPixelBuffer(0, pixel);
|
|
23526
|
-
texture = texture2DArray;
|
|
23527
|
-
break;
|
|
23528
|
-
case 1:
|
|
23529
|
-
var textureCube = new TextureCube(engine, 1, format, false, isSRGBColorSpace);
|
|
23530
|
-
for(var i = 0; i < 6; i++){
|
|
23531
|
-
textureCube.setPixelBuffer(TextureCubeFace.PositiveX + i, pixel);
|
|
23532
|
-
}
|
|
23533
|
-
texture = textureCube;
|
|
23534
|
-
break;
|
|
23535
|
-
default:
|
|
23536
|
-
throw "Invalid texture type";
|
|
23537
|
-
}
|
|
23538
|
-
texture.isGCIgnored = true;
|
|
23539
|
-
engine.resourceManager.addContentRestorer(new (/*#__PURE__*/ function(ContentRestorer) {
|
|
23540
|
-
_inherits(_class, ContentRestorer);
|
|
23541
|
-
function _class() {
|
|
23542
|
-
return ContentRestorer.call(this, texture) || this;
|
|
23543
|
-
}
|
|
23544
|
-
var _proto = _class.prototype;
|
|
23545
|
-
_proto.restoreContent = function restoreContent() {
|
|
23546
|
-
switch(type){
|
|
23547
|
-
case 0:
|
|
23548
|
-
this.resource.setPixelBuffer(pixel);
|
|
23549
|
-
break;
|
|
23550
|
-
case 2:
|
|
23551
|
-
this.resource.setPixelBuffer(0, pixel);
|
|
23552
|
-
break;
|
|
23553
|
-
case 1:
|
|
23554
|
-
for(var i = 0; i < 6; i++){
|
|
23555
|
-
this.resource.setPixelBuffer(TextureCubeFace.PositiveX + i, pixel);
|
|
23556
|
-
}
|
|
23557
|
-
break;
|
|
23558
|
-
}
|
|
23559
|
-
};
|
|
23560
|
-
return _class;
|
|
23561
|
-
}(ContentRestorer))());
|
|
23562
|
-
return texture;
|
|
23563
|
-
};
|
|
23564
|
-
_proto._create2DMaterial = function _create2DMaterial(engine, shader) {
|
|
23565
|
-
var material = new Material(engine, shader);
|
|
23566
|
-
var renderState = material.renderState;
|
|
23567
|
-
var target = renderState.blendState.targetBlendState;
|
|
23568
|
-
target.enabled = true;
|
|
23569
|
-
target.sourceColorBlendFactor = BlendFactor.SourceAlpha;
|
|
23570
|
-
target.destinationColorBlendFactor = BlendFactor.OneMinusSourceAlpha;
|
|
23571
|
-
target.sourceAlphaBlendFactor = BlendFactor.One;
|
|
23572
|
-
target.destinationAlphaBlendFactor = BlendFactor.OneMinusSourceAlpha;
|
|
23573
|
-
target.colorBlendOperation = target.alphaBlendOperation = BlendOperation.Add;
|
|
23574
|
-
renderState.depthState.writeEnabled = false;
|
|
23575
|
-
renderState.rasterState.cullMode = CullMode.Off;
|
|
23576
|
-
renderState.renderQueueType = RenderQueueType.Transparent;
|
|
23577
|
-
material.isGCIgnored = true;
|
|
23578
|
-
return material;
|
|
23579
|
-
};
|
|
23580
|
-
_proto._createMagentaMaterial = function _createMagentaMaterial(engine, shaderName) {
|
|
23581
|
-
var material = new Material(engine, Shader.find(shaderName));
|
|
23582
|
-
material.isGCIgnored = true;
|
|
23583
|
-
material.shaderData.setColor("material_BaseColor", new Color(1.0, 0.0, 1.01, 1.0));
|
|
23584
|
-
return material;
|
|
23585
|
-
};
|
|
23586
|
-
_proto._createSpriteMaskMaterial = function _createSpriteMaskMaterial(engine) {
|
|
23587
|
-
var material = new Material(engine, Shader.find("SpriteMask"));
|
|
23588
|
-
material.isGCIgnored = true;
|
|
23589
|
-
return material;
|
|
23590
|
-
};
|
|
23591
|
-
BasicResources.getMaskInteractionRenderStates = function getMaskInteractionRenderStates(maskInteraction) {
|
|
23592
|
-
var visibleInsideMask = maskInteraction === SpriteMaskInteraction.VisibleInsideMask;
|
|
23593
|
-
var renderStates;
|
|
23594
|
-
var compareFunction;
|
|
23595
|
-
if (visibleInsideMask) {
|
|
23596
|
-
renderStates = BasicResources._maskReadInsideRenderStates;
|
|
23597
|
-
if (renderStates) {
|
|
23598
|
-
return renderStates;
|
|
23599
|
-
}
|
|
23600
|
-
BasicResources._maskReadInsideRenderStates = renderStates = {};
|
|
23601
|
-
compareFunction = CompareFunction.LessEqual;
|
|
23602
|
-
} else {
|
|
23603
|
-
renderStates = BasicResources._maskReadOutsideRenderStates;
|
|
23604
|
-
if (renderStates) {
|
|
23605
|
-
return renderStates;
|
|
23602
|
+
return this._children;
|
|
23606
23603
|
}
|
|
23607
|
-
|
|
23608
|
-
|
|
23609
|
-
|
|
23610
|
-
|
|
23611
|
-
|
|
23612
|
-
|
|
23613
|
-
|
|
23614
|
-
|
|
23615
|
-
return renderStates;
|
|
23616
|
-
};
|
|
23617
|
-
BasicResources.getMaskTypeRenderStates = function getMaskTypeRenderStates(maskType) {
|
|
23618
|
-
var isIncrement = maskType === RenderQueueMaskType.Increment;
|
|
23619
|
-
var renderStates;
|
|
23620
|
-
var passOperation;
|
|
23621
|
-
if (isIncrement) {
|
|
23622
|
-
renderStates = BasicResources._maskWriteIncrementRenderStates;
|
|
23623
|
-
if (renderStates) {
|
|
23624
|
-
return renderStates;
|
|
23604
|
+
},
|
|
23605
|
+
{
|
|
23606
|
+
key: "childCount",
|
|
23607
|
+
get: /**
|
|
23608
|
+
* @deprecated Please use `children.length` property instead.
|
|
23609
|
+
* Number of the children entities
|
|
23610
|
+
*/ function get() {
|
|
23611
|
+
return this._children.length;
|
|
23625
23612
|
}
|
|
23626
|
-
|
|
23627
|
-
|
|
23628
|
-
|
|
23629
|
-
|
|
23630
|
-
|
|
23631
|
-
|
|
23613
|
+
},
|
|
23614
|
+
{
|
|
23615
|
+
key: "scene",
|
|
23616
|
+
get: /**
|
|
23617
|
+
* The scene the entity belongs to.
|
|
23618
|
+
*/ function get() {
|
|
23619
|
+
return this._scene;
|
|
23632
23620
|
}
|
|
23633
|
-
|
|
23634
|
-
passOperation = StencilOperation.DecrementSaturate;
|
|
23635
|
-
}
|
|
23636
|
-
renderStates[RenderStateElementKey.StencilStateEnabled] = true;
|
|
23637
|
-
renderStates[RenderStateElementKey.StencilStatePassOperationFront] = passOperation;
|
|
23638
|
-
renderStates[RenderStateElementKey.StencilStatePassOperationBack] = passOperation;
|
|
23639
|
-
renderStates[RenderStateElementKey.StencilStateCompareFunctionFront] = CompareFunction.Always;
|
|
23640
|
-
renderStates[RenderStateElementKey.StencilStateCompareFunctionBack] = CompareFunction.Always;
|
|
23641
|
-
var failStencilOperation = StencilOperation.Keep;
|
|
23642
|
-
renderStates[RenderStateElementKey.StencilStateFailOperationFront] = failStencilOperation;
|
|
23643
|
-
renderStates[RenderStateElementKey.StencilStateFailOperationBack] = failStencilOperation;
|
|
23644
|
-
renderStates[RenderStateElementKey.StencilStateZFailOperationFront] = failStencilOperation;
|
|
23645
|
-
renderStates[RenderStateElementKey.StencilStateZFailOperationBack] = failStencilOperation;
|
|
23646
|
-
renderStates[RenderStateElementKey.BlendStateColorWriteMask0] = ColorWriteMask.None;
|
|
23647
|
-
renderStates[RenderStateElementKey.DepthStateEnabled] = false;
|
|
23648
|
-
renderStates[RenderStateElementKey.RasterStateCullMode] = CullMode.Off;
|
|
23649
|
-
return renderStates;
|
|
23650
|
-
};
|
|
23651
|
-
_create_class(BasicResources, [
|
|
23621
|
+
},
|
|
23652
23622
|
{
|
|
23653
|
-
key: "
|
|
23654
|
-
get:
|
|
23655
|
-
|
|
23623
|
+
key: "siblingIndex",
|
|
23624
|
+
get: /**
|
|
23625
|
+
* The sibling index.
|
|
23626
|
+
*/ function get() {
|
|
23627
|
+
return this._siblingIndex;
|
|
23628
|
+
},
|
|
23629
|
+
set: function set(value) {
|
|
23630
|
+
if (this._siblingIndex === -1) {
|
|
23631
|
+
throw "The entity " + this.name + " is not in the hierarchy";
|
|
23632
|
+
}
|
|
23633
|
+
if (this._isRoot) {
|
|
23634
|
+
this._setSiblingIndex(this._scene._rootEntities, value);
|
|
23635
|
+
} else {
|
|
23636
|
+
var parent = this._parent;
|
|
23637
|
+
this._setSiblingIndex(parent._children, value);
|
|
23638
|
+
parent._dispatchModify(EntityModifyFlags.Child, parent);
|
|
23639
|
+
}
|
|
23656
23640
|
}
|
|
23657
23641
|
}
|
|
23658
23642
|
]);
|
|
23659
|
-
return
|
|
23660
|
-
}();
|
|
23661
|
-
|
|
23662
|
-
BasicResources._maskReadOutsideRenderStates = null;
|
|
23663
|
-
BasicResources._maskWriteIncrementRenderStates = null;
|
|
23664
|
-
BasicResources._maskWriteDecrementRenderStates = null;
|
|
23643
|
+
return Entity;
|
|
23644
|
+
}(EngineObject);
|
|
23645
|
+
/** @internal */ Entity._tempComponentConstructors = [];
|
|
23665
23646
|
|
|
23666
23647
|
var ObjectPool = /*#__PURE__*/ function() {
|
|
23667
23648
|
function ObjectPool(type) {
|
|
@@ -29026,6 +29007,184 @@ var PointerMethods = /*#__PURE__*/ function(PointerMethods) {
|
|
|
29026
29007
|
return PointerMethods;
|
|
29027
29008
|
}({});
|
|
29028
29009
|
|
|
29010
|
+
/**
|
|
29011
|
+
* Signal is a typed event mechanism for Galacean Engine.
|
|
29012
|
+
* @typeParam T - Tuple type of the signal arguments
|
|
29013
|
+
*/ var Signal = /*#__PURE__*/ function() {
|
|
29014
|
+
function Signal() {
|
|
29015
|
+
this._listeners = new SafeLoopArray();
|
|
29016
|
+
}
|
|
29017
|
+
var _proto = Signal.prototype;
|
|
29018
|
+
_proto.on = function on(fnOrTarget, targetOrMethodName) {
|
|
29019
|
+
for(var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
|
|
29020
|
+
args[_key - 2] = arguments[_key];
|
|
29021
|
+
}
|
|
29022
|
+
this._addListener.apply(this, [].concat([
|
|
29023
|
+
fnOrTarget,
|
|
29024
|
+
targetOrMethodName,
|
|
29025
|
+
false
|
|
29026
|
+
], args));
|
|
29027
|
+
};
|
|
29028
|
+
_proto.once = function once(fnOrTarget, targetOrMethodName) {
|
|
29029
|
+
for(var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
|
|
29030
|
+
args[_key - 2] = arguments[_key];
|
|
29031
|
+
}
|
|
29032
|
+
this._addListener.apply(this, [].concat([
|
|
29033
|
+
fnOrTarget,
|
|
29034
|
+
targetOrMethodName,
|
|
29035
|
+
true
|
|
29036
|
+
], args));
|
|
29037
|
+
};
|
|
29038
|
+
_proto.off = function off(fnOrTarget, targetOrMethodName) {
|
|
29039
|
+
if (typeof fnOrTarget === "function") {
|
|
29040
|
+
var target = targetOrMethodName != null ? targetOrMethodName : null;
|
|
29041
|
+
this._listeners.findAndRemove(function(listener) {
|
|
29042
|
+
if (listener.fn === fnOrTarget && listener.target === target) {
|
|
29043
|
+
listener.destroyed = true;
|
|
29044
|
+
return true;
|
|
29045
|
+
}
|
|
29046
|
+
return false;
|
|
29047
|
+
});
|
|
29048
|
+
} else {
|
|
29049
|
+
var target1 = fnOrTarget;
|
|
29050
|
+
var methodName = targetOrMethodName;
|
|
29051
|
+
this._listeners.findAndRemove(function(listener) {
|
|
29052
|
+
if (listener.target === target1 && listener.methodName === methodName) {
|
|
29053
|
+
listener.destroyed = true;
|
|
29054
|
+
return true;
|
|
29055
|
+
}
|
|
29056
|
+
return false;
|
|
29057
|
+
});
|
|
29058
|
+
}
|
|
29059
|
+
};
|
|
29060
|
+
/**
|
|
29061
|
+
* Remove all listeners, or all listeners for a specific target.
|
|
29062
|
+
* @param target - If provided, only remove listeners bound to this target
|
|
29063
|
+
*/ _proto.removeAll = function removeAll(target) {
|
|
29064
|
+
if (target !== undefined) {
|
|
29065
|
+
this._listeners.findAndRemove(function(listener) {
|
|
29066
|
+
if (listener.target === target) {
|
|
29067
|
+
return listener.destroyed = true;
|
|
29068
|
+
}
|
|
29069
|
+
return false;
|
|
29070
|
+
});
|
|
29071
|
+
} else {
|
|
29072
|
+
this._listeners.findAndRemove(function(listener) {
|
|
29073
|
+
return listener.destroyed = true;
|
|
29074
|
+
});
|
|
29075
|
+
}
|
|
29076
|
+
};
|
|
29077
|
+
/**
|
|
29078
|
+
* Invoke the signal, calling all listeners in order.
|
|
29079
|
+
* @param args - Arguments to pass to each listener
|
|
29080
|
+
*/ _proto.invoke = function invoke() {
|
|
29081
|
+
var _this, _loop = function(i, n) {
|
|
29082
|
+
var listener = listeners[i];
|
|
29083
|
+
if (listener.destroyed) return "continue";
|
|
29084
|
+
if (listener.methodName && listener.target.destroyed) {
|
|
29085
|
+
listener.destroyed = true;
|
|
29086
|
+
_this._listeners.findAndRemove(function(l) {
|
|
29087
|
+
return l === listener;
|
|
29088
|
+
});
|
|
29089
|
+
return "continue";
|
|
29090
|
+
}
|
|
29091
|
+
listener.fn.apply(listener.target, args);
|
|
29092
|
+
if (listener.once) {
|
|
29093
|
+
listener.destroyed = true;
|
|
29094
|
+
_this._listeners.findAndRemove(function(l) {
|
|
29095
|
+
return l === listener;
|
|
29096
|
+
});
|
|
29097
|
+
}
|
|
29098
|
+
};
|
|
29099
|
+
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
29100
|
+
args[_key] = arguments[_key];
|
|
29101
|
+
}
|
|
29102
|
+
var listeners = this._listeners.getLoopArray();
|
|
29103
|
+
for(var i = 0, n = listeners.length; i < n; i++)_this = this, _loop(i);
|
|
29104
|
+
};
|
|
29105
|
+
/**
|
|
29106
|
+
* @internal
|
|
29107
|
+
* Clone listeners to target signal, remapping entity/component references.
|
|
29108
|
+
*/ _proto._cloneTo = function _cloneTo(target, srcRoot, targetRoot) {
|
|
29109
|
+
var listeners = this._listeners.getLoopArray();
|
|
29110
|
+
for(var i = 0, n = listeners.length; i < n; i++){
|
|
29111
|
+
var listener = listeners[i];
|
|
29112
|
+
if (listener.destroyed || !listener.methodName) continue;
|
|
29113
|
+
var clonedTarget = CloneUtils.remapComponent(srcRoot, targetRoot, listener.target);
|
|
29114
|
+
if (clonedTarget) {
|
|
29115
|
+
var clonedArgs = this._cloneArguments(listener.arguments, srcRoot, targetRoot);
|
|
29116
|
+
if (listener.once) {
|
|
29117
|
+
var _target;
|
|
29118
|
+
(_target = target).once.apply(_target, [].concat([
|
|
29119
|
+
clonedTarget,
|
|
29120
|
+
listener.methodName
|
|
29121
|
+
], clonedArgs));
|
|
29122
|
+
} else {
|
|
29123
|
+
var _target1;
|
|
29124
|
+
(_target1 = target).on.apply(_target1, [].concat([
|
|
29125
|
+
clonedTarget,
|
|
29126
|
+
listener.methodName
|
|
29127
|
+
], clonedArgs));
|
|
29128
|
+
}
|
|
29129
|
+
}
|
|
29130
|
+
}
|
|
29131
|
+
};
|
|
29132
|
+
_proto._cloneArguments = function _cloneArguments(args, srcRoot, targetRoot) {
|
|
29133
|
+
if (!args || args.length === 0) return [];
|
|
29134
|
+
var len = args.length;
|
|
29135
|
+
var clonedArgs = new Array(len);
|
|
29136
|
+
for(var i = 0; i < len; i++){
|
|
29137
|
+
var arg = args[i];
|
|
29138
|
+
if (_instanceof(arg, Entity)) {
|
|
29139
|
+
clonedArgs[i] = CloneUtils.remapEntity(srcRoot, targetRoot, arg);
|
|
29140
|
+
} else if (_instanceof(arg, Component)) {
|
|
29141
|
+
clonedArgs[i] = CloneUtils.remapComponent(srcRoot, targetRoot, arg);
|
|
29142
|
+
} else {
|
|
29143
|
+
clonedArgs[i] = arg;
|
|
29144
|
+
}
|
|
29145
|
+
}
|
|
29146
|
+
return clonedArgs;
|
|
29147
|
+
};
|
|
29148
|
+
_proto._addListener = function _addListener(fnOrTarget, targetOrMethodName, once) {
|
|
29149
|
+
for(var _len = arguments.length, args = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++){
|
|
29150
|
+
args[_key - 3] = arguments[_key];
|
|
29151
|
+
}
|
|
29152
|
+
if (typeof fnOrTarget === "function") {
|
|
29153
|
+
this._listeners.push({
|
|
29154
|
+
fn: fnOrTarget,
|
|
29155
|
+
target: targetOrMethodName != null ? targetOrMethodName : null,
|
|
29156
|
+
once: once
|
|
29157
|
+
});
|
|
29158
|
+
} else {
|
|
29159
|
+
var _target, _target1;
|
|
29160
|
+
var target = fnOrTarget;
|
|
29161
|
+
var methodName = targetOrMethodName;
|
|
29162
|
+
var fn = args.length > 0 ? function() {
|
|
29163
|
+
for(var _len = arguments.length, signalArgs = new Array(_len), _key = 0; _key < _len; _key++){
|
|
29164
|
+
signalArgs[_key] = arguments[_key];
|
|
29165
|
+
}
|
|
29166
|
+
return (_target = target)[methodName].apply(_target, [].concat(args, signalArgs));
|
|
29167
|
+
} : function() {
|
|
29168
|
+
for(var _len = arguments.length, signalArgs = new Array(_len), _key = 0; _key < _len; _key++){
|
|
29169
|
+
signalArgs[_key] = arguments[_key];
|
|
29170
|
+
}
|
|
29171
|
+
return (_target1 = target)[methodName].apply(_target1, [].concat(signalArgs));
|
|
29172
|
+
};
|
|
29173
|
+
this._listeners.push({
|
|
29174
|
+
fn: fn,
|
|
29175
|
+
target: target,
|
|
29176
|
+
once: once,
|
|
29177
|
+
methodName: methodName,
|
|
29178
|
+
arguments: args
|
|
29179
|
+
});
|
|
29180
|
+
}
|
|
29181
|
+
};
|
|
29182
|
+
return Signal;
|
|
29183
|
+
}();
|
|
29184
|
+
__decorate([
|
|
29185
|
+
ignoreClone
|
|
29186
|
+
], Signal.prototype, "_listeners", void 0);
|
|
29187
|
+
|
|
29029
29188
|
/**
|
|
29030
29189
|
* Loader abstract class.
|
|
29031
29190
|
*/ var Loader = /*#__PURE__*/ function() {
|
|
@@ -31144,7 +31303,7 @@ function _type_of(obj) {
|
|
|
31144
31303
|
};
|
|
31145
31304
|
/**
|
|
31146
31305
|
* @internal
|
|
31147
|
-
*/ _proto._cloneTo = function _cloneTo(target
|
|
31306
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
31148
31307
|
var animatorController = target._animatorController;
|
|
31149
31308
|
if (animatorController) {
|
|
31150
31309
|
target._addResourceReferCount(animatorController, 1);
|
|
@@ -36295,9 +36454,6 @@ __decorate([
|
|
|
36295
36454
|
__decorate([
|
|
36296
36455
|
ignoreClone
|
|
36297
36456
|
], ParticleGenerator.prototype, "_subPrimitive", void 0);
|
|
36298
|
-
__decorate([
|
|
36299
|
-
ignoreClone
|
|
36300
|
-
], ParticleGenerator.prototype, "_renderer", void 0);
|
|
36301
36457
|
__decorate([
|
|
36302
36458
|
ignoreClone
|
|
36303
36459
|
], ParticleGenerator.prototype, "_isPlaying", void 0);
|
|
@@ -37036,7 +37192,7 @@ ConeShape._tempVector31 = new Vector3();
|
|
|
37036
37192
|
};
|
|
37037
37193
|
/**
|
|
37038
37194
|
* @internal
|
|
37039
|
-
*/ _proto._cloneTo = function _cloneTo(target
|
|
37195
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
37040
37196
|
target.mesh = this._mesh;
|
|
37041
37197
|
};
|
|
37042
37198
|
_create_class(MeshShape, [
|
|
@@ -38016,7 +38172,7 @@ AudioManager._needsUserGestureResume = false;
|
|
|
38016
38172
|
};
|
|
38017
38173
|
/**
|
|
38018
38174
|
* @internal
|
|
38019
|
-
*/ _proto._cloneTo = function _cloneTo(target
|
|
38175
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
38020
38176
|
var _target__clip;
|
|
38021
38177
|
(_target__clip = target._clip) == null ? void 0 : _target__clip._addReferCount(1);
|
|
38022
38178
|
target._gainNode.gain.setValueAtTime(target._volume, AudioManager.getContext().currentTime);
|
|
@@ -38337,5 +38493,5 @@ __decorate([
|
|
|
38337
38493
|
|
|
38338
38494
|
Polyfill.registerPolyfill();
|
|
38339
38495
|
|
|
38340
|
-
export { AmbientLight, AmbientOcclusion, AmbientOcclusionQuality, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationRectCurve, AnimationRefCurve, AnimationStringCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorCondition, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorControllerParameter, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorLayerMask, AnimatorState, AnimatorStateMachine, AnimatorStateTransition, AntiAliasing, AssetPromise, AssetType, AudioClip, AudioManager, AudioSource, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, BasicRenderPipeline, BatchUtils, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlendState, BlinnPhongMaterial, Blitter, BloomDownScaleMode, BloomEffect, BoolUpdateFlag, BoxColliderShape, BoxShape, Buffer, BufferAsset, BufferBindFlag, BufferMesh, BufferUsage, BufferUtil, Burst, Camera, CameraClearFlags, CameraModifyFlags, CameraType, Canvas, CapsuleColliderShape, CharRenderInfo, CharacterController, CircleShape, ClearableObjectPool, CloneManager, Collider, ColliderShape, ColliderShapeUpAxis, Collision, CollisionDetectionMode, ColorOverLifetimeModule, ColorWriteMask, CompareFunction, Component, ConeEmitType, ConeShape, ContactPoint, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, CurveKey, DataType, DependentMode, DepthState, DepthTextureMode, DiffuseMode, DirectLight, DisorderedArray, Downsampling, DynamicCollider, DynamicColliderConstraints, EmissionModule, Engine, EngineObject, Entity, EntityModifyFlags, EventDispatcher, FinalPass, FixedJoint, FogMode, Font, FontStyle, GLCapabilityType, GradientAlphaKey, GradientColorKey, HemisphereShape, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolationType, JSONAsset, Joint, JointLimits, JointMotor, Keyframe, Keys, Layer, LayerPathMask, Light, Loader, Logger, MSAASamples, MainModule, Material, Mesh, MeshColliderShape, MeshColliderShapeCookingFlag, MeshRenderer, MeshShape, MeshTopology, ModelMesh, OverflowMode, PBRMaterial, ParticleCompositeCurve, ParticleCompositeGradient, ParticleCurve, ParticleCurveMode, ParticleGenerator, ParticleGradient, ParticleGradientMode, ParticleMaterial, ParticleRenderMode, ParticleRenderer, ParticleScaleMode, ParticleShapeArcMode, ParticleShapeType, ParticleSimulationSpace, ParticleStopMode, PhysicsMaterial, PhysicsMaterialCombineMode, PhysicsScene, PipelineStage, PlaneColliderShape, Platform, PointLight, Pointer, PointerButton, PointerEventData, PointerEventEmitter, PointerPhase, PostProcess, PostProcessEffect, PostProcessEffectBoolParameter, PostProcessEffectColorParameter, PostProcessEffectEnumParameter, PostProcessEffectFloatParameter, PostProcessEffectParameter, PostProcessEffectTextureParameter, PostProcessEffectVector2Parameter, PostProcessEffectVector3Parameter, PostProcessEffectVector4Parameter, PostProcessManager, PostProcessPass, PostProcessPassEvent, PostProcessUberPass, Primitive, PrimitiveMesh, Probe, RasterState, ReferResource, RefractionMode, RenderBufferDepthFormat, RenderFace, RenderQueue, RenderQueueFlags, RenderQueueType, RenderState, RenderStateElementKey, RenderTarget, RenderTargetBlendState, Renderer, RendererUpdateFlags, RenderingStatistics, ReplacementFailureStrategy, ResourceManager, ReturnableObjectPool, RotationOverLifetimeModule, SafeLoopArray, Scene, SceneManager, Script, SetDataOptions, Shader, ShaderData, ShaderDataGroup, ShaderFactory, ShaderLanguage, ShaderLib, ShaderMacro, ShaderMacroCollection, ShaderPass, ShaderProperty, ShaderPropertyType, ShaderTagKey, ShadowCascadesMode, ShadowResolution, ShadowType, SimpleSpriteAssembler, SizeOverLifetimeModule, Skin, SkinnedMeshRenderer, Sky, SkyBoxMaterial, SkyProceduralMaterial, SlicedSpriteAssembler, SphereColliderShape, SphereShape, SpotLight, SpringJoint, Sprite, SpriteAtlas, SpriteDrawMode, SpriteMask, SpriteMaskInteraction, SpriteMaskLayer, SpriteModifyFlags, SpriteRenderer, SpriteTileMode, StateMachineScript, StaticCollider, StencilOperation, StencilState, SubFont, SubMesh, SubPrimitive, SubShader, SunMode, SystemInfo, TextAsset, TextHorizontalAlignment, TextRenderer, TextUtils, TextVerticalAlignment, Texture, Texture2D, Texture2DArray, TextureCoordinate, TextureCube, TextureCubeFace, TextureDepthCompareFunction, TextureFilterMode, TextureFormat, TextureSheetAnimationModule, TextureUsage, TextureUtils, TextureWrapMode, TiledSpriteAssembler, Time, TonemappingEffect, TonemappingMode, TrailMaterial, TrailRenderer, TrailTextureMode, Transform, TransformModifyFlags, UnlitMaterial, Utils, VelocityOverLifetimeModule, VertexAttribute, VertexBufferBinding, VertexElement, VertexElementFormat, WrapMode, XRManager, assignmentClone, deepClone, dependentComponents, ignoreClone, registerPointerEventEmitter, request, resourceLoader, shallowClone };
|
|
38496
|
+
export { AmbientLight, AmbientOcclusion, AmbientOcclusionQuality, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationRectCurve, AnimationRefCurve, AnimationStringCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorCondition, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorControllerParameter, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorLayerMask, AnimatorState, AnimatorStateMachine, AnimatorStateTransition, AntiAliasing, AssetPromise, AssetType, AudioClip, AudioManager, AudioSource, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, BasicRenderPipeline, BatchUtils, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlendState, BlinnPhongMaterial, Blitter, BloomDownScaleMode, BloomEffect, BoolUpdateFlag, BoxColliderShape, BoxShape, Buffer, BufferAsset, BufferBindFlag, BufferMesh, BufferUsage, BufferUtil, Burst, Camera, CameraClearFlags, CameraModifyFlags, CameraType, Canvas, CapsuleColliderShape, CharRenderInfo, CharacterController, CircleShape, ClearableObjectPool, CloneManager, CloneUtils, Collider, ColliderShape, ColliderShapeUpAxis, Collision, CollisionDetectionMode, ColorOverLifetimeModule, ColorWriteMask, CompareFunction, Component, ConeEmitType, ConeShape, ContactPoint, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, CurveKey, DataType, DependentMode, DepthState, DepthTextureMode, DiffuseMode, DirectLight, DisorderedArray, Downsampling, DynamicCollider, DynamicColliderConstraints, EmissionModule, Engine, EngineObject, Entity, EntityModifyFlags, EventDispatcher, FinalPass, FixedJoint, FogMode, Font, FontStyle, GLCapabilityType, GradientAlphaKey, GradientColorKey, HemisphereShape, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolationType, JSONAsset, Joint, JointLimits, JointMotor, Keyframe, Keys, Layer, LayerPathMask, Light, Loader, Logger, MSAASamples, MainModule, Material, Mesh, MeshColliderShape, MeshColliderShapeCookingFlag, MeshRenderer, MeshShape, MeshTopology, ModelMesh, OverflowMode, PBRMaterial, ParticleCompositeCurve, ParticleCompositeGradient, ParticleCurve, ParticleCurveMode, ParticleGenerator, ParticleGradient, ParticleGradientMode, ParticleMaterial, ParticleRenderMode, ParticleRenderer, ParticleScaleMode, ParticleShapeArcMode, ParticleShapeType, ParticleSimulationSpace, ParticleStopMode, PhysicsMaterial, PhysicsMaterialCombineMode, PhysicsScene, PipelineStage, PlaneColliderShape, Platform, PointLight, Pointer, PointerButton, PointerEventData, PointerEventEmitter, PointerPhase, PostProcess, PostProcessEffect, PostProcessEffectBoolParameter, PostProcessEffectColorParameter, PostProcessEffectEnumParameter, PostProcessEffectFloatParameter, PostProcessEffectParameter, PostProcessEffectTextureParameter, PostProcessEffectVector2Parameter, PostProcessEffectVector3Parameter, PostProcessEffectVector4Parameter, PostProcessManager, PostProcessPass, PostProcessPassEvent, PostProcessUberPass, Primitive, PrimitiveMesh, Probe, RasterState, ReferResource, RefractionMode, RenderBufferDepthFormat, RenderFace, RenderQueue, RenderQueueFlags, RenderQueueType, RenderState, RenderStateElementKey, RenderTarget, RenderTargetBlendState, Renderer, RendererUpdateFlags, RenderingStatistics, ReplacementFailureStrategy, ResourceManager, ReturnableObjectPool, RotationOverLifetimeModule, SafeLoopArray, Scene, SceneManager, Script, SetDataOptions, Shader, ShaderData, ShaderDataGroup, ShaderFactory, ShaderLanguage, ShaderLib, ShaderMacro, ShaderMacroCollection, ShaderPass, ShaderProperty, ShaderPropertyType, ShaderTagKey, ShadowCascadesMode, ShadowResolution, ShadowType, Signal, SimpleSpriteAssembler, SizeOverLifetimeModule, Skin, SkinnedMeshRenderer, Sky, SkyBoxMaterial, SkyProceduralMaterial, SlicedSpriteAssembler, SphereColliderShape, SphereShape, SpotLight, SpringJoint, Sprite, SpriteAtlas, SpriteDrawMode, SpriteMask, SpriteMaskInteraction, SpriteMaskLayer, SpriteModifyFlags, SpriteRenderer, SpriteTileMode, StateMachineScript, StaticCollider, StencilOperation, StencilState, SubFont, SubMesh, SubPrimitive, SubShader, SunMode, SystemInfo, TextAsset, TextHorizontalAlignment, TextRenderer, TextUtils, TextVerticalAlignment, Texture, Texture2D, Texture2DArray, TextureCoordinate, TextureCube, TextureCubeFace, TextureDepthCompareFunction, TextureFilterMode, TextureFormat, TextureSheetAnimationModule, TextureUsage, TextureUtils, TextureWrapMode, TiledSpriteAssembler, Time, TonemappingEffect, TonemappingMode, TrailMaterial, TrailRenderer, TrailTextureMode, Transform, TransformModifyFlags, UnlitMaterial, Utils, VelocityOverLifetimeModule, VertexAttribute, VertexBufferBinding, VertexElement, VertexElementFormat, WrapMode, XRManager, assignmentClone, deepClone, dependentComponents, ignoreClone, registerPointerEventEmitter, request, resourceLoader, shallowClone };
|
|
38341
38497
|
//# sourceMappingURL=module.js.map
|