@galacean/engine 1.3.24 → 1.3.26
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/browser.js +446 -81
- package/dist/browser.js.map +1 -1
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/miniprogram.js +1 -1
- package/dist/module.js +1 -1
- package/package.json +5 -5
package/dist/browser.js
CHANGED
|
@@ -5203,6 +5203,101 @@
|
|
|
5203
5203
|
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5204
5204
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5205
5205
|
}
|
|
5206
|
+
function __generator$1(thisArg, body) {
|
|
5207
|
+
var verb = function verb(n) {
|
|
5208
|
+
return function(v) {
|
|
5209
|
+
return step([
|
|
5210
|
+
n,
|
|
5211
|
+
v
|
|
5212
|
+
]);
|
|
5213
|
+
};
|
|
5214
|
+
};
|
|
5215
|
+
var step = function step(op) {
|
|
5216
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
5217
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
5218
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
5219
|
+
if (y = 0, t) op = [
|
|
5220
|
+
op[0] & 2,
|
|
5221
|
+
t.value
|
|
5222
|
+
];
|
|
5223
|
+
switch(op[0]){
|
|
5224
|
+
case 0:
|
|
5225
|
+
case 1:
|
|
5226
|
+
t = op;
|
|
5227
|
+
break;
|
|
5228
|
+
case 4:
|
|
5229
|
+
_.label++;
|
|
5230
|
+
return {
|
|
5231
|
+
value: op[1],
|
|
5232
|
+
done: false
|
|
5233
|
+
};
|
|
5234
|
+
case 5:
|
|
5235
|
+
_.label++;
|
|
5236
|
+
y = op[1];
|
|
5237
|
+
op = [
|
|
5238
|
+
0
|
|
5239
|
+
];
|
|
5240
|
+
continue;
|
|
5241
|
+
case 7:
|
|
5242
|
+
op = _.ops.pop();
|
|
5243
|
+
_.trys.pop();
|
|
5244
|
+
continue;
|
|
5245
|
+
default:
|
|
5246
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
5247
|
+
_ = 0;
|
|
5248
|
+
continue;
|
|
5249
|
+
}
|
|
5250
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
5251
|
+
_.label = op[1];
|
|
5252
|
+
break;
|
|
5253
|
+
}
|
|
5254
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
5255
|
+
_.label = t[1];
|
|
5256
|
+
t = op;
|
|
5257
|
+
break;
|
|
5258
|
+
}
|
|
5259
|
+
if (t && _.label < t[2]) {
|
|
5260
|
+
_.label = t[2];
|
|
5261
|
+
_.ops.push(op);
|
|
5262
|
+
break;
|
|
5263
|
+
}
|
|
5264
|
+
if (t[2]) _.ops.pop();
|
|
5265
|
+
_.trys.pop();
|
|
5266
|
+
continue;
|
|
5267
|
+
}
|
|
5268
|
+
op = body.call(thisArg, _);
|
|
5269
|
+
} catch (e) {
|
|
5270
|
+
op = [
|
|
5271
|
+
6,
|
|
5272
|
+
e
|
|
5273
|
+
];
|
|
5274
|
+
y = 0;
|
|
5275
|
+
} finally{
|
|
5276
|
+
f = t = 0;
|
|
5277
|
+
}
|
|
5278
|
+
if (op[0] & 5) throw op[1];
|
|
5279
|
+
return {
|
|
5280
|
+
value: op[0] ? op[1] : void 0,
|
|
5281
|
+
done: true
|
|
5282
|
+
};
|
|
5283
|
+
};
|
|
5284
|
+
var _ = {
|
|
5285
|
+
label: 0,
|
|
5286
|
+
sent: function sent() {
|
|
5287
|
+
if (t[0] & 1) throw t[1];
|
|
5288
|
+
return t[1];
|
|
5289
|
+
},
|
|
5290
|
+
trys: [],
|
|
5291
|
+
ops: []
|
|
5292
|
+
}, f, y, t, g;
|
|
5293
|
+
return g = {
|
|
5294
|
+
next: verb(0),
|
|
5295
|
+
"throw": verb(1),
|
|
5296
|
+
"return": verb(2)
|
|
5297
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
5298
|
+
return this;
|
|
5299
|
+
}), g;
|
|
5300
|
+
}
|
|
5206
5301
|
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
5207
5302
|
var e = new Error(message);
|
|
5208
5303
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
@@ -8768,11 +8863,13 @@
|
|
|
8768
8863
|
/**
|
|
8769
8864
|
* @internal
|
|
8770
8865
|
* @todo Should merge when we can delete material render state
|
|
8771
|
-
*/ _proto.
|
|
8866
|
+
*/ _proto._getRenderQueueByShaderData = function _getRenderQueueByShaderData(renderStateDataMap, shaderData) {
|
|
8772
8867
|
var renderQueueType = renderStateDataMap[exports.RenderStateDataKey.RenderQueueType];
|
|
8773
|
-
if (renderQueueType
|
|
8868
|
+
if (renderQueueType === undefined) {
|
|
8869
|
+
return this.renderQueueType;
|
|
8870
|
+
} else {
|
|
8774
8871
|
var _shaderData_getFloat;
|
|
8775
|
-
|
|
8872
|
+
return (_shaderData_getFloat = shaderData.getFloat(renderQueueType)) != null ? _shaderData_getFloat : exports.RenderQueueType.Opaque;
|
|
8776
8873
|
}
|
|
8777
8874
|
};
|
|
8778
8875
|
_proto._applyStatesByShaderData = function _applyStatesByShaderData(renderStateDataMap, shaderData) {
|
|
@@ -9973,9 +10070,11 @@
|
|
|
9973
10070
|
_this._rotation = new Vector3();
|
|
9974
10071
|
_this._rotationQuaternion = new Quaternion();
|
|
9975
10072
|
_this._scale = new Vector3(1, 1, 1);
|
|
10073
|
+
_this._localUniformScaling = true;
|
|
9976
10074
|
_this._worldPosition = new Vector3();
|
|
9977
10075
|
_this._worldRotation = new Vector3();
|
|
9978
10076
|
_this._worldRotationQuaternion = new Quaternion();
|
|
10077
|
+
_this._worldUniformScaling = true;
|
|
9979
10078
|
_this._lossyWorldScale = new Vector3(1, 1, 1);
|
|
9980
10079
|
_this._localMatrix = new Matrix();
|
|
9981
10080
|
_this._worldMatrix = new Matrix();
|
|
@@ -10143,7 +10242,7 @@
|
|
|
10143
10242
|
* @internal
|
|
10144
10243
|
*/ _proto._parentChange = function _parentChange() {
|
|
10145
10244
|
this._isParentDirty = true;
|
|
10146
|
-
this._updateAllWorldFlag();
|
|
10245
|
+
this._updateAllWorldFlag(0x1bc);
|
|
10147
10246
|
};
|
|
10148
10247
|
/**
|
|
10149
10248
|
* @internal
|
|
@@ -10178,10 +10277,10 @@
|
|
|
10178
10277
|
*/ _proto._updateWorldPositionFlag = function _updateWorldPositionFlag() {
|
|
10179
10278
|
if (!this._isContainDirtyFlags(0x84)) {
|
|
10180
10279
|
this._worldAssociatedChange(0x84);
|
|
10181
|
-
var
|
|
10182
|
-
for(var i = 0, n =
|
|
10183
|
-
var
|
|
10184
|
-
(
|
|
10280
|
+
var children = this._entity._children;
|
|
10281
|
+
for(var i = 0, n = children.length; i < n; i++){
|
|
10282
|
+
var _children_i_transform;
|
|
10283
|
+
(_children_i_transform = children[i].transform) == null ? void 0 : _children_i_transform._updateWorldPositionFlag();
|
|
10185
10284
|
}
|
|
10186
10285
|
}
|
|
10187
10286
|
};
|
|
@@ -10190,14 +10289,19 @@
|
|
|
10190
10289
|
* Get worldPosition: Will trigger the worldMatrix, local position update of itself and the worldMatrix update of all parent entities.
|
|
10191
10290
|
* Get worldRotationQuaternion: Will trigger the world rotation (in quaternion) update of itself and all parent entities.
|
|
10192
10291
|
* Get worldRotation: Will trigger the world rotation(in euler and quaternion) update of itself and world rotation(in quaternion) update of all parent entities.
|
|
10292
|
+
* Get worldScale: Will trigger the scaling update of itself and all parent entities.
|
|
10193
10293
|
* In summary, any update of related variables will cause the dirty mark of one of the full process (worldMatrix or worldRotationQuaternion) to be false.
|
|
10194
10294
|
*/ _proto._updateWorldRotationFlag = function _updateWorldRotationFlag() {
|
|
10195
|
-
|
|
10196
|
-
|
|
10197
|
-
|
|
10198
|
-
|
|
10199
|
-
|
|
10200
|
-
|
|
10295
|
+
var parent = this._getParentTransform();
|
|
10296
|
+
var parentWorldUniformScaling = parent ? parent._getWorldUniformScaling() : true;
|
|
10297
|
+
var flags = parentWorldUniformScaling ? 0x98 : 0xb8;
|
|
10298
|
+
if (!this._isContainDirtyFlags(flags)) {
|
|
10299
|
+
this._worldAssociatedChange(flags);
|
|
10300
|
+
flags = this._getWorldUniformScaling() ? 0x9c : 0xbc;
|
|
10301
|
+
var children = this._entity._children;
|
|
10302
|
+
for(var i = 0, n = children.length; i < n; i++){
|
|
10303
|
+
var _children_i_transform;
|
|
10304
|
+
(_children_i_transform = children[i].transform) == null ? void 0 : _children_i_transform._updateWorldPositionAndRotationFlag(flags); // Rotation update of parent entity will trigger world position, rotation and scale update of all child entity.
|
|
10201
10305
|
}
|
|
10202
10306
|
}
|
|
10203
10307
|
};
|
|
@@ -10206,14 +10310,17 @@
|
|
|
10206
10310
|
* Get worldPosition: Will trigger the worldMatrix, local position update of itself and the worldMatrix update of all parent entities.
|
|
10207
10311
|
* Get worldRotationQuaternion: Will trigger the world rotation (in quaternion) update of itself and all parent entities.
|
|
10208
10312
|
* Get worldRotation: Will trigger the world rotation(in euler and quaternion) update of itself and world rotation(in quaternion) update of all parent entities.
|
|
10313
|
+
* Get worldScale: Will trigger the scaling update of itself and all parent entities.
|
|
10209
10314
|
* In summary, any update of related variables will cause the dirty mark of one of the full process (worldMatrix or worldRotationQuaternion) to be false.
|
|
10210
|
-
|
|
10211
|
-
|
|
10212
|
-
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
|
|
10216
|
-
|
|
10315
|
+
* @param flags - Dirty flag
|
|
10316
|
+
*/ _proto._updateWorldPositionAndRotationFlag = function _updateWorldPositionAndRotationFlag(flags) {
|
|
10317
|
+
if (!this._isContainDirtyFlags(flags)) {
|
|
10318
|
+
this._worldAssociatedChange(flags);
|
|
10319
|
+
flags = this._getWorldUniformScaling() ? 0x9c : 0xbc;
|
|
10320
|
+
var children = this._entity._children;
|
|
10321
|
+
for(var i = 0, n = children.length; i < n; i++){
|
|
10322
|
+
var _children_i_transform;
|
|
10323
|
+
(_children_i_transform = children[i].transform) == null ? void 0 : _children_i_transform._updateWorldPositionAndRotationFlag(flags);
|
|
10217
10324
|
}
|
|
10218
10325
|
}
|
|
10219
10326
|
};
|
|
@@ -10222,13 +10329,15 @@
|
|
|
10222
10329
|
* Get worldPosition: Will trigger the worldMatrix, local position update of itself and the worldMatrix update of all parent entities.
|
|
10223
10330
|
* Get worldScale: Will trigger the scaling update of itself and all parent entities.
|
|
10224
10331
|
* In summary, any update of related variables will cause the dirty mark of one of the full process (worldMatrix) to be false.
|
|
10225
|
-
|
|
10226
|
-
|
|
10227
|
-
|
|
10228
|
-
|
|
10229
|
-
|
|
10230
|
-
|
|
10231
|
-
|
|
10332
|
+
* @param flags - Dirty flag
|
|
10333
|
+
*/ _proto._updateWorldScaleFlag = function _updateWorldScaleFlag(flags) {
|
|
10334
|
+
if (!this._isContainDirtyFlags(flags)) {
|
|
10335
|
+
this._worldAssociatedChange(flags);
|
|
10336
|
+
flags |= 0x4;
|
|
10337
|
+
var children = this._entity._children;
|
|
10338
|
+
for(var i = 0, n = children.length; i < n; i++){
|
|
10339
|
+
var _children_i_transform;
|
|
10340
|
+
(_children_i_transform = children[i].transform) == null ? void 0 : _children_i_transform._updateWorldPositionAndScaleFlag(flags);
|
|
10232
10341
|
}
|
|
10233
10342
|
}
|
|
10234
10343
|
};
|
|
@@ -10237,25 +10346,27 @@
|
|
|
10237
10346
|
* Get worldPosition: Will trigger the worldMatrix, local position update of itself and the worldMatrix update of all parent entities.
|
|
10238
10347
|
* Get worldScale: Will trigger the scaling update of itself and all parent entities.
|
|
10239
10348
|
* In summary, any update of related variables will cause the dirty mark of one of the full process (worldMatrix) to be false.
|
|
10240
|
-
|
|
10241
|
-
|
|
10242
|
-
|
|
10243
|
-
|
|
10244
|
-
|
|
10245
|
-
|
|
10246
|
-
|
|
10349
|
+
* @param flags - Dirty flag
|
|
10350
|
+
*/ _proto._updateWorldPositionAndScaleFlag = function _updateWorldPositionAndScaleFlag(flags) {
|
|
10351
|
+
if (!this._isContainDirtyFlags(flags)) {
|
|
10352
|
+
this._worldAssociatedChange(flags);
|
|
10353
|
+
var children = this._entity._children;
|
|
10354
|
+
for(var i = 0, n = children.length; i < n; i++){
|
|
10355
|
+
var _children_i_transform;
|
|
10356
|
+
(_children_i_transform = children[i].transform) == null ? void 0 : _children_i_transform._updateWorldPositionAndScaleFlag(flags);
|
|
10247
10357
|
}
|
|
10248
10358
|
}
|
|
10249
10359
|
};
|
|
10250
10360
|
/**
|
|
10251
10361
|
* Update all world transform property dirty flag, the principle is the same as above.
|
|
10252
|
-
|
|
10253
|
-
|
|
10254
|
-
|
|
10255
|
-
|
|
10256
|
-
|
|
10257
|
-
|
|
10258
|
-
|
|
10362
|
+
* @param flags - Dirty flag
|
|
10363
|
+
*/ _proto._updateAllWorldFlag = function _updateAllWorldFlag(flags) {
|
|
10364
|
+
if (!this._isContainDirtyFlags(flags)) {
|
|
10365
|
+
this._worldAssociatedChange(flags);
|
|
10366
|
+
var children = this._entity._children;
|
|
10367
|
+
for(var i = 0, n = children.length; i < n; i++){
|
|
10368
|
+
var _children_i_transform;
|
|
10369
|
+
(_children_i_transform = children[i].transform) == null ? void 0 : _children_i_transform._updateAllWorldFlag(flags);
|
|
10259
10370
|
}
|
|
10260
10371
|
}
|
|
10261
10372
|
};
|
|
@@ -10303,7 +10414,7 @@
|
|
|
10303
10414
|
};
|
|
10304
10415
|
_proto._worldAssociatedChange = function _worldAssociatedChange(type) {
|
|
10305
10416
|
this._dirtyFlag |= type;
|
|
10306
|
-
this._updateFlagManager.dispatch(
|
|
10417
|
+
this._updateFlagManager.dispatch(type);
|
|
10307
10418
|
};
|
|
10308
10419
|
_proto._rotateByQuat = function _rotateByQuat(rotateQuat, relativeToLocal) {
|
|
10309
10420
|
if (relativeToLocal) {
|
|
@@ -10372,8 +10483,28 @@
|
|
|
10372
10483
|
this._setDirtyFlagFalse(0x10);
|
|
10373
10484
|
};
|
|
10374
10485
|
_proto._onScaleChanged = function _onScaleChanged() {
|
|
10486
|
+
var _this__scale = this._scale, x = _this__scale.x, y = _this__scale.y, z = _this__scale.z;
|
|
10375
10487
|
this._setDirtyFlagTrue(0x40);
|
|
10376
|
-
|
|
10488
|
+
var localUniformScaling = x == y && y == z;
|
|
10489
|
+
if (this._localUniformScaling !== localUniformScaling) {
|
|
10490
|
+
this._localUniformScaling = localUniformScaling;
|
|
10491
|
+
this._updateWorldScaleFlag(0x1a0);
|
|
10492
|
+
} else {
|
|
10493
|
+
this._updateWorldScaleFlag(0xa0);
|
|
10494
|
+
}
|
|
10495
|
+
};
|
|
10496
|
+
_proto._getWorldUniformScaling = function _getWorldUniformScaling() {
|
|
10497
|
+
if (this._isContainDirtyFlag(0x100)) {
|
|
10498
|
+
var localUniformScaling = this._localUniformScaling;
|
|
10499
|
+
if (localUniformScaling) {
|
|
10500
|
+
var parent = this._getParentTransform();
|
|
10501
|
+
this._worldUniformScaling = localUniformScaling && (parent ? parent._getWorldUniformScaling() : true);
|
|
10502
|
+
} else {
|
|
10503
|
+
this._worldUniformScaling = false;
|
|
10504
|
+
}
|
|
10505
|
+
this._setDirtyFlagFalse(0x100);
|
|
10506
|
+
}
|
|
10507
|
+
return this._worldUniformScaling;
|
|
10377
10508
|
};
|
|
10378
10509
|
_create_class$2(Transform, [
|
|
10379
10510
|
{
|
|
@@ -10540,11 +10671,12 @@
|
|
|
10540
10671
|
key: "lossyWorldScale",
|
|
10541
10672
|
get: /**
|
|
10542
10673
|
* Local lossy scaling.
|
|
10543
|
-
* @remarks The value obtained may not be correct under certain conditions(for example, the parent node has scaling,
|
|
10544
|
-
* and the child node has a rotation), the scaling will be tilted.
|
|
10674
|
+
* @remarks The value obtained may not be correct under certain conditions(for example, the parent node has non-uniform world scaling,
|
|
10675
|
+
* and the child node has a rotation), the scaling will be tilted.
|
|
10545
10676
|
*/ function get() {
|
|
10546
10677
|
if (this._isContainDirtyFlag(0x20)) {
|
|
10547
10678
|
if (this._getParentTransform()) {
|
|
10679
|
+
// Vector3 cannot be used to correctly represent the scaling. Must use Matrix3x3
|
|
10548
10680
|
var scaleMat = this._getScaleMatrix();
|
|
10549
10681
|
var e = scaleMat.elements;
|
|
10550
10682
|
this._lossyWorldScale.set(e[0], e[4], e[8]);
|
|
@@ -10572,18 +10704,25 @@
|
|
|
10572
10704
|
if (this._localMatrix !== value) {
|
|
10573
10705
|
this._localMatrix.copyFrom(value);
|
|
10574
10706
|
}
|
|
10707
|
+
var _this = this, position = _this._position, rotationQuaternion = _this._rotationQuaternion, scale = _this._scale;
|
|
10575
10708
|
// @ts-ignore
|
|
10576
|
-
|
|
10577
|
-
this._localMatrix.decompose(
|
|
10709
|
+
position._onValueChanged = rotationQuaternion._onValueChanged = scale._onValueChanged = null;
|
|
10710
|
+
this._localMatrix.decompose(position, rotationQuaternion, scale);
|
|
10578
10711
|
// @ts-ignore
|
|
10579
|
-
|
|
10712
|
+
position._onValueChanged = this._onPositionChanged;
|
|
10580
10713
|
// @ts-ignore
|
|
10581
|
-
|
|
10714
|
+
rotationQuaternion._onValueChanged = this._onRotationQuaternionChanged;
|
|
10582
10715
|
// @ts-ignore
|
|
10583
|
-
|
|
10716
|
+
scale._onValueChanged = this._onScaleChanged;
|
|
10584
10717
|
this._setDirtyFlagTrue(0x1);
|
|
10585
10718
|
this._setDirtyFlagFalse(0x40 | 0x2);
|
|
10586
|
-
|
|
10719
|
+
var localUniformScaling = scale.x === scale.y && scale.y === scale.z;
|
|
10720
|
+
if (this._localUniformScaling !== localUniformScaling) {
|
|
10721
|
+
this._localUniformScaling = localUniformScaling;
|
|
10722
|
+
this._updateAllWorldFlag(0x1bc);
|
|
10723
|
+
} else {
|
|
10724
|
+
this._updateAllWorldFlag(0xbc);
|
|
10725
|
+
}
|
|
10587
10726
|
}
|
|
10588
10727
|
},
|
|
10589
10728
|
{
|
|
@@ -10693,6 +10832,9 @@
|
|
|
10693
10832
|
__decorate$1([
|
|
10694
10833
|
deepClone
|
|
10695
10834
|
], Transform.prototype, "_scale", void 0);
|
|
10835
|
+
__decorate$1([
|
|
10836
|
+
assignmentClone
|
|
10837
|
+
], Transform.prototype, "_localUniformScaling", void 0);
|
|
10696
10838
|
__decorate$1([
|
|
10697
10839
|
deepClone
|
|
10698
10840
|
], Transform.prototype, "_worldPosition", void 0);
|
|
@@ -10702,6 +10844,9 @@
|
|
|
10702
10844
|
__decorate$1([
|
|
10703
10845
|
deepClone
|
|
10704
10846
|
], Transform.prototype, "_worldRotationQuaternion", void 0);
|
|
10847
|
+
__decorate$1([
|
|
10848
|
+
assignmentClone
|
|
10849
|
+
], Transform.prototype, "_worldUniformScaling", void 0);
|
|
10705
10850
|
__decorate$1([
|
|
10706
10851
|
deepClone
|
|
10707
10852
|
], Transform.prototype, "_lossyWorldScale", void 0);
|
|
@@ -10760,12 +10905,18 @@
|
|
|
10760
10905
|
TransformModifyFlags[TransformModifyFlags["WorldScale"] = 0x20] = "WorldScale";
|
|
10761
10906
|
TransformModifyFlags[TransformModifyFlags["LocalMatrix"] = 0x40] = "LocalMatrix";
|
|
10762
10907
|
TransformModifyFlags[TransformModifyFlags["WorldMatrix"] = 0x80] = "WorldMatrix";
|
|
10908
|
+
TransformModifyFlags[TransformModifyFlags[/** This is an internal flag used to assist in determining the dispatch
|
|
10909
|
+
* of world scaling dirty flags in the case of non-uniform scaling.
|
|
10910
|
+
*/ "IsWorldUniformScaling"] = 0x100] = "IsWorldUniformScaling";
|
|
10763
10911
|
TransformModifyFlags[TransformModifyFlags[/** WorldMatrix | WorldPosition */ "WmWp"] = 0x84] = "WmWp";
|
|
10764
10912
|
TransformModifyFlags[TransformModifyFlags[/** WorldMatrix | WorldEuler | WorldQuat */ "WmWeWq"] = 0x98] = "WmWeWq";
|
|
10913
|
+
TransformModifyFlags[TransformModifyFlags[/** WorldMatrix | WorldEuler | WorldQuat | WorldScale*/ "WmWeWqWs"] = 0xb8] = "WmWeWqWs";
|
|
10765
10914
|
TransformModifyFlags[TransformModifyFlags[/** WorldMatrix | WorldPosition | WorldEuler | WorldQuat */ "WmWpWeWq"] = 0x9c] = "WmWpWeWq";
|
|
10766
10915
|
TransformModifyFlags[TransformModifyFlags[/** WorldMatrix | WorldScale */ "WmWs"] = 0xa0] = "WmWs";
|
|
10916
|
+
TransformModifyFlags[TransformModifyFlags[/** WorldMatrix | WorldScale | WorldUniformScaling */ "WmWsWus"] = 0x1a0] = "WmWsWus";
|
|
10767
10917
|
TransformModifyFlags[TransformModifyFlags[/** WorldMatrix | WorldPosition | WorldScale */ "WmWpWs"] = 0xa4] = "WmWpWs";
|
|
10768
10918
|
TransformModifyFlags[TransformModifyFlags[/** WorldMatrix | WorldPosition | WorldEuler | WorldQuat | WorldScale */ "WmWpWeWqWs"] = 0xbc] = "WmWpWeWqWs";
|
|
10919
|
+
TransformModifyFlags[TransformModifyFlags[/** WorldMatrix | WorldPosition | WorldEuler | WorldQuat | WorldScale | WorldUniformScaling */ "WmWpWeWqWsWus"] = 0x1bc] = "WmWpWeWqWsWus";
|
|
10769
10920
|
})(TransformModifyFlags || (TransformModifyFlags = {}));
|
|
10770
10921
|
// @ts-ignore
|
|
10771
10922
|
var _Renderer;
|
|
@@ -13076,11 +13227,13 @@
|
|
|
13076
13227
|
* @param viewport - Viewport
|
|
13077
13228
|
* @param material - The material to use when blitting
|
|
13078
13229
|
* @param passIndex - Pass index to use of the provided material
|
|
13079
|
-
|
|
13230
|
+
* @param flipYOfSource - Whether flip Y axis of source texture
|
|
13231
|
+
*/ PipelineUtils.blitTexture = function blitTexture(engine, source, destination, mipLevel, viewport, material, passIndex, flipYOfSource) {
|
|
13080
13232
|
if (mipLevel === void 0) mipLevel = 0;
|
|
13081
13233
|
if (viewport === void 0) viewport = PipelineUtils.defaultViewport;
|
|
13082
13234
|
if (material === void 0) material = null;
|
|
13083
13235
|
if (passIndex === void 0) passIndex = 0;
|
|
13236
|
+
if (flipYOfSource === void 0) flipYOfSource = false;
|
|
13084
13237
|
var basicResources = engine._basicResources;
|
|
13085
13238
|
var blitMesh = destination ? basicResources.flipYBlitMesh : basicResources.blitMesh;
|
|
13086
13239
|
var blitMaterial = material || basicResources.blitMaterial;
|
|
@@ -13094,9 +13247,15 @@
|
|
|
13094
13247
|
rendererShaderData.setFloat(PipelineUtils._blitMipLevelProperty, mipLevel);
|
|
13095
13248
|
PipelineUtils._texelSize.set(1 / source.width, 1 / source.height, source.width, source.height);
|
|
13096
13249
|
rendererShaderData.setVector4(PipelineUtils._blitTexelSizeProperty, PipelineUtils._texelSize);
|
|
13250
|
+
if (flipYOfSource) {
|
|
13251
|
+
rendererShaderData.enableMacro(PipelineUtils._flipYTextureMacro);
|
|
13252
|
+
} else {
|
|
13253
|
+
rendererShaderData.disableMacro(PipelineUtils._flipYTextureMacro);
|
|
13254
|
+
}
|
|
13097
13255
|
var pass = blitMaterial.shader.subShaders[0].passes[passIndex];
|
|
13098
13256
|
var compileMacros = Shader._compileMacros;
|
|
13099
|
-
ShaderMacroCollection.unionCollection(context.camera._globalShaderMacro,
|
|
13257
|
+
ShaderMacroCollection.unionCollection(context.camera._globalShaderMacro, rendererShaderData._macroCollection, compileMacros);
|
|
13258
|
+
ShaderMacroCollection.unionCollection(compileMacros, blitMaterial.shaderData._macroCollection, compileMacros);
|
|
13100
13259
|
var program = pass._getShaderProgram(engine, compileMacros);
|
|
13101
13260
|
program.bind();
|
|
13102
13261
|
program.groupingOtherUniformBlock();
|
|
@@ -13118,6 +13277,9 @@
|
|
|
13118
13277
|
PipelineUtils._blitTexelSizeProperty = ShaderProperty.getByName("renderer_texelSize") // x: 1/width, y: 1/height, z: width, w: height
|
|
13119
13278
|
;
|
|
13120
13279
|
})();
|
|
13280
|
+
(function() {
|
|
13281
|
+
PipelineUtils._flipYTextureMacro = ShaderMacro.getByName("renderer_FlipYBlitTexture");
|
|
13282
|
+
})();
|
|
13121
13283
|
(function() {
|
|
13122
13284
|
PipelineUtils._rendererShaderData = new ShaderData(ShaderDataGroup.Renderer);
|
|
13123
13285
|
})();
|
|
@@ -13231,7 +13393,7 @@
|
|
|
13231
13393
|
/**
|
|
13232
13394
|
* Multi-sample anti-aliasing samples when use independent canvas mode.
|
|
13233
13395
|
*
|
|
13234
|
-
* @remarks
|
|
13396
|
+
* @remarks It will take effect when `independentCanvasEnabled` property is `true`, otherwise it will be invalid.
|
|
13235
13397
|
*/ _this.msaaSamples = exports.MSAASamples.None;
|
|
13236
13398
|
/** @internal */ _this._cameraType = exports.CameraType.Normal;
|
|
13237
13399
|
/** @internal */ _this._globalShaderMacro = new ShaderMacroCollection();
|
|
@@ -13593,13 +13755,17 @@
|
|
|
13593
13755
|
key: "independentCanvasEnabled",
|
|
13594
13756
|
get: /**
|
|
13595
13757
|
* Whether independent canvas is enabled.
|
|
13596
|
-
*
|
|
13597
13758
|
* @remarks If true, the msaa in viewport can turn or off independently by `msaaSamples` property.
|
|
13598
13759
|
*/ function get() {
|
|
13599
|
-
|
|
13760
|
+
// Uber pass need internal RT
|
|
13761
|
+
if (this.enablePostProcess && this.scene._postProcessManager.hasActiveEffect) {
|
|
13600
13762
|
return true;
|
|
13601
13763
|
}
|
|
13602
|
-
|
|
13764
|
+
if (this.enableHDR || this.opaqueTextureEnabled) {
|
|
13765
|
+
var _this_renderTarget;
|
|
13766
|
+
return this._getInternalColorTextureFormat() !== ((_this_renderTarget = this.renderTarget) == null ? void 0 : _this_renderTarget.getColorTexture(0).format);
|
|
13767
|
+
}
|
|
13768
|
+
return false;
|
|
13603
13769
|
}
|
|
13604
13770
|
},
|
|
13605
13771
|
{
|
|
@@ -14098,8 +14264,15 @@
|
|
|
14098
14264
|
if (shaderPass.getTagValue(pipelineStageKey) !== pipelineStageTagValue) {
|
|
14099
14265
|
continue;
|
|
14100
14266
|
}
|
|
14101
|
-
var
|
|
14102
|
-
|
|
14267
|
+
var renderState = shaderPass._renderState;
|
|
14268
|
+
var passQueueType = void 0;
|
|
14269
|
+
if (renderState) {
|
|
14270
|
+
passQueueType = renderState._getRenderQueueByShaderData(shaderPass._renderStateDataMap, materialData);
|
|
14271
|
+
} else {
|
|
14272
|
+
renderState = renderStates[j];
|
|
14273
|
+
passQueueType = renderState.renderQueueType;
|
|
14274
|
+
}
|
|
14275
|
+
if (passQueueType !== renderQueueType) {
|
|
14103
14276
|
continue;
|
|
14104
14277
|
}
|
|
14105
14278
|
var program = shaderPass._getShaderProgram(engine, compileMacros);
|
|
@@ -14153,8 +14326,6 @@
|
|
|
14153
14326
|
program.uploadUnGroupTextures();
|
|
14154
14327
|
}
|
|
14155
14328
|
}
|
|
14156
|
-
var _shaderPass__renderState1;
|
|
14157
|
-
var renderState = (_shaderPass__renderState1 = shaderPass._renderState) != null ? _shaderPass__renderState1 : renderStates[j];
|
|
14158
14329
|
renderState._applyStates(engine, renderer.entity.transform._isFrontFaceInvert(), shaderPass._renderStateDataMap, material.shaderData);
|
|
14159
14330
|
rhi.drawPrimitive(primitive, subElement.subPrimitive, program);
|
|
14160
14331
|
}
|
|
@@ -14181,9 +14352,12 @@
|
|
|
14181
14352
|
var camera = context.camera;
|
|
14182
14353
|
var engine = camera.engine;
|
|
14183
14354
|
camera.scene._maskManager.buildMaskRenderElement(master, incrementMaskQueue, decrementMaskQueue);
|
|
14355
|
+
var primitiveChunkManagerMask = engine._batcherManager.primitiveChunkManagerMask;
|
|
14184
14356
|
incrementMaskQueue._batch(engine._batcherManager);
|
|
14357
|
+
primitiveChunkManagerMask.uploadBuffer();
|
|
14185
14358
|
incrementMaskQueue.render(context, pipelineStageTagValue, 1);
|
|
14186
14359
|
decrementMaskQueue._batch(engine._batcherManager);
|
|
14360
|
+
primitiveChunkManagerMask.uploadBuffer();
|
|
14187
14361
|
decrementMaskQueue.render(context, pipelineStageTagValue, 2);
|
|
14188
14362
|
};
|
|
14189
14363
|
RenderQueue.compareForOpaque = function compareForOpaque(a, b) {
|
|
@@ -15101,6 +15275,8 @@
|
|
|
15101
15275
|
var BasicRenderPipeline = function BasicRenderPipeline(camera) {
|
|
15102
15276
|
this._lastCanvasSize = new Vector2();
|
|
15103
15277
|
this._internalColorTarget = null;
|
|
15278
|
+
this._canUseBlitFrameBuffer = false;
|
|
15279
|
+
this._shouldGrabColor = false;
|
|
15104
15280
|
this._camera = camera;
|
|
15105
15281
|
var engine = camera.engine;
|
|
15106
15282
|
this._cullingResults = new CullingResults();
|
|
@@ -15125,10 +15301,19 @@
|
|
|
15125
15301
|
context.rendererUpdateFlag = ContextRendererUpdateFlag.All;
|
|
15126
15302
|
var camera = this._camera;
|
|
15127
15303
|
var scene = camera.scene, engine = camera.engine;
|
|
15304
|
+
var rhi = engine._hardwareRenderer;
|
|
15128
15305
|
var cullingResults = this._cullingResults;
|
|
15129
15306
|
var sunlight = scene._lightManager._sunlight;
|
|
15130
15307
|
var depthOnlyPass = this._depthOnlyPass;
|
|
15131
15308
|
var depthPassEnabled = camera.depthTextureMode === exports.DepthTextureMode.PrePass && depthOnlyPass._supportDepthTexture;
|
|
15309
|
+
var finalClearFlags = camera.clearFlags & ~(ignoreClear != null ? ignoreClear : exports.CameraClearFlags.None);
|
|
15310
|
+
var independentCanvasEnabled = camera.independentCanvasEnabled;
|
|
15311
|
+
var msaaSamples = camera.renderTarget ? camera.renderTarget.antiAliasing : camera.msaaSamples;
|
|
15312
|
+
this._shouldGrabColor = independentCanvasEnabled && !(finalClearFlags & exports.CameraClearFlags.Color);
|
|
15313
|
+
// 1. Only support blitFramebuffer in webgl2 context
|
|
15314
|
+
// 2. Can't blit normal FBO to MSAA FBO
|
|
15315
|
+
// 3. Can't blit screen MSAA FBO to normal FBO in mac safari platform and mobile, but mac chrome and firfox is OK
|
|
15316
|
+
this._canUseBlitFrameBuffer = rhi.isWebGL2 && msaaSamples === 1 && (!!camera.renderTarget || !rhi.context.antialias);
|
|
15132
15317
|
if (scene.castShadows && sunlight && sunlight.shadowType !== exports.ShadowType.None) {
|
|
15133
15318
|
this._cascadedShadowCasterPass.onRender(context);
|
|
15134
15319
|
context.rendererUpdateFlag = ContextRendererUpdateFlag.None;
|
|
@@ -15148,24 +15333,46 @@
|
|
|
15148
15333
|
} else {
|
|
15149
15334
|
camera.shaderData.setTexture(exports.Camera._cameraDepthTextureProperty, engine._basicResources.whiteTexture2D);
|
|
15150
15335
|
}
|
|
15151
|
-
// Check if need to create internal color texture
|
|
15152
|
-
var independentCanvasEnabled = camera.independentCanvasEnabled;
|
|
15336
|
+
// Check if need to create internal color texture or grab texture
|
|
15153
15337
|
if (independentCanvasEnabled) {
|
|
15338
|
+
var depthFormat;
|
|
15339
|
+
if (camera.renderTarget) {
|
|
15340
|
+
depthFormat = camera.renderTarget._depthFormat;
|
|
15341
|
+
} else if (rhi.context.depth && rhi.context.stencil) {
|
|
15342
|
+
depthFormat = exports.TextureFormat.Depth24Stencil8;
|
|
15343
|
+
} else if (rhi.context.depth) {
|
|
15344
|
+
depthFormat = exports.TextureFormat.Depth24;
|
|
15345
|
+
} else if (rhi.context.stencil) {
|
|
15346
|
+
depthFormat = exports.TextureFormat.Stencil;
|
|
15347
|
+
} else {
|
|
15348
|
+
depthFormat = null;
|
|
15349
|
+
}
|
|
15154
15350
|
var viewport = camera.pixelViewport;
|
|
15155
|
-
var internalColorTarget = PipelineUtils.recreateRenderTargetIfNeeded(engine, this._internalColorTarget, viewport.width, viewport.height, camera._getInternalColorTextureFormat(),
|
|
15351
|
+
var internalColorTarget = PipelineUtils.recreateRenderTargetIfNeeded(engine, this._internalColorTarget, viewport.width, viewport.height, camera._getInternalColorTextureFormat(), depthFormat, false, false, msaaSamples, exports.TextureWrapMode.Clamp, exports.TextureFilterMode.Bilinear);
|
|
15352
|
+
if (!this._canUseBlitFrameBuffer && this._shouldGrabColor) {
|
|
15353
|
+
var _camera_renderTarget;
|
|
15354
|
+
var _camera_renderTarget_getColorTexture_format;
|
|
15355
|
+
var grabTexture = PipelineUtils.recreateTextureIfNeeded(engine, this._grabTexture, viewport.width, viewport.height, (_camera_renderTarget_getColorTexture_format = (_camera_renderTarget = camera.renderTarget) == null ? void 0 : _camera_renderTarget.getColorTexture(0).format) != null ? _camera_renderTarget_getColorTexture_format : exports.TextureFormat.R8G8B8A8, false, exports.TextureWrapMode.Clamp, exports.TextureFilterMode.Bilinear);
|
|
15356
|
+
this._grabTexture = grabTexture;
|
|
15357
|
+
}
|
|
15156
15358
|
this._internalColorTarget = internalColorTarget;
|
|
15157
15359
|
} else {
|
|
15158
15360
|
var internalColorTarget1 = this._internalColorTarget;
|
|
15361
|
+
var grabTexture1 = this._grabTexture;
|
|
15159
15362
|
if (internalColorTarget1) {
|
|
15160
15363
|
var _internalColorTarget_getColorTexture;
|
|
15161
15364
|
(_internalColorTarget_getColorTexture = internalColorTarget1.getColorTexture(0)) == null ? void 0 : _internalColorTarget_getColorTexture.destroy(true);
|
|
15162
15365
|
internalColorTarget1.destroy(true);
|
|
15163
15366
|
this._internalColorTarget = null;
|
|
15164
15367
|
}
|
|
15368
|
+
if (grabTexture1) {
|
|
15369
|
+
grabTexture1.destroy(true);
|
|
15370
|
+
this._grabTexture = null;
|
|
15371
|
+
}
|
|
15165
15372
|
}
|
|
15166
|
-
this._drawRenderPass(context, camera, cubeFace, mipLevel
|
|
15373
|
+
this._drawRenderPass(context, camera, finalClearFlags, cubeFace, mipLevel);
|
|
15167
15374
|
};
|
|
15168
|
-
_proto._drawRenderPass = function _drawRenderPass(context, camera, cubeFace, mipLevel
|
|
15375
|
+
_proto._drawRenderPass = function _drawRenderPass(context, camera, finalClearFlags, cubeFace, mipLevel) {
|
|
15169
15376
|
var _cameraRenderTarget, _cameraRenderTarget1;
|
|
15170
15377
|
var cullingResults = this._cullingResults;
|
|
15171
15378
|
var opaqueQueue = cullingResults.opaqueQueue, alphaTestQueue = cullingResults.alphaTestQueue, transparentQueue = cullingResults.transparentQueue;
|
|
@@ -15182,14 +15389,33 @@
|
|
|
15182
15389
|
context.applyVirtualCamera(camera._virtualCamera, needFlipProjection);
|
|
15183
15390
|
}
|
|
15184
15391
|
rhi.activeRenderTarget(colorTarget, colorViewport, context.flipProjection, mipLevel, cubeFace);
|
|
15185
|
-
var clearFlags = camera.clearFlags & ~(ignoreClear != null ? ignoreClear : exports.CameraClearFlags.None);
|
|
15186
15392
|
var color = background.solidColor;
|
|
15187
|
-
if (
|
|
15188
|
-
|
|
15393
|
+
if (internalColorTarget && finalClearFlags !== exports.CameraClearFlags.All) {
|
|
15394
|
+
// Can use `blitFramebuffer` API to copy color/depth/stencil buffer from back buffer to internal RT
|
|
15395
|
+
if (this._canUseBlitFrameBuffer) {
|
|
15396
|
+
finalClearFlags !== exports.CameraClearFlags.None && rhi.clearRenderTarget(engine, finalClearFlags, color);
|
|
15397
|
+
rhi.blitInternalRTByBlitFrameBuffer(camera.renderTarget, internalColorTarget, finalClearFlags, camera.viewport);
|
|
15398
|
+
} else {
|
|
15399
|
+
if (!(finalClearFlags & exports.CameraClearFlags.Depth) || !(finalClearFlags & exports.CameraClearFlags.Stencil)) {
|
|
15400
|
+
Logger.warn("We clear all depth/stencil state cause of the internalRT can't copy depth/stencil buffer from back buffer when use copy plan");
|
|
15401
|
+
}
|
|
15402
|
+
if (this._shouldGrabColor) {
|
|
15403
|
+
rhi.clearRenderTarget(engine, exports.CameraClearFlags.DepthStencil);
|
|
15404
|
+
// Copy RT's color buffer to grab texture
|
|
15405
|
+
rhi.copyRenderTargetToSubTexture(camera.renderTarget, this._grabTexture, camera.viewport);
|
|
15406
|
+
// Then blit grab texture to internal RT's color buffer
|
|
15407
|
+
PipelineUtils.blitTexture(engine, this._grabTexture, internalColorTarget, 0, undefined, undefined, undefined, !camera.renderTarget);
|
|
15408
|
+
} else {
|
|
15409
|
+
rhi.clearRenderTarget(engine, exports.CameraClearFlags.All, color);
|
|
15410
|
+
}
|
|
15411
|
+
}
|
|
15412
|
+
rhi.activeRenderTarget(colorTarget, colorViewport, context.flipProjection, mipLevel, cubeFace);
|
|
15413
|
+
} else if (finalClearFlags !== exports.CameraClearFlags.None) {
|
|
15414
|
+
rhi.clearRenderTarget(engine, finalClearFlags, color);
|
|
15189
15415
|
}
|
|
15190
15416
|
opaqueQueue.render(context, exports.PipelineStage.Forward);
|
|
15191
15417
|
alphaTestQueue.render(context, exports.PipelineStage.Forward);
|
|
15192
|
-
if (
|
|
15418
|
+
if (finalClearFlags & exports.CameraClearFlags.Color) {
|
|
15193
15419
|
if (background.mode === exports.BackgroundMode.Sky) {
|
|
15194
15420
|
background.sky._render(context);
|
|
15195
15421
|
} else if (background.mode === exports.BackgroundMode.Texture && background.texture) {
|
|
@@ -15264,8 +15490,7 @@
|
|
|
15264
15490
|
var shaderPass = shaderPasses[i];
|
|
15265
15491
|
var renderState = shaderPass._renderState;
|
|
15266
15492
|
if (renderState) {
|
|
15267
|
-
renderState.
|
|
15268
|
-
renderQueueType = renderState.renderQueueType;
|
|
15493
|
+
renderQueueType = renderState._getRenderQueueByShaderData(shaderPass._renderStateDataMap, subRenderElement.material.shaderData);
|
|
15269
15494
|
} else {
|
|
15270
15495
|
renderQueueType = renderStates[i].renderQueueType;
|
|
15271
15496
|
}
|
|
@@ -27996,7 +28221,7 @@
|
|
|
27996
28221
|
(function() {
|
|
27997
28222
|
ParticleBufferUtils.boundsMaxLifetimeOffset = 7;
|
|
27998
28223
|
})();
|
|
27999
|
-
var blitFs = "#define GLSLIFY 1\nuniform mediump sampler2D renderer_BlitTexture;\n#ifdef HAS_TEX_LOD\nuniform float renderer_BlitMipLevel;\n#endif\nvarying vec2 v_uv;void main(){\n#ifdef HAS_TEX_LOD\ngl_FragColor=texture2DLodEXT(renderer_BlitTexture,
|
|
28224
|
+
var blitFs = "#define GLSLIFY 1\nuniform mediump sampler2D renderer_BlitTexture;\n#ifdef HAS_TEX_LOD\nuniform float renderer_BlitMipLevel;\n#endif\nvarying vec2 v_uv;void main(){vec2 uv=v_uv;\n#ifdef renderer_FlipYBlitTexture\nuv.y=1.0-uv.y;\n#endif\n#ifdef HAS_TEX_LOD\ngl_FragColor=texture2DLodEXT(renderer_BlitTexture,uv,renderer_BlitMipLevel);\n#else\ngl_FragColor=texture2D(renderer_BlitTexture,uv);\n#endif\n}"; // eslint-disable-line
|
|
28000
28225
|
var blitVs = "#define GLSLIFY 1\nattribute vec4 POSITION_UV;varying vec2 v_uv;void main(){gl_Position=vec4(POSITION_UV.xy,0.0,1.0);v_uv=POSITION_UV.zw;}"; // eslint-disable-line
|
|
28001
28226
|
var skyProceduralFs = "#define GLSLIFY 1\n#include <common>\nconst float MIE_G=-0.990;const float MIE_G2=0.9801;const float SKY_GROUND_THRESHOLD=0.02;uniform float material_SunSize;uniform float material_SunSizeConvergence;uniform vec4 scene_SunlightColor;uniform vec3 scene_SunlightDirection;varying vec3 v_GroundColor;varying vec3 v_SkyColor;\n#ifdef MATERIAL_SUN_HIGH_QUALITY\nvarying vec3 v_Vertex;\n#elif defined(MATERIAL_SUN_SIMPLE)\nvarying vec3 v_RayDir;\n#else\nvarying float v_SkyGroundFactor;\n#endif\n#if defined(MATERIAL_SUN_HIGH_QUALITY)||defined(MATERIAL_SUN_SIMPLE)\nvarying vec3 v_SunColor;\n#endif\n#if defined(ENGINE_IS_COLORSPACE_GAMMA)\n#define LINEAR_2_OUTPUT(color) sqrt(color)\n#endif\nfloat getMiePhase(float eyeCos,float eyeCos2){float temp=1.0+MIE_G2-2.0*MIE_G*eyeCos;temp=pow(temp,pow(material_SunSize,0.65)*10.0);temp=max(temp,1.0e-4);temp=1.5*((1.0-MIE_G2)/(2.0+MIE_G2))*(1.0+eyeCos2)/temp;return temp;}float calcSunAttenuation(vec3 lightPos,vec3 ray){\n#ifdef MATERIAL_SUN_HIGH_QUALITY\nfloat focusedEyeCos=pow(clamp(dot(lightPos,ray),0.0,1.0),material_SunSizeConvergence);return getMiePhase(-focusedEyeCos,focusedEyeCos*focusedEyeCos);\n#else\nvec3 delta=lightPos-ray;float dist=length(delta);float spot=1.0-smoothstep(0.0,material_SunSize,dist);return spot*spot;\n#endif\n}void main(){vec3 col=vec3(0.0,0.0,0.0);\n#ifdef MATERIAL_SUN_HIGH_QUALITY\nvec3 ray=normalize(v_Vertex);float y=ray.y/SKY_GROUND_THRESHOLD;\n#elif defined(MATERIAL_SUN_SIMPLE)\nvec3 ray=v_RayDir;float y=ray.y/SKY_GROUND_THRESHOLD;\n#else\nfloat y=v_SkyGroundFactor;\n#endif\ncol=mix(v_SkyColor,v_GroundColor,clamp(y,0.0,1.0));\n#if defined(MATERIAL_SUN_HIGH_QUALITY)||defined(MATERIAL_SUN_SIMPLE)\nif(y<0.0)col+=v_SunColor*calcSunAttenuation(-scene_SunlightDirection,-ray);\n#endif\n#ifdef ENGINE_IS_COLORSPACE_GAMMA\ncol=LINEAR_2_OUTPUT(col);\n#endif\ngl_FragColor=vec4(col,1.0);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ngl_FragColor=linearToGamma(gl_FragColor);\n#endif\n}"; // eslint-disable-line
|
|
28002
28227
|
var skyProceduralVs = "#define GLSLIFY 1\n#define OUTER_RADIUS 1.025\n#define RAYLEIGH (mix(0.0, 0.0025, pow(material_AtmosphereThickness,2.5)))\n#define MIE 0.0010\n#define SUN_BRIGHTNESS 20.0\n#define MAX_SCATTER 50.0\nconst float SKY_GROUND_THRESHOLD=0.02;const float outerRadius=OUTER_RADIUS;const float outerRadius2=OUTER_RADIUS*OUTER_RADIUS;const float innerRadius=1.0;const float innerRadius2=1.0;const float cameraHeight=0.0001;const float HDSundiskIntensityFactor=15.0;const float simpleSundiskIntensityFactor=27.0;const float sunScale=400.0*SUN_BRIGHTNESS;const float kmESun=MIE*SUN_BRIGHTNESS;const float km4PI=MIE*4.0*3.14159265;const float scale=1.0/(OUTER_RADIUS-1.0);const float scaleDepth=0.25;const float scaleOverScaleDepth=(1.0/(OUTER_RADIUS-1.0))/0.25;const float samples=2.0;const vec3 c_DefaultScatteringWavelength=vec3(0.65,0.57,0.475);const vec3 c_VariableRangeForScatteringWavelength=vec3(0.15,0.15,0.15);attribute vec4 POSITION;uniform mat4 camera_VPMat;uniform vec3 material_SkyTint;uniform vec3 material_GroundTint;uniform float material_Exposure;uniform float material_AtmosphereThickness;uniform vec4 scene_SunlightColor;uniform vec3 scene_SunlightDirection;varying vec3 v_GroundColor;varying vec3 v_SkyColor;\n#ifdef MATERIAL_SUN_HIGH_QUALITY\nvarying vec3 v_Vertex;\n#elif defined(MATERIAL_SUN_SIMPLE)\nvarying vec3 v_RayDir;\n#else\nvarying float v_SkyGroundFactor;\n#endif\n#if defined(MATERIAL_SUN_HIGH_QUALITY)||defined(MATERIAL_SUN_SIMPLE)\nvarying vec3 v_SunColor;\n#endif\n#if defined(ENGINE_IS_COLORSPACE_GAMMA)\n#define COLOR_2_GAMMA(color) color\n#define COLOR_2_LINEAR(color) color*color\n#else\n#define GAMMA 2.2\n#define COLOR_2_GAMMA(color) pow(color,vec3(1.0/GAMMA))\n#define COLOR_2_LINEAR(color) color\n#endif\nfloat getRayleighPhase(vec3 light,vec3 ray){float eyeCos=dot(light,ray);return 0.75+0.75*eyeCos*eyeCos;}float scaleAngle(float inCos){float x=1.0-inCos;return 0.25*exp(-0.00287+x*(0.459+x*(3.83+x*(-6.80+x*5.25))));}void main(){gl_Position=camera_VPMat*vec4(POSITION.xyz,1.0);vec3 skyTintInGammaSpace=COLOR_2_GAMMA(material_SkyTint);vec3 scatteringWavelength=mix(c_DefaultScatteringWavelength-c_VariableRangeForScatteringWavelength,c_DefaultScatteringWavelength+c_VariableRangeForScatteringWavelength,vec3(1.0)-skyTintInGammaSpace);vec3 invWavelength=1.0/pow(scatteringWavelength,vec3(4.0));float krESun=RAYLEIGH*SUN_BRIGHTNESS;float kr4PI=RAYLEIGH*4.0*3.14159265;vec3 cameraPos=vec3(0.0,innerRadius+cameraHeight,0.0);vec3 eyeRay=normalize(POSITION.xyz);float far=0.0;vec3 cIn,cOut;if(eyeRay.y>=0.0){far=sqrt(outerRadius2+innerRadius2*eyeRay.y*eyeRay.y-innerRadius2)-innerRadius*eyeRay.y;float height=innerRadius+cameraHeight;float depth=exp(scaleOverScaleDepth*-cameraHeight);float startAngle=dot(eyeRay,cameraPos)/height;float startOffset=depth*scaleAngle(startAngle);float sampleLength=far/samples;float scaledLength=sampleLength*scale;vec3 sampleRay=eyeRay*sampleLength;vec3 samplePoint=cameraPos+sampleRay*0.5;vec3 frontColor=vec3(0.0);{float height=length(samplePoint);float depth=exp(scaleOverScaleDepth*(innerRadius-height));float lightAngle=dot(-scene_SunlightDirection,samplePoint)/height;float cameraAngle=dot(eyeRay,samplePoint)/height;float scatter=(startOffset+depth*(scaleAngle(lightAngle)-scaleAngle(cameraAngle)));vec3 attenuate=exp(-clamp(scatter,0.0,MAX_SCATTER)*(invWavelength*kr4PI+km4PI));frontColor+=attenuate*(depth*scaledLength);samplePoint+=sampleRay;}{float height=length(samplePoint);float depth=exp(scaleOverScaleDepth*(innerRadius-height));float lightAngle=dot(-scene_SunlightDirection,samplePoint)/height;float cameraAngle=dot(eyeRay,samplePoint)/height;float scatter=(startOffset+depth*(scaleAngle(lightAngle)-scaleAngle(cameraAngle)));vec3 attenuate=exp(-clamp(scatter,0.0,MAX_SCATTER)*(invWavelength*kr4PI+km4PI));frontColor+=attenuate*(depth*scaledLength);samplePoint+=sampleRay;}cIn=frontColor*(invWavelength*krESun);cOut=frontColor*kmESun;}else{far=(-cameraHeight)/(min(-0.001,eyeRay.y));vec3 pos=cameraPos+far*eyeRay;float depth=exp((-cameraHeight)*(1.0/scaleDepth));float cameraAngle=dot(-eyeRay,pos);float lightAngle=dot(-scene_SunlightDirection,pos);float cameraScale=scaleAngle(cameraAngle);float lightScale=scaleAngle(lightAngle);float cameraOffset=depth*cameraScale;float temp=lightScale+cameraScale;float sampleLength=far/samples;float scaledLength=sampleLength*scale;vec3 sampleRay=eyeRay*sampleLength;vec3 samplePoint=cameraPos+sampleRay*0.5;vec3 frontColor=vec3(0.0,0.0,0.0);vec3 attenuate;{float height=length(samplePoint);float depth=exp(scaleOverScaleDepth*(innerRadius-height));float scatter=depth*temp-cameraOffset;attenuate=exp(-clamp(scatter,0.0,MAX_SCATTER)*(invWavelength*kr4PI+km4PI));frontColor+=attenuate*(depth*scaledLength);samplePoint+=sampleRay;}cIn=frontColor*(invWavelength*krESun+kmESun);cOut=clamp(attenuate,0.0,1.0);}\n#ifdef MATERIAL_SUN_HIGH_QUALITY\nv_Vertex=-POSITION.xyz;\n#elif defined(MATERIAL_SUN_SIMPLE)\nv_RayDir=-eyeRay;\n#else\nv_SkyGroundFactor=-eyeRay.y/SKY_GROUND_THRESHOLD;\n#endif\nv_GroundColor=material_Exposure*(cIn+COLOR_2_LINEAR(material_GroundTint)*cOut);v_SkyColor=material_Exposure*(cIn*getRayleighPhase(-scene_SunlightDirection,-eyeRay));float lightColorIntensity=clamp(length(scene_SunlightColor.xyz),0.25,1.0);\n#ifdef MATERIAL_SUN_HIGH_QUALITY\nv_SunColor=HDSundiskIntensityFactor*clamp(cOut,0.0,1.0)*scene_SunlightColor.xyz/lightColorIntensity;\n#elif defined(MATERIAL_SUN_SIMPLE)\nv_SunColor=simpleSundiskIntensityFactor*clamp(cOut*sunScale,0.0,1.0)*scene_SunlightColor.xyz/lightColorIntensity;\n#endif\n}"; // eslint-disable-line
|
|
@@ -33790,13 +34015,11 @@
|
|
|
33790
34015
|
return true;
|
|
33791
34016
|
};
|
|
33792
34017
|
_proto._applyTransition = function _applyTransition(layerIndex, layerData, layer, transition, aniUpdate) {
|
|
33793
|
-
// Need prepare first, it should crossFade when to exit
|
|
33794
|
-
var success = this._prepareCrossFadeByTransition(transition, layerIndex);
|
|
33795
34018
|
if (transition.isExit) {
|
|
33796
34019
|
this._checkAnyAndEntryState(layerIndex, layerData, layer, 0, aniUpdate);
|
|
33797
|
-
return
|
|
34020
|
+
return false;
|
|
33798
34021
|
}
|
|
33799
|
-
return
|
|
34022
|
+
return this._prepareCrossFadeByTransition(transition, layerIndex);
|
|
33800
34023
|
};
|
|
33801
34024
|
_proto._checkConditions = function _checkConditions(state, transition) {
|
|
33802
34025
|
var _state;
|
|
@@ -39137,6 +39360,72 @@
|
|
|
39137
39360
|
};
|
|
39138
39361
|
return CubeProbe;
|
|
39139
39362
|
}(Probe);
|
|
39363
|
+
/**
|
|
39364
|
+
* @internal
|
|
39365
|
+
*/ var Polyfill = /*#__PURE__*/ function() {
|
|
39366
|
+
var Polyfill = function Polyfill() {};
|
|
39367
|
+
Polyfill.registerPolyfill = function registerPolyfill() {
|
|
39368
|
+
Polyfill._registerMatchAll();
|
|
39369
|
+
};
|
|
39370
|
+
Polyfill._registerMatchAll = function _registerMatchAll() {
|
|
39371
|
+
if (!String.prototype.matchAll) {
|
|
39372
|
+
Logger.info("polyfill String.prototype.matchAll");
|
|
39373
|
+
String.prototype.matchAll = function(pattern) {
|
|
39374
|
+
var flags = pattern.flags;
|
|
39375
|
+
var globalFlagIdx = flags.indexOf("g");
|
|
39376
|
+
if (globalFlagIdx === -1) {
|
|
39377
|
+
throw TypeError("String.prototype.matchAll called with a non-global RegExp argument");
|
|
39378
|
+
}
|
|
39379
|
+
var bindThis = this;
|
|
39380
|
+
return function() {
|
|
39381
|
+
var matchResult, matchFlag, matchPattern, _tmp, _tmp1, _i, index, item;
|
|
39382
|
+
return __generator$1(this, function(_state) {
|
|
39383
|
+
switch(_state.label){
|
|
39384
|
+
case 0:
|
|
39385
|
+
matchResult = bindThis.match(pattern);
|
|
39386
|
+
if (matchResult == null) return [
|
|
39387
|
+
2,
|
|
39388
|
+
null
|
|
39389
|
+
];
|
|
39390
|
+
matchFlag = flags.split("g").join("");
|
|
39391
|
+
matchPattern = new RegExp(pattern.source, matchFlag);
|
|
39392
|
+
_tmp = [];
|
|
39393
|
+
for(_tmp1 in matchResult)_tmp.push(_tmp1);
|
|
39394
|
+
_i = 0;
|
|
39395
|
+
_state.label = 1;
|
|
39396
|
+
case 1:
|
|
39397
|
+
if (!(_i < _tmp.length)) return [
|
|
39398
|
+
3,
|
|
39399
|
+
4
|
|
39400
|
+
];
|
|
39401
|
+
index = _tmp[_i];
|
|
39402
|
+
item = matchResult[index];
|
|
39403
|
+
return [
|
|
39404
|
+
4,
|
|
39405
|
+
item.match(matchPattern)
|
|
39406
|
+
];
|
|
39407
|
+
case 2:
|
|
39408
|
+
_state.sent();
|
|
39409
|
+
_state.label = 3;
|
|
39410
|
+
case 3:
|
|
39411
|
+
_i++;
|
|
39412
|
+
return [
|
|
39413
|
+
3,
|
|
39414
|
+
1
|
|
39415
|
+
];
|
|
39416
|
+
case 4:
|
|
39417
|
+
return [
|
|
39418
|
+
2
|
|
39419
|
+
];
|
|
39420
|
+
}
|
|
39421
|
+
});
|
|
39422
|
+
}();
|
|
39423
|
+
};
|
|
39424
|
+
}
|
|
39425
|
+
};
|
|
39426
|
+
return Polyfill;
|
|
39427
|
+
}();
|
|
39428
|
+
Polyfill.registerPolyfill();
|
|
39140
39429
|
|
|
39141
39430
|
var CoreObjects = /*#__PURE__*/Object.freeze({
|
|
39142
39431
|
__proto__: null,
|
|
@@ -41246,7 +41535,7 @@
|
|
|
41246
41535
|
var gl = this._gl;
|
|
41247
41536
|
var _engine__lastRenderState = engine._lastRenderState, targetBlendState = _engine__lastRenderState.blendState.targetBlendState, depthState = _engine__lastRenderState.depthState, stencilState = _engine__lastRenderState.stencilState;
|
|
41248
41537
|
var clearFlag = 0;
|
|
41249
|
-
if (clearFlags & exports.CameraClearFlags.Color) {
|
|
41538
|
+
if (clearFlags & exports.CameraClearFlags.Color && clearColor) {
|
|
41250
41539
|
clearFlag |= gl.COLOR_BUFFER_BIT;
|
|
41251
41540
|
var lc = this._lastClearColor;
|
|
41252
41541
|
var r = clearColor.r, g = clearColor.g, b = clearColor.b, a = clearColor.a;
|
|
@@ -41310,6 +41599,75 @@
|
|
|
41310
41599
|
this.viewport(x, y, width, height);
|
|
41311
41600
|
this.scissor(x, y, width, height);
|
|
41312
41601
|
};
|
|
41602
|
+
_proto.blitInternalRTByBlitFrameBuffer = function blitInternalRTByBlitFrameBuffer(srcRT, destRT, clearFlags, viewport) {
|
|
41603
|
+
if (!this._isWebGL2) {
|
|
41604
|
+
Logger.warn("WebGL1.0 not support blit frame buffer.");
|
|
41605
|
+
return;
|
|
41606
|
+
}
|
|
41607
|
+
var gl = this._gl;
|
|
41608
|
+
// @ts-ignore
|
|
41609
|
+
var srcFrameBuffer = srcRT ? srcRT._platformRenderTarget._frameBuffer : null;
|
|
41610
|
+
// @ts-ignore
|
|
41611
|
+
var destFrameBuffer = destRT ? destRT._platformRenderTarget._frameBuffer : null;
|
|
41612
|
+
var bufferWidth = this.getMainFrameBufferWidth();
|
|
41613
|
+
var bufferHeight = this.getMainFrameBufferHeight();
|
|
41614
|
+
var srcWidth = srcRT ? srcRT.width : bufferWidth;
|
|
41615
|
+
var srcHeight = srcRT ? srcRT.height : bufferHeight;
|
|
41616
|
+
var blitWidth = destRT.width;
|
|
41617
|
+
var blitHeight = destRT.height;
|
|
41618
|
+
var needFlipY = !srcRT;
|
|
41619
|
+
var needBlitColor = (clearFlags & exports.CameraClearFlags.Color) === 0;
|
|
41620
|
+
var needBlitDepth = (clearFlags & exports.CameraClearFlags.Depth) === 0;
|
|
41621
|
+
var needBlitStencil = (clearFlags & exports.CameraClearFlags.Stencil) === 0;
|
|
41622
|
+
gl.bindFramebuffer(gl.READ_FRAMEBUFFER, srcFrameBuffer);
|
|
41623
|
+
gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, destFrameBuffer);
|
|
41624
|
+
var blitMask = needBlitColor ? gl.COLOR_BUFFER_BIT : 0;
|
|
41625
|
+
if (needBlitDepth || needBlitStencil) {
|
|
41626
|
+
// @ts-ignore
|
|
41627
|
+
var depthFormat = destRT._depthFormat;
|
|
41628
|
+
if (needBlitDepth) {
|
|
41629
|
+
if (depthFormat === exports.TextureFormat.Depth || depthFormat >= exports.TextureFormat.DepthStencil && depthFormat <= exports.TextureFormat.Depth32Stencil8) {
|
|
41630
|
+
blitMask |= gl.DEPTH_BUFFER_BIT;
|
|
41631
|
+
} else {
|
|
41632
|
+
Logger.warn("Do not clear depth, or set depth format of target which is " + exports.TextureFormat[depthFormat] + " now.");
|
|
41633
|
+
}
|
|
41634
|
+
}
|
|
41635
|
+
if (needBlitStencil) {
|
|
41636
|
+
if (depthFormat === exports.TextureFormat.Stencil || depthFormat === exports.TextureFormat.DepthStencil || depthFormat >= exports.TextureFormat.Depth24Stencil8 || depthFormat >= exports.TextureFormat.Depth32Stencil8) {
|
|
41637
|
+
blitMask |= gl.STENCIL_BUFFER_BIT;
|
|
41638
|
+
} else {
|
|
41639
|
+
Logger.warn("Do not clear stencil, or set stencil format of target which is " + exports.TextureFormat[depthFormat] + " now.");
|
|
41640
|
+
}
|
|
41641
|
+
}
|
|
41642
|
+
}
|
|
41643
|
+
var xStart = viewport.x * srcWidth;
|
|
41644
|
+
var xEnd = xStart + blitWidth;
|
|
41645
|
+
var yStart = needFlipY ? srcHeight - viewport.y * srcHeight : srcHeight - viewport.y * srcHeight - blitHeight;
|
|
41646
|
+
var yEnd = needFlipY ? yStart - blitHeight : yStart + blitHeight;
|
|
41647
|
+
gl.blitFramebuffer(xStart, yStart, xEnd, yEnd, 0, 0, blitWidth, blitHeight, blitMask, gl.NEAREST);
|
|
41648
|
+
};
|
|
41649
|
+
_proto.copyRenderTargetToSubTexture = function copyRenderTargetToSubTexture(srcRT, grabTexture, viewport) {
|
|
41650
|
+
var _srcRT;
|
|
41651
|
+
var gl = this._gl;
|
|
41652
|
+
var bufferWidth = this.getMainFrameBufferWidth();
|
|
41653
|
+
var bufferHeight = this.getMainFrameBufferHeight();
|
|
41654
|
+
var srcWidth = srcRT ? srcRT.width : bufferWidth;
|
|
41655
|
+
var srcHeight = srcRT ? srcRT.height : bufferHeight;
|
|
41656
|
+
var copyWidth = grabTexture.width;
|
|
41657
|
+
var copyHeight = grabTexture.height;
|
|
41658
|
+
var flipY = !srcRT;
|
|
41659
|
+
var xStart = viewport.x * srcWidth;
|
|
41660
|
+
var yStart = flipY ? srcHeight - viewport.y * srcHeight - copyHeight : viewport.y * srcHeight;
|
|
41661
|
+
var _srcRT__platformRenderTarget__frameBuffer;
|
|
41662
|
+
// @ts-ignore
|
|
41663
|
+
var frameBuffer = (_srcRT__platformRenderTarget__frameBuffer = (_srcRT = srcRT) == null ? void 0 : _srcRT._platformRenderTarget._frameBuffer) != null ? _srcRT__platformRenderTarget__frameBuffer : null;
|
|
41664
|
+
// @ts-ignore
|
|
41665
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, frameBuffer);
|
|
41666
|
+
// @ts-ignore
|
|
41667
|
+
var glTexture = grabTexture._platformTexture;
|
|
41668
|
+
glTexture._bind();
|
|
41669
|
+
gl.copyTexSubImage2D(glTexture._target, 0, 0, 0, xStart, yStart, copyWidth, copyHeight);
|
|
41670
|
+
};
|
|
41313
41671
|
_proto.activeTexture = function activeTexture(textureID) {
|
|
41314
41672
|
if (this._activeTextureID !== textureID) {
|
|
41315
41673
|
this._gl.activeTexture(textureID);
|
|
@@ -41370,6 +41728,7 @@
|
|
|
41370
41728
|
if (debugRenderInfo != null) {
|
|
41371
41729
|
this._renderer = gl.getParameter(debugRenderInfo.UNMASKED_RENDERER_WEBGL);
|
|
41372
41730
|
}
|
|
41731
|
+
this._contextAttributes = gl.getContextAttributes();
|
|
41373
41732
|
};
|
|
41374
41733
|
_proto.destroy = function destroy() {
|
|
41375
41734
|
var webCanvas = this._webCanvas;
|
|
@@ -41426,6 +41785,12 @@
|
|
|
41426
41785
|
get: function get() {
|
|
41427
41786
|
return this.capability.canIUseMoreJoints;
|
|
41428
41787
|
}
|
|
41788
|
+
},
|
|
41789
|
+
{
|
|
41790
|
+
key: "context",
|
|
41791
|
+
get: function get() {
|
|
41792
|
+
return this._contextAttributes;
|
|
41793
|
+
}
|
|
41429
41794
|
}
|
|
41430
41795
|
]);
|
|
41431
41796
|
return WebGLGraphicDevice;
|
|
@@ -47821,7 +48186,7 @@
|
|
|
47821
48186
|
};
|
|
47822
48187
|
return ShaderChunkLoader1;
|
|
47823
48188
|
}(Loader), function() {
|
|
47824
|
-
_ShaderChunkLoader._shaderIncludeRegex =
|
|
48189
|
+
_ShaderChunkLoader._shaderIncludeRegex = /#include\s+"([./][^\\"]+)"/gm;
|
|
47825
48190
|
}(), _ShaderChunkLoader);
|
|
47826
48191
|
ShaderChunkLoader = __decorate([
|
|
47827
48192
|
resourceLoader("ShaderChunk", [
|
|
@@ -48427,7 +48792,7 @@
|
|
|
48427
48792
|
], EXT_texture_webp);
|
|
48428
48793
|
|
|
48429
48794
|
//@ts-ignore
|
|
48430
|
-
var version = "1.3.
|
|
48795
|
+
var version = "1.3.26";
|
|
48431
48796
|
console.log("Galacean engine version: " + version);
|
|
48432
48797
|
for(var key in CoreObjects){
|
|
48433
48798
|
Loader.registerClass(key, CoreObjects[key]);
|