@galacean/engine 1.3.0-alpha.0 → 1.3.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.js CHANGED
@@ -94,6 +94,15 @@
94
94
  */ MathUtil.degreeToRadian = function degreeToRadian(d) {
95
95
  return d * MathUtil.degreeToRadFactor;
96
96
  };
97
+ /**
98
+ * Linearly interpolate between two values
99
+ * @param start - Specify the start of the range in which to interpolate
100
+ * @param end - Specify the end of the range in which to interpolate
101
+ * @param t - The blend amount where 0 returns start and 1 end
102
+ * @returns The result of linear blending between start and end
103
+ */ MathUtil.lerp = function lerp(start, end, t) {
104
+ return start + (end - start) * t;
105
+ };
97
106
  return MathUtil;
98
107
  }();
99
108
  (function() {
@@ -8218,7 +8227,7 @@
8218
8227
  var noise_simplex_3D_grad = "#define GLSLIFY 1\nfloat simplex(vec3 v,out vec3 gradient){const vec2 C=vec2(1.0/6.0,1.0/3.0);const vec4 D=vec4(0.0,0.5,1.0,2.0);vec3 i=floor(v+dot(v,C.yyy));vec3 x0=v-i+dot(i,C.xxx);vec3 g=step(x0.yzx,x0.xyz);vec3 l=1.0-g;vec3 i1=min(g.xyz,l.zxy);vec3 i2=max(g.xyz,l.zxy);vec3 x1=x0-i1+C.xxx;vec3 x2=x0-i2+C.yyy;vec3 x3=x0-D.yyy;i=mod289(i);vec4 p=permute(permute(permute(i.z+vec4(0.0,i1.z,i2.z,1.0))+i.y+vec4(0.0,i1.y,i2.y,1.0))+i.x+vec4(0.0,i1.x,i2.x,1.0));float n_=0.142857142857;vec3 ns=n_*D.wyz-D.xzx;vec4 j=p-49.0*floor(p*ns.z*ns.z);vec4 x_=floor(j*ns.z);vec4 y_=floor(j-7.0*x_);vec4 x=x_*ns.x+ns.yyyy;vec4 y=y_*ns.x+ns.yyyy;vec4 h=1.0-abs(x)-abs(y);vec4 b0=vec4(x.xy,y.xy);vec4 b1=vec4(x.zw,y.zw);vec4 s0=floor(b0)*2.0+1.0;vec4 s1=floor(b1)*2.0+1.0;vec4 sh=-step(h,vec4(0.0));vec4 a0=b0.xzyw+s0.xzyw*sh.xxyy;vec4 a1=b1.xzyw+s1.xzyw*sh.zzww;vec3 p0=vec3(a0.xy,h.x);vec3 p1=vec3(a0.zw,h.y);vec3 p2=vec3(a1.xy,h.z);vec3 p3=vec3(a1.zw,h.w);vec4 norm=taylorInvSqrt(vec4(dot(p0,p0),dot(p1,p1),dot(p2,p2),dot(p3,p3)));p0*=norm.x;p1*=norm.y;p2*=norm.z;p3*=norm.w;vec4 m=max(0.6-vec4(dot(x0,x0),dot(x1,x1),dot(x2,x2),dot(x3,x3)),0.0);vec4 m2=m*m;vec4 m4=m2*m2;vec4 pdotx=vec4(dot(p0,x0),dot(p1,x1),dot(p2,x2),dot(p3,x3));vec4 temp=m2*m*pdotx;gradient=-8.0*(temp.x*x0+temp.y*x1+temp.z*x2+temp.w*x3);gradient+=m4.x*p0+m4.y*p1+m4.z*p2+m4.w*p3;gradient*=42.0;return 42.0*dot(m4,pdotx);}"; // eslint-disable-line
8219
8228
  var noise_simplex_4D = "#define GLSLIFY 1\nvec4 grad4(float j,vec4 ip){const vec4 ones=vec4(1.0,1.0,1.0,-1.0);vec4 p,s;p.xyz=floor(fract(vec3(j)*ip.xyz)*7.0)*ip.z-1.0;p.w=1.5-dot(abs(p.xyz),ones.xyz);s=vec4(lessThan(p,vec4(0.0)));p.xyz=p.xyz+(s.xyz*2.0-1.0)*s.www;return p;}\n#define F4 0.309016994374947451\nfloat simplex(vec4 v){const vec4 C=vec4(0.138196601125011,0.276393202250021,0.414589803375032,-0.447213595499958);vec4 i=floor(v+dot(v,vec4(F4)));vec4 x0=v-i+dot(i,C.xxxx);vec4 i0;vec3 isX=step(x0.yzw,x0.xxx);vec3 isYZ=step(x0.zww,x0.yyz);i0.x=isX.x+isX.y+isX.z;i0.yzw=1.0-isX;i0.y+=isYZ.x+isYZ.y;i0.zw+=1.0-isYZ.xy;i0.z+=isYZ.z;i0.w+=1.0-isYZ.z;vec4 i3=clamp(i0,0.0,1.0);vec4 i2=clamp(i0-1.0,0.0,1.0);vec4 i1=clamp(i0-2.0,0.0,1.0);vec4 x1=x0-i1+C.xxxx;vec4 x2=x0-i2+C.yyyy;vec4 x3=x0-i3+C.zzzz;vec4 x4=x0+C.wwww;i=mod289(i);float j0=permute(permute(permute(permute(i.w)+i.z)+i.y)+i.x);vec4 j1=permute(permute(permute(permute(i.w+vec4(i1.w,i2.w,i3.w,1.0))+i.z+vec4(i1.z,i2.z,i3.z,1.0))+i.y+vec4(i1.y,i2.y,i3.y,1.0))+i.x+vec4(i1.x,i2.x,i3.x,1.0));vec4 ip=vec4(1.0/294.0,1.0/49.0,1.0/7.0,0.0);vec4 p0=grad4(j0,ip);vec4 p1=grad4(j1.x,ip);vec4 p2=grad4(j1.y,ip);vec4 p3=grad4(j1.z,ip);vec4 p4=grad4(j1.w,ip);vec4 norm=taylorInvSqrt(vec4(dot(p0,p0),dot(p1,p1),dot(p2,p2),dot(p3,p3)));p0*=norm.x;p1*=norm.y;p2*=norm.z;p3*=norm.w;p4*=taylorInvSqrt(dot(p4,p4));vec3 m0=max(0.6-vec3(dot(x0,x0),dot(x1,x1),dot(x2,x2)),0.0);vec2 m1=max(0.6-vec2(dot(x3,x3),dot(x4,x4)),0.0);m0=m0*m0;m1=m1*m1;return 49.0*(dot(m0*m0,vec3(dot(p0,x0),dot(p1,x1),dot(p2,x2)))+dot(m1*m1,vec2(dot(p3,x3),dot(p4,x4))));}"; // eslint-disable-line
8220
8229
  var pbr_frag_define = "#define GLSLIFY 1\n#define MIN_PERCEPTUAL_ROUGHNESS 0.045\n#define MIN_ROUGHNESS 0.002025\nuniform float material_AlphaCutoff;uniform vec4 material_BaseColor;uniform float material_Metal;uniform float material_Roughness;uniform float material_IOR;uniform vec3 material_PBRSpecularColor;uniform float material_Glossiness;uniform vec3 material_EmissiveColor;uniform float material_NormalIntensity;uniform float material_OcclusionIntensity;uniform float material_OcclusionTextureCoord;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nuniform float material_ClearCoat;uniform float material_ClearCoatRoughness;\n#ifdef MATERIAL_HAS_CLEAR_COAT_TEXTURE\nuniform sampler2D material_ClearCoatTexture;\n#endif\n#ifdef MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE\nuniform sampler2D material_ClearCoatRoughnessTexture;\n#endif\n#ifdef MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE\nuniform sampler2D material_ClearCoatNormalTexture;\n#endif\n#endif\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nuniform vec3 material_AnisotropyInfo;\n#ifdef MATERIAL_HAS_ANISOTROPY_TEXTURE\nuniform sampler2D material_AnisotropyTexture;\n#endif\n#endif\n#ifdef MATERIAL_HAS_BASETEXTURE\nuniform sampler2D material_BaseTexture;\n#endif\n#ifdef MATERIAL_HAS_NORMALTEXTURE\nuniform sampler2D material_NormalTexture;\n#endif\n#ifdef MATERIAL_HAS_EMISSIVETEXTURE\nuniform sampler2D material_EmissiveTexture;\n#endif\n#ifdef MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE\nuniform sampler2D material_RoughnessMetallicTexture;\n#endif\n#ifdef MATERIAL_HAS_SPECULAR_GLOSSINESS_TEXTURE\nuniform sampler2D material_SpecularGlossinessTexture;\n#endif\n#ifdef MATERIAL_HAS_OCCLUSION_TEXTURE\nuniform sampler2D material_OcclusionTexture;\n#endif\nstruct ReflectedLight{vec3 directDiffuse;vec3 directSpecular;vec3 indirectDiffuse;vec3 indirectSpecular;};struct Geometry{vec3 position;vec3 normal;vec3 viewDir;float dotNV;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nvec3 clearCoatNormal;float clearCoatDotNV;\n#endif\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nvec3 anisotropicT;vec3 anisotropicB;vec3 anisotropicN;float anisotropy;\n#endif\n};struct Material{vec3 diffuseColor;float roughness;vec3 specularColor;float opacity;float f0;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nfloat clearCoat;float clearCoatRoughness;\n#endif\n};"; // eslint-disable-line
8221
- var pbr_helper = "#define GLSLIFY 1\n#include <normal_get>\nfloat computeSpecularOcclusion(float ambientOcclusion,float roughness,float dotNV){return saturate(pow(dotNV+ambientOcclusion,exp2(-16.0*roughness-1.0))-1.0+ambientOcclusion);}float getAARoughnessFactor(vec3 normal){\n#ifdef HAS_DERIVATIVES\nvec3 dxy=max(abs(dFdx(normal)),abs(dFdy(normal)));return MIN_PERCEPTUAL_ROUGHNESS+max(max(dxy.x,dxy.y),dxy.z);\n#else\nreturn MIN_PERCEPTUAL_ROUGHNESS;\n#endif\n}\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nvec3 getAnisotropicBentNormal(Geometry geometry,vec3 n,float roughness){vec3 anisotropyDirection=geometry.anisotropy>=0.0 ? geometry.anisotropicB : geometry.anisotropicT;vec3 anisotropicTangent=cross(anisotropyDirection,geometry.viewDir);vec3 anisotropicNormal=cross(anisotropicTangent,anisotropyDirection);vec3 bentNormal=normalize(mix(n,anisotropicNormal,abs(geometry.anisotropy)*saturate(5.0*roughness)));return bentNormal;}\n#endif\nvoid initGeometry(out Geometry geometry,bool isFrontFacing){geometry.position=v_pos;\n#ifdef CAMERA_ORTHOGRAPHIC\ngeometry.viewDir=-camera_Forward;\n#else\ngeometry.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)\nmat3 tbn=getTBN(isFrontFacing);\n#endif\n#ifdef MATERIAL_HAS_NORMALTEXTURE\ngeometry.normal=getNormalByNormalTexture(tbn,material_NormalTexture,material_NormalIntensity,v_uv,isFrontFacing);\n#else\ngeometry.normal=getNormal(isFrontFacing);\n#endif\ngeometry.dotNV=saturate(dot(geometry.normal,geometry.viewDir));\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\n#ifdef MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE\ngeometry.clearCoatNormal=getNormalByNormalTexture(tbn,material_ClearCoatNormalTexture,material_NormalIntensity,v_uv,isFrontFacing);\n#else\ngeometry.clearCoatNormal=getNormal(isFrontFacing);\n#endif\ngeometry.clearCoatDotNV=saturate(dot(geometry.clearCoatNormal,geometry.viewDir));\n#endif\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nfloat anisotropy=material_AnisotropyInfo.z;vec3 anisotropicDirection=vec3(material_AnisotropyInfo.xy,0.0);\n#ifdef MATERIAL_HAS_ANISOTROPY_TEXTURE\nvec3 anisotropyTextureInfo=texture2D(material_AnisotropyTexture,v_uv).rgb;anisotropy*=anisotropyTextureInfo.b;anisotropicDirection.xy*=anisotropyTextureInfo.rg*2.0-1.0;\n#endif\ngeometry.anisotropy=anisotropy;geometry.anisotropicT=normalize(tbn*anisotropicDirection);geometry.anisotropicB=normalize(cross(geometry.normal,geometry.anisotropicT));\n#endif\n}void initMaterial(out Material material,inout Geometry geometry){vec4 baseColor=material_BaseColor;float metal=material_Metal;float roughness=material_Roughness;vec3 specularColor=material_PBRSpecularColor;float glossiness=material_Glossiness;float alphaCutoff=material_AlphaCutoff;float f0=pow2((material_IOR-1.0)/(material_IOR+1.0));material.f0=f0;\n#ifdef MATERIAL_HAS_BASETEXTURE\nvec4 baseTextureColor=texture2D(material_BaseTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nbaseTextureColor=gammaToLinear(baseTextureColor);\n#endif\nbaseColor*=baseTextureColor;\n#endif\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\nbaseColor*=v_color;\n#endif\n#ifdef MATERIAL_IS_ALPHA_CUTOFF\nif(baseColor.a<alphaCutoff){discard;}\n#endif\n#ifdef MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE\nvec4 metalRoughMapColor=texture2D(material_RoughnessMetallicTexture,v_uv);roughness*=metalRoughMapColor.g;metal*=metalRoughMapColor.b;\n#endif\n#ifdef MATERIAL_HAS_SPECULAR_GLOSSINESS_TEXTURE\nvec4 specularGlossinessColor=texture2D(material_SpecularGlossinessTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nspecularGlossinessColor=gammaToLinear(specularGlossinessColor);\n#endif\nspecularColor*=specularGlossinessColor.rgb;glossiness*=specularGlossinessColor.a;\n#endif\n#ifdef IS_METALLIC_WORKFLOW\nmaterial.diffuseColor=baseColor.rgb*(1.0-metal);material.specularColor=mix(vec3(f0),baseColor.rgb,metal);material.roughness=roughness;\n#else\nfloat specularStrength=max(max(specularColor.r,specularColor.g),specularColor.b);material.diffuseColor=baseColor.rgb*(1.0-specularStrength);material.specularColor=specularColor;material.roughness=1.0-glossiness;\n#endif\nmaterial.roughness=max(material.roughness,getAARoughnessFactor(geometry.normal));\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nmaterial.clearCoat=material_ClearCoat;material.clearCoatRoughness=material_ClearCoatRoughness;\n#ifdef MATERIAL_HAS_CLEAR_COAT_TEXTURE\nmaterial.clearCoat*=texture2D(material_ClearCoatTexture,v_uv).r;\n#endif\n#ifdef MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE\nmaterial.clearCoatRoughness*=texture2D(material_ClearCoatRoughnessTexture,v_uv).g;\n#endif\nmaterial.clearCoat=saturate(material.clearCoat);material.clearCoatRoughness=max(material.clearCoatRoughness,getAARoughnessFactor(geometry.clearCoatNormal));\n#endif\n#ifdef MATERIAL_IS_TRANSPARENT\nmaterial.opacity=baseColor.a;\n#else\nmaterial.opacity=1.0;\n#endif\n#ifdef MATERIAL_ENABLE_ANISOTROPY\ngeometry.anisotropicN=getAnisotropicBentNormal(geometry,geometry.normal,material.roughness);\n#endif\n}\n#include <brdf>\n#include <direct_irradiance_frag_define>\n#include <ibl_frag_define>\n"; // eslint-disable-line
8230
+ var pbr_helper = "#define GLSLIFY 1\n#include <normal_get>\nfloat computeSpecularOcclusion(float ambientOcclusion,float roughness,float dotNV){return saturate(pow(dotNV+ambientOcclusion,exp2(-16.0*roughness-1.0))-1.0+ambientOcclusion);}float getAARoughnessFactor(vec3 normal){\n#ifdef HAS_DERIVATIVES\nvec3 dxy=max(abs(dFdx(normal)),abs(dFdy(normal)));return max(max(dxy.x,dxy.y),dxy.z);\n#else\nreturn 0.0;\n#endif\n}\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nvec3 getAnisotropicBentNormal(Geometry geometry,vec3 n,float roughness){vec3 anisotropyDirection=geometry.anisotropy>=0.0 ? geometry.anisotropicB : geometry.anisotropicT;vec3 anisotropicTangent=cross(anisotropyDirection,geometry.viewDir);vec3 anisotropicNormal=cross(anisotropicTangent,anisotropyDirection);vec3 bentNormal=normalize(mix(n,anisotropicNormal,abs(geometry.anisotropy)*saturate(5.0*roughness)));return bentNormal;}\n#endif\nvoid initGeometry(out Geometry geometry,bool isFrontFacing){geometry.position=v_pos;\n#ifdef CAMERA_ORTHOGRAPHIC\ngeometry.viewDir=-camera_Forward;\n#else\ngeometry.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)\nmat3 tbn=getTBN(isFrontFacing);\n#endif\n#ifdef MATERIAL_HAS_NORMALTEXTURE\ngeometry.normal=getNormalByNormalTexture(tbn,material_NormalTexture,material_NormalIntensity,v_uv,isFrontFacing);\n#else\ngeometry.normal=getNormal(isFrontFacing);\n#endif\ngeometry.dotNV=saturate(dot(geometry.normal,geometry.viewDir));\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\n#ifdef MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE\ngeometry.clearCoatNormal=getNormalByNormalTexture(tbn,material_ClearCoatNormalTexture,material_NormalIntensity,v_uv,isFrontFacing);\n#else\ngeometry.clearCoatNormal=getNormal(isFrontFacing);\n#endif\ngeometry.clearCoatDotNV=saturate(dot(geometry.clearCoatNormal,geometry.viewDir));\n#endif\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nfloat anisotropy=material_AnisotropyInfo.z;vec3 anisotropicDirection=vec3(material_AnisotropyInfo.xy,0.0);\n#ifdef MATERIAL_HAS_ANISOTROPY_TEXTURE\nvec3 anisotropyTextureInfo=texture2D(material_AnisotropyTexture,v_uv).rgb;anisotropy*=anisotropyTextureInfo.b;anisotropicDirection.xy*=anisotropyTextureInfo.rg*2.0-1.0;\n#endif\ngeometry.anisotropy=anisotropy;geometry.anisotropicT=normalize(tbn*anisotropicDirection);geometry.anisotropicB=normalize(cross(geometry.normal,geometry.anisotropicT));\n#endif\n}void initMaterial(out Material material,inout Geometry geometry){vec4 baseColor=material_BaseColor;float metal=material_Metal;float roughness=material_Roughness;vec3 specularColor=material_PBRSpecularColor;float glossiness=material_Glossiness;float alphaCutoff=material_AlphaCutoff;float f0=pow2((material_IOR-1.0)/(material_IOR+1.0));material.f0=f0;\n#ifdef MATERIAL_HAS_BASETEXTURE\nvec4 baseTextureColor=texture2D(material_BaseTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nbaseTextureColor=gammaToLinear(baseTextureColor);\n#endif\nbaseColor*=baseTextureColor;\n#endif\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\nbaseColor*=v_color;\n#endif\n#ifdef MATERIAL_IS_ALPHA_CUTOFF\nif(baseColor.a<alphaCutoff){discard;}\n#endif\n#ifdef MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE\nvec4 metalRoughMapColor=texture2D(material_RoughnessMetallicTexture,v_uv);roughness*=metalRoughMapColor.g;metal*=metalRoughMapColor.b;\n#endif\n#ifdef MATERIAL_HAS_SPECULAR_GLOSSINESS_TEXTURE\nvec4 specularGlossinessColor=texture2D(material_SpecularGlossinessTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nspecularGlossinessColor=gammaToLinear(specularGlossinessColor);\n#endif\nspecularColor*=specularGlossinessColor.rgb;glossiness*=specularGlossinessColor.a;\n#endif\n#ifdef IS_METALLIC_WORKFLOW\nmaterial.diffuseColor=baseColor.rgb*(1.0-metal);material.specularColor=mix(vec3(f0),baseColor.rgb,metal);material.roughness=roughness;\n#else\nfloat specularStrength=max(max(specularColor.r,specularColor.g),specularColor.b);material.diffuseColor=baseColor.rgb*(1.0-specularStrength);material.specularColor=specularColor;material.roughness=1.0-glossiness;\n#endif\nmaterial.roughness=max(MIN_PERCEPTUAL_ROUGHNESS,min(material.roughness+getAARoughnessFactor(geometry.normal),1.0));\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nmaterial.clearCoat=material_ClearCoat;material.clearCoatRoughness=material_ClearCoatRoughness;\n#ifdef MATERIAL_HAS_CLEAR_COAT_TEXTURE\nmaterial.clearCoat*=texture2D(material_ClearCoatTexture,v_uv).r;\n#endif\n#ifdef MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE\nmaterial.clearCoatRoughness*=texture2D(material_ClearCoatRoughnessTexture,v_uv).g;\n#endif\nmaterial.clearCoat=saturate(material.clearCoat);material.clearCoatRoughness=max(MIN_PERCEPTUAL_ROUGHNESS,min(material.clearCoatRoughness+getAARoughnessFactor(geometry.clearCoatNormal),1.0));\n#endif\n#ifdef MATERIAL_IS_TRANSPARENT\nmaterial.opacity=baseColor.a;\n#else\nmaterial.opacity=1.0;\n#endif\n#ifdef MATERIAL_ENABLE_ANISOTROPY\ngeometry.anisotropicN=getAnisotropicBentNormal(geometry,geometry.normal,material.roughness);\n#endif\n}\n#include <brdf>\n#include <direct_irradiance_frag_define>\n#include <ibl_frag_define>\n"; // eslint-disable-line
8222
8231
  var brdf = "#define GLSLIFY 1\nfloat F_Schlick(float f0,float dotLH){return f0+0.96*(pow(1.0-dotLH,5.0));}vec3 F_Schlick(vec3 specularColor,float dotLH){float fresnel=exp2((-5.55473*dotLH-6.98316)*dotLH);return(1.0-specularColor)*fresnel+specularColor;}float G_GGX_SmithCorrelated(float alpha,float dotNL,float dotNV){float a2=pow2(alpha);float gv=dotNL*sqrt(a2+(1.0-a2)*pow2(dotNV));float gl=dotNV*sqrt(a2+(1.0-a2)*pow2(dotNL));return 0.5/max(gv+gl,EPSILON);}\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nfloat G_GGX_SmithCorrelated_Anisotropic(float at,float ab,float ToV,float BoV,float ToL,float BoL,float NoV,float NoL){float lambdaV=NoL*length(vec3(at*ToV,ab*BoV,NoV));float lambdaL=NoV*length(vec3(at*ToL,ab*BoL,NoL));return 0.5/max(lambdaV+lambdaL,EPSILON);}\n#endif\nfloat D_GGX(float alpha,float dotNH){float a2=pow2(alpha);float denom=pow2(dotNH)*(a2-1.0)+1.0;return RECIPROCAL_PI*a2/pow2(denom);}\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nfloat D_GGX_Anisotropic(float at,float ab,float ToH,float BoH,float NoH){float a2=at*ab;vec3 d=vec3(ab*ToH,at*BoH,a2*NoH);float d2=dot(d,d);float b2=a2/d2;return a2*b2*b2*RECIPROCAL_PI;}\n#endif\nvec3 isotropicLobe(vec3 specularColor,float alpha,float dotNV,float dotNL,float dotNH,float dotLH){vec3 F=F_Schlick(specularColor,dotLH);float D=D_GGX(alpha,dotNH);float G=G_GGX_SmithCorrelated(alpha,dotNL,dotNV);return F*(G*D);}\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nvec3 anisotropicLobe(vec3 h,vec3 l,Geometry geometry,vec3 specularColor,float alpha,float dotNV,float dotNL,float dotNH,float dotLH){vec3 t=geometry.anisotropicT;vec3 b=geometry.anisotropicB;vec3 v=geometry.viewDir;float dotTV=dot(t,v);float dotBV=dot(b,v);float dotTL=dot(t,l);float dotBL=dot(b,l);float dotTH=dot(t,h);float dotBH=dot(b,h);float at=max(alpha*(1.0+geometry.anisotropy),MIN_ROUGHNESS);float ab=max(alpha*(1.0-geometry.anisotropy),MIN_ROUGHNESS);vec3 F=F_Schlick(specularColor,dotLH);float D=D_GGX_Anisotropic(at,ab,dotTH,dotBH,dotNH);float G=G_GGX_SmithCorrelated_Anisotropic(at,ab,dotTV,dotBV,dotTL,dotBL,dotNV,dotNL);return F*(G*D);}\n#endif\nvec3 BRDF_Specular_GGX(vec3 incidentDirection,Geometry geometry,vec3 normal,vec3 specularColor,float roughness){float alpha=pow2(roughness);vec3 halfDir=normalize(incidentDirection+geometry.viewDir);float dotNL=saturate(dot(normal,incidentDirection));float dotNV=saturate(dot(normal,geometry.viewDir));float dotNH=saturate(dot(normal,halfDir));float dotLH=saturate(dot(incidentDirection,halfDir));\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nreturn anisotropicLobe(halfDir,incidentDirection,geometry,specularColor,alpha,dotNV,dotNL,dotNH,dotLH);\n#else\nreturn isotropicLobe(specularColor,alpha,dotNV,dotNL,dotNH,dotLH);\n#endif\n}vec3 BRDF_Diffuse_Lambert(vec3 diffuseColor){return RECIPROCAL_PI*diffuseColor;}"; // eslint-disable-line
8223
8232
  var direct_irradiance_frag_define = "#define GLSLIFY 1\n#include <ShadowFragmentDeclaration>\nvoid addDirectRadiance(vec3 incidentDirection,vec3 color,Geometry geometry,Material material,inout ReflectedLight reflectedLight){float attenuation=1.0;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nfloat clearCoatDotNL=saturate(dot(geometry.clearCoatNormal,incidentDirection));vec3 clearCoatIrradiance=clearCoatDotNL*color;reflectedLight.directSpecular+=material.clearCoat*clearCoatIrradiance*BRDF_Specular_GGX(incidentDirection,geometry,geometry.clearCoatNormal,vec3(0.04),material.clearCoatRoughness);attenuation-=material.clearCoat*F_Schlick(material.f0,geometry.clearCoatDotNV);\n#endif\nfloat dotNL=saturate(dot(geometry.normal,incidentDirection));vec3 irradiance=dotNL*color*PI;reflectedLight.directSpecular+=attenuation*irradiance*BRDF_Specular_GGX(incidentDirection,geometry,geometry.normal,material.specularColor,material.roughness);reflectedLight.directDiffuse+=attenuation*irradiance*BRDF_Diffuse_Lambert(material.diffuseColor);}\n#ifdef SCENE_DIRECT_LIGHT_COUNT\nvoid addDirectionalDirectLightRadiance(DirectLight directionalLight,Geometry geometry,Material material,inout ReflectedLight reflectedLight){vec3 color=directionalLight.color;vec3 direction=-directionalLight.direction;addDirectRadiance(direction,color,geometry,material,reflectedLight);}\n#endif\n#ifdef SCENE_POINT_LIGHT_COUNT\nvoid addPointDirectLightRadiance(PointLight pointLight,Geometry geometry,Material material,inout ReflectedLight reflectedLight){vec3 lVector=pointLight.position-geometry.position;vec3 direction=normalize(lVector);float lightDistance=length(lVector);vec3 color=pointLight.color;color*=clamp(1.0-pow(lightDistance/pointLight.distance,4.0),0.0,1.0);addDirectRadiance(direction,color,geometry,material,reflectedLight);}\n#endif\n#ifdef SCENE_SPOT_LIGHT_COUNT\nvoid addSpotDirectLightRadiance(SpotLight spotLight,Geometry geometry,Material material,inout ReflectedLight reflectedLight){vec3 lVector=spotLight.position-geometry.position;vec3 direction=normalize(lVector);float lightDistance=length(lVector);float angleCos=dot(direction,-spotLight.direction);float spotEffect=smoothstep(spotLight.penumbraCos,spotLight.angleCos,angleCos);float decayEffect=clamp(1.0-pow(lightDistance/spotLight.distance,4.0),0.0,1.0);vec3 color=spotLight.color;color*=spotEffect*decayEffect;addDirectRadiance(direction,color,geometry,material,reflectedLight);}\n#endif\nvoid addTotalDirectRadiance(Geometry geometry,Material material,inout ReflectedLight reflectedLight){float shadowAttenuation=1.0;\n#ifdef SCENE_DIRECT_LIGHT_COUNT\nshadowAttenuation=1.0;\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nshadowAttenuation*=sampleShadowMap();\n#endif\nDirectLight directionalLight;for(int i=0;i<SCENE_DIRECT_LIGHT_COUNT;i++){if(!isRendererCulledByLight(renderer_Layer.xy,scene_DirectLightCullingMask[i])){directionalLight.color=scene_DirectLightColor[i];\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nif(i==0){directionalLight.color*=shadowAttenuation;}\n#endif\ndirectionalLight.direction=scene_DirectLightDirection[i];addDirectionalDirectLightRadiance(directionalLight,geometry,material,reflectedLight);}}\n#endif\n#ifdef SCENE_POINT_LIGHT_COUNT\nPointLight pointLight;for(int i=0;i<SCENE_POINT_LIGHT_COUNT;i++){if(!isRendererCulledByLight(renderer_Layer.xy,scene_PointLightCullingMask[i])){pointLight.color=scene_PointLightColor[i];pointLight.position=scene_PointLightPosition[i];pointLight.distance=scene_PointLightDistance[i];addPointDirectLightRadiance(pointLight,geometry,material,reflectedLight);}}\n#endif\n#ifdef SCENE_SPOT_LIGHT_COUNT\nSpotLight spotLight;for(int i=0;i<SCENE_SPOT_LIGHT_COUNT;i++){if(!isRendererCulledByLight(renderer_Layer.xy,scene_SpotLightCullingMask[i])){spotLight.color=scene_SpotLightColor[i];spotLight.position=scene_SpotLightPosition[i];spotLight.direction=scene_SpotLightDirection[i];spotLight.distance=scene_SpotLightDistance[i];spotLight.angleCos=scene_SpotLightAngleCos[i];spotLight.penumbraCos=scene_SpotLightPenumbraCos[i];addSpotDirectLightRadiance(spotLight,geometry,material,reflectedLight);}}\n#endif\n}"; // eslint-disable-line
8224
8233
  var ibl_frag_define = "#define GLSLIFY 1\nvec3 getLightProbeIrradiance(vec3 sh[9],vec3 normal){normal.x=-normal.x;vec3 result=sh[0]+sh[1]*(normal.y)+sh[2]*(normal.z)+sh[3]*(normal.x)+sh[4]*(normal.y*normal.x)+sh[5]*(normal.y*normal.z)+sh[6]*(3.0*normal.z*normal.z-1.0)+sh[7]*(normal.z*normal.x)+sh[8]*(normal.x*normal.x-normal.y*normal.y);return max(result,vec3(0.0));}vec3 envBRDFApprox(vec3 specularColor,float roughness,float dotNV){const vec4 c0=vec4(-1,-0.0275,-0.572,0.022);const vec4 c1=vec4(1,0.0425,1.04,-0.04);vec4 r=roughness*c0+c1;float a004=min(r.x*r.x,exp2(-9.28*dotNV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}float getSpecularMIPLevel(float roughness,int maxMIPLevel){return roughness*float(maxMIPLevel);}vec3 getReflectedVector(Geometry geometry,vec3 n){\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nvec3 r=reflect(-geometry.viewDir,geometry.anisotropicN);\n#else\nvec3 r=reflect(-geometry.viewDir,n);\n#endif\nreturn r;}vec3 getLightProbeRadiance(Geometry geometry,vec3 normal,float roughness,int maxMIPLevel,float specularIntensity){\n#ifndef SCENE_USE_SPECULAR_ENV\nreturn vec3(0);\n#else\nvec3 reflectVec=getReflectedVector(geometry,normal);reflectVec.x=-reflectVec.x;float specularMIPLevel=getSpecularMIPLevel(roughness,maxMIPLevel);\n#ifdef HAS_TEX_LOD\nvec4 envMapColor=textureCubeLodEXT(scene_EnvSpecularSampler,reflectVec,specularMIPLevel);\n#else\nvec4 envMapColor=textureCube(scene_EnvSpecularSampler,reflectVec,specularMIPLevel);\n#endif\n#ifdef SCENE_IS_DECODE_ENV_RGBM\nenvMapColor.rgb=RGBMToLinear(envMapColor,5.0).rgb;\n#ifdef ENGINE_IS_COLORSPACE_GAMMA\nenvMapColor=linearToGamma(envMapColor);\n#endif\n#else\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nenvMapColor=gammaToLinear(envMapColor);\n#endif\n#endif\nreturn envMapColor.rgb*specularIntensity;\n#endif\n}"; // eslint-disable-line
@@ -10111,6 +10120,7 @@
10111
10120
  TextureFormat[TextureFormat[/** RGBA format, 16 bits per channel. */ "R16G16B16A16"] = 7] = "R16G16B16A16";
10112
10121
  TextureFormat[TextureFormat[/** RGBA format, 32 bits per channel. */ "R32G32B32A32"] = 8] = "R32G32B32A32";
10113
10122
  TextureFormat[TextureFormat[/** RGBA unsigned integer format, 32 bits per channel. */ "R32G32B32A32_UInt"] = 9] = "R32G32B32A32_UInt";
10123
+ TextureFormat[TextureFormat[/** RGB unsigned float format, 11 bits in R channel, 11 bits in G channel, 10 bits in B channel. */ "R11G11B10_UFloat"] = 35] = "R11G11B10_UFloat";
10114
10124
  TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "BC1"] = 10] = "BC1";
