@galacean/engine 0.0.0-experimental-animator-additive.2 → 0.0.0-experimental-animator-additive.4

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
@@ -12275,8 +12275,8 @@
12275
12275
  var noise_simplex_3D = "#define GLSLIFY 1\nfloat simplex(vec3 v){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);m=m*m;return 42.0*dot(m*m,vec4(dot(p0,x0),dot(p1,x1),dot(p2,x2),dot(p3,x3)));}"; // eslint-disable-line
12276
12276
  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
12277
12277
  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
12278
- var pbr_frag_define = "#define GLSLIFY 1\nuniform float u_alphaCutoff;uniform vec4 u_baseColor;uniform float u_metal;uniform float u_roughness;uniform vec3 u_PBRSpecularColor;uniform float u_glossiness;uniform vec3 u_emissiveColor;\n#ifdef CLEARCOAT\nuniform float u_clearCoat;uniform float u_clearCoatRoughness;\n#endif\nuniform float u_normalIntensity;uniform float u_occlusionIntensity;uniform float u_occlusionTextureCoord;\n#ifdef BASETEXTURE\nuniform sampler2D u_baseTexture;\n#endif\n#ifdef NORMALTEXTURE\nuniform sampler2D u_normalTexture;\n#endif\n#ifdef EMISSIVETEXTURE\nuniform sampler2D u_emissiveTexture;\n#endif\n#ifdef ROUGHNESSMETALLICTEXTURE\nuniform sampler2D u_roughnessMetallicTexture;\n#endif\n#ifdef SPECULARGLOSSINESSTEXTURE\nuniform sampler2D u_specularGlossinessTexture;\n#endif\n#ifdef OCCLUSIONTEXTURE\nuniform sampler2D u_occlusionTexture;\n#endif\n#ifdef HAS_CLEARCOATTEXTURE\nuniform sampler2D u_clearCoatTexture;\n#endif\n#ifdef HAS_CLEARCOATROUGHNESSTEXTURE\nuniform sampler2D u_clearCoatRoughnessTexture;\n#endif\n#ifdef HAS_CLEARCOATNORMALTEXTURE\nuniform sampler2D u_clearCoatNormalTexture;\n#endif\nstruct ReflectedLight{vec3 directDiffuse;vec3 directSpecular;vec3 indirectDiffuse;vec3 indirectSpecular;};struct Geometry{vec3 position;vec3 normal;vec3 viewDir;float dotNV;\n#ifdef CLEARCOAT\nvec3 clearCoatNormal;float clearCoatDotNV;\n#endif\n};struct Material{vec3 diffuseColor;float roughness;vec3 specularColor;float opacity;\n#ifdef CLEARCOAT\nfloat clearCoat;float clearCoatRoughness;\n#endif\n};"; // eslint-disable-line
12279
- 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 0.04+max(max(dxy.x,dxy.y),dxy.z);\n#else\nreturn 0.04;\n#endif\n}void initGeometry(out Geometry geometry){geometry.position=v_pos;geometry.viewDir=normalize(u_cameraPos-v_pos);\n#if defined(NORMALTEXTURE) || defined(HAS_CLEARCOATNORMALTEXTURE)\nmat3 tbn=getTBN();\n#endif\n#ifdef NORMALTEXTURE\ngeometry.normal=getNormalByNormalTexture(tbn,u_normalTexture,u_normalIntensity,v_uv);\n#else\ngeometry.normal=getNormal();\n#endif\ngeometry.dotNV=saturate(dot(geometry.normal,geometry.viewDir));\n#ifdef CLEARCOAT\n#ifdef HAS_CLEARCOATNORMALTEXTURE\ngeometry.clearCoatNormal=getNormalByNormalTexture(tbn,u_clearCoatNormalTexture,u_normalIntensity,v_uv);\n#else\ngeometry.clearCoatNormal=getNormal();\n#endif\ngeometry.clearCoatDotNV=saturate(dot(geometry.clearCoatNormal,geometry.viewDir));\n#endif\n}void initMaterial(out Material material,const in Geometry geometry){vec4 baseColor=u_baseColor;float metal=u_metal;float roughness=u_roughness;vec3 specularColor=u_PBRSpecularColor;float glossiness=u_glossiness;float alphaCutoff=u_alphaCutoff;\n#ifdef BASETEXTURE\nvec4 baseTextureColor=texture2D(u_baseTexture,v_uv);\n#ifndef OASIS_COLORSPACE_GAMMA\nbaseTextureColor=gammaToLinear(baseTextureColor);\n#endif\nbaseColor*=baseTextureColor;\n#endif\n#ifdef O3_HAS_VERTEXCOLOR\nbaseColor*=v_color;\n#endif\n#ifdef ALPHA_CUTOFF\nif(baseColor.a<alphaCutoff){discard;}\n#endif\n#ifdef ROUGHNESSMETALLICTEXTURE\nvec4 metalRoughMapColor=texture2D(u_roughnessMetallicTexture,v_uv);roughness*=metalRoughMapColor.g;metal*=metalRoughMapColor.b;\n#endif\n#ifdef SPECULARGLOSSINESSTEXTURE\nvec4 specularGlossinessColor=texture2D(u_specularGlossinessTexture,v_uv);\n#ifndef OASIS_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(0.04),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 CLEARCOAT\nmaterial.clearCoat=u_clearCoat;material.clearCoatRoughness=u_clearCoatRoughness;\n#ifdef HAS_CLEARCOATTEXTURE\nmaterial.clearCoat*=texture2D(u_clearCoatTexture,v_uv).r;\n#endif\n#ifdef HAS_CLEARCOATROUGHNESSTEXTURE\nmaterial.clearCoatRoughness*=texture2D(u_clearCoatRoughnessTexture,v_uv).g;\n#endif\nmaterial.clearCoat=saturate(material.clearCoat);material.clearCoatRoughness=max(material.clearCoatRoughness,getAARoughnessFactor(geometry.clearCoatNormal));\n#endif\n#ifdef OASIS_TRANSPARENT\nmaterial.opacity=baseColor.a;\n#else\nmaterial.opacity=1.0;\n#endif\n}\n#include <brdf>\n#include <direct_irradiance_frag_define>\n#include <ibl_frag_define>\n"; // eslint-disable-line
12278
+ var pbr_frag_define = "#define GLSLIFY 1\nuniform float u_alphaCutoff;uniform vec4 u_baseColor;uniform float u_metal;uniform float u_roughness;uniform vec3 u_PBRSpecularColor;uniform float u_glossiness;uniform vec3 u_emissiveColor;\n#ifdef CLEARCOAT\nuniform float u_clearCoat;uniform float u_clearCoatRoughness;\n#endif\nuniform float u_normalIntensity;uniform float u_occlusionIntensity;uniform float u_occlusionTextureCoord;\n#ifdef BASETEXTURE\nuniform sampler2D u_baseTexture;\n#endif\n#ifdef NORMALTEXTURE\nuniform sampler2D u_normalTexture;\n#endif\n#ifdef EMISSIVETEXTURE\nuniform sampler2D u_emissiveTexture;\n#endif\n#ifdef ROUGHNESSMETALLICTEXTURE\nuniform sampler2D u_roughnessMetallicTexture;\n#endif\n#ifdef SPECULARGLOSSINESSTEXTURE\nuniform sampler2D u_specularGlossinessTexture;\n#endif\n#ifdef OCCLUSIONTEXTURE\nuniform sampler2D u_occlusionTexture;\n#endif\n#ifdef HAS_CLEARCOATTEXTURE\nuniform sampler2D u_clearCoatTexture;\n#endif\n#ifdef HAS_CLEARCOATROUGHNESSTEXTURE\nuniform sampler2D u_clearCoatRoughnessTexture;\n#endif\n#ifdef HAS_CLEARCOATNORMALTEXTURE\nuniform sampler2D u_clearCoatNormalTexture;\n#endif\nstruct ReflectedLight{vec3 directDiffuse;vec3 directSpecular;vec3 indirectDiffuse;vec3 indirectSpecular;};struct Geometry{vec3 position;vec3 normal;vec3 viewDir;float dotNV;\n#ifdef CLEARCOAT\nvec3 clearCoatNormal;float clearCoatDotNV;\n#endif\n};struct Material{vec3 diffuseColor;float roughness;vec3 specularColor;float opacity;\n#ifdef CLEARCOAT\nfloat clearCoat;float clearCoatRoughness;\n#endif\n};uniform float material_IOR;"; // eslint-disable-line
12279
+ 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 0.04+max(max(dxy.x,dxy.y),dxy.z);\n#else\nreturn 0.04;\n#endif\n}void initGeometry(out Geometry geometry){geometry.position=v_pos;geometry.viewDir=normalize(u_cameraPos-v_pos);\n#if defined(NORMALTEXTURE) || defined(HAS_CLEARCOATNORMALTEXTURE)\nmat3 tbn=getTBN();\n#endif\n#ifdef NORMALTEXTURE\ngeometry.normal=getNormalByNormalTexture(tbn,u_normalTexture,u_normalIntensity,v_uv);\n#else\ngeometry.normal=getNormal();\n#endif\ngeometry.dotNV=saturate(dot(geometry.normal,geometry.viewDir));\n#ifdef CLEARCOAT\n#ifdef HAS_CLEARCOATNORMALTEXTURE\ngeometry.clearCoatNormal=getNormalByNormalTexture(tbn,u_clearCoatNormalTexture,u_normalIntensity,v_uv);\n#else\ngeometry.clearCoatNormal=getNormal();\n#endif\ngeometry.clearCoatDotNV=saturate(dot(geometry.clearCoatNormal,geometry.viewDir));\n#endif\n}void initMaterial(out Material material,const in Geometry geometry){vec4 baseColor=u_baseColor;float metal=u_metal;float roughness=u_roughness;vec3 specularColor=u_PBRSpecularColor;float glossiness=u_glossiness;float alphaCutoff=u_alphaCutoff;float F0=pow2((material_IOR-1.0)/(material_IOR+1.0));\n#ifdef BASETEXTURE\nvec4 baseTextureColor=texture2D(u_baseTexture,v_uv);\n#ifndef OASIS_COLORSPACE_GAMMA\nbaseTextureColor=gammaToLinear(baseTextureColor);\n#endif\nbaseColor*=baseTextureColor;\n#endif\n#ifdef O3_HAS_VERTEXCOLOR\nbaseColor*=v_color;\n#endif\n#ifdef ALPHA_CUTOFF\nif(baseColor.a<alphaCutoff){discard;}\n#endif\n#ifdef ROUGHNESSMETALLICTEXTURE\nvec4 metalRoughMapColor=texture2D(u_roughnessMetallicTexture,v_uv);roughness*=metalRoughMapColor.g;metal*=metalRoughMapColor.b;\n#endif\n#ifdef SPECULARGLOSSINESSTEXTURE\nvec4 specularGlossinessColor=texture2D(u_specularGlossinessTexture,v_uv);\n#ifndef OASIS_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 CLEARCOAT\nmaterial.clearCoat=u_clearCoat;material.clearCoatRoughness=u_clearCoatRoughness;\n#ifdef HAS_CLEARCOATTEXTURE\nmaterial.clearCoat*=texture2D(u_clearCoatTexture,v_uv).r;\n#endif\n#ifdef HAS_CLEARCOATROUGHNESSTEXTURE\nmaterial.clearCoatRoughness*=texture2D(u_clearCoatRoughnessTexture,v_uv).g;\n#endif\nmaterial.clearCoat=saturate(material.clearCoat);material.clearCoatRoughness=max(material.clearCoatRoughness,getAARoughnessFactor(geometry.clearCoatNormal));\n#endif\n#ifdef OASIS_TRANSPARENT\nmaterial.opacity=baseColor.a;\n#else\nmaterial.opacity=1.0;\n#endif\n}\n#include <brdf>\n#include <direct_irradiance_frag_define>\n#include <ibl_frag_define>\n"; // eslint-disable-line
12280
12280
  var brdf = "#define GLSLIFY 1\nfloat F_Schlick(float dotLH){return 0.04+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);}float 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);}vec3 BRDF_Specular_GGX(vec3 incidentDirection,vec3 viewDir,vec3 normal,vec3 specularColor,float roughness){float alpha=pow2(roughness);vec3 halfDir=normalize(incidentDirection+viewDir);float dotNL=saturate(dot(normal,incidentDirection));float dotNV=saturate(dot(normal,viewDir));float dotNH=saturate(dot(normal,halfDir));float dotLH=saturate(dot(incidentDirection,halfDir));vec3 F=F_Schlick(specularColor,dotLH);float G=G_GGX_SmithCorrelated(alpha,dotNL,dotNV);float D=D_GGX(alpha,dotNH);return F*(G*D);}vec3 BRDF_Diffuse_Lambert(vec3 diffuseColor){return RECIPROCAL_PI*diffuseColor;}"; // eslint-disable-line
