@galacean/engine 2.0.0-alpha.23 → 2.0.0-alpha.25
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 +382 -469
- 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 +381 -468
- 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
|
@@ -9848,7 +9848,7 @@ var pbr_frag_define = "#define MIN_PERCEPTUAL_ROUGHNESS 0.045\n#define MIN_ROUGH
|
|
|
9848
9848
|
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
|
|
9849
9849
|
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
|
|
9850
9850
|
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
|
|
9851
|
-
var ibl_frag_define = "// ------------------------Diffuse------------------------\n\n// sh need be pre-scaled in CPU.\nvec3 getLightProbeIrradiance(vec3 sh[9], vec3 normal){\n
|
|
9851
|
+
var ibl_frag_define = "// ------------------------Diffuse------------------------\n\n// sh need be pre-scaled in CPU.\nvec3 getLightProbeIrradiance(vec3 sh[9], vec3 normal){\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\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
|
|
9852
9852
|
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
|
|
9853
9853
|
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
|
|
9854
9854
|
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
|
|
@@ -9886,7 +9886,7 @@ var particle_feedback_simulation = "// Transform Feedback update shader for part
|
|
|
9886
9886
|
var sphere_billboard = "#ifdef RENDERER_MODE_SPHERE_BILLBOARD\n\tvec2 corner = a_CornerTextureCoordinate.xy + renderer_PivotOffset.xy;\n\tvec3 sideVector = normalize(cross(camera_Forward, camera_Up));\n\tvec3 upVector = normalize(cross(sideVector, camera_Forward));\n\tcorner *= computeParticleSizeBillboard(a_StartSize.xy, normalizedAge);\n #if defined(RENDERER_ROL_CONSTANT_MODE) || defined(RENDERER_ROL_CURVE_MODE)\n if (renderer_ThreeDStartRotation) {\n vec3 rotation = radians(vec3(a_StartRotation0.xy, computeParticleRotationFloat(a_StartRotation0.z, age, normalizedAge)));\n center += renderer_SizeScale.xzy * rotationByEuler(corner.x * sideVector + corner.y * upVector, rotation);\n } else {\n float rot = radians(computeParticleRotationFloat(a_StartRotation0.x, age, normalizedAge));\n float c = cos(rot);\n float s = sin(rot);\n mat2 rotation = mat2(c, -s, s, c);\n corner = rotation * corner;\n center += renderer_SizeScale.xzy * (corner.x * sideVector + corner.y * upVector);\n }\n #else\n if (renderer_ThreeDStartRotation) {\n center += renderer_SizeScale.xzy * rotationByEuler(corner.x * sideVector + corner.y * upVector, radians(a_StartRotation0));\n } else {\n float c = cos(radians(a_StartRotation0.x));\n float s = sin(radians(a_StartRotation0.x));\n mat2 rotation = mat2(c, -s, s, c);\n corner = rotation * corner;\n center += renderer_SizeScale.xzy * (corner.x * sideVector + corner.y * upVector);\n }\n #endif\n#endif"; // eslint-disable-line
|
|
9887
9887
|
var stretched_billboard = "#ifdef RENDERER_MODE_STRETCHED_BILLBOARD\n\tvec2 corner = a_CornerTextureCoordinate.xy + renderer_PivotOffset.xy;\n\tvec3 velocity = rotationByQuaternions(renderer_SizeScale * localVelocity, worldRotation) + worldVelocity;\n\tvec3 cameraUpVector = normalize(velocity);\n\tvec3 direction = normalize(center - camera_Position);\n\tvec3 sideVector = normalize(cross(direction, normalize(velocity)));\n\n\tsideVector = renderer_SizeScale.xzy * sideVector;\n\tcameraUpVector = length(vec3(renderer_SizeScale.x, 0.0, 0.0)) * cameraUpVector;\n\n\tvec2 size = computeParticleSizeBillboard(a_StartSize.xy, normalizedAge);\n\n\tconst mat2 rotationZHalfPI = mat2(0.0, -1.0, 1.0, 0.0);\n\tcorner = rotationZHalfPI * corner;\n\tcorner.y = corner.y - abs(corner.y);\n\n\tfloat speed = length(velocity); // TODO:\n\tcenter += sign(renderer_SizeScale.x) * (sign(renderer_StretchedBillboardLengthScale) * size.x * corner.x * sideVector\n\t + (speed * renderer_StretchedBillboardSpeedScale + size.y * renderer_StretchedBillboardLengthScale) * corner.y * cameraUpVector);\n#endif"; // eslint-disable-line
|
|
9888
9888
|
var vertical_billboard = "#ifdef RENDERER_MODE_VERTICAL_BILLBOARD\n\tvec2 corner = a_CornerTextureCoordinate.xy + renderer_PivotOffset.xy; // Billboard模式z轴无效\n\tconst vec3 cameraUpVector = vec3(0.0, 1.0, 0.0);\n\tvec3 sideVector = normalize(cross(camera_Forward, cameraUpVector));\n\n\tfloat rot = radians(computeParticleRotationFloat(a_StartRotation0.x, age, normalizedAge));\n\tfloat c = cos(rot);\n\tfloat s = sin(rot);\n\tmat2 rotation = mat2(c, -s, s, c);\n\tcorner = rotation * corner * cos(0.78539816339744830961566084581988); // TODO:临时缩小cos45,不确定U3D原因\n\tcorner *= computeParticleSizeBillboard(a_StartSize.xy, normalizedAge);\n\tcenter += renderer_SizeScale.xzy * (corner.x * sideVector + corner.y * cameraUpVector);\n#endif"; // eslint-disable-line
|
|
9889
|
-
var horizontal_billboard = "#ifdef RENDERER_MODE_HORIZONTAL_BILLBOARD\n\tvec2 corner = a_CornerTextureCoordinate.xy + renderer_PivotOffset.xy
|
|
9889
|
+
var horizontal_billboard = "#ifdef RENDERER_MODE_HORIZONTAL_BILLBOARD\n\tvec2 corner = a_CornerTextureCoordinate.xy + renderer_PivotOffset.xy;\n\tconst vec3 sideVector = vec3(1.0, 0.0, 0.0);\n\tconst vec3 upVector = vec3(0.0, 0.0, -1.0);\n\tcorner *= computeParticleSizeBillboard(a_StartSize.xy, normalizedAge);\n\n\t// HorizontalBillboard rotates in XZ plane (around Y-axis normal).\n\t// Uses Z-axis rotation data to match Unity behavior.\n\tfloat rot;\n\tif (renderer_ThreeDStartRotation) {\n\t\trot = radians(computeParticleRotationFloat(a_StartRotation0.z, age, normalizedAge));\n\t} else {\n\t\trot = radians(computeParticleRotationFloat(a_StartRotation0.x, age, normalizedAge));\n\t}\n\n\tfloat c = cos(rot);\n\tfloat s = sin(rot);\n\tmat2 rotation = mat2(c, -s, s, c);\n\tcorner = rotation * corner;\n\tcenter += renderer_SizeScale.xzy * (corner.x * sideVector + corner.y * upVector);\n#endif"; // eslint-disable-line
|
|
9890
9890
|
var particle_mesh = "// Only support local alignment mode\n#ifdef RENDERER_MODE_MESH\n #if defined(RENDERER_ROL_CONSTANT_MODE) || defined(RENDERER_ROL_CURVE_MODE)\n #define RENDERER_ROL_ENABLED\n #endif\n\n\tvec3 size = computeParticleSizeMesh(a_StartSize, normalizedAge);\n\n bool is3DRotation = renderer_ThreeDStartRotation;\n #if defined(RENDERER_ROL_ENABLED) && defined(RENDERER_ROL_IS_SEPARATE)\n is3DRotation = true;\n #endif\n\n if (is3DRotation) {\n #ifdef RENDERER_ROL_ENABLED\n vec3 startRotation = renderer_ThreeDStartRotation ? a_StartRotation0 : vec3(0.0, 0.0, a_StartRotation0.x);\n vec3 rotation = radians(computeParticleRotationVec3(startRotation, age, normalizedAge));\n #else\n vec3 rotation = radians(a_StartRotation0);\n #endif\n // 3D Start Rotation is same in local and world simulation space\n center += rotationByQuaternions(renderer_SizeScale * rotationByEuler(POSITION * size, rotation), worldRotation);\n } else {\n #ifdef RENDERER_ROL_ENABLED\n float angle = radians(computeParticleRotationFloat(a_StartRotation0.x, age, normalizedAge));\n #else\n float angle = radians(a_StartRotation0.x);\n #endif\n #ifdef RENDERER_EMISSION_SHAPE\n // Axis is side vector of emit position look at zero\n vec3 axis = vec3(a_ShapePositionStartLifeTime.xy, 0.0);\n if (renderer_SimulationSpace == 1){\n axis = rotationByQuaternions(axis, worldRotation);\n }\n vec3 crossResult = cross(axis, vec3(0.0, 0.0, -1.0));\n float crossLen = length(crossResult);\n vec3 rotateAxis = crossLen > 0.0001 ? crossResult / crossLen : vec3(0.0, 1.0, 0.0);\n #else\n // Axis is negative z\n vec3 rotateAxis = vec3(0.0, 0.0, -1.0);\n #endif\n center += rotationByQuaternions(renderer_SizeScale *rotationByAxis(POSITION * size, rotateAxis, angle), worldRotation);\n }\n #ifdef RENDERER_ENABLE_VERTEXCOLOR\n\t\tv_MeshColor = COLOR_0;\n\t#endif\n#endif"; // eslint-disable-line
|
|
9891
9891
|
var ParticleShaderLib = {
|
|
9892
9892
|
particle_common: particle_common,
|
|
@@ -28937,8 +28937,7 @@ PrimitiveChunk.subMeshPool = new ReturnableObjectPool(SubMesh, 10);
|
|
|
28937
28937
|
/** Plain text. */ AssetType["Text"] = "Text";
|
|
28938
28938
|
/** JSON. */ AssetType["JSON"] = "JSON";
|
|
28939
28939
|
/** ArrayBuffer. */ AssetType["Buffer"] = "Buffer";
|
|
28940
|
-
/**
|
|
28941
|
-
/** Cube Texture. */ AssetType["TextureCube"] = "TextureCube";
|
|
28940
|
+
/** Texture. */ AssetType["Texture"] = "Texture";
|
|
28942
28941
|
/** Material. */ AssetType["Material"] = "Material";
|
|
28943
28942
|
/** Shader. */ AssetType["Shader"] = "Shader";
|
|
28944
28943
|
/** Mesh. */ AssetType["Mesh"] = "Mesh";
|
|
@@ -31139,7 +31138,7 @@ var pbrVs = "#include <common>\n#include <common_vert>\n#include <blendShape_inp
|
|
|
31139
31138
|
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
|
|
31140
31139
|
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
|
|
31141
31140
|
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
|
|
31142
|
-
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 =
|
|
31141
|
+
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 = POSITION;\n gl_Position = camera_VPMat * rotateY(vec4(POSITION, 1.0), material_Rotation);\n}\n"; // eslint-disable-line
|
|
31143
31142
|
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
|
|
31144
31143
|
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
|
|
31145
31144
|
var spriteFs = "#include <common>\nuniform sampler2D renderer_SpriteTexture;\n\nvarying vec2 v_uv;\nvarying vec4 v_color;\n\nvoid main()\n{\n vec4 baseColor = texture2DSRGB(renderer_SpriteTexture, v_uv);\n gl_FragColor = baseColor * v_color;\n}\n"; // eslint-disable-line
|
|
@@ -38077,7 +38076,8 @@ var ParticleStopMode = /*#__PURE__*/ function(ParticleStopMode) {
|
|
|
38077
38076
|
renderModeMacro = ParticleRenderer._stretchedBillboardModeMacro;
|
|
38078
38077
|
break;
|
|
38079
38078
|
case ParticleRenderMode.HorizontalBillboard:
|
|
38080
|
-
|
|
38079
|
+
renderModeMacro = ParticleRenderer._horizontalBillboardModeMacro;
|
|
38080
|
+
break;
|
|
38081
38081
|
case ParticleRenderMode.VerticalBillboard:
|
|
38082
38082
|
throw "Not implemented";
|
|
38083
38083
|
case ParticleRenderMode.Mesh:
|
|
@@ -47710,11 +47710,189 @@ var ReflectionParser = /*#__PURE__*/ function() {
|
|
|
47710
47710
|
};
|
|
47711
47711
|
return ReflectionParser;
|
|
47712
47712
|
}();
|
|
47713
|
-
|
|
47713
|
+
/**
|
|
47714
|
+
* HDR (Radiance RGBE) image decoder.
|
|
47715
|
+
*
|
|
47716
|
+
* Decodes .hdr files into pixel data. Supports parsing the header
|
|
47717
|
+
* and decoding RLE-compressed RGBE scanlines into R16G16B16A16 half-float pixels.
|
|
47718
|
+
*/ var HDRDecoder = /*#__PURE__*/ function() {
|
|
47719
|
+
function HDRDecoder() {}
|
|
47720
|
+
/**
|
|
47721
|
+
* Parse the header of an HDR file.
|
|
47722
|
+
* @returns Header info including width, height, and data start position.
|
|
47723
|
+
*/ HDRDecoder.parseHeader = function parseHeader(uint8array) {
|
|
47724
|
+
var line = this._readStringLine(uint8array, 0);
|
|
47725
|
+
if (line[0] !== "#" || line[1] !== "?") {
|
|
47726
|
+
throw "HDRDecoder: invalid file header";
|
|
47727
|
+
}
|
|
47728
|
+
var endOfHeader = false;
|
|
47729
|
+
var findFormat = false;
|
|
47730
|
+
var lineIndex = 0;
|
|
47731
|
+
do {
|
|
47732
|
+
lineIndex += line.length + 1;
|
|
47733
|
+
line = this._readStringLine(uint8array, lineIndex);
|
|
47734
|
+
if (line === "FORMAT=32-bit_rle_rgbe") findFormat = true;
|
|
47735
|
+
else if (line.length === 0) endOfHeader = true;
|
|
47736
|
+
}while (!endOfHeader);
|
|
47737
|
+
if (!findFormat) {
|
|
47738
|
+
throw "HDRDecoder: unsupported format, expected 32-bit_rle_rgbe";
|
|
47739
|
+
}
|
|
47740
|
+
lineIndex += line.length + 1;
|
|
47741
|
+
line = this._readStringLine(uint8array, lineIndex);
|
|
47742
|
+
var match = /^\-Y (.*) \+X (.*)$/g.exec(line);
|
|
47743
|
+
if (!match || match.length < 3) {
|
|
47744
|
+
throw "HDRDecoder: missing image size, only -Y +X layout is supported";
|
|
47745
|
+
}
|
|
47746
|
+
var width = parseInt(match[2]);
|
|
47747
|
+
var height = parseInt(match[1]);
|
|
47748
|
+
if (width < 8 || width > 0x7fff) {
|
|
47749
|
+
throw "HDRDecoder: unsupported image width, must be between 8 and 32767";
|
|
47750
|
+
}
|
|
47751
|
+
return {
|
|
47752
|
+
height: height,
|
|
47753
|
+
width: width,
|
|
47754
|
+
dataPosition: lineIndex + line.length + 1
|
|
47755
|
+
};
|
|
47756
|
+
};
|
|
47757
|
+
/**
|
|
47758
|
+
* Decode an HDR file buffer into R16G16B16A16 half-float pixel data.
|
|
47759
|
+
* @param buffer - The full HDR file as Uint8Array.
|
|
47760
|
+
* @returns Object with width, height, and half-float pixel data.
|
|
47761
|
+
*/ HDRDecoder.decode = function decode(buffer) {
|
|
47762
|
+
var header = this.parseHeader(buffer);
|
|
47763
|
+
var width = header.width, height = header.height, dataPosition = header.dataPosition;
|
|
47764
|
+
var rgbe = this._readPixels(buffer.subarray(dataPosition), width, height);
|
|
47765
|
+
var pixels = this._rgbeToHalfFloat(rgbe, width, height);
|
|
47766
|
+
return {
|
|
47767
|
+
width: width,
|
|
47768
|
+
height: height,
|
|
47769
|
+
pixels: pixels
|
|
47770
|
+
};
|
|
47771
|
+
};
|
|
47772
|
+
/**
|
|
47773
|
+
* Convert RGBE pixel data to R16G16B16A16 half-float.
|
|
47774
|
+
*/ HDRDecoder._rgbeToHalfFloat = function _rgbeToHalfFloat(rgbe, width, height) {
|
|
47775
|
+
var floatView = this._floatView;
|
|
47776
|
+
var uint32View = this._uint32View;
|
|
47777
|
+
var _this__float2HalfTables = this._float2HalfTables, baseTable = _this__float2HalfTables.baseTable, shiftTable = _this__float2HalfTables.shiftTable;
|
|
47778
|
+
var one = 0x3c00; // Half float 1.0
|
|
47779
|
+
var pixelCount = width * height;
|
|
47780
|
+
var result = new Uint16Array(pixelCount * 4);
|
|
47781
|
+
for(var i = 0; i < pixelCount; i++){
|
|
47782
|
+
var srcIdx = i * 4;
|
|
47783
|
+
var dstIdx = i * 4;
|
|
47784
|
+
var scaleFactor = Math.pow(2, rgbe[srcIdx + 3] - 128 - 8);
|
|
47785
|
+
for(var c = 0; c < 3; c++){
|
|
47786
|
+
floatView[0] = Math.min(rgbe[srcIdx + c] * scaleFactor, 65504);
|
|
47787
|
+
var f = uint32View[0];
|
|
47788
|
+
var e = f >> 23 & 0x1ff;
|
|
47789
|
+
result[dstIdx + c] = baseTable[e] + ((f & 0x007fffff) >> shiftTable[e]);
|
|
47790
|
+
}
|
|
47791
|
+
result[dstIdx + 3] = one;
|
|
47792
|
+
}
|
|
47793
|
+
return result;
|
|
47794
|
+
};
|
|
47795
|
+
/**
|
|
47796
|
+
* Decode RLE-compressed RGBE scanlines into raw RGBE pixel data.
|
|
47797
|
+
*/ HDRDecoder._readPixels = function _readPixels(buffer, width, height) {
|
|
47798
|
+
var byteLength = buffer.byteLength;
|
|
47799
|
+
var dataRGBA = new Uint8Array(4 * width * height);
|
|
47800
|
+
var offset = 0;
|
|
47801
|
+
var pos = 0;
|
|
47802
|
+
var ptrEnd = 4 * width;
|
|
47803
|
+
var scanLineBuffer = new Uint8Array(ptrEnd);
|
|
47804
|
+
var numScanLines = height;
|
|
47805
|
+
while(numScanLines > 0 && pos < byteLength){
|
|
47806
|
+
var a = buffer[pos++];
|
|
47807
|
+
var b = buffer[pos++];
|
|
47808
|
+
var c = buffer[pos++];
|
|
47809
|
+
var d = buffer[pos++];
|
|
47810
|
+
if (a !== 2 || b !== 2 || c & 0x80 || width < 8 || width > 32767) return buffer;
|
|
47811
|
+
if ((c << 8 | d) !== width) throw "HDRDecoder: wrong scanline width";
|
|
47812
|
+
var ptr = 0;
|
|
47813
|
+
while(ptr < ptrEnd && pos < byteLength){
|
|
47814
|
+
var count = buffer[pos++];
|
|
47815
|
+
var isEncodedRun = count > 128;
|
|
47816
|
+
if (isEncodedRun) count -= 128;
|
|
47817
|
+
if (count === 0 || ptr + count > ptrEnd) throw "HDRDecoder: bad scanline data";
|
|
47818
|
+
if (isEncodedRun) {
|
|
47819
|
+
var byteValue = buffer[pos++];
|
|
47820
|
+
for(var i = 0; i < count; i++)scanLineBuffer[ptr++] = byteValue;
|
|
47821
|
+
} else {
|
|
47822
|
+
scanLineBuffer.set(buffer.subarray(pos, pos + count), ptr);
|
|
47823
|
+
ptr += count;
|
|
47824
|
+
pos += count;
|
|
47825
|
+
}
|
|
47826
|
+
}
|
|
47827
|
+
for(var i1 = 0; i1 < width; i1++, offset += 4){
|
|
47828
|
+
dataRGBA[offset] = scanLineBuffer[i1];
|
|
47829
|
+
dataRGBA[offset + 1] = scanLineBuffer[i1 + width];
|
|
47830
|
+
dataRGBA[offset + 2] = scanLineBuffer[i1 + width * 2];
|
|
47831
|
+
dataRGBA[offset + 3] = scanLineBuffer[i1 + width * 3];
|
|
47832
|
+
}
|
|
47833
|
+
numScanLines--;
|
|
47834
|
+
}
|
|
47835
|
+
return dataRGBA;
|
|
47836
|
+
};
|
|
47837
|
+
HDRDecoder._generateFloat2HalfTables = function _generateFloat2HalfTables() {
|
|
47838
|
+
var baseTable = new Uint32Array(512);
|
|
47839
|
+
var shiftTable = new Uint32Array(512);
|
|
47840
|
+
for(var i = 0; i < 256; ++i){
|
|
47841
|
+
var e = i - 127;
|
|
47842
|
+
if (e < -27) {
|
|
47843
|
+
baseTable[i] = 0x0000;
|
|
47844
|
+
baseTable[i | 0x100] = 0x8000;
|
|
47845
|
+
shiftTable[i] = 24;
|
|
47846
|
+
shiftTable[i | 0x100] = 24;
|
|
47847
|
+
} else if (e < -14) {
|
|
47848
|
+
baseTable[i] = 0x0400 >> -e - 14;
|
|
47849
|
+
baseTable[i | 0x100] = 0x0400 >> -e - 14 | 0x8000;
|
|
47850
|
+
shiftTable[i] = -e - 1;
|
|
47851
|
+
shiftTable[i | 0x100] = -e - 1;
|
|
47852
|
+
} else if (e <= 15) {
|
|
47853
|
+
baseTable[i] = e + 15 << 10;
|
|
47854
|
+
baseTable[i | 0x100] = e + 15 << 10 | 0x8000;
|
|
47855
|
+
shiftTable[i] = 13;
|
|
47856
|
+
shiftTable[i | 0x100] = 13;
|
|
47857
|
+
} else if (e < 128) {
|
|
47858
|
+
baseTable[i] = 0x7c00;
|
|
47859
|
+
baseTable[i | 0x100] = 0xfc00;
|
|
47860
|
+
shiftTable[i] = 24;
|
|
47861
|
+
shiftTable[i | 0x100] = 24;
|
|
47862
|
+
} else {
|
|
47863
|
+
baseTable[i] = 0x7c00;
|
|
47864
|
+
baseTable[i | 0x100] = 0xfc00;
|
|
47865
|
+
shiftTable[i] = 13;
|
|
47866
|
+
shiftTable[i | 0x100] = 13;
|
|
47867
|
+
}
|
|
47868
|
+
}
|
|
47869
|
+
return {
|
|
47870
|
+
baseTable: baseTable,
|
|
47871
|
+
shiftTable: shiftTable
|
|
47872
|
+
};
|
|
47873
|
+
};
|
|
47874
|
+
HDRDecoder._readStringLine = function _readStringLine(uint8array, startIndex) {
|
|
47875
|
+
var line = "";
|
|
47876
|
+
for(var i = startIndex, n = uint8array.length; i < n; i++){
|
|
47877
|
+
var character = String.fromCharCode(uint8array[i]);
|
|
47878
|
+
if (character === "\n") break;
|
|
47879
|
+
line += character;
|
|
47880
|
+
}
|
|
47881
|
+
return line;
|
|
47882
|
+
};
|
|
47883
|
+
return HDRDecoder;
|
|
47884
|
+
}();
|
|
47885
|
+
HDRDecoder._float2HalfTables = HDRDecoder._generateFloat2HalfTables();
|
|
47886
|
+
HDRDecoder._floatView = new Float32Array(1);
|
|
47887
|
+
HDRDecoder._uint32View = new Uint32Array(HDRDecoder._floatView.buffer);
|
|
47888
|
+
/**
|
|
47889
|
+
* Data format: [url] [mipmap(1B)] [filterMode(1B)] [anisoLevel(1B)] [wrapModeU(1B)] [wrapModeV(1B)]
|
|
47890
|
+
* [format(1B)] [width(2B)] [height(2B)] [isSRGBColorSpace(1B)] [Uint32(imageSize) + imageBytes]
|
|
47891
|
+
*/ var Texture2DDecoder = /*#__PURE__*/ function() {
|
|
47714
47892
|
function Texture2DDecoder() {}
|
|
47715
47893
|
Texture2DDecoder.decode = function decode(engine, bufferReader, restoredTexture) {
|
|
47716
47894
|
return new AssetPromise(function(resolve, reject) {
|
|
47717
|
-
|
|
47895
|
+
bufferReader.nextStr();
|
|
47718
47896
|
var mipmap = !!bufferReader.nextUint8();
|
|
47719
47897
|
var filterMode = bufferReader.nextUint8();
|
|
47720
47898
|
var anisoLevel = bufferReader.nextUint8();
|
|
@@ -47723,58 +47901,34 @@ var Texture2DDecoder = /*#__PURE__*/ function() {
|
|
|
47723
47901
|
var format = bufferReader.nextUint8();
|
|
47724
47902
|
var width = bufferReader.nextUint16();
|
|
47725
47903
|
var height = bufferReader.nextUint16();
|
|
47726
|
-
var isPixelBuffer = bufferReader.nextUint8();
|
|
47727
47904
|
var isSRGBColorSpace = !!bufferReader.nextUint8();
|
|
47728
|
-
var
|
|
47729
|
-
var
|
|
47730
|
-
var
|
|
47731
|
-
|
|
47732
|
-
|
|
47733
|
-
|
|
47734
|
-
|
|
47735
|
-
|
|
47736
|
-
|
|
47737
|
-
|
|
47738
|
-
|
|
47739
|
-
|
|
47740
|
-
|
|
47741
|
-
var pixelBuffer1 = imagesData[i];
|
|
47742
|
-
texture2D.setPixelBuffer(pixelBuffer1, i);
|
|
47743
|
-
}
|
|
47744
|
-
}
|
|
47745
|
-
// @ts-ignore
|
|
47746
|
-
engine.resourceManager._objectPool[url] = texture2D;
|
|
47747
|
-
resolve(texture2D);
|
|
47905
|
+
var imageData = bufferReader.nextImagesData(1)[0];
|
|
47906
|
+
var isHDR = imageData[0] === 0x23 && imageData[1] === 0x3f;
|
|
47907
|
+
var textureFormat = isHDR ? TextureFormat.R16G16B16A16 : format;
|
|
47908
|
+
var texture = restoredTexture || new Texture2D(engine, width, height, textureFormat, mipmap, isHDR ? false : isSRGBColorSpace);
|
|
47909
|
+
texture.filterMode = filterMode;
|
|
47910
|
+
texture.anisoLevel = anisoLevel;
|
|
47911
|
+
texture.wrapModeU = wrapModeU;
|
|
47912
|
+
texture.wrapModeV = wrapModeV;
|
|
47913
|
+
if (isHDR) {
|
|
47914
|
+
var pixels = HDRDecoder.decode(imageData).pixels;
|
|
47915
|
+
texture.setPixelBuffer(pixels);
|
|
47916
|
+
mipmap && texture.generateMipmaps();
|
|
47917
|
+
resolve(texture);
|
|
47748
47918
|
} else {
|
|
47749
|
-
var blob = new
|
|
47750
|
-
|
|
47919
|
+
var blob = new Blob([
|
|
47920
|
+
imageData
|
|
47751
47921
|
]);
|
|
47752
47922
|
var img = new Image();
|
|
47753
47923
|
img.onload = function() {
|
|
47754
|
-
|
|
47755
|
-
|
|
47756
|
-
|
|
47757
|
-
|
|
47758
|
-
|
|
47759
|
-
|
|
47760
|
-
|
|
47761
|
-
|
|
47762
|
-
onComplete();
|
|
47763
|
-
if (mipmap) {
|
|
47764
|
-
var _loop = function _loop(i) {
|
|
47765
|
-
var blob = new window.Blob([
|
|
47766
|
-
imagesData[i]
|
|
47767
|
-
]);
|
|
47768
|
-
var img = new Image();
|
|
47769
|
-
img.onload = function() {
|
|
47770
|
-
texture2D.setImageSource(img, i);
|
|
47771
|
-
onComplete();
|
|
47772
|
-
};
|
|
47773
|
-
img.src = URL.createObjectURL(blob);
|
|
47774
|
-
};
|
|
47775
|
-
texture2D.generateMipmaps();
|
|
47776
|
-
for(var i = 1; i < mipCount; i++)_loop(i);
|
|
47777
|
-
}
|
|
47924
|
+
URL.revokeObjectURL(img.src);
|
|
47925
|
+
texture.setImageSource(img);
|
|
47926
|
+
mipmap && texture.generateMipmaps();
|
|
47927
|
+
resolve(texture);
|
|
47928
|
+
};
|
|
47929
|
+
img.onerror = function(e) {
|
|
47930
|
+
URL.revokeObjectURL(img.src);
|
|
47931
|
+
reject(e);
|
|
47778
47932
|
};
|
|
47779
47933
|
img.src = URL.createObjectURL(blob);
|
|
47780
47934
|
}
|
|
@@ -47785,6 +47939,68 @@ var Texture2DDecoder = /*#__PURE__*/ function() {
|
|
|
47785
47939
|
Texture2DDecoder = __decorate([
|
|
47786
47940
|
decoder("Texture2D")
|
|
47787
47941
|
], Texture2DDecoder);
|
|
47942
|
+
/**
|
|
47943
|
+
* Data format: [url] [mipmap(1B)] [filterMode(1B)] [anisoLevel(1B)] [wrapModeU(1B)] [wrapModeV(1B)]
|
|
47944
|
+
* [format(1B)] [faceSize(2B)] [isSRGBColorSpace(1B)] [Uint32(size) + faceBytes] × 6
|
|
47945
|
+
*/ var TextureCubeDecoder = /*#__PURE__*/ function() {
|
|
47946
|
+
function TextureCubeDecoder() {}
|
|
47947
|
+
TextureCubeDecoder.decode = function decode(engine, bufferReader, restoredTexture) {
|
|
47948
|
+
return new AssetPromise(function(resolve, reject) {
|
|
47949
|
+
bufferReader.nextStr();
|
|
47950
|
+
var mipmap = !!bufferReader.nextUint8();
|
|
47951
|
+
var filterMode = bufferReader.nextUint8();
|
|
47952
|
+
var anisoLevel = bufferReader.nextUint8();
|
|
47953
|
+
var wrapModeU = bufferReader.nextUint8();
|
|
47954
|
+
var wrapModeV = bufferReader.nextUint8();
|
|
47955
|
+
var format = bufferReader.nextUint8();
|
|
47956
|
+
var faceSize = bufferReader.nextUint16();
|
|
47957
|
+
var isSRGBColorSpace = !!bufferReader.nextUint8();
|
|
47958
|
+
var facesData = bufferReader.nextImagesData(6);
|
|
47959
|
+
// Detect format by first face's magic bytes
|
|
47960
|
+
var isHDR = facesData[0][0] === 0x23 && facesData[0][1] === 0x3f;
|
|
47961
|
+
var textureFormat = isHDR ? TextureFormat.R16G16B16A16 : format;
|
|
47962
|
+
var texture = restoredTexture || new TextureCube(engine, faceSize, textureFormat, mipmap, isSRGBColorSpace);
|
|
47963
|
+
texture.filterMode = filterMode;
|
|
47964
|
+
texture.anisoLevel = anisoLevel;
|
|
47965
|
+
texture.wrapModeU = wrapModeU;
|
|
47966
|
+
texture.wrapModeV = wrapModeV;
|
|
47967
|
+
if (isHDR) {
|
|
47968
|
+
for(var i = 0; i < 6; i++){
|
|
47969
|
+
var pixels = HDRDecoder.decode(facesData[i]).pixels;
|
|
47970
|
+
texture.setPixelBuffer(TextureCubeFace.PositiveX + i, pixels, 0);
|
|
47971
|
+
}
|
|
47972
|
+
mipmap && texture.generateMipmaps();
|
|
47973
|
+
resolve(texture);
|
|
47974
|
+
} else {
|
|
47975
|
+
var _loop = function _loop(i1) {
|
|
47976
|
+
var blob = new Blob([
|
|
47977
|
+
facesData[i1]
|
|
47978
|
+
]);
|
|
47979
|
+
var img = new Image();
|
|
47980
|
+
img.onload = function() {
|
|
47981
|
+
URL.revokeObjectURL(img.src);
|
|
47982
|
+
texture.setImageSource(TextureCubeFace.PositiveX + i1, img);
|
|
47983
|
+
if (++loadedCount === 6) {
|
|
47984
|
+
mipmap && texture.generateMipmaps();
|
|
47985
|
+
resolve(texture);
|
|
47986
|
+
}
|
|
47987
|
+
};
|
|
47988
|
+
img.onerror = function(e) {
|
|
47989
|
+
URL.revokeObjectURL(img.src);
|
|
47990
|
+
reject(e);
|
|
47991
|
+
};
|
|
47992
|
+
img.src = URL.createObjectURL(blob);
|
|
47993
|
+
};
|
|
47994
|
+
var loadedCount = 0;
|
|
47995
|
+
for(var i1 = 0; i1 < 6; i1++)_loop(i1);
|
|
47996
|
+
}
|
|
47997
|
+
});
|
|
47998
|
+
};
|
|
47999
|
+
return TextureCubeDecoder;
|
|
48000
|
+
}();
|
|
48001
|
+
TextureCubeDecoder = __decorate([
|
|
48002
|
+
decoder("TextureCube")
|
|
48003
|
+
], TextureCubeDecoder);
|
|
47788
48004
|
function _instanceof1(left, right) {
|
|
47789
48005
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
47790
48006
|
return !!right[Symbol.hasInstance](left);
|
|
@@ -50355,11 +50571,13 @@ function registerGLTFParser(pipeline) {
|
|
|
50355
50571
|
});
|
|
50356
50572
|
var img = new Image();
|
|
50357
50573
|
img.onerror = function() {
|
|
50574
|
+
URL.revokeObjectURL(img.src);
|
|
50358
50575
|
reject(new Error("Failed to load image buffer"));
|
|
50359
50576
|
};
|
|
50360
50577
|
img.onload = function() {
|
|
50361
50578
|
// Call requestAnimationFrame to avoid iOS's bug.
|
|
50362
50579
|
requestAnimationFrame(function() {
|
|
50580
|
+
URL.revokeObjectURL(img.src);
|
|
50363
50581
|
resolve(img);
|
|
50364
50582
|
img.onload = null;
|
|
50365
50583
|
img.onerror = null;
|
|
@@ -51777,7 +51995,7 @@ var GLTFTextureParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
51777
51995
|
if (uri) {
|
|
51778
51996
|
var extIndex = uri.lastIndexOf(".");
|
|
51779
51997
|
var ext = uri.substring(extIndex + 1);
|
|
51780
|
-
var type = ext.startsWith("ktx") ? AssetType.KTX : AssetType.
|
|
51998
|
+
var type = ext.startsWith("ktx") ? AssetType.KTX : AssetType.Texture;
|
|
51781
51999
|
texture = engine.resourceManager.load({
|
|
51782
52000
|
url: Utils.resolveAbsoluteUrl(url, uri),
|
|
51783
52001
|
type: type,
|
|
@@ -52634,7 +52852,7 @@ var SpriteAtlasLoader = /*#__PURE__*/ function(Loader) {
|
|
|
52634
52852
|
var _atlasItem_type;
|
|
52635
52853
|
chainPromises.push(resourceManager.load({
|
|
52636
52854
|
url: Utils.resolveAbsoluteUrl(item.url, atlasItem.img),
|
|
52637
|
-
type: (_atlasItem_type = atlasItem.type) != null ? _atlasItem_type : AssetType.
|
|
52855
|
+
type: (_atlasItem_type = atlasItem.type) != null ? _atlasItem_type : AssetType.Texture,
|
|
52638
52856
|
params: {
|
|
52639
52857
|
format: format,
|
|
52640
52858
|
mipmap: mipmap
|
|
@@ -52769,26 +52987,12 @@ TextLoader = __decorate([
|
|
|
52769
52987
|
"txt"
|
|
52770
52988
|
])
|
|
52771
52989
|
], TextLoader);
|
|
52772
|
-
function
|
|
52773
|
-
|
|
52774
|
-
|
|
52775
|
-
buffer
|
|
52776
|
-
]);
|
|
52777
|
-
var img = new Image();
|
|
52778
|
-
img.onload = function() {
|
|
52779
|
-
URL.revokeObjectURL(img.src);
|
|
52780
|
-
resolve(img);
|
|
52781
|
-
};
|
|
52782
|
-
img.onerror = reject;
|
|
52783
|
-
img.src = URL.createObjectURL(blob);
|
|
52784
|
-
});
|
|
52785
|
-
}
|
|
52786
|
-
var Texture2DLoader = /*#__PURE__*/ function(Loader) {
|
|
52787
|
-
_inherits(Texture2DLoader, Loader);
|
|
52788
|
-
function Texture2DLoader() {
|
|
52990
|
+
var TextureLoader = /*#__PURE__*/ function(Loader) {
|
|
52991
|
+
_inherits(TextureLoader, Loader);
|
|
52992
|
+
function TextureLoader() {
|
|
52789
52993
|
return Loader.apply(this, arguments) || this;
|
|
52790
52994
|
}
|
|
52791
|
-
var _proto =
|
|
52995
|
+
var _proto = TextureLoader.prototype;
|
|
52792
52996
|
_proto.load = function load(item, resourceManager) {
|
|
52793
52997
|
var _this = this;
|
|
52794
52998
|
var url = item.url;
|
|
@@ -52798,427 +53002,136 @@ var Texture2DLoader = /*#__PURE__*/ function(Loader) {
|
|
|
52798
53002
|
return new AssetPromise(function(resolve, reject, setTaskCompleteProgress, setTaskDetailProgress) {
|
|
52799
53003
|
resourceManager // @ts-ignore
|
|
52800
53004
|
._request(url, requestConfig).onProgress(setTaskCompleteProgress, setTaskDetailProgress).then(function(buffer) {
|
|
52801
|
-
|
|
52802
|
-
|
|
52803
|
-
|
|
52804
|
-
|
|
52805
|
-
}, reject);
|
|
52806
|
-
} else {
|
|
52807
|
-
loadImageFromBuffer(buffer).then(function(img) {
|
|
52808
|
-
var texture = _this._createTexture(img, item, resourceManager);
|
|
52809
|
-
resourceManager.addContentRestorer(new Texture2DContentRestorer(texture, url, requestConfig));
|
|
52810
|
-
resolve(texture);
|
|
52811
|
-
}, reject);
|
|
52812
|
-
}
|
|
53005
|
+
_this._decode(buffer, item, resourceManager).then(function(texture) {
|
|
53006
|
+
resourceManager.addContentRestorer(new TextureContentRestorer(texture, url, requestConfig));
|
|
53007
|
+
resolve(texture);
|
|
53008
|
+
}, reject);
|
|
52813
53009
|
}).catch(reject);
|
|
52814
53010
|
});
|
|
52815
53011
|
};
|
|
52816
|
-
_proto.
|
|
53012
|
+
_proto._decode = function _decode(buffer, item, resourceManager) {
|
|
53013
|
+
if (FileHeader.checkMagic(buffer)) {
|
|
53014
|
+
return decode(buffer, resourceManager.engine);
|
|
53015
|
+
}
|
|
53016
|
+
var bufferView = new Uint8Array(buffer);
|
|
53017
|
+
var isHDR = bufferView[0] === 0x23 && bufferView[1] === 0x3f;
|
|
53018
|
+
if (isHDR) {
|
|
53019
|
+
return this._decodeHDR(bufferView, item, resourceManager);
|
|
53020
|
+
}
|
|
53021
|
+
return this._decodeImage(buffer, item, resourceManager);
|
|
53022
|
+
};
|
|
53023
|
+
_proto._decodeHDR = function _decodeHDR(buffer, item, resourceManager) {
|
|
53024
|
+
var _this = this;
|
|
53025
|
+
return new AssetPromise(function(resolve, reject) {
|
|
53026
|
+
var engine = resourceManager.engine;
|
|
53027
|
+
if (!SystemInfo.supportsTextureFormat(engine, TextureFormat.R16G16B16A16)) {
|
|
53028
|
+
reject(new Error("TextureLoader: HDR texture requires half float support."));
|
|
53029
|
+
return;
|
|
53030
|
+
}
|
|
53031
|
+
var _HDRDecoder_decode = HDRDecoder.decode(buffer), width = _HDRDecoder_decode.width, height = _HDRDecoder_decode.height, pixels = _HDRDecoder_decode.pixels;
|
|
53032
|
+
var _item_params;
|
|
53033
|
+
var _ref = (_item_params = item.params) != null ? _item_params : {}, _ref_mipmap = _ref.mipmap, mipmap = _ref_mipmap === void 0 ? true : _ref_mipmap;
|
|
53034
|
+
var texture = new Texture2D(engine, width, height, TextureFormat.R16G16B16A16, mipmap, false);
|
|
53035
|
+
texture.setPixelBuffer(pixels);
|
|
53036
|
+
mipmap && texture.generateMipmaps();
|
|
53037
|
+
_this._applyParams(texture, item);
|
|
53038
|
+
resolve(texture);
|
|
53039
|
+
});
|
|
53040
|
+
};
|
|
53041
|
+
_proto._decodeImage = function _decodeImage(buffer, item, resourceManager) {
|
|
53042
|
+
var _this = this;
|
|
53043
|
+
return new AssetPromise(function(resolve, reject) {
|
|
53044
|
+
var blob = new Blob([
|
|
53045
|
+
buffer
|
|
53046
|
+
]);
|
|
53047
|
+
var img = new Image();
|
|
53048
|
+
img.onload = function() {
|
|
53049
|
+
URL.revokeObjectURL(img.src);
|
|
53050
|
+
var _item_params;
|
|
53051
|
+
var _ref = (_item_params = item.params) != null ? _item_params : {}, _ref_format = _ref.format, format = _ref_format === void 0 ? TextureFormat.R8G8B8A8 : _ref_format, _ref_isSRGBColorSpace = _ref.isSRGBColorSpace, isSRGBColorSpace = _ref_isSRGBColorSpace === void 0 ? true : _ref_isSRGBColorSpace, _ref_mipmap = _ref.mipmap, mipmap = _ref_mipmap === void 0 ? true : _ref_mipmap;
|
|
53052
|
+
var engine = resourceManager.engine;
|
|
53053
|
+
var width = img.width, height = img.height;
|
|
53054
|
+
var generateMipmap = TextureUtils.supportGenerateMipmapsWithCorrection(engine, width, height, format, mipmap, isSRGBColorSpace);
|
|
53055
|
+
var texture = new Texture2D(engine, width, height, format, generateMipmap, isSRGBColorSpace);
|
|
53056
|
+
texture.setImageSource(img);
|
|
53057
|
+
generateMipmap && texture.generateMipmaps();
|
|
53058
|
+
_this._applyParams(texture, item);
|
|
53059
|
+
resolve(texture);
|
|
53060
|
+
};
|
|
53061
|
+
img.onerror = function(e) {
|
|
53062
|
+
URL.revokeObjectURL(img.src);
|
|
53063
|
+
reject(e);
|
|
53064
|
+
};
|
|
53065
|
+
img.src = URL.createObjectURL(blob);
|
|
53066
|
+
});
|
|
53067
|
+
};
|
|
53068
|
+
_proto._applyParams = function _applyParams(texture, item) {
|
|
52817
53069
|
var _item_params;
|
|
52818
|
-
var _ref = (_item_params = item.params) != null ? _item_params : {},
|
|
52819
|
-
var width = img.width, height = img.height;
|
|
52820
|
-
var engine = resourceManager.engine;
|
|
52821
|
-
var generateMipmap = TextureUtils.supportGenerateMipmapsWithCorrection(engine, width, height, format, mipmap, isSRGBColorSpace);
|
|
52822
|
-
var texture = new Texture2D(engine, width, height, format, generateMipmap, isSRGBColorSpace);
|
|
53070
|
+
var _ref = (_item_params = item.params) != null ? _item_params : {}, anisoLevel = _ref.anisoLevel, wrapModeU = _ref.wrapModeU, wrapModeV = _ref.wrapModeV, filterMode = _ref.filterMode;
|
|
52823
53071
|
texture.anisoLevel = anisoLevel != null ? anisoLevel : texture.anisoLevel;
|
|
52824
53072
|
texture.filterMode = filterMode != null ? filterMode : texture.filterMode;
|
|
52825
53073
|
texture.wrapModeU = wrapModeU != null ? wrapModeU : texture.wrapModeU;
|
|
52826
53074
|
texture.wrapModeV = wrapModeV != null ? wrapModeV : texture.wrapModeV;
|
|
52827
|
-
texture.setImageSource(img);
|
|
52828
|
-
generateMipmap && texture.generateMipmaps();
|
|
52829
53075
|
var url = item.url;
|
|
52830
53076
|
if (url.indexOf("data:") !== 0) {
|
|
52831
53077
|
texture.name = url.substring(url.lastIndexOf("/") + 1);
|
|
52832
53078
|
}
|
|
52833
|
-
return texture;
|
|
52834
53079
|
};
|
|
52835
|
-
return
|
|
53080
|
+
return TextureLoader;
|
|
52836
53081
|
}(Loader);
|
|
52837
|
-
|
|
52838
|
-
resourceLoader(AssetType.
|
|
53082
|
+
TextureLoader = __decorate([
|
|
53083
|
+
resourceLoader(AssetType.Texture, [
|
|
53084
|
+
"tex",
|
|
52839
53085
|
"png",
|
|
52840
53086
|
"jpg",
|
|
52841
53087
|
"webp",
|
|
52842
53088
|
"jpeg",
|
|
52843
|
-
"
|
|
53089
|
+
"hdr"
|
|
52844
53090
|
])
|
|
52845
|
-
],
|
|
52846
|
-
var
|
|
52847
|
-
_inherits(
|
|
52848
|
-
function
|
|
53091
|
+
], TextureLoader);
|
|
53092
|
+
var TextureContentRestorer = /*#__PURE__*/ function(ContentRestorer) {
|
|
53093
|
+
_inherits(TextureContentRestorer, ContentRestorer);
|
|
53094
|
+
function TextureContentRestorer(resource, url, requestConfig) {
|
|
52849
53095
|
var _this;
|
|
52850
53096
|
_this = ContentRestorer.call(this, resource) || this, _this.url = url, _this.requestConfig = requestConfig;
|
|
52851
53097
|
return _this;
|
|
52852
53098
|
}
|
|
52853
|
-
var _proto =
|
|
53099
|
+
var _proto = TextureContentRestorer.prototype;
|
|
52854
53100
|
_proto.restoreContent = function restoreContent() {
|
|
52855
|
-
var
|
|
52856
|
-
|
|
52857
|
-
return engine.resourceManager // @ts-ignore
|
|
53101
|
+
var _this = this;
|
|
53102
|
+
return this.resource.engine.resourceManager // @ts-ignore
|
|
52858
53103
|
._request(this.url, this.requestConfig).then(function(buffer) {
|
|
52859
53104
|
if (FileHeader.checkMagic(buffer)) {
|
|
52860
|
-
return decode(buffer, engine,
|
|
52861
|
-
}
|
|
52862
|
-
|
|
52863
|
-
|
|
52864
|
-
|
|
52865
|
-
|
|
52866
|
-
|
|
52867
|
-
|
|
52868
|
-
|
|
52869
|
-
};
|
|
52870
|
-
return Texture2DContentRestorer;
|
|
52871
|
-
}(ContentRestorer);
|
|
52872
|
-
/**
|
|
52873
|
-
* HDR panorama to cubemap decoder.
|
|
52874
|
-
*/ var HDRDecoder = /*#__PURE__*/ function() {
|
|
52875
|
-
function HDRDecoder() {}
|
|
52876
|
-
HDRDecoder.parseHeader = function parseHeader(uint8array) {
|
|
52877
|
-
var line = this._readStringLine(uint8array, 0);
|
|
52878
|
-
if (line[0] !== "#" || line[1] !== "?") {
|
|
52879
|
-
throw "HDRDecoder: invalid file header";
|
|
52880
|
-
}
|
|
52881
|
-
var endOfHeader = false;
|
|
52882
|
-
var findFormat = false;
|
|
52883
|
-
var lineIndex = 0;
|
|
52884
|
-
do {
|
|
52885
|
-
lineIndex += line.length + 1;
|
|
52886
|
-
line = this._readStringLine(uint8array, lineIndex);
|
|
52887
|
-
if (line === "FORMAT=32-bit_rle_rgbe") findFormat = true;
|
|
52888
|
-
else if (line.length === 0) endOfHeader = true;
|
|
52889
|
-
}while (!endOfHeader);
|
|
52890
|
-
if (!findFormat) {
|
|
52891
|
-
throw "HDRDecoder: unsupported format, expected 32-bit_rle_rgbe";
|
|
52892
|
-
}
|
|
52893
|
-
lineIndex += line.length + 1;
|
|
52894
|
-
line = this._readStringLine(uint8array, lineIndex);
|
|
52895
|
-
var match = /^\-Y (.*) \+X (.*)$/g.exec(line);
|
|
52896
|
-
if (!match || match.length < 3) {
|
|
52897
|
-
throw "HDRDecoder: missing image size, only -Y +X layout is supported";
|
|
52898
|
-
}
|
|
52899
|
-
var width = parseInt(match[2]);
|
|
52900
|
-
var height = parseInt(match[1]);
|
|
52901
|
-
if (width < 8 || width > 0x7fff) {
|
|
52902
|
-
throw "HDRDecoder: unsupported image width, must be between 8 and 32767";
|
|
52903
|
-
}
|
|
52904
|
-
return {
|
|
52905
|
-
height: height,
|
|
52906
|
-
width: width,
|
|
52907
|
-
dataPosition: lineIndex + line.length + 1
|
|
52908
|
-
};
|
|
52909
|
-
};
|
|
52910
|
-
HDRDecoder.decodeFaces = function decodeFaces(bufferArray, header, onFace) {
|
|
52911
|
-
var width = header.width, height = header.height, dataPosition = header.dataPosition;
|
|
52912
|
-
var cubeSize = height >> 1;
|
|
52913
|
-
var pixels = HDRDecoder._readPixels(bufferArray.subarray(dataPosition), width, height);
|
|
52914
|
-
var faces = HDRDecoder._faces;
|
|
52915
|
-
var faceBuffer = new Uint16Array(cubeSize * cubeSize * 4);
|
|
52916
|
-
for(var faceIndex = 0; faceIndex < 6; faceIndex++){
|
|
52917
|
-
HDRDecoder._createCubemapData(cubeSize, faces[faceIndex], pixels, width, height, faceBuffer);
|
|
52918
|
-
onFace(faceIndex, faceBuffer);
|
|
52919
|
-
}
|
|
52920
|
-
};
|
|
52921
|
-
HDRDecoder._generateFloat2HalfTables = function _generateFloat2HalfTables() {
|
|
52922
|
-
var baseTable = new Uint32Array(512);
|
|
52923
|
-
var shiftTable = new Uint32Array(512);
|
|
52924
|
-
for(var i = 0; i < 256; ++i){
|
|
52925
|
-
var e = i - 127;
|
|
52926
|
-
if (e < -27) {
|
|
52927
|
-
baseTable[i] = 0x0000;
|
|
52928
|
-
baseTable[i | 0x100] = 0x8000;
|
|
52929
|
-
shiftTable[i] = 24;
|
|
52930
|
-
shiftTable[i | 0x100] = 24;
|
|
52931
|
-
} else if (e < -14) {
|
|
52932
|
-
baseTable[i] = 0x0400 >> -e - 14;
|
|
52933
|
-
baseTable[i | 0x100] = 0x0400 >> -e - 14 | 0x8000;
|
|
52934
|
-
shiftTable[i] = -e - 1;
|
|
52935
|
-
shiftTable[i | 0x100] = -e - 1;
|
|
52936
|
-
} else if (e <= 15) {
|
|
52937
|
-
baseTable[i] = e + 15 << 10;
|
|
52938
|
-
baseTable[i | 0x100] = e + 15 << 10 | 0x8000;
|
|
52939
|
-
shiftTable[i] = 13;
|
|
52940
|
-
shiftTable[i | 0x100] = 13;
|
|
52941
|
-
} else if (e < 128) {
|
|
52942
|
-
baseTable[i] = 0x7c00;
|
|
52943
|
-
baseTable[i | 0x100] = 0xfc00;
|
|
52944
|
-
shiftTable[i] = 24;
|
|
52945
|
-
shiftTable[i | 0x100] = 24;
|
|
52946
|
-
} else {
|
|
52947
|
-
baseTable[i] = 0x7c00;
|
|
52948
|
-
baseTable[i | 0x100] = 0xfc00;
|
|
52949
|
-
shiftTable[i] = 13;
|
|
52950
|
-
shiftTable[i | 0x100] = 13;
|
|
52951
|
-
}
|
|
52952
|
-
}
|
|
52953
|
-
return {
|
|
52954
|
-
baseTable: baseTable,
|
|
52955
|
-
shiftTable: shiftTable
|
|
52956
|
-
};
|
|
52957
|
-
};
|
|
52958
|
-
HDRDecoder._createCubemapData = function _createCubemapData(texSize, face, pixels, inputWidth, inputHeight, facePixels) {
|
|
52959
|
-
var invSize = 1 / texSize;
|
|
52960
|
-
var rotDX1X = (face[3] - face[0]) * invSize;
|
|
52961
|
-
var rotDX1Y = (face[4] - face[1]) * invSize;
|
|
52962
|
-
var rotDX1Z = (face[5] - face[2]) * invSize;
|
|
52963
|
-
var rotDX2X = (face[9] - face[6]) * invSize;
|
|
52964
|
-
var rotDX2Y = (face[10] - face[7]) * invSize;
|
|
52965
|
-
var rotDX2Z = (face[11] - face[8]) * invSize;
|
|
52966
|
-
var floatView = HDRDecoder._floatView;
|
|
52967
|
-
var uint32View = HDRDecoder._uint32View;
|
|
52968
|
-
var _HDRDecoder__float2HalfTables = HDRDecoder._float2HalfTables, baseTable = _HDRDecoder__float2HalfTables.baseTable, shiftTable = _HDRDecoder__float2HalfTables.shiftTable;
|
|
52969
|
-
var one = HDRDecoder._one;
|
|
52970
|
-
var fy = 0;
|
|
52971
|
-
for(var y = 0; y < texSize; y++){
|
|
52972
|
-
var xv1X = face[0], xv1Y = face[1], xv1Z = face[2];
|
|
52973
|
-
var xv2X = face[6], xv2Y = face[7], xv2Z = face[8];
|
|
52974
|
-
for(var x = 0; x < texSize; x++){
|
|
52975
|
-
var dirX = xv1X + (xv2X - xv1X) * fy;
|
|
52976
|
-
var dirY = xv1Y + (xv2Y - xv1Y) * fy;
|
|
52977
|
-
var dirZ = xv1Z + (xv2Z - xv1Z) * fy;
|
|
52978
|
-
var invLen = 1 / Math.sqrt(dirX * dirX + dirY * dirY + dirZ * dirZ);
|
|
52979
|
-
dirX *= invLen;
|
|
52980
|
-
dirY *= invLen;
|
|
52981
|
-
dirZ *= invLen;
|
|
52982
|
-
var px = Math.round((Math.atan2(dirZ, dirX) / Math.PI * 0.5 + 0.5) * inputWidth);
|
|
52983
|
-
if (px < 0) px = 0;
|
|
52984
|
-
else if (px >= inputWidth) px = inputWidth - 1;
|
|
52985
|
-
var py = Math.round(Math.acos(dirY) / Math.PI * inputHeight);
|
|
52986
|
-
if (py < 0) py = 0;
|
|
52987
|
-
else if (py >= inputHeight) py = inputHeight - 1;
|
|
52988
|
-
var srcIndex = (inputHeight - py - 1) * inputWidth * 4 + px * 4;
|
|
52989
|
-
var scaleFactor = Math.pow(2, pixels[srcIndex + 3] - 128) / 255;
|
|
52990
|
-
var dstIndex = y * texSize * 4 + x * 4;
|
|
52991
|
-
for(var c = 0; c < 3; c++){
|
|
52992
|
-
// Clamp to half-float max (65504) to prevent Infinity in R16G16B16A16
|
|
52993
|
-
floatView[0] = Math.min(pixels[srcIndex + c] * scaleFactor, 65504);
|
|
52994
|
-
var f = uint32View[0];
|
|
52995
|
-
var e = f >> 23 & 0x1ff;
|
|
52996
|
-
facePixels[dstIndex + c] = baseTable[e] + ((f & 0x007fffff) >> shiftTable[e]);
|
|
52997
|
-
}
|
|
52998
|
-
facePixels[dstIndex + 3] = one;
|
|
52999
|
-
xv1X += rotDX1X;
|
|
53000
|
-
xv1Y += rotDX1Y;
|
|
53001
|
-
xv1Z += rotDX1Z;
|
|
53002
|
-
xv2X += rotDX2X;
|
|
53003
|
-
xv2Y += rotDX2Y;
|
|
53004
|
-
xv2Z += rotDX2Z;
|
|
53005
|
-
}
|
|
53006
|
-
fy += invSize;
|
|
53007
|
-
}
|
|
53008
|
-
};
|
|
53009
|
-
HDRDecoder._readStringLine = function _readStringLine(uint8array, startIndex) {
|
|
53010
|
-
var line = "";
|
|
53011
|
-
for(var i = startIndex, n = uint8array.length; i < n; i++){
|
|
53012
|
-
var character = String.fromCharCode(uint8array[i]);
|
|
53013
|
-
if (character === "\n") break;
|
|
53014
|
-
line += character;
|
|
53015
|
-
}
|
|
53016
|
-
return line;
|
|
53017
|
-
};
|
|
53018
|
-
HDRDecoder._readPixels = function _readPixels(buffer, width, height) {
|
|
53019
|
-
var byteLength = buffer.byteLength;
|
|
53020
|
-
var dataRGBA = new Uint8Array(4 * width * height);
|
|
53021
|
-
var offset = 0;
|
|
53022
|
-
var pos = 0;
|
|
53023
|
-
var ptrEnd = 4 * width;
|
|
53024
|
-
var scanLineBuffer = new Uint8Array(ptrEnd);
|
|
53025
|
-
var numScanLines = height;
|
|
53026
|
-
while(numScanLines > 0 && pos < byteLength){
|
|
53027
|
-
var a = buffer[pos++];
|
|
53028
|
-
var b = buffer[pos++];
|
|
53029
|
-
var c = buffer[pos++];
|
|
53030
|
-
var d = buffer[pos++];
|
|
53031
|
-
if (a !== 2 || b !== 2 || c & 0x80 || width < 8 || width > 32767) return buffer;
|
|
53032
|
-
if ((c << 8 | d) !== width) throw "HDRDecoder: wrong scanline width";
|
|
53033
|
-
var ptr = 0;
|
|
53034
|
-
while(ptr < ptrEnd && pos < byteLength){
|
|
53035
|
-
var count = buffer[pos++];
|
|
53036
|
-
var isEncodedRun = count > 128;
|
|
53037
|
-
if (isEncodedRun) count -= 128;
|
|
53038
|
-
if (count === 0 || ptr + count > ptrEnd) throw "HDRDecoder: bad scanline data";
|
|
53039
|
-
if (isEncodedRun) {
|
|
53040
|
-
var byteValue = buffer[pos++];
|
|
53041
|
-
for(var i = 0; i < count; i++)scanLineBuffer[ptr++] = byteValue;
|
|
53042
|
-
} else {
|
|
53043
|
-
scanLineBuffer.set(buffer.subarray(pos, pos + count), ptr);
|
|
53044
|
-
ptr += count;
|
|
53045
|
-
pos += count;
|
|
53046
|
-
}
|
|
53047
|
-
}
|
|
53048
|
-
for(var i1 = 0; i1 < width; i1++, offset += 4){
|
|
53049
|
-
dataRGBA[offset] = scanLineBuffer[i1];
|
|
53050
|
-
dataRGBA[offset + 1] = scanLineBuffer[i1 + width];
|
|
53051
|
-
dataRGBA[offset + 2] = scanLineBuffer[i1 + width * 2];
|
|
53052
|
-
dataRGBA[offset + 3] = scanLineBuffer[i1 + width * 3];
|
|
53105
|
+
return decode(buffer, _this.resource.engine, _this.resource);
|
|
53106
|
+
}
|
|
53107
|
+
var bufferView = new Uint8Array(buffer);
|
|
53108
|
+
var texture = _this.resource;
|
|
53109
|
+
if (bufferView[0] === 0x23 && bufferView[1] === 0x3f) {
|
|
53110
|
+
var pixels = HDRDecoder.decode(bufferView).pixels;
|
|
53111
|
+
texture.setPixelBuffer(pixels);
|
|
53112
|
+
texture.mipmapCount > 1 && texture.generateMipmaps();
|
|
53113
|
+
return texture;
|
|
53053
53114
|
}
|
|
53054
|
-
|
|
53055
|
-
|
|
53056
|
-
|
|
53057
|
-
|
|
53058
|
-
|
|
53059
|
-
|
|
53060
|
-
|
|
53061
|
-
|
|
53062
|
-
|
|
53063
|
-
|
|
53064
|
-
|
|
53065
|
-
|
|
53066
|
-
|
|
53067
|
-
|
|
53068
|
-
|
|
53069
|
-
|
|
53070
|
-
-1,
|
|
53071
|
-
-1,
|
|
53072
|
-
1,
|
|
53073
|
-
-1,
|
|
53074
|
-
1,
|
|
53075
|
-
1,
|
|
53076
|
-
1,
|
|
53077
|
-
-1,
|
|
53078
|
-
1,
|
|
53079
|
-
1,
|
|
53080
|
-
1
|
|
53081
|
-
],
|
|
53082
|
-
/* -X */ [
|
|
53083
|
-
-1,
|
|
53084
|
-
-1,
|
|
53085
|
-
1,
|
|
53086
|
-
-1,
|
|
53087
|
-
-1,
|
|
53088
|
-
-1,
|
|
53089
|
-
-1,
|
|
53090
|
-
1,
|
|
53091
|
-
1,
|
|
53092
|
-
-1,
|
|
53093
|
-
1,
|
|
53094
|
-
-1
|
|
53095
|
-
],
|
|
53096
|
-
/* +Y */ [
|
|
53097
|
-
-1,
|
|
53098
|
-
-1,
|
|
53099
|
-
1,
|
|
53100
|
-
1,
|
|
53101
|
-
-1,
|
|
53102
|
-
1,
|
|
53103
|
-
-1,
|
|
53104
|
-
-1,
|
|
53105
|
-
-1,
|
|
53106
|
-
1,
|
|
53107
|
-
-1,
|
|
53108
|
-
-1
|
|
53109
|
-
],
|
|
53110
|
-
/* -Y */ [
|
|
53111
|
-
-1,
|
|
53112
|
-
1,
|
|
53113
|
-
-1,
|
|
53114
|
-
1,
|
|
53115
|
-
1,
|
|
53116
|
-
-1,
|
|
53117
|
-
-1,
|
|
53118
|
-
1,
|
|
53119
|
-
1,
|
|
53120
|
-
1,
|
|
53121
|
-
1,
|
|
53122
|
-
1
|
|
53123
|
-
],
|
|
53124
|
-
/* +Z */ [
|
|
53125
|
-
-1,
|
|
53126
|
-
-1,
|
|
53127
|
-
-1,
|
|
53128
|
-
1,
|
|
53129
|
-
-1,
|
|
53130
|
-
-1,
|
|
53131
|
-
-1,
|
|
53132
|
-
1,
|
|
53133
|
-
-1,
|
|
53134
|
-
1,
|
|
53135
|
-
1,
|
|
53136
|
-
-1
|
|
53137
|
-
],
|
|
53138
|
-
/* -Z */ [
|
|
53139
|
-
1,
|
|
53140
|
-
-1,
|
|
53141
|
-
1,
|
|
53142
|
-
-1,
|
|
53143
|
-
-1,
|
|
53144
|
-
1,
|
|
53145
|
-
1,
|
|
53146
|
-
1,
|
|
53147
|
-
1,
|
|
53148
|
-
-1,
|
|
53149
|
-
1,
|
|
53150
|
-
1
|
|
53151
|
-
]
|
|
53152
|
-
];
|
|
53153
|
-
var TextureCubeLoader = /*#__PURE__*/ function(Loader) {
|
|
53154
|
-
_inherits(TextureCubeLoader, Loader);
|
|
53155
|
-
function TextureCubeLoader() {
|
|
53156
|
-
return Loader.apply(this, arguments) || this;
|
|
53157
|
-
}
|
|
53158
|
-
var _proto = TextureCubeLoader.prototype;
|
|
53159
|
-
_proto.load = function load(item, resourceManager) {
|
|
53160
|
-
return new AssetPromise(function(resolve, reject) {
|
|
53161
|
-
var engine = resourceManager.engine;
|
|
53162
|
-
var url = item.url;
|
|
53163
|
-
var requestConfig = _extends({}, item, {
|
|
53164
|
-
type: "arraybuffer"
|
|
53115
|
+
return new AssetPromise(function(resolve, reject) {
|
|
53116
|
+
var blob = new Blob([
|
|
53117
|
+
buffer
|
|
53118
|
+
]);
|
|
53119
|
+
var img = new Image();
|
|
53120
|
+
img.onload = function() {
|
|
53121
|
+
URL.revokeObjectURL(img.src);
|
|
53122
|
+
texture.setImageSource(img);
|
|
53123
|
+
texture.mipmapCount > 1 && texture.generateMipmaps();
|
|
53124
|
+
resolve(texture);
|
|
53125
|
+
};
|
|
53126
|
+
img.onerror = function(e) {
|
|
53127
|
+
URL.revokeObjectURL(img.src);
|
|
53128
|
+
reject(e);
|
|
53129
|
+
};
|
|
53130
|
+
img.src = URL.createObjectURL(blob);
|
|
53165
53131
|
});
|
|
53166
|
-
resourceManager // @ts-ignore
|
|
53167
|
-
._request(url, requestConfig).then(function(buffer) {
|
|
53168
|
-
if (!SystemInfo.supportsTextureFormat(engine, TextureFormat.R16G16B16A16)) {
|
|
53169
|
-
reject(new Error("TextureCubeLoader: HDR texture requires half float support."));
|
|
53170
|
-
return;
|
|
53171
|
-
}
|
|
53172
|
-
var _item_params;
|
|
53173
|
-
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;
|
|
53174
|
-
var bufferArray = new Uint8Array(buffer);
|
|
53175
|
-
var header = HDRDecoder.parseHeader(bufferArray);
|
|
53176
|
-
var texture = new TextureCube(engine, header.height >> 1, TextureFormat.R16G16B16A16, mipmap, false);
|
|
53177
|
-
HDRDecoder.decodeFaces(bufferArray, header, function(faceIndex, data) {
|
|
53178
|
-
texture.setPixelBuffer(TextureCubeFace.PositiveX + faceIndex, data, 0);
|
|
53179
|
-
});
|
|
53180
|
-
texture.generateMipmaps();
|
|
53181
|
-
texture.anisoLevel = anisoLevel != null ? anisoLevel : texture.anisoLevel;
|
|
53182
|
-
texture.filterMode = filterMode != null ? filterMode : texture.filterMode;
|
|
53183
|
-
texture.wrapModeU = wrapModeU != null ? wrapModeU : texture.wrapModeU;
|
|
53184
|
-
texture.wrapModeV = wrapModeV != null ? wrapModeV : texture.wrapModeV;
|
|
53185
|
-
resourceManager.addContentRestorer(new HDRContentRestorer(texture, url, requestConfig));
|
|
53186
|
-
resolve(texture);
|
|
53187
|
-
}).catch(reject);
|
|
53188
|
-
});
|
|
53189
|
-
};
|
|
53190
|
-
return TextureCubeLoader;
|
|
53191
|
-
}(Loader);
|
|
53192
|
-
TextureCubeLoader = __decorate([
|
|
53193
|
-
resourceLoader(AssetType.TextureCube, [
|
|
53194
|
-
"texCube",
|
|
53195
|
-
"hdr"
|
|
53196
|
-
])
|
|
53197
|
-
], TextureCubeLoader);
|
|
53198
|
-
var HDRContentRestorer = /*#__PURE__*/ function(ContentRestorer) {
|
|
53199
|
-
_inherits(HDRContentRestorer, ContentRestorer);
|
|
53200
|
-
function HDRContentRestorer(resource, url, requestConfig) {
|
|
53201
|
-
var _this;
|
|
53202
|
-
_this = ContentRestorer.call(this, resource) || this, _this.url = url, _this.requestConfig = requestConfig;
|
|
53203
|
-
return _this;
|
|
53204
|
-
}
|
|
53205
|
-
var _proto = HDRContentRestorer.prototype;
|
|
53206
|
-
_proto.restoreContent = function restoreContent() {
|
|
53207
|
-
var _this = this;
|
|
53208
|
-
return new AssetPromise(function(resolve, reject) {
|
|
53209
|
-
var resource = _this.resource;
|
|
53210
|
-
resource.engine.resourceManager // @ts-ignore
|
|
53211
|
-
._request(_this.url, _this.requestConfig).then(function(buffer) {
|
|
53212
|
-
var bufferArray = new Uint8Array(buffer);
|
|
53213
|
-
HDRDecoder.decodeFaces(bufferArray, HDRDecoder.parseHeader(bufferArray), function(faceIndex, data) {
|
|
53214
|
-
resource.setPixelBuffer(TextureCubeFace.PositiveX + faceIndex, data, 0);
|
|
53215
|
-
});
|
|
53216
|
-
resource.generateMipmaps();
|
|
53217
|
-
resolve(resource);
|
|
53218
|
-
}).catch(reject);
|
|
53219
53132
|
});
|
|
53220
53133
|
};
|
|
53221
|
-
return
|
|
53134
|
+
return TextureContentRestorer;
|
|
53222
53135
|
}(ContentRestorer);
|
|
53223
53136
|
var AudioLoader = /*#__PURE__*/ function(Loader) {
|
|
53224
53137
|
_inherits(AudioLoader, Loader);
|
|
@@ -54049,11 +53962,11 @@ EXT_texture_webp = __decorate([
|
|
|
54049
53962
|
], EXT_texture_webp);
|
|
54050
53963
|
|
|
54051
53964
|
//@ts-ignore
|
|
54052
|
-
var version = "2.0.0-alpha.
|
|
53965
|
+
var version = "2.0.0-alpha.25";
|
|
54053
53966
|
console.log("Galacean Engine Version: " + version);
|
|
54054
53967
|
for(var key in CoreObjects){
|
|
54055
53968
|
Loader.registerClass(key, CoreObjects[key]);
|
|
54056
53969
|
}
|
|
54057
53970
|
|
|
54058
|
-
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, CloneUtils, 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, HDRDecoder, HemisphereShape, HierarchyParser, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolableValueType, InterpolationType, JSONAsset, Joint, JointLimits, JointMotor, KTX2Loader, KTX2TargetFormat, Keyframe, Keys, Layer, LayerPathMask, Light, LimitVelocityOverLifetimeModule, 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, Signal, 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,
|
|
53971
|
+
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, CloneUtils, 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, HDRDecoder, HemisphereShape, HierarchyParser, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolableValueType, InterpolationType, JSONAsset, Joint, JointLimits, JointMotor, KTX2Loader, KTX2TargetFormat, Keyframe, Keys, Layer, LayerPathMask, Light, LimitVelocityOverLifetimeModule, 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, Signal, 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, 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 };
|
|
54059
53972
|
//# sourceMappingURL=bundled.module.js.map
|