@galacean/engine-physics-lite 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.map +1 -1
- package/dist/miniprogram.js +178 -58
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
package/dist/miniprogram.js
CHANGED
|
@@ -733,7 +733,9 @@ __decorate$1([
|
|
|
733
733
|
*/ _proto._addToResourceManager = function _addToResourceManager(path) {
|
|
734
734
|
this._engine.resourceManager._addAsset(path, this);
|
|
735
735
|
};
|
|
736
|
-
|
|
736
|
+
/**
|
|
737
|
+
* @internal
|
|
738
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
737
739
|
EngineObject.prototype._onDestroy.call(this);
|
|
738
740
|
this._engine.resourceManager._deleteReferResource(this);
|
|
739
741
|
var refCount = this._getReferCount();
|
|
@@ -857,7 +859,9 @@ var GraphicsResource = /*#__PURE__*/ function(ReferResource) {
|
|
|
857
859
|
};
|
|
858
860
|
_inherits$2(GraphicsResource, ReferResource);
|
|
859
861
|
var _proto = GraphicsResource.prototype;
|
|
860
|
-
|
|
862
|
+
/**
|
|
863
|
+
* @internal
|
|
864
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
861
865
|
ReferResource.prototype._onDestroy.call(this);
|
|
862
866
|
this.engine.resourceManager._deleteGraphicResource(this);
|
|
863
867
|
};
|
|
@@ -934,7 +938,9 @@ var Logger = {
|
|
|
934
938
|
platformTexture.depthCompareFunction = this._depthCompareFunction;
|
|
935
939
|
platformTexture.setUseDepthCompareMode(this._useDepthCompareMode);
|
|
936
940
|
};
|
|
937
|
-
|
|
941
|
+
/**
|
|
942
|
+
* @internal
|
|
943
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
938
944
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
939
945
|
this._platformTexture.destroy();
|
|
940
946
|
this._platformTexture = null;
|
|
@@ -1121,7 +1127,9 @@ var Logger = {
|
|
|
1121
1127
|
this._depthTexture && this._depthTexture.generateMipmaps();
|
|
1122
1128
|
}
|
|
1123
1129
|
};
|
|
1124
|
-
|
|
1130
|
+
/**
|
|
1131
|
+
* @internal
|
|
1132
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
1125
1133
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
1126
1134
|
this._platformRenderTarget.destroy();
|
|
1127
1135
|
this._colorTextures.length = 0;
|
|
@@ -1495,7 +1503,9 @@ var Logger = {
|
|
|
1495
1503
|
_proto.getCharInfo = function getCharInfo(char) {
|
|
1496
1504
|
return this._charInfoMap[char.charCodeAt(0)];
|
|
1497
1505
|
};
|
|
1498
|
-
|
|
1506
|
+
/**
|
|
1507
|
+
* @internal
|
|
1508
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
1499
1509
|
ReferResource.prototype._onDestroy.call(this);
|
|
1500
1510
|
this.texture.destroy();
|
|
1501
1511
|
this.texture = null;
|
|
@@ -2053,7 +2063,9 @@ var Logger = {
|
|
|
2053
2063
|
subFontMap[key] = subFont;
|
|
2054
2064
|
return subFont;
|
|
2055
2065
|
};
|
|
2056
|
-
|
|
2066
|
+
/**
|
|
2067
|
+
* @internal
|
|
2068
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
2057
2069
|
ReferResource.prototype._onDestroy.call(this);
|
|
2058
2070
|
var subFontMap = this._subFontMap;
|
|
2059
2071
|
for(var k in subFontMap){
|
|
@@ -3260,7 +3272,9 @@ exports.GLCapabilityType = void 0;
|
|
|
3260
3272
|
}
|
|
3261
3273
|
}
|
|
3262
3274
|
};
|
|
3263
|
-
|
|
3275
|
+
/**
|
|
3276
|
+
* @internal
|
|
3277
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
3264
3278
|
EngineObject.prototype._onDestroy.call(this);
|
|
3265
3279
|
this._entity._removeComponent(this);
|
|
3266
3280
|
if (this._entity.isActiveInHierarchy) {
|
|
@@ -6009,7 +6023,9 @@ exports.Collider = /*#__PURE__*/ function(Component) {
|
|
|
6009
6023
|
*/ _proto._onDisable = function _onDisable() {
|
|
6010
6024
|
this.engine.physicsManager._removeCollider(this);
|
|
6011
6025
|
};
|
|
6012
|
-
|
|
6026
|
+
/**
|
|
6027
|
+
* @internal
|
|
6028
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
6013
6029
|
Component.prototype._onDestroy.call(this);
|
|
6014
6030
|
this.clearShapes();
|
|
6015
6031
|
this._nativeCollider.destroy();
|
|
@@ -7833,7 +7849,9 @@ exports.DynamicColliderConstraints = void 0;
|
|
|
7833
7849
|
};
|
|
7834
7850
|
_inherits$2(Light, Component);
|
|
7835
7851
|
var _proto = Light.prototype;
|
|
7836
|
-
|
|
7852
|
+
/**
|
|
7853
|
+
* @internal
|
|
7854
|
+
*/ _proto._getLightColor = function _getLightColor() {
|
|
7837
7855
|
this._lightColor.r = this.color.r * this.intensity;
|
|
7838
7856
|
this._lightColor.g = this.color.g * this.intensity;
|
|
7839
7857
|
this._lightColor.b = this.color.b * this.intensity;
|
|
@@ -9475,8 +9493,8 @@ var noise_simplex_2D = "#define GLSLIFY 1\nfloat simplex(vec2 v){const vec4 C=ve
|
|
|
9475
9493
|
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
|
|
9476
9494
|
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
|
|
9477
9495
|
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
|
|
9478
|
-
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
|
|
9479
|
-
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
|
|
9496
|
+
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
|
|
9497
|
+
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
|
|
9480
9498
|
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
|
|
9481
9499
|
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
|
|
9482
9500
|
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
|
|
@@ -10648,14 +10666,18 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10648
10666
|
(_materials_i = materials[i]) == null ? void 0 : _materials_i._addReferCount(-1);
|
|
10649
10667
|
}
|
|
10650
10668
|
};
|
|
10651
|
-
|
|
10669
|
+
/**
|
|
10670
|
+
* @internal
|
|
10671
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
10652
10672
|
var entity = this.entity;
|
|
10653
10673
|
var worldMatrix = entity.transform.worldMatrix;
|
|
10654
10674
|
this._updateTransformShaderData(context, worldMatrix);
|
|
10655
10675
|
var layer = entity.layer;
|
|
10656
10676
|
this._rendererLayer.set(layer & 65535, layer >>> 16 & 65535, 0, 0);
|
|
10657
10677
|
};
|
|
10658
|
-
|
|
10678
|
+
/**
|
|
10679
|
+
* @internal
|
|
10680
|
+
*/ _proto._updateTransformShaderData = function _updateTransformShaderData(context, worldMatrix) {
|
|
10659
10681
|
var shaderData = this.shaderData;
|
|
10660
10682
|
var virtualCamera = context.virtualCamera;
|
|
10661
10683
|
var mvMatrix = this._mvMatrix;
|
|
@@ -10674,14 +10696,22 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10674
10696
|
shaderData.setMatrix(exports.Renderer._mvInvMatrixProperty, mvInvMatrix);
|
|
10675
10697
|
shaderData.setMatrix(exports.Renderer._normalMatrixProperty, normalMatrix);
|
|
10676
10698
|
};
|
|
10677
|
-
|
|
10699
|
+
/**
|
|
10700
|
+
* @internal
|
|
10701
|
+
*/ _proto._registerEntityTransformListener = function _registerEntityTransformListener() {
|
|
10678
10702
|
this.entity.transform._updateFlagManager.addListener(this._onTransformChanged);
|
|
10679
10703
|
};
|
|
10680
|
-
|
|
10681
|
-
|
|
10704
|
+
/**
|
|
10705
|
+
* @internal
|
|
10706
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {};
|
|
10707
|
+
/**
|
|
10708
|
+
* @internal
|
|
10709
|
+
*/ _proto._render = function _render(context) {
|
|
10682
10710
|
throw "not implement";
|
|
10683
10711
|
};
|
|
10684
|
-
|
|
10712
|
+
/**
|
|
10713
|
+
* @internal
|
|
10714
|
+
*/ _proto._createInstanceMaterial = function _createInstanceMaterial(material, index) {
|
|
10685
10715
|
var insMaterial = material.clone();
|
|
10686
10716
|
insMaterial.name = insMaterial.name + "(Instance)";
|
|
10687
10717
|
material._addReferCount(-1);
|
|
@@ -10704,7 +10734,9 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10704
10734
|
materials[index] = material;
|
|
10705
10735
|
}
|
|
10706
10736
|
};
|
|
10707
|
-
|
|
10737
|
+
/**
|
|
10738
|
+
* @internal
|
|
10739
|
+
*/ _proto._onTransformChanged = function _onTransformChanged(type) {
|
|
10708
10740
|
this._dirtyUpdateFlag |= 0x1;
|
|
10709
10741
|
};
|
|
10710
10742
|
_create_class$2(Renderer1, [
|
|
@@ -11022,7 +11054,9 @@ SimpleSpriteAssembler = __decorate$1([
|
|
|
11022
11054
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
11023
11055
|
target.sprite = this._sprite;
|
|
11024
11056
|
};
|
|
11025
|
-
|
|
11057
|
+
/**
|
|
11058
|
+
* @internal
|
|
11059
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
11026
11060
|
var _this_sprite;
|
|
11027
11061
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
11028
11062
|
worldBounds.min.set(0, 0, 0);
|
|
@@ -11032,6 +11066,7 @@ SimpleSpriteAssembler = __decorate$1([
|
|
|
11032
11066
|
}
|
|
11033
11067
|
};
|
|
11034
11068
|
/**
|
|
11069
|
+
* @internal
|
|
11035
11070
|
* @inheritdoc
|
|
11036
11071
|
*/ _proto._render = function _render(context) {
|
|
11037
11072
|
var _this_sprite;
|
|
@@ -11057,6 +11092,7 @@ SimpleSpriteAssembler = __decorate$1([
|
|
|
11057
11092
|
this._maskElement = renderElement;
|
|
11058
11093
|
};
|
|
11059
11094
|
/**
|
|
11095
|
+
* @internal
|
|
11060
11096
|
* @inheritdoc
|
|
11061
11097
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
11062
11098
|
var _this__sprite;
|
|
@@ -11474,7 +11510,9 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11474
11510
|
var platformBuffer = this._engine._hardwareRenderer.createPlatformBuffer(this._type, this._byteLength, this._bufferUsage);
|
|
11475
11511
|
this._platformBuffer = platformBuffer;
|
|
11476
11512
|
};
|
|
11477
|
-
|
|
11513
|
+
/**
|
|
11514
|
+
* @internal
|
|
11515
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
11478
11516
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
11479
11517
|
this._platformBuffer.destroy();
|
|
11480
11518
|
};
|
|
@@ -11682,13 +11720,17 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11682
11720
|
this._vertexElementMap = null;
|
|
11683
11721
|
this._platformPrimitive.destroy();
|
|
11684
11722
|
};
|
|
11685
|
-
|
|
11723
|
+
/**
|
|
11724
|
+
* @internal
|
|
11725
|
+
*/ _proto._setVertexElements = function _setVertexElements(elements) {
|
|
11686
11726
|
this._clearVertexElements();
|
|
11687
11727
|
for(var i = 0, n = elements.length; i < n; i++){
|
|
11688
11728
|
this._addVertexElement(elements[i]);
|
|
11689
11729
|
}
|
|
11690
11730
|
};
|
|
11691
|
-
|
|
11731
|
+
/**
|
|
11732
|
+
* @internal
|
|
11733
|
+
*/ _proto._setIndexBufferBinding = function _setIndexBufferBinding(binding) {
|
|
11692
11734
|
var lastBinding = this._indexBufferBinding;
|
|
11693
11735
|
if (binding) {
|
|
11694
11736
|
this._indexBufferBinding = binding;
|
|
@@ -12822,7 +12864,9 @@ var MeshModifyFlags;
|
|
|
12822
12864
|
}
|
|
12823
12865
|
this.setTangents(tangents);
|
|
12824
12866
|
};
|
|
12825
|
-
|
|
12867
|
+
/**
|
|
12868
|
+
* @internal
|
|
12869
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
12826
12870
|
Mesh.prototype._onDestroy.call(this);
|
|
12827
12871
|
this._readable && this._releaseCache();
|
|
12828
12872
|
};
|
|
@@ -13295,7 +13339,9 @@ var VertexChangedFlags;
|
|
|
13295
13339
|
};
|
|
13296
13340
|
_inherits$2(MeshRenderer, Renderer);
|
|
13297
13341
|
var _proto = MeshRenderer.prototype;
|
|
13298
|
-
|
|
13342
|
+
/**
|
|
13343
|
+
* @internal
|
|
13344
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
13299
13345
|
Renderer.prototype._onDestroy.call(this);
|
|
13300
13346
|
var mesh = this._mesh;
|
|
13301
13347
|
if (mesh && !mesh.destroyed) {
|
|
@@ -13308,7 +13354,9 @@ var VertexChangedFlags;
|
|
|
13308
13354
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
13309
13355
|
target.mesh = this._mesh;
|
|
13310
13356
|
};
|
|
13311
|
-
|
|
13357
|
+
/**
|
|
13358
|
+
* @internal
|
|
13359
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
13312
13360
|
var mesh = this._mesh;
|
|
13313
13361
|
if (mesh) {
|
|
13314
13362
|
var localBounds = mesh.bounds;
|
|
@@ -13319,7 +13367,9 @@ var VertexChangedFlags;
|
|
|
13319
13367
|
worldBounds.max.set(0, 0, 0);
|
|
13320
13368
|
}
|
|
13321
13369
|
};
|
|
13322
|
-
|
|
13370
|
+
/**
|
|
13371
|
+
* @internal
|
|
13372
|
+
*/ _proto._render = function _render(context) {
|
|
13323
13373
|
var mesh = this._mesh;
|
|
13324
13374
|
if (mesh) {
|
|
13325
13375
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
@@ -13479,7 +13529,9 @@ var /**
|
|
|
13479
13529
|
}
|
|
13480
13530
|
}
|
|
13481
13531
|
};
|
|
13482
|
-
|
|
13532
|
+
/**
|
|
13533
|
+
* @internal
|
|
13534
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
13483
13535
|
var entity = this.entity;
|
|
13484
13536
|
var worldMatrix = this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
|
|
13485
13537
|
this._updateTransformShaderData(context, worldMatrix);
|
|
@@ -13534,10 +13586,14 @@ var /**
|
|
|
13534
13586
|
MeshRenderer.prototype._cloneTo.call(this, target);
|
|
13535
13587
|
this._blendShapeWeights && (target._blendShapeWeights = this._blendShapeWeights.slice());
|
|
13536
13588
|
};
|
|
13537
|
-
|
|
13589
|
+
/**
|
|
13590
|
+
* @internal
|
|
13591
|
+
*/ _proto._registerEntityTransformListener = function _registerEntityTransformListener() {
|
|
13538
13592
|
// Cancel register listener to entity transform.
|
|
13539
13593
|
};
|
|
13540
|
-
|
|
13594
|
+
/**
|
|
13595
|
+
* @internal
|
|
13596
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
13541
13597
|
if (this._rootBone) {
|
|
13542
13598
|
var localBounds = this._localBounds;
|
|
13543
13599
|
var worldMatrix = this._rootBone.transform.worldMatrix;
|
|
@@ -16583,7 +16639,9 @@ ShaderPool.init();
|
|
|
16583
16639
|
this._magentaTexture2DArray = magentaTexture2DArray;
|
|
16584
16640
|
}
|
|
16585
16641
|
};
|
|
16586
|
-
|
|
16642
|
+
/**
|
|
16643
|
+
* @internal
|
|
16644
|
+
*/ _proto._initialize = function _initialize(configuration) {
|
|
16587
16645
|
var _this = this;
|
|
16588
16646
|
var physics = configuration.physics;
|
|
16589
16647
|
if (physics) {
|
|
@@ -16904,7 +16962,9 @@ ShaderPool.init();
|
|
|
16904
16962
|
this._entity._removeScript(this);
|
|
16905
16963
|
this._waitHandlingInValid = false;
|
|
16906
16964
|
};
|
|
16907
|
-
|
|
16965
|
+
/**
|
|
16966
|
+
* @internal
|
|
16967
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
16908
16968
|
Component.prototype._onDestroy.call(this);
|
|
16909
16969
|
this._engine._componentsManager.addPendingDestroyScript(this);
|
|
16910
16970
|
};
|
|
@@ -18577,6 +18637,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
18577
18637
|
this.entity.scene._detachRenderCamera(this);
|
|
18578
18638
|
};
|
|
18579
18639
|
/**
|
|
18640
|
+
* @internal
|
|
18580
18641
|
* @inheritdoc
|
|
18581
18642
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
18582
18643
|
var _this__renderPipeline;
|
|
@@ -19761,6 +19822,7 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19761
19822
|
_this = PBRBaseMaterial.call(this, engine, Shader.find("pbr")) || this;
|
|
19762
19823
|
_this.shaderData.setFloat(PBRMaterial._metallicProp, 1);
|
|
19763
19824
|
_this.shaderData.setFloat(PBRMaterial._roughnessProp, 1);
|
|
19825
|
+
_this.shaderData.setFloat(PBRMaterial._iorProp, 1.5);
|
|
19764
19826
|
return _this;
|
|
19765
19827
|
}
|
|
19766
19828
|
var _proto = PBRMaterial.prototype;
|
|
@@ -19772,10 +19834,23 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19772
19834
|
return dest;
|
|
19773
19835
|
};
|
|
19774
19836
|
_create_class$2(PBRMaterial, [
|
|
19837
|
+
{
|
|
19838
|
+
key: "ior",
|
|
19839
|
+
get: /**
|
|
19840
|
+
* Index Of Refraction.
|
|
19841
|
+
* @defaultValue `1.5`
|
|
19842
|
+
*/ function get() {
|
|
19843
|
+
return this.shaderData.getFloat(PBRMaterial._iorProp);
|
|
19844
|
+
},
|
|
19845
|
+
set: function set(v) {
|
|
19846
|
+
this.shaderData.setFloat(PBRMaterial._iorProp, Math.max(v, 0));
|
|
19847
|
+
}
|
|
19848
|
+
},
|
|
19775
19849
|
{
|
|
19776
19850
|
key: "metallic",
|
|
19777
19851
|
get: /**
|
|
19778
|
-
* Metallic
|
|
19852
|
+
* Metallic.
|
|
19853
|
+
* @defaultValue `1.0`
|
|
19779
19854
|
*/ function get() {
|
|
19780
19855
|
return this.shaderData.getFloat(PBRMaterial._metallicProp);
|
|
19781
19856
|
},
|
|
@@ -19786,7 +19861,8 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19786
19861
|
{
|
|
19787
19862
|
key: "roughness",
|
|
19788
19863
|
get: /**
|
|
19789
|
-
* Roughness
|
|
19864
|
+
* Roughness. default 1.0.
|
|
19865
|
+
* @defaultValue `1.0`
|
|
19790
19866
|
*/ function get() {
|
|
19791
19867
|
return this.shaderData.getFloat(PBRMaterial._roughnessProp);
|
|
19792
19868
|
},
|
|
@@ -19823,6 +19899,9 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19823
19899
|
(function() {
|
|
19824
19900
|
PBRMaterial._roughnessMetallicTextureProp = ShaderProperty.getByName("material_RoughnessMetallicTexture");
|
|
19825
19901
|
})();
|
|
19902
|
+
(function() {
|
|
19903
|
+
PBRMaterial._iorProp = Shader.getPropertyByName("material_IOR");
|
|
19904
|
+
})();
|
|
19826
19905
|
/**
|
|
19827
19906
|
* PBR (Specular-Glossiness Workflow) Material.
|
|
19828
19907
|
*/ var PBRSpecularMaterial = /*#__PURE__*/ function(PBRBaseMaterial) {
|
|
@@ -20031,7 +20110,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20031
20110
|
*/ _proto._addSprite = function _addSprite(sprite) {
|
|
20032
20111
|
this._spriteNamesToIndex[sprite.name] = this._sprites.push(sprite) - 1;
|
|
20033
20112
|
};
|
|
20034
|
-
|
|
20113
|
+
/**
|
|
20114
|
+
* @internal
|
|
20115
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
20035
20116
|
ReferResource.prototype._onDestroy.call(this);
|
|
20036
20117
|
this._sprites = null;
|
|
20037
20118
|
this._spriteNamesToIndex = null;
|
|
@@ -20137,7 +20218,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20137
20218
|
this._dirtyUpdateFlag & 0x1 && this._updatePositions();
|
|
20138
20219
|
return this._bounds;
|
|
20139
20220
|
};
|
|
20140
|
-
|
|
20221
|
+
/**
|
|
20222
|
+
* @internal
|
|
20223
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
20141
20224
|
ReferResource.prototype._onDestroy.call(this);
|
|
20142
20225
|
this._texture = null;
|
|
20143
20226
|
};
|
|
@@ -20872,11 +20955,15 @@ var TiledType;
|
|
|
20872
20955
|
target._assembler.resetData(target);
|
|
20873
20956
|
target.sprite = this._sprite;
|
|
20874
20957
|
};
|
|
20875
|
-
|
|
20958
|
+
/**
|
|
20959
|
+
* @internal
|
|
20960
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
20876
20961
|
// @ts-ignore
|
|
20877
20962
|
this._updateTransformShaderData(context, miniprogram$7.Matrix._identity);
|
|
20878
20963
|
};
|
|
20879
|
-
|
|
20964
|
+
/**
|
|
20965
|
+
* @internal
|
|
20966
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
20880
20967
|
var _this_sprite;
|
|
20881
20968
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
20882
20969
|
worldBounds.min.set(0, 0, 0);
|
|
@@ -20885,7 +20972,9 @@ var TiledType;
|
|
|
20885
20972
|
this._assembler.updatePositions(this);
|
|
20886
20973
|
}
|
|
20887
20974
|
};
|
|
20888
|
-
|
|
20975
|
+
/**
|
|
20976
|
+
* @internal
|
|
20977
|
+
*/ _proto._render = function _render(context) {
|
|
20889
20978
|
var _this_sprite;
|
|
20890
20979
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
20891
20980
|
return;
|
|
@@ -21293,7 +21382,9 @@ var /**
|
|
|
21293
21382
|
this._font._addReferCount(1);
|
|
21294
21383
|
this.setMaterial(engine._spriteDefaultMaterial);
|
|
21295
21384
|
};
|
|
21296
|
-
|
|
21385
|
+
/**
|
|
21386
|
+
* @internal
|
|
21387
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
21297
21388
|
Renderer.prototype._onDestroy.call(this);
|
|
21298
21389
|
// Clear render data.
|
|
21299
21390
|
var charRenderDatas = this._charRenderDatas;
|
|
@@ -21328,14 +21419,20 @@ var /**
|
|
|
21328
21419
|
*/ _proto._setDirtyFlagFalse = function _setDirtyFlagFalse(type) {
|
|
21329
21420
|
this._dirtyFlag &= ~type;
|
|
21330
21421
|
};
|
|
21331
|
-
|
|
21422
|
+
/**
|
|
21423
|
+
* @internal
|
|
21424
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
21332
21425
|
// @ts-ignore
|
|
21333
21426
|
this._updateTransformShaderData(context, miniprogram$7.Matrix._identity);
|
|
21334
21427
|
};
|
|
21335
|
-
|
|
21428
|
+
/**
|
|
21429
|
+
* @internal
|
|
21430
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
21336
21431
|
miniprogram$7.BoundingBox.transform(this._localBounds, this._entity.transform.worldMatrix, worldBounds);
|
|
21337
21432
|
};
|
|
21338
|
-
|
|
21433
|
+
/**
|
|
21434
|
+
* @internal
|
|
21435
|
+
*/ _proto._render = function _render(context) {
|
|
21339
21436
|
if (this._text === "" || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0) {
|
|
21340
21437
|
return;
|
|
21341
21438
|
}
|
|
@@ -21518,7 +21615,9 @@ var /**
|
|
|
21518
21615
|
return a.texture.instanceId - b.texture.instanceId;
|
|
21519
21616
|
});
|
|
21520
21617
|
};
|
|
21521
|
-
|
|
21618
|
+
/**
|
|
21619
|
+
* @internal
|
|
21620
|
+
*/ _proto._onTransformChanged = function _onTransformChanged(bit) {
|
|
21522
21621
|
Renderer.prototype._onTransformChanged.call(this, bit);
|
|
21523
21622
|
this._setDirtyFlagTrue(0x4 | 0x8);
|
|
21524
21623
|
};
|
|
@@ -25241,7 +25340,9 @@ var _tempVector3 = new miniprogram$7.Vector3();
|
|
|
25241
25340
|
this.getMaterial().shaderData.setTexture("u_texture", texture);
|
|
25242
25341
|
}
|
|
25243
25342
|
};
|
|
25244
|
-
|
|
25343
|
+
/**
|
|
25344
|
+
* @internal
|
|
25345
|
+
*/ _proto._render = function _render(context) {
|
|
25245
25346
|
this._updateStrapVertices(context.camera, this._points);
|
|
25246
25347
|
this._updateStrapCoords();
|
|
25247
25348
|
this._vertexBuffer.setData(this._vertices);
|
|
@@ -25432,7 +25533,7 @@ var cacheDir = new miniprogram$7.Vector3();
|
|
|
25432
25533
|
/**
|
|
25433
25534
|
* The position of the probe can be set, the default is the origin [0,0,0].
|
|
25434
25535
|
*/ _this.position = new miniprogram$7.Vector3(0, 0, 0);
|
|
25435
|
-
_this._isCube = true;
|
|
25536
|
+
/** @internal */ _this._isCube = true;
|
|
25436
25537
|
_this.oriViewMatrix = new miniprogram$7.Matrix();
|
|
25437
25538
|
return _this;
|
|
25438
25539
|
};
|
|
@@ -27983,7 +28084,9 @@ var GLTFValidator = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
27983
28084
|
};
|
|
27984
28085
|
_inherits$1(GLTFResource, EngineObject);
|
|
27985
28086
|
var _proto = GLTFResource.prototype;
|
|
27986
|
-
|
|
28087
|
+
/**
|
|
28088
|
+
* @internal
|
|
28089
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
27987
28090
|
EngineObject.prototype._onDestroy.call(this);
|
|
27988
28091
|
this.defaultSceneRoot.destroy();
|
|
27989
28092
|
this.textures = null;
|
|
@@ -30287,6 +30390,21 @@ var KHR_materials_clearcoat = /*#__PURE__*/ function(GLTFExtensionParser) {
|
|
|
30287
30390
|
KHR_materials_clearcoat = __decorate([
|
|
30288
30391
|
registerGLTFExtension("KHR_materials_clearcoat", exports.GLTFExtensionMode.AdditiveParse)
|
|
30289
30392
|
], KHR_materials_clearcoat);
|
|
30393
|
+
var KHR_materials_ior = /*#__PURE__*/ function(GLTFExtensionParser) {
|
|
30394
|
+
var KHR_materials_ior = function KHR_materials_ior() {
|
|
30395
|
+
return GLTFExtensionParser.apply(this, arguments);
|
|
30396
|
+
};
|
|
30397
|
+
_inherits$1(KHR_materials_ior, GLTFExtensionParser);
|
|
30398
|
+
var _proto = KHR_materials_ior.prototype;
|
|
30399
|
+
_proto.additiveParse = function additiveParse(context, material, schema) {
|
|
30400
|
+
var _schema_ior = schema.ior, ior = _schema_ior === void 0 ? 1.5 : _schema_ior;
|
|
30401
|
+
material.ior = ior;
|
|
30402
|
+
};
|
|
30403
|
+
return KHR_materials_ior;
|
|
30404
|
+
}(GLTFExtensionParser);
|
|
30405
|
+
KHR_materials_ior = __decorate([
|
|
30406
|
+
registerGLTFExtension("KHR_materials_ior", exports.GLTFExtensionMode.AdditiveParse)
|
|
30407
|
+
], KHR_materials_ior);
|
|
30290
30408
|
var KHR_materials_pbrSpecularGlossiness = /*#__PURE__*/ function(GLTFExtensionParser) {
|
|
30291
30409
|
var KHR_materials_pbrSpecularGlossiness = function KHR_materials_pbrSpecularGlossiness() {
|
|
30292
30410
|
return GLTFExtensionParser.apply(this, arguments);
|
|
@@ -35522,6 +35640,7 @@ function _inherits(subClass, superClass) {
|
|
|
35522
35640
|
var webCanvas = new WebCanvas(typeof canvas === "string" ? engineMiniprogramAdapter.document.getElementById(canvas) : canvas);
|
|
35523
35641
|
var webGLGraphicDevice = new WebGLGraphicDevice(configuration.graphicDeviceOptions);
|
|
35524
35642
|
var engine = new WebGLEngine(webCanvas, webGLGraphicDevice, configuration);
|
|
35643
|
+
// @ts-ignore
|
|
35525
35644
|
return engine._initialize(configuration);
|
|
35526
35645
|
};
|
|
35527
35646
|
_create_class(WebGLEngine, [
|
|
@@ -35530,6 +35649,7 @@ function _inherits(subClass, superClass) {
|
|
|
35530
35649
|
get: /**
|
|
35531
35650
|
* Web canvas.
|
|
35532
35651
|
*/ function get() {
|
|
35652
|
+
// @ts-ignore
|
|
35533
35653
|
return this._canvas;
|
|
35534
35654
|
}
|
|
35535
35655
|
}
|
|
@@ -37198,23 +37318,23 @@ exports.WebGLMode = void 0;
|
|
|
37198
37318
|
};
|
|
37199
37319
|
_proto.activeRenderTarget = function activeRenderTarget(renderTarget, viewport, mipLevel) {
|
|
37200
37320
|
var gl = this._gl;
|
|
37321
|
+
var bufferWidth, bufferHeight;
|
|
37201
37322
|
if (renderTarget) {
|
|
37202
37323
|
var /** @ts-ignore */ _renderTarget__platformRenderTarget;
|
|
37203
37324
|
(_renderTarget__platformRenderTarget = renderTarget._platformRenderTarget) == null ? void 0 : _renderTarget__platformRenderTarget._activeRenderTarget();
|
|
37204
|
-
|
|
37205
|
-
|
|
37206
|
-
this.viewport(0, 0, width, height);
|
|
37207
|
-
this.scissor(0, 0, width, height);
|
|
37325
|
+
bufferWidth = renderTarget.width >> mipLevel;
|
|
37326
|
+
bufferHeight = renderTarget.height >> mipLevel;
|
|
37208
37327
|
} else {
|
|
37209
37328
|
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
37210
|
-
|
|
37211
|
-
|
|
37212
|
-
var height1 = drawingBufferHeight * viewport.w;
|
|
37213
|
-
var x = viewport.x * drawingBufferWidth;
|
|
37214
|
-
var y = drawingBufferHeight - viewport.y * drawingBufferHeight - height1;
|
|
37215
|
-
this.viewport(x, y, width1, height1);
|
|
37216
|
-
this.scissor(x, y, width1, height1);
|
|
37329
|
+
bufferWidth = gl.drawingBufferWidth;
|
|
37330
|
+
bufferHeight = gl.drawingBufferHeight;
|
|
37217
37331
|
}
|
|
37332
|
+
var width = bufferWidth * viewport.z;
|
|
37333
|
+
var height = bufferHeight * viewport.w;
|
|
37334
|
+
var x = viewport.x * bufferWidth;
|
|
37335
|
+
var y = bufferHeight - viewport.y * bufferHeight - height;
|
|
37336
|
+
this.viewport(x, y, width, height);
|
|
37337
|
+
this.scissor(x, y, width, height);
|
|
37218
37338
|
};
|
|
37219
37339
|
_proto.activeTexture = function activeTexture(textureID) {
|
|
37220
37340
|
if (this._activeTextureID !== textureID) {
|
|
@@ -37379,7 +37499,7 @@ function _interopNamespace(e) {
|
|
|
37379
37499
|
}
|
|
37380
37500
|
var CoreObjects__namespace = /*#__PURE__*/ _interopNamespace(CoreObjects);
|
|
37381
37501
|
//@ts-ignore
|
|
37382
|
-
var version = "1.0.0-beta.
|
|
37502
|
+
var version = "1.0.0-beta.4";
|
|
37383
37503
|
console.log("Galacean engine version: " + version);
|
|
37384
37504
|
for(var key in CoreObjects__namespace){
|
|
37385
37505
|
CoreObjects.Loader.registerClass(key, CoreObjects__namespace[key]);
|