12281
12281
  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 CLEARCOAT\nfloat clearCoatDotNL=saturate(dot(geometry.clearCoatNormal,incidentDirection));vec3 clearCoatIrradiance=clearCoatDotNL*color;reflectedLight.directSpecular+=material.clearCoat*clearCoatIrradiance*BRDF_Specular_GGX(incidentDirection,geometry.viewDir,geometry.clearCoatNormal,vec3(0.04),material.clearCoatRoughness);attenuation-=material.clearCoat*F_Schlick(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.viewDir,geometry.normal,material.specularColor,material.roughness);reflectedLight.directDiffuse+=attenuation*irradiance*BRDF_Diffuse_Lambert(material.diffuseColor);}\n#ifdef O3_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 O3_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 O3_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 O3_DIRECT_LIGHT_COUNT\nshadowAttenuation=1.0;\n#ifdef OASIS_CALCULATE_SHADOWS\nshadowAttenuation*=sampleShadowMap();int sunIndex=int(u_shadowInfo.z);\n#endif\nDirectLight directionalLight;for(int i=0;i<O3_DIRECT_LIGHT_COUNT;i++){if(isRendererCulledByLight(oasis_RendererLayer.xy,u_directLightCullingMask[i]))continue;directionalLight.color=u_directLightColor[i];\n#ifdef OASIS_CALCULATE_SHADOWS\nif(i==sunIndex){directionalLight.color*=shadowAttenuation;}\n#endif\ndirectionalLight.direction=u_directLightDirection[i];addDirectionalDirectLightRadiance(directionalLight,geometry,material,reflectedLight);}\n#endif\n#ifdef O3_POINT_LIGHT_COUNT\nPointLight pointLight;for(int i=0;i<O3_POINT_LIGHT_COUNT;i++){if(isRendererCulledByLight(oasis_RendererLayer.xy,u_pointLightCullingMask[i]))continue;pointLight.color=u_pointLightColor[i];pointLight.position=u_pointLightPosition[i];pointLight.distance=u_pointLightDistance[i];addPointDirectLightRadiance(pointLight,geometry,material,reflectedLight);}\n#endif\n#ifdef O3_SPOT_LIGHT_COUNT\nSpotLight spotLight;for(int i=0;i<O3_SPOT_LIGHT_COUNT;i++){if(isRendererCulledByLight(oasis_RendererLayer.xy,u_spotLightCullingMask[i]))continue;spotLight.color=u_spotLightColor[i];spotLight.position=u_spotLightPosition[i];spotLight.direction=u_spotLightDirection[i];spotLight.distance=u_spotLightDistance[i];spotLight.angleCos=u_spotLightAngleCos[i];spotLight.penumbraCos=u_spotLightPenumbraCos[i];addSpotDirectLightRadiance(spotLight,geometry,material,reflectedLight);}\n#endif\n}"; // eslint-disable-line