10115
10125
  TextureFormat[TextureFormat[/** RGBA compressed format, 8 bits per pixel. */ "BC3"] = 11] = "BC3";
10116
10126
  TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 4x4 pixel block. */ "BC7"] = 12] = "BC7";
@@ -12785,22 +12795,23 @@
12785
12795
  * @param height - Need texture height
12786
12796
  * @param format - Need texture format
12787
12797
  * @param mipmap - Need texture mipmap
12798
+ * @param textureWrapMode - Texture wrap mode
12799
+ * @param textureFilterMode - Texture filter mode
12788
12800
  * @returns Texture
12789
- */ PipelineUtils.recreateTextureIfNeeded = function recreateTextureIfNeeded(engine, currentTexture, width, height, format, mipmap) {
12801
+ */ PipelineUtils.recreateTextureIfNeeded = function recreateTextureIfNeeded(engine, currentTexture, width, height, format, mipmap, textureWrapMode, textureFilterMode) {
12790
12802
  if (currentTexture) {
12791
12803
  if (currentTexture.width !== width || currentTexture.height !== height || currentTexture.format !== format || currentTexture.mipmapCount > 1 !== mipmap) {
12792
12804
  currentTexture.destroy(true);
12793
- var texture = new Texture2D(engine, width, height, format, mipmap);
12794
- texture.isGCIgnored = true;
12795
- return texture;
12796
- } else {
12797
- return currentTexture;
12805
+ currentTexture = new Texture2D(engine, width, height, format, mipmap);
12806
+ currentTexture.isGCIgnored = true;
12798
12807
  }
12799
12808
  } else {
12800
- var texture1 = new Texture2D(engine, width, height, format, mipmap);
12801
- texture1.isGCIgnored = true;
12802
- return texture1;
12809
+ currentTexture = new Texture2D(engine, width, height, format, mipmap);
12810
+ currentTexture.isGCIgnored = true;
12803
12811
  }
12812
+ currentTexture.wrapModeU = currentTexture.wrapModeV = textureWrapMode;
12813
+ currentTexture.filterMode = textureFilterMode;
12814
+ return currentTexture;
12804
12815
  };
12805
12816
  /**
12806
12817
  * Recreate render target if needed.
@@ -12812,15 +12823,17 @@
12812
12823
  * @param depthFormat - Need render target depth format
12813
12824
  * @param mipmap - Need render target mipmap
12814
12825
  * @param antiAliasing - Need render target anti aliasing
12826
+ * @param textureWrapMode - Texture wrap mode
12827
+ * @param textureFilterMode - Texture filter mode
12815
12828
  * @returns Render target
12816
- */ PipelineUtils.recreateRenderTargetIfNeeded = function recreateRenderTargetIfNeeded(engine, currentRenderTarget, width, height, colorFormat, depthFormat, needDepthTexture, mipmap, antiAliasing) {
12829
+ */ PipelineUtils.recreateRenderTargetIfNeeded = function recreateRenderTargetIfNeeded(engine, currentRenderTarget, width, height, colorFormat, depthFormat, needDepthTexture, mipmap, antiAliasing, textureWrapMode, textureFilterMode) {
12817
12830
  var _currentRenderTarget;
12818
12831
  var currentColorTexture = (_currentRenderTarget = currentRenderTarget) == null ? void 0 : _currentRenderTarget.getColorTexture(0);
12819
- var colorTexture = colorFormat ? PipelineUtils.recreateTextureIfNeeded(engine, currentColorTexture, width, height, colorFormat, mipmap) : null;
12832
+ var colorTexture = colorFormat ? PipelineUtils.recreateTextureIfNeeded(engine, currentColorTexture, width, height, colorFormat, mipmap, textureWrapMode, textureFilterMode) : null;
12820
12833
  if (needDepthTexture) {
12821
12834
  var _currentRenderTarget1;
12822
12835
  var currentDepthTexture = (_currentRenderTarget1 = currentRenderTarget) == null ? void 0 : _currentRenderTarget1.depthTexture;
12823
- var _$needDepthTexture = depthFormat ? PipelineUtils.recreateTextureIfNeeded(engine, currentDepthTexture, width, height, depthFormat, mipmap) : null;
12836
+ var _$needDepthTexture = depthFormat ? PipelineUtils.recreateTextureIfNeeded(engine, currentDepthTexture, width, height, depthFormat, mipmap, textureWrapMode, textureFilterMode) : null;
12824
12837
  if (currentColorTexture !== colorTexture || currentDepthTexture !== _$needDepthTexture) {
12825
12838
  var _currentRenderTarget2;
12826
12839
  (_currentRenderTarget2 = currentRenderTarget) == null ? void 0 : _currentRenderTarget2.destroy(true);
@@ -12829,38 +12842,46 @@
12829
12842
  }
12830
12843
  } else {
12831
12844
  var _currentRenderTarget3;
12832
- var needDepthFormat = depthFormat;
12833
- if (currentColorTexture !== colorTexture || ((_currentRenderTarget3 = currentRenderTarget) == null ? void 0 : _currentRenderTarget3._depthFormat) !== needDepthFormat) {
12845
+ if (currentColorTexture !== colorTexture || ((_currentRenderTarget3 = currentRenderTarget) == null ? void 0 : _currentRenderTarget3._depthFormat) !== depthFormat || currentRenderTarget.antiAliasing !== antiAliasing) {
12834
12846
  var _currentRenderTarget4;
12835
12847
  (_currentRenderTarget4 = currentRenderTarget) == null ? void 0 : _currentRenderTarget4.destroy(true);
12836
- currentRenderTarget = new RenderTarget(engine, width, height, colorTexture, needDepthFormat, antiAliasing);
12848
+ currentRenderTarget = new RenderTarget(engine, width, height, colorTexture, depthFormat, antiAliasing);
12837
12849
  currentRenderTarget.isGCIgnored = true;
12838
12850
  }
12839
12851
  }
12840
12852
  return currentRenderTarget;
12841
12853
  };
12842
12854
  /**
12843
- * Blit texture to destination render target.
12855
+ * Blit texture to destination render target using a triangle.
12844
12856
  * @param engine - Engine
12845
12857
  * @param source - Source texture
12846
12858
  * @param destination - Destination render target
12847
12859
  * @param mipLevel - Mip level to blit
12848
12860
  * @param viewport - Viewport
12849
- */ PipelineUtils.blitTexture = function blitTexture(engine, source, destination, mipLevel, viewport) {
12861
+ * @param material - The material to use when blitting
12862
+ * @param passIndex - Pass index to use of the provided material
12863
+ */ PipelineUtils.blitTexture = function blitTexture(engine, source, destination, mipLevel, viewport, material, passIndex) {
12850
12864
  if (mipLevel === void 0) mipLevel = 0;
12865
+ if (viewport === void 0) viewport = PipelineUtils.defaultViewport;
12866
+ if (material === void 0) material = null;
12867
+ if (passIndex === void 0) passIndex = 0;
12851
12868
  var basicResources = engine._basicResources;
12852
12869
  var blitMesh = destination ? basicResources.flipYBlitMesh : basicResources.blitMesh;
12853
- var blitMaterial = basicResources.blitMaterial;
12870
+ var blitMaterial = material || basicResources.blitMaterial;
12854
12871
  var rhi = engine._hardwareRenderer;
12855
12872
  var context = engine._renderContext;
12856
12873
  // We not use projection matrix when blit, but we must modify flipProjection to make front face correct
12857
- context.flipProjection = destination ? true : false;
12858
- rhi.activeRenderTarget(destination, viewport != null ? viewport : PipelineUtils.defaultViewport, context.flipProjection, 0);
12874
+ context.flipProjection = !!destination;
12875
+ rhi.activeRenderTarget(destination, viewport, context.flipProjection, 0);
12859
12876
  var rendererShaderData = PipelineUtils._rendererShaderData;
12860
- var pass = blitMaterial.shader.subShaders[0].passes[0];
12861
- var program = pass._getShaderProgram(engine, Shader._compileMacros);
12862
12877
  rendererShaderData.setTexture(PipelineUtils._blitTextureProperty, source);
12863
12878
  rendererShaderData.setFloat(PipelineUtils._blitMipLevelProperty, mipLevel);
12879
+ PipelineUtils._texelSize.set(1 / source.width, 1 / source.height, source.width, source.height);
12880
+ rendererShaderData.setVector4(PipelineUtils._blitTexelSizeProperty, PipelineUtils._texelSize);
12881
+ var pass = blitMaterial.shader.subShaders[0].passes[passIndex];
12882
+ var compileMacros = Shader._compileMacros;
12883
+ ShaderMacroCollection.unionCollection(context.camera._globalShaderMacro, blitMaterial.shaderData._macroCollection, compileMacros);
12884
+ var program = pass._getShaderProgram(engine, compileMacros);
12864
12885
  program.bind();
12865
12886
  program.groupingOtherUniformBlock();
12866
12887
  program.uploadAll(program.rendererUniformBlock, rendererShaderData);
@@ -12877,9 +12898,16 @@
12877
12898
  (function() {
12878
12899
  PipelineUtils._blitMipLevelProperty = ShaderProperty.getByName("renderer_BlitMipLevel");
12879
12900
  })();
12901
+ (function() {
12902
+ PipelineUtils._blitTexelSizeProperty = ShaderProperty.getByName("renderer_texelSize") // x: 1/width, y: 1/height, z: width, w: height
12903
+ ;
12904
+ })();
12880
12905
  (function() {
12881
12906
  PipelineUtils._rendererShaderData = new ShaderData(ShaderDataGroup.Renderer);
12882
12907
  })();
12908
+ (function() {
12909
+ PipelineUtils._texelSize = new Vector4();
12910
+ })();
12883
12911
  (function() {
12884
12912
  PipelineUtils.defaultViewport = new Vector4(0, 0, 1, 1);
12885
12913
  })();
@@ -13001,6 +13029,8 @@
13001
13029
  _this._renderTarget = null;
13002
13030
  _this._depthBufferParams = new Vector4();
13003
13031
  _this._opaqueTextureEnabled = false;
13032
+ _this._enableHDR = false;
13033
+ _this._enablePostProcess = false;
13004
13034
  _this._viewport = new Vector4(0, 0, 1, 1);
13005
13035
  _this._pixelViewport = new Rect(0, 0, 0, 0);
13006
13036
  _this._inverseProjectionMatrix = new Matrix();
@@ -13207,6 +13237,11 @@
13207
13237
  };
13208
13238
  /**
13209
13239
  * @internal
13240
+ */ _proto._getInternalColorTextureFormat = function _getInternalColorTextureFormat() {
13241
+ return this._enableHDR ? this.engine._hardwareRenderer.isWebGL2 ? exports.TextureFormat.R11G11B10_UFloat : exports.TextureFormat.R16G16B16A16 : exports.TextureFormat.R8G8B8A8;
13242
+ };
13243
+ /**
13244
+ * @internal
13210
13245
  * @inheritdoc
13211
13246
  */ _proto._onDestroy = function _onDestroy() {
13212
13247
  var _this__renderPipeline;
@@ -13295,9 +13330,6 @@
13295
13330
  }
13296
13331
  return this._inverseProjectionMatrix;
13297
13332
  };
13298
- _proto._forceUseInternalCanvas = function _forceUseInternalCanvas() {
13299
- return this.opaqueTextureEnabled;
13300
- };
13301
13333
  _proto._onPixelViewportChanged = function _onPixelViewportChanged() {
13302
13334
  this._updatePixelViewport();
13303
13335
  var _this__customAspectRatio;
@@ -13306,7 +13338,7 @@
13306
13338
  };
13307
13339
  _proto._checkMainCanvasAntialiasWaste = function _checkMainCanvasAntialiasWaste() {
13308
13340
  if (this.independentCanvasEnabled && Vector4.equals(this._viewport, PipelineUtils.defaultViewport)) {
13309
- console.warn("Camera use independent canvas and viewport cover the whole screen, it is recommended to disable antialias, depth and stencil to save memory when create engine.");
13341
+ Logger.warn("Camera use independent canvas and viewport cover the whole screen, it is recommended to disable antialias, depth and stencil to save memory when create engine.");
13310
13342
  }
13311
13343
  };
13312
13344
  _create_class$2(Camera1, [
@@ -13317,7 +13349,6 @@
13317
13349
  * If enabled, the opaque texture can be accessed in the shader using `camera_OpaqueTexture`.
13318
13350
  *
13319
13351
  * @defaultValue `false`
13320
- *
13321
13352
  * @remarks If enabled, the `independentCanvasEnabled` property will be forced to be true.
13322
13353
  */ function get() {
13323
13354
  return this._opaqueTextureEnabled;
@@ -13336,10 +13367,10 @@
13336
13367
  *
13337
13368
  * @remarks If true, the msaa in viewport can turn or off independently by `msaaSamples` property.
13338
13369
  */ function get() {
13339
- if (this._renderTarget) {
13340
- return false;
13370
+ if (this.enableHDR || this.enablePostProcess && this.scene._postProcessManager.hasActiveEffect) {
13371
+ return true;
13341
13372
  }
13342
- return this._forceUseInternalCanvas();
13373
+ return this.opaqueTextureEnabled && !this._renderTarget;
13343
13374
  }
13344
13375
  },
13345
13376
  {
@@ -13524,13 +13555,38 @@
13524
13555
  key: "enableHDR",
13525
13556
  get: /**
13526
13557
  * Whether to enable HDR.
13527
- * @todo When render pipeline modification
13558
+ * @defaultValue `false`
13559
+ * @remarks If enabled, the `independentCanvasEnabled` property will be forced to be true.
13528
13560
  */ function get() {
13529
- console.log("not implementation");
13530
- return false;
13561
+ return this._enableHDR;
13562
+ },
13563
+ set: function set(value) {
13564
+ if (this.enableHDR !== value) {
13565
+ var rhi = this.engine._hardwareRenderer;
13566
+ var supportHDR = rhi.isWebGL2 || rhi.canIUse(exports.GLCapabilityType.textureHalfFloat);
13567
+ if (value && !supportHDR) {
13568
+ Logger.warn("Can't enable HDR in this device.");
13569
+ return;
13570
+ }
13571
+ this._enableHDR = value;
13572
+ this._checkMainCanvasAntialiasWaste();
13573
+ }
13574
+ }
13575
+ },
13576
+ {
13577
+ key: "enablePostProcess",
13578
+ get: /**
13579
+ * Whether to enable post process.
13580
+ * @defaultValue `false`
13581
+ * @remarks If enabled, the `independentCanvasEnabled` property will be forced to be true.
13582
+ */ function get() {
13583
+ return this._enablePostProcess;
13531
13584
  },
13532
13585
  set: function set(value) {
13533
- console.log("not implementation");
13586
+ if (this._enablePostProcess !== value) {
13587
+ this._enablePostProcess = value;
13588
+ this._checkMainCanvasAntialiasWaste();
13589
+ }
13534
13590
  }
13535
13591
  },
13536
13592
  {
@@ -13546,7 +13602,6 @@
13546
13602
  value && this._addResourceReferCount(value, 1);
13547
13603
  this._renderTarget = value;
13548
13604
  this._onPixelViewportChanged();
13549
- this._checkMainCanvasAntialiasWaste();
13550
13605
  }
13551
13606
  }
13552
13607
  }
@@ -13628,7 +13683,7 @@
13628
13683
  /**
13629
13684
  * PipelinePass is a base class for all pipeline passes.
13630
13685
  */ var PipelinePass = function PipelinePass(engine) {
13631
- this._engine = engine;
13686
+ this.engine = engine;
13632
13687
  };
13633
13688
  /**
13634
13689
  * @internal
@@ -14495,7 +14550,7 @@
14495
14550
  this._updateReceiversShaderData(light);
14496
14551
  };
14497
14552
  _proto._renderDirectShadowMap = function _renderDirectShadowMap(context, light) {
14498
- var _this = this, engine = _this._engine, camera = _this._camera, viewports = _this._viewportOffsets, shadowSliceData = _this._shadowSliceData, splitBoundSpheres = _this._splitBoundSpheres, shadowMatrices = _this._shadowMatrices;
14553
+ var _this = this, engine = _this.engine, camera = _this._camera, viewports = _this._viewportOffsets, shadowSliceData = _this._shadowSliceData, splitBoundSpheres = _this._splitBoundSpheres, shadowMatrices = _this._shadowMatrices;
14499
14554
  var _camera__renderPipeline__cullingResults = camera._renderPipeline._cullingResults, opaqueQueue = _camera__renderPipeline__cullingResults.opaqueQueue, alphaTestQueue = _camera__renderPipeline__cullingResults.alphaTestQueue;
14500
14555
  var scene = camera.scene;
14501
14556
  var componentsManager = scene._componentsManager;
@@ -14514,13 +14569,12 @@
14514
14569
  var renderTarget;
14515
14570
  var shadowTexture;
14516
14571
  if (this._supportDepthTexture) {
14517
- renderTarget = PipelineUtils.recreateRenderTargetIfNeeded(engine, this._renderTarget, width, height, null, format, true, false, 1);
14572
+ renderTarget = PipelineUtils.recreateRenderTargetIfNeeded(engine, this._renderTarget, width, height, null, format, true, false, 1, exports.TextureWrapMode.Clamp, exports.TextureFilterMode.Bilinear);
14518
14573
  shadowTexture = renderTarget.depthTexture;
14519
14574
  } else {
14520
- renderTarget = PipelineUtils.recreateRenderTargetIfNeeded(engine, this._renderTarget, width, height, format, null, false, false, 1);
14575
+ renderTarget = PipelineUtils.recreateRenderTargetIfNeeded(engine, this._renderTarget, width, height, format, null, false, false, 1, exports.TextureWrapMode.Clamp, exports.TextureFilterMode.Bilinear);
14521
14576
  shadowTexture = renderTarget.getColorTexture(0);
14522
14577
  }
14523
- shadowTexture.wrapModeU = shadowTexture.wrapModeV = exports.TextureWrapMode.Clamp;
14524
14578
  if (engine._hardwareRenderer._isWebGL2) {
14525
14579
  shadowTexture.depthCompareFunction = exports.TextureDepthCompareFunction.Less;
14526
14580
  }
@@ -14769,22 +14823,17 @@
14769
14823
  _inherits$2(DepthOnlyPass, PipelinePass1);
14770
14824
  var _proto = DepthOnlyPass.prototype;
14771
14825
  _proto.onConfig = function onConfig(camera) {
14772
- var engine = this._engine;
14826
+ var engine = this.engine;
14773
14827
  var _camera_pixelViewport = camera.pixelViewport, width = _camera_pixelViewport.width, height = _camera_pixelViewport.height;
14774
- var renderTarget = PipelineUtils.recreateRenderTargetIfNeeded(engine, this._renderTarget, width, height, null, exports.TextureFormat.Depth16, true, false, 1);
14775
- var depthTexture = renderTarget.depthTexture;
14776
- depthTexture.wrapModeU = depthTexture.wrapModeV = exports.TextureWrapMode.Clamp;
14777
- depthTexture.filterMode = exports.TextureFilterMode.Point;
14828
+ var renderTarget = PipelineUtils.recreateRenderTargetIfNeeded(engine, this._renderTarget, width, height, null, exports.TextureFormat.Depth16, true, false, 1, exports.TextureWrapMode.Clamp, exports.TextureFilterMode.Point);
14778
14829
  this._renderTarget = renderTarget;
14779
14830
  };
14780
14831
  _proto.onRender = function onRender(context, cullingResults) {
14781
- var engine = this._engine;
14832
+ var engine = this.engine;
14782
14833
  var renderTarget = this._renderTarget;
14783
14834
  var camera = context.camera;
14784
14835
  var rhi = engine._hardwareRenderer;
14785
- rhi.activeRenderTarget(renderTarget, camera.viewport, context.flipProjection, 0);
14786
- rhi.viewport(0, 0, renderTarget.width, renderTarget.height);
14787
- rhi.scissor(0, 0, renderTarget.width, renderTarget.height);
14836
+ rhi.activeRenderTarget(renderTarget, PipelineUtils.defaultViewport, context.flipProjection, 0);
14788
14837
  rhi.clearRenderTarget(engine, exports.CameraClearFlags.Depth, null);
14789
14838
  engine._renderCount++;
14790
14839
  cullingResults.opaqueQueue.render(context, exports.PipelineStage.DepthOnly);
@@ -14808,14 +14857,11 @@
14808
14857
  var isNoDownsampling = downsampling === exports.Downsampling.None;
14809
14858
  var viewport = camera.pixelViewport;
14810
14859
  var sizeScale = isNoDownsampling ? 1.0 : downsampling === exports.Downsampling.TwoX ? 0.5 : 0.25;
14811
- var opaqueRenderTarget = PipelineUtils.recreateRenderTargetIfNeeded(this._engine, this._renderTarget, viewport.width * sizeScale, viewport.height * sizeScale, exports.TextureFormat.R8G8B8A8, null, false, false, 1);
14812
- var colorTexture = opaqueRenderTarget.getColorTexture(0);
14813
- colorTexture.wrapModeU = colorTexture.wrapModeV = exports.TextureWrapMode.Clamp;
14814
- colorTexture.filterMode = isNoDownsampling ? exports.TextureFilterMode.Point : exports.TextureFilterMode.Bilinear;
14860
+ var opaqueRenderTarget = PipelineUtils.recreateRenderTargetIfNeeded(this.engine, this._renderTarget, viewport.width * sizeScale, viewport.height * sizeScale, camera._getInternalColorTextureFormat(), null, false, false, 1, exports.TextureWrapMode.Clamp, isNoDownsampling ? exports.TextureFilterMode.Point : exports.TextureFilterMode.Bilinear);
14815
14861
  this._renderTarget = opaqueRenderTarget;
14816
14862
  };
14817
- _proto.onRender = function onRender(context, _) {
14818
- PipelineUtils.blitTexture(this._engine, this._cameraColorTexture, this._renderTarget);
14863
+ _proto.onRender = function onRender(context) {
14864
+ PipelineUtils.blitTexture(this.engine, this._cameraColorTexture, this._renderTarget);
14819
14865
  context.camera.shaderData.setTexture(exports.Camera._cameraOpaqueTextureProperty, this._renderTarget.getColorTexture(0));
14820
14866
  };
14821
14867
  return OpaqueTexturePass;
@@ -14877,9 +14923,7 @@
14877
14923
  var independentCanvasEnabled = camera.independentCanvasEnabled;
14878
14924
  if (independentCanvasEnabled) {
14879
14925
  var viewport = camera.pixelViewport;
14880
- var internalColorTarget = PipelineUtils.recreateRenderTargetIfNeeded(engine, this._internalColorTarget, viewport.width, viewport.height, exports.TextureFormat.R8G8B8A8, exports.TextureFormat.Depth24Stencil8, false, false, camera.msaaSamples);
14881
- var colorTexture = internalColorTarget.getColorTexture(0);
14882
- colorTexture.wrapModeU = colorTexture.wrapModeV = exports.TextureWrapMode.Clamp;
14926
+ var internalColorTarget = PipelineUtils.recreateRenderTargetIfNeeded(engine, this._internalColorTarget, viewport.width, viewport.height, camera._getInternalColorTextureFormat(), exports.TextureFormat.Depth24Stencil8, false, false, camera.msaaSamples, exports.TextureWrapMode.Clamp, exports.TextureFilterMode.Bilinear);
14883
14927
  this._internalColorTarget = internalColorTarget;
14884
14928
  } else {
14885
14929
  var internalColorTarget1 = this._internalColorTarget;
@@ -14893,17 +14937,16 @@
14893
14937
  this._drawRenderPass(context, camera, cubeFace, mipLevel, ignoreClear);
14894
14938
  };
14895
14939
  _proto._drawRenderPass = function _drawRenderPass(context, camera, cubeFace, mipLevel, ignoreClear) {
14896
- var _colorTarget, _colorTarget1;
14940
+ var _cameraRenderTarget, _cameraRenderTarget1;
14897
14941
  var cullingResults = this._cullingResults;
14898
14942
  var opaqueQueue = cullingResults.opaqueQueue, alphaTestQueue = cullingResults.alphaTestQueue, transparentQueue = cullingResults.transparentQueue;
14899
14943
  var engine = camera.engine, scene = camera.scene;
14900
14944
  var background = scene.background;
14901
- var internalColorTarget = this._internalColorTarget;
14902
14945
  var rhi = engine._hardwareRenderer;
14903
- var _camera_renderTarget;
14904
- var colorTarget = (_camera_renderTarget = camera.renderTarget) != null ? _camera_renderTarget : internalColorTarget;
14946
+ var internalColorTarget = this._internalColorTarget;
14947
+ var colorTarget = internalColorTarget || camera.renderTarget;
14905
14948
  var colorViewport = internalColorTarget ? PipelineUtils.defaultViewport : camera.viewport;
14906
- var needFlipProjection = camera.renderTarget && cubeFace == undefined || internalColorTarget !== null;
14949
+ var needFlipProjection = !!internalColorTarget || camera.renderTarget && cubeFace == undefined;
14907
14950
  if (context.flipProjection !== needFlipProjection) {
14908
14951
  // Just add projection matrix update type is enough
14909
14952
  context.rendererUpdateFlag |= ContextRendererUpdateFlag.ProjectionMatrix;
@@ -14930,18 +14973,23 @@
14930
14973
  colorTarget._blitRenderTarget();
14931
14974
  var opaqueTexturePass = this._opaqueTexturePass;
14932
14975
  opaqueTexturePass.onConfig(camera, colorTarget.getColorTexture(0));
14933
- opaqueTexturePass.onRender(context, cullingResults);
14976
+ opaqueTexturePass.onRender(context);
14934
14977
  // Should revert to original render target
14935
14978
  rhi.activeRenderTarget(colorTarget, colorViewport, context.flipProjection, mipLevel, cubeFace);
14936
14979
  } else {
14937
14980
  camera.shaderData.setTexture(exports.Camera._cameraOpaqueTextureProperty, null);
14938
14981
  }
14939
14982
  transparentQueue.render(context, exports.PipelineStage.Forward);
14940
- (_colorTarget = colorTarget) == null ? void 0 : _colorTarget._blitRenderTarget();
14941
- (_colorTarget1 = colorTarget) == null ? void 0 : _colorTarget1.generateMipmaps();
14942
- if (internalColorTarget) {
14943
- PipelineUtils.blitTexture(engine, internalColorTarget.getColorTexture(0), null, 0, camera.viewport);
14983
+ var postProcessManager = scene._postProcessManager;
14984
+ var cameraRenderTarget = camera.renderTarget;
14985
+ if (camera.enablePostProcess && postProcessManager.hasActiveEffect) {
14986
+ postProcessManager._render(context, internalColorTarget, cameraRenderTarget);
14987
+ } else if (internalColorTarget) {
14988
+ internalColorTarget._blitRenderTarget();
14989
+ PipelineUtils.blitTexture(engine, internalColorTarget.getColorTexture(0), cameraRenderTarget, 0, camera.viewport);
14944
14990
  }
14991
+ (_cameraRenderTarget = cameraRenderTarget) == null ? void 0 : _cameraRenderTarget._blitRenderTarget();
14992
+ (_cameraRenderTarget1 = cameraRenderTarget) == null ? void 0 : _cameraRenderTarget1.generateMipmaps();
14945
14993
  };
14946
14994
  /**
14947
14995
  * Push render data to render queue.
@@ -23088,37 +23136,29 @@
23088
23136
  -1,
23089
23137
  0,
23090
23138
  1,
23091
- 1,
23139
+ 3,
23092
23140
  -1,
23093
- 1,
23141
+ 2,
23094
23142
  1,
23095
23143
  -1,
23096
- 1,
23097
- 0,
23144
+ 3,
23098
23145
  0,
23099
- 1,
23100
- 1,
23101
- 1,
23102
- 0
23103
- ]); // right-top
23146
+ -1
23147
+ ]); // left-top
23104
23148
  // prettier-ignore
23105
23149
  var flipYVertices = new Float32Array([
23106
- 1,
23150
+ 3,
23107
23151
  -1,
23108
- 1,
23152
+ 2,
23109
23153
  0,
23110
23154
  -1,
23111
23155
  -1,
23112
23156
  0,
23113
23157
  0,
23114
- 1,
23115
- 1,
23116
- 1,
23117
- 1,
23118
23158
  -1,
23119
- 1,
23159
+ 3,
23120
23160
  0,
23121
- 1
23161
+ 2
23122
23162
  ]); // left-top
23123
23163
  var blitMaterial = new Material(engine, Shader.find("blit"));
23124
23164
  blitMaterial._addReferCount(1);
@@ -23156,7 +23196,7 @@
23156
23196
  new VertexElement("POSITION_UV", 0, exports.VertexElementFormat.Vector4, 0)
23157
23197
  ]);
23158
23198
  mesh.setVertexBufferBinding(new Buffer(engine, exports.BufferBindFlag.VertexBuffer, vertices, exports.BufferUsage.Static), 16);
23159
- mesh.addSubMesh(0, 4, exports.MeshTopology.TriangleStrip);
23199
+ mesh.addSubMesh(0, 3, exports.MeshTopology.Triangles);
23160
23200
  return mesh;
23161
23201
  };
23162
23202
  _proto._create1x1Texture = function _create1x1Texture(engine, type, format, pixel) {
@@ -29514,6 +29554,455 @@
29514
29554
  * Each type of light source is at most 10, beyond which it will not take effect.
29515
29555
  * */ LightManager._maxLight = 10;
29516
29556
  })();
29557
+ var fragBlurH = "#define GLSLIFY 1\n#include <PostCommon>\nvarying vec2 v_uv;uniform sampler2D renderer_BlitTexture;uniform vec4 renderer_texelSize;void main(){vec2 texelSize=renderer_texelSize.xy*2.0;mediump vec4 c0=sampleTexture(renderer_BlitTexture,v_uv-vec2(texelSize.x*4.0,0.0));mediump vec4 c1=sampleTexture(renderer_BlitTexture,v_uv-vec2(texelSize.x*3.0,0.0));mediump vec4 c2=sampleTexture(renderer_BlitTexture,v_uv-vec2(texelSize.x*2.0,0.0));mediump vec4 c3=sampleTexture(renderer_BlitTexture,v_uv-vec2(texelSize.x*1.0,0.0));mediump vec4 c4=sampleTexture(renderer_BlitTexture,v_uv);mediump vec4 c5=sampleTexture(renderer_BlitTexture,v_uv+vec2(texelSize.x*1.0,0.0));mediump vec4 c6=sampleTexture(renderer_BlitTexture,v_uv+vec2(texelSize.x*2.0,0.0));mediump vec4 c7=sampleTexture(renderer_BlitTexture,v_uv+vec2(texelSize.x*3.0,0.0));mediump vec4 c8=sampleTexture(renderer_BlitTexture,v_uv+vec2(texelSize.x*4.0,0.0));gl_FragColor=c0*0.01621622+c1*0.05405405+c2*0.12162162+c3*0.19459459+c4*0.22702703+c5*0.19459459+c6*0.12162162+c7*0.05405405+c8*0.01621622;\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ngl_FragColor=linearToGamma(gl_FragColor);\n#endif\n}"; // eslint-disable-line
29558
+ var fragBlurV = "#define GLSLIFY 1\n#include <PostCommon>\nvarying vec2 v_uv;uniform sampler2D renderer_BlitTexture;uniform vec4 renderer_texelSize;void main(){vec2 texelSize=renderer_texelSize.xy;mediump vec4 c0=sampleTexture(renderer_BlitTexture,v_uv-vec2(0.0,texelSize.y*3.23076923));mediump vec4 c1=sampleTexture(renderer_BlitTexture,v_uv-vec2(0.0,texelSize.y*1.38461538));mediump vec4 c2=sampleTexture(renderer_BlitTexture,v_uv);mediump vec4 c3=sampleTexture(renderer_BlitTexture,v_uv+vec2(0.0,texelSize.y*1.38461538));mediump vec4 c4=sampleTexture(renderer_BlitTexture,v_uv+vec2(0.0,texelSize.y*3.23076923));gl_FragColor=c0*0.07027027+c1*0.31621622+c2*0.22702703+c3*0.31621622+c4*0.07027027;\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ngl_FragColor=linearToGamma(gl_FragColor);\n#endif\n}"; // eslint-disable-line
29559
+ var fragPrefilter = "#define GLSLIFY 1\n#include <PostCommon>\nvarying vec2 v_uv;uniform sampler2D renderer_BlitTexture;uniform vec4 material_BloomParams;uniform vec4 renderer_texelSize;void main(){\n#ifdef BLOOM_HQ\nvec2 texelSize=renderer_texelSize.xy;mediump vec4 A=sampleTexture(renderer_BlitTexture,v_uv+texelSize*vec2(-1.0,-1.0));mediump vec4 B=sampleTexture(renderer_BlitTexture,v_uv+texelSize*vec2(0.0,-1.0));mediump vec4 C=sampleTexture(renderer_BlitTexture,v_uv+texelSize*vec2(1.0,-1.0));mediump vec4 D=sampleTexture(renderer_BlitTexture,v_uv+texelSize*vec2(-0.5,-0.5));mediump vec4 E=sampleTexture(renderer_BlitTexture,v_uv+texelSize*vec2(0.5,-0.5));mediump vec4 F=sampleTexture(renderer_BlitTexture,v_uv+texelSize*vec2(-1.0,0.0));mediump vec4 G=sampleTexture(renderer_BlitTexture,v_uv);mediump vec4 H=sampleTexture(renderer_BlitTexture,v_uv+texelSize*vec2(1.0,0.0));mediump vec4 I=sampleTexture(renderer_BlitTexture,v_uv+texelSize*vec2(-0.5,0.5));mediump vec4 J=sampleTexture(renderer_BlitTexture,v_uv+texelSize*vec2(0.5,0.5));mediump vec4 K=sampleTexture(renderer_BlitTexture,v_uv+texelSize*vec2(-1.0,1.0));mediump vec4 L=sampleTexture(renderer_BlitTexture,v_uv+texelSize*vec2(0.0,1.0));mediump vec4 M=sampleTexture(renderer_BlitTexture,v_uv+texelSize*vec2(1.0,1.0));mediump vec2 scale=vec2(0.5,0.125);mediump vec2 div=(1.0/4.0)*scale;mediump vec4 samplerColor=(D+E+I+J)*div.x;samplerColor+=(A+B+G+F)*div.y;samplerColor+=(B+C+H+G)*div.y;samplerColor+=(F+G+L+K)*div.y;samplerColor+=(G+H+M+L)*div.y;\n#else\nmediump vec4 samplerColor=sampleTexture(renderer_BlitTexture,v_uv);\n#endif\nmediump vec3 color=samplerColor.rgb;color=min(color,HALF_MAX);mediump float brightness=max3(color);float threshold=material_BloomParams.x;float thresholdKnee=material_BloomParams.y;mediump float softness=clamp(brightness-threshold+thresholdKnee,0.0,2.0*thresholdKnee);softness=(softness*softness)/(4.0*thresholdKnee+1e-4);mediump float multiplier=max(brightness-threshold,softness)/max(brightness,1e-4);color*=multiplier;color=max(color,0.0);gl_FragColor=vec4(color,samplerColor.a);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ngl_FragColor=linearToGamma(gl_FragColor);\n#endif\n}"; // eslint-disable-line
29560
+ var fragUpsample = "#define GLSLIFY 1\n#include <PostCommon>\n#include <Filtering>\nvarying vec2 v_uv;uniform sampler2D renderer_BlitTexture;uniform sampler2D material_lowMipTexture;uniform vec4 material_BloomParams;uniform vec4 material_lowMipTexelSize;void main(){mediump vec4 highMip=sampleTexture(renderer_BlitTexture,v_uv);\n#ifdef BLOOM_HQ\nmediump vec4 lowMip=sampleTexture2DBicubic(material_lowMipTexture,v_uv,material_lowMipTexelSize);\n#else\nmediump vec4 lowMip=sampleTexture(material_lowMipTexture,v_uv);\n#endif\ngl_FragColor=mix(highMip,lowMip,material_BloomParams.z);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ngl_FragColor=linearToGamma(gl_FragColor);\n#endif\n}"; // eslint-disable-line
29561
+ exports.BloomDownScaleMode = void 0;
29562
+ (function(BloomDownScaleMode) {
29563
+ BloomDownScaleMode[BloomDownScaleMode[/**
29564
+ * Use this to select half size as the starting resolution.
29565
+ */ "Half"] = 0] = "Half";
29566
+ BloomDownScaleMode[BloomDownScaleMode[/**
29567
+ * Use this to select quarter size as the starting resolution.
29568
+ */ "Quarter"] = 1] = "Quarter";
29569
+ })(exports.BloomDownScaleMode || (exports.BloomDownScaleMode = {}));
29570
+ var BloomEffect = /*#__PURE__*/ function() {
29571
+ function BloomEffect(_uberMaterial) {
29572
+ this._uberMaterial = _uberMaterial;
29573
+ this._highQualityFiltering = false;
29574
+ this._mipDownRT = [];
29575
+ this._mipUpRT = [];
29576
+ this._maxIterations = 6;
29577
+ this._enabled = false;
29578
+ this./**
29579
+ * Controls the starting resolution that this effect begins processing.
29580
+ */ downScale = 0;
29581
+ var engine = _uberMaterial.engine;
29582
+ var material = new Material(engine, Shader.find(BloomEffect.SHADER_NAME));
29583
+ var depthState = material.renderState.depthState;
29584
+ depthState.enabled = false;
29585
+ depthState.writeEnabled = false;
29586
+ var bloomShaderData = material.shaderData;
29587
+ var uberShaderData = _uberMaterial.shaderData;
29588
+ bloomShaderData.setVector4(BloomEffect._bloomParams, new Vector4());
29589
+ bloomShaderData.setVector4(BloomEffect._lowMipTexelSizeProp, new Vector4());
29590
+ uberShaderData.setVector4(BloomEffect._bloomIntensityParams, new Vector4(1, 1, 0, 0));
29591
+ uberShaderData.setVector4(BloomEffect._dirtTilingOffsetProp, new Vector4());
29592
+ uberShaderData.setColor(BloomEffect._tintProp, new Color(1, 1, 1, 1));
29593
+ this._bloomMaterial = material;
29594
+ this.threshold = 0.9;
29595
+ this.scatter = 0.7;
29596
+ this.intensity = 1;
29597
+ this.dirtIntensity = 1;
29598
+ }
29599
+ var _proto = BloomEffect.prototype;
29600
+ _proto.onRender = function onRender(context, srcTexture) {
29601
+ var camera = context.camera;
29602
+ var downRes = this.downScale === 0 ? 1 : 2;
29603
+ var pixelViewport = camera.pixelViewport;
29604
+ var tw = pixelViewport.width >> downRes;
29605
+ var th = pixelViewport.height >> downRes;
29606
+ // Determine the iteration count
29607
+ var mipCount = this._calculateMipCount(tw, th);
29608
+ // Prefilter
29609
+ this._prefilter(camera, srcTexture, tw, th, mipCount);
29610
+ // Down sample - gaussian pyramid
29611
+ this._downsample(mipCount);
29612
+ // Up sample (bilinear by default, HQ filtering does bicubic instead
29613
+ this._upsample(mipCount);
29614
+ // Setup bloom on uber
29615
+ this._setupUber(camera);
29616
+ };
29617
+ _proto._calculateMipCount = function _calculateMipCount(tw, th) {
29618
+ var maxSize = Math.max(tw, th);
29619
+ var iterations = Math.floor(Math.log2(maxSize) - 1);
29620
+ return Math.min(Math.max(iterations, 1), this._maxIterations);
29621
+ };
29622
+ _proto._prefilter = function _prefilter(camera, srcTexture, tw, th, mipCount) {
29623
+ var engine = this._uberMaterial.engine;
29624
+ var internalColorTextureFormat = camera._getInternalColorTextureFormat();
29625
+ var mipWidth = tw, mipHeight = th;
29626
+ for(var i = 0; i < mipCount; i++){
29627
+ this._mipUpRT[i] = PipelineUtils.recreateRenderTargetIfNeeded(engine, this._mipUpRT[i], mipWidth, mipHeight, internalColorTextureFormat, null, false, false, 1, exports.TextureWrapMode.Clamp, exports.TextureFilterMode.Bilinear);
29628
+ this._mipDownRT[i] = PipelineUtils.recreateRenderTargetIfNeeded(engine, this._mipDownRT[i], mipWidth, mipHeight, internalColorTextureFormat, null, false, false, 1, exports.TextureWrapMode.Clamp, exports.TextureFilterMode.Bilinear);
29629
+ mipWidth = Math.max(1, Math.floor(mipWidth / 2));
29630
+ mipHeight = Math.max(1, Math.floor(mipHeight / 2));
29631
+ }
29632
+ PipelineUtils.blitTexture(engine, srcTexture, this._mipDownRT[0], undefined, undefined, this._bloomMaterial, 0);
29633
+ };
29634
+ _proto._downsample = function _downsample(mipCount) {
29635
+ var material = this._bloomMaterial;
29636
+ var engine = material.engine;
29637
+ var lastDown = this._mipDownRT[0];
29638
+ // Down sample - gaussian pyramid
29639
+ for(var i = 1; i < mipCount; i++){
29640
+ // Classic two pass gaussian blur - use mipUp as a temporary target
29641
+ // First pass does 2x downsampling + 9-tap gaussian
29642
+ // Second pass does 9-tap gaussian using a 5-tap filter + bilinear filtering
29643
+ PipelineUtils.blitTexture(engine, lastDown.getColorTexture(0), this._mipUpRT[i], undefined, undefined, material, 1);
29644
+ PipelineUtils.blitTexture(engine, this._mipUpRT[i].getColorTexture(0), this._mipDownRT[i], undefined, undefined, material, 2);
29645
+ lastDown = this._mipDownRT[i];
29646
+ }
29647
+ };
29648
+ _proto._upsample = function _upsample(mipCount) {
29649
+ var material = this._bloomMaterial;
29650
+ var engine = material.engine;
29651
+ var shaderData = material.shaderData;
29652
+ // Up sample (bilinear by default, HQ filtering does bicubic instead
29653
+ for(var i = mipCount - 2; i >= 0; i--){
29654
+ var lowMip = i == mipCount - 2 ? this._mipDownRT[i + 1] : this._mipUpRT[i + 1];
29655
+ var highMip = this._mipDownRT[i];
29656
+ var dst = this._mipUpRT[i];
29657
+ shaderData.setTexture(BloomEffect._lowMipTextureProp, lowMip.getColorTexture(0));
29658
+ if (this.highQualityFiltering) {
29659
+ var texelSizeLow = shaderData.getVector4(BloomEffect._lowMipTexelSizeProp);
29660
+ texelSizeLow.set(1 / lowMip.width, 1 / lowMip.height, lowMip.width, lowMip.height);
29661
+ }
29662
+ PipelineUtils.blitTexture(engine, highMip.getColorTexture(0), dst, undefined, undefined, material, 3);
29663
+ }
29664
+ };
29665
+ _proto._setupUber = function _setupUber(camera) {
29666
+ var shaderData = this._uberMaterial.shaderData;
29667
+ var dirtTexture = this.dirtTexture;
29668
+ if (dirtTexture) {
29669
+ var dirtTilingOffset = shaderData.getVector4(BloomEffect._dirtTilingOffsetProp);
29670
+ var dirtRatio = dirtTexture.width / dirtTexture.height;
29671
+ var screenRatio = camera.aspectRatio;
29672
+ if (dirtRatio > screenRatio) {
29673
+ dirtTilingOffset.set(screenRatio / dirtRatio, 1, (1 - dirtTilingOffset.x) * 0.5, 0);
29674
+ } else if (dirtRatio < screenRatio) {
29675
+ dirtTilingOffset.set(1, dirtRatio / screenRatio, 0, (1 - dirtTilingOffset.y) * 0.5);
29676
+ } else {
29677
+ dirtTilingOffset.set(1, 1, 0, 0);
29678
+ }
29679
+ }
29680
+ shaderData.setTexture(BloomEffect._bloomTextureProp, this._mipUpRT[0].getColorTexture(0));
29681
+ };
29682
+ _proto._releaseRenderTargets = function _releaseRenderTargets() {
29683
+ var length = this._mipDownRT.length;
29684
+ for(var i = 0; i < length; i++){
29685
+ var downRT = this._mipDownRT[i];
29686
+ var upRT = this._mipUpRT[i];
29687
+ if (downRT) {
29688
+ downRT.getColorTexture(0).destroy(true);
29689
+ downRT.destroy(true);
29690
+ }
29691
+ if (upRT) {
29692
+ upRT.getColorTexture(0).destroy(true);
29693
+ upRT.destroy(true);
29694
+ }
29695
+ }
29696
+ this._mipDownRT.length = 0;
29697
+ this._mipUpRT.length = 0;
29698
+ };
29699
+ _create_class$2(BloomEffect, [
29700
+ {
29701
+ key: "enabled",
29702
+ get: /**
29703
+ * Indicates whether the post process effect is enabled.
29704
+ */ function get() {
29705
+ return this._enabled;
29706
+ },
29707
+ set: function set(value) {
29708
+ if (value !== this._enabled) {
29709
+ this._enabled = value;
29710
+ if (value) {
29711
+ this._uberMaterial.shaderData.enableMacro(BloomEffect._enableMacro);
29712
+ } else {
29713
+ this._uberMaterial.shaderData.disableMacro(BloomEffect._enableMacro);
29714
+ this._releaseRenderTargets();
29715
+ }
29716
+ }
29717
+ }
29718
+ },
29719
+ {
29720
+ key: "threshold",
29721
+ get: /**
29722
+ * Set the level of brightness to filter out pixels under this level.
29723
+ * @remarks This value is expressed in gamma-space.
29724
+ */ function get() {
29725
+ return this._threshold;
29726
+ },
29727
+ set: function set(value) {
29728
+ value = Math.max(0, value);
29729
+ if (value !== this._threshold) {
29730
+ this._threshold = value;
29731
+ var threshold = Color.gammaToLinearSpace(value);
29732
+ var thresholdKnee = threshold * 0.5; // Hardcoded soft knee
29733
+ var params = this._bloomMaterial.shaderData.getVector4(BloomEffect._bloomParams);
29734
+ params.x = threshold;
29735
+ params.y = thresholdKnee;
29736
+ }
29737
+ }
29738
+ },
29739
+ {
29740
+ key: "scatter",
29741
+ get: /**
29742
+ * Controls the radius of the bloom effect.
29743
+ */ function get() {
29744
+ return this._scatter;
29745
+ },
29746
+ set: function set(value) {
29747
+ value = Math.min(Math.max(0, value), 1);
29748
+ if (value !== this._scatter) {
29749
+ this._scatter = value;
29750
+ var params = this._bloomMaterial.shaderData.getVector4(BloomEffect._bloomParams);
29751
+ var scatter = MathUtil.lerp(0.05, 0.95, value);
29752
+ params.z = scatter;
29753
+ }
29754
+ }
29755
+ },
29756
+ {
29757
+ key: "intensity",
29758
+ get: /**
29759
+ * Controls the strength of the bloom effect.
29760
+ */ function get() {
29761
+ return this._uberMaterial.shaderData.getVector4(BloomEffect._bloomIntensityParams).x;
29762
+ },
29763
+ set: function set(value) {
29764
+ value = Math.max(0, value);
29765
+ this._uberMaterial.shaderData.getVector4(BloomEffect._bloomIntensityParams).x = value;
29766
+ }
29767
+ },
29768
+ {
29769
+ key: "tint",
29770
+ get: /**
29771
+ * Specifies the tint of the bloom effect.
29772
+ */ function get() {
29773
+ return this._uberMaterial.shaderData.getColor(BloomEffect._tintProp);
29774
+ },
29775
+ set: function set(value) {
29776
+ var tint = this._uberMaterial.shaderData.getColor(BloomEffect._tintProp);
29777
+ if (value !== tint) {
29778
+ tint.copyFrom(value);
29779
+ }
29780
+ }
29781
+ },
29782
+ {
29783
+ key: "highQualityFiltering",
29784
+ get: /**
29785
+ * Controls whether to use bicubic sampling instead of bilinear sampling for the upSampling passes.
29786
+ * @remarks This is slightly more expensive but helps getting smoother visuals.
29787
+ */ function get() {
29788
+ return this._highQualityFiltering;
29789
+ },
29790
+ set: function set(value) {
29791
+ if (value !== this._highQualityFiltering) {
29792
+ this._highQualityFiltering = value;
29793
+ if (value) {
29794
+ this._bloomMaterial.shaderData.enableMacro(BloomEffect._hqMacro);
29795
+ this._uberMaterial.shaderData.enableMacro(BloomEffect._hqMacro);
29796
+ } else {
29797
+ this._bloomMaterial.shaderData.disableMacro(BloomEffect._hqMacro);
29798
+ this._uberMaterial.shaderData.disableMacro(BloomEffect._hqMacro);
29799
+ }
29800
+ }
29801
+ }
29802
+ },
29803
+ {
29804
+ key: "dirtTexture",
29805
+ get: /**
29806
+ * Specifies a Texture to add smudges or dust to the bloom effect.
29807
+ */ function get() {
29808
+ return this._uberMaterial.shaderData.getTexture(BloomEffect._dirtTextureProp);
29809
+ },
29810
+ set: function set(value) {
29811
+ this._uberMaterial.shaderData.setTexture(BloomEffect._dirtTextureProp, value);
29812
+ if (value) {
29813
+ this._uberMaterial.shaderData.enableMacro(BloomEffect._dirtMacro);
29814
+ } else {
29815
+ this._uberMaterial.shaderData.disableMacro(BloomEffect._dirtMacro);
29816
+ }
29817
+ }
29818
+ },
29819
+ {
29820
+ key: "dirtIntensity",
29821
+ get: /**
29822
+ * Controls the strength of the lens dirt.
29823
+ */ function get() {
29824
+ return this._uberMaterial.shaderData.getVector4(BloomEffect._bloomIntensityParams).y;
29825
+ },
29826
+ set: function set(value) {
29827
+ value = Math.max(0, value);
29828
+ this._uberMaterial.shaderData.getVector4(BloomEffect._bloomIntensityParams).y = value;
29829
+ }
29830
+ }
29831
+ ]);
29832
+ return BloomEffect;
29833
+ }();
29834
+ (function() {
29835
+ BloomEffect.SHADER_NAME = "PostProcessEffect Bloom";
29836
+ })();
29837
+ (function() {
29838
+ // Bloom shader properties
29839
+ BloomEffect._hqMacro = ShaderMacro.getByName("BLOOM_HQ");
29840
+ })();
29841
+ (function() {
29842
+ BloomEffect._dirtMacro = ShaderMacro.getByName("BLOOM_DIRT");
29843
+ })();
29844
+ (function() {
29845
+ BloomEffect._bloomParams = ShaderProperty.getByName("material_BloomParams") // x: threshold (linear), y: threshold knee, z: scatter
29846
+ ;
29847
+ })();
29848
+ (function() {
29849
+ BloomEffect._lowMipTextureProp = ShaderProperty.getByName("material_lowMipTexture");
29850
+ })();
29851
+ (function() {
29852
+ BloomEffect._lowMipTexelSizeProp = ShaderProperty.getByName("material_lowMipTexelSize") // x: 1/width, y: 1/height, z: width, w: height
29853
+ ;
29854
+ })();
29855
+ (function() {
29856
+ // Uber shader properties
29857
+ BloomEffect._enableMacro = ShaderMacro.getByName("ENABLE_EFFECT_BLOOM");
29858
+ })();
29859
+ (function() {
29860
+ BloomEffect._bloomTextureProp = ShaderProperty.getByName("material_BloomTexture");
29861
+ })();
29862
+ (function() {
29863
+ BloomEffect._dirtTextureProp = ShaderProperty.getByName("material_BloomDirtTexture");
29864
+ })();
29865
+ (function() {
29866
+ BloomEffect._tintProp = ShaderProperty.getByName("material_BloomTint");
29867
+ })();
29868
+ (function() {
29869
+ BloomEffect._bloomIntensityParams = ShaderProperty.getByName("material_BloomIntensityParams") // x: bloom intensity, y: dirt intensity
29870
+ ;
29871
+ })();
29872
+ (function() {
29873
+ BloomEffect._dirtTilingOffsetProp = ShaderProperty.getByName("material_BloomDirtTilingOffset");
29874
+ })();
29875
+ Shader.create(BloomEffect.SHADER_NAME, [
29876
+ new ShaderPass("Bloom Prefilter", blitVs, fragPrefilter),
29877
+ new ShaderPass("Bloom Blur Horizontal", blitVs, fragBlurH),
29878
+ new ShaderPass("Bloom Blur Vertical", blitVs, fragBlurV),
29879
+ new ShaderPass("Bloom Upsample", blitVs, fragUpsample)
29880
+ ]);
29881
+ exports.TonemappingMode = void 0;
29882
+ (function(TonemappingMode) {
29883
+ TonemappingMode[TonemappingMode[/**
29884
+ * Neutral tonemapper
29885
+ * @remarks Use this option if you only want range-remapping with minimal impact on color hue and saturation.
29886
+ */ "Neutral"] = 0] = "Neutral";
29887
+ TonemappingMode[TonemappingMode[/**
29888
+ * ACES Filmic reference tonemapper (custom approximation)
29889
+ * @remarks
29890
+ * Use this option to apply a close approximation of the reference ACES tonemapper for a more filmic look.
29891
+ * It is more contrasted than Neutral and has an effect on actual color hue and saturation.
29892
+ */ "ACES"] = 1] = "ACES";
29893
+ })(exports.TonemappingMode || (exports.TonemappingMode = {}));
29894
+ var TonemappingEffect = /*#__PURE__*/ function() {
29895
+ var TonemappingEffect = function TonemappingEffect(_uberMaterial) {
29896
+ this._uberMaterial = _uberMaterial;
29897
+ this._enabled = false;
29898
+ this.mode = 0;
29899
+ };
29900
+ _create_class$2(TonemappingEffect, [
29901
+ {
29902
+ key: "enabled",
29903
+ get: /**
29904
+ * Indicates whether the post process effect is enabled.
29905
+ */ function get() {
29906
+ return this._enabled;
29907
+ },
29908
+ set: function set(value) {
29909
+ if (value !== this._enabled) {
29910
+ this._enabled = value;
29911
+ if (value) {
29912
+ this._uberMaterial.shaderData.enableMacro(TonemappingEffect._enableMacro);
29913
+ } else {
29914
+ this._uberMaterial.shaderData.disableMacro(TonemappingEffect._enableMacro);
29915
+ }
29916
+ }
29917
+ }
29918
+ },
29919
+ {
29920
+ key: "mode",
29921
+ get: /**
29922
+ * Use this to select a tonemapping algorithm to use.
29923
+ */ function get() {
29924
+ return this._mode;
29925
+ },
29926
+ set: function set(value) {
29927
+ if (value !== this._mode) {
29928
+ this._mode = value;
29929
+ this._uberMaterial.shaderData.enableMacro("TONEMAPPING_MODE", value.toString());
29930
+ }
29931
+ }
29932
+ }
29933
+ ]);
29934
+ return TonemappingEffect;
29935
+ }();
29936
+ (function() {
29937
+ TonemappingEffect._enableMacro = ShaderMacro.getByName("ENABLE_EFFECT_TONEMAPPING");
29938
+ })();
29939
+ /**
29940
+ * @internal
29941
+ */ var _PostProcessManager = /*#__PURE__*/ function() {
29942
+ function _PostProcessManager(scene) {
29943
+ this.scene = scene;
29944
+ var uberShader = Shader.find(_PostProcessManager.UBER_SHADER_NAME);
29945
+ var uberMaterial = new Material(scene.engine, uberShader);
29946
+ var depthState = uberMaterial.renderState.depthState;
29947
+ depthState.enabled = false;
29948
+ depthState.writeEnabled = false;
29949
+ var bloomEffect = new BloomEffect(uberMaterial);
29950
+ var tonemappingEffect = new TonemappingEffect(uberMaterial);
29951
+ this._uberMaterial = uberMaterial;
29952
+ this._bloomEffect = bloomEffect;
29953
+ this._tonemappingEffect = tonemappingEffect;
29954
+ }
29955
+ var _proto = _PostProcessManager.prototype;
29956
+ /**
29957
+ * @internal
29958
+ */ _proto._render = function _render(context, srcTarget, destTarget) {
29959
+ var camera = context.camera;
29960
+ var engine = camera.engine;
29961
+ // Should blit to resolve the MSAA
29962
+ srcTarget._blitRenderTarget();
29963
+ var srcTexture = srcTarget.getColorTexture();
29964
+ var bloomEffect = this._bloomEffect;
29965
+ if (bloomEffect.enabled) {
29966
+ bloomEffect.onRender(context, srcTexture);
29967
+ }
29968
+ // Done with Uber, blit it
29969
+ PipelineUtils.blitTexture(engine, srcTexture, destTarget, 0, camera.viewport, this._uberMaterial);
29970
+ };
29971
+ _create_class$2(_PostProcessManager, [
29972
+ {
29973
+ key: "hasActiveEffect",
29974
+ get: /**
29975
+ * Whether has active post process effect.
29976
+ */ function get() {
29977
+ return this._bloomEffect.enabled || this._tonemappingEffect.enabled;
29978
+ }
29979
+ }
29980
+ ]);
29981
+ return _PostProcessManager;
29982
+ }();
29983
+ (function() {
29984
+ _PostProcessManager.UBER_SHADER_NAME = "UberPost";
29985
+ })();
29986
+ var Filtering = "#define GLSLIFY 1\n#ifndef FILTERING\n#define FILTERING\nvec2 bSpline3MiddleLeft(vec2 x){return 0.16666667+x*(0.5+x*(0.5-x*0.5));}vec2 bSpline3MiddleRight(vec2 x){return 0.66666667+x*(-1.0+0.5*x)*x;}vec2 bSpline3Rightmost(vec2 x){return 0.16666667+x*(-0.5+x*(0.5-x*0.16666667));}void bicubicFilter(vec2 fracCoord,out vec2 weights[2],out vec2 offsets[2]){vec2 r=bSpline3Rightmost(fracCoord);vec2 mr=bSpline3MiddleRight(fracCoord);vec2 ml=bSpline3MiddleLeft(fracCoord);vec2 l=1.0-mr-ml-r;weights[0]=r+mr;weights[1]=ml+l;offsets[0]=-1.0+mr/weights[0];offsets[1]=1.0+l/weights[1];}vec4 sampleTexture2DBicubic(sampler2D tex,vec2 coord,vec4 texSize){vec2 xy=coord*texSize.zw+0.5;vec2 ic=floor(xy);vec2 fc=fract(xy);vec2 weights[2],offsets[2];bicubicFilter(fc,weights,offsets);return weights[0].y*(weights[0].x*sampleTexture(tex,(ic+vec2(offsets[0].x,offsets[0].y)-0.5)*texSize.xy)+weights[1].x*sampleTexture(tex,(ic+vec2(offsets[1].x,offsets[0].y)-0.5)*texSize.xy))+weights[1].y*(weights[0].x*sampleTexture(tex,(ic+vec2(offsets[0].x,offsets[1].y)-0.5)*texSize.xy)+weights[1].x*sampleTexture(tex,(ic+vec2(offsets[1].x,offsets[1].y)-0.5)*texSize.xy));}\n#endif\n"; // eslint-disable-line
29987
+ var PostCommon = "#define GLSLIFY 1\n#ifndef POST_COMMON\n#define POST_COMMON\n#include <common>\n#define FLT_MIN 1.175494351e-38\n#define HALF_MIN 6.103515625e-5\n#define HALF_MAX 65504.0\nfloat min3(vec3 val){return min(min(val.x,val.y),val.z);}float max3(vec3 val){return max(max(val.x,val.y),val.z);}const float INVERT_LOG10=0.43429448190325176;float log10(float x){return log(x)*INVERT_LOG10;}vec4 sampleTexture(sampler2D tex,vec2 uv){vec4 color=texture2D(tex,uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ncolor=gammaToLinear(color);\n#endif\nreturn color;}\n#endif\n"; // eslint-disable-line
29988
+ var ACESTonemapping = "#define GLSLIFY 1\n#include <ColorTransform>\n#include <RRT>\n#include <ODT>\nvec3 ACESTonemap(vec3 color){vec3 aces=sRGB_2_AP0*color;mediump float saturation=rgb_2_saturation(aces);mediump float ycIn=rgb_2_yc(aces);mediump float s=sigmoid_shaper((saturation-0.4)/0.2);float addedGlow=1.0+glow_fwd(ycIn,RRT_GLOW_GAIN*s,RRT_GLOW_MID);aces*=addedGlow;mediump float hue=rgb_2_hue(vec3(aces));mediump float centeredHue=center_hue(hue,RRT_RED_HUE);float hueWeight=smoothstep(0.0,1.0,1.0-abs(2.0*centeredHue/RRT_RED_WIDTH));hueWeight*=hueWeight;aces.r+=hueWeight*saturation*(RRT_RED_PIVOT-aces.r)*(1.0-RRT_RED_SCALE);vec3 acescg=max(AP0_2_AP1_MAT*aces,0.0);acescg=mix(vec3(dot(acescg,AP1_RGB2Y)),acescg,RRT_SAT_FACTOR);const float a=0.0245786;const float b=0.000090537;const float c=0.983729;const float d=0.4329510;const float e=0.238081;vec3 rcpAcesCG=1.0/(acescg+FLT_MIN);mediump vec3 rgbPost=(acescg+a-b*rcpAcesCG)/(acescg*c+d+e*rcpAcesCG);vec3 linearCV=darkSurround_to_dimSurround(rgbPost);linearCV=mix(vec3(dot(linearCV,AP1_RGB2Y)),linearCV,ODT_SAT_FACTOR);vec3 XYZ=AP1_2_XYZ_MAT*linearCV;XYZ=D60_2_D65_CAT*XYZ;linearCV=XYZ_2_REC709_MAT*XYZ;return linearCV;}"; // eslint-disable-line
29989
+ var ColorTransform = "#define GLSLIFY 1\n#ifndef COLOR_TRANSFORM\n#define COLOR_TRANSFORM\nconst mediump mat3 sRGB_2_AP0=mat3(0.4397010,0.0897923,0.0175440,0.3829780,0.8134230,0.1115440,0.1773350,0.0967616,0.8707040);const mediump mat3 AP1_2_AP0_MAT=mat3(vec3(0.6954522414,0.0447945634,-0.0055258826),vec3(0.1406786965,0.8596711185,0.0040252103),vec3(0.1638690622,0.0955343182,1.0015006723));const mediump mat3 AP0_2_AP1_MAT=mat3(vec3(1.4514393161,-0.0765537734,0.0083161484),vec3(-0.2365107469,1.1762296998,-0.0060324498),vec3(-0.2149285693,-0.0996759264,0.9977163014));const mediump mat3 AP1_2_XYZ_MAT=mat3(vec3(0.6624541811,0.2722287168,-0.0055746495),vec3(0.1340042065,0.6740817658,0.0040607335),vec3(0.1561876870,0.0536895174,1.0103391003));const mediump mat3 XYZ_2_AP1_MAT=mat3(vec3(1.6410233797,-0.6636628587,0.0117218943),vec3(-0.3248032942,1.6153315917,-0.0082844420),vec3(-0.2364246952,0.0167563477,0.9883948585));const mediump mat3 D60_2_D65_CAT=mat3(vec3(0.987224,-0.00759836,0.00307257),vec3(-0.00611327,1.00186,-0.00509595),vec3(0.0159533,0.00533002,1.08168));const mediump mat3 XYZ_2_REC709_MAT=mat3(vec3(3.2409699419,-0.9692436363,0.0556300797),vec3(-1.5373831776,1.8759675015,-0.2039769589),vec3(-0.498610760,0.0415550574,1.0569715142));const mediump vec3 AP1_RGB2Y=vec3(0.2722287168,0.6740817658,0.0536895174);mediump float rgb_2_saturation(mediump vec3 rgb){const mediump float TINY=1e-4;mediump float mi=min3(rgb);mediump float ma=max3(rgb);return(max(ma,TINY)-max(mi,TINY))/max(ma,1e-2);}mediump float rgb_2_yc(mediump vec3 rgb){const mediump float ycRadiusWeight=1.75;mediump float r=rgb.x;mediump float g=rgb.y;mediump float b=rgb.z;mediump float k=b*(b-g)+g*(g-r)+r*(r-b);k=max(k,0.0);float chroma=k==0.0 ? 0.0 : sqrt(k);return(b+g+r+ycRadiusWeight*chroma)/3.0;}mediump float rgb_2_hue(mediump vec3 rgb){mediump float hue;if(rgb.x==rgb.y&&rgb.y==rgb.z){hue=0.0;}else{hue=(180.0/PI)*atan(sqrt(3.0)*(rgb.y-rgb.z),2.0*rgb.x-rgb.y-rgb.z);}if(hue<0.0){hue=hue+360.0;}return hue;}mediump float center_hue(mediump float hue,mediump float centerH){mediump float hueCentered=hue-centerH;if(hueCentered<-180.0){hueCentered=hueCentered+360.0;}else if(hueCentered>180.0){hueCentered=hueCentered-360.0;}return hueCentered;}\n#endif\n"; // eslint-disable-line
29990
+ var ODT = "#define GLSLIFY 1\n#include <Tonescale>\nconst float CINEMA_WHITE=48.0;const float CINEMA_BLACK=0.02;const float ODT_SAT_FACTOR=0.93;mediump vec3 Y_2_linCV(mediump vec3 Y,mediump float Ymax,mediump float Ymin){return(Y-Ymin)/(Ymax-Ymin);}mediump vec3 XYZ_2_xyY(mediump vec3 XYZ){mediump float divisor=max(dot(XYZ,vec3(1.0)),1e-4);return vec3(XYZ.xy/divisor,XYZ.y);}mediump vec3 xyY_2_XYZ(mediump vec3 xyY){mediump float m=xyY.z/max(xyY.y,1e-4);mediump vec3 XYZ=vec3(xyY.xz,(1.0-xyY.x-xyY.y));XYZ.xz*=m;return XYZ;}const mediump float DIM_SURROUND_GAMMA=0.9811;mediump vec3 darkSurround_to_dimSurround(mediump vec3 linearCV){mediump vec3 XYZ=AP1_2_XYZ_MAT*linearCV;mediump vec3 xyY=XYZ_2_xyY(XYZ);xyY.z=clamp(xyY.z,0.0,HALF_MAX);xyY.z=pow(xyY.z,DIM_SURROUND_GAMMA);XYZ=xyY_2_XYZ(xyY);return XYZ_2_AP1_MAT*XYZ;}mediump vec3 ODT_RGBmonitor_100nits_dim(mediump vec3 oces){mediump vec3 rgbPre=AP0_2_AP1_MAT*oces;mediump vec3 rgbPost;rgbPost.r=segmented_spline_c9_fwd(rgbPre.r);rgbPost.g=segmented_spline_c9_fwd(rgbPre.g);rgbPost.b=segmented_spline_c9_fwd(rgbPre.b);mediump vec3 linearCV=Y_2_linCV(rgbPost,CINEMA_WHITE,CINEMA_BLACK);linearCV=darkSurround_to_dimSurround(linearCV);linearCV=mix(vec3(dot(linearCV,AP1_RGB2Y)),linearCV,ODT_SAT_FACTOR);mediump vec3 XYZ=AP1_2_XYZ_MAT*linearCV;XYZ=D60_2_D65_CAT*XYZ;linearCV=XYZ_2_REC709_MAT*XYZ;linearCV=clamp(linearCV,vec3(0),vec3(1));return linearCV;}"; // eslint-disable-line
29991
+ var RRT = "#define GLSLIFY 1\n#include <Tonescale>\nmediump float sigmoid_shaper(mediump float x){mediump float t=max(1.0-abs(x/2.0),0.0);mediump float y=1.0+sign(x)*(1.0-t*t);return y*0.5;}mediump float glow_fwd(mediump float ycIn,mediump float glowGainIn,mediump float glowMid){mediump float glowGainOut;if(ycIn<=2.0/3.0*glowMid){glowGainOut=glowGainIn;}else if(ycIn>=2.0*glowMid){glowGainOut=0.0;}else{glowGainOut=glowGainIn*(glowMid/ycIn-1.0/2.0);}return glowGainOut;}const mediump float RRT_GLOW_GAIN=0.05;const mediump float RRT_GLOW_MID=0.08;const mediump float RRT_RED_SCALE=0.82;const mediump float RRT_RED_PIVOT=0.03;const mediump float RRT_RED_HUE=0.0;const mediump float RRT_RED_WIDTH=135.0;const mediump float RRT_SAT_FACTOR=0.96;mediump vec3 RRT(mediump vec3 aces){mediump float saturation=rgb_2_saturation(aces);mediump float ycIn=rgb_2_yc(aces);mediump float s=sigmoid_shaper((saturation-0.4)/0.2);mediump float addedGlow=1.0+glow_fwd(ycIn,RRT_GLOW_GAIN*s,RRT_GLOW_MID);aces*=addedGlow;mediump float hue=rgb_2_hue(aces);mediump float centeredHue=center_hue(hue,RRT_RED_HUE);mediump float hueWeight=smoothstep(0.0,1.0,1.0-abs(2.0*centeredHue/RRT_RED_WIDTH));hueWeight*=hueWeight;aces.r+=hueWeight*saturation*(RRT_RED_PIVOT-aces.r)*(1.0-RRT_RED_SCALE);aces=clamp(aces,0.0,HALF_MAX);mediump vec3 rgbPre=AP0_2_AP1_MAT*aces;rgbPre=clamp(rgbPre,0.0,HALF_MAX);rgbPre=mix(vec3(dot(rgbPre,AP1_RGB2Y)),rgbPre,RRT_SAT_FACTOR);mediump vec3 rgbPost;rgbPost.x=segmented_spline_c5_fwd(rgbPre.x);rgbPost.y=segmented_spline_c5_fwd(rgbPre.y);rgbPost.z=segmented_spline_c5_fwd(rgbPre.z);mediump vec3 outputVal=AP1_2_AP0_MAT*rgbPost;return outputVal;}"; // eslint-disable-line
29992
+ var Tonescale = "#define GLSLIFY 1\n#ifndef TONE_SCALE\n#define TONE_SCALE\nconst mediump mat3 M=mat3(vec3(0.5,-1.0,0.5),vec3(-1.0,1.0,0.5),vec3(0.5,0.0,0.0));mediump float segmented_spline_c5_fwd(mediump float x){\n#ifdef GRAPHICS_API_WEBGL2\nconst mediump float coefsLow[6]=float[6](-4.0000000000,-4.0000000000,-3.1573765773,-0.4852499958,1.8477324706,1.8477324706);const mediump float coefsHigh[6]=float[6](-0.7185482425,2.0810307172,3.6681241237,4.0000000000,4.0000000000,4.0000000000);\n#else\nconst mediump float coefsLow_0=-4.0000000000;const mediump float coefsLow_1=-4.0000000000;const mediump float coefsLow_2=-3.1573765773;const mediump float coefsLow_3=-0.4852499958;const mediump float coefsLow_4=1.8477324706;const mediump float coefsLow_5=1.8477324706;const mediump float coefsHigh_0=-0.7185482425;const mediump float coefsHigh_1=2.0810307172;const mediump float coefsHigh_2=3.6681241237;const mediump float coefsHigh_3=4.0000000000;const mediump float coefsHigh_4=4.0000000000;const mediump float coefsHigh_5=4.0000000000;\n#endif\nconst mediump vec2 minPoint=vec2(0.0000054931640625,0.0001);const mediump vec2 midPoint=vec2(0.18,0.48);const mediump vec2 maxPoint=vec2(47185.92,10000.0);const mediump float slopeLow=0.0;const mediump float slopeHigh=0.0;const int N_KNOTS_LOW=4;const int N_KNOTS_HIGH=4;mediump float logx=log10(max(x,HALF_MIN));mediump float logy;if(logx<=log10(minPoint.x)){logy=logx*slopeLow+(log10(minPoint.y)-slopeLow*log10(minPoint.x));}else if((logx>log10(minPoint.x))&&(logx<log10(midPoint.x))){mediump float knot_coord=float(N_KNOTS_LOW-1)*(logx-log10(minPoint.x))/(log10(midPoint.x)-log10(minPoint.x));int j=int(knot_coord);mediump float t=knot_coord-float(j);mediump vec3 cf;\n#ifdef GRAPHICS_API_WEBGL2\ncf=vec3(coefsLow[j],coefsLow[j+1],coefsLow[j+2]);\n#else\nif(j<=0){cf=vec3(coefsLow_0,coefsLow_1,coefsLow_2);}else if(j==1){cf=vec3(coefsLow_1,coefsLow_2,coefsLow_3);}else if(j==2){cf=vec3(coefsLow_2,coefsLow_3,coefsLow_4);}else{cf=vec3(coefsLow_3,coefsLow_4,coefsLow_5);}\n#endif\nmediump vec3 monomials=vec3(t*t,t,1.0);logy=dot(monomials,M*cf);}else if((logx>=log10(midPoint.x))&&(logx<log10(maxPoint.x))){mediump float knot_coord=float(N_KNOTS_HIGH-1)*(logx-log10(midPoint.x))/(log10(maxPoint.x)-log10(midPoint.x));int j=int(knot_coord);mediump float t=knot_coord-float(j);mediump vec3 cf;\n#ifdef GRAPHICS_API_WEBGL2\ncf=vec3(coefsHigh[j],coefsHigh[j+1],coefsHigh[j+2]);\n#else\nif(j<=0){cf=vec3(coefsHigh_0,coefsHigh_1,coefsHigh_2);}else if(j==1){cf=vec3(coefsHigh_1,coefsHigh_2,coefsHigh_3);}else if(j==2){cf=vec3(coefsHigh_2,coefsHigh_3,coefsHigh_4);}else{cf=vec3(coefsHigh_3,coefsHigh_4,coefsHigh_5);}\n#endif\nmediump vec3 monomials=vec3(t*t,t,1.0);logy=dot(monomials,M*cf);}else{logy=logx*slopeHigh+(log10(maxPoint.y)-slopeHigh*log10(maxPoint.x));}return pow(10.0,logy);}mediump float segmented_spline_c9_fwd(mediump float x){\n#ifdef GRAPHICS_API_WEBGL2\nconst mediump float coefsLow[10]=float[10](-1.6989700043,-1.6989700043,-1.4779000000,-1.2291000000,-0.8648000000,-0.4480000000,0.0051800000,0.4511080334,0.9113744414,0.9113744414);const mediump float coefsHigh[10]=float[10](0.5154386965,0.8470437783,1.1358000000,1.3802000000,1.5197000000,1.5985000000,1.6467000000,1.6746091357,1.6878733390,1.6878733390);\n#else\nconst mediump float coefsLow_0=-1.6989700043;const mediump float coefsLow_1=-1.6989700043;const mediump float coefsLow_2=-1.4779000000;const mediump float coefsLow_3=-1.2291000000;const mediump float coefsLow_4=-0.8648000000;const mediump float coefsLow_5=-0.4480000000;const mediump float coefsLow_6=0.0051800000;const mediump float coefsLow_7=0.4511080334;const mediump float coefsLow_8=0.9113744414;const mediump float coefsLow_9=0.9113744414;const mediump float coefsHigh_0=0.5154386965;const mediump float coefsHigh_1=0.8470437783;const mediump float coefsHigh_2=1.1358000000;const mediump float coefsHigh_3=1.3802000000;const mediump float coefsHigh_4=1.5197000000;const mediump float coefsHigh_5=1.5985000000;const mediump float coefsHigh_6=1.6467000000;const mediump float coefsHigh_7=1.6746091357;const mediump float coefsHigh_8=1.6878733390;const mediump float coefsHigh_9=1.6878733390;\n#endif\nconst mediump vec2 minPoint=vec2(0.0028799,0.02);const mediump vec2 midPoint=vec2(4.799999,4.8);const mediump vec2 maxPoint=vec2(1005.719,48.0);const mediump float slopeLow=0.0;const mediump float slopeHigh=0.04;const int N_KNOTS_LOW=8;const int N_KNOTS_HIGH=8;mediump float logx=log10(max(x,1e-4));mediump float logy;if(logx<=log10(minPoint.x)){logy=logx*slopeLow+(log10(minPoint.y)-slopeLow*log10(minPoint.x));}else if((logx>log10(minPoint.x))&&(logx<log10(midPoint.x))){mediump float knot_coord=float(N_KNOTS_LOW-1)*(logx-log10(minPoint.x))/(log10(midPoint.x)-log10(minPoint.x));int j=int(knot_coord);mediump float t=knot_coord-float(j);mediump vec3 cf;\n#ifdef GRAPHICS_API_WEBGL2\ncf=vec3(coefsLow[j],coefsLow[j+1],coefsLow[j+2]);\n#else\nif(j<=0){cf=vec3(coefsLow_0,coefsLow_1,coefsLow_2);}else if(j==1){cf=vec3(coefsLow_1,coefsLow_2,coefsLow_3);}else if(j==2){cf=vec3(coefsLow_2,coefsLow_3,coefsLow_4);}else if(j==3){cf=vec3(coefsLow_3,coefsLow_4,coefsLow_5);}else if(j==4){cf=vec3(coefsLow_4,coefsLow_5,coefsLow_6);}else if(j==5){cf=vec3(coefsLow_5,coefsLow_6,coefsLow_7);}else if(j==6){cf=vec3(coefsLow_6,coefsLow_7,coefsLow_8);}else{cf=vec3(coefsLow_7,coefsLow_8,coefsLow_9);}\n#endif\nmediump vec3 monomials=vec3(t*t,t,1.0);logy=dot(monomials,M*cf);}else if((logx>=log10(midPoint.x))&&(logx<log10(maxPoint.x))){mediump float knot_coord=float(N_KNOTS_HIGH-1)*(logx-log10(midPoint.x))/(log10(maxPoint.x)-log10(midPoint.x));int j=int(knot_coord);mediump float t=knot_coord-float(j);mediump vec3 cf;\n#ifdef GRAPHICS_API_WEBGL2\ncf=vec3(coefsHigh[j],coefsHigh[j+1],coefsHigh[j+2]);\n#else\nif(j<=0){cf=vec3(coefsHigh_0,coefsHigh_1,coefsHigh_2);}else if(j==1){cf=vec3(coefsHigh_1,coefsHigh_2,coefsHigh_3);}else if(j==2){cf=vec3(coefsHigh_2,coefsHigh_3,coefsHigh_4);}else if(j==3){cf=vec3(coefsHigh_3,coefsHigh_4,coefsHigh_5);}else if(j==4){cf=vec3(coefsHigh_4,coefsHigh_5,coefsHigh_6);}else if(j==5){cf=vec3(coefsHigh_5,coefsHigh_6,coefsHigh_7);}else if(j==6){cf=vec3(coefsHigh_6,coefsHigh_7,coefsHigh_8);}else{cf=vec3(coefsHigh_7,coefsHigh_8,coefsHigh_9);}\n#endif\nmediump vec3 monomials=vec3(t*t,t,1.0);logy=dot(monomials,M*cf);}else{logy=logx*slopeHigh+(log10(maxPoint.y)-slopeHigh*log10(maxPoint.x));}return pow(10.0,logy);}\n#endif\n"; // eslint-disable-line
29993
+ var NeutralTonemapping = "#define GLSLIFY 1\nvec3 neutralCurve(vec3 x,float a,float b,float c,float d,float e,float f){return vec3(((x*(a*x+c*b)+d*e)/(x*(a*x+b)+d*f))-e/f);}\n#define TONEMAPPING_CLAMP_MAX 435.18712\nvec3 neutralTonemap(vec3 color){const float a=0.2;const float b=0.29;const float c=0.24;const float d=0.272;const float e=0.02;const float f=0.3;\n#ifndef GL_FRAGMENT_PRECISION_HIGH\ncolor=min(color,TONEMAPPING_CLAMP_MAX);\n#endif\nconst float whiteScale=1.31338;color=neutralCurve(color*whiteScale,a,b,c,d,e,f);color*=whiteScale;return color;}"; // eslint-disable-line
29994
+ var UberPost = "#define GLSLIFY 1\n#include <PostCommon>\n#include <Filtering>\n#include <NeutralTonemapping>\n#include <ACESTonemapping>\nvarying vec2 v_uv;uniform sampler2D renderer_BlitTexture;uniform vec4 renderer_texelSize;\n#ifdef ENABLE_EFFECT_BLOOM\nuniform sampler2D material_BloomTexture;uniform sampler2D material_BloomDirtTexture;uniform vec4 material_BloomTint;uniform vec4 material_BloomDirtTilingOffset;uniform vec4 material_BloomIntensityParams;\n#endif\nvoid main(){mediump vec4 color=sampleTexture(renderer_BlitTexture,v_uv);\n#ifdef ENABLE_EFFECT_BLOOM\n#ifdef BLOOM_HQ\nmediump vec4 bloom=sampleTexture2DBicubic(material_BloomTexture,v_uv,renderer_texelSize);\n#else\nmediump vec4 bloom=sampleTexture(material_BloomTexture,v_uv);\n#endif\nbloom*=material_BloomIntensityParams.x;color+=bloom*material_BloomTint;\n#ifdef BLOOM_DIRT\nmediump vec4 dirt=sampleTexture(material_BloomDirtTexture,v_uv*material_BloomDirtTilingOffset.xy+material_BloomDirtTilingOffset.zw);dirt*=material_BloomIntensityParams.y;color+=dirt*bloom;\n#endif\n#endif\n#ifdef ENABLE_EFFECT_TONEMAPPING\n#if TONEMAPPING_MODE == 0\ncolor.rgb=neutralTonemap(color.rgb);\n#elif TONEMAPPING_MODE == 1\ncolor.rgb=ACESTonemap(color.rgb);\n#endif\ncolor.rgb=clamp(color.rgb,vec3(0),vec3(1));\n#endif\ngl_FragColor=color;\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ngl_FragColor=linearToGamma(gl_FragColor);\n#endif\n}"; // eslint-disable-line
29995
+ Object.assign(ShaderLib, {
29996
+ PostCommon: PostCommon,
29997
+ Filtering: Filtering,
29998
+ ODT: ODT,
29999
+ RRT: RRT,
30000
+ Tonescale: Tonescale,
30001
+ ColorTransform: ColorTransform,
30002
+ NeutralTonemapping: NeutralTonemapping,
30003
+ ACESTonemapping: ACESTonemapping
30004
+ });
30005
+ Shader.create(_PostProcessManager.UBER_SHADER_NAME, blitVs, UberPost);
29517
30006
  /**
29518
30007
  * Scene.
29519
30008
  */ var Scene = /*#__PURE__*/ function(EngineObject1) {
@@ -29537,6 +30026,7 @@
29537
30026
  /** @internal */ _this._isActiveInEngine = false;
29538
30027
  /** @internal */ _this._globalShaderMacro = new ShaderMacroCollection();
29539
30028
  /** @internal */ _this._rootEntities = [];
30029
+ /** @internal */ _this._postProcessManager = new _PostProcessManager(_assert_this_initialized(_this));
29540
30030
  _this._background = new Background(_this._engine);
29541
30031
  _this._shaderData = new ShaderData(ShaderDataGroup.Scene);
29542
30032
  _this._shadowCascades = exports.ShadowCascadesMode.NoCascades;
@@ -32424,7 +32914,8 @@
32424
32914
  eventHandler.event = event;
32425
32915
  handlers.length = 0;
32426
32916
  for(var j = scriptCount - 1; j >= 0; j--){
32427
- var handler = scripts[j][funcName];
32917
+ var script = scripts[j];
32918
+ var handler = script[funcName].bind(script);
32428
32919
  handler && handlers.push(handler);
32429
32920
  }
32430
32921
  eventHandlers.push(eventHandler);
@@ -38209,6 +38700,8 @@
38209
38700
  BlendShapeFrame: BlendShapeFrame,
38210
38701
  BlendState: BlendState,
38211
38702
  BlinnPhongMaterial: BlinnPhongMaterial,
38703
+ get BloomDownScaleMode () { return exports.BloomDownScaleMode; },
38704
+ BloomEffect: BloomEffect,
38212
38705
  BoolUpdateFlag: BoolUpdateFlag,
38213
38706
  BoxColliderShape: BoxColliderShape,
38214
38707
  BoxShape: BoxShape,
@@ -38395,6 +38888,8 @@
38395
38888
  get TextureUsage () { return exports.TextureUsage; },
38396
38889
  get TextureWrapMode () { return exports.TextureWrapMode; },
38397
38890
  Time: Time,
38891
+ TonemappingEffect: TonemappingEffect,
38892
+ get TonemappingMode () { return exports.TonemappingMode; },
38398
38893
  TrailMaterial: TrailMaterial,
38399
38894
  TrailRenderer: TrailRenderer,
38400
38895
  Transform: Transform,
@@ -38407,6 +38902,7 @@
38407
38902
  get VertexElementFormat () { return exports.VertexElementFormat; },
38408
38903
  get WrapMode () { return exports.WrapMode; },
38409
38904
  XRManager: XRManager,
38905
+ _PostProcessManager: _PostProcessManager,
38410
38906
  assignmentClone: assignmentClone,
38411
38907
  deepClone: deepClone,
38412
38908
  dependentComponents: dependentComponents,
@@ -39290,6 +39786,13 @@
39290
39786
  dataType: gl.UNSIGNED_BYTE,
39291
39787
  isCompressed: false
39292
39788
  };
39789
+ case exports.TextureFormat.R11G11B10_UFloat:
39790
+ return {
39791
+ internalFormat: isWebGL2 ? gl.R11F_G11F_B10F : gl.NONE,
39792
+ baseFormat: gl.RGB,
39793
+ dataType: gl.FLOAT,
39794
+ isCompressed: false
39795
+ };
39293
39796
  case exports.TextureFormat.R16G16B16A16:
39294
39797
  return {
39295
39798
  internalFormat: isWebGL2 ? gl.RGBA16F : gl.RGBA,
@@ -39552,6 +40055,7 @@
39552
40055
  return false;
39553
40056
  }
39554
40057
  break;
40058
+ case exports.TextureFormat.R11G11B10_UFloat:
39555
40059
  case exports.TextureFormat.R32G32B32A32_UInt:
39556
40060
  case exports.TextureFormat.Depth24:
39557
40061
  case exports.TextureFormat.Depth32:
@@ -39579,6 +40083,11 @@
39579
40083
  }
39580
40084
  }
