@galacean/engine 1.6.0-alpha.2 → 1.6.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +236 -245
- package/dist/browser.js.map +1 -1
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/package.json +5 -5
package/dist/browser.js
CHANGED
|
@@ -9311,6 +9311,14 @@
|
|
|
9311
9311
|
/** cut the back-face of the polygons. */ CullMode[CullMode["Back"] = 2] = "Back";
|
|
9312
9312
|
return CullMode;
|
|
9313
9313
|
}({});
|
|
9314
|
+
/**
|
|
9315
|
+
* Render queue type.
|
|
9316
|
+
*/ var RenderQueueType = /*#__PURE__*/ function(RenderQueueType) {
|
|
9317
|
+
/** Opaque queue. */ RenderQueueType[RenderQueueType["Opaque"] = 0] = "Opaque";
|
|
9318
|
+
/** Opaque queue, alpha cutoff. */ RenderQueueType[RenderQueueType["AlphaTest"] = 1] = "AlphaTest";
|
|
9319
|
+
/** Transparent queue, rendering from back to front to ensure correct rendering of transparent objects. */ RenderQueueType[RenderQueueType["Transparent"] = 2] = "Transparent";
|
|
9320
|
+
return RenderQueueType;
|
|
9321
|
+
}({});
|
|
9314
9322
|
var RenderStateElementKey = /*#__PURE__*/ function(RenderStateElementKey) {
|
|
9315
9323
|
/** Blend state enabled for target 0 key. */ RenderStateElementKey[RenderStateElementKey["BlendStateEnabled0"] = 0] = "BlendStateEnabled0";
|
|
9316
9324
|
/** Blend state color blend operation for target 0 key. */ RenderStateElementKey[RenderStateElementKey["BlendStateColorBlendOperation0"] = 1] = "BlendStateColorBlendOperation0";
|
|
@@ -9343,14 +9351,6 @@
|
|
|
9343
9351
|
/** Render queue type key. */ RenderStateElementKey[RenderStateElementKey["RenderQueueType"] = 28] = "RenderQueueType";
|
|
9344
9352
|
return RenderStateElementKey;
|
|
9345
9353
|
}({});
|
|
9346
|
-
/**
|
|
9347
|
-
* Render queue type.
|
|
9348
|
-
*/ var RenderQueueType = /*#__PURE__*/ function(RenderQueueType) {
|
|
9349
|
-
/** Opaque queue. */ RenderQueueType[RenderQueueType["Opaque"] = 0] = "Opaque";
|
|
9350
|
-
/** Opaque queue, alpha cutoff. */ RenderQueueType[RenderQueueType["AlphaTest"] = 1] = "AlphaTest";
|
|
9351
|
-
/** Transparent queue, rendering from back to front to ensure correct rendering of transparent objects. */ RenderQueueType[RenderQueueType["Transparent"] = 2] = "Transparent";
|
|
9352
|
-
return RenderQueueType;
|
|
9353
|
-
}({});
|
|
9354
9354
|
/**
|
|
9355
9355
|
* Shader data grouping.
|
|
9356
9356
|
*/ var ShaderDataGroup = /*#__PURE__*/ function(ShaderDataGroup) {
|
|
@@ -9361,6 +9361,13 @@
|
|
|
9361
9361
|
/** Render element group. */ ShaderDataGroup[ShaderDataGroup["RenderElement"] = 4] = "RenderElement";
|
|
9362
9362
|
return ShaderDataGroup;
|
|
9363
9363
|
}({});
|
|
9364
|
+
/**
|
|
9365
|
+
* Shader language belongs to.
|
|
9366
|
+
*/ var ShaderLanguage = /*#__PURE__*/ function(ShaderLanguage) {
|
|
9367
|
+
/** GLSL ES 100. */ ShaderLanguage[ShaderLanguage["GLSLES100"] = 0] = "GLSLES100";
|
|
9368
|
+
/** GLSL ES 300. */ ShaderLanguage[ShaderLanguage["GLSLES300"] = 1] = "GLSLES300";
|
|
9369
|
+
return ShaderLanguage;
|
|
9370
|
+
}({});
|
|
9364
9371
|
/**
|
|
9365
9372
|
* Shader Property type.
|
|
9366
9373
|
*/ var ShaderPropertyType = /*#__PURE__*/ function(ShaderPropertyType) {
|
|
@@ -9391,43 +9398,6 @@
|
|
|
9391
9398
|
/** Decrements the current stencil buffer value. Wraps stencil buffer value to the maximum representable unsigned value when decrementing a stencil buffer value of 0. */ StencilOperation[StencilOperation["DecrementWrap"] = 7] = "DecrementWrap";
|
|
9392
9399
|
return StencilOperation;
|
|
9393
9400
|
}({});
|
|
9394
|
-
var ShaderPlatformTarget = /*#__PURE__*/ function(ShaderPlatformTarget) {
|
|
9395
|
-
ShaderPlatformTarget[ShaderPlatformTarget["GLES100"] = 0] = "GLES100";
|
|
9396
|
-
ShaderPlatformTarget[ShaderPlatformTarget["GLES300"] = 1] = "GLES300";
|
|
9397
|
-
return ShaderPlatformTarget;
|
|
9398
|
-
}({});
|
|
9399
|
-
function _array_like_to_array$1(arr, len) {
|
|
9400
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
9401
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
9402
|
-
return arr2;
|
|
9403
|
-
}
|
|
9404
|
-
function _unsupported_iterable_to_array$1(o, minLen) {
|
|
9405
|
-
if (!o) return;
|
|
9406
|
-
if (typeof o === "string") return _array_like_to_array$1(o, minLen);
|
|
9407
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
9408
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
9409
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
9410
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
|
|
9411
|
-
}
|
|
9412
|
-
function _create_for_of_iterator_helper_loose$1(o, allowArrayLike) {
|
|
9413
|
-
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
9414
|
-
if (it) return (it = it.call(o)).next.bind(it);
|
|
9415
|
-
// Fallback for engines without symbol support
|
|
9416
|
-
if (Array.isArray(o) || (it = _unsupported_iterable_to_array$1(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
9417
|
-
if (it) o = it;
|
|
9418
|
-
var i = 0;
|
|
9419
|
-
return function() {
|
|
9420
|
-
if (i >= o.length) return {
|
|
9421
|
-
done: true
|
|
9422
|
-
};
|
|
9423
|
-
return {
|
|
9424
|
-
done: false,
|
|
9425
|
-
value: o[i++]
|
|
9426
|
-
};
|
|
9427
|
-
};
|
|
9428
|
-
}
|
|
9429
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
9430
|
-
}
|
|
9431
9401
|
/**
|
|
9432
9402
|
* Shader macro。
|
|
9433
9403
|
*/ var ShaderMacro = /*#__PURE__*/ function() {
|
|
@@ -9654,7 +9624,7 @@
|
|
|
9654
9624
|
return PipelineStage;
|
|
9655
9625
|
}({});
|
|
9656
9626
|
var camera_declare = "uniform vec3 camera_Position;\nuniform vec3 camera_Forward; "; // eslint-disable-line
|
|
9657
|
-
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\
|
|
9627
|
+
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
|
|
9658
9628
|
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
|
|
9659
9629
|
var transform_declare = "uniform mat4 renderer_LocalMat;\nuniform mat4 renderer_ModelMat;\nuniform mat4 camera_ViewMat;\nuniform mat4 camera_ProjMat;\nuniform mat4 renderer_MVMat;\nuniform mat4 renderer_MVPMat;\nuniform mat4 renderer_NormalMat;"; // eslint-disable-line
|
|
9660
9630
|
var color_share = "#ifdef RENDERER_ENABLE_VERTEXCOLOR\n\nvarying vec4 v_color;\n\n#endif\n"; // eslint-disable-line
|
|
@@ -9699,7 +9669,7 @@
|
|
|
9699
9669
|
var noise_simplex_3D_grad = "//\n// Description : Array and textureless GLSL 2D/3D/4D simplex\n// noise functions.\n// Author : Ian McEwan, Ashima Arts.\n// Maintainer : stegu\n// Lastmod : 20150104 (JcBernack)\n// License : Copyright (C) 2011 Ashima Arts. All rights reserved.\n// Distributed under the MIT License. See LICENSE file.\n// https://github.com/ashima/webgl-noise\n// https://github.com/stegu/webgl-noise\n//\n\nfloat simplex( vec3 v, out vec3 gradient ) {\n\n const vec2 C = vec2( 1.0 / 6.0, 1.0 / 3.0 );\n const vec4 D = vec4( 0.0, 0.5, 1.0, 2.0 );\n\n // First corner\n vec3 i = floor( v + dot( v, C.yyy ) );\n vec3 x0 = v - i + dot( i, C.xxx ) ;\n\n // Other corners\n vec3 g = step( x0.yzx, x0.xyz );\n vec3 l = 1.0 - g;\n vec3 i1 = min( g.xyz, l.zxy );\n vec3 i2 = max( g.xyz, l.zxy );\n\n vec3 x1 = x0 - i1 + C.xxx;\n vec3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y\n vec3 x3 = x0 - D.yyy; // -1.0+3.0*C.x = -0.5 = -D.y\n\n // Permutations\n i = mod289( i );\n vec4 p = permute( permute( permute(\n i.z + vec4( 0.0, i1.z, i2.z, 1.0 ) )\n + i.y + vec4( 0.0, i1.y, i2.y, 1.0 ) )\n + i.x + vec4( 0.0, i1.x, i2.x, 1.0 ) );\n\n // Gradients: 7x7 points over a square, mapped onto an octahedron.\n // The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)\n float n_ = 0.142857142857; // 1.0/7.0\n vec3 ns = n_ * D.wyz - D.xzx;\n\n vec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p,7*7)\n\n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)\n\n vec4 x = x_ * ns.x + ns.yyyy;\n vec4 y = y_ * ns.x + ns.yyyy;\n vec4 h = 1.0 - abs( x ) - abs( y );\n\n vec4 b0 = vec4( x.xy, y.xy );\n vec4 b1 = vec4( x.zw, y.zw );\n\n vec4 s0 = floor( b0 ) * 2.0 + 1.0;\n vec4 s1 = floor( b1 ) * 2.0 + 1.0;\n vec4 sh = - step( h, vec4( 0.0 ) );\n\n vec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy ;\n vec4 a1 = b1.xzyw + s1.xzyw * sh.zzww ;\n\n vec3 p0 = vec3( a0.xy, h.x );\n vec3 p1 = vec3( a0.zw, h.y );\n vec3 p2 = vec3( a1.xy, h.z );\n vec3 p3 = vec3( a1.zw, h.w );\n\n //Normalise gradients\n vec4 norm = taylorInvSqrt( vec4( dot( p0, p0 ), dot( p1, p1 ), dot( p2, p2 ), dot( p3, p3 ) ) );\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n\n // Mix final noise value\n vec4 m = max( 0.6 - vec4( dot( x0, x0 ), dot( x1, x1 ), dot( x2, x2 ), dot( x3, x3 ) ), 0.0 );\n vec4 m2 = m * m;\n vec4 m4 = m2 * m2;\n vec4 pdotx = vec4( dot( p0, x0 ), dot( p1, x1 ), dot( p2, x2 ), dot( p3, x3 ) );\n\n // Determine noise gradient\n vec4 temp = m2 * m * pdotx;\n gradient = - 8.0 * ( temp.x * x0 + temp.y * x1 + temp.z * x2 + temp.w * x3 );\n gradient += m4.x * p0 + m4.y * p1 + m4.z * p2 + m4.w * p3;\n gradient *= 42.0;\n\n return 42.0 * dot( m4, pdotx );\n\n}\n"; // eslint-disable-line
|
|
9700
9670
|
var noise_simplex_4D = "//\n// Description : Array and textureless GLSL 2D/3D/4D simplex\n// noise functions.\n// Author : Ian McEwan, Ashima Arts.\n// Maintainer : stegu\n// Lastmod : 20110822 (ijm)\n// License : Copyright (C) 2011 Ashima Arts. All rights reserved.\n// Distributed under the MIT License. See LICENSE file.\n// https://github.com/ashima/webgl-noise\n// https://github.com/stegu/webgl-noise\n//\n\nvec4 grad4( float j, vec4 ip ) {\n\n const vec4 ones = vec4( 1.0, 1.0, 1.0, -1.0 );\n vec4 p, s;\n\n p.xyz = floor( fract( vec3( j ) * ip.xyz ) * 7.0 ) * ip.z - 1.0;\n p.w = 1.5 - dot( abs( p.xyz ), ones.xyz );\n s = vec4( lessThan( p, vec4( 0.0 ) ) );\n p.xyz = p.xyz + ( s.xyz * 2.0 - 1.0 ) * s.www;\n\n return p;\n\n}\n\n// (sqrt(5) - 1)/4 = F4, used once below\n#define F4 0.309016994374947451\n\nfloat simplex(vec4 v) {\n\n const vec4 C = vec4( 0.138196601125011, // (5 - sqrt(5))/20 G4\n 0.276393202250021, // 2 * G4\n 0.414589803375032, // 3 * G4\n -0.447213595499958); // -1 + 4 * G4\n\n // First corner\n vec4 i = floor( v + dot( v, vec4( F4 ) ) );\n vec4 x0 = v - i + dot( i, C.xxxx );\n\n // Other corners\n\n // Rank sorting originally contributed by Bill Licea-Kane, AMD (formerly ATI)\n vec4 i0;\n vec3 isX = step( x0.yzw, x0.xxx );\n vec3 isYZ = step( x0.zww, x0.yyz );\n i0.x = isX.x + isX.y + isX.z;\n i0.yzw = 1.0 - isX;\n i0.y += isYZ.x + isYZ.y;\n i0.zw += 1.0 - isYZ.xy;\n i0.z += isYZ.z;\n i0.w += 1.0 - isYZ.z;\n\n vec4 i3 = clamp( i0, 0.0, 1.0 );\n vec4 i2 = clamp( i0 - 1.0, 0.0, 1.0 );\n vec4 i1 = clamp( i0 - 2.0, 0.0, 1.0 );\n\n vec4 x1 = x0 - i1 + C.xxxx;\n vec4 x2 = x0 - i2 + C.yyyy;\n vec4 x3 = x0 - i3 + C.zzzz;\n vec4 x4 = x0 + C.wwww;\n\n // Permutations\n i = mod289( i );\n float j0 = permute( permute( permute( permute( i.w ) + i.z ) + i.y ) + i.x );\n vec4 j1 = permute( permute( permute( permute (\n i.w + vec4(i1.w, i2.w, i3.w, 1.0 ))\n + i.z + vec4(i1.z, i2.z, i3.z, 1.0 ))\n + i.y + vec4(i1.y, i2.y, i3.y, 1.0 ))\n + i.x + vec4(i1.x, i2.x, i3.x, 1.0 ));\n\n // Gradients: 7x7x6 points over a cube, mapped onto a 4-cross polytope\n // 7*7*6 = 294, which is close to the ring size 17*17 = 289.\n vec4 ip = vec4( 1.0 / 294.0, 1.0 / 49.0, 1.0 / 7.0, 0.0 );\n\n vec4 p0 = grad4(j0, ip);\n vec4 p1 = grad4(j1.x, ip);\n vec4 p2 = grad4(j1.y, ip);\n vec4 p3 = grad4(j1.z, ip);\n vec4 p4 = grad4(j1.w, ip);\n\n // Normalise gradients\n vec4 norm = taylorInvSqrt( vec4( dot( p0, p0 ), dot( p1, p1 ), dot( p2, p2 ), dot( p3, p3 ) ) );\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n p4 *= taylorInvSqrt( dot( p4, p4 ) );\n\n // Mix contributions from the five corners\n vec3 m0 = max( 0.6 - vec3( dot( x0, x0 ), dot( x1, x1 ), dot( x2, x2 ) ), 0.0 );\n vec2 m1 = max( 0.6 - vec2( dot( x3, x3 ), dot( x4, x4 ) ), 0.0 );\n m0 = m0 * m0;\n m1 = m1 * m1;\n return 49.0 * ( dot(m0*m0, vec3( dot( p0, x0 ), dot( p1, x1 ), dot( p2, x2 )))\n + dot(m1*m1, vec2( dot( p3, x3 ), dot( p4, x4 ) ) ) ) ;\n\n}\n"; // eslint-disable-line
|
|
9701
9671
|
var pbr_frag_define = "#define MIN_PERCEPTUAL_ROUGHNESS 0.045\n#define MIN_ROUGHNESS 0.002025\n\nuniform float material_AlphaCutoff;\nuniform vec4 material_BaseColor;\nuniform float material_Metal;\nuniform float material_Roughness;\nuniform float material_IOR;\nuniform vec3 material_PBRSpecularColor;\nuniform float material_Glossiness;\nuniform vec3 material_EmissiveColor;\nuniform float material_NormalIntensity;\nuniform float material_OcclusionIntensity;\nuniform float material_OcclusionTextureCoord;\n\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\n uniform float material_ClearCoat;\n uniform float material_ClearCoatRoughness;\n\n #ifdef MATERIAL_HAS_CLEAR_COAT_TEXTURE\n uniform sampler2D material_ClearCoatTexture;\n #endif\n\n #ifdef MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE\n uniform sampler2D material_ClearCoatRoughnessTexture;\n #endif\n\n #ifdef MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE\n uniform sampler2D material_ClearCoatNormalTexture;\n #endif\n#endif\n\n#ifdef MATERIAL_ENABLE_ANISOTROPY\n uniform vec3 material_AnisotropyInfo;\n #ifdef MATERIAL_HAS_ANISOTROPY_TEXTURE\n uniform sampler2D material_AnisotropyTexture;\n #endif\n#endif\n\n// Texture\n#ifdef MATERIAL_HAS_BASETEXTURE\n uniform sampler2D material_BaseTexture;\n#endif\n\n#ifdef MATERIAL_HAS_NORMALTEXTURE\n uniform sampler2D material_NormalTexture;\n#endif\n\n#ifdef MATERIAL_HAS_EMISSIVETEXTURE\n uniform sampler2D material_EmissiveTexture;\n#endif\n\n#ifdef MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE\n uniform sampler2D material_RoughnessMetallicTexture;\n#endif\n\n\n#ifdef MATERIAL_HAS_SPECULAR_GLOSSINESS_TEXTURE\n uniform sampler2D material_SpecularGlossinessTexture;\n#endif\n\n#ifdef MATERIAL_HAS_OCCLUSION_TEXTURE\n uniform sampler2D material_OcclusionTexture;\n#endif\n\n\n#ifdef MATERIAL_ENABLE_SHEEN\n uniform float material_SheenRoughness;\n uniform vec3 material_SheenColor;\n #ifdef MATERIAL_HAS_SHEEN_TEXTURE\n uniform sampler2D material_SheenTexture;\n #endif\n\n #ifdef MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE\n uniform sampler2D material_SheenRoughnessTexture;\n #endif\n#endif\n\n\n#ifdef MATERIAL_ENABLE_IRIDESCENCE\n uniform vec4 material_IridescenceInfo;\n #ifdef MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE\n uniform sampler2D material_IridescenceThicknessTexture;\n #endif\n\n #ifdef MATERIAL_HAS_IRIDESCENCE_TEXTURE\n uniform sampler2D material_IridescenceTexture;\n #endif\n#endif\n\n#ifdef MATERIAL_ENABLE_TRANSMISSION\n uniform float material_Transmission;\n #ifdef MATERIAL_HAS_TRANSMISSION_TEXTURE\n uniform sampler2D material_TransmissionTexture;\n #endif\n\n #ifdef MATERIAL_HAS_THICKNESS\n uniform vec3 material_AttenuationColor;\n uniform float material_AttenuationDistance;\n uniform float material_Thickness;\n\n #ifdef MATERIAL_HAS_THICKNESS_TEXTURE\n uniform sampler2D material_ThicknessTexture;\n #endif\n #endif\n#endif\n\n// Runtime\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n\nstruct Geometry {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n float dotNV;\n \n #ifdef MATERIAL_ENABLE_CLEAR_COAT\n vec3 clearCoatNormal;\n float clearCoatDotNV;\n #endif\n\n #ifdef MATERIAL_ENABLE_ANISOTROPY\n vec3 anisotropicT;\n vec3 anisotropicB;\n vec3 anisotropicN;\n float anisotropy;\n #endif\n};\n\nstruct Material {\n vec3 diffuseColor;\n float roughness;\n vec3 specularColor;\n float opacity;\n float f0;\n float diffuseAO;\n float specularAO;\n vec3 envSpecularDFG;\n float IOR;\n\n #ifdef MATERIAL_ENABLE_CLEAR_COAT\n float clearCoat;\n float clearCoatRoughness;\n #endif\n\n #ifdef MATERIAL_ENABLE_IRIDESCENCE\n float iridescenceIOR;\n float iridescenceFactor;\n float iridescenceThickness;\n vec3 iridescenceSpecularColor;\n #endif\n\n #ifdef MATERIAL_ENABLE_SHEEN\n float sheenRoughness;\n vec3 sheenColor;\n float sheenScaling;\n float approxIBLSheenDG;\n #endif\n\n #ifdef MATERIAL_ENABLE_TRANSMISSION \n vec3 absorptionCoefficient;\n float transmission;\n float thickness;\n #endif\n};"; // eslint-disable-line
|
|
9702
|
-
var pbr_helper = "#include <normal_get>\n#include <brdf>\n#include <btdf>\n\n// direct + indirect\n#include <direct_irradiance_frag_define>\n#include <ibl_frag_define>\n\nuniform sampler2D camera_AOTexture;\n\nfloat computeSpecularOcclusion(float ambientOcclusion, float roughness, float dotNV ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n\nfloat getAARoughnessFactor(vec3 normal) {\n // Kaplanyan 2016, \"Stable specular highlights\"\n // Tokuyoshi 2017, \"Error Reduction and Simplification for Shading Anti-Aliasing\"\n // Tokuyoshi and Kaplanyan 2019, \"Improved Geometric Specular Antialiasing\"\n #ifdef HAS_DERIVATIVES\n vec3 dxy = max( abs(dFdx(normal)), abs(dFdy(normal)) );\n return max( max(dxy.x, dxy.y), dxy.z );\n #else\n return 0.0;\n #endif\n}\n\n#ifdef MATERIAL_ENABLE_ANISOTROPY\n // Aniso Bent Normals\n // Mc Alley https://www.gdcvault.com/play/1022235/Rendering-the-World-of-Far \n vec3 getAnisotropicBentNormal(Geometry geometry, vec3 n, float roughness) {\n vec3 anisotropyDirection = geometry.anisotropy >= 0.0 ? geometry.anisotropicB : geometry.anisotropicT;\n vec3 anisotropicTangent = cross(anisotropyDirection, geometry.viewDir);\n vec3 anisotropicNormal = cross(anisotropicTangent, anisotropyDirection);\n // reduce stretching for (roughness < 0.2), refer to https://advances.realtimerendering.com/s2018/Siggraph%202018%20HDRP%20talk_with%20notes.pdf 80\n vec3 bentNormal = normalize( mix(n, anisotropicNormal, abs(geometry.anisotropy) * saturate( 5.0 * roughness)) );\n\n return bentNormal;\n }\n#endif\n\nvoid initGeometry(out Geometry geometry, bool isFrontFacing){\n geometry.position = v_pos;\n #ifdef CAMERA_ORTHOGRAPHIC\n geometry.viewDir = -camera_Forward;\n #else\n geometry.viewDir = normalize(camera_Position - v_pos);\n #endif\n #if defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) || defined(MATERIAL_ENABLE_ANISOTROPY)\n mat3 tbn = getTBN(isFrontFacing);\n #endif\n\n #ifdef MATERIAL_HAS_NORMALTEXTURE\n geometry.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, v_uv, isFrontFacing);\n #else\n geometry.normal = getNormal(isFrontFacing);\n #endif\n\n geometry.dotNV = saturate( dot(geometry.normal, geometry.viewDir) );\n\n\n #ifdef MATERIAL_ENABLE_CLEAR_COAT\n #ifdef MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE\n geometry.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, v_uv, isFrontFacing);\n #else\n geometry.clearCoatNormal = getNormal(isFrontFacing);\n #endif\n geometry.clearCoatDotNV = saturate( dot(geometry.clearCoatNormal, geometry.viewDir) );\n #endif\n\n #ifdef MATERIAL_ENABLE_ANISOTROPY\n float anisotropy = material_AnisotropyInfo.z;\n vec3 anisotropicDirection = vec3(material_AnisotropyInfo.xy, 0.0);\n #ifdef MATERIAL_HAS_ANISOTROPY_TEXTURE\n vec3 anisotropyTextureInfo = texture2D( material_AnisotropyTexture, v_uv ).rgb;\n anisotropy *= anisotropyTextureInfo.b;\n anisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0;\n #endif\n\n geometry.anisotropy = anisotropy;\n geometry.anisotropicT = normalize(tbn * anisotropicDirection);\n geometry.anisotropicB = normalize(cross(geometry.normal, geometry.anisotropicT));\n #endif\n}\n\nvoid initMaterial(out Material material, inout Geometry geometry){\n vec4 baseColor = material_BaseColor;\n float metal = material_Metal;\n float roughness = material_Roughness;\n vec3 specularColor = material_PBRSpecularColor;\n float glossiness = material_Glossiness;\n float alphaCutoff = material_AlphaCutoff;\n float f0 = pow2( (material_IOR - 1.0) / (material_IOR + 1.0) );\n\n material.f0 = f0;\n material.IOR = material_IOR;\n\n #ifdef MATERIAL_HAS_BASETEXTURE\n baseColor *= texture2DSRGB(material_BaseTexture, v_uv);\n #endif\n\n #ifdef RENDERER_ENABLE_VERTEXCOLOR\n baseColor *= v_color;\n #endif\n\n\n #ifdef MATERIAL_IS_ALPHA_CUTOFF\n if( baseColor.a < alphaCutoff ) {\n discard;\n }\n #endif\n\n #ifdef MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE\n vec4 metalRoughMapColor = texture2D( material_RoughnessMetallicTexture, v_uv );\n roughness *= metalRoughMapColor.g;\n metal *= metalRoughMapColor.b;\n #endif\n\n #ifdef MATERIAL_HAS_SPECULAR_GLOSSINESS_TEXTURE\n vec4 specularGlossinessColor = texture2DSRGB(material_SpecularGlossinessTexture, v_uv);\n specularColor *= specularGlossinessColor.rgb;\n glossiness *= specularGlossinessColor.a;\n #endif\n\n\n #ifdef IS_METALLIC_WORKFLOW\n material.diffuseColor = baseColor.rgb * ( 1.0 - metal );\n material.specularColor = mix( vec3(f0), baseColor.rgb, metal );\n material.roughness = roughness;\n #else\n float specularStrength = max( max( specularColor.r, specularColor.g ), specularColor.b );\n material.diffuseColor = baseColor.rgb * ( 1.0 - specularStrength );\n material.specularColor = specularColor;\n material.roughness = 1.0 - glossiness;\n #endif\n\n material.roughness = max(MIN_PERCEPTUAL_ROUGHNESS, min(material.roughness + getAARoughnessFactor(geometry.normal), 1.0));\n\n #ifdef MATERIAL_ENABLE_CLEAR_COAT\n material.clearCoat = material_ClearCoat;\n material.clearCoatRoughness = material_ClearCoatRoughness;\n #ifdef MATERIAL_HAS_CLEAR_COAT_TEXTURE\n material.clearCoat *= texture2D( material_ClearCoatTexture, v_uv ).r;\n #endif\n #ifdef MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE\n material.clearCoatRoughness *= texture2D( material_ClearCoatRoughnessTexture, v_uv ).g;\n #endif\n material.clearCoat = saturate( material.clearCoat );\n material.clearCoatRoughness = max(MIN_PERCEPTUAL_ROUGHNESS, min(material.clearCoatRoughness + getAARoughnessFactor(geometry.clearCoatNormal), 1.0));\n #endif\n\n #ifdef MATERIAL_IS_TRANSPARENT\n material.opacity = baseColor.a;\n #else\n material.opacity = 1.0;\n #endif\n #ifdef MATERIAL_ENABLE_ANISOTROPY\n geometry.anisotropicN = getAnisotropicBentNormal(geometry, geometry.normal, material.roughness);\n #endif\n\n material.envSpecularDFG = envBRDFApprox(material.specularColor, material.roughness, geometry.dotNV );\n\n // AO\n float diffuseAO = 1.0;\n float specularAO = 1.0;\n\n #ifdef MATERIAL_HAS_OCCLUSION_TEXTURE\n vec2 aoUV = v_uv;\n #ifdef RENDERER_HAS_UV1\n if(material_OcclusionTextureCoord == 1.0){\n aoUV = v_uv1;\n }\n #endif\n diffuseAO = ((texture2D(material_OcclusionTexture, aoUV)).r - 1.0) * material_OcclusionIntensity + 1.0;\n #endif\n\n #ifdef SCENE_ENABLE_AMBIENT_OCCLUSION \n float ambientAO = texture2D(camera_AOTexture,(v_PositionCS.xy / v_PositionCS.w) * 0.5 + 0.5).r;\n diffuseAO = min(diffuseAO, ambientAO);\n #endif\n\n #if (defined(MATERIAL_HAS_OCCLUSION_TEXTURE) || defined(SCENE_ENABLE_AMBIENT_OCCLUSION))&& defined(SCENE_USE_SPECULAR_ENV) \n specularAO = saturate( pow( geometry.dotNV + diffuseAO, exp2( - 16.0 * material.roughness - 1.0 ) ) - 1.0 + diffuseAO );\n #endif\n\n material.diffuseAO = diffuseAO;\n material.specularAO = specularAO;\n\n // Sheen\n #ifdef MATERIAL_ENABLE_SHEEN\n vec3 sheenColor = material_SheenColor;\n #ifdef MATERIAL_HAS_SHEEN_TEXTURE\n sheenColor *= texture2DSRGB(material_SheenTexture, v_uv).rgb;\n #endif\n material.sheenColor = sheenColor;\n\n material.sheenRoughness = material_SheenRoughness;\n #ifdef MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE\n material.sheenRoughness *= texture2D(material_SheenRoughnessTexture, v_uv).a;\n #endif\n\n material.sheenRoughness = max(MIN_PERCEPTUAL_ROUGHNESS, min(material.sheenRoughness + getAARoughnessFactor(geometry.normal), 1.0));\n material.approxIBLSheenDG = prefilteredSheenDFG(geometry.dotNV, material.sheenRoughness);\n material.sheenScaling = 1.0 - material.approxIBLSheenDG * max(max(material.sheenColor.r, material.sheenColor.g), material.sheenColor.b);\n #endif\n\n // Iridescence\n #ifdef MATERIAL_ENABLE_IRIDESCENCE\n material.iridescenceFactor = material_IridescenceInfo.x;\n material.iridescenceIOR = material_IridescenceInfo.y;\n\n #ifdef MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE\n float iridescenceThicknessWeight = texture2D( material_IridescenceThicknessTexture, v_uv).g;\n material.iridescenceThickness = mix(material_IridescenceInfo.z, material_IridescenceInfo.w, iridescenceThicknessWeight);\n #else\n material.iridescenceThickness = material_IridescenceInfo.w;\n #endif\n\n #ifdef MATERIAL_HAS_IRIDESCENCE_TEXTURE\n material.iridescenceFactor *= texture2D( material_IridescenceTexture, v_uv).r;\n #endif\n \n #ifdef MATERIAL_ENABLE_IRIDESCENCE\n float topIOR = 1.0;\n material.iridescenceSpecularColor = evalIridescenceSpecular(topIOR, geometry.dotNV, material.iridescenceIOR, material.specularColor, material.iridescenceThickness); \n #endif\n #endif\n\n // Transmission\n #ifdef MATERIAL_ENABLE_TRANSMISSION \n material.transmission = material_Transmission;\n #ifdef MATERIAL_HAS_TRANSMISSION_TEXTURE\n material.transmission *= texture2D(material_TransmissionTexture, v_uv).r;\n #endif\n\n #ifdef MATERIAL_HAS_THICKNESS\n material.absorptionCoefficient = -log(material_AttenuationColor + HALF_EPS) / max(HALF_EPS, material_AttenuationDistance);\n material.thickness = max(material_Thickness, 0.0001);\n #ifdef MATERIAL_HAS_THICKNESS_TEXTURE\n material.thickness *= texture2D( material_ThicknessTexture, v_uv).g;\n #endif\n #endif \n #endif\n\n}\n\n\n"; // eslint-disable-line
|
|
9672
|
+
var pbr_helper = "#include <normal_get>\n#include <brdf>\n#include <btdf>\n\n// direct + indirect\n#include <direct_irradiance_frag_define>\n#include <ibl_frag_define>\n\nuniform sampler2D camera_AOTexture;\n\nfloat evaluateAmbientOcclusion(vec2 uv)\n{\n #ifdef MATERIAL_IS_TRANSPARENT\n return 1.0;\n #else\n return texture2D(camera_AOTexture, uv).r;\n #endif\n}\n\n\nfloat computeSpecularOcclusion(float ambientOcclusion, float roughness, float dotNV ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n\nfloat getAARoughnessFactor(vec3 normal) {\n // Kaplanyan 2016, \"Stable specular highlights\"\n // Tokuyoshi 2017, \"Error Reduction and Simplification for Shading Anti-Aliasing\"\n // Tokuyoshi and Kaplanyan 2019, \"Improved Geometric Specular Antialiasing\"\n #ifdef HAS_DERIVATIVES\n vec3 dxy = max( abs(dFdx(normal)), abs(dFdy(normal)) );\n return max( max(dxy.x, dxy.y), dxy.z );\n #else\n return 0.0;\n #endif\n}\n\n#ifdef MATERIAL_ENABLE_ANISOTROPY\n // Aniso Bent Normals\n // Mc Alley https://www.gdcvault.com/play/1022235/Rendering-the-World-of-Far \n vec3 getAnisotropicBentNormal(Geometry geometry, vec3 n, float roughness) {\n vec3 anisotropyDirection = geometry.anisotropy >= 0.0 ? geometry.anisotropicB : geometry.anisotropicT;\n vec3 anisotropicTangent = cross(anisotropyDirection, geometry.viewDir);\n vec3 anisotropicNormal = cross(anisotropicTangent, anisotropyDirection);\n // reduce stretching for (roughness < 0.2), refer to https://advances.realtimerendering.com/s2018/Siggraph%202018%20HDRP%20talk_with%20notes.pdf 80\n vec3 bentNormal = normalize( mix(n, anisotropicNormal, abs(geometry.anisotropy) * saturate( 5.0 * roughness)) );\n\n return bentNormal;\n }\n#endif\n\nvoid initGeometry(out Geometry geometry, bool isFrontFacing){\n geometry.position = v_pos;\n #ifdef CAMERA_ORTHOGRAPHIC\n geometry.viewDir = -camera_Forward;\n #else\n geometry.viewDir = normalize(camera_Position - v_pos);\n #endif\n #if defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) || defined(MATERIAL_ENABLE_ANISOTROPY)\n mat3 tbn = getTBN(isFrontFacing);\n #endif\n\n #ifdef MATERIAL_HAS_NORMALTEXTURE\n geometry.normal = getNormalByNormalTexture(tbn, material_NormalTexture, material_NormalIntensity, v_uv, isFrontFacing);\n #else\n geometry.normal = getNormal(isFrontFacing);\n #endif\n\n geometry.dotNV = saturate( dot(geometry.normal, geometry.viewDir) );\n\n\n #ifdef MATERIAL_ENABLE_CLEAR_COAT\n #ifdef MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE\n geometry.clearCoatNormal = getNormalByNormalTexture(tbn, material_ClearCoatNormalTexture, material_NormalIntensity, v_uv, isFrontFacing);\n #else\n geometry.clearCoatNormal = getNormal(isFrontFacing);\n #endif\n geometry.clearCoatDotNV = saturate( dot(geometry.clearCoatNormal, geometry.viewDir) );\n #endif\n\n #ifdef MATERIAL_ENABLE_ANISOTROPY\n float anisotropy = material_AnisotropyInfo.z;\n vec3 anisotropicDirection = vec3(material_AnisotropyInfo.xy, 0.0);\n #ifdef MATERIAL_HAS_ANISOTROPY_TEXTURE\n vec3 anisotropyTextureInfo = texture2D( material_AnisotropyTexture, v_uv ).rgb;\n anisotropy *= anisotropyTextureInfo.b;\n anisotropicDirection.xy *= anisotropyTextureInfo.rg * 2.0 - 1.0;\n #endif\n\n geometry.anisotropy = anisotropy;\n geometry.anisotropicT = normalize(tbn * anisotropicDirection);\n geometry.anisotropicB = normalize(cross(geometry.normal, geometry.anisotropicT));\n #endif\n}\n\nvoid initMaterial(out Material material, inout Geometry geometry){\n vec4 baseColor = material_BaseColor;\n float metal = material_Metal;\n float roughness = material_Roughness;\n vec3 specularColor = material_PBRSpecularColor;\n float glossiness = material_Glossiness;\n float alphaCutoff = material_AlphaCutoff;\n float f0 = pow2( (material_IOR - 1.0) / (material_IOR + 1.0) );\n\n material.f0 = f0;\n material.IOR = material_IOR;\n\n #ifdef MATERIAL_HAS_BASETEXTURE\n baseColor *= texture2DSRGB(material_BaseTexture, v_uv);\n #endif\n\n #ifdef RENDERER_ENABLE_VERTEXCOLOR\n baseColor *= v_color;\n #endif\n\n\n #ifdef MATERIAL_IS_ALPHA_CUTOFF\n if( baseColor.a < alphaCutoff ) {\n discard;\n }\n #endif\n\n #ifdef MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE\n vec4 metalRoughMapColor = texture2D( material_RoughnessMetallicTexture, v_uv );\n roughness *= metalRoughMapColor.g;\n metal *= metalRoughMapColor.b;\n #endif\n\n #ifdef MATERIAL_HAS_SPECULAR_GLOSSINESS_TEXTURE\n vec4 specularGlossinessColor = texture2DSRGB(material_SpecularGlossinessTexture, v_uv);\n specularColor *= specularGlossinessColor.rgb;\n glossiness *= specularGlossinessColor.a;\n #endif\n\n\n #ifdef IS_METALLIC_WORKFLOW\n material.diffuseColor = baseColor.rgb * ( 1.0 - metal );\n material.specularColor = mix( vec3(f0), baseColor.rgb, metal );\n material.roughness = roughness;\n #else\n float specularStrength = max( max( specularColor.r, specularColor.g ), specularColor.b );\n material.diffuseColor = baseColor.rgb * ( 1.0 - specularStrength );\n material.specularColor = specularColor;\n material.roughness = 1.0 - glossiness;\n #endif\n\n material.roughness = max(MIN_PERCEPTUAL_ROUGHNESS, min(material.roughness + getAARoughnessFactor(geometry.normal), 1.0));\n\n #ifdef MATERIAL_ENABLE_CLEAR_COAT\n material.clearCoat = material_ClearCoat;\n material.clearCoatRoughness = material_ClearCoatRoughness;\n #ifdef MATERIAL_HAS_CLEAR_COAT_TEXTURE\n material.clearCoat *= texture2D( material_ClearCoatTexture, v_uv ).r;\n #endif\n #ifdef MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE\n material.clearCoatRoughness *= texture2D( material_ClearCoatRoughnessTexture, v_uv ).g;\n #endif\n material.clearCoat = saturate( material.clearCoat );\n material.clearCoatRoughness = max(MIN_PERCEPTUAL_ROUGHNESS, min(material.clearCoatRoughness + getAARoughnessFactor(geometry.clearCoatNormal), 1.0));\n #endif\n\n #ifdef MATERIAL_IS_TRANSPARENT\n material.opacity = baseColor.a;\n #else\n material.opacity = 1.0;\n #endif\n #ifdef MATERIAL_ENABLE_ANISOTROPY\n geometry.anisotropicN = getAnisotropicBentNormal(geometry, geometry.normal, material.roughness);\n #endif\n\n material.envSpecularDFG = envBRDFApprox(material.specularColor, material.roughness, geometry.dotNV );\n\n // AO\n float diffuseAO = 1.0;\n float specularAO = 1.0;\n\n #ifdef MATERIAL_HAS_OCCLUSION_TEXTURE\n vec2 aoUV = v_uv;\n #ifdef RENDERER_HAS_UV1\n if(material_OcclusionTextureCoord == 1.0){\n aoUV = v_uv1;\n }\n #endif\n diffuseAO = ((texture2D(material_OcclusionTexture, aoUV)).r - 1.0) * material_OcclusionIntensity + 1.0;\n #endif\n\n #ifdef SCENE_ENABLE_AMBIENT_OCCLUSION\n float ambientAO = evaluateAmbientOcclusion((v_PositionCS.xy / v_PositionCS.w) * 0.5 + 0.5);\n diffuseAO = min(diffuseAO, ambientAO);\n #endif\n\n #if (defined(MATERIAL_HAS_OCCLUSION_TEXTURE) || defined(SCENE_ENABLE_AMBIENT_OCCLUSION))&& defined(SCENE_USE_SPECULAR_ENV) \n specularAO = saturate( pow( geometry.dotNV + diffuseAO, exp2( - 16.0 * material.roughness - 1.0 ) ) - 1.0 + diffuseAO );\n #endif\n\n material.diffuseAO = diffuseAO;\n material.specularAO = specularAO;\n\n // Sheen\n #ifdef MATERIAL_ENABLE_SHEEN\n vec3 sheenColor = material_SheenColor;\n #ifdef MATERIAL_HAS_SHEEN_TEXTURE\n sheenColor *= texture2DSRGB(material_SheenTexture, v_uv).rgb;\n #endif\n material.sheenColor = sheenColor;\n\n material.sheenRoughness = material_SheenRoughness;\n #ifdef MATERIAL_HAS_SHEEN_ROUGHNESS_TEXTURE\n material.sheenRoughness *= texture2D(material_SheenRoughnessTexture, v_uv).a;\n #endif\n\n material.sheenRoughness = max(MIN_PERCEPTUAL_ROUGHNESS, min(material.sheenRoughness + getAARoughnessFactor(geometry.normal), 1.0));\n material.approxIBLSheenDG = prefilteredSheenDFG(geometry.dotNV, material.sheenRoughness);\n material.sheenScaling = 1.0 - material.approxIBLSheenDG * max(max(material.sheenColor.r, material.sheenColor.g), material.sheenColor.b);\n #endif\n\n // Iridescence\n #ifdef MATERIAL_ENABLE_IRIDESCENCE\n material.iridescenceFactor = material_IridescenceInfo.x;\n material.iridescenceIOR = material_IridescenceInfo.y;\n\n #ifdef MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE\n float iridescenceThicknessWeight = texture2D( material_IridescenceThicknessTexture, v_uv).g;\n material.iridescenceThickness = mix(material_IridescenceInfo.z, material_IridescenceInfo.w, iridescenceThicknessWeight);\n #else\n material.iridescenceThickness = material_IridescenceInfo.w;\n #endif\n\n #ifdef MATERIAL_HAS_IRIDESCENCE_TEXTURE\n material.iridescenceFactor *= texture2D( material_IridescenceTexture, v_uv).r;\n #endif\n \n #ifdef MATERIAL_ENABLE_IRIDESCENCE\n float topIOR = 1.0;\n material.iridescenceSpecularColor = evalIridescenceSpecular(topIOR, geometry.dotNV, material.iridescenceIOR, material.specularColor, material.iridescenceThickness); \n #endif\n #endif\n\n // Transmission\n #ifdef MATERIAL_ENABLE_TRANSMISSION \n material.transmission = material_Transmission;\n #ifdef MATERIAL_HAS_TRANSMISSION_TEXTURE\n material.transmission *= texture2D(material_TransmissionTexture, v_uv).r;\n #endif\n\n #ifdef MATERIAL_HAS_THICKNESS\n material.absorptionCoefficient = -log(material_AttenuationColor + HALF_EPS) / max(HALF_EPS, material_AttenuationDistance);\n material.thickness = max(material_Thickness, 0.0001);\n #ifdef MATERIAL_HAS_THICKNESS_TEXTURE\n material.thickness *= texture2D( material_ThicknessTexture, v_uv).g;\n #endif\n #endif \n #endif\n}\n\n\n\n"; // eslint-disable-line
|
|
9703
9673
|
var brdf = "\n#ifdef MATERIAL_ENABLE_SHEEN\n uniform sampler2D scene_PrefilteredDFG;\n#endif\n\nfloat F_Schlick(float f0, float dotLH) {\n\treturn f0 + 0.96 * (pow(1.0 - dotLH, 5.0));\n}\n\nvec3 F_Schlick(vec3 specularColor, float dotLH ) {\n\n\t// Original approximation by Christophe Schlick '94\n\t// float fresnel = pow( 1.0 - dotLH, 5.0 );\n\n\t// Optimized variant (presented by Epic at SIGGRAPH '13)\n\t// https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n\n}\n\n// Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2\n// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat G_GGX_SmithCorrelated(float alpha, float dotNL, float dotNV ) {\n\n\tfloat a2 = pow2( alpha );\n\n\t// dotNL and dotNV are explicitly swapped. This is not a mistake.\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\n\treturn 0.5 / max( gv + gl, EPSILON );\n\n}\n\n#ifdef MATERIAL_ENABLE_ANISOTROPY\n // Heitz 2014, \"Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs\"\n // Heitz http://jcgt.org/published/0003/02/03/paper.pdf\n float G_GGX_SmithCorrelated_Anisotropic(float at, float ab, float ToV, float BoV, float ToL, float BoL, float NoV, float NoL) {\n float lambdaV = NoL * length(vec3(at * ToV, ab * BoV, NoV));\n float lambdaL = NoV * length(vec3(at * ToL, ab * BoL, NoL));\n return 0.5 / max(lambdaV + lambdaL, EPSILON);\n }\n#endif\n\n// Microfacet Models for Refraction through Rough Surfaces - equation (33)\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\n// alpha is \"roughness squared\" in Disney’s reparameterization\nfloat D_GGX(float alpha, float dotNH ) {\n\n\tfloat a2 = pow2( alpha );\n\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; // avoid alpha = 0 with dotNH = 1\n\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n\n}\n\n#ifdef MATERIAL_ENABLE_SHEEN\n // http://www.aconty.com/pdf/s2017_pbs_imageworks_sheen.pdf\n float D_Charlie(float roughness, float dotNH) {\n float invAlpha = 1.0 / roughness;\n float cos2h = dotNH * dotNH;\n float sin2h = max(1.0 - cos2h, 0.0078125); // 2^(-14/2), so sin2h^2 > 0 in fp16\n return (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n }\n\n // Neubelt and Pettineo 2013, \"Crafting a Next-gen Material Pipeline for The Order: 1886\".\n float V_Neubelt(float NoV, float NoL) {\n return saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n }\n\n vec3 sheenBRDF(vec3 incidentDirection, Geometry geometry, vec3 sheenColor, float sheenRoughness) {\n vec3 halfDir = normalize(incidentDirection + geometry.viewDir);\n float dotNL = saturate(dot(geometry.normal, incidentDirection));\n float dotNH = saturate(dot(geometry.normal, halfDir));\n float D = D_Charlie(sheenRoughness, dotNH);\n float V = V_Neubelt(geometry.dotNV, dotNL);\n vec3 F = sheenColor;\n return D * V * F;\n }\n\n float prefilteredSheenDFG(float dotNV, float sheenRoughness) {\n #ifdef HAS_TEX_LOD\n return texture2DLodEXT(scene_PrefilteredDFG, vec2(dotNV, sheenRoughness), 0.0).b;\n #else\n return texture2D(scene_PrefilteredDFG, vec2(dotNV, sheenRoughness),0.0).b;\n #endif \n }\n#endif\n\n#ifdef MATERIAL_ENABLE_ANISOTROPY\n // GGX Distribution Anisotropic\n // https://blog.selfshadow.com/publications/s2012-shading-course/burley/s2012_pbs_disney_brdf_notes_v3.pdf Addenda\n float D_GGX_Anisotropic(float at, float ab, float ToH, float BoH, float NoH) {\n float a2 = at * ab;\n vec3 d = vec3(ab * ToH, at * BoH, a2 * NoH);\n float d2 = dot(d, d);\n float b2 = a2 / d2;\n return a2 * b2 * b2 * RECIPROCAL_PI;\n }\n#endif\n\nfloat DG_GGX(float alpha, float dotNV, float dotNL, float dotNH) {\n\tfloat D = D_GGX( alpha, dotNH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n return G * D;\n}\n\n#ifdef MATERIAL_ENABLE_ANISOTROPY\n float DG_GGX_anisotropic(vec3 h, vec3 l, Geometry geometry, float alpha, float dotNV, float dotNL, float dotNH) {\n vec3 t = geometry.anisotropicT;\n vec3 b = geometry.anisotropicB;\n vec3 v = geometry.viewDir;\n\n float dotTV = dot(t, v);\n float dotBV = dot(b, v);\n float dotTL = dot(t, l);\n float dotBL = dot(b, l);\n float dotTH = dot(t, h);\n float dotBH = dot(b, h);\n\n // Aniso parameter remapping\n // https://blog.selfshadow.com/publications/s2017-shading-course/imageworks/s2017_pbs_imageworks_slides_v2.pdf page 24\n float at = max(alpha * (1.0 + geometry.anisotropy), MIN_ROUGHNESS);\n float ab = max(alpha * (1.0 - geometry.anisotropy), MIN_ROUGHNESS);\n\n // specular anisotropic BRDF\n float D = D_GGX_Anisotropic(at, ab, dotTH, dotBH, dotNH);\n float G = G_GGX_SmithCorrelated_Anisotropic(at, ab, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL);\n\n return G * D;\n }\n#endif\n\n#ifdef MATERIAL_ENABLE_IRIDESCENCE\n vec3 iorToFresnel0(vec3 transmittedIOR, float incidentIOR) {\n return pow((transmittedIOR - incidentIOR) / (transmittedIOR + incidentIOR),vec3(2.0));\n } \n\n float iorToFresnel0(float transmittedIOR, float incidentIOR) {\n return pow((transmittedIOR - incidentIOR) / (transmittedIOR + incidentIOR),2.0);\n } \n\n // Assume air interface for top\n // Note: We don't handle the case fresnel0 == 1\n vec3 fresnelToIOR(vec3 f0){\n vec3 sqrtF0 = sqrt(f0);\n return (vec3(1.0) + sqrtF0) / (vec3(1.0) - sqrtF0);\n }\n\n // Fresnel equations for dielectric/dielectric interfaces.\n // Ref: https://belcour.github.io/blog/research/publication/2017/05/01/brdf-thin-film.html\n // Evaluation XYZ sensitivity curves in Fourier space\n vec3 evalSensitivity(float opd, vec3 shift){\n // Use Gaussian fits, given by 3 parameters: val, pos and var\n float phase = 2.0 * PI * opd * 1.0e-9;\n const vec3 val = vec3(5.4856e-13, 4.4201e-13, 5.2481e-13);\n const vec3 pos = vec3(1.6810e+06, 1.7953e+06, 2.2084e+06);\n const vec3 var = vec3(4.3278e+09, 9.3046e+09, 6.6121e+09);\n vec3 xyz = val * sqrt(2.0 * PI * var) * cos(pos * phase + shift) * exp(-var * pow2(phase));\n xyz.x += 9.7470e-14 * sqrt(2.0 * PI * 4.5282e+09) * cos(2.2399e+06 * phase + shift[0]) * exp(-4.5282e+09 * pow2(phase));\n xyz /= 1.0685e-7;\n // XYZ to RGB color space\n const mat3 XYZ_TO_RGB = mat3( 3.2404542, -0.9692660, 0.0556434,\n -1.5371385, 1.8760108, -0.2040259,\n -0.4985314, 0.0415560, 1.0572252);\n vec3 rgb = XYZ_TO_RGB * xyz;\n return rgb;\n }\n\n vec3 evalIridescenceSpecular(float outsideIOR, float dotNV, float thinIOR, vec3 baseF0,float iridescenceThickness){ \n vec3 iridescence = vec3(1.0);\n // Force iridescenceIOR -> outsideIOR when thinFilmThickness -> 0.0\n float iridescenceIOR = mix( outsideIOR, thinIOR, smoothstep( 0.0, 0.03, iridescenceThickness ) );\n // Evaluate the cosTheta on the base layer (Snell law)\n float sinTheta2Sq = pow( outsideIOR / iridescenceIOR, 2.0) * (1.0 - pow( dotNV, 2.0));\n float cosTheta2Sq = 1.0 - sinTheta2Sq;\n // Handle total internal reflection\n if (cosTheta2Sq < 0.0) {\n return iridescence;\n }\n float cosTheta2 = sqrt(cosTheta2Sq);\n \n // First interface\n float f0 = iorToFresnel0(iridescenceIOR, outsideIOR);\n float reflectance = F_Schlick(f0, dotNV);\n float t121 = 1.0 - reflectance;\n float phi12 = 0.0;\n // iridescenceIOR has limited greater than 1.0\n // if (iridescenceIOR < outsideIOR) {phi12 = PI;} \n float phi21 = PI - phi12;\n \n // Second interface\n vec3 baseIOR = fresnelToIOR(clamp(baseF0, 0.0, 0.9999)); // guard against 1.0\n vec3 r1 = iorToFresnel0(baseIOR, iridescenceIOR);\n vec3 r23 = F_Schlick(r1, cosTheta2);\n vec3 phi23 =vec3(0.0);\n if (baseIOR[0] < iridescenceIOR) {phi23[0] = PI;}\n if (baseIOR[1] < iridescenceIOR) {phi23[1] = PI;}\n if (baseIOR[2] < iridescenceIOR) {phi23[2] = PI;}\n \n // Phase shift\n float opd = 2.0 * iridescenceIOR * iridescenceThickness * cosTheta2;\n vec3 phi = vec3(phi21) + phi23;\n \n // Compound terms\n vec3 r123 = clamp(reflectance * r23, 1e-5, 0.9999);\n vec3 sr123 = sqrt(r123);\n vec3 rs = pow2(t121) * r23 / (vec3(1.0) - r123);\n // Reflectance term for m = 0 (DC term amplitude)\n vec3 c0 = reflectance + rs;\n iridescence = c0;\n // Reflectance term for m > 0 (pairs of diracs)\n vec3 cm = rs - t121;\n for (int m = 1; m <= 2; ++m) {\n cm *= sr123;\n vec3 sm = 2.0 * evalSensitivity(float(m) * opd, float(m) * phi);\n iridescence += cm * sm;\n }\n return iridescence = max(iridescence, vec3(0.0)); \n }\n#endif\n\n// GGX Distribution, Schlick Fresnel, GGX-Smith Visibility\nvec3 BRDF_Specular_GGX(vec3 incidentDirection, Geometry geometry, Material material, vec3 normal, vec3 specularColor, float roughness ) {\n\n\tfloat alpha = pow2( roughness ); // UE4's roughness\n\n\tvec3 halfDir = normalize( incidentDirection + geometry.viewDir );\n\n\tfloat dotNL = saturate( dot( normal, incidentDirection ) );\n\tfloat dotNV = saturate( dot( normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentDirection, halfDir ) );\n\n vec3 F = F_Schlick( specularColor, dotLH );\n #ifdef MATERIAL_ENABLE_IRIDESCENCE\n F = mix(F, material.iridescenceSpecularColor, material.iridescenceFactor);\n #endif\n\n #ifdef MATERIAL_ENABLE_ANISOTROPY\n float GD = DG_GGX_anisotropic(halfDir, incidentDirection, geometry, alpha, dotNV, dotNL, dotNH);\n #else\n float GD = DG_GGX(alpha, dotNV, dotNL, dotNH);\n #endif\n\n return F * GD;\n}\n\nvec3 BRDF_Diffuse_Lambert(vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\n"; // eslint-disable-line
|
|
9704
9674
|
var direct_irradiance_frag_define = "#include <ShadowFragmentDeclaration>\n\nvoid sheenLobe(Geometry geometry, Material material, vec3 incidentDirection, vec3 attenuationIrradiance, inout vec3 diffuseColor, inout vec3 specularColor){\n #ifdef MATERIAL_ENABLE_SHEEN\n diffuseColor *= material.sheenScaling;\n specularColor *= material.sheenScaling;\n\n specularColor += attenuationIrradiance * sheenBRDF(incidentDirection, geometry, material.sheenColor, material.sheenRoughness);\n #endif\n}\n\nvoid addDirectRadiance(vec3 incidentDirection, vec3 color, Geometry geometry, Material material, inout ReflectedLight reflectedLight) {\n float attenuation = 1.0;\n\n #ifdef MATERIAL_ENABLE_CLEAR_COAT\n float clearCoatDotNL = saturate( dot( geometry.clearCoatNormal, incidentDirection ) );\n vec3 clearCoatIrradiance = clearCoatDotNL * color;\n\n reflectedLight.directSpecular += material.clearCoat * clearCoatIrradiance * BRDF_Specular_GGX( incidentDirection, geometry, material, geometry.clearCoatNormal, vec3( 0.04 ), material.clearCoatRoughness );\n attenuation -= material.clearCoat * F_Schlick(material.f0, geometry.clearCoatDotNV);\n #endif\n\n float dotNL = saturate( dot( geometry.normal, incidentDirection ) );\n vec3 irradiance = dotNL * color * PI;\n\n reflectedLight.directSpecular += attenuation * irradiance * BRDF_Specular_GGX( incidentDirection, geometry, material, geometry.normal, material.specularColor, material.roughness);\n reflectedLight.directDiffuse += attenuation * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\n // Sheen Lobe\n sheenLobe(geometry, material, incidentDirection, attenuation * irradiance, reflectedLight.directDiffuse, reflectedLight.directSpecular);\n\n}\n\n#ifdef SCENE_DIRECT_LIGHT_COUNT\n\n void addDirectionalDirectLightRadiance(DirectLight directionalLight, Geometry geometry, Material material, inout ReflectedLight reflectedLight) {\n vec3 color = directionalLight.color;\n vec3 direction = -directionalLight.direction;\n\n\t\taddDirectRadiance( direction, color, geometry, material, reflectedLight );\n\n }\n\n#endif\n\n#ifdef SCENE_POINT_LIGHT_COUNT\n\n\tvoid addPointDirectLightRadiance(PointLight pointLight, Geometry geometry, Material material, inout ReflectedLight reflectedLight) {\n\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tvec3 direction = normalize( lVector );\n\n\t\tfloat lightDistance = length( lVector );\n\n\t\tvec3 color = pointLight.color;\n\t\tcolor *= clamp(1.0 - pow(lightDistance/pointLight.distance, 4.0), 0.0, 1.0);\n\n\t\taddDirectRadiance( direction, color, geometry, material, reflectedLight );\n\n\t}\n\n#endif\n\n#ifdef SCENE_SPOT_LIGHT_COUNT\n\n\tvoid addSpotDirectLightRadiance(SpotLight spotLight, Geometry geometry, Material material, inout ReflectedLight reflectedLight) {\n\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tvec3 direction = normalize( lVector );\n\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( direction, -spotLight.direction );\n\n\t\tfloat spotEffect = smoothstep( spotLight.penumbraCos, spotLight.angleCos, angleCos );\n\t\tfloat decayEffect = clamp(1.0 - pow(lightDistance/spotLight.distance, 4.0), 0.0, 1.0);\n\n\t\tvec3 color = spotLight.color;\n\t\tcolor *= spotEffect * decayEffect;\n\n\t\taddDirectRadiance( direction, color, geometry, material, reflectedLight );\n\n\t}\n\n\n#endif\n\nvoid addTotalDirectRadiance(Geometry geometry, Material material, inout ReflectedLight reflectedLight){\n float shadowAttenuation = 1.0;\n\n #ifdef SCENE_DIRECT_LIGHT_COUNT\n shadowAttenuation = 1.0;\n #ifdef SCENE_IS_CALCULATE_SHADOWS\n shadowAttenuation *= sampleShadowMap();\n #endif\n\n DirectLight directionalLight;\n for ( int i = 0; i < SCENE_DIRECT_LIGHT_COUNT; i ++ ) {\n // warning: use `continue` syntax may trigger flickering bug in safri 16.1.\n if(!isRendererCulledByLight(renderer_Layer.xy, scene_DirectLightCullingMask[i])){\n directionalLight.color = scene_DirectLightColor[i];\n #ifdef SCENE_IS_CALCULATE_SHADOWS\n if (i == 0) { // Sun light index is always 0\n directionalLight.color *= shadowAttenuation;\n }\n #endif\n directionalLight.direction = scene_DirectLightDirection[i];\n addDirectionalDirectLightRadiance( directionalLight, geometry, material, reflectedLight );\n }\n }\n\n #endif\n\n #ifdef SCENE_POINT_LIGHT_COUNT\n\n PointLight pointLight;\n\n for ( int i = 0; i < SCENE_POINT_LIGHT_COUNT; i ++ ) {\n if(!isRendererCulledByLight(renderer_Layer.xy, scene_PointLightCullingMask[i])){\n pointLight.color = scene_PointLightColor[i];\n pointLight.position = scene_PointLightPosition[i];\n pointLight.distance = scene_PointLightDistance[i];\n\n addPointDirectLightRadiance( pointLight, geometry, material, reflectedLight );\n } \n }\n\n #endif\n\n #ifdef SCENE_SPOT_LIGHT_COUNT\n\n SpotLight spotLight;\n\n for ( int i = 0; i < SCENE_SPOT_LIGHT_COUNT; i ++ ) {\n if(!isRendererCulledByLight(renderer_Layer.xy, scene_SpotLightCullingMask[i])){\n spotLight.color = scene_SpotLightColor[i];\n spotLight.position = scene_SpotLightPosition[i];\n spotLight.direction = scene_SpotLightDirection[i];\n spotLight.distance = scene_SpotLightDistance[i];\n spotLight.angleCos = scene_SpotLightAngleCos[i];\n spotLight.penumbraCos = scene_SpotLightPenumbraCos[i];\n\n addSpotDirectLightRadiance( spotLight, geometry, material, reflectedLight );\n } \n }\n\n #endif\n}"; // eslint-disable-line
|
|
9705
9675
|
var ibl_frag_define = "// ------------------------Diffuse------------------------\n\n// sh need be pre-scaled in CPU.\nvec3 getLightProbeIrradiance(vec3 sh[9], vec3 normal){\n normal.x = -normal.x;\n vec3 result = sh[0] +\n\n sh[1] * (normal.y) +\n sh[2] * (normal.z) +\n sh[3] * (normal.x) +\n\n sh[4] * (normal.y * normal.x) +\n sh[5] * (normal.y * normal.z) +\n sh[6] * (3.0 * normal.z * normal.z - 1.0) +\n sh[7] * (normal.z * normal.x) +\n sh[8] * (normal.x * normal.x - normal.y * normal.y);\n \n return max(result, vec3(0.0));\n\n}\n\n// ------------------------Specular------------------------\n\n// ref: https://www.unrealengine.com/blog/physically-based-shading-on-mobile - environmentBRDF for GGX on mobile\nvec3 envBRDFApprox(vec3 specularColor,float roughness, float dotNV ) {\n\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\n vec4 r = roughness * c0 + c1;\n\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\n vec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\n return specularColor * AB.x + AB.y;\n}\n\n\nfloat getSpecularMIPLevel(float roughness, int maxMIPLevel ) {\n return roughness * float(maxMIPLevel);\n}\n\nvec3 getReflectedVector(Geometry geometry, vec3 n) {\n #ifdef MATERIAL_ENABLE_ANISOTROPY\n vec3 r = reflect(-geometry.viewDir, geometry.anisotropicN);\n #else\n vec3 r = reflect(-geometry.viewDir, n);\n #endif\n\n return r;\n}\n\nvec3 getLightProbeRadiance(Geometry geometry, vec3 normal, float roughness, int maxMIPLevel, float specularIntensity) {\n\n #ifndef SCENE_USE_SPECULAR_ENV\n return vec3(0);\n #else\n vec3 reflectVec = getReflectedVector(geometry, normal);\n reflectVec.x = -reflectVec.x; // TextureCube is left-hand,so x need inverse\n \n float specularMIPLevel = getSpecularMIPLevel(roughness, maxMIPLevel );\n\n #ifdef HAS_TEX_LOD\n vec4 envMapColor = textureCubeLodEXT( scene_EnvSpecularSampler, reflectVec, specularMIPLevel );\n #else\n vec4 envMapColor = textureCube( scene_EnvSpecularSampler, reflectVec, specularMIPLevel );\n #endif\n\n #ifdef SCENE_IS_DECODE_ENV_RGBM\n envMapColor.rgb = RGBMToLinear(envMapColor, 5.0).rgb;\n #elif defined(ENGINE_NO_SRGB)\n envMapColor = sRGBToLinear(envMapColor);\n #endif\n \n return envMapColor.rgb * specularIntensity;\n\n #endif\n\n}\n\n\nvoid evaluateSheenIBL(Geometry geometry, Material material, float radianceAttenuation, inout vec3 diffuseColor, inout vec3 specularColor){\n #ifdef MATERIAL_ENABLE_SHEEN\n diffuseColor *= material.sheenScaling;\n specularColor *= material.sheenScaling;\n\n vec3 reflectance = material.specularAO * radianceAttenuation * material.approxIBLSheenDG * material.sheenColor;\n specularColor += reflectance;\n #endif\n}"; // eslint-disable-line
|
|
@@ -9843,11 +9813,11 @@
|
|
|
9843
9813
|
shader = shader.replace(/\bvarying\b/g, isFrag ? "in" : "out");
|
|
9844
9814
|
shader = shader.replace(/\btexture(2D|Cube)\b/g, "texture");
|
|
9845
9815
|
shader = shader.replace(/\btexture2DProj\b/g, "textureProj");
|
|
9816
|
+
shader = shader.replace(/\btexture(2D|Cube)LodEXT\b/g, "textureLod");
|
|
9817
|
+
shader = shader.replace(/\btexture(2D|Cube)GradEXT\b/g, "textureGrad");
|
|
9818
|
+
shader = shader.replace(/\btexture2DProjLodEXT\b/g, "textureProjLod");
|
|
9819
|
+
shader = shader.replace(/\btexture2DProjGradEXT\b/g, "textureProjGrad");
|
|
9846
9820
|
if (isFrag) {
|
|
9847
|
-
shader = shader.replace(/\btexture(2D|Cube)LodEXT\b/g, "textureLod");
|
|
9848
|
-
shader = shader.replace(/\btexture(2D|Cube)GradEXT\b/g, "textureGrad");
|
|
9849
|
-
shader = shader.replace(/\btexture2DProjLodEXT\b/g, "textureProjLod");
|
|
9850
|
-
shader = shader.replace(/\btexture2DProjGradEXT\b/g, "textureProjGrad");
|
|
9851
9821
|
shader = shader.replace(/\bgl_FragDepthEXT\b/g, "gl_FragDepth");
|
|
9852
9822
|
if (!ShaderFactory._has300Output(shader)) {
|
|
9853
9823
|
var isMRT = /\bgl_FragData\[.+?\]/g.test(shader);
|
|
@@ -9856,7 +9826,7 @@
|
|
|
9856
9826
|
var result = shader.match(/\bgl_FragData\[.+?\]/g);
|
|
9857
9827
|
shader = this._replaceMRTShader(shader, result);
|
|
9858
9828
|
} else {
|
|
9859
|
-
shader =
|
|
9829
|
+
shader = "out vec4 glFragColor;\n" + shader;
|
|
9860
9830
|
shader = shader.replace(/\bgl_FragColor\b/g, "glFragColor");
|
|
9861
9831
|
}
|
|
9862
9832
|
}
|
|
@@ -10547,46 +10517,29 @@
|
|
|
10547
10517
|
return ShaderProgram;
|
|
10548
10518
|
}();
|
|
10549
10519
|
ShaderProgram._counter = 0;
|
|
10550
|
-
|
|
10551
|
-
* @internal
|
|
10552
|
-
* Shader pass type
|
|
10553
|
-
*/ var ShaderType = /*#__PURE__*/ function(ShaderType) {
|
|
10554
|
-
/** init by glsl */ ShaderType[ShaderType["Canonical"] = 0] = "Canonical";
|
|
10555
|
-
/** init by shader-lab */ ShaderType[ShaderType["ShaderLab"] = 1] = "ShaderLab";
|
|
10556
|
-
return ShaderType;
|
|
10557
|
-
}({});
|
|
10520
|
+
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 ";
|
|
10558
10521
|
/**
|
|
10559
10522
|
* Shader pass containing vertex and fragment source.
|
|
10560
10523
|
*/ var ShaderPass = /*#__PURE__*/ function(ShaderPart) {
|
|
10561
10524
|
_inherits$2(ShaderPass, ShaderPart);
|
|
10562
|
-
function ShaderPass(nameOrVertexSource,
|
|
10525
|
+
function ShaderPass(nameOrVertexSource, vertexSourceOrFragmentSource, fragmentSourceOrTags, tags) {
|
|
10563
10526
|
var _this;
|
|
10564
|
-
_this = ShaderPart.call(this) || this, /** @internal */ _this._shaderPassId = 0, /** @internal */ _this._renderStateDataMap = {}, /** @internal */ _this._shaderProgramPools = []
|
|
10527
|
+
_this = ShaderPart.call(this) || this, /** @internal */ _this._shaderPassId = 0, /** @internal */ _this._renderStateDataMap = {}, /** @internal */ _this._shaderProgramPools = [];
|
|
10565
10528
|
_this._shaderPassId = ShaderPass._shaderPassCounter++;
|
|
10566
|
-
|
|
10567
|
-
if (typeof fragmentEntryOrTags === "string") {
|
|
10529
|
+
if (typeof fragmentSourceOrTags === "string") {
|
|
10568
10530
|
_this._name = nameOrVertexSource;
|
|
10569
|
-
_this.
|
|
10570
|
-
_this.
|
|
10571
|
-
_this._fragmentEntry = fragmentEntryOrTags;
|
|
10531
|
+
_this._vertexSource = vertexSourceOrFragmentSource;
|
|
10532
|
+
_this._fragmentSource = fragmentSourceOrTags;
|
|
10572
10533
|
tags = _extends$2({
|
|
10573
10534
|
pipelineStage: PipelineStage.Forward
|
|
10574
10535
|
}, tags);
|
|
10575
|
-
_this._type = ShaderType.ShaderLab;
|
|
10576
|
-
} else if (typeof fragmentSourceOrTagsOrVertexEntry === "string") {
|
|
10577
|
-
_this._name = nameOrVertexSource;
|
|
10578
|
-
_this._vertexSource = vertexSourceOrFragmentSourceOrCode;
|
|
10579
|
-
_this._fragmentSource = fragmentSourceOrTagsOrVertexEntry;
|
|
10580
|
-
tags = fragmentEntryOrTags != null ? fragmentEntryOrTags : {
|
|
10581
|
-
pipelineStage: PipelineStage.Forward
|
|
10582
|
-
};
|
|
10583
10536
|
} else {
|
|
10584
10537
|
_this._name = "Default";
|
|
10585
10538
|
_this._vertexSource = nameOrVertexSource;
|
|
10586
|
-
_this._fragmentSource =
|
|
10587
|
-
tags =
|
|
10539
|
+
_this._fragmentSource = vertexSourceOrFragmentSource;
|
|
10540
|
+
tags = _extends$2({
|
|
10588
10541
|
pipelineStage: PipelineStage.Forward
|
|
10589
|
-
};
|
|
10542
|
+
}, fragmentSourceOrTags);
|
|
10590
10543
|
}
|
|
10591
10544
|
for(var key in tags){
|
|
10592
10545
|
_this.setTag(key, tags[key]);
|
|
@@ -10602,11 +10555,7 @@
|
|
|
10602
10555
|
if (shaderProgram) {
|
|
10603
10556
|
return shaderProgram;
|
|
10604
10557
|
}
|
|
10605
|
-
|
|
10606
|
-
shaderProgram = this._getCanonicalShaderProgram(engine, macroCollection);
|
|
10607
|
-
} else {
|
|
10608
|
-
shaderProgram = this._compileShaderProgram(engine, macroCollection, this._vertexEntry, this._fragmentEntry);
|
|
10609
|
-
}
|
|
10558
|
+
shaderProgram = this._getCanonicalShaderProgram(engine, macroCollection);
|
|
10610
10559
|
shaderProgramPool.cache(shaderProgram);
|
|
10611
10560
|
return shaderProgram;
|
|
10612
10561
|
};
|
|
@@ -10622,55 +10571,37 @@
|
|
|
10622
10571
|
// Clear array storing multiple engine shader program pools
|
|
10623
10572
|
shaderProgramPools.length = 0;
|
|
10624
10573
|
};
|
|
10625
|
-
|
|
10626
|
-
* Shader Lab compilation
|
|
10627
|
-
*/ _proto._compileShaderProgram = function _compileShaderProgram(engine, macroCollection, vertexEntry, fragmentEntry) {
|
|
10628
|
-
var _this = this, path = _this._path, platformMacros = _this._platformMacros;
|
|
10574
|
+
_proto._getCanonicalShaderProgram = function _getCanonicalShaderProgram(engine, macroCollection) {
|
|
10629
10575
|
var isWebGL2 = engine._hardwareRenderer.isWebGL2;
|
|
10630
|
-
var
|
|
10631
|
-
ShaderMacro._getMacrosElements(macroCollection,
|
|
10632
|
-
|
|
10576
|
+
var shaderMacroList = new Array();
|
|
10577
|
+
ShaderMacro._getMacrosElements(macroCollection, shaderMacroList);
|
|
10578
|
+
shaderMacroList.push(ShaderMacro.getByName(isWebGL2 ? "GRAPHICS_API_WEBGL2" : "GRAPHICS_API_WEBGL1"));
|
|
10633
10579
|
if (engine._hardwareRenderer.canIUse(GLCapabilityType.shaderTextureLod)) {
|
|
10634
|
-
|
|
10580
|
+
shaderMacroList.push(ShaderMacro.getByName("HAS_TEX_LOD"));
|
|
10635
10581
|
}
|
|
10636
10582
|
if (engine._hardwareRenderer.canIUse(GLCapabilityType.standardDerivatives)) {
|
|
10637
|
-
|
|
10583
|
+
shaderMacroList.push(ShaderMacro.getByName("HAS_DERIVATIVES"));
|
|
10638
10584
|
}
|
|
10639
|
-
|
|
10640
|
-
|
|
10585
|
+
// Compatible with non-shaderlab syntax
|
|
10586
|
+
var noIncludeVertex = ShaderFactory.parseIncludes(this._vertexSource);
|
|
10587
|
+
var noIncludeFrag = ShaderFactory.parseIncludes(this._fragmentSource);
|
|
10588
|
+
// Parse macros when use shaderlab
|
|
10589
|
+
if (this._platformTarget != undefined) {
|
|
10590
|
+
noIncludeVertex = Shader._shaderLab._parseMacros(noIncludeVertex, shaderMacroList);
|
|
10591
|
+
noIncludeFrag = Shader._shaderLab._parseMacros(noIncludeFrag, shaderMacroList);
|
|
10641
10592
|
} else {
|
|
10642
|
-
|
|
10593
|
+
var macroNameStr = ShaderFactory.parseCustomMacros(shaderMacroList);
|
|
10594
|
+
noIncludeVertex = macroNameStr + noIncludeVertex;
|
|
10595
|
+
noIncludeFrag = macroNameStr + noIncludeFrag;
|
|
10643
10596
|
}
|
|
10644
|
-
|
|
10645
|
-
|
|
10646
|
-
|
|
10647
|
-
|
|
10648
|
-
return new ShaderProgram(engine, shaderProgramSource.vertex, shaderProgramSource.fragment);
|
|
10649
|
-
} else {
|
|
10650
|
-
return new ShaderProgram(engine, "", "");
|
|
10597
|
+
// Need to convert to 300 es when the target is GLSL ES 100 or unkdown
|
|
10598
|
+
if (isWebGL2 && (this._platformTarget == undefined || this._platformTarget === ShaderLanguage.GLSLES100)) {
|
|
10599
|
+
noIncludeVertex = ShaderFactory.convertTo300(noIncludeVertex);
|
|
10600
|
+
noIncludeFrag = ShaderFactory.convertTo300(noIncludeFrag, true);
|
|
10651
10601
|
}
|
|
10652
|
-
};
|
|
10653
|
-
// TODO: remove it after migrate all shader to `ShaderLab`.
|
|
10654
|
-
_proto._getCanonicalShaderProgram = function _getCanonicalShaderProgram(engine, macroCollection) {
|
|
10655
|
-
var isWebGL2 = engine._hardwareRenderer.isWebGL2;
|
|
10656
|
-
var macroNameList = new Array();
|
|
10657
|
-
ShaderMacro._getMacrosElements(macroCollection, macroNameList);
|
|
10658
|
-
var macroNameStr = ShaderFactory.parseCustomMacros(macroNameList);
|
|
10659
10602
|
var versionStr = isWebGL2 ? "#version 300 es" : "#version 100";
|
|
10660
|
-
var
|
|
10661
|
-
var
|
|
10662
|
-
if (engine._hardwareRenderer.canIUse(GLCapabilityType.shaderTextureLod)) {
|
|
10663
|
-
precisionStr += "#define HAS_TEX_LOD\n";
|
|
10664
|
-
}
|
|
10665
|
-
if (engine._hardwareRenderer.canIUse(GLCapabilityType.standardDerivatives)) {
|
|
10666
|
-
precisionStr += "#define HAS_DERIVATIVES\n";
|
|
10667
|
-
}
|
|
10668
|
-
var vertexSource = " " + versionStr + "\n " + graphicAPI + "\n " + macroNameStr + "\n " + ShaderFactory.parseIncludes(this._vertexSource);
|
|
10669
|
-
var fragmentSource = " " + versionStr + "\n " + graphicAPI + "\n " + (isWebGL2 ? "" : ShaderFactory._shaderExtension) + "\n " + precisionStr + "\n " + macroNameStr + "\n " + ShaderFactory.parseIncludes(this._fragmentSource);
|
|
10670
|
-
if (isWebGL2) {
|
|
10671
|
-
vertexSource = ShaderFactory.convertTo300(vertexSource);
|
|
10672
|
-
fragmentSource = ShaderFactory.convertTo300(fragmentSource, true);
|
|
10673
|
-
}
|
|
10603
|
+
var vertexSource = " " + versionStr + " \n " + noIncludeVertex + "\n ";
|
|
10604
|
+
var fragmentSource = " " + versionStr + "\n " + (isWebGL2 ? "" : ShaderFactory._shaderExtension) + "\n " + precisionStr + "\n " + noIncludeFrag + "\n ";
|
|
10674
10605
|
var shaderProgram = new ShaderProgram(engine, vertexSource, fragmentSource);
|
|
10675
10606
|
return shaderProgram;
|
|
10676
10607
|
};
|
|
@@ -11344,18 +11275,6 @@
|
|
|
11344
11275
|
}
|
|
11345
11276
|
var _proto = Shader.prototype;
|
|
11346
11277
|
/**
|
|
11347
|
-
* @internal
|
|
11348
|
-
* path should follow the specifications of [URL.origin](https://developer.mozilla.org/en-US/docs/Web/API/URL/origin), like: `shaders://root/`
|
|
11349
|
-
*/ _proto._registerPath = function _registerPath(path) {
|
|
11350
|
-
for(var _iterator = _create_for_of_iterator_helper_loose$1(this._subShaders), _step; !(_step = _iterator()).done;){
|
|
11351
|
-
var subShader = _step.value;
|
|
11352
|
-
for(var _iterator1 = _create_for_of_iterator_helper_loose$1(subShader.passes), _step1; !(_step1 = _iterator1()).done;){
|
|
11353
|
-
var shaderPass = _step1.value;
|
|
11354
|
-
shaderPass._path = path;
|
|
11355
|
-
}
|
|
11356
|
-
}
|
|
11357
|
-
};
|
|
11358
|
-
/**
|
|
11359
11278
|
* Compile shader variant by macro name list.
|
|
11360
11279
|
*
|
|
11361
11280
|
* @remarks
|
|
@@ -11411,74 +11330,82 @@
|
|
|
11411
11330
|
*/ _proto._addReferCount = function _addReferCount(value) {
|
|
11412
11331
|
this._refCount += value;
|
|
11413
11332
|
};
|
|
11414
|
-
Shader.create = function create(nameOrShaderSource,
|
|
11333
|
+
Shader.create = function create(nameOrShaderSource, vertexSourceOrShaderPassesOrSubShadersOrPlatformTarget, fragmentSourceOrPath) {
|
|
11415
11334
|
var shader;
|
|
11416
11335
|
var shaderMap = Shader._shaderMap;
|
|
11417
|
-
if (
|
|
11418
|
-
|
|
11336
|
+
if (vertexSourceOrShaderPassesOrSubShadersOrPlatformTarget == undefined) {
|
|
11337
|
+
vertexSourceOrShaderPassesOrSubShadersOrPlatformTarget = ShaderLanguage.GLSLES100;
|
|
11338
|
+
}
|
|
11339
|
+
if (typeof vertexSourceOrShaderPassesOrSubShadersOrPlatformTarget === "number") {
|
|
11340
|
+
var shaderLab = Shader._shaderLab;
|
|
11341
|
+
if (!shaderLab) {
|
|
11419
11342
|
throw "ShaderLab has not been set up yet.";
|
|
11420
11343
|
}
|
|
11421
|
-
var
|
|
11422
|
-
if (shaderMap[
|
|
11423
|
-
console.error('Shader named "' +
|
|
11344
|
+
var shaderSource = shaderLab._parseShaderSource(nameOrShaderSource);
|
|
11345
|
+
if (shaderMap[shaderSource.name]) {
|
|
11346
|
+
console.error('Shader named "' + shaderSource.name + '" already exists.');
|
|
11424
11347
|
return;
|
|
11425
11348
|
}
|
|
11426
|
-
var subShaderList =
|
|
11427
|
-
var passList =
|
|
11428
|
-
if (
|
|
11349
|
+
var subShaderList = shaderSource.subShaders.map(function(subShaderSource) {
|
|
11350
|
+
var passList = subShaderSource.passes.map(function(passSource) {
|
|
11351
|
+
if (passSource.isUsePass) {
|
|
11429
11352
|
var _Shader_find_subShaders_find, _Shader_find;
|
|
11430
|
-
|
|
11431
|
-
|
|
11432
|
-
|
|
11433
|
-
return subShader.name === paths[1];
|
|
11353
|
+
var _passSource_name_split = passSource.name.split("/"), shaderName = _passSource_name_split[0], subShaderName = _passSource_name_split[1], passName = _passSource_name_split[2];
|
|
11354
|
+
return (_Shader_find = Shader.find(shaderName)) == null ? void 0 : (_Shader_find_subShaders_find = _Shader_find.subShaders.find(function(subShader) {
|
|
11355
|
+
return subShader.name === subShaderName;
|
|
11434
11356
|
})) == null ? void 0 : _Shader_find_subShaders_find.passes.find(function(pass) {
|
|
11435
|
-
return pass.name ===
|
|
11357
|
+
return pass.name === passName;
|
|
11436
11358
|
});
|
|
11437
11359
|
}
|
|
11438
|
-
var
|
|
11439
|
-
|
|
11360
|
+
var shaderPassSource = Shader._shaderLab._parseShaderPass(passSource.contents, passSource.vertexEntry, passSource.fragmentEntry, vertexSourceOrShaderPassesOrSubShadersOrPlatformTarget, new URL(fragmentSourceOrPath != null ? fragmentSourceOrPath : "", ShaderPass._shaderRootPath).href);
|
|
11361
|
+
if (!shaderPassSource) {
|
|
11362
|
+
throw 'Shader pass "' + shaderSource.name + "." + subShaderSource.name + "." + passSource.name + '" parse failed, please check the shader source code.';
|
|
11363
|
+
}
|
|
11364
|
+
var shaderPass = new ShaderPass(passSource.name, shaderPassSource.vertex, shaderPassSource.fragment, passSource.tags);
|
|
11365
|
+
shaderPass._platformTarget = vertexSourceOrShaderPassesOrSubShadersOrPlatformTarget;
|
|
11366
|
+
var _passSource_renderStates = passSource.renderStates, constantMap = _passSource_renderStates.constantMap, variableMap = _passSource_renderStates.variableMap;
|
|
11440
11367
|
// Compatible shader lab no render state use material `renderState` to modify render state
|
|
11441
11368
|
if (Object.keys(constantMap).length > 0 || Object.keys(variableMap).length > 0) {
|
|
11442
11369
|
// Parse const render state
|
|
11443
11370
|
var renderState = new RenderState();
|
|
11444
|
-
shaderPassContent._renderState = renderState;
|
|
11445
11371
|
for(var k in constantMap){
|
|
11446
|
-
Shader._applyConstRenderStates(renderState,
|
|
11372
|
+
Shader._applyConstRenderStates(renderState, +k, constantMap[k]);
|
|
11447
11373
|
}
|
|
11374
|
+
shaderPass._renderState = renderState;
|
|
11448
11375
|
// Parse variable render state
|
|
11449
11376
|
var renderStateDataMap = {};
|
|
11450
11377
|
for(var k1 in variableMap){
|
|
11451
11378
|
renderStateDataMap[k1] = ShaderProperty.getByName(variableMap[k1]);
|
|
11452
11379
|
}
|
|
11453
|
-
|
|
11380
|
+
shaderPass._renderStateDataMap = renderStateDataMap;
|
|
11454
11381
|
}
|
|
11455
|
-
return
|
|
11382
|
+
return shaderPass;
|
|
11456
11383
|
});
|
|
11457
|
-
return new SubShader(
|
|
11384
|
+
return new SubShader(subShaderSource.name, passList, subShaderSource.tags);
|
|
11458
11385
|
});
|
|
11459
|
-
shader = new Shader(
|
|
11460
|
-
shaderMap[
|
|
11386
|
+
shader = new Shader(shaderSource.name, subShaderList);
|
|
11387
|
+
shaderMap[shaderSource.name] = shader;
|
|
11461
11388
|
return shader;
|
|
11462
11389
|
} else {
|
|
11463
11390
|
if (shaderMap[nameOrShaderSource]) {
|
|
11464
11391
|
console.error('Shader named "' + nameOrShaderSource + '" already exists.');
|
|
11465
11392
|
return;
|
|
11466
11393
|
}
|
|
11467
|
-
if (typeof
|
|
11468
|
-
var shaderPass = new ShaderPass(
|
|
11394
|
+
if (typeof vertexSourceOrShaderPassesOrSubShadersOrPlatformTarget === "string") {
|
|
11395
|
+
var shaderPass = new ShaderPass(vertexSourceOrShaderPassesOrSubShadersOrPlatformTarget, fragmentSourceOrPath);
|
|
11469
11396
|
shader = new Shader(nameOrShaderSource, [
|
|
11470
11397
|
new SubShader("Default", [
|
|
11471
11398
|
shaderPass
|
|
11472
11399
|
])
|
|
11473
11400
|
]);
|
|
11474
11401
|
} else {
|
|
11475
|
-
if (
|
|
11476
|
-
if (
|
|
11402
|
+
if (vertexSourceOrShaderPassesOrSubShadersOrPlatformTarget.length > 0) {
|
|
11403
|
+
if (vertexSourceOrShaderPassesOrSubShadersOrPlatformTarget[0].constructor === ShaderPass) {
|
|
11477
11404
|
shader = new Shader(nameOrShaderSource, [
|
|
11478
|
-
new SubShader("Default",
|
|
11405
|
+
new SubShader("Default", vertexSourceOrShaderPassesOrSubShadersOrPlatformTarget)
|
|
11479
11406
|
]);
|
|
11480
11407
|
} else {
|
|
11481
|
-
shader = new Shader(nameOrShaderSource,
|
|
11408
|
+
shader = new Shader(nameOrShaderSource, vertexSourceOrShaderPassesOrSubShadersOrPlatformTarget.slice());
|
|
11482
11409
|
}
|
|
11483
11410
|
} else {
|
|
11484
11411
|
throw "SubShader or ShaderPass count must large than 0.";
|
|
@@ -14384,6 +14311,7 @@
|
|
|
14384
14311
|
var shaderData = _this.shaderData;
|
|
14385
14312
|
shaderData.setFloat(BaseMaterial._alphaCutoffProp, 0);
|
|
14386
14313
|
shaderData.setFloat(BaseMaterial._shadowCasterRenderQueueProp, RenderQueueType.Opaque);
|
|
14314
|
+
shaderData.setFloat(BaseMaterial._depthOnlyRenderQueueProp, RenderQueueType.Opaque);
|
|
14387
14315
|
return _this;
|
|
14388
14316
|
}
|
|
14389
14317
|
var _proto = BaseMaterial.prototype;
|
|
@@ -14476,44 +14404,48 @@
|
|
|
14476
14404
|
};
|
|
14477
14405
|
_proto._seIsTransparent = function _seIsTransparent(value) {
|
|
14478
14406
|
if (value !== this._isTransparent) {
|
|
14407
|
+
// Forward pass
|
|
14479
14408
|
this.setIsTransparent(0, value);
|
|
14409
|
+
// Shadow caster pass and depth only pass
|
|
14480
14410
|
var shaderData = this.shaderData;
|
|
14481
14411
|
if (value) {
|
|
14482
|
-
//
|
|
14412
|
+
// Shadow caster render queue, use alpha test queue to simulate transparent shadow
|
|
14483
14413
|
shaderData.setFloat(BaseMaterial._shadowCasterRenderQueueProp, RenderQueueType.AlphaTest);
|
|
14414
|
+
// Depth only render queue
|
|
14415
|
+
shaderData.setFloat(BaseMaterial._depthOnlyRenderQueueProp, RenderQueueType.Transparent);
|
|
14484
14416
|
} else {
|
|
14485
14417
|
var alphaCutoff = shaderData.getFloat(BaseMaterial._alphaCutoffProp);
|
|
14486
|
-
|
|
14487
|
-
|
|
14488
|
-
|
|
14489
|
-
|
|
14490
|
-
|
|
14418
|
+
var renderQueueType = alphaCutoff ? RenderQueueType.AlphaTest : RenderQueueType.Opaque;
|
|
14419
|
+
// Shadow caster render queue
|
|
14420
|
+
shaderData.setFloat(BaseMaterial._shadowCasterRenderQueueProp, renderQueueType);
|
|
14421
|
+
// Depth only render queue
|
|
14422
|
+
shaderData.setFloat(BaseMaterial._depthOnlyRenderQueueProp, renderQueueType);
|
|
14491
14423
|
}
|
|
14492
14424
|
this._isTransparent = value;
|
|
14493
14425
|
}
|
|
14494
14426
|
};
|
|
14495
14427
|
_proto._setAlphaCutoff = function _setAlphaCutoff(value) {
|
|
14496
|
-
var shaderData =
|
|
14428
|
+
var _this = this, shaderData = _this.shaderData, isTransparent = _this._isTransparent;
|
|
14497
14429
|
if (shaderData.getFloat(BaseMaterial._alphaCutoffProp) !== value) {
|
|
14498
14430
|
if (value) {
|
|
14499
14431
|
shaderData.enableMacro(BaseMaterial._alphaCutoffMacro);
|
|
14432
|
+
// Forward render queue
|
|
14433
|
+
var forwardQueue = isTransparent ? RenderQueueType.Transparent : RenderQueueType.AlphaTest;
|
|
14434
|
+
this.renderStates[0].renderQueueType = forwardQueue;
|
|
14435
|
+
// Shadow caster render queue
|
|
14500
14436
|
shaderData.setFloat(BaseMaterial._shadowCasterRenderQueueProp, RenderQueueType.AlphaTest);
|
|
14437
|
+
// Depth only render queue
|
|
14438
|
+
shaderData.setFloat(BaseMaterial._depthOnlyRenderQueueProp, forwardQueue);
|
|
14501
14439
|
} else {
|
|
14502
14440
|
shaderData.disableMacro(BaseMaterial._alphaCutoffMacro);
|
|
14503
|
-
|
|
14504
|
-
|
|
14505
|
-
|
|
14506
|
-
|
|
14507
|
-
|
|
14508
|
-
|
|
14509
|
-
|
|
14510
|
-
|
|
14511
|
-
var renderState = renderStates[i];
|
|
14512
|
-
if (value > 0) {
|
|
14513
|
-
renderState.renderQueueType = renderState.blendState.targetBlendState.enabled ? RenderQueueType.Transparent : RenderQueueType.AlphaTest;
|
|
14514
|
-
} else {
|
|
14515
|
-
renderState.renderQueueType = renderState.blendState.targetBlendState.enabled ? RenderQueueType.Transparent : RenderQueueType.Opaque;
|
|
14516
|
-
}
|
|
14441
|
+
// Forward render queue
|
|
14442
|
+
var forwardQueue1 = isTransparent ? RenderQueueType.Transparent : RenderQueueType.Opaque;
|
|
14443
|
+
this.renderStates[0].renderQueueType = forwardQueue1;
|
|
14444
|
+
// Shadow caster render queue
|
|
14445
|
+
var shadowCasterQueue = isTransparent ? RenderQueueType.AlphaTest : RenderQueueType.Opaque;
|
|
14446
|
+
shaderData.setFloat(BaseMaterial._shadowCasterRenderQueueProp, shadowCasterQueue);
|
|
14447
|
+
// Depth only render queue
|
|
14448
|
+
shaderData.setFloat(BaseMaterial._depthOnlyRenderQueueProp, forwardQueue1);
|
|
14517
14449
|
}
|
|
14518
14450
|
shaderData.setFloat(BaseMaterial._alphaCutoffProp, value);
|
|
14519
14451
|
}
|
|
@@ -14609,6 +14541,7 @@
|
|
|
14609
14541
|
return BaseMaterial;
|
|
14610
14542
|
}(Material);
|
|
14611
14543
|
/** @internal */ BaseMaterial._shadowCasterRenderQueueProp = ShaderProperty.getByName("material_ShadowCasterRenderQueue");
|
|
14544
|
+
/** @internal */ BaseMaterial._depthOnlyRenderQueueProp = ShaderProperty.getByName("material_DepthOnlyRenderQueue");
|
|
14612
14545
|
BaseMaterial._baseTextureMacro = ShaderMacro.getByName("MATERIAL_HAS_BASETEXTURE");
|
|
14613
14546
|
BaseMaterial._normalTextureMacro = ShaderMacro.getByName("MATERIAL_HAS_NORMALTEXTURE");
|
|
14614
14547
|
BaseMaterial._emissiveTextureMacro = ShaderMacro.getByName("MATERIAL_HAS_EMISSIVETEXTURE");
|
|
@@ -17510,65 +17443,91 @@
|
|
|
17510
17443
|
}
|
|
17511
17444
|
return result;
|
|
17512
17445
|
};
|
|
17513
|
-
|
|
17514
|
-
|
|
17515
|
-
|
|
17516
|
-
|
|
17517
|
-
|
|
17518
|
-
|
|
17519
|
-
|
|
17520
|
-
|
|
17521
|
-
|
|
17522
|
-
|
|
17523
|
-
|
|
17524
|
-
if (
|
|
17525
|
-
|
|
17526
|
-
if (
|
|
17446
|
+
_proto.boxCast = function boxCast(center, halfExtents, direction, orientationOrDistanceOrResult, distanceOrResult, layerMaskOrResult, outHitResult) {
|
|
17447
|
+
var hitResult;
|
|
17448
|
+
var orientation = PhysicsScene._identityQuaternion;
|
|
17449
|
+
var distance = Number.MAX_VALUE;
|
|
17450
|
+
var layerMask = Layer.Everything;
|
|
17451
|
+
// Parse parameters based on new overload patterns
|
|
17452
|
+
if (typeof orientationOrDistanceOrResult === "number") {
|
|
17453
|
+
distance = orientationOrDistanceOrResult;
|
|
17454
|
+
if ((distanceOrResult == null ? void 0 : distanceOrResult.constructor) === HitResult) {
|
|
17455
|
+
hitResult = distanceOrResult;
|
|
17456
|
+
}
|
|
17457
|
+
} else if ((orientationOrDistanceOrResult == null ? void 0 : orientationOrDistanceOrResult.constructor) === HitResult) {
|
|
17458
|
+
hitResult = orientationOrDistanceOrResult;
|
|
17459
|
+
} else if ((orientationOrDistanceOrResult == null ? void 0 : orientationOrDistanceOrResult.constructor) === Quaternion) {
|
|
17460
|
+
orientation = orientationOrDistanceOrResult;
|
|
17461
|
+
if (typeof distanceOrResult === "number") {
|
|
17462
|
+
distance = distanceOrResult;
|
|
17463
|
+
if (typeof layerMaskOrResult === "number") {
|
|
17464
|
+
layerMask = layerMaskOrResult;
|
|
17465
|
+
}
|
|
17466
|
+
}
|
|
17467
|
+
}
|
|
17468
|
+
if (outHitResult) {
|
|
17469
|
+
hitResult = outHitResult;
|
|
17470
|
+
}
|
|
17527
17471
|
var preFilter = this._createPreFilter(layerMask);
|
|
17528
|
-
var result = this._nativePhysicsScene.boxCast(center, orientation, halfExtents, direction, distance, preFilter,
|
|
17529
|
-
if (!result &&
|
|
17530
|
-
this._clearHitResult(
|
|
17472
|
+
var result = this._nativePhysicsScene.boxCast(center, orientation, halfExtents, direction, distance, preFilter, hitResult ? this._createHitCallback(hitResult) : undefined);
|
|
17473
|
+
if (!result && hitResult) {
|
|
17474
|
+
this._clearHitResult(hitResult);
|
|
17531
17475
|
}
|
|
17532
17476
|
return result;
|
|
17533
17477
|
};
|
|
17534
|
-
|
|
17535
|
-
|
|
17536
|
-
|
|
17537
|
-
|
|
17538
|
-
|
|
17539
|
-
|
|
17540
|
-
|
|
17541
|
-
|
|
17542
|
-
|
|
17543
|
-
|
|
17544
|
-
|
|
17545
|
-
|
|
17478
|
+
_proto.sphereCast = function sphereCast(center, radius, direction, distanceOrResult, layerMaskOrResult, outHitResult) {
|
|
17479
|
+
var hitResult;
|
|
17480
|
+
var distance = Number.MAX_VALUE;
|
|
17481
|
+
var layerMask = Layer.Everything;
|
|
17482
|
+
// Parse parameters based on new overload patterns
|
|
17483
|
+
if (typeof distanceOrResult === "number") {
|
|
17484
|
+
distance = distanceOrResult;
|
|
17485
|
+
if ((layerMaskOrResult == null ? void 0 : layerMaskOrResult.constructor) === HitResult) {
|
|
17486
|
+
hitResult = layerMaskOrResult;
|
|
17487
|
+
} else if (typeof layerMaskOrResult === "number") {
|
|
17488
|
+
layerMask = layerMaskOrResult;
|
|
17489
|
+
}
|
|
17490
|
+
} else if ((distanceOrResult == null ? void 0 : distanceOrResult.constructor) === HitResult) {
|
|
17491
|
+
hitResult = distanceOrResult;
|
|
17492
|
+
}
|
|
17493
|
+
if (outHitResult) {
|
|
17494
|
+
hitResult = outHitResult;
|
|
17495
|
+
}
|
|
17546
17496
|
var preFilter = this._createPreFilter(layerMask);
|
|
17547
|
-
var result = this._nativePhysicsScene.sphereCast(center, radius, direction, distance, preFilter,
|
|
17548
|
-
if (!result &&
|
|
17549
|
-
this._clearHitResult(
|
|
17497
|
+
var result = this._nativePhysicsScene.sphereCast(center, radius, direction, distance, preFilter, hitResult ? this._createHitCallback(hitResult) : undefined);
|
|
17498
|
+
if (!result && hitResult) {
|
|
17499
|
+
this._clearHitResult(hitResult);
|
|
17550
17500
|
}
|
|
17551
17501
|
return result;
|
|
17552
17502
|
};
|
|
17553
|
-
|
|
17554
|
-
|
|
17555
|
-
|
|
17556
|
-
|
|
17557
|
-
|
|
17558
|
-
|
|
17559
|
-
|
|
17560
|
-
|
|
17561
|
-
|
|
17562
|
-
|
|
17563
|
-
|
|
17564
|
-
|
|
17565
|
-
if (
|
|
17566
|
-
|
|
17567
|
-
|
|
17503
|
+
_proto.capsuleCast = function capsuleCast(center, radius, height, direction, orientationOrDistanceOrResult, distanceOrResult, layerMaskOrResult, outHitResult) {
|
|
17504
|
+
var hitResult;
|
|
17505
|
+
var orientation = PhysicsScene._identityQuaternion;
|
|
17506
|
+
var distance = Number.MAX_VALUE;
|
|
17507
|
+
var layerMask = Layer.Everything;
|
|
17508
|
+
if (typeof orientationOrDistanceOrResult === "number") {
|
|
17509
|
+
distance = orientationOrDistanceOrResult;
|
|
17510
|
+
if ((distanceOrResult == null ? void 0 : distanceOrResult.constructor) === HitResult) {
|
|
17511
|
+
hitResult = distanceOrResult;
|
|
17512
|
+
}
|
|
17513
|
+
} else if ((orientationOrDistanceOrResult == null ? void 0 : orientationOrDistanceOrResult.constructor) === HitResult) {
|
|
17514
|
+
hitResult = orientationOrDistanceOrResult;
|
|
17515
|
+
} else if ((orientationOrDistanceOrResult == null ? void 0 : orientationOrDistanceOrResult.constructor) === Quaternion) {
|
|
17516
|
+
orientation = orientationOrDistanceOrResult;
|
|
17517
|
+
if (typeof distanceOrResult === "number") {
|
|
17518
|
+
distance = distanceOrResult;
|
|
17519
|
+
if (typeof layerMaskOrResult === "number") {
|
|
17520
|
+
layerMask = layerMaskOrResult;
|
|
17521
|
+
}
|
|
17522
|
+
}
|
|
17523
|
+
}
|
|
17524
|
+
if (outHitResult) {
|
|
17525
|
+
hitResult = outHitResult;
|
|
17526
|
+
}
|
|
17568
17527
|
var preFilter = this._createPreFilter(layerMask);
|
|
17569
|
-
var result = this._nativePhysicsScene.capsuleCast(center, radius, height, orientation, direction, distance, preFilter,
|
|
17570
|
-
if (!result &&
|
|
17571
|
-
this._clearHitResult(
|
|
17528
|
+
var result = this._nativePhysicsScene.capsuleCast(center, radius, height, orientation, direction, distance, preFilter, hitResult ? this._createHitCallback(hitResult) : undefined);
|
|
17529
|
+
if (!result && hitResult) {
|
|
17530
|
+
this._clearHitResult(hitResult);
|
|
17572
17531
|
}
|
|
17573
17532
|
return result;
|
|
17574
17533
|
};
|
|
@@ -30546,8 +30505,8 @@
|
|
|
30546
30505
|
ParticleBufferUtils.boundsFloatStride = 8;
|
|
30547
30506
|
ParticleBufferUtils.boundsTimeOffset = 6;
|
|
30548
30507
|
ParticleBufferUtils.boundsMaxLifetimeOffset = 7;
|
|
30549
|
-
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
|
|
30550
|
-
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
|
|
30508
|
+
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
|
|
30509
|
+
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
|
|
30551
30510
|
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
|
|
30552
30511
|
var skyProceduralVs = "// 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#define OUTER_RADIUS 1.025\n#define RAYLEIGH (mix(0.0, 0.0025, pow(material_AtmosphereThickness,2.5)))\t// Rayleigh constant\n#define MIE 0.0010\t// Mie constant\n#define SUN_BRIGHTNESS 20.0\t// Sun brightness\n#define MAX_SCATTER 50.0 // Maximum scattering value, to prevent math overflows on Adrenos\n\nconst float SKY_GROUND_THRESHOLD = 0.02;\nconst float outerRadius = OUTER_RADIUS;\nconst float outerRadius2 = OUTER_RADIUS*OUTER_RADIUS;\nconst float innerRadius = 1.0;\nconst float innerRadius2 = 1.0;\nconst float cameraHeight = 0.0001;\n\nconst float HDSundiskIntensityFactor = 15.0;\nconst float simpleSundiskIntensityFactor = 27.0;\n\nconst float sunScale = 400.0 * SUN_BRIGHTNESS;\nconst float kmESun = MIE * SUN_BRIGHTNESS;\nconst float km4PI = MIE * 4.0 * 3.14159265;\nconst float scale = 1.0 / (OUTER_RADIUS - 1.0);\nconst float scaleDepth = 0.25;\nconst float scaleOverScaleDepth = (1.0 / (OUTER_RADIUS - 1.0)) / 0.25;\nconst float samples = 2.0; // THIS IS UNROLLED MANUALLY, DON'T TOUCH\n\n// RGB wavelengths .35 (.62=158), .43 (.68=174), .525 (.75=190)\nconst vec3 c_DefaultScatteringWavelength = vec3(0.65, 0.57, 0.475);\nconst vec3 c_VariableRangeForScatteringWavelength = vec3(0.15, 0.15, 0.15);\n\nattribute vec4 POSITION;\n\nuniform mat4 camera_VPMat;\nuniform vec3 material_SkyTint;\nuniform vec3 material_GroundTint;\nuniform float material_Exposure;\nuniform float material_AtmosphereThickness;\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#define GAMMA 2.2\n#define COLOR_2_GAMMA(color) pow(color,vec3(1.0/GAMMA))\n#define COLOR_2_LINEAR(color) color\n\n// Calculates the Rayleigh phase function\nfloat getRayleighPhase(vec3 light, vec3 ray) \n{\n\tfloat eyeCos = dot(light, ray);\n\treturn 0.75 + 0.75 * eyeCos * eyeCos;\n}\n\nfloat scaleAngle(float inCos)\n{\n\tfloat x = 1.0 - inCos;\n\treturn 0.25 * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25))));\n}\n\nvoid main () {\n\tgl_Position = camera_VPMat*vec4(POSITION.xyz,1.0);\n\n \tvec3 skyTintInGammaSpace = COLOR_2_GAMMA(material_SkyTint);\n\tvec3 scatteringWavelength = mix(c_DefaultScatteringWavelength-c_VariableRangeForScatteringWavelength,c_DefaultScatteringWavelength+c_VariableRangeForScatteringWavelength,vec3(1.0) - skyTintInGammaSpace); // using Tint in sRGB+ gamma allows for more visually linear interpolation and to keep (0.5) at (128, gray in sRGB) point\n\tvec3 invWavelength = 1.0 / pow(scatteringWavelength, vec3(4.0));\n\n\tfloat krESun = RAYLEIGH * SUN_BRIGHTNESS;\n\tfloat kr4PI = RAYLEIGH * 4.0 * 3.14159265;\n\n\tvec3 cameraPos = vec3(0.0,innerRadius + cameraHeight,0.0); // The camera's current position\n\n\t// Get the ray from the camera to the vertex and its length (which is the far point of the ray passing through the atmosphere)\n\tvec3 eyeRay = normalize(POSITION.xyz);\n\n\tfloat far = 0.0;\n\tvec3 cIn, cOut;\n\tif (eyeRay.y >= 0.0) {\n\t\t// Sky \n\t\t// Calculate the length of the \"atmosphere\"\n\t\tfar = sqrt(outerRadius2 + innerRadius2 * eyeRay.y * eyeRay.y - innerRadius2) - innerRadius * eyeRay.y;\n\n\t\t// Calculate the ray's starting position, then calculate its scattering offset\n\t\tfloat height = innerRadius + cameraHeight;\n\t\tfloat depth = exp(scaleOverScaleDepth * -cameraHeight);\n\t\tfloat startAngle = dot(eyeRay, cameraPos) / height;\n\t\tfloat startOffset = depth*scaleAngle(startAngle);\n\n\t\t// Initialize the scattering loop variables\n\t\tfloat sampleLength = far / samples;\n\t\tfloat scaledLength = sampleLength * scale;\n\t\tvec3 sampleRay = eyeRay * sampleLength;\n\t\tvec3 samplePoint = cameraPos + sampleRay * 0.5;\n\n\t\tvec3 frontColor = vec3(0.0);\n\t\t//unrolling this manually to avoid some platform for loop slow\n\t\t{\n\t\t\tfloat height = length(samplePoint);\n\t\t\tfloat depth = exp(scaleOverScaleDepth * (innerRadius - height));\n\t\t\tfloat lightAngle = dot(-scene_SunlightDirection, samplePoint) / height;\n\t\t\tfloat cameraAngle = dot(eyeRay, samplePoint) / height;\n\t\t\tfloat scatter = (startOffset + depth*(scaleAngle(lightAngle) - scaleAngle(cameraAngle)));\n\t\t\tvec3 attenuate = exp(-clamp(scatter, 0.0, MAX_SCATTER) * (invWavelength * kr4PI + km4PI));\n\n\t\t\tfrontColor += attenuate * (depth * scaledLength);\n\t\t\tsamplePoint += sampleRay;\n\t\t}\n\t\t{\n\t\t\tfloat height = length(samplePoint);\n\t\t\tfloat depth = exp(scaleOverScaleDepth * (innerRadius - height));\n\t\t\tfloat lightAngle = dot(-scene_SunlightDirection, samplePoint) / height;\n\t\t\tfloat cameraAngle = dot(eyeRay, samplePoint) / height;\n\t\t\tfloat scatter = (startOffset + depth*(scaleAngle(lightAngle) - scaleAngle(cameraAngle)));\n\t\t\tvec3 attenuate = exp(-clamp(scatter, 0.0, MAX_SCATTER) * (invWavelength * kr4PI + km4PI));\n\n\t\t\tfrontColor += attenuate * (depth * scaledLength);\n\t\t\tsamplePoint += sampleRay;\n\t\t}\n\n\t\t// Finally, scale the Mie and Rayleigh colors and set up the varying variables for the pixel shader\n\t\tcIn = frontColor * (invWavelength * krESun);\n\t\tcOut = frontColor * kmESun;\n\t} else {\n\t\t// Ground\n\t\tfar = (-cameraHeight) / (min(-0.001, eyeRay.y));\n\t\tvec3 pos = cameraPos + far * eyeRay;\n\n\t\t// Calculate the ray's starting position, then calculate its scattering offset\n\t\tfloat depth = exp((-cameraHeight) * (1.0/scaleDepth));\n\t\tfloat cameraAngle = dot(-eyeRay, pos);\n\t\tfloat lightAngle = dot(-scene_SunlightDirection, pos);\n\t\tfloat cameraScale = scaleAngle(cameraAngle);\n\t\tfloat lightScale = scaleAngle(lightAngle);\n\t\tfloat cameraOffset = depth*cameraScale;\n\t\tfloat temp = lightScale + cameraScale;\n\n\t\t// Initialize the scattering loop variables\n\t\tfloat sampleLength = far / samples;\n\t\tfloat scaledLength = sampleLength * scale;\n\t\tvec3 sampleRay = eyeRay * sampleLength;\n\t\tvec3 samplePoint = cameraPos + sampleRay * 0.5;\n\n\t\t// Now loop through the sample rays\n\t\tvec3 frontColor = vec3(0.0, 0.0, 0.0);\n\t\tvec3 attenuate;\n\n\t\t// Loop removed because we kept hitting SM2.0 temp variable limits. Doesn't affect the image too much\n\t\t{\n\t\t\tfloat height = length(samplePoint);\n\t\t\tfloat depth = exp(scaleOverScaleDepth * (innerRadius - height));\n\t\t\tfloat scatter = depth*temp - cameraOffset;\n\t\t\tattenuate = exp(-clamp(scatter, 0.0, MAX_SCATTER) * (invWavelength * kr4PI + km4PI));\n\t\t\tfrontColor += attenuate * (depth * scaledLength);\n\t\t\tsamplePoint += sampleRay;\n\t\t}\n\n\t\tcIn = frontColor * (invWavelength * krESun + kmESun);\n\t\tcOut = clamp(attenuate, 0.0, 1.0);\n\t}\n\n\t#ifdef MATERIAL_SUN_HIGH_QUALITY\n\t\tv_Vertex = -POSITION.xyz;\n\t#elif defined(MATERIAL_SUN_SIMPLE) \n\t\tv_RayDir = -eyeRay;\n\t#else\n\t\tv_SkyGroundFactor = -eyeRay.y / SKY_GROUND_THRESHOLD;\n\t#endif\n\n\t// if we want to calculate color in vprog:\n\t// 1. in case of linear: multiply by _Exposure in here (even in case of lerp it will be common multiplier, so we can skip mul in fshader)\n\t// 2. in case of gamma: do sqrt right away instead of doing that in fshader\n\t\n\tv_GroundColor = material_Exposure * (cIn + COLOR_2_LINEAR(material_GroundTint) * cOut);\n\tv_SkyColor = material_Exposure * (cIn * getRayleighPhase(-scene_SunlightDirection, -eyeRay));\n\n\t\n\t// The sun should have a stable intensity in its course in the sky. Moreover it should match the highlight of a purely specular material.\n\t// This matching was done using the standard shader BRDF1 on the 5/31/2017\n\t// Finally we want the sun to be always bright even in LDR thus the normalization of the lightColor for low intensity.\n\tfloat lightColorIntensity = clamp(length(scene_SunlightColor.xyz), 0.25, 1.0);\n\n\t#ifdef MATERIAL_SUN_HIGH_QUALITY \n\t\tv_SunColor = HDSundiskIntensityFactor * clamp(cOut,0.0,1.0) * scene_SunlightColor.xyz / lightColorIntensity;\n\t#elif defined(MATERIAL_SUN_SIMPLE) \n\t\tv_SunColor = simpleSundiskIntensityFactor * clamp(cOut * sunScale,0.0,1.0) * scene_SunlightColor.xyz / lightColorIntensity;\n\t#endif\n}\n"; // eslint-disable-line
|
|
30553
30512
|
var backgroundTextureFs = "#include <common>\nuniform sampler2D material_BaseTexture;\n\nvarying vec2 v_uv;\n\nvoid main() {\n gl_FragColor = texture2DSRGB(material_BaseTexture, v_uv);\n}"; // eslint-disable-line
|
|
@@ -30587,6 +30546,8 @@
|
|
|
30587
30546
|
var depthOnlyPass = new ShaderPass("DepthOnly", depthOnlyVs, depthOnlyFs, {
|
|
30588
30547
|
pipelineStage: PipelineStage.DepthOnly
|
|
30589
30548
|
});
|
|
30549
|
+
depthOnlyPass._renderState = new RenderState();
|
|
30550
|
+
depthOnlyPass._renderStateDataMap[RenderStateElementKey.RenderQueueType] = BaseMaterial._depthOnlyRenderQueueProp;
|
|
30590
30551
|
var basePasses = [
|
|
30591
30552
|
shadowCasterPass,
|
|
30592
30553
|
depthOnlyPass
|
|
@@ -32973,6 +32934,38 @@
|
|
|
32973
32934
|
Scene._fogColorProperty = ShaderProperty.getByName("scene_FogColor");
|
|
32974
32935
|
Scene._fogParamsProperty = ShaderProperty.getByName("scene_FogParams");
|
|
32975
32936
|
Scene._prefilterdDFGProperty = ShaderProperty.getByName("scene_PrefilteredDFG");
|
|
32937
|
+
function _array_like_to_array$1(arr, len) {
|
|
32938
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
32939
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
32940
|
+
return arr2;
|
|
32941
|
+
}
|
|
32942
|
+
function _unsupported_iterable_to_array$1(o, minLen) {
|
|
32943
|
+
if (!o) return;
|
|
32944
|
+
if (typeof o === "string") return _array_like_to_array$1(o, minLen);
|
|
32945
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
32946
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
32947
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
32948
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
|
|
32949
|
+
}
|
|
32950
|
+
function _create_for_of_iterator_helper_loose$1(o, allowArrayLike) {
|
|
32951
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
32952
|
+
if (it) return (it = it.call(o)).next.bind(it);
|
|
32953
|
+
// Fallback for engines without symbol support
|
|
32954
|
+
if (Array.isArray(o) || (it = _unsupported_iterable_to_array$1(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
32955
|
+
if (it) o = it;
|
|
32956
|
+
var i = 0;
|
|
32957
|
+
return function() {
|
|
32958
|
+
if (i >= o.length) return {
|
|
32959
|
+
done: true
|
|
32960
|
+
};
|
|
32961
|
+
return {
|
|
32962
|
+
done: false,
|
|
32963
|
+
value: o[i++]
|
|
32964
|
+
};
|
|
32965
|
+
};
|
|
32966
|
+
}
|
|
32967
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
32968
|
+
}
|
|
32976
32969
|
/**
|
|
32977
32970
|
* Script class, used for logic writing.
|
|
32978
32971
|
*/ var Script = /*#__PURE__*/ function(Component) {
|
|
@@ -42048,7 +42041,7 @@
|
|
|
42048
42041
|
RenderQueueFlags: RenderQueueFlags,
|
|
42049
42042
|
RenderQueueType: RenderQueueType,
|
|
42050
42043
|
RenderState: RenderState,
|
|
42051
|
-
|
|
42044
|
+
RenderStateElementKey: RenderStateElementKey,
|
|
42052
42045
|
RenderTarget: RenderTarget,
|
|
42053
42046
|
RenderTargetBlendState: RenderTargetBlendState,
|
|
42054
42047
|
get Renderer () { return exports.Renderer; },
|
|
@@ -42066,11 +42059,11 @@
|
|
|
42066
42059
|
ShaderData: ShaderData,
|
|
42067
42060
|
ShaderDataGroup: ShaderDataGroup,
|
|
42068
42061
|
ShaderFactory: ShaderFactory,
|
|
42062
|
+
ShaderLanguage: ShaderLanguage,
|
|
42069
42063
|
ShaderLib: ShaderLib,
|
|
42070
42064
|
ShaderMacro: ShaderMacro,
|
|
42071
42065
|
ShaderMacroCollection: ShaderMacroCollection,
|
|
42072
42066
|
ShaderPass: ShaderPass,
|
|
42073
|
-
ShaderPlatformTarget: ShaderPlatformTarget,
|
|
42074
42067
|
ShaderProperty: ShaderProperty,
|
|
42075
42068
|
ShaderPropertyType: ShaderPropertyType,
|
|
42076
42069
|
ShaderTagKey: ShaderTagKey,
|
|
@@ -50899,9 +50892,7 @@
|
|
|
50899
50892
|
return Shader.find(builtinShader);
|
|
50900
50893
|
}
|
|
50901
50894
|
return ShaderChunkLoader._loadChunksInCode(code, url, resourceManager).then(function() {
|
|
50902
|
-
var shader = Shader.create(code);
|
|
50903
|
-
// @ts-ignore
|
|
50904
|
-
shader._registerPath(url);
|
|
50895
|
+
var shader = Shader.create(code, undefined, url);
|
|
50905
50896
|
return shader;
|
|
50906
50897
|
});
|
|
50907
50898
|
});
|
|
@@ -51581,7 +51572,7 @@
|
|
|
51581
51572
|
], EXT_texture_webp);
|
|
51582
51573
|
|
|
51583
51574
|
//@ts-ignore
|
|
51584
|
-
var version = "1.6.0-
|
|
51575
|
+
var version = "1.6.0-beta.1";
|
|
51585
51576
|
console.log("Galacean Engine Version: " + version);
|
|
51586
51577
|
for(var key in CoreObjects){
|
|
51587
51578
|
Loader.registerClass(key, CoreObjects[key]);
|
|
@@ -51804,7 +51795,7 @@
|
|
|
51804
51795
|
exports.RenderQueueFlags = RenderQueueFlags;
|
|
51805
51796
|
exports.RenderQueueType = RenderQueueType;
|
|
51806
51797
|
exports.RenderState = RenderState;
|
|
51807
|
-
exports.
|
|
51798
|
+
exports.RenderStateElementKey = RenderStateElementKey;
|
|
51808
51799
|
exports.RenderTarget = RenderTarget;
|
|
51809
51800
|
exports.RenderTargetBlendState = RenderTargetBlendState;
|
|
51810
51801
|
exports.RendererUpdateFlags = RendererUpdateFlags;
|
|
@@ -51822,11 +51813,11 @@
|
|
|
51822
51813
|
exports.ShaderData = ShaderData;
|
|
51823
51814
|
exports.ShaderDataGroup = ShaderDataGroup;
|
|
51824
51815
|
exports.ShaderFactory = ShaderFactory;
|
|
51816
|
+
exports.ShaderLanguage = ShaderLanguage;
|
|
51825
51817
|
exports.ShaderLib = ShaderLib;
|
|
51826
51818
|
exports.ShaderMacro = ShaderMacro;
|
|
51827
51819
|
exports.ShaderMacroCollection = ShaderMacroCollection;
|
|
51828
51820
|
exports.ShaderPass = ShaderPass;
|
|
51829
|
-
exports.ShaderPlatformTarget = ShaderPlatformTarget;
|
|
51830
51821
|
exports.ShaderProperty = ShaderProperty;
|
|
51831
51822
|
exports.ShaderPropertyType = ShaderPropertyType;
|
|
51832
51823
|
exports.ShaderTagKey = ShaderTagKey;
|