12282
12282
  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 getLightProbeRadiance(vec3 viewDir,vec3 normal,float roughness,int maxMIPLevel,float specularIntensity){\n#ifndef O3_USE_SPECULAR_ENV\nreturn vec3(0);\n#else\nvec3 reflectVec=reflect(-viewDir,normal);reflectVec.x=-reflectVec.x;float specularMIPLevel=getSpecularMIPLevel(roughness,maxMIPLevel);\n#ifdef HAS_TEX_LOD\nvec4 envMapColor=textureCubeLodEXT(u_env_specularSampler,reflectVec,specularMIPLevel);\n#else\nvec4 envMapColor=textureCube(u_env_specularSampler,reflectVec,specularMIPLevel);\n#endif\n#ifdef O3_DECODE_ENV_RGBM\nenvMapColor.rgb=RGBMToLinear(envMapColor,5.0).rgb;\n#ifdef OASIS_COLORSPACE_GAMMA\nenvMapColor=linearToGamma(envMapColor);\n#endif\n#else\n#ifndef OASIS_COLORSPACE_GAMMA\nenvMapColor=gammaToLinear(envMapColor);\n#endif\n#endif\nreturn envMapColor.rgb*specularIntensity;\n#endif\n}"; // eslint-disable-line
@@ -17507,6 +17507,7 @@
17507
17507
  var MeshRenderer = function MeshRenderer(entity) {
17508
17508
  var _this;
17509
17509
  _this = Renderer.call(this, entity) || this;
17510
+ _this._enableVertexColor = false;
17510
17511
  _this._onMeshChanged = _this._onMeshChanged.bind(_assert_this_initialized(_this));
17511
17512
  return _this;
17512
17513
  };
@@ -17569,7 +17570,7 @@
17569
17570
  shaderData.enableMacro(MeshRenderer._tangentMacro);
17570
17571
  break;
17571
17572
  case "COLOR_0":
17572
- shaderData.enableMacro(MeshRenderer._vertexColorMacro);
17573
+ this.enableVertexColor && shaderData.enableMacro(MeshRenderer._vertexColorMacro);
17573
17574
  break;
17574
17575
  }
