@galacean/engine 1.0.0-beta.1 → 1.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +934 -428
- package/dist/browser.min.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/package.json +5 -5
package/dist/browser.js
CHANGED
|
@@ -5533,7 +5533,9 @@
|
|
|
5533
5533
|
*/ _proto._addToResourceManager = function _addToResourceManager(path) {
|
|
5534
5534
|
this._engine.resourceManager._addAsset(path, this);
|
|
5535
5535
|
};
|
|
5536
|
-
|
|
5536
|
+
/**
|
|
5537
|
+
* @internal
|
|
5538
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
5537
5539
|
EngineObject.prototype._onDestroy.call(this);
|
|
5538
5540
|
this._engine.resourceManager._deleteReferResource(this);
|
|
5539
5541
|
var refCount = this._getReferCount();
|
|
@@ -5657,7 +5659,9 @@
|
|
|
5657
5659
|
};
|
|
5658
5660
|
_inherits$2(GraphicsResource, ReferResource);
|
|
5659
5661
|
var _proto = GraphicsResource.prototype;
|
|
5660
|
-
|
|
5662
|
+
/**
|
|
5663
|
+
* @internal
|
|
5664
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
5661
5665
|
ReferResource.prototype._onDestroy.call(this);
|
|
5662
5666
|
this.engine.resourceManager._deleteGraphicResource(this);
|
|
5663
5667
|
};
|
|
@@ -5734,7 +5738,9 @@
|
|
|
5734
5738
|
platformTexture.depthCompareFunction = this._depthCompareFunction;
|
|
5735
5739
|
platformTexture.setUseDepthCompareMode(this._useDepthCompareMode);
|
|
5736
5740
|
};
|
|
5737
|
-
|
|
5741
|
+
/**
|
|
5742
|
+
* @internal
|
|
5743
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
5738
5744
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
5739
5745
|
this._platformTexture.destroy();
|
|
5740
5746
|
this._platformTexture = null;
|
|
@@ -5882,9 +5888,11 @@
|
|
|
5882
5888
|
renderTexture
|
|
5883
5889
|
];
|
|
5884
5890
|
for(var i = 0, n = colorTextures.length; i < n; i++){
|
|
5885
|
-
|
|
5891
|
+
var colorTexture = colorTextures[i];
|
|
5892
|
+
if (colorTexture._isDepthTexture) {
|
|
5886
5893
|
throw "Render texture can't use depth format.";
|
|
5887
5894
|
}
|
|
5895
|
+
colorTexture._addReferCount(1);
|
|
5888
5896
|
}
|
|
5889
5897
|
_this._colorTextures = colorTextures;
|
|
5890
5898
|
} else {
|
|
@@ -5895,6 +5903,7 @@
|
|
|
5895
5903
|
throw "Depth texture must use depth format.";
|
|
5896
5904
|
}
|
|
5897
5905
|
_this._depthTexture = depth;
|
|
5906
|
+
_this._depthTexture._addReferCount(1);
|
|
5898
5907
|
}
|
|
5899
5908
|
_this._platformRenderTarget = engine._hardwareRenderer.createPlatformRenderTarget(_assert_this_initialized(_this));
|
|
5900
5909
|
return _this;
|
|
@@ -5921,10 +5930,18 @@
|
|
|
5921
5930
|
this._depthTexture && this._depthTexture.generateMipmaps();
|
|
5922
5931
|
}
|
|
5923
5932
|
};
|
|
5924
|
-
|
|
5933
|
+
/**
|
|
5934
|
+
* @internal
|
|
5935
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
5936
|
+
var _this__depthTexture;
|
|
5925
5937
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
5926
5938
|
this._platformRenderTarget.destroy();
|
|
5927
|
-
this
|
|
5939
|
+
var _this = this, colorTextures = _this._colorTextures;
|
|
5940
|
+
for(var i = 0, n = colorTextures.length; i < n; i++){
|
|
5941
|
+
colorTextures[i]._addReferCount(-1);
|
|
5942
|
+
}
|
|
5943
|
+
colorTextures.length = 0;
|
|
5944
|
+
(_this__depthTexture = this._depthTexture) == null ? void 0 : _this__depthTexture._addReferCount(-1);
|
|
5928
5945
|
this._depthTexture = null;
|
|
5929
5946
|
this._depth = null;
|
|
5930
5947
|
};
|
|
@@ -6295,7 +6312,9 @@
|
|
|
6295
6312
|
_proto.getCharInfo = function getCharInfo(char) {
|
|
6296
6313
|
return this._charInfoMap[char.charCodeAt(0)];
|
|
6297
6314
|
};
|
|
6298
|
-
|
|
6315
|
+
/**
|
|
6316
|
+
* @internal
|
|
6317
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
6299
6318
|
ReferResource.prototype._onDestroy.call(this);
|
|
6300
6319
|
this.texture.destroy();
|
|
6301
6320
|
this.texture = null;
|
|
@@ -6798,6 +6817,7 @@
|
|
|
6798
6817
|
var fontAtlas = new FontAtlas(engine);
|
|
6799
6818
|
var texture = new Texture2D(engine, 256, 256);
|
|
6800
6819
|
fontAtlas.texture = texture;
|
|
6820
|
+
fontAtlas.isGCIgnored = texture.isGCIgnored = true;
|
|
6801
6821
|
this._fontAtlases.push(fontAtlas);
|
|
6802
6822
|
var nativeFontString = this.nativeFontString;
|
|
6803
6823
|
engine.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
|
|
@@ -6853,7 +6873,9 @@
|
|
|
6853
6873
|
subFontMap[key] = subFont;
|
|
6854
6874
|
return subFont;
|
|
6855
6875
|
};
|
|
6856
|
-
|
|
6876
|
+
/**
|
|
6877
|
+
* @internal
|
|
6878
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
6857
6879
|
ReferResource.prototype._onDestroy.call(this);
|
|
6858
6880
|
var subFontMap = this._subFontMap;
|
|
6859
6881
|
for(var k in subFontMap){
|
|
@@ -8060,7 +8082,9 @@
|
|
|
8060
8082
|
}
|
|
8061
8083
|
}
|
|
8062
8084
|
};
|
|
8063
|
-
|
|
8085
|
+
/**
|
|
8086
|
+
* @internal
|
|
8087
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
8064
8088
|
EngineObject.prototype._onDestroy.call(this);
|
|
8065
8089
|
this._entity._removeComponent(this);
|
|
8066
8090
|
if (this._entity.isActiveInHierarchy) {
|
|
@@ -10055,14 +10079,14 @@
|
|
|
10055
10079
|
Keys[Keys[/** Tab or ⇥. */ "Tab"] = 63] = "Tab";
|
|
10056
10080
|
Keys[Keys[/** Japanese: 変換 (henkan). */ "Convert"] = 64] = "Convert";
|
|
10057
10081
|
Keys[Keys[/** Japanese: カタカナ/ひらがな/ローマ字 (katakana/hiragana/romaji). */ "KanaMode"] = 65] = "KanaMode";
|
|
10058
|
-
Keys[Keys[/**
|
|
10059
|
-
* Korean: HangulMode 한/영 (han/yeong).
|
|
10060
|
-
* Japanese (Mac keyboard): かな (kana).
|
|
10061
|
-
* */ "Lang1"] = 66] = "Lang1";
|
|
10062
10082
|
Keys[Keys[/**
|
|
10063
|
-
|
|
10064
|
-
|
|
10065
|
-
|
|
10083
|
+
* Korean: HangulMode 한/영 (han/yeong).
|
|
10084
|
+
* Japanese (Mac keyboard): かな (kana).
|
|
10085
|
+
* */ "Lang1"] = 66] = "Lang1";
|
|
10086
|
+
Keys[Keys[/**
|
|
10087
|
+
* Korean: Hanja 한자 (hanja).
|
|
10088
|
+
* Japanese (Mac keyboard): 英数 (eisu).
|
|
10089
|
+
*/ "Lang2"] = 67] = "Lang2";
|
|
10066
10090
|
Keys[Keys[/** Japanese (word-processing keyboard): Katakana. */ "Lang3"] = 68] = "Lang3";
|
|
10067
10091
|
Keys[Keys[/** Japanese (word-processing keyboard): Hiragana. */ "Lang4"] = 69] = "Lang4";
|
|
10068
10092
|
Keys[Keys[/** Japanese (word-processing keyboard): Zenkaku/Hankaku. */ "Lang5"] = 70] = "Lang5";
|
|
@@ -10079,46 +10103,46 @@
|
|
|
10079
10103
|
Keys[Keys[/** → */ "ArrowRight"] = 81] = "ArrowRight";
|
|
10080
10104
|
Keys[Keys[/** ↑ */ "ArrowUp"] = 82] = "ArrowUp";
|
|
10081
10105
|
Keys[Keys[/** On the Mac, the "NumLock" code should be used for the numpad Clear key. */ "NumLock"] = 83] = "NumLock";
|
|
10082
|
-
Keys[Keys[/**
|
|
10083
|
-
* 0 Ins on a keyboard.
|
|
10084
|
-
* 0 on a phone or remote control.
|
|
10085
|
-
* */ "Numpad0"] = 84] = "Numpad0";
|
|
10086
10106
|
Keys[Keys[/**
|
|
10087
|
-
|
|
10088
|
-
|
|
10089
|
-
|
|
10107
|
+
* 0 Ins on a keyboard.
|
|
10108
|
+
* 0 on a phone or remote control.
|
|
10109
|
+
* */ "Numpad0"] = 84] = "Numpad0";
|
|
10110
|
+
Keys[Keys[/**
|
|
10111
|
+
* 1 End on a keyboard.
|
|
10112
|
+
* 1 or 1 QZ on a phone or remote control.
|
|
10113
|
+
*/ "Numpad1"] = 85] = "Numpad1";
|
|
10090
10114
|
Keys[Keys[/**
|
|
10091
|
-
|
|
10092
|
-
|
|
10093
|
-
|
|
10115
|
+
* 2 ↓ on a keyboard.
|
|
10116
|
+
* 2 ABC on a phone or remote control.
|
|
10117
|
+
*/ "Numpad2"] = 86] = "Numpad2";
|
|
10094
10118
|
Keys[Keys[/**
|
|
10095
|
-
|
|
10096
|
-
|
|
10097
|
-
|
|
10119
|
+
* 3 PgDn on a keyboard.
|
|
10120
|
+
* 3 DEF on a phone or remote control.
|
|
10121
|
+
*/ "Numpad3"] = 87] = "Numpad3";
|
|
10098
10122
|
Keys[Keys[/**
|
|
10099
|
-
|
|
10100
|
-
|
|
10101
|
-
|
|
10123
|
+
* 4 ← on a keyboard.
|
|
10124
|
+
* 4 GHI on a phone or remote control.
|
|
10125
|
+
*/ "Numpad4"] = 88] = "Numpad4";
|
|
10102
10126
|
Keys[Keys[/**
|
|
10103
|
-
|
|
10104
|
-
|
|
10105
|
-
|
|
10127
|
+
* 5 on a keyboard.
|
|
10128
|
+
* 5 JKL on a phone or remote control.
|
|
10129
|
+
*/ "Numpad5"] = 89] = "Numpad5";
|
|
10106
10130
|
Keys[Keys[/**
|
|
10107
|
-
|
|
10108
|
-
|
|
10109
|
-
|
|
10131
|
+
* 6 → on a keyboard.
|
|
10132
|
+
* 6 MNO on a phone or remote control.
|
|
10133
|
+
*/ "Numpad6"] = 90] = "Numpad6";
|
|
10110
10134
|
Keys[Keys[/**
|
|
10111
|
-
|
|
10112
|
-
|
|
10113
|
-
|
|
10135
|
+
* 7 Home on a keyboard.
|
|
10136
|
+
* 7 PQRS or 7 PRS on a phone or remote control.
|
|
10137
|
+
*/ "Numpad7"] = 91] = "Numpad7";
|
|
10114
10138
|
Keys[Keys[/**
|
|
10115
|
-
|
|
10116
|
-
|
|
10117
|
-
|
|
10139
|
+
* 8 ↑ on a keyboard.
|
|
10140
|
+
* 8 TUV on a phone or remote control.
|
|
10141
|
+
*/ "Numpad8"] = 92] = "Numpad8";
|
|
10118
10142
|
Keys[Keys[/**
|
|
10119
|
-
|
|
10120
|
-
|
|
10121
|
-
|
|
10143
|
+
* 9 PgUp on a keyboard.
|
|
10144
|
+
* 9 WXYZ or 9 WXY on a phone or remote control.
|
|
10145
|
+
*/ "Numpad9"] = 93] = "Numpad9";
|
|
10122
10146
|
Keys[Keys[/** + */ "NumpadAdd"] = 94] = "NumpadAdd";
|
|
10123
10147
|
Keys[Keys[/** Found on the Microsoft Natural Keyboard. */ "NumpadBackspace"] = 95] = "NumpadBackspace";
|
|
10124
10148
|
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";
|
|
@@ -10134,16 +10158,16 @@
|
|
|
10134
10158
|
Keys[Keys[/** MR Replace the current entry with the value stored in memory. */ "NumpadMemoryRecall"] = 106] = "NumpadMemoryRecall";
|
|
10135
10159
|
Keys[Keys[/** MS Replace the value stored in memory with the current entry. */ "NumpadMemoryStore"] = 107] = "NumpadMemoryStore";
|
|
10136
10160
|
Keys[Keys[/** M- Subtract current entry from the value stored in memory. */ "NumpadMemorySubtract"] = 108] = "NumpadMemorySubtract";
|
|
10137
|
-
Keys[Keys[/**
|
|
10138
|
-
|
|
10139
|
-
|
|
10140
|
-
|
|
10161
|
+
Keys[Keys[/**
|
|
10162
|
+
* * on a keyboard. For use with numpads that provide mathematical operations (+, -, * and /).
|
|
10163
|
+
* Use "NumpadStar" for the * key on phones and remote controls.
|
|
10164
|
+
*/ "NumpadMultiply"] = 109] = "NumpadMultiply";
|
|
10141
10165
|
Keys[Keys[/** ( Found on the Microsoft Natural Keyboard. */ "NumpadParenLeft"] = 110] = "NumpadParenLeft";
|
|
10142
10166
|
Keys[Keys[/** ) Found on the Microsoft Natural Keyboard. */ "NumpadParenRight"] = 111] = "NumpadParenRight";
|
|
10143
10167
|
Keys[Keys[/**
|
|
10144
|
-
|
|
10145
|
-
|
|
10146
|
-
|
|
10168
|
+
* * on a phone or remote control device. This key is typically found below the 7 key and to the left of the 0 key.
|
|
10169
|
+
* Use "NumpadMultiply" for the * key on numeric keypads.
|
|
10170
|
+
*/ "NumpadStar"] = 112] = "NumpadStar";
|
|
10147
10171
|
Keys[Keys[/** - */ "NumpadSubtract"] = 113] = "NumpadSubtract";
|
|
10148
10172
|
Keys[Keys[/** Esc or ⎋. */ "Escape"] = 114] = "Escape";
|
|
10149
10173
|
Keys[Keys[/** F1 */ "F1"] = 115] = "F1";
|
|
@@ -10809,7 +10833,9 @@
|
|
|
10809
10833
|
*/ _proto._onDisable = function _onDisable() {
|
|
10810
10834
|
this.engine.physicsManager._removeCollider(this);
|
|
10811
10835
|
};
|
|
10812
|
-
|
|
10836
|
+
/**
|
|
10837
|
+
* @internal
|
|
10838
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
10813
10839
|
Component.prototype._onDestroy.call(this);
|
|
10814
10840
|
this.clearShapes();
|
|
10815
10841
|
this._nativeCollider.destroy();
|
|
@@ -12633,7 +12659,10 @@
|
|
|
12633
12659
|
};
|
|
12634
12660
|
_inherits$2(Light, Component);
|
|
12635
12661
|
var _proto = Light.prototype;
|
|
12636
|
-
|
|
12662
|
+
/**
|
|
12663
|
+
* Light Color, include intensity.
|
|
12664
|
+
* @internal
|
|
12665
|
+
*/ _proto._getLightIntensityColor = function _getLightIntensityColor() {
|
|
12637
12666
|
this._lightColor.r = this.color.r * this.intensity;
|
|
12638
12667
|
this._lightColor.g = this.color.g * this.intensity;
|
|
12639
12668
|
this._lightColor.b = this.color.b * this.intensity;
|
|
@@ -12702,15 +12731,21 @@
|
|
|
12702
12731
|
var cullingMaskStart = lightIndex * 2;
|
|
12703
12732
|
var colorStart = lightIndex * 3;
|
|
12704
12733
|
var directionStart = lightIndex * 3;
|
|
12705
|
-
var lightColor = this.
|
|
12734
|
+
var lightColor = this._getLightIntensityColor();
|
|
12706
12735
|
var direction = this.direction;
|
|
12707
12736
|
var data = DirectLight._combinedData;
|
|
12708
12737
|
var cullingMask = this.cullingMask;
|
|
12709
12738
|
data.cullingMask[cullingMaskStart] = cullingMask & 65535;
|
|
12710
12739
|
data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
|
|
12711
|
-
|
|
12712
|
-
|
|
12713
|
-
|
|
12740
|
+
if (this.engine.settings.colorSpace === exports.ColorSpace.Linear) {
|
|
12741
|
+
data.color[colorStart] = Color$1.gammaToLinearSpace(lightColor.r);
|
|
12742
|
+
data.color[colorStart + 1] = Color$1.gammaToLinearSpace(lightColor.g);
|
|
12743
|
+
data.color[colorStart + 2] = Color$1.gammaToLinearSpace(lightColor.b);
|
|
12744
|
+
} else {
|
|
12745
|
+
data.color[colorStart] = lightColor.r;
|
|
12746
|
+
data.color[colorStart + 1] = lightColor.g;
|
|
12747
|
+
data.color[colorStart + 2] = lightColor.b;
|
|
12748
|
+
}
|
|
12714
12749
|
data.direction[directionStart] = direction.x;
|
|
12715
12750
|
data.direction[directionStart + 1] = direction.y;
|
|
12716
12751
|
data.direction[directionStart + 2] = direction.z;
|
|
@@ -12798,15 +12833,21 @@
|
|
|
12798
12833
|
var colorStart = lightIndex * 3;
|
|
12799
12834
|
var positionStart = lightIndex * 3;
|
|
12800
12835
|
var distanceStart = lightIndex;
|
|
12801
|
-
var lightColor = this.
|
|
12836
|
+
var lightColor = this._getLightIntensityColor();
|
|
12802
12837
|
var lightPosition = this.position;
|
|
12803
12838
|
var data = PointLight._combinedData;
|
|
12804
12839
|
var cullingMask = this.cullingMask;
|
|
12805
12840
|
data.cullingMask[cullingMaskStart] = cullingMask & 65535;
|
|
12806
12841
|
data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
|
|
12807
|
-
|
|
12808
|
-
|
|
12809
|
-
|
|
12842
|
+
if (this.engine.settings.colorSpace === exports.ColorSpace.Linear) {
|
|
12843
|
+
data.color[colorStart] = Color$1.gammaToLinearSpace(lightColor.r);
|
|
12844
|
+
data.color[colorStart + 1] = Color$1.gammaToLinearSpace(lightColor.g);
|
|
12845
|
+
data.color[colorStart + 2] = Color$1.gammaToLinearSpace(lightColor.b);
|
|
12846
|
+
} else {
|
|
12847
|
+
data.color[colorStart] = lightColor.r;
|
|
12848
|
+
data.color[colorStart + 1] = lightColor.g;
|
|
12849
|
+
data.color[colorStart + 2] = lightColor.b;
|
|
12850
|
+
}
|
|
12810
12851
|
data.position[positionStart] = lightPosition.x;
|
|
12811
12852
|
data.position[positionStart + 1] = lightPosition.y;
|
|
12812
12853
|
data.position[positionStart + 2] = lightPosition.z;
|
|
@@ -12898,16 +12939,22 @@
|
|
|
12898
12939
|
var distanceStart = lightIndex;
|
|
12899
12940
|
var penumbraCosStart = lightIndex;
|
|
12900
12941
|
var angleCosStart = lightIndex;
|
|
12901
|
-
var
|
|
12942
|
+
var lightColor = this._getLightIntensityColor();
|
|
12902
12943
|
var position = this.position;
|
|
12903
12944
|
var direction = this.direction;
|
|
12904
12945
|
var data = SpotLight._combinedData;
|
|
12905
12946
|
var cullingMask = this.cullingMask;
|
|
12906
12947
|
data.cullingMask[cullingMaskStart] = cullingMask & 65535;
|
|
12907
12948
|
data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
|
|
12908
|
-
|
|
12909
|
-
|
|
12910
|
-
|
|
12949
|
+
if (this.engine.settings.colorSpace === exports.ColorSpace.Linear) {
|
|
12950
|
+
data.color[colorStart] = Color$1.gammaToLinearSpace(lightColor.r);
|
|
12951
|
+
data.color[colorStart + 1] = Color$1.gammaToLinearSpace(lightColor.g);
|
|
12952
|
+
data.color[colorStart + 2] = Color$1.gammaToLinearSpace(lightColor.b);
|
|
12953
|
+
} else {
|
|
12954
|
+
data.color[colorStart] = lightColor.r;
|
|
12955
|
+
data.color[colorStart + 1] = lightColor.g;
|
|
12956
|
+
data.color[colorStart + 2] = lightColor.b;
|
|
12957
|
+
}
|
|
12911
12958
|
data.position[positionStart] = position.x;
|
|
12912
12959
|
data.position[positionStart + 1] = position.y;
|
|
12913
12960
|
data.position[positionStart + 2] = position.z;
|
|
@@ -13544,6 +13591,7 @@
|
|
|
13544
13591
|
_proto.cloneTo = function cloneTo(target) {
|
|
13545
13592
|
CloneManager.deepCloneObject(this._macroCollection, target._macroCollection);
|
|
13546
13593
|
Object.assign(target._macroMap, this._macroMap);
|
|
13594
|
+
var referCount = target._getReferCount();
|
|
13547
13595
|
var propertyValueMap = this._propertyValueMap;
|
|
13548
13596
|
var targetPropertyValueMap = target._propertyValueMap;
|
|
13549
13597
|
var keys = Object.keys(propertyValueMap);
|
|
@@ -13555,6 +13603,7 @@
|
|
|
13555
13603
|
targetPropertyValueMap[k] = property;
|
|
13556
13604
|
} else if (_instanceof1$2(property, Texture)) {
|
|
13557
13605
|
targetPropertyValueMap[k] = property;
|
|
13606
|
+
referCount > 0 && property._addReferCount(referCount);
|
|
13558
13607
|
} else if (_instanceof1$2(property, Array) || _instanceof1$2(property, Float32Array) || _instanceof1$2(property, Int32Array)) {
|
|
13559
13608
|
targetPropertyValueMap[k] = property.slice();
|
|
13560
13609
|
} else {
|
|
@@ -14234,9 +14283,9 @@
|
|
|
14234
14283
|
}
|
|
14235
14284
|
var camera_declare = "#define GLSLIFY 1\nuniform vec3 camera_Position;"; // eslint-disable-line
|
|
14236
14285
|
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
|
|
14237
|
-
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
|
|
14286
|
+
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
|
|
14238
14287
|
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
|
|
14239
|
-
var color_share = "#define GLSLIFY 1\n#ifdef
|
|
14288
|
+
var color_share = "#define GLSLIFY 1\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\nvarying vec4 v_color;\n#endif\n"; // eslint-disable-line
|
|
14240
14289
|
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
|
|
14241
14290
|
var FogVertexDeclaration = "#define GLSLIFY 1\n#if SCENE_FOG_MODE != 0\nvarying vec3 v_positionVS;\n#endif\n"; // eslint-disable-line
|
|
14242
14291
|
var normal_share = "#define GLSLIFY 1\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef RENDERER_HAS_NORMAL\nvarying vec3 v_normal;\n#if defined(RENDERER_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\nvarying mat3 v_TBN;\n#endif\n#endif\n#endif\n"; // eslint-disable-line
|
|
@@ -14246,7 +14295,7 @@
|
|
|
14246
14295
|
var begin_position_vert = "#define GLSLIFY 1\nvec4 position=vec4(POSITION,1.0);"; // eslint-disable-line
|
|
14247
14296
|
var blendShape_input = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_BLENDSHAPE\n#ifdef RENDERER_BLENDSHAPE_USE_TEXTURE\nuniform mediump sampler2DArray renderer_BlendShapeTexture;uniform ivec3 renderer_BlendShapeTextureInfo;uniform float renderer_BlendShapeWeights[RENDERER_BLENDSHAPE_COUNT];\n#else\nattribute vec3 POSITION_BS0;attribute vec3 POSITION_BS1;\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) && defined( RENDERER_BLENDSHAPE_HAS_TANGENT )\nattribute vec3 NORMAL_BS0;attribute vec3 NORMAL_BS1;attribute vec3 TANGENT_BS0;attribute vec3 TANGENT_BS1;uniform float renderer_BlendShapeWeights[2];\n#else\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) || defined( RENDERER_BLENDSHAPE_HAS_TANGENT )\nattribute vec3 POSITION_BS2;attribute vec3 POSITION_BS3;\n#ifdef RENDERER_BLENDSHAPE_HAS_NORMAL\nattribute vec3 NORMAL_BS0;attribute vec3 NORMAL_BS1;attribute vec3 NORMAL_BS2;attribute vec3 NORMAL_BS3;\n#endif\n#ifdef RENDERER_BLENDSHAPE_HAS_TANGENT\nattribute vec3 TANGENT_BS0;attribute vec3 TANGENT_BS1;attribute vec3 TANGENT_BS2;attribute vec3 TANGENT_BS3;\n#endif\nuniform float renderer_BlendShapeWeights[4];\n#else\nattribute vec3 POSITION_BS2;attribute vec3 POSITION_BS3;attribute vec3 POSITION_BS4;attribute vec3 POSITION_BS5;attribute vec3 POSITION_BS6;attribute vec3 POSITION_BS7;uniform float renderer_BlendShapeWeights[8];\n#endif\n#endif\n#endif\n#ifdef RENDERER_BLENDSHAPE_USE_TEXTURE\nvec3 getBlendShapeVertexElement(int blendShapeIndex,int vertexElementIndex){int y=vertexElementIndex/renderer_BlendShapeTextureInfo.y;int x=vertexElementIndex-y*renderer_BlendShapeTextureInfo.y;ivec3 uv=ivec3(x,y,blendShapeIndex);return texelFetch(renderer_BlendShapeTexture,uv,0).xyz;}\n#endif\n#endif\n"; // eslint-disable-line
|
|
14248
14297
|
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
|
|
14249
|
-
var color_vert = "#define GLSLIFY 1\n#ifdef
|
|
14298
|
+
var color_vert = "#define GLSLIFY 1\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\nv_color=COLOR_0;\n#endif\n"; // eslint-disable-line
|
|
14250
14299
|
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
|
|
14251
14300
|
var normal_vert = "#define GLSLIFY 1\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef RENDERER_HAS_NORMAL\nv_normal=normalize(mat3(renderer_NormalMat)*normal);\n#if defined(RENDERER_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\nvec3 normalW=normalize(mat3(renderer_NormalMat)*normal.xyz);vec3 tangentW=normalize(mat3(renderer_NormalMat)*tangent.xyz);vec3 bitangentW=cross(normalW,tangentW)*tangent.w;v_TBN=mat3(tangentW,bitangentW,normalW);\n#endif\n#endif\n#endif\n"; // eslint-disable-line
|
|
14252
14301
|
var position_vert = "#define GLSLIFY 1\ngl_Position=renderer_MVPMat*position;"; // eslint-disable-line
|
|
@@ -14256,9 +14305,9 @@
|
|
|
14256
14305
|
var FogFragment = "#define GLSLIFY 1\n#if SCENE_FOG_MODE != 0\nfloat fogIntensity=ComputeFogIntensity(length(v_positionVS));gl_FragColor.rgb=mix(scene_FogColor.rgb,gl_FragColor.rgb,fogIntensity);\n#endif\n"; // eslint-disable-line
|
|
14257
14306
|
var light_frag_define = "#define GLSLIFY 1\n#ifdef SCENE_DIRECT_LIGHT_COUNT\nstruct DirectLight{vec3 color;vec3 direction;};uniform ivec2 scene_DirectLightCullingMask[SCENE_DIRECT_LIGHT_COUNT];uniform vec3 scene_DirectLightColor[SCENE_DIRECT_LIGHT_COUNT];uniform vec3 scene_DirectLightDirection[SCENE_DIRECT_LIGHT_COUNT];\n#endif\n#ifdef SCENE_POINT_LIGHT_COUNT\nstruct PointLight{vec3 color;vec3 position;float distance;};uniform ivec2 scene_PointLightCullingMask[SCENE_POINT_LIGHT_COUNT];uniform vec3 scene_PointLightColor[SCENE_POINT_LIGHT_COUNT];uniform vec3 scene_PointLightPosition[SCENE_POINT_LIGHT_COUNT];uniform float scene_PointLightDistance[SCENE_POINT_LIGHT_COUNT];\n#endif\n#ifdef SCENE_SPOT_LIGHT_COUNT\nstruct SpotLight{vec3 color;vec3 position;vec3 direction;float distance;float angleCos;float penumbraCos;};uniform ivec2 scene_SpotLightCullingMask[SCENE_SPOT_LIGHT_COUNT];uniform vec3 scene_SpotLightColor[SCENE_SPOT_LIGHT_COUNT];uniform vec3 scene_SpotLightPosition[SCENE_SPOT_LIGHT_COUNT];uniform vec3 scene_SpotLightDirection[SCENE_SPOT_LIGHT_COUNT];uniform float scene_SpotLightDistance[SCENE_SPOT_LIGHT_COUNT];uniform float scene_SpotLightAngleCos[SCENE_SPOT_LIGHT_COUNT];uniform float scene_SpotLightPenumbraCos[SCENE_SPOT_LIGHT_COUNT];\n#endif\nstruct EnvMapLight{vec3 diffuse;float mipMapLevel;float diffuseIntensity;float specularIntensity;};uniform EnvMapLight scene_EnvMapLight;uniform ivec4 renderer_Layer;\n#ifdef SCENE_USE_SH\nuniform vec3 scene_EnvSH[9];\n#endif\n#ifdef SCENE_USE_SPECULAR_ENV\nuniform samplerCube scene_EnvSpecularSampler;\n#endif\n#ifndef GRAPHICS_API_WEBGL2\nbool isBitSet(float value,float mask,float bitIndex){return mod(floor(value/pow(2.0,bitIndex)),2.0)==1.0&&mod(floor(mask/pow(2.0,bitIndex)),2.0)==1.0;}\n#endif\nbool isRendererCulledByLight(ivec2 rendererLayer,ivec2 lightCullingMask){\n#ifdef GRAPHICS_API_WEBGL2\nreturn!((rendererLayer.x&lightCullingMask.x)!=0||(rendererLayer.y&lightCullingMask.y)!=0);\n#else\nfor(int i=0;i<16;i++){if(isBitSet(float(rendererLayer.x),float(lightCullingMask.x),float(i))||isBitSet(float(rendererLayer.y),float(lightCullingMask.y),float(i))){return false;}}return true;\n#endif\n}"; // eslint-disable-line
|
|
14258
14307
|
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
|
|
14259
|
-
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
|
|
14308
|
+
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
|
|
14260
14309
|
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
|
|
14261
|
-
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
|
|
14310
|
+
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
|
|
14262
14311
|
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
|
|
14263
14312
|
var noise_cellular_2D = "#define GLSLIFY 1\nvec2 cellular(vec2 P){vec2 Pi=mod289(floor(P));vec2 Pf=fract(P);vec3 oi=vec3(-1.0,0.0,1.0);vec3 of=vec3(-0.5,0.5,1.5);vec3 px=permute(Pi.x+oi);vec3 p=permute(px.x+Pi.y+oi);vec3 ox=fract(p*K)-Ko;vec3 oy=mod7(floor(p*K))*K-Ko;vec3 dx=Pf.x+0.5+jitter*ox;vec3 dy=Pf.y-of+jitter*oy;vec3 d1=dx*dx+dy*dy;p=permute(px.y+Pi.y+oi);ox=fract(p*K)-Ko;oy=mod7(floor(p*K))*K-Ko;dx=Pf.x-0.5+jitter*ox;dy=Pf.y-of+jitter*oy;vec3 d2=dx*dx+dy*dy;p=permute(px.z+Pi.y+oi);ox=fract(p*K)-Ko;oy=mod7(floor(p*K))*K-Ko;dx=Pf.x-1.5+jitter*ox;dy=Pf.y-of+jitter*oy;vec3 d3=dx*dx+dy*dy;vec3 d1a=min(d1,d2);d2=max(d1,d2);d2=min(d2,d3);d1=min(d1a,d2);d2=max(d1a,d2);d1.xy=(d1.x<d1.y)? d1.xy : d1.yx;d1.xz=(d1.x<d1.z)? d1.xz : d1.zx;d1.yz=min(d1.yz,d2.yz);d1.y=min(d1.y,d1.z);d1.y=min(d1.y,d2.x);return sqrt(d1.xy);}"; // eslint-disable-line
|
|
14264
14313
|
var noise_cellular_2x2 = "#define GLSLIFY 1\nvec2 cellular2x2(vec2 P){vec2 Pi=mod289(floor(P));vec2 Pf=fract(P);vec4 Pfx=Pf.x+vec4(-0.5,-1.5,-0.5,-1.5);vec4 Pfy=Pf.y+vec4(-0.5,-0.5,-1.5,-1.5);vec4 p=permute(Pi.x+vec4(0.0,1.0,0.0,1.0));p=permute(p+Pi.y+vec4(0.0,0.0,1.0,1.0));vec4 ox=mod7(p)*K+Kd2;vec4 oy=mod7(floor(p*K))*K+Kd2;vec4 dx=Pfx+jitter1*ox;vec4 dy=Pfy+jitter1*oy;vec4 d=dx*dx+dy*dy;d.xy=(d.x<d.y)? d.xy : d.yx;d.xz=(d.x<d.z)? d.xz : d.zx;d.xw=(d.x<d.w)? d.xw : d.wx;d.y=min(d.y,d.z);d.y=min(d.y,d.w);return sqrt(d.xy);}"; // eslint-disable-line
|
|
@@ -14275,12 +14324,12 @@
|
|
|
14275
14324
|
var noise_simplex_3D = "#define GLSLIFY 1\nfloat simplex(vec3 v){const vec2 C=vec2(1.0/6.0,1.0/3.0);const vec4 D=vec4(0.0,0.5,1.0,2.0);vec3 i=floor(v+dot(v,C.yyy));vec3 x0=v-i+dot(i,C.xxx);vec3 g=step(x0.yzx,x0.xyz);vec3 l=1.0-g;vec3 i1=min(g.xyz,l.zxy);vec3 i2=max(g.xyz,l.zxy);vec3 x1=x0-i1+C.xxx;vec3 x2=x0-i2+C.yyy;vec3 x3=x0-D.yyy;i=mod289(i);vec4 p=permute(permute(permute(i.z+vec4(0.0,i1.z,i2.z,1.0))+i.y+vec4(0.0,i1.y,i2.y,1.0))+i.x+vec4(0.0,i1.x,i2.x,1.0));float n_=0.142857142857;vec3 ns=n_*D.wyz-D.xzx;vec4 j=p-49.0*floor(p*ns.z*ns.z);vec4 x_=floor(j*ns.z);vec4 y_=floor(j-7.0*x_);vec4 x=x_*ns.x+ns.yyyy;vec4 y=y_*ns.x+ns.yyyy;vec4 h=1.0-abs(x)-abs(y);vec4 b0=vec4(x.xy,y.xy);vec4 b1=vec4(x.zw,y.zw);vec4 s0=floor(b0)*2.0+1.0;vec4 s1=floor(b1)*2.0+1.0;vec4 sh=-step(h,vec4(0.0));vec4 a0=b0.xzyw+s0.xzyw*sh.xxyy;vec4 a1=b1.xzyw+s1.xzyw*sh.zzww;vec3 p0=vec3(a0.xy,h.x);vec3 p1=vec3(a0.zw,h.y);vec3 p2=vec3(a1.xy,h.z);vec3 p3=vec3(a1.zw,h.w);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;vec4 m=max(0.6-vec4(dot(x0,x0),dot(x1,x1),dot(x2,x2),dot(x3,x3)),0.0);m=m*m;return 42.0*dot(m*m,vec4(dot(p0,x0),dot(p1,x1),dot(p2,x2),dot(p3,x3)));}"; // eslint-disable-line
|
|
14276
14325
|
var noise_simplex_3D_grad = "#define GLSLIFY 1\nfloat simplex(vec3 v,out vec3 gradient){const vec2 C=vec2(1.0/6.0,1.0/3.0);const vec4 D=vec4(0.0,0.5,1.0,2.0);vec3 i=floor(v+dot(v,C.yyy));vec3 x0=v-i+dot(i,C.xxx);vec3 g=step(x0.yzx,x0.xyz);vec3 l=1.0-g;vec3 i1=min(g.xyz,l.zxy);vec3 i2=max(g.xyz,l.zxy);vec3 x1=x0-i1+C.xxx;vec3 x2=x0-i2+C.yyy;vec3 x3=x0-D.yyy;i=mod289(i);vec4 p=permute(permute(permute(i.z+vec4(0.0,i1.z,i2.z,1.0))+i.y+vec4(0.0,i1.y,i2.y,1.0))+i.x+vec4(0.0,i1.x,i2.x,1.0));float n_=0.142857142857;vec3 ns=n_*D.wyz-D.xzx;vec4 j=p-49.0*floor(p*ns.z*ns.z);vec4 x_=floor(j*ns.z);vec4 y_=floor(j-7.0*x_);vec4 x=x_*ns.x+ns.yyyy;vec4 y=y_*ns.x+ns.yyyy;vec4 h=1.0-abs(x)-abs(y);vec4 b0=vec4(x.xy,y.xy);vec4 b1=vec4(x.zw,y.zw);vec4 s0=floor(b0)*2.0+1.0;vec4 s1=floor(b1)*2.0+1.0;vec4 sh=-step(h,vec4(0.0));vec4 a0=b0.xzyw+s0.xzyw*sh.xxyy;vec4 a1=b1.xzyw+s1.xzyw*sh.zzww;vec3 p0=vec3(a0.xy,h.x);vec3 p1=vec3(a0.zw,h.y);vec3 p2=vec3(a1.xy,h.z);vec3 p3=vec3(a1.zw,h.w);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;vec4 m=max(0.6-vec4(dot(x0,x0),dot(x1,x1),dot(x2,x2),dot(x3,x3)),0.0);vec4 m2=m*m;vec4 m4=m2*m2;vec4 pdotx=vec4(dot(p0,x0),dot(p1,x1),dot(p2,x2),dot(p3,x3));vec4 temp=m2*m*pdotx;gradient=-8.0*(temp.x*x0+temp.y*x1+temp.z*x2+temp.w*x3);gradient+=m4.x*p0+m4.y*p1+m4.z*p2+m4.w*p3;gradient*=42.0;return 42.0*dot(m4,pdotx);}"; // eslint-disable-line
|
|
14277
14326
|
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
|
|
14278
|
-
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
|
|
14279
|
-
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
|
|
14327
|
+
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
|
|
14328
|
+
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
|
|
14280
14329
|
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
|
|
14281
14330
|
var direct_irradiance_frag_define = "#define GLSLIFY 1\n#include <ShadowFragmentDeclaration>\nvoid addDirectRadiance(vec3 incidentDirection,vec3 color,Geometry geometry,Material material,inout ReflectedLight reflectedLight){float attenuation=1.0;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nfloat clearCoatDotNL=saturate(dot(geometry.clearCoatNormal,incidentDirection));vec3 clearCoatIrradiance=clearCoatDotNL*color;reflectedLight.directSpecular+=material.clearCoat*clearCoatIrradiance*BRDF_Specular_GGX(incidentDirection,geometry.viewDir,geometry.clearCoatNormal,vec3(0.04),material.clearCoatRoughness);attenuation-=material.clearCoat*F_Schlick(geometry.clearCoatDotNV);\n#endif\nfloat dotNL=saturate(dot(geometry.normal,incidentDirection));vec3 irradiance=dotNL*color*PI;reflectedLight.directSpecular+=attenuation*irradiance*BRDF_Specular_GGX(incidentDirection,geometry.viewDir,geometry.normal,material.specularColor,material.roughness);reflectedLight.directDiffuse+=attenuation*irradiance*BRDF_Diffuse_Lambert(material.diffuseColor);}\n#ifdef SCENE_DIRECT_LIGHT_COUNT\nvoid addDirectionalDirectLightRadiance(DirectLight directionalLight,Geometry geometry,Material material,inout ReflectedLight reflectedLight){vec3 color=directionalLight.color;vec3 direction=-directionalLight.direction;addDirectRadiance(direction,color,geometry,material,reflectedLight);}\n#endif\n#ifdef SCENE_POINT_LIGHT_COUNT\nvoid addPointDirectLightRadiance(PointLight pointLight,Geometry geometry,Material material,inout ReflectedLight reflectedLight){vec3 lVector=pointLight.position-geometry.position;vec3 direction=normalize(lVector);float lightDistance=length(lVector);vec3 color=pointLight.color;color*=clamp(1.0-pow(lightDistance/pointLight.distance,4.0),0.0,1.0);addDirectRadiance(direction,color,geometry,material,reflectedLight);}\n#endif\n#ifdef SCENE_SPOT_LIGHT_COUNT\nvoid addSpotDirectLightRadiance(SpotLight spotLight,Geometry geometry,Material material,inout ReflectedLight reflectedLight){vec3 lVector=spotLight.position-geometry.position;vec3 direction=normalize(lVector);float lightDistance=length(lVector);float angleCos=dot(direction,-spotLight.direction);float spotEffect=smoothstep(spotLight.penumbraCos,spotLight.angleCos,angleCos);float decayEffect=clamp(1.0-pow(lightDistance/spotLight.distance,4.0),0.0,1.0);vec3 color=spotLight.color;color*=spotEffect*decayEffect;addDirectRadiance(direction,color,geometry,material,reflectedLight);}\n#endif\nvoid addTotalDirectRadiance(Geometry geometry,Material material,inout ReflectedLight reflectedLight){float shadowAttenuation=1.0;\n#ifdef SCENE_DIRECT_LIGHT_COUNT\nshadowAttenuation=1.0;\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nshadowAttenuation*=sampleShadowMap();int sunIndex=int(scene_ShadowInfo.z);\n#endif\nDirectLight directionalLight;for(int i=0;i<SCENE_DIRECT_LIGHT_COUNT;i++){if(isRendererCulledByLight(renderer_Layer.xy,scene_DirectLightCullingMask[i]))continue;directionalLight.color=scene_DirectLightColor[i];\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nif(i==sunIndex){directionalLight.color*=shadowAttenuation;}\n#endif\ndirectionalLight.direction=scene_DirectLightDirection[i];addDirectionalDirectLightRadiance(directionalLight,geometry,material,reflectedLight);}\n#endif\n#ifdef SCENE_POINT_LIGHT_COUNT\nPointLight pointLight;for(int i=0;i<SCENE_POINT_LIGHT_COUNT;i++){if(isRendererCulledByLight(renderer_Layer.xy,scene_PointLightCullingMask[i]))continue;pointLight.color=scene_PointLightColor[i];pointLight.position=scene_PointLightPosition[i];pointLight.distance=scene_PointLightDistance[i];addPointDirectLightRadiance(pointLight,geometry,material,reflectedLight);}\n#endif\n#ifdef SCENE_SPOT_LIGHT_COUNT\nSpotLight spotLight;for(int i=0;i<SCENE_SPOT_LIGHT_COUNT;i++){if(isRendererCulledByLight(renderer_Layer.xy,scene_SpotLightCullingMask[i]))continue;spotLight.color=scene_SpotLightColor[i];spotLight.position=scene_SpotLightPosition[i];spotLight.direction=scene_SpotLightDirection[i];spotLight.distance=scene_SpotLightDistance[i];spotLight.angleCos=scene_SpotLightAngleCos[i];spotLight.penumbraCos=scene_SpotLightPenumbraCos[i];addSpotDirectLightRadiance(spotLight,geometry,material,reflectedLight);}\n#endif\n}"; // eslint-disable-line
|
|
14282
14331
|
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
|
|
14283
|
-
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
|
|
14332
|
+
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
|
|
14284
14333
|
var PBRShaderLib = {
|
|
14285
14334
|
pbr_frag_define: pbr_frag_define,
|
|
14286
14335
|
pbr_helper: pbr_helper,
|
|
@@ -14301,7 +14350,7 @@
|
|
|
14301
14350
|
ShadowVertexDeclaration: ShadowVertexDeclaration,
|
|
14302
14351
|
ShadowVertex: ShadowVertex
|
|
14303
14352
|
};
|
|
14304
|
-
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(
|
|
14353
|
+
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
|
|
14305
14354
|
var ShaderLib = _extends$2({
|
|
14306
14355
|
common: common,
|
|
14307
14356
|
common_vert: common_vert,
|
|
@@ -15438,6 +15487,14 @@
|
|
|
15438
15487
|
};
|
|
15439
15488
|
/**
|
|
15440
15489
|
* @internal
|
|
15490
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
15491
|
+
var materials = this._materials;
|
|
15492
|
+
for(var i = 0, n = materials.length; i < n; i++){
|
|
15493
|
+
target._setMaterial(i, materials[i]);
|
|
15494
|
+
}
|
|
15495
|
+
};
|
|
15496
|
+
/**
|
|
15497
|
+
* @internal
|
|
15441
15498
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
15442
15499
|
Component.prototype._onDestroy.call(this);
|
|
15443
15500
|
this.entity.transform._updateFlagManager.removeListener(this._onTransformChanged);
|
|
@@ -15448,14 +15505,18 @@
|
|
|
15448
15505
|
(_materials_i = materials[i]) == null ? void 0 : _materials_i._addReferCount(-1);
|
|
15449
15506
|
}
|
|
15450
15507
|
};
|
|
15451
|
-
|
|
15508
|
+
/**
|
|
15509
|
+
* @internal
|
|
15510
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
15452
15511
|
var entity = this.entity;
|
|
15453
15512
|
var worldMatrix = entity.transform.worldMatrix;
|
|
15454
15513
|
this._updateTransformShaderData(context, worldMatrix);
|
|
15455
15514
|
var layer = entity.layer;
|
|
15456
15515
|
this._rendererLayer.set(layer & 65535, layer >>> 16 & 65535, 0, 0);
|
|
15457
15516
|
};
|
|
15458
|
-
|
|
15517
|
+
/**
|
|
15518
|
+
* @internal
|
|
15519
|
+
*/ _proto._updateTransformShaderData = function _updateTransformShaderData(context, worldMatrix) {
|
|
15459
15520
|
var shaderData = this.shaderData;
|
|
15460
15521
|
var virtualCamera = context.virtualCamera;
|
|
15461
15522
|
var mvMatrix = this._mvMatrix;
|
|
@@ -15474,14 +15535,22 @@
|
|
|
15474
15535
|
shaderData.setMatrix(exports.Renderer._mvInvMatrixProperty, mvInvMatrix);
|
|
15475
15536
|
shaderData.setMatrix(exports.Renderer._normalMatrixProperty, normalMatrix);
|
|
15476
15537
|
};
|
|
15477
|
-
|
|
15538
|
+
/**
|
|
15539
|
+
* @internal
|
|
15540
|
+
*/ _proto._registerEntityTransformListener = function _registerEntityTransformListener() {
|
|
15478
15541
|
this.entity.transform._updateFlagManager.addListener(this._onTransformChanged);
|
|
15479
15542
|
};
|
|
15480
|
-
|
|
15481
|
-
|
|
15543
|
+
/**
|
|
15544
|
+
* @internal
|
|
15545
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {};
|
|
15546
|
+
/**
|
|
15547
|
+
* @internal
|
|
15548
|
+
*/ _proto._render = function _render(context) {
|
|
15482
15549
|
throw "not implement";
|
|
15483
15550
|
};
|
|
15484
|
-
|
|
15551
|
+
/**
|
|
15552
|
+
* @internal
|
|
15553
|
+
*/ _proto._createInstanceMaterial = function _createInstanceMaterial(material, index) {
|
|
15485
15554
|
var insMaterial = material.clone();
|
|
15486
15555
|
insMaterial.name = insMaterial.name + "(Instance)";
|
|
15487
15556
|
material._addReferCount(-1);
|
|
@@ -15504,7 +15573,9 @@
|
|
|
15504
15573
|
materials[index] = material;
|
|
15505
15574
|
}
|
|
15506
15575
|
};
|
|
15507
|
-
|
|
15576
|
+
/**
|
|
15577
|
+
* @internal
|
|
15578
|
+
*/ _proto._onTransformChanged = function _onTransformChanged(type) {
|
|
15508
15579
|
this._dirtyUpdateFlag |= 0x1;
|
|
15509
15580
|
};
|
|
15510
15581
|
_create_class$3(Renderer1, [
|
|
@@ -15617,7 +15688,7 @@
|
|
|
15617
15688
|
ignoreClone
|
|
15618
15689
|
], exports.Renderer.prototype, "_overrideUpdate", void 0);
|
|
15619
15690
|
__decorate$1([
|
|
15620
|
-
|
|
15691
|
+
ignoreClone
|
|
15621
15692
|
], exports.Renderer.prototype, "_materials", void 0);
|
|
15622
15693
|
__decorate$1([
|
|
15623
15694
|
ignoreClone
|
|
@@ -15804,8 +15875,10 @@
|
|
|
15804
15875
|
_this = Renderer.call(this, entity) || this;
|
|
15805
15876
|
/** The mask layers the sprite mask influence to. */ _this.influenceLayers = exports.SpriteMaskLayer.Everything;
|
|
15806
15877
|
_this._sprite = null;
|
|
15807
|
-
_this.
|
|
15808
|
-
_this.
|
|
15878
|
+
_this._automaticWidth = 0;
|
|
15879
|
+
_this._automaticHeight = 0;
|
|
15880
|
+
_this._customWidth = undefined;
|
|
15881
|
+
_this._customHeight = undefined;
|
|
15809
15882
|
_this._flipX = false;
|
|
15810
15883
|
_this._flipY = false;
|
|
15811
15884
|
_this._alphaCutoff = 0.5;
|
|
@@ -15820,30 +15893,33 @@
|
|
|
15820
15893
|
/**
|
|
15821
15894
|
* @internal
|
|
15822
15895
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
15896
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
15823
15897
|
target.sprite = this._sprite;
|
|
15824
15898
|
};
|
|
15825
|
-
|
|
15826
|
-
|
|
15827
|
-
|
|
15899
|
+
/**
|
|
15900
|
+
* @internal
|
|
15901
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
15902
|
+
if (this.sprite) {
|
|
15903
|
+
SimpleSpriteAssembler.updatePositions(this);
|
|
15904
|
+
} else {
|
|
15828
15905
|
worldBounds.min.set(0, 0, 0);
|
|
15829
15906
|
worldBounds.max.set(0, 0, 0);
|
|
15830
|
-
} else {
|
|
15831
|
-
SimpleSpriteAssembler.updatePositions(this);
|
|
15832
15907
|
}
|
|
15833
15908
|
};
|
|
15834
15909
|
/**
|
|
15910
|
+
* @internal
|
|
15835
15911
|
* @inheritdoc
|
|
15836
15912
|
*/ _proto._render = function _render(context) {
|
|
15837
15913
|
var _this_sprite;
|
|
15838
15914
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
15839
15915
|
return;
|
|
15840
15916
|
}
|
|
15841
|
-
// Update position
|
|
15917
|
+
// Update position
|
|
15842
15918
|
if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
|
|
15843
15919
|
SimpleSpriteAssembler.updatePositions(this);
|
|
15844
15920
|
this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
|
|
15845
15921
|
}
|
|
15846
|
-
// Update uv
|
|
15922
|
+
// Update uv
|
|
15847
15923
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
15848
15924
|
SimpleSpriteAssembler.updateUVs(this);
|
|
15849
15925
|
this._dirtyUpdateFlag &= ~0x2;
|
|
@@ -15857,19 +15933,39 @@
|
|
|
15857
15933
|
this._maskElement = renderElement;
|
|
15858
15934
|
};
|
|
15859
15935
|
/**
|
|
15936
|
+
* @internal
|
|
15860
15937
|
* @inheritdoc
|
|
15861
15938
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
15862
|
-
var _this__sprite;
|
|
15863
15939
|
Renderer.prototype._onDestroy.call(this);
|
|
15864
|
-
|
|
15940
|
+
var sprite = this._sprite;
|
|
15941
|
+
if (sprite) {
|
|
15942
|
+
sprite._addReferCount(-1);
|
|
15943
|
+
sprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
15944
|
+
}
|
|
15865
15945
|
this._sprite = null;
|
|
15866
15946
|
this._verticesData = null;
|
|
15867
15947
|
};
|
|
15948
|
+
_proto._calDefaultSize = function _calDefaultSize() {
|
|
15949
|
+
var sprite = this._sprite;
|
|
15950
|
+
if (sprite) {
|
|
15951
|
+
this._automaticWidth = sprite.width;
|
|
15952
|
+
this._automaticHeight = sprite.height;
|
|
15953
|
+
} else {
|
|
15954
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
15955
|
+
}
|
|
15956
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
15957
|
+
};
|
|
15868
15958
|
_proto._onSpriteChange = function _onSpriteChange(type) {
|
|
15869
15959
|
switch(type){
|
|
15870
15960
|
case SpriteModifyFlags.texture:
|
|
15871
15961
|
this.shaderData.setTexture(SpriteMask._textureProperty, this.sprite.texture);
|
|
15872
15962
|
break;
|
|
15963
|
+
case SpriteModifyFlags.size:
|
|
15964
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
15965
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
15966
|
+
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
15967
|
+
}
|
|
15968
|
+
break;
|
|
15873
15969
|
case SpriteModifyFlags.region:
|
|
15874
15970
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
15875
15971
|
this._dirtyUpdateFlag |= 0x3;
|
|
@@ -15877,22 +15973,31 @@
|
|
|
15877
15973
|
case SpriteModifyFlags.atlasRegion:
|
|
15878
15974
|
this._dirtyUpdateFlag |= 0x2;
|
|
15879
15975
|
break;
|
|
15976
|
+
case SpriteModifyFlags.pivot:
|
|
15977
|
+
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
15978
|
+
break;
|
|
15880
15979
|
}
|
|
15881
15980
|
};
|
|
15882
15981
|
_create_class$3(SpriteMask, [
|
|
15883
15982
|
{
|
|
15884
15983
|
key: "width",
|
|
15885
15984
|
get: /**
|
|
15886
|
-
* Render width.
|
|
15985
|
+
* Render width (in world coordinates).
|
|
15986
|
+
*
|
|
15987
|
+
* @remarks
|
|
15988
|
+
* If width is set, return the set value,
|
|
15989
|
+
* otherwise return `SpriteMask.sprite.width`.
|
|
15887
15990
|
*/ function get() {
|
|
15888
|
-
if (this.
|
|
15889
|
-
|
|
15991
|
+
if (this._customWidth !== undefined) {
|
|
15992
|
+
return this._customWidth;
|
|
15993
|
+
} else {
|
|
15994
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
15995
|
+
return this._automaticWidth;
|
|
15890
15996
|
}
|
|
15891
|
-
return this._width;
|
|
15892
15997
|
},
|
|
15893
15998
|
set: function set(value) {
|
|
15894
|
-
if (this.
|
|
15895
|
-
this.
|
|
15999
|
+
if (this._customWidth !== value) {
|
|
16000
|
+
this._customWidth = value;
|
|
15896
16001
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
15897
16002
|
}
|
|
15898
16003
|
}
|
|
@@ -15900,16 +16005,22 @@
|
|
|
15900
16005
|
{
|
|
15901
16006
|
key: "height",
|
|
15902
16007
|
get: /**
|
|
15903
|
-
* Render height.
|
|
16008
|
+
* Render height (in world coordinates).
|
|
16009
|
+
*
|
|
16010
|
+
* @remarks
|
|
16011
|
+
* If height is set, return the set value,
|
|
16012
|
+
* otherwise return `SpriteMask.sprite.height`.
|
|
15904
16013
|
*/ function get() {
|
|
15905
|
-
if (this.
|
|
15906
|
-
|
|
16014
|
+
if (this._customHeight !== undefined) {
|
|
16015
|
+
return this._customHeight;
|
|
16016
|
+
} else {
|
|
16017
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
16018
|
+
return this._automaticHeight;
|
|
15907
16019
|
}
|
|
15908
|
-
return this._height;
|
|
15909
16020
|
},
|
|
15910
16021
|
set: function set(value) {
|
|
15911
|
-
if (this.
|
|
15912
|
-
this.
|
|
16022
|
+
if (this._customHeight !== value) {
|
|
16023
|
+
this._customHeight = value;
|
|
15913
16024
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
15914
16025
|
}
|
|
15915
16026
|
}
|
|
@@ -15952,10 +16063,14 @@
|
|
|
15952
16063
|
set: function set(value) {
|
|
15953
16064
|
var lastSprite = this._sprite;
|
|
15954
16065
|
if (lastSprite !== value) {
|
|
15955
|
-
|
|
16066
|
+
if (lastSprite) {
|
|
16067
|
+
lastSprite._addReferCount(-1);
|
|
16068
|
+
lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
16069
|
+
}
|
|
16070
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
15956
16071
|
if (value) {
|
|
16072
|
+
value._addReferCount(1);
|
|
15957
16073
|
value._updateFlagManager.addListener(this._onSpriteChange);
|
|
15958
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
15959
16074
|
this.shaderData.setTexture(SpriteMask._textureProperty, value.texture);
|
|
15960
16075
|
} else {
|
|
15961
16076
|
this.shaderData.setTexture(SpriteMask._textureProperty, null);
|
|
@@ -15995,10 +16110,16 @@
|
|
|
15995
16110
|
], SpriteMask.prototype, "_sprite", void 0);
|
|
15996
16111
|
__decorate$1([
|
|
15997
16112
|
ignoreClone
|
|
15998
|
-
], SpriteMask.prototype, "
|
|
16113
|
+
], SpriteMask.prototype, "_automaticWidth", void 0);
|
|
15999
16114
|
__decorate$1([
|
|
16000
16115
|
ignoreClone
|
|
16001
|
-
], SpriteMask.prototype, "
|
|
16116
|
+
], SpriteMask.prototype, "_automaticHeight", void 0);
|
|
16117
|
+
__decorate$1([
|
|
16118
|
+
assignmentClone
|
|
16119
|
+
], SpriteMask.prototype, "_customWidth", void 0);
|
|
16120
|
+
__decorate$1([
|
|
16121
|
+
assignmentClone
|
|
16122
|
+
], SpriteMask.prototype, "_customHeight", void 0);
|
|
16002
16123
|
__decorate$1([
|
|
16003
16124
|
assignmentClone
|
|
16004
16125
|
], SpriteMask.prototype, "_flipX", void 0);
|
|
@@ -16016,7 +16137,9 @@
|
|
|
16016
16137
|
*/ SpriteMaskUpdateFlags;
|
|
16017
16138
|
(function(SpriteMaskUpdateFlags) {
|
|
16018
16139
|
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
|
|
16019
|
-
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/**
|
|
16140
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
|
|
16141
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
|
|
16142
|
+
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** All. */ "All"] = 0x7] = "All";
|
|
16020
16143
|
})(SpriteMaskUpdateFlags || (SpriteMaskUpdateFlags = {}));
|
|
16021
16144
|
/**
|
|
16022
16145
|
* Vertex element format.
|
|
@@ -16274,7 +16397,9 @@
|
|
|
16274
16397
|
var platformBuffer = this._engine._hardwareRenderer.createPlatformBuffer(this._type, this._byteLength, this._bufferUsage);
|
|
16275
16398
|
this._platformBuffer = platformBuffer;
|
|
16276
16399
|
};
|
|
16277
|
-
|
|
16400
|
+
/**
|
|
16401
|
+
* @internal
|
|
16402
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
16278
16403
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
16279
16404
|
this._platformBuffer.destroy();
|
|
16280
16405
|
};
|
|
@@ -16448,10 +16573,11 @@
|
|
|
16448
16573
|
/**
|
|
16449
16574
|
* @internal
|
|
16450
16575
|
*/ _proto._setVertexBufferBinding = function _setVertexBufferBinding(index, binding) {
|
|
16451
|
-
|
|
16452
|
-
|
|
16453
|
-
|
|
16454
|
-
|
|
16576
|
+
var referCount = this._getReferCount();
|
|
16577
|
+
if (referCount > 0) {
|
|
16578
|
+
var _this__vertexBufferBindings_index;
|
|
16579
|
+
(_this__vertexBufferBindings_index = this._vertexBufferBindings[index]) == null ? void 0 : _this__vertexBufferBindings_index._buffer._addReferCount(-referCount);
|
|
16580
|
+
binding == null ? void 0 : binding._buffer._addReferCount(referCount);
|
|
16455
16581
|
}
|
|
16456
16582
|
this._vertexBufferBindings[index] = binding;
|
|
16457
16583
|
this._bufferStructChanged = true;
|
|
@@ -16463,11 +16589,13 @@
|
|
|
16463
16589
|
this._bufferStructChanged = false;
|
|
16464
16590
|
};
|
|
16465
16591
|
_proto._addReferCount = function _addReferCount(value) {
|
|
16592
|
+
var _this__indexBufferBinding;
|
|
16466
16593
|
GraphicsResource.prototype._addReferCount.call(this, value);
|
|
16467
16594
|
var vertexBufferBindings = this._vertexBufferBindings;
|
|
16468
16595
|
for(var i = 0, n = vertexBufferBindings.length; i < n; i++){
|
|
16469
16596
|
vertexBufferBindings[i]._buffer._addReferCount(value);
|
|
16470
16597
|
}
|
|
16598
|
+
(_this__indexBufferBinding = this._indexBufferBinding) == null ? void 0 : _this__indexBufferBinding._buffer._addReferCount(value);
|
|
16471
16599
|
};
|
|
16472
16600
|
_proto._rebuild = function _rebuild() {
|
|
16473
16601
|
this._engine._hardwareRenderer.createPlatformPrimitive(this);
|
|
@@ -16482,14 +16610,23 @@
|
|
|
16482
16610
|
this._vertexElementMap = null;
|
|
16483
16611
|
this._platformPrimitive.destroy();
|
|
16484
16612
|
};
|
|
16485
|
-
|
|
16613
|
+
/**
|
|
16614
|
+
* @internal
|
|
16615
|
+
*/ _proto._setVertexElements = function _setVertexElements(elements) {
|
|
16486
16616
|
this._clearVertexElements();
|
|
16487
16617
|
for(var i = 0, n = elements.length; i < n; i++){
|
|
16488
16618
|
this._addVertexElement(elements[i]);
|
|
16489
16619
|
}
|
|
16490
16620
|
};
|
|
16491
|
-
|
|
16621
|
+
/**
|
|
16622
|
+
* @internal
|
|
16623
|
+
*/ _proto._setIndexBufferBinding = function _setIndexBufferBinding(binding) {
|
|
16492
16624
|
var lastBinding = this._indexBufferBinding;
|
|
16625
|
+
var referCount = this._getReferCount();
|
|
16626
|
+
if (referCount > 0) {
|
|
16627
|
+
lastBinding == null ? void 0 : lastBinding.buffer._addReferCount(-referCount);
|
|
16628
|
+
binding == null ? void 0 : binding.buffer._addReferCount(referCount);
|
|
16629
|
+
}
|
|
16493
16630
|
if (binding) {
|
|
16494
16631
|
this._indexBufferBinding = binding;
|
|
16495
16632
|
this._glIndexType = BufferUtil._getGLIndexType(binding.format);
|
|
@@ -16803,6 +16940,7 @@
|
|
|
16803
16940
|
var subDataDirtyFlags = this._subDataDirtyFlags;
|
|
16804
16941
|
var blendShapeFloatStride = this._vertexElementCount * 3;
|
|
16805
16942
|
var blendShapeByteStride = blendShapeFloatStride * 4;
|
|
16943
|
+
var bufferOffset = this._bufferBindingOffset;
|
|
16806
16944
|
// @todo: should fix bug when dataChangedFlag is true
|
|
16807
16945
|
for(var i = 0, n = blendShapes.length; i < n; i++){
|
|
16808
16946
|
var dataChangedFlag = subDataDirtyFlags[i];
|
|
@@ -16820,7 +16958,7 @@
|
|
|
16820
16958
|
var offset = indexInBuffer * blendShapeFloatStride;
|
|
16821
16959
|
var storeInfo = storeInfos[i];
|
|
16822
16960
|
storeInfo || (storeInfos[i] = storeInfo = new Vector2());
|
|
16823
|
-
storeInfo.set(
|
|
16961
|
+
storeInfo.set(bufferOffset + bufferIndex, indexInBuffer * blendShapeByteStride); // BufferOffset is mesh vertexBuffer offset
|
|
16824
16962
|
var deltaPositions = endFrame.deltaPositions;
|
|
16825
16963
|
for(var j = 0; j < vertexCount; j++){
|
|
16826
16964
|
var start = offset + bufferFloatStride * j;
|
|
@@ -17622,7 +17760,9 @@
|
|
|
17622
17760
|
}
|
|
17623
17761
|
this.setTangents(tangents);
|
|
17624
17762
|
};
|
|
17625
|
-
|
|
17763
|
+
/**
|
|
17764
|
+
* @internal
|
|
17765
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
17626
17766
|
Mesh.prototype._onDestroy.call(this);
|
|
17627
17767
|
this._readable && this._releaseCache();
|
|
17628
17768
|
};
|
|
@@ -18090,25 +18230,32 @@
|
|
|
18090
18230
|
var MeshRenderer = function MeshRenderer(entity) {
|
|
18091
18231
|
var _this;
|
|
18092
18232
|
_this = Renderer.call(this, entity) || this;
|
|
18233
|
+
_this._enableVertexColor = false;
|
|
18093
18234
|
_this._onMeshChanged = _this._onMeshChanged.bind(_assert_this_initialized(_this));
|
|
18094
18235
|
return _this;
|
|
18095
18236
|
};
|
|
18096
18237
|
_inherits$2(MeshRenderer, Renderer);
|
|
18097
18238
|
var _proto = MeshRenderer.prototype;
|
|
18098
|
-
|
|
18239
|
+
/**
|
|
18240
|
+
* @internal
|
|
18241
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
18099
18242
|
Renderer.prototype._onDestroy.call(this);
|
|
18100
18243
|
var mesh = this._mesh;
|
|
18101
18244
|
if (mesh && !mesh.destroyed) {
|
|
18102
18245
|
mesh._addReferCount(-1);
|
|
18246
|
+
mesh._updateFlagManager.removeListener(this._onMeshChanged);
|
|
18103
18247
|
this._mesh = null;
|
|
18104
18248
|
}
|
|
18105
18249
|
};
|
|
18106
18250
|
/**
|
|
18107
18251
|
* @internal
|
|
18108
18252
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
18253
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
18109
18254
|
target.mesh = this._mesh;
|
|
18110
18255
|
};
|
|
18111
|
-
|
|
18256
|
+
/**
|
|
18257
|
+
* @internal
|
|
18258
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
18112
18259
|
var mesh = this._mesh;
|
|
18113
18260
|
if (mesh) {
|
|
18114
18261
|
var localBounds = mesh.bounds;
|
|
@@ -18119,7 +18266,9 @@
|
|
|
18119
18266
|
worldBounds.max.set(0, 0, 0);
|
|
18120
18267
|
}
|
|
18121
18268
|
};
|
|
18122
|
-
|
|
18269
|
+
/**
|
|
18270
|
+
* @internal
|
|
18271
|
+
*/ _proto._render = function _render(context) {
|
|
18123
18272
|
var mesh = this._mesh;
|
|
18124
18273
|
if (mesh) {
|
|
18125
18274
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
@@ -18129,7 +18278,7 @@
|
|
|
18129
18278
|
shaderData.disableMacro(MeshRenderer._uv1Macro);
|
|
18130
18279
|
shaderData.disableMacro(MeshRenderer._normalMacro);
|
|
18131
18280
|
shaderData.disableMacro(MeshRenderer._tangentMacro);
|
|
18132
|
-
shaderData.disableMacro(MeshRenderer.
|
|
18281
|
+
shaderData.disableMacro(MeshRenderer._enableVertexColorMacro);
|
|
18133
18282
|
for(var i = 0, n = vertexElements.length; i < n; i++){
|
|
18134
18283
|
switch(vertexElements[i].semantic){
|
|
18135
18284
|
case "TEXCOORD_0":
|
|
@@ -18145,7 +18294,7 @@
|
|
|
18145
18294
|
shaderData.enableMacro(MeshRenderer._tangentMacro);
|
|
18146
18295
|
break;
|
|
18147
18296
|
case "COLOR_0":
|
|
18148
|
-
shaderData.enableMacro(MeshRenderer.
|
|
18297
|
+
this._enableVertexColor && shaderData.enableMacro(MeshRenderer._enableVertexColorMacro);
|
|
18149
18298
|
break;
|
|
18150
18299
|
}
|
|
18151
18300
|
}
|
|
@@ -18196,6 +18345,20 @@
|
|
|
18196
18345
|
this._setMesh(value);
|
|
18197
18346
|
}
|
|
18198
18347
|
}
|
|
18348
|
+
},
|
|
18349
|
+
{
|
|
18350
|
+
key: "enableVertexColor",
|
|
18351
|
+
get: /**
|
|
18352
|
+
* Whether enable vertex color.
|
|
18353
|
+
*/ function get() {
|
|
18354
|
+
return this._enableVertexColor;
|
|
18355
|
+
},
|
|
18356
|
+
set: function set(value) {
|
|
18357
|
+
if (value !== this._enableVertexColor) {
|
|
18358
|
+
this._dirtyUpdateFlag |= 0x2;
|
|
18359
|
+
this._enableVertexColor = value;
|
|
18360
|
+
}
|
|
18361
|
+
}
|
|
18199
18362
|
}
|
|
18200
18363
|
]);
|
|
18201
18364
|
return MeshRenderer;
|
|
@@ -18213,7 +18376,7 @@
|
|
|
18213
18376
|
MeshRenderer._tangentMacro = ShaderMacro.getByName("RENDERER_HAS_TANGENT");
|
|
18214
18377
|
})();
|
|
18215
18378
|
(function() {
|
|
18216
|
-
MeshRenderer.
|
|
18379
|
+
MeshRenderer._enableVertexColorMacro = ShaderMacro.getByName("RENDERER_ENABLE_VERTEXCOLOR");
|
|
18217
18380
|
})();
|
|
18218
18381
|
__decorate$1([
|
|
18219
18382
|
ignoreClone
|
|
@@ -18243,7 +18406,7 @@
|
|
|
18243
18406
|
// Limit size to 256 to avoid some problem:
|
|
18244
18407
|
// 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!
|
|
18245
18408
|
// 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.
|
|
18246
|
-
maxVertexUniformVectors = Math.min(maxVertexUniformVectors,
|
|
18409
|
+
maxVertexUniformVectors = Math.min(maxVertexUniformVectors, rhi._options._maxAllowSkinUniformVectorCount);
|
|
18247
18410
|
_this._maxVertexUniformVectors = maxVertexUniformVectors;
|
|
18248
18411
|
_this._onLocalBoundsChanged = _this._onLocalBoundsChanged.bind(_assert_this_initialized(_this));
|
|
18249
18412
|
var localBounds = _this._localBounds;
|
|
@@ -18279,7 +18442,9 @@
|
|
|
18279
18442
|
}
|
|
18280
18443
|
}
|
|
18281
18444
|
};
|
|
18282
|
-
|
|
18445
|
+
/**
|
|
18446
|
+
* @internal
|
|
18447
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
18283
18448
|
var entity = this.entity;
|
|
18284
18449
|
var worldMatrix = this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
|
|
18285
18450
|
this._updateTransformShaderData(context, worldMatrix);
|
|
@@ -18305,6 +18470,7 @@
|
|
|
18305
18470
|
(_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
|
|
18306
18471
|
this._jointTexture = new Texture2D(engine, 4, jointCount, exports.TextureFormat.R32G32B32A32, false);
|
|
18307
18472
|
this._jointTexture.filterMode = exports.TextureFilterMode.Point;
|
|
18473
|
+
this._jointTexture.isGCIgnored = true;
|
|
18308
18474
|
}
|
|
18309
18475
|
shaderData.disableMacro("RENDERER_JOINTS_NUM");
|
|
18310
18476
|
shaderData.enableMacro("RENDERER_USE_JOINT_TEXTURE");
|
|
@@ -18330,14 +18496,26 @@
|
|
|
18330
18496
|
};
|
|
18331
18497
|
/**
|
|
18332
18498
|
* @internal
|
|
18499
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
18500
|
+
var _this_rootBone, _this__jointTexture;
|
|
18501
|
+
MeshRenderer.prototype._onDestroy.call(this);
|
|
18502
|
+
(_this_rootBone = this.rootBone) == null ? void 0 : _this_rootBone.transform._updateFlagManager.removeListener(this._onTransformChanged);
|
|
18503
|
+
(_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
|
|
18504
|
+
};
|
|
18505
|
+
/**
|
|
18506
|
+
* @internal
|
|
18333
18507
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
18334
18508
|
MeshRenderer.prototype._cloneTo.call(this, target);
|
|
18335
18509
|
this._blendShapeWeights && (target._blendShapeWeights = this._blendShapeWeights.slice());
|
|
18336
18510
|
};
|
|
18337
|
-
|
|
18511
|
+
/**
|
|
18512
|
+
* @internal
|
|
18513
|
+
*/ _proto._registerEntityTransformListener = function _registerEntityTransformListener() {
|
|
18338
18514
|
// Cancel register listener to entity transform.
|
|
18339
18515
|
};
|
|
18340
|
-
|
|
18516
|
+
/**
|
|
18517
|
+
* @internal
|
|
18518
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
18341
18519
|
if (this._rootBone) {
|
|
18342
18520
|
var localBounds = this._localBounds;
|
|
18343
18521
|
var worldMatrix = this._rootBone.transform.worldMatrix;
|
|
@@ -19779,14 +19957,17 @@
|
|
|
19779
19957
|
_proto._createMesh = function _createMesh(engine, index) {
|
|
19780
19958
|
var MAX_VERTEX_COUNT = Basic2DBatcher.MAX_VERTEX_COUNT;
|
|
19781
19959
|
var mesh = new BufferMesh(engine, "BufferMesh" + index);
|
|
19960
|
+
mesh.isGCIgnored = true;
|
|
19782
19961
|
var vertexElements = [];
|
|
19783
19962
|
var vertexStride = this.createVertexElements(vertexElements);
|
|
19784
19963
|
// vertices
|
|
19785
|
-
this._vertexBuffers[index] = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * 4 * vertexStride, exports.BufferUsage.Dynamic);
|
|
19964
|
+
var vertexBuffer = this._vertexBuffers[index] = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * 4 * vertexStride, exports.BufferUsage.Dynamic);
|
|
19965
|
+
vertexBuffer.isGCIgnored = true;
|
|
19786
19966
|
// indices
|
|
19787
|
-
this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 3, exports.BufferUsage.Dynamic);
|
|
19788
|
-
|
|
19789
|
-
mesh.
|
|
19967
|
+
var indiceBuffer = this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 2 * 3, exports.BufferUsage.Dynamic);
|
|
19968
|
+
indiceBuffer.isGCIgnored = true;
|
|
19969
|
+
mesh.setVertexBufferBinding(vertexBuffer, vertexStride);
|
|
19970
|
+
mesh.setIndexBufferBinding(indiceBuffer, exports.IndexFormat.UInt16);
|
|
19790
19971
|
mesh.setVertexElements(vertexElements);
|
|
19791
19972
|
return mesh;
|
|
19792
19973
|
};
|
|
@@ -20062,6 +20243,12 @@
|
|
|
20062
20243
|
var _proto = Sky.prototype;
|
|
20063
20244
|
/**
|
|
20064
20245
|
* @internal
|
|
20246
|
+
*/ _proto.destroy = function destroy() {
|
|
20247
|
+
this.mesh = null;
|
|
20248
|
+
this.material = null;
|
|
20249
|
+
};
|
|
20250
|
+
/**
|
|
20251
|
+
* @internal
|
|
20065
20252
|
*/ _proto._render = function _render(context) {
|
|
20066
20253
|
var _this = this, material = _this.material, mesh = _this.mesh;
|
|
20067
20254
|
if (!material) {
|
|
@@ -20102,6 +20289,40 @@
|
|
|
20102
20289
|
rhi.drawPrimitive(mesh, mesh.subMesh, program);
|
|
20103
20290
|
cameraShaderData.setMatrix(RenderContext.vpMatrixProperty, originViewProjMatrix);
|
|
20104
20291
|
};
|
|
20292
|
+
_create_class$3(Sky, [
|
|
20293
|
+
{
|
|
20294
|
+
key: "material",
|
|
20295
|
+
get: /**
|
|
20296
|
+
* Material of the sky.
|
|
20297
|
+
*/ function get() {
|
|
20298
|
+
return this._material;
|
|
20299
|
+
},
|
|
20300
|
+
set: function set(value) {
|
|
20301
|
+
if (this._material !== value) {
|
|
20302
|
+
var _this__material;
|
|
20303
|
+
value == null ? void 0 : value._addReferCount(1);
|
|
20304
|
+
(_this__material = this._material) == null ? void 0 : _this__material._addReferCount(-1);
|
|
20305
|
+
this._material = value;
|
|
20306
|
+
}
|
|
20307
|
+
}
|
|
20308
|
+
},
|
|
20309
|
+
{
|
|
20310
|
+
key: "mesh",
|
|
20311
|
+
get: /**
|
|
20312
|
+
* Mesh of the sky.
|
|
20313
|
+
*/ function get() {
|
|
20314
|
+
return this._mesh;
|
|
20315
|
+
},
|
|
20316
|
+
set: function set(value) {
|
|
20317
|
+
if (this._mesh !== value) {
|
|
20318
|
+
var _this__mesh;
|
|
20319
|
+
value == null ? void 0 : value._addReferCount(1);
|
|
20320
|
+
(_this__mesh = this._mesh) == null ? void 0 : _this__mesh._addReferCount(-1);
|
|
20321
|
+
this._mesh = value;
|
|
20322
|
+
}
|
|
20323
|
+
}
|
|
20324
|
+
}
|
|
20325
|
+
]);
|
|
20105
20326
|
return Sky;
|
|
20106
20327
|
}();
|
|
20107
20328
|
(function() {
|
|
@@ -20136,9 +20357,19 @@
|
|
|
20136
20357
|
var _proto = Background.prototype;
|
|
20137
20358
|
/**
|
|
20138
20359
|
* @internal
|
|
20360
|
+
*/ _proto.destroy = function destroy() {
|
|
20361
|
+
this._mesh._addReferCount(-1);
|
|
20362
|
+
this._mesh = null;
|
|
20363
|
+
this.texture = null;
|
|
20364
|
+
this.solidColor = null;
|
|
20365
|
+
this.sky.destroy();
|
|
20366
|
+
};
|
|
20367
|
+
/**
|
|
20368
|
+
* @internal
|
|
20139
20369
|
* Standalone for CanvasRenderer plugin.
|
|
20140
20370
|
*/ _proto._initMesh = function _initMesh(engine) {
|
|
20141
20371
|
this._mesh = this._createPlane(engine);
|
|
20372
|
+
this._mesh._addReferCount(1);
|
|
20142
20373
|
};
|
|
20143
20374
|
/**
|
|
20144
20375
|
* @internal
|
|
@@ -20210,6 +20441,9 @@
|
|
|
20210
20441
|
},
|
|
20211
20442
|
set: function set(value) {
|
|
20212
20443
|
if (this._texture !== value) {
|
|
20444
|
+
var _this__texture;
|
|
20445
|
+
value == null ? void 0 : value._addReferCount(1);
|
|
20446
|
+
(_this__texture = this._texture) == null ? void 0 : _this__texture._addReferCount(-1);
|
|
20213
20447
|
this._texture = value;
|
|
20214
20448
|
this._engine._backgroundTextureMaterial.shaderData.setTexture("material_BaseTexture", value);
|
|
20215
20449
|
}
|
|
@@ -20683,7 +20917,7 @@
|
|
|
20683
20917
|
var sunLightIndex = lightManager._getSunLightIndex();
|
|
20684
20918
|
if (sunLightIndex !== -1) {
|
|
20685
20919
|
var sunlight = lightManager._directLights.get(sunLightIndex);
|
|
20686
|
-
shaderData.setColor(Scene._sunlightColorProperty, sunlight.
|
|
20920
|
+
shaderData.setColor(Scene._sunlightColorProperty, sunlight._getLightIntensityColor());
|
|
20687
20921
|
shaderData.setVector3(Scene._sunlightDirectionProperty, sunlight.direction);
|
|
20688
20922
|
this._sunLight = sunlight;
|
|
20689
20923
|
}
|
|
@@ -20714,6 +20948,7 @@
|
|
|
20714
20948
|
this._rootEntities[0].destroy();
|
|
20715
20949
|
}
|
|
20716
20950
|
this._activeCameras.length = 0;
|
|
20951
|
+
this.background.destroy();
|
|
20717
20952
|
this.shaderData._addReferCount(-1);
|
|
20718
20953
|
};
|
|
20719
20954
|
_proto._addToRootEntityList = function _addToRootEntityList(index, rootEntity) {
|
|
@@ -21146,7 +21381,7 @@
|
|
|
21146
21381
|
_this._spriteDefaultMaterial = _this._createSpriteMaterial();
|
|
21147
21382
|
_this._spriteMaskDefaultMaterial = _this._createSpriteMaskMaterial();
|
|
21148
21383
|
_this._textDefaultFont = Font.createFromOS(_assert_this_initialized(_this), "Arial");
|
|
21149
|
-
_this._textDefaultFont.isGCIgnored =
|
|
21384
|
+
_this._textDefaultFont.isGCIgnored = true;
|
|
21150
21385
|
_this.inputManager = new InputManager(_assert_this_initialized(_this));
|
|
21151
21386
|
_this._initMagentaTextures(hardwareRenderer);
|
|
21152
21387
|
if (!hardwareRenderer.canIUse(exports.GLCapabilityType.depthTexture)) {
|
|
@@ -21157,6 +21392,7 @@
|
|
|
21157
21392
|
_this._depthTexture2D = depthTexture2D;
|
|
21158
21393
|
}
|
|
21159
21394
|
var magentaMaterial = new Material(_assert_this_initialized(_this), Shader.find("unlit"));
|
|
21395
|
+
magentaMaterial.isGCIgnored = true;
|
|
21160
21396
|
magentaMaterial.shaderData.setColor("material_BaseColor", new Color(1.0, 0.0, 1.01, 1.0));
|
|
21161
21397
|
_this._magentaMaterial = magentaMaterial;
|
|
21162
21398
|
var backgroundTextureMaterial = new Material(_assert_this_initialized(_this), Shader.find("background-texture"));
|
|
@@ -21383,7 +21619,9 @@
|
|
|
21383
21619
|
this._magentaTexture2DArray = magentaTexture2DArray;
|
|
21384
21620
|
}
|
|
21385
21621
|
};
|
|
21386
|
-
|
|
21622
|
+
/**
|
|
21623
|
+
* @internal
|
|
21624
|
+
*/ _proto._initialize = function _initialize(configuration) {
|
|
21387
21625
|
var _this = this;
|
|
21388
21626
|
var physics = configuration.physics;
|
|
21389
21627
|
if (physics) {
|
|
@@ -21704,7 +21942,9 @@
|
|
|
21704
21942
|
this._entity._removeScript(this);
|
|
21705
21943
|
this._waitHandlingInValid = false;
|
|
21706
21944
|
};
|
|
21707
|
-
|
|
21945
|
+
/**
|
|
21946
|
+
* @internal
|
|
21947
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
21708
21948
|
Component.prototype._onDestroy.call(this);
|
|
21709
21949
|
this._engine._componentsManager.addPendingDestroyScript(this);
|
|
21710
21950
|
};
|
|
@@ -22648,7 +22888,7 @@
|
|
|
22648
22888
|
// prepare render target
|
|
22649
22889
|
var renderTarget = this._getAvailableRenderTarget();
|
|
22650
22890
|
// @todo: shouldn't set viewport and scissor in activeRenderTarget
|
|
22651
|
-
rhi.activeRenderTarget(renderTarget,
|
|
22891
|
+
rhi.activeRenderTarget(renderTarget, CascadedShadowCasterPass._viewport, 0);
|
|
22652
22892
|
if (this._supportDepthTexture) {
|
|
22653
22893
|
rhi.clearRenderTarget(engine, exports.CameraClearFlags.Depth, null);
|
|
22654
22894
|
} else {
|
|
@@ -22770,11 +23010,13 @@
|
|
|
22770
23010
|
if (engine._hardwareRenderer._isWebGL2) {
|
|
22771
23011
|
depthTexture.depthCompareFunction = exports.TextureDepthCompareFunction.Less;
|
|
22772
23012
|
}
|
|
23013
|
+
renderTarget == null ? void 0 : renderTarget._addReferCount(-1);
|
|
22773
23014
|
if (this._supportDepthTexture) {
|
|
22774
23015
|
renderTarget = this._renderTargets = new RenderTarget(engine, width, height, null, depthTexture);
|
|
22775
23016
|
} else {
|
|
22776
23017
|
renderTarget = this._renderTargets = new RenderTarget(engine, width, height, depthTexture);
|
|
22777
23018
|
}
|
|
23019
|
+
renderTarget._addReferCount(1);
|
|
22778
23020
|
}
|
|
22779
23021
|
return renderTarget;
|
|
22780
23022
|
};
|
|
@@ -22797,7 +23039,12 @@
|
|
|
22797
23039
|
var height = shadowCascades == exports.ShadowCascadesMode.TwoCascades ? shadowTileResolution : shadowTileResolution * 2;
|
|
22798
23040
|
this._shadowMapSize.set(1.0 / width, 1.0 / height, width, height);
|
|
22799
23041
|
}
|
|
22800
|
-
this._renderTargets
|
|
23042
|
+
var renderTargets = this._renderTargets;
|
|
23043
|
+
if (renderTargets) {
|
|
23044
|
+
renderTargets._addReferCount(-1);
|
|
23045
|
+
renderTargets.destroy();
|
|
23046
|
+
this._renderTargets = null;
|
|
23047
|
+
}
|
|
22801
23048
|
var viewportOffset = this._viewportOffsets;
|
|
22802
23049
|
var shadowTileResolution1 = this._shadowTileResolution;
|
|
22803
23050
|
switch(shadowCascades){
|
|
@@ -22853,6 +23100,9 @@
|
|
|
22853
23100
|
(function() {
|
|
22854
23101
|
CascadedShadowCasterPass._cascadesSplitDistance = new Array(CascadedShadowCasterPass._maxCascades + 1);
|
|
22855
23102
|
})();
|
|
23103
|
+
(function() {
|
|
23104
|
+
CascadedShadowCasterPass._viewport = new Vector4(0, 0, 1, 1);
|
|
23105
|
+
})();
|
|
22856
23106
|
(function() {
|
|
22857
23107
|
CascadedShadowCasterPass._clearColor = new Color$1(1, 1, 1, 1);
|
|
22858
23108
|
})();
|
|
@@ -23377,6 +23627,7 @@
|
|
|
23377
23627
|
this.entity.scene._detachRenderCamera(this);
|
|
23378
23628
|
};
|
|
23379
23629
|
/**
|
|
23630
|
+
* @internal
|
|
23380
23631
|
* @inheritdoc
|
|
23381
23632
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
23382
23633
|
var _this__renderPipeline;
|
|
@@ -23582,7 +23833,12 @@
|
|
|
23582
23833
|
return this._renderTarget;
|
|
23583
23834
|
},
|
|
23584
23835
|
set: function set(value) {
|
|
23585
|
-
this._renderTarget
|
|
23836
|
+
if (this._renderTarget !== value) {
|
|
23837
|
+
var _this__renderTarget;
|
|
23838
|
+
value == null ? void 0 : value._addReferCount(1);
|
|
23839
|
+
(_this__renderTarget = this._renderTarget) == null ? void 0 : _this__renderTarget._addReferCount(-1);
|
|
23840
|
+
this._renderTarget = value;
|
|
23841
|
+
}
|
|
23586
23842
|
}
|
|
23587
23843
|
}
|
|
23588
23844
|
]);
|
|
@@ -24561,6 +24817,7 @@
|
|
|
24561
24817
|
_this = PBRBaseMaterial.call(this, engine, Shader.find("pbr")) || this;
|
|
24562
24818
|
_this.shaderData.setFloat(PBRMaterial._metallicProp, 1);
|
|
24563
24819
|
_this.shaderData.setFloat(PBRMaterial._roughnessProp, 1);
|
|
24820
|
+
_this.shaderData.setFloat(PBRMaterial._iorProp, 1.5);
|
|
24564
24821
|
return _this;
|
|
24565
24822
|
}
|
|
24566
24823
|
var _proto = PBRMaterial.prototype;
|
|
@@ -24572,10 +24829,23 @@
|
|
|
24572
24829
|
return dest;
|
|
24573
24830
|
};
|
|
24574
24831
|
_create_class$3(PBRMaterial, [
|
|
24832
|
+
{
|
|
24833
|
+
key: "ior",
|
|
24834
|
+
get: /**
|
|
24835
|
+
* Index Of Refraction.
|
|
24836
|
+
* @defaultValue `1.5`
|
|
24837
|
+
*/ function get() {
|
|
24838
|
+
return this.shaderData.getFloat(PBRMaterial._iorProp);
|
|
24839
|
+
},
|
|
24840
|
+
set: function set(v) {
|
|
24841
|
+
this.shaderData.setFloat(PBRMaterial._iorProp, Math.max(v, 0));
|
|
24842
|
+
}
|
|
24843
|
+
},
|
|
24575
24844
|
{
|
|
24576
24845
|
key: "metallic",
|
|
24577
24846
|
get: /**
|
|
24578
|
-
* Metallic
|
|
24847
|
+
* Metallic.
|
|
24848
|
+
* @defaultValue `1.0`
|
|
24579
24849
|
*/ function get() {
|
|
24580
24850
|
return this.shaderData.getFloat(PBRMaterial._metallicProp);
|
|
24581
24851
|
},
|
|
@@ -24586,7 +24856,8 @@
|
|
|
24586
24856
|
{
|
|
24587
24857
|
key: "roughness",
|
|
24588
24858
|
get: /**
|
|
24589
|
-
* Roughness
|
|
24859
|
+
* Roughness. default 1.0.
|
|
24860
|
+
* @defaultValue `1.0`
|
|
24590
24861
|
*/ function get() {
|
|
24591
24862
|
return this.shaderData.getFloat(PBRMaterial._roughnessProp);
|
|
24592
24863
|
},
|
|
@@ -24623,6 +24894,9 @@
|
|
|
24623
24894
|
(function() {
|
|
24624
24895
|
PBRMaterial._roughnessMetallicTextureProp = ShaderProperty.getByName("material_RoughnessMetallicTexture");
|
|
24625
24896
|
})();
|
|
24897
|
+
(function() {
|
|
24898
|
+
PBRMaterial._iorProp = Shader.getPropertyByName("material_IOR");
|
|
24899
|
+
})();
|
|
24626
24900
|
/**
|
|
24627
24901
|
* PBR (Specular-Glossiness Workflow) Material.
|
|
24628
24902
|
*/ var PBRSpecularMaterial = /*#__PURE__*/ function(PBRBaseMaterial) {
|
|
@@ -24830,9 +25104,18 @@
|
|
|
24830
25104
|
* @internal
|
|
24831
25105
|
*/ _proto._addSprite = function _addSprite(sprite) {
|
|
24832
25106
|
this._spriteNamesToIndex[sprite.name] = this._sprites.push(sprite) - 1;
|
|
25107
|
+
sprite._atlas = this;
|
|
25108
|
+
sprite.isGCIgnored = true;
|
|
24833
25109
|
};
|
|
24834
|
-
|
|
25110
|
+
/**
|
|
25111
|
+
* @internal
|
|
25112
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
24835
25113
|
ReferResource.prototype._onDestroy.call(this);
|
|
25114
|
+
var _this = this, sprites = _this._sprites;
|
|
25115
|
+
for(var i = 0, n = sprites.length; i < n; i++){
|
|
25116
|
+
sprites[i].destroy();
|
|
25117
|
+
}
|
|
25118
|
+
sprites.length = 0;
|
|
24836
25119
|
this._sprites = null;
|
|
24837
25120
|
this._spriteNamesToIndex = null;
|
|
24838
25121
|
};
|
|
@@ -24876,8 +25159,10 @@
|
|
|
24876
25159
|
if (name === void 0) name = null;
|
|
24877
25160
|
var _this;
|
|
24878
25161
|
_this = ReferResource.call(this, engine) || this;
|
|
24879
|
-
_this.
|
|
24880
|
-
_this.
|
|
25162
|
+
_this._automaticWidth = 0;
|
|
25163
|
+
_this._automaticHeight = 0;
|
|
25164
|
+
_this._customWidth = undefined;
|
|
25165
|
+
_this._customHeight = undefined;
|
|
24881
25166
|
_this._positions = [
|
|
24882
25167
|
new Vector2(),
|
|
24883
25168
|
new Vector2(),
|
|
@@ -24898,7 +25183,7 @@
|
|
|
24898
25183
|
_this._region = new Rect(0, 0, 1, 1);
|
|
24899
25184
|
_this._pivot = new Vector2(0.5, 0.5);
|
|
24900
25185
|
_this._border = new Vector4(0, 0, 0, 0);
|
|
24901
|
-
_this._dirtyUpdateFlag =
|
|
25186
|
+
_this._dirtyUpdateFlag = 0x7;
|
|
24902
25187
|
/** @internal */ _this._updateFlagManager = new UpdateFlagManager();
|
|
24903
25188
|
_this._texture = texture;
|
|
24904
25189
|
region && _this._region.copyFrom(region);
|
|
@@ -24937,17 +25222,41 @@
|
|
|
24937
25222
|
this._dirtyUpdateFlag & 0x1 && this._updatePositions();
|
|
24938
25223
|
return this._bounds;
|
|
24939
25224
|
};
|
|
24940
|
-
|
|
25225
|
+
/**
|
|
25226
|
+
* @internal
|
|
25227
|
+
*/ _proto._addReferCount = function _addReferCount(value) {
|
|
25228
|
+
var _this__atlas;
|
|
25229
|
+
ReferResource.prototype._addReferCount.call(this, value);
|
|
25230
|
+
(_this__atlas = this._atlas) == null ? void 0 : _this__atlas._addReferCount(value);
|
|
25231
|
+
};
|
|
25232
|
+
/**
|
|
25233
|
+
* @internal
|
|
25234
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
24941
25235
|
ReferResource.prototype._onDestroy.call(this);
|
|
25236
|
+
this._positions.length = 0;
|
|
25237
|
+
this._positions = null;
|
|
25238
|
+
this._uvs.length = 0;
|
|
25239
|
+
this._uvs = null;
|
|
25240
|
+
this._atlasRegion = null;
|
|
25241
|
+
this._atlasRegionOffset = null;
|
|
25242
|
+
this._region = null;
|
|
25243
|
+
this._pivot = null;
|
|
25244
|
+
this._border = null;
|
|
25245
|
+
this._bounds = null;
|
|
25246
|
+
this._atlas = null;
|
|
24942
25247
|
this._texture = null;
|
|
25248
|
+
this._updateFlagManager = null;
|
|
24943
25249
|
};
|
|
24944
25250
|
_proto._calDefaultSize = function _calDefaultSize() {
|
|
24945
25251
|
if (this._texture) {
|
|
24946
25252
|
var _this = this, _texture = _this._texture, _atlasRegion = _this._atlasRegion, _atlasRegionOffset = _this._atlasRegionOffset, _region = _this._region;
|
|
24947
25253
|
var pixelsPerUnitReciprocal = 1.0 / Engine._pixelsPerUnit;
|
|
24948
|
-
this.
|
|
24949
|
-
this.
|
|
25254
|
+
this._automaticWidth = _texture.width * _atlasRegion.width / (1 - _atlasRegionOffset.x - _atlasRegionOffset.z) * _region.width * pixelsPerUnitReciprocal;
|
|
25255
|
+
this._automaticHeight = _texture.height * _atlasRegion.height / (1 - _atlasRegionOffset.y - _atlasRegionOffset.w) * _region.height * pixelsPerUnitReciprocal;
|
|
25256
|
+
} else {
|
|
25257
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
24950
25258
|
}
|
|
25259
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
24951
25260
|
};
|
|
24952
25261
|
_proto._updatePositions = function _updatePositions() {
|
|
24953
25262
|
var blank = this._atlasRegionOffset;
|
|
@@ -25001,11 +25310,16 @@
|
|
|
25001
25310
|
};
|
|
25002
25311
|
_proto._dispatchSpriteChange = function _dispatchSpriteChange(type) {
|
|
25003
25312
|
switch(type){
|
|
25313
|
+
case SpriteModifyFlags.texture:
|
|
25314
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
25315
|
+
break;
|
|
25004
25316
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
25005
25317
|
case SpriteModifyFlags.region:
|
|
25006
|
-
this._dirtyUpdateFlag |=
|
|
25318
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
25007
25319
|
break;
|
|
25008
25320
|
case SpriteModifyFlags.atlasRegion:
|
|
25321
|
+
this._dirtyUpdateFlag |= 0x4 | 0x2;
|
|
25322
|
+
break;
|
|
25009
25323
|
case SpriteModifyFlags.border:
|
|
25010
25324
|
this._dirtyUpdateFlag |= 0x2;
|
|
25011
25325
|
break;
|
|
@@ -25024,7 +25338,9 @@
|
|
|
25024
25338
|
if (this._texture !== value) {
|
|
25025
25339
|
this._texture = value;
|
|
25026
25340
|
this._dispatchSpriteChange(SpriteModifyFlags.texture);
|
|
25027
|
-
(this.
|
|
25341
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
25342
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
25343
|
+
}
|
|
25028
25344
|
}
|
|
25029
25345
|
}
|
|
25030
25346
|
},
|
|
@@ -25032,13 +25348,21 @@
|
|
|
25032
25348
|
key: "width",
|
|
25033
25349
|
get: /**
|
|
25034
25350
|
* The width of the sprite (in world coordinates).
|
|
25351
|
+
*
|
|
25352
|
+
* @remarks
|
|
25353
|
+
* If width is set, return the set value,
|
|
25354
|
+
* otherwise return the width calculated according to `Texture.width`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
|
|
25035
25355
|
*/ function get() {
|
|
25036
|
-
this.
|
|
25037
|
-
|
|
25356
|
+
if (this._customWidth !== undefined) {
|
|
25357
|
+
return this._customWidth;
|
|
25358
|
+
} else {
|
|
25359
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
25360
|
+
return this._automaticWidth;
|
|
25361
|
+
}
|
|
25038
25362
|
},
|
|
25039
25363
|
set: function set(value) {
|
|
25040
|
-
if (this.
|
|
25041
|
-
this.
|
|
25364
|
+
if (this._customWidth !== value) {
|
|
25365
|
+
this._customWidth = value;
|
|
25042
25366
|
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
25043
25367
|
}
|
|
25044
25368
|
}
|
|
@@ -25047,13 +25371,21 @@
|
|
|
25047
25371
|
key: "height",
|
|
25048
25372
|
get: /**
|
|
25049
25373
|
* The height of the sprite (in world coordinates).
|
|
25374
|
+
*
|
|
25375
|
+
* @remarks
|
|
25376
|
+
* If height is set, return the set value,
|
|
25377
|
+
* otherwise return the height calculated according to `Texture.height`, `Sprite.region`, `Sprite.atlasRegion`, `Sprite.atlasRegionOffset` and `Engine._pixelsPerUnit`.
|
|
25050
25378
|
*/ function get() {
|
|
25051
|
-
this.
|
|
25052
|
-
|
|
25379
|
+
if (this._customHeight !== undefined) {
|
|
25380
|
+
return this._customHeight;
|
|
25381
|
+
} else {
|
|
25382
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
25383
|
+
return this._automaticHeight;
|
|
25384
|
+
}
|
|
25053
25385
|
},
|
|
25054
25386
|
set: function set(value) {
|
|
25055
|
-
if (this.
|
|
25056
|
-
this.
|
|
25387
|
+
if (this._customHeight !== value) {
|
|
25388
|
+
this._customHeight = value;
|
|
25057
25389
|
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
25058
25390
|
}
|
|
25059
25391
|
}
|
|
@@ -25083,7 +25415,9 @@
|
|
|
25083
25415
|
var y = MathUtil$1.clamp(value.y, 0, 1);
|
|
25084
25416
|
this._atlasRegion.set(x, y, MathUtil$1.clamp(value.width, 0, 1 - x), MathUtil$1.clamp(value.height, 0, 1 - y));
|
|
25085
25417
|
this._dispatchSpriteChange(SpriteModifyFlags.atlasRegion);
|
|
25086
|
-
(this.
|
|
25418
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
25419
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
25420
|
+
}
|
|
25087
25421
|
}
|
|
25088
25422
|
},
|
|
25089
25423
|
{
|
|
@@ -25098,7 +25432,9 @@
|
|
|
25098
25432
|
var y = MathUtil$1.clamp(value.y, 0, 1);
|
|
25099
25433
|
this._atlasRegionOffset.set(x, y, MathUtil$1.clamp(value.z, 0, 1 - x), MathUtil$1.clamp(value.w, 0, 1 - y));
|
|
25100
25434
|
this._dispatchSpriteChange(SpriteModifyFlags.atlasRegionOffset);
|
|
25101
|
-
(this.
|
|
25435
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
25436
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
25437
|
+
}
|
|
25102
25438
|
}
|
|
25103
25439
|
},
|
|
25104
25440
|
{
|
|
@@ -25114,7 +25450,9 @@
|
|
|
25114
25450
|
var y = MathUtil$1.clamp(value.y, 0, 1);
|
|
25115
25451
|
region.set(x, y, MathUtil$1.clamp(value.width, 0, 1 - x), MathUtil$1.clamp(value.height, 0, 1 - y));
|
|
25116
25452
|
this._dispatchSpriteChange(SpriteModifyFlags.region);
|
|
25117
|
-
(this.
|
|
25453
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
25454
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
25455
|
+
}
|
|
25118
25456
|
}
|
|
25119
25457
|
},
|
|
25120
25458
|
{
|
|
@@ -25164,7 +25502,8 @@
|
|
|
25164
25502
|
(function(SpriteUpdateFlags) {
|
|
25165
25503
|
SpriteUpdateFlags[SpriteUpdateFlags["positions"] = 0x1] = "positions";
|
|
25166
25504
|
SpriteUpdateFlags[SpriteUpdateFlags["uvs"] = 0x2] = "uvs";
|
|
25167
|
-
SpriteUpdateFlags[SpriteUpdateFlags["
|
|
25505
|
+
SpriteUpdateFlags[SpriteUpdateFlags["automaticSize"] = 0x4] = "automaticSize";
|
|
25506
|
+
SpriteUpdateFlags[SpriteUpdateFlags["all"] = 0x7] = "all";
|
|
25168
25507
|
})(SpriteUpdateFlags || (SpriteUpdateFlags = {}));
|
|
25169
25508
|
var _SlicedSpriteAssembler;
|
|
25170
25509
|
var SlicedSpriteAssembler = (_SlicedSpriteAssembler = /*#__PURE__*/ function() {
|
|
@@ -25652,8 +25991,10 @@
|
|
|
25652
25991
|
_this._tiledAdaptiveThreshold = 0.5;
|
|
25653
25992
|
_this._color = new Color$1(1, 1, 1, 1);
|
|
25654
25993
|
_this._sprite = null;
|
|
25655
|
-
_this.
|
|
25656
|
-
_this.
|
|
25994
|
+
_this._automaticWidth = 0;
|
|
25995
|
+
_this._automaticHeight = 0;
|
|
25996
|
+
_this._customWidth = undefined;
|
|
25997
|
+
_this._customHeight = undefined;
|
|
25657
25998
|
_this._flipX = false;
|
|
25658
25999
|
_this._flipY = false;
|
|
25659
26000
|
_this._maskLayer = exports.SpriteMaskLayer.Layer0;
|
|
@@ -25669,38 +26010,45 @@
|
|
|
25669
26010
|
/**
|
|
25670
26011
|
* @internal
|
|
25671
26012
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
26013
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
25672
26014
|
target._assembler.resetData(target);
|
|
25673
26015
|
target.sprite = this._sprite;
|
|
26016
|
+
target.drawMode = this._drawMode;
|
|
25674
26017
|
};
|
|
25675
|
-
|
|
26018
|
+
/**
|
|
26019
|
+
* @internal
|
|
26020
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
25676
26021
|
// @ts-ignore
|
|
25677
26022
|
this._updateTransformShaderData(context, Matrix._identity);
|
|
25678
26023
|
};
|
|
25679
|
-
|
|
25680
|
-
|
|
25681
|
-
|
|
26024
|
+
/**
|
|
26025
|
+
* @internal
|
|
26026
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
26027
|
+
if (this.sprite) {
|
|
26028
|
+
this._assembler.updatePositions(this);
|
|
26029
|
+
} else {
|
|
25682
26030
|
worldBounds.min.set(0, 0, 0);
|
|
25683
26031
|
worldBounds.max.set(0, 0, 0);
|
|
25684
|
-
} else {
|
|
25685
|
-
this._assembler.updatePositions(this);
|
|
25686
26032
|
}
|
|
25687
26033
|
};
|
|
25688
|
-
|
|
26034
|
+
/**
|
|
26035
|
+
* @internal
|
|
26036
|
+
*/ _proto._render = function _render(context) {
|
|
25689
26037
|
var _this_sprite;
|
|
25690
26038
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
25691
26039
|
return;
|
|
25692
26040
|
}
|
|
25693
|
-
// Update position
|
|
26041
|
+
// Update position
|
|
25694
26042
|
if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
|
|
25695
26043
|
this._assembler.updatePositions(this);
|
|
25696
26044
|
this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
|
|
25697
26045
|
}
|
|
25698
|
-
// Update uv
|
|
26046
|
+
// Update uv
|
|
25699
26047
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
25700
26048
|
this._assembler.updateUVs(this);
|
|
25701
26049
|
this._dirtyUpdateFlag &= ~0x2;
|
|
25702
26050
|
}
|
|
25703
|
-
// Push
|
|
26051
|
+
// Push primitive
|
|
25704
26052
|
var material = this.getMaterial();
|
|
25705
26053
|
var texture = this.sprite.texture;
|
|
25706
26054
|
var renderData = this._engine._spriteRenderDataPool.getFromPool();
|
|
@@ -25710,14 +26058,27 @@
|
|
|
25710
26058
|
/**
|
|
25711
26059
|
* @internal
|
|
25712
26060
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
25713
|
-
var _this__sprite;
|
|
25714
26061
|
Renderer.prototype._onDestroy.call(this);
|
|
25715
|
-
|
|
26062
|
+
var sprite = this._sprite;
|
|
26063
|
+
if (sprite) {
|
|
26064
|
+
sprite._addReferCount(-1);
|
|
26065
|
+
sprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
26066
|
+
}
|
|
25716
26067
|
this._color = null;
|
|
25717
26068
|
this._sprite = null;
|
|
25718
26069
|
this._assembler = null;
|
|
25719
26070
|
this._verticesData = null;
|
|
25720
26071
|
};
|
|
26072
|
+
_proto._calDefaultSize = function _calDefaultSize() {
|
|
26073
|
+
var sprite = this._sprite;
|
|
26074
|
+
if (sprite) {
|
|
26075
|
+
this._automaticWidth = sprite.width;
|
|
26076
|
+
this._automaticHeight = sprite.height;
|
|
26077
|
+
} else {
|
|
26078
|
+
this._automaticWidth = this._automaticHeight = 0;
|
|
26079
|
+
}
|
|
26080
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
26081
|
+
};
|
|
25721
26082
|
_proto._updateStencilState = function _updateStencilState() {
|
|
25722
26083
|
// Update stencil.
|
|
25723
26084
|
var material = this.getInstanceMaterial();
|
|
@@ -25744,22 +26105,21 @@
|
|
|
25744
26105
|
break;
|
|
25745
26106
|
case SpriteModifyFlags.size:
|
|
25746
26107
|
var _this = this, drawMode = _this._drawMode;
|
|
25747
|
-
|
|
26108
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
26109
|
+
if (this._drawMode === exports.SpriteDrawMode.Sliced) {
|
|
25748
26110
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
25749
26111
|
} else if (drawMode === exports.SpriteDrawMode.Tiled) {
|
|
25750
26112
|
this._dirtyUpdateFlag |= 0x3;
|
|
25751
26113
|
} else {
|
|
25752
26114
|
// When the width and height of `SpriteRenderer` are `undefined`,
|
|
25753
26115
|
// the `size` of `Sprite` will affect the position of `SpriteRenderer`.
|
|
25754
|
-
if (this.
|
|
26116
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
25755
26117
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
25756
26118
|
}
|
|
25757
26119
|
}
|
|
25758
26120
|
break;
|
|
25759
26121
|
case SpriteModifyFlags.border:
|
|
25760
|
-
|
|
25761
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
25762
|
-
}
|
|
26122
|
+
this._drawMode === exports.SpriteDrawMode.Sliced && (this._dirtyUpdateFlag |= 0x3);
|
|
25763
26123
|
break;
|
|
25764
26124
|
case SpriteModifyFlags.region:
|
|
25765
26125
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
@@ -25843,10 +26203,14 @@
|
|
|
25843
26203
|
set: function set(value) {
|
|
25844
26204
|
var lastSprite = this._sprite;
|
|
25845
26205
|
if (lastSprite !== value) {
|
|
25846
|
-
|
|
26206
|
+
if (lastSprite) {
|
|
26207
|
+
lastSprite._addReferCount(-1);
|
|
26208
|
+
lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
26209
|
+
}
|
|
26210
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
25847
26211
|
if (value) {
|
|
26212
|
+
value._addReferCount(1);
|
|
25848
26213
|
value._updateFlagManager.addListener(this._onSpriteChange);
|
|
25849
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
25850
26214
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, value.texture);
|
|
25851
26215
|
} else {
|
|
25852
26216
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, null);
|
|
@@ -25871,16 +26235,22 @@
|
|
|
25871
26235
|
{
|
|
25872
26236
|
key: "width",
|
|
25873
26237
|
get: /**
|
|
25874
|
-
* Render width.
|
|
26238
|
+
* Render width (in world coordinates).
|
|
26239
|
+
*
|
|
26240
|
+
* @remarks
|
|
26241
|
+
* If width is set, return the set value,
|
|
26242
|
+
* otherwise return `SpriteRenderer.sprite.width`.
|
|
25875
26243
|
*/ function get() {
|
|
25876
|
-
|
|
25877
|
-
|
|
26244
|
+
if (this._customWidth !== undefined) {
|
|
26245
|
+
return this._customWidth;
|
|
26246
|
+
} else {
|
|
26247
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
26248
|
+
return this._automaticWidth;
|
|
26249
|
+
}
|
|
25878
26250
|
},
|
|
25879
26251
|
set: function set(value) {
|
|
25880
|
-
|
|
25881
|
-
|
|
25882
|
-
if (this._width !== value) {
|
|
25883
|
-
this._width = value;
|
|
26252
|
+
if (this._customWidth !== value) {
|
|
26253
|
+
this._customWidth = value;
|
|
25884
26254
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
25885
26255
|
}
|
|
25886
26256
|
}
|
|
@@ -25888,16 +26258,22 @@
|
|
|
25888
26258
|
{
|
|
25889
26259
|
key: "height",
|
|
25890
26260
|
get: /**
|
|
25891
|
-
* Render height.
|
|
26261
|
+
* Render height (in world coordinates).
|
|
26262
|
+
*
|
|
26263
|
+
* @remarks
|
|
26264
|
+
* If height is set, return the set value,
|
|
26265
|
+
* otherwise return `SpriteRenderer.sprite.height`.
|
|
25892
26266
|
*/ function get() {
|
|
25893
|
-
|
|
25894
|
-
|
|
26267
|
+
if (this._customHeight !== undefined) {
|
|
26268
|
+
return this._customHeight;
|
|
26269
|
+
} else {
|
|
26270
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
26271
|
+
return this._automaticHeight;
|
|
26272
|
+
}
|
|
25895
26273
|
},
|
|
25896
26274
|
set: function set(value) {
|
|
25897
|
-
|
|
25898
|
-
|
|
25899
|
-
if (this._height !== value) {
|
|
25900
|
-
this._height = value;
|
|
26275
|
+
if (this._customHeight !== value) {
|
|
26276
|
+
this._customHeight = value;
|
|
25901
26277
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
25902
26278
|
}
|
|
25903
26279
|
}
|
|
@@ -25984,10 +26360,16 @@
|
|
|
25984
26360
|
], SpriteRenderer.prototype, "_sprite", void 0);
|
|
25985
26361
|
__decorate$1([
|
|
25986
26362
|
ignoreClone
|
|
25987
|
-
], SpriteRenderer.prototype, "
|
|
26363
|
+
], SpriteRenderer.prototype, "_automaticWidth", void 0);
|
|
25988
26364
|
__decorate$1([
|
|
25989
26365
|
ignoreClone
|
|
25990
|
-
], SpriteRenderer.prototype, "
|
|
26366
|
+
], SpriteRenderer.prototype, "_automaticHeight", void 0);
|
|
26367
|
+
__decorate$1([
|
|
26368
|
+
assignmentClone
|
|
26369
|
+
], SpriteRenderer.prototype, "_customWidth", void 0);
|
|
26370
|
+
__decorate$1([
|
|
26371
|
+
assignmentClone
|
|
26372
|
+
], SpriteRenderer.prototype, "_customHeight", void 0);
|
|
25991
26373
|
__decorate$1([
|
|
25992
26374
|
assignmentClone
|
|
25993
26375
|
], SpriteRenderer.prototype, "_flipX", void 0);
|
|
@@ -26008,7 +26390,9 @@
|
|
|
26008
26390
|
*/ SpriteRendererUpdateFlags;
|
|
26009
26391
|
(function(SpriteRendererUpdateFlags) {
|
|
26010
26392
|
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
|
|
26011
|
-
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/**
|
|
26393
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** WorldVolume and UV . */ "RenderData"] = 0x3] = "RenderData";
|
|
26394
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** Automatic Size. */ "AutomaticSize"] = 0x4] = "AutomaticSize";
|
|
26395
|
+
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** All. */ "All"] = 0x7] = "All";
|
|
26012
26396
|
})(SpriteRendererUpdateFlags || (SpriteRendererUpdateFlags = {}));
|
|
26013
26397
|
/**
|
|
26014
26398
|
* @internal
|
|
@@ -26093,7 +26477,9 @@
|
|
|
26093
26477
|
this._font._addReferCount(1);
|
|
26094
26478
|
this.setMaterial(engine._spriteDefaultMaterial);
|
|
26095
26479
|
};
|
|
26096
|
-
|
|
26480
|
+
/**
|
|
26481
|
+
* @internal
|
|
26482
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
26097
26483
|
Renderer.prototype._onDestroy.call(this);
|
|
26098
26484
|
// Clear render data.
|
|
26099
26485
|
var charRenderDatas = this._charRenderDatas;
|
|
@@ -26110,6 +26496,7 @@
|
|
|
26110
26496
|
/**
|
|
26111
26497
|
* @internal
|
|
26112
26498
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
26499
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
26113
26500
|
target.font = this._font;
|
|
26114
26501
|
target._subFont = this._subFont;
|
|
26115
26502
|
};
|
|
@@ -26128,14 +26515,20 @@
|
|
|
26128
26515
|
*/ _proto._setDirtyFlagFalse = function _setDirtyFlagFalse(type) {
|
|
26129
26516
|
this._dirtyFlag &= ~type;
|
|
26130
26517
|
};
|
|
26131
|
-
|
|
26518
|
+
/**
|
|
26519
|
+
* @internal
|
|
26520
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
26132
26521
|
// @ts-ignore
|
|
26133
26522
|
this._updateTransformShaderData(context, Matrix._identity);
|
|
26134
26523
|
};
|
|
26135
|
-
|
|
26524
|
+
/**
|
|
26525
|
+
* @internal
|
|
26526
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
26136
26527
|
BoundingBox.transform(this._localBounds, this._entity.transform.worldMatrix, worldBounds);
|
|
26137
26528
|
};
|
|
26138
|
-
|
|
26529
|
+
/**
|
|
26530
|
+
* @internal
|
|
26531
|
+
*/ _proto._render = function _render(context) {
|
|
26139
26532
|
if (this._text === "" || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0) {
|
|
26140
26533
|
return;
|
|
26141
26534
|
}
|
|
@@ -26230,8 +26623,6 @@
|
|
|
26230
26623
|
_proto._updateLocalData = function _updateLocalData() {
|
|
26231
26624
|
var _this = this, color = _this.color, horizontalAlignment = _this.horizontalAlignment, verticalAlignment = _this.verticalAlignment, charRenderDatas = _this._charRenderDatas;
|
|
26232
26625
|
var _this__localBounds = this._localBounds, min = _this__localBounds.min, max = _this__localBounds.max;
|
|
26233
|
-
min.set(0, 0, 0);
|
|
26234
|
-
max.set(0, 0, 0);
|
|
26235
26626
|
var _pixelsPerUnit = Engine._pixelsPerUnit;
|
|
26236
26627
|
var pixelsPerUnitReciprocal = 1.0 / _pixelsPerUnit;
|
|
26237
26628
|
var charFont = this._subFont;
|
|
@@ -26258,54 +26649,65 @@
|
|
|
26258
26649
|
break;
|
|
26259
26650
|
}
|
|
26260
26651
|
var renderDataCount = 0;
|
|
26652
|
+
var firstLine = -1;
|
|
26261
26653
|
var minX = Number.MAX_SAFE_INTEGER;
|
|
26262
26654
|
var minY = Number.MAX_SAFE_INTEGER;
|
|
26263
26655
|
var maxX = Number.MIN_SAFE_INTEGER;
|
|
26264
26656
|
var maxY = Number.MIN_SAFE_INTEGER;
|
|
26265
|
-
var lastLineIndex = linesLen - 1;
|
|
26266
26657
|
for(var i = 0; i < linesLen; ++i){
|
|
26267
|
-
var line = lines[i];
|
|
26268
26658
|
var lineWidth = lineWidths[i];
|
|
26269
|
-
|
|
26270
|
-
|
|
26271
|
-
|
|
26272
|
-
|
|
26273
|
-
|
|
26274
|
-
|
|
26275
|
-
|
|
26276
|
-
|
|
26277
|
-
|
|
26278
|
-
|
|
26279
|
-
|
|
26280
|
-
|
|
26281
|
-
|
|
26282
|
-
|
|
26283
|
-
|
|
26284
|
-
|
|
26285
|
-
|
|
26286
|
-
|
|
26287
|
-
|
|
26288
|
-
|
|
26289
|
-
|
|
26290
|
-
|
|
26291
|
-
|
|
26292
|
-
|
|
26293
|
-
|
|
26294
|
-
|
|
26295
|
-
|
|
26296
|
-
|
|
26297
|
-
|
|
26298
|
-
|
|
26299
|
-
|
|
26300
|
-
|
|
26301
|
-
|
|
26302
|
-
|
|
26303
|
-
|
|
26659
|
+
if (lineWidth > 0) {
|
|
26660
|
+
var line = lines[i];
|
|
26661
|
+
var startX = 0;
|
|
26662
|
+
var firstRow = -1;
|
|
26663
|
+
if (firstLine < 0) {
|
|
26664
|
+
firstLine = i;
|
|
26665
|
+
}
|
|
26666
|
+
switch(horizontalAlignment){
|
|
26667
|
+
case exports.TextHorizontalAlignment.Left:
|
|
26668
|
+
startX = -halfRendererWidth;
|
|
26669
|
+
break;
|
|
26670
|
+
case exports.TextHorizontalAlignment.Center:
|
|
26671
|
+
startX = -lineWidth * 0.5;
|
|
26672
|
+
break;
|
|
26673
|
+
case exports.TextHorizontalAlignment.Right:
|
|
26674
|
+
startX = halfRendererWidth - lineWidth;
|
|
26675
|
+
break;
|
|
26676
|
+
}
|
|
26677
|
+
for(var j = 0, n = line.length; j < n; ++j){
|
|
26678
|
+
var char = line[j];
|
|
26679
|
+
var charInfo = charFont._getCharInfo(char);
|
|
26680
|
+
if (charInfo.h > 0) {
|
|
26681
|
+
var _charRenderDatas, _ref;
|
|
26682
|
+
firstRow < 0 && (firstRow = j);
|
|
26683
|
+
var charRenderData = (_charRenderDatas = charRenderDatas)[_ref = renderDataCount++] || (_charRenderDatas[_ref] = charRenderDataPool.get());
|
|
26684
|
+
var renderData = charRenderData.renderData, localPositions = charRenderData.localPositions;
|
|
26685
|
+
charRenderData.texture = charFont._getTextureByIndex(charInfo.index);
|
|
26686
|
+
renderData.color = color;
|
|
26687
|
+
renderData.uvs = charInfo.uvs;
|
|
26688
|
+
var w = charInfo.w, ascent = charInfo.ascent, descent = charInfo.descent;
|
|
26689
|
+
var left = startX * pixelsPerUnitReciprocal;
|
|
26690
|
+
var right = (startX + w) * pixelsPerUnitReciprocal;
|
|
26691
|
+
var top = (startY + ascent) * pixelsPerUnitReciprocal;
|
|
26692
|
+
var bottom = (startY - descent + 1) * pixelsPerUnitReciprocal;
|
|
26693
|
+
localPositions.set(left, top, right, bottom);
|
|
26694
|
+
i === firstLine && (maxY = Math.max(maxY, top));
|
|
26695
|
+
minY = Math.min(minY, bottom);
|
|
26696
|
+
j === firstRow && (minX = Math.min(minX, left));
|
|
26697
|
+
maxX = Math.max(maxX, right);
|
|
26698
|
+
}
|
|
26699
|
+
startX += charInfo.xAdvance;
|
|
26700
|
+
}
|
|
26304
26701
|
}
|
|
26305
26702
|
startY -= lineHeight;
|
|
26306
26703
|
}
|
|
26307
|
-
|
|
26308
|
-
|
|
26704
|
+
if (firstLine < 0) {
|
|
26705
|
+
min.set(0, 0, 0);
|
|
26706
|
+
max.set(0, 0, 0);
|
|
26707
|
+
} else {
|
|
26708
|
+
min.set(minX, minY, 0);
|
|
26709
|
+
max.set(maxX, maxY, 0);
|
|
26710
|
+
}
|
|
26309
26711
|
// Revert excess render data to pool.
|
|
26310
26712
|
var lastRenderDataCount = charRenderDatas.length;
|
|
26311
26713
|
if (lastRenderDataCount > renderDataCount) {
|
|
@@ -26318,7 +26720,9 @@
|
|
|
26318
26720
|
return a.texture.instanceId - b.texture.instanceId;
|
|
26319
26721
|
});
|
|
26320
26722
|
};
|
|
26321
|
-
|
|
26723
|
+
/**
|
|
26724
|
+
* @internal
|
|
26725
|
+
*/ _proto._onTransformChanged = function _onTransformChanged(bit) {
|
|
26322
26726
|
Renderer.prototype._onTransformChanged.call(this, bit);
|
|
26323
26727
|
this._setDirtyFlagTrue(0x4 | 0x8);
|
|
26324
26728
|
};
|
|
@@ -26635,7 +27039,6 @@
|
|
|
26635
27039
|
* @internal
|
|
26636
27040
|
*/ var AnimationCurveOwner = /*#__PURE__*/ function() {
|
|
26637
27041
|
function AnimationCurveOwner(target, type, property, cureType) {
|
|
26638
|
-
this.crossCurveMark = 0;
|
|
26639
27042
|
this.hasSavedDefaultValue = false;
|
|
26640
27043
|
this.baseEvaluateData = {
|
|
26641
27044
|
curKeyframeIndex: 0,
|
|
@@ -26829,6 +27232,11 @@
|
|
|
26829
27232
|
return BlendShapeWeightsAnimationCurveOwnerAssembler;
|
|
26830
27233
|
}();
|
|
26831
27234
|
AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights", BlendShapeWeightsAnimationCurveOwnerAssembler);
|
|
27235
|
+
/**
|
|
27236
|
+
* @internal
|
|
27237
|
+
*/ var AnimationCurveLayerOwner = function AnimationCurveLayerOwner() {
|
|
27238
|
+
this.crossCurveMark = 0;
|
|
27239
|
+
};
|
|
26832
27240
|
/**
|
|
26833
27241
|
* Associate AnimationCurve and the Entity
|
|
26834
27242
|
*/ var AnimationClipCurveBinding = /*#__PURE__*/ function() {
|
|
@@ -26846,6 +27254,13 @@
|
|
|
26846
27254
|
};
|
|
26847
27255
|
/**
|
|
26848
27256
|
* @internal
|
|
27257
|
+
*/ _proto._createCurveLayerOwner = function _createCurveLayerOwner(owner) {
|
|
27258
|
+
var layerOwner = new AnimationCurveLayerOwner();
|
|
27259
|
+
layerOwner.curveOwner = owner;
|
|
27260
|
+
return layerOwner;
|
|
27261
|
+
};
|
|
27262
|
+
/**
|
|
27263
|
+
* @internal
|
|
26849
27264
|
*/ _proto._getTempCurveOwner = function _getTempCurveOwner(entity) {
|
|
26850
27265
|
var instanceId = entity.instanceId;
|
|
26851
27266
|
if (!this._tempCurveOwner[instanceId]) {
|
|
@@ -27977,12 +28392,14 @@
|
|
|
27977
28392
|
* @internal
|
|
27978
28393
|
*/ var AnimatorLayerData = /*#__PURE__*/ function() {
|
|
27979
28394
|
var AnimatorLayerData = function AnimatorLayerData() {
|
|
28395
|
+
this.curveOwnerPool = Object.create(null);
|
|
27980
28396
|
this.animatorStateDataMap = {};
|
|
27981
28397
|
this.srcPlayData = new AnimatorStatePlayData();
|
|
27982
28398
|
this.destPlayData = new AnimatorStatePlayData();
|
|
27983
28399
|
this.layerState = LayerState.Standby;
|
|
27984
28400
|
this.crossCurveMark = 0;
|
|
27985
28401
|
this.manuallyTransition = new AnimatorStateTransition();
|
|
28402
|
+
this.crossOwnerLayerDataCollection = [];
|
|
27986
28403
|
};
|
|
27987
28404
|
var _proto = AnimatorLayerData.prototype;
|
|
27988
28405
|
_proto.switchPlayData = function switchPlayData() {
|
|
@@ -27996,7 +28413,7 @@
|
|
|
27996
28413
|
/**
|
|
27997
28414
|
* @internal
|
|
27998
28415
|
*/ var AnimatorStateData = function AnimatorStateData() {
|
|
27999
|
-
this.
|
|
28416
|
+
this.curveLayerOwner = [];
|
|
28000
28417
|
this.eventHandlers = [];
|
|
28001
28418
|
};
|
|
28002
28419
|
/**
|
|
@@ -28008,8 +28425,7 @@
|
|
|
28008
28425
|
/** Culling mode of this Animator. */ _this.cullingMode = exports.AnimatorCullingMode.None;
|
|
28009
28426
|
/** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0;
|
|
28010
28427
|
_this._animatorLayersData = [];
|
|
28011
|
-
_this.
|
|
28012
|
-
_this._animationCurveOwners = [];
|
|
28428
|
+
_this._curveOwnerPool = Object.create(null);
|
|
28013
28429
|
_this._animationEventHandlerPool = new ClassPool(AnimationEventHandler);
|
|
28014
28430
|
_this._tempAnimatorStateInfo = {
|
|
28015
28431
|
layerIndex: -1,
|
|
@@ -28042,7 +28458,6 @@
|
|
|
28042
28458
|
return;
|
|
28043
28459
|
}
|
|
28044
28460
|
var animatorLayerData = this._getAnimatorLayerData(stateInfo.layerIndex);
|
|
28045
|
-
//TODO CM: Not consider same stateName, but different animation
|
|
28046
28461
|
var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData);
|
|
28047
28462
|
this._preparePlay(animatorLayerData, state, animatorStateData);
|
|
28048
28463
|
animatorLayerData.layerState = LayerState.Playing;
|
|
@@ -28133,7 +28548,7 @@
|
|
|
28133
28548
|
/**
|
|
28134
28549
|
* @internal
|
|
28135
28550
|
*/ _proto._reset = function _reset() {
|
|
28136
|
-
var _this = this, animationCurveOwners = _this.
|
|
28551
|
+
var _this = this, animationCurveOwners = _this._curveOwnerPool;
|
|
28137
28552
|
for(var instanceId in animationCurveOwners){
|
|
28138
28553
|
var propertyOwners = animationCurveOwners[instanceId];
|
|
28139
28554
|
for(var property in propertyOwners){
|
|
@@ -28142,8 +28557,7 @@
|
|
|
28142
28557
|
}
|
|
28143
28558
|
}
|
|
28144
28559
|
this._animatorLayersData.length = 0;
|
|
28145
|
-
this.
|
|
28146
|
-
this._animationCurveOwners.length = 0;
|
|
28560
|
+
this._curveOwnerPool = {};
|
|
28147
28561
|
this._animationEventHandlerPool.resetPool();
|
|
28148
28562
|
if (this._controllerUpdateFlag) {
|
|
28149
28563
|
this._controllerUpdateFlag.flag = false;
|
|
@@ -28171,10 +28585,10 @@
|
|
|
28171
28585
|
return stateInfo;
|
|
28172
28586
|
};
|
|
28173
28587
|
_proto._saveDefaultValues = function _saveDefaultValues(stateData) {
|
|
28174
|
-
var
|
|
28175
|
-
for(var i =
|
|
28176
|
-
var
|
|
28177
|
-
(
|
|
28588
|
+
var curveLayerOwner = stateData.curveLayerOwner;
|
|
28589
|
+
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
28590
|
+
var _curveLayerOwner_i;
|
|
28591
|
+
(_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner.saveDefaultValue();
|
|
28178
28592
|
}
|
|
28179
28593
|
};
|
|
28180
28594
|
_proto._getAnimatorStateData = function _getAnimatorStateData(stateName, animatorState, animatorLayerData) {
|
|
@@ -28183,25 +28597,32 @@
|
|
|
28183
28597
|
if (!animatorStateData) {
|
|
28184
28598
|
animatorStateData = new AnimatorStateData();
|
|
28185
28599
|
animatorStateDataMap[stateName] = animatorStateData;
|
|
28186
|
-
this._saveAnimatorStateData(animatorState, animatorStateData);
|
|
28600
|
+
this._saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData);
|
|
28187
28601
|
this._saveAnimatorEventHandlers(animatorState, animatorStateData);
|
|
28188
28602
|
}
|
|
28189
28603
|
return animatorStateData;
|
|
28190
28604
|
};
|
|
28191
|
-
_proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData) {
|
|
28192
|
-
var _this = this, entity = _this.entity,
|
|
28193
|
-
var
|
|
28605
|
+
_proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData) {
|
|
28606
|
+
var _this = this, entity = _this.entity, curveOwnerPool = _this._curveOwnerPool;
|
|
28607
|
+
var curveLayerOwner = animatorStateData.curveLayerOwner;
|
|
28608
|
+
var layerCurveOwnerPool = animatorLayerData.curveOwnerPool;
|
|
28194
28609
|
var _animatorState_clip = animatorState.clip, curves = _animatorState_clip._curveBindings;
|
|
28195
28610
|
for(var i = curves.length - 1; i >= 0; i--){
|
|
28196
28611
|
var curve = curves[i];
|
|
28197
28612
|
var targetEntity = curve.relativePath === "" ? entity : entity.findByPath(curve.relativePath);
|
|
28198
28613
|
if (targetEntity) {
|
|
28614
|
+
var _curveOwnerPool, _instanceId, _propertyOwners, _property, _layerCurveOwnerPool, _instanceId1, _layerPropertyOwners, _property1;
|
|
28199
28615
|
var property = curve.property;
|
|
28200
28616
|
var instanceId = targetEntity.instanceId;
|
|
28201
|
-
|
|
28202
|
-
|
|
28617
|
+
// Get owner
|
|
28618
|
+
var propertyOwners = (_curveOwnerPool = curveOwnerPool)[_instanceId = instanceId] || (_curveOwnerPool[_instanceId] = Object.create(null));
|
|
28619
|
+
var owner = (_propertyOwners = propertyOwners)[_property = property] || (_propertyOwners[_property] = curve._createCurveOwner(targetEntity));
|
|
28620
|
+
// Get layer owner
|
|
28621
|
+
var layerPropertyOwners = (_layerCurveOwnerPool = layerCurveOwnerPool)[_instanceId1 = instanceId] || (_layerCurveOwnerPool[_instanceId1] = Object.create(null));
|
|
28622
|
+
var layerOwner = (_layerPropertyOwners = layerPropertyOwners)[_property1 = property] || (_layerPropertyOwners[_property1] = curve._createCurveLayerOwner(owner));
|
|
28623
|
+
curveLayerOwner[i] = layerOwner;
|
|
28203
28624
|
} else {
|
|
28204
|
-
|
|
28625
|
+
curveLayerOwner[i] = null;
|
|
28205
28626
|
console.warn("The entity don't have the child entity which path is " + curve.relativePath + ".");
|
|
28206
28627
|
}
|
|
28207
28628
|
}
|
|
@@ -28229,65 +28650,61 @@
|
|
|
28229
28650
|
};
|
|
28230
28651
|
_proto._clearCrossData = function _clearCrossData(animatorLayerData) {
|
|
28231
28652
|
animatorLayerData.crossCurveMark++;
|
|
28232
|
-
|
|
28653
|
+
animatorLayerData.crossOwnerLayerDataCollection.length = 0;
|
|
28233
28654
|
};
|
|
28234
|
-
_proto.
|
|
28235
|
-
|
|
28236
|
-
|
|
28237
|
-
|
|
28655
|
+
_proto._addCrossOwner = function _addCrossOwner(animatorLayerData, layerOwner, curCurveIndex, nextCurveIndex) {
|
|
28656
|
+
layerOwner.crossSrcCurveIndex = curCurveIndex;
|
|
28657
|
+
layerOwner.crossDestCurveIndex = nextCurveIndex;
|
|
28658
|
+
animatorLayerData.crossOwnerLayerDataCollection.push(layerOwner);
|
|
28238
28659
|
};
|
|
28239
28660
|
_proto._prepareCrossFading = function _prepareCrossFading(animatorLayerData) {
|
|
28240
|
-
var crossCurveData = this._crossOwnerCollection;
|
|
28241
|
-
var crossCurveMark = animatorLayerData.crossCurveMark;
|
|
28242
28661
|
// Add src cross curve data.
|
|
28243
|
-
this._prepareSrcCrossData(
|
|
28662
|
+
this._prepareSrcCrossData(animatorLayerData, false);
|
|
28244
28663
|
// Add dest cross curve data.
|
|
28245
|
-
this._prepareDestCrossData(
|
|
28664
|
+
this._prepareDestCrossData(animatorLayerData, false);
|
|
28246
28665
|
};
|
|
28247
28666
|
_proto._prepareStandbyCrossFading = function _prepareStandbyCrossFading(animatorLayerData) {
|
|
28248
|
-
var crossOwnerCollection = this._crossOwnerCollection;
|
|
28249
|
-
var srcPlayData = animatorLayerData.srcPlayData, crossCurveMark = animatorLayerData.crossCurveMark;
|
|
28250
28667
|
// Standby have two sub state, one is never play, one is finished, never play srcPlayData.state is null.
|
|
28251
|
-
srcPlayData.state && this._prepareSrcCrossData(
|
|
28668
|
+
animatorLayerData.srcPlayData.state && this._prepareSrcCrossData(animatorLayerData, true);
|
|
28252
28669
|
// Add dest cross curve data.
|
|
28253
|
-
this._prepareDestCrossData(
|
|
28670
|
+
this._prepareDestCrossData(animatorLayerData, true);
|
|
28254
28671
|
};
|
|
28255
28672
|
_proto._prepareFixedPoseCrossFading = function _prepareFixedPoseCrossFading(animatorLayerData) {
|
|
28256
|
-
var
|
|
28673
|
+
var crossOwnerLayerDataCollection = animatorLayerData.crossOwnerLayerDataCollection;
|
|
28257
28674
|
// Save current cross curve data owner fixed pose.
|
|
28258
|
-
for(var i =
|
|
28259
|
-
var
|
|
28260
|
-
|
|
28675
|
+
for(var i = crossOwnerLayerDataCollection.length - 1; i >= 0; i--){
|
|
28676
|
+
var layerOwner = crossOwnerLayerDataCollection[i];
|
|
28677
|
+
if (!layerOwner) continue;
|
|
28678
|
+
layerOwner.curveOwner.saveFixedPoseValue();
|
|
28261
28679
|
// Reset destCurveIndex When fixed pose crossFading again.
|
|
28262
|
-
|
|
28680
|
+
layerOwner.crossDestCurveIndex = -1;
|
|
28263
28681
|
}
|
|
28264
28682
|
// prepare dest AnimatorState cross data.
|
|
28265
|
-
this._prepareDestCrossData(
|
|
28266
|
-
};
|
|
28267
|
-
_proto._prepareSrcCrossData = function _prepareSrcCrossData(
|
|
28268
|
-
var
|
|
28269
|
-
for(var i =
|
|
28270
|
-
var
|
|
28271
|
-
if (!
|
|
28272
|
-
|
|
28273
|
-
|
|
28274
|
-
|
|
28275
|
-
|
|
28276
|
-
|
|
28277
|
-
|
|
28278
|
-
|
|
28279
|
-
var
|
|
28280
|
-
|
|
28281
|
-
|
|
28282
|
-
if (
|
|
28283
|
-
|
|
28284
|
-
crossCurveData[owner.crossCurveDataIndex].crossDestCurveIndex = i;
|
|
28683
|
+
this._prepareDestCrossData(animatorLayerData, true);
|
|
28684
|
+
};
|
|
28685
|
+
_proto._prepareSrcCrossData = function _prepareSrcCrossData(animatorLayerData, saveFixed) {
|
|
28686
|
+
var curveLayerOwner = animatorLayerData.srcPlayData.stateData.curveLayerOwner;
|
|
28687
|
+
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
28688
|
+
var layerOwner = curveLayerOwner[i];
|
|
28689
|
+
if (!layerOwner) continue;
|
|
28690
|
+
layerOwner.crossCurveMark = animatorLayerData.crossCurveMark;
|
|
28691
|
+
saveFixed && layerOwner.curveOwner.saveFixedPoseValue();
|
|
28692
|
+
this._addCrossOwner(animatorLayerData, layerOwner, i, -1);
|
|
28693
|
+
}
|
|
28694
|
+
};
|
|
28695
|
+
_proto._prepareDestCrossData = function _prepareDestCrossData(animatorLayerData, saveFixed) {
|
|
28696
|
+
var curveLayerOwner = animatorLayerData.destPlayData.stateData.curveLayerOwner;
|
|
28697
|
+
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
28698
|
+
var layerOwner = curveLayerOwner[i];
|
|
28699
|
+
if (!layerOwner) continue;
|
|
28700
|
+
if (layerOwner.crossCurveMark === animatorLayerData.crossCurveMark) {
|
|
28701
|
+
layerOwner.crossDestCurveIndex = i;
|
|
28285
28702
|
} else {
|
|
28703
|
+
var owner = layerOwner.curveOwner;
|
|
28286
28704
|
owner.saveDefaultValue();
|
|
28287
28705
|
saveFixed && owner.saveFixedPoseValue();
|
|
28288
|
-
|
|
28289
|
-
|
|
28290
|
-
this._addCrossCurveData(crossCurveData, owner, -1, i);
|
|
28706
|
+
layerOwner.crossCurveMark = animatorLayerData.crossCurveMark;
|
|
28707
|
+
this._addCrossOwner(animatorLayerData, layerOwner, -1, i);
|
|
28291
28708
|
}
|
|
28292
28709
|
}
|
|
28293
28710
|
};
|
|
@@ -28317,7 +28734,7 @@
|
|
|
28317
28734
|
}
|
|
28318
28735
|
};
|
|
28319
28736
|
_proto._updatePlayingState = function _updatePlayingState(playData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
28320
|
-
var _playData_stateData = playData.stateData,
|
|
28737
|
+
var _playData_stateData = playData.stateData, curveLayerOwner = _playData_stateData.curveLayerOwner, eventHandlers = _playData_stateData.eventHandlers;
|
|
28321
28738
|
var state = playData.state, lastPlayState = playData.playState, lastClipTime = playData.clipTime;
|
|
28322
28739
|
var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
|
|
28323
28740
|
playData.update(this.speed < 0);
|
|
@@ -28327,8 +28744,8 @@
|
|
|
28327
28744
|
var clipTime = playData.clipTime, playState = playData.playState;
|
|
28328
28745
|
eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, clipTime);
|
|
28329
28746
|
for(var i = curveBindings.length - 1; i >= 0; i--){
|
|
28330
|
-
var
|
|
28331
|
-
|
|
28747
|
+
var _curveLayerOwner_i;
|
|
28748
|
+
(_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner.evaluateAndApplyValue(curveBindings[i].curve, clipTime, weight, additive);
|
|
28332
28749
|
}
|
|
28333
28750
|
playData.frameTime += state.speed * delta;
|
|
28334
28751
|
if (playState === AnimatorStatePlayState.Finished) {
|
|
@@ -28344,7 +28761,7 @@
|
|
|
28344
28761
|
}
|
|
28345
28762
|
};
|
|
28346
28763
|
_proto._updateCrossFade = function _updateCrossFade(srcPlayData, destPlayData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
28347
|
-
var
|
|
28764
|
+
var crossOwnerLayerDataCollection = layerData.crossOwnerLayerDataCollection;
|
|
28348
28765
|
var _srcPlayData_state_clip = srcPlayData.state.clip, srcCurves = _srcPlayData_state_clip._curveBindings;
|
|
28349
28766
|
var srcState = srcPlayData.state, srcStateData = srcPlayData.stateData, lastSrcPlayState = srcPlayData.playState;
|
|
28350
28767
|
var srcEventHandlers = srcStateData.eventHandlers;
|
|
@@ -28383,14 +28800,16 @@
|
|
|
28383
28800
|
} else {
|
|
28384
28801
|
this._callAnimatorScriptOnUpdate(destState, layerIndex);
|
|
28385
28802
|
}
|
|
28386
|
-
for(var i =
|
|
28387
|
-
var
|
|
28388
|
-
|
|
28389
|
-
|
|
28803
|
+
for(var i = crossOwnerLayerDataCollection.length - 1; i >= 0; i--){
|
|
28804
|
+
var layerOwner = crossOwnerLayerDataCollection[i];
|
|
28805
|
+
if (!layerOwner) continue;
|
|
28806
|
+
var srcCurveIndex = layerOwner.crossSrcCurveIndex;
|
|
28807
|
+
var destCurveIndex = layerOwner.crossDestCurveIndex;
|
|
28808
|
+
layerOwner.curveOwner.crossFadeAndApplyValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, weight, additive);
|
|
28390
28809
|
}
|
|
28391
28810
|
};
|
|
28392
28811
|
_proto._updateCrossFadeFromPose = function _updateCrossFadeFromPose(destPlayData, layerData, layerIndex, layerWeight, delta, additive, aniUpdate) {
|
|
28393
|
-
var
|
|
28812
|
+
var crossOwnerLayerDataCollection = layerData.crossOwnerLayerDataCollection;
|
|
28394
28813
|
var state = destPlayData.state, stateData = destPlayData.stateData, lastPlayState = destPlayData.playState;
|
|
28395
28814
|
var eventHandlers = stateData.eventHandlers;
|
|
28396
28815
|
var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
|
|
@@ -28414,10 +28833,11 @@
|
|
|
28414
28833
|
} else {
|
|
28415
28834
|
this._callAnimatorScriptOnUpdate(state, layerIndex);
|
|
28416
28835
|
}
|
|
28417
|
-
for(var i =
|
|
28418
|
-
var
|
|
28419
|
-
|
|
28420
|
-
|
|
28836
|
+
for(var i = crossOwnerLayerDataCollection.length - 1; i >= 0; i--){
|
|
28837
|
+
var layerOwner = crossOwnerLayerDataCollection[i];
|
|
28838
|
+
if (!layerOwner) continue;
|
|
28839
|
+
var curveIndex = layerOwner.crossDestCurveIndex;
|
|
28840
|
+
layerOwner.curveOwner.crossFadeFromPoseAndApplyValue(curveIndex >= 0 ? curveBindings[curveIndex].curve : null, destClipTime, crossWeight, layerWeight, additive);
|
|
28421
28841
|
}
|
|
28422
28842
|
};
|
|
28423
28843
|
_proto._updateCrossFadeData = function _updateCrossFadeData(layerData, crossWeight, delta, fixed) {
|
|
@@ -28439,18 +28859,19 @@
|
|
|
28439
28859
|
if (layerData.layerState === LayerState.Playing) {
|
|
28440
28860
|
var srcPlayData = layerData.srcPlayData;
|
|
28441
28861
|
if (srcPlayData.state !== playState) {
|
|
28442
|
-
var
|
|
28443
|
-
for(var i =
|
|
28444
|
-
var
|
|
28862
|
+
var curveLayerOwner = srcPlayData.stateData.curveLayerOwner;
|
|
28863
|
+
for(var i = curveLayerOwner.length - 1; i >= 0; i--){
|
|
28864
|
+
var _curveLayerOwner_i;
|
|
28865
|
+
var owner = (_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner;
|
|
28445
28866
|
(owner == null ? void 0 : owner.hasSavedDefaultValue) && owner.revertDefaultValue();
|
|
28446
28867
|
}
|
|
28447
28868
|
this._saveDefaultValues(playStateData);
|
|
28448
28869
|
}
|
|
28449
28870
|
} else {
|
|
28450
28871
|
// layerState is CrossFading, FixedCrossFading, Standby
|
|
28451
|
-
var
|
|
28452
|
-
for(var i1 =
|
|
28453
|
-
var owner1 =
|
|
28872
|
+
var crossOwnerLayerDataCollection = layerData.crossOwnerLayerDataCollection;
|
|
28873
|
+
for(var i1 = crossOwnerLayerDataCollection.length - 1; i1 >= 0; i1--){
|
|
28874
|
+
var owner1 = crossOwnerLayerDataCollection[i1].curveOwner;
|
|
28454
28875
|
owner1.hasSavedDefaultValue && owner1.revertDefaultValue();
|
|
28455
28876
|
}
|
|
28456
28877
|
this._saveDefaultValues(playStateData);
|
|
@@ -28620,10 +29041,7 @@
|
|
|
28620
29041
|
], Animator.prototype, "_animatorLayersData", void 0);
|
|
28621
29042
|
__decorate$1([
|
|
28622
29043
|
ignoreClone
|
|
28623
|
-
], Animator.prototype, "
|
|
28624
|
-
__decorate$1([
|
|
28625
|
-
ignoreClone
|
|
28626
|
-
], Animator.prototype, "_animationCurveOwners", void 0);
|
|
29044
|
+
], Animator.prototype, "_curveOwnerPool", void 0);
|
|
28627
29045
|
__decorate$1([
|
|
28628
29046
|
ignoreClone
|
|
28629
29047
|
], Animator.prototype, "_animationEventHandlerPool", void 0);
|
|
@@ -30041,7 +30459,9 @@
|
|
|
30041
30459
|
this.getMaterial().shaderData.setTexture("u_texture", texture);
|
|
30042
30460
|
}
|
|
30043
30461
|
};
|
|
30044
|
-
|
|
30462
|
+
/**
|
|
30463
|
+
* @internal
|
|
30464
|
+
*/ _proto._render = function _render(context) {
|
|
30045
30465
|
this._updateStrapVertices(context.camera, this._points);
|
|
30046
30466
|
this._updateStrapCoords();
|
|
30047
30467
|
this._vertexBuffer.setData(this._vertices);
|
|
@@ -30232,7 +30652,7 @@
|
|
|
30232
30652
|
/**
|
|
30233
30653
|
* The position of the probe can be set, the default is the origin [0,0,0].
|
|
30234
30654
|
*/ _this.position = new Vector3(0, 0, 0);
|
|
30235
|
-
_this._isCube = true;
|
|
30655
|
+
/** @internal */ _this._isCube = true;
|
|
30236
30656
|
_this.oriViewMatrix = new Matrix();
|
|
30237
30657
|
return _this;
|
|
30238
30658
|
};
|
|
@@ -30343,6 +30763,7 @@
|
|
|
30343
30763
|
get BlendOperation () { return exports.BlendOperation; },
|
|
30344
30764
|
BlendShape: BlendShape,
|
|
30345
30765
|
BlendShapeFrame: BlendShapeFrame,
|
|
30766
|
+
BlendState: BlendState,
|
|
30346
30767
|
BlinnPhongMaterial: BlinnPhongMaterial,
|
|
30347
30768
|
BoolUpdateFlag: BoolUpdateFlag,
|
|
30348
30769
|
BoxColliderShape: BoxColliderShape,
|
|
@@ -30371,6 +30792,7 @@
|
|
|
30371
30792
|
get CullMode () { return exports.CullMode; },
|
|
30372
30793
|
get DataType () { return exports.DataType; },
|
|
30373
30794
|
get DependentMode () { return exports.DependentMode; },
|
|
30795
|
+
DepthState: DepthState,
|
|
30374
30796
|
get DiffuseMode () { return exports.DiffuseMode; },
|
|
30375
30797
|
DirectLight: DirectLight,
|
|
30376
30798
|
DynamicCollider: DynamicCollider,
|
|
@@ -30422,13 +30844,16 @@
|
|
|
30422
30844
|
get PointerPhase () { return exports.PointerPhase; },
|
|
30423
30845
|
PrimitiveMesh: PrimitiveMesh,
|
|
30424
30846
|
Probe: Probe,
|
|
30847
|
+
RasterState: RasterState,
|
|
30425
30848
|
ReferResource: ReferResource,
|
|
30426
30849
|
get RenderBufferDepthFormat () { return exports.RenderBufferDepthFormat; },
|
|
30427
30850
|
get RenderFace () { return exports.RenderFace; },
|
|
30428
30851
|
RenderPass: RenderPass,
|
|
30429
30852
|
RenderQueue: RenderQueue,
|
|
30430
30853
|
get RenderQueueType () { return exports.RenderQueueType; },
|
|
30854
|
+
RenderState: RenderState,
|
|
30431
30855
|
RenderTarget: RenderTarget,
|
|
30856
|
+
RenderTargetBlendState: RenderTargetBlendState,
|
|
30432
30857
|
get Renderer () { return exports.Renderer; },
|
|
30433
30858
|
ResourceManager: ResourceManager,
|
|
30434
30859
|
Scene: Scene,
|
|
@@ -30466,6 +30891,7 @@
|
|
|
30466
30891
|
StateMachineScript: StateMachineScript,
|
|
30467
30892
|
StaticCollider: StaticCollider,
|
|
30468
30893
|
get StencilOperation () { return exports.StencilOperation; },
|
|
30894
|
+
StencilState: StencilState,
|
|
30469
30895
|
SubMesh: SubMesh,
|
|
30470
30896
|
SubShader: SubShader,
|
|
30471
30897
|
get SunMode () { return exports.SunMode; },
|
|
@@ -30691,8 +31117,9 @@
|
|
|
30691
31117
|
*/ WebGLEngine.create = function create(configuration) {
|
|
30692
31118
|
var canvas = configuration.canvas;
|
|
30693
31119
|
var webCanvas = new WebCanvas(typeof canvas === "string" ? document.getElementById(canvas) : canvas);
|
|
30694
|
-
var
|
|
30695
|
-
var engine = new WebGLEngine(webCanvas,
|
|
31120
|
+
var webGLGraphicDevice = new WebGLGraphicDevice(configuration.graphicDeviceOptions);
|
|
31121
|
+
var engine = new WebGLEngine(webCanvas, webGLGraphicDevice, configuration);
|
|
31122
|
+
// @ts-ignore
|
|
30696
31123
|
return engine._initialize(configuration);
|
|
30697
31124
|
};
|
|
30698
31125
|
_create_class$2(WebGLEngine, [
|
|
@@ -30701,6 +31128,7 @@
|
|
|
30701
31128
|
get: /**
|
|
30702
31129
|
* Web canvas.
|
|
30703
31130
|
*/ function get() {
|
|
31131
|
+
// @ts-ignore
|
|
30704
31132
|
return this._canvas;
|
|
30705
31133
|
}
|
|
30706
31134
|
}
|
|
@@ -32214,7 +32642,8 @@
|
|
|
32214
32642
|
var options = _extends$1({
|
|
32215
32643
|
webGLMode: 0,
|
|
32216
32644
|
stencil: true,
|
|
32217
|
-
_forceFlush: false
|
|
32645
|
+
_forceFlush: false,
|
|
32646
|
+
_maxAllowSkinUniformVectorCount: 256
|
|
32218
32647
|
}, initializeOptions);
|
|
32219
32648
|
if (SystemInfo.platform === exports.Platform.IPhone || SystemInfo.platform === exports.Platform.IPad) {
|
|
32220
32649
|
var version = SystemInfo.operatingSystem.match(/(\d+).?(\d+)?.?(\d+)?/);
|
|
@@ -32369,23 +32798,23 @@
|
|
|
32369
32798
|
};
|
|
32370
32799
|
_proto.activeRenderTarget = function activeRenderTarget(renderTarget, viewport, mipLevel) {
|
|
32371
32800
|
var gl = this._gl;
|
|
32801
|
+
var bufferWidth, bufferHeight;
|
|
32372
32802
|
if (renderTarget) {
|
|
32373
32803
|
var /** @ts-ignore */ _renderTarget__platformRenderTarget;
|
|
32374
32804
|
(_renderTarget__platformRenderTarget = renderTarget._platformRenderTarget) == null ? void 0 : _renderTarget__platformRenderTarget._activeRenderTarget();
|
|
32375
|
-
|
|
32376
|
-
|
|
32377
|
-
this.viewport(0, 0, width, height);
|
|
32378
|
-
this.scissor(0, 0, width, height);
|
|
32805
|
+
bufferWidth = renderTarget.width >> mipLevel;
|
|
32806
|
+
bufferHeight = renderTarget.height >> mipLevel;
|
|
32379
32807
|
} else {
|
|
32380
32808
|
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
32381
|
-
|
|
32382
|
-
|
|
32383
|
-
var height1 = drawingBufferHeight * viewport.w;
|
|
32384
|
-
var x = viewport.x * drawingBufferWidth;
|
|
32385
|
-
var y = drawingBufferHeight - viewport.y * drawingBufferHeight - height1;
|
|
32386
|
-
this.viewport(x, y, width1, height1);
|
|
32387
|
-
this.scissor(x, y, width1, height1);
|
|
32809
|
+
bufferWidth = gl.drawingBufferWidth;
|
|
32810
|
+
bufferHeight = gl.drawingBufferHeight;
|
|
32388
32811
|
}
|
|
32812
|
+
var width = bufferWidth * viewport.z;
|
|
32813
|
+
var height = bufferHeight * viewport.w;
|
|
32814
|
+
var x = viewport.x * bufferWidth;
|
|
32815
|
+
var y = bufferHeight - viewport.y * bufferHeight - height;
|
|
32816
|
+
this.viewport(x, y, width, height);
|
|
32817
|
+
this.scissor(x, y, width, height);
|
|
32389
32818
|
};
|
|
32390
32819
|
_proto.activeTexture = function activeTexture(textureID) {
|
|
32391
32820
|
if (this._activeTextureID !== textureID) {
|
|
@@ -34581,21 +35010,31 @@
|
|
|
34581
35010
|
var vertexCount;
|
|
34582
35011
|
var bufferBindIndex = 0;
|
|
34583
35012
|
var positions;
|
|
34584
|
-
|
|
35013
|
+
var boneIndices;
|
|
35014
|
+
var boneWeights;
|
|
35015
|
+
if (keepMeshData) {
|
|
35016
|
+
positions = new Array(vertexCount);
|
|
35017
|
+
boneIndices = new Array(vertexCount);
|
|
35018
|
+
boneWeights = new Array(vertexCount);
|
|
35019
|
+
}
|
|
34585
35020
|
for(var attribute in attributes){
|
|
34586
35021
|
var accessor = accessors[attributes[attribute]];
|
|
34587
35022
|
var accessorBuffer = GLTFUtils.getAccessorBuffer(context, gltf.bufferViews, accessor);
|
|
34588
35023
|
var dataElementSize = GLTFUtils.getAccessorTypeSize(accessor.type);
|
|
34589
|
-
var
|
|
35024
|
+
var accessorCount = accessor.count;
|
|
34590
35025
|
var vertices = accessorBuffer.data;
|
|
34591
35026
|
var vertexElement = void 0;
|
|
34592
35027
|
var meshId = mesh.instanceId;
|
|
34593
35028
|
var vertexBindingInfos = accessorBuffer.vertexBindingInfos;
|
|
34594
|
-
var
|
|
35029
|
+
var elementNormalized = accessor.normalized;
|
|
35030
|
+
var elementFormat = GLTFUtils.getElementFormat(accessor.componentType, dataElementSize, elementNormalized);
|
|
35031
|
+
var scaleFactor = void 0;
|
|
35032
|
+
elementNormalized && (scaleFactor = GLTFUtils.getNormalizedComponentScale(accessor.componentType));
|
|
35033
|
+
var elementOffset = void 0;
|
|
34595
35034
|
if (accessorBuffer.interleaved) {
|
|
34596
35035
|
var byteOffset = accessor.byteOffset || 0;
|
|
34597
35036
|
var stride = accessorBuffer.stride;
|
|
34598
|
-
|
|
35037
|
+
elementOffset = byteOffset % stride;
|
|
34599
35038
|
if (vertexBindingInfos[meshId] === undefined) {
|
|
34600
35039
|
vertexElement = new VertexElement(attribute, elementOffset, elementFormat, bufferBindIndex);
|
|
34601
35040
|
var vertexBuffer = accessorBuffer.vertexBuffer;
|
|
@@ -34611,7 +35050,8 @@
|
|
|
34611
35050
|
vertexElement = new VertexElement(attribute, elementOffset, elementFormat, vertexBindingInfos[meshId]);
|
|
34612
35051
|
}
|
|
34613
35052
|
} else {
|
|
34614
|
-
|
|
35053
|
+
elementOffset = 0;
|
|
35054
|
+
vertexElement = new VertexElement(attribute, elementOffset, elementFormat, bufferBindIndex);
|
|
34615
35055
|
var vertexBuffer1 = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, vertices.byteLength, exports.BufferUsage.Static);
|
|
34616
35056
|
vertexBuffer1.setData(vertices);
|
|
34617
35057
|
meshRestoreInfo.vertexBuffers.push(new BufferRestoreInfo(vertexBuffer1, accessorBuffer.restoreInfo));
|
|
@@ -34620,35 +35060,61 @@
|
|
|
34620
35060
|
}
|
|
34621
35061
|
vertexElements.push(vertexElement);
|
|
34622
35062
|
if (attribute === "POSITION") {
|
|
34623
|
-
vertexCount =
|
|
35063
|
+
vertexCount = accessorCount;
|
|
34624
35064
|
var _mesh_bounds = mesh.bounds, min = _mesh_bounds.min, max = _mesh_bounds.max;
|
|
34625
35065
|
if (accessor.min && accessor.max) {
|
|
34626
35066
|
min.copyFromArray(accessor.min);
|
|
34627
35067
|
max.copyFromArray(accessor.max);
|
|
34628
35068
|
if (keepMeshData) {
|
|
34629
|
-
var
|
|
34630
|
-
|
|
34631
|
-
|
|
34632
|
-
|
|
35069
|
+
var baseOffset = elementOffset / vertices.BYTES_PER_ELEMENT;
|
|
35070
|
+
var stride1 = vertices.length / accessorCount;
|
|
35071
|
+
for(var j = 0; j < accessorCount; j++){
|
|
35072
|
+
var offset = baseOffset + j * stride1;
|
|
35073
|
+
var position = new Vector3(vertices[offset], vertices[offset + 1], vertices[offset + 2]);
|
|
35074
|
+
elementNormalized && position.scale(scaleFactor);
|
|
35075
|
+
positions[j] = position;
|
|
34633
35076
|
}
|
|
34634
35077
|
}
|
|
34635
35078
|
} else {
|
|
34636
|
-
var
|
|
35079
|
+
var position1 = GLTFMeshParser._tempVector3;
|
|
34637
35080
|
min.set(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
|
|
34638
35081
|
max.set(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);
|
|
34639
|
-
var
|
|
34640
|
-
|
|
34641
|
-
|
|
34642
|
-
|
|
34643
|
-
|
|
34644
|
-
Vector3.
|
|
35082
|
+
var baseOffset1 = elementOffset / vertices.BYTES_PER_ELEMENT;
|
|
35083
|
+
var stride2 = vertices.length / accessorCount;
|
|
35084
|
+
for(var j1 = 0; j1 < accessorCount; j1++){
|
|
35085
|
+
var offset1 = baseOffset1 + j1 * stride2;
|
|
35086
|
+
position1.copyFromArray(vertices, offset1);
|
|
35087
|
+
Vector3.min(min, position1, min);
|
|
35088
|
+
Vector3.max(max, position1, max);
|
|
35089
|
+
if (keepMeshData) {
|
|
35090
|
+
var clonePosition = position1.clone();
|
|
35091
|
+
elementNormalized && clonePosition.scale(scaleFactor);
|
|
35092
|
+
positions[j1] = clonePosition;
|
|
35093
|
+
}
|
|
34645
35094
|
}
|
|
34646
35095
|
}
|
|
34647
|
-
if (
|
|
34648
|
-
var scaleFactor = GLTFUtils.getNormalizedComponentScale(accessor.componentType);
|
|
35096
|
+
if (elementNormalized) {
|
|
34649
35097
|
min.scale(scaleFactor);
|
|
34650
35098
|
max.scale(scaleFactor);
|
|
34651
35099
|
}
|
|
35100
|
+
} else if (attribute === "JOINTS_0" && keepMeshData) {
|
|
35101
|
+
var baseOffset2 = elementOffset / vertices.BYTES_PER_ELEMENT;
|
|
35102
|
+
var stride3 = vertices.length / accessorCount;
|
|
35103
|
+
for(var j2 = 0; j2 < accessorCount; j2++){
|
|
35104
|
+
var offset2 = baseOffset2 + j2 * stride3;
|
|
35105
|
+
var boneIndex = new Vector4(vertices[offset2], vertices[offset2 + 1], vertices[offset2 + 2], vertices[offset2 + 3]);
|
|
35106
|
+
elementNormalized && boneIndex.scale(scaleFactor);
|
|
35107
|
+
boneIndices[j2] = boneIndex;
|
|
35108
|
+
}
|
|
35109
|
+
} else if (attribute === "WEIGHTS_0" && keepMeshData) {
|
|
35110
|
+
var baseOffset3 = elementOffset / vertices.BYTES_PER_ELEMENT;
|
|
35111
|
+
var stride4 = vertices.length / accessorCount;
|
|
35112
|
+
for(var j3 = 0; j3 < accessorCount; j3++){
|
|
35113
|
+
var offset3 = baseOffset3 + j3 * stride4;
|
|
35114
|
+
var boneWeight = new Vector4(vertices[offset3], vertices[offset3 + 1], vertices[offset3 + 2], vertices[offset3 + 3]);
|
|
35115
|
+
elementNormalized && boneWeight.scale(scaleFactor);
|
|
35116
|
+
boneWeights[j3] = boneWeight;
|
|
35117
|
+
}
|
|
34652
35118
|
}
|
|
34653
35119
|
}
|
|
34654
35120
|
mesh.setVertexElements(vertexElements);
|
|
@@ -34667,6 +35133,10 @@
|
|
|
34667
35133
|
mesh.uploadData(!keepMeshData);
|
|
34668
35134
|
//@ts-ignore
|
|
34669
35135
|
mesh._positions = positions;
|
|
35136
|
+
//@ts-ignore
|
|
35137
|
+
mesh._boneIndices = boneIndices;
|
|
35138
|
+
//@ts-ignore
|
|
35139
|
+
mesh._boneWeights = boneWeights;
|
|
34670
35140
|
return Promise.resolve(mesh);
|
|
34671
35141
|
};
|
|
34672
35142
|
/**
|
|
@@ -34756,14 +35226,7 @@
|
|
|
34756
35226
|
camera.enabled = false;
|
|
34757
35227
|
};
|
|
34758
35228
|
_proto._createRenderer = function _createRenderer(context, glTFNode, entity) {
|
|
34759
|
-
var
|
|
34760
|
-
var glTFMeshes = glTF.meshes;
|
|
34761
|
-
var engine = glTFResource.engine, meshes = glTFResource.meshes, materials = glTFResource.materials, skins = glTFResource.skins;
|
|
34762
|
-
var meshID = glTFNode.mesh, skinID = glTFNode.skin;
|
|
34763
|
-
var glTFMesh = glTFMeshes[meshID];
|
|
34764
|
-
var glTFMeshPrimitives = glTFMesh.primitives;
|
|
34765
|
-
var blendShapeWeights = glTFNode.weights || glTFMesh.weights;
|
|
34766
|
-
for(var i = 0; i < glTFMeshPrimitives.length; i++){
|
|
35229
|
+
var _loop = function _loop(i) {
|
|
34767
35230
|
var gltfPrimitive = glTFMeshPrimitives[i];
|
|
34768
35231
|
var mesh = meshes[meshID][i];
|
|
34769
35232
|
var renderer = void 0;
|
|
@@ -34785,8 +35248,22 @@
|
|
|
34785
35248
|
var materialIndex = gltfPrimitive.material;
|
|
34786
35249
|
var material = (materials == null ? void 0 : materials[materialIndex]) || GLTFSceneParser._getDefaultMaterial(engine);
|
|
34787
35250
|
renderer.setMaterial(material);
|
|
35251
|
+
// Enable vertex color if mesh has COLOR_0 vertex element
|
|
35252
|
+
mesh.vertexElements.forEach(function(element) {
|
|
35253
|
+
if (element.semantic === "COLOR_0") {
|
|
35254
|
+
renderer.enableVertexColor = true;
|
|
35255
|
+
}
|
|
35256
|
+
});
|
|
34788
35257
|
GLTFParser.executeExtensionsAdditiveAndParse(gltfPrimitive.extensions, context, renderer, gltfPrimitive);
|
|
34789
|
-
}
|
|
35258
|
+
};
|
|
35259
|
+
var glTFResource = context.glTFResource, glTF = context.glTF;
|
|
35260
|
+
var glTFMeshes = glTF.meshes;
|
|
35261
|
+
var engine = glTFResource.engine, meshes = glTFResource.meshes, materials = glTFResource.materials, skins = glTFResource.skins;
|
|
35262
|
+
var meshID = glTFNode.mesh, skinID = glTFNode.skin;
|
|
35263
|
+
var glTFMesh = glTFMeshes[meshID];
|
|
35264
|
+
var glTFMeshPrimitives = glTFMesh.primitives;
|
|
35265
|
+
var blendShapeWeights = glTFNode.weights || glTFMesh.weights;
|
|
35266
|
+
for(var i = 0; i < glTFMeshPrimitives.length; i++)_loop(i);
|
|
34790
35267
|
};
|
|
34791
35268
|
_proto._createAnimator = function _createAnimator(context) {
|
|
34792
35269
|
if (!context.hasSkinned && !context.glTFResource.animations) {
|
|
@@ -35080,7 +35557,9 @@
|
|
|
35080
35557
|
};
|
|
35081
35558
|
_inherits(GLTFResource, EngineObject);
|
|
35082
35559
|
var _proto = GLTFResource.prototype;
|
|
35083
|
-
|
|
35560
|
+
/**
|
|
35561
|
+
* @internal
|
|
35562
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
35084
35563
|
EngineObject.prototype._onDestroy.call(this);
|
|
35085
35564
|
this.defaultSceneRoot.destroy();
|
|
35086
35565
|
this.textures = null;
|
|
@@ -35720,6 +36199,15 @@
|
|
|
35720
36199
|
"ktx"
|
|
35721
36200
|
])
|
|
35722
36201
|
], KTXLoader);
|
|
36202
|
+
function parseProperty(object, key, value) {
|
|
36203
|
+
if (typeof value === "object") {
|
|
36204
|
+
for(var subKey in value){
|
|
36205
|
+
parseProperty(object[key], subKey, value[subKey]);
|
|
36206
|
+
}
|
|
36207
|
+
} else {
|
|
36208
|
+
object[key] = value;
|
|
36209
|
+
}
|
|
36210
|
+
}
|
|
35723
36211
|
var MaterialLoader = /*#__PURE__*/ function(Loader) {
|
|
35724
36212
|
var MaterialLoader = function MaterialLoader() {
|
|
35725
36213
|
return Loader.apply(this, arguments);
|
|
@@ -35731,7 +36219,7 @@
|
|
|
35731
36219
|
return new AssetPromise(function(resolve, reject) {
|
|
35732
36220
|
_this.request(item.url, _extends({}, item, {
|
|
35733
36221
|
type: "json"
|
|
35734
|
-
})).then(function(
|
|
36222
|
+
})).then(function(materialSchema) {
|
|
35735
36223
|
var _loop = function _loop(key) {
|
|
35736
36224
|
var _shaderData_key = shaderData[key], type = _shaderData_key.type, value = _shaderData_key.value;
|
|
35737
36225
|
switch(type){
|
|
@@ -35758,27 +36246,8 @@
|
|
|
35758
36246
|
}
|
|
35759
36247
|
};
|
|
35760
36248
|
var engine = resourceManager.engine;
|
|
35761
|
-
var name =
|
|
35762
|
-
var material;
|
|
35763
|
-
switch(shader){
|
|
35764
|
-
case "pbr":
|
|
35765
|
-
material = new PBRMaterial(engine);
|
|
35766
|
-
break;
|
|
35767
|
-
case "pbr-specular":
|
|
35768
|
-
material = new PBRSpecularMaterial(engine);
|
|
35769
|
-
break;
|
|
35770
|
-
case "unlit":
|
|
35771
|
-
material = new UnlitMaterial(engine);
|
|
35772
|
-
break;
|
|
35773
|
-
case "blinn-phong":
|
|
35774
|
-
material = new BlinnPhongMaterial(engine);
|
|
35775
|
-
break;
|
|
35776
|
-
case "bake-pbr":
|
|
35777
|
-
// @todo refactor custom shader later
|
|
35778
|
-
// @ts-ignore
|
|
35779
|
-
material = new PBRBaseMaterial(engine, Shader.find("bake-pbr"));
|
|
35780
|
-
break;
|
|
35781
|
-
}
|
|
36249
|
+
var name = materialSchema.name, shader = materialSchema.shader, shaderData = materialSchema.shaderData, macros = materialSchema.macros, renderState = materialSchema.renderState;
|
|
36250
|
+
var material = new Material(engine, Shader.find(shader));
|
|
35782
36251
|
material.name = name;
|
|
35783
36252
|
var texturePromises = new Array();
|
|
35784
36253
|
var materialShaderData = material.shaderData;
|
|
@@ -35791,9 +36260,7 @@
|
|
|
35791
36260
|
materialShaderData.enableMacro(name1, value);
|
|
35792
36261
|
}
|
|
35793
36262
|
}
|
|
35794
|
-
|
|
35795
|
-
material[key1] = renderState[key1];
|
|
35796
|
-
}
|
|
36263
|
+
parseProperty(material, "renderState", renderState);
|
|
35797
36264
|
return Promise.all(texturePromises).then(function() {
|
|
35798
36265
|
resolve(material);
|
|
35799
36266
|
});
|
|
@@ -36529,6 +36996,11 @@
|
|
|
36529
36996
|
exports.AnimationClipDecoder = __decorate([
|
|
36530
36997
|
decoder("AnimationClip")
|
|
36531
36998
|
], exports.AnimationClipDecoder);
|
|
36999
|
+
exports.SpecularMode = void 0;
|
|
37000
|
+
(function(SpecularMode) {
|
|
37001
|
+
SpecularMode["Sky"] = "Sky";
|
|
37002
|
+
SpecularMode["Custom"] = "Custom";
|
|
37003
|
+
})(exports.SpecularMode || (exports.SpecularMode = {}));
|
|
36532
37004
|
var SceneParserContext = /*#__PURE__*/ function() {
|
|
36533
37005
|
var SceneParserContext = function SceneParserContext(originalData, scene) {
|
|
36534
37006
|
this.originalData = originalData;
|
|
@@ -36804,7 +37276,7 @@
|
|
|
36804
37276
|
var atlasItem = atlasItems[i];
|
|
36805
37277
|
if (atlasItem.img) {
|
|
36806
37278
|
chainPromises.push(resourceManager.load({
|
|
36807
|
-
url: atlasItem.img,
|
|
37279
|
+
url: Utils.resolveAbsoluteUrl(item.url, atlasItem.img),
|
|
36808
37280
|
type: exports.AssetType.Texture2D,
|
|
36809
37281
|
params: {
|
|
36810
37282
|
format: format,
|
|
@@ -37073,47 +37545,63 @@
|
|
|
37073
37545
|
// @ts-ignore
|
|
37074
37546
|
engine.resourceManager.initVirtualResources(data.files);
|
|
37075
37547
|
return SceneParser.parse(engine, data).then(function(scene) {
|
|
37548
|
+
var promises = [];
|
|
37076
37549
|
// parse ambient light
|
|
37077
37550
|
var ambient = data.scene.ambient;
|
|
37078
|
-
var
|
|
37079
|
-
if (ambient.
|
|
37080
|
-
|
|
37081
|
-
|
|
37082
|
-
|
|
37551
|
+
var useCustomAmbient = ambient.specularMode === "Custom";
|
|
37552
|
+
if (useCustomAmbient && ambient.customAmbientLight) {
|
|
37553
|
+
// @ts-ignore
|
|
37554
|
+
// prettier-ignore
|
|
37555
|
+
var customAmbientPromise = resourceManager.getResourceByRef(ambient.customAmbientLight).then(function(ambientLight) {
|
|
37556
|
+
scene.ambientLight = ambientLight;
|
|
37083
37557
|
scene.ambientLight.diffuseIntensity = ambient.diffuseIntensity;
|
|
37084
37558
|
scene.ambientLight.specularIntensity = ambient.specularIntensity;
|
|
37559
|
+
scene.ambientLight.diffuseMode = ambient.diffuseMode;
|
|
37560
|
+
scene.ambientLight.diffuseSolidColor.copyFrom(ambient.diffuseSolidColor);
|
|
37085
37561
|
});
|
|
37086
|
-
|
|
37087
|
-
|
|
37088
|
-
|
|
37089
|
-
|
|
37562
|
+
promises.push(customAmbientPromise);
|
|
37563
|
+
} else if (!useCustomAmbient && ambient.ambientLight) {
|
|
37564
|
+
// @ts-ignore
|
|
37565
|
+
// prettier-ignore
|
|
37566
|
+
var ambientLightPromise = resourceManager.getResourceByRef(ambient.ambientLight).then(function(ambientLight) {
|
|
37567
|
+
scene.ambientLight = ambientLight;
|
|
37568
|
+
scene.ambientLight.diffuseIntensity = ambient.diffuseIntensity;
|
|
37569
|
+
scene.ambientLight.specularIntensity = ambient.specularIntensity;
|
|
37570
|
+
scene.ambientLight.diffuseMode = ambient.diffuseMode;
|
|
37571
|
+
scene.ambientLight.diffuseSolidColor.copyFrom(ambient.diffuseSolidColor);
|
|
37572
|
+
});
|
|
37573
|
+
promises.push(ambientLightPromise);
|
|
37090
37574
|
}
|
|
37091
37575
|
var background = data.scene.background;
|
|
37092
37576
|
scene.background.mode = background.mode;
|
|
37093
|
-
var backgroundPromise = Promise.resolve();
|
|
37094
37577
|
switch(scene.background.mode){
|
|
37095
37578
|
case exports.BackgroundMode.SolidColor:
|
|
37096
37579
|
scene.background.solidColor.copyFrom(background.color);
|
|
37097
37580
|
break;
|
|
37098
37581
|
case exports.BackgroundMode.Sky:
|
|
37099
|
-
if (background.
|
|
37582
|
+
if (background.skyMesh && background.skyMaterial) {
|
|
37100
37583
|
// @ts-ignore
|
|
37101
|
-
|
|
37102
|
-
|
|
37103
|
-
var skyMaterial = new SkyBoxMaterial(engine);
|
|
37104
|
-
skyMaterial.texture = light.specularTexture;
|
|
37105
|
-
skyMaterial.textureDecodeRGBM = true;
|
|
37106
|
-
sky.material = skyMaterial;
|
|
37107
|
-
sky.mesh = PrimitiveMesh.createCuboid(engine, 1, 1, 1);
|
|
37584
|
+
var skyMeshPromise = resourceManager.getResourceByRef(background.skyMesh).then(function(mesh) {
|
|
37585
|
+
scene.background.sky.mesh = mesh;
|
|
37108
37586
|
});
|
|
37587
|
+
// @ts-ignore
|
|
37588
|
+
// prettier-ignore
|
|
37589
|
+
var skyMaterialPromise = resourceManager.getResourceByRef(background.skyMaterial).then(function(material) {
|
|
37590
|
+
scene.background.sky.material = material;
|
|
37591
|
+
});
|
|
37592
|
+
promises.push(skyMeshPromise, skyMaterialPromise);
|
|
37593
|
+
} else {
|
|
37594
|
+
Logger.warn("Sky background mode requires skyMesh and skyMaterial");
|
|
37109
37595
|
}
|
|
37110
37596
|
break;
|
|
37111
37597
|
case exports.BackgroundMode.Texture:
|
|
37112
37598
|
if (background.texture) {
|
|
37113
37599
|
// @ts-ignore
|
|
37114
|
-
|
|
37600
|
+
// prettier-ignore
|
|
37601
|
+
var backgroundPromise = resourceManager.getResourceByRef(background.texture).then(function(texture) {
|
|
37115
37602
|
scene.background.texture = texture;
|
|
37116
37603
|
});
|
|
37604
|
+
promises.push(backgroundPromise);
|
|
37117
37605
|
}
|
|
37118
37606
|
break;
|
|
37119
37607
|
}
|
|
@@ -37125,10 +37613,7 @@
|
|
|
37125
37613
|
if (shadow.shadowDistance != undefined) scene.shadowDistance = shadow.shadowDistance;
|
|
37126
37614
|
if (shadow.shadowCascades != undefined) scene.shadowCascades = shadow.shadowCascades;
|
|
37127
37615
|
}
|
|
37128
|
-
return Promise.all(
|
|
37129
|
-
ambientLightPromise,
|
|
37130
|
-
backgroundPromise
|
|
37131
|
-
]).then(function() {
|
|
37616
|
+
return Promise.all(promises).then(function() {
|
|
37132
37617
|
resolve(scene);
|
|
37133
37618
|
});
|
|
37134
37619
|
});
|
|
@@ -37384,6 +37869,21 @@
|
|
|
37384
37869
|
KHR_materials_clearcoat = __decorate([
|
|
37385
37870
|
registerGLTFExtension("KHR_materials_clearcoat", exports.GLTFExtensionMode.AdditiveParse)
|
|
37386
37871
|
], KHR_materials_clearcoat);
|
|
37872
|
+
var KHR_materials_ior = /*#__PURE__*/ function(GLTFExtensionParser) {
|
|
37873
|
+
var KHR_materials_ior = function KHR_materials_ior() {
|
|
37874
|
+
return GLTFExtensionParser.apply(this, arguments);
|
|
37875
|
+
};
|
|
37876
|
+
_inherits(KHR_materials_ior, GLTFExtensionParser);
|
|
37877
|
+
var _proto = KHR_materials_ior.prototype;
|
|
37878
|
+
_proto.additiveParse = function additiveParse(context, material, schema) {
|
|
37879
|
+
var _schema_ior = schema.ior, ior = _schema_ior === void 0 ? 1.5 : _schema_ior;
|
|
37880
|
+
material.ior = ior;
|
|
37881
|
+
};
|
|
37882
|
+
return KHR_materials_ior;
|
|
37883
|
+
}(GLTFExtensionParser);
|
|
37884
|
+
KHR_materials_ior = __decorate([
|
|
37885
|
+
registerGLTFExtension("KHR_materials_ior", exports.GLTFExtensionMode.AdditiveParse)
|
|
37886
|
+
], KHR_materials_ior);
|
|
37387
37887
|
var KHR_materials_pbrSpecularGlossiness = /*#__PURE__*/ function(GLTFExtensionParser) {
|
|
37388
37888
|
var KHR_materials_pbrSpecularGlossiness = function KHR_materials_pbrSpecularGlossiness() {
|
|
37389
37889
|
return GLTFExtensionParser.apply(this, arguments);
|
|
@@ -37516,7 +38016,7 @@
|
|
|
37516
38016
|
], GALACEAN_animation_event);
|
|
37517
38017
|
|
|
37518
38018
|
//@ts-ignore
|
|
37519
|
-
var version = "1.0.0-beta.
|
|
38019
|
+
var version = "1.0.0-beta.10";
|
|
37520
38020
|
console.log("Galacean engine version: " + version);
|
|
37521
38021
|
for(var key in CoreObjects){
|
|
37522
38022
|
Loader.registerClass(key, CoreObjects[key]);
|
|
@@ -37540,6 +38040,7 @@
|
|
|
37540
38040
|
exports.BasicRenderPipeline = BasicRenderPipeline;
|
|
37541
38041
|
exports.BlendShape = BlendShape;
|
|
37542
38042
|
exports.BlendShapeFrame = BlendShapeFrame;
|
|
38043
|
+
exports.BlendState = BlendState;
|
|
37543
38044
|
exports.BlinnPhongMaterial = BlinnPhongMaterial;
|
|
37544
38045
|
exports.BoolUpdateFlag = BoolUpdateFlag;
|
|
37545
38046
|
exports.BoundingBox = BoundingBox;
|
|
@@ -37559,6 +38060,7 @@
|
|
|
37559
38060
|
exports.ComponentMap = ComponentMap;
|
|
37560
38061
|
exports.ContentRestorer = ContentRestorer;
|
|
37561
38062
|
exports.CubeProbe = CubeProbe;
|
|
38063
|
+
exports.DepthState = DepthState;
|
|
37562
38064
|
exports.DirectLight = DirectLight;
|
|
37563
38065
|
exports.DynamicCollider = DynamicCollider;
|
|
37564
38066
|
exports.Engine = Engine;
|
|
@@ -37613,13 +38115,16 @@
|
|
|
37613
38115
|
exports.PrimitiveMesh = PrimitiveMesh;
|
|
37614
38116
|
exports.Probe = Probe;
|
|
37615
38117
|
exports.Quaternion = Quaternion;
|
|
38118
|
+
exports.RasterState = RasterState;
|
|
37616
38119
|
exports.Ray = Ray;
|
|
37617
38120
|
exports.Rect = Rect;
|
|
37618
38121
|
exports.ReferResource = ReferResource;
|
|
37619
38122
|
exports.ReflectionParser = ReflectionParser;
|
|
37620
38123
|
exports.RenderPass = RenderPass;
|
|
37621
38124
|
exports.RenderQueue = RenderQueue;
|
|
38125
|
+
exports.RenderState = RenderState;
|
|
37622
38126
|
exports.RenderTarget = RenderTarget;
|
|
38127
|
+
exports.RenderTargetBlendState = RenderTargetBlendState;
|
|
37623
38128
|
exports.ResourceManager = ResourceManager;
|
|
37624
38129
|
exports.Scene = Scene;
|
|
37625
38130
|
exports.SceneManager = SceneManager;
|
|
@@ -37648,6 +38153,7 @@
|
|
|
37648
38153
|
exports.SpriteRenderer = SpriteRenderer;
|
|
37649
38154
|
exports.StateMachineScript = StateMachineScript;
|
|
37650
38155
|
exports.StaticCollider = StaticCollider;
|
|
38156
|
+
exports.StencilState = StencilState;
|
|
37651
38157
|
exports.SubMesh = SubMesh;
|
|
37652
38158
|
exports.SubShader = SubShader;
|
|
37653
38159
|
exports.SystemInfo = SystemInfo;
|