39581
40085
  break;
40086
+ case exports.TextureFormat.R11G11B10_UFloat:
40087
+ {
40088
+ isSupported = rhi.isWebGL2;
40089
+ }
40090
+ break;
39582
40091
  }
39583
40092
  return isSupported;
39584
40093
  };
@@ -47187,7 +47696,7 @@
47187
47696
  ], KHR_materials_anisotropy);
47188
47697
 
47189
47698
  //@ts-ignore
47190
- var version = "1.3.0-alpha.0";
47699
+ var version = "1.3.0-alpha.1";
47191
47700
  console.log("Galacean engine version: " + version);
47192
47701
  for(var key in CoreObjects){
47193
47702
  Loader.registerClass(key, CoreObjects[key]);
@@ -47213,6 +47722,7 @@
47213
47722
  exports.BlendShapeFrame = BlendShapeFrame;
47214
47723
  exports.BlendState = BlendState;
47215
47724
  exports.BlinnPhongMaterial = BlinnPhongMaterial;
47725
+ exports.BloomEffect = BloomEffect;
47216
47726
  exports.BoolUpdateFlag = BoolUpdateFlag;
47217
47727
  exports.BoundingBox = BoundingBox;
47218
47728
  exports.BoundingFrustum = BoundingFrustum;
@@ -47353,6 +47863,7 @@
47353
47863
  exports.TextureCube = TextureCube;
47354
47864
  exports.TextureSheetAnimationModule = TextureSheetAnimationModule;
47355
47865
  exports.Time = Time;
47866
+ exports.TonemappingEffect = TonemappingEffect;
47356
47867
  exports.TrailMaterial = TrailMaterial;
47357
47868
  exports.TrailRenderer = TrailRenderer;
47358
47869
  exports.Transform = Transform;
@@ -47368,6 +47879,7 @@
47368
47879
  exports.WebGLEngine = WebGLEngine;
47369
47880
  exports.WebGLGraphicDevice = WebGLGraphicDevice;
47370
47881
  exports.XRManager = XRManager;
47882
+ exports._PostProcessManager = _PostProcessManager;
47371
47883
  exports.assignmentClone = assignmentClone;
47372
47884
  exports.decode = decode;
47373
47885
  exports.deepClone = deepClone;