17575
17576
  }
@@ -17624,6 +17625,20 @@
17624
17625
  this._setMesh(value);
17625
17626
  }
17626
17627
  }
17628
+ },
17629
+ {
17630
+ key: "enableVertexColor",
17631
+ get: /**
17632
+ * Whether enable vertex color.
17633
+ */ function get() {
17634
+ return this._enableVertexColor;
17635
+ },
17636
+ set: function set(value) {
17637
+ if (value !== this._enableVertexColor) {
17638
+ this._dirtyUpdateFlag |= 0x2;
17639
+ this._enableVertexColor = value;
17640
+ }
17641
+ }
17627
17642
  }
17628
17643
  ]);
17629
17644
  return MeshRenderer;
@@ -17730,6 +17745,7 @@
17730
17745
  var SkinnedMeshRenderer = function SkinnedMeshRenderer(entity) {
17731
17746
  var _this;
17732
17747
  _this = MeshRenderer.call(this, entity) || this;
17748
+ _this._supportSkinning = false;
17733
17749
  _this._hasInitSkin = false;
17734
17750
  _this._jointDataCreateCache = new Vector2(-1, -1);
17735
17751
  _this._localBounds = new BoundingBox();
@@ -17739,7 +17755,7 @@
17739
17755
  // Limit size to 256 to avoid some problem:
17740
17756
  // For renderer is "Apple GPU", when uniform is large than 256 the skeleton matrix array access in shader very slow in Safari or WKWebview. This may be a apple bug, Chrome and Firefox is OK!
17741
17757
  // For renderer is "ANGLE (AMD, AMD Radeon(TM) Graphics Direct3011 vs_5_0 ps_5_0, D3011)", compile shader si very slow because of max uniform is 4096.
17742
- maxVertexUniformVectors = Math.min(maxVertexUniformVectors, 256);
17758
+ maxVertexUniformVectors = Math.min(maxVertexUniformVectors, rhi._options._maxAllowSkinUniformVectorCount);
17743
17759
  _this._maxVertexUniformVectors = maxVertexUniformVectors;
17744
17760
  _this._onLocalBoundsChanged = _this._onLocalBoundsChanged.bind(_assert_this_initialized(_this));
17745
17761
  var localBounds = _this._localBounds;
@@ -17758,9 +17774,8 @@
17758
17774
  this._initSkin();
17759
17775
  this._hasInitSkin = true;
17760
17776
  }
