@galacean/engine-physics-physx 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
|
@@ -726,7 +726,9 @@ __decorate$1([
|
|
|
726
726
|
*/ _proto._addToResourceManager = function _addToResourceManager(path) {
|
|
727
727
|
this._engine.resourceManager._addAsset(path, this);
|
|
728
728
|
};
|
|
729
|
-
|
|
729
|
+
/**
|
|
730
|
+
* @internal
|
|
731
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
730
732
|
EngineObject.prototype._onDestroy.call(this);
|
|
731
733
|
this._engine.resourceManager._deleteReferResource(this);
|
|
732
734
|
var refCount = this._getReferCount();
|
|
@@ -850,7 +852,9 @@ var GraphicsResource = /*#__PURE__*/ function(ReferResource) {
|
|
|
850
852
|
};
|
|
851
853
|
_inherits$2(GraphicsResource, ReferResource);
|
|
852
854
|
var _proto = GraphicsResource.prototype;
|
|
853
|
-
|
|
855
|
+
/**
|
|
856
|
+
* @internal
|
|
857
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
854
858
|
ReferResource.prototype._onDestroy.call(this);
|
|
855
859
|
this.engine.resourceManager._deleteGraphicResource(this);
|
|
856
860
|
};
|
|
@@ -927,7 +931,9 @@ var Logger = {
|
|
|
927
931
|
platformTexture.depthCompareFunction = this._depthCompareFunction;
|
|
928
932
|
platformTexture.setUseDepthCompareMode(this._useDepthCompareMode);
|
|
929
933
|
};
|
|
930
|
-
|
|
934
|
+
/**
|
|
935
|
+
* @internal
|
|
936
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
931
937
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
932
938
|
this._platformTexture.destroy();
|
|
933
939
|
this._platformTexture = null;
|
|
@@ -1114,7 +1120,9 @@ var Logger = {
|
|
|
1114
1120
|
this._depthTexture && this._depthTexture.generateMipmaps();
|
|
1115
1121
|
}
|
|
1116
1122
|
};
|
|
1117
|
-
|
|
1123
|
+
/**
|
|
1124
|
+
* @internal
|
|
1125
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
1118
1126
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
1119
1127
|
this._platformRenderTarget.destroy();
|
|
1120
1128
|
this._colorTextures.length = 0;
|
|
@@ -1488,7 +1496,9 @@ var Logger = {
|
|
|
1488
1496
|
_proto.getCharInfo = function getCharInfo(char) {
|
|
1489
1497
|
return this._charInfoMap[char.charCodeAt(0)];
|
|
1490
1498
|
};
|
|
1491
|
-
|
|
1499
|
+
/**
|
|
1500
|
+
* @internal
|
|
1501
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
1492
1502
|
ReferResource.prototype._onDestroy.call(this);
|
|
1493
1503
|
this.texture.destroy();
|
|
1494
1504
|
this.texture = null;
|
|
@@ -2046,7 +2056,9 @@ var Logger = {
|
|
|
2046
2056
|
subFontMap[key] = subFont;
|
|
2047
2057
|
return subFont;
|
|
2048
2058
|
};
|
|
2049
|
-
|
|
2059
|
+
/**
|
|
2060
|
+
* @internal
|
|
2061
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
2050
2062
|
ReferResource.prototype._onDestroy.call(this);
|
|
2051
2063
|
var subFontMap = this._subFontMap;
|
|
2052
2064
|
for(var k in subFontMap){
|
|
@@ -3253,7 +3265,9 @@ exports.GLCapabilityType = void 0;
|
|
|
3253
3265
|
}
|
|
3254
3266
|
}
|
|
3255
3267
|
};
|
|
3256
|
-
|
|
3268
|
+
/**
|
|
3269
|
+
* @internal
|
|
3270
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
3257
3271
|
EngineObject.prototype._onDestroy.call(this);
|
|
3258
3272
|
this._entity._removeComponent(this);
|
|
3259
3273
|
if (this._entity.isActiveInHierarchy) {
|
|
@@ -6002,7 +6016,9 @@ exports.Collider = /*#__PURE__*/ function(Component) {
|
|
|
6002
6016
|
*/ _proto._onDisable = function _onDisable() {
|
|
6003
6017
|
this.engine.physicsManager._removeCollider(this);
|
|
6004
6018
|
};
|
|
6005
|
-
|
|
6019
|
+
/**
|
|
6020
|
+
* @internal
|
|
6021
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
6006
6022
|
Component.prototype._onDestroy.call(this);
|
|
6007
6023
|
this.clearShapes();
|
|
6008
6024
|
this._nativeCollider.destroy();
|
|
@@ -7826,7 +7842,9 @@ exports.DynamicColliderConstraints = void 0;
|
|
|
7826
7842
|
};
|
|
7827
7843
|
_inherits$2(Light, Component);
|
|
7828
7844
|
var _proto = Light.prototype;
|
|
7829
|
-
|
|
7845
|
+
/**
|
|
7846
|
+
* @internal
|
|
7847
|
+
*/ _proto._getLightColor = function _getLightColor() {
|
|
7830
7848
|
this._lightColor.r = this.color.r * this.intensity;
|
|
7831
7849
|
this._lightColor.g = this.color.g * this.intensity;
|
|
7832
7850
|
this._lightColor.b = this.color.b * this.intensity;
|
|
@@ -9468,8 +9486,8 @@ var noise_simplex_2D = "#define GLSLIFY 1\nfloat simplex(vec2 v){const vec4 C=ve
|
|
|
9468
9486
|
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
|
|
9469
9487
|
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
|
|
9470
9488
|
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
|
|
9471
|
-
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
|
|
9472
|
-
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
|
|
9489
|
+
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
|
|
9490
|
+
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
|
|
9473
9491
|
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
|
|
9474
9492
|
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
|
|
9475
9493
|
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
|
|
@@ -10641,14 +10659,18 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10641
10659
|
(_materials_i = materials[i]) == null ? void 0 : _materials_i._addReferCount(-1);
|
|
10642
10660
|
}
|
|
10643
10661
|
};
|
|
10644
|
-
|
|
10662
|
+
/**
|
|
10663
|
+
* @internal
|
|
10664
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
10645
10665
|
var entity = this.entity;
|
|
10646
10666
|
var worldMatrix = entity.transform.worldMatrix;
|
|
10647
10667
|
this._updateTransformShaderData(context, worldMatrix);
|
|
10648
10668
|
var layer = entity.layer;
|
|
10649
10669
|
this._rendererLayer.set(layer & 65535, layer >>> 16 & 65535, 0, 0);
|
|
10650
10670
|
};
|
|
10651
|
-
|
|
10671
|
+
/**
|
|
10672
|
+
* @internal
|
|
10673
|
+
*/ _proto._updateTransformShaderData = function _updateTransformShaderData(context, worldMatrix) {
|
|
10652
10674
|
var shaderData = this.shaderData;
|
|
10653
10675
|
var virtualCamera = context.virtualCamera;
|
|
10654
10676
|
var mvMatrix = this._mvMatrix;
|
|
@@ -10667,14 +10689,22 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10667
10689
|
shaderData.setMatrix(exports.Renderer._mvInvMatrixProperty, mvInvMatrix);
|
|
10668
10690
|
shaderData.setMatrix(exports.Renderer._normalMatrixProperty, normalMatrix);
|
|
10669
10691
|
};
|
|
10670
|
-
|
|
10692
|
+
/**
|
|
10693
|
+
* @internal
|
|
10694
|
+
*/ _proto._registerEntityTransformListener = function _registerEntityTransformListener() {
|
|
10671
10695
|
this.entity.transform._updateFlagManager.addListener(this._onTransformChanged);
|
|
10672
10696
|
};
|
|
10673
|
-
|
|
10674
|
-
|
|
10697
|
+
/**
|
|
10698
|
+
* @internal
|
|
10699
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {};
|
|
10700
|
+
/**
|
|
10701
|
+
* @internal
|
|
10702
|
+
*/ _proto._render = function _render(context) {
|
|
10675
10703
|
throw "not implement";
|
|
10676
10704
|
};
|
|
10677
|
-
|
|
10705
|
+
/**
|
|
10706
|
+
* @internal
|
|
10707
|
+
*/ _proto._createInstanceMaterial = function _createInstanceMaterial(material, index) {
|
|
10678
10708
|
var insMaterial = material.clone();
|
|
10679
10709
|
insMaterial.name = insMaterial.name + "(Instance)";
|
|
10680
10710
|
material._addReferCount(-1);
|
|
@@ -10697,7 +10727,9 @@ exports.Renderer = (_Renderer = /*#__PURE__*/ function(Component) {
|
|
|
10697
10727
|
materials[index] = material;
|
|
10698
10728
|
}
|
|
10699
10729
|
};
|
|
10700
|
-
|
|
10730
|
+
/**
|
|
10731
|
+
* @internal
|
|
10732
|
+
*/ _proto._onTransformChanged = function _onTransformChanged(type) {
|
|
10701
10733
|
this._dirtyUpdateFlag |= 0x1;
|
|
10702
10734
|
};
|
|
10703
10735
|
_create_class$2(Renderer1, [
|
|
@@ -11015,7 +11047,9 @@ SimpleSpriteAssembler = __decorate$1([
|
|
|
11015
11047
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
11016
11048
|
target.sprite = this._sprite;
|
|
11017
11049
|
};
|
|
11018
|
-
|
|
11050
|
+
/**
|
|
11051
|
+
* @internal
|
|
11052
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
11019
11053
|
var _this_sprite;
|
|
11020
11054
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
11021
11055
|
worldBounds.min.set(0, 0, 0);
|
|
@@ -11025,6 +11059,7 @@ SimpleSpriteAssembler = __decorate$1([
|
|
|
11025
11059
|
}
|
|
11026
11060
|
};
|
|
11027
11061
|
/**
|
|
11062
|
+
* @internal
|
|
11028
11063
|
* @inheritdoc
|
|
11029
11064
|
*/ _proto._render = function _render(context) {
|
|
11030
11065
|
var _this_sprite;
|
|
@@ -11050,6 +11085,7 @@ SimpleSpriteAssembler = __decorate$1([
|
|
|
11050
11085
|
this._maskElement = renderElement;
|
|
11051
11086
|
};
|
|
11052
11087
|
/**
|
|
11088
|
+
* @internal
|
|
11053
11089
|
* @inheritdoc
|
|
11054
11090
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
11055
11091
|
var _this__sprite;
|
|
@@ -11467,7 +11503,9 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11467
11503
|
var platformBuffer = this._engine._hardwareRenderer.createPlatformBuffer(this._type, this._byteLength, this._bufferUsage);
|
|
11468
11504
|
this._platformBuffer = platformBuffer;
|
|
11469
11505
|
};
|
|
11470
|
-
|
|
11506
|
+
/**
|
|
11507
|
+
* @internal
|
|
11508
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
11471
11509
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
11472
11510
|
this._platformBuffer.destroy();
|
|
11473
11511
|
};
|
|
@@ -11675,13 +11713,17 @@ var BufferUtil = /*#__PURE__*/ function() {
|
|
|
11675
11713
|
this._vertexElementMap = null;
|
|
11676
11714
|
this._platformPrimitive.destroy();
|
|
11677
11715
|
};
|
|
11678
|
-
|
|
11716
|
+
/**
|
|
11717
|
+
* @internal
|
|
11718
|
+
*/ _proto._setVertexElements = function _setVertexElements(elements) {
|
|
11679
11719
|
this._clearVertexElements();
|
|
11680
11720
|
for(var i = 0, n = elements.length; i < n; i++){
|
|
11681
11721
|
this._addVertexElement(elements[i]);
|
|
11682
11722
|
}
|
|
11683
11723
|
};
|
|
11684
|
-
|
|
11724
|
+
/**
|
|
11725
|
+
* @internal
|
|
11726
|
+
*/ _proto._setIndexBufferBinding = function _setIndexBufferBinding(binding) {
|
|
11685
11727
|
var lastBinding = this._indexBufferBinding;
|
|
11686
11728
|
if (binding) {
|
|
11687
11729
|
this._indexBufferBinding = binding;
|
|
@@ -12815,7 +12857,9 @@ var MeshModifyFlags;
|
|
|
12815
12857
|
}
|
|
12816
12858
|
this.setTangents(tangents);
|
|
12817
12859
|
};
|
|
12818
|
-
|
|
12860
|
+
/**
|
|
12861
|
+
* @internal
|
|
12862
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
12819
12863
|
Mesh.prototype._onDestroy.call(this);
|
|
12820
12864
|
this._readable && this._releaseCache();
|
|
12821
12865
|
};
|
|
@@ -13288,7 +13332,9 @@ var VertexChangedFlags;
|
|
|
13288
13332
|
};
|
|
13289
13333
|
_inherits$2(MeshRenderer, Renderer);
|
|
13290
13334
|
var _proto = MeshRenderer.prototype;
|
|
13291
|
-
|
|
13335
|
+
/**
|
|
13336
|
+
* @internal
|
|
13337
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
13292
13338
|
Renderer.prototype._onDestroy.call(this);
|
|
13293
13339
|
var mesh = this._mesh;
|
|
13294
13340
|
if (mesh && !mesh.destroyed) {
|
|
@@ -13301,7 +13347,9 @@ var VertexChangedFlags;
|
|
|
13301
13347
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
13302
13348
|
target.mesh = this._mesh;
|
|
13303
13349
|
};
|
|
13304
|
-
|
|
13350
|
+
/**
|
|
13351
|
+
* @internal
|
|
13352
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
13305
13353
|
var mesh = this._mesh;
|
|
13306
13354
|
if (mesh) {
|
|
13307
13355
|
var localBounds = mesh.bounds;
|
|
@@ -13312,7 +13360,9 @@ var VertexChangedFlags;
|
|
|
13312
13360
|
worldBounds.max.set(0, 0, 0);
|
|
13313
13361
|
}
|
|
13314
13362
|
};
|
|
13315
|
-
|
|
13363
|
+
/**
|
|
13364
|
+
* @internal
|
|
13365
|
+
*/ _proto._render = function _render(context) {
|
|
13316
13366
|
var mesh = this._mesh;
|
|
13317
13367
|
if (mesh) {
|
|
13318
13368
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
@@ -13472,7 +13522,9 @@ var /**
|
|
|
13472
13522
|
}
|
|
13473
13523
|
}
|
|
13474
13524
|
};
|
|
13475
|
-
|
|
13525
|
+
/**
|
|
13526
|
+
* @internal
|
|
13527
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
13476
13528
|
var entity = this.entity;
|
|
13477
13529
|
var worldMatrix = this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
|
|
13478
13530
|
this._updateTransformShaderData(context, worldMatrix);
|
|
@@ -13527,10 +13579,14 @@ var /**
|
|
|
13527
13579
|
MeshRenderer.prototype._cloneTo.call(this, target);
|
|
13528
13580
|
this._blendShapeWeights && (target._blendShapeWeights = this._blendShapeWeights.slice());
|
|
13529
13581
|
};
|
|
13530
|
-
|
|
13582
|
+
/**
|
|
13583
|
+
* @internal
|
|
13584
|
+
*/ _proto._registerEntityTransformListener = function _registerEntityTransformListener() {
|
|
13531
13585
|
// Cancel register listener to entity transform.
|
|
13532
13586
|
};
|
|
13533
|
-
|
|
13587
|
+
/**
|
|
13588
|
+
* @internal
|
|
13589
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
13534
13590
|
if (this._rootBone) {
|
|
13535
13591
|
var localBounds = this._localBounds;
|
|
13536
13592
|
var worldMatrix = this._rootBone.transform.worldMatrix;
|
|
@@ -16576,7 +16632,9 @@ ShaderPool.init();
|
|
|
16576
16632
|
this._magentaTexture2DArray = magentaTexture2DArray;
|
|
16577
16633
|
}
|
|
16578
16634
|
};
|
|
16579
|
-
|
|
16635
|
+
/**
|
|
16636
|
+
* @internal
|
|
16637
|
+
*/ _proto._initialize = function _initialize(configuration) {
|
|
16580
16638
|
var _this = this;
|
|
16581
16639
|
var physics = configuration.physics;
|
|
16582
16640
|
if (physics) {
|
|
@@ -16897,7 +16955,9 @@ ShaderPool.init();
|
|
|
16897
16955
|
this._entity._removeScript(this);
|
|
16898
16956
|
this._waitHandlingInValid = false;
|
|
16899
16957
|
};
|
|
16900
|
-
|
|
16958
|
+
/**
|
|
16959
|
+
* @internal
|
|
16960
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
16901
16961
|
Component.prototype._onDestroy.call(this);
|
|
16902
16962
|
this._engine._componentsManager.addPendingDestroyScript(this);
|
|
16903
16963
|
};
|
|
@@ -18570,6 +18630,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component) {
|
|
|
18570
18630
|
this.entity.scene._detachRenderCamera(this);
|
|
18571
18631
|
};
|
|
18572
18632
|
/**
|
|
18633
|
+
* @internal
|
|
18573
18634
|
* @inheritdoc
|
|
18574
18635
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
18575
18636
|
var _this__renderPipeline;
|
|
@@ -19754,6 +19815,7 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19754
19815
|
_this = PBRBaseMaterial.call(this, engine, Shader.find("pbr")) || this;
|
|
19755
19816
|
_this.shaderData.setFloat(PBRMaterial._metallicProp, 1);
|
|
19756
19817
|
_this.shaderData.setFloat(PBRMaterial._roughnessProp, 1);
|
|
19818
|
+
_this.shaderData.setFloat(PBRMaterial._iorProp, 1.5);
|
|
19757
19819
|
return _this;
|
|
19758
19820
|
}
|
|
19759
19821
|
var _proto = PBRMaterial.prototype;
|
|
@@ -19765,10 +19827,23 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19765
19827
|
return dest;
|
|
19766
19828
|
};
|
|
19767
19829
|
_create_class$2(PBRMaterial, [
|
|
19830
|
+
{
|
|
19831
|
+
key: "ior",
|
|
19832
|
+
get: /**
|
|
19833
|
+
* Index Of Refraction.
|
|
19834
|
+
* @defaultValue `1.5`
|
|
19835
|
+
*/ function get() {
|
|
19836
|
+
return this.shaderData.getFloat(PBRMaterial._iorProp);
|
|
19837
|
+
},
|
|
19838
|
+
set: function set(v) {
|
|
19839
|
+
this.shaderData.setFloat(PBRMaterial._iorProp, Math.max(v, 0));
|
|
19840
|
+
}
|
|
19841
|
+
},
|
|
19768
19842
|
{
|
|
19769
19843
|
key: "metallic",
|
|
19770
19844
|
get: /**
|
|
19771
|
-
* Metallic
|
|
19845
|
+
* Metallic.
|
|
19846
|
+
* @defaultValue `1.0`
|
|
19772
19847
|
*/ function get() {
|
|
19773
19848
|
return this.shaderData.getFloat(PBRMaterial._metallicProp);
|
|
19774
19849
|
},
|
|
@@ -19779,7 +19854,8 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19779
19854
|
{
|
|
19780
19855
|
key: "roughness",
|
|
19781
19856
|
get: /**
|
|
19782
|
-
* Roughness
|
|
19857
|
+
* Roughness. default 1.0.
|
|
19858
|
+
* @defaultValue `1.0`
|
|
19783
19859
|
*/ function get() {
|
|
19784
19860
|
return this.shaderData.getFloat(PBRMaterial._roughnessProp);
|
|
19785
19861
|
},
|
|
@@ -19816,6 +19892,9 @@ var BaseMaterial = /*#__PURE__*/ function(Material) {
|
|
|
19816
19892
|
(function() {
|
|
19817
19893
|
PBRMaterial._roughnessMetallicTextureProp = ShaderProperty.getByName("material_RoughnessMetallicTexture");
|
|
19818
19894
|
})();
|
|
19895
|
+
(function() {
|
|
19896
|
+
PBRMaterial._iorProp = Shader.getPropertyByName("material_IOR");
|
|
19897
|
+
})();
|
|
19819
19898
|
/**
|
|
19820
19899
|
* PBR (Specular-Glossiness Workflow) Material.
|
|
19821
19900
|
*/ var PBRSpecularMaterial = /*#__PURE__*/ function(PBRBaseMaterial) {
|
|
@@ -20024,7 +20103,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20024
20103
|
*/ _proto._addSprite = function _addSprite(sprite) {
|
|
20025
20104
|
this._spriteNamesToIndex[sprite.name] = this._sprites.push(sprite) - 1;
|
|
20026
20105
|
};
|
|
20027
|
-
|
|
20106
|
+
/**
|
|
20107
|
+
* @internal
|
|
20108
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
20028
20109
|
ReferResource.prototype._onDestroy.call(this);
|
|
20029
20110
|
this._sprites = null;
|
|
20030
20111
|
this._spriteNamesToIndex = null;
|
|
@@ -20130,7 +20211,9 @@ exports.TextVerticalAlignment = void 0;
|
|
|
20130
20211
|
this._dirtyUpdateFlag & 0x1 && this._updatePositions();
|
|
20131
20212
|
return this._bounds;
|
|
20132
20213
|
};
|
|
20133
|
-
|
|
20214
|
+
/**
|
|
20215
|
+
* @internal
|
|
20216
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
20134
20217
|
ReferResource.prototype._onDestroy.call(this);
|
|
20135
20218
|
this._texture = null;
|
|
20136
20219
|
};
|
|
@@ -20865,11 +20948,15 @@ var TiledType;
|
|
|
20865
20948
|
target._assembler.resetData(target);
|
|
20866
20949
|
target.sprite = this._sprite;
|
|
20867
20950
|
};
|
|
20868
|
-
|
|
20951
|
+
/**
|
|
20952
|
+
* @internal
|
|
20953
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
20869
20954
|
// @ts-ignore
|
|
20870
20955
|
this._updateTransformShaderData(context, miniprogram$7.Matrix._identity);
|
|
20871
20956
|
};
|
|
20872
|
-
|
|
20957
|
+
/**
|
|
20958
|
+
* @internal
|
|
20959
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
20873
20960
|
var _this_sprite;
|
|
20874
20961
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
20875
20962
|
worldBounds.min.set(0, 0, 0);
|
|
@@ -20878,7 +20965,9 @@ var TiledType;
|
|
|
20878
20965
|
this._assembler.updatePositions(this);
|
|
20879
20966
|
}
|
|
20880
20967
|
};
|
|
20881
|
-
|
|
20968
|
+
/**
|
|
20969
|
+
* @internal
|
|
20970
|
+
*/ _proto._render = function _render(context) {
|
|
20882
20971
|
var _this_sprite;
|
|
20883
20972
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
20884
20973
|
return;
|
|
@@ -21286,7 +21375,9 @@ var /**
|
|
|
21286
21375
|
this._font._addReferCount(1);
|
|
21287
21376
|
this.setMaterial(engine._spriteDefaultMaterial);
|
|
21288
21377
|
};
|
|
21289
|
-
|
|
21378
|
+
/**
|
|
21379
|
+
* @internal
|
|
21380
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
21290
21381
|
Renderer.prototype._onDestroy.call(this);
|
|
21291
21382
|
// Clear render data.
|
|
21292
21383
|
var charRenderDatas = this._charRenderDatas;
|
|
@@ -21321,14 +21412,20 @@ var /**
|
|
|
21321
21412
|
*/ _proto._setDirtyFlagFalse = function _setDirtyFlagFalse(type) {
|
|
21322
21413
|
this._dirtyFlag &= ~type;
|
|
21323
21414
|
};
|
|
21324
|
-
|
|
21415
|
+
/**
|
|
21416
|
+
* @internal
|
|
21417
|
+
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
21325
21418
|
// @ts-ignore
|
|
21326
21419
|
this._updateTransformShaderData(context, miniprogram$7.Matrix._identity);
|
|
21327
21420
|
};
|
|
21328
|
-
|
|
21421
|
+
/**
|
|
21422
|
+
* @internal
|
|
21423
|
+
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
21329
21424
|
miniprogram$7.BoundingBox.transform(this._localBounds, this._entity.transform.worldMatrix, worldBounds);
|
|
21330
21425
|
};
|
|
21331
|
-
|
|
21426
|
+
/**
|
|
21427
|
+
* @internal
|
|
21428
|
+
*/ _proto._render = function _render(context) {
|
|
21332
21429
|
if (this._text === "" || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0) {
|
|
21333
21430
|
return;
|
|
21334
21431
|
}
|
|
@@ -21511,7 +21608,9 @@ var /**
|
|
|
21511
21608
|
return a.texture.instanceId - b.texture.instanceId;
|
|
21512
21609
|
});
|
|
21513
21610
|
};
|
|
21514
|
-
|
|
21611
|
+
/**
|
|
21612
|
+
* @internal
|
|
21613
|
+
*/ _proto._onTransformChanged = function _onTransformChanged(bit) {
|
|
21515
21614
|
Renderer.prototype._onTransformChanged.call(this, bit);
|
|
21516
21615
|
this._setDirtyFlagTrue(0x4 | 0x8);
|
|
21517
21616
|
};
|
|
@@ -25234,7 +25333,9 @@ var _tempVector3 = new miniprogram$7.Vector3();
|
|
|
25234
25333
|
this.getMaterial().shaderData.setTexture("u_texture", texture);
|
|
25235
25334
|
}
|
|
25236
25335
|
};
|
|
25237
|
-
|
|
25336
|
+
/**
|
|
25337
|
+
* @internal
|
|
25338
|
+
*/ _proto._render = function _render(context) {
|
|
25238
25339
|
this._updateStrapVertices(context.camera, this._points);
|
|
25239
25340
|
this._updateStrapCoords();
|
|
25240
25341
|
this._vertexBuffer.setData(this._vertices);
|
|
@@ -25425,7 +25526,7 @@ var cacheDir = new miniprogram$7.Vector3();
|
|
|
25425
25526
|
/**
|
|
25426
25527
|
* The position of the probe can be set, the default is the origin [0,0,0].
|
|
25427
25528
|
*/ _this.position = new miniprogram$7.Vector3(0, 0, 0);
|
|
25428
|
-
_this._isCube = true;
|
|
25529
|
+
/** @internal */ _this._isCube = true;
|
|
25429
25530
|
_this.oriViewMatrix = new miniprogram$7.Matrix();
|
|
25430
25531
|
return _this;
|
|
25431
25532
|
};
|
|
@@ -27976,7 +28077,9 @@ var GLTFValidator = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
27976
28077
|
};
|
|
27977
28078
|
_inherits$1(GLTFResource, EngineObject);
|
|
27978
28079
|
var _proto = GLTFResource.prototype;
|
|
27979
|
-
|
|
28080
|
+
/**
|
|
28081
|
+
* @internal
|
|
28082
|
+
*/ _proto._onDestroy = function _onDestroy() {
|
|
27980
28083
|
EngineObject.prototype._onDestroy.call(this);
|
|
27981
28084
|
this.defaultSceneRoot.destroy();
|
|
27982
28085
|
this.textures = null;
|
|
@@ -30280,6 +30383,21 @@ var KHR_materials_clearcoat = /*#__PURE__*/ function(GLTFExtensionParser) {
|
|
|
30280
30383
|
KHR_materials_clearcoat = __decorate([
|
|
30281
30384
|
registerGLTFExtension("KHR_materials_clearcoat", exports.GLTFExtensionMode.AdditiveParse)
|
|
30282
30385
|
], KHR_materials_clearcoat);
|
|
30386
|
+
var KHR_materials_ior = /*#__PURE__*/ function(GLTFExtensionParser) {
|
|
30387
|
+
var KHR_materials_ior = function KHR_materials_ior() {
|
|
30388
|
+
return GLTFExtensionParser.apply(this, arguments);
|
|
30389
|
+
};
|
|
30390
|
+
_inherits$1(KHR_materials_ior, GLTFExtensionParser);
|
|
30391
|
+
var _proto = KHR_materials_ior.prototype;
|
|
30392
|
+
_proto.additiveParse = function additiveParse(context, material, schema) {
|
|
30393
|
+
var _schema_ior = schema.ior, ior = _schema_ior === void 0 ? 1.5 : _schema_ior;
|
|
30394
|
+
material.ior = ior;
|
|
30395
|
+
};
|
|
30396
|
+
return KHR_materials_ior;
|
|
30397
|
+
}(GLTFExtensionParser);
|
|
30398
|
+
KHR_materials_ior = __decorate([
|
|
30399
|
+
registerGLTFExtension("KHR_materials_ior", exports.GLTFExtensionMode.AdditiveParse)
|
|
30400
|
+
], KHR_materials_ior);
|
|
30283
30401
|
var KHR_materials_pbrSpecularGlossiness = /*#__PURE__*/ function(GLTFExtensionParser) {
|
|
30284
30402
|
var KHR_materials_pbrSpecularGlossiness = function KHR_materials_pbrSpecularGlossiness() {
|
|
30285
30403
|
return GLTFExtensionParser.apply(this, arguments);
|
|
@@ -35515,6 +35633,7 @@ function _inherits(subClass, superClass) {
|
|
|
35515
35633
|
var webCanvas = new WebCanvas(typeof canvas === "string" ? engineMiniprogramAdapter.document.getElementById(canvas) : canvas);
|
|
35516
35634
|
var webGLGraphicDevice = new WebGLGraphicDevice(configuration.graphicDeviceOptions);
|
|
35517
35635
|
var engine = new WebGLEngine(webCanvas, webGLGraphicDevice, configuration);
|
|
35636
|
+
// @ts-ignore
|
|
35518
35637
|
return engine._initialize(configuration);
|
|
35519
35638
|
};
|
|
35520
35639
|
_create_class(WebGLEngine, [
|
|
@@ -35523,6 +35642,7 @@ function _inherits(subClass, superClass) {
|
|
|
35523
35642
|
get: /**
|
|
35524
35643
|
* Web canvas.
|
|
35525
35644
|
*/ function get() {
|
|
35645
|
+
// @ts-ignore
|
|
35526
35646
|
return this._canvas;
|
|
35527
35647
|
}
|
|
35528
35648
|
}
|
|
@@ -37191,23 +37311,23 @@ exports.WebGLMode = void 0;
|
|
|
37191
37311
|
};
|
|
37192
37312
|
_proto.activeRenderTarget = function activeRenderTarget(renderTarget, viewport, mipLevel) {
|
|
37193
37313
|
var gl = this._gl;
|
|
37314
|
+
var bufferWidth, bufferHeight;
|
|
37194
37315
|
if (renderTarget) {
|
|
37195
37316
|
var /** @ts-ignore */ _renderTarget__platformRenderTarget;
|
|
37196
37317
|
(_renderTarget__platformRenderTarget = renderTarget._platformRenderTarget) == null ? void 0 : _renderTarget__platformRenderTarget._activeRenderTarget();
|
|
37197
|
-
|
|
37198
|
-
|
|
37199
|
-
this.viewport(0, 0, width, height);
|
|
37200
|
-
this.scissor(0, 0, width, height);
|
|
37318
|
+
bufferWidth = renderTarget.width >> mipLevel;
|
|
37319
|
+
bufferHeight = renderTarget.height >> mipLevel;
|
|
37201
37320
|
} else {
|
|
37202
37321
|
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
37203
|
-
|
|
37204
|
-
|
|
37205
|
-
var height1 = drawingBufferHeight * viewport.w;
|
|
37206
|
-
var x = viewport.x * drawingBufferWidth;
|
|
37207
|
-
var y = drawingBufferHeight - viewport.y * drawingBufferHeight - height1;
|
|
37208
|
-
this.viewport(x, y, width1, height1);
|
|
37209
|
-
this.scissor(x, y, width1, height1);
|
|
37322
|
+
bufferWidth = gl.drawingBufferWidth;
|
|
37323
|
+
bufferHeight = gl.drawingBufferHeight;
|
|
37210
37324
|
}
|
|
37325
|
+
var width = bufferWidth * viewport.z;
|
|
37326
|
+
var height = bufferHeight * viewport.w;
|
|
37327
|
+
var x = viewport.x * bufferWidth;
|
|
37328
|
+
var y = bufferHeight - viewport.y * bufferHeight - height;
|
|
37329
|
+
this.viewport(x, y, width, height);
|
|
37330
|
+
this.scissor(x, y, width, height);
|
|
37211
37331
|
};
|
|
37212
37332
|
_proto.activeTexture = function activeTexture(textureID) {
|
|
37213
37333
|
if (this._activeTextureID !== textureID) {
|
|
@@ -37372,7 +37492,7 @@ function _interopNamespace(e) {
|
|
|
37372
37492
|
}
|
|
37373
37493
|
var CoreObjects__namespace = /*#__PURE__*/ _interopNamespace(CoreObjects);
|
|
37374
37494
|
//@ts-ignore
|
|
37375
|
-
var version = "1.0.0-beta.
|
|
37495
|
+
var version = "1.0.0-beta.4";
|
|
37376
37496
|
console.log("Galacean engine version: " + version);
|
|
37377
37497
|
for(var key in CoreObjects__namespace){
|
|
37378
37498
|
CoreObjects.Loader.registerClass(key, CoreObjects__namespace[key]);
|