@galacean/engine 1.2.0-alpha.1 → 1.2.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +257 -227
- package/dist/browser.min.js +1 -1
- package/dist/main.js +1 -1
- package/dist/miniprogram.js +1 -1
- package/dist/module.js +1 -1
- package/package.json +5 -5
package/dist/browser.js
CHANGED
|
@@ -5571,7 +5571,14 @@
|
|
|
5571
5571
|
* @param url - The url to be judged.
|
|
5572
5572
|
* @returns Whether the url is absolute url.
|
|
5573
5573
|
*/ Utils.isAbsoluteUrl = function isAbsoluteUrl(url) {
|
|
5574
|
-
return /^(
|
|
5574
|
+
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
|
5575
|
+
};
|
|
5576
|
+
/**
|
|
5577
|
+
* Judge whether the url is base64 url.
|
|
5578
|
+
* @param url - The url to be judged.
|
|
5579
|
+
* @returns Whether the url is base64 url.
|
|
5580
|
+
*/ Utils.isBase64Url = function isBase64Url(url) {
|
|
5581
|
+
return /^data:.*,.*$/i.test(url);
|
|
5575
5582
|
};
|
|
5576
5583
|
/**
|
|
5577
5584
|
* Get the values of an object.
|
|
@@ -5589,7 +5596,10 @@
|
|
|
5589
5596
|
if (Utils.isAbsoluteUrl(relativeUrl)) {
|
|
5590
5597
|
return relativeUrl;
|
|
5591
5598
|
}
|
|
5592
|
-
|
|
5599
|
+
if (Utils.isBase64Url(relativeUrl)) {
|
|
5600
|
+
return relativeUrl;
|
|
5601
|
+
}
|
|
5602
|
+
return relativeUrl ? baseUrl.replace(/\/+$/, "") + "/" + relativeUrl.replace(/^\/+/, "") : baseUrl;
|
|
5593
5603
|
};
|
|
5594
5604
|
/**
|
|
5595
5605
|
* @internal
|
|
@@ -8113,7 +8123,7 @@
|
|
|
8113
8123
|
};
|
|
8114
8124
|
return _extends$2.apply(this, arguments);
|
|
8115
8125
|
}
|
|
8116
|
-
var camera_declare = "#define GLSLIFY 1\nuniform vec3 camera_Position;"; // eslint-disable-line
|
|
8126
|
+
var camera_declare = "#define GLSLIFY 1\nuniform vec3 camera_Position;uniform vec3 camera_Forward;"; // eslint-disable-line
|
|
8117
8127
|
var common = "#define GLSLIFY 1\n#define PI 3.14159265359\n#define RECIPROCAL_PI 0.31830988618\n#define EPSILON 1e-6\n#define LOG2 1.442695\n#define saturate( a ) clamp( a, 0.0, 1.0 )\nfloat pow2(float x){return x*x;}vec4 RGBMToLinear(vec4 value,float maxRange){return vec4(value.rgb*value.a*maxRange,1.0);}vec4 gammaToLinear(vec4 srgbIn){return vec4(pow(srgbIn.rgb,vec3(2.2)),srgbIn.a);}vec4 linearToGamma(vec4 linearIn){return vec4(pow(linearIn.rgb,vec3(1.0/2.2)),linearIn.a);}uniform vec4 camera_DepthBufferParams;float remapDepthBufferLinear01(float z){return 1.0/(camera_DepthBufferParams.x*z+camera_DepthBufferParams.y);}\n#ifdef GRAPHICS_API_WEBGL2\n#define INVERSE_MAT(mat) inverse(mat)\n#else\nmat2 inverseMat(mat2 m){return mat2(m[1][1],-m[0][1],-m[1][0],m[0][0])/(m[0][0]*m[1][1]-m[0][1]*m[1][0]);}mat3 inverseMat(mat3 m){float a00=m[0][0],a01=m[0][1],a02=m[0][2];float a10=m[1][0],a11=m[1][1],a12=m[1][2];float a20=m[2][0],a21=m[2][1],a22=m[2][2];float b01=a22*a11-a12*a21;float b11=-a22*a10+a12*a20;float b21=a21*a10-a11*a20;float det=a00*b01+a01*b11+a02*b21;return mat3(b01,(-a22*a01+a02*a21),(a12*a01-a02*a11),b11,(a22*a00-a02*a20),(-a12*a00+a02*a10),b21,(-a21*a00+a01*a20),(a11*a00-a01*a10))/det;}mat4 inverseMat(mat4 m){float a00=m[0][0],a01=m[0][1],a02=m[0][2],a03=m[0][3],a10=m[1][0],a11=m[1][1],a12=m[1][2],a13=m[1][3],a20=m[2][0],a21=m[2][1],a22=m[2][2],a23=m[2][3],a30=m[3][0],a31=m[3][1],a32=m[3][2],a33=m[3][3],b00=a00*a11-a01*a10,b01=a00*a12-a02*a10,b02=a00*a13-a03*a10,b03=a01*a12-a02*a11,b04=a01*a13-a03*a11,b05=a02*a13-a03*a12,b06=a20*a31-a21*a30,b07=a20*a32-a22*a30,b08=a20*a33-a23*a30,b09=a21*a32-a22*a31,b10=a21*a33-a23*a31,b11=a22*a33-a23*a32,det=b00*b11-b01*b10+b02*b09+b03*b08-b04*b07+b05*b06;return mat4(a11*b11-a12*b10+a13*b09,a02*b10-a01*b11-a03*b09,a31*b05-a32*b04+a33*b03,a22*b04-a21*b05-a23*b03,a12*b08-a10*b11-a13*b07,a00*b11-a02*b08+a03*b07,a32*b02-a30*b05-a33*b01,a20*b05-a22*b02+a23*b01,a10*b10-a11*b08+a13*b06,a01*b08-a00*b10-a03*b06,a30*b04-a31*b02+a33*b00,a21*b02-a20*b04-a23*b00,a11*b07-a10*b09-a12*b06,a00*b09-a01*b07+a02*b06,a31*b01-a30*b03-a32*b00,a20*b03-a21*b01+a22*b00)/det;}\n#define INVERSE_MAT(mat) inverseMat(mat)\n#endif\n"; // eslint-disable-line
|
|
8118
8128
|
var common_vert = "#define GLSLIFY 1\nattribute vec3 POSITION;\n#ifdef RENDERER_HAS_UV\nattribute vec2 TEXCOORD_0;\n#endif\n#ifdef RENDERER_HAS_UV1\nattribute vec2 TEXCOORD_1;\n#endif\n#ifdef RENDERER_HAS_SKIN\nattribute vec4 JOINTS_0;attribute vec4 WEIGHTS_0;\n#ifdef RENDERER_USE_JOINT_TEXTURE\nuniform sampler2D renderer_JointSampler;uniform float renderer_JointCount;mat4 getJointMatrix(sampler2D smp,float index){float base=index/renderer_JointCount;float hf=0.5/renderer_JointCount;float v=base+hf;vec4 m0=texture2D(smp,vec2(0.125,v));vec4 m1=texture2D(smp,vec2(0.375,v));vec4 m2=texture2D(smp,vec2(0.625,v));vec4 m3=texture2D(smp,vec2(0.875,v));return mat4(m0,m1,m2,m3);}\n#else\nuniform mat4 renderer_JointMatrix[RENDERER_JOINTS_NUM];\n#endif\n#endif\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\nattribute vec4 COLOR_0;\n#endif\n#include <transform_declare>\n#include <camera_declare>\nuniform vec4 material_TilingOffset;\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef RENDERER_HAS_NORMAL\nattribute vec3 NORMAL;\n#endif\n#ifdef RENDERER_HAS_TANGENT\nattribute vec4 TANGENT;\n#endif\n#endif\n"; // eslint-disable-line
|
|
8119
8129
|
var transform_declare = "#define GLSLIFY 1\nuniform mat4 renderer_LocalMat;uniform mat4 renderer_ModelMat;uniform mat4 camera_ViewMat;uniform mat4 camera_ProjMat;uniform mat4 renderer_MVMat;uniform mat4 renderer_MVPMat;uniform mat4 renderer_NormalMat;"; // eslint-disable-line
|
|
@@ -8138,7 +8148,7 @@
|
|
|
8138
8148
|
var light_frag_define = "#define GLSLIFY 1\n#ifdef SCENE_DIRECT_LIGHT_COUNT\nstruct DirectLight{vec3 color;vec3 direction;};uniform ivec2 scene_DirectLightCullingMask[SCENE_DIRECT_LIGHT_COUNT];uniform vec3 scene_DirectLightColor[SCENE_DIRECT_LIGHT_COUNT];uniform vec3 scene_DirectLightDirection[SCENE_DIRECT_LIGHT_COUNT];\n#endif\n#ifdef SCENE_POINT_LIGHT_COUNT\nstruct PointLight{vec3 color;vec3 position;float distance;};uniform ivec2 scene_PointLightCullingMask[SCENE_POINT_LIGHT_COUNT];uniform vec3 scene_PointLightColor[SCENE_POINT_LIGHT_COUNT];uniform vec3 scene_PointLightPosition[SCENE_POINT_LIGHT_COUNT];uniform float scene_PointLightDistance[SCENE_POINT_LIGHT_COUNT];\n#endif\n#ifdef SCENE_SPOT_LIGHT_COUNT\nstruct SpotLight{vec3 color;vec3 position;vec3 direction;float distance;float angleCos;float penumbraCos;};uniform ivec2 scene_SpotLightCullingMask[SCENE_SPOT_LIGHT_COUNT];uniform vec3 scene_SpotLightColor[SCENE_SPOT_LIGHT_COUNT];uniform vec3 scene_SpotLightPosition[SCENE_SPOT_LIGHT_COUNT];uniform vec3 scene_SpotLightDirection[SCENE_SPOT_LIGHT_COUNT];uniform float scene_SpotLightDistance[SCENE_SPOT_LIGHT_COUNT];uniform float scene_SpotLightAngleCos[SCENE_SPOT_LIGHT_COUNT];uniform float scene_SpotLightPenumbraCos[SCENE_SPOT_LIGHT_COUNT];\n#endif\nstruct EnvMapLight{vec3 diffuse;float mipMapLevel;float diffuseIntensity;float specularIntensity;};uniform EnvMapLight scene_EnvMapLight;uniform ivec4 renderer_Layer;\n#ifdef SCENE_USE_SH\nuniform vec3 scene_EnvSH[9];\n#endif\n#ifdef SCENE_USE_SPECULAR_ENV\nuniform samplerCube scene_EnvSpecularSampler;\n#endif\n#ifndef GRAPHICS_API_WEBGL2\nbool isBitSet(float value,float mask,float bitIndex){return mod(floor(value/pow(2.0,bitIndex)),2.0)==1.0&&mod(floor(mask/pow(2.0,bitIndex)),2.0)==1.0;}\n#endif\nbool isRendererCulledByLight(ivec2 rendererLayer,ivec2 lightCullingMask){\n#ifdef GRAPHICS_API_WEBGL2\nreturn!((rendererLayer.x&lightCullingMask.x)!=0||(rendererLayer.y&lightCullingMask.y)!=0);\n#else\nfor(int i=0;i<16;i++){if(isBitSet(float(rendererLayer.x),float(lightCullingMask.x),float(i))||isBitSet(float(rendererLayer.y),float(lightCullingMask.y),float(i))){return false;}}return true;\n#endif\n}"; // eslint-disable-line
|
|
8139
8149
|
var mobile_material_frag = "#define GLSLIFY 1\nuniform vec4 material_EmissiveColor;uniform vec4 material_BaseColor;uniform vec4 material_SpecularColor;uniform float material_Shininess;uniform float material_NormalIntensity;uniform float material_AlphaCutoff;\n#ifdef MATERIAL_HAS_EMISSIVETEXTURE\nuniform sampler2D material_EmissiveTexture;\n#endif\n#ifdef MATERIAL_HAS_BASETEXTURE\nuniform sampler2D material_BaseTexture;\n#endif\n#ifdef MATERIAL_HAS_SPECULAR_TEXTURE\nuniform sampler2D material_SpecularTexture;\n#endif\n#ifdef MATERIAL_HAS_NORMALTEXTURE\nuniform sampler2D material_NormalTexture;\n#endif\n"; // eslint-disable-line
|
|
8140
8150
|
var begin_mobile_frag = "#define GLSLIFY 1\nvec4 ambient=vec4(0.0);vec4 emission=material_EmissiveColor;vec4 diffuse=material_BaseColor;vec4 specular=material_SpecularColor;\n#ifdef MATERIAL_HAS_EMISSIVETEXTURE\nvec4 emissiveTextureColor=texture2D(material_EmissiveTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nemissiveTextureColor=gammaToLinear(emissiveTextureColor);\n#endif\nemission*=emissiveTextureColor;\n#endif\n#ifdef MATERIAL_HAS_BASETEXTURE\nvec4 diffuseTextureColor=texture2D(material_BaseTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ndiffuseTextureColor=gammaToLinear(diffuseTextureColor);\n#endif\ndiffuse*=diffuseTextureColor;\n#endif\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\ndiffuse*=v_color;\n#endif\n#ifdef MATERIAL_HAS_SPECULAR_TEXTURE\nvec4 specularTextureColor=texture2D(material_SpecularTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nspecularTextureColor=gammaToLinear(specularTextureColor);\n#endif\nspecular*=specularTextureColor;\n#endif\nambient=vec4(scene_EnvMapLight.diffuse*scene_EnvMapLight.diffuseIntensity,1.0)*diffuse;"; // eslint-disable-line
|
|
8141
|
-
var begin_viewdir_frag = "#define GLSLIFY 1\n#ifdef MATERIAL_NEED_WORLD_POS\nvec3 V=normalize(camera_Position-v_pos);\n#endif\n"; // eslint-disable-line
|
|
8151
|
+
var begin_viewdir_frag = "#define GLSLIFY 1\n#ifdef CAMERA_ORTHOGRAPHIC\nvec3 V=-camera_Forward;\n#else\n#ifdef MATERIAL_NEED_WORLD_POS\nvec3 V=normalize(camera_Position-v_pos);\n#endif\n#endif\n"; // eslint-disable-line
|
|
8142
8152
|
var mobile_blinnphong_frag = "#define GLSLIFY 1\n#ifdef MATERIAL_HAS_NORMALTEXTURE\nmat3 tbn=getTBN(gl_FrontFacing);vec3 N=getNormalByNormalTexture(tbn,material_NormalTexture,material_NormalIntensity,v_uv,gl_FrontFacing);\n#else\nvec3 N=getNormal(gl_FrontFacing);\n#endif\nvec3 lightDiffuse=vec3(0.0,0.0,0.0);vec3 lightSpecular=vec3(0.0,0.0,0.0);float shadowAttenuation=1.0;\n#ifdef SCENE_DIRECT_LIGHT_COUNT\nshadowAttenuation=1.0;\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nshadowAttenuation*=sampleShadowMap();\n#endif\nDirectLight directionalLight;for(int i=0;i<SCENE_DIRECT_LIGHT_COUNT;i++){if(!isRendererCulledByLight(renderer_Layer.xy,scene_DirectLightCullingMask[i])){directionalLight.color=scene_DirectLightColor[i];\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nif(i==0){directionalLight.color*=shadowAttenuation;}\n#endif\ndirectionalLight.direction=scene_DirectLightDirection[i];float d=max(dot(N,-directionalLight.direction),0.0);lightDiffuse+=directionalLight.color*d;vec3 halfDir=normalize(V-directionalLight.direction);float s=pow(clamp(dot(N,halfDir),0.0,1.0),material_Shininess);lightSpecular+=directionalLight.color*s;}}\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])){pointLight.color=scene_PointLightColor[i];pointLight.position=scene_PointLightPosition[i];pointLight.distance=scene_PointLightDistance[i];vec3 direction=v_pos-pointLight.position;float dist=length(direction);direction/=dist;float decay=clamp(1.0-pow(dist/pointLight.distance,4.0),0.0,1.0);float d=max(dot(N,-direction),0.0)*decay;lightDiffuse+=pointLight.color*d;vec3 halfDir=normalize(V-direction);float s=pow(clamp(dot(N,halfDir),0.0,1.0),material_Shininess)*decay;lightSpecular+=pointLight.color*s;}}\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])){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];vec3 direction=spotLight.position-v_pos;float lightDistance=length(direction);direction/=lightDistance;float angleCos=dot(direction,-spotLight.direction);float decay=clamp(1.0-pow(lightDistance/spotLight.distance,4.0),0.0,1.0);float spotEffect=smoothstep(spotLight.penumbraCos,spotLight.angleCos,angleCos);float decayTotal=decay*spotEffect;float d=max(dot(N,direction),0.0)*decayTotal;lightDiffuse+=spotLight.color*d;vec3 halfDir=normalize(V+direction);float s=pow(clamp(dot(N,halfDir),0.0,1.0),material_Shininess)*decayTotal;lightSpecular+=spotLight.color*s;}}\n#endif\ndiffuse*=vec4(lightDiffuse,1.0);specular*=vec4(lightSpecular,1.0);\n#ifdef MATERIAL_IS_ALPHA_CUTOFF\nif(diffuse.a<material_AlphaCutoff){discard;}\n#endif\n"; // eslint-disable-line
|
|
8143
8153
|
var noise_cellular = "#define GLSLIFY 1\n#include <noise_cellular_2D>\n#include <noise_cellular_3D>\n#include <noise_cellular_2x2>\n#include <noise_cellular_2x2x2>\n"; // eslint-disable-line
|
|
8144
8154
|
var noise_cellular_2D = "#define GLSLIFY 1\nvec2 cellular(vec2 P){vec2 Pi=mod289(floor(P));vec2 Pf=fract(P);vec3 oi=vec3(-1.0,0.0,1.0);vec3 of=vec3(-0.5,0.5,1.5);vec3 px=permute(Pi.x+oi);vec3 p=permute(px.x+Pi.y+oi);vec3 ox=fract(p*K)-Ko;vec3 oy=mod7(floor(p*K))*K-Ko;vec3 dx=Pf.x+0.5+jitter*ox;vec3 dy=Pf.y-of+jitter*oy;vec3 d1=dx*dx+dy*dy;p=permute(px.y+Pi.y+oi);ox=fract(p*K)-Ko;oy=mod7(floor(p*K))*K-Ko;dx=Pf.x-0.5+jitter*ox;dy=Pf.y-of+jitter*oy;vec3 d2=dx*dx+dy*dy;p=permute(px.z+Pi.y+oi);ox=fract(p*K)-Ko;oy=mod7(floor(p*K))*K-Ko;dx=Pf.x-1.5+jitter*ox;dy=Pf.y-of+jitter*oy;vec3 d3=dx*dx+dy*dy;vec3 d1a=min(d1,d2);d2=max(d1,d2);d2=min(d2,d3);d1=min(d1a,d2);d2=max(d1a,d2);d1.xy=(d1.x<d1.y)? d1.xy : d1.yx;d1.xz=(d1.x<d1.z)? d1.xz : d1.zx;d1.yz=min(d1.yz,d2.yz);d1.y=min(d1.y,d1.z);d1.y=min(d1.y,d2.x);return sqrt(d1.xy);}"; // eslint-disable-line
|
|
@@ -8157,7 +8167,7 @@
|
|
|
8157
8167
|
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
|
|
8158
8168
|
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
|
|
8159
8169
|
var pbr_frag_define = "#define GLSLIFY 1\n#define MIN_PERCEPTUAL_ROUGHNESS 0.045\n#define MIN_ROUGHNESS 0.002025\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;uniform float material_NormalIntensity;uniform float material_OcclusionIntensity;uniform float material_OcclusionTextureCoord;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nuniform float material_ClearCoat;uniform float material_ClearCoatRoughness;\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\n#endif\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nuniform vec3 material_AnisotropyInfo;\n#ifdef MATERIAL_HAS_ANISOTROPY_TEXTURE\nuniform sampler2D material_AnisotropyTexture;\n#endif\n#endif\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\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#ifdef MATERIAL_ENABLE_ANISOTROPY\nvec3 anisotropicT;vec3 anisotropicB;vec3 anisotropicN;float anisotropy;\n#endif\n};struct Material{vec3 diffuseColor;float roughness;vec3 specularColor;float opacity;float f0;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nfloat clearCoat;float clearCoatRoughness;\n#endif\n};"; // eslint-disable-line
|
|
8160
|
-
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 MIN_PERCEPTUAL_ROUGHNESS+max(max(dxy.x,dxy.y),dxy.z);\n#else\nreturn MIN_PERCEPTUAL_ROUGHNESS;\n#endif\n}\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nvec3 getAnisotropicBentNormal(Geometry geometry,vec3 n,float roughness){vec3 anisotropyDirection=geometry.anisotropy>=0.0 ? geometry.anisotropicB : geometry.anisotropicT;vec3 anisotropicTangent=cross(anisotropyDirection,geometry.viewDir);vec3 anisotropicNormal=cross(anisotropicTangent,anisotropyDirection);vec3 bentNormal=normalize(mix(n,anisotropicNormal,abs(geometry.anisotropy)*saturate(5.0*roughness)));return bentNormal;}\n#endif\nvoid initGeometry(out Geometry geometry,bool isFrontFacing){geometry.position=v_pos
|
|
8170
|
+
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 MIN_PERCEPTUAL_ROUGHNESS+max(max(dxy.x,dxy.y),dxy.z);\n#else\nreturn MIN_PERCEPTUAL_ROUGHNESS;\n#endif\n}\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nvec3 getAnisotropicBentNormal(Geometry geometry,vec3 n,float roughness){vec3 anisotropyDirection=geometry.anisotropy>=0.0 ? geometry.anisotropicB : geometry.anisotropicT;vec3 anisotropicTangent=cross(anisotropyDirection,geometry.viewDir);vec3 anisotropicNormal=cross(anisotropicTangent,anisotropyDirection);vec3 bentNormal=normalize(mix(n,anisotropicNormal,abs(geometry.anisotropy)*saturate(5.0*roughness)));return bentNormal;}\n#endif\nvoid initGeometry(out Geometry geometry,bool isFrontFacing){geometry.position=v_pos;\n#ifdef CAMERA_ORTHOGRAPHIC\ngeometry.viewDir=-camera_Forward;\n#else\ngeometry.viewDir=normalize(camera_Position-v_pos);\n#endif\n#if defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) || defined(MATERIAL_ENABLE_ANISOTROPY)\nmat3 tbn=getTBN(isFrontFacing);\n#endif\n#ifdef MATERIAL_HAS_NORMALTEXTURE\ngeometry.normal=getNormalByNormalTexture(tbn,material_NormalTexture,material_NormalIntensity,v_uv,isFrontFacing);\n#else\ngeometry.normal=getNormal(isFrontFacing);\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,isFrontFacing);\n#else\ngeometry.clearCoatNormal=getNormal(isFrontFacing);\n#endif\ngeometry.clearCoatDotNV=saturate(dot(geometry.clearCoatNormal,geometry.viewDir));\n#endif\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nfloat anisotropy=material_AnisotropyInfo.z;vec3 anisotropicDirection=vec3(material_AnisotropyInfo.xy,0.0);\n#ifdef MATERIAL_HAS_ANISOTROPY_TEXTURE\nvec3 anisotropyTextureInfo=texture2D(material_AnisotropyTexture,v_uv).rgb;anisotropy*=anisotropyTextureInfo.b;anisotropicDirection.xy*=anisotropyTextureInfo.rg*2.0-1.0;\n#endif\ngeometry.anisotropy=anisotropy;geometry.anisotropicT=normalize(tbn*anisotropicDirection);geometry.anisotropicB=normalize(cross(geometry.normal,geometry.anisotropicT));\n#endif\n}void initMaterial(out Material material,inout 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));material.f0=f0;\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_ENABLE_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#ifdef MATERIAL_ENABLE_ANISOTROPY\ngeometry.anisotropicN=getAnisotropicBentNormal(geometry,geometry.normal,material.roughness);\n#endif\n}\n#include <brdf>\n#include <direct_irradiance_frag_define>\n#include <ibl_frag_define>\n"; // eslint-disable-line
|
|
8161
8171
|
var brdf = "#define GLSLIFY 1\nfloat F_Schlick(float f0,float dotLH){return f0+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);}\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nfloat G_GGX_SmithCorrelated_Anisotropic(float at,float ab,float ToV,float BoV,float ToL,float BoL,float NoV,float NoL){float lambdaV=NoL*length(vec3(at*ToV,ab*BoV,NoV));float lambdaL=NoV*length(vec3(at*ToL,ab*BoL,NoL));return 0.5/max(lambdaV+lambdaL,EPSILON);}\n#endif\nfloat 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);}\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nfloat D_GGX_Anisotropic(float at,float ab,float ToH,float BoH,float NoH){float a2=at*ab;highp vec3 d=vec3(ab*ToH,at*BoH,a2*NoH);highp float d2=dot(d,d);float b2=a2/d2;return a2*b2*b2*RECIPROCAL_PI;}\n#endif\nvec3 isotropicLobe(vec3 specularColor,float alpha,float dotNV,float dotNL,float dotNH,float dotLH){vec3 F=F_Schlick(specularColor,dotLH);float D=D_GGX(alpha,dotNH);float G=G_GGX_SmithCorrelated(alpha,dotNL,dotNV);return F*(G*D);}\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nvec3 anisotropicLobe(vec3 h,vec3 l,Geometry geometry,vec3 specularColor,float alpha,float dotNV,float dotNL,float dotNH,float dotLH){vec3 t=geometry.anisotropicT;vec3 b=geometry.anisotropicB;vec3 v=geometry.viewDir;float dotTV=dot(t,v);float dotBV=dot(b,v);float dotTL=dot(t,l);float dotBL=dot(b,l);float dotTH=dot(t,h);float dotBH=dot(b,h);float at=max(alpha*(1.0+geometry.anisotropy),MIN_ROUGHNESS);float ab=max(alpha*(1.0-geometry.anisotropy),MIN_ROUGHNESS);vec3 F=F_Schlick(specularColor,dotLH);float D=D_GGX_Anisotropic(at,ab,dotTH,dotBH,dotNH);float G=G_GGX_SmithCorrelated_Anisotropic(at,ab,dotTV,dotBV,dotTL,dotBL,dotNV,dotNL);return F*(G*D);}\n#endif\nvec3 BRDF_Specular_GGX(vec3 incidentDirection,Geometry geometry,vec3 normal,vec3 specularColor,float roughness){float alpha=pow2(roughness);vec3 halfDir=normalize(incidentDirection+geometry.viewDir);float dotNL=saturate(dot(normal,incidentDirection));float dotNV=saturate(dot(normal,geometry.viewDir));float dotNH=saturate(dot(normal,halfDir));float dotLH=saturate(dot(incidentDirection,halfDir));\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nreturn anisotropicLobe(halfDir,incidentDirection,geometry,specularColor,alpha,dotNV,dotNL,dotNH,dotLH);\n#else\nreturn isotropicLobe(specularColor,alpha,dotNV,dotNL,dotNH,dotLH);\n#endif\n}vec3 BRDF_Diffuse_Lambert(vec3 diffuseColor){return RECIPROCAL_PI*diffuseColor;}"; // eslint-disable-line
|
|
8162
8172
|
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,geometry.clearCoatNormal,vec3(0.04),material.clearCoatRoughness);attenuation-=material.clearCoat*F_Schlick(material.f0,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,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();\n#endif\nDirectLight directionalLight;for(int i=0;i<SCENE_DIRECT_LIGHT_COUNT;i++){if(!isRendererCulledByLight(renderer_Layer.xy,scene_DirectLightCullingMask[i])){directionalLight.color=scene_DirectLightColor[i];\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nif(i==0){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])){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])){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
|
|
8163
8173
|
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 getReflectedVector(Geometry geometry,vec3 n){\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nvec3 r=reflect(-geometry.viewDir,geometry.anisotropicN);\n#else\nvec3 r=reflect(-geometry.viewDir,n);\n#endif\nreturn r;}vec3 getLightProbeRadiance(Geometry geometry,vec3 normal,float roughness,int maxMIPLevel,float specularIntensity){\n#ifndef SCENE_USE_SPECULAR_ENV\nreturn vec3(0);\n#else\nvec3 reflectVec=getReflectedVector(geometry,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
|
|
@@ -8267,7 +8277,11 @@
|
|
|
8267
8277
|
}
|
|
8268
8278
|
ShaderLib[includeName] = includeSource;
|
|
8269
8279
|
};
|
|
8270
|
-
|
|
8280
|
+
/**
|
|
8281
|
+
* @param regex The default regex is for engine's builtin glsl `#include` syntax,
|
|
8282
|
+
* since `ShaderLab` use the same parsing function but different syntax for `#include` --- `/^[ \t]*#include +"([\w\d.]+)"/gm`
|
|
8283
|
+
*/ ShaderFactory.parseIncludes = function parseIncludes(src, regex) {
|
|
8284
|
+
if (regex === void 0) regex = /^[ \t]*#include +<([\w\d.]+)>/gm;
|
|
8271
8285
|
var replace = function replace(match, slice) {
|
|
8272
8286
|
var replace = ShaderLib[slice];
|
|
8273
8287
|
if (replace === undefined) {
|
|
@@ -8276,7 +8290,6 @@
|
|
|
8276
8290
|
}
|
|
8277
8291
|
return ShaderFactory.parseIncludes(replace);
|
|
8278
8292
|
};
|
|
8279
|
-
var regex = /^[ \t]*#include +<([\w\d.]+)>/gm;
|
|
8280
8293
|
return src.replace(regex, replace);
|
|
8281
8294
|
};
|
|
8282
8295
|
/**
|
|
@@ -11229,7 +11242,7 @@
|
|
|
11229
11242
|
_this._byteLength = byteLength;
|
|
11230
11243
|
_this._platformBuffer = engine._hardwareRenderer.createPlatformBuffer(type, byteLength, bufferUsage, data);
|
|
11231
11244
|
if (readable) {
|
|
11232
|
-
var buffer =
|
|
11245
|
+
var buffer = data.constructor === ArrayBuffer ? data.slice(0) : data.buffer.slice(data.byteOffset, data.byteOffset + byteLength);
|
|
11233
11246
|
_this._data = new Uint8Array(buffer);
|
|
11234
11247
|
}
|
|
11235
11248
|
}
|
|
@@ -17678,6 +17691,9 @@
|
|
|
17678
17691
|
var baseline = Math.ceil(context.measureText(TextUtils._measureBaseline).width);
|
|
17679
17692
|
var height = baseline * TextUtils._heightMultiplier;
|
|
17680
17693
|
baseline = TextUtils._baselineMultiplier * baseline | 0;
|
|
17694
|
+
var _extendHeight = TextUtils._extendHeight;
|
|
17695
|
+
height += _extendHeight;
|
|
17696
|
+
baseline += _extendHeight * 0.5;
|
|
17681
17697
|
canvas.width = width;
|
|
17682
17698
|
canvas.height = height;
|
|
17683
17699
|
context.font = fontString;
|
|
@@ -17712,6 +17728,7 @@
|
|
|
17712
17728
|
}
|
|
17713
17729
|
if (top !== -1 && bottom !== -1) {
|
|
17714
17730
|
ascent = baseline - top;
|
|
17731
|
+
// Baseline belong to descent
|
|
17715
17732
|
descent = bottom - baseline + 1;
|
|
17716
17733
|
size = ascent + descent;
|
|
17717
17734
|
}
|
|
@@ -17788,9 +17805,8 @@
|
|
|
17788
17805
|
];
|
|
17789
17806
|
})();
|
|
17790
17807
|
(function() {
|
|
17791
|
-
//
|
|
17792
|
-
|
|
17793
|
-
/** @internal */ TextUtils._heightMultiplier = 2;
|
|
17808
|
+
// _extendHeight used to extend the height of canvas, because in miniprogram performance is different from h5.
|
|
17809
|
+
/** @internal */ TextUtils._extendHeight = 0;
|
|
17794
17810
|
})();
|
|
17795
17811
|
(function() {
|
|
17796
17812
|
/** These characters are all tall to help calculate the height required for text. */ TextUtils._measureString = "|\xc9q\xc5";
|
|
@@ -17798,6 +17814,9 @@
|
|
|
17798
17814
|
(function() {
|
|
17799
17815
|
TextUtils._measureBaseline = "M";
|
|
17800
17816
|
})();
|
|
17817
|
+
(function() {
|
|
17818
|
+
TextUtils._heightMultiplier = 2;
|
|
17819
|
+
})();
|
|
17801
17820
|
(function() {
|
|
17802
17821
|
TextUtils._baselineMultiplier = 1.4;
|
|
17803
17822
|
})();
|
|
@@ -19539,6 +19558,7 @@
|
|
|
19539
19558
|
AssetType[/** Cube Compress Texture. */ "KTXCube"] = "KTXCube";
|
|
19540
19559
|
AssetType[/** KTX2 Compress Texture */ "KTX2"] = "KTX2";
|
|
19541
19560
|
AssetType[/** Sprite. */ "Sprite"] = "Sprite";
|
|
19561
|
+
AssetType[/** PrimitiveMesh. */ "PrimitiveMesh"] = "PrimitiveMesh";
|
|
19542
19562
|
AssetType[/** Sprite Atlas. */ "SpriteAtlas"] = "SpriteAtlas";
|
|
19543
19563
|
AssetType[/** Ambient light. */ "Env"] = "Environment";
|
|
19544
19564
|
AssetType[/** Scene. */ "Scene"] = "Scene";
|
|
@@ -19920,6 +19940,7 @@
|
|
|
19920
19940
|
this./** The number of retries after failing to load assets. */ retryCount = 1;
|
|
19921
19941
|
this./** Retry delay time after failed to load assets, in milliseconds. */ retryInterval = 0;
|
|
19922
19942
|
this./** The default timeout period for loading assets, in milliseconds. */ timeout = Infinity;
|
|
19943
|
+
this./** Base url for loading assets. */ baseUrl = null;
|
|
19923
19944
|
this._loadingPromises = {};
|
|
19924
19945
|
this._assetPool = Object.create(null);
|
|
19925
19946
|
this._assetUrlPool = Object.create(null);
|
|
@@ -20122,6 +20143,8 @@
|
|
|
20122
20143
|
// Check url mapping
|
|
20123
20144
|
var itemURL = item.url;
|
|
20124
20145
|
var url = this._virtualPathMap[itemURL] ? this._virtualPathMap[itemURL] : itemURL;
|
|
20146
|
+
// Not absolute and base url is set
|
|
20147
|
+
if (!Utils.isAbsoluteUrl(url) && this.baseUrl) url = Utils.resolveAbsoluteUrl(this.baseUrl, url);
|
|
20125
20148
|
// Parse url
|
|
20126
20149
|
var _this__parseURL = this._parseURL(url), assetBaseURL = _this__parseURL.assetBaseURL, queryPath = _this__parseURL.queryPath;
|
|
20127
20150
|
var paths = queryPath ? this._parseQueryPath(queryPath) : [];
|
|
@@ -20805,7 +20828,7 @@
|
|
|
20805
20828
|
* Keyboard Manager.
|
|
20806
20829
|
* @internal
|
|
20807
20830
|
*/ var KeyboardManager = /*#__PURE__*/ function() {
|
|
20808
|
-
var KeyboardManager = function KeyboardManager(engine) {
|
|
20831
|
+
var KeyboardManager = function KeyboardManager(engine, target) {
|
|
20809
20832
|
/** @internal */ this._curHeldDownKeyToIndexMap = [];
|
|
20810
20833
|
/** @internal */ this._upKeyToFrameCountMap = [];
|
|
20811
20834
|
/** @internal */ this._downKeyToFrameCountMap = [];
|
|
@@ -20813,17 +20836,11 @@
|
|
|
20813
20836
|
/** @internal */ this._curFrameDownList = new DisorderedArray();
|
|
20814
20837
|
/** @internal */ this._curFrameUpList = new DisorderedArray();
|
|
20815
20838
|
this._nativeEvents = [];
|
|
20816
|
-
this._hadListener = false;
|
|
20817
|
-
// @ts-ignore
|
|
20818
|
-
var htmlCanvas = engine._canvas._webCanvas;
|
|
20819
20839
|
this._engine = engine;
|
|
20820
|
-
this.
|
|
20821
|
-
// Need to set tabIndex to make the canvas focus.
|
|
20822
|
-
htmlCanvas.tabIndex = htmlCanvas.tabIndex;
|
|
20840
|
+
this._onBlur = this._onBlur.bind(this);
|
|
20823
20841
|
this._onKeyEvent = this._onKeyEvent.bind(this);
|
|
20824
|
-
|
|
20825
|
-
|
|
20826
|
-
this._hadListener = true;
|
|
20842
|
+
this._target = target;
|
|
20843
|
+
this._addEventListener();
|
|
20827
20844
|
};
|
|
20828
20845
|
var _proto = KeyboardManager.prototype;
|
|
20829
20846
|
/**
|
|
@@ -20875,35 +20892,8 @@
|
|
|
20875
20892
|
};
|
|
20876
20893
|
/**
|
|
20877
20894
|
* @internal
|
|
20878
|
-
*/ _proto._onFocus = function _onFocus() {
|
|
20879
|
-
if (!this._hadListener) {
|
|
20880
|
-
this._htmlCanvas.addEventListener("keydown", this._onKeyEvent);
|
|
20881
|
-
this._htmlCanvas.addEventListener("keyup", this._onKeyEvent);
|
|
20882
|
-
this._hadListener = true;
|
|
20883
|
-
}
|
|
20884
|
-
};
|
|
20885
|
-
/**
|
|
20886
|
-
* @internal
|
|
20887
|
-
*/ _proto._onBlur = function _onBlur() {
|
|
20888
|
-
if (this._hadListener) {
|
|
20889
|
-
this._htmlCanvas.removeEventListener("keydown", this._onKeyEvent);
|
|
20890
|
-
this._htmlCanvas.removeEventListener("keyup", this._onKeyEvent);
|
|
20891
|
-
this._curHeldDownKeyToIndexMap.length = 0;
|
|
20892
|
-
this._curFrameHeldDownList.length = 0;
|
|
20893
|
-
this._curFrameDownList.length = 0;
|
|
20894
|
-
this._curFrameUpList.length = 0;
|
|
20895
|
-
this._nativeEvents.length = 0;
|
|
20896
|
-
this._hadListener = false;
|
|
20897
|
-
}
|
|
20898
|
-
};
|
|
20899
|
-
/**
|
|
20900
|
-
* @internal
|
|
20901
20895
|
*/ _proto._destroy = function _destroy() {
|
|
20902
|
-
|
|
20903
|
-
this._htmlCanvas.removeEventListener("keydown", this._onKeyEvent);
|
|
20904
|
-
this._htmlCanvas.removeEventListener("keyup", this._onKeyEvent);
|
|
20905
|
-
this._hadListener = false;
|
|
20906
|
-
}
|
|
20896
|
+
this._removeEventListener();
|
|
20907
20897
|
this._curHeldDownKeyToIndexMap.length = 0;
|
|
20908
20898
|
this._curHeldDownKeyToIndexMap = null;
|
|
20909
20899
|
this._upKeyToFrameCountMap.length = 0;
|
|
@@ -20918,12 +20908,30 @@
|
|
|
20918
20908
|
this._curFrameDownList = null;
|
|
20919
20909
|
this._curFrameUpList.length = 0;
|
|
20920
20910
|
this._curFrameUpList = null;
|
|
20921
|
-
this._htmlCanvas = null;
|
|
20922
20911
|
this._engine = null;
|
|
20923
20912
|
};
|
|
20913
|
+
_proto._onBlur = function _onBlur() {
|
|
20914
|
+
this._curHeldDownKeyToIndexMap.length = 0;
|
|
20915
|
+
this._curFrameHeldDownList.length = 0;
|
|
20916
|
+
this._curFrameDownList.length = 0;
|
|
20917
|
+
this._curFrameUpList.length = 0;
|
|
20918
|
+
this._nativeEvents.length = 0;
|
|
20919
|
+
};
|
|
20924
20920
|
_proto._onKeyEvent = function _onKeyEvent(evt) {
|
|
20925
20921
|
this._nativeEvents.push(evt);
|
|
20926
20922
|
};
|
|
20923
|
+
_proto._addEventListener = function _addEventListener() {
|
|
20924
|
+
var _this = this, target = _this._target;
|
|
20925
|
+
target.addEventListener("keydown", this._onKeyEvent);
|
|
20926
|
+
target.addEventListener("keyup", this._onKeyEvent);
|
|
20927
|
+
target.addEventListener("blur", this._onBlur);
|
|
20928
|
+
};
|
|
20929
|
+
_proto._removeEventListener = function _removeEventListener() {
|
|
20930
|
+
var _this = this, target = _this._target;
|
|
20931
|
+
target.removeEventListener("keydown", this._onKeyEvent);
|
|
20932
|
+
target.removeEventListener("keyup", this._onKeyEvent);
|
|
20933
|
+
target.removeEventListener("blur", this._onBlur);
|
|
20934
|
+
};
|
|
20927
20935
|
return KeyboardManager;
|
|
20928
20936
|
}();
|
|
20929
20937
|
/**
|
|
@@ -22860,7 +22868,7 @@
|
|
|
22860
22868
|
* Pointer Manager.
|
|
22861
22869
|
* @internal
|
|
22862
22870
|
*/ var PointerManager = /*#__PURE__*/ function() {
|
|
22863
|
-
var PointerManager = function PointerManager(engine) {
|
|
22871
|
+
var PointerManager = function PointerManager(engine, target) {
|
|
22864
22872
|
/** @internal */ this._pointers = [];
|
|
22865
22873
|
/** @internal */ this._multiPointerEnabled = true;
|
|
22866
22874
|
/** @internal */ this._buttons = exports.PointerButton.None;
|
|
@@ -22869,16 +22877,18 @@
|
|
|
22869
22877
|
/** @internal */ this._upList = new DisorderedArray();
|
|
22870
22878
|
/** @internal */ this._downList = new DisorderedArray();
|
|
22871
22879
|
this._nativeEvents = [];
|
|
22872
|
-
|
|
22873
|
-
|
|
22874
|
-
|
|
22880
|
+
if (_instanceof1$2(target, Window)) {
|
|
22881
|
+
throw "Do not set window as target because window cannot listen to pointer leave event.";
|
|
22882
|
+
}
|
|
22875
22883
|
this._engine = engine;
|
|
22884
|
+
this._target = target;
|
|
22876
22885
|
this._canvas = engine.canvas;
|
|
22877
|
-
|
|
22878
|
-
this.
|
|
22879
|
-
this._onFocus();
|
|
22886
|
+
// @ts-ignore
|
|
22887
|
+
this._htmlCanvas = engine._canvas._webCanvas;
|
|
22880
22888
|
// If there are no compatibility issues, navigator.maxTouchPoints should be used here
|
|
22881
22889
|
this._pointerPool = new Array(11);
|
|
22890
|
+
this._onPointerEvent = this._onPointerEvent.bind(this);
|
|
22891
|
+
this._addEventListener();
|
|
22882
22892
|
};
|
|
22883
22893
|
var _proto = PointerManager.prototype;
|
|
22884
22894
|
/**
|
|
@@ -22948,7 +22958,8 @@
|
|
|
22948
22958
|
var length = events.length;
|
|
22949
22959
|
if (length > 0) {
|
|
22950
22960
|
for(var i1 = 0; i1 < length; i1++){
|
|
22951
|
-
|
|
22961
|
+
var event = events[i1];
|
|
22962
|
+
switch(event.type){
|
|
22952
22963
|
case "pointerdown":
|
|
22953
22964
|
pointer.phase = exports.PointerPhase.Down;
|
|
22954
22965
|
pointer._firePointerDown(rayCastEntity);
|
|
@@ -22970,66 +22981,14 @@
|
|
|
22970
22981
|
};
|
|
22971
22982
|
/**
|
|
22972
22983
|
* @internal
|
|
22973
|
-
*/ _proto._onFocus = function _onFocus() {
|
|
22974
|
-
if (!this._hadListener) {
|
|
22975
|
-
var _this = this, htmlCanvas = _this._htmlCanvas, onPointerEvent = _this._onPointerEvent;
|
|
22976
|
-
htmlCanvas.addEventListener("pointerdown", onPointerEvent);
|
|
22977
|
-
htmlCanvas.addEventListener("pointerup", onPointerEvent);
|
|
22978
|
-
htmlCanvas.addEventListener("pointerleave", onPointerEvent);
|
|
22979
|
-
htmlCanvas.addEventListener("pointermove", onPointerEvent);
|
|
22980
|
-
htmlCanvas.addEventListener("pointercancel", onPointerEvent);
|
|
22981
|
-
this._hadListener = true;
|
|
22982
|
-
}
|
|
22983
|
-
};
|
|
22984
|
-
/**
|
|
22985
|
-
* @internal
|
|
22986
|
-
*/ _proto._onBlur = function _onBlur() {
|
|
22987
|
-
if (this._hadListener) {
|
|
22988
|
-
var _this = this, htmlCanvas = _this._htmlCanvas, onPointerEvent = _this._onPointerEvent;
|
|
22989
|
-
htmlCanvas.removeEventListener("pointerdown", onPointerEvent);
|
|
22990
|
-
htmlCanvas.removeEventListener("pointerup", onPointerEvent);
|
|
22991
|
-
htmlCanvas.removeEventListener("pointerleave", onPointerEvent);
|
|
22992
|
-
htmlCanvas.removeEventListener("pointermove", onPointerEvent);
|
|
22993
|
-
htmlCanvas.removeEventListener("pointercancel", onPointerEvent);
|
|
22994
|
-
this._hadListener = false;
|
|
22995
|
-
this._pointers.length = 0;
|
|
22996
|
-
this._downList.length = 0;
|
|
22997
|
-
this._upList.length = 0;
|
|
22998
|
-
}
|
|
22999
|
-
};
|
|
23000
|
-
/**
|
|
23001
|
-
* @internal
|
|
23002
22984
|
*/ _proto._destroy = function _destroy() {
|
|
23003
|
-
|
|
23004
|
-
if (this._hadListener) {
|
|
23005
|
-
var _this = this, htmlCanvas = _this._htmlCanvas, onPointerEvent = _this._onPointerEvent;
|
|
23006
|
-
htmlCanvas.removeEventListener("pointerdown", onPointerEvent);
|
|
23007
|
-
htmlCanvas.removeEventListener("pointerup", onPointerEvent);
|
|
23008
|
-
htmlCanvas.removeEventListener("pointerleave", onPointerEvent);
|
|
23009
|
-
htmlCanvas.removeEventListener("pointermove", onPointerEvent);
|
|
23010
|
-
htmlCanvas.removeEventListener("pointercancel", onPointerEvent);
|
|
23011
|
-
this._hadListener = false;
|
|
23012
|
-
}
|
|
22985
|
+
this._removeEventListener();
|
|
23013
22986
|
this._pointerPool.length = 0;
|
|
23014
|
-
this._pointerPool = null;
|
|
23015
|
-
this._pointers.length = 0;
|
|
23016
|
-
this._pointers = null;
|
|
23017
|
-
this._downList.length = 0;
|
|
23018
|
-
this._downList = null;
|
|
23019
|
-
this._upList.length = 0;
|
|
23020
|
-
this._upList = null;
|
|
23021
22987
|
this._nativeEvents.length = 0;
|
|
23022
|
-
this._nativeEvents = null;
|
|
23023
|
-
this._upMap.length = 0;
|
|
23024
|
-
this._upMap = null;
|
|
23025
22988
|
this._downMap.length = 0;
|
|
23026
|
-
this.
|
|
23027
|
-
this._htmlCanvas = null;
|
|
23028
|
-
this._canvas = null;
|
|
23029
|
-
this._engine = null;
|
|
22989
|
+
this._upMap.length = 0;
|
|
23030
22990
|
};
|
|
23031
22991
|
_proto._onPointerEvent = function _onPointerEvent(evt) {
|
|
23032
|
-
evt.type === "pointerdown" && this._htmlCanvas.focus();
|
|
23033
22992
|
this._nativeEvents.push(evt);
|
|
23034
22993
|
};
|
|
23035
22994
|
_proto._getPointerByID = function _getPointerByID(pointerId) {
|
|
@@ -23112,6 +23071,26 @@
|
|
|
23112
23071
|
}
|
|
23113
23072
|
return null;
|
|
23114
23073
|
};
|
|
23074
|
+
_proto._addEventListener = function _addEventListener() {
|
|
23075
|
+
var _this = this, target = _this._target, onPointerEvent = _this._onPointerEvent;
|
|
23076
|
+
target.addEventListener("pointerdown", onPointerEvent);
|
|
23077
|
+
target.addEventListener("pointerup", onPointerEvent);
|
|
23078
|
+
target.addEventListener("pointerleave", onPointerEvent);
|
|
23079
|
+
target.addEventListener("pointermove", onPointerEvent);
|
|
23080
|
+
target.addEventListener("pointercancel", onPointerEvent);
|
|
23081
|
+
};
|
|
23082
|
+
_proto._removeEventListener = function _removeEventListener() {
|
|
23083
|
+
var _this = this, target = _this._target, onPointerEvent = _this._onPointerEvent;
|
|
23084
|
+
target.removeEventListener("pointerdown", onPointerEvent);
|
|
23085
|
+
target.removeEventListener("pointerup", onPointerEvent);
|
|
23086
|
+
target.removeEventListener("pointerleave", onPointerEvent);
|
|
23087
|
+
target.removeEventListener("pointermove", onPointerEvent);
|
|
23088
|
+
target.removeEventListener("pointercancel", onPointerEvent);
|
|
23089
|
+
this._nativeEvents.length = 0;
|
|
23090
|
+
this._pointers.length = 0;
|
|
23091
|
+
this._downList.length = 0;
|
|
23092
|
+
this._upList.length = 0;
|
|
23093
|
+
};
|
|
23115
23094
|
return PointerManager;
|
|
23116
23095
|
}();
|
|
23117
23096
|
(function() {
|
|
@@ -23127,15 +23106,12 @@
|
|
|
23127
23106
|
* Wheel Manager.
|
|
23128
23107
|
* @internal
|
|
23129
23108
|
*/ var WheelManager = /*#__PURE__*/ function() {
|
|
23130
|
-
var WheelManager = function WheelManager(engine) {
|
|
23109
|
+
var WheelManager = function WheelManager(engine, target) {
|
|
23131
23110
|
/** @internal */ this._delta = new Vector3();
|
|
23132
23111
|
this._nativeEvents = [];
|
|
23133
|
-
// @ts-ignore
|
|
23134
|
-
var htmlCanvas = engine._canvas._webCanvas;
|
|
23135
23112
|
this._onWheelEvent = this._onWheelEvent.bind(this);
|
|
23136
|
-
|
|
23137
|
-
this.
|
|
23138
|
-
this._hadListener = true;
|
|
23113
|
+
this._target = target;
|
|
23114
|
+
this._addEventListener();
|
|
23139
23115
|
};
|
|
23140
23116
|
var _proto = WheelManager.prototype;
|
|
23141
23117
|
/**
|
|
@@ -23156,35 +23132,24 @@
|
|
|
23156
23132
|
};
|
|
23157
23133
|
/**
|
|
23158
23134
|
* @internal
|
|
23159
|
-
*/ _proto.
|
|
23160
|
-
|
|
23161
|
-
this._canvas.addEventListener("wheel", this._onWheelEvent);
|
|
23162
|
-
this._hadListener = true;
|
|
23163
|
-
}
|
|
23135
|
+
*/ _proto._addEventListener = function _addEventListener() {
|
|
23136
|
+
this._target.addEventListener("wheel", this._onWheelEvent);
|
|
23164
23137
|
};
|
|
23165
23138
|
/**
|
|
23166
23139
|
* @internal
|
|
23167
|
-
*/ _proto.
|
|
23168
|
-
|
|
23169
|
-
|
|
23170
|
-
|
|
23171
|
-
this._delta.set(0, 0, 0);
|
|
23172
|
-
this._hadListener = false;
|
|
23173
|
-
}
|
|
23140
|
+
*/ _proto._removeEventListener = function _removeEventListener() {
|
|
23141
|
+
this._target.removeEventListener("wheel", this._onWheelEvent);
|
|
23142
|
+
this._nativeEvents.length = 0;
|
|
23143
|
+
this._delta.set(0, 0, 0);
|
|
23174
23144
|
};
|
|
23175
23145
|
/**
|
|
23176
23146
|
* @internal
|
|
23177
23147
|
*/ _proto._destroy = function _destroy() {
|
|
23178
|
-
|
|
23179
|
-
this._canvas.removeEventListener("wheel", this._onWheelEvent);
|
|
23180
|
-
this._hadListener = false;
|
|
23181
|
-
}
|
|
23148
|
+
this._removeEventListener();
|
|
23182
23149
|
this._nativeEvents = null;
|
|
23183
|
-
this._canvas = null;
|
|
23184
23150
|
this._delta = null;
|
|
23185
23151
|
};
|
|
23186
23152
|
_proto._onWheelEvent = function _onWheelEvent(evt) {
|
|
23187
|
-
evt.cancelable && evt.preventDefault();
|
|
23188
23153
|
this._nativeEvents.push(evt);
|
|
23189
23154
|
};
|
|
23190
23155
|
return WheelManager;
|
|
@@ -23192,19 +23157,19 @@
|
|
|
23192
23157
|
/**
|
|
23193
23158
|
* InputManager manages device input such as mouse, touch, keyboard, etc.
|
|
23194
23159
|
*/ var InputManager = /*#__PURE__*/ function() {
|
|
23195
|
-
var InputManager = function InputManager(engine) {
|
|
23160
|
+
var InputManager = function InputManager(engine, inputOptions) {
|
|
23196
23161
|
/** Sometimes the input module will not be initialized, such as off-screen rendering. */ this._initialized = false;
|
|
23197
23162
|
this._engine = engine;
|
|
23198
23163
|
// @ts-ignore
|
|
23199
23164
|
var canvas = engine._canvas._webCanvas;
|
|
23200
23165
|
if (typeof OffscreenCanvas === "undefined" || !_instanceof1$2(canvas, OffscreenCanvas)) {
|
|
23201
|
-
|
|
23202
|
-
|
|
23203
|
-
this.
|
|
23204
|
-
|
|
23205
|
-
|
|
23206
|
-
|
|
23207
|
-
|
|
23166
|
+
var _inputOptions, _inputOptions1, _inputOptions2;
|
|
23167
|
+
var _inputOptions_wheelTarget;
|
|
23168
|
+
this._wheelManager = new WheelManager(engine, (_inputOptions_wheelTarget = (_inputOptions = inputOptions) == null ? void 0 : _inputOptions.wheelTarget) != null ? _inputOptions_wheelTarget : canvas);
|
|
23169
|
+
var _inputOptions_pointerTarget;
|
|
23170
|
+
this._pointerManager = new PointerManager(engine, (_inputOptions_pointerTarget = (_inputOptions1 = inputOptions) == null ? void 0 : _inputOptions1.pointerTarget) != null ? _inputOptions_pointerTarget : canvas);
|
|
23171
|
+
var _inputOptions_keyboardTarget;
|
|
23172
|
+
this._keyboardManager = new KeyboardManager(engine, (_inputOptions_keyboardTarget = (_inputOptions2 = inputOptions) == null ? void 0 : _inputOptions2.keyboardTarget) != null ? _inputOptions_keyboardTarget : window);
|
|
23208
23173
|
this._initialized = true;
|
|
23209
23174
|
}
|
|
23210
23175
|
};
|
|
@@ -23317,8 +23282,6 @@
|
|
|
23317
23282
|
* @internal
|
|
23318
23283
|
*/ _proto._destroy = function _destroy() {
|
|
23319
23284
|
if (this._initialized) {
|
|
23320
|
-
window.removeEventListener("blur", this._onBlur);
|
|
23321
|
-
window.removeEventListener("focus", this._onFocus);
|
|
23322
23285
|
this._wheelManager._destroy();
|
|
23323
23286
|
this._wheelManager = null;
|
|
23324
23287
|
this._pointerManager._destroy();
|
|
@@ -23327,16 +23290,6 @@
|
|
|
23327
23290
|
this._keyboardManager = null;
|
|
23328
23291
|
}
|
|
23329
23292
|
};
|
|
23330
|
-
_proto._onBlur = function _onBlur() {
|
|
23331
|
-
this._wheelManager._onBlur();
|
|
23332
|
-
this._pointerManager._onBlur();
|
|
23333
|
-
this._keyboardManager._onBlur();
|
|
23334
|
-
};
|
|
23335
|
-
_proto._onFocus = function _onFocus() {
|
|
23336
|
-
this._wheelManager._onFocus();
|
|
23337
|
-
this._pointerManager._onFocus();
|
|
23338
|
-
this._keyboardManager._onFocus();
|
|
23339
|
-
};
|
|
23340
23293
|
_create_class$2(InputManager, [
|
|
23341
23294
|
{
|
|
23342
23295
|
key: "pointers",
|
|
@@ -23803,7 +23756,7 @@
|
|
|
23803
23756
|
_this._spriteMaskDefaultMaterial = _this._createSpriteMaskMaterial();
|
|
23804
23757
|
_this._textDefaultFont = Font.createFromOS(_assert_this_initialized(_this), "Arial");
|
|
23805
23758
|
_this._textDefaultFont.isGCIgnored = true;
|
|
23806
|
-
_this.inputManager = new InputManager(_assert_this_initialized(_this));
|
|
23759
|
+
_this.inputManager = new InputManager(_assert_this_initialized(_this), configuration.input);
|
|
23807
23760
|
var xrDevice = configuration.xrDevice;
|
|
23808
23761
|
if (xrDevice) {
|
|
23809
23762
|
_this.xrManager = new XRManager();
|
|
@@ -26628,7 +26581,12 @@
|
|
|
26628
26581
|
if (componentA.instanceId === componentB.instanceId) {
|
|
26629
26582
|
return dataA.material._priority - dataB.material._priority || componentA._distanceForSort - componentB._distanceForSort;
|
|
26630
26583
|
} else {
|
|
26631
|
-
|
|
26584
|
+
var distanceDiff = componentA._distanceForSort - componentB._distanceForSort;
|
|
26585
|
+
if (distanceDiff === 0) {
|
|
26586
|
+
return componentA.instanceId - componentB.instanceId;
|
|
26587
|
+
} else {
|
|
26588
|
+
return distanceDiff;
|
|
26589
|
+
}
|
|
26632
26590
|
}
|
|
26633
26591
|
};
|
|
26634
26592
|
/**
|
|
@@ -26646,7 +26604,12 @@
|
|
|
26646
26604
|
if (componentA.instanceId === componentB.instanceId) {
|
|
26647
26605
|
return dataA.material._priority - dataB.material._priority || componentB._distanceForSort - componentA._distanceForSort;
|
|
26648
26606
|
} else {
|
|
26649
|
-
|
|
26607
|
+
var distanceDiff = componentB._distanceForSort - componentA._distanceForSort;
|
|
26608
|
+
if (distanceDiff === 0) {
|
|
26609
|
+
return componentA.instanceId - componentB.instanceId;
|
|
26610
|
+
} else {
|
|
26611
|
+
return distanceDiff;
|
|
26612
|
+
}
|
|
26650
26613
|
}
|
|
26651
26614
|
};
|
|
26652
26615
|
return RenderQueue;
|
|
@@ -27847,14 +27810,14 @@
|
|
|
27847
27810
|
/** @internal */ _this._cameraIndex = -1;
|
|
27848
27811
|
_this._priority = 0;
|
|
27849
27812
|
_this._shaderData = new ShaderData(ShaderDataGroup.Camera);
|
|
27850
|
-
_this.
|
|
27813
|
+
_this._isCustomViewMatrix = false;
|
|
27814
|
+
_this._isCustomProjectionMatrix = false;
|
|
27851
27815
|
_this._nearClipPlane = 0.1;
|
|
27852
27816
|
_this._farClipPlane = 100;
|
|
27853
27817
|
_this._fieldOfView = 45;
|
|
27854
27818
|
_this._orthographicSize = 10;
|
|
27855
27819
|
_this._isProjectionDirty = true;
|
|
27856
27820
|
_this._isInvProjMatDirty = true;
|
|
27857
|
-
_this._isFrustumProjectDirty = true;
|
|
27858
27821
|
_this._customAspectRatio = undefined;
|
|
27859
27822
|
_this._renderTarget = null;
|
|
27860
27823
|
_this._depthBufferParams = new Vector4();
|
|
@@ -27866,7 +27829,7 @@
|
|
|
27866
27829
|
_this._transform = transform;
|
|
27867
27830
|
_this._isViewMatrixDirty = transform.registerWorldChangeFlag();
|
|
27868
27831
|
_this._isInvViewProjDirty = transform.registerWorldChangeFlag();
|
|
27869
|
-
_this.
|
|
27832
|
+
_this._frustumChangeFlag = transform.registerWorldChangeFlag();
|
|
27870
27833
|
_this._renderPipeline = new BasicRenderPipeline(_assert_this_initialized(_this));
|
|
27871
27834
|
_this._addResourceReferCount(_this.shaderData, 1);
|
|
27872
27835
|
_this._updatePixelViewport();
|
|
@@ -27879,16 +27842,22 @@
|
|
|
27879
27842
|
_inherits$2(Camera1, Component1);
|
|
27880
27843
|
var _proto = Camera1.prototype;
|
|
27881
27844
|
/**
|
|
27845
|
+
* Restore the view matrix to the world matrix of the entity.
|
|
27846
|
+
*/ _proto.resetViewMatrix = function resetViewMatrix() {
|
|
27847
|
+
this._isCustomViewMatrix = false;
|
|
27848
|
+
this._viewMatrixChange();
|
|
27849
|
+
};
|
|
27850
|
+
/**
|
|
27882
27851
|
* Restore the automatic calculation of projection matrix through fieldOfView, nearClipPlane and farClipPlane.
|
|
27883
27852
|
*/ _proto.resetProjectionMatrix = function resetProjectionMatrix() {
|
|
27884
|
-
this.
|
|
27885
|
-
this.
|
|
27853
|
+
this._isCustomProjectionMatrix = false;
|
|
27854
|
+
this._projectionMatrixChange();
|
|
27886
27855
|
};
|
|
27887
27856
|
/**
|
|
27888
27857
|
* Restore the automatic calculation of the aspect ratio through the viewport aspect ratio.
|
|
27889
27858
|
*/ _proto.resetAspectRatio = function resetAspectRatio() {
|
|
27890
27859
|
this._customAspectRatio = undefined;
|
|
27891
|
-
this.
|
|
27860
|
+
this._projectionMatrixChange();
|
|
27892
27861
|
};
|
|
27893
27862
|
/**
|
|
27894
27863
|
* Transform a point from world space to viewport space.
|
|
@@ -28018,10 +27987,9 @@
|
|
|
28018
27987
|
context.replacementShader = this._replacementShader;
|
|
28019
27988
|
context.replacementTag = this._replacementSubShaderTag;
|
|
28020
27989
|
// compute cull frustum.
|
|
28021
|
-
if (this.enableFrustumCulling &&
|
|
27990
|
+
if (this.enableFrustumCulling && this._frustumChangeFlag.flag) {
|
|
28022
27991
|
this._frustum.calculateFromMatrix(virtualCamera.viewProjectionMatrix);
|
|
28023
|
-
this.
|
|
28024
|
-
this._isFrustumProjectDirty = false;
|
|
27992
|
+
this._frustumChangeFlag.flag = false;
|
|
28025
27993
|
}
|
|
28026
27994
|
this._updateShaderData();
|
|
28027
27995
|
// union scene and camera macro.
|
|
@@ -28076,7 +28044,7 @@
|
|
|
28076
28044
|
this._renderPipeline = null;
|
|
28077
28045
|
this._virtualCamera = null;
|
|
28078
28046
|
this._shaderData = null;
|
|
28079
|
-
this.
|
|
28047
|
+
this._frustumChangeFlag = null;
|
|
28080
28048
|
this._transform = null;
|
|
28081
28049
|
this._isViewMatrixDirty = null;
|
|
28082
28050
|
this._isInvViewProjDirty = null;
|
|
@@ -28098,11 +28066,16 @@
|
|
|
28098
28066
|
var viewport = this._viewport;
|
|
28099
28067
|
this._pixelViewport.set(viewport.x * width, viewport.y * height, viewport.z * width, viewport.w * height);
|
|
28100
28068
|
};
|
|
28101
|
-
_proto.
|
|
28102
|
-
this.
|
|
28069
|
+
_proto._viewMatrixChange = function _viewMatrixChange() {
|
|
28070
|
+
this._isViewMatrixDirty.flag = true;
|
|
28071
|
+
this._isInvViewProjDirty.flag = true;
|
|
28072
|
+
this._frustumChangeFlag.flag = true;
|
|
28073
|
+
};
|
|
28074
|
+
_proto._projectionMatrixChange = function _projectionMatrixChange() {
|
|
28103
28075
|
this._isProjectionDirty = true;
|
|
28104
28076
|
this._isInvProjMatDirty = true;
|
|
28105
28077
|
this._isInvViewProjDirty.flag = true;
|
|
28078
|
+
this._frustumChangeFlag.flag = true;
|
|
28106
28079
|
};
|
|
28107
28080
|
_proto._innerViewportToWorldPoint = function _innerViewportToWorldPoint(x, y, z, invViewProjMat, out) {
|
|
28108
28081
|
// Depth is a normalized value, 0 is nearPlane, 1 is farClipPlane.
|
|
@@ -28145,7 +28118,7 @@
|
|
|
28145
28118
|
_proto._onPixelViewportChanged = function _onPixelViewportChanged() {
|
|
28146
28119
|
this._updatePixelViewport();
|
|
28147
28120
|
var _this__customAspectRatio;
|
|
28148
|
-
(_this__customAspectRatio = this._customAspectRatio) != null ? _this__customAspectRatio : this.
|
|
28121
|
+
(_this__customAspectRatio = this._customAspectRatio) != null ? _this__customAspectRatio : this._projectionMatrixChange();
|
|
28149
28122
|
};
|
|
28150
28123
|
_create_class$2(Camera1, [
|
|
28151
28124
|
{
|
|
@@ -28165,7 +28138,7 @@
|
|
|
28165
28138
|
},
|
|
28166
28139
|
set: function set(value) {
|
|
28167
28140
|
this._nearClipPlane = value;
|
|
28168
|
-
this.
|
|
28141
|
+
this._projectionMatrixChange();
|
|
28169
28142
|
}
|
|
28170
28143
|
},
|
|
28171
28144
|
{
|
|
@@ -28177,7 +28150,7 @@
|
|
|
28177
28150
|
},
|
|
28178
28151
|
set: function set(value) {
|
|
28179
28152
|
this._farClipPlane = value;
|
|
28180
|
-
this.
|
|
28153
|
+
this._projectionMatrixChange();
|
|
28181
28154
|
}
|
|
28182
28155
|
},
|
|
28183
28156
|
{
|
|
@@ -28189,7 +28162,7 @@
|
|
|
28189
28162
|
},
|
|
28190
28163
|
set: function set(value) {
|
|
28191
28164
|
this._fieldOfView = value;
|
|
28192
|
-
this.
|
|
28165
|
+
this._projectionMatrixChange();
|
|
28193
28166
|
}
|
|
28194
28167
|
},
|
|
28195
28168
|
{
|
|
@@ -28204,7 +28177,7 @@
|
|
|
28204
28177
|
},
|
|
28205
28178
|
set: function set(value) {
|
|
28206
28179
|
this._customAspectRatio = value;
|
|
28207
|
-
this.
|
|
28180
|
+
this._projectionMatrixChange();
|
|
28208
28181
|
}
|
|
28209
28182
|
},
|
|
28210
28183
|
{
|
|
@@ -28256,7 +28229,12 @@
|
|
|
28256
28229
|
},
|
|
28257
28230
|
set: function set(value) {
|
|
28258
28231
|
this._virtualCamera.isOrthographic = value;
|
|
28259
|
-
this.
|
|
28232
|
+
this._projectionMatrixChange();
|
|
28233
|
+
if (value) {
|
|
28234
|
+
this.shaderData.enableMacro("CAMERA_ORTHOGRAPHIC");
|
|
28235
|
+
} else {
|
|
28236
|
+
this.shaderData.disableMacro("CAMERA_ORTHOGRAPHIC");
|
|
28237
|
+
}
|
|
28260
28238
|
}
|
|
28261
28239
|
},
|
|
28262
28240
|
{
|
|
@@ -28268,7 +28246,7 @@
|
|
|
28268
28246
|
},
|
|
28269
28247
|
set: function set(value) {
|
|
28270
28248
|
this._orthographicSize = value;
|
|
28271
|
-
this.
|
|
28249
|
+
this._projectionMatrixChange();
|
|
28272
28250
|
}
|
|
28273
28251
|
},
|
|
28274
28252
|
{
|
|
@@ -28277,22 +28255,31 @@
|
|
|
28277
28255
|
* View matrix.
|
|
28278
28256
|
*/ function get() {
|
|
28279
28257
|
var viewMatrix = this._virtualCamera.viewMatrix;
|
|
28280
|
-
if (this._isViewMatrixDirty.flag) {
|
|
28281
|
-
|
|
28282
|
-
|
|
28283
|
-
|
|
28284
|
-
|
|
28285
|
-
|
|
28286
|
-
|
|
28258
|
+
if (!this._isViewMatrixDirty.flag || this._isCustomViewMatrix) {
|
|
28259
|
+
return viewMatrix;
|
|
28260
|
+
}
|
|
28261
|
+
this._isViewMatrixDirty.flag = false;
|
|
28262
|
+
// Ignore scale
|
|
28263
|
+
var transform = this._transform;
|
|
28264
|
+
Matrix.rotationTranslation(transform.worldRotationQuaternion, transform.worldPosition, viewMatrix);
|
|
28265
|
+
viewMatrix.invert();
|
|
28287
28266
|
return viewMatrix;
|
|
28267
|
+
},
|
|
28268
|
+
set: function set(value) {
|
|
28269
|
+
this._virtualCamera.viewMatrix.copyFrom(value);
|
|
28270
|
+
this._isCustomViewMatrix = true;
|
|
28271
|
+
this._viewMatrixChange();
|
|
28288
28272
|
}
|
|
28289
28273
|
},
|
|
28290
28274
|
{
|
|
28291
28275
|
key: "projectionMatrix",
|
|
28292
|
-
get:
|
|
28276
|
+
get: /**
|
|
28277
|
+
* The projection matrix is calculated by the relevant parameters of the camera by default.
|
|
28278
|
+
* If it is manually set, the manual value will be maintained. Call resetProjectionMatrix() to restore it.
|
|
28279
|
+
*/ function get() {
|
|
28293
28280
|
var virtualCamera = this._virtualCamera;
|
|
28294
28281
|
var projectionMatrix = virtualCamera.projectionMatrix;
|
|
28295
|
-
if (!this._isProjectionDirty || this.
|
|
28282
|
+
if (!this._isProjectionDirty || this._isCustomProjectionMatrix) {
|
|
28296
28283
|
return projectionMatrix;
|
|
28297
28284
|
}
|
|
28298
28285
|
this._isProjectionDirty = false;
|
|
@@ -28306,13 +28293,10 @@
|
|
|
28306
28293
|
}
|
|
28307
28294
|
return projectionMatrix;
|
|
28308
28295
|
},
|
|
28309
|
-
set:
|
|
28310
|
-
* The projection matrix is calculated by the relevant parameters of the camera by default.
|
|
28311
|
-
* If it is manually set, the manual value will be maintained. Call resetProjectionMatrix() to restore it.
|
|
28312
|
-
*/ function set(value) {
|
|
28296
|
+
set: function set(value) {
|
|
28313
28297
|
this._virtualCamera.projectionMatrix.copyFrom(value);
|
|
28314
|
-
this.
|
|
28315
|
-
this.
|
|
28298
|
+
this._isCustomProjectionMatrix = true;
|
|
28299
|
+
this._projectionMatrixChange();
|
|
28316
28300
|
}
|
|
28317
28301
|
},
|
|
28318
28302
|
{
|
|
@@ -28373,7 +28357,7 @@
|
|
|
28373
28357
|
], exports.Camera.prototype, "_cameraIndex", void 0);
|
|
28374
28358
|
__decorate$1([
|
|
28375
28359
|
ignoreClone
|
|
28376
|
-
], exports.Camera.prototype, "
|
|
28360
|
+
], exports.Camera.prototype, "_frustumChangeFlag", void 0);
|
|
28377
28361
|
__decorate$1([
|
|
28378
28362
|
ignoreClone
|
|
28379
28363
|
], exports.Camera.prototype, "_transform", void 0);
|
|
@@ -43563,6 +43547,84 @@
|
|
|
43563
43547
|
"mesh"
|
|
43564
43548
|
])
|
|
43565
43549
|
], MeshLoader);
|
|
43550
|
+
var PrimitiveMeshLoader = /*#__PURE__*/ function(Loader1) {
|
|
43551
|
+
var PrimitiveMeshLoader = function PrimitiveMeshLoader() {
|
|
43552
|
+
return Loader1.apply(this, arguments);
|
|
43553
|
+
};
|
|
43554
|
+
_inherits(PrimitiveMeshLoader, Loader1);
|
|
43555
|
+
var _proto = PrimitiveMeshLoader.prototype;
|
|
43556
|
+
_proto.load = function load(item, param) {
|
|
43557
|
+
var engine = param.engine;
|
|
43558
|
+
return this.request(item.url, _extends({}, item, {
|
|
43559
|
+
type: "json"
|
|
43560
|
+
})).then(function(data) {
|
|
43561
|
+
switch(data.type){
|
|
43562
|
+
case "sphere":
|
|
43563
|
+
return PrimitiveMesh.createSubdivisionSurfaceSphere(engine, data.sphereRadius, data.sphereStep);
|
|
43564
|
+
case "capsule":
|
|
43565
|
+
return PrimitiveMesh.createCapsule(engine, data.capsuleRadius, data.capsuleHeight, data.capsuleRadialSegments, data.capsuleHeightSegments);
|
|
43566
|
+
case "cone":
|
|
43567
|
+
return PrimitiveMesh.createCone(engine, data.coneRadius, data.coneHeight, data.coneRadialSegment, data.coneHeightSegment);
|
|
43568
|
+
case "cuboid":
|
|
43569
|
+
return PrimitiveMesh.createCuboid(engine, data.cuboidWidth, data.cuboidHeight, data.cuboidDepth);
|
|
43570
|
+
case "cylinder":
|
|
43571
|
+
return PrimitiveMesh.createCylinder(engine, data.cylinderRadiusTop, data.cylinderRadiusBottom, data.cylinderHeight, data.cylinderRadialSegment, data.cylinderHeightSegment);
|
|
43572
|
+
case "plane":
|
|
43573
|
+
return PrimitiveMesh.createPlane(engine, data.planeWidth, data.planeHeight, data.planeHorizontalSegments, data.planeVerticalSegments);
|
|
43574
|
+
case "torus":
|
|
43575
|
+
return PrimitiveMesh.createTorus(engine, data.torusRadius, data.torusTubeRadius, data.torusRadialSegments, data.torusTubularSegments, data.torusArc);
|
|
43576
|
+
}
|
|
43577
|
+
});
|
|
43578
|
+
};
|
|
43579
|
+
return PrimitiveMeshLoader;
|
|
43580
|
+
}(Loader);
|
|
43581
|
+
PrimitiveMeshLoader = __decorate([
|
|
43582
|
+
resourceLoader(exports.AssetType.PrimitiveMesh, [
|
|
43583
|
+
"mesh"
|
|
43584
|
+
], false)
|
|
43585
|
+
], PrimitiveMeshLoader);
|
|
43586
|
+
var /** @internal */ PrimitiveMeshType;
|
|
43587
|
+
(function(PrimitiveMeshType) {
|
|
43588
|
+
PrimitiveMeshType["Sphere"] = "sphere";
|
|
43589
|
+
PrimitiveMeshType["Cuboid"] = "cuboid";
|
|
43590
|
+
PrimitiveMeshType["Plane"] = "plane";
|
|
43591
|
+
PrimitiveMeshType["Cylinder"] = "cylinder";
|
|
43592
|
+
PrimitiveMeshType["Torus"] = "torus";
|
|
43593
|
+
PrimitiveMeshType["Cone"] = "cone";
|
|
43594
|
+
PrimitiveMeshType["Capsule"] = "capsule";
|
|
43595
|
+
})(PrimitiveMeshType || (PrimitiveMeshType = {}));
|
|
43596
|
+
var ProjectLoader = /*#__PURE__*/ function(Loader1) {
|
|
43597
|
+
var ProjectLoader = function ProjectLoader() {
|
|
43598
|
+
return Loader1.apply(this, arguments);
|
|
43599
|
+
};
|
|
43600
|
+
_inherits(ProjectLoader, Loader1);
|
|
43601
|
+
var _proto = ProjectLoader.prototype;
|
|
43602
|
+
_proto.load = function load(item, resourceManager) {
|
|
43603
|
+
var _this = this;
|
|
43604
|
+
var engine = resourceManager.engine;
|
|
43605
|
+
return new AssetPromise(function(resolve, reject) {
|
|
43606
|
+
_this.request(item.url, {
|
|
43607
|
+
type: "json"
|
|
43608
|
+
}).then(function(data) {
|
|
43609
|
+
// @ts-ignore
|
|
43610
|
+
engine.resourceManager.initVirtualResources(data.files);
|
|
43611
|
+
return resourceManager.load({
|
|
43612
|
+
type: exports.AssetType.Scene,
|
|
43613
|
+
url: data.scene
|
|
43614
|
+
}).then(function(scene) {
|
|
43615
|
+
engine.sceneManager.activeScene = scene;
|
|
43616
|
+
resolve();
|
|
43617
|
+
});
|
|
43618
|
+
}).catch(reject);
|
|
43619
|
+
});
|
|
43620
|
+
};
|
|
43621
|
+
return ProjectLoader;
|
|
43622
|
+
}(Loader);
|
|
43623
|
+
ProjectLoader = __decorate([
|
|
43624
|
+
resourceLoader(exports.AssetType.Project, [
|
|
43625
|
+
"proj"
|
|
43626
|
+
], false)
|
|
43627
|
+
], ProjectLoader);
|
|
43566
43628
|
var SourceFontLoader = /*#__PURE__*/ function(Loader1) {
|
|
43567
43629
|
var SourceFontLoader = function SourceFontLoader() {
|
|
43568
43630
|
return Loader1.apply(this, arguments);
|
|
@@ -43891,38 +43953,6 @@
|
|
|
43891
43953
|
""
|
|
43892
43954
|
])
|
|
43893
43955
|
], TextureCubeLoader);
|
|
43894
|
-
var ProjectLoader = /*#__PURE__*/ function(Loader1) {
|
|
43895
|
-
var ProjectLoader = function ProjectLoader() {
|
|
43896
|
-
return Loader1.apply(this, arguments);
|
|
43897
|
-
};
|
|
43898
|
-
_inherits(ProjectLoader, Loader1);
|
|
43899
|
-
var _proto = ProjectLoader.prototype;
|
|
43900
|
-
_proto.load = function load(item, resourceManager) {
|
|
43901
|
-
var _this = this;
|
|
43902
|
-
var engine = resourceManager.engine;
|
|
43903
|
-
return new AssetPromise(function(resolve, reject) {
|
|
43904
|
-
_this.request(item.url, {
|
|
43905
|
-
type: "json"
|
|
43906
|
-
}).then(function(data) {
|
|
43907
|
-
// @ts-ignore
|
|
43908
|
-
engine.resourceManager.initVirtualResources(data.files);
|
|
43909
|
-
return resourceManager.load({
|
|
43910
|
-
type: exports.AssetType.Scene,
|
|
43911
|
-
url: data.scene
|
|
43912
|
-
}).then(function(scene) {
|
|
43913
|
-
engine.sceneManager.activeScene = scene;
|
|
43914
|
-
resolve();
|
|
43915
|
-
});
|
|
43916
|
-
}).catch(reject);
|
|
43917
|
-
});
|
|
43918
|
-
};
|
|
43919
|
-
return ProjectLoader;
|
|
43920
|
-
}(Loader);
|
|
43921
|
-
ProjectLoader = __decorate([
|
|
43922
|
-
resourceLoader(exports.AssetType.Project, [
|
|
43923
|
-
"proj"
|
|
43924
|
-
], false)
|
|
43925
|
-
], ProjectLoader);
|
|
43926
43956
|
var SceneLoader = /*#__PURE__*/ function(Loader1) {
|
|
43927
43957
|
var SceneLoader = function SceneLoader() {
|
|
43928
43958
|
return Loader1.apply(this, arguments);
|
|
@@ -44400,7 +44430,7 @@
|
|
|
44400
44430
|
], KHR_materials_anisotropy);
|
|
44401
44431
|
|
|
44402
44432
|
//@ts-ignore
|
|
44403
|
-
var version = "1.2.0-alpha.
|
|
44433
|
+
var version = "1.2.0-alpha.2";
|
|
44404
44434
|
console.log("Galacean engine version: " + version);
|
|
44405
44435
|
for(var key in CoreObjects){
|
|
44406
44436
|
Loader.registerClass(key, CoreObjects[key]);
|