17761
- var skin = this._skin;
17762
- if (skin) {
17763
- var ibms = skin.inverseBindMatrices;
17777
+ if (this._supportSkinning) {
17778
+ var ibms = this._skin.inverseBindMatrices;
17764
17779
  var worldToLocal = this._rootBone.getInvModelMatrix();
17765
17780
  var _this = this, joints = _this._jointEntities, jointMatrices = _this._jointMatrices;
17766
17781
  for(var i = joints.length - 1; i >= 0; i--){
@@ -17779,8 +17794,6 @@
17779
17794
  * @override
17780
17795
  */ _proto._updateShaderData = function _updateShaderData(context) {
17781
17796
  var entity = this.entity;
17782
- var worldMatrix = this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
17783
- this._updateTransformShaderData(context, worldMatrix);
17784
17797
  var shaderData = this.shaderData;
17785
17798
  var mesh = this.mesh;
17786
17799
  var blendShapeManager = mesh._blendShapeManager;
@@ -17807,12 +17820,18 @@
17807
17820
  shaderData.disableMacro("O3_JOINTS_NUM");
17808
17821
  shaderData.enableMacro("O3_USE_JOINT_TEXTURE");
17809
17822
  shaderData.setTexture(SkinnedMeshRenderer._jointSamplerProperty, this._jointTexture);
17823
+ this._supportSkinning = true;
17810
17824
  } else {
17811
- Logger.error("component's joints count(" + jointCount + ") greater than device's MAX_VERTEX_UNIFORM_VECTORS number " + this._maxVertexUniformVectors + ", and don't support jointTexture in this device. suggest joint count less than " + remainUniformJointCount + ".", this);
17825
+ var _this__jointTexture1;
17826
+ this._supportSkinning = false;
17827
+ (_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
17828
+ shaderData.disableMacro("O3_HAS_SKIN");
17829
+ Logger.warn("component's joints count(" + jointCount + ") greater than device's MAX_VERTEX_UNIFORM_VECTORS number " + this._maxVertexUniformVectors + ", and don't support jointTexture in this device. suggest joint count less than " + remainUniformJointCount + ".", this);
17812
17830
  }
17813
17831
  } else {
17814
- var _this__jointTexture1;
17815
- (_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
17832
+ var _this__jointTexture2;
17833
+ this._supportSkinning = true;
17834
+ (_this__jointTexture2 = this._jointTexture) == null ? void 0 : _this__jointTexture2.destroy();
17816
17835
  shaderData.disableMacro("O3_USE_JOINT_TEXTURE");
17817
17836
  shaderData.enableMacro("O3_JOINTS_NUM", remainUniformJointCount.toString());
17818
17837
  shaderData.setFloatArray(SkinnedMeshRenderer._jointMatrixProperty, this._jointMatrices);
@@ -17823,6 +17842,8 @@
17823
17842
  this._jointTexture.setPixelBuffer(this._jointMatrices);
17824
17843
  }
17825
17844
  }
17845
+ var worldMatrix = this._supportSkinning && this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
17846
+ this._updateTransformShaderData(context, worldMatrix);
17826
17847
  var layer = entity.layer;
17827
17848
  this._rendererLayer.set(layer & 65535, layer >>> 16 & 65535, 0, 0);
17828
17849
  };
@@ -18017,6 +18038,9 @@
18017
18038
  (function() {
18018
18039
  SkinnedMeshRenderer._jointMatrixProperty = Shader.getPropertyByName("u_jointMatrix");
18019
18040
  })();
18041
+ __decorate$1([
18042
+ ignoreClone
18043
+ ], SkinnedMeshRenderer.prototype, "_supportSkinning", void 0);
18020
18044
  __decorate$1([
18021
18045
  ignoreClone
18022
18046
  ], SkinnedMeshRenderer.prototype, "_hasInitSkin", void 0);
@@ -18983,7 +19007,7 @@
18983
19007
  // vertices
18984
19008
  this._vertexBuffers[index] = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * 4 * vertexStride, exports.BufferUsage.Dynamic);
18985
19009
  // indices
18986
- this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 3, exports.BufferUsage.Dynamic);
19010
+ this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 2 * 3, exports.BufferUsage.Dynamic);
18987
19011
  mesh.setVertexBufferBinding(this._vertexBuffers[index], vertexStride);
18988
19012
  mesh.setIndexBufferBinding(this._indiceBuffers[index], exports.IndexFormat.UInt16);
18989
19013
  mesh.setVertexElements(vertexElements);
@@ -21659,7 +21683,7 @@
21659
21683
  // prepare render target
21660
21684
  var renderTarget = this._getAvailableRenderTarget();
21661
21685
  // @todo: shouldn't set viewport and scissor in activeRenderTarget
21662
- rhi.activeRenderTarget(renderTarget, null, 0);
21686
+ rhi.activeRenderTarget(renderTarget, CascadedShadowCasterPass._viewport, 0);
21663
21687
  if (this._supportDepthTexture) {
21664
21688
  rhi.clearRenderTarget(engine, exports.CameraClearFlags.Depth, null);
21665
21689
  } else {
@@ -21863,6 +21887,9 @@
21863
21887
  (function() {
21864
21888
  CascadedShadowCasterPass._cascadesSplitDistance = new Array(CascadedShadowCasterPass._maxCascades + 1);
21865
21889
  })();
21890
+ (function() {
21891
+ CascadedShadowCasterPass._viewport = new Vector4(0, 0, 1, 1);
21892
+ })();
21866
21893
  (function() {
21867
21894
  CascadedShadowCasterPass._clearColor = new Color$1(1, 1, 1, 1);
21868
21895
  })();
@@ -23524,6 +23551,7 @@
23524
23551
  _this = PBRBaseMaterial.call(this, engine, Shader.find("pbr")) || this;
23525
23552
  _this.shaderData.setFloat(PBRMaterial._metallicProp, 1);
23526
23553
  _this.shaderData.setFloat(PBRMaterial._roughnessProp, 1);
23554
+ _this.shaderData.setFloat(PBRMaterial._iorProp, 1.5);
23527
23555
  return _this;
23528
23556
  }
23529
23557
  var _proto = PBRMaterial.prototype;
@@ -23535,10 +23563,23 @@
23535
23563
  return dest;
23536
23564
  };
