@galacean/engine 1.0.0-beta.3 → 1.0.0-beta.5

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
@@ -5533,7 +5533,9 @@
5533
5533
  */ _proto._addToResourceManager = function _addToResourceManager(path) {
5534
5534
  this._engine.resourceManager._addAsset(path, this);
5535
5535
  };
5536
- _proto._onDestroy = function _onDestroy() {
5536
+ /**
5537
+ * @internal
5538
+ */ _proto._onDestroy = function _onDestroy() {
5537
5539
  EngineObject.prototype._onDestroy.call(this);
5538
5540
  this._engine.resourceManager._deleteReferResource(this);
5539
5541
  var refCount = this._getReferCount();
@@ -5657,7 +5659,9 @@
5657
5659
  };
5658
5660
  _inherits$2(GraphicsResource, ReferResource);
5659
5661
  var _proto = GraphicsResource.prototype;
5660
- _proto._onDestroy = function _onDestroy() {
5662
+ /**
5663
+ * @internal
5664
+ */ _proto._onDestroy = function _onDestroy() {
5661
5665
  ReferResource.prototype._onDestroy.call(this);
5662
5666
  this.engine.resourceManager._deleteGraphicResource(this);
5663
5667
  };
@@ -5734,7 +5738,9 @@
5734
5738
  platformTexture.depthCompareFunction = this._depthCompareFunction;
5735
5739
  platformTexture.setUseDepthCompareMode(this._useDepthCompareMode);
5736
5740
  };
5737
- _proto._onDestroy = function _onDestroy() {
5741
+ /**
5742
+ * @internal
5743
+ */ _proto._onDestroy = function _onDestroy() {
5738
5744
  GraphicsResource.prototype._onDestroy.call(this);
5739
5745
  this._platformTexture.destroy();
5740
5746
  this._platformTexture = null;
@@ -5921,7 +5927,9 @@
5921
5927
  this._depthTexture && this._depthTexture.generateMipmaps();
5922
5928
  }
5923
5929
  };
5924
- _proto._onDestroy = function _onDestroy() {
5930
+ /**
5931
+ * @internal
5932
+ */ _proto._onDestroy = function _onDestroy() {
5925
5933
  GraphicsResource.prototype._onDestroy.call(this);
5926
5934
  this._platformRenderTarget.destroy();
5927
5935
  this._colorTextures.length = 0;
@@ -6295,7 +6303,9 @@
6295
6303
  _proto.getCharInfo = function getCharInfo(char) {
6296
6304
  return this._charInfoMap[char.charCodeAt(0)];
6297
6305
  };
6298
- _proto._onDestroy = function _onDestroy() {
6306
+ /**
6307
+ * @internal
6308
+ */ _proto._onDestroy = function _onDestroy() {
6299
6309
  ReferResource.prototype._onDestroy.call(this);
6300
6310
  this.texture.destroy();
6301
6311
  this.texture = null;
@@ -6853,7 +6863,9 @@
6853
6863
  subFontMap[key] = subFont;
6854
6864
  return subFont;
6855
6865
  };
6856
- _proto._onDestroy = function _onDestroy() {
6866
+ /**
6867
+ * @internal
6868
+ */ _proto._onDestroy = function _onDestroy() {
6857
6869
  ReferResource.prototype._onDestroy.call(this);
6858
6870
  var subFontMap = this._subFontMap;
6859
6871
  for(var k in subFontMap){
@@ -8060,7 +8072,9 @@
8060
8072
  }
8061
8073
  }
8062
8074
  };
8063
- _proto._onDestroy = function _onDestroy() {
8075
+ /**
8076
+ * @internal
8077
+ */ _proto._onDestroy = function _onDestroy() {
8064
8078
  EngineObject.prototype._onDestroy.call(this);
8065
8079
  this._entity._removeComponent(this);
8066
8080
  if (this._entity.isActiveInHierarchy) {
@@ -10809,7 +10823,9 @@
10809
10823
  */ _proto._onDisable = function _onDisable() {
10810
10824
  this.engine.physicsManager._removeCollider(this);
10811
10825
  };
10812
- _proto._onDestroy = function _onDestroy() {
10826
+ /**
10827
+ * @internal
10828
+ */ _proto._onDestroy = function _onDestroy() {
10813
10829
  Component.prototype._onDestroy.call(this);
10814
10830
  this.clearShapes();
10815
10831
  this._nativeCollider.destroy();
@@ -12633,7 +12649,9 @@
12633
12649
  };
12634
12650
  _inherits$2(Light, Component);
12635
12651
  var _proto = Light.prototype;
12636
- _proto._getLightColor = function _getLightColor() {
12652
+ /**
12653
+ * @internal
12654
+ */ _proto._getLightColor = function _getLightColor() {
12637
12655
  this._lightColor.r = this.color.r * this.intensity;
12638
12656
  this._lightColor.g = this.color.g * this.intensity;
12639
12657
  this._lightColor.b = this.color.b * this.intensity;
@@ -14275,8 +14293,8 @@
14275
14293
  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
14276
14294
  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
14277
14295
  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
14278
- var pbr_frag_define = "#define GLSLIFY 1\nuniform float material_AlphaCutoff;uniform vec4 material_BaseColor;uniform float material_Metal;uniform float material_Roughness;uniform vec3 material_PBRSpecularColor;uniform float material_Glossiness;uniform vec3 material_EmissiveColor;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nuniform float material_ClearCoat;uniform float material_ClearCoatRoughness;\n#endif\nuniform float material_NormalIntensity;uniform float material_OcclusionIntensity;uniform float material_OcclusionTextureCoord;\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\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\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};struct Material{vec3 diffuseColor;float roughness;vec3 specularColor;float opacity;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nfloat clearCoat;float clearCoatRoughness;\n#endif\n};"; // eslint-disable-line
14279
- 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(camera_Position-v_pos);\n#if defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE)\nmat3 tbn=getTBN();\n#endif\n#ifdef MATERIAL_HAS_NORMALTEXTURE\ngeometry.normal=getNormalByNormalTexture(tbn,material_NormalTexture,material_NormalIntensity,v_uv);\n#else\ngeometry.normal=getNormal();\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);\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=material_BaseColor;float metal=material_Metal;float roughness=material_Roughness;vec3 specularColor=material_PBRSpecularColor;float glossiness=material_Glossiness;float alphaCutoff=material_AlphaCutoff;\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_HAS_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(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 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}\n#include <brdf>\n#include <direct_irradiance_frag_define>\n#include <ibl_frag_define>\n"; // eslint-disable-line
14296
+ var pbr_frag_define = "#define GLSLIFY 1\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;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nuniform float material_ClearCoat;uniform float material_ClearCoatRoughness;\n#endif\nuniform float material_NormalIntensity;uniform float material_OcclusionIntensity;uniform float material_OcclusionTextureCoord;\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\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\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};struct Material{vec3 diffuseColor;float roughness;vec3 specularColor;float opacity;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nfloat clearCoat;float clearCoatRoughness;\n#endif\n};"; // eslint-disable-line
14297
+ 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(camera_Position-v_pos);\n#if defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE)\nmat3 tbn=getTBN();\n#endif\n#ifdef MATERIAL_HAS_NORMALTEXTURE\ngeometry.normal=getNormalByNormalTexture(tbn,material_NormalTexture,material_NormalIntensity,v_uv);\n#else\ngeometry.normal=getNormal();\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);\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=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));\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_HAS_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}\n#include <brdf>\n#include <direct_irradiance_frag_define>\n#include <ibl_frag_define>\n"; // eslint-disable-line
14280
14298
  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
14281
14299
  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.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 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();int sunIndex=int(scene_ShadowInfo.z);\n#endif\nDirectLight directionalLight;for(int i=0;i<SCENE_DIRECT_LIGHT_COUNT;i++){if(isRendererCulledByLight(renderer_Layer.xy,scene_DirectLightCullingMask[i]))continue;directionalLight.color=scene_DirectLightColor[i];\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nif(i==sunIndex){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]))continue;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]))continue;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
14282
14300
  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 SCENE_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(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
@@ -15448,14 +15466,18 @@
15448
15466
  (_materials_i = materials[i]) == null ? void 0 : _materials_i._addReferCount(-1);
15449
15467
  }
15450
15468
  };
15451
- _proto._updateShaderData = function _updateShaderData(context) {
15469
+ /**
15470
+ * @internal
15471
+ */ _proto._updateShaderData = function _updateShaderData(context) {
15452
15472
  var entity = this.entity;
15453
15473
  var worldMatrix = entity.transform.worldMatrix;
15454
15474
  this._updateTransformShaderData(context, worldMatrix);
15455
15475
  var layer = entity.layer;
15456
15476
  this._rendererLayer.set(layer & 65535, layer >>> 16 & 65535, 0, 0);
15457
15477
  };
15458
- _proto._updateTransformShaderData = function _updateTransformShaderData(context, worldMatrix) {
15478
+ /**
15479
+ * @internal
15480
+ */ _proto._updateTransformShaderData = function _updateTransformShaderData(context, worldMatrix) {
15459
15481
  var shaderData = this.shaderData;
15460
15482
  var virtualCamera = context.virtualCamera;
15461
15483
  var mvMatrix = this._mvMatrix;
@@ -15474,14 +15496,22 @@
15474
15496
  shaderData.setMatrix(exports.Renderer._mvInvMatrixProperty, mvInvMatrix);
15475
15497
  shaderData.setMatrix(exports.Renderer._normalMatrixProperty, normalMatrix);
15476
15498
  };
15477
- _proto._registerEntityTransformListener = function _registerEntityTransformListener() {
15499
+ /**
15500
+ * @internal
15501
+ */ _proto._registerEntityTransformListener = function _registerEntityTransformListener() {
15478
15502
  this.entity.transform._updateFlagManager.addListener(this._onTransformChanged);
15479
15503
  };
15480
- _proto._updateBounds = function _updateBounds(worldBounds) {};
15481
- _proto._render = function _render(context) {
15504
+ /**
15505
+ * @internal
15506
+ */ _proto._updateBounds = function _updateBounds(worldBounds) {};
15507
+ /**
15508
+ * @internal
15509
+ */ _proto._render = function _render(context) {
15482
15510
  throw "not implement";
15483
15511
  };
15484
- _proto._createInstanceMaterial = function _createInstanceMaterial(material, index) {
15512
+ /**
15513
+ * @internal
15514
+ */ _proto._createInstanceMaterial = function _createInstanceMaterial(material, index) {
15485
15515
  var insMaterial = material.clone();
15486
15516
  insMaterial.name = insMaterial.name + "(Instance)";
15487
15517
  material._addReferCount(-1);
@@ -15504,7 +15534,9 @@
15504
15534
  materials[index] = material;
15505
15535
  }
15506
15536
  };
15507
- _proto._onTransformChanged = function _onTransformChanged(type) {
15537
+ /**
15538
+ * @internal
15539
+ */ _proto._onTransformChanged = function _onTransformChanged(type) {
15508
15540
  this._dirtyUpdateFlag |= 0x1;
15509
15541
  };
15510
15542
  _create_class$3(Renderer1, [
@@ -15822,7 +15854,9 @@
15822
15854
  */ _proto._cloneTo = function _cloneTo(target) {
15823
15855
  target.sprite = this._sprite;
15824
15856
  };
15825
- _proto._updateBounds = function _updateBounds(worldBounds) {
15857
+ /**
15858
+ * @internal
15859
+ */ _proto._updateBounds = function _updateBounds(worldBounds) {
15826
15860
  var _this_sprite;
15827
15861
  if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
15828
15862
  worldBounds.min.set(0, 0, 0);
@@ -15832,6 +15866,7 @@
15832
15866
  }
15833
15867
  };
15834
15868
  /**
15869
+ * @internal
15835
15870
  * @inheritdoc
15836
15871
  */ _proto._render = function _render(context) {
15837
15872
  var _this_sprite;
@@ -15857,6 +15892,7 @@
15857
15892
  this._maskElement = renderElement;
15858
15893
  };
15859
15894
  /**
15895
+ * @internal
15860
15896
  * @inheritdoc
15861
15897
  */ _proto._onDestroy = function _onDestroy() {
15862
15898
  var _this__sprite;
@@ -16274,7 +16310,9 @@
16274
16310
  var platformBuffer = this._engine._hardwareRenderer.createPlatformBuffer(this._type, this._byteLength, this._bufferUsage);
16275
16311
  this._platformBuffer = platformBuffer;
16276
16312
  };
16277
- _proto._onDestroy = function _onDestroy() {
16313
+ /**
16314
+ * @internal
16315
+ */ _proto._onDestroy = function _onDestroy() {
16278
16316
  GraphicsResource.prototype._onDestroy.call(this);
16279
16317
  this._platformBuffer.destroy();
16280
16318
  };
@@ -16482,13 +16520,17 @@
16482
16520
  this._vertexElementMap = null;
16483
16521
  this._platformPrimitive.destroy();
16484
16522
  };
16485
- _proto._setVertexElements = function _setVertexElements(elements) {
16523
+ /**
16524
+ * @internal
16525
+ */ _proto._setVertexElements = function _setVertexElements(elements) {
16486
16526
  this._clearVertexElements();
16487
16527
  for(var i = 0, n = elements.length; i < n; i++){
16488
16528
  this._addVertexElement(elements[i]);
16489
16529
  }
16490
16530
  };
16491
- _proto._setIndexBufferBinding = function _setIndexBufferBinding(binding) {
16531
+ /**
16532
+ * @internal
16533
+ */ _proto._setIndexBufferBinding = function _setIndexBufferBinding(binding) {
16492
16534
  var lastBinding = this._indexBufferBinding;
16493
16535
  if (binding) {
16494
16536
  this._indexBufferBinding = binding;
@@ -17622,7 +17664,9 @@
17622
17664
  }
17623
17665
  this.setTangents(tangents);
17624
17666
  };
17625
- _proto._onDestroy = function _onDestroy() {
17667
+ /**
17668
+ * @internal
17669
+ */ _proto._onDestroy = function _onDestroy() {
17626
17670
  Mesh.prototype._onDestroy.call(this);
17627
17671
  this._readable && this._releaseCache();
17628
17672
  };
@@ -18095,7 +18139,9 @@
18095
18139
  };
18096
18140
  _inherits$2(MeshRenderer, Renderer);
18097
18141
  var _proto = MeshRenderer.prototype;
18098
- _proto._onDestroy = function _onDestroy() {
18142
+ /**
18143
+ * @internal
18144
+ */ _proto._onDestroy = function _onDestroy() {
18099
18145
  Renderer.prototype._onDestroy.call(this);
18100
18146
  var mesh = this._mesh;
18101
18147
  if (mesh && !mesh.destroyed) {
@@ -18108,7 +18154,9 @@
18108
18154
  */ _proto._cloneTo = function _cloneTo(target) {
18109
18155
  target.mesh = this._mesh;
18110
18156
  };
18111
- _proto._updateBounds = function _updateBounds(worldBounds) {
18157
+ /**
18158
+ * @internal
18159
+ */ _proto._updateBounds = function _updateBounds(worldBounds) {
18112
18160
  var mesh = this._mesh;
18113
18161
  if (mesh) {
18114
18162
  var localBounds = mesh.bounds;
@@ -18119,7 +18167,9 @@
18119
18167
  worldBounds.max.set(0, 0, 0);
18120
18168
  }
18121
18169
  };
18122
- _proto._render = function _render(context) {
18170
+ /**
18171
+ * @internal
18172
+ */ _proto._render = function _render(context) {
18123
18173
  var mesh = this._mesh;
18124
18174
  if (mesh) {
18125
18175
  if (this._dirtyUpdateFlag & 0x2) {
@@ -18279,7 +18329,9 @@
18279
18329
  }
18280
18330
  }
18281
18331
  };
18282
- _proto._updateShaderData = function _updateShaderData(context) {
18332
+ /**
18333
+ * @internal
18334
+ */ _proto._updateShaderData = function _updateShaderData(context) {
18283
18335
  var entity = this.entity;
18284
18336
  var worldMatrix = this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
18285
18337
  this._updateTransformShaderData(context, worldMatrix);
@@ -18334,10 +18386,14 @@
18334
18386
  MeshRenderer.prototype._cloneTo.call(this, target);
18335
18387
  this._blendShapeWeights && (target._blendShapeWeights = this._blendShapeWeights.slice());
18336
18388
  };
18337
- _proto._registerEntityTransformListener = function _registerEntityTransformListener() {
18389
+ /**
18390
+ * @internal
18391
+ */ _proto._registerEntityTransformListener = function _registerEntityTransformListener() {
18338
18392
  // Cancel register listener to entity transform.
18339
18393
  };
18340
- _proto._updateBounds = function _updateBounds(worldBounds) {
18394
+ /**
18395
+ * @internal
18396
+ */ _proto._updateBounds = function _updateBounds(worldBounds) {
18341
18397
  if (this._rootBone) {
18342
18398
  var localBounds = this._localBounds;
18343
18399
  var worldMatrix = this._rootBone.transform.worldMatrix;
@@ -21383,7 +21439,9 @@
21383
21439
  this._magentaTexture2DArray = magentaTexture2DArray;
21384
21440
  }
21385
21441
  };
21386
- _proto._initialize = function _initialize(configuration) {
21442
+ /**
21443
+ * @internal
21444
+ */ _proto._initialize = function _initialize(configuration) {
21387
21445
  var _this = this;
21388
21446
  var physics = configuration.physics;
21389
21447
  if (physics) {
@@ -21704,7 +21762,9 @@
21704
21762
  this._entity._removeScript(this);
21705
21763
  this._waitHandlingInValid = false;
21706
21764
  };
21707
- _proto._onDestroy = function _onDestroy() {
21765
+ /**
21766
+ * @internal
21767
+ */ _proto._onDestroy = function _onDestroy() {
21708
21768
  Component.prototype._onDestroy.call(this);
21709
21769
  this._engine._componentsManager.addPendingDestroyScript(this);
21710
21770
  };
@@ -23377,6 +23437,7 @@
23377
23437
  this.entity.scene._detachRenderCamera(this);
23378
23438
  };
23379
23439
  /**
23440
+ * @internal
23380
23441
  * @inheritdoc
23381
23442
  */ _proto._onDestroy = function _onDestroy() {
23382
23443
  var _this__renderPipeline;
@@ -24561,6 +24622,7 @@
24561
24622
  _this = PBRBaseMaterial.call(this, engine, Shader.find("pbr")) || this;
24562
24623
  _this.shaderData.setFloat(PBRMaterial._metallicProp, 1);
24563
24624
  _this.shaderData.setFloat(PBRMaterial._roughnessProp, 1);
24625
+ _this.shaderData.setFloat(PBRMaterial._iorProp, 1.5);
24564
24626
  return _this;
24565
24627
  }
24566
24628
  var _proto = PBRMaterial.prototype;
@@ -24572,10 +24634,23 @@
24572
24634
  return dest;
24573
24635
  };
24574
24636
  _create_class$3(PBRMaterial, [
24637
+ {
24638
+ key: "ior",
24639
+ get: /**
24640
+ * Index Of Refraction.
24641
+ * @defaultValue `1.5`
24642
+ */ function get() {
24643
+ return this.shaderData.getFloat(PBRMaterial._iorProp);
24644
+ },
24645
+ set: function set(v) {
24646
+ this.shaderData.setFloat(PBRMaterial._iorProp, Math.max(v, 0));
24647
+ }
24648
+ },
24575
24649
  {
24576
24650
  key: "metallic",
24577
24651
  get: /**
24578
- * Metallic, default 1.0.
24652
+ * Metallic.
24653
+ * @defaultValue `1.0`
24579
24654
  */ function get() {
24580
24655
  return this.shaderData.getFloat(PBRMaterial._metallicProp);
24581
24656
  },
@@ -24586,7 +24661,8 @@
24586
24661
  {
24587
24662
  key: "roughness",
24588
24663
  get: /**
24589
- * Roughness, default 1.0.
24664
+ * Roughness. default 1.0.
24665
+ * @defaultValue `1.0`
24590
24666
  */ function get() {
24591
24667
  return this.shaderData.getFloat(PBRMaterial._roughnessProp);
24592
24668
  },
@@ -24623,6 +24699,9 @@
24623
24699
  (function() {
24624
24700
  PBRMaterial._roughnessMetallicTextureProp = ShaderProperty.getByName("material_RoughnessMetallicTexture");
24625
24701
  })();
24702
+ (function() {
24703
+ PBRMaterial._iorProp = Shader.getPropertyByName("material_IOR");
24704
+ })();
24626
24705
  /**
24627
24706
  * PBR (Specular-Glossiness Workflow) Material.
24628
24707
  */ var PBRSpecularMaterial = /*#__PURE__*/ function(PBRBaseMaterial) {
@@ -24831,7 +24910,9 @@
24831
24910
  */ _proto._addSprite = function _addSprite(sprite) {
24832
24911
  this._spriteNamesToIndex[sprite.name] = this._sprites.push(sprite) - 1;
24833
24912
  };
24834
- _proto._onDestroy = function _onDestroy() {
24913
+ /**
24914
+ * @internal
24915
+ */ _proto._onDestroy = function _onDestroy() {
24835
24916
  ReferResource.prototype._onDestroy.call(this);
24836
24917
  this._sprites = null;
24837
24918
  this._spriteNamesToIndex = null;
@@ -24937,7 +25018,9 @@
24937
25018
  this._dirtyUpdateFlag & 0x1 && this._updatePositions();
24938
25019
  return this._bounds;
24939
25020
  };
24940
- _proto._onDestroy = function _onDestroy() {
25021
+ /**
25022
+ * @internal
25023
+ */ _proto._onDestroy = function _onDestroy() {
24941
25024
  ReferResource.prototype._onDestroy.call(this);
24942
25025
  this._texture = null;
24943
25026
  };
@@ -25672,11 +25755,15 @@
25672
25755
  target._assembler.resetData(target);
25673
25756
  target.sprite = this._sprite;
25674
25757
  };
25675
- _proto._updateShaderData = function _updateShaderData(context) {
25758
+ /**
25759
+ * @internal
25760
+ */ _proto._updateShaderData = function _updateShaderData(context) {
25676
25761
  // @ts-ignore
25677
25762
  this._updateTransformShaderData(context, Matrix._identity);
25678
25763
  };
25679
- _proto._updateBounds = function _updateBounds(worldBounds) {
25764
+ /**
25765
+ * @internal
25766
+ */ _proto._updateBounds = function _updateBounds(worldBounds) {
25680
25767
  var _this_sprite;
25681
25768
  if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
25682
25769
  worldBounds.min.set(0, 0, 0);
@@ -25685,7 +25772,9 @@
25685
25772
  this._assembler.updatePositions(this);
25686
25773
  }
25687
25774
  };
25688
- _proto._render = function _render(context) {
25775
+ /**
25776
+ * @internal
25777
+ */ _proto._render = function _render(context) {
25689
25778
  var _this_sprite;
25690
25779
  if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
25691
25780
  return;
@@ -26093,7 +26182,9 @@
26093
26182
  this._font._addReferCount(1);
26094
26183
  this.setMaterial(engine._spriteDefaultMaterial);
26095
26184
  };
26096
- _proto._onDestroy = function _onDestroy() {
26185
+ /**
26186
+ * @internal
26187
+ */ _proto._onDestroy = function _onDestroy() {
26097
26188
  Renderer.prototype._onDestroy.call(this);
26098
26189
  // Clear render data.
26099
26190
  var charRenderDatas = this._charRenderDatas;
@@ -26128,14 +26219,20 @@
26128
26219
  */ _proto._setDirtyFlagFalse = function _setDirtyFlagFalse(type) {
26129
26220
  this._dirtyFlag &= ~type;
26130
26221
  };
26131
- _proto._updateShaderData = function _updateShaderData(context) {
26222
+ /**
26223
+ * @internal
26224
+ */ _proto._updateShaderData = function _updateShaderData(context) {
26132
26225
  // @ts-ignore
26133
26226
  this._updateTransformShaderData(context, Matrix._identity);
26134
26227
  };
26135
- _proto._updateBounds = function _updateBounds(worldBounds) {
26228
+ /**
26229
+ * @internal
26230
+ */ _proto._updateBounds = function _updateBounds(worldBounds) {
26136
26231
  BoundingBox.transform(this._localBounds, this._entity.transform.worldMatrix, worldBounds);
26137
26232
  };
26138
- _proto._render = function _render(context) {
26233
+ /**
26234
+ * @internal
26235
+ */ _proto._render = function _render(context) {
26139
26236
  if (this._text === "" || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0) {
26140
26237
  return;
26141
26238
  }
@@ -26318,7 +26415,9 @@
26318
26415
  return a.texture.instanceId - b.texture.instanceId;
26319
26416
  });
26320
26417
  };
26321
- _proto._onTransformChanged = function _onTransformChanged(bit) {
26418
+ /**
26419
+ * @internal
26420
+ */ _proto._onTransformChanged = function _onTransformChanged(bit) {
26322
26421
  Renderer.prototype._onTransformChanged.call(this, bit);
26323
26422
  this._setDirtyFlagTrue(0x4 | 0x8);
26324
26423
  };
@@ -30041,7 +30140,9 @@
30041
30140
  this.getMaterial().shaderData.setTexture("u_texture", texture);
30042
30141
  }
30043
30142
  };
30044
- _proto._render = function _render(context) {
30143
+ /**
30144
+ * @internal
30145
+ */ _proto._render = function _render(context) {
30045
30146
  this._updateStrapVertices(context.camera, this._points);
30046
30147
  this._updateStrapCoords();
30047
30148
  this._vertexBuffer.setData(this._vertices);
@@ -30232,7 +30333,7 @@
30232
30333
  /**
30233
30334
  * The position of the probe can be set, the default is the origin [0,0,0].
30234
30335
  */ _this.position = new Vector3(0, 0, 0);
30235
- _this._isCube = true;
30336
+ /** @internal */ _this._isCube = true;
30236
30337
  _this.oriViewMatrix = new Matrix();
30237
30338
  return _this;
30238
30339
  };
@@ -30693,6 +30794,7 @@
30693
30794
  var webCanvas = new WebCanvas(typeof canvas === "string" ? document.getElementById(canvas) : canvas);
30694
30795
  var webGLGraphicDevice = new WebGLGraphicDevice(configuration.graphicDeviceOptions);
30695
30796
  var engine = new WebGLEngine(webCanvas, webGLGraphicDevice, configuration);
30797
+ // @ts-ignore
30696
30798
  return engine._initialize(configuration);
30697
30799
  };
30698
30800
  _create_class$2(WebGLEngine, [
@@ -30701,6 +30803,7 @@
30701
30803
  get: /**
30702
30804
  * Web canvas.
30703
30805
  */ function get() {
30806
+ // @ts-ignore
30704
30807
  return this._canvas;
30705
30808
  }
30706
30809
  }
@@ -32369,23 +32472,23 @@
32369
32472
  };
32370
32473
  _proto.activeRenderTarget = function activeRenderTarget(renderTarget, viewport, mipLevel) {
32371
32474
  var gl = this._gl;
32475
+ var bufferWidth, bufferHeight;
32372
32476
  if (renderTarget) {
32373
32477
  var /** @ts-ignore */ _renderTarget__platformRenderTarget;
32374
32478
  (_renderTarget__platformRenderTarget = renderTarget._platformRenderTarget) == null ? void 0 : _renderTarget__platformRenderTarget._activeRenderTarget();
32375
- var width = renderTarget.width >> mipLevel;
32376
- var height = renderTarget.height >> mipLevel;
32377
- this.viewport(0, 0, width, height);
32378
- this.scissor(0, 0, width, height);
32479
+ bufferWidth = renderTarget.width >> mipLevel;
32480
+ bufferHeight = renderTarget.height >> mipLevel;
32379
32481
  } else {
32380
32482
  gl.bindFramebuffer(gl.FRAMEBUFFER, null);
32381
- var drawingBufferWidth = gl.drawingBufferWidth, drawingBufferHeight = gl.drawingBufferHeight;
32382
- var width1 = drawingBufferWidth * viewport.z;
32383
- var height1 = drawingBufferHeight * viewport.w;
32384
- var x = viewport.x * drawingBufferWidth;
32385
- var y = drawingBufferHeight - viewport.y * drawingBufferHeight - height1;
32386
- this.viewport(x, y, width1, height1);
32387
- this.scissor(x, y, width1, height1);
32483
+ bufferWidth = gl.drawingBufferWidth;
32484
+ bufferHeight = gl.drawingBufferHeight;
32388
32485
  }
32486
+ var width = bufferWidth * viewport.z;
32487
+ var height = bufferHeight * viewport.w;
32488
+ var x = viewport.x * bufferWidth;
32489
+ var y = bufferHeight - viewport.y * bufferHeight - height;
32490
+ this.viewport(x, y, width, height);
32491
+ this.scissor(x, y, width, height);
32389
32492
  };
32390
32493
  _proto.activeTexture = function activeTexture(textureID) {
32391
32494
  if (this._activeTextureID !== textureID) {
@@ -35080,7 +35183,9 @@
35080
35183
  };
35081
35184
  _inherits(GLTFResource, EngineObject);
35082
35185
  var _proto = GLTFResource.prototype;
35083
- _proto._onDestroy = function _onDestroy() {
35186
+ /**
35187
+ * @internal
35188
+ */ _proto._onDestroy = function _onDestroy() {
35084
35189
  EngineObject.prototype._onDestroy.call(this);
35085
35190
  this.defaultSceneRoot.destroy();
35086
35191
  this.textures = null;
@@ -37384,6 +37489,21 @@
37384
37489
  KHR_materials_clearcoat = __decorate([
37385
37490
  registerGLTFExtension("KHR_materials_clearcoat", exports.GLTFExtensionMode.AdditiveParse)
37386
37491
  ], KHR_materials_clearcoat);
37492
+ var KHR_materials_ior = /*#__PURE__*/ function(GLTFExtensionParser) {
37493
+ var KHR_materials_ior = function KHR_materials_ior() {
37494
+ return GLTFExtensionParser.apply(this, arguments);
37495
+ };
37496
+ _inherits(KHR_materials_ior, GLTFExtensionParser);
37497
+ var _proto = KHR_materials_ior.prototype;
37498
+ _proto.additiveParse = function additiveParse(context, material, schema) {
37499
+ var _schema_ior = schema.ior, ior = _schema_ior === void 0 ? 1.5 : _schema_ior;
37500
+ material.ior = ior;
37501
+ };
37502
+ return KHR_materials_ior;
37503
+ }(GLTFExtensionParser);
37504
+ KHR_materials_ior = __decorate([
37505
+ registerGLTFExtension("KHR_materials_ior", exports.GLTFExtensionMode.AdditiveParse)
37506
+ ], KHR_materials_ior);
37387
37507
  var KHR_materials_pbrSpecularGlossiness = /*#__PURE__*/ function(GLTFExtensionParser) {
37388
37508
  var KHR_materials_pbrSpecularGlossiness = function KHR_materials_pbrSpecularGlossiness() {
37389
37509
  return GLTFExtensionParser.apply(this, arguments);
@@ -37516,7 +37636,7 @@
37516
37636
  ], GALACEAN_animation_event);
37517
37637
 
37518
37638
  //@ts-ignore
37519
- var version = "1.0.0-beta.3";
37639
+ var version = "1.0.0-beta.5";
37520
37640
  console.log("Galacean engine version: " + version);
37521
37641
  for(var key in CoreObjects){
37522
37642
  Loader.registerClass(key, CoreObjects[key]);