@galacean/engine-core 1.6.0-alpha.2 → 1.6.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/module.js CHANGED
@@ -4261,6 +4261,15 @@ __decorate([
4261
4261
  return CullMode;
4262
4262
  }({});
4263
4263
 
4264
+ /**
4265
+ * Render queue type.
4266
+ */ var RenderQueueType = /*#__PURE__*/ function(RenderQueueType) {
4267
+ /** Opaque queue. */ RenderQueueType[RenderQueueType["Opaque"] = 0] = "Opaque";
4268
+ /** Opaque queue, alpha cutoff. */ RenderQueueType[RenderQueueType["AlphaTest"] = 1] = "AlphaTest";
4269
+ /** Transparent queue, rendering from back to front to ensure correct rendering of transparent objects. */ RenderQueueType[RenderQueueType["Transparent"] = 2] = "Transparent";
4270
+ return RenderQueueType;
4271
+ }({});
4272
+
4264
4273
  var RenderStateElementKey = /*#__PURE__*/ function(RenderStateElementKey) {
4265
4274
  /** Blend state enabled for target 0 key. */ RenderStateElementKey[RenderStateElementKey["BlendStateEnabled0"] = 0] = "BlendStateEnabled0";
4266
4275
  /** Blend state color blend operation for target 0 key. */ RenderStateElementKey[RenderStateElementKey["BlendStateColorBlendOperation0"] = 1] = "BlendStateColorBlendOperation0";
@@ -4294,15 +4303,6 @@ var RenderStateElementKey = /*#__PURE__*/ function(RenderStateElementKey) {
4294
4303
  return RenderStateElementKey;
4295
4304
  }({});
4296
4305
 
4297
- /**
4298
- * Render queue type.
4299
- */ var RenderQueueType = /*#__PURE__*/ function(RenderQueueType) {
4300
- /** Opaque queue. */ RenderQueueType[RenderQueueType["Opaque"] = 0] = "Opaque";
4301
- /** Opaque queue, alpha cutoff. */ RenderQueueType[RenderQueueType["AlphaTest"] = 1] = "AlphaTest";
4302
- /** Transparent queue, rendering from back to front to ensure correct rendering of transparent objects. */ RenderQueueType[RenderQueueType["Transparent"] = 2] = "Transparent";
4303
- return RenderQueueType;
4304
- }({});
4305
-
4306
4306
  /**
4307
4307
  * Shader data grouping.
4308
4308
  */ var ShaderDataGroup = /*#__PURE__*/ function(ShaderDataGroup) {
@@ -4314,6 +4314,14 @@ var RenderStateElementKey = /*#__PURE__*/ function(RenderStateElementKey) {
4314
4314
  return ShaderDataGroup;
4315
4315
  }({});
4316
4316
 
4317
+ /**
4318
+ * Shader language belongs to.
4319
+ */ var ShaderLanguage = /*#__PURE__*/ function(ShaderLanguage) {
4320
+ /** GLSL ES 100. */ ShaderLanguage[ShaderLanguage["GLSLES100"] = 0] = "GLSLES100";
4321
+ /** GLSL ES 300. */ ShaderLanguage[ShaderLanguage["GLSLES300"] = 1] = "GLSLES300";
4322
+ return ShaderLanguage;
4323
+ }({});
4324
+
4317
4325
  /**
4318
4326
  * Shader Property type.
4319
4327
  */ var ShaderPropertyType = /*#__PURE__*/ function(ShaderPropertyType) {
@@ -4346,51 +4354,6 @@ var RenderStateElementKey = /*#__PURE__*/ function(RenderStateElementKey) {
4346
4354
  return StencilOperation;
4347
4355
  }({});
4348
4356
 
4349
- var ShaderPlatformTarget = /*#__PURE__*/ function(ShaderPlatformTarget) {
4350
- ShaderPlatformTarget[ShaderPlatformTarget["GLES100"] = 0] = "GLES100";
4351
- ShaderPlatformTarget[ShaderPlatformTarget["GLES300"] = 1] = "GLES300";
4352
- return ShaderPlatformTarget;
4353
- }({});
4354
-
4355
- function _array_like_to_array(arr, len) {
4356
- if (len == null || len > arr.length) len = arr.length;
4357
-
4358
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
4359
-
4360
- return arr2;
4361
- }
4362
-
4363
- function _unsupported_iterable_to_array(o, minLen) {
4364
- if (!o) return;
4365
- if (typeof o === "string") return _array_like_to_array(o, minLen);
4366
-
4367
- var n = Object.prototype.toString.call(o).slice(8, -1);
4368
-
4369
- if (n === "Object" && o.constructor) n = o.constructor.name;
4370
- if (n === "Map" || n === "Set") return Array.from(n);
4371
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
4372
- }
4373
-
4374
- function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
4375
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
4376
-
4377
- if (it) return (it = it.call(o)).next.bind(it);
4378
- // Fallback for engines without symbol support
4379
- if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike && o && typeof o.length === "number") {
4380
- if (it) o = it;
4381
-
4382
- var i = 0;
4383
-
4384
- return function() {
4385
- if (i >= o.length) return { done: true };
4386
-
4387
- return { done: false, value: o[i++] };
4388
- };
4389
- }
4390
-
4391
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
4392
- }
4393
-
4394
4357
  /**
4395
4358
  * Shader macro。
4396
4359
  */ var ShaderMacro = /*#__PURE__*/ function() {
@@ -4624,7 +4587,7 @@ function _extends() {
4624
4587
 
4625
4588
  var camera_declare = "uniform vec3 camera_Position;\nuniform vec3 camera_Forward; "; // eslint-disable-line
4626
4589
 
4627
- var common = "#define PI 3.14159265359\n#define RECIPROCAL_PI 0.31830988618\n#define EPSILON 1e-6\n#define LOG2 1.442695\n#define HALF_MIN 6.103515625e-5 // 2^-14, the same value for 10, 11 and 16-bit: https://www.khronos.org/opengl/wiki/Small_Float_Formats\n#define HALF_EPS 4.8828125e-4 // 2^-11, machine epsilon: 1 + EPS = 1 (half of the ULP for 1.0f)\n\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n\nfloat pow2(float x ) {\n return x * x;\n}\n\nvec4 RGBMToLinear(vec4 value, float maxRange ) {\n return vec4( value.rgb * value.a * maxRange, 1.0 );\n}\n\nvec4 gammaToLinear(vec4 value){\n return vec4( pow(value.rgb, vec3(2.2)), value.a);\n}\n\nvec4 linearToGamma(vec4 value){\n\tvalue = max(value, 0.0);\n return vec4( pow(value.rgb, vec3(1.0 / 2.2)), value.a);\n}\n\n\n// https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_framebuffer_sRGB.txt\n// https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_texture_sRGB_decode.txt\nfloat sRGBToLinear(float value){\n float linearRGBLo = value / 12.92;\n float linearRGBHi = pow((value + 0.055) / 1.055, 2.4);\n float linearRGB = (value <= 0.04045) ? linearRGBLo : linearRGBHi;\n return linearRGB;\n}\n\nvec4 sRGBToLinear(vec4 value){\n return vec4(sRGBToLinear(value.r), sRGBToLinear(value.g), sRGBToLinear(value.b), value.a);\n}\n\nfloat linearToSRGB(float value){\n\tvalue = max(value, 0.0);\n return (value <= 0.0031308) ? (value * 12.9232102) : 1.055 * pow(value, 1.0 / 2.4) - 0.055;\n}\n\nvec4 linearToSRGB(vec4 value){\n return vec4(linearToSRGB(value.r), linearToSRGB(value.g), linearToSRGB(value.b), value.a);\n}\n\n// Compatible with devices that do not even support EXT_sRGB in WebGL1.0.\nvec4 texture2DSRGB(sampler2D tex, vec2 uv) {\n\tvec4 color = texture2D(tex, uv);\n\t#ifdef ENGINE_NO_SRGB\n\t\tcolor = sRGBToLinear(color);\n\t#endif\n\treturn color;\n}\n\n#ifdef HAS_TEX_LOD\n\tvec4 texture2DLodSRGB(sampler2D tex, vec2 uv, float lod) {\n\t\tvec4 color = texture2DLodEXT(tex, uv, lod);\n\t\t#ifdef ENGINE_NO_SRGB\n\t\t\tcolor = sRGBToLinear(color);\n\t\t#endif\n\t\treturn color;\n\t}\n#endif\n\n\nvec4 outputSRGBCorrection(vec4 linearIn){\n #ifdef ENGINE_OUTPUT_SRGB_CORRECT\n \treturn linearToSRGB(linearIn);\n #else \n \treturn linearIn;\n #endif\n}\n\n\nuniform vec4 camera_DepthBufferParams;\nuniform vec4 camera_ProjectionParams;\n\nfloat remapDepthBufferLinear01(float depth){\n\treturn 1.0 / (camera_DepthBufferParams.x * depth + camera_DepthBufferParams.y);\n}\n\nfloat remapDepthBufferEyeDepth(float depth){\n\t#ifdef CAMERA_ORTHOGRAPHIC\n\t\treturn camera_ProjectionParams.y + (camera_ProjectionParams.z - camera_ProjectionParams.y) * depth;\n\t#else\n\t\treturn 1.0 / (camera_DepthBufferParams.z * depth + camera_DepthBufferParams.w);\n\t#endif\n}\n\n// From Next Generation Post Processing in Call of Duty: Advanced Warfare [Jimenez 2014]\n// http://advances.realtimerendering.com/s2014/index.html\n// sampleCoord must not be normalized (e.g. window coordinates)\nfloat interleavedGradientNoise(vec2 sampleCoord)\n{\n\tconst vec3 magic = vec3(0.06711056, 0.00583715, 52.9829189);\n\treturn fract(magic.z * fract(dot(sampleCoord, magic.xy)));\n}\n\n#ifdef GRAPHICS_API_WEBGL2\n\t#define INVERSE_MAT(mat) inverse(mat)\n#else\n\tmat2 inverseMat(mat2 m) {\n\t\treturn mat2(m[1][1],-m[0][1],\n\t\t\t\t-m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n\t}\n\tmat3 inverseMat(mat3 m) {\n\t\tfloat a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n\t\tfloat a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n\t\tfloat a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n\t\tfloat b01 = a22 * a11 - a12 * a21;\n\t\tfloat b11 = -a22 * a10 + a12 * a20;\n\t\tfloat b21 = a21 * a10 - a11 * a20;\n\n\t\tfloat det = a00 * b01 + a01 * b11 + a02 * b21;\n\n\t\treturn mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n\t\t\t\t\tb11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n\t\t\t\t\tb21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n\t}\n\tmat4 inverseMat(mat4 m) {\n\t\tfloat a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n\t\t\ta10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n\t\t\ta20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n\t\t\ta30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n\t\t\tb00 = a00 * a11 - a01 * a10,\n\t\t\tb01 = a00 * a12 - a02 * a10,\n\t\t\tb02 = a00 * a13 - a03 * a10,\n\t\t\tb03 = a01 * a12 - a02 * a11,\n\t\t\tb04 = a01 * a13 - a03 * a11,\n\t\t\tb05 = a02 * a13 - a03 * a12,\n\t\t\tb06 = a20 * a31 - a21 * a30,\n\t\t\tb07 = a20 * a32 - a22 * a30,\n\t\t\tb08 = a20 * a33 - a23 * a30,\n\t\t\tb09 = a21 * a32 - a22 * a31,\n\t\t\tb10 = a21 * a33 - a23 * a31,\n\t\t\tb11 = a22 * a33 - a23 * a32,\n\n\t\t\tdet = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n\t\treturn mat4(\n\t\t\ta11 * b11 - a12 * b10 + a13 * b09,\n\t\t\ta02 * b10 - a01 * b11 - a03 * b09,\n\t\t\ta31 * b05 - a32 * b04 + a33 * b03,\n\t\t\ta22 * b04 - a21 * b05 - a23 * b03,\n\t\t\ta12 * b08 - a10 * b11 - a13 * b07,\n\t\t\ta00 * b11 - a02 * b08 + a03 * b07,\n\t\t\ta32 * b02 - a30 * b05 - a33 * b01,\n\t\t\ta20 * b05 - a22 * b02 + a23 * b01,\n\t\t\ta10 * b10 - a11 * b08 + a13 * b06,\n\t\t\ta01 * b08 - a00 * b10 - a03 * b06,\n\t\t\ta30 * b04 - a31 * b02 + a33 * b00,\n\t\t\ta21 * b02 - a20 * b04 - a23 * b00,\n\t\t\ta11 * b07 - a10 * b09 - a12 * b06,\n\t\t\ta00 * b09 - a01 * b07 + a02 * b06,\n\t\t\ta31 * b01 - a30 * b03 - a32 * b00,\n\t\t\ta20 * b03 - a21 * b01 + a22 * b00) / det;\n\t}\n\n\t#define INVERSE_MAT(mat) inverseMat(mat)\n#endif\n\n\nvec3 safeNormalize(vec3 inVec) {\n float dp3 = max(float(HALF_MIN), dot(inVec, inVec));\n return inVec * inversesqrt(dp3);\n}\n"; // eslint-disable-line
4590
+ var common = "#define PI 3.14159265359\n#define RECIPROCAL_PI 0.31830988618\n#define EPSILON 1e-6\n#define LOG2 1.442695\n#define HALF_MIN 6.103515625e-5 // 2^-14, the same value for 10, 11 and 16-bit: https://www.khronos.org/opengl/wiki/Small_Float_Formats\n#define HALF_EPS 4.8828125e-4 // 2^-11, machine epsilon: 1 + EPS = 1 (half of the ULP for 1.0f)\n\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n\nfloat pow2(float x ) {\n return x * x;\n}\n\nvec4 RGBMToLinear(vec4 value, float maxRange ) {\n return vec4( value.rgb * value.a * maxRange, 1.0 );\n}\n\nvec4 gammaToLinear(vec4 value){\n return vec4( pow(value.rgb, vec3(2.2)), value.a);\n}\n\nvec4 linearToGamma(vec4 value){\n\tvalue = max(value, 0.0);\n return vec4( pow(value.rgb, vec3(1.0 / 2.2)), value.a);\n}\n\n\n// https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_framebuffer_sRGB.txt\n// https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_texture_sRGB_decode.txt\nfloat sRGBToLinear(float value){\n float linearRGBLo = value / 12.92;\n float linearRGBHi = pow((value + 0.055) / 1.055, 2.4);\n float linearRGB = (value <= 0.04045) ? linearRGBLo : linearRGBHi;\n return linearRGB;\n}\n\nvec4 sRGBToLinear(vec4 value){\n return vec4(sRGBToLinear(value.r), sRGBToLinear(value.g), sRGBToLinear(value.b), value.a);\n}\n\nfloat linearToSRGB(float value){\n\tvalue = max(value, 0.0);\n return (value <= 0.0031308) ? (value * 12.9232102) : 1.055 * pow(value, 1.0 / 2.4) - 0.055;\n}\n\nvec4 linearToSRGB(vec4 value){\n return vec4(linearToSRGB(value.r), linearToSRGB(value.g), linearToSRGB(value.b), value.a);\n}\n\n// Compatible with devices that do not even support EXT_sRGB in WebGL1.0.\nvec4 texture2DSRGB(sampler2D tex, vec2 uv) {\n\tvec4 color = texture2D(tex, uv);\n\t#ifdef ENGINE_NO_SRGB\n\t\tcolor = sRGBToLinear(color);\n\t#endif\n\treturn color;\n}\n\nvec4 outputSRGBCorrection(vec4 linearIn){\n #ifdef ENGINE_OUTPUT_SRGB_CORRECT\n \treturn linearToSRGB(linearIn);\n #else \n \treturn linearIn;\n #endif\n}\n\n\nuniform vec4 camera_DepthBufferParams;\nuniform vec4 camera_ProjectionParams;\n\nfloat remapDepthBufferLinear01(float depth){\n\treturn 1.0 / (camera_DepthBufferParams.x * depth + camera_DepthBufferParams.y);\n}\n\nfloat remapDepthBufferEyeDepth(float depth){\n\t#ifdef CAMERA_ORTHOGRAPHIC\n\t\treturn camera_ProjectionParams.y + (camera_ProjectionParams.z - camera_ProjectionParams.y) * depth;\n\t#else\n\t\treturn 1.0 / (camera_DepthBufferParams.z * depth + camera_DepthBufferParams.w);\n\t#endif\n}\n\n// From Next Generation Post Processing in Call of Duty: Advanced Warfare [Jimenez 2014]\n// http://advances.realtimerendering.com/s2014/index.html\n// sampleCoord must not be normalized (e.g. window coordinates)\nfloat interleavedGradientNoise(vec2 sampleCoord)\n{\n\tconst vec3 magic = vec3(0.06711056, 0.00583715, 52.9829189);\n\treturn fract(magic.z * fract(dot(sampleCoord, magic.xy)));\n}\n\n#ifdef GRAPHICS_API_WEBGL2\n\t#define INVERSE_MAT(mat) inverse(mat)\n#else\n\tmat2 inverseMat(mat2 m) {\n\t\treturn mat2(m[1][1],-m[0][1],\n\t\t\t\t-m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n\t}\n\tmat3 inverseMat(mat3 m) {\n\t\tfloat a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n\t\tfloat a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n\t\tfloat a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n\t\tfloat b01 = a22 * a11 - a12 * a21;\n\t\tfloat b11 = -a22 * a10 + a12 * a20;\n\t\tfloat b21 = a21 * a10 - a11 * a20;\n\n\t\tfloat det = a00 * b01 + a01 * b11 + a02 * b21;\n\n\t\treturn mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n\t\t\t\t\tb11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n\t\t\t\t\tb21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n\t}\n\tmat4 inverseMat(mat4 m) {\n\t\tfloat a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n\t\t\ta10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n\t\t\ta20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n\t\t\ta30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n\t\t\tb00 = a00 * a11 - a01 * a10,\n\t\t\tb01 = a00 * a12 - a02 * a10,\n\t\t\tb02 = a00 * a13 - a03 * a10,\n\t\t\tb03 = a01 * a12 - a02 * a11,\n\t\t\tb04 = a01 * a13 - a03 * a11,\n\t\t\tb05 = a02 * a13 - a03 * a12,\n\t\t\tb06 = a20 * a31 - a21 * a30,\n\t\t\tb07 = a20 * a32 - a22 * a30,\n\t\t\tb08 = a20 * a33 - a23 * a30,\n\t\t\tb09 = a21 * a32 - a22 * a31,\n\t\t\tb10 = a21 * a33 - a23 * a31,\n\t\t\tb11 = a22 * a33 - a23 * a32,\n\n\t\t\tdet = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n\t\treturn mat4(\n\t\t\ta11 * b11 - a12 * b10 + a13 * b09,\n\t\t\ta02 * b10 - a01 * b11 - a03 * b09,\n\t\t\ta31 * b05 - a32 * b04 + a33 * b03,\n\t\t\ta22 * b04 - a21 * b05 - a23 * b03,\n\t\t\ta12 * b08 - a10 * b11 - a13 * b07,\n\t\t\ta00 * b11 - a02 * b08 + a03 * b07,\n\t\t\ta32 * b02 - a30 * b05 - a33 * b01,\n\t\t\ta20 * b05 - a22 * b02 + a23 * b01,\n\t\t\ta10 * b10 - a11 * b08 + a13 * b06,\n\t\t\ta01 * b08 - a00 * b10 - a03 * b06,\n\t\t\ta30 * b04 - a31 * b02 + a33 * b00,\n\t\t\ta21 * b02 - a20 * b04 - a23 * b00,\n\t\t\ta11 * b07 - a10 * b09 - a12 * b06,\n\t\t\ta00 * b09 - a01 * b07 + a02 * b06,\n\t\t\ta31 * b01 - a30 * b03 - a32 * b00,\n\t\t\ta20 * b03 - a21 * b01 + a22 * b00) / det;\n\t}\n\n\t#define INVERSE_MAT(mat) inverseMat(mat)\n#endif\n\n\nvec3 safeNormalize(vec3 inVec) {\n float dp3 = max(float(HALF_MIN), dot(inVec, inVec));\n return inVec * inversesqrt(dp3);\n}\n"; // eslint-disable-line
4628
4591
 
4629
4592
  var common_vert = "attribute vec3 POSITION;\n\n#ifdef RENDERER_HAS_UV\n attribute vec2 TEXCOORD_0;\n#endif\n\n#ifdef RENDERER_HAS_UV1\n attribute vec2 TEXCOORD_1;\n#endif\n\n#ifdef RENDERER_HAS_SKIN\n attribute vec4 JOINTS_0;\n attribute vec4 WEIGHTS_0;\n\n #ifdef RENDERER_USE_JOINT_TEXTURE\n uniform sampler2D renderer_JointSampler;\n uniform float renderer_JointCount;\n\n mat4 getJointMatrix(sampler2D smp, float index)\n {\n float base = index / renderer_JointCount;\n float hf = 0.5 / renderer_JointCount;\n float v = base + hf;\n\n vec4 m0 = texture2D(smp, vec2(0.125, v ));\n vec4 m1 = texture2D(smp, vec2(0.375, v ));\n vec4 m2 = texture2D(smp, vec2(0.625, v ));\n vec4 m3 = texture2D(smp, vec2(0.875, v ));\n\n return mat4(m0, m1, m2, m3);\n\n }\n\n #else\n uniform mat4 renderer_JointMatrix[ RENDERER_JOINTS_NUM ];\n #endif\n#endif\n\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\n attribute vec4 COLOR_0;\n#endif\n\n\n#include <transform_declare>\n#include <camera_declare>\n\nuniform vec4 material_TilingOffset;\n\n\n#ifndef MATERIAL_OMIT_NORMAL\n #ifdef RENDERER_HAS_NORMAL\n attribute vec3 NORMAL;\n #endif\n\n #ifdef RENDERER_HAS_TANGENT\n attribute vec4 TANGENT;\n #endif\n#endif"; // eslint-disable-line
4630
4593
 
@@ -4887,11 +4850,11 @@ var ShaderFactory = /*#__PURE__*/ function() {
4887
4850
  shader = shader.replace(/\bvarying\b/g, isFrag ? "in" : "out");
4888
4851
  shader = shader.replace(/\btexture(2D|Cube)\b/g, "texture");
4889
4852
  shader = shader.replace(/\btexture2DProj\b/g, "textureProj");
4853
+ shader = shader.replace(/\btexture(2D|Cube)LodEXT\b/g, "textureLod");
4854
+ shader = shader.replace(/\btexture(2D|Cube)GradEXT\b/g, "textureGrad");
4855
+ shader = shader.replace(/\btexture2DProjLodEXT\b/g, "textureProjLod");
4856
+ shader = shader.replace(/\btexture2DProjGradEXT\b/g, "textureProjGrad");
4890
4857
  if (isFrag) {
4891
- shader = shader.replace(/\btexture(2D|Cube)LodEXT\b/g, "textureLod");
4892
- shader = shader.replace(/\btexture(2D|Cube)GradEXT\b/g, "textureGrad");
4893
- shader = shader.replace(/\btexture2DProjLodEXT\b/g, "textureProjLod");
4894
- shader = shader.replace(/\btexture2DProjGradEXT\b/g, "textureProjGrad");
4895
4858
  shader = shader.replace(/\bgl_FragDepthEXT\b/g, "gl_FragDepth");
4896
4859
  if (!ShaderFactory._has300Output(shader)) {
4897
4860
  var isMRT = /\bgl_FragData\[.+?\]/g.test(shader);
@@ -4900,7 +4863,7 @@ var ShaderFactory = /*#__PURE__*/ function() {
4900
4863
  var result = shader.match(/\bgl_FragData\[.+?\]/g);
4901
4864
  shader = this._replaceMRTShader(shader, result);
4902
4865
  } else {
4903
- shader = shader.replace(/void\s+?main\s*\(/g, "out vec4 glFragColor;\nvoid main(");
4866
+ shader = "out vec4 glFragColor;\n" + shader;
4904
4867
  shader = shader.replace(/\bgl_FragColor\b/g, "glFragColor");
4905
4868
  }
4906
4869
  }
@@ -5597,47 +5560,29 @@ ShaderTagKey._nameMap = Object.create(null);
5597
5560
  }();
5598
5561
  ShaderProgram._counter = 0;
5599
5562
 
5600
- /**
5601
- * @internal
5602
- * Shader pass type
5603
- */ var ShaderType = /*#__PURE__*/ function(ShaderType) {
5604
- /** init by glsl */ ShaderType[ShaderType["Canonical"] = 0] = "Canonical";
5605
- /** init by shader-lab */ ShaderType[ShaderType["ShaderLab"] = 1] = "ShaderLab";
5606
- return ShaderType;
5607
- }({});
5608
-
5563
+ var precisionStr = "\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n precision highp int;\n #else\n precision mediump float;\n precision mediump int;\n #endif\n ";
5609
5564
  /**
5610
5565
  * Shader pass containing vertex and fragment source.
5611
5566
  */ var ShaderPass = /*#__PURE__*/ function(ShaderPart) {
5612
5567
  _inherits(ShaderPass, ShaderPart);
5613
- function ShaderPass(nameOrVertexSource, vertexSourceOrFragmentSourceOrCode, fragmentSourceOrTagsOrVertexEntry, fragmentEntryOrTags, tags) {
5568
+ function ShaderPass(nameOrVertexSource, vertexSourceOrFragmentSource, fragmentSourceOrTags, tags) {
5614
5569
  var _this;
5615
- _this = ShaderPart.call(this) || this, /** @internal */ _this._shaderPassId = 0, /** @internal */ _this._renderStateDataMap = {}, /** @internal */ _this._shaderProgramPools = [], /** @internal */ _this._path = "", _this._platformMacros = [];
5570
+ _this = ShaderPart.call(this) || this, /** @internal */ _this._shaderPassId = 0, /** @internal */ _this._renderStateDataMap = {}, /** @internal */ _this._shaderProgramPools = [];
5616
5571
  _this._shaderPassId = ShaderPass._shaderPassCounter++;
5617
- _this._type = ShaderType.Canonical;
5618
- if (typeof fragmentEntryOrTags === "string") {
5572
+ if (typeof fragmentSourceOrTags === "string") {
5619
5573
  _this._name = nameOrVertexSource;
5620
- _this._shaderLabSource = vertexSourceOrFragmentSourceOrCode;
5621
- _this._vertexEntry = fragmentSourceOrTagsOrVertexEntry;
5622
- _this._fragmentEntry = fragmentEntryOrTags;
5574
+ _this._vertexSource = vertexSourceOrFragmentSource;
5575
+ _this._fragmentSource = fragmentSourceOrTags;
5623
5576
  tags = _extends({
5624
5577
  pipelineStage: PipelineStage.Forward
5625
5578
  }, tags);
5626
- _this._type = ShaderType.ShaderLab;
5627
- } else if (typeof fragmentSourceOrTagsOrVertexEntry === "string") {
5628
- _this._name = nameOrVertexSource;
5629
- _this._vertexSource = vertexSourceOrFragmentSourceOrCode;
5630
- _this._fragmentSource = fragmentSourceOrTagsOrVertexEntry;
5631
- tags = fragmentEntryOrTags != null ? fragmentEntryOrTags : {
5632
- pipelineStage: PipelineStage.Forward
5633
- };
5634
5579
  } else {
5635
5580
  _this._name = "Default";
5636
5581
  _this._vertexSource = nameOrVertexSource;
5637
- _this._fragmentSource = vertexSourceOrFragmentSourceOrCode;
5638
- tags = fragmentSourceOrTagsOrVertexEntry != null ? fragmentSourceOrTagsOrVertexEntry : {
5582
+ _this._fragmentSource = vertexSourceOrFragmentSource;
5583
+ tags = _extends({
5639
5584
  pipelineStage: PipelineStage.Forward
5640
- };
5585
+ }, fragmentSourceOrTags);
5641
5586
  }
5642
5587
  for(var key in tags){
5643
5588
  _this.setTag(key, tags[key]);
@@ -5653,11 +5598,7 @@ ShaderProgram._counter = 0;
5653
5598
  if (shaderProgram) {
5654
5599
  return shaderProgram;
5655
5600
  }
5656
- if (this._type === ShaderType.Canonical) {
5657
- shaderProgram = this._getCanonicalShaderProgram(engine, macroCollection);
5658
- } else {
5659
- shaderProgram = this._compileShaderProgram(engine, macroCollection, this._vertexEntry, this._fragmentEntry);
5660
- }
5601
+ shaderProgram = this._getCanonicalShaderProgram(engine, macroCollection);
5661
5602
  shaderProgramPool.cache(shaderProgram);
5662
5603
  return shaderProgram;
5663
5604
  };
@@ -5673,55 +5614,37 @@ ShaderProgram._counter = 0;
5673
5614
  // Clear array storing multiple engine shader program pools
5674
5615
  shaderProgramPools.length = 0;
5675
5616
  };
5676
- /**
5677
- * Shader Lab compilation
5678
- */ _proto._compileShaderProgram = function _compileShaderProgram(engine, macroCollection, vertexEntry, fragmentEntry) {
5679
- var _this = this, path = _this._path, platformMacros = _this._platformMacros;
5617
+ _proto._getCanonicalShaderProgram = function _getCanonicalShaderProgram(engine, macroCollection) {
5680
5618
  var isWebGL2 = engine._hardwareRenderer.isWebGL2;
5681
- var macros = new Array();
5682
- ShaderMacro._getMacrosElements(macroCollection, macros);
5683
- platformMacros.length = 0;
5619
+ var shaderMacroList = new Array();
5620
+ ShaderMacro._getMacrosElements(macroCollection, shaderMacroList);
5621
+ shaderMacroList.push(ShaderMacro.getByName(isWebGL2 ? "GRAPHICS_API_WEBGL2" : "GRAPHICS_API_WEBGL1"));
5684
5622
  if (engine._hardwareRenderer.canIUse(GLCapabilityType.shaderTextureLod)) {
5685
- platformMacros.push("HAS_TEX_LOD");
5623
+ shaderMacroList.push(ShaderMacro.getByName("HAS_TEX_LOD"));
5686
5624
  }
5687
5625
  if (engine._hardwareRenderer.canIUse(GLCapabilityType.standardDerivatives)) {
5688
- platformMacros.push("HAS_DERIVATIVES");
5689
- }
5690
- if (isWebGL2) {
5691
- platformMacros.push("GRAPHICS_API_WEBGL2");
5626
+ shaderMacroList.push(ShaderMacro.getByName("HAS_DERIVATIVES"));
5627
+ }
5628
+ // Compatible with non-shaderlab syntax
5629
+ var noIncludeVertex = ShaderFactory.parseIncludes(this._vertexSource);
5630
+ var noIncludeFrag = ShaderFactory.parseIncludes(this._fragmentSource);
5631
+ // Parse macros when use shaderlab
5632
+ if (this._platformTarget != undefined) {
5633
+ noIncludeVertex = Shader._shaderLab._parseMacros(noIncludeVertex, shaderMacroList);
5634
+ noIncludeFrag = Shader._shaderLab._parseMacros(noIncludeFrag, shaderMacroList);
5692
5635
  } else {
5693
- platformMacros.push("GRAPHICS_API_WEBGL1");
5636
+ var macroNameStr = ShaderFactory.parseCustomMacros(shaderMacroList);
5637
+ noIncludeVertex = macroNameStr + noIncludeVertex;
5638
+ noIncludeFrag = macroNameStr + noIncludeFrag;
5694
5639
  }
5695
- var start = performance.now();
5696
- var shaderProgramSource = Shader._shaderLab._parseShaderPass(this._shaderLabSource, vertexEntry, fragmentEntry, macros, isWebGL2 ? ShaderPlatformTarget.GLES300 : ShaderPlatformTarget.GLES100, platformMacros, new URL(path, ShaderPass._shaderRootPath).href);
5697
- Logger.info("[ShaderLab compilation] cost time: " + (performance.now() - start) + "ms");
5698
- if (shaderProgramSource) {
5699
- return new ShaderProgram(engine, shaderProgramSource.vertex, shaderProgramSource.fragment);
5700
- } else {
5701
- return new ShaderProgram(engine, "", "");
5640
+ // Need to convert to 300 es when the target is GLSL ES 100 or unkdown
5641
+ if (isWebGL2 && (this._platformTarget == undefined || this._platformTarget === ShaderLanguage.GLSLES100)) {
5642
+ noIncludeVertex = ShaderFactory.convertTo300(noIncludeVertex);
5643
+ noIncludeFrag = ShaderFactory.convertTo300(noIncludeFrag, true);
5702
5644
  }
5703
- };
5704
- // TODO: remove it after migrate all shader to `ShaderLab`.
5705
- _proto._getCanonicalShaderProgram = function _getCanonicalShaderProgram(engine, macroCollection) {
5706
- var isWebGL2 = engine._hardwareRenderer.isWebGL2;
5707
- var macroNameList = new Array();
5708
- ShaderMacro._getMacrosElements(macroCollection, macroNameList);
5709
- var macroNameStr = ShaderFactory.parseCustomMacros(macroNameList);
5710
5645
  var versionStr = isWebGL2 ? "#version 300 es" : "#version 100";
5711
- var graphicAPI = isWebGL2 ? "#define GRAPHICS_API_WEBGL2" : "#define GRAPHICS_API_WEBGL1";
5712
- var precisionStr = "\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n precision highp int;\n #else\n precision mediump float;\n precision mediump int;\n #endif\n ";
5713
- if (engine._hardwareRenderer.canIUse(GLCapabilityType.shaderTextureLod)) {
5714
- precisionStr += "#define HAS_TEX_LOD\n";
5715
- }
5716
- if (engine._hardwareRenderer.canIUse(GLCapabilityType.standardDerivatives)) {
5717
- precisionStr += "#define HAS_DERIVATIVES\n";
5718
- }
5719
- var vertexSource = " " + versionStr + "\n " + graphicAPI + "\n " + macroNameStr + "\n " + ShaderFactory.parseIncludes(this._vertexSource);
5720
- var fragmentSource = " " + versionStr + "\n " + graphicAPI + "\n " + (isWebGL2 ? "" : ShaderFactory._shaderExtension) + "\n " + precisionStr + "\n " + macroNameStr + "\n " + ShaderFactory.parseIncludes(this._fragmentSource);
5721
- if (isWebGL2) {
5722
- vertexSource = ShaderFactory.convertTo300(vertexSource);
5723
- fragmentSource = ShaderFactory.convertTo300(fragmentSource, true);
5724
- }
5646
+ var vertexSource = " " + versionStr + " \n " + noIncludeVertex + "\n ";
5647
+ var fragmentSource = " " + versionStr + "\n " + (isWebGL2 ? "" : ShaderFactory._shaderExtension) + "\n " + precisionStr + "\n " + noIncludeFrag + "\n ";
5725
5648
  var shaderProgram = new ShaderProgram(engine, vertexSource, fragmentSource);
5726
5649
  return shaderProgram;
5727
5650
  };
@@ -6403,18 +6326,6 @@ __decorate([
6403
6326
  }
6404
6327
  var _proto = Shader.prototype;
6405
6328
  /**
6406
- * @internal
6407
- * path should follow the specifications of [URL.origin](https://developer.mozilla.org/en-US/docs/Web/API/URL/origin), like: `shaders://root/`
6408
- */ _proto._registerPath = function _registerPath(path) {
6409
- for(var _iterator = _create_for_of_iterator_helper_loose(this._subShaders), _step; !(_step = _iterator()).done;){
6410
- var subShader = _step.value;
6411
- for(var _iterator1 = _create_for_of_iterator_helper_loose(subShader.passes), _step1; !(_step1 = _iterator1()).done;){
6412
- var shaderPass = _step1.value;
6413
- shaderPass._path = path;
6414
- }
6415
- }
6416
- };
6417
- /**
6418
6329
  * Compile shader variant by macro name list.
6419
6330
  *
6420
6331
  * @remarks
@@ -6470,74 +6381,82 @@ __decorate([
6470
6381
  */ _proto._addReferCount = function _addReferCount(value) {
6471
6382
  this._refCount += value;
6472
6383
  };
6473
- Shader.create = function create(nameOrShaderSource, vertexSourceOrShaderPassesOrSubShaders, fragmentSource) {
6384
+ Shader.create = function create(nameOrShaderSource, vertexSourceOrShaderPassesOrSubShadersOrPlatformTarget, fragmentSourceOrPath) {
6474
6385
  var shader;
6475
6386
  var shaderMap = Shader._shaderMap;
6476
- if (!vertexSourceOrShaderPassesOrSubShaders) {
6477
- if (!Shader._shaderLab) {
6387
+ if (vertexSourceOrShaderPassesOrSubShadersOrPlatformTarget == undefined) {
6388
+ vertexSourceOrShaderPassesOrSubShadersOrPlatformTarget = ShaderLanguage.GLSLES100;
6389
+ }
6390
+ if (typeof vertexSourceOrShaderPassesOrSubShadersOrPlatformTarget === "number") {
6391
+ var shaderLab = Shader._shaderLab;
6392
+ if (!shaderLab) {
6478
6393
  throw "ShaderLab has not been set up yet.";
6479
6394
  }
6480
- var shaderContent = Shader._shaderLab._parseShaderContent(nameOrShaderSource);
6481
- if (shaderMap[shaderContent.name]) {
6482
- console.error('Shader named "' + shaderContent.name + '" already exists.');
6395
+ var shaderSource = shaderLab._parseShaderSource(nameOrShaderSource);
6396
+ if (shaderMap[shaderSource.name]) {
6397
+ console.error('Shader named "' + shaderSource.name + '" already exists.');
6483
6398
  return;
6484
6399
  }
6485
- var subShaderList = shaderContent.subShaders.map(function(subShaderContent) {
6486
- var passList = subShaderContent.passes.map(function(passInfo) {
6487
- if (passInfo.isUsePass) {
6400
+ var subShaderList = shaderSource.subShaders.map(function(subShaderSource) {
6401
+ var passList = subShaderSource.passes.map(function(passSource) {
6402
+ if (passSource.isUsePass) {
6488
6403
  var _Shader_find_subShaders_find, _Shader_find;
6489
- // Use pass reference
6490
- var paths = passInfo.name.split("/");
6491
- return (_Shader_find = Shader.find(paths[0])) == null ? void 0 : (_Shader_find_subShaders_find = _Shader_find.subShaders.find(function(subShader) {
6492
- return subShader.name === paths[1];
6404
+ var _passSource_name_split = passSource.name.split("/"), shaderName = _passSource_name_split[0], subShaderName = _passSource_name_split[1], passName = _passSource_name_split[2];
6405
+ return (_Shader_find = Shader.find(shaderName)) == null ? void 0 : (_Shader_find_subShaders_find = _Shader_find.subShaders.find(function(subShader) {
6406
+ return subShader.name === subShaderName;
6493
6407
  })) == null ? void 0 : _Shader_find_subShaders_find.passes.find(function(pass) {
6494
- return pass.name === paths[2];
6408
+ return pass.name === passName;
6495
6409
  });
6496
6410
  }
6497
- var shaderPassContent = new ShaderPass(passInfo.name, passInfo.contents, passInfo.vertexEntry, passInfo.fragmentEntry, passInfo.tags);
6498
- var _passInfo_renderStates = passInfo.renderStates, constantMap = _passInfo_renderStates.constantMap, variableMap = _passInfo_renderStates.variableMap;
6411
+ var shaderPassSource = Shader._shaderLab._parseShaderPass(passSource.contents, passSource.vertexEntry, passSource.fragmentEntry, vertexSourceOrShaderPassesOrSubShadersOrPlatformTarget, new URL(fragmentSourceOrPath != null ? fragmentSourceOrPath : "", ShaderPass._shaderRootPath).href);
6412
+ if (!shaderPassSource) {
6413
+ throw 'Shader pass "' + shaderSource.name + "." + subShaderSource.name + "." + passSource.name + '" parse failed, please check the shader source code.';
6414
+ }
6415
+ var shaderPass = new ShaderPass(passSource.name, shaderPassSource.vertex, shaderPassSource.fragment, passSource.tags);
6416
+ shaderPass._platformTarget = vertexSourceOrShaderPassesOrSubShadersOrPlatformTarget;
6417
+ var _passSource_renderStates = passSource.renderStates, constantMap = _passSource_renderStates.constantMap, variableMap = _passSource_renderStates.variableMap;
6499
6418
  // Compatible shader lab no render state use material `renderState` to modify render state
6500
6419
  if (Object.keys(constantMap).length > 0 || Object.keys(variableMap).length > 0) {
6501
6420
  // Parse const render state
6502
6421
  var renderState = new RenderState();
6503
- shaderPassContent._renderState = renderState;
6504
6422
  for(var k in constantMap){
6505
- Shader._applyConstRenderStates(renderState, parseInt(k), constantMap[k]);
6423
+ Shader._applyConstRenderStates(renderState, +k, constantMap[k]);
6506
6424
  }
6425
+ shaderPass._renderState = renderState;
6507
6426
  // Parse variable render state
6508
6427
  var renderStateDataMap = {};
6509
6428
  for(var k1 in variableMap){
6510
6429
  renderStateDataMap[k1] = ShaderProperty.getByName(variableMap[k1]);
6511
6430
  }
6512
- shaderPassContent._renderStateDataMap = renderStateDataMap;
6431
+ shaderPass._renderStateDataMap = renderStateDataMap;
6513
6432
  }
6514
- return shaderPassContent;
6433
+ return shaderPass;
6515
6434
  });
6516
- return new SubShader(subShaderContent.name, passList, subShaderContent.tags);
6435
+ return new SubShader(subShaderSource.name, passList, subShaderSource.tags);
6517
6436
  });
6518
- shader = new Shader(shaderContent.name, subShaderList);
6519
- shaderMap[shaderContent.name] = shader;
6437
+ shader = new Shader(shaderSource.name, subShaderList);
6438
+ shaderMap[shaderSource.name] = shader;
6520
6439
  return shader;
6521
6440
  } else {
6522
6441
  if (shaderMap[nameOrShaderSource]) {
6523
6442
  console.error('Shader named "' + nameOrShaderSource + '" already exists.');
6524
6443
  return;
6525
6444
  }
6526
- if (typeof vertexSourceOrShaderPassesOrSubShaders === "string") {
6527
- var shaderPass = new ShaderPass(vertexSourceOrShaderPassesOrSubShaders, fragmentSource);
6445
+ if (typeof vertexSourceOrShaderPassesOrSubShadersOrPlatformTarget === "string") {
6446
+ var shaderPass = new ShaderPass(vertexSourceOrShaderPassesOrSubShadersOrPlatformTarget, fragmentSourceOrPath);
6528
6447
  shader = new Shader(nameOrShaderSource, [
6529
6448
  new SubShader("Default", [
6530
6449
  shaderPass
6531
6450
  ])
6532
6451
  ]);
6533
6452
  } else {
6534
- if (vertexSourceOrShaderPassesOrSubShaders.length > 0) {
6535
- if (vertexSourceOrShaderPassesOrSubShaders[0].constructor === ShaderPass) {
6453
+ if (vertexSourceOrShaderPassesOrSubShadersOrPlatformTarget.length > 0) {
6454
+ if (vertexSourceOrShaderPassesOrSubShadersOrPlatformTarget[0].constructor === ShaderPass) {
6536
6455
  shader = new Shader(nameOrShaderSource, [
6537
- new SubShader("Default", vertexSourceOrShaderPassesOrSubShaders)
6456
+ new SubShader("Default", vertexSourceOrShaderPassesOrSubShadersOrPlatformTarget)
6538
6457
  ]);
6539
6458
  } else {
6540
- shader = new Shader(nameOrShaderSource, vertexSourceOrShaderPassesOrSubShaders.slice());
6459
+ shader = new Shader(nameOrShaderSource, vertexSourceOrShaderPassesOrSubShadersOrPlatformTarget.slice());
6541
6460
  }
6542
6461
  } else {
6543
6462
  throw "SubShader or ShaderPass count must large than 0.";
@@ -25789,9 +25708,9 @@ ParticleBufferUtils.boundsFloatStride = 8;
25789
25708
  ParticleBufferUtils.boundsTimeOffset = 6;
25790
25709
  ParticleBufferUtils.boundsMaxLifetimeOffset = 7;
25791
25710
 
25792
- var blitFs = "#include <common>\n\nuniform mediump sampler2D renderer_BlitTexture;\n#ifdef HAS_TEX_LOD\n\tuniform float renderer_BlitMipLevel;\n#endif\n\nuniform vec4 renderer_SourceScaleOffset;\n\nvarying vec2 v_uv;\n\nvoid main() {\n\tvec2 uv = v_uv;\n\tuv = uv * renderer_SourceScaleOffset.xy + renderer_SourceScaleOffset.zw;\n\n\t#ifdef HAS_TEX_LOD\n\t\tgl_FragColor = texture2DLodSRGB( renderer_BlitTexture, uv, renderer_BlitMipLevel );\n\t#else\n\t\tgl_FragColor = texture2DSRGB( renderer_BlitTexture, uv );\n\t#endif\n}\n\n"; // eslint-disable-line
25711
+ var blitFs = "#include <common>\n\nuniform mediump sampler2D renderer_BlitTexture;\n#ifdef HAS_TEX_LOD\n\tuniform float renderer_BlitMipLevel;\n#endif\n\nuniform vec4 renderer_SourceScaleOffset;\n\nvarying vec2 v_uv;\n\n#ifdef HAS_TEX_LOD\n\tvec4 texture2DLodSRGB(sampler2D tex, vec2 uv, float lod) {\n\t\tvec4 color = texture2DLodEXT(tex, uv, lod);\n\t\t#ifdef ENGINE_NO_SRGB\n\t\t\tcolor = sRGBToLinear(color);\n\t\t#endif\n\t\treturn color;\n\t}\n#endif\n\nvoid main() {\n\tvec2 uv = v_uv;\n\tuv = uv * renderer_SourceScaleOffset.xy + renderer_SourceScaleOffset.zw;\n\n\t#ifdef HAS_TEX_LOD\n\t\tgl_FragColor = texture2DLodSRGB( renderer_BlitTexture, uv, renderer_BlitMipLevel );\n\t#else\n\t\tgl_FragColor = texture2DSRGB( renderer_BlitTexture, uv );\n\t#endif\n}\n\n"; // eslint-disable-line
25793
25712
 
25794
- var blitScreenFs = "#include <common>\n\nuniform mediump sampler2D renderer_BlitTexture;\n#ifdef HAS_TEX_LOD\n\tuniform float renderer_BlitMipLevel;\n#endif\n\nvarying vec2 v_uv;\n\nvoid main() {\n\tvec2 uv = v_uv;\n\t// Screen uv is flipped\n\tuv.y = 1.0 - uv.y;\n\n\t#ifdef HAS_TEX_LOD\n\t\tgl_FragColor = texture2DLodSRGB( renderer_BlitTexture, uv, renderer_BlitMipLevel );\n\t#else\n\t\tgl_FragColor = texture2D( renderer_BlitTexture, uv );\n\t#endif\n\n\t// Color space in screen is in gamma space but without sRGB texture, so we need to convert it to linear space manually\n\tgl_FragColor = sRGBToLinear(gl_FragColor);\n}\n\n"; // eslint-disable-line
25713
+ var blitScreenFs = "#include <common>\n\nuniform mediump sampler2D renderer_BlitTexture;\n#ifdef HAS_TEX_LOD\n\tuniform float renderer_BlitMipLevel;\n#endif\n\nvarying vec2 v_uv;\n\n#ifdef HAS_TEX_LOD\n\tvec4 texture2DLodSRGB(sampler2D tex, vec2 uv, float lod) {\n\t\tvec4 color = texture2DLodEXT(tex, uv, lod);\n\t\t#ifdef ENGINE_NO_SRGB\n\t\t\tcolor = sRGBToLinear(color);\n\t\t#endif\n\t\treturn color;\n\t}\n#endif\n\nvoid main() {\n\tvec2 uv = v_uv;\n\t// Screen uv is flipped\n\tuv.y = 1.0 - uv.y;\n\n\t#ifdef HAS_TEX_LOD\n\t\tgl_FragColor = texture2DLodSRGB( renderer_BlitTexture, uv, renderer_BlitMipLevel );\n\t#else\n\t\tgl_FragColor = texture2D( renderer_BlitTexture, uv );\n\t#endif\n\n\t// Color space in screen is in gamma space but without sRGB texture, so we need to convert it to linear space manually\n\tgl_FragColor = sRGBToLinear(gl_FragColor);\n}\n\n"; // eslint-disable-line
25795
25714
 
25796
25715
  var skyProceduralFs = "// This code uses the Unity skybox-Procedural shader algorithm, developed by Unity and licensed under the Unity Companion License. \n// The original implementation can be found at unity build-in shader(DefaultResourcesExtra/Skybox-Procedural.shader)\n\n#include <common>\n\nconst float MIE_G = -0.990;\nconst float MIE_G2 = 0.9801;\nconst float SKY_GROUND_THRESHOLD = 0.02;\n\nuniform float material_SunSize;\nuniform float material_SunSizeConvergence;\nuniform vec4 scene_SunlightColor;\nuniform vec3 scene_SunlightDirection;\n\nvarying vec3 v_GroundColor;\nvarying vec3 v_SkyColor;\n\n#ifdef MATERIAL_SUN_HIGH_QUALITY\n\tvarying vec3 v_Vertex;\n#elif defined(MATERIAL_SUN_SIMPLE)\n\tvarying vec3 v_RayDir;\n#else\n\tvarying float v_SkyGroundFactor;\n#endif\n\n#if defined(MATERIAL_SUN_HIGH_QUALITY)||defined(MATERIAL_SUN_SIMPLE)\n\tvarying vec3 v_SunColor;\n#endif\n\n// Calculates the Mie phase function\nfloat getMiePhase(float eyeCos, float eyeCos2) {\n\tfloat temp = 1.0 + MIE_G2 - 2.0 * MIE_G * eyeCos;\n\ttemp = pow(temp, pow(material_SunSize,0.65) * 10.0);\n\ttemp = max(temp,1.0e-4); // prevent division by zero, esp. in half precision\n\ttemp = 1.5 * ((1.0 - MIE_G2) / (2.0 + MIE_G2)) * (1.0 + eyeCos2) / temp;\n\treturn temp;\n}\n\n// Calculates the sun shape\nfloat calcSunAttenuation(vec3 lightPos, vec3 ray) {\n\t#ifdef MATERIAL_SUN_HIGH_QUALITY\n\t\tfloat focusedEyeCos = pow(clamp(dot(lightPos, ray),0.0,1.0), material_SunSizeConvergence);\n\t\treturn getMiePhase(-focusedEyeCos, focusedEyeCos * focusedEyeCos);\n\t#else //MATERIAL_SUN_SIMPLE\n\t\tvec3 delta = lightPos - ray;\n\t\tfloat dist = length(delta);\n\t\tfloat spot = 1.0 - smoothstep(0.0, material_SunSize, dist);\n\t\treturn spot * spot;\n\t#endif\n}\n\nvoid main() {\n\t// if y > 1 [eyeRay.y < -SKY_GROUND_THRESHOLD] - ground\n\t// if y >= 0 and < 1 [eyeRay.y <= 0 and > -SKY_GROUND_THRESHOLD] - horizon\n\t// if y < 0 [eyeRay.y > 0] - sky\n\tvec3 col = vec3(0.0, 0.0, 0.0);\n\n\t#ifdef MATERIAL_SUN_HIGH_QUALITY\n\t\tvec3 ray = normalize(v_Vertex);\n\t\tfloat y = ray.y / SKY_GROUND_THRESHOLD;\n\t#elif defined(MATERIAL_SUN_SIMPLE) \n\t\tvec3 ray = v_RayDir;\n\t\tfloat y = ray.y / SKY_GROUND_THRESHOLD;\t\n\t#else\n\t\tfloat y = v_SkyGroundFactor;\n\t#endif\n\n\t// if we did precalculate color in vprog: just do lerp between them\n\tcol = mix(v_SkyColor, v_GroundColor, clamp(y,0.0,1.0));\n\n\t#if defined(MATERIAL_SUN_HIGH_QUALITY)||defined(MATERIAL_SUN_SIMPLE)\n\t\tif (y < 0.0)\n\t\t\tcol += v_SunColor * calcSunAttenuation(-scene_SunlightDirection, -ray);\n\t#endif\n\n\n\tgl_FragColor = vec4(col, 1.0);\n}\n\n"; // eslint-disable-line
25797
25716
 
@@ -28259,6 +28178,45 @@ Scene._fogColorProperty = ShaderProperty.getByName("scene_FogColor");
28259
28178
  Scene._fogParamsProperty = ShaderProperty.getByName("scene_FogParams");
28260
28179
  Scene._prefilterdDFGProperty = ShaderProperty.getByName("scene_PrefilteredDFG");
28261
28180
 
28181
+ function _array_like_to_array(arr, len) {
28182
+ if (len == null || len > arr.length) len = arr.length;
28183
+
28184
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
28185
+
28186
+ return arr2;
28187
+ }
28188
+
28189
+ function _unsupported_iterable_to_array(o, minLen) {
28190
+ if (!o) return;
28191
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
28192
+
28193
+ var n = Object.prototype.toString.call(o).slice(8, -1);
28194
+
28195
+ if (n === "Object" && o.constructor) n = o.constructor.name;
28196
+ if (n === "Map" || n === "Set") return Array.from(n);
28197
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
28198
+ }
28199
+
28200
+ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
28201
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
28202
+
28203
+ if (it) return (it = it.call(o)).next.bind(it);
28204
+ // Fallback for engines without symbol support
28205
+ if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike && o && typeof o.length === "number") {
28206
+ if (it) o = it;
28207
+
28208
+ var i = 0;
28209
+
28210
+ return function() {
28211
+ if (i >= o.length) return { done: true };
28212
+
28213
+ return { done: false, value: o[i++] };
28214
+ };
28215
+ }
28216
+
28217
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
28218
+ }
28219
+
28262
28220
  /**
28263
28221
  * Script class, used for logic writing.
28264
28222
  */ var Script = /*#__PURE__*/ function(Component) {
@@ -37243,5 +37201,5 @@ __decorate([
37243
37201
 
37244
37202
  Polyfill.registerPolyfill();
37245
37203
 
37246
- export { AmbientLight, AmbientOcclusion, AmbientOcclusionQuality, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationRectCurve, AnimationRefCurve, AnimationStringCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorCondition, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorControllerParameter, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorLayerMask, AnimatorState, AnimatorStateMachine, AnimatorStateTransition, AntiAliasing, AssetPromise, AssetType, AudioClip, AudioManager, AudioSource, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, BasicRenderPipeline, BatchUtils, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlendState, BlinnPhongMaterial, Blitter, BloomDownScaleMode, BloomEffect, BoolUpdateFlag, BoxColliderShape, BoxShape, Buffer, BufferBindFlag, BufferMesh, BufferUsage, BufferUtil, Burst, Camera, CameraClearFlags, CameraModifyFlags, CameraType, Canvas, CapsuleColliderShape, CharRenderInfo, CharacterController, CircleShape, ClearableObjectPool, CloneManager, Collider, ColliderShape, ColliderShapeUpAxis, Collision, CollisionDetectionMode, ColorOverLifetimeModule, ColorWriteMask, CompareFunction, Component, ConeEmitType, ConeShape, ContactPoint, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, CurveKey, DataType, DependentMode, DepthState, DepthTextureMode, DiffuseMode, DirectLight, DisorderedArray, Downsampling, DynamicCollider, DynamicColliderConstraints, EmissionModule, Engine, EngineObject, Entity, EntityModifyFlags, EventDispatcher, FinalPass, FixedJoint, FogMode, Font, FontStyle, GLCapabilityType, GradientAlphaKey, GradientColorKey, HemisphereShape, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolationType, Joint, JointLimits, JointMotor, Keyframe, Keys, Layer, LayerPathMask, Light, Loader, Logger, MSAASamples, MainModule, Material, Mesh, MeshRenderer, MeshShape, MeshTopology, ModelMesh, OverflowMode, PBRMaterial, ParticleCompositeCurve, ParticleCompositeGradient, ParticleCurve, ParticleCurveMode, ParticleGenerator, ParticleGradient, ParticleGradientMode, ParticleMaterial, ParticleRenderMode, ParticleRenderer, ParticleScaleMode, ParticleShapeArcMode, ParticleShapeType, ParticleSimulationSpace, ParticleStopMode, PhysicsMaterial, PhysicsMaterialCombineMode, PhysicsScene, PipelineStage, PlaneColliderShape, Platform, PointLight, Pointer, PointerButton, PointerEventData, PointerEventEmitter, PointerPhase, PostProcess, PostProcessEffect, PostProcessEffectBoolParameter, PostProcessEffectColorParameter, PostProcessEffectEnumParameter, PostProcessEffectFloatParameter, PostProcessEffectParameter, PostProcessEffectTextureParameter, PostProcessEffectVector2Parameter, PostProcessEffectVector3Parameter, PostProcessEffectVector4Parameter, PostProcessManager, PostProcessPass, PostProcessPassEvent, PostProcessUberPass, Primitive, PrimitiveMesh, Probe, RasterState, ReferResource, RefractionMode, RenderBufferDepthFormat, RenderFace, RenderQueue, RenderQueueFlags, RenderQueueType, RenderState, RenderStateElementKey as RenderStateDataKey, RenderTarget, RenderTargetBlendState, Renderer, RendererUpdateFlags, ReplacementFailureStrategy, ResourceManager, ReturnableObjectPool, RotationOverLifetimeModule, SafeLoopArray, Scene, SceneManager, Script, SetDataOptions, Shader, ShaderData, ShaderDataGroup, ShaderFactory, ShaderLib, ShaderMacro, ShaderMacroCollection, ShaderPass, ShaderPlatformTarget, ShaderProperty, ShaderPropertyType, ShaderTagKey, ShadowCascadesMode, ShadowResolution, ShadowType, SimpleSpriteAssembler, SizeOverLifetimeModule, Skin, SkinnedMeshRenderer, Sky, SkyBoxMaterial, SkyProceduralMaterial, SlicedSpriteAssembler, SphereColliderShape, SphereShape, SpotLight, SpringJoint, Sprite, SpriteAtlas, SpriteDrawMode, SpriteMask, SpriteMaskInteraction, SpriteMaskLayer, SpriteModifyFlags, SpriteRenderer, SpriteTileMode, StateMachineScript, StaticCollider, StencilOperation, StencilState, SubFont, SubMesh, SubPrimitive, SubShader, SunMode, SystemInfo, TextHorizontalAlignment, TextRenderer, TextUtils, TextVerticalAlignment, Texture, Texture2D, Texture2DArray, TextureCoordinate, TextureCube, TextureCubeFace, TextureDepthCompareFunction, TextureFilterMode, TextureFormat, TextureSheetAnimationModule, TextureUsage, TextureUtils, TextureWrapMode, TiledSpriteAssembler, Time, TonemappingEffect, TonemappingMode, TrailMaterial, TrailRenderer, Transform, TransformModifyFlags, UnlitMaterial, Utils, VelocityOverLifetimeModule, VertexAttribute, VertexBufferBinding, VertexElement, VertexElementFormat, WrapMode, XRManager, assignmentClone, deepClone, dependentComponents, ignoreClone, registerPointerEventEmitter, request, resourceLoader, shallowClone };
37204
+ export { AmbientLight, AmbientOcclusion, AmbientOcclusionQuality, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationRectCurve, AnimationRefCurve, AnimationStringCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorCondition, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorControllerParameter, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorLayerMask, AnimatorState, AnimatorStateMachine, AnimatorStateTransition, AntiAliasing, AssetPromise, AssetType, AudioClip, AudioManager, AudioSource, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, BasicRenderPipeline, BatchUtils, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlendState, BlinnPhongMaterial, Blitter, BloomDownScaleMode, BloomEffect, BoolUpdateFlag, BoxColliderShape, BoxShape, Buffer, BufferBindFlag, BufferMesh, BufferUsage, BufferUtil, Burst, Camera, CameraClearFlags, CameraModifyFlags, CameraType, Canvas, CapsuleColliderShape, CharRenderInfo, CharacterController, CircleShape, ClearableObjectPool, CloneManager, Collider, ColliderShape, ColliderShapeUpAxis, Collision, CollisionDetectionMode, ColorOverLifetimeModule, ColorWriteMask, CompareFunction, Component, ConeEmitType, ConeShape, ContactPoint, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, CurveKey, DataType, DependentMode, DepthState, DepthTextureMode, DiffuseMode, DirectLight, DisorderedArray, Downsampling, DynamicCollider, DynamicColliderConstraints, EmissionModule, Engine, EngineObject, Entity, EntityModifyFlags, EventDispatcher, FinalPass, FixedJoint, FogMode, Font, FontStyle, GLCapabilityType, GradientAlphaKey, GradientColorKey, HemisphereShape, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolationType, Joint, JointLimits, JointMotor, Keyframe, Keys, Layer, LayerPathMask, Light, Loader, Logger, MSAASamples, MainModule, Material, Mesh, MeshRenderer, MeshShape, MeshTopology, ModelMesh, OverflowMode, PBRMaterial, ParticleCompositeCurve, ParticleCompositeGradient, ParticleCurve, ParticleCurveMode, ParticleGenerator, ParticleGradient, ParticleGradientMode, ParticleMaterial, ParticleRenderMode, ParticleRenderer, ParticleScaleMode, ParticleShapeArcMode, ParticleShapeType, ParticleSimulationSpace, ParticleStopMode, PhysicsMaterial, PhysicsMaterialCombineMode, PhysicsScene, PipelineStage, PlaneColliderShape, Platform, PointLight, Pointer, PointerButton, PointerEventData, PointerEventEmitter, PointerPhase, PostProcess, PostProcessEffect, PostProcessEffectBoolParameter, PostProcessEffectColorParameter, PostProcessEffectEnumParameter, PostProcessEffectFloatParameter, PostProcessEffectParameter, PostProcessEffectTextureParameter, PostProcessEffectVector2Parameter, PostProcessEffectVector3Parameter, PostProcessEffectVector4Parameter, PostProcessManager, PostProcessPass, PostProcessPassEvent, PostProcessUberPass, Primitive, PrimitiveMesh, Probe, RasterState, ReferResource, RefractionMode, RenderBufferDepthFormat, RenderFace, RenderQueue, RenderQueueFlags, RenderQueueType, RenderState, RenderStateElementKey, RenderTarget, RenderTargetBlendState, Renderer, RendererUpdateFlags, ReplacementFailureStrategy, ResourceManager, ReturnableObjectPool, RotationOverLifetimeModule, SafeLoopArray, Scene, SceneManager, Script, SetDataOptions, Shader, ShaderData, ShaderDataGroup, ShaderFactory, ShaderLanguage, ShaderLib, ShaderMacro, ShaderMacroCollection, ShaderPass, ShaderProperty, ShaderPropertyType, ShaderTagKey, ShadowCascadesMode, ShadowResolution, ShadowType, SimpleSpriteAssembler, SizeOverLifetimeModule, Skin, SkinnedMeshRenderer, Sky, SkyBoxMaterial, SkyProceduralMaterial, SlicedSpriteAssembler, SphereColliderShape, SphereShape, SpotLight, SpringJoint, Sprite, SpriteAtlas, SpriteDrawMode, SpriteMask, SpriteMaskInteraction, SpriteMaskLayer, SpriteModifyFlags, SpriteRenderer, SpriteTileMode, StateMachineScript, StaticCollider, StencilOperation, StencilState, SubFont, SubMesh, SubPrimitive, SubShader, SunMode, SystemInfo, TextHorizontalAlignment, TextRenderer, TextUtils, TextVerticalAlignment, Texture, Texture2D, Texture2DArray, TextureCoordinate, TextureCube, TextureCubeFace, TextureDepthCompareFunction, TextureFilterMode, TextureFormat, TextureSheetAnimationModule, TextureUsage, TextureUtils, TextureWrapMode, TiledSpriteAssembler, Time, TonemappingEffect, TonemappingMode, TrailMaterial, TrailRenderer, Transform, TransformModifyFlags, UnlitMaterial, Utils, VelocityOverLifetimeModule, VertexAttribute, VertexBufferBinding, VertexElement, VertexElementFormat, WrapMode, XRManager, assignmentClone, deepClone, dependentComponents, ignoreClone, registerPointerEventEmitter, request, resourceLoader, shallowClone };
37247
37205
  //# sourceMappingURL=module.js.map