@galacean/engine-core 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.
@@ -7598,9 +7598,9 @@ var noise_simplex_3D_grad = "#define GLSLIFY 1\nfloat simplex(vec3 v,out vec3 gr
7598
7598
 
7599
7599
  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
7600
7600
 
7601
- 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
7601
+ 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
7602
7602
 
7603
- 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
7603
+ 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
7604
7604
 
7605
7605
  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
7606
7606
 
@@ -12900,6 +12900,7 @@ var VertexChangedFlags;
12900
12900
  function MeshRenderer(entity) {
12901
12901
  var _this;
12902
12902
  _this = Renderer.call(this, entity) || this;
12903
+ _this._enableVertexColor = false;
12903
12904
  _this._onMeshChanged = _this._onMeshChanged.bind(_assert_this_initialized(_this));
12904
12905
  return _this;
12905
12906
  }
@@ -12961,7 +12962,7 @@ var VertexChangedFlags;
12961
12962
  shaderData.enableMacro(MeshRenderer._tangentMacro);
12962
12963
  break;
12963
12964
  case "COLOR_0":
12964
- shaderData.enableMacro(MeshRenderer._vertexColorMacro);
12965
+ this.enableVertexColor && shaderData.enableMacro(MeshRenderer._vertexColorMacro);
12965
12966
  break;
12966
12967
  }
12967
12968
  }
@@ -13016,6 +13017,20 @@ var VertexChangedFlags;
13016
13017
  this._setMesh(value);
13017
13018
  }
13018
13019
  }
13020
+ },
13021
+ {
13022
+ key: "enableVertexColor",
13023
+ get: /**
13024
+ * Whether enable vertex color.
13025
+ */ function get() {
13026
+ return this._enableVertexColor;
13027
+ },
13028
+ set: function set(value) {
13029
+ if (value !== this._enableVertexColor) {
13030
+ this._dirtyUpdateFlag |= 0x2;
13031
+ this._enableVertexColor = value;
13032
+ }
13033
+ }
13019
13034
  }
13020
13035
  ]);
13021
13036
  return MeshRenderer;
@@ -13126,6 +13141,7 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13126
13141
  function SkinnedMeshRenderer(entity) {
13127
13142
  var _this;
13128
13143
  _this = MeshRenderer.call(this, entity) || this;
13144
+ _this._supportSkinning = false;
13129
13145
  _this._hasInitSkin = false;
13130
13146
  _this._jointDataCreateCache = new miniprogram.Vector2(-1, -1);
13131
13147
  _this._localBounds = new miniprogram.BoundingBox();
@@ -13135,7 +13151,7 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13135
13151
  // Limit size to 256 to avoid some problem:
13136
13152
  // 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!
13137
13153
  // 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.
13138
- maxVertexUniformVectors = Math.min(maxVertexUniformVectors, 256);
13154
+ maxVertexUniformVectors = Math.min(maxVertexUniformVectors, rhi._options._maxAllowSkinUniformVectorCount);
13139
13155
  _this._maxVertexUniformVectors = maxVertexUniformVectors;
13140
13156
  _this._onLocalBoundsChanged = _this._onLocalBoundsChanged.bind(_assert_this_initialized(_this));
13141
13157
  var localBounds = _this._localBounds;
@@ -13153,9 +13169,8 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13153
13169
  this._initSkin();
13154
13170
  this._hasInitSkin = true;
13155
13171
  }
