@galacean/engine-core 1.0.0-beta.1 → 1.0.0-beta.11
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 +936 -356
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +936 -356
- package/dist/module.js +931 -357
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/2d/atlas/SpriteAtlas.d.ts +0 -1
- package/types/2d/sprite/Sprite.d.ts +12 -3
- package/types/2d/sprite/SpriteMask.d.ts +16 -17
- package/types/2d/sprite/SpriteRenderer.d.ts +17 -11
- package/types/2d/text/Font.d.ts +0 -1
- package/types/2d/text/TextRenderer.d.ts +1 -9
- package/types/Camera.d.ts +5 -6
- package/types/Component.d.ts +0 -1
- package/types/Engine.d.ts +0 -2
- package/types/RenderPipeline/ClassPool.d.ts +3 -1
- package/types/RenderPipeline/IPoolElement.d.ts +3 -0
- package/types/RenderPipeline/MeshRenderData.d.ts +3 -1
- package/types/RenderPipeline/RenderElement.d.ts +3 -1
- package/types/RenderPipeline/SpriteMaskRenderData.d.ts +3 -1
- package/types/RenderPipeline/SpriteRenderData.d.ts +3 -1
- package/types/RenderPipeline/TextRenderData.d.ts +3 -1
- package/types/Renderer.d.ts +8 -13
- package/types/SafeLoopArray.d.ts +37 -0
- package/types/Scene.d.ts +10 -4
- package/types/Script.d.ts +0 -1
- package/types/animation/Animator.d.ts +2 -3
- 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 -1
- package/types/asset/ReferResource.d.ts +0 -1
- package/types/enums/ActiveChangeFlag.d.ts +6 -0
- package/types/env-probe/CubeProbe.d.ts +0 -1
- package/types/graphic/Buffer.d.ts +0 -1
- package/types/graphic/Mesh.d.ts +2 -6
- package/types/graphic/SubMesh.d.ts +3 -1
- package/types/index.d.ts +1 -1
- package/types/lighting/Light.d.ts +0 -1
- package/types/material/Material.d.ts +9 -2
- package/types/material/PBRMaterial.d.ts +11 -2
- package/types/mesh/MeshRenderer.d.ts +8 -8
- package/types/mesh/ModelMesh.d.ts +0 -1
- package/types/mesh/SkinnedMeshRenderer.d.ts +0 -4
- package/types/physics/Collider.d.ts +0 -1
- package/types/physics/PhysicsScene.d.ts +75 -0
- 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/texture/RenderTarget.d.ts +0 -1
- package/types/texture/Texture.d.ts +0 -1
- package/types/trail/TrailRenderer.d.ts +0 -2
- package/types/utils/BoolUpdateFlag.d.ts +12 -0
- package/types/utils/DisorderedArray.d.ts +18 -0
- package/types/utils/SafeLoopArray.d.ts +41 -0
- package/types/utils/UpdateFlag.d.ts +20 -0
- package/types/utils/UpdateFlagManager.d.ts +1 -0
- package/types/utils/Utils.d.ts +31 -0
package/dist/main.js
CHANGED
|
@@ -682,7 +682,9 @@ __decorate([
|
|
|
682
682
|
*/ _proto._addToResourceManager = function _addToResourceManager(path) {
|
|
683
683
|
this._engine.resourceManager._addAsset(path, this);
|
|
684
684
|
};
|
|
685
|
-
|
|
685
|
+
/**
|
|
686
|
+
* @internal
|
|
687
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
686
688
|
EngineObject.prototype._onDestroy.call(this);
|
|
687
689
|
this._engine.resourceManager._deleteReferResource(this);
|
|
688
690
|
var refCount = this._getReferCount();
|
|
@@ -814,7 +816,9 @@ var GraphicsResource = /*#__PURE__*/ function(ReferResource) {
|
|
|
814
816
|
return _this;
|
|
815
817
|
}
|
|
816
818
|
var _proto = GraphicsResource.prototype;
|
|
817
|
-
|
|
819
|
+
/**
|
|
820
|
+
* @internal
|
|
821
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
818
822
|
ReferResource.prototype._onDestroy.call(this);
|
|
819
823
|
this.engine.resourceManager._deleteGraphicResource(this);
|
|
820
824
|
};
|
|
@@ -893,7 +897,9 @@ var Logger = {
|
|
|
893
897
|
platformTexture.depthCompareFunction = this._depthCompareFunction;
|
|
894
898
|
platformTexture.setUseDepthCompareMode(this._useDepthCompareMode);
|
|
895
899
|
};
|
|
896
|
-
|
|
900
|
+
/**
|
|
901
|
+
* @internal
|
|
902
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
897
903
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
898
904
|
this._platformTexture.destroy();
|
|
899
905
|
this._platformTexture = null;
|
|
@@ -1043,9 +1049,11 @@ var Logger = {
|
|
|
1043
1049
|
renderTexture
|
|
1044
1050
|
];
|
|
1045
1051
|
for(var i = 0, n = colorTextures.length; i < n; i++){
|
|
1046
|
-
|
|
1052
|
+
var colorTexture = colorTextures[i];
|
|
1053
|
+
if (colorTexture._isDepthTexture) {
|
|
1047
1054
|
throw "Render texture can't use depth format.";
|
|
1048
1055
|
}
|
|
1056
|
+
colorTexture._addReferCount(1);
|
|
1049
1057
|
}
|
|
1050
1058
|
_this._colorTextures = colorTextures;
|
|
1051
1059
|
} else {
|
|
@@ -1056,6 +1064,7 @@ var Logger = {
|
|
|
1056
1064
|
throw "Depth texture must use depth format.";
|
|
1057
1065
|
}
|
|
1058
1066
|
_this._depthTexture = depth;
|
|
1067
|
+
_this._depthTexture._addReferCount(1);
|
|
1059
1068
|
}
|
|
1060
1069
|
_this._platformRenderTarget = engine._hardwareRenderer.createPlatformRenderTarget(_assert_this_initialized(_this));
|
|
1061
1070
|
return _this;
|
|
@@ -1081,10 +1090,18 @@ var Logger = {
|
|
|
1081
1090
|
this._depthTexture && this._depthTexture.generateMipmaps();
|
|
1082
1091
|
}
|
|
1083
1092
|
};
|
|
1084
|
-
|
|
1093
|
+
/**
|
|
1094
|
+
* @internal
|
|
1095
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
1096
|
+
var _this__depthTexture;
|
|
1085
1097
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
1086
1098
|
this._platformRenderTarget.destroy();
|
|
1087
|
-
this
|
|
1099
|
+
var _this = this, colorTextures = _this._colorTextures;
|
|
1100
|
+
for(var i = 0, n = colorTextures.length; i < n; i++){
|
|
1101
|
+
colorTextures[i]._addReferCount(-1);
|
|
1102
|
+
}
|
|
1103
|
+
colorTextures.length = 0;
|
|
1104
|
+
(_this__depthTexture = this._depthTexture) == null ? void 0 : _this__depthTexture._addReferCount(-1);
|
|
1088
1105
|
this._depthTexture = null;
|
|
1089
1106
|
this._depth = null;
|
|
1090
1107
|
};
|
|
@@ -1459,7 +1476,9 @@ var Logger = {
|
|
|
1459
1476
|
_proto.getCharInfo = function getCharInfo(char) {
|
|
1460
1477
|
return this._charInfoMap[char.charCodeAt(0)];
|
|
1461
1478
|
};
|
|
1462
|
-
|
|
1479
|
+
/**
|
|
1480
|
+
* @internal
|
|
1481
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
1463
1482
|
ReferResource.prototype._onDestroy.call(this);
|
|
1464
1483
|
this.texture.destroy();
|
|
1465
1484
|
this.texture = null;
|
|
@@ -1966,6 +1985,7 @@ var Logger = {
|
|
|
1966
1985
|
var fontAtlas = new FontAtlas(engine);
|
|
1967
1986
|
var texture = new Texture2D(engine, 256, 256);
|
|
1968
1987
|
fontAtlas.texture = texture;
|
|
1988
|
+
fontAtlas.isGCIgnored = texture.isGCIgnored = true;
|
|
1969
1989
|
this._fontAtlases.push(fontAtlas);
|
|
1970
1990
|
var nativeFontString = this.nativeFontString;
|
|
1971
1991
|
engine.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
|
|
@@ -2022,7 +2042,9 @@ var Logger = {
|
|
|
2022
2042
|
subFontMap[key] = subFont;
|
|
2023
2043
|
return subFont;
|
|
2024
2044
|
};
|
|
2025
|
-
|
|
2045
|
+
/**
|
|
2046
|
+
* @internal
|
|
2047
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
2026
2048
|
ReferResource.prototype._onDestroy.call(this);
|
|
2027
2049
|
var subFontMap = this._subFontMap;
|
|
2028
2050
|
for(var k in subFontMap){
|
|
@@ -2266,6 +2288,29 @@ var /** @internal */ PromiseState;
|
|
|
2266
2288
|
* @remarks The release principle is that it is not referenced by the components, including direct and indirect reference.
|
|
2267
2289
|
*/ _proto.gc = function gc() {
|
|
2268
2290
|
this._gc(false);
|
|
2291
|
+
var engine = this.engine;
|
|
2292
|
+
engine._renderElementPool.garbageCollection();
|
|
2293
|
+
engine._meshRenderDataPool.garbageCollection();
|
|
2294
|
+
engine._spriteRenderDataPool.garbageCollection();
|
|
2295
|
+
engine._spriteMaskRenderDataPool.garbageCollection();
|
|
2296
|
+
engine._textRenderDataPool.garbageCollection();
|
|
2297
|
+
var _componentsManager = engine._componentsManager, _lightManager = engine._lightManager;
|
|
2298
|
+
_componentsManager._renderers.garbageCollection();
|
|
2299
|
+
// @ts-ignore
|
|
2300
|
+
_componentsManager._onStartScripts.garbageCollection();
|
|
2301
|
+
// @ts-ignore
|
|
2302
|
+
_componentsManager._onUpdateScripts.garbageCollection();
|
|
2303
|
+
// @ts-ignore
|
|
2304
|
+
_componentsManager._onLateUpdateScripts.garbageCollection();
|
|
2305
|
+
// @ts-ignore
|
|
2306
|
+
_componentsManager._onPhysicsUpdateScripts.garbageCollection();
|
|
2307
|
+
// @ts-ignore
|
|
2308
|
+
_componentsManager._onUpdateAnimations.garbageCollection();
|
|
2309
|
+
// @ts-ignore
|
|
2310
|
+
_componentsManager._onUpdateRenderers.garbageCollection();
|
|
2311
|
+
_lightManager._spotLights.garbageCollection();
|
|
2312
|
+
_lightManager._pointLights.garbageCollection();
|
|
2313
|
+
_lightManager._directLights.garbageCollection();
|
|
2269
2314
|
};
|
|
2270
2315
|
/**
|
|
2271
2316
|
* Add content restorer.
|
|
@@ -3241,7 +3286,9 @@ exports.GLCapabilityType = void 0;
|
|
|
3241
3286
|
}
|
|
3242
3287
|
}
|
|
3243
3288
|
};
|
|
3244
|
-
|
|
3289
|
+
/**
|
|
3290
|
+
* @internal
|
|
3291
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
3245
3292
|
EngineObject.prototype._onDestroy.call(this);
|
|
3246
3293
|
this._entity._removeComponent(this);
|
|
3247
3294
|
if (this._entity.isActiveInHierarchy) {
|
|
@@ -4699,6 +4746,11 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
4699
4746
|
* @returns Cloned entity
|
|
4700
4747
|
*/ _proto.clone = function clone() {
|
|
4701
4748
|
var cloneEntity = new Entity(this._engine, this.name);
|
|
4749
|
+
var _this = this, hookResource = _this._hookResource;
|
|
4750
|
+
if (hookResource) {
|
|
4751
|
+
cloneEntity._hookResource = hookResource;
|
|
4752
|
+
hookResource._addReferCount(1);
|
|
4753
|
+
}
|
|
4702
4754
|
cloneEntity._isActive = this._isActive;
|
|
4703
4755
|
cloneEntity.transform.localMatrix = this.transform.localMatrix;
|
|
4704
4756
|
var children = this._children;
|
|
@@ -4723,6 +4775,10 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
4723
4775
|
return;
|
|
4724
4776
|
}
|
|
4725
4777
|
EngineObject.prototype.destroy.call(this);
|
|
4778
|
+
if (this._hookResource) {
|
|
4779
|
+
this._hookResource._addReferCount(-1);
|
|
4780
|
+
this._hookResource = null;
|
|
4781
|
+
}
|
|
4726
4782
|
var components = this._components;
|
|
4727
4783
|
for(var i = components.length - 1; i >= 0; i--){
|
|
4728
4784
|
components[i].destroy();
|
|
@@ -5251,14 +5307,14 @@ SystemInfo._initialize();
|
|
|
5251
5307
|
Keys[Keys[/** Tab or ⇥. */ "Tab"] = 63] = "Tab";
|
|
5252
5308
|
Keys[Keys[/** Japanese: 変換 (henkan). */ "Convert"] = 64] = "Convert";
|
|
5253
5309
|
Keys[Keys[/** Japanese: カタカナ/ひらがな/ローマ字 (katakana/hiragana/romaji). */ "KanaMode"] = 65] = "KanaMode";
|
|
5254
|
-
Keys[Keys[/**
|
|
5255
|
-
* Korean: HangulMode 한/영 (han/yeong).
|
|
5256
|
-
* Japanese (Mac keyboard): かな (kana).
|
|
5257
|
-
* */ "Lang1"] = 66] = "Lang1";
|
|
5258
5310
|
Keys[Keys[/**
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5311
|
+
* Korean: HangulMode 한/영 (han/yeong).
|
|
5312
|
+
* Japanese (Mac keyboard): かな (kana).
|
|
5313
|
+
* */ "Lang1"] = 66] = "Lang1";
|
|
5314
|
+
Keys[Keys[/**
|
|
5315
|
+
* Korean: Hanja 한자 (hanja).
|
|
5316
|
+
* Japanese (Mac keyboard): 英数 (eisu).
|
|
5317
|
+
*/ "Lang2"] = 67] = "Lang2";
|
|
5262
5318
|
Keys[Keys[/** Japanese (word-processing keyboard): Katakana. */ "Lang3"] = 68] = "Lang3";
|
|
5263
5319
|
Keys[Keys[/** Japanese (word-processing keyboard): Hiragana. */ "Lang4"] = 69] = "Lang4";
|
|
5264
5320
|
Keys[Keys[/** Japanese (word-processing keyboard): Zenkaku/Hankaku. */ "Lang5"] = 70] = "Lang5";
|
|
@@ -5275,46 +5331,46 @@ SystemInfo._initialize();
|
|
|
5275
5331
|
Keys[Keys[/** → */ "ArrowRight"] = 81] = "ArrowRight";
|
|
5276
5332
|
Keys[Keys[/** ↑ */ "ArrowUp"] = 82] = "ArrowUp";
|
|
5277
5333
|
Keys[Keys[/** On the Mac, the "NumLock" code should be used for the numpad Clear key. */ "NumLock"] = 83] = "NumLock";
|
|
5278
|
-
Keys[Keys[/**
|
|
5279
|
-
* 0 Ins on a keyboard.
|
|
5280
|
-
* 0 on a phone or remote control.
|
|
5281
|
-
* */ "Numpad0"] = 84] = "Numpad0";
|
|
5282
5334
|
Keys[Keys[/**
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5335
|
+
* 0 Ins on a keyboard.
|
|
5336
|
+
* 0 on a phone or remote control.
|
|
5337
|
+
* */ "Numpad0"] = 84] = "Numpad0";
|
|
5338
|
+
Keys[Keys[/**
|
|
5339
|
+
* 1 End on a keyboard.
|
|
5340
|
+
* 1 or 1 QZ on a phone or remote control.
|
|
5341
|
+
*/ "Numpad1"] = 85] = "Numpad1";
|
|
5286
5342
|
Keys[Keys[/**
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5343
|
+
* 2 ↓ on a keyboard.
|
|
5344
|
+
* 2 ABC on a phone or remote control.
|
|
5345
|
+
*/ "Numpad2"] = 86] = "Numpad2";
|
|
5290
5346
|
Keys[Keys[/**
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5347
|
+
* 3 PgDn on a keyboard.
|
|
5348
|
+
* 3 DEF on a phone or remote control.
|
|
5349
|
+
*/ "Numpad3"] = 87] = "Numpad3";
|
|
5294
5350
|
Keys[Keys[/**
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5351
|
+
* 4 ← on a keyboard.
|
|
5352
|
+
* 4 GHI on a phone or remote control.
|
|
5353
|
+
*/ "Numpad4"] = 88] = "Numpad4";
|
|
5298
5354
|
Keys[Keys[/**
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5355
|
+
* 5 on a keyboard.
|
|
5356
|
+
* 5 JKL on a phone or remote control.
|
|
5357
|
+
*/ "Numpad5"] = 89] = "Numpad5";
|
|
5302
5358
|
Keys[Keys[/**
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5359
|
+
* 6 → on a keyboard.
|
|
5360
|
+
* 6 MNO on a phone or remote control.
|
|
5361
|
+
*/ "Numpad6"] = 90] = "Numpad6";
|
|
5306
5362
|
Keys[Keys[/**
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5363
|
+
* 7 Home on a keyboard.
|
|
5364
|
+
* 7 PQRS or 7 PRS on a phone or remote control.
|
|
5365
|
+
*/ "Numpad7"] = 91] = "Numpad7";
|
|
5310
5366
|
Keys[Keys[/**
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5367
|
+
* 8 ↑ on a keyboard.
|
|
5368
|
+
* 8 TUV on a phone or remote control.
|
|
5369
|
+
*/ "Numpad8"] = 92] = "Numpad8";
|
|
5314
5370
|
Keys[Keys[/**
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5371
|
+
* 9 PgUp on a keyboard.
|
|
5372
|
+
* 9 WXYZ or 9 WXY on a phone or remote control.
|
|
5373
|
+
*/ "Numpad9"] = 93] = "Numpad9";
|
|
5318
5374
|
Keys[Keys[/** + */ "NumpadAdd"] = 94] = "NumpadAdd";
|
|
5319
5375
|
Keys[Keys[/** Found on the Microsoft Natural Keyboard. */ "NumpadBackspace"] = 95] = "NumpadBackspace";
|
|
5320
5376
|
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";
|
|
@@ -5330,16 +5386,16 @@ SystemInfo._initialize();
|
|
|
5330
5386
|
Keys[Keys[/** MR Replace the current entry with the value stored in memory. */ "NumpadMemoryRecall"] = 106] = "NumpadMemoryRecall";
|
|
5331
5387
|
Keys[Keys[/** MS Replace the value stored in memory with the current entry. */ "NumpadMemoryStore"] = 107] = "NumpadMemoryStore";
|
|
5332
5388
|
Keys[Keys[/** M- Subtract current entry from the value stored in memory. */ "NumpadMemorySubtract"] = 108] = "NumpadMemorySubtract";
|
|
5333
|
-
Keys[Keys[/**
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5389
|
+
Keys[Keys[/**
|
|
5390
|
+
* * on a keyboard. For use with numpads that provide mathematical operations (+, -, * and /).
|
|
5391
|
+
* Use "NumpadStar" for the * key on phones and remote controls.
|
|
5392
|
+
*/ "NumpadMultiply"] = 109] = "NumpadMultiply";
|
|
5337
5393
|
Keys[Keys[/** ( Found on the Microsoft Natural Keyboard. */ "NumpadParenLeft"] = 110] = "NumpadParenLeft";
|
|
5338
5394
|
Keys[Keys[/** ) Found on the Microsoft Natural Keyboard. */ "NumpadParenRight"] = 111] = "NumpadParenRight";
|
|
5339
5395
|
Keys[Keys[/**
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5396
|
+
* * on a phone or remote control device. This key is typically found below the 7 key and to the left of the 0 key.
|
|
5397
|
+
* Use "NumpadMultiply" for the * key on numeric keypads.
|
|
5398
|
+
*/ "NumpadStar"] = 112] = "NumpadStar";
|
|
5343
5399
|
Keys[Keys[/** - */ "NumpadSubtract"] = 113] = "NumpadSubtract";
|
|
5344
5400
|
Keys[Keys[/** Esc or ⎋. */ "Escape"] = 114] = "Escape";
|
|
5345
5401
|
Keys[Keys[/** F1 */ "F1"] = 115] = "F1";
|
|
@@ -6014,7 +6070,9 @@ exports.Collider = /*#__PURE__*/ function(Component) {
|
|
|
6014
6070
|
*/ _proto._onDisable = function _onDisable() {
|
|
6015
6071
|
this.engine.physicsManager._removeCollider(this);
|
|
6016
6072
|
};
|
|
6017
|
-
|
|
6073
|
+
/**
|
|
6074
|
+
* @internal
|
|
6075
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
6018
6076
|
Component.prototype._onDestroy.call(this);
|
|
6019
6077
|
this.clearShapes();
|
|
6020
6078
|
this._nativeCollider.destroy();
|
|
@@ -7864,7 +7922,10 @@ exports.DynamicColliderConstraints = void 0;
|
|
|
7864
7922
|
return _this;
|
|
7865
7923
|
}
|
|
7866
7924
|
var _proto = Light.prototype;
|
|
7867
|
-
|
|
7925
|
+
/**
|
|
7926
|
+
* Light Color, include intensity.
|
|
7927
|
+
* @internal
|
|
7928
|
+
*/ _proto._getLightIntensityColor = function _getLightIntensityColor() {
|
|
7868
7929
|
this._lightColor.r = this.color.r * this.intensity;
|
|
7869
7930
|
this._lightColor.g = this.color.g * this.intensity;
|
|
7870
7931
|
this._lightColor.b = this.color.b * this.intensity;
|
|
@@ -7934,15 +7995,21 @@ __decorate([
|
|
|
7934
7995
|
var cullingMaskStart = lightIndex * 2;
|
|
7935
7996
|
var colorStart = lightIndex * 3;
|
|
7936
7997
|
var directionStart = lightIndex * 3;
|
|
7937
|
-
var lightColor = this.
|
|
7998
|
+
var lightColor = this._getLightIntensityColor();
|
|
7938
7999
|
var direction = this.direction;
|
|
7939
8000
|
var data = DirectLight._combinedData;
|
|
7940
8001
|
var cullingMask = this.cullingMask;
|
|
7941
8002
|
data.cullingMask[cullingMaskStart] = cullingMask & 65535;
|
|
7942
8003
|
data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
8004
|
+
if (this.engine.settings.colorSpace === exports.ColorSpace.Linear) {
|
|
8005
|
+
data.color[colorStart] = engineMath.Color.gammaToLinearSpace(lightColor.r);
|
|
8006
|
+
data.color[colorStart + 1] = engineMath.Color.gammaToLinearSpace(lightColor.g);
|
|
8007
|
+
data.color[colorStart + 2] = engineMath.Color.gammaToLinearSpace(lightColor.b);
|
|
8008
|
+
} else {
|
|
8009
|
+
data.color[colorStart] = lightColor.r;
|
|
8010
|
+
data.color[colorStart + 1] = lightColor.g;
|
|
8011
|
+
data.color[colorStart + 2] = lightColor.b;
|
|
8012
|
+
}
|
|
7946
8013
|
data.direction[directionStart] = direction.x;
|
|
7947
8014
|
data.direction[directionStart + 1] = direction.y;
|
|
7948
8015
|
data.direction[directionStart + 2] = direction.z;
|
|
@@ -8031,15 +8098,21 @@ __decorate([
|
|
|
8031
8098
|
var colorStart = lightIndex * 3;
|
|
8032
8099
|
var positionStart = lightIndex * 3;
|
|
8033
8100
|
var distanceStart = lightIndex;
|
|
8034
|
-
var lightColor = this.
|
|
8101
|
+
var lightColor = this._getLightIntensityColor();
|
|
8035
8102
|
var lightPosition = this.position;
|
|
8036
8103
|
var data = PointLight._combinedData;
|
|
8037
8104
|
var cullingMask = this.cullingMask;
|
|
8038
8105
|
data.cullingMask[cullingMaskStart] = cullingMask & 65535;
|
|
8039
8106
|
data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
|
|
8107
|
+
if (this.engine.settings.colorSpace === exports.ColorSpace.Linear) {
|
|
8108
|
+
data.color[colorStart] = engineMath.Color.gammaToLinearSpace(lightColor.r);
|
|
8109
|
+
data.color[colorStart + 1] = engineMath.Color.gammaToLinearSpace(lightColor.g);
|
|
8110
|
+
data.color[colorStart + 2] = engineMath.Color.gammaToLinearSpace(lightColor.b);
|
|
8111
|
+
} else {
|
|
8112
|
+
data.color[colorStart] = lightColor.r;
|
|
8113
|
+
data.color[colorStart + 1] = lightColor.g;
|
|
8114
|
+
data.color[colorStart + 2] = lightColor.b;
|
|
8115
|
+
}
|
|
8043
8116
|
data.position[positionStart] = lightPosition.x;
|
|
8044
8117
|
data.position[positionStart + 1] = lightPosition.y;
|
|
8045
8118
|
data.position[positionStart + 2] = lightPosition.z;
|
|
@@ -8132,16 +8205,22 @@ __decorate([
|
|
|
8132
8205
|
var distanceStart = lightIndex;
|
|
8133
8206
|
var penumbraCosStart = lightIndex;
|
|
8134
8207
|
var angleCosStart = lightIndex;
|
|
8135
|
-
var
|
|
8208
|
+
var lightColor = this._getLightIntensityColor();
|
|
8136
8209
|
var position = this.position;
|
|
8137
8210
|
var direction = this.direction;
|
|
8138
8211
|
var data = SpotLight._combinedData;
|
|
8139
8212
|
var cullingMask = this.cullingMask;
|
|
8140
8213
|
data.cullingMask[cullingMaskStart] = cullingMask & 65535;
|
|
8141
8214
|
data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
|
|
8142
|
-
|
|
8143
|
-
|
|
8144
|
-
|
|
8215
|
+
if (this.engine.settings.colorSpace === exports.ColorSpace.Linear) {
|
|
8216
|
+
data.color[colorStart] = engineMath.Color.gammaToLinearSpace(lightColor.r);
|
|
8217
|
+
data.color[colorStart + 1] = engineMath.Color.gammaToLinearSpace(lightColor.g);
|
|
8218
|
+
data.color[colorStart + 2] = engineMath.Color.gammaToLinearSpace(lightColor.b);
|
|
8219
|
+
} else {
|
|
8220
|
+
data.color[colorStart] = lightColor.r;
|
|
8221
|
+
data.color[colorStart + 1] = lightColor.g;
|
|
8222
|
+
data.color[colorStart + 2] = lightColor.b;
|
|
8223
|
+
}
|
|
8145
8224
|
data.position[positionStart] = position.x;
|
|
8146
8225
|
data.position[positionStart + 1] = position.y;
|
|
8147
8226
|
data.position[positionStart + 2] = position.z;
|
|
@@ -8784,6 +8863,7 @@ __decorate([
|
|
|
8784
8863
|
_proto.cloneTo = function cloneTo(target) {
|
|
8785
8864
|
CloneManager.deepCloneObject(this._macroCollection, target._macroCollection);
|
|
8786
8865
|
Object.assign(target._macroMap, this._macroMap);
|
|
8866
|
+
var referCount = target._getReferCount();
|
|
8787
8867
|
var propertyValueMap = this._propertyValueMap;
|
|
8788
8868
|
var targetPropertyValueMap = target._propertyValueMap;
|
|
8789
8869
|
var keys = Object.keys(propertyValueMap);
|
|
@@ -8795,6 +8875,7 @@ __decorate([
|
|
|
8795
8875
|
targetPropertyValueMap[k] = property;
|
|
8796
8876
|
} else if (_instanceof(property, Texture)) {
|
|
8797
8877
|
targetPropertyValueMap[k] = property;
|
|
8878
|
+
referCount > 0 && property._addReferCount(referCount);
|
|
8798
8879
|
} else if (_instanceof(property, Array) || _instanceof(property, Float32Array) || _instanceof(property, Int32Array)) {
|
|
8799
8880
|
targetPropertyValueMap[k] = property.slice();
|
|
8800
8881
|
} else {
|
|
@@ -9352,9 +9433,9 @@ __decorate([
|
|
|
9352
9433
|
function Material(engine, shader) {
|
|
9353
9434
|
var _this;
|
|
9354
9435
|
_this = ReferResource.call(this, engine) || this;
|
|
9355
|
-
/** Shader data. */ _this.shaderData = new ShaderData(ShaderDataGroup.Material);
|
|
9356
9436
|
/** @internal */ _this._renderStates = [] // todo: later will as a part of shaderData when shader effect frame is OK, that is more powerful and flexible.
|
|
9357
9437
|
;
|
|
9438
|
+
_this._shaderData = new ShaderData(ShaderDataGroup.Material);
|
|
9358
9439
|
_this.shader = shader;
|
|
9359
9440
|
return _this;
|
|
9360
9441
|
}
|
|
@@ -9378,7 +9459,23 @@ __decorate([
|
|
|
9378
9459
|
ReferResource.prototype._addReferCount.call(this, value);
|
|
9379
9460
|
this.shaderData._addReferCount(value);
|
|
9380
9461
|
};
|
|
9462
|
+
/**
|
|
9463
|
+
* @override
|
|
9464
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
9465
|
+
this._shader = null;
|
|
9466
|
+
this._shaderData = null;
|
|
9467
|
+
this._renderStates.length = 0;
|
|
9468
|
+
this._renderStates = null;
|
|
9469
|
+
};
|
|
9381
9470
|
_create_class(Material, [
|
|
9471
|
+
{
|
|
9472
|
+
key: "shaderData",
|
|
9473
|
+
get: /**
|
|
9474
|
+
* Shader data.
|
|
9475
|
+
*/ function get() {
|
|
9476
|
+
return this._shaderData;
|
|
9477
|
+
}
|
|
9478
|
+
},
|
|
9382
9479
|
{
|
|
9383
9480
|
key: "shader",
|
|
9384
9481
|
get: /**
|
|
@@ -9451,6 +9548,12 @@ __decorate([
|
|
|
9451
9548
|
*/ _proto.resetPool = function resetPool() {
|
|
9452
9549
|
this._elementPoolIndex = 0;
|
|
9453
9550
|
};
|
|
9551
|
+
_proto.garbageCollection = function garbageCollection() {
|
|
9552
|
+
var _this = this, pool = _this._elementPool;
|
|
9553
|
+
for(var i = pool.length - 1; i >= 0; i--){
|
|
9554
|
+
pool[i].dispose && pool[i].dispose();
|
|
9555
|
+
}
|
|
9556
|
+
};
|
|
9454
9557
|
return ClassPool;
|
|
9455
9558
|
}();
|
|
9456
9559
|
|
|
@@ -9471,6 +9574,9 @@ var RenderData = function RenderData() {
|
|
|
9471
9574
|
this.mesh = mesh;
|
|
9472
9575
|
this.subMesh = subMesh;
|
|
9473
9576
|
};
|
|
9577
|
+
_proto.dispose = function dispose() {
|
|
9578
|
+
this.component = this.material = this.mesh = this.subMesh = null;
|
|
9579
|
+
};
|
|
9474
9580
|
return MeshRenderData;
|
|
9475
9581
|
}(RenderData);
|
|
9476
9582
|
|
|
@@ -9499,11 +9605,11 @@ var camera_declare = "#define GLSLIFY 1\nuniform vec3 camera_Position;"; // esli
|
|
|
9499
9605
|
|
|
9500
9606
|
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
|
|
9501
9607
|
|
|
9502
|
-
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
|
|
9608
|
+
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
|
|
9503
9609
|
|
|
9504
9610
|
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
|
|
9505
9611
|
|
|
9506
|
-
var color_share = "#define GLSLIFY 1\n#ifdef
|
|
9612
|
+
var color_share = "#define GLSLIFY 1\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\nvarying vec4 v_color;\n#endif\n"; // eslint-disable-line
|
|
9507
9613
|
|
|
9508
9614
|
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
|
|
9509
9615
|
|
|
@@ -9523,7 +9629,7 @@ var blendShape_input = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_BLENDSHAPE\n#ifde
|
|
|
9523
9629
|
|
|
9524
9630
|
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
|
|
9525
9631
|
|
|
9526
|
-
var color_vert = "#define GLSLIFY 1\n#ifdef
|
|
9632
|
+
var color_vert = "#define GLSLIFY 1\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\nv_color=COLOR_0;\n#endif\n"; // eslint-disable-line
|
|
9527
9633
|
|
|
9528
9634
|
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
|
|
9529
9635
|
|
|
@@ -9543,11 +9649,11 @@ var light_frag_define = "#define GLSLIFY 1\n#ifdef SCENE_DIRECT_LIGHT_COUNT\nstr
|
|
|
9543
9649
|
|
|
9544
9650
|
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
|
|
9545
9651
|
|
|
9546
|
-
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
|
|
9652
|
+
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
|
|
9547
9653
|
|
|
9548
9654
|
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
|
|
9549
9655
|
|
|
9550
|
-
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
|
|
9656
|
+
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
|
|
9551
9657
|
|
|
9552
9658
|
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
|
|
9553
9659
|
|
|
@@ -9581,9 +9687,9 @@ var noise_simplex_3D_grad = "#define GLSLIFY 1\nfloat simplex(vec3 v,out vec3 gr
|
|
|
9581
9687
|
|
|
9582
9688
|
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
|
|
9583
9689
|
|
|
9584
|
-
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 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
|
|
9690
|
+
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
|
|
9585
9691
|
|
|
9586
|
-
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(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE)\nmat3 tbn=getTBN();\n#endif\n#ifdef MATERIAL_HAS_NORMALTEXTURE\ngeometry.normal=getNormalByNormalTexture(tbn,material_NormalTexture,material_NormalIntensity,v_uv);\n#else\ngeometry.normal=getNormal();\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);\n#else\ngeometry.clearCoatNormal=getNormal();\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;\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
|
|
9692
|
+
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
|
|
9587
9693
|
|
|
9588
9694
|
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
|
|
9589
9695
|
|
|
@@ -9591,7 +9697,7 @@ var direct_irradiance_frag_define = "#define GLSLIFY 1\n#include <ShadowFragment
|
|
|
9591
9697
|
|
|
9592
9698
|
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
|
|
9593
9699
|
|
|
9594
|
-
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 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
|
|
9700
|
+
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
|
|
9595
9701
|
|
|
9596
9702
|
var PBRShaderLib = {
|
|
9597
9703
|
pbr_frag_define: pbr_frag_define,
|
|
@@ -9620,7 +9726,7 @@ var ShadowLib = {
|
|
|
9620
9726
|
ShadowVertex: ShadowVertex
|
|
9621
9727
|
};
|
|
9622
9728
|
|
|
9623
|
-
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(
|
|
9729
|
+
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
|
|
9624
9730
|
|
|
9625
9731
|
var ShaderLib = _extends({
|
|
9626
9732
|
common: common,
|
|
@@ -10616,6 +10722,9 @@ var RenderElement = /*#__PURE__*/ function() {
|
|
|
10616
10722
|
this.shaderPass = shaderPass;
|
|
10617
10723
|
this.renderState = renderState;
|
|
10618
10724
|
};
|
|
10725
|
+
_proto.dispose = function dispose() {
|
|
10726
|
+
this.data = this.shaderPass = this.renderState = null;
|
|
10727
|
+
};
|
|
10619
10728
|
return RenderElement;
|
|
10620
10729
|
}();
|
|
10621
10730
|
|
|
@@ -10635,7 +10744,6 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10635
10744
|
function Renderer1(entity) {
|
|
10636
10745
|
var _this;
|
|
10637
10746
|
_this = Component.call(this, entity) || this;
|
|
10638
|
-
/** ShaderData related to renderer. */ _this.shaderData = new ShaderData(ShaderDataGroup.Renderer);
|
|
10639
10747
|
/** @internal */ _this._onUpdateIndex = -1;
|
|
10640
10748
|
/** @internal */ _this._rendererIndex = -1;
|
|
10641
10749
|
/** @internal */ _this._globalShaderMacro = new ShaderMacroCollection();
|
|
@@ -10643,6 +10751,7 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10643
10751
|
_this._overrideUpdate = false;
|
|
10644
10752
|
_this._materials = [];
|
|
10645
10753
|
_this._dirtyUpdateFlag = 0;
|
|
10754
|
+
_this._shaderData = new ShaderData(ShaderDataGroup.Renderer);
|
|
10646
10755
|
_this._mvMatrix = new engineMath.Matrix();
|
|
10647
10756
|
_this._mvpMatrix = new engineMath.Matrix();
|
|
10648
10757
|
_this._mvInvMatrix = new engineMath.Matrix();
|
|
@@ -10771,6 +10880,14 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10771
10880
|
};
|
|
10772
10881
|
/**
|
|
10773
10882
|
* @internal
|
|
10883
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
10884
|
+
var materials = this._materials;
|
|
10885
|
+
for(var i = 0, n = materials.length; i < n; i++){
|
|
10886
|
+
target._setMaterial(i, materials[i]);
|
|
10887
|
+
}
|
|
10888
|
+
};
|
|
10889
|
+
/**
|
|
10890
|
+
* @internal
|
|
10774
10891
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
10775
10892
|
Component.prototype._onDestroy.call(this);
|
|
10776
10893
|
this.entity.transform._updateFlagManager.removeListener(this._onTransformChanged);
|
|
@@ -10780,15 +10897,30 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10780
10897
|
var _materials_i;
|
|
10781
10898
|
(_materials_i = materials[i]) == null ? void 0 : _materials_i._addReferCount(-1);
|
|
10782
10899
|
}
|
|
10900
|
+
this._entity = null;
|
|
10901
|
+
this._globalShaderMacro = null;
|
|
10902
|
+
this._bounds = null;
|
|
10903
|
+
this._materials = null;
|
|
10904
|
+
this._shaderData = null;
|
|
10905
|
+
this._mvMatrix = null;
|
|
10906
|
+
this._mvpMatrix = null;
|
|
10907
|
+
this._mvInvMatrix = null;
|
|
10908
|
+
this._normalMatrix = null;
|
|
10909
|
+
this._materialsInstanced = null;
|
|
10910
|
+
this._rendererLayer = null;
|
|
10783
10911
|
};
|
|
10784
|
-
|
|
10912
|
+
/**
|
|
10913
|
+
* @internal
|
|
10914
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
10785
10915
|
var entity = this.entity;
|
|
10786
10916
|
var worldMatrix = entity.transform.worldMatrix;
|
|
10787
10917
|
this._updateTransformShaderData(context, worldMatrix);
|
|
10788
10918
|
var layer = entity.layer;
|
|
10789
10919
|
this._rendererLayer.set(layer & 65535, layer >>> 16 & 65535, 0, 0);
|
|
10790
10920
|
};
|
|
10791
|
-
|
|
10921
|
+
/**
|
|
10922
|
+
* @internal
|
|
10923
|
+
*/ _proto._updateTransformShaderData = function _updateTransformShaderData(context, worldMatrix) {
|
|
10792
10924
|
var shaderData = this.shaderData;
|
|
10793
10925
|
var virtualCamera = context.virtualCamera;
|
|
10794
10926
|
var mvMatrix = this._mvMatrix;
|
|
@@ -10807,14 +10939,22 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10807
10939
|
shaderData.setMatrix(exports.Renderer._mvInvMatrixProperty, mvInvMatrix);
|
|
10808
10940
|
shaderData.setMatrix(exports.Renderer._normalMatrixProperty, normalMatrix);
|
|
10809
10941
|
};
|
|
10810
|
-
|
|
10942
|
+
/**
|
|
10943
|
+
* @internal
|
|
10944
|
+
*/ _proto._registerEntityTransformListener = function _registerEntityTransformListener() {
|
|
10811
10945
|
this.entity.transform._updateFlagManager.addListener(this._onTransformChanged);
|
|
10812
10946
|
};
|
|
10813
|
-
|
|
10814
|
-
|
|
10947
|
+
/**
|
|
10948
|
+
* @internal
|
|
10949
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {};
|
|
10950
|
+
/**
|
|
10951
|
+
* @internal
|
|
10952
|
+
*/ _proto._render = function _render(context) {
|
|
10815
10953
|
throw "not implement";
|
|
10816
10954
|
};
|
|
10817
|
-
|
|
10955
|
+
/**
|
|
10956
|
+
* @internal
|
|
10957
|
+
*/ _proto._createInstanceMaterial = function _createInstanceMaterial(material, index) {
|
|
10818
10958
|
var insMaterial = material.clone();
|
|
10819
10959
|
insMaterial.name = insMaterial.name + "(Instance)";
|
|
10820
10960
|
material._addReferCount(-1);
|
|
@@ -10837,10 +10977,20 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10837
10977
|
materials[index] = material;
|
|
10838
10978
|
}
|
|
10839
10979
|
};
|
|
10840
|
-
|
|
10980
|
+
/**
|
|
10981
|
+
* @internal
|
|
10982
|
+
*/ _proto._onTransformChanged = function _onTransformChanged(type) {
|
|
10841
10983
|
this._dirtyUpdateFlag |= 0x1;
|
|
10842
10984
|
};
|
|
10843
10985
|
_create_class(Renderer1, [
|
|
10986
|
+
{
|
|
10987
|
+
key: "shaderData",
|
|
10988
|
+
get: /**
|
|
10989
|
+
* ShaderData related to renderer.
|
|
10990
|
+
*/ function get() {
|
|
10991
|
+
return this._shaderData;
|
|
10992
|
+
}
|
|
10993
|
+
},
|
|
10844
10994
|
{
|
|
10845
10995
|
key: "isCulled",
|
|
10846
10996
|
get: /**
|
|
@@ -10925,9 +11075,6 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10925
11075
|
}(), function() {
|
|
10926
11076
|
_Renderer._rendererLayerProperty = ShaderProperty.getByName("renderer_Layer");
|
|
10927
11077
|
}(), _Renderer);
|
|
10928
|
-
__decorate([
|
|
10929
|
-
deepClone
|
|
10930
|
-
], exports.Renderer.prototype, "shaderData", void 0);
|
|
10931
11078
|
__decorate([
|
|
10932
11079
|
ignoreClone
|
|
10933
11080
|
], exports.Renderer.prototype, "_distanceForSort", void 0);
|
|
@@ -10950,11 +11097,14 @@ __decorate([
|
|
|
10950
11097
|
ignoreClone
|
|
10951
11098
|
], exports.Renderer.prototype, "_overrideUpdate", void 0);
|
|
10952
11099
|
__decorate([
|
|
10953
|
-
|
|
11100
|
+
ignoreClone
|
|
10954
11101
|
], exports.Renderer.prototype, "_materials", void 0);
|
|
10955
11102
|
__decorate([
|
|
10956
11103
|
ignoreClone
|
|
10957
11104
|
], exports.Renderer.prototype, "_dirtyUpdateFlag", void 0);
|
|
11105
|
+
__decorate([
|
|
11106
|
+
deepClone
|
|
11107
|
+
], exports.Renderer.prototype, "_shaderData", void 0);
|
|
10958
11108
|
__decorate([
|
|
10959
11109
|
ignoreClone
|
|
10960
11110
|
], exports.Renderer.prototype, "_mvMatrix", void 0);
|
|
@@ -11144,8 +11294,10 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11144
11294
|
_this = Renderer.call(this, entity) || this;
|
|
11145
11295
|
/** The mask layers the sprite mask influence to. */ _this.influenceLayers = exports.SpriteMaskLayer.Everything;
|
|
11146
11296
|
_this._sprite = null;
|
|
11147
|
-
_this.
|
|
11148
|
-
_this.
|
|
11297
|
+
_this._automaticWidth = 0;
|
|
11298
|
+
_this._automaticHeight = 0;
|
|
11299
|
+
_this._customWidth = undefined;
|
|
11300
|
+
_this._customHeight = undefined;
|
|
11149
11301
|
_this._flipX = false;
|
|
11150
11302
|
_this._flipY = false;
|
|
11151
11303
|
_this._alphaCutoff = 0.5;
|
|
@@ -11160,30 +11312,33 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11160
11312
|
/**
|
|
11161
11313
|
* @internal
|
|
11162
11314
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
11315
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
11163
11316
|
target.sprite = this._sprite;
|
|
11164
11317
|
};
|
|
11165
|
-
|
|
11166
|
-
|
|
11167
|
-
|
|
11318
|
+
/**
|
|
11319
|
+
* @internal
|
|
11320
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
11321
|
+
if (this.sprite) {
|
|
11322
|
+
SimpleSpriteAssembler.updatePositions(this);
|
|
11323
|
+
} else {
|
|
11168
11324
|
worldBounds.min.set(0, 0, 0);
|
|
11169
11325
|
worldBounds.max.set(0, 0, 0);
|
|
11170
|
-
} else {
|
|
11171
|
-
SimpleSpriteAssembler.updatePositions(this);
|
|
11172
11326
|
}
|
|
11173
11327
|
};
|
|
11174
11328
|
/**
|
|
11329
|
+
* @internal
|
|
11175
11330
|
* @inheritdoc
|
|
11176
11331
|
*/ _proto._render = function _render(context) {
|
|
11177
11332
|
var _this_sprite;
|
|
11178
11333
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
11179
11334
|
return;
|
|
11180
11335
|
}
|
|
11181
|
-
// Update position
|
|
11336
|
+
// Update position
|
|
11182
11337
|
if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
|
|
11183
11338
|
SimpleSpriteAssembler.updatePositions(this);
|
|
11184
11339
|
this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
|
|
11185
11340
|
}
|
|
11186
|
-
// Update uv
|
|
11341
|
+
// Update uv
|
|
11187
11342
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
11188
11343
|
SimpleSpriteAssembler.updateUVs(this);
|
|
11189
11344
|
this._dirtyUpdateFlag &= ~0x2;
|
|
@@ -11197,19 +11352,40 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11197
11352
|
this._maskElement = renderElement;
|
|
11198
11353
|
};
|
|
11199
11354
|
/**
|
|
11355
|
+
* @internal
|
|
11200
11356
|
* @inheritdoc
|
|
11201
11357
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
11202
|
-
var _this__sprite;
|
|
11203
11358
|
Renderer.prototype._onDestroy.call(this);
|
|
11204
|
-
|
|
11359
|
+
var sprite = this._sprite;
|
|
11360
|
+
if (sprite) {
|
|
11361
|
+
sprite._addReferCount(-1);
|
|
11362
|
+
sprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
11363
|
+
}
|
|
11364
|
+
this._entity = null;
|
|
11205
11365
|
this._sprite = null;
|
|
11206
11366
|
this._verticesData = null;
|
|
11207
11367
|
};
|
|
11368
|
+
_proto._calDefaultSize = function _calDefaultSize() {
|
|
11369
|
+
var sprite = this._sprite;
|
|
11370
|
+
if (sprite) {
|
|
11371
|
+
this._automaticWidth = sprite.width;
|
|
11372
|
+
this._automaticHeight = sprite.height;
|
|
11373
|
+
} else {
|
|
11374
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
11375
|
+
}
|
|
11376
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
11377
|
+
};
|
|
11208
11378
|
_proto._onSpriteChange = function _onSpriteChange(type) {
|
|
11209
11379
|
switch(type){
|
|
11210
11380
|
case SpriteModifyFlags.texture:
|
|
11211
11381
|
this.shaderData.setTexture(SpriteMask._textureProperty, this.sprite.texture);
|
|
11212
11382
|
break;
|
|
11383
|
+
case SpriteModifyFlags.size:
|
|
11384
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
11385
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
11386
|
+
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
11387
|
+
}
|
|
11388
|
+
break;
|
|
11213
11389
|
case SpriteModifyFlags.region:
|
|
11214
11390
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
11215
11391
|
this._dirtyUpdateFlag |= 0x3;
|
|
@@ -11217,22 +11393,31 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11217
11393
|
case SpriteModifyFlags.atlasRegion:
|
|
11218
11394
|
this._dirtyUpdateFlag |= 0x2;
|
|
11219
11395
|
break;
|
|
11396
|
+
case SpriteModifyFlags.pivot:
|
|
11397
|
+
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
11398
|
+
break;
|
|
11220
11399
|
}
|
|
11221
11400
|
};
|
|
11222
11401
|
_create_class(SpriteMask, [
|
|
11223
11402
|
{
|
|
11224
11403
|
key: "width",
|
|
11225
11404
|
get: /**
|
|
11226
|
-
* Render width.
|
|
11405
|
+
* Render width (in world coordinates).
|
|
11406
|
+
*
|
|
11407
|
+
* @remarks
|
|
11408
|
+
* If width is set, return the set value,
|
|
11409
|
+
* otherwise return `SpriteMask.sprite.width`.
|
|
11227
11410
|
*/ function get() {
|
|
11228
|
-
if (this.
|
|
11229
|
-
|
|
11411
|
+
if (this._customWidth !== undefined) {
|
|
11412
|
+
return this._customWidth;
|
|
11413
|
+
} else {
|
|
11414
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
11415
|
+
return this._automaticWidth;
|
|
11230
11416
|
}
|
|
11231
|
-
return this._width;
|
|
11232
11417
|
},
|
|
11233
11418
|
set: function set(value) {
|
|
11234
|
-
if (this.
|
|
11235
|
-
this.
|
|
11419
|
+
if (this._customWidth !== value) {
|
|
11420
|
+
this._customWidth = value;
|
|
11236
11421
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
11237
11422
|
}
|
|
11238
11423
|
}
|
|
@@ -11240,16 +11425,22 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11240
11425
|
{
|
|
11241
11426
|
key: "height",
|
|
11242
11427
|
get: /**
|
|
11243
|
-
* Render height.
|
|
11428
|
+
* Render height (in world coordinates).
|
|
11429
|
+
*
|
|
11430
|
+
* @remarks
|
|
11431
|
+
* If height is set, return the set value,
|
|
11432
|
+
* otherwise return `SpriteMask.sprite.height`.
|
|
11244
11433
|
*/ function get() {
|
|
11245
|
-
if (this.
|
|
11246
|
-
|
|
11434
|
+
if (this._customHeight !== undefined) {
|
|
11435
|
+
return this._customHeight;
|
|
11436
|
+
} else {
|
|
11437
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
11438
|
+
return this._automaticHeight;
|
|
11247
11439
|
}
|
|
11248
|
-
return this._height;
|
|
11249
11440
|
},
|
|
11250
11441
|
set: function set(value) {
|
|
11251
|
-
if (this.
|
|
11252
|
-
this.
|
|
11442
|
+
if (this._customHeight !== value) {
|
|
11443
|
+
this._customHeight = value;
|
|
11253
11444
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
11254
11445
|
}
|
|
11255
11446
|
}
|
|
@@ -11292,10 +11483,14 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11292
11483
|
set: function set(value) {
|
|
11293
11484
|
var lastSprite = this._sprite;
|
|
11294
11485
|
if (lastSprite !== value) {
|
|
11295
|
-
|
|
11486
|
+
if (lastSprite) {
|
|
11487
|
+
lastSprite._addReferCount(-1);
|
|
11488
|
+
lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
11489
|
+
}
|
|
11490
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
11296
11491
|
if (value) {
|
|
11492
|
+
value._addReferCount(1);
|
|
11297
11493
|
value._updateFlagManager.addListener(this._onSpriteChange);
|
|
11298
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
11299
11494
|
this.shaderData.setTexture(SpriteMask._textureProperty, value.texture);
|
|
11300
11495
|
} else {
|
|
11301
11496
|
this.shaderData.setTexture(SpriteMask._textureProperty, null);
|
|
@@ -11335,10 +11530,16 @@ __decorate([
|
|
|
11335
11530
|
], SpriteMask.prototype, "_sprite", void 0);
|
|
11336
11531
|
__decorate([
|
|
11337
11532
|
ignoreClone
|
|
11338
|
-
], SpriteMask.prototype, "
|
|
11533
|
+
], SpriteMask.prototype, "_automaticWidth", void 0);
|
|
11339
11534
|
__decorate([
|
|
11340
11535
|
ignoreClone
|
|
11341
|
-
], SpriteMask.prototype, "
|
|
11536
|
+
], SpriteMask.prototype, "_automaticHeight", void 0);
|
|
11537
|
+
__decorate([
|
|
11538
|
+
assignmentClone
|
|
11539
|
+
], SpriteMask.prototype, "_customWidth", void 0);
|
|
11540
|
+
__decorate([
|
|
11541
|
+
assignmentClone
|
|
11542
|
+
], SpriteMask.prototype, "_customHeight", void 0);
|
|
11342
11543
|
__decorate([
|
|
11343
11544
|
assignmentClone
|
|
11344
11545
|
], SpriteMask.prototype, "_flipX", void 0);
|
|
@@ -11356,7 +11557,9 @@ var /**
|
|
|
11356
11557
|
*/ SpriteMaskUpdateFlags;
|
|
11357
11558
|
(function(SpriteMaskUpdateFlags) {
|
|
11358
11559
|
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
|
|
11359
|
-
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/**
|
|
11560
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
|
|
11561
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
|
|
11562
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** All. */ "All"] = 0x7] = "All";
|
|
11360
11563
|
})(SpriteMaskUpdateFlags || (SpriteMaskUpdateFlags = {}));
|
|
11361
11564
|
|
|
11362
11565
|
/**
|
|
@@ -11621,7 +11824,9 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11621
11824
|
var platformBuffer = this._engine._hardwareRenderer.createPlatformBuffer(this._type, this._byteLength, this._bufferUsage);
|
|
11622
11825
|
this._platformBuffer = platformBuffer;
|
|
11623
11826
|
};
|
|
11624
|
-
|
|
11827
|
+
/**
|
|
11828
|
+
* @internal
|
|
11829
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
11625
11830
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
11626
11831
|
this._platformBuffer.destroy();
|
|
11627
11832
|
};
|
|
@@ -11711,14 +11916,19 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11711
11916
|
|
|
11712
11917
|
/**
|
|
11713
11918
|
* Sub-mesh, mainly contains drawing information.
|
|
11714
|
-
*/ var SubMesh = function
|
|
11715
|
-
|
|
11716
|
-
|
|
11717
|
-
|
|
11718
|
-
|
|
11719
|
-
|
|
11720
|
-
|
|
11721
|
-
|
|
11919
|
+
*/ var SubMesh = /*#__PURE__*/ function() {
|
|
11920
|
+
function SubMesh(start, count, topology) {
|
|
11921
|
+
if (start === void 0) start = 0;
|
|
11922
|
+
if (count === void 0) count = 0;
|
|
11923
|
+
if (topology === void 0) topology = exports.MeshTopology.Triangles;
|
|
11924
|
+
this.start = start;
|
|
11925
|
+
this.count = count;
|
|
11926
|
+
this.topology = topology;
|
|
11927
|
+
}
|
|
11928
|
+
var _proto = SubMesh.prototype;
|
|
11929
|
+
_proto.dispose = function dispose() {};
|
|
11930
|
+
return SubMesh;
|
|
11931
|
+
}();
|
|
11722
11932
|
|
|
11723
11933
|
/**
|
|
11724
11934
|
* Mesh.
|
|
@@ -11800,10 +12010,11 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11800
12010
|
/**
|
|
11801
12011
|
* @internal
|
|
11802
12012
|
*/ _proto._setVertexBufferBinding = function _setVertexBufferBinding(index, binding) {
|
|
11803
|
-
|
|
11804
|
-
|
|
11805
|
-
|
|
11806
|
-
|
|
12013
|
+
var referCount = this._getReferCount();
|
|
12014
|
+
if (referCount > 0) {
|
|
12015
|
+
var _this__vertexBufferBindings_index;
|
|
12016
|
+
(_this__vertexBufferBindings_index = this._vertexBufferBindings[index]) == null ? void 0 : _this__vertexBufferBindings_index._buffer._addReferCount(-referCount);
|
|
12017
|
+
binding == null ? void 0 : binding._buffer._addReferCount(referCount);
|
|
11807
12018
|
}
|
|
11808
12019
|
this._vertexBufferBindings[index] = binding;
|
|
11809
12020
|
this._bufferStructChanged = true;
|
|
@@ -11815,11 +12026,13 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11815
12026
|
this._bufferStructChanged = false;
|
|
11816
12027
|
};
|
|
11817
12028
|
_proto._addReferCount = function _addReferCount(value) {
|
|
12029
|
+
var _this__indexBufferBinding;
|
|
11818
12030
|
GraphicsResource.prototype._addReferCount.call(this, value);
|
|
11819
12031
|
var vertexBufferBindings = this._vertexBufferBindings;
|
|
11820
12032
|
for(var i = 0, n = vertexBufferBindings.length; i < n; i++){
|
|
11821
12033
|
vertexBufferBindings[i]._buffer._addReferCount(value);
|
|
11822
12034
|
}
|
|
12035
|
+
(_this__indexBufferBinding = this._indexBufferBinding) == null ? void 0 : _this__indexBufferBinding._buffer._addReferCount(value);
|
|
11823
12036
|
};
|
|
11824
12037
|
_proto._rebuild = function _rebuild() {
|
|
11825
12038
|
this._engine._hardwareRenderer.createPlatformPrimitive(this);
|
|
@@ -11834,14 +12047,23 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11834
12047
|
this._vertexElementMap = null;
|
|
11835
12048
|
this._platformPrimitive.destroy();
|
|
11836
12049
|
};
|
|
11837
|
-
|
|
12050
|
+
/**
|
|
12051
|
+
* @internal
|
|
12052
|
+
*/ _proto._setVertexElements = function _setVertexElements(elements) {
|
|
11838
12053
|
this._clearVertexElements();
|
|
11839
12054
|
for(var i = 0, n = elements.length; i < n; i++){
|
|
11840
12055
|
this._addVertexElement(elements[i]);
|
|
11841
12056
|
}
|
|
11842
12057
|
};
|
|
11843
|
-
|
|
12058
|
+
/**
|
|
12059
|
+
* @internal
|
|
12060
|
+
*/ _proto._setIndexBufferBinding = function _setIndexBufferBinding(binding) {
|
|
11844
12061
|
var lastBinding = this._indexBufferBinding;
|
|
12062
|
+
var referCount = this._getReferCount();
|
|
12063
|
+
if (referCount > 0) {
|
|
12064
|
+
lastBinding == null ? void 0 : lastBinding.buffer._addReferCount(-referCount);
|
|
12065
|
+
binding == null ? void 0 : binding.buffer._addReferCount(referCount);
|
|
12066
|
+
}
|
|
11845
12067
|
if (binding) {
|
|
11846
12068
|
this._indexBufferBinding = binding;
|
|
11847
12069
|
this._glIndexType = BufferUtil._getGLIndexType(binding.format);
|
|
@@ -12157,6 +12379,7 @@ var MeshModifyFlags;
|
|
|
12157
12379
|
var subDataDirtyFlags = this._subDataDirtyFlags;
|
|
12158
12380
|
var blendShapeFloatStride = this._vertexElementCount * 3;
|
|
12159
12381
|
var blendShapeByteStride = blendShapeFloatStride * 4;
|
|
12382
|
+
var bufferOffset = this._bufferBindingOffset;
|
|
12160
12383
|
// @todo: should fix bug when dataChangedFlag is true
|
|
12161
12384
|
for(var i = 0, n = blendShapes.length; i < n; i++){
|
|
12162
12385
|
var dataChangedFlag = subDataDirtyFlags[i];
|
|
@@ -12174,7 +12397,7 @@ var MeshModifyFlags;
|
|
|
12174
12397
|
var offset = indexInBuffer * blendShapeFloatStride;
|
|
12175
12398
|
var storeInfo = storeInfos[i];
|
|
12176
12399
|
storeInfo || (storeInfos[i] = storeInfo = new engineMath.Vector2());
|
|
12177
|
-
storeInfo.set(
|
|
12400
|
+
storeInfo.set(bufferOffset + bufferIndex, indexInBuffer * blendShapeByteStride); // BufferOffset is mesh vertexBuffer offset
|
|
12178
12401
|
var deltaPositions = endFrame.deltaPositions;
|
|
12179
12402
|
for(var j = 0; j < vertexCount; j++){
|
|
12180
12403
|
var start = offset + bufferFloatStride * j;
|
|
@@ -12978,7 +13201,9 @@ var MeshModifyFlags;
|
|
|
12978
13201
|
}
|
|
12979
13202
|
this.setTangents(tangents);
|
|
12980
13203
|
};
|
|
12981
|
-
|
|
13204
|
+
/**
|
|
13205
|
+
* @internal
|
|
13206
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
12982
13207
|
Mesh.prototype._onDestroy.call(this);
|
|
12983
13208
|
this._readable && this._releaseCache();
|
|
12984
13209
|
};
|
|
@@ -13449,24 +13674,31 @@ var VertexChangedFlags;
|
|
|
13449
13674
|
function MeshRenderer(entity) {
|
|
13450
13675
|
var _this;
|
|
13451
13676
|
_this = Renderer.call(this, entity) || this;
|
|
13677
|
+
_this._enableVertexColor = false;
|
|
13452
13678
|
_this._onMeshChanged = _this._onMeshChanged.bind(_assert_this_initialized(_this));
|
|
13453
13679
|
return _this;
|
|
13454
13680
|
}
|
|
13455
13681
|
var _proto = MeshRenderer.prototype;
|
|
13456
|
-
|
|
13682
|
+
/**
|
|
13683
|
+
* @internal
|
|
13684
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
13457
13685
|
Renderer.prototype._onDestroy.call(this);
|
|
13458
13686
|
var mesh = this._mesh;
|
|
13459
|
-
if (mesh
|
|
13460
|
-
mesh._addReferCount(-1);
|
|
13687
|
+
if (mesh) {
|
|
13688
|
+
mesh.destroyed || mesh._addReferCount(-1);
|
|
13689
|
+
mesh._updateFlagManager.removeListener(this._onMeshChanged);
|
|
13461
13690
|
this._mesh = null;
|
|
13462
13691
|
}
|
|
13463
13692
|
};
|
|
13464
13693
|
/**
|
|
13465
13694
|
* @internal
|
|
13466
13695
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
13696
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
13467
13697
|
target.mesh = this._mesh;
|
|
13468
13698
|
};
|
|
13469
|
-
|
|
13699
|
+
/**
|
|
13700
|
+
* @internal
|
|
13701
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
13470
13702
|
var mesh = this._mesh;
|
|
13471
13703
|
if (mesh) {
|
|
13472
13704
|
var localBounds = mesh.bounds;
|
|
@@ -13477,7 +13709,9 @@ var VertexChangedFlags;
|
|
|
13477
13709
|
worldBounds.max.set(0, 0, 0);
|
|
13478
13710
|
}
|
|
13479
13711
|
};
|
|
13480
|
-
|
|
13712
|
+
/**
|
|
13713
|
+
* @internal
|
|
13714
|
+
*/ _proto._render = function _render(context) {
|
|
13481
13715
|
var mesh = this._mesh;
|
|
13482
13716
|
if (mesh) {
|
|
13483
13717
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
@@ -13487,7 +13721,7 @@ var VertexChangedFlags;
|
|
|
13487
13721
|
shaderData.disableMacro(MeshRenderer._uv1Macro);
|
|
13488
13722
|
shaderData.disableMacro(MeshRenderer._normalMacro);
|
|
13489
13723
|
shaderData.disableMacro(MeshRenderer._tangentMacro);
|
|
13490
|
-
shaderData.disableMacro(MeshRenderer.
|
|
13724
|
+
shaderData.disableMacro(MeshRenderer._enableVertexColorMacro);
|
|
13491
13725
|
for(var i = 0, n = vertexElements.length; i < n; i++){
|
|
13492
13726
|
switch(vertexElements[i].semantic){
|
|
13493
13727
|
case "TEXCOORD_0":
|
|
@@ -13503,7 +13737,7 @@ var VertexChangedFlags;
|
|
|
13503
13737
|
shaderData.enableMacro(MeshRenderer._tangentMacro);
|
|
13504
13738
|
break;
|
|
13505
13739
|
case "COLOR_0":
|
|
13506
|
-
shaderData.enableMacro(MeshRenderer.
|
|
13740
|
+
this._enableVertexColor && shaderData.enableMacro(MeshRenderer._enableVertexColorMacro);
|
|
13507
13741
|
break;
|
|
13508
13742
|
}
|
|
13509
13743
|
}
|
|
@@ -13554,6 +13788,20 @@ var VertexChangedFlags;
|
|
|
13554
13788
|
this._setMesh(value);
|
|
13555
13789
|
}
|
|
13556
13790
|
}
|
|
13791
|
+
},
|
|
13792
|
+
{
|
|
13793
|
+
key: "enableVertexColor",
|
|
13794
|
+
get: /**
|
|
13795
|
+
* Whether enable vertex color.
|
|
13796
|
+
*/ function get() {
|
|
13797
|
+
return this._enableVertexColor;
|
|
13798
|
+
},
|
|
13799
|
+
set: function set(value) {
|
|
13800
|
+
if (value !== this._enableVertexColor) {
|
|
13801
|
+
this._dirtyUpdateFlag |= 0x2;
|
|
13802
|
+
this._enableVertexColor = value;
|
|
13803
|
+
}
|
|
13804
|
+
}
|
|
13557
13805
|
}
|
|
13558
13806
|
]);
|
|
13559
13807
|
return MeshRenderer;
|
|
@@ -13571,7 +13819,7 @@ var VertexChangedFlags;
|
|
|
13571
13819
|
MeshRenderer._tangentMacro = ShaderMacro.getByName("RENDERER_HAS_TANGENT");
|
|
13572
13820
|
})();
|
|
13573
13821
|
(function() {
|
|
13574
|
-
MeshRenderer.
|
|
13822
|
+
MeshRenderer._enableVertexColorMacro = ShaderMacro.getByName("RENDERER_ENABLE_VERTEXCOLOR");
|
|
13575
13823
|
})();
|
|
13576
13824
|
__decorate([
|
|
13577
13825
|
ignoreClone
|
|
@@ -13603,7 +13851,7 @@ var /**
|
|
|
13603
13851
|
// Limit size to 256 to avoid some problem:
|
|
13604
13852
|
// 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!
|
|
13605
13853
|
// 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.
|
|
13606
|
-
maxVertexUniformVectors = Math.min(maxVertexUniformVectors,
|
|
13854
|
+
maxVertexUniformVectors = Math.min(maxVertexUniformVectors, rhi._options._maxAllowSkinUniformVectorCount);
|
|
13607
13855
|
_this._maxVertexUniformVectors = maxVertexUniformVectors;
|
|
13608
13856
|
_this._onLocalBoundsChanged = _this._onLocalBoundsChanged.bind(_assert_this_initialized(_this));
|
|
13609
13857
|
var localBounds = _this._localBounds;
|
|
@@ -13638,7 +13886,9 @@ var /**
|
|
|
13638
13886
|
}
|
|
13639
13887
|
}
|
|
13640
13888
|
};
|
|
13641
|
-
|
|
13889
|
+
/**
|
|
13890
|
+
* @internal
|
|
13891
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
13642
13892
|
var entity = this.entity;
|
|
13643
13893
|
var worldMatrix = this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
|
|
13644
13894
|
this._updateTransformShaderData(context, worldMatrix);
|
|
@@ -13664,6 +13914,7 @@ var /**
|
|
|
13664
13914
|
(_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
|
|
13665
13915
|
this._jointTexture = new Texture2D(engine, 4, jointCount, exports.TextureFormat.R32G32B32A32, false);
|
|
13666
13916
|
this._jointTexture.filterMode = exports.TextureFilterMode.Point;
|
|
13917
|
+
this._jointTexture.isGCIgnored = true;
|
|
13667
13918
|
}
|
|
13668
13919
|
shaderData.disableMacro("RENDERER_JOINTS_NUM");
|
|
13669
13920
|
shaderData.enableMacro("RENDERER_USE_JOINT_TEXTURE");
|
|
@@ -13689,14 +13940,37 @@ var /**
|
|
|
13689
13940
|
};
|
|
13690
13941
|
/**
|
|
13691
13942
|
* @internal
|
|
13943
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
13944
|
+
var _this__rootBone, _this__jointTexture;
|
|
13945
|
+
MeshRenderer.prototype._onDestroy.call(this);
|
|
13946
|
+
(_this__rootBone = this._rootBone) == null ? void 0 : _this__rootBone.transform._updateFlagManager.removeListener(this._onTransformChanged);
|
|
13947
|
+
this._rootBone = null;
|
|
13948
|
+
this._jointDataCreateCache = null;
|
|
13949
|
+
this._skin = null;
|
|
13950
|
+
this._blendShapeWeights = null;
|
|
13951
|
+
this._localBounds = null;
|
|
13952
|
+
this._jointMatrices = null;
|
|
13953
|
+
(_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
|
|
13954
|
+
this._jointTexture = null;
|
|
13955
|
+
if (this._jointEntities) {
|
|
13956
|
+
this._jointEntities.length = 0;
|
|
13957
|
+
this._jointEntities = null;
|
|
13958
|
+
}
|
|
13959
|
+
};
|
|
13960
|
+
/**
|
|
13961
|
+
* @internal
|
|
13692
13962
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
13693
13963
|
MeshRenderer.prototype._cloneTo.call(this, target);
|
|
13694
13964
|
this._blendShapeWeights && (target._blendShapeWeights = this._blendShapeWeights.slice());
|
|
13695
13965
|
};
|
|
13696
|
-
|
|
13966
|
+
/**
|
|
13967
|
+
* @internal
|
|
13968
|
+
*/ _proto._registerEntityTransformListener = function _registerEntityTransformListener() {
|
|
13697
13969
|
// Cancel register listener to entity transform.
|
|
13698
13970
|
};
|
|
13699
|
-
|
|
13971
|
+
/**
|
|
13972
|
+
* @internal
|
|
13973
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
13700
13974
|
if (this._rootBone) {
|
|
13701
13975
|
var localBounds = this._localBounds;
|
|
13702
13976
|
var worldMatrix = this._rootBone.transform.worldMatrix;
|
|
@@ -15149,14 +15423,17 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
|
|
|
15149
15423
|
_proto._createMesh = function _createMesh(engine, index) {
|
|
15150
15424
|
var MAX_VERTEX_COUNT = Basic2DBatcher.MAX_VERTEX_COUNT;
|
|
15151
15425
|
var mesh = new BufferMesh(engine, "BufferMesh" + index);
|
|
15426
|
+
mesh.isGCIgnored = true;
|
|
15152
15427
|
var vertexElements = [];
|
|
15153
15428
|
var vertexStride = this.createVertexElements(vertexElements);
|
|
15154
15429
|
// vertices
|
|
15155
|
-
this._vertexBuffers[index] = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * 4 * vertexStride, exports.BufferUsage.Dynamic);
|
|
15430
|
+
var vertexBuffer = this._vertexBuffers[index] = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * 4 * vertexStride, exports.BufferUsage.Dynamic);
|
|
15431
|
+
vertexBuffer.isGCIgnored = true;
|
|
15156
15432
|
// indices
|
|
15157
|
-
this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 3, exports.BufferUsage.Dynamic);
|
|
15158
|
-
|
|
15159
|
-
mesh.
|
|
15433
|
+
var indiceBuffer = this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 2 * 3, exports.BufferUsage.Dynamic);
|
|
15434
|
+
indiceBuffer.isGCIgnored = true;
|
|
15435
|
+
mesh.setVertexBufferBinding(vertexBuffer, vertexStride);
|
|
15436
|
+
mesh.setIndexBufferBinding(indiceBuffer, exports.IndexFormat.UInt16);
|
|
15160
15437
|
mesh.setVertexElements(vertexElements);
|
|
15161
15438
|
return mesh;
|
|
15162
15439
|
};
|
|
@@ -15380,6 +15657,9 @@ var SpriteMaskRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
15380
15657
|
this.material = material;
|
|
15381
15658
|
this.verticesData = verticesData;
|
|
15382
15659
|
};
|
|
15660
|
+
_proto.dispose = function dispose() {
|
|
15661
|
+
this.component = this.material = this.verticesData = null;
|
|
15662
|
+
};
|
|
15383
15663
|
return SpriteMaskRenderData;
|
|
15384
15664
|
}(RenderData);
|
|
15385
15665
|
|
|
@@ -15400,6 +15680,9 @@ var SpriteRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
15400
15680
|
this.texture = texture;
|
|
15401
15681
|
this.dataIndex = dataIndex;
|
|
15402
15682
|
};
|
|
15683
|
+
_proto.dispose = function dispose() {
|
|
15684
|
+
this.component = this.material = this.verticesData = this.texture = null;
|
|
15685
|
+
};
|
|
15403
15686
|
return SpriteRenderData;
|
|
15404
15687
|
}(RenderData);
|
|
15405
15688
|
|
|
@@ -15412,6 +15695,11 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
15412
15695
|
_this.multiRenderData = true;
|
|
15413
15696
|
return _this;
|
|
15414
15697
|
}
|
|
15698
|
+
var _proto = TextRenderData.prototype;
|
|
15699
|
+
_proto.dispose = function dispose() {
|
|
15700
|
+
this.component = this.material = null;
|
|
15701
|
+
this.charsData.length = 0;
|
|
15702
|
+
};
|
|
15415
15703
|
return TextRenderData;
|
|
15416
15704
|
}(RenderData);
|
|
15417
15705
|
|
|
@@ -15440,6 +15728,12 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
15440
15728
|
var _proto = Sky.prototype;
|
|
15441
15729
|
/**
|
|
15442
15730
|
* @internal
|
|
15731
|
+
*/ _proto.destroy = function destroy() {
|
|
15732
|
+
this.mesh = null;
|
|
15733
|
+
this.material = null;
|
|
15734
|
+
};
|
|
15735
|
+
/**
|
|
15736
|
+
* @internal
|
|
15443
15737
|
*/ _proto._render = function _render(context) {
|
|
15444
15738
|
var _this = this, material = _this.material, mesh = _this.mesh;
|
|
15445
15739
|
if (!material) {
|
|
@@ -15480,6 +15774,40 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
15480
15774
|
rhi.drawPrimitive(mesh, mesh.subMesh, program);
|
|
15481
15775
|
cameraShaderData.setMatrix(RenderContext.vpMatrixProperty, originViewProjMatrix);
|
|
15482
15776
|
};
|
|
15777
|
+
_create_class(Sky, [
|
|
15778
|
+
{
|
|
15779
|
+
key: "material",
|
|
15780
|
+
get: /**
|
|
15781
|
+
* Material of the sky.
|
|
15782
|
+
*/ function get() {
|
|
15783
|
+
return this._material;
|
|
15784
|
+
},
|
|
15785
|
+
set: function set(value) {
|
|
15786
|
+
if (this._material !== value) {
|
|
15787
|
+
var _this__material;
|
|
15788
|
+
value == null ? void 0 : value._addReferCount(1);
|
|
15789
|
+
(_this__material = this._material) == null ? void 0 : _this__material._addReferCount(-1);
|
|
15790
|
+
this._material = value;
|
|
15791
|
+
}
|
|
15792
|
+
}
|
|
15793
|
+
},
|
|
15794
|
+
{
|
|
15795
|
+
key: "mesh",
|
|
15796
|
+
get: /**
|
|
15797
|
+
* Mesh of the sky.
|
|
15798
|
+
*/ function get() {
|
|
15799
|
+
return this._mesh;
|
|
15800
|
+
},
|
|
15801
|
+
set: function set(value) {
|
|
15802
|
+
if (this._mesh !== value) {
|
|
15803
|
+
var _this__mesh;
|
|
15804
|
+
value == null ? void 0 : value._addReferCount(1);
|
|
15805
|
+
(_this__mesh = this._mesh) == null ? void 0 : _this__mesh._addReferCount(-1);
|
|
15806
|
+
this._mesh = value;
|
|
15807
|
+
}
|
|
15808
|
+
}
|
|
15809
|
+
}
|
|
15810
|
+
]);
|
|
15483
15811
|
return Sky;
|
|
15484
15812
|
}();
|
|
15485
15813
|
(function() {
|
|
@@ -15515,9 +15843,19 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
15515
15843
|
var _proto = Background.prototype;
|
|
15516
15844
|
/**
|
|
15517
15845
|
* @internal
|
|
15846
|
+
*/ _proto.destroy = function destroy() {
|
|
15847
|
+
this._mesh._addReferCount(-1);
|
|
15848
|
+
this._mesh = null;
|
|
15849
|
+
this.texture = null;
|
|
15850
|
+
this.solidColor = null;
|
|
15851
|
+
this.sky.destroy();
|
|
15852
|
+
};
|
|
15853
|
+
/**
|
|
15854
|
+
* @internal
|
|
15518
15855
|
* Standalone for CanvasRenderer plugin.
|
|
15519
15856
|
*/ _proto._initMesh = function _initMesh(engine) {
|
|
15520
15857
|
this._mesh = this._createPlane(engine);
|
|
15858
|
+
this._mesh._addReferCount(1);
|
|
15521
15859
|
};
|
|
15522
15860
|
/**
|
|
15523
15861
|
* @internal
|
|
@@ -15589,6 +15927,9 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
15589
15927
|
},
|
|
15590
15928
|
set: function set(value) {
|
|
15591
15929
|
if (this._texture !== value) {
|
|
15930
|
+
var _this__texture;
|
|
15931
|
+
value == null ? void 0 : value._addReferCount(1);
|
|
15932
|
+
(_this__texture = this._texture) == null ? void 0 : _this__texture._addReferCount(-1);
|
|
15592
15933
|
this._texture = value;
|
|
15593
15934
|
this._engine._backgroundTextureMaterial.shaderData.setTexture("material_BaseTexture", value);
|
|
15594
15935
|
}
|
|
@@ -15892,8 +16233,6 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
15892
16233
|
function Scene(engine, name) {
|
|
15893
16234
|
var _this;
|
|
15894
16235
|
_this = EngineObject.call(this, engine) || this;
|
|
15895
|
-
/** The background of the scene. */ _this.background = new Background(_this._engine);
|
|
15896
|
-
/** Scene-related shader data. */ _this.shaderData = new ShaderData(ShaderDataGroup.Scene);
|
|
15897
16236
|
/** If cast shadows. */ _this.castShadows = true;
|
|
15898
16237
|
/** The resolution of the shadow maps. */ _this.shadowResolution = exports.ShadowResolution.Medium;
|
|
15899
16238
|
/** The splits of two cascade distribution. */ _this.shadowTwoCascadeSplits = 1.0 / 3.0;
|
|
@@ -15903,6 +16242,8 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
15903
16242
|
/** @internal */ _this._isActiveInEngine = false;
|
|
15904
16243
|
/** @internal */ _this._globalShaderMacro = new ShaderMacroCollection();
|
|
15905
16244
|
/** @internal */ _this._rootEntities = [];
|
|
16245
|
+
_this._background = new Background(_this._engine);
|
|
16246
|
+
_this._shaderData = new ShaderData(ShaderDataGroup.Scene);
|
|
15906
16247
|
_this._shadowCascades = exports.ShadowCascadesMode.NoCascades;
|
|
15907
16248
|
_this._fogMode = exports.FogMode.None;
|
|
15908
16249
|
_this._fogColor = new engineMath.Color(0.5, 0.5, 0.5, 1.0);
|
|
@@ -16066,9 +16407,11 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
16066
16407
|
var sunLightIndex = lightManager._getSunLightIndex();
|
|
16067
16408
|
if (sunLightIndex !== -1) {
|
|
16068
16409
|
var sunlight = lightManager._directLights.get(sunLightIndex);
|
|
16069
|
-
shaderData.setColor(Scene._sunlightColorProperty, sunlight.
|
|
16410
|
+
shaderData.setColor(Scene._sunlightColorProperty, sunlight._getLightIntensityColor());
|
|
16070
16411
|
shaderData.setVector3(Scene._sunlightDirectionProperty, sunlight.direction);
|
|
16071
16412
|
this._sunLight = sunlight;
|
|
16413
|
+
} else {
|
|
16414
|
+
this._sunLight = null;
|
|
16072
16415
|
}
|
|
16073
16416
|
if (this.castShadows && this._sunLight && this._sunLight.shadowType !== exports.ShadowType.None) {
|
|
16074
16417
|
shaderData.enableMacro("SCENE_SHADOW_TYPE", this._sunLight.shadowType.toString());
|
|
@@ -16097,6 +16440,7 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
16097
16440
|
this._rootEntities[0].destroy();
|
|
16098
16441
|
}
|
|
16099
16442
|
this._activeCameras.length = 0;
|
|
16443
|
+
this.background.destroy();
|
|
16100
16444
|
this.shaderData._addReferCount(-1);
|
|
16101
16445
|
};
|
|
16102
16446
|
_proto._addToRootEntityList = function _addToRootEntityList(index, rootEntity) {
|
|
@@ -16127,6 +16471,22 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
16127
16471
|
this._fogParams.w = density / Math.sqrt(Math.LN2);
|
|
16128
16472
|
};
|
|
16129
16473
|
_create_class(Scene, [
|
|
16474
|
+
{
|
|
16475
|
+
key: "shaderData",
|
|
16476
|
+
get: /**
|
|
16477
|
+
* Scene-related shader data.
|
|
16478
|
+
*/ function get() {
|
|
16479
|
+
return this._shaderData;
|
|
16480
|
+
}
|
|
16481
|
+
},
|
|
16482
|
+
{
|
|
16483
|
+
key: "background",
|
|
16484
|
+
get: /**
|
|
16485
|
+
* The background of the scene.
|
|
16486
|
+
*/ function get() {
|
|
16487
|
+
return this._background;
|
|
16488
|
+
}
|
|
16489
|
+
},
|
|
16130
16490
|
{
|
|
16131
16491
|
key: "shadowCascades",
|
|
16132
16492
|
get: /**
|
|
@@ -16554,7 +16914,7 @@ ShaderPool.init();
|
|
|
16554
16914
|
_this._spriteDefaultMaterial = _this._createSpriteMaterial();
|
|
16555
16915
|
_this._spriteMaskDefaultMaterial = _this._createSpriteMaskMaterial();
|
|
16556
16916
|
_this._textDefaultFont = Font.createFromOS(_assert_this_initialized(_this), "Arial");
|
|
16557
|
-
_this._textDefaultFont.isGCIgnored =
|
|
16917
|
+
_this._textDefaultFont.isGCIgnored = true;
|
|
16558
16918
|
_this.inputManager = new InputManager(_assert_this_initialized(_this));
|
|
16559
16919
|
_this._initMagentaTextures(hardwareRenderer);
|
|
16560
16920
|
if (!hardwareRenderer.canIUse(exports.GLCapabilityType.depthTexture)) {
|
|
@@ -16565,6 +16925,7 @@ ShaderPool.init();
|
|
|
16565
16925
|
_this._depthTexture2D = depthTexture2D;
|
|
16566
16926
|
}
|
|
16567
16927
|
var magentaMaterial = new Material(_assert_this_initialized(_this), Shader.find("unlit"));
|
|
16928
|
+
magentaMaterial.isGCIgnored = true;
|
|
16568
16929
|
magentaMaterial.shaderData.setColor("material_BaseColor", new Color(1.0, 0.0, 1.01, 1.0));
|
|
16569
16930
|
_this._magentaMaterial = magentaMaterial;
|
|
16570
16931
|
var backgroundTextureMaterial = new Material(_assert_this_initialized(_this), Shader.find("background-texture"));
|
|
@@ -16791,7 +17152,9 @@ ShaderPool.init();
|
|
|
16791
17152
|
this._magentaTexture2DArray = magentaTexture2DArray;
|
|
16792
17153
|
}
|
|
16793
17154
|
};
|
|
16794
|
-
|
|
17155
|
+
/**
|
|
17156
|
+
* @internal
|
|
17157
|
+
*/ _proto._initialize = function _initialize(configuration) {
|
|
16795
17158
|
var _this = this;
|
|
16796
17159
|
var physics = configuration.physics;
|
|
16797
17160
|
if (physics) {
|
|
@@ -17113,7 +17476,9 @@ ShaderPool.init();
|
|
|
17113
17476
|
this._entity._removeScript(this);
|
|
17114
17477
|
this._waitHandlingInValid = false;
|
|
17115
17478
|
};
|
|
17116
|
-
|
|
17479
|
+
/**
|
|
17480
|
+
* @internal
|
|
17481
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
17117
17482
|
Component.prototype._onDestroy.call(this);
|
|
17118
17483
|
this._engine._componentsManager.addPendingDestroyScript(this);
|
|
17119
17484
|
};
|
|
@@ -18063,7 +18428,7 @@ var /**
|
|
|
18063
18428
|
// prepare render target
|
|
18064
18429
|
var renderTarget = this._getAvailableRenderTarget();
|
|
18065
18430
|
// @todo: shouldn't set viewport and scissor in activeRenderTarget
|
|
18066
|
-
rhi.activeRenderTarget(renderTarget,
|
|
18431
|
+
rhi.activeRenderTarget(renderTarget, CascadedShadowCasterPass._viewport, 0);
|
|
18067
18432
|
if (this._supportDepthTexture) {
|
|
18068
18433
|
rhi.clearRenderTarget(engine, exports.CameraClearFlags.Depth, null);
|
|
18069
18434
|
} else {
|
|
@@ -18185,11 +18550,13 @@ var /**
|
|
|
18185
18550
|
if (engine._hardwareRenderer._isWebGL2) {
|
|
18186
18551
|
depthTexture.depthCompareFunction = exports.TextureDepthCompareFunction.Less;
|
|
18187
18552
|
}
|
|
18553
|
+
renderTarget == null ? void 0 : renderTarget._addReferCount(-1);
|
|
18188
18554
|
if (this._supportDepthTexture) {
|
|
18189
18555
|
renderTarget = this._renderTargets = new RenderTarget(engine, width, height, null, depthTexture);
|
|
18190
18556
|
} else {
|
|
18191
18557
|
renderTarget = this._renderTargets = new RenderTarget(engine, width, height, depthTexture);
|
|
18192
18558
|
}
|
|
18559
|
+
renderTarget._addReferCount(1);
|
|
18193
18560
|
}
|
|
18194
18561
|
return renderTarget;
|
|
18195
18562
|
};
|
|
@@ -18212,7 +18579,12 @@ var /**
|
|
|
18212
18579
|
var height = shadowCascades == exports.ShadowCascadesMode.TwoCascades ? shadowTileResolution : shadowTileResolution * 2;
|
|
18213
18580
|
this._shadowMapSize.set(1.0 / width, 1.0 / height, width, height);
|
|
18214
18581
|
}
|
|
18215
|
-
this._renderTargets
|
|
18582
|
+
var renderTargets = this._renderTargets;
|
|
18583
|
+
if (renderTargets) {
|
|
18584
|
+
renderTargets._addReferCount(-1);
|
|
18585
|
+
renderTargets.destroy();
|
|
18586
|
+
this._renderTargets = null;
|
|
18587
|
+
}
|
|
18216
18588
|
var viewportOffset = this._viewportOffsets;
|
|
18217
18589
|
var shadowTileResolution1 = this._shadowTileResolution;
|
|
18218
18590
|
switch(shadowCascades){
|
|
@@ -18268,6 +18640,9 @@ var /**
|
|
|
18268
18640
|
(function() {
|
|
18269
18641
|
CascadedShadowCasterPass._cascadesSplitDistance = new Array(CascadedShadowCasterPass._maxCascades + 1);
|
|
18270
18642
|
})();
|
|
18643
|
+
(function() {
|
|
18644
|
+
CascadedShadowCasterPass._viewport = new engineMath.Vector4(0, 0, 1, 1);
|
|
18645
|
+
})();
|
|
18271
18646
|
(function() {
|
|
18272
18647
|
CascadedShadowCasterPass._clearColor = new engineMath.Color(1, 1, 1, 1);
|
|
18273
18648
|
})();
|
|
@@ -18580,7 +18955,6 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
18580
18955
|
function Camera1(entity) {
|
|
18581
18956
|
var _this;
|
|
18582
18957
|
_this = Component.call(this, entity) || this;
|
|
18583
|
-
/** Shader data. */ _this.shaderData = new ShaderData(ShaderDataGroup.Camera);
|
|
18584
18958
|
/** Rendering priority - A Camera with higher priority will be rendered on top of a camera with lower priority. */ _this.priority = 0;
|
|
18585
18959
|
/** Whether to enable frustum culling, it is enabled by default. */ _this.enableFrustumCulling = true;
|
|
18586
18960
|
/**
|
|
@@ -18596,6 +18970,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
18596
18970
|
/** @internal */ _this._virtualCamera = new VirtualCamera();
|
|
18597
18971
|
/** @internal */ _this._replacementShader = null;
|
|
18598
18972
|
/** @internal */ _this._replacementSubShaderTag = null;
|
|
18973
|
+
_this._shaderData = new ShaderData(ShaderDataGroup.Camera);
|
|
18599
18974
|
_this._isProjMatSetting = false;
|
|
18600
18975
|
_this._nearClipPlane = 0.1;
|
|
18601
18976
|
_this._farClipPlane = 100;
|
|
@@ -18796,6 +19171,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
18796
19171
|
this.entity.scene._detachRenderCamera(this);
|
|
18797
19172
|
};
|
|
18798
19173
|
/**
|
|
19174
|
+
* @internal
|
|
18799
19175
|
* @inheritdoc
|
|
18800
19176
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
18801
19177
|
var _this__renderPipeline;
|
|
@@ -18804,6 +19180,20 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
18804
19180
|
this._isInvViewProjDirty.destroy();
|
|
18805
19181
|
this._isViewMatrixDirty.destroy();
|
|
18806
19182
|
this.shaderData._addReferCount(-1);
|
|
19183
|
+
this._entity = null;
|
|
19184
|
+
this._globalShaderMacro = null;
|
|
19185
|
+
this._frustum = null;
|
|
19186
|
+
this._renderPipeline = null;
|
|
19187
|
+
this._virtualCamera = null;
|
|
19188
|
+
this._shaderData = null;
|
|
19189
|
+
this._frustumViewChangeFlag = null;
|
|
19190
|
+
this._transform = null;
|
|
19191
|
+
this._isViewMatrixDirty = null;
|
|
19192
|
+
this._isInvViewProjDirty = null;
|
|
19193
|
+
this._viewport = null;
|
|
19194
|
+
this._inverseProjectionMatrix = null;
|
|
19195
|
+
this._lastAspectSize = null;
|
|
19196
|
+
this._invViewProjMat = null;
|
|
18807
19197
|
};
|
|
18808
19198
|
_proto._projMatChange = function _projMatChange() {
|
|
18809
19199
|
this._isFrustumProjectDirty = true;
|
|
@@ -18843,6 +19233,14 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
18843
19233
|
return this._inverseProjectionMatrix;
|
|
18844
19234
|
};
|
|
18845
19235
|
_create_class(Camera1, [
|
|
19236
|
+
{
|
|
19237
|
+
key: "shaderData",
|
|
19238
|
+
get: /**
|
|
19239
|
+
* Shader data.
|
|
19240
|
+
*/ function get() {
|
|
19241
|
+
return this._shaderData;
|
|
19242
|
+
}
|
|
19243
|
+
},
|
|
18846
19244
|
{
|
|
18847
19245
|
key: "nearClipPlane",
|
|
18848
19246
|
get: /**
|
|
@@ -19001,7 +19399,12 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
19001
19399
|
return this._renderTarget;
|
|
19002
19400
|
},
|
|
19003
19401
|
set: function set(value) {
|
|
19004
|
-
this._renderTarget
|
|
19402
|
+
if (this._renderTarget !== value) {
|
|
19403
|
+
var _this__renderTarget;
|
|
19404
|
+
value == null ? void 0 : value._addReferCount(1);
|
|
19405
|
+
(_this__renderTarget = this._renderTarget) == null ? void 0 : _this__renderTarget._addReferCount(-1);
|
|
19406
|
+
this._renderTarget = value;
|
|
19407
|
+
}
|
|
19005
19408
|
}
|
|
19006
19409
|
}
|
|
19007
19410
|
]);
|
|
@@ -19990,6 +20393,7 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19990
20393
|
_this = PBRBaseMaterial.call(this, engine, Shader.find("pbr")) || this;
|
|
19991
20394
|
_this.shaderData.setFloat(PBRMaterial._metallicProp, 1);
|
|
19992
20395
|
_this.shaderData.setFloat(PBRMaterial._roughnessProp, 1);
|
|
20396
|
+
_this.shaderData.setFloat(PBRMaterial._iorProp, 1.5);
|
|
19993
20397
|
return _this;
|
|
19994
20398
|
}
|
|
19995
20399
|
var _proto = PBRMaterial.prototype;
|
|
@@ -20001,10 +20405,23 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20001
20405
|
return dest;
|
|
20002
20406
|
};
|
|
20003
20407
|
_create_class(PBRMaterial, [
|
|
20408
|
+
{
|
|
20409
|
+
key: "ior",
|
|
20410
|
+
get: /**
|
|
20411
|
+
* Index Of Refraction.
|
|
20412
|
+
* @defaultValue `1.5`
|
|
20413
|
+
*/ function get() {
|
|
20414
|
+
return this.shaderData.getFloat(PBRMaterial._iorProp);
|
|
20415
|
+
},
|
|
20416
|
+
set: function set(v) {
|
|
20417
|
+
this.shaderData.setFloat(PBRMaterial._iorProp, Math.max(v, 0));
|
|
20418
|
+
}
|
|
20419
|
+
},
|
|
20004
20420
|
{
|
|
20005
20421
|
key: "metallic",
|
|
20006
20422
|
get: /**
|
|
20007
|
-
* Metallic
|
|
20423
|
+
* Metallic.
|
|
20424
|
+
* @defaultValue `1.0`
|
|
20008
20425
|
*/ function get() {
|
|
20009
20426
|
return this.shaderData.getFloat(PBRMaterial._metallicProp);
|
|
20010
20427
|
},
|
|
@@ -20015,7 +20432,8 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20015
20432
|
{
|
|
20016
20433
|
key: "roughness",
|
|
20017
20434
|
get: /**
|
|
20018
|
-
* Roughness
|
|
20435
|
+
* Roughness. default 1.0.
|
|
20436
|
+
* @defaultValue `1.0`
|
|
20019
20437
|
*/ function get() {
|
|
20020
20438
|
return this.shaderData.getFloat(PBRMaterial._roughnessProp);
|
|
20021
20439
|
},
|
|
@@ -20052,6 +20470,9 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20052
20470
|
(function() {
|
|
20053
20471
|
PBRMaterial._roughnessMetallicTextureProp = ShaderProperty.getByName("material_RoughnessMetallicTexture");
|
|
20054
20472
|
})();
|
|
20473
|
+
(function() {
|
|
20474
|
+
PBRMaterial._iorProp = Shader.getPropertyByName("material_IOR");
|
|
20475
|
+
})();
|
|
20055
20476
|
|
|
20056
20477
|
/**
|
|
20057
20478
|
* PBR (Specular-Glossiness Workflow) Material.
|
|
@@ -20263,9 +20684,18 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20263
20684
|
* @internal
|
|
20264
20685
|
*/ _proto._addSprite = function _addSprite(sprite) {
|
|
20265
20686
|
this._spriteNamesToIndex[sprite.name] = this._sprites.push(sprite) - 1;
|
|
20687
|
+
sprite._atlas = this;
|
|
20688
|
+
sprite.isGCIgnored = true;
|
|
20266
20689
|
};
|
|
20267
|
-
|
|
20690
|
+
/**
|
|
20691
|
+
* @internal
|
|
20692
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
20268
20693
|
ReferResource.prototype._onDestroy.call(this);
|
|
20694
|
+
var _this = this, sprites = _this._sprites;
|
|
20695
|
+
for(var i = 0, n = sprites.length; i < n; i++){
|
|
20696
|
+
sprites[i].destroy();
|
|
20697
|
+
}
|
|
20698
|
+
sprites.length = 0;
|
|
20269
20699
|
this._sprites = null;
|
|
20270
20700
|
this._spriteNamesToIndex = null;
|
|
20271
20701
|
};
|
|
@@ -20313,8 +20743,10 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20313
20743
|
if (name === void 0) name = null;
|
|
20314
20744
|
var _this;
|
|
20315
20745
|
_this = ReferResource.call(this, engine) || this;
|
|
20316
|
-
_this.
|
|
20317
|
-
_this.
|
|
20746
|
+
_this._automaticWidth = 0;
|
|
20747
|
+
_this._automaticHeight = 0;
|
|
20748
|
+
_this._customWidth = undefined;
|
|
20749
|
+
_this._customHeight = undefined;
|
|
20318
20750
|
_this._positions = [
|
|
20319
20751
|
new engineMath.Vector2(),
|
|
20320
20752
|
new engineMath.Vector2(),
|
|
@@ -20335,7 +20767,7 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20335
20767
|
_this._region = new engineMath.Rect(0, 0, 1, 1);
|
|
20336
20768
|
_this._pivot = new engineMath.Vector2(0.5, 0.5);
|
|
20337
20769
|
_this._border = new engineMath.Vector4(0, 0, 0, 0);
|
|
20338
|
-
_this._dirtyUpdateFlag =
|
|
20770
|
+
_this._dirtyUpdateFlag = 0x7;
|
|
20339
20771
|
/** @internal */ _this._updateFlagManager = new UpdateFlagManager();
|
|
20340
20772
|
_this._texture = texture;
|
|
20341
20773
|
region && _this._region.copyFrom(region);
|
|
@@ -20373,17 +20805,41 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20373
20805
|
this._dirtyUpdateFlag & 0x1 && this._updatePositions();
|
|
20374
20806
|
return this._bounds;
|
|
20375
20807
|
};
|
|
20376
|
-
|
|
20808
|
+
/**
|
|
20809
|
+
* @internal
|
|
20810
|
+
*/ _proto._addReferCount = function _addReferCount(value) {
|
|
20811
|
+
var _this__atlas;
|
|
20812
|
+
ReferResource.prototype._addReferCount.call(this, value);
|
|
20813
|
+
(_this__atlas = this._atlas) == null ? void 0 : _this__atlas._addReferCount(value);
|
|
20814
|
+
};
|
|
20815
|
+
/**
|
|
20816
|
+
* @internal
|
|
20817
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
20377
20818
|
ReferResource.prototype._onDestroy.call(this);
|
|
20819
|
+
this._positions.length = 0;
|
|
20820
|
+
this._positions = null;
|
|
20821
|
+
this._uvs.length = 0;
|
|
20822
|
+
this._uvs = null;
|
|
20823
|
+
this._atlasRegion = null;
|
|
20824
|
+
this._atlasRegionOffset = null;
|
|
20825
|
+
this._region = null;
|
|
20826
|
+
this._pivot = null;
|
|
20827
|
+
this._border = null;
|
|
20828
|
+
this._bounds = null;
|
|
20829
|
+
this._atlas = null;
|
|
20378
20830
|
this._texture = null;
|
|
20831
|
+
this._updateFlagManager = null;
|
|
20379
20832
|
};
|
|
20380
20833
|
_proto._calDefaultSize = function _calDefaultSize() {
|
|
20381
20834
|
if (this._texture) {
|
|
20382
20835
|
var _this = this, _texture = _this._texture, _atlasRegion = _this._atlasRegion, _atlasRegionOffset = _this._atlasRegionOffset, _region = _this._region;
|
|
20383
20836
|
var pixelsPerUnitReciprocal = 1.0 / Engine._pixelsPerUnit;
|
|
20384
|
-
this.
|
|
20385
|
-
this.
|
|
20837
|
+
this._automaticWidth = _texture.width * _atlasRegion.width / (1 - _atlasRegionOffset.x - _atlasRegionOffset.z) * _region.width * pixelsPerUnitReciprocal;
|
|
20838
|
+
this._automaticHeight = _texture.height * _atlasRegion.height / (1 - _atlasRegionOffset.y - _atlasRegionOffset.w) * _region.height * pixelsPerUnitReciprocal;
|
|
20839
|
+
} else {
|
|
20840
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
20386
20841
|
}
|
|
20842
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
20387
20843
|
};
|
|
20388
20844
|
_proto._updatePositions = function _updatePositions() {
|
|
20389
20845
|
var blank = this._atlasRegionOffset;
|
|
@@ -20437,11 +20893,16 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20437
20893
|
};
|
|
20438
20894
|
_proto._dispatchSpriteChange = function _dispatchSpriteChange(type) {
|
|
20439
20895
|
switch(type){
|
|
20896
|
+
case SpriteModifyFlags.texture:
|
|
20897
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
20898
|
+
break;
|
|
20440
20899
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
20441
20900
|
case SpriteModifyFlags.region:
|
|
20442
|
-
this._dirtyUpdateFlag |=
|
|
20901
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
20443
20902
|
break;
|
|
20444
20903
|
case SpriteModifyFlags.atlasRegion:
|
|
20904
|
+
this._dirtyUpdateFlag |= 0x4 | 0x2;
|
|
20905
|
+
break;
|
|
20445
20906
|
case SpriteModifyFlags.border:
|
|
20446
20907
|
this._dirtyUpdateFlag |= 0x2;
|
|
20447
20908
|
break;
|
|
@@ -20460,7 +20921,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20460
20921
|
if (this._texture !== value) {
|
|
20461
20922
|
this._texture = value;
|
|
20462
20923
|
this._dispatchSpriteChange(SpriteModifyFlags.texture);
|
|
20463
|
-
(this.
|
|
20924
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
20925
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
20926
|
+
}
|
|
20464
20927
|
}
|
|
20465
20928
|
}
|
|
20466
20929
|
},
|
|
@@ -20468,13 +20931,21 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20468
20931
|
key: "width",
|
|
20469
20932
|
get: /**
|
|
20470
20933
|
* The width of the sprite (in world coordinates).
|
|
20934
|
+
*
|
|
20935
|
+
* @remarks
|
|
20936
|
+
* If width is set, return the set value,
|
|
20937
|
+
* otherwise return the width calculated according to `Texture.width`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
|
|
20471
20938
|
*/ function get() {
|
|
20472
|
-
this.
|
|
20473
|
-
|
|
20939
|
+
if (this._customWidth !== undefined) {
|
|
20940
|
+
return this._customWidth;
|
|
20941
|
+
} else {
|
|
20942
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
20943
|
+
return this._automaticWidth;
|
|
20944
|
+
}
|
|
20474
20945
|
},
|
|
20475
20946
|
set: function set(value) {
|
|
20476
|
-
if (this.
|
|
20477
|
-
this.
|
|
20947
|
+
if (this._customWidth !== value) {
|
|
20948
|
+
this._customWidth = value;
|
|
20478
20949
|
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
20479
20950
|
}
|
|
20480
20951
|
}
|
|
@@ -20483,13 +20954,21 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20483
20954
|
key: "height",
|
|
20484
20955
|
get: /**
|
|
20485
20956
|
* The height of the sprite (in world coordinates).
|
|
20957
|
+
*
|
|
20958
|
+
* @remarks
|
|
20959
|
+
* If height is set, return the set value,
|
|
20960
|
+
* otherwise return the height calculated according to `Texture.height`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
|
|
20486
20961
|
*/ function get() {
|
|
20487
|
-
this.
|
|
20488
|
-
|
|
20962
|
+
if (this._customHeight !== undefined) {
|
|
20963
|
+
return this._customHeight;
|
|
20964
|
+
} else {
|
|
20965
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
20966
|
+
return this._automaticHeight;
|
|
20967
|
+
}
|
|
20489
20968
|
},
|
|
20490
20969
|
set: function set(value) {
|
|
20491
|
-
if (this.
|
|
20492
|
-
this.
|
|
20970
|
+
if (this._customHeight !== value) {
|
|
20971
|
+
this._customHeight = value;
|
|
20493
20972
|
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
20494
20973
|
}
|
|
20495
20974
|
}
|
|
@@ -20519,7 +20998,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20519
20998
|
var y = engineMath.MathUtil.clamp(value.y, 0, 1);
|
|
20520
20999
|
this._atlasRegion.set(x, y, engineMath.MathUtil.clamp(value.width, 0, 1 - x), engineMath.MathUtil.clamp(value.height, 0, 1 - y));
|
|
20521
21000
|
this._dispatchSpriteChange(SpriteModifyFlags.atlasRegion);
|
|
20522
|
-
(this.
|
|
21001
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
21002
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
21003
|
+
}
|
|
20523
21004
|
}
|
|
20524
21005
|
},
|
|
20525
21006
|
{
|
|
@@ -20534,7 +21015,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20534
21015
|
var y = engineMath.MathUtil.clamp(value.y, 0, 1);
|
|
20535
21016
|
this._atlasRegionOffset.set(x, y, engineMath.MathUtil.clamp(value.z, 0, 1 - x), engineMath.MathUtil.clamp(value.w, 0, 1 - y));
|
|
20536
21017
|
this._dispatchSpriteChange(SpriteModifyFlags.atlasRegionOffset);
|
|
20537
|
-
(this.
|
|
21018
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
21019
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
21020
|
+
}
|
|
20538
21021
|
}
|
|
20539
21022
|
},
|
|
20540
21023
|
{
|
|
@@ -20550,7 +21033,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20550
21033
|
var y = engineMath.MathUtil.clamp(value.y, 0, 1);
|
|
20551
21034
|
region.set(x, y, engineMath.MathUtil.clamp(value.width, 0, 1 - x), engineMath.MathUtil.clamp(value.height, 0, 1 - y));
|
|
20552
21035
|
this._dispatchSpriteChange(SpriteModifyFlags.region);
|
|
20553
|
-
(this.
|
|
21036
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
21037
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
21038
|
+
}
|
|
20554
21039
|
}
|
|
20555
21040
|
},
|
|
20556
21041
|
{
|
|
@@ -20600,7 +21085,8 @@ var SpriteUpdateFlags;
|
|
|
20600
21085
|
(function(SpriteUpdateFlags) {
|
|
20601
21086
|
SpriteUpdateFlags[SpriteUpdateFlags["positions"] = 0x1] = "positions";
|
|
20602
21087
|
SpriteUpdateFlags[SpriteUpdateFlags["uvs"] = 0x2] = "uvs";
|
|
20603
|
-
SpriteUpdateFlags[SpriteUpdateFlags["
|
|
21088
|
+
SpriteUpdateFlags[SpriteUpdateFlags["automaticSize"] = 0x4] = "automaticSize";
|
|
21089
|
+
SpriteUpdateFlags[SpriteUpdateFlags["all"] = 0x7] = "all";
|
|
20604
21090
|
})(SpriteUpdateFlags || (SpriteUpdateFlags = {}));
|
|
20605
21091
|
|
|
20606
21092
|
var _SlicedSpriteAssembler;
|
|
@@ -21092,8 +21578,10 @@ var TiledType;
|
|
|
21092
21578
|
_this._tiledAdaptiveThreshold = 0.5;
|
|
21093
21579
|
_this._color = new engineMath.Color(1, 1, 1, 1);
|
|
21094
21580
|
_this._sprite = null;
|
|
21095
|
-
_this.
|
|
21096
|
-
_this.
|
|
21581
|
+
_this._automaticWidth = 0;
|
|
21582
|
+
_this._automaticHeight = 0;
|
|
21583
|
+
_this._customWidth = undefined;
|
|
21584
|
+
_this._customHeight = undefined;
|
|
21097
21585
|
_this._flipX = false;
|
|
21098
21586
|
_this._flipY = false;
|
|
21099
21587
|
_this._maskLayer = exports.SpriteMaskLayer.Layer0;
|
|
@@ -21108,38 +21596,45 @@ var TiledType;
|
|
|
21108
21596
|
/**
|
|
21109
21597
|
* @internal
|
|
21110
21598
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
21599
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
21111
21600
|
target._assembler.resetData(target);
|
|
21112
21601
|
target.sprite = this._sprite;
|
|
21602
|
+
target.drawMode = this._drawMode;
|
|
21113
21603
|
};
|
|
21114
|
-
|
|
21604
|
+
/**
|
|
21605
|
+
* @internal
|
|
21606
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
21115
21607
|
// @ts-ignore
|
|
21116
21608
|
this._updateTransformShaderData(context, engineMath.Matrix._identity);
|
|
21117
21609
|
};
|
|
21118
|
-
|
|
21119
|
-
|
|
21120
|
-
|
|
21610
|
+
/**
|
|
21611
|
+
* @internal
|
|
21612
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
21613
|
+
if (this.sprite) {
|
|
21614
|
+
this._assembler.updatePositions(this);
|
|
21615
|
+
} else {
|
|
21121
21616
|
worldBounds.min.set(0, 0, 0);
|
|
21122
21617
|
worldBounds.max.set(0, 0, 0);
|
|
21123
|
-
} else {
|
|
21124
|
-
this._assembler.updatePositions(this);
|
|
21125
21618
|
}
|
|
21126
21619
|
};
|
|
21127
|
-
|
|
21620
|
+
/**
|
|
21621
|
+
* @internal
|
|
21622
|
+
*/ _proto._render = function _render(context) {
|
|
21128
21623
|
var _this_sprite;
|
|
21129
21624
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
21130
21625
|
return;
|
|
21131
21626
|
}
|
|
21132
|
-
// Update position
|
|
21627
|
+
// Update position
|
|
21133
21628
|
if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
|
|
21134
21629
|
this._assembler.updatePositions(this);
|
|
21135
21630
|
this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
|
|
21136
21631
|
}
|
|
21137
|
-
// Update uv
|
|
21632
|
+
// Update uv
|
|
21138
21633
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
21139
21634
|
this._assembler.updateUVs(this);
|
|
21140
21635
|
this._dirtyUpdateFlag &= ~0x2;
|
|
21141
21636
|
}
|
|
21142
|
-
// Push
|
|
21637
|
+
// Push primitive
|
|
21143
21638
|
var material = this.getMaterial();
|
|
21144
21639
|
var texture = this.sprite.texture;
|
|
21145
21640
|
var renderData = this._engine._spriteRenderDataPool.getFromPool();
|
|
@@ -21149,14 +21644,28 @@ var TiledType;
|
|
|
21149
21644
|
/**
|
|
21150
21645
|
* @internal
|
|
21151
21646
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
21152
|
-
var _this__sprite;
|
|
21153
21647
|
Renderer.prototype._onDestroy.call(this);
|
|
21154
|
-
|
|
21648
|
+
var sprite = this._sprite;
|
|
21649
|
+
if (sprite) {
|
|
21650
|
+
sprite._addReferCount(-1);
|
|
21651
|
+
sprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
21652
|
+
}
|
|
21653
|
+
this._entity = null;
|
|
21155
21654
|
this._color = null;
|
|
21156
21655
|
this._sprite = null;
|
|
21157
21656
|
this._assembler = null;
|
|
21158
21657
|
this._verticesData = null;
|
|
21159
21658
|
};
|
|
21659
|
+
_proto._calDefaultSize = function _calDefaultSize() {
|
|
21660
|
+
var sprite = this._sprite;
|
|
21661
|
+
if (sprite) {
|
|
21662
|
+
this._automaticWidth = sprite.width;
|
|
21663
|
+
this._automaticHeight = sprite.height;
|
|
21664
|
+
} else {
|
|
21665
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
21666
|
+
}
|
|
21667
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
21668
|
+
};
|
|
21160
21669
|
_proto._updateStencilState = function _updateStencilState() {
|
|
21161
21670
|
// Update stencil.
|
|
21162
21671
|
var material = this.getInstanceMaterial();
|
|
@@ -21183,22 +21692,21 @@ var TiledType;
|
|
|
21183
21692
|
break;
|
|
21184
21693
|
case SpriteModifyFlags.size:
|
|
21185
21694
|
var _this = this, drawMode = _this._drawMode;
|
|
21186
|
-
|
|
21695
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
21696
|
+
if (this._drawMode === exports.SpriteDrawMode.Sliced) {
|
|
21187
21697
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
21188
21698
|
} else if (drawMode === exports.SpriteDrawMode.Tiled) {
|
|
21189
21699
|
this._dirtyUpdateFlag |= 0x3;
|
|
21190
21700
|
} else {
|
|
21191
21701
|
// When the width and height of `SpriteRenderer` are `undefined`,
|
|
21192
21702
|
// the `size` of `Sprite` will affect the position of `SpriteRenderer`.
|
|
21193
|
-
if (this.
|
|
21703
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
21194
21704
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
21195
21705
|
}
|
|
21196
21706
|
}
|
|
21197
21707
|
break;
|
|
21198
21708
|
case SpriteModifyFlags.border:
|
|
21199
|
-
|
|
21200
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
21201
|
-
}
|
|
21709
|
+
this._drawMode === exports.SpriteDrawMode.Sliced && (this._dirtyUpdateFlag |= 0x3);
|
|
21202
21710
|
break;
|
|
21203
21711
|
case SpriteModifyFlags.region:
|
|
21204
21712
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
@@ -21282,10 +21790,14 @@ var TiledType;
|
|
|
21282
21790
|
set: function set(value) {
|
|
21283
21791
|
var lastSprite = this._sprite;
|
|
21284
21792
|
if (lastSprite !== value) {
|
|
21285
|
-
|
|
21793
|
+
if (lastSprite) {
|
|
21794
|
+
lastSprite._addReferCount(-1);
|
|
21795
|
+
lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
21796
|
+
}
|
|
21797
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
21286
21798
|
if (value) {
|
|
21799
|
+
value._addReferCount(1);
|
|
21287
21800
|
value._updateFlagManager.addListener(this._onSpriteChange);
|
|
21288
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
21289
21801
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, value.texture);
|
|
21290
21802
|
} else {
|
|
21291
21803
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, null);
|
|
@@ -21310,16 +21822,22 @@ var TiledType;
|
|
|
21310
21822
|
{
|
|
21311
21823
|
key: "width",
|
|
21312
21824
|
get: /**
|
|
21313
|
-
* Render width.
|
|
21825
|
+
* Render width (in world coordinates).
|
|
21826
|
+
*
|
|
21827
|
+
* @remarks
|
|
21828
|
+
* If width is set, return the set value,
|
|
21829
|
+
* otherwise return `SpriteRenderer.sprite.width`.
|
|
21314
21830
|
*/ function get() {
|
|
21315
|
-
|
|
21316
|
-
|
|
21831
|
+
if (this._customWidth !== undefined) {
|
|
21832
|
+
return this._customWidth;
|
|
21833
|
+
} else {
|
|
21834
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
21835
|
+
return this._automaticWidth;
|
|
21836
|
+
}
|
|
21317
21837
|
},
|
|
21318
21838
|
set: function set(value) {
|
|
21319
|
-
|
|
21320
|
-
|
|
21321
|
-
if (this._width !== value) {
|
|
21322
|
-
this._width = value;
|
|
21839
|
+
if (this._customWidth !== value) {
|
|
21840
|
+
this._customWidth = value;
|
|
21323
21841
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
21324
21842
|
}
|
|
21325
21843
|
}
|
|
@@ -21327,16 +21845,22 @@ var TiledType;
|
|
|
21327
21845
|
{
|
|
21328
21846
|
key: "height",
|
|
21329
21847
|
get: /**
|
|
21330
|
-
* Render height.
|
|
21848
|
+
* Render height (in world coordinates).
|
|
21849
|
+
*
|
|
21850
|
+
* @remarks
|
|
21851
|
+
* If height is set, return the set value,
|
|
21852
|
+
* otherwise return `SpriteRenderer.sprite.height`.
|
|
21331
21853
|
*/ function get() {
|
|
21332
|
-
|
|
21333
|
-
|
|
21854
|
+
if (this._customHeight !== undefined) {
|
|
21855
|
+
return this._customHeight;
|
|
21856
|
+
} else {
|
|
21857
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
21858
|
+
return this._automaticHeight;
|
|
21859
|
+
}
|
|
21334
21860
|
},
|
|
21335
21861
|
set: function set(value) {
|
|
21336
|
-
|
|
21337
|
-
|
|
21338
|
-
if (this._height !== value) {
|
|
21339
|
-
this._height = value;
|
|
21862
|
+
if (this._customHeight !== value) {
|
|
21863
|
+
this._customHeight = value;
|
|
21340
21864
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
21341
21865
|
}
|
|
21342
21866
|
}
|
|
@@ -21423,10 +21947,16 @@ __decorate([
|
|
|
21423
21947
|
], SpriteRenderer.prototype, "_sprite", void 0);
|
|
21424
21948
|
__decorate([
|
|
21425
21949
|
ignoreClone
|
|
21426
|
-
], SpriteRenderer.prototype, "
|
|
21950
|
+
], SpriteRenderer.prototype, "_automaticWidth", void 0);
|
|
21427
21951
|
__decorate([
|
|
21428
21952
|
ignoreClone
|
|
21429
|
-
], SpriteRenderer.prototype, "
|
|
21953
|
+
], SpriteRenderer.prototype, "_automaticHeight", void 0);
|
|
21954
|
+
__decorate([
|
|
21955
|
+
assignmentClone
|
|
21956
|
+
], SpriteRenderer.prototype, "_customWidth", void 0);
|
|
21957
|
+
__decorate([
|
|
21958
|
+
assignmentClone
|
|
21959
|
+
], SpriteRenderer.prototype, "_customHeight", void 0);
|
|
21430
21960
|
__decorate([
|
|
21431
21961
|
assignmentClone
|
|
21432
21962
|
], SpriteRenderer.prototype, "_flipX", void 0);
|
|
@@ -21447,7 +21977,9 @@ var /**
|
|
|
21447
21977
|
*/ SpriteRendererUpdateFlags;
|
|
21448
21978
|
(function(SpriteRendererUpdateFlags) {
|
|
21449
21979
|
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
|
|
21450
|
-
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/**
|
|
21980
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
|
|
21981
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
|
|
21982
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** All. */ "All"] = 0x7] = "All";
|
|
21451
21983
|
})(SpriteRendererUpdateFlags || (SpriteRendererUpdateFlags = {}));
|
|
21452
21984
|
|
|
21453
21985
|
/**
|
|
@@ -21535,7 +22067,9 @@ var /**
|
|
|
21535
22067
|
this._font._addReferCount(1);
|
|
21536
22068
|
this.setMaterial(engine._spriteDefaultMaterial);
|
|
21537
22069
|
};
|
|
21538
|
-
|
|
22070
|
+
/**
|
|
22071
|
+
* @internal
|
|
22072
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
21539
22073
|
Renderer.prototype._onDestroy.call(this);
|
|
21540
22074
|
// Clear render data.
|
|
21541
22075
|
var charRenderDatas = this._charRenderDatas;
|
|
@@ -21552,6 +22086,7 @@ var /**
|
|
|
21552
22086
|
/**
|
|
21553
22087
|
* @internal
|
|
21554
22088
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
22089
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
21555
22090
|
target.font = this._font;
|
|
21556
22091
|
target._subFont = this._subFont;
|
|
21557
22092
|
};
|
|
@@ -21570,14 +22105,20 @@ var /**
|
|
|
21570
22105
|
*/ _proto._setDirtyFlagFalse = function _setDirtyFlagFalse(type) {
|
|
21571
22106
|
this._dirtyFlag &= ~type;
|
|
21572
22107
|
};
|
|
21573
|
-
|
|
22108
|
+
/**
|
|
22109
|
+
* @internal
|
|
22110
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
21574
22111
|
// @ts-ignore
|
|
21575
22112
|
this._updateTransformShaderData(context, engineMath.Matrix._identity);
|
|
21576
22113
|
};
|
|
21577
|
-
|
|
22114
|
+
/**
|
|
22115
|
+
* @internal
|
|
22116
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
21578
22117
|
engineMath.BoundingBox.transform(this._localBounds, this._entity.transform.worldMatrix, worldBounds);
|
|
21579
22118
|
};
|
|
21580
|
-
|
|
22119
|
+
/**
|
|
22120
|
+
* @internal
|
|
22121
|
+
*/ _proto._render = function _render(context) {
|
|
21581
22122
|
if (this._text === "" || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0) {
|
|
21582
22123
|
return;
|
|
21583
22124
|
}
|
|
@@ -21672,8 +22213,6 @@ var /**
|
|
|
21672
22213
|
_proto._updateLocalData = function _updateLocalData() {
|
|
21673
22214
|
var _this = this, color = _this.color, horizontalAlignment = _this.horizontalAlignment, verticalAlignment = _this.verticalAlignment, charRenderDatas = _this._charRenderDatas;
|
|
21674
22215
|
var _this__localBounds = this._localBounds, min = _this__localBounds.min, max = _this__localBounds.max;
|
|
21675
|
-
min.set(0, 0, 0);
|
|
21676
|
-
max.set(0, 0, 0);
|
|
21677
22216
|
var _pixelsPerUnit = Engine._pixelsPerUnit;
|
|
21678
22217
|
var pixelsPerUnitReciprocal = 1.0 / _pixelsPerUnit;
|
|
21679
22218
|
var charFont = this._subFont;
|
|
@@ -21700,54 +22239,65 @@ var /**
|
|
|
21700
22239
|
break;
|
|
21701
22240
|
}
|
|
21702
22241
|
var renderDataCount = 0;
|
|
22242
|
+
var firstLine = -1;
|
|
21703
22243
|
var minX = Number.MAX_SAFE_INTEGER;
|
|
21704
22244
|
var minY = Number.MAX_SAFE_INTEGER;
|
|
21705
22245
|
var maxX = Number.MIN_SAFE_INTEGER;
|
|
21706
22246
|
var maxY = Number.MIN_SAFE_INTEGER;
|
|
21707
|
-
var lastLineIndex = linesLen - 1;
|
|
21708
22247
|
for(var i = 0; i < linesLen; ++i){
|
|
21709
|
-
var line = lines[i];
|
|
21710
22248
|
var lineWidth = lineWidths[i];
|
|
21711
|
-
|
|
21712
|
-
|
|
21713
|
-
|
|
21714
|
-
|
|
21715
|
-
|
|
21716
|
-
|
|
21717
|
-
|
|
21718
|
-
|
|
21719
|
-
|
|
21720
|
-
|
|
21721
|
-
|
|
21722
|
-
|
|
21723
|
-
|
|
21724
|
-
|
|
21725
|
-
|
|
21726
|
-
|
|
21727
|
-
|
|
21728
|
-
|
|
21729
|
-
|
|
21730
|
-
|
|
21731
|
-
|
|
21732
|
-
|
|
21733
|
-
|
|
21734
|
-
|
|
21735
|
-
|
|
21736
|
-
|
|
21737
|
-
|
|
21738
|
-
|
|
21739
|
-
|
|
21740
|
-
|
|
21741
|
-
|
|
21742
|
-
|
|
21743
|
-
|
|
21744
|
-
|
|
21745
|
-
|
|
22249
|
+
if (lineWidth > 0) {
|
|
22250
|
+
var line = lines[i];
|
|
22251
|
+
var startX = 0;
|
|
22252
|
+
var firstRow = -1;
|
|
22253
|
+
if (firstLine < 0) {
|
|
22254
|
+
firstLine = i;
|
|
22255
|
+
}
|
|
22256
|
+
switch(horizontalAlignment){
|
|
22257
|
+
case exports.TextHorizontalAlignment.Left:
|
|
22258
|
+
startX = -halfRendererWidth;
|
|
22259
|
+
break;
|
|
22260
|
+
case exports.TextHorizontalAlignment.Center:
|
|
22261
|
+
startX = -lineWidth * 0.5;
|
|
22262
|
+
break;
|
|
22263
|
+
case exports.TextHorizontalAlignment.Right:
|
|
22264
|
+
startX = halfRendererWidth - lineWidth;
|
|
22265
|
+
break;
|
|
22266
|
+
}
|
|
22267
|
+
for(var j = 0, n = line.length; j < n; ++j){
|
|
22268
|
+
var char = line[j];
|
|
22269
|
+
var charInfo = charFont._getCharInfo(char);
|
|
22270
|
+
if (charInfo.h > 0) {
|
|
22271
|
+
var _charRenderDatas, _ref;
|
|
22272
|
+
firstRow < 0 && (firstRow = j);
|
|
22273
|
+
var charRenderData = (_charRenderDatas = charRenderDatas)[_ref = renderDataCount++] || (_charRenderDatas[_ref] = charRenderDataPool.get());
|
|
22274
|
+
var renderData = charRenderData.renderData, localPositions = charRenderData.localPositions;
|
|
22275
|
+
charRenderData.texture = charFont._getTextureByIndex(charInfo.index);
|
|
22276
|
+
renderData.color = color;
|
|
22277
|
+
renderData.uvs = charInfo.uvs;
|
|
22278
|
+
var w = charInfo.w, ascent = charInfo.ascent, descent = charInfo.descent;
|
|
22279
|
+
var left = startX * pixelsPerUnitReciprocal;
|
|
22280
|
+
var right = (startX + w) * pixelsPerUnitReciprocal;
|
|
22281
|
+
var top = (startY + ascent) * pixelsPerUnitReciprocal;
|
|
22282
|
+
var bottom = (startY - descent + 1) * pixelsPerUnitReciprocal;
|
|
22283
|
+
localPositions.set(left, top, right, bottom);
|
|
22284
|
+
i === firstLine && (maxY = Math.max(maxY, top));
|
|
22285
|
+
minY = Math.min(minY, bottom);
|
|
22286
|
+
j === firstRow && (minX = Math.min(minX, left));
|
|
22287
|
+
maxX = Math.max(maxX, right);
|
|
22288
|
+
}
|
|
22289
|
+
startX += charInfo.xAdvance;
|
|
22290
|
+
}
|
|
21746
22291
|
}
|
|
21747
22292
|
startY -= lineHeight;
|
|
21748
22293
|
}
|
|
21749
|
-
|
|
21750
|
-
|
|
22294
|
+
if (firstLine < 0) {
|
|
22295
|
+
min.set(0, 0, 0);
|
|
22296
|
+
max.set(0, 0, 0);
|
|
22297
|
+
} else {
|
|
22298
|
+
min.set(minX, minY, 0);
|
|
22299
|
+
max.set(maxX, maxY, 0);
|
|
22300
|
+
}
|
|
21751
22301
|
// Revert excess render data to pool.
|
|
21752
22302
|
var lastRenderDataCount = charRenderDatas.length;
|
|
21753
22303
|
if (lastRenderDataCount > renderDataCount) {
|
|
@@ -21760,7 +22310,9 @@ var /**
|
|
|
21760
22310
|
return a.texture.instanceId - b.texture.instanceId;
|
|
21761
22311
|
});
|
|
21762
22312
|
};
|
|
21763
|
-
|
|
22313
|
+
/**
|
|
22314
|
+
* @internal
|
|
22315
|
+
*/ _proto._onTransformChanged = function _onTransformChanged(bit) {
|
|
21764
22316
|
Renderer.prototype._onTransformChanged.call(this, bit);
|
|
21765
22317
|
this._setDirtyFlagTrue(0x4 | 0x8);
|
|
21766
22318
|
};
|
|
@@ -22079,7 +22631,6 @@ var DirtyFlag;
|
|
|
22079
22631
|
* @internal
|
|
22080
22632
|
*/ var AnimationCurveOwner = /*#__PURE__*/ function() {
|
|
22081
22633
|
function AnimationCurveOwner(target, type, property, cureType) {
|
|
22082
|
-
this.crossCurveMark = 0;
|
|
22083
22634
|
this.hasSavedDefaultValue = false;
|
|
22084
22635
|
this.baseEvaluateData = {
|
|
22085
22636
|
curKeyframeIndex: 0,
|
|
@@ -22278,6 +22829,12 @@ AnimationCurveOwner.registerAssembler(Transform, "scale", ScaleAnimationCurveOwn
|
|
|
22278
22829
|
}();
|
|
22279
22830
|
AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights", BlendShapeWeightsAnimationCurveOwnerAssembler);
|
|
22280
22831
|
|
|
22832
|
+
/**
|
|
22833
|
+
* @internal
|
|
22834
|
+
*/ var AnimationCurveLayerOwner = function AnimationCurveLayerOwner() {
|
|
22835
|
+
this.crossCurveMark = 0;
|
|
22836
|
+
};
|
|
22837
|
+
|
|
22281
22838
|
/**
|
|
22282
22839
|
* Associate AnimationCurve and the Entity
|
|
22283
22840
|
*/ var AnimationClipCurveBinding = /*#__PURE__*/ function() {
|
|
@@ -22295,6 +22852,13 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
22295
22852
|
};
|
|
22296
22853
|
/**
|
|
22297
22854
|
* @internal
|
|
22855
|
+
*/ _proto._createCurveLayerOwner = function _createCurveLayerOwner(owner) {
|
|
22856
|
+
var layerOwner = new AnimationCurveLayerOwner();
|
|
22857
|
+
layerOwner.curveOwner = owner;
|
|
22858
|
+
return layerOwner;
|
|
22859
|
+
};
|
|
22860
|
+
/**
|
|
22861
|
+
* @internal
|
|
22298
22862
|
*/ _proto._getTempCurveOwner = function _getTempCurveOwner(entity) {
|
|
22299
22863
|
var instanceId = entity.instanceId;
|
|
22300
22864
|
if (!this._tempCurveOwner[instanceId]) {
|
|
@@ -23389,9 +23953,14 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23389
23953
|
|
|
23390
23954
|
/**
|
|
23391
23955
|
* @internal
|
|
23392
|
-
*/ var AnimationEventHandler = function
|
|
23393
|
-
|
|
23394
|
-
|
|
23956
|
+
*/ var AnimationEventHandler = /*#__PURE__*/ function() {
|
|
23957
|
+
function AnimationEventHandler() {
|
|
23958
|
+
this.handlers = [];
|
|
23959
|
+
}
|
|
23960
|
+
var _proto = AnimationEventHandler.prototype;
|
|
23961
|
+
_proto.dispose = function dispose() {};
|
|
23962
|
+
return AnimationEventHandler;
|
|
23963
|
+
}();
|
|
23395
23964
|
|
|
23396
23965
|
/**
|
|
23397
23966
|
* Transitions define when and how the state machine switch from on state to another. AnimatorTransition always originate from a StateMachine or a StateMachine entry.
|
|
@@ -23449,12 +24018,14 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23449
24018
|
* @internal
|
|
23450
24019
|
*/ var AnimatorLayerData = /*#__PURE__*/ function() {
|
|
23451
24020
|
function AnimatorLayerData() {
|
|
24021
|
+
this.curveOwnerPool = Object.create(null);
|
|
23452
24022
|
this.animatorStateDataMap = {};
|
|
23453
24023
|
this.srcPlayData = new AnimatorStatePlayData();
|
|
23454
24024
|
this.destPlayData = new AnimatorStatePlayData();
|
|
23455
24025
|
this.layerState = LayerState.Standby;
|
|
23456
24026
|
this.crossCurveMark = 0;
|
|
23457
24027
|
this.manuallyTransition = new AnimatorStateTransition();
|
|
24028
|
+
this.crossOwnerLayerDataCollection = [];
|
|
23458
24029
|
}
|
|
23459
24030
|
var _proto = AnimatorLayerData.prototype;
|
|
23460
24031
|
_proto.switchPlayData = function switchPlayData() {
|
|
@@ -23469,7 +24040,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23469
24040
|
/**
|
|
23470
24041
|
* @internal
|
|
23471
24042
|
*/ var AnimatorStateData = function AnimatorStateData() {
|
|
23472
|
-
this.
|
|
24043
|
+
this.curveLayerOwner = [];
|
|
23473
24044
|
this.eventHandlers = [];
|
|
23474
24045
|
};
|
|
23475
24046
|
|
|
@@ -23483,8 +24054,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23483
24054
|
/** Culling mode of this Animator. */ _this.cullingMode = exports.AnimatorCullingMode.None;
|
|
23484
24055
|
/** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0;
|
|
23485
24056
|
_this._animatorLayersData = [];
|
|
23486
|
-
_this.
|
|
23487
|
-
_this._animationCurveOwners = [];
|
|
24057
|
+
_this._curveOwnerPool = Object.create(null);
|
|
23488
24058
|
_this._animationEventHandlerPool = new ClassPool(AnimationEventHandler);
|
|
23489
24059
|
_this._tempAnimatorStateInfo = {
|
|
23490
24060
|
layerIndex: -1,
|
|
@@ -23516,7 +24086,6 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23516
24086
|
return;
|
|
23517
24087
|
}
|
|
23518
24088
|
var animatorLayerData = this._getAnimatorLayerData(stateInfo.layerIndex);
|
|
23519
|
-
//TODO CM: Not consider same stateName, but different animation
|
|
23520
24089
|
var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData);
|
|
23521
24090
|
this._preparePlay(animatorLayerData, state, animatorStateData);
|
|
23522
24091
|
animatorLayerData.layerState = LayerState.Playing;
|
|
@@ -23607,7 +24176,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23607
24176
|
/**
|
|
23608
24177
|
* @internal
|
|
23609
24178
|
*/ _proto._reset = function _reset() {
|
|
23610
|
-
var _this = this, animationCurveOwners = _this.
|
|
24179
|
+
var _this = this, animationCurveOwners = _this._curveOwnerPool;
|
|
23611
24180
|
for(var instanceId in animationCurveOwners){
|
|
23612
24181
|
var propertyOwners = animationCurveOwners[instanceId];
|
|
23613
24182
|
for(var property in propertyOwners){
|
|
@@ -23616,8 +24185,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23616
24185
|
}
|
|
23617
24186
|
}
|
|
23618
24187
|
this._animatorLayersData.length = 0;
|
|
23619
|
-
this.
|
|
23620
|
-
this._animationCurveOwners.length = 0;
|
|
24188
|
+
this._curveOwnerPool = {};
|
|
23621
24189
|
this._animationEventHandlerPool.resetPool();
|
|
23622
24190
|
if (this._controllerUpdateFlag) {
|
|
23623
24191
|
this._controllerUpdateFlag.flag = false;
|
|
@@ -23645,10 +24213,10 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23645
24213
|
return stateInfo;
|
|
23646
24214
|
};
|
|
23647
24215
|
_proto._saveDefaultValues = function _saveDefaultValues(stateData) {
|
|
23648
|
-
var
|
|
23649
|
-
for(var i =
|
|
23650
|
-
var
|
|
23651
|
-
(
|
|
24216
|
+
var curveLayerOwner = stateData.curveLayerOwner;
|
|
24217
|
+
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
24218
|
+
var _curveLayerOwner_i;
|
|
24219
|
+
(_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner.saveDefaultValue();
|
|
23652
24220
|
}
|
|
23653
24221
|
};
|
|
23654
24222
|
_proto._getAnimatorStateData = function _getAnimatorStateData(stateName, animatorState, animatorLayerData) {
|
|
@@ -23657,25 +24225,32 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23657
24225
|
if (!animatorStateData) {
|
|
23658
24226
|
animatorStateData = new AnimatorStateData();
|
|
23659
24227
|
animatorStateDataMap[stateName] = animatorStateData;
|
|
23660
|
-
this._saveAnimatorStateData(animatorState, animatorStateData);
|
|
24228
|
+
this._saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData);
|
|
23661
24229
|
this._saveAnimatorEventHandlers(animatorState, animatorStateData);
|
|
23662
24230
|
}
|
|
23663
24231
|
return animatorStateData;
|
|
23664
24232
|
};
|
|
23665
|
-
_proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData) {
|
|
23666
|
-
var _this = this, entity = _this.entity,
|
|
23667
|
-
var
|
|
24233
|
+
_proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData) {
|
|
24234
|
+
var _this = this, entity = _this.entity, curveOwnerPool = _this._curveOwnerPool;
|
|
24235
|
+
var curveLayerOwner = animatorStateData.curveLayerOwner;
|
|
24236
|
+
var layerCurveOwnerPool = animatorLayerData.curveOwnerPool;
|
|
23668
24237
|
var _animatorState_clip = animatorState.clip, curves = _animatorState_clip._curveBindings;
|
|
23669
24238
|
for(var i = curves.length - 1; i >= 0; i--){
|
|
23670
24239
|
var curve = curves[i];
|
|
23671
24240
|
var targetEntity = curve.relativePath === "" ? entity : entity.findByPath(curve.relativePath);
|
|
23672
24241
|
if (targetEntity) {
|
|
24242
|
+
var _curveOwnerPool, _instanceId, _propertyOwners, _property, _layerCurveOwnerPool, _instanceId1, _layerPropertyOwners, _property1;
|
|
23673
24243
|
var property = curve.property;
|
|
23674
24244
|
var instanceId = targetEntity.instanceId;
|
|
23675
|
-
|
|
23676
|
-
|
|
24245
|
+
// Get owner
|
|
24246
|
+
var propertyOwners = (_curveOwnerPool = curveOwnerPool)[_instanceId = instanceId] || (_curveOwnerPool[_instanceId] = Object.create(null));
|
|
24247
|
+
var owner = (_propertyOwners = propertyOwners)[_property = property] || (_propertyOwners[_property] = curve._createCurveOwner(targetEntity));
|
|
24248
|
+
// Get layer owner
|
|
24249
|
+
var layerPropertyOwners = (_layerCurveOwnerPool = layerCurveOwnerPool)[_instanceId1 = instanceId] || (_layerCurveOwnerPool[_instanceId1] = Object.create(null));
|
|
24250
|
+
var layerOwner = (_layerPropertyOwners = layerPropertyOwners)[_property1 = property] || (_layerPropertyOwners[_property1] = curve._createCurveLayerOwner(owner));
|
|
24251
|
+
curveLayerOwner[i] = layerOwner;
|
|
23677
24252
|
} else {
|
|
23678
|
-
|
|
24253
|
+
curveLayerOwner[i] = null;
|
|
23679
24254
|
console.warn("The entity don't have the child entity which path is " + curve.relativePath + ".");
|
|
23680
24255
|
}
|
|
23681
24256
|
}
|
|
@@ -23703,65 +24278,61 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23703
24278
|
};
|
|
23704
24279
|
_proto._clearCrossData = function _clearCrossData(animatorLayerData) {
|
|
23705
24280
|
animatorLayerData.crossCurveMark++;
|
|
23706
|
-
|
|
24281
|
+
animatorLayerData.crossOwnerLayerDataCollection.length = 0;
|
|
23707
24282
|
};
|
|
23708
|
-
_proto.
|
|
23709
|
-
|
|
23710
|
-
|
|
23711
|
-
|
|
24283
|
+
_proto._addCrossOwner = function _addCrossOwner(animatorLayerData, layerOwner, curCurveIndex, nextCurveIndex) {
|
|
24284
|
+
layerOwner.crossSrcCurveIndex = curCurveIndex;
|
|
24285
|
+
layerOwner.crossDestCurveIndex = nextCurveIndex;
|
|
24286
|
+
animatorLayerData.crossOwnerLayerDataCollection.push(layerOwner);
|
|
23712
24287
|
};
|
|
23713
24288
|
_proto._prepareCrossFading = function _prepareCrossFading(animatorLayerData) {
|
|
23714
|
-
var crossCurveData = this._crossOwnerCollection;
|
|
23715
|
-
var crossCurveMark = animatorLayerData.crossCurveMark;
|
|
23716
24289
|
// Add src cross curve data.
|
|
23717
|
-
this._prepareSrcCrossData(
|
|
24290
|
+
this._prepareSrcCrossData(animatorLayerData, false);
|
|
23718
24291
|
// Add dest cross curve data.
|
|
23719
|
-
this._prepareDestCrossData(
|
|
24292
|
+
this._prepareDestCrossData(animatorLayerData, false);
|
|
23720
24293
|
};
|
|
23721
24294
|
_proto._prepareStandbyCrossFading = function _prepareStandbyCrossFading(animatorLayerData) {
|
|
23722
|
-
var crossOwnerCollection = this._crossOwnerCollection;
|
|
23723
|
-
var srcPlayData = animatorLayerData.srcPlayData, crossCurveMark = animatorLayerData.crossCurveMark;
|
|
23724
24295
|
// Standby have two sub state, one is never play, one is finished, never play srcPlayData.state is null.
|
|
23725
|
-
srcPlayData.state && this._prepareSrcCrossData(
|
|
24296
|
+
animatorLayerData.srcPlayData.state && this._prepareSrcCrossData(animatorLayerData, true);
|
|
23726
24297
|
// Add dest cross curve data.
|
|
23727
|
-
this._prepareDestCrossData(
|
|
24298
|
+
this._prepareDestCrossData(animatorLayerData, true);
|
|
23728
24299
|
};
|
|
23729
24300
|
_proto._prepareFixedPoseCrossFading = function _prepareFixedPoseCrossFading(animatorLayerData) {
|
|
23730
|
-
var
|
|
24301
|
+
var crossOwnerLayerDataCollection = animatorLayerData.crossOwnerLayerDataCollection;
|
|
23731
24302
|
// Save current cross curve data owner fixed pose.
|
|
23732
|
-
for(var i =
|
|
23733
|
-
var
|
|
23734
|
-
|
|
24303
|
+
for(var i = crossOwnerLayerDataCollection.length - 1; i >= 0; i--){
|
|
24304
|
+
var layerOwner = crossOwnerLayerDataCollection[i];
|
|
24305
|
+
if (!layerOwner) continue;
|
|
24306
|
+
layerOwner.curveOwner.saveFixedPoseValue();
|
|
23735
24307
|
// Reset destCurveIndex When fixed pose crossFading again.
|
|
23736
|
-
|
|
24308
|
+
layerOwner.crossDestCurveIndex = -1;
|
|
23737
24309
|
}
|
|
23738
24310
|
// prepare dest AnimatorState cross data.
|
|
23739
|
-
this._prepareDestCrossData(
|
|
23740
|
-
};
|
|
23741
|
-
_proto._prepareSrcCrossData = function _prepareSrcCrossData(
|
|
23742
|
-
var
|
|
23743
|
-
for(var i =
|
|
23744
|
-
var
|
|
23745
|
-
if (!
|
|
23746
|
-
|
|
23747
|
-
|
|
23748
|
-
|
|
23749
|
-
|
|
23750
|
-
|
|
23751
|
-
|
|
23752
|
-
|
|
23753
|
-
var
|
|
23754
|
-
|
|
23755
|
-
|
|
23756
|
-
if (
|
|
23757
|
-
|
|
23758
|
-
crossCurveData[owner.crossCurveDataIndex].crossDestCurveIndex = i;
|
|
24311
|
+
this._prepareDestCrossData(animatorLayerData, true);
|
|
24312
|
+
};
|
|
24313
|
+
_proto._prepareSrcCrossData = function _prepareSrcCrossData(animatorLayerData, saveFixed) {
|
|
24314
|
+
var curveLayerOwner = animatorLayerData.srcPlayData.stateData.curveLayerOwner;
|
|
24315
|
+
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
24316
|
+
var layerOwner = curveLayerOwner[i];
|
|
24317
|
+
if (!layerOwner) continue;
|
|
24318
|
+
layerOwner.crossCurveMark = animatorLayerData.crossCurveMark;
|
|
24319
|
+
saveFixed && layerOwner.curveOwner.saveFixedPoseValue();
|
|
24320
|
+
this._addCrossOwner(animatorLayerData, layerOwner, i, -1);
|
|
24321
|
+
}
|
|
24322
|
+
};
|
|
24323
|
+
_proto._prepareDestCrossData = function _prepareDestCrossData(animatorLayerData, saveFixed) {
|
|
24324
|
+
var curveLayerOwner = animatorLayerData.destPlayData.stateData.curveLayerOwner;
|
|
24325
|
+
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
24326
|
+
var layerOwner = curveLayerOwner[i];
|
|
24327
|
+
if (!layerOwner) continue;
|
|
24328
|
+
if (layerOwner.crossCurveMark === animatorLayerData.crossCurveMark) {
|
|
24329
|
+
layerOwner.crossDestCurveIndex = i;
|
|
23759
24330
|
} else {
|
|
24331
|
+
var owner = layerOwner.curveOwner;
|
|
23760
24332
|
owner.saveDefaultValue();
|
|
23761
24333
|
saveFixed && owner.saveFixedPoseValue();
|
|
23762
|
-
|
|
23763
|
-
|
|
23764
|
-
this._addCrossCurveData(crossCurveData, owner, -1, i);
|
|
24334
|
+
layerOwner.crossCurveMark = animatorLayerData.crossCurveMark;
|
|
24335
|
+
this._addCrossOwner(animatorLayerData, layerOwner, -1, i);
|
|
23765
24336
|
}
|
|
23766
24337
|
}
|
|
23767
24338
|
};
|
|
@@ -23791,7 +24362,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23791
24362
|
}
|
|
23792
24363
|
};
|
|
23793
24364
|
_proto._updatePlayingState = function _updatePlayingState(playData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
23794
|
-
var _playData_stateData = playData.stateData,
|
|
24365
|
+
var _playData_stateData = playData.stateData, curveLayerOwner = _playData_stateData.curveLayerOwner, eventHandlers = _playData_stateData.eventHandlers;
|
|
23795
24366
|
var state = playData.state, lastPlayState = playData.playState, lastClipTime = playData.clipTime;
|
|
23796
24367
|
var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
|
|
23797
24368
|
playData.update(this.speed < 0);
|
|
@@ -23801,8 +24372,8 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23801
24372
|
var clipTime = playData.clipTime, playState = playData.playState;
|
|
23802
24373
|
eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, clipTime);
|
|
23803
24374
|
for(var i = curveBindings.length - 1; i >= 0; i--){
|
|
23804
|
-
var
|
|
23805
|
-
|
|
24375
|
+
var _curveLayerOwner_i;
|
|
24376
|
+
(_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner.evaluateAndApplyValue(curveBindings[i].curve, clipTime, weight, additive);
|
|
23806
24377
|
}
|
|
23807
24378
|
playData.frameTime += state.speed * delta;
|
|
23808
24379
|
if (playState === AnimatorStatePlayState.Finished) {
|
|
@@ -23818,7 +24389,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23818
24389
|
}
|
|
23819
24390
|
};
|
|
23820
24391
|
_proto._updateCrossFade = function _updateCrossFade(srcPlayData, destPlayData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
23821
|
-
var
|
|
24392
|
+
var crossOwnerLayerDataCollection = layerData.crossOwnerLayerDataCollection;
|
|
23822
24393
|
var _srcPlayData_state_clip = srcPlayData.state.clip, srcCurves = _srcPlayData_state_clip._curveBindings;
|
|
23823
24394
|
var srcState = srcPlayData.state, srcStateData = srcPlayData.stateData, lastSrcPlayState = srcPlayData.playState;
|
|
23824
24395
|
var srcEventHandlers = srcStateData.eventHandlers;
|
|
@@ -23857,14 +24428,16 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23857
24428
|
} else {
|
|
23858
24429
|
this._callAnimatorScriptOnUpdate(destState, layerIndex);
|
|
23859
24430
|
}
|
|
23860
|
-
for(var i =
|
|
23861
|
-
var
|
|
23862
|
-
|
|
23863
|
-
|
|
24431
|
+
for(var i = crossOwnerLayerDataCollection.length - 1; i >= 0; i--){
|
|
24432
|
+
var layerOwner = crossOwnerLayerDataCollection[i];
|
|
24433
|
+
if (!layerOwner) continue;
|
|
24434
|
+
var srcCurveIndex = layerOwner.crossSrcCurveIndex;
|
|
24435
|
+
var destCurveIndex = layerOwner.crossDestCurveIndex;
|
|
24436
|
+
layerOwner.curveOwner.crossFadeAndApplyValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, weight, additive);
|
|
23864
24437
|
}
|
|
23865
24438
|
};
|
|
23866
24439
|
_proto._updateCrossFadeFromPose = function _updateCrossFadeFromPose(destPlayData, layerData, layerIndex, layerWeight, delta, additive, aniUpdate) {
|
|
23867
|
-
var
|
|
24440
|
+
var crossOwnerLayerDataCollection = layerData.crossOwnerLayerDataCollection;
|
|
23868
24441
|
var state = destPlayData.state, stateData = destPlayData.stateData, lastPlayState = destPlayData.playState;
|
|
23869
24442
|
var eventHandlers = stateData.eventHandlers;
|
|
23870
24443
|
var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
|
|
@@ -23888,10 +24461,11 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23888
24461
|
} else {
|
|
23889
24462
|
this._callAnimatorScriptOnUpdate(state, layerIndex);
|
|
23890
24463
|
}
|
|
23891
|
-
for(var i =
|
|
23892
|
-
var
|
|
23893
|
-
|
|
23894
|
-
|
|
24464
|
+
for(var i = crossOwnerLayerDataCollection.length - 1; i >= 0; i--){
|
|
24465
|
+
var layerOwner = crossOwnerLayerDataCollection[i];
|
|
24466
|
+
if (!layerOwner) continue;
|
|
24467
|
+
var curveIndex = layerOwner.crossDestCurveIndex;
|
|
24468
|
+
layerOwner.curveOwner.crossFadeFromPoseAndApplyValue(curveIndex >= 0 ? curveBindings[curveIndex].curve : null, destClipTime, crossWeight, layerWeight, additive);
|
|
23895
24469
|
}
|
|
23896
24470
|
};
|
|
23897
24471
|
_proto._updateCrossFadeData = function _updateCrossFadeData(layerData, crossWeight, delta, fixed) {
|
|
@@ -23913,18 +24487,19 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23913
24487
|
if (layerData.layerState === LayerState.Playing) {
|
|
23914
24488
|
var srcPlayData = layerData.srcPlayData;
|
|
23915
24489
|
if (srcPlayData.state !== playState) {
|
|
23916
|
-
var
|
|
23917
|
-
for(var i =
|
|
23918
|
-
var
|
|
24490
|
+
var curveLayerOwner = srcPlayData.stateData.curveLayerOwner;
|
|
24491
|
+
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
24492
|
+
var _curveLayerOwner_i;
|
|
24493
|
+
var owner = (_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner;
|
|
23919
24494
|
(owner == null ? void 0 : owner.hasSavedDefaultValue) && owner.revertDefaultValue();
|
|
23920
24495
|
}
|
|
23921
24496
|
this._saveDefaultValues(playStateData);
|
|
23922
24497
|
}
|
|
23923
24498
|
} else {
|
|
23924
24499
|
// layerState is CrossFading, FixedCrossFading, Standby
|
|
23925
|
-
var
|
|
23926
|
-
for(var i1 =
|
|
23927
|
-
var owner1 =
|
|
24500
|
+
var crossOwnerLayerDataCollection = layerData.crossOwnerLayerDataCollection;
|
|
24501
|
+
for(var i1 = crossOwnerLayerDataCollection.length - 1; i1 >= 0; i1--){
|
|
24502
|
+
var owner1 = crossOwnerLayerDataCollection[i1].curveOwner;
|
|
23928
24503
|
owner1.hasSavedDefaultValue && owner1.revertDefaultValue();
|
|
23929
24504
|
}
|
|
23930
24505
|
this._saveDefaultValues(playStateData);
|
|
@@ -24094,10 +24669,7 @@ __decorate([
|
|
|
24094
24669
|
], Animator.prototype, "_animatorLayersData", void 0);
|
|
24095
24670
|
__decorate([
|
|
24096
24671
|
ignoreClone
|
|
24097
|
-
], Animator.prototype, "
|
|
24098
|
-
__decorate([
|
|
24099
|
-
ignoreClone
|
|
24100
|
-
], Animator.prototype, "_animationCurveOwners", void 0);
|
|
24672
|
+
], Animator.prototype, "_curveOwnerPool", void 0);
|
|
24101
24673
|
__decorate([
|
|
24102
24674
|
ignoreClone
|
|
24103
24675
|
], Animator.prototype, "_animationEventHandlerPool", void 0);
|
|
@@ -25530,7 +26102,9 @@ var _tempVector3 = new engineMath.Vector3();
|
|
|
25530
26102
|
this.getMaterial().shaderData.setTexture("u_texture", texture);
|
|
25531
26103
|
}
|
|
25532
26104
|
};
|
|
25533
|
-
|
|
26105
|
+
/**
|
|
26106
|
+
* @internal
|
|
26107
|
+
*/ _proto._render = function _render(context) {
|
|
25534
26108
|
this._updateStrapVertices(context.camera, this._points);
|
|
25535
26109
|
this._updateStrapCoords();
|
|
25536
26110
|
this._vertexBuffer.setData(this._vertices);
|
|
@@ -25724,7 +26298,7 @@ var cacheDir = new engineMath.Vector3();
|
|
|
25724
26298
|
/**
|
|
25725
26299
|
* The position of the probe can be set, the default is the origin [0,0,0].
|
|
25726
26300
|
*/ _this.position = new engineMath.Vector3(0, 0, 0);
|
|
25727
|
-
_this._isCube = true;
|
|
26301
|
+
/** @internal */ _this._isCube = true;
|
|
25728
26302
|
_this.oriViewMatrix = new engineMath.Matrix();
|
|
25729
26303
|
return _this;
|
|
25730
26304
|
}
|
|
@@ -25814,6 +26388,7 @@ exports.Basic2DBatcher = Basic2DBatcher;
|
|
|
25814
26388
|
exports.BasicRenderPipeline = BasicRenderPipeline;
|
|
25815
26389
|
exports.BlendShape = BlendShape;
|
|
25816
26390
|
exports.BlendShapeFrame = BlendShapeFrame;
|
|
26391
|
+
exports.BlendState = BlendState;
|
|
25817
26392
|
exports.BlinnPhongMaterial = BlinnPhongMaterial;
|
|
25818
26393
|
exports.BoolUpdateFlag = BoolUpdateFlag;
|
|
25819
26394
|
exports.BoxColliderShape = BoxColliderShape;
|
|
@@ -25827,6 +26402,7 @@ exports.ColliderShape = ColliderShape;
|
|
|
25827
26402
|
exports.Component = Component;
|
|
25828
26403
|
exports.ContentRestorer = ContentRestorer;
|
|
25829
26404
|
exports.CubeProbe = CubeProbe;
|
|
26405
|
+
exports.DepthState = DepthState;
|
|
25830
26406
|
exports.DirectLight = DirectLight;
|
|
25831
26407
|
exports.DynamicCollider = DynamicCollider;
|
|
25832
26408
|
exports.Engine = Engine;
|
|
@@ -25860,10 +26436,13 @@ exports.PointLight = PointLight;
|
|
|
25860
26436
|
exports.Pointer = Pointer;
|
|
25861
26437
|
exports.PrimitiveMesh = PrimitiveMesh;
|
|
25862
26438
|
exports.Probe = Probe;
|
|
26439
|
+
exports.RasterState = RasterState;
|
|
25863
26440
|
exports.ReferResource = ReferResource;
|
|
25864
26441
|
exports.RenderPass = RenderPass;
|
|
25865
26442
|
exports.RenderQueue = RenderQueue;
|
|
26443
|
+
exports.RenderState = RenderState;
|
|
25866
26444
|
exports.RenderTarget = RenderTarget;
|
|
26445
|
+
exports.RenderTargetBlendState = RenderTargetBlendState;
|
|
25867
26446
|
exports.ResourceManager = ResourceManager;
|
|
25868
26447
|
exports.Scene = Scene;
|
|
25869
26448
|
exports.SceneManager = SceneManager;
|
|
@@ -25890,6 +26469,7 @@ exports.SpriteMask = SpriteMask;
|
|
|
25890
26469
|
exports.SpriteRenderer = SpriteRenderer;
|
|
25891
26470
|
exports.StateMachineScript = StateMachineScript;
|
|
25892
26471
|
exports.StaticCollider = StaticCollider;
|
|
26472
|
+
exports.StencilState = StencilState;
|
|
25893
26473
|
exports.SubMesh = SubMesh;
|
|
25894
26474
|
exports.SubShader = SubShader;
|
|
25895
26475
|
exports.SystemInfo = SystemInfo;
|