@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/miniprogram.js
CHANGED
|
@@ -683,7 +683,9 @@ __decorate([
|
|
|
683
683
|
*/ _proto._addToResourceManager = function _addToResourceManager(path) {
|
|
684
684
|
this._engine.resourceManager._addAsset(path, this);
|
|
685
685
|
};
|
|
686
|
-
|
|
686
|
+
/**
|
|
687
|
+
* @internal
|
|
688
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
687
689
|
EngineObject.prototype._onDestroy.call(this);
|
|
688
690
|
this._engine.resourceManager._deleteReferResource(this);
|
|
689
691
|
var refCount = this._getReferCount();
|
|
@@ -815,7 +817,9 @@ var GraphicsResource = /*#__PURE__*/ function(ReferResource) {
|
|
|
815
817
|
return _this;
|
|
816
818
|
}
|
|
817
819
|
var _proto = GraphicsResource.prototype;
|
|
818
|
-
|
|
820
|
+
/**
|
|
821
|
+
* @internal
|
|
822
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
819
823
|
ReferResource.prototype._onDestroy.call(this);
|
|
820
824
|
this.engine.resourceManager._deleteGraphicResource(this);
|
|
821
825
|
};
|
|
@@ -894,7 +898,9 @@ var Logger = {
|
|
|
894
898
|
platformTexture.depthCompareFunction = this._depthCompareFunction;
|
|
895
899
|
platformTexture.setUseDepthCompareMode(this._useDepthCompareMode);
|
|
896
900
|
};
|
|
897
|
-
|
|
901
|
+
/**
|
|
902
|
+
* @internal
|
|
903
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
898
904
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
899
905
|
this._platformTexture.destroy();
|
|
900
906
|
this._platformTexture = null;
|
|
@@ -1082,7 +1088,9 @@ var Logger = {
|
|
|
1082
1088
|
this._depthTexture && this._depthTexture.generateMipmaps();
|
|
1083
1089
|
}
|
|
1084
1090
|
};
|
|
1085
|
-
|
|
1091
|
+
/**
|
|
1092
|
+
* @internal
|
|
1093
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
1086
1094
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
1087
1095
|
this._platformRenderTarget.destroy();
|
|
1088
1096
|
this._colorTextures.length = 0;
|
|
@@ -1460,7 +1468,9 @@ var Logger = {
|
|
|
1460
1468
|
_proto.getCharInfo = function getCharInfo(char) {
|
|
1461
1469
|
return this._charInfoMap[char.charCodeAt(0)];
|
|
1462
1470
|
};
|
|
1463
|
-
|
|
1471
|
+
/**
|
|
1472
|
+
* @internal
|
|
1473
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
1464
1474
|
ReferResource.prototype._onDestroy.call(this);
|
|
1465
1475
|
this.texture.destroy();
|
|
1466
1476
|
this.texture = null;
|
|
@@ -2023,7 +2033,9 @@ var Logger = {
|
|
|
2023
2033
|
subFontMap[key] = subFont;
|
|
2024
2034
|
return subFont;
|
|
2025
2035
|
};
|
|
2026
|
-
|
|
2036
|
+
/**
|
|
2037
|
+
* @internal
|
|
2038
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
2027
2039
|
ReferResource.prototype._onDestroy.call(this);
|
|
2028
2040
|
var subFontMap = this._subFontMap;
|
|
2029
2041
|
for(var k in subFontMap){
|
|
@@ -3242,7 +3254,9 @@ exports.GLCapabilityType = void 0;
|
|
|
3242
3254
|
}
|
|
3243
3255
|
}
|
|
3244
3256
|
};
|
|
3245
|
-
|
|
3257
|
+
/**
|
|
3258
|
+
* @internal
|
|
3259
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
3246
3260
|
EngineObject.prototype._onDestroy.call(this);
|
|
3247
3261
|
this._entity._removeComponent(this);
|
|
3248
3262
|
if (this._entity.isActiveInHierarchy) {
|
|
@@ -6015,7 +6029,9 @@ exports.Collider = /*#__PURE__*/ function(Component) {
|
|
|
6015
6029
|
*/ _proto._onDisable = function _onDisable() {
|
|
6016
6030
|
this.engine.physicsManager._removeCollider(this);
|
|
6017
6031
|
};
|
|
6018
|
-
|
|
6032
|
+
/**
|
|
6033
|
+
* @internal
|
|
6034
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
6019
6035
|
Component.prototype._onDestroy.call(this);
|
|
6020
6036
|
this.clearShapes();
|
|
6021
6037
|
this._nativeCollider.destroy();
|
|
@@ -7865,7 +7881,9 @@ exports.DynamicColliderConstraints = void 0;
|
|
|
7865
7881
|
return _this;
|
|
7866
7882
|
}
|
|
7867
7883
|
var _proto = Light.prototype;
|
|
7868
|
-
|
|
7884
|
+
/**
|
|
7885
|
+
* @internal
|
|
7886
|
+
*/ _proto._getLightColor = function _getLightColor() {
|
|
7869
7887
|
this._lightColor.r = this.color.r * this.intensity;
|
|
7870
7888
|
this._lightColor.g = this.color.g * this.intensity;
|
|
7871
7889
|
this._lightColor.b = this.color.b * this.intensity;
|
|
@@ -9582,9 +9600,9 @@ var noise_simplex_3D_grad = "#define GLSLIFY 1\nfloat simplex(vec3 v,out vec3 gr
|
|
|
9582
9600
|
|
|
9583
9601
|
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
|
|
9584
9602
|
|
|
9585
|
-
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
|
|
9603
|
+
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
|
|
9586
9604
|
|
|
9587
|
-
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
|
|
9605
|
+
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
|
|
9588
9606
|
|
|
9589
9607
|
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
|
|
9590
9608
|
|
|
@@ -10782,14 +10800,18 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10782
10800
|
(_materials_i = materials[i]) == null ? void 0 : _materials_i._addReferCount(-1);
|
|
10783
10801
|
}
|
|
10784
10802
|
};
|
|
10785
|
-
|
|
10803
|
+
/**
|
|
10804
|
+
* @internal
|
|
10805
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
10786
10806
|
var entity = this.entity;
|
|
10787
10807
|
var worldMatrix = entity.transform.worldMatrix;
|
|
10788
10808
|
this._updateTransformShaderData(context, worldMatrix);
|
|
10789
10809
|
var layer = entity.layer;
|
|
10790
10810
|
this._rendererLayer.set(layer & 65535, layer >>> 16 & 65535, 0, 0);
|
|
10791
10811
|
};
|
|
10792
|
-
|
|
10812
|
+
/**
|
|
10813
|
+
* @internal
|
|
10814
|
+
*/ _proto._updateTransformShaderData = function _updateTransformShaderData(context, worldMatrix) {
|
|
10793
10815
|
var shaderData = this.shaderData;
|
|
10794
10816
|
var virtualCamera = context.virtualCamera;
|
|
10795
10817
|
var mvMatrix = this._mvMatrix;
|
|
@@ -10808,14 +10830,22 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10808
10830
|
shaderData.setMatrix(exports.Renderer._mvInvMatrixProperty, mvInvMatrix);
|
|
10809
10831
|
shaderData.setMatrix(exports.Renderer._normalMatrixProperty, normalMatrix);
|
|
10810
10832
|
};
|
|
10811
|
-
|
|
10833
|
+
/**
|
|
10834
|
+
* @internal
|
|
10835
|
+
*/ _proto._registerEntityTransformListener = function _registerEntityTransformListener() {
|
|
10812
10836
|
this.entity.transform._updateFlagManager.addListener(this._onTransformChanged);
|
|
10813
10837
|
};
|
|
10814
|
-
|
|
10815
|
-
|
|
10838
|
+
/**
|
|
10839
|
+
* @internal
|
|
10840
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {};
|
|
10841
|
+
/**
|
|
10842
|
+
* @internal
|
|
10843
|
+
*/ _proto._render = function _render(context) {
|
|
10816
10844
|
throw "not implement";
|
|
10817
10845
|
};
|
|
10818
|
-
|
|
10846
|
+
/**
|
|
10847
|
+
* @internal
|
|
10848
|
+
*/ _proto._createInstanceMaterial = function _createInstanceMaterial(material, index) {
|
|
10819
10849
|
var insMaterial = material.clone();
|
|
10820
10850
|
insMaterial.name = insMaterial.name + "(Instance)";
|
|
10821
10851
|
material._addReferCount(-1);
|
|
@@ -10838,7 +10868,9 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10838
10868
|
materials[index] = material;
|
|
10839
10869
|
}
|
|
10840
10870
|
};
|
|
10841
|
-
|
|
10871
|
+
/**
|
|
10872
|
+
* @internal
|
|
10873
|
+
*/ _proto._onTransformChanged = function _onTransformChanged(type) {
|
|
10842
10874
|
this._dirtyUpdateFlag |= 0x1;
|
|
10843
10875
|
};
|
|
10844
10876
|
_create_class(Renderer1, [
|
|
@@ -11163,7 +11195,9 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11163
11195
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
11164
11196
|
target.sprite = this._sprite;
|
|
11165
11197
|
};
|
|
11166
|
-
|
|
11198
|
+
/**
|
|
11199
|
+
* @internal
|
|
11200
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
11167
11201
|
var _this_sprite;
|
|
11168
11202
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
11169
11203
|
worldBounds.min.set(0, 0, 0);
|
|
@@ -11173,6 +11207,7 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11173
11207
|
}
|
|
11174
11208
|
};
|
|
11175
11209
|
/**
|
|
11210
|
+
* @internal
|
|
11176
11211
|
* @inheritdoc
|
|
11177
11212
|
*/ _proto._render = function _render(context) {
|
|
11178
11213
|
var _this_sprite;
|
|
@@ -11198,6 +11233,7 @@ SimpleSpriteAssembler = __decorate([
|
|
|
11198
11233
|
this._maskElement = renderElement;
|
|
11199
11234
|
};
|
|
11200
11235
|
/**
|
|
11236
|
+
* @internal
|
|
11201
11237
|
* @inheritdoc
|
|
11202
11238
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
11203
11239
|
var _this__sprite;
|
|
@@ -11622,7 +11658,9 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11622
11658
|
var platformBuffer = this._engine._hardwareRenderer.createPlatformBuffer(this._type, this._byteLength, this._bufferUsage);
|
|
11623
11659
|
this._platformBuffer = platformBuffer;
|
|
11624
11660
|
};
|
|
11625
|
-
|
|
11661
|
+
/**
|
|
11662
|
+
* @internal
|
|
11663
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
11626
11664
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
11627
11665
|
this._platformBuffer.destroy();
|
|
11628
11666
|
};
|
|
@@ -11835,13 +11873,17 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11835
11873
|
this._vertexElementMap = null;
|
|
11836
11874
|
this._platformPrimitive.destroy();
|
|
11837
11875
|
};
|
|
11838
|
-
|
|
11876
|
+
/**
|
|
11877
|
+
* @internal
|
|
11878
|
+
*/ _proto._setVertexElements = function _setVertexElements(elements) {
|
|
11839
11879
|
this._clearVertexElements();
|
|
11840
11880
|
for(var i = 0, n = elements.length; i < n; i++){
|
|
11841
11881
|
this._addVertexElement(elements[i]);
|
|
11842
11882
|
}
|
|
11843
11883
|
};
|
|
11844
|
-
|
|
11884
|
+
/**
|
|
11885
|
+
* @internal
|
|
11886
|
+
*/ _proto._setIndexBufferBinding = function _setIndexBufferBinding(binding) {
|
|
11845
11887
|
var lastBinding = this._indexBufferBinding;
|
|
11846
11888
|
if (binding) {
|
|
11847
11889
|
this._indexBufferBinding = binding;
|
|
@@ -12979,7 +13021,9 @@ var MeshModifyFlags;
|
|
|
12979
13021
|
}
|
|
12980
13022
|
this.setTangents(tangents);
|
|
12981
13023
|
};
|
|
12982
|
-
|
|
13024
|
+
/**
|
|
13025
|
+
* @internal
|
|
13026
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
12983
13027
|
Mesh.prototype._onDestroy.call(this);
|
|
12984
13028
|
this._readable && this._releaseCache();
|
|
12985
13029
|
};
|
|
@@ -13454,7 +13498,9 @@ var VertexChangedFlags;
|
|
|
13454
13498
|
return _this;
|
|
13455
13499
|
}
|
|
13456
13500
|
var _proto = MeshRenderer.prototype;
|
|
13457
|
-
|
|
13501
|
+
/**
|
|
13502
|
+
* @internal
|
|
13503
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
13458
13504
|
Renderer.prototype._onDestroy.call(this);
|
|
13459
13505
|
var mesh = this._mesh;
|
|
13460
13506
|
if (mesh && !mesh.destroyed) {
|
|
@@ -13467,7 +13513,9 @@ var VertexChangedFlags;
|
|
|
13467
13513
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
13468
13514
|
target.mesh = this._mesh;
|
|
13469
13515
|
};
|
|
13470
|
-
|
|
13516
|
+
/**
|
|
13517
|
+
* @internal
|
|
13518
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
13471
13519
|
var mesh = this._mesh;
|
|
13472
13520
|
if (mesh) {
|
|
13473
13521
|
var localBounds = mesh.bounds;
|
|
@@ -13478,7 +13526,9 @@ var VertexChangedFlags;
|
|
|
13478
13526
|
worldBounds.max.set(0, 0, 0);
|
|
13479
13527
|
}
|
|
13480
13528
|
};
|
|
13481
|
-
|
|
13529
|
+
/**
|
|
13530
|
+
* @internal
|
|
13531
|
+
*/ _proto._render = function _render(context) {
|
|
13482
13532
|
var mesh = this._mesh;
|
|
13483
13533
|
if (mesh) {
|
|
13484
13534
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
@@ -13639,7 +13689,9 @@ var /**
|
|
|
13639
13689
|
}
|
|
13640
13690
|
}
|
|
13641
13691
|
};
|
|
13642
|
-
|
|
13692
|
+
/**
|
|
13693
|
+
* @internal
|
|
13694
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
13643
13695
|
var entity = this.entity;
|
|
13644
13696
|
var worldMatrix = this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
|
|
13645
13697
|
this._updateTransformShaderData(context, worldMatrix);
|
|
@@ -13694,10 +13746,14 @@ var /**
|
|
|
13694
13746
|
MeshRenderer.prototype._cloneTo.call(this, target);
|
|
13695
13747
|
this._blendShapeWeights && (target._blendShapeWeights = this._blendShapeWeights.slice());
|
|
13696
13748
|
};
|
|
13697
|
-
|
|
13749
|
+
/**
|
|
13750
|
+
* @internal
|
|
13751
|
+
*/ _proto._registerEntityTransformListener = function _registerEntityTransformListener() {
|
|
13698
13752
|
// Cancel register listener to entity transform.
|
|
13699
13753
|
};
|
|
13700
|
-
|
|
13754
|
+
/**
|
|
13755
|
+
* @internal
|
|
13756
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
13701
13757
|
if (this._rootBone) {
|
|
13702
13758
|
var localBounds = this._localBounds;
|
|
13703
13759
|
var worldMatrix = this._rootBone.transform.worldMatrix;
|
|
@@ -16792,7 +16848,9 @@ ShaderPool.init();
|
|
|
16792
16848
|
this._magentaTexture2DArray = magentaTexture2DArray;
|
|
16793
16849
|
}
|
|
16794
16850
|
};
|
|
16795
|
-
|
|
16851
|
+
/**
|
|
16852
|
+
* @internal
|
|
16853
|
+
*/ _proto._initialize = function _initialize(configuration) {
|
|
16796
16854
|
var _this = this;
|
|
16797
16855
|
var physics = configuration.physics;
|
|
16798
16856
|
if (physics) {
|
|
@@ -17114,7 +17172,9 @@ ShaderPool.init();
|
|
|
17114
17172
|
this._entity._removeScript(this);
|
|
17115
17173
|
this._waitHandlingInValid = false;
|
|
17116
17174
|
};
|
|
17117
|
-
|
|
17175
|
+
/**
|
|
17176
|
+
* @internal
|
|
17177
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
17118
17178
|
Component.prototype._onDestroy.call(this);
|
|
17119
17179
|
this._engine._componentsManager.addPendingDestroyScript(this);
|
|
17120
17180
|
};
|
|
@@ -18797,6 +18857,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
18797
18857
|
this.entity.scene._detachRenderCamera(this);
|
|
18798
18858
|
};
|
|
18799
18859
|
/**
|
|
18860
|
+
* @internal
|
|
18800
18861
|
* @inheritdoc
|
|
18801
18862
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
18802
18863
|
var _this__renderPipeline;
|
|
@@ -19991,6 +20052,7 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19991
20052
|
_this = PBRBaseMaterial.call(this, engine, Shader.find("pbr")) || this;
|
|
19992
20053
|
_this.shaderData.setFloat(PBRMaterial._metallicProp, 1);
|
|
19993
20054
|
_this.shaderData.setFloat(PBRMaterial._roughnessProp, 1);
|
|
20055
|
+
_this.shaderData.setFloat(PBRMaterial._iorProp, 1.5);
|
|
19994
20056
|
return _this;
|
|
19995
20057
|
}
|
|
19996
20058
|
var _proto = PBRMaterial.prototype;
|
|
@@ -20002,10 +20064,23 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20002
20064
|
return dest;
|
|
20003
20065
|
};
|
|
20004
20066
|
_create_class(PBRMaterial, [
|
|
20067
|
+
{
|
|
20068
|
+
key: "ior",
|
|
20069
|
+
get: /**
|
|
20070
|
+
* Index Of Refraction.
|
|
20071
|
+
* @defaultValue `1.5`
|
|
20072
|
+
*/ function get() {
|
|
20073
|
+
return this.shaderData.getFloat(PBRMaterial._iorProp);
|
|
20074
|
+
},
|
|
20075
|
+
set: function set(v) {
|
|
20076
|
+
this.shaderData.setFloat(PBRMaterial._iorProp, Math.max(v, 0));
|
|
20077
|
+
}
|
|
20078
|
+
},
|
|
20005
20079
|
{
|
|
20006
20080
|
key: "metallic",
|
|
20007
20081
|
get: /**
|
|
20008
|
-
* Metallic
|
|
20082
|
+
* Metallic.
|
|
20083
|
+
* @defaultValue `1.0`
|
|
20009
20084
|
*/ function get() {
|
|
20010
20085
|
return this.shaderData.getFloat(PBRMaterial._metallicProp);
|
|
20011
20086
|
},
|
|
@@ -20016,7 +20091,8 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20016
20091
|
{
|
|
20017
20092
|
key: "roughness",
|
|
20018
20093
|
get: /**
|
|
20019
|
-
* Roughness
|
|
20094
|
+
* Roughness. default 1.0.
|
|
20095
|
+
* @defaultValue `1.0`
|
|
20020
20096
|
*/ function get() {
|
|
20021
20097
|
return this.shaderData.getFloat(PBRMaterial._roughnessProp);
|
|
20022
20098
|
},
|
|
@@ -20053,6 +20129,9 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
20053
20129
|
(function() {
|
|
20054
20130
|
PBRMaterial._roughnessMetallicTextureProp = ShaderProperty.getByName("material_RoughnessMetallicTexture");
|
|
20055
20131
|
})();
|
|
20132
|
+
(function() {
|
|
20133
|
+
PBRMaterial._iorProp = Shader.getPropertyByName("material_IOR");
|
|
20134
|
+
})();
|
|
20056
20135
|
|
|
20057
20136
|
/**
|
|
20058
20137
|
* PBR (Specular-Glossiness Workflow) Material.
|
|
@@ -20265,7 +20344,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20265
20344
|
*/ _proto._addSprite = function _addSprite(sprite) {
|
|
20266
20345
|
this._spriteNamesToIndex[sprite.name] = this._sprites.push(sprite) - 1;
|
|
20267
20346
|
};
|
|
20268
|
-
|
|
20347
|
+
/**
|
|
20348
|
+
* @internal
|
|
20349
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
20269
20350
|
ReferResource.prototype._onDestroy.call(this);
|
|
20270
20351
|
this._sprites = null;
|
|
20271
20352
|
this._spriteNamesToIndex = null;
|
|
@@ -20374,7 +20455,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20374
20455
|
this._dirtyUpdateFlag & 0x1 && this._updatePositions();
|
|
20375
20456
|
return this._bounds;
|
|
20376
20457
|
};
|
|
20377
|
-
|
|
20458
|
+
/**
|
|
20459
|
+
* @internal
|
|
20460
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
20378
20461
|
ReferResource.prototype._onDestroy.call(this);
|
|
20379
20462
|
this._texture = null;
|
|
20380
20463
|
};
|
|
@@ -21112,11 +21195,15 @@ var TiledType;
|
|
|
21112
21195
|
target._assembler.resetData(target);
|
|
21113
21196
|
target.sprite = this._sprite;
|
|
21114
21197
|
};
|
|
21115
|
-
|
|
21198
|
+
/**
|
|
21199
|
+
* @internal
|
|
21200
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
21116
21201
|
// @ts-ignore
|
|
21117
21202
|
this._updateTransformShaderData(context, miniprogram.Matrix._identity);
|
|
21118
21203
|
};
|
|
21119
|
-
|
|
21204
|
+
/**
|
|
21205
|
+
* @internal
|
|
21206
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
21120
21207
|
var _this_sprite;
|
|
21121
21208
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
21122
21209
|
worldBounds.min.set(0, 0, 0);
|
|
@@ -21125,7 +21212,9 @@ var TiledType;
|
|
|
21125
21212
|
this._assembler.updatePositions(this);
|
|
21126
21213
|
}
|
|
21127
21214
|
};
|
|
21128
|
-
|
|
21215
|
+
/**
|
|
21216
|
+
* @internal
|
|
21217
|
+
*/ _proto._render = function _render(context) {
|
|
21129
21218
|
var _this_sprite;
|
|
21130
21219
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
21131
21220
|
return;
|
|
@@ -21536,7 +21625,9 @@ var /**
|
|
|
21536
21625
|
this._font._addReferCount(1);
|
|
21537
21626
|
this.setMaterial(engine._spriteDefaultMaterial);
|
|
21538
21627
|
};
|
|
21539
|
-
|
|
21628
|
+
/**
|
|
21629
|
+
* @internal
|
|
21630
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
21540
21631
|
Renderer.prototype._onDestroy.call(this);
|
|
21541
21632
|
// Clear render data.
|
|
21542
21633
|
var charRenderDatas = this._charRenderDatas;
|
|
@@ -21571,14 +21662,20 @@ var /**
|
|
|
21571
21662
|
*/ _proto._setDirtyFlagFalse = function _setDirtyFlagFalse(type) {
|
|
21572
21663
|
this._dirtyFlag &= ~type;
|
|
21573
21664
|
};
|
|
21574
|
-
|
|
21665
|
+
/**
|
|
21666
|
+
* @internal
|
|
21667
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
21575
21668
|
// @ts-ignore
|
|
21576
21669
|
this._updateTransformShaderData(context, miniprogram.Matrix._identity);
|
|
21577
21670
|
};
|
|
21578
|
-
|
|
21671
|
+
/**
|
|
21672
|
+
* @internal
|
|
21673
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
21579
21674
|
miniprogram.BoundingBox.transform(this._localBounds, this._entity.transform.worldMatrix, worldBounds);
|
|
21580
21675
|
};
|
|
21581
|
-
|
|
21676
|
+
/**
|
|
21677
|
+
* @internal
|
|
21678
|
+
*/ _proto._render = function _render(context) {
|
|
21582
21679
|
if (this._text === "" || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0) {
|
|
21583
21680
|
return;
|
|
21584
21681
|
}
|
|
@@ -21761,7 +21858,9 @@ var /**
|
|
|
21761
21858
|
return a.texture.instanceId - b.texture.instanceId;
|
|
21762
21859
|
});
|
|
21763
21860
|
};
|
|
21764
|
-
|
|
21861
|
+
/**
|
|
21862
|
+
* @internal
|
|
21863
|
+
*/ _proto._onTransformChanged = function _onTransformChanged(bit) {
|
|
21765
21864
|
Renderer.prototype._onTransformChanged.call(this, bit);
|
|
21766
21865
|
this._setDirtyFlagTrue(0x4 | 0x8);
|
|
21767
21866
|
};
|
|
@@ -25531,7 +25630,9 @@ var _tempVector3 = new miniprogram.Vector3();
|
|
|
25531
25630
|
this.getMaterial().shaderData.setTexture("u_texture", texture);
|
|
25532
25631
|
}
|
|
25533
25632
|
};
|
|
25534
|
-
|
|
25633
|
+
/**
|
|
25634
|
+
* @internal
|
|
25635
|
+
*/ _proto._render = function _render(context) {
|
|
25535
25636
|
this._updateStrapVertices(context.camera, this._points);
|
|
25536
25637
|
this._updateStrapCoords();
|
|
25537
25638
|
this._vertexBuffer.setData(this._vertices);
|
|
@@ -25725,7 +25826,7 @@ var cacheDir = new miniprogram.Vector3();
|
|
|
25725
25826
|
/**
|
|
25726
25827
|
* The position of the probe can be set, the default is the origin [0,0,0].
|
|
25727
25828
|
*/ _this.position = new miniprogram.Vector3(0, 0, 0);
|
|
25728
|
-
_this._isCube = true;
|
|
25829
|
+
/** @internal */ _this._isCube = true;
|
|
25729
25830
|
_this.oriViewMatrix = new miniprogram.Matrix();
|
|
25730
25831
|
return _this;
|
|
25731
25832
|
}
|