13156
- var skin = this._skin;
13157
- if (skin) {
13158
- var ibms = skin.inverseBindMatrices;
13172
+ if (this._supportSkinning) {
13173
+ var ibms = this._skin.inverseBindMatrices;
13159
13174
  var worldToLocal = this._rootBone.getInvModelMatrix();
13160
13175
  var _this = this, joints = _this._jointEntities, jointMatrices = _this._jointMatrices;
13161
13176
  for(var i = joints.length - 1; i >= 0; i--){
@@ -13174,8 +13189,6 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13174
13189
  * @override
13175
13190
  */ _proto._updateShaderData = function _updateShaderData(context) {
13176
13191
  var entity = this.entity;
13177
- var worldMatrix = this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
13178
- this._updateTransformShaderData(context, worldMatrix);
13179
13192
  var shaderData = this.shaderData;
13180
13193
  var mesh = this.mesh;
13181
13194
  var blendShapeManager = mesh._blendShapeManager;
@@ -13202,12 +13215,18 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13202
13215
  shaderData.disableMacro("O3_JOINTS_NUM");
13203
13216
  shaderData.enableMacro("O3_USE_JOINT_TEXTURE");
13204
13217
  shaderData.setTexture(SkinnedMeshRenderer._jointSamplerProperty, this._jointTexture);
13218
+ this._supportSkinning = true;
13205
13219
  } else {
13206
- 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);
13220
+ var _this__jointTexture1;
13221
+ this._supportSkinning = false;
13222
+ (_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
13223
+ shaderData.disableMacro("O3_HAS_SKIN");
13224
+ 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);
13207
13225
  }
13208
13226
  } else {
13209
- var _this__jointTexture1;
13210
- (_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
13227
+ var _this__jointTexture2;
13228
+ this._supportSkinning = true;
13229
+ (_this__jointTexture2 = this._jointTexture) == null ? void 0 : _this__jointTexture2.destroy();
13211
13230
  shaderData.disableMacro("O3_USE_JOINT_TEXTURE");
13212
13231
  shaderData.enableMacro("O3_JOINTS_NUM", remainUniformJointCount.toString());
13213
13232
  shaderData.setFloatArray(SkinnedMeshRenderer._jointMatrixProperty, this._jointMatrices);
@@ -13218,6 +13237,8 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13218
13237
  this._jointTexture.setPixelBuffer(this._jointMatrices);
13219
13238
  }
13220
13239
  }
13240
+ var worldMatrix = this._supportSkinning && this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
13241
+ this._updateTransformShaderData(context, worldMatrix);
13221
13242
  var layer = entity.layer;
13222
13243
  this._rendererLayer.set(layer & 65535, layer >>> 16 & 65535, 0, 0);
13223
13244
  };
@@ -13412,6 +13433,9 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
13412
13433
  (function() {
13413
13434
  SkinnedMeshRenderer._jointMatrixProperty = Shader.getPropertyByName("u_jointMatrix");
13414
13435
  })();
13436
+ __decorate([
13437
+ ignoreClone
13438
+ ], SkinnedMeshRenderer.prototype, "_supportSkinning", void 0);
13415
13439
  __decorate([
13416
13440
  ignoreClone
13417
13441
  ], SkinnedMeshRenderer.prototype, "_hasInitSkin", void 0);
@@ -14388,7 +14412,7 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
14388
14412
  // vertices
14389
14413
  this._vertexBuffers[index] = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * 4 * vertexStride, exports.BufferUsage.Dynamic);
14390
14414
  // indices
14391
- this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 3, exports.BufferUsage.Dynamic);
14415
+ this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 2 * 3, exports.BufferUsage.Dynamic);
14392
14416
  mesh.setVertexBufferBinding(this._vertexBuffers[index], vertexStride);
14393
14417
  mesh.setIndexBufferBinding(this._indiceBuffers[index], exports.IndexFormat.UInt16);
14394
14418
  mesh.setVertexElements(vertexElements);
