@galacean/engine 2.0.0-alpha.5 → 2.0.0-alpha.7
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 +532 -576
- package/dist/browser.js.map +1 -1
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +1 -1
- package/dist/bundled.module.js +533 -577
- package/dist/bundled.module.js.map +1 -1
- package/dist/bundled.module.min.js +1 -1
- package/dist/bundled.module.min.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/module.js +1 -1
- package/package.json +5 -5
package/dist/bundled.module.js
CHANGED
|
@@ -9793,7 +9793,7 @@ function _extends$2() {
|
|
|
9793
9793
|
return PipelineStage;
|
|
9794
9794
|
}({});
|
|
9795
9795
|
var camera_declare = "uniform vec3 camera_Position;\nuniform vec3 camera_Forward; "; // eslint-disable-line
|
|
9796
|
-
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
|
|
9796
|
+
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 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
|
|
9797
9797
|
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
|
|
9798
9798
|
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
|
|
9799
9799
|
var color_share = "#ifdef RENDERER_ENABLE_VERTEXCOLOR\n\nvarying vec4 v_color;\n\n#endif\n"; // eslint-disable-line
|
|
@@ -9841,7 +9841,7 @@ var pbr_frag_define = "#define MIN_PERCEPTUAL_ROUGHNESS 0.045\n#define MIN_ROUGH
|
|
|
9841
9841
|
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 float alphaCutoff = material_AlphaCutoff;\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 // Specular\n material.specularIntensity = material_SpecularIntensity;\n material.specularColor = material_SpecularColor;\n #ifdef MATERIAL_HAS_SPECULAR_TEXTURE\n material.specularIntensity *= texture2D( material_SpecularIntensityTexture, v_uv ).a;\n #endif\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\n material.roughness = max(MIN_PERCEPTUAL_ROUGHNESS, min(roughness + getAARoughnessFactor(geometry.normal), 1.0));\n\n #ifdef MATERIAL_ENABLE_ANISOTROPY\n geometry.anisotropicN = getAnisotropicBentNormal(geometry, geometry.normal, material.roughness);\n #endif\n\n vec3 dielectricBaseF0 = vec3(pow2( (material.IOR - 1.0) / (material.IOR + 1.0) ));\n vec3 dielectricF0 = min(dielectricBaseF0 * material.specularColor , vec3(1.0)) * material.specularIntensity;\n float dielectricF90 = material.specularIntensity; \n\n material.specularF0 = mix(dielectricF0, baseColor.rgb, metal);\n material.specularF90 = mix(dielectricF90, 1.0, metal);\n material.resolvedSpecularF0 = material.specularF0;\n\n // Simplify: albedoColor * mix((1.0 - max(max(dielectricF0.r,dielectricF0.g),dielectricF0.b)), 0.0, metallic);\n material.diffuseColor = baseColor.rgb * (1.0 - metal) * (1.0 - max(max(dielectricF0.r,dielectricF0.g),dielectricF0.b));\n // Environment BRDF\n vec2 dfg = envDFGApprox(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.specularF0, material.specularF90, material.iridescenceThickness);\n material.resolvedSpecularF0 = mix(material.resolvedSpecularF0, material.iridescenceSpecularColor, material.iridescenceFactor);\n #endif\n #endif\n\n material.envSpecularDFG = material.resolvedSpecularF0 * dfg.x + material.specularF90 * dfg.y;\n\n // Multi-scattering energy compensation\n // Ref: Kulla & Conty 2017, \"Revisiting Physically Based Shading at Imageworks\"\n // Ref: Lagarde & Golubev 2018, simplified multiplier approach\n material.energyCompensation = 1.0 + material.resolvedSpecularF0 * (1.0 / max(dfg.x + dfg.y, EPSILON) - 1.0);\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"; // eslint-disable-line
|
|
9842
9842
|
var brdf = "\n#ifdef MATERIAL_ENABLE_SHEEN\n uniform sampler2D scene_PrefilteredDFG;\n#endif\n\nfloat F_Schlick(float f0, float f90, float dotLH) {\n\treturn f0 + (f90 - f0) * (pow(1.0 - dotLH, 5.0));\n}\n\nvec3 F_Schlick(vec3 f0, float f90, 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 (f90 - f0 ) * fresnel + f0;\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 baseF90, 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, baseF90, 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, baseF90, 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, material.specularF90, 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
|
|
9843
9843
|
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(0.04, 1.0, 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.specularF0, material.roughness) * material.energyCompensation;\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
|
|
9844
|
-
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// Returns raw DFG approximation coefficients (split-sum LUT approximation)\nvec2 envDFGApprox(float roughness, float dotNV) {\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n return vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\n\n// ref: https://www.unrealengine.com/blog/physically-based-shading-on-mobile - environmentBRDF for GGX on mobile\nvec3 envBRDFApprox(vec3 f0, float f90, float roughness, float dotNV ) {\n vec2 AB = envDFGApprox(roughness, dotNV);\n return f0 * AB.x + f90 * 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
|
|
9844
|
+
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// Returns raw DFG approximation coefficients (split-sum LUT approximation)\nvec2 envDFGApprox(float roughness, float dotNV) {\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n return vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\n\n// ref: https://www.unrealengine.com/blog/physically-based-shading-on-mobile - environmentBRDF for GGX on mobile\nvec3 envBRDFApprox(vec3 f0, float f90, float roughness, float dotNV ) {\n vec2 AB = envDFGApprox(roughness, dotNV);\n return f0 * AB.x + f90 * 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 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
|
|
9845
9845
|
var pbr_frag = "Geometry geometry;\nMaterial material;\nReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\ninitGeometry(geometry, gl_FrontFacing);\ninitMaterial(material, geometry);\n\n// Direct Light\naddTotalDirectRadiance(geometry, material, reflectedLight);\n\n// IBL diffuse\n#ifdef SCENE_USE_SH\n vec3 irradiance = getLightProbeIrradiance(scene_EnvSH, geometry.normal);\n irradiance *= scene_EnvMapLight.diffuseIntensity;\n#else\n vec3 irradiance = scene_EnvMapLight.diffuse * scene_EnvMapLight.diffuseIntensity;\n irradiance *= PI;\n#endif\n\nreflectedLight.indirectDiffuse += material.diffuseAO * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\n// IBL specular\nvec3 radiance = getLightProbeRadiance(geometry, geometry.normal, material.roughness, int(scene_EnvMapLight.mipMapLevel), scene_EnvMapLight.specularIntensity);\nfloat radianceAttenuation = 1.0;\n\n// IBL Clear Coat\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\n vec3 clearCoatRadiance = getLightProbeRadiance( geometry, geometry.clearCoatNormal, material.clearCoatRoughness, int(scene_EnvMapLight.mipMapLevel), scene_EnvMapLight.specularIntensity );\n\n reflectedLight.indirectSpecular += material.specularAO * clearCoatRadiance * material.clearCoat * envBRDFApprox(vec3( 0.04 ), 1.0, material.clearCoatRoughness, geometry.clearCoatDotNV);\n radianceAttenuation -= material.clearCoat * F_Schlick(0.04, 1.0, geometry.clearCoatDotNV);\n#endif\n\nreflectedLight.indirectSpecular += material.specularAO * radianceAttenuation * radiance * envBRDFApprox(material.resolvedSpecularF0, material.specularF90, material.roughness, geometry.dotNV) * material.energyCompensation;\n\n\n// IBL Sheen\nevaluateSheenIBL(geometry, material, radianceAttenuation, reflectedLight.indirectDiffuse, reflectedLight.indirectSpecular);\n\n\n// Final color\nvec3 totalDiffuseColor = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\nvec3 totalSpecularColor = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\n#ifdef MATERIAL_ENABLE_TRANSMISSION \n vec3 refractionTransmitted = evaluateTransmission(geometry, material);\n totalDiffuseColor = mix(totalDiffuseColor, refractionTransmitted, material.transmission);\n#endif\n\nvec4 finalColor = vec4(totalDiffuseColor + totalSpecularColor, material.opacity);\n\n\n// Emissive\nvec3 emissiveRadiance = material_EmissiveColor;\n#ifdef MATERIAL_HAS_EMISSIVETEXTURE\n emissiveRadiance *= texture2DSRGB(material_EmissiveTexture, v_uv).rgb;\n#endif\n\nfinalColor.rgb += emissiveRadiance;\n\n\ngl_FragColor = finalColor;\n"; // eslint-disable-line
|
|
9846
9846
|
var btdf = "#include <refraction>\n\n#ifdef MATERIAL_ENABLE_TRANSMISSION \n uniform sampler2D camera_OpaqueTexture;\n vec3 evaluateTransmission(Geometry geometry, Material material) {\n RefractionModelResult ray;\n #if REFRACTION_MODE == 0 \n // RefractionMode.Sphere\n refractionModelSphere(-geometry.viewDir, geometry.position, geometry.normal, material.IOR, material.thickness, ray);\n #elif REFRACTION_MODE == 1\n // RefractionMode.Planar\n refractionModelPlanar(-geometry.viewDir, geometry.position, geometry.normal, material.IOR, material.thickness, ray);\n #endif\n\n vec3 refractedRayExit = ray.positionExit;\n\n // We calculate the screen space position of the refracted point\n vec4 samplingPositionNDC = camera_ProjMat * camera_ViewMat * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = (samplingPositionNDC.xy / samplingPositionNDC.w) * 0.5 + 0.5;\n\n // Sample the opaque texture to get the transmitted light\n vec3 refractionTransmitted = texture2DSRGB(camera_OpaqueTexture, refractionCoords).rgb;\n refractionTransmitted *= material.diffuseColor;\n \n // Use specularFGD as an approximation of the fresnel effect\n // https://blog.selfshadow.com/publications/s2017-shading-course/imageworks/s2017_pbs_imageworks_slides_v2.pdf\n refractionTransmitted *= (1.0 - material.envSpecularDFG);\n\n #ifdef MATERIAL_HAS_THICKNESS\n // Absorption coefficient from Disney: http://blog.selfshadow.com/publications/s2015-shading-course/burley/s2015_pbs_disney_bsdf_notes.pdf\n vec3 transmittance = min(vec3(1.0), exp(-material.absorptionCoefficient * ray.transmissionLength));\n refractionTransmitted *= transmittance;\n #endif\n \n return refractionTransmitted;\n }\n#endif"; // eslint-disable-line
|
|
9847
9847
|
var refraction = "#ifdef MATERIAL_ENABLE_TRANSMISSION \n\tstruct RefractionModelResult {\n\t float transmissionLength; // length of the transmission during refraction through the shape\n\t vec3 positionExit; // out ray position\n\t // vec3 directionExit; // out ray direction\n\t};\n\n\t//https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@15.0/manual/refraction-models.html\n\t void refractionModelSphere(vec3 V, vec3 positionWS, vec3 normalWS, float ior, float thickness, out RefractionModelResult ray) {\n\t // Refracted ray\n\t vec3 R1 = refract(V, normalWS, 1.0 / ior);\n\t // Center of the tangent sphere\n\t // vec3 C = positionWS - normalWS * thickness * 0.5;\n\n\t // Second refraction (tangent sphere out)\n\t float dist = dot(-normalWS, R1) * thickness;\n\t // Out hit point in the tangent sphere\n\t vec3 P1 = positionWS + R1 * dist;\n\t // Out normal\n\t // vec3 N1 = safeNormalize(C - P1);\n\t // Out refracted ray\n\t // vec3 R2 = refract(R1, N1, ior);\n\n\t ray.transmissionLength = dist;\n\t ray.positionExit = P1;\n\t // ray.directionExit = R2; \n\t}\n\n\tvoid refractionModelPlanar(vec3 V, vec3 positionWS, vec3 normalWS, float ior, float thickness, out RefractionModelResult ray) {\n\t // Refracted ray\n\t vec3 R = refract(V, normalWS, 1.0 / ior);\n\t // Optical depth within the thin plane\n\t float dist = thickness / max(dot(-normalWS, R), 1e-5f);\n\n\t ray.transmissionLength = dist;\n\t ray.positionExit = vec3(positionWS + R * dist);\n\t // ray.directionExit = V;\n\t}\n\n#endif"; // eslint-disable-line
|
|
@@ -28926,7 +28926,6 @@ PrimitiveChunk.subMeshPool = new ReturnableObjectPool(SubMesh, 10);
|
|
|
28926
28926
|
/** Sprite Atlas. */ AssetType["SpriteAtlas"] = "SpriteAtlas";
|
|
28927
28927
|
/** Ambient light. */ AssetType["Env"] = "Environment";
|
|
28928
28928
|
/** Scene. */ AssetType["Scene"] = "Scene";
|
|
28929
|
-
/** HDR to cube. */ AssetType["HDR"] = "HDR";
|
|
28930
28929
|
/** Font. */ AssetType["Font"] = "Font";
|
|
28931
28930
|
/** Source Font, include ttf, otf and woff. */ AssetType["SourceFont"] = "SourceFont";
|
|
28932
28931
|
/** AudioClip, include ogg, wav and mp3. */ AssetType["Audio"] = "Audio";
|
|
@@ -29340,7 +29339,6 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
29340
29339
|
this._contentRestorerPool = Object.create(null);
|
|
29341
29340
|
this._subAssetPromiseCallbacks = {};
|
|
29342
29341
|
this./** @internal */ _objectPool = Object.create(null);
|
|
29343
|
-
this./** @internal */ _idResourceMap = Object.create(null);
|
|
29344
29342
|
this./** @internal */ _virtualPathResourceMap = Object.create(null);
|
|
29345
29343
|
}
|
|
29346
29344
|
var _proto = ResourceManager.prototype;
|
|
@@ -29739,30 +29737,29 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
29739
29737
|
* @internal
|
|
29740
29738
|
* @beta Just for internal editor, not recommended for developers.
|
|
29741
29739
|
*/ _proto.getResourceByRef = function getResourceByRef(ref) {
|
|
29742
|
-
var
|
|
29743
|
-
|
|
29744
|
-
|
|
29745
|
-
|
|
29746
|
-
|
|
29747
|
-
|
|
29748
|
-
|
|
29749
|
-
|
|
29750
|
-
|
|
29751
|
-
|
|
29752
|
-
|
|
29753
|
-
|
|
29754
|
-
|
|
29755
|
-
url += "?q=" + key;
|
|
29756
|
-
}
|
|
29757
|
-
promise = this.load({
|
|
29758
|
-
url: url,
|
|
29759
|
-
type: resourceConfig.type,
|
|
29760
|
-
params: resourceConfig.params
|
|
29761
|
-
});
|
|
29740
|
+
var url = ref.url, key = ref.key, isClone = ref.isClone;
|
|
29741
|
+
if (!url) {
|
|
29742
|
+
Logger.warn("ResourceManager.getResourceByRef: url is empty.");
|
|
29743
|
+
return AssetPromise.resolve(null);
|
|
29744
|
+
}
|
|
29745
|
+
var cached = this._objectPool[url];
|
|
29746
|
+
if (cached) {
|
|
29747
|
+
return AssetPromise.resolve(isClone ? cached.clone() : cached);
|
|
29748
|
+
}
|
|
29749
|
+
var mapped = this._virtualPathResourceMap[url];
|
|
29750
|
+
if (!mapped) {
|
|
29751
|
+
Logger.warn('ResourceManager.getResourceByRef: url "' + url + '" not found in virtualPathResourceMap.');
|
|
29752
|
+
return AssetPromise.resolve(null);
|
|
29762
29753
|
}
|
|
29763
|
-
|
|
29764
|
-
|
|
29754
|
+
var loadUrl = key ? url + "?q=" + key : url;
|
|
29755
|
+
var promise = this.load({
|
|
29756
|
+
url: loadUrl,
|
|
29757
|
+
type: mapped.type,
|
|
29758
|
+
params: mapped.params
|
|
29765
29759
|
});
|
|
29760
|
+
return isClone ? promise.then(function(item) {
|
|
29761
|
+
return item.clone();
|
|
29762
|
+
}) : promise;
|
|
29766
29763
|
};
|
|
29767
29764
|
/**
|
|
29768
29765
|
* @internal
|
|
@@ -29771,7 +29768,6 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
29771
29768
|
var _this = this;
|
|
29772
29769
|
config.forEach(function(element) {
|
|
29773
29770
|
_this._virtualPathResourceMap[element.virtualPath] = element;
|
|
29774
|
-
_this._idResourceMap[element.id] = element;
|
|
29775
29771
|
if (element.dependentAssetMap) {
|
|
29776
29772
|
_this._virtualPathResourceMap[element.virtualPath].dependentAssetMap = element.dependentAssetMap;
|
|
29777
29773
|
}
|
|
@@ -31089,7 +31085,7 @@ var pbrFs = "#include <common>\n#include <camera_declare>\n#include <transform_d
|
|
|
31089
31085
|
var pbrVs = "#include <common>\n#include <common_vert>\n#include <blendShape_input>\n#include <uv_share>\n#include <color_share>\n#include <normal_share>\n#include <worldpos_share>\n\n#include <ShadowVertexDeclaration>\n#include <FogVertexDeclaration>\n#include <PositionClipSpaceDeclaration>\n\nvoid main() {\n\n #include <begin_position_vert>\n #include <begin_normal_vert>\n #include <blendShape_vert>\n #include <skinning_vert>\n #include <uv_vert>\n #include <color_vert>\n #include <normal_vert>\n #include <worldpos_vert>\n #include <position_vert>\n\n #include <ShadowVertex>\n #include <FogVertex>\n #include <PositionClipSpaceVertex>\n}\n"; // eslint-disable-line
|
|
31090
31086
|
var shadowMapFs = "#ifdef ENGINE_NO_DEPTH_TEXTURE\n /**\n * Decompose and save depth value.\n */\n vec4 pack (float depth) {\n // Use rgba 4 bytes with a total of 32 bits to store the z value, and the accuracy of 1 byte is 1/256.\n const vec4 bitShift = vec4(1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0);\n const vec4 bitMask = vec4(1.0/256.0, 1.0/256.0, 1.0/256.0, 0.0);\n\n vec4 rgbaDepth = fract(depth * bitShift); // Calculate the z value of each point\n\n // Cut off the value which do not fit in 8 bits\n rgbaDepth -= rgbaDepth.gbaa * bitMask;\n\n return rgbaDepth;\n }\n#endif\n\n\nuniform vec4 material_BaseColor;\nuniform sampler2D material_BaseTexture;\nuniform float material_AlphaCutoff;\nvarying vec2 v_uv;\n\nvoid main() {\n #if defined(MATERIAL_IS_ALPHA_CUTOFF) || (defined(SCENE_ENABLE_TRANSPARENT_SHADOW) && defined(MATERIAL_IS_TRANSPARENT))\n float alpha = material_BaseColor.a;\n #ifdef MATERIAL_HAS_BASETEXTURE\n alpha *= texture2D(material_BaseTexture, v_uv).a;\n #endif\n \n #ifdef MATERIAL_IS_ALPHA_CUTOFF\n if(alpha < material_AlphaCutoff){\n discard;\n }\n #endif\n \n #if defined(SCENE_ENABLE_TRANSPARENT_SHADOW) && defined(MATERIAL_IS_TRANSPARENT)\n // Interleaved gradient noise\n float noise = fract(52.982919 * fract(dot(vec2(0.06711, 0.00584), gl_FragCoord.xy)));\n if (alpha <= noise) {\n discard;\n };\n #endif\n #endif\n\n #ifdef ENGINE_NO_DEPTH_TEXTURE\n gl_FragColor = pack(gl_FragCoord.z);\n #else\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n #endif\n}"; // eslint-disable-line
|
|
31091
31087
|
var shadowMapVs = "#include <common>\n#include <common_vert>\n#include <blendShape_input>\n#include <normal_share>\n#include <uv_share>\nuniform mat4 camera_VPMat;\nuniform vec2 scene_ShadowBias; // x: depth bias, y: normal bias\nuniform vec3 scene_LightDirection;\n\nvec3 applyShadowBias(vec3 positionWS) {\n positionWS -= scene_LightDirection * scene_ShadowBias.x;\n return positionWS;\n}\n\nvec3 applyShadowNormalBias(vec3 positionWS, vec3 normalWS) {\n float invNdotL = 1.0 - clamp(dot(-scene_LightDirection, normalWS), 0.0, 1.0);\n float scale = invNdotL * scene_ShadowBias.y;\n positionWS += normalWS * vec3(scale);\n return positionWS;\n}\n\nvoid main() {\n\n #include <begin_position_vert>\n #include <begin_normal_vert>\n #include <blendShape_vert>\n #include <skinning_vert>\n #include <uv_vert>\n \n vec4 positionWS = renderer_ModelMat * position;\n\n positionWS.xyz = applyShadowBias(positionWS.xyz);\n #ifndef MATERIAL_OMIT_NORMAL\n #ifdef RENDERER_HAS_NORMAL\n vec3 normalWS = normalize( mat3(renderer_NormalMat) * normal );\n positionWS.xyz = applyShadowNormalBias(positionWS.xyz, normalWS);\n #endif\n #endif\n\n\n vec4 positionCS = camera_VPMat * positionWS;\n positionCS.z = max(positionCS.z, -1.0);// clamp to min ndc z\n\n gl_Position = positionCS;\n\n}\n"; // eslint-disable-line
|
|
31092
|
-
var skyboxFs = "#include <common>\nuniform samplerCube material_CubeTexture;\n\nvarying vec3 v_cubeUV;\nuniform float material_Exposure;\nuniform vec4 material_TintColor;\n\nvoid main() {\n vec4 textureColor = textureCube( material_CubeTexture, v_cubeUV );\n\n #ifdef
|
|
31088
|
+
var skyboxFs = "#include <common>\nuniform samplerCube material_CubeTexture;\n\nvarying vec3 v_cubeUV;\nuniform float material_Exposure;\nuniform vec4 material_TintColor;\n\nvoid main() {\n vec4 textureColor = textureCube( material_CubeTexture, v_cubeUV );\n\n #ifdef ENGINE_NO_SRGB\n textureColor = sRGBToLinear(textureColor);\n #endif\n\n textureColor.rgb *= material_Exposure * material_TintColor.rgb;\n \n gl_FragColor = textureColor;\n}\n"; // eslint-disable-line
|
|
31093
31089
|
var skyboxVs = "#include <common_vert>\n\nuniform mat4 camera_VPMat;\n\nvarying vec3 v_cubeUV;\nuniform float material_Rotation;\n\nvec4 rotateY(vec4 v, float angle) {\n\tconst float deg2rad = 3.1415926 / 180.0;\n\tfloat radian = angle * deg2rad;\n\tfloat sina = sin(radian);\n\tfloat cosa = cos(radian);\n\tmat2 m = mat2(cosa, -sina, sina, cosa);\n\treturn vec4(m * v.xz, v.yw).xzyw;\n}\n\nvoid main() {\n v_cubeUV = vec3( -POSITION.x, POSITION.yz ); // TextureCube is left-hand,so x need inverse\n gl_Position = camera_VPMat * rotateY(vec4(POSITION, 1.0), material_Rotation);\n}\n"; // eslint-disable-line
|
|
31094
31090
|
var spriteMaskFs = "uniform sampler2D renderer_MaskTexture;\nuniform float renderer_MaskAlphaCutoff;\nvarying vec2 v_uv;\n\nvoid main()\n{\n vec4 color = texture2D(renderer_MaskTexture, v_uv);\n if (color.a < renderer_MaskAlphaCutoff) {\n discard;\n }\n\n gl_FragColor = color;\n}\n"; // eslint-disable-line
|
|
31095
31091
|
var spriteMaskVs = "uniform mat4 camera_VPMat;\n\nattribute vec3 POSITION;\nattribute vec2 TEXCOORD_0;\n\nvarying vec2 v_uv;\n\nvoid main()\n{\n gl_Position = camera_VPMat * vec4(POSITION, 1.0);\n v_uv = TEXCOORD_0;\n}\n"; // eslint-disable-line
|
|
@@ -32254,7 +32250,7 @@ ShaderPool.init();
|
|
|
32254
32250
|
_inherits$2(AmbientLight, ReferResource);
|
|
32255
32251
|
function AmbientLight(engine) {
|
|
32256
32252
|
var _this;
|
|
32257
|
-
_this = ReferResource.call(this, engine) || this, _this._diffuseSolidColor = new Color(0.03696758874771872, 0.0421494543549785, 0.05455383078270364), _this._diffuseIntensity = 1.0, _this._specularIntensity = 1.0, _this._diffuseMode = DiffuseMode.SolidColor, _this._shArray = new Float32Array(27), _this._scenes = []
|
|
32253
|
+
_this = ReferResource.call(this, engine) || this, _this._diffuseSolidColor = new Color(0.03696758874771872, 0.0421494543549785, 0.05455383078270364), _this._diffuseIntensity = 1.0, _this._specularIntensity = 1.0, _this._diffuseMode = DiffuseMode.SolidColor, _this._shArray = new Float32Array(27), _this._scenes = [];
|
|
32258
32254
|
return _this;
|
|
32259
32255
|
}
|
|
32260
32256
|
var _proto = AmbientLight.prototype;
|
|
@@ -32269,7 +32265,6 @@ ShaderPool.init();
|
|
|
32269
32265
|
shaderData.setFloat(AmbientLight._specularIntensityProperty, this._specularIntensity);
|
|
32270
32266
|
shaderData.setFloatArray(AmbientLight._diffuseSHProperty, this._shArray);
|
|
32271
32267
|
this._setDiffuseMode(shaderData);
|
|
32272
|
-
this._setSpecularTextureDecodeRGBM(shaderData);
|
|
32273
32268
|
this._setSpecularTexture(shaderData);
|
|
32274
32269
|
};
|
|
32275
32270
|
/**
|
|
@@ -32299,13 +32294,6 @@ ShaderPool.init();
|
|
|
32299
32294
|
sceneShaderData.disableMacro(AmbientLight._specularMacro);
|
|
32300
32295
|
}
|
|
32301
32296
|
};
|
|
32302
|
-
_proto._setSpecularTextureDecodeRGBM = function _setSpecularTextureDecodeRGBM(sceneShaderData) {
|
|
32303
|
-
if (this._specularTextureDecodeRGBM) {
|
|
32304
|
-
sceneShaderData.enableMacro(AmbientLight._decodeRGBMMacro);
|
|
32305
|
-
} else {
|
|
32306
|
-
sceneShaderData.disableMacro(AmbientLight._decodeRGBMMacro);
|
|
32307
|
-
}
|
|
32308
|
-
};
|
|
32309
32297
|
_proto._preComputeSH = function _preComputeSH(sh, out) {
|
|
32310
32298
|
/**
|
|
32311
32299
|
* Basis constants
|
|
@@ -32360,21 +32348,6 @@ ShaderPool.init();
|
|
|
32360
32348
|
out[26] = src[26] * 0.429042;
|
|
32361
32349
|
};
|
|
32362
32350
|
_create_class$2(AmbientLight, [
|
|
32363
|
-
{
|
|
32364
|
-
key: "specularTextureDecodeRGBM",
|
|
32365
|
-
get: /**
|
|
32366
|
-
* Whether to decode from specularTexture with RGBM format.
|
|
32367
|
-
*/ function get() {
|
|
32368
|
-
return this._specularTextureDecodeRGBM;
|
|
32369
|
-
},
|
|
32370
|
-
set: function set(value) {
|
|
32371
|
-
this._specularTextureDecodeRGBM = value;
|
|
32372
|
-
var scenes = this._scenes;
|
|
32373
|
-
for(var i = 0, n = scenes.length; i < n; i++){
|
|
32374
|
-
this._setSpecularTextureDecodeRGBM(scenes[i].shaderData);
|
|
32375
|
-
}
|
|
32376
|
-
}
|
|
32377
|
-
},
|
|
32378
32351
|
{
|
|
32379
32352
|
key: "diffuseMode",
|
|
32380
32353
|
get: /**
|
|
@@ -32472,7 +32445,6 @@ ShaderPool.init();
|
|
|
32472
32445
|
}(ReferResource);
|
|
32473
32446
|
AmbientLight._shMacro = ShaderMacro.getByName("SCENE_USE_SH");
|
|
32474
32447
|
AmbientLight._specularMacro = ShaderMacro.getByName("SCENE_USE_SPECULAR_ENV");
|
|
32475
|
-
AmbientLight._decodeRGBMMacro = ShaderMacro.getByName("SCENE_IS_DECODE_ENV_RGBM");
|
|
32476
32448
|
AmbientLight._diffuseColorProperty = ShaderProperty.getByName("scene_EnvMapLight.diffuse");
|
|
32477
32449
|
AmbientLight._diffuseSHProperty = ShaderProperty.getByName("scene_EnvSH");
|
|
32478
32450
|
AmbientLight._diffuseIntensityProperty = ShaderProperty.getByName("scene_EnvMapLight.diffuseIntensity");
|
|
@@ -37447,7 +37419,7 @@ function _assert_this_initialized(self) {
|
|
|
37447
37419
|
_inherits$2(SkyBoxMaterial, Material);
|
|
37448
37420
|
function SkyBoxMaterial(engine) {
|
|
37449
37421
|
var _this;
|
|
37450
|
-
_this = Material.call(this, engine, Shader.find("skybox")) || this, _this.
|
|
37422
|
+
_this = Material.call(this, engine, Shader.find("skybox")) || this, _this._tintColor = new Color(1, 1, 1, 1);
|
|
37451
37423
|
_this.renderState.rasterState.cullMode = CullMode.Off;
|
|
37452
37424
|
_this.renderState.depthState.compareFunction = CompareFunction.LessEqual;
|
|
37453
37425
|
_this.shaderData.setFloat(SkyBoxMaterial._rotationProp, 0);
|
|
@@ -37462,22 +37434,6 @@ function _assert_this_initialized(self) {
|
|
|
37462
37434
|
return dest;
|
|
37463
37435
|
};
|
|
37464
37436
|
_create_class$2(SkyBoxMaterial, [
|
|
37465
|
-
{
|
|
37466
|
-
key: "textureDecodeRGBM",
|
|
37467
|
-
get: /**
|
|
37468
|
-
* Whether to decode texture with RGBM format.
|
|
37469
|
-
*/ function get() {
|
|
37470
|
-
return this._textureDecodeRGBM;
|
|
37471
|
-
},
|
|
37472
|
-
set: function set(value) {
|
|
37473
|
-
this._textureDecodeRGBM = value;
|
|
37474
|
-
if (value) {
|
|
37475
|
-
this.shaderData.enableMacro(SkyBoxMaterial._decodeSkyRGBMMacro);
|
|
37476
|
-
} else {
|
|
37477
|
-
this.shaderData.disableMacro(SkyBoxMaterial._decodeSkyRGBMMacro);
|
|
37478
|
-
}
|
|
37479
|
-
}
|
|
37480
|
-
},
|
|
37481
37437
|
{
|
|
37482
37438
|
key: "texture",
|
|
37483
37439
|
get: /**
|
|
@@ -37531,7 +37487,6 @@ SkyBoxMaterial._tintColorProp = ShaderProperty.getByName("material_TintColor");
|
|
|
37531
37487
|
SkyBoxMaterial._textureCubeProp = ShaderProperty.getByName("material_CubeTexture");
|
|
37532
37488
|
SkyBoxMaterial._rotationProp = ShaderProperty.getByName("material_Rotation");
|
|
37533
37489
|
SkyBoxMaterial._exposureProp = ShaderProperty.getByName("material_Exposure");
|
|
37534
|
-
SkyBoxMaterial._decodeSkyRGBMMacro = ShaderMacro.getByName("MATERIAL_IS_DECODE_SKY_RGBM");
|
|
37535
37490
|
/**
|
|
37536
37491
|
* Sun mode.
|
|
37537
37492
|
*/ var SunMode = /*#__PURE__*/ function(SunMode) {
|
|
@@ -45751,7 +45706,9 @@ var decoderMap = {};
|
|
|
45751
45706
|
decoderMap[type] = target;
|
|
45752
45707
|
};
|
|
45753
45708
|
}
|
|
45754
|
-
|
|
45709
|
+
/**
|
|
45710
|
+
* Binary format: [MAGIC(4B)] [totalLength(4B)] [version(1B)] [typeLen(2B)] [type] [nameLen(2B)] [name] [data...]
|
|
45711
|
+
*/ var FileHeader = /*#__PURE__*/ function() {
|
|
45755
45712
|
function FileHeader() {
|
|
45756
45713
|
this.totalLength = 0;
|
|
45757
45714
|
this.version = 0;
|
|
@@ -45759,14 +45716,23 @@ var FileHeader = /*#__PURE__*/ function() {
|
|
|
45759
45716
|
this.name = "";
|
|
45760
45717
|
this.headerLength = 0;
|
|
45761
45718
|
}
|
|
45719
|
+
FileHeader.checkMagic = function checkMagic(arrayBuffer) {
|
|
45720
|
+
if (arrayBuffer.byteLength < 4) return false;
|
|
45721
|
+
var view = new DataView(arrayBuffer);
|
|
45722
|
+
return view.getUint32(0, true) === FileHeader.MAGIC;
|
|
45723
|
+
};
|
|
45762
45724
|
FileHeader.decode = function decode(arrayBuffer) {
|
|
45763
45725
|
var dataView = new DataView(arrayBuffer);
|
|
45764
|
-
|
|
45765
|
-
|
|
45766
|
-
|
|
45767
|
-
var
|
|
45768
|
-
var
|
|
45769
|
-
var
|
|
45726
|
+
if (!FileHeader.checkMagic(arrayBuffer)) {
|
|
45727
|
+
throw new Error("Invalid Galacean binary file: missing GLCN magic header.");
|
|
45728
|
+
}
|
|
45729
|
+
var offset = 4;
|
|
45730
|
+
var totalLen = dataView.getUint32(offset, true);
|
|
45731
|
+
var fileVersion = dataView.getUint8(offset + 4);
|
|
45732
|
+
var typeLen = dataView.getUint16(offset + 5, true);
|
|
45733
|
+
var typeUint8Array = new Uint8Array(arrayBuffer, offset + 7, typeLen);
|
|
45734
|
+
var nameLen = dataView.getUint16(offset + 7 + typeLen, true);
|
|
45735
|
+
var nameUint8Array = new Uint8Array(arrayBuffer, offset + 9 + typeLen, nameLen);
|
|
45770
45736
|
var name = Utils.decodeText(nameUint8Array);
|
|
45771
45737
|
var type = Utils.decodeText(typeUint8Array);
|
|
45772
45738
|
var header = new FileHeader();
|
|
@@ -45774,7 +45740,7 @@ var FileHeader = /*#__PURE__*/ function() {
|
|
|
45774
45740
|
header.name = name;
|
|
45775
45741
|
header.type = type;
|
|
45776
45742
|
header.version = fileVersion;
|
|
45777
|
-
header.headerLength = nameUint8Array.byteLength + typeUint8Array.byteLength + 9;
|
|
45743
|
+
header.headerLength = offset + nameUint8Array.byteLength + typeUint8Array.byteLength + 9;
|
|
45778
45744
|
return header;
|
|
45779
45745
|
};
|
|
45780
45746
|
_create_class(FileHeader, [
|
|
@@ -45787,6 +45753,8 @@ var FileHeader = /*#__PURE__*/ function() {
|
|
|
45787
45753
|
]);
|
|
45788
45754
|
return FileHeader;
|
|
45789
45755
|
}();
|
|
45756
|
+
FileHeader.MAGIC = 0x4e434c47 // "GLCN" in little-endian
|
|
45757
|
+
;
|
|
45790
45758
|
var InterpolableValueType = /*#__PURE__*/ function(InterpolableValueType) {
|
|
45791
45759
|
InterpolableValueType[InterpolableValueType["Float"] = 0] = "Float";
|
|
45792
45760
|
InterpolableValueType[InterpolableValueType["FloatArray"] = 1] = "FloatArray";
|
|
@@ -46187,12 +46155,12 @@ var ParserType = /*#__PURE__*/ function(ParserType) {
|
|
|
46187
46155
|
this.rootIds.length = 0;
|
|
46188
46156
|
this.strippedIds.length = 0;
|
|
46189
46157
|
};
|
|
46190
|
-
/** @internal */ _proto._addDependentAsset = function _addDependentAsset(
|
|
46158
|
+
/** @internal */ _proto._addDependentAsset = function _addDependentAsset(url, promise) {
|
|
46191
46159
|
var _this = this;
|
|
46192
46160
|
var tasks = this._tasks;
|
|
46193
|
-
if (tasks.has(
|
|
46161
|
+
if (tasks.has(url)) return;
|
|
46194
46162
|
++this._total;
|
|
46195
|
-
tasks.add(
|
|
46163
|
+
tasks.add(url);
|
|
46196
46164
|
promise.finally(function() {
|
|
46197
46165
|
++_this._loaded;
|
|
46198
46166
|
_this._setTaskCompleteProgress(_this._loaded, _this._total);
|
|
@@ -46299,7 +46267,7 @@ var ReflectionParser = /*#__PURE__*/ function() {
|
|
|
46299
46267
|
// reference object
|
|
46300
46268
|
// @ts-ignore
|
|
46301
46269
|
return context.resourceManager.getResourceByRef(value).then(function(resource) {
|
|
46302
|
-
if (context.type === ParserType.Prefab) {
|
|
46270
|
+
if (resource && context.type === ParserType.Prefab) {
|
|
46303
46271
|
// @ts-ignore
|
|
46304
46272
|
context.resource._addDependenceAsset(resource);
|
|
46305
46273
|
}
|
|
@@ -46342,18 +46310,18 @@ var ReflectionParser = /*#__PURE__*/ function() {
|
|
|
46342
46310
|
_proto._getEntityByConfig = function _getEntityByConfig(entityConfig) {
|
|
46343
46311
|
var _this = this;
|
|
46344
46312
|
// @ts-ignore
|
|
46345
|
-
var
|
|
46313
|
+
var assetUrl = entityConfig.assetUrl;
|
|
46346
46314
|
var engine = this._context.engine;
|
|
46347
|
-
if (
|
|
46315
|
+
if (assetUrl) {
|
|
46348
46316
|
return engine.resourceManager // @ts-ignore
|
|
46349
46317
|
.getResourceByRef({
|
|
46350
|
-
|
|
46318
|
+
url: assetUrl,
|
|
46351
46319
|
key: entityConfig.key,
|
|
46352
46320
|
isClone: entityConfig.isClone
|
|
46353
46321
|
}).then(function(entity) {
|
|
46354
46322
|
// @ts-ignore
|
|
46355
|
-
var resource = engine.resourceManager._objectPool[
|
|
46356
|
-
if (_this._context.type === ParserType.Prefab) {
|
|
46323
|
+
var resource = engine.resourceManager._objectPool[assetUrl];
|
|
46324
|
+
if (resource && _this._context.type === ParserType.Prefab) {
|
|
46357
46325
|
// @ts-ignore
|
|
46358
46326
|
_this._context.resource._addDependenceAsset(resource);
|
|
46359
46327
|
}
|
|
@@ -46376,7 +46344,7 @@ var ReflectionParser = /*#__PURE__*/ function() {
|
|
|
46376
46344
|
return value["classType"] !== undefined;
|
|
46377
46345
|
};
|
|
46378
46346
|
ReflectionParser._isAssetRef = function _isAssetRef(value) {
|
|
46379
|
-
return value["
|
|
46347
|
+
return value["url"] !== undefined;
|
|
46380
46348
|
};
|
|
46381
46349
|
ReflectionParser._isEntityRef = function _isEntityRef(value) {
|
|
46382
46350
|
return value["entityId"] !== undefined;
|
|
@@ -46394,7 +46362,7 @@ var Texture2DDecoder = /*#__PURE__*/ function() {
|
|
|
46394
46362
|
function Texture2DDecoder() {}
|
|
46395
46363
|
Texture2DDecoder.decode = function decode(engine, bufferReader, restoredTexture) {
|
|
46396
46364
|
return new AssetPromise(function(resolve, reject) {
|
|
46397
|
-
var
|
|
46365
|
+
var url = bufferReader.nextStr();
|
|
46398
46366
|
var mipmap = !!bufferReader.nextUint8();
|
|
46399
46367
|
var filterMode = bufferReader.nextUint8();
|
|
46400
46368
|
var anisoLevel = bufferReader.nextUint8();
|
|
@@ -46423,7 +46391,7 @@ var Texture2DDecoder = /*#__PURE__*/ function() {
|
|
|
46423
46391
|
}
|
|
46424
46392
|
}
|
|
46425
46393
|
// @ts-ignore
|
|
46426
|
-
engine.resourceManager._objectPool[
|
|
46394
|
+
engine.resourceManager._objectPool[url] = texture2D;
|
|
46427
46395
|
resolve(texture2D);
|
|
46428
46396
|
} else {
|
|
46429
46397
|
var blob = new window.Blob([
|
|
@@ -46717,7 +46685,7 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
|
46717
46685
|
_proto._getEntityByConfig = function _getEntityByConfig(entityConfig, engine) {
|
|
46718
46686
|
var _this = this;
|
|
46719
46687
|
var entityPromise;
|
|
46720
|
-
if (entityConfig.
|
|
46688
|
+
if (entityConfig.assetUrl) {
|
|
46721
46689
|
entityPromise = this._parsePrefab(entityConfig, engine);
|
|
46722
46690
|
} else if (entityConfig.strippedId) {
|
|
46723
46691
|
entityPromise = this._parseStrippedEntity(entityConfig);
|
|
@@ -46737,10 +46705,10 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
|
46737
46705
|
};
|
|
46738
46706
|
_proto._parsePrefab = function _parsePrefab(entityConfig, engine) {
|
|
46739
46707
|
var _this = this;
|
|
46740
|
-
var
|
|
46708
|
+
var assetUrl = entityConfig.assetUrl;
|
|
46741
46709
|
return engine.resourceManager // @ts-ignore
|
|
46742
46710
|
.getResourceByRef({
|
|
46743
|
-
|
|
46711
|
+
url: assetUrl
|
|
46744
46712
|
}).then(function(prefabResource) {
|
|
46745
46713
|
var entity = _instanceof1(prefabResource, PrefabResource) ? prefabResource.instantiate() : prefabResource.instantiateSceneRoot();
|
|
46746
46714
|
var instanceContext = new ParserContext(engine, ParserType.Prefab, null);
|
|
@@ -46791,7 +46759,7 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
|
46791
46759
|
var componentConfigMap = context.componentConfigMap;
|
|
46792
46760
|
for(var i = 0, n = components.length; i < n; i++){
|
|
46793
46761
|
var componentConfig = components[i];
|
|
46794
|
-
var key = !componentConfig.
|
|
46762
|
+
var key = !componentConfig.url ? componentConfig.class : componentConfig.url;
|
|
46795
46763
|
var componentId = componentConfig.id;
|
|
46796
46764
|
var component = entity.addComponent(Loader.getClass(key));
|
|
46797
46765
|
componentMap.set(componentId, component);
|
|
@@ -46838,52 +46806,6 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
|
46838
46806
|
_proto._addEntityPlugin = function _addEntityPlugin(entityId, entity) {};
|
|
46839
46807
|
return HierarchyParser;
|
|
46840
46808
|
}();
|
|
46841
|
-
var EditorTextureLoader = /*#__PURE__*/ function(Loader) {
|
|
46842
|
-
_inherits(EditorTextureLoader, Loader);
|
|
46843
|
-
function EditorTextureLoader() {
|
|
46844
|
-
return Loader.apply(this, arguments) || this;
|
|
46845
|
-
}
|
|
46846
|
-
var _proto = EditorTextureLoader.prototype;
|
|
46847
|
-
_proto.load = function load(item, resourceManager) {
|
|
46848
|
-
var requestConfig = _extends({}, item, {
|
|
46849
|
-
type: "arraybuffer"
|
|
46850
|
-
});
|
|
46851
|
-
var url = item.url;
|
|
46852
|
-
return new AssetPromise(function(resolve, reject) {
|
|
46853
|
-
resourceManager // @ts-ignore
|
|
46854
|
-
._request(url, requestConfig).then(function(data) {
|
|
46855
|
-
decode(data, resourceManager.engine).then(function(texture) {
|
|
46856
|
-
resourceManager.addContentRestorer(new EditorTexture2DContentRestorer(texture, url, requestConfig));
|
|
46857
|
-
resolve(texture);
|
|
46858
|
-
});
|
|
46859
|
-
}).catch(reject);
|
|
46860
|
-
});
|
|
46861
|
-
};
|
|
46862
|
-
return EditorTextureLoader;
|
|
46863
|
-
}(Loader);
|
|
46864
|
-
EditorTextureLoader = __decorate([
|
|
46865
|
-
resourceLoader("EditorTexture2D", [
|
|
46866
|
-
"prefab"
|
|
46867
|
-
], true)
|
|
46868
|
-
], EditorTextureLoader);
|
|
46869
|
-
var EditorTexture2DContentRestorer = /*#__PURE__*/ function(ContentRestorer) {
|
|
46870
|
-
_inherits(EditorTexture2DContentRestorer, ContentRestorer);
|
|
46871
|
-
function EditorTexture2DContentRestorer(resource, url, requestConfig) {
|
|
46872
|
-
var _this;
|
|
46873
|
-
_this = ContentRestorer.call(this, resource) || this, _this.url = url, _this.requestConfig = requestConfig;
|
|
46874
|
-
return _this;
|
|
46875
|
-
}
|
|
46876
|
-
var _proto = EditorTexture2DContentRestorer.prototype;
|
|
46877
|
-
_proto.restoreContent = function restoreContent() {
|
|
46878
|
-
var texture = this.resource;
|
|
46879
|
-
var engine = texture.engine;
|
|
46880
|
-
return engine.resourceManager // @ts-ignore
|
|
46881
|
-
._request(this.url, this.requestConfig).then(function(data) {
|
|
46882
|
-
return decode(data, engine, texture);
|
|
46883
|
-
});
|
|
46884
|
-
};
|
|
46885
|
-
return EditorTexture2DContentRestorer;
|
|
46886
|
-
}(ContentRestorer);
|
|
46887
46809
|
var MaterialLoaderType = /*#__PURE__*/ function(MaterialLoaderType) {
|
|
46888
46810
|
MaterialLoaderType["Vector2"] = "Vector2";
|
|
46889
46811
|
MaterialLoaderType["Vector3"] = "Vector3";
|
|
@@ -46922,11 +46844,11 @@ var SpecularMode = /*#__PURE__*/ function(SpecularMode) {
|
|
|
46922
46844
|
var customAmbientLight = ambient.customAmbientLight, ambientLight = ambient.ambientLight;
|
|
46923
46845
|
if (useCustomAmbient && customAmbientLight) {
|
|
46924
46846
|
// @ts-ignore
|
|
46925
|
-
context._addDependentAsset(customAmbientLight.
|
|
46847
|
+
context._addDependentAsset(customAmbientLight.url, resourceManager.getResourceByRef(customAmbientLight));
|
|
46926
46848
|
}
|
|
46927
46849
|
if (ambientLight && (!useCustomAmbient || useSH)) {
|
|
46928
46850
|
// @ts-ignore
|
|
46929
|
-
context._addDependentAsset(ambientLight.
|
|
46851
|
+
context._addDependentAsset(ambientLight.url, resourceManager.getResourceByRef(ambientLight));
|
|
46930
46852
|
}
|
|
46931
46853
|
}
|
|
46932
46854
|
var background = scene.background;
|
|
@@ -46934,14 +46856,14 @@ var SpecularMode = /*#__PURE__*/ function(SpecularMode) {
|
|
|
46934
46856
|
if (backgroundMode === BackgroundMode.Texture) {
|
|
46935
46857
|
var texture = background.texture;
|
|
46936
46858
|
// @ts-ignore
|
|
46937
|
-
texture && context._addDependentAsset(texture.
|
|
46859
|
+
texture && context._addDependentAsset(texture.url, resourceManager.getResourceByRef(texture));
|
|
46938
46860
|
} else if (backgroundMode === BackgroundMode.Sky) {
|
|
46939
46861
|
var skyMesh = background.skyMesh, skyMaterial = background.skyMaterial;
|
|
46940
46862
|
if (skyMesh && skyMaterial) {
|
|
46941
46863
|
// @ts-ignore
|
|
46942
|
-
context._addDependentAsset(skyMesh.
|
|
46864
|
+
context._addDependentAsset(skyMesh.url, resourceManager.getResourceByRef(skyMesh));
|
|
46943
46865
|
// @ts-ignore
|
|
46944
|
-
context._addDependentAsset(skyMaterial.
|
|
46866
|
+
context._addDependentAsset(skyMaterial.url, resourceManager.getResourceByRef(skyMaterial));
|
|
46945
46867
|
}
|
|
46946
46868
|
}
|
|
46947
46869
|
};
|
|
@@ -46957,12 +46879,12 @@ var SpecularMode = /*#__PURE__*/ function(SpecularMode) {
|
|
|
46957
46879
|
var entities = file.entities;
|
|
46958
46880
|
for(var i = 0, n = entities.length; i < n; i++){
|
|
46959
46881
|
var entity = entities[i];
|
|
46960
|
-
if (!!entity.
|
|
46882
|
+
if (!!entity.assetUrl) {
|
|
46961
46883
|
var context = this.context;
|
|
46962
|
-
var
|
|
46884
|
+
var url = entity.assetUrl, key = entity.key;
|
|
46963
46885
|
// @ts-ignore
|
|
46964
|
-
context._addDependentAsset(
|
|
46965
|
-
|
|
46886
|
+
context._addDependentAsset(url, context.resourceManager.getResourceByRef({
|
|
46887
|
+
url: url,
|
|
46966
46888
|
key: key
|
|
46967
46889
|
}));
|
|
46968
46890
|
} else if (entity.strippedId) {
|
|
@@ -46987,7 +46909,7 @@ var SpecularMode = /*#__PURE__*/ function(SpecularMode) {
|
|
|
46987
46909
|
if (ReflectionParser._isAssetRef(value)) {
|
|
46988
46910
|
var context = this.context;
|
|
46989
46911
|
// @ts-ignore
|
|
46990
|
-
context._addDependentAsset(value.
|
|
46912
|
+
context._addDependentAsset(value.url, context.resourceManager.getResourceByRef(value));
|
|
46991
46913
|
} else {
|
|
46992
46914
|
for(var key in value){
|
|
46993
46915
|
this._searchDependentAssets(value[key]);
|
|
@@ -47049,7 +46971,7 @@ var AnimationClipLoader = /*#__PURE__*/ function(Loader) {
|
|
|
47049
46971
|
};
|
|
47050
46972
|
_proto._parseKeyframeValue = function _parseKeyframeValue(keyframe, resourceManager) {
|
|
47051
46973
|
var value = keyframe.value;
|
|
47052
|
-
if ((typeof value === "undefined" ? "undefined" : _type_of1(value)) === "object" && (value == null ? void 0 : value.
|
|
46974
|
+
if ((typeof value === "undefined" ? "undefined" : _type_of1(value)) === "object" && (value == null ? void 0 : value.url)) {
|
|
47053
46975
|
return new Promise(function(resolve) {
|
|
47054
46976
|
resourceManager // @ts-ignore
|
|
47055
46977
|
.getResourceByRef(value).then(function(asset) {
|
|
@@ -47065,7 +46987,7 @@ var AnimationClipLoader = /*#__PURE__*/ function(Loader) {
|
|
|
47065
46987
|
}(Loader);
|
|
47066
46988
|
AnimationClipLoader = __decorate([
|
|
47067
46989
|
resourceLoader(AssetType.AnimationClip, [
|
|
47068
|
-
"
|
|
46990
|
+
"anim"
|
|
47069
46991
|
])
|
|
47070
46992
|
], AnimationClipLoader);
|
|
47071
46993
|
var AnimatorControllerLoader = /*#__PURE__*/ function(Loader1) {
|
|
@@ -47176,8 +47098,8 @@ var AnimatorControllerLoader = /*#__PURE__*/ function(Loader1) {
|
|
|
47176
47098
|
}(Loader);
|
|
47177
47099
|
AnimatorControllerLoader = __decorate([
|
|
47178
47100
|
resourceLoader(AssetType.AnimatorController, [
|
|
47179
|
-
"
|
|
47180
|
-
]
|
|
47101
|
+
"animCtrl"
|
|
47102
|
+
])
|
|
47181
47103
|
], AnimatorControllerLoader);
|
|
47182
47104
|
var base64Regex = /^data:(.+?);base64,/;
|
|
47183
47105
|
var BufferLoader = /*#__PURE__*/ function(Loader) {
|
|
@@ -47204,8 +47126,7 @@ var BufferLoader = /*#__PURE__*/ function(Loader) {
|
|
|
47204
47126
|
}(Loader);
|
|
47205
47127
|
BufferLoader = __decorate([
|
|
47206
47128
|
resourceLoader(AssetType.Buffer, [
|
|
47207
|
-
"bin"
|
|
47208
|
-
"r3bin"
|
|
47129
|
+
"bin"
|
|
47209
47130
|
])
|
|
47210
47131
|
], BufferLoader);
|
|
47211
47132
|
var EnvLoader = /*#__PURE__*/ function(Loader) {
|
|
@@ -47231,7 +47152,6 @@ var EnvLoader = /*#__PURE__*/ function(Loader) {
|
|
|
47231
47152
|
sh.copyFromArray(new Float32Array(arraybuffer, 0, 27));
|
|
47232
47153
|
ambientLight.diffuseSphericalHarmonics = sh;
|
|
47233
47154
|
ambientLight.specularTexture = texture;
|
|
47234
|
-
ambientLight.specularTextureDecodeRGBM = true;
|
|
47235
47155
|
resolve(ambientLight);
|
|
47236
47156
|
}).catch(function(e) {
|
|
47237
47157
|
reject(e);
|
|
@@ -47244,7 +47164,7 @@ var EnvLoader = /*#__PURE__*/ function(Loader) {
|
|
|
47244
47164
|
var _this;
|
|
47245
47165
|
var shByteLength = 27 * 4;
|
|
47246
47166
|
var size = (_this = new Uint16Array(buffer, shByteLength, 1)) == null ? void 0 : _this[0];
|
|
47247
|
-
texture || (texture = new TextureCube(engine, size,
|
|
47167
|
+
texture || (texture = new TextureCube(engine, size, TextureFormat.R16G16B16A16, true, false));
|
|
47248
47168
|
texture.filterMode = TextureFilterMode.Trilinear;
|
|
47249
47169
|
var mipmapCount = texture.mipmapCount;
|
|
47250
47170
|
var offset = shByteLength + 2;
|
|
@@ -47252,8 +47172,8 @@ var EnvLoader = /*#__PURE__*/ function(Loader) {
|
|
|
47252
47172
|
var mipSize = size >> mipLevel;
|
|
47253
47173
|
for(var face = 0; face < 6; face++){
|
|
47254
47174
|
var dataSize = mipSize * mipSize * 4;
|
|
47255
|
-
var data = new
|
|
47256
|
-
offset += dataSize;
|
|
47175
|
+
var data = new Uint16Array(buffer, offset, dataSize);
|
|
47176
|
+
offset += dataSize * 2;
|
|
47257
47177
|
texture.setPixelBuffer(TextureCubeFace.PositiveX + face, data, mipLevel);
|
|
47258
47178
|
}
|
|
47259
47179
|
}
|
|
@@ -50744,340 +50664,6 @@ PrefabLoader = __decorate([
|
|
|
50744
50664
|
"prefab"
|
|
50745
50665
|
])
|
|
50746
50666
|
], PrefabLoader);
|
|
50747
|
-
var PI = Math.PI;
|
|
50748
|
-
// referenece: https://www.flipcode.com/archives/HDR_Image_Reader.shtml
|
|
50749
|
-
var HDRLoader = /*#__PURE__*/ function(Loader) {
|
|
50750
|
-
_inherits(HDRLoader, Loader);
|
|
50751
|
-
function HDRLoader() {
|
|
50752
|
-
return Loader.apply(this, arguments) || this;
|
|
50753
|
-
}
|
|
50754
|
-
var _proto = HDRLoader.prototype;
|
|
50755
|
-
_proto.load = function load(item, resourceManager) {
|
|
50756
|
-
return new AssetPromise(function(resolve, reject) {
|
|
50757
|
-
var engine = resourceManager.engine;
|
|
50758
|
-
var requestConfig = _extends({}, item, {
|
|
50759
|
-
type: "arraybuffer"
|
|
50760
|
-
});
|
|
50761
|
-
var url = item.url;
|
|
50762
|
-
resourceManager // @ts-ignore
|
|
50763
|
-
._request(url, requestConfig).then(function(buffer) {
|
|
50764
|
-
var texture = HDRLoader._setTextureByBuffer(engine, buffer);
|
|
50765
|
-
engine.resourceManager.addContentRestorer(new HDRContentRestorer(texture, url, requestConfig));
|
|
50766
|
-
resolve(texture);
|
|
50767
|
-
}).catch(reject);
|
|
50768
|
-
});
|
|
50769
|
-
};
|
|
50770
|
-
/**
|
|
50771
|
-
* @internal
|
|
50772
|
-
*/ HDRLoader._setTextureByBuffer = function _setTextureByBuffer(engine, buffer, texture) {
|
|
50773
|
-
var bufferArray = new Uint8Array(buffer);
|
|
50774
|
-
var _HDRLoader__parseHeader = HDRLoader._parseHeader(bufferArray), width = _HDRLoader__parseHeader.width, height = _HDRLoader__parseHeader.height, dataPosition = _HDRLoader__parseHeader.dataPosition;
|
|
50775
|
-
var cubeSize = height >> 1;
|
|
50776
|
-
texture || (texture = new TextureCube(engine, cubeSize, undefined, undefined, false));
|
|
50777
|
-
var pixels = HDRLoader._readPixels(bufferArray.subarray(dataPosition), width, height);
|
|
50778
|
-
var cubeMapData = HDRLoader._convertToCubemap(pixels, width, height, cubeSize);
|
|
50779
|
-
for(var faceIndex = 0; faceIndex < 6; faceIndex++){
|
|
50780
|
-
texture.setPixelBuffer(TextureCubeFace.PositiveX + faceIndex, cubeMapData[faceIndex], 0);
|
|
50781
|
-
}
|
|
50782
|
-
texture.generateMipmaps();
|
|
50783
|
-
return texture;
|
|
50784
|
-
};
|
|
50785
|
-
HDRLoader._convertToCubemap = function _convertToCubemap(pixels, inputWidth, inputHeight, size) {
|
|
50786
|
-
if (!pixels) {
|
|
50787
|
-
throw "ConvertPanoramaToCubemap: input cannot be null";
|
|
50788
|
-
}
|
|
50789
|
-
if (pixels.length != inputWidth * inputHeight * 4) {
|
|
50790
|
-
throw "ConvertPanoramaToCubemap: input size is wrong";
|
|
50791
|
-
}
|
|
50792
|
-
var textureRight = this._createCubemapData(size, this._faceRight, pixels, inputWidth, inputHeight);
|
|
50793
|
-
var textureLeft = this._createCubemapData(size, this._faceLeft, pixels, inputWidth, inputHeight);
|
|
50794
|
-
var textureUp = this._createCubemapData(size, this._faceUp, pixels, inputWidth, inputHeight);
|
|
50795
|
-
var textureDown = this._createCubemapData(size, this._faceBottom, pixels, inputWidth, inputHeight);
|
|
50796
|
-
var textureFront = this._createCubemapData(size, this._faceFront, pixels, inputWidth, inputHeight);
|
|
50797
|
-
var textureBack = this._createCubemapData(size, this._faceBack, pixels, inputWidth, inputHeight);
|
|
50798
|
-
return [
|
|
50799
|
-
textureRight,
|
|
50800
|
-
textureLeft,
|
|
50801
|
-
textureUp,
|
|
50802
|
-
textureDown,
|
|
50803
|
-
textureFront,
|
|
50804
|
-
textureBack
|
|
50805
|
-
];
|
|
50806
|
-
};
|
|
50807
|
-
HDRLoader._createCubemapData = function _createCubemapData(texSize, faceData, pixels, inputWidth, inputHeight) {
|
|
50808
|
-
var textureArray = new Uint8ClampedArray(texSize * texSize * 4);
|
|
50809
|
-
var rotDX1 = this._tempVector3.set(0, 0, 0).add(faceData[1]).subtract(faceData[0]).scale(1 / texSize);
|
|
50810
|
-
var rotDX2 = this._temp2Vector3.set(0, 0, 0).add(faceData[3]).subtract(faceData[2]).scale(1 / texSize);
|
|
50811
|
-
var dy = 1 / texSize;
|
|
50812
|
-
var fy = 0;
|
|
50813
|
-
for(var y = 0; y < texSize; y++){
|
|
50814
|
-
var xv1 = this._temp3Vector3.set(0, 0, 0).add(faceData[0]);
|
|
50815
|
-
var xv2 = this._temp4Vector3.set(0, 0, 0).add(faceData[2]);
|
|
50816
|
-
for(var x = 0; x < texSize; x++){
|
|
50817
|
-
var v = this._temp5Vector3.set(0, 0, 0).add(xv2).subtract(xv1).scale(fy).add(xv1);
|
|
50818
|
-
v.normalize();
|
|
50819
|
-
var color = this._calcProjectionSpherical(v, pixels, inputWidth, inputHeight);
|
|
50820
|
-
this._RGBEToLinear(color);
|
|
50821
|
-
this._linearToRGBM(color, 5);
|
|
50822
|
-
// 4 channels per pixels
|
|
50823
|
-
var index = y * texSize * 4 + x * 4;
|
|
50824
|
-
textureArray[index] = color.r;
|
|
50825
|
-
textureArray[index + 1] = color.g;
|
|
50826
|
-
textureArray[index + 2] = color.b;
|
|
50827
|
-
textureArray[index + 3] = color.a;
|
|
50828
|
-
xv1.add(rotDX1);
|
|
50829
|
-
xv2.add(rotDX2);
|
|
50830
|
-
}
|
|
50831
|
-
fy += dy;
|
|
50832
|
-
}
|
|
50833
|
-
return textureArray;
|
|
50834
|
-
};
|
|
50835
|
-
HDRLoader._calcProjectionSpherical = function _calcProjectionSpherical(vDir, pixels, inputWidth, inputHeight) {
|
|
50836
|
-
var theta = Math.atan2(vDir.z, vDir.x);
|
|
50837
|
-
var phi = Math.acos(vDir.y);
|
|
50838
|
-
while(theta < -PI){
|
|
50839
|
-
theta += 2 * PI;
|
|
50840
|
-
}
|
|
50841
|
-
while(theta > PI){
|
|
50842
|
-
theta -= 2 * PI;
|
|
50843
|
-
}
|
|
50844
|
-
var dx = theta / PI;
|
|
50845
|
-
var dy = phi / PI;
|
|
50846
|
-
// recenter.
|
|
50847
|
-
dx = dx * 0.5 + 0.5;
|
|
50848
|
-
var px = Math.round(dx * inputWidth);
|
|
50849
|
-
if (px < 0) {
|
|
50850
|
-
px = 0;
|
|
50851
|
-
} else if (px >= inputWidth) {
|
|
50852
|
-
px = inputWidth - 1;
|
|
50853
|
-
}
|
|
50854
|
-
var py = Math.round(dy * inputHeight);
|
|
50855
|
-
if (py < 0) {
|
|
50856
|
-
py = 0;
|
|
50857
|
-
} else if (py >= inputHeight) {
|
|
50858
|
-
py = inputHeight - 1;
|
|
50859
|
-
}
|
|
50860
|
-
var inputY = inputHeight - py - 1;
|
|
50861
|
-
var index = inputY * inputWidth * 4 + px * 4;
|
|
50862
|
-
var r = pixels[index];
|
|
50863
|
-
var g = pixels[index + 1];
|
|
50864
|
-
var b = pixels[index + 2];
|
|
50865
|
-
var a = pixels[index + 3];
|
|
50866
|
-
return new Color(r, g, b, a);
|
|
50867
|
-
};
|
|
50868
|
-
HDRLoader._readStringLine = function _readStringLine(uint8array, startIndex) {
|
|
50869
|
-
var line = "";
|
|
50870
|
-
var character = "";
|
|
50871
|
-
for(var i = startIndex; i < uint8array.length - startIndex; i++){
|
|
50872
|
-
character = String.fromCharCode(uint8array[i]);
|
|
50873
|
-
if (character == "\n") {
|
|
50874
|
-
break;
|
|
50875
|
-
}
|
|
50876
|
-
line += character;
|
|
50877
|
-
}
|
|
50878
|
-
return line;
|
|
50879
|
-
};
|
|
50880
|
-
HDRLoader._parseHeader = function _parseHeader(uint8array) {
|
|
50881
|
-
var height = 0;
|
|
50882
|
-
var width = 0;
|
|
50883
|
-
var line = this._readStringLine(uint8array, 0);
|
|
50884
|
-
if (line[0] != "#" || line[1] != "?") {
|
|
50885
|
-
throw "Bad HDR Format.";
|
|
50886
|
-
}
|
|
50887
|
-
var endOfHeader = false;
|
|
50888
|
-
var findFormat = false;
|
|
50889
|
-
var lineIndex = 0;
|
|
50890
|
-
do {
|
|
50891
|
-
lineIndex += line.length + 1;
|
|
50892
|
-
line = this._readStringLine(uint8array, lineIndex);
|
|
50893
|
-
if (line == "FORMAT=32-bit_rle_rgbe") {
|
|
50894
|
-
findFormat = true;
|
|
50895
|
-
} else if (line.length == 0) {
|
|
50896
|
-
endOfHeader = true;
|
|
50897
|
-
}
|
|
50898
|
-
}while (!endOfHeader);
|
|
50899
|
-
if (!findFormat) {
|
|
50900
|
-
throw "HDR Bad header format, unsupported FORMAT";
|
|
50901
|
-
}
|
|
50902
|
-
lineIndex += line.length + 1;
|
|
50903
|
-
line = this._readStringLine(uint8array, lineIndex);
|
|
50904
|
-
var sizeRegexp = /^\-Y (.*) \+X (.*)$/g;
|
|
50905
|
-
var match = sizeRegexp.exec(line);
|
|
50906
|
-
// TODO. Support +Y and -X if needed.
|
|
50907
|
-
if (!match || match.length < 3) {
|
|
50908
|
-
throw "HDR Bad header format, no size";
|
|
50909
|
-
}
|
|
50910
|
-
width = parseInt(match[2]);
|
|
50911
|
-
height = parseInt(match[1]);
|
|
50912
|
-
if (width < 8 || width > 0x7fff) {
|
|
50913
|
-
throw "HDR Bad header format, unsupported size";
|
|
50914
|
-
}
|
|
50915
|
-
lineIndex += line.length + 1;
|
|
50916
|
-
return {
|
|
50917
|
-
height: height,
|
|
50918
|
-
width: width,
|
|
50919
|
-
dataPosition: lineIndex
|
|
50920
|
-
};
|
|
50921
|
-
};
|
|
50922
|
-
HDRLoader._readPixels = function _readPixels(buffer, width, height) {
|
|
50923
|
-
var scanLineWidth = width;
|
|
50924
|
-
var byteLength = buffer.byteLength;
|
|
50925
|
-
var dataRGBA = new Uint8Array(4 * width * height);
|
|
50926
|
-
var offset = 0, pos = 0;
|
|
50927
|
-
var ptrEnd = 4 * scanLineWidth;
|
|
50928
|
-
var scanLineBuffer = new Uint8Array(ptrEnd);
|
|
50929
|
-
var numScanLines = height; // read in each successive scanLine
|
|
50930
|
-
while(numScanLines > 0 && pos < byteLength){
|
|
50931
|
-
var a = buffer[pos++];
|
|
50932
|
-
var b = buffer[pos++];
|
|
50933
|
-
var c = buffer[pos++];
|
|
50934
|
-
var d = buffer[pos++];
|
|
50935
|
-
if (a != 2 || b != 2 || c & 0x80 || width < 8 || width > 32767) {
|
|
50936
|
-
// this file is not run length encoded
|
|
50937
|
-
// read values sequentially
|
|
50938
|
-
return buffer;
|
|
50939
|
-
}
|
|
50940
|
-
if ((c << 8 | d) != scanLineWidth) {
|
|
50941
|
-
// eslint-disable-next-line no-throw-literal
|
|
50942
|
-
throw "HDR Bad header format, wrong scan line width";
|
|
50943
|
-
}
|
|
50944
|
-
// read each of the four channels for the scanline into the buffer
|
|
50945
|
-
// first red, then green, then blue, then exponent
|
|
50946
|
-
var ptr = 0, count = void 0;
|
|
50947
|
-
while(ptr < ptrEnd && pos < byteLength){
|
|
50948
|
-
count = buffer[pos++];
|
|
50949
|
-
var isEncodedRun = count > 128;
|
|
50950
|
-
if (isEncodedRun) count -= 128;
|
|
50951
|
-
if (0 === count || ptr + count > ptrEnd) {
|
|
50952
|
-
throw "HDR Bad Format, bad scanline data (run)";
|
|
50953
|
-
}
|
|
50954
|
-
if (isEncodedRun) {
|
|
50955
|
-
// a (encoded) run of the same value
|
|
50956
|
-
var byteValue = buffer[pos++];
|
|
50957
|
-
for(var i = 0; i < count; i++){
|
|
50958
|
-
scanLineBuffer[ptr++] = byteValue;
|
|
50959
|
-
} //ptr += count;
|
|
50960
|
-
} else {
|
|
50961
|
-
// a literal-run
|
|
50962
|
-
scanLineBuffer.set(buffer.subarray(pos, pos + count), ptr);
|
|
50963
|
-
ptr += count;
|
|
50964
|
-
pos += count;
|
|
50965
|
-
}
|
|
50966
|
-
} // now convert data from buffer into rgba
|
|
50967
|
-
// first red, then green, then blue, then exponent (alpha)
|
|
50968
|
-
var l = scanLineWidth; //scanLine_buffer.byteLength;
|
|
50969
|
-
for(var i1 = 0; i1 < l; i1++){
|
|
50970
|
-
var off = 0;
|
|
50971
|
-
dataRGBA[offset] = scanLineBuffer[i1 + off];
|
|
50972
|
-
off += scanLineWidth;
|
|
50973
|
-
dataRGBA[offset + 1] = scanLineBuffer[i1 + off];
|
|
50974
|
-
off += scanLineWidth;
|
|
50975
|
-
dataRGBA[offset + 2] = scanLineBuffer[i1 + off];
|
|
50976
|
-
off += scanLineWidth;
|
|
50977
|
-
dataRGBA[offset + 3] = scanLineBuffer[i1 + off];
|
|
50978
|
-
offset += 4;
|
|
50979
|
-
}
|
|
50980
|
-
numScanLines--;
|
|
50981
|
-
}
|
|
50982
|
-
return dataRGBA;
|
|
50983
|
-
};
|
|
50984
|
-
HDRLoader._RGBEToLinear = function _RGBEToLinear(color) {
|
|
50985
|
-
var scaleFactor = Math.pow(2, color.a - 128) / 255;
|
|
50986
|
-
color.r *= scaleFactor;
|
|
50987
|
-
color.g *= scaleFactor;
|
|
50988
|
-
color.b *= scaleFactor;
|
|
50989
|
-
color.a = 1;
|
|
50990
|
-
};
|
|
50991
|
-
HDRLoader._linearToRGBM = function _linearToRGBM(color, maxRange) {
|
|
50992
|
-
var maxRGB = Math.max(color.r, Math.max(color.g, color.b));
|
|
50993
|
-
var M = Math.min(maxRGB / maxRange, 1);
|
|
50994
|
-
M = Math.ceil(M * 255);
|
|
50995
|
-
var scaleFactor = 65025 / (M * maxRange); // 255 * (255 / (M * maxRange) )
|
|
50996
|
-
color.r *= scaleFactor;
|
|
50997
|
-
color.g *= scaleFactor;
|
|
50998
|
-
color.b *= scaleFactor;
|
|
50999
|
-
color.a *= M;
|
|
51000
|
-
};
|
|
51001
|
-
return HDRLoader;
|
|
51002
|
-
}(Loader);
|
|
51003
|
-
HDRLoader._rightBottomBack = new Vector3(1.0, -1.0, -1.0);
|
|
51004
|
-
HDRLoader._rightBottomFront = new Vector3(1.0, -1.0, 1.0);
|
|
51005
|
-
HDRLoader._rightUpBack = new Vector3(1.0, 1.0, -1.0);
|
|
51006
|
-
HDRLoader._rightUpFront = new Vector3(1.0, 1.0, 1.0);
|
|
51007
|
-
HDRLoader._leftBottomBack = new Vector3(-1.0, -1.0, -1.0);
|
|
51008
|
-
HDRLoader._leftBottomFront = new Vector3(-1.0, -1.0, 1.0);
|
|
51009
|
-
HDRLoader._leftUpBack = new Vector3(-1.0, 1.0, -1.0);
|
|
51010
|
-
HDRLoader._leftUpFront = new Vector3(-1.0, 1.0, 1.0);
|
|
51011
|
-
HDRLoader._faceRight = [
|
|
51012
|
-
HDRLoader._rightBottomBack,
|
|
51013
|
-
HDRLoader._rightBottomFront,
|
|
51014
|
-
HDRLoader._rightUpBack,
|
|
51015
|
-
HDRLoader._rightUpFront
|
|
51016
|
-
];
|
|
51017
|
-
HDRLoader._faceLeft = [
|
|
51018
|
-
HDRLoader._leftBottomFront,
|
|
51019
|
-
HDRLoader._leftBottomBack,
|
|
51020
|
-
HDRLoader._leftUpFront,
|
|
51021
|
-
HDRLoader._leftUpBack
|
|
51022
|
-
];
|
|
51023
|
-
HDRLoader._faceUp = [
|
|
51024
|
-
HDRLoader._leftBottomFront,
|
|
51025
|
-
HDRLoader._rightBottomFront,
|
|
51026
|
-
HDRLoader._leftBottomBack,
|
|
51027
|
-
HDRLoader._rightBottomBack
|
|
51028
|
-
];
|
|
51029
|
-
HDRLoader._faceBottom = [
|
|
51030
|
-
HDRLoader._leftUpBack,
|
|
51031
|
-
HDRLoader._rightUpBack,
|
|
51032
|
-
HDRLoader._leftUpFront,
|
|
51033
|
-
HDRLoader._rightUpFront
|
|
51034
|
-
];
|
|
51035
|
-
HDRLoader._faceFront = [
|
|
51036
|
-
HDRLoader._leftBottomBack,
|
|
51037
|
-
HDRLoader._rightBottomBack,
|
|
51038
|
-
HDRLoader._leftUpBack,
|
|
51039
|
-
HDRLoader._rightUpBack
|
|
51040
|
-
];
|
|
51041
|
-
HDRLoader._faceBack = [
|
|
51042
|
-
HDRLoader._rightBottomFront,
|
|
51043
|
-
HDRLoader._leftBottomFront,
|
|
51044
|
-
HDRLoader._rightUpFront,
|
|
51045
|
-
HDRLoader._leftUpFront
|
|
51046
|
-
];
|
|
51047
|
-
HDRLoader._tempVector3 = new Vector3();
|
|
51048
|
-
HDRLoader._temp2Vector3 = new Vector3();
|
|
51049
|
-
HDRLoader._temp3Vector3 = new Vector3();
|
|
51050
|
-
HDRLoader._temp4Vector3 = new Vector3();
|
|
51051
|
-
HDRLoader._temp5Vector3 = new Vector3();
|
|
51052
|
-
HDRLoader = __decorate([
|
|
51053
|
-
resourceLoader(AssetType.HDR, [
|
|
51054
|
-
"hdr"
|
|
51055
|
-
])
|
|
51056
|
-
], HDRLoader);
|
|
51057
|
-
/**
|
|
51058
|
-
* @internal
|
|
51059
|
-
*/ var HDRContentRestorer = /*#__PURE__*/ function(ContentRestorer) {
|
|
51060
|
-
_inherits(HDRContentRestorer, ContentRestorer);
|
|
51061
|
-
function HDRContentRestorer(resource, url, requestConfig) {
|
|
51062
|
-
var _this;
|
|
51063
|
-
_this = ContentRestorer.call(this, resource) || this, _this.url = url, _this.requestConfig = requestConfig;
|
|
51064
|
-
return _this;
|
|
51065
|
-
}
|
|
51066
|
-
var _proto = HDRContentRestorer.prototype;
|
|
51067
|
-
_proto.restoreContent = function restoreContent() {
|
|
51068
|
-
var _this = this;
|
|
51069
|
-
return new AssetPromise(function(resolve, reject) {
|
|
51070
|
-
var resource = _this.resource;
|
|
51071
|
-
var engine = resource.engine;
|
|
51072
|
-
engine.resourceManager // @ts-ignore
|
|
51073
|
-
._request(_this.url, _this.requestConfig).then(function(buffer) {
|
|
51074
|
-
HDRLoader._setTextureByBuffer(engine, buffer, resource);
|
|
51075
|
-
resolve(resource);
|
|
51076
|
-
}).catch(reject);
|
|
51077
|
-
});
|
|
51078
|
-
};
|
|
51079
|
-
return HDRContentRestorer;
|
|
51080
|
-
}(ContentRestorer);
|
|
51081
50667
|
var JSONLoader = /*#__PURE__*/ function(Loader) {
|
|
51082
50668
|
_inherits(JSONLoader, Loader);
|
|
51083
50669
|
function JSONLoader() {
|
|
@@ -51473,7 +51059,7 @@ var MaterialLoader = /*#__PURE__*/ function(Loader) {
|
|
|
51473
51059
|
}(Loader);
|
|
51474
51060
|
MaterialLoader = __decorate([
|
|
51475
51061
|
resourceLoader(AssetType.Material, [
|
|
51476
|
-
"
|
|
51062
|
+
"mat"
|
|
51477
51063
|
])
|
|
51478
51064
|
], MaterialLoader);
|
|
51479
51065
|
var MeshLoader = /*#__PURE__*/ function(Loader) {
|
|
@@ -51593,7 +51179,7 @@ var ProjectLoader = /*#__PURE__*/ function(Loader) {
|
|
|
51593
51179
|
}(Loader);
|
|
51594
51180
|
ProjectLoader = __decorate([
|
|
51595
51181
|
resourceLoader(AssetType.Project, [
|
|
51596
|
-
"
|
|
51182
|
+
"project"
|
|
51597
51183
|
], false)
|
|
51598
51184
|
], ProjectLoader);
|
|
51599
51185
|
var SourceFontLoader = /*#__PURE__*/ function(Loader) {
|
|
@@ -51809,27 +51395,20 @@ TextLoader = __decorate([
|
|
|
51809
51395
|
"txt"
|
|
51810
51396
|
])
|
|
51811
51397
|
], TextLoader);
|
|
51812
|
-
|
|
51813
|
-
|
|
51814
|
-
|
|
51815
|
-
|
|
51816
|
-
|
|
51817
|
-
var
|
|
51818
|
-
|
|
51819
|
-
|
|
51820
|
-
|
|
51821
|
-
|
|
51822
|
-
|
|
51823
|
-
|
|
51824
|
-
|
|
51825
|
-
|
|
51826
|
-
resource.setImageSource(image);
|
|
51827
|
-
resource.generateMipmaps();
|
|
51828
|
-
return resource;
|
|
51829
|
-
});
|
|
51830
|
-
};
|
|
51831
|
-
return Texture2DContentRestorer;
|
|
51832
|
-
}(ContentRestorer);
|
|
51398
|
+
function loadImageFromBuffer(buffer) {
|
|
51399
|
+
return new AssetPromise(function(resolve, reject) {
|
|
51400
|
+
var blob = new Blob([
|
|
51401
|
+
buffer
|
|
51402
|
+
]);
|
|
51403
|
+
var img = new Image();
|
|
51404
|
+
img.onload = function() {
|
|
51405
|
+
URL.revokeObjectURL(img.src);
|
|
51406
|
+
resolve(img);
|
|
51407
|
+
};
|
|
51408
|
+
img.onerror = reject;
|
|
51409
|
+
img.src = URL.createObjectURL(blob);
|
|
51410
|
+
});
|
|
51411
|
+
}
|
|
51833
51412
|
var Texture2DLoader = /*#__PURE__*/ function(Loader) {
|
|
51834
51413
|
_inherits(Texture2DLoader, Loader);
|
|
51835
51414
|
function Texture2DLoader() {
|
|
@@ -51837,36 +51416,48 @@ var Texture2DLoader = /*#__PURE__*/ function(Loader) {
|
|
|
51837
51416
|
}
|
|
51838
51417
|
var _proto = Texture2DLoader.prototype;
|
|
51839
51418
|
_proto.load = function load(item, resourceManager) {
|
|
51419
|
+
var _this = this;
|
|
51420
|
+
var url = item.url;
|
|
51421
|
+
var requestConfig = _extends({}, item, {
|
|
51422
|
+
type: "arraybuffer"
|
|
51423
|
+
});
|
|
51840
51424
|
return new AssetPromise(function(resolve, reject, setTaskCompleteProgress, setTaskDetailProgress) {
|
|
51841
|
-
var url = item.url;
|
|
51842
|
-
var requestConfig = _extends({}, item, {
|
|
51843
|
-
type: "image"
|
|
51844
|
-
});
|
|
51845
51425
|
resourceManager // @ts-ignore
|
|
51846
|
-
._request(url, requestConfig).onProgress(setTaskCompleteProgress, setTaskDetailProgress).then(function(
|
|
51847
|
-
|
|
51848
|
-
|
|
51849
|
-
|
|
51850
|
-
|
|
51851
|
-
|
|
51852
|
-
|
|
51853
|
-
|
|
51854
|
-
|
|
51855
|
-
|
|
51856
|
-
|
|
51857
|
-
|
|
51858
|
-
generateMipmap && texture.generateMipmaps();
|
|
51859
|
-
if (url.indexOf("data:") !== 0) {
|
|
51860
|
-
var index = url.lastIndexOf("/");
|
|
51861
|
-
texture.name = url.substring(index + 1);
|
|
51426
|
+
._request(url, requestConfig).onProgress(setTaskCompleteProgress, setTaskDetailProgress).then(function(buffer) {
|
|
51427
|
+
if (FileHeader.checkMagic(buffer)) {
|
|
51428
|
+
decode(buffer, resourceManager.engine).then(function(texture) {
|
|
51429
|
+
resourceManager.addContentRestorer(new Texture2DContentRestorer(texture, url, requestConfig));
|
|
51430
|
+
resolve(texture);
|
|
51431
|
+
}, reject);
|
|
51432
|
+
} else {
|
|
51433
|
+
loadImageFromBuffer(buffer).then(function(img) {
|
|
51434
|
+
var texture = _this._createTexture(img, item, resourceManager);
|
|
51435
|
+
resourceManager.addContentRestorer(new Texture2DContentRestorer(texture, url, requestConfig));
|
|
51436
|
+
resolve(texture);
|
|
51437
|
+
}, reject);
|
|
51862
51438
|
}
|
|
51863
|
-
|
|
51864
|
-
resolve(texture);
|
|
51865
|
-
}).catch(function(e) {
|
|
51866
|
-
reject(e);
|
|
51867
|
-
});
|
|
51439
|
+
}).catch(reject);
|
|
51868
51440
|
});
|
|
51869
51441
|
};
|
|
51442
|
+
_proto._createTexture = function _createTexture(img, item, resourceManager) {
|
|
51443
|
+
var _item_params;
|
|
51444
|
+
var _ref = (_item_params = item.params) != null ? _item_params : {}, _ref_format = _ref.format, format = _ref_format === void 0 ? TextureFormat.R8G8B8A8 : _ref_format, anisoLevel = _ref.anisoLevel, wrapModeU = _ref.wrapModeU, wrapModeV = _ref.wrapModeV, filterMode = _ref.filterMode, _ref_isSRGBColorSpace = _ref.isSRGBColorSpace, isSRGBColorSpace = _ref_isSRGBColorSpace === void 0 ? true : _ref_isSRGBColorSpace, _ref_mipmap = _ref.mipmap, mipmap = _ref_mipmap === void 0 ? true : _ref_mipmap;
|
|
51445
|
+
var width = img.width, height = img.height;
|
|
51446
|
+
var engine = resourceManager.engine;
|
|
51447
|
+
var generateMipmap = TextureUtils.supportGenerateMipmapsWithCorrection(engine, width, height, format, mipmap, isSRGBColorSpace);
|
|
51448
|
+
var texture = new Texture2D(engine, width, height, format, generateMipmap, isSRGBColorSpace);
|
|
51449
|
+
texture.anisoLevel = anisoLevel != null ? anisoLevel : texture.anisoLevel;
|
|
51450
|
+
texture.filterMode = filterMode != null ? filterMode : texture.filterMode;
|
|
51451
|
+
texture.wrapModeU = wrapModeU != null ? wrapModeU : texture.wrapModeU;
|
|
51452
|
+
texture.wrapModeV = wrapModeV != null ? wrapModeV : texture.wrapModeV;
|
|
51453
|
+
texture.setImageSource(img);
|
|
51454
|
+
generateMipmap && texture.generateMipmaps();
|
|
51455
|
+
var url = item.url;
|
|
51456
|
+
if (url.indexOf("data:") !== 0) {
|
|
51457
|
+
texture.name = url.substring(url.lastIndexOf("/") + 1);
|
|
51458
|
+
}
|
|
51459
|
+
return texture;
|
|
51460
|
+
};
|
|
51870
51461
|
return Texture2DLoader;
|
|
51871
51462
|
}(Loader);
|
|
51872
51463
|
Texture2DLoader = __decorate([
|
|
@@ -51874,38 +51465,317 @@ Texture2DLoader = __decorate([
|
|
|
51874
51465
|
"png",
|
|
51875
51466
|
"jpg",
|
|
51876
51467
|
"webp",
|
|
51877
|
-
"jpeg"
|
|
51468
|
+
"jpeg",
|
|
51469
|
+
"tex"
|
|
51878
51470
|
])
|
|
51879
51471
|
], Texture2DLoader);
|
|
51880
|
-
|
|
51881
|
-
|
|
51882
|
-
|
|
51883
|
-
_inherits(TextureCubeContentRestorer, ContentRestorer);
|
|
51884
|
-
function TextureCubeContentRestorer(resource, urls, requestConfig) {
|
|
51472
|
+
var Texture2DContentRestorer = /*#__PURE__*/ function(ContentRestorer) {
|
|
51473
|
+
_inherits(Texture2DContentRestorer, ContentRestorer);
|
|
51474
|
+
function Texture2DContentRestorer(resource, url, requestConfig) {
|
|
51885
51475
|
var _this;
|
|
51886
|
-
_this = ContentRestorer.call(this, resource) || this, _this.
|
|
51476
|
+
_this = ContentRestorer.call(this, resource) || this, _this.url = url, _this.requestConfig = requestConfig;
|
|
51887
51477
|
return _this;
|
|
51888
51478
|
}
|
|
51889
|
-
var _proto =
|
|
51479
|
+
var _proto = Texture2DContentRestorer.prototype;
|
|
51890
51480
|
_proto.restoreContent = function restoreContent() {
|
|
51891
|
-
var
|
|
51892
|
-
|
|
51893
|
-
|
|
51894
|
-
|
|
51895
|
-
|
|
51896
|
-
|
|
51897
|
-
|
|
51898
|
-
|
|
51899
|
-
|
|
51900
|
-
|
|
51901
|
-
|
|
51902
|
-
|
|
51903
|
-
|
|
51904
|
-
});
|
|
51481
|
+
var texture = this.resource;
|
|
51482
|
+
var engine = texture.engine;
|
|
51483
|
+
return engine.resourceManager // @ts-ignore
|
|
51484
|
+
._request(this.url, this.requestConfig).then(function(buffer) {
|
|
51485
|
+
if (FileHeader.checkMagic(buffer)) {
|
|
51486
|
+
return decode(buffer, engine, texture);
|
|
51487
|
+
} else {
|
|
51488
|
+
return loadImageFromBuffer(buffer).then(function(img) {
|
|
51489
|
+
texture.setImageSource(img);
|
|
51490
|
+
texture.generateMipmaps();
|
|
51491
|
+
return texture;
|
|
51492
|
+
});
|
|
51493
|
+
}
|
|
51905
51494
|
});
|
|
51906
51495
|
};
|
|
51907
|
-
return
|
|
51496
|
+
return Texture2DContentRestorer;
|
|
51908
51497
|
}(ContentRestorer);
|
|
51498
|
+
/**
|
|
51499
|
+
* @internal
|
|
51500
|
+
* HDR panorama to cubemap decoder.
|
|
51501
|
+
*/ var HDRDecoder = /*#__PURE__*/ function() {
|
|
51502
|
+
function HDRDecoder() {}
|
|
51503
|
+
HDRDecoder.parseHeader = function parseHeader(uint8array) {
|
|
51504
|
+
var line = this._readStringLine(uint8array, 0);
|
|
51505
|
+
if (line[0] !== "#" || line[1] !== "?") {
|
|
51506
|
+
throw "HDRDecoder: invalid file header";
|
|
51507
|
+
}
|
|
51508
|
+
var endOfHeader = false;
|
|
51509
|
+
var findFormat = false;
|
|
51510
|
+
var lineIndex = 0;
|
|
51511
|
+
do {
|
|
51512
|
+
lineIndex += line.length + 1;
|
|
51513
|
+
line = this._readStringLine(uint8array, lineIndex);
|
|
51514
|
+
if (line === "FORMAT=32-bit_rle_rgbe") findFormat = true;
|
|
51515
|
+
else if (line.length === 0) endOfHeader = true;
|
|
51516
|
+
}while (!endOfHeader);
|
|
51517
|
+
if (!findFormat) {
|
|
51518
|
+
throw "HDRDecoder: unsupported format, expected 32-bit_rle_rgbe";
|
|
51519
|
+
}
|
|
51520
|
+
lineIndex += line.length + 1;
|
|
51521
|
+
line = this._readStringLine(uint8array, lineIndex);
|
|
51522
|
+
var match = /^\-Y (.*) \+X (.*)$/g.exec(line);
|
|
51523
|
+
if (!match || match.length < 3) {
|
|
51524
|
+
throw "HDRDecoder: missing image size, only -Y +X layout is supported";
|
|
51525
|
+
}
|
|
51526
|
+
var width = parseInt(match[2]);
|
|
51527
|
+
var height = parseInt(match[1]);
|
|
51528
|
+
if (width < 8 || width > 0x7fff) {
|
|
51529
|
+
throw "HDRDecoder: unsupported image width, must be between 8 and 32767";
|
|
51530
|
+
}
|
|
51531
|
+
return {
|
|
51532
|
+
height: height,
|
|
51533
|
+
width: width,
|
|
51534
|
+
dataPosition: lineIndex + line.length + 1
|
|
51535
|
+
};
|
|
51536
|
+
};
|
|
51537
|
+
HDRDecoder.decodeFaces = function decodeFaces(bufferArray, header, onFace) {
|
|
51538
|
+
var width = header.width, height = header.height, dataPosition = header.dataPosition;
|
|
51539
|
+
var cubeSize = height >> 1;
|
|
51540
|
+
var pixels = HDRDecoder._readPixels(bufferArray.subarray(dataPosition), width, height);
|
|
51541
|
+
var faces = HDRDecoder._faces;
|
|
51542
|
+
var faceBuffer = new Uint16Array(cubeSize * cubeSize * 4);
|
|
51543
|
+
for(var faceIndex = 0; faceIndex < 6; faceIndex++){
|
|
51544
|
+
HDRDecoder._createCubemapData(cubeSize, faces[faceIndex], pixels, width, height, faceBuffer);
|
|
51545
|
+
onFace(faceIndex, faceBuffer);
|
|
51546
|
+
}
|
|
51547
|
+
};
|
|
51548
|
+
HDRDecoder._generateFloat2HalfTables = function _generateFloat2HalfTables() {
|
|
51549
|
+
var baseTable = new Uint32Array(512);
|
|
51550
|
+
var shiftTable = new Uint32Array(512);
|
|
51551
|
+
for(var i = 0; i < 256; ++i){
|
|
51552
|
+
var e = i - 127;
|
|
51553
|
+
if (e < -27) {
|
|
51554
|
+
baseTable[i] = 0x0000;
|
|
51555
|
+
baseTable[i | 0x100] = 0x8000;
|
|
51556
|
+
shiftTable[i] = 24;
|
|
51557
|
+
shiftTable[i | 0x100] = 24;
|
|
51558
|
+
} else if (e < -14) {
|
|
51559
|
+
baseTable[i] = 0x0400 >> -e - 14;
|
|
51560
|
+
baseTable[i | 0x100] = 0x0400 >> -e - 14 | 0x8000;
|
|
51561
|
+
shiftTable[i] = -e - 1;
|
|
51562
|
+
shiftTable[i | 0x100] = -e - 1;
|
|
51563
|
+
} else if (e <= 15) {
|
|
51564
|
+
baseTable[i] = e + 15 << 10;
|
|
51565
|
+
baseTable[i | 0x100] = e + 15 << 10 | 0x8000;
|
|
51566
|
+
shiftTable[i] = 13;
|
|
51567
|
+
shiftTable[i | 0x100] = 13;
|
|
51568
|
+
} else if (e < 128) {
|
|
51569
|
+
baseTable[i] = 0x7c00;
|
|
51570
|
+
baseTable[i | 0x100] = 0xfc00;
|
|
51571
|
+
shiftTable[i] = 24;
|
|
51572
|
+
shiftTable[i | 0x100] = 24;
|
|
51573
|
+
} else {
|
|
51574
|
+
baseTable[i] = 0x7c00;
|
|
51575
|
+
baseTable[i | 0x100] = 0xfc00;
|
|
51576
|
+
shiftTable[i] = 13;
|
|
51577
|
+
shiftTable[i | 0x100] = 13;
|
|
51578
|
+
}
|
|
51579
|
+
}
|
|
51580
|
+
return {
|
|
51581
|
+
baseTable: baseTable,
|
|
51582
|
+
shiftTable: shiftTable
|
|
51583
|
+
};
|
|
51584
|
+
};
|
|
51585
|
+
HDRDecoder._createCubemapData = function _createCubemapData(texSize, face, pixels, inputWidth, inputHeight, facePixels) {
|
|
51586
|
+
var invSize = 1 / texSize;
|
|
51587
|
+
var rotDX1X = (face[3] - face[0]) * invSize;
|
|
51588
|
+
var rotDX1Y = (face[4] - face[1]) * invSize;
|
|
51589
|
+
var rotDX1Z = (face[5] - face[2]) * invSize;
|
|
51590
|
+
var rotDX2X = (face[9] - face[6]) * invSize;
|
|
51591
|
+
var rotDX2Y = (face[10] - face[7]) * invSize;
|
|
51592
|
+
var rotDX2Z = (face[11] - face[8]) * invSize;
|
|
51593
|
+
var floatView = HDRDecoder._floatView;
|
|
51594
|
+
var uint32View = HDRDecoder._uint32View;
|
|
51595
|
+
var _HDRDecoder__float2HalfTables = HDRDecoder._float2HalfTables, baseTable = _HDRDecoder__float2HalfTables.baseTable, shiftTable = _HDRDecoder__float2HalfTables.shiftTable;
|
|
51596
|
+
var one = HDRDecoder._one;
|
|
51597
|
+
var fy = 0;
|
|
51598
|
+
for(var y = 0; y < texSize; y++){
|
|
51599
|
+
var xv1X = face[0], xv1Y = face[1], xv1Z = face[2];
|
|
51600
|
+
var xv2X = face[6], xv2Y = face[7], xv2Z = face[8];
|
|
51601
|
+
for(var x = 0; x < texSize; x++){
|
|
51602
|
+
var dirX = xv1X + (xv2X - xv1X) * fy;
|
|
51603
|
+
var dirY = xv1Y + (xv2Y - xv1Y) * fy;
|
|
51604
|
+
var dirZ = xv1Z + (xv2Z - xv1Z) * fy;
|
|
51605
|
+
var invLen = 1 / Math.sqrt(dirX * dirX + dirY * dirY + dirZ * dirZ);
|
|
51606
|
+
dirX *= invLen;
|
|
51607
|
+
dirY *= invLen;
|
|
51608
|
+
dirZ *= invLen;
|
|
51609
|
+
var px = Math.round((Math.atan2(dirZ, dirX) / Math.PI * 0.5 + 0.5) * inputWidth);
|
|
51610
|
+
if (px < 0) px = 0;
|
|
51611
|
+
else if (px >= inputWidth) px = inputWidth - 1;
|
|
51612
|
+
var py = Math.round(Math.acos(dirY) / Math.PI * inputHeight);
|
|
51613
|
+
if (py < 0) py = 0;
|
|
51614
|
+
else if (py >= inputHeight) py = inputHeight - 1;
|
|
51615
|
+
var srcIndex = (inputHeight - py - 1) * inputWidth * 4 + px * 4;
|
|
51616
|
+
var scaleFactor = Math.pow(2, pixels[srcIndex + 3] - 128) / 255;
|
|
51617
|
+
var dstIndex = y * texSize * 4 + x * 4;
|
|
51618
|
+
for(var c = 0; c < 3; c++){
|
|
51619
|
+
floatView[0] = pixels[srcIndex + c] * scaleFactor;
|
|
51620
|
+
var f = uint32View[0];
|
|
51621
|
+
var e = f >> 23 & 0x1ff;
|
|
51622
|
+
facePixels[dstIndex + c] = baseTable[e] + ((f & 0x007fffff) >> shiftTable[e]);
|
|
51623
|
+
}
|
|
51624
|
+
facePixels[dstIndex + 3] = one;
|
|
51625
|
+
xv1X += rotDX1X;
|
|
51626
|
+
xv1Y += rotDX1Y;
|
|
51627
|
+
xv1Z += rotDX1Z;
|
|
51628
|
+
xv2X += rotDX2X;
|
|
51629
|
+
xv2Y += rotDX2Y;
|
|
51630
|
+
xv2Z += rotDX2Z;
|
|
51631
|
+
}
|
|
51632
|
+
fy += invSize;
|
|
51633
|
+
}
|
|
51634
|
+
};
|
|
51635
|
+
HDRDecoder._readStringLine = function _readStringLine(uint8array, startIndex) {
|
|
51636
|
+
var line = "";
|
|
51637
|
+
for(var i = startIndex, n = uint8array.length; i < n; i++){
|
|
51638
|
+
var character = String.fromCharCode(uint8array[i]);
|
|
51639
|
+
if (character === "\n") break;
|
|
51640
|
+
line += character;
|
|
51641
|
+
}
|
|
51642
|
+
return line;
|
|
51643
|
+
};
|
|
51644
|
+
HDRDecoder._readPixels = function _readPixels(buffer, width, height) {
|
|
51645
|
+
var byteLength = buffer.byteLength;
|
|
51646
|
+
var dataRGBA = new Uint8Array(4 * width * height);
|
|
51647
|
+
var offset = 0;
|
|
51648
|
+
var pos = 0;
|
|
51649
|
+
var ptrEnd = 4 * width;
|
|
51650
|
+
var scanLineBuffer = new Uint8Array(ptrEnd);
|
|
51651
|
+
var numScanLines = height;
|
|
51652
|
+
while(numScanLines > 0 && pos < byteLength){
|
|
51653
|
+
var a = buffer[pos++];
|
|
51654
|
+
var b = buffer[pos++];
|
|
51655
|
+
var c = buffer[pos++];
|
|
51656
|
+
var d = buffer[pos++];
|
|
51657
|
+
if (a !== 2 || b !== 2 || c & 0x80 || width < 8 || width > 32767) return buffer;
|
|
51658
|
+
if ((c << 8 | d) !== width) throw "HDRDecoder: wrong scanline width";
|
|
51659
|
+
var ptr = 0;
|
|
51660
|
+
while(ptr < ptrEnd && pos < byteLength){
|
|
51661
|
+
var count = buffer[pos++];
|
|
51662
|
+
var isEncodedRun = count > 128;
|
|
51663
|
+
if (isEncodedRun) count -= 128;
|
|
51664
|
+
if (count === 0 || ptr + count > ptrEnd) throw "HDRDecoder: bad scanline data";
|
|
51665
|
+
if (isEncodedRun) {
|
|
51666
|
+
var byteValue = buffer[pos++];
|
|
51667
|
+
for(var i = 0; i < count; i++)scanLineBuffer[ptr++] = byteValue;
|
|
51668
|
+
} else {
|
|
51669
|
+
scanLineBuffer.set(buffer.subarray(pos, pos + count), ptr);
|
|
51670
|
+
ptr += count;
|
|
51671
|
+
pos += count;
|
|
51672
|
+
}
|
|
51673
|
+
}
|
|
51674
|
+
for(var i1 = 0; i1 < width; i1++, offset += 4){
|
|
51675
|
+
dataRGBA[offset] = scanLineBuffer[i1];
|
|
51676
|
+
dataRGBA[offset + 1] = scanLineBuffer[i1 + width];
|
|
51677
|
+
dataRGBA[offset + 2] = scanLineBuffer[i1 + width * 2];
|
|
51678
|
+
dataRGBA[offset + 3] = scanLineBuffer[i1 + width * 3];
|
|
51679
|
+
}
|
|
51680
|
+
numScanLines--;
|
|
51681
|
+
}
|
|
51682
|
+
return dataRGBA;
|
|
51683
|
+
};
|
|
51684
|
+
return HDRDecoder;
|
|
51685
|
+
}();
|
|
51686
|
+
// Float32 to Float16 lookup tables (http://www.fox-toolkit.org/ftp/fasthalffloatconversion.pdf)
|
|
51687
|
+
HDRDecoder._float2HalfTables = HDRDecoder._generateFloat2HalfTables();
|
|
51688
|
+
HDRDecoder._floatView = new Float32Array(1);
|
|
51689
|
+
HDRDecoder._uint32View = new Uint32Array(HDRDecoder._floatView.buffer);
|
|
51690
|
+
HDRDecoder._one = 0x3c00 // Half float for 1.0
|
|
51691
|
+
;
|
|
51692
|
+
// prettier-ignore
|
|
51693
|
+
HDRDecoder._faces = [
|
|
51694
|
+
/* +X */ [
|
|
51695
|
+
1,
|
|
51696
|
+
-1,
|
|
51697
|
+
-1,
|
|
51698
|
+
1,
|
|
51699
|
+
-1,
|
|
51700
|
+
1,
|
|
51701
|
+
1,
|
|
51702
|
+
1,
|
|
51703
|
+
-1,
|
|
51704
|
+
1,
|
|
51705
|
+
1,
|
|
51706
|
+
1
|
|
51707
|
+
],
|
|
51708
|
+
/* -X */ [
|
|
51709
|
+
-1,
|
|
51710
|
+
-1,
|
|
51711
|
+
1,
|
|
51712
|
+
-1,
|
|
51713
|
+
-1,
|
|
51714
|
+
-1,
|
|
51715
|
+
-1,
|
|
51716
|
+
1,
|
|
51717
|
+
1,
|
|
51718
|
+
-1,
|
|
51719
|
+
1,
|
|
51720
|
+
-1
|
|
51721
|
+
],
|
|
51722
|
+
/* +Y */ [
|
|
51723
|
+
-1,
|
|
51724
|
+
-1,
|
|
51725
|
+
1,
|
|
51726
|
+
1,
|
|
51727
|
+
-1,
|
|
51728
|
+
1,
|
|
51729
|
+
-1,
|
|
51730
|
+
-1,
|
|
51731
|
+
-1,
|
|
51732
|
+
1,
|
|
51733
|
+
-1,
|
|
51734
|
+
-1
|
|
51735
|
+
],
|
|
51736
|
+
/* -Y */ [
|
|
51737
|
+
-1,
|
|
51738
|
+
1,
|
|
51739
|
+
-1,
|
|
51740
|
+
1,
|
|
51741
|
+
1,
|
|
51742
|
+
-1,
|
|
51743
|
+
-1,
|
|
51744
|
+
1,
|
|
51745
|
+
1,
|
|
51746
|
+
1,
|
|
51747
|
+
1,
|
|
51748
|
+
1
|
|
51749
|
+
],
|
|
51750
|
+
/* +Z */ [
|
|
51751
|
+
-1,
|
|
51752
|
+
-1,
|
|
51753
|
+
-1,
|
|
51754
|
+
1,
|
|
51755
|
+
-1,
|
|
51756
|
+
-1,
|
|
51757
|
+
-1,
|
|
51758
|
+
1,
|
|
51759
|
+
-1,
|
|
51760
|
+
1,
|
|
51761
|
+
1,
|
|
51762
|
+
-1
|
|
51763
|
+
],
|
|
51764
|
+
/* -Z */ [
|
|
51765
|
+
1,
|
|
51766
|
+
-1,
|
|
51767
|
+
1,
|
|
51768
|
+
-1,
|
|
51769
|
+
-1,
|
|
51770
|
+
1,
|
|
51771
|
+
1,
|
|
51772
|
+
1,
|
|
51773
|
+
1,
|
|
51774
|
+
-1,
|
|
51775
|
+
1,
|
|
51776
|
+
1
|
|
51777
|
+
]
|
|
51778
|
+
];
|
|
51909
51779
|
var TextureCubeLoader = /*#__PURE__*/ function(Loader) {
|
|
51910
51780
|
_inherits(TextureCubeLoader, Loader);
|
|
51911
51781
|
function TextureCubeLoader() {
|
|
@@ -51913,6 +51783,44 @@ var TextureCubeLoader = /*#__PURE__*/ function(Loader) {
|
|
|
51913
51783
|
}
|
|
51914
51784
|
var _proto = TextureCubeLoader.prototype;
|
|
51915
51785
|
_proto.load = function load(item, resourceManager) {
|
|
51786
|
+
if (item.urls) {
|
|
51787
|
+
return this._loadCubeFaces(item, resourceManager);
|
|
51788
|
+
} else {
|
|
51789
|
+
return this._loadHDR(item, resourceManager);
|
|
51790
|
+
}
|
|
51791
|
+
};
|
|
51792
|
+
_proto._loadHDR = function _loadHDR(item, resourceManager) {
|
|
51793
|
+
return new AssetPromise(function(resolve, reject) {
|
|
51794
|
+
var engine = resourceManager.engine;
|
|
51795
|
+
var url = item.url;
|
|
51796
|
+
var requestConfig = _extends({}, item, {
|
|
51797
|
+
type: "arraybuffer"
|
|
51798
|
+
});
|
|
51799
|
+
resourceManager // @ts-ignore
|
|
51800
|
+
._request(url, requestConfig).then(function(buffer) {
|
|
51801
|
+
if (!SystemInfo.supportsTextureFormat(engine, TextureFormat.R16G16B16A16)) {
|
|
51802
|
+
reject(new Error("TextureCubeLoader: HDR texture requires half float support."));
|
|
51803
|
+
return;
|
|
51804
|
+
}
|
|
51805
|
+
var _item_params;
|
|
51806
|
+
var _ref = (_item_params = item.params) != null ? _item_params : {}, _ref_mipmap = _ref.mipmap, mipmap = _ref_mipmap === void 0 ? true : _ref_mipmap, anisoLevel = _ref.anisoLevel, wrapModeU = _ref.wrapModeU, wrapModeV = _ref.wrapModeV, filterMode = _ref.filterMode;
|
|
51807
|
+
var bufferArray = new Uint8Array(buffer);
|
|
51808
|
+
var header = HDRDecoder.parseHeader(bufferArray);
|
|
51809
|
+
var texture = new TextureCube(engine, header.height >> 1, TextureFormat.R16G16B16A16, mipmap, false);
|
|
51810
|
+
HDRDecoder.decodeFaces(bufferArray, header, function(faceIndex, data) {
|
|
51811
|
+
texture.setPixelBuffer(TextureCubeFace.PositiveX + faceIndex, data, 0);
|
|
51812
|
+
});
|
|
51813
|
+
texture.generateMipmaps();
|
|
51814
|
+
texture.anisoLevel = anisoLevel != null ? anisoLevel : texture.anisoLevel;
|
|
51815
|
+
texture.filterMode = filterMode != null ? filterMode : texture.filterMode;
|
|
51816
|
+
texture.wrapModeU = wrapModeU != null ? wrapModeU : texture.wrapModeU;
|
|
51817
|
+
texture.wrapModeV = wrapModeV != null ? wrapModeV : texture.wrapModeV;
|
|
51818
|
+
resourceManager.addContentRestorer(new HDRContentRestorer(texture, url, requestConfig));
|
|
51819
|
+
resolve(texture);
|
|
51820
|
+
}).catch(reject);
|
|
51821
|
+
});
|
|
51822
|
+
};
|
|
51823
|
+
_proto._loadCubeFaces = function _loadCubeFaces(item, resourceManager) {
|
|
51916
51824
|
return new AssetPromise(function(resolve, reject) {
|
|
51917
51825
|
var urls = item.urls;
|
|
51918
51826
|
var requestConfig = _extends({}, item, {
|
|
@@ -51926,7 +51834,7 @@ var TextureCubeLoader = /*#__PURE__*/ function(Loader) {
|
|
|
51926
51834
|
var _ref = (_item_params = item.params) != null ? _item_params : {}, _ref_format = _ref.format, format = _ref_format === void 0 ? TextureFormat.R8G8B8A8 : _ref_format, anisoLevel = _ref.anisoLevel, wrapModeU = _ref.wrapModeU, wrapModeV = _ref.wrapModeV, filterMode = _ref.filterMode, _ref_isSRGBColorSpace = _ref.isSRGBColorSpace, isSRGBColorSpace = _ref_isSRGBColorSpace === void 0 ? true : _ref_isSRGBColorSpace, _ref_mipmap = _ref.mipmap, mipmap = _ref_mipmap === void 0 ? true : _ref_mipmap;
|
|
51927
51835
|
var _images_ = images[0], width = _images_.width, height = _images_.height;
|
|
51928
51836
|
if (width !== height) {
|
|
51929
|
-
|
|
51837
|
+
reject(new Error("The cube texture must have the same width and height"));
|
|
51930
51838
|
return;
|
|
51931
51839
|
}
|
|
51932
51840
|
var engine = resourceManager.engine;
|
|
@@ -51939,21 +51847,70 @@ var TextureCubeLoader = /*#__PURE__*/ function(Loader) {
|
|
|
51939
51847
|
for(var faceIndex = 0; faceIndex < 6; faceIndex++){
|
|
51940
51848
|
texture.setImageSource(TextureCubeFace.PositiveX + faceIndex, images[faceIndex], 0);
|
|
51941
51849
|
}
|
|
51942
|
-
|
|
51943
|
-
resourceManager.addContentRestorer(new
|
|
51850
|
+
texture.generateMipmaps();
|
|
51851
|
+
resourceManager.addContentRestorer(new CubeFaceContentRestorer(texture, urls, requestConfig));
|
|
51944
51852
|
resolve(texture);
|
|
51945
|
-
}).catch(
|
|
51946
|
-
reject(e);
|
|
51947
|
-
});
|
|
51853
|
+
}).catch(reject);
|
|
51948
51854
|
});
|
|
51949
51855
|
};
|
|
51950
51856
|
return TextureCubeLoader;
|
|
51951
51857
|
}(Loader);
|
|
51952
51858
|
TextureCubeLoader = __decorate([
|
|
51953
51859
|
resourceLoader(AssetType.TextureCube, [
|
|
51954
|
-
""
|
|
51860
|
+
"texCube",
|
|
51861
|
+
"hdr"
|
|
51955
51862
|
])
|
|
51956
51863
|
], TextureCubeLoader);
|
|
51864
|
+
var HDRContentRestorer = /*#__PURE__*/ function(ContentRestorer) {
|
|
51865
|
+
_inherits(HDRContentRestorer, ContentRestorer);
|
|
51866
|
+
function HDRContentRestorer(resource, url, requestConfig) {
|
|
51867
|
+
var _this;
|
|
51868
|
+
_this = ContentRestorer.call(this, resource) || this, _this.url = url, _this.requestConfig = requestConfig;
|
|
51869
|
+
return _this;
|
|
51870
|
+
}
|
|
51871
|
+
var _proto = HDRContentRestorer.prototype;
|
|
51872
|
+
_proto.restoreContent = function restoreContent() {
|
|
51873
|
+
var _this = this;
|
|
51874
|
+
return new AssetPromise(function(resolve, reject) {
|
|
51875
|
+
var resource = _this.resource;
|
|
51876
|
+
resource.engine.resourceManager // @ts-ignore
|
|
51877
|
+
._request(_this.url, _this.requestConfig).then(function(buffer) {
|
|
51878
|
+
var bufferArray = new Uint8Array(buffer);
|
|
51879
|
+
HDRDecoder.decodeFaces(bufferArray, HDRDecoder.parseHeader(bufferArray), function(faceIndex, data) {
|
|
51880
|
+
resource.setPixelBuffer(TextureCubeFace.PositiveX + faceIndex, data, 0);
|
|
51881
|
+
});
|
|
51882
|
+
resource.generateMipmaps();
|
|
51883
|
+
resolve(resource);
|
|
51884
|
+
}).catch(reject);
|
|
51885
|
+
});
|
|
51886
|
+
};
|
|
51887
|
+
return HDRContentRestorer;
|
|
51888
|
+
}(ContentRestorer);
|
|
51889
|
+
var CubeFaceContentRestorer = /*#__PURE__*/ function(ContentRestorer) {
|
|
51890
|
+
_inherits(CubeFaceContentRestorer, ContentRestorer);
|
|
51891
|
+
function CubeFaceContentRestorer(resource, urls, requestConfig) {
|
|
51892
|
+
var _this;
|
|
51893
|
+
_this = ContentRestorer.call(this, resource) || this, _this.urls = urls, _this.requestConfig = requestConfig;
|
|
51894
|
+
return _this;
|
|
51895
|
+
}
|
|
51896
|
+
var _proto = CubeFaceContentRestorer.prototype;
|
|
51897
|
+
_proto.restoreContent = function restoreContent() {
|
|
51898
|
+
var _this = this;
|
|
51899
|
+
return new AssetPromise(function(resolve, reject) {
|
|
51900
|
+
Promise.all(_this.urls.map(function(url) {
|
|
51901
|
+
return request(url, _this.requestConfig);
|
|
51902
|
+
})).then(function(images) {
|
|
51903
|
+
var resource = _this.resource;
|
|
51904
|
+
for(var faceIndex = 0; faceIndex < 6; faceIndex++){
|
|
51905
|
+
resource.setImageSource(TextureCubeFace.PositiveX + faceIndex, images[faceIndex], 0);
|
|
51906
|
+
}
|
|
51907
|
+
resource.generateMipmaps();
|
|
51908
|
+
resolve(resource);
|
|
51909
|
+
}).catch(reject);
|
|
51910
|
+
});
|
|
51911
|
+
};
|
|
51912
|
+
return CubeFaceContentRestorer;
|
|
51913
|
+
}(ContentRestorer);
|
|
51957
51914
|
var AudioLoader = /*#__PURE__*/ function(Loader) {
|
|
51958
51915
|
_inherits(AudioLoader, Loader);
|
|
51959
51916
|
function AudioLoader() {
|
|
@@ -52099,7 +52056,7 @@ var PhysicsMaterialLoader = /*#__PURE__*/ function(Loader) {
|
|
|
52099
52056
|
}(Loader);
|
|
52100
52057
|
PhysicsMaterialLoader = __decorate([
|
|
52101
52058
|
resourceLoader(AssetType.PhysicsMaterial, [
|
|
52102
|
-
"
|
|
52059
|
+
"physMat"
|
|
52103
52060
|
])
|
|
52104
52061
|
], PhysicsMaterialLoader);
|
|
52105
52062
|
var SceneLoader = /*#__PURE__*/ function(Loader) {
|
|
@@ -52133,7 +52090,6 @@ var SceneLoader = /*#__PURE__*/ function(Loader) {
|
|
|
52133
52090
|
scene.ambientLight.specularIntensity = ambient.specularIntensity;
|
|
52134
52091
|
scene.ambientLight.diffuseMode = ambient.diffuseMode;
|
|
52135
52092
|
scene.ambientLight.diffuseSolidColor.copyFrom(ambient.diffuseSolidColor);
|
|
52136
|
-
scene.ambientLight.specularTextureDecodeRGBM = true;
|
|
52137
52093
|
if (useCustomAmbient && ambient.customAmbientLight) {
|
|
52138
52094
|
promises.push(resourceManager.getResourceByRef(ambient.customAmbientLight).then(function(ambientLight) {
|
|
52139
52095
|
scene.ambientLight.specularTexture = ambientLight == null ? void 0 : ambientLight.specularTexture;
|
|
@@ -52751,11 +52707,11 @@ EXT_texture_webp = __decorate([
|
|
|
52751
52707
|
], EXT_texture_webp);
|
|
52752
52708
|
|
|
52753
52709
|
//@ts-ignore
|
|
52754
|
-
var version = "2.0.0-alpha.
|
|
52710
|
+
var version = "2.0.0-alpha.7";
|
|
52755
52711
|
console.log("Galacean Engine Version: " + version);
|
|
52756
52712
|
for(var key in CoreObjects){
|
|
52757
52713
|
Loader.registerClass(key, CoreObjects[key]);
|
|
52758
52714
|
}
|
|
52759
52715
|
|
|
52760
|
-
export { AccessorType, AmbientLight, AmbientOcclusion, AmbientOcclusionQuality, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationClipDecoder, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationRectCurve, AnimationRefCurve, AnimationStringCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorCondition, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorControllerParameter, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorLayerMask, AnimatorState, AnimatorStateMachine, AnimatorStateTransition, AntiAliasing, AssetPromise, AssetType, AudioClip, AudioManager, AudioSource, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, BasicRenderPipeline, BatchUtils, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlendState, BlinnPhongMaterial, Blitter, BloomDownScaleMode, BloomEffect, BoolUpdateFlag, BoundingBox, BoundingFrustum, BoundingSphere, BoxColliderShape, BoxShape, Buffer, BufferAsset, BufferBindFlag, BufferInfo, BufferMesh, BufferReader, BufferUsage, BufferUtil, Burst, Camera, CameraClearFlags, CameraModifyFlags, CameraType$1 as CameraType, Canvas, CapsuleColliderShape, CharRenderInfo, CharacterController, CircleShape, ClearableObjectPool, CloneManager, Collider, ColliderShape, ColliderShapeUpAxis, Collision, CollisionDetectionMode, CollisionUtil, Color, ColorOverLifetimeModule, ColorWriteMask, CompareFunction, Component, ConeEmitType, ConeShape, ContactPoint, ContainmentType, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, CurveKey, DataType, DependentMode, DepthState, DepthTextureMode, DiffuseMode, DirectLight, DisorderedArray, Downsampling, DynamicCollider, DynamicColliderConstraints,
|
|
52716
|
+
export { AccessorType, AmbientLight, AmbientOcclusion, AmbientOcclusionQuality, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationClipDecoder, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationRectCurve, AnimationRefCurve, AnimationStringCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorCondition, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorControllerParameter, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorLayerMask, AnimatorState, AnimatorStateMachine, AnimatorStateTransition, AntiAliasing, AssetPromise, AssetType, AudioClip, AudioManager, AudioSource, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, BasicRenderPipeline, BatchUtils, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlendState, BlinnPhongMaterial, Blitter, BloomDownScaleMode, BloomEffect, BoolUpdateFlag, BoundingBox, BoundingFrustum, BoundingSphere, BoxColliderShape, BoxShape, Buffer, BufferAsset, BufferBindFlag, BufferInfo, BufferMesh, BufferReader, BufferUsage, BufferUtil, Burst, Camera, CameraClearFlags, CameraModifyFlags, CameraType$1 as CameraType, Canvas, CapsuleColliderShape, CharRenderInfo, CharacterController, CircleShape, ClearableObjectPool, CloneManager, Collider, ColliderShape, ColliderShapeUpAxis, Collision, CollisionDetectionMode, CollisionUtil, Color, ColorOverLifetimeModule, ColorWriteMask, CompareFunction, Component, ConeEmitType, ConeShape, ContactPoint, ContainmentType, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, CurveKey, DataType, DependentMode, DepthState, DepthTextureMode, DiffuseMode, DirectLight, DisorderedArray, Downsampling, DynamicCollider, DynamicColliderConstraints, EmissionModule, Engine, EngineObject, Entity, EntityModifyFlags, EventDispatcher, FileHeader, FinalPass, FixedJoint, FogMode, Font, FontStyle, FrustumFace, GLCapabilityType, GLCompressedTextureInternalFormat, GLTFAnimationParser, GLTFAnimatorControllerParser, GLTFBufferParser, GLTFBufferViewParser, GLTFEntityParser, GLTFExtensionMode, GLTFExtensionParser, GLTFLoader, GLTFMaterialParser, GLTFMeshParser, GLTFParser, GLTFParserContext, GLTFParserType, GLTFResource, GLTFSceneParser, GLTFSchemaParser, GLTFSkinParser, GLTFTextureParser, GLTFUtils, GLTFValidator, GradientAlphaKey, GradientColorKey, HemisphereShape, HierarchyParser, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolableValueType, InterpolationType, JSONAsset, Joint, JointLimits, JointMotor, KTX2Loader, KTX2TargetFormat, Keyframe, Keys, Layer, LayerPathMask, Light, Loader, Logger, MSAASamples, MainModule, Material, MaterialLoaderType, MathUtil, Matrix, Matrix3x3, Mesh, MeshColliderShape, MeshColliderShapeCookingFlag, MeshDecoder, MeshRenderer, MeshShape, MeshTopology, ModelMesh, OverflowMode, PBRMaterial, ParserContext, ParserType, ParticleCompositeCurve, ParticleCompositeGradient, ParticleCurve, ParticleCurveMode, ParticleGenerator, ParticleGradient, ParticleGradientMode, ParticleMaterial, ParticleRenderMode, ParticleRenderer, ParticleScaleMode, ParticleShapeArcMode, ParticleShapeType, ParticleSimulationSpace, ParticleStopMode, PhysicsMaterial, PhysicsMaterialCombineMode, PhysicsScene, PipelineStage, Plane, PlaneColliderShape, PlaneIntersectionType, Platform, PointLight, Pointer, PointerButton, PointerEventData, PointerEventEmitter, PointerPhase, PostProcess, PostProcessEffect, PostProcessEffectBoolParameter, PostProcessEffectColorParameter, PostProcessEffectEnumParameter, PostProcessEffectFloatParameter, PostProcessEffectParameter, PostProcessEffectTextureParameter, PostProcessEffectVector2Parameter, PostProcessEffectVector3Parameter, PostProcessEffectVector4Parameter, PostProcessManager, PostProcessPass, PostProcessPassEvent, PostProcessUberPass, PrefabResource, Primitive, PrimitiveMesh, Probe, Quaternion, Rand, RasterState, Ray, Rect, ReferResource, ReflectionParser, RefractionMode, RenderBufferDepthFormat, RenderFace, RenderQueue, RenderQueueFlags, RenderQueueType, RenderState, RenderStateElementKey, RenderTarget, RenderTargetBlendState, Renderer, RendererUpdateFlags, RenderingStatistics, ReplacementFailureStrategy, ResourceManager, ReturnableObjectPool, RotationOverLifetimeModule, SafeLoopArray, Scene, SceneManager, SceneParser, Script, SetDataOptions, Shader, ShaderData, ShaderDataGroup, ShaderFactory, ShaderLanguage, ShaderLib, ShaderMacro, ShaderMacroCollection, ShaderPass, ShaderProperty, ShaderPropertyType, ShaderTagKey, ShadowCascadesMode, ShadowResolution, ShadowType, SimpleSpriteAssembler, SizeOverLifetimeModule, Skin, SkinnedMeshRenderer, Sky, SkyBoxMaterial, SkyProceduralMaterial, SlicedSpriteAssembler, SpecularMode, SphereColliderShape, SphereShape, SphericalHarmonics3, SpotLight, SpringJoint, Sprite, SpriteAtlas, SpriteDrawMode, SpriteMask, SpriteMaskInteraction, SpriteMaskLayer, SpriteModifyFlags, SpriteRenderer, SpriteTileMode, StateMachineScript, StaticCollider, StencilOperation, StencilState, SubFont, SubMesh, SubPrimitive, SubShader, SunMode, SystemInfo, TextAsset, TextHorizontalAlignment, TextRenderer, TextUtils, TextVerticalAlignment, Texture, Texture2D, Texture2DArray, Texture2DDecoder, TextureCoordinate, TextureCube, TextureCubeFace, TextureDepthCompareFunction, TextureFilterMode, TextureFormat, TextureSheetAnimationModule, TextureUsage, TextureUtils, TextureWrapMode$1 as TextureWrapMode, TiledSpriteAssembler, Time, TonemappingEffect, TonemappingMode, TrailMaterial, TrailRenderer, TrailTextureMode, Transform, TransformModifyFlags, UnlitMaterial, Utils, Vector2, Vector3, Vector4, VelocityOverLifetimeModule, VertexAttribute, VertexBufferBinding, VertexElement, VertexElementFormat, WebCanvas, WebGLEngine, WebGLGraphicDevice, WebGLMode, WrapMode, XRManager, assignmentClone, decode, decoder, decoderMap, deepClone, dependentComponents, ignoreClone, parseSingleKTX, registerGLTFExtension, registerGLTFParser, registerPointerEventEmitter, request, resourceLoader, shallowClone, version };
|
|
52761
52717
|
//# sourceMappingURL=bundled.module.js.map
|