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