@@ -17105,7 +17129,7 @@ var /**
17105
17129
  // prepare render target
17106
17130
  var renderTarget = this._getAvailableRenderTarget();
17107
17131
  // @todo: shouldn't set viewport and scissor in activeRenderTarget
17108
- rhi.activeRenderTarget(renderTarget, null, 0);
17132
+ rhi.activeRenderTarget(renderTarget, CascadedShadowCasterPass._viewport, 0);
17109
17133
  if (this._supportDepthTexture) {
17110
17134
  rhi.clearRenderTarget(engine, exports.CameraClearFlags.Depth, null);
17111
17135
  } else {
@@ -17309,6 +17333,9 @@ var /**
17309
17333
  (function() {
17310
17334
  CascadedShadowCasterPass._cascadesSplitDistance = new Array(CascadedShadowCasterPass._maxCascades + 1);
17311
17335
  })();
17336
+ (function() {
17337
+ CascadedShadowCasterPass._viewport = new miniprogram.Vector4(0, 0, 1, 1);
17338
+ })();
17312
17339
  (function() {
17313
17340
  CascadedShadowCasterPass._clearColor = new miniprogram.Color(1, 1, 1, 1);
17314
17341
  })();
@@ -18984,6 +19011,7 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
18984
19011
  _this = PBRBaseMaterial.call(this, engine, Shader.find("pbr")) || this;
18985
19012
  _this.shaderData.setFloat(PBRMaterial._metallicProp, 1);
18986
19013
  _this.shaderData.setFloat(PBRMaterial._roughnessProp, 1);
19014
+ _this.shaderData.setFloat(PBRMaterial._iorProp, 1.5);
18987
19015
  return _this;
18988
19016
  }
18989
19017
  var _proto = PBRMaterial.prototype;
@@ -18995,10 +19023,23 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
18995
19023
  return dest;
18996
19024
  };
18997
19025
  _create_class(PBRMaterial, [
19026
+ {
19027
+ key: "ior",
19028
+ get: /**
19029
+ * Index Of Refraction.
19030
+ * @defaultValue `1.5`
19031
+ */ function get() {
19032
+ return this.shaderData.getFloat(PBRMaterial._iorProp);
19033
+ },
19034
+ set: function set(v) {
19035
+ this.shaderData.setFloat(PBRMaterial._iorProp, Math.max(v, 0));
19036
+ }
19037
+ },
18998
19038
  {
18999
19039
  key: "metallic",
19000
19040
  get: /**
19001
- * Metallic, default 1.0.
19041
+ * Metallic.
19042
+ * @defaultValue `1.0`
19002
19043
  */ function get() {
19003
19044
  return this.shaderData.getFloat(PBRMaterial._metallicProp);
19004
19045
  },
@@ -19009,7 +19050,8 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
19009
19050
  {
19010
19051
  key: "roughness",
19011
19052
  get: /**
19012
- * Roughness, default 1.0.
19053
+ * Roughness. default 1.0.
19054
+ * @defaultValue `1.0`
19013
19055
  */ function get() {
19014
19056
  return this.shaderData.getFloat(PBRMaterial._roughnessProp);
19015
19057
  },
@@ -19046,6 +19088,9 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
19046
19088
  (function() {
19047
19089
  PBRMaterial._roughnessMetallicTextureProp = Shader.getPropertyByName("u_roughnessMetallicTexture");
19048
19090
  })();
19091
+ (function() {
19092
+ PBRMaterial._iorProp = Shader.getPropertyByName("material_IOR");
19093
+ })();
19049
19094
 
19050
19095
  /**
19051
19096
  * PBR (Specular-Glossiness Workflow) Material.
@@ -22522,7 +22567,13 @@ exports.AnimatorLayerBlendingMode = void 0;
22522
22567
  var _this__animatorLayersData_i = this._animatorLayersData[i1], srcPlayData = _this__animatorLayersData_i.srcPlayData, destPlayData = _this__animatorLayersData_i.destPlayData;
22523
22568
  this._revertCurveOwners(srcPlayData == null ? void 0 : (_srcPlayData_stateData = srcPlayData.stateData) == null ? void 0 : _srcPlayData_stateData.curveOwners);
22524
22569
  this._revertCurveOwners(destPlayData == null ? void 0 : (_destPlayData_stateData = destPlayData.stateData) == null ? void 0 : _destPlayData_stateData.curveOwners);
22525
- this._updateLayer(i1, i1 === 0, deltaTime / 1000, animationUpdate);
22570
+ }
22571
+ for(var i2 = 0, n2 = animatorController.layers.length; i2 < n2; i2++){
22572
+ var animatorLayerData1 = this._getAnimatorLayerData(i2);
22573
+ if (animatorLayerData1.layerState === LayerState.Standby) {
22574
+ continue;
22575
+ }
22576
+ this._updateLayer(i2, i2 === 0, deltaTime / 1000, animationUpdate);
22526
22577
  }
22527
22578
  };
22528
22579
  /**
@@ -22787,6 +22838,12 @@ exports.AnimatorLayerBlendingMode = void 0;
22787
22838
  }
22788
22839
  var srcClipTime = srcPlayData.clipTime;
22789
22840
  var destClipTime = destPlayData.clipTime;
22841
+ for(var i = crossOwnerCollection.length - 1; i >= 0; i--){
22842
+ var crossOwner = crossOwnerCollection[i];
22843
+ var srcCurveIndex = crossOwner.crossSrcCurveIndices[layerIndex];
22844
+ var destCurveIndex = crossOwner.crossDestCurveIndices[layerIndex];
22845
+ crossOwner.crossFadeAndApplyValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, weight, additive);
22846
+ }
22790
22847
  srcEventHandlers.length && this._fireAnimationEvents(srcPlayData, srcEventHandlers, lastSrcClipTime, srcClipTime);
22791
22848
  destEventHandlers.length && this._fireAnimationEvents(destPlayData, destEventHandlers, lastDestClipTime, destClipTime);
22792
22849
  if (lastSrcPlayState === AnimatorStatePlayState.UnStarted) {
@@ -22805,12 +22862,6 @@ exports.AnimatorLayerBlendingMode = void 0;
22805
22862
  } else {
22806
22863
  this._callAnimatorScriptOnUpdate(destState, layerIndex);
22807
22864
  }
22808
- for(var i = crossOwnerCollection.length - 1; i >= 0; i--){
22809
- var crossOwner = crossOwnerCollection[i];
22810
- var srcCurveIndex = crossOwner.crossSrcCurveIndices[layerIndex];
22811
- var destCurveIndex = crossOwner.crossDestCurveIndices[layerIndex];
22812
- crossOwner.crossFadeAndApplyValue(srcCurveIndex >= 0 ? srcCurves[srcCurveIndex].curve : null, destCurveIndex >= 0 ? destCurves[destCurveIndex].curve : null, srcClipTime, destClipTime, crossWeight, weight, additive);
22813
- }
22814
22865
  };
22815
22866
  _proto._updateCrossFadeFromPose = function _updateCrossFadeFromPose(destPlayData, layerData, layerIndex, layerWeight, delta, additive, aniUpdate) {
22816
22867
  var crossOwnerCollection = layerData.crossOwnerCollection;
@@ -22827,6 +22878,12 @@ exports.AnimatorLayerBlendingMode = void 0;
22827
22878
  return;
22828
22879
  }
22829
22880
  var destClipTime = destPlayData.clipTime;
22881
+ for(var i = crossOwnerCollection.length - 1; i >= 0; i--){
22882
+ var crossOwner = crossOwnerCollection[i];
22883
+ var crossDestCurveIndices = crossOwner.crossDestCurveIndices;
22884
+ var curveIndex = crossDestCurveIndices[layerIndex];
22885
+ crossOwner.crossFadeFromPoseAndApplyValue(curveIndex >= 0 ? curveBindings[curveIndex].curve : null, destClipTime, crossWeight, layerWeight, additive);
22886
+ }
22830
22887
  //TODO: srcState 少了最新一段时间的判断
22831
22888
  eventHandlers.length && this._fireAnimationEvents(destPlayData, eventHandlers, lastDestClipTime, destClipTime);
22832
22889
  if (lastPlayState === AnimatorStatePlayState.UnStarted) {
@@ -22837,12 +22894,6 @@ exports.AnimatorLayerBlendingMode = void 0;
22837
22894
  } else {
22838
22895
  this._callAnimatorScriptOnUpdate(state, layerIndex);
22839
22896
  }
22840
- for(var i = crossOwnerCollection.length - 1; i >= 0; i--){
22841
- var crossOwner = crossOwnerCollection[i];
22842
- var crossDestCurveIndices = crossOwner.crossDestCurveIndices;
22843
- var curveIndex = crossDestCurveIndices[layerIndex];
22844
- crossOwner.crossFadeFromPoseAndApplyValue(curveIndex >= 0 ? curveBindings[curveIndex].curve : null, destClipTime, crossWeight, layerWeight, additive);
22845
- }
22846
22897
  };
22847
22898
  _proto._updateCrossFadeData = function _updateCrossFadeData(layerData, crossWeight, delta, fixed) {
22848
22899
  var destPlayData = layerData.destPlayData;