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