@galacean/engine-core 1.2.0-alpha.1 → 1.2.0-alpha.3
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 +180 -195
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +180 -195
- package/dist/module.js +180 -195
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/Camera.d.ts +11 -5
- package/types/Engine.d.ts +4 -2
- package/types/Utils.d.ts +6 -0
- package/types/asset/AssetType.d.ts +2 -0
- package/types/asset/ResourceManager.d.ts +2 -0
- package/types/input/InputManager.d.ts +0 -2
- package/types/input/interface/IInput.d.ts +0 -8
- package/types/shaderlib/ShaderFactory.d.ts +5 -1
package/dist/main.js
CHANGED
|
@@ -599,7 +599,14 @@ var Utils = /*#__PURE__*/ function() {
|
|
|
599
599
|
* @param url - The url to be judged.
|
|
600
600
|
* @returns Whether the url is absolute url.
|
|
601
601
|
*/ Utils.isAbsoluteUrl = function isAbsoluteUrl(url) {
|
|
602
|
-
return /^(
|
|
602
|
+
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
|
603
|
+
};
|
|
604
|
+
/**
|
|
605
|
+
* Judge whether the url is base64 url.
|
|
606
|
+
* @param url - The url to be judged.
|
|
607
|
+
* @returns Whether the url is base64 url.
|
|
608
|
+
*/ Utils.isBase64Url = function isBase64Url(url) {
|
|
609
|
+
return /^data:.*,.*$/i.test(url);
|
|
603
610
|
};
|
|
604
611
|
/**
|
|
605
612
|
* Get the values of an object.
|
|
@@ -617,7 +624,10 @@ var Utils = /*#__PURE__*/ function() {
|
|
|
617
624
|
if (Utils.isAbsoluteUrl(relativeUrl)) {
|
|
618
625
|
return relativeUrl;
|
|
619
626
|
}
|
|
620
|
-
|
|
627
|
+
if (Utils.isBase64Url(relativeUrl)) {
|
|
628
|
+
return relativeUrl;
|
|
629
|
+
}
|
|
630
|
+
return relativeUrl ? baseUrl.replace(/\/+$/, "") + "/" + relativeUrl.replace(/^\/+/, "") : baseUrl;
|
|
621
631
|
};
|
|
622
632
|
/**
|
|
623
633
|
* @internal
|
|
@@ -3173,7 +3183,7 @@ function _extends() {
|
|
|
3173
3183
|
return _extends.apply(this, arguments);
|
|
3174
3184
|
}
|
|
3175
3185
|
|
|
3176
|
-
var camera_declare = "#define GLSLIFY 1\nuniform vec3 camera_Position;"; // eslint-disable-line
|
|
3186
|
+
var camera_declare = "#define GLSLIFY 1\nuniform vec3 camera_Position;uniform vec3 camera_Forward;"; // eslint-disable-line
|
|
3177
3187
|
|
|
3178
3188
|
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
|
|
3179
3189
|
|
|
@@ -3223,7 +3233,7 @@ var mobile_material_frag = "#define GLSLIFY 1\nuniform vec4 material_EmissiveCol
|
|
|
3223
3233
|
|
|
3224
3234
|
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
|
|
3225
3235
|
|
|
3226
|
-
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
|
|
3236
|
+
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
|
|
3227
3237
|
|
|
3228
3238
|
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
|
|
3229
3239
|
|
|
@@ -3261,7 +3271,7 @@ var noise_simplex_4D = "#define GLSLIFY 1\nvec4 grad4(float j,vec4 ip){const vec
|
|
|
3261
3271
|
|
|
3262
3272
|
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
|
|
3263
3273
|
|
|
3264
|
-
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
|
|
3274
|
+
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
|
|
3265
3275
|
|
|
3266
3276
|
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
|
|
3267
3277
|
|
|
@@ -3397,7 +3407,11 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
3397
3407
|
}
|
|
3398
3408
|
ShaderLib[includeName] = includeSource;
|
|
3399
3409
|
};
|
|
3400
|
-
|
|
3410
|
+
/**
|
|
3411
|
+
* @param regex The default regex is for engine's builtin glsl `#include` syntax,
|
|
3412
|
+
* since `ShaderLab` use the same parsing function but different syntax for `#include` --- `/^[ \t]*#include +"([\w\d.]+)"/gm`
|
|
3413
|
+
*/ ShaderFactory.parseIncludes = function parseIncludes(src, regex) {
|
|
3414
|
+
if (regex === void 0) regex = /^[ \t]*#include +<([\w\d.]+)>/gm;
|
|
3401
3415
|
var replace = function replace(match, slice) {
|
|
3402
3416
|
var replace = ShaderLib[slice];
|
|
3403
3417
|
if (replace === undefined) {
|
|
@@ -3406,7 +3420,6 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
3406
3420
|
}
|
|
3407
3421
|
return ShaderFactory.parseIncludes(replace);
|
|
3408
3422
|
};
|
|
3409
|
-
var regex = /^[ \t]*#include +<([\w\d.]+)>/gm;
|
|
3410
3423
|
return src.replace(regex, replace);
|
|
3411
3424
|
};
|
|
3412
3425
|
/**
|
|
@@ -6388,7 +6401,7 @@ SlicedSpriteAssembler = __decorate([
|
|
|
6388
6401
|
_this._byteLength = byteLength;
|
|
6389
6402
|
_this._platformBuffer = engine._hardwareRenderer.createPlatformBuffer(type, byteLength, bufferUsage, data);
|
|
6390
6403
|
if (readable) {
|
|
6391
|
-
var buffer =
|
|
6404
|
+
var buffer = data.constructor === ArrayBuffer ? data.slice(0) : data.buffer.slice(data.byteOffset, data.byteOffset + byteLength);
|
|
6392
6405
|
_this._data = new Uint8Array(buffer);
|
|
6393
6406
|
}
|
|
6394
6407
|
}
|
|
@@ -12883,6 +12896,9 @@ var /**
|
|
|
12883
12896
|
var baseline = Math.ceil(context.measureText(TextUtils._measureBaseline).width);
|
|
12884
12897
|
var height = baseline * TextUtils._heightMultiplier;
|
|
12885
12898
|
baseline = TextUtils._baselineMultiplier * baseline | 0;
|
|
12899
|
+
var _extendHeight = TextUtils._extendHeight;
|
|
12900
|
+
height += _extendHeight;
|
|
12901
|
+
baseline += _extendHeight * 0.5;
|
|
12886
12902
|
canvas.width = width;
|
|
12887
12903
|
canvas.height = height;
|
|
12888
12904
|
context.font = fontString;
|
|
@@ -12917,6 +12933,7 @@ var /**
|
|
|
12917
12933
|
}
|
|
12918
12934
|
if (top !== -1 && bottom !== -1) {
|
|
12919
12935
|
ascent = baseline - top;
|
|
12936
|
+
// Baseline belong to descent
|
|
12920
12937
|
descent = bottom - baseline + 1;
|
|
12921
12938
|
size = ascent + descent;
|
|
12922
12939
|
}
|
|
@@ -12993,9 +13010,8 @@ var /**
|
|
|
12993
13010
|
];
|
|
12994
13011
|
})();
|
|
12995
13012
|
(function() {
|
|
12996
|
-
//
|
|
12997
|
-
|
|
12998
|
-
/** @internal */ TextUtils._heightMultiplier = 2;
|
|
13013
|
+
// _extendHeight used to extend the height of canvas, because in miniprogram performance is different from h5.
|
|
13014
|
+
/** @internal */ TextUtils._extendHeight = 0;
|
|
12999
13015
|
})();
|
|
13000
13016
|
(function() {
|
|
13001
13017
|
/** These characters are all tall to help calculate the height required for text. */ TextUtils._measureString = "|\xc9q\xc5";
|
|
@@ -13003,6 +13019,9 @@ var /**
|
|
|
13003
13019
|
(function() {
|
|
13004
13020
|
TextUtils._measureBaseline = "M";
|
|
13005
13021
|
})();
|
|
13022
|
+
(function() {
|
|
13023
|
+
TextUtils._heightMultiplier = 2;
|
|
13024
|
+
})();
|
|
13006
13025
|
(function() {
|
|
13007
13026
|
TextUtils._baselineMultiplier = 1.4;
|
|
13008
13027
|
})();
|
|
@@ -14761,6 +14780,7 @@ var TextRenderData = /*#__PURE__*/ function(RenderData1) {
|
|
|
14761
14780
|
AssetType[/** Cube Compress Texture. */ "KTXCube"] = "KTXCube";
|
|
14762
14781
|
AssetType[/** KTX2 Compress Texture */ "KTX2"] = "KTX2";
|
|
14763
14782
|
AssetType[/** Sprite. */ "Sprite"] = "Sprite";
|
|
14783
|
+
AssetType[/** PrimitiveMesh. */ "PrimitiveMesh"] = "PrimitiveMesh";
|
|
14764
14784
|
AssetType[/** Sprite Atlas. */ "SpriteAtlas"] = "SpriteAtlas";
|
|
14765
14785
|
AssetType[/** Ambient light. */ "Env"] = "Environment";
|
|
14766
14786
|
AssetType[/** Scene. */ "Scene"] = "Scene";
|
|
@@ -15146,6 +15166,7 @@ var /** @internal */ PromiseState;
|
|
|
15146
15166
|
this./** The number of retries after failing to load assets. */ retryCount = 1;
|
|
15147
15167
|
this./** Retry delay time after failed to load assets, in milliseconds. */ retryInterval = 0;
|
|
15148
15168
|
this./** The default timeout period for loading assets, in milliseconds. */ timeout = Infinity;
|
|
15169
|
+
this./** Base url for loading assets. */ baseUrl = null;
|
|
15149
15170
|
this._loadingPromises = {};
|
|
15150
15171
|
this._assetPool = Object.create(null);
|
|
15151
15172
|
this._assetUrlPool = Object.create(null);
|
|
@@ -15349,6 +15370,8 @@ var /** @internal */ PromiseState;
|
|
|
15349
15370
|
// Check url mapping
|
|
15350
15371
|
var itemURL = item.url;
|
|
15351
15372
|
var url = this._virtualPathMap[itemURL] ? this._virtualPathMap[itemURL] : itemURL;
|
|
15373
|
+
// Not absolute and base url is set
|
|
15374
|
+
if (!Utils.isAbsoluteUrl(url) && this.baseUrl) url = Utils.resolveAbsoluteUrl(this.baseUrl, url);
|
|
15352
15375
|
// Parse url
|
|
15353
15376
|
var _this__parseURL = this._parseURL(url), assetBaseURL = _this__parseURL.assetBaseURL, queryPath = _this__parseURL.queryPath;
|
|
15354
15377
|
var paths = queryPath ? this._parseQueryPath(queryPath) : [];
|
|
@@ -16039,7 +16062,7 @@ SystemInfo._initialize();
|
|
|
16039
16062
|
* Keyboard Manager.
|
|
16040
16063
|
* @internal
|
|
16041
16064
|
*/ var KeyboardManager = /*#__PURE__*/ function() {
|
|
16042
|
-
function KeyboardManager(engine) {
|
|
16065
|
+
function KeyboardManager(engine, target) {
|
|
16043
16066
|
/** @internal */ this._curHeldDownKeyToIndexMap = [];
|
|
16044
16067
|
/** @internal */ this._upKeyToFrameCountMap = [];
|
|
16045
16068
|
/** @internal */ this._downKeyToFrameCountMap = [];
|
|
@@ -16047,17 +16070,11 @@ SystemInfo._initialize();
|
|
|
16047
16070
|
/** @internal */ this._curFrameDownList = new DisorderedArray();
|
|
16048
16071
|
/** @internal */ this._curFrameUpList = new DisorderedArray();
|
|
16049
16072
|
this._nativeEvents = [];
|
|
16050
|
-
this._hadListener = false;
|
|
16051
|
-
// @ts-ignore
|
|
16052
|
-
var htmlCanvas = engine._canvas._webCanvas;
|
|
16053
16073
|
this._engine = engine;
|
|
16054
|
-
this.
|
|
16055
|
-
// Need to set tabIndex to make the canvas focus.
|
|
16056
|
-
htmlCanvas.tabIndex = htmlCanvas.tabIndex;
|
|
16074
|
+
this._onBlur = this._onBlur.bind(this);
|
|
16057
16075
|
this._onKeyEvent = this._onKeyEvent.bind(this);
|
|
16058
|
-
|
|
16059
|
-
|
|
16060
|
-
this._hadListener = true;
|
|
16076
|
+
this._target = target;
|
|
16077
|
+
this._addEventListener();
|
|
16061
16078
|
}
|
|
16062
16079
|
var _proto = KeyboardManager.prototype;
|
|
16063
16080
|
/**
|
|
@@ -16109,35 +16126,8 @@ SystemInfo._initialize();
|
|
|
16109
16126
|
};
|
|
16110
16127
|
/**
|
|
16111
16128
|
* @internal
|
|
16112
|
-
*/ _proto._onFocus = function _onFocus() {
|
|
16113
|
-
if (!this._hadListener) {
|
|
16114
|
-
this._htmlCanvas.addEventListener("keydown", this._onKeyEvent);
|
|
16115
|
-
this._htmlCanvas.addEventListener("keyup", this._onKeyEvent);
|
|
16116
|
-
this._hadListener = true;
|
|
16117
|
-
}
|
|
16118
|
-
};
|
|
16119
|
-
/**
|
|
16120
|
-
* @internal
|
|
16121
|
-
*/ _proto._onBlur = function _onBlur() {
|
|
16122
|
-
if (this._hadListener) {
|
|
16123
|
-
this._htmlCanvas.removeEventListener("keydown", this._onKeyEvent);
|
|
16124
|
-
this._htmlCanvas.removeEventListener("keyup", this._onKeyEvent);
|
|
16125
|
-
this._curHeldDownKeyToIndexMap.length = 0;
|
|
16126
|
-
this._curFrameHeldDownList.length = 0;
|
|
16127
|
-
this._curFrameDownList.length = 0;
|
|
16128
|
-
this._curFrameUpList.length = 0;
|
|
16129
|
-
this._nativeEvents.length = 0;
|
|
16130
|
-
this._hadListener = false;
|
|
16131
|
-
}
|
|
16132
|
-
};
|
|
16133
|
-
/**
|
|
16134
|
-
* @internal
|
|
16135
16129
|
*/ _proto._destroy = function _destroy() {
|
|
16136
|
-
|
|
16137
|
-
this._htmlCanvas.removeEventListener("keydown", this._onKeyEvent);
|
|
16138
|
-
this._htmlCanvas.removeEventListener("keyup", this._onKeyEvent);
|
|
16139
|
-
this._hadListener = false;
|
|
16140
|
-
}
|
|
16130
|
+
this._removeEventListener();
|
|
16141
16131
|
this._curHeldDownKeyToIndexMap.length = 0;
|
|
16142
16132
|
this._curHeldDownKeyToIndexMap = null;
|
|
16143
16133
|
this._upKeyToFrameCountMap.length = 0;
|
|
@@ -16152,12 +16142,30 @@ SystemInfo._initialize();
|
|
|
16152
16142
|
this._curFrameDownList = null;
|
|
16153
16143
|
this._curFrameUpList.length = 0;
|
|
16154
16144
|
this._curFrameUpList = null;
|
|
16155
|
-
this._htmlCanvas = null;
|
|
16156
16145
|
this._engine = null;
|
|
16157
16146
|
};
|
|
16147
|
+
_proto._onBlur = function _onBlur() {
|
|
16148
|
+
this._curHeldDownKeyToIndexMap.length = 0;
|
|
16149
|
+
this._curFrameHeldDownList.length = 0;
|
|
16150
|
+
this._curFrameDownList.length = 0;
|
|
16151
|
+
this._curFrameUpList.length = 0;
|
|
16152
|
+
this._nativeEvents.length = 0;
|
|
16153
|
+
};
|
|
16158
16154
|
_proto._onKeyEvent = function _onKeyEvent(evt) {
|
|
16159
16155
|
this._nativeEvents.push(evt);
|
|
16160
16156
|
};
|
|
16157
|
+
_proto._addEventListener = function _addEventListener() {
|
|
16158
|
+
var _this = this, target = _this._target;
|
|
16159
|
+
target.addEventListener("keydown", this._onKeyEvent);
|
|
16160
|
+
target.addEventListener("keyup", this._onKeyEvent);
|
|
16161
|
+
target.addEventListener("blur", this._onBlur);
|
|
16162
|
+
};
|
|
16163
|
+
_proto._removeEventListener = function _removeEventListener() {
|
|
16164
|
+
var _this = this, target = _this._target;
|
|
16165
|
+
target.removeEventListener("keydown", this._onKeyEvent);
|
|
16166
|
+
target.removeEventListener("keyup", this._onKeyEvent);
|
|
16167
|
+
target.removeEventListener("blur", this._onBlur);
|
|
16168
|
+
};
|
|
16161
16169
|
return KeyboardManager;
|
|
16162
16170
|
}();
|
|
16163
16171
|
|
|
@@ -18121,7 +18129,7 @@ __decorate([
|
|
|
18121
18129
|
* Pointer Manager.
|
|
18122
18130
|
* @internal
|
|
18123
18131
|
*/ var PointerManager = /*#__PURE__*/ function() {
|
|
18124
|
-
function PointerManager(engine) {
|
|
18132
|
+
function PointerManager(engine, target) {
|
|
18125
18133
|
/** @internal */ this._pointers = [];
|
|
18126
18134
|
/** @internal */ this._multiPointerEnabled = true;
|
|
18127
18135
|
/** @internal */ this._buttons = exports.PointerButton.None;
|
|
@@ -18130,16 +18138,18 @@ __decorate([
|
|
|
18130
18138
|
/** @internal */ this._upList = new DisorderedArray();
|
|
18131
18139
|
/** @internal */ this._downList = new DisorderedArray();
|
|
18132
18140
|
this._nativeEvents = [];
|
|
18133
|
-
|
|
18134
|
-
|
|
18135
|
-
|
|
18141
|
+
if (_instanceof(target, Window)) {
|
|
18142
|
+
throw "Do not set window as target because window cannot listen to pointer leave event.";
|
|
18143
|
+
}
|
|
18136
18144
|
this._engine = engine;
|
|
18145
|
+
this._target = target;
|
|
18137
18146
|
this._canvas = engine.canvas;
|
|
18138
|
-
|
|
18139
|
-
this.
|
|
18140
|
-
this._onFocus();
|
|
18147
|
+
// @ts-ignore
|
|
18148
|
+
this._htmlCanvas = engine._canvas._webCanvas;
|
|
18141
18149
|
// If there are no compatibility issues, navigator.maxTouchPoints should be used here
|
|
18142
18150
|
this._pointerPool = new Array(11);
|
|
18151
|
+
this._onPointerEvent = this._onPointerEvent.bind(this);
|
|
18152
|
+
this._addEventListener();
|
|
18143
18153
|
}
|
|
18144
18154
|
var _proto = PointerManager.prototype;
|
|
18145
18155
|
/**
|
|
@@ -18209,7 +18219,8 @@ __decorate([
|
|
|
18209
18219
|
var length = events.length;
|
|
18210
18220
|
if (length > 0) {
|
|
18211
18221
|
for(var i1 = 0; i1 < length; i1++){
|
|
18212
|
-
|
|
18222
|
+
var event = events[i1];
|
|
18223
|
+
switch(event.type){
|
|
18213
18224
|
case "pointerdown":
|
|
18214
18225
|
pointer.phase = exports.PointerPhase.Down;
|
|
18215
18226
|
pointer._firePointerDown(rayCastEntity);
|
|
@@ -18231,66 +18242,14 @@ __decorate([
|
|
|
18231
18242
|
};
|
|
18232
18243
|
/**
|
|
18233
18244
|
* @internal
|
|
18234
|
-
*/ _proto._onFocus = function _onFocus() {
|
|
18235
|
-
if (!this._hadListener) {
|
|
18236
|
-
var _this = this, htmlCanvas = _this._htmlCanvas, onPointerEvent = _this._onPointerEvent;
|
|
18237
|
-
htmlCanvas.addEventListener("pointerdown", onPointerEvent);
|
|
18238
|
-
htmlCanvas.addEventListener("pointerup", onPointerEvent);
|
|
18239
|
-
htmlCanvas.addEventListener("pointerleave", onPointerEvent);
|
|
18240
|
-
htmlCanvas.addEventListener("pointermove", onPointerEvent);
|
|
18241
|
-
htmlCanvas.addEventListener("pointercancel", onPointerEvent);
|
|
18242
|
-
this._hadListener = true;
|
|
18243
|
-
}
|
|
18244
|
-
};
|
|
18245
|
-
/**
|
|
18246
|
-
* @internal
|
|
18247
|
-
*/ _proto._onBlur = function _onBlur() {
|
|
18248
|
-
if (this._hadListener) {
|
|
18249
|
-
var _this = this, htmlCanvas = _this._htmlCanvas, onPointerEvent = _this._onPointerEvent;
|
|
18250
|
-
htmlCanvas.removeEventListener("pointerdown", onPointerEvent);
|
|
18251
|
-
htmlCanvas.removeEventListener("pointerup", onPointerEvent);
|
|
18252
|
-
htmlCanvas.removeEventListener("pointerleave", onPointerEvent);
|
|
18253
|
-
htmlCanvas.removeEventListener("pointermove", onPointerEvent);
|
|
18254
|
-
htmlCanvas.removeEventListener("pointercancel", onPointerEvent);
|
|
18255
|
-
this._hadListener = false;
|
|
18256
|
-
this._pointers.length = 0;
|
|
18257
|
-
this._downList.length = 0;
|
|
18258
|
-
this._upList.length = 0;
|
|
18259
|
-
}
|
|
18260
|
-
};
|
|
18261
|
-
/**
|
|
18262
|
-
* @internal
|
|
18263
18245
|
*/ _proto._destroy = function _destroy() {
|
|
18264
|
-
|
|
18265
|
-
if (this._hadListener) {
|
|
18266
|
-
var _this = this, htmlCanvas = _this._htmlCanvas, onPointerEvent = _this._onPointerEvent;
|
|
18267
|
-
htmlCanvas.removeEventListener("pointerdown", onPointerEvent);
|
|
18268
|
-
htmlCanvas.removeEventListener("pointerup", onPointerEvent);
|
|
18269
|
-
htmlCanvas.removeEventListener("pointerleave", onPointerEvent);
|
|
18270
|
-
htmlCanvas.removeEventListener("pointermove", onPointerEvent);
|
|
18271
|
-
htmlCanvas.removeEventListener("pointercancel", onPointerEvent);
|
|
18272
|
-
this._hadListener = false;
|
|
18273
|
-
}
|
|
18246
|
+
this._removeEventListener();
|
|
18274
18247
|
this._pointerPool.length = 0;
|
|
18275
|
-
this._pointerPool = null;
|
|
18276
|
-
this._pointers.length = 0;
|
|
18277
|
-
this._pointers = null;
|
|
18278
|
-
this._downList.length = 0;
|
|
18279
|
-
this._downList = null;
|
|
18280
|
-
this._upList.length = 0;
|
|
18281
|
-
this._upList = null;
|
|
18282
18248
|
this._nativeEvents.length = 0;
|
|
18283
|
-
this._nativeEvents = null;
|
|
18284
|
-
this._upMap.length = 0;
|
|
18285
|
-
this._upMap = null;
|
|
18286
18249
|
this._downMap.length = 0;
|
|
18287
|
-
this.
|
|
18288
|
-
this._htmlCanvas = null;
|
|
18289
|
-
this._canvas = null;
|
|
18290
|
-
this._engine = null;
|
|
18250
|
+
this._upMap.length = 0;
|
|
18291
18251
|
};
|
|
18292
18252
|
_proto._onPointerEvent = function _onPointerEvent(evt) {
|
|
18293
|
-
evt.type === "pointerdown" && this._htmlCanvas.focus();
|
|
18294
18253
|
this._nativeEvents.push(evt);
|
|
18295
18254
|
};
|
|
18296
18255
|
_proto._getPointerByID = function _getPointerByID(pointerId) {
|
|
@@ -18373,6 +18332,26 @@ __decorate([
|
|
|
18373
18332
|
}
|
|
18374
18333
|
return null;
|
|
18375
18334
|
};
|
|
18335
|
+
_proto._addEventListener = function _addEventListener() {
|
|
18336
|
+
var _this = this, target = _this._target, onPointerEvent = _this._onPointerEvent;
|
|
18337
|
+
target.addEventListener("pointerdown", onPointerEvent);
|
|
18338
|
+
target.addEventListener("pointerup", onPointerEvent);
|
|
18339
|
+
target.addEventListener("pointerleave", onPointerEvent);
|
|
18340
|
+
target.addEventListener("pointermove", onPointerEvent);
|
|
18341
|
+
target.addEventListener("pointercancel", onPointerEvent);
|
|
18342
|
+
};
|
|
18343
|
+
_proto._removeEventListener = function _removeEventListener() {
|
|
18344
|
+
var _this = this, target = _this._target, onPointerEvent = _this._onPointerEvent;
|
|
18345
|
+
target.removeEventListener("pointerdown", onPointerEvent);
|
|
18346
|
+
target.removeEventListener("pointerup", onPointerEvent);
|
|
18347
|
+
target.removeEventListener("pointerleave", onPointerEvent);
|
|
18348
|
+
target.removeEventListener("pointermove", onPointerEvent);
|
|
18349
|
+
target.removeEventListener("pointercancel", onPointerEvent);
|
|
18350
|
+
this._nativeEvents.length = 0;
|
|
18351
|
+
this._pointers.length = 0;
|
|
18352
|
+
this._downList.length = 0;
|
|
18353
|
+
this._upList.length = 0;
|
|
18354
|
+
};
|
|
18376
18355
|
return PointerManager;
|
|
18377
18356
|
}();
|
|
18378
18357
|
(function() {
|
|
@@ -18389,15 +18368,12 @@ __decorate([
|
|
|
18389
18368
|
* Wheel Manager.
|
|
18390
18369
|
* @internal
|
|
18391
18370
|
*/ var WheelManager = /*#__PURE__*/ function() {
|
|
18392
|
-
function WheelManager(engine) {
|
|
18371
|
+
function WheelManager(engine, target) {
|
|
18393
18372
|
/** @internal */ this._delta = new engineMath.Vector3();
|
|
18394
18373
|
this._nativeEvents = [];
|
|
18395
|
-
// @ts-ignore
|
|
18396
|
-
var htmlCanvas = engine._canvas._webCanvas;
|
|
18397
18374
|
this._onWheelEvent = this._onWheelEvent.bind(this);
|
|
18398
|
-
|
|
18399
|
-
this.
|
|
18400
|
-
this._hadListener = true;
|
|
18375
|
+
this._target = target;
|
|
18376
|
+
this._addEventListener();
|
|
18401
18377
|
}
|
|
18402
18378
|
var _proto = WheelManager.prototype;
|
|
18403
18379
|
/**
|
|
@@ -18418,35 +18394,24 @@ __decorate([
|
|
|
18418
18394
|
};
|
|
18419
18395
|
/**
|
|
18420
18396
|
* @internal
|
|
18421
|
-
*/ _proto.
|
|
18422
|
-
|
|
18423
|
-
this._canvas.addEventListener("wheel", this._onWheelEvent);
|
|
18424
|
-
this._hadListener = true;
|
|
18425
|
-
}
|
|
18397
|
+
*/ _proto._addEventListener = function _addEventListener() {
|
|
18398
|
+
this._target.addEventListener("wheel", this._onWheelEvent);
|
|
18426
18399
|
};
|
|
18427
18400
|
/**
|
|
18428
18401
|
* @internal
|
|
18429
|
-
*/ _proto.
|
|
18430
|
-
|
|
18431
|
-
|
|
18432
|
-
|
|
18433
|
-
this._delta.set(0, 0, 0);
|
|
18434
|
-
this._hadListener = false;
|
|
18435
|
-
}
|
|
18402
|
+
*/ _proto._removeEventListener = function _removeEventListener() {
|
|
18403
|
+
this._target.removeEventListener("wheel", this._onWheelEvent);
|
|
18404
|
+
this._nativeEvents.length = 0;
|
|
18405
|
+
this._delta.set(0, 0, 0);
|
|
18436
18406
|
};
|
|
18437
18407
|
/**
|
|
18438
18408
|
* @internal
|
|
18439
18409
|
*/ _proto._destroy = function _destroy() {
|
|
18440
|
-
|
|
18441
|
-
this._canvas.removeEventListener("wheel", this._onWheelEvent);
|
|
18442
|
-
this._hadListener = false;
|
|
18443
|
-
}
|
|
18410
|
+
this._removeEventListener();
|
|
18444
18411
|
this._nativeEvents = null;
|
|
18445
|
-
this._canvas = null;
|
|
18446
18412
|
this._delta = null;
|
|
18447
18413
|
};
|
|
18448
18414
|
_proto._onWheelEvent = function _onWheelEvent(evt) {
|
|
18449
|
-
evt.cancelable && evt.preventDefault();
|
|
18450
18415
|
this._nativeEvents.push(evt);
|
|
18451
18416
|
};
|
|
18452
18417
|
return WheelManager;
|
|
@@ -18455,19 +18420,19 @@ __decorate([
|
|
|
18455
18420
|
/**
|
|
18456
18421
|
* InputManager manages device input such as mouse, touch, keyboard, etc.
|
|
18457
18422
|
*/ var InputManager = /*#__PURE__*/ function() {
|
|
18458
|
-
function InputManager(engine) {
|
|
18423
|
+
function InputManager(engine, inputOptions) {
|
|
18459
18424
|
/** Sometimes the input module will not be initialized, such as off-screen rendering. */ this._initialized = false;
|
|
18460
18425
|
this._engine = engine;
|
|
18461
18426
|
// @ts-ignore
|
|
18462
18427
|
var canvas = engine._canvas._webCanvas;
|
|
18463
18428
|
if (typeof OffscreenCanvas === "undefined" || !_instanceof(canvas, OffscreenCanvas)) {
|
|
18464
|
-
|
|
18465
|
-
|
|
18466
|
-
this.
|
|
18467
|
-
|
|
18468
|
-
|
|
18469
|
-
|
|
18470
|
-
|
|
18429
|
+
var _inputOptions, _inputOptions1, _inputOptions2;
|
|
18430
|
+
var _inputOptions_wheelTarget;
|
|
18431
|
+
this._wheelManager = new WheelManager(engine, (_inputOptions_wheelTarget = (_inputOptions = inputOptions) == null ? void 0 : _inputOptions.wheelTarget) != null ? _inputOptions_wheelTarget : canvas);
|
|
18432
|
+
var _inputOptions_pointerTarget;
|
|
18433
|
+
this._pointerManager = new PointerManager(engine, (_inputOptions_pointerTarget = (_inputOptions1 = inputOptions) == null ? void 0 : _inputOptions1.pointerTarget) != null ? _inputOptions_pointerTarget : canvas);
|
|
18434
|
+
var _inputOptions_keyboardTarget;
|
|
18435
|
+
this._keyboardManager = new KeyboardManager(engine, (_inputOptions_keyboardTarget = (_inputOptions2 = inputOptions) == null ? void 0 : _inputOptions2.keyboardTarget) != null ? _inputOptions_keyboardTarget : window);
|
|
18471
18436
|
this._initialized = true;
|
|
18472
18437
|
}
|
|
18473
18438
|
}
|
|
@@ -18580,8 +18545,6 @@ __decorate([
|
|
|
18580
18545
|
* @internal
|
|
18581
18546
|
*/ _proto._destroy = function _destroy() {
|
|
18582
18547
|
if (this._initialized) {
|
|
18583
|
-
window.removeEventListener("blur", this._onBlur);
|
|
18584
|
-
window.removeEventListener("focus", this._onFocus);
|
|
18585
18548
|
this._wheelManager._destroy();
|
|
18586
18549
|
this._wheelManager = null;
|
|
18587
18550
|
this._pointerManager._destroy();
|
|
@@ -18590,16 +18553,6 @@ __decorate([
|
|
|
18590
18553
|
this._keyboardManager = null;
|
|
18591
18554
|
}
|
|
18592
18555
|
};
|
|
18593
|
-
_proto._onBlur = function _onBlur() {
|
|
18594
|
-
this._wheelManager._onBlur();
|
|
18595
|
-
this._pointerManager._onBlur();
|
|
18596
|
-
this._keyboardManager._onBlur();
|
|
18597
|
-
};
|
|
18598
|
-
_proto._onFocus = function _onFocus() {
|
|
18599
|
-
this._wheelManager._onFocus();
|
|
18600
|
-
this._pointerManager._onFocus();
|
|
18601
|
-
this._keyboardManager._onFocus();
|
|
18602
|
-
};
|
|
18603
18556
|
_create_class(InputManager, [
|
|
18604
18557
|
{
|
|
18605
18558
|
key: "pointers",
|
|
@@ -18978,8 +18931,9 @@ var unlitVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\n#in
|
|
|
18978
18931
|
}
|
|
18979
18932
|
return;
|
|
18980
18933
|
}
|
|
18934
|
+
++hierarchy;
|
|
18981
18935
|
for(var k1 in cacheMap){
|
|
18982
|
-
this._recursiveDestroy(
|
|
18936
|
+
this._recursiveDestroy(hierarchy, cacheMap[k1]);
|
|
18983
18937
|
}
|
|
18984
18938
|
};
|
|
18985
18939
|
_proto._resizeCacheMapHierarchy = function _resizeCacheMapHierarchy(cacheMap, hierarchy, currentHierarchy, increaseHierarchy) {
|
|
@@ -19097,7 +19051,7 @@ ShaderPool.init();
|
|
|
19097
19051
|
_this._spriteMaskDefaultMaterial = _this._createSpriteMaskMaterial();
|
|
19098
19052
|
_this._textDefaultFont = Font.createFromOS(_assert_this_initialized(_this), "Arial");
|
|
19099
19053
|
_this._textDefaultFont.isGCIgnored = true;
|
|
19100
|
-
_this.inputManager = new InputManager(_assert_this_initialized(_this));
|
|
19054
|
+
_this.inputManager = new InputManager(_assert_this_initialized(_this), configuration.input);
|
|
19101
19055
|
var xrDevice = configuration.xrDevice;
|
|
19102
19056
|
if (xrDevice) {
|
|
19103
19057
|
_this.xrManager = new XRManager();
|
|
@@ -21945,7 +21899,12 @@ var passNum = 0;
|
|
|
21945
21899
|
if (componentA.instanceId === componentB.instanceId) {
|
|
21946
21900
|
return dataA.material._priority - dataB.material._priority || componentA._distanceForSort - componentB._distanceForSort;
|
|
21947
21901
|
} else {
|
|
21948
|
-
|
|
21902
|
+
var distanceDiff = componentA._distanceForSort - componentB._distanceForSort;
|
|
21903
|
+
if (distanceDiff === 0) {
|
|
21904
|
+
return componentA.instanceId - componentB.instanceId;
|
|
21905
|
+
} else {
|
|
21906
|
+
return distanceDiff;
|
|
21907
|
+
}
|
|
21949
21908
|
}
|
|
21950
21909
|
};
|
|
21951
21910
|
/**
|
|
@@ -21963,7 +21922,12 @@ var passNum = 0;
|
|
|
21963
21922
|
if (componentA.instanceId === componentB.instanceId) {
|
|
21964
21923
|
return dataA.material._priority - dataB.material._priority || componentB._distanceForSort - componentA._distanceForSort;
|
|
21965
21924
|
} else {
|
|
21966
|
-
|
|
21925
|
+
var distanceDiff = componentB._distanceForSort - componentA._distanceForSort;
|
|
21926
|
+
if (distanceDiff === 0) {
|
|
21927
|
+
return componentA.instanceId - componentB.instanceId;
|
|
21928
|
+
} else {
|
|
21929
|
+
return distanceDiff;
|
|
21930
|
+
}
|
|
21967
21931
|
}
|
|
21968
21932
|
};
|
|
21969
21933
|
return RenderQueue;
|
|
@@ -23177,14 +23141,14 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23177
23141
|
/** @internal */ _this._cameraIndex = -1;
|
|
23178
23142
|
_this._priority = 0;
|
|
23179
23143
|
_this._shaderData = new ShaderData(ShaderDataGroup.Camera);
|
|
23180
|
-
_this.
|
|
23144
|
+
_this._isCustomViewMatrix = false;
|
|
23145
|
+
_this._isCustomProjectionMatrix = false;
|
|
23181
23146
|
_this._nearClipPlane = 0.1;
|
|
23182
23147
|
_this._farClipPlane = 100;
|
|
23183
23148
|
_this._fieldOfView = 45;
|
|
23184
23149
|
_this._orthographicSize = 10;
|
|
23185
23150
|
_this._isProjectionDirty = true;
|
|
23186
23151
|
_this._isInvProjMatDirty = true;
|
|
23187
|
-
_this._isFrustumProjectDirty = true;
|
|
23188
23152
|
_this._customAspectRatio = undefined;
|
|
23189
23153
|
_this._renderTarget = null;
|
|
23190
23154
|
_this._depthBufferParams = new engineMath.Vector4();
|
|
@@ -23196,7 +23160,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23196
23160
|
_this._transform = transform;
|
|
23197
23161
|
_this._isViewMatrixDirty = transform.registerWorldChangeFlag();
|
|
23198
23162
|
_this._isInvViewProjDirty = transform.registerWorldChangeFlag();
|
|
23199
|
-
_this.
|
|
23163
|
+
_this._frustumChangeFlag = transform.registerWorldChangeFlag();
|
|
23200
23164
|
_this._renderPipeline = new BasicRenderPipeline(_assert_this_initialized(_this));
|
|
23201
23165
|
_this._addResourceReferCount(_this.shaderData, 1);
|
|
23202
23166
|
_this._updatePixelViewport();
|
|
@@ -23208,16 +23172,22 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23208
23172
|
}
|
|
23209
23173
|
var _proto = Camera1.prototype;
|
|
23210
23174
|
/**
|
|
23175
|
+
* Restore the view matrix to the world matrix of the entity.
|
|
23176
|
+
*/ _proto.resetViewMatrix = function resetViewMatrix() {
|
|
23177
|
+
this._isCustomViewMatrix = false;
|
|
23178
|
+
this._viewMatrixChange();
|
|
23179
|
+
};
|
|
23180
|
+
/**
|
|
23211
23181
|
* Restore the automatic calculation of projection matrix through fieldOfView, nearClipPlane and farClipPlane.
|
|
23212
23182
|
*/ _proto.resetProjectionMatrix = function resetProjectionMatrix() {
|
|
23213
|
-
this.
|
|
23214
|
-
this.
|
|
23183
|
+
this._isCustomProjectionMatrix = false;
|
|
23184
|
+
this._projectionMatrixChange();
|
|
23215
23185
|
};
|
|
23216
23186
|
/**
|
|
23217
23187
|
* Restore the automatic calculation of the aspect ratio through the viewport aspect ratio.
|
|
23218
23188
|
*/ _proto.resetAspectRatio = function resetAspectRatio() {
|
|
23219
23189
|
this._customAspectRatio = undefined;
|
|
23220
|
-
this.
|
|
23190
|
+
this._projectionMatrixChange();
|
|
23221
23191
|
};
|
|
23222
23192
|
/**
|
|
23223
23193
|
* Transform a point from world space to viewport space.
|
|
@@ -23347,10 +23317,9 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23347
23317
|
context.replacementShader = this._replacementShader;
|
|
23348
23318
|
context.replacementTag = this._replacementSubShaderTag;
|
|
23349
23319
|
// compute cull frustum.
|
|
23350
|
-
if (this.enableFrustumCulling &&
|
|
23320
|
+
if (this.enableFrustumCulling && this._frustumChangeFlag.flag) {
|
|
23351
23321
|
this._frustum.calculateFromMatrix(virtualCamera.viewProjectionMatrix);
|
|
23352
|
-
this.
|
|
23353
|
-
this._isFrustumProjectDirty = false;
|
|
23322
|
+
this._frustumChangeFlag.flag = false;
|
|
23354
23323
|
}
|
|
23355
23324
|
this._updateShaderData();
|
|
23356
23325
|
// union scene and camera macro.
|
|
@@ -23405,7 +23374,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23405
23374
|
this._renderPipeline = null;
|
|
23406
23375
|
this._virtualCamera = null;
|
|
23407
23376
|
this._shaderData = null;
|
|
23408
|
-
this.
|
|
23377
|
+
this._frustumChangeFlag = null;
|
|
23409
23378
|
this._transform = null;
|
|
23410
23379
|
this._isViewMatrixDirty = null;
|
|
23411
23380
|
this._isInvViewProjDirty = null;
|
|
@@ -23427,11 +23396,16 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23427
23396
|
var viewport = this._viewport;
|
|
23428
23397
|
this._pixelViewport.set(viewport.x * width, viewport.y * height, viewport.z * width, viewport.w * height);
|
|
23429
23398
|
};
|
|
23430
|
-
_proto.
|
|
23431
|
-
this.
|
|
23399
|
+
_proto._viewMatrixChange = function _viewMatrixChange() {
|
|
23400
|
+
this._isViewMatrixDirty.flag = true;
|
|
23401
|
+
this._isInvViewProjDirty.flag = true;
|
|
23402
|
+
this._frustumChangeFlag.flag = true;
|
|
23403
|
+
};
|
|
23404
|
+
_proto._projectionMatrixChange = function _projectionMatrixChange() {
|
|
23432
23405
|
this._isProjectionDirty = true;
|
|
23433
23406
|
this._isInvProjMatDirty = true;
|
|
23434
23407
|
this._isInvViewProjDirty.flag = true;
|
|
23408
|
+
this._frustumChangeFlag.flag = true;
|
|
23435
23409
|
};
|
|
23436
23410
|
_proto._innerViewportToWorldPoint = function _innerViewportToWorldPoint(x, y, z, invViewProjMat, out) {
|
|
23437
23411
|
// Depth is a normalized value, 0 is nearPlane, 1 is farClipPlane.
|
|
@@ -23474,7 +23448,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23474
23448
|
_proto._onPixelViewportChanged = function _onPixelViewportChanged() {
|
|
23475
23449
|
this._updatePixelViewport();
|
|
23476
23450
|
var _this__customAspectRatio;
|
|
23477
|
-
(_this__customAspectRatio = this._customAspectRatio) != null ? _this__customAspectRatio : this.
|
|
23451
|
+
(_this__customAspectRatio = this._customAspectRatio) != null ? _this__customAspectRatio : this._projectionMatrixChange();
|
|
23478
23452
|
};
|
|
23479
23453
|
_create_class(Camera1, [
|
|
23480
23454
|
{
|
|
@@ -23494,7 +23468,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23494
23468
|
},
|
|
23495
23469
|
set: function set(value) {
|
|
23496
23470
|
this._nearClipPlane = value;
|
|
23497
|
-
this.
|
|
23471
|
+
this._projectionMatrixChange();
|
|
23498
23472
|
}
|
|
23499
23473
|
},
|
|
23500
23474
|
{
|
|
@@ -23506,7 +23480,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23506
23480
|
},
|
|
23507
23481
|
set: function set(value) {
|
|
23508
23482
|
this._farClipPlane = value;
|
|
23509
|
-
this.
|
|
23483
|
+
this._projectionMatrixChange();
|
|
23510
23484
|
}
|
|
23511
23485
|
},
|
|
23512
23486
|
{
|
|
@@ -23518,7 +23492,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23518
23492
|
},
|
|
23519
23493
|
set: function set(value) {
|
|
23520
23494
|
this._fieldOfView = value;
|
|
23521
|
-
this.
|
|
23495
|
+
this._projectionMatrixChange();
|
|
23522
23496
|
}
|
|
23523
23497
|
},
|
|
23524
23498
|
{
|
|
@@ -23533,7 +23507,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23533
23507
|
},
|
|
23534
23508
|
set: function set(value) {
|
|
23535
23509
|
this._customAspectRatio = value;
|
|
23536
|
-
this.
|
|
23510
|
+
this._projectionMatrixChange();
|
|
23537
23511
|
}
|
|
23538
23512
|
},
|
|
23539
23513
|
{
|
|
@@ -23585,7 +23559,12 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23585
23559
|
},
|
|
23586
23560
|
set: function set(value) {
|
|
23587
23561
|
this._virtualCamera.isOrthographic = value;
|
|
23588
|
-
this.
|
|
23562
|
+
this._projectionMatrixChange();
|
|
23563
|
+
if (value) {
|
|
23564
|
+
this.shaderData.enableMacro("CAMERA_ORTHOGRAPHIC");
|
|
23565
|
+
} else {
|
|
23566
|
+
this.shaderData.disableMacro("CAMERA_ORTHOGRAPHIC");
|
|
23567
|
+
}
|
|
23589
23568
|
}
|
|
23590
23569
|
},
|
|
23591
23570
|
{
|
|
@@ -23597,7 +23576,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23597
23576
|
},
|
|
23598
23577
|
set: function set(value) {
|
|
23599
23578
|
this._orthographicSize = value;
|
|
23600
|
-
this.
|
|
23579
|
+
this._projectionMatrixChange();
|
|
23601
23580
|
}
|
|
23602
23581
|
},
|
|
23603
23582
|
{
|
|
@@ -23606,22 +23585,31 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23606
23585
|
* View matrix.
|
|
23607
23586
|
*/ function get() {
|
|
23608
23587
|
var viewMatrix = this._virtualCamera.viewMatrix;
|
|
23609
|
-
if (this._isViewMatrixDirty.flag) {
|
|
23610
|
-
|
|
23611
|
-
|
|
23612
|
-
|
|
23613
|
-
|
|
23614
|
-
|
|
23615
|
-
|
|
23588
|
+
if (!this._isViewMatrixDirty.flag || this._isCustomViewMatrix) {
|
|
23589
|
+
return viewMatrix;
|
|
23590
|
+
}
|
|
23591
|
+
this._isViewMatrixDirty.flag = false;
|
|
23592
|
+
// Ignore scale
|
|
23593
|
+
var transform = this._transform;
|
|
23594
|
+
engineMath.Matrix.rotationTranslation(transform.worldRotationQuaternion, transform.worldPosition, viewMatrix);
|
|
23595
|
+
viewMatrix.invert();
|
|
23616
23596
|
return viewMatrix;
|
|
23597
|
+
},
|
|
23598
|
+
set: function set(value) {
|
|
23599
|
+
this._virtualCamera.viewMatrix.copyFrom(value);
|
|
23600
|
+
this._isCustomViewMatrix = true;
|
|
23601
|
+
this._viewMatrixChange();
|
|
23617
23602
|
}
|
|
23618
23603
|
},
|
|
23619
23604
|
{
|
|
23620
23605
|
key: "projectionMatrix",
|
|
23621
|
-
get:
|
|
23606
|
+
get: /**
|
|
23607
|
+
* The projection matrix is calculated by the relevant parameters of the camera by default.
|
|
23608
|
+
* If it is manually set, the manual value will be maintained. Call resetProjectionMatrix() to restore it.
|
|
23609
|
+
*/ function get() {
|
|
23622
23610
|
var virtualCamera = this._virtualCamera;
|
|
23623
23611
|
var projectionMatrix = virtualCamera.projectionMatrix;
|
|
23624
|
-
if (!this._isProjectionDirty || this.
|
|
23612
|
+
if (!this._isProjectionDirty || this._isCustomProjectionMatrix) {
|
|
23625
23613
|
return projectionMatrix;
|
|
23626
23614
|
}
|
|
23627
23615
|
this._isProjectionDirty = false;
|
|
@@ -23635,13 +23623,10 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23635
23623
|
}
|
|
23636
23624
|
return projectionMatrix;
|
|
23637
23625
|
},
|
|
23638
|
-
set:
|
|
23639
|
-
* The projection matrix is calculated by the relevant parameters of the camera by default.
|
|
23640
|
-
* If it is manually set, the manual value will be maintained. Call resetProjectionMatrix() to restore it.
|
|
23641
|
-
*/ function set(value) {
|
|
23626
|
+
set: function set(value) {
|
|
23642
23627
|
this._virtualCamera.projectionMatrix.copyFrom(value);
|
|
23643
|
-
this.
|
|
23644
|
-
this.
|
|
23628
|
+
this._isCustomProjectionMatrix = true;
|
|
23629
|
+
this._projectionMatrixChange();
|
|
23645
23630
|
}
|
|
23646
23631
|
},
|
|
23647
23632
|
{
|
|
@@ -23702,7 +23687,7 @@ __decorate([
|
|
|
23702
23687
|
], exports.Camera.prototype, "_cameraIndex", void 0);
|
|
23703
23688
|
__decorate([
|
|
23704
23689
|
ignoreClone
|
|
23705
|
-
], exports.Camera.prototype, "
|
|
23690
|
+
], exports.Camera.prototype, "_frustumChangeFlag", void 0);
|
|
23706
23691
|
__decorate([
|
|
23707
23692
|
ignoreClone
|
|
23708
23693
|
], exports.Camera.prototype, "_transform", void 0);
|