@galacean/engine-core 1.0.0-beta.0 → 1.0.0-beta.10
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 +785 -499
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +785 -499
- package/dist/module.js +780 -500
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/2d/data/RenderData2D.d.ts +1 -0
- package/types/2d/sprite/Sprite.d.ts +13 -3
- package/types/2d/sprite/SpriteMask.d.ts +16 -22
- package/types/2d/sprite/SpriteRenderer.d.ts +17 -20
- package/types/2d/text/TextRenderer.d.ts +1 -17
- package/types/Camera.d.ts +0 -7
- package/types/Engine.d.ts +0 -2
- package/types/Entity.d.ts +1 -1
- package/types/RenderPipeline/MeshRenderElement.d.ts +17 -0
- package/types/RenderPipeline/SpriteElement.d.ts +13 -0
- package/types/RenderPipeline/SpriteMaskElement.d.ts +10 -0
- package/types/RenderPipeline/TextRenderElement.d.ts +6 -0
- package/types/Renderer.d.ts +4 -12
- package/types/SafeLoopArray.d.ts +37 -0
- package/types/Scene.d.ts +1 -1
- package/types/animation/Animator.d.ts +2 -3
- package/types/animation/animationCurve/AnimationFloatArrayCurve.d.ts +0 -1
- package/types/animation/internal/AnimationCurveLayerOwner.d.ts +1 -0
- package/types/animation/internal/AnimationCurveOwnerLayerData.d.ts +1 -0
- package/types/asset/GraphicsResource.d.ts +0 -4
- package/types/asset/IRefObject.d.ts +2 -0
- package/types/asset/RefObject.d.ts +27 -0
- package/types/asset/ReferResource.d.ts +0 -5
- package/types/base/Event.d.ts +24 -0
- package/types/base/Util.d.ts +14 -0
- package/types/enums/ActiveChangeFlag.d.ts +6 -0
- package/types/env-probe/CubeProbe.d.ts +0 -7
- package/types/env-probe/Probe.d.ts +0 -6
- package/types/graphic/Buffer.d.ts +0 -3
- package/types/graphic/Mesh.d.ts +2 -12
- package/types/index.d.ts +1 -1
- package/types/lighting/Light.d.ts +0 -1
- package/types/material/BaseMaterial.d.ts +0 -2
- package/types/material/BlinnPhongMaterial.d.ts +0 -3
- package/types/material/Material.d.ts +1 -4
- package/types/material/PBRMaterial.d.ts +12 -3
- package/types/material/PBRSpecularMaterial.d.ts +1 -1
- package/types/material/UnlitMaterial.d.ts +1 -1
- package/types/mesh/MeshRenderer.d.ts +7 -12
- package/types/mesh/SkinnedMeshRenderer.d.ts +0 -13
- package/types/physics/CharacterController.d.ts +0 -2
- package/types/physics/PhysicsScene.d.ts +75 -0
- package/types/physics/joint/HingeJoint.d.ts +2 -2
- package/types/physics/joint/SpringJoint.d.ts +1 -1
- package/types/shader/index.d.ts +1 -0
- package/types/shader/state/index.d.ts +6 -0
- package/types/shadow/CascadedShadowCasterPass.d.ts +1 -0
- package/types/sky/Sky.d.ts +12 -4
- package/types/sky/SkyBoxMaterial.d.ts +0 -3
- package/types/sky/SkyProceduralMaterial.d.ts +1 -1
- package/types/texture/RenderTarget.d.ts +0 -4
- package/types/texture/Texture2DArray.d.ts +0 -4
- package/types/texture/TextureCube.d.ts +0 -4
- package/types/trail/TrailRenderer.d.ts +0 -5
- package/types/utils/BoolUpdateFlag.d.ts +12 -0
- package/types/utils/DisorderedArray.d.ts +18 -0
- package/types/utils/SafeLoopArray.d.ts +41 -0
- package/types/utils/UpdateFlag.d.ts +20 -0
- package/types/utils/UpdateFlagManager.d.ts +1 -0
- package/types/utils/Utils.d.ts +31 -0
package/dist/module.js
CHANGED
|
@@ -652,7 +652,6 @@ __decorate([
|
|
|
652
652
|
}
|
|
653
653
|
var _proto = ReferResource.prototype;
|
|
654
654
|
/**
|
|
655
|
-
* @override
|
|
656
655
|
* Destroy self.
|
|
657
656
|
* @param force - Whether to force the destruction, if it is false, refCount = 0 can be released successfully.
|
|
658
657
|
* @returns Whether the release was successful.
|
|
@@ -680,7 +679,7 @@ __decorate([
|
|
|
680
679
|
this._engine.resourceManager._addAsset(path, this);
|
|
681
680
|
};
|
|
682
681
|
/**
|
|
683
|
-
* @
|
|
682
|
+
* @internal
|
|
684
683
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
685
684
|
EngineObject.prototype._onDestroy.call(this);
|
|
686
685
|
this._engine.resourceManager._deleteReferResource(this);
|
|
@@ -814,7 +813,7 @@ var GraphicsResource = /*#__PURE__*/ function(ReferResource) {
|
|
|
814
813
|
}
|
|
815
814
|
var _proto = GraphicsResource.prototype;
|
|
816
815
|
/**
|
|
817
|
-
* @
|
|
816
|
+
* @internal
|
|
818
817
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
819
818
|
ReferResource.prototype._onDestroy.call(this);
|
|
820
819
|
this.engine.resourceManager._deleteGraphicResource(this);
|
|
@@ -884,7 +883,6 @@ var Logger = {
|
|
|
884
883
|
}
|
|
885
884
|
};
|
|
886
885
|
/**
|
|
887
|
-
* @override
|
|
888
886
|
* @internal
|
|
889
887
|
*/ _proto._rebuild = function _rebuild() {
|
|
890
888
|
var platformTexture = this._platformTexture;
|
|
@@ -896,7 +894,6 @@ var Logger = {
|
|
|
896
894
|
platformTexture.setUseDepthCompareMode(this._useDepthCompareMode);
|
|
897
895
|
};
|
|
898
896
|
/**
|
|
899
|
-
* @override
|
|
900
897
|
* @internal
|
|
901
898
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
902
899
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
@@ -1048,9 +1045,11 @@ var Logger = {
|
|
|
1048
1045
|
renderTexture
|
|
1049
1046
|
];
|
|
1050
1047
|
for(var i = 0, n = colorTextures.length; i < n; i++){
|
|
1051
|
-
|
|
1048
|
+
var colorTexture = colorTextures[i];
|
|
1049
|
+
if (colorTexture._isDepthTexture) {
|
|
1052
1050
|
throw "Render texture can't use depth format.";
|
|
1053
1051
|
}
|
|
1052
|
+
colorTexture._addReferCount(1);
|
|
1054
1053
|
}
|
|
1055
1054
|
_this._colorTextures = colorTextures;
|
|
1056
1055
|
} else {
|
|
@@ -1061,6 +1060,7 @@ var Logger = {
|
|
|
1061
1060
|
throw "Depth texture must use depth format.";
|
|
1062
1061
|
}
|
|
1063
1062
|
_this._depthTexture = depth;
|
|
1063
|
+
_this._depthTexture._addReferCount(1);
|
|
1064
1064
|
}
|
|
1065
1065
|
_this._platformRenderTarget = engine._hardwareRenderer.createPlatformRenderTarget(_assert_this_initialized(_this));
|
|
1066
1066
|
return _this;
|
|
@@ -1087,11 +1087,17 @@ var Logger = {
|
|
|
1087
1087
|
}
|
|
1088
1088
|
};
|
|
1089
1089
|
/**
|
|
1090
|
-
* @
|
|
1090
|
+
* @internal
|
|
1091
1091
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
1092
|
+
var _this__depthTexture;
|
|
1092
1093
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
1093
1094
|
this._platformRenderTarget.destroy();
|
|
1094
|
-
this
|
|
1095
|
+
var _this = this, colorTextures = _this._colorTextures;
|
|
1096
|
+
for(var i = 0, n = colorTextures.length; i < n; i++){
|
|
1097
|
+
colorTextures[i]._addReferCount(-1);
|
|
1098
|
+
}
|
|
1099
|
+
colorTextures.length = 0;
|
|
1100
|
+
(_this__depthTexture = this._depthTexture) == null ? void 0 : _this__depthTexture._addReferCount(-1);
|
|
1095
1101
|
this._depthTexture = null;
|
|
1096
1102
|
this._depth = null;
|
|
1097
1103
|
};
|
|
@@ -1106,7 +1112,6 @@ var Logger = {
|
|
|
1106
1112
|
this._platformRenderTarget.blitRenderTarget();
|
|
1107
1113
|
};
|
|
1108
1114
|
/**
|
|
1109
|
-
* @override
|
|
1110
1115
|
* @internal
|
|
1111
1116
|
*/ _proto._rebuild = function _rebuild() {
|
|
1112
1117
|
this._platformRenderTarget = this._engine._hardwareRenderer.createPlatformRenderTarget(this);
|
|
@@ -1309,7 +1314,7 @@ var Logger = {
|
|
|
1309
1314
|
}
|
|
1310
1315
|
};
|
|
1311
1316
|
/**
|
|
1312
|
-
* @
|
|
1317
|
+
* @internal
|
|
1313
1318
|
*/ _proto._rebuild = function _rebuild() {
|
|
1314
1319
|
this._platformTexture = this._engine._hardwareRenderer.createPlatformTexture2DArray(this);
|
|
1315
1320
|
Texture.prototype._rebuild.call(this);
|
|
@@ -1393,7 +1398,7 @@ var Logger = {
|
|
|
1393
1398
|
}
|
|
1394
1399
|
};
|
|
1395
1400
|
/**
|
|
1396
|
-
* @
|
|
1401
|
+
* @internal
|
|
1397
1402
|
*/ _proto._rebuild = function _rebuild() {
|
|
1398
1403
|
this._platformTexture = this._engine._hardwareRenderer.createPlatformTextureCube(this);
|
|
1399
1404
|
Texture.prototype._rebuild.call(this);
|
|
@@ -1468,7 +1473,6 @@ var Logger = {
|
|
|
1468
1473
|
return this._charInfoMap[char.charCodeAt(0)];
|
|
1469
1474
|
};
|
|
1470
1475
|
/**
|
|
1471
|
-
* @override
|
|
1472
1476
|
* @internal
|
|
1473
1477
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
1474
1478
|
ReferResource.prototype._onDestroy.call(this);
|
|
@@ -1977,6 +1981,7 @@ var Logger = {
|
|
|
1977
1981
|
var fontAtlas = new FontAtlas(engine);
|
|
1978
1982
|
var texture = new Texture2D(engine, 256, 256);
|
|
1979
1983
|
fontAtlas.texture = texture;
|
|
1984
|
+
fontAtlas.isGCIgnored = texture.isGCIgnored = true;
|
|
1980
1985
|
this._fontAtlases.push(fontAtlas);
|
|
1981
1986
|
var nativeFontString = this.nativeFontString;
|
|
1982
1987
|
engine.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
|
|
@@ -2034,7 +2039,6 @@ var Logger = {
|
|
|
2034
2039
|
return subFont;
|
|
2035
2040
|
};
|
|
2036
2041
|
/**
|
|
2037
|
-
* @override
|
|
2038
2042
|
* @internal
|
|
2039
2043
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
2040
2044
|
ReferResource.prototype._onDestroy.call(this);
|
|
@@ -3208,54 +3212,6 @@ var GLCapabilityType;
|
|
|
3208
3212
|
return ComponentsManager;
|
|
3209
3213
|
}();
|
|
3210
3214
|
|
|
3211
|
-
var ComponentCloner = /*#__PURE__*/ function() {
|
|
3212
|
-
function ComponentCloner() {}
|
|
3213
|
-
/**
|
|
3214
|
-
* Clone component.
|
|
3215
|
-
* @param source - Clone source
|
|
3216
|
-
* @param target - Clone target
|
|
3217
|
-
*/ ComponentCloner.cloneComponent = function cloneComponent(source, target) {
|
|
3218
|
-
var cloneModes = CloneManager.getCloneMode(source.constructor);
|
|
3219
|
-
var keys = Object.keys(source);
|
|
3220
|
-
for(var i = 0, n = keys.length; i < n; i++){
|
|
3221
|
-
var k = keys[i];
|
|
3222
|
-
var cloneMode = cloneModes[k];
|
|
3223
|
-
switch(cloneMode){
|
|
3224
|
-
case undefined:
|
|
3225
|
-
case CloneMode.Assignment:
|
|
3226
|
-
target[k] = source[k];
|
|
3227
|
-
break;
|
|
3228
|
-
case CloneMode.Shallow:
|
|
3229
|
-
var sourcePropS = source[k];
|
|
3230
|
-
if (_instanceof(sourcePropS, Object)) {
|
|
3231
|
-
var tarProp = target[k];
|
|
3232
|
-
tarProp == null && (tarProp = target[k] = sourcePropS.constructor());
|
|
3233
|
-
Object.assign(tarProp, sourcePropS);
|
|
3234
|
-
} else {
|
|
3235
|
-
// Null or undefined and primitive type.
|
|
3236
|
-
target[k] = sourcePropS;
|
|
3237
|
-
}
|
|
3238
|
-
break;
|
|
3239
|
-
case CloneMode.Deep:
|
|
3240
|
-
var sourcePropD = source[k];
|
|
3241
|
-
if (_instanceof(sourcePropD, Object)) {
|
|
3242
|
-
var tarProp1 = target[k];
|
|
3243
|
-
tarProp1 == null && (tarProp1 = target[k] = sourcePropD.constructor());
|
|
3244
|
-
CloneManager.deepCloneObject(sourcePropD, tarProp1);
|
|
3245
|
-
} else {
|
|
3246
|
-
// Null or undefined and primitive type.
|
|
3247
|
-
target[k] = sourcePropD;
|
|
3248
|
-
}
|
|
3249
|
-
break;
|
|
3250
|
-
}
|
|
3251
|
-
}
|
|
3252
|
-
if (source._cloneTo) {
|
|
3253
|
-
source._cloneTo(target);
|
|
3254
|
-
}
|
|
3255
|
-
};
|
|
3256
|
-
return ComponentCloner;
|
|
3257
|
-
}();
|
|
3258
|
-
|
|
3259
3215
|
/**
|
|
3260
3216
|
* The base class of the components.
|
|
3261
3217
|
*/ var Component = /*#__PURE__*/ function(EngineObject) {
|
|
@@ -3304,7 +3260,6 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
3304
3260
|
}
|
|
3305
3261
|
};
|
|
3306
3262
|
/**
|
|
3307
|
-
* @override
|
|
3308
3263
|
* @internal
|
|
3309
3264
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
3310
3265
|
EngineObject.prototype._onDestroy.call(this);
|
|
@@ -4538,6 +4493,54 @@ var TransformModifyFlags;
|
|
|
4538
4493
|
TransformModifyFlags[TransformModifyFlags[/** WorldMatrix | WorldPosition | WorldEuler | WorldQuat | WorldScale */ "WmWpWeWqWs"] = 0xbc] = "WmWpWeWqWs";
|
|
4539
4494
|
})(TransformModifyFlags || (TransformModifyFlags = {}));
|
|
4540
4495
|
|
|
4496
|
+
var ComponentCloner = /*#__PURE__*/ function() {
|
|
4497
|
+
function ComponentCloner() {}
|
|
4498
|
+
/**
|
|
4499
|
+
* Clone component.
|
|
4500
|
+
* @param source - Clone source
|
|
4501
|
+
* @param target - Clone target
|
|
4502
|
+
*/ ComponentCloner.cloneComponent = function cloneComponent(source, target) {
|
|
4503
|
+
var cloneModes = CloneManager.getCloneMode(source.constructor);
|
|
4504
|
+
var keys = Object.keys(source);
|
|
4505
|
+
for(var i = 0, n = keys.length; i < n; i++){
|
|
4506
|
+
var k = keys[i];
|
|
4507
|
+
var cloneMode = cloneModes[k];
|
|
4508
|
+
switch(cloneMode){
|
|
4509
|
+
case undefined:
|
|
4510
|
+
case CloneMode.Assignment:
|
|
4511
|
+
target[k] = source[k];
|
|
4512
|
+
break;
|
|
4513
|
+
case CloneMode.Shallow:
|
|
4514
|
+
var sourcePropS = source[k];
|
|
4515
|
+
if (_instanceof(sourcePropS, Object)) {
|
|
4516
|
+
var tarProp = target[k];
|
|
4517
|
+
tarProp == null && (tarProp = target[k] = sourcePropS.constructor());
|
|
4518
|
+
Object.assign(tarProp, sourcePropS);
|
|
4519
|
+
} else {
|
|
4520
|
+
// Null or undefined and primitive type.
|
|
4521
|
+
target[k] = sourcePropS;
|
|
4522
|
+
}
|
|
4523
|
+
break;
|
|
4524
|
+
case CloneMode.Deep:
|
|
4525
|
+
var sourcePropD = source[k];
|
|
4526
|
+
if (_instanceof(sourcePropD, Object)) {
|
|
4527
|
+
var tarProp1 = target[k];
|
|
4528
|
+
tarProp1 == null && (tarProp1 = target[k] = sourcePropD.constructor());
|
|
4529
|
+
CloneManager.deepCloneObject(sourcePropD, tarProp1);
|
|
4530
|
+
} else {
|
|
4531
|
+
// Null or undefined and primitive type.
|
|
4532
|
+
target[k] = sourcePropD;
|
|
4533
|
+
}
|
|
4534
|
+
break;
|
|
4535
|
+
}
|
|
4536
|
+
}
|
|
4537
|
+
if (source._cloneTo) {
|
|
4538
|
+
source._cloneTo(target);
|
|
4539
|
+
}
|
|
4540
|
+
};
|
|
4541
|
+
return ComponentCloner;
|
|
4542
|
+
}();
|
|
4543
|
+
|
|
4541
4544
|
/**
|
|
4542
4545
|
* Entity, be used as components container.
|
|
4543
4546
|
*/ var Entity = /*#__PURE__*/ function(EngineObject) {
|
|
@@ -5268,14 +5271,14 @@ SystemInfo._initialize();
|
|
|
5268
5271
|
Keys[Keys[/** Tab or ⇥. */ "Tab"] = 63] = "Tab";
|
|
5269
5272
|
Keys[Keys[/** Japanese: 変換 (henkan). */ "Convert"] = 64] = "Convert";
|
|
5270
5273
|
Keys[Keys[/** Japanese: カタカナ/ひらがな/ローマ字 (katakana/hiragana/romaji). */ "KanaMode"] = 65] = "KanaMode";
|
|
5271
|
-
Keys[Keys[/**
|
|
5272
|
-
* Korean: HangulMode 한/영 (han/yeong).
|
|
5273
|
-
* Japanese (Mac keyboard): かな (kana).
|
|
5274
|
-
* */ "Lang1"] = 66] = "Lang1";
|
|
5275
5274
|
Keys[Keys[/**
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5275
|
+
* Korean: HangulMode 한/영 (han/yeong).
|
|
5276
|
+
* Japanese (Mac keyboard): かな (kana).
|
|
5277
|
+
* */ "Lang1"] = 66] = "Lang1";
|
|
5278
|
+
Keys[Keys[/**
|
|
5279
|
+
* Korean: Hanja 한자 (hanja).
|
|
5280
|
+
* Japanese (Mac keyboard): 英数 (eisu).
|
|
5281
|
+
*/ "Lang2"] = 67] = "Lang2";
|
|
5279
5282
|
Keys[Keys[/** Japanese (word-processing keyboard): Katakana. */ "Lang3"] = 68] = "Lang3";
|
|
5280
5283
|
Keys[Keys[/** Japanese (word-processing keyboard): Hiragana. */ "Lang4"] = 69] = "Lang4";
|
|
5281
5284
|
Keys[Keys[/** Japanese (word-processing keyboard): Zenkaku/Hankaku. */ "Lang5"] = 70] = "Lang5";
|
|
@@ -5292,46 +5295,46 @@ SystemInfo._initialize();
|
|
|
5292
5295
|
Keys[Keys[/** → */ "ArrowRight"] = 81] = "ArrowRight";
|
|
5293
5296
|
Keys[Keys[/** ↑ */ "ArrowUp"] = 82] = "ArrowUp";
|
|
5294
5297
|
Keys[Keys[/** On the Mac, the "NumLock" code should be used for the numpad Clear key. */ "NumLock"] = 83] = "NumLock";
|
|
5295
|
-
Keys[Keys[/**
|
|
5296
|
-
* 0 Ins on a keyboard.
|
|
5297
|
-
* 0 on a phone or remote control.
|
|
5298
|
-
* */ "Numpad0"] = 84] = "Numpad0";
|
|
5299
5298
|
Keys[Keys[/**
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5299
|
+
* 0 Ins on a keyboard.
|
|
5300
|
+
* 0 on a phone or remote control.
|
|
5301
|
+
* */ "Numpad0"] = 84] = "Numpad0";
|
|
5302
|
+
Keys[Keys[/**
|
|
5303
|
+
* 1 End on a keyboard.
|
|
5304
|
+
* 1 or 1 QZ on a phone or remote control.
|
|
5305
|
+
*/ "Numpad1"] = 85] = "Numpad1";
|
|
5303
5306
|
Keys[Keys[/**
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
+
* 2 ↓ on a keyboard.
|
|
5308
|
+
* 2 ABC on a phone or remote control.
|
|
5309
|
+
*/ "Numpad2"] = 86] = "Numpad2";
|
|
5307
5310
|
Keys[Keys[/**
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
+
* 3 PgDn on a keyboard.
|
|
5312
|
+
* 3 DEF on a phone or remote control.
|
|
5313
|
+
*/ "Numpad3"] = 87] = "Numpad3";
|
|
5311
5314
|
Keys[Keys[/**
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
+
* 4 ← on a keyboard.
|
|
5316
|
+
* 4 GHI on a phone or remote control.
|
|
5317
|
+
*/ "Numpad4"] = 88] = "Numpad4";
|
|
5315
5318
|
Keys[Keys[/**
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
+
* 5 on a keyboard.
|
|
5320
|
+
* 5 JKL on a phone or remote control.
|
|
5321
|
+
*/ "Numpad5"] = 89] = "Numpad5";
|
|
5319
5322
|
Keys[Keys[/**
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
+
* 6 → on a keyboard.
|
|
5324
|
+
* 6 MNO on a phone or remote control.
|
|
5325
|
+
*/ "Numpad6"] = 90] = "Numpad6";
|
|
5323
5326
|
Keys[Keys[/**
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
+
* 7 Home on a keyboard.
|
|
5328
|
+
* 7 PQRS or 7 PRS on a phone or remote control.
|
|
5329
|
+
*/ "Numpad7"] = 91] = "Numpad7";
|
|
5327
5330
|
Keys[Keys[/**
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
+
* 8 ↑ on a keyboard.
|
|
5332
|
+
* 8 TUV on a phone or remote control.
|
|
5333
|
+
*/ "Numpad8"] = 92] = "Numpad8";
|
|
5331
5334
|
Keys[Keys[/**
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
+
* 9 PgUp on a keyboard.
|
|
5336
|
+
* 9 WXYZ or 9 WXY on a phone or remote control.
|
|
5337
|
+
*/ "Numpad9"] = 93] = "Numpad9";
|
|
5335
5338
|
Keys[Keys[/** + */ "NumpadAdd"] = 94] = "NumpadAdd";
|
|
5336
5339
|
Keys[Keys[/** Found on the Microsoft Natural Keyboard. */ "NumpadBackspace"] = 95] = "NumpadBackspace";
|
|
5337
5340
|
Keys[Keys[/** C or AC (All Clear). Also for use with numpads that have a Clear key that is separate from the NumLock key. On the Mac, the numpad Clear key should always be encoded as "NumLock". */ "NumpadClear"] = 96] = "NumpadClear";
|
|
@@ -5347,16 +5350,16 @@ SystemInfo._initialize();
|
|
|
5347
5350
|
Keys[Keys[/** MR Replace the current entry with the value stored in memory. */ "NumpadMemoryRecall"] = 106] = "NumpadMemoryRecall";
|
|
5348
5351
|
Keys[Keys[/** MS Replace the value stored in memory with the current entry. */ "NumpadMemoryStore"] = 107] = "NumpadMemoryStore";
|
|
5349
5352
|
Keys[Keys[/** M- Subtract current entry from the value stored in memory. */ "NumpadMemorySubtract"] = 108] = "NumpadMemorySubtract";
|
|
5350
|
-
Keys[Keys[/**
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5353
|
+
Keys[Keys[/**
|
|
5354
|
+
* * on a keyboard. For use with numpads that provide mathematical operations (+, -, * and /).
|
|
5355
|
+
* Use "NumpadStar" for the * key on phones and remote controls.
|
|
5356
|
+
*/ "NumpadMultiply"] = 109] = "NumpadMultiply";
|
|
5354
5357
|
Keys[Keys[/** ( Found on the Microsoft Natural Keyboard. */ "NumpadParenLeft"] = 110] = "NumpadParenLeft";
|
|
5355
5358
|
Keys[Keys[/** ) Found on the Microsoft Natural Keyboard. */ "NumpadParenRight"] = 111] = "NumpadParenRight";
|
|
5356
5359
|
Keys[Keys[/**
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
+
* * on a phone or remote control device. This key is typically found below the 7 key and to the left of the 0 key.
|
|
5361
|
+
* Use "NumpadMultiply" for the * key on numeric keypads.
|
|
5362
|
+
*/ "NumpadStar"] = 112] = "NumpadStar";
|
|
5360
5363
|
Keys[Keys[/** - */ "NumpadSubtract"] = 113] = "NumpadSubtract";
|
|
5361
5364
|
Keys[Keys[/** Esc or ⎋. */ "Escape"] = 114] = "Escape";
|
|
5362
5365
|
Keys[Keys[/** F1 */ "F1"] = 115] = "F1";
|
|
@@ -6022,19 +6025,16 @@ var Collider = /*#__PURE__*/ function(Component) {
|
|
|
6022
6025
|
* @internal
|
|
6023
6026
|
*/ _proto._onLateUpdate = function _onLateUpdate() {};
|
|
6024
6027
|
/**
|
|
6025
|
-
* @override
|
|
6026
6028
|
* @internal
|
|
6027
6029
|
*/ _proto._onEnable = function _onEnable() {
|
|
6028
6030
|
this.engine.physicsManager._addCollider(this);
|
|
6029
6031
|
};
|
|
6030
6032
|
/**
|
|
6031
|
-
* @override
|
|
6032
6033
|
* @internal
|
|
6033
6034
|
*/ _proto._onDisable = function _onDisable() {
|
|
6034
6035
|
this.engine.physicsManager._removeCollider(this);
|
|
6035
6036
|
};
|
|
6036
6037
|
/**
|
|
6037
|
-
* @override
|
|
6038
6038
|
* @internal
|
|
6039
6039
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
6040
6040
|
Component.prototype._onDestroy.call(this);
|
|
@@ -6075,7 +6075,6 @@ Collider = __decorate([
|
|
|
6075
6075
|
function CharacterController(entity) {
|
|
6076
6076
|
var _this;
|
|
6077
6077
|
_this = Collider.call(this, entity) || this;
|
|
6078
|
-
/** @internal */ _this._index = -1;
|
|
6079
6078
|
_this._stepOffset = 0.5;
|
|
6080
6079
|
_this._nonWalkableMode = ControllerNonWalkableMode.PreventClimbing;
|
|
6081
6080
|
_this._upDirection = new Vector3(0, 1, 0);
|
|
@@ -6099,7 +6098,6 @@ Collider = __decorate([
|
|
|
6099
6098
|
/**
|
|
6100
6099
|
* Add collider shape on this controller.
|
|
6101
6100
|
* @param shape - Collider shape
|
|
6102
|
-
* @override
|
|
6103
6101
|
*/ _proto.addShape = function addShape(shape) {
|
|
6104
6102
|
if (this._shapes.length > 0) {
|
|
6105
6103
|
throw "only allow single shape on controller!";
|
|
@@ -6109,7 +6107,6 @@ Collider = __decorate([
|
|
|
6109
6107
|
};
|
|
6110
6108
|
/**
|
|
6111
6109
|
* Remove all shape attached.
|
|
6112
|
-
* @override
|
|
6113
6110
|
*/ _proto.clearShapes = function clearShapes() {
|
|
6114
6111
|
if (this._shapes.length > 0) {
|
|
6115
6112
|
Collider.prototype.removeShape.call(this, this._shapes[0]);
|
|
@@ -6117,7 +6114,6 @@ Collider = __decorate([
|
|
|
6117
6114
|
};
|
|
6118
6115
|
/**
|
|
6119
6116
|
* @internal
|
|
6120
|
-
* @override
|
|
6121
6117
|
*/ _proto._onUpdate = function _onUpdate() {
|
|
6122
6118
|
if (this._updateFlag.flag) {
|
|
6123
6119
|
var transform = this.entity.transform;
|
|
@@ -6132,7 +6128,6 @@ Collider = __decorate([
|
|
|
6132
6128
|
};
|
|
6133
6129
|
/**
|
|
6134
6130
|
* @internal
|
|
6135
|
-
* @override
|
|
6136
6131
|
*/ _proto._onLateUpdate = function _onLateUpdate() {
|
|
6137
6132
|
var position = this.entity.transform.worldPosition;
|
|
6138
6133
|
this._nativeCollider.getWorldPosition(position);
|
|
@@ -6140,13 +6135,11 @@ Collider = __decorate([
|
|
|
6140
6135
|
this._updateFlag.flag = false;
|
|
6141
6136
|
};
|
|
6142
6137
|
/**
|
|
6143
|
-
* @override
|
|
6144
6138
|
* @internal
|
|
6145
6139
|
*/ _proto._onEnable = function _onEnable() {
|
|
6146
6140
|
this.engine.physicsManager._addCharacterController(this);
|
|
6147
6141
|
};
|
|
6148
6142
|
/**
|
|
6149
|
-
* @override
|
|
6150
6143
|
* @internal
|
|
6151
6144
|
*/ _proto._onDisable = function _onDisable() {
|
|
6152
6145
|
this.engine.physicsManager._removeCharacterController(this);
|
|
@@ -6639,7 +6632,6 @@ Joint = __decorate([
|
|
|
6639
6632
|
}
|
|
6640
6633
|
var _proto = FixedJoint.prototype;
|
|
6641
6634
|
/**
|
|
6642
|
-
* @override
|
|
6643
6635
|
* @internal
|
|
6644
6636
|
*/ _proto._onAwake = function _onAwake() {
|
|
6645
6637
|
var collider = this._collider;
|
|
@@ -6673,7 +6665,6 @@ Joint = __decorate([
|
|
|
6673
6665
|
}
|
|
6674
6666
|
var _proto = HingeJoint.prototype;
|
|
6675
6667
|
/**
|
|
6676
|
-
* @override
|
|
6677
6668
|
* @internal
|
|
6678
6669
|
*/ _proto._onAwake = function _onAwake() {
|
|
6679
6670
|
var collider = this._collider;
|
|
@@ -6825,7 +6816,6 @@ Joint = __decorate([
|
|
|
6825
6816
|
}
|
|
6826
6817
|
var _proto = SpringJoint.prototype;
|
|
6827
6818
|
/**
|
|
6828
|
-
* @override
|
|
6829
6819
|
* @internal
|
|
6830
6820
|
*/ _proto._onAwake = function _onAwake() {
|
|
6831
6821
|
var collider = this._collider;
|
|
@@ -7030,7 +7020,6 @@ Joint = __decorate([
|
|
|
7030
7020
|
this._nativeCollider.wakeUp();
|
|
7031
7021
|
};
|
|
7032
7022
|
/**
|
|
7033
|
-
* @override
|
|
7034
7023
|
* @internal
|
|
7035
7024
|
*/ _proto._onLateUpdate = function _onLateUpdate() {
|
|
7036
7025
|
var transform = this.entity.transform;
|
|
@@ -7897,7 +7886,10 @@ var DynamicColliderConstraints;
|
|
|
7897
7886
|
return _this;
|
|
7898
7887
|
}
|
|
7899
7888
|
var _proto = Light.prototype;
|
|
7900
|
-
|
|
7889
|
+
/**
|
|
7890
|
+
* Light Color, include intensity.
|
|
7891
|
+
* @internal
|
|
7892
|
+
*/ _proto._getLightIntensityColor = function _getLightIntensityColor() {
|
|
7901
7893
|
this._lightColor.r = this.color.r * this.intensity;
|
|
7902
7894
|
this._lightColor.g = this.color.g * this.intensity;
|
|
7903
7895
|
this._lightColor.b = this.color.b * this.intensity;
|
|
@@ -7967,15 +7959,21 @@ __decorate([
|
|
|
7967
7959
|
var cullingMaskStart = lightIndex * 2;
|
|
7968
7960
|
var colorStart = lightIndex * 3;
|
|
7969
7961
|
var directionStart = lightIndex * 3;
|
|
7970
|
-
var lightColor = this.
|
|
7962
|
+
var lightColor = this._getLightIntensityColor();
|
|
7971
7963
|
var direction = this.direction;
|
|
7972
7964
|
var data = DirectLight._combinedData;
|
|
7973
7965
|
var cullingMask = this.cullingMask;
|
|
7974
7966
|
data.cullingMask[cullingMaskStart] = cullingMask & 65535;
|
|
7975
7967
|
data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7968
|
+
if (this.engine.settings.colorSpace === ColorSpace.Linear) {
|
|
7969
|
+
data.color[colorStart] = Color$1.gammaToLinearSpace(lightColor.r);
|
|
7970
|
+
data.color[colorStart + 1] = Color$1.gammaToLinearSpace(lightColor.g);
|
|
7971
|
+
data.color[colorStart + 2] = Color$1.gammaToLinearSpace(lightColor.b);
|
|
7972
|
+
} else {
|
|
7973
|
+
data.color[colorStart] = lightColor.r;
|
|
7974
|
+
data.color[colorStart + 1] = lightColor.g;
|
|
7975
|
+
data.color[colorStart + 2] = lightColor.b;
|
|
7976
|
+
}
|
|
7979
7977
|
data.direction[directionStart] = direction.x;
|
|
7980
7978
|
data.direction[directionStart + 1] = direction.y;
|
|
7981
7979
|
data.direction[directionStart + 2] = direction.z;
|
|
@@ -7983,14 +7981,12 @@ __decorate([
|
|
|
7983
7981
|
/**
|
|
7984
7982
|
* Mount to the current Scene.
|
|
7985
7983
|
* @internal
|
|
7986
|
-
* @override
|
|
7987
7984
|
*/ _proto._onEnable = function _onEnable() {
|
|
7988
7985
|
this.engine._lightManager._attachDirectLight(this);
|
|
7989
7986
|
};
|
|
7990
7987
|
/**
|
|
7991
7988
|
* Unmount from the current Scene.
|
|
7992
7989
|
* @internal
|
|
7993
|
-
* @override
|
|
7994
7990
|
*/ _proto._onDisable = function _onDisable() {
|
|
7995
7991
|
this.engine._lightManager._detachDirectLight(this);
|
|
7996
7992
|
};
|
|
@@ -8024,7 +8020,6 @@ __decorate([
|
|
|
8024
8020
|
key: "_shadowProjectionMatrix",
|
|
8025
8021
|
get: /**
|
|
8026
8022
|
* @internal
|
|
8027
|
-
* @override
|
|
8028
8023
|
*/ function get() {
|
|
8029
8024
|
throw "Unknown!";
|
|
8030
8025
|
}
|
|
@@ -8067,15 +8062,21 @@ __decorate([
|
|
|
8067
8062
|
var colorStart = lightIndex * 3;
|
|
8068
8063
|
var positionStart = lightIndex * 3;
|
|
8069
8064
|
var distanceStart = lightIndex;
|
|
8070
|
-
var lightColor = this.
|
|
8065
|
+
var lightColor = this._getLightIntensityColor();
|
|
8071
8066
|
var lightPosition = this.position;
|
|
8072
8067
|
var data = PointLight._combinedData;
|
|
8073
8068
|
var cullingMask = this.cullingMask;
|
|
8074
8069
|
data.cullingMask[cullingMaskStart] = cullingMask & 65535;
|
|
8075
8070
|
data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
|
|
8076
|
-
|
|
8077
|
-
|
|
8078
|
-
|
|
8071
|
+
if (this.engine.settings.colorSpace === ColorSpace.Linear) {
|
|
8072
|
+
data.color[colorStart] = Color$1.gammaToLinearSpace(lightColor.r);
|
|
8073
|
+
data.color[colorStart + 1] = Color$1.gammaToLinearSpace(lightColor.g);
|
|
8074
|
+
data.color[colorStart + 2] = Color$1.gammaToLinearSpace(lightColor.b);
|
|
8075
|
+
} else {
|
|
8076
|
+
data.color[colorStart] = lightColor.r;
|
|
8077
|
+
data.color[colorStart + 1] = lightColor.g;
|
|
8078
|
+
data.color[colorStart + 2] = lightColor.b;
|
|
8079
|
+
}
|
|
8079
8080
|
data.position[positionStart] = lightPosition.x;
|
|
8080
8081
|
data.position[positionStart + 1] = lightPosition.y;
|
|
8081
8082
|
data.position[positionStart + 2] = lightPosition.z;
|
|
@@ -8084,14 +8085,12 @@ __decorate([
|
|
|
8084
8085
|
/**
|
|
8085
8086
|
* Mount to the current Scene.
|
|
8086
8087
|
* @internal
|
|
8087
|
-
* @override
|
|
8088
8088
|
*/ _proto._onEnable = function _onEnable() {
|
|
8089
8089
|
this.engine._lightManager._attachPointLight(this);
|
|
8090
8090
|
};
|
|
8091
8091
|
/**
|
|
8092
8092
|
* Unmount from the current Scene.
|
|
8093
8093
|
* @internal
|
|
8094
|
-
* @override
|
|
8095
8094
|
*/ _proto._onDisable = function _onDisable() {
|
|
8096
8095
|
this.engine._lightManager._detachPointLight(this);
|
|
8097
8096
|
};
|
|
@@ -8117,7 +8116,6 @@ __decorate([
|
|
|
8117
8116
|
key: "_shadowProjectionMatrix",
|
|
8118
8117
|
get: /**
|
|
8119
8118
|
* @internal
|
|
8120
|
-
* @override
|
|
8121
8119
|
*/ function get() {
|
|
8122
8120
|
throw "Unknown!";
|
|
8123
8121
|
}
|
|
@@ -8171,16 +8169,22 @@ __decorate([
|
|
|
8171
8169
|
var distanceStart = lightIndex;
|
|
8172
8170
|
var penumbraCosStart = lightIndex;
|
|
8173
8171
|
var angleCosStart = lightIndex;
|
|
8174
|
-
var
|
|
8172
|
+
var lightColor = this._getLightIntensityColor();
|
|
8175
8173
|
var position = this.position;
|
|
8176
8174
|
var direction = this.direction;
|
|
8177
8175
|
var data = SpotLight._combinedData;
|
|
8178
8176
|
var cullingMask = this.cullingMask;
|
|
8179
8177
|
data.cullingMask[cullingMaskStart] = cullingMask & 65535;
|
|
8180
8178
|
data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
|
|
8181
|
-
|
|
8182
|
-
|
|
8183
|
-
|
|
8179
|
+
if (this.engine.settings.colorSpace === ColorSpace.Linear) {
|
|
8180
|
+
data.color[colorStart] = Color$1.gammaToLinearSpace(lightColor.r);
|
|
8181
|
+
data.color[colorStart + 1] = Color$1.gammaToLinearSpace(lightColor.g);
|
|
8182
|
+
data.color[colorStart + 2] = Color$1.gammaToLinearSpace(lightColor.b);
|
|
8183
|
+
} else {
|
|
8184
|
+
data.color[colorStart] = lightColor.r;
|
|
8185
|
+
data.color[colorStart + 1] = lightColor.g;
|
|
8186
|
+
data.color[colorStart + 2] = lightColor.b;
|
|
8187
|
+
}
|
|
8184
8188
|
data.position[positionStart] = position.x;
|
|
8185
8189
|
data.position[positionStart + 1] = position.y;
|
|
8186
8190
|
data.position[positionStart + 2] = position.z;
|
|
@@ -8194,14 +8198,12 @@ __decorate([
|
|
|
8194
8198
|
/**
|
|
8195
8199
|
* Mount to the current Scene.
|
|
8196
8200
|
* @internal
|
|
8197
|
-
* @override
|
|
8198
8201
|
*/ _proto._onEnable = function _onEnable() {
|
|
8199
8202
|
this.engine._lightManager._attachSpotLight(this);
|
|
8200
8203
|
};
|
|
8201
8204
|
/**
|
|
8202
8205
|
* Unmount from the current Scene.
|
|
8203
8206
|
* @internal
|
|
8204
|
-
* @override
|
|
8205
8207
|
*/ _proto._onDisable = function _onDisable() {
|
|
8206
8208
|
this.engine._lightManager._detachSpotLight(this);
|
|
8207
8209
|
};
|
|
@@ -8247,7 +8249,6 @@ __decorate([
|
|
|
8247
8249
|
key: "_shadowProjectionMatrix",
|
|
8248
8250
|
get: /**
|
|
8249
8251
|
* @internal
|
|
8250
|
-
* @override
|
|
8251
8252
|
*/ function get() {
|
|
8252
8253
|
var matrix = this._projectMatrix;
|
|
8253
8254
|
var fov = Math.min(Math.PI / 2, this.angle * 2 * Math.sqrt(2));
|
|
@@ -8826,6 +8827,7 @@ __decorate([
|
|
|
8826
8827
|
_proto.cloneTo = function cloneTo(target) {
|
|
8827
8828
|
CloneManager.deepCloneObject(this._macroCollection, target._macroCollection);
|
|
8828
8829
|
Object.assign(target._macroMap, this._macroMap);
|
|
8830
|
+
var referCount = target._getReferCount();
|
|
8829
8831
|
var propertyValueMap = this._propertyValueMap;
|
|
8830
8832
|
var targetPropertyValueMap = target._propertyValueMap;
|
|
8831
8833
|
var keys = Object.keys(propertyValueMap);
|
|
@@ -8837,6 +8839,7 @@ __decorate([
|
|
|
8837
8839
|
targetPropertyValueMap[k] = property;
|
|
8838
8840
|
} else if (_instanceof(property, Texture)) {
|
|
8839
8841
|
targetPropertyValueMap[k] = property;
|
|
8842
|
+
referCount > 0 && property._addReferCount(referCount);
|
|
8840
8843
|
} else if (_instanceof(property, Array) || _instanceof(property, Float32Array) || _instanceof(property, Int32Array)) {
|
|
8841
8844
|
targetPropertyValueMap[k] = property.slice();
|
|
8842
8845
|
} else {
|
|
@@ -9416,9 +9419,7 @@ __decorate([
|
|
|
9416
9419
|
this.shaderData.cloneTo(target.shaderData);
|
|
9417
9420
|
CloneManager.deepCloneObject(this.renderStates, target.renderStates);
|
|
9418
9421
|
};
|
|
9419
|
-
|
|
9420
|
-
* @override
|
|
9421
|
-
*/ _proto._addReferCount = function _addReferCount(value) {
|
|
9422
|
+
_proto._addReferCount = function _addReferCount(value) {
|
|
9422
9423
|
ReferResource.prototype._addReferCount.call(this, value);
|
|
9423
9424
|
this.shaderData._addReferCount(value);
|
|
9424
9425
|
};
|
|
@@ -9543,21 +9544,21 @@ var camera_declare = "#define GLSLIFY 1\nuniform vec3 camera_Position;"; // esli
|
|
|
9543
9544
|
|
|
9544
9545
|
var common = "#define GLSLIFY 1\n#define PI 3.14159265359\n#define RECIPROCAL_PI 0.31830988618\n#define EPSILON 1e-6\n#define LOG2 1.442695\n#define saturate( a ) clamp( a, 0.0, 1.0 )\nfloat pow2(float x){return x*x;}vec4 RGBMToLinear(vec4 value,float maxRange){return vec4(value.rgb*value.a*maxRange,1.0);}vec4 gammaToLinear(vec4 srgbIn){return vec4(pow(srgbIn.rgb,vec3(2.2)),srgbIn.a);}vec4 linearToGamma(vec4 linearIn){return vec4(pow(linearIn.rgb,vec3(1.0/2.2)),linearIn.a);}\n#ifdef GRAPHICS_API_WEBGL2\n#define INVERSE_MAT(mat) inverse(mat)\n#else\nmat2 inverseMat(mat2 m){return mat2(m[1][1],-m[0][1],-m[1][0],m[0][0])/(m[0][0]*m[1][1]-m[0][1]*m[1][0]);}mat3 inverseMat(mat3 m){float a00=m[0][0],a01=m[0][1],a02=m[0][2];float a10=m[1][0],a11=m[1][1],a12=m[1][2];float a20=m[2][0],a21=m[2][1],a22=m[2][2];float b01=a22*a11-a12*a21;float b11=-a22*a10+a12*a20;float b21=a21*a10-a11*a20;float det=a00*b01+a01*b11+a02*b21;return mat3(b01,(-a22*a01+a02*a21),(a12*a01-a02*a11),b11,(a22*a00-a02*a20),(-a12*a00+a02*a10),b21,(-a21*a00+a01*a20),(a11*a00-a01*a10))/det;}mat4 inverseMat(mat4 m){float a00=m[0][0],a01=m[0][1],a02=m[0][2],a03=m[0][3],a10=m[1][0],a11=m[1][1],a12=m[1][2],a13=m[1][3],a20=m[2][0],a21=m[2][1],a22=m[2][2],a23=m[2][3],a30=m[3][0],a31=m[3][1],a32=m[3][2],a33=m[3][3],b00=a00*a11-a01*a10,b01=a00*a12-a02*a10,b02=a00*a13-a03*a10,b03=a01*a12-a02*a11,b04=a01*a13-a03*a11,b05=a02*a13-a03*a12,b06=a20*a31-a21*a30,b07=a20*a32-a22*a30,b08=a20*a33-a23*a30,b09=a21*a32-a22*a31,b10=a21*a33-a23*a31,b11=a22*a33-a23*a32,det=b00*b11-b01*b10+b02*b09+b03*b08-b04*b07+b05*b06;return mat4(a11*b11-a12*b10+a13*b09,a02*b10-a01*b11-a03*b09,a31*b05-a32*b04+a33*b03,a22*b04-a21*b05-a23*b03,a12*b08-a10*b11-a13*b07,a00*b11-a02*b08+a03*b07,a32*b02-a30*b05-a33*b01,a20*b05-a22*b02+a23*b01,a10*b10-a11*b08+a13*b06,a01*b08-a00*b10-a03*b06,a30*b04-a31*b02+a33*b00,a21*b02-a20*b04-a23*b00,a11*b07-a10*b09-a12*b06,a00*b09-a01*b07+a02*b06,a31*b01-a30*b03-a32*b00,a20*b03-a21*b01+a22*b00)/det;}\n#define INVERSE_MAT(mat) inverseMat(mat)\n#endif\n"; // eslint-disable-line
|
|
9545
9546
|
|
|
9546
|
-
var common_vert = "#define GLSLIFY 1\nattribute vec3 POSITION;\n#ifdef RENDERER_HAS_UV\nattribute vec2 TEXCOORD_0;\n#endif\n#ifdef RENDERER_HAS_UV1\nattribute vec2 TEXCOORD_1;\n#endif\n#ifdef RENDERER_HAS_SKIN\nattribute vec4 JOINTS_0;attribute vec4 WEIGHTS_0;\n#ifdef RENDERER_USE_JOINT_TEXTURE\nuniform sampler2D renderer_JointSampler;uniform float renderer_JointCount;mat4 getJointMatrix(sampler2D smp,float index){float base=index/renderer_JointCount;float hf=0.5/renderer_JointCount;float v=base+hf;vec4 m0=texture2D(smp,vec2(0.125,v));vec4 m1=texture2D(smp,vec2(0.375,v));vec4 m2=texture2D(smp,vec2(0.625,v));vec4 m3=texture2D(smp,vec2(0.875,v));return mat4(m0,m1,m2,m3);}\n#else\nuniform mat4 renderer_JointMatrix[RENDERER_JOINTS_NUM];\n#endif\n#endif\n#ifdef
|
|
9547
|
+
var common_vert = "#define GLSLIFY 1\nattribute vec3 POSITION;\n#ifdef RENDERER_HAS_UV\nattribute vec2 TEXCOORD_0;\n#endif\n#ifdef RENDERER_HAS_UV1\nattribute vec2 TEXCOORD_1;\n#endif\n#ifdef RENDERER_HAS_SKIN\nattribute vec4 JOINTS_0;attribute vec4 WEIGHTS_0;\n#ifdef RENDERER_USE_JOINT_TEXTURE\nuniform sampler2D renderer_JointSampler;uniform float renderer_JointCount;mat4 getJointMatrix(sampler2D smp,float index){float base=index/renderer_JointCount;float hf=0.5/renderer_JointCount;float v=base+hf;vec4 m0=texture2D(smp,vec2(0.125,v));vec4 m1=texture2D(smp,vec2(0.375,v));vec4 m2=texture2D(smp,vec2(0.625,v));vec4 m3=texture2D(smp,vec2(0.875,v));return mat4(m0,m1,m2,m3);}\n#else\nuniform mat4 renderer_JointMatrix[RENDERER_JOINTS_NUM];\n#endif\n#endif\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\nattribute vec4 COLOR_0;\n#endif\n#include <transform_declare>\n#include <camera_declare>\nuniform vec4 material_TilingOffset;\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef RENDERER_HAS_NORMAL\nattribute vec3 NORMAL;\n#endif\n#ifdef RENDERER_HAS_TANGENT\nattribute vec4 TANGENT;\n#endif\n#endif\n"; // eslint-disable-line
|
|
9547
9548
|
|
|
9548
9549
|
var transform_declare = "#define GLSLIFY 1\nuniform mat4 renderer_LocalMat;uniform mat4 renderer_ModelMat;uniform mat4 camera_ViewMat;uniform mat4 camera_ProjMat;uniform mat4 renderer_MVMat;uniform mat4 renderer_MVPMat;uniform mat4 renderer_NormalMat;"; // eslint-disable-line
|
|
9549
9550
|
|
|
9550
|
-
var color_share = "#define GLSLIFY 1\n#ifdef
|
|
9551
|
+
var color_share = "#define GLSLIFY 1\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\nvarying vec4 v_color;\n#endif\n"; // eslint-disable-line
|
|
9551
9552
|
|
|
9552
9553
|
var FogFragmentDeclaration = "#define GLSLIFY 1\n#if SCENE_FOG_MODE != 0\nvarying vec3 v_positionVS;uniform vec4 scene_FogColor;uniform vec4 scene_FogParams;float ComputeFogIntensity(float fogDepth){\n#if SCENE_FOG_MODE == 1\nreturn clamp(fogDepth*scene_FogParams.x+scene_FogParams.y,0.0,1.0);\n#elif SCENE_FOG_MODE == 2\nreturn clamp(exp2(-fogDepth*scene_FogParams.z),0.0,1.0);\n#elif SCENE_FOG_MODE == 3\nfloat factor=fogDepth*scene_FogParams.w;return clamp(exp2(-factor*factor),0.0,1.0);\n#endif\n}\n#endif\n"; // eslint-disable-line
|
|
9553
9554
|
|
|
9554
9555
|
var FogVertexDeclaration = "#define GLSLIFY 1\n#if SCENE_FOG_MODE != 0\nvarying vec3 v_positionVS;\n#endif\n"; // eslint-disable-line
|
|
9555
9556
|
|
|
9556
|
-
var normal_share = "#define GLSLIFY 1\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef RENDERER_HAS_NORMAL\nvarying vec3 v_normal;\n#if defined(RENDERER_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(
|
|
9557
|
+
var normal_share = "#define GLSLIFY 1\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef RENDERER_HAS_NORMAL\nvarying vec3 v_normal;\n#if defined(RENDERER_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\nvarying mat3 v_TBN;\n#endif\n#endif\n#endif\n"; // eslint-disable-line
|
|
9557
9558
|
|
|
9558
9559
|
var uv_share = "#define GLSLIFY 1\nvarying vec2 v_uv;\n#ifdef RENDERER_HAS_UV1\nvarying vec2 v_uv1;\n#endif\n"; // eslint-disable-line
|
|
9559
9560
|
|
|
9560
|
-
var worldpos_share = "#define GLSLIFY 1\n#ifdef
|
|
9561
|
+
var worldpos_share = "#define GLSLIFY 1\n#ifdef MATERIAL_NEED_WORLD_POS\nvarying vec3 v_pos;\n#endif\n"; // eslint-disable-line
|
|
9561
9562
|
|
|
9562
9563
|
var begin_normal_vert = "#define GLSLIFY 1\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef RENDERER_HAS_NORMAL\nvec3 normal=vec3(NORMAL);\n#endif\n#ifdef RENDERER_HAS_TANGENT\nvec4 tangent=vec4(TANGENT);\n#endif\n#endif\n"; // eslint-disable-line
|
|
9563
9564
|
|
|
@@ -9565,21 +9566,21 @@ var begin_position_vert = "#define GLSLIFY 1\nvec4 position=vec4(POSITION,1.0);"
|
|
|
9565
9566
|
|
|
9566
9567
|
var blendShape_input = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_BLENDSHAPE\n#ifdef RENDERER_BLENDSHAPE_USE_TEXTURE\nuniform mediump sampler2DArray renderer_BlendShapeTexture;uniform ivec3 renderer_BlendShapeTextureInfo;uniform float renderer_BlendShapeWeights[RENDERER_BLENDSHAPE_COUNT];\n#else\nattribute vec3 POSITION_BS0;attribute vec3 POSITION_BS1;\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) && defined( RENDERER_BLENDSHAPE_HAS_TANGENT )\nattribute vec3 NORMAL_BS0;attribute vec3 NORMAL_BS1;attribute vec3 TANGENT_BS0;attribute vec3 TANGENT_BS1;uniform float renderer_BlendShapeWeights[2];\n#else\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) || defined( RENDERER_BLENDSHAPE_HAS_TANGENT )\nattribute vec3 POSITION_BS2;attribute vec3 POSITION_BS3;\n#ifdef RENDERER_BLENDSHAPE_HAS_NORMAL\nattribute vec3 NORMAL_BS0;attribute vec3 NORMAL_BS1;attribute vec3 NORMAL_BS2;attribute vec3 NORMAL_BS3;\n#endif\n#ifdef RENDERER_BLENDSHAPE_HAS_TANGENT\nattribute vec3 TANGENT_BS0;attribute vec3 TANGENT_BS1;attribute vec3 TANGENT_BS2;attribute vec3 TANGENT_BS3;\n#endif\nuniform float renderer_BlendShapeWeights[4];\n#else\nattribute vec3 POSITION_BS2;attribute vec3 POSITION_BS3;attribute vec3 POSITION_BS4;attribute vec3 POSITION_BS5;attribute vec3 POSITION_BS6;attribute vec3 POSITION_BS7;uniform float renderer_BlendShapeWeights[8];\n#endif\n#endif\n#endif\n#ifdef RENDERER_BLENDSHAPE_USE_TEXTURE\nvec3 getBlendShapeVertexElement(int blendShapeIndex,int vertexElementIndex){int y=vertexElementIndex/renderer_BlendShapeTextureInfo.y;int x=vertexElementIndex-y*renderer_BlendShapeTextureInfo.y;ivec3 uv=ivec3(x,y,blendShapeIndex);return texelFetch(renderer_BlendShapeTexture,uv,0).xyz;}\n#endif\n#endif\n"; // eslint-disable-line
|
|
9567
9568
|
|
|
9568
|
-
var blendShape_vert = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_BLENDSHAPE\n#ifdef RENDERER_BLENDSHAPE_USE_TEXTURE\nint vertexOffset=gl_VertexID*renderer_BlendShapeTextureInfo.x;for(int i=0;i<RENDERER_BLENDSHAPE_COUNT;i++){int vertexElementOffset=vertexOffset;float weight=renderer_BlendShapeWeights[i];position.xyz+=getBlendShapeVertexElement(i,vertexElementOffset)*weight;\n#ifndef MATERIAL_OMIT_NORMAL\n#if defined( RENDERER_HAS_NORMAL ) && defined( RENDERER_BLENDSHAPE_HAS_NORMAL )\nvertexElementOffset+=1;normal+=getBlendShapeVertexElement(i,vertexElementOffset)*weight;\n#endif\n#if defined( RENDERER_HAS_TANGENT ) && defined(RENDERER_BLENDSHAPE_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(
|
|
9569
|
+
var blendShape_vert = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_BLENDSHAPE\n#ifdef RENDERER_BLENDSHAPE_USE_TEXTURE\nint vertexOffset=gl_VertexID*renderer_BlendShapeTextureInfo.x;for(int i=0;i<RENDERER_BLENDSHAPE_COUNT;i++){int vertexElementOffset=vertexOffset;float weight=renderer_BlendShapeWeights[i];position.xyz+=getBlendShapeVertexElement(i,vertexElementOffset)*weight;\n#ifndef MATERIAL_OMIT_NORMAL\n#if defined( RENDERER_HAS_NORMAL ) && defined( RENDERER_BLENDSHAPE_HAS_NORMAL )\nvertexElementOffset+=1;normal+=getBlendShapeVertexElement(i,vertexElementOffset)*weight;\n#endif\n#if defined( RENDERER_HAS_TANGENT ) && defined(RENDERER_BLENDSHAPE_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\nvertexElementOffset+=1;tangent.xyz+=getBlendShapeVertexElement(i,vertexElementOffset)*weight;\n#endif\n#endif\n}\n#else\nposition.xyz+=POSITION_BS0*renderer_BlendShapeWeights[0];position.xyz+=POSITION_BS1*renderer_BlendShapeWeights[1];\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) && defined( RENDERER_BLENDSHAPE_HAS_TANGENT )\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef RENDERER_HAS_NORMAL\nnormal+=NORMAL_BS0*renderer_BlendShapeWeights[0];normal+=NORMAL_BS1*renderer_BlendShapeWeights[1];\n#endif\n#if defined( RENDERER_HAS_TANGENT ) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\ntangent.xyz+=TANGENT_BS0*renderer_BlendShapeWeights[0];tangent.xyz+=TANGENT_BS1*renderer_BlendShapeWeights[1];\n#endif\n#endif\n#else\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) || defined( RENDERER_BLENDSHAPE_HAS_TANGENT )\n#ifndef MATERIAL_OMIT_NORMAL\nposition.xyz+=POSITION_BS2*renderer_BlendShapeWeights[2];position.xyz+=POSITION_BS3*renderer_BlendShapeWeights[3];\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) && defined( RENDERER_HAS_NORMAL )\nnormal+=NORMAL_BS0*renderer_BlendShapeWeights[0];normal+=NORMAL_BS1*renderer_BlendShapeWeights[1];normal+=NORMAL_BS2*renderer_BlendShapeWeights[2];normal+=NORMAL_BS3*renderer_BlendShapeWeights[3];\n#endif\n#if defined(RENDERER_BLENDSHAPE_HAS_TANGENT) && defined( RENDERER_HAS_TANGENT ) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\ntangent.xyz+=TANGENT_BS0*renderer_BlendShapeWeights[0];tangent.xyz+=TANGENT_BS1*renderer_BlendShapeWeights[1];tangent.xyz+=TANGENT_BS2*renderer_BlendShapeWeights[2];tangent.xyz+=TANGENT_BS3*renderer_BlendShapeWeights[3];\n#endif\n#endif\n#else\nposition.xyz+=POSITION_BS2*renderer_BlendShapeWeights[2];position.xyz+=POSITION_BS3*renderer_BlendShapeWeights[3];position.xyz+=POSITION_BS4*renderer_BlendShapeWeights[4];position.xyz+=POSITION_BS5*renderer_BlendShapeWeights[5];position.xyz+=POSITION_BS6*renderer_BlendShapeWeights[6];position.xyz+=POSITION_BS7*renderer_BlendShapeWeights[7];\n#endif\n#endif\n#endif\n#endif\n"; // eslint-disable-line
|
|
9569
9570
|
|
|
9570
|
-
var color_vert = "#define GLSLIFY 1\n#ifdef
|
|
9571
|
+
var color_vert = "#define GLSLIFY 1\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\nv_color=COLOR_0;\n#endif\n"; // eslint-disable-line
|
|
9571
9572
|
|
|
9572
9573
|
var FogVertex = "#define GLSLIFY 1\n#if SCENE_FOG_MODE != 0\nvec4 positionVS=renderer_MVMat*position;v_positionVS=positionVS.xyz/positionVS.w;\n#endif\n"; // eslint-disable-line
|
|
9573
9574
|
|
|
9574
|
-
var normal_vert = "#define GLSLIFY 1\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef RENDERER_HAS_NORMAL\nv_normal=normalize(mat3(renderer_NormalMat)*normal);\n#if defined(RENDERER_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(
|
|
9575
|
+
var normal_vert = "#define GLSLIFY 1\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef RENDERER_HAS_NORMAL\nv_normal=normalize(mat3(renderer_NormalMat)*normal);\n#if defined(RENDERER_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\nvec3 normalW=normalize(mat3(renderer_NormalMat)*normal.xyz);vec3 tangentW=normalize(mat3(renderer_NormalMat)*tangent.xyz);vec3 bitangentW=cross(normalW,tangentW)*tangent.w;v_TBN=mat3(tangentW,bitangentW,normalW);\n#endif\n#endif\n#endif\n"; // eslint-disable-line
|
|
9575
9576
|
|
|
9576
9577
|
var position_vert = "#define GLSLIFY 1\ngl_Position=renderer_MVPMat*position;"; // eslint-disable-line
|
|
9577
9578
|
|
|
9578
|
-
var skinning_vert = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_SKIN\n#ifdef RENDERER_USE_JOINT_TEXTURE\nmat4 skinMatrix=WEIGHTS_0.x*getJointMatrix(renderer_JointSampler,JOINTS_0.x)+WEIGHTS_0.y*getJointMatrix(renderer_JointSampler,JOINTS_0.y)+WEIGHTS_0.z*getJointMatrix(renderer_JointSampler,JOINTS_0.z)+WEIGHTS_0.w*getJointMatrix(renderer_JointSampler,JOINTS_0.w);\n#else\nmat4 skinMatrix=WEIGHTS_0.x*renderer_JointMatrix[int(JOINTS_0.x)]+WEIGHTS_0.y*renderer_JointMatrix[int(JOINTS_0.y)]+WEIGHTS_0.z*renderer_JointMatrix[int(JOINTS_0.z)]+WEIGHTS_0.w*renderer_JointMatrix[int(JOINTS_0.w)];\n#endif\nposition=skinMatrix*position;\n#if defined(RENDERER_HAS_NORMAL) && !defined(MATERIAL_OMIT_NORMAL)\nmat3 skinNormalMatrix=INVERSE_MAT(mat3(skinMatrix));normal=normal*skinNormalMatrix;\n#if defined(RENDERER_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(
|
|
9579
|
+
var skinning_vert = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_SKIN\n#ifdef RENDERER_USE_JOINT_TEXTURE\nmat4 skinMatrix=WEIGHTS_0.x*getJointMatrix(renderer_JointSampler,JOINTS_0.x)+WEIGHTS_0.y*getJointMatrix(renderer_JointSampler,JOINTS_0.y)+WEIGHTS_0.z*getJointMatrix(renderer_JointSampler,JOINTS_0.z)+WEIGHTS_0.w*getJointMatrix(renderer_JointSampler,JOINTS_0.w);\n#else\nmat4 skinMatrix=WEIGHTS_0.x*renderer_JointMatrix[int(JOINTS_0.x)]+WEIGHTS_0.y*renderer_JointMatrix[int(JOINTS_0.y)]+WEIGHTS_0.z*renderer_JointMatrix[int(JOINTS_0.z)]+WEIGHTS_0.w*renderer_JointMatrix[int(JOINTS_0.w)];\n#endif\nposition=skinMatrix*position;\n#if defined(RENDERER_HAS_NORMAL) && !defined(MATERIAL_OMIT_NORMAL)\nmat3 skinNormalMatrix=INVERSE_MAT(mat3(skinMatrix));normal=normal*skinNormalMatrix;\n#if defined(RENDERER_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\ntangent.xyz=tangent.xyz*skinNormalMatrix;\n#endif\n#endif\n#endif\n"; // eslint-disable-line
|
|
9579
9580
|
|
|
9580
|
-
var uv_vert = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_UV\nv_uv=TEXCOORD_0;\n#else\nv_uv=vec2(0.,0.);\n#endif\n#ifdef RENDERER_HAS_UV1\nv_uv1=TEXCOORD_1;\n#endif\n#ifdef
|
|
9581
|
+
var uv_vert = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_UV\nv_uv=TEXCOORD_0;\n#else\nv_uv=vec2(0.,0.);\n#endif\n#ifdef RENDERER_HAS_UV1\nv_uv1=TEXCOORD_1;\n#endif\n#ifdef MATERIAL_NEED_TILING_OFFSET\nv_uv=v_uv*material_TilingOffset.xy+material_TilingOffset.zw;\n#endif\n"; // eslint-disable-line
|
|
9581
9582
|
|
|
9582
|
-
var worldpos_vert = "#define GLSLIFY 1\n#ifdef
|
|
9583
|
+
var worldpos_vert = "#define GLSLIFY 1\n#ifdef MATERIAL_NEED_WORLD_POS\nvec4 temp_pos=renderer_ModelMat*position;v_pos=temp_pos.xyz/temp_pos.w;\n#endif\n"; // eslint-disable-line
|
|
9583
9584
|
|
|
9584
9585
|
var FogFragment = "#define GLSLIFY 1\n#if SCENE_FOG_MODE != 0\nfloat fogIntensity=ComputeFogIntensity(length(v_positionVS));gl_FragColor.rgb=mix(scene_FogColor.rgb,gl_FragColor.rgb,fogIntensity);\n#endif\n"; // eslint-disable-line
|
|
9585
9586
|
|
|
@@ -9587,11 +9588,11 @@ var light_frag_define = "#define GLSLIFY 1\n#ifdef SCENE_DIRECT_LIGHT_COUNT\nstr
|
|
|
9587
9588
|
|
|
9588
9589
|
var mobile_material_frag = "#define GLSLIFY 1\nuniform vec4 material_EmissiveColor;uniform vec4 material_BaseColor;uniform vec4 material_SpecularColor;uniform float material_Shininess;uniform float material_NormalIntensity;uniform float material_AlphaCutoff;\n#ifdef MATERIAL_HAS_EMISSIVETEXTURE\nuniform sampler2D material_EmissiveTexture;\n#endif\n#ifdef MATERIAL_HAS_BASETEXTURE\nuniform sampler2D material_BaseTexture;\n#endif\n#ifdef MATERIAL_HAS_SPECULAR_TEXTURE\nuniform sampler2D material_SpecularTexture;\n#endif\n#ifdef MATERIAL_HAS_NORMALTEXTURE\nuniform sampler2D material_NormalTexture;\n#endif\n"; // eslint-disable-line
|
|
9589
9590
|
|
|
9590
|
-
var begin_mobile_frag = "#define GLSLIFY 1\nvec4 ambient=vec4(0.0);vec4 emission=material_EmissiveColor;vec4 diffuse=material_BaseColor;vec4 specular=material_SpecularColor;\n#ifdef MATERIAL_HAS_EMISSIVETEXTURE\nvec4 emissiveTextureColor=texture2D(material_EmissiveTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nemissiveTextureColor=gammaToLinear(emissiveTextureColor);\n#endif\nemission*=emissiveTextureColor;\n#endif\n#ifdef MATERIAL_HAS_BASETEXTURE\nvec4 diffuseTextureColor=texture2D(material_BaseTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ndiffuseTextureColor=gammaToLinear(diffuseTextureColor);\n#endif\ndiffuse*=diffuseTextureColor;\n#endif\n#ifdef
|
|
9591
|
+
var begin_mobile_frag = "#define GLSLIFY 1\nvec4 ambient=vec4(0.0);vec4 emission=material_EmissiveColor;vec4 diffuse=material_BaseColor;vec4 specular=material_SpecularColor;\n#ifdef MATERIAL_HAS_EMISSIVETEXTURE\nvec4 emissiveTextureColor=texture2D(material_EmissiveTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nemissiveTextureColor=gammaToLinear(emissiveTextureColor);\n#endif\nemission*=emissiveTextureColor;\n#endif\n#ifdef MATERIAL_HAS_BASETEXTURE\nvec4 diffuseTextureColor=texture2D(material_BaseTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ndiffuseTextureColor=gammaToLinear(diffuseTextureColor);\n#endif\ndiffuse*=diffuseTextureColor;\n#endif\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\ndiffuse*=v_color;\n#endif\n#ifdef MATERIAL_HAS_SPECULAR_TEXTURE\nvec4 specularTextureColor=texture2D(material_SpecularTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nspecularTextureColor=gammaToLinear(specularTextureColor);\n#endif\nspecular*=specularTextureColor;\n#endif\nambient=vec4(scene_EnvMapLight.diffuse*scene_EnvMapLight.diffuseIntensity,1.0)*diffuse;"; // eslint-disable-line
|
|
9591
9592
|
|
|
9592
|
-
var begin_viewdir_frag = "#define GLSLIFY 1\n#ifdef
|
|
9593
|
+
var begin_viewdir_frag = "#define GLSLIFY 1\n#ifdef MATERIAL_NEED_WORLD_POS\nvec3 V=normalize(camera_Position-v_pos);\n#endif\n"; // eslint-disable-line
|
|
9593
9594
|
|
|
9594
|
-
var mobile_blinnphong_frag = "#define GLSLIFY 1\n#ifdef MATERIAL_HAS_NORMALTEXTURE\nmat3 tbn=getTBN();vec3 N=getNormalByNormalTexture(tbn,material_NormalTexture,material_NormalIntensity,v_uv);\n#else\nvec3 N=getNormal();\n#endif\nvec3 lightDiffuse=vec3(0.0,0.0,0.0);vec3 lightSpecular=vec3(0.0,0.0,0.0);float shadowAttenuation=1.0;\n#ifdef SCENE_DIRECT_LIGHT_COUNT\nshadowAttenuation=1.0;\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nshadowAttenuation*=sampleShadowMap();int sunIndex=int(scene_ShadowInfo.z);\n#endif\nDirectLight directionalLight;for(int i=0;i<SCENE_DIRECT_LIGHT_COUNT;i++){if(isRendererCulledByLight(renderer_Layer.xy,scene_DirectLightCullingMask[i]))continue;directionalLight.color=scene_DirectLightColor[i];\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nif(i==sunIndex){directionalLight.color*=shadowAttenuation;}\n#endif\ndirectionalLight.direction=scene_DirectLightDirection[i];float d=max(dot(N,-directionalLight.direction),0.0);lightDiffuse+=directionalLight.color*d;vec3 halfDir=normalize(V-directionalLight.direction);float s=pow(clamp(dot(N,halfDir),0.0,1.0),material_Shininess);lightSpecular+=directionalLight.color*s;}\n#endif\n#ifdef SCENE_POINT_LIGHT_COUNT\nPointLight pointLight;for(int i=0;i<SCENE_POINT_LIGHT_COUNT;i++){if(isRendererCulledByLight(renderer_Layer.xy,scene_PointLightCullingMask[i]))continue;pointLight.color=scene_PointLightColor[i];pointLight.position=scene_PointLightPosition[i];pointLight.distance=scene_PointLightDistance[i];vec3 direction=v_pos-pointLight.position;float dist=length(direction);direction/=dist;float decay=clamp(1.0-pow(dist/pointLight.distance,4.0),0.0,1.0);float d=max(dot(N,-direction),0.0)*decay;lightDiffuse+=pointLight.color*d;vec3 halfDir=normalize(V-direction);float s=pow(clamp(dot(N,halfDir),0.0,1.0),material_Shininess)*decay;lightSpecular+=pointLight.color*s;}\n#endif\n#ifdef SCENE_SPOT_LIGHT_COUNT\nSpotLight spotLight;for(int i=0;i<SCENE_SPOT_LIGHT_COUNT;i++){if(isRendererCulledByLight(renderer_Layer.xy,scene_SpotLightCullingMask[i]))continue;spotLight.color=scene_SpotLightColor[i];spotLight.position=scene_SpotLightPosition[i];spotLight.direction=scene_SpotLightDirection[i];spotLight.distance=scene_SpotLightDistance[i];spotLight.angleCos=scene_SpotLightAngleCos[i];spotLight.penumbraCos=scene_SpotLightPenumbraCos[i];vec3 direction=spotLight.position-v_pos;float lightDistance=length(direction);direction/=lightDistance;float angleCos=dot(direction,-spotLight.direction);float decay=clamp(1.0-pow(lightDistance/spotLight.distance,4.0),0.0,1.0);float spotEffect=smoothstep(spotLight.penumbraCos,spotLight.angleCos,angleCos);float decayTotal=decay*spotEffect;float d=max(dot(N,direction),0.0)*decayTotal;lightDiffuse+=spotLight.color*d;vec3 halfDir=normalize(V+direction);float s=pow(clamp(dot(N,halfDir),0.0,1.0),material_Shininess)*decayTotal;lightSpecular+=spotLight.color*s;}\n#endif\ndiffuse*=vec4(lightDiffuse,1.0);specular*=vec4(lightSpecular,1.0);\n#ifdef MATERIAL_IS_ALPHA_CUTOFF\nif(diffuse.a<material_AlphaCutoff){discard;}\n#endif\n"; // eslint-disable-line
|
|
9595
|
+
var mobile_blinnphong_frag = "#define GLSLIFY 1\n#ifdef MATERIAL_HAS_NORMALTEXTURE\nmat3 tbn=getTBN(gl_FrontFacing);vec3 N=getNormalByNormalTexture(tbn,material_NormalTexture,material_NormalIntensity,v_uv,gl_FrontFacing);\n#else\nvec3 N=getNormal(gl_FrontFacing);\n#endif\nvec3 lightDiffuse=vec3(0.0,0.0,0.0);vec3 lightSpecular=vec3(0.0,0.0,0.0);float shadowAttenuation=1.0;\n#ifdef SCENE_DIRECT_LIGHT_COUNT\nshadowAttenuation=1.0;\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nshadowAttenuation*=sampleShadowMap();int sunIndex=int(scene_ShadowInfo.z);\n#endif\nDirectLight directionalLight;for(int i=0;i<SCENE_DIRECT_LIGHT_COUNT;i++){if(isRendererCulledByLight(renderer_Layer.xy,scene_DirectLightCullingMask[i]))continue;directionalLight.color=scene_DirectLightColor[i];\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nif(i==sunIndex){directionalLight.color*=shadowAttenuation;}\n#endif\ndirectionalLight.direction=scene_DirectLightDirection[i];float d=max(dot(N,-directionalLight.direction),0.0);lightDiffuse+=directionalLight.color*d;vec3 halfDir=normalize(V-directionalLight.direction);float s=pow(clamp(dot(N,halfDir),0.0,1.0),material_Shininess);lightSpecular+=directionalLight.color*s;}\n#endif\n#ifdef SCENE_POINT_LIGHT_COUNT\nPointLight pointLight;for(int i=0;i<SCENE_POINT_LIGHT_COUNT;i++){if(isRendererCulledByLight(renderer_Layer.xy,scene_PointLightCullingMask[i]))continue;pointLight.color=scene_PointLightColor[i];pointLight.position=scene_PointLightPosition[i];pointLight.distance=scene_PointLightDistance[i];vec3 direction=v_pos-pointLight.position;float dist=length(direction);direction/=dist;float decay=clamp(1.0-pow(dist/pointLight.distance,4.0),0.0,1.0);float d=max(dot(N,-direction),0.0)*decay;lightDiffuse+=pointLight.color*d;vec3 halfDir=normalize(V-direction);float s=pow(clamp(dot(N,halfDir),0.0,1.0),material_Shininess)*decay;lightSpecular+=pointLight.color*s;}\n#endif\n#ifdef SCENE_SPOT_LIGHT_COUNT\nSpotLight spotLight;for(int i=0;i<SCENE_SPOT_LIGHT_COUNT;i++){if(isRendererCulledByLight(renderer_Layer.xy,scene_SpotLightCullingMask[i]))continue;spotLight.color=scene_SpotLightColor[i];spotLight.position=scene_SpotLightPosition[i];spotLight.direction=scene_SpotLightDirection[i];spotLight.distance=scene_SpotLightDistance[i];spotLight.angleCos=scene_SpotLightAngleCos[i];spotLight.penumbraCos=scene_SpotLightPenumbraCos[i];vec3 direction=spotLight.position-v_pos;float lightDistance=length(direction);direction/=lightDistance;float angleCos=dot(direction,-spotLight.direction);float decay=clamp(1.0-pow(lightDistance/spotLight.distance,4.0),0.0,1.0);float spotEffect=smoothstep(spotLight.penumbraCos,spotLight.angleCos,angleCos);float decayTotal=decay*spotEffect;float d=max(dot(N,direction),0.0)*decayTotal;lightDiffuse+=spotLight.color*d;vec3 halfDir=normalize(V+direction);float s=pow(clamp(dot(N,halfDir),0.0,1.0),material_Shininess)*decayTotal;lightSpecular+=spotLight.color*s;}\n#endif\ndiffuse*=vec4(lightDiffuse,1.0);specular*=vec4(lightSpecular,1.0);\n#ifdef MATERIAL_IS_ALPHA_CUTOFF\nif(diffuse.a<material_AlphaCutoff){discard;}\n#endif\n"; // eslint-disable-line
|
|
9595
9596
|
|
|
9596
9597
|
var noise_cellular = "#define GLSLIFY 1\n#include <noise_cellular_2D>\n#include <noise_cellular_3D>\n#include <noise_cellular_2x2>\n#include <noise_cellular_2x2x2>\n"; // eslint-disable-line
|
|
9597
9598
|
|
|
@@ -9625,17 +9626,17 @@ var noise_simplex_3D_grad = "#define GLSLIFY 1\nfloat simplex(vec3 v,out vec3 gr
|
|
|
9625
9626
|
|
|
9626
9627
|
var noise_simplex_4D = "#define GLSLIFY 1\nvec4 grad4(float j,vec4 ip){const vec4 ones=vec4(1.0,1.0,1.0,-1.0);vec4 p,s;p.xyz=floor(fract(vec3(j)*ip.xyz)*7.0)*ip.z-1.0;p.w=1.5-dot(abs(p.xyz),ones.xyz);s=vec4(lessThan(p,vec4(0.0)));p.xyz=p.xyz+(s.xyz*2.0-1.0)*s.www;return p;}\n#define F4 0.309016994374947451\nfloat simplex(vec4 v){const vec4 C=vec4(0.138196601125011,0.276393202250021,0.414589803375032,-0.447213595499958);vec4 i=floor(v+dot(v,vec4(F4)));vec4 x0=v-i+dot(i,C.xxxx);vec4 i0;vec3 isX=step(x0.yzw,x0.xxx);vec3 isYZ=step(x0.zww,x0.yyz);i0.x=isX.x+isX.y+isX.z;i0.yzw=1.0-isX;i0.y+=isYZ.x+isYZ.y;i0.zw+=1.0-isYZ.xy;i0.z+=isYZ.z;i0.w+=1.0-isYZ.z;vec4 i3=clamp(i0,0.0,1.0);vec4 i2=clamp(i0-1.0,0.0,1.0);vec4 i1=clamp(i0-2.0,0.0,1.0);vec4 x1=x0-i1+C.xxxx;vec4 x2=x0-i2+C.yyyy;vec4 x3=x0-i3+C.zzzz;vec4 x4=x0+C.wwww;i=mod289(i);float j0=permute(permute(permute(permute(i.w)+i.z)+i.y)+i.x);vec4 j1=permute(permute(permute(permute(i.w+vec4(i1.w,i2.w,i3.w,1.0))+i.z+vec4(i1.z,i2.z,i3.z,1.0))+i.y+vec4(i1.y,i2.y,i3.y,1.0))+i.x+vec4(i1.x,i2.x,i3.x,1.0));vec4 ip=vec4(1.0/294.0,1.0/49.0,1.0/7.0,0.0);vec4 p0=grad4(j0,ip);vec4 p1=grad4(j1.x,ip);vec4 p2=grad4(j1.y,ip);vec4 p3=grad4(j1.z,ip);vec4 p4=grad4(j1.w,ip);vec4 norm=taylorInvSqrt(vec4(dot(p0,p0),dot(p1,p1),dot(p2,p2),dot(p3,p3)));p0*=norm.x;p1*=norm.y;p2*=norm.z;p3*=norm.w;p4*=taylorInvSqrt(dot(p4,p4));vec3 m0=max(0.6-vec3(dot(x0,x0),dot(x1,x1),dot(x2,x2)),0.0);vec2 m1=max(0.6-vec2(dot(x3,x3),dot(x4,x4)),0.0);m0=m0*m0;m1=m1*m1;return 49.0*(dot(m0*m0,vec3(dot(p0,x0),dot(p1,x1),dot(p2,x2)))+dot(m1*m1,vec2(dot(p3,x3),dot(p4,x4))));}"; // eslint-disable-line
|
|
9627
9628
|
|
|
9628
|
-
var pbr_frag_define = "#define GLSLIFY 1\nuniform float material_AlphaCutoff;uniform vec4 material_BaseColor;uniform float material_Metal;uniform float material_Roughness;uniform vec3 material_PBRSpecularColor;uniform float material_Glossiness;uniform vec3 material_EmissiveColor;\n#ifdef
|
|
9629
|
+
var pbr_frag_define = "#define GLSLIFY 1\nuniform float material_AlphaCutoff;uniform vec4 material_BaseColor;uniform float material_Metal;uniform float material_Roughness;uniform float material_IOR;uniform vec3 material_PBRSpecularColor;uniform float material_Glossiness;uniform vec3 material_EmissiveColor;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nuniform float material_ClearCoat;uniform float material_ClearCoatRoughness;\n#endif\nuniform float material_NormalIntensity;uniform float material_OcclusionIntensity;uniform float material_OcclusionTextureCoord;\n#ifdef MATERIAL_HAS_BASETEXTURE\nuniform sampler2D material_BaseTexture;\n#endif\n#ifdef MATERIAL_HAS_NORMALTEXTURE\nuniform sampler2D material_NormalTexture;\n#endif\n#ifdef MATERIAL_HAS_EMISSIVETEXTURE\nuniform sampler2D material_EmissiveTexture;\n#endif\n#ifdef MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE\nuniform sampler2D material_RoughnessMetallicTexture;\n#endif\n#ifdef MATERIAL_HAS_SPECULAR_GLOSSINESS_TEXTURE\nuniform sampler2D material_SpecularGlossinessTexture;\n#endif\n#ifdef MATERIAL_HAS_OCCLUSION_TEXTURE\nuniform sampler2D material_OcclusionTexture;\n#endif\n#ifdef MATERIAL_HAS_CLEAR_COAT_TEXTURE\nuniform sampler2D material_ClearCoatTexture;\n#endif\n#ifdef MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE\nuniform sampler2D material_ClearCoatRoughnessTexture;\n#endif\n#ifdef MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE\nuniform sampler2D material_ClearCoatNormalTexture;\n#endif\nstruct ReflectedLight{vec3 directDiffuse;vec3 directSpecular;vec3 indirectDiffuse;vec3 indirectSpecular;};struct Geometry{vec3 position;vec3 normal;vec3 viewDir;float dotNV;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nvec3 clearCoatNormal;float clearCoatDotNV;\n#endif\n};struct Material{vec3 diffuseColor;float roughness;vec3 specularColor;float opacity;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nfloat clearCoat;float clearCoatRoughness;\n#endif\n};"; // eslint-disable-line
|
|
9629
9630
|
|
|
9630
|
-
var pbr_helper = "#define GLSLIFY 1\n#include <normal_get>\nfloat computeSpecularOcclusion(float ambientOcclusion,float roughness,float dotNV){return saturate(pow(dotNV+ambientOcclusion,exp2(-16.0*roughness-1.0))-1.0+ambientOcclusion);}float getAARoughnessFactor(vec3 normal){\n#ifdef HAS_DERIVATIVES\nvec3 dxy=max(abs(dFdx(normal)),abs(dFdy(normal)));return 0.04+max(max(dxy.x,dxy.y),dxy.z);\n#else\nreturn 0.04;\n#endif\n}void initGeometry(out Geometry geometry){geometry.position=v_pos;geometry.viewDir=normalize(camera_Position-v_pos);\n#if defined(MATERIAL_HAS_NORMALTEXTURE) || defined(
|
|
9631
|
+
var pbr_helper = "#define GLSLIFY 1\n#include <normal_get>\nfloat computeSpecularOcclusion(float ambientOcclusion,float roughness,float dotNV){return saturate(pow(dotNV+ambientOcclusion,exp2(-16.0*roughness-1.0))-1.0+ambientOcclusion);}float getAARoughnessFactor(vec3 normal){\n#ifdef HAS_DERIVATIVES\nvec3 dxy=max(abs(dFdx(normal)),abs(dFdy(normal)));return 0.04+max(max(dxy.x,dxy.y),dxy.z);\n#else\nreturn 0.04;\n#endif\n}void initGeometry(out Geometry geometry,bool isFrontFacing){geometry.position=v_pos;geometry.viewDir=normalize(camera_Position-v_pos);\n#if defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE)\nmat3 tbn=getTBN(isFrontFacing);\n#endif\n#ifdef MATERIAL_HAS_NORMALTEXTURE\ngeometry.normal=getNormalByNormalTexture(tbn,material_NormalTexture,material_NormalIntensity,v_uv,isFrontFacing);\n#else\ngeometry.normal=getNormal(isFrontFacing);\n#endif\ngeometry.dotNV=saturate(dot(geometry.normal,geometry.viewDir));\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\n#ifdef MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE\ngeometry.clearCoatNormal=getNormalByNormalTexture(tbn,material_ClearCoatNormalTexture,material_NormalIntensity,v_uv,isFrontFacing);\n#else\ngeometry.clearCoatNormal=getNormal(isFrontFacing);\n#endif\ngeometry.clearCoatDotNV=saturate(dot(geometry.clearCoatNormal,geometry.viewDir));\n#endif\n}void initMaterial(out Material material,const in Geometry geometry){vec4 baseColor=material_BaseColor;float metal=material_Metal;float roughness=material_Roughness;vec3 specularColor=material_PBRSpecularColor;float glossiness=material_Glossiness;float alphaCutoff=material_AlphaCutoff;float F0=pow2((material_IOR-1.0)/(material_IOR+1.0));\n#ifdef MATERIAL_HAS_BASETEXTURE\nvec4 baseTextureColor=texture2D(material_BaseTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nbaseTextureColor=gammaToLinear(baseTextureColor);\n#endif\nbaseColor*=baseTextureColor;\n#endif\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\nbaseColor*=v_color;\n#endif\n#ifdef MATERIAL_IS_ALPHA_CUTOFF\nif(baseColor.a<alphaCutoff){discard;}\n#endif\n#ifdef MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE\nvec4 metalRoughMapColor=texture2D(material_RoughnessMetallicTexture,v_uv);roughness*=metalRoughMapColor.g;metal*=metalRoughMapColor.b;\n#endif\n#ifdef MATERIAL_HAS_SPECULAR_GLOSSINESS_TEXTURE\nvec4 specularGlossinessColor=texture2D(material_SpecularGlossinessTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nspecularGlossinessColor=gammaToLinear(specularGlossinessColor);\n#endif\nspecularColor*=specularGlossinessColor.rgb;glossiness*=specularGlossinessColor.a;\n#endif\n#ifdef IS_METALLIC_WORKFLOW\nmaterial.diffuseColor=baseColor.rgb*(1.0-metal);material.specularColor=mix(vec3(F0),baseColor.rgb,metal);material.roughness=roughness;\n#else\nfloat specularStrength=max(max(specularColor.r,specularColor.g),specularColor.b);material.diffuseColor=baseColor.rgb*(1.0-specularStrength);material.specularColor=specularColor;material.roughness=1.0-glossiness;\n#endif\nmaterial.roughness=max(material.roughness,getAARoughnessFactor(geometry.normal));\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nmaterial.clearCoat=material_ClearCoat;material.clearCoatRoughness=material_ClearCoatRoughness;\n#ifdef MATERIAL_HAS_CLEAR_COAT_TEXTURE\nmaterial.clearCoat*=texture2D(material_ClearCoatTexture,v_uv).r;\n#endif\n#ifdef MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE\nmaterial.clearCoatRoughness*=texture2D(material_ClearCoatRoughnessTexture,v_uv).g;\n#endif\nmaterial.clearCoat=saturate(material.clearCoat);material.clearCoatRoughness=max(material.clearCoatRoughness,getAARoughnessFactor(geometry.clearCoatNormal));\n#endif\n#ifdef MATERIAL_IS_TRANSPARENT\nmaterial.opacity=baseColor.a;\n#else\nmaterial.opacity=1.0;\n#endif\n}\n#include <brdf>\n#include <direct_irradiance_frag_define>\n#include <ibl_frag_define>\n"; // eslint-disable-line
|
|
9631
9632
|
|
|
9632
9633
|
var brdf = "#define GLSLIFY 1\nfloat F_Schlick(float dotLH){return 0.04+0.96*(pow(1.0-dotLH,5.0));}vec3 F_Schlick(vec3 specularColor,float dotLH){float fresnel=exp2((-5.55473*dotLH-6.98316)*dotLH);return(1.0-specularColor)*fresnel+specularColor;}float G_GGX_SmithCorrelated(float alpha,float dotNL,float dotNV){float a2=pow2(alpha);float gv=dotNL*sqrt(a2+(1.0-a2)*pow2(dotNV));float gl=dotNV*sqrt(a2+(1.0-a2)*pow2(dotNL));return 0.5/max(gv+gl,EPSILON);}float D_GGX(float alpha,float dotNH){float a2=pow2(alpha);float denom=pow2(dotNH)*(a2-1.0)+1.0;return RECIPROCAL_PI*a2/pow2(denom);}vec3 BRDF_Specular_GGX(vec3 incidentDirection,vec3 viewDir,vec3 normal,vec3 specularColor,float roughness){float alpha=pow2(roughness);vec3 halfDir=normalize(incidentDirection+viewDir);float dotNL=saturate(dot(normal,incidentDirection));float dotNV=saturate(dot(normal,viewDir));float dotNH=saturate(dot(normal,halfDir));float dotLH=saturate(dot(incidentDirection,halfDir));vec3 F=F_Schlick(specularColor,dotLH);float G=G_GGX_SmithCorrelated(alpha,dotNL,dotNV);float D=D_GGX(alpha,dotNH);return F*(G*D);}vec3 BRDF_Diffuse_Lambert(vec3 diffuseColor){return RECIPROCAL_PI*diffuseColor;}"; // eslint-disable-line
|
|
9633
9634
|
|
|
9634
|
-
var direct_irradiance_frag_define = "#define GLSLIFY 1\n#include <ShadowFragmentDeclaration>\nvoid addDirectRadiance(vec3 incidentDirection,vec3 color,Geometry geometry,Material material,inout ReflectedLight reflectedLight){float attenuation=1.0;\n#ifdef
|
|
9635
|
+
var direct_irradiance_frag_define = "#define GLSLIFY 1\n#include <ShadowFragmentDeclaration>\nvoid addDirectRadiance(vec3 incidentDirection,vec3 color,Geometry geometry,Material material,inout ReflectedLight reflectedLight){float attenuation=1.0;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nfloat clearCoatDotNL=saturate(dot(geometry.clearCoatNormal,incidentDirection));vec3 clearCoatIrradiance=clearCoatDotNL*color;reflectedLight.directSpecular+=material.clearCoat*clearCoatIrradiance*BRDF_Specular_GGX(incidentDirection,geometry.viewDir,geometry.clearCoatNormal,vec3(0.04),material.clearCoatRoughness);attenuation-=material.clearCoat*F_Schlick(geometry.clearCoatDotNV);\n#endif\nfloat dotNL=saturate(dot(geometry.normal,incidentDirection));vec3 irradiance=dotNL*color*PI;reflectedLight.directSpecular+=attenuation*irradiance*BRDF_Specular_GGX(incidentDirection,geometry.viewDir,geometry.normal,material.specularColor,material.roughness);reflectedLight.directDiffuse+=attenuation*irradiance*BRDF_Diffuse_Lambert(material.diffuseColor);}\n#ifdef SCENE_DIRECT_LIGHT_COUNT\nvoid addDirectionalDirectLightRadiance(DirectLight directionalLight,Geometry geometry,Material material,inout ReflectedLight reflectedLight){vec3 color=directionalLight.color;vec3 direction=-directionalLight.direction;addDirectRadiance(direction,color,geometry,material,reflectedLight);}\n#endif\n#ifdef SCENE_POINT_LIGHT_COUNT\nvoid addPointDirectLightRadiance(PointLight pointLight,Geometry geometry,Material material,inout ReflectedLight reflectedLight){vec3 lVector=pointLight.position-geometry.position;vec3 direction=normalize(lVector);float lightDistance=length(lVector);vec3 color=pointLight.color;color*=clamp(1.0-pow(lightDistance/pointLight.distance,4.0),0.0,1.0);addDirectRadiance(direction,color,geometry,material,reflectedLight);}\n#endif\n#ifdef SCENE_SPOT_LIGHT_COUNT\nvoid addSpotDirectLightRadiance(SpotLight spotLight,Geometry geometry,Material material,inout ReflectedLight reflectedLight){vec3 lVector=spotLight.position-geometry.position;vec3 direction=normalize(lVector);float lightDistance=length(lVector);float angleCos=dot(direction,-spotLight.direction);float spotEffect=smoothstep(spotLight.penumbraCos,spotLight.angleCos,angleCos);float decayEffect=clamp(1.0-pow(lightDistance/spotLight.distance,4.0),0.0,1.0);vec3 color=spotLight.color;color*=spotEffect*decayEffect;addDirectRadiance(direction,color,geometry,material,reflectedLight);}\n#endif\nvoid addTotalDirectRadiance(Geometry geometry,Material material,inout ReflectedLight reflectedLight){float shadowAttenuation=1.0;\n#ifdef SCENE_DIRECT_LIGHT_COUNT\nshadowAttenuation=1.0;\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nshadowAttenuation*=sampleShadowMap();int sunIndex=int(scene_ShadowInfo.z);\n#endif\nDirectLight directionalLight;for(int i=0;i<SCENE_DIRECT_LIGHT_COUNT;i++){if(isRendererCulledByLight(renderer_Layer.xy,scene_DirectLightCullingMask[i]))continue;directionalLight.color=scene_DirectLightColor[i];\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nif(i==sunIndex){directionalLight.color*=shadowAttenuation;}\n#endif\ndirectionalLight.direction=scene_DirectLightDirection[i];addDirectionalDirectLightRadiance(directionalLight,geometry,material,reflectedLight);}\n#endif\n#ifdef SCENE_POINT_LIGHT_COUNT\nPointLight pointLight;for(int i=0;i<SCENE_POINT_LIGHT_COUNT;i++){if(isRendererCulledByLight(renderer_Layer.xy,scene_PointLightCullingMask[i]))continue;pointLight.color=scene_PointLightColor[i];pointLight.position=scene_PointLightPosition[i];pointLight.distance=scene_PointLightDistance[i];addPointDirectLightRadiance(pointLight,geometry,material,reflectedLight);}\n#endif\n#ifdef SCENE_SPOT_LIGHT_COUNT\nSpotLight spotLight;for(int i=0;i<SCENE_SPOT_LIGHT_COUNT;i++){if(isRendererCulledByLight(renderer_Layer.xy,scene_SpotLightCullingMask[i]))continue;spotLight.color=scene_SpotLightColor[i];spotLight.position=scene_SpotLightPosition[i];spotLight.direction=scene_SpotLightDirection[i];spotLight.distance=scene_SpotLightDistance[i];spotLight.angleCos=scene_SpotLightAngleCos[i];spotLight.penumbraCos=scene_SpotLightPenumbraCos[i];addSpotDirectLightRadiance(spotLight,geometry,material,reflectedLight);}\n#endif\n}"; // eslint-disable-line
|
|
9635
9636
|
|
|
9636
9637
|
var ibl_frag_define = "#define GLSLIFY 1\nvec3 getLightProbeIrradiance(vec3 sh[9],vec3 normal){normal.x=-normal.x;vec3 result=sh[0]+sh[1]*(normal.y)+sh[2]*(normal.z)+sh[3]*(normal.x)+sh[4]*(normal.y*normal.x)+sh[5]*(normal.y*normal.z)+sh[6]*(3.0*normal.z*normal.z-1.0)+sh[7]*(normal.z*normal.x)+sh[8]*(normal.x*normal.x-normal.y*normal.y);return max(result,vec3(0.0));}vec3 envBRDFApprox(vec3 specularColor,float roughness,float dotNV){const vec4 c0=vec4(-1,-0.0275,-0.572,0.022);const vec4 c1=vec4(1,0.0425,1.04,-0.04);vec4 r=roughness*c0+c1;float a004=min(r.x*r.x,exp2(-9.28*dotNV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}float getSpecularMIPLevel(float roughness,int maxMIPLevel){return roughness*float(maxMIPLevel);}vec3 getLightProbeRadiance(vec3 viewDir,vec3 normal,float roughness,int maxMIPLevel,float specularIntensity){\n#ifndef SCENE_USE_SPECULAR_ENV\nreturn vec3(0);\n#else\nvec3 reflectVec=reflect(-viewDir,normal);reflectVec.x=-reflectVec.x;float specularMIPLevel=getSpecularMIPLevel(roughness,maxMIPLevel);\n#ifdef HAS_TEX_LOD\nvec4 envMapColor=textureCubeLodEXT(scene_EnvSpecularSampler,reflectVec,specularMIPLevel);\n#else\nvec4 envMapColor=textureCube(scene_EnvSpecularSampler,reflectVec,specularMIPLevel);\n#endif\n#ifdef SCENE_IS_DECODE_ENV_RGBM\nenvMapColor.rgb=RGBMToLinear(envMapColor,5.0).rgb;\n#ifdef ENGINE_IS_COLORSPACE_GAMMA\nenvMapColor=linearToGamma(envMapColor);\n#endif\n#else\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nenvMapColor=gammaToLinear(envMapColor);\n#endif\n#endif\nreturn envMapColor.rgb*specularIntensity;\n#endif\n}"; // eslint-disable-line
|
|
9637
9638
|
|
|
9638
|
-
var pbr_frag = "#define GLSLIFY 1\nGeometry geometry;Material material;ReflectedLight reflectedLight=ReflectedLight(vec3(0.0),vec3(0.0),vec3(0.0),vec3(0.0));initGeometry(geometry);initMaterial(material,geometry);addTotalDirectRadiance(geometry,material,reflectedLight);\n#ifdef SCENE_USE_SH\nvec3 irradiance=getLightProbeIrradiance(scene_EnvSH,geometry.normal);\n#ifdef ENGINE_IS_COLORSPACE_GAMMA\nirradiance=linearToGamma(vec4(irradiance,1.0)).rgb;\n#endif\nirradiance*=scene_EnvMapLight.diffuseIntensity;\n#else\nvec3 irradiance=scene_EnvMapLight.diffuse*scene_EnvMapLight.diffuseIntensity;irradiance*=PI;\n#endif\nreflectedLight.indirectDiffuse+=irradiance*BRDF_Diffuse_Lambert(material.diffuseColor);vec3 radiance=getLightProbeRadiance(geometry.viewDir,geometry.normal,material.roughness,int(scene_EnvMapLight.mipMapLevel),scene_EnvMapLight.specularIntensity);float radianceAttenuation=1.0;\n#ifdef
|
|
9639
|
+
var pbr_frag = "#define GLSLIFY 1\nGeometry geometry;Material material;ReflectedLight reflectedLight=ReflectedLight(vec3(0.0),vec3(0.0),vec3(0.0),vec3(0.0));initGeometry(geometry,gl_FrontFacing);initMaterial(material,geometry);addTotalDirectRadiance(geometry,material,reflectedLight);\n#ifdef SCENE_USE_SH\nvec3 irradiance=getLightProbeIrradiance(scene_EnvSH,geometry.normal);\n#ifdef ENGINE_IS_COLORSPACE_GAMMA\nirradiance=linearToGamma(vec4(irradiance,1.0)).rgb;\n#endif\nirradiance*=scene_EnvMapLight.diffuseIntensity;\n#else\nvec3 irradiance=scene_EnvMapLight.diffuse*scene_EnvMapLight.diffuseIntensity;irradiance*=PI;\n#endif\nreflectedLight.indirectDiffuse+=irradiance*BRDF_Diffuse_Lambert(material.diffuseColor);vec3 radiance=getLightProbeRadiance(geometry.viewDir,geometry.normal,material.roughness,int(scene_EnvMapLight.mipMapLevel),scene_EnvMapLight.specularIntensity);float radianceAttenuation=1.0;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nvec3 clearCoatRadiance=getLightProbeRadiance(geometry.viewDir,geometry.clearCoatNormal,material.clearCoatRoughness,int(scene_EnvMapLight.mipMapLevel),scene_EnvMapLight.specularIntensity);reflectedLight.indirectSpecular+=clearCoatRadiance*material.clearCoat*envBRDFApprox(vec3(0.04),material.clearCoatRoughness,geometry.clearCoatDotNV);radianceAttenuation-=material.clearCoat*F_Schlick(geometry.clearCoatDotNV);\n#endif\nreflectedLight.indirectSpecular+=radianceAttenuation*radiance*envBRDFApprox(material.specularColor,material.roughness,geometry.dotNV);\n#ifdef MATERIAL_HAS_OCCLUSION_TEXTURE\nvec2 aoUV=v_uv;\n#ifdef RENDERER_HAS_UV1\nif(material_OcclusionTextureCoord==1.0){aoUV=v_uv1;}\n#endif\nfloat ambientOcclusion=(texture2D(material_OcclusionTexture,aoUV).r-1.0)*material_OcclusionIntensity+1.0;reflectedLight.indirectDiffuse*=ambientOcclusion;\n#ifdef SCENE_USE_SPECULAR_ENV\nreflectedLight.indirectSpecular*=computeSpecularOcclusion(ambientOcclusion,material.roughness,geometry.dotNV);\n#endif\n#endif\nvec3 emissiveRadiance=material_EmissiveColor;\n#ifdef MATERIAL_HAS_EMISSIVETEXTURE\nvec4 emissiveColor=texture2D(material_EmissiveTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nemissiveColor=gammaToLinear(emissiveColor);\n#endif\nemissiveRadiance*=emissiveColor.rgb;\n#endif\nvec3 totalRadiance=reflectedLight.directDiffuse+reflectedLight.indirectDiffuse+reflectedLight.directSpecular+reflectedLight.indirectSpecular+emissiveRadiance;vec4 targetColor=vec4(totalRadiance,material.opacity);gl_FragColor=targetColor;"; // eslint-disable-line
|
|
9639
9640
|
|
|
9640
9641
|
var PBRShaderLib = {
|
|
9641
9642
|
pbr_frag_define: pbr_frag_define,
|
|
@@ -9664,7 +9665,7 @@ var ShadowLib = {
|
|
|
9664
9665
|
ShadowVertex: ShadowVertex
|
|
9665
9666
|
};
|
|
9666
9667
|
|
|
9667
|
-
var normal_get = "#define GLSLIFY 1\nvec3 getNormal(){\n#ifdef RENDERER_HAS_NORMAL\nvec3 normal=normalize(v_normal);\n#elif defined(HAS_DERIVATIVES)\nvec3 pos_dx=dFdx(v_pos);vec3 pos_dy=dFdy(v_pos);vec3 normal=normalize(cross(pos_dx,pos_dy));\n#else\nvec3 normal=vec3(0,0,1);\n#endif\nnormal*=float(
|
|
9668
|
+
var normal_get = "#define GLSLIFY 1\nvec3 getNormal(bool isFrontFacing){\n#ifdef RENDERER_HAS_NORMAL\nvec3 normal=normalize(v_normal);\n#elif defined(HAS_DERIVATIVES)\nvec3 pos_dx=dFdx(v_pos);vec3 pos_dy=dFdy(v_pos);vec3 normal=normalize(cross(pos_dx,pos_dy));\n#else\nvec3 normal=vec3(0,0,1);\n#endif\nnormal*=float(isFrontFacing)*2.0-1.0;return normal;}vec3 getNormalByNormalTexture(mat3 tbn,sampler2D normalTexture,float normalIntensity,vec2 uv,bool isFrontFacing){vec3 normal=texture2D(normalTexture,uv).rgb;normal=normalize(tbn*((2.0*normal-1.0)*vec3(normalIntensity,normalIntensity,1.0)));normal*=float(isFrontFacing)*2.0-1.0;return normal;}mat3 getTBN(bool isFrontFacing){\n#if defined(RENDERER_HAS_NORMAL) && defined(RENDERER_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\nmat3 tbn=v_TBN;\n#else\nvec3 normal=getNormal(isFrontFacing);vec3 position=v_pos;vec2 uv=isFrontFacing? v_uv:-v_uv;\n#ifdef HAS_DERIVATIVES\nvec3 dp1=dFdx(position);vec3 dp2=dFdy(position);vec2 duv1=dFdx(uv);vec2 duv2=dFdy(uv);vec3 dp2perp=cross(dp2,normal);vec3 dp1perp=cross(normal,dp1);vec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;vec3 binormal=dp2perp*duv1.y+dp1perp*duv2.y;float invmax=inversesqrt(max(dot(tangent,tangent),dot(binormal,binormal)));mat3 tbn=mat3(tangent*invmax,binormal*invmax,normal);\n#else\nmat3 tbn=mat3(vec3(0.0),vec3(0.0),normal);\n#endif\n#endif\nreturn tbn;}"; // eslint-disable-line
|
|
9668
9669
|
|
|
9669
9670
|
var ShaderLib = _extends({
|
|
9670
9671
|
common: common,
|
|
@@ -10779,7 +10780,6 @@ var Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10779
10780
|
};
|
|
10780
10781
|
_proto.update = function update(deltaTime) {};
|
|
10781
10782
|
/**
|
|
10782
|
-
* @override
|
|
10783
10783
|
* @internal
|
|
10784
10784
|
*/ _proto._onEnable = function _onEnable() {
|
|
10785
10785
|
var componentsManager = this.engine._componentsManager;
|
|
@@ -10789,7 +10789,6 @@ var Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10789
10789
|
componentsManager.addRenderer(this);
|
|
10790
10790
|
};
|
|
10791
10791
|
/**
|
|
10792
|
-
* @override
|
|
10793
10792
|
* @internal
|
|
10794
10793
|
*/ _proto._onDisable = function _onDisable() {
|
|
10795
10794
|
var componentsManager = this.engine._componentsManager;
|
|
@@ -10816,7 +10815,14 @@ var Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10816
10815
|
ShaderMacroCollection.unionCollection(context.camera._globalShaderMacro, this.shaderData._macroCollection, this._globalShaderMacro);
|
|
10817
10816
|
};
|
|
10818
10817
|
/**
|
|
10819
|
-
* @
|
|
10818
|
+
* @internal
|
|
10819
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
10820
|
+
var materials = this._materials;
|
|
10821
|
+
for(var i = 0, n = materials.length; i < n; i++){
|
|
10822
|
+
target._setMaterial(i, materials[i]);
|
|
10823
|
+
}
|
|
10824
|
+
};
|
|
10825
|
+
/**
|
|
10820
10826
|
* @internal
|
|
10821
10827
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
10822
10828
|
Component.prototype._onDestroy.call(this);
|
|
@@ -10828,14 +10834,18 @@ var Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10828
10834
|
(_materials_i = materials[i]) == null ? void 0 : _materials_i._addReferCount(-1);
|
|
10829
10835
|
}
|
|
10830
10836
|
};
|
|
10831
|
-
|
|
10837
|
+
/**
|
|
10838
|
+
* @internal
|
|
10839
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
10832
10840
|
var entity = this.entity;
|
|
10833
10841
|
var worldMatrix = entity.transform.worldMatrix;
|
|
10834
10842
|
this._updateTransformShaderData(context, worldMatrix);
|
|
10835
10843
|
var layer = entity.layer;
|
|
10836
10844
|
this._rendererLayer.set(layer & 65535, layer >>> 16 & 65535, 0, 0);
|
|
10837
10845
|
};
|
|
10838
|
-
|
|
10846
|
+
/**
|
|
10847
|
+
* @internal
|
|
10848
|
+
*/ _proto._updateTransformShaderData = function _updateTransformShaderData(context, worldMatrix) {
|
|
10839
10849
|
var shaderData = this.shaderData;
|
|
10840
10850
|
var virtualCamera = context.virtualCamera;
|
|
10841
10851
|
var mvMatrix = this._mvMatrix;
|
|
@@ -10854,14 +10864,22 @@ var Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10854
10864
|
shaderData.setMatrix(Renderer._mvInvMatrixProperty, mvInvMatrix);
|
|
10855
10865
|
shaderData.setMatrix(Renderer._normalMatrixProperty, normalMatrix);
|
|
10856
10866
|
};
|
|
10857
|
-
|
|
10867
|
+
/**
|
|
10868
|
+
* @internal
|
|
10869
|
+
*/ _proto._registerEntityTransformListener = function _registerEntityTransformListener() {
|
|
10858
10870
|
this.entity.transform._updateFlagManager.addListener(this._onTransformChanged);
|
|
10859
10871
|
};
|
|
10860
|
-
|
|
10861
|
-
|
|
10872
|
+
/**
|
|
10873
|
+
* @internal
|
|
10874
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {};
|
|
10875
|
+
/**
|
|
10876
|
+
* @internal
|
|
10877
|
+
*/ _proto._render = function _render(context) {
|
|
10862
10878
|
throw "not implement";
|
|
10863
10879
|
};
|
|
10864
|
-
|
|
10880
|
+
/**
|
|
10881
|
+
* @internal
|
|
10882
|
+
*/ _proto._createInstanceMaterial = function _createInstanceMaterial(material, index) {
|
|
10865
10883
|
var insMaterial = material.clone();
|
|
10866
10884
|
insMaterial.name = insMaterial.name + "(Instance)";
|
|
10867
10885
|
material._addReferCount(-1);
|
|
@@ -10884,7 +10902,9 @@ var Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10884
10902
|
materials[index] = material;
|
|
10885
10903
|
}
|
|
10886
10904
|
};
|
|
10887
|
-
|
|
10905
|
+
/**
|
|
10906
|
+
* @internal
|
|
10907
|
+
*/ _proto._onTransformChanged = function _onTransformChanged(type) {
|
|
10888
10908
|
this._dirtyUpdateFlag |= 0x1;
|
|
10889
10909
|
};
|
|
10890
10910
|
_create_class(Renderer1, [
|
|
@@ -10997,7 +11017,7 @@ __decorate([
|
|
|
10997
11017
|
ignoreClone
|
|
10998
11018
|
], Renderer.prototype, "_overrideUpdate", void 0);
|
|
10999
11019
|
__decorate([
|
|
11000
|
-
|
|
11020
|
+
ignoreClone
|
|
11001
11021
|
], Renderer.prototype, "_materials", void 0);
|
|
11002
11022
|
__decorate([
|
|
11003
11023
|
ignoreClone
|
|
@@ -11191,8 +11211,10 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11191
11211
|
_this = Renderer.call(this, entity) || this;
|
|
11192
11212
|
/** The mask layers the sprite mask influence to. */ _this.influenceLayers = SpriteMaskLayer.Everything;
|
|
11193
11213
|
_this._sprite = null;
|
|
11194
|
-
_this.
|
|
11195
|
-
_this.
|
|
11214
|
+
_this._automaticWidth = 0;
|
|
11215
|
+
_this._automaticHeight = 0;
|
|
11216
|
+
_this._customWidth = undefined;
|
|
11217
|
+
_this._customHeight = undefined;
|
|
11196
11218
|
_this._flipX = false;
|
|
11197
11219
|
_this._flipY = false;
|
|
11198
11220
|
_this._alphaCutoff = 0.5;
|
|
@@ -11207,33 +11229,33 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11207
11229
|
/**
|
|
11208
11230
|
* @internal
|
|
11209
11231
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
11232
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
11210
11233
|
target.sprite = this._sprite;
|
|
11211
11234
|
};
|
|
11212
11235
|
/**
|
|
11213
|
-
* @
|
|
11236
|
+
* @internal
|
|
11214
11237
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
11215
|
-
|
|
11216
|
-
|
|
11238
|
+
if (this.sprite) {
|
|
11239
|
+
SimpleSpriteAssembler.updatePositions(this);
|
|
11240
|
+
} else {
|
|
11217
11241
|
worldBounds.min.set(0, 0, 0);
|
|
11218
11242
|
worldBounds.max.set(0, 0, 0);
|
|
11219
|
-
} else {
|
|
11220
|
-
SimpleSpriteAssembler.updatePositions(this);
|
|
11221
11243
|
}
|
|
11222
11244
|
};
|
|
11223
11245
|
/**
|
|
11224
|
-
* @
|
|
11246
|
+
* @internal
|
|
11225
11247
|
* @inheritdoc
|
|
11226
11248
|
*/ _proto._render = function _render(context) {
|
|
11227
11249
|
var _this_sprite;
|
|
11228
11250
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
11229
11251
|
return;
|
|
11230
11252
|
}
|
|
11231
|
-
// Update position
|
|
11253
|
+
// Update position
|
|
11232
11254
|
if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
|
|
11233
11255
|
SimpleSpriteAssembler.updatePositions(this);
|
|
11234
11256
|
this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
|
|
11235
11257
|
}
|
|
11236
|
-
// Update uv
|
|
11258
|
+
// Update uv
|
|
11237
11259
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
11238
11260
|
SimpleSpriteAssembler.updateUVs(this);
|
|
11239
11261
|
this._dirtyUpdateFlag &= ~0x2;
|
|
@@ -11247,20 +11269,39 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11247
11269
|
this._maskElement = renderElement;
|
|
11248
11270
|
};
|
|
11249
11271
|
/**
|
|
11250
|
-
* @
|
|
11272
|
+
* @internal
|
|
11251
11273
|
* @inheritdoc
|
|
11252
11274
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
11253
|
-
var _this__sprite;
|
|
11254
11275
|
Renderer.prototype._onDestroy.call(this);
|
|
11255
|
-
|
|
11276
|
+
var sprite = this._sprite;
|
|
11277
|
+
if (sprite) {
|
|
11278
|
+
sprite._addReferCount(-1);
|
|
11279
|
+
sprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
11280
|
+
}
|
|
11256
11281
|
this._sprite = null;
|
|
11257
11282
|
this._verticesData = null;
|
|
11258
11283
|
};
|
|
11284
|
+
_proto._calDefaultSize = function _calDefaultSize() {
|
|
11285
|
+
var sprite = this._sprite;
|
|
11286
|
+
if (sprite) {
|
|
11287
|
+
this._automaticWidth = sprite.width;
|
|
11288
|
+
this._automaticHeight = sprite.height;
|
|
11289
|
+
} else {
|
|
11290
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
11291
|
+
}
|
|
11292
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
11293
|
+
};
|
|
11259
11294
|
_proto._onSpriteChange = function _onSpriteChange(type) {
|
|
11260
11295
|
switch(type){
|
|
11261
11296
|
case SpriteModifyFlags.texture:
|
|
11262
11297
|
this.shaderData.setTexture(SpriteMask._textureProperty, this.sprite.texture);
|
|
11263
11298
|
break;
|
|
11299
|
+
case SpriteModifyFlags.size:
|
|
11300
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
11301
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
11302
|
+
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
11303
|
+
}
|
|
11304
|
+
break;
|
|
11264
11305
|
case SpriteModifyFlags.region:
|
|
11265
11306
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
11266
11307
|
this._dirtyUpdateFlag |= 0x3;
|
|
@@ -11268,22 +11309,31 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11268
11309
|
case SpriteModifyFlags.atlasRegion:
|
|
11269
11310
|
this._dirtyUpdateFlag |= 0x2;
|
|
11270
11311
|
break;
|
|
11312
|
+
case SpriteModifyFlags.pivot:
|
|
11313
|
+
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
11314
|
+
break;
|
|
11271
11315
|
}
|
|
11272
11316
|
};
|
|
11273
11317
|
_create_class(SpriteMask, [
|
|
11274
11318
|
{
|
|
11275
11319
|
key: "width",
|
|
11276
11320
|
get: /**
|
|
11277
|
-
* Render width.
|
|
11321
|
+
* Render width (in world coordinates).
|
|
11322
|
+
*
|
|
11323
|
+
* @remarks
|
|
11324
|
+
* If width is set, return the set value,
|
|
11325
|
+
* otherwise return `SpriteMask.sprite.width`.
|
|
11278
11326
|
*/ function get() {
|
|
11279
|
-
if (this.
|
|
11280
|
-
|
|
11327
|
+
if (this._customWidth !== undefined) {
|
|
11328
|
+
return this._customWidth;
|
|
11329
|
+
} else {
|
|
11330
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
11331
|
+
return this._automaticWidth;
|
|
11281
11332
|
}
|
|
11282
|
-
return this._width;
|
|
11283
11333
|
},
|
|
11284
11334
|
set: function set(value) {
|
|
11285
|
-
if (this.
|
|
11286
|
-
this.
|
|
11335
|
+
if (this._customWidth !== value) {
|
|
11336
|
+
this._customWidth = value;
|
|
11287
11337
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
11288
11338
|
}
|
|
11289
11339
|
}
|
|
@@ -11291,16 +11341,22 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11291
11341
|
{
|
|
11292
11342
|
key: "height",
|
|
11293
11343
|
get: /**
|
|
11294
|
-
* Render height.
|
|
11344
|
+
* Render height (in world coordinates).
|
|
11345
|
+
*
|
|
11346
|
+
* @remarks
|
|
11347
|
+
* If height is set, return the set value,
|
|
11348
|
+
* otherwise return `SpriteMask.sprite.height`.
|
|
11295
11349
|
*/ function get() {
|
|
11296
|
-
if (this.
|
|
11297
|
-
|
|
11350
|
+
if (this._customHeight !== undefined) {
|
|
11351
|
+
return this._customHeight;
|
|
11352
|
+
} else {
|
|
11353
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
11354
|
+
return this._automaticHeight;
|
|
11298
11355
|
}
|
|
11299
|
-
return this._height;
|
|
11300
11356
|
},
|
|
11301
11357
|
set: function set(value) {
|
|
11302
|
-
if (this.
|
|
11303
|
-
this.
|
|
11358
|
+
if (this._customHeight !== value) {
|
|
11359
|
+
this._customHeight = value;
|
|
11304
11360
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
11305
11361
|
}
|
|
11306
11362
|
}
|
|
@@ -11343,10 +11399,14 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11343
11399
|
set: function set(value) {
|
|
11344
11400
|
var lastSprite = this._sprite;
|
|
11345
11401
|
if (lastSprite !== value) {
|
|
11346
|
-
|
|
11402
|
+
if (lastSprite) {
|
|
11403
|
+
lastSprite._addReferCount(-1);
|
|
11404
|
+
lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
11405
|
+
}
|
|
11406
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
11347
11407
|
if (value) {
|
|
11408
|
+
value._addReferCount(1);
|
|
11348
11409
|
value._updateFlagManager.addListener(this._onSpriteChange);
|
|
11349
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
11350
11410
|
this.shaderData.setTexture(SpriteMask._textureProperty, value.texture);
|
|
11351
11411
|
} else {
|
|
11352
11412
|
this.shaderData.setTexture(SpriteMask._textureProperty, null);
|
|
@@ -11386,10 +11446,16 @@ __decorate([
|
|
|
11386
11446
|
], SpriteMask.prototype, "_sprite", void 0);
|
|
11387
11447
|
__decorate([
|
|
11388
11448
|
ignoreClone
|
|
11389
|
-
], SpriteMask.prototype, "
|
|
11449
|
+
], SpriteMask.prototype, "_automaticWidth", void 0);
|
|
11390
11450
|
__decorate([
|
|
11391
11451
|
ignoreClone
|
|
11392
|
-
], SpriteMask.prototype, "
|
|
11452
|
+
], SpriteMask.prototype, "_automaticHeight", void 0);
|
|
11453
|
+
__decorate([
|
|
11454
|
+
assignmentClone
|
|
11455
|
+
], SpriteMask.prototype, "_customWidth", void 0);
|
|
11456
|
+
__decorate([
|
|
11457
|
+
assignmentClone
|
|
11458
|
+
], SpriteMask.prototype, "_customHeight", void 0);
|
|
11393
11459
|
__decorate([
|
|
11394
11460
|
assignmentClone
|
|
11395
11461
|
], SpriteMask.prototype, "_flipX", void 0);
|
|
@@ -11407,7 +11473,9 @@ var /**
|
|
|
11407
11473
|
*/ SpriteMaskUpdateFlags;
|
|
11408
11474
|
(function(SpriteMaskUpdateFlags) {
|
|
11409
11475
|
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
|
|
11410
|
-
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/**
|
|
11476
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
|
|
11477
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
|
|
11478
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** All. */ "All"] = 0x7] = "All";
|
|
11411
11479
|
})(SpriteMaskUpdateFlags || (SpriteMaskUpdateFlags = {}));
|
|
11412
11480
|
|
|
11413
11481
|
/**
|
|
@@ -11668,14 +11736,11 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11668
11736
|
if (dataOffset === void 0) dataOffset = 0;
|
|
11669
11737
|
this._platformBuffer.getData(data, bufferByteOffset, dataOffset, dataLength);
|
|
11670
11738
|
};
|
|
11671
|
-
|
|
11672
|
-
* @override
|
|
11673
|
-
*/ _proto._rebuild = function _rebuild() {
|
|
11739
|
+
_proto._rebuild = function _rebuild() {
|
|
11674
11740
|
var platformBuffer = this._engine._hardwareRenderer.createPlatformBuffer(this._type, this._byteLength, this._bufferUsage);
|
|
11675
11741
|
this._platformBuffer = platformBuffer;
|
|
11676
11742
|
};
|
|
11677
11743
|
/**
|
|
11678
|
-
* @override
|
|
11679
11744
|
* @internal
|
|
11680
11745
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
11681
11746
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
@@ -11856,10 +11921,11 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11856
11921
|
/**
|
|
11857
11922
|
* @internal
|
|
11858
11923
|
*/ _proto._setVertexBufferBinding = function _setVertexBufferBinding(index, binding) {
|
|
11859
|
-
|
|
11860
|
-
|
|
11861
|
-
|
|
11862
|
-
|
|
11924
|
+
var referCount = this._getReferCount();
|
|
11925
|
+
if (referCount > 0) {
|
|
11926
|
+
var _this__vertexBufferBindings_index;
|
|
11927
|
+
(_this__vertexBufferBindings_index = this._vertexBufferBindings[index]) == null ? void 0 : _this__vertexBufferBindings_index._buffer._addReferCount(-referCount);
|
|
11928
|
+
binding == null ? void 0 : binding._buffer._addReferCount(referCount);
|
|
11863
11929
|
}
|
|
11864
11930
|
this._vertexBufferBindings[index] = binding;
|
|
11865
11931
|
this._bufferStructChanged = true;
|
|
@@ -11870,22 +11936,19 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11870
11936
|
this._platformPrimitive.draw(shaderProgram, subMesh);
|
|
11871
11937
|
this._bufferStructChanged = false;
|
|
11872
11938
|
};
|
|
11873
|
-
|
|
11874
|
-
|
|
11875
|
-
*/ _proto._addReferCount = function _addReferCount(value) {
|
|
11939
|
+
_proto._addReferCount = function _addReferCount(value) {
|
|
11940
|
+
var _this__indexBufferBinding;
|
|
11876
11941
|
GraphicsResource.prototype._addReferCount.call(this, value);
|
|
11877
11942
|
var vertexBufferBindings = this._vertexBufferBindings;
|
|
11878
11943
|
for(var i = 0, n = vertexBufferBindings.length; i < n; i++){
|
|
11879
11944
|
vertexBufferBindings[i]._buffer._addReferCount(value);
|
|
11880
11945
|
}
|
|
11946
|
+
(_this__indexBufferBinding = this._indexBufferBinding) == null ? void 0 : _this__indexBufferBinding._buffer._addReferCount(value);
|
|
11881
11947
|
};
|
|
11882
|
-
|
|
11883
|
-
* @override
|
|
11884
|
-
*/ _proto._rebuild = function _rebuild() {
|
|
11948
|
+
_proto._rebuild = function _rebuild() {
|
|
11885
11949
|
this._engine._hardwareRenderer.createPlatformPrimitive(this);
|
|
11886
11950
|
};
|
|
11887
11951
|
/**
|
|
11888
|
-
* @override
|
|
11889
11952
|
* @internal
|
|
11890
11953
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
11891
11954
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
@@ -11895,14 +11958,23 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11895
11958
|
this._vertexElementMap = null;
|
|
11896
11959
|
this._platformPrimitive.destroy();
|
|
11897
11960
|
};
|
|
11898
|
-
|
|
11961
|
+
/**
|
|
11962
|
+
* @internal
|
|
11963
|
+
*/ _proto._setVertexElements = function _setVertexElements(elements) {
|
|
11899
11964
|
this._clearVertexElements();
|
|
11900
11965
|
for(var i = 0, n = elements.length; i < n; i++){
|
|
11901
11966
|
this._addVertexElement(elements[i]);
|
|
11902
11967
|
}
|
|
11903
11968
|
};
|
|
11904
|
-
|
|
11969
|
+
/**
|
|
11970
|
+
* @internal
|
|
11971
|
+
*/ _proto._setIndexBufferBinding = function _setIndexBufferBinding(binding) {
|
|
11905
11972
|
var lastBinding = this._indexBufferBinding;
|
|
11973
|
+
var referCount = this._getReferCount();
|
|
11974
|
+
if (referCount > 0) {
|
|
11975
|
+
lastBinding == null ? void 0 : lastBinding.buffer._addReferCount(-referCount);
|
|
11976
|
+
binding == null ? void 0 : binding.buffer._addReferCount(referCount);
|
|
11977
|
+
}
|
|
11906
11978
|
if (binding) {
|
|
11907
11979
|
this._indexBufferBinding = binding;
|
|
11908
11980
|
this._glIndexType = BufferUtil._getGLIndexType(binding.format);
|
|
@@ -12218,6 +12290,7 @@ var MeshModifyFlags;
|
|
|
12218
12290
|
var subDataDirtyFlags = this._subDataDirtyFlags;
|
|
12219
12291
|
var blendShapeFloatStride = this._vertexElementCount * 3;
|
|
12220
12292
|
var blendShapeByteStride = blendShapeFloatStride * 4;
|
|
12293
|
+
var bufferOffset = this._bufferBindingOffset;
|
|
12221
12294
|
// @todo: should fix bug when dataChangedFlag is true
|
|
12222
12295
|
for(var i = 0, n = blendShapes.length; i < n; i++){
|
|
12223
12296
|
var dataChangedFlag = subDataDirtyFlags[i];
|
|
@@ -12235,7 +12308,7 @@ var MeshModifyFlags;
|
|
|
12235
12308
|
var offset = indexInBuffer * blendShapeFloatStride;
|
|
12236
12309
|
var storeInfo = storeInfos[i];
|
|
12237
12310
|
storeInfo || (storeInfos[i] = storeInfo = new Vector2());
|
|
12238
|
-
storeInfo.set(
|
|
12311
|
+
storeInfo.set(bufferOffset + bufferIndex, indexInBuffer * blendShapeByteStride); // BufferOffset is mesh vertexBuffer offset
|
|
12239
12312
|
var deltaPositions = endFrame.deltaPositions;
|
|
12240
12313
|
for(var j = 0; j < vertexCount; j++){
|
|
12241
12314
|
var start = offset + bufferFloatStride * j;
|
|
@@ -13040,7 +13113,6 @@ var MeshModifyFlags;
|
|
|
13040
13113
|
this.setTangents(tangents);
|
|
13041
13114
|
};
|
|
13042
13115
|
/**
|
|
13043
|
-
* @override
|
|
13044
13116
|
* @internal
|
|
13045
13117
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
13046
13118
|
Mesh.prototype._onDestroy.call(this);
|
|
@@ -13513,28 +13585,30 @@ var VertexChangedFlags;
|
|
|
13513
13585
|
function MeshRenderer(entity) {
|
|
13514
13586
|
var _this;
|
|
13515
13587
|
_this = Renderer.call(this, entity) || this;
|
|
13588
|
+
_this._enableVertexColor = false;
|
|
13516
13589
|
_this._onMeshChanged = _this._onMeshChanged.bind(_assert_this_initialized(_this));
|
|
13517
13590
|
return _this;
|
|
13518
13591
|
}
|
|
13519
13592
|
var _proto = MeshRenderer.prototype;
|
|
13520
13593
|
/**
|
|
13521
13594
|
* @internal
|
|
13522
|
-
* @override
|
|
13523
13595
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
13524
13596
|
Renderer.prototype._onDestroy.call(this);
|
|
13525
13597
|
var mesh = this._mesh;
|
|
13526
13598
|
if (mesh && !mesh.destroyed) {
|
|
13527
13599
|
mesh._addReferCount(-1);
|
|
13600
|
+
mesh._updateFlagManager.removeListener(this._onMeshChanged);
|
|
13528
13601
|
this._mesh = null;
|
|
13529
13602
|
}
|
|
13530
13603
|
};
|
|
13531
13604
|
/**
|
|
13532
13605
|
* @internal
|
|
13533
13606
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
13607
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
13534
13608
|
target.mesh = this._mesh;
|
|
13535
13609
|
};
|
|
13536
13610
|
/**
|
|
13537
|
-
* @
|
|
13611
|
+
* @internal
|
|
13538
13612
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
13539
13613
|
var mesh = this._mesh;
|
|
13540
13614
|
if (mesh) {
|
|
@@ -13547,7 +13621,7 @@ var VertexChangedFlags;
|
|
|
13547
13621
|
}
|
|
13548
13622
|
};
|
|
13549
13623
|
/**
|
|
13550
|
-
* @
|
|
13624
|
+
* @internal
|
|
13551
13625
|
*/ _proto._render = function _render(context) {
|
|
13552
13626
|
var mesh = this._mesh;
|
|
13553
13627
|
if (mesh) {
|
|
@@ -13558,7 +13632,7 @@ var VertexChangedFlags;
|
|
|
13558
13632
|
shaderData.disableMacro(MeshRenderer._uv1Macro);
|
|
13559
13633
|
shaderData.disableMacro(MeshRenderer._normalMacro);
|
|
13560
13634
|
shaderData.disableMacro(MeshRenderer._tangentMacro);
|
|
13561
|
-
shaderData.disableMacro(MeshRenderer.
|
|
13635
|
+
shaderData.disableMacro(MeshRenderer._enableVertexColorMacro);
|
|
13562
13636
|
for(var i = 0, n = vertexElements.length; i < n; i++){
|
|
13563
13637
|
switch(vertexElements[i].semantic){
|
|
13564
13638
|
case "TEXCOORD_0":
|
|
@@ -13574,7 +13648,7 @@ var VertexChangedFlags;
|
|
|
13574
13648
|
shaderData.enableMacro(MeshRenderer._tangentMacro);
|
|
13575
13649
|
break;
|
|
13576
13650
|
case "COLOR_0":
|
|
13577
|
-
shaderData.enableMacro(MeshRenderer.
|
|
13651
|
+
this._enableVertexColor && shaderData.enableMacro(MeshRenderer._enableVertexColorMacro);
|
|
13578
13652
|
break;
|
|
13579
13653
|
}
|
|
13580
13654
|
}
|
|
@@ -13625,6 +13699,20 @@ var VertexChangedFlags;
|
|
|
13625
13699
|
this._setMesh(value);
|
|
13626
13700
|
}
|
|
13627
13701
|
}
|
|
13702
|
+
},
|
|
13703
|
+
{
|
|
13704
|
+
key: "enableVertexColor",
|
|
13705
|
+
get: /**
|
|
13706
|
+
* Whether enable vertex color.
|
|
13707
|
+
*/ function get() {
|
|
13708
|
+
return this._enableVertexColor;
|
|
13709
|
+
},
|
|
13710
|
+
set: function set(value) {
|
|
13711
|
+
if (value !== this._enableVertexColor) {
|
|
13712
|
+
this._dirtyUpdateFlag |= 0x2;
|
|
13713
|
+
this._enableVertexColor = value;
|
|
13714
|
+
}
|
|
13715
|
+
}
|
|
13628
13716
|
}
|
|
13629
13717
|
]);
|
|
13630
13718
|
return MeshRenderer;
|
|
@@ -13642,7 +13730,7 @@ var VertexChangedFlags;
|
|
|
13642
13730
|
MeshRenderer._tangentMacro = ShaderMacro.getByName("RENDERER_HAS_TANGENT");
|
|
13643
13731
|
})();
|
|
13644
13732
|
(function() {
|
|
13645
|
-
MeshRenderer.
|
|
13733
|
+
MeshRenderer._enableVertexColorMacro = ShaderMacro.getByName("RENDERER_ENABLE_VERTEXCOLOR");
|
|
13646
13734
|
})();
|
|
13647
13735
|
__decorate([
|
|
13648
13736
|
ignoreClone
|
|
@@ -13674,7 +13762,7 @@ var /**
|
|
|
13674
13762
|
// Limit size to 256 to avoid some problem:
|
|
13675
13763
|
// 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!
|
|
13676
13764
|
// 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.
|
|
13677
|
-
maxVertexUniformVectors = Math.min(maxVertexUniformVectors,
|
|
13765
|
+
maxVertexUniformVectors = Math.min(maxVertexUniformVectors, rhi._options._maxAllowSkinUniformVectorCount);
|
|
13678
13766
|
_this._maxVertexUniformVectors = maxVertexUniformVectors;
|
|
13679
13767
|
_this._onLocalBoundsChanged = _this._onLocalBoundsChanged.bind(_assert_this_initialized(_this));
|
|
13680
13768
|
var localBounds = _this._localBounds;
|
|
@@ -13710,7 +13798,7 @@ var /**
|
|
|
13710
13798
|
}
|
|
13711
13799
|
};
|
|
13712
13800
|
/**
|
|
13713
|
-
* @
|
|
13801
|
+
* @internal
|
|
13714
13802
|
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
13715
13803
|
var entity = this.entity;
|
|
13716
13804
|
var worldMatrix = this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
|
|
@@ -13737,6 +13825,7 @@ var /**
|
|
|
13737
13825
|
(_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
|
|
13738
13826
|
this._jointTexture = new Texture2D(engine, 4, jointCount, TextureFormat.R32G32B32A32, false);
|
|
13739
13827
|
this._jointTexture.filterMode = TextureFilterMode.Point;
|
|
13828
|
+
this._jointTexture.isGCIgnored = true;
|
|
13740
13829
|
}
|
|
13741
13830
|
shaderData.disableMacro("RENDERER_JOINTS_NUM");
|
|
13742
13831
|
shaderData.enableMacro("RENDERER_USE_JOINT_TEXTURE");
|
|
@@ -13762,17 +13851,25 @@ var /**
|
|
|
13762
13851
|
};
|
|
13763
13852
|
/**
|
|
13764
13853
|
* @internal
|
|
13854
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
13855
|
+
var _this_rootBone, _this__jointTexture;
|
|
13856
|
+
MeshRenderer.prototype._onDestroy.call(this);
|
|
13857
|
+
(_this_rootBone = this.rootBone) == null ? void 0 : _this_rootBone.transform._updateFlagManager.removeListener(this._onTransformChanged);
|
|
13858
|
+
(_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
|
|
13859
|
+
};
|
|
13860
|
+
/**
|
|
13861
|
+
* @internal
|
|
13765
13862
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
13766
13863
|
MeshRenderer.prototype._cloneTo.call(this, target);
|
|
13767
13864
|
this._blendShapeWeights && (target._blendShapeWeights = this._blendShapeWeights.slice());
|
|
13768
13865
|
};
|
|
13769
13866
|
/**
|
|
13770
|
-
* @
|
|
13867
|
+
* @internal
|
|
13771
13868
|
*/ _proto._registerEntityTransformListener = function _registerEntityTransformListener() {
|
|
13772
13869
|
// Cancel register listener to entity transform.
|
|
13773
13870
|
};
|
|
13774
13871
|
/**
|
|
13775
|
-
* @
|
|
13872
|
+
* @internal
|
|
13776
13873
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
13777
13874
|
if (this._rootBone) {
|
|
13778
13875
|
var localBounds = this._localBounds;
|
|
@@ -13993,9 +14090,7 @@ __decorate([
|
|
|
13993
14090
|
return _this;
|
|
13994
14091
|
}
|
|
13995
14092
|
var _proto = PrimitiveMeshRestorer.prototype;
|
|
13996
|
-
|
|
13997
|
-
* @override
|
|
13998
|
-
*/ _proto.restoreContent = function restoreContent() {
|
|
14093
|
+
_proto.restoreContent = function restoreContent() {
|
|
13999
14094
|
var primitiveInfo = this.primitiveInfo;
|
|
14000
14095
|
switch(primitiveInfo.type){
|
|
14001
14096
|
case 0:
|
|
@@ -14055,7 +14150,6 @@ var PrimitiveType;
|
|
|
14055
14150
|
_this = PrimitiveRestoreInfo.call(this, 0, noLongerAccessible) || this;
|
|
14056
14151
|
_this.radius = radius;
|
|
14057
14152
|
_this.segments = segments;
|
|
14058
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
14059
14153
|
return _this;
|
|
14060
14154
|
}
|
|
14061
14155
|
return SphereRestoreInfo;
|
|
@@ -14070,7 +14164,6 @@ var PrimitiveType;
|
|
|
14070
14164
|
_this.width = width;
|
|
14071
14165
|
_this.height = height;
|
|
14072
14166
|
_this.depth = depth;
|
|
14073
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
14074
14167
|
return _this;
|
|
14075
14168
|
}
|
|
14076
14169
|
return CuboidRestoreInfo;
|
|
@@ -14086,7 +14179,6 @@ var PrimitiveType;
|
|
|
14086
14179
|
_this.height = height;
|
|
14087
14180
|
_this.horizontalSegments = horizontalSegments;
|
|
14088
14181
|
_this.verticalSegments = verticalSegments;
|
|
14089
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
14090
14182
|
return _this;
|
|
14091
14183
|
}
|
|
14092
14184
|
return PlaneRestoreInfo;
|
|
@@ -14103,7 +14195,6 @@ var PrimitiveType;
|
|
|
14103
14195
|
_this.height = height;
|
|
14104
14196
|
_this.radialSegments = radialSegments;
|
|
14105
14197
|
_this.heightSegments = heightSegments;
|
|
14106
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
14107
14198
|
return _this;
|
|
14108
14199
|
}
|
|
14109
14200
|
return CylinderRestoreInfo;
|
|
@@ -14120,7 +14211,6 @@ var PrimitiveType;
|
|
|
14120
14211
|
_this.radialSegments = radialSegments;
|
|
14121
14212
|
_this.tubularSegments = tubularSegments;
|
|
14122
14213
|
_this.arc = arc;
|
|
14123
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
14124
14214
|
return _this;
|
|
14125
14215
|
}
|
|
14126
14216
|
return TorusRestoreInfo;
|
|
@@ -14136,7 +14226,6 @@ var PrimitiveType;
|
|
|
14136
14226
|
_this.height = height;
|
|
14137
14227
|
_this.radialSegments = radialSegments;
|
|
14138
14228
|
_this.heightSegments = heightSegments;
|
|
14139
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
14140
14229
|
return _this;
|
|
14141
14230
|
}
|
|
14142
14231
|
return ConeRestoreInfo;
|
|
@@ -14152,7 +14241,6 @@ var PrimitiveType;
|
|
|
14152
14241
|
_this.height = height;
|
|
14153
14242
|
_this.radialSegments = radialSegments;
|
|
14154
14243
|
_this.heightSegments = heightSegments;
|
|
14155
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
14156
14244
|
return _this;
|
|
14157
14245
|
}
|
|
14158
14246
|
return CapsuleRestoreInfo;
|
|
@@ -15235,14 +15323,17 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
|
|
|
15235
15323
|
_proto._createMesh = function _createMesh(engine, index) {
|
|
15236
15324
|
var MAX_VERTEX_COUNT = Basic2DBatcher.MAX_VERTEX_COUNT;
|
|
15237
15325
|
var mesh = new BufferMesh(engine, "BufferMesh" + index);
|
|
15326
|
+
mesh.isGCIgnored = true;
|
|
15238
15327
|
var vertexElements = [];
|
|
15239
15328
|
var vertexStride = this.createVertexElements(vertexElements);
|
|
15240
15329
|
// vertices
|
|
15241
|
-
this._vertexBuffers[index] = new Buffer(engine, BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * 4 * vertexStride, BufferUsage.Dynamic);
|
|
15330
|
+
var vertexBuffer = this._vertexBuffers[index] = new Buffer(engine, BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * 4 * vertexStride, BufferUsage.Dynamic);
|
|
15331
|
+
vertexBuffer.isGCIgnored = true;
|
|
15242
15332
|
// indices
|
|
15243
|
-
this._indiceBuffers[index] = new Buffer(engine, BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 3, BufferUsage.Dynamic);
|
|
15244
|
-
|
|
15245
|
-
mesh.
|
|
15333
|
+
var indiceBuffer = this._indiceBuffers[index] = new Buffer(engine, BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 2 * 3, BufferUsage.Dynamic);
|
|
15334
|
+
indiceBuffer.isGCIgnored = true;
|
|
15335
|
+
mesh.setVertexBufferBinding(vertexBuffer, vertexStride);
|
|
15336
|
+
mesh.setIndexBufferBinding(indiceBuffer, IndexFormat.UInt16);
|
|
15246
15337
|
mesh.setVertexElements(vertexElements);
|
|
15247
15338
|
return mesh;
|
|
15248
15339
|
};
|
|
@@ -15526,6 +15617,12 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
15526
15617
|
var _proto = Sky.prototype;
|
|
15527
15618
|
/**
|
|
15528
15619
|
* @internal
|
|
15620
|
+
*/ _proto.destroy = function destroy() {
|
|
15621
|
+
this.mesh = null;
|
|
15622
|
+
this.material = null;
|
|
15623
|
+
};
|
|
15624
|
+
/**
|
|
15625
|
+
* @internal
|
|
15529
15626
|
*/ _proto._render = function _render(context) {
|
|
15530
15627
|
var _this = this, material = _this.material, mesh = _this.mesh;
|
|
15531
15628
|
if (!material) {
|
|
@@ -15566,6 +15663,40 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
15566
15663
|
rhi.drawPrimitive(mesh, mesh.subMesh, program);
|
|
15567
15664
|
cameraShaderData.setMatrix(RenderContext.vpMatrixProperty, originViewProjMatrix);
|
|
15568
15665
|
};
|
|
15666
|
+
_create_class(Sky, [
|
|
15667
|
+
{
|
|
15668
|
+
key: "material",
|
|
15669
|
+
get: /**
|
|
15670
|
+
* Material of the sky.
|
|
15671
|
+
*/ function get() {
|
|
15672
|
+
return this._material;
|
|
15673
|
+
},
|
|
15674
|
+
set: function set(value) {
|
|
15675
|
+
if (this._material !== value) {
|
|
15676
|
+
var _this__material;
|
|
15677
|
+
value == null ? void 0 : value._addReferCount(1);
|
|
15678
|
+
(_this__material = this._material) == null ? void 0 : _this__material._addReferCount(-1);
|
|
15679
|
+
this._material = value;
|
|
15680
|
+
}
|
|
15681
|
+
}
|
|
15682
|
+
},
|
|
15683
|
+
{
|
|
15684
|
+
key: "mesh",
|
|
15685
|
+
get: /**
|
|
15686
|
+
* Mesh of the sky.
|
|
15687
|
+
*/ function get() {
|
|
15688
|
+
return this._mesh;
|
|
15689
|
+
},
|
|
15690
|
+
set: function set(value) {
|
|
15691
|
+
if (this._mesh !== value) {
|
|
15692
|
+
var _this__mesh;
|
|
15693
|
+
value == null ? void 0 : value._addReferCount(1);
|
|
15694
|
+
(_this__mesh = this._mesh) == null ? void 0 : _this__mesh._addReferCount(-1);
|
|
15695
|
+
this._mesh = value;
|
|
15696
|
+
}
|
|
15697
|
+
}
|
|
15698
|
+
}
|
|
15699
|
+
]);
|
|
15569
15700
|
return Sky;
|
|
15570
15701
|
}();
|
|
15571
15702
|
(function() {
|
|
@@ -15601,9 +15732,19 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
15601
15732
|
var _proto = Background.prototype;
|
|
15602
15733
|
/**
|
|
15603
15734
|
* @internal
|
|
15735
|
+
*/ _proto.destroy = function destroy() {
|
|
15736
|
+
this._mesh._addReferCount(-1);
|
|
15737
|
+
this._mesh = null;
|
|
15738
|
+
this.texture = null;
|
|
15739
|
+
this.solidColor = null;
|
|
15740
|
+
this.sky.destroy();
|
|
15741
|
+
};
|
|
15742
|
+
/**
|
|
15743
|
+
* @internal
|
|
15604
15744
|
* Standalone for CanvasRenderer plugin.
|
|
15605
15745
|
*/ _proto._initMesh = function _initMesh(engine) {
|
|
15606
15746
|
this._mesh = this._createPlane(engine);
|
|
15747
|
+
this._mesh._addReferCount(1);
|
|
15607
15748
|
};
|
|
15608
15749
|
/**
|
|
15609
15750
|
* @internal
|
|
@@ -15675,6 +15816,9 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
15675
15816
|
},
|
|
15676
15817
|
set: function set(value) {
|
|
15677
15818
|
if (this._texture !== value) {
|
|
15819
|
+
var _this__texture;
|
|
15820
|
+
value == null ? void 0 : value._addReferCount(1);
|
|
15821
|
+
(_this__texture = this._texture) == null ? void 0 : _this__texture._addReferCount(-1);
|
|
15678
15822
|
this._texture = value;
|
|
15679
15823
|
this._engine._backgroundTextureMaterial.shaderData.setTexture("material_BaseTexture", value);
|
|
15680
15824
|
}
|
|
@@ -16152,7 +16296,7 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
16152
16296
|
var sunLightIndex = lightManager._getSunLightIndex();
|
|
16153
16297
|
if (sunLightIndex !== -1) {
|
|
16154
16298
|
var sunlight = lightManager._directLights.get(sunLightIndex);
|
|
16155
|
-
shaderData.setColor(Scene._sunlightColorProperty, sunlight.
|
|
16299
|
+
shaderData.setColor(Scene._sunlightColorProperty, sunlight._getLightIntensityColor());
|
|
16156
16300
|
shaderData.setVector3(Scene._sunlightDirectionProperty, sunlight.direction);
|
|
16157
16301
|
this._sunLight = sunlight;
|
|
16158
16302
|
}
|
|
@@ -16183,6 +16327,7 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
16183
16327
|
this._rootEntities[0].destroy();
|
|
16184
16328
|
}
|
|
16185
16329
|
this._activeCameras.length = 0;
|
|
16330
|
+
this.background.destroy();
|
|
16186
16331
|
this.shaderData._addReferCount(-1);
|
|
16187
16332
|
};
|
|
16188
16333
|
_proto._addToRootEntityList = function _addToRootEntityList(index, rootEntity) {
|
|
@@ -16640,7 +16785,7 @@ ShaderPool.init();
|
|
|
16640
16785
|
_this._spriteDefaultMaterial = _this._createSpriteMaterial();
|
|
16641
16786
|
_this._spriteMaskDefaultMaterial = _this._createSpriteMaskMaterial();
|
|
16642
16787
|
_this._textDefaultFont = Font.createFromOS(_assert_this_initialized(_this), "Arial");
|
|
16643
|
-
_this._textDefaultFont.isGCIgnored =
|
|
16788
|
+
_this._textDefaultFont.isGCIgnored = true;
|
|
16644
16789
|
_this.inputManager = new InputManager(_assert_this_initialized(_this));
|
|
16645
16790
|
_this._initMagentaTextures(hardwareRenderer);
|
|
16646
16791
|
if (!hardwareRenderer.canIUse(GLCapabilityType.depthTexture)) {
|
|
@@ -16651,6 +16796,7 @@ ShaderPool.init();
|
|
|
16651
16796
|
_this._depthTexture2D = depthTexture2D;
|
|
16652
16797
|
}
|
|
16653
16798
|
var magentaMaterial = new Material(_assert_this_initialized(_this), Shader.find("unlit"));
|
|
16799
|
+
magentaMaterial.isGCIgnored = true;
|
|
16654
16800
|
magentaMaterial.shaderData.setColor("material_BaseColor", new Color(1.0, 0.0, 1.01, 1.0));
|
|
16655
16801
|
_this._magentaMaterial = magentaMaterial;
|
|
16656
16802
|
var backgroundTextureMaterial = new Material(_assert_this_initialized(_this), Shader.find("background-texture"));
|
|
@@ -16877,7 +17023,9 @@ ShaderPool.init();
|
|
|
16877
17023
|
this._magentaTexture2DArray = magentaTexture2DArray;
|
|
16878
17024
|
}
|
|
16879
17025
|
};
|
|
16880
|
-
|
|
17026
|
+
/**
|
|
17027
|
+
* @internal
|
|
17028
|
+
*/ _proto._initialize = function _initialize(configuration) {
|
|
16881
17029
|
var _this = this;
|
|
16882
17030
|
var physics = configuration.physics;
|
|
16883
17031
|
if (physics) {
|
|
@@ -17146,14 +17294,12 @@ ShaderPool.init();
|
|
|
17146
17294
|
/**
|
|
17147
17295
|
* @internal
|
|
17148
17296
|
* @inheritDoc
|
|
17149
|
-
* @override
|
|
17150
17297
|
*/ _proto._onAwake = function _onAwake() {
|
|
17151
17298
|
this.onAwake();
|
|
17152
17299
|
};
|
|
17153
17300
|
/**
|
|
17154
17301
|
* @internal
|
|
17155
17302
|
* @inheritDoc
|
|
17156
|
-
* @override
|
|
17157
17303
|
*/ _proto._onEnable = function _onEnable() {
|
|
17158
17304
|
if (this._waitHandlingInValid) {
|
|
17159
17305
|
this._waitHandlingInValid = false;
|
|
@@ -17179,7 +17325,6 @@ ShaderPool.init();
|
|
|
17179
17325
|
/**
|
|
17180
17326
|
* @internal
|
|
17181
17327
|
* @inheritDoc
|
|
17182
|
-
* @override
|
|
17183
17328
|
*/ _proto._onDisable = function _onDisable() {
|
|
17184
17329
|
this._waitHandlingInValid = true;
|
|
17185
17330
|
this._engine._componentsManager.addDisableScript(this);
|
|
@@ -17203,7 +17348,6 @@ ShaderPool.init();
|
|
|
17203
17348
|
this._waitHandlingInValid = false;
|
|
17204
17349
|
};
|
|
17205
17350
|
/**
|
|
17206
|
-
* @override
|
|
17207
17351
|
* @internal
|
|
17208
17352
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
17209
17353
|
Component.prototype._onDestroy.call(this);
|
|
@@ -18155,7 +18299,7 @@ var /**
|
|
|
18155
18299
|
// prepare render target
|
|
18156
18300
|
var renderTarget = this._getAvailableRenderTarget();
|
|
18157
18301
|
// @todo: shouldn't set viewport and scissor in activeRenderTarget
|
|
18158
|
-
rhi.activeRenderTarget(renderTarget,
|
|
18302
|
+
rhi.activeRenderTarget(renderTarget, CascadedShadowCasterPass._viewport, 0);
|
|
18159
18303
|
if (this._supportDepthTexture) {
|
|
18160
18304
|
rhi.clearRenderTarget(engine, CameraClearFlags.Depth, null);
|
|
18161
18305
|
} else {
|
|
@@ -18277,11 +18421,13 @@ var /**
|
|
|
18277
18421
|
if (engine._hardwareRenderer._isWebGL2) {
|
|
18278
18422
|
depthTexture.depthCompareFunction = TextureDepthCompareFunction.Less;
|
|
18279
18423
|
}
|
|
18424
|
+
renderTarget == null ? void 0 : renderTarget._addReferCount(-1);
|
|
18280
18425
|
if (this._supportDepthTexture) {
|
|
18281
18426
|
renderTarget = this._renderTargets = new RenderTarget(engine, width, height, null, depthTexture);
|
|
18282
18427
|
} else {
|
|
18283
18428
|
renderTarget = this._renderTargets = new RenderTarget(engine, width, height, depthTexture);
|
|
18284
18429
|
}
|
|
18430
|
+
renderTarget._addReferCount(1);
|
|
18285
18431
|
}
|
|
18286
18432
|
return renderTarget;
|
|
18287
18433
|
};
|
|
@@ -18304,7 +18450,12 @@ var /**
|
|
|
18304
18450
|
var height = shadowCascades == ShadowCascadesMode.TwoCascades ? shadowTileResolution : shadowTileResolution * 2;
|
|
18305
18451
|
this._shadowMapSize.set(1.0 / width, 1.0 / height, width, height);
|
|
18306
18452
|
}
|
|
18307
|
-
this._renderTargets
|
|
18453
|
+
var renderTargets = this._renderTargets;
|
|
18454
|
+
if (renderTargets) {
|
|
18455
|
+
renderTargets._addReferCount(-1);
|
|
18456
|
+
renderTargets.destroy();
|
|
18457
|
+
this._renderTargets = null;
|
|
18458
|
+
}
|
|
18308
18459
|
var viewportOffset = this._viewportOffsets;
|
|
18309
18460
|
var shadowTileResolution1 = this._shadowTileResolution;
|
|
18310
18461
|
switch(shadowCascades){
|
|
@@ -18360,6 +18511,9 @@ var /**
|
|
|
18360
18511
|
(function() {
|
|
18361
18512
|
CascadedShadowCasterPass._cascadesSplitDistance = new Array(CascadedShadowCasterPass._maxCascades + 1);
|
|
18362
18513
|
})();
|
|
18514
|
+
(function() {
|
|
18515
|
+
CascadedShadowCasterPass._viewport = new Vector4(0, 0, 1, 1);
|
|
18516
|
+
})();
|
|
18363
18517
|
(function() {
|
|
18364
18518
|
CascadedShadowCasterPass._clearColor = new Color$1(1, 1, 1, 1);
|
|
18365
18519
|
})();
|
|
@@ -18878,19 +19032,17 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
18878
19032
|
this._replacementSubShaderTag = null;
|
|
18879
19033
|
};
|
|
18880
19034
|
/**
|
|
18881
|
-
* @override
|
|
18882
19035
|
* @inheritdoc
|
|
18883
19036
|
*/ _proto._onEnable = function _onEnable() {
|
|
18884
19037
|
this.entity.scene._attachRenderCamera(this);
|
|
18885
19038
|
};
|
|
18886
19039
|
/**
|
|
18887
|
-
* @override
|
|
18888
19040
|
* @inheritdoc
|
|
18889
19041
|
*/ _proto._onDisable = function _onDisable() {
|
|
18890
19042
|
this.entity.scene._detachRenderCamera(this);
|
|
18891
19043
|
};
|
|
18892
19044
|
/**
|
|
18893
|
-
* @
|
|
19045
|
+
* @internal
|
|
18894
19046
|
* @inheritdoc
|
|
18895
19047
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
18896
19048
|
var _this__renderPipeline;
|
|
@@ -19096,7 +19248,12 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
19096
19248
|
return this._renderTarget;
|
|
19097
19249
|
},
|
|
19098
19250
|
set: function set(value) {
|
|
19099
|
-
this._renderTarget
|
|
19251
|
+
if (this._renderTarget !== value) {
|
|
19252
|
+
var _this__renderTarget;
|
|
19253
|
+
value == null ? void 0 : value._addReferCount(1);
|
|
19254
|
+
(_this__renderTarget = this._renderTarget) == null ? void 0 : _this__renderTarget._addReferCount(-1);
|
|
19255
|
+
this._renderTarget = value;
|
|
19256
|
+
}
|
|
19100
19257
|
}
|
|
19101
19258
|
}
|
|
19102
19259
|
]);
|
|
@@ -19454,7 +19611,6 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19454
19611
|
}
|
|
19455
19612
|
};
|
|
19456
19613
|
/**
|
|
19457
|
-
* @override
|
|
19458
19614
|
* Clone and return the instance.
|
|
19459
19615
|
*/ _proto.clone = function clone() {
|
|
19460
19616
|
var dest = new BaseMaterial(this._engine, this.shader);
|
|
@@ -19462,7 +19618,6 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19462
19618
|
return dest;
|
|
19463
19619
|
};
|
|
19464
19620
|
/**
|
|
19465
|
-
* @override
|
|
19466
19621
|
* Clone to the target material.
|
|
19467
19622
|
* @param target - target material
|
|
19468
19623
|
*/ _proto.cloneTo = function cloneTo(target) {
|
|
@@ -19623,8 +19778,8 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19623
19778
|
var _this;
|
|
19624
19779
|
_this = BaseMaterial.call(this, engine, Shader.find("blinn-phong")) || this;
|
|
19625
19780
|
var shaderData = _this.shaderData;
|
|
19626
|
-
shaderData.enableMacro("
|
|
19627
|
-
shaderData.enableMacro("
|
|
19781
|
+
shaderData.enableMacro("MATERIAL_NEED_WORLD_POS");
|
|
19782
|
+
shaderData.enableMacro("MATERIAL_NEED_TILING_OFFSET");
|
|
19628
19783
|
shaderData.setColor(BlinnPhongMaterial._baseColorProp, new Color$1(1, 1, 1, 1));
|
|
19629
19784
|
shaderData.setColor(BlinnPhongMaterial._specularColorProp, new Color$1(1, 1, 1, 1));
|
|
19630
19785
|
shaderData.setColor(BlinnPhongMaterial._emissiveColorProp, new Color$1(0, 0, 0, 1));
|
|
@@ -19634,9 +19789,7 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19634
19789
|
return _this;
|
|
19635
19790
|
}
|
|
19636
19791
|
var _proto = BlinnPhongMaterial.prototype;
|
|
19637
|
-
|
|
19638
|
-
* @override
|
|
19639
|
-
*/ _proto.clone = function clone() {
|
|
19792
|
+
_proto.clone = function clone() {
|
|
19640
19793
|
var dest = new BlinnPhongMaterial(this._engine);
|
|
19641
19794
|
this.cloneTo(dest);
|
|
19642
19795
|
return dest;
|
|
@@ -19819,8 +19972,8 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19819
19972
|
var _this;
|
|
19820
19973
|
_this = BaseMaterial.call(this, engine, shader) || this;
|
|
19821
19974
|
var shaderData = _this.shaderData;
|
|
19822
|
-
shaderData.enableMacro("
|
|
19823
|
-
shaderData.enableMacro("
|
|
19975
|
+
shaderData.enableMacro("MATERIAL_NEED_WORLD_POS");
|
|
19976
|
+
shaderData.enableMacro("MATERIAL_NEED_TILING_OFFSET");
|
|
19824
19977
|
shaderData.setColor(PBRBaseMaterial._baseColorProp, new Color$1(1, 1, 1, 1));
|
|
19825
19978
|
shaderData.setColor(PBRBaseMaterial._emissiveColorProp, new Color$1(0, 0, 0, 1));
|
|
19826
19979
|
shaderData.setVector4(PBRBaseMaterial._tilingOffsetProp, new Vector4(1, 1, 0, 0));
|
|
@@ -19929,9 +20082,9 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19929
20082
|
set: function set(value) {
|
|
19930
20083
|
this.shaderData.setTexture(PBRBaseMaterial._occlusionTextureProp, value);
|
|
19931
20084
|
if (value) {
|
|
19932
|
-
this.shaderData.enableMacro("
|
|
20085
|
+
this.shaderData.enableMacro("MATERIAL_HAS_OCCLUSION_TEXTURE");
|
|
19933
20086
|
} else {
|
|
19934
|
-
this.shaderData.disableMacro("
|
|
20087
|
+
this.shaderData.disableMacro("MATERIAL_HAS_OCCLUSION_TEXTURE");
|
|
19935
20088
|
}
|
|
19936
20089
|
}
|
|
19937
20090
|
},
|
|
@@ -19985,9 +20138,9 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19985
20138
|
set: function set(value) {
|
|
19986
20139
|
if (!!this.shaderData.getFloat(PBRBaseMaterial._clearCoatProp) !== !!value) {
|
|
19987
20140
|
if (value === 0) {
|
|
19988
|
-
this.shaderData.disableMacro("
|
|
20141
|
+
this.shaderData.disableMacro("MATERIAL_ENABLE_CLEAR_COAT");
|
|
19989
20142
|
} else {
|
|
19990
|
-
this.shaderData.enableMacro("
|
|
20143
|
+
this.shaderData.enableMacro("MATERIAL_ENABLE_CLEAR_COAT");
|
|
19991
20144
|
}
|
|
19992
20145
|
}
|
|
19993
20146
|
this.shaderData.setFloat(PBRBaseMaterial._clearCoatProp, value);
|
|
@@ -20003,9 +20156,9 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20003
20156
|
set: function set(value) {
|
|
20004
20157
|
this.shaderData.setTexture(PBRBaseMaterial._clearCoatTextureProp, value);
|
|
20005
20158
|
if (value) {
|
|
20006
|
-
this.shaderData.enableMacro("
|
|
20159
|
+
this.shaderData.enableMacro("MATERIAL_HAS_CLEAR_COAT_TEXTURE");
|
|
20007
20160
|
} else {
|
|
20008
|
-
this.shaderData.disableMacro("
|
|
20161
|
+
this.shaderData.disableMacro("MATERIAL_HAS_CLEAR_COAT_TEXTURE");
|
|
20009
20162
|
}
|
|
20010
20163
|
}
|
|
20011
20164
|
},
|
|
@@ -20030,9 +20183,9 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20030
20183
|
set: function set(value) {
|
|
20031
20184
|
this.shaderData.setTexture(PBRBaseMaterial._clearCoatRoughnessTextureProp, value);
|
|
20032
20185
|
if (value) {
|
|
20033
|
-
this.shaderData.enableMacro("
|
|
20186
|
+
this.shaderData.enableMacro("MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE");
|
|
20034
20187
|
} else {
|
|
20035
|
-
this.shaderData.disableMacro("
|
|
20188
|
+
this.shaderData.disableMacro("MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE");
|
|
20036
20189
|
}
|
|
20037
20190
|
}
|
|
20038
20191
|
},
|
|
@@ -20046,9 +20199,9 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20046
20199
|
set: function set(value) {
|
|
20047
20200
|
this.shaderData.setTexture(PBRBaseMaterial._clearCoatNormalTextureProp, value);
|
|
20048
20201
|
if (value) {
|
|
20049
|
-
this.shaderData.enableMacro("
|
|
20202
|
+
this.shaderData.enableMacro("MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE");
|
|
20050
20203
|
} else {
|
|
20051
|
-
this.shaderData.disableMacro("
|
|
20204
|
+
this.shaderData.disableMacro("MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE");
|
|
20052
20205
|
}
|
|
20053
20206
|
}
|
|
20054
20207
|
}
|
|
@@ -20089,21 +20242,35 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20089
20242
|
_this = PBRBaseMaterial.call(this, engine, Shader.find("pbr")) || this;
|
|
20090
20243
|
_this.shaderData.setFloat(PBRMaterial._metallicProp, 1);
|
|
20091
20244
|
_this.shaderData.setFloat(PBRMaterial._roughnessProp, 1);
|
|
20245
|
+
_this.shaderData.setFloat(PBRMaterial._iorProp, 1.5);
|
|
20092
20246
|
return _this;
|
|
20093
20247
|
}
|
|
20094
20248
|
var _proto = PBRMaterial.prototype;
|
|
20095
20249
|
/**
|
|
20096
|
-
* @
|
|
20250
|
+
* @inheritdoc
|
|
20097
20251
|
*/ _proto.clone = function clone() {
|
|
20098
20252
|
var dest = new PBRMaterial(this._engine);
|
|
20099
20253
|
this.cloneTo(dest);
|
|
20100
20254
|
return dest;
|
|
20101
20255
|
};
|
|
20102
20256
|
_create_class(PBRMaterial, [
|
|
20257
|
+
{
|
|
20258
|
+
key: "ior",
|
|
20259
|
+
get: /**
|
|
20260
|
+
* Index Of Refraction.
|
|
20261
|
+
* @defaultValue `1.5`
|
|
20262
|
+
*/ function get() {
|
|
20263
|
+
return this.shaderData.getFloat(PBRMaterial._iorProp);
|
|
20264
|
+
},
|
|
20265
|
+
set: function set(v) {
|
|
20266
|
+
this.shaderData.setFloat(PBRMaterial._iorProp, Math.max(v, 0));
|
|
20267
|
+
}
|
|
20268
|
+
},
|
|
20103
20269
|
{
|
|
20104
20270
|
key: "metallic",
|
|
20105
20271
|
get: /**
|
|
20106
|
-
* Metallic
|
|
20272
|
+
* Metallic.
|
|
20273
|
+
* @defaultValue `1.0`
|
|
20107
20274
|
*/ function get() {
|
|
20108
20275
|
return this.shaderData.getFloat(PBRMaterial._metallicProp);
|
|
20109
20276
|
},
|
|
@@ -20114,7 +20281,8 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20114
20281
|
{
|
|
20115
20282
|
key: "roughness",
|
|
20116
20283
|
get: /**
|
|
20117
|
-
* Roughness
|
|
20284
|
+
* Roughness. default 1.0.
|
|
20285
|
+
* @defaultValue `1.0`
|
|
20118
20286
|
*/ function get() {
|
|
20119
20287
|
return this.shaderData.getFloat(PBRMaterial._roughnessProp);
|
|
20120
20288
|
},
|
|
@@ -20133,9 +20301,9 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20133
20301
|
set: function set(value) {
|
|
20134
20302
|
this.shaderData.setTexture(PBRMaterial._roughnessMetallicTextureProp, value);
|
|
20135
20303
|
if (value) {
|
|
20136
|
-
this.shaderData.enableMacro("
|
|
20304
|
+
this.shaderData.enableMacro("MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE");
|
|
20137
20305
|
} else {
|
|
20138
|
-
this.shaderData.disableMacro("
|
|
20306
|
+
this.shaderData.disableMacro("MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE");
|
|
20139
20307
|
}
|
|
20140
20308
|
}
|
|
20141
20309
|
}
|
|
@@ -20151,6 +20319,9 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20151
20319
|
(function() {
|
|
20152
20320
|
PBRMaterial._roughnessMetallicTextureProp = ShaderProperty.getByName("material_RoughnessMetallicTexture");
|
|
20153
20321
|
})();
|
|
20322
|
+
(function() {
|
|
20323
|
+
PBRMaterial._iorProp = Shader.getPropertyByName("material_IOR");
|
|
20324
|
+
})();
|
|
20154
20325
|
|
|
20155
20326
|
/**
|
|
20156
20327
|
* PBR (Specular-Glossiness Workflow) Material.
|
|
@@ -20165,7 +20336,7 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20165
20336
|
}
|
|
20166
20337
|
var _proto = PBRSpecularMaterial.prototype;
|
|
20167
20338
|
/**
|
|
20168
|
-
* @
|
|
20339
|
+
* @inheritdoc
|
|
20169
20340
|
*/ _proto.clone = function clone() {
|
|
20170
20341
|
var dest = new PBRSpecularMaterial(this._engine);
|
|
20171
20342
|
this.cloneTo(dest);
|
|
@@ -20227,7 +20398,7 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20227
20398
|
PBRSpecularMaterial._specularGlossinessTextureProp = ShaderProperty.getByName("material_SpecularGlossinessTexture");
|
|
20228
20399
|
})();
|
|
20229
20400
|
(function() {
|
|
20230
|
-
PBRSpecularMaterial._specularGlossinessTextureMacro = ShaderMacro.getByName("
|
|
20401
|
+
PBRSpecularMaterial._specularGlossinessTextureMacro = ShaderMacro.getByName("MATERIAL_HAS_SPECULAR_GLOSSINESS_TEXTURE");
|
|
20231
20402
|
})();
|
|
20232
20403
|
|
|
20233
20404
|
/**
|
|
@@ -20239,14 +20410,14 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20239
20410
|
_this = BaseMaterial.call(this, engine, Shader.find("unlit")) || this;
|
|
20240
20411
|
var shaderData = _this.shaderData;
|
|
20241
20412
|
shaderData.enableMacro("MATERIAL_OMIT_NORMAL");
|
|
20242
|
-
shaderData.enableMacro("
|
|
20413
|
+
shaderData.enableMacro("MATERIAL_NEED_TILING_OFFSET");
|
|
20243
20414
|
shaderData.setColor(UnlitMaterial._baseColorProp, new Color$1(1, 1, 1, 1));
|
|
20244
20415
|
shaderData.setVector4(UnlitMaterial._tilingOffsetProp, new Vector4(1, 1, 0, 0));
|
|
20245
20416
|
return _this;
|
|
20246
20417
|
}
|
|
20247
20418
|
var _proto = UnlitMaterial.prototype;
|
|
20248
20419
|
/**
|
|
20249
|
-
* @
|
|
20420
|
+
* @inheritdoc
|
|
20250
20421
|
*/ _proto.clone = function clone() {
|
|
20251
20422
|
var dest = new UnlitMaterial(this._engine);
|
|
20252
20423
|
this.cloneTo(dest);
|
|
@@ -20362,12 +20533,18 @@ var TextVerticalAlignment;
|
|
|
20362
20533
|
* @internal
|
|
20363
20534
|
*/ _proto._addSprite = function _addSprite(sprite) {
|
|
20364
20535
|
this._spriteNamesToIndex[sprite.name] = this._sprites.push(sprite) - 1;
|
|
20536
|
+
sprite._atlas = this;
|
|
20537
|
+
sprite.isGCIgnored = true;
|
|
20365
20538
|
};
|
|
20366
20539
|
/**
|
|
20367
|
-
* @override
|
|
20368
20540
|
* @internal
|
|
20369
20541
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
20370
20542
|
ReferResource.prototype._onDestroy.call(this);
|
|
20543
|
+
var _this = this, sprites = _this._sprites;
|
|
20544
|
+
for(var i = 0, n = sprites.length; i < n; i++){
|
|
20545
|
+
sprites[i].destroy();
|
|
20546
|
+
}
|
|
20547
|
+
sprites.length = 0;
|
|
20371
20548
|
this._sprites = null;
|
|
20372
20549
|
this._spriteNamesToIndex = null;
|
|
20373
20550
|
};
|
|
@@ -20415,8 +20592,10 @@ var TextVerticalAlignment;
|
|
|
20415
20592
|
if (name === void 0) name = null;
|
|
20416
20593
|
var _this;
|
|
20417
20594
|
_this = ReferResource.call(this, engine) || this;
|
|
20418
|
-
_this.
|
|
20419
|
-
_this.
|
|
20595
|
+
_this._automaticWidth = 0;
|
|
20596
|
+
_this._automaticHeight = 0;
|
|
20597
|
+
_this._customWidth = undefined;
|
|
20598
|
+
_this._customHeight = undefined;
|
|
20420
20599
|
_this._positions = [
|
|
20421
20600
|
new Vector2(),
|
|
20422
20601
|
new Vector2(),
|
|
@@ -20437,7 +20616,7 @@ var TextVerticalAlignment;
|
|
|
20437
20616
|
_this._region = new Rect(0, 0, 1, 1);
|
|
20438
20617
|
_this._pivot = new Vector2(0.5, 0.5);
|
|
20439
20618
|
_this._border = new Vector4(0, 0, 0, 0);
|
|
20440
|
-
_this._dirtyUpdateFlag =
|
|
20619
|
+
_this._dirtyUpdateFlag = 0x7;
|
|
20441
20620
|
/** @internal */ _this._updateFlagManager = new UpdateFlagManager();
|
|
20442
20621
|
_this._texture = texture;
|
|
20443
20622
|
region && _this._region.copyFrom(region);
|
|
@@ -20476,19 +20655,40 @@ var TextVerticalAlignment;
|
|
|
20476
20655
|
return this._bounds;
|
|
20477
20656
|
};
|
|
20478
20657
|
/**
|
|
20479
|
-
* @
|
|
20658
|
+
* @internal
|
|
20659
|
+
*/ _proto._addReferCount = function _addReferCount(value) {
|
|
20660
|
+
var _this__atlas;
|
|
20661
|
+
ReferResource.prototype._addReferCount.call(this, value);
|
|
20662
|
+
(_this__atlas = this._atlas) == null ? void 0 : _this__atlas._addReferCount(value);
|
|
20663
|
+
};
|
|
20664
|
+
/**
|
|
20480
20665
|
* @internal
|
|
20481
20666
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
20482
20667
|
ReferResource.prototype._onDestroy.call(this);
|
|
20668
|
+
this._positions.length = 0;
|
|
20669
|
+
this._positions = null;
|
|
20670
|
+
this._uvs.length = 0;
|
|
20671
|
+
this._uvs = null;
|
|
20672
|
+
this._atlasRegion = null;
|
|
20673
|
+
this._atlasRegionOffset = null;
|
|
20674
|
+
this._region = null;
|
|
20675
|
+
this._pivot = null;
|
|
20676
|
+
this._border = null;
|
|
20677
|
+
this._bounds = null;
|
|
20678
|
+
this._atlas = null;
|
|
20483
20679
|
this._texture = null;
|
|
20680
|
+
this._updateFlagManager = null;
|
|
20484
20681
|
};
|
|
20485
20682
|
_proto._calDefaultSize = function _calDefaultSize() {
|
|
20486
20683
|
if (this._texture) {
|
|
20487
20684
|
var _this = this, _texture = _this._texture, _atlasRegion = _this._atlasRegion, _atlasRegionOffset = _this._atlasRegionOffset, _region = _this._region;
|
|
20488
20685
|
var pixelsPerUnitReciprocal = 1.0 / Engine._pixelsPerUnit;
|
|
20489
|
-
this.
|
|
20490
|
-
this.
|
|
20686
|
+
this._automaticWidth = _texture.width * _atlasRegion.width / (1 - _atlasRegionOffset.x - _atlasRegionOffset.z) * _region.width * pixelsPerUnitReciprocal;
|
|
20687
|
+
this._automaticHeight = _texture.height * _atlasRegion.height / (1 - _atlasRegionOffset.y - _atlasRegionOffset.w) * _region.height * pixelsPerUnitReciprocal;
|
|
20688
|
+
} else {
|
|
20689
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
20491
20690
|
}
|
|
20691
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
20492
20692
|
};
|
|
20493
20693
|
_proto._updatePositions = function _updatePositions() {
|
|
20494
20694
|
var blank = this._atlasRegionOffset;
|
|
@@ -20542,11 +20742,16 @@ var TextVerticalAlignment;
|
|
|
20542
20742
|
};
|
|
20543
20743
|
_proto._dispatchSpriteChange = function _dispatchSpriteChange(type) {
|
|
20544
20744
|
switch(type){
|
|
20745
|
+
case SpriteModifyFlags.texture:
|
|
20746
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
20747
|
+
break;
|
|
20545
20748
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
20546
20749
|
case SpriteModifyFlags.region:
|
|
20547
|
-
this._dirtyUpdateFlag |=
|
|
20750
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
20548
20751
|
break;
|
|
20549
20752
|
case SpriteModifyFlags.atlasRegion:
|
|
20753
|
+
this._dirtyUpdateFlag |= 0x4 | 0x2;
|
|
20754
|
+
break;
|
|
20550
20755
|
case SpriteModifyFlags.border:
|
|
20551
20756
|
this._dirtyUpdateFlag |= 0x2;
|
|
20552
20757
|
break;
|
|
@@ -20565,7 +20770,9 @@ var TextVerticalAlignment;
|
|
|
20565
20770
|
if (this._texture !== value) {
|
|
20566
20771
|
this._texture = value;
|
|
20567
20772
|
this._dispatchSpriteChange(SpriteModifyFlags.texture);
|
|
20568
|
-
(this.
|
|
20773
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
20774
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
20775
|
+
}
|
|
20569
20776
|
}
|
|
20570
20777
|
}
|
|
20571
20778
|
},
|
|
@@ -20573,13 +20780,21 @@ var TextVerticalAlignment;
|
|
|
20573
20780
|
key: "width",
|
|
20574
20781
|
get: /**
|
|
20575
20782
|
* The width of the sprite (in world coordinates).
|
|
20783
|
+
*
|
|
20784
|
+
* @remarks
|
|
20785
|
+
* If width is set, return the set value,
|
|
20786
|
+
* otherwise return the width calculated according to `Texture.width`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
|
|
20576
20787
|
*/ function get() {
|
|
20577
|
-
this.
|
|
20578
|
-
|
|
20788
|
+
if (this._customWidth !== undefined) {
|
|
20789
|
+
return this._customWidth;
|
|
20790
|
+
} else {
|
|
20791
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
20792
|
+
return this._automaticWidth;
|
|
20793
|
+
}
|
|
20579
20794
|
},
|
|
20580
20795
|
set: function set(value) {
|
|
20581
|
-
if (this.
|
|
20582
|
-
this.
|
|
20796
|
+
if (this._customWidth !== value) {
|
|
20797
|
+
this._customWidth = value;
|
|
20583
20798
|
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
20584
20799
|
}
|
|
20585
20800
|
}
|
|
@@ -20588,13 +20803,21 @@ var TextVerticalAlignment;
|
|
|
20588
20803
|
key: "height",
|
|
20589
20804
|
get: /**
|
|
20590
20805
|
* The height of the sprite (in world coordinates).
|
|
20806
|
+
*
|
|
20807
|
+
* @remarks
|
|
20808
|
+
* If height is set, return the set value,
|
|
20809
|
+
* otherwise return the height calculated according to `Texture.height`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
|
|
20591
20810
|
*/ function get() {
|
|
20592
|
-
this.
|
|
20593
|
-
|
|
20811
|
+
if (this._customHeight !== undefined) {
|
|
20812
|
+
return this._customHeight;
|
|
20813
|
+
} else {
|
|
20814
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
20815
|
+
return this._automaticHeight;
|
|
20816
|
+
}
|
|
20594
20817
|
},
|
|
20595
20818
|
set: function set(value) {
|
|
20596
|
-
if (this.
|
|
20597
|
-
this.
|
|
20819
|
+
if (this._customHeight !== value) {
|
|
20820
|
+
this._customHeight = value;
|
|
20598
20821
|
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
20599
20822
|
}
|
|
20600
20823
|
}
|
|
@@ -20624,7 +20847,9 @@ var TextVerticalAlignment;
|
|
|
20624
20847
|
var y = MathUtil$1.clamp(value.y, 0, 1);
|
|
20625
20848
|
this._atlasRegion.set(x, y, MathUtil$1.clamp(value.width, 0, 1 - x), MathUtil$1.clamp(value.height, 0, 1 - y));
|
|
20626
20849
|
this._dispatchSpriteChange(SpriteModifyFlags.atlasRegion);
|
|
20627
|
-
(this.
|
|
20850
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
20851
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
20852
|
+
}
|
|
20628
20853
|
}
|
|
20629
20854
|
},
|
|
20630
20855
|
{
|
|
@@ -20639,7 +20864,9 @@ var TextVerticalAlignment;
|
|
|
20639
20864
|
var y = MathUtil$1.clamp(value.y, 0, 1);
|
|
20640
20865
|
this._atlasRegionOffset.set(x, y, MathUtil$1.clamp(value.z, 0, 1 - x), MathUtil$1.clamp(value.w, 0, 1 - y));
|
|
20641
20866
|
this._dispatchSpriteChange(SpriteModifyFlags.atlasRegionOffset);
|
|
20642
|
-
(this.
|
|
20867
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
20868
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
20869
|
+
}
|
|
20643
20870
|
}
|
|
20644
20871
|
},
|
|
20645
20872
|
{
|
|
@@ -20655,7 +20882,9 @@ var TextVerticalAlignment;
|
|
|
20655
20882
|
var y = MathUtil$1.clamp(value.y, 0, 1);
|
|
20656
20883
|
region.set(x, y, MathUtil$1.clamp(value.width, 0, 1 - x), MathUtil$1.clamp(value.height, 0, 1 - y));
|
|
20657
20884
|
this._dispatchSpriteChange(SpriteModifyFlags.region);
|
|
20658
|
-
(this.
|
|
20885
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
20886
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
20887
|
+
}
|
|
20659
20888
|
}
|
|
20660
20889
|
},
|
|
20661
20890
|
{
|
|
@@ -20705,7 +20934,8 @@ var SpriteUpdateFlags;
|
|
|
20705
20934
|
(function(SpriteUpdateFlags) {
|
|
20706
20935
|
SpriteUpdateFlags[SpriteUpdateFlags["positions"] = 0x1] = "positions";
|
|
20707
20936
|
SpriteUpdateFlags[SpriteUpdateFlags["uvs"] = 0x2] = "uvs";
|
|
20708
|
-
SpriteUpdateFlags[SpriteUpdateFlags["
|
|
20937
|
+
SpriteUpdateFlags[SpriteUpdateFlags["automaticSize"] = 0x4] = "automaticSize";
|
|
20938
|
+
SpriteUpdateFlags[SpriteUpdateFlags["all"] = 0x7] = "all";
|
|
20709
20939
|
})(SpriteUpdateFlags || (SpriteUpdateFlags = {}));
|
|
20710
20940
|
|
|
20711
20941
|
var _SlicedSpriteAssembler;
|
|
@@ -21197,8 +21427,10 @@ var TiledType;
|
|
|
21197
21427
|
_this._tiledAdaptiveThreshold = 0.5;
|
|
21198
21428
|
_this._color = new Color$1(1, 1, 1, 1);
|
|
21199
21429
|
_this._sprite = null;
|
|
21200
|
-
_this.
|
|
21201
|
-
_this.
|
|
21430
|
+
_this._automaticWidth = 0;
|
|
21431
|
+
_this._automaticHeight = 0;
|
|
21432
|
+
_this._customWidth = undefined;
|
|
21433
|
+
_this._customHeight = undefined;
|
|
21202
21434
|
_this._flipX = false;
|
|
21203
21435
|
_this._flipY = false;
|
|
21204
21436
|
_this._maskLayer = SpriteMaskLayer.Layer0;
|
|
@@ -21213,44 +21445,45 @@ var TiledType;
|
|
|
21213
21445
|
/**
|
|
21214
21446
|
* @internal
|
|
21215
21447
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
21448
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
21216
21449
|
target._assembler.resetData(target);
|
|
21217
21450
|
target.sprite = this._sprite;
|
|
21451
|
+
target.drawMode = this._drawMode;
|
|
21218
21452
|
};
|
|
21219
21453
|
/**
|
|
21220
|
-
* @
|
|
21454
|
+
* @internal
|
|
21221
21455
|
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
21222
21456
|
// @ts-ignore
|
|
21223
21457
|
this._updateTransformShaderData(context, Matrix._identity);
|
|
21224
21458
|
};
|
|
21225
21459
|
/**
|
|
21226
|
-
* @
|
|
21460
|
+
* @internal
|
|
21227
21461
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
21228
|
-
|
|
21229
|
-
|
|
21462
|
+
if (this.sprite) {
|
|
21463
|
+
this._assembler.updatePositions(this);
|
|
21464
|
+
} else {
|
|
21230
21465
|
worldBounds.min.set(0, 0, 0);
|
|
21231
21466
|
worldBounds.max.set(0, 0, 0);
|
|
21232
|
-
} else {
|
|
21233
|
-
this._assembler.updatePositions(this);
|
|
21234
21467
|
}
|
|
21235
21468
|
};
|
|
21236
21469
|
/**
|
|
21237
|
-
* @
|
|
21470
|
+
* @internal
|
|
21238
21471
|
*/ _proto._render = function _render(context) {
|
|
21239
21472
|
var _this_sprite;
|
|
21240
21473
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
21241
21474
|
return;
|
|
21242
21475
|
}
|
|
21243
|
-
// Update position
|
|
21476
|
+
// Update position
|
|
21244
21477
|
if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
|
|
21245
21478
|
this._assembler.updatePositions(this);
|
|
21246
21479
|
this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
|
|
21247
21480
|
}
|
|
21248
|
-
// Update uv
|
|
21481
|
+
// Update uv
|
|
21249
21482
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
21250
21483
|
this._assembler.updateUVs(this);
|
|
21251
21484
|
this._dirtyUpdateFlag &= ~0x2;
|
|
21252
21485
|
}
|
|
21253
|
-
// Push
|
|
21486
|
+
// Push primitive
|
|
21254
21487
|
var material = this.getMaterial();
|
|
21255
21488
|
var texture = this.sprite.texture;
|
|
21256
21489
|
var renderData = this._engine._spriteRenderDataPool.getFromPool();
|
|
@@ -21258,17 +21491,29 @@ var TiledType;
|
|
|
21258
21491
|
context.camera._renderPipeline.pushRenderData(context, renderData);
|
|
21259
21492
|
};
|
|
21260
21493
|
/**
|
|
21261
|
-
* @override
|
|
21262
21494
|
* @internal
|
|
21263
21495
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
21264
|
-
var _this__sprite;
|
|
21265
21496
|
Renderer.prototype._onDestroy.call(this);
|
|
21266
|
-
|
|
21497
|
+
var sprite = this._sprite;
|
|
21498
|
+
if (sprite) {
|
|
21499
|
+
sprite._addReferCount(-1);
|
|
21500
|
+
sprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
21501
|
+
}
|
|
21267
21502
|
this._color = null;
|
|
21268
21503
|
this._sprite = null;
|
|
21269
21504
|
this._assembler = null;
|
|
21270
21505
|
this._verticesData = null;
|
|
21271
21506
|
};
|
|
21507
|
+
_proto._calDefaultSize = function _calDefaultSize() {
|
|
21508
|
+
var sprite = this._sprite;
|
|
21509
|
+
if (sprite) {
|
|
21510
|
+
this._automaticWidth = sprite.width;
|
|
21511
|
+
this._automaticHeight = sprite.height;
|
|
21512
|
+
} else {
|
|
21513
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
21514
|
+
}
|
|
21515
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
21516
|
+
};
|
|
21272
21517
|
_proto._updateStencilState = function _updateStencilState() {
|
|
21273
21518
|
// Update stencil.
|
|
21274
21519
|
var material = this.getInstanceMaterial();
|
|
@@ -21295,22 +21540,21 @@ var TiledType;
|
|
|
21295
21540
|
break;
|
|
21296
21541
|
case SpriteModifyFlags.size:
|
|
21297
21542
|
var _this = this, drawMode = _this._drawMode;
|
|
21298
|
-
|
|
21543
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
21544
|
+
if (this._drawMode === SpriteDrawMode.Sliced) {
|
|
21299
21545
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
21300
21546
|
} else if (drawMode === SpriteDrawMode.Tiled) {
|
|
21301
21547
|
this._dirtyUpdateFlag |= 0x3;
|
|
21302
21548
|
} else {
|
|
21303
21549
|
// When the width and height of `SpriteRenderer` are `undefined`,
|
|
21304
21550
|
// the `size` of `Sprite` will affect the position of `SpriteRenderer`.
|
|
21305
|
-
if (this.
|
|
21551
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
21306
21552
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
21307
21553
|
}
|
|
21308
21554
|
}
|
|
21309
21555
|
break;
|
|
21310
21556
|
case SpriteModifyFlags.border:
|
|
21311
|
-
|
|
21312
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
21313
|
-
}
|
|
21557
|
+
this._drawMode === SpriteDrawMode.Sliced && (this._dirtyUpdateFlag |= 0x3);
|
|
21314
21558
|
break;
|
|
21315
21559
|
case SpriteModifyFlags.region:
|
|
21316
21560
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
@@ -21394,10 +21638,14 @@ var TiledType;
|
|
|
21394
21638
|
set: function set(value) {
|
|
21395
21639
|
var lastSprite = this._sprite;
|
|
21396
21640
|
if (lastSprite !== value) {
|
|
21397
|
-
|
|
21641
|
+
if (lastSprite) {
|
|
21642
|
+
lastSprite._addReferCount(-1);
|
|
21643
|
+
lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
21644
|
+
}
|
|
21645
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
21398
21646
|
if (value) {
|
|
21647
|
+
value._addReferCount(1);
|
|
21399
21648
|
value._updateFlagManager.addListener(this._onSpriteChange);
|
|
21400
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
21401
21649
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, value.texture);
|
|
21402
21650
|
} else {
|
|
21403
21651
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, null);
|
|
@@ -21422,16 +21670,22 @@ var TiledType;
|
|
|
21422
21670
|
{
|
|
21423
21671
|
key: "width",
|
|
21424
21672
|
get: /**
|
|
21425
|
-
* Render width.
|
|
21673
|
+
* Render width (in world coordinates).
|
|
21674
|
+
*
|
|
21675
|
+
* @remarks
|
|
21676
|
+
* If width is set, return the set value,
|
|
21677
|
+
* otherwise return `SpriteRenderer.sprite.width`.
|
|
21426
21678
|
*/ function get() {
|
|
21427
|
-
|
|
21428
|
-
|
|
21679
|
+
if (this._customWidth !== undefined) {
|
|
21680
|
+
return this._customWidth;
|
|
21681
|
+
} else {
|
|
21682
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
21683
|
+
return this._automaticWidth;
|
|
21684
|
+
}
|
|
21429
21685
|
},
|
|
21430
21686
|
set: function set(value) {
|
|
21431
|
-
|
|
21432
|
-
|
|
21433
|
-
if (this._width !== value) {
|
|
21434
|
-
this._width = value;
|
|
21687
|
+
if (this._customWidth !== value) {
|
|
21688
|
+
this._customWidth = value;
|
|
21435
21689
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
21436
21690
|
}
|
|
21437
21691
|
}
|
|
@@ -21439,16 +21693,22 @@ var TiledType;
|
|
|
21439
21693
|
{
|
|
21440
21694
|
key: "height",
|
|
21441
21695
|
get: /**
|
|
21442
|
-
* Render height.
|
|
21696
|
+
* Render height (in world coordinates).
|
|
21697
|
+
*
|
|
21698
|
+
* @remarks
|
|
21699
|
+
* If height is set, return the set value,
|
|
21700
|
+
* otherwise return `SpriteRenderer.sprite.height`.
|
|
21443
21701
|
*/ function get() {
|
|
21444
|
-
|
|
21445
|
-
|
|
21702
|
+
if (this._customHeight !== undefined) {
|
|
21703
|
+
return this._customHeight;
|
|
21704
|
+
} else {
|
|
21705
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
21706
|
+
return this._automaticHeight;
|
|
21707
|
+
}
|
|
21446
21708
|
},
|
|
21447
21709
|
set: function set(value) {
|
|
21448
|
-
|
|
21449
|
-
|
|
21450
|
-
if (this._height !== value) {
|
|
21451
|
-
this._height = value;
|
|
21710
|
+
if (this._customHeight !== value) {
|
|
21711
|
+
this._customHeight = value;
|
|
21452
21712
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
21453
21713
|
}
|
|
21454
21714
|
}
|
|
@@ -21535,10 +21795,16 @@ __decorate([
|
|
|
21535
21795
|
], SpriteRenderer.prototype, "_sprite", void 0);
|
|
21536
21796
|
__decorate([
|
|
21537
21797
|
ignoreClone
|
|
21538
|
-
], SpriteRenderer.prototype, "
|
|
21798
|
+
], SpriteRenderer.prototype, "_automaticWidth", void 0);
|
|
21539
21799
|
__decorate([
|
|
21540
21800
|
ignoreClone
|
|
21541
|
-
], SpriteRenderer.prototype, "
|
|
21801
|
+
], SpriteRenderer.prototype, "_automaticHeight", void 0);
|
|
21802
|
+
__decorate([
|
|
21803
|
+
assignmentClone
|
|
21804
|
+
], SpriteRenderer.prototype, "_customWidth", void 0);
|
|
21805
|
+
__decorate([
|
|
21806
|
+
assignmentClone
|
|
21807
|
+
], SpriteRenderer.prototype, "_customHeight", void 0);
|
|
21542
21808
|
__decorate([
|
|
21543
21809
|
assignmentClone
|
|
21544
21810
|
], SpriteRenderer.prototype, "_flipX", void 0);
|
|
@@ -21559,7 +21825,9 @@ var /**
|
|
|
21559
21825
|
*/ SpriteRendererUpdateFlags;
|
|
21560
21826
|
(function(SpriteRendererUpdateFlags) {
|
|
21561
21827
|
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
|
|
21562
|
-
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/**
|
|
21828
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
|
|
21829
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
|
|
21830
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** All. */ "All"] = 0x7] = "All";
|
|
21563
21831
|
})(SpriteRendererUpdateFlags || (SpriteRendererUpdateFlags = {}));
|
|
21564
21832
|
|
|
21565
21833
|
/**
|
|
@@ -21666,6 +21934,7 @@ var /**
|
|
|
21666
21934
|
/**
|
|
21667
21935
|
* @internal
|
|
21668
21936
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
21937
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
21669
21938
|
target.font = this._font;
|
|
21670
21939
|
target._subFont = this._subFont;
|
|
21671
21940
|
};
|
|
@@ -21685,18 +21954,18 @@ var /**
|
|
|
21685
21954
|
this._dirtyFlag &= ~type;
|
|
21686
21955
|
};
|
|
21687
21956
|
/**
|
|
21688
|
-
* @
|
|
21957
|
+
* @internal
|
|
21689
21958
|
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
21690
21959
|
// @ts-ignore
|
|
21691
21960
|
this._updateTransformShaderData(context, Matrix._identity);
|
|
21692
21961
|
};
|
|
21693
21962
|
/**
|
|
21694
|
-
* @
|
|
21963
|
+
* @internal
|
|
21695
21964
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
21696
21965
|
BoundingBox.transform(this._localBounds, this._entity.transform.worldMatrix, worldBounds);
|
|
21697
21966
|
};
|
|
21698
21967
|
/**
|
|
21699
|
-
* @
|
|
21968
|
+
* @internal
|
|
21700
21969
|
*/ _proto._render = function _render(context) {
|
|
21701
21970
|
if (this._text === "" || this.enableWrapping && this.width <= 0 || this.overflowMode === OverflowMode.Truncate && this.height <= 0) {
|
|
21702
21971
|
return;
|
|
@@ -21792,8 +22061,6 @@ var /**
|
|
|
21792
22061
|
_proto._updateLocalData = function _updateLocalData() {
|
|
21793
22062
|
var _this = this, color = _this.color, horizontalAlignment = _this.horizontalAlignment, verticalAlignment = _this.verticalAlignment, charRenderDatas = _this._charRenderDatas;
|
|
21794
22063
|
var _this__localBounds = this._localBounds, min = _this__localBounds.min, max = _this__localBounds.max;
|
|
21795
|
-
min.set(0, 0, 0);
|
|
21796
|
-
max.set(0, 0, 0);
|
|
21797
22064
|
var _pixelsPerUnit = Engine._pixelsPerUnit;
|
|
21798
22065
|
var pixelsPerUnitReciprocal = 1.0 / _pixelsPerUnit;
|
|
21799
22066
|
var charFont = this._subFont;
|
|
@@ -21820,54 +22087,65 @@ var /**
|
|
|
21820
22087
|
break;
|
|
21821
22088
|
}
|
|
21822
22089
|
var renderDataCount = 0;
|
|
22090
|
+
var firstLine = -1;
|
|
21823
22091
|
var minX = Number.MAX_SAFE_INTEGER;
|
|
21824
22092
|
var minY = Number.MAX_SAFE_INTEGER;
|
|
21825
22093
|
var maxX = Number.MIN_SAFE_INTEGER;
|
|
21826
22094
|
var maxY = Number.MIN_SAFE_INTEGER;
|
|
21827
|
-
var lastLineIndex = linesLen - 1;
|
|
21828
22095
|
for(var i = 0; i < linesLen; ++i){
|
|
21829
|
-
var line = lines[i];
|
|
21830
22096
|
var lineWidth = lineWidths[i];
|
|
21831
|
-
|
|
21832
|
-
|
|
21833
|
-
|
|
21834
|
-
|
|
21835
|
-
|
|
21836
|
-
|
|
21837
|
-
|
|
21838
|
-
|
|
21839
|
-
|
|
21840
|
-
|
|
21841
|
-
|
|
21842
|
-
|
|
21843
|
-
|
|
21844
|
-
|
|
21845
|
-
|
|
21846
|
-
|
|
21847
|
-
|
|
21848
|
-
|
|
21849
|
-
|
|
21850
|
-
|
|
21851
|
-
|
|
21852
|
-
|
|
21853
|
-
|
|
21854
|
-
|
|
21855
|
-
|
|
21856
|
-
|
|
21857
|
-
|
|
21858
|
-
|
|
21859
|
-
|
|
21860
|
-
|
|
21861
|
-
|
|
21862
|
-
|
|
21863
|
-
|
|
21864
|
-
|
|
21865
|
-
|
|
22097
|
+
if (lineWidth > 0) {
|
|
22098
|
+
var line = lines[i];
|
|
22099
|
+
var startX = 0;
|
|
22100
|
+
var firstRow = -1;
|
|
22101
|
+
if (firstLine < 0) {
|
|
22102
|
+
firstLine = i;
|
|
22103
|
+
}
|
|
22104
|
+
switch(horizontalAlignment){
|
|
22105
|
+
case TextHorizontalAlignment.Left:
|
|
22106
|
+
startX = -halfRendererWidth;
|
|
22107
|
+
break;
|
|
22108
|
+
case TextHorizontalAlignment.Center:
|
|
22109
|
+
startX = -lineWidth * 0.5;
|
|
22110
|
+
break;
|
|
22111
|
+
case TextHorizontalAlignment.Right:
|
|
22112
|
+
startX = halfRendererWidth - lineWidth;
|
|
22113
|
+
break;
|
|
22114
|
+
}
|
|
22115
|
+
for(var j = 0, n = line.length; j < n; ++j){
|
|
22116
|
+
var char = line[j];
|
|
22117
|
+
var charInfo = charFont._getCharInfo(char);
|
|
22118
|
+
if (charInfo.h > 0) {
|
|
22119
|
+
var _charRenderDatas, _ref;
|
|
22120
|
+
firstRow < 0 && (firstRow = j);
|
|
22121
|
+
var charRenderData = (_charRenderDatas = charRenderDatas)[_ref = renderDataCount++] || (_charRenderDatas[_ref] = charRenderDataPool.get());
|
|
22122
|
+
var renderData = charRenderData.renderData, localPositions = charRenderData.localPositions;
|
|
22123
|
+
charRenderData.texture = charFont._getTextureByIndex(charInfo.index);
|
|
22124
|
+
renderData.color = color;
|
|
22125
|
+
renderData.uvs = charInfo.uvs;
|
|
22126
|
+
var w = charInfo.w, ascent = charInfo.ascent, descent = charInfo.descent;
|
|
22127
|
+
var left = startX * pixelsPerUnitReciprocal;
|
|
22128
|
+
var right = (startX + w) * pixelsPerUnitReciprocal;
|
|
22129
|
+
var top = (startY + ascent) * pixelsPerUnitReciprocal;
|
|
22130
|
+
var bottom = (startY - descent + 1) * pixelsPerUnitReciprocal;
|
|
22131
|
+
localPositions.set(left, top, right, bottom);
|
|
22132
|
+
i === firstLine && (maxY = Math.max(maxY, top));
|
|
22133
|
+
minY = Math.min(minY, bottom);
|
|
22134
|
+
j === firstRow && (minX = Math.min(minX, left));
|
|
22135
|
+
maxX = Math.max(maxX, right);
|
|
22136
|
+
}
|
|
22137
|
+
startX += charInfo.xAdvance;
|
|
22138
|
+
}
|
|
21866
22139
|
}
|
|
21867
22140
|
startY -= lineHeight;
|
|
21868
22141
|
}
|
|
21869
|
-
|
|
21870
|
-
|
|
22142
|
+
if (firstLine < 0) {
|
|
22143
|
+
min.set(0, 0, 0);
|
|
22144
|
+
max.set(0, 0, 0);
|
|
22145
|
+
} else {
|
|
22146
|
+
min.set(minX, minY, 0);
|
|
22147
|
+
max.set(maxX, maxY, 0);
|
|
22148
|
+
}
|
|
21871
22149
|
// Revert excess render data to pool.
|
|
21872
22150
|
var lastRenderDataCount = charRenderDatas.length;
|
|
21873
22151
|
if (lastRenderDataCount > renderDataCount) {
|
|
@@ -21880,7 +22158,9 @@ var /**
|
|
|
21880
22158
|
return a.texture.instanceId - b.texture.instanceId;
|
|
21881
22159
|
});
|
|
21882
22160
|
};
|
|
21883
|
-
|
|
22161
|
+
/**
|
|
22162
|
+
* @internal
|
|
22163
|
+
*/ _proto._onTransformChanged = function _onTransformChanged(bit) {
|
|
21884
22164
|
Renderer.prototype._onTransformChanged.call(this, bit);
|
|
21885
22165
|
this._setDirtyFlagTrue(0x4 | 0x8);
|
|
21886
22166
|
};
|
|
@@ -22199,7 +22479,6 @@ var DirtyFlag;
|
|
|
22199
22479
|
* @internal
|
|
22200
22480
|
*/ var AnimationCurveOwner = /*#__PURE__*/ function() {
|
|
22201
22481
|
function AnimationCurveOwner(target, type, property, cureType) {
|
|
22202
|
-
this.crossCurveMark = 0;
|
|
22203
22482
|
this.hasSavedDefaultValue = false;
|
|
22204
22483
|
this.baseEvaluateData = {
|
|
22205
22484
|
curKeyframeIndex: 0,
|
|
@@ -22398,6 +22677,12 @@ AnimationCurveOwner.registerAssembler(Transform, "scale", ScaleAnimationCurveOwn
|
|
|
22398
22677
|
}();
|
|
22399
22678
|
AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights", BlendShapeWeightsAnimationCurveOwnerAssembler);
|
|
22400
22679
|
|
|
22680
|
+
/**
|
|
22681
|
+
* @internal
|
|
22682
|
+
*/ var AnimationCurveLayerOwner = function AnimationCurveLayerOwner() {
|
|
22683
|
+
this.crossCurveMark = 0;
|
|
22684
|
+
};
|
|
22685
|
+
|
|
22401
22686
|
/**
|
|
22402
22687
|
* Associate AnimationCurve and the Entity
|
|
22403
22688
|
*/ var AnimationClipCurveBinding = /*#__PURE__*/ function() {
|
|
@@ -22415,6 +22700,13 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
22415
22700
|
};
|
|
22416
22701
|
/**
|
|
22417
22702
|
* @internal
|
|
22703
|
+
*/ _proto._createCurveLayerOwner = function _createCurveLayerOwner(owner) {
|
|
22704
|
+
var layerOwner = new AnimationCurveLayerOwner();
|
|
22705
|
+
layerOwner.curveOwner = owner;
|
|
22706
|
+
return layerOwner;
|
|
22707
|
+
};
|
|
22708
|
+
/**
|
|
22709
|
+
* @internal
|
|
22418
22710
|
*/ _proto._getTempCurveOwner = function _getTempCurveOwner(entity) {
|
|
22419
22711
|
var instanceId = entity.instanceId;
|
|
22420
22712
|
if (!this._tempCurveOwner[instanceId]) {
|
|
@@ -22932,7 +23224,6 @@ var AnimationFloatArrayCurve = (_AnimationFloatArrayCurve = /*#__PURE__*/ functi
|
|
|
22932
23224
|
var _proto = AnimationFloatArrayCurve.prototype;
|
|
22933
23225
|
/**
|
|
22934
23226
|
* @inheritdoc
|
|
22935
|
-
* @override
|
|
22936
23227
|
*/ _proto.addKey = function addKey(key) {
|
|
22937
23228
|
AnimationCurve.prototype.addKey.call(this, key);
|
|
22938
23229
|
var evaluateData = this._evaluateData;
|
|
@@ -23570,12 +23861,14 @@ var AnimatorLayerBlendingMode;
|
|
|
23570
23861
|
* @internal
|
|
23571
23862
|
*/ var AnimatorLayerData = /*#__PURE__*/ function() {
|
|
23572
23863
|
function AnimatorLayerData() {
|
|
23864
|
+
this.curveOwnerPool = Object.create(null);
|
|
23573
23865
|
this.animatorStateDataMap = {};
|
|
23574
23866
|
this.srcPlayData = new AnimatorStatePlayData();
|
|
23575
23867
|
this.destPlayData = new AnimatorStatePlayData();
|
|
23576
23868
|
this.layerState = LayerState.Standby;
|
|
23577
23869
|
this.crossCurveMark = 0;
|
|
23578
23870
|
this.manuallyTransition = new AnimatorStateTransition();
|
|
23871
|
+
this.crossOwnerLayerDataCollection = [];
|
|
23579
23872
|
}
|
|
23580
23873
|
var _proto = AnimatorLayerData.prototype;
|
|
23581
23874
|
_proto.switchPlayData = function switchPlayData() {
|
|
@@ -23590,7 +23883,7 @@ var AnimatorLayerBlendingMode;
|
|
|
23590
23883
|
/**
|
|
23591
23884
|
* @internal
|
|
23592
23885
|
*/ var AnimatorStateData = function AnimatorStateData() {
|
|
23593
|
-
this.
|
|
23886
|
+
this.curveLayerOwner = [];
|
|
23594
23887
|
this.eventHandlers = [];
|
|
23595
23888
|
};
|
|
23596
23889
|
|
|
@@ -23604,8 +23897,7 @@ var AnimatorLayerBlendingMode;
|
|
|
23604
23897
|
/** Culling mode of this Animator. */ _this.cullingMode = AnimatorCullingMode.None;
|
|
23605
23898
|
/** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0;
|
|
23606
23899
|
_this._animatorLayersData = [];
|
|
23607
|
-
_this.
|
|
23608
|
-
_this._animationCurveOwners = [];
|
|
23900
|
+
_this._curveOwnerPool = Object.create(null);
|
|
23609
23901
|
_this._animationEventHandlerPool = new ClassPool(AnimationEventHandler);
|
|
23610
23902
|
_this._tempAnimatorStateInfo = {
|
|
23611
23903
|
layerIndex: -1,
|
|
@@ -23637,7 +23929,6 @@ var AnimatorLayerBlendingMode;
|
|
|
23637
23929
|
return;
|
|
23638
23930
|
}
|
|
23639
23931
|
var animatorLayerData = this._getAnimatorLayerData(stateInfo.layerIndex);
|
|
23640
|
-
//TODO CM: Not consider same stateName, but different animation
|
|
23641
23932
|
var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData);
|
|
23642
23933
|
this._preparePlay(animatorLayerData, state, animatorStateData);
|
|
23643
23934
|
animatorLayerData.layerState = LayerState.Playing;
|
|
@@ -23714,7 +24005,6 @@ var AnimatorLayerBlendingMode;
|
|
|
23714
24005
|
return this._getAnimatorStateInfo(stateName, layerIndex).state;
|
|
23715
24006
|
};
|
|
23716
24007
|
/**
|
|
23717
|
-
* @override
|
|
23718
24008
|
* @internal
|
|
23719
24009
|
*/ _proto._onEnable = function _onEnable() {
|
|
23720
24010
|
this.engine._componentsManager.addOnUpdateAnimations(this);
|
|
@@ -23722,7 +24012,6 @@ var AnimatorLayerBlendingMode;
|
|
|
23722
24012
|
this._entity.getComponentsIncludeChildren(Renderer, this._controlledRenderers);
|
|
23723
24013
|
};
|
|
23724
24014
|
/**
|
|
23725
|
-
* @override
|
|
23726
24015
|
* @internal
|
|
23727
24016
|
*/ _proto._onDisable = function _onDisable() {
|
|
23728
24017
|
this.engine._componentsManager.removeOnUpdateAnimations(this);
|
|
@@ -23730,7 +24019,7 @@ var AnimatorLayerBlendingMode;
|
|
|
23730
24019
|
/**
|
|
23731
24020
|
* @internal
|
|
23732
24021
|
*/ _proto._reset = function _reset() {
|
|
23733
|
-
var _this = this, animationCurveOwners = _this.
|
|
24022
|
+
var _this = this, animationCurveOwners = _this._curveOwnerPool;
|
|
23734
24023
|
for(var instanceId in animationCurveOwners){
|
|
23735
24024
|
var propertyOwners = animationCurveOwners[instanceId];
|
|
23736
24025
|
for(var property in propertyOwners){
|
|
@@ -23739,8 +24028,7 @@ var AnimatorLayerBlendingMode;
|
|
|
23739
24028
|
}
|
|
23740
24029
|
}
|
|
23741
24030
|
this._animatorLayersData.length = 0;
|
|
23742
|
-
this.
|
|
23743
|
-
this._animationCurveOwners.length = 0;
|
|
24031
|
+
this._curveOwnerPool = {};
|
|
23744
24032
|
this._animationEventHandlerPool.resetPool();
|
|
23745
24033
|
if (this._controllerUpdateFlag) {
|
|
23746
24034
|
this._controllerUpdateFlag.flag = false;
|
|
@@ -23768,10 +24056,10 @@ var AnimatorLayerBlendingMode;
|
|
|
23768
24056
|
return stateInfo;
|
|
23769
24057
|
};
|
|
23770
24058
|
_proto._saveDefaultValues = function _saveDefaultValues(stateData) {
|
|
23771
|
-
var
|
|
23772
|
-
for(var i =
|
|
23773
|
-
var
|
|
23774
|
-
(
|
|
24059
|
+
var curveLayerOwner = stateData.curveLayerOwner;
|
|
24060
|
+
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
24061
|
+
var _curveLayerOwner_i;
|
|
24062
|
+
(_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner.saveDefaultValue();
|
|
23775
24063
|
}
|
|
23776
24064
|
};
|
|
23777
24065
|
_proto._getAnimatorStateData = function _getAnimatorStateData(stateName, animatorState, animatorLayerData) {
|
|
@@ -23780,25 +24068,32 @@ var AnimatorLayerBlendingMode;
|
|
|
23780
24068
|
if (!animatorStateData) {
|
|
23781
24069
|
animatorStateData = new AnimatorStateData();
|
|
23782
24070
|
animatorStateDataMap[stateName] = animatorStateData;
|
|
23783
|
-
this._saveAnimatorStateData(animatorState, animatorStateData);
|
|
24071
|
+
this._saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData);
|
|
23784
24072
|
this._saveAnimatorEventHandlers(animatorState, animatorStateData);
|
|
23785
24073
|
}
|
|
23786
24074
|
return animatorStateData;
|
|
23787
24075
|
};
|
|
23788
|
-
_proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData) {
|
|
23789
|
-
var _this = this, entity = _this.entity,
|
|
23790
|
-
var
|
|
24076
|
+
_proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData) {
|
|
24077
|
+
var _this = this, entity = _this.entity, curveOwnerPool = _this._curveOwnerPool;
|
|
24078
|
+
var curveLayerOwner = animatorStateData.curveLayerOwner;
|
|
24079
|
+
var layerCurveOwnerPool = animatorLayerData.curveOwnerPool;
|
|
23791
24080
|
var _animatorState_clip = animatorState.clip, curves = _animatorState_clip._curveBindings;
|
|
23792
24081
|
for(var i = curves.length - 1; i >= 0; i--){
|
|
23793
24082
|
var curve = curves[i];
|
|
23794
24083
|
var targetEntity = curve.relativePath === "" ? entity : entity.findByPath(curve.relativePath);
|
|
23795
24084
|
if (targetEntity) {
|
|
24085
|
+
var _curveOwnerPool, _instanceId, _propertyOwners, _property, _layerCurveOwnerPool, _instanceId1, _layerPropertyOwners, _property1;
|
|
23796
24086
|
var property = curve.property;
|
|
23797
24087
|
var instanceId = targetEntity.instanceId;
|
|
23798
|
-
|
|
23799
|
-
|
|
24088
|
+
// Get owner
|
|
24089
|
+
var propertyOwners = (_curveOwnerPool = curveOwnerPool)[_instanceId = instanceId] || (_curveOwnerPool[_instanceId] = Object.create(null));
|
|
24090
|
+
var owner = (_propertyOwners = propertyOwners)[_property = property] || (_propertyOwners[_property] = curve._createCurveOwner(targetEntity));
|
|
24091
|
+
// Get layer owner
|
|
24092
|
+
var layerPropertyOwners = (_layerCurveOwnerPool = layerCurveOwnerPool)[_instanceId1 = instanceId] || (_layerCurveOwnerPool[_instanceId1] = Object.create(null));
|
|
24093
|
+
var layerOwner = (_layerPropertyOwners = layerPropertyOwners)[_property1 = property] || (_layerPropertyOwners[_property1] = curve._createCurveLayerOwner(owner));
|
|
24094
|
+
curveLayerOwner[i] = layerOwner;
|
|
23800
24095
|
} else {
|
|
23801
|
-
|
|
24096
|
+
curveLayerOwner[i] = null;
|
|
23802
24097
|
console.warn("The entity don't have the child entity which path is " + curve.relativePath + ".");
|
|
23803
24098
|
}
|
|
23804
24099
|
}
|
|
@@ -23826,65 +24121,61 @@ var AnimatorLayerBlendingMode;
|
|
|
23826
24121
|
};
|
|
23827
24122
|
_proto._clearCrossData = function _clearCrossData(animatorLayerData) {
|
|
23828
24123
|
animatorLayerData.crossCurveMark++;
|
|
23829
|
-
|
|
24124
|
+
animatorLayerData.crossOwnerLayerDataCollection.length = 0;
|
|
23830
24125
|
};
|
|
23831
|
-
_proto.
|
|
23832
|
-
|
|
23833
|
-
|
|
23834
|
-
|
|
24126
|
+
_proto._addCrossOwner = function _addCrossOwner(animatorLayerData, layerOwner, curCurveIndex, nextCurveIndex) {
|
|
24127
|
+
layerOwner.crossSrcCurveIndex = curCurveIndex;
|
|
24128
|
+
layerOwner.crossDestCurveIndex = nextCurveIndex;
|
|
24129
|
+
animatorLayerData.crossOwnerLayerDataCollection.push(layerOwner);
|
|
23835
24130
|
};
|
|
23836
24131
|
_proto._prepareCrossFading = function _prepareCrossFading(animatorLayerData) {
|
|
23837
|
-
var crossCurveData = this._crossOwnerCollection;
|
|
23838
|
-
var crossCurveMark = animatorLayerData.crossCurveMark;
|
|
23839
24132
|
// Add src cross curve data.
|
|
23840
|
-
this._prepareSrcCrossData(
|
|
24133
|
+
this._prepareSrcCrossData(animatorLayerData, false);
|
|
23841
24134
|
// Add dest cross curve data.
|
|
23842
|
-
this._prepareDestCrossData(
|
|
24135
|
+
this._prepareDestCrossData(animatorLayerData, false);
|
|
23843
24136
|
};
|
|
23844
24137
|
_proto._prepareStandbyCrossFading = function _prepareStandbyCrossFading(animatorLayerData) {
|
|
23845
|
-
var crossOwnerCollection = this._crossOwnerCollection;
|
|
23846
|
-
var srcPlayData = animatorLayerData.srcPlayData, crossCurveMark = animatorLayerData.crossCurveMark;
|
|
23847
24138
|
// Standby have two sub state, one is never play, one is finished, never play srcPlayData.state is null.
|
|
23848
|
-
srcPlayData.state && this._prepareSrcCrossData(
|
|
24139
|
+
animatorLayerData.srcPlayData.state && this._prepareSrcCrossData(animatorLayerData, true);
|
|
23849
24140
|
// Add dest cross curve data.
|
|
23850
|
-
this._prepareDestCrossData(
|
|
24141
|
+
this._prepareDestCrossData(animatorLayerData, true);
|
|
23851
24142
|
};
|
|
23852
24143
|
_proto._prepareFixedPoseCrossFading = function _prepareFixedPoseCrossFading(animatorLayerData) {
|
|
23853
|
-
var
|
|
24144
|
+
var crossOwnerLayerDataCollection = animatorLayerData.crossOwnerLayerDataCollection;
|
|
23854
24145
|
// Save current cross curve data owner fixed pose.
|
|
23855
|
-
for(var i =
|
|
23856
|
-
var
|
|
23857
|
-
|
|
24146
|
+
for(var i = crossOwnerLayerDataCollection.length - 1; i >= 0; i--){
|
|
24147
|
+
var layerOwner = crossOwnerLayerDataCollection[i];
|
|
24148
|
+
if (!layerOwner) continue;
|
|
24149
|
+
layerOwner.curveOwner.saveFixedPoseValue();
|
|
23858
24150
|
// Reset destCurveIndex When fixed pose crossFading again.
|
|
23859
|
-
|
|
24151
|
+
layerOwner.crossDestCurveIndex = -1;
|
|
23860
24152
|
}
|
|
23861
24153
|
// prepare dest AnimatorState cross data.
|
|
23862
|
-
this._prepareDestCrossData(
|
|
23863
|
-
};
|
|
23864
|
-
_proto._prepareSrcCrossData = function _prepareSrcCrossData(
|
|
23865
|
-
var
|
|
23866
|
-
for(var i =
|
|
23867
|
-
var
|
|
23868
|
-
if (!
|
|
23869
|
-
|
|
23870
|
-
|
|
23871
|
-
|
|
23872
|
-
|
|
23873
|
-
|
|
23874
|
-
|
|
23875
|
-
|
|
23876
|
-
var
|
|
23877
|
-
|
|
23878
|
-
|
|
23879
|
-
if (
|
|
23880
|
-
|
|
23881
|
-
crossCurveData[owner.crossCurveDataIndex].crossDestCurveIndex = i;
|
|
24154
|
+
this._prepareDestCrossData(animatorLayerData, true);
|
|
24155
|
+
};
|
|
24156
|
+
_proto._prepareSrcCrossData = function _prepareSrcCrossData(animatorLayerData, saveFixed) {
|
|
24157
|
+
var curveLayerOwner = animatorLayerData.srcPlayData.stateData.curveLayerOwner;
|
|
24158
|
+
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
24159
|
+
var layerOwner = curveLayerOwner[i];
|
|
24160
|
+
if (!layerOwner) continue;
|
|
24161
|
+
layerOwner.crossCurveMark = animatorLayerData.crossCurveMark;
|
|
24162
|
+
saveFixed && layerOwner.curveOwner.saveFixedPoseValue();
|
|
24163
|
+
this._addCrossOwner(animatorLayerData, layerOwner, i, -1);
|
|
24164
|
+
}
|
|
24165
|
+
};
|
|
24166
|
+
_proto._prepareDestCrossData = function _prepareDestCrossData(animatorLayerData, saveFixed) {
|
|
24167
|
+
var curveLayerOwner = animatorLayerData.destPlayData.stateData.curveLayerOwner;
|
|
24168
|
+
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
24169
|
+
var layerOwner = curveLayerOwner[i];
|
|
24170
|
+
if (!layerOwner) continue;
|
|
24171
|
+
if (layerOwner.crossCurveMark === animatorLayerData.crossCurveMark) {
|
|
24172
|
+
layerOwner.crossDestCurveIndex = i;
|
|
23882
24173
|
} else {
|
|
24174
|
+
var owner = layerOwner.curveOwner;
|
|
23883
24175
|
owner.saveDefaultValue();
|
|
23884
24176
|
saveFixed && owner.saveFixedPoseValue();
|
|
23885
|
-
|
|
23886
|
-
|
|
23887
|
-
this._addCrossCurveData(crossCurveData, owner, -1, i);
|
|
24177
|
+
layerOwner.crossCurveMark = animatorLayerData.crossCurveMark;
|
|
24178
|
+
this._addCrossOwner(animatorLayerData, layerOwner, -1, i);
|
|
23888
24179
|
}
|
|
23889
24180
|
}
|
|
23890
24181
|
};
|
|
@@ -23914,7 +24205,7 @@ var AnimatorLayerBlendingMode;
|
|
|
23914
24205
|
}
|
|
23915
24206
|
};
|
|
23916
24207
|
_proto._updatePlayingState = function _updatePlayingState(playData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
23917
|
-
var _playData_stateData = playData.stateData,
|
|
24208
|
+
var _playData_stateData = playData.stateData, curveLayerOwner = _playData_stateData.curveLayerOwner, eventHandlers = _playData_stateData.eventHandlers;
|
|
23918
24209
|
var state = playData.state, lastPlayState = playData.playState, lastClipTime = playData.clipTime;
|
|
23919
24210
|
var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
|
|
23920
24211
|
playData.update(this.speed < 0);
|
|
@@ -23924,8 +24215,8 @@ var AnimatorLayerBlendingMode;
|
|
|
23924
24215
|
var clipTime = playData.clipTime, playState = playData.playState;
|
|
23925
24216
|
eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, clipTime);
|
|
23926
24217
|
for(var i = curveBindings.length - 1; i >= 0; i--){
|
|
23927
|
-
var
|
|
23928
|
-
|
|
24218
|
+
var _curveLayerOwner_i;
|
|
24219
|
+
(_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner.evaluateAndApplyValue(curveBindings[i].curve, clipTime, weight, additive);
|
|
23929
24220
|
}
|
|
23930
24221
|
playData.frameTime += state.speed * delta;
|
|
23931
24222
|
if (playState === AnimatorStatePlayState.Finished) {
|
|
@@ -23941,7 +24232,7 @@ var AnimatorLayerBlendingMode;
|
|
|
23941
24232
|
}
|
|
23942
24233
|
};
|
|
23943
24234
|
_proto._updateCrossFade = function _updateCrossFade(srcPlayData, destPlayData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
23944
|
-
var
|
|
24235
|
+
var crossOwnerLayerDataCollection = layerData.crossOwnerLayerDataCollection;
|
|
23945
24236
|
var _srcPlayData_state_clip = srcPlayData.state.clip, srcCurves = _srcPlayData_state_clip._curveBindings;
|
|
23946
24237
|
var srcState = srcPlayData.state, srcStateData = srcPlayData.stateData, lastSrcPlayState = srcPlayData.playState;
|
|
23947
24238
|
var srcEventHandlers = srcStateData.eventHandlers;
|
|
@@ -23980,14 +24271,16 @@ var AnimatorLayerBlendingMode;
|
|
|
23980
24271
|
} else {
|
|
23981
24272
|
this._callAnimatorScriptOnUpdate(destState, layerIndex);
|
|
23982
24273
|
}
|
|
23983
|
-
for(var i =
|
|
23984
|
-
var
|
|
23985
|
-
|
|
23986
|
-
|
|
24274
|
+
for(var i = crossOwnerLayerDataCollection.length - 1; i >= 0; i--){
|
|
24275
|
+
var layerOwner = crossOwnerLayerDataCollection[i];
|
|
24276
|
+
if (!layerOwner) continue;
|
|
24277
|
+
var srcCurveIndex = layerOwner.crossSrcCurveIndex;
|
|
24278
|
+
var destCurveIndex = layerOwner.crossDestCurveIndex;
|
|
24279
|
+
layerOwner.curveOwner.crossFadeAndApplyValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, weight, additive);
|
|
23987
24280
|
}
|
|
23988
24281
|
};
|
|
23989
24282
|
_proto._updateCrossFadeFromPose = function _updateCrossFadeFromPose(destPlayData, layerData, layerIndex, layerWeight, delta, additive, aniUpdate) {
|
|
23990
|
-
var
|
|
24283
|
+
var crossOwnerLayerDataCollection = layerData.crossOwnerLayerDataCollection;
|
|
23991
24284
|
var state = destPlayData.state, stateData = destPlayData.stateData, lastPlayState = destPlayData.playState;
|
|
23992
24285
|
var eventHandlers = stateData.eventHandlers;
|
|
23993
24286
|
var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
|
|
@@ -24011,10 +24304,11 @@ var AnimatorLayerBlendingMode;
|
|
|
24011
24304
|
} else {
|
|
24012
24305
|
this._callAnimatorScriptOnUpdate(state, layerIndex);
|
|
24013
24306
|
}
|
|
24014
|
-
for(var i =
|
|
24015
|
-
var
|
|
24016
|
-
|
|
24017
|
-
|
|
24307
|
+
for(var i = crossOwnerLayerDataCollection.length - 1; i >= 0; i--){
|
|
24308
|
+
var layerOwner = crossOwnerLayerDataCollection[i];
|
|
24309
|
+
if (!layerOwner) continue;
|
|
24310
|
+
var curveIndex = layerOwner.crossDestCurveIndex;
|
|
24311
|
+
layerOwner.curveOwner.crossFadeFromPoseAndApplyValue(curveIndex >= 0 ? curveBindings[curveIndex].curve : null, destClipTime, crossWeight, layerWeight, additive);
|
|
24018
24312
|
}
|
|
24019
24313
|
};
|
|
24020
24314
|
_proto._updateCrossFadeData = function _updateCrossFadeData(layerData, crossWeight, delta, fixed) {
|
|
@@ -24036,18 +24330,19 @@ var AnimatorLayerBlendingMode;
|
|
|
24036
24330
|
if (layerData.layerState === LayerState.Playing) {
|
|
24037
24331
|
var srcPlayData = layerData.srcPlayData;
|
|
24038
24332
|
if (srcPlayData.state !== playState) {
|
|
24039
|
-
var
|
|
24040
|
-
for(var i =
|
|
24041
|
-
var
|
|
24333
|
+
var curveLayerOwner = srcPlayData.stateData.curveLayerOwner;
|
|
24334
|
+
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
24335
|
+
var _curveLayerOwner_i;
|
|
24336
|
+
var owner = (_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner;
|
|
24042
24337
|
(owner == null ? void 0 : owner.hasSavedDefaultValue) && owner.revertDefaultValue();
|
|
24043
24338
|
}
|
|
24044
24339
|
this._saveDefaultValues(playStateData);
|
|
24045
24340
|
}
|
|
24046
24341
|
} else {
|
|
24047
24342
|
// layerState is CrossFading, FixedCrossFading, Standby
|
|
24048
|
-
var
|
|
24049
|
-
for(var i1 =
|
|
24050
|
-
var owner1 =
|
|
24343
|
+
var crossOwnerLayerDataCollection = layerData.crossOwnerLayerDataCollection;
|
|
24344
|
+
for(var i1 = crossOwnerLayerDataCollection.length - 1; i1 >= 0; i1--){
|
|
24345
|
+
var owner1 = crossOwnerLayerDataCollection[i1].curveOwner;
|
|
24051
24346
|
owner1.hasSavedDefaultValue && owner1.revertDefaultValue();
|
|
24052
24347
|
}
|
|
24053
24348
|
this._saveDefaultValues(playStateData);
|
|
@@ -24217,10 +24512,7 @@ __decorate([
|
|
|
24217
24512
|
], Animator.prototype, "_animatorLayersData", void 0);
|
|
24218
24513
|
__decorate([
|
|
24219
24514
|
ignoreClone
|
|
24220
|
-
], Animator.prototype, "
|
|
24221
|
-
__decorate([
|
|
24222
|
-
ignoreClone
|
|
24223
|
-
], Animator.prototype, "_animationCurveOwners", void 0);
|
|
24515
|
+
], Animator.prototype, "_curveOwnerPool", void 0);
|
|
24224
24516
|
__decorate([
|
|
24225
24517
|
ignoreClone
|
|
24226
24518
|
], Animator.prototype, "_animationEventHandlerPool", void 0);
|
|
@@ -24547,9 +24839,7 @@ var AnimatorConditionMode;
|
|
|
24547
24839
|
return _this;
|
|
24548
24840
|
}
|
|
24549
24841
|
var _proto = SkyBoxMaterial.prototype;
|
|
24550
|
-
|
|
24551
|
-
* @override
|
|
24552
|
-
*/ _proto.clone = function clone() {
|
|
24842
|
+
_proto.clone = function clone() {
|
|
24553
24843
|
var dest = new SkyBoxMaterial(this._engine);
|
|
24554
24844
|
this.cloneTo(dest);
|
|
24555
24845
|
return dest;
|
|
@@ -24662,7 +24952,7 @@ var SunMode;
|
|
|
24662
24952
|
}
|
|
24663
24953
|
var _proto = SkyProceduralMaterial.prototype;
|
|
24664
24954
|
/**
|
|
24665
|
-
* @
|
|
24955
|
+
* @inheritDoc
|
|
24666
24956
|
*/ _proto.clone = function clone() {
|
|
24667
24957
|
var dest = new SkyProceduralMaterial(this._engine);
|
|
24668
24958
|
this.cloneTo(dest);
|
|
@@ -24860,7 +25150,6 @@ var ParticleRendererBlendMode;
|
|
|
24860
25150
|
}
|
|
24861
25151
|
var _proto = ParticleRenderer.prototype;
|
|
24862
25152
|
/**
|
|
24863
|
-
* @override
|
|
24864
25153
|
* @internal
|
|
24865
25154
|
*/ _proto.update = function update(deltaTime) {
|
|
24866
25155
|
if (!this._isInit || !this._isStart) {
|
|
@@ -24878,7 +25167,6 @@ var ParticleRendererBlendMode;
|
|
|
24878
25167
|
this.shaderData.setFloat("u_time", this._time);
|
|
24879
25168
|
};
|
|
24880
25169
|
/**
|
|
24881
|
-
* @override
|
|
24882
25170
|
* @internal
|
|
24883
25171
|
*/ _proto._onEnable = function _onEnable() {
|
|
24884
25172
|
MeshRenderer.prototype._onEnable.call(this);
|
|
@@ -25658,7 +25946,7 @@ var _tempVector3 = new Vector3();
|
|
|
25658
25946
|
}
|
|
25659
25947
|
};
|
|
25660
25948
|
/**
|
|
25661
|
-
* @
|
|
25949
|
+
* @internal
|
|
25662
25950
|
*/ _proto._render = function _render(context) {
|
|
25663
25951
|
this._updateStrapVertices(context.camera, this._points);
|
|
25664
25952
|
this._updateStrapCoords();
|
|
@@ -25805,9 +26093,7 @@ var _tempVector3 = new Vector3();
|
|
|
25805
26093
|
* Provide hooks for users to exchange Texture.
|
|
25806
26094
|
* @remarks Prevent issue: Feedback Loops Between Textures and the Framebuffer.
|
|
25807
26095
|
*/ _proto.onTextureChange = function onTextureChange(renderColorTexture) {};
|
|
25808
|
-
|
|
25809
|
-
* @override
|
|
25810
|
-
*/ _proto.onBeginRender = function onBeginRender(camera) {
|
|
26096
|
+
_proto.onBeginRender = function onBeginRender(camera) {
|
|
25811
26097
|
if (!this.enabled) return;
|
|
25812
26098
|
this._camera = camera;
|
|
25813
26099
|
this._oriCameraCullingMask = camera.cullingMask;
|
|
@@ -25820,9 +26106,7 @@ var _tempVector3 = new Vector3();
|
|
|
25820
26106
|
this._oriCameraRenderTarget = camera.renderTarget;
|
|
25821
26107
|
camera.renderTarget = this._activeRenderTarget;
|
|
25822
26108
|
};
|
|
25823
|
-
|
|
25824
|
-
* @override
|
|
25825
|
-
*/ _proto.onEndRender = function onEndRender(camera) {
|
|
26109
|
+
_proto.onEndRender = function onEndRender(camera) {
|
|
25826
26110
|
if (!this.enabled) return;
|
|
25827
26111
|
this.onTextureChange && this.onTextureChange(this._texture);
|
|
25828
26112
|
this._activeRenderTarget = this._activeRenderTarget === this._renderTarget ? this._renderTargetSwap : this._renderTarget;
|
|
@@ -25857,16 +26141,12 @@ var cacheDir = new Vector3();
|
|
|
25857
26141
|
/**
|
|
25858
26142
|
* The position of the probe can be set, the default is the origin [0,0,0].
|
|
25859
26143
|
*/ _this.position = new Vector3(0, 0, 0);
|
|
25860
|
-
/**
|
|
25861
|
-
* @override
|
|
25862
|
-
*/ _this._isCube = true;
|
|
26144
|
+
/** @internal */ _this._isCube = true;
|
|
25863
26145
|
_this.oriViewMatrix = new Matrix();
|
|
25864
26146
|
return _this;
|
|
25865
26147
|
}
|
|
25866
26148
|
var _proto = CubeProbe.prototype;
|
|
25867
|
-
|
|
25868
|
-
* @override
|
|
25869
|
-
*/ _proto.onBeginRender = function onBeginRender(camera) {
|
|
26149
|
+
_proto.onBeginRender = function onBeginRender(camera) {
|
|
25870
26150
|
if (!this.enabled) return;
|
|
25871
26151
|
Probe.prototype.onBeginRender.call(this, camera);
|
|
25872
26152
|
this._storeCamera(camera);
|
|
@@ -25933,5 +26213,5 @@ var cacheDir = new Vector3();
|
|
|
25933
26213
|
return CubeProbe;
|
|
25934
26214
|
}(Probe);
|
|
25935
26215
|
|
|
25936
|
-
export { AmbientLight, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorState, AnimatorStateMachine, AnimatorStateTransition, AssetPromise, AssetType, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, Basic2DBatcher, BasicRenderPipeline, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlinnPhongMaterial, BoolUpdateFlag, BoxColliderShape, Buffer, BufferBindFlag, BufferMesh, BufferUsage, BufferUtil, Camera, CameraClearFlags, CapsuleColliderShape, CharacterController, CloneManager, Collider, ColliderShape, ColliderShapeUpAxis, CollisionDetectionMode, ColorSpace, ColorWriteMask, CompareFunction, Component, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, DataType, DependentMode, DiffuseMode, DirectLight, DynamicCollider, DynamicColliderConstraints, Engine, EngineObject, Entity, EventDispatcher, FixedJoint, FogMode, Font, FontStyle, GLCapabilityType, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolationType, Joint, JointLimits, JointMotor, Keyframe, Keys, Layer, Light, Loader, Logger, Material, Mesh, MeshRenderer, MeshTopology, ModelMesh, OverflowMode, PBRBaseMaterial, PBRMaterial, PBRSpecularMaterial, ParticleRenderer, ParticleRendererBlendMode, PhysicsManager, PhysicsMaterial, PhysicsMaterialCombineMode, PipelineStage, PlaneColliderShape, Platform, PointLight, Pointer, PointerButton, PointerPhase, PrimitiveMesh, Probe, ReferResource, RenderBufferDepthFormat, RenderFace, RenderPass, RenderQueue, RenderQueueType, RenderTarget, Renderer, ResourceManager, Scene, SceneManager, Script, SetDataOptions, Shader, ShaderData, ShaderFactory, ShaderMacro, ShaderMacroCollection, ShaderPass, ShaderProperty, ShaderPropertyType, ShaderTagKey, ShadowCascadesMode, ShadowResolution, ShadowType, Skin, SkinnedMeshRenderer, Sky, SkyBoxMaterial, SkyProceduralMaterial, SphereColliderShape, SpotLight, SpringJoint, Sprite, SpriteAtlas, SpriteDrawMode, SpriteMask, SpriteMaskInteraction, SpriteMaskLayer, SpriteRenderer, SpriteTileMode, StateMachineScript, StaticCollider, StencilOperation, SubMesh, SubShader, SunMode, SystemInfo, TextHorizontalAlignment, TextRenderer, TextUtils, TextVerticalAlignment, Texture, Texture2D, Texture2DArray, TextureCoordinate, TextureCube, TextureCubeFace, TextureDepthCompareFunction, TextureFilterMode, TextureFormat, TextureWrapMode, Time, TrailMaterial, TrailRenderer, Transform, UnlitMaterial, Utils, VertexBufferBinding, VertexElement, VertexElementFormat, WrapMode, assignmentClone, deepClone, dependentComponents, ignoreClone, request, resourceLoader, shallowClone };
|
|
26216
|
+
export { AmbientLight, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorState, AnimatorStateMachine, AnimatorStateTransition, AssetPromise, AssetType, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, Basic2DBatcher, BasicRenderPipeline, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlendState, BlinnPhongMaterial, BoolUpdateFlag, BoxColliderShape, Buffer, BufferBindFlag, BufferMesh, BufferUsage, BufferUtil, Camera, CameraClearFlags, CapsuleColliderShape, CharacterController, CloneManager, Collider, ColliderShape, ColliderShapeUpAxis, CollisionDetectionMode, ColorSpace, ColorWriteMask, CompareFunction, Component, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, DataType, DependentMode, DepthState, DiffuseMode, DirectLight, DynamicCollider, DynamicColliderConstraints, Engine, EngineObject, Entity, EventDispatcher, FixedJoint, FogMode, Font, FontStyle, GLCapabilityType, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolationType, Joint, JointLimits, JointMotor, Keyframe, Keys, Layer, Light, Loader, Logger, Material, Mesh, MeshRenderer, MeshTopology, ModelMesh, OverflowMode, PBRBaseMaterial, PBRMaterial, PBRSpecularMaterial, ParticleRenderer, ParticleRendererBlendMode, PhysicsManager, PhysicsMaterial, PhysicsMaterialCombineMode, PipelineStage, PlaneColliderShape, Platform, PointLight, Pointer, PointerButton, PointerPhase, PrimitiveMesh, Probe, RasterState, ReferResource, RenderBufferDepthFormat, RenderFace, RenderPass, RenderQueue, RenderQueueType, RenderState, RenderTarget, RenderTargetBlendState, Renderer, ResourceManager, Scene, SceneManager, Script, SetDataOptions, Shader, ShaderData, ShaderFactory, ShaderMacro, ShaderMacroCollection, ShaderPass, ShaderProperty, ShaderPropertyType, ShaderTagKey, ShadowCascadesMode, ShadowResolution, ShadowType, Skin, SkinnedMeshRenderer, Sky, SkyBoxMaterial, SkyProceduralMaterial, SphereColliderShape, SpotLight, SpringJoint, Sprite, SpriteAtlas, SpriteDrawMode, SpriteMask, SpriteMaskInteraction, SpriteMaskLayer, SpriteRenderer, SpriteTileMode, StateMachineScript, StaticCollider, StencilOperation, StencilState, SubMesh, SubShader, SunMode, SystemInfo, TextHorizontalAlignment, TextRenderer, TextUtils, TextVerticalAlignment, Texture, Texture2D, Texture2DArray, TextureCoordinate, TextureCube, TextureCubeFace, TextureDepthCompareFunction, TextureFilterMode, TextureFormat, TextureWrapMode, Time, TrailMaterial, TrailRenderer, Transform, UnlitMaterial, Utils, VertexBufferBinding, VertexElement, VertexElementFormat, WrapMode, assignmentClone, deepClone, dependentComponents, ignoreClone, request, resourceLoader, shallowClone };
|
|
25937
26217
|
//# sourceMappingURL=module.js.map
|