@galacean/engine-core 1.0.0-alpha.6 → 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +1523 -869
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +1523 -869
- package/dist/module.js +1522 -868
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/2d/atlas/types.d.ts +12 -1
- package/types/Scene.d.ts +2 -0
- package/types/Utils.d.ts +28 -0
- package/types/asset/ResourceManager.d.ts +12 -6
- package/types/base/index.d.ts +0 -1
- package/types/graphic/BufferUtil.d.ts +1 -1
- package/types/index.d.ts +1 -0
- package/types/material/BaseMaterial.d.ts +4 -4
- package/types/shaderlib/ShaderLib.d.ts +0 -1
- package/types/sky/SkyBoxMaterial.d.ts +30 -9
- package/types/sky/SkyProceduralMaterial.d.ts +1 -1
- package/types/sky/index.d.ts +1 -0
- package/types/2d/data/RenderData2D.d.ts +0 -1
- package/types/RenderPipeline/MeshRenderElement.d.ts +0 -17
- package/types/RenderPipeline/SpriteElement.d.ts +0 -13
- package/types/RenderPipeline/SpriteMaskElement.d.ts +0 -10
- package/types/RenderPipeline/TextRenderElement.d.ts +0 -6
- package/types/asset/IRefObject.d.ts +0 -2
- package/types/asset/RefObject.d.ts +0 -27
- package/types/base/Event.d.ts +0 -24
- package/types/base/Util.d.ts +0 -14
package/dist/module.js
CHANGED
|
@@ -11,56 +11,48 @@ import { Vector2, Vector4, Quaternion, Vector3, Matrix3x3, Matrix, MathUtil as M
|
|
|
11
11
|
Platform[Platform[/** Unknown platform. */ "Unknown"] = 4] = "Unknown";
|
|
12
12
|
})(Platform || (Platform = {}));
|
|
13
13
|
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
17
|
-
}
|
|
14
|
+
function _assert_this_initialized(self) {
|
|
15
|
+
if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
return self;
|
|
20
18
|
}
|
|
21
19
|
|
|
22
20
|
function _defineProperties(target, props) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
for (var i = 0; i < props.length; i++) {
|
|
22
|
+
var descriptor = props[i];
|
|
23
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
24
|
+
descriptor.configurable = true;
|
|
25
|
+
|
|
26
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
27
|
+
|
|
28
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
29
|
+
}
|
|
30
30
|
}
|
|
31
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
32
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
33
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
34
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
35
|
-
return Constructor;
|
|
35
|
+
return Constructor;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
function
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return o;
|
|
42
|
-
};
|
|
38
|
+
function _set_prototype_of(o, p) {
|
|
39
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
40
|
+
o.__proto__ = p;
|
|
43
41
|
|
|
44
|
-
|
|
45
|
-
}
|
|
42
|
+
return o;
|
|
43
|
+
};
|
|
46
44
|
|
|
47
|
-
|
|
48
|
-
return setPrototypeOf(o, p);
|
|
45
|
+
return _set_prototype_of(o, p);
|
|
49
46
|
}
|
|
50
47
|
|
|
51
48
|
function _inherits(subClass, superClass) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
57
|
-
constructor: {
|
|
58
|
-
value: subClass,
|
|
59
|
-
writable: true,
|
|
60
|
-
configurable: true
|
|
49
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
50
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
61
51
|
}
|
|
62
|
-
|
|
63
|
-
|
|
52
|
+
|
|
53
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
|
|
54
|
+
|
|
55
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
64
56
|
}
|
|
65
57
|
|
|
66
58
|
/**
|
|
@@ -108,9 +100,15 @@ function _inherits(subClass, superClass) {
|
|
|
108
100
|
};
|
|
109
101
|
return MathUtil;
|
|
110
102
|
}();
|
|
111
|
-
|
|
112
|
-
/** The
|
|
113
|
-
|
|
103
|
+
(function() {
|
|
104
|
+
/** The value for which all absolute numbers smaller than are considered equal to zero. */ MathUtil.zeroTolerance = 1e-6;
|
|
105
|
+
})();
|
|
106
|
+
(function() {
|
|
107
|
+
/** The conversion factor that radian to degree. */ MathUtil.radToDegreeFactor = 180 / Math.PI;
|
|
108
|
+
})();
|
|
109
|
+
(function() {
|
|
110
|
+
/** The conversion factor that degree to radian. */ MathUtil.degreeToRadFactor = Math.PI / 180;
|
|
111
|
+
})();
|
|
114
112
|
|
|
115
113
|
/**
|
|
116
114
|
* Describes a color in the from of RGBA (in order: R, G, B, A).
|
|
@@ -320,7 +318,7 @@ function _inherits(subClass, superClass) {
|
|
|
320
318
|
out._onValueChanged && out._onValueChanged();
|
|
321
319
|
return out;
|
|
322
320
|
};
|
|
323
|
-
|
|
321
|
+
_create_class(Color, [
|
|
324
322
|
{
|
|
325
323
|
key: "r",
|
|
326
324
|
get: /**
|
|
@@ -396,11 +394,9 @@ function __decorate(decorators, target, key, desc) {
|
|
|
396
394
|
}
|
|
397
395
|
|
|
398
396
|
function _instanceof(left, right) {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
return left instanceof right;
|
|
403
|
-
}
|
|
397
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
398
|
+
return !!right[Symbol.hasInstance](left);
|
|
399
|
+
} else return left instanceof right;
|
|
404
400
|
}
|
|
405
401
|
|
|
406
402
|
/**
|
|
@@ -581,16 +577,22 @@ function _instanceof(left, right) {
|
|
|
581
577
|
};
|
|
582
578
|
return CloneManager;
|
|
583
579
|
}();
|
|
584
|
-
|
|
585
|
-
/** @internal */ CloneManager.
|
|
586
|
-
|
|
580
|
+
(function() {
|
|
581
|
+
/** @internal */ CloneManager._subCloneModeMap = new Map();
|
|
582
|
+
})();
|
|
583
|
+
(function() {
|
|
584
|
+
/** @internal */ CloneManager._cloneModeMap = new Map();
|
|
585
|
+
})();
|
|
586
|
+
(function() {
|
|
587
|
+
CloneManager._objectType = Object.getPrototypeOf(Object);
|
|
588
|
+
})();
|
|
587
589
|
|
|
588
590
|
/**
|
|
589
591
|
* EngineObject.
|
|
590
592
|
*/ var EngineObject = /*#__PURE__*/ function() {
|
|
591
593
|
function EngineObject(engine) {
|
|
592
|
-
this._destroyed = false;
|
|
593
594
|
/** Engine unique id. */ this.instanceId = ++EngineObject._instanceIdCounter;
|
|
595
|
+
this._destroyed = false;
|
|
594
596
|
this._engine = engine;
|
|
595
597
|
}
|
|
596
598
|
var _proto = EngineObject.prototype;
|
|
@@ -606,7 +608,7 @@ CloneManager._objectType = Object.getPrototypeOf(Object);
|
|
|
606
608
|
resourceManager._deleteAsset(this);
|
|
607
609
|
resourceManager._deleteContentRestorer(this);
|
|
608
610
|
};
|
|
609
|
-
|
|
611
|
+
_create_class(EngineObject, [
|
|
610
612
|
{
|
|
611
613
|
key: "engine",
|
|
612
614
|
get: /**
|
|
@@ -626,7 +628,9 @@ CloneManager._objectType = Object.getPrototypeOf(Object);
|
|
|
626
628
|
]);
|
|
627
629
|
return EngineObject;
|
|
628
630
|
}();
|
|
629
|
-
|
|
631
|
+
(function() {
|
|
632
|
+
EngineObject._instanceIdCounter = 0;
|
|
633
|
+
})();
|
|
630
634
|
__decorate([
|
|
631
635
|
ignoreClone
|
|
632
636
|
], EngineObject.prototype, "instanceId", void 0);
|
|
@@ -643,7 +647,7 @@ __decorate([
|
|
|
643
647
|
_this = EngineObject.call(this, engine) || this;
|
|
644
648
|
/** Whether to ignore the garbage collection check, if it is true, it will not be affected by ResourceManager.gc(). */ _this.isGCIgnored = false;
|
|
645
649
|
_this._refCount = 0;
|
|
646
|
-
engine.resourceManager._addReferResource(
|
|
650
|
+
engine.resourceManager._addReferResource(_assert_this_initialized(_this));
|
|
647
651
|
return _this;
|
|
648
652
|
}
|
|
649
653
|
var _proto = ReferResource.prototype;
|
|
@@ -685,7 +689,7 @@ __decorate([
|
|
|
685
689
|
this._addReferCount(-refCount);
|
|
686
690
|
}
|
|
687
691
|
};
|
|
688
|
-
|
|
692
|
+
_create_class(ReferResource, [
|
|
689
693
|
{
|
|
690
694
|
key: "refCount",
|
|
691
695
|
get: /**
|
|
@@ -805,7 +809,7 @@ var GraphicsResource = /*#__PURE__*/ function(ReferResource) {
|
|
|
805
809
|
function GraphicsResource(engine) {
|
|
806
810
|
var _this;
|
|
807
811
|
_this = ReferResource.call(this, engine) || this;
|
|
808
|
-
engine.resourceManager._addGraphicResource(
|
|
812
|
+
engine.resourceManager._addGraphicResource(_assert_this_initialized(_this));
|
|
809
813
|
return _this;
|
|
810
814
|
}
|
|
811
815
|
var _proto = GraphicsResource.prototype;
|
|
@@ -908,7 +912,7 @@ var Logger = {
|
|
|
908
912
|
_proto._getMipmapCount = function _getMipmapCount() {
|
|
909
913
|
return this._mipmap ? Math.floor(Math.log2(Math.max(this._width, this._height))) + 1 : 1;
|
|
910
914
|
};
|
|
911
|
-
|
|
915
|
+
_create_class(Texture, [
|
|
912
916
|
{
|
|
913
917
|
key: "format",
|
|
914
918
|
get: /**
|
|
@@ -1058,7 +1062,7 @@ var Logger = {
|
|
|
1058
1062
|
}
|
|
1059
1063
|
_this._depthTexture = depth;
|
|
1060
1064
|
}
|
|
1061
|
-
_this._platformRenderTarget = engine._hardwareRenderer.createPlatformRenderTarget(
|
|
1065
|
+
_this._platformRenderTarget = engine._hardwareRenderer.createPlatformRenderTarget(_assert_this_initialized(_this));
|
|
1062
1066
|
return _this;
|
|
1063
1067
|
}
|
|
1064
1068
|
var _proto = RenderTarget.prototype;
|
|
@@ -1107,7 +1111,7 @@ var Logger = {
|
|
|
1107
1111
|
*/ _proto._rebuild = function _rebuild() {
|
|
1108
1112
|
this._platformRenderTarget = this._engine._hardwareRenderer.createPlatformRenderTarget(this);
|
|
1109
1113
|
};
|
|
1110
|
-
|
|
1114
|
+
_create_class(RenderTarget, [
|
|
1111
1115
|
{
|
|
1112
1116
|
key: "autoGenerateMipmaps",
|
|
1113
1117
|
get: /**
|
|
@@ -1179,7 +1183,7 @@ var Logger = {
|
|
|
1179
1183
|
_this._format = format;
|
|
1180
1184
|
_this._mipmapCount = _this._getMipmapCount();
|
|
1181
1185
|
_this._isDepthTexture = format == TextureFormat.Depth || format == TextureFormat.DepthStencil || format == TextureFormat.Depth16 || format == TextureFormat.Depth24 || format == TextureFormat.Depth32 || format == TextureFormat.Depth24Stencil8 || format == TextureFormat.Depth32Stencil8;
|
|
1182
|
-
_this._platformTexture = engine._hardwareRenderer.createPlatformTexture2D(
|
|
1186
|
+
_this._platformTexture = engine._hardwareRenderer.createPlatformTexture2D(_assert_this_initialized(_this));
|
|
1183
1187
|
_this.filterMode = TextureFilterMode.Bilinear;
|
|
1184
1188
|
_this.wrapModeU = _this.wrapModeV = TextureWrapMode.Repeat;
|
|
1185
1189
|
return _this;
|
|
@@ -1252,7 +1256,7 @@ var Logger = {
|
|
|
1252
1256
|
_this._length = length;
|
|
1253
1257
|
_this._format = format;
|
|
1254
1258
|
_this._mipmapCount = _this._getMipmapCount();
|
|
1255
|
-
_this._platformTexture = engine._hardwareRenderer.createPlatformTexture2DArray(
|
|
1259
|
+
_this._platformTexture = engine._hardwareRenderer.createPlatformTexture2DArray(_assert_this_initialized(_this));
|
|
1256
1260
|
_this.filterMode = TextureFilterMode.Bilinear;
|
|
1257
1261
|
_this.wrapModeU = _this.wrapModeV = TextureWrapMode.Repeat;
|
|
1258
1262
|
return _this;
|
|
@@ -1310,7 +1314,7 @@ var Logger = {
|
|
|
1310
1314
|
this._platformTexture = this._engine._hardwareRenderer.createPlatformTexture2DArray(this);
|
|
1311
1315
|
Texture.prototype._rebuild.call(this);
|
|
1312
1316
|
};
|
|
1313
|
-
|
|
1317
|
+
_create_class(Texture2DArray, [
|
|
1314
1318
|
{
|
|
1315
1319
|
key: "length",
|
|
1316
1320
|
get: /**
|
|
@@ -1337,7 +1341,7 @@ var Logger = {
|
|
|
1337
1341
|
_this._height = size;
|
|
1338
1342
|
_this._format = format;
|
|
1339
1343
|
_this._mipmapCount = _this._getMipmapCount();
|
|
1340
|
-
_this._platformTexture = engine._hardwareRenderer.createPlatformTextureCube(
|
|
1344
|
+
_this._platformTexture = engine._hardwareRenderer.createPlatformTextureCube(_assert_this_initialized(_this));
|
|
1341
1345
|
_this.filterMode = TextureFilterMode.Bilinear;
|
|
1342
1346
|
_this.wrapModeU = _this.wrapModeV = TextureWrapMode.Clamp;
|
|
1343
1347
|
return _this;
|
|
@@ -1868,23 +1872,37 @@ var Logger = {
|
|
|
1868
1872
|
};
|
|
1869
1873
|
return TextUtils;
|
|
1870
1874
|
}();
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
TextUtils.
|
|
1886
|
-
|
|
1887
|
-
|
|
1875
|
+
(function() {
|
|
1876
|
+
/** @internal */ TextUtils._genericFontFamilies = [
|
|
1877
|
+
"serif",
|
|
1878
|
+
"sans-serif",
|
|
1879
|
+
"monospace",
|
|
1880
|
+
"cursive",
|
|
1881
|
+
"fantasy",
|
|
1882
|
+
"system-ui",
|
|
1883
|
+
"math",
|
|
1884
|
+
"emoji",
|
|
1885
|
+
"fangsong"
|
|
1886
|
+
];
|
|
1887
|
+
})();
|
|
1888
|
+
(function() {
|
|
1889
|
+
/** These characters are all tall to help calculate the height required for text. */ TextUtils._measureString = "|\xc9q\xc5";
|
|
1890
|
+
})();
|
|
1891
|
+
(function() {
|
|
1892
|
+
TextUtils._measureBaseline = "M";
|
|
1893
|
+
})();
|
|
1894
|
+
(function() {
|
|
1895
|
+
TextUtils._heightMultiplier = 2;
|
|
1896
|
+
})();
|
|
1897
|
+
(function() {
|
|
1898
|
+
TextUtils._baselineMultiplier = 1.4;
|
|
1899
|
+
})();
|
|
1900
|
+
(function() {
|
|
1901
|
+
TextUtils._fontSizeInfoCache = {};
|
|
1902
|
+
})();
|
|
1903
|
+
(function() {
|
|
1904
|
+
TextUtils._textContext = null;
|
|
1905
|
+
})();
|
|
1888
1906
|
|
|
1889
1907
|
/**
|
|
1890
1908
|
* @internal
|
|
@@ -2045,7 +2063,7 @@ TextUtils._textContext = null;
|
|
|
2045
2063
|
}
|
|
2046
2064
|
return null;
|
|
2047
2065
|
};
|
|
2048
|
-
|
|
2066
|
+
_create_class(Font, [
|
|
2049
2067
|
{
|
|
2050
2068
|
key: "name",
|
|
2051
2069
|
get: /**
|
|
@@ -2058,74 +2076,6 @@ TextUtils._textContext = null;
|
|
|
2058
2076
|
return Font;
|
|
2059
2077
|
}(ReferResource);
|
|
2060
2078
|
|
|
2061
|
-
var Util = {
|
|
2062
|
-
isArray: "isArray" in Array ? Array.isArray : function(value) {
|
|
2063
|
-
return toString.call(value) === "[object Array]";
|
|
2064
|
-
},
|
|
2065
|
-
isArrayLike: function isArrayLike(x) {
|
|
2066
|
-
return !!x && typeof x.length === "number" && typeof x !== "function";
|
|
2067
|
-
},
|
|
2068
|
-
clone: function clone(obj) {
|
|
2069
|
-
if (typeof obj !== "object" || obj === null) {
|
|
2070
|
-
return obj;
|
|
2071
|
-
}
|
|
2072
|
-
var rst;
|
|
2073
|
-
if (Util.isArrayLike(obj)) {
|
|
2074
|
-
rst = obj.slice();
|
|
2075
|
-
for(var i = 0, l = obj.length; i < l; i++){
|
|
2076
|
-
rst[i] = Util.clone(obj[i]);
|
|
2077
|
-
}
|
|
2078
|
-
} else {
|
|
2079
|
-
rst = {};
|
|
2080
|
-
for(var k in obj){
|
|
2081
|
-
if (obj.hasOwnProperty(k)) {
|
|
2082
|
-
rst[k] = Util.clone(obj[k]);
|
|
2083
|
-
}
|
|
2084
|
-
}
|
|
2085
|
-
}
|
|
2086
|
-
return rst;
|
|
2087
|
-
},
|
|
2088
|
-
downloadBlob: function downloadBlob(blob, fileName) {
|
|
2089
|
-
if (fileName === void 0) fileName = "";
|
|
2090
|
-
var url = window.URL.createObjectURL(blob);
|
|
2091
|
-
var a = document.createElement("a");
|
|
2092
|
-
document.body.appendChild(a);
|
|
2093
|
-
a.style.display = "none";
|
|
2094
|
-
a.href = url;
|
|
2095
|
-
a.download = fileName;
|
|
2096
|
-
a.addEventListener("click", function() {
|
|
2097
|
-
if (a.parentElement) {
|
|
2098
|
-
a.parentElement.removeChild(a);
|
|
2099
|
-
}
|
|
2100
|
-
});
|
|
2101
|
-
a.click();
|
|
2102
|
-
window.URL.revokeObjectURL(url);
|
|
2103
|
-
}
|
|
2104
|
-
};
|
|
2105
|
-
/**
|
|
2106
|
-
* Fastly remove an element from array.
|
|
2107
|
-
* @param array - Array
|
|
2108
|
-
* @param item - Element
|
|
2109
|
-
*/ function removeFromArray(array, item) {
|
|
2110
|
-
var index = array.indexOf(item);
|
|
2111
|
-
if (index < 0) {
|
|
2112
|
-
return false;
|
|
2113
|
-
}
|
|
2114
|
-
var last = array.length - 1;
|
|
2115
|
-
if (index !== last) {
|
|
2116
|
-
var end = array[last];
|
|
2117
|
-
array[index] = end;
|
|
2118
|
-
}
|
|
2119
|
-
array.length--;
|
|
2120
|
-
return true;
|
|
2121
|
-
}
|
|
2122
|
-
function ObjectValues(obj) {
|
|
2123
|
-
return Object.keys(obj).map(function(key) {
|
|
2124
|
-
return obj[key];
|
|
2125
|
-
});
|
|
2126
|
-
}
|
|
2127
|
-
|
|
2128
|
-
var _Symbol_toStringTag = Symbol.toStringTag;
|
|
2129
2079
|
var AssetPromise = /*#__PURE__*/ function() {
|
|
2130
2080
|
function AssetPromise(executor) {
|
|
2131
2081
|
var _this = this;
|
|
@@ -2244,9 +2194,9 @@ var AssetPromise = /*#__PURE__*/ function() {
|
|
|
2244
2194
|
}
|
|
2245
2195
|
});
|
|
2246
2196
|
};
|
|
2247
|
-
|
|
2197
|
+
_create_class(AssetPromise, [
|
|
2248
2198
|
{
|
|
2249
|
-
key:
|
|
2199
|
+
key: Symbol.toStringTag,
|
|
2250
2200
|
get: /** compatible with Promise */ function get() {
|
|
2251
2201
|
return "AssetPromise";
|
|
2252
2202
|
}
|
|
@@ -2294,10 +2244,25 @@ var /** @internal */ PromiseState;
|
|
|
2294
2244
|
});
|
|
2295
2245
|
return AssetPromise.all(promises);
|
|
2296
2246
|
};
|
|
2247
|
+
/**
|
|
2248
|
+
* Get the resource from cache by asset url, return the resource object if it loaded, otherwise return null.
|
|
2249
|
+
* @param url - Resource url
|
|
2250
|
+
* @returns Resource object
|
|
2251
|
+
*/ _proto.getFromCache = function getFromCache(url) {
|
|
2252
|
+
var _this__assetUrlPool_url;
|
|
2253
|
+
return (_this__assetUrlPool_url = this._assetUrlPool[url]) != null ? _this__assetUrlPool_url : null;
|
|
2254
|
+
};
|
|
2255
|
+
/**
|
|
2256
|
+
* Get asset url from instanceId.
|
|
2257
|
+
* @param instanceId - Engine instance id
|
|
2258
|
+
* @returns Asset url
|
|
2259
|
+
*/ _proto.getAssetPath = function getAssetPath(instanceId) {
|
|
2260
|
+
return this._assetPool[instanceId];
|
|
2261
|
+
};
|
|
2297
2262
|
_proto.cancelNotLoaded = function cancelNotLoaded(url) {
|
|
2298
2263
|
var _this = this;
|
|
2299
2264
|
if (!url) {
|
|
2300
|
-
|
|
2265
|
+
Utils.objectValues(this._loadingPromises).forEach(function(promise) {
|
|
2301
2266
|
promise.cancel();
|
|
2302
2267
|
});
|
|
2303
2268
|
} else if (typeof url === "string") {
|
|
@@ -2317,13 +2282,6 @@ var /** @internal */ PromiseState;
|
|
|
2317
2282
|
this._gc(false);
|
|
2318
2283
|
};
|
|
2319
2284
|
/**
|
|
2320
|
-
* Get asset url from instanceId.
|
|
2321
|
-
* @param instanceId - Engine instance id
|
|
2322
|
-
* @returns Asset url
|
|
2323
|
-
*/ _proto.getAssetPath = function getAssetPath(instanceId) {
|
|
2324
|
-
return this._assetPool[instanceId];
|
|
2325
|
-
};
|
|
2326
|
-
/**
|
|
2327
2285
|
* Add content restorer.
|
|
2328
2286
|
* @param restorer - The restorer
|
|
2329
2287
|
*/ _proto.addContentRestorer = function addContentRestorer(restorer) {
|
|
@@ -2495,7 +2453,7 @@ var /** @internal */ PromiseState;
|
|
|
2495
2453
|
}
|
|
2496
2454
|
};
|
|
2497
2455
|
_proto._gc = function _gc(forceDestroy) {
|
|
2498
|
-
var objects =
|
|
2456
|
+
var objects = Utils.objectValues(this._referResourcePool);
|
|
2499
2457
|
for(var i = 0, len = objects.length; i < len; i++){
|
|
2500
2458
|
if (!objects[i].isGCIgnored || forceDestroy) {
|
|
2501
2459
|
objects[i].destroy();
|
|
@@ -2597,8 +2555,12 @@ var /** @internal */ PromiseState;
|
|
|
2597
2555
|
};
|
|
2598
2556
|
return ResourceManager;
|
|
2599
2557
|
}();
|
|
2600
|
-
|
|
2601
|
-
ResourceManager.
|
|
2558
|
+
(function() {
|
|
2559
|
+
/** Loader collection. */ ResourceManager._loaders = {};
|
|
2560
|
+
})();
|
|
2561
|
+
(function() {
|
|
2562
|
+
ResourceManager._extTypeMapping = {};
|
|
2563
|
+
})();
|
|
2602
2564
|
/**
|
|
2603
2565
|
* Declare ResourceLoader's decorator.
|
|
2604
2566
|
* @param assetType - Type of asset
|
|
@@ -2808,7 +2770,7 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
2808
2770
|
var shaderProperty = ShaderProperty._propertyNameMap[propertyName];
|
|
2809
2771
|
return shaderProperty == null ? void 0 : shaderProperty._group;
|
|
2810
2772
|
};
|
|
2811
|
-
|
|
2773
|
+
_create_class(ShaderProperty, [
|
|
2812
2774
|
{
|
|
2813
2775
|
key: "type",
|
|
2814
2776
|
get: /**
|
|
@@ -2820,9 +2782,15 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
2820
2782
|
]);
|
|
2821
2783
|
return ShaderProperty;
|
|
2822
2784
|
}();
|
|
2823
|
-
|
|
2824
|
-
ShaderProperty.
|
|
2825
|
-
|
|
2785
|
+
(function() {
|
|
2786
|
+
/** @internal */ ShaderProperty._propertyIdMap = Object.create(null);
|
|
2787
|
+
})();
|
|
2788
|
+
(function() {
|
|
2789
|
+
ShaderProperty._propertyNameCounter = 0;
|
|
2790
|
+
})();
|
|
2791
|
+
(function() {
|
|
2792
|
+
ShaderProperty._propertyNameMap = Object.create(null);
|
|
2793
|
+
})();
|
|
2826
2794
|
|
|
2827
2795
|
/**
|
|
2828
2796
|
* Provide time related information.
|
|
@@ -2868,7 +2836,7 @@ ShaderProperty._propertyNameMap = Object.create(null);
|
|
|
2868
2836
|
deltaTimeValue.set(this._deltaTime, 0, 0, 0);
|
|
2869
2837
|
shaderData.setVector4(Time._deltaTimeProperty, deltaTimeValue);
|
|
2870
2838
|
};
|
|
2871
|
-
|
|
2839
|
+
_create_class(Time, [
|
|
2872
2840
|
{
|
|
2873
2841
|
key: "frameCount",
|
|
2874
2842
|
get: /*
|
|
@@ -2916,8 +2884,12 @@ ShaderProperty._propertyNameMap = Object.create(null);
|
|
|
2916
2884
|
]);
|
|
2917
2885
|
return Time;
|
|
2918
2886
|
}();
|
|
2919
|
-
|
|
2920
|
-
Time.
|
|
2887
|
+
(function() {
|
|
2888
|
+
Time._elapsedTimeProperty = ShaderProperty.getByName("scene_ElapsedTime");
|
|
2889
|
+
})();
|
|
2890
|
+
(function() {
|
|
2891
|
+
Time._deltaTimeProperty = ShaderProperty.getByName("scene_DeltaTime");
|
|
2892
|
+
})();
|
|
2921
2893
|
|
|
2922
2894
|
/**
|
|
2923
2895
|
* Data type enumeration
|
|
@@ -3341,7 +3313,7 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
3341
3313
|
this._enabled && this._onDisable();
|
|
3342
3314
|
}
|
|
3343
3315
|
};
|
|
3344
|
-
|
|
3316
|
+
_create_class(Component, [
|
|
3345
3317
|
{
|
|
3346
3318
|
key: "enabled",
|
|
3347
3319
|
get: /**
|
|
@@ -3464,8 +3436,12 @@ __decorate([
|
|
|
3464
3436
|
};
|
|
3465
3437
|
return ComponentsDependencies;
|
|
3466
3438
|
}();
|
|
3467
|
-
|
|
3468
|
-
ComponentsDependencies.
|
|
3439
|
+
(function() {
|
|
3440
|
+
ComponentsDependencies._invDependenciesMap = new Map();
|
|
3441
|
+
})();
|
|
3442
|
+
(function() {
|
|
3443
|
+
ComponentsDependencies._dependenciesMap = new Map();
|
|
3444
|
+
})();
|
|
3469
3445
|
function dependentComponents(componentOrComponents, dependentMode) {
|
|
3470
3446
|
if (dependentMode === void 0) dependentMode = /** Check only, throw error if dependent components do not exist. */ 0;
|
|
3471
3447
|
var components = Array.isArray(componentOrComponents) ? componentOrComponents : [
|
|
@@ -3527,6 +3503,145 @@ var DependentMode;
|
|
|
3527
3503
|
Layer[Layer[/** None layer. */ "Nothing"] = 0x0] = "Nothing";
|
|
3528
3504
|
})(Layer || (Layer = {}));
|
|
3529
3505
|
|
|
3506
|
+
var Utils = /*#__PURE__*/ function() {
|
|
3507
|
+
function Utils() {}
|
|
3508
|
+
/**
|
|
3509
|
+
* @internal
|
|
3510
|
+
*/ Utils._floatMatrixMultiply = function _floatMatrixMultiply(left, re, rOffset, oe, offset) {
|
|
3511
|
+
var le = left.elements;
|
|
3512
|
+
// prettier-ignore
|
|
3513
|
+
var l11 = le[0], l12 = le[1], l13 = le[2], l14 = le[3], l21 = le[4], l22 = le[5], l23 = le[6], l24 = le[7], l31 = le[8], l32 = le[9], l33 = le[10], l34 = le[11], l41 = le[12], l42 = le[13], l43 = le[14], l44 = le[15];
|
|
3514
|
+
// prettier-ignore
|
|
3515
|
+
var r11 = re[rOffset], r12 = re[rOffset + 1], r13 = re[rOffset + 2], r14 = re[rOffset + 3], r21 = re[rOffset + 4], r22 = re[rOffset + 5], r23 = re[rOffset + 6], r24 = re[rOffset + 7], r31 = re[rOffset + 8], r32 = re[rOffset + 9], r33 = re[rOffset + 10], r34 = re[rOffset + 11], r41 = re[rOffset + 12], r42 = re[rOffset + 13], r43 = re[rOffset + 14], r44 = re[rOffset + 15];
|
|
3516
|
+
oe[offset] = l11 * r11 + l21 * r12 + l31 * r13 + l41 * r14;
|
|
3517
|
+
oe[offset + 1] = l12 * r11 + l22 * r12 + l32 * r13 + l42 * r14;
|
|
3518
|
+
oe[offset + 2] = l13 * r11 + l23 * r12 + l33 * r13 + l43 * r14;
|
|
3519
|
+
oe[offset + 3] = l14 * r11 + l24 * r12 + l34 * r13 + l44 * r14;
|
|
3520
|
+
oe[offset + 4] = l11 * r21 + l21 * r22 + l31 * r23 + l41 * r24;
|
|
3521
|
+
oe[offset + 5] = l12 * r21 + l22 * r22 + l32 * r23 + l42 * r24;
|
|
3522
|
+
oe[offset + 6] = l13 * r21 + l23 * r22 + l33 * r23 + l43 * r24;
|
|
3523
|
+
oe[offset + 7] = l14 * r21 + l24 * r22 + l34 * r23 + l44 * r24;
|
|
3524
|
+
oe[offset + 8] = l11 * r31 + l21 * r32 + l31 * r33 + l41 * r34;
|
|
3525
|
+
oe[offset + 9] = l12 * r31 + l22 * r32 + l32 * r33 + l42 * r34;
|
|
3526
|
+
oe[offset + 10] = l13 * r31 + l23 * r32 + l33 * r33 + l43 * r34;
|
|
3527
|
+
oe[offset + 11] = l14 * r31 + l24 * r32 + l34 * r33 + l44 * r34;
|
|
3528
|
+
oe[offset + 12] = l11 * r41 + l21 * r42 + l31 * r43 + l41 * r44;
|
|
3529
|
+
oe[offset + 13] = l12 * r41 + l22 * r42 + l32 * r43 + l42 * r44;
|
|
3530
|
+
oe[offset + 14] = l13 * r41 + l23 * r42 + l33 * r43 + l43 * r44;
|
|
3531
|
+
oe[offset + 15] = l14 * r41 + l24 * r42 + l34 * r43 + l44 * r44;
|
|
3532
|
+
};
|
|
3533
|
+
/**
|
|
3534
|
+
* @internal
|
|
3535
|
+
* Simplify lodash get: https://github.com/lodash/lodash/blob/master/get.js.
|
|
3536
|
+
* @param target - The object to query.
|
|
3537
|
+
* @param path - The path of the property to get.
|
|
3538
|
+
* @returns Returns the resolved value.
|
|
3539
|
+
*/ Utils._reflectGet = function _reflectGet(target, path) {
|
|
3540
|
+
var pathArr = this._stringToPath(path);
|
|
3541
|
+
var object = target;
|
|
3542
|
+
var index = 0;
|
|
3543
|
+
var length = pathArr.length;
|
|
3544
|
+
while(object != null && index < length){
|
|
3545
|
+
object = object[pathArr[index++]];
|
|
3546
|
+
}
|
|
3547
|
+
return index && index == length ? object : undefined;
|
|
3548
|
+
};
|
|
3549
|
+
/**
|
|
3550
|
+
* Fast remove an element from array.
|
|
3551
|
+
* @param array - Array
|
|
3552
|
+
* @param item - Element
|
|
3553
|
+
*/ Utils.removeFromArray = function removeFromArray(array, item) {
|
|
3554
|
+
var index = array.indexOf(item);
|
|
3555
|
+
if (index < 0) {
|
|
3556
|
+
return false;
|
|
3557
|
+
}
|
|
3558
|
+
var last = array.length - 1;
|
|
3559
|
+
if (index !== last) {
|
|
3560
|
+
var end = array[last];
|
|
3561
|
+
array[index] = end;
|
|
3562
|
+
}
|
|
3563
|
+
array.length--;
|
|
3564
|
+
return true;
|
|
3565
|
+
};
|
|
3566
|
+
/**
|
|
3567
|
+
* Decodes a given Uint8Array into a string.
|
|
3568
|
+
*/ Utils.decodeText = function decodeText(array) {
|
|
3569
|
+
if (typeof TextDecoder !== "undefined") {
|
|
3570
|
+
return new TextDecoder().decode(array);
|
|
3571
|
+
}
|
|
3572
|
+
// TextDecoder polyfill
|
|
3573
|
+
var s = "";
|
|
3574
|
+
for(var i = 0, il = array.length; i < il; i++){
|
|
3575
|
+
s += String.fromCharCode(array[i]);
|
|
3576
|
+
}
|
|
3577
|
+
return decodeURIComponent(encodeURIComponent(s));
|
|
3578
|
+
};
|
|
3579
|
+
/**
|
|
3580
|
+
* Judge whether the url is absolute url.
|
|
3581
|
+
* @param url - The url to be judged.
|
|
3582
|
+
* @returns Whether the url is absolute url.
|
|
3583
|
+
*/ Utils.isAbsoluteUrl = function isAbsoluteUrl(url) {
|
|
3584
|
+
return /^(?:http|blob|data:|\/)/.test(url);
|
|
3585
|
+
};
|
|
3586
|
+
/**
|
|
3587
|
+
* Get the values of an object.
|
|
3588
|
+
*/ Utils.objectValues = function objectValues(obj) {
|
|
3589
|
+
return Object.keys(obj).map(function(key) {
|
|
3590
|
+
return obj[key];
|
|
3591
|
+
});
|
|
3592
|
+
};
|
|
3593
|
+
/**
|
|
3594
|
+
* Convert a relative URL to an absolute URL based on a given base URL.
|
|
3595
|
+
* @param baseUrl - The base url.
|
|
3596
|
+
* @param relativeUrl - The relative url.
|
|
3597
|
+
* @returns The resolved url.
|
|
3598
|
+
*/ Utils.resolveAbsoluteUrl = function resolveAbsoluteUrl(baseUrl, relativeUrl) {
|
|
3599
|
+
if (Utils.isAbsoluteUrl(relativeUrl)) {
|
|
3600
|
+
return relativeUrl;
|
|
3601
|
+
}
|
|
3602
|
+
var char0 = relativeUrl.charAt(0);
|
|
3603
|
+
if (char0 === ".") {
|
|
3604
|
+
return Utils._formatRelativePath(relativeUrl + relativeUrl);
|
|
3605
|
+
}
|
|
3606
|
+
return baseUrl.substring(0, baseUrl.lastIndexOf("/") + 1) + relativeUrl;
|
|
3607
|
+
};
|
|
3608
|
+
Utils._stringToPath = function _stringToPath(string) {
|
|
3609
|
+
var result = [];
|
|
3610
|
+
if (string.charCodeAt(0) === charCodeOfDot) {
|
|
3611
|
+
result.push("");
|
|
3612
|
+
}
|
|
3613
|
+
string.replace(rePropName, function(match, expression, quote, subString) {
|
|
3614
|
+
var key = match;
|
|
3615
|
+
if (quote) {
|
|
3616
|
+
key = subString.replace(reEscapeChar, "$1");
|
|
3617
|
+
} else if (expression) {
|
|
3618
|
+
key = expression.trim();
|
|
3619
|
+
}
|
|
3620
|
+
result.push(key);
|
|
3621
|
+
});
|
|
3622
|
+
return result;
|
|
3623
|
+
};
|
|
3624
|
+
Utils._formatRelativePath = function _formatRelativePath(value) {
|
|
3625
|
+
var parts = value.split("/");
|
|
3626
|
+
for(var i = 0, n = parts.length; i < n; i++){
|
|
3627
|
+
if (parts[i] == "..") {
|
|
3628
|
+
parts.splice(i - 1, 2);
|
|
3629
|
+
i -= 2;
|
|
3630
|
+
}
|
|
3631
|
+
}
|
|
3632
|
+
return parts.join("/");
|
|
3633
|
+
};
|
|
3634
|
+
return Utils;
|
|
3635
|
+
}();
|
|
3636
|
+
var charCodeOfDot = ".".charCodeAt(0);
|
|
3637
|
+
var reEscapeChar = /\\(\\)?/g;
|
|
3638
|
+
var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
3639
|
+
"[^.[\\]]+" + "|" + // Or match property names within brackets.
|
|
3640
|
+
"\\[(?:" + // Match a non-string expression.
|
|
3641
|
+
"([^\"'][^[]*)" + "|" + // Or match strings (supports escaping characters).
|
|
3642
|
+
"([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2" + ")\\]" + "|" + // Or match "" as the space between consecutive dots or empty brackets.
|
|
3643
|
+
"(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))", "g");
|
|
3644
|
+
|
|
3530
3645
|
/**
|
|
3531
3646
|
* Used to update tags.
|
|
3532
3647
|
*/ var UpdateFlag = /*#__PURE__*/ function() {
|
|
@@ -3549,7 +3664,7 @@ var DependentMode;
|
|
|
3549
3664
|
_proto._removeFromManagers = function _removeFromManagers() {
|
|
3550
3665
|
var flagManagers = this._flagManagers;
|
|
3551
3666
|
for(var i = 0, n = flagManagers.length; i < n; i++){
|
|
3552
|
-
removeFromArray(flagManagers[i]._updateFlags, this);
|
|
3667
|
+
Utils.removeFromArray(flagManagers[i]._updateFlags, this);
|
|
3553
3668
|
}
|
|
3554
3669
|
};
|
|
3555
3670
|
return UpdateFlag;
|
|
@@ -3601,9 +3716,9 @@ var DependentMode;
|
|
|
3601
3716
|
* Remove a UpdateFlag.
|
|
3602
3717
|
* @param flag - The UpdateFlag.
|
|
3603
3718
|
*/ _proto.removeFlag = function removeFlag(flag) {
|
|
3604
|
-
var success = removeFromArray(this._updateFlags, flag);
|
|
3719
|
+
var success = Utils.removeFromArray(this._updateFlags, flag);
|
|
3605
3720
|
if (success) {
|
|
3606
|
-
removeFromArray(flag._flagManagers, this);
|
|
3721
|
+
Utils.removeFromArray(flag._flagManagers, this);
|
|
3607
3722
|
}
|
|
3608
3723
|
};
|
|
3609
3724
|
/**
|
|
@@ -3616,7 +3731,7 @@ var DependentMode;
|
|
|
3616
3731
|
* Remove a listener.
|
|
3617
3732
|
* @param listener - The listener
|
|
3618
3733
|
*/ _proto.removeListener = function removeListener(listener) {
|
|
3619
|
-
removeFromArray(this._listeners, listener);
|
|
3734
|
+
Utils.removeFromArray(this._listeners, listener);
|
|
3620
3735
|
};
|
|
3621
3736
|
/**
|
|
3622
3737
|
* Dispatch a event.
|
|
@@ -3642,7 +3757,6 @@ var DependentMode;
|
|
|
3642
3757
|
function Transform(entity) {
|
|
3643
3758
|
var _this;
|
|
3644
3759
|
_this = Component.call(this, entity) || this;
|
|
3645
|
-
_this._dirtyFlag = 0xbc;
|
|
3646
3760
|
_this._position = new Vector3();
|
|
3647
3761
|
_this._rotation = new Vector3();
|
|
3648
3762
|
_this._rotationQuaternion = new Quaternion();
|
|
@@ -3658,14 +3772,15 @@ var DependentMode;
|
|
|
3658
3772
|
_this._worldUp = null;
|
|
3659
3773
|
_this._isParentDirty = true;
|
|
3660
3774
|
_this._parentTransformCache = null;
|
|
3775
|
+
_this._dirtyFlag = 0xbc;
|
|
3661
3776
|
/** @internal */ _this._updateFlagManager = new UpdateFlagManager();
|
|
3662
|
-
_this._onPositionChanged = _this._onPositionChanged.bind(
|
|
3663
|
-
_this._onWorldPositionChanged = _this._onWorldPositionChanged.bind(
|
|
3664
|
-
_this._onRotationChanged = _this._onRotationChanged.bind(
|
|
3665
|
-
_this._onWorldRotationChanged = _this._onWorldRotationChanged.bind(
|
|
3666
|
-
_this._onRotationQuaternionChanged = _this._onRotationQuaternionChanged.bind(
|
|
3667
|
-
_this._onWorldRotationQuaternionChanged = _this._onWorldRotationQuaternionChanged.bind(
|
|
3668
|
-
_this._onScaleChanged = _this._onScaleChanged.bind(
|
|
3777
|
+
_this._onPositionChanged = _this._onPositionChanged.bind(_assert_this_initialized(_this));
|
|
3778
|
+
_this._onWorldPositionChanged = _this._onWorldPositionChanged.bind(_assert_this_initialized(_this));
|
|
3779
|
+
_this._onRotationChanged = _this._onRotationChanged.bind(_assert_this_initialized(_this));
|
|
3780
|
+
_this._onWorldRotationChanged = _this._onWorldRotationChanged.bind(_assert_this_initialized(_this));
|
|
3781
|
+
_this._onRotationQuaternionChanged = _this._onRotationQuaternionChanged.bind(_assert_this_initialized(_this));
|
|
3782
|
+
_this._onWorldRotationQuaternionChanged = _this._onWorldRotationQuaternionChanged.bind(_assert_this_initialized(_this));
|
|
3783
|
+
_this._onScaleChanged = _this._onScaleChanged.bind(_assert_this_initialized(_this));
|
|
3669
3784
|
//@ts-ignore
|
|
3670
3785
|
_this._position._onValueChanged = _this._onPositionChanged;
|
|
3671
3786
|
//@ts-ignore
|
|
@@ -4030,7 +4145,7 @@ var DependentMode;
|
|
|
4030
4145
|
this._setDirtyFlagTrue(0x40);
|
|
4031
4146
|
this._updateWorldScaleFlag();
|
|
4032
4147
|
};
|
|
4033
|
-
|
|
4148
|
+
_create_class(Transform, [
|
|
4034
4149
|
{
|
|
4035
4150
|
key: "position",
|
|
4036
4151
|
get: /**
|
|
@@ -4309,15 +4424,33 @@ var DependentMode;
|
|
|
4309
4424
|
]);
|
|
4310
4425
|
return Transform;
|
|
4311
4426
|
}(Component);
|
|
4312
|
-
|
|
4313
|
-
Transform.
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
Transform.
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
Transform.
|
|
4320
|
-
|
|
4427
|
+
(function() {
|
|
4428
|
+
Transform._tempQuat0 = new Quaternion();
|
|
4429
|
+
})();
|
|
4430
|
+
(function() {
|
|
4431
|
+
Transform._tempVec30 = new Vector3();
|
|
4432
|
+
})();
|
|
4433
|
+
(function() {
|
|
4434
|
+
Transform._tempVec31 = new Vector3();
|
|
4435
|
+
})();
|
|
4436
|
+
(function() {
|
|
4437
|
+
Transform._tempVec32 = new Vector3();
|
|
4438
|
+
})();
|
|
4439
|
+
(function() {
|
|
4440
|
+
Transform._tempMat30 = new Matrix3x3();
|
|
4441
|
+
})();
|
|
4442
|
+
(function() {
|
|
4443
|
+
Transform._tempMat31 = new Matrix3x3();
|
|
4444
|
+
})();
|
|
4445
|
+
(function() {
|
|
4446
|
+
Transform._tempMat32 = new Matrix3x3();
|
|
4447
|
+
})();
|
|
4448
|
+
(function() {
|
|
4449
|
+
Transform._tempMat41 = new Matrix();
|
|
4450
|
+
})();
|
|
4451
|
+
(function() {
|
|
4452
|
+
Transform._tempMat42 = new Matrix();
|
|
4453
|
+
})();
|
|
4321
4454
|
__decorate([
|
|
4322
4455
|
deepClone
|
|
4323
4456
|
], Transform.prototype, "_position", void 0);
|
|
@@ -4826,7 +4959,7 @@ var TransformModifyFlags;
|
|
|
4826
4959
|
this._traverseSetOwnerScene(children[i], scene);
|
|
4827
4960
|
}
|
|
4828
4961
|
};
|
|
4829
|
-
|
|
4962
|
+
_create_class(Entity, [
|
|
4830
4963
|
{
|
|
4831
4964
|
key: "isActive",
|
|
4832
4965
|
get: /**
|
|
@@ -5044,7 +5177,7 @@ var TransformModifyFlags;
|
|
|
5044
5177
|
}
|
|
5045
5178
|
}
|
|
5046
5179
|
};
|
|
5047
|
-
|
|
5180
|
+
_create_class(SystemInfo, null, [
|
|
5048
5181
|
{
|
|
5049
5182
|
key: "devicePixelRatio",
|
|
5050
5183
|
get: /**
|
|
@@ -5056,8 +5189,12 @@ var TransformModifyFlags;
|
|
|
5056
5189
|
]);
|
|
5057
5190
|
return SystemInfo;
|
|
5058
5191
|
}();
|
|
5059
|
-
|
|
5060
|
-
/** The
|
|
5192
|
+
(function() {
|
|
5193
|
+
/** The platform is running on. */ SystemInfo.platform = Platform.Unknown;
|
|
5194
|
+
})();
|
|
5195
|
+
(function() {
|
|
5196
|
+
/** The operating system is running on. */ SystemInfo.operatingSystem = "";
|
|
5197
|
+
})();
|
|
5061
5198
|
SystemInfo._initialize();
|
|
5062
5199
|
|
|
5063
5200
|
/**
|
|
@@ -5694,7 +5831,7 @@ var Collision = function Collision() {
|
|
|
5694
5831
|
_proto._setGravity = function _setGravity() {
|
|
5695
5832
|
this._nativePhysicsManager.setGravity(this._gravity);
|
|
5696
5833
|
};
|
|
5697
|
-
|
|
5834
|
+
_create_class(PhysicsManager, [
|
|
5698
5835
|
{
|
|
5699
5836
|
key: "gravity",
|
|
5700
5837
|
get: /**
|
|
@@ -5712,7 +5849,9 @@ var Collision = function Collision() {
|
|
|
5712
5849
|
]);
|
|
5713
5850
|
return PhysicsManager;
|
|
5714
5851
|
}();
|
|
5715
|
-
|
|
5852
|
+
(function() {
|
|
5853
|
+
PhysicsManager._collision = new Collision();
|
|
5854
|
+
})();
|
|
5716
5855
|
|
|
5717
5856
|
/**
|
|
5718
5857
|
* Describes how physics materials of the colliding objects are combined.
|
|
@@ -5741,7 +5880,7 @@ PhysicsManager._collision = new Collision();
|
|
|
5741
5880
|
*/ _proto._destroy = function _destroy() {
|
|
5742
5881
|
this._nativeMaterial.destroy();
|
|
5743
5882
|
};
|
|
5744
|
-
|
|
5883
|
+
_create_class(PhysicsMaterial, [
|
|
5745
5884
|
{
|
|
5746
5885
|
key: "bounciness",
|
|
5747
5886
|
get: /**
|
|
@@ -5821,8 +5960,8 @@ var Collider = /*#__PURE__*/ function(Component) {
|
|
|
5821
5960
|
function Collider(entity) {
|
|
5822
5961
|
var _this;
|
|
5823
5962
|
_this = Component.call(this, entity) || this;
|
|
5824
|
-
_this._shapes = [];
|
|
5825
5963
|
/** @internal */ _this._index = -1;
|
|
5964
|
+
_this._shapes = [];
|
|
5826
5965
|
_this._updateFlag = _this.entity.transform.registerWorldChangeFlag();
|
|
5827
5966
|
return _this;
|
|
5828
5967
|
}
|
|
@@ -5902,7 +6041,7 @@ var Collider = /*#__PURE__*/ function(Component) {
|
|
|
5902
6041
|
this.clearShapes();
|
|
5903
6042
|
this._nativeCollider.destroy();
|
|
5904
6043
|
};
|
|
5905
|
-
|
|
6044
|
+
_create_class(Collider, [
|
|
5906
6045
|
{
|
|
5907
6046
|
key: "shapes",
|
|
5908
6047
|
get: /**
|
|
@@ -5942,7 +6081,7 @@ Collider = __decorate([
|
|
|
5942
6081
|
_this._upDirection = new Vector3(0, 1, 0);
|
|
5943
6082
|
_this._slopeLimit = 0.707;
|
|
5944
6083
|
_this._nativeCollider = PhysicsManager._nativePhysics.createCharacterController();
|
|
5945
|
-
_this._setUpDirection = _this._setUpDirection.bind(
|
|
6084
|
+
_this._setUpDirection = _this._setUpDirection.bind(_assert_this_initialized(_this));
|
|
5946
6085
|
//@ts-ignore
|
|
5947
6086
|
_this._upDirection._onValueChanged = _this._setUpDirection;
|
|
5948
6087
|
return _this;
|
|
@@ -6015,7 +6154,7 @@ Collider = __decorate([
|
|
|
6015
6154
|
_proto._setUpDirection = function _setUpDirection() {
|
|
6016
6155
|
this._nativeCollider.setUpDirection(this._upDirection);
|
|
6017
6156
|
};
|
|
6018
|
-
|
|
6157
|
+
_create_class(CharacterController, [
|
|
6019
6158
|
{
|
|
6020
6159
|
key: "stepOffset",
|
|
6021
6160
|
get: /**
|
|
@@ -6110,7 +6249,7 @@ Collider = __decorate([
|
|
|
6110
6249
|
_proto._setRotation = function _setRotation() {
|
|
6111
6250
|
this._nativeShape.setRotation(this._rotation);
|
|
6112
6251
|
};
|
|
6113
|
-
|
|
6252
|
+
_create_class(ColliderShape, [
|
|
6114
6253
|
{
|
|
6115
6254
|
key: "collider",
|
|
6116
6255
|
get: /**
|
|
@@ -6198,7 +6337,9 @@ Collider = __decorate([
|
|
|
6198
6337
|
]);
|
|
6199
6338
|
return ColliderShape;
|
|
6200
6339
|
}();
|
|
6201
|
-
|
|
6340
|
+
(function() {
|
|
6341
|
+
ColliderShape._idGenerator = 0;
|
|
6342
|
+
})();
|
|
6202
6343
|
|
|
6203
6344
|
/**
|
|
6204
6345
|
* Physical collider shape for box.
|
|
@@ -6209,7 +6350,7 @@ ColliderShape._idGenerator = 0;
|
|
|
6209
6350
|
_this = ColliderShape.call(this) || this;
|
|
6210
6351
|
_this._size = new Vector3(1, 1, 1);
|
|
6211
6352
|
_this._nativeShape = PhysicsManager._nativePhysics.createBoxColliderShape(_this._id, _this._size, _this._material._nativeMaterial);
|
|
6212
|
-
_this._setSize = _this._setSize.bind(
|
|
6353
|
+
_this._setSize = _this._setSize.bind(_assert_this_initialized(_this));
|
|
6213
6354
|
//@ts-ignore
|
|
6214
6355
|
_this._size._onValueChanged = _this._setSize;
|
|
6215
6356
|
return _this;
|
|
@@ -6218,7 +6359,7 @@ ColliderShape._idGenerator = 0;
|
|
|
6218
6359
|
_proto._setSize = function _setSize() {
|
|
6219
6360
|
this._nativeShape.setSize(this._size);
|
|
6220
6361
|
};
|
|
6221
|
-
|
|
6362
|
+
_create_class(BoxColliderShape, [
|
|
6222
6363
|
{
|
|
6223
6364
|
key: "size",
|
|
6224
6365
|
get: /**
|
|
@@ -6247,7 +6388,7 @@ ColliderShape._idGenerator = 0;
|
|
|
6247
6388
|
_this._nativeShape = PhysicsManager._nativePhysics.createSphereColliderShape(_this._id, _this._radius, _this._material._nativeMaterial);
|
|
6248
6389
|
return _this;
|
|
6249
6390
|
}
|
|
6250
|
-
|
|
6391
|
+
_create_class(SphereColliderShape, [
|
|
6251
6392
|
{
|
|
6252
6393
|
key: "radius",
|
|
6253
6394
|
get: /**
|
|
@@ -6301,7 +6442,7 @@ ColliderShape._idGenerator = 0;
|
|
|
6301
6442
|
_this._nativeShape = PhysicsManager._nativePhysics.createCapsuleColliderShape(_this._id, _this._radius, _this._height, _this._material._nativeMaterial);
|
|
6302
6443
|
return _this;
|
|
6303
6444
|
}
|
|
6304
|
-
|
|
6445
|
+
_create_class(CapsuleColliderShape, [
|
|
6305
6446
|
{
|
|
6306
6447
|
key: "radius",
|
|
6307
6448
|
get: /**
|
|
@@ -6360,7 +6501,7 @@ var Joint = /*#__PURE__*/ function(Component) {
|
|
|
6360
6501
|
_this._connectedCollider.localPosition = new Vector3();
|
|
6361
6502
|
return _this;
|
|
6362
6503
|
}
|
|
6363
|
-
|
|
6504
|
+
_create_class(Joint, [
|
|
6364
6505
|
{
|
|
6365
6506
|
key: "connectedCollider",
|
|
6366
6507
|
get: /**
|
|
@@ -6540,7 +6681,7 @@ Joint = __decorate([
|
|
|
6540
6681
|
collider.collider = this.entity.getComponent(Collider);
|
|
6541
6682
|
this._nativeJoint = PhysicsManager._nativePhysics.createHingeJoint(collider.collider._nativeCollider);
|
|
6542
6683
|
};
|
|
6543
|
-
|
|
6684
|
+
_create_class(HingeJoint, [
|
|
6544
6685
|
{
|
|
6545
6686
|
key: "axis",
|
|
6546
6687
|
get: /**
|
|
@@ -6692,7 +6833,7 @@ Joint = __decorate([
|
|
|
6692
6833
|
collider.collider = this.entity.getComponent(Collider);
|
|
6693
6834
|
this._nativeJoint = PhysicsManager._nativePhysics.createSpringJoint(collider.collider._nativeCollider);
|
|
6694
6835
|
};
|
|
6695
|
-
|
|
6836
|
+
_create_class(SpringJoint, [
|
|
6696
6837
|
{
|
|
6697
6838
|
key: "swingOffset",
|
|
6698
6839
|
get: /**
|
|
@@ -6848,10 +6989,10 @@ Joint = __decorate([
|
|
|
6848
6989
|
_this._sleepThreshold = 5e-3;
|
|
6849
6990
|
var transform = _this.entity.transform;
|
|
6850
6991
|
_this._nativeCollider = PhysicsManager._nativePhysics.createDynamicCollider(transform.worldPosition, transform.worldRotationQuaternion);
|
|
6851
|
-
_this._setLinearVelocity = _this._setLinearVelocity.bind(
|
|
6852
|
-
_this._setAngularVelocity = _this._setAngularVelocity.bind(
|
|
6853
|
-
_this._setCenterOfMass = _this._setCenterOfMass.bind(
|
|
6854
|
-
_this._setInertiaTensor = _this._setInertiaTensor.bind(
|
|
6992
|
+
_this._setLinearVelocity = _this._setLinearVelocity.bind(_assert_this_initialized(_this));
|
|
6993
|
+
_this._setAngularVelocity = _this._setAngularVelocity.bind(_assert_this_initialized(_this));
|
|
6994
|
+
_this._setCenterOfMass = _this._setCenterOfMass.bind(_assert_this_initialized(_this));
|
|
6995
|
+
_this._setInertiaTensor = _this._setInertiaTensor.bind(_assert_this_initialized(_this));
|
|
6855
6996
|
//@ts-ignore
|
|
6856
6997
|
_this._linearVelocity._onValueChanged = _this._setLinearVelocity;
|
|
6857
6998
|
//@ts-ignore
|
|
@@ -6909,7 +7050,7 @@ Joint = __decorate([
|
|
|
6909
7050
|
_proto._setInertiaTensor = function _setInertiaTensor() {
|
|
6910
7051
|
this._nativeCollider.setInertiaTensor(this._inertiaTensor);
|
|
6911
7052
|
};
|
|
6912
|
-
|
|
7053
|
+
_create_class(DynamicCollider, [
|
|
6913
7054
|
{
|
|
6914
7055
|
key: "linearDamping",
|
|
6915
7056
|
get: /**
|
|
@@ -7456,9 +7597,15 @@ var DynamicColliderConstraints;
|
|
|
7456
7597
|
};
|
|
7457
7598
|
return PointerManager;
|
|
7458
7599
|
}();
|
|
7459
|
-
|
|
7460
|
-
PointerManager.
|
|
7461
|
-
|
|
7600
|
+
(function() {
|
|
7601
|
+
PointerManager._tempRay = new Ray();
|
|
7602
|
+
})();
|
|
7603
|
+
(function() {
|
|
7604
|
+
PointerManager._tempPoint = new Vector2();
|
|
7605
|
+
})();
|
|
7606
|
+
(function() {
|
|
7607
|
+
PointerManager._tempHitResult = new HitResult();
|
|
7608
|
+
})();
|
|
7462
7609
|
|
|
7463
7610
|
/**
|
|
7464
7611
|
* Wheel Manager.
|
|
@@ -7665,7 +7812,7 @@ PointerManager._tempHitResult = new HitResult();
|
|
|
7665
7812
|
this._pointerManager._onFocus();
|
|
7666
7813
|
this._keyboardManager._onFocus();
|
|
7667
7814
|
};
|
|
7668
|
-
|
|
7815
|
+
_create_class(InputManager, [
|
|
7669
7816
|
{
|
|
7670
7817
|
key: "pointers",
|
|
7671
7818
|
get: /**
|
|
@@ -7744,9 +7891,9 @@ PointerManager._tempHitResult = new HitResult();
|
|
|
7744
7891
|
/** Shadow mapping normal-based bias. */ _this.shadowNormalBias = 1;
|
|
7745
7892
|
/** Near plane value to use for shadow frustums. */ _this.shadowNearPlane = 0.1;
|
|
7746
7893
|
/** Shadow intensity, the larger the value, the clearer and darker the shadow. */ _this.shadowStrength = 1.0;
|
|
7894
|
+
/** @internal */ _this._lightIndex = -1;
|
|
7747
7895
|
_this._color = new Color$1(1, 1, 1, 1);
|
|
7748
7896
|
_this._lightColor = new Color$1();
|
|
7749
|
-
/** @internal */ _this._lightIndex = -1;
|
|
7750
7897
|
return _this;
|
|
7751
7898
|
}
|
|
7752
7899
|
var _proto = Light.prototype;
|
|
@@ -7757,7 +7904,7 @@ PointerManager._tempHitResult = new HitResult();
|
|
|
7757
7904
|
this._lightColor.a = this.color.a * this.intensity;
|
|
7758
7905
|
return this._lightColor;
|
|
7759
7906
|
};
|
|
7760
|
-
|
|
7907
|
+
_create_class(Light, [
|
|
7761
7908
|
{
|
|
7762
7909
|
key: "color",
|
|
7763
7910
|
get: /**
|
|
@@ -7794,9 +7941,11 @@ PointerManager._tempHitResult = new HitResult();
|
|
|
7794
7941
|
]);
|
|
7795
7942
|
return Light;
|
|
7796
7943
|
}(Component);
|
|
7797
|
-
|
|
7944
|
+
(function() {
|
|
7945
|
+
/**
|
|
7798
7946
|
* Each type of light source is at most 10, beyond which it will not take effect.
|
|
7799
7947
|
* */ Light._maxLight = 10;
|
|
7948
|
+
})();
|
|
7800
7949
|
__decorate([
|
|
7801
7950
|
ignoreClone
|
|
7802
7951
|
], Light.prototype, "_lightIndex", void 0);
|
|
@@ -7853,7 +8002,7 @@ __decorate([
|
|
|
7853
8002
|
shaderData.setFloatArray(DirectLight._colorProperty, data.color);
|
|
7854
8003
|
shaderData.setFloatArray(DirectLight._directionProperty, data.direction);
|
|
7855
8004
|
};
|
|
7856
|
-
|
|
8005
|
+
_create_class(DirectLight, [
|
|
7857
8006
|
{
|
|
7858
8007
|
key: "direction",
|
|
7859
8008
|
get: /**
|
|
@@ -7883,14 +8032,22 @@ __decorate([
|
|
|
7883
8032
|
]);
|
|
7884
8033
|
return DirectLight;
|
|
7885
8034
|
}(Light);
|
|
7886
|
-
|
|
7887
|
-
DirectLight.
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
8035
|
+
(function() {
|
|
8036
|
+
DirectLight._cullingMaskProperty = ShaderProperty.getByName("scene_DirectLightCullingMask");
|
|
8037
|
+
})();
|
|
8038
|
+
(function() {
|
|
8039
|
+
DirectLight._colorProperty = ShaderProperty.getByName("scene_DirectLightColor");
|
|
8040
|
+
})();
|
|
8041
|
+
(function() {
|
|
8042
|
+
DirectLight._directionProperty = ShaderProperty.getByName("scene_DirectLightDirection");
|
|
8043
|
+
})();
|
|
8044
|
+
(function() {
|
|
8045
|
+
DirectLight._combinedData = {
|
|
8046
|
+
cullingMask: new Int32Array(Light._maxLight * 2),
|
|
8047
|
+
color: new Float32Array(Light._maxLight * 3),
|
|
8048
|
+
direction: new Float32Array(Light._maxLight * 3)
|
|
8049
|
+
};
|
|
8050
|
+
})();
|
|
7894
8051
|
|
|
7895
8052
|
/**
|
|
7896
8053
|
* Point light.
|
|
@@ -7947,7 +8104,7 @@ DirectLight._combinedData = {
|
|
|
7947
8104
|
shaderData.setFloatArray(PointLight._positionProperty, data.position);
|
|
7948
8105
|
shaderData.setFloatArray(PointLight._distanceProperty, data.distance);
|
|
7949
8106
|
};
|
|
7950
|
-
|
|
8107
|
+
_create_class(PointLight, [
|
|
7951
8108
|
{
|
|
7952
8109
|
key: "position",
|
|
7953
8110
|
get: /**
|
|
@@ -7968,16 +8125,26 @@ DirectLight._combinedData = {
|
|
|
7968
8125
|
]);
|
|
7969
8126
|
return PointLight;
|
|
7970
8127
|
}(Light);
|
|
7971
|
-
|
|
7972
|
-
PointLight.
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
PointLight.
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
8128
|
+
(function() {
|
|
8129
|
+
PointLight._cullingMaskProperty = ShaderProperty.getByName("scene_PointLightCullingMask");
|
|
8130
|
+
})();
|
|
8131
|
+
(function() {
|
|
8132
|
+
PointLight._colorProperty = ShaderProperty.getByName("scene_PointLightColor");
|
|
8133
|
+
})();
|
|
8134
|
+
(function() {
|
|
8135
|
+
PointLight._positionProperty = ShaderProperty.getByName("scene_PointLightPosition");
|
|
8136
|
+
})();
|
|
8137
|
+
(function() {
|
|
8138
|
+
PointLight._distanceProperty = ShaderProperty.getByName("scene_PointLightDistance");
|
|
8139
|
+
})();
|
|
8140
|
+
(function() {
|
|
8141
|
+
PointLight._combinedData = {
|
|
8142
|
+
cullingMask: new Int32Array(Light._maxLight * 2),
|
|
8143
|
+
color: new Float32Array(Light._maxLight * 3),
|
|
8144
|
+
position: new Float32Array(Light._maxLight * 3),
|
|
8145
|
+
distance: new Float32Array(Light._maxLight)
|
|
8146
|
+
};
|
|
8147
|
+
})();
|
|
7981
8148
|
|
|
7982
8149
|
/**
|
|
7983
8150
|
* Spot light.
|
|
@@ -8050,7 +8217,7 @@ PointLight._combinedData = {
|
|
|
8050
8217
|
shaderData.setFloatArray(SpotLight._angleCosProperty, data.angleCos);
|
|
8051
8218
|
shaderData.setFloatArray(SpotLight._penumbraCosProperty, data.penumbraCos);
|
|
8052
8219
|
};
|
|
8053
|
-
|
|
8220
|
+
_create_class(SpotLight, [
|
|
8054
8221
|
{
|
|
8055
8222
|
key: "position",
|
|
8056
8223
|
get: /**
|
|
@@ -8091,22 +8258,38 @@ PointLight._combinedData = {
|
|
|
8091
8258
|
]);
|
|
8092
8259
|
return SpotLight;
|
|
8093
8260
|
}(Light);
|
|
8094
|
-
|
|
8095
|
-
SpotLight.
|
|
8096
|
-
|
|
8097
|
-
|
|
8098
|
-
SpotLight.
|
|
8099
|
-
|
|
8100
|
-
|
|
8101
|
-
SpotLight.
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
|
|
8261
|
+
(function() {
|
|
8262
|
+
SpotLight._cullingMaskProperty = ShaderProperty.getByName("scene_SpotLightCullingMask");
|
|
8263
|
+
})();
|
|
8264
|
+
(function() {
|
|
8265
|
+
SpotLight._colorProperty = ShaderProperty.getByName("scene_SpotLightColor");
|
|
8266
|
+
})();
|
|
8267
|
+
(function() {
|
|
8268
|
+
SpotLight._positionProperty = ShaderProperty.getByName("scene_SpotLightPosition");
|
|
8269
|
+
})();
|
|
8270
|
+
(function() {
|
|
8271
|
+
SpotLight._directionProperty = ShaderProperty.getByName("scene_SpotLightDirection");
|
|
8272
|
+
})();
|
|
8273
|
+
(function() {
|
|
8274
|
+
SpotLight._distanceProperty = ShaderProperty.getByName("scene_SpotLightDistance");
|
|
8275
|
+
})();
|
|
8276
|
+
(function() {
|
|
8277
|
+
SpotLight._angleCosProperty = ShaderProperty.getByName("scene_SpotLightAngleCos");
|
|
8278
|
+
})();
|
|
8279
|
+
(function() {
|
|
8280
|
+
SpotLight._penumbraCosProperty = ShaderProperty.getByName("scene_SpotLightPenumbraCos");
|
|
8281
|
+
})();
|
|
8282
|
+
(function() {
|
|
8283
|
+
SpotLight._combinedData = {
|
|
8284
|
+
cullingMask: new Int32Array(Light._maxLight * 2),
|
|
8285
|
+
color: new Float32Array(Light._maxLight * 3),
|
|
8286
|
+
position: new Float32Array(Light._maxLight * 3),
|
|
8287
|
+
direction: new Float32Array(Light._maxLight * 3),
|
|
8288
|
+
distance: new Float32Array(Light._maxLight),
|
|
8289
|
+
angleCos: new Float32Array(Light._maxLight),
|
|
8290
|
+
penumbraCos: new Float32Array(Light._maxLight)
|
|
8291
|
+
};
|
|
8292
|
+
})();
|
|
8110
8293
|
|
|
8111
8294
|
/**
|
|
8112
8295
|
* Light manager.
|
|
@@ -8207,21 +8390,21 @@ SpotLight._combinedData = {
|
|
|
8207
8390
|
}
|
|
8208
8391
|
if (directLightCount) {
|
|
8209
8392
|
DirectLight._updateShaderData(shaderData);
|
|
8210
|
-
shaderData.enableMacro("
|
|
8393
|
+
shaderData.enableMacro("SCENE_DIRECT_LIGHT_COUNT", directLightCount.toString());
|
|
8211
8394
|
} else {
|
|
8212
|
-
shaderData.disableMacro("
|
|
8395
|
+
shaderData.disableMacro("SCENE_DIRECT_LIGHT_COUNT");
|
|
8213
8396
|
}
|
|
8214
8397
|
if (pointLightCount) {
|
|
8215
8398
|
PointLight._updateShaderData(shaderData);
|
|
8216
|
-
shaderData.enableMacro("
|
|
8399
|
+
shaderData.enableMacro("SCENE_POINT_LIGHT_COUNT", pointLightCount.toString());
|
|
8217
8400
|
} else {
|
|
8218
|
-
shaderData.disableMacro("
|
|
8401
|
+
shaderData.disableMacro("SCENE_POINT_LIGHT_COUNT");
|
|
8219
8402
|
}
|
|
8220
8403
|
if (spotLightCount) {
|
|
8221
8404
|
SpotLight._updateShaderData(shaderData);
|
|
8222
|
-
shaderData.enableMacro("
|
|
8405
|
+
shaderData.enableMacro("SCENE_SPOT_LIGHT_COUNT", spotLightCount.toString());
|
|
8223
8406
|
} else {
|
|
8224
|
-
shaderData.disableMacro("
|
|
8407
|
+
shaderData.disableMacro("SCENE_SPOT_LIGHT_COUNT");
|
|
8225
8408
|
}
|
|
8226
8409
|
};
|
|
8227
8410
|
return LightManager;
|
|
@@ -8307,11 +8490,21 @@ SpotLight._combinedData = {
|
|
|
8307
8490
|
};
|
|
8308
8491
|
return ShaderMacro;
|
|
8309
8492
|
}();
|
|
8310
|
-
|
|
8311
|
-
/** @internal */ ShaderMacro.
|
|
8312
|
-
|
|
8313
|
-
|
|
8314
|
-
ShaderMacro.
|
|
8493
|
+
(function() {
|
|
8494
|
+
/** @internal */ ShaderMacro._macroMaskMap = [];
|
|
8495
|
+
})();
|
|
8496
|
+
(function() {
|
|
8497
|
+
/** @internal */ ShaderMacro._macroNameIdMap = Object.create(null);
|
|
8498
|
+
})();
|
|
8499
|
+
(function() {
|
|
8500
|
+
ShaderMacro._macroNameCounter = 0;
|
|
8501
|
+
})();
|
|
8502
|
+
(function() {
|
|
8503
|
+
ShaderMacro._macroCounter = 0;
|
|
8504
|
+
})();
|
|
8505
|
+
(function() {
|
|
8506
|
+
ShaderMacro._macroMap = Object.create(null);
|
|
8507
|
+
})();
|
|
8315
8508
|
|
|
8316
8509
|
/**
|
|
8317
8510
|
* Shader macro collection.
|
|
@@ -9229,7 +9422,7 @@ ShaderMacro._macroMap = Object.create(null);
|
|
|
9229
9422
|
ReferResource.prototype._addReferCount.call(this, value);
|
|
9230
9423
|
this.shaderData._addReferCount(value);
|
|
9231
9424
|
};
|
|
9232
|
-
|
|
9425
|
+
_create_class(Material, [
|
|
9233
9426
|
{
|
|
9234
9427
|
key: "shader",
|
|
9235
9428
|
get: /**
|
|
@@ -9333,83 +9526,72 @@ var RenderData = function RenderData() {
|
|
|
9333
9526
|
PipelineStage[/** Forward shading stage. */ "Forward"] = "Forward";
|
|
9334
9527
|
})(PipelineStage || (PipelineStage = {}));
|
|
9335
9528
|
|
|
9336
|
-
function
|
|
9337
|
-
|
|
9338
|
-
|
|
9339
|
-
|
|
9340
|
-
|
|
9341
|
-
for (var key in source) {
|
|
9342
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
9343
|
-
target[key] = source[key];
|
|
9529
|
+
function _extends() {
|
|
9530
|
+
_extends = Object.assign || function assign(target) {
|
|
9531
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
9532
|
+
var source = arguments[i];
|
|
9533
|
+
for (var key in source) if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
9344
9534
|
}
|
|
9345
|
-
}
|
|
9346
|
-
}
|
|
9347
|
-
|
|
9348
|
-
return target;
|
|
9349
|
-
};
|
|
9350
9535
|
|
|
9351
|
-
|
|
9352
|
-
}
|
|
9536
|
+
return target;
|
|
9537
|
+
};
|
|
9353
9538
|
|
|
9354
|
-
|
|
9355
|
-
return extends_.apply(this, arguments);
|
|
9539
|
+
return _extends.apply(this, arguments);
|
|
9356
9540
|
}
|
|
9357
9541
|
|
|
9358
|
-
var camera_declare = "#define GLSLIFY 1\nuniform vec3
|
|
9542
|
+
var camera_declare = "#define GLSLIFY 1\nuniform vec3 camera_Position;"; // eslint-disable-line
|
|
9359
9543
|
|
|
9360
9544
|
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
|
|
9361
9545
|
|
|
9362
|
-
var common_vert = "#define GLSLIFY 1\nattribute vec3 POSITION;\n#ifdef
|
|
9546
|
+
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_HAS_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
|
|
9363
9547
|
|
|
9364
|
-
var transform_declare = "#define GLSLIFY 1\nuniform mat4
|
|
9548
|
+
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
|
|
9365
9549
|
|
|
9366
|
-
var color_share = "#define GLSLIFY 1\n#ifdef
|
|
9550
|
+
var color_share = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_VERTEXCOLOR\nvarying vec4 v_color;\n#endif\n"; // eslint-disable-line
|
|
9367
9551
|
|
|
9368
|
-
var
|
|
9552
|
+
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
|
|
9369
9553
|
|
|
9370
|
-
var
|
|
9554
|
+
var FogVertexDeclaration = "#define GLSLIFY 1\n#if SCENE_FOG_MODE != 0\nvarying vec3 v_positionVS;\n#endif\n"; // eslint-disable-line
|
|
9371
9555
|
|
|
9372
|
-
var
|
|
9556
|
+
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_CLEARCOATNORMALTEXTURE) )\nvarying mat3 v_TBN;\n#endif\n#endif\n#endif\n"; // eslint-disable-line
|
|
9373
9557
|
|
|
9374
|
-
var
|
|
9558
|
+
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
|
|
9375
9559
|
|
|
9376
|
-
var
|
|
9560
|
+
var worldpos_share = "#define GLSLIFY 1\n#ifdef MATERIAL_NEED_WORLDPOS\nvarying vec3 v_pos;\n#endif\n"; // eslint-disable-line
|
|
9377
9561
|
|
|
9378
|
-
var
|
|
9379
|
-
|
|
9380
|
-
var begin_normal_vert = "#define GLSLIFY 1\n#ifndef OMIT_NORMAL\n#ifdef O3_HAS_NORMAL\nvec3 normal=vec3(NORMAL);\n#endif\n#ifdef O3_HAS_TANGENT\nvec4 tangent=vec4(TANGENT);\n#endif\n#endif\n"; // eslint-disable-line
|
|
9562
|
+
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
|
|
9381
9563
|
|
|
9382
9564
|
var begin_position_vert = "#define GLSLIFY 1\nvec4 position=vec4(POSITION,1.0);"; // eslint-disable-line
|
|
9383
9565
|
|
|
9384
|
-
var blendShape_input = "#define GLSLIFY 1\n#ifdef
|
|
9566
|
+
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
|
|
9385
9567
|
|
|
9386
|
-
var blendShape_vert = "#define GLSLIFY 1\n#ifdef
|
|
9568
|
+
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_CLEARCOATNORMALTEXTURE) )\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_CLEARCOATNORMALTEXTURE) )\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_CLEARCOATNORMALTEXTURE) )\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
|
|
9387
9569
|
|
|
9388
|
-
var color_vert = "#define GLSLIFY 1\n#ifdef
|
|
9570
|
+
var color_vert = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_VERTEXCOLOR\nv_color=COLOR_0;\n#endif\n"; // eslint-disable-line
|
|
9389
9571
|
|
|
9390
|
-
var FogVertex = "#define GLSLIFY 1\n#if
|
|
9572
|
+
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
|
|
9391
9573
|
|
|
9392
|
-
var normal_vert = "#define GLSLIFY 1\n#ifndef
|
|
9574
|
+
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_CLEARCOATNORMALTEXTURE) )\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
|
|
9393
9575
|
|
|
9394
|
-
var position_vert = "#define GLSLIFY 1\ngl_Position=
|
|
9576
|
+
var position_vert = "#define GLSLIFY 1\ngl_Position=renderer_MVPMat*position;"; // eslint-disable-line
|
|
9395
9577
|
|
|
9396
|
-
var skinning_vert = "#define GLSLIFY 1\n#ifdef
|
|
9578
|
+
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_CLEARCOATNORMALTEXTURE) )\ntangent.xyz=tangent.xyz*skinNormalMatrix;\n#endif\n#endif\n#endif\n"; // eslint-disable-line
|
|
9397
9579
|
|
|
9398
|
-
var uv_vert = "#define GLSLIFY 1\n#ifdef
|
|
9580
|
+
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_TILINGOFFSET\nv_uv=v_uv*material_TilingOffset.xy+material_TilingOffset.zw;\n#endif\n"; // eslint-disable-line
|
|
9399
9581
|
|
|
9400
|
-
var worldpos_vert = "#define GLSLIFY 1\n#ifdef
|
|
9582
|
+
var worldpos_vert = "#define GLSLIFY 1\n#ifdef MATERIAL_NEED_WORLDPOS\nvec4 temp_pos=renderer_ModelMat*position;v_pos=temp_pos.xyz/temp_pos.w;\n#endif\n"; // eslint-disable-line
|
|
9401
9583
|
|
|
9402
|
-
var FogFragment = "#define GLSLIFY 1\n#if
|
|
9584
|
+
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
|
|
9403
9585
|
|
|
9404
|
-
var light_frag_define = "#define GLSLIFY 1\n#ifdef
|
|
9586
|
+
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
|
|
9405
9587
|
|
|
9406
|
-
var mobile_material_frag = "#define GLSLIFY 1\nuniform vec4
|
|
9588
|
+
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
|
|
9407
9589
|
|
|
9408
|
-
var begin_mobile_frag = "#define GLSLIFY 1\nvec4 ambient=vec4(0.0);vec4 emission=
|
|
9590
|
+
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_HAS_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
|
|
9409
9591
|
|
|
9410
|
-
var begin_viewdir_frag = "#define GLSLIFY 1\n#ifdef
|
|
9592
|
+
var begin_viewdir_frag = "#define GLSLIFY 1\n#ifdef MATERIAL_NEED_WORLDPOS\nvec3 V=normalize(camera_Position-v_pos);\n#endif\n"; // eslint-disable-line
|
|
9411
9593
|
|
|
9412
|
-
var mobile_blinnphong_frag = "#define GLSLIFY 1\n#ifdef
|
|
9594
|
+
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
|
|
9413
9595
|
|
|
9414
9596
|
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
|
|
9415
9597
|
|
|
@@ -9443,17 +9625,17 @@ var noise_simplex_3D_grad = "#define GLSLIFY 1\nfloat simplex(vec3 v,out vec3 gr
|
|
|
9443
9625
|
|
|
9444
9626
|
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
|
|
9445
9627
|
|
|
9446
|
-
var pbr_frag_define = "#define GLSLIFY 1\nuniform float
|
|
9628
|
+
var pbr_frag_define = "#define GLSLIFY 1\nuniform float material_AlphaCutoff;uniform vec4 material_BaseColor;uniform float material_Metal;uniform float material_Roughness;uniform vec3 material_PBRSpecularColor;uniform float material_Glossiness;uniform vec3 material_EmissiveColor;\n#ifdef MATERIAL_CLEARCOAT\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_HAS_EMISSIVETEXTURE;\n#endif\n#ifdef MATERIAL_ROUGHNESSMETALLICTEXTURE\nuniform sampler2D material_RoughnessMetallicTexture;\n#endif\n#ifdef MATERIAL_HAS_SPECULARGLOSSINESSTEXTURE\nuniform sampler2D material_SpecularGlossinessTexture;\n#endif\n#ifdef MATERIAL_OCCLUSIONTEXTURE\nuniform sampler2D material_OcclusionTexture;\n#endif\n#ifdef MATERIAL_HAS_CLEARCOATTEXTURE\nuniform sampler2D material_ClearCoatTexture;\n#endif\n#ifdef MATERIAL_HAS_CLEARCOATROUGHNESSTEXTURE\nuniform sampler2D material_ClearCoatRoughnessTexture;\n#endif\n#ifdef MATERIAL_HAS_CLEARCOATNORMALTEXTURE\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_CLEARCOAT\nvec3 clearCoatNormal;float clearCoatDotNV;\n#endif\n};struct Material{vec3 diffuseColor;float roughness;vec3 specularColor;float opacity;\n#ifdef MATERIAL_CLEARCOAT\nfloat clearCoat;float clearCoatRoughness;\n#endif\n};"; // eslint-disable-line
|
|
9447
9629
|
|
|
9448
|
-
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(
|
|
9630
|
+
var pbr_helper = "#define GLSLIFY 1\n#include <normal_get>\nfloat computeSpecularOcclusion(float ambientOcclusion,float roughness,float dotNV){return saturate(pow(dotNV+ambientOcclusion,exp2(-16.0*roughness-1.0))-1.0+ambientOcclusion);}float getAARoughnessFactor(vec3 normal){\n#ifdef HAS_DERIVATIVES\nvec3 dxy=max(abs(dFdx(normal)),abs(dFdy(normal)));return 0.04+max(max(dxy.x,dxy.y),dxy.z);\n#else\nreturn 0.04;\n#endif\n}void initGeometry(out Geometry geometry){geometry.position=v_pos;geometry.viewDir=normalize(camera_Position-v_pos);\n#if defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEARCOATNORMALTEXTURE)\nmat3 tbn=getTBN();\n#endif\n#ifdef MATERIAL_HAS_NORMALTEXTURE\ngeometry.normal=getNormalByNormalTexture(tbn,material_NormalTexture,material_NormalIntensity,v_uv);\n#else\ngeometry.normal=getNormal();\n#endif\ngeometry.dotNV=saturate(dot(geometry.normal,geometry.viewDir));\n#ifdef MATERIAL_CLEARCOAT\n#ifdef MATERIAL_HAS_CLEARCOATNORMALTEXTURE\ngeometry.clearCoatNormal=getNormalByNormalTexture(tbn,material_ClearCoatNormalTexture,material_NormalIntensity,v_uv);\n#else\ngeometry.clearCoatNormal=getNormal();\n#endif\ngeometry.clearCoatDotNV=saturate(dot(geometry.clearCoatNormal,geometry.viewDir));\n#endif\n}void initMaterial(out Material material,const in Geometry geometry){vec4 baseColor=material_BaseColor;float metal=material_Metal;float roughness=material_Roughness;vec3 specularColor=material_PBRSpecularColor;float glossiness=material_Glossiness;float alphaCutoff=material_AlphaCutoff;\n#ifdef MATERIAL_HAS_BASETEXTURE\nvec4 baseTextureColor=texture2D(material_BaseTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nbaseTextureColor=gammaToLinear(baseTextureColor);\n#endif\nbaseColor*=baseTextureColor;\n#endif\n#ifdef RENDERER_HAS_VERTEXCOLOR\nbaseColor*=v_color;\n#endif\n#ifdef MATERIAL_IS_ALPHA_CUTOFF\nif(baseColor.a<alphaCutoff){discard;}\n#endif\n#ifdef MATERIAL_ROUGHNESSMETALLICTEXTURE\nvec4 metalRoughMapColor=texture2D(material_RoughnessMetallicTexture,v_uv);roughness*=metalRoughMapColor.g;metal*=metalRoughMapColor.b;\n#endif\n#ifdef MATERIAL_HAS_SPECULARGLOSSINESSTEXTURE\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(0.04),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_CLEARCOAT\nmaterial.clearCoat=material_ClearCoat;material.clearCoatRoughness=material_ClearCoatRoughness;\n#ifdef MATERIAL_HAS_CLEARCOATTEXTURE\nmaterial.clearCoat*=texture2D(material_ClearCoatTexture,v_uv).r;\n#endif\n#ifdef MATERIAL_HAS_CLEARCOATROUGHNESSTEXTURE\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
|
|
9449
9631
|
|
|
9450
9632
|
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
|
|
9451
9633
|
|
|
9452
|
-
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
|
|
9634
|
+
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_CLEARCOAT\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
|
|
9453
9635
|
|
|
9454
|
-
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
|
|
9636
|
+
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
|
|
9455
9637
|
|
|
9456
|
-
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
|
|
9638
|
+
var pbr_frag = "#define GLSLIFY 1\nGeometry geometry;Material material;ReflectedLight reflectedLight=ReflectedLight(vec3(0.0),vec3(0.0),vec3(0.0),vec3(0.0));initGeometry(geometry);initMaterial(material,geometry);addTotalDirectRadiance(geometry,material,reflectedLight);\n#ifdef SCENE_USE_SH\nvec3 irradiance=getLightProbeIrradiance(scene_EnvSH,geometry.normal);\n#ifdef ENGINE_IS_COLORSPACE_GAMMA\nirradiance=linearToGamma(vec4(irradiance,1.0)).rgb;\n#endif\nirradiance*=scene_EnvMapLight.diffuseIntensity;\n#else\nvec3 irradiance=scene_EnvMapLight.diffuse*scene_EnvMapLight.diffuseIntensity;irradiance*=PI;\n#endif\nreflectedLight.indirectDiffuse+=irradiance*BRDF_Diffuse_Lambert(material.diffuseColor);vec3 radiance=getLightProbeRadiance(geometry.viewDir,geometry.normal,material.roughness,int(scene_EnvMapLight.mipMapLevel),scene_EnvMapLight.specularIntensity);float radianceAttenuation=1.0;\n#ifdef MATERIAL_CLEARCOAT\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_OCCLUSIONTEXTURE\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
|
|
9457
9639
|
|
|
9458
9640
|
var PBRShaderLib = {
|
|
9459
9641
|
pbr_frag_define: pbr_frag_define,
|
|
@@ -9464,15 +9646,15 @@ var PBRShaderLib = {
|
|
|
9464
9646
|
pbr_frag: pbr_frag
|
|
9465
9647
|
};
|
|
9466
9648
|
|
|
9467
|
-
var ShadowCoord = "#define GLSLIFY 1\nuniform mat4
|
|
9649
|
+
var ShadowCoord = "#define GLSLIFY 1\nuniform mat4 scene_ShadowMatrices[SCENE_SHADOW_CASCADED_COUNT+1];uniform vec4 scene_ShadowSplitSpheres[4];mediump int computeCascadeIndex(vec3 positionWS){vec3 fromCenter0=positionWS-scene_ShadowSplitSpheres[0].xyz;vec3 fromCenter1=positionWS-scene_ShadowSplitSpheres[1].xyz;vec3 fromCenter2=positionWS-scene_ShadowSplitSpheres[2].xyz;vec3 fromCenter3=positionWS-scene_ShadowSplitSpheres[3].xyz;mediump vec4 comparison=vec4(dot(fromCenter0,fromCenter0)<scene_ShadowSplitSpheres[0].w,dot(fromCenter1,fromCenter1)<scene_ShadowSplitSpheres[1].w,dot(fromCenter2,fromCenter2)<scene_ShadowSplitSpheres[2].w,dot(fromCenter3,fromCenter3)<scene_ShadowSplitSpheres[3].w);comparison.yzw=clamp(comparison.yzw-comparison.xyz,0.0,1.0);mediump vec4 indexCoefficient=vec4(4.0,3.0,2.0,1.0);mediump int index=4-int(dot(comparison,indexCoefficient));return index;}vec3 getShadowCoord(){\n#if SCENE_SHADOW_CASCADED_COUNT == 1\nmediump int cascadeIndex=0;\n#else\nmediump int cascadeIndex=computeCascadeIndex(v_pos);\n#endif\n#ifdef GRAPHICS_API_WEBGL2\nmat4 shadowMatrix=scene_ShadowMatrices[cascadeIndex];\n#else\nmat4 shadowMatrix;\n#if SCENE_SHADOW_CASCADED_COUNT == 4\nif(cascadeIndex==0){shadowMatrix=scene_ShadowMatrices[0];}else if(cascadeIndex==1){shadowMatrix=scene_ShadowMatrices[1];}else if(cascadeIndex==2){shadowMatrix=scene_ShadowMatrices[2];}else if(cascadeIndex==3){shadowMatrix=scene_ShadowMatrices[3];}else{shadowMatrix=scene_ShadowMatrices[4];}\n#endif\n#if SCENE_SHADOW_CASCADED_COUNT == 2\nif(cascadeIndex==0){shadowMatrix=scene_ShadowMatrices[0];}else if(cascadeIndex==1){shadowMatrix=scene_ShadowMatrices[1];}else{shadowMatrix=scene_ShadowMatrices[2];}\n#endif\n#if SCENE_SHADOW_CASCADED_COUNT == 1\nif(cascadeIndex==0){shadowMatrix=scene_ShadowMatrices[0];}else{shadowMatrix=scene_ShadowMatrices[1];}\n#endif\n#endif\nvec4 shadowCoord=shadowMatrix*vec4(v_pos,1.0);return shadowCoord.xyz;}"; // eslint-disable-line
|
|
9468
9650
|
|
|
9469
|
-
var ShadowFragmentDeclaration = "#define GLSLIFY 1\n#if defined(
|
|
9651
|
+
var ShadowFragmentDeclaration = "#define GLSLIFY 1\n#if defined(SCENE_SHADOW_TYPE) && defined(RENDERER_IS_RECEIVE_SHADOWS)\n#define SCENE_IS_CALCULATE_SHADOWS\n#endif\n#ifdef SCENE_IS_CALCULATE_SHADOWS\n#if SCENE_SHADOW_CASCADED_COUNT == 1\nvarying vec3 v_shadowCoord;\n#else\n#include <ShadowCoord>\n#endif\nuniform vec3 scene_ShadowInfo;uniform vec4 scene_ShadowMapSize;\n#ifdef GRAPHICS_API_WEBGL2\nuniform mediump sampler2DShadow scene_ShadowMap;\n#define SAMPLE_TEXTURE2D_SHADOW(textureName, coord3) textureLod(textureName, coord3 , 0.0)\n#define TEXTURE2D_SHADOW_PARAM(shadowMap) mediump sampler2DShadow shadowMap\n#else\nuniform sampler2D scene_ShadowMap;\n#ifdef ENGINE_NO_DEPTH_TEXTURE\nconst vec4 bitShift=vec4(1.0,1.0/256.0,1.0/(256.0*256.0),1.0/(256.0*256.0*256.0));float unpack(const in vec4 rgbaDepth){return dot(rgbaDepth,bitShift);}\n#define SAMPLE_TEXTURE2D_SHADOW(textureName, coord3) (unpack(texture2D(textureName, coord3.xy)) < coord3.z ? 0.0 : 1.0)\n#else\n#define SAMPLE_TEXTURE2D_SHADOW(textureName, coord3) (texture2D(textureName, coord3.xy).r < coord3.z ? 0.0 : 1.0)\n#endif\n#define TEXTURE2D_SHADOW_PARAM(shadowMap) mediump sampler2D shadowMap\n#endif\n#if SCENE_SHADOW_TYPE == 2\nfloat sampleShadowMapFiltered4(TEXTURE2D_SHADOW_PARAM(shadowMap),vec3 shadowCoord,vec4 shadowMapSize){float attenuation;vec4 attenuation4;vec2 offset=shadowMapSize.xy/2.0;vec3 shadowCoord0=shadowCoord+vec3(-offset,0.0);vec3 shadowCoord1=shadowCoord+vec3(offset.x,-offset.y,0.0);vec3 shadowCoord2=shadowCoord+vec3(-offset.x,offset.y,0.0);vec3 shadowCoord3=shadowCoord+vec3(offset,0.0);attenuation4.x=SAMPLE_TEXTURE2D_SHADOW(shadowMap,shadowCoord0);attenuation4.y=SAMPLE_TEXTURE2D_SHADOW(shadowMap,shadowCoord1);attenuation4.z=SAMPLE_TEXTURE2D_SHADOW(shadowMap,shadowCoord2);attenuation4.w=SAMPLE_TEXTURE2D_SHADOW(shadowMap,shadowCoord3);attenuation=dot(attenuation4,vec4(0.25));return attenuation;}\n#endif\n#if SCENE_SHADOW_TYPE == 3\n#include <shadow_sample_tent>\nfloat sampleShadowMapFiltered9(TEXTURE2D_SHADOW_PARAM(shadowMap),vec3 shadowCoord,vec4 shadowmapSize){float attenuation;float fetchesWeights[9];vec2 fetchesUV[9];sampleShadowComputeSamplesTent5x5(shadowmapSize,shadowCoord.xy,fetchesWeights,fetchesUV);attenuation=fetchesWeights[0]*SAMPLE_TEXTURE2D_SHADOW(shadowMap,vec3(fetchesUV[0].xy,shadowCoord.z));attenuation+=fetchesWeights[1]*SAMPLE_TEXTURE2D_SHADOW(shadowMap,vec3(fetchesUV[1].xy,shadowCoord.z));attenuation+=fetchesWeights[2]*SAMPLE_TEXTURE2D_SHADOW(shadowMap,vec3(fetchesUV[2].xy,shadowCoord.z));attenuation+=fetchesWeights[3]*SAMPLE_TEXTURE2D_SHADOW(shadowMap,vec3(fetchesUV[3].xy,shadowCoord.z));attenuation+=fetchesWeights[4]*SAMPLE_TEXTURE2D_SHADOW(shadowMap,vec3(fetchesUV[4].xy,shadowCoord.z));attenuation+=fetchesWeights[5]*SAMPLE_TEXTURE2D_SHADOW(shadowMap,vec3(fetchesUV[5].xy,shadowCoord.z));attenuation+=fetchesWeights[6]*SAMPLE_TEXTURE2D_SHADOW(shadowMap,vec3(fetchesUV[6].xy,shadowCoord.z));attenuation+=fetchesWeights[7]*SAMPLE_TEXTURE2D_SHADOW(shadowMap,vec3(fetchesUV[7].xy,shadowCoord.z));attenuation+=fetchesWeights[8]*SAMPLE_TEXTURE2D_SHADOW(shadowMap,vec3(fetchesUV[8].xy,shadowCoord.z));return attenuation;}\n#endif\nfloat sampleShadowMap(){\n#if SCENE_SHADOW_CASCADED_COUNT == 1\nvec3 shadowCoord=v_shadowCoord;\n#else\nvec3 shadowCoord=getShadowCoord();\n#endif\nfloat attenuation=1.0;if(shadowCoord.z>0.0&&shadowCoord.z<1.0){\n#if SCENE_SHADOW_TYPE == 1\nattenuation=SAMPLE_TEXTURE2D_SHADOW(scene_ShadowMap,shadowCoord);\n#endif\n#if SCENE_SHADOW_TYPE == 2\nattenuation=sampleShadowMapFiltered4(scene_ShadowMap,shadowCoord,scene_ShadowMapSize);\n#endif\n#if SCENE_SHADOW_TYPE == 3\nattenuation=sampleShadowMapFiltered9(scene_ShadowMap,shadowCoord,scene_ShadowMapSize);\n#endif\nattenuation=mix(1.0,attenuation,scene_ShadowInfo.x);}return attenuation;}\n#endif\n"; // eslint-disable-line
|
|
9470
9652
|
|
|
9471
9653
|
var shadow_sample_tent = "#define GLSLIFY 1\nfloat sampleShadowGetIRTriangleTexelArea(float triangleHeight){return triangleHeight-0.5;}void sampleShadowGetTexelAreasTent3x3(float offset,out vec4 computedArea,out vec4 computedAreaUncut){float a=offset+0.5;float offsetSquaredHalved=a*a*0.5;computedAreaUncut.x=computedArea.x=offsetSquaredHalved-offset;computedAreaUncut.w=computedArea.w=offsetSquaredHalved;computedAreaUncut.y=sampleShadowGetIRTriangleTexelArea(1.5-offset);float clampedOffsetLeft=min(offset,0.0);float areaOfSmallLeftTriangle=clampedOffsetLeft*clampedOffsetLeft;computedArea.y=computedAreaUncut.y-areaOfSmallLeftTriangle;computedAreaUncut.z=sampleShadowGetIRTriangleTexelArea(1.5+offset);float clampedOffsetRight=max(offset,0.0);float areaOfSmallRightTriangle=clampedOffsetRight*clampedOffsetRight;computedArea.z=computedAreaUncut.z-areaOfSmallRightTriangle;}void sampleShadowGetTexelWeightsTent5x5(float offset,out vec3 texelsWeightsA,out vec3 texelsWeightsB){vec4 areaFrom3texelTriangle;vec4 areaUncutFrom3texelTriangle;sampleShadowGetTexelAreasTent3x3(offset,areaFrom3texelTriangle,areaUncutFrom3texelTriangle);texelsWeightsA.x=0.16*(areaFrom3texelTriangle.x);texelsWeightsA.y=0.16*(areaUncutFrom3texelTriangle.y);texelsWeightsA.z=0.16*(areaFrom3texelTriangle.y+1.0);texelsWeightsB.x=0.16*(areaFrom3texelTriangle.z+1.0);texelsWeightsB.y=0.16*(areaUncutFrom3texelTriangle.z);texelsWeightsB.z=0.16*(areaFrom3texelTriangle.w);}void sampleShadowComputeSamplesTent5x5(vec4 shadowMapTextureTexelSize,vec2 coord,out float fetchesWeights[9],out vec2 fetchesUV[9]){vec2 tentCenterInTexelSpace=coord.xy*shadowMapTextureTexelSize.zw;vec2 centerOfFetchesInTexelSpace=floor(tentCenterInTexelSpace+0.5);vec2 offsetFromTentCenterToCenterOfFetches=tentCenterInTexelSpace-centerOfFetchesInTexelSpace;vec3 texelsWeightsUA,texelsWeightsUB;vec3 texelsWeightsVA,texelsWeightsVB;sampleShadowGetTexelWeightsTent5x5(offsetFromTentCenterToCenterOfFetches.x,texelsWeightsUA,texelsWeightsUB);sampleShadowGetTexelWeightsTent5x5(offsetFromTentCenterToCenterOfFetches.y,texelsWeightsVA,texelsWeightsVB);vec3 fetchesWeightsU=vec3(texelsWeightsUA.xz,texelsWeightsUB.y)+vec3(texelsWeightsUA.y,texelsWeightsUB.xz);vec3 fetchesWeightsV=vec3(texelsWeightsVA.xz,texelsWeightsVB.y)+vec3(texelsWeightsVA.y,texelsWeightsVB.xz);vec3 fetchesOffsetsU=vec3(texelsWeightsUA.y,texelsWeightsUB.xz)/fetchesWeightsU.xyz+vec3(-2.5,-0.5,1.5);vec3 fetchesOffsetsV=vec3(texelsWeightsVA.y,texelsWeightsVB.xz)/fetchesWeightsV.xyz+vec3(-2.5,-0.5,1.5);fetchesOffsetsU*=shadowMapTextureTexelSize.xxx;fetchesOffsetsV*=shadowMapTextureTexelSize.yyy;vec2 bilinearFetchOrigin=centerOfFetchesInTexelSpace*shadowMapTextureTexelSize.xy;fetchesUV[0]=bilinearFetchOrigin+vec2(fetchesOffsetsU.x,fetchesOffsetsV.x);fetchesUV[1]=bilinearFetchOrigin+vec2(fetchesOffsetsU.y,fetchesOffsetsV.x);fetchesUV[2]=bilinearFetchOrigin+vec2(fetchesOffsetsU.z,fetchesOffsetsV.x);fetchesUV[3]=bilinearFetchOrigin+vec2(fetchesOffsetsU.x,fetchesOffsetsV.y);fetchesUV[4]=bilinearFetchOrigin+vec2(fetchesOffsetsU.y,fetchesOffsetsV.y);fetchesUV[5]=bilinearFetchOrigin+vec2(fetchesOffsetsU.z,fetchesOffsetsV.y);fetchesUV[6]=bilinearFetchOrigin+vec2(fetchesOffsetsU.x,fetchesOffsetsV.z);fetchesUV[7]=bilinearFetchOrigin+vec2(fetchesOffsetsU.y,fetchesOffsetsV.z);fetchesUV[8]=bilinearFetchOrigin+vec2(fetchesOffsetsU.z,fetchesOffsetsV.z);fetchesWeights[0]=fetchesWeightsU.x*fetchesWeightsV.x;fetchesWeights[1]=fetchesWeightsU.y*fetchesWeightsV.x;fetchesWeights[2]=fetchesWeightsU.z*fetchesWeightsV.x;fetchesWeights[3]=fetchesWeightsU.x*fetchesWeightsV.y;fetchesWeights[4]=fetchesWeightsU.y*fetchesWeightsV.y;fetchesWeights[5]=fetchesWeightsU.z*fetchesWeightsV.y;fetchesWeights[6]=fetchesWeightsU.x*fetchesWeightsV.z;fetchesWeights[7]=fetchesWeightsU.y*fetchesWeightsV.z;fetchesWeights[8]=fetchesWeightsU.z*fetchesWeightsV.z;}"; // eslint-disable-line
|
|
9472
9654
|
|
|
9473
|
-
var ShadowVertexDeclaration = "#define GLSLIFY 1\n#if defined(
|
|
9655
|
+
var ShadowVertexDeclaration = "#define GLSLIFY 1\n#if defined(SCENE_SHADOW_TYPE) && defined(RENDERER_IS_RECEIVE_SHADOWS)\n#define SCENE_IS_CALCULATE_SHADOWS\n#endif\n#ifdef SCENE_IS_CALCULATE_SHADOWS\n#if SCENE_SHADOW_CASCADED_COUNT==1\n#include <ShadowCoord>\nvarying vec3 v_shadowCoord;\n#endif\n#endif\n"; // eslint-disable-line
|
|
9474
9656
|
|
|
9475
|
-
var ShadowVertex = "#define GLSLIFY 1\n#ifdef
|
|
9657
|
+
var ShadowVertex = "#define GLSLIFY 1\n#ifdef SCENE_IS_CALCULATE_SHADOWS\n#if SCENE_SHADOW_CASCADED_COUNT == 1\nv_shadowCoord=getShadowCoord();\n#endif\n#endif\n"; // eslint-disable-line
|
|
9476
9658
|
|
|
9477
9659
|
var ShadowLib = {
|
|
9478
9660
|
ShadowCoord: ShadowCoord,
|
|
@@ -9482,7 +9664,7 @@ var ShadowLib = {
|
|
|
9482
9664
|
ShadowVertex: ShadowVertex
|
|
9483
9665
|
};
|
|
9484
9666
|
|
|
9485
|
-
var normal_get = "#define GLSLIFY 1\nvec3 getNormal(){\n#ifdef
|
|
9667
|
+
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(gl_FrontFacing)*2.0-1.0;return normal;}vec3 getNormalByNormalTexture(mat3 tbn,sampler2D normalTexture,float normalIntensity,vec2 uv){vec3 normal=texture2D(normalTexture,uv).rgb;normal=normalize(tbn*((2.0*normal-1.0)*vec3(normalIntensity,normalIntensity,1.0)));normal*=float(gl_FrontFacing)*2.0-1.0;return normal;}mat3 getTBN(){\n#if defined(RENDERER_HAS_NORMAL) && defined(RENDERER_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEARCOATNORMALTEXTURE) )\nmat3 tbn=v_TBN;\n#else\nvec3 normal=getNormal();vec3 position=v_pos;vec2 uv=gl_FrontFacing? 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
|
|
9486
9668
|
|
|
9487
9669
|
var ShaderLib = _extends({
|
|
9488
9670
|
common: common,
|
|
@@ -9493,7 +9675,6 @@ var ShaderLib = _extends({
|
|
|
9493
9675
|
normal_share: normal_share,
|
|
9494
9676
|
uv_share: uv_share,
|
|
9495
9677
|
worldpos_share: worldpos_share,
|
|
9496
|
-
RendererFragmentDeclaration: RendererFragmentDeclaration,
|
|
9497
9678
|
FogVertexDeclaration: FogVertexDeclaration,
|
|
9498
9679
|
FogFragmentDeclaration: FogFragmentDeclaration,
|
|
9499
9680
|
begin_normal_vert: begin_normal_vert,
|
|
@@ -9602,8 +9783,7 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
9602
9783
|
|
|
9603
9784
|
/**
|
|
9604
9785
|
* Shader tag key.
|
|
9605
|
-
*/ var
|
|
9606
|
-
var ShaderTagKey = /*#__PURE__*/ function() {
|
|
9786
|
+
*/ var ShaderTagKey = /*#__PURE__*/ function() {
|
|
9607
9787
|
function ShaderTagKey(name) {
|
|
9608
9788
|
this.name = name;
|
|
9609
9789
|
this._uniqueId = ShaderTagKey._nameCounter++;
|
|
@@ -9613,13 +9793,18 @@ var ShaderTagKey = /*#__PURE__*/ function() {
|
|
|
9613
9793
|
* @param name - Name of the shader property
|
|
9614
9794
|
* @returns Shader property
|
|
9615
9795
|
*/ ShaderTagKey.getByName = function getByName(name) {
|
|
9796
|
+
var _nameMap, _name;
|
|
9616
9797
|
var nameMap = ShaderTagKey._nameMap;
|
|
9617
9798
|
return (_nameMap = nameMap)[_name = name] || (_nameMap[_name] = new ShaderTagKey(name));
|
|
9618
9799
|
};
|
|
9619
9800
|
return ShaderTagKey;
|
|
9620
9801
|
}();
|
|
9621
|
-
|
|
9622
|
-
ShaderTagKey.
|
|
9802
|
+
(function() {
|
|
9803
|
+
ShaderTagKey._nameCounter = 0;
|
|
9804
|
+
})();
|
|
9805
|
+
(function() {
|
|
9806
|
+
ShaderTagKey._nameMap = Object.create(null);
|
|
9807
|
+
})();
|
|
9623
9808
|
|
|
9624
9809
|
/**
|
|
9625
9810
|
* Base class for shader structure.
|
|
@@ -10223,7 +10408,7 @@ ShaderTagKey._nameMap = Object.create(null);
|
|
|
10223
10408
|
return prefix + line;
|
|
10224
10409
|
}).join("\n");
|
|
10225
10410
|
};
|
|
10226
|
-
|
|
10411
|
+
_create_class(ShaderProgram, [
|
|
10227
10412
|
{
|
|
10228
10413
|
key: "isValid",
|
|
10229
10414
|
get: /**
|
|
@@ -10235,7 +10420,9 @@ ShaderTagKey._nameMap = Object.create(null);
|
|
|
10235
10420
|
]);
|
|
10236
10421
|
return ShaderProgram;
|
|
10237
10422
|
}();
|
|
10238
|
-
|
|
10423
|
+
(function() {
|
|
10424
|
+
ShaderProgram._counter = 0;
|
|
10425
|
+
})();
|
|
10239
10426
|
|
|
10240
10427
|
/**
|
|
10241
10428
|
* Shader pass containing vertex and fragment source.
|
|
@@ -10290,7 +10477,9 @@ ShaderProgram._counter = 0;
|
|
|
10290
10477
|
};
|
|
10291
10478
|
return ShaderPass;
|
|
10292
10479
|
}(ShaderPart);
|
|
10293
|
-
|
|
10480
|
+
(function() {
|
|
10481
|
+
ShaderPass._shaderPassCounter = 0;
|
|
10482
|
+
})();
|
|
10294
10483
|
|
|
10295
10484
|
/**
|
|
10296
10485
|
* Sub shader.
|
|
@@ -10310,7 +10499,7 @@ ShaderPass._shaderPassCounter = 0;
|
|
|
10310
10499
|
}
|
|
10311
10500
|
return _this;
|
|
10312
10501
|
}
|
|
10313
|
-
|
|
10502
|
+
_create_class(SubShader, [
|
|
10314
10503
|
{
|
|
10315
10504
|
key: "passes",
|
|
10316
10505
|
get: /**
|
|
@@ -10409,7 +10598,7 @@ ShaderPass._shaderPassCounter = 0;
|
|
|
10409
10598
|
*/ Shader.getPropertyByName = function getPropertyByName(name) {
|
|
10410
10599
|
return ShaderProperty.getByName(name);
|
|
10411
10600
|
};
|
|
10412
|
-
|
|
10601
|
+
_create_class(Shader, [
|
|
10413
10602
|
{
|
|
10414
10603
|
key: "subShaders",
|
|
10415
10604
|
get: /**
|
|
@@ -10421,13 +10610,19 @@ ShaderPass._shaderPassCounter = 0;
|
|
|
10421
10610
|
]);
|
|
10422
10611
|
return Shader;
|
|
10423
10612
|
}();
|
|
10424
|
-
|
|
10425
|
-
/** @internal */ Shader.
|
|
10426
|
-
|
|
10427
|
-
|
|
10428
|
-
|
|
10429
|
-
|
|
10430
|
-
|
|
10613
|
+
(function() {
|
|
10614
|
+
/** @internal */ Shader._compileMacros = new ShaderMacroCollection();
|
|
10615
|
+
})();
|
|
10616
|
+
(function() {
|
|
10617
|
+
/** @internal */ Shader._shaderExtension = [
|
|
10618
|
+
"GL_EXT_shader_texture_lod",
|
|
10619
|
+
"GL_OES_standard_derivatives",
|
|
10620
|
+
"GL_EXT_draw_buffers"
|
|
10621
|
+
];
|
|
10622
|
+
})();
|
|
10623
|
+
(function() {
|
|
10624
|
+
Shader._shaderMap = Object.create(null);
|
|
10625
|
+
})();
|
|
10431
10626
|
|
|
10432
10627
|
/**
|
|
10433
10628
|
* @internal
|
|
@@ -10444,10 +10639,18 @@ Shader._shaderMap = Object.create(null);
|
|
|
10444
10639
|
};
|
|
10445
10640
|
return RenderContext;
|
|
10446
10641
|
}();
|
|
10447
|
-
|
|
10448
|
-
RenderContext.
|
|
10449
|
-
|
|
10450
|
-
|
|
10642
|
+
(function() {
|
|
10643
|
+
RenderContext.vpMatrixProperty = ShaderProperty.getByName("camera_VPMat");
|
|
10644
|
+
})();
|
|
10645
|
+
(function() {
|
|
10646
|
+
RenderContext.pipelineStageKey = ShaderTagKey.getByName("pipelineStage");
|
|
10647
|
+
})();
|
|
10648
|
+
(function() {
|
|
10649
|
+
RenderContext._viewMatrixProperty = ShaderProperty.getByName("camera_ViewMat");
|
|
10650
|
+
})();
|
|
10651
|
+
(function() {
|
|
10652
|
+
RenderContext._projectionMatrixProperty = ShaderProperty.getByName("camera_ProjMat");
|
|
10653
|
+
})();
|
|
10451
10654
|
|
|
10452
10655
|
var RenderElement = /*#__PURE__*/ function() {
|
|
10453
10656
|
function RenderElement() {}
|
|
@@ -10476,7 +10679,6 @@ var Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10476
10679
|
function Renderer1(entity) {
|
|
10477
10680
|
var _this;
|
|
10478
10681
|
_this = Component.call(this, entity) || this;
|
|
10479
|
-
/** Whether cast shadow. */ _this.castShadows = true;
|
|
10480
10682
|
/** ShaderData related to renderer. */ _this.shaderData = new ShaderData(ShaderDataGroup.Renderer);
|
|
10481
10683
|
/** @internal */ _this._onUpdateIndex = -1;
|
|
10482
10684
|
/** @internal */ _this._rendererIndex = -1;
|
|
@@ -10493,11 +10695,12 @@ var Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10493
10695
|
_this._priority = 0;
|
|
10494
10696
|
_this._receiveShadows = true;
|
|
10495
10697
|
_this._rendererLayer = new Vector4();
|
|
10698
|
+
/** Whether cast shadow. */ _this.castShadows = true;
|
|
10496
10699
|
var prototype = Renderer.prototype;
|
|
10497
10700
|
var shaderData = _this.shaderData;
|
|
10498
10701
|
_this._overrideUpdate = _this.update !== prototype.update;
|
|
10499
10702
|
shaderData._addReferCount(1);
|
|
10500
|
-
_this._onTransformChanged = _this._onTransformChanged.bind(
|
|
10703
|
+
_this._onTransformChanged = _this._onTransformChanged.bind(_assert_this_initialized(_this));
|
|
10501
10704
|
_this._registerEntityTransformListener();
|
|
10502
10705
|
shaderData.enableMacro(Renderer._receiveShadowMacro);
|
|
10503
10706
|
shaderData.setVector4(Renderer._rendererLayerProperty, _this._rendererLayer);
|
|
@@ -10684,7 +10887,7 @@ var Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10684
10887
|
_proto._onTransformChanged = function _onTransformChanged(type) {
|
|
10685
10888
|
this._dirtyUpdateFlag |= 0x1;
|
|
10686
10889
|
};
|
|
10687
|
-
|
|
10890
|
+
_create_class(Renderer1, [
|
|
10688
10891
|
{
|
|
10689
10892
|
key: "isCulled",
|
|
10690
10893
|
get: /**
|
|
@@ -10750,7 +10953,25 @@ var Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10750
10953
|
}
|
|
10751
10954
|
]);
|
|
10752
10955
|
return Renderer1;
|
|
10753
|
-
}(Component),
|
|
10956
|
+
}(Component), function() {
|
|
10957
|
+
_Renderer._tempVector0 = new Vector3();
|
|
10958
|
+
}(), function() {
|
|
10959
|
+
_Renderer._receiveShadowMacro = ShaderMacro.getByName("RENDERER_IS_RECEIVE_SHADOWS");
|
|
10960
|
+
}(), function() {
|
|
10961
|
+
_Renderer._localMatrixProperty = ShaderProperty.getByName("renderer_LocalMat");
|
|
10962
|
+
}(), function() {
|
|
10963
|
+
_Renderer._worldMatrixProperty = ShaderProperty.getByName("renderer_ModelMat");
|
|
10964
|
+
}(), function() {
|
|
10965
|
+
_Renderer._mvMatrixProperty = ShaderProperty.getByName("renderer_MVMat");
|
|
10966
|
+
}(), function() {
|
|
10967
|
+
_Renderer._mvpMatrixProperty = ShaderProperty.getByName("renderer_MVPMat");
|
|
10968
|
+
}(), function() {
|
|
10969
|
+
_Renderer._mvInvMatrixProperty = ShaderProperty.getByName("renderer_MVInvMat");
|
|
10970
|
+
}(), function() {
|
|
10971
|
+
_Renderer._normalMatrixProperty = ShaderProperty.getByName("renderer_NormalMat");
|
|
10972
|
+
}(), function() {
|
|
10973
|
+
_Renderer._rendererLayerProperty = ShaderProperty.getByName("renderer_Layer");
|
|
10974
|
+
}(), _Renderer);
|
|
10754
10975
|
__decorate([
|
|
10755
10976
|
deepClone
|
|
10756
10977
|
], Renderer.prototype, "shaderData", void 0);
|
|
@@ -10880,14 +11101,18 @@ var SimpleSpriteAssembler = (_SimpleSpriteAssembler = /*#__PURE__*/ function() {
|
|
|
10880
11101
|
renderUVs[3].set(right, top);
|
|
10881
11102
|
};
|
|
10882
11103
|
return SimpleSpriteAssembler1;
|
|
10883
|
-
}(),
|
|
10884
|
-
|
|
10885
|
-
|
|
10886
|
-
|
|
10887
|
-
|
|
10888
|
-
|
|
10889
|
-
|
|
10890
|
-
|
|
11104
|
+
}(), function() {
|
|
11105
|
+
_SimpleSpriteAssembler._rectangleTriangles = [
|
|
11106
|
+
0,
|
|
11107
|
+
1,
|
|
11108
|
+
2,
|
|
11109
|
+
2,
|
|
11110
|
+
1,
|
|
11111
|
+
3
|
|
11112
|
+
];
|
|
11113
|
+
}(), function() {
|
|
11114
|
+
_SimpleSpriteAssembler._worldMatrix = new Matrix();
|
|
11115
|
+
}(), _SimpleSpriteAssembler);
|
|
10891
11116
|
SimpleSpriteAssembler = __decorate([
|
|
10892
11117
|
StaticInterfaceImplement()
|
|
10893
11118
|
], SimpleSpriteAssembler);
|
|
@@ -10972,10 +11197,10 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10972
11197
|
_this._flipY = false;
|
|
10973
11198
|
_this._alphaCutoff = 0.5;
|
|
10974
11199
|
_this._verticesData = new VertexData2D(4, [], []);
|
|
10975
|
-
SimpleSpriteAssembler.resetData(
|
|
11200
|
+
SimpleSpriteAssembler.resetData(_assert_this_initialized(_this));
|
|
10976
11201
|
_this.setMaterial(_this._engine._spriteMaskDefaultMaterial);
|
|
10977
11202
|
_this.shaderData.setFloat(SpriteMask._alphaCutoffProperty, _this._alphaCutoff);
|
|
10978
|
-
_this._onSpriteChange = _this._onSpriteChange.bind(
|
|
11203
|
+
_this._onSpriteChange = _this._onSpriteChange.bind(_assert_this_initialized(_this));
|
|
10979
11204
|
return _this;
|
|
10980
11205
|
}
|
|
10981
11206
|
var _proto = SpriteMask.prototype;
|
|
@@ -11045,7 +11270,7 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11045
11270
|
break;
|
|
11046
11271
|
}
|
|
11047
11272
|
};
|
|
11048
|
-
|
|
11273
|
+
_create_class(SpriteMask, [
|
|
11049
11274
|
{
|
|
11050
11275
|
key: "width",
|
|
11051
11276
|
get: /**
|
|
@@ -11147,8 +11372,12 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11147
11372
|
]);
|
|
11148
11373
|
return SpriteMask;
|
|
11149
11374
|
}(Renderer);
|
|
11150
|
-
|
|
11151
|
-
/** @internal */ SpriteMask.
|
|
11375
|
+
(function() {
|
|
11376
|
+
/** @internal */ SpriteMask._textureProperty = ShaderProperty.getByName("renderer_MaskTexture");
|
|
11377
|
+
})();
|
|
11378
|
+
(function() {
|
|
11379
|
+
/** @internal */ SpriteMask._alphaCutoffProperty = ShaderProperty.getByName("renderer_MaskAlphaCutoff");
|
|
11380
|
+
})();
|
|
11152
11381
|
__decorate([
|
|
11153
11382
|
assignmentClone
|
|
11154
11383
|
], SpriteMask.prototype, "influenceLayers", void 0);
|
|
@@ -11333,7 +11562,7 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11333
11562
|
this._glElementInfo = BufferUtil._getElementInfo(this.format);
|
|
11334
11563
|
this._instanceStepRate = Math.floor(instanceStepRate);
|
|
11335
11564
|
}
|
|
11336
|
-
|
|
11565
|
+
_create_class(VertexElement, [
|
|
11337
11566
|
{
|
|
11338
11567
|
key: "semantic",
|
|
11339
11568
|
get: /**
|
|
@@ -11458,7 +11687,7 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11458
11687
|
this._platformBuffer.resize(byteLength);
|
|
11459
11688
|
this._byteLength = byteLength;
|
|
11460
11689
|
};
|
|
11461
|
-
|
|
11690
|
+
_create_class(Buffer, [
|
|
11462
11691
|
{
|
|
11463
11692
|
key: "type",
|
|
11464
11693
|
get: /**
|
|
@@ -11515,7 +11744,7 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11515
11744
|
this._buffer = buffer;
|
|
11516
11745
|
this._format = format;
|
|
11517
11746
|
}
|
|
11518
|
-
|
|
11747
|
+
_create_class(IndexBufferBinding, [
|
|
11519
11748
|
{
|
|
11520
11749
|
key: "buffer",
|
|
11521
11750
|
get: /**
|
|
@@ -11564,8 +11793,8 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11564
11793
|
_this._bounds = new BoundingBox();
|
|
11565
11794
|
_this._subMeshes = [];
|
|
11566
11795
|
_this.name = name;
|
|
11567
|
-
_this._platformPrimitive = _this._engine._hardwareRenderer.createPlatformPrimitive(
|
|
11568
|
-
_this._onBoundsChanged = _this._onBoundsChanged.bind(
|
|
11796
|
+
_this._platformPrimitive = _this._engine._hardwareRenderer.createPlatformPrimitive(_assert_this_initialized(_this));
|
|
11797
|
+
_this._onBoundsChanged = _this._onBoundsChanged.bind(_assert_this_initialized(_this));
|
|
11569
11798
|
var bounds = _this._bounds;
|
|
11570
11799
|
// @ts-ignore
|
|
11571
11800
|
bounds.min._onValueChanged = _this._onBoundsChanged;
|
|
@@ -11688,7 +11917,7 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11688
11917
|
_proto._onBoundsChanged = function _onBoundsChanged() {
|
|
11689
11918
|
this._updateFlagManager.dispatch(0x1);
|
|
11690
11919
|
};
|
|
11691
|
-
|
|
11920
|
+
_create_class(Mesh, [
|
|
11692
11921
|
{
|
|
11693
11922
|
key: "bounds",
|
|
11694
11923
|
get: /**
|
|
@@ -11734,7 +11963,7 @@ var MeshModifyFlags;
|
|
|
11734
11963
|
this._buffer = buffer;
|
|
11735
11964
|
this._stride = stride;
|
|
11736
11965
|
}
|
|
11737
|
-
|
|
11966
|
+
_create_class(VertexBufferBinding, [
|
|
11738
11967
|
{
|
|
11739
11968
|
key: "buffer",
|
|
11740
11969
|
get: /**
|
|
@@ -11816,7 +12045,7 @@ var MeshModifyFlags;
|
|
|
11816
12045
|
shaderData.setTexture(BlendShapeManager._blendShapeTextureProperty, this._vertexTexture);
|
|
11817
12046
|
shaderData.setVector3(BlendShapeManager._blendShapeTextureInfoProperty, this._dataTextureInfo);
|
|
11818
12047
|
shaderData.setFloatArray(BlendShapeManager._blendShapeWeightsProperty, skinnedMeshRenderer.blendShapeWeights);
|
|
11819
|
-
shaderData.enableMacro("
|
|
12048
|
+
shaderData.enableMacro("RENDERER_BLENDSHAPE_COUNT", blendShapeCount.toString());
|
|
11820
12049
|
this._uniformOccupiesCount = blendShapeCount + 1;
|
|
11821
12050
|
} else {
|
|
11822
12051
|
var maxBlendCount = this._getVertexBufferModeSupportCount();
|
|
@@ -11835,7 +12064,7 @@ var MeshModifyFlags;
|
|
|
11835
12064
|
this._modelMesh._enableVAO = true;
|
|
11836
12065
|
}
|
|
11837
12066
|
shaderData.disableMacro(BlendShapeManager._blendShapeTextureMacro);
|
|
11838
|
-
shaderData.disableMacro("
|
|
12067
|
+
shaderData.disableMacro("RENDERER_BLENDSHAPE_COUNT");
|
|
11839
12068
|
this._uniformOccupiesCount = blendShapeCount;
|
|
11840
12069
|
}
|
|
11841
12070
|
if (this._useBlendNormal) {
|
|
@@ -11850,7 +12079,7 @@ var MeshModifyFlags;
|
|
|
11850
12079
|
}
|
|
11851
12080
|
} else {
|
|
11852
12081
|
shaderData.disableMacro(BlendShapeManager._blendShapeMacro);
|
|
11853
|
-
shaderData.disableMacro("
|
|
12082
|
+
shaderData.disableMacro("RENDERER_BLENDSHAPE_COUNT");
|
|
11854
12083
|
}
|
|
11855
12084
|
};
|
|
11856
12085
|
/**
|
|
@@ -12168,13 +12397,27 @@ var MeshModifyFlags;
|
|
|
12168
12397
|
};
|
|
12169
12398
|
return BlendShapeManager;
|
|
12170
12399
|
}();
|
|
12171
|
-
|
|
12172
|
-
BlendShapeManager.
|
|
12173
|
-
|
|
12174
|
-
|
|
12175
|
-
BlendShapeManager.
|
|
12176
|
-
|
|
12177
|
-
|
|
12400
|
+
(function() {
|
|
12401
|
+
BlendShapeManager._blendShapeMacro = ShaderMacro.getByName("RENDERER_HAS_BLENDSHAPE");
|
|
12402
|
+
})();
|
|
12403
|
+
(function() {
|
|
12404
|
+
BlendShapeManager._blendShapeTextureMacro = ShaderMacro.getByName("RENDERER_BLENDSHAPE_USE_TEXTURE");
|
|
12405
|
+
})();
|
|
12406
|
+
(function() {
|
|
12407
|
+
BlendShapeManager._blendShapeNormalMacro = ShaderMacro.getByName("RENDERER_BLENDSHAPE_HAS_NORMAL");
|
|
12408
|
+
})();
|
|
12409
|
+
(function() {
|
|
12410
|
+
BlendShapeManager._blendShapeTangentMacro = ShaderMacro.getByName("RENDERER_BLENDSHAPE_HAS_TANGENT");
|
|
12411
|
+
})();
|
|
12412
|
+
(function() {
|
|
12413
|
+
BlendShapeManager._blendShapeWeightsProperty = ShaderProperty.getByName("renderer_BlendShapeWeights");
|
|
12414
|
+
})();
|
|
12415
|
+
(function() {
|
|
12416
|
+
BlendShapeManager._blendShapeTextureProperty = ShaderProperty.getByName("renderer_BlendShapeTexture");
|
|
12417
|
+
})();
|
|
12418
|
+
(function() {
|
|
12419
|
+
BlendShapeManager._blendShapeTextureInfoProperty = ShaderProperty.getByName("renderer_BlendShapeTextureInfo");
|
|
12420
|
+
})();
|
|
12178
12421
|
|
|
12179
12422
|
/**
|
|
12180
12423
|
* Vertex attribute types of a vertex in a ModelMesh.
|
|
@@ -12231,7 +12474,7 @@ BlendShapeManager._blendShapeTextureInfoProperty = ShaderProperty.getByName("u_b
|
|
|
12231
12474
|
_this._customVertexElements = [];
|
|
12232
12475
|
_this._vertexCountChanged = false;
|
|
12233
12476
|
_this.name = name;
|
|
12234
|
-
_this._blendShapeManager = new BlendShapeManager(engine,
|
|
12477
|
+
_this._blendShapeManager = new BlendShapeManager(engine, _assert_this_initialized(_this));
|
|
12235
12478
|
return _this;
|
|
12236
12479
|
}
|
|
12237
12480
|
var _proto = ModelMesh.prototype;
|
|
@@ -13148,7 +13391,7 @@ BlendShapeManager._blendShapeTextureInfoProperty = ShaderProperty.getByName("u_b
|
|
|
13148
13391
|
this._uv7 = null;
|
|
13149
13392
|
this._blendShapeManager._releaseMemoryCache();
|
|
13150
13393
|
};
|
|
13151
|
-
|
|
13394
|
+
_create_class(ModelMesh, [
|
|
13152
13395
|
{
|
|
13153
13396
|
key: "readable",
|
|
13154
13397
|
get: /**
|
|
@@ -13213,11 +13456,21 @@ BlendShapeManager._blendShapeTextureInfoProperty = ShaderProperty.getByName("u_b
|
|
|
13213
13456
|
]);
|
|
13214
13457
|
return ModelMesh;
|
|
13215
13458
|
}(Mesh);
|
|
13216
|
-
|
|
13217
|
-
ModelMesh.
|
|
13218
|
-
|
|
13219
|
-
|
|
13220
|
-
ModelMesh.
|
|
13459
|
+
(function() {
|
|
13460
|
+
ModelMesh._tempVec0 = new Vector3();
|
|
13461
|
+
})();
|
|
13462
|
+
(function() {
|
|
13463
|
+
ModelMesh._tempVec1 = new Vector3();
|
|
13464
|
+
})();
|
|
13465
|
+
(function() {
|
|
13466
|
+
ModelMesh._tempVec2 = new Vector3();
|
|
13467
|
+
})();
|
|
13468
|
+
(function() {
|
|
13469
|
+
ModelMesh._tempVec3 = new Vector3();
|
|
13470
|
+
})();
|
|
13471
|
+
(function() {
|
|
13472
|
+
ModelMesh._tempVec4 = new Vector3();
|
|
13473
|
+
})();
|
|
13221
13474
|
var VertexChangedFlags;
|
|
13222
13475
|
(function(VertexChangedFlags) {
|
|
13223
13476
|
VertexChangedFlags[VertexChangedFlags["Position"] = 0x1] = "Position";
|
|
@@ -13260,7 +13513,7 @@ var VertexChangedFlags;
|
|
|
13260
13513
|
function MeshRenderer(entity) {
|
|
13261
13514
|
var _this;
|
|
13262
13515
|
_this = Renderer.call(this, entity) || this;
|
|
13263
|
-
_this._onMeshChanged = _this._onMeshChanged.bind(
|
|
13516
|
+
_this._onMeshChanged = _this._onMeshChanged.bind(_assert_this_initialized(_this));
|
|
13264
13517
|
return _this;
|
|
13265
13518
|
}
|
|
13266
13519
|
var _proto = MeshRenderer.prototype;
|
|
@@ -13359,7 +13612,7 @@ var VertexChangedFlags;
|
|
|
13359
13612
|
type & MeshModifyFlags.Bounds && (this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume);
|
|
13360
13613
|
type & MeshModifyFlags.VertexElements && (this._dirtyUpdateFlag |= 0x2);
|
|
13361
13614
|
};
|
|
13362
|
-
|
|
13615
|
+
_create_class(MeshRenderer, [
|
|
13363
13616
|
{
|
|
13364
13617
|
key: "mesh",
|
|
13365
13618
|
get: /**
|
|
@@ -13376,11 +13629,21 @@ var VertexChangedFlags;
|
|
|
13376
13629
|
]);
|
|
13377
13630
|
return MeshRenderer;
|
|
13378
13631
|
}(Renderer);
|
|
13379
|
-
|
|
13380
|
-
MeshRenderer.
|
|
13381
|
-
|
|
13382
|
-
|
|
13383
|
-
MeshRenderer.
|
|
13632
|
+
(function() {
|
|
13633
|
+
MeshRenderer._uvMacro = ShaderMacro.getByName("RENDERER_HAS_UV");
|
|
13634
|
+
})();
|
|
13635
|
+
(function() {
|
|
13636
|
+
MeshRenderer._uv1Macro = ShaderMacro.getByName("RENDERER_HAS_UV1");
|
|
13637
|
+
})();
|
|
13638
|
+
(function() {
|
|
13639
|
+
MeshRenderer._normalMacro = ShaderMacro.getByName("RENDERER_HAS_NORMAL");
|
|
13640
|
+
})();
|
|
13641
|
+
(function() {
|
|
13642
|
+
MeshRenderer._tangentMacro = ShaderMacro.getByName("RENDERER_HAS_TANGENT");
|
|
13643
|
+
})();
|
|
13644
|
+
(function() {
|
|
13645
|
+
MeshRenderer._vertexColorMacro = ShaderMacro.getByName("RENDERER_HAS_VERTEXCOLOR");
|
|
13646
|
+
})();
|
|
13384
13647
|
__decorate([
|
|
13385
13648
|
ignoreClone
|
|
13386
13649
|
], MeshRenderer.prototype, "_mesh", void 0);
|
|
@@ -13395,76 +13658,6 @@ var /**
|
|
|
13395
13658
|
MeshRendererUpdateFlags[MeshRendererUpdateFlags[/** All. */ "All"] = 0x3] = "All";
|
|
13396
13659
|
})(MeshRendererUpdateFlags || (MeshRendererUpdateFlags = {}));
|
|
13397
13660
|
|
|
13398
|
-
var Utils = /*#__PURE__*/ function() {
|
|
13399
|
-
function Utils() {}
|
|
13400
|
-
/**
|
|
13401
|
-
* @internal
|
|
13402
|
-
*/ Utils._floatMatrixMultiply = function _floatMatrixMultiply(left, re, rOffset, oe, offset) {
|
|
13403
|
-
var le = left.elements;
|
|
13404
|
-
// prettier-ignore
|
|
13405
|
-
var l11 = le[0], l12 = le[1], l13 = le[2], l14 = le[3], l21 = le[4], l22 = le[5], l23 = le[6], l24 = le[7], l31 = le[8], l32 = le[9], l33 = le[10], l34 = le[11], l41 = le[12], l42 = le[13], l43 = le[14], l44 = le[15];
|
|
13406
|
-
// prettier-ignore
|
|
13407
|
-
var r11 = re[rOffset], r12 = re[rOffset + 1], r13 = re[rOffset + 2], r14 = re[rOffset + 3], r21 = re[rOffset + 4], r22 = re[rOffset + 5], r23 = re[rOffset + 6], r24 = re[rOffset + 7], r31 = re[rOffset + 8], r32 = re[rOffset + 9], r33 = re[rOffset + 10], r34 = re[rOffset + 11], r41 = re[rOffset + 12], r42 = re[rOffset + 13], r43 = re[rOffset + 14], r44 = re[rOffset + 15];
|
|
13408
|
-
oe[offset] = l11 * r11 + l21 * r12 + l31 * r13 + l41 * r14;
|
|
13409
|
-
oe[offset + 1] = l12 * r11 + l22 * r12 + l32 * r13 + l42 * r14;
|
|
13410
|
-
oe[offset + 2] = l13 * r11 + l23 * r12 + l33 * r13 + l43 * r14;
|
|
13411
|
-
oe[offset + 3] = l14 * r11 + l24 * r12 + l34 * r13 + l44 * r14;
|
|
13412
|
-
oe[offset + 4] = l11 * r21 + l21 * r22 + l31 * r23 + l41 * r24;
|
|
13413
|
-
oe[offset + 5] = l12 * r21 + l22 * r22 + l32 * r23 + l42 * r24;
|
|
13414
|
-
oe[offset + 6] = l13 * r21 + l23 * r22 + l33 * r23 + l43 * r24;
|
|
13415
|
-
oe[offset + 7] = l14 * r21 + l24 * r22 + l34 * r23 + l44 * r24;
|
|
13416
|
-
oe[offset + 8] = l11 * r31 + l21 * r32 + l31 * r33 + l41 * r34;
|
|
13417
|
-
oe[offset + 9] = l12 * r31 + l22 * r32 + l32 * r33 + l42 * r34;
|
|
13418
|
-
oe[offset + 10] = l13 * r31 + l23 * r32 + l33 * r33 + l43 * r34;
|
|
13419
|
-
oe[offset + 11] = l14 * r31 + l24 * r32 + l34 * r33 + l44 * r34;
|
|
13420
|
-
oe[offset + 12] = l11 * r41 + l21 * r42 + l31 * r43 + l41 * r44;
|
|
13421
|
-
oe[offset + 13] = l12 * r41 + l22 * r42 + l32 * r43 + l42 * r44;
|
|
13422
|
-
oe[offset + 14] = l13 * r41 + l23 * r42 + l33 * r43 + l43 * r44;
|
|
13423
|
-
oe[offset + 15] = l14 * r41 + l24 * r42 + l34 * r43 + l44 * r44;
|
|
13424
|
-
};
|
|
13425
|
-
/**
|
|
13426
|
-
* @internal
|
|
13427
|
-
* Simplify lodash get: https://github.com/lodash/lodash/blob/master/get.js.
|
|
13428
|
-
* @param target - The object to query.
|
|
13429
|
-
* @param path - The path of the property to get.
|
|
13430
|
-
* @returns Returns the resolved value.
|
|
13431
|
-
*/ Utils._reflectGet = function _reflectGet(target, path) {
|
|
13432
|
-
var pathArr = this._stringToPath(path);
|
|
13433
|
-
var object = target;
|
|
13434
|
-
var index = 0;
|
|
13435
|
-
var length = pathArr.length;
|
|
13436
|
-
while(object != null && index < length){
|
|
13437
|
-
object = object[pathArr[index++]];
|
|
13438
|
-
}
|
|
13439
|
-
return index && index == length ? object : undefined;
|
|
13440
|
-
};
|
|
13441
|
-
Utils._stringToPath = function _stringToPath(string) {
|
|
13442
|
-
var result = [];
|
|
13443
|
-
if (string.charCodeAt(0) === charCodeOfDot) {
|
|
13444
|
-
result.push("");
|
|
13445
|
-
}
|
|
13446
|
-
string.replace(rePropName, function(match, expression, quote, subString) {
|
|
13447
|
-
var key = match;
|
|
13448
|
-
if (quote) {
|
|
13449
|
-
key = subString.replace(reEscapeChar, "$1");
|
|
13450
|
-
} else if (expression) {
|
|
13451
|
-
key = expression.trim();
|
|
13452
|
-
}
|
|
13453
|
-
result.push(key);
|
|
13454
|
-
});
|
|
13455
|
-
return result;
|
|
13456
|
-
};
|
|
13457
|
-
return Utils;
|
|
13458
|
-
}();
|
|
13459
|
-
var charCodeOfDot = ".".charCodeAt(0);
|
|
13460
|
-
var reEscapeChar = /\\(\\)?/g;
|
|
13461
|
-
var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
13462
|
-
"[^.[\\]]+" + "|" + // Or match property names within brackets.
|
|
13463
|
-
"\\[(?:" + // Match a non-string expression.
|
|
13464
|
-
"([^\"'][^[]*)" + "|" + // Or match strings (supports escaping characters).
|
|
13465
|
-
"([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2" + ")\\]" + "|" + // Or match "" as the space between consecutive dots or empty brackets.
|
|
13466
|
-
"(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))", "g");
|
|
13467
|
-
|
|
13468
13661
|
/**
|
|
13469
13662
|
* SkinnedMeshRenderer.
|
|
13470
13663
|
*/ var SkinnedMeshRenderer = /*#__PURE__*/ function(MeshRenderer) {
|
|
@@ -13483,7 +13676,7 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13483
13676
|
// 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.
|
|
13484
13677
|
maxVertexUniformVectors = Math.min(maxVertexUniformVectors, 256);
|
|
13485
13678
|
_this._maxVertexUniformVectors = maxVertexUniformVectors;
|
|
13486
|
-
_this._onLocalBoundsChanged = _this._onLocalBoundsChanged.bind(
|
|
13679
|
+
_this._onLocalBoundsChanged = _this._onLocalBoundsChanged.bind(_assert_this_initialized(_this));
|
|
13487
13680
|
var localBounds = _this._localBounds;
|
|
13488
13681
|
// @ts-ignore
|
|
13489
13682
|
localBounds.min._onValueChanged = _this._onLocalBoundsChanged;
|
|
@@ -13545,8 +13738,8 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13545
13738
|
this._jointTexture = new Texture2D(engine, 4, jointCount, TextureFormat.R32G32B32A32, false);
|
|
13546
13739
|
this._jointTexture.filterMode = TextureFilterMode.Point;
|
|
13547
13740
|
}
|
|
13548
|
-
shaderData.disableMacro("
|
|
13549
|
-
shaderData.enableMacro("
|
|
13741
|
+
shaderData.disableMacro("RENDERER_JOINTS_NUM");
|
|
13742
|
+
shaderData.enableMacro("RENDERER_USE_JOINT_TEXTURE");
|
|
13550
13743
|
shaderData.setTexture(SkinnedMeshRenderer._jointSamplerProperty, this._jointTexture);
|
|
13551
13744
|
} else {
|
|
13552
13745
|
Logger.error("component's joints count(" + jointCount + ") greater than device's MAX_VERTEX_UNIFORM_VECTORS number " + this._maxVertexUniformVectors + ", and don't support jointTexture in this device. suggest joint count less than " + remainUniformJointCount + ".", this);
|
|
@@ -13554,8 +13747,8 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13554
13747
|
} else {
|
|
13555
13748
|
var _this__jointTexture1;
|
|
13556
13749
|
(_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
|
|
13557
|
-
shaderData.disableMacro("
|
|
13558
|
-
shaderData.enableMacro("
|
|
13750
|
+
shaderData.disableMacro("RENDERER_USE_JOINT_TEXTURE");
|
|
13751
|
+
shaderData.enableMacro("RENDERER_JOINTS_NUM", remainUniformJointCount.toString());
|
|
13559
13752
|
shaderData.setFloatArray(SkinnedMeshRenderer._jointMatrixProperty, this._jointMatrices);
|
|
13560
13753
|
}
|
|
13561
13754
|
jointDataCreateCache.set(jointCount, bsUniformOccupiesCount);
|
|
@@ -13594,7 +13787,7 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13594
13787
|
if (!rhi) return;
|
|
13595
13788
|
var _this = this, skin = _this._skin, shaderData = _this.shaderData;
|
|
13596
13789
|
if (!skin) {
|
|
13597
|
-
shaderData.disableMacro("
|
|
13790
|
+
shaderData.disableMacro("RENDERER_HAS_SKIN");
|
|
13598
13791
|
return;
|
|
13599
13792
|
}
|
|
13600
13793
|
var joints = skin.joints;
|
|
@@ -13626,10 +13819,10 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13626
13819
|
}
|
|
13627
13820
|
this._rootBone = rootBone;
|
|
13628
13821
|
if (jointCount) {
|
|
13629
|
-
shaderData.enableMacro("
|
|
13822
|
+
shaderData.enableMacro("RENDERER_HAS_SKIN");
|
|
13630
13823
|
shaderData.setInt(SkinnedMeshRenderer._jointCountProperty, jointCount);
|
|
13631
13824
|
} else {
|
|
13632
|
-
shaderData.disableMacro("
|
|
13825
|
+
shaderData.disableMacro("RENDERER_HAS_SKIN");
|
|
13633
13826
|
}
|
|
13634
13827
|
};
|
|
13635
13828
|
_proto._computeApproximateBindMatrix = function _computeApproximateBindMatrix(jointEntities, inverseBindMatrices, rootEntity, approximateBindMatrix) {
|
|
@@ -13681,7 +13874,7 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13681
13874
|
_proto._onLocalBoundsChanged = function _onLocalBoundsChanged() {
|
|
13682
13875
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
13683
13876
|
};
|
|
13684
|
-
|
|
13877
|
+
_create_class(SkinnedMeshRenderer, [
|
|
13685
13878
|
{
|
|
13686
13879
|
key: "blendShapeWeights",
|
|
13687
13880
|
get: /**
|
|
@@ -13746,9 +13939,15 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13746
13939
|
]);
|
|
13747
13940
|
return SkinnedMeshRenderer;
|
|
13748
13941
|
}(MeshRenderer);
|
|
13749
|
-
|
|
13750
|
-
SkinnedMeshRenderer.
|
|
13751
|
-
|
|
13942
|
+
(function() {
|
|
13943
|
+
SkinnedMeshRenderer._jointCountProperty = ShaderProperty.getByName("renderer_JointCount");
|
|
13944
|
+
})();
|
|
13945
|
+
(function() {
|
|
13946
|
+
SkinnedMeshRenderer._jointSamplerProperty = ShaderProperty.getByName("renderer_JointSampler");
|
|
13947
|
+
})();
|
|
13948
|
+
(function() {
|
|
13949
|
+
SkinnedMeshRenderer._jointMatrixProperty = ShaderProperty.getByName("renderer_JointMatrix");
|
|
13950
|
+
})();
|
|
13752
13951
|
__decorate([
|
|
13753
13952
|
ignoreClone
|
|
13754
13953
|
], SkinnedMeshRenderer.prototype, "_hasInitSkin", void 0);
|
|
@@ -14749,7 +14948,7 @@ var PrimitiveType;
|
|
|
14749
14948
|
}
|
|
14750
14949
|
this._setIndexBufferBinding(binding);
|
|
14751
14950
|
};
|
|
14752
|
-
|
|
14951
|
+
_create_class(BufferMesh, [
|
|
14753
14952
|
{
|
|
14754
14953
|
key: "instanceCount",
|
|
14755
14954
|
get: /**
|
|
@@ -14816,7 +15015,7 @@ var PrimitiveType;
|
|
|
14816
15015
|
this._deltaNormals = null;
|
|
14817
15016
|
this._deltaTangents = null;
|
|
14818
15017
|
};
|
|
14819
|
-
|
|
15018
|
+
_create_class(BlendShapeFrame, [
|
|
14820
15019
|
{
|
|
14821
15020
|
key: "deltaPositions",
|
|
14822
15021
|
get: /**
|
|
@@ -14934,7 +15133,7 @@ var BlendShapeFrameDirty;
|
|
|
14934
15133
|
this._updateUseNormalAndTangent(!!frame.deltaNormals, !!frame.deltaTangents);
|
|
14935
15134
|
this._dataChangeManager.dispatch();
|
|
14936
15135
|
};
|
|
14937
|
-
|
|
15136
|
+
_create_class(BlendShape, [
|
|
14938
15137
|
{
|
|
14939
15138
|
key: "frames",
|
|
14940
15139
|
get: /**
|
|
@@ -15103,9 +15302,15 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
|
|
|
15103
15302
|
};
|
|
15104
15303
|
return Basic2DBatcher;
|
|
15105
15304
|
}();
|
|
15106
|
-
|
|
15107
|
-
|
|
15108
|
-
|
|
15305
|
+
(function() {
|
|
15306
|
+
Basic2DBatcher._disableBatchTag = ShaderTagKey.getByName("spriteDisableBatching");
|
|
15307
|
+
})();
|
|
15308
|
+
(function() {
|
|
15309
|
+
/** The maximum number of vertex. */ Basic2DBatcher.MAX_VERTEX_COUNT = 4096;
|
|
15310
|
+
})();
|
|
15311
|
+
(function() {
|
|
15312
|
+
Basic2DBatcher._canUploadSameBuffer = true;
|
|
15313
|
+
})();
|
|
15109
15314
|
|
|
15110
15315
|
var SpriteMaskBatcher = /*#__PURE__*/ function(Basic2DBatcher) {
|
|
15111
15316
|
_inherits(SpriteMaskBatcher, Basic2DBatcher);
|
|
@@ -15332,6 +15537,7 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
15332
15537
|
return;
|
|
15333
15538
|
}
|
|
15334
15539
|
var _context_camera = context.camera, engine = _context_camera.engine, aspectRatio = _context_camera.aspectRatio, fieldOfView = _context_camera.fieldOfView, viewMatrix = _context_camera.viewMatrix, cameraShaderData = _context_camera.shaderData;
|
|
15540
|
+
var sceneData = context.camera.scene.shaderData;
|
|
15335
15541
|
var viewProjMatrix = Sky._viewProjMatrix, projectionMatrix = Sky._projectionMatrix;
|
|
15336
15542
|
var rhi = engine._hardwareRenderer;
|
|
15337
15543
|
var materialShaderData = material.shaderData, shader = material.shader, renderState = material.renderState;
|
|
@@ -15352,6 +15558,7 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
15352
15558
|
var program = shader.subShaders[0].passes[0]._getShaderProgram(engine, compileMacros);
|
|
15353
15559
|
program.bind();
|
|
15354
15560
|
program.groupingOtherUniformBlock();
|
|
15561
|
+
program.uploadAll(program.sceneUniformBlock, sceneData);
|
|
15355
15562
|
program.uploadAll(program.cameraUniformBlock, cameraShaderData);
|
|
15356
15563
|
program.uploadAll(program.materialUniformBlock, materialShaderData);
|
|
15357
15564
|
program.uploadUnGroupTextures();
|
|
@@ -15361,9 +15568,15 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
15361
15568
|
};
|
|
15362
15569
|
return Sky;
|
|
15363
15570
|
}();
|
|
15364
|
-
|
|
15365
|
-
Sky.
|
|
15366
|
-
|
|
15571
|
+
(function() {
|
|
15572
|
+
Sky._epsilon = 1e-6;
|
|
15573
|
+
})();
|
|
15574
|
+
(function() {
|
|
15575
|
+
Sky._viewProjMatrix = new Matrix();
|
|
15576
|
+
})();
|
|
15577
|
+
(function() {
|
|
15578
|
+
Sky._projectionMatrix = new Matrix(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, Sky._epsilon - 1, -1, 0, 0, 0, 0);
|
|
15579
|
+
})();
|
|
15367
15580
|
|
|
15368
15581
|
/**
|
|
15369
15582
|
* Background of scene.
|
|
@@ -15451,7 +15664,7 @@ Sky._projectionMatrix = new Matrix(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, Sky._epsilon -
|
|
|
15451
15664
|
mesh.addSubMesh(0, indices.length);
|
|
15452
15665
|
return mesh;
|
|
15453
15666
|
};
|
|
15454
|
-
|
|
15667
|
+
_create_class(Background, [
|
|
15455
15668
|
{
|
|
15456
15669
|
key: "texture",
|
|
15457
15670
|
get: /**
|
|
@@ -15463,7 +15676,7 @@ Sky._projectionMatrix = new Matrix(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, Sky._epsilon -
|
|
|
15463
15676
|
set: function set(value) {
|
|
15464
15677
|
if (this._texture !== value) {
|
|
15465
15678
|
this._texture = value;
|
|
15466
|
-
this._engine._backgroundTextureMaterial.shaderData.setTexture("
|
|
15679
|
+
this._engine._backgroundTextureMaterial.shaderData.setTexture("material_BaseTexture", value);
|
|
15467
15680
|
}
|
|
15468
15681
|
}
|
|
15469
15682
|
},
|
|
@@ -15619,7 +15832,7 @@ Sky._projectionMatrix = new Matrix(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, Sky._epsilon -
|
|
|
15619
15832
|
out[25] = src[25] * 0.429042;
|
|
15620
15833
|
out[26] = src[26] * 0.429042;
|
|
15621
15834
|
};
|
|
15622
|
-
|
|
15835
|
+
_create_class(AmbientLight, [
|
|
15623
15836
|
{
|
|
15624
15837
|
key: "specularTextureDecodeRGBM",
|
|
15625
15838
|
get: /**
|
|
@@ -15730,15 +15943,33 @@ Sky._projectionMatrix = new Matrix(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, Sky._epsilon -
|
|
|
15730
15943
|
]);
|
|
15731
15944
|
return AmbientLight;
|
|
15732
15945
|
}();
|
|
15733
|
-
|
|
15734
|
-
AmbientLight.
|
|
15735
|
-
|
|
15736
|
-
|
|
15737
|
-
AmbientLight.
|
|
15738
|
-
|
|
15739
|
-
|
|
15740
|
-
AmbientLight.
|
|
15741
|
-
|
|
15946
|
+
(function() {
|
|
15947
|
+
AmbientLight._shMacro = ShaderMacro.getByName("SCENE_USE_SH");
|
|
15948
|
+
})();
|
|
15949
|
+
(function() {
|
|
15950
|
+
AmbientLight._specularMacro = ShaderMacro.getByName("SCENE_USE_SPECULAR_ENV");
|
|
15951
|
+
})();
|
|
15952
|
+
(function() {
|
|
15953
|
+
AmbientLight._decodeRGBMMacro = ShaderMacro.getByName("SCENE_IS_DECODE_ENV_RGBM");
|
|
15954
|
+
})();
|
|
15955
|
+
(function() {
|
|
15956
|
+
AmbientLight._diffuseColorProperty = ShaderProperty.getByName("scene_EnvMapLight.diffuse");
|
|
15957
|
+
})();
|
|
15958
|
+
(function() {
|
|
15959
|
+
AmbientLight._diffuseSHProperty = ShaderProperty.getByName("scene_EnvSH");
|
|
15960
|
+
})();
|
|
15961
|
+
(function() {
|
|
15962
|
+
AmbientLight._diffuseIntensityProperty = ShaderProperty.getByName("scene_EnvMapLight.diffuseIntensity");
|
|
15963
|
+
})();
|
|
15964
|
+
(function() {
|
|
15965
|
+
AmbientLight._specularTextureProperty = ShaderProperty.getByName("scene_EnvSpecularSampler");
|
|
15966
|
+
})();
|
|
15967
|
+
(function() {
|
|
15968
|
+
AmbientLight._specularIntensityProperty = ShaderProperty.getByName("scene_EnvMapLight.specularIntensity");
|
|
15969
|
+
})();
|
|
15970
|
+
(function() {
|
|
15971
|
+
AmbientLight._mipLevelProperty = ShaderProperty.getByName("scene_EnvMapLight.mipMapLevel");
|
|
15972
|
+
})();
|
|
15742
15973
|
|
|
15743
15974
|
/**
|
|
15744
15975
|
* Scene.
|
|
@@ -15769,9 +16000,9 @@ AmbientLight._mipLevelProperty = ShaderProperty.getByName("u_envMapLight.mipMapL
|
|
|
15769
16000
|
var shaderData = _this.shaderData;
|
|
15770
16001
|
shaderData._addReferCount(1);
|
|
15771
16002
|
_this.ambientLight = new AmbientLight();
|
|
15772
|
-
engine.sceneManager._allScenes.push(
|
|
15773
|
-
shaderData.enableMacro("
|
|
15774
|
-
shaderData.enableMacro("
|
|
16003
|
+
engine.sceneManager._allScenes.push(_assert_this_initialized(_this));
|
|
16004
|
+
shaderData.enableMacro("SCENE_FOG_MODE", _this._fogMode.toString());
|
|
16005
|
+
shaderData.enableMacro("SCENE_SHADOW_CASCADED_COUNT", _this.shadowCascades.toString());
|
|
15775
16006
|
shaderData.setColor(Scene._fogColorProperty, _this._fogColor);
|
|
15776
16007
|
shaderData.setVector4(Scene._fogParamsProperty, _this._fogParams);
|
|
15777
16008
|
_this._computeLinearFogParams(_this._fogStart, _this._fogEnd);
|
|
@@ -15920,12 +16151,15 @@ AmbientLight._mipLevelProperty = ShaderProperty.getByName("u_envMapLight.mipMapL
|
|
|
15920
16151
|
lightManager._updateShaderData(this.shaderData);
|
|
15921
16152
|
var sunLightIndex = lightManager._getSunLightIndex();
|
|
15922
16153
|
if (sunLightIndex !== -1) {
|
|
15923
|
-
|
|
16154
|
+
var sunlight = lightManager._directLights.get(sunLightIndex);
|
|
16155
|
+
shaderData.setColor(Scene._sunlightColorProperty, sunlight.color);
|
|
16156
|
+
shaderData.setVector3(Scene._sunlightDirectionProperty, sunlight.direction);
|
|
16157
|
+
this._sunLight = sunlight;
|
|
15924
16158
|
}
|
|
15925
16159
|
if (this.castShadows && this._sunLight && this._sunLight.shadowType !== ShadowType.None) {
|
|
15926
|
-
shaderData.enableMacro("
|
|
16160
|
+
shaderData.enableMacro("SCENE_SHADOW_TYPE", this._sunLight.shadowType.toString());
|
|
15927
16161
|
} else {
|
|
15928
|
-
shaderData.disableMacro("
|
|
16162
|
+
shaderData.disableMacro("SCENE_SHADOW_TYPE");
|
|
15929
16163
|
}
|
|
15930
16164
|
// union scene and camera macro.
|
|
15931
16165
|
ShaderMacroCollection.unionCollection(this.engine._macroCollection, shaderData._macroCollection, this._globalShaderMacro);
|
|
@@ -15978,7 +16212,7 @@ AmbientLight._mipLevelProperty = ShaderProperty.getByName("u_envMapLight.mipMapL
|
|
|
15978
16212
|
this._fogParams.z = density / Math.LN2;
|
|
15979
16213
|
this._fogParams.w = density / Math.sqrt(Math.LN2);
|
|
15980
16214
|
};
|
|
15981
|
-
|
|
16215
|
+
_create_class(Scene, [
|
|
15982
16216
|
{
|
|
15983
16217
|
key: "shadowCascades",
|
|
15984
16218
|
get: /**
|
|
@@ -15988,7 +16222,7 @@ AmbientLight._mipLevelProperty = ShaderProperty.getByName("u_envMapLight.mipMapL
|
|
|
15988
16222
|
},
|
|
15989
16223
|
set: function set(value) {
|
|
15990
16224
|
if (this._shadowCascades !== value) {
|
|
15991
|
-
this.shaderData.enableMacro("
|
|
16225
|
+
this.shaderData.enableMacro("SCENE_SHADOW_CASCADED_COUNT", value.toString());
|
|
15992
16226
|
this._shadowCascades = value;
|
|
15993
16227
|
}
|
|
15994
16228
|
}
|
|
@@ -16027,7 +16261,7 @@ AmbientLight._mipLevelProperty = ShaderProperty.getByName("u_envMapLight.mipMapL
|
|
|
16027
16261
|
},
|
|
16028
16262
|
set: function set(value) {
|
|
16029
16263
|
if (this._fogMode !== value) {
|
|
16030
|
-
this.shaderData.enableMacro("
|
|
16264
|
+
this.shaderData.enableMacro("SCENE_FOG_MODE", value.toString());
|
|
16031
16265
|
this._fogMode = value;
|
|
16032
16266
|
}
|
|
16033
16267
|
}
|
|
@@ -16106,8 +16340,18 @@ AmbientLight._mipLevelProperty = ShaderProperty.getByName("u_envMapLight.mipMapL
|
|
|
16106
16340
|
]);
|
|
16107
16341
|
return Scene;
|
|
16108
16342
|
}(EngineObject);
|
|
16109
|
-
|
|
16110
|
-
Scene.
|
|
16343
|
+
(function() {
|
|
16344
|
+
Scene._fogColorProperty = ShaderProperty.getByName("scene_FogColor");
|
|
16345
|
+
})();
|
|
16346
|
+
(function() {
|
|
16347
|
+
Scene._fogParamsProperty = ShaderProperty.getByName("scene_FogParams");
|
|
16348
|
+
})();
|
|
16349
|
+
(function() {
|
|
16350
|
+
Scene._sunlightColorProperty = ShaderProperty.getByName("scene_SunlightColor");
|
|
16351
|
+
})();
|
|
16352
|
+
(function() {
|
|
16353
|
+
Scene._sunlightDirectionProperty = ShaderProperty.getByName("scene_SunlightDirection");
|
|
16354
|
+
})();
|
|
16111
16355
|
|
|
16112
16356
|
/**
|
|
16113
16357
|
* Scene manager.
|
|
@@ -16155,7 +16399,7 @@ Scene._fogParamsProperty = ShaderProperty.getByName("galacean_FogParams");
|
|
|
16155
16399
|
}
|
|
16156
16400
|
allScenes.length = 0;
|
|
16157
16401
|
};
|
|
16158
|
-
|
|
16402
|
+
_create_class(SceneManager, [
|
|
16159
16403
|
{
|
|
16160
16404
|
key: "activeScene",
|
|
16161
16405
|
get: /**
|
|
@@ -16176,41 +16420,45 @@ Scene._fogParamsProperty = ShaderProperty.getByName("galacean_FogParams");
|
|
|
16176
16420
|
return SceneManager;
|
|
16177
16421
|
}();
|
|
16178
16422
|
|
|
16179
|
-
var backgroundTextureFs = "#define GLSLIFY 1\nuniform sampler2D
|
|
16423
|
+
var backgroundTextureFs = "#define GLSLIFY 1\nuniform sampler2D material_BaseTexture;varying vec2 v_uv;void main(){gl_FragColor=texture2D(material_BaseTexture,v_uv);}"; // eslint-disable-line
|
|
16180
16424
|
|
|
16181
16425
|
var backgroundTextureVs = "#define GLSLIFY 1\nattribute vec3 POSITION;attribute vec2 TEXCOORD_0;varying vec2 v_uv;void main(){gl_Position=vec4(POSITION,1.0);v_uv=TEXCOORD_0;}"; // eslint-disable-line
|
|
16182
16426
|
|
|
16183
|
-
var blinnPhongFs = "#define GLSLIFY 1\n#include <common>\n#include <camera_declare>\n#include <uv_share>\n#include <normal_share>\n#include <color_share>\n#include <worldpos_share>\n#include <light_frag_define>\n#include <ShadowFragmentDeclaration>\n#include <mobile_material_frag>\n#include <
|
|
16427
|
+
var blinnPhongFs = "#define GLSLIFY 1\n#include <common>\n#include <camera_declare>\n#include <uv_share>\n#include <normal_share>\n#include <color_share>\n#include <worldpos_share>\n#include <light_frag_define>\n#include <ShadowFragmentDeclaration>\n#include <mobile_material_frag>\n#include <FogFragmentDeclaration>\n#include <normal_get>\nvoid main(){\n#include <begin_mobile_frag>\n#include <begin_viewdir_frag>\n#include <mobile_blinnphong_frag>\ngl_FragColor=emission+ambient+diffuse+specular;\n#ifdef MATERIAL_IS_TRANSPARENT\ngl_FragColor.a=diffuse.a;\n#else\ngl_FragColor.a=1.0;\n#endif\n#include <FogFragment>\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ngl_FragColor=linearToGamma(gl_FragColor);\n#endif\n}"; // eslint-disable-line
|
|
16184
16428
|
|
|
16185
16429
|
var blinnPhongVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\n#include <blendShape_input>\n#include <uv_share>\n#include <color_share>\n#include <normal_share>\n#include <worldpos_share>\n#include <ShadowVertexDeclaration>\n#include <FogVertexDeclaration>\nvoid main(){\n#include <begin_position_vert>\n#include <begin_normal_vert>\n#include <blendShape_vert>\n#include <skinning_vert>\n#include <uv_vert>\n#include <color_vert>\n#include <normal_vert>\n#include <worldpos_vert>\n#include <position_vert>\n#include <ShadowVertex>\n#include <FogVertex>\n}"; // eslint-disable-line
|
|
16186
16430
|
|
|
16187
16431
|
var particleFs = "#define GLSLIFY 1\nvarying vec4 v_color;varying float v_lifeLeft;varying vec2 v_uv;uniform sampler2D u_texture;void main(){if(v_lifeLeft==1.0){discard;}float alphaFactor=1.0;\n#ifdef fadeIn\nfloat fadeInFactor=step(0.5,v_lifeLeft);alphaFactor=2.0*fadeInFactor*(1.0-v_lifeLeft)+(1.0-fadeInFactor);\n#endif\n#ifdef fadeOut\nfloat fadeOutFactor=step(0.5,v_lifeLeft);alphaFactor=alphaFactor*2.0*(1.0-fadeOutFactor)*v_lifeLeft+alphaFactor*fadeOutFactor;\n#endif\n#ifdef particleTexture\nvec4 tex=texture2D(u_texture,v_uv);\n#ifdef useOriginColor\ngl_FragColor=vec4(tex.rgb,alphaFactor*tex.a*v_color.w);\n#else\ngl_FragColor=vec4(v_color.xyz*tex.rgb,alphaFactor*tex.a*v_color.w);\n#endif\n#else\ngl_FragColor=vec4(v_color.xyz,alphaFactor*v_color.w);\n#endif\n}"; // eslint-disable-line
|
|
16188
16432
|
|
|
16189
|
-
var particleVs = "#define GLSLIFY 1\nattribute vec3 a_position;attribute vec3 a_velocity;attribute vec3 a_acceleration;attribute vec4 a_color;attribute vec4 a_lifeAndSize;attribute vec2 a_rotation;attribute vec3 a_uv;attribute vec2 a_normalizedUv;uniform float u_time;uniform bool u_once;uniform mat4
|
|
16433
|
+
var particleVs = "#define GLSLIFY 1\nattribute vec3 a_position;attribute vec3 a_velocity;attribute vec3 a_acceleration;attribute vec4 a_color;attribute vec4 a_lifeAndSize;attribute vec2 a_rotation;attribute vec3 a_uv;attribute vec2 a_normalizedUv;uniform float u_time;uniform bool u_once;uniform mat4 renderer_MVPMat;varying vec4 v_color;varying float v_lifeLeft;varying vec2 v_uv;\n#ifdef is2d\nuniform mat4 camera_ViewInvMat;uniform mat4 camera_ProjMat;uniform mat4 camera_ViewMat;uniform mat4 renderer_ModelMat;\n#endif\nmat2 rotation2d(float angle){float s=sin(angle);float c=cos(angle);return mat2(c,-s,s,c);}void main(){v_color=a_color;v_uv=a_uv.xy;float life=a_lifeAndSize.y;float startTime=a_lifeAndSize.x;float deltaTime=max(mod(u_time-startTime,life),0.0);if((u_once&&u_time>life+startTime)){deltaTime=0.0;}v_lifeLeft=1.0-deltaTime/life;float scale=a_lifeAndSize.z;vec3 position=a_position+(a_velocity+a_acceleration*deltaTime*0.5)*deltaTime;\n#ifdef isScaleByLifetime\nscale*=v_lifeLeft;\n#else\nscale*=pow(a_lifeAndSize.w,deltaTime);\n#endif\n#ifdef rotateToVelocity\nvec3 v=a_velocity+a_acceleration*deltaTime;float angle=atan(v.z,v.x)*2.0;\n#else\nfloat deltaAngle=deltaTime*a_rotation.y;float angle=a_rotation.x+deltaAngle;\n#endif\n#ifdef is2d\nvec2 rotatedPoint=rotation2d(angle)*vec2(a_normalizedUv.x,a_normalizedUv.y*a_uv.z);vec3 basisX=camera_ViewInvMat[0].xyz;vec3 basisZ=camera_ViewInvMat[1].xyz;vec3 localPosition=vec3(basisX*rotatedPoint.x+basisZ*rotatedPoint.y)*scale+position;gl_Position=camera_ProjMat*camera_ViewMat*vec4(localPosition+renderer_ModelMat[3].xyz,1.);\n#else\n#ifdef rotateToVelocity\nfloat s=sin(angle);float c=cos(angle);\n#else\nfloat s=sin(angle);float c=cos(angle);\n#endif\nvec4 rotatedPoint=vec4((a_normalizedUv.x*c+a_normalizedUv.y*a_uv.z*s)*scale,0.,(a_normalizedUv.x*s-a_normalizedUv.y*a_uv.z*c)*scale,1.);vec4 orientation=vec4(0,0,0,1);vec4 q2=orientation+orientation;vec4 qx=orientation.xxxw*q2.xyzx;vec4 qy=orientation.xyyw*q2.xyzy;vec4 qz=orientation.xxzw*q2.xxzz;mat4 localMatrix=mat4((1.0-qy.y)-qz.z,qx.y+qz.w,qx.z-qy.w,0,qx.y-qz.w,(1.0-qx.x)-qz.z,qy.z+qx.w,0,qx.z+qy.w,qy.z-qx.w,(1.0-qx.x)-qy.y,0,position.x,position.y,position.z,1);rotatedPoint=localMatrix*rotatedPoint;gl_Position=renderer_MVPMat*rotatedPoint;\n#endif\n}"; // eslint-disable-line
|
|
16190
16434
|
|
|
16191
|
-
var pbrSpecularFs = "#define GLSLIFY 1\n#include <common>\n#include <camera_declare>\n#include <FogFragmentDeclaration>\n#include <uv_share>\n#include <normal_share>\n#include <color_share>\n#include <worldpos_share>\n#include <light_frag_define>\n#include <pbr_frag_define>\n#include <pbr_helper>\nvoid main(){\n#include <pbr_frag>\n#include <FogFragment>\n#ifndef
|
|
16435
|
+
var pbrSpecularFs = "#define GLSLIFY 1\n#include <common>\n#include <camera_declare>\n#include <FogFragmentDeclaration>\n#include <uv_share>\n#include <normal_share>\n#include <color_share>\n#include <worldpos_share>\n#include <light_frag_define>\n#include <pbr_frag_define>\n#include <pbr_helper>\nvoid main(){\n#include <pbr_frag>\n#include <FogFragment>\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ngl_FragColor=linearToGamma(gl_FragColor);\n#endif\n}"; // eslint-disable-line
|
|
16192
16436
|
|
|
16193
|
-
var pbrFs = "#define GLSLIFY 1\n#define IS_METALLIC_WORKFLOW\n#include <common>\n#include <camera_declare>\n#include <
|
|
16437
|
+
var pbrFs = "#define GLSLIFY 1\n#define IS_METALLIC_WORKFLOW\n#include <common>\n#include <camera_declare>\n#include <FogFragmentDeclaration>\n#include <uv_share>\n#include <normal_share>\n#include <color_share>\n#include <worldpos_share>\n#include <light_frag_define>\n#include <pbr_frag_define>\n#include <pbr_helper>\nvoid main(){\n#include <pbr_frag>\n#include <FogFragment>\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ngl_FragColor=linearToGamma(gl_FragColor);\n#endif\n}"; // eslint-disable-line
|
|
16194
16438
|
|
|
16195
16439
|
var pbrVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\n#include <blendShape_input>\n#include <uv_share>\n#include <color_share>\n#include <normal_share>\n#include <worldpos_share>\n#include <ShadowVertexDeclaration>\n#include <FogVertexDeclaration>\nvoid main(){\n#include <begin_position_vert>\n#include <begin_normal_vert>\n#include <blendShape_vert>\n#include <skinning_vert>\n#include <uv_vert>\n#include <color_vert>\n#include <normal_vert>\n#include <worldpos_vert>\n#include <position_vert>\n#include <ShadowVertex>\n#include <FogVertex>\n}"; // eslint-disable-line
|
|
16196
16440
|
|
|
16197
|
-
var shadowMapFs = "#define GLSLIFY 1\n#ifdef
|
|
16441
|
+
var shadowMapFs = "#define GLSLIFY 1\n#ifdef ENGINE_NO_DEPTH_TEXTURE\nvec4 pack(float depth){const vec4 bitShift=vec4(1.0,256.0,256.0*256.0,256.0*256.0*256.0);const vec4 bitMask=vec4(1.0/256.0,1.0/256.0,1.0/256.0,0.0);vec4 rgbaDepth=fract(depth*bitShift);rgbaDepth-=rgbaDepth.gbaa*bitMask;return rgbaDepth;}\n#endif\nvoid main(){\n#ifdef ENGINE_NO_DEPTH_TEXTURE\ngl_FragColor=pack(gl_FragCoord.z);\n#else\ngl_FragColor=vec4(0.0,0.0,0.0,0.0);\n#endif\n}"; // eslint-disable-line
|
|
16198
16442
|
|
|
16199
|
-
var shadowMapVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\n#include <blendShape_input>\n#include <normal_share>\nuniform mat4
|
|
16443
|
+
var shadowMapVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\n#include <blendShape_input>\n#include <normal_share>\nuniform mat4 camera_VPMat;uniform vec2 scene_ShadowBias;uniform vec3 scene_LightDirection;vec3 applyShadowBias(vec3 positionWS){positionWS-=scene_LightDirection*scene_ShadowBias.x;return positionWS;}vec3 applyShadowNormalBias(vec3 positionWS,vec3 normalWS){float invNdotL=1.0-clamp(dot(-scene_LightDirection,normalWS),0.0,1.0);float scale=invNdotL*scene_ShadowBias.y;positionWS+=normalWS*vec3(scale);return positionWS;}void main(){\n#include <begin_position_vert>\n#include <begin_normal_vert>\n#include <blendShape_vert>\n#include <skinning_vert>\nvec4 positionWS=renderer_ModelMat*position;positionWS.xyz=applyShadowBias(positionWS.xyz);\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef RENDERER_HAS_NORMAL\nvec3 normalWS=normalize(mat3(renderer_NormalMat)*normal);positionWS.xyz=applyShadowNormalBias(positionWS.xyz,normalWS);\n#endif\n#endif\nvec4 positionCS=camera_VPMat*positionWS;positionCS.z=max(positionCS.z,-1.0);gl_Position=positionCS;}"; // eslint-disable-line
|
|
16200
16444
|
|
|
16201
|
-
var skyboxFs = "#define GLSLIFY 1\n#include <common>\nuniform samplerCube
|
|
16445
|
+
var skyboxFs = "#define GLSLIFY 1\n#include <common>\nuniform samplerCube material_CubeTexture;varying vec3 v_cubeUV;uniform float material_Exposure;uniform vec4 material_TintColor;void main(){vec4 textureColor=textureCube(material_CubeTexture,v_cubeUV);\n#ifdef MATERIAL_IS_DECODE_SKY_RGBM\ntextureColor=RGBMToLinear(textureColor,5.0);\n#elif !defined(ENGINE_IS_COLORSPACE_GAMMA)\ntextureColor=gammaToLinear(textureColor);\n#endif\ntextureColor.rgb*=material_Exposure*material_TintColor.rgb;gl_FragColor=textureColor;\n#if defined(MATERIAL_IS_DECODE_SKY_RGBM) || !defined(ENGINE_IS_COLORSPACE_GAMMA)\ngl_FragColor=linearToGamma(gl_FragColor);\n#endif\n}"; // eslint-disable-line
|
|
16202
16446
|
|
|
16203
|
-
var skyboxVs = "#define GLSLIFY 1\n#include <common_vert>\nuniform mat4
|
|
16447
|
+
var skyboxVs = "#define GLSLIFY 1\n#include <common_vert>\nuniform mat4 camera_VPMat;varying vec3 v_cubeUV;uniform float material_Rotation;vec4 rotateY(vec4 v,float angle){const float deg2rad=3.1415926/180.0;float radian=angle*deg2rad;float sina=sin(radian);float cosa=cos(radian);mat2 m=mat2(cosa,-sina,sina,cosa);return vec4(m*v.xz,v.yw).xzyw;}void main(){v_cubeUV=vec3(-POSITION.x,POSITION.yz);gl_Position=camera_VPMat*rotateY(vec4(POSITION,1.0),material_Rotation);}"; // eslint-disable-line
|
|
16204
16448
|
|
|
16205
|
-
var
|
|
16449
|
+
var skyProceduralFs = "#define GLSLIFY 1\n#include <common>\nconst float MIE_G=-0.990;const float MIE_G2=0.9801;const float SKY_GROUND_THRESHOLD=0.02;uniform float material_SunSize;uniform float material_SunSizeConvergence;uniform vec4 scene_SunlightColor;uniform vec3 scene_SunlightDirection;varying vec3 v_GroundColor;varying vec3 v_SkyColor;\n#ifdef MATERIAL_SUN_HIGH_QUALITY\nvarying vec3 v_Vertex;\n#elif defined(MATERIAL_SUN_SIMPLE)\nvarying vec3 v_RayDir;\n#else\nvarying float v_SkyGroundFactor;\n#endif\n#if defined(MATERIAL_SUN_HIGH_QUALITY)||defined(MATERIAL_SUN_SIMPLE)\nvarying vec3 v_SunColor;\n#endif\n#if defined(ENGINE_IS_COLORSPACE_GAMMA)\n#define LINEAR_2_OUTPUT(color) sqrt(color)\n#endif\nfloat getMiePhase(float eyeCos,float eyeCos2){float temp=1.0+MIE_G2-2.0*MIE_G*eyeCos;temp=pow(temp,pow(material_SunSize,0.65)*10.0);temp=max(temp,1.0e-4);temp=1.5*((1.0-MIE_G2)/(2.0+MIE_G2))*(1.0+eyeCos2)/temp;return temp;}float calcSunAttenuation(vec3 lightPos,vec3 ray){\n#ifdef MATERIAL_SUN_HIGH_QUALITY\nfloat focusedEyeCos=pow(clamp(dot(lightPos,ray),0.0,1.0),material_SunSizeConvergence);return getMiePhase(-focusedEyeCos,focusedEyeCos*focusedEyeCos);\n#else\nvec3 delta=lightPos-ray;float dist=length(delta);float spot=1.0-smoothstep(0.0,material_SunSize,dist);return spot*spot;\n#endif\n}void main(){vec3 col=vec3(0.0,0.0,0.0);\n#ifdef MATERIAL_SUN_HIGH_QUALITY\nvec3 ray=normalize(v_Vertex);float y=ray.y/SKY_GROUND_THRESHOLD;\n#elif defined(MATERIAL_SUN_SIMPLE)\nvec3 ray=v_RayDir;float y=ray.y/SKY_GROUND_THRESHOLD;\n#else\nfloat y=v_SkyGroundFactor;\n#endif\ncol=mix(v_SkyColor,v_GroundColor,clamp(y,0.0,1.0));\n#if defined(MATERIAL_SUN_HIGH_QUALITY)||defined(MATERIAL_SUN_SIMPLE)\nif(y<0.0)col+=v_SunColor*calcSunAttenuation(-scene_SunlightDirection,-ray);\n#endif\n#ifdef ENGINE_IS_COLORSPACE_GAMMA\ncol=LINEAR_2_OUTPUT(col);\n#endif\ngl_FragColor=vec4(col,1.0);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ngl_FragColor=linearToGamma(gl_FragColor);\n#endif\n}"; // eslint-disable-line
|
|
16206
16450
|
|
|
16207
|
-
var
|
|
16451
|
+
var skyProceduralVs = "#define GLSLIFY 1\n#define OUTER_RADIUS 1.025\n#define RAYLEIGH (mix(0.0, 0.0025, pow(material_AtmosphereThickness,2.5)))\n#define MIE 0.0010\n#define SUN_BRIGHTNESS 20.0\n#define MAX_SCATTER 50.0\nconst float SKY_GROUND_THRESHOLD=0.02;const float outerRadius=OUTER_RADIUS;const float outerRadius2=OUTER_RADIUS*OUTER_RADIUS;const float innerRadius=1.0;const float innerRadius2=1.0;const float cameraHeight=0.0001;const float HDSundiskIntensityFactor=15.0;const float simpleSundiskIntensityFactor=27.0;const float sunScale=400.0*SUN_BRIGHTNESS;const float kmESun=MIE*SUN_BRIGHTNESS;const float km4PI=MIE*4.0*3.14159265;const float scale=1.0/(OUTER_RADIUS-1.0);const float scaleDepth=0.25;const float scaleOverScaleDepth=(1.0/(OUTER_RADIUS-1.0))/0.25;const float samples=2.0;const vec3 c_DefaultScatteringWavelength=vec3(0.65,0.57,0.475);const vec3 c_VariableRangeForScatteringWavelength=vec3(0.15,0.15,0.15);attribute vec4 POSITION;uniform mat4 camera_VPMat;uniform vec3 material_SkyTint;uniform vec3 material_GroundTint;uniform float material_Exposure;uniform float material_AtmosphereThickness;uniform vec4 scene_SunlightColor;uniform vec3 scene_SunlightDirection;varying vec3 v_GroundColor;varying vec3 v_SkyColor;\n#ifdef MATERIAL_SUN_HIGH_QUALITY\nvarying vec3 v_Vertex;\n#elif defined(MATERIAL_SUN_SIMPLE)\nvarying vec3 v_RayDir;\n#else\nvarying float v_SkyGroundFactor;\n#endif\n#if defined(MATERIAL_SUN_HIGH_QUALITY)||defined(MATERIAL_SUN_SIMPLE)\nvarying vec3 v_SunColor;\n#endif\n#if defined(ENGINE_IS_COLORSPACE_GAMMA)\n#define COLOR_2_GAMMA(color) color\n#define COLOR_2_LINEAR(color) color*color\n#else\n#define GAMMA 2.2\n#define COLOR_2_GAMMA(color) pow(color,vec3(1.0/GAMMA))\n#define COLOR_2_LINEAR(color) color\n#endif\nfloat getRayleighPhase(vec3 light,vec3 ray){float eyeCos=dot(light,ray);return 0.75+0.75*eyeCos*eyeCos;}float scaleAngle(float inCos){float x=1.0-inCos;return 0.25*exp(-0.00287+x*(0.459+x*(3.83+x*(-6.80+x*5.25))));}void main(){gl_Position=camera_VPMat*vec4(POSITION.xyz,1.0);vec3 skyTintInGammaSpace=COLOR_2_GAMMA(material_SkyTint);vec3 scatteringWavelength=mix(c_DefaultScatteringWavelength-c_VariableRangeForScatteringWavelength,c_DefaultScatteringWavelength+c_VariableRangeForScatteringWavelength,vec3(1.0)-skyTintInGammaSpace);vec3 invWavelength=1.0/pow(scatteringWavelength,vec3(4.0));float krESun=RAYLEIGH*SUN_BRIGHTNESS;float kr4PI=RAYLEIGH*4.0*3.14159265;vec3 cameraPos=vec3(0.0,innerRadius+cameraHeight,0.0);vec3 eyeRay=normalize(POSITION.xyz);float far=0.0;vec3 cIn,cOut;if(eyeRay.y>=0.0){far=sqrt(outerRadius2+innerRadius2*eyeRay.y*eyeRay.y-innerRadius2)-innerRadius*eyeRay.y;float height=innerRadius+cameraHeight;float depth=exp(scaleOverScaleDepth*-cameraHeight);float startAngle=dot(eyeRay,cameraPos)/height;float startOffset=depth*scaleAngle(startAngle);float sampleLength=far/samples;float scaledLength=sampleLength*scale;vec3 sampleRay=eyeRay*sampleLength;vec3 samplePoint=cameraPos+sampleRay*0.5;vec3 frontColor=vec3(0.0);{float height=length(samplePoint);float depth=exp(scaleOverScaleDepth*(innerRadius-height));float lightAngle=dot(-scene_SunlightDirection,samplePoint)/height;float cameraAngle=dot(eyeRay,samplePoint)/height;float scatter=(startOffset+depth*(scaleAngle(lightAngle)-scaleAngle(cameraAngle)));vec3 attenuate=exp(-clamp(scatter,0.0,MAX_SCATTER)*(invWavelength*kr4PI+km4PI));frontColor+=attenuate*(depth*scaledLength);samplePoint+=sampleRay;}{float height=length(samplePoint);float depth=exp(scaleOverScaleDepth*(innerRadius-height));float lightAngle=dot(-scene_SunlightDirection,samplePoint)/height;float cameraAngle=dot(eyeRay,samplePoint)/height;float scatter=(startOffset+depth*(scaleAngle(lightAngle)-scaleAngle(cameraAngle)));vec3 attenuate=exp(-clamp(scatter,0.0,MAX_SCATTER)*(invWavelength*kr4PI+km4PI));frontColor+=attenuate*(depth*scaledLength);samplePoint+=sampleRay;}cIn=frontColor*(invWavelength*krESun);cOut=frontColor*kmESun;}else{far=(-cameraHeight)/(min(-0.001,eyeRay.y));vec3 pos=cameraPos+far*eyeRay;float depth=exp((-cameraHeight)*(1.0/scaleDepth));float cameraAngle=dot(-eyeRay,pos);float lightAngle=dot(-scene_SunlightDirection,pos);float cameraScale=scaleAngle(cameraAngle);float lightScale=scaleAngle(lightAngle);float cameraOffset=depth*cameraScale;float temp=lightScale+cameraScale;float sampleLength=far/samples;float scaledLength=sampleLength*scale;vec3 sampleRay=eyeRay*sampleLength;vec3 samplePoint=cameraPos+sampleRay*0.5;vec3 frontColor=vec3(0.0,0.0,0.0);vec3 attenuate;{float height=length(samplePoint);float depth=exp(scaleOverScaleDepth*(innerRadius-height));float scatter=depth*temp-cameraOffset;attenuate=exp(-clamp(scatter,0.0,MAX_SCATTER)*(invWavelength*kr4PI+km4PI));frontColor+=attenuate*(depth*scaledLength);samplePoint+=sampleRay;}cIn=frontColor*(invWavelength*krESun+kmESun);cOut=clamp(attenuate,0.0,1.0);}\n#ifdef MATERIAL_SUN_HIGH_QUALITY\nv_Vertex=-POSITION.xyz;\n#elif defined(MATERIAL_SUN_SIMPLE)\nv_RayDir=-eyeRay;\n#else\nv_SkyGroundFactor=-eyeRay.y/SKY_GROUND_THRESHOLD;\n#endif\nv_GroundColor=material_Exposure*(cIn+COLOR_2_LINEAR(material_GroundTint)*cOut);v_SkyColor=material_Exposure*(cIn*getRayleighPhase(-scene_SunlightDirection,-eyeRay));float lightColorIntensity=clamp(length(scene_SunlightColor.xyz),0.25,1.0);\n#ifdef MATERIAL_SUN_HIGH_QUALITY\nv_SunColor=HDSundiskIntensityFactor*clamp(cOut,0.0,1.0)*scene_SunlightColor.xyz/lightColorIntensity;\n#elif defined(MATERIAL_SUN_SIMPLE)\nv_SunColor=simpleSundiskIntensityFactor*clamp(cOut*sunScale,0.0,1.0)*scene_SunlightColor.xyz/lightColorIntensity;\n#endif\n}"; // eslint-disable-line
|
|
16208
16452
|
|
|
16209
|
-
var
|
|
16453
|
+
var spriteMaskFs = "#define GLSLIFY 1\nuniform sampler2D renderer_MaskTexture;uniform float renderer_MaskAlphaCutoff;varying vec2 v_uv;void main(){vec4 color=texture2D(renderer_MaskTexture,v_uv);if(color.a<renderer_MaskAlphaCutoff){discard;}gl_FragColor=color;}"; // eslint-disable-line
|
|
16210
16454
|
|
|
16211
|
-
var
|
|
16455
|
+
var spriteMaskVs = "#define GLSLIFY 1\nuniform mat4 camera_VPMat;attribute vec3 POSITION;attribute vec2 TEXCOORD_0;varying vec2 v_uv;void main(){gl_Position=camera_VPMat*vec4(POSITION,1.0);v_uv=TEXCOORD_0;}"; // eslint-disable-line
|
|
16212
16456
|
|
|
16213
|
-
var
|
|
16457
|
+
var spriteFs = "#define GLSLIFY 1\nuniform sampler2D renderer_SpriteTexture;varying vec2 v_uv;varying vec4 v_color;void main(){vec4 baseColor=texture2D(renderer_SpriteTexture,v_uv);gl_FragColor=baseColor*v_color;}"; // eslint-disable-line
|
|
16458
|
+
|
|
16459
|
+
var spriteVs = "#define GLSLIFY 1\nuniform mat4 renderer_MVPMat;attribute vec3 POSITION;attribute vec2 TEXCOORD_0;attribute vec4 COLOR_0;varying vec2 v_uv;varying vec4 v_color;void main(){gl_Position=renderer_MVPMat*vec4(POSITION,1.0);v_uv=TEXCOORD_0;v_color=COLOR_0;}"; // eslint-disable-line
|
|
16460
|
+
|
|
16461
|
+
var unlitFs = "#define GLSLIFY 1\n#include <common>\n#include <uv_share>\n#include <FogFragmentDeclaration>\nuniform vec4 material_BaseColor;uniform float material_AlphaCutoff;\n#ifdef MATERIAL_HAS_BASETEXTURE\nuniform sampler2D material_BaseTexture;\n#endif\nvoid main(){vec4 baseColor=material_BaseColor;\n#ifdef MATERIAL_HAS_BASETEXTURE\nvec4 textureColor=texture2D(material_BaseTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ntextureColor=gammaToLinear(textureColor);\n#endif\nbaseColor*=textureColor;\n#endif\n#ifdef MATERIAL_IS_ALPHA_CUTOFF\nif(baseColor.a<material_AlphaCutoff){discard;}\n#endif\ngl_FragColor=baseColor;\n#ifndef MATERIAL_IS_TRANSPARENT\ngl_FragColor.a=1.0;\n#endif\n#include <FogFragment>\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ngl_FragColor=linearToGamma(gl_FragColor);\n#endif\n}"; // eslint-disable-line
|
|
16214
16462
|
|
|
16215
16463
|
var unlitVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\n#include <blendShape_input>\n#include <uv_share>\n#include <FogVertexDeclaration>\nvoid main(){\n#include <begin_position_vert>\n#include <blendShape_vert>\n#include <skinning_vert>\n#include <uv_vert>\n#include <position_vert>\n#include <FogVertex>\n}"; // eslint-disable-line
|
|
16216
16464
|
|
|
@@ -16246,6 +16494,9 @@ var unlitVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\n#in
|
|
|
16246
16494
|
Shader.create("skybox", [
|
|
16247
16495
|
new ShaderPass(skyboxVs, skyboxFs, forwardPassTags)
|
|
16248
16496
|
]);
|
|
16497
|
+
Shader.create("SkyProcedural", [
|
|
16498
|
+
new ShaderPass(skyProceduralVs, skyProceduralFs, forwardPassTags)
|
|
16499
|
+
]);
|
|
16249
16500
|
Shader.create("particle-shader", [
|
|
16250
16501
|
new ShaderPass(particleVs, particleFs, forwardPassTags)
|
|
16251
16502
|
]);
|
|
@@ -16356,8 +16607,8 @@ ShaderPool.init();
|
|
|
16356
16607
|
/** @internal */ _this._fontMap = {};
|
|
16357
16608
|
/** @internal @todo: temporary solution */ _this._macroCollection = new ShaderMacroCollection();
|
|
16358
16609
|
_this._settings = {};
|
|
16359
|
-
_this._resourceManager = new ResourceManager(
|
|
16360
|
-
_this._sceneManager = new SceneManager(
|
|
16610
|
+
_this._resourceManager = new ResourceManager(_assert_this_initialized(_this));
|
|
16611
|
+
_this._sceneManager = new SceneManager(_assert_this_initialized(_this));
|
|
16361
16612
|
_this._vSyncCount = 1;
|
|
16362
16613
|
_this._targetFrameRate = 60;
|
|
16363
16614
|
_this._time = new Time();
|
|
@@ -16381,28 +16632,28 @@ ShaderPool.init();
|
|
|
16381
16632
|
}
|
|
16382
16633
|
};
|
|
16383
16634
|
_this._hardwareRenderer = hardwareRenderer;
|
|
16384
|
-
_this._hardwareRenderer.init(canvas, _this._onDeviceLost.bind(
|
|
16385
|
-
_this.physicsManager = new PhysicsManager(
|
|
16635
|
+
_this._hardwareRenderer.init(canvas, _this._onDeviceLost.bind(_assert_this_initialized(_this)), _this._onDeviceRestored.bind(_assert_this_initialized(_this)));
|
|
16636
|
+
_this.physicsManager = new PhysicsManager(_assert_this_initialized(_this));
|
|
16386
16637
|
_this._canvas = canvas;
|
|
16387
|
-
_this._sceneManager.activeScene = new Scene(
|
|
16388
|
-
_this._spriteMaskManager = new SpriteMaskManager(
|
|
16638
|
+
_this._sceneManager.activeScene = new Scene(_assert_this_initialized(_this), "DefaultScene");
|
|
16639
|
+
_this._spriteMaskManager = new SpriteMaskManager(_assert_this_initialized(_this));
|
|
16389
16640
|
_this._spriteDefaultMaterial = _this._createSpriteMaterial();
|
|
16390
16641
|
_this._spriteMaskDefaultMaterial = _this._createSpriteMaskMaterial();
|
|
16391
|
-
_this._textDefaultFont = Font.createFromOS(
|
|
16642
|
+
_this._textDefaultFont = Font.createFromOS(_assert_this_initialized(_this), "Arial");
|
|
16392
16643
|
_this._textDefaultFont.isGCIgnored = false;
|
|
16393
|
-
_this.inputManager = new InputManager(
|
|
16644
|
+
_this.inputManager = new InputManager(_assert_this_initialized(_this));
|
|
16394
16645
|
_this._initMagentaTextures(hardwareRenderer);
|
|
16395
16646
|
if (!hardwareRenderer.canIUse(GLCapabilityType.depthTexture)) {
|
|
16396
16647
|
_this._macroCollection.enable(Engine._noDepthTextureMacro);
|
|
16397
16648
|
} else {
|
|
16398
|
-
var depthTexture2D = new Texture2D(
|
|
16649
|
+
var depthTexture2D = new Texture2D(_assert_this_initialized(_this), 1, 1, TextureFormat.Depth16, false);
|
|
16399
16650
|
depthTexture2D.isGCIgnored = true;
|
|
16400
16651
|
_this._depthTexture2D = depthTexture2D;
|
|
16401
16652
|
}
|
|
16402
|
-
var magentaMaterial = new Material(
|
|
16403
|
-
magentaMaterial.shaderData.setColor("
|
|
16653
|
+
var magentaMaterial = new Material(_assert_this_initialized(_this), Shader.find("unlit"));
|
|
16654
|
+
magentaMaterial.shaderData.setColor("material_BaseColor", new Color(1.0, 0.0, 1.01, 1.0));
|
|
16404
16655
|
_this._magentaMaterial = magentaMaterial;
|
|
16405
|
-
var backgroundTextureMaterial = new Material(
|
|
16656
|
+
var backgroundTextureMaterial = new Material(_assert_this_initialized(_this), Shader.find("background-texture"));
|
|
16406
16657
|
backgroundTextureMaterial.isGCIgnored = true;
|
|
16407
16658
|
backgroundTextureMaterial.renderState.depthState.compareFunction = CompareFunction.LessEqual;
|
|
16408
16659
|
_this._backgroundTextureMaterial = backgroundTextureMaterial;
|
|
@@ -16688,7 +16939,7 @@ ShaderPool.init();
|
|
|
16688
16939
|
console.error(error);
|
|
16689
16940
|
});
|
|
16690
16941
|
};
|
|
16691
|
-
|
|
16942
|
+
_create_class(Engine, [
|
|
16692
16943
|
{
|
|
16693
16944
|
key: "settings",
|
|
16694
16945
|
get: /**
|
|
@@ -16776,9 +17027,15 @@ ShaderPool.init();
|
|
|
16776
17027
|
]);
|
|
16777
17028
|
return Engine;
|
|
16778
17029
|
}(EventDispatcher);
|
|
16779
|
-
|
|
16780
|
-
/** @internal */ Engine.
|
|
16781
|
-
|
|
17030
|
+
(function() {
|
|
17031
|
+
/** @internal */ Engine._gammaMacro = ShaderMacro.getByName("ENGINE_IS_COLORSPACE_GAMMA");
|
|
17032
|
+
})();
|
|
17033
|
+
(function() {
|
|
17034
|
+
/** @internal */ Engine._noDepthTextureMacro = ShaderMacro.getByName("ENGINE_NO_DEPTH_TEXTURE");
|
|
17035
|
+
})();
|
|
17036
|
+
(function() {
|
|
17037
|
+
/** @internal Conversion of space units to pixel units for 2D. */ Engine._pixelsPerUnit = 100;
|
|
17038
|
+
})();
|
|
16782
17039
|
|
|
16783
17040
|
/**
|
|
16784
17041
|
* Script class, used for logic writing.
|
|
@@ -17096,7 +17353,9 @@ __decorate([
|
|
|
17096
17353
|
};
|
|
17097
17354
|
return SpriteBatcher;
|
|
17098
17355
|
}(Basic2DBatcher);
|
|
17099
|
-
|
|
17356
|
+
(function() {
|
|
17357
|
+
SpriteBatcher._textureProperty = ShaderProperty.getByName("renderer_SpriteTexture");
|
|
17358
|
+
})();
|
|
17100
17359
|
|
|
17101
17360
|
/**
|
|
17102
17361
|
* Render queue.
|
|
@@ -17597,227 +17856,247 @@ var /**
|
|
|
17597
17856
|
};
|
|
17598
17857
|
return ShadowUtils;
|
|
17599
17858
|
}();
|
|
17600
|
-
|
|
17601
|
-
|
|
17602
|
-
|
|
17603
|
-
|
|
17604
|
-
|
|
17605
|
-
new
|
|
17606
|
-
|
|
17607
|
-
|
|
17608
|
-
|
|
17609
|
-
|
|
17610
|
-
|
|
17611
|
-
|
|
17612
|
-
|
|
17613
|
-
|
|
17614
|
-
|
|
17615
|
-
|
|
17616
|
-
|
|
17617
|
-
|
|
17618
|
-
|
|
17619
|
-
|
|
17620
|
-
|
|
17621
|
-
|
|
17622
|
-
|
|
17623
|
-
|
|
17624
|
-
|
|
17625
|
-
|
|
17626
|
-
|
|
17627
|
-
|
|
17628
|
-
|
|
17629
|
-
|
|
17630
|
-
|
|
17631
|
-
|
|
17632
|
-
|
|
17633
|
-
FrustumFace.Top,
|
|
17634
|
-
FrustumFace.Bottom
|
|
17635
|
-
],
|
|
17636
|
-
[
|
|
17637
|
-
FrustumFace.Near,
|
|
17638
|
-
FrustumFace.Far,
|
|
17639
|
-
FrustumFace.Top,
|
|
17640
|
-
FrustumFace.Bottom
|
|
17641
|
-
],
|
|
17642
|
-
[
|
|
17643
|
-
FrustumFace.Near,
|
|
17644
|
-
FrustumFace.Far,
|
|
17645
|
-
FrustumFace.Left,
|
|
17646
|
-
FrustumFace.Right
|
|
17647
|
-
],
|
|
17648
|
-
[
|
|
17649
|
-
FrustumFace.Near,
|
|
17650
|
-
FrustumFace.Far,
|
|
17651
|
-
FrustumFace.Left,
|
|
17652
|
-
FrustumFace.Right
|
|
17653
|
-
]
|
|
17654
|
-
];
|
|
17655
|
-
/** near, far, left, right, bottom, top */ ShadowUtils._frustumTwoPlaneCorners = [
|
|
17656
|
-
[
|
|
17657
|
-
// near, far, left, right, bottom, top
|
|
17658
|
-
[
|
|
17659
|
-
8,
|
|
17660
|
-
8
|
|
17661
|
-
],
|
|
17662
|
-
[
|
|
17663
|
-
8,
|
|
17664
|
-
8
|
|
17665
|
-
],
|
|
17666
|
-
[
|
|
17667
|
-
4,
|
|
17668
|
-
5
|
|
17669
|
-
],
|
|
17670
|
-
[
|
|
17671
|
-
6,
|
|
17672
|
-
7
|
|
17673
|
-
],
|
|
17674
|
-
[
|
|
17675
|
-
7,
|
|
17676
|
-
4
|
|
17677
|
-
],
|
|
17678
|
-
[
|
|
17679
|
-
5,
|
|
17680
|
-
6
|
|
17681
|
-
]
|
|
17682
|
-
],
|
|
17683
|
-
[
|
|
17684
|
-
// near, far, left, right, bottom, top
|
|
17685
|
-
[
|
|
17686
|
-
8,
|
|
17687
|
-
8
|
|
17688
|
-
],
|
|
17689
|
-
[
|
|
17690
|
-
8,
|
|
17691
|
-
8
|
|
17692
|
-
],
|
|
17693
|
-
[
|
|
17694
|
-
1,
|
|
17695
|
-
0
|
|
17696
|
-
],
|
|
17697
|
-
[
|
|
17698
|
-
3,
|
|
17699
|
-
2
|
|
17700
|
-
],
|
|
17701
|
-
[
|
|
17702
|
-
0,
|
|
17703
|
-
3
|
|
17704
|
-
],
|
|
17705
|
-
[
|
|
17706
|
-
2,
|
|
17707
|
-
1
|
|
17708
|
-
]
|
|
17709
|
-
],
|
|
17710
|
-
[
|
|
17711
|
-
// near, far, left, right, bottom, top
|
|
17712
|
-
[
|
|
17713
|
-
5,
|
|
17714
|
-
4
|
|
17715
|
-
],
|
|
17716
|
-
[
|
|
17717
|
-
0,
|
|
17718
|
-
1
|
|
17719
|
-
],
|
|
17720
|
-
[
|
|
17721
|
-
8,
|
|
17722
|
-
8
|
|
17723
|
-
],
|
|
17724
|
-
[
|
|
17725
|
-
8,
|
|
17726
|
-
8
|
|
17727
|
-
],
|
|
17728
|
-
[
|
|
17729
|
-
4,
|
|
17730
|
-
0
|
|
17731
|
-
],
|
|
17732
|
-
[
|
|
17733
|
-
1,
|
|
17734
|
-
5
|
|
17735
|
-
]
|
|
17736
|
-
],
|
|
17737
|
-
[
|
|
17738
|
-
// near, far, left, right, bottom, top
|
|
17739
|
-
[
|
|
17740
|
-
7,
|
|
17741
|
-
6
|
|
17742
|
-
],
|
|
17743
|
-
[
|
|
17744
|
-
2,
|
|
17745
|
-
3
|
|
17746
|
-
],
|
|
17747
|
-
[
|
|
17748
|
-
8,
|
|
17749
|
-
8
|
|
17750
|
-
],
|
|
17751
|
-
[
|
|
17752
|
-
8,
|
|
17753
|
-
8
|
|
17754
|
-
],
|
|
17755
|
-
[
|
|
17756
|
-
3,
|
|
17757
|
-
7
|
|
17758
|
-
],
|
|
17759
|
-
[
|
|
17760
|
-
6,
|
|
17761
|
-
2
|
|
17762
|
-
]
|
|
17763
|
-
],
|
|
17764
|
-
[
|
|
17765
|
-
// near, far, left, right, bottom, top
|
|
17859
|
+
(function() {
|
|
17860
|
+
ShadowUtils._tempMatrix0 = new Matrix();
|
|
17861
|
+
})();
|
|
17862
|
+
(function() {
|
|
17863
|
+
// prettier-ignore
|
|
17864
|
+
/** @internal */ ShadowUtils._shadowMapCoordMatrix = new Matrix(0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 1.0);
|
|
17865
|
+
})();
|
|
17866
|
+
(function() {
|
|
17867
|
+
ShadowUtils._frustumCorners = [
|
|
17868
|
+
new Vector3(),
|
|
17869
|
+
new Vector3(),
|
|
17870
|
+
new Vector3(),
|
|
17871
|
+
new Vector3(),
|
|
17872
|
+
new Vector3(),
|
|
17873
|
+
new Vector3(),
|
|
17874
|
+
new Vector3(),
|
|
17875
|
+
new Vector3()
|
|
17876
|
+
];
|
|
17877
|
+
})();
|
|
17878
|
+
(function() {
|
|
17879
|
+
ShadowUtils._adjustNearPlane = new Plane(new Vector3());
|
|
17880
|
+
})();
|
|
17881
|
+
(function() {
|
|
17882
|
+
ShadowUtils._adjustFarPlane = new Plane(new Vector3());
|
|
17883
|
+
})();
|
|
17884
|
+
(function() {
|
|
17885
|
+
ShadowUtils._backPlaneFaces = new Array(5);
|
|
17886
|
+
})();
|
|
17887
|
+
(function() {
|
|
17888
|
+
ShadowUtils._edgePlanePoint2 = new Vector3();
|
|
17889
|
+
})();
|
|
17890
|
+
(function() {
|
|
17891
|
+
/** near, far, left, right, bottom, top */ ShadowUtils._frustumPlaneNeighbors = [
|
|
17766
17892
|
[
|
|
17767
|
-
|
|
17768
|
-
|
|
17893
|
+
FrustumFace.Left,
|
|
17894
|
+
FrustumFace.Right,
|
|
17895
|
+
FrustumFace.Top,
|
|
17896
|
+
FrustumFace.Bottom
|
|
17769
17897
|
],
|
|
17770
17898
|
[
|
|
17771
|
-
|
|
17772
|
-
|
|
17899
|
+
FrustumFace.Left,
|
|
17900
|
+
FrustumFace.Right,
|
|
17901
|
+
FrustumFace.Top,
|
|
17902
|
+
FrustumFace.Bottom
|
|
17773
17903
|
],
|
|
17774
17904
|
[
|
|
17775
|
-
|
|
17776
|
-
|
|
17905
|
+
FrustumFace.Near,
|
|
17906
|
+
FrustumFace.Far,
|
|
17907
|
+
FrustumFace.Top,
|
|
17908
|
+
FrustumFace.Bottom
|
|
17777
17909
|
],
|
|
17778
17910
|
[
|
|
17779
|
-
|
|
17780
|
-
|
|
17911
|
+
FrustumFace.Near,
|
|
17912
|
+
FrustumFace.Far,
|
|
17913
|
+
FrustumFace.Top,
|
|
17914
|
+
FrustumFace.Bottom
|
|
17781
17915
|
],
|
|
17782
17916
|
[
|
|
17783
|
-
|
|
17784
|
-
|
|
17917
|
+
FrustumFace.Near,
|
|
17918
|
+
FrustumFace.Far,
|
|
17919
|
+
FrustumFace.Left,
|
|
17920
|
+
FrustumFace.Right
|
|
17785
17921
|
],
|
|
17786
17922
|
[
|
|
17787
|
-
|
|
17788
|
-
|
|
17923
|
+
FrustumFace.Near,
|
|
17924
|
+
FrustumFace.Far,
|
|
17925
|
+
FrustumFace.Left,
|
|
17926
|
+
FrustumFace.Right
|
|
17789
17927
|
]
|
|
17790
|
-
]
|
|
17791
|
-
|
|
17792
|
-
|
|
17928
|
+
];
|
|
17929
|
+
})();
|
|
17930
|
+
(function() {
|
|
17931
|
+
/** near, far, left, right, bottom, top */ ShadowUtils._frustumTwoPlaneCorners = [
|
|
17793
17932
|
[
|
|
17794
|
-
|
|
17795
|
-
|
|
17933
|
+
// near, far, left, right, bottom, top
|
|
17934
|
+
[
|
|
17935
|
+
8,
|
|
17936
|
+
8
|
|
17937
|
+
],
|
|
17938
|
+
[
|
|
17939
|
+
8,
|
|
17940
|
+
8
|
|
17941
|
+
],
|
|
17942
|
+
[
|
|
17943
|
+
4,
|
|
17944
|
+
5
|
|
17945
|
+
],
|
|
17946
|
+
[
|
|
17947
|
+
6,
|
|
17948
|
+
7
|
|
17949
|
+
],
|
|
17950
|
+
[
|
|
17951
|
+
7,
|
|
17952
|
+
4
|
|
17953
|
+
],
|
|
17954
|
+
[
|
|
17955
|
+
5,
|
|
17956
|
+
6
|
|
17957
|
+
]
|
|
17796
17958
|
],
|
|
17797
17959
|
[
|
|
17798
|
-
|
|
17799
|
-
|
|
17960
|
+
// near, far, left, right, bottom, top
|
|
17961
|
+
[
|
|
17962
|
+
8,
|
|
17963
|
+
8
|
|
17964
|
+
],
|
|
17965
|
+
[
|
|
17966
|
+
8,
|
|
17967
|
+
8
|
|
17968
|
+
],
|
|
17969
|
+
[
|
|
17970
|
+
1,
|
|
17971
|
+
0
|
|
17972
|
+
],
|
|
17973
|
+
[
|
|
17974
|
+
3,
|
|
17975
|
+
2
|
|
17976
|
+
],
|
|
17977
|
+
[
|
|
17978
|
+
0,
|
|
17979
|
+
3
|
|
17980
|
+
],
|
|
17981
|
+
[
|
|
17982
|
+
2,
|
|
17983
|
+
1
|
|
17984
|
+
]
|
|
17800
17985
|
],
|
|
17801
17986
|
[
|
|
17802
|
-
|
|
17803
|
-
|
|
17987
|
+
// near, far, left, right, bottom, top
|
|
17988
|
+
[
|
|
17989
|
+
5,
|
|
17990
|
+
4
|
|
17991
|
+
],
|
|
17992
|
+
[
|
|
17993
|
+
0,
|
|
17994
|
+
1
|
|
17995
|
+
],
|
|
17996
|
+
[
|
|
17997
|
+
8,
|
|
17998
|
+
8
|
|
17999
|
+
],
|
|
18000
|
+
[
|
|
18001
|
+
8,
|
|
18002
|
+
8
|
|
18003
|
+
],
|
|
18004
|
+
[
|
|
18005
|
+
4,
|
|
18006
|
+
0
|
|
18007
|
+
],
|
|
18008
|
+
[
|
|
18009
|
+
1,
|
|
18010
|
+
5
|
|
18011
|
+
]
|
|
17804
18012
|
],
|
|
17805
18013
|
[
|
|
17806
|
-
|
|
17807
|
-
|
|
18014
|
+
// near, far, left, right, bottom, top
|
|
18015
|
+
[
|
|
18016
|
+
7,
|
|
18017
|
+
6
|
|
18018
|
+
],
|
|
18019
|
+
[
|
|
18020
|
+
2,
|
|
18021
|
+
3
|
|
18022
|
+
],
|
|
18023
|
+
[
|
|
18024
|
+
8,
|
|
18025
|
+
8
|
|
18026
|
+
],
|
|
18027
|
+
[
|
|
18028
|
+
8,
|
|
18029
|
+
8
|
|
18030
|
+
],
|
|
18031
|
+
[
|
|
18032
|
+
3,
|
|
18033
|
+
7
|
|
18034
|
+
],
|
|
18035
|
+
[
|
|
18036
|
+
6,
|
|
18037
|
+
2
|
|
18038
|
+
]
|
|
17808
18039
|
],
|
|
17809
18040
|
[
|
|
17810
|
-
|
|
17811
|
-
|
|
18041
|
+
// near, far, left, right, bottom, top
|
|
18042
|
+
[
|
|
18043
|
+
4,
|
|
18044
|
+
7
|
|
18045
|
+
],
|
|
18046
|
+
[
|
|
18047
|
+
3,
|
|
18048
|
+
0
|
|
18049
|
+
],
|
|
18050
|
+
[
|
|
18051
|
+
0,
|
|
18052
|
+
4
|
|
18053
|
+
],
|
|
18054
|
+
[
|
|
18055
|
+
7,
|
|
18056
|
+
3
|
|
18057
|
+
],
|
|
18058
|
+
[
|
|
18059
|
+
8,
|
|
18060
|
+
8
|
|
18061
|
+
],
|
|
18062
|
+
[
|
|
18063
|
+
8,
|
|
18064
|
+
8
|
|
18065
|
+
]
|
|
17812
18066
|
],
|
|
17813
18067
|
[
|
|
17814
|
-
|
|
17815
|
-
|
|
18068
|
+
// near, far, left, right, bottom, top
|
|
18069
|
+
[
|
|
18070
|
+
6,
|
|
18071
|
+
5
|
|
18072
|
+
],
|
|
18073
|
+
[
|
|
18074
|
+
1,
|
|
18075
|
+
2
|
|
18076
|
+
],
|
|
18077
|
+
[
|
|
18078
|
+
5,
|
|
18079
|
+
1
|
|
18080
|
+
],
|
|
18081
|
+
[
|
|
18082
|
+
2,
|
|
18083
|
+
6
|
|
18084
|
+
],
|
|
18085
|
+
[
|
|
18086
|
+
8,
|
|
18087
|
+
8
|
|
18088
|
+
],
|
|
18089
|
+
[
|
|
18090
|
+
8,
|
|
18091
|
+
8
|
|
18092
|
+
]
|
|
17816
18093
|
]
|
|
17817
|
-
]
|
|
17818
|
-
|
|
17819
|
-
|
|
17820
|
-
|
|
18094
|
+
];
|
|
18095
|
+
})();
|
|
18096
|
+
(function() {
|
|
18097
|
+
//now max shadow sample tent is 5x5, atlas borderSize at least 3=ceil(2.5),and +1 pixel is for global border for no cascade mode.
|
|
18098
|
+
ShadowUtils.atlasBorderSize = 4.0;
|
|
18099
|
+
})();
|
|
17821
18100
|
|
|
17822
18101
|
/**
|
|
17823
18102
|
* Cascade shadow caster.
|
|
@@ -18054,18 +18333,42 @@ ShadowUtils.atlasBorderSize = 4.0;
|
|
|
18054
18333
|
};
|
|
18055
18334
|
return CascadedShadowCasterPass;
|
|
18056
18335
|
}();
|
|
18057
|
-
|
|
18058
|
-
CascadedShadowCasterPass.
|
|
18059
|
-
|
|
18060
|
-
|
|
18061
|
-
CascadedShadowCasterPass.
|
|
18062
|
-
|
|
18063
|
-
|
|
18064
|
-
CascadedShadowCasterPass.
|
|
18065
|
-
|
|
18066
|
-
|
|
18067
|
-
CascadedShadowCasterPass.
|
|
18068
|
-
|
|
18336
|
+
(function() {
|
|
18337
|
+
CascadedShadowCasterPass._lightShadowBiasProperty = ShaderProperty.getByName("scene_ShadowBias");
|
|
18338
|
+
})();
|
|
18339
|
+
(function() {
|
|
18340
|
+
CascadedShadowCasterPass._lightDirectionProperty = ShaderProperty.getByName("scene_LightDirection");
|
|
18341
|
+
})();
|
|
18342
|
+
(function() {
|
|
18343
|
+
CascadedShadowCasterPass._shadowMatricesProperty = ShaderProperty.getByName("scene_ShadowMatrices");
|
|
18344
|
+
})();
|
|
18345
|
+
(function() {
|
|
18346
|
+
CascadedShadowCasterPass._shadowMapSize = ShaderProperty.getByName("scene_ShadowMapSize");
|
|
18347
|
+
})();
|
|
18348
|
+
(function() {
|
|
18349
|
+
CascadedShadowCasterPass._shadowInfosProperty = ShaderProperty.getByName("scene_ShadowInfo");
|
|
18350
|
+
})();
|
|
18351
|
+
(function() {
|
|
18352
|
+
CascadedShadowCasterPass._shadowMapsProperty = ShaderProperty.getByName("scene_ShadowMap");
|
|
18353
|
+
})();
|
|
18354
|
+
(function() {
|
|
18355
|
+
CascadedShadowCasterPass._shadowSplitSpheresProperty = ShaderProperty.getByName("scene_ShadowSplitSpheres");
|
|
18356
|
+
})();
|
|
18357
|
+
(function() {
|
|
18358
|
+
CascadedShadowCasterPass._maxCascades = 4;
|
|
18359
|
+
})();
|
|
18360
|
+
(function() {
|
|
18361
|
+
CascadedShadowCasterPass._cascadesSplitDistance = new Array(CascadedShadowCasterPass._maxCascades + 1);
|
|
18362
|
+
})();
|
|
18363
|
+
(function() {
|
|
18364
|
+
CascadedShadowCasterPass._clearColor = new Color$1(1, 1, 1, 1);
|
|
18365
|
+
})();
|
|
18366
|
+
(function() {
|
|
18367
|
+
CascadedShadowCasterPass._tempVector = new Vector3();
|
|
18368
|
+
})();
|
|
18369
|
+
(function() {
|
|
18370
|
+
CascadedShadowCasterPass._tempMatrix0 = new Matrix();
|
|
18371
|
+
})();
|
|
18069
18372
|
|
|
18070
18373
|
var passNum = 0;
|
|
18071
18374
|
/**
|
|
@@ -18333,7 +18636,7 @@ var passNum = 0;
|
|
|
18333
18636
|
renderer._prepareRender(context);
|
|
18334
18637
|
}
|
|
18335
18638
|
};
|
|
18336
|
-
|
|
18639
|
+
_create_class(BasicRenderPipeline, [
|
|
18337
18640
|
{
|
|
18338
18641
|
key: "defaultRenderPass",
|
|
18339
18642
|
get: /**
|
|
@@ -18345,15 +18648,25 @@ var passNum = 0;
|
|
|
18345
18648
|
]);
|
|
18346
18649
|
return BasicRenderPipeline;
|
|
18347
18650
|
}();
|
|
18348
|
-
|
|
18349
|
-
BasicRenderPipeline.
|
|
18651
|
+
(function() {
|
|
18652
|
+
BasicRenderPipeline._shadowCasterPipelineStageTagValue = PipelineStage.ShadowCaster;
|
|
18653
|
+
})();
|
|
18654
|
+
(function() {
|
|
18655
|
+
BasicRenderPipeline._forwardPipelineStageTagValue = PipelineStage.Forward;
|
|
18656
|
+
})();
|
|
18350
18657
|
|
|
18351
18658
|
var _Camera;
|
|
18352
18659
|
var MathTemp = function MathTemp() {
|
|
18353
18660
|
};
|
|
18354
|
-
|
|
18355
|
-
MathTemp.
|
|
18356
|
-
|
|
18661
|
+
(function() {
|
|
18662
|
+
MathTemp.tempVec4 = new Vector4();
|
|
18663
|
+
})();
|
|
18664
|
+
(function() {
|
|
18665
|
+
MathTemp.tempVec3 = new Vector3();
|
|
18666
|
+
})();
|
|
18667
|
+
(function() {
|
|
18668
|
+
MathTemp.tempVec2 = new Vector2();
|
|
18669
|
+
})();
|
|
18357
18670
|
var Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
18358
18671
|
_inherits(Camera1, Component);
|
|
18359
18672
|
function Camera1(entity) {
|
|
@@ -18371,6 +18684,8 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
18371
18684
|
* @remarks Support bit manipulation, corresponding to `Layer`.
|
|
18372
18685
|
*/ _this.cullingMask = Layer.Everything;
|
|
18373
18686
|
/** @internal */ _this._globalShaderMacro = new ShaderMacroCollection();
|
|
18687
|
+
/** @internal */ _this._frustum = new BoundingFrustum();
|
|
18688
|
+
/** @internal */ _this._virtualCamera = new VirtualCamera();
|
|
18374
18689
|
/** @internal */ _this._replacementShader = null;
|
|
18375
18690
|
/** @internal */ _this._replacementSubShaderTag = null;
|
|
18376
18691
|
_this._isProjMatSetting = false;
|
|
@@ -18383,8 +18698,6 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
18383
18698
|
_this._isFrustumProjectDirty = true;
|
|
18384
18699
|
_this._customAspectRatio = undefined;
|
|
18385
18700
|
_this._renderTarget = null;
|
|
18386
|
-
/** @internal */ _this._frustum = new BoundingFrustum();
|
|
18387
|
-
/** @internal */ _this._virtualCamera = new VirtualCamera();
|
|
18388
18701
|
_this._viewport = new Vector4(0, 0, 1, 1);
|
|
18389
18702
|
_this._inverseProjectionMatrix = new Matrix();
|
|
18390
18703
|
_this._lastAspectSize = new Vector2(0, 0);
|
|
@@ -18394,7 +18707,7 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
18394
18707
|
_this._isViewMatrixDirty = transform.registerWorldChangeFlag();
|
|
18395
18708
|
_this._isInvViewProjDirty = transform.registerWorldChangeFlag();
|
|
18396
18709
|
_this._frustumViewChangeFlag = transform.registerWorldChangeFlag();
|
|
18397
|
-
_this._renderPipeline = new BasicRenderPipeline(
|
|
18710
|
+
_this._renderPipeline = new BasicRenderPipeline(_assert_this_initialized(_this));
|
|
18398
18711
|
_this.shaderData._addReferCount(1);
|
|
18399
18712
|
return _this;
|
|
18400
18713
|
}
|
|
@@ -18624,7 +18937,7 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
18624
18937
|
}
|
|
18625
18938
|
return this._inverseProjectionMatrix;
|
|
18626
18939
|
};
|
|
18627
|
-
|
|
18940
|
+
_create_class(Camera1, [
|
|
18628
18941
|
{
|
|
18629
18942
|
key: "nearClipPlane",
|
|
18630
18943
|
get: /**
|
|
@@ -18788,7 +19101,11 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
18788
19101
|
}
|
|
18789
19102
|
]);
|
|
18790
19103
|
return Camera1;
|
|
18791
|
-
}(Component),
|
|
19104
|
+
}(Component), function() {
|
|
19105
|
+
/** @internal */ _Camera._inverseViewMatrixProperty = ShaderProperty.getByName("camera_ViewInvMat");
|
|
19106
|
+
}(), function() {
|
|
19107
|
+
/** @internal */ _Camera._cameraPositionProperty = ShaderProperty.getByName("camera_Position");
|
|
19108
|
+
}(), _Camera);
|
|
18792
19109
|
__decorate([
|
|
18793
19110
|
deepClone
|
|
18794
19111
|
], Camera.prototype, "_frustum", void 0);
|
|
@@ -18999,7 +19316,9 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
18999
19316
|
};
|
|
19000
19317
|
return Loader;
|
|
19001
19318
|
}();
|
|
19002
|
-
|
|
19319
|
+
(function() {
|
|
19320
|
+
Loader._engineObjects = {};
|
|
19321
|
+
})();
|
|
19003
19322
|
|
|
19004
19323
|
/**
|
|
19005
19324
|
* Asset Type.
|
|
@@ -19152,7 +19471,7 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19152
19471
|
target._isTransparent = this._isTransparent;
|
|
19153
19472
|
target._blendMode = this._blendMode;
|
|
19154
19473
|
};
|
|
19155
|
-
|
|
19474
|
+
_create_class(BaseMaterial, [
|
|
19156
19475
|
{
|
|
19157
19476
|
key: "shader",
|
|
19158
19477
|
get: /**
|
|
@@ -19256,19 +19575,45 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19256
19575
|
]);
|
|
19257
19576
|
return BaseMaterial;
|
|
19258
19577
|
}(Material);
|
|
19259
|
-
|
|
19260
|
-
BaseMaterial.
|
|
19261
|
-
|
|
19262
|
-
|
|
19263
|
-
BaseMaterial.
|
|
19264
|
-
|
|
19265
|
-
|
|
19266
|
-
BaseMaterial.
|
|
19267
|
-
|
|
19268
|
-
|
|
19269
|
-
BaseMaterial._transparentMacro = ShaderMacro.getByName("
|
|
19270
|
-
|
|
19271
|
-
|
|
19578
|
+
(function() {
|
|
19579
|
+
BaseMaterial._baseTextureMacro = ShaderMacro.getByName("MATERIAL_HAS_BASETEXTURE");
|
|
19580
|
+
})();
|
|
19581
|
+
(function() {
|
|
19582
|
+
BaseMaterial._normalTextureMacro = ShaderMacro.getByName("MATERIAL_HAS_NORMALTEXTURE");
|
|
19583
|
+
})();
|
|
19584
|
+
(function() {
|
|
19585
|
+
BaseMaterial._emissiveTextureMacro = ShaderMacro.getByName("MATERIAL_HAS_EMISSIVETEXTURE");
|
|
19586
|
+
})();
|
|
19587
|
+
(function() {
|
|
19588
|
+
BaseMaterial._transparentMacro = ShaderMacro.getByName("MATERIAL_IS_TRANSPARENT");
|
|
19589
|
+
})();
|
|
19590
|
+
(function() {
|
|
19591
|
+
BaseMaterial._baseColorProp = ShaderProperty.getByName("material_BaseColor");
|
|
19592
|
+
})();
|
|
19593
|
+
(function() {
|
|
19594
|
+
BaseMaterial._baseTextureProp = ShaderProperty.getByName("material_BaseTexture");
|
|
19595
|
+
})();
|
|
19596
|
+
(function() {
|
|
19597
|
+
BaseMaterial._tilingOffsetProp = ShaderProperty.getByName("material_TilingOffset");
|
|
19598
|
+
})();
|
|
19599
|
+
(function() {
|
|
19600
|
+
BaseMaterial._normalTextureProp = ShaderProperty.getByName("material_NormalTexture");
|
|
19601
|
+
})();
|
|
19602
|
+
(function() {
|
|
19603
|
+
BaseMaterial._normalIntensityProp = ShaderProperty.getByName("material_NormalIntensity");
|
|
19604
|
+
})();
|
|
19605
|
+
(function() {
|
|
19606
|
+
BaseMaterial._emissiveColorProp = ShaderProperty.getByName("material_EmissiveColor");
|
|
19607
|
+
})();
|
|
19608
|
+
(function() {
|
|
19609
|
+
BaseMaterial._emissiveTextureProp = ShaderProperty.getByName("material_EmissiveTexture");
|
|
19610
|
+
})();
|
|
19611
|
+
(function() {
|
|
19612
|
+
BaseMaterial._alphaCutoffProp = ShaderProperty.getByName("material_AlphaCutoff");
|
|
19613
|
+
})();
|
|
19614
|
+
(function() {
|
|
19615
|
+
BaseMaterial._alphaCutoffMacro = ShaderMacro.getByName("MATERIAL_IS_ALPHA_CUTOFF");
|
|
19616
|
+
})();
|
|
19272
19617
|
|
|
19273
19618
|
/**
|
|
19274
19619
|
* Blinn-phong Material.
|
|
@@ -19278,8 +19623,8 @@ BaseMaterial._alphaCutoffMacro = ShaderMacro.getByName("ALPHA_CUTOFF");
|
|
|
19278
19623
|
var _this;
|
|
19279
19624
|
_this = BaseMaterial.call(this, engine, Shader.find("blinn-phong")) || this;
|
|
19280
19625
|
var shaderData = _this.shaderData;
|
|
19281
|
-
shaderData.enableMacro("
|
|
19282
|
-
shaderData.enableMacro("
|
|
19626
|
+
shaderData.enableMacro("MATERIAL_NEED_WORLDPOS");
|
|
19627
|
+
shaderData.enableMacro("MATERIAL_NEED_TILINGOFFSET");
|
|
19283
19628
|
shaderData.setColor(BlinnPhongMaterial._baseColorProp, new Color$1(1, 1, 1, 1));
|
|
19284
19629
|
shaderData.setColor(BlinnPhongMaterial._specularColorProp, new Color$1(1, 1, 1, 1));
|
|
19285
19630
|
shaderData.setColor(BlinnPhongMaterial._emissiveColorProp, new Color$1(0, 0, 0, 1));
|
|
@@ -19296,7 +19641,7 @@ BaseMaterial._alphaCutoffMacro = ShaderMacro.getByName("ALPHA_CUTOFF");
|
|
|
19296
19641
|
this.cloneTo(dest);
|
|
19297
19642
|
return dest;
|
|
19298
19643
|
};
|
|
19299
|
-
|
|
19644
|
+
_create_class(BlinnPhongMaterial, [
|
|
19300
19645
|
{
|
|
19301
19646
|
key: "baseColor",
|
|
19302
19647
|
get: /**
|
|
@@ -19351,9 +19696,9 @@ BaseMaterial._alphaCutoffMacro = ShaderMacro.getByName("ALPHA_CUTOFF");
|
|
|
19351
19696
|
set: function set(value) {
|
|
19352
19697
|
this.shaderData.setTexture(BlinnPhongMaterial._specularTextureProp, value);
|
|
19353
19698
|
if (value) {
|
|
19354
|
-
this.shaderData.enableMacro("
|
|
19699
|
+
this.shaderData.enableMacro("MATERIAL_HAS_SPECULAR_TEXTURE");
|
|
19355
19700
|
} else {
|
|
19356
|
-
this.shaderData.disableMacro("
|
|
19701
|
+
this.shaderData.disableMacro("MATERIAL_HAS_SPECULAR_TEXTURE");
|
|
19357
19702
|
}
|
|
19358
19703
|
}
|
|
19359
19704
|
},
|
|
@@ -19442,9 +19787,15 @@ BaseMaterial._alphaCutoffMacro = ShaderMacro.getByName("ALPHA_CUTOFF");
|
|
|
19442
19787
|
]);
|
|
19443
19788
|
return BlinnPhongMaterial;
|
|
19444
19789
|
}(BaseMaterial);
|
|
19445
|
-
|
|
19446
|
-
BlinnPhongMaterial.
|
|
19447
|
-
|
|
19790
|
+
(function() {
|
|
19791
|
+
BlinnPhongMaterial._specularColorProp = ShaderProperty.getByName("material_SpecularColor");
|
|
19792
|
+
})();
|
|
19793
|
+
(function() {
|
|
19794
|
+
BlinnPhongMaterial._shininessProp = ShaderProperty.getByName("material_Shininess");
|
|
19795
|
+
})();
|
|
19796
|
+
(function() {
|
|
19797
|
+
BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_SpecularTexture");
|
|
19798
|
+
})();
|
|
19448
19799
|
|
|
19449
19800
|
/**
|
|
19450
19801
|
* Texture UV coordinate.
|
|
@@ -19468,8 +19819,8 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("u_specularTe
|
|
|
19468
19819
|
var _this;
|
|
19469
19820
|
_this = BaseMaterial.call(this, engine, shader) || this;
|
|
19470
19821
|
var shaderData = _this.shaderData;
|
|
19471
|
-
shaderData.enableMacro("
|
|
19472
|
-
shaderData.enableMacro("
|
|
19822
|
+
shaderData.enableMacro("MATERIAL_NEED_WORLDPOS");
|
|
19823
|
+
shaderData.enableMacro("MATERIAL_NEED_TILINGOFFSET");
|
|
19473
19824
|
shaderData.setColor(PBRBaseMaterial._baseColorProp, new Color$1(1, 1, 1, 1));
|
|
19474
19825
|
shaderData.setColor(PBRBaseMaterial._emissiveColorProp, new Color$1(0, 0, 0, 1));
|
|
19475
19826
|
shaderData.setVector4(PBRBaseMaterial._tilingOffsetProp, new Vector4(1, 1, 0, 0));
|
|
@@ -19480,7 +19831,7 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("u_specularTe
|
|
|
19480
19831
|
shaderData.setFloat(PBRBaseMaterial._clearCoatRoughnessProp, 0);
|
|
19481
19832
|
return _this;
|
|
19482
19833
|
}
|
|
19483
|
-
|
|
19834
|
+
_create_class(PBRBaseMaterial, [
|
|
19484
19835
|
{
|
|
19485
19836
|
key: "baseColor",
|
|
19486
19837
|
get: /**
|
|
@@ -19704,14 +20055,30 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("u_specularTe
|
|
|
19704
20055
|
]);
|
|
19705
20056
|
return PBRBaseMaterial;
|
|
19706
20057
|
}(BaseMaterial);
|
|
19707
|
-
|
|
19708
|
-
PBRBaseMaterial.
|
|
19709
|
-
|
|
19710
|
-
|
|
19711
|
-
PBRBaseMaterial.
|
|
19712
|
-
|
|
19713
|
-
|
|
19714
|
-
PBRBaseMaterial.
|
|
20058
|
+
(function() {
|
|
20059
|
+
PBRBaseMaterial._occlusionTextureIntensityProp = ShaderProperty.getByName("material_OcclusionIntensity");
|
|
20060
|
+
})();
|
|
20061
|
+
(function() {
|
|
20062
|
+
PBRBaseMaterial._occlusionTextureCoordProp = ShaderProperty.getByName("material_OcclusionTextureCoord");
|
|
20063
|
+
})();
|
|
20064
|
+
(function() {
|
|
20065
|
+
PBRBaseMaterial._occlusionTextureProp = ShaderProperty.getByName("material_OcclusionTexture");
|
|
20066
|
+
})();
|
|
20067
|
+
(function() {
|
|
20068
|
+
PBRBaseMaterial._clearCoatProp = ShaderProperty.getByName("material_ClearCoat");
|
|
20069
|
+
})();
|
|
20070
|
+
(function() {
|
|
20071
|
+
PBRBaseMaterial._clearCoatTextureProp = ShaderProperty.getByName("material_ClearCoatTexture");
|
|
20072
|
+
})();
|
|
20073
|
+
(function() {
|
|
20074
|
+
PBRBaseMaterial._clearCoatRoughnessProp = ShaderProperty.getByName("material_ClearCoatRoughness");
|
|
20075
|
+
})();
|
|
20076
|
+
(function() {
|
|
20077
|
+
PBRBaseMaterial._clearCoatRoughnessTextureProp = ShaderProperty.getByName("material_ClearCoatRoughnessTexture");
|
|
20078
|
+
})();
|
|
20079
|
+
(function() {
|
|
20080
|
+
PBRBaseMaterial._clearCoatNormalTextureProp = ShaderProperty.getByName("material_ClearCoatNormalTexture");
|
|
20081
|
+
})();
|
|
19715
20082
|
|
|
19716
20083
|
/**
|
|
19717
20084
|
* PBR (Metallic-Roughness Workflow) Material.
|
|
@@ -19732,7 +20099,7 @@ PBRBaseMaterial._clearCoatNormalTextureProp = ShaderProperty.getByName("u_clearC
|
|
|
19732
20099
|
this.cloneTo(dest);
|
|
19733
20100
|
return dest;
|
|
19734
20101
|
};
|
|
19735
|
-
|
|
20102
|
+
_create_class(PBRMaterial, [
|
|
19736
20103
|
{
|
|
19737
20104
|
key: "metallic",
|
|
19738
20105
|
get: /**
|
|
@@ -19766,18 +20133,24 @@ PBRBaseMaterial._clearCoatNormalTextureProp = ShaderProperty.getByName("u_clearC
|
|
|
19766
20133
|
set: function set(value) {
|
|
19767
20134
|
this.shaderData.setTexture(PBRMaterial._roughnessMetallicTextureProp, value);
|
|
19768
20135
|
if (value) {
|
|
19769
|
-
this.shaderData.enableMacro("
|
|
20136
|
+
this.shaderData.enableMacro("MATERIAL_ROUGHNESSMETALLICTEXTURE");
|
|
19770
20137
|
} else {
|
|
19771
|
-
this.shaderData.disableMacro("
|
|
20138
|
+
this.shaderData.disableMacro("MATERIAL_ROUGHNESSMETALLICTEXTURE");
|
|
19772
20139
|
}
|
|
19773
20140
|
}
|
|
19774
20141
|
}
|
|
19775
20142
|
]);
|
|
19776
20143
|
return PBRMaterial;
|
|
19777
20144
|
}(PBRBaseMaterial);
|
|
19778
|
-
|
|
19779
|
-
PBRMaterial.
|
|
19780
|
-
|
|
20145
|
+
(function() {
|
|
20146
|
+
PBRMaterial._metallicProp = ShaderProperty.getByName("material_Metal");
|
|
20147
|
+
})();
|
|
20148
|
+
(function() {
|
|
20149
|
+
PBRMaterial._roughnessProp = ShaderProperty.getByName("material_Roughness");
|
|
20150
|
+
})();
|
|
20151
|
+
(function() {
|
|
20152
|
+
PBRMaterial._roughnessMetallicTextureProp = ShaderProperty.getByName("material_RoughnessMetallicTexture");
|
|
20153
|
+
})();
|
|
19781
20154
|
|
|
19782
20155
|
/**
|
|
19783
20156
|
* PBR (Specular-Glossiness Workflow) Material.
|
|
@@ -19798,7 +20171,7 @@ PBRMaterial._roughnessMetallicTextureProp = ShaderProperty.getByName("u_roughnes
|
|
|
19798
20171
|
this.cloneTo(dest);
|
|
19799
20172
|
return dest;
|
|
19800
20173
|
};
|
|
19801
|
-
|
|
20174
|
+
_create_class(PBRSpecularMaterial, [
|
|
19802
20175
|
{
|
|
19803
20176
|
key: "specularColor",
|
|
19804
20177
|
get: /**
|
|
@@ -19844,10 +20217,18 @@ PBRMaterial._roughnessMetallicTextureProp = ShaderProperty.getByName("u_roughnes
|
|
|
19844
20217
|
]);
|
|
19845
20218
|
return PBRSpecularMaterial;
|
|
19846
20219
|
}(PBRBaseMaterial);
|
|
19847
|
-
|
|
19848
|
-
PBRSpecularMaterial.
|
|
19849
|
-
|
|
19850
|
-
|
|
20220
|
+
(function() {
|
|
20221
|
+
PBRSpecularMaterial._specularColorProp = ShaderProperty.getByName("material_PBRSpecularColor");
|
|
20222
|
+
})();
|
|
20223
|
+
(function() {
|
|
20224
|
+
PBRSpecularMaterial._glossinessProp = ShaderProperty.getByName("material_Glossiness");
|
|
20225
|
+
})();
|
|
20226
|
+
(function() {
|
|
20227
|
+
PBRSpecularMaterial._specularGlossinessTextureProp = ShaderProperty.getByName("material_SpecularGlossinessTexture");
|
|
20228
|
+
})();
|
|
20229
|
+
(function() {
|
|
20230
|
+
PBRSpecularMaterial._specularGlossinessTextureMacro = ShaderMacro.getByName("MATERIAL_HAS_SPECULARGLOSSINESSTEXTURE");
|
|
20231
|
+
})();
|
|
19851
20232
|
|
|
19852
20233
|
/**
|
|
19853
20234
|
* Unlit Material.
|
|
@@ -19857,8 +20238,8 @@ PBRSpecularMaterial._specularGlossinessTextureMacro = ShaderMacro.getByName("SPE
|
|
|
19857
20238
|
var _this;
|
|
19858
20239
|
_this = BaseMaterial.call(this, engine, Shader.find("unlit")) || this;
|
|
19859
20240
|
var shaderData = _this.shaderData;
|
|
19860
|
-
shaderData.enableMacro("
|
|
19861
|
-
shaderData.enableMacro("
|
|
20241
|
+
shaderData.enableMacro("MATERIAL_OMIT_NORMAL");
|
|
20242
|
+
shaderData.enableMacro("MATERIAL_NEED_TILINGOFFSET");
|
|
19862
20243
|
shaderData.setColor(UnlitMaterial._baseColorProp, new Color$1(1, 1, 1, 1));
|
|
19863
20244
|
shaderData.setVector4(UnlitMaterial._tilingOffsetProp, new Vector4(1, 1, 0, 0));
|
|
19864
20245
|
return _this;
|
|
@@ -19871,7 +20252,7 @@ PBRSpecularMaterial._specularGlossinessTextureMacro = ShaderMacro.getByName("SPE
|
|
|
19871
20252
|
this.cloneTo(dest);
|
|
19872
20253
|
return dest;
|
|
19873
20254
|
};
|
|
19874
|
-
|
|
20255
|
+
_create_class(UnlitMaterial, [
|
|
19875
20256
|
{
|
|
19876
20257
|
key: "baseColor",
|
|
19877
20258
|
get: /**
|
|
@@ -19990,7 +20371,7 @@ var TextVerticalAlignment;
|
|
|
19990
20371
|
this._sprites = null;
|
|
19991
20372
|
this._spriteNamesToIndex = null;
|
|
19992
20373
|
};
|
|
19993
|
-
|
|
20374
|
+
_create_class(SpriteAtlas, [
|
|
19994
20375
|
{
|
|
19995
20376
|
key: "sprites",
|
|
19996
20377
|
get: /**
|
|
@@ -20071,7 +20452,6 @@ var TextVerticalAlignment;
|
|
|
20071
20452
|
* @returns Cloned sprite
|
|
20072
20453
|
*/ _proto.clone = function clone() {
|
|
20073
20454
|
var cloneSprite = new Sprite(this._engine, this._texture, this._region, this._pivot, this._border, this.name);
|
|
20074
|
-
cloneSprite._assetID = this._assetID;
|
|
20075
20455
|
cloneSprite._atlasRotated = this._atlasRotated;
|
|
20076
20456
|
cloneSprite._atlasRegion.copyFrom(this._atlasRegion);
|
|
20077
20457
|
cloneSprite._atlasRegionOffset.copyFrom(this._atlasRegionOffset);
|
|
@@ -20173,7 +20553,7 @@ var TextVerticalAlignment;
|
|
|
20173
20553
|
}
|
|
20174
20554
|
this._updateFlagManager.dispatch(type);
|
|
20175
20555
|
};
|
|
20176
|
-
|
|
20556
|
+
_create_class(Sprite, [
|
|
20177
20557
|
{
|
|
20178
20558
|
key: "texture",
|
|
20179
20559
|
get: /**
|
|
@@ -20462,16 +20842,18 @@ var SlicedSpriteAssembler = (_SlicedSpriteAssembler = /*#__PURE__*/ function() {
|
|
|
20462
20842
|
};
|
|
20463
20843
|
SlicedSpriteAssembler1.updateUVs = function updateUVs(renderer) {};
|
|
20464
20844
|
return SlicedSpriteAssembler1;
|
|
20465
|
-
}(),
|
|
20845
|
+
}(), function() {
|
|
20846
|
+
_SlicedSpriteAssembler._worldMatrix = new Matrix();
|
|
20847
|
+
}(), _SlicedSpriteAssembler);
|
|
20466
20848
|
SlicedSpriteAssembler = __decorate([
|
|
20467
20849
|
StaticInterfaceImplement()
|
|
20468
20850
|
], SlicedSpriteAssembler);
|
|
20469
20851
|
|
|
20470
|
-
var _renderer__verticesData;
|
|
20471
20852
|
var _TiledSpriteAssembler;
|
|
20472
20853
|
var TiledSpriteAssembler = (_TiledSpriteAssembler = /*#__PURE__*/ function() {
|
|
20473
20854
|
function TiledSpriteAssembler1() {}
|
|
20474
20855
|
TiledSpriteAssembler1.resetData = function resetData(renderer) {
|
|
20856
|
+
var _renderer__verticesData;
|
|
20475
20857
|
(_renderer__verticesData = renderer._verticesData).triangles || (_renderer__verticesData.triangles = []);
|
|
20476
20858
|
};
|
|
20477
20859
|
TiledSpriteAssembler1.updatePositions = function updatePositions(renderer) {
|
|
@@ -20783,7 +21165,17 @@ var TiledSpriteAssembler = (_TiledSpriteAssembler = /*#__PURE__*/ function() {
|
|
|
20783
21165
|
}
|
|
20784
21166
|
};
|
|
20785
21167
|
return TiledSpriteAssembler1;
|
|
20786
|
-
}(),
|
|
21168
|
+
}(), function() {
|
|
21169
|
+
_TiledSpriteAssembler._worldMatrix = new Matrix();
|
|
21170
|
+
}(), function() {
|
|
21171
|
+
_TiledSpriteAssembler._posRow = new DisorderedArray();
|
|
21172
|
+
}(), function() {
|
|
21173
|
+
_TiledSpriteAssembler._posColumn = new DisorderedArray();
|
|
21174
|
+
}(), function() {
|
|
21175
|
+
_TiledSpriteAssembler._uvRow = new DisorderedArray();
|
|
21176
|
+
}(), function() {
|
|
21177
|
+
_TiledSpriteAssembler._uvColumn = new DisorderedArray();
|
|
21178
|
+
}(), _TiledSpriteAssembler);
|
|
20787
21179
|
TiledSpriteAssembler = __decorate([
|
|
20788
21180
|
StaticInterfaceImplement()
|
|
20789
21181
|
], TiledSpriteAssembler);
|
|
@@ -20814,7 +21206,7 @@ var TiledType;
|
|
|
20814
21206
|
_this._verticesData = new VertexData2D(4, [], [], null, _this._color);
|
|
20815
21207
|
_this.drawMode = SpriteDrawMode.Simple;
|
|
20816
21208
|
_this.setMaterial(_this._engine._spriteDefaultMaterial);
|
|
20817
|
-
_this._onSpriteChange = _this._onSpriteChange.bind(
|
|
21209
|
+
_this._onSpriteChange = _this._onSpriteChange.bind(_assert_this_initialized(_this));
|
|
20818
21210
|
return _this;
|
|
20819
21211
|
}
|
|
20820
21212
|
var _proto = SpriteRenderer.prototype;
|
|
@@ -20932,7 +21324,7 @@ var TiledType;
|
|
|
20932
21324
|
break;
|
|
20933
21325
|
}
|
|
20934
21326
|
};
|
|
20935
|
-
|
|
21327
|
+
_create_class(SpriteRenderer, [
|
|
20936
21328
|
{
|
|
20937
21329
|
key: "drawMode",
|
|
20938
21330
|
get: /**
|
|
@@ -21117,7 +21509,9 @@ var TiledType;
|
|
|
21117
21509
|
]);
|
|
21118
21510
|
return SpriteRenderer;
|
|
21119
21511
|
}(Renderer);
|
|
21120
|
-
|
|
21512
|
+
(function() {
|
|
21513
|
+
/** @internal */ SpriteRenderer._textureProperty = ShaderProperty.getByName("renderer_SpriteTexture");
|
|
21514
|
+
})();
|
|
21121
21515
|
__decorate([
|
|
21122
21516
|
ignoreClone
|
|
21123
21517
|
], SpriteRenderer.prototype, "_verticesData", void 0);
|
|
@@ -21180,14 +21574,16 @@ var /**
|
|
|
21180
21574
|
];
|
|
21181
21575
|
this.renderData = new VertexData2D(4, positions, null, CharRenderData.triangles, null);
|
|
21182
21576
|
};
|
|
21183
|
-
|
|
21184
|
-
|
|
21185
|
-
|
|
21186
|
-
|
|
21187
|
-
|
|
21188
|
-
|
|
21189
|
-
|
|
21190
|
-
|
|
21577
|
+
(function() {
|
|
21578
|
+
CharRenderData.triangles = [
|
|
21579
|
+
0,
|
|
21580
|
+
2,
|
|
21581
|
+
1,
|
|
21582
|
+
2,
|
|
21583
|
+
0,
|
|
21584
|
+
3
|
|
21585
|
+
];
|
|
21586
|
+
})();
|
|
21191
21587
|
|
|
21192
21588
|
/**
|
|
21193
21589
|
* @internal
|
|
@@ -21488,7 +21884,7 @@ CharRenderData.triangles = [
|
|
|
21488
21884
|
Renderer.prototype._onTransformChanged.call(this, bit);
|
|
21489
21885
|
this._setDirtyFlagTrue(0x4 | 0x8);
|
|
21490
21886
|
};
|
|
21491
|
-
|
|
21887
|
+
_create_class(TextRenderer, [
|
|
21492
21888
|
{
|
|
21493
21889
|
key: "color",
|
|
21494
21890
|
get: /**
|
|
@@ -21701,9 +22097,15 @@ CharRenderData.triangles = [
|
|
|
21701
22097
|
]);
|
|
21702
22098
|
return TextRenderer;
|
|
21703
22099
|
}(Renderer);
|
|
21704
|
-
|
|
21705
|
-
TextRenderer.
|
|
21706
|
-
|
|
22100
|
+
(function() {
|
|
22101
|
+
TextRenderer._charRenderDataPool = new CharRenderDataPool(CharRenderData, 50);
|
|
22102
|
+
})();
|
|
22103
|
+
(function() {
|
|
22104
|
+
TextRenderer._tempVec30 = new Vector3();
|
|
22105
|
+
})();
|
|
22106
|
+
(function() {
|
|
22107
|
+
TextRenderer._tempVec31 = new Vector3();
|
|
22108
|
+
})();
|
|
21707
22109
|
__decorate([
|
|
21708
22110
|
assignmentClone
|
|
21709
22111
|
], TextRenderer.prototype, "_subFont", void 0);
|
|
@@ -21920,7 +22322,9 @@ var DirtyFlag;
|
|
|
21920
22322
|
};
|
|
21921
22323
|
return AnimationCurveOwner;
|
|
21922
22324
|
}();
|
|
21923
|
-
|
|
22325
|
+
(function() {
|
|
22326
|
+
AnimationCurveOwner._assemblerMap = new Map();
|
|
22327
|
+
})();
|
|
21924
22328
|
|
|
21925
22329
|
/**
|
|
21926
22330
|
* @internal
|
|
@@ -22098,7 +22502,7 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
22098
22502
|
}
|
|
22099
22503
|
}
|
|
22100
22504
|
};
|
|
22101
|
-
|
|
22505
|
+
_create_class(AnimationClip, [
|
|
22102
22506
|
{
|
|
22103
22507
|
key: "events",
|
|
22104
22508
|
get: /**
|
|
@@ -22246,7 +22650,7 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
22246
22650
|
var result = this._evaluate(time, evaluateData);
|
|
22247
22651
|
return this._type._subtractValue(result, this.keys[0].value, evaluateData.value);
|
|
22248
22652
|
};
|
|
22249
|
-
|
|
22653
|
+
_create_class(AnimationCurve, [
|
|
22250
22654
|
{
|
|
22251
22655
|
key: "interpolation",
|
|
22252
22656
|
get: /**
|
|
@@ -22356,7 +22760,11 @@ var AnimationArrayCurve = (_AnimationArrayCurve = /*#__PURE__*/ function(Animati
|
|
|
22356
22760
|
return out;
|
|
22357
22761
|
};
|
|
22358
22762
|
return AnimationArrayCurve;
|
|
22359
|
-
}(AnimationCurve),
|
|
22763
|
+
}(AnimationCurve), function() {
|
|
22764
|
+
/** @internal */ _AnimationArrayCurve._isReferenceType = true;
|
|
22765
|
+
}(), function() {
|
|
22766
|
+
/** @internal */ _AnimationArrayCurve._isInterpolationType = true;
|
|
22767
|
+
}(), _AnimationArrayCurve);
|
|
22360
22768
|
AnimationArrayCurve = __decorate([
|
|
22361
22769
|
StaticInterfaceImplement()
|
|
22362
22770
|
], AnimationArrayCurve);
|
|
@@ -22409,7 +22817,11 @@ var AnimationBoolCurve = (_AnimationBoolCurve = /*#__PURE__*/ function(Animation
|
|
|
22409
22817
|
return frame.value;
|
|
22410
22818
|
};
|
|
22411
22819
|
return AnimationBoolCurve;
|
|
22412
|
-
}(AnimationCurve),
|
|
22820
|
+
}(AnimationCurve), function() {
|
|
22821
|
+
/** @internal */ _AnimationBoolCurve._isReferenceType = false;
|
|
22822
|
+
}(), function() {
|
|
22823
|
+
/** @internal */ _AnimationBoolCurve._isInterpolationType = false;
|
|
22824
|
+
}(), _AnimationBoolCurve);
|
|
22413
22825
|
AnimationBoolCurve = __decorate([
|
|
22414
22826
|
StaticInterfaceImplement()
|
|
22415
22827
|
], AnimationBoolCurve);
|
|
@@ -22502,7 +22914,11 @@ var AnimationColorCurve = (_AnimationColorCurve = /*#__PURE__*/ function(Animati
|
|
|
22502
22914
|
return out;
|
|
22503
22915
|
};
|
|
22504
22916
|
return AnimationColorCurve;
|
|
22505
|
-
}(AnimationCurve),
|
|
22917
|
+
}(AnimationCurve), function() {
|
|
22918
|
+
/** @internal */ _AnimationColorCurve._isReferenceType = true;
|
|
22919
|
+
}(), function() {
|
|
22920
|
+
/** @internal */ _AnimationColorCurve._isInterpolationType = true;
|
|
22921
|
+
}(), _AnimationColorCurve);
|
|
22506
22922
|
AnimationColorCurve = __decorate([
|
|
22507
22923
|
StaticInterfaceImplement()
|
|
22508
22924
|
], AnimationColorCurve);
|
|
@@ -22598,7 +23014,11 @@ var AnimationFloatArrayCurve = (_AnimationFloatArrayCurve = /*#__PURE__*/ functi
|
|
|
22598
23014
|
return out;
|
|
22599
23015
|
};
|
|
22600
23016
|
return AnimationFloatArrayCurve;
|
|
22601
|
-
}(AnimationCurve),
|
|
23017
|
+
}(AnimationCurve), function() {
|
|
23018
|
+
/** @internal */ _AnimationFloatArrayCurve._isReferenceType = true;
|
|
23019
|
+
}(), function() {
|
|
23020
|
+
/** @internal */ _AnimationFloatArrayCurve._isInterpolationType = true;
|
|
23021
|
+
}(), _AnimationFloatArrayCurve);
|
|
22602
23022
|
AnimationFloatArrayCurve = __decorate([
|
|
22603
23023
|
StaticInterfaceImplement()
|
|
22604
23024
|
], AnimationFloatArrayCurve);
|
|
@@ -22663,7 +23083,11 @@ var AnimationFloatCurve = (_AnimationFloatCurve = /*#__PURE__*/ function(Animati
|
|
|
22663
23083
|
}
|
|
22664
23084
|
};
|
|
22665
23085
|
return AnimationFloatCurve;
|
|
22666
|
-
}(AnimationCurve),
|
|
23086
|
+
}(AnimationCurve), function() {
|
|
23087
|
+
/** @internal */ _AnimationFloatCurve._isReferenceType = false;
|
|
23088
|
+
}(), function() {
|
|
23089
|
+
/** @internal */ _AnimationFloatCurve._isInterpolationType = true;
|
|
23090
|
+
}(), _AnimationFloatCurve);
|
|
22667
23091
|
AnimationFloatCurve = __decorate([
|
|
22668
23092
|
StaticInterfaceImplement()
|
|
22669
23093
|
], AnimationFloatCurve);
|
|
@@ -22761,7 +23185,13 @@ var AnimationQuaternionCurve = (_AnimationQuaternionCurve = /*#__PURE__*/ functi
|
|
|
22761
23185
|
return out;
|
|
22762
23186
|
};
|
|
22763
23187
|
return AnimationQuaternionCurve1;
|
|
22764
|
-
}(AnimationCurve),
|
|
23188
|
+
}(AnimationCurve), function() {
|
|
23189
|
+
/** @internal */ _AnimationQuaternionCurve._isInterpolationType = true;
|
|
23190
|
+
}(), function() {
|
|
23191
|
+
/** @internal */ _AnimationQuaternionCurve._isReferenceType = true;
|
|
23192
|
+
}(), function() {
|
|
23193
|
+
/** @internal */ _AnimationQuaternionCurve._tempConjugateQuat = new Quaternion();
|
|
23194
|
+
}(), _AnimationQuaternionCurve);
|
|
22765
23195
|
AnimationQuaternionCurve = __decorate([
|
|
22766
23196
|
StaticInterfaceImplement()
|
|
22767
23197
|
], AnimationQuaternionCurve);
|
|
@@ -22842,7 +23272,11 @@ var AnimationVector2Curve = (_AnimationVector2Curve = /*#__PURE__*/ function(Ani
|
|
|
22842
23272
|
return out;
|
|
22843
23273
|
};
|
|
22844
23274
|
return AnimationVector2Curve;
|
|
22845
|
-
}(AnimationCurve),
|
|
23275
|
+
}(AnimationCurve), function() {
|
|
23276
|
+
/** @internal */ _AnimationVector2Curve._isReferenceType = true;
|
|
23277
|
+
}(), function() {
|
|
23278
|
+
/** @internal */ _AnimationVector2Curve._isInterpolationType = true;
|
|
23279
|
+
}(), _AnimationVector2Curve);
|
|
22846
23280
|
AnimationVector2Curve = __decorate([
|
|
22847
23281
|
StaticInterfaceImplement()
|
|
22848
23282
|
], AnimationVector2Curve);
|
|
@@ -22935,7 +23369,11 @@ var AnimationVector3Curve = (_AnimationVector3Curve = /*#__PURE__*/ function(Ani
|
|
|
22935
23369
|
return out;
|
|
22936
23370
|
};
|
|
22937
23371
|
return AnimationVector3Curve;
|
|
22938
|
-
}(AnimationCurve),
|
|
23372
|
+
}(AnimationCurve), function() {
|
|
23373
|
+
/** @internal */ _AnimationVector3Curve._isReferenceType = true;
|
|
23374
|
+
}(), function() {
|
|
23375
|
+
/** @internal */ _AnimationVector3Curve._isInterpolationType = true;
|
|
23376
|
+
}(), _AnimationVector3Curve);
|
|
22939
23377
|
AnimationVector3Curve = __decorate([
|
|
22940
23378
|
StaticInterfaceImplement()
|
|
22941
23379
|
], AnimationVector3Curve);
|
|
@@ -23028,7 +23466,11 @@ var AnimationVector4Curve = (_AnimationVector4Curve = /*#__PURE__*/ function(Ani
|
|
|
23028
23466
|
return out;
|
|
23029
23467
|
};
|
|
23030
23468
|
return AnimationVector4Curve;
|
|
23031
|
-
}(AnimationCurve),
|
|
23469
|
+
}(AnimationCurve), function() {
|
|
23470
|
+
/** @internal */ _AnimationVector4Curve._isReferenceType = true;
|
|
23471
|
+
}(), function() {
|
|
23472
|
+
/** @internal */ _AnimationVector4Curve._isInterpolationType = true;
|
|
23473
|
+
}(), _AnimationVector4Curve);
|
|
23032
23474
|
AnimationVector4Curve = __decorate([
|
|
23033
23475
|
StaticInterfaceImplement()
|
|
23034
23476
|
], AnimationVector4Curve);
|
|
@@ -23744,7 +24186,7 @@ var AnimatorLayerBlendingMode;
|
|
|
23744
24186
|
}
|
|
23745
24187
|
}
|
|
23746
24188
|
};
|
|
23747
|
-
|
|
24189
|
+
_create_class(Animator, [
|
|
23748
24190
|
{
|
|
23749
24191
|
key: "animatorController",
|
|
23750
24192
|
get: /**
|
|
@@ -23835,7 +24277,7 @@ __decorate([
|
|
|
23835
24277
|
*/ _proto._registerChangeFlag = function _registerChangeFlag() {
|
|
23836
24278
|
return this._updateFlagManager.createFlag(BoolUpdateFlag);
|
|
23837
24279
|
};
|
|
23838
|
-
|
|
24280
|
+
_create_class(AnimatorController, [
|
|
23839
24281
|
{
|
|
23840
24282
|
key: "layers",
|
|
23841
24283
|
get: /**
|
|
@@ -23969,7 +24411,7 @@ __decorate([
|
|
|
23969
24411
|
index2 !== -1 && this._onStateExitScripts.splice(index2, 1);
|
|
23970
24412
|
}
|
|
23971
24413
|
};
|
|
23972
|
-
|
|
24414
|
+
_create_class(AnimatorState, [
|
|
23973
24415
|
{
|
|
23974
24416
|
key: "transitions",
|
|
23975
24417
|
get: /**
|
|
@@ -24089,55 +24531,265 @@ var AnimatorConditionMode;
|
|
|
24089
24531
|
};
|
|
24090
24532
|
|
|
24091
24533
|
/**
|
|
24092
|
-
*
|
|
24534
|
+
* SkyBoxMaterial.
|
|
24093
24535
|
*/ var SkyBoxMaterial = /*#__PURE__*/ function(Material) {
|
|
24094
24536
|
_inherits(SkyBoxMaterial, Material);
|
|
24095
24537
|
function SkyBoxMaterial(engine) {
|
|
24096
24538
|
var _this;
|
|
24097
24539
|
_this = Material.call(this, engine, Shader.find("skybox")) || this;
|
|
24098
|
-
_this.
|
|
24540
|
+
_this._textureDecodeRGBM = false;
|
|
24541
|
+
_this._tintColor = new Color$1(1, 1, 1, 1);
|
|
24099
24542
|
_this.renderState.rasterState.cullMode = CullMode.Off;
|
|
24100
24543
|
_this.renderState.depthState.compareFunction = CompareFunction.LessEqual;
|
|
24101
|
-
_this.shaderData.
|
|
24544
|
+
_this.shaderData.setFloat(SkyBoxMaterial._rotationProp, 0);
|
|
24545
|
+
_this.shaderData.setFloat(SkyBoxMaterial._exposureProp, 1);
|
|
24546
|
+
_this.shaderData.setColor(SkyBoxMaterial._tintColorProp, _this._tintColor);
|
|
24102
24547
|
return _this;
|
|
24103
24548
|
}
|
|
24104
|
-
|
|
24549
|
+
var _proto = SkyBoxMaterial.prototype;
|
|
24550
|
+
/**
|
|
24551
|
+
* @override
|
|
24552
|
+
*/ _proto.clone = function clone() {
|
|
24553
|
+
var dest = new SkyBoxMaterial(this._engine);
|
|
24554
|
+
this.cloneTo(dest);
|
|
24555
|
+
return dest;
|
|
24556
|
+
};
|
|
24557
|
+
_create_class(SkyBoxMaterial, [
|
|
24105
24558
|
{
|
|
24106
24559
|
key: "textureDecodeRGBM",
|
|
24107
24560
|
get: /**
|
|
24108
|
-
* Whether to decode
|
|
24561
|
+
* Whether to decode texture with RGBM format.
|
|
24562
|
+
*/ function get() {
|
|
24563
|
+
return this._textureDecodeRGBM;
|
|
24564
|
+
},
|
|
24565
|
+
set: function set(value) {
|
|
24566
|
+
this._textureDecodeRGBM = value;
|
|
24567
|
+
if (value) {
|
|
24568
|
+
this.shaderData.enableMacro(SkyBoxMaterial._decodeSkyRGBMMacro);
|
|
24569
|
+
} else {
|
|
24570
|
+
this.shaderData.disableMacro(SkyBoxMaterial._decodeSkyRGBMMacro);
|
|
24571
|
+
}
|
|
24572
|
+
}
|
|
24573
|
+
},
|
|
24574
|
+
{
|
|
24575
|
+
key: "texture",
|
|
24576
|
+
get: /**
|
|
24577
|
+
* Texture of the sky box material.
|
|
24578
|
+
*/ function get() {
|
|
24579
|
+
return this.shaderData.getTexture(SkyBoxMaterial._textureCubeProp);
|
|
24580
|
+
},
|
|
24581
|
+
set: function set(value) {
|
|
24582
|
+
this.shaderData.setTexture(SkyBoxMaterial._textureCubeProp, value);
|
|
24583
|
+
}
|
|
24584
|
+
},
|
|
24585
|
+
{
|
|
24586
|
+
key: "rotation",
|
|
24587
|
+
get: /**
|
|
24588
|
+
* The angle to rotate around the y-axis, unit is degree.
|
|
24109
24589
|
*/ function get() {
|
|
24110
|
-
return
|
|
24590
|
+
return this.shaderData.getFloat(SkyBoxMaterial._rotationProp);
|
|
24111
24591
|
},
|
|
24112
24592
|
set: function set(value) {
|
|
24113
|
-
this.
|
|
24593
|
+
this.shaderData.setFloat(SkyBoxMaterial._rotationProp, value);
|
|
24114
24594
|
}
|
|
24115
24595
|
},
|
|
24116
24596
|
{
|
|
24117
|
-
key: "
|
|
24597
|
+
key: "exposure",
|
|
24118
24598
|
get: /**
|
|
24119
|
-
*
|
|
24599
|
+
* The exposure value of this material.
|
|
24120
24600
|
*/ function get() {
|
|
24121
|
-
return this.
|
|
24601
|
+
return this.shaderData.getFloat(SkyBoxMaterial._exposureProp);
|
|
24122
24602
|
},
|
|
24123
24603
|
set: function set(value) {
|
|
24124
|
-
this.
|
|
24604
|
+
this.shaderData.setFloat(SkyBoxMaterial._exposureProp, value);
|
|
24125
24605
|
}
|
|
24126
24606
|
},
|
|
24127
24607
|
{
|
|
24128
|
-
key: "
|
|
24608
|
+
key: "tintColor",
|
|
24129
24609
|
get: /**
|
|
24130
|
-
*
|
|
24610
|
+
* The Tint color of this material.
|
|
24131
24611
|
*/ function get() {
|
|
24132
|
-
return this.
|
|
24612
|
+
return this._tintColor;
|
|
24133
24613
|
},
|
|
24134
|
-
set: function set(
|
|
24135
|
-
this.
|
|
24614
|
+
set: function set(value) {
|
|
24615
|
+
if (this._tintColor != value) {
|
|
24616
|
+
this._tintColor.copyFrom(value);
|
|
24617
|
+
}
|
|
24136
24618
|
}
|
|
24137
24619
|
}
|
|
24138
24620
|
]);
|
|
24139
24621
|
return SkyBoxMaterial;
|
|
24140
24622
|
}(Material);
|
|
24623
|
+
(function() {
|
|
24624
|
+
SkyBoxMaterial._tintColorProp = ShaderProperty.getByName("material_TintColor");
|
|
24625
|
+
})();
|
|
24626
|
+
(function() {
|
|
24627
|
+
SkyBoxMaterial._textureCubeProp = ShaderProperty.getByName("material_CubeTexture");
|
|
24628
|
+
})();
|
|
24629
|
+
(function() {
|
|
24630
|
+
SkyBoxMaterial._rotationProp = ShaderProperty.getByName("material_Rotation");
|
|
24631
|
+
})();
|
|
24632
|
+
(function() {
|
|
24633
|
+
SkyBoxMaterial._exposureProp = ShaderProperty.getByName("material_Exposure");
|
|
24634
|
+
})();
|
|
24635
|
+
(function() {
|
|
24636
|
+
SkyBoxMaterial._decodeSkyRGBMMacro = ShaderMacro.getByName("MATERIAL_IS_DECODE_SKY_RGBM");
|
|
24637
|
+
})();
|
|
24638
|
+
|
|
24639
|
+
var SunMode;
|
|
24640
|
+
(function(SunMode) {
|
|
24641
|
+
SunMode[SunMode[/** None */ "None"] = 0] = "None";
|
|
24642
|
+
SunMode[SunMode[/** Simple sun. */ "Simple"] = 1] = "Simple";
|
|
24643
|
+
SunMode[SunMode[/** High quality sun. */ "HighQuality"] = 2] = "HighQuality";
|
|
24644
|
+
})(SunMode || (SunMode = {}));
|
|
24645
|
+
/**
|
|
24646
|
+
* Sky procedural material.
|
|
24647
|
+
*/ var SkyProceduralMaterial = /*#__PURE__*/ function(Material) {
|
|
24648
|
+
_inherits(SkyProceduralMaterial, Material);
|
|
24649
|
+
function SkyProceduralMaterial(engine) {
|
|
24650
|
+
var _this;
|
|
24651
|
+
_this = Material.call(this, engine, Shader.find("SkyProcedural")) || this;
|
|
24652
|
+
_this.sunMode = 2;
|
|
24653
|
+
_this.sunSize = 0.04;
|
|
24654
|
+
_this.sunSizeConvergence = 5;
|
|
24655
|
+
_this.atmosphereThickness = 1.0;
|
|
24656
|
+
_this.skyTint = new Color$1(0.5, 0.5, 0.5, 1.0);
|
|
24657
|
+
_this.groundTint = new Color$1(0.369, 0.349, 0.341, 1.0);
|
|
24658
|
+
_this.exposure = 1.3;
|
|
24659
|
+
_this.renderState.rasterState.cullMode = CullMode.Off;
|
|
24660
|
+
_this.renderState.depthState.compareFunction = CompareFunction.LessEqual;
|
|
24661
|
+
return _this;
|
|
24662
|
+
}
|
|
24663
|
+
var _proto = SkyProceduralMaterial.prototype;
|
|
24664
|
+
/**
|
|
24665
|
+
* @override
|
|
24666
|
+
*/ _proto.clone = function clone() {
|
|
24667
|
+
var dest = new SkyProceduralMaterial(this._engine);
|
|
24668
|
+
this.cloneTo(dest);
|
|
24669
|
+
return dest;
|
|
24670
|
+
};
|
|
24671
|
+
_create_class(SkyProceduralMaterial, [
|
|
24672
|
+
{
|
|
24673
|
+
key: "sunMode",
|
|
24674
|
+
get: /**
|
|
24675
|
+
* Sun mode.
|
|
24676
|
+
*/ function get() {
|
|
24677
|
+
return this._sunDisk;
|
|
24678
|
+
},
|
|
24679
|
+
set: function set(value) {
|
|
24680
|
+
var shaderData = this.shaderData;
|
|
24681
|
+
switch(value){
|
|
24682
|
+
case 2:
|
|
24683
|
+
shaderData.disableMacro(SkyProceduralMaterial._sunSimpleMacro);
|
|
24684
|
+
shaderData.enableMacro(SkyProceduralMaterial._sunHighQualityMacro);
|
|
24685
|
+
break;
|
|
24686
|
+
case 1:
|
|
24687
|
+
shaderData.disableMacro(SkyProceduralMaterial._sunHighQualityMacro);
|
|
24688
|
+
shaderData.enableMacro(SkyProceduralMaterial._sunSimpleMacro);
|
|
24689
|
+
break;
|
|
24690
|
+
case 0:
|
|
24691
|
+
shaderData.disableMacro(SkyProceduralMaterial._sunHighQualityMacro);
|
|
24692
|
+
shaderData.disableMacro(SkyProceduralMaterial._sunSimpleMacro);
|
|
24693
|
+
break;
|
|
24694
|
+
default:
|
|
24695
|
+
throw "SkyBoxProceduralMaterial: unknown sun value.";
|
|
24696
|
+
}
|
|
24697
|
+
this._sunDisk = value;
|
|
24698
|
+
}
|
|
24699
|
+
},
|
|
24700
|
+
{
|
|
24701
|
+
key: "sunSize",
|
|
24702
|
+
get: /**
|
|
24703
|
+
* Sun size, range is 0 to 1.
|
|
24704
|
+
*/ function get() {
|
|
24705
|
+
return this.shaderData.getFloat(SkyProceduralMaterial._sunSizeProp);
|
|
24706
|
+
},
|
|
24707
|
+
set: function set(value) {
|
|
24708
|
+
this.shaderData.setFloat(SkyProceduralMaterial._sunSizeProp, Math.min(Math.max(0.0, value), 1.0));
|
|
24709
|
+
}
|
|
24710
|
+
},
|
|
24711
|
+
{
|
|
24712
|
+
key: "sunSizeConvergence",
|
|
24713
|
+
get: /**
|
|
24714
|
+
* Sun size convergence, range is 0 to 20.
|
|
24715
|
+
*/ function get() {
|
|
24716
|
+
return this.shaderData.getFloat(SkyProceduralMaterial._sunSizeConvergenceProp);
|
|
24717
|
+
},
|
|
24718
|
+
set: function set(value) {
|
|
24719
|
+
this.shaderData.setFloat(SkyProceduralMaterial._sunSizeConvergenceProp, Math.min(Math.max(0.0, value), 20.0));
|
|
24720
|
+
}
|
|
24721
|
+
},
|
|
24722
|
+
{
|
|
24723
|
+
key: "atmosphereThickness",
|
|
24724
|
+
get: /**
|
|
24725
|
+
* Atmosphere thickness, range is 0 to 5.
|
|
24726
|
+
*/ function get() {
|
|
24727
|
+
return this.shaderData.getFloat(SkyProceduralMaterial._atmosphereThicknessProp);
|
|
24728
|
+
},
|
|
24729
|
+
set: function set(value) {
|
|
24730
|
+
this.shaderData.setFloat(SkyProceduralMaterial._atmosphereThicknessProp, Math.min(Math.max(0.0, value), 5.0));
|
|
24731
|
+
}
|
|
24732
|
+
},
|
|
24733
|
+
{
|
|
24734
|
+
key: "skyTint",
|
|
24735
|
+
get: /**
|
|
24736
|
+
* Sky tint.
|
|
24737
|
+
*/ function get() {
|
|
24738
|
+
return this.shaderData.getColor(SkyProceduralMaterial._skyTintProp);
|
|
24739
|
+
},
|
|
24740
|
+
set: function set(value) {
|
|
24741
|
+
this.shaderData.setColor(SkyProceduralMaterial._skyTintProp, value);
|
|
24742
|
+
}
|
|
24743
|
+
},
|
|
24744
|
+
{
|
|
24745
|
+
key: "groundTint",
|
|
24746
|
+
get: /**
|
|
24747
|
+
* Ground tint.
|
|
24748
|
+
*/ function get() {
|
|
24749
|
+
return this.shaderData.getColor(SkyProceduralMaterial._groundTintProp);
|
|
24750
|
+
},
|
|
24751
|
+
set: function set(value) {
|
|
24752
|
+
this.shaderData.setColor(SkyProceduralMaterial._groundTintProp, value);
|
|
24753
|
+
}
|
|
24754
|
+
},
|
|
24755
|
+
{
|
|
24756
|
+
key: "exposure",
|
|
24757
|
+
get: /**
|
|
24758
|
+
* Exposure, range is 0 to 8.
|
|
24759
|
+
*/ function get() {
|
|
24760
|
+
return this.shaderData.getFloat(SkyProceduralMaterial._exposureProp);
|
|
24761
|
+
},
|
|
24762
|
+
set: function set(value) {
|
|
24763
|
+
this.shaderData.setFloat(SkyProceduralMaterial._exposureProp, Math.min(Math.max(0.0, value), 8.0));
|
|
24764
|
+
}
|
|
24765
|
+
}
|
|
24766
|
+
]);
|
|
24767
|
+
return SkyProceduralMaterial;
|
|
24768
|
+
}(Material);
|
|
24769
|
+
(function() {
|
|
24770
|
+
SkyProceduralMaterial._sunSizeProp = ShaderProperty.getByName("material_SunSize");
|
|
24771
|
+
})();
|
|
24772
|
+
(function() {
|
|
24773
|
+
SkyProceduralMaterial._sunSizeConvergenceProp = ShaderProperty.getByName("material_SunSizeConvergence");
|
|
24774
|
+
})();
|
|
24775
|
+
(function() {
|
|
24776
|
+
SkyProceduralMaterial._atmosphereThicknessProp = ShaderProperty.getByName("material_AtmosphereThickness");
|
|
24777
|
+
})();
|
|
24778
|
+
(function() {
|
|
24779
|
+
SkyProceduralMaterial._skyTintProp = ShaderProperty.getByName("material_SkyTint");
|
|
24780
|
+
})();
|
|
24781
|
+
(function() {
|
|
24782
|
+
SkyProceduralMaterial._groundTintProp = ShaderProperty.getByName("material_GroundTint");
|
|
24783
|
+
})();
|
|
24784
|
+
(function() {
|
|
24785
|
+
SkyProceduralMaterial._exposureProp = ShaderProperty.getByName("material_Exposure");
|
|
24786
|
+
})();
|
|
24787
|
+
(function() {
|
|
24788
|
+
SkyProceduralMaterial._sunHighQualityMacro = ShaderMacro.getByName("MATERIAL_SUN_HIGH_QUALITY");
|
|
24789
|
+
})();
|
|
24790
|
+
(function() {
|
|
24791
|
+
SkyProceduralMaterial._sunSimpleMacro = ShaderMacro.getByName("MATERIAL_SUN_SIMPLE");
|
|
24792
|
+
})();
|
|
24141
24793
|
|
|
24142
24794
|
var DirtyFlagType;
|
|
24143
24795
|
(function(DirtyFlagType) {
|
|
@@ -24200,7 +24852,7 @@ var ParticleRendererBlendMode;
|
|
|
24200
24852
|
_this._isFadeOut = false;
|
|
24201
24853
|
_this._playOnEnable = true;
|
|
24202
24854
|
_this._blendMode = 0;
|
|
24203
|
-
_this._onColorChanged = _this._onColorChanged.bind(
|
|
24855
|
+
_this._onColorChanged = _this._onColorChanged.bind(_assert_this_initialized(_this));
|
|
24204
24856
|
//@ts-ignore
|
|
24205
24857
|
_this._color._onValueChanged = _this._onColorChanged;
|
|
24206
24858
|
_this.setMaterial(_this._createMaterial());
|
|
@@ -24477,7 +25129,7 @@ var ParticleRendererBlendMode;
|
|
|
24477
25129
|
ParticleRenderer._getRandom = function _getRandom() {
|
|
24478
25130
|
return Math.random() - 0.5;
|
|
24479
25131
|
};
|
|
24480
|
-
|
|
25132
|
+
_create_class(ParticleRenderer, [
|
|
24481
25133
|
{
|
|
24482
25134
|
key: "texture",
|
|
24483
25135
|
get: /**
|
|
@@ -24908,14 +25560,16 @@ var ParticleRendererBlendMode;
|
|
|
24908
25560
|
]);
|
|
24909
25561
|
return ParticleRenderer;
|
|
24910
25562
|
}(MeshRenderer);
|
|
24911
|
-
|
|
25563
|
+
(function() {
|
|
25564
|
+
/** The max number of indices that Uint16Array can support. */ ParticleRenderer._uint16VertexLimit = 65535;
|
|
25565
|
+
})();
|
|
24912
25566
|
__decorate([
|
|
24913
25567
|
ignoreClone
|
|
24914
25568
|
], ParticleRenderer.prototype, "_onColorChanged", null);
|
|
24915
25569
|
|
|
24916
25570
|
var FRAG_SHADER = "#define GLSLIFY 1\nvarying vec2 v_uv;uniform sampler2D u_texture;void main(void){gl_FragColor=texture2D(u_texture,v_uv);}"; // eslint-disable-line
|
|
24917
25571
|
|
|
24918
|
-
var VERT_SHADER = "#define GLSLIFY 1\nattribute vec3 POSITION;attribute vec2 TEXCOORD_0;varying vec2 v_uv;uniform mat4
|
|
25572
|
+
var VERT_SHADER = "#define GLSLIFY 1\nattribute vec3 POSITION;attribute vec2 TEXCOORD_0;varying vec2 v_uv;uniform mat4 camera_ProjMat;uniform mat4 camera_ViewMat;void main(){gl_Position=camera_ProjMat*camera_ViewMat*vec4(POSITION,1.0);v_uv=TEXCOORD_0;}"; // eslint-disable-line
|
|
24919
25573
|
|
|
24920
25574
|
Shader.create("trail", VERT_SHADER, FRAG_SHADER);
|
|
24921
25575
|
var TrailMaterial = /*#__PURE__*/ function(Material) {
|
|
@@ -25178,7 +25832,7 @@ var _tempVector3 = new Vector3();
|
|
|
25178
25832
|
this._camera.renderTarget = this._oriCameraRenderTarget;
|
|
25179
25833
|
this._camera.cullingMask = this._oriCameraCullingMask;
|
|
25180
25834
|
};
|
|
25181
|
-
|
|
25835
|
+
_create_class(Probe, [
|
|
25182
25836
|
{
|
|
25183
25837
|
key: "_texture",
|
|
25184
25838
|
get: function get() {
|
|
@@ -25279,5 +25933,5 @@ var cacheDir = new Vector3();
|
|
|
25279
25933
|
return CubeProbe;
|
|
25280
25934
|
}(Probe);
|
|
25281
25935
|
|
|
25282
|
-
export { AmbientLight, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorState, AnimatorStateMachine, AnimatorStateTransition, AssetPromise, AssetType, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, Basic2DBatcher, BasicRenderPipeline, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlinnPhongMaterial, BoolUpdateFlag, BoxColliderShape, Buffer, BufferBindFlag, BufferMesh, BufferUsage, BufferUtil, Camera, CameraClearFlags, CapsuleColliderShape, CharacterController, CloneManager, Collider, ColliderShape, ColliderShapeUpAxis, CollisionDetectionMode, ColorSpace, ColorWriteMask, CompareFunction, Component, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, DataType, DependentMode, DiffuseMode, DirectLight, DynamicCollider, DynamicColliderConstraints, Engine, EngineObject, Entity, EventDispatcher, FixedJoint, FogMode, Font, FontStyle, GLCapabilityType, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolationType, Joint, JointLimits, JointMotor, Keyframe, Keys, Layer, Light, Loader, Logger, Material, Mesh, MeshRenderer, MeshTopology, ModelMesh,
|
|
25936
|
+
export { AmbientLight, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorState, AnimatorStateMachine, AnimatorStateTransition, AssetPromise, AssetType, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, Basic2DBatcher, BasicRenderPipeline, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlinnPhongMaterial, BoolUpdateFlag, BoxColliderShape, Buffer, BufferBindFlag, BufferMesh, BufferUsage, BufferUtil, Camera, CameraClearFlags, CapsuleColliderShape, CharacterController, CloneManager, Collider, ColliderShape, ColliderShapeUpAxis, CollisionDetectionMode, ColorSpace, ColorWriteMask, CompareFunction, Component, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, DataType, DependentMode, DiffuseMode, DirectLight, DynamicCollider, DynamicColliderConstraints, Engine, EngineObject, Entity, EventDispatcher, FixedJoint, FogMode, Font, FontStyle, GLCapabilityType, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolationType, Joint, JointLimits, JointMotor, Keyframe, Keys, Layer, Light, Loader, Logger, Material, Mesh, MeshRenderer, MeshTopology, ModelMesh, OverflowMode, PBRBaseMaterial, PBRMaterial, PBRSpecularMaterial, ParticleRenderer, ParticleRendererBlendMode, PhysicsManager, PhysicsMaterial, PhysicsMaterialCombineMode, PipelineStage, PlaneColliderShape, Platform, PointLight, Pointer, PointerButton, PointerPhase, PrimitiveMesh, Probe, ReferResource, RenderBufferDepthFormat, RenderFace, RenderPass, RenderQueue, RenderQueueType, RenderTarget, Renderer, ResourceManager, Scene, SceneManager, Script, SetDataOptions, Shader, ShaderData, ShaderFactory, ShaderMacro, ShaderMacroCollection, ShaderPass, ShaderProperty, ShaderPropertyType, ShaderTagKey, ShadowCascadesMode, ShadowResolution, ShadowType, Skin, SkinnedMeshRenderer, Sky, SkyBoxMaterial, SkyProceduralMaterial, SphereColliderShape, SpotLight, SpringJoint, Sprite, SpriteAtlas, SpriteDrawMode, SpriteMask, SpriteMaskInteraction, SpriteMaskLayer, SpriteRenderer, SpriteTileMode, StateMachineScript, StaticCollider, StencilOperation, SubMesh, SubShader, SunMode, SystemInfo, TextHorizontalAlignment, TextRenderer, TextUtils, TextVerticalAlignment, Texture, Texture2D, Texture2DArray, TextureCoordinate, TextureCube, TextureCubeFace, TextureDepthCompareFunction, TextureFilterMode, TextureFormat, TextureWrapMode, Time, TrailMaterial, TrailRenderer, Transform, UnlitMaterial, Utils, VertexBufferBinding, VertexElement, VertexElementFormat, WrapMode, assignmentClone, deepClone, dependentComponents, ignoreClone, request, resourceLoader, shallowClone };
|
|
25283
25937
|
//# sourceMappingURL=module.js.map
|