@galacean/engine-core 1.0.0-beta.3 → 1.0.0-beta.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/main.js +146 -45
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +146 -45
- package/dist/module.js +146 -45
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/2d/atlas/SpriteAtlas.d.ts +0 -1
- package/types/2d/sprite/Sprite.d.ts +0 -1
- package/types/2d/sprite/SpriteMask.d.ts +0 -11
- package/types/2d/sprite/SpriteRenderer.d.ts +1 -5
- package/types/2d/text/Font.d.ts +0 -1
- package/types/2d/text/TextRenderer.d.ts +0 -7
- package/types/Camera.d.ts +0 -4
- package/types/Component.d.ts +0 -1
- package/types/Engine.d.ts +0 -2
- package/types/Renderer.d.ts +1 -10
- package/types/Script.d.ts +0 -1
- package/types/asset/GraphicsResource.d.ts +0 -1
- package/types/asset/ReferResource.d.ts +0 -1
- package/types/env-probe/CubeProbe.d.ts +0 -1
- package/types/graphic/Buffer.d.ts +0 -1
- package/types/graphic/Mesh.d.ts +2 -6
- package/types/lighting/Light.d.ts +0 -1
- package/types/material/PBRMaterial.d.ts +11 -2
- package/types/mesh/MeshRenderer.d.ts +0 -5
- package/types/mesh/ModelMesh.d.ts +0 -1
- package/types/mesh/SkinnedMeshRenderer.d.ts +0 -4
- package/types/physics/Collider.d.ts +0 -1
- package/types/texture/RenderTarget.d.ts +0 -1
- package/types/texture/Texture.d.ts +0 -1
- package/types/trail/TrailRenderer.d.ts +0 -2
package/dist/module.js
CHANGED
|
@@ -678,7 +678,9 @@ __decorate([
|
|
|
678
678
|
*/ _proto._addToResourceManager = function _addToResourceManager(path) {
|
|
679
679
|
this._engine.resourceManager._addAsset(path, this);
|
|
680
680
|
};
|
|
681
|
-
|
|
681
|
+
/**
|
|
682
|
+
* @internal
|
|
683
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
682
684
|
EngineObject.prototype._onDestroy.call(this);
|
|
683
685
|
this._engine.resourceManager._deleteReferResource(this);
|
|
684
686
|
var refCount = this._getReferCount();
|
|
@@ -810,7 +812,9 @@ var GraphicsResource = /*#__PURE__*/ function(ReferResource) {
|
|
|
810
812
|
return _this;
|
|
811
813
|
}
|
|
812
814
|
var _proto = GraphicsResource.prototype;
|
|
813
|
-
|
|
815
|
+
/**
|
|
816
|
+
* @internal
|
|
817
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
814
818
|
ReferResource.prototype._onDestroy.call(this);
|
|
815
819
|
this.engine.resourceManager._deleteGraphicResource(this);
|
|
816
820
|
};
|
|
@@ -889,7 +893,9 @@ var Logger = {
|
|
|
889
893
|
platformTexture.depthCompareFunction = this._depthCompareFunction;
|
|
890
894
|
platformTexture.setUseDepthCompareMode(this._useDepthCompareMode);
|
|
891
895
|
};
|
|
892
|
-
|
|
896
|
+
/**
|
|
897
|
+
* @internal
|
|
898
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
893
899
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
894
900
|
this._platformTexture.destroy();
|
|
895
901
|
this._platformTexture = null;
|
|
@@ -1077,7 +1083,9 @@ var Logger = {
|
|
|
1077
1083
|
this._depthTexture && this._depthTexture.generateMipmaps();
|
|
1078
1084
|
}
|
|
1079
1085
|
};
|
|
1080
|
-
|
|
1086
|
+
/**
|
|
1087
|
+
* @internal
|
|
1088
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
1081
1089
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
1082
1090
|
this._platformRenderTarget.destroy();
|
|
1083
1091
|
this._colorTextures.length = 0;
|
|
@@ -1455,7 +1463,9 @@ var Logger = {
|
|
|
1455
1463
|
_proto.getCharInfo = function getCharInfo(char) {
|
|
1456
1464
|
return this._charInfoMap[char.charCodeAt(0)];
|
|
1457
1465
|
};
|
|
1458
|
-
|
|
1466
|
+
/**
|
|
1467
|
+
* @internal
|
|
1468
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
1459
1469
|
ReferResource.prototype._onDestroy.call(this);
|
|
1460
1470
|
this.texture.destroy();
|
|
1461
1471
|
this.texture = null;
|
|
@@ -2018,7 +2028,9 @@ var Logger = {
|
|
|
2018
2028
|
subFontMap[key] = subFont;
|
|
2019
2029
|
return subFont;
|
|
2020
2030
|
};
|
|
2021
|
-
|
|
2031
|
+
/**
|
|
2032
|
+
* @internal
|
|
2033
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
2022
2034
|
ReferResource.prototype._onDestroy.call(this);
|
|
2023
2035
|
var subFontMap = this._subFontMap;
|
|
2024
2036
|
for(var k in subFontMap){
|
|
@@ -3237,7 +3249,9 @@ var GLCapabilityType;
|
|
|
3237
3249
|
}
|
|
3238
3250
|
}
|
|
3239
3251
|
};
|
|
3240
|
-
|
|
3252
|
+
/**
|
|
3253
|
+
* @internal
|
|
3254
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
3241
3255
|
EngineObject.prototype._onDestroy.call(this);
|
|
3242
3256
|
this._entity._removeComponent(this);
|
|
3243
3257
|
if (this._entity.isActiveInHierarchy) {
|
|
@@ -6010,7 +6024,9 @@ var Collider = /*#__PURE__*/ function(Component) {
|
|
|
6010
6024
|
*/ _proto._onDisable = function _onDisable() {
|
|
6011
6025
|
this.engine.physicsManager._removeCollider(this);
|
|
6012
6026
|
};
|
|
6013
|
-
|
|
6027
|
+
/**
|
|
6028
|
+
* @internal
|
|
6029
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
6014
6030
|
Component.prototype._onDestroy.call(this);
|
|
6015
6031
|
this.clearShapes();
|
|
6016
6032
|
this._nativeCollider.destroy();
|
|
@@ -7860,7 +7876,9 @@ var DynamicColliderConstraints;
|
|
|
7860
7876
|
return _this;
|
|
7861
7877
|
}
|
|
7862
7878
|
var _proto = Light.prototype;
|
|
7863
|
-
|
|
7879
|
+
/**
|
|
7880
|
+
* @internal
|
|
7881
|
+
*/ _proto._getLightColor = function _getLightColor() {
|
|
7864
7882
|
this._lightColor.r = this.color.r * this.intensity;
|
|
7865
7883
|
this._lightColor.g = this.color.g * this.intensity;
|
|
7866
7884
|
this._lightColor.b = this.color.b * this.intensity;
|
|
@@ -9577,9 +9595,9 @@ var noise_simplex_3D_grad = "#define GLSLIFY 1\nfloat simplex(vec3 v,out vec3 gr
|
|
|
9577
9595
|
|
|
9578
9596
|
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
|
|
9579
9597
|
|
|
9580
|
-
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
|
|
9598
|
+
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
|
|
9581
9599
|
|
|
9582
|
-
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
|
|
9600
|
+
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
|
|
9583
9601
|
|
|
9584
9602
|
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
|
|
9585
9603
|
|
|
@@ -10777,14 +10795,18 @@ var Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10777
10795
|
(_materials_i = materials[i]) == null ? void 0 : _materials_i._addReferCount(-1);
|
|
10778
10796
|
}
|
|
10779
10797
|
};
|
|
10780
|
-
|
|
10798
|
+
/**
|
|
10799
|
+
* @internal
|
|
10800
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
10781
10801
|
var entity = this.entity;
|
|
10782
10802
|
var worldMatrix = entity.transform.worldMatrix;
|
|
10783
10803
|
this._updateTransformShaderData(context, worldMatrix);
|
|
10784
10804
|
var layer = entity.layer;
|
|
10785
10805
|
this._rendererLayer.set(layer & 65535, layer >>> 16 & 65535, 0, 0);
|
|
10786
10806
|
};
|
|
10787
|
-
|
|
10807
|
+
/**
|
|
10808
|
+
* @internal
|
|
10809
|
+
*/ _proto._updateTransformShaderData = function _updateTransformShaderData(context, worldMatrix) {
|
|
10788
10810
|
var shaderData = this.shaderData;
|
|
10789
10811
|
var virtualCamera = context.virtualCamera;
|
|
10790
10812
|
var mvMatrix = this._mvMatrix;
|
|
@@ -10803,14 +10825,22 @@ var Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10803
10825
|
shaderData.setMatrix(Renderer._mvInvMatrixProperty, mvInvMatrix);
|
|
10804
10826
|
shaderData.setMatrix(Renderer._normalMatrixProperty, normalMatrix);
|
|
10805
10827
|
};
|
|
10806
|
-
|
|
10828
|
+
/**
|
|
10829
|
+
* @internal
|
|
10830
|
+
*/ _proto._registerEntityTransformListener = function _registerEntityTransformListener() {
|
|
10807
10831
|
this.entity.transform._updateFlagManager.addListener(this._onTransformChanged);
|
|
10808
10832
|
};
|
|
10809
|
-
|
|
10810
|
-
|
|
10833
|
+
/**
|
|
10834
|
+
* @internal
|
|
10835
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {};
|
|
10836
|
+
/**
|
|
10837
|
+
* @internal
|
|
10838
|
+
*/ _proto._render = function _render(context) {
|
|
10811
10839
|
throw "not implement";
|
|
10812
10840
|
};
|
|
10813
|
-
|
|
10841
|
+
/**
|
|
10842
|
+
* @internal
|
|
10843
|
+
*/ _proto._createInstanceMaterial = function _createInstanceMaterial(material, index) {
|
|
10814
10844
|
var insMaterial = material.clone();
|
|
10815
10845
|
insMaterial.name = insMaterial.name + "(Instance)";
|
|
10816
10846
|
material._addReferCount(-1);
|
|
@@ -10833,7 +10863,9 @@ var Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10833
10863
|
materials[index] = material;
|
|
10834
10864
|
}
|
|
10835
10865
|
};
|
|
10836
|
-
|
|
10866
|
+
/**
|
|
10867
|
+
* @internal
|
|
10868
|
+
*/ _proto._onTransformChanged = function _onTransformChanged(type) {
|
|
10837
10869
|
this._dirtyUpdateFlag |= 0x1;
|
|
10838
10870
|
};
|
|
10839
10871
|
_create_class(Renderer1, [
|
|
@@ -11158,7 +11190,9 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11158
11190
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
11159
11191
|
target.sprite = this._sprite;
|
|
11160
11192
|
};
|
|
11161
|
-
|
|
11193
|
+
/**
|
|
11194
|
+
* @internal
|
|
11195
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
11162
11196
|
var _this_sprite;
|
|
11163
11197
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
11164
11198
|
worldBounds.min.set(0, 0, 0);
|
|
@@ -11168,6 +11202,7 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11168
11202
|
}
|
|
11169
11203
|
};
|
|
11170
11204
|
/**
|
|
11205
|
+
* @internal
|
|
11171
11206
|
* @inheritdoc
|
|
11172
11207
|
*/ _proto._render = function _render(context) {
|
|
11173
11208
|
var _this_sprite;
|
|
@@ -11193,6 +11228,7 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11193
11228
|
this._maskElement = renderElement;
|
|
11194
11229
|
};
|
|
11195
11230
|
/**
|
|
11231
|
+
* @internal
|
|
11196
11232
|
* @inheritdoc
|
|
11197
11233
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
11198
11234
|
var _this__sprite;
|
|
@@ -11617,7 +11653,9 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11617
11653
|
var platformBuffer = this._engine._hardwareRenderer.createPlatformBuffer(this._type, this._byteLength, this._bufferUsage);
|
|
11618
11654
|
this._platformBuffer = platformBuffer;
|
|
11619
11655
|
};
|
|
11620
|
-
|
|
11656
|
+
/**
|
|
11657
|
+
* @internal
|
|
11658
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
11621
11659
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
11622
11660
|
this._platformBuffer.destroy();
|
|
11623
11661
|
};
|
|
@@ -11830,13 +11868,17 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11830
11868
|
this._vertexElementMap = null;
|
|
11831
11869
|
this._platformPrimitive.destroy();
|
|
11832
11870
|
};
|
|
11833
|
-
|
|
11871
|
+
/**
|
|
11872
|
+
* @internal
|
|
11873
|
+
*/ _proto._setVertexElements = function _setVertexElements(elements) {
|
|
11834
11874
|
this._clearVertexElements();
|
|
11835
11875
|
for(var i = 0, n = elements.length; i < n; i++){
|
|
11836
11876
|
this._addVertexElement(elements[i]);
|
|
11837
11877
|
}
|
|
11838
11878
|
};
|
|
11839
|
-
|
|
11879
|
+
/**
|
|
11880
|
+
* @internal
|
|
11881
|
+
*/ _proto._setIndexBufferBinding = function _setIndexBufferBinding(binding) {
|
|
11840
11882
|
var lastBinding = this._indexBufferBinding;
|
|
11841
11883
|
if (binding) {
|
|
11842
11884
|
this._indexBufferBinding = binding;
|
|
@@ -12974,7 +13016,9 @@ var MeshModifyFlags;
|
|
|
12974
13016
|
}
|
|
12975
13017
|
this.setTangents(tangents);
|
|
12976
13018
|
};
|
|
12977
|
-
|
|
13019
|
+
/**
|
|
13020
|
+
* @internal
|
|
13021
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
12978
13022
|
Mesh.prototype._onDestroy.call(this);
|
|
12979
13023
|
this._readable && this._releaseCache();
|
|
12980
13024
|
};
|
|
@@ -13449,7 +13493,9 @@ var VertexChangedFlags;
|
|
|
13449
13493
|
return _this;
|
|
13450
13494
|
}
|
|
13451
13495
|
var _proto = MeshRenderer.prototype;
|
|
13452
|
-
|
|
13496
|
+
/**
|
|
13497
|
+
* @internal
|
|
13498
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
13453
13499
|
Renderer.prototype._onDestroy.call(this);
|
|
13454
13500
|
var mesh = this._mesh;
|
|
13455
13501
|
if (mesh && !mesh.destroyed) {
|
|
@@ -13462,7 +13508,9 @@ var VertexChangedFlags;
|
|
|
13462
13508
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
13463
13509
|
target.mesh = this._mesh;
|
|
13464
13510
|
};
|
|
13465
|
-
|
|
13511
|
+
/**
|
|
13512
|
+
* @internal
|
|
13513
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
13466
13514
|
var mesh = this._mesh;
|
|
13467
13515
|
if (mesh) {
|
|
13468
13516
|
var localBounds = mesh.bounds;
|
|
@@ -13473,7 +13521,9 @@ var VertexChangedFlags;
|
|
|
13473
13521
|
worldBounds.max.set(0, 0, 0);
|
|
13474
13522
|
}
|
|
13475
13523
|
};
|
|
13476
|
-
|
|
13524
|
+
/**
|
|
13525
|
+
* @internal
|
|
13526
|
+
*/ _proto._render = function _render(context) {
|
|
13477
13527
|
var mesh = this._mesh;
|
|
13478
13528
|
if (mesh) {
|
|
13479
13529
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
@@ -13634,7 +13684,9 @@ var /**
|
|
|
13634
13684
|
}
|
|
13635
13685
|
}
|
|
13636
13686
|
};
|
|
13637
|
-
|
|
13687
|
+
/**
|
|
13688
|
+
* @internal
|
|
13689
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
13638
13690
|
var entity = this.entity;
|
|
13639
13691
|
var worldMatrix = this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
|
|
13640
13692
|
this._updateTransformShaderData(context, worldMatrix);
|
|
@@ -13689,10 +13741,14 @@ var /**
|
|
|
13689
13741
|
MeshRenderer.prototype._cloneTo.call(this, target);
|
|
13690
13742
|
this._blendShapeWeights && (target._blendShapeWeights = this._blendShapeWeights.slice());
|
|
13691
13743
|
};
|
|
13692
|
-
|
|
13744
|
+
/**
|
|
13745
|
+
* @internal
|
|
13746
|
+
*/ _proto._registerEntityTransformListener = function _registerEntityTransformListener() {
|
|
13693
13747
|
// Cancel register listener to entity transform.
|
|
13694
13748
|
};
|
|
13695
|
-
|
|
13749
|
+
/**
|
|
13750
|
+
* @internal
|
|
13751
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
13696
13752
|
if (this._rootBone) {
|
|
13697
13753
|
var localBounds = this._localBounds;
|
|
13698
13754
|
var worldMatrix = this._rootBone.transform.worldMatrix;
|
|
@@ -16787,7 +16843,9 @@ ShaderPool.init();
|
|
|
16787
16843
|
this._magentaTexture2DArray = magentaTexture2DArray;
|
|
16788
16844
|
}
|
|
16789
16845
|
};
|
|
16790
|
-
|
|
16846
|
+
/**
|
|
16847
|
+
* @internal
|
|
16848
|
+
*/ _proto._initialize = function _initialize(configuration) {
|
|
16791
16849
|
var _this = this;
|
|
16792
16850
|
var physics = configuration.physics;
|
|
16793
16851
|
if (physics) {
|
|
@@ -17109,7 +17167,9 @@ ShaderPool.init();
|
|
|
17109
17167
|
this._entity._removeScript(this);
|
|
17110
17168
|
this._waitHandlingInValid = false;
|
|
17111
17169
|
};
|
|
17112
|
-
|
|
17170
|
+
/**
|
|
17171
|
+
* @internal
|
|
17172
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
17113
17173
|
Component.prototype._onDestroy.call(this);
|
|
17114
17174
|
this._engine._componentsManager.addPendingDestroyScript(this);
|
|
17115
17175
|
};
|
|
@@ -18792,6 +18852,7 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
18792
18852
|
this.entity.scene._detachRenderCamera(this);
|
|
18793
18853
|
};
|
|
18794
18854
|
/**
|
|
18855
|
+
* @internal
|
|
18795
18856
|
* @inheritdoc
|
|
18796
18857
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
18797
18858
|
var _this__renderPipeline;
|
|
@@ -19986,6 +20047,7 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19986
20047
|
_this = PBRBaseMaterial.call(this, engine, Shader.find("pbr")) || this;
|
|
19987
20048
|
_this.shaderData.setFloat(PBRMaterial._metallicProp, 1);
|
|
19988
20049
|
_this.shaderData.setFloat(PBRMaterial._roughnessProp, 1);
|
|
20050
|
+
_this.shaderData.setFloat(PBRMaterial._iorProp, 1.5);
|
|
19989
20051
|
return _this;
|
|
19990
20052
|
}
|
|
19991
20053
|
var _proto = PBRMaterial.prototype;
|
|
@@ -19997,10 +20059,23 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19997
20059
|
return dest;
|
|
19998
20060
|
};
|
|
19999
20061
|
_create_class(PBRMaterial, [
|
|
20062
|
+
{
|
|
20063
|
+
key: "ior",
|
|
20064
|
+
get: /**
|
|
20065
|
+
* Index Of Refraction.
|
|
20066
|
+
* @defaultValue `1.5`
|
|
20067
|
+
*/ function get() {
|
|
20068
|
+
return this.shaderData.getFloat(PBRMaterial._iorProp);
|
|
20069
|
+
},
|
|
20070
|
+
set: function set(v) {
|
|
20071
|
+
this.shaderData.setFloat(PBRMaterial._iorProp, Math.max(v, 0));
|
|
20072
|
+
}
|
|
20073
|
+
},
|
|
20000
20074
|
{
|
|
20001
20075
|
key: "metallic",
|
|
20002
20076
|
get: /**
|
|
20003
|
-
* Metallic
|
|
20077
|
+
* Metallic.
|
|
20078
|
+
* @defaultValue `1.0`
|
|
20004
20079
|
*/ function get() {
|
|
20005
20080
|
return this.shaderData.getFloat(PBRMaterial._metallicProp);
|
|
20006
20081
|
},
|
|
@@ -20011,7 +20086,8 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20011
20086
|
{
|
|
20012
20087
|
key: "roughness",
|
|
20013
20088
|
get: /**
|
|
20014
|
-
* Roughness
|
|
20089
|
+
* Roughness. default 1.0.
|
|
20090
|
+
* @defaultValue `1.0`
|
|
20015
20091
|
*/ function get() {
|
|
20016
20092
|
return this.shaderData.getFloat(PBRMaterial._roughnessProp);
|
|
20017
20093
|
},
|
|
@@ -20048,6 +20124,9 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20048
20124
|
(function() {
|
|
20049
20125
|
PBRMaterial._roughnessMetallicTextureProp = ShaderProperty.getByName("material_RoughnessMetallicTexture");
|
|
20050
20126
|
})();
|
|
20127
|
+
(function() {
|
|
20128
|
+
PBRMaterial._iorProp = Shader.getPropertyByName("material_IOR");
|
|
20129
|
+
})();
|
|
20051
20130
|
|
|
20052
20131
|
/**
|
|
20053
20132
|
* PBR (Specular-Glossiness Workflow) Material.
|
|
@@ -20260,7 +20339,9 @@ var TextVerticalAlignment;
|
|
|
20260
20339
|
*/ _proto._addSprite = function _addSprite(sprite) {
|
|
20261
20340
|
this._spriteNamesToIndex[sprite.name] = this._sprites.push(sprite) - 1;
|
|
20262
20341
|
};
|
|
20263
|
-
|
|
20342
|
+
/**
|
|
20343
|
+
* @internal
|
|
20344
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
20264
20345
|
ReferResource.prototype._onDestroy.call(this);
|
|
20265
20346
|
this._sprites = null;
|
|
20266
20347
|
this._spriteNamesToIndex = null;
|
|
@@ -20369,7 +20450,9 @@ var TextVerticalAlignment;
|
|
|
20369
20450
|
this._dirtyUpdateFlag & 0x1 && this._updatePositions();
|
|
20370
20451
|
return this._bounds;
|
|
20371
20452
|
};
|
|
20372
|
-
|
|
20453
|
+
/**
|
|
20454
|
+
* @internal
|
|
20455
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
20373
20456
|
ReferResource.prototype._onDestroy.call(this);
|
|
20374
20457
|
this._texture = null;
|
|
20375
20458
|
};
|
|
@@ -21107,11 +21190,15 @@ var TiledType;
|
|
|
21107
21190
|
target._assembler.resetData(target);
|
|
21108
21191
|
target.sprite = this._sprite;
|
|
21109
21192
|
};
|
|
21110
|
-
|
|
21193
|
+
/**
|
|
21194
|
+
* @internal
|
|
21195
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
21111
21196
|
// @ts-ignore
|
|
21112
21197
|
this._updateTransformShaderData(context, Matrix._identity);
|
|
21113
21198
|
};
|
|
21114
|
-
|
|
21199
|
+
/**
|
|
21200
|
+
* @internal
|
|
21201
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
21115
21202
|
var _this_sprite;
|
|
21116
21203
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
21117
21204
|
worldBounds.min.set(0, 0, 0);
|
|
@@ -21120,7 +21207,9 @@ var TiledType;
|
|
|
21120
21207
|
this._assembler.updatePositions(this);
|
|
21121
21208
|
}
|
|
21122
21209
|
};
|
|
21123
|
-
|
|
21210
|
+
/**
|
|
21211
|
+
* @internal
|
|
21212
|
+
*/ _proto._render = function _render(context) {
|
|
21124
21213
|
var _this_sprite;
|
|
21125
21214
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
21126
21215
|
return;
|
|
@@ -21531,7 +21620,9 @@ var /**
|
|
|
21531
21620
|
this._font._addReferCount(1);
|
|
21532
21621
|
this.setMaterial(engine._spriteDefaultMaterial);
|
|
21533
21622
|
};
|
|
21534
|
-
|
|
21623
|
+
/**
|
|
21624
|
+
* @internal
|
|
21625
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
21535
21626
|
Renderer.prototype._onDestroy.call(this);
|
|
21536
21627
|
// Clear render data.
|
|
21537
21628
|
var charRenderDatas = this._charRenderDatas;
|
|
@@ -21566,14 +21657,20 @@ var /**
|
|
|
21566
21657
|
*/ _proto._setDirtyFlagFalse = function _setDirtyFlagFalse(type) {
|
|
21567
21658
|
this._dirtyFlag &= ~type;
|
|
21568
21659
|
};
|
|
21569
|
-
|
|
21660
|
+
/**
|
|
21661
|
+
* @internal
|
|
21662
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
21570
21663
|
// @ts-ignore
|
|
21571
21664
|
this._updateTransformShaderData(context, Matrix._identity);
|
|
21572
21665
|
};
|
|
21573
|
-
|
|
21666
|
+
/**
|
|
21667
|
+
* @internal
|
|
21668
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
21574
21669
|
BoundingBox.transform(this._localBounds, this._entity.transform.worldMatrix, worldBounds);
|
|
21575
21670
|
};
|
|
21576
|
-
|
|
21671
|
+
/**
|
|
21672
|
+
* @internal
|
|
21673
|
+
*/ _proto._render = function _render(context) {
|
|
21577
21674
|
if (this._text === "" || this.enableWrapping && this.width <= 0 || this.overflowMode === OverflowMode.Truncate && this.height <= 0) {
|
|
21578
21675
|
return;
|
|
21579
21676
|
}
|
|
@@ -21756,7 +21853,9 @@ var /**
|
|
|
21756
21853
|
return a.texture.instanceId - b.texture.instanceId;
|
|
21757
21854
|
});
|
|
21758
21855
|
};
|
|
21759
|
-
|
|
21856
|
+
/**
|
|
21857
|
+
* @internal
|
|
21858
|
+
*/ _proto._onTransformChanged = function _onTransformChanged(bit) {
|
|
21760
21859
|
Renderer.prototype._onTransformChanged.call(this, bit);
|
|
21761
21860
|
this._setDirtyFlagTrue(0x4 | 0x8);
|
|
21762
21861
|
};
|
|
@@ -25526,7 +25625,9 @@ var _tempVector3 = new Vector3();
|
|
|
25526
25625
|
this.getMaterial().shaderData.setTexture("u_texture", texture);
|
|
25527
25626
|
}
|
|
25528
25627
|
};
|
|
25529
|
-
|
|
25628
|
+
/**
|
|
25629
|
+
* @internal
|
|
25630
|
+
*/ _proto._render = function _render(context) {
|
|
25530
25631
|
this._updateStrapVertices(context.camera, this._points);
|
|
25531
25632
|
this._updateStrapCoords();
|
|
25532
25633
|
this._vertexBuffer.setData(this._vertices);
|
|
@@ -25720,7 +25821,7 @@ var cacheDir = new Vector3();
|
|
|
25720
25821
|
/**
|
|
25721
25822
|
* The position of the probe can be set, the default is the origin [0,0,0].
|
|
25722
25823
|
*/ _this.position = new Vector3(0, 0, 0);
|
|
25723
|
-
_this._isCube = true;
|
|
25824
|
+
/** @internal */ _this._isCube = true;
|
|
25724
25825
|
_this.oriViewMatrix = new Matrix();
|
|
25725
25826
|
return _this;
|
|
25726
25827
|
}
|