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