@galacean/engine 1.0.0-beta.0 → 1.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +969 -636
- 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
|
@@ -5507,7 +5507,6 @@
|
|
|
5507
5507
|
_inherits$2(ReferResource, EngineObject);
|
|
5508
5508
|
var _proto = ReferResource.prototype;
|
|
5509
5509
|
/**
|
|
5510
|
-
* @override
|
|
5511
5510
|
* Destroy self.
|
|
5512
5511
|
* @param force - Whether to force the destruction, if it is false, refCount = 0 can be released successfully.
|
|
5513
5512
|
* @returns Whether the release was successful.
|
|
@@ -5535,7 +5534,7 @@
|
|
|
5535
5534
|
this._engine.resourceManager._addAsset(path, this);
|
|
5536
5535
|
};
|
|
5537
5536
|
/**
|
|
5538
|
-
* @
|
|
5537
|
+
* @internal
|
|
5539
5538
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
5540
5539
|
EngineObject.prototype._onDestroy.call(this);
|
|
5541
5540
|
this._engine.resourceManager._deleteReferResource(this);
|
|
@@ -5661,7 +5660,7 @@
|
|
|
5661
5660
|
_inherits$2(GraphicsResource, ReferResource);
|
|
5662
5661
|
var _proto = GraphicsResource.prototype;
|
|
5663
5662
|
/**
|
|
5664
|
-
* @
|
|
5663
|
+
* @internal
|
|
5665
5664
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
5666
5665
|
ReferResource.prototype._onDestroy.call(this);
|
|
5667
5666
|
this.engine.resourceManager._deleteGraphicResource(this);
|
|
@@ -5729,7 +5728,6 @@
|
|
|
5729
5728
|
}
|
|
5730
5729
|
};
|
|
5731
5730
|
/**
|
|
5732
|
-
* @override
|
|
5733
5731
|
* @internal
|
|
5734
5732
|
*/ _proto._rebuild = function _rebuild() {
|
|
5735
5733
|
var platformTexture = this._platformTexture;
|
|
@@ -5741,7 +5739,6 @@
|
|
|
5741
5739
|
platformTexture.setUseDepthCompareMode(this._useDepthCompareMode);
|
|
5742
5740
|
};
|
|
5743
5741
|
/**
|
|
5744
|
-
* @override
|
|
5745
5742
|
* @internal
|
|
5746
5743
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
5747
5744
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
@@ -5891,9 +5888,11 @@
|
|
|
5891
5888
|
renderTexture
|
|
5892
5889
|
];
|
|
5893
5890
|
for(var i = 0, n = colorTextures.length; i < n; i++){
|
|
5894
|
-
|
|
5891
|
+
var colorTexture = colorTextures[i];
|
|
5892
|
+
if (colorTexture._isDepthTexture) {
|
|
5895
5893
|
throw "Render texture can't use depth format.";
|
|
5896
5894
|
}
|
|
5895
|
+
colorTexture._addReferCount(1);
|
|
5897
5896
|
}
|
|
5898
5897
|
_this._colorTextures = colorTextures;
|
|
5899
5898
|
} else {
|
|
@@ -5904,6 +5903,7 @@
|
|
|
5904
5903
|
throw "Depth texture must use depth format.";
|
|
5905
5904
|
}
|
|
5906
5905
|
_this._depthTexture = depth;
|
|
5906
|
+
_this._depthTexture._addReferCount(1);
|
|
5907
5907
|
}
|
|
5908
5908
|
_this._platformRenderTarget = engine._hardwareRenderer.createPlatformRenderTarget(_assert_this_initialized(_this));
|
|
5909
5909
|
return _this;
|
|
@@ -5931,11 +5931,17 @@
|
|
|
5931
5931
|
}
|
|
5932
5932
|
};
|
|
5933
5933
|
/**
|
|
5934
|
-
* @
|
|
5934
|
+
* @internal
|
|
5935
5935
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
5936
|
+
var _this__depthTexture;
|
|
5936
5937
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
5937
5938
|
this._platformRenderTarget.destroy();
|
|
5938
|
-
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);
|
|
5939
5945
|
this._depthTexture = null;
|
|
5940
5946
|
this._depth = null;
|
|
5941
5947
|
};
|
|
@@ -5950,7 +5956,6 @@
|
|
|
5950
5956
|
this._platformRenderTarget.blitRenderTarget();
|
|
5951
5957
|
};
|
|
5952
5958
|
/**
|
|
5953
|
-
* @override
|
|
5954
5959
|
* @internal
|
|
5955
5960
|
*/ _proto._rebuild = function _rebuild() {
|
|
5956
5961
|
this._platformRenderTarget = this._engine._hardwareRenderer.createPlatformRenderTarget(this);
|
|
@@ -6151,7 +6156,7 @@
|
|
|
6151
6156
|
}
|
|
6152
6157
|
};
|
|
6153
6158
|
/**
|
|
6154
|
-
* @
|
|
6159
|
+
* @internal
|
|
6155
6160
|
*/ _proto._rebuild = function _rebuild() {
|
|
6156
6161
|
this._platformTexture = this._engine._hardwareRenderer.createPlatformTexture2DArray(this);
|
|
6157
6162
|
Texture.prototype._rebuild.call(this);
|
|
@@ -6234,7 +6239,7 @@
|
|
|
6234
6239
|
}
|
|
6235
6240
|
};
|
|
6236
6241
|
/**
|
|
6237
|
-
* @
|
|
6242
|
+
* @internal
|
|
6238
6243
|
*/ _proto._rebuild = function _rebuild() {
|
|
6239
6244
|
this._platformTexture = this._engine._hardwareRenderer.createPlatformTextureCube(this);
|
|
6240
6245
|
Texture.prototype._rebuild.call(this);
|
|
@@ -6308,7 +6313,6 @@
|
|
|
6308
6313
|
return this._charInfoMap[char.charCodeAt(0)];
|
|
6309
6314
|
};
|
|
6310
6315
|
/**
|
|
6311
|
-
* @override
|
|
6312
6316
|
* @internal
|
|
6313
6317
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
6314
6318
|
ReferResource.prototype._onDestroy.call(this);
|
|
@@ -6813,6 +6817,7 @@
|
|
|
6813
6817
|
var fontAtlas = new FontAtlas(engine);
|
|
6814
6818
|
var texture = new Texture2D(engine, 256, 256);
|
|
6815
6819
|
fontAtlas.texture = texture;
|
|
6820
|
+
fontAtlas.isGCIgnored = texture.isGCIgnored = true;
|
|
6816
6821
|
this._fontAtlases.push(fontAtlas);
|
|
6817
6822
|
var nativeFontString = this.nativeFontString;
|
|
6818
6823
|
engine.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
|
|
@@ -6869,7 +6874,6 @@
|
|
|
6869
6874
|
return subFont;
|
|
6870
6875
|
};
|
|
6871
6876
|
/**
|
|
6872
|
-
* @override
|
|
6873
6877
|
* @internal
|
|
6874
6878
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
6875
6879
|
ReferResource.prototype._onDestroy.call(this);
|
|
@@ -8031,53 +8035,6 @@
|
|
|
8031
8035
|
};
|
|
8032
8036
|
return ComponentsManager;
|
|
8033
8037
|
}();
|
|
8034
|
-
var ComponentCloner = /*#__PURE__*/ function() {
|
|
8035
|
-
var ComponentCloner = function ComponentCloner() {};
|
|
8036
|
-
/**
|
|
8037
|
-
* Clone component.
|
|
8038
|
-
* @param source - Clone source
|
|
8039
|
-
* @param target - Clone target
|
|
8040
|
-
*/ ComponentCloner.cloneComponent = function cloneComponent(source, target) {
|
|
8041
|
-
var cloneModes = CloneManager.getCloneMode(source.constructor);
|
|
8042
|
-
var keys = Object.keys(source);
|
|
8043
|
-
for(var i = 0, n = keys.length; i < n; i++){
|
|
8044
|
-
var k = keys[i];
|
|
8045
|
-
var cloneMode = cloneModes[k];
|
|
8046
|
-
switch(cloneMode){
|
|
8047
|
-
case undefined:
|
|
8048
|
-
case CloneMode.Assignment:
|
|
8049
|
-
target[k] = source[k];
|
|
8050
|
-
break;
|
|
8051
|
-
case CloneMode.Shallow:
|
|
8052
|
-
var sourcePropS = source[k];
|
|
8053
|
-
if (_instanceof1$2(sourcePropS, Object)) {
|
|
8054
|
-
var tarProp = target[k];
|
|
8055
|
-
tarProp == null && (tarProp = target[k] = sourcePropS.constructor());
|
|
8056
|
-
Object.assign(tarProp, sourcePropS);
|
|
8057
|
-
} else {
|
|
8058
|
-
// Null or undefined and primitive type.
|
|
8059
|
-
target[k] = sourcePropS;
|
|
8060
|
-
}
|
|
8061
|
-
break;
|
|
8062
|
-
case CloneMode.Deep:
|
|
8063
|
-
var sourcePropD = source[k];
|
|
8064
|
-
if (_instanceof1$2(sourcePropD, Object)) {
|
|
8065
|
-
var tarProp1 = target[k];
|
|
8066
|
-
tarProp1 == null && (tarProp1 = target[k] = sourcePropD.constructor());
|
|
8067
|
-
CloneManager.deepCloneObject(sourcePropD, tarProp1);
|
|
8068
|
-
} else {
|
|
8069
|
-
// Null or undefined and primitive type.
|
|
8070
|
-
target[k] = sourcePropD;
|
|
8071
|
-
}
|
|
8072
|
-
break;
|
|
8073
|
-
}
|
|
8074
|
-
}
|
|
8075
|
-
if (source._cloneTo) {
|
|
8076
|
-
source._cloneTo(target);
|
|
8077
|
-
}
|
|
8078
|
-
};
|
|
8079
|
-
return ComponentCloner;
|
|
8080
|
-
}();
|
|
8081
8038
|
/**
|
|
8082
8039
|
* The base class of the components.
|
|
8083
8040
|
*/ var Component = /*#__PURE__*/ function(EngineObject) {
|
|
@@ -8126,7 +8083,6 @@
|
|
|
8126
8083
|
}
|
|
8127
8084
|
};
|
|
8128
8085
|
/**
|
|
8129
|
-
* @override
|
|
8130
8086
|
* @internal
|
|
8131
8087
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
8132
8088
|
EngineObject.prototype._onDestroy.call(this);
|
|
@@ -9351,6 +9307,53 @@
|
|
|
9351
9307
|
TransformModifyFlags[TransformModifyFlags[/** WorldMatrix | WorldPosition | WorldScale */ "WmWpWs"] = 0xa4] = "WmWpWs";
|
|
9352
9308
|
TransformModifyFlags[TransformModifyFlags[/** WorldMatrix | WorldPosition | WorldEuler | WorldQuat | WorldScale */ "WmWpWeWqWs"] = 0xbc] = "WmWpWeWqWs";
|
|
9353
9309
|
})(TransformModifyFlags || (TransformModifyFlags = {}));
|
|
9310
|
+
var ComponentCloner = /*#__PURE__*/ function() {
|
|
9311
|
+
var ComponentCloner = function ComponentCloner() {};
|
|
9312
|
+
/**
|
|
9313
|
+
* Clone component.
|
|
9314
|
+
* @param source - Clone source
|
|
9315
|
+
* @param target - Clone target
|
|
9316
|
+
*/ ComponentCloner.cloneComponent = function cloneComponent(source, target) {
|
|
9317
|
+
var cloneModes = CloneManager.getCloneMode(source.constructor);
|
|
9318
|
+
var keys = Object.keys(source);
|
|
9319
|
+
for(var i = 0, n = keys.length; i < n; i++){
|
|
9320
|
+
var k = keys[i];
|
|
9321
|
+
var cloneMode = cloneModes[k];
|
|
9322
|
+
switch(cloneMode){
|
|
9323
|
+
case undefined:
|
|
9324
|
+
case CloneMode.Assignment:
|
|
9325
|
+
target[k] = source[k];
|
|
9326
|
+
break;
|
|
9327
|
+
case CloneMode.Shallow:
|
|
9328
|
+
var sourcePropS = source[k];
|
|
9329
|
+
if (_instanceof1$2(sourcePropS, Object)) {
|
|
9330
|
+
var tarProp = target[k];
|
|
9331
|
+
tarProp == null && (tarProp = target[k] = sourcePropS.constructor());
|
|
9332
|
+
Object.assign(tarProp, sourcePropS);
|
|
9333
|
+
} else {
|
|
9334
|
+
// Null or undefined and primitive type.
|
|
9335
|
+
target[k] = sourcePropS;
|
|
9336
|
+
}
|
|
9337
|
+
break;
|
|
9338
|
+
case CloneMode.Deep:
|
|
9339
|
+
var sourcePropD = source[k];
|
|
9340
|
+
if (_instanceof1$2(sourcePropD, Object)) {
|
|
9341
|
+
var tarProp1 = target[k];
|
|
9342
|
+
tarProp1 == null && (tarProp1 = target[k] = sourcePropD.constructor());
|
|
9343
|
+
CloneManager.deepCloneObject(sourcePropD, tarProp1);
|
|
9344
|
+
} else {
|
|
9345
|
+
// Null or undefined and primitive type.
|
|
9346
|
+
target[k] = sourcePropD;
|
|
9347
|
+
}
|
|
9348
|
+
break;
|
|
9349
|
+
}
|
|
9350
|
+
}
|
|
9351
|
+
if (source._cloneTo) {
|
|
9352
|
+
source._cloneTo(target);
|
|
9353
|
+
}
|
|
9354
|
+
};
|
|
9355
|
+
return ComponentCloner;
|
|
9356
|
+
}();
|
|
9354
9357
|
/**
|
|
9355
9358
|
* Entity, be used as components container.
|
|
9356
9359
|
*/ var Entity = /*#__PURE__*/ function(EngineObject) {
|
|
@@ -10076,14 +10079,14 @@
|
|
|
10076
10079
|
Keys[Keys[/** Tab or ⇥. */ "Tab"] = 63] = "Tab";
|
|
10077
10080
|
Keys[Keys[/** Japanese: 変換 (henkan). */ "Convert"] = 64] = "Convert";
|
|
10078
10081
|
Keys[Keys[/** Japanese: カタカナ/ひらがな/ローマ字 (katakana/hiragana/romaji). */ "KanaMode"] = 65] = "KanaMode";
|
|
10079
|
-
Keys[Keys[/**
|
|
10080
|
-
* Korean: HangulMode 한/영 (han/yeong).
|
|
10081
|
-
* Japanese (Mac keyboard): かな (kana).
|
|
10082
|
-
* */ "Lang1"] = 66] = "Lang1";
|
|
10083
10082
|
Keys[Keys[/**
|
|
10084
|
-
|
|
10085
|
-
|
|
10086
|
-
|
|
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";
|
|
10087
10090
|
Keys[Keys[/** Japanese (word-processing keyboard): Katakana. */ "Lang3"] = 68] = "Lang3";
|
|
10088
10091
|
Keys[Keys[/** Japanese (word-processing keyboard): Hiragana. */ "Lang4"] = 69] = "Lang4";
|
|
10089
10092
|
Keys[Keys[/** Japanese (word-processing keyboard): Zenkaku/Hankaku. */ "Lang5"] = 70] = "Lang5";
|
|
@@ -10100,46 +10103,46 @@
|
|
|
10100
10103
|
Keys[Keys[/** → */ "ArrowRight"] = 81] = "ArrowRight";
|
|
10101
10104
|
Keys[Keys[/** ↑ */ "ArrowUp"] = 82] = "ArrowUp";
|
|
10102
10105
|
Keys[Keys[/** On the Mac, the "NumLock" code should be used for the numpad Clear key. */ "NumLock"] = 83] = "NumLock";
|
|
10103
|
-
Keys[Keys[/**
|
|
10104
|
-
* 0 Ins on a keyboard.
|
|
10105
|
-
* 0 on a phone or remote control.
|
|
10106
|
-
* */ "Numpad0"] = 84] = "Numpad0";
|
|
10107
10106
|
Keys[Keys[/**
|
|
10108
|
-
|
|
10109
|
-
|
|
10110
|
-
|
|
10107
|
+
* 0 Ins on a keyboard.
|
|
10108
|
+
* 0 on a phone or remote control.
|
|
10109
|
+
* */ "Numpad0"] = 84] = "Numpad0";
|
|
10111
10110
|
Keys[Keys[/**
|
|
10112
|
-
|
|
10113
|
-
|
|
10114
|
-
|
|
10111
|
+
* 1 End on a keyboard.
|
|
10112
|
+
* 1 or 1 QZ on a phone or remote control.
|
|
10113
|
+
*/ "Numpad1"] = 85] = "Numpad1";
|
|
10115
10114
|
Keys[Keys[/**
|
|
10116
|
-
|
|
10117
|
-
|
|
10118
|
-
|
|
10115
|
+
* 2 ↓ on a keyboard.
|
|
10116
|
+
* 2 ABC on a phone or remote control.
|
|
10117
|
+
*/ "Numpad2"] = 86] = "Numpad2";
|
|
10119
10118
|
Keys[Keys[/**
|
|
10120
|
-
|
|
10121
|
-
|
|
10122
|
-
|
|
10119
|
+
* 3 PgDn on a keyboard.
|
|
10120
|
+
* 3 DEF on a phone or remote control.
|
|
10121
|
+
*/ "Numpad3"] = 87] = "Numpad3";
|
|
10123
10122
|
Keys[Keys[/**
|
|
10124
|
-
|
|
10125
|
-
|
|
10126
|
-
|
|
10123
|
+
* 4 ← on a keyboard.
|
|
10124
|
+
* 4 GHI on a phone or remote control.
|
|
10125
|
+
*/ "Numpad4"] = 88] = "Numpad4";
|
|
10127
10126
|
Keys[Keys[/**
|
|
10128
|
-
|
|
10129
|
-
|
|
10130
|
-
|
|
10127
|
+
* 5 on a keyboard.
|
|
10128
|
+
* 5 JKL on a phone or remote control.
|
|
10129
|
+
*/ "Numpad5"] = 89] = "Numpad5";
|
|
10131
10130
|
Keys[Keys[/**
|
|
10132
|
-
|
|
10133
|
-
|
|
10134
|
-
|
|
10131
|
+
* 6 → on a keyboard.
|
|
10132
|
+
* 6 MNO on a phone or remote control.
|
|
10133
|
+
*/ "Numpad6"] = 90] = "Numpad6";
|
|
10135
10134
|
Keys[Keys[/**
|
|
10136
|
-
|
|
10137
|
-
|
|
10138
|
-
|
|
10135
|
+
* 7 Home on a keyboard.
|
|
10136
|
+
* 7 PQRS or 7 PRS on a phone or remote control.
|
|
10137
|
+
*/ "Numpad7"] = 91] = "Numpad7";
|
|
10139
10138
|
Keys[Keys[/**
|
|
10140
|
-
|
|
10141
|
-
|
|
10142
|
-
|
|
10139
|
+
* 8 ↑ on a keyboard.
|
|
10140
|
+
* 8 TUV on a phone or remote control.
|
|
10141
|
+
*/ "Numpad8"] = 92] = "Numpad8";
|
|
10142
|
+
Keys[Keys[/**
|
|
10143
|
+
* 9 PgUp on a keyboard.
|
|
10144
|
+
* 9 WXYZ or 9 WXY on a phone or remote control.
|
|
10145
|
+
*/ "Numpad9"] = 93] = "Numpad9";
|
|
10143
10146
|
Keys[Keys[/** + */ "NumpadAdd"] = 94] = "NumpadAdd";
|
|
10144
10147
|
Keys[Keys[/** Found on the Microsoft Natural Keyboard. */ "NumpadBackspace"] = 95] = "NumpadBackspace";
|
|
10145
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";
|
|
@@ -10155,16 +10158,16 @@
|
|
|
10155
10158
|
Keys[Keys[/** MR Replace the current entry with the value stored in memory. */ "NumpadMemoryRecall"] = 106] = "NumpadMemoryRecall";
|
|
10156
10159
|
Keys[Keys[/** MS Replace the value stored in memory with the current entry. */ "NumpadMemoryStore"] = 107] = "NumpadMemoryStore";
|
|
10157
10160
|
Keys[Keys[/** M- Subtract current entry from the value stored in memory. */ "NumpadMemorySubtract"] = 108] = "NumpadMemorySubtract";
|
|
10158
|
-
Keys[Keys[/**
|
|
10159
|
-
|
|
10160
|
-
|
|
10161
|
-
|
|
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";
|
|
10162
10165
|
Keys[Keys[/** ( Found on the Microsoft Natural Keyboard. */ "NumpadParenLeft"] = 110] = "NumpadParenLeft";
|
|
10163
10166
|
Keys[Keys[/** ) Found on the Microsoft Natural Keyboard. */ "NumpadParenRight"] = 111] = "NumpadParenRight";
|
|
10164
10167
|
Keys[Keys[/**
|
|
10165
|
-
|
|
10166
|
-
|
|
10167
|
-
|
|
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";
|
|
10168
10171
|
Keys[Keys[/** - */ "NumpadSubtract"] = 113] = "NumpadSubtract";
|
|
10169
10172
|
Keys[Keys[/** Esc or ⎋. */ "Escape"] = 114] = "Escape";
|
|
10170
10173
|
Keys[Keys[/** F1 */ "F1"] = 115] = "F1";
|
|
@@ -10821,19 +10824,16 @@
|
|
|
10821
10824
|
* @internal
|
|
10822
10825
|
*/ _proto._onLateUpdate = function _onLateUpdate() {};
|
|
10823
10826
|
/**
|
|
10824
|
-
* @override
|
|
10825
10827
|
* @internal
|
|
10826
10828
|
*/ _proto._onEnable = function _onEnable() {
|
|
10827
10829
|
this.engine.physicsManager._addCollider(this);
|
|
10828
10830
|
};
|
|
10829
10831
|
/**
|
|
10830
|
-
* @override
|
|
10831
10832
|
* @internal
|
|
10832
10833
|
*/ _proto._onDisable = function _onDisable() {
|
|
10833
10834
|
this.engine.physicsManager._removeCollider(this);
|
|
10834
10835
|
};
|
|
10835
10836
|
/**
|
|
10836
|
-
* @override
|
|
10837
10837
|
* @internal
|
|
10838
10838
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
10839
10839
|
Component.prototype._onDestroy.call(this);
|
|
@@ -10871,7 +10871,6 @@
|
|
|
10871
10871
|
var CharacterController = function CharacterController(entity) {
|
|
10872
10872
|
var _this;
|
|
10873
10873
|
_this = Collider.call(this, entity) || this;
|
|
10874
|
-
/** @internal */ _this._index = -1;
|
|
10875
10874
|
_this._stepOffset = 0.5;
|
|
10876
10875
|
_this._nonWalkableMode = exports.ControllerNonWalkableMode.PreventClimbing;
|
|
10877
10876
|
_this._upDirection = new Vector3(0, 1, 0);
|
|
@@ -10896,7 +10895,6 @@
|
|
|
10896
10895
|
/**
|
|
10897
10896
|
* Add collider shape on this controller.
|
|
10898
10897
|
* @param shape - Collider shape
|
|
10899
|
-
* @override
|
|
10900
10898
|
*/ _proto.addShape = function addShape(shape) {
|
|
10901
10899
|
if (this._shapes.length > 0) {
|
|
10902
10900
|
throw "only allow single shape on controller!";
|
|
@@ -10906,7 +10904,6 @@
|
|
|
10906
10904
|
};
|
|
10907
10905
|
/**
|
|
10908
10906
|
* Remove all shape attached.
|
|
10909
|
-
* @override
|
|
10910
10907
|
*/ _proto.clearShapes = function clearShapes() {
|
|
10911
10908
|
if (this._shapes.length > 0) {
|
|
10912
10909
|
Collider.prototype.removeShape.call(this, this._shapes[0]);
|
|
@@ -10914,7 +10911,6 @@
|
|
|
10914
10911
|
};
|
|
10915
10912
|
/**
|
|
10916
10913
|
* @internal
|
|
10917
|
-
* @override
|
|
10918
10914
|
*/ _proto._onUpdate = function _onUpdate() {
|
|
10919
10915
|
if (this._updateFlag.flag) {
|
|
10920
10916
|
var transform = this.entity.transform;
|
|
@@ -10929,7 +10925,6 @@
|
|
|
10929
10925
|
};
|
|
10930
10926
|
/**
|
|
10931
10927
|
* @internal
|
|
10932
|
-
* @override
|
|
10933
10928
|
*/ _proto._onLateUpdate = function _onLateUpdate() {
|
|
10934
10929
|
var position = this.entity.transform.worldPosition;
|
|
10935
10930
|
this._nativeCollider.getWorldPosition(position);
|
|
@@ -10937,13 +10932,11 @@
|
|
|
10937
10932
|
this._updateFlag.flag = false;
|
|
10938
10933
|
};
|
|
10939
10934
|
/**
|
|
10940
|
-
* @override
|
|
10941
10935
|
* @internal
|
|
10942
10936
|
*/ _proto._onEnable = function _onEnable() {
|
|
10943
10937
|
this.engine.physicsManager._addCharacterController(this);
|
|
10944
10938
|
};
|
|
10945
10939
|
/**
|
|
10946
|
-
* @override
|
|
10947
10940
|
* @internal
|
|
10948
10941
|
*/ _proto._onDisable = function _onDisable() {
|
|
10949
10942
|
this.engine.physicsManager._removeCharacterController(this);
|
|
@@ -11428,7 +11421,6 @@
|
|
|
11428
11421
|
_inherits$2(FixedJoint, Joint);
|
|
11429
11422
|
var _proto = FixedJoint.prototype;
|
|
11430
11423
|
/**
|
|
11431
|
-
* @override
|
|
11432
11424
|
* @internal
|
|
11433
11425
|
*/ _proto._onAwake = function _onAwake() {
|
|
11434
11426
|
var collider = this._collider;
|
|
@@ -11460,7 +11452,6 @@
|
|
|
11460
11452
|
_inherits$2(HingeJoint, Joint);
|
|
11461
11453
|
var _proto = HingeJoint.prototype;
|
|
11462
11454
|
/**
|
|
11463
|
-
* @override
|
|
11464
11455
|
* @internal
|
|
11465
11456
|
*/ _proto._onAwake = function _onAwake() {
|
|
11466
11457
|
var collider = this._collider;
|
|
@@ -11611,7 +11602,6 @@
|
|
|
11611
11602
|
_inherits$2(SpringJoint, Joint);
|
|
11612
11603
|
var _proto = SpringJoint.prototype;
|
|
11613
11604
|
/**
|
|
11614
|
-
* @override
|
|
11615
11605
|
* @internal
|
|
11616
11606
|
*/ _proto._onAwake = function _onAwake() {
|
|
11617
11607
|
var collider = this._collider;
|
|
@@ -11811,7 +11801,6 @@
|
|
|
11811
11801
|
this._nativeCollider.wakeUp();
|
|
11812
11802
|
};
|
|
11813
11803
|
/**
|
|
11814
|
-
* @override
|
|
11815
11804
|
* @internal
|
|
11816
11805
|
*/ _proto._onLateUpdate = function _onLateUpdate() {
|
|
11817
11806
|
var transform = this.entity.transform;
|
|
@@ -12670,7 +12659,10 @@
|
|
|
12670
12659
|
};
|
|
12671
12660
|
_inherits$2(Light, Component);
|
|
12672
12661
|
var _proto = Light.prototype;
|
|
12673
|
-
|
|
12662
|
+
/**
|
|
12663
|
+
* Light Color, include intensity.
|
|
12664
|
+
* @internal
|
|
12665
|
+
*/ _proto._getLightIntensityColor = function _getLightIntensityColor() {
|
|
12674
12666
|
this._lightColor.r = this.color.r * this.intensity;
|
|
12675
12667
|
this._lightColor.g = this.color.g * this.intensity;
|
|
12676
12668
|
this._lightColor.b = this.color.b * this.intensity;
|
|
@@ -12739,15 +12731,21 @@
|
|
|
12739
12731
|
var cullingMaskStart = lightIndex * 2;
|
|
12740
12732
|
var colorStart = lightIndex * 3;
|
|
12741
12733
|
var directionStart = lightIndex * 3;
|
|
12742
|
-
var lightColor = this.
|
|
12734
|
+
var lightColor = this._getLightIntensityColor();
|
|
12743
12735
|
var direction = this.direction;
|
|
12744
12736
|
var data = DirectLight._combinedData;
|
|
12745
12737
|
var cullingMask = this.cullingMask;
|
|
12746
12738
|
data.cullingMask[cullingMaskStart] = cullingMask & 65535;
|
|
12747
12739
|
data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
|
|
12748
|
-
|
|
12749
|
-
|
|
12750
|
-
|
|
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
|
+
}
|
|
12751
12749
|
data.direction[directionStart] = direction.x;
|
|
12752
12750
|
data.direction[directionStart + 1] = direction.y;
|
|
12753
12751
|
data.direction[directionStart + 2] = direction.z;
|
|
@@ -12755,14 +12753,12 @@
|
|
|
12755
12753
|
/**
|
|
12756
12754
|
* Mount to the current Scene.
|
|
12757
12755
|
* @internal
|
|
12758
|
-
* @override
|
|
12759
12756
|
*/ _proto._onEnable = function _onEnable() {
|
|
12760
12757
|
this.engine._lightManager._attachDirectLight(this);
|
|
12761
12758
|
};
|
|
12762
12759
|
/**
|
|
12763
12760
|
* Unmount from the current Scene.
|
|
12764
12761
|
* @internal
|
|
12765
|
-
* @override
|
|
12766
12762
|
*/ _proto._onDisable = function _onDisable() {
|
|
12767
12763
|
this.engine._lightManager._detachDirectLight(this);
|
|
12768
12764
|
};
|
|
@@ -12796,7 +12792,6 @@
|
|
|
12796
12792
|
key: "_shadowProjectionMatrix",
|
|
12797
12793
|
get: /**
|
|
12798
12794
|
* @internal
|
|
12799
|
-
* @override
|
|
12800
12795
|
*/ function get() {
|
|
12801
12796
|
throw "Unknown!";
|
|
12802
12797
|
}
|
|
@@ -12838,15 +12833,21 @@
|
|
|
12838
12833
|
var colorStart = lightIndex * 3;
|
|
12839
12834
|
var positionStart = lightIndex * 3;
|
|
12840
12835
|
var distanceStart = lightIndex;
|
|
12841
|
-
var lightColor = this.
|
|
12836
|
+
var lightColor = this._getLightIntensityColor();
|
|
12842
12837
|
var lightPosition = this.position;
|
|
12843
12838
|
var data = PointLight._combinedData;
|
|
12844
12839
|
var cullingMask = this.cullingMask;
|
|
12845
12840
|
data.cullingMask[cullingMaskStart] = cullingMask & 65535;
|
|
12846
12841
|
data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
|
|
12847
|
-
|
|
12848
|
-
|
|
12849
|
-
|
|
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
|
+
}
|
|
12850
12851
|
data.position[positionStart] = lightPosition.x;
|
|
12851
12852
|
data.position[positionStart + 1] = lightPosition.y;
|
|
12852
12853
|
data.position[positionStart + 2] = lightPosition.z;
|
|
@@ -12855,14 +12856,12 @@
|
|
|
12855
12856
|
/**
|
|
12856
12857
|
* Mount to the current Scene.
|
|
12857
12858
|
* @internal
|
|
12858
|
-
* @override
|
|
12859
12859
|
*/ _proto._onEnable = function _onEnable() {
|
|
12860
12860
|
this.engine._lightManager._attachPointLight(this);
|
|
12861
12861
|
};
|
|
12862
12862
|
/**
|
|
12863
12863
|
* Unmount from the current Scene.
|
|
12864
12864
|
* @internal
|
|
12865
|
-
* @override
|
|
12866
12865
|
*/ _proto._onDisable = function _onDisable() {
|
|
12867
12866
|
this.engine._lightManager._detachPointLight(this);
|
|
12868
12867
|
};
|
|
@@ -12888,7 +12887,6 @@
|
|
|
12888
12887
|
key: "_shadowProjectionMatrix",
|
|
12889
12888
|
get: /**
|
|
12890
12889
|
* @internal
|
|
12891
|
-
* @override
|
|
12892
12890
|
*/ function get() {
|
|
12893
12891
|
throw "Unknown!";
|
|
12894
12892
|
}
|
|
@@ -12941,16 +12939,22 @@
|
|
|
12941
12939
|
var distanceStart = lightIndex;
|
|
12942
12940
|
var penumbraCosStart = lightIndex;
|
|
12943
12941
|
var angleCosStart = lightIndex;
|
|
12944
|
-
var
|
|
12942
|
+
var lightColor = this._getLightIntensityColor();
|
|
12945
12943
|
var position = this.position;
|
|
12946
12944
|
var direction = this.direction;
|
|
12947
12945
|
var data = SpotLight._combinedData;
|
|
12948
12946
|
var cullingMask = this.cullingMask;
|
|
12949
12947
|
data.cullingMask[cullingMaskStart] = cullingMask & 65535;
|
|
12950
12948
|
data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
|
|
12951
|
-
|
|
12952
|
-
|
|
12953
|
-
|
|
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
|
+
}
|
|
12954
12958
|
data.position[positionStart] = position.x;
|
|
12955
12959
|
data.position[positionStart + 1] = position.y;
|
|
12956
12960
|
data.position[positionStart + 2] = position.z;
|
|
@@ -12964,14 +12968,12 @@
|
|
|
12964
12968
|
/**
|
|
12965
12969
|
* Mount to the current Scene.
|
|
12966
12970
|
* @internal
|
|
12967
|
-
* @override
|
|
12968
12971
|
*/ _proto._onEnable = function _onEnable() {
|
|
12969
12972
|
this.engine._lightManager._attachSpotLight(this);
|
|
12970
12973
|
};
|
|
12971
12974
|
/**
|
|
12972
12975
|
* Unmount from the current Scene.
|
|
12973
12976
|
* @internal
|
|
12974
|
-
* @override
|
|
12975
12977
|
*/ _proto._onDisable = function _onDisable() {
|
|
12976
12978
|
this.engine._lightManager._detachSpotLight(this);
|
|
12977
12979
|
};
|
|
@@ -13017,7 +13019,6 @@
|
|
|
13017
13019
|
key: "_shadowProjectionMatrix",
|
|
13018
13020
|
get: /**
|
|
13019
13021
|
* @internal
|
|
13020
|
-
* @override
|
|
13021
13022
|
*/ function get() {
|
|
13022
13023
|
var matrix = this._projectMatrix;
|
|
13023
13024
|
var fov = Math.min(Math.PI / 2, this.angle * 2 * Math.sqrt(2));
|
|
@@ -13590,6 +13591,7 @@
|
|
|
13590
13591
|
_proto.cloneTo = function cloneTo(target) {
|
|
13591
13592
|
CloneManager.deepCloneObject(this._macroCollection, target._macroCollection);
|
|
13592
13593
|
Object.assign(target._macroMap, this._macroMap);
|
|
13594
|
+
var referCount = target._getReferCount();
|
|
13593
13595
|
var propertyValueMap = this._propertyValueMap;
|
|
13594
13596
|
var targetPropertyValueMap = target._propertyValueMap;
|
|
13595
13597
|
var keys = Object.keys(propertyValueMap);
|
|
@@ -13601,6 +13603,7 @@
|
|
|
13601
13603
|
targetPropertyValueMap[k] = property;
|
|
13602
13604
|
} else if (_instanceof1$2(property, Texture)) {
|
|
13603
13605
|
targetPropertyValueMap[k] = property;
|
|
13606
|
+
referCount > 0 && property._addReferCount(referCount);
|
|
13604
13607
|
} else if (_instanceof1$2(property, Array) || _instanceof1$2(property, Float32Array) || _instanceof1$2(property, Int32Array)) {
|
|
13605
13608
|
targetPropertyValueMap[k] = property.slice();
|
|
13606
13609
|
} else {
|
|
@@ -14166,9 +14169,7 @@
|
|
|
14166
14169
|
this.shaderData.cloneTo(target.shaderData);
|
|
14167
14170
|
CloneManager.deepCloneObject(this.renderStates, target.renderStates);
|
|
14168
14171
|
};
|
|
14169
|
-
|
|
14170
|
-
* @override
|
|
14171
|
-
*/ _proto._addReferCount = function _addReferCount(value) {
|
|
14172
|
+
_proto._addReferCount = function _addReferCount(value) {
|
|
14172
14173
|
ReferResource.prototype._addReferCount.call(this, value);
|
|
14173
14174
|
this.shaderData._addReferCount(value);
|
|
14174
14175
|
};
|
|
@@ -14282,31 +14283,31 @@
|
|
|
14282
14283
|
}
|
|
14283
14284
|
var camera_declare = "#define GLSLIFY 1\nuniform vec3 camera_Position;"; // eslint-disable-line
|
|
14284
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
|
|
14285
|
-
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
|
|
14286
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
|
|
14287
|
-
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
|
|
14288
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
|
|
14289
14290
|
var FogVertexDeclaration = "#define GLSLIFY 1\n#if SCENE_FOG_MODE != 0\nvarying vec3 v_positionVS;\n#endif\n"; // eslint-disable-line
|
|
14290
|
-
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(
|
|
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
|
|
14291
14292
|
var uv_share = "#define GLSLIFY 1\nvarying vec2 v_uv;\n#ifdef RENDERER_HAS_UV1\nvarying vec2 v_uv1;\n#endif\n"; // eslint-disable-line
|
|
14292
|
-
var worldpos_share = "#define GLSLIFY 1\n#ifdef
|
|
14293
|
+
var worldpos_share = "#define GLSLIFY 1\n#ifdef MATERIAL_NEED_WORLD_POS\nvarying vec3 v_pos;\n#endif\n"; // eslint-disable-line
|
|
14293
14294
|
var begin_normal_vert = "#define GLSLIFY 1\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef RENDERER_HAS_NORMAL\nvec3 normal=vec3(NORMAL);\n#endif\n#ifdef RENDERER_HAS_TANGENT\nvec4 tangent=vec4(TANGENT);\n#endif\n#endif\n"; // eslint-disable-line
|
|
14294
14295
|
var begin_position_vert = "#define GLSLIFY 1\nvec4 position=vec4(POSITION,1.0);"; // eslint-disable-line
|
|
14295
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
|
|
14296
|
-
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(
|
|
14297
|
-
var color_vert = "#define GLSLIFY 1\n#ifdef
|
|
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
|
|
14298
|
+
var color_vert = "#define GLSLIFY 1\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\nv_color=COLOR_0;\n#endif\n"; // eslint-disable-line
|
|
14298
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
|
|
14299
|
-
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(
|
|
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
|
|
14300
14301
|
var position_vert = "#define GLSLIFY 1\ngl_Position=renderer_MVPMat*position;"; // eslint-disable-line
|
|
14301
|
-
var skinning_vert = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_SKIN\n#ifdef RENDERER_USE_JOINT_TEXTURE\nmat4 skinMatrix=WEIGHTS_0.x*getJointMatrix(renderer_JointSampler,JOINTS_0.x)+WEIGHTS_0.y*getJointMatrix(renderer_JointSampler,JOINTS_0.y)+WEIGHTS_0.z*getJointMatrix(renderer_JointSampler,JOINTS_0.z)+WEIGHTS_0.w*getJointMatrix(renderer_JointSampler,JOINTS_0.w);\n#else\nmat4 skinMatrix=WEIGHTS_0.x*renderer_JointMatrix[int(JOINTS_0.x)]+WEIGHTS_0.y*renderer_JointMatrix[int(JOINTS_0.y)]+WEIGHTS_0.z*renderer_JointMatrix[int(JOINTS_0.z)]+WEIGHTS_0.w*renderer_JointMatrix[int(JOINTS_0.w)];\n#endif\nposition=skinMatrix*position;\n#if defined(RENDERER_HAS_NORMAL) && !defined(MATERIAL_OMIT_NORMAL)\nmat3 skinNormalMatrix=INVERSE_MAT(mat3(skinMatrix));normal=normal*skinNormalMatrix;\n#if defined(RENDERER_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(
|
|
14302
|
-
var uv_vert = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_UV\nv_uv=TEXCOORD_0;\n#else\nv_uv=vec2(0.,0.);\n#endif\n#ifdef RENDERER_HAS_UV1\nv_uv1=TEXCOORD_1;\n#endif\n#ifdef
|
|
14303
|
-
var worldpos_vert = "#define GLSLIFY 1\n#ifdef
|
|
14302
|
+
var skinning_vert = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_SKIN\n#ifdef RENDERER_USE_JOINT_TEXTURE\nmat4 skinMatrix=WEIGHTS_0.x*getJointMatrix(renderer_JointSampler,JOINTS_0.x)+WEIGHTS_0.y*getJointMatrix(renderer_JointSampler,JOINTS_0.y)+WEIGHTS_0.z*getJointMatrix(renderer_JointSampler,JOINTS_0.z)+WEIGHTS_0.w*getJointMatrix(renderer_JointSampler,JOINTS_0.w);\n#else\nmat4 skinMatrix=WEIGHTS_0.x*renderer_JointMatrix[int(JOINTS_0.x)]+WEIGHTS_0.y*renderer_JointMatrix[int(JOINTS_0.y)]+WEIGHTS_0.z*renderer_JointMatrix[int(JOINTS_0.z)]+WEIGHTS_0.w*renderer_JointMatrix[int(JOINTS_0.w)];\n#endif\nposition=skinMatrix*position;\n#if defined(RENDERER_HAS_NORMAL) && !defined(MATERIAL_OMIT_NORMAL)\nmat3 skinNormalMatrix=INVERSE_MAT(mat3(skinMatrix));normal=normal*skinNormalMatrix;\n#if defined(RENDERER_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\ntangent.xyz=tangent.xyz*skinNormalMatrix;\n#endif\n#endif\n#endif\n"; // eslint-disable-line
|
|
14303
|
+
var uv_vert = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_UV\nv_uv=TEXCOORD_0;\n#else\nv_uv=vec2(0.,0.);\n#endif\n#ifdef RENDERER_HAS_UV1\nv_uv1=TEXCOORD_1;\n#endif\n#ifdef MATERIAL_NEED_TILING_OFFSET\nv_uv=v_uv*material_TilingOffset.xy+material_TilingOffset.zw;\n#endif\n"; // eslint-disable-line
|
|
14304
|
+
var worldpos_vert = "#define GLSLIFY 1\n#ifdef MATERIAL_NEED_WORLD_POS\nvec4 temp_pos=renderer_ModelMat*position;v_pos=temp_pos.xyz/temp_pos.w;\n#endif\n"; // eslint-disable-line
|
|
14304
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
|
|
14305
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
|
|
14306
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
|
|
14307
|
-
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_viewdir_frag = "#define GLSLIFY 1\n#ifdef
|
|
14309
|
-
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
|
|
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
|
|
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
|
|
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
|
|
14310
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
|
|
14311
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
|
|
14312
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
|
|
@@ -14323,12 +14324,12 @@
|
|
|
14323
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
|
|
14324
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
|
|
14325
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
|
|
14326
|
-
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
|
|
14327
|
-
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(
|
|
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
|
|
14328
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
|
|
14329
|
-
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
|
|
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
|
|
14330
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
|
|
14331
|
-
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
|
|
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
|
|
14332
14333
|
var PBRShaderLib = {
|
|
14333
14334
|
pbr_frag_define: pbr_frag_define,
|
|
14334
14335
|
pbr_helper: pbr_helper,
|
|
@@ -14349,7 +14350,7 @@
|
|
|
14349
14350
|
ShadowVertexDeclaration: ShadowVertexDeclaration,
|
|
14350
14351
|
ShadowVertex: ShadowVertex
|
|
14351
14352
|
};
|
|
14352
|
-
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
|
|
14353
14354
|
var ShaderLib = _extends$2({
|
|
14354
14355
|
common: common,
|
|
14355
14356
|
common_vert: common_vert,
|
|
@@ -15450,7 +15451,6 @@
|
|
|
15450
15451
|
};
|
|
15451
15452
|
_proto.update = function update(deltaTime) {};
|
|
15452
15453
|
/**
|
|
15453
|
-
* @override
|
|
15454
15454
|
* @internal
|
|
15455
15455
|
*/ _proto._onEnable = function _onEnable() {
|
|
15456
15456
|
var componentsManager = this.engine._componentsManager;
|
|
@@ -15460,7 +15460,6 @@
|
|
|
15460
15460
|
componentsManager.addRenderer(this);
|
|
15461
15461
|
};
|
|
15462
15462
|
/**
|
|
15463
|
-
* @override
|
|
15464
15463
|
* @internal
|
|
15465
15464
|
*/ _proto._onDisable = function _onDisable() {
|
|
15466
15465
|
var componentsManager = this.engine._componentsManager;
|
|
@@ -15487,7 +15486,14 @@
|
|
|
15487
15486
|
ShaderMacroCollection.unionCollection(context.camera._globalShaderMacro, this.shaderData._macroCollection, this._globalShaderMacro);
|
|
15488
15487
|
};
|
|
15489
15488
|
/**
|
|
15490
|
-
* @
|
|
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
|
+
/**
|
|
15491
15497
|
* @internal
|
|
15492
15498
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
15493
15499
|
Component.prototype._onDestroy.call(this);
|
|
@@ -15499,14 +15505,18 @@
|
|
|
15499
15505
|
(_materials_i = materials[i]) == null ? void 0 : _materials_i._addReferCount(-1);
|
|
15500
15506
|
}
|
|
15501
15507
|
};
|
|
15502
|
-
|
|
15508
|
+
/**
|
|
15509
|
+
* @internal
|
|
15510
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
15503
15511
|
var entity = this.entity;
|
|
15504
15512
|
var worldMatrix = entity.transform.worldMatrix;
|
|
15505
15513
|
this._updateTransformShaderData(context, worldMatrix);
|
|
15506
15514
|
var layer = entity.layer;
|
|
15507
15515
|
this._rendererLayer.set(layer & 65535, layer >>> 16 & 65535, 0, 0);
|
|
15508
15516
|
};
|
|
15509
|
-
|
|
15517
|
+
/**
|
|
15518
|
+
* @internal
|
|
15519
|
+
*/ _proto._updateTransformShaderData = function _updateTransformShaderData(context, worldMatrix) {
|
|
15510
15520
|
var shaderData = this.shaderData;
|
|
15511
15521
|
var virtualCamera = context.virtualCamera;
|
|
15512
15522
|
var mvMatrix = this._mvMatrix;
|
|
@@ -15525,14 +15535,22 @@
|
|
|
15525
15535
|
shaderData.setMatrix(exports.Renderer._mvInvMatrixProperty, mvInvMatrix);
|
|
15526
15536
|
shaderData.setMatrix(exports.Renderer._normalMatrixProperty, normalMatrix);
|
|
15527
15537
|
};
|
|
15528
|
-
|
|
15538
|
+
/**
|
|
15539
|
+
* @internal
|
|
15540
|
+
*/ _proto._registerEntityTransformListener = function _registerEntityTransformListener() {
|
|
15529
15541
|
this.entity.transform._updateFlagManager.addListener(this._onTransformChanged);
|
|
15530
15542
|
};
|
|
15531
|
-
|
|
15532
|
-
|
|
15543
|
+
/**
|
|
15544
|
+
* @internal
|
|
15545
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {};
|
|
15546
|
+
/**
|
|
15547
|
+
* @internal
|
|
15548
|
+
*/ _proto._render = function _render(context) {
|
|
15533
15549
|
throw "not implement";
|
|
15534
15550
|
};
|
|
15535
|
-
|
|
15551
|
+
/**
|
|
15552
|
+
* @internal
|
|
15553
|
+
*/ _proto._createInstanceMaterial = function _createInstanceMaterial(material, index) {
|
|
15536
15554
|
var insMaterial = material.clone();
|
|
15537
15555
|
insMaterial.name = insMaterial.name + "(Instance)";
|
|
15538
15556
|
material._addReferCount(-1);
|
|
@@ -15555,7 +15573,9 @@
|
|
|
15555
15573
|
materials[index] = material;
|
|
15556
15574
|
}
|
|
15557
15575
|
};
|
|
15558
|
-
|
|
15576
|
+
/**
|
|
15577
|
+
* @internal
|
|
15578
|
+
*/ _proto._onTransformChanged = function _onTransformChanged(type) {
|
|
15559
15579
|
this._dirtyUpdateFlag |= 0x1;
|
|
15560
15580
|
};
|
|
15561
15581
|
_create_class$3(Renderer1, [
|
|
@@ -15668,7 +15688,7 @@
|
|
|
15668
15688
|
ignoreClone
|
|
15669
15689
|
], exports.Renderer.prototype, "_overrideUpdate", void 0);
|
|
15670
15690
|
__decorate$1([
|
|
15671
|
-
|
|
15691
|
+
ignoreClone
|
|
15672
15692
|
], exports.Renderer.prototype, "_materials", void 0);
|
|
15673
15693
|
__decorate$1([
|
|
15674
15694
|
ignoreClone
|
|
@@ -15855,8 +15875,10 @@
|
|
|
15855
15875
|
_this = Renderer.call(this, entity) || this;
|
|
15856
15876
|
/** The mask layers the sprite mask influence to. */ _this.influenceLayers = exports.SpriteMaskLayer.Everything;
|
|
15857
15877
|
_this._sprite = null;
|
|
15858
|
-
_this.
|
|
15859
|
-
_this.
|
|
15878
|
+
_this._automaticWidth = 0;
|
|
15879
|
+
_this._automaticHeight = 0;
|
|
15880
|
+
_this._customWidth = undefined;
|
|
15881
|
+
_this._customHeight = undefined;
|
|
15860
15882
|
_this._flipX = false;
|
|
15861
15883
|
_this._flipY = false;
|
|
15862
15884
|
_this._alphaCutoff = 0.5;
|
|
@@ -15871,33 +15893,33 @@
|
|
|
15871
15893
|
/**
|
|
15872
15894
|
* @internal
|
|
15873
15895
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
15896
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
15874
15897
|
target.sprite = this._sprite;
|
|
15875
15898
|
};
|
|
15876
15899
|
/**
|
|
15877
|
-
* @
|
|
15900
|
+
* @internal
|
|
15878
15901
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
15879
|
-
|
|
15880
|
-
|
|
15902
|
+
if (this.sprite) {
|
|
15903
|
+
SimpleSpriteAssembler.updatePositions(this);
|
|
15904
|
+
} else {
|
|
15881
15905
|
worldBounds.min.set(0, 0, 0);
|
|
15882
15906
|
worldBounds.max.set(0, 0, 0);
|
|
15883
|
-
} else {
|
|
15884
|
-
SimpleSpriteAssembler.updatePositions(this);
|
|
15885
15907
|
}
|
|
15886
15908
|
};
|
|
15887
15909
|
/**
|
|
15888
|
-
* @
|
|
15910
|
+
* @internal
|
|
15889
15911
|
* @inheritdoc
|
|
15890
15912
|
*/ _proto._render = function _render(context) {
|
|
15891
15913
|
var _this_sprite;
|
|
15892
15914
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
15893
15915
|
return;
|
|
15894
15916
|
}
|
|
15895
|
-
// Update position
|
|
15917
|
+
// Update position
|
|
15896
15918
|
if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
|
|
15897
15919
|
SimpleSpriteAssembler.updatePositions(this);
|
|
15898
15920
|
this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
|
|
15899
15921
|
}
|
|
15900
|
-
// Update uv
|
|
15922
|
+
// Update uv
|
|
15901
15923
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
15902
15924
|
SimpleSpriteAssembler.updateUVs(this);
|
|
15903
15925
|
this._dirtyUpdateFlag &= ~0x2;
|
|
@@ -15911,20 +15933,39 @@
|
|
|
15911
15933
|
this._maskElement = renderElement;
|
|
15912
15934
|
};
|
|
15913
15935
|
/**
|
|
15914
|
-
* @
|
|
15936
|
+
* @internal
|
|
15915
15937
|
* @inheritdoc
|
|
15916
15938
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
15917
|
-
var _this__sprite;
|
|
15918
15939
|
Renderer.prototype._onDestroy.call(this);
|
|
15919
|
-
|
|
15940
|
+
var sprite = this._sprite;
|
|
15941
|
+
if (sprite) {
|
|
15942
|
+
sprite._addReferCount(-1);
|
|
15943
|
+
sprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
15944
|
+
}
|
|
15920
15945
|
this._sprite = null;
|
|
15921
15946
|
this._verticesData = null;
|
|
15922
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
|
+
};
|
|
15923
15958
|
_proto._onSpriteChange = function _onSpriteChange(type) {
|
|
15924
15959
|
switch(type){
|
|
15925
15960
|
case SpriteModifyFlags.texture:
|
|
15926
15961
|
this.shaderData.setTexture(SpriteMask._textureProperty, this.sprite.texture);
|
|
15927
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;
|
|
15928
15969
|
case SpriteModifyFlags.region:
|
|
15929
15970
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
15930
15971
|
this._dirtyUpdateFlag |= 0x3;
|
|
@@ -15932,22 +15973,31 @@
|
|
|
15932
15973
|
case SpriteModifyFlags.atlasRegion:
|
|
15933
15974
|
this._dirtyUpdateFlag |= 0x2;
|
|
15934
15975
|
break;
|
|
15976
|
+
case SpriteModifyFlags.pivot:
|
|
15977
|
+
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
15978
|
+
break;
|
|
15935
15979
|
}
|
|
15936
15980
|
};
|
|
15937
15981
|
_create_class$3(SpriteMask, [
|
|
15938
15982
|
{
|
|
15939
15983
|
key: "width",
|
|
15940
15984
|
get: /**
|
|
15941
|
-
* 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`.
|
|
15942
15990
|
*/ function get() {
|
|
15943
|
-
if (this.
|
|
15944
|
-
|
|
15991
|
+
if (this._customWidth !== undefined) {
|
|
15992
|
+
return this._customWidth;
|
|
15993
|
+
} else {
|
|
15994
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
15995
|
+
return this._automaticWidth;
|
|
15945
15996
|
}
|
|
15946
|
-
return this._width;
|
|
15947
15997
|
},
|
|
15948
15998
|
set: function set(value) {
|
|
15949
|
-
if (this.
|
|
15950
|
-
this.
|
|
15999
|
+
if (this._customWidth !== value) {
|
|
16000
|
+
this._customWidth = value;
|
|
15951
16001
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
15952
16002
|
}
|
|
15953
16003
|
}
|
|
@@ -15955,16 +16005,22 @@
|
|
|
15955
16005
|
{
|
|
15956
16006
|
key: "height",
|
|
15957
16007
|
get: /**
|
|
15958
|
-
* 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`.
|
|
15959
16013
|
*/ function get() {
|
|
15960
|
-
if (this.
|
|
15961
|
-
|
|
16014
|
+
if (this._customHeight !== undefined) {
|
|
16015
|
+
return this._customHeight;
|
|
16016
|
+
} else {
|
|
16017
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
16018
|
+
return this._automaticHeight;
|
|
15962
16019
|
}
|
|
15963
|
-
return this._height;
|
|
15964
16020
|
},
|
|
15965
16021
|
set: function set(value) {
|
|
15966
|
-
if (this.
|
|
15967
|
-
this.
|
|
16022
|
+
if (this._customHeight !== value) {
|
|
16023
|
+
this._customHeight = value;
|
|
15968
16024
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
15969
16025
|
}
|
|
15970
16026
|
}
|
|
@@ -16007,10 +16063,14 @@
|
|
|
16007
16063
|
set: function set(value) {
|
|
16008
16064
|
var lastSprite = this._sprite;
|
|
16009
16065
|
if (lastSprite !== value) {
|
|
16010
|
-
|
|
16066
|
+
if (lastSprite) {
|
|
16067
|
+
lastSprite._addReferCount(-1);
|
|
16068
|
+
lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
16069
|
+
}
|
|
16070
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
16011
16071
|
if (value) {
|
|
16072
|
+
value._addReferCount(1);
|
|
16012
16073
|
value._updateFlagManager.addListener(this._onSpriteChange);
|
|
16013
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
16014
16074
|
this.shaderData.setTexture(SpriteMask._textureProperty, value.texture);
|
|
16015
16075
|
} else {
|
|
16016
16076
|
this.shaderData.setTexture(SpriteMask._textureProperty, null);
|
|
@@ -16050,10 +16110,16 @@
|
|
|
16050
16110
|
], SpriteMask.prototype, "_sprite", void 0);
|
|
16051
16111
|
__decorate$1([
|
|
16052
16112
|
ignoreClone
|
|
16053
|
-
], SpriteMask.prototype, "
|
|
16113
|
+
], SpriteMask.prototype, "_automaticWidth", void 0);
|
|
16054
16114
|
__decorate$1([
|
|
16055
16115
|
ignoreClone
|
|
16056
|
-
], 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);
|
|
16057
16123
|
__decorate$1([
|
|
16058
16124
|
assignmentClone
|
|
16059
16125
|
], SpriteMask.prototype, "_flipX", void 0);
|
|
@@ -16071,7 +16137,9 @@
|
|
|
16071
16137
|
*/ SpriteMaskUpdateFlags;
|
|
16072
16138
|
(function(SpriteMaskUpdateFlags) {
|
|
16073
16139
|
SpriteMaskUpdateFlags[SpriteMaskUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
|
|
16074
|
-
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";
|
|
16075
16143
|
})(SpriteMaskUpdateFlags || (SpriteMaskUpdateFlags = {}));
|
|
16076
16144
|
/**
|
|
16077
16145
|
* Vertex element format.
|
|
@@ -16325,14 +16393,11 @@
|
|
|
16325
16393
|
if (dataOffset === void 0) dataOffset = 0;
|
|
16326
16394
|
this._platformBuffer.getData(data, bufferByteOffset, dataOffset, dataLength);
|
|
16327
16395
|
};
|
|
16328
|
-
|
|
16329
|
-
* @override
|
|
16330
|
-
*/ _proto._rebuild = function _rebuild() {
|
|
16396
|
+
_proto._rebuild = function _rebuild() {
|
|
16331
16397
|
var platformBuffer = this._engine._hardwareRenderer.createPlatformBuffer(this._type, this._byteLength, this._bufferUsage);
|
|
16332
16398
|
this._platformBuffer = platformBuffer;
|
|
16333
16399
|
};
|
|
16334
16400
|
/**
|
|
16335
|
-
* @override
|
|
16336
16401
|
* @internal
|
|
16337
16402
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
16338
16403
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
@@ -16508,10 +16573,11 @@
|
|
|
16508
16573
|
/**
|
|
16509
16574
|
* @internal
|
|
16510
16575
|
*/ _proto._setVertexBufferBinding = function _setVertexBufferBinding(index, binding) {
|
|
16511
|
-
|
|
16512
|
-
|
|
16513
|
-
|
|
16514
|
-
|
|
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);
|
|
16515
16581
|
}
|
|
16516
16582
|
this._vertexBufferBindings[index] = binding;
|
|
16517
16583
|
this._bufferStructChanged = true;
|
|
@@ -16522,22 +16588,19 @@
|
|
|
16522
16588
|
this._platformPrimitive.draw(shaderProgram, subMesh);
|
|
16523
16589
|
this._bufferStructChanged = false;
|
|
16524
16590
|
};
|
|
16525
|
-
|
|
16526
|
-
|
|
16527
|
-
*/ _proto._addReferCount = function _addReferCount(value) {
|
|
16591
|
+
_proto._addReferCount = function _addReferCount(value) {
|
|
16592
|
+
var _this__indexBufferBinding;
|
|
16528
16593
|
GraphicsResource.prototype._addReferCount.call(this, value);
|
|
16529
16594
|
var vertexBufferBindings = this._vertexBufferBindings;
|
|
16530
16595
|
for(var i = 0, n = vertexBufferBindings.length; i < n; i++){
|
|
16531
16596
|
vertexBufferBindings[i]._buffer._addReferCount(value);
|
|
16532
16597
|
}
|
|
16598
|
+
(_this__indexBufferBinding = this._indexBufferBinding) == null ? void 0 : _this__indexBufferBinding._buffer._addReferCount(value);
|
|
16533
16599
|
};
|
|
16534
|
-
|
|
16535
|
-
* @override
|
|
16536
|
-
*/ _proto._rebuild = function _rebuild() {
|
|
16600
|
+
_proto._rebuild = function _rebuild() {
|
|
16537
16601
|
this._engine._hardwareRenderer.createPlatformPrimitive(this);
|
|
16538
16602
|
};
|
|
16539
16603
|
/**
|
|
16540
|
-
* @override
|
|
16541
16604
|
* @internal
|
|
16542
16605
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
16543
16606
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
@@ -16547,14 +16610,23 @@
|
|
|
16547
16610
|
this._vertexElementMap = null;
|
|
16548
16611
|
this._platformPrimitive.destroy();
|
|
16549
16612
|
};
|
|
16550
|
-
|
|
16613
|
+
/**
|
|
16614
|
+
* @internal
|
|
16615
|
+
*/ _proto._setVertexElements = function _setVertexElements(elements) {
|
|
16551
16616
|
this._clearVertexElements();
|
|
16552
16617
|
for(var i = 0, n = elements.length; i < n; i++){
|
|
16553
16618
|
this._addVertexElement(elements[i]);
|
|
16554
16619
|
}
|
|
16555
16620
|
};
|
|
16556
|
-
|
|
16621
|
+
/**
|
|
16622
|
+
* @internal
|
|
16623
|
+
*/ _proto._setIndexBufferBinding = function _setIndexBufferBinding(binding) {
|
|
16557
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
|
+
}
|
|
16558
16630
|
if (binding) {
|
|
16559
16631
|
this._indexBufferBinding = binding;
|
|
16560
16632
|
this._glIndexType = BufferUtil._getGLIndexType(binding.format);
|
|
@@ -16868,6 +16940,7 @@
|
|
|
16868
16940
|
var subDataDirtyFlags = this._subDataDirtyFlags;
|
|
16869
16941
|
var blendShapeFloatStride = this._vertexElementCount * 3;
|
|
16870
16942
|
var blendShapeByteStride = blendShapeFloatStride * 4;
|
|
16943
|
+
var bufferOffset = this._bufferBindingOffset;
|
|
16871
16944
|
// @todo: should fix bug when dataChangedFlag is true
|
|
16872
16945
|
for(var i = 0, n = blendShapes.length; i < n; i++){
|
|
16873
16946
|
var dataChangedFlag = subDataDirtyFlags[i];
|
|
@@ -16885,7 +16958,7 @@
|
|
|
16885
16958
|
var offset = indexInBuffer * blendShapeFloatStride;
|
|
16886
16959
|
var storeInfo = storeInfos[i];
|
|
16887
16960
|
storeInfo || (storeInfos[i] = storeInfo = new Vector2());
|
|
16888
|
-
storeInfo.set(
|
|
16961
|
+
storeInfo.set(bufferOffset + bufferIndex, indexInBuffer * blendShapeByteStride); // BufferOffset is mesh vertexBuffer offset
|
|
16889
16962
|
var deltaPositions = endFrame.deltaPositions;
|
|
16890
16963
|
for(var j = 0; j < vertexCount; j++){
|
|
16891
16964
|
var start = offset + bufferFloatStride * j;
|
|
@@ -17688,7 +17761,6 @@
|
|
|
17688
17761
|
this.setTangents(tangents);
|
|
17689
17762
|
};
|
|
17690
17763
|
/**
|
|
17691
|
-
* @override
|
|
17692
17764
|
* @internal
|
|
17693
17765
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
17694
17766
|
Mesh.prototype._onDestroy.call(this);
|
|
@@ -18158,6 +18230,7 @@
|
|
|
18158
18230
|
var MeshRenderer = function MeshRenderer(entity) {
|
|
18159
18231
|
var _this;
|
|
18160
18232
|
_this = Renderer.call(this, entity) || this;
|
|
18233
|
+
_this._enableVertexColor = false;
|
|
18161
18234
|
_this._onMeshChanged = _this._onMeshChanged.bind(_assert_this_initialized(_this));
|
|
18162
18235
|
return _this;
|
|
18163
18236
|
};
|
|
@@ -18165,22 +18238,23 @@
|
|
|
18165
18238
|
var _proto = MeshRenderer.prototype;
|
|
18166
18239
|
/**
|
|
18167
18240
|
* @internal
|
|
18168
|
-
* @override
|
|
18169
18241
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
18170
18242
|
Renderer.prototype._onDestroy.call(this);
|
|
18171
18243
|
var mesh = this._mesh;
|
|
18172
18244
|
if (mesh && !mesh.destroyed) {
|
|
18173
18245
|
mesh._addReferCount(-1);
|
|
18246
|
+
mesh._updateFlagManager.removeListener(this._onMeshChanged);
|
|
18174
18247
|
this._mesh = null;
|
|
18175
18248
|
}
|
|
18176
18249
|
};
|
|
18177
18250
|
/**
|
|
18178
18251
|
* @internal
|
|
18179
18252
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
18253
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
18180
18254
|
target.mesh = this._mesh;
|
|
18181
18255
|
};
|
|
18182
18256
|
/**
|
|
18183
|
-
* @
|
|
18257
|
+
* @internal
|
|
18184
18258
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
18185
18259
|
var mesh = this._mesh;
|
|
18186
18260
|
if (mesh) {
|
|
@@ -18193,7 +18267,7 @@
|
|
|
18193
18267
|
}
|
|
18194
18268
|
};
|
|
18195
18269
|
/**
|
|
18196
|
-
* @
|
|
18270
|
+
* @internal
|
|
18197
18271
|
*/ _proto._render = function _render(context) {
|
|
18198
18272
|
var mesh = this._mesh;
|
|
18199
18273
|
if (mesh) {
|
|
@@ -18204,7 +18278,7 @@
|
|
|
18204
18278
|
shaderData.disableMacro(MeshRenderer._uv1Macro);
|
|
18205
18279
|
shaderData.disableMacro(MeshRenderer._normalMacro);
|
|
18206
18280
|
shaderData.disableMacro(MeshRenderer._tangentMacro);
|
|
18207
|
-
shaderData.disableMacro(MeshRenderer.
|
|
18281
|
+
shaderData.disableMacro(MeshRenderer._enableVertexColorMacro);
|
|
18208
18282
|
for(var i = 0, n = vertexElements.length; i < n; i++){
|
|
18209
18283
|
switch(vertexElements[i].semantic){
|
|
18210
18284
|
case "TEXCOORD_0":
|
|
@@ -18220,7 +18294,7 @@
|
|
|
18220
18294
|
shaderData.enableMacro(MeshRenderer._tangentMacro);
|
|
18221
18295
|
break;
|
|
18222
18296
|
case "COLOR_0":
|
|
18223
|
-
shaderData.enableMacro(MeshRenderer.
|
|
18297
|
+
this._enableVertexColor && shaderData.enableMacro(MeshRenderer._enableVertexColorMacro);
|
|
18224
18298
|
break;
|
|
18225
18299
|
}
|
|
18226
18300
|
}
|
|
@@ -18271,6 +18345,20 @@
|
|
|
18271
18345
|
this._setMesh(value);
|
|
18272
18346
|
}
|
|
18273
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
|
+
}
|
|
18274
18362
|
}
|
|
18275
18363
|
]);
|
|
18276
18364
|
return MeshRenderer;
|
|
@@ -18288,7 +18376,7 @@
|
|
|
18288
18376
|
MeshRenderer._tangentMacro = ShaderMacro.getByName("RENDERER_HAS_TANGENT");
|
|
18289
18377
|
})();
|
|
18290
18378
|
(function() {
|
|
18291
|
-
MeshRenderer.
|
|
18379
|
+
MeshRenderer._enableVertexColorMacro = ShaderMacro.getByName("RENDERER_ENABLE_VERTEXCOLOR");
|
|
18292
18380
|
})();
|
|
18293
18381
|
__decorate$1([
|
|
18294
18382
|
ignoreClone
|
|
@@ -18318,7 +18406,7 @@
|
|
|
18318
18406
|
// Limit size to 256 to avoid some problem:
|
|
18319
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!
|
|
18320
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.
|
|
18321
|
-
maxVertexUniformVectors = Math.min(maxVertexUniformVectors,
|
|
18409
|
+
maxVertexUniformVectors = Math.min(maxVertexUniformVectors, rhi._options._maxAllowSkinUniformVectorCount);
|
|
18322
18410
|
_this._maxVertexUniformVectors = maxVertexUniformVectors;
|
|
18323
18411
|
_this._onLocalBoundsChanged = _this._onLocalBoundsChanged.bind(_assert_this_initialized(_this));
|
|
18324
18412
|
var localBounds = _this._localBounds;
|
|
@@ -18355,7 +18443,7 @@
|
|
|
18355
18443
|
}
|
|
18356
18444
|
};
|
|
18357
18445
|
/**
|
|
18358
|
-
* @
|
|
18446
|
+
* @internal
|
|
18359
18447
|
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
18360
18448
|
var entity = this.entity;
|
|
18361
18449
|
var worldMatrix = this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
|
|
@@ -18382,6 +18470,7 @@
|
|
|
18382
18470
|
(_this__jointTexture = this._jointTexture) == null ? void 0 : _this__jointTexture.destroy();
|
|
18383
18471
|
this._jointTexture = new Texture2D(engine, 4, jointCount, exports.TextureFormat.R32G32B32A32, false);
|
|
18384
18472
|
this._jointTexture.filterMode = exports.TextureFilterMode.Point;
|
|
18473
|
+
this._jointTexture.isGCIgnored = true;
|
|
18385
18474
|
}
|
|
18386
18475
|
shaderData.disableMacro("RENDERER_JOINTS_NUM");
|
|
18387
18476
|
shaderData.enableMacro("RENDERER_USE_JOINT_TEXTURE");
|
|
@@ -18407,17 +18496,25 @@
|
|
|
18407
18496
|
};
|
|
18408
18497
|
/**
|
|
18409
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
|
|
18410
18507
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
18411
18508
|
MeshRenderer.prototype._cloneTo.call(this, target);
|
|
18412
18509
|
this._blendShapeWeights && (target._blendShapeWeights = this._blendShapeWeights.slice());
|
|
18413
18510
|
};
|
|
18414
18511
|
/**
|
|
18415
|
-
* @
|
|
18512
|
+
* @internal
|
|
18416
18513
|
*/ _proto._registerEntityTransformListener = function _registerEntityTransformListener() {
|
|
18417
18514
|
// Cancel register listener to entity transform.
|
|
18418
18515
|
};
|
|
18419
18516
|
/**
|
|
18420
|
-
* @
|
|
18517
|
+
* @internal
|
|
18421
18518
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
18422
18519
|
if (this._rootBone) {
|
|
18423
18520
|
var localBounds = this._localBounds;
|
|
@@ -18637,9 +18734,7 @@
|
|
|
18637
18734
|
};
|
|
18638
18735
|
_inherits$2(PrimitiveMeshRestorer, ContentRestorer);
|
|
18639
18736
|
var _proto = PrimitiveMeshRestorer.prototype;
|
|
18640
|
-
|
|
18641
|
-
* @override
|
|
18642
|
-
*/ _proto.restoreContent = function restoreContent() {
|
|
18737
|
+
_proto.restoreContent = function restoreContent() {
|
|
18643
18738
|
var primitiveInfo = this.primitiveInfo;
|
|
18644
18739
|
switch(primitiveInfo.type){
|
|
18645
18740
|
case 0:
|
|
@@ -18698,7 +18793,6 @@
|
|
|
18698
18793
|
_this = PrimitiveRestoreInfo.call(this, 0, noLongerAccessible) || this;
|
|
18699
18794
|
_this.radius = radius;
|
|
18700
18795
|
_this.segments = segments;
|
|
18701
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
18702
18796
|
return _this;
|
|
18703
18797
|
};
|
|
18704
18798
|
_inherits$2(SphereRestoreInfo, PrimitiveRestoreInfo);
|
|
@@ -18713,7 +18807,6 @@
|
|
|
18713
18807
|
_this.width = width;
|
|
18714
18808
|
_this.height = height;
|
|
18715
18809
|
_this.depth = depth;
|
|
18716
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
18717
18810
|
return _this;
|
|
18718
18811
|
};
|
|
18719
18812
|
_inherits$2(CuboidRestoreInfo, PrimitiveRestoreInfo);
|
|
@@ -18729,7 +18822,6 @@
|
|
|
18729
18822
|
_this.height = height;
|
|
18730
18823
|
_this.horizontalSegments = horizontalSegments;
|
|
18731
18824
|
_this.verticalSegments = verticalSegments;
|
|
18732
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
18733
18825
|
return _this;
|
|
18734
18826
|
};
|
|
18735
18827
|
_inherits$2(PlaneRestoreInfo, PrimitiveRestoreInfo);
|
|
@@ -18746,7 +18838,6 @@
|
|
|
18746
18838
|
_this.height = height;
|
|
18747
18839
|
_this.radialSegments = radialSegments;
|
|
18748
18840
|
_this.heightSegments = heightSegments;
|
|
18749
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
18750
18841
|
return _this;
|
|
18751
18842
|
};
|
|
18752
18843
|
_inherits$2(CylinderRestoreInfo, PrimitiveRestoreInfo);
|
|
@@ -18763,7 +18854,6 @@
|
|
|
18763
18854
|
_this.radialSegments = radialSegments;
|
|
18764
18855
|
_this.tubularSegments = tubularSegments;
|
|
18765
18856
|
_this.arc = arc;
|
|
18766
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
18767
18857
|
return _this;
|
|
18768
18858
|
};
|
|
18769
18859
|
_inherits$2(TorusRestoreInfo, PrimitiveRestoreInfo);
|
|
@@ -18779,7 +18869,6 @@
|
|
|
18779
18869
|
_this.height = height;
|
|
18780
18870
|
_this.radialSegments = radialSegments;
|
|
18781
18871
|
_this.heightSegments = heightSegments;
|
|
18782
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
18783
18872
|
return _this;
|
|
18784
18873
|
};
|
|
18785
18874
|
_inherits$2(ConeRestoreInfo, PrimitiveRestoreInfo);
|
|
@@ -18795,7 +18884,6 @@
|
|
|
18795
18884
|
_this.height = height;
|
|
18796
18885
|
_this.radialSegments = radialSegments;
|
|
18797
18886
|
_this.heightSegments = heightSegments;
|
|
18798
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
18799
18887
|
return _this;
|
|
18800
18888
|
};
|
|
18801
18889
|
_inherits$2(CapsuleRestoreInfo, PrimitiveRestoreInfo);
|
|
@@ -19869,14 +19957,17 @@
|
|
|
19869
19957
|
_proto._createMesh = function _createMesh(engine, index) {
|
|
19870
19958
|
var MAX_VERTEX_COUNT = Basic2DBatcher.MAX_VERTEX_COUNT;
|
|
19871
19959
|
var mesh = new BufferMesh(engine, "BufferMesh" + index);
|
|
19960
|
+
mesh.isGCIgnored = true;
|
|
19872
19961
|
var vertexElements = [];
|
|
19873
19962
|
var vertexStride = this.createVertexElements(vertexElements);
|
|
19874
19963
|
// vertices
|
|
19875
|
-
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;
|
|
19876
19966
|
// indices
|
|
19877
|
-
this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 3, exports.BufferUsage.Dynamic);
|
|
19878
|
-
|
|
19879
|
-
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);
|
|
19880
19971
|
mesh.setVertexElements(vertexElements);
|
|
19881
19972
|
return mesh;
|
|
19882
19973
|
};
|
|
@@ -20152,6 +20243,12 @@
|
|
|
20152
20243
|
var _proto = Sky.prototype;
|
|
20153
20244
|
/**
|
|
20154
20245
|
* @internal
|
|
20246
|
+
*/ _proto.destroy = function destroy() {
|
|
20247
|
+
this.mesh = null;
|
|
20248
|
+
this.material = null;
|
|
20249
|
+
};
|
|
20250
|
+
/**
|
|
20251
|
+
* @internal
|
|
20155
20252
|
*/ _proto._render = function _render(context) {
|
|
20156
20253
|
var _this = this, material = _this.material, mesh = _this.mesh;
|
|
20157
20254
|
if (!material) {
|
|
@@ -20192,6 +20289,40 @@
|
|
|
20192
20289
|
rhi.drawPrimitive(mesh, mesh.subMesh, program);
|
|
20193
20290
|
cameraShaderData.setMatrix(RenderContext.vpMatrixProperty, originViewProjMatrix);
|
|
20194
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
|
+
]);
|
|
20195
20326
|
return Sky;
|
|
20196
20327
|
}();
|
|
20197
20328
|
(function() {
|
|
@@ -20226,9 +20357,19 @@
|
|
|
20226
20357
|
var _proto = Background.prototype;
|
|
20227
20358
|
/**
|
|
20228
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
|
|
20229
20369
|
* Standalone for CanvasRenderer plugin.
|
|
20230
20370
|
*/ _proto._initMesh = function _initMesh(engine) {
|
|
20231
20371
|
this._mesh = this._createPlane(engine);
|
|
20372
|
+
this._mesh._addReferCount(1);
|
|
20232
20373
|
};
|
|
20233
20374
|
/**
|
|
20234
20375
|
* @internal
|
|
@@ -20300,6 +20441,9 @@
|
|
|
20300
20441
|
},
|
|
20301
20442
|
set: function set(value) {
|
|
20302
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);
|
|
20303
20447
|
this._texture = value;
|
|
20304
20448
|
this._engine._backgroundTextureMaterial.shaderData.setTexture("material_BaseTexture", value);
|
|
20305
20449
|
}
|
|
@@ -20773,7 +20917,7 @@
|
|
|
20773
20917
|
var sunLightIndex = lightManager._getSunLightIndex();
|
|
20774
20918
|
if (sunLightIndex !== -1) {
|
|
20775
20919
|
var sunlight = lightManager._directLights.get(sunLightIndex);
|
|
20776
|
-
shaderData.setColor(Scene._sunlightColorProperty, sunlight.
|
|
20920
|
+
shaderData.setColor(Scene._sunlightColorProperty, sunlight._getLightIntensityColor());
|
|
20777
20921
|
shaderData.setVector3(Scene._sunlightDirectionProperty, sunlight.direction);
|
|
20778
20922
|
this._sunLight = sunlight;
|
|
20779
20923
|
}
|
|
@@ -20804,6 +20948,7 @@
|
|
|
20804
20948
|
this._rootEntities[0].destroy();
|
|
20805
20949
|
}
|
|
20806
20950
|
this._activeCameras.length = 0;
|
|
20951
|
+
this.background.destroy();
|
|
20807
20952
|
this.shaderData._addReferCount(-1);
|
|
20808
20953
|
};
|
|
20809
20954
|
_proto._addToRootEntityList = function _addToRootEntityList(index, rootEntity) {
|
|
@@ -21236,7 +21381,7 @@
|
|
|
21236
21381
|
_this._spriteDefaultMaterial = _this._createSpriteMaterial();
|
|
21237
21382
|
_this._spriteMaskDefaultMaterial = _this._createSpriteMaskMaterial();
|
|
21238
21383
|
_this._textDefaultFont = Font.createFromOS(_assert_this_initialized(_this), "Arial");
|
|
21239
|
-
_this._textDefaultFont.isGCIgnored =
|
|
21384
|
+
_this._textDefaultFont.isGCIgnored = true;
|
|
21240
21385
|
_this.inputManager = new InputManager(_assert_this_initialized(_this));
|
|
21241
21386
|
_this._initMagentaTextures(hardwareRenderer);
|
|
21242
21387
|
if (!hardwareRenderer.canIUse(exports.GLCapabilityType.depthTexture)) {
|
|
@@ -21247,6 +21392,7 @@
|
|
|
21247
21392
|
_this._depthTexture2D = depthTexture2D;
|
|
21248
21393
|
}
|
|
21249
21394
|
var magentaMaterial = new Material(_assert_this_initialized(_this), Shader.find("unlit"));
|
|
21395
|
+
magentaMaterial.isGCIgnored = true;
|
|
21250
21396
|
magentaMaterial.shaderData.setColor("material_BaseColor", new Color(1.0, 0.0, 1.01, 1.0));
|
|
21251
21397
|
_this._magentaMaterial = magentaMaterial;
|
|
21252
21398
|
var backgroundTextureMaterial = new Material(_assert_this_initialized(_this), Shader.find("background-texture"));
|
|
@@ -21473,7 +21619,9 @@
|
|
|
21473
21619
|
this._magentaTexture2DArray = magentaTexture2DArray;
|
|
21474
21620
|
}
|
|
21475
21621
|
};
|
|
21476
|
-
|
|
21622
|
+
/**
|
|
21623
|
+
* @internal
|
|
21624
|
+
*/ _proto._initialize = function _initialize(configuration) {
|
|
21477
21625
|
var _this = this;
|
|
21478
21626
|
var physics = configuration.physics;
|
|
21479
21627
|
if (physics) {
|
|
@@ -21741,14 +21889,12 @@
|
|
|
21741
21889
|
/**
|
|
21742
21890
|
* @internal
|
|
21743
21891
|
* @inheritDoc
|
|
21744
|
-
* @override
|
|
21745
21892
|
*/ _proto._onAwake = function _onAwake() {
|
|
21746
21893
|
this.onAwake();
|
|
21747
21894
|
};
|
|
21748
21895
|
/**
|
|
21749
21896
|
* @internal
|
|
21750
21897
|
* @inheritDoc
|
|
21751
|
-
* @override
|
|
21752
21898
|
*/ _proto._onEnable = function _onEnable() {
|
|
21753
21899
|
if (this._waitHandlingInValid) {
|
|
21754
21900
|
this._waitHandlingInValid = false;
|
|
@@ -21774,7 +21920,6 @@
|
|
|
21774
21920
|
/**
|
|
21775
21921
|
* @internal
|
|
21776
21922
|
* @inheritDoc
|
|
21777
|
-
* @override
|
|
21778
21923
|
*/ _proto._onDisable = function _onDisable() {
|
|
21779
21924
|
this._waitHandlingInValid = true;
|
|
21780
21925
|
this._engine._componentsManager.addDisableScript(this);
|
|
@@ -21798,7 +21943,6 @@
|
|
|
21798
21943
|
this._waitHandlingInValid = false;
|
|
21799
21944
|
};
|
|
21800
21945
|
/**
|
|
21801
|
-
* @override
|
|
21802
21946
|
* @internal
|
|
21803
21947
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
21804
21948
|
Component.prototype._onDestroy.call(this);
|
|
@@ -22744,7 +22888,7 @@
|
|
|
22744
22888
|
// prepare render target
|
|
22745
22889
|
var renderTarget = this._getAvailableRenderTarget();
|
|
22746
22890
|
// @todo: shouldn't set viewport and scissor in activeRenderTarget
|
|
22747
|
-
rhi.activeRenderTarget(renderTarget,
|
|
22891
|
+
rhi.activeRenderTarget(renderTarget, CascadedShadowCasterPass._viewport, 0);
|
|
22748
22892
|
if (this._supportDepthTexture) {
|
|
22749
22893
|
rhi.clearRenderTarget(engine, exports.CameraClearFlags.Depth, null);
|
|
22750
22894
|
} else {
|
|
@@ -22866,11 +23010,13 @@
|
|
|
22866
23010
|
if (engine._hardwareRenderer._isWebGL2) {
|
|
22867
23011
|
depthTexture.depthCompareFunction = exports.TextureDepthCompareFunction.Less;
|
|
22868
23012
|
}
|
|
23013
|
+
renderTarget == null ? void 0 : renderTarget._addReferCount(-1);
|
|
22869
23014
|
if (this._supportDepthTexture) {
|
|
22870
23015
|
renderTarget = this._renderTargets = new RenderTarget(engine, width, height, null, depthTexture);
|
|
22871
23016
|
} else {
|
|
22872
23017
|
renderTarget = this._renderTargets = new RenderTarget(engine, width, height, depthTexture);
|
|
22873
23018
|
}
|
|
23019
|
+
renderTarget._addReferCount(1);
|
|
22874
23020
|
}
|
|
22875
23021
|
return renderTarget;
|
|
22876
23022
|
};
|
|
@@ -22893,7 +23039,12 @@
|
|
|
22893
23039
|
var height = shadowCascades == exports.ShadowCascadesMode.TwoCascades ? shadowTileResolution : shadowTileResolution * 2;
|
|
22894
23040
|
this._shadowMapSize.set(1.0 / width, 1.0 / height, width, height);
|
|
22895
23041
|
}
|
|
22896
|
-
this._renderTargets
|
|
23042
|
+
var renderTargets = this._renderTargets;
|
|
23043
|
+
if (renderTargets) {
|
|
23044
|
+
renderTargets._addReferCount(-1);
|
|
23045
|
+
renderTargets.destroy();
|
|
23046
|
+
this._renderTargets = null;
|
|
23047
|
+
}
|
|
22897
23048
|
var viewportOffset = this._viewportOffsets;
|
|
22898
23049
|
var shadowTileResolution1 = this._shadowTileResolution;
|
|
22899
23050
|
switch(shadowCascades){
|
|
@@ -22949,6 +23100,9 @@
|
|
|
22949
23100
|
(function() {
|
|
22950
23101
|
CascadedShadowCasterPass._cascadesSplitDistance = new Array(CascadedShadowCasterPass._maxCascades + 1);
|
|
22951
23102
|
})();
|
|
23103
|
+
(function() {
|
|
23104
|
+
CascadedShadowCasterPass._viewport = new Vector4(0, 0, 1, 1);
|
|
23105
|
+
})();
|
|
22952
23106
|
(function() {
|
|
22953
23107
|
CascadedShadowCasterPass._clearColor = new Color$1(1, 1, 1, 1);
|
|
22954
23108
|
})();
|
|
@@ -23463,19 +23617,17 @@
|
|
|
23463
23617
|
this._replacementSubShaderTag = null;
|
|
23464
23618
|
};
|
|
23465
23619
|
/**
|
|
23466
|
-
* @override
|
|
23467
23620
|
* @inheritdoc
|
|
23468
23621
|
*/ _proto._onEnable = function _onEnable() {
|
|
23469
23622
|
this.entity.scene._attachRenderCamera(this);
|
|
23470
23623
|
};
|
|
23471
23624
|
/**
|
|
23472
|
-
* @override
|
|
23473
23625
|
* @inheritdoc
|
|
23474
23626
|
*/ _proto._onDisable = function _onDisable() {
|
|
23475
23627
|
this.entity.scene._detachRenderCamera(this);
|
|
23476
23628
|
};
|
|
23477
23629
|
/**
|
|
23478
|
-
* @
|
|
23630
|
+
* @internal
|
|
23479
23631
|
* @inheritdoc
|
|
23480
23632
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
23481
23633
|
var _this__renderPipeline;
|
|
@@ -23681,7 +23833,12 @@
|
|
|
23681
23833
|
return this._renderTarget;
|
|
23682
23834
|
},
|
|
23683
23835
|
set: function set(value) {
|
|
23684
|
-
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
|
+
}
|
|
23685
23842
|
}
|
|
23686
23843
|
}
|
|
23687
23844
|
]);
|
|
@@ -24033,7 +24190,6 @@
|
|
|
24033
24190
|
}
|
|
24034
24191
|
};
|
|
24035
24192
|
/**
|
|
24036
|
-
* @override
|
|
24037
24193
|
* Clone and return the instance.
|
|
24038
24194
|
*/ _proto.clone = function clone() {
|
|
24039
24195
|
var dest = new BaseMaterial(this._engine, this.shader);
|
|
@@ -24041,7 +24197,6 @@
|
|
|
24041
24197
|
return dest;
|
|
24042
24198
|
};
|
|
24043
24199
|
/**
|
|
24044
|
-
* @override
|
|
24045
24200
|
* Clone to the target material.
|
|
24046
24201
|
* @param target - target material
|
|
24047
24202
|
*/ _proto.cloneTo = function cloneTo(target) {
|
|
@@ -24201,8 +24356,8 @@
|
|
|
24201
24356
|
var _this;
|
|
24202
24357
|
_this = BaseMaterial.call(this, engine, Shader.find("blinn-phong")) || this;
|
|
24203
24358
|
var shaderData = _this.shaderData;
|
|
24204
|
-
shaderData.enableMacro("
|
|
24205
|
-
shaderData.enableMacro("
|
|
24359
|
+
shaderData.enableMacro("MATERIAL_NEED_WORLD_POS");
|
|
24360
|
+
shaderData.enableMacro("MATERIAL_NEED_TILING_OFFSET");
|
|
24206
24361
|
shaderData.setColor(BlinnPhongMaterial._baseColorProp, new Color$1(1, 1, 1, 1));
|
|
24207
24362
|
shaderData.setColor(BlinnPhongMaterial._specularColorProp, new Color$1(1, 1, 1, 1));
|
|
24208
24363
|
shaderData.setColor(BlinnPhongMaterial._emissiveColorProp, new Color$1(0, 0, 0, 1));
|
|
@@ -24212,9 +24367,7 @@
|
|
|
24212
24367
|
return _this;
|
|
24213
24368
|
}
|
|
24214
24369
|
var _proto = BlinnPhongMaterial.prototype;
|
|
24215
|
-
|
|
24216
|
-
* @override
|
|
24217
|
-
*/ _proto.clone = function clone() {
|
|
24370
|
+
_proto.clone = function clone() {
|
|
24218
24371
|
var dest = new BlinnPhongMaterial(this._engine);
|
|
24219
24372
|
this.cloneTo(dest);
|
|
24220
24373
|
return dest;
|
|
@@ -24395,8 +24548,8 @@
|
|
|
24395
24548
|
var _this;
|
|
24396
24549
|
_this = BaseMaterial.call(this, engine, shader) || this;
|
|
24397
24550
|
var shaderData = _this.shaderData;
|
|
24398
|
-
shaderData.enableMacro("
|
|
24399
|
-
shaderData.enableMacro("
|
|
24551
|
+
shaderData.enableMacro("MATERIAL_NEED_WORLD_POS");
|
|
24552
|
+
shaderData.enableMacro("MATERIAL_NEED_TILING_OFFSET");
|
|
24400
24553
|
shaderData.setColor(PBRBaseMaterial._baseColorProp, new Color$1(1, 1, 1, 1));
|
|
24401
24554
|
shaderData.setColor(PBRBaseMaterial._emissiveColorProp, new Color$1(0, 0, 0, 1));
|
|
24402
24555
|
shaderData.setVector4(PBRBaseMaterial._tilingOffsetProp, new Vector4(1, 1, 0, 0));
|
|
@@ -24505,9 +24658,9 @@
|
|
|
24505
24658
|
set: function set(value) {
|
|
24506
24659
|
this.shaderData.setTexture(PBRBaseMaterial._occlusionTextureProp, value);
|
|
24507
24660
|
if (value) {
|
|
24508
|
-
this.shaderData.enableMacro("
|
|
24661
|
+
this.shaderData.enableMacro("MATERIAL_HAS_OCCLUSION_TEXTURE");
|
|
24509
24662
|
} else {
|
|
24510
|
-
this.shaderData.disableMacro("
|
|
24663
|
+
this.shaderData.disableMacro("MATERIAL_HAS_OCCLUSION_TEXTURE");
|
|
24511
24664
|
}
|
|
24512
24665
|
}
|
|
24513
24666
|
},
|
|
@@ -24561,9 +24714,9 @@
|
|
|
24561
24714
|
set: function set(value) {
|
|
24562
24715
|
if (!!this.shaderData.getFloat(PBRBaseMaterial._clearCoatProp) !== !!value) {
|
|
24563
24716
|
if (value === 0) {
|
|
24564
|
-
this.shaderData.disableMacro("
|
|
24717
|
+
this.shaderData.disableMacro("MATERIAL_ENABLE_CLEAR_COAT");
|
|
24565
24718
|
} else {
|
|
24566
|
-
this.shaderData.enableMacro("
|
|
24719
|
+
this.shaderData.enableMacro("MATERIAL_ENABLE_CLEAR_COAT");
|
|
24567
24720
|
}
|
|
24568
24721
|
}
|
|
24569
24722
|
this.shaderData.setFloat(PBRBaseMaterial._clearCoatProp, value);
|
|
@@ -24579,9 +24732,9 @@
|
|
|
24579
24732
|
set: function set(value) {
|
|
24580
24733
|
this.shaderData.setTexture(PBRBaseMaterial._clearCoatTextureProp, value);
|
|
24581
24734
|
if (value) {
|
|
24582
|
-
this.shaderData.enableMacro("
|
|
24735
|
+
this.shaderData.enableMacro("MATERIAL_HAS_CLEAR_COAT_TEXTURE");
|
|
24583
24736
|
} else {
|
|
24584
|
-
this.shaderData.disableMacro("
|
|
24737
|
+
this.shaderData.disableMacro("MATERIAL_HAS_CLEAR_COAT_TEXTURE");
|
|
24585
24738
|
}
|
|
24586
24739
|
}
|
|
24587
24740
|
},
|
|
@@ -24606,9 +24759,9 @@
|
|
|
24606
24759
|
set: function set(value) {
|
|
24607
24760
|
this.shaderData.setTexture(PBRBaseMaterial._clearCoatRoughnessTextureProp, value);
|
|
24608
24761
|
if (value) {
|
|
24609
|
-
this.shaderData.enableMacro("
|
|
24762
|
+
this.shaderData.enableMacro("MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE");
|
|
24610
24763
|
} else {
|
|
24611
|
-
this.shaderData.disableMacro("
|
|
24764
|
+
this.shaderData.disableMacro("MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE");
|
|
24612
24765
|
}
|
|
24613
24766
|
}
|
|
24614
24767
|
},
|
|
@@ -24622,9 +24775,9 @@
|
|
|
24622
24775
|
set: function set(value) {
|
|
24623
24776
|
this.shaderData.setTexture(PBRBaseMaterial._clearCoatNormalTextureProp, value);
|
|
24624
24777
|
if (value) {
|
|
24625
|
-
this.shaderData.enableMacro("
|
|
24778
|
+
this.shaderData.enableMacro("MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE");
|
|
24626
24779
|
} else {
|
|
24627
|
-
this.shaderData.disableMacro("
|
|
24780
|
+
this.shaderData.disableMacro("MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE");
|
|
24628
24781
|
}
|
|
24629
24782
|
}
|
|
24630
24783
|
}
|
|
@@ -24664,21 +24817,35 @@
|
|
|
24664
24817
|
_this = PBRBaseMaterial.call(this, engine, Shader.find("pbr")) || this;
|
|
24665
24818
|
_this.shaderData.setFloat(PBRMaterial._metallicProp, 1);
|
|
24666
24819
|
_this.shaderData.setFloat(PBRMaterial._roughnessProp, 1);
|
|
24820
|
+
_this.shaderData.setFloat(PBRMaterial._iorProp, 1.5);
|
|
24667
24821
|
return _this;
|
|
24668
24822
|
}
|
|
24669
24823
|
var _proto = PBRMaterial.prototype;
|
|
24670
24824
|
/**
|
|
24671
|
-
* @
|
|
24825
|
+
* @inheritdoc
|
|
24672
24826
|
*/ _proto.clone = function clone() {
|
|
24673
24827
|
var dest = new PBRMaterial(this._engine);
|
|
24674
24828
|
this.cloneTo(dest);
|
|
24675
24829
|
return dest;
|
|
24676
24830
|
};
|
|
24677
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
|
+
},
|
|
24678
24844
|
{
|
|
24679
24845
|
key: "metallic",
|
|
24680
24846
|
get: /**
|
|
24681
|
-
* Metallic
|
|
24847
|
+
* Metallic.
|
|
24848
|
+
* @defaultValue `1.0`
|
|
24682
24849
|
*/ function get() {
|
|
24683
24850
|
return this.shaderData.getFloat(PBRMaterial._metallicProp);
|
|
24684
24851
|
},
|
|
@@ -24689,7 +24856,8 @@
|
|
|
24689
24856
|
{
|
|
24690
24857
|
key: "roughness",
|
|
24691
24858
|
get: /**
|
|
24692
|
-
* Roughness
|
|
24859
|
+
* Roughness. default 1.0.
|
|
24860
|
+
* @defaultValue `1.0`
|
|
24693
24861
|
*/ function get() {
|
|
24694
24862
|
return this.shaderData.getFloat(PBRMaterial._roughnessProp);
|
|
24695
24863
|
},
|
|
@@ -24708,9 +24876,9 @@
|
|
|
24708
24876
|
set: function set(value) {
|
|
24709
24877
|
this.shaderData.setTexture(PBRMaterial._roughnessMetallicTextureProp, value);
|
|
24710
24878
|
if (value) {
|
|
24711
|
-
this.shaderData.enableMacro("
|
|
24879
|
+
this.shaderData.enableMacro("MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE");
|
|
24712
24880
|
} else {
|
|
24713
|
-
this.shaderData.disableMacro("
|
|
24881
|
+
this.shaderData.disableMacro("MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE");
|
|
24714
24882
|
}
|
|
24715
24883
|
}
|
|
24716
24884
|
}
|
|
@@ -24726,6 +24894,9 @@
|
|
|
24726
24894
|
(function() {
|
|
24727
24895
|
PBRMaterial._roughnessMetallicTextureProp = ShaderProperty.getByName("material_RoughnessMetallicTexture");
|
|
24728
24896
|
})();
|
|
24897
|
+
(function() {
|
|
24898
|
+
PBRMaterial._iorProp = Shader.getPropertyByName("material_IOR");
|
|
24899
|
+
})();
|
|
24729
24900
|
/**
|
|
24730
24901
|
* PBR (Specular-Glossiness Workflow) Material.
|
|
24731
24902
|
*/ var PBRSpecularMaterial = /*#__PURE__*/ function(PBRBaseMaterial) {
|
|
@@ -24739,7 +24910,7 @@
|
|
|
24739
24910
|
}
|
|
24740
24911
|
var _proto = PBRSpecularMaterial.prototype;
|
|
24741
24912
|
/**
|
|
24742
|
-
* @
|
|
24913
|
+
* @inheritdoc
|
|
24743
24914
|
*/ _proto.clone = function clone() {
|
|
24744
24915
|
var dest = new PBRSpecularMaterial(this._engine);
|
|
24745
24916
|
this.cloneTo(dest);
|
|
@@ -24801,7 +24972,7 @@
|
|
|
24801
24972
|
PBRSpecularMaterial._specularGlossinessTextureProp = ShaderProperty.getByName("material_SpecularGlossinessTexture");
|
|
24802
24973
|
})();
|
|
24803
24974
|
(function() {
|
|
24804
|
-
PBRSpecularMaterial._specularGlossinessTextureMacro = ShaderMacro.getByName("
|
|
24975
|
+
PBRSpecularMaterial._specularGlossinessTextureMacro = ShaderMacro.getByName("MATERIAL_HAS_SPECULAR_GLOSSINESS_TEXTURE");
|
|
24805
24976
|
})();
|
|
24806
24977
|
/**
|
|
24807
24978
|
* Unlit Material.
|
|
@@ -24812,14 +24983,14 @@
|
|
|
24812
24983
|
_this = BaseMaterial.call(this, engine, Shader.find("unlit")) || this;
|
|
24813
24984
|
var shaderData = _this.shaderData;
|
|
24814
24985
|
shaderData.enableMacro("MATERIAL_OMIT_NORMAL");
|
|
24815
|
-
shaderData.enableMacro("
|
|
24986
|
+
shaderData.enableMacro("MATERIAL_NEED_TILING_OFFSET");
|
|
24816
24987
|
shaderData.setColor(UnlitMaterial._baseColorProp, new Color$1(1, 1, 1, 1));
|
|
24817
24988
|
shaderData.setVector4(UnlitMaterial._tilingOffsetProp, new Vector4(1, 1, 0, 0));
|
|
24818
24989
|
return _this;
|
|
24819
24990
|
}
|
|
24820
24991
|
var _proto = UnlitMaterial.prototype;
|
|
24821
24992
|
/**
|
|
24822
|
-
* @
|
|
24993
|
+
* @inheritdoc
|
|
24823
24994
|
*/ _proto.clone = function clone() {
|
|
24824
24995
|
var dest = new UnlitMaterial(this._engine);
|
|
24825
24996
|
this.cloneTo(dest);
|
|
@@ -24933,12 +25104,18 @@
|
|
|
24933
25104
|
* @internal
|
|
24934
25105
|
*/ _proto._addSprite = function _addSprite(sprite) {
|
|
24935
25106
|
this._spriteNamesToIndex[sprite.name] = this._sprites.push(sprite) - 1;
|
|
25107
|
+
sprite._atlas = this;
|
|
25108
|
+
sprite.isGCIgnored = true;
|
|
24936
25109
|
};
|
|
24937
25110
|
/**
|
|
24938
|
-
* @override
|
|
24939
25111
|
* @internal
|
|
24940
25112
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
24941
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;
|
|
24942
25119
|
this._sprites = null;
|
|
24943
25120
|
this._spriteNamesToIndex = null;
|
|
24944
25121
|
};
|
|
@@ -24982,8 +25159,10 @@
|
|
|
24982
25159
|
if (name === void 0) name = null;
|
|
24983
25160
|
var _this;
|
|
24984
25161
|
_this = ReferResource.call(this, engine) || this;
|
|
24985
|
-
_this.
|
|
24986
|
-
_this.
|
|
25162
|
+
_this._automaticWidth = 0;
|
|
25163
|
+
_this._automaticHeight = 0;
|
|
25164
|
+
_this._customWidth = undefined;
|
|
25165
|
+
_this._customHeight = undefined;
|
|
24987
25166
|
_this._positions = [
|
|
24988
25167
|
new Vector2(),
|
|
24989
25168
|
new Vector2(),
|
|
@@ -25004,7 +25183,7 @@
|
|
|
25004
25183
|
_this._region = new Rect(0, 0, 1, 1);
|
|
25005
25184
|
_this._pivot = new Vector2(0.5, 0.5);
|
|
25006
25185
|
_this._border = new Vector4(0, 0, 0, 0);
|
|
25007
|
-
_this._dirtyUpdateFlag =
|
|
25186
|
+
_this._dirtyUpdateFlag = 0x7;
|
|
25008
25187
|
/** @internal */ _this._updateFlagManager = new UpdateFlagManager();
|
|
25009
25188
|
_this._texture = texture;
|
|
25010
25189
|
region && _this._region.copyFrom(region);
|
|
@@ -25044,19 +25223,40 @@
|
|
|
25044
25223
|
return this._bounds;
|
|
25045
25224
|
};
|
|
25046
25225
|
/**
|
|
25047
|
-
* @
|
|
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
|
+
/**
|
|
25048
25233
|
* @internal
|
|
25049
25234
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
25050
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;
|
|
25051
25247
|
this._texture = null;
|
|
25248
|
+
this._updateFlagManager = null;
|
|
25052
25249
|
};
|
|
25053
25250
|
_proto._calDefaultSize = function _calDefaultSize() {
|
|
25054
25251
|
if (this._texture) {
|
|
25055
25252
|
var _this = this, _texture = _this._texture, _atlasRegion = _this._atlasRegion, _atlasRegionOffset = _this._atlasRegionOffset, _region = _this._region;
|
|
25056
25253
|
var pixelsPerUnitReciprocal = 1.0 / Engine._pixelsPerUnit;
|
|
25057
|
-
this.
|
|
25058
|
-
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;
|
|
25059
25258
|
}
|
|
25259
|
+
this._dirtyUpdateFlag &= ~0x4;
|
|
25060
25260
|
};
|
|
25061
25261
|
_proto._updatePositions = function _updatePositions() {
|
|
25062
25262
|
var blank = this._atlasRegionOffset;
|
|
@@ -25110,11 +25310,16 @@
|
|
|
25110
25310
|
};
|
|
25111
25311
|
_proto._dispatchSpriteChange = function _dispatchSpriteChange(type) {
|
|
25112
25312
|
switch(type){
|
|
25313
|
+
case SpriteModifyFlags.texture:
|
|
25314
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
25315
|
+
break;
|
|
25113
25316
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
25114
25317
|
case SpriteModifyFlags.region:
|
|
25115
|
-
this._dirtyUpdateFlag |=
|
|
25318
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
25116
25319
|
break;
|
|
25117
25320
|
case SpriteModifyFlags.atlasRegion:
|
|
25321
|
+
this._dirtyUpdateFlag |= 0x4 | 0x2;
|
|
25322
|
+
break;
|
|
25118
25323
|
case SpriteModifyFlags.border:
|
|
25119
25324
|
this._dirtyUpdateFlag |= 0x2;
|
|
25120
25325
|
break;
|
|
@@ -25133,7 +25338,9 @@
|
|
|
25133
25338
|
if (this._texture !== value) {
|
|
25134
25339
|
this._texture = value;
|
|
25135
25340
|
this._dispatchSpriteChange(SpriteModifyFlags.texture);
|
|
25136
|
-
(this.
|
|
25341
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
25342
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
25343
|
+
}
|
|
25137
25344
|
}
|
|
25138
25345
|
}
|
|
25139
25346
|
},
|
|
@@ -25141,13 +25348,21 @@
|
|
|
25141
25348
|
key: "width",
|
|
25142
25349
|
get: /**
|
|
25143
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`.
|
|
25144
25355
|
*/ function get() {
|
|
25145
|
-
this.
|
|
25146
|
-
|
|
25356
|
+
if (this._customWidth !== undefined) {
|
|
25357
|
+
return this._customWidth;
|
|
25358
|
+
} else {
|
|
25359
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
25360
|
+
return this._automaticWidth;
|
|
25361
|
+
}
|
|
25147
25362
|
},
|
|
25148
25363
|
set: function set(value) {
|
|
25149
|
-
if (this.
|
|
25150
|
-
this.
|
|
25364
|
+
if (this._customWidth !== value) {
|
|
25365
|
+
this._customWidth = value;
|
|
25151
25366
|
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
25152
25367
|
}
|
|
25153
25368
|
}
|
|
@@ -25156,13 +25371,21 @@
|
|
|
25156
25371
|
key: "height",
|
|
25157
25372
|
get: /**
|
|
25158
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`.
|
|
25159
25378
|
*/ function get() {
|
|
25160
|
-
this.
|
|
25161
|
-
|
|
25379
|
+
if (this._customHeight !== undefined) {
|
|
25380
|
+
return this._customHeight;
|
|
25381
|
+
} else {
|
|
25382
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
25383
|
+
return this._automaticHeight;
|
|
25384
|
+
}
|
|
25162
25385
|
},
|
|
25163
25386
|
set: function set(value) {
|
|
25164
|
-
if (this.
|
|
25165
|
-
this.
|
|
25387
|
+
if (this._customHeight !== value) {
|
|
25388
|
+
this._customHeight = value;
|
|
25166
25389
|
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
25167
25390
|
}
|
|
25168
25391
|
}
|
|
@@ -25192,7 +25415,9 @@
|
|
|
25192
25415
|
var y = MathUtil$1.clamp(value.y, 0, 1);
|
|
25193
25416
|
this._atlasRegion.set(x, y, MathUtil$1.clamp(value.width, 0, 1 - x), MathUtil$1.clamp(value.height, 0, 1 - y));
|
|
25194
25417
|
this._dispatchSpriteChange(SpriteModifyFlags.atlasRegion);
|
|
25195
|
-
(this.
|
|
25418
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
25419
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
25420
|
+
}
|
|
25196
25421
|
}
|
|
25197
25422
|
},
|
|
25198
25423
|
{
|
|
@@ -25207,7 +25432,9 @@
|
|
|
25207
25432
|
var y = MathUtil$1.clamp(value.y, 0, 1);
|
|
25208
25433
|
this._atlasRegionOffset.set(x, y, MathUtil$1.clamp(value.z, 0, 1 - x), MathUtil$1.clamp(value.w, 0, 1 - y));
|
|
25209
25434
|
this._dispatchSpriteChange(SpriteModifyFlags.atlasRegionOffset);
|
|
25210
|
-
(this.
|
|
25435
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
25436
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
25437
|
+
}
|
|
25211
25438
|
}
|
|
25212
25439
|
},
|
|
25213
25440
|
{
|
|
@@ -25223,7 +25450,9 @@
|
|
|
25223
25450
|
var y = MathUtil$1.clamp(value.y, 0, 1);
|
|
25224
25451
|
region.set(x, y, MathUtil$1.clamp(value.width, 0, 1 - x), MathUtil$1.clamp(value.height, 0, 1 - y));
|
|
25225
25452
|
this._dispatchSpriteChange(SpriteModifyFlags.region);
|
|
25226
|
-
(this.
|
|
25453
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
25454
|
+
this._dispatchSpriteChange(SpriteModifyFlags.size);
|
|
25455
|
+
}
|
|
25227
25456
|
}
|
|
25228
25457
|
},
|
|
25229
25458
|
{
|
|
@@ -25273,7 +25502,8 @@
|
|
|
25273
25502
|
(function(SpriteUpdateFlags) {
|
|
25274
25503
|
SpriteUpdateFlags[SpriteUpdateFlags["positions"] = 0x1] = "positions";
|
|
25275
25504
|
SpriteUpdateFlags[SpriteUpdateFlags["uvs"] = 0x2] = "uvs";
|
|
25276
|
-
SpriteUpdateFlags[SpriteUpdateFlags["
|
|
25505
|
+
SpriteUpdateFlags[SpriteUpdateFlags["automaticSize"] = 0x4] = "automaticSize";
|
|
25506
|
+
SpriteUpdateFlags[SpriteUpdateFlags["all"] = 0x7] = "all";
|
|
25277
25507
|
})(SpriteUpdateFlags || (SpriteUpdateFlags = {}));
|
|
25278
25508
|
var _SlicedSpriteAssembler;
|
|
25279
25509
|
var SlicedSpriteAssembler = (_SlicedSpriteAssembler = /*#__PURE__*/ function() {
|
|
@@ -25761,8 +25991,10 @@
|
|
|
25761
25991
|
_this._tiledAdaptiveThreshold = 0.5;
|
|
25762
25992
|
_this._color = new Color$1(1, 1, 1, 1);
|
|
25763
25993
|
_this._sprite = null;
|
|
25764
|
-
_this.
|
|
25765
|
-
_this.
|
|
25994
|
+
_this._automaticWidth = 0;
|
|
25995
|
+
_this._automaticHeight = 0;
|
|
25996
|
+
_this._customWidth = undefined;
|
|
25997
|
+
_this._customHeight = undefined;
|
|
25766
25998
|
_this._flipX = false;
|
|
25767
25999
|
_this._flipY = false;
|
|
25768
26000
|
_this._maskLayer = exports.SpriteMaskLayer.Layer0;
|
|
@@ -25778,44 +26010,45 @@
|
|
|
25778
26010
|
/**
|
|
25779
26011
|
* @internal
|
|
25780
26012
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
26013
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
25781
26014
|
target._assembler.resetData(target);
|
|
25782
26015
|
target.sprite = this._sprite;
|
|
26016
|
+
target.drawMode = this._drawMode;
|
|
25783
26017
|
};
|
|
25784
26018
|
/**
|
|
25785
|
-
* @
|
|
26019
|
+
* @internal
|
|
25786
26020
|
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
25787
26021
|
// @ts-ignore
|
|
25788
26022
|
this._updateTransformShaderData(context, Matrix._identity);
|
|
25789
26023
|
};
|
|
25790
26024
|
/**
|
|
25791
|
-
* @
|
|
26025
|
+
* @internal
|
|
25792
26026
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
25793
|
-
|
|
25794
|
-
|
|
26027
|
+
if (this.sprite) {
|
|
26028
|
+
this._assembler.updatePositions(this);
|
|
26029
|
+
} else {
|
|
25795
26030
|
worldBounds.min.set(0, 0, 0);
|
|
25796
26031
|
worldBounds.max.set(0, 0, 0);
|
|
25797
|
-
} else {
|
|
25798
|
-
this._assembler.updatePositions(this);
|
|
25799
26032
|
}
|
|
25800
26033
|
};
|
|
25801
26034
|
/**
|
|
25802
|
-
* @
|
|
26035
|
+
* @internal
|
|
25803
26036
|
*/ _proto._render = function _render(context) {
|
|
25804
26037
|
var _this_sprite;
|
|
25805
26038
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
25806
26039
|
return;
|
|
25807
26040
|
}
|
|
25808
|
-
// Update position
|
|
26041
|
+
// Update position
|
|
25809
26042
|
if (this._dirtyUpdateFlag & RendererUpdateFlags.WorldVolume) {
|
|
25810
26043
|
this._assembler.updatePositions(this);
|
|
25811
26044
|
this._dirtyUpdateFlag &= ~RendererUpdateFlags.WorldVolume;
|
|
25812
26045
|
}
|
|
25813
|
-
// Update uv
|
|
26046
|
+
// Update uv
|
|
25814
26047
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
25815
26048
|
this._assembler.updateUVs(this);
|
|
25816
26049
|
this._dirtyUpdateFlag &= ~0x2;
|
|
25817
26050
|
}
|
|
25818
|
-
// Push
|
|
26051
|
+
// Push primitive
|
|
25819
26052
|
var material = this.getMaterial();
|
|
25820
26053
|
var texture = this.sprite.texture;
|
|
25821
26054
|
var renderData = this._engine._spriteRenderDataPool.getFromPool();
|
|
@@ -25823,17 +26056,29 @@
|
|
|
25823
26056
|
context.camera._renderPipeline.pushRenderData(context, renderData);
|
|
25824
26057
|
};
|
|
25825
26058
|
/**
|
|
25826
|
-
* @override
|
|
25827
26059
|
* @internal
|
|
25828
26060
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
25829
|
-
var _this__sprite;
|
|
25830
26061
|
Renderer.prototype._onDestroy.call(this);
|
|
25831
|
-
|
|
26062
|
+
var sprite = this._sprite;
|
|
26063
|
+
if (sprite) {
|
|
26064
|
+
sprite._addReferCount(-1);
|
|
26065
|
+
sprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
26066
|
+
}
|
|
25832
26067
|
this._color = null;
|
|
25833
26068
|
this._sprite = null;
|
|
25834
26069
|
this._assembler = null;
|
|
25835
26070
|
this._verticesData = null;
|
|
25836
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
|
+
};
|
|
25837
26082
|
_proto._updateStencilState = function _updateStencilState() {
|
|
25838
26083
|
// Update stencil.
|
|
25839
26084
|
var material = this.getInstanceMaterial();
|
|
@@ -25860,22 +26105,21 @@
|
|
|
25860
26105
|
break;
|
|
25861
26106
|
case SpriteModifyFlags.size:
|
|
25862
26107
|
var _this = this, drawMode = _this._drawMode;
|
|
25863
|
-
|
|
26108
|
+
this._dirtyUpdateFlag |= 0x4;
|
|
26109
|
+
if (this._drawMode === exports.SpriteDrawMode.Sliced) {
|
|
25864
26110
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
25865
26111
|
} else if (drawMode === exports.SpriteDrawMode.Tiled) {
|
|
25866
26112
|
this._dirtyUpdateFlag |= 0x3;
|
|
25867
26113
|
} else {
|
|
25868
26114
|
// When the width and height of `SpriteRenderer` are `undefined`,
|
|
25869
26115
|
// the `size` of `Sprite` will affect the position of `SpriteRenderer`.
|
|
25870
|
-
if (this.
|
|
26116
|
+
if (this._customWidth === undefined || this._customHeight === undefined) {
|
|
25871
26117
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
25872
26118
|
}
|
|
25873
26119
|
}
|
|
25874
26120
|
break;
|
|
25875
26121
|
case SpriteModifyFlags.border:
|
|
25876
|
-
|
|
25877
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
25878
|
-
}
|
|
26122
|
+
this._drawMode === exports.SpriteDrawMode.Sliced && (this._dirtyUpdateFlag |= 0x3);
|
|
25879
26123
|
break;
|
|
25880
26124
|
case SpriteModifyFlags.region:
|
|
25881
26125
|
case SpriteModifyFlags.atlasRegionOffset:
|
|
@@ -25959,10 +26203,14 @@
|
|
|
25959
26203
|
set: function set(value) {
|
|
25960
26204
|
var lastSprite = this._sprite;
|
|
25961
26205
|
if (lastSprite !== value) {
|
|
25962
|
-
|
|
26206
|
+
if (lastSprite) {
|
|
26207
|
+
lastSprite._addReferCount(-1);
|
|
26208
|
+
lastSprite._updateFlagManager.removeListener(this._onSpriteChange);
|
|
26209
|
+
}
|
|
26210
|
+
this._dirtyUpdateFlag |= 0x7;
|
|
25963
26211
|
if (value) {
|
|
26212
|
+
value._addReferCount(1);
|
|
25964
26213
|
value._updateFlagManager.addListener(this._onSpriteChange);
|
|
25965
|
-
this._dirtyUpdateFlag |= 0x3;
|
|
25966
26214
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, value.texture);
|
|
25967
26215
|
} else {
|
|
25968
26216
|
this.shaderData.setTexture(SpriteRenderer._textureProperty, null);
|
|
@@ -25987,16 +26235,22 @@
|
|
|
25987
26235
|
{
|
|
25988
26236
|
key: "width",
|
|
25989
26237
|
get: /**
|
|
25990
|
-
* 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`.
|
|
25991
26243
|
*/ function get() {
|
|
25992
|
-
|
|
25993
|
-
|
|
26244
|
+
if (this._customWidth !== undefined) {
|
|
26245
|
+
return this._customWidth;
|
|
26246
|
+
} else {
|
|
26247
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
26248
|
+
return this._automaticWidth;
|
|
26249
|
+
}
|
|
25994
26250
|
},
|
|
25995
26251
|
set: function set(value) {
|
|
25996
|
-
|
|
25997
|
-
|
|
25998
|
-
if (this._width !== value) {
|
|
25999
|
-
this._width = value;
|
|
26252
|
+
if (this._customWidth !== value) {
|
|
26253
|
+
this._customWidth = value;
|
|
26000
26254
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
26001
26255
|
}
|
|
26002
26256
|
}
|
|
@@ -26004,16 +26258,22 @@
|
|
|
26004
26258
|
{
|
|
26005
26259
|
key: "height",
|
|
26006
26260
|
get: /**
|
|
26007
|
-
* 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`.
|
|
26008
26266
|
*/ function get() {
|
|
26009
|
-
|
|
26010
|
-
|
|
26267
|
+
if (this._customHeight !== undefined) {
|
|
26268
|
+
return this._customHeight;
|
|
26269
|
+
} else {
|
|
26270
|
+
this._dirtyUpdateFlag & 0x4 && this._calDefaultSize();
|
|
26271
|
+
return this._automaticHeight;
|
|
26272
|
+
}
|
|
26011
26273
|
},
|
|
26012
26274
|
set: function set(value) {
|
|
26013
|
-
|
|
26014
|
-
|
|
26015
|
-
if (this._height !== value) {
|
|
26016
|
-
this._height = value;
|
|
26275
|
+
if (this._customHeight !== value) {
|
|
26276
|
+
this._customHeight = value;
|
|
26017
26277
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
26018
26278
|
}
|
|
26019
26279
|
}
|
|
@@ -26100,10 +26360,16 @@
|
|
|
26100
26360
|
], SpriteRenderer.prototype, "_sprite", void 0);
|
|
26101
26361
|
__decorate$1([
|
|
26102
26362
|
ignoreClone
|
|
26103
|
-
], SpriteRenderer.prototype, "
|
|
26363
|
+
], SpriteRenderer.prototype, "_automaticWidth", void 0);
|
|
26104
26364
|
__decorate$1([
|
|
26105
26365
|
ignoreClone
|
|
26106
|
-
], 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);
|
|
26107
26373
|
__decorate$1([
|
|
26108
26374
|
assignmentClone
|
|
26109
26375
|
], SpriteRenderer.prototype, "_flipX", void 0);
|
|
@@ -26124,7 +26390,9 @@
|
|
|
26124
26390
|
*/ SpriteRendererUpdateFlags;
|
|
26125
26391
|
(function(SpriteRendererUpdateFlags) {
|
|
26126
26392
|
SpriteRendererUpdateFlags[SpriteRendererUpdateFlags[/** UV. */ "UV"] = 0x2] = "UV";
|
|
26127
|
-
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";
|
|
26128
26396
|
})(SpriteRendererUpdateFlags || (SpriteRendererUpdateFlags = {}));
|
|
26129
26397
|
/**
|
|
26130
26398
|
* @internal
|
|
@@ -26228,6 +26496,7 @@
|
|
|
26228
26496
|
/**
|
|
26229
26497
|
* @internal
|
|
26230
26498
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
26499
|
+
Renderer.prototype._cloneTo.call(this, target);
|
|
26231
26500
|
target.font = this._font;
|
|
26232
26501
|
target._subFont = this._subFont;
|
|
26233
26502
|
};
|
|
@@ -26247,18 +26516,18 @@
|
|
|
26247
26516
|
this._dirtyFlag &= ~type;
|
|
26248
26517
|
};
|
|
26249
26518
|
/**
|
|
26250
|
-
* @
|
|
26519
|
+
* @internal
|
|
26251
26520
|
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
26252
26521
|
// @ts-ignore
|
|
26253
26522
|
this._updateTransformShaderData(context, Matrix._identity);
|
|
26254
26523
|
};
|
|
26255
26524
|
/**
|
|
26256
|
-
* @
|
|
26525
|
+
* @internal
|
|
26257
26526
|
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
26258
26527
|
BoundingBox.transform(this._localBounds, this._entity.transform.worldMatrix, worldBounds);
|
|
26259
26528
|
};
|
|
26260
26529
|
/**
|
|
26261
|
-
* @
|
|
26530
|
+
* @internal
|
|
26262
26531
|
*/ _proto._render = function _render(context) {
|
|
26263
26532
|
if (this._text === "" || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0) {
|
|
26264
26533
|
return;
|
|
@@ -26354,8 +26623,6 @@
|
|
|
26354
26623
|
_proto._updateLocalData = function _updateLocalData() {
|
|
26355
26624
|
var _this = this, color = _this.color, horizontalAlignment = _this.horizontalAlignment, verticalAlignment = _this.verticalAlignment, charRenderDatas = _this._charRenderDatas;
|
|
26356
26625
|
var _this__localBounds = this._localBounds, min = _this__localBounds.min, max = _this__localBounds.max;
|
|
26357
|
-
min.set(0, 0, 0);
|
|
26358
|
-
max.set(0, 0, 0);
|
|
26359
26626
|
var _pixelsPerUnit = Engine._pixelsPerUnit;
|
|
26360
26627
|
var pixelsPerUnitReciprocal = 1.0 / _pixelsPerUnit;
|
|
26361
26628
|
var charFont = this._subFont;
|
|
@@ -26382,54 +26649,65 @@
|
|
|
26382
26649
|
break;
|
|
26383
26650
|
}
|
|
26384
26651
|
var renderDataCount = 0;
|
|
26652
|
+
var firstLine = -1;
|
|
26385
26653
|
var minX = Number.MAX_SAFE_INTEGER;
|
|
26386
26654
|
var minY = Number.MAX_SAFE_INTEGER;
|
|
26387
26655
|
var maxX = Number.MIN_SAFE_INTEGER;
|
|
26388
26656
|
var maxY = Number.MIN_SAFE_INTEGER;
|
|
26389
|
-
var lastLineIndex = linesLen - 1;
|
|
26390
26657
|
for(var i = 0; i < linesLen; ++i){
|
|
26391
|
-
var line = lines[i];
|
|
26392
26658
|
var lineWidth = lineWidths[i];
|
|
26393
|
-
|
|
26394
|
-
|
|
26395
|
-
|
|
26396
|
-
|
|
26397
|
-
|
|
26398
|
-
|
|
26399
|
-
|
|
26400
|
-
|
|
26401
|
-
|
|
26402
|
-
|
|
26403
|
-
|
|
26404
|
-
|
|
26405
|
-
|
|
26406
|
-
|
|
26407
|
-
|
|
26408
|
-
|
|
26409
|
-
|
|
26410
|
-
|
|
26411
|
-
|
|
26412
|
-
|
|
26413
|
-
|
|
26414
|
-
|
|
26415
|
-
|
|
26416
|
-
|
|
26417
|
-
|
|
26418
|
-
|
|
26419
|
-
|
|
26420
|
-
|
|
26421
|
-
|
|
26422
|
-
|
|
26423
|
-
|
|
26424
|
-
|
|
26425
|
-
|
|
26426
|
-
|
|
26427
|
-
|
|
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
|
+
}
|
|
26428
26701
|
}
|
|
26429
26702
|
startY -= lineHeight;
|
|
26430
26703
|
}
|
|
26431
|
-
|
|
26432
|
-
|
|
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
|
+
}
|
|
26433
26711
|
// Revert excess render data to pool.
|
|
26434
26712
|
var lastRenderDataCount = charRenderDatas.length;
|
|
26435
26713
|
if (lastRenderDataCount > renderDataCount) {
|
|
@@ -26442,7 +26720,9 @@
|
|
|
26442
26720
|
return a.texture.instanceId - b.texture.instanceId;
|
|
26443
26721
|
});
|
|
26444
26722
|
};
|
|
26445
|
-
|
|
26723
|
+
/**
|
|
26724
|
+
* @internal
|
|
26725
|
+
*/ _proto._onTransformChanged = function _onTransformChanged(bit) {
|
|
26446
26726
|
Renderer.prototype._onTransformChanged.call(this, bit);
|
|
26447
26727
|
this._setDirtyFlagTrue(0x4 | 0x8);
|
|
26448
26728
|
};
|
|
@@ -26759,7 +27039,6 @@
|
|
|
26759
27039
|
* @internal
|
|
26760
27040
|
*/ var AnimationCurveOwner = /*#__PURE__*/ function() {
|
|
26761
27041
|
function AnimationCurveOwner(target, type, property, cureType) {
|
|
26762
|
-
this.crossCurveMark = 0;
|
|
26763
27042
|
this.hasSavedDefaultValue = false;
|
|
26764
27043
|
this.baseEvaluateData = {
|
|
26765
27044
|
curKeyframeIndex: 0,
|
|
@@ -26953,6 +27232,11 @@
|
|
|
26953
27232
|
return BlendShapeWeightsAnimationCurveOwnerAssembler;
|
|
26954
27233
|
}();
|
|
26955
27234
|
AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights", BlendShapeWeightsAnimationCurveOwnerAssembler);
|
|
27235
|
+
/**
|
|
27236
|
+
* @internal
|
|
27237
|
+
*/ var AnimationCurveLayerOwner = function AnimationCurveLayerOwner() {
|
|
27238
|
+
this.crossCurveMark = 0;
|
|
27239
|
+
};
|
|
26956
27240
|
/**
|
|
26957
27241
|
* Associate AnimationCurve and the Entity
|
|
26958
27242
|
*/ var AnimationClipCurveBinding = /*#__PURE__*/ function() {
|
|
@@ -26970,6 +27254,13 @@
|
|
|
26970
27254
|
};
|
|
26971
27255
|
/**
|
|
26972
27256
|
* @internal
|
|
27257
|
+
*/ _proto._createCurveLayerOwner = function _createCurveLayerOwner(owner) {
|
|
27258
|
+
var layerOwner = new AnimationCurveLayerOwner();
|
|
27259
|
+
layerOwner.curveOwner = owner;
|
|
27260
|
+
return layerOwner;
|
|
27261
|
+
};
|
|
27262
|
+
/**
|
|
27263
|
+
* @internal
|
|
26973
27264
|
*/ _proto._getTempCurveOwner = function _getTempCurveOwner(entity) {
|
|
26974
27265
|
var instanceId = entity.instanceId;
|
|
26975
27266
|
if (!this._tempCurveOwner[instanceId]) {
|
|
@@ -27478,7 +27769,6 @@
|
|
|
27478
27769
|
var _proto = AnimationFloatArrayCurve.prototype;
|
|
27479
27770
|
/**
|
|
27480
27771
|
* @inheritdoc
|
|
27481
|
-
* @override
|
|
27482
27772
|
*/ _proto.addKey = function addKey(key) {
|
|
27483
27773
|
AnimationCurve.prototype.addKey.call(this, key);
|
|
27484
27774
|
var evaluateData = this._evaluateData;
|
|
@@ -28102,12 +28392,14 @@
|
|
|
28102
28392
|
* @internal
|
|
28103
28393
|
*/ var AnimatorLayerData = /*#__PURE__*/ function() {
|
|
28104
28394
|
var AnimatorLayerData = function AnimatorLayerData() {
|
|
28395
|
+
this.curveOwnerPool = Object.create(null);
|
|
28105
28396
|
this.animatorStateDataMap = {};
|
|
28106
28397
|
this.srcPlayData = new AnimatorStatePlayData();
|
|
28107
28398
|
this.destPlayData = new AnimatorStatePlayData();
|
|
28108
28399
|
this.layerState = LayerState.Standby;
|
|
28109
28400
|
this.crossCurveMark = 0;
|
|
28110
28401
|
this.manuallyTransition = new AnimatorStateTransition();
|
|
28402
|
+
this.crossOwnerLayerDataCollection = [];
|
|
28111
28403
|
};
|
|
28112
28404
|
var _proto = AnimatorLayerData.prototype;
|
|
28113
28405
|
_proto.switchPlayData = function switchPlayData() {
|
|
@@ -28121,7 +28413,7 @@
|
|
|
28121
28413
|
/**
|
|
28122
28414
|
* @internal
|
|
28123
28415
|
*/ var AnimatorStateData = function AnimatorStateData() {
|
|
28124
|
-
this.
|
|
28416
|
+
this.curveLayerOwner = [];
|
|
28125
28417
|
this.eventHandlers = [];
|
|
28126
28418
|
};
|
|
28127
28419
|
/**
|
|
@@ -28133,8 +28425,7 @@
|
|
|
28133
28425
|
/** Culling mode of this Animator. */ _this.cullingMode = exports.AnimatorCullingMode.None;
|
|
28134
28426
|
/** The playback speed of the Animator, 1.0 is normal playback speed. */ _this.speed = 1.0;
|
|
28135
28427
|
_this._animatorLayersData = [];
|
|
28136
|
-
_this.
|
|
28137
|
-
_this._animationCurveOwners = [];
|
|
28428
|
+
_this._curveOwnerPool = Object.create(null);
|
|
28138
28429
|
_this._animationEventHandlerPool = new ClassPool(AnimationEventHandler);
|
|
28139
28430
|
_this._tempAnimatorStateInfo = {
|
|
28140
28431
|
layerIndex: -1,
|
|
@@ -28167,7 +28458,6 @@
|
|
|
28167
28458
|
return;
|
|
28168
28459
|
}
|
|
28169
28460
|
var animatorLayerData = this._getAnimatorLayerData(stateInfo.layerIndex);
|
|
28170
|
-
//TODO CM: Not consider same stateName, but different animation
|
|
28171
28461
|
var animatorStateData = this._getAnimatorStateData(stateName, state, animatorLayerData);
|
|
28172
28462
|
this._preparePlay(animatorLayerData, state, animatorStateData);
|
|
28173
28463
|
animatorLayerData.layerState = LayerState.Playing;
|
|
@@ -28244,7 +28534,6 @@
|
|
|
28244
28534
|
return this._getAnimatorStateInfo(stateName, layerIndex).state;
|
|
28245
28535
|
};
|
|
28246
28536
|
/**
|
|
28247
|
-
* @override
|
|
28248
28537
|
* @internal
|
|
28249
28538
|
*/ _proto._onEnable = function _onEnable() {
|
|
28250
28539
|
this.engine._componentsManager.addOnUpdateAnimations(this);
|
|
@@ -28252,7 +28541,6 @@
|
|
|
28252
28541
|
this._entity.getComponentsIncludeChildren(exports.Renderer, this._controlledRenderers);
|
|
28253
28542
|
};
|
|
28254
28543
|
/**
|
|
28255
|
-
* @override
|
|
28256
28544
|
* @internal
|
|
28257
28545
|
*/ _proto._onDisable = function _onDisable() {
|
|
28258
28546
|
this.engine._componentsManager.removeOnUpdateAnimations(this);
|
|
@@ -28260,7 +28548,7 @@
|
|
|
28260
28548
|
/**
|
|
28261
28549
|
* @internal
|
|
28262
28550
|
*/ _proto._reset = function _reset() {
|
|
28263
|
-
var _this = this, animationCurveOwners = _this.
|
|
28551
|
+
var _this = this, animationCurveOwners = _this._curveOwnerPool;
|
|
28264
28552
|
for(var instanceId in animationCurveOwners){
|
|
28265
28553
|
var propertyOwners = animationCurveOwners[instanceId];
|
|
28266
28554
|
for(var property in propertyOwners){
|
|
@@ -28269,8 +28557,7 @@
|
|
|
28269
28557
|
}
|
|
28270
28558
|
}
|
|
28271
28559
|
this._animatorLayersData.length = 0;
|
|
28272
|
-
this.
|
|
28273
|
-
this._animationCurveOwners.length = 0;
|
|
28560
|
+
this._curveOwnerPool = {};
|
|
28274
28561
|
this._animationEventHandlerPool.resetPool();
|
|
28275
28562
|
if (this._controllerUpdateFlag) {
|
|
28276
28563
|
this._controllerUpdateFlag.flag = false;
|
|
@@ -28298,10 +28585,10 @@
|
|
|
28298
28585
|
return stateInfo;
|
|
28299
28586
|
};
|
|
28300
28587
|
_proto._saveDefaultValues = function _saveDefaultValues(stateData) {
|
|
28301
|
-
var
|
|
28302
|
-
for(var i =
|
|
28303
|
-
var
|
|
28304
|
-
(
|
|
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();
|
|
28305
28592
|
}
|
|
28306
28593
|
};
|
|
28307
28594
|
_proto._getAnimatorStateData = function _getAnimatorStateData(stateName, animatorState, animatorLayerData) {
|
|
@@ -28310,25 +28597,32 @@
|
|
|
28310
28597
|
if (!animatorStateData) {
|
|
28311
28598
|
animatorStateData = new AnimatorStateData();
|
|
28312
28599
|
animatorStateDataMap[stateName] = animatorStateData;
|
|
28313
|
-
this._saveAnimatorStateData(animatorState, animatorStateData);
|
|
28600
|
+
this._saveAnimatorStateData(animatorState, animatorStateData, animatorLayerData);
|
|
28314
28601
|
this._saveAnimatorEventHandlers(animatorState, animatorStateData);
|
|
28315
28602
|
}
|
|
28316
28603
|
return animatorStateData;
|
|
28317
28604
|
};
|
|
28318
|
-
_proto._saveAnimatorStateData = function _saveAnimatorStateData(animatorState, animatorStateData) {
|
|
28319
|
-
var _this = this, entity = _this.entity,
|
|
28320
|
-
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;
|
|
28321
28609
|
var _animatorState_clip = animatorState.clip, curves = _animatorState_clip._curveBindings;
|
|
28322
28610
|
for(var i = curves.length - 1; i >= 0; i--){
|
|
28323
28611
|
var curve = curves[i];
|
|
28324
28612
|
var targetEntity = curve.relativePath === "" ? entity : entity.findByPath(curve.relativePath);
|
|
28325
28613
|
if (targetEntity) {
|
|
28614
|
+
var _curveOwnerPool, _instanceId, _propertyOwners, _property, _layerCurveOwnerPool, _instanceId1, _layerPropertyOwners, _property1;
|
|
28326
28615
|
var property = curve.property;
|
|
28327
28616
|
var instanceId = targetEntity.instanceId;
|
|
28328
|
-
|
|
28329
|
-
|
|
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;
|
|
28330
28624
|
} else {
|
|
28331
|
-
|
|
28625
|
+
curveLayerOwner[i] = null;
|
|
28332
28626
|
console.warn("The entity don't have the child entity which path is " + curve.relativePath + ".");
|
|
28333
28627
|
}
|
|
28334
28628
|
}
|
|
@@ -28356,65 +28650,61 @@
|
|
|
28356
28650
|
};
|
|
28357
28651
|
_proto._clearCrossData = function _clearCrossData(animatorLayerData) {
|
|
28358
28652
|
animatorLayerData.crossCurveMark++;
|
|
28359
|
-
|
|
28653
|
+
animatorLayerData.crossOwnerLayerDataCollection.length = 0;
|
|
28360
28654
|
};
|
|
28361
|
-
_proto.
|
|
28362
|
-
|
|
28363
|
-
|
|
28364
|
-
|
|
28655
|
+
_proto._addCrossOwner = function _addCrossOwner(animatorLayerData, layerOwner, curCurveIndex, nextCurveIndex) {
|
|
28656
|
+
layerOwner.crossSrcCurveIndex = curCurveIndex;
|
|
28657
|
+
layerOwner.crossDestCurveIndex = nextCurveIndex;
|
|
28658
|
+
animatorLayerData.crossOwnerLayerDataCollection.push(layerOwner);
|
|
28365
28659
|
};
|
|
28366
28660
|
_proto._prepareCrossFading = function _prepareCrossFading(animatorLayerData) {
|
|
28367
|
-
var crossCurveData = this._crossOwnerCollection;
|
|
28368
|
-
var crossCurveMark = animatorLayerData.crossCurveMark;
|
|
28369
28661
|
// Add src cross curve data.
|
|
28370
|
-
this._prepareSrcCrossData(
|
|
28662
|
+
this._prepareSrcCrossData(animatorLayerData, false);
|
|
28371
28663
|
// Add dest cross curve data.
|
|
28372
|
-
this._prepareDestCrossData(
|
|
28664
|
+
this._prepareDestCrossData(animatorLayerData, false);
|
|
28373
28665
|
};
|
|
28374
28666
|
_proto._prepareStandbyCrossFading = function _prepareStandbyCrossFading(animatorLayerData) {
|
|
28375
|
-
var crossOwnerCollection = this._crossOwnerCollection;
|
|
28376
|
-
var srcPlayData = animatorLayerData.srcPlayData, crossCurveMark = animatorLayerData.crossCurveMark;
|
|
28377
28667
|
// Standby have two sub state, one is never play, one is finished, never play srcPlayData.state is null.
|
|
28378
|
-
srcPlayData.state && this._prepareSrcCrossData(
|
|
28668
|
+
animatorLayerData.srcPlayData.state && this._prepareSrcCrossData(animatorLayerData, true);
|
|
28379
28669
|
// Add dest cross curve data.
|
|
28380
|
-
this._prepareDestCrossData(
|
|
28670
|
+
this._prepareDestCrossData(animatorLayerData, true);
|
|
28381
28671
|
};
|
|
28382
28672
|
_proto._prepareFixedPoseCrossFading = function _prepareFixedPoseCrossFading(animatorLayerData) {
|
|
28383
|
-
var
|
|
28673
|
+
var crossOwnerLayerDataCollection = animatorLayerData.crossOwnerLayerDataCollection;
|
|
28384
28674
|
// Save current cross curve data owner fixed pose.
|
|
28385
|
-
for(var i =
|
|
28386
|
-
var
|
|
28387
|
-
|
|
28675
|
+
for(var i = crossOwnerLayerDataCollection.length - 1; i >= 0; i--){
|
|
28676
|
+
var layerOwner = crossOwnerLayerDataCollection[i];
|
|
28677
|
+
if (!layerOwner) continue;
|
|
28678
|
+
layerOwner.curveOwner.saveFixedPoseValue();
|
|
28388
28679
|
// Reset destCurveIndex When fixed pose crossFading again.
|
|
28389
|
-
|
|
28680
|
+
layerOwner.crossDestCurveIndex = -1;
|
|
28390
28681
|
}
|
|
28391
28682
|
// prepare dest AnimatorState cross data.
|
|
28392
|
-
this._prepareDestCrossData(
|
|
28393
|
-
};
|
|
28394
|
-
_proto._prepareSrcCrossData = function _prepareSrcCrossData(
|
|
28395
|
-
var
|
|
28396
|
-
for(var i =
|
|
28397
|
-
var
|
|
28398
|
-
if (!
|
|
28399
|
-
|
|
28400
|
-
|
|
28401
|
-
|
|
28402
|
-
|
|
28403
|
-
|
|
28404
|
-
|
|
28405
|
-
|
|
28406
|
-
var
|
|
28407
|
-
|
|
28408
|
-
|
|
28409
|
-
if (
|
|
28410
|
-
|
|
28411
|
-
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;
|
|
28412
28702
|
} else {
|
|
28703
|
+
var owner = layerOwner.curveOwner;
|
|
28413
28704
|
owner.saveDefaultValue();
|
|
28414
28705
|
saveFixed && owner.saveFixedPoseValue();
|
|
28415
|
-
|
|
28416
|
-
|
|
28417
|
-
this._addCrossCurveData(crossCurveData, owner, -1, i);
|
|
28706
|
+
layerOwner.crossCurveMark = animatorLayerData.crossCurveMark;
|
|
28707
|
+
this._addCrossOwner(animatorLayerData, layerOwner, -1, i);
|
|
28418
28708
|
}
|
|
28419
28709
|
}
|
|
28420
28710
|
};
|
|
@@ -28444,7 +28734,7 @@
|
|
|
28444
28734
|
}
|
|
28445
28735
|
};
|
|
28446
28736
|
_proto._updatePlayingState = function _updatePlayingState(playData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
28447
|
-
var _playData_stateData = playData.stateData,
|
|
28737
|
+
var _playData_stateData = playData.stateData, curveLayerOwner = _playData_stateData.curveLayerOwner, eventHandlers = _playData_stateData.eventHandlers;
|
|
28448
28738
|
var state = playData.state, lastPlayState = playData.playState, lastClipTime = playData.clipTime;
|
|
28449
28739
|
var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
|
|
28450
28740
|
playData.update(this.speed < 0);
|
|
@@ -28454,8 +28744,8 @@
|
|
|
28454
28744
|
var clipTime = playData.clipTime, playState = playData.playState;
|
|
28455
28745
|
eventHandlers.length && this._fireAnimationEvents(playData, eventHandlers, lastClipTime, clipTime);
|
|
28456
28746
|
for(var i = curveBindings.length - 1; i >= 0; i--){
|
|
28457
|
-
var
|
|
28458
|
-
|
|
28747
|
+
var _curveLayerOwner_i;
|
|
28748
|
+
(_curveLayerOwner_i = curveLayerOwner[i]) == null ? void 0 : _curveLayerOwner_i.curveOwner.evaluateAndApplyValue(curveBindings[i].curve, clipTime, weight, additive);
|
|
28459
28749
|
}
|
|
28460
28750
|
playData.frameTime += state.speed * delta;
|
|
28461
28751
|
if (playState === AnimatorStatePlayState.Finished) {
|
|
@@ -28471,7 +28761,7 @@
|
|
|
28471
28761
|
}
|
|
28472
28762
|
};
|
|
28473
28763
|
_proto._updateCrossFade = function _updateCrossFade(srcPlayData, destPlayData, layerData, layerIndex, weight, delta, additive, aniUpdate) {
|
|
28474
|
-
var
|
|
28764
|
+
var crossOwnerLayerDataCollection = layerData.crossOwnerLayerDataCollection;
|
|
28475
28765
|
var _srcPlayData_state_clip = srcPlayData.state.clip, srcCurves = _srcPlayData_state_clip._curveBindings;
|
|
28476
28766
|
var srcState = srcPlayData.state, srcStateData = srcPlayData.stateData, lastSrcPlayState = srcPlayData.playState;
|
|
28477
28767
|
var srcEventHandlers = srcStateData.eventHandlers;
|
|
@@ -28510,14 +28800,16 @@
|
|
|
28510
28800
|
} else {
|
|
28511
28801
|
this._callAnimatorScriptOnUpdate(destState, layerIndex);
|
|
28512
28802
|
}
|
|
28513
|
-
for(var i =
|
|
28514
|
-
var
|
|
28515
|
-
|
|
28516
|
-
|
|
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);
|
|
28517
28809
|
}
|
|
28518
28810
|
};
|
|
28519
28811
|
_proto._updateCrossFadeFromPose = function _updateCrossFadeFromPose(destPlayData, layerData, layerIndex, layerWeight, delta, additive, aniUpdate) {
|
|
28520
|
-
var
|
|
28812
|
+
var crossOwnerLayerDataCollection = layerData.crossOwnerLayerDataCollection;
|
|
28521
28813
|
var state = destPlayData.state, stateData = destPlayData.stateData, lastPlayState = destPlayData.playState;
|
|
28522
28814
|
var eventHandlers = stateData.eventHandlers;
|
|
28523
28815
|
var _state_clip = state.clip, curveBindings = _state_clip._curveBindings;
|
|
@@ -28541,10 +28833,11 @@
|
|
|
28541
28833
|
} else {
|
|
28542
28834
|
this._callAnimatorScriptOnUpdate(state, layerIndex);
|
|
28543
28835
|
}
|
|
28544
|
-
for(var i =
|
|
28545
|
-
var
|
|
28546
|
-
|
|
28547
|
-
|
|
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);
|
|
28548
28841
|
}
|
|
28549
28842
|
};
|
|
28550
28843
|
_proto._updateCrossFadeData = function _updateCrossFadeData(layerData, crossWeight, delta, fixed) {
|
|
@@ -28566,18 +28859,19 @@
|
|
|
28566
28859
|
if (layerData.layerState === LayerState.Playing) {
|
|
28567
28860
|
var srcPlayData = layerData.srcPlayData;
|
|
28568
28861
|
if (srcPlayData.state !== playState) {
|
|
28569
|
-
var
|
|
28570
|
-
for(var i =
|
|
28571
|
-
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;
|
|
28572
28866
|
(owner == null ? void 0 : owner.hasSavedDefaultValue) && owner.revertDefaultValue();
|
|
28573
28867
|
}
|
|
28574
28868
|
this._saveDefaultValues(playStateData);
|
|
28575
28869
|
}
|
|
28576
28870
|
} else {
|
|
28577
28871
|
// layerState is CrossFading, FixedCrossFading, Standby
|
|
28578
|
-
var
|
|
28579
|
-
for(var i1 =
|
|
28580
|
-
var owner1 =
|
|
28872
|
+
var crossOwnerLayerDataCollection = layerData.crossOwnerLayerDataCollection;
|
|
28873
|
+
for(var i1 = crossOwnerLayerDataCollection.length - 1; i1 >= 0; i1--){
|
|
28874
|
+
var owner1 = crossOwnerLayerDataCollection[i1].curveOwner;
|
|
28581
28875
|
owner1.hasSavedDefaultValue && owner1.revertDefaultValue();
|
|
28582
28876
|
}
|
|
28583
28877
|
this._saveDefaultValues(playStateData);
|
|
@@ -28747,10 +29041,7 @@
|
|
|
28747
29041
|
], Animator.prototype, "_animatorLayersData", void 0);
|
|
28748
29042
|
__decorate$1([
|
|
28749
29043
|
ignoreClone
|
|
28750
|
-
], Animator.prototype, "
|
|
28751
|
-
__decorate$1([
|
|
28752
|
-
ignoreClone
|
|
28753
|
-
], Animator.prototype, "_animationCurveOwners", void 0);
|
|
29044
|
+
], Animator.prototype, "_curveOwnerPool", void 0);
|
|
28754
29045
|
__decorate$1([
|
|
28755
29046
|
ignoreClone
|
|
28756
29047
|
], Animator.prototype, "_animationEventHandlerPool", void 0);
|
|
@@ -29068,9 +29359,7 @@
|
|
|
29068
29359
|
return _this;
|
|
29069
29360
|
}
|
|
29070
29361
|
var _proto = SkyBoxMaterial.prototype;
|
|
29071
|
-
|
|
29072
|
-
* @override
|
|
29073
|
-
*/ _proto.clone = function clone() {
|
|
29362
|
+
_proto.clone = function clone() {
|
|
29074
29363
|
var dest = new SkyBoxMaterial(this._engine);
|
|
29075
29364
|
this.cloneTo(dest);
|
|
29076
29365
|
return dest;
|
|
@@ -29182,7 +29471,7 @@
|
|
|
29182
29471
|
_inherits$2(SkyProceduralMaterial, Material);
|
|
29183
29472
|
var _proto = SkyProceduralMaterial.prototype;
|
|
29184
29473
|
/**
|
|
29185
|
-
* @
|
|
29474
|
+
* @inheritDoc
|
|
29186
29475
|
*/ _proto.clone = function clone() {
|
|
29187
29476
|
var dest = new SkyProceduralMaterial(this._engine);
|
|
29188
29477
|
this.cloneTo(dest);
|
|
@@ -29379,7 +29668,6 @@
|
|
|
29379
29668
|
_inherits$2(ParticleRenderer, MeshRenderer);
|
|
29380
29669
|
var _proto = ParticleRenderer.prototype;
|
|
29381
29670
|
/**
|
|
29382
|
-
* @override
|
|
29383
29671
|
* @internal
|
|
29384
29672
|
*/ _proto.update = function update(deltaTime) {
|
|
29385
29673
|
if (!this._isInit || !this._isStart) {
|
|
@@ -29397,7 +29685,6 @@
|
|
|
29397
29685
|
this.shaderData.setFloat("u_time", this._time);
|
|
29398
29686
|
};
|
|
29399
29687
|
/**
|
|
29400
|
-
* @override
|
|
29401
29688
|
* @internal
|
|
29402
29689
|
*/ _proto._onEnable = function _onEnable() {
|
|
29403
29690
|
MeshRenderer.prototype._onEnable.call(this);
|
|
@@ -30173,7 +30460,7 @@
|
|
|
30173
30460
|
}
|
|
30174
30461
|
};
|
|
30175
30462
|
/**
|
|
30176
|
-
* @
|
|
30463
|
+
* @internal
|
|
30177
30464
|
*/ _proto._render = function _render(context) {
|
|
30178
30465
|
this._updateStrapVertices(context.camera, this._points);
|
|
30179
30466
|
this._updateStrapCoords();
|
|
@@ -30319,9 +30606,7 @@
|
|
|
30319
30606
|
* Provide hooks for users to exchange Texture.
|
|
30320
30607
|
* @remarks Prevent issue: Feedback Loops Between Textures and the Framebuffer.
|
|
30321
30608
|
*/ _proto.onTextureChange = function onTextureChange(renderColorTexture) {};
|
|
30322
|
-
|
|
30323
|
-
* @override
|
|
30324
|
-
*/ _proto.onBeginRender = function onBeginRender(camera) {
|
|
30609
|
+
_proto.onBeginRender = function onBeginRender(camera) {
|
|
30325
30610
|
if (!this.enabled) return;
|
|
30326
30611
|
this._camera = camera;
|
|
30327
30612
|
this._oriCameraCullingMask = camera.cullingMask;
|
|
@@ -30334,9 +30619,7 @@
|
|
|
30334
30619
|
this._oriCameraRenderTarget = camera.renderTarget;
|
|
30335
30620
|
camera.renderTarget = this._activeRenderTarget;
|
|
30336
30621
|
};
|
|
30337
|
-
|
|
30338
|
-
* @override
|
|
30339
|
-
*/ _proto.onEndRender = function onEndRender(camera) {
|
|
30622
|
+
_proto.onEndRender = function onEndRender(camera) {
|
|
30340
30623
|
if (!this.enabled) return;
|
|
30341
30624
|
this.onTextureChange && this.onTextureChange(this._texture);
|
|
30342
30625
|
this._activeRenderTarget = this._activeRenderTarget === this._renderTarget ? this._renderTargetSwap : this._renderTarget;
|
|
@@ -30369,17 +30652,13 @@
|
|
|
30369
30652
|
/**
|
|
30370
30653
|
* The position of the probe can be set, the default is the origin [0,0,0].
|
|
30371
30654
|
*/ _this.position = new Vector3(0, 0, 0);
|
|
30372
|
-
/**
|
|
30373
|
-
* @override
|
|
30374
|
-
*/ _this._isCube = true;
|
|
30655
|
+
/** @internal */ _this._isCube = true;
|
|
30375
30656
|
_this.oriViewMatrix = new Matrix();
|
|
30376
30657
|
return _this;
|
|
30377
30658
|
};
|
|
30378
30659
|
_inherits$2(CubeProbe, Probe);
|
|
30379
30660
|
var _proto = CubeProbe.prototype;
|
|
30380
|
-
|
|
30381
|
-
* @override
|
|
30382
|
-
*/ _proto.onBeginRender = function onBeginRender(camera) {
|
|
30661
|
+
_proto.onBeginRender = function onBeginRender(camera) {
|
|
30383
30662
|
if (!this.enabled) return;
|
|
30384
30663
|
Probe.prototype.onBeginRender.call(this, camera);
|
|
30385
30664
|
this._storeCamera(camera);
|
|
@@ -30484,6 +30763,7 @@
|
|
|
30484
30763
|
get BlendOperation () { return exports.BlendOperation; },
|
|
30485
30764
|
BlendShape: BlendShape,
|
|
30486
30765
|
BlendShapeFrame: BlendShapeFrame,
|
|
30766
|
+
BlendState: BlendState,
|
|
30487
30767
|
BlinnPhongMaterial: BlinnPhongMaterial,
|
|
30488
30768
|
BoolUpdateFlag: BoolUpdateFlag,
|
|
30489
30769
|
BoxColliderShape: BoxColliderShape,
|
|
@@ -30512,6 +30792,7 @@
|
|
|
30512
30792
|
get CullMode () { return exports.CullMode; },
|
|
30513
30793
|
get DataType () { return exports.DataType; },
|
|
30514
30794
|
get DependentMode () { return exports.DependentMode; },
|
|
30795
|
+
DepthState: DepthState,
|
|
30515
30796
|
get DiffuseMode () { return exports.DiffuseMode; },
|
|
30516
30797
|
DirectLight: DirectLight,
|
|
30517
30798
|
DynamicCollider: DynamicCollider,
|
|
@@ -30563,13 +30844,16 @@
|
|
|
30563
30844
|
get PointerPhase () { return exports.PointerPhase; },
|
|
30564
30845
|
PrimitiveMesh: PrimitiveMesh,
|
|
30565
30846
|
Probe: Probe,
|
|
30847
|
+
RasterState: RasterState,
|
|
30566
30848
|
ReferResource: ReferResource,
|
|
30567
30849
|
get RenderBufferDepthFormat () { return exports.RenderBufferDepthFormat; },
|
|
30568
30850
|
get RenderFace () { return exports.RenderFace; },
|
|
30569
30851
|
RenderPass: RenderPass,
|
|
30570
30852
|
RenderQueue: RenderQueue,
|
|
30571
30853
|
get RenderQueueType () { return exports.RenderQueueType; },
|
|
30854
|
+
RenderState: RenderState,
|
|
30572
30855
|
RenderTarget: RenderTarget,
|
|
30856
|
+
RenderTargetBlendState: RenderTargetBlendState,
|
|
30573
30857
|
get Renderer () { return exports.Renderer; },
|
|
30574
30858
|
ResourceManager: ResourceManager,
|
|
30575
30859
|
Scene: Scene,
|
|
@@ -30607,6 +30891,7 @@
|
|
|
30607
30891
|
StateMachineScript: StateMachineScript,
|
|
30608
30892
|
StaticCollider: StaticCollider,
|
|
30609
30893
|
get StencilOperation () { return exports.StencilOperation; },
|
|
30894
|
+
StencilState: StencilState,
|
|
30610
30895
|
SubMesh: SubMesh,
|
|
30611
30896
|
SubShader: SubShader,
|
|
30612
30897
|
get SunMode () { return exports.SunMode; },
|
|
@@ -30832,8 +31117,9 @@
|
|
|
30832
31117
|
*/ WebGLEngine.create = function create(configuration) {
|
|
30833
31118
|
var canvas = configuration.canvas;
|
|
30834
31119
|
var webCanvas = new WebCanvas(typeof canvas === "string" ? document.getElementById(canvas) : canvas);
|
|
30835
|
-
var
|
|
30836
|
-
var engine = new WebGLEngine(webCanvas,
|
|
31120
|
+
var webGLGraphicDevice = new WebGLGraphicDevice(configuration.graphicDeviceOptions);
|
|
31121
|
+
var engine = new WebGLEngine(webCanvas, webGLGraphicDevice, configuration);
|
|
31122
|
+
// @ts-ignore
|
|
30837
31123
|
return engine._initialize(configuration);
|
|
30838
31124
|
};
|
|
30839
31125
|
_create_class$2(WebGLEngine, [
|
|
@@ -30842,6 +31128,7 @@
|
|
|
30842
31128
|
get: /**
|
|
30843
31129
|
* Web canvas.
|
|
30844
31130
|
*/ function get() {
|
|
31131
|
+
// @ts-ignore
|
|
30845
31132
|
return this._canvas;
|
|
30846
31133
|
}
|
|
30847
31134
|
}
|
|
@@ -32355,7 +32642,8 @@
|
|
|
32355
32642
|
var options = _extends$1({
|
|
32356
32643
|
webGLMode: 0,
|
|
32357
32644
|
stencil: true,
|
|
32358
|
-
_forceFlush: false
|
|
32645
|
+
_forceFlush: false,
|
|
32646
|
+
_maxAllowSkinUniformVectorCount: 256
|
|
32359
32647
|
}, initializeOptions);
|
|
32360
32648
|
if (SystemInfo.platform === exports.Platform.IPhone || SystemInfo.platform === exports.Platform.IPad) {
|
|
32361
32649
|
var version = SystemInfo.operatingSystem.match(/(\d+).?(\d+)?.?(\d+)?/);
|
|
@@ -32510,23 +32798,23 @@
|
|
|
32510
32798
|
};
|
|
32511
32799
|
_proto.activeRenderTarget = function activeRenderTarget(renderTarget, viewport, mipLevel) {
|
|
32512
32800
|
var gl = this._gl;
|
|
32801
|
+
var bufferWidth, bufferHeight;
|
|
32513
32802
|
if (renderTarget) {
|
|
32514
32803
|
var /** @ts-ignore */ _renderTarget__platformRenderTarget;
|
|
32515
32804
|
(_renderTarget__platformRenderTarget = renderTarget._platformRenderTarget) == null ? void 0 : _renderTarget__platformRenderTarget._activeRenderTarget();
|
|
32516
|
-
|
|
32517
|
-
|
|
32518
|
-
this.viewport(0, 0, width, height);
|
|
32519
|
-
this.scissor(0, 0, width, height);
|
|
32805
|
+
bufferWidth = renderTarget.width >> mipLevel;
|
|
32806
|
+
bufferHeight = renderTarget.height >> mipLevel;
|
|
32520
32807
|
} else {
|
|
32521
32808
|
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
32522
|
-
|
|
32523
|
-
|
|
32524
|
-
var height1 = drawingBufferHeight * viewport.w;
|
|
32525
|
-
var x = viewport.x * drawingBufferWidth;
|
|
32526
|
-
var y = drawingBufferHeight - viewport.y * drawingBufferHeight - height1;
|
|
32527
|
-
this.viewport(x, y, width1, height1);
|
|
32528
|
-
this.scissor(x, y, width1, height1);
|
|
32809
|
+
bufferWidth = gl.drawingBufferWidth;
|
|
32810
|
+
bufferHeight = gl.drawingBufferHeight;
|
|
32529
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);
|
|
32530
32818
|
};
|
|
32531
32819
|
_proto.activeTexture = function activeTexture(textureID) {
|
|
32532
32820
|
if (this._activeTextureID !== textureID) {
|
|
@@ -33308,9 +33596,7 @@
|
|
|
33308
33596
|
};
|
|
33309
33597
|
_inherits(GLTFContentRestorer, ContentRestorer);
|
|
33310
33598
|
var _proto = GLTFContentRestorer.prototype;
|
|
33311
|
-
|
|
33312
|
-
* @override
|
|
33313
|
-
*/ _proto.restoreContent = function restoreContent() {
|
|
33599
|
+
_proto.restoreContent = function restoreContent() {
|
|
33314
33600
|
var _this = this;
|
|
33315
33601
|
return new AssetPromise(function(resolve, reject) {
|
|
33316
33602
|
Promise.all(_this.bufferRequests.map(function(bufferRequestInfo) {
|
|
@@ -34724,21 +35010,31 @@
|
|
|
34724
35010
|
var vertexCount;
|
|
34725
35011
|
var bufferBindIndex = 0;
|
|
34726
35012
|
var positions;
|
|
34727
|
-
|
|
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
|
+
}
|
|
34728
35020
|
for(var attribute in attributes){
|
|
34729
35021
|
var accessor = accessors[attributes[attribute]];
|
|
34730
35022
|
var accessorBuffer = GLTFUtils.getAccessorBuffer(context, gltf.bufferViews, accessor);
|
|
34731
35023
|
var dataElementSize = GLTFUtils.getAccessorTypeSize(accessor.type);
|
|
34732
|
-
var
|
|
35024
|
+
var accessorCount = accessor.count;
|
|
34733
35025
|
var vertices = accessorBuffer.data;
|
|
34734
35026
|
var vertexElement = void 0;
|
|
34735
35027
|
var meshId = mesh.instanceId;
|
|
34736
35028
|
var vertexBindingInfos = accessorBuffer.vertexBindingInfos;
|
|
34737
|
-
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;
|
|
34738
35034
|
if (accessorBuffer.interleaved) {
|
|
34739
35035
|
var byteOffset = accessor.byteOffset || 0;
|
|
34740
35036
|
var stride = accessorBuffer.stride;
|
|
34741
|
-
|
|
35037
|
+
elementOffset = byteOffset % stride;
|
|
34742
35038
|
if (vertexBindingInfos[meshId] === undefined) {
|
|
34743
35039
|
vertexElement = new VertexElement(attribute, elementOffset, elementFormat, bufferBindIndex);
|
|
34744
35040
|
var vertexBuffer = accessorBuffer.vertexBuffer;
|
|
@@ -34754,7 +35050,8 @@
|
|
|
34754
35050
|
vertexElement = new VertexElement(attribute, elementOffset, elementFormat, vertexBindingInfos[meshId]);
|
|
34755
35051
|
}
|
|
34756
35052
|
} else {
|
|
34757
|
-
|
|
35053
|
+
elementOffset = 0;
|
|
35054
|
+
vertexElement = new VertexElement(attribute, elementOffset, elementFormat, bufferBindIndex);
|
|
34758
35055
|
var vertexBuffer1 = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, vertices.byteLength, exports.BufferUsage.Static);
|
|
34759
35056
|
vertexBuffer1.setData(vertices);
|
|
34760
35057
|
meshRestoreInfo.vertexBuffers.push(new BufferRestoreInfo(vertexBuffer1, accessorBuffer.restoreInfo));
|
|
@@ -34763,35 +35060,61 @@
|
|
|
34763
35060
|
}
|
|
34764
35061
|
vertexElements.push(vertexElement);
|
|
34765
35062
|
if (attribute === "POSITION") {
|
|
34766
|
-
vertexCount =
|
|
35063
|
+
vertexCount = accessorCount;
|
|
34767
35064
|
var _mesh_bounds = mesh.bounds, min = _mesh_bounds.min, max = _mesh_bounds.max;
|
|
34768
35065
|
if (accessor.min && accessor.max) {
|
|
34769
35066
|
min.copyFromArray(accessor.min);
|
|
34770
35067
|
max.copyFromArray(accessor.max);
|
|
34771
35068
|
if (keepMeshData) {
|
|
34772
|
-
var
|
|
34773
|
-
|
|
34774
|
-
|
|
34775
|
-
|
|
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;
|
|
34776
35076
|
}
|
|
34777
35077
|
}
|
|
34778
35078
|
} else {
|
|
34779
|
-
var
|
|
35079
|
+
var position1 = GLTFMeshParser._tempVector3;
|
|
34780
35080
|
min.set(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
|
|
34781
35081
|
max.set(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);
|
|
34782
|
-
var
|
|
34783
|
-
|
|
34784
|
-
|
|
34785
|
-
|
|
34786
|
-
|
|
34787
|
-
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
|
+
}
|
|
34788
35094
|
}
|
|
34789
35095
|
}
|
|
34790
|
-
if (
|
|
34791
|
-
var scaleFactor = GLTFUtils.getNormalizedComponentScale(accessor.componentType);
|
|
35096
|
+
if (elementNormalized) {
|
|
34792
35097
|
min.scale(scaleFactor);
|
|
34793
35098
|
max.scale(scaleFactor);
|
|
34794
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
|
+
}
|
|
34795
35118
|
}
|
|
34796
35119
|
}
|
|
34797
35120
|
mesh.setVertexElements(vertexElements);
|
|
@@ -34810,6 +35133,10 @@
|
|
|
34810
35133
|
mesh.uploadData(!keepMeshData);
|
|
34811
35134
|
//@ts-ignore
|
|
34812
35135
|
mesh._positions = positions;
|
|
35136
|
+
//@ts-ignore
|
|
35137
|
+
mesh._boneIndices = boneIndices;
|
|
35138
|
+
//@ts-ignore
|
|
35139
|
+
mesh._boneWeights = boneWeights;
|
|
34813
35140
|
return Promise.resolve(mesh);
|
|
34814
35141
|
};
|
|
34815
35142
|
/**
|
|
@@ -34899,14 +35226,7 @@
|
|
|
34899
35226
|
camera.enabled = false;
|
|
34900
35227
|
};
|
|
34901
35228
|
_proto._createRenderer = function _createRenderer(context, glTFNode, entity) {
|
|
34902
|
-
var
|
|
34903
|
-
var glTFMeshes = glTF.meshes;
|
|
34904
|
-
var engine = glTFResource.engine, meshes = glTFResource.meshes, materials = glTFResource.materials, skins = glTFResource.skins;
|
|
34905
|
-
var meshID = glTFNode.mesh, skinID = glTFNode.skin;
|
|
34906
|
-
var glTFMesh = glTFMeshes[meshID];
|
|
34907
|
-
var glTFMeshPrimitives = glTFMesh.primitives;
|
|
34908
|
-
var blendShapeWeights = glTFNode.weights || glTFMesh.weights;
|
|
34909
|
-
for(var i = 0; i < glTFMeshPrimitives.length; i++){
|
|
35229
|
+
var _loop = function _loop(i) {
|
|
34910
35230
|
var gltfPrimitive = glTFMeshPrimitives[i];
|
|
34911
35231
|
var mesh = meshes[meshID][i];
|
|
34912
35232
|
var renderer = void 0;
|
|
@@ -34928,8 +35248,22 @@
|
|
|
34928
35248
|
var materialIndex = gltfPrimitive.material;
|
|
34929
35249
|
var material = (materials == null ? void 0 : materials[materialIndex]) || GLTFSceneParser._getDefaultMaterial(engine);
|
|
34930
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
|
+
});
|
|
34931
35257
|
GLTFParser.executeExtensionsAdditiveAndParse(gltfPrimitive.extensions, context, renderer, gltfPrimitive);
|
|
34932
|
-
}
|
|
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);
|
|
34933
35267
|
};
|
|
34934
35268
|
_proto._createAnimator = function _createAnimator(context) {
|
|
34935
35269
|
if (!context.hasSkinned && !context.glTFResource.animations) {
|
|
@@ -35224,7 +35558,7 @@
|
|
|
35224
35558
|
_inherits(GLTFResource, EngineObject);
|
|
35225
35559
|
var _proto = GLTFResource.prototype;
|
|
35226
35560
|
/**
|
|
35227
|
-
* @
|
|
35561
|
+
* @internal
|
|
35228
35562
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
35229
35563
|
EngineObject.prototype._onDestroy.call(this);
|
|
35230
35564
|
this.defaultSceneRoot.destroy();
|
|
@@ -35247,9 +35581,7 @@
|
|
|
35247
35581
|
};
|
|
35248
35582
|
_inherits(GLTFLoader, Loader);
|
|
35249
35583
|
var _proto = GLTFLoader.prototype;
|
|
35250
|
-
|
|
35251
|
-
* @override
|
|
35252
|
-
*/ _proto.load = function load(item, resourceManager) {
|
|
35584
|
+
_proto.load = function load(item, resourceManager) {
|
|
35253
35585
|
var url = item.url;
|
|
35254
35586
|
var params = item.params;
|
|
35255
35587
|
var context = new GLTFParserContext(url);
|
|
@@ -35867,6 +36199,15 @@
|
|
|
35867
36199
|
"ktx"
|
|
35868
36200
|
])
|
|
35869
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
|
+
}
|
|
35870
36211
|
var MaterialLoader = /*#__PURE__*/ function(Loader) {
|
|
35871
36212
|
var MaterialLoader = function MaterialLoader() {
|
|
35872
36213
|
return Loader.apply(this, arguments);
|
|
@@ -35878,7 +36219,7 @@
|
|
|
35878
36219
|
return new AssetPromise(function(resolve, reject) {
|
|
35879
36220
|
_this.request(item.url, _extends({}, item, {
|
|
35880
36221
|
type: "json"
|
|
35881
|
-
})).then(function(
|
|
36222
|
+
})).then(function(materialSchema) {
|
|
35882
36223
|
var _loop = function _loop(key) {
|
|
35883
36224
|
var _shaderData_key = shaderData[key], type = _shaderData_key.type, value = _shaderData_key.value;
|
|
35884
36225
|
switch(type){
|
|
@@ -35905,27 +36246,8 @@
|
|
|
35905
36246
|
}
|
|
35906
36247
|
};
|
|
35907
36248
|
var engine = resourceManager.engine;
|
|
35908
|
-
var name =
|
|
35909
|
-
var material;
|
|
35910
|
-
switch(shader){
|
|
35911
|
-
case "pbr":
|
|
35912
|
-
material = new PBRMaterial(engine);
|
|
35913
|
-
break;
|
|
35914
|
-
case "pbr-specular":
|
|
35915
|
-
material = new PBRSpecularMaterial(engine);
|
|
35916
|
-
break;
|
|
35917
|
-
case "unlit":
|
|
35918
|
-
material = new UnlitMaterial(engine);
|
|
35919
|
-
break;
|
|
35920
|
-
case "blinn-phong":
|
|
35921
|
-
material = new BlinnPhongMaterial(engine);
|
|
35922
|
-
break;
|
|
35923
|
-
case "bake-pbr":
|
|
35924
|
-
// @todo refactor custom shader later
|
|
35925
|
-
// @ts-ignore
|
|
35926
|
-
material = new PBRBaseMaterial(engine, Shader.find("bake-pbr"));
|
|
35927
|
-
break;
|
|
35928
|
-
}
|
|
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));
|
|
35929
36251
|
material.name = name;
|
|
35930
36252
|
var texturePromises = new Array();
|
|
35931
36253
|
var materialShaderData = material.shaderData;
|
|
@@ -35938,9 +36260,7 @@
|
|
|
35938
36260
|
materialShaderData.enableMacro(name1, value);
|
|
35939
36261
|
}
|
|
35940
36262
|
}
|
|
35941
|
-
|
|
35942
|
-
material[key1] = renderState[key1];
|
|
35943
|
-
}
|
|
36263
|
+
parseProperty(material, "renderState", renderState);
|
|
35944
36264
|
return Promise.all(texturePromises).then(function() {
|
|
35945
36265
|
resolve(material);
|
|
35946
36266
|
});
|
|
@@ -36676,6 +36996,11 @@
|
|
|
36676
36996
|
exports.AnimationClipDecoder = __decorate([
|
|
36677
36997
|
decoder("AnimationClip")
|
|
36678
36998
|
], exports.AnimationClipDecoder);
|
|
36999
|
+
exports.SpecularMode = void 0;
|
|
37000
|
+
(function(SpecularMode) {
|
|
37001
|
+
SpecularMode["Sky"] = "Sky";
|
|
37002
|
+
SpecularMode["Custom"] = "Custom";
|
|
37003
|
+
})(exports.SpecularMode || (exports.SpecularMode = {}));
|
|
36679
37004
|
var SceneParserContext = /*#__PURE__*/ function() {
|
|
36680
37005
|
var SceneParserContext = function SceneParserContext(originalData, scene) {
|
|
36681
37006
|
this.originalData = originalData;
|
|
@@ -36951,7 +37276,7 @@
|
|
|
36951
37276
|
var atlasItem = atlasItems[i];
|
|
36952
37277
|
if (atlasItem.img) {
|
|
36953
37278
|
chainPromises.push(resourceManager.load({
|
|
36954
|
-
url: atlasItem.img,
|
|
37279
|
+
url: Utils.resolveAbsoluteUrl(item.url, atlasItem.img),
|
|
36955
37280
|
type: exports.AssetType.Texture2D,
|
|
36956
37281
|
params: {
|
|
36957
37282
|
format: format,
|
|
@@ -37060,9 +37385,7 @@
|
|
|
37060
37385
|
};
|
|
37061
37386
|
_inherits(Texture2DContentRestorer, ContentRestorer);
|
|
37062
37387
|
var _proto = Texture2DContentRestorer.prototype;
|
|
37063
|
-
|
|
37064
|
-
* @override
|
|
37065
|
-
*/ _proto.restoreContent = function restoreContent() {
|
|
37388
|
+
_proto.restoreContent = function restoreContent() {
|
|
37066
37389
|
var _this = this;
|
|
37067
37390
|
return request(this.url, this.requestConfig).then(function(image) {
|
|
37068
37391
|
var resource = _this.resource;
|
|
@@ -37079,9 +37402,7 @@
|
|
|
37079
37402
|
};
|
|
37080
37403
|
_inherits(Texture2DLoader, Loader);
|
|
37081
37404
|
var _proto = Texture2DLoader.prototype;
|
|
37082
|
-
|
|
37083
|
-
* @override
|
|
37084
|
-
*/ _proto.load = function load(item, resourceManager) {
|
|
37405
|
+
_proto.load = function load(item, resourceManager) {
|
|
37085
37406
|
var _this = this;
|
|
37086
37407
|
return new AssetPromise(function(resolve, reject) {
|
|
37087
37408
|
var url = item.url;
|
|
@@ -37126,9 +37447,7 @@
|
|
|
37126
37447
|
};
|
|
37127
37448
|
_inherits(TextureCubeContentRestorer, ContentRestorer);
|
|
37128
37449
|
var _proto = TextureCubeContentRestorer.prototype;
|
|
37129
|
-
|
|
37130
|
-
* @override
|
|
37131
|
-
*/ _proto.restoreContent = function restoreContent() {
|
|
37450
|
+
_proto.restoreContent = function restoreContent() {
|
|
37132
37451
|
var _this = this;
|
|
37133
37452
|
return new AssetPromise(function(resolve, reject) {
|
|
37134
37453
|
Promise.all(_this.urls.map(function(url) {
|
|
@@ -37153,9 +37472,7 @@
|
|
|
37153
37472
|
};
|
|
37154
37473
|
_inherits(TextureCubeLoader, Loader);
|
|
37155
37474
|
var _proto = TextureCubeLoader.prototype;
|
|
37156
|
-
|
|
37157
|
-
* @override
|
|
37158
|
-
*/ _proto.load = function load(item, resourceManager) {
|
|
37475
|
+
_proto.load = function load(item, resourceManager) {
|
|
37159
37476
|
var _this = this;
|
|
37160
37477
|
return new AssetPromise(function(resolve, reject) {
|
|
37161
37478
|
var urls = item.urls;
|
|
@@ -37228,47 +37545,63 @@
|
|
|
37228
37545
|
// @ts-ignore
|
|
37229
37546
|
engine.resourceManager.initVirtualResources(data.files);
|
|
37230
37547
|
return SceneParser.parse(engine, data).then(function(scene) {
|
|
37548
|
+
var promises = [];
|
|
37231
37549
|
// parse ambient light
|
|
37232
37550
|
var ambient = data.scene.ambient;
|
|
37233
|
-
var
|
|
37234
|
-
if (ambient.
|
|
37235
|
-
|
|
37236
|
-
|
|
37237
|
-
|
|
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;
|
|
37238
37557
|
scene.ambientLight.diffuseIntensity = ambient.diffuseIntensity;
|
|
37239
37558
|
scene.ambientLight.specularIntensity = ambient.specularIntensity;
|
|
37559
|
+
scene.ambientLight.diffuseMode = ambient.diffuseMode;
|
|
37560
|
+
scene.ambientLight.diffuseSolidColor.copyFrom(ambient.diffuseSolidColor);
|
|
37240
37561
|
});
|
|
37241
|
-
|
|
37242
|
-
|
|
37243
|
-
|
|
37244
|
-
|
|
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);
|
|
37245
37574
|
}
|
|
37246
37575
|
var background = data.scene.background;
|
|
37247
37576
|
scene.background.mode = background.mode;
|
|
37248
|
-
var backgroundPromise = Promise.resolve();
|
|
37249
37577
|
switch(scene.background.mode){
|
|
37250
37578
|
case exports.BackgroundMode.SolidColor:
|
|
37251
37579
|
scene.background.solidColor.copyFrom(background.color);
|
|
37252
37580
|
break;
|
|
37253
37581
|
case exports.BackgroundMode.Sky:
|
|
37254
|
-
if (background.
|
|
37582
|
+
if (background.skyMesh && background.skyMaterial) {
|
|
37255
37583
|
// @ts-ignore
|
|
37256
|
-
|
|
37257
|
-
|
|
37258
|
-
var skyMaterial = new SkyBoxMaterial(engine);
|
|
37259
|
-
skyMaterial.texture = light.specularTexture;
|
|
37260
|
-
skyMaterial.textureDecodeRGBM = true;
|
|
37261
|
-
sky.material = skyMaterial;
|
|
37262
|
-
sky.mesh = PrimitiveMesh.createCuboid(engine, 1, 1, 1);
|
|
37584
|
+
var skyMeshPromise = resourceManager.getResourceByRef(background.skyMesh).then(function(mesh) {
|
|
37585
|
+
scene.background.sky.mesh = mesh;
|
|
37263
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");
|
|
37264
37595
|
}
|
|
37265
37596
|
break;
|
|
37266
37597
|
case exports.BackgroundMode.Texture:
|
|
37267
37598
|
if (background.texture) {
|
|
37268
37599
|
// @ts-ignore
|
|
37269
|
-
|
|
37600
|
+
// prettier-ignore
|
|
37601
|
+
var backgroundPromise = resourceManager.getResourceByRef(background.texture).then(function(texture) {
|
|
37270
37602
|
scene.background.texture = texture;
|
|
37271
37603
|
});
|
|
37604
|
+
promises.push(backgroundPromise);
|
|
37272
37605
|
}
|
|
37273
37606
|
break;
|
|
37274
37607
|
}
|
|
@@ -37280,10 +37613,7 @@
|
|
|
37280
37613
|
if (shadow.shadowDistance != undefined) scene.shadowDistance = shadow.shadowDistance;
|
|
37281
37614
|
if (shadow.shadowCascades != undefined) scene.shadowCascades = shadow.shadowCascades;
|
|
37282
37615
|
}
|
|
37283
|
-
return Promise.all(
|
|
37284
|
-
ambientLightPromise,
|
|
37285
|
-
backgroundPromise
|
|
37286
|
-
]).then(function() {
|
|
37616
|
+
return Promise.all(promises).then(function() {
|
|
37287
37617
|
resolve(scene);
|
|
37288
37618
|
});
|
|
37289
37619
|
});
|
|
@@ -37318,16 +37648,12 @@
|
|
|
37318
37648
|
};
|
|
37319
37649
|
_inherits(KHR_draco_mesh_compression1, GLTFExtensionParser);
|
|
37320
37650
|
var _proto = KHR_draco_mesh_compression1.prototype;
|
|
37321
|
-
|
|
37322
|
-
* @override
|
|
37323
|
-
*/ _proto.initialize = function initialize() {
|
|
37651
|
+
_proto.initialize = function initialize() {
|
|
37324
37652
|
if (!KHR_draco_mesh_compression._decoder) {
|
|
37325
37653
|
KHR_draco_mesh_compression._decoder = new DRACODecoder();
|
|
37326
37654
|
}
|
|
37327
37655
|
};
|
|
37328
|
-
|
|
37329
|
-
* @override
|
|
37330
|
-
*/ _proto.createAndParse = function createAndParse(context, schema, glTFPrimitive, glTFMesh) {
|
|
37656
|
+
_proto.createAndParse = function createAndParse(context, schema, glTFPrimitive, glTFMesh) {
|
|
37331
37657
|
var _this = this;
|
|
37332
37658
|
var glTF = context.glTF, buffers = context.buffers, engine = context.glTFResource.engine;
|
|
37333
37659
|
var bufferViews = glTF.bufferViews, accessors = glTF.accessors;
|
|
@@ -37481,9 +37807,7 @@
|
|
|
37481
37807
|
};
|
|
37482
37808
|
_inherits(KHR_lights_punctual, GLTFExtensionParser);
|
|
37483
37809
|
var _proto = KHR_lights_punctual.prototype;
|
|
37484
|
-
|
|
37485
|
-
* @override
|
|
37486
|
-
*/ _proto.additiveParse = function additiveParse(context, entity, extensionSchema) {
|
|
37810
|
+
_proto.additiveParse = function additiveParse(context, entity, extensionSchema) {
|
|
37487
37811
|
var lightsSchema = context.glTF.extensions.KHR_lights_punctual.lights;
|
|
37488
37812
|
var lightSchema = lightsSchema[extensionSchema.light];
|
|
37489
37813
|
var color = lightSchema.color, _lightSchema_intensity = lightSchema.intensity, intensity = _lightSchema_intensity === void 0 ? 1 : _lightSchema_intensity, type = lightSchema.type, range = lightSchema.range, spot = lightSchema.spot;
|
|
@@ -37522,9 +37846,7 @@
|
|
|
37522
37846
|
};
|
|
37523
37847
|
_inherits(KHR_materials_clearcoat, GLTFExtensionParser);
|
|
37524
37848
|
var _proto = KHR_materials_clearcoat.prototype;
|
|
37525
|
-
|
|
37526
|
-
* @override
|
|
37527
|
-
*/ _proto.additiveParse = function additiveParse(context, material, schema) {
|
|
37849
|
+
_proto.additiveParse = function additiveParse(context, material, schema) {
|
|
37528
37850
|
var textures = context.glTFResource.textures;
|
|
37529
37851
|
var _schema_clearcoatFactor = schema.clearcoatFactor, clearcoatFactor = _schema_clearcoatFactor === void 0 ? 0 : _schema_clearcoatFactor, clearcoatTexture = schema.clearcoatTexture, _schema_clearcoatRoughnessFactor = schema.clearcoatRoughnessFactor, clearcoatRoughnessFactor = _schema_clearcoatRoughnessFactor === void 0 ? 0 : _schema_clearcoatRoughnessFactor, clearcoatRoughnessTexture = schema.clearcoatRoughnessTexture, clearcoatNormalTexture = schema.clearcoatNormalTexture;
|
|
37530
37852
|
material.clearCoat = clearcoatFactor;
|
|
@@ -37547,15 +37869,28 @@
|
|
|
37547
37869
|
KHR_materials_clearcoat = __decorate([
|
|
37548
37870
|
registerGLTFExtension("KHR_materials_clearcoat", exports.GLTFExtensionMode.AdditiveParse)
|
|
37549
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);
|
|
37550
37887
|
var KHR_materials_pbrSpecularGlossiness = /*#__PURE__*/ function(GLTFExtensionParser) {
|
|
37551
37888
|
var KHR_materials_pbrSpecularGlossiness = function KHR_materials_pbrSpecularGlossiness() {
|
|
37552
37889
|
return GLTFExtensionParser.apply(this, arguments);
|
|
37553
37890
|
};
|
|
37554
37891
|
_inherits(KHR_materials_pbrSpecularGlossiness, GLTFExtensionParser);
|
|
37555
37892
|
var _proto = KHR_materials_pbrSpecularGlossiness.prototype;
|
|
37556
|
-
|
|
37557
|
-
* @override
|
|
37558
|
-
*/ _proto.createAndParse = function createAndParse(context, schema, ownerSchema) {
|
|
37893
|
+
_proto.createAndParse = function createAndParse(context, schema, ownerSchema) {
|
|
37559
37894
|
var _context_glTFResource = context.glTFResource, engine = _context_glTFResource.engine, textures = _context_glTFResource.textures;
|
|
37560
37895
|
var material = new PBRSpecularMaterial(engine);
|
|
37561
37896
|
var diffuseFactor = schema.diffuseFactor, diffuseTexture = schema.diffuseTexture, specularFactor = schema.specularFactor, glossinessFactor = schema.glossinessFactor, specularGlossinessTexture = schema.specularGlossinessTexture;
|
|
@@ -37591,9 +37926,7 @@
|
|
|
37591
37926
|
};
|
|
37592
37927
|
_inherits(KHR_materials_unlit, GLTFExtensionParser);
|
|
37593
37928
|
var _proto = KHR_materials_unlit.prototype;
|
|
37594
|
-
|
|
37595
|
-
* @override
|
|
37596
|
-
*/ _proto.createAndParse = function createAndParse(context, _, ownerSchema) {
|
|
37929
|
+
_proto.createAndParse = function createAndParse(context, _, ownerSchema) {
|
|
37597
37930
|
var engine = context.glTFResource.engine;
|
|
37598
37931
|
var material = new UnlitMaterial(engine);
|
|
37599
37932
|
material.name = ownerSchema.name;
|
|
@@ -37621,9 +37954,7 @@
|
|
|
37621
37954
|
};
|
|
37622
37955
|
_inherits(KHR_texture_transform, GLTFExtensionParser);
|
|
37623
37956
|
var _proto = KHR_texture_transform.prototype;
|
|
37624
|
-
|
|
37625
|
-
* @override
|
|
37626
|
-
*/ _proto.additiveParse = function additiveParse(context, material, schema) {
|
|
37957
|
+
_proto.additiveParse = function additiveParse(context, material, schema) {
|
|
37627
37958
|
var offset = schema.offset, rotation = schema.rotation, scale = schema.scale, texCoord = schema.texCoord;
|
|
37628
37959
|
if (offset) {
|
|
37629
37960
|
material.tilingOffset.z = offset[0];
|
|
@@ -37651,9 +37982,7 @@
|
|
|
37651
37982
|
};
|
|
37652
37983
|
_inherits(GALACEAN_materials_remap, GLTFExtensionParser);
|
|
37653
37984
|
var _proto = GALACEAN_materials_remap.prototype;
|
|
37654
|
-
|
|
37655
|
-
* @override
|
|
37656
|
-
*/ _proto.createAndParse = function createAndParse(context, schema) {
|
|
37985
|
+
_proto.createAndParse = function createAndParse(context, schema) {
|
|
37657
37986
|
var engine = context.glTFResource.engine;
|
|
37658
37987
|
// @ts-ignore
|
|
37659
37988
|
return engine.resourceManager.getResourceByRef(schema);
|
|
@@ -37669,9 +37998,7 @@
|
|
|
37669
37998
|
};
|
|
37670
37999
|
_inherits(GALACEAN_animation_event, GLTFExtensionParser);
|
|
37671
38000
|
var _proto = GALACEAN_animation_event.prototype;
|
|
37672
|
-
|
|
37673
|
-
* @override
|
|
37674
|
-
*/ _proto.additiveParse = function additiveParse(context, animationClip, schema) {
|
|
38001
|
+
_proto.additiveParse = function additiveParse(context, animationClip, schema) {
|
|
37675
38002
|
context.glTFResource.engine;
|
|
37676
38003
|
var events = schema.events;
|
|
37677
38004
|
events.map(function(eventData) {
|
|
@@ -37689,7 +38016,7 @@
|
|
|
37689
38016
|
], GALACEAN_animation_event);
|
|
37690
38017
|
|
|
37691
38018
|
//@ts-ignore
|
|
37692
|
-
var version = "1.0.0-beta.
|
|
38019
|
+
var version = "1.0.0-beta.10";
|
|
37693
38020
|
console.log("Galacean engine version: " + version);
|
|
37694
38021
|
for(var key in CoreObjects){
|
|
37695
38022
|
Loader.registerClass(key, CoreObjects[key]);
|
|
@@ -37713,6 +38040,7 @@
|
|
|
37713
38040
|
exports.BasicRenderPipeline = BasicRenderPipeline;
|
|
37714
38041
|
exports.BlendShape = BlendShape;
|
|
37715
38042
|
exports.BlendShapeFrame = BlendShapeFrame;
|
|
38043
|
+
exports.BlendState = BlendState;
|
|
37716
38044
|
exports.BlinnPhongMaterial = BlinnPhongMaterial;
|
|
37717
38045
|
exports.BoolUpdateFlag = BoolUpdateFlag;
|
|
37718
38046
|
exports.BoundingBox = BoundingBox;
|
|
@@ -37732,6 +38060,7 @@
|
|
|
37732
38060
|
exports.ComponentMap = ComponentMap;
|
|
37733
38061
|
exports.ContentRestorer = ContentRestorer;
|
|
37734
38062
|
exports.CubeProbe = CubeProbe;
|
|
38063
|
+
exports.DepthState = DepthState;
|
|
37735
38064
|
exports.DirectLight = DirectLight;
|
|
37736
38065
|
exports.DynamicCollider = DynamicCollider;
|
|
37737
38066
|
exports.Engine = Engine;
|
|
@@ -37786,13 +38115,16 @@
|
|
|
37786
38115
|
exports.PrimitiveMesh = PrimitiveMesh;
|
|
37787
38116
|
exports.Probe = Probe;
|
|
37788
38117
|
exports.Quaternion = Quaternion;
|
|
38118
|
+
exports.RasterState = RasterState;
|
|
37789
38119
|
exports.Ray = Ray;
|
|
37790
38120
|
exports.Rect = Rect;
|
|
37791
38121
|
exports.ReferResource = ReferResource;
|
|
37792
38122
|
exports.ReflectionParser = ReflectionParser;
|
|
37793
38123
|
exports.RenderPass = RenderPass;
|
|
37794
38124
|
exports.RenderQueue = RenderQueue;
|
|
38125
|
+
exports.RenderState = RenderState;
|
|
37795
38126
|
exports.RenderTarget = RenderTarget;
|
|
38127
|
+
exports.RenderTargetBlendState = RenderTargetBlendState;
|
|
37796
38128
|
exports.ResourceManager = ResourceManager;
|
|
37797
38129
|
exports.Scene = Scene;
|
|
37798
38130
|
exports.SceneManager = SceneManager;
|
|
@@ -37821,6 +38153,7 @@
|
|
|
37821
38153
|
exports.SpriteRenderer = SpriteRenderer;
|
|
37822
38154
|
exports.StateMachineScript = StateMachineScript;
|
|
37823
38155
|
exports.StaticCollider = StaticCollider;
|
|
38156
|
+
exports.StencilState = StencilState;
|
|
37824
38157
|
exports.SubMesh = SubMesh;
|
|
37825
38158
|
exports.SubShader = SubShader;
|
|
37826
38159
|
exports.SystemInfo = SystemInfo;
|