@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/main.js
CHANGED
|
@@ -656,7 +656,6 @@ __decorate([
|
|
|
656
656
|
}
|
|
657
657
|
var _proto = ReferResource.prototype;
|
|
658
658
|
/**
|
|
659
|
-
* @override
|
|
660
659
|
* Destroy self.
|
|
661
660
|
* @param force - Whether to force the destruction, if it is false, refCount = 0 can be released successfully.
|
|
662
661
|
* @returns Whether the release was successful.
|
|
@@ -684,7 +683,7 @@ __decorate([
|
|
|
684
683
|
this._engine.resourceManager._addAsset(path, this);
|
|
685
684
|
};
|
|
686
685
|
/**
|
|
687
|
-
* @
|
|
686
|
+
* @internal
|
|
688
687
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
689
688
|
EngineObject.prototype._onDestroy.call(this);
|
|
690
689
|
this._engine.resourceManager._deleteReferResource(this);
|
|
@@ -818,7 +817,7 @@ var GraphicsResource = /*#__PURE__*/ function(ReferResource) {
|
|
|
818
817
|
}
|
|
819
818
|
var _proto = GraphicsResource.prototype;
|
|
820
819
|
/**
|
|
821
|
-
* @
|
|
820
|
+
* @internal
|
|
822
821
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
823
822
|
ReferResource.prototype._onDestroy.call(this);
|
|
824
823
|
this.engine.resourceManager._deleteGraphicResource(this);
|
|
@@ -888,7 +887,6 @@ var Logger = {
|
|
|
888
887
|
}
|
|
889
888
|
};
|
|
890
889
|
/**
|
|
891
|
-
* @override
|
|
892
890
|
* @internal
|
|
893
891
|
*/ _proto._rebuild = function _rebuild() {
|
|
894
892
|
var platformTexture = this._platformTexture;
|
|
@@ -900,7 +898,6 @@ var Logger = {
|
|
|
900
898
|
platformTexture.setUseDepthCompareMode(this._useDepthCompareMode);
|
|
901
899
|
};
|
|
902
900
|
/**
|
|
903
|
-
* @override
|
|
904
901
|
* @internal
|
|
905
902
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
906
903
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
@@ -1052,9 +1049,11 @@ var Logger = {
|
|
|
1052
1049
|
renderTexture
|
|
1053
1050
|
];
|
|
1054
1051
|
for(var i = 0, n = colorTextures.length; i < n; i++){
|
|
1055
|
-
|
|
1052
|
+
var colorTexture = colorTextures[i];
|
|
1053
|
+
if (colorTexture._isDepthTexture) {
|
|
1056
1054
|
throw "Render texture can't use depth format.";
|
|
1057
1055
|
}
|
|
1056
|
+
colorTexture._addReferCount(1);
|
|
1058
1057
|
}
|
|
1059
1058
|
_this._colorTextures = colorTextures;
|
|
1060
1059
|
} else {
|
|
@@ -1065,6 +1064,7 @@ var Logger = {
|
|
|
1065
1064
|
throw "Depth texture must use depth format.";
|
|
1066
1065
|
}
|
|
1067
1066
|
_this._depthTexture = depth;
|
|
1067
|
+
_this._depthTexture._addReferCount(1);
|
|
1068
1068
|
}
|
|
1069
1069
|
_this._platformRenderTarget = engine._hardwareRenderer.createPlatformRenderTarget(_assert_this_initialized(_this));
|
|
1070
1070
|
return _this;
|
|
@@ -1091,11 +1091,17 @@ var Logger = {
|
|
|
1091
1091
|
}
|
|
1092
1092
|
};
|
|
1093
1093
|
/**
|
|
1094
|
-
* @
|
|
1094
|
+
* @internal
|
|
1095
1095
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
1096
|
+
var _this__depthTexture;
|
|
1096
1097
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
1097
1098
|
this._platformRenderTarget.destroy();
|
|
1098
|
-
this
|
|
1099
|
+
var _this = this, colorTextures = _this._colorTextures;
|
|
1100
|
+
for(var i = 0, n = colorTextures.length; i < n; i++){
|
|
1101
|
+
colorTextures[i]._addReferCount(-1);
|
|
1102
|
+
}
|
|
1103
|
+
colorTextures.length = 0;
|
|
1104
|
+
(_this__depthTexture = this._depthTexture) == null ? void 0 : _this__depthTexture._addReferCount(-1);
|
|
1099
1105
|
this._depthTexture = null;
|
|
1100
1106
|
this._depth = null;
|
|
1101
1107
|
};
|
|
@@ -1110,7 +1116,6 @@ var Logger = {
|
|
|
1110
1116
|
this._platformRenderTarget.blitRenderTarget();
|
|
1111
1117
|
};
|
|
1112
1118
|
/**
|
|
1113
|
-
* @override
|
|
1114
1119
|
* @internal
|
|
1115
1120
|
*/ _proto._rebuild = function _rebuild() {
|
|
1116
1121
|
this._platformRenderTarget = this._engine._hardwareRenderer.createPlatformRenderTarget(this);
|
|
@@ -1313,7 +1318,7 @@ var Logger = {
|
|
|
1313
1318
|
}
|
|
1314
1319
|
};
|
|
1315
1320
|
/**
|
|
1316
|
-
* @
|
|
1321
|
+
* @internal
|
|
1317
1322
|
*/ _proto._rebuild = function _rebuild() {
|
|
1318
1323
|
this._platformTexture = this._engine._hardwareRenderer.createPlatformTexture2DArray(this);
|
|
1319
1324
|
Texture.prototype._rebuild.call(this);
|
|
@@ -1397,7 +1402,7 @@ var Logger = {
|
|
|
1397
1402
|
}
|
|
1398
1403
|
};
|
|
1399
1404
|
/**
|
|
1400
|
-
* @
|
|
1405
|
+
* @internal
|
|
1401
1406
|
*/ _proto._rebuild = function _rebuild() {
|
|
1402
1407
|
this._platformTexture = this._engine._hardwareRenderer.createPlatformTextureCube(this);
|
|
1403
1408
|
Texture.prototype._rebuild.call(this);
|
|
@@ -1472,7 +1477,6 @@ var Logger = {
|
|
|
1472
1477
|
return this._charInfoMap[char.charCodeAt(0)];
|
|
1473
1478
|
};
|
|
1474
1479
|
/**
|
|
1475
|
-
* @override
|
|
1476
1480
|
* @internal
|
|
1477
1481
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
1478
1482
|
ReferResource.prototype._onDestroy.call(this);
|
|
@@ -1981,6 +1985,7 @@ var Logger = {
|
|
|
1981
1985
|
var fontAtlas = new FontAtlas(engine);
|
|
1982
1986
|
var texture = new Texture2D(engine, 256, 256);
|
|
1983
1987
|
fontAtlas.texture = texture;
|
|
1988
|
+
fontAtlas.isGCIgnored = texture.isGCIgnored = true;
|
|
1984
1989
|
this._fontAtlases.push(fontAtlas);
|
|
1985
1990
|
var nativeFontString = this.nativeFontString;
|
|
1986
1991
|
engine.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
|
|
@@ -2038,7 +2043,6 @@ var Logger = {
|
|
|
2038
2043
|
return subFont;
|
|
2039
2044
|
};
|
|
2040
2045
|
/**
|
|
2041
|
-
* @override
|
|
2042
2046
|
* @internal
|
|
2043
2047
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
2044
2048
|
ReferResource.prototype._onDestroy.call(this);
|
|
@@ -3212,54 +3216,6 @@ exports.GLCapabilityType = void 0;
|
|
|
3212
3216
|
return ComponentsManager;
|
|
3213
3217
|
}();
|
|
3214
3218
|
|
|
3215
|
-
var ComponentCloner = /*#__PURE__*/ function() {
|
|
3216
|
-
function ComponentCloner() {}
|
|
3217
|
-
/**
|
|
3218
|
-
* Clone component.
|
|
3219
|
-
* @param source - Clone source
|
|
3220
|
-
* @param target - Clone target
|
|
3221
|
-
*/ ComponentCloner.cloneComponent = function cloneComponent(source, target) {
|
|
3222
|
-
var cloneModes = CloneManager.getCloneMode(source.constructor);
|
|
3223
|
-
var keys = Object.keys(source);
|
|
3224
|
-
for(var i = 0, n = keys.length; i < n; i++){
|
|
3225
|
-
var k = keys[i];
|
|
3226
|
-
var cloneMode = cloneModes[k];
|
|
3227
|
-
switch(cloneMode){
|
|
3228
|
-
case undefined:
|
|
3229
|
-
case CloneMode.Assignment:
|
|
3230
|
-
target[k] = source[k];
|
|
3231
|
-
break;
|
|
3232
|
-
case CloneMode.Shallow:
|
|
3233
|
-
var sourcePropS = source[k];
|
|
3234
|
-
if (_instanceof(sourcePropS, Object)) {
|
|
3235
|
-
var tarProp = target[k];
|
|
3236
|
-
tarProp == null && (tarProp = target[k] = sourcePropS.constructor());
|
|
3237
|
-
Object.assign(tarProp, sourcePropS);
|
|
3238
|
-
} else {
|
|
3239
|
-
// Null or undefined and primitive type.
|
|
3240
|
-
target[k] = sourcePropS;
|
|
3241
|
-
}
|
|
3242
|
-
break;
|
|
3243
|
-
case CloneMode.Deep:
|
|
3244
|
-
var sourcePropD = source[k];
|
|
3245
|
-
if (_instanceof(sourcePropD, Object)) {
|
|
3246
|
-
var tarProp1 = target[k];
|
|
3247
|
-
tarProp1 == null && (tarProp1 = target[k] = sourcePropD.constructor());
|
|
3248
|
-
CloneManager.deepCloneObject(sourcePropD, tarProp1);
|
|
3249
|
-
} else {
|
|
3250
|
-
// Null or undefined and primitive type.
|
|
3251
|
-
target[k] = sourcePropD;
|
|
3252
|
-
}
|
|
3253
|
-
break;
|
|
3254
|
-
}
|
|
3255
|
-
}
|
|
3256
|
-
if (source._cloneTo) {
|
|
3257
|
-
source._cloneTo(target);
|
|
3258
|
-
}
|
|
3259
|
-
};
|
|
3260
|
-
return ComponentCloner;
|
|
3261
|
-
}();
|
|
3262
|
-
|
|
3263
3219
|
/**
|
|
3264
3220
|
* The base class of the components.
|
|
3265
3221
|
*/ var Component = /*#__PURE__*/ function(EngineObject) {
|
|
@@ -3308,7 +3264,6 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
3308
3264
|
}
|
|
3309
3265
|
};
|
|
3310
3266
|
/**
|
|
3311
|
-
* @override
|
|
3312
3267
|
* @internal
|
|
3313
3268
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
3314
3269
|
EngineObject.prototype._onDestroy.call(this);
|
|
@@ -4542,6 +4497,54 @@ var TransformModifyFlags;
|
|
|
4542
4497
|
TransformModifyFlags[TransformModifyFlags[/** WorldMatrix | WorldPosition | WorldEuler | WorldQuat | WorldScale */ "WmWpWeWqWs"] = 0xbc] = "WmWpWeWqWs";
|
|
4543
4498
|
})(TransformModifyFlags || (TransformModifyFlags = {}));
|
|
4544
4499
|
|
|
4500
|
+
var ComponentCloner = /*#__PURE__*/ function() {
|
|
4501
|
+
function ComponentCloner() {}
|
|
4502
|
+
/**
|
|
4503
|
+
* Clone component.
|
|
4504
|
+
* @param source - Clone source
|
|
4505
|
+
* @param target - Clone target
|
|
4506
|
+
*/ ComponentCloner.cloneComponent = function cloneComponent(source, target) {
|
|
4507
|
+
var cloneModes = CloneManager.getCloneMode(source.constructor);
|
|
4508
|
+
var keys = Object.keys(source);
|
|
4509
|
+
for(var i = 0, n = keys.length; i < n; i++){
|
|
4510
|
+
var k = keys[i];
|
|
4511
|
+
var cloneMode = cloneModes[k];
|
|
4512
|
+
switch(cloneMode){
|
|
4513
|
+
case undefined:
|
|
4514
|
+
case CloneMode.Assignment:
|
|
4515
|
+
target[k] = source[k];
|
|
4516
|
+
break;
|
|
4517
|
+
case CloneMode.Shallow:
|
|
4518
|
+
var sourcePropS = source[k];
|
|
4519
|
+
if (_instanceof(sourcePropS, Object)) {
|
|
4520
|
+
var tarProp = target[k];
|
|
4521
|
+
tarProp == null && (tarProp = target[k] = sourcePropS.constructor());
|
|
4522
|
+
Object.assign(tarProp, sourcePropS);
|
|
4523
|
+
} else {
|
|
4524
|
+
// Null or undefined and primitive type.
|
|
4525
|
+
target[k] = sourcePropS;
|
|
4526
|
+
}
|
|
4527
|
+
break;
|
|
4528
|
+
case CloneMode.Deep:
|
|
4529
|
+
var sourcePropD = source[k];
|
|
4530
|
+
if (_instanceof(sourcePropD, Object)) {
|
|
4531
|
+
var tarProp1 = target[k];
|
|
4532
|
+
tarProp1 == null && (tarProp1 = target[k] = sourcePropD.constructor());
|
|
4533
|
+
CloneManager.deepCloneObject(sourcePropD, tarProp1);
|
|
4534
|
+
} else {
|
|
4535
|
+
// Null or undefined and primitive type.
|
|
4536
|
+
target[k] = sourcePropD;
|
|
4537
|
+
}
|
|
4538
|
+
break;
|
|
4539
|
+
}
|
|
4540
|
+
}
|
|
4541
|
+
if (source._cloneTo) {
|
|
4542
|
+
source._cloneTo(target);
|
|
4543
|
+
}
|
|
4544
|
+
};
|
|
4545
|
+
return ComponentCloner;
|
|
4546
|
+
}();
|
|
4547
|
+
|
|
4545
4548
|
/**
|
|
4546
4549
|
* Entity, be used as components container.
|
|
4547
4550
|
*/ var Entity = /*#__PURE__*/ function(EngineObject) {
|
|
@@ -5272,14 +5275,14 @@ SystemInfo._initialize();
|
|
|
5272
5275
|
Keys[Keys[/** Tab or ⇥. */ "Tab"] = 63] = "Tab";
|
|
5273
5276
|
Keys[Keys[/** Japanese: 変換 (henkan). */ "Convert"] = 64] = "Convert";
|
|
5274
5277
|
Keys[Keys[/** Japanese: カタカナ/ひらがな/ローマ字 (katakana/hiragana/romaji). */ "KanaMode"] = 65] = "KanaMode";
|
|
5275
|
-
Keys[Keys[/**
|
|
5276
|
-
* Korean: HangulMode 한/영 (han/yeong).
|
|
5277
|
-
* Japanese (Mac keyboard): かな (kana).
|
|
5278
|
-
* */ "Lang1"] = 66] = "Lang1";
|
|
5279
5278
|
Keys[Keys[/**
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5279
|
+
* Korean: HangulMode 한/영 (han/yeong).
|
|
5280
|
+
* Japanese (Mac keyboard): かな (kana).
|
|
5281
|
+
* */ "Lang1"] = 66] = "Lang1";
|
|
5282
|
+
Keys[Keys[/**
|
|
5283
|
+
* Korean: Hanja 한자 (hanja).
|
|
5284
|
+
* Japanese (Mac keyboard): 英数 (eisu).
|
|
5285
|
+
*/ "Lang2"] = 67] = "Lang2";
|
|
5283
5286
|
Keys[Keys[/** Japanese (word-processing keyboard): Katakana. */ "Lang3"] = 68] = "Lang3";
|
|
5284
5287
|
Keys[Keys[/** Japanese (word-processing keyboard): Hiragana. */ "Lang4"] = 69] = "Lang4";
|
|
5285
5288
|
Keys[Keys[/** Japanese (word-processing keyboard): Zenkaku/Hankaku. */ "Lang5"] = 70] = "Lang5";
|
|
@@ -5296,46 +5299,46 @@ SystemInfo._initialize();
|
|
|
5296
5299
|
Keys[Keys[/** → */ "ArrowRight"] = 81] = "ArrowRight";
|
|
5297
5300
|
Keys[Keys[/** ↑ */ "ArrowUp"] = 82] = "ArrowUp";
|
|
5298
5301
|
Keys[Keys[/** On the Mac, the "NumLock" code should be used for the numpad Clear key. */ "NumLock"] = 83] = "NumLock";
|
|
5299
|
-
Keys[Keys[/**
|
|
5300
|
-
* 0 Ins on a keyboard.
|
|
5301
|
-
* 0 on a phone or remote control.
|
|
5302
|
-
* */ "Numpad0"] = 84] = "Numpad0";
|
|
5303
5302
|
Keys[Keys[/**
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5303
|
+
* 0 Ins on a keyboard.
|
|
5304
|
+
* 0 on a phone or remote control.
|
|
5305
|
+
* */ "Numpad0"] = 84] = "Numpad0";
|
|
5306
|
+
Keys[Keys[/**
|
|
5307
|
+
* 1 End on a keyboard.
|
|
5308
|
+
* 1 or 1 QZ on a phone or remote control.
|
|
5309
|
+
*/ "Numpad1"] = 85] = "Numpad1";
|
|
5307
5310
|
Keys[Keys[/**
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
+
* 2 ↓ on a keyboard.
|
|
5312
|
+
* 2 ABC on a phone or remote control.
|
|
5313
|
+
*/ "Numpad2"] = 86] = "Numpad2";
|
|
5311
5314
|
Keys[Keys[/**
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
+
* 3 PgDn on a keyboard.
|
|
5316
|
+
* 3 DEF on a phone or remote control.
|
|
5317
|
+
*/ "Numpad3"] = 87] = "Numpad3";
|
|
5315
5318
|
Keys[Keys[/**
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
+
* 4 ← on a keyboard.
|
|
5320
|
+
* 4 GHI on a phone or remote control.
|
|
5321
|
+
*/ "Numpad4"] = 88] = "Numpad4";
|
|
5319
5322
|
Keys[Keys[/**
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
+
* 5 on a keyboard.
|
|
5324
|
+
* 5 JKL on a phone or remote control.
|
|
5325
|
+
*/ "Numpad5"] = 89] = "Numpad5";
|
|
5323
5326
|
Keys[Keys[/**
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
+
* 6 → on a keyboard.
|
|
5328
|
+
* 6 MNO on a phone or remote control.
|
|
5329
|
+
*/ "Numpad6"] = 90] = "Numpad6";
|
|
5327
5330
|
Keys[Keys[/**
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
+
* 7 Home on a keyboard.
|
|
5332
|
+
* 7 PQRS or 7 PRS on a phone or remote control.
|
|
5333
|
+
*/ "Numpad7"] = 91] = "Numpad7";
|
|
5331
5334
|
Keys[Keys[/**
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
+
* 8 ↑ on a keyboard.
|
|
5336
|
+
* 8 TUV on a phone or remote control.
|
|
5337
|
+
*/ "Numpad8"] = 92] = "Numpad8";
|
|
5335
5338
|
Keys[Keys[/**
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
+
* 9 PgUp on a keyboard.
|
|
5340
|
+
* 9 WXYZ or 9 WXY on a phone or remote control.
|
|
5341
|
+
*/ "Numpad9"] = 93] = "Numpad9";
|
|
5339
5342
|
Keys[Keys[/** + */ "NumpadAdd"] = 94] = "NumpadAdd";
|
|
5340
5343
|
Keys[Keys[/** Found on the Microsoft Natural Keyboard. */ "NumpadBackspace"] = 95] = "NumpadBackspace";
|
|
5341
5344
|
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";
|
|
@@ -5351,16 +5354,16 @@ SystemInfo._initialize();
|
|
|
5351
5354
|
Keys[Keys[/** MR Replace the current entry with the value stored in memory. */ "NumpadMemoryRecall"] = 106] = "NumpadMemoryRecall";
|
|
5352
5355
|
Keys[Keys[/** MS Replace the value stored in memory with the current entry. */ "NumpadMemoryStore"] = 107] = "NumpadMemoryStore";
|
|
5353
5356
|
Keys[Keys[/** M- Subtract current entry from the value stored in memory. */ "NumpadMemorySubtract"] = 108] = "NumpadMemorySubtract";
|
|
5354
|
-
Keys[Keys[/**
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5357
|
+
Keys[Keys[/**
|
|
5358
|
+
* * on a keyboard. For use with numpads that provide mathematical operations (+, -, * and /).
|
|
5359
|
+
* Use "NumpadStar" for the * key on phones and remote controls.
|
|
5360
|
+
*/ "NumpadMultiply"] = 109] = "NumpadMultiply";
|
|
5358
5361
|
Keys[Keys[/** ( Found on the Microsoft Natural Keyboard. */ "NumpadParenLeft"] = 110] = "NumpadParenLeft";
|
|
5359
5362
|
Keys[Keys[/** ) Found on the Microsoft Natural Keyboard. */ "NumpadParenRight"] = 111] = "NumpadParenRight";
|
|
5360
5363
|
Keys[Keys[/**
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
+
* * on a phone or remote control device. This key is typically found below the 7 key and to the left of the 0 key.
|
|
5365
|
+
* Use "NumpadMultiply" for the * key on numeric keypads.
|
|
5366
|
+
*/ "NumpadStar"] = 112] = "NumpadStar";
|
|
5364
5367
|
Keys[Keys[/** - */ "NumpadSubtract"] = 113] = "NumpadSubtract";
|
|
5365
5368
|
Keys[Keys[/** Esc or ⎋. */ "Escape"] = 114] = "Escape";
|
|
5366
5369
|
Keys[Keys[/** F1 */ "F1"] = 115] = "F1";
|
|
@@ -6026,19 +6029,16 @@ exports.Collider = /*#__PURE__*/ function(Component) {
|
|
|
6026
6029
|
* @internal
|
|
6027
6030
|
*/ _proto._onLateUpdate = function _onLateUpdate() {};
|
|
6028
6031
|
/**
|
|
6029
|
-
* @override
|
|
6030
6032
|
* @internal
|
|
6031
6033
|
*/ _proto._onEnable = function _onEnable() {
|
|
6032
6034
|
this.engine.physicsManager._addCollider(this);
|
|
6033
6035
|
};
|
|
6034
6036
|
/**
|
|
6035
|
-
* @override
|
|
6036
6037
|
* @internal
|
|
6037
6038
|
*/ _proto._onDisable = function _onDisable() {
|
|
6038
6039
|
this.engine.physicsManager._removeCollider(this);
|
|
6039
6040
|
};
|
|
6040
6041
|
/**
|
|
6041
|
-
* @override
|
|
6042
6042
|
* @internal
|
|
6043
6043
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
6044
6044
|
Component.prototype._onDestroy.call(this);
|
|
@@ -6079,7 +6079,6 @@ exports.Collider = __decorate([
|
|
|
6079
6079
|
function CharacterController(entity) {
|
|
6080
6080
|
var _this;
|
|
6081
6081
|
_this = Collider.call(this, entity) || this;
|
|
6082
|
-
/** @internal */ _this._index = -1;
|
|
6083
6082
|
_this._stepOffset = 0.5;
|
|
6084
6083
|
_this._nonWalkableMode = exports.ControllerNonWalkableMode.PreventClimbing;
|
|
6085
6084
|
_this._upDirection = new engineMath.Vector3(0, 1, 0);
|
|
@@ -6103,7 +6102,6 @@ exports.Collider = __decorate([
|
|
|
6103
6102
|
/**
|
|
6104
6103
|
* Add collider shape on this controller.
|
|
6105
6104
|
* @param shape - Collider shape
|
|
6106
|
-
* @override
|
|
6107
6105
|
*/ _proto.addShape = function addShape(shape) {
|
|
6108
6106
|
if (this._shapes.length > 0) {
|
|
6109
6107
|
throw "only allow single shape on controller!";
|
|
@@ -6113,7 +6111,6 @@ exports.Collider = __decorate([
|
|
|
6113
6111
|
};
|
|
6114
6112
|
/**
|
|
6115
6113
|
* Remove all shape attached.
|
|
6116
|
-
* @override
|
|
6117
6114
|
*/ _proto.clearShapes = function clearShapes() {
|
|
6118
6115
|
if (this._shapes.length > 0) {
|
|
6119
6116
|
Collider.prototype.removeShape.call(this, this._shapes[0]);
|
|
@@ -6121,7 +6118,6 @@ exports.Collider = __decorate([
|
|
|
6121
6118
|
};
|
|
6122
6119
|
/**
|
|
6123
6120
|
* @internal
|
|
6124
|
-
* @override
|
|
6125
6121
|
*/ _proto._onUpdate = function _onUpdate() {
|
|
6126
6122
|
if (this._updateFlag.flag) {
|
|
6127
6123
|
var transform = this.entity.transform;
|
|
@@ -6136,7 +6132,6 @@ exports.Collider = __decorate([
|
|
|
6136
6132
|
};
|
|
6137
6133
|
/**
|
|
6138
6134
|
* @internal
|
|
6139
|
-
* @override
|
|
6140
6135
|
*/ _proto._onLateUpdate = function _onLateUpdate() {
|
|
6141
6136
|
var position = this.entity.transform.worldPosition;
|
|
6142
6137
|
this._nativeCollider.getWorldPosition(position);
|
|
@@ -6144,13 +6139,11 @@ exports.Collider = __decorate([
|
|
|
6144
6139
|
this._updateFlag.flag = false;
|
|
6145
6140
|
};
|
|
6146
6141
|
/**
|
|
6147
|
-
* @override
|
|
6148
6142
|
* @internal
|
|
6149
6143
|
*/ _proto._onEnable = function _onEnable() {
|
|
6150
6144
|
this.engine.physicsManager._addCharacterController(this);
|
|
6151
6145
|
};
|
|
6152
6146
|
/**
|
|
6153
|
-
* @override
|
|
6154
6147
|
* @internal
|
|
6155
6148
|
*/ _proto._onDisable = function _onDisable() {
|
|
6156
6149
|
this.engine.physicsManager._removeCharacterController(this);
|
|
@@ -6643,7 +6636,6 @@ exports.Joint = __decorate([
|
|
|
6643
6636
|
}
|
|
6644
6637
|
var _proto = FixedJoint.prototype;
|
|
6645
6638
|
/**
|
|
6646
|
-
* @override
|
|
6647
6639
|
* @internal
|
|
6648
6640
|
*/ _proto._onAwake = function _onAwake() {
|
|
6649
6641
|
var collider = this._collider;
|
|
@@ -6677,7 +6669,6 @@ exports.Joint = __decorate([
|
|
|
6677
6669
|
}
|
|
6678
6670
|
var _proto = HingeJoint.prototype;
|
|
6679
6671
|
/**
|
|
6680
|
-
* @override
|
|
6681
6672
|
* @internal
|
|
6682
6673
|
*/ _proto._onAwake = function _onAwake() {
|
|
6683
6674
|
var collider = this._collider;
|
|
@@ -6829,7 +6820,6 @@ exports.Joint = __decorate([
|
|
|
6829
6820
|
}
|
|
6830
6821
|
var _proto = SpringJoint.prototype;
|
|
6831
6822
|
/**
|
|
6832
|
-
* @override
|
|
6833
6823
|
* @internal
|
|
6834
6824
|
*/ _proto._onAwake = function _onAwake() {
|
|
6835
6825
|
var collider = this._collider;
|
|
@@ -7034,7 +7024,6 @@ exports.Joint = __decorate([
|
|
|
7034
7024
|
this._nativeCollider.wakeUp();
|
|
7035
7025
|
};
|
|
7036
7026
|
/**
|
|
7037
|
-
* @override
|
|
7038
7027
|
* @internal
|
|
7039
7028
|
*/ _proto._onLateUpdate = function _onLateUpdate() {
|
|
7040
7029
|
var transform = this.entity.transform;
|
|
@@ -7901,7 +7890,10 @@ exports.DynamicColliderConstraints = void 0;
|
|
|
7901
7890
|
return _this;
|
|
7902
7891
|
}
|
|
7903
7892
|
var _proto = Light.prototype;
|
|
7904
|
-
|
|
7893
|
+
/**
|
|
7894
|
+
* Light Color, include intensity.
|
|
7895
|
+
* @internal
|
|
7896
|
+
*/ _proto._getLightIntensityColor = function _getLightIntensityColor() {
|
|
7905
7897
|
this._lightColor.r = this.color.r * this.intensity;
|
|
7906
7898
|
this._lightColor.g = this.color.g * this.intensity;
|
|
7907
7899
|
this._lightColor.b = this.color.b * this.intensity;
|
|
@@ -7971,15 +7963,21 @@ __decorate([
|
|
|
7971
7963
|
var cullingMaskStart = lightIndex * 2;
|
|
7972
7964
|
var colorStart = lightIndex * 3;
|
|
7973
7965
|
var directionStart = lightIndex * 3;
|
|
7974
|
-
var lightColor = this.
|
|
7966
|
+
var lightColor = this._getLightIntensityColor();
|
|
7975
7967
|
var direction = this.direction;
|
|
7976
7968
|
var data = DirectLight._combinedData;
|
|
7977
7969
|
var cullingMask = this.cullingMask;
|
|
7978
7970
|
data.cullingMask[cullingMaskStart] = cullingMask & 65535;
|
|
7979
7971
|
data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7972
|
+
if (this.engine.settings.colorSpace === exports.ColorSpace.Linear) {
|
|
7973
|
+
data.color[colorStart] = engineMath.Color.gammaToLinearSpace(lightColor.r);
|
|
7974
|
+
data.color[colorStart + 1] = engineMath.Color.gammaToLinearSpace(lightColor.g);
|
|
7975
|
+
data.color[colorStart + 2] = engineMath.Color.gammaToLinearSpace(lightColor.b);
|
|
7976
|
+
} else {
|
|
7977
|
+
data.color[colorStart] = lightColor.r;
|
|
7978
|
+
data.color[colorStart + 1] = lightColor.g;
|
|
7979
|
+
data.color[colorStart + 2] = lightColor.b;
|
|
7980
|
+
}
|
|
7983
7981
|
data.direction[directionStart] = direction.x;
|
|
7984
7982
|
data.direction[directionStart + 1] = direction.y;
|
|
7985
7983
|
data.direction[directionStart + 2] = direction.z;
|
|
@@ -7987,14 +7985,12 @@ __decorate([
|
|
|
7987
7985
|
/**
|
|
7988
7986
|
* Mount to the current Scene.
|
|
7989
7987
|
* @internal
|
|
7990
|
-
* @override
|
|
7991
7988
|
*/ _proto._onEnable = function _onEnable() {
|
|
7992
7989
|
this.engine._lightManager._attachDirectLight(this);
|
|
7993
7990
|
};
|
|
7994
7991
|
/**
|
|
7995
7992
|
* Unmount from the current Scene.
|
|
7996
7993
|
* @internal
|
|
7997
|
-
* @override
|
|
7998
7994
|
*/ _proto._onDisable = function _onDisable() {
|
|
7999
7995
|
this.engine._lightManager._detachDirectLight(this);
|
|
8000
7996
|
};
|
|
@@ -8028,7 +8024,6 @@ __decorate([
|
|
|
8028
8024
|
key: "_shadowProjectionMatrix",
|
|
8029
8025
|
get: /**
|
|
8030
8026
|
* @internal
|
|
8031
|
-
* @override
|
|
8032
8027
|
*/ function get() {
|
|
8033
8028
|
throw "Unknown!";
|
|
8034
8029
|
}
|
|
@@ -8071,15 +8066,21 @@ __decorate([
|
|
|
8071
8066
|
var colorStart = lightIndex * 3;
|
|
8072
8067
|
var positionStart = lightIndex * 3;
|
|
8073
8068
|
var distanceStart = lightIndex;
|
|
8074
|
-
var lightColor = this.
|
|
8069
|
+
var lightColor = this._getLightIntensityColor();
|
|
8075
8070
|
var lightPosition = this.position;
|
|
8076
8071
|
var data = PointLight._combinedData;
|
|
8077
8072
|
var cullingMask = this.cullingMask;
|
|
8078
8073
|
data.cullingMask[cullingMaskStart] = cullingMask & 65535;
|
|
8079
8074
|
data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
|
|
8080
|
-
|
|
8081
|
-
|
|
8082
|
-
|
|
8075
|
+
if (this.engine.settings.colorSpace === exports.ColorSpace.Linear) {
|
|
8076
|
+
data.color[colorStart] = engineMath.Color.gammaToLinearSpace(lightColor.r);
|
|
8077
|
+
data.color[colorStart + 1] = engineMath.Color.gammaToLinearSpace(lightColor.g);
|
|
8078
|
+
data.color[colorStart + 2] = engineMath.Color.gammaToLinearSpace(lightColor.b);
|
|
8079
|
+
} else {
|
|
8080
|
+
data.color[colorStart] = lightColor.r;
|
|
8081
|
+
data.color[colorStart + 1] = lightColor.g;
|
|
8082
|
+
data.color[colorStart + 2] = lightColor.b;
|
|
8083
|
+
}
|
|
8083
8084
|
data.position[positionStart] = lightPosition.x;
|
|
8084
8085
|
data.position[positionStart + 1] = lightPosition.y;
|
|
8085
8086
|
data.position[positionStart + 2] = lightPosition.z;
|
|
@@ -8088,14 +8089,12 @@ __decorate([
|
|
|
8088
8089
|
/**
|
|
8089
8090
|
* Mount to the current Scene.
|
|
8090
8091
|
* @internal
|
|
8091
|
-
* @override
|
|
8092
8092
|
*/ _proto._onEnable = function _onEnable() {
|
|
8093
8093
|
this.engine._lightManager._attachPointLight(this);
|
|
8094
8094
|
};
|
|
8095
8095
|
/**
|
|
8096
8096
|
* Unmount from the current Scene.
|
|
8097
8097
|
* @internal
|
|
8098
|
-
* @override
|
|
8099
8098
|
*/ _proto._onDisable = function _onDisable() {
|
|
8100
8099
|
this.engine._lightManager._detachPointLight(this);
|
|
8101
8100
|
};
|
|
@@ -8121,7 +8120,6 @@ __decorate([
|
|
|
8121
8120
|
key: "_shadowProjectionMatrix",
|
|
8122
8121
|
get: /**
|
|
8123
8122
|
* @internal
|
|
8124
|
-
* @override
|
|
8125
8123
|
*/ function get() {
|
|
8126
8124
|
throw "Unknown!";
|
|
8127
8125
|
}
|
|
@@ -8175,16 +8173,22 @@ __decorate([
|
|
|
8175
8173
|
var distanceStart = lightIndex;
|
|
8176
8174
|
var penumbraCosStart = lightIndex;
|
|
8177
8175
|
var angleCosStart = lightIndex;
|
|
8178
|
-
var
|
|
8176
|
+
var lightColor = this._getLightIntensityColor();
|
|
8179
8177
|
var position = this.position;
|
|
8180
8178
|
var direction = this.direction;
|
|
8181
8179
|
var data = SpotLight._combinedData;
|
|
8182
8180
|
var cullingMask = this.cullingMask;
|
|
8183
8181
|
data.cullingMask[cullingMaskStart] = cullingMask & 65535;
|
|
8184
8182
|
data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
|
|
8185
|
-
|
|
8186
|
-
|
|
8187
|
-
|
|
8183
|
+
if (this.engine.settings.colorSpace === exports.ColorSpace.Linear) {
|
|
8184
|
+
data.color[colorStart] = engineMath.Color.gammaToLinearSpace(lightColor.r);
|
|
8185
|
+
data.color[colorStart + 1] = engineMath.Color.gammaToLinearSpace(lightColor.g);
|
|
8186
|
+
data.color[colorStart + 2] = engineMath.Color.gammaToLinearSpace(lightColor.b);
|
|
8187
|
+
} else {
|
|
8188
|
+
data.color[colorStart] = lightColor.r;
|
|
8189
|
+
data.color[colorStart + 1] = lightColor.g;
|
|
8190
|
+
data.color[colorStart + 2] = lightColor.b;
|
|
8191
|
+
}
|
|
8188
8192
|
data.position[positionStart] = position.x;
|
|
8189
8193
|
data.position[positionStart + 1] = position.y;
|
|
8190
8194
|
data.position[positionStart + 2] = position.z;
|
|
@@ -8198,14 +8202,12 @@ __decorate([
|
|
|
8198
8202
|
/**
|
|
8199
8203
|
* Mount to the current Scene.
|
|
8200
8204
|
* @internal
|
|
8201
|
-
* @override
|
|
8202
8205
|
*/ _proto._onEnable = function _onEnable() {
|
|
8203
8206
|
this.engine._lightManager._attachSpotLight(this);
|
|
8204
8207
|
};
|
|
8205
8208
|
/**
|
|
8206
8209
|
* Unmount from the current Scene.
|
|
8207
8210
|
* @internal
|
|
8208
|
-
* @override
|
|
8209
8211
|
*/ _proto._onDisable = function _onDisable() {
|
|
8210
8212
|
this.engine._lightManager._detachSpotLight(this);
|
|
8211
8213
|
};
|
|
@@ -8251,7 +8253,6 @@ __decorate([
|
|
|
8251
8253
|
key: "_shadowProjectionMatrix",
|
|
8252
8254
|
get: /**
|
|
8253
8255
|
* @internal
|
|
8254
|
-
* @override
|
|
8255
8256
|
*/ function get() {
|
|
8256
8257
|
var matrix = this._projectMatrix;
|
|
8257
8258
|
var fov = Math.min(Math.PI / 2, this.angle * 2 * Math.sqrt(2));
|
|
@@ -8830,6 +8831,7 @@ __decorate([
|
|
|
8830
8831
|
_proto.cloneTo = function cloneTo(target) {
|
|
8831
8832
|
CloneManager.deepCloneObject(this._macroCollection, target._macroCollection);
|
|
8832
8833
|
Object.assign(target._macroMap, this._macroMap);
|
|
8834
|
+
var referCount = target._getReferCount();
|
|
8833
8835
|
var propertyValueMap = this._propertyValueMap;
|
|
8834
8836
|
var targetPropertyValueMap = target._propertyValueMap;
|
|
8835
8837
|
var keys = Object.keys(propertyValueMap);
|
|
@@ -8841,6 +8843,7 @@ __decorate([
|
|
|
8841
8843
|
targetPropertyValueMap[k] = property;
|
|
8842
8844
|
} else if (_instanceof(property, Texture)) {
|
|
8843
8845
|
targetPropertyValueMap[k] = property;
|
|
8846
|
+
referCount > 0 && property._addReferCount(referCount);
|
|
8844
8847
|
} else if (_instanceof(property, Array) || _instanceof(property, Float32Array) || _instanceof(property, Int32Array)) {
|
|
8845
8848
|
targetPropertyValueMap[k] = property.slice();
|
|
8846
8849
|
} else {
|
|
@@ -9420,9 +9423,7 @@ __decorate([
|
|
|
9420
9423
|
this.shaderData.cloneTo(target.shaderData);
|
|
9421
9424
|
CloneManager.deepCloneObject(this.renderStates, target.renderStates);
|
|
9422
9425
|
};
|
|
9423
|
-
|
|
9424
|
-
* @override
|
|
9425
|
-
*/ _proto._addReferCount = function _addReferCount(value) {
|
|
9426
|
+
_proto._addReferCount = function _addReferCount(value) {
|
|
9426
9427
|
ReferResource.prototype._addReferCount.call(this, value);
|
|
9427
9428
|
this.shaderData._addReferCount(value);
|
|
9428
9429
|
};
|
|
@@ -9547,21 +9548,21 @@ var camera_declare = "#define GLSLIFY 1\nuniform vec3 camera_Position;"; // esli
|
|
|
9547
9548
|
|
|
9548
9549
|
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
|
|
9549
9550
|
|
|
9550
|
-
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
|
|
9551
|
+
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
|
|
9551
9552
|
|
|
9552
9553
|
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
|
|
9553
9554
|
|
|
9554
|
-
var color_share = "#define GLSLIFY 1\n#ifdef
|
|
9555
|
+
var color_share = "#define GLSLIFY 1\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\nvarying vec4 v_color;\n#endif\n"; // eslint-disable-line
|
|
9555
9556
|
|
|
9556
9557
|
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
|
|
9557
9558
|
|
|
9558
9559
|
var FogVertexDeclaration = "#define GLSLIFY 1\n#if SCENE_FOG_MODE != 0\nvarying vec3 v_positionVS;\n#endif\n"; // eslint-disable-line
|
|
9559
9560
|
|
|
9560
|
-
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(
|
|
9561
|
+
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
|
|
9561
9562
|
|
|
9562
9563
|
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
|
|
9563
9564
|
|
|
9564
|
-
var worldpos_share = "#define GLSLIFY 1\n#ifdef
|
|
9565
|
+
var worldpos_share = "#define GLSLIFY 1\n#ifdef MATERIAL_NEED_WORLD_POS\nvarying vec3 v_pos;\n#endif\n"; // eslint-disable-line
|
|
9565
9566
|
|
|
9566
9567
|
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
|
|
9567
9568
|
|
|
@@ -9569,21 +9570,21 @@ var begin_position_vert = "#define GLSLIFY 1\nvec4 position=vec4(POSITION,1.0);"
|
|
|
9569
9570
|
|
|
9570
9571
|
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
|
|
9571
9572
|
|
|
9572
|
-
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(
|
|
9573
|
+
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
|
|
9573
9574
|
|
|
9574
|
-
var color_vert = "#define GLSLIFY 1\n#ifdef
|
|
9575
|
+
var color_vert = "#define GLSLIFY 1\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\nv_color=COLOR_0;\n#endif\n"; // eslint-disable-line
|
|
9575
9576
|
|
|
9576
9577
|
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
|
|
9577
9578
|
|
|
9578
|
-
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(
|
|
9579
|
+
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
|
|
9579
9580
|
|
|
9580
9581
|
var position_vert = "#define GLSLIFY 1\ngl_Position=renderer_MVPMat*position;"; // eslint-disable-line
|
|
9581
9582
|
|
|
9582
|
-
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(
|
|
9583
|
+
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
|
|
9583
9584
|
|
|
9584
|
-
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
|
|
9585
|
+
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
|
|
9585
9586
|
|
|
9586
|
-
var worldpos_vert = "#define GLSLIFY 1\n#ifdef
|
|
9587
|
+
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
|
|
9587
9588
|
|
|
9588
9589
|
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
|
|
9589
9590
|
|
|
@@ -9591,11 +9592,11 @@ var light_frag_define = "#define GLSLIFY 1\n#ifdef SCENE_DIRECT_LIGHT_COUNT\nstr
|
|
|
9591
9592
|
|
|
9592
9593
|
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
|
|
9593
9594
|
|
|
9594
|
-
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
|
|
9595
|
+
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
|
|
9595
9596
|
|
|
9596
|
-
var begin_viewdir_frag = "#define GLSLIFY 1\n#ifdef
|
|
9597
|
+
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
|
|
9597
9598
|
|
|
9598
|
-
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
|
|
9599
|
+
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
|
|
9599
9600
|
|
|
9600
9601
|
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
|
|
9601
9602
|
|
|
@@ -9629,17 +9630,17 @@ var noise_simplex_3D_grad = "#define GLSLIFY 1\nfloat simplex(vec3 v,out vec3 gr
|
|
|
9629
9630
|
|
|
9630
9631
|
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
|
|
9631
9632
|
|
|
9632
|
-
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
|
|
9633
|
+
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
|
|
9633
9634
|
|
|
9634
|
-
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(
|
|
9635
|
+
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
|
|
9635
9636
|
|
|
9636
9637
|
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
|
|
9637
9638
|
|
|
9638
|
-
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
|
|
9639
|
+
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
|
|
9639
9640
|
|
|
9640
9641
|
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
|
|
9641
9642
|
|
|
9642
|
-
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
|
|
9643
|
+
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
|
|
9643
9644
|
|
|
9644
9645
|
var PBRShaderLib = {
|
|
9645
9646
|
pbr_frag_define: pbr_frag_define,
|
|
@@ -9668,7 +9669,7 @@ var ShadowLib = {
|
|
|
9668
9669
|
ShadowVertex: ShadowVertex
|
|
9669
9670
|
};
|
|
9670
9671
|
|
|
9671
|
-
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(
|
|
9672
|
+
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
|
|
9672
9673
|
|
|
9673
9674
|
var ShaderLib = _extends({
|
|
9674
9675
|
common: common,
|
|
@@ -10783,7 +10784,6 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10783
10784
|
};
|
|
10784
10785
|
_proto.update = function update(deltaTime) {};
|
|
10785
10786
|
/**
|
|
10786
|
-
* @override
|
|
10787
10787
|
* @internal
|
|
10788
10788
|
*/ _proto._onEnable = function _onEnable() {
|
|
10789
10789
|
var componentsManager = this.engine._componentsManager;
|
|
@@ -10793,7 +10793,6 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10793
10793
|
componentsManager.addRenderer(this);
|
|
10794
10794
|
};
|
|
10795
10795
|
/**
|
|
10796
|
-
* @override
|
|
10797
10796
|
* @internal
|
|
10798
10797
|
*/ _proto._onDisable = function _onDisable() {
|
|
10799
10798
|
var componentsManager = this.engine._componentsManager;
|
|
@@ -10820,7 +10819,14 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10820
10819
|
ShaderMacroCollection.unionCollection(context.camera._globalShaderMacro, this.shaderData._macroCollection, this._globalShaderMacro);
|
|
10821
10820
|
};
|
|
10822
10821
|
/**
|
|
10823
|
-
* @
|
|
10822
|
+
* @internal
|
|
10823
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
10824
|
+
var materials = this._materials;
|
|
10825
|
+
for(var i = 0, n = materials.length; i < n; i++){
|
|
10826
|
+
target._setMaterial(i, materials[i]);
|
|
10827
|
+
}
|
|
10828
|
+
};
|
|
10829
|
+
/**
|
|
10824
10830
|
* @internal
|
|
10825
10831
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
10826
10832
|
Component.prototype._onDestroy.call(this);
|
|
@@ -10832,14 +10838,18 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10832
10838
|
(_materials_i = materials[i]) == null ? void 0 : _materials_i._addReferCount(-1);
|
|
10833
10839
|
}
|
|
10834
10840
|
};
|
|
10835
|
-
|
|
10841
|
+
/**
|
|
10842
|
+
* @internal
|
|
10843
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
10836
10844
|
var entity = this.entity;
|
|
10837
10845
|
var worldMatrix = entity.transform.worldMatrix;
|
|
10838
10846
|
this._updateTransformShaderData(context, worldMatrix);
|
|
10839
10847
|
var layer = entity.layer;
|
|
10840
10848
|
this._rendererLayer.set(layer & 65535, layer >>> 16 & 65535, 0, 0);
|
|
10841
10849
|
};
|
|
10842
|
-
|
|
10850
|
+
/**
|
|
10851
|
+
* @internal
|
|
10852
|
+
*/ _proto._updateTransformShaderData = function _updateTransformShaderData(context, worldMatrix) {
|
|
10843
10853
|
var shaderData = this.shaderData;
|
|
10844
10854
|
var virtualCamera = context.virtualCamera;
|
|
10845
10855
|
var mvMatrix = this._mvMatrix;
|
|
@@ -10858,14 +10868,22 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10858
10868
|
shaderData.setMatrix(exports.Renderer._mvInvMatrixProperty, mvInvMatrix);
|
|
10859
10869
|
shaderData.setMatrix(exports.Renderer._normalMatrixProperty, normalMatrix);
|
|
10860
10870
|
};
|
|
10861
|
-
|
|
10871
|
+
/**
|
|
10872
|
+
* @internal
|
|
10873
|
+
*/ _proto._registerEntityTransformListener = function _registerEntityTransformListener() {
|
|
10862
10874
|
this.entity.transform._updateFlagManager.addListener(this._onTransformChanged);
|
|
10863
10875
|
};
|
|
10864
|
-
|
|
10865
|
-
|
|
10876
|
+
/**
|
|
10877
|
+
* @internal
|
|
10878
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {};
|
|
10879
|
+
/**
|
|
10880
|
+
* @internal
|
|
10881
|
+
*/ _proto._render = function _render(context) {
|
|
10866
10882
|
throw "not implement";
|
|
10867
10883
|
};
|
|
10868
|
-
|
|
10884
|
+
/**
|
|
10885
|
+
* @internal
|
|
10886
|
+
*/ _proto._createInstanceMaterial = function _createInstanceMaterial(material, index) {
|
|
10869
10887
|
var insMaterial = material.clone();
|
|
10870
10888
|
insMaterial.name = insMaterial.name + "(Instance)";
|
|
10871
10889
|
material._addReferCount(-1);
|
|
@@ -10888,7 +10906,9 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10888
10906
|
materials[index] = material;
|
|
10889
10907
|
}
|
|
10890
10908
|
};
|
|
10891
|
-
|
|
10909
|
+
/**
|
|
10910
|
+
* @internal
|
|
10911
|
+
*/ _proto._onTransformChanged = function _onTransformChanged(type) {
|
|
10892
10912
|
this._dirtyUpdateFlag |= 0x1;
|
|
10893
10913
|
};
|
|
10894
10914
|
_create_class(Renderer1, [
|
|
@@ -11001,7 +11021,7 @@ __decorate([
|
|
|
11001
11021
|
ignoreClone
|
|
11002
11022
|
], exports.Renderer.prototype, "_overrideUpdate", void 0);
|
|
11003
11023
|
__decorate([
|
|
11004
|
-
|
|
11024
|
+
ignoreClone
|
|
11005
11025
|
], exports.Renderer.prototype, "_materials", void 0);
|
|
11006
11026
|
__decorate([
|
|
11007
11027
|
ignoreClone
|
|
@@ -11195,8 +11215,10 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11195
11215
|
_this = Renderer.call(this, entity) || this;
|
|
11196
11216
|
/** The mask layers the sprite mask influence to. */ _this.influenceLayers = exports.SpriteMaskLayer.Everything;
|
|
11197
11217
|
_this._sprite = null;
|
|
11198
|
-
_this.
|
|
11199
|
-
_this.
|
|
11218
|
+
_this._automaticWidth = 0;
|
|
11219
|
+
_this._automaticHeight = 0;
|
|
11220
|
+
_this._customWidth = undefined;
|
|
11221
|
+
_this._customHeight = undefined;
|
|
11200
11222
|
_this._flipX = false;
|
|
11201
11223
|
_this._flipY = false;
|
|
11202
11224
|
_this._alphaCutoff = 0.5;
|
|
@@ -11211,33 +11233,33 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11211
11233
|
/**
|
|
11212
11234
|
* @internal
|
|
11213
11235
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
11236
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
11214
11237
|
target.sprite = this._sprite;
|
|
11215
11238
|
};
|
|
11216
11239
|
/**
|
|
11217
|
-
* @
|
|
11240
|
+
* @internal
|
|
11218
11241
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
11219
|
-
|
|
11220
|
-
|
|
11242
|
+
if (this.sprite) {
|
|
11243
|
+
SimpleSpriteAssembler.updatePositions(this);
|
|
11244
|
+
} else {
|
|
11221
11245
|
worldBounds.min.set(0, 0, 0);
|
|
11222
11246
|
worldBounds.max.set(0, 0, 0);
|
|
11223
|
-
} else {
|
|
11224
|
-
SimpleSpriteAssembler.updatePositions(this);
|
|
11225
11247
|
}
|
|
11226
11248
|
};
|
|
11227
11249
|
/**
|
|
11228
|
-
* @
|
|
11250
|
+
* @internal
|
|
11229
11251
|
* @inheritdoc
|
|
11230
11252
|
*/ _proto._render = function _render(context) {
|
|
11231
11253
|
var _this_sprite;
|
|
11232
11254
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
11233
11255
|
return;
|
|
11234
11256
|
}
|
|
11235
|
-
// Update position
|
|
11257
|
+
// Update position
|
|
11236
11258
|
if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
|
|
11237
11259
|
SimpleSpriteAssembler.updatePositions(this);
|
|
11238
11260
|
this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
|
|
11239
11261
|
}
|
|
11240
|
-
// Update uv
|
|
11262
|
+
// Update uv
|
|
11241
11263
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
11242
11264
|
SimpleSpriteAssembler.updateUVs(this);
|
|
11243
11265
|
this._dirtyUpdateFlag &= ~0x2;
|
|
@@ -11251,20 +11273,39 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11251
11273
|
this._maskElement = renderElement;
|
|
11252
11274
|
};
|
|
11253
11275
|
/**
|
|
11254
|
-
* @
|
|
11276
|
+
* @internal
|
|
11255
11277
|
* @inheritdoc
|
|
11256
11278
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
11257
|
-
var _this__sprite;
|
|
11258
11279
|
Renderer.prototype._onDestroy.call(this);
|
|
11259
|
-
|
|
11280
|
+
var sprite = this._sprite;
|
|
11281
|
+
if (sprite) {
|
|
11282
|
+
sprite._addReferCount(-1);
|
|
11283
|
+
sprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
11284
|
+
}
|
|
11260
11285
|
this._sprite = null;
|
|
11261
11286
|
this._verticesData = null;
|
|
11262
11287
|
};
|
|
11288
|
+
_proto._calDefaultSize = function _calDefaultSize() {
|
|
11289
|
+
var sprite = this._sprite;
|
|
11290
|
+
if (sprite) {
|
|
11291
|
+
this._automaticWidth = sprite.width;
|
|
11292
|
+
this._automaticHeight = sprite.height;
|
|
11293
|
+
} else {
|
|
11294
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
11295
|
+
}
|
|
11296
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
11297
|
+
};
|
|
11263
11298
|
_proto._onSpriteChange = function _onSpriteChange(type) {
|
|
11264
11299
|
switch(type){
|
|
11265
11300
|
case SpriteModifyFlags.texture:
|
|
11266
11301
|
this.shaderData.setTexture(SpriteMask._textureProperty, this.sprite.texture);
|
|
11267
11302
|
break;
|
|
11303
|
+
case SpriteModifyFlags.size:
|
|
11304
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
11305
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
11306
|
+
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
11307
|
+
}
|
|
11308
|
+
break;
|
|
11268
11309
|
case SpriteModifyFlags.region:
|
|
11269
11310
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
11270
11311
|
this._dirtyUpdateFlag |= 0x3;
|
|
@@ -11272,22 +11313,31 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11272
11313
|
case SpriteModifyFlags.atlasRegion:
|
|
11273
11314
|
this._dirtyUpdateFlag |= 0x2;
|
|
11274
11315
|
break;
|
|
11316
|
+
case SpriteModifyFlags.pivot:
|
|
11317
|
+
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
11318
|
+
break;
|
|
11275
11319
|
}
|
|
11276
11320
|
};
|
|
11277
11321
|
_create_class(SpriteMask, [
|
|
11278
11322
|
{
|
|
11279
11323
|
key: "width",
|
|
11280
11324
|
get: /**
|
|
11281
|
-
* Render width.
|
|
11325
|
+
* Render width (in world coordinates).
|
|
11326
|
+
*
|
|
11327
|
+
* @remarks
|
|
11328
|
+
* If width is set, return the set value,
|
|
11329
|
+
* otherwise return `SpriteMask.sprite.width`.
|
|
11282
11330
|
*/ function get() {
|
|
11283
|
-
if (this.
|
|
11284
|
-
|
|
11331
|
+
if (this._customWidth !== undefined) {
|
|
11332
|
+
return this._customWidth;
|
|
11333
|
+
} else {
|
|
11334
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
11335
|
+
return this._automaticWidth;
|
|
11285
11336
|
}
|
|
11286
|
-
return this._width;
|
|
11287
11337
|
},
|
|
11288
11338
|
set: function set(value) {
|
|
11289
|
-
if (this.
|
|
11290
|
-
this.
|
|
11339
|
+
if (this._customWidth !== value) {
|
|
11340
|
+
this._customWidth = value;
|
|
11291
11341
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
11292
11342
|
}
|
|
11293
11343
|
}
|
|
@@ -11295,16 +11345,22 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11295
11345
|
{
|
|
11296
11346
|
key: "height",
|
|
11297
11347
|
get: /**
|
|
11298
|
-
* Render height.
|
|
11348
|
+
* Render height (in world coordinates).
|
|
11349
|
+
*
|
|
11350
|
+
* @remarks
|
|
11351
|
+
* If height is set, return the set value,
|
|
11352
|
+
* otherwise return `SpriteMask.sprite.height`.
|
|
11299
11353
|
*/ function get() {
|
|
11300
|
-
if (this.
|
|
11301
|
-
|
|
11354
|
+
if (this._customHeight !== undefined) {
|
|
11355
|
+
return this._customHeight;
|
|
11356
|
+
} else {
|
|
11357
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
11358
|
+
return this._automaticHeight;
|
|
11302
11359
|
}
|
|
11303
|
-
return this._height;
|
|
11304
11360
|
},
|
|
11305
11361
|
set: function set(value) {
|
|
11306
|
-
if (this.
|
|
11307
|
-
this.
|
|
11362
|
+
if (this._customHeight !== value) {
|
|
11363
|
+
this._customHeight = value;
|
|
11308
11364
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
11309
11365
|
}
|
|
11310
11366
|
}
|
|
@@ -11347,10 +11403,14 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11347
11403
|
set: function set(value) {
|
|
11348
11404
|
var lastSprite = this._sprite;
|
|
11349
11405
|
if (lastSprite !== value) {
|
|
11350
|
-
|
|
11406
|
+
if (lastSprite) {
|
|
11407
|
+
lastSprite._addReferCount(-1);
|
|
11408
|
+
lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
11409
|
+
}
|
|
11410
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
11351
11411
|
if (value) {
|
|
11412
|
+
value._addReferCount(1);
|
|
11352
11413
|
value._updateFlagManager.addListener(this._onSpriteChange);
|
|
11353
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
11354
11414
|
this.shaderData.setTexture(SpriteMask._textureProperty, value.texture);
|
|
11355
11415
|
} else {
|
|
11356
11416
|
this.shaderData.setTexture(SpriteMask._textureProperty, null);
|
|
@@ -11390,10 +11450,16 @@ __decorate([
|
|
|
11390
11450
|
], SpriteMask.prototype, "_sprite", void 0);
|
|
11391
11451
|
__decorate([
|
|
11392
11452
|
ignoreClone
|
|
11393
|
-
], SpriteMask.prototype, "
|
|
11453
|
+
], SpriteMask.prototype, "_automaticWidth", void 0);
|
|
11394
11454
|
__decorate([
|
|
11395
11455
|
ignoreClone
|
|
11396
|
-
], SpriteMask.prototype, "
|
|
11456
|
+
], SpriteMask.prototype, "_automaticHeight", void 0);
|
|
11457
|
+
__decorate([
|
|
11458
|
+
assignmentClone
|
|
11459
|
+
], SpriteMask.prototype, "_customWidth", void 0);
|
|
11460
|
+
__decorate([
|
|
11461
|
+
assignmentClone
|
|
11462
|
+
], SpriteMask.prototype, "_customHeight", void 0);
|
|
11397
11463
|
__decorate([
|
|
11398
11464
|
assignmentClone
|
|
11399
11465
|
], SpriteMask.prototype, "_flipX", void 0);
|
|
@@ -11411,7 +11477,9 @@ var /**
|
|
|
11411
11477
|
*/ SpriteMaskUpdateFlags;
|
|
11412
11478
|
(function(SpriteMaskUpdateFlags) {
|
|
11413
11479
|
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
|
|
11414
|
-
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/**
|
|
11480
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
|
|
11481
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
|
|
11482
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** All. */ "All"] = 0x7] = "All";
|
|
11415
11483
|
})(SpriteMaskUpdateFlags || (SpriteMaskUpdateFlags = {}));
|
|
11416
11484
|
|
|
11417
11485
|
/**
|
|
@@ -11672,14 +11740,11 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11672
11740
|
if (dataOffset === void 0) dataOffset = 0;
|
|
11673
11741
|
this._platformBuffer.getData(data, bufferByteOffset, dataOffset, dataLength);
|
|
11674
11742
|
};
|
|
11675
|
-
|
|
11676
|
-
* @override
|
|
11677
|
-
*/ _proto._rebuild = function _rebuild() {
|
|
11743
|
+
_proto._rebuild = function _rebuild() {
|
|
11678
11744
|
var platformBuffer = this._engine._hardwareRenderer.createPlatformBuffer(this._type, this._byteLength, this._bufferUsage);
|
|
11679
11745
|
this._platformBuffer = platformBuffer;
|
|
11680
11746
|
};
|
|
11681
11747
|
/**
|
|
11682
|
-
* @override
|
|
11683
11748
|
* @internal
|
|
11684
11749
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
11685
11750
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
@@ -11860,10 +11925,11 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11860
11925
|
/**
|
|
11861
11926
|
* @internal
|
|
11862
11927
|
*/ _proto._setVertexBufferBinding = function _setVertexBufferBinding(index, binding) {
|
|
11863
|
-
|
|
11864
|
-
|
|
11865
|
-
|
|
11866
|
-
|
|
11928
|
+
var referCount = this._getReferCount();
|
|
11929
|
+
if (referCount > 0) {
|
|
11930
|
+
var _this__vertexBufferBindings_index;
|
|
11931
|
+
(_this__vertexBufferBindings_index = this._vertexBufferBindings[index]) == null ? void 0 : _this__vertexBufferBindings_index._buffer._addReferCount(-referCount);
|
|
11932
|
+
binding == null ? void 0 : binding._buffer._addReferCount(referCount);
|
|
11867
11933
|
}
|
|
11868
11934
|
this._vertexBufferBindings[index] = binding;
|
|
11869
11935
|
this._bufferStructChanged = true;
|
|
@@ -11874,22 +11940,19 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11874
11940
|
this._platformPrimitive.draw(shaderProgram, subMesh);
|
|
11875
11941
|
this._bufferStructChanged = false;
|
|
11876
11942
|
};
|
|
11877
|
-
|
|
11878
|
-
|
|
11879
|
-
*/ _proto._addReferCount = function _addReferCount(value) {
|
|
11943
|
+
_proto._addReferCount = function _addReferCount(value) {
|
|
11944
|
+
var _this__indexBufferBinding;
|
|
11880
11945
|
GraphicsResource.prototype._addReferCount.call(this, value);
|
|
11881
11946
|
var vertexBufferBindings = this._vertexBufferBindings;
|
|
11882
11947
|
for(var i = 0, n = vertexBufferBindings.length; i < n; i++){
|
|
11883
11948
|
vertexBufferBindings[i]._buffer._addReferCount(value);
|
|
11884
11949
|
}
|
|
11950
|
+
(_this__indexBufferBinding = this._indexBufferBinding) == null ? void 0 : _this__indexBufferBinding._buffer._addReferCount(value);
|
|
11885
11951
|
};
|
|
11886
|
-
|
|
11887
|
-
* @override
|
|
11888
|
-
*/ _proto._rebuild = function _rebuild() {
|
|
11952
|
+
_proto._rebuild = function _rebuild() {
|
|
11889
11953
|
this._engine._hardwareRenderer.createPlatformPrimitive(this);
|
|
11890
11954
|
};
|
|
11891
11955
|
/**
|
|
11892
|
-
* @override
|
|
11893
11956
|
* @internal
|
|
11894
11957
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
11895
11958
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
@@ -11899,14 +11962,23 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11899
11962
|
this._vertexElementMap = null;
|
|
11900
11963
|
this._platformPrimitive.destroy();
|
|
11901
11964
|
};
|
|
11902
|
-
|
|
11965
|
+
/**
|
|
11966
|
+
* @internal
|
|
11967
|
+
*/ _proto._setVertexElements = function _setVertexElements(elements) {
|
|
11903
11968
|
this._clearVertexElements();
|
|
11904
11969
|
for(var i = 0, n = elements.length; i < n; i++){
|
|
11905
11970
|
this._addVertexElement(elements[i]);
|
|
11906
11971
|
}
|
|
11907
11972
|
};
|
|
11908
|
-
|
|
11973
|
+
/**
|
|
11974
|
+
* @internal
|
|
11975
|
+
*/ _proto._setIndexBufferBinding = function _setIndexBufferBinding(binding) {
|
|
11909
11976
|
var lastBinding = this._indexBufferBinding;
|
|
11977
|
+
var referCount = this._getReferCount();
|
|
11978
|
+
if (referCount > 0) {
|
|
11979
|
+
lastBinding == null ? void 0 : lastBinding.buffer._addReferCount(-referCount);
|
|
11980
|
+
binding == null ? void 0 : binding.buffer._addReferCount(referCount);
|
|
11981
|
+
}
|
|
11910
11982
|
if (binding) {
|
|
11911
11983
|
this._indexBufferBinding = binding;
|
|
11912
11984
|
this._glIndexType = BufferUtil._getGLIndexType(binding.format);
|
|
@@ -12222,6 +12294,7 @@ var MeshModifyFlags;
|
|
|
12222
12294
|
var subDataDirtyFlags = this._subDataDirtyFlags;
|
|
12223
12295
|
var blendShapeFloatStride = this._vertexElementCount * 3;
|
|
12224
12296
|
var blendShapeByteStride = blendShapeFloatStride * 4;
|
|
12297
|
+
var bufferOffset = this._bufferBindingOffset;
|
|
12225
12298
|
// @todo: should fix bug when dataChangedFlag is true
|
|
12226
12299
|
for(var i = 0, n = blendShapes.length; i < n; i++){
|
|
12227
12300
|
var dataChangedFlag = subDataDirtyFlags[i];
|
|
@@ -12239,7 +12312,7 @@ var MeshModifyFlags;
|
|
|
12239
12312
|
var offset = indexInBuffer * blendShapeFloatStride;
|
|
12240
12313
|
var storeInfo = storeInfos[i];
|
|
12241
12314
|
storeInfo || (storeInfos[i] = storeInfo = new engineMath.Vector2());
|
|
12242
|
-
storeInfo.set(
|
|
12315
|
+
storeInfo.set(bufferOffset + bufferIndex, indexInBuffer * blendShapeByteStride); // BufferOffset is mesh vertexBuffer offset
|
|
12243
12316
|
var deltaPositions = endFrame.deltaPositions;
|
|
12244
12317
|
for(var j = 0; j < vertexCount; j++){
|
|
12245
12318
|
var start = offset + bufferFloatStride * j;
|
|
@@ -13044,7 +13117,6 @@ var MeshModifyFlags;
|
|
|
13044
13117
|
this.setTangents(tangents);
|
|
13045
13118
|
};
|
|
13046
13119
|
/**
|
|
13047
|
-
* @override
|
|
13048
13120
|
* @internal
|
|
13049
13121
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
13050
13122
|
Mesh.prototype._onDestroy.call(this);
|
|
@@ -13517,28 +13589,30 @@ var VertexChangedFlags;
|
|
|
13517
13589
|
function MeshRenderer(entity) {
|
|
13518
13590
|
var _this;
|
|
13519
13591
|
_this = Renderer.call(this, entity) || this;
|
|
13592
|
+
_this._enableVertexColor = false;
|
|
13520
13593
|
_this._onMeshChanged = _this._onMeshChanged.bind(_assert_this_initialized(_this));
|
|
13521
13594
|
return _this;
|
|
13522
13595
|
}
|
|
13523
13596
|
var _proto = MeshRenderer.prototype;
|
|
13524
13597
|
/**
|
|
13525
13598
|
* @internal
|
|
13526
|
-
* @override
|
|
13527
13599
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
13528
13600
|
Renderer.prototype._onDestroy.call(this);
|
|
13529
13601
|
var mesh = this._mesh;
|
|
13530
13602
|
if (mesh && !mesh.destroyed) {
|
|
13531
13603
|
mesh._addReferCount(-1);
|
|
13604
|
+
mesh._updateFlagManager.removeListener(this._onMeshChanged);
|
|
13532
13605
|
this._mesh = null;
|
|
13533
13606
|
}
|
|
13534
13607
|
};
|
|
13535
13608
|
/**
|
|
13536
13609
|
* @internal
|
|
13537
13610
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
13611
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
13538
13612
|
target.mesh = this._mesh;
|
|
13539
13613
|
};
|
|
13540
13614
|
/**
|
|
13541
|
-
* @
|
|
13615
|
+
* @internal
|
|
13542
13616
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
13543
13617
|
var mesh = this._mesh;
|
|
13544
13618
|
if (mesh) {
|
|
@@ -13551,7 +13625,7 @@ var VertexChangedFlags;
|
|
|
13551
13625
|
}
|
|
13552
13626
|
};
|
|
13553
13627
|
/**
|
|
13554
|
-
* @
|
|
13628
|
+
* @internal
|
|
13555
13629
|
*/ _proto._render = function _render(context) {
|
|
13556
13630
|
var mesh = this._mesh;
|
|
13557
13631
|
if (mesh) {
|
|
@@ -13562,7 +13636,7 @@ var VertexChangedFlags;
|
|
|
13562
13636
|
shaderData.disableMacro(MeshRenderer._uv1Macro);
|
|
13563
13637
|
shaderData.disableMacro(MeshRenderer._normalMacro);
|
|
13564
13638
|
shaderData.disableMacro(MeshRenderer._tangentMacro);
|
|
13565
|
-
shaderData.disableMacro(MeshRenderer.
|
|
13639
|
+
shaderData.disableMacro(MeshRenderer._enableVertexColorMacro);
|
|
13566
13640
|
for(var i = 0, n = vertexElements.length; i < n; i++){
|
|
13567
13641
|
switch(vertexElements[i].semantic){
|
|
13568
13642
|
case "TEXCOORD_0":
|
|
@@ -13578,7 +13652,7 @@ var VertexChangedFlags;
|
|
|
13578
13652
|
shaderData.enableMacro(MeshRenderer._tangentMacro);
|
|
13579
13653
|
break;
|
|
13580
13654
|
case "COLOR_0":
|
|
13581
|
-
shaderData.enableMacro(MeshRenderer.
|
|
13655
|
+
this._enableVertexColor && shaderData.enableMacro(MeshRenderer._enableVertexColorMacro);
|
|
13582
13656
|
break;
|
|
13583
13657
|
}
|
|
13584
13658
|
}
|
|
@@ -13629,6 +13703,20 @@ var VertexChangedFlags;
|
|
|
13629
13703
|
this._setMesh(value);
|
|
13630
13704
|
}
|
|
13631
13705
|
}
|
|
13706
|
+
},
|
|
13707
|
+
{
|
|
13708
|
+
key: "enableVertexColor",
|
|
13709
|
+
get: /**
|
|
13710
|
+
* Whether enable vertex color.
|
|
13711
|
+
*/ function get() {
|
|
13712
|
+
return this._enableVertexColor;
|
|
13713
|
+
},
|
|
13714
|
+
set: function set(value) {
|
|
13715
|
+
if (value !== this._enableVertexColor) {
|
|
13716
|
+
this._dirtyUpdateFlag |= 0x2;
|
|
13717
|
+
this._enableVertexColor = value;
|
|
13718
|
+
}
|
|
13719
|
+
}
|
|
13632
13720
|
}
|
|
13633
13721
|
]);
|
|
13634
13722
|
return MeshRenderer;
|
|
@@ -13646,7 +13734,7 @@ var VertexChangedFlags;
|
|
|
13646
13734
|
MeshRenderer._tangentMacro = ShaderMacro.getByName("RENDERER_HAS_TANGENT");
|
|
13647
13735
|
})();
|
|
13648
13736
|
(function() {
|
|
13649
|
-
MeshRenderer.
|
|
13737
|
+
MeshRenderer._enableVertexColorMacro = ShaderMacro.getByName("RENDERER_ENABLE_VERTEXCOLOR");
|
|
13650
13738
|
})();
|
|
13651
13739
|
__decorate([
|
|
13652
13740
|
ignoreClone
|
|
@@ -13678,7 +13766,7 @@ var /**
|
|
|
13678
13766
|
// Limit size to 256 to avoid some problem:
|
|
13679
13767
|
// 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!
|
|
13680
13768
|
// 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.
|
|
13681
|
-
maxVertexUniformVectors = Math.min(maxVertexUniformVectors,
|
|
13769
|
+
maxVertexUniformVectors = Math.min(maxVertexUniformVectors, rhi._options._maxAllowSkinUniformVectorCount);
|
|
13682
13770
|
_this._maxVertexUniformVectors = maxVertexUniformVectors;
|
|
13683
13771
|
_this._onLocalBoundsChanged = _this._onLocalBoundsChanged.bind(_assert_this_initialized(_this));
|
|
13684
13772
|
var localBounds = _this._localBounds;
|
|
@@ -13714,7 +13802,7 @@ var /**
|
|
|
13714
13802
|
}
|
|
13715
13803
|
};
|
|
13716
13804
|
/**
|
|
13717
|
-
* @
|
|
13805
|
+
* @internal
|
|
13718
13806
|
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
13719
13807
|
var entity = this.entity;
|
|
13720
13808
|
var worldMatrix = this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
|
|
@@ -13741,6 +13829,7 @@ var /**
|
|
|
13741
13829
|
(_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
|
|
13742
13830
|
this._jointTexture = new Texture2D(engine, 4, jointCount, exports.TextureFormat.R32G32B32A32, false);
|
|
13743
13831
|
this._jointTexture.filterMode = exports.TextureFilterMode.Point;
|
|
13832
|
+
this._jointTexture.isGCIgnored = true;
|
|
13744
13833
|
}
|
|
13745
13834
|
shaderData.disableMacro("RENDERER_JOINTS_NUM");
|
|
13746
13835
|
shaderData.enableMacro("RENDERER_USE_JOINT_TEXTURE");
|
|
@@ -13766,17 +13855,25 @@ var /**
|
|
|
13766
13855
|
};
|
|
13767
13856
|
/**
|
|
13768
13857
|
* @internal
|
|
13858
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
13859
|
+
var _this_rootBone, _this__jointTexture;
|
|
13860
|
+
MeshRenderer.prototype._onDestroy.call(this);
|
|
13861
|
+
(_this_rootBone = this.rootBone) == null ? void 0 : _this_rootBone.transform._updateFlagManager.removeListener(this._onTransformChanged);
|
|
13862
|
+
(_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
|
|
13863
|
+
};
|
|
13864
|
+
/**
|
|
13865
|
+
* @internal
|
|
13769
13866
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
13770
13867
|
MeshRenderer.prototype._cloneTo.call(this, target);
|
|
13771
13868
|
this._blendShapeWeights && (target._blendShapeWeights = this._blendShapeWeights.slice());
|
|
13772
13869
|
};
|
|
13773
13870
|
/**
|
|
13774
|
-
* @
|
|
13871
|
+
* @internal
|
|
13775
13872
|
*/ _proto._registerEntityTransformListener = function _registerEntityTransformListener() {
|
|
13776
13873
|
// Cancel register listener to entity transform.
|
|
13777
13874
|
};
|
|
13778
13875
|
/**
|
|
13779
|
-
* @
|
|
13876
|
+
* @internal
|
|
13780
13877
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
13781
13878
|
if (this._rootBone) {
|
|
13782
13879
|
var localBounds = this._localBounds;
|
|
@@ -13997,9 +14094,7 @@ __decorate([
|
|
|
13997
14094
|
return _this;
|
|
13998
14095
|
}
|
|
13999
14096
|
var _proto = PrimitiveMeshRestorer.prototype;
|
|
14000
|
-
|
|
14001
|
-
* @override
|
|
14002
|
-
*/ _proto.restoreContent = function restoreContent() {
|
|
14097
|
+
_proto.restoreContent = function restoreContent() {
|
|
14003
14098
|
var primitiveInfo = this.primitiveInfo;
|
|
14004
14099
|
switch(primitiveInfo.type){
|
|
14005
14100
|
case 0:
|
|
@@ -14059,7 +14154,6 @@ var PrimitiveType;
|
|
|
14059
14154
|
_this = PrimitiveRestoreInfo.call(this, 0, noLongerAccessible) || this;
|
|
14060
14155
|
_this.radius = radius;
|
|
14061
14156
|
_this.segments = segments;
|
|
14062
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
14063
14157
|
return _this;
|
|
14064
14158
|
}
|
|
14065
14159
|
return SphereRestoreInfo;
|
|
@@ -14074,7 +14168,6 @@ var PrimitiveType;
|
|
|
14074
14168
|
_this.width = width;
|
|
14075
14169
|
_this.height = height;
|
|
14076
14170
|
_this.depth = depth;
|
|
14077
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
14078
14171
|
return _this;
|
|
14079
14172
|
}
|
|
14080
14173
|
return CuboidRestoreInfo;
|
|
@@ -14090,7 +14183,6 @@ var PrimitiveType;
|
|
|
14090
14183
|
_this.height = height;
|
|
14091
14184
|
_this.horizontalSegments = horizontalSegments;
|
|
14092
14185
|
_this.verticalSegments = verticalSegments;
|
|
14093
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
14094
14186
|
return _this;
|
|
14095
14187
|
}
|
|
14096
14188
|
return PlaneRestoreInfo;
|
|
@@ -14107,7 +14199,6 @@ var PrimitiveType;
|
|
|
14107
14199
|
_this.height = height;
|
|
14108
14200
|
_this.radialSegments = radialSegments;
|
|
14109
14201
|
_this.heightSegments = heightSegments;
|
|
14110
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
14111
14202
|
return _this;
|
|
14112
14203
|
}
|
|
14113
14204
|
return CylinderRestoreInfo;
|
|
@@ -14124,7 +14215,6 @@ var PrimitiveType;
|
|
|
14124
14215
|
_this.radialSegments = radialSegments;
|
|
14125
14216
|
_this.tubularSegments = tubularSegments;
|
|
14126
14217
|
_this.arc = arc;
|
|
14127
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
14128
14218
|
return _this;
|
|
14129
14219
|
}
|
|
14130
14220
|
return TorusRestoreInfo;
|
|
@@ -14140,7 +14230,6 @@ var PrimitiveType;
|
|
|
14140
14230
|
_this.height = height;
|
|
14141
14231
|
_this.radialSegments = radialSegments;
|
|
14142
14232
|
_this.heightSegments = heightSegments;
|
|
14143
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
14144
14233
|
return _this;
|
|
14145
14234
|
}
|
|
14146
14235
|
return ConeRestoreInfo;
|
|
@@ -14156,7 +14245,6 @@ var PrimitiveType;
|
|
|
14156
14245
|
_this.height = height;
|
|
14157
14246
|
_this.radialSegments = radialSegments;
|
|
14158
14247
|
_this.heightSegments = heightSegments;
|
|
14159
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
14160
14248
|
return _this;
|
|
14161
14249
|
}
|
|
14162
14250
|
return CapsuleRestoreInfo;
|
|
@@ -15239,14 +15327,17 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
|
|
|
15239
15327
|
_proto._createMesh = function _createMesh(engine, index) {
|
|
15240
15328
|
var MAX_VERTEX_COUNT = Basic2DBatcher.MAX_VERTEX_COUNT;
|
|
15241
15329
|
var mesh = new BufferMesh(engine, "BufferMesh" + index);
|
|
15330
|
+
mesh.isGCIgnored = true;
|
|
15242
15331
|
var vertexElements = [];
|
|
15243
15332
|
var vertexStride = this.createVertexElements(vertexElements);
|
|
15244
15333
|
// vertices
|
|
15245
|
-
this._vertexBuffers[index] = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * 4 * vertexStride, exports.BufferUsage.Dynamic);
|
|
15334
|
+
var vertexBuffer = this._vertexBuffers[index] = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * 4 * vertexStride, exports.BufferUsage.Dynamic);
|
|
15335
|
+
vertexBuffer.isGCIgnored = true;
|
|
15246
15336
|
// indices
|
|
15247
|
-
this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 3, exports.BufferUsage.Dynamic);
|
|
15248
|
-
|
|
15249
|
-
mesh.
|
|
15337
|
+
var indiceBuffer = this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 2 * 3, exports.BufferUsage.Dynamic);
|
|
15338
|
+
indiceBuffer.isGCIgnored = true;
|
|
15339
|
+
mesh.setVertexBufferBinding(vertexBuffer, vertexStride);
|
|
15340
|
+
mesh.setIndexBufferBinding(indiceBuffer, exports.IndexFormat.UInt16);
|
|
15250
15341
|
mesh.setVertexElements(vertexElements);
|
|
15251
15342
|
return mesh;
|
|
15252
15343
|
};
|
|
@@ -15530,6 +15621,12 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
15530
15621
|
var _proto = Sky.prototype;
|
|
15531
15622
|
/**
|
|
15532
15623
|
* @internal
|
|
15624
|
+
*/ _proto.destroy = function destroy() {
|
|
15625
|
+
this.mesh = null;
|
|
15626
|
+
this.material = null;
|
|
15627
|
+
};
|
|
15628
|
+
/**
|
|
15629
|
+
* @internal
|
|
15533
15630
|
*/ _proto._render = function _render(context) {
|
|
15534
15631
|
var _this = this, material = _this.material, mesh = _this.mesh;
|
|
15535
15632
|
if (!material) {
|
|
@@ -15570,6 +15667,40 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
15570
15667
|
rhi.drawPrimitive(mesh, mesh.subMesh, program);
|
|
15571
15668
|
cameraShaderData.setMatrix(RenderContext.vpMatrixProperty, originViewProjMatrix);
|
|
15572
15669
|
};
|
|
15670
|
+
_create_class(Sky, [
|
|
15671
|
+
{
|
|
15672
|
+
key: "material",
|
|
15673
|
+
get: /**
|
|
15674
|
+
* Material of the sky.
|
|
15675
|
+
*/ function get() {
|
|
15676
|
+
return this._material;
|
|
15677
|
+
},
|
|
15678
|
+
set: function set(value) {
|
|
15679
|
+
if (this._material !== value) {
|
|
15680
|
+
var _this__material;
|
|
15681
|
+
value == null ? void 0 : value._addReferCount(1);
|
|
15682
|
+
(_this__material = this._material) == null ? void 0 : _this__material._addReferCount(-1);
|
|
15683
|
+
this._material = value;
|
|
15684
|
+
}
|
|
15685
|
+
}
|
|
15686
|
+
},
|
|
15687
|
+
{
|
|
15688
|
+
key: "mesh",
|
|
15689
|
+
get: /**
|
|
15690
|
+
* Mesh of the sky.
|
|
15691
|
+
*/ function get() {
|
|
15692
|
+
return this._mesh;
|
|
15693
|
+
},
|
|
15694
|
+
set: function set(value) {
|
|
15695
|
+
if (this._mesh !== value) {
|
|
15696
|
+
var _this__mesh;
|
|
15697
|
+
value == null ? void 0 : value._addReferCount(1);
|
|
15698
|
+
(_this__mesh = this._mesh) == null ? void 0 : _this__mesh._addReferCount(-1);
|
|
15699
|
+
this._mesh = value;
|
|
15700
|
+
}
|
|
15701
|
+
}
|
|
15702
|
+
}
|
|
15703
|
+
]);
|
|
15573
15704
|
return Sky;
|
|
15574
15705
|
}();
|
|
15575
15706
|
(function() {
|
|
@@ -15605,9 +15736,19 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
15605
15736
|
var _proto = Background.prototype;
|
|
15606
15737
|
/**
|
|
15607
15738
|
* @internal
|
|
15739
|
+
*/ _proto.destroy = function destroy() {
|
|
15740
|
+
this._mesh._addReferCount(-1);
|
|
15741
|
+
this._mesh = null;
|
|
15742
|
+
this.texture = null;
|
|
15743
|
+
this.solidColor = null;
|
|
15744
|
+
this.sky.destroy();
|
|
15745
|
+
};
|
|
15746
|
+
/**
|
|
15747
|
+
* @internal
|
|
15608
15748
|
* Standalone for CanvasRenderer plugin.
|
|
15609
15749
|
*/ _proto._initMesh = function _initMesh(engine) {
|
|
15610
15750
|
this._mesh = this._createPlane(engine);
|
|
15751
|
+
this._mesh._addReferCount(1);
|
|
15611
15752
|
};
|
|
15612
15753
|
/**
|
|
15613
15754
|
* @internal
|
|
@@ -15679,6 +15820,9 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
15679
15820
|
},
|
|
15680
15821
|
set: function set(value) {
|
|
15681
15822
|
if (this._texture !== value) {
|
|
15823
|
+
var _this__texture;
|
|
15824
|
+
value == null ? void 0 : value._addReferCount(1);
|
|
15825
|
+
(_this__texture = this._texture) == null ? void 0 : _this__texture._addReferCount(-1);
|
|
15682
15826
|
this._texture = value;
|
|
15683
15827
|
this._engine._backgroundTextureMaterial.shaderData.setTexture("material_BaseTexture", value);
|
|
15684
15828
|
}
|
|
@@ -16156,7 +16300,7 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
16156
16300
|
var sunLightIndex = lightManager._getSunLightIndex();
|
|
16157
16301
|
if (sunLightIndex !== -1) {
|
|
16158
16302
|
var sunlight = lightManager._directLights.get(sunLightIndex);
|
|
16159
|
-
shaderData.setColor(Scene._sunlightColorProperty, sunlight.
|
|
16303
|
+
shaderData.setColor(Scene._sunlightColorProperty, sunlight._getLightIntensityColor());
|
|
16160
16304
|
shaderData.setVector3(Scene._sunlightDirectionProperty, sunlight.direction);
|
|
16161
16305
|
this._sunLight = sunlight;
|
|
16162
16306
|
}
|
|
@@ -16187,6 +16331,7 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
16187
16331
|
this._rootEntities[0].destroy();
|
|
16188
16332
|
}
|
|
16189
16333
|
this._activeCameras.length = 0;
|
|
16334
|
+
this.background.destroy();
|
|
16190
16335
|
this.shaderData._addReferCount(-1);
|
|
16191
16336
|
};
|
|
16192
16337
|
_proto._addToRootEntityList = function _addToRootEntityList(index, rootEntity) {
|
|
@@ -16644,7 +16789,7 @@ ShaderPool.init();
|
|
|
16644
16789
|
_this._spriteDefaultMaterial = _this._createSpriteMaterial();
|
|
16645
16790
|
_this._spriteMaskDefaultMaterial = _this._createSpriteMaskMaterial();
|
|
16646
16791
|
_this._textDefaultFont = Font.createFromOS(_assert_this_initialized(_this), "Arial");
|
|
16647
|
-
_this._textDefaultFont.isGCIgnored =
|
|
16792
|
+
_this._textDefaultFont.isGCIgnored = true;
|
|
16648
16793
|
_this.inputManager = new InputManager(_assert_this_initialized(_this));
|
|
16649
16794
|
_this._initMagentaTextures(hardwareRenderer);
|
|
16650
16795
|
if (!hardwareRenderer.canIUse(exports.GLCapabilityType.depthTexture)) {
|
|
@@ -16655,6 +16800,7 @@ ShaderPool.init();
|
|
|
16655
16800
|
_this._depthTexture2D = depthTexture2D;
|
|
16656
16801
|
}
|
|
16657
16802
|
var magentaMaterial = new Material(_assert_this_initialized(_this), Shader.find("unlit"));
|
|
16803
|
+
magentaMaterial.isGCIgnored = true;
|
|
16658
16804
|
magentaMaterial.shaderData.setColor("material_BaseColor", new Color(1.0, 0.0, 1.01, 1.0));
|
|
16659
16805
|
_this._magentaMaterial = magentaMaterial;
|
|
16660
16806
|
var backgroundTextureMaterial = new Material(_assert_this_initialized(_this), Shader.find("background-texture"));
|
|
@@ -16881,7 +17027,9 @@ ShaderPool.init();
|
|
|
16881
17027
|
this._magentaTexture2DArray = magentaTexture2DArray;
|
|
16882
17028
|
}
|
|
16883
17029
|
};
|
|
16884
|
-
|
|
17030
|
+
/**
|
|
17031
|
+
* @internal
|
|
17032
|
+
*/ _proto._initialize = function _initialize(configuration) {
|
|
16885
17033
|
var _this = this;
|
|
16886
17034
|
var physics = configuration.physics;
|
|
16887
17035
|
if (physics) {
|
|
@@ -17150,14 +17298,12 @@ ShaderPool.init();
|
|
|
17150
17298
|
/**
|
|
17151
17299
|
* @internal
|
|
17152
17300
|
* @inheritDoc
|
|
17153
|
-
* @override
|
|
17154
17301
|
*/ _proto._onAwake = function _onAwake() {
|
|
17155
17302
|
this.onAwake();
|
|
17156
17303
|
};
|
|
17157
17304
|
/**
|
|
17158
17305
|
* @internal
|
|
17159
17306
|
* @inheritDoc
|
|
17160
|
-
* @override
|
|
17161
17307
|
*/ _proto._onEnable = function _onEnable() {
|
|
17162
17308
|
if (this._waitHandlingInValid) {
|
|
17163
17309
|
this._waitHandlingInValid = false;
|
|
@@ -17183,7 +17329,6 @@ ShaderPool.init();
|
|
|
17183
17329
|
/**
|
|
17184
17330
|
* @internal
|
|
17185
17331
|
* @inheritDoc
|
|
17186
|
-
* @override
|
|
17187
17332
|
*/ _proto._onDisable = function _onDisable() {
|
|
17188
17333
|
this._waitHandlingInValid = true;
|
|
17189
17334
|
this._engine._componentsManager.addDisableScript(this);
|
|
@@ -17207,7 +17352,6 @@ ShaderPool.init();
|
|
|
17207
17352
|
this._waitHandlingInValid = false;
|
|
17208
17353
|
};
|
|
17209
17354
|
/**
|
|
17210
|
-
* @override
|
|
17211
17355
|
* @internal
|
|
17212
17356
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
17213
17357
|
Component.prototype._onDestroy.call(this);
|
|
@@ -18159,7 +18303,7 @@ var /**
|
|
|
18159
18303
|
// prepare render target
|
|
18160
18304
|
var renderTarget = this._getAvailableRenderTarget();
|
|
18161
18305
|
// @todo: shouldn't set viewport and scissor in activeRenderTarget
|
|
18162
|
-
rhi.activeRenderTarget(renderTarget,
|
|
18306
|
+
rhi.activeRenderTarget(renderTarget, CascadedShadowCasterPass._viewport, 0);
|
|
18163
18307
|
if (this._supportDepthTexture) {
|
|
18164
18308
|
rhi.clearRenderTarget(engine, exports.CameraClearFlags.Depth, null);
|
|
18165
18309
|
} else {
|
|
@@ -18281,11 +18425,13 @@ var /**
|
|
|
18281
18425
|
if (engine._hardwareRenderer._isWebGL2) {
|
|
18282
18426
|
depthTexture.depthCompareFunction = exports.TextureDepthCompareFunction.Less;
|
|
18283
18427
|
}
|
|
18428
|
+
renderTarget == null ? void 0 : renderTarget._addReferCount(-1);
|
|
18284
18429
|
if (this._supportDepthTexture) {
|
|
18285
18430
|
renderTarget = this._renderTargets = new RenderTarget(engine, width, height, null, depthTexture);
|
|
18286
18431
|
} else {
|
|
18287
18432
|
renderTarget = this._renderTargets = new RenderTarget(engine, width, height, depthTexture);
|
|
18288
18433
|
}
|
|
18434
|
+
renderTarget._addReferCount(1);
|
|
18289
18435
|
}
|
|
18290
18436
|
return renderTarget;
|
|
18291
18437
|
};
|
|
@@ -18308,7 +18454,12 @@ var /**
|
|
|
18308
18454
|
var height = shadowCascades == exports.ShadowCascadesMode.TwoCascades ? shadowTileResolution : shadowTileResolution * 2;
|
|
18309
18455
|
this._shadowMapSize.set(1.0 / width, 1.0 / height, width, height);
|
|
18310
18456
|
}
|
|
18311
|
-
this._renderTargets
|
|
18457
|
+
var renderTargets = this._renderTargets;
|
|
18458
|
+
if (renderTargets) {
|
|
18459
|
+
renderTargets._addReferCount(-1);
|
|
18460
|
+
renderTargets.destroy();
|
|
18461
|
+
this._renderTargets = null;
|
|
18462
|
+
}
|
|
18312
18463
|
var viewportOffset = this._viewportOffsets;
|
|
18313
18464
|
var shadowTileResolution1 = this._shadowTileResolution;
|
|
18314
18465
|
switch(shadowCascades){
|
|
@@ -18364,6 +18515,9 @@ var /**
|
|
|
18364
18515
|
(function() {
|
|
18365
18516
|
CascadedShadowCasterPass._cascadesSplitDistance = new Array(CascadedShadowCasterPass._maxCascades + 1);
|
|
18366
18517
|
})();
|
|
18518
|
+
(function() {
|
|
18519
|
+
CascadedShadowCasterPass._viewport = new engineMath.Vector4(0, 0, 1, 1);
|
|
18520
|
+
})();
|
|
18367
18521
|
(function() {
|
|
18368
18522
|
CascadedShadowCasterPass._clearColor = new engineMath.Color(1, 1, 1, 1);
|
|
18369
18523
|
})();
|
|
@@ -18882,19 +19036,17 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
18882
19036
|
this._replacementSubShaderTag = null;
|
|
18883
19037
|
};
|
|
18884
19038
|
/**
|
|
18885
|
-
* @override
|
|
18886
19039
|
* @inheritdoc
|
|
18887
19040
|
*/ _proto._onEnable = function _onEnable() {
|
|
18888
19041
|
this.entity.scene._attachRenderCamera(this);
|
|
18889
19042
|
};
|
|
18890
19043
|
/**
|
|
18891
|
-
* @override
|
|
18892
19044
|
* @inheritdoc
|
|
18893
19045
|
*/ _proto._onDisable = function _onDisable() {
|
|
18894
19046
|
this.entity.scene._detachRenderCamera(this);
|
|
18895
19047
|
};
|
|
18896
19048
|
/**
|
|
18897
|
-
* @
|
|
19049
|
+
* @internal
|
|
18898
19050
|
* @inheritdoc
|
|
18899
19051
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
18900
19052
|
var _this__renderPipeline;
|
|
@@ -19100,7 +19252,12 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
19100
19252
|
return this._renderTarget;
|
|
19101
19253
|
},
|
|
19102
19254
|
set: function set(value) {
|
|
19103
|
-
this._renderTarget
|
|
19255
|
+
if (this._renderTarget !== value) {
|
|
19256
|
+
var _this__renderTarget;
|
|
19257
|
+
value == null ? void 0 : value._addReferCount(1);
|
|
19258
|
+
(_this__renderTarget = this._renderTarget) == null ? void 0 : _this__renderTarget._addReferCount(-1);
|
|
19259
|
+
this._renderTarget = value;
|
|
19260
|
+
}
|
|
19104
19261
|
}
|
|
19105
19262
|
}
|
|
19106
19263
|
]);
|
|
@@ -19458,7 +19615,6 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19458
19615
|
}
|
|
19459
19616
|
};
|
|
19460
19617
|
/**
|
|
19461
|
-
* @override
|
|
19462
19618
|
* Clone and return the instance.
|
|
19463
19619
|
*/ _proto.clone = function clone() {
|
|
19464
19620
|
var dest = new BaseMaterial(this._engine, this.shader);
|
|
@@ -19466,7 +19622,6 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19466
19622
|
return dest;
|
|
19467
19623
|
};
|
|
19468
19624
|
/**
|
|
19469
|
-
* @override
|
|
19470
19625
|
* Clone to the target material.
|
|
19471
19626
|
* @param target - target material
|
|
19472
19627
|
*/ _proto.cloneTo = function cloneTo(target) {
|
|
@@ -19627,8 +19782,8 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19627
19782
|
var _this;
|
|
19628
19783
|
_this = BaseMaterial.call(this, engine, Shader.find("blinn-phong")) || this;
|
|
19629
19784
|
var shaderData = _this.shaderData;
|
|
19630
|
-
shaderData.enableMacro("
|
|
19631
|
-
shaderData.enableMacro("
|
|
19785
|
+
shaderData.enableMacro("MATERIAL_NEED_WORLD_POS");
|
|
19786
|
+
shaderData.enableMacro("MATERIAL_NEED_TILING_OFFSET");
|
|
19632
19787
|
shaderData.setColor(BlinnPhongMaterial._baseColorProp, new engineMath.Color(1, 1, 1, 1));
|
|
19633
19788
|
shaderData.setColor(BlinnPhongMaterial._specularColorProp, new engineMath.Color(1, 1, 1, 1));
|
|
19634
19789
|
shaderData.setColor(BlinnPhongMaterial._emissiveColorProp, new engineMath.Color(0, 0, 0, 1));
|
|
@@ -19638,9 +19793,7 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19638
19793
|
return _this;
|
|
19639
19794
|
}
|
|
19640
19795
|
var _proto = BlinnPhongMaterial.prototype;
|
|
19641
|
-
|
|
19642
|
-
* @override
|
|
19643
|
-
*/ _proto.clone = function clone() {
|
|
19796
|
+
_proto.clone = function clone() {
|
|
19644
19797
|
var dest = new BlinnPhongMaterial(this._engine);
|
|
19645
19798
|
this.cloneTo(dest);
|
|
19646
19799
|
return dest;
|
|
@@ -19823,8 +19976,8 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19823
19976
|
var _this;
|
|
19824
19977
|
_this = BaseMaterial.call(this, engine, shader) || this;
|
|
19825
19978
|
var shaderData = _this.shaderData;
|
|
19826
|
-
shaderData.enableMacro("
|
|
19827
|
-
shaderData.enableMacro("
|
|
19979
|
+
shaderData.enableMacro("MATERIAL_NEED_WORLD_POS");
|
|
19980
|
+
shaderData.enableMacro("MATERIAL_NEED_TILING_OFFSET");
|
|
19828
19981
|
shaderData.setColor(PBRBaseMaterial._baseColorProp, new engineMath.Color(1, 1, 1, 1));
|
|
19829
19982
|
shaderData.setColor(PBRBaseMaterial._emissiveColorProp, new engineMath.Color(0, 0, 0, 1));
|
|
19830
19983
|
shaderData.setVector4(PBRBaseMaterial._tilingOffsetProp, new engineMath.Vector4(1, 1, 0, 0));
|
|
@@ -19933,9 +20086,9 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19933
20086
|
set: function set(value) {
|
|
19934
20087
|
this.shaderData.setTexture(PBRBaseMaterial._occlusionTextureProp, value);
|
|
19935
20088
|
if (value) {
|
|
19936
|
-
this.shaderData.enableMacro("
|
|
20089
|
+
this.shaderData.enableMacro("MATERIAL_HAS_OCCLUSION_TEXTURE");
|
|
19937
20090
|
} else {
|
|
19938
|
-
this.shaderData.disableMacro("
|
|
20091
|
+
this.shaderData.disableMacro("MATERIAL_HAS_OCCLUSION_TEXTURE");
|
|
19939
20092
|
}
|
|
19940
20093
|
}
|
|
19941
20094
|
},
|
|
@@ -19989,9 +20142,9 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19989
20142
|
set: function set(value) {
|
|
19990
20143
|
if (!!this.shaderData.getFloat(PBRBaseMaterial._clearCoatProp) !== !!value) {
|
|
19991
20144
|
if (value === 0) {
|
|
19992
|
-
this.shaderData.disableMacro("
|
|
20145
|
+
this.shaderData.disableMacro("MATERIAL_ENABLE_CLEAR_COAT");
|
|
19993
20146
|
} else {
|
|
19994
|
-
this.shaderData.enableMacro("
|
|
20147
|
+
this.shaderData.enableMacro("MATERIAL_ENABLE_CLEAR_COAT");
|
|
19995
20148
|
}
|
|
19996
20149
|
}
|
|
19997
20150
|
this.shaderData.setFloat(PBRBaseMaterial._clearCoatProp, value);
|
|
@@ -20007,9 +20160,9 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20007
20160
|
set: function set(value) {
|
|
20008
20161
|
this.shaderData.setTexture(PBRBaseMaterial._clearCoatTextureProp, value);
|
|
20009
20162
|
if (value) {
|
|
20010
|
-
this.shaderData.enableMacro("
|
|
20163
|
+
this.shaderData.enableMacro("MATERIAL_HAS_CLEAR_COAT_TEXTURE");
|
|
20011
20164
|
} else {
|
|
20012
|
-
this.shaderData.disableMacro("
|
|
20165
|
+
this.shaderData.disableMacro("MATERIAL_HAS_CLEAR_COAT_TEXTURE");
|
|
20013
20166
|
}
|
|
20014
20167
|
}
|
|
20015
20168
|
},
|
|
@@ -20034,9 +20187,9 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20034
20187
|
set: function set(value) {
|
|
20035
20188
|
this.shaderData.setTexture(PBRBaseMaterial._clearCoatRoughnessTextureProp, value);
|
|
20036
20189
|
if (value) {
|
|
20037
|
-
this.shaderData.enableMacro("
|
|
20190
|
+
this.shaderData.enableMacro("MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE");
|
|
20038
20191
|
} else {
|
|
20039
|
-
this.shaderData.disableMacro("
|
|
20192
|
+
this.shaderData.disableMacro("MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE");
|
|
20040
20193
|
}
|
|
20041
20194
|
}
|
|
20042
20195
|
},
|
|
@@ -20050,9 +20203,9 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20050
20203
|
set: function set(value) {
|
|
20051
20204
|
this.shaderData.setTexture(PBRBaseMaterial._clearCoatNormalTextureProp, value);
|
|
20052
20205
|
if (value) {
|
|
20053
|
-
this.shaderData.enableMacro("
|
|
20206
|
+
this.shaderData.enableMacro("MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE");
|
|
20054
20207
|
} else {
|
|
20055
|
-
this.shaderData.disableMacro("
|
|
20208
|
+
this.shaderData.disableMacro("MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE");
|
|
20056
20209
|
}
|
|
20057
20210
|
}
|
|
20058
20211
|
}
|
|
@@ -20093,21 +20246,35 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20093
20246
|
_this = PBRBaseMaterial.call(this, engine, Shader.find("pbr")) || this;
|
|
20094
20247
|
_this.shaderData.setFloat(PBRMaterial._metallicProp, 1);
|
|
20095
20248
|
_this.shaderData.setFloat(PBRMaterial._roughnessProp, 1);
|
|
20249
|
+
_this.shaderData.setFloat(PBRMaterial._iorProp, 1.5);
|
|
20096
20250
|
return _this;
|
|
20097
20251
|
}
|
|
20098
20252
|
var _proto = PBRMaterial.prototype;
|
|
20099
20253
|
/**
|
|
20100
|
-
* @
|
|
20254
|
+
* @inheritdoc
|
|
20101
20255
|
*/ _proto.clone = function clone() {
|
|
20102
20256
|
var dest = new PBRMaterial(this._engine);
|
|
20103
20257
|
this.cloneTo(dest);
|
|
20104
20258
|
return dest;
|
|
20105
20259
|
};
|
|
20106
20260
|
_create_class(PBRMaterial, [
|
|
20261
|
+
{
|
|
20262
|
+
key: "ior",
|
|
20263
|
+
get: /**
|
|
20264
|
+
* Index Of Refraction.
|
|
20265
|
+
* @defaultValue `1.5`
|
|
20266
|
+
*/ function get() {
|
|
20267
|
+
return this.shaderData.getFloat(PBRMaterial._iorProp);
|
|
20268
|
+
},
|
|
20269
|
+
set: function set(v) {
|
|
20270
|
+
this.shaderData.setFloat(PBRMaterial._iorProp, Math.max(v, 0));
|
|
20271
|
+
}
|
|
20272
|
+
},
|
|
20107
20273
|
{
|
|
20108
20274
|
key: "metallic",
|
|
20109
20275
|
get: /**
|
|
20110
|
-
* Metallic
|
|
20276
|
+
* Metallic.
|
|
20277
|
+
* @defaultValue `1.0`
|
|
20111
20278
|
*/ function get() {
|
|
20112
20279
|
return this.shaderData.getFloat(PBRMaterial._metallicProp);
|
|
20113
20280
|
},
|
|
@@ -20118,7 +20285,8 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20118
20285
|
{
|
|
20119
20286
|
key: "roughness",
|
|
20120
20287
|
get: /**
|
|
20121
|
-
* Roughness
|
|
20288
|
+
* Roughness. default 1.0.
|
|
20289
|
+
* @defaultValue `1.0`
|
|
20122
20290
|
*/ function get() {
|
|
20123
20291
|
return this.shaderData.getFloat(PBRMaterial._roughnessProp);
|
|
20124
20292
|
},
|
|
@@ -20137,9 +20305,9 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20137
20305
|
set: function set(value) {
|
|
20138
20306
|
this.shaderData.setTexture(PBRMaterial._roughnessMetallicTextureProp, value);
|
|
20139
20307
|
if (value) {
|
|
20140
|
-
this.shaderData.enableMacro("
|
|
20308
|
+
this.shaderData.enableMacro("MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE");
|
|
20141
20309
|
} else {
|
|
20142
|
-
this.shaderData.disableMacro("
|
|
20310
|
+
this.shaderData.disableMacro("MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE");
|
|
20143
20311
|
}
|
|
20144
20312
|
}
|
|
20145
20313
|
}
|
|
@@ -20155,6 +20323,9 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20155
20323
|
(function() {
|
|
20156
20324
|
PBRMaterial._roughnessMetallicTextureProp = ShaderProperty.getByName("material_RoughnessMetallicTexture");
|
|
20157
20325
|
})();
|
|
20326
|
+
(function() {
|
|
20327
|
+
PBRMaterial._iorProp = Shader.getPropertyByName("material_IOR");
|
|
20328
|
+
})();
|
|
20158
20329
|
|
|
20159
20330
|
/**
|
|
20160
20331
|
* PBR (Specular-Glossiness Workflow) Material.
|
|
@@ -20169,7 +20340,7 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20169
20340
|
}
|
|
20170
20341
|
var _proto = PBRSpecularMaterial.prototype;
|
|
20171
20342
|
/**
|
|
20172
|
-
* @
|
|
20343
|
+
* @inheritdoc
|
|
20173
20344
|
*/ _proto.clone = function clone() {
|
|
20174
20345
|
var dest = new PBRSpecularMaterial(this._engine);
|
|
20175
20346
|
this.cloneTo(dest);
|
|
@@ -20231,7 +20402,7 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20231
20402
|
PBRSpecularMaterial._specularGlossinessTextureProp = ShaderProperty.getByName("material_SpecularGlossinessTexture");
|
|
20232
20403
|
})();
|
|
20233
20404
|
(function() {
|
|
20234
|
-
PBRSpecularMaterial._specularGlossinessTextureMacro = ShaderMacro.getByName("
|
|
20405
|
+
PBRSpecularMaterial._specularGlossinessTextureMacro = ShaderMacro.getByName("MATERIAL_HAS_SPECULAR_GLOSSINESS_TEXTURE");
|
|
20235
20406
|
})();
|
|
20236
20407
|
|
|
20237
20408
|
/**
|
|
@@ -20243,14 +20414,14 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20243
20414
|
_this = BaseMaterial.call(this, engine, Shader.find("unlit")) || this;
|
|
20244
20415
|
var shaderData = _this.shaderData;
|
|
20245
20416
|
shaderData.enableMacro("MATERIAL_OMIT_NORMAL");
|
|
20246
|
-
shaderData.enableMacro("
|
|
20417
|
+
shaderData.enableMacro("MATERIAL_NEED_TILING_OFFSET");
|
|
20247
20418
|
shaderData.setColor(UnlitMaterial._baseColorProp, new engineMath.Color(1, 1, 1, 1));
|
|
20248
20419
|
shaderData.setVector4(UnlitMaterial._tilingOffsetProp, new engineMath.Vector4(1, 1, 0, 0));
|
|
20249
20420
|
return _this;
|
|
20250
20421
|
}
|
|
20251
20422
|
var _proto = UnlitMaterial.prototype;
|
|
20252
20423
|
/**
|
|
20253
|
-
* @
|
|
20424
|
+
* @inheritdoc
|
|
20254
20425
|
*/ _proto.clone = function clone() {
|
|
20255
20426
|
var dest = new UnlitMaterial(this._engine);
|
|
20256
20427
|
this.cloneTo(dest);
|
|
@@ -20366,12 +20537,18 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20366
20537
|
* @internal
|
|
20367
20538
|
*/ _proto._addSprite = function _addSprite(sprite) {
|
|
20368
20539
|
this._spriteNamesToIndex[sprite.name] = this._sprites.push(sprite) - 1;
|
|
20540
|
+
sprite._atlas = this;
|
|
20541
|
+
sprite.isGCIgnored = true;
|
|
20369
20542
|
};
|
|
20370
20543
|
/**
|
|
20371
|
-
* @override
|
|
20372
20544
|
* @internal
|
|
20373
20545
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
20374
20546
|
ReferResource.prototype._onDestroy.call(this);
|
|
20547
|
+
var _this = this, sprites = _this._sprites;
|
|
20548
|
+
for(var i = 0, n = sprites.length; i < n; i++){
|
|
20549
|
+
sprites[i].destroy();
|
|
20550
|
+
}
|
|
20551
|
+
sprites.length = 0;
|
|
20375
20552
|
this._sprites = null;
|
|
20376
20553
|
this._spriteNamesToIndex = null;
|
|
20377
20554
|
};
|
|
@@ -20419,8 +20596,10 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20419
20596
|
if (name === void 0) name = null;
|
|
20420
20597
|
var _this;
|
|
20421
20598
|
_this = ReferResource.call(this, engine) || this;
|
|
20422
|
-
_this.
|
|
20423
|
-
_this.
|
|
20599
|
+
_this._automaticWidth = 0;
|
|
20600
|
+
_this._automaticHeight = 0;
|
|
20601
|
+
_this._customWidth = undefined;
|
|
20602
|
+
_this._customHeight = undefined;
|
|
20424
20603
|
_this._positions = [
|
|
20425
20604
|
new engineMath.Vector2(),
|
|
20426
20605
|
new engineMath.Vector2(),
|
|
@@ -20441,7 +20620,7 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20441
20620
|
_this._region = new engineMath.Rect(0, 0, 1, 1);
|
|
20442
20621
|
_this._pivot = new engineMath.Vector2(0.5, 0.5);
|
|
20443
20622
|
_this._border = new engineMath.Vector4(0, 0, 0, 0);
|
|
20444
|
-
_this._dirtyUpdateFlag =
|
|
20623
|
+
_this._dirtyUpdateFlag = 0x7;
|
|
20445
20624
|
/** @internal */ _this._updateFlagManager = new UpdateFlagManager();
|
|
20446
20625
|
_this._texture = texture;
|
|
20447
20626
|
region && _this._region.copyFrom(region);
|
|
@@ -20480,19 +20659,40 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20480
20659
|
return this._bounds;
|
|
20481
20660
|
};
|
|
20482
20661
|
/**
|
|
20483
|
-
* @
|
|
20662
|
+
* @internal
|
|
20663
|
+
*/ _proto._addReferCount = function _addReferCount(value) {
|
|
20664
|
+
var _this__atlas;
|
|
20665
|
+
ReferResource.prototype._addReferCount.call(this, value);
|
|
20666
|
+
(_this__atlas = this._atlas) == null ? void 0 : _this__atlas._addReferCount(value);
|
|
20667
|
+
};
|
|
20668
|
+
/**
|
|
20484
20669
|
* @internal
|
|
20485
20670
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
20486
20671
|
ReferResource.prototype._onDestroy.call(this);
|
|
20672
|
+
this._positions.length = 0;
|
|
20673
|
+
this._positions = null;
|
|
20674
|
+
this._uvs.length = 0;
|
|
20675
|
+
this._uvs = null;
|
|
20676
|
+
this._atlasRegion = null;
|
|
20677
|
+
this._atlasRegionOffset = null;
|
|
20678
|
+
this._region = null;
|
|
20679
|
+
this._pivot = null;
|
|
20680
|
+
this._border = null;
|
|
20681
|
+
this._bounds = null;
|
|
20682
|
+
this._atlas = null;
|
|
20487
20683
|
this._texture = null;
|
|
20684
|
+
this._updateFlagManager = null;
|
|
20488
20685
|
};
|
|
20489
20686
|
_proto._calDefaultSize = function _calDefaultSize() {
|
|
20490
20687
|
if (this._texture) {
|
|
20491
20688
|
var _this = this, _texture = _this._texture, _atlasRegion = _this._atlasRegion, _atlasRegionOffset = _this._atlasRegionOffset, _region = _this._region;
|
|
20492
20689
|
var pixelsPerUnitReciprocal = 1.0 / Engine._pixelsPerUnit;
|
|
20493
|
-
this.
|
|
20494
|
-
this.
|
|
20690
|
+
this._automaticWidth = _texture.width * _atlasRegion.width / (1 - _atlasRegionOffset.x - _atlasRegionOffset.z) * _region.width * pixelsPerUnitReciprocal;
|
|
20691
|
+
this._automaticHeight = _texture.height * _atlasRegion.height / (1 - _atlasRegionOffset.y - _atlasRegionOffset.w) * _region.height * pixelsPerUnitReciprocal;
|
|
20692
|
+
} else {
|
|
20693
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
20495
20694
|
}
|
|
20695
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
20496
20696
|
};
|
|
20497
20697
|
_proto._updatePositions = function _updatePositions() {
|
|
20498
20698
|
var blank = this._atlasRegionOffset;
|
|
@@ -20546,11 +20746,16 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20546
20746
|
};
|
|
20547
20747
|
_proto._dispatchSpriteChange = function _dispatchSpriteChange(type) {
|
|
20548
20748
|
switch(type){
|
|
20749
|
+
case SpriteModifyFlags.texture:
|
|
20750
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
20751
|
+
break;
|
|
20549
20752
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
20550
20753
|
case SpriteModifyFlags.region:
|
|
20551
|
-
this._dirtyUpdateFlag |=
|
|
20754
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
20552
20755
|
break;
|
|
20553
20756
|
case SpriteModifyFlags.atlasRegion:
|
|
20757
|
+
this._dirtyUpdateFlag |= 0x4 | 0x2;
|
|
20758
|
+
break;
|
|
20554
20759
|
case SpriteModifyFlags.border:
|
|
20555
20760
|
this._dirtyUpdateFlag |= 0x2;
|
|
20556
20761
|
break;
|
|
@@ -20569,7 +20774,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20569
20774
|
if (this._texture !== value) {
|
|
20570
20775
|
this._texture = value;
|
|
20571
20776
|
this._dispatchSpriteChange(SpriteModifyFlags.texture);
|
|
20572
|
-
(this.
|
|
20777
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
20778
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
20779
|
+
}
|
|
20573
20780
|
}
|
|
20574
20781
|
}
|
|
20575
20782
|
},
|
|
@@ -20577,13 +20784,21 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20577
20784
|
key: "width",
|
|
20578
20785
|
get: /**
|
|
20579
20786
|
* The width of the sprite (in world coordinates).
|
|
20787
|
+
*
|
|
20788
|
+
* @remarks
|
|
20789
|
+
* If width is set, return the set value,
|
|
20790
|
+
* otherwise return the width calculated according to `Texture.width`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
|
|
20580
20791
|
*/ function get() {
|
|
20581
|
-
this.
|
|
20582
|
-
|
|
20792
|
+
if (this._customWidth !== undefined) {
|
|
20793
|
+
return this._customWidth;
|
|
20794
|
+
} else {
|
|
20795
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
20796
|
+
return this._automaticWidth;
|
|
20797
|
+
}
|
|
20583
20798
|
},
|
|
20584
20799
|
set: function set(value) {
|
|
20585
|
-
if (this.
|
|
20586
|
-
this.
|
|
20800
|
+
if (this._customWidth !== value) {
|
|
20801
|
+
this._customWidth = value;
|
|
20587
20802
|
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
20588
20803
|
}
|
|
20589
20804
|
}
|
|
@@ -20592,13 +20807,21 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20592
20807
|
key: "height",
|
|
20593
20808
|
get: /**
|
|
20594
20809
|
* The height of the sprite (in world coordinates).
|
|
20810
|
+
*
|
|
20811
|
+
* @remarks
|
|
20812
|
+
* If height is set, return the set value,
|
|
20813
|
+
* otherwise return the height calculated according to `Texture.height`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
|
|
20595
20814
|
*/ function get() {
|
|
20596
|
-
this.
|
|
20597
|
-
|
|
20815
|
+
if (this._customHeight !== undefined) {
|
|
20816
|
+
return this._customHeight;
|
|
20817
|
+
} else {
|
|
20818
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
20819
|
+
return this._automaticHeight;
|
|
20820
|
+
}
|
|
20598
20821
|
},
|
|
20599
20822
|
set: function set(value) {
|
|
20600
|
-
if (this.
|
|
20601
|
-
this.
|
|
20823
|
+
if (this._customHeight !== value) {
|
|
20824
|
+
this._customHeight = value;
|
|
20602
20825
|
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
20603
20826
|
}
|
|
20604
20827
|
}
|
|
@@ -20628,7 +20851,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20628
20851
|
var y = engineMath.MathUtil.clamp(value.y, 0, 1);
|
|
20629
20852
|
this._atlasRegion.set(x, y, engineMath.MathUtil.clamp(value.width, 0, 1 - x), engineMath.MathUtil.clamp(value.height, 0, 1 - y));
|
|
20630
20853
|
this._dispatchSpriteChange(SpriteModifyFlags.atlasRegion);
|
|
20631
|
-
(this.
|
|
20854
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
20855
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
20856
|
+
}
|
|
20632
20857
|
}
|
|
20633
20858
|
},
|
|
20634
20859
|
{
|
|
@@ -20643,7 +20868,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20643
20868
|
var y = engineMath.MathUtil.clamp(value.y, 0, 1);
|
|
20644
20869
|
this._atlasRegionOffset.set(x, y, engineMath.MathUtil.clamp(value.z, 0, 1 - x), engineMath.MathUtil.clamp(value.w, 0, 1 - y));
|
|
20645
20870
|
this._dispatchSpriteChange(SpriteModifyFlags.atlasRegionOffset);
|
|
20646
|
-
(this.
|
|
20871
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
20872
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
20873
|
+
}
|
|
20647
20874
|
}
|
|
20648
20875
|
},
|
|
20649
20876
|
{
|
|
@@ -20659,7 +20886,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20659
20886
|
var y = engineMath.MathUtil.clamp(value.y, 0, 1);
|
|
20660
20887
|
region.set(x, y, engineMath.MathUtil.clamp(value.width, 0, 1 - x), engineMath.MathUtil.clamp(value.height, 0, 1 - y));
|
|
20661
20888
|
this._dispatchSpriteChange(SpriteModifyFlags.region);
|
|
20662
|
-
(this.
|
|
20889
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
20890
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
20891
|
+
}
|
|
20663
20892
|
}
|
|
20664
20893
|
},
|
|
20665
20894
|
{
|
|
@@ -20709,7 +20938,8 @@ var SpriteUpdateFlags;
|
|
|
20709
20938
|
(function(SpriteUpdateFlags) {
|
|
20710
20939
|
SpriteUpdateFlags[SpriteUpdateFlags["positions"] = 0x1] = "positions";
|
|
20711
20940
|
SpriteUpdateFlags[SpriteUpdateFlags["uvs"] = 0x2] = "uvs";
|
|
20712
|
-
SpriteUpdateFlags[SpriteUpdateFlags["
|
|
20941
|
+
SpriteUpdateFlags[SpriteUpdateFlags["automaticSize"] = 0x4] = "automaticSize";
|
|
20942
|
+
SpriteUpdateFlags[SpriteUpdateFlags["all"] = 0x7] = "all";
|
|
20713
20943
|
})(SpriteUpdateFlags || (SpriteUpdateFlags = {}));
|
|
20714
20944
|
|
|
20715
20945
|
var _SlicedSpriteAssembler;
|
|
@@ -21201,8 +21431,10 @@ var TiledType;
|
|
|
21201
21431
|
_this._tiledAdaptiveThreshold = 0.5;
|
|
21202
21432
|
_this._color = new engineMath.Color(1, 1, 1, 1);
|
|
21203
21433
|
_this._sprite = null;
|
|
21204
|
-
_this.
|
|
21205
|
-
_this.
|
|
21434
|
+
_this._automaticWidth = 0;
|
|
21435
|
+
_this._automaticHeight = 0;
|
|
21436
|
+
_this._customWidth = undefined;
|
|
21437
|
+
_this._customHeight = undefined;
|
|
21206
21438
|
_this._flipX = false;
|
|
21207
21439
|
_this._flipY = false;
|
|
21208
21440
|
_this._maskLayer = exports.SpriteMaskLayer.Layer0;
|
|
@@ -21217,44 +21449,45 @@ var TiledType;
|
|
|
21217
21449
|
/**
|
|
21218
21450
|
* @internal
|
|
21219
21451
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
21452
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
21220
21453
|
target._assembler.resetData(target);
|
|
21221
21454
|
target.sprite = this._sprite;
|
|
21455
|
+
target.drawMode = this._drawMode;
|
|
21222
21456
|
};
|
|
21223
21457
|
/**
|
|
21224
|
-
* @
|
|
21458
|
+
* @internal
|
|
21225
21459
|
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
21226
21460
|
// @ts-ignore
|
|
21227
21461
|
this._updateTransformShaderData(context, engineMath.Matrix._identity);
|
|
21228
21462
|
};
|
|
21229
21463
|
/**
|
|
21230
|
-
* @
|
|
21464
|
+
* @internal
|
|
21231
21465
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
21232
|
-
|
|
21233
|
-
|
|
21466
|
+
if (this.sprite) {
|
|
21467
|
+
this._assembler.updatePositions(this);
|
|
21468
|
+
} else {
|
|
21234
21469
|
worldBounds.min.set(0, 0, 0);
|
|
21235
21470
|
worldBounds.max.set(0, 0, 0);
|
|
21236
|
-
} else {
|
|
21237
|
-
this._assembler.updatePositions(this);
|
|
21238
21471
|
}
|
|
21239
21472
|
};
|
|
21240
21473
|
/**
|
|
21241
|
-
* @
|
|
21474
|
+
* @internal
|
|
21242
21475
|
*/ _proto._render = function _render(context) {
|
|
21243
21476
|
var _this_sprite;
|
|
21244
21477
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
21245
21478
|
return;
|
|
21246
21479
|
}
|
|
21247
|
-
// Update position
|
|
21480
|
+
// Update position
|
|
21248
21481
|
if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
|
|
21249
21482
|
this._assembler.updatePositions(this);
|
|
21250
21483
|
this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
|
|
21251
21484
|
}
|
|
21252
|
-
// Update uv
|
|
21485
|
+
// Update uv
|
|
21253
21486
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
21254
21487
|
this._assembler.updateUVs(this);
|
|
21255
21488
|
this._dirtyUpdateFlag &= ~0x2;
|
|
21256
21489
|
}
|
|
21257
|
-
// Push
|
|
21490
|
+
// Push primitive
|
|
21258
21491
|
var material = this.getMaterial();
|
|
21259
21492
|
var texture = this.sprite.texture;
|
|
21260
21493
|
var renderData = this._engine._spriteRenderDataPool.getFromPool();
|
|
@@ -21262,17 +21495,29 @@ var TiledType;
|
|
|
21262
21495
|
context.camera._renderPipeline.pushRenderData(context, renderData);
|
|
21263
21496
|
};
|
|
21264
21497
|
/**
|
|
21265
|
-
* @override
|
|
21266
21498
|
* @internal
|
|
21267
21499
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
21268
|
-
var _this__sprite;
|
|
21269
21500
|
Renderer.prototype._onDestroy.call(this);
|
|
21270
|
-
|
|
21501
|
+
var sprite = this._sprite;
|
|
21502
|
+
if (sprite) {
|
|
21503
|
+
sprite._addReferCount(-1);
|
|
21504
|
+
sprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
21505
|
+
}
|
|
21271
21506
|
this._color = null;
|
|
21272
21507
|
this._sprite = null;
|
|
21273
21508
|
this._assembler = null;
|
|
21274
21509
|
this._verticesData = null;
|
|
21275
21510
|
};
|
|
21511
|
+
_proto._calDefaultSize = function _calDefaultSize() {
|
|
21512
|
+
var sprite = this._sprite;
|
|
21513
|
+
if (sprite) {
|
|
21514
|
+
this._automaticWidth = sprite.width;
|
|
21515
|
+
this._automaticHeight = sprite.height;
|
|
21516
|
+
} else {
|
|
21517
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
21518
|
+
}
|
|
21519
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
21520
|
+
};
|
|
21276
21521
|
_proto._updateStencilState = function _updateStencilState() {
|
|
21277
21522
|
// Update stencil.
|
|
21278
21523
|
var material = this.getInstanceMaterial();
|
|
@@ -21299,22 +21544,21 @@ var TiledType;
|
|
|
21299
21544
|
break;
|
|
21300
21545
|
case SpriteModifyFlags.size:
|
|
21301
21546
|
var _this = this, drawMode = _this._drawMode;
|
|
21302
|
-
|
|
21547
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
21548
|
+
if (this._drawMode === exports.SpriteDrawMode.Sliced) {
|
|
21303
21549
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
21304
21550
|
} else if (drawMode === exports.SpriteDrawMode.Tiled) {
|
|
21305
21551
|
this._dirtyUpdateFlag |= 0x3;
|
|
21306
21552
|
} else {
|
|
21307
21553
|
// When the width and height of `SpriteRenderer` are `undefined`,
|
|
21308
21554
|
// the `size` of `Sprite` will affect the position of `SpriteRenderer`.
|
|
21309
|
-
if (this.
|
|
21555
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
21310
21556
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
21311
21557
|
}
|
|
21312
21558
|
}
|
|
21313
21559
|
break;
|
|
21314
21560
|
case SpriteModifyFlags.border:
|
|
21315
|
-
|
|
21316
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
21317
|
-
}
|
|
21561
|
+
this._drawMode === exports.SpriteDrawMode.Sliced && (this._dirtyUpdateFlag |= 0x3);
|
|
21318
21562
|
break;
|
|
21319
21563
|
case SpriteModifyFlags.region:
|
|
21320
21564
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
@@ -21398,10 +21642,14 @@ var TiledType;
|
|
|
21398
21642
|
set: function set(value) {
|
|
21399
21643
|
var lastSprite = this._sprite;
|
|
21400
21644
|
if (lastSprite !== value) {
|
|
21401
|
-
|
|
21645
|
+
if (lastSprite) {
|
|
21646
|
+
lastSprite._addReferCount(-1);
|
|
21647
|
+
lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
21648
|
+
}
|
|
21649
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
21402
21650
|
if (value) {
|
|
21651
|
+
value._addReferCount(1);
|
|
21403
21652
|
value._updateFlagManager.addListener(this._onSpriteChange);
|
|
21404
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
21405
21653
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, value.texture);
|
|
21406
21654
|
} else {
|
|
21407
21655
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, null);
|
|
@@ -21426,16 +21674,22 @@ var TiledType;
|
|
|
21426
21674
|
{
|
|
21427
21675
|
key: "width",
|
|
21428
21676
|
get: /**
|
|
21429
|
-
* Render width.
|
|
21677
|
+
* Render width (in world coordinates).
|
|
21678
|
+
*
|
|
21679
|
+
* @remarks
|
|
21680
|
+
* If width is set, return the set value,
|
|
21681
|
+
* otherwise return `SpriteRenderer.sprite.width`.
|
|
21430
21682
|
*/ function get() {
|
|
21431
|
-
|
|
21432
|
-
|
|
21683
|
+
if (this._customWidth !== undefined) {
|
|
21684
|
+
return this._customWidth;
|
|
21685
|
+
} else {
|
|
21686
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
21687
|
+
return this._automaticWidth;
|
|
21688
|
+
}
|
|
21433
21689
|
},
|
|
21434
21690
|
set: function set(value) {
|
|
21435
|
-
|
|
21436
|
-
|
|
21437
|
-
if (this._width !== value) {
|
|
21438
|
-
this._width = value;
|
|
21691
|
+
if (this._customWidth !== value) {
|
|
21692
|
+
this._customWidth = value;
|
|
21439
21693
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
21440
21694
|
}
|
|
21441
21695
|
}
|
|
@@ -21443,16 +21697,22 @@ var TiledType;
|
|
|
21443
21697
|
{
|
|
21444
21698
|
key: "height",
|
|
21445
21699
|
get: /**
|
|
21446
|
-
* Render height.
|
|
21700
|
+
* Render height (in world coordinates).
|
|
21701
|
+
*
|
|
21702
|
+
* @remarks
|
|
21703
|
+
* If height is set, return the set value,
|
|
21704
|
+
* otherwise return `SpriteRenderer.sprite.height`.
|
|
21447
21705
|
*/ function get() {
|
|
21448
|
-
|
|
21449
|
-
|
|
21706
|
+
if (this._customHeight !== undefined) {
|
|
21707
|
+
return this._customHeight;
|
|
21708
|
+
} else {
|
|
21709
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
21710
|
+
return this._automaticHeight;
|
|
21711
|
+
}
|
|
21450
21712
|
},
|
|
21451
21713
|
set: function set(value) {
|
|
21452
|
-
|
|
21453
|
-
|
|
21454
|
-
if (this._height !== value) {
|
|
21455
|
-
this._height = value;
|
|
21714
|
+
if (this._customHeight !== value) {
|
|
21715
|
+
this._customHeight = value;
|
|
21456
21716
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
21457
21717
|
}
|
|
21458
21718
|
}
|
|
@@ -21539,10 +21799,16 @@ __decorate([
|
|
|
21539
21799
|
], SpriteRenderer.prototype, "_sprite", void 0);
|
|
21540
21800
|
__decorate([
|
|
21541
21801
|
ignoreClone
|
|
21542
|
-
], SpriteRenderer.prototype, "
|
|
21802
|
+
], SpriteRenderer.prototype, "_automaticWidth", void 0);
|
|
21543
21803
|
__decorate([
|
|
21544
21804
|
ignoreClone
|
|
21545
|
-
], SpriteRenderer.prototype, "
|
|
21805
|
+
], SpriteRenderer.prototype, "_automaticHeight", void 0);
|
|
21806
|
+
__decorate([
|
|
21807
|
+
assignmentClone
|
|
21808
|
+
], SpriteRenderer.prototype, "_customWidth", void 0);
|
|
21809
|
+
__decorate([
|
|
21810
|
+
assignmentClone
|
|
21811
|
+
], SpriteRenderer.prototype, "_customHeight", void 0);
|
|
21546
21812
|
__decorate([
|
|
21547
21813
|
assignmentClone
|
|
21548
21814
|
], SpriteRenderer.prototype, "_flipX", void 0);
|
|
@@ -21563,7 +21829,9 @@ var /**
|
|
|
21563
21829
|
*/ SpriteRendererUpdateFlags;
|
|
21564
21830
|
(function(SpriteRendererUpdateFlags) {
|
|
21565
21831
|
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
|
|
21566
|
-
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/**
|
|
21832
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
|
|
21833
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
|
|
21834
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** All. */ "All"] = 0x7] = "All";
|
|
21567
21835
|
})(SpriteRendererUpdateFlags || (SpriteRendererUpdateFlags = {}));
|
|
21568
21836
|
|
|
21569
21837
|
/**
|
|
@@ -21670,6 +21938,7 @@ var /**
|
|
|
21670
21938
|
/**
|
|
21671
21939
|
* @internal
|
|
21672
21940
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
21941
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
21673
21942
|
target.font = this._font;
|
|
21674
21943
|
target._subFont = this._subFont;
|
|
21675
21944
|
};
|
|
@@ -21689,18 +21958,18 @@ var /**
|
|
|
21689
21958
|
this._dirtyFlag &= ~type;
|
|
21690
21959
|
};
|
|
21691
21960
|
/**
|
|
21692
|
-
* @
|
|
21961
|
+
* @internal
|
|
21693
21962
|
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
21694
21963
|
// @ts-ignore
|
|
21695
21964
|
this._updateTransformShaderData(context, engineMath.Matrix._identity);
|
|
21696
21965
|
};
|
|
21697
21966
|
/**
|
|
21698
|
-
* @
|
|
21967
|
+
* @internal
|
|
21699
21968
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
21700
21969
|
engineMath.BoundingBox.transform(this._localBounds, this._entity.transform.worldMatrix, worldBounds);
|
|
21701
21970
|
};
|
|
21702
21971
|
/**
|
|
21703
|
-
* @
|
|
21972
|
+
* @internal
|
|
21704
21973
|
*/ _proto._render = function _render(context) {
|
|
21705
21974
|
if (this._text === "" || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0) {
|
|
21706
21975
|
return;
|
|
@@ -21796,8 +22065,6 @@ var /**
|
|
|
21796
22065
|
_proto._updateLocalData = function _updateLocalData() {
|
|
21797
22066
|
var _this = this, color = _this.color, horizontalAlignment = _this.horizontalAlignment, verticalAlignment = _this.verticalAlignment, charRenderDatas = _this._charRenderDatas;
|
|
21798
22067
|
var _this__localBounds = this._localBounds, min = _this__localBounds.min, max = _this__localBounds.max;
|
|
21799
|
-
min.set(0, 0, 0);
|
|
21800
|
-
max.set(0, 0, 0);
|
|
21801
22068
|
var _pixelsPerUnit = Engine._pixelsPerUnit;
|
|
21802
22069
|
var pixelsPerUnitReciprocal = 1.0 / _pixelsPerUnit;
|
|
21803
22070
|
var charFont = this._subFont;
|
|
@@ -21824,54 +22091,65 @@ var /**
|
|
|
21824
22091
|
break;
|
|
21825
22092
|
}
|
|
21826
22093
|
var renderDataCount = 0;
|
|
22094
|
+
var firstLine = -1;
|
|
21827
22095
|
var minX = Number.MAX_SAFE_INTEGER;
|
|
21828
22096
|
var minY = Number.MAX_SAFE_INTEGER;
|
|
21829
22097
|
var maxX = Number.MIN_SAFE_INTEGER;
|
|
21830
22098
|
var maxY = Number.MIN_SAFE_INTEGER;
|
|
21831
|
-
var lastLineIndex = linesLen - 1;
|
|
21832
22099
|
for(var i = 0; i < linesLen; ++i){
|
|
21833
|
-
var line = lines[i];
|
|
21834
22100
|
var lineWidth = lineWidths[i];
|
|
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
|
-
|
|
21866
|
-
|
|
21867
|
-
|
|
21868
|
-
|
|
21869
|
-
|
|
22101
|
+
if (lineWidth > 0) {
|
|
22102
|
+
var line = lines[i];
|
|
22103
|
+
var startX = 0;
|
|
22104
|
+
var firstRow = -1;
|
|
22105
|
+
if (firstLine < 0) {
|
|
22106
|
+
firstLine = i;
|
|
22107
|
+
}
|
|
22108
|
+
switch(horizontalAlignment){
|
|
22109
|
+
case exports.TextHorizontalAlignment.Left:
|
|
22110
|
+
startX = -halfRendererWidth;
|
|
22111
|
+
break;
|
|
22112
|
+
case exports.TextHorizontalAlignment.Center:
|
|
22113
|
+
startX = -lineWidth * 0.5;
|
|
22114
|
+
break;
|
|
22115
|
+
case exports.TextHorizontalAlignment.Right:
|
|
22116
|
+
startX = halfRendererWidth - lineWidth;
|
|
22117
|
+
break;
|
|
22118
|
+
}
|
|
22119
|
+
for(var j = 0, n = line.length; j < n; ++j){
|
|
22120
|
+
var char = line[j];
|
|
22121
|
+
var charInfo = charFont._getCharInfo(char);
|
|
22122
|
+
if (charInfo.h > 0) {
|
|
22123
|
+
var _charRenderDatas, _ref;
|
|
22124
|
+
firstRow < 0 && (firstRow = j);
|
|
22125
|
+
var charRenderData = (_charRenderDatas = charRenderDatas)[_ref = renderDataCount++] || (_charRenderDatas[_ref] = charRenderDataPool.get());
|
|
22126
|
+
var renderData = charRenderData.renderData, localPositions = charRenderData.localPositions;
|
|
22127
|
+
charRenderData.texture = charFont._getTextureByIndex(charInfo.index);
|
|
22128
|
+
renderData.color = color;
|
|
22129
|
+
renderData.uvs = charInfo.uvs;
|
|
22130
|
+
var w = charInfo.w, ascent = charInfo.ascent, descent = charInfo.descent;
|
|
22131
|
+
var left = startX * pixelsPerUnitReciprocal;
|
|
22132
|
+
var right = (startX + w) * pixelsPerUnitReciprocal;
|
|
22133
|
+
var top = (startY + ascent) * pixelsPerUnitReciprocal;
|
|
22134
|
+
var bottom = (startY - descent + 1) * pixelsPerUnitReciprocal;
|
|
22135
|
+
localPositions.set(left, top, right, bottom);
|
|
22136
|
+
i === firstLine && (maxY = Math.max(maxY, top));
|
|
22137
|
+
minY = Math.min(minY, bottom);
|
|
22138
|
+
j === firstRow && (minX = Math.min(minX, left));
|
|
22139
|
+
maxX = Math.max(maxX, right);
|
|
22140
|
+
}
|
|
22141
|
+
startX += charInfo.xAdvance;
|
|
22142
|
+
}
|
|
21870
22143
|
}
|
|
21871
22144
|
startY -= lineHeight;
|
|
21872
22145
|
}
|
|
21873
|
-
|
|
21874
|
-
|
|
22146
|
+
if (firstLine < 0) {
|
|
22147
|
+
min.set(0, 0, 0);
|
|
22148
|
+
max.set(0, 0, 0);
|
|
22149
|
+
} else {
|
|
22150
|
+
min.set(minX, minY, 0);
|
|
22151
|
+
max.set(maxX, maxY, 0);
|
|
22152
|
+
}
|
|
21875
22153
|
// Revert excess render data to pool.
|
|
21876
22154
|
var lastRenderDataCount = charRenderDatas.length;
|
|
21877
22155
|
if (lastRenderDataCount > renderDataCount) {
|
|
@@ -21884,7 +22162,9 @@ var /**
|
|
|
21884
22162
|
return a.texture.instanceId - b.texture.instanceId;
|
|
21885
22163
|
});
|
|
21886
22164
|
};
|
|
21887
|
-
|
|
22165
|
+
/**
|
|
22166
|
+
* @internal
|
|
22167
|
+
*/ _proto._onTransformChanged = function _onTransformChanged(bit) {
|
|
21888
22168
|
Renderer.prototype._onTransformChanged.call(this, bit);
|
|
21889
22169
|
this._setDirtyFlagTrue(0x4 | 0x8);
|
|
21890
22170
|
};
|
|
@@ -22203,7 +22483,6 @@ var DirtyFlag;
|
|
|
22203
22483
|
* @internal
|
|
22204
22484
|
*/ var AnimationCurveOwner = /*#__PURE__*/ function() {
|
|
22205
22485
|
function AnimationCurveOwner(target, type, property, cureType) {
|
|
22206
|
-
this.crossCurveMark = 0;
|
|
22207
22486
|
this.hasSavedDefaultValue = false;
|
|
22208
22487
|
this.baseEvaluateData = {
|
|
22209
22488
|
curKeyframeIndex: 0,
|
|
@@ -22402,6 +22681,12 @@ AnimationCurveOwner.registerAssembler(Transform, "scale", ScaleAnimationCurveOwn
|
|
|
22402
22681
|
}();
|
|
22403
22682
|
AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights", BlendShapeWeightsAnimationCurveOwnerAssembler);
|
|
22404
22683
|
|
|
22684
|
+
/**
|
|
22685
|
+
* @internal
|
|
22686
|
+
*/ var AnimationCurveLayerOwner = function AnimationCurveLayerOwner() {
|
|
22687
|
+
this.crossCurveMark = 0;
|
|
22688
|
+
};
|
|
22689
|
+
|
|
22405
22690
|
/**
|
|
22406
22691
|
* Associate AnimationCurve and the Entity
|
|
22407
22692
|
*/ var AnimationClipCurveBinding = /*#__PURE__*/ function() {
|
|
@@ -22419,6 +22704,13 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
22419
22704
|
};
|
|
22420
22705
|
/**
|
|
22421
22706
|
* @internal
|
|
22707
|
+
*/ _proto._createCurveLayerOwner = function _createCurveLayerOwner(owner) {
|
|
22708
|
+
var layerOwner = new AnimationCurveLayerOwner();
|
|
22709
|
+
layerOwner.curveOwner = owner;
|
|
22710
|
+
return layerOwner;
|
|
22711
|
+
};
|
|
22712
|
+
/**
|
|
22713
|
+
* @internal
|
|
22422
22714
|
*/ _proto._getTempCurveOwner = function _getTempCurveOwner(entity) {
|
|
22423
22715
|
var instanceId = entity.instanceId;
|
|
22424
22716
|
if (!this._tempCurveOwner[instanceId]) {
|
|
@@ -22936,7 +23228,6 @@ exports.AnimationFloatArrayCurve = (_AnimationFloatArrayCurve = /*#__PURE__*/ fu
|
|
|
22936
23228
|
var _proto = AnimationFloatArrayCurve.prototype;
|
|
22937
23229
|
/**
|
|
22938
23230
|
* @inheritdoc
|
|
22939
|
-
* @override
|
|
22940
23231
|
*/ _proto.addKey = function addKey(key) {
|
|
22941
23232
|
AnimationCurve.prototype.addKey.call(this, key);
|
|
22942
23233
|
var evaluateData = this._evaluateData;
|
|
@@ -23574,12 +23865,14 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23574
23865
|
* @internal
|
|
23575
23866
|
*/ var AnimatorLayerData = /*#__PURE__*/ function() {
|
|
23576
23867
|
function AnimatorLayerData() {
|
|
23868
|
+
this.curveOwnerPool = Object.create(null);
|
|
23577
23869
|
this.animatorStateDataMap = {};
|
|
23578
23870
|
this.srcPlayData = new AnimatorStatePlayData();
|
|
23579
23871
|
this.destPlayData = new AnimatorStatePlayData();
|
|
23580
23872
|
this.layerState = LayerState.Standby;
|
|
23581
23873
|
this.crossCurveMark = 0;
|
|
23582
23874
|
this.manuallyTransition = new AnimatorStateTransition();
|
|
23875
|
+
this.crossOwnerLayerDataCollection = [];
|
|
23583
23876
|
}
|
|
23584
23877
|
var _proto = AnimatorLayerData.prototype;
|
|
23585
23878
|
_proto.switchPlayData = function switchPlayData() {
|
|
@@ -23594,7 +23887,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23594
23887
|
/**
|
|
23595
23888
|
* @internal
|
|
23596
23889
|
*/ var AnimatorStateData = function AnimatorStateData() {
|
|
23597
|
-
this.
|
|
23890
|
+
this.curveLayerOwner = [];
|
|
23598
23891
|
this.eventHandlers = [];
|
|
23599
23892
|
};
|
|
23600
23893
|
|
|
@@ -23608,8 +23901,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23608
23901
|
/** Culling mode of this Animator. */ _this.cullingMode = exports.AnimatorCullingMode.None;
|
|
23609
23902
|
/** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0;
|
|
23610
23903
|
_this._animatorLayersData = [];
|
|
23611
|
-
_this.
|
|
23612
|
-
_this._animationCurveOwners = [];
|
|
23904
|
+
_this._curveOwnerPool = Object.create(null);
|
|
23613
23905
|
_this._animationEventHandlerPool = new ClassPool(AnimationEventHandler);
|
|
23614
23906
|
_this._tempAnimatorStateInfo = {
|
|
23615
23907
|
layerIndex: -1,
|
|
@@ -23641,7 +23933,6 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23641
23933
|
return;
|
|
23642
23934
|
}
|
|
23643
23935
|
var animatorLayerData = this._getAnimatorLayerData(stateInfo.layerIndex);
|
|
23644
|
-
//TODO CM: Not consider same stateName, but different animation
|
|
23645
23936
|
var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData);
|
|
23646
23937
|
this._preparePlay(animatorLayerData, state, animatorStateData);
|
|
23647
23938
|
animatorLayerData.layerState = LayerState.Playing;
|
|
@@ -23718,7 +24009,6 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23718
24009
|
return this._getAnimatorStateInfo(stateName, layerIndex).state;
|
|
23719
24010
|
};
|
|
23720
24011
|
/**
|
|
23721
|
-
* @override
|
|
23722
24012
|
* @internal
|
|
23723
24013
|
*/ _proto._onEnable = function _onEnable() {
|
|
23724
24014
|
this.engine._componentsManager.addOnUpdateAnimations(this);
|
|
@@ -23726,7 +24016,6 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23726
24016
|
this._entity.getComponentsIncludeChildren(exports.Renderer, this._controlledRenderers);
|
|
23727
24017
|
};
|
|
23728
24018
|
/**
|
|
23729
|
-
* @override
|
|
23730
24019
|
* @internal
|
|
23731
24020
|
*/ _proto._onDisable = function _onDisable() {
|
|
23732
24021
|
this.engine._componentsManager.removeOnUpdateAnimations(this);
|
|
@@ -23734,7 +24023,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23734
24023
|
/**
|
|
23735
24024
|
* @internal
|
|
23736
24025
|
*/ _proto._reset = function _reset() {
|
|
23737
|
-
var _this = this, animationCurveOwners = _this.
|
|
24026
|
+
var _this = this, animationCurveOwners = _this._curveOwnerPool;
|
|
23738
24027
|
for(var instanceId in animationCurveOwners){
|
|
23739
24028
|
var propertyOwners = animationCurveOwners[instanceId];
|
|
23740
24029
|
for(var property in propertyOwners){
|
|
@@ -23743,8 +24032,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23743
24032
|
}
|
|
23744
24033
|
}
|
|
23745
24034
|
this._animatorLayersData.length = 0;
|
|
23746
|
-
this.
|
|
23747
|
-
this._animationCurveOwners.length = 0;
|
|
24035
|
+
this._curveOwnerPool = {};
|
|
23748
24036
|
this._animationEventHandlerPool.resetPool();
|
|
23749
24037
|
if (this._controllerUpdateFlag) {
|
|
23750
24038
|
this._controllerUpdateFlag.flag = false;
|
|
@@ -23772,10 +24060,10 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23772
24060
|
return stateInfo;
|
|
23773
24061
|
};
|
|
23774
24062
|
_proto._saveDefaultValues = function _saveDefaultValues(stateData) {
|
|
23775
|
-
var
|
|
23776
|
-
for(var i =
|
|
23777
|
-
var
|
|
23778
|
-
(
|
|
24063
|
+
var curveLayerOwner = stateData.curveLayerOwner;
|
|
24064
|
+
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
24065
|
+
var _curveLayerOwner_i;
|
|
24066
|
+
(_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner.saveDefaultValue();
|
|
23779
24067
|
}
|
|
23780
24068
|
};
|
|
23781
24069
|
_proto._getAnimatorStateData = function _getAnimatorStateData(stateName, animatorState, animatorLayerData) {
|
|
@@ -23784,25 +24072,32 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23784
24072
|
if (!animatorStateData) {
|
|
23785
24073
|
animatorStateData = new AnimatorStateData();
|
|
23786
24074
|
animatorStateDataMap[stateName] = animatorStateData;
|
|
23787
|
-
this._saveAnimatorStateData(animatorState, animatorStateData);
|
|
24075
|
+
this._saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData);
|
|
23788
24076
|
this._saveAnimatorEventHandlers(animatorState, animatorStateData);
|
|
23789
24077
|
}
|
|
23790
24078
|
return animatorStateData;
|
|
23791
24079
|
};
|
|
23792
|
-
_proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData) {
|
|
23793
|
-
var _this = this, entity = _this.entity,
|
|
23794
|
-
var
|
|
24080
|
+
_proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData) {
|
|
24081
|
+
var _this = this, entity = _this.entity, curveOwnerPool = _this._curveOwnerPool;
|
|
24082
|
+
var curveLayerOwner = animatorStateData.curveLayerOwner;
|
|
24083
|
+
var layerCurveOwnerPool = animatorLayerData.curveOwnerPool;
|
|
23795
24084
|
var _animatorState_clip = animatorState.clip, curves = _animatorState_clip._curveBindings;
|
|
23796
24085
|
for(var i = curves.length - 1; i >= 0; i--){
|
|
23797
24086
|
var curve = curves[i];
|
|
23798
24087
|
var targetEntity = curve.relativePath === "" ? entity : entity.findByPath(curve.relativePath);
|
|
23799
24088
|
if (targetEntity) {
|
|
24089
|
+
var _curveOwnerPool, _instanceId, _propertyOwners, _property, _layerCurveOwnerPool, _instanceId1, _layerPropertyOwners, _property1;
|
|
23800
24090
|
var property = curve.property;
|
|
23801
24091
|
var instanceId = targetEntity.instanceId;
|
|
23802
|
-
|
|
23803
|
-
|
|
24092
|
+
// Get owner
|
|
24093
|
+
var propertyOwners = (_curveOwnerPool = curveOwnerPool)[_instanceId = instanceId] || (_curveOwnerPool[_instanceId] = Object.create(null));
|
|
24094
|
+
var owner = (_propertyOwners = propertyOwners)[_property = property] || (_propertyOwners[_property] = curve._createCurveOwner(targetEntity));
|
|
24095
|
+
// Get layer owner
|
|
24096
|
+
var layerPropertyOwners = (_layerCurveOwnerPool = layerCurveOwnerPool)[_instanceId1 = instanceId] || (_layerCurveOwnerPool[_instanceId1] = Object.create(null));
|
|
24097
|
+
var layerOwner = (_layerPropertyOwners = layerPropertyOwners)[_property1 = property] || (_layerPropertyOwners[_property1] = curve._createCurveLayerOwner(owner));
|
|
24098
|
+
curveLayerOwner[i] = layerOwner;
|
|
23804
24099
|
} else {
|
|
23805
|
-
|
|
24100
|
+
curveLayerOwner[i] = null;
|
|
23806
24101
|
console.warn("The entity don't have the child entity which path is " + curve.relativePath + ".");
|
|
23807
24102
|
}
|
|
23808
24103
|
}
|
|
@@ -23830,65 +24125,61 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23830
24125
|
};
|
|
23831
24126
|
_proto._clearCrossData = function _clearCrossData(animatorLayerData) {
|
|
23832
24127
|
animatorLayerData.crossCurveMark++;
|
|
23833
|
-
|
|
24128
|
+
animatorLayerData.crossOwnerLayerDataCollection.length = 0;
|
|
23834
24129
|
};
|
|
23835
|
-
_proto.
|
|
23836
|
-
|
|
23837
|
-
|
|
23838
|
-
|
|
24130
|
+
_proto._addCrossOwner = function _addCrossOwner(animatorLayerData, layerOwner, curCurveIndex, nextCurveIndex) {
|
|
24131
|
+
layerOwner.crossSrcCurveIndex = curCurveIndex;
|
|
24132
|
+
layerOwner.crossDestCurveIndex = nextCurveIndex;
|
|
24133
|
+
animatorLayerData.crossOwnerLayerDataCollection.push(layerOwner);
|
|
23839
24134
|
};
|
|
23840
24135
|
_proto._prepareCrossFading = function _prepareCrossFading(animatorLayerData) {
|
|
23841
|
-
var crossCurveData = this._crossOwnerCollection;
|
|
23842
|
-
var crossCurveMark = animatorLayerData.crossCurveMark;
|
|
23843
24136
|
// Add src cross curve data.
|
|
23844
|
-
this._prepareSrcCrossData(
|
|
24137
|
+
this._prepareSrcCrossData(animatorLayerData, false);
|
|
23845
24138
|
// Add dest cross curve data.
|
|
23846
|
-
this._prepareDestCrossData(
|
|
24139
|
+
this._prepareDestCrossData(animatorLayerData, false);
|
|
23847
24140
|
};
|
|
23848
24141
|
_proto._prepareStandbyCrossFading = function _prepareStandbyCrossFading(animatorLayerData) {
|
|
23849
|
-
var crossOwnerCollection = this._crossOwnerCollection;
|
|
23850
|
-
var srcPlayData = animatorLayerData.srcPlayData, crossCurveMark = animatorLayerData.crossCurveMark;
|
|
23851
24142
|
// Standby have two sub state, one is never play, one is finished, never play srcPlayData.state is null.
|
|
23852
|
-
srcPlayData.state && this._prepareSrcCrossData(
|
|
24143
|
+
animatorLayerData.srcPlayData.state && this._prepareSrcCrossData(animatorLayerData, true);
|
|
23853
24144
|
// Add dest cross curve data.
|
|
23854
|
-
this._prepareDestCrossData(
|
|
24145
|
+
this._prepareDestCrossData(animatorLayerData, true);
|
|
23855
24146
|
};
|
|
23856
24147
|
_proto._prepareFixedPoseCrossFading = function _prepareFixedPoseCrossFading(animatorLayerData) {
|
|
23857
|
-
var
|
|
24148
|
+
var crossOwnerLayerDataCollection = animatorLayerData.crossOwnerLayerDataCollection;
|
|
23858
24149
|
// Save current cross curve data owner fixed pose.
|
|
23859
|
-
for(var i =
|
|
23860
|
-
var
|
|
23861
|
-
|
|
24150
|
+
for(var i = crossOwnerLayerDataCollection.length - 1; i >= 0; i--){
|
|
24151
|
+
var layerOwner = crossOwnerLayerDataCollection[i];
|
|
24152
|
+
if (!layerOwner) continue;
|
|
24153
|
+
layerOwner.curveOwner.saveFixedPoseValue();
|
|
23862
24154
|
// Reset destCurveIndex When fixed pose crossFading again.
|
|
23863
|
-
|
|
24155
|
+
layerOwner.crossDestCurveIndex = -1;
|
|
23864
24156
|
}
|
|
23865
24157
|
// prepare dest AnimatorState cross data.
|
|
23866
|
-
this._prepareDestCrossData(
|
|
23867
|
-
};
|
|
23868
|
-
_proto._prepareSrcCrossData = function _prepareSrcCrossData(
|
|
23869
|
-
var
|
|
23870
|
-
for(var i =
|
|
23871
|
-
var
|
|
23872
|
-
if (!
|
|
23873
|
-
|
|
23874
|
-
|
|
23875
|
-
|
|
23876
|
-
|
|
23877
|
-
|
|
23878
|
-
|
|
23879
|
-
|
|
23880
|
-
var
|
|
23881
|
-
|
|
23882
|
-
|
|
23883
|
-
if (
|
|
23884
|
-
|
|
23885
|
-
crossCurveData[owner.crossCurveDataIndex].crossDestCurveIndex = i;
|
|
24158
|
+
this._prepareDestCrossData(animatorLayerData, true);
|
|
24159
|
+
};
|
|
24160
|
+
_proto._prepareSrcCrossData = function _prepareSrcCrossData(animatorLayerData, saveFixed) {
|
|
24161
|
+
var curveLayerOwner = animatorLayerData.srcPlayData.stateData.curveLayerOwner;
|
|
24162
|
+
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
24163
|
+
var layerOwner = curveLayerOwner[i];
|
|
24164
|
+
if (!layerOwner) continue;
|
|
24165
|
+
layerOwner.crossCurveMark = animatorLayerData.crossCurveMark;
|
|
24166
|
+
saveFixed && layerOwner.curveOwner.saveFixedPoseValue();
|
|
24167
|
+
this._addCrossOwner(animatorLayerData, layerOwner, i, -1);
|
|
24168
|
+
}
|
|
24169
|
+
};
|
|
24170
|
+
_proto._prepareDestCrossData = function _prepareDestCrossData(animatorLayerData, saveFixed) {
|
|
24171
|
+
var curveLayerOwner = animatorLayerData.destPlayData.stateData.curveLayerOwner;
|
|
24172
|
+
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
24173
|
+
var layerOwner = curveLayerOwner[i];
|
|
24174
|
+
if (!layerOwner) continue;
|
|
24175
|
+
if (layerOwner.crossCurveMark === animatorLayerData.crossCurveMark) {
|
|
24176
|
+
layerOwner.crossDestCurveIndex = i;
|
|
23886
24177
|
} else {
|
|
24178
|
+
var owner = layerOwner.curveOwner;
|
|
23887
24179
|
owner.saveDefaultValue();
|
|
23888
24180
|
saveFixed && owner.saveFixedPoseValue();
|
|
23889
|
-
|
|
23890
|
-
|
|
23891
|
-
this._addCrossCurveData(crossCurveData, owner, -1, i);
|
|
24181
|
+
layerOwner.crossCurveMark = animatorLayerData.crossCurveMark;
|
|
24182
|
+
this._addCrossOwner(animatorLayerData, layerOwner, -1, i);
|
|
23892
24183
|
}
|
|
23893
24184
|
}
|
|
23894
24185
|
};
|
|
@@ -23918,7 +24209,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23918
24209
|
}
|
|
23919
24210
|
};
|
|
23920
24211
|
_proto._updatePlayingState = function _updatePlayingState(playData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
23921
|
-
var _playData_stateData = playData.stateData,
|
|
24212
|
+
var _playData_stateData = playData.stateData, curveLayerOwner = _playData_stateData.curveLayerOwner, eventHandlers = _playData_stateData.eventHandlers;
|
|
23922
24213
|
var state = playData.state, lastPlayState = playData.playState, lastClipTime = playData.clipTime;
|
|
23923
24214
|
var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
|
|
23924
24215
|
playData.update(this.speed < 0);
|
|
@@ -23928,8 +24219,8 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23928
24219
|
var clipTime = playData.clipTime, playState = playData.playState;
|
|
23929
24220
|
eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, clipTime);
|
|
23930
24221
|
for(var i = curveBindings.length - 1; i >= 0; i--){
|
|
23931
|
-
var
|
|
23932
|
-
|
|
24222
|
+
var _curveLayerOwner_i;
|
|
24223
|
+
(_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner.evaluateAndApplyValue(curveBindings[i].curve, clipTime, weight, additive);
|
|
23933
24224
|
}
|
|
23934
24225
|
playData.frameTime += state.speed * delta;
|
|
23935
24226
|
if (playState === AnimatorStatePlayState.Finished) {
|
|
@@ -23945,7 +24236,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23945
24236
|
}
|
|
23946
24237
|
};
|
|
23947
24238
|
_proto._updateCrossFade = function _updateCrossFade(srcPlayData, destPlayData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
23948
|
-
var
|
|
24239
|
+
var crossOwnerLayerDataCollection = layerData.crossOwnerLayerDataCollection;
|
|
23949
24240
|
var _srcPlayData_state_clip = srcPlayData.state.clip, srcCurves = _srcPlayData_state_clip._curveBindings;
|
|
23950
24241
|
var srcState = srcPlayData.state, srcStateData = srcPlayData.stateData, lastSrcPlayState = srcPlayData.playState;
|
|
23951
24242
|
var srcEventHandlers = srcStateData.eventHandlers;
|
|
@@ -23984,14 +24275,16 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23984
24275
|
} else {
|
|
23985
24276
|
this._callAnimatorScriptOnUpdate(destState, layerIndex);
|
|
23986
24277
|
}
|
|
23987
|
-
for(var i =
|
|
23988
|
-
var
|
|
23989
|
-
|
|
23990
|
-
|
|
24278
|
+
for(var i = crossOwnerLayerDataCollection.length - 1; i >= 0; i--){
|
|
24279
|
+
var layerOwner = crossOwnerLayerDataCollection[i];
|
|
24280
|
+
if (!layerOwner) continue;
|
|
24281
|
+
var srcCurveIndex = layerOwner.crossSrcCurveIndex;
|
|
24282
|
+
var destCurveIndex = layerOwner.crossDestCurveIndex;
|
|
24283
|
+
layerOwner.curveOwner.crossFadeAndApplyValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, weight, additive);
|
|
23991
24284
|
}
|
|
23992
24285
|
};
|
|
23993
24286
|
_proto._updateCrossFadeFromPose = function _updateCrossFadeFromPose(destPlayData, layerData, layerIndex, layerWeight, delta, additive, aniUpdate) {
|
|
23994
|
-
var
|
|
24287
|
+
var crossOwnerLayerDataCollection = layerData.crossOwnerLayerDataCollection;
|
|
23995
24288
|
var state = destPlayData.state, stateData = destPlayData.stateData, lastPlayState = destPlayData.playState;
|
|
23996
24289
|
var eventHandlers = stateData.eventHandlers;
|
|
23997
24290
|
var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
|
|
@@ -24015,10 +24308,11 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24015
24308
|
} else {
|
|
24016
24309
|
this._callAnimatorScriptOnUpdate(state, layerIndex);
|
|
24017
24310
|
}
|
|
24018
|
-
for(var i =
|
|
24019
|
-
var
|
|
24020
|
-
|
|
24021
|
-
|
|
24311
|
+
for(var i = crossOwnerLayerDataCollection.length - 1; i >= 0; i--){
|
|
24312
|
+
var layerOwner = crossOwnerLayerDataCollection[i];
|
|
24313
|
+
if (!layerOwner) continue;
|
|
24314
|
+
var curveIndex = layerOwner.crossDestCurveIndex;
|
|
24315
|
+
layerOwner.curveOwner.crossFadeFromPoseAndApplyValue(curveIndex >= 0 ? curveBindings[curveIndex].curve : null, destClipTime, crossWeight, layerWeight, additive);
|
|
24022
24316
|
}
|
|
24023
24317
|
};
|
|
24024
24318
|
_proto._updateCrossFadeData = function _updateCrossFadeData(layerData, crossWeight, delta, fixed) {
|
|
@@ -24040,18 +24334,19 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
24040
24334
|
if (layerData.layerState === LayerState.Playing) {
|
|
24041
24335
|
var srcPlayData = layerData.srcPlayData;
|
|
24042
24336
|
if (srcPlayData.state !== playState) {
|
|
24043
|
-
var
|
|
24044
|
-
for(var i =
|
|
24045
|
-
var
|
|
24337
|
+
var curveLayerOwner = srcPlayData.stateData.curveLayerOwner;
|
|
24338
|
+
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
24339
|
+
var _curveLayerOwner_i;
|
|
24340
|
+
var owner = (_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner;
|
|
24046
24341
|
(owner == null ? void 0 : owner.hasSavedDefaultValue) && owner.revertDefaultValue();
|
|
24047
24342
|
}
|
|
24048
24343
|
this._saveDefaultValues(playStateData);
|
|
24049
24344
|
}
|
|
24050
24345
|
} else {
|
|
24051
24346
|
// layerState is CrossFading, FixedCrossFading, Standby
|
|
24052
|
-
var
|
|
24053
|
-
for(var i1 =
|
|
24054
|
-
var owner1 =
|
|
24347
|
+
var crossOwnerLayerDataCollection = layerData.crossOwnerLayerDataCollection;
|
|
24348
|
+
for(var i1 = crossOwnerLayerDataCollection.length - 1; i1 >= 0; i1--){
|
|
24349
|
+
var owner1 = crossOwnerLayerDataCollection[i1].curveOwner;
|
|
24055
24350
|
owner1.hasSavedDefaultValue && owner1.revertDefaultValue();
|
|
24056
24351
|
}
|
|
24057
24352
|
this._saveDefaultValues(playStateData);
|
|
@@ -24221,10 +24516,7 @@ __decorate([
|
|
|
24221
24516
|
], Animator.prototype, "_animatorLayersData", void 0);
|
|
24222
24517
|
__decorate([
|
|
24223
24518
|
ignoreClone
|
|
24224
|
-
], Animator.prototype, "
|
|
24225
|
-
__decorate([
|
|
24226
|
-
ignoreClone
|
|
24227
|
-
], Animator.prototype, "_animationCurveOwners", void 0);
|
|
24519
|
+
], Animator.prototype, "_curveOwnerPool", void 0);
|
|
24228
24520
|
__decorate([
|
|
24229
24521
|
ignoreClone
|
|
24230
24522
|
], Animator.prototype, "_animationEventHandlerPool", void 0);
|
|
@@ -24551,9 +24843,7 @@ exports.AnimatorConditionMode = void 0;
|
|
|
24551
24843
|
return _this;
|
|
24552
24844
|
}
|
|
24553
24845
|
var _proto = SkyBoxMaterial.prototype;
|
|
24554
|
-
|
|
24555
|
-
* @override
|
|
24556
|
-
*/ _proto.clone = function clone() {
|
|
24846
|
+
_proto.clone = function clone() {
|
|
24557
24847
|
var dest = new SkyBoxMaterial(this._engine);
|
|
24558
24848
|
this.cloneTo(dest);
|
|
24559
24849
|
return dest;
|
|
@@ -24666,7 +24956,7 @@ exports.SunMode = void 0;
|
|
|
24666
24956
|
}
|
|
24667
24957
|
var _proto = SkyProceduralMaterial.prototype;
|
|
24668
24958
|
/**
|
|
24669
|
-
* @
|
|
24959
|
+
* @inheritDoc
|
|
24670
24960
|
*/ _proto.clone = function clone() {
|
|
24671
24961
|
var dest = new SkyProceduralMaterial(this._engine);
|
|
24672
24962
|
this.cloneTo(dest);
|
|
@@ -24864,7 +25154,6 @@ exports.ParticleRendererBlendMode = void 0;
|
|
|
24864
25154
|
}
|
|
24865
25155
|
var _proto = ParticleRenderer.prototype;
|
|
24866
25156
|
/**
|
|
24867
|
-
* @override
|
|
24868
25157
|
* @internal
|
|
24869
25158
|
*/ _proto.update = function update(deltaTime) {
|
|
24870
25159
|
if (!this._isInit || !this._isStart) {
|
|
@@ -24882,7 +25171,6 @@ exports.ParticleRendererBlendMode = void 0;
|
|
|
24882
25171
|
this.shaderData.setFloat("u_time", this._time);
|
|
24883
25172
|
};
|
|
24884
25173
|
/**
|
|
24885
|
-
* @override
|
|
24886
25174
|
* @internal
|
|
24887
25175
|
*/ _proto._onEnable = function _onEnable() {
|
|
24888
25176
|
MeshRenderer.prototype._onEnable.call(this);
|
|
@@ -25662,7 +25950,7 @@ var _tempVector3 = new engineMath.Vector3();
|
|
|
25662
25950
|
}
|
|
25663
25951
|
};
|
|
25664
25952
|
/**
|
|
25665
|
-
* @
|
|
25953
|
+
* @internal
|
|
25666
25954
|
*/ _proto._render = function _render(context) {
|
|
25667
25955
|
this._updateStrapVertices(context.camera, this._points);
|
|
25668
25956
|
this._updateStrapCoords();
|
|
@@ -25809,9 +26097,7 @@ var _tempVector3 = new engineMath.Vector3();
|
|
|
25809
26097
|
* Provide hooks for users to exchange Texture.
|
|
25810
26098
|
* @remarks Prevent issue: Feedback Loops Between Textures and the Framebuffer.
|
|
25811
26099
|
*/ _proto.onTextureChange = function onTextureChange(renderColorTexture) {};
|
|
25812
|
-
|
|
25813
|
-
* @override
|
|
25814
|
-
*/ _proto.onBeginRender = function onBeginRender(camera) {
|
|
26100
|
+
_proto.onBeginRender = function onBeginRender(camera) {
|
|
25815
26101
|
if (!this.enabled) return;
|
|
25816
26102
|
this._camera = camera;
|
|
25817
26103
|
this._oriCameraCullingMask = camera.cullingMask;
|
|
@@ -25824,9 +26110,7 @@ var _tempVector3 = new engineMath.Vector3();
|
|
|
25824
26110
|
this._oriCameraRenderTarget = camera.renderTarget;
|
|
25825
26111
|
camera.renderTarget = this._activeRenderTarget;
|
|
25826
26112
|
};
|
|
25827
|
-
|
|
25828
|
-
* @override
|
|
25829
|
-
*/ _proto.onEndRender = function onEndRender(camera) {
|
|
26113
|
+
_proto.onEndRender = function onEndRender(camera) {
|
|
25830
26114
|
if (!this.enabled) return;
|
|
25831
26115
|
this.onTextureChange && this.onTextureChange(this._texture);
|
|
25832
26116
|
this._activeRenderTarget = this._activeRenderTarget === this._renderTarget ? this._renderTargetSwap : this._renderTarget;
|
|
@@ -25861,16 +26145,12 @@ var cacheDir = new engineMath.Vector3();
|
|
|
25861
26145
|
/**
|
|
25862
26146
|
* The position of the probe can be set, the default is the origin [0,0,0].
|
|
25863
26147
|
*/ _this.position = new engineMath.Vector3(0, 0, 0);
|
|
25864
|
-
/**
|
|
25865
|
-
* @override
|
|
25866
|
-
*/ _this._isCube = true;
|
|
26148
|
+
/** @internal */ _this._isCube = true;
|
|
25867
26149
|
_this.oriViewMatrix = new engineMath.Matrix();
|
|
25868
26150
|
return _this;
|
|
25869
26151
|
}
|
|
25870
26152
|
var _proto = CubeProbe.prototype;
|
|
25871
|
-
|
|
25872
|
-
* @override
|
|
25873
|
-
*/ _proto.onBeginRender = function onBeginRender(camera) {
|
|
26153
|
+
_proto.onBeginRender = function onBeginRender(camera) {
|
|
25874
26154
|
if (!this.enabled) return;
|
|
25875
26155
|
Probe.prototype.onBeginRender.call(this, camera);
|
|
25876
26156
|
this._storeCamera(camera);
|
|
@@ -25955,6 +26235,7 @@ exports.Basic2DBatcher = Basic2DBatcher;
|
|
|
25955
26235
|
exports.BasicRenderPipeline = BasicRenderPipeline;
|
|
25956
26236
|
exports.BlendShape = BlendShape;
|
|
25957
26237
|
exports.BlendShapeFrame = BlendShapeFrame;
|
|
26238
|
+
exports.BlendState = BlendState;
|
|
25958
26239
|
exports.BlinnPhongMaterial = BlinnPhongMaterial;
|
|
25959
26240
|
exports.BoolUpdateFlag = BoolUpdateFlag;
|
|
25960
26241
|
exports.BoxColliderShape = BoxColliderShape;
|
|
@@ -25968,6 +26249,7 @@ exports.ColliderShape = ColliderShape;
|
|
|
25968
26249
|
exports.Component = Component;
|
|
25969
26250
|
exports.ContentRestorer = ContentRestorer;
|
|
25970
26251
|
exports.CubeProbe = CubeProbe;
|
|
26252
|
+
exports.DepthState = DepthState;
|
|
25971
26253
|
exports.DirectLight = DirectLight;
|
|
25972
26254
|
exports.DynamicCollider = DynamicCollider;
|
|
25973
26255
|
exports.Engine = Engine;
|
|
@@ -26001,10 +26283,13 @@ exports.PointLight = PointLight;
|
|
|
26001
26283
|
exports.Pointer = Pointer;
|
|
26002
26284
|
exports.PrimitiveMesh = PrimitiveMesh;
|
|
26003
26285
|
exports.Probe = Probe;
|
|
26286
|
+
exports.RasterState = RasterState;
|
|
26004
26287
|
exports.ReferResource = ReferResource;
|
|
26005
26288
|
exports.RenderPass = RenderPass;
|
|
26006
26289
|
exports.RenderQueue = RenderQueue;
|
|
26290
|
+
exports.RenderState = RenderState;
|
|
26007
26291
|
exports.RenderTarget = RenderTarget;
|
|
26292
|
+
exports.RenderTargetBlendState = RenderTargetBlendState;
|
|
26008
26293
|
exports.ResourceManager = ResourceManager;
|
|
26009
26294
|
exports.Scene = Scene;
|
|
26010
26295
|
exports.SceneManager = SceneManager;
|
|
@@ -26031,6 +26316,7 @@ exports.SpriteMask = SpriteMask;
|
|
|
26031
26316
|
exports.SpriteRenderer = SpriteRenderer;
|
|
26032
26317
|
exports.StateMachineScript = StateMachineScript;
|
|
26033
26318
|
exports.StaticCollider = StaticCollider;
|
|
26319
|
+
exports.StencilState = StencilState;
|
|
26034
26320
|
exports.SubMesh = SubMesh;
|
|
26035
26321
|
exports.SubShader = SubShader;
|
|
26036
26322
|
exports.SystemInfo = SystemInfo;
|