@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/miniprogram.js
CHANGED
|
@@ -16,56 +16,48 @@ var miniprogram = require('@galacean/engine-math/dist/miniprogram');
|
|
|
16
16
|
Platform[Platform[/** Unknown platform. */ "Unknown"] = 4] = "Unknown";
|
|
17
17
|
})(exports.Platform || (exports.Platform = {}));
|
|
18
18
|
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
22
|
-
}
|
|
19
|
+
function _assert_this_initialized(self) {
|
|
20
|
+
if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
23
21
|
|
|
24
|
-
|
|
22
|
+
return self;
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
function _defineProperties(target, props) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
for (var i = 0; i < props.length; i++) {
|
|
27
|
+
var descriptor = props[i];
|
|
28
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
29
|
+
descriptor.configurable = true;
|
|
30
|
+
|
|
31
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
32
|
+
|
|
33
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
34
|
+
}
|
|
35
35
|
}
|
|
36
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
37
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
38
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
36
39
|
|
|
37
|
-
|
|
38
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
39
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
40
|
-
return Constructor;
|
|
40
|
+
return Constructor;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
function
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return o;
|
|
47
|
-
};
|
|
43
|
+
function _set_prototype_of(o, p) {
|
|
44
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
45
|
+
o.__proto__ = p;
|
|
48
46
|
|
|
49
|
-
|
|
50
|
-
}
|
|
47
|
+
return o;
|
|
48
|
+
};
|
|
51
49
|
|
|
52
|
-
|
|
53
|
-
return setPrototypeOf(o, p);
|
|
50
|
+
return _set_prototype_of(o, p);
|
|
54
51
|
}
|
|
55
52
|
|
|
56
53
|
function _inherits(subClass, superClass) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
62
|
-
constructor: {
|
|
63
|
-
value: subClass,
|
|
64
|
-
writable: true,
|
|
65
|
-
configurable: true
|
|
54
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
55
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
66
56
|
}
|
|
67
|
-
|
|
68
|
-
|
|
57
|
+
|
|
58
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
|
|
59
|
+
|
|
60
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
69
61
|
}
|
|
70
62
|
|
|
71
63
|
/**
|
|
@@ -113,9 +105,15 @@ function _inherits(subClass, superClass) {
|
|
|
113
105
|
};
|
|
114
106
|
return MathUtil;
|
|
115
107
|
}();
|
|
116
|
-
|
|
117
|
-
/** The
|
|
118
|
-
|
|
108
|
+
(function() {
|
|
109
|
+
/** The value for which all absolute numbers smaller than are considered equal to zero. */ MathUtil.zeroTolerance = 1e-6;
|
|
110
|
+
})();
|
|
111
|
+
(function() {
|
|
112
|
+
/** The conversion factor that radian to degree. */ MathUtil.radToDegreeFactor = 180 / Math.PI;
|
|
113
|
+
})();
|
|
114
|
+
(function() {
|
|
115
|
+
/** The conversion factor that degree to radian. */ MathUtil.degreeToRadFactor = Math.PI / 180;
|
|
116
|
+
})();
|
|
119
117
|
|
|
120
118
|
/**
|
|
121
119
|
* Describes a color in the from of RGBA (in order: R, G, B, A).
|
|
@@ -325,7 +323,7 @@ function _inherits(subClass, superClass) {
|
|
|
325
323
|
out._onValueChanged && out._onValueChanged();
|
|
326
324
|
return out;
|
|
327
325
|
};
|
|
328
|
-
|
|
326
|
+
_create_class(Color, [
|
|
329
327
|
{
|
|
330
328
|
key: "r",
|
|
331
329
|
get: /**
|
|
@@ -401,11 +399,9 @@ function __decorate(decorators, target, key, desc) {
|
|
|
401
399
|
}
|
|
402
400
|
|
|
403
401
|
function _instanceof(left, right) {
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
return left instanceof right;
|
|
408
|
-
}
|
|
402
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
403
|
+
return !!right[Symbol.hasInstance](left);
|
|
404
|
+
} else return left instanceof right;
|
|
409
405
|
}
|
|
410
406
|
|
|
411
407
|
/**
|
|
@@ -586,16 +582,22 @@ function _instanceof(left, right) {
|
|
|
586
582
|
};
|
|
587
583
|
return CloneManager;
|
|
588
584
|
}();
|
|
589
|
-
|
|
590
|
-
/** @internal */ CloneManager.
|
|
591
|
-
|
|
585
|
+
(function() {
|
|
586
|
+
/** @internal */ CloneManager._subCloneModeMap = new Map();
|
|
587
|
+
})();
|
|
588
|
+
(function() {
|
|
589
|
+
/** @internal */ CloneManager._cloneModeMap = new Map();
|
|
590
|
+
})();
|
|
591
|
+
(function() {
|
|
592
|
+
CloneManager._objectType = Object.getPrototypeOf(Object);
|
|
593
|
+
})();
|
|
592
594
|
|
|
593
595
|
/**
|
|
594
596
|
* EngineObject.
|
|
595
597
|
*/ var EngineObject = /*#__PURE__*/ function() {
|
|
596
598
|
function EngineObject(engine) {
|
|
597
|
-
this._destroyed = false;
|
|
598
599
|
/** Engine unique id. */ this.instanceId = ++EngineObject._instanceIdCounter;
|
|
600
|
+
this._destroyed = false;
|
|
599
601
|
this._engine = engine;
|
|
600
602
|
}
|
|
601
603
|
var _proto = EngineObject.prototype;
|
|
@@ -611,7 +613,7 @@ CloneManager._objectType = Object.getPrototypeOf(Object);
|
|
|
611
613
|
resourceManager._deleteAsset(this);
|
|
612
614
|
resourceManager._deleteContentRestorer(this);
|
|
613
615
|
};
|
|
614
|
-
|
|
616
|
+
_create_class(EngineObject, [
|
|
615
617
|
{
|
|
616
618
|
key: "engine",
|
|
617
619
|
get: /**
|
|
@@ -631,7 +633,9 @@ CloneManager._objectType = Object.getPrototypeOf(Object);
|
|
|
631
633
|
]);
|
|
632
634
|
return EngineObject;
|
|
633
635
|
}();
|
|
634
|
-
|
|
636
|
+
(function() {
|
|
637
|
+
EngineObject._instanceIdCounter = 0;
|
|
638
|
+
})();
|
|
635
639
|
__decorate([
|
|
636
640
|
ignoreClone
|
|
637
641
|
], EngineObject.prototype, "instanceId", void 0);
|
|
@@ -648,7 +652,7 @@ __decorate([
|
|
|
648
652
|
_this = EngineObject.call(this, engine) || this;
|
|
649
653
|
/** Whether to ignore the garbage collection check, if it is true, it will not be affected by ResourceManager.gc(). */ _this.isGCIgnored = false;
|
|
650
654
|
_this._refCount = 0;
|
|
651
|
-
engine.resourceManager._addReferResource(
|
|
655
|
+
engine.resourceManager._addReferResource(_assert_this_initialized(_this));
|
|
652
656
|
return _this;
|
|
653
657
|
}
|
|
654
658
|
var _proto = ReferResource.prototype;
|
|
@@ -690,7 +694,7 @@ __decorate([
|
|
|
690
694
|
this._addReferCount(-refCount);
|
|
691
695
|
}
|
|
692
696
|
};
|
|
693
|
-
|
|
697
|
+
_create_class(ReferResource, [
|
|
694
698
|
{
|
|
695
699
|
key: "refCount",
|
|
696
700
|
get: /**
|
|
@@ -810,7 +814,7 @@ var GraphicsResource = /*#__PURE__*/ function(ReferResource) {
|
|
|
810
814
|
function GraphicsResource(engine) {
|
|
811
815
|
var _this;
|
|
812
816
|
_this = ReferResource.call(this, engine) || this;
|
|
813
|
-
engine.resourceManager._addGraphicResource(
|
|
817
|
+
engine.resourceManager._addGraphicResource(_assert_this_initialized(_this));
|
|
814
818
|
return _this;
|
|
815
819
|
}
|
|
816
820
|
var _proto = GraphicsResource.prototype;
|
|
@@ -913,7 +917,7 @@ var Logger = {
|
|
|
913
917
|
_proto._getMipmapCount = function _getMipmapCount() {
|
|
914
918
|
return this._mipmap ? Math.floor(Math.log2(Math.max(this._width, this._height))) + 1 : 1;
|
|
915
919
|
};
|
|
916
|
-
|
|
920
|
+
_create_class(Texture, [
|
|
917
921
|
{
|
|
918
922
|
key: "format",
|
|
919
923
|
get: /**
|
|
@@ -1063,7 +1067,7 @@ var Logger = {
|
|
|
1063
1067
|
}
|
|
1064
1068
|
_this._depthTexture = depth;
|
|
1065
1069
|
}
|
|
1066
|
-
_this._platformRenderTarget = engine._hardwareRenderer.createPlatformRenderTarget(
|
|
1070
|
+
_this._platformRenderTarget = engine._hardwareRenderer.createPlatformRenderTarget(_assert_this_initialized(_this));
|
|
1067
1071
|
return _this;
|
|
1068
1072
|
}
|
|
1069
1073
|
var _proto = RenderTarget.prototype;
|
|
@@ -1112,7 +1116,7 @@ var Logger = {
|
|
|
1112
1116
|
*/ _proto._rebuild = function _rebuild() {
|
|
1113
1117
|
this._platformRenderTarget = this._engine._hardwareRenderer.createPlatformRenderTarget(this);
|
|
1114
1118
|
};
|
|
1115
|
-
|
|
1119
|
+
_create_class(RenderTarget, [
|
|
1116
1120
|
{
|
|
1117
1121
|
key: "autoGenerateMipmaps",
|
|
1118
1122
|
get: /**
|
|
@@ -1184,7 +1188,7 @@ var Logger = {
|
|
|
1184
1188
|
_this._format = format;
|
|
1185
1189
|
_this._mipmapCount = _this._getMipmapCount();
|
|
1186
1190
|
_this._isDepthTexture = format == exports.TextureFormat.Depth || format == exports.TextureFormat.DepthStencil || format == exports.TextureFormat.Depth16 || format == exports.TextureFormat.Depth24 || format == exports.TextureFormat.Depth32 || format == exports.TextureFormat.Depth24Stencil8 || format == exports.TextureFormat.Depth32Stencil8;
|
|
1187
|
-
_this._platformTexture = engine._hardwareRenderer.createPlatformTexture2D(
|
|
1191
|
+
_this._platformTexture = engine._hardwareRenderer.createPlatformTexture2D(_assert_this_initialized(_this));
|
|
1188
1192
|
_this.filterMode = exports.TextureFilterMode.Bilinear;
|
|
1189
1193
|
_this.wrapModeU = _this.wrapModeV = exports.TextureWrapMode.Repeat;
|
|
1190
1194
|
return _this;
|
|
@@ -1257,7 +1261,7 @@ var Logger = {
|
|
|
1257
1261
|
_this._length = length;
|
|
1258
1262
|
_this._format = format;
|
|
1259
1263
|
_this._mipmapCount = _this._getMipmapCount();
|
|
1260
|
-
_this._platformTexture = engine._hardwareRenderer.createPlatformTexture2DArray(
|
|
1264
|
+
_this._platformTexture = engine._hardwareRenderer.createPlatformTexture2DArray(_assert_this_initialized(_this));
|
|
1261
1265
|
_this.filterMode = exports.TextureFilterMode.Bilinear;
|
|
1262
1266
|
_this.wrapModeU = _this.wrapModeV = exports.TextureWrapMode.Repeat;
|
|
1263
1267
|
return _this;
|
|
@@ -1315,7 +1319,7 @@ var Logger = {
|
|
|
1315
1319
|
this._platformTexture = this._engine._hardwareRenderer.createPlatformTexture2DArray(this);
|
|
1316
1320
|
Texture.prototype._rebuild.call(this);
|
|
1317
1321
|
};
|
|
1318
|
-
|
|
1322
|
+
_create_class(Texture2DArray, [
|
|
1319
1323
|
{
|
|
1320
1324
|
key: "length",
|
|
1321
1325
|
get: /**
|
|
@@ -1342,7 +1346,7 @@ var Logger = {
|
|
|
1342
1346
|
_this._height = size;
|
|
1343
1347
|
_this._format = format;
|
|
1344
1348
|
_this._mipmapCount = _this._getMipmapCount();
|
|
1345
|
-
_this._platformTexture = engine._hardwareRenderer.createPlatformTextureCube(
|
|
1349
|
+
_this._platformTexture = engine._hardwareRenderer.createPlatformTextureCube(_assert_this_initialized(_this));
|
|
1346
1350
|
_this.filterMode = exports.TextureFilterMode.Bilinear;
|
|
1347
1351
|
_this.wrapModeU = _this.wrapModeV = exports.TextureWrapMode.Clamp;
|
|
1348
1352
|
return _this;
|
|
@@ -1873,23 +1877,37 @@ var Logger = {
|
|
|
1873
1877
|
};
|
|
1874
1878
|
return TextUtils;
|
|
1875
1879
|
}();
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
TextUtils.
|
|
1891
|
-
|
|
1892
|
-
|
|
1880
|
+
(function() {
|
|
1881
|
+
/** @internal */ TextUtils._genericFontFamilies = [
|
|
1882
|
+
"serif",
|
|
1883
|
+
"sans-serif",
|
|
1884
|
+
"monospace",
|
|
1885
|
+
"cursive",
|
|
1886
|
+
"fantasy",
|
|
1887
|
+
"system-ui",
|
|
1888
|
+
"math",
|
|
1889
|
+
"emoji",
|
|
1890
|
+
"fangsong"
|
|
1891
|
+
];
|
|
1892
|
+
})();
|
|
1893
|
+
(function() {
|
|
1894
|
+
/** These characters are all tall to help calculate the height required for text. */ TextUtils._measureString = "|\xc9q\xc5";
|
|
1895
|
+
})();
|
|
1896
|
+
(function() {
|
|
1897
|
+
TextUtils._measureBaseline = "M";
|
|
1898
|
+
})();
|
|
1899
|
+
(function() {
|
|
1900
|
+
TextUtils._heightMultiplier = 2;
|
|
1901
|
+
})();
|
|
1902
|
+
(function() {
|
|
1903
|
+
TextUtils._baselineMultiplier = 1.4;
|
|
1904
|
+
})();
|
|
1905
|
+
(function() {
|
|
1906
|
+
TextUtils._fontSizeInfoCache = {};
|
|
1907
|
+
})();
|
|
1908
|
+
(function() {
|
|
1909
|
+
TextUtils._textContext = null;
|
|
1910
|
+
})();
|
|
1893
1911
|
|
|
1894
1912
|
/**
|
|
1895
1913
|
* @internal
|
|
@@ -2050,7 +2068,7 @@ TextUtils._textContext = null;
|
|
|
2050
2068
|
}
|
|
2051
2069
|
return null;
|
|
2052
2070
|
};
|
|
2053
|
-
|
|
2071
|
+
_create_class(Font, [
|
|
2054
2072
|
{
|
|
2055
2073
|
key: "name",
|
|
2056
2074
|
get: /**
|
|
@@ -2063,74 +2081,6 @@ TextUtils._textContext = null;
|
|
|
2063
2081
|
return Font;
|
|
2064
2082
|
}(ReferResource);
|
|
2065
2083
|
|
|
2066
|
-
var Util = {
|
|
2067
|
-
isArray: "isArray" in Array ? Array.isArray : function(value) {
|
|
2068
|
-
return toString.call(value) === "[object Array]";
|
|
2069
|
-
},
|
|
2070
|
-
isArrayLike: function isArrayLike(x) {
|
|
2071
|
-
return !!x && typeof x.length === "number" && typeof x !== "function";
|
|
2072
|
-
},
|
|
2073
|
-
clone: function clone(obj) {
|
|
2074
|
-
if (typeof obj !== "object" || obj === null) {
|
|
2075
|
-
return obj;
|
|
2076
|
-
}
|
|
2077
|
-
var rst;
|
|
2078
|
-
if (Util.isArrayLike(obj)) {
|
|
2079
|
-
rst = obj.slice();
|
|
2080
|
-
for(var i = 0, l = obj.length; i < l; i++){
|
|
2081
|
-
rst[i] = Util.clone(obj[i]);
|
|
2082
|
-
}
|
|
2083
|
-
} else {
|
|
2084
|
-
rst = {};
|
|
2085
|
-
for(var k in obj){
|
|
2086
|
-
if (obj.hasOwnProperty(k)) {
|
|
2087
|
-
rst[k] = Util.clone(obj[k]);
|
|
2088
|
-
}
|
|
2089
|
-
}
|
|
2090
|
-
}
|
|
2091
|
-
return rst;
|
|
2092
|
-
},
|
|
2093
|
-
downloadBlob: function downloadBlob(blob, fileName) {
|
|
2094
|
-
if (fileName === void 0) fileName = "";
|
|
2095
|
-
var url = engineMiniprogramAdapter.window.URL.createObjectURL(blob);
|
|
2096
|
-
var a = engineMiniprogramAdapter.document.createElement("a");
|
|
2097
|
-
engineMiniprogramAdapter.document.body.appendChild(a);
|
|
2098
|
-
a.style.display = "none";
|
|
2099
|
-
a.href = url;
|
|
2100
|
-
a.download = fileName;
|
|
2101
|
-
a.addEventListener("click", function() {
|
|
2102
|
-
if (a.parentElement) {
|
|
2103
|
-
a.parentElement.removeChild(a);
|
|
2104
|
-
}
|
|
2105
|
-
});
|
|
2106
|
-
a.click();
|
|
2107
|
-
engineMiniprogramAdapter.window.URL.revokeObjectURL(url);
|
|
2108
|
-
}
|
|
2109
|
-
};
|
|
2110
|
-
/**
|
|
2111
|
-
* Fastly remove an element from array.
|
|
2112
|
-
* @param array - Array
|
|
2113
|
-
* @param item - Element
|
|
2114
|
-
*/ function removeFromArray(array, item) {
|
|
2115
|
-
var index = array.indexOf(item);
|
|
2116
|
-
if (index < 0) {
|
|
2117
|
-
return false;
|
|
2118
|
-
}
|
|
2119
|
-
var last = array.length - 1;
|
|
2120
|
-
if (index !== last) {
|
|
2121
|
-
var end = array[last];
|
|
2122
|
-
array[index] = end;
|
|
2123
|
-
}
|
|
2124
|
-
array.length--;
|
|
2125
|
-
return true;
|
|
2126
|
-
}
|
|
2127
|
-
function ObjectValues(obj) {
|
|
2128
|
-
return Object.keys(obj).map(function(key) {
|
|
2129
|
-
return obj[key];
|
|
2130
|
-
});
|
|
2131
|
-
}
|
|
2132
|
-
|
|
2133
|
-
var _Symbol_toStringTag = Symbol.toStringTag;
|
|
2134
2084
|
var AssetPromise = /*#__PURE__*/ function() {
|
|
2135
2085
|
function AssetPromise(executor) {
|
|
2136
2086
|
var _this = this;
|
|
@@ -2249,9 +2199,9 @@ var AssetPromise = /*#__PURE__*/ function() {
|
|
|
2249
2199
|
}
|
|
2250
2200
|
});
|
|
2251
2201
|
};
|
|
2252
|
-
|
|
2202
|
+
_create_class(AssetPromise, [
|
|
2253
2203
|
{
|
|
2254
|
-
key:
|
|
2204
|
+
key: Symbol.toStringTag,
|
|
2255
2205
|
get: /** compatible with Promise */ function get() {
|
|
2256
2206
|
return "AssetPromise";
|
|
2257
2207
|
}
|
|
@@ -2299,10 +2249,25 @@ var /** @internal */ PromiseState;
|
|
|
2299
2249
|
});
|
|
2300
2250
|
return AssetPromise.all(promises);
|
|
2301
2251
|
};
|
|
2252
|
+
/**
|
|
2253
|
+
* Get the resource from cache by asset url, return the resource object if it loaded, otherwise return null.
|
|
2254
|
+
* @param url - Resource url
|
|
2255
|
+
* @returns Resource object
|
|
2256
|
+
*/ _proto.getFromCache = function getFromCache(url) {
|
|
2257
|
+
var _this__assetUrlPool_url;
|
|
2258
|
+
return (_this__assetUrlPool_url = this._assetUrlPool[url]) != null ? _this__assetUrlPool_url : null;
|
|
2259
|
+
};
|
|
2260
|
+
/**
|
|
2261
|
+
* Get asset url from instanceId.
|
|
2262
|
+
* @param instanceId - Engine instance id
|
|
2263
|
+
* @returns Asset url
|
|
2264
|
+
*/ _proto.getAssetPath = function getAssetPath(instanceId) {
|
|
2265
|
+
return this._assetPool[instanceId];
|
|
2266
|
+
};
|
|
2302
2267
|
_proto.cancelNotLoaded = function cancelNotLoaded(url) {
|
|
2303
2268
|
var _this = this;
|
|
2304
2269
|
if (!url) {
|
|
2305
|
-
|
|
2270
|
+
Utils.objectValues(this._loadingPromises).forEach(function(promise) {
|
|
2306
2271
|
promise.cancel();
|
|
2307
2272
|
});
|
|
2308
2273
|
} else if (typeof url === "string") {
|
|
@@ -2322,13 +2287,6 @@ var /** @internal */ PromiseState;
|
|
|
2322
2287
|
this._gc(false);
|
|
2323
2288
|
};
|
|
2324
2289
|
/**
|
|
2325
|
-
* Get asset url from instanceId.
|
|
2326
|
-
* @param instanceId - Engine instance id
|
|
2327
|
-
* @returns Asset url
|
|
2328
|
-
*/ _proto.getAssetPath = function getAssetPath(instanceId) {
|
|
2329
|
-
return this._assetPool[instanceId];
|
|
2330
|
-
};
|
|
2331
|
-
/**
|
|
2332
2290
|
* Add content restorer.
|
|
2333
2291
|
* @param restorer - The restorer
|
|
2334
2292
|
*/ _proto.addContentRestorer = function addContentRestorer(restorer) {
|
|
@@ -2500,7 +2458,7 @@ var /** @internal */ PromiseState;
|
|
|
2500
2458
|
}
|
|
2501
2459
|
};
|
|
2502
2460
|
_proto._gc = function _gc(forceDestroy) {
|
|
2503
|
-
var objects =
|
|
2461
|
+
var objects = Utils.objectValues(this._referResourcePool);
|
|
2504
2462
|
for(var i = 0, len = objects.length; i < len; i++){
|
|
2505
2463
|
if (!objects[i].isGCIgnored || forceDestroy) {
|
|
2506
2464
|
objects[i].destroy();
|
|
@@ -2602,8 +2560,12 @@ var /** @internal */ PromiseState;
|
|
|
2602
2560
|
};
|
|
2603
2561
|
return ResourceManager;
|
|
2604
2562
|
}();
|
|
2605
|
-
|
|
2606
|
-
ResourceManager.
|
|
2563
|
+
(function() {
|
|
2564
|
+
/** Loader collection. */ ResourceManager._loaders = {};
|
|
2565
|
+
})();
|
|
2566
|
+
(function() {
|
|
2567
|
+
ResourceManager._extTypeMapping = {};
|
|
2568
|
+
})();
|
|
2607
2569
|
/**
|
|
2608
2570
|
* Declare ResourceLoader's decorator.
|
|
2609
2571
|
* @param assetType - Type of asset
|
|
@@ -2813,7 +2775,7 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
2813
2775
|
var shaderProperty = ShaderProperty._propertyNameMap[propertyName];
|
|
2814
2776
|
return shaderProperty == null ? void 0 : shaderProperty._group;
|
|
2815
2777
|
};
|
|
2816
|
-
|
|
2778
|
+
_create_class(ShaderProperty, [
|
|
2817
2779
|
{
|
|
2818
2780
|
key: "type",
|
|
2819
2781
|
get: /**
|
|
@@ -2825,9 +2787,15 @@ var rePropName$1 = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
2825
2787
|
]);
|
|
2826
2788
|
return ShaderProperty;
|
|
2827
2789
|
}();
|
|
2828
|
-
|
|
2829
|
-
ShaderProperty.
|
|
2830
|
-
|
|
2790
|
+
(function() {
|
|
2791
|
+
/** @internal */ ShaderProperty._propertyIdMap = Object.create(null);
|
|
2792
|
+
})();
|
|
2793
|
+
(function() {
|
|
2794
|
+
ShaderProperty._propertyNameCounter = 0;
|
|
2795
|
+
})();
|
|
2796
|
+
(function() {
|
|
2797
|
+
ShaderProperty._propertyNameMap = Object.create(null);
|
|
2798
|
+
})();
|
|
2831
2799
|
|
|
2832
2800
|
/**
|
|
2833
2801
|
* Provide time related information.
|
|
@@ -2873,7 +2841,7 @@ ShaderProperty._propertyNameMap = Object.create(null);
|
|
|
2873
2841
|
deltaTimeValue.set(this._deltaTime, 0, 0, 0);
|
|
2874
2842
|
shaderData.setVector4(Time._deltaTimeProperty, deltaTimeValue);
|
|
2875
2843
|
};
|
|
2876
|
-
|
|
2844
|
+
_create_class(Time, [
|
|
2877
2845
|
{
|
|
2878
2846
|
key: "frameCount",
|
|
2879
2847
|
get: /*
|
|
@@ -2921,8 +2889,12 @@ ShaderProperty._propertyNameMap = Object.create(null);
|
|
|
2921
2889
|
]);
|
|
2922
2890
|
return Time;
|
|
2923
2891
|
}();
|
|
2924
|
-
|
|
2925
|
-
Time.
|
|
2892
|
+
(function() {
|
|
2893
|
+
Time._elapsedTimeProperty = ShaderProperty.getByName("scene_ElapsedTime");
|
|
2894
|
+
})();
|
|
2895
|
+
(function() {
|
|
2896
|
+
Time._deltaTimeProperty = ShaderProperty.getByName("scene_DeltaTime");
|
|
2897
|
+
})();
|
|
2926
2898
|
|
|
2927
2899
|
/**
|
|
2928
2900
|
* Data type enumeration
|
|
@@ -3346,7 +3318,7 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
3346
3318
|
this._enabled && this._onDisable();
|
|
3347
3319
|
}
|
|
3348
3320
|
};
|
|
3349
|
-
|
|
3321
|
+
_create_class(Component, [
|
|
3350
3322
|
{
|
|
3351
3323
|
key: "enabled",
|
|
3352
3324
|
get: /**
|
|
@@ -3469,8 +3441,12 @@ __decorate([
|
|
|
3469
3441
|
};
|
|
3470
3442
|
return ComponentsDependencies;
|
|
3471
3443
|
}();
|
|
3472
|
-
|
|
3473
|
-
ComponentsDependencies.
|
|
3444
|
+
(function() {
|
|
3445
|
+
ComponentsDependencies._invDependenciesMap = new Map();
|
|
3446
|
+
})();
|
|
3447
|
+
(function() {
|
|
3448
|
+
ComponentsDependencies._dependenciesMap = new Map();
|
|
3449
|
+
})();
|
|
3474
3450
|
function dependentComponents(componentOrComponents, dependentMode) {
|
|
3475
3451
|
if (dependentMode === void 0) dependentMode = /** Check only, throw error if dependent components do not exist. */ 0;
|
|
3476
3452
|
var components = Array.isArray(componentOrComponents) ? componentOrComponents : [
|
|
@@ -3532,6 +3508,145 @@ exports.DependentMode = void 0;
|
|
|
3532
3508
|
Layer[Layer[/** None layer. */ "Nothing"] = 0x0] = "Nothing";
|
|
3533
3509
|
})(exports.Layer || (exports.Layer = {}));
|
|
3534
3510
|
|
|
3511
|
+
var Utils = /*#__PURE__*/ function() {
|
|
3512
|
+
function Utils() {}
|
|
3513
|
+
/**
|
|
3514
|
+
* @internal
|
|
3515
|
+
*/ Utils._floatMatrixMultiply = function _floatMatrixMultiply(left, re, rOffset, oe, offset) {
|
|
3516
|
+
var le = left.elements;
|
|
3517
|
+
// prettier-ignore
|
|
3518
|
+
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];
|
|
3519
|
+
// prettier-ignore
|
|
3520
|
+
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];
|
|
3521
|
+
oe[offset] = l11 * r11 + l21 * r12 + l31 * r13 + l41 * r14;
|
|
3522
|
+
oe[offset + 1] = l12 * r11 + l22 * r12 + l32 * r13 + l42 * r14;
|
|
3523
|
+
oe[offset + 2] = l13 * r11 + l23 * r12 + l33 * r13 + l43 * r14;
|
|
3524
|
+
oe[offset + 3] = l14 * r11 + l24 * r12 + l34 * r13 + l44 * r14;
|
|
3525
|
+
oe[offset + 4] = l11 * r21 + l21 * r22 + l31 * r23 + l41 * r24;
|
|
3526
|
+
oe[offset + 5] = l12 * r21 + l22 * r22 + l32 * r23 + l42 * r24;
|
|
3527
|
+
oe[offset + 6] = l13 * r21 + l23 * r22 + l33 * r23 + l43 * r24;
|
|
3528
|
+
oe[offset + 7] = l14 * r21 + l24 * r22 + l34 * r23 + l44 * r24;
|
|
3529
|
+
oe[offset + 8] = l11 * r31 + l21 * r32 + l31 * r33 + l41 * r34;
|
|
3530
|
+
oe[offset + 9] = l12 * r31 + l22 * r32 + l32 * r33 + l42 * r34;
|
|
3531
|
+
oe[offset + 10] = l13 * r31 + l23 * r32 + l33 * r33 + l43 * r34;
|
|
3532
|
+
oe[offset + 11] = l14 * r31 + l24 * r32 + l34 * r33 + l44 * r34;
|
|
3533
|
+
oe[offset + 12] = l11 * r41 + l21 * r42 + l31 * r43 + l41 * r44;
|
|
3534
|
+
oe[offset + 13] = l12 * r41 + l22 * r42 + l32 * r43 + l42 * r44;
|
|
3535
|
+
oe[offset + 14] = l13 * r41 + l23 * r42 + l33 * r43 + l43 * r44;
|
|
3536
|
+
oe[offset + 15] = l14 * r41 + l24 * r42 + l34 * r43 + l44 * r44;
|
|
3537
|
+
};
|
|
3538
|
+
/**
|
|
3539
|
+
* @internal
|
|
3540
|
+
* Simplify lodash get: https://github.com/lodash/lodash/blob/master/get.js.
|
|
3541
|
+
* @param target - The object to query.
|
|
3542
|
+
* @param path - The path of the property to get.
|
|
3543
|
+
* @returns Returns the resolved value.
|
|
3544
|
+
*/ Utils._reflectGet = function _reflectGet(target, path) {
|
|
3545
|
+
var pathArr = this._stringToPath(path);
|
|
3546
|
+
var object = target;
|
|
3547
|
+
var index = 0;
|
|
3548
|
+
var length = pathArr.length;
|
|
3549
|
+
while(object != null && index < length){
|
|
3550
|
+
object = object[pathArr[index++]];
|
|
3551
|
+
}
|
|
3552
|
+
return index && index == length ? object : undefined;
|
|
3553
|
+
};
|
|
3554
|
+
/**
|
|
3555
|
+
* Fast remove an element from array.
|
|
3556
|
+
* @param array - Array
|
|
3557
|
+
* @param item - Element
|
|
3558
|
+
*/ Utils.removeFromArray = function removeFromArray(array, item) {
|
|
3559
|
+
var index = array.indexOf(item);
|
|
3560
|
+
if (index < 0) {
|
|
3561
|
+
return false;
|
|
3562
|
+
}
|
|
3563
|
+
var last = array.length - 1;
|
|
3564
|
+
if (index !== last) {
|
|
3565
|
+
var end = array[last];
|
|
3566
|
+
array[index] = end;
|
|
3567
|
+
}
|
|
3568
|
+
array.length--;
|
|
3569
|
+
return true;
|
|
3570
|
+
};
|
|
3571
|
+
/**
|
|
3572
|
+
* Decodes a given Uint8Array into a string.
|
|
3573
|
+
*/ Utils.decodeText = function decodeText(array) {
|
|
3574
|
+
if (typeof TextDecoder !== "undefined") {
|
|
3575
|
+
return new TextDecoder().decode(array);
|
|
3576
|
+
}
|
|
3577
|
+
// TextDecoder polyfill
|
|
3578
|
+
var s = "";
|
|
3579
|
+
for(var i = 0, il = array.length; i < il; i++){
|
|
3580
|
+
s += String.fromCharCode(array[i]);
|
|
3581
|
+
}
|
|
3582
|
+
return decodeURIComponent(encodeURIComponent(s));
|
|
3583
|
+
};
|
|
3584
|
+
/**
|
|
3585
|
+
* Judge whether the url is absolute url.
|
|
3586
|
+
* @param url - The url to be judged.
|
|
3587
|
+
* @returns Whether the url is absolute url.
|
|
3588
|
+
*/ Utils.isAbsoluteUrl = function isAbsoluteUrl(url) {
|
|
3589
|
+
return /^(?:http|blob|data:|\/)/.test(url);
|
|
3590
|
+
};
|
|
3591
|
+
/**
|
|
3592
|
+
* Get the values of an object.
|
|
3593
|
+
*/ Utils.objectValues = function objectValues(obj) {
|
|
3594
|
+
return Object.keys(obj).map(function(key) {
|
|
3595
|
+
return obj[key];
|
|
3596
|
+
});
|
|
3597
|
+
};
|
|
3598
|
+
/**
|
|
3599
|
+
* Convert a relative URL to an absolute URL based on a given base URL.
|
|
3600
|
+
* @param baseUrl - The base url.
|
|
3601
|
+
* @param relativeUrl - The relative url.
|
|
3602
|
+
* @returns The resolved url.
|
|
3603
|
+
*/ Utils.resolveAbsoluteUrl = function resolveAbsoluteUrl(baseUrl, relativeUrl) {
|
|
3604
|
+
if (Utils.isAbsoluteUrl(relativeUrl)) {
|
|
3605
|
+
return relativeUrl;
|
|
3606
|
+
}
|
|
3607
|
+
var char0 = relativeUrl.charAt(0);
|
|
3608
|
+
if (char0 === ".") {
|
|
3609
|
+
return Utils._formatRelativePath(relativeUrl + relativeUrl);
|
|
3610
|
+
}
|
|
3611
|
+
return baseUrl.substring(0, baseUrl.lastIndexOf("/") + 1) + relativeUrl;
|
|
3612
|
+
};
|
|
3613
|
+
Utils._stringToPath = function _stringToPath(string) {
|
|
3614
|
+
var result = [];
|
|
3615
|
+
if (string.charCodeAt(0) === charCodeOfDot) {
|
|
3616
|
+
result.push("");
|
|
3617
|
+
}
|
|
3618
|
+
string.replace(rePropName, function(match, expression, quote, subString) {
|
|
3619
|
+
var key = match;
|
|
3620
|
+
if (quote) {
|
|
3621
|
+
key = subString.replace(reEscapeChar, "$1");
|
|
3622
|
+
} else if (expression) {
|
|
3623
|
+
key = expression.trim();
|
|
3624
|
+
}
|
|
3625
|
+
result.push(key);
|
|
3626
|
+
});
|
|
3627
|
+
return result;
|
|
3628
|
+
};
|
|
3629
|
+
Utils._formatRelativePath = function _formatRelativePath(value) {
|
|
3630
|
+
var parts = value.split("/");
|
|
3631
|
+
for(var i = 0, n = parts.length; i < n; i++){
|
|
3632
|
+
if (parts[i] == "..") {
|
|
3633
|
+
parts.splice(i - 1, 2);
|
|
3634
|
+
i -= 2;
|
|
3635
|
+
}
|
|
3636
|
+
}
|
|
3637
|
+
return parts.join("/");
|
|
3638
|
+
};
|
|
3639
|
+
return Utils;
|
|
3640
|
+
}();
|
|
3641
|
+
var charCodeOfDot = ".".charCodeAt(0);
|
|
3642
|
+
var reEscapeChar = /\\(\\)?/g;
|
|
3643
|
+
var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
3644
|
+
"[^.[\\]]+" + "|" + // Or match property names within brackets.
|
|
3645
|
+
"\\[(?:" + // Match a non-string expression.
|
|
3646
|
+
"([^\"'][^[]*)" + "|" + // Or match strings (supports escaping characters).
|
|
3647
|
+
"([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2" + ")\\]" + "|" + // Or match "" as the space between consecutive dots or empty brackets.
|
|
3648
|
+
"(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))", "g");
|
|
3649
|
+
|
|
3535
3650
|
/**
|
|
3536
3651
|
* Used to update tags.
|
|
3537
3652
|
*/ var UpdateFlag = /*#__PURE__*/ function() {
|
|
@@ -3554,7 +3669,7 @@ exports.DependentMode = void 0;
|
|
|
3554
3669
|
_proto._removeFromManagers = function _removeFromManagers() {
|
|
3555
3670
|
var flagManagers = this._flagManagers;
|
|
3556
3671
|
for(var i = 0, n = flagManagers.length; i < n; i++){
|
|
3557
|
-
removeFromArray(flagManagers[i]._updateFlags, this);
|
|
3672
|
+
Utils.removeFromArray(flagManagers[i]._updateFlags, this);
|
|
3558
3673
|
}
|
|
3559
3674
|
};
|
|
3560
3675
|
return UpdateFlag;
|
|
@@ -3606,9 +3721,9 @@ exports.DependentMode = void 0;
|
|
|
3606
3721
|
* Remove a UpdateFlag.
|
|
3607
3722
|
* @param flag - The UpdateFlag.
|
|
3608
3723
|
*/ _proto.removeFlag = function removeFlag(flag) {
|
|
3609
|
-
var success = removeFromArray(this._updateFlags, flag);
|
|
3724
|
+
var success = Utils.removeFromArray(this._updateFlags, flag);
|
|
3610
3725
|
if (success) {
|
|
3611
|
-
removeFromArray(flag._flagManagers, this);
|
|
3726
|
+
Utils.removeFromArray(flag._flagManagers, this);
|
|
3612
3727
|
}
|
|
3613
3728
|
};
|
|
3614
3729
|
/**
|
|
@@ -3621,7 +3736,7 @@ exports.DependentMode = void 0;
|
|
|
3621
3736
|
* Remove a listener.
|
|
3622
3737
|
* @param listener - The listener
|
|
3623
3738
|
*/ _proto.removeListener = function removeListener(listener) {
|
|
3624
|
-
removeFromArray(this._listeners, listener);
|
|
3739
|
+
Utils.removeFromArray(this._listeners, listener);
|
|
3625
3740
|
};
|
|
3626
3741
|
/**
|
|
3627
3742
|
* Dispatch a event.
|
|
@@ -3647,7 +3762,6 @@ exports.DependentMode = void 0;
|
|
|
3647
3762
|
function Transform(entity) {
|
|
3648
3763
|
var _this;
|
|
3649
3764
|
_this = Component.call(this, entity) || this;
|
|
3650
|
-
_this._dirtyFlag = 0xbc;
|
|
3651
3765
|
_this._position = new miniprogram.Vector3();
|
|
3652
3766
|
_this._rotation = new miniprogram.Vector3();
|
|
3653
3767
|
_this._rotationQuaternion = new miniprogram.Quaternion();
|
|
@@ -3663,14 +3777,15 @@ exports.DependentMode = void 0;
|
|
|
3663
3777
|
_this._worldUp = null;
|
|
3664
3778
|
_this._isParentDirty = true;
|
|
3665
3779
|
_this._parentTransformCache = null;
|
|
3780
|
+
_this._dirtyFlag = 0xbc;
|
|
3666
3781
|
/** @internal */ _this._updateFlagManager = new UpdateFlagManager();
|
|
3667
|
-
_this._onPositionChanged = _this._onPositionChanged.bind(
|
|
3668
|
-
_this._onWorldPositionChanged = _this._onWorldPositionChanged.bind(
|
|
3669
|
-
_this._onRotationChanged = _this._onRotationChanged.bind(
|
|
3670
|
-
_this._onWorldRotationChanged = _this._onWorldRotationChanged.bind(
|
|
3671
|
-
_this._onRotationQuaternionChanged = _this._onRotationQuaternionChanged.bind(
|
|
3672
|
-
_this._onWorldRotationQuaternionChanged = _this._onWorldRotationQuaternionChanged.bind(
|
|
3673
|
-
_this._onScaleChanged = _this._onScaleChanged.bind(
|
|
3782
|
+
_this._onPositionChanged = _this._onPositionChanged.bind(_assert_this_initialized(_this));
|
|
3783
|
+
_this._onWorldPositionChanged = _this._onWorldPositionChanged.bind(_assert_this_initialized(_this));
|
|
3784
|
+
_this._onRotationChanged = _this._onRotationChanged.bind(_assert_this_initialized(_this));
|
|
3785
|
+
_this._onWorldRotationChanged = _this._onWorldRotationChanged.bind(_assert_this_initialized(_this));
|
|
3786
|
+
_this._onRotationQuaternionChanged = _this._onRotationQuaternionChanged.bind(_assert_this_initialized(_this));
|
|
3787
|
+
_this._onWorldRotationQuaternionChanged = _this._onWorldRotationQuaternionChanged.bind(_assert_this_initialized(_this));
|
|
3788
|
+
_this._onScaleChanged = _this._onScaleChanged.bind(_assert_this_initialized(_this));
|
|
3674
3789
|
//@ts-ignore
|
|
3675
3790
|
_this._position._onValueChanged = _this._onPositionChanged;
|
|
3676
3791
|
//@ts-ignore
|
|
@@ -4035,7 +4150,7 @@ exports.DependentMode = void 0;
|
|
|
4035
4150
|
this._setDirtyFlagTrue(0x40);
|
|
4036
4151
|
this._updateWorldScaleFlag();
|
|
4037
4152
|
};
|
|
4038
|
-
|
|
4153
|
+
_create_class(Transform, [
|
|
4039
4154
|
{
|
|
4040
4155
|
key: "position",
|
|
4041
4156
|
get: /**
|
|
@@ -4314,15 +4429,33 @@ exports.DependentMode = void 0;
|
|
|
4314
4429
|
]);
|
|
4315
4430
|
return Transform;
|
|
4316
4431
|
}(Component);
|
|
4317
|
-
|
|
4318
|
-
Transform.
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
Transform.
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
Transform.
|
|
4325
|
-
|
|
4432
|
+
(function() {
|
|
4433
|
+
Transform._tempQuat0 = new miniprogram.Quaternion();
|
|
4434
|
+
})();
|
|
4435
|
+
(function() {
|
|
4436
|
+
Transform._tempVec30 = new miniprogram.Vector3();
|
|
4437
|
+
})();
|
|
4438
|
+
(function() {
|
|
4439
|
+
Transform._tempVec31 = new miniprogram.Vector3();
|
|
4440
|
+
})();
|
|
4441
|
+
(function() {
|
|
4442
|
+
Transform._tempVec32 = new miniprogram.Vector3();
|
|
4443
|
+
})();
|
|
4444
|
+
(function() {
|
|
4445
|
+
Transform._tempMat30 = new miniprogram.Matrix3x3();
|
|
4446
|
+
})();
|
|
4447
|
+
(function() {
|
|
4448
|
+
Transform._tempMat31 = new miniprogram.Matrix3x3();
|
|
4449
|
+
})();
|
|
4450
|
+
(function() {
|
|
4451
|
+
Transform._tempMat32 = new miniprogram.Matrix3x3();
|
|
4452
|
+
})();
|
|
4453
|
+
(function() {
|
|
4454
|
+
Transform._tempMat41 = new miniprogram.Matrix();
|
|
4455
|
+
})();
|
|
4456
|
+
(function() {
|
|
4457
|
+
Transform._tempMat42 = new miniprogram.Matrix();
|
|
4458
|
+
})();
|
|
4326
4459
|
__decorate([
|
|
4327
4460
|
deepClone
|
|
4328
4461
|
], Transform.prototype, "_position", void 0);
|
|
@@ -4831,7 +4964,7 @@ var TransformModifyFlags;
|
|
|
4831
4964
|
this._traverseSetOwnerScene(children[i], scene);
|
|
4832
4965
|
}
|
|
4833
4966
|
};
|
|
4834
|
-
|
|
4967
|
+
_create_class(Entity, [
|
|
4835
4968
|
{
|
|
4836
4969
|
key: "isActive",
|
|
4837
4970
|
get: /**
|
|
@@ -5049,7 +5182,7 @@ var TransformModifyFlags;
|
|
|
5049
5182
|
}
|
|
5050
5183
|
}
|
|
5051
5184
|
};
|
|
5052
|
-
|
|
5185
|
+
_create_class(SystemInfo, null, [
|
|
5053
5186
|
{
|
|
5054
5187
|
key: "devicePixelRatio",
|
|
5055
5188
|
get: /**
|
|
@@ -5061,8 +5194,12 @@ var TransformModifyFlags;
|
|
|
5061
5194
|
]);
|
|
5062
5195
|
return SystemInfo;
|
|
5063
5196
|
}();
|
|
5064
|
-
|
|
5065
|
-
/** The
|
|
5197
|
+
(function() {
|
|
5198
|
+
/** The platform is running on. */ SystemInfo.platform = exports.Platform.Unknown;
|
|
5199
|
+
})();
|
|
5200
|
+
(function() {
|
|
5201
|
+
/** The operating system is running on. */ SystemInfo.operatingSystem = "";
|
|
5202
|
+
})();
|
|
5066
5203
|
SystemInfo._initialize();
|
|
5067
5204
|
|
|
5068
5205
|
/**
|
|
@@ -5699,7 +5836,7 @@ var Collision = function Collision() {
|
|
|
5699
5836
|
_proto._setGravity = function _setGravity() {
|
|
5700
5837
|
this._nativePhysicsManager.setGravity(this._gravity);
|
|
5701
5838
|
};
|
|
5702
|
-
|
|
5839
|
+
_create_class(PhysicsManager, [
|
|
5703
5840
|
{
|
|
5704
5841
|
key: "gravity",
|
|
5705
5842
|
get: /**
|
|
@@ -5717,7 +5854,9 @@ var Collision = function Collision() {
|
|
|
5717
5854
|
]);
|
|
5718
5855
|
return PhysicsManager;
|
|
5719
5856
|
}();
|
|
5720
|
-
|
|
5857
|
+
(function() {
|
|
5858
|
+
PhysicsManager._collision = new Collision();
|
|
5859
|
+
})();
|
|
5721
5860
|
|
|
5722
5861
|
/**
|
|
5723
5862
|
* Describes how physics materials of the colliding objects are combined.
|
|
@@ -5746,7 +5885,7 @@ PhysicsManager._collision = new Collision();
|
|
|
5746
5885
|
*/ _proto._destroy = function _destroy() {
|
|
5747
5886
|
this._nativeMaterial.destroy();
|
|
5748
5887
|
};
|
|
5749
|
-
|
|
5888
|
+
_create_class(PhysicsMaterial, [
|
|
5750
5889
|
{
|
|
5751
5890
|
key: "bounciness",
|
|
5752
5891
|
get: /**
|
|
@@ -5826,8 +5965,8 @@ exports.Collider = /*#__PURE__*/ function(Component) {
|
|
|
5826
5965
|
function Collider(entity) {
|
|
5827
5966
|
var _this;
|
|
5828
5967
|
_this = Component.call(this, entity) || this;
|
|
5829
|
-
_this._shapes = [];
|
|
5830
5968
|
/** @internal */ _this._index = -1;
|
|
5969
|
+
_this._shapes = [];
|
|
5831
5970
|
_this._updateFlag = _this.entity.transform.registerWorldChangeFlag();
|
|
5832
5971
|
return _this;
|
|
5833
5972
|
}
|
|
@@ -5907,7 +6046,7 @@ exports.Collider = /*#__PURE__*/ function(Component) {
|
|
|
5907
6046
|
this.clearShapes();
|
|
5908
6047
|
this._nativeCollider.destroy();
|
|
5909
6048
|
};
|
|
5910
|
-
|
|
6049
|
+
_create_class(Collider, [
|
|
5911
6050
|
{
|
|
5912
6051
|
key: "shapes",
|
|
5913
6052
|
get: /**
|
|
@@ -5947,7 +6086,7 @@ exports.Collider = __decorate([
|
|
|
5947
6086
|
_this._upDirection = new miniprogram.Vector3(0, 1, 0);
|
|
5948
6087
|
_this._slopeLimit = 0.707;
|
|
5949
6088
|
_this._nativeCollider = PhysicsManager._nativePhysics.createCharacterController();
|
|
5950
|
-
_this._setUpDirection = _this._setUpDirection.bind(
|
|
6089
|
+
_this._setUpDirection = _this._setUpDirection.bind(_assert_this_initialized(_this));
|
|
5951
6090
|
//@ts-ignore
|
|
5952
6091
|
_this._upDirection._onValueChanged = _this._setUpDirection;
|
|
5953
6092
|
return _this;
|
|
@@ -6020,7 +6159,7 @@ exports.Collider = __decorate([
|
|
|
6020
6159
|
_proto._setUpDirection = function _setUpDirection() {
|
|
6021
6160
|
this._nativeCollider.setUpDirection(this._upDirection);
|
|
6022
6161
|
};
|
|
6023
|
-
|
|
6162
|
+
_create_class(CharacterController, [
|
|
6024
6163
|
{
|
|
6025
6164
|
key: "stepOffset",
|
|
6026
6165
|
get: /**
|
|
@@ -6115,7 +6254,7 @@ exports.Collider = __decorate([
|
|
|
6115
6254
|
_proto._setRotation = function _setRotation() {
|
|
6116
6255
|
this._nativeShape.setRotation(this._rotation);
|
|
6117
6256
|
};
|
|
6118
|
-
|
|
6257
|
+
_create_class(ColliderShape, [
|
|
6119
6258
|
{
|
|
6120
6259
|
key: "collider",
|
|
6121
6260
|
get: /**
|
|
@@ -6203,7 +6342,9 @@ exports.Collider = __decorate([
|
|
|
6203
6342
|
]);
|
|
6204
6343
|
return ColliderShape;
|
|
6205
6344
|
}();
|
|
6206
|
-
|
|
6345
|
+
(function() {
|
|
6346
|
+
ColliderShape._idGenerator = 0;
|
|
6347
|
+
})();
|
|
6207
6348
|
|
|
6208
6349
|
/**
|
|
6209
6350
|
* Physical collider shape for box.
|
|
@@ -6214,7 +6355,7 @@ ColliderShape._idGenerator = 0;
|
|
|
6214
6355
|
_this = ColliderShape.call(this) || this;
|
|
6215
6356
|
_this._size = new miniprogram.Vector3(1, 1, 1);
|
|
6216
6357
|
_this._nativeShape = PhysicsManager._nativePhysics.createBoxColliderShape(_this._id, _this._size, _this._material._nativeMaterial);
|
|
6217
|
-
_this._setSize = _this._setSize.bind(
|
|
6358
|
+
_this._setSize = _this._setSize.bind(_assert_this_initialized(_this));
|
|
6218
6359
|
//@ts-ignore
|
|
6219
6360
|
_this._size._onValueChanged = _this._setSize;
|
|
6220
6361
|
return _this;
|
|
@@ -6223,7 +6364,7 @@ ColliderShape._idGenerator = 0;
|
|
|
6223
6364
|
_proto._setSize = function _setSize() {
|
|
6224
6365
|
this._nativeShape.setSize(this._size);
|
|
6225
6366
|
};
|
|
6226
|
-
|
|
6367
|
+
_create_class(BoxColliderShape, [
|
|
6227
6368
|
{
|
|
6228
6369
|
key: "size",
|
|
6229
6370
|
get: /**
|
|
@@ -6252,7 +6393,7 @@ ColliderShape._idGenerator = 0;
|
|
|
6252
6393
|
_this._nativeShape = PhysicsManager._nativePhysics.createSphereColliderShape(_this._id, _this._radius, _this._material._nativeMaterial);
|
|
6253
6394
|
return _this;
|
|
6254
6395
|
}
|
|
6255
|
-
|
|
6396
|
+
_create_class(SphereColliderShape, [
|
|
6256
6397
|
{
|
|
6257
6398
|
key: "radius",
|
|
6258
6399
|
get: /**
|
|
@@ -6306,7 +6447,7 @@ ColliderShape._idGenerator = 0;
|
|
|
6306
6447
|
_this._nativeShape = PhysicsManager._nativePhysics.createCapsuleColliderShape(_this._id, _this._radius, _this._height, _this._material._nativeMaterial);
|
|
6307
6448
|
return _this;
|
|
6308
6449
|
}
|
|
6309
|
-
|
|
6450
|
+
_create_class(CapsuleColliderShape, [
|
|
6310
6451
|
{
|
|
6311
6452
|
key: "radius",
|
|
6312
6453
|
get: /**
|
|
@@ -6365,7 +6506,7 @@ exports.Joint = /*#__PURE__*/ function(Component) {
|
|
|
6365
6506
|
_this._connectedCollider.localPosition = new miniprogram.Vector3();
|
|
6366
6507
|
return _this;
|
|
6367
6508
|
}
|
|
6368
|
-
|
|
6509
|
+
_create_class(Joint, [
|
|
6369
6510
|
{
|
|
6370
6511
|
key: "connectedCollider",
|
|
6371
6512
|
get: /**
|
|
@@ -6545,7 +6686,7 @@ exports.Joint = __decorate([
|
|
|
6545
6686
|
collider.collider = this.entity.getComponent(exports.Collider);
|
|
6546
6687
|
this._nativeJoint = PhysicsManager._nativePhysics.createHingeJoint(collider.collider._nativeCollider);
|
|
6547
6688
|
};
|
|
6548
|
-
|
|
6689
|
+
_create_class(HingeJoint, [
|
|
6549
6690
|
{
|
|
6550
6691
|
key: "axis",
|
|
6551
6692
|
get: /**
|
|
@@ -6697,7 +6838,7 @@ exports.Joint = __decorate([
|
|
|
6697
6838
|
collider.collider = this.entity.getComponent(exports.Collider);
|
|
6698
6839
|
this._nativeJoint = PhysicsManager._nativePhysics.createSpringJoint(collider.collider._nativeCollider);
|
|
6699
6840
|
};
|
|
6700
|
-
|
|
6841
|
+
_create_class(SpringJoint, [
|
|
6701
6842
|
{
|
|
6702
6843
|
key: "swingOffset",
|
|
6703
6844
|
get: /**
|
|
@@ -6853,10 +6994,10 @@ exports.Joint = __decorate([
|
|
|
6853
6994
|
_this._sleepThreshold = 5e-3;
|
|
6854
6995
|
var transform = _this.entity.transform;
|
|
6855
6996
|
_this._nativeCollider = PhysicsManager._nativePhysics.createDynamicCollider(transform.worldPosition, transform.worldRotationQuaternion);
|
|
6856
|
-
_this._setLinearVelocity = _this._setLinearVelocity.bind(
|
|
6857
|
-
_this._setAngularVelocity = _this._setAngularVelocity.bind(
|
|
6858
|
-
_this._setCenterOfMass = _this._setCenterOfMass.bind(
|
|
6859
|
-
_this._setInertiaTensor = _this._setInertiaTensor.bind(
|
|
6997
|
+
_this._setLinearVelocity = _this._setLinearVelocity.bind(_assert_this_initialized(_this));
|
|
6998
|
+
_this._setAngularVelocity = _this._setAngularVelocity.bind(_assert_this_initialized(_this));
|
|
6999
|
+
_this._setCenterOfMass = _this._setCenterOfMass.bind(_assert_this_initialized(_this));
|
|
7000
|
+
_this._setInertiaTensor = _this._setInertiaTensor.bind(_assert_this_initialized(_this));
|
|
6860
7001
|
//@ts-ignore
|
|
6861
7002
|
_this._linearVelocity._onValueChanged = _this._setLinearVelocity;
|
|
6862
7003
|
//@ts-ignore
|
|
@@ -6914,7 +7055,7 @@ exports.Joint = __decorate([
|
|
|
6914
7055
|
_proto._setInertiaTensor = function _setInertiaTensor() {
|
|
6915
7056
|
this._nativeCollider.setInertiaTensor(this._inertiaTensor);
|
|
6916
7057
|
};
|
|
6917
|
-
|
|
7058
|
+
_create_class(DynamicCollider, [
|
|
6918
7059
|
{
|
|
6919
7060
|
key: "linearDamping",
|
|
6920
7061
|
get: /**
|
|
@@ -7461,9 +7602,15 @@ exports.DynamicColliderConstraints = void 0;
|
|
|
7461
7602
|
};
|
|
7462
7603
|
return PointerManager;
|
|
7463
7604
|
}();
|
|
7464
|
-
|
|
7465
|
-
PointerManager.
|
|
7466
|
-
|
|
7605
|
+
(function() {
|
|
7606
|
+
PointerManager._tempRay = new miniprogram.Ray();
|
|
7607
|
+
})();
|
|
7608
|
+
(function() {
|
|
7609
|
+
PointerManager._tempPoint = new miniprogram.Vector2();
|
|
7610
|
+
})();
|
|
7611
|
+
(function() {
|
|
7612
|
+
PointerManager._tempHitResult = new HitResult();
|
|
7613
|
+
})();
|
|
7467
7614
|
|
|
7468
7615
|
/**
|
|
7469
7616
|
* Wheel Manager.
|
|
@@ -7670,7 +7817,7 @@ PointerManager._tempHitResult = new HitResult();
|
|
|
7670
7817
|
this._pointerManager._onFocus();
|
|
7671
7818
|
this._keyboardManager._onFocus();
|
|
7672
7819
|
};
|
|
7673
|
-
|
|
7820
|
+
_create_class(InputManager, [
|
|
7674
7821
|
{
|
|
7675
7822
|
key: "pointers",
|
|
7676
7823
|
get: /**
|
|
@@ -7749,9 +7896,9 @@ PointerManager._tempHitResult = new HitResult();
|
|
|
7749
7896
|
/** Shadow mapping normal-based bias. */ _this.shadowNormalBias = 1;
|
|
7750
7897
|
/** Near plane value to use for shadow frustums. */ _this.shadowNearPlane = 0.1;
|
|
7751
7898
|
/** Shadow intensity, the larger the value, the clearer and darker the shadow. */ _this.shadowStrength = 1.0;
|
|
7899
|
+
/** @internal */ _this._lightIndex = -1;
|
|
7752
7900
|
_this._color = new miniprogram.Color(1, 1, 1, 1);
|
|
7753
7901
|
_this._lightColor = new miniprogram.Color();
|
|
7754
|
-
/** @internal */ _this._lightIndex = -1;
|
|
7755
7902
|
return _this;
|
|
7756
7903
|
}
|
|
7757
7904
|
var _proto = Light.prototype;
|
|
@@ -7762,7 +7909,7 @@ PointerManager._tempHitResult = new HitResult();
|
|
|
7762
7909
|
this._lightColor.a = this.color.a * this.intensity;
|
|
7763
7910
|
return this._lightColor;
|
|
7764
7911
|
};
|
|
7765
|
-
|
|
7912
|
+
_create_class(Light, [
|
|
7766
7913
|
{
|
|
7767
7914
|
key: "color",
|
|
7768
7915
|
get: /**
|
|
@@ -7799,9 +7946,11 @@ PointerManager._tempHitResult = new HitResult();
|
|
|
7799
7946
|
]);
|
|
7800
7947
|
return Light;
|
|
7801
7948
|
}(Component);
|
|
7802
|
-
|
|
7949
|
+
(function() {
|
|
7950
|
+
/**
|
|
7803
7951
|
* Each type of light source is at most 10, beyond which it will not take effect.
|
|
7804
7952
|
* */ Light._maxLight = 10;
|
|
7953
|
+
})();
|
|
7805
7954
|
__decorate([
|
|
7806
7955
|
ignoreClone
|
|
7807
7956
|
], Light.prototype, "_lightIndex", void 0);
|
|
@@ -7858,7 +8007,7 @@ __decorate([
|
|
|
7858
8007
|
shaderData.setFloatArray(DirectLight._colorProperty, data.color);
|
|
7859
8008
|
shaderData.setFloatArray(DirectLight._directionProperty, data.direction);
|
|
7860
8009
|
};
|
|
7861
|
-
|
|
8010
|
+
_create_class(DirectLight, [
|
|
7862
8011
|
{
|
|
7863
8012
|
key: "direction",
|
|
7864
8013
|
get: /**
|
|
@@ -7888,14 +8037,22 @@ __decorate([
|
|
|
7888
8037
|
]);
|
|
7889
8038
|
return DirectLight;
|
|
7890
8039
|
}(Light);
|
|
7891
|
-
|
|
7892
|
-
DirectLight.
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
8040
|
+
(function() {
|
|
8041
|
+
DirectLight._cullingMaskProperty = ShaderProperty.getByName("scene_DirectLightCullingMask");
|
|
8042
|
+
})();
|
|
8043
|
+
(function() {
|
|
8044
|
+
DirectLight._colorProperty = ShaderProperty.getByName("scene_DirectLightColor");
|
|
8045
|
+
})();
|
|
8046
|
+
(function() {
|
|
8047
|
+
DirectLight._directionProperty = ShaderProperty.getByName("scene_DirectLightDirection");
|
|
8048
|
+
})();
|
|
8049
|
+
(function() {
|
|
8050
|
+
DirectLight._combinedData = {
|
|
8051
|
+
cullingMask: new Int32Array(Light._maxLight * 2),
|
|
8052
|
+
color: new Float32Array(Light._maxLight * 3),
|
|
8053
|
+
direction: new Float32Array(Light._maxLight * 3)
|
|
8054
|
+
};
|
|
8055
|
+
})();
|
|
7899
8056
|
|
|
7900
8057
|
/**
|
|
7901
8058
|
* Point light.
|
|
@@ -7952,7 +8109,7 @@ DirectLight._combinedData = {
|
|
|
7952
8109
|
shaderData.setFloatArray(PointLight._positionProperty, data.position);
|
|
7953
8110
|
shaderData.setFloatArray(PointLight._distanceProperty, data.distance);
|
|
7954
8111
|
};
|
|
7955
|
-
|
|
8112
|
+
_create_class(PointLight, [
|
|
7956
8113
|
{
|
|
7957
8114
|
key: "position",
|
|
7958
8115
|
get: /**
|
|
@@ -7973,16 +8130,26 @@ DirectLight._combinedData = {
|
|
|
7973
8130
|
]);
|
|
7974
8131
|
return PointLight;
|
|
7975
8132
|
}(Light);
|
|
7976
|
-
|
|
7977
|
-
PointLight.
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
PointLight.
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
|
|
8133
|
+
(function() {
|
|
8134
|
+
PointLight._cullingMaskProperty = ShaderProperty.getByName("scene_PointLightCullingMask");
|
|
8135
|
+
})();
|
|
8136
|
+
(function() {
|
|
8137
|
+
PointLight._colorProperty = ShaderProperty.getByName("scene_PointLightColor");
|
|
8138
|
+
})();
|
|
8139
|
+
(function() {
|
|
8140
|
+
PointLight._positionProperty = ShaderProperty.getByName("scene_PointLightPosition");
|
|
8141
|
+
})();
|
|
8142
|
+
(function() {
|
|
8143
|
+
PointLight._distanceProperty = ShaderProperty.getByName("scene_PointLightDistance");
|
|
8144
|
+
})();
|
|
8145
|
+
(function() {
|
|
8146
|
+
PointLight._combinedData = {
|
|
8147
|
+
cullingMask: new Int32Array(Light._maxLight * 2),
|
|
8148
|
+
color: new Float32Array(Light._maxLight * 3),
|
|
8149
|
+
position: new Float32Array(Light._maxLight * 3),
|
|
8150
|
+
distance: new Float32Array(Light._maxLight)
|
|
8151
|
+
};
|
|
8152
|
+
})();
|
|
7986
8153
|
|
|
7987
8154
|
/**
|
|
7988
8155
|
* Spot light.
|
|
@@ -8055,7 +8222,7 @@ PointLight._combinedData = {
|
|
|
8055
8222
|
shaderData.setFloatArray(SpotLight._angleCosProperty, data.angleCos);
|
|
8056
8223
|
shaderData.setFloatArray(SpotLight._penumbraCosProperty, data.penumbraCos);
|
|
8057
8224
|
};
|
|
8058
|
-
|
|
8225
|
+
_create_class(SpotLight, [
|
|
8059
8226
|
{
|
|
8060
8227
|
key: "position",
|
|
8061
8228
|
get: /**
|
|
@@ -8096,22 +8263,38 @@ PointLight._combinedData = {
|
|
|
8096
8263
|
]);
|
|
8097
8264
|
return SpotLight;
|
|
8098
8265
|
}(Light);
|
|
8099
|
-
|
|
8100
|
-
SpotLight.
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
SpotLight.
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
SpotLight.
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
|
|
8114
|
-
|
|
8266
|
+
(function() {
|
|
8267
|
+
SpotLight._cullingMaskProperty = ShaderProperty.getByName("scene_SpotLightCullingMask");
|
|
8268
|
+
})();
|
|
8269
|
+
(function() {
|
|
8270
|
+
SpotLight._colorProperty = ShaderProperty.getByName("scene_SpotLightColor");
|
|
8271
|
+
})();
|
|
8272
|
+
(function() {
|
|
8273
|
+
SpotLight._positionProperty = ShaderProperty.getByName("scene_SpotLightPosition");
|
|
8274
|
+
})();
|
|
8275
|
+
(function() {
|
|
8276
|
+
SpotLight._directionProperty = ShaderProperty.getByName("scene_SpotLightDirection");
|
|
8277
|
+
})();
|
|
8278
|
+
(function() {
|
|
8279
|
+
SpotLight._distanceProperty = ShaderProperty.getByName("scene_SpotLightDistance");
|
|
8280
|
+
})();
|
|
8281
|
+
(function() {
|
|
8282
|
+
SpotLight._angleCosProperty = ShaderProperty.getByName("scene_SpotLightAngleCos");
|
|
8283
|
+
})();
|
|
8284
|
+
(function() {
|
|
8285
|
+
SpotLight._penumbraCosProperty = ShaderProperty.getByName("scene_SpotLightPenumbraCos");
|
|
8286
|
+
})();
|
|
8287
|
+
(function() {
|
|
8288
|
+
SpotLight._combinedData = {
|
|
8289
|
+
cullingMask: new Int32Array(Light._maxLight * 2),
|
|
8290
|
+
color: new Float32Array(Light._maxLight * 3),
|
|
8291
|
+
position: new Float32Array(Light._maxLight * 3),
|
|
8292
|
+
direction: new Float32Array(Light._maxLight * 3),
|
|
8293
|
+
distance: new Float32Array(Light._maxLight),
|
|
8294
|
+
angleCos: new Float32Array(Light._maxLight),
|
|
8295
|
+
penumbraCos: new Float32Array(Light._maxLight)
|
|
8296
|
+
};
|
|
8297
|
+
})();
|
|
8115
8298
|
|
|
8116
8299
|
/**
|
|
8117
8300
|
* Light manager.
|
|
@@ -8212,21 +8395,21 @@ SpotLight._combinedData = {
|
|
|
8212
8395
|
}
|
|
8213
8396
|
if (directLightCount) {
|
|
8214
8397
|
DirectLight._updateShaderData(shaderData);
|
|
8215
|
-
shaderData.enableMacro("
|
|
8398
|
+
shaderData.enableMacro("SCENE_DIRECT_LIGHT_COUNT", directLightCount.toString());
|
|
8216
8399
|
} else {
|
|
8217
|
-
shaderData.disableMacro("
|
|
8400
|
+
shaderData.disableMacro("SCENE_DIRECT_LIGHT_COUNT");
|
|
8218
8401
|
}
|
|
8219
8402
|
if (pointLightCount) {
|
|
8220
8403
|
PointLight._updateShaderData(shaderData);
|
|
8221
|
-
shaderData.enableMacro("
|
|
8404
|
+
shaderData.enableMacro("SCENE_POINT_LIGHT_COUNT", pointLightCount.toString());
|
|
8222
8405
|
} else {
|
|
8223
|
-
shaderData.disableMacro("
|
|
8406
|
+
shaderData.disableMacro("SCENE_POINT_LIGHT_COUNT");
|
|
8224
8407
|
}
|
|
8225
8408
|
if (spotLightCount) {
|
|
8226
8409
|
SpotLight._updateShaderData(shaderData);
|
|
8227
|
-
shaderData.enableMacro("
|
|
8410
|
+
shaderData.enableMacro("SCENE_SPOT_LIGHT_COUNT", spotLightCount.toString());
|
|
8228
8411
|
} else {
|
|
8229
|
-
shaderData.disableMacro("
|
|
8412
|
+
shaderData.disableMacro("SCENE_SPOT_LIGHT_COUNT");
|
|
8230
8413
|
}
|
|
8231
8414
|
};
|
|
8232
8415
|
return LightManager;
|
|
@@ -8312,11 +8495,21 @@ SpotLight._combinedData = {
|
|
|
8312
8495
|
};
|
|
8313
8496
|
return ShaderMacro;
|
|
8314
8497
|
}();
|
|
8315
|
-
|
|
8316
|
-
/** @internal */ ShaderMacro.
|
|
8317
|
-
|
|
8318
|
-
|
|
8319
|
-
ShaderMacro.
|
|
8498
|
+
(function() {
|
|
8499
|
+
/** @internal */ ShaderMacro._macroMaskMap = [];
|
|
8500
|
+
})();
|
|
8501
|
+
(function() {
|
|
8502
|
+
/** @internal */ ShaderMacro._macroNameIdMap = Object.create(null);
|
|
8503
|
+
})();
|
|
8504
|
+
(function() {
|
|
8505
|
+
ShaderMacro._macroNameCounter = 0;
|
|
8506
|
+
})();
|
|
8507
|
+
(function() {
|
|
8508
|
+
ShaderMacro._macroCounter = 0;
|
|
8509
|
+
})();
|
|
8510
|
+
(function() {
|
|
8511
|
+
ShaderMacro._macroMap = Object.create(null);
|
|
8512
|
+
})();
|
|
8320
8513
|
|
|
8321
8514
|
/**
|
|
8322
8515
|
* Shader macro collection.
|
|
@@ -9234,7 +9427,7 @@ ShaderMacro._macroMap = Object.create(null);
|
|
|
9234
9427
|
ReferResource.prototype._addReferCount.call(this, value);
|
|
9235
9428
|
this.shaderData._addReferCount(value);
|
|
9236
9429
|
};
|
|
9237
|
-
|
|
9430
|
+
_create_class(Material, [
|
|
9238
9431
|
{
|
|
9239
9432
|
key: "shader",
|
|
9240
9433
|
get: /**
|
|
@@ -9338,83 +9531,72 @@ var RenderData = function RenderData() {
|
|
|
9338
9531
|
PipelineStage[/** Forward shading stage. */ "Forward"] = "Forward";
|
|
9339
9532
|
})(exports.PipelineStage || (exports.PipelineStage = {}));
|
|
9340
9533
|
|
|
9341
|
-
function
|
|
9342
|
-
|
|
9343
|
-
|
|
9344
|
-
|
|
9345
|
-
|
|
9346
|
-
for (var key in source) {
|
|
9347
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
9348
|
-
target[key] = source[key];
|
|
9534
|
+
function _extends() {
|
|
9535
|
+
_extends = Object.assign || function assign(target) {
|
|
9536
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
9537
|
+
var source = arguments[i];
|
|
9538
|
+
for (var key in source) if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
9349
9539
|
}
|
|
9350
|
-
}
|
|
9351
|
-
}
|
|
9352
|
-
|
|
9353
|
-
return target;
|
|
9354
|
-
};
|
|
9355
9540
|
|
|
9356
|
-
|
|
9357
|
-
}
|
|
9541
|
+
return target;
|
|
9542
|
+
};
|
|
9358
9543
|
|
|
9359
|
-
|
|
9360
|
-
return extends_.apply(this, arguments);
|
|
9544
|
+
return _extends.apply(this, arguments);
|
|
9361
9545
|
}
|
|
9362
9546
|
|
|
9363
|
-
var camera_declare = "#define GLSLIFY 1\nuniform vec3
|
|
9547
|
+
var camera_declare = "#define GLSLIFY 1\nuniform vec3 camera_Position;"; // eslint-disable-line
|
|
9364
9548
|
|
|
9365
9549
|
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
|
|
9366
9550
|
|
|
9367
|
-
var common_vert = "#define GLSLIFY 1\nattribute vec3 POSITION;\n#ifdef
|
|
9551
|
+
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
|
|
9368
9552
|
|
|
9369
|
-
var transform_declare = "#define GLSLIFY 1\nuniform mat4
|
|
9553
|
+
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
|
|
9370
9554
|
|
|
9371
|
-
var color_share = "#define GLSLIFY 1\n#ifdef
|
|
9555
|
+
var color_share = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_VERTEXCOLOR\nvarying vec4 v_color;\n#endif\n"; // eslint-disable-line
|
|
9372
9556
|
|
|
9373
|
-
var
|
|
9557
|
+
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
|
|
9374
9558
|
|
|
9375
|
-
var
|
|
9559
|
+
var FogVertexDeclaration = "#define GLSLIFY 1\n#if SCENE_FOG_MODE != 0\nvarying vec3 v_positionVS;\n#endif\n"; // eslint-disable-line
|
|
9376
9560
|
|
|
9377
|
-
var
|
|
9561
|
+
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
|
|
9378
9562
|
|
|
9379
|
-
var
|
|
9563
|
+
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
|
|
9380
9564
|
|
|
9381
|
-
var
|
|
9565
|
+
var worldpos_share = "#define GLSLIFY 1\n#ifdef MATERIAL_NEED_WORLDPOS\nvarying vec3 v_pos;\n#endif\n"; // eslint-disable-line
|
|
9382
9566
|
|
|
9383
|
-
var
|
|
9384
|
-
|
|
9385
|
-
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
|
|
9567
|
+
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
|
|
9386
9568
|
|
|
9387
9569
|
var begin_position_vert = "#define GLSLIFY 1\nvec4 position=vec4(POSITION,1.0);"; // eslint-disable-line
|
|
9388
9570
|
|
|
9389
|
-
var blendShape_input = "#define GLSLIFY 1\n#ifdef
|
|
9571
|
+
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
|
|
9390
9572
|
|
|
9391
|
-
var blendShape_vert = "#define GLSLIFY 1\n#ifdef
|
|
9573
|
+
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
|
|
9392
9574
|
|
|
9393
|
-
var color_vert = "#define GLSLIFY 1\n#ifdef
|
|
9575
|
+
var color_vert = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_VERTEXCOLOR\nv_color=COLOR_0;\n#endif\n"; // eslint-disable-line
|
|
9394
9576
|
|
|
9395
|
-
var FogVertex = "#define GLSLIFY 1\n#if
|
|
9577
|
+
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
|
|
9396
9578
|
|
|
9397
|
-
var normal_vert = "#define GLSLIFY 1\n#ifndef
|
|
9579
|
+
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
|
|
9398
9580
|
|
|
9399
|
-
var position_vert = "#define GLSLIFY 1\ngl_Position=
|
|
9581
|
+
var position_vert = "#define GLSLIFY 1\ngl_Position=renderer_MVPMat*position;"; // eslint-disable-line
|
|
9400
9582
|
|
|
9401
|
-
var skinning_vert = "#define GLSLIFY 1\n#ifdef
|
|
9583
|
+
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
|
|
9402
9584
|
|
|
9403
|
-
var uv_vert = "#define GLSLIFY 1\n#ifdef
|
|
9585
|
+
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
|
|
9404
9586
|
|
|
9405
|
-
var worldpos_vert = "#define GLSLIFY 1\n#ifdef
|
|
9587
|
+
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
|
|
9406
9588
|
|
|
9407
|
-
var FogFragment = "#define GLSLIFY 1\n#if
|
|
9589
|
+
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
|
|
9408
9590
|
|
|
9409
|
-
var light_frag_define = "#define GLSLIFY 1\n#ifdef
|
|
9591
|
+
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
|
|
9410
9592
|
|
|
9411
|
-
var mobile_material_frag = "#define GLSLIFY 1\nuniform vec4
|
|
9593
|
+
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
|
|
9412
9594
|
|
|
9413
|
-
var begin_mobile_frag = "#define GLSLIFY 1\nvec4 ambient=vec4(0.0);vec4 emission=
|
|
9595
|
+
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
|
|
9414
9596
|
|
|
9415
|
-
var begin_viewdir_frag = "#define GLSLIFY 1\n#ifdef
|
|
9597
|
+
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
|
|
9416
9598
|
|
|
9417
|
-
var mobile_blinnphong_frag = "#define GLSLIFY 1\n#ifdef
|
|
9599
|
+
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
|
|
9418
9600
|
|
|
9419
9601
|
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
|
|
9420
9602
|
|
|
@@ -9448,17 +9630,17 @@ var noise_simplex_3D_grad = "#define GLSLIFY 1\nfloat simplex(vec3 v,out vec3 gr
|
|
|
9448
9630
|
|
|
9449
9631
|
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
|
|
9450
9632
|
|
|
9451
|
-
var pbr_frag_define = "#define GLSLIFY 1\nuniform float
|
|
9633
|
+
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
|
|
9452
9634
|
|
|
9453
|
-
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(
|
|
9635
|
+
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
|
|
9454
9636
|
|
|
9455
9637
|
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
|
|
9456
9638
|
|
|
9457
|
-
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
|
|
9639
|
+
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
|
|
9458
9640
|
|
|
9459
|
-
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
|
|
9641
|
+
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
|
|
9460
9642
|
|
|
9461
|
-
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
|
|
9643
|
+
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
|
|
9462
9644
|
|
|
9463
9645
|
var PBRShaderLib = {
|
|
9464
9646
|
pbr_frag_define: pbr_frag_define,
|
|
@@ -9469,15 +9651,15 @@ var PBRShaderLib = {
|
|
|
9469
9651
|
pbr_frag: pbr_frag
|
|
9470
9652
|
};
|
|
9471
9653
|
|
|
9472
|
-
var ShadowCoord = "#define GLSLIFY 1\nuniform mat4
|
|
9654
|
+
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
|
|
9473
9655
|
|
|
9474
|
-
var ShadowFragmentDeclaration = "#define GLSLIFY 1\n#if defined(
|
|
9656
|
+
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
|
|
9475
9657
|
|
|
9476
9658
|
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
|
|
9477
9659
|
|
|
9478
|
-
var ShadowVertexDeclaration = "#define GLSLIFY 1\n#if defined(
|
|
9660
|
+
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
|
|
9479
9661
|
|
|
9480
|
-
var ShadowVertex = "#define GLSLIFY 1\n#ifdef
|
|
9662
|
+
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
|
|
9481
9663
|
|
|
9482
9664
|
var ShadowLib = {
|
|
9483
9665
|
ShadowCoord: ShadowCoord,
|
|
@@ -9487,7 +9669,7 @@ var ShadowLib = {
|
|
|
9487
9669
|
ShadowVertex: ShadowVertex
|
|
9488
9670
|
};
|
|
9489
9671
|
|
|
9490
|
-
var normal_get = "#define GLSLIFY 1\nvec3 getNormal(){\n#ifdef
|
|
9672
|
+
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
|
|
9491
9673
|
|
|
9492
9674
|
var ShaderLib = _extends({
|
|
9493
9675
|
common: common,
|
|
@@ -9498,7 +9680,6 @@ var ShaderLib = _extends({
|
|
|
9498
9680
|
normal_share: normal_share,
|
|
9499
9681
|
uv_share: uv_share,
|
|
9500
9682
|
worldpos_share: worldpos_share,
|
|
9501
|
-
RendererFragmentDeclaration: RendererFragmentDeclaration,
|
|
9502
9683
|
FogVertexDeclaration: FogVertexDeclaration,
|
|
9503
9684
|
FogFragmentDeclaration: FogFragmentDeclaration,
|
|
9504
9685
|
begin_normal_vert: begin_normal_vert,
|
|
@@ -9607,8 +9788,7 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
9607
9788
|
|
|
9608
9789
|
/**
|
|
9609
9790
|
* Shader tag key.
|
|
9610
|
-
*/ var
|
|
9611
|
-
var ShaderTagKey = /*#__PURE__*/ function() {
|
|
9791
|
+
*/ var ShaderTagKey = /*#__PURE__*/ function() {
|
|
9612
9792
|
function ShaderTagKey(name) {
|
|
9613
9793
|
this.name = name;
|
|
9614
9794
|
this._uniqueId = ShaderTagKey._nameCounter++;
|
|
@@ -9618,13 +9798,18 @@ var ShaderTagKey = /*#__PURE__*/ function() {
|
|
|
9618
9798
|
* @param name - Name of the shader property
|
|
9619
9799
|
* @returns Shader property
|
|
9620
9800
|
*/ ShaderTagKey.getByName = function getByName(name) {
|
|
9801
|
+
var _nameMap, _name;
|
|
9621
9802
|
var nameMap = ShaderTagKey._nameMap;
|
|
9622
9803
|
return (_nameMap = nameMap)[_name = name] || (_nameMap[_name] = new ShaderTagKey(name));
|
|
9623
9804
|
};
|
|
9624
9805
|
return ShaderTagKey;
|
|
9625
9806
|
}();
|
|
9626
|
-
|
|
9627
|
-
ShaderTagKey.
|
|
9807
|
+
(function() {
|
|
9808
|
+
ShaderTagKey._nameCounter = 0;
|
|
9809
|
+
})();
|
|
9810
|
+
(function() {
|
|
9811
|
+
ShaderTagKey._nameMap = Object.create(null);
|
|
9812
|
+
})();
|
|
9628
9813
|
|
|
9629
9814
|
/**
|
|
9630
9815
|
* Base class for shader structure.
|
|
@@ -10228,7 +10413,7 @@ ShaderTagKey._nameMap = Object.create(null);
|
|
|
10228
10413
|
return prefix + line;
|
|
10229
10414
|
}).join("\n");
|
|
10230
10415
|
};
|
|
10231
|
-
|
|
10416
|
+
_create_class(ShaderProgram, [
|
|
10232
10417
|
{
|
|
10233
10418
|
key: "isValid",
|
|
10234
10419
|
get: /**
|
|
@@ -10240,7 +10425,9 @@ ShaderTagKey._nameMap = Object.create(null);
|
|
|
10240
10425
|
]);
|
|
10241
10426
|
return ShaderProgram;
|
|
10242
10427
|
}();
|
|
10243
|
-
|
|
10428
|
+
(function() {
|
|
10429
|
+
ShaderProgram._counter = 0;
|
|
10430
|
+
})();
|
|
10244
10431
|
|
|
10245
10432
|
/**
|
|
10246
10433
|
* Shader pass containing vertex and fragment source.
|
|
@@ -10295,7 +10482,9 @@ ShaderProgram._counter = 0;
|
|
|
10295
10482
|
};
|
|
10296
10483
|
return ShaderPass;
|
|
10297
10484
|
}(ShaderPart);
|
|
10298
|
-
|
|
10485
|
+
(function() {
|
|
10486
|
+
ShaderPass._shaderPassCounter = 0;
|
|
10487
|
+
})();
|
|
10299
10488
|
|
|
10300
10489
|
/**
|
|
10301
10490
|
* Sub shader.
|
|
@@ -10315,7 +10504,7 @@ ShaderPass._shaderPassCounter = 0;
|
|
|
10315
10504
|
}
|
|
10316
10505
|
return _this;
|
|
10317
10506
|
}
|
|
10318
|
-
|
|
10507
|
+
_create_class(SubShader, [
|
|
10319
10508
|
{
|
|
10320
10509
|
key: "passes",
|
|
10321
10510
|
get: /**
|
|
@@ -10414,7 +10603,7 @@ ShaderPass._shaderPassCounter = 0;
|
|
|
10414
10603
|
*/ Shader.getPropertyByName = function getPropertyByName(name) {
|
|
10415
10604
|
return ShaderProperty.getByName(name);
|
|
10416
10605
|
};
|
|
10417
|
-
|
|
10606
|
+
_create_class(Shader, [
|
|
10418
10607
|
{
|
|
10419
10608
|
key: "subShaders",
|
|
10420
10609
|
get: /**
|
|
@@ -10426,13 +10615,19 @@ ShaderPass._shaderPassCounter = 0;
|
|
|
10426
10615
|
]);
|
|
10427
10616
|
return Shader;
|
|
10428
10617
|
}();
|
|
10429
|
-
|
|
10430
|
-
/** @internal */ Shader.
|
|
10431
|
-
|
|
10432
|
-
|
|
10433
|
-
|
|
10434
|
-
|
|
10435
|
-
|
|
10618
|
+
(function() {
|
|
10619
|
+
/** @internal */ Shader._compileMacros = new ShaderMacroCollection();
|
|
10620
|
+
})();
|
|
10621
|
+
(function() {
|
|
10622
|
+
/** @internal */ Shader._shaderExtension = [
|
|
10623
|
+
"GL_EXT_shader_texture_lod",
|
|
10624
|
+
"GL_OES_standard_derivatives",
|
|
10625
|
+
"GL_EXT_draw_buffers"
|
|
10626
|
+
];
|
|
10627
|
+
})();
|
|
10628
|
+
(function() {
|
|
10629
|
+
Shader._shaderMap = Object.create(null);
|
|
10630
|
+
})();
|
|
10436
10631
|
|
|
10437
10632
|
/**
|
|
10438
10633
|
* @internal
|
|
@@ -10449,10 +10644,18 @@ Shader._shaderMap = Object.create(null);
|
|
|
10449
10644
|
};
|
|
10450
10645
|
return RenderContext;
|
|
10451
10646
|
}();
|
|
10452
|
-
|
|
10453
|
-
RenderContext.
|
|
10454
|
-
|
|
10455
|
-
|
|
10647
|
+
(function() {
|
|
10648
|
+
RenderContext.vpMatrixProperty = ShaderProperty.getByName("camera_VPMat");
|
|
10649
|
+
})();
|
|
10650
|
+
(function() {
|
|
10651
|
+
RenderContext.pipelineStageKey = ShaderTagKey.getByName("pipelineStage");
|
|
10652
|
+
})();
|
|
10653
|
+
(function() {
|
|
10654
|
+
RenderContext._viewMatrixProperty = ShaderProperty.getByName("camera_ViewMat");
|
|
10655
|
+
})();
|
|
10656
|
+
(function() {
|
|
10657
|
+
RenderContext._projectionMatrixProperty = ShaderProperty.getByName("camera_ProjMat");
|
|
10658
|
+
})();
|
|
10456
10659
|
|
|
10457
10660
|
var RenderElement = /*#__PURE__*/ function() {
|
|
10458
10661
|
function RenderElement() {}
|
|
@@ -10481,7 +10684,6 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10481
10684
|
function Renderer1(entity) {
|
|
10482
10685
|
var _this;
|
|
10483
10686
|
_this = Component.call(this, entity) || this;
|
|
10484
|
-
/** Whether cast shadow. */ _this.castShadows = true;
|
|
10485
10687
|
/** ShaderData related to renderer. */ _this.shaderData = new ShaderData(ShaderDataGroup.Renderer);
|
|
10486
10688
|
/** @internal */ _this._onUpdateIndex = -1;
|
|
10487
10689
|
/** @internal */ _this._rendererIndex = -1;
|
|
@@ -10498,11 +10700,12 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10498
10700
|
_this._priority = 0;
|
|
10499
10701
|
_this._receiveShadows = true;
|
|
10500
10702
|
_this._rendererLayer = new miniprogram.Vector4();
|
|
10703
|
+
/** Whether cast shadow. */ _this.castShadows = true;
|
|
10501
10704
|
var prototype = exports.Renderer.prototype;
|
|
10502
10705
|
var shaderData = _this.shaderData;
|
|
10503
10706
|
_this._overrideUpdate = _this.update !== prototype.update;
|
|
10504
10707
|
shaderData._addReferCount(1);
|
|
10505
|
-
_this._onTransformChanged = _this._onTransformChanged.bind(
|
|
10708
|
+
_this._onTransformChanged = _this._onTransformChanged.bind(_assert_this_initialized(_this));
|
|
10506
10709
|
_this._registerEntityTransformListener();
|
|
10507
10710
|
shaderData.enableMacro(exports.Renderer._receiveShadowMacro);
|
|
10508
10711
|
shaderData.setVector4(exports.Renderer._rendererLayerProperty, _this._rendererLayer);
|
|
@@ -10689,7 +10892,7 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10689
10892
|
_proto._onTransformChanged = function _onTransformChanged(type) {
|
|
10690
10893
|
this._dirtyUpdateFlag |= 0x1;
|
|
10691
10894
|
};
|
|
10692
|
-
|
|
10895
|
+
_create_class(Renderer1, [
|
|
10693
10896
|
{
|
|
10694
10897
|
key: "isCulled",
|
|
10695
10898
|
get: /**
|
|
@@ -10755,7 +10958,25 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10755
10958
|
}
|
|
10756
10959
|
]);
|
|
10757
10960
|
return Renderer1;
|
|
10758
|
-
}(Component),
|
|
10961
|
+
}(Component), function() {
|
|
10962
|
+
_Renderer._tempVector0 = new miniprogram.Vector3();
|
|
10963
|
+
}(), function() {
|
|
10964
|
+
_Renderer._receiveShadowMacro = ShaderMacro.getByName("RENDERER_IS_RECEIVE_SHADOWS");
|
|
10965
|
+
}(), function() {
|
|
10966
|
+
_Renderer._localMatrixProperty = ShaderProperty.getByName("renderer_LocalMat");
|
|
10967
|
+
}(), function() {
|
|
10968
|
+
_Renderer._worldMatrixProperty = ShaderProperty.getByName("renderer_ModelMat");
|
|
10969
|
+
}(), function() {
|
|
10970
|
+
_Renderer._mvMatrixProperty = ShaderProperty.getByName("renderer_MVMat");
|
|
10971
|
+
}(), function() {
|
|
10972
|
+
_Renderer._mvpMatrixProperty = ShaderProperty.getByName("renderer_MVPMat");
|
|
10973
|
+
}(), function() {
|
|
10974
|
+
_Renderer._mvInvMatrixProperty = ShaderProperty.getByName("renderer_MVInvMat");
|
|
10975
|
+
}(), function() {
|
|
10976
|
+
_Renderer._normalMatrixProperty = ShaderProperty.getByName("renderer_NormalMat");
|
|
10977
|
+
}(), function() {
|
|
10978
|
+
_Renderer._rendererLayerProperty = ShaderProperty.getByName("renderer_Layer");
|
|
10979
|
+
}(), _Renderer);
|
|
10759
10980
|
__decorate([
|
|
10760
10981
|
deepClone
|
|
10761
10982
|
], exports.Renderer.prototype, "shaderData", void 0);
|
|
@@ -10885,14 +11106,18 @@ var SimpleSpriteAssembler = (_SimpleSpriteAssembler = /*#__PURE__*/ function() {
|
|
|
10885
11106
|
renderUVs[3].set(right, top);
|
|
10886
11107
|
};
|
|
10887
11108
|
return SimpleSpriteAssembler1;
|
|
10888
|
-
}(),
|
|
10889
|
-
|
|
10890
|
-
|
|
10891
|
-
|
|
10892
|
-
|
|
10893
|
-
|
|
10894
|
-
|
|
10895
|
-
|
|
11109
|
+
}(), function() {
|
|
11110
|
+
_SimpleSpriteAssembler._rectangleTriangles = [
|
|
11111
|
+
0,
|
|
11112
|
+
1,
|
|
11113
|
+
2,
|
|
11114
|
+
2,
|
|
11115
|
+
1,
|
|
11116
|
+
3
|
|
11117
|
+
];
|
|
11118
|
+
}(), function() {
|
|
11119
|
+
_SimpleSpriteAssembler._worldMatrix = new miniprogram.Matrix();
|
|
11120
|
+
}(), _SimpleSpriteAssembler);
|
|
10896
11121
|
SimpleSpriteAssembler = __decorate([
|
|
10897
11122
|
StaticInterfaceImplement()
|
|
10898
11123
|
], SimpleSpriteAssembler);
|
|
@@ -10977,10 +11202,10 @@ SimpleSpriteAssembler = __decorate([
|
|
|
10977
11202
|
_this._flipY = false;
|
|
10978
11203
|
_this._alphaCutoff = 0.5;
|
|
10979
11204
|
_this._verticesData = new VertexData2D(4, [], []);
|
|
10980
|
-
SimpleSpriteAssembler.resetData(
|
|
11205
|
+
SimpleSpriteAssembler.resetData(_assert_this_initialized(_this));
|
|
10981
11206
|
_this.setMaterial(_this._engine._spriteMaskDefaultMaterial);
|
|
10982
11207
|
_this.shaderData.setFloat(SpriteMask._alphaCutoffProperty, _this._alphaCutoff);
|
|
10983
|
-
_this._onSpriteChange = _this._onSpriteChange.bind(
|
|
11208
|
+
_this._onSpriteChange = _this._onSpriteChange.bind(_assert_this_initialized(_this));
|
|
10984
11209
|
return _this;
|
|
10985
11210
|
}
|
|
10986
11211
|
var _proto = SpriteMask.prototype;
|
|
@@ -11050,7 +11275,7 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11050
11275
|
break;
|
|
11051
11276
|
}
|
|
11052
11277
|
};
|
|
11053
|
-
|
|
11278
|
+
_create_class(SpriteMask, [
|
|
11054
11279
|
{
|
|
11055
11280
|
key: "width",
|
|
11056
11281
|
get: /**
|
|
@@ -11152,8 +11377,12 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11152
11377
|
]);
|
|
11153
11378
|
return SpriteMask;
|
|
11154
11379
|
}(exports.Renderer);
|
|
11155
|
-
|
|
11156
|
-
/** @internal */ SpriteMask.
|
|
11380
|
+
(function() {
|
|
11381
|
+
/** @internal */ SpriteMask._textureProperty = ShaderProperty.getByName("renderer_MaskTexture");
|
|
11382
|
+
})();
|
|
11383
|
+
(function() {
|
|
11384
|
+
/** @internal */ SpriteMask._alphaCutoffProperty = ShaderProperty.getByName("renderer_MaskAlphaCutoff");
|
|
11385
|
+
})();
|
|
11157
11386
|
__decorate([
|
|
11158
11387
|
assignmentClone
|
|
11159
11388
|
], SpriteMask.prototype, "influenceLayers", void 0);
|
|
@@ -11338,7 +11567,7 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11338
11567
|
this._glElementInfo = BufferUtil._getElementInfo(this.format);
|
|
11339
11568
|
this._instanceStepRate = Math.floor(instanceStepRate);
|
|
11340
11569
|
}
|
|
11341
|
-
|
|
11570
|
+
_create_class(VertexElement, [
|
|
11342
11571
|
{
|
|
11343
11572
|
key: "semantic",
|
|
11344
11573
|
get: /**
|
|
@@ -11463,7 +11692,7 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11463
11692
|
this._platformBuffer.resize(byteLength);
|
|
11464
11693
|
this._byteLength = byteLength;
|
|
11465
11694
|
};
|
|
11466
|
-
|
|
11695
|
+
_create_class(Buffer, [
|
|
11467
11696
|
{
|
|
11468
11697
|
key: "type",
|
|
11469
11698
|
get: /**
|
|
@@ -11520,7 +11749,7 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11520
11749
|
this._buffer = buffer;
|
|
11521
11750
|
this._format = format;
|
|
11522
11751
|
}
|
|
11523
|
-
|
|
11752
|
+
_create_class(IndexBufferBinding, [
|
|
11524
11753
|
{
|
|
11525
11754
|
key: "buffer",
|
|
11526
11755
|
get: /**
|
|
@@ -11569,8 +11798,8 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11569
11798
|
_this._bounds = new miniprogram.BoundingBox();
|
|
11570
11799
|
_this._subMeshes = [];
|
|
11571
11800
|
_this.name = name;
|
|
11572
|
-
_this._platformPrimitive = _this._engine._hardwareRenderer.createPlatformPrimitive(
|
|
11573
|
-
_this._onBoundsChanged = _this._onBoundsChanged.bind(
|
|
11801
|
+
_this._platformPrimitive = _this._engine._hardwareRenderer.createPlatformPrimitive(_assert_this_initialized(_this));
|
|
11802
|
+
_this._onBoundsChanged = _this._onBoundsChanged.bind(_assert_this_initialized(_this));
|
|
11574
11803
|
var bounds = _this._bounds;
|
|
11575
11804
|
// @ts-ignore
|
|
11576
11805
|
bounds.min._onValueChanged = _this._onBoundsChanged;
|
|
@@ -11693,7 +11922,7 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11693
11922
|
_proto._onBoundsChanged = function _onBoundsChanged() {
|
|
11694
11923
|
this._updateFlagManager.dispatch(0x1);
|
|
11695
11924
|
};
|
|
11696
|
-
|
|
11925
|
+
_create_class(Mesh, [
|
|
11697
11926
|
{
|
|
11698
11927
|
key: "bounds",
|
|
11699
11928
|
get: /**
|
|
@@ -11739,7 +11968,7 @@ var MeshModifyFlags;
|
|
|
11739
11968
|
this._buffer = buffer;
|
|
11740
11969
|
this._stride = stride;
|
|
11741
11970
|
}
|
|
11742
|
-
|
|
11971
|
+
_create_class(VertexBufferBinding, [
|
|
11743
11972
|
{
|
|
11744
11973
|
key: "buffer",
|
|
11745
11974
|
get: /**
|
|
@@ -11821,7 +12050,7 @@ var MeshModifyFlags;
|
|
|
11821
12050
|
shaderData.setTexture(BlendShapeManager._blendShapeTextureProperty, this._vertexTexture);
|
|
11822
12051
|
shaderData.setVector3(BlendShapeManager._blendShapeTextureInfoProperty, this._dataTextureInfo);
|
|
11823
12052
|
shaderData.setFloatArray(BlendShapeManager._blendShapeWeightsProperty, skinnedMeshRenderer.blendShapeWeights);
|
|
11824
|
-
shaderData.enableMacro("
|
|
12053
|
+
shaderData.enableMacro("RENDERER_BLENDSHAPE_COUNT", blendShapeCount.toString());
|
|
11825
12054
|
this._uniformOccupiesCount = blendShapeCount + 1;
|
|
11826
12055
|
} else {
|
|
11827
12056
|
var maxBlendCount = this._getVertexBufferModeSupportCount();
|
|
@@ -11840,7 +12069,7 @@ var MeshModifyFlags;
|
|
|
11840
12069
|
this._modelMesh._enableVAO = true;
|
|
11841
12070
|
}
|
|
11842
12071
|
shaderData.disableMacro(BlendShapeManager._blendShapeTextureMacro);
|
|
11843
|
-
shaderData.disableMacro("
|
|
12072
|
+
shaderData.disableMacro("RENDERER_BLENDSHAPE_COUNT");
|
|
11844
12073
|
this._uniformOccupiesCount = blendShapeCount;
|
|
11845
12074
|
}
|
|
11846
12075
|
if (this._useBlendNormal) {
|
|
@@ -11855,7 +12084,7 @@ var MeshModifyFlags;
|
|
|
11855
12084
|
}
|
|
11856
12085
|
} else {
|
|
11857
12086
|
shaderData.disableMacro(BlendShapeManager._blendShapeMacro);
|
|
11858
|
-
shaderData.disableMacro("
|
|
12087
|
+
shaderData.disableMacro("RENDERER_BLENDSHAPE_COUNT");
|
|
11859
12088
|
}
|
|
11860
12089
|
};
|
|
11861
12090
|
/**
|
|
@@ -12173,13 +12402,27 @@ var MeshModifyFlags;
|
|
|
12173
12402
|
};
|
|
12174
12403
|
return BlendShapeManager;
|
|
12175
12404
|
}();
|
|
12176
|
-
|
|
12177
|
-
BlendShapeManager.
|
|
12178
|
-
|
|
12179
|
-
|
|
12180
|
-
BlendShapeManager.
|
|
12181
|
-
|
|
12182
|
-
|
|
12405
|
+
(function() {
|
|
12406
|
+
BlendShapeManager._blendShapeMacro = ShaderMacro.getByName("RENDERER_HAS_BLENDSHAPE");
|
|
12407
|
+
})();
|
|
12408
|
+
(function() {
|
|
12409
|
+
BlendShapeManager._blendShapeTextureMacro = ShaderMacro.getByName("RENDERER_BLENDSHAPE_USE_TEXTURE");
|
|
12410
|
+
})();
|
|
12411
|
+
(function() {
|
|
12412
|
+
BlendShapeManager._blendShapeNormalMacro = ShaderMacro.getByName("RENDERER_BLENDSHAPE_HAS_NORMAL");
|
|
12413
|
+
})();
|
|
12414
|
+
(function() {
|
|
12415
|
+
BlendShapeManager._blendShapeTangentMacro = ShaderMacro.getByName("RENDERER_BLENDSHAPE_HAS_TANGENT");
|
|
12416
|
+
})();
|
|
12417
|
+
(function() {
|
|
12418
|
+
BlendShapeManager._blendShapeWeightsProperty = ShaderProperty.getByName("renderer_BlendShapeWeights");
|
|
12419
|
+
})();
|
|
12420
|
+
(function() {
|
|
12421
|
+
BlendShapeManager._blendShapeTextureProperty = ShaderProperty.getByName("renderer_BlendShapeTexture");
|
|
12422
|
+
})();
|
|
12423
|
+
(function() {
|
|
12424
|
+
BlendShapeManager._blendShapeTextureInfoProperty = ShaderProperty.getByName("renderer_BlendShapeTextureInfo");
|
|
12425
|
+
})();
|
|
12183
12426
|
|
|
12184
12427
|
/**
|
|
12185
12428
|
* Vertex attribute types of a vertex in a ModelMesh.
|
|
@@ -12236,7 +12479,7 @@ BlendShapeManager._blendShapeTextureInfoProperty = ShaderProperty.getByName("u_b
|
|
|
12236
12479
|
_this._customVertexElements = [];
|
|
12237
12480
|
_this._vertexCountChanged = false;
|
|
12238
12481
|
_this.name = name;
|
|
12239
|
-
_this._blendShapeManager = new BlendShapeManager(engine,
|
|
12482
|
+
_this._blendShapeManager = new BlendShapeManager(engine, _assert_this_initialized(_this));
|
|
12240
12483
|
return _this;
|
|
12241
12484
|
}
|
|
12242
12485
|
var _proto = ModelMesh.prototype;
|
|
@@ -13153,7 +13396,7 @@ BlendShapeManager._blendShapeTextureInfoProperty = ShaderProperty.getByName("u_b
|
|
|
13153
13396
|
this._uv7 = null;
|
|
13154
13397
|
this._blendShapeManager._releaseMemoryCache();
|
|
13155
13398
|
};
|
|
13156
|
-
|
|
13399
|
+
_create_class(ModelMesh, [
|
|
13157
13400
|
{
|
|
13158
13401
|
key: "readable",
|
|
13159
13402
|
get: /**
|
|
@@ -13218,11 +13461,21 @@ BlendShapeManager._blendShapeTextureInfoProperty = ShaderProperty.getByName("u_b
|
|
|
13218
13461
|
]);
|
|
13219
13462
|
return ModelMesh;
|
|
13220
13463
|
}(Mesh);
|
|
13221
|
-
|
|
13222
|
-
ModelMesh.
|
|
13223
|
-
|
|
13224
|
-
|
|
13225
|
-
ModelMesh.
|
|
13464
|
+
(function() {
|
|
13465
|
+
ModelMesh._tempVec0 = new miniprogram.Vector3();
|
|
13466
|
+
})();
|
|
13467
|
+
(function() {
|
|
13468
|
+
ModelMesh._tempVec1 = new miniprogram.Vector3();
|
|
13469
|
+
})();
|
|
13470
|
+
(function() {
|
|
13471
|
+
ModelMesh._tempVec2 = new miniprogram.Vector3();
|
|
13472
|
+
})();
|
|
13473
|
+
(function() {
|
|
13474
|
+
ModelMesh._tempVec3 = new miniprogram.Vector3();
|
|
13475
|
+
})();
|
|
13476
|
+
(function() {
|
|
13477
|
+
ModelMesh._tempVec4 = new miniprogram.Vector3();
|
|
13478
|
+
})();
|
|
13226
13479
|
var VertexChangedFlags;
|
|
13227
13480
|
(function(VertexChangedFlags) {
|
|
13228
13481
|
VertexChangedFlags[VertexChangedFlags["Position"] = 0x1] = "Position";
|
|
@@ -13265,7 +13518,7 @@ var VertexChangedFlags;
|
|
|
13265
13518
|
function MeshRenderer(entity) {
|
|
13266
13519
|
var _this;
|
|
13267
13520
|
_this = Renderer.call(this, entity) || this;
|
|
13268
|
-
_this._onMeshChanged = _this._onMeshChanged.bind(
|
|
13521
|
+
_this._onMeshChanged = _this._onMeshChanged.bind(_assert_this_initialized(_this));
|
|
13269
13522
|
return _this;
|
|
13270
13523
|
}
|
|
13271
13524
|
var _proto = MeshRenderer.prototype;
|
|
@@ -13364,7 +13617,7 @@ var VertexChangedFlags;
|
|
|
13364
13617
|
type & MeshModifyFlags.Bounds && (this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume);
|
|
13365
13618
|
type & MeshModifyFlags.VertexElements && (this._dirtyUpdateFlag |= 0x2);
|
|
13366
13619
|
};
|
|
13367
|
-
|
|
13620
|
+
_create_class(MeshRenderer, [
|
|
13368
13621
|
{
|
|
13369
13622
|
key: "mesh",
|
|
13370
13623
|
get: /**
|
|
@@ -13381,11 +13634,21 @@ var VertexChangedFlags;
|
|
|
13381
13634
|
]);
|
|
13382
13635
|
return MeshRenderer;
|
|
13383
13636
|
}(exports.Renderer);
|
|
13384
|
-
|
|
13385
|
-
MeshRenderer.
|
|
13386
|
-
|
|
13387
|
-
|
|
13388
|
-
MeshRenderer.
|
|
13637
|
+
(function() {
|
|
13638
|
+
MeshRenderer._uvMacro = ShaderMacro.getByName("RENDERER_HAS_UV");
|
|
13639
|
+
})();
|
|
13640
|
+
(function() {
|
|
13641
|
+
MeshRenderer._uv1Macro = ShaderMacro.getByName("RENDERER_HAS_UV1");
|
|
13642
|
+
})();
|
|
13643
|
+
(function() {
|
|
13644
|
+
MeshRenderer._normalMacro = ShaderMacro.getByName("RENDERER_HAS_NORMAL");
|
|
13645
|
+
})();
|
|
13646
|
+
(function() {
|
|
13647
|
+
MeshRenderer._tangentMacro = ShaderMacro.getByName("RENDERER_HAS_TANGENT");
|
|
13648
|
+
})();
|
|
13649
|
+
(function() {
|
|
13650
|
+
MeshRenderer._vertexColorMacro = ShaderMacro.getByName("RENDERER_HAS_VERTEXCOLOR");
|
|
13651
|
+
})();
|
|
13389
13652
|
__decorate([
|
|
13390
13653
|
ignoreClone
|
|
13391
13654
|
], MeshRenderer.prototype, "_mesh", void 0);
|
|
@@ -13400,76 +13663,6 @@ var /**
|
|
|
13400
13663
|
MeshRendererUpdateFlags[MeshRendererUpdateFlags[/** All. */ "All"] = 0x3] = "All";
|
|
13401
13664
|
})(MeshRendererUpdateFlags || (MeshRendererUpdateFlags = {}));
|
|
13402
13665
|
|
|
13403
|
-
var Utils = /*#__PURE__*/ function() {
|
|
13404
|
-
function Utils() {}
|
|
13405
|
-
/**
|
|
13406
|
-
* @internal
|
|
13407
|
-
*/ Utils._floatMatrixMultiply = function _floatMatrixMultiply(left, re, rOffset, oe, offset) {
|
|
13408
|
-
var le = left.elements;
|
|
13409
|
-
// prettier-ignore
|
|
13410
|
-
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];
|
|
13411
|
-
// prettier-ignore
|
|
13412
|
-
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];
|
|
13413
|
-
oe[offset] = l11 * r11 + l21 * r12 + l31 * r13 + l41 * r14;
|
|
13414
|
-
oe[offset + 1] = l12 * r11 + l22 * r12 + l32 * r13 + l42 * r14;
|
|
13415
|
-
oe[offset + 2] = l13 * r11 + l23 * r12 + l33 * r13 + l43 * r14;
|
|
13416
|
-
oe[offset + 3] = l14 * r11 + l24 * r12 + l34 * r13 + l44 * r14;
|
|
13417
|
-
oe[offset + 4] = l11 * r21 + l21 * r22 + l31 * r23 + l41 * r24;
|
|
13418
|
-
oe[offset + 5] = l12 * r21 + l22 * r22 + l32 * r23 + l42 * r24;
|
|
13419
|
-
oe[offset + 6] = l13 * r21 + l23 * r22 + l33 * r23 + l43 * r24;
|
|
13420
|
-
oe[offset + 7] = l14 * r21 + l24 * r22 + l34 * r23 + l44 * r24;
|
|
13421
|
-
oe[offset + 8] = l11 * r31 + l21 * r32 + l31 * r33 + l41 * r34;
|
|
13422
|
-
oe[offset + 9] = l12 * r31 + l22 * r32 + l32 * r33 + l42 * r34;
|
|
13423
|
-
oe[offset + 10] = l13 * r31 + l23 * r32 + l33 * r33 + l43 * r34;
|
|
13424
|
-
oe[offset + 11] = l14 * r31 + l24 * r32 + l34 * r33 + l44 * r34;
|
|
13425
|
-
oe[offset + 12] = l11 * r41 + l21 * r42 + l31 * r43 + l41 * r44;
|
|
13426
|
-
oe[offset + 13] = l12 * r41 + l22 * r42 + l32 * r43 + l42 * r44;
|
|
13427
|
-
oe[offset + 14] = l13 * r41 + l23 * r42 + l33 * r43 + l43 * r44;
|
|
13428
|
-
oe[offset + 15] = l14 * r41 + l24 * r42 + l34 * r43 + l44 * r44;
|
|
13429
|
-
};
|
|
13430
|
-
/**
|
|
13431
|
-
* @internal
|
|
13432
|
-
* Simplify lodash get: https://github.com/lodash/lodash/blob/master/get.js.
|
|
13433
|
-
* @param target - The object to query.
|
|
13434
|
-
* @param path - The path of the property to get.
|
|
13435
|
-
* @returns Returns the resolved value.
|
|
13436
|
-
*/ Utils._reflectGet = function _reflectGet(target, path) {
|
|
13437
|
-
var pathArr = this._stringToPath(path);
|
|
13438
|
-
var object = target;
|
|
13439
|
-
var index = 0;
|
|
13440
|
-
var length = pathArr.length;
|
|
13441
|
-
while(object != null && index < length){
|
|
13442
|
-
object = object[pathArr[index++]];
|
|
13443
|
-
}
|
|
13444
|
-
return index && index == length ? object : undefined;
|
|
13445
|
-
};
|
|
13446
|
-
Utils._stringToPath = function _stringToPath(string) {
|
|
13447
|
-
var result = [];
|
|
13448
|
-
if (string.charCodeAt(0) === charCodeOfDot) {
|
|
13449
|
-
result.push("");
|
|
13450
|
-
}
|
|
13451
|
-
string.replace(rePropName, function(match, expression, quote, subString) {
|
|
13452
|
-
var key = match;
|
|
13453
|
-
if (quote) {
|
|
13454
|
-
key = subString.replace(reEscapeChar, "$1");
|
|
13455
|
-
} else if (expression) {
|
|
13456
|
-
key = expression.trim();
|
|
13457
|
-
}
|
|
13458
|
-
result.push(key);
|
|
13459
|
-
});
|
|
13460
|
-
return result;
|
|
13461
|
-
};
|
|
13462
|
-
return Utils;
|
|
13463
|
-
}();
|
|
13464
|
-
var charCodeOfDot = ".".charCodeAt(0);
|
|
13465
|
-
var reEscapeChar = /\\(\\)?/g;
|
|
13466
|
-
var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
13467
|
-
"[^.[\\]]+" + "|" + // Or match property names within brackets.
|
|
13468
|
-
"\\[(?:" + // Match a non-string expression.
|
|
13469
|
-
"([^\"'][^[]*)" + "|" + // Or match strings (supports escaping characters).
|
|
13470
|
-
"([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2" + ")\\]" + "|" + // Or match "" as the space between consecutive dots or empty brackets.
|
|
13471
|
-
"(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))", "g");
|
|
13472
|
-
|
|
13473
13666
|
/**
|
|
13474
13667
|
* SkinnedMeshRenderer.
|
|
13475
13668
|
*/ var SkinnedMeshRenderer = /*#__PURE__*/ function(MeshRenderer) {
|
|
@@ -13488,7 +13681,7 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13488
13681
|
// 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.
|
|
13489
13682
|
maxVertexUniformVectors = Math.min(maxVertexUniformVectors, 256);
|
|
13490
13683
|
_this._maxVertexUniformVectors = maxVertexUniformVectors;
|
|
13491
|
-
_this._onLocalBoundsChanged = _this._onLocalBoundsChanged.bind(
|
|
13684
|
+
_this._onLocalBoundsChanged = _this._onLocalBoundsChanged.bind(_assert_this_initialized(_this));
|
|
13492
13685
|
var localBounds = _this._localBounds;
|
|
13493
13686
|
// @ts-ignore
|
|
13494
13687
|
localBounds.min._onValueChanged = _this._onLocalBoundsChanged;
|
|
@@ -13550,8 +13743,8 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13550
13743
|
this._jointTexture = new Texture2D(engine, 4, jointCount, exports.TextureFormat.R32G32B32A32, false);
|
|
13551
13744
|
this._jointTexture.filterMode = exports.TextureFilterMode.Point;
|
|
13552
13745
|
}
|
|
13553
|
-
shaderData.disableMacro("
|
|
13554
|
-
shaderData.enableMacro("
|
|
13746
|
+
shaderData.disableMacro("RENDERER_JOINTS_NUM");
|
|
13747
|
+
shaderData.enableMacro("RENDERER_USE_JOINT_TEXTURE");
|
|
13555
13748
|
shaderData.setTexture(SkinnedMeshRenderer._jointSamplerProperty, this._jointTexture);
|
|
13556
13749
|
} else {
|
|
13557
13750
|
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);
|
|
@@ -13559,8 +13752,8 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13559
13752
|
} else {
|
|
13560
13753
|
var _this__jointTexture1;
|
|
13561
13754
|
(_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
|
|
13562
|
-
shaderData.disableMacro("
|
|
13563
|
-
shaderData.enableMacro("
|
|
13755
|
+
shaderData.disableMacro("RENDERER_USE_JOINT_TEXTURE");
|
|
13756
|
+
shaderData.enableMacro("RENDERER_JOINTS_NUM", remainUniformJointCount.toString());
|
|
13564
13757
|
shaderData.setFloatArray(SkinnedMeshRenderer._jointMatrixProperty, this._jointMatrices);
|
|
13565
13758
|
}
|
|
13566
13759
|
jointDataCreateCache.set(jointCount, bsUniformOccupiesCount);
|
|
@@ -13599,7 +13792,7 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13599
13792
|
if (!rhi) return;
|
|
13600
13793
|
var _this = this, skin = _this._skin, shaderData = _this.shaderData;
|
|
13601
13794
|
if (!skin) {
|
|
13602
|
-
shaderData.disableMacro("
|
|
13795
|
+
shaderData.disableMacro("RENDERER_HAS_SKIN");
|
|
13603
13796
|
return;
|
|
13604
13797
|
}
|
|
13605
13798
|
var joints = skin.joints;
|
|
@@ -13631,10 +13824,10 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13631
13824
|
}
|
|
13632
13825
|
this._rootBone = rootBone;
|
|
13633
13826
|
if (jointCount) {
|
|
13634
|
-
shaderData.enableMacro("
|
|
13827
|
+
shaderData.enableMacro("RENDERER_HAS_SKIN");
|
|
13635
13828
|
shaderData.setInt(SkinnedMeshRenderer._jointCountProperty, jointCount);
|
|
13636
13829
|
} else {
|
|
13637
|
-
shaderData.disableMacro("
|
|
13830
|
+
shaderData.disableMacro("RENDERER_HAS_SKIN");
|
|
13638
13831
|
}
|
|
13639
13832
|
};
|
|
13640
13833
|
_proto._computeApproximateBindMatrix = function _computeApproximateBindMatrix(jointEntities, inverseBindMatrices, rootEntity, approximateBindMatrix) {
|
|
@@ -13686,7 +13879,7 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13686
13879
|
_proto._onLocalBoundsChanged = function _onLocalBoundsChanged() {
|
|
13687
13880
|
this._dirtyUpdateFlag |= RendererUpdateFlags.WorldVolume;
|
|
13688
13881
|
};
|
|
13689
|
-
|
|
13882
|
+
_create_class(SkinnedMeshRenderer, [
|
|
13690
13883
|
{
|
|
13691
13884
|
key: "blendShapeWeights",
|
|
13692
13885
|
get: /**
|
|
@@ -13751,9 +13944,15 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13751
13944
|
]);
|
|
13752
13945
|
return SkinnedMeshRenderer;
|
|
13753
13946
|
}(MeshRenderer);
|
|
13754
|
-
|
|
13755
|
-
SkinnedMeshRenderer.
|
|
13756
|
-
|
|
13947
|
+
(function() {
|
|
13948
|
+
SkinnedMeshRenderer._jointCountProperty = ShaderProperty.getByName("renderer_JointCount");
|
|
13949
|
+
})();
|
|
13950
|
+
(function() {
|
|
13951
|
+
SkinnedMeshRenderer._jointSamplerProperty = ShaderProperty.getByName("renderer_JointSampler");
|
|
13952
|
+
})();
|
|
13953
|
+
(function() {
|
|
13954
|
+
SkinnedMeshRenderer._jointMatrixProperty = ShaderProperty.getByName("renderer_JointMatrix");
|
|
13955
|
+
})();
|
|
13757
13956
|
__decorate([
|
|
13758
13957
|
ignoreClone
|
|
13759
13958
|
], SkinnedMeshRenderer.prototype, "_hasInitSkin", void 0);
|
|
@@ -14754,7 +14953,7 @@ var PrimitiveType;
|
|
|
14754
14953
|
}
|
|
14755
14954
|
this._setIndexBufferBinding(binding);
|
|
14756
14955
|
};
|
|
14757
|
-
|
|
14956
|
+
_create_class(BufferMesh, [
|
|
14758
14957
|
{
|
|
14759
14958
|
key: "instanceCount",
|
|
14760
14959
|
get: /**
|
|
@@ -14821,7 +15020,7 @@ var PrimitiveType;
|
|
|
14821
15020
|
this._deltaNormals = null;
|
|
14822
15021
|
this._deltaTangents = null;
|
|
14823
15022
|
};
|
|
14824
|
-
|
|
15023
|
+
_create_class(BlendShapeFrame, [
|
|
14825
15024
|
{
|
|
14826
15025
|
key: "deltaPositions",
|
|
14827
15026
|
get: /**
|
|
@@ -14939,7 +15138,7 @@ var BlendShapeFrameDirty;
|
|
|
14939
15138
|
this._updateUseNormalAndTangent(!!frame.deltaNormals, !!frame.deltaTangents);
|
|
14940
15139
|
this._dataChangeManager.dispatch();
|
|
14941
15140
|
};
|
|
14942
|
-
|
|
15141
|
+
_create_class(BlendShape, [
|
|
14943
15142
|
{
|
|
14944
15143
|
key: "frames",
|
|
14945
15144
|
get: /**
|
|
@@ -15108,9 +15307,15 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
|
|
|
15108
15307
|
};
|
|
15109
15308
|
return Basic2DBatcher;
|
|
15110
15309
|
}();
|
|
15111
|
-
|
|
15112
|
-
|
|
15113
|
-
|
|
15310
|
+
(function() {
|
|
15311
|
+
Basic2DBatcher._disableBatchTag = ShaderTagKey.getByName("spriteDisableBatching");
|
|
15312
|
+
})();
|
|
15313
|
+
(function() {
|
|
15314
|
+
/** The maximum number of vertex. */ Basic2DBatcher.MAX_VERTEX_COUNT = 4096;
|
|
15315
|
+
})();
|
|
15316
|
+
(function() {
|
|
15317
|
+
Basic2DBatcher._canUploadSameBuffer = true;
|
|
15318
|
+
})();
|
|
15114
15319
|
|
|
15115
15320
|
var SpriteMaskBatcher = /*#__PURE__*/ function(Basic2DBatcher) {
|
|
15116
15321
|
_inherits(SpriteMaskBatcher, Basic2DBatcher);
|
|
@@ -15337,6 +15542,7 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
15337
15542
|
return;
|
|
15338
15543
|
}
|
|
15339
15544
|
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;
|
|
15545
|
+
var sceneData = context.camera.scene.shaderData;
|
|
15340
15546
|
var viewProjMatrix = Sky._viewProjMatrix, projectionMatrix = Sky._projectionMatrix;
|
|
15341
15547
|
var rhi = engine._hardwareRenderer;
|
|
15342
15548
|
var materialShaderData = material.shaderData, shader = material.shader, renderState = material.renderState;
|
|
@@ -15357,6 +15563,7 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
15357
15563
|
var program = shader.subShaders[0].passes[0]._getShaderProgram(engine, compileMacros);
|
|
15358
15564
|
program.bind();
|
|
15359
15565
|
program.groupingOtherUniformBlock();
|
|
15566
|
+
program.uploadAll(program.sceneUniformBlock, sceneData);
|
|
15360
15567
|
program.uploadAll(program.cameraUniformBlock, cameraShaderData);
|
|
15361
15568
|
program.uploadAll(program.materialUniformBlock, materialShaderData);
|
|
15362
15569
|
program.uploadUnGroupTextures();
|
|
@@ -15366,9 +15573,15 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
15366
15573
|
};
|
|
15367
15574
|
return Sky;
|
|
15368
15575
|
}();
|
|
15369
|
-
|
|
15370
|
-
Sky.
|
|
15371
|
-
|
|
15576
|
+
(function() {
|
|
15577
|
+
Sky._epsilon = 1e-6;
|
|
15578
|
+
})();
|
|
15579
|
+
(function() {
|
|
15580
|
+
Sky._viewProjMatrix = new miniprogram.Matrix();
|
|
15581
|
+
})();
|
|
15582
|
+
(function() {
|
|
15583
|
+
Sky._projectionMatrix = new miniprogram.Matrix(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, Sky._epsilon - 1, -1, 0, 0, 0, 0);
|
|
15584
|
+
})();
|
|
15372
15585
|
|
|
15373
15586
|
/**
|
|
15374
15587
|
* Background of scene.
|
|
@@ -15456,7 +15669,7 @@ Sky._projectionMatrix = new miniprogram.Matrix(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, Sky
|
|
|
15456
15669
|
mesh.addSubMesh(0, indices.length);
|
|
15457
15670
|
return mesh;
|
|
15458
15671
|
};
|
|
15459
|
-
|
|
15672
|
+
_create_class(Background, [
|
|
15460
15673
|
{
|
|
15461
15674
|
key: "texture",
|
|
15462
15675
|
get: /**
|
|
@@ -15468,7 +15681,7 @@ Sky._projectionMatrix = new miniprogram.Matrix(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, Sky
|
|
|
15468
15681
|
set: function set(value) {
|
|
15469
15682
|
if (this._texture !== value) {
|
|
15470
15683
|
this._texture = value;
|
|
15471
|
-
this._engine._backgroundTextureMaterial.shaderData.setTexture("
|
|
15684
|
+
this._engine._backgroundTextureMaterial.shaderData.setTexture("material_BaseTexture", value);
|
|
15472
15685
|
}
|
|
15473
15686
|
}
|
|
15474
15687
|
},
|
|
@@ -15624,7 +15837,7 @@ Sky._projectionMatrix = new miniprogram.Matrix(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, Sky
|
|
|
15624
15837
|
out[25] = src[25] * 0.429042;
|
|
15625
15838
|
out[26] = src[26] * 0.429042;
|
|
15626
15839
|
};
|
|
15627
|
-
|
|
15840
|
+
_create_class(AmbientLight, [
|
|
15628
15841
|
{
|
|
15629
15842
|
key: "specularTextureDecodeRGBM",
|
|
15630
15843
|
get: /**
|
|
@@ -15735,15 +15948,33 @@ Sky._projectionMatrix = new miniprogram.Matrix(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, Sky
|
|
|
15735
15948
|
]);
|
|
15736
15949
|
return AmbientLight;
|
|
15737
15950
|
}();
|
|
15738
|
-
|
|
15739
|
-
AmbientLight.
|
|
15740
|
-
|
|
15741
|
-
|
|
15742
|
-
AmbientLight.
|
|
15743
|
-
|
|
15744
|
-
|
|
15745
|
-
AmbientLight.
|
|
15746
|
-
|
|
15951
|
+
(function() {
|
|
15952
|
+
AmbientLight._shMacro = ShaderMacro.getByName("SCENE_USE_SH");
|
|
15953
|
+
})();
|
|
15954
|
+
(function() {
|
|
15955
|
+
AmbientLight._specularMacro = ShaderMacro.getByName("SCENE_USE_SPECULAR_ENV");
|
|
15956
|
+
})();
|
|
15957
|
+
(function() {
|
|
15958
|
+
AmbientLight._decodeRGBMMacro = ShaderMacro.getByName("SCENE_IS_DECODE_ENV_RGBM");
|
|
15959
|
+
})();
|
|
15960
|
+
(function() {
|
|
15961
|
+
AmbientLight._diffuseColorProperty = ShaderProperty.getByName("scene_EnvMapLight.diffuse");
|
|
15962
|
+
})();
|
|
15963
|
+
(function() {
|
|
15964
|
+
AmbientLight._diffuseSHProperty = ShaderProperty.getByName("scene_EnvSH");
|
|
15965
|
+
})();
|
|
15966
|
+
(function() {
|
|
15967
|
+
AmbientLight._diffuseIntensityProperty = ShaderProperty.getByName("scene_EnvMapLight.diffuseIntensity");
|
|
15968
|
+
})();
|
|
15969
|
+
(function() {
|
|
15970
|
+
AmbientLight._specularTextureProperty = ShaderProperty.getByName("scene_EnvSpecularSampler");
|
|
15971
|
+
})();
|
|
15972
|
+
(function() {
|
|
15973
|
+
AmbientLight._specularIntensityProperty = ShaderProperty.getByName("scene_EnvMapLight.specularIntensity");
|
|
15974
|
+
})();
|
|
15975
|
+
(function() {
|
|
15976
|
+
AmbientLight._mipLevelProperty = ShaderProperty.getByName("scene_EnvMapLight.mipMapLevel");
|
|
15977
|
+
})();
|
|
15747
15978
|
|
|
15748
15979
|
/**
|
|
15749
15980
|
* Scene.
|
|
@@ -15774,9 +16005,9 @@ AmbientLight._mipLevelProperty = ShaderProperty.getByName("u_envMapLight.mipMapL
|
|
|
15774
16005
|
var shaderData = _this.shaderData;
|
|
15775
16006
|
shaderData._addReferCount(1);
|
|
15776
16007
|
_this.ambientLight = new AmbientLight();
|
|
15777
|
-
engine.sceneManager._allScenes.push(
|
|
15778
|
-
shaderData.enableMacro("
|
|
15779
|
-
shaderData.enableMacro("
|
|
16008
|
+
engine.sceneManager._allScenes.push(_assert_this_initialized(_this));
|
|
16009
|
+
shaderData.enableMacro("SCENE_FOG_MODE", _this._fogMode.toString());
|
|
16010
|
+
shaderData.enableMacro("SCENE_SHADOW_CASCADED_COUNT", _this.shadowCascades.toString());
|
|
15780
16011
|
shaderData.setColor(Scene._fogColorProperty, _this._fogColor);
|
|
15781
16012
|
shaderData.setVector4(Scene._fogParamsProperty, _this._fogParams);
|
|
15782
16013
|
_this._computeLinearFogParams(_this._fogStart, _this._fogEnd);
|
|
@@ -15925,12 +16156,15 @@ AmbientLight._mipLevelProperty = ShaderProperty.getByName("u_envMapLight.mipMapL
|
|
|
15925
16156
|
lightManager._updateShaderData(this.shaderData);
|
|
15926
16157
|
var sunLightIndex = lightManager._getSunLightIndex();
|
|
15927
16158
|
if (sunLightIndex !== -1) {
|
|
15928
|
-
|
|
16159
|
+
var sunlight = lightManager._directLights.get(sunLightIndex);
|
|
16160
|
+
shaderData.setColor(Scene._sunlightColorProperty, sunlight.color);
|
|
16161
|
+
shaderData.setVector3(Scene._sunlightDirectionProperty, sunlight.direction);
|
|
16162
|
+
this._sunLight = sunlight;
|
|
15929
16163
|
}
|
|
15930
16164
|
if (this.castShadows && this._sunLight && this._sunLight.shadowType !== exports.ShadowType.None) {
|
|
15931
|
-
shaderData.enableMacro("
|
|
16165
|
+
shaderData.enableMacro("SCENE_SHADOW_TYPE", this._sunLight.shadowType.toString());
|
|
15932
16166
|
} else {
|
|
15933
|
-
shaderData.disableMacro("
|
|
16167
|
+
shaderData.disableMacro("SCENE_SHADOW_TYPE");
|
|
15934
16168
|
}
|
|
15935
16169
|
// union scene and camera macro.
|
|
15936
16170
|
ShaderMacroCollection.unionCollection(this.engine._macroCollection, shaderData._macroCollection, this._globalShaderMacro);
|
|
@@ -15983,7 +16217,7 @@ AmbientLight._mipLevelProperty = ShaderProperty.getByName("u_envMapLight.mipMapL
|
|
|
15983
16217
|
this._fogParams.z = density / Math.LN2;
|
|
15984
16218
|
this._fogParams.w = density / Math.sqrt(Math.LN2);
|
|
15985
16219
|
};
|
|
15986
|
-
|
|
16220
|
+
_create_class(Scene, [
|
|
15987
16221
|
{
|
|
15988
16222
|
key: "shadowCascades",
|
|
15989
16223
|
get: /**
|
|
@@ -15993,7 +16227,7 @@ AmbientLight._mipLevelProperty = ShaderProperty.getByName("u_envMapLight.mipMapL
|
|
|
15993
16227
|
},
|
|
15994
16228
|
set: function set(value) {
|
|
15995
16229
|
if (this._shadowCascades !== value) {
|
|
15996
|
-
this.shaderData.enableMacro("
|
|
16230
|
+
this.shaderData.enableMacro("SCENE_SHADOW_CASCADED_COUNT", value.toString());
|
|
15997
16231
|
this._shadowCascades = value;
|
|
15998
16232
|
}
|
|
15999
16233
|
}
|
|
@@ -16032,7 +16266,7 @@ AmbientLight._mipLevelProperty = ShaderProperty.getByName("u_envMapLight.mipMapL
|
|
|
16032
16266
|
},
|
|
16033
16267
|
set: function set(value) {
|
|
16034
16268
|
if (this._fogMode !== value) {
|
|
16035
|
-
this.shaderData.enableMacro("
|
|
16269
|
+
this.shaderData.enableMacro("SCENE_FOG_MODE", value.toString());
|
|
16036
16270
|
this._fogMode = value;
|
|
16037
16271
|
}
|
|
16038
16272
|
}
|
|
@@ -16111,8 +16345,18 @@ AmbientLight._mipLevelProperty = ShaderProperty.getByName("u_envMapLight.mipMapL
|
|
|
16111
16345
|
]);
|
|
16112
16346
|
return Scene;
|
|
16113
16347
|
}(EngineObject);
|
|
16114
|
-
|
|
16115
|
-
Scene.
|
|
16348
|
+
(function() {
|
|
16349
|
+
Scene._fogColorProperty = ShaderProperty.getByName("scene_FogColor");
|
|
16350
|
+
})();
|
|
16351
|
+
(function() {
|
|
16352
|
+
Scene._fogParamsProperty = ShaderProperty.getByName("scene_FogParams");
|
|
16353
|
+
})();
|
|
16354
|
+
(function() {
|
|
16355
|
+
Scene._sunlightColorProperty = ShaderProperty.getByName("scene_SunlightColor");
|
|
16356
|
+
})();
|
|
16357
|
+
(function() {
|
|
16358
|
+
Scene._sunlightDirectionProperty = ShaderProperty.getByName("scene_SunlightDirection");
|
|
16359
|
+
})();
|
|
16116
16360
|
|
|
16117
16361
|
/**
|
|
16118
16362
|
* Scene manager.
|
|
@@ -16160,7 +16404,7 @@ Scene._fogParamsProperty = ShaderProperty.getByName("galacean_FogParams");
|
|
|
16160
16404
|
}
|
|
16161
16405
|
allScenes.length = 0;
|
|
16162
16406
|
};
|
|
16163
|
-
|
|
16407
|
+
_create_class(SceneManager, [
|
|
16164
16408
|
{
|
|
16165
16409
|
key: "activeScene",
|
|
16166
16410
|
get: /**
|
|
@@ -16181,41 +16425,45 @@ Scene._fogParamsProperty = ShaderProperty.getByName("galacean_FogParams");
|
|
|
16181
16425
|
return SceneManager;
|
|
16182
16426
|
}();
|
|
16183
16427
|
|
|
16184
|
-
var backgroundTextureFs = "#define GLSLIFY 1\nuniform sampler2D
|
|
16428
|
+
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
|
|
16185
16429
|
|
|
16186
16430
|
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
|
|
16187
16431
|
|
|
16188
|
-
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 <
|
|
16432
|
+
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
|
|
16189
16433
|
|
|
16190
16434
|
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
|
|
16191
16435
|
|
|
16192
16436
|
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
|
|
16193
16437
|
|
|
16194
|
-
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
|
|
16438
|
+
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
|
|
16195
16439
|
|
|
16196
|
-
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
|
|
16440
|
+
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
|
|
16197
16441
|
|
|
16198
|
-
var pbrFs = "#define GLSLIFY 1\n#define IS_METALLIC_WORKFLOW\n#include <common>\n#include <camera_declare>\n#include <
|
|
16442
|
+
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
|
|
16199
16443
|
|
|
16200
16444
|
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
|
|
16201
16445
|
|
|
16202
|
-
var shadowMapFs = "#define GLSLIFY 1\n#ifdef
|
|
16446
|
+
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
|
|
16203
16447
|
|
|
16204
|
-
var shadowMapVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\n#include <blendShape_input>\n#include <normal_share>\nuniform mat4
|
|
16448
|
+
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
|
|
16205
16449
|
|
|
16206
|
-
var skyboxFs = "#define GLSLIFY 1\n#include <common>\nuniform samplerCube
|
|
16450
|
+
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
|
|
16207
16451
|
|
|
16208
|
-
var skyboxVs = "#define GLSLIFY 1\n#include <common_vert>\nuniform mat4
|
|
16452
|
+
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
|
|
16209
16453
|
|
|
16210
|
-
var
|
|
16454
|
+
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
|
|
16211
16455
|
|
|
16212
|
-
var
|
|
16456
|
+
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
|
|
16213
16457
|
|
|
16214
|
-
var
|
|
16458
|
+
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
|
|
16215
16459
|
|
|
16216
|
-
var
|
|
16460
|
+
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
|
|
16217
16461
|
|
|
16218
|
-
var
|
|
16462
|
+
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
|
|
16463
|
+
|
|
16464
|
+
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
|
|
16465
|
+
|
|
16466
|
+
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
|
|
16219
16467
|
|
|
16220
16468
|
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
|
|
16221
16469
|
|
|
@@ -16251,6 +16499,9 @@ var unlitVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\n#in
|
|
|
16251
16499
|
Shader.create("skybox", [
|
|
16252
16500
|
new ShaderPass(skyboxVs, skyboxFs, forwardPassTags)
|
|
16253
16501
|
]);
|
|
16502
|
+
Shader.create("SkyProcedural", [
|
|
16503
|
+
new ShaderPass(skyProceduralVs, skyProceduralFs, forwardPassTags)
|
|
16504
|
+
]);
|
|
16254
16505
|
Shader.create("particle-shader", [
|
|
16255
16506
|
new ShaderPass(particleVs, particleFs, forwardPassTags)
|
|
16256
16507
|
]);
|
|
@@ -16361,8 +16612,8 @@ ShaderPool.init();
|
|
|
16361
16612
|
/** @internal */ _this._fontMap = {};
|
|
16362
16613
|
/** @internal @todo: temporary solution */ _this._macroCollection = new ShaderMacroCollection();
|
|
16363
16614
|
_this._settings = {};
|
|
16364
|
-
_this._resourceManager = new ResourceManager(
|
|
16365
|
-
_this._sceneManager = new SceneManager(
|
|
16615
|
+
_this._resourceManager = new ResourceManager(_assert_this_initialized(_this));
|
|
16616
|
+
_this._sceneManager = new SceneManager(_assert_this_initialized(_this));
|
|
16366
16617
|
_this._vSyncCount = 1;
|
|
16367
16618
|
_this._targetFrameRate = 60;
|
|
16368
16619
|
_this._time = new Time();
|
|
@@ -16386,28 +16637,28 @@ ShaderPool.init();
|
|
|
16386
16637
|
}
|
|
16387
16638
|
};
|
|
16388
16639
|
_this._hardwareRenderer = hardwareRenderer;
|
|
16389
|
-
_this._hardwareRenderer.init(canvas, _this._onDeviceLost.bind(
|
|
16390
|
-
_this.physicsManager = new PhysicsManager(
|
|
16640
|
+
_this._hardwareRenderer.init(canvas, _this._onDeviceLost.bind(_assert_this_initialized(_this)), _this._onDeviceRestored.bind(_assert_this_initialized(_this)));
|
|
16641
|
+
_this.physicsManager = new PhysicsManager(_assert_this_initialized(_this));
|
|
16391
16642
|
_this._canvas = canvas;
|
|
16392
|
-
_this._sceneManager.activeScene = new Scene(
|
|
16393
|
-
_this._spriteMaskManager = new SpriteMaskManager(
|
|
16643
|
+
_this._sceneManager.activeScene = new Scene(_assert_this_initialized(_this), "DefaultScene");
|
|
16644
|
+
_this._spriteMaskManager = new SpriteMaskManager(_assert_this_initialized(_this));
|
|
16394
16645
|
_this._spriteDefaultMaterial = _this._createSpriteMaterial();
|
|
16395
16646
|
_this._spriteMaskDefaultMaterial = _this._createSpriteMaskMaterial();
|
|
16396
|
-
_this._textDefaultFont = Font.createFromOS(
|
|
16647
|
+
_this._textDefaultFont = Font.createFromOS(_assert_this_initialized(_this), "Arial");
|
|
16397
16648
|
_this._textDefaultFont.isGCIgnored = false;
|
|
16398
|
-
_this.inputManager = new InputManager(
|
|
16649
|
+
_this.inputManager = new InputManager(_assert_this_initialized(_this));
|
|
16399
16650
|
_this._initMagentaTextures(hardwareRenderer);
|
|
16400
16651
|
if (!hardwareRenderer.canIUse(exports.GLCapabilityType.depthTexture)) {
|
|
16401
16652
|
_this._macroCollection.enable(Engine._noDepthTextureMacro);
|
|
16402
16653
|
} else {
|
|
16403
|
-
var depthTexture2D = new Texture2D(
|
|
16654
|
+
var depthTexture2D = new Texture2D(_assert_this_initialized(_this), 1, 1, exports.TextureFormat.Depth16, false);
|
|
16404
16655
|
depthTexture2D.isGCIgnored = true;
|
|
16405
16656
|
_this._depthTexture2D = depthTexture2D;
|
|
16406
16657
|
}
|
|
16407
|
-
var magentaMaterial = new Material(
|
|
16408
|
-
magentaMaterial.shaderData.setColor("
|
|
16658
|
+
var magentaMaterial = new Material(_assert_this_initialized(_this), Shader.find("unlit"));
|
|
16659
|
+
magentaMaterial.shaderData.setColor("material_BaseColor", new Color(1.0, 0.0, 1.01, 1.0));
|
|
16409
16660
|
_this._magentaMaterial = magentaMaterial;
|
|
16410
|
-
var backgroundTextureMaterial = new Material(
|
|
16661
|
+
var backgroundTextureMaterial = new Material(_assert_this_initialized(_this), Shader.find("background-texture"));
|
|
16411
16662
|
backgroundTextureMaterial.isGCIgnored = true;
|
|
16412
16663
|
backgroundTextureMaterial.renderState.depthState.compareFunction = exports.CompareFunction.LessEqual;
|
|
16413
16664
|
_this._backgroundTextureMaterial = backgroundTextureMaterial;
|
|
@@ -16693,7 +16944,7 @@ ShaderPool.init();
|
|
|
16693
16944
|
console.error(error);
|
|
16694
16945
|
});
|
|
16695
16946
|
};
|
|
16696
|
-
|
|
16947
|
+
_create_class(Engine, [
|
|
16697
16948
|
{
|
|
16698
16949
|
key: "settings",
|
|
16699
16950
|
get: /**
|
|
@@ -16781,9 +17032,15 @@ ShaderPool.init();
|
|
|
16781
17032
|
]);
|
|
16782
17033
|
return Engine;
|
|
16783
17034
|
}(EventDispatcher);
|
|
16784
|
-
|
|
16785
|
-
/** @internal */ Engine.
|
|
16786
|
-
|
|
17035
|
+
(function() {
|
|
17036
|
+
/** @internal */ Engine._gammaMacro = ShaderMacro.getByName("ENGINE_IS_COLORSPACE_GAMMA");
|
|
17037
|
+
})();
|
|
17038
|
+
(function() {
|
|
17039
|
+
/** @internal */ Engine._noDepthTextureMacro = ShaderMacro.getByName("ENGINE_NO_DEPTH_TEXTURE");
|
|
17040
|
+
})();
|
|
17041
|
+
(function() {
|
|
17042
|
+
/** @internal Conversion of space units to pixel units for 2D. */ Engine._pixelsPerUnit = 100;
|
|
17043
|
+
})();
|
|
16787
17044
|
|
|
16788
17045
|
/**
|
|
16789
17046
|
* Script class, used for logic writing.
|
|
@@ -17101,7 +17358,9 @@ __decorate([
|
|
|
17101
17358
|
};
|
|
17102
17359
|
return SpriteBatcher;
|
|
17103
17360
|
}(Basic2DBatcher);
|
|
17104
|
-
|
|
17361
|
+
(function() {
|
|
17362
|
+
SpriteBatcher._textureProperty = ShaderProperty.getByName("renderer_SpriteTexture");
|
|
17363
|
+
})();
|
|
17105
17364
|
|
|
17106
17365
|
/**
|
|
17107
17366
|
* Render queue.
|
|
@@ -17602,227 +17861,247 @@ var /**
|
|
|
17602
17861
|
};
|
|
17603
17862
|
return ShadowUtils;
|
|
17604
17863
|
}();
|
|
17605
|
-
|
|
17606
|
-
|
|
17607
|
-
|
|
17608
|
-
|
|
17609
|
-
|
|
17610
|
-
new miniprogram.
|
|
17611
|
-
|
|
17612
|
-
|
|
17613
|
-
|
|
17614
|
-
|
|
17615
|
-
|
|
17616
|
-
|
|
17617
|
-
|
|
17618
|
-
|
|
17619
|
-
|
|
17620
|
-
|
|
17621
|
-
|
|
17622
|
-
|
|
17623
|
-
|
|
17624
|
-
|
|
17625
|
-
|
|
17626
|
-
|
|
17627
|
-
|
|
17628
|
-
|
|
17629
|
-
|
|
17630
|
-
|
|
17631
|
-
|
|
17632
|
-
|
|
17633
|
-
|
|
17634
|
-
|
|
17635
|
-
|
|
17636
|
-
|
|
17637
|
-
|
|
17638
|
-
miniprogram.FrustumFace.Top,
|
|
17639
|
-
miniprogram.FrustumFace.Bottom
|
|
17640
|
-
],
|
|
17641
|
-
[
|
|
17642
|
-
miniprogram.FrustumFace.Near,
|
|
17643
|
-
miniprogram.FrustumFace.Far,
|
|
17644
|
-
miniprogram.FrustumFace.Top,
|
|
17645
|
-
miniprogram.FrustumFace.Bottom
|
|
17646
|
-
],
|
|
17647
|
-
[
|
|
17648
|
-
miniprogram.FrustumFace.Near,
|
|
17649
|
-
miniprogram.FrustumFace.Far,
|
|
17650
|
-
miniprogram.FrustumFace.Left,
|
|
17651
|
-
miniprogram.FrustumFace.Right
|
|
17652
|
-
],
|
|
17653
|
-
[
|
|
17654
|
-
miniprogram.FrustumFace.Near,
|
|
17655
|
-
miniprogram.FrustumFace.Far,
|
|
17656
|
-
miniprogram.FrustumFace.Left,
|
|
17657
|
-
miniprogram.FrustumFace.Right
|
|
17658
|
-
]
|
|
17659
|
-
];
|
|
17660
|
-
/** near, far, left, right, bottom, top */ ShadowUtils._frustumTwoPlaneCorners = [
|
|
17661
|
-
[
|
|
17662
|
-
// near, far, left, right, bottom, top
|
|
17663
|
-
[
|
|
17664
|
-
8,
|
|
17665
|
-
8
|
|
17666
|
-
],
|
|
17667
|
-
[
|
|
17668
|
-
8,
|
|
17669
|
-
8
|
|
17670
|
-
],
|
|
17671
|
-
[
|
|
17672
|
-
4,
|
|
17673
|
-
5
|
|
17674
|
-
],
|
|
17675
|
-
[
|
|
17676
|
-
6,
|
|
17677
|
-
7
|
|
17678
|
-
],
|
|
17679
|
-
[
|
|
17680
|
-
7,
|
|
17681
|
-
4
|
|
17682
|
-
],
|
|
17683
|
-
[
|
|
17684
|
-
5,
|
|
17685
|
-
6
|
|
17686
|
-
]
|
|
17687
|
-
],
|
|
17688
|
-
[
|
|
17689
|
-
// near, far, left, right, bottom, top
|
|
17690
|
-
[
|
|
17691
|
-
8,
|
|
17692
|
-
8
|
|
17693
|
-
],
|
|
17694
|
-
[
|
|
17695
|
-
8,
|
|
17696
|
-
8
|
|
17697
|
-
],
|
|
17698
|
-
[
|
|
17699
|
-
1,
|
|
17700
|
-
0
|
|
17701
|
-
],
|
|
17702
|
-
[
|
|
17703
|
-
3,
|
|
17704
|
-
2
|
|
17705
|
-
],
|
|
17706
|
-
[
|
|
17707
|
-
0,
|
|
17708
|
-
3
|
|
17709
|
-
],
|
|
17710
|
-
[
|
|
17711
|
-
2,
|
|
17712
|
-
1
|
|
17713
|
-
]
|
|
17714
|
-
],
|
|
17715
|
-
[
|
|
17716
|
-
// near, far, left, right, bottom, top
|
|
17717
|
-
[
|
|
17718
|
-
5,
|
|
17719
|
-
4
|
|
17720
|
-
],
|
|
17721
|
-
[
|
|
17722
|
-
0,
|
|
17723
|
-
1
|
|
17724
|
-
],
|
|
17725
|
-
[
|
|
17726
|
-
8,
|
|
17727
|
-
8
|
|
17728
|
-
],
|
|
17729
|
-
[
|
|
17730
|
-
8,
|
|
17731
|
-
8
|
|
17732
|
-
],
|
|
17733
|
-
[
|
|
17734
|
-
4,
|
|
17735
|
-
0
|
|
17736
|
-
],
|
|
17737
|
-
[
|
|
17738
|
-
1,
|
|
17739
|
-
5
|
|
17740
|
-
]
|
|
17741
|
-
],
|
|
17742
|
-
[
|
|
17743
|
-
// near, far, left, right, bottom, top
|
|
17744
|
-
[
|
|
17745
|
-
7,
|
|
17746
|
-
6
|
|
17747
|
-
],
|
|
17748
|
-
[
|
|
17749
|
-
2,
|
|
17750
|
-
3
|
|
17751
|
-
],
|
|
17752
|
-
[
|
|
17753
|
-
8,
|
|
17754
|
-
8
|
|
17755
|
-
],
|
|
17756
|
-
[
|
|
17757
|
-
8,
|
|
17758
|
-
8
|
|
17759
|
-
],
|
|
17760
|
-
[
|
|
17761
|
-
3,
|
|
17762
|
-
7
|
|
17763
|
-
],
|
|
17764
|
-
[
|
|
17765
|
-
6,
|
|
17766
|
-
2
|
|
17767
|
-
]
|
|
17768
|
-
],
|
|
17769
|
-
[
|
|
17770
|
-
// near, far, left, right, bottom, top
|
|
17864
|
+
(function() {
|
|
17865
|
+
ShadowUtils._tempMatrix0 = new miniprogram.Matrix();
|
|
17866
|
+
})();
|
|
17867
|
+
(function() {
|
|
17868
|
+
// prettier-ignore
|
|
17869
|
+
/** @internal */ ShadowUtils._shadowMapCoordMatrix = new miniprogram.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);
|
|
17870
|
+
})();
|
|
17871
|
+
(function() {
|
|
17872
|
+
ShadowUtils._frustumCorners = [
|
|
17873
|
+
new miniprogram.Vector3(),
|
|
17874
|
+
new miniprogram.Vector3(),
|
|
17875
|
+
new miniprogram.Vector3(),
|
|
17876
|
+
new miniprogram.Vector3(),
|
|
17877
|
+
new miniprogram.Vector3(),
|
|
17878
|
+
new miniprogram.Vector3(),
|
|
17879
|
+
new miniprogram.Vector3(),
|
|
17880
|
+
new miniprogram.Vector3()
|
|
17881
|
+
];
|
|
17882
|
+
})();
|
|
17883
|
+
(function() {
|
|
17884
|
+
ShadowUtils._adjustNearPlane = new miniprogram.Plane(new miniprogram.Vector3());
|
|
17885
|
+
})();
|
|
17886
|
+
(function() {
|
|
17887
|
+
ShadowUtils._adjustFarPlane = new miniprogram.Plane(new miniprogram.Vector3());
|
|
17888
|
+
})();
|
|
17889
|
+
(function() {
|
|
17890
|
+
ShadowUtils._backPlaneFaces = new Array(5);
|
|
17891
|
+
})();
|
|
17892
|
+
(function() {
|
|
17893
|
+
ShadowUtils._edgePlanePoint2 = new miniprogram.Vector3();
|
|
17894
|
+
})();
|
|
17895
|
+
(function() {
|
|
17896
|
+
/** near, far, left, right, bottom, top */ ShadowUtils._frustumPlaneNeighbors = [
|
|
17771
17897
|
[
|
|
17772
|
-
|
|
17773
|
-
|
|
17898
|
+
miniprogram.FrustumFace.Left,
|
|
17899
|
+
miniprogram.FrustumFace.Right,
|
|
17900
|
+
miniprogram.FrustumFace.Top,
|
|
17901
|
+
miniprogram.FrustumFace.Bottom
|
|
17774
17902
|
],
|
|
17775
17903
|
[
|
|
17776
|
-
|
|
17777
|
-
|
|
17904
|
+
miniprogram.FrustumFace.Left,
|
|
17905
|
+
miniprogram.FrustumFace.Right,
|
|
17906
|
+
miniprogram.FrustumFace.Top,
|
|
17907
|
+
miniprogram.FrustumFace.Bottom
|
|
17778
17908
|
],
|
|
17779
17909
|
[
|
|
17780
|
-
|
|
17781
|
-
|
|
17910
|
+
miniprogram.FrustumFace.Near,
|
|
17911
|
+
miniprogram.FrustumFace.Far,
|
|
17912
|
+
miniprogram.FrustumFace.Top,
|
|
17913
|
+
miniprogram.FrustumFace.Bottom
|
|
17782
17914
|
],
|
|
17783
17915
|
[
|
|
17784
|
-
|
|
17785
|
-
|
|
17916
|
+
miniprogram.FrustumFace.Near,
|
|
17917
|
+
miniprogram.FrustumFace.Far,
|
|
17918
|
+
miniprogram.FrustumFace.Top,
|
|
17919
|
+
miniprogram.FrustumFace.Bottom
|
|
17786
17920
|
],
|
|
17787
17921
|
[
|
|
17788
|
-
|
|
17789
|
-
|
|
17922
|
+
miniprogram.FrustumFace.Near,
|
|
17923
|
+
miniprogram.FrustumFace.Far,
|
|
17924
|
+
miniprogram.FrustumFace.Left,
|
|
17925
|
+
miniprogram.FrustumFace.Right
|
|
17790
17926
|
],
|
|
17791
17927
|
[
|
|
17792
|
-
|
|
17793
|
-
|
|
17928
|
+
miniprogram.FrustumFace.Near,
|
|
17929
|
+
miniprogram.FrustumFace.Far,
|
|
17930
|
+
miniprogram.FrustumFace.Left,
|
|
17931
|
+
miniprogram.FrustumFace.Right
|
|
17794
17932
|
]
|
|
17795
|
-
]
|
|
17796
|
-
|
|
17797
|
-
|
|
17933
|
+
];
|
|
17934
|
+
})();
|
|
17935
|
+
(function() {
|
|
17936
|
+
/** near, far, left, right, bottom, top */ ShadowUtils._frustumTwoPlaneCorners = [
|
|
17798
17937
|
[
|
|
17799
|
-
|
|
17800
|
-
|
|
17938
|
+
// near, far, left, right, bottom, top
|
|
17939
|
+
[
|
|
17940
|
+
8,
|
|
17941
|
+
8
|
|
17942
|
+
],
|
|
17943
|
+
[
|
|
17944
|
+
8,
|
|
17945
|
+
8
|
|
17946
|
+
],
|
|
17947
|
+
[
|
|
17948
|
+
4,
|
|
17949
|
+
5
|
|
17950
|
+
],
|
|
17951
|
+
[
|
|
17952
|
+
6,
|
|
17953
|
+
7
|
|
17954
|
+
],
|
|
17955
|
+
[
|
|
17956
|
+
7,
|
|
17957
|
+
4
|
|
17958
|
+
],
|
|
17959
|
+
[
|
|
17960
|
+
5,
|
|
17961
|
+
6
|
|
17962
|
+
]
|
|
17801
17963
|
],
|
|
17802
17964
|
[
|
|
17803
|
-
|
|
17804
|
-
|
|
17965
|
+
// near, far, left, right, bottom, top
|
|
17966
|
+
[
|
|
17967
|
+
8,
|
|
17968
|
+
8
|
|
17969
|
+
],
|
|
17970
|
+
[
|
|
17971
|
+
8,
|
|
17972
|
+
8
|
|
17973
|
+
],
|
|
17974
|
+
[
|
|
17975
|
+
1,
|
|
17976
|
+
0
|
|
17977
|
+
],
|
|
17978
|
+
[
|
|
17979
|
+
3,
|
|
17980
|
+
2
|
|
17981
|
+
],
|
|
17982
|
+
[
|
|
17983
|
+
0,
|
|
17984
|
+
3
|
|
17985
|
+
],
|
|
17986
|
+
[
|
|
17987
|
+
2,
|
|
17988
|
+
1
|
|
17989
|
+
]
|
|
17805
17990
|
],
|
|
17806
17991
|
[
|
|
17807
|
-
|
|
17808
|
-
|
|
17992
|
+
// near, far, left, right, bottom, top
|
|
17993
|
+
[
|
|
17994
|
+
5,
|
|
17995
|
+
4
|
|
17996
|
+
],
|
|
17997
|
+
[
|
|
17998
|
+
0,
|
|
17999
|
+
1
|
|
18000
|
+
],
|
|
18001
|
+
[
|
|
18002
|
+
8,
|
|
18003
|
+
8
|
|
18004
|
+
],
|
|
18005
|
+
[
|
|
18006
|
+
8,
|
|
18007
|
+
8
|
|
18008
|
+
],
|
|
18009
|
+
[
|
|
18010
|
+
4,
|
|
18011
|
+
0
|
|
18012
|
+
],
|
|
18013
|
+
[
|
|
18014
|
+
1,
|
|
18015
|
+
5
|
|
18016
|
+
]
|
|
17809
18017
|
],
|
|
17810
18018
|
[
|
|
17811
|
-
|
|
17812
|
-
|
|
18019
|
+
// near, far, left, right, bottom, top
|
|
18020
|
+
[
|
|
18021
|
+
7,
|
|
18022
|
+
6
|
|
18023
|
+
],
|
|
18024
|
+
[
|
|
18025
|
+
2,
|
|
18026
|
+
3
|
|
18027
|
+
],
|
|
18028
|
+
[
|
|
18029
|
+
8,
|
|
18030
|
+
8
|
|
18031
|
+
],
|
|
18032
|
+
[
|
|
18033
|
+
8,
|
|
18034
|
+
8
|
|
18035
|
+
],
|
|
18036
|
+
[
|
|
18037
|
+
3,
|
|
18038
|
+
7
|
|
18039
|
+
],
|
|
18040
|
+
[
|
|
18041
|
+
6,
|
|
18042
|
+
2
|
|
18043
|
+
]
|
|
17813
18044
|
],
|
|
17814
18045
|
[
|
|
17815
|
-
|
|
17816
|
-
|
|
18046
|
+
// near, far, left, right, bottom, top
|
|
18047
|
+
[
|
|
18048
|
+
4,
|
|
18049
|
+
7
|
|
18050
|
+
],
|
|
18051
|
+
[
|
|
18052
|
+
3,
|
|
18053
|
+
0
|
|
18054
|
+
],
|
|
18055
|
+
[
|
|
18056
|
+
0,
|
|
18057
|
+
4
|
|
18058
|
+
],
|
|
18059
|
+
[
|
|
18060
|
+
7,
|
|
18061
|
+
3
|
|
18062
|
+
],
|
|
18063
|
+
[
|
|
18064
|
+
8,
|
|
18065
|
+
8
|
|
18066
|
+
],
|
|
18067
|
+
[
|
|
18068
|
+
8,
|
|
18069
|
+
8
|
|
18070
|
+
]
|
|
17817
18071
|
],
|
|
17818
18072
|
[
|
|
17819
|
-
|
|
17820
|
-
|
|
18073
|
+
// near, far, left, right, bottom, top
|
|
18074
|
+
[
|
|
18075
|
+
6,
|
|
18076
|
+
5
|
|
18077
|
+
],
|
|
18078
|
+
[
|
|
18079
|
+
1,
|
|
18080
|
+
2
|
|
18081
|
+
],
|
|
18082
|
+
[
|
|
18083
|
+
5,
|
|
18084
|
+
1
|
|
18085
|
+
],
|
|
18086
|
+
[
|
|
18087
|
+
2,
|
|
18088
|
+
6
|
|
18089
|
+
],
|
|
18090
|
+
[
|
|
18091
|
+
8,
|
|
18092
|
+
8
|
|
18093
|
+
],
|
|
18094
|
+
[
|
|
18095
|
+
8,
|
|
18096
|
+
8
|
|
18097
|
+
]
|
|
17821
18098
|
]
|
|
17822
|
-
]
|
|
17823
|
-
|
|
17824
|
-
|
|
17825
|
-
|
|
18099
|
+
];
|
|
18100
|
+
})();
|
|
18101
|
+
(function() {
|
|
18102
|
+
//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.
|
|
18103
|
+
ShadowUtils.atlasBorderSize = 4.0;
|
|
18104
|
+
})();
|
|
17826
18105
|
|
|
17827
18106
|
/**
|
|
17828
18107
|
* Cascade shadow caster.
|
|
@@ -18059,18 +18338,42 @@ ShadowUtils.atlasBorderSize = 4.0;
|
|
|
18059
18338
|
};
|
|
18060
18339
|
return CascadedShadowCasterPass;
|
|
18061
18340
|
}();
|
|
18062
|
-
|
|
18063
|
-
CascadedShadowCasterPass.
|
|
18064
|
-
|
|
18065
|
-
|
|
18066
|
-
CascadedShadowCasterPass.
|
|
18067
|
-
|
|
18068
|
-
|
|
18069
|
-
CascadedShadowCasterPass.
|
|
18070
|
-
|
|
18071
|
-
|
|
18072
|
-
CascadedShadowCasterPass.
|
|
18073
|
-
|
|
18341
|
+
(function() {
|
|
18342
|
+
CascadedShadowCasterPass._lightShadowBiasProperty = ShaderProperty.getByName("scene_ShadowBias");
|
|
18343
|
+
})();
|
|
18344
|
+
(function() {
|
|
18345
|
+
CascadedShadowCasterPass._lightDirectionProperty = ShaderProperty.getByName("scene_LightDirection");
|
|
18346
|
+
})();
|
|
18347
|
+
(function() {
|
|
18348
|
+
CascadedShadowCasterPass._shadowMatricesProperty = ShaderProperty.getByName("scene_ShadowMatrices");
|
|
18349
|
+
})();
|
|
18350
|
+
(function() {
|
|
18351
|
+
CascadedShadowCasterPass._shadowMapSize = ShaderProperty.getByName("scene_ShadowMapSize");
|
|
18352
|
+
})();
|
|
18353
|
+
(function() {
|
|
18354
|
+
CascadedShadowCasterPass._shadowInfosProperty = ShaderProperty.getByName("scene_ShadowInfo");
|
|
18355
|
+
})();
|
|
18356
|
+
(function() {
|
|
18357
|
+
CascadedShadowCasterPass._shadowMapsProperty = ShaderProperty.getByName("scene_ShadowMap");
|
|
18358
|
+
})();
|
|
18359
|
+
(function() {
|
|
18360
|
+
CascadedShadowCasterPass._shadowSplitSpheresProperty = ShaderProperty.getByName("scene_ShadowSplitSpheres");
|
|
18361
|
+
})();
|
|
18362
|
+
(function() {
|
|
18363
|
+
CascadedShadowCasterPass._maxCascades = 4;
|
|
18364
|
+
})();
|
|
18365
|
+
(function() {
|
|
18366
|
+
CascadedShadowCasterPass._cascadesSplitDistance = new Array(CascadedShadowCasterPass._maxCascades + 1);
|
|
18367
|
+
})();
|
|
18368
|
+
(function() {
|
|
18369
|
+
CascadedShadowCasterPass._clearColor = new miniprogram.Color(1, 1, 1, 1);
|
|
18370
|
+
})();
|
|
18371
|
+
(function() {
|
|
18372
|
+
CascadedShadowCasterPass._tempVector = new miniprogram.Vector3();
|
|
18373
|
+
})();
|
|
18374
|
+
(function() {
|
|
18375
|
+
CascadedShadowCasterPass._tempMatrix0 = new miniprogram.Matrix();
|
|
18376
|
+
})();
|
|
18074
18377
|
|
|
18075
18378
|
var passNum = 0;
|
|
18076
18379
|
/**
|
|
@@ -18338,7 +18641,7 @@ var passNum = 0;
|
|
|
18338
18641
|
renderer._prepareRender(context);
|
|
18339
18642
|
}
|
|
18340
18643
|
};
|
|
18341
|
-
|
|
18644
|
+
_create_class(BasicRenderPipeline, [
|
|
18342
18645
|
{
|
|
18343
18646
|
key: "defaultRenderPass",
|
|
18344
18647
|
get: /**
|
|
@@ -18350,15 +18653,25 @@ var passNum = 0;
|
|
|
18350
18653
|
]);
|
|
18351
18654
|
return BasicRenderPipeline;
|
|
18352
18655
|
}();
|
|
18353
|
-
|
|
18354
|
-
BasicRenderPipeline.
|
|
18656
|
+
(function() {
|
|
18657
|
+
BasicRenderPipeline._shadowCasterPipelineStageTagValue = exports.PipelineStage.ShadowCaster;
|
|
18658
|
+
})();
|
|
18659
|
+
(function() {
|
|
18660
|
+
BasicRenderPipeline._forwardPipelineStageTagValue = exports.PipelineStage.Forward;
|
|
18661
|
+
})();
|
|
18355
18662
|
|
|
18356
18663
|
var _Camera;
|
|
18357
18664
|
var MathTemp = function MathTemp() {
|
|
18358
18665
|
};
|
|
18359
|
-
|
|
18360
|
-
MathTemp.
|
|
18361
|
-
|
|
18666
|
+
(function() {
|
|
18667
|
+
MathTemp.tempVec4 = new miniprogram.Vector4();
|
|
18668
|
+
})();
|
|
18669
|
+
(function() {
|
|
18670
|
+
MathTemp.tempVec3 = new miniprogram.Vector3();
|
|
18671
|
+
})();
|
|
18672
|
+
(function() {
|
|
18673
|
+
MathTemp.tempVec2 = new miniprogram.Vector2();
|
|
18674
|
+
})();
|
|
18362
18675
|
exports.Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
18363
18676
|
_inherits(Camera1, Component);
|
|
18364
18677
|
function Camera1(entity) {
|
|
@@ -18376,6 +18689,8 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
18376
18689
|
* @remarks Support bit manipulation, corresponding to `Layer`.
|
|
18377
18690
|
*/ _this.cullingMask = exports.Layer.Everything;
|
|
18378
18691
|
/** @internal */ _this._globalShaderMacro = new ShaderMacroCollection();
|
|
18692
|
+
/** @internal */ _this._frustum = new miniprogram.BoundingFrustum();
|
|
18693
|
+
/** @internal */ _this._virtualCamera = new VirtualCamera();
|
|
18379
18694
|
/** @internal */ _this._replacementShader = null;
|
|
18380
18695
|
/** @internal */ _this._replacementSubShaderTag = null;
|
|
18381
18696
|
_this._isProjMatSetting = false;
|
|
@@ -18388,8 +18703,6 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
18388
18703
|
_this._isFrustumProjectDirty = true;
|
|
18389
18704
|
_this._customAspectRatio = undefined;
|
|
18390
18705
|
_this._renderTarget = null;
|
|
18391
|
-
/** @internal */ _this._frustum = new miniprogram.BoundingFrustum();
|
|
18392
|
-
/** @internal */ _this._virtualCamera = new VirtualCamera();
|
|
18393
18706
|
_this._viewport = new miniprogram.Vector4(0, 0, 1, 1);
|
|
18394
18707
|
_this._inverseProjectionMatrix = new miniprogram.Matrix();
|
|
18395
18708
|
_this._lastAspectSize = new miniprogram.Vector2(0, 0);
|
|
@@ -18399,7 +18712,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
18399
18712
|
_this._isViewMatrixDirty = transform.registerWorldChangeFlag();
|
|
18400
18713
|
_this._isInvViewProjDirty = transform.registerWorldChangeFlag();
|
|
18401
18714
|
_this._frustumViewChangeFlag = transform.registerWorldChangeFlag();
|
|
18402
|
-
_this._renderPipeline = new BasicRenderPipeline(
|
|
18715
|
+
_this._renderPipeline = new BasicRenderPipeline(_assert_this_initialized(_this));
|
|
18403
18716
|
_this.shaderData._addReferCount(1);
|
|
18404
18717
|
return _this;
|
|
18405
18718
|
}
|
|
@@ -18629,7 +18942,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
18629
18942
|
}
|
|
18630
18943
|
return this._inverseProjectionMatrix;
|
|
18631
18944
|
};
|
|
18632
|
-
|
|
18945
|
+
_create_class(Camera1, [
|
|
18633
18946
|
{
|
|
18634
18947
|
key: "nearClipPlane",
|
|
18635
18948
|
get: /**
|
|
@@ -18793,7 +19106,11 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
18793
19106
|
}
|
|
18794
19107
|
]);
|
|
18795
19108
|
return Camera1;
|
|
18796
|
-
}(Component),
|
|
19109
|
+
}(Component), function() {
|
|
19110
|
+
/** @internal */ _Camera._inverseViewMatrixProperty = ShaderProperty.getByName("camera_ViewInvMat");
|
|
19111
|
+
}(), function() {
|
|
19112
|
+
/** @internal */ _Camera._cameraPositionProperty = ShaderProperty.getByName("camera_Position");
|
|
19113
|
+
}(), _Camera);
|
|
18797
19114
|
__decorate([
|
|
18798
19115
|
deepClone
|
|
18799
19116
|
], exports.Camera.prototype, "_frustum", void 0);
|
|
@@ -19004,7 +19321,9 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
19004
19321
|
};
|
|
19005
19322
|
return Loader;
|
|
19006
19323
|
}();
|
|
19007
|
-
|
|
19324
|
+
(function() {
|
|
19325
|
+
Loader._engineObjects = {};
|
|
19326
|
+
})();
|
|
19008
19327
|
|
|
19009
19328
|
/**
|
|
19010
19329
|
* Asset Type.
|
|
@@ -19157,7 +19476,7 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19157
19476
|
target._isTransparent = this._isTransparent;
|
|
19158
19477
|
target._blendMode = this._blendMode;
|
|
19159
19478
|
};
|
|
19160
|
-
|
|
19479
|
+
_create_class(BaseMaterial, [
|
|
19161
19480
|
{
|
|
19162
19481
|
key: "shader",
|
|
19163
19482
|
get: /**
|
|
@@ -19261,19 +19580,45 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19261
19580
|
]);
|
|
19262
19581
|
return BaseMaterial;
|
|
19263
19582
|
}(Material);
|
|
19264
|
-
|
|
19265
|
-
BaseMaterial.
|
|
19266
|
-
|
|
19267
|
-
|
|
19268
|
-
BaseMaterial.
|
|
19269
|
-
|
|
19270
|
-
|
|
19271
|
-
BaseMaterial.
|
|
19272
|
-
|
|
19273
|
-
|
|
19274
|
-
BaseMaterial._transparentMacro = ShaderMacro.getByName("
|
|
19275
|
-
|
|
19276
|
-
|
|
19583
|
+
(function() {
|
|
19584
|
+
BaseMaterial._baseTextureMacro = ShaderMacro.getByName("MATERIAL_HAS_BASETEXTURE");
|
|
19585
|
+
})();
|
|
19586
|
+
(function() {
|
|
19587
|
+
BaseMaterial._normalTextureMacro = ShaderMacro.getByName("MATERIAL_HAS_NORMALTEXTURE");
|
|
19588
|
+
})();
|
|
19589
|
+
(function() {
|
|
19590
|
+
BaseMaterial._emissiveTextureMacro = ShaderMacro.getByName("MATERIAL_HAS_EMISSIVETEXTURE");
|
|
19591
|
+
})();
|
|
19592
|
+
(function() {
|
|
19593
|
+
BaseMaterial._transparentMacro = ShaderMacro.getByName("MATERIAL_IS_TRANSPARENT");
|
|
19594
|
+
})();
|
|
19595
|
+
(function() {
|
|
19596
|
+
BaseMaterial._baseColorProp = ShaderProperty.getByName("material_BaseColor");
|
|
19597
|
+
})();
|
|
19598
|
+
(function() {
|
|
19599
|
+
BaseMaterial._baseTextureProp = ShaderProperty.getByName("material_BaseTexture");
|
|
19600
|
+
})();
|
|
19601
|
+
(function() {
|
|
19602
|
+
BaseMaterial._tilingOffsetProp = ShaderProperty.getByName("material_TilingOffset");
|
|
19603
|
+
})();
|
|
19604
|
+
(function() {
|
|
19605
|
+
BaseMaterial._normalTextureProp = ShaderProperty.getByName("material_NormalTexture");
|
|
19606
|
+
})();
|
|
19607
|
+
(function() {
|
|
19608
|
+
BaseMaterial._normalIntensityProp = ShaderProperty.getByName("material_NormalIntensity");
|
|
19609
|
+
})();
|
|
19610
|
+
(function() {
|
|
19611
|
+
BaseMaterial._emissiveColorProp = ShaderProperty.getByName("material_EmissiveColor");
|
|
19612
|
+
})();
|
|
19613
|
+
(function() {
|
|
19614
|
+
BaseMaterial._emissiveTextureProp = ShaderProperty.getByName("material_EmissiveTexture");
|
|
19615
|
+
})();
|
|
19616
|
+
(function() {
|
|
19617
|
+
BaseMaterial._alphaCutoffProp = ShaderProperty.getByName("material_AlphaCutoff");
|
|
19618
|
+
})();
|
|
19619
|
+
(function() {
|
|
19620
|
+
BaseMaterial._alphaCutoffMacro = ShaderMacro.getByName("MATERIAL_IS_ALPHA_CUTOFF");
|
|
19621
|
+
})();
|
|
19277
19622
|
|
|
19278
19623
|
/**
|
|
19279
19624
|
* Blinn-phong Material.
|
|
@@ -19283,8 +19628,8 @@ BaseMaterial._alphaCutoffMacro = ShaderMacro.getByName("ALPHA_CUTOFF");
|
|
|
19283
19628
|
var _this;
|
|
19284
19629
|
_this = BaseMaterial.call(this, engine, Shader.find("blinn-phong")) || this;
|
|
19285
19630
|
var shaderData = _this.shaderData;
|
|
19286
|
-
shaderData.enableMacro("
|
|
19287
|
-
shaderData.enableMacro("
|
|
19631
|
+
shaderData.enableMacro("MATERIAL_NEED_WORLDPOS");
|
|
19632
|
+
shaderData.enableMacro("MATERIAL_NEED_TILINGOFFSET");
|
|
19288
19633
|
shaderData.setColor(BlinnPhongMaterial._baseColorProp, new miniprogram.Color(1, 1, 1, 1));
|
|
19289
19634
|
shaderData.setColor(BlinnPhongMaterial._specularColorProp, new miniprogram.Color(1, 1, 1, 1));
|
|
19290
19635
|
shaderData.setColor(BlinnPhongMaterial._emissiveColorProp, new miniprogram.Color(0, 0, 0, 1));
|
|
@@ -19301,7 +19646,7 @@ BaseMaterial._alphaCutoffMacro = ShaderMacro.getByName("ALPHA_CUTOFF");
|
|
|
19301
19646
|
this.cloneTo(dest);
|
|
19302
19647
|
return dest;
|
|
19303
19648
|
};
|
|
19304
|
-
|
|
19649
|
+
_create_class(BlinnPhongMaterial, [
|
|
19305
19650
|
{
|
|
19306
19651
|
key: "baseColor",
|
|
19307
19652
|
get: /**
|
|
@@ -19356,9 +19701,9 @@ BaseMaterial._alphaCutoffMacro = ShaderMacro.getByName("ALPHA_CUTOFF");
|
|
|
19356
19701
|
set: function set(value) {
|
|
19357
19702
|
this.shaderData.setTexture(BlinnPhongMaterial._specularTextureProp, value);
|
|
19358
19703
|
if (value) {
|
|
19359
|
-
this.shaderData.enableMacro("
|
|
19704
|
+
this.shaderData.enableMacro("MATERIAL_HAS_SPECULAR_TEXTURE");
|
|
19360
19705
|
} else {
|
|
19361
|
-
this.shaderData.disableMacro("
|
|
19706
|
+
this.shaderData.disableMacro("MATERIAL_HAS_SPECULAR_TEXTURE");
|
|
19362
19707
|
}
|
|
19363
19708
|
}
|
|
19364
19709
|
},
|
|
@@ -19447,9 +19792,15 @@ BaseMaterial._alphaCutoffMacro = ShaderMacro.getByName("ALPHA_CUTOFF");
|
|
|
19447
19792
|
]);
|
|
19448
19793
|
return BlinnPhongMaterial;
|
|
19449
19794
|
}(BaseMaterial);
|
|
19450
|
-
|
|
19451
|
-
BlinnPhongMaterial.
|
|
19452
|
-
|
|
19795
|
+
(function() {
|
|
19796
|
+
BlinnPhongMaterial._specularColorProp = ShaderProperty.getByName("material_SpecularColor");
|
|
19797
|
+
})();
|
|
19798
|
+
(function() {
|
|
19799
|
+
BlinnPhongMaterial._shininessProp = ShaderProperty.getByName("material_Shininess");
|
|
19800
|
+
})();
|
|
19801
|
+
(function() {
|
|
19802
|
+
BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_SpecularTexture");
|
|
19803
|
+
})();
|
|
19453
19804
|
|
|
19454
19805
|
/**
|
|
19455
19806
|
* Texture UV coordinate.
|
|
@@ -19473,8 +19824,8 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("u_specularTe
|
|
|
19473
19824
|
var _this;
|
|
19474
19825
|
_this = BaseMaterial.call(this, engine, shader) || this;
|
|
19475
19826
|
var shaderData = _this.shaderData;
|
|
19476
|
-
shaderData.enableMacro("
|
|
19477
|
-
shaderData.enableMacro("
|
|
19827
|
+
shaderData.enableMacro("MATERIAL_NEED_WORLDPOS");
|
|
19828
|
+
shaderData.enableMacro("MATERIAL_NEED_TILINGOFFSET");
|
|
19478
19829
|
shaderData.setColor(PBRBaseMaterial._baseColorProp, new miniprogram.Color(1, 1, 1, 1));
|
|
19479
19830
|
shaderData.setColor(PBRBaseMaterial._emissiveColorProp, new miniprogram.Color(0, 0, 0, 1));
|
|
19480
19831
|
shaderData.setVector4(PBRBaseMaterial._tilingOffsetProp, new miniprogram.Vector4(1, 1, 0, 0));
|
|
@@ -19485,7 +19836,7 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("u_specularTe
|
|
|
19485
19836
|
shaderData.setFloat(PBRBaseMaterial._clearCoatRoughnessProp, 0);
|
|
19486
19837
|
return _this;
|
|
19487
19838
|
}
|
|
19488
|
-
|
|
19839
|
+
_create_class(PBRBaseMaterial, [
|
|
19489
19840
|
{
|
|
19490
19841
|
key: "baseColor",
|
|
19491
19842
|
get: /**
|
|
@@ -19709,14 +20060,30 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("u_specularTe
|
|
|
19709
20060
|
]);
|
|
19710
20061
|
return PBRBaseMaterial;
|
|
19711
20062
|
}(BaseMaterial);
|
|
19712
|
-
|
|
19713
|
-
PBRBaseMaterial.
|
|
19714
|
-
|
|
19715
|
-
|
|
19716
|
-
PBRBaseMaterial.
|
|
19717
|
-
|
|
19718
|
-
|
|
19719
|
-
PBRBaseMaterial.
|
|
20063
|
+
(function() {
|
|
20064
|
+
PBRBaseMaterial._occlusionTextureIntensityProp = ShaderProperty.getByName("material_OcclusionIntensity");
|
|
20065
|
+
})();
|
|
20066
|
+
(function() {
|
|
20067
|
+
PBRBaseMaterial._occlusionTextureCoordProp = ShaderProperty.getByName("material_OcclusionTextureCoord");
|
|
20068
|
+
})();
|
|
20069
|
+
(function() {
|
|
20070
|
+
PBRBaseMaterial._occlusionTextureProp = ShaderProperty.getByName("material_OcclusionTexture");
|
|
20071
|
+
})();
|
|
20072
|
+
(function() {
|
|
20073
|
+
PBRBaseMaterial._clearCoatProp = ShaderProperty.getByName("material_ClearCoat");
|
|
20074
|
+
})();
|
|
20075
|
+
(function() {
|
|
20076
|
+
PBRBaseMaterial._clearCoatTextureProp = ShaderProperty.getByName("material_ClearCoatTexture");
|
|
20077
|
+
})();
|
|
20078
|
+
(function() {
|
|
20079
|
+
PBRBaseMaterial._clearCoatRoughnessProp = ShaderProperty.getByName("material_ClearCoatRoughness");
|
|
20080
|
+
})();
|
|
20081
|
+
(function() {
|
|
20082
|
+
PBRBaseMaterial._clearCoatRoughnessTextureProp = ShaderProperty.getByName("material_ClearCoatRoughnessTexture");
|
|
20083
|
+
})();
|
|
20084
|
+
(function() {
|
|
20085
|
+
PBRBaseMaterial._clearCoatNormalTextureProp = ShaderProperty.getByName("material_ClearCoatNormalTexture");
|
|
20086
|
+
})();
|
|
19720
20087
|
|
|
19721
20088
|
/**
|
|
19722
20089
|
* PBR (Metallic-Roughness Workflow) Material.
|
|
@@ -19737,7 +20104,7 @@ PBRBaseMaterial._clearCoatNormalTextureProp = ShaderProperty.getByName("u_clearC
|
|
|
19737
20104
|
this.cloneTo(dest);
|
|
19738
20105
|
return dest;
|
|
19739
20106
|
};
|
|
19740
|
-
|
|
20107
|
+
_create_class(PBRMaterial, [
|
|
19741
20108
|
{
|
|
19742
20109
|
key: "metallic",
|
|
19743
20110
|
get: /**
|
|
@@ -19771,18 +20138,24 @@ PBRBaseMaterial._clearCoatNormalTextureProp = ShaderProperty.getByName("u_clearC
|
|
|
19771
20138
|
set: function set(value) {
|
|
19772
20139
|
this.shaderData.setTexture(PBRMaterial._roughnessMetallicTextureProp, value);
|
|
19773
20140
|
if (value) {
|
|
19774
|
-
this.shaderData.enableMacro("
|
|
20141
|
+
this.shaderData.enableMacro("MATERIAL_ROUGHNESSMETALLICTEXTURE");
|
|
19775
20142
|
} else {
|
|
19776
|
-
this.shaderData.disableMacro("
|
|
20143
|
+
this.shaderData.disableMacro("MATERIAL_ROUGHNESSMETALLICTEXTURE");
|
|
19777
20144
|
}
|
|
19778
20145
|
}
|
|
19779
20146
|
}
|
|
19780
20147
|
]);
|
|
19781
20148
|
return PBRMaterial;
|
|
19782
20149
|
}(PBRBaseMaterial);
|
|
19783
|
-
|
|
19784
|
-
PBRMaterial.
|
|
19785
|
-
|
|
20150
|
+
(function() {
|
|
20151
|
+
PBRMaterial._metallicProp = ShaderProperty.getByName("material_Metal");
|
|
20152
|
+
})();
|
|
20153
|
+
(function() {
|
|
20154
|
+
PBRMaterial._roughnessProp = ShaderProperty.getByName("material_Roughness");
|
|
20155
|
+
})();
|
|
20156
|
+
(function() {
|
|
20157
|
+
PBRMaterial._roughnessMetallicTextureProp = ShaderProperty.getByName("material_RoughnessMetallicTexture");
|
|
20158
|
+
})();
|
|
19786
20159
|
|
|
19787
20160
|
/**
|
|
19788
20161
|
* PBR (Specular-Glossiness Workflow) Material.
|
|
@@ -19803,7 +20176,7 @@ PBRMaterial._roughnessMetallicTextureProp = ShaderProperty.getByName("u_roughnes
|
|
|
19803
20176
|
this.cloneTo(dest);
|
|
19804
20177
|
return dest;
|
|
19805
20178
|
};
|
|
19806
|
-
|
|
20179
|
+
_create_class(PBRSpecularMaterial, [
|
|
19807
20180
|
{
|
|
19808
20181
|
key: "specularColor",
|
|
19809
20182
|
get: /**
|
|
@@ -19849,10 +20222,18 @@ PBRMaterial._roughnessMetallicTextureProp = ShaderProperty.getByName("u_roughnes
|
|
|
19849
20222
|
]);
|
|
19850
20223
|
return PBRSpecularMaterial;
|
|
19851
20224
|
}(PBRBaseMaterial);
|
|
19852
|
-
|
|
19853
|
-
PBRSpecularMaterial.
|
|
19854
|
-
|
|
19855
|
-
|
|
20225
|
+
(function() {
|
|
20226
|
+
PBRSpecularMaterial._specularColorProp = ShaderProperty.getByName("material_PBRSpecularColor");
|
|
20227
|
+
})();
|
|
20228
|
+
(function() {
|
|
20229
|
+
PBRSpecularMaterial._glossinessProp = ShaderProperty.getByName("material_Glossiness");
|
|
20230
|
+
})();
|
|
20231
|
+
(function() {
|
|
20232
|
+
PBRSpecularMaterial._specularGlossinessTextureProp = ShaderProperty.getByName("material_SpecularGlossinessTexture");
|
|
20233
|
+
})();
|
|
20234
|
+
(function() {
|
|
20235
|
+
PBRSpecularMaterial._specularGlossinessTextureMacro = ShaderMacro.getByName("MATERIAL_HAS_SPECULARGLOSSINESSTEXTURE");
|
|
20236
|
+
})();
|
|
19856
20237
|
|
|
19857
20238
|
/**
|
|
19858
20239
|
* Unlit Material.
|
|
@@ -19862,8 +20243,8 @@ PBRSpecularMaterial._specularGlossinessTextureMacro = ShaderMacro.getByName("SPE
|
|
|
19862
20243
|
var _this;
|
|
19863
20244
|
_this = BaseMaterial.call(this, engine, Shader.find("unlit")) || this;
|
|
19864
20245
|
var shaderData = _this.shaderData;
|
|
19865
|
-
shaderData.enableMacro("
|
|
19866
|
-
shaderData.enableMacro("
|
|
20246
|
+
shaderData.enableMacro("MATERIAL_OMIT_NORMAL");
|
|
20247
|
+
shaderData.enableMacro("MATERIAL_NEED_TILINGOFFSET");
|
|
19867
20248
|
shaderData.setColor(UnlitMaterial._baseColorProp, new miniprogram.Color(1, 1, 1, 1));
|
|
19868
20249
|
shaderData.setVector4(UnlitMaterial._tilingOffsetProp, new miniprogram.Vector4(1, 1, 0, 0));
|
|
19869
20250
|
return _this;
|
|
@@ -19876,7 +20257,7 @@ PBRSpecularMaterial._specularGlossinessTextureMacro = ShaderMacro.getByName("SPE
|
|
|
19876
20257
|
this.cloneTo(dest);
|
|
19877
20258
|
return dest;
|
|
19878
20259
|
};
|
|
19879
|
-
|
|
20260
|
+
_create_class(UnlitMaterial, [
|
|
19880
20261
|
{
|
|
19881
20262
|
key: "baseColor",
|
|
19882
20263
|
get: /**
|
|
@@ -19995,7 +20376,7 @@ exports.TextVerticalAlignment = void 0;
|
|
|
19995
20376
|
this._sprites = null;
|
|
19996
20377
|
this._spriteNamesToIndex = null;
|
|
19997
20378
|
};
|
|
19998
|
-
|
|
20379
|
+
_create_class(SpriteAtlas, [
|
|
19999
20380
|
{
|
|
20000
20381
|
key: "sprites",
|
|
20001
20382
|
get: /**
|
|
@@ -20076,7 +20457,6 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20076
20457
|
* @returns Cloned sprite
|
|
20077
20458
|
*/ _proto.clone = function clone() {
|
|
20078
20459
|
var cloneSprite = new Sprite(this._engine, this._texture, this._region, this._pivot, this._border, this.name);
|
|
20079
|
-
cloneSprite._assetID = this._assetID;
|
|
20080
20460
|
cloneSprite._atlasRotated = this._atlasRotated;
|
|
20081
20461
|
cloneSprite._atlasRegion.copyFrom(this._atlasRegion);
|
|
20082
20462
|
cloneSprite._atlasRegionOffset.copyFrom(this._atlasRegionOffset);
|
|
@@ -20178,7 +20558,7 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20178
20558
|
}
|
|
20179
20559
|
this._updateFlagManager.dispatch(type);
|
|
20180
20560
|
};
|
|
20181
|
-
|
|
20561
|
+
_create_class(Sprite, [
|
|
20182
20562
|
{
|
|
20183
20563
|
key: "texture",
|
|
20184
20564
|
get: /**
|
|
@@ -20467,16 +20847,18 @@ var SlicedSpriteAssembler = (_SlicedSpriteAssembler = /*#__PURE__*/ function() {
|
|
|
20467
20847
|
};
|
|
20468
20848
|
SlicedSpriteAssembler1.updateUVs = function updateUVs(renderer) {};
|
|
20469
20849
|
return SlicedSpriteAssembler1;
|
|
20470
|
-
}(),
|
|
20850
|
+
}(), function() {
|
|
20851
|
+
_SlicedSpriteAssembler._worldMatrix = new miniprogram.Matrix();
|
|
20852
|
+
}(), _SlicedSpriteAssembler);
|
|
20471
20853
|
SlicedSpriteAssembler = __decorate([
|
|
20472
20854
|
StaticInterfaceImplement()
|
|
20473
20855
|
], SlicedSpriteAssembler);
|
|
20474
20856
|
|
|
20475
|
-
var _renderer__verticesData;
|
|
20476
20857
|
var _TiledSpriteAssembler;
|
|
20477
20858
|
var TiledSpriteAssembler = (_TiledSpriteAssembler = /*#__PURE__*/ function() {
|
|
20478
20859
|
function TiledSpriteAssembler1() {}
|
|
20479
20860
|
TiledSpriteAssembler1.resetData = function resetData(renderer) {
|
|
20861
|
+
var _renderer__verticesData;
|
|
20480
20862
|
(_renderer__verticesData = renderer._verticesData).triangles || (_renderer__verticesData.triangles = []);
|
|
20481
20863
|
};
|
|
20482
20864
|
TiledSpriteAssembler1.updatePositions = function updatePositions(renderer) {
|
|
@@ -20788,7 +21170,17 @@ var TiledSpriteAssembler = (_TiledSpriteAssembler = /*#__PURE__*/ function() {
|
|
|
20788
21170
|
}
|
|
20789
21171
|
};
|
|
20790
21172
|
return TiledSpriteAssembler1;
|
|
20791
|
-
}(),
|
|
21173
|
+
}(), function() {
|
|
21174
|
+
_TiledSpriteAssembler._worldMatrix = new miniprogram.Matrix();
|
|
21175
|
+
}(), function() {
|
|
21176
|
+
_TiledSpriteAssembler._posRow = new DisorderedArray();
|
|
21177
|
+
}(), function() {
|
|
21178
|
+
_TiledSpriteAssembler._posColumn = new DisorderedArray();
|
|
21179
|
+
}(), function() {
|
|
21180
|
+
_TiledSpriteAssembler._uvRow = new DisorderedArray();
|
|
21181
|
+
}(), function() {
|
|
21182
|
+
_TiledSpriteAssembler._uvColumn = new DisorderedArray();
|
|
21183
|
+
}(), _TiledSpriteAssembler);
|
|
20792
21184
|
TiledSpriteAssembler = __decorate([
|
|
20793
21185
|
StaticInterfaceImplement()
|
|
20794
21186
|
], TiledSpriteAssembler);
|
|
@@ -20819,7 +21211,7 @@ var TiledType;
|
|
|
20819
21211
|
_this._verticesData = new VertexData2D(4, [], [], null, _this._color);
|
|
20820
21212
|
_this.drawMode = exports.SpriteDrawMode.Simple;
|
|
20821
21213
|
_this.setMaterial(_this._engine._spriteDefaultMaterial);
|
|
20822
|
-
_this._onSpriteChange = _this._onSpriteChange.bind(
|
|
21214
|
+
_this._onSpriteChange = _this._onSpriteChange.bind(_assert_this_initialized(_this));
|
|
20823
21215
|
return _this;
|
|
20824
21216
|
}
|
|
20825
21217
|
var _proto = SpriteRenderer.prototype;
|
|
@@ -20937,7 +21329,7 @@ var TiledType;
|
|
|
20937
21329
|
break;
|
|
20938
21330
|
}
|
|
20939
21331
|
};
|
|
20940
|
-
|
|
21332
|
+
_create_class(SpriteRenderer, [
|
|
20941
21333
|
{
|
|
20942
21334
|
key: "drawMode",
|
|
20943
21335
|
get: /**
|
|
@@ -21122,7 +21514,9 @@ var TiledType;
|
|
|
21122
21514
|
]);
|
|
21123
21515
|
return SpriteRenderer;
|
|
21124
21516
|
}(exports.Renderer);
|
|
21125
|
-
|
|
21517
|
+
(function() {
|
|
21518
|
+
/** @internal */ SpriteRenderer._textureProperty = ShaderProperty.getByName("renderer_SpriteTexture");
|
|
21519
|
+
})();
|
|
21126
21520
|
__decorate([
|
|
21127
21521
|
ignoreClone
|
|
21128
21522
|
], SpriteRenderer.prototype, "_verticesData", void 0);
|
|
@@ -21185,14 +21579,16 @@ var /**
|
|
|
21185
21579
|
];
|
|
21186
21580
|
this.renderData = new VertexData2D(4, positions, null, CharRenderData.triangles, null);
|
|
21187
21581
|
};
|
|
21188
|
-
|
|
21189
|
-
|
|
21190
|
-
|
|
21191
|
-
|
|
21192
|
-
|
|
21193
|
-
|
|
21194
|
-
|
|
21195
|
-
|
|
21582
|
+
(function() {
|
|
21583
|
+
CharRenderData.triangles = [
|
|
21584
|
+
0,
|
|
21585
|
+
2,
|
|
21586
|
+
1,
|
|
21587
|
+
2,
|
|
21588
|
+
0,
|
|
21589
|
+
3
|
|
21590
|
+
];
|
|
21591
|
+
})();
|
|
21196
21592
|
|
|
21197
21593
|
/**
|
|
21198
21594
|
* @internal
|
|
@@ -21493,7 +21889,7 @@ CharRenderData.triangles = [
|
|
|
21493
21889
|
Renderer.prototype._onTransformChanged.call(this, bit);
|
|
21494
21890
|
this._setDirtyFlagTrue(0x4 | 0x8);
|
|
21495
21891
|
};
|
|
21496
|
-
|
|
21892
|
+
_create_class(TextRenderer, [
|
|
21497
21893
|
{
|
|
21498
21894
|
key: "color",
|
|
21499
21895
|
get: /**
|
|
@@ -21706,9 +22102,15 @@ CharRenderData.triangles = [
|
|
|
21706
22102
|
]);
|
|
21707
22103
|
return TextRenderer;
|
|
21708
22104
|
}(exports.Renderer);
|
|
21709
|
-
|
|
21710
|
-
TextRenderer.
|
|
21711
|
-
|
|
22105
|
+
(function() {
|
|
22106
|
+
TextRenderer._charRenderDataPool = new CharRenderDataPool(CharRenderData, 50);
|
|
22107
|
+
})();
|
|
22108
|
+
(function() {
|
|
22109
|
+
TextRenderer._tempVec30 = new miniprogram.Vector3();
|
|
22110
|
+
})();
|
|
22111
|
+
(function() {
|
|
22112
|
+
TextRenderer._tempVec31 = new miniprogram.Vector3();
|
|
22113
|
+
})();
|
|
21712
22114
|
__decorate([
|
|
21713
22115
|
assignmentClone
|
|
21714
22116
|
], TextRenderer.prototype, "_subFont", void 0);
|
|
@@ -21925,7 +22327,9 @@ var DirtyFlag;
|
|
|
21925
22327
|
};
|
|
21926
22328
|
return AnimationCurveOwner;
|
|
21927
22329
|
}();
|
|
21928
|
-
|
|
22330
|
+
(function() {
|
|
22331
|
+
AnimationCurveOwner._assemblerMap = new Map();
|
|
22332
|
+
})();
|
|
21929
22333
|
|
|
21930
22334
|
/**
|
|
21931
22335
|
* @internal
|
|
@@ -22103,7 +22507,7 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
22103
22507
|
}
|
|
22104
22508
|
}
|
|
22105
22509
|
};
|
|
22106
|
-
|
|
22510
|
+
_create_class(AnimationClip, [
|
|
22107
22511
|
{
|
|
22108
22512
|
key: "events",
|
|
22109
22513
|
get: /**
|
|
@@ -22251,7 +22655,7 @@ AnimationCurveOwner.registerAssembler(SkinnedMeshRenderer, "blendShapeWeights",
|
|
|
22251
22655
|
var result = this._evaluate(time, evaluateData);
|
|
22252
22656
|
return this._type._subtractValue(result, this.keys[0].value, evaluateData.value);
|
|
22253
22657
|
};
|
|
22254
|
-
|
|
22658
|
+
_create_class(AnimationCurve, [
|
|
22255
22659
|
{
|
|
22256
22660
|
key: "interpolation",
|
|
22257
22661
|
get: /**
|
|
@@ -22361,7 +22765,11 @@ exports.AnimationArrayCurve = (_AnimationArrayCurve = /*#__PURE__*/ function(Ani
|
|
|
22361
22765
|
return out;
|
|
22362
22766
|
};
|
|
22363
22767
|
return AnimationArrayCurve;
|
|
22364
|
-
}(AnimationCurve),
|
|
22768
|
+
}(AnimationCurve), function() {
|
|
22769
|
+
/** @internal */ _AnimationArrayCurve._isReferenceType = true;
|
|
22770
|
+
}(), function() {
|
|
22771
|
+
/** @internal */ _AnimationArrayCurve._isInterpolationType = true;
|
|
22772
|
+
}(), _AnimationArrayCurve);
|
|
22365
22773
|
exports.AnimationArrayCurve = __decorate([
|
|
22366
22774
|
StaticInterfaceImplement()
|
|
22367
22775
|
], exports.AnimationArrayCurve);
|
|
@@ -22414,7 +22822,11 @@ exports.AnimationBoolCurve = (_AnimationBoolCurve = /*#__PURE__*/ function(Anima
|
|
|
22414
22822
|
return frame.value;
|
|
22415
22823
|
};
|
|
22416
22824
|
return AnimationBoolCurve;
|
|
22417
|
-
}(AnimationCurve),
|
|
22825
|
+
}(AnimationCurve), function() {
|
|
22826
|
+
/** @internal */ _AnimationBoolCurve._isReferenceType = false;
|
|
22827
|
+
}(), function() {
|
|
22828
|
+
/** @internal */ _AnimationBoolCurve._isInterpolationType = false;
|
|
22829
|
+
}(), _AnimationBoolCurve);
|
|
22418
22830
|
exports.AnimationBoolCurve = __decorate([
|
|
22419
22831
|
StaticInterfaceImplement()
|
|
22420
22832
|
], exports.AnimationBoolCurve);
|
|
@@ -22507,7 +22919,11 @@ exports.AnimationColorCurve = (_AnimationColorCurve = /*#__PURE__*/ function(Ani
|
|
|
22507
22919
|
return out;
|
|
22508
22920
|
};
|
|
22509
22921
|
return AnimationColorCurve;
|
|
22510
|
-
}(AnimationCurve),
|
|
22922
|
+
}(AnimationCurve), function() {
|
|
22923
|
+
/** @internal */ _AnimationColorCurve._isReferenceType = true;
|
|
22924
|
+
}(), function() {
|
|
22925
|
+
/** @internal */ _AnimationColorCurve._isInterpolationType = true;
|
|
22926
|
+
}(), _AnimationColorCurve);
|
|
22511
22927
|
exports.AnimationColorCurve = __decorate([
|
|
22512
22928
|
StaticInterfaceImplement()
|
|
22513
22929
|
], exports.AnimationColorCurve);
|
|
@@ -22603,7 +23019,11 @@ exports.AnimationFloatArrayCurve = (_AnimationFloatArrayCurve = /*#__PURE__*/ fu
|
|
|
22603
23019
|
return out;
|
|
22604
23020
|
};
|
|
22605
23021
|
return AnimationFloatArrayCurve;
|
|
22606
|
-
}(AnimationCurve),
|
|
23022
|
+
}(AnimationCurve), function() {
|
|
23023
|
+
/** @internal */ _AnimationFloatArrayCurve._isReferenceType = true;
|
|
23024
|
+
}(), function() {
|
|
23025
|
+
/** @internal */ _AnimationFloatArrayCurve._isInterpolationType = true;
|
|
23026
|
+
}(), _AnimationFloatArrayCurve);
|
|
22607
23027
|
exports.AnimationFloatArrayCurve = __decorate([
|
|
22608
23028
|
StaticInterfaceImplement()
|
|
22609
23029
|
], exports.AnimationFloatArrayCurve);
|
|
@@ -22668,7 +23088,11 @@ exports.AnimationFloatCurve = (_AnimationFloatCurve = /*#__PURE__*/ function(Ani
|
|
|
22668
23088
|
}
|
|
22669
23089
|
};
|
|
22670
23090
|
return AnimationFloatCurve;
|
|
22671
|
-
}(AnimationCurve),
|
|
23091
|
+
}(AnimationCurve), function() {
|
|
23092
|
+
/** @internal */ _AnimationFloatCurve._isReferenceType = false;
|
|
23093
|
+
}(), function() {
|
|
23094
|
+
/** @internal */ _AnimationFloatCurve._isInterpolationType = true;
|
|
23095
|
+
}(), _AnimationFloatCurve);
|
|
22672
23096
|
exports.AnimationFloatCurve = __decorate([
|
|
22673
23097
|
StaticInterfaceImplement()
|
|
22674
23098
|
], exports.AnimationFloatCurve);
|
|
@@ -22766,7 +23190,13 @@ exports.AnimationQuaternionCurve = (_AnimationQuaternionCurve = /*#__PURE__*/ fu
|
|
|
22766
23190
|
return out;
|
|
22767
23191
|
};
|
|
22768
23192
|
return AnimationQuaternionCurve1;
|
|
22769
|
-
}(AnimationCurve),
|
|
23193
|
+
}(AnimationCurve), function() {
|
|
23194
|
+
/** @internal */ _AnimationQuaternionCurve._isInterpolationType = true;
|
|
23195
|
+
}(), function() {
|
|
23196
|
+
/** @internal */ _AnimationQuaternionCurve._isReferenceType = true;
|
|
23197
|
+
}(), function() {
|
|
23198
|
+
/** @internal */ _AnimationQuaternionCurve._tempConjugateQuat = new miniprogram.Quaternion();
|
|
23199
|
+
}(), _AnimationQuaternionCurve);
|
|
22770
23200
|
exports.AnimationQuaternionCurve = __decorate([
|
|
22771
23201
|
StaticInterfaceImplement()
|
|
22772
23202
|
], exports.AnimationQuaternionCurve);
|
|
@@ -22847,7 +23277,11 @@ exports.AnimationVector2Curve = (_AnimationVector2Curve = /*#__PURE__*/ function
|
|
|
22847
23277
|
return out;
|
|
22848
23278
|
};
|
|
22849
23279
|
return AnimationVector2Curve;
|
|
22850
|
-
}(AnimationCurve),
|
|
23280
|
+
}(AnimationCurve), function() {
|
|
23281
|
+
/** @internal */ _AnimationVector2Curve._isReferenceType = true;
|
|
23282
|
+
}(), function() {
|
|
23283
|
+
/** @internal */ _AnimationVector2Curve._isInterpolationType = true;
|
|
23284
|
+
}(), _AnimationVector2Curve);
|
|
22851
23285
|
exports.AnimationVector2Curve = __decorate([
|
|
22852
23286
|
StaticInterfaceImplement()
|
|
22853
23287
|
], exports.AnimationVector2Curve);
|
|
@@ -22940,7 +23374,11 @@ exports.AnimationVector3Curve = (_AnimationVector3Curve = /*#__PURE__*/ function
|
|
|
22940
23374
|
return out;
|
|
22941
23375
|
};
|
|
22942
23376
|
return AnimationVector3Curve;
|
|
22943
|
-
}(AnimationCurve),
|
|
23377
|
+
}(AnimationCurve), function() {
|
|
23378
|
+
/** @internal */ _AnimationVector3Curve._isReferenceType = true;
|
|
23379
|
+
}(), function() {
|
|
23380
|
+
/** @internal */ _AnimationVector3Curve._isInterpolationType = true;
|
|
23381
|
+
}(), _AnimationVector3Curve);
|
|
22944
23382
|
exports.AnimationVector3Curve = __decorate([
|
|
22945
23383
|
StaticInterfaceImplement()
|
|
22946
23384
|
], exports.AnimationVector3Curve);
|
|
@@ -23033,7 +23471,11 @@ exports.AnimationVector4Curve = (_AnimationVector4Curve = /*#__PURE__*/ function
|
|
|
23033
23471
|
return out;
|
|
23034
23472
|
};
|
|
23035
23473
|
return AnimationVector4Curve;
|
|
23036
|
-
}(AnimationCurve),
|
|
23474
|
+
}(AnimationCurve), function() {
|
|
23475
|
+
/** @internal */ _AnimationVector4Curve._isReferenceType = true;
|
|
23476
|
+
}(), function() {
|
|
23477
|
+
/** @internal */ _AnimationVector4Curve._isInterpolationType = true;
|
|
23478
|
+
}(), _AnimationVector4Curve);
|
|
23037
23479
|
exports.AnimationVector4Curve = __decorate([
|
|
23038
23480
|
StaticInterfaceImplement()
|
|
23039
23481
|
], exports.AnimationVector4Curve);
|
|
@@ -23749,7 +24191,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
23749
24191
|
}
|
|
23750
24192
|
}
|
|
23751
24193
|
};
|
|
23752
|
-
|
|
24194
|
+
_create_class(Animator, [
|
|
23753
24195
|
{
|
|
23754
24196
|
key: "animatorController",
|
|
23755
24197
|
get: /**
|
|
@@ -23840,7 +24282,7 @@ __decorate([
|
|
|
23840
24282
|
*/ _proto._registerChangeFlag = function _registerChangeFlag() {
|
|
23841
24283
|
return this._updateFlagManager.createFlag(BoolUpdateFlag);
|
|
23842
24284
|
};
|
|
23843
|
-
|
|
24285
|
+
_create_class(AnimatorController, [
|
|
23844
24286
|
{
|
|
23845
24287
|
key: "layers",
|
|
23846
24288
|
get: /**
|
|
@@ -23974,7 +24416,7 @@ __decorate([
|
|
|
23974
24416
|
index2 !== -1 && this._onStateExitScripts.splice(index2, 1);
|
|
23975
24417
|
}
|
|
23976
24418
|
};
|
|
23977
|
-
|
|
24419
|
+
_create_class(AnimatorState, [
|
|
23978
24420
|
{
|
|
23979
24421
|
key: "transitions",
|
|
23980
24422
|
get: /**
|
|
@@ -24094,55 +24536,265 @@ exports.AnimatorConditionMode = void 0;
|
|
|
24094
24536
|
};
|
|
24095
24537
|
|
|
24096
24538
|
/**
|
|
24097
|
-
*
|
|
24539
|
+
* SkyBoxMaterial.
|
|
24098
24540
|
*/ var SkyBoxMaterial = /*#__PURE__*/ function(Material) {
|
|
24099
24541
|
_inherits(SkyBoxMaterial, Material);
|
|
24100
24542
|
function SkyBoxMaterial(engine) {
|
|
24101
24543
|
var _this;
|
|
24102
24544
|
_this = Material.call(this, engine, Shader.find("skybox")) || this;
|
|
24103
|
-
_this.
|
|
24545
|
+
_this._textureDecodeRGBM = false;
|
|
24546
|
+
_this._tintColor = new miniprogram.Color(1, 1, 1, 1);
|
|
24104
24547
|
_this.renderState.rasterState.cullMode = exports.CullMode.Off;
|
|
24105
24548
|
_this.renderState.depthState.compareFunction = exports.CompareFunction.LessEqual;
|
|
24106
|
-
_this.shaderData.
|
|
24549
|
+
_this.shaderData.setFloat(SkyBoxMaterial._rotationProp, 0);
|
|
24550
|
+
_this.shaderData.setFloat(SkyBoxMaterial._exposureProp, 1);
|
|
24551
|
+
_this.shaderData.setColor(SkyBoxMaterial._tintColorProp, _this._tintColor);
|
|
24107
24552
|
return _this;
|
|
24108
24553
|
}
|
|
24109
|
-
|
|
24554
|
+
var _proto = SkyBoxMaterial.prototype;
|
|
24555
|
+
/**
|
|
24556
|
+
* @override
|
|
24557
|
+
*/ _proto.clone = function clone() {
|
|
24558
|
+
var dest = new SkyBoxMaterial(this._engine);
|
|
24559
|
+
this.cloneTo(dest);
|
|
24560
|
+
return dest;
|
|
24561
|
+
};
|
|
24562
|
+
_create_class(SkyBoxMaterial, [
|
|
24110
24563
|
{
|
|
24111
24564
|
key: "textureDecodeRGBM",
|
|
24112
24565
|
get: /**
|
|
24113
|
-
* Whether to decode
|
|
24566
|
+
* Whether to decode texture with RGBM format.
|
|
24567
|
+
*/ function get() {
|
|
24568
|
+
return this._textureDecodeRGBM;
|
|
24569
|
+
},
|
|
24570
|
+
set: function set(value) {
|
|
24571
|
+
this._textureDecodeRGBM = value;
|
|
24572
|
+
if (value) {
|
|
24573
|
+
this.shaderData.enableMacro(SkyBoxMaterial._decodeSkyRGBMMacro);
|
|
24574
|
+
} else {
|
|
24575
|
+
this.shaderData.disableMacro(SkyBoxMaterial._decodeSkyRGBMMacro);
|
|
24576
|
+
}
|
|
24577
|
+
}
|
|
24578
|
+
},
|
|
24579
|
+
{
|
|
24580
|
+
key: "texture",
|
|
24581
|
+
get: /**
|
|
24582
|
+
* Texture of the sky box material.
|
|
24583
|
+
*/ function get() {
|
|
24584
|
+
return this.shaderData.getTexture(SkyBoxMaterial._textureCubeProp);
|
|
24585
|
+
},
|
|
24586
|
+
set: function set(value) {
|
|
24587
|
+
this.shaderData.setTexture(SkyBoxMaterial._textureCubeProp, value);
|
|
24588
|
+
}
|
|
24589
|
+
},
|
|
24590
|
+
{
|
|
24591
|
+
key: "rotation",
|
|
24592
|
+
get: /**
|
|
24593
|
+
* The angle to rotate around the y-axis, unit is degree.
|
|
24114
24594
|
*/ function get() {
|
|
24115
|
-
return
|
|
24595
|
+
return this.shaderData.getFloat(SkyBoxMaterial._rotationProp);
|
|
24116
24596
|
},
|
|
24117
24597
|
set: function set(value) {
|
|
24118
|
-
this.
|
|
24598
|
+
this.shaderData.setFloat(SkyBoxMaterial._rotationProp, value);
|
|
24119
24599
|
}
|
|
24120
24600
|
},
|
|
24121
24601
|
{
|
|
24122
|
-
key: "
|
|
24602
|
+
key: "exposure",
|
|
24123
24603
|
get: /**
|
|
24124
|
-
*
|
|
24604
|
+
* The exposure value of this material.
|
|
24125
24605
|
*/ function get() {
|
|
24126
|
-
return this.
|
|
24606
|
+
return this.shaderData.getFloat(SkyBoxMaterial._exposureProp);
|
|
24127
24607
|
},
|
|
24128
24608
|
set: function set(value) {
|
|
24129
|
-
this.
|
|
24609
|
+
this.shaderData.setFloat(SkyBoxMaterial._exposureProp, value);
|
|
24130
24610
|
}
|
|
24131
24611
|
},
|
|
24132
24612
|
{
|
|
24133
|
-
key: "
|
|
24613
|
+
key: "tintColor",
|
|
24134
24614
|
get: /**
|
|
24135
|
-
*
|
|
24615
|
+
* The Tint color of this material.
|
|
24136
24616
|
*/ function get() {
|
|
24137
|
-
return this.
|
|
24617
|
+
return this._tintColor;
|
|
24138
24618
|
},
|
|
24139
|
-
set: function set(
|
|
24140
|
-
this.
|
|
24619
|
+
set: function set(value) {
|
|
24620
|
+
if (this._tintColor != value) {
|
|
24621
|
+
this._tintColor.copyFrom(value);
|
|
24622
|
+
}
|
|
24141
24623
|
}
|
|
24142
24624
|
}
|
|
24143
24625
|
]);
|
|
24144
24626
|
return SkyBoxMaterial;
|
|
24145
24627
|
}(Material);
|
|
24628
|
+
(function() {
|
|
24629
|
+
SkyBoxMaterial._tintColorProp = ShaderProperty.getByName("material_TintColor");
|
|
24630
|
+
})();
|
|
24631
|
+
(function() {
|
|
24632
|
+
SkyBoxMaterial._textureCubeProp = ShaderProperty.getByName("material_CubeTexture");
|
|
24633
|
+
})();
|
|
24634
|
+
(function() {
|
|
24635
|
+
SkyBoxMaterial._rotationProp = ShaderProperty.getByName("material_Rotation");
|
|
24636
|
+
})();
|
|
24637
|
+
(function() {
|
|
24638
|
+
SkyBoxMaterial._exposureProp = ShaderProperty.getByName("material_Exposure");
|
|
24639
|
+
})();
|
|
24640
|
+
(function() {
|
|
24641
|
+
SkyBoxMaterial._decodeSkyRGBMMacro = ShaderMacro.getByName("MATERIAL_IS_DECODE_SKY_RGBM");
|
|
24642
|
+
})();
|
|
24643
|
+
|
|
24644
|
+
exports.SunMode = void 0;
|
|
24645
|
+
(function(SunMode) {
|
|
24646
|
+
SunMode[SunMode[/** None */ "None"] = 0] = "None";
|
|
24647
|
+
SunMode[SunMode[/** Simple sun. */ "Simple"] = 1] = "Simple";
|
|
24648
|
+
SunMode[SunMode[/** High quality sun. */ "HighQuality"] = 2] = "HighQuality";
|
|
24649
|
+
})(exports.SunMode || (exports.SunMode = {}));
|
|
24650
|
+
/**
|
|
24651
|
+
* Sky procedural material.
|
|
24652
|
+
*/ var SkyProceduralMaterial = /*#__PURE__*/ function(Material) {
|
|
24653
|
+
_inherits(SkyProceduralMaterial, Material);
|
|
24654
|
+
function SkyProceduralMaterial(engine) {
|
|
24655
|
+
var _this;
|
|
24656
|
+
_this = Material.call(this, engine, Shader.find("SkyProcedural")) || this;
|
|
24657
|
+
_this.sunMode = 2;
|
|
24658
|
+
_this.sunSize = 0.04;
|
|
24659
|
+
_this.sunSizeConvergence = 5;
|
|
24660
|
+
_this.atmosphereThickness = 1.0;
|
|
24661
|
+
_this.skyTint = new miniprogram.Color(0.5, 0.5, 0.5, 1.0);
|
|
24662
|
+
_this.groundTint = new miniprogram.Color(0.369, 0.349, 0.341, 1.0);
|
|
24663
|
+
_this.exposure = 1.3;
|
|
24664
|
+
_this.renderState.rasterState.cullMode = exports.CullMode.Off;
|
|
24665
|
+
_this.renderState.depthState.compareFunction = exports.CompareFunction.LessEqual;
|
|
24666
|
+
return _this;
|
|
24667
|
+
}
|
|
24668
|
+
var _proto = SkyProceduralMaterial.prototype;
|
|
24669
|
+
/**
|
|
24670
|
+
* @override
|
|
24671
|
+
*/ _proto.clone = function clone() {
|
|
24672
|
+
var dest = new SkyProceduralMaterial(this._engine);
|
|
24673
|
+
this.cloneTo(dest);
|
|
24674
|
+
return dest;
|
|
24675
|
+
};
|
|
24676
|
+
_create_class(SkyProceduralMaterial, [
|
|
24677
|
+
{
|
|
24678
|
+
key: "sunMode",
|
|
24679
|
+
get: /**
|
|
24680
|
+
* Sun mode.
|
|
24681
|
+
*/ function get() {
|
|
24682
|
+
return this._sunDisk;
|
|
24683
|
+
},
|
|
24684
|
+
set: function set(value) {
|
|
24685
|
+
var shaderData = this.shaderData;
|
|
24686
|
+
switch(value){
|
|
24687
|
+
case 2:
|
|
24688
|
+
shaderData.disableMacro(SkyProceduralMaterial._sunSimpleMacro);
|
|
24689
|
+
shaderData.enableMacro(SkyProceduralMaterial._sunHighQualityMacro);
|
|
24690
|
+
break;
|
|
24691
|
+
case 1:
|
|
24692
|
+
shaderData.disableMacro(SkyProceduralMaterial._sunHighQualityMacro);
|
|
24693
|
+
shaderData.enableMacro(SkyProceduralMaterial._sunSimpleMacro);
|
|
24694
|
+
break;
|
|
24695
|
+
case 0:
|
|
24696
|
+
shaderData.disableMacro(SkyProceduralMaterial._sunHighQualityMacro);
|
|
24697
|
+
shaderData.disableMacro(SkyProceduralMaterial._sunSimpleMacro);
|
|
24698
|
+
break;
|
|
24699
|
+
default:
|
|
24700
|
+
throw "SkyBoxProceduralMaterial: unknown sun value.";
|
|
24701
|
+
}
|
|
24702
|
+
this._sunDisk = value;
|
|
24703
|
+
}
|
|
24704
|
+
},
|
|
24705
|
+
{
|
|
24706
|
+
key: "sunSize",
|
|
24707
|
+
get: /**
|
|
24708
|
+
* Sun size, range is 0 to 1.
|
|
24709
|
+
*/ function get() {
|
|
24710
|
+
return this.shaderData.getFloat(SkyProceduralMaterial._sunSizeProp);
|
|
24711
|
+
},
|
|
24712
|
+
set: function set(value) {
|
|
24713
|
+
this.shaderData.setFloat(SkyProceduralMaterial._sunSizeProp, Math.min(Math.max(0.0, value), 1.0));
|
|
24714
|
+
}
|
|
24715
|
+
},
|
|
24716
|
+
{
|
|
24717
|
+
key: "sunSizeConvergence",
|
|
24718
|
+
get: /**
|
|
24719
|
+
* Sun size convergence, range is 0 to 20.
|
|
24720
|
+
*/ function get() {
|
|
24721
|
+
return this.shaderData.getFloat(SkyProceduralMaterial._sunSizeConvergenceProp);
|
|
24722
|
+
},
|
|
24723
|
+
set: function set(value) {
|
|
24724
|
+
this.shaderData.setFloat(SkyProceduralMaterial._sunSizeConvergenceProp, Math.min(Math.max(0.0, value), 20.0));
|
|
24725
|
+
}
|
|
24726
|
+
},
|
|
24727
|
+
{
|
|
24728
|
+
key: "atmosphereThickness",
|
|
24729
|
+
get: /**
|
|
24730
|
+
* Atmosphere thickness, range is 0 to 5.
|
|
24731
|
+
*/ function get() {
|
|
24732
|
+
return this.shaderData.getFloat(SkyProceduralMaterial._atmosphereThicknessProp);
|
|
24733
|
+
},
|
|
24734
|
+
set: function set(value) {
|
|
24735
|
+
this.shaderData.setFloat(SkyProceduralMaterial._atmosphereThicknessProp, Math.min(Math.max(0.0, value), 5.0));
|
|
24736
|
+
}
|
|
24737
|
+
},
|
|
24738
|
+
{
|
|
24739
|
+
key: "skyTint",
|
|
24740
|
+
get: /**
|
|
24741
|
+
* Sky tint.
|
|
24742
|
+
*/ function get() {
|
|
24743
|
+
return this.shaderData.getColor(SkyProceduralMaterial._skyTintProp);
|
|
24744
|
+
},
|
|
24745
|
+
set: function set(value) {
|
|
24746
|
+
this.shaderData.setColor(SkyProceduralMaterial._skyTintProp, value);
|
|
24747
|
+
}
|
|
24748
|
+
},
|
|
24749
|
+
{
|
|
24750
|
+
key: "groundTint",
|
|
24751
|
+
get: /**
|
|
24752
|
+
* Ground tint.
|
|
24753
|
+
*/ function get() {
|
|
24754
|
+
return this.shaderData.getColor(SkyProceduralMaterial._groundTintProp);
|
|
24755
|
+
},
|
|
24756
|
+
set: function set(value) {
|
|
24757
|
+
this.shaderData.setColor(SkyProceduralMaterial._groundTintProp, value);
|
|
24758
|
+
}
|
|
24759
|
+
},
|
|
24760
|
+
{
|
|
24761
|
+
key: "exposure",
|
|
24762
|
+
get: /**
|
|
24763
|
+
* Exposure, range is 0 to 8.
|
|
24764
|
+
*/ function get() {
|
|
24765
|
+
return this.shaderData.getFloat(SkyProceduralMaterial._exposureProp);
|
|
24766
|
+
},
|
|
24767
|
+
set: function set(value) {
|
|
24768
|
+
this.shaderData.setFloat(SkyProceduralMaterial._exposureProp, Math.min(Math.max(0.0, value), 8.0));
|
|
24769
|
+
}
|
|
24770
|
+
}
|
|
24771
|
+
]);
|
|
24772
|
+
return SkyProceduralMaterial;
|
|
24773
|
+
}(Material);
|
|
24774
|
+
(function() {
|
|
24775
|
+
SkyProceduralMaterial._sunSizeProp = ShaderProperty.getByName("material_SunSize");
|
|
24776
|
+
})();
|
|
24777
|
+
(function() {
|
|
24778
|
+
SkyProceduralMaterial._sunSizeConvergenceProp = ShaderProperty.getByName("material_SunSizeConvergence");
|
|
24779
|
+
})();
|
|
24780
|
+
(function() {
|
|
24781
|
+
SkyProceduralMaterial._atmosphereThicknessProp = ShaderProperty.getByName("material_AtmosphereThickness");
|
|
24782
|
+
})();
|
|
24783
|
+
(function() {
|
|
24784
|
+
SkyProceduralMaterial._skyTintProp = ShaderProperty.getByName("material_SkyTint");
|
|
24785
|
+
})();
|
|
24786
|
+
(function() {
|
|
24787
|
+
SkyProceduralMaterial._groundTintProp = ShaderProperty.getByName("material_GroundTint");
|
|
24788
|
+
})();
|
|
24789
|
+
(function() {
|
|
24790
|
+
SkyProceduralMaterial._exposureProp = ShaderProperty.getByName("material_Exposure");
|
|
24791
|
+
})();
|
|
24792
|
+
(function() {
|
|
24793
|
+
SkyProceduralMaterial._sunHighQualityMacro = ShaderMacro.getByName("MATERIAL_SUN_HIGH_QUALITY");
|
|
24794
|
+
})();
|
|
24795
|
+
(function() {
|
|
24796
|
+
SkyProceduralMaterial._sunSimpleMacro = ShaderMacro.getByName("MATERIAL_SUN_SIMPLE");
|
|
24797
|
+
})();
|
|
24146
24798
|
|
|
24147
24799
|
var DirtyFlagType;
|
|
24148
24800
|
(function(DirtyFlagType) {
|
|
@@ -24205,7 +24857,7 @@ exports.ParticleRendererBlendMode = void 0;
|
|
|
24205
24857
|
_this._isFadeOut = false;
|
|
24206
24858
|
_this._playOnEnable = true;
|
|
24207
24859
|
_this._blendMode = 0;
|
|
24208
|
-
_this._onColorChanged = _this._onColorChanged.bind(
|
|
24860
|
+
_this._onColorChanged = _this._onColorChanged.bind(_assert_this_initialized(_this));
|
|
24209
24861
|
//@ts-ignore
|
|
24210
24862
|
_this._color._onValueChanged = _this._onColorChanged;
|
|
24211
24863
|
_this.setMaterial(_this._createMaterial());
|
|
@@ -24482,7 +25134,7 @@ exports.ParticleRendererBlendMode = void 0;
|
|
|
24482
25134
|
ParticleRenderer._getRandom = function _getRandom() {
|
|
24483
25135
|
return Math.random() - 0.5;
|
|
24484
25136
|
};
|
|
24485
|
-
|
|
25137
|
+
_create_class(ParticleRenderer, [
|
|
24486
25138
|
{
|
|
24487
25139
|
key: "texture",
|
|
24488
25140
|
get: /**
|
|
@@ -24913,14 +25565,16 @@ exports.ParticleRendererBlendMode = void 0;
|
|
|
24913
25565
|
]);
|
|
24914
25566
|
return ParticleRenderer;
|
|
24915
25567
|
}(MeshRenderer);
|
|
24916
|
-
|
|
25568
|
+
(function() {
|
|
25569
|
+
/** The max number of indices that Uint16Array can support. */ ParticleRenderer._uint16VertexLimit = 65535;
|
|
25570
|
+
})();
|
|
24917
25571
|
__decorate([
|
|
24918
25572
|
ignoreClone
|
|
24919
25573
|
], ParticleRenderer.prototype, "_onColorChanged", null);
|
|
24920
25574
|
|
|
24921
25575
|
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
|
|
24922
25576
|
|
|
24923
|
-
var VERT_SHADER = "#define GLSLIFY 1\nattribute vec3 POSITION;attribute vec2 TEXCOORD_0;varying vec2 v_uv;uniform mat4
|
|
25577
|
+
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
|
|
24924
25578
|
|
|
24925
25579
|
Shader.create("trail", VERT_SHADER, FRAG_SHADER);
|
|
24926
25580
|
var TrailMaterial = /*#__PURE__*/ function(Material) {
|
|
@@ -25183,7 +25837,7 @@ var _tempVector3 = new miniprogram.Vector3();
|
|
|
25183
25837
|
this._camera.renderTarget = this._oriCameraRenderTarget;
|
|
25184
25838
|
this._camera.cullingMask = this._oriCameraCullingMask;
|
|
25185
25839
|
};
|
|
25186
|
-
|
|
25840
|
+
_create_class(Probe, [
|
|
25187
25841
|
{
|
|
25188
25842
|
key: "_texture",
|
|
25189
25843
|
get: function get() {
|
|
@@ -25337,7 +25991,6 @@ exports.Material = Material;
|
|
|
25337
25991
|
exports.Mesh = Mesh;
|
|
25338
25992
|
exports.MeshRenderer = MeshRenderer;
|
|
25339
25993
|
exports.ModelMesh = ModelMesh;
|
|
25340
|
-
exports.ObjectValues = ObjectValues;
|
|
25341
25994
|
exports.PBRBaseMaterial = PBRBaseMaterial;
|
|
25342
25995
|
exports.PBRMaterial = PBRMaterial;
|
|
25343
25996
|
exports.PBRSpecularMaterial = PBRSpecularMaterial;
|
|
@@ -25369,6 +26022,7 @@ exports.Skin = Skin;
|
|
|
25369
26022
|
exports.SkinnedMeshRenderer = SkinnedMeshRenderer;
|
|
25370
26023
|
exports.Sky = Sky;
|
|
25371
26024
|
exports.SkyBoxMaterial = SkyBoxMaterial;
|
|
26025
|
+
exports.SkyProceduralMaterial = SkyProceduralMaterial;
|
|
25372
26026
|
exports.SphereColliderShape = SphereColliderShape;
|
|
25373
26027
|
exports.SpotLight = SpotLight;
|
|
25374
26028
|
exports.SpringJoint = SpringJoint;
|
|
@@ -25392,7 +26046,7 @@ exports.TrailMaterial = TrailMaterial;
|
|
|
25392
26046
|
exports.TrailRenderer = TrailRenderer;
|
|
25393
26047
|
exports.Transform = Transform;
|
|
25394
26048
|
exports.UnlitMaterial = UnlitMaterial;
|
|
25395
|
-
exports.
|
|
26049
|
+
exports.Utils = Utils;
|
|
25396
26050
|
exports.VertexBufferBinding = VertexBufferBinding;
|
|
25397
26051
|
exports.VertexElement = VertexElement;
|
|
25398
26052
|
exports.assignmentClone = assignmentClone;
|