23537
23565
  _create_class$3(PBRMaterial, [
23566
+ {
23567
+ key: "ior",
23568
+ get: /**
23569
+ * Index Of Refraction.
23570
+ * @defaultValue `1.5`
23571
+ */ function get() {
23572
+ return this.shaderData.getFloat(PBRMaterial._iorProp);
23573
+ },
23574
+ set: function set(v) {
23575
+ this.shaderData.setFloat(PBRMaterial._iorProp, Math.max(v, 0));
23576
+ }
23577
+ },
23538
23578
  {
23539
23579
  key: "metallic",
23540
23580
  get: /**
23541
- * Metallic, default 1.0.
23581
+ * Metallic.
23582
+ * @defaultValue `1.0`
23542
23583
  */ function get() {
23543
23584
  return this.shaderData.getFloat(PBRMaterial._metallicProp);
23544
23585
  },
@@ -23549,7 +23590,8 @@
23549
23590
  {
23550
23591
  key: "roughness",
23551
23592
  get: /**
23552
- * Roughness, default 1.0.
23593
+ * Roughness. default 1.0.
23594
+ * @defaultValue `1.0`
23553
23595
  */ function get() {
23554
23596
  return this.shaderData.getFloat(PBRMaterial._roughnessProp);
23555
23597
  },
@@ -23586,6 +23628,9 @@
23586
23628
  (function() {
23587
23629
  PBRMaterial._roughnessMetallicTextureProp = Shader.getPropertyByName("u_roughnessMetallicTexture");
23588
23630
  })();
23631
+ (function() {
23632
+ PBRMaterial._iorProp = Shader.getPropertyByName("material_IOR");
23633
+ })();
23589
23634
  /**
23590
23635
  * PBR (Specular-Glossiness Workflow) Material.
23591
23636
  */ var PBRSpecularMaterial = /*#__PURE__*/ function(PBRBaseMaterial) {
@@ -27016,7 +27061,13 @@
27016
27061
  var _this__animatorLayersData_i = this._animatorLayersData[i1], srcPlayData = _this__animatorLayersData_i.srcPlayData, destPlayData = _this__animatorLayersData_i.destPlayData;
27017
27062
  this._revertCurveOwners(srcPlayData == null ? void 0 : (_srcPlayData_stateData = srcPlayData.stateData) == null ? void 0 : _srcPlayData_stateData.curveOwners);
27018
27063
  this._revertCurveOwners(destPlayData == null ? void 0 : (_destPlayData_stateData = destPlayData.stateData) == null ? void 0 : _destPlayData_stateData.curveOwners);
27019
- this._updateLayer(i1, i1 === 0, deltaTime / 1000, animationUpdate);
27064
+ }
27065
+ for(var i2 = 0, n2 = animatorController.layers.length; i2 < n2; i2++){
27066
+ var animatorLayerData1 = this._getAnimatorLayerData(i2);
27067
+ if (animatorLayerData1.layerState === LayerState.Standby) {
27068
+ continue;
27069
+ }
27070
+ this._updateLayer(i2, i2 === 0, deltaTime / 1000, animationUpdate);
27020
27071
  }
27021
27072
  };
27022
27073
  /**
@@ -27281,6 +27332,12 @@
27281
27332
  }
27282
27333
  var srcClipTime = srcPlayData.clipTime;
27283
27334
  var destClipTime = destPlayData.clipTime;
27335
+ for(var i = crossOwnerCollection.length - 1; i >= 0; i--){
27336
+ var crossOwner = crossOwnerCollection[i];
27337
+ var srcCurveIndex = crossOwner.crossSrcCurveIndices[layerIndex];
27338
+ var destCurveIndex = crossOwner.crossDestCurveIndices[layerIndex];
27339
+ crossOwner.crossFadeAndApplyValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, weight, additive);
27340
+ }
27284
27341
  srcEventHandlers.length && this._fireAnimationEvents(srcPlayData, srcEventHandlers, lastSrcClipTime, srcClipTime);
27285
27342
  destEventHandlers.length && this._fireAnimationEvents(destPlayData, destEventHandlers, lastDestClipTime, destClipTime);
27286
27343
  if (lastSrcPlayState === AnimatorStatePlayState.UnStarted) {
@@ -27299,12 +27356,6 @@
27299
27356
  } else {
27300
27357
  this._callAnimatorScriptOnUpdate(destState, layerIndex);
27301
27358
  }
27302
- for(var i = crossOwnerCollection.length - 1; i >= 0; i--){
27303
- var crossOwner = crossOwnerCollection[i];
27304
- var srcCurveIndex = crossOwner.crossSrcCurveIndices[layerIndex];
27305
- var destCurveIndex = crossOwner.crossDestCurveIndices[layerIndex];
27306
- crossOwner.crossFadeAndApplyValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, weight, additive);
27307
- }
27308
27359
  };
27309
27360
  _proto._updateCrossFadeFromPose = function _updateCrossFadeFromPose(destPlayData, layerData, layerIndex, layerWeight, delta, additive, aniUpdate) {
27310
27361
  var crossOwnerCollection = layerData.crossOwnerCollection;
@@ -27321,6 +27372,12 @@
27321
27372
  return;
27322
27373
  }
27323
27374
  var destClipTime = destPlayData.clipTime;
27375
+ for(var i = crossOwnerCollection.length - 1; i >= 0; i--){
27376
+ var crossOwner = crossOwnerCollection[i];
27377
+ var crossDestCurveIndices = crossOwner.crossDestCurveIndices;
27378
+ var curveIndex = crossDestCurveIndices[layerIndex];
27379
+ crossOwner.crossFadeFromPoseAndApplyValue(curveIndex >= 0 ? curveBindings[curveIndex].curve : null, destClipTime, crossWeight, layerWeight, additive);
27380
+ }
27324
27381
  //TODO: srcState 少了最新一段时间的判断
27325
27382
  eventHandlers.length && this._fireAnimationEvents(destPlayData, eventHandlers, lastDestClipTime, destClipTime);
27326
27383
  if (lastPlayState === AnimatorStatePlayState.UnStarted) {
@@ -27331,12 +27388,6 @@
27331
27388
  } else {
27332
27389
  this._callAnimatorScriptOnUpdate(state, layerIndex);
27333
27390
  }
27334
- for(var i = crossOwnerCollection.length - 1; i >= 0; i--){
27335
- var crossOwner = crossOwnerCollection[i];
27336
- var crossDestCurveIndices = crossOwner.crossDestCurveIndices;
27337
- var curveIndex = crossDestCurveIndices[layerIndex];
27338
- crossOwner.crossFadeFromPoseAndApplyValue(curveIndex >= 0 ? curveBindings[curveIndex].curve : null, destClipTime, crossWeight, layerWeight, additive);
27339
- }
27340
27391
  };
27341
27392
  _proto._updateCrossFadeData = function _updateCrossFadeData(layerData, crossWeight, delta, fixed) {
27342
27393
  var destPlayData = layerData.destPlayData;
@@ -31052,7 +31103,8 @@
31052
31103
  webGLMode: 0,
31053
31104
  alpha: false,
31054
31105
  stencil: true,
31055
- _forceFlush: false
31106
+ _forceFlush: false,
31107
+ _maxAllowSkinUniformVectorCount: 256
31056
31108
  }, initializeOptions);
31057
31109
  if (SystemInfo.platform === exports.Platform.IPhone || SystemInfo.platform === exports.Platform.IPad) {
31058
31110
  var version = SystemInfo.operatingSystem.match(/(\d+).?(\d+)?.?(\d+)?/);
@@ -31204,23 +31256,23 @@
31204
31256
  };
31205
31257
  _proto.activeRenderTarget = function activeRenderTarget(renderTarget, viewport, mipLevel) {
31206
31258
  var gl = this._gl;
31259
+ var bufferWidth, bufferHeight;
31207
31260
  if (renderTarget) {
31208
31261
  var /** @ts-ignore */ _renderTarget__platformRenderTarget;
31209
31262
  (_renderTarget__platformRenderTarget = renderTarget._platformRenderTarget) == null ? void 0 : _renderTarget__platformRenderTarget._activeRenderTarget();
31210
- var width = renderTarget.width >> mipLevel;
31211
- var height = renderTarget.height >> mipLevel;
31212
- this.viewport(0, 0, width, height);
31213
- this.scissor(0, 0, width, height);
31263
+ bufferWidth = renderTarget.width >> mipLevel;
31264
+ bufferHeight = renderTarget.height >> mipLevel;
31214
31265
  } else {
31215
31266
  gl.bindFramebuffer(gl.FRAMEBUFFER, null);
31216
- var drawingBufferWidth = gl.drawingBufferWidth, drawingBufferHeight = gl.drawingBufferHeight;
31217
- var width1 = drawingBufferWidth * viewport.z;
31218
- var height1 = drawingBufferHeight * viewport.w;
31219
- var x = viewport.x * drawingBufferWidth;
31220
- var y = drawingBufferHeight - viewport.y * drawingBufferHeight - height1;
31221
- this.viewport(x, y, width1, height1);
31222
- this.scissor(x, y, width1, height1);
31267
+ bufferWidth = gl.drawingBufferWidth;
31268
+ bufferHeight = gl.drawingBufferHeight;
31223
31269
  }
31270
+ var width = bufferWidth * viewport.z;
31271
+ var height = bufferHeight * viewport.w;
31272
+ var x = viewport.x * bufferWidth;
31273
+ var y = bufferHeight - viewport.y * bufferHeight - height;
31274
+ this.viewport(x, y, width, height);
31275
+ this.scissor(x, y, width, height);
31224
31276
  };
31225
31277
  _proto.activeTexture = function activeTexture(textureID) {
31226
31278
  if (this._activeTextureID !== textureID) {
@@ -32491,7 +32543,7 @@
32491
32543
  var materials = [];
32492
32544
  for(var i = 0; i < gltf.materials.length; i++){
32493
32545
  var _gltf_materials_i = gltf.materials[i], _gltf_materials_i_extensions = _gltf_materials_i.extensions, extensions = _gltf_materials_i_extensions === void 0 ? {} : _gltf_materials_i_extensions, pbrMetallicRoughness = _gltf_materials_i.pbrMetallicRoughness, normalTexture = _gltf_materials_i.normalTexture, occlusionTexture = _gltf_materials_i.occlusionTexture, emissiveTexture = _gltf_materials_i.emissiveTexture, emissiveFactor = _gltf_materials_i.emissiveFactor, alphaMode = _gltf_materials_i.alphaMode, alphaCutoff = _gltf_materials_i.alphaCutoff, doubleSided = _gltf_materials_i.doubleSided, _gltf_materials_i_name = _gltf_materials_i.name, name = _gltf_materials_i_name === void 0 ? "" : _gltf_materials_i_name;
32494
- var KHR_materials_unlit = extensions.KHR_materials_unlit, KHR_materials_pbrSpecularGlossiness = extensions.KHR_materials_pbrSpecularGlossiness, KHR_materials_clearcoat = extensions.KHR_materials_clearcoat, OASIS_materials_remap = extensions.OASIS_materials_remap;
32546
+ var KHR_materials_unlit = extensions.KHR_materials_unlit, KHR_materials_pbrSpecularGlossiness = extensions.KHR_materials_pbrSpecularGlossiness, KHR_materials_clearcoat = extensions.KHR_materials_clearcoat, KHR_materials_ior = extensions.KHR_materials_ior, OASIS_materials_remap = extensions.OASIS_materials_remap;
32495
32547
  var material = null;
32496
32548
  if (KHR_materials_unlit) {
32497
32549
  material = Parser.createEngineResource("KHR_materials_unlit", KHR_materials_unlit, context);
@@ -32504,6 +32556,9 @@
32504
32556
  if (KHR_materials_clearcoat) {
32505
32557
  Parser.parseEngineResource("KHR_materials_clearcoat", KHR_materials_clearcoat, material, context);
32506
32558
  }
32559
+ if (KHR_materials_ior) {
32560
+ Parser.parseEngineResource("KHR_materials_ior", KHR_materials_ior, material, context);
32561
+ }
32507
32562
  if (pbrMetallicRoughness) {
32508
32563
  var baseColorFactor = pbrMetallicRoughness.baseColorFactor, baseColorTexture = pbrMetallicRoughness.baseColorTexture, metallicFactor = pbrMetallicRoughness.metallicFactor, roughnessFactor = pbrMetallicRoughness.roughnessFactor, metallicRoughnessTexture = pbrMetallicRoughness.metallicRoughnessTexture;
32509
32564
  if (baseColorFactor) {
@@ -32621,6 +32676,21 @@
32621
32676
  KHR_materials_clearcoat = __decorate([
32622
32677
  registerExtension("KHR_materials_clearcoat")
32623
32678
  ], KHR_materials_clearcoat);
32679
+ var KHR_materials_ior = /*#__PURE__*/ function(ExtensionParser) {
32680
+ var KHR_materials_ior = function KHR_materials_ior() {
32681
+ return ExtensionParser.apply(this, arguments);
32682
+ };
32683
+ _inherits(KHR_materials_ior, ExtensionParser);
32684
+ var _proto = KHR_materials_ior.prototype;
32685
+ _proto.parseEngineResource = function parseEngineResource(schema, material, context) {
32686
+ var _schema_ior = schema.ior, ior = _schema_ior === void 0 ? 1.5 : _schema_ior;
32687
+ material.ior = ior;
32688
+ };
32689
+ return KHR_materials_ior;
32690
+ }(ExtensionParser);
32691
+ KHR_materials_ior = __decorate([
32692
+ registerExtension("KHR_materials_ior")
32693
+ ], KHR_materials_ior);
32624
32694
  var KHR_materials_pbrSpecularGlossiness = /*#__PURE__*/ function(ExtensionParser) {
32625
32695
  var KHR_materials_pbrSpecularGlossiness = function KHR_materials_pbrSpecularGlossiness() {
32626
32696
  return ExtensionParser.apply(this, arguments);
@@ -33486,6 +33556,12 @@
33486
33556
  } else {
33487
33557
  var material = (materials == null ? void 0 : materials[materialIndex]) || SceneParser._getDefaultMaterial(engine);
33488
33558
  renderer.setMaterial(material);
33559
+ // Enable vertex color if mesh has COLOR_0 vertex element
33560
+ mesh.vertexElements.forEach(function(element) {
33561
+ if (element.semantic === "COLOR_0") {
33562
+ renderer.enableVertexColor = true;
33563
+ }
33564
+ });
33489
33565
  }
33490
33566
  var _gltfMeshPrimitives_i = gltfMeshPrimitives[i], _gltfMeshPrimitives_i_extensions = _gltfMeshPrimitives_i.extensions, extensions = _gltfMeshPrimitives_i_extensions === void 0 ? {} : _gltfMeshPrimitives_i_extensions;
33491
33567
  var KHR_materials_variants = extensions.KHR_materials_variants;
@@ -35688,6 +35764,29 @@
35688
35764
  ""
35689
35765
  ])
35690
35766
  ], TextureCubeLoader);
35767
+ var AnimationClipLoader = /*#__PURE__*/ function(Loader) {
35768
+ var AnimationClipLoader = function AnimationClipLoader() {
35769
+ return Loader.apply(this, arguments);
35770
+ };
35771
+ _inherits(AnimationClipLoader, Loader);
35772
+ var _proto = AnimationClipLoader.prototype;
35773
+ _proto.load = function load(item, resourceManager) {
35774
+ var _this = this;
35775
+ return new AssetPromise(function(resolve, reject) {
35776
+ _this.request(item.url, _extends({}, item, {
35777
+ type: "arraybuffer"
35778
+ })).then(function(data) {
35779
+ return decode(data, resourceManager.engine).then(resolve);
35780
+ }).catch(reject);
35781
+ });
35782
+ };
35783
+ return AnimationClipLoader;
35784
+ }(Loader);
35785
+ AnimationClipLoader = __decorate([
35786
+ resourceLoader(exports.AssetType.AnimationClip, [
35787
+ "ani"
35788
+ ])
35789
+ ], AnimationClipLoader);
35691
35790
  var SceneLoader = /*#__PURE__*/ function(Loader) {
35692
35791
  var SceneLoader = function SceneLoader() {
35693
35792
  return Loader.apply(this, arguments);
@@ -35756,6 +35855,14 @@
35756
35855
  if (shadow.shadowDistance != undefined) scene.shadowDistance = shadow.shadowDistance;
35757
35856
  if (shadow.shadowCascades != undefined) scene.shadowCascades = shadow.shadowCascades;
35758
35857
  }
35858
+ var fog = data.scene.fog;
35859
+ if (fog) {
35860
+ if (fog.fogMode != undefined) scene.fogMode = fog.fogMode;
35861
+ if (fog.fogStart != undefined) scene.fogStart = fog.fogStart;
35862
+ if (fog.fogEnd != undefined) scene.fogEnd = fog.fogEnd;
35863
+ if (fog.fogDensity != undefined) scene.fogDensity = fog.fogDensity;
35864
+ if (fog.fogColor != undefined) scene.fogColor.copyFrom(fog.fogColor);
35865
+ }
35759
35866
  return Promise.all([
35760
35867
  ambientLightPromise,
35761
35868
  backgroundPromise
@@ -35789,7 +35896,7 @@
35789
35896
  }));
35790
35897
 
35791
35898
  //@ts-ignore
35792
- var version = "0.0.0-experimental-animator-additive.1";
35899
+ var version = "0.0.0-experimental-animator-additive.4";
35793
35900
  console.log("Galacean engine version: " + version);
35794
35901
  for(var key in CoreObjects){
35795
35902
  Loader.registerClass(key, CoreObjects[key]);