@galacean/engine-core 1.2.0-alpha.1 → 1.2.0-alpha.11
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 +564 -483
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +564 -483
- package/dist/module.js +563 -482
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/Camera.d.ts +11 -5
- package/types/Canvas.d.ts +2 -1
- package/types/Engine.d.ts +4 -2
- package/types/RenderPipeline/MeshRenderElement.d.ts +19 -0
- package/types/RenderPipeline/SpriteElement.d.ts +15 -0
- package/types/RenderPipeline/SpriteMaskElement.d.ts +12 -0
- package/types/RenderPipeline/TextRenderElement.d.ts +8 -0
- package/types/Scene.d.ts +5 -0
- package/types/Utils.d.ts +6 -0
- package/types/asset/AssetType.d.ts +2 -0
- package/types/asset/IRefObject.d.ts +2 -0
- package/types/asset/Loader.d.ts +7 -0
- package/types/asset/RefObject.d.ts +27 -0
- package/types/asset/ResourceManager.d.ts +2 -0
- package/types/base/Event.d.ts +24 -0
- package/types/base/Util.d.ts +14 -0
- package/types/input/InputManager.d.ts +0 -2
- package/types/input/interface/IInput.d.ts +0 -8
- package/types/particle/modules/MainModule.d.ts +2 -0
- package/types/particle/modules/shape/BaseShape.d.ts +2 -2
- package/types/particle/modules/shape/BoxShape.d.ts +2 -1
- package/types/particle/modules/shape/CircleShape.d.ts +2 -1
- package/types/particle/modules/shape/ConeShape.d.ts +2 -1
- package/types/particle/modules/shape/HemisphereShape.d.ts +2 -1
- package/types/particle/modules/shape/SphereShape.d.ts +2 -1
- package/types/particle/modules/shape/index.d.ts +1 -0
- package/types/physics/HitResult.d.ts +3 -0
- package/types/shaderlib/ShaderFactory.d.ts +6 -1
- package/types/shadow/CascadedShadowCasterPass.d.ts +0 -1
- package/types/texture/Texture.d.ts +1 -0
- package/types/texture/enums/TextureFormat.d.ts +28 -26
- package/types/xr/XRPose.d.ts +0 -15
- package/types/xr/feature/XRFeature.d.ts +0 -16
- package/types/xr/feature/XRFeatureManager.d.ts +0 -65
- package/types/xr/feature/XRFeatureType.d.ts +0 -13
- package/types/xr/feature/camera/XRCameraManager.d.ts +0 -26
- package/types/xr/feature/hitTest/TrackableType.d.ts +0 -10
- package/types/xr/feature/hitTest/XRHitResult.d.ts +0 -19
- package/types/xr/feature/hitTest/XRHitTest.d.ts +0 -39
- package/types/xr/feature/hitTest/XRHitTestManager.d.ts +0 -38
- package/types/xr/feature/hitTest/XRHitTestType.d.ts +0 -16
- package/types/xr/feature/movementTracking/XRMovementTracking.d.ts +0 -18
- package/types/xr/feature/movementTracking/XRMovementTrackingManager.d.ts +0 -10
- package/types/xr/feature/movementTracking/XRMovementTrackingMode.d.ts +0 -5
- package/types/xr/feature/trackable/XRRequestTrackingState.d.ts +0 -11
- package/types/xr/feature/trackable/XRTrackableFeature.d.ts +0 -38
- package/types/xr/feature/trackable/XRTrackableManager.d.ts +0 -41
- package/types/xr/feature/trackable/XRTracked.d.ts +0 -1
- package/types/xr/feature/trackable/anchor/XRAnchor.d.ts +0 -6
- package/types/xr/feature/trackable/anchor/XRAnchorTracking.d.ts +0 -37
- package/types/xr/feature/trackable/anchor/XRAnchorTrackingManager.d.ts +0 -20
- package/types/xr/feature/trackable/anchor/XRRequestAnchor.d.ts +0 -15
- package/types/xr/feature/trackable/image/XRImageTracking.d.ts +0 -24
- package/types/xr/feature/trackable/image/XRImageTrackingManager.d.ts +0 -31
- package/types/xr/feature/trackable/image/XRReferenceImage.d.ts +0 -11
- package/types/xr/feature/trackable/image/XRRequestImage.d.ts +0 -13
- package/types/xr/feature/trackable/image/XRTrackedImage.d.ts +0 -8
- package/types/xr/feature/trackable/plane/XRPlaneMode.d.ts +0 -13
- package/types/xr/feature/trackable/plane/XRPlaneTracking.d.ts +0 -23
- package/types/xr/feature/trackable/plane/XRPlaneTrackingManager.d.ts +0 -11
- package/types/xr/feature/trackable/plane/XRRequestPlane.d.ts +0 -12
- package/types/xr/feature/trackable/plane/XRTrackedPlane.d.ts +0 -20
- package/types/xr/index.d.ts +0 -25
- package/types/xr/input/XRCamera.d.ts +0 -15
- package/types/xr/input/XRController.d.ts +0 -38
- package/types/xr/input/XRControllerPoseMode.d.ts +0 -9
- package/types/xr/input/XRInput.d.ts +0 -8
- package/types/xr/input/XRInputButton.d.ts +0 -19
- package/types/xr/input/XRInputEvent.d.ts +0 -24
- package/types/xr/input/XRInputEventType.d.ts +0 -11
- package/types/xr/input/XRInputManager.d.ts +0 -31
- package/types/xr/input/XRInputType.d.ts +0 -23
- package/types/xr/input/XRTargetRayMode.d.ts +0 -12
- package/types/xr/input/XRTrackedInputDevice.d.ts +0 -21
- package/types/xr/input/XRTrackedUpdateFlag.d.ts +0 -11
- package/types/xr/input/XRTrackingState.d.ts +0 -11
- package/types/xr/session/XRSessionManager.d.ts +0 -45
- package/types/xr/session/XRSessionMode.d.ts +0 -8
- package/types/xr/session/XRSessionState.d.ts +0 -13
- /package/types/{xr/feature/trackable/XRRequestTracking.d.ts → 2d/data/RenderData2D.d.ts} +0 -0
package/dist/module.js
CHANGED
|
@@ -595,7 +595,14 @@ var Utils = /*#__PURE__*/ function() {
|
|
|
595
595
|
* @param url - The url to be judged.
|
|
596
596
|
* @returns Whether the url is absolute url.
|
|
597
597
|
*/ Utils.isAbsoluteUrl = function isAbsoluteUrl(url) {
|
|
598
|
-
return /^(
|
|
598
|
+
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
|
599
|
+
};
|
|
600
|
+
/**
|
|
601
|
+
* Judge whether the url is base64 url.
|
|
602
|
+
* @param url - The url to be judged.
|
|
603
|
+
* @returns Whether the url is base64 url.
|
|
604
|
+
*/ Utils.isBase64Url = function isBase64Url(url) {
|
|
605
|
+
return /^data:.*,.*$/i.test(url);
|
|
599
606
|
};
|
|
600
607
|
/**
|
|
601
608
|
* Get the values of an object.
|
|
@@ -613,7 +620,10 @@ var Utils = /*#__PURE__*/ function() {
|
|
|
613
620
|
if (Utils.isAbsoluteUrl(relativeUrl)) {
|
|
614
621
|
return relativeUrl;
|
|
615
622
|
}
|
|
616
|
-
|
|
623
|
+
if (Utils.isBase64Url(relativeUrl)) {
|
|
624
|
+
return relativeUrl;
|
|
625
|
+
}
|
|
626
|
+
return relativeUrl ? baseUrl.replace(/\/+$/, "") + "/" + relativeUrl.replace(/^\/+/, "") : baseUrl;
|
|
617
627
|
};
|
|
618
628
|
/**
|
|
619
629
|
* @internal
|
|
@@ -3169,7 +3179,7 @@ function _extends() {
|
|
|
3169
3179
|
return _extends.apply(this, arguments);
|
|
3170
3180
|
}
|
|
3171
3181
|
|
|
3172
|
-
var camera_declare = "#define GLSLIFY 1\nuniform vec3 camera_Position;"; // eslint-disable-line
|
|
3182
|
+
var camera_declare = "#define GLSLIFY 1\nuniform vec3 camera_Position;uniform vec3 camera_Forward;"; // eslint-disable-line
|
|
3173
3183
|
|
|
3174
3184
|
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
|
|
3175
3185
|
|
|
@@ -3219,7 +3229,7 @@ var mobile_material_frag = "#define GLSLIFY 1\nuniform vec4 material_EmissiveCol
|
|
|
3219
3229
|
|
|
3220
3230
|
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
|
|
3221
3231
|
|
|
3222
|
-
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
|
|
3232
|
+
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
|
|
3223
3233
|
|
|
3224
3234
|
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
|
|
3225
3235
|
|
|
@@ -3257,7 +3267,7 @@ var noise_simplex_4D = "#define GLSLIFY 1\nvec4 grad4(float j,vec4 ip){const vec
|
|
|
3257
3267
|
|
|
3258
3268
|
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
|
|
3259
3269
|
|
|
3260
|
-
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
|
|
3270
|
+
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
|
|
3261
3271
|
|
|
3262
3272
|
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
|
|
3263
3273
|
|
|
@@ -3278,7 +3288,7 @@ var PBRShaderLib = {
|
|
|
3278
3288
|
|
|
3279
3289
|
var ShadowCoord = "#define GLSLIFY 1\nuniform mat4 scene_ShadowMatrices[SCENE_SHADOW_CASCADED_COUNT+1];uniform vec4 scene_ShadowSplitSpheres[4];mediump int computeCascadeIndex(vec3 positionWS){vec3 fromCenter0=positionWS-scene_ShadowSplitSpheres[0].xyz;vec3 fromCenter1=positionWS-scene_ShadowSplitSpheres[1].xyz;vec3 fromCenter2=positionWS-scene_ShadowSplitSpheres[2].xyz;vec3 fromCenter3=positionWS-scene_ShadowSplitSpheres[3].xyz;mediump vec4 comparison=vec4(dot(fromCenter0,fromCenter0)<scene_ShadowSplitSpheres[0].w,dot(fromCenter1,fromCenter1)<scene_ShadowSplitSpheres[1].w,dot(fromCenter2,fromCenter2)<scene_ShadowSplitSpheres[2].w,dot(fromCenter3,fromCenter3)<scene_ShadowSplitSpheres[3].w);comparison.yzw=clamp(comparison.yzw-comparison.xyz,0.0,1.0);mediump vec4 indexCoefficient=vec4(4.0,3.0,2.0,1.0);mediump int index=4-int(dot(comparison,indexCoefficient));return index;}vec3 getShadowCoord(){\n#if SCENE_SHADOW_CASCADED_COUNT == 1\nmediump int cascadeIndex=0;\n#else\nmediump int cascadeIndex=computeCascadeIndex(v_pos);\n#endif\n#ifdef GRAPHICS_API_WEBGL2\nmat4 shadowMatrix=scene_ShadowMatrices[cascadeIndex];\n#else\nmat4 shadowMatrix;\n#if SCENE_SHADOW_CASCADED_COUNT == 4\nif(cascadeIndex==0){shadowMatrix=scene_ShadowMatrices[0];}else if(cascadeIndex==1){shadowMatrix=scene_ShadowMatrices[1];}else if(cascadeIndex==2){shadowMatrix=scene_ShadowMatrices[2];}else if(cascadeIndex==3){shadowMatrix=scene_ShadowMatrices[3];}else{shadowMatrix=scene_ShadowMatrices[4];}\n#endif\n#if SCENE_SHADOW_CASCADED_COUNT == 2\nif(cascadeIndex==0){shadowMatrix=scene_ShadowMatrices[0];}else if(cascadeIndex==1){shadowMatrix=scene_ShadowMatrices[1];}else{shadowMatrix=scene_ShadowMatrices[2];}\n#endif\n#if SCENE_SHADOW_CASCADED_COUNT == 1\nif(cascadeIndex==0){shadowMatrix=scene_ShadowMatrices[0];}else{shadowMatrix=scene_ShadowMatrices[1];}\n#endif\n#endif\nvec4 shadowCoord=shadowMatrix*vec4(v_pos,1.0);return shadowCoord.xyz;}"; // eslint-disable-line
|
|
3280
3290
|
|
|
3281
|
-
var ShadowFragmentDeclaration = "#define GLSLIFY 1\n#if defined(SCENE_SHADOW_TYPE) && defined(RENDERER_IS_RECEIVE_SHADOWS)\n#define SCENE_IS_CALCULATE_SHADOWS\n#endif\n#ifdef SCENE_IS_CALCULATE_SHADOWS\n#if SCENE_SHADOW_CASCADED_COUNT == 1\nvarying vec3 v_shadowCoord;\n#else\n#include <ShadowCoord>\n#endif\nuniform
|
|
3291
|
+
var ShadowFragmentDeclaration = "#define GLSLIFY 1\n#if defined(SCENE_SHADOW_TYPE) && defined(RENDERER_IS_RECEIVE_SHADOWS)\n#define SCENE_IS_CALCULATE_SHADOWS\n#endif\n#ifdef SCENE_IS_CALCULATE_SHADOWS\n#if SCENE_SHADOW_CASCADED_COUNT == 1\nvarying vec3 v_shadowCoord;\n#else\n#include <ShadowCoord>\n#endif\nuniform vec4 scene_ShadowInfo;uniform vec4 scene_ShadowMapSize;\n#ifdef GRAPHICS_API_WEBGL2\nuniform mediump sampler2DShadow scene_ShadowMap;\n#define SAMPLE_TEXTURE2D_SHADOW(textureName, coord3) textureLod(textureName, coord3 , 0.0)\n#define TEXTURE2D_SHADOW_PARAM(shadowMap) mediump sampler2DShadow shadowMap\n#else\nuniform sampler2D scene_ShadowMap;\n#ifdef ENGINE_NO_DEPTH_TEXTURE\nconst vec4 bitShift=vec4(1.0,1.0/256.0,1.0/(256.0*256.0),1.0/(256.0*256.0*256.0));float unpack(const in vec4 rgbaDepth){return dot(rgbaDepth,bitShift);}\n#define SAMPLE_TEXTURE2D_SHADOW(textureName, coord3) (unpack(texture2D(textureName, coord3.xy)) < coord3.z ? 0.0 : 1.0)\n#else\n#define SAMPLE_TEXTURE2D_SHADOW(textureName, coord3) (texture2D(textureName, coord3.xy).r < coord3.z ? 0.0 : 1.0)\n#endif\n#define TEXTURE2D_SHADOW_PARAM(shadowMap) mediump sampler2D shadowMap\n#endif\n#if SCENE_SHADOW_TYPE == 2\nfloat sampleShadowMapFiltered4(TEXTURE2D_SHADOW_PARAM(shadowMap),vec3 shadowCoord,vec4 shadowMapSize){float attenuation;vec4 attenuation4;vec2 offset=shadowMapSize.xy/2.0;vec3 shadowCoord0=shadowCoord+vec3(-offset,0.0);vec3 shadowCoord1=shadowCoord+vec3(offset.x,-offset.y,0.0);vec3 shadowCoord2=shadowCoord+vec3(-offset.x,offset.y,0.0);vec3 shadowCoord3=shadowCoord+vec3(offset,0.0);attenuation4.x=SAMPLE_TEXTURE2D_SHADOW(shadowMap,shadowCoord0);attenuation4.y=SAMPLE_TEXTURE2D_SHADOW(shadowMap,shadowCoord1);attenuation4.z=SAMPLE_TEXTURE2D_SHADOW(shadowMap,shadowCoord2);attenuation4.w=SAMPLE_TEXTURE2D_SHADOW(shadowMap,shadowCoord3);attenuation=dot(attenuation4,vec4(0.25));return attenuation;}\n#endif\n#if SCENE_SHADOW_TYPE == 3\n#include <shadow_sample_tent>\nfloat sampleShadowMapFiltered9(TEXTURE2D_SHADOW_PARAM(shadowMap),vec3 shadowCoord,vec4 shadowmapSize){float attenuation;float fetchesWeights[9];vec2 fetchesUV[9];sampleShadowComputeSamplesTent5x5(shadowmapSize,shadowCoord.xy,fetchesWeights,fetchesUV);attenuation=fetchesWeights[0]*SAMPLE_TEXTURE2D_SHADOW(shadowMap,vec3(fetchesUV[0].xy,shadowCoord.z));attenuation+=fetchesWeights[1]*SAMPLE_TEXTURE2D_SHADOW(shadowMap,vec3(fetchesUV[1].xy,shadowCoord.z));attenuation+=fetchesWeights[2]*SAMPLE_TEXTURE2D_SHADOW(shadowMap,vec3(fetchesUV[2].xy,shadowCoord.z));attenuation+=fetchesWeights[3]*SAMPLE_TEXTURE2D_SHADOW(shadowMap,vec3(fetchesUV[3].xy,shadowCoord.z));attenuation+=fetchesWeights[4]*SAMPLE_TEXTURE2D_SHADOW(shadowMap,vec3(fetchesUV[4].xy,shadowCoord.z));attenuation+=fetchesWeights[5]*SAMPLE_TEXTURE2D_SHADOW(shadowMap,vec3(fetchesUV[5].xy,shadowCoord.z));attenuation+=fetchesWeights[6]*SAMPLE_TEXTURE2D_SHADOW(shadowMap,vec3(fetchesUV[6].xy,shadowCoord.z));attenuation+=fetchesWeights[7]*SAMPLE_TEXTURE2D_SHADOW(shadowMap,vec3(fetchesUV[7].xy,shadowCoord.z));attenuation+=fetchesWeights[8]*SAMPLE_TEXTURE2D_SHADOW(shadowMap,vec3(fetchesUV[8].xy,shadowCoord.z));return attenuation;}\n#endif\nfloat getShadowFade(vec3 positionWS){vec3 camToPixel=positionWS-camera_Position;float distanceCamToPixel2=dot(camToPixel,camToPixel);return saturate(distanceCamToPixel2*scene_ShadowInfo.z+scene_ShadowInfo.w);}float sampleShadowMap(){\n#if SCENE_SHADOW_CASCADED_COUNT == 1\nvec3 shadowCoord=v_shadowCoord;\n#else\nvec3 shadowCoord=getShadowCoord();\n#endif\nfloat attenuation=1.0;if(shadowCoord.z>0.0&&shadowCoord.z<1.0){\n#if SCENE_SHADOW_TYPE == 1\nattenuation=SAMPLE_TEXTURE2D_SHADOW(scene_ShadowMap,shadowCoord);\n#endif\n#if SCENE_SHADOW_TYPE == 2\nattenuation=sampleShadowMapFiltered4(scene_ShadowMap,shadowCoord,scene_ShadowMapSize);\n#endif\n#if SCENE_SHADOW_TYPE == 3\nattenuation=sampleShadowMapFiltered9(scene_ShadowMap,shadowCoord,scene_ShadowMapSize);\n#endif\nfloat shadowFade=getShadowFade(v_pos);attenuation=mix(1.0,mix(attenuation,1.0,shadowFade),scene_ShadowInfo.x);}return attenuation;}\n#endif\n"; // eslint-disable-line
|
|
3282
3292
|
|
|
3283
3293
|
var shadow_sample_tent = "#define GLSLIFY 1\nfloat sampleShadowGetIRTriangleTexelArea(float triangleHeight){return triangleHeight-0.5;}void sampleShadowGetTexelAreasTent3x3(float offset,out vec4 computedArea,out vec4 computedAreaUncut){float a=offset+0.5;float offsetSquaredHalved=a*a*0.5;computedAreaUncut.x=computedArea.x=offsetSquaredHalved-offset;computedAreaUncut.w=computedArea.w=offsetSquaredHalved;computedAreaUncut.y=sampleShadowGetIRTriangleTexelArea(1.5-offset);float clampedOffsetLeft=min(offset,0.0);float areaOfSmallLeftTriangle=clampedOffsetLeft*clampedOffsetLeft;computedArea.y=computedAreaUncut.y-areaOfSmallLeftTriangle;computedAreaUncut.z=sampleShadowGetIRTriangleTexelArea(1.5+offset);float clampedOffsetRight=max(offset,0.0);float areaOfSmallRightTriangle=clampedOffsetRight*clampedOffsetRight;computedArea.z=computedAreaUncut.z-areaOfSmallRightTriangle;}void sampleShadowGetTexelWeightsTent5x5(float offset,out vec3 texelsWeightsA,out vec3 texelsWeightsB){vec4 areaFrom3texelTriangle;vec4 areaUncutFrom3texelTriangle;sampleShadowGetTexelAreasTent3x3(offset,areaFrom3texelTriangle,areaUncutFrom3texelTriangle);texelsWeightsA.x=0.16*(areaFrom3texelTriangle.x);texelsWeightsA.y=0.16*(areaUncutFrom3texelTriangle.y);texelsWeightsA.z=0.16*(areaFrom3texelTriangle.y+1.0);texelsWeightsB.x=0.16*(areaFrom3texelTriangle.z+1.0);texelsWeightsB.y=0.16*(areaUncutFrom3texelTriangle.z);texelsWeightsB.z=0.16*(areaFrom3texelTriangle.w);}void sampleShadowComputeSamplesTent5x5(vec4 shadowMapTextureTexelSize,vec2 coord,out float fetchesWeights[9],out vec2 fetchesUV[9]){vec2 tentCenterInTexelSpace=coord.xy*shadowMapTextureTexelSize.zw;vec2 centerOfFetchesInTexelSpace=floor(tentCenterInTexelSpace+0.5);vec2 offsetFromTentCenterToCenterOfFetches=tentCenterInTexelSpace-centerOfFetchesInTexelSpace;vec3 texelsWeightsUA,texelsWeightsUB;vec3 texelsWeightsVA,texelsWeightsVB;sampleShadowGetTexelWeightsTent5x5(offsetFromTentCenterToCenterOfFetches.x,texelsWeightsUA,texelsWeightsUB);sampleShadowGetTexelWeightsTent5x5(offsetFromTentCenterToCenterOfFetches.y,texelsWeightsVA,texelsWeightsVB);vec3 fetchesWeightsU=vec3(texelsWeightsUA.xz,texelsWeightsUB.y)+vec3(texelsWeightsUA.y,texelsWeightsUB.xz);vec3 fetchesWeightsV=vec3(texelsWeightsVA.xz,texelsWeightsVB.y)+vec3(texelsWeightsVA.y,texelsWeightsVB.xz);vec3 fetchesOffsetsU=vec3(texelsWeightsUA.y,texelsWeightsUB.xz)/fetchesWeightsU.xyz+vec3(-2.5,-0.5,1.5);vec3 fetchesOffsetsV=vec3(texelsWeightsVA.y,texelsWeightsVB.xz)/fetchesWeightsV.xyz+vec3(-2.5,-0.5,1.5);fetchesOffsetsU*=shadowMapTextureTexelSize.xxx;fetchesOffsetsV*=shadowMapTextureTexelSize.yyy;vec2 bilinearFetchOrigin=centerOfFetchesInTexelSpace*shadowMapTextureTexelSize.xy;fetchesUV[0]=bilinearFetchOrigin+vec2(fetchesOffsetsU.x,fetchesOffsetsV.x);fetchesUV[1]=bilinearFetchOrigin+vec2(fetchesOffsetsU.y,fetchesOffsetsV.x);fetchesUV[2]=bilinearFetchOrigin+vec2(fetchesOffsetsU.z,fetchesOffsetsV.x);fetchesUV[3]=bilinearFetchOrigin+vec2(fetchesOffsetsU.x,fetchesOffsetsV.y);fetchesUV[4]=bilinearFetchOrigin+vec2(fetchesOffsetsU.y,fetchesOffsetsV.y);fetchesUV[5]=bilinearFetchOrigin+vec2(fetchesOffsetsU.z,fetchesOffsetsV.y);fetchesUV[6]=bilinearFetchOrigin+vec2(fetchesOffsetsU.x,fetchesOffsetsV.z);fetchesUV[7]=bilinearFetchOrigin+vec2(fetchesOffsetsU.y,fetchesOffsetsV.z);fetchesUV[8]=bilinearFetchOrigin+vec2(fetchesOffsetsU.z,fetchesOffsetsV.z);fetchesWeights[0]=fetchesWeightsU.x*fetchesWeightsV.x;fetchesWeights[1]=fetchesWeightsU.y*fetchesWeightsV.x;fetchesWeights[2]=fetchesWeightsU.z*fetchesWeightsV.x;fetchesWeights[3]=fetchesWeightsU.x*fetchesWeightsV.y;fetchesWeights[4]=fetchesWeightsU.y*fetchesWeightsV.y;fetchesWeights[5]=fetchesWeightsU.z*fetchesWeightsV.y;fetchesWeights[6]=fetchesWeightsU.x*fetchesWeightsV.z;fetchesWeights[7]=fetchesWeightsU.y*fetchesWeightsV.z;fetchesWeights[8]=fetchesWeightsU.z*fetchesWeightsV.z;}"; // eslint-disable-line
|
|
3284
3294
|
|
|
@@ -3393,16 +3403,22 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
3393
3403
|
}
|
|
3394
3404
|
ShaderLib[includeName] = includeSource;
|
|
3395
3405
|
};
|
|
3396
|
-
ShaderFactory.
|
|
3406
|
+
ShaderFactory.unRegisterInclude = function unRegisterInclude(includeName) {
|
|
3407
|
+
delete ShaderLib[includeName];
|
|
3408
|
+
};
|
|
3409
|
+
/**
|
|
3410
|
+
* @param regex The default regex is for engine's builtin glsl `#include` syntax,
|
|
3411
|
+
* since `ShaderLab` use the same parsing function but different syntax for `#include` --- `/^[ \t]*#include +"([\w\d.]+)"/gm`
|
|
3412
|
+
*/ ShaderFactory.parseIncludes = function parseIncludes(src, regex) {
|
|
3413
|
+
if (regex === void 0) regex = /^[ \t]*#include +<([\w\d.]+)>/gm;
|
|
3397
3414
|
var replace = function replace(match, slice) {
|
|
3398
3415
|
var replace = ShaderLib[slice];
|
|
3399
3416
|
if (replace === undefined) {
|
|
3400
3417
|
Logger.error('Shader slice "' + match.trim() + '" not founded.');
|
|
3401
3418
|
return "";
|
|
3402
3419
|
}
|
|
3403
|
-
return ShaderFactory.parseIncludes(replace);
|
|
3420
|
+
return ShaderFactory.parseIncludes(replace, regex);
|
|
3404
3421
|
};
|
|
3405
|
-
var regex = /^[ \t]*#include +<([\w\d.]+)>/gm;
|
|
3406
3422
|
return src.replace(regex, replace);
|
|
3407
3423
|
};
|
|
3408
3424
|
/**
|
|
@@ -3513,16 +3529,6 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
3513
3529
|
return ShaderPart;
|
|
3514
3530
|
}();
|
|
3515
3531
|
|
|
3516
|
-
/**
|
|
3517
|
-
* Shader data grouping.
|
|
3518
|
-
*/ var ShaderDataGroup;
|
|
3519
|
-
(function(ShaderDataGroup) {
|
|
3520
|
-
ShaderDataGroup[ShaderDataGroup[/** Scene group. */ "Scene"] = 0] = "Scene";
|
|
3521
|
-
ShaderDataGroup[ShaderDataGroup[/** Camera group. */ "Camera"] = 1] = "Camera";
|
|
3522
|
-
ShaderDataGroup[ShaderDataGroup[/** Renderer group. */ "Renderer"] = 2] = "Renderer";
|
|
3523
|
-
ShaderDataGroup[ShaderDataGroup[/** material group. */ "Material"] = 3] = "Material";
|
|
3524
|
-
})(ShaderDataGroup || (ShaderDataGroup = {}));
|
|
3525
|
-
|
|
3526
3532
|
/**
|
|
3527
3533
|
* Color Space.
|
|
3528
3534
|
*/ var ColorSpace;
|
|
@@ -3732,6 +3738,16 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
3732
3738
|
this.textureUniforms = [];
|
|
3733
3739
|
};
|
|
3734
3740
|
|
|
3741
|
+
/**
|
|
3742
|
+
* Shader data grouping.
|
|
3743
|
+
*/ var ShaderDataGroup;
|
|
3744
|
+
(function(ShaderDataGroup) {
|
|
3745
|
+
ShaderDataGroup[ShaderDataGroup[/** Scene group. */ "Scene"] = 0] = "Scene";
|
|
3746
|
+
ShaderDataGroup[ShaderDataGroup[/** Camera group. */ "Camera"] = 1] = "Camera";
|
|
3747
|
+
ShaderDataGroup[ShaderDataGroup[/** Renderer group. */ "Renderer"] = 2] = "Renderer";
|
|
3748
|
+
ShaderDataGroup[ShaderDataGroup[/** material group. */ "Material"] = 3] = "Material";
|
|
3749
|
+
})(ShaderDataGroup || (ShaderDataGroup = {}));
|
|
3750
|
+
|
|
3735
3751
|
/**
|
|
3736
3752
|
* Shader program, corresponding to the GPU shader program.
|
|
3737
3753
|
* @internal
|
|
@@ -4027,6 +4043,7 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
4027
4043
|
break;
|
|
4028
4044
|
case gl.SAMPLER_2D:
|
|
4029
4045
|
case gl.SAMPLER_CUBE:
|
|
4046
|
+
case gl.UNSIGNED_INT_SAMPLER_2D:
|
|
4030
4047
|
case gl.SAMPLER_2D_ARRAY:
|
|
4031
4048
|
case gl.SAMPLER_2D_SHADOW:
|
|
4032
4049
|
var defaultTexture;
|
|
@@ -4037,6 +4054,9 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
4037
4054
|
case gl.SAMPLER_CUBE:
|
|
4038
4055
|
defaultTexture = _this._engine._magentaTextureCube;
|
|
4039
4056
|
break;
|
|
4057
|
+
case gl.UNSIGNED_INT_SAMPLER_2D:
|
|
4058
|
+
defaultTexture = _this._engine._uintMagentaTexture2D;
|
|
4059
|
+
break;
|
|
4040
4060
|
case gl.SAMPLER_2D_ARRAY:
|
|
4041
4061
|
defaultTexture = _this._engine._magentaTexture2DArray;
|
|
4042
4062
|
break;
|
|
@@ -5126,6 +5146,57 @@ var GraphicsResource = /*#__PURE__*/ function(ReferResource1) {
|
|
|
5126
5146
|
return GraphicsResource;
|
|
5127
5147
|
}(ReferResource);
|
|
5128
5148
|
|
|
5149
|
+
/**
|
|
5150
|
+
* The filter mode of the texture.
|
|
5151
|
+
*/ var TextureFilterMode;
|
|
5152
|
+
(function(TextureFilterMode) {
|
|
5153
|
+
TextureFilterMode[TextureFilterMode[/** Point filtering. */ "Point"] = 0] = "Point";
|
|
5154
|
+
TextureFilterMode[TextureFilterMode[/** Bilinear filtering. */ "Bilinear"] = 1] = "Bilinear";
|
|
5155
|
+
TextureFilterMode[TextureFilterMode[/** Trilinear filtering. */ "Trilinear"] = 2] = "Trilinear";
|
|
5156
|
+
})(TextureFilterMode || (TextureFilterMode = {}));
|
|
5157
|
+
|
|
5158
|
+
/**
|
|
5159
|
+
* Texture format enumeration.
|
|
5160
|
+
*/ var TextureFormat;
|
|
5161
|
+
(function(TextureFormat) {
|
|
5162
|
+
TextureFormat[TextureFormat[/** RGB format, 8 bits per channel. */ "R8G8B8"] = 0] = "R8G8B8";
|
|
5163
|
+
TextureFormat[TextureFormat[/** RGBA format, 8 bits per channel. */ "R8G8B8A8"] = 1] = "R8G8B8A8";
|
|
5164
|
+
TextureFormat[TextureFormat[/** RGBA format, 4 bits per channel. */ "R4G4B4A4"] = 2] = "R4G4B4A4";
|
|
5165
|
+
TextureFormat[TextureFormat[/** RGBA format, 5 bits in R channel, 5 bits in G channel, 5 bits in B channel, 1 bit in A channel. */ "R5G5B5A1"] = 3] = "R5G5B5A1";
|
|
5166
|
+
TextureFormat[TextureFormat[/** RGB format, 5 bits in R channel, 6 bits in G channel, 5 bits in B channel. */ "R5G6B5"] = 4] = "R5G6B5";
|
|
5167
|
+
TextureFormat[TextureFormat[/** Transparent format, 8 bits. */ "Alpha8"] = 5] = "Alpha8";
|
|
5168
|
+
TextureFormat[TextureFormat[/** Luminance/alpha in RGB channel, alpha in A channel. */ "LuminanceAlpha"] = 6] = "LuminanceAlpha";
|
|
5169
|
+
TextureFormat[TextureFormat[/** RGBA format, 16 bits per channel. */ "R16G16B16A16"] = 7] = "R16G16B16A16";
|
|
5170
|
+
TextureFormat[TextureFormat[/** RGBA format, 32 bits per channel. */ "R32G32B32A32"] = 8] = "R32G32B32A32";
|
|
5171
|
+
TextureFormat[TextureFormat[/** RGBA unsigned integer format, 32 bits per channel. */ "R32G32B32A32_UInt"] = 9] = "R32G32B32A32_UInt";
|
|
5172
|
+
TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "BC1"] = 10] = "BC1";
|
|
5173
|
+
TextureFormat[TextureFormat[/** RGBA compressed format, 8 bits per pixel. */ "BC3"] = 11] = "BC3";
|
|
5174
|
+
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 4x4 pixel block. */ "BC7"] = 12] = "BC7";
|
|
5175
|
+
TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "ETC1_RGB"] = 13] = "ETC1_RGB";
|
|
5176
|
+
TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "ETC2_RGB"] = 14] = "ETC2_RGB";
|
|
5177
|
+
TextureFormat[TextureFormat[/** RGBA compressed format, 5 bits per pixel, 4 bit in RGB, 1 bit in A. */ "ETC2_RGBA5"] = 15] = "ETC2_RGBA5";
|
|
5178
|
+
TextureFormat[TextureFormat[/** RGB compressed format, 8 bits per pixel. */ "ETC2_RGBA8"] = 16] = "ETC2_RGBA8";
|
|
5179
|
+
TextureFormat[TextureFormat[/** RGB compressed format, 2 bits per pixel. */ "PVRTC_RGB2"] = 17] = "PVRTC_RGB2";
|
|
5180
|
+
TextureFormat[TextureFormat[/** RGBA compressed format, 2 bits per pixel. */ "PVRTC_RGBA2"] = 18] = "PVRTC_RGBA2";
|
|
5181
|
+
TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "PVRTC_RGB4"] = 19] = "PVRTC_RGB4";
|
|
5182
|
+
TextureFormat[TextureFormat[/** RGBA compressed format, 4 bits per pixel. */ "PVRTC_RGBA4"] = 20] = "PVRTC_RGBA4";
|
|
5183
|
+
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 4x4 pixel block. */ "ASTC_4x4"] = 21] = "ASTC_4x4";
|
|
5184
|
+
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 5x5 pixel block. */ "ASTC_5x5"] = 22] = "ASTC_5x5";
|
|
5185
|
+
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 6x6 pixel block. */ "ASTC_6x6"] = 23] = "ASTC_6x6";
|
|
5186
|
+
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 8x8 pixel block. */ "ASTC_8x8"] = 24] = "ASTC_8x8";
|
|
5187
|
+
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 10x10 pixel block. */ "ASTC_10x10"] = 25] = "ASTC_10x10";
|
|
5188
|
+
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 12x12 pixel block. */ "ASTC_12x12"] = 26] = "ASTC_12x12";
|
|
5189
|
+
TextureFormat[TextureFormat[/** Automatic depth format, engine will automatically select the supported precision. */ "Depth"] = 27] = "Depth";
|
|
5190
|
+
TextureFormat[TextureFormat[/** Automatic depth stencil format, engine will automatically select the supported precision. */ "DepthStencil"] = 28] = "DepthStencil";
|
|
5191
|
+
TextureFormat[TextureFormat[/** 16-bit depth format. */ "Depth16"] = 29] = "Depth16";
|
|
5192
|
+
TextureFormat[TextureFormat[/** 24-bit depth format. */ "Depth24"] = 30] = "Depth24";
|
|
5193
|
+
TextureFormat[TextureFormat[/** 32-bit depth format. */ "Depth32"] = 31] = "Depth32";
|
|
5194
|
+
TextureFormat[TextureFormat[/** 16-bit depth + 8-bit stencil format. */ "Depth24Stencil8"] = 32] = "Depth24Stencil8";
|
|
5195
|
+
TextureFormat[TextureFormat[/** 32-bit depth + 8-bit stencil format. */ "Depth32Stencil8"] = 33] = "Depth32Stencil8";
|
|
5196
|
+
TextureFormat[TextureFormat[/** @deprecated Use `TextureFormat.BC1` instead. */ "DXT1"] = 34] = "DXT1";
|
|
5197
|
+
TextureFormat[TextureFormat[/** @deprecated Use `TextureFormat.BC3` instead. */ "DXT5"] = 35] = "DXT5";
|
|
5198
|
+
})(TextureFormat || (TextureFormat = {}));
|
|
5199
|
+
|
|
5129
5200
|
/**
|
|
5130
5201
|
* The base class of texture, contains some common functions of texture-related classes.
|
|
5131
5202
|
*/ var Texture = /*#__PURE__*/ function(GraphicsResource1) {
|
|
@@ -5182,6 +5253,12 @@ var GraphicsResource = /*#__PURE__*/ function(ReferResource1) {
|
|
|
5182
5253
|
_proto._getMipmapCount = function _getMipmapCount() {
|
|
5183
5254
|
return this._mipmap ? Math.floor(Math.log2(Math.max(this._width, this._height))) + 1 : 1;
|
|
5184
5255
|
};
|
|
5256
|
+
_proto._isIntFormat = function _isIntFormat() {
|
|
5257
|
+
if (TextureFormat.R32G32B32A32_UInt === this._format) {
|
|
5258
|
+
return true;
|
|
5259
|
+
}
|
|
5260
|
+
return false;
|
|
5261
|
+
};
|
|
5185
5262
|
_create_class(Texture, [
|
|
5186
5263
|
{
|
|
5187
5264
|
key: "format",
|
|
@@ -5258,6 +5335,11 @@ var GraphicsResource = /*#__PURE__*/ function(ReferResource1) {
|
|
|
5258
5335
|
},
|
|
5259
5336
|
set: function set(value) {
|
|
5260
5337
|
if (value === this._filterMode) return;
|
|
5338
|
+
if (value !== TextureFilterMode.Point && this._isIntFormat()) {
|
|
5339
|
+
value = TextureFilterMode.Point;
|
|
5340
|
+
Logger.warn("Int or UInt format texture only support TextureFilterMode.Point");
|
|
5341
|
+
return;
|
|
5342
|
+
}
|
|
5261
5343
|
this._filterMode = value;
|
|
5262
5344
|
this._platformTexture.filterMode = value;
|
|
5263
5345
|
}
|
|
@@ -6384,7 +6466,7 @@ SlicedSpriteAssembler = __decorate([
|
|
|
6384
6466
|
_this._byteLength = byteLength;
|
|
6385
6467
|
_this._platformBuffer = engine._hardwareRenderer.createPlatformBuffer(type, byteLength, bufferUsage, data);
|
|
6386
6468
|
if (readable) {
|
|
6387
|
-
var buffer =
|
|
6469
|
+
var buffer = data.constructor === ArrayBuffer ? data.slice(0) : data.buffer.slice(data.byteOffset, data.byteOffset + byteLength);
|
|
6388
6470
|
_this._data = new Uint8Array(buffer);
|
|
6389
6471
|
}
|
|
6390
6472
|
}
|
|
@@ -7561,56 +7643,6 @@ var /**
|
|
|
7561
7643
|
TextureDepthCompareFunction[TextureDepthCompareFunction[/** always pass. */ "Always"] = 7] = "Always";
|
|
7562
7644
|
})(TextureDepthCompareFunction || (TextureDepthCompareFunction = {}));
|
|
7563
7645
|
|
|
7564
|
-
/**
|
|
7565
|
-
* The filter mode of the texture.
|
|
7566
|
-
*/ var TextureFilterMode;
|
|
7567
|
-
(function(TextureFilterMode) {
|
|
7568
|
-
TextureFilterMode[TextureFilterMode[/** Point filtering. */ "Point"] = 0] = "Point";
|
|
7569
|
-
TextureFilterMode[TextureFilterMode[/** Bilinear filtering. */ "Bilinear"] = 1] = "Bilinear";
|
|
7570
|
-
TextureFilterMode[TextureFilterMode[/** Trilinear filtering. */ "Trilinear"] = 2] = "Trilinear";
|
|
7571
|
-
})(TextureFilterMode || (TextureFilterMode = {}));
|
|
7572
|
-
|
|
7573
|
-
/**
|
|
7574
|
-
* Texture format enumeration.
|
|
7575
|
-
*/ var TextureFormat;
|
|
7576
|
-
(function(TextureFormat) {
|
|
7577
|
-
TextureFormat[TextureFormat[/** RGB format, 8 bits per channel. */ "R8G8B8"] = 0] = "R8G8B8";
|
|
7578
|
-
TextureFormat[TextureFormat[/** RGBA format, 8 bits per channel. */ "R8G8B8A8"] = 1] = "R8G8B8A8";
|
|
7579
|
-
TextureFormat[TextureFormat[/** RGBA format, 4 bits per channel. */ "R4G4B4A4"] = 2] = "R4G4B4A4";
|
|
7580
|
-
TextureFormat[TextureFormat[/** RGBA format, 5 bits in R channel, 5 bits in G channel, 5 bits in B channel, 1 bit in A channel. */ "R5G5B5A1"] = 3] = "R5G5B5A1";
|
|
7581
|
-
TextureFormat[TextureFormat[/** RGB format, 5 bits in R channel, 6 bits in G channel, 5 bits in B channel. */ "R5G6B5"] = 4] = "R5G6B5";
|
|
7582
|
-
TextureFormat[TextureFormat[/** Transparent format, 8 bits. */ "Alpha8"] = 5] = "Alpha8";
|
|
7583
|
-
TextureFormat[TextureFormat[/** Luminance/alpha in RGB channel, alpha in A channel. */ "LuminanceAlpha"] = 6] = "LuminanceAlpha";
|
|
7584
|
-
TextureFormat[TextureFormat[/** RGBA format, 16 bits per channel. */ "R16G16B16A16"] = 7] = "R16G16B16A16";
|
|
7585
|
-
TextureFormat[TextureFormat[/** RGBA format, 32 bits per channel. */ "R32G32B32A32"] = 8] = "R32G32B32A32";
|
|
7586
|
-
TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "BC1"] = 9] = "BC1";
|
|
7587
|
-
TextureFormat[TextureFormat[/** RGBA compressed format, 8 bits per pixel. */ "BC3"] = 10] = "BC3";
|
|
7588
|
-
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 4x4 pixel block. */ "BC7"] = 11] = "BC7";
|
|
7589
|
-
TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "ETC1_RGB"] = 12] = "ETC1_RGB";
|
|
7590
|
-
TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "ETC2_RGB"] = 13] = "ETC2_RGB";
|
|
7591
|
-
TextureFormat[TextureFormat[/** RGBA compressed format, 5 bits per pixel, 4 bit in RGB, 1 bit in A. */ "ETC2_RGBA5"] = 14] = "ETC2_RGBA5";
|
|
7592
|
-
TextureFormat[TextureFormat[/** RGB compressed format, 8 bits per pixel. */ "ETC2_RGBA8"] = 15] = "ETC2_RGBA8";
|
|
7593
|
-
TextureFormat[TextureFormat[/** RGB compressed format, 2 bits per pixel. */ "PVRTC_RGB2"] = 16] = "PVRTC_RGB2";
|
|
7594
|
-
TextureFormat[TextureFormat[/** RGBA compressed format, 2 bits per pixel. */ "PVRTC_RGBA2"] = 17] = "PVRTC_RGBA2";
|
|
7595
|
-
TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "PVRTC_RGB4"] = 18] = "PVRTC_RGB4";
|
|
7596
|
-
TextureFormat[TextureFormat[/** RGBA compressed format, 4 bits per pixel. */ "PVRTC_RGBA4"] = 19] = "PVRTC_RGBA4";
|
|
7597
|
-
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 4x4 pixel block. */ "ASTC_4x4"] = 20] = "ASTC_4x4";
|
|
7598
|
-
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 5x5 pixel block. */ "ASTC_5x5"] = 21] = "ASTC_5x5";
|
|
7599
|
-
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 6x6 pixel block. */ "ASTC_6x6"] = 22] = "ASTC_6x6";
|
|
7600
|
-
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 8x8 pixel block. */ "ASTC_8x8"] = 23] = "ASTC_8x8";
|
|
7601
|
-
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 10x10 pixel block. */ "ASTC_10x10"] = 24] = "ASTC_10x10";
|
|
7602
|
-
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 12x12 pixel block. */ "ASTC_12x12"] = 25] = "ASTC_12x12";
|
|
7603
|
-
TextureFormat[TextureFormat[/** Automatic depth format, engine will automatically select the supported precision. */ "Depth"] = 26] = "Depth";
|
|
7604
|
-
TextureFormat[TextureFormat[/** Automatic depth stencil format, engine will automatically select the supported precision. */ "DepthStencil"] = 27] = "DepthStencil";
|
|
7605
|
-
TextureFormat[TextureFormat[/** 16-bit depth format. */ "Depth16"] = 28] = "Depth16";
|
|
7606
|
-
TextureFormat[TextureFormat[/** 24-bit depth format. */ "Depth24"] = 29] = "Depth24";
|
|
7607
|
-
TextureFormat[TextureFormat[/** 32-bit depth format. */ "Depth32"] = 30] = "Depth32";
|
|
7608
|
-
TextureFormat[TextureFormat[/** 16-bit depth + 8-bit stencil format. */ "Depth24Stencil8"] = 31] = "Depth24Stencil8";
|
|
7609
|
-
TextureFormat[TextureFormat[/** 32-bit depth + 8-bit stencil format. */ "Depth32Stencil8"] = 32] = "Depth32Stencil8";
|
|
7610
|
-
TextureFormat[TextureFormat[/** @deprecated Use `TextureFormat.BC1` instead. */ "DXT1"] = 33] = "DXT1";
|
|
7611
|
-
TextureFormat[TextureFormat[/** @deprecated Use `TextureFormat.BC3` instead. */ "DXT5"] = 34] = "DXT5";
|
|
7612
|
-
})(TextureFormat || (TextureFormat = {}));
|
|
7613
|
-
|
|
7614
7646
|
/**
|
|
7615
7647
|
* Texture usage.
|
|
7616
7648
|
*/ var TextureUsage;
|
|
@@ -7794,7 +7826,7 @@ var /**
|
|
|
7794
7826
|
_this._mipmapCount = _this._getMipmapCount();
|
|
7795
7827
|
_this._isDepthTexture = format == TextureFormat.Depth || format == TextureFormat.DepthStencil || format == TextureFormat.Depth16 || format == TextureFormat.Depth24 || format == TextureFormat.Depth32 || format == TextureFormat.Depth24Stencil8 || format == TextureFormat.Depth32Stencil8;
|
|
7796
7828
|
_this._platformTexture = engine._hardwareRenderer.createPlatformTexture2D(_assert_this_initialized(_this));
|
|
7797
|
-
_this.filterMode = TextureFilterMode.Bilinear;
|
|
7829
|
+
_this.filterMode = _this._isIntFormat() ? TextureFilterMode.Point : TextureFilterMode.Bilinear;
|
|
7798
7830
|
_this.wrapModeU = _this.wrapModeV = TextureWrapMode.Repeat;
|
|
7799
7831
|
return _this;
|
|
7800
7832
|
}
|
|
@@ -10604,7 +10636,7 @@ var PrimitiveType;
|
|
|
10604
10636
|
var theta = thetaStart + u * thetaRange;
|
|
10605
10637
|
var sinTheta = Math.sin(theta);
|
|
10606
10638
|
var cosTheta = Math.cos(theta);
|
|
10607
|
-
var curRadius = radius -
|
|
10639
|
+
var curRadius = radius - v * radius;
|
|
10608
10640
|
var posX = curRadius * sinTheta;
|
|
10609
10641
|
var posY = y * unitHeight - halfHeight;
|
|
10610
10642
|
var posZ = curRadius * cosTheta;
|
|
@@ -10738,8 +10770,8 @@ var PrimitiveType;
|
|
|
10738
10770
|
indices[indicesOffset++] = d;
|
|
10739
10771
|
indices[indicesOffset++] = c;
|
|
10740
10772
|
}
|
|
10741
|
-
PrimitiveMesh._createCapsuleCap(radius, height, radialSegments, thetaRange, torsoVertexCount, 1, vertices, indices, indicesOffset);
|
|
10742
|
-
PrimitiveMesh._createCapsuleCap(radius, height, radialSegments, -thetaRange, torsoVertexCount + capVertexCount, -1, vertices, indices, indicesOffset + 6 * capRectangleCount);
|
|
10773
|
+
PrimitiveMesh._createCapsuleCap(radius, height, radialSegments, thetaStart, thetaRange, torsoVertexCount, 1, vertices, indices, indicesOffset);
|
|
10774
|
+
PrimitiveMesh._createCapsuleCap(radius, height, radialSegments, thetaStart, -thetaRange, torsoVertexCount + capVertexCount, -1, vertices, indices, indicesOffset + 6 * capRectangleCount);
|
|
10743
10775
|
if (!isRestoreMode) {
|
|
10744
10776
|
var bounds = capsuleMesh.bounds;
|
|
10745
10777
|
bounds.min.set(-radius, -radius - halfHeight, -radius);
|
|
@@ -10780,7 +10812,7 @@ var PrimitiveType;
|
|
|
10780
10812
|
}
|
|
10781
10813
|
return indices;
|
|
10782
10814
|
};
|
|
10783
|
-
PrimitiveMesh._createCapsuleCap = function _createCapsuleCap(radius, height, radialSegments,
|
|
10815
|
+
PrimitiveMesh._createCapsuleCap = function _createCapsuleCap(radius, height, radialSegments, thetaStart, thetaRange, offset, posIndex, vertices, indices, indicesOffset) {
|
|
10784
10816
|
var radialCount = radialSegments + 1;
|
|
10785
10817
|
var halfHeight = height * 0.5 * posIndex;
|
|
10786
10818
|
var capVertexCount = radialCount * radialCount;
|
|
@@ -10793,12 +10825,12 @@ var PrimitiveType;
|
|
|
10793
10825
|
var y = i * radialCountReciprocal | 0;
|
|
10794
10826
|
var u = x * radialSegmentsReciprocal;
|
|
10795
10827
|
var v = y * radialSegmentsReciprocal;
|
|
10796
|
-
var
|
|
10797
|
-
var
|
|
10798
|
-
var
|
|
10799
|
-
var posX =
|
|
10800
|
-
var posY = radius * Math.cos(
|
|
10801
|
-
var posZ = radius * Math.
|
|
10828
|
+
var theta = thetaStart + u * thetaRange;
|
|
10829
|
+
var alpha = v * Math.PI * 0.5;
|
|
10830
|
+
var sinAlpha = Math.sin(alpha);
|
|
10831
|
+
var posX = radius * Math.sin(theta) * sinAlpha;
|
|
10832
|
+
var posY = radius * Math.cos(alpha) * posIndex + halfHeight;
|
|
10833
|
+
var posZ = radius * Math.cos(theta) * sinAlpha;
|
|
10802
10834
|
var index = (i + offset) * vertexFloatCount;
|
|
10803
10835
|
// Position
|
|
10804
10836
|
vertices[index++] = posX;
|
|
@@ -11357,7 +11389,9 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
|
|
|
11357
11389
|
this._batchedQueue = null;
|
|
11358
11390
|
var _this = this, meshes = _this._meshes, vertexBuffers = _this._vertexBuffers, indiceBuffers = _this._indiceBuffers;
|
|
11359
11391
|
for(var i = 0, n = meshes.length; i < n; ++i){
|
|
11360
|
-
meshes[i]
|
|
11392
|
+
var mesh = meshes[i];
|
|
11393
|
+
mesh._addReferCount(-1);
|
|
11394
|
+
mesh.destroy();
|
|
11361
11395
|
}
|
|
11362
11396
|
this._meshes = null;
|
|
11363
11397
|
for(var i1 = 0, n1 = vertexBuffers.length; i1 < n1; ++i1){
|
|
@@ -11380,7 +11414,7 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
|
|
|
11380
11414
|
_proto._createMesh = function _createMesh(engine, index) {
|
|
11381
11415
|
var MAX_VERTEX_COUNT = Basic2DBatcher.MAX_VERTEX_COUNT;
|
|
11382
11416
|
var mesh = new BufferMesh(engine, "BufferMesh" + index);
|
|
11383
|
-
mesh.
|
|
11417
|
+
mesh._addReferCount(1);
|
|
11384
11418
|
var vertexElements = [];
|
|
11385
11419
|
var vertexStride = this.createVertexElements(vertexElements);
|
|
11386
11420
|
// vertices
|
|
@@ -12879,6 +12913,9 @@ var /**
|
|
|
12879
12913
|
var baseline = Math.ceil(context.measureText(TextUtils._measureBaseline).width);
|
|
12880
12914
|
var height = baseline * TextUtils._heightMultiplier;
|
|
12881
12915
|
baseline = TextUtils._baselineMultiplier * baseline | 0;
|
|
12916
|
+
var _extendHeight = TextUtils._extendHeight;
|
|
12917
|
+
height += _extendHeight;
|
|
12918
|
+
baseline += _extendHeight * 0.5;
|
|
12882
12919
|
canvas.width = width;
|
|
12883
12920
|
canvas.height = height;
|
|
12884
12921
|
context.font = fontString;
|
|
@@ -12913,6 +12950,7 @@ var /**
|
|
|
12913
12950
|
}
|
|
12914
12951
|
if (top !== -1 && bottom !== -1) {
|
|
12915
12952
|
ascent = baseline - top;
|
|
12953
|
+
// Baseline belong to descent
|
|
12916
12954
|
descent = bottom - baseline + 1;
|
|
12917
12955
|
size = ascent + descent;
|
|
12918
12956
|
}
|
|
@@ -12989,9 +13027,8 @@ var /**
|
|
|
12989
13027
|
];
|
|
12990
13028
|
})();
|
|
12991
13029
|
(function() {
|
|
12992
|
-
//
|
|
12993
|
-
|
|
12994
|
-
/** @internal */ TextUtils._heightMultiplier = 2;
|
|
13030
|
+
// _extendHeight used to extend the height of canvas, because in miniprogram performance is different from h5.
|
|
13031
|
+
/** @internal */ TextUtils._extendHeight = 0;
|
|
12995
13032
|
})();
|
|
12996
13033
|
(function() {
|
|
12997
13034
|
/** These characters are all tall to help calculate the height required for text. */ TextUtils._measureString = "|\xc9q\xc5";
|
|
@@ -12999,6 +13036,9 @@ var /**
|
|
|
12999
13036
|
(function() {
|
|
13000
13037
|
TextUtils._measureBaseline = "M";
|
|
13001
13038
|
})();
|
|
13039
|
+
(function() {
|
|
13040
|
+
TextUtils._heightMultiplier = 2;
|
|
13041
|
+
})();
|
|
13002
13042
|
(function() {
|
|
13003
13043
|
TextUtils._baselineMultiplier = 1.4;
|
|
13004
13044
|
})();
|
|
@@ -14757,6 +14797,7 @@ var TextRenderData = /*#__PURE__*/ function(RenderData1) {
|
|
|
14757
14797
|
AssetType[/** Cube Compress Texture. */ "KTXCube"] = "KTXCube";
|
|
14758
14798
|
AssetType[/** KTX2 Compress Texture */ "KTX2"] = "KTX2";
|
|
14759
14799
|
AssetType[/** Sprite. */ "Sprite"] = "Sprite";
|
|
14800
|
+
AssetType[/** PrimitiveMesh. */ "PrimitiveMesh"] = "PrimitiveMesh";
|
|
14760
14801
|
AssetType[/** Sprite Atlas. */ "SpriteAtlas"] = "SpriteAtlas";
|
|
14761
14802
|
AssetType[/** Ambient light. */ "Env"] = "Environment";
|
|
14762
14803
|
AssetType[/** Scene. */ "Scene"] = "Scene";
|
|
@@ -15142,6 +15183,7 @@ var /** @internal */ PromiseState;
|
|
|
15142
15183
|
this./** The number of retries after failing to load assets. */ retryCount = 1;
|
|
15143
15184
|
this./** Retry delay time after failed to load assets, in milliseconds. */ retryInterval = 0;
|
|
15144
15185
|
this./** The default timeout period for loading assets, in milliseconds. */ timeout = Infinity;
|
|
15186
|
+
this./** Base url for loading assets. */ baseUrl = null;
|
|
15145
15187
|
this._loadingPromises = {};
|
|
15146
15188
|
this._assetPool = Object.create(null);
|
|
15147
15189
|
this._assetUrlPool = Object.create(null);
|
|
@@ -15345,6 +15387,8 @@ var /** @internal */ PromiseState;
|
|
|
15345
15387
|
// Check url mapping
|
|
15346
15388
|
var itemURL = item.url;
|
|
15347
15389
|
var url = this._virtualPathMap[itemURL] ? this._virtualPathMap[itemURL] : itemURL;
|
|
15390
|
+
// Not absolute and base url is set
|
|
15391
|
+
if (!Utils.isAbsoluteUrl(url) && this.baseUrl) url = Utils.resolveAbsoluteUrl(this.baseUrl, url);
|
|
15348
15392
|
// Parse url
|
|
15349
15393
|
var _this__parseURL = this._parseURL(url), assetBaseURL = _this__parseURL.assetBaseURL, queryPath = _this__parseURL.queryPath;
|
|
15350
15394
|
var paths = queryPath ? this._parseQueryPath(queryPath) : [];
|
|
@@ -15437,10 +15481,20 @@ var /** @internal */ PromiseState;
|
|
|
15437
15481
|
};
|
|
15438
15482
|
_proto._parseURL = function _parseURL(path) {
|
|
15439
15483
|
var _path_split = path.split("?"), baseUrl = _path_split[0], searchStr = _path_split[1];
|
|
15440
|
-
var
|
|
15441
|
-
var
|
|
15442
|
-
|
|
15443
|
-
|
|
15484
|
+
var queryPath = undefined;
|
|
15485
|
+
var assetBaseURL = baseUrl;
|
|
15486
|
+
if (searchStr) {
|
|
15487
|
+
var params = searchStr.split("&");
|
|
15488
|
+
for(var i = 0; i < params.length; i++){
|
|
15489
|
+
var param = params[i];
|
|
15490
|
+
if (param.startsWith("q=")) {
|
|
15491
|
+
queryPath = decodeURIComponent(param.split("=")[1]);
|
|
15492
|
+
params.splice(i, 1);
|
|
15493
|
+
break;
|
|
15494
|
+
}
|
|
15495
|
+
}
|
|
15496
|
+
assetBaseURL = params.length > 0 ? baseUrl + "?" + params.join("&") : baseUrl;
|
|
15497
|
+
}
|
|
15444
15498
|
return {
|
|
15445
15499
|
assetBaseURL: assetBaseURL,
|
|
15446
15500
|
queryPath: queryPath
|
|
@@ -16035,7 +16089,7 @@ SystemInfo._initialize();
|
|
|
16035
16089
|
* Keyboard Manager.
|
|
16036
16090
|
* @internal
|
|
16037
16091
|
*/ var KeyboardManager = /*#__PURE__*/ function() {
|
|
16038
|
-
function KeyboardManager(engine) {
|
|
16092
|
+
function KeyboardManager(engine, target) {
|
|
16039
16093
|
/** @internal */ this._curHeldDownKeyToIndexMap = [];
|
|
16040
16094
|
/** @internal */ this._upKeyToFrameCountMap = [];
|
|
16041
16095
|
/** @internal */ this._downKeyToFrameCountMap = [];
|
|
@@ -16043,17 +16097,11 @@ SystemInfo._initialize();
|
|
|
16043
16097
|
/** @internal */ this._curFrameDownList = new DisorderedArray();
|
|
16044
16098
|
/** @internal */ this._curFrameUpList = new DisorderedArray();
|
|
16045
16099
|
this._nativeEvents = [];
|
|
16046
|
-
this._hadListener = false;
|
|
16047
|
-
// @ts-ignore
|
|
16048
|
-
var htmlCanvas = engine._canvas._webCanvas;
|
|
16049
16100
|
this._engine = engine;
|
|
16050
|
-
this.
|
|
16051
|
-
// Need to set tabIndex to make the canvas focus.
|
|
16052
|
-
htmlCanvas.tabIndex = htmlCanvas.tabIndex;
|
|
16101
|
+
this._onBlur = this._onBlur.bind(this);
|
|
16053
16102
|
this._onKeyEvent = this._onKeyEvent.bind(this);
|
|
16054
|
-
|
|
16055
|
-
|
|
16056
|
-
this._hadListener = true;
|
|
16103
|
+
this._target = target;
|
|
16104
|
+
this._addEventListener();
|
|
16057
16105
|
}
|
|
16058
16106
|
var _proto = KeyboardManager.prototype;
|
|
16059
16107
|
/**
|
|
@@ -16105,35 +16153,8 @@ SystemInfo._initialize();
|
|
|
16105
16153
|
};
|
|
16106
16154
|
/**
|
|
16107
16155
|
* @internal
|
|
16108
|
-
*/ _proto._onFocus = function _onFocus() {
|
|
16109
|
-
if (!this._hadListener) {
|
|
16110
|
-
this._htmlCanvas.addEventListener("keydown", this._onKeyEvent);
|
|
16111
|
-
this._htmlCanvas.addEventListener("keyup", this._onKeyEvent);
|
|
16112
|
-
this._hadListener = true;
|
|
16113
|
-
}
|
|
16114
|
-
};
|
|
16115
|
-
/**
|
|
16116
|
-
* @internal
|
|
16117
|
-
*/ _proto._onBlur = function _onBlur() {
|
|
16118
|
-
if (this._hadListener) {
|
|
16119
|
-
this._htmlCanvas.removeEventListener("keydown", this._onKeyEvent);
|
|
16120
|
-
this._htmlCanvas.removeEventListener("keyup", this._onKeyEvent);
|
|
16121
|
-
this._curHeldDownKeyToIndexMap.length = 0;
|
|
16122
|
-
this._curFrameHeldDownList.length = 0;
|
|
16123
|
-
this._curFrameDownList.length = 0;
|
|
16124
|
-
this._curFrameUpList.length = 0;
|
|
16125
|
-
this._nativeEvents.length = 0;
|
|
16126
|
-
this._hadListener = false;
|
|
16127
|
-
}
|
|
16128
|
-
};
|
|
16129
|
-
/**
|
|
16130
|
-
* @internal
|
|
16131
16156
|
*/ _proto._destroy = function _destroy() {
|
|
16132
|
-
|
|
16133
|
-
this._htmlCanvas.removeEventListener("keydown", this._onKeyEvent);
|
|
16134
|
-
this._htmlCanvas.removeEventListener("keyup", this._onKeyEvent);
|
|
16135
|
-
this._hadListener = false;
|
|
16136
|
-
}
|
|
16157
|
+
this._removeEventListener();
|
|
16137
16158
|
this._curHeldDownKeyToIndexMap.length = 0;
|
|
16138
16159
|
this._curHeldDownKeyToIndexMap = null;
|
|
16139
16160
|
this._upKeyToFrameCountMap.length = 0;
|
|
@@ -16148,12 +16169,30 @@ SystemInfo._initialize();
|
|
|
16148
16169
|
this._curFrameDownList = null;
|
|
16149
16170
|
this._curFrameUpList.length = 0;
|
|
16150
16171
|
this._curFrameUpList = null;
|
|
16151
|
-
this._htmlCanvas = null;
|
|
16152
16172
|
this._engine = null;
|
|
16153
16173
|
};
|
|
16174
|
+
_proto._onBlur = function _onBlur() {
|
|
16175
|
+
this._curHeldDownKeyToIndexMap.length = 0;
|
|
16176
|
+
this._curFrameHeldDownList.length = 0;
|
|
16177
|
+
this._curFrameDownList.length = 0;
|
|
16178
|
+
this._curFrameUpList.length = 0;
|
|
16179
|
+
this._nativeEvents.length = 0;
|
|
16180
|
+
};
|
|
16154
16181
|
_proto._onKeyEvent = function _onKeyEvent(evt) {
|
|
16155
16182
|
this._nativeEvents.push(evt);
|
|
16156
16183
|
};
|
|
16184
|
+
_proto._addEventListener = function _addEventListener() {
|
|
16185
|
+
var _this = this, target = _this._target;
|
|
16186
|
+
target.addEventListener("keydown", this._onKeyEvent);
|
|
16187
|
+
target.addEventListener("keyup", this._onKeyEvent);
|
|
16188
|
+
target.addEventListener("blur", this._onBlur);
|
|
16189
|
+
};
|
|
16190
|
+
_proto._removeEventListener = function _removeEventListener() {
|
|
16191
|
+
var _this = this, target = _this._target;
|
|
16192
|
+
target.removeEventListener("keydown", this._onKeyEvent);
|
|
16193
|
+
target.removeEventListener("keyup", this._onKeyEvent);
|
|
16194
|
+
target.removeEventListener("blur", this._onBlur);
|
|
16195
|
+
};
|
|
16157
16196
|
return KeyboardManager;
|
|
16158
16197
|
}();
|
|
16159
16198
|
|
|
@@ -16456,7 +16495,9 @@ var Collision = function Collision() {
|
|
|
16456
16495
|
};
|
|
16457
16496
|
if (hitResult != undefined) {
|
|
16458
16497
|
var result = this._nativePhysicsScene.raycast(ray, distance, onRaycast, function(idx, distance, position, normal) {
|
|
16459
|
-
|
|
16498
|
+
var hitShape = _this._scene.engine._physicalObjectsMap[idx];
|
|
16499
|
+
hitResult.entity = hitShape._collider.entity;
|
|
16500
|
+
hitResult.shape = hitShape;
|
|
16460
16501
|
hitResult.distance = distance;
|
|
16461
16502
|
hitResult.normal.copyFrom(normal);
|
|
16462
16503
|
hitResult.point.copyFrom(position);
|
|
@@ -16465,6 +16506,7 @@ var Collision = function Collision() {
|
|
|
16465
16506
|
return true;
|
|
16466
16507
|
} else {
|
|
16467
16508
|
hitResult.entity = null;
|
|
16509
|
+
hitResult.shape = null;
|
|
16468
16510
|
hitResult.distance = 0;
|
|
16469
16511
|
hitResult.point.set(0, 0, 0);
|
|
16470
16512
|
hitResult.normal.set(0, 0, 0);
|
|
@@ -17126,6 +17168,7 @@ var DynamicColliderConstraints;
|
|
|
17126
17168
|
/** The distance from the ray's origin to the impact point. */ this.distance = 0;
|
|
17127
17169
|
/** The impact point in world space where the ray hit the collider. */ this.point = new Vector3();
|
|
17128
17170
|
/** The normal of the surface the ray hit. */ this.normal = new Vector3();
|
|
17171
|
+
/** The shape of the collider that was hit. */ this.shape = null;
|
|
17129
17172
|
};
|
|
17130
17173
|
|
|
17131
17174
|
/**
|
|
@@ -18117,7 +18160,7 @@ __decorate([
|
|
|
18117
18160
|
* Pointer Manager.
|
|
18118
18161
|
* @internal
|
|
18119
18162
|
*/ var PointerManager = /*#__PURE__*/ function() {
|
|
18120
|
-
function PointerManager(engine) {
|
|
18163
|
+
function PointerManager(engine, target) {
|
|
18121
18164
|
/** @internal */ this._pointers = [];
|
|
18122
18165
|
/** @internal */ this._multiPointerEnabled = true;
|
|
18123
18166
|
/** @internal */ this._buttons = PointerButton.None;
|
|
@@ -18126,16 +18169,18 @@ __decorate([
|
|
|
18126
18169
|
/** @internal */ this._upList = new DisorderedArray();
|
|
18127
18170
|
/** @internal */ this._downList = new DisorderedArray();
|
|
18128
18171
|
this._nativeEvents = [];
|
|
18129
|
-
|
|
18130
|
-
|
|
18131
|
-
|
|
18172
|
+
if (_instanceof(target, Window)) {
|
|
18173
|
+
throw "Do not set window as target because window cannot listen to pointer leave event.";
|
|
18174
|
+
}
|
|
18132
18175
|
this._engine = engine;
|
|
18176
|
+
this._target = target;
|
|
18133
18177
|
this._canvas = engine.canvas;
|
|
18134
|
-
|
|
18135
|
-
this.
|
|
18136
|
-
this._onFocus();
|
|
18178
|
+
// @ts-ignore
|
|
18179
|
+
this._htmlCanvas = engine._canvas._webCanvas;
|
|
18137
18180
|
// If there are no compatibility issues, navigator.maxTouchPoints should be used here
|
|
18138
18181
|
this._pointerPool = new Array(11);
|
|
18182
|
+
this._onPointerEvent = this._onPointerEvent.bind(this);
|
|
18183
|
+
this._addEventListener();
|
|
18139
18184
|
}
|
|
18140
18185
|
var _proto = PointerManager.prototype;
|
|
18141
18186
|
/**
|
|
@@ -18205,7 +18250,8 @@ __decorate([
|
|
|
18205
18250
|
var length = events.length;
|
|
18206
18251
|
if (length > 0) {
|
|
18207
18252
|
for(var i1 = 0; i1 < length; i1++){
|
|
18208
|
-
|
|
18253
|
+
var event = events[i1];
|
|
18254
|
+
switch(event.type){
|
|
18209
18255
|
case "pointerdown":
|
|
18210
18256
|
pointer.phase = PointerPhase.Down;
|
|
18211
18257
|
pointer._firePointerDown(rayCastEntity);
|
|
@@ -18227,66 +18273,14 @@ __decorate([
|
|
|
18227
18273
|
};
|
|
18228
18274
|
/**
|
|
18229
18275
|
* @internal
|
|
18230
|
-
*/ _proto._onFocus = function _onFocus() {
|
|
18231
|
-
if (!this._hadListener) {
|
|
18232
|
-
var _this = this, htmlCanvas = _this._htmlCanvas, onPointerEvent = _this._onPointerEvent;
|
|
18233
|
-
htmlCanvas.addEventListener("pointerdown", onPointerEvent);
|
|
18234
|
-
htmlCanvas.addEventListener("pointerup", onPointerEvent);
|
|
18235
|
-
htmlCanvas.addEventListener("pointerleave", onPointerEvent);
|
|
18236
|
-
htmlCanvas.addEventListener("pointermove", onPointerEvent);
|
|
18237
|
-
htmlCanvas.addEventListener("pointercancel", onPointerEvent);
|
|
18238
|
-
this._hadListener = true;
|
|
18239
|
-
}
|
|
18240
|
-
};
|
|
18241
|
-
/**
|
|
18242
|
-
* @internal
|
|
18243
|
-
*/ _proto._onBlur = function _onBlur() {
|
|
18244
|
-
if (this._hadListener) {
|
|
18245
|
-
var _this = this, htmlCanvas = _this._htmlCanvas, onPointerEvent = _this._onPointerEvent;
|
|
18246
|
-
htmlCanvas.removeEventListener("pointerdown", onPointerEvent);
|
|
18247
|
-
htmlCanvas.removeEventListener("pointerup", onPointerEvent);
|
|
18248
|
-
htmlCanvas.removeEventListener("pointerleave", onPointerEvent);
|
|
18249
|
-
htmlCanvas.removeEventListener("pointermove", onPointerEvent);
|
|
18250
|
-
htmlCanvas.removeEventListener("pointercancel", onPointerEvent);
|
|
18251
|
-
this._hadListener = false;
|
|
18252
|
-
this._pointers.length = 0;
|
|
18253
|
-
this._downList.length = 0;
|
|
18254
|
-
this._upList.length = 0;
|
|
18255
|
-
}
|
|
18256
|
-
};
|
|
18257
|
-
/**
|
|
18258
|
-
* @internal
|
|
18259
18276
|
*/ _proto._destroy = function _destroy() {
|
|
18260
|
-
|
|
18261
|
-
if (this._hadListener) {
|
|
18262
|
-
var _this = this, htmlCanvas = _this._htmlCanvas, onPointerEvent = _this._onPointerEvent;
|
|
18263
|
-
htmlCanvas.removeEventListener("pointerdown", onPointerEvent);
|
|
18264
|
-
htmlCanvas.removeEventListener("pointerup", onPointerEvent);
|
|
18265
|
-
htmlCanvas.removeEventListener("pointerleave", onPointerEvent);
|
|
18266
|
-
htmlCanvas.removeEventListener("pointermove", onPointerEvent);
|
|
18267
|
-
htmlCanvas.removeEventListener("pointercancel", onPointerEvent);
|
|
18268
|
-
this._hadListener = false;
|
|
18269
|
-
}
|
|
18277
|
+
this._removeEventListener();
|
|
18270
18278
|
this._pointerPool.length = 0;
|
|
18271
|
-
this._pointerPool = null;
|
|
18272
|
-
this._pointers.length = 0;
|
|
18273
|
-
this._pointers = null;
|
|
18274
|
-
this._downList.length = 0;
|
|
18275
|
-
this._downList = null;
|
|
18276
|
-
this._upList.length = 0;
|
|
18277
|
-
this._upList = null;
|
|
18278
18279
|
this._nativeEvents.length = 0;
|
|
18279
|
-
this._nativeEvents = null;
|
|
18280
|
-
this._upMap.length = 0;
|
|
18281
|
-
this._upMap = null;
|
|
18282
18280
|
this._downMap.length = 0;
|
|
18283
|
-
this.
|
|
18284
|
-
this._htmlCanvas = null;
|
|
18285
|
-
this._canvas = null;
|
|
18286
|
-
this._engine = null;
|
|
18281
|
+
this._upMap.length = 0;
|
|
18287
18282
|
};
|
|
18288
18283
|
_proto._onPointerEvent = function _onPointerEvent(evt) {
|
|
18289
|
-
evt.type === "pointerdown" && this._htmlCanvas.focus();
|
|
18290
18284
|
this._nativeEvents.push(evt);
|
|
18291
18285
|
};
|
|
18292
18286
|
_proto._getPointerByID = function _getPointerByID(pointerId) {
|
|
@@ -18369,6 +18363,26 @@ __decorate([
|
|
|
18369
18363
|
}
|
|
18370
18364
|
return null;
|
|
18371
18365
|
};
|
|
18366
|
+
_proto._addEventListener = function _addEventListener() {
|
|
18367
|
+
var _this = this, target = _this._target, onPointerEvent = _this._onPointerEvent;
|
|
18368
|
+
target.addEventListener("pointerdown", onPointerEvent);
|
|
18369
|
+
target.addEventListener("pointerup", onPointerEvent);
|
|
18370
|
+
target.addEventListener("pointerleave", onPointerEvent);
|
|
18371
|
+
target.addEventListener("pointermove", onPointerEvent);
|
|
18372
|
+
target.addEventListener("pointercancel", onPointerEvent);
|
|
18373
|
+
};
|
|
18374
|
+
_proto._removeEventListener = function _removeEventListener() {
|
|
18375
|
+
var _this = this, target = _this._target, onPointerEvent = _this._onPointerEvent;
|
|
18376
|
+
target.removeEventListener("pointerdown", onPointerEvent);
|
|
18377
|
+
target.removeEventListener("pointerup", onPointerEvent);
|
|
18378
|
+
target.removeEventListener("pointerleave", onPointerEvent);
|
|
18379
|
+
target.removeEventListener("pointermove", onPointerEvent);
|
|
18380
|
+
target.removeEventListener("pointercancel", onPointerEvent);
|
|
18381
|
+
this._nativeEvents.length = 0;
|
|
18382
|
+
this._pointers.length = 0;
|
|
18383
|
+
this._downList.length = 0;
|
|
18384
|
+
this._upList.length = 0;
|
|
18385
|
+
};
|
|
18372
18386
|
return PointerManager;
|
|
18373
18387
|
}();
|
|
18374
18388
|
(function() {
|
|
@@ -18385,15 +18399,12 @@ __decorate([
|
|
|
18385
18399
|
* Wheel Manager.
|
|
18386
18400
|
* @internal
|
|
18387
18401
|
*/ var WheelManager = /*#__PURE__*/ function() {
|
|
18388
|
-
function WheelManager(engine) {
|
|
18402
|
+
function WheelManager(engine, target) {
|
|
18389
18403
|
/** @internal */ this._delta = new Vector3();
|
|
18390
18404
|
this._nativeEvents = [];
|
|
18391
|
-
// @ts-ignore
|
|
18392
|
-
var htmlCanvas = engine._canvas._webCanvas;
|
|
18393
18405
|
this._onWheelEvent = this._onWheelEvent.bind(this);
|
|
18394
|
-
|
|
18395
|
-
this.
|
|
18396
|
-
this._hadListener = true;
|
|
18406
|
+
this._target = target;
|
|
18407
|
+
this._addEventListener();
|
|
18397
18408
|
}
|
|
18398
18409
|
var _proto = WheelManager.prototype;
|
|
18399
18410
|
/**
|
|
@@ -18414,35 +18425,24 @@ __decorate([
|
|
|
18414
18425
|
};
|
|
18415
18426
|
/**
|
|
18416
18427
|
* @internal
|
|
18417
|
-
*/ _proto.
|
|
18418
|
-
|
|
18419
|
-
this._canvas.addEventListener("wheel", this._onWheelEvent);
|
|
18420
|
-
this._hadListener = true;
|
|
18421
|
-
}
|
|
18428
|
+
*/ _proto._addEventListener = function _addEventListener() {
|
|
18429
|
+
this._target.addEventListener("wheel", this._onWheelEvent);
|
|
18422
18430
|
};
|
|
18423
18431
|
/**
|
|
18424
18432
|
* @internal
|
|
18425
|
-
*/ _proto.
|
|
18426
|
-
|
|
18427
|
-
|
|
18428
|
-
|
|
18429
|
-
this._delta.set(0, 0, 0);
|
|
18430
|
-
this._hadListener = false;
|
|
18431
|
-
}
|
|
18433
|
+
*/ _proto._removeEventListener = function _removeEventListener() {
|
|
18434
|
+
this._target.removeEventListener("wheel", this._onWheelEvent);
|
|
18435
|
+
this._nativeEvents.length = 0;
|
|
18436
|
+
this._delta.set(0, 0, 0);
|
|
18432
18437
|
};
|
|
18433
18438
|
/**
|
|
18434
18439
|
* @internal
|
|
18435
18440
|
*/ _proto._destroy = function _destroy() {
|
|
18436
|
-
|
|
18437
|
-
this._canvas.removeEventListener("wheel", this._onWheelEvent);
|
|
18438
|
-
this._hadListener = false;
|
|
18439
|
-
}
|
|
18441
|
+
this._removeEventListener();
|
|
18440
18442
|
this._nativeEvents = null;
|
|
18441
|
-
this._canvas = null;
|
|
18442
18443
|
this._delta = null;
|
|
18443
18444
|
};
|
|
18444
18445
|
_proto._onWheelEvent = function _onWheelEvent(evt) {
|
|
18445
|
-
evt.cancelable && evt.preventDefault();
|
|
18446
18446
|
this._nativeEvents.push(evt);
|
|
18447
18447
|
};
|
|
18448
18448
|
return WheelManager;
|
|
@@ -18451,19 +18451,19 @@ __decorate([
|
|
|
18451
18451
|
/**
|
|
18452
18452
|
* InputManager manages device input such as mouse, touch, keyboard, etc.
|
|
18453
18453
|
*/ var InputManager = /*#__PURE__*/ function() {
|
|
18454
|
-
function InputManager(engine) {
|
|
18454
|
+
function InputManager(engine, inputOptions) {
|
|
18455
18455
|
/** Sometimes the input module will not be initialized, such as off-screen rendering. */ this._initialized = false;
|
|
18456
18456
|
this._engine = engine;
|
|
18457
18457
|
// @ts-ignore
|
|
18458
18458
|
var canvas = engine._canvas._webCanvas;
|
|
18459
18459
|
if (typeof OffscreenCanvas === "undefined" || !_instanceof(canvas, OffscreenCanvas)) {
|
|
18460
|
-
|
|
18461
|
-
|
|
18462
|
-
this.
|
|
18463
|
-
|
|
18464
|
-
|
|
18465
|
-
|
|
18466
|
-
|
|
18460
|
+
var _inputOptions, _inputOptions1, _inputOptions2;
|
|
18461
|
+
var _inputOptions_wheelTarget;
|
|
18462
|
+
this._wheelManager = new WheelManager(engine, (_inputOptions_wheelTarget = (_inputOptions = inputOptions) == null ? void 0 : _inputOptions.wheelTarget) != null ? _inputOptions_wheelTarget : canvas);
|
|
18463
|
+
var _inputOptions_pointerTarget;
|
|
18464
|
+
this._pointerManager = new PointerManager(engine, (_inputOptions_pointerTarget = (_inputOptions1 = inputOptions) == null ? void 0 : _inputOptions1.pointerTarget) != null ? _inputOptions_pointerTarget : canvas);
|
|
18465
|
+
var _inputOptions_keyboardTarget;
|
|
18466
|
+
this._keyboardManager = new KeyboardManager(engine, (_inputOptions_keyboardTarget = (_inputOptions2 = inputOptions) == null ? void 0 : _inputOptions2.keyboardTarget) != null ? _inputOptions_keyboardTarget : window);
|
|
18467
18467
|
this._initialized = true;
|
|
18468
18468
|
}
|
|
18469
18469
|
}
|
|
@@ -18576,8 +18576,6 @@ __decorate([
|
|
|
18576
18576
|
* @internal
|
|
18577
18577
|
*/ _proto._destroy = function _destroy() {
|
|
18578
18578
|
if (this._initialized) {
|
|
18579
|
-
window.removeEventListener("blur", this._onBlur);
|
|
18580
|
-
window.removeEventListener("focus", this._onFocus);
|
|
18581
18579
|
this._wheelManager._destroy();
|
|
18582
18580
|
this._wheelManager = null;
|
|
18583
18581
|
this._pointerManager._destroy();
|
|
@@ -18586,16 +18584,6 @@ __decorate([
|
|
|
18586
18584
|
this._keyboardManager = null;
|
|
18587
18585
|
}
|
|
18588
18586
|
};
|
|
18589
|
-
_proto._onBlur = function _onBlur() {
|
|
18590
|
-
this._wheelManager._onBlur();
|
|
18591
|
-
this._pointerManager._onBlur();
|
|
18592
|
-
this._keyboardManager._onBlur();
|
|
18593
|
-
};
|
|
18594
|
-
_proto._onFocus = function _onFocus() {
|
|
18595
|
-
this._wheelManager._onFocus();
|
|
18596
|
-
this._pointerManager._onFocus();
|
|
18597
|
-
this._keyboardManager._onFocus();
|
|
18598
|
-
};
|
|
18599
18587
|
_create_class(InputManager, [
|
|
18600
18588
|
{
|
|
18601
18589
|
key: "pointers",
|
|
@@ -18974,8 +18962,9 @@ var unlitVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\n#in
|
|
|
18974
18962
|
}
|
|
18975
18963
|
return;
|
|
18976
18964
|
}
|
|
18965
|
+
++hierarchy;
|
|
18977
18966
|
for(var k1 in cacheMap){
|
|
18978
|
-
this._recursiveDestroy(
|
|
18967
|
+
this._recursiveDestroy(hierarchy, cacheMap[k1]);
|
|
18979
18968
|
}
|
|
18980
18969
|
};
|
|
18981
18970
|
_proto._resizeCacheMapHierarchy = function _resizeCacheMapHierarchy(cacheMap, hierarchy, currentHierarchy, increaseHierarchy) {
|
|
@@ -19093,7 +19082,7 @@ ShaderPool.init();
|
|
|
19093
19082
|
_this._spriteMaskDefaultMaterial = _this._createSpriteMaskMaterial();
|
|
19094
19083
|
_this._textDefaultFont = Font.createFromOS(_assert_this_initialized(_this), "Arial");
|
|
19095
19084
|
_this._textDefaultFont.isGCIgnored = true;
|
|
19096
|
-
_this.inputManager = new InputManager(_assert_this_initialized(_this));
|
|
19085
|
+
_this.inputManager = new InputManager(_assert_this_initialized(_this), configuration.input);
|
|
19097
19086
|
var xrDevice = configuration.xrDevice;
|
|
19098
19087
|
if (xrDevice) {
|
|
19099
19088
|
_this.xrManager = new XRManager();
|
|
@@ -19387,6 +19376,26 @@ ShaderPool.init();
|
|
|
19387
19376
|
this._magentaTexture2D = magentaTexture2D;
|
|
19388
19377
|
this._magentaTextureCube = magentaTextureCube;
|
|
19389
19378
|
if (hardwareRenderer.isWebGL2) {
|
|
19379
|
+
var magentaPixel32 = new Uint32Array([
|
|
19380
|
+
255,
|
|
19381
|
+
0,
|
|
19382
|
+
255,
|
|
19383
|
+
255
|
|
19384
|
+
]);
|
|
19385
|
+
var uintMagentaTexture2D = new Texture2D(this, 1, 1, TextureFormat.R32G32B32A32_UInt, false);
|
|
19386
|
+
uintMagentaTexture2D.setPixelBuffer(magentaPixel32);
|
|
19387
|
+
uintMagentaTexture2D.isGCIgnored = true;
|
|
19388
|
+
this.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
|
|
19389
|
+
_inherits(_class, ContentRestorer);
|
|
19390
|
+
function _class() {
|
|
19391
|
+
return ContentRestorer.call(this, uintMagentaTexture2D);
|
|
19392
|
+
}
|
|
19393
|
+
var _proto = _class.prototype;
|
|
19394
|
+
_proto.restoreContent = function restoreContent() {
|
|
19395
|
+
this.resource.setPixelBuffer(magentaPixel32);
|
|
19396
|
+
};
|
|
19397
|
+
return _class;
|
|
19398
|
+
}(ContentRestorer))());
|
|
19390
19399
|
var magentaTexture2DArray = new Texture2DArray(this, 1, 1, 1, TextureFormat.R8G8B8A8, false);
|
|
19391
19400
|
magentaTexture2DArray.setPixelBuffer(0, magentaPixel);
|
|
19392
19401
|
magentaTexture2DArray.isGCIgnored = true;
|
|
@@ -19401,6 +19410,7 @@ ShaderPool.init();
|
|
|
19401
19410
|
};
|
|
19402
19411
|
return _class;
|
|
19403
19412
|
}(ContentRestorer))());
|
|
19413
|
+
this._uintMagentaTexture2D = uintMagentaTexture2D;
|
|
19404
19414
|
this._magentaTexture2DArray = magentaTexture2DArray;
|
|
19405
19415
|
}
|
|
19406
19416
|
};
|
|
@@ -19633,8 +19643,8 @@ ShaderPool.init();
|
|
|
19633
19643
|
set: function set(value) {
|
|
19634
19644
|
if (this._width !== value) {
|
|
19635
19645
|
this._width = value;
|
|
19646
|
+
this._onWidthChanged(value);
|
|
19636
19647
|
this._sizeUpdateFlagManager.dispatch();
|
|
19637
|
-
this._onSizeChanged(value, this._width);
|
|
19638
19648
|
}
|
|
19639
19649
|
}
|
|
19640
19650
|
},
|
|
@@ -19648,8 +19658,8 @@ ShaderPool.init();
|
|
|
19648
19658
|
set: function set(value) {
|
|
19649
19659
|
if (this._height !== value) {
|
|
19650
19660
|
this._height = value;
|
|
19661
|
+
this._onHeightChange(value);
|
|
19651
19662
|
this._sizeUpdateFlagManager.dispatch();
|
|
19652
|
-
this._onSizeChanged(this._width, value);
|
|
19653
19663
|
}
|
|
19654
19664
|
}
|
|
19655
19665
|
}
|
|
@@ -21004,6 +21014,10 @@ __decorate([
|
|
|
21004
21014
|
/** The splits of two cascade distribution. */ _this.shadowTwoCascadeSplits = 1.0 / 3.0;
|
|
21005
21015
|
/** The splits of four cascade distribution. */ _this.shadowFourCascadeSplits = new Vector3(1.0 / 15, 3.0 / 15.0, 7.0 / 15.0);
|
|
21006
21016
|
/** Max Shadow distance. */ _this.shadowDistance = 50;
|
|
21017
|
+
/**
|
|
21018
|
+
* Last shadow fade distance in percentage, range [0,1].
|
|
21019
|
+
* @remarks Value 0 is used for no shadow fade.
|
|
21020
|
+
*/ _this.shadowFadeBorder = 0.1;
|
|
21007
21021
|
/* @internal */ _this._lightManager = new LightManager();
|
|
21008
21022
|
/* @internal */ _this._componentsManager = new ComponentsManager();
|
|
21009
21023
|
/** @internal */ _this._isActiveInEngine = false;
|
|
@@ -21628,47 +21642,66 @@ __decorate([
|
|
|
21628
21642
|
DepthTextureMode[DepthTextureMode[/* Generate depth texture by pre-pass rendering. */ "PrePass"] = 1] = "PrePass";
|
|
21629
21643
|
})(DepthTextureMode || (DepthTextureMode = {}));
|
|
21630
21644
|
|
|
21631
|
-
var passNum = 0;
|
|
21632
21645
|
/**
|
|
21633
|
-
*
|
|
21634
|
-
*/ var
|
|
21635
|
-
|
|
21636
|
-
|
|
21637
|
-
|
|
21638
|
-
|
|
21639
|
-
|
|
21640
|
-
|
|
21641
|
-
|
|
21642
|
-
this.enabled = true;
|
|
21643
|
-
this.priority = priority;
|
|
21644
|
-
this.renderTarget = renderTarget;
|
|
21645
|
-
this.replaceMaterial = replaceMaterial;
|
|
21646
|
-
this.mask = mask || Layer.Everything;
|
|
21647
|
-
this.renderOverride = false; // If renderOverride is set to true, you need to implement the render method
|
|
21648
|
-
}
|
|
21649
|
-
var _proto = RenderPass.prototype;
|
|
21650
|
-
/**
|
|
21651
|
-
* Rendering callback, will be executed if renderOverride is set to true.
|
|
21652
|
-
* @param camera - Camera
|
|
21653
|
-
* @param opaqueQueue - Opaque queue
|
|
21654
|
-
* @param alphaTestQueue - Alpha test queue
|
|
21655
|
-
* @param transparentQueue - Transparent queue
|
|
21656
|
-
*/ _proto.render = function render(camera, opaqueQueue, alphaTestQueue, transparentQueue) {};
|
|
21646
|
+
* PipelinePass is a base class for all pipeline passes.
|
|
21647
|
+
*/ var PipelinePass = function PipelinePass(engine) {
|
|
21648
|
+
this._engine = engine;
|
|
21649
|
+
};
|
|
21650
|
+
|
|
21651
|
+
/**
|
|
21652
|
+
* @internal
|
|
21653
|
+
*/ var PipelineUtils = /*#__PURE__*/ function() {
|
|
21654
|
+
function PipelineUtils() {}
|
|
21657
21655
|
/**
|
|
21658
|
-
*
|
|
21659
|
-
* @param
|
|
21660
|
-
* @param
|
|
21661
|
-
* @param
|
|
21662
|
-
* @param
|
|
21663
|
-
|
|
21656
|
+
* Recreate texture if needed.
|
|
21657
|
+
* @param engine - Engine
|
|
21658
|
+
* @param currentTexture - Current texture
|
|
21659
|
+
* @param width - Need texture width
|
|
21660
|
+
* @param height - Need texture height
|
|
21661
|
+
* @param format - Need texture format
|
|
21662
|
+
* @param mipmap - Need texture mipmap
|
|
21663
|
+
* @returns Texture
|
|
21664
|
+
*/ PipelineUtils.recreateTextureIfNeeded = function recreateTextureIfNeeded(engine, currentTexture, width, height, format, mipmap) {
|
|
21665
|
+
if (currentTexture) {
|
|
21666
|
+
if (currentTexture.width !== width || currentTexture.height !== height || currentTexture.format !== format || currentTexture.mipmapCount > 1 !== mipmap) {
|
|
21667
|
+
currentTexture.destroy();
|
|
21668
|
+
var texture = new Texture2D(engine, width, height, format, mipmap);
|
|
21669
|
+
texture.isGCIgnored = true;
|
|
21670
|
+
return texture;
|
|
21671
|
+
} else {
|
|
21672
|
+
return currentTexture;
|
|
21673
|
+
}
|
|
21674
|
+
} else {
|
|
21675
|
+
var texture1 = new Texture2D(engine, width, height, format, mipmap);
|
|
21676
|
+
texture1.isGCIgnored = true;
|
|
21677
|
+
return texture1;
|
|
21678
|
+
}
|
|
21679
|
+
};
|
|
21664
21680
|
/**
|
|
21665
|
-
*
|
|
21666
|
-
* @param
|
|
21667
|
-
* @param
|
|
21668
|
-
* @param
|
|
21669
|
-
* @param
|
|
21670
|
-
|
|
21671
|
-
|
|
21681
|
+
* Recreate render target if needed.
|
|
21682
|
+
* @param engine - Engine
|
|
21683
|
+
* @param currentRenderTarget - Current render target
|
|
21684
|
+
* @param width - Need render target width
|
|
21685
|
+
* @param height - Need render target height
|
|
21686
|
+
* @param colorFormat - Need render target color format
|
|
21687
|
+
* @param depthFormat - Need render target depth format
|
|
21688
|
+
* @param mipmap - Need render target mipmap
|
|
21689
|
+
* @returns Render target
|
|
21690
|
+
*/ PipelineUtils.recreateRenderTargetIfNeeded = function recreateRenderTargetIfNeeded(engine, currentRenderTarget, width, height, colorFormat, depthFormat, mipmap) {
|
|
21691
|
+
var _currentRenderTarget, _currentRenderTarget1;
|
|
21692
|
+
var currentColorTexture = (_currentRenderTarget = currentRenderTarget) == null ? void 0 : _currentRenderTarget.getColorTexture(0);
|
|
21693
|
+
var currentDepthTexture = (_currentRenderTarget1 = currentRenderTarget) == null ? void 0 : _currentRenderTarget1.depthTexture;
|
|
21694
|
+
var colorTexture = colorFormat ? PipelineUtils.recreateTextureIfNeeded(engine, currentColorTexture, width, height, colorFormat, mipmap) : null;
|
|
21695
|
+
var depthTexture = depthFormat ? PipelineUtils.recreateTextureIfNeeded(engine, currentDepthTexture, width, height, depthFormat, mipmap) : null;
|
|
21696
|
+
if (currentColorTexture !== colorTexture || currentDepthTexture !== depthTexture) {
|
|
21697
|
+
var _currentRenderTarget2;
|
|
21698
|
+
(_currentRenderTarget2 = currentRenderTarget) == null ? void 0 : _currentRenderTarget2.destroy();
|
|
21699
|
+
currentRenderTarget = new RenderTarget(engine, width, height, colorTexture, depthTexture);
|
|
21700
|
+
currentRenderTarget.isGCIgnored = true;
|
|
21701
|
+
}
|
|
21702
|
+
return currentRenderTarget;
|
|
21703
|
+
};
|
|
21704
|
+
return PipelineUtils;
|
|
21672
21705
|
}();
|
|
21673
21706
|
|
|
21674
21707
|
/**
|
|
@@ -21939,9 +21972,14 @@ var passNum = 0;
|
|
|
21939
21972
|
}
|
|
21940
21973
|
// make suer from the same renderer.
|
|
21941
21974
|
if (componentA.instanceId === componentB.instanceId) {
|
|
21942
|
-
return dataA.material._priority - dataB.material._priority
|
|
21975
|
+
return dataA.material._priority - dataB.material._priority;
|
|
21943
21976
|
} else {
|
|
21944
|
-
|
|
21977
|
+
var distanceDiff = componentA._distanceForSort - componentB._distanceForSort;
|
|
21978
|
+
if (distanceDiff === 0) {
|
|
21979
|
+
return componentA.instanceId - componentB.instanceId;
|
|
21980
|
+
} else {
|
|
21981
|
+
return distanceDiff;
|
|
21982
|
+
}
|
|
21945
21983
|
}
|
|
21946
21984
|
};
|
|
21947
21985
|
/**
|
|
@@ -21957,68 +21995,60 @@ var passNum = 0;
|
|
|
21957
21995
|
}
|
|
21958
21996
|
// make suer from the same renderer.
|
|
21959
21997
|
if (componentA.instanceId === componentB.instanceId) {
|
|
21960
|
-
return dataA.material._priority - dataB.material._priority
|
|
21998
|
+
return dataA.material._priority - dataB.material._priority;
|
|
21961
21999
|
} else {
|
|
21962
|
-
|
|
22000
|
+
var distanceDiff = componentB._distanceForSort - componentA._distanceForSort;
|
|
22001
|
+
if (distanceDiff === 0) {
|
|
22002
|
+
return componentA.instanceId - componentB.instanceId;
|
|
22003
|
+
} else {
|
|
22004
|
+
return distanceDiff;
|
|
22005
|
+
}
|
|
21963
22006
|
}
|
|
21964
22007
|
};
|
|
21965
22008
|
return RenderQueue;
|
|
21966
22009
|
}();
|
|
21967
22010
|
|
|
22011
|
+
var passNum = 0;
|
|
21968
22012
|
/**
|
|
21969
|
-
*
|
|
21970
|
-
*/ var
|
|
21971
|
-
function
|
|
22013
|
+
* RenderPass.
|
|
22014
|
+
*/ var RenderPass = /*#__PURE__*/ function() {
|
|
22015
|
+
function RenderPass(name, priority, renderTarget, replaceMaterial, mask) {
|
|
22016
|
+
if (name === void 0) name = "RENDER_PASS" + passNum++;
|
|
22017
|
+
if (priority === void 0) priority = 0;
|
|
22018
|
+
if (renderTarget === void 0) renderTarget = null;
|
|
22019
|
+
if (replaceMaterial === void 0) replaceMaterial = null;
|
|
22020
|
+
if (mask === void 0) mask = null;
|
|
22021
|
+
this.name = name;
|
|
22022
|
+
this.enabled = true;
|
|
22023
|
+
this.priority = priority;
|
|
22024
|
+
this.renderTarget = renderTarget;
|
|
22025
|
+
this.replaceMaterial = replaceMaterial;
|
|
22026
|
+
this.mask = mask || Layer.Everything;
|
|
22027
|
+
this.renderOverride = false; // If renderOverride is set to true, you need to implement the render method
|
|
22028
|
+
}
|
|
22029
|
+
var _proto = RenderPass.prototype;
|
|
21972
22030
|
/**
|
|
21973
|
-
*
|
|
21974
|
-
* @param
|
|
21975
|
-
* @param
|
|
21976
|
-
* @param
|
|
21977
|
-
* @param
|
|
21978
|
-
|
|
21979
|
-
* @param mipmap - Need texture mipmap
|
|
21980
|
-
* @returns Texture
|
|
21981
|
-
*/ PipelineUtils.recreateTextureIfNeeded = function recreateTextureIfNeeded(engine, currentTexture, width, height, format, mipmap) {
|
|
21982
|
-
if (currentTexture) {
|
|
21983
|
-
if (currentTexture.width !== width || currentTexture.height !== height || currentTexture.format !== format || currentTexture.mipmapCount > 1 !== mipmap) {
|
|
21984
|
-
currentTexture.destroy();
|
|
21985
|
-
var texture = new Texture2D(engine, width, height, format, mipmap);
|
|
21986
|
-
texture.isGCIgnored = true;
|
|
21987
|
-
return texture;
|
|
21988
|
-
} else {
|
|
21989
|
-
return currentTexture;
|
|
21990
|
-
}
|
|
21991
|
-
} else {
|
|
21992
|
-
var texture1 = new Texture2D(engine, width, height, format, mipmap);
|
|
21993
|
-
texture1.isGCIgnored = true;
|
|
21994
|
-
return texture1;
|
|
21995
|
-
}
|
|
21996
|
-
};
|
|
22031
|
+
* Rendering callback, will be executed if renderOverride is set to true.
|
|
22032
|
+
* @param camera - Camera
|
|
22033
|
+
* @param opaqueQueue - Opaque queue
|
|
22034
|
+
* @param alphaTestQueue - Alpha test queue
|
|
22035
|
+
* @param transparentQueue - Transparent queue
|
|
22036
|
+
*/ _proto.render = function render(camera, opaqueQueue, alphaTestQueue, transparentQueue) {};
|
|
21997
22037
|
/**
|
|
21998
|
-
*
|
|
21999
|
-
* @param
|
|
22000
|
-
* @param
|
|
22001
|
-
* @param
|
|
22002
|
-
* @param
|
|
22003
|
-
|
|
22004
|
-
|
|
22005
|
-
*
|
|
22006
|
-
* @
|
|
22007
|
-
|
|
22008
|
-
|
|
22009
|
-
|
|
22010
|
-
|
|
22011
|
-
|
|
22012
|
-
var depthTexture = depthFormat ? PipelineUtils.recreateTextureIfNeeded(engine, currentDepthTexture, width, height, depthFormat, mipmap) : null;
|
|
22013
|
-
if (currentColorTexture !== colorTexture || currentDepthTexture !== depthTexture) {
|
|
22014
|
-
var _currentRenderTarget2;
|
|
22015
|
-
(_currentRenderTarget2 = currentRenderTarget) == null ? void 0 : _currentRenderTarget2.destroy();
|
|
22016
|
-
currentRenderTarget = new RenderTarget(engine, width, height, colorTexture, depthTexture);
|
|
22017
|
-
currentRenderTarget.isGCIgnored = true;
|
|
22018
|
-
}
|
|
22019
|
-
return currentRenderTarget;
|
|
22020
|
-
};
|
|
22021
|
-
return PipelineUtils;
|
|
22038
|
+
* Post rendering callback.
|
|
22039
|
+
* @param camera - Camera
|
|
22040
|
+
* @param opaqueQueue - Opaque queue
|
|
22041
|
+
* @param alphaTestQueue - Alpha test queue
|
|
22042
|
+
* @param transparentQueue - Transparent queue
|
|
22043
|
+
*/ _proto.preRender = function preRender(camera, opaqueQueue, alphaTestQueue, transparentQueue) {};
|
|
22044
|
+
/**
|
|
22045
|
+
* Post rendering callback.
|
|
22046
|
+
* @param camera - Camera
|
|
22047
|
+
* @param opaqueQueue - Opaque queue
|
|
22048
|
+
* @param alphaTestQueue - Alpha test queue
|
|
22049
|
+
* @param transparentQueue - Transparent queue
|
|
22050
|
+
*/ _proto.postRender = function postRender(camera, opaqueQueue, alphaTestQueue, transparentQueue) {};
|
|
22051
|
+
return RenderPass;
|
|
22022
22052
|
}();
|
|
22023
22053
|
|
|
22024
22054
|
/**
|
|
@@ -22286,6 +22316,26 @@ var /**
|
|
|
22286
22316
|
var offset = cascadeIndex * 16;
|
|
22287
22317
|
Utils._floatMatrixMultiply(sliceMatrix, outShadowMatrices, offset, outShadowMatrices, offset);
|
|
22288
22318
|
};
|
|
22319
|
+
/**
|
|
22320
|
+
* Extract scale and bias from a fade distance to achieve a linear fading of the fade distance.
|
|
22321
|
+
*/ ShadowUtils.getScaleAndBiasForLinearDistanceFade = function getScaleAndBiasForLinearDistanceFade(fadeDistance, border, outInfo) {
|
|
22322
|
+
// (P^2-N^2)/(F^2-N^2)
|
|
22323
|
+
// To avoid division from zero
|
|
22324
|
+
// This values ensure that fade within cascade will be 0 and outside 1
|
|
22325
|
+
if (border < 0.0001) {
|
|
22326
|
+
var multiplier = 1000; // To avoid blending if difference is in fractions
|
|
22327
|
+
outInfo.z = multiplier;
|
|
22328
|
+
outInfo.w = -fadeDistance * multiplier;
|
|
22329
|
+
return;
|
|
22330
|
+
}
|
|
22331
|
+
border = 1 - border;
|
|
22332
|
+
border *= border;
|
|
22333
|
+
// Fade with distance calculation is just a linear fade from 90% of fade distance to fade distance. 90% arbitrarily chosen but should work well enough.
|
|
22334
|
+
var distanceFadeNear = border * fadeDistance;
|
|
22335
|
+
var fadeRange = fadeDistance - distanceFadeNear;
|
|
22336
|
+
outInfo.z = 1.0 / fadeRange;
|
|
22337
|
+
outInfo.w = -distanceFadeNear / fadeRange;
|
|
22338
|
+
};
|
|
22289
22339
|
return ShadowUtils;
|
|
22290
22340
|
}();
|
|
22291
22341
|
(function() {
|
|
@@ -22530,12 +22580,6 @@ var /**
|
|
|
22530
22580
|
ShadowUtils.atlasBorderSize = 4.0;
|
|
22531
22581
|
})();
|
|
22532
22582
|
|
|
22533
|
-
/**
|
|
22534
|
-
* PipelinePass is a base class for all pipeline passes.
|
|
22535
|
-
*/ var PipelinePass = function PipelinePass(engine) {
|
|
22536
|
-
this._engine = engine;
|
|
22537
|
-
};
|
|
22538
|
-
|
|
22539
22583
|
/**
|
|
22540
22584
|
* Cascade shadow caster pass.
|
|
22541
22585
|
*/ var CascadedShadowCasterPass = /*#__PURE__*/ function(PipelinePass1) {
|
|
@@ -22548,11 +22592,10 @@ var /**
|
|
|
22548
22592
|
_this._shadowSliceData = new ShadowSliceData();
|
|
22549
22593
|
_this._lightUp = new Vector3();
|
|
22550
22594
|
_this._lightSide = new Vector3();
|
|
22551
|
-
_this._existShadowMap = false;
|
|
22552
22595
|
_this._splitBoundSpheres = new Float32Array(CascadedShadowCasterPass._maxCascades * 4);
|
|
22553
22596
|
/** The end is project precision problem in shader. */ _this._shadowMatrices = new Float32Array((CascadedShadowCasterPass._maxCascades + 1) * 16);
|
|
22554
|
-
//
|
|
22555
|
-
_this._shadowInfos = new
|
|
22597
|
+
// intensity, null, fadeScale, fadeBias
|
|
22598
|
+
_this._shadowInfos = new Vector4();
|
|
22556
22599
|
_this._viewportOffsets = [
|
|
22557
22600
|
new Vector2(),
|
|
22558
22601
|
new Vector2(),
|
|
@@ -22568,14 +22611,12 @@ var /**
|
|
|
22568
22611
|
/**
|
|
22569
22612
|
* @internal
|
|
22570
22613
|
*/ _proto.onRender = function onRender(context) {
|
|
22614
|
+
var light = this._camera.scene._lightManager._sunlight;
|
|
22571
22615
|
this._updateShadowSettings();
|
|
22572
|
-
this.
|
|
22573
|
-
this.
|
|
22574
|
-
if (this._existShadowMap) {
|
|
22575
|
-
this._updateReceiversShaderData();
|
|
22576
|
-
}
|
|
22616
|
+
this._renderDirectShadowMap(context, light);
|
|
22617
|
+
this._updateReceiversShaderData(light);
|
|
22577
22618
|
};
|
|
22578
|
-
_proto._renderDirectShadowMap = function _renderDirectShadowMap(context) {
|
|
22619
|
+
_proto._renderDirectShadowMap = function _renderDirectShadowMap(context, light) {
|
|
22579
22620
|
var _this = this, engine = _this._engine, camera = _this._camera, viewports = _this._viewportOffsets, shadowSliceData = _this._shadowSliceData, splitBoundSpheres = _this._splitBoundSpheres, shadowMatrices = _this._shadowMatrices;
|
|
22580
22621
|
var _camera__renderPipeline__cullingResults = camera._renderPipeline._cullingResults, opaqueQueue = _camera__renderPipeline__cullingResults.opaqueQueue, alphaTestQueue = _camera__renderPipeline__cullingResults.alphaTestQueue, transparentQueue = _camera__renderPipeline__cullingResults.transparentQueue;
|
|
22581
22622
|
var scene = camera.scene;
|
|
@@ -22589,91 +22630,87 @@ var /**
|
|
|
22589
22630
|
var lightUp = this._lightUp;
|
|
22590
22631
|
var lightSide = this._lightSide;
|
|
22591
22632
|
var lightForward = shadowSliceData.virtualCamera.forward;
|
|
22592
|
-
|
|
22593
|
-
|
|
22594
|
-
|
|
22595
|
-
|
|
22596
|
-
|
|
22597
|
-
|
|
22598
|
-
|
|
22599
|
-
|
|
22600
|
-
|
|
22601
|
-
|
|
22602
|
-
|
|
22603
|
-
|
|
22604
|
-
|
|
22605
|
-
|
|
22606
|
-
|
|
22607
|
-
|
|
22608
|
-
|
|
22609
|
-
|
|
22610
|
-
|
|
22611
|
-
|
|
22612
|
-
|
|
22613
|
-
|
|
22614
|
-
|
|
22615
|
-
rhi.
|
|
22616
|
-
|
|
22617
|
-
|
|
22618
|
-
|
|
22619
|
-
|
|
22620
|
-
|
|
22621
|
-
|
|
22622
|
-
|
|
22623
|
-
|
|
22624
|
-
|
|
22625
|
-
|
|
22626
|
-
|
|
22627
|
-
|
|
22628
|
-
|
|
22629
|
-
|
|
22630
|
-
|
|
22631
|
-
|
|
22632
|
-
|
|
22633
|
-
|
|
22634
|
-
|
|
22635
|
-
|
|
22636
|
-
|
|
22637
|
-
|
|
22638
|
-
|
|
22639
|
-
|
|
22640
|
-
|
|
22641
|
-
|
|
22642
|
-
|
|
22643
|
-
|
|
22644
|
-
|
|
22645
|
-
|
|
22646
|
-
|
|
22647
|
-
|
|
22648
|
-
|
|
22649
|
-
|
|
22650
|
-
|
|
22651
|
-
|
|
22652
|
-
|
|
22653
|
-
|
|
22654
|
-
|
|
22655
|
-
|
|
22656
|
-
|
|
22657
|
-
|
|
22658
|
-
|
|
22659
|
-
|
|
22660
|
-
|
|
22661
|
-
|
|
22662
|
-
|
|
22663
|
-
|
|
22664
|
-
|
|
22665
|
-
|
|
22666
|
-
|
|
22667
|
-
}
|
|
22668
|
-
}
|
|
22669
|
-
this._existShadowMap = true;
|
|
22670
|
-
}
|
|
22671
|
-
};
|
|
22672
|
-
_proto._updateReceiversShaderData = function _updateReceiversShaderData() {
|
|
22673
|
-
var scene = this._camera.scene;
|
|
22633
|
+
// Prepare render target
|
|
22634
|
+
var _this__shadowMapSize = this._shadowMapSize, width = _this__shadowMapSize.z, height = _this__shadowMapSize.w;
|
|
22635
|
+
var format = this._shadowMapFormat;
|
|
22636
|
+
var renderTarget;
|
|
22637
|
+
var shadowTexture;
|
|
22638
|
+
if (this._supportDepthTexture) {
|
|
22639
|
+
renderTarget = PipelineUtils.recreateRenderTargetIfNeeded(engine, this._renderTarget, width, height, null, format, false);
|
|
22640
|
+
shadowTexture = renderTarget.depthTexture;
|
|
22641
|
+
} else {
|
|
22642
|
+
renderTarget = PipelineUtils.recreateRenderTargetIfNeeded(engine, this._renderTarget, width, height, format, null, false);
|
|
22643
|
+
shadowTexture = renderTarget.getColorTexture(0);
|
|
22644
|
+
}
|
|
22645
|
+
shadowTexture.wrapModeU = shadowTexture.wrapModeV = TextureWrapMode.Clamp;
|
|
22646
|
+
if (engine._hardwareRenderer._isWebGL2) {
|
|
22647
|
+
shadowTexture.depthCompareFunction = TextureDepthCompareFunction.Less;
|
|
22648
|
+
}
|
|
22649
|
+
this._renderTarget = renderTarget;
|
|
22650
|
+
this._depthTexture = shadowTexture;
|
|
22651
|
+
// @todo: shouldn't set viewport and scissor in activeRenderTarget
|
|
22652
|
+
rhi.activeRenderTarget(renderTarget, CascadedShadowCasterPass._viewport, 0);
|
|
22653
|
+
if (this._supportDepthTexture) {
|
|
22654
|
+
rhi.clearRenderTarget(engine, CameraClearFlags.Depth, null);
|
|
22655
|
+
} else {
|
|
22656
|
+
rhi.clearRenderTarget(engine, CameraClearFlags.All, CascadedShadowCasterPass._clearColor);
|
|
22657
|
+
}
|
|
22658
|
+
// prepare light and camera direction
|
|
22659
|
+
Matrix.rotationQuaternion(light.entity.transform.worldRotationQuaternion, lightWorld);
|
|
22660
|
+
lightSide.set(lightWorldE[0], lightWorldE[1], lightWorldE[2]);
|
|
22661
|
+
lightUp.set(lightWorldE[4], lightWorldE[5], lightWorldE[6]);
|
|
22662
|
+
lightForward.set(-lightWorldE[8], -lightWorldE[9], -lightWorldE[10]);
|
|
22663
|
+
var cameraForward = CascadedShadowCasterPass._tempVector;
|
|
22664
|
+
cameraForward.copyFrom(camera.entity.transform.worldForward);
|
|
22665
|
+
var shadowTileResolution = this._shadowTileResolution;
|
|
22666
|
+
for(var j = 0; j < shadowCascades; j++){
|
|
22667
|
+
ShadowUtils.getBoundSphereByFrustum(splitDistance[j], splitDistance[j + 1], camera, cameraForward, shadowSliceData);
|
|
22668
|
+
ShadowUtils.getDirectionLightShadowCullPlanes(camera._frustum, splitDistance[j], camera.nearClipPlane, lightForward, shadowSliceData);
|
|
22669
|
+
ShadowUtils.getDirectionalLightMatrices(lightUp, lightSide, lightForward, j, light.shadowNearPlane, shadowTileResolution, shadowSliceData, shadowMatrices);
|
|
22670
|
+
if (shadowCascades > 1) {
|
|
22671
|
+
ShadowUtils.applySliceTransform(shadowTileResolution, width, height, j, this._viewportOffsets[j], shadowMatrices);
|
|
22672
|
+
}
|
|
22673
|
+
this._updateSingleShadowCasterShaderData(light, shadowSliceData, context);
|
|
22674
|
+
// upload pre-cascade infos.
|
|
22675
|
+
var center = boundSphere.center;
|
|
22676
|
+
var radius = boundSphere.radius;
|
|
22677
|
+
var offset = j * 4;
|
|
22678
|
+
splitBoundSpheres[offset] = center.x;
|
|
22679
|
+
splitBoundSpheres[offset + 1] = center.y;
|
|
22680
|
+
splitBoundSpheres[offset + 2] = center.z;
|
|
22681
|
+
splitBoundSpheres[offset + 3] = radius * radius;
|
|
22682
|
+
opaqueQueue.clear();
|
|
22683
|
+
alphaTestQueue.clear();
|
|
22684
|
+
transparentQueue.clear();
|
|
22685
|
+
var renderers = componentsManager._renderers;
|
|
22686
|
+
var elements = renderers._elements;
|
|
22687
|
+
for(var k = renderers.length - 1; k >= 0; --k){
|
|
22688
|
+
ShadowUtils.shadowCullFrustum(context, light, elements[k], shadowSliceData);
|
|
22689
|
+
}
|
|
22690
|
+
if (opaqueQueue.elements.length || alphaTestQueue.elements.length) {
|
|
22691
|
+
opaqueQueue.sort(RenderQueue._compareFromNearToFar);
|
|
22692
|
+
alphaTestQueue.sort(RenderQueue._compareFromNearToFar);
|
|
22693
|
+
var _viewports_j = viewports[j], x = _viewports_j.x, y = _viewports_j.y;
|
|
22694
|
+
rhi.setGlobalDepthBias(1.0, 1.0);
|
|
22695
|
+
rhi.viewport(x, y, shadowTileResolution, shadowTileResolution);
|
|
22696
|
+
// for no cascade is for the edge,for cascade is for the beyond maxCascade pixel can use (0,0,0) trick sample the shadowMap
|
|
22697
|
+
rhi.scissor(x + 1, y + 1, shadowTileResolution - 2, shadowTileResolution - 2);
|
|
22698
|
+
engine._renderCount++;
|
|
22699
|
+
opaqueQueue.render(camera, Layer.Everything, PipelineStage.ShadowCaster);
|
|
22700
|
+
alphaTestQueue.render(camera, Layer.Everything, PipelineStage.ShadowCaster);
|
|
22701
|
+
rhi.setGlobalDepthBias(0, 0);
|
|
22702
|
+
}
|
|
22703
|
+
}
|
|
22704
|
+
};
|
|
22705
|
+
_proto._updateReceiversShaderData = function _updateReceiversShaderData(light) {
|
|
22706
|
+
var camera = this._camera;
|
|
22707
|
+
var scene = camera.scene;
|
|
22674
22708
|
var splitBoundSpheres = this._splitBoundSpheres;
|
|
22675
22709
|
var shadowMatrices = this._shadowMatrices;
|
|
22676
22710
|
var shadowCascades = scene.shadowCascades;
|
|
22711
|
+
var shadowFar = Math.min(scene.shadowDistance, camera.farClipPlane);
|
|
22712
|
+
ShadowUtils.getScaleAndBiasForLinearDistanceFade(Math.pow(shadowFar, 2), scene.shadowFadeBorder, this._shadowInfos);
|
|
22713
|
+
this._shadowInfos.x = light.shadowStrength;
|
|
22677
22714
|
// set zero matrix to project the index out of max cascade
|
|
22678
22715
|
if (shadowCascades > 1) {
|
|
22679
22716
|
for(var i = shadowCascades * 4, n = splitBoundSpheres.length; i < n; i++){
|
|
@@ -22686,7 +22723,7 @@ var /**
|
|
|
22686
22723
|
}
|
|
22687
22724
|
var shaderData = scene.shaderData;
|
|
22688
22725
|
shaderData.setFloatArray(CascadedShadowCasterPass._shadowMatricesProperty, this._shadowMatrices);
|
|
22689
|
-
shaderData.
|
|
22726
|
+
shaderData.setVector4(CascadedShadowCasterPass._shadowInfosProperty, this._shadowInfos);
|
|
22690
22727
|
shaderData.setTexture(CascadedShadowCasterPass._shadowMapsProperty, this._depthTexture);
|
|
22691
22728
|
shaderData.setFloatArray(CascadedShadowCasterPass._shadowSplitSpheresProperty, this._splitBoundSpheres);
|
|
22692
22729
|
shaderData.setVector4(CascadedShadowCasterPass._shadowMapSize, this._shadowMapSize);
|
|
@@ -22722,10 +22759,13 @@ var /**
|
|
|
22722
22759
|
return Math.sqrt(radius * radius / denominator);
|
|
22723
22760
|
};
|
|
22724
22761
|
_proto._updateShadowSettings = function _updateShadowSettings() {
|
|
22725
|
-
var
|
|
22762
|
+
var camera = this._camera;
|
|
22763
|
+
var scene = camera.scene;
|
|
22726
22764
|
var shadowFormat = ShadowUtils.shadowDepthFormat(scene.shadowResolution, this._supportDepthTexture);
|
|
22727
22765
|
var shadowResolution = ShadowUtils.shadowResolution(scene.shadowResolution);
|
|
22728
22766
|
var shadowCascades = scene.shadowCascades;
|
|
22767
|
+
var shadowFar = Math.min(scene.shadowDistance, camera.farClipPlane);
|
|
22768
|
+
this._getCascadesSplitDistance(shadowFar);
|
|
22729
22769
|
if (shadowFormat !== this._shadowMapFormat || shadowResolution !== this._shadowMapResolution || shadowCascades !== this._shadowCascadeMode) {
|
|
22730
22770
|
this._shadowMapFormat = shadowFormat;
|
|
22731
22771
|
this._shadowMapResolution = shadowResolution;
|
|
@@ -23173,14 +23213,14 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23173
23213
|
/** @internal */ _this._cameraIndex = -1;
|
|
23174
23214
|
_this._priority = 0;
|
|
23175
23215
|
_this._shaderData = new ShaderData(ShaderDataGroup.Camera);
|
|
23176
|
-
_this.
|
|
23216
|
+
_this._isCustomViewMatrix = false;
|
|
23217
|
+
_this._isCustomProjectionMatrix = false;
|
|
23177
23218
|
_this._nearClipPlane = 0.1;
|
|
23178
23219
|
_this._farClipPlane = 100;
|
|
23179
23220
|
_this._fieldOfView = 45;
|
|
23180
23221
|
_this._orthographicSize = 10;
|
|
23181
23222
|
_this._isProjectionDirty = true;
|
|
23182
23223
|
_this._isInvProjMatDirty = true;
|
|
23183
|
-
_this._isFrustumProjectDirty = true;
|
|
23184
23224
|
_this._customAspectRatio = undefined;
|
|
23185
23225
|
_this._renderTarget = null;
|
|
23186
23226
|
_this._depthBufferParams = new Vector4();
|
|
@@ -23192,7 +23232,7 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23192
23232
|
_this._transform = transform;
|
|
23193
23233
|
_this._isViewMatrixDirty = transform.registerWorldChangeFlag();
|
|
23194
23234
|
_this._isInvViewProjDirty = transform.registerWorldChangeFlag();
|
|
23195
|
-
_this.
|
|
23235
|
+
_this._frustumChangeFlag = transform.registerWorldChangeFlag();
|
|
23196
23236
|
_this._renderPipeline = new BasicRenderPipeline(_assert_this_initialized(_this));
|
|
23197
23237
|
_this._addResourceReferCount(_this.shaderData, 1);
|
|
23198
23238
|
_this._updatePixelViewport();
|
|
@@ -23204,16 +23244,22 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23204
23244
|
}
|
|
23205
23245
|
var _proto = Camera1.prototype;
|
|
23206
23246
|
/**
|
|
23247
|
+
* Restore the view matrix to the world matrix of the entity.
|
|
23248
|
+
*/ _proto.resetViewMatrix = function resetViewMatrix() {
|
|
23249
|
+
this._isCustomViewMatrix = false;
|
|
23250
|
+
this._viewMatrixChange();
|
|
23251
|
+
};
|
|
23252
|
+
/**
|
|
23207
23253
|
* Restore the automatic calculation of projection matrix through fieldOfView, nearClipPlane and farClipPlane.
|
|
23208
23254
|
*/ _proto.resetProjectionMatrix = function resetProjectionMatrix() {
|
|
23209
|
-
this.
|
|
23210
|
-
this.
|
|
23255
|
+
this._isCustomProjectionMatrix = false;
|
|
23256
|
+
this._projectionMatrixChange();
|
|
23211
23257
|
};
|
|
23212
23258
|
/**
|
|
23213
23259
|
* Restore the automatic calculation of the aspect ratio through the viewport aspect ratio.
|
|
23214
23260
|
*/ _proto.resetAspectRatio = function resetAspectRatio() {
|
|
23215
23261
|
this._customAspectRatio = undefined;
|
|
23216
|
-
this.
|
|
23262
|
+
this._projectionMatrixChange();
|
|
23217
23263
|
};
|
|
23218
23264
|
/**
|
|
23219
23265
|
* Transform a point from world space to viewport space.
|
|
@@ -23343,10 +23389,9 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23343
23389
|
context.replacementShader = this._replacementShader;
|
|
23344
23390
|
context.replacementTag = this._replacementSubShaderTag;
|
|
23345
23391
|
// compute cull frustum.
|
|
23346
|
-
if (this.enableFrustumCulling &&
|
|
23392
|
+
if (this.enableFrustumCulling && this._frustumChangeFlag.flag) {
|
|
23347
23393
|
this._frustum.calculateFromMatrix(virtualCamera.viewProjectionMatrix);
|
|
23348
|
-
this.
|
|
23349
|
-
this._isFrustumProjectDirty = false;
|
|
23394
|
+
this._frustumChangeFlag.flag = false;
|
|
23350
23395
|
}
|
|
23351
23396
|
this._updateShaderData();
|
|
23352
23397
|
// union scene and camera macro.
|
|
@@ -23395,13 +23440,16 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23395
23440
|
//@ts-ignore
|
|
23396
23441
|
this._viewport._onValueChanged = null;
|
|
23397
23442
|
this.engine.canvas._sizeUpdateFlagManager.removeListener(this._onPixelViewportChanged);
|
|
23443
|
+
//@ts-ignore
|
|
23444
|
+
this._viewport._onValueChanged = null;
|
|
23445
|
+
this.engine.canvas._sizeUpdateFlagManager.removeListener(this._onPixelViewportChanged);
|
|
23398
23446
|
this._entity = null;
|
|
23399
23447
|
this._globalShaderMacro = null;
|
|
23400
23448
|
this._frustum = null;
|
|
23401
23449
|
this._renderPipeline = null;
|
|
23402
23450
|
this._virtualCamera = null;
|
|
23403
23451
|
this._shaderData = null;
|
|
23404
|
-
this.
|
|
23452
|
+
this._frustumChangeFlag = null;
|
|
23405
23453
|
this._transform = null;
|
|
23406
23454
|
this._isViewMatrixDirty = null;
|
|
23407
23455
|
this._isInvViewProjDirty = null;
|
|
@@ -23423,11 +23471,16 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23423
23471
|
var viewport = this._viewport;
|
|
23424
23472
|
this._pixelViewport.set(viewport.x * width, viewport.y * height, viewport.z * width, viewport.w * height);
|
|
23425
23473
|
};
|
|
23426
|
-
_proto.
|
|
23427
|
-
this.
|
|
23474
|
+
_proto._viewMatrixChange = function _viewMatrixChange() {
|
|
23475
|
+
this._isViewMatrixDirty.flag = true;
|
|
23476
|
+
this._isInvViewProjDirty.flag = true;
|
|
23477
|
+
this._frustumChangeFlag.flag = true;
|
|
23478
|
+
};
|
|
23479
|
+
_proto._projectionMatrixChange = function _projectionMatrixChange() {
|
|
23428
23480
|
this._isProjectionDirty = true;
|
|
23429
23481
|
this._isInvProjMatDirty = true;
|
|
23430
23482
|
this._isInvViewProjDirty.flag = true;
|
|
23483
|
+
this._frustumChangeFlag.flag = true;
|
|
23431
23484
|
};
|
|
23432
23485
|
_proto._innerViewportToWorldPoint = function _innerViewportToWorldPoint(x, y, z, invViewProjMat, out) {
|
|
23433
23486
|
// Depth is a normalized value, 0 is nearPlane, 1 is farClipPlane.
|
|
@@ -23470,7 +23523,7 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23470
23523
|
_proto._onPixelViewportChanged = function _onPixelViewportChanged() {
|
|
23471
23524
|
this._updatePixelViewport();
|
|
23472
23525
|
var _this__customAspectRatio;
|
|
23473
|
-
(_this__customAspectRatio = this._customAspectRatio) != null ? _this__customAspectRatio : this.
|
|
23526
|
+
(_this__customAspectRatio = this._customAspectRatio) != null ? _this__customAspectRatio : this._projectionMatrixChange();
|
|
23474
23527
|
};
|
|
23475
23528
|
_create_class(Camera1, [
|
|
23476
23529
|
{
|
|
@@ -23490,7 +23543,7 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23490
23543
|
},
|
|
23491
23544
|
set: function set(value) {
|
|
23492
23545
|
this._nearClipPlane = value;
|
|
23493
|
-
this.
|
|
23546
|
+
this._projectionMatrixChange();
|
|
23494
23547
|
}
|
|
23495
23548
|
},
|
|
23496
23549
|
{
|
|
@@ -23502,7 +23555,7 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23502
23555
|
},
|
|
23503
23556
|
set: function set(value) {
|
|
23504
23557
|
this._farClipPlane = value;
|
|
23505
|
-
this.
|
|
23558
|
+
this._projectionMatrixChange();
|
|
23506
23559
|
}
|
|
23507
23560
|
},
|
|
23508
23561
|
{
|
|
@@ -23514,7 +23567,7 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23514
23567
|
},
|
|
23515
23568
|
set: function set(value) {
|
|
23516
23569
|
this._fieldOfView = value;
|
|
23517
|
-
this.
|
|
23570
|
+
this._projectionMatrixChange();
|
|
23518
23571
|
}
|
|
23519
23572
|
},
|
|
23520
23573
|
{
|
|
@@ -23529,7 +23582,7 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23529
23582
|
},
|
|
23530
23583
|
set: function set(value) {
|
|
23531
23584
|
this._customAspectRatio = value;
|
|
23532
|
-
this.
|
|
23585
|
+
this._projectionMatrixChange();
|
|
23533
23586
|
}
|
|
23534
23587
|
},
|
|
23535
23588
|
{
|
|
@@ -23581,7 +23634,12 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23581
23634
|
},
|
|
23582
23635
|
set: function set(value) {
|
|
23583
23636
|
this._virtualCamera.isOrthographic = value;
|
|
23584
|
-
this.
|
|
23637
|
+
this._projectionMatrixChange();
|
|
23638
|
+
if (value) {
|
|
23639
|
+
this.shaderData.enableMacro("CAMERA_ORTHOGRAPHIC");
|
|
23640
|
+
} else {
|
|
23641
|
+
this.shaderData.disableMacro("CAMERA_ORTHOGRAPHIC");
|
|
23642
|
+
}
|
|
23585
23643
|
}
|
|
23586
23644
|
},
|
|
23587
23645
|
{
|
|
@@ -23593,7 +23651,7 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23593
23651
|
},
|
|
23594
23652
|
set: function set(value) {
|
|
23595
23653
|
this._orthographicSize = value;
|
|
23596
|
-
this.
|
|
23654
|
+
this._projectionMatrixChange();
|
|
23597
23655
|
}
|
|
23598
23656
|
},
|
|
23599
23657
|
{
|
|
@@ -23602,22 +23660,31 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23602
23660
|
* View matrix.
|
|
23603
23661
|
*/ function get() {
|
|
23604
23662
|
var viewMatrix = this._virtualCamera.viewMatrix;
|
|
23605
|
-
if (this._isViewMatrixDirty.flag) {
|
|
23606
|
-
|
|
23607
|
-
|
|
23608
|
-
|
|
23609
|
-
|
|
23610
|
-
|
|
23611
|
-
|
|
23663
|
+
if (!this._isViewMatrixDirty.flag || this._isCustomViewMatrix) {
|
|
23664
|
+
return viewMatrix;
|
|
23665
|
+
}
|
|
23666
|
+
this._isViewMatrixDirty.flag = false;
|
|
23667
|
+
// Ignore scale
|
|
23668
|
+
var transform = this._transform;
|
|
23669
|
+
Matrix.rotationTranslation(transform.worldRotationQuaternion, transform.worldPosition, viewMatrix);
|
|
23670
|
+
viewMatrix.invert();
|
|
23612
23671
|
return viewMatrix;
|
|
23672
|
+
},
|
|
23673
|
+
set: function set(value) {
|
|
23674
|
+
this._virtualCamera.viewMatrix.copyFrom(value);
|
|
23675
|
+
this._isCustomViewMatrix = true;
|
|
23676
|
+
this._viewMatrixChange();
|
|
23613
23677
|
}
|
|
23614
23678
|
},
|
|
23615
23679
|
{
|
|
23616
23680
|
key: "projectionMatrix",
|
|
23617
|
-
get:
|
|
23681
|
+
get: /**
|
|
23682
|
+
* The projection matrix is calculated by the relevant parameters of the camera by default.
|
|
23683
|
+
* If it is manually set, the manual value will be maintained. Call resetProjectionMatrix() to restore it.
|
|
23684
|
+
*/ function get() {
|
|
23618
23685
|
var virtualCamera = this._virtualCamera;
|
|
23619
23686
|
var projectionMatrix = virtualCamera.projectionMatrix;
|
|
23620
|
-
if (!this._isProjectionDirty || this.
|
|
23687
|
+
if (!this._isProjectionDirty || this._isCustomProjectionMatrix) {
|
|
23621
23688
|
return projectionMatrix;
|
|
23622
23689
|
}
|
|
23623
23690
|
this._isProjectionDirty = false;
|
|
@@ -23631,13 +23698,10 @@ var Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23631
23698
|
}
|
|
23632
23699
|
return projectionMatrix;
|
|
23633
23700
|
},
|
|
23634
|
-
set:
|
|
23635
|
-
* The projection matrix is calculated by the relevant parameters of the camera by default.
|
|
23636
|
-
* If it is manually set, the manual value will be maintained. Call resetProjectionMatrix() to restore it.
|
|
23637
|
-
*/ function set(value) {
|
|
23701
|
+
set: function set(value) {
|
|
23638
23702
|
this._virtualCamera.projectionMatrix.copyFrom(value);
|
|
23639
|
-
this.
|
|
23640
|
-
this.
|
|
23703
|
+
this._isCustomProjectionMatrix = true;
|
|
23704
|
+
this._projectionMatrixChange();
|
|
23641
23705
|
}
|
|
23642
23706
|
},
|
|
23643
23707
|
{
|
|
@@ -23698,7 +23762,7 @@ __decorate([
|
|
|
23698
23762
|
], Camera.prototype, "_cameraIndex", void 0);
|
|
23699
23763
|
__decorate([
|
|
23700
23764
|
ignoreClone
|
|
23701
|
-
], Camera.prototype, "
|
|
23765
|
+
], Camera.prototype, "_frustumChangeFlag", void 0);
|
|
23702
23766
|
__decorate([
|
|
23703
23767
|
ignoreClone
|
|
23704
23768
|
], Camera.prototype, "_transform", void 0);
|
|
@@ -23885,6 +23949,7 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
23885
23949
|
* @param obj - class object
|
|
23886
23950
|
*/ Loader.registerClass = function registerClass(className, classDefine) {
|
|
23887
23951
|
this._engineObjects[className] = classDefine;
|
|
23952
|
+
this._classNameMap.set(classDefine, className);
|
|
23888
23953
|
};
|
|
23889
23954
|
/**
|
|
23890
23955
|
* Get the class object by class name.
|
|
@@ -23893,11 +23958,21 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
23893
23958
|
*/ Loader.getClass = function getClass(className) {
|
|
23894
23959
|
return this._engineObjects[className];
|
|
23895
23960
|
};
|
|
23961
|
+
/**
|
|
23962
|
+
* Get the class name by class object.
|
|
23963
|
+
* @param obj - class object
|
|
23964
|
+
* @returns class name
|
|
23965
|
+
*/ Loader.getClassName = function getClassName(obj) {
|
|
23966
|
+
return this._classNameMap.get(obj);
|
|
23967
|
+
};
|
|
23896
23968
|
return Loader;
|
|
23897
23969
|
}();
|
|
23898
23970
|
(function() {
|
|
23899
23971
|
Loader._engineObjects = {};
|
|
23900
23972
|
})();
|
|
23973
|
+
(function() {
|
|
23974
|
+
Loader._classNameMap = new Map();
|
|
23975
|
+
})();
|
|
23901
23976
|
|
|
23902
23977
|
/**
|
|
23903
23978
|
* Alpha blend mode.
|
|
@@ -27667,7 +27742,7 @@ __decorate([
|
|
|
27667
27742
|
this._clip = clip;
|
|
27668
27743
|
this._clipEndTime = Math.min(this._clipEndTime, 1);
|
|
27669
27744
|
this._onClipChanged();
|
|
27670
|
-
clip._updateFlagManager.addListener(this._onClipChanged);
|
|
27745
|
+
clip && clip._updateFlagManager.addListener(this._onClipChanged);
|
|
27671
27746
|
}
|
|
27672
27747
|
},
|
|
27673
27748
|
{
|
|
@@ -28374,6 +28449,7 @@ __decorate([
|
|
|
28374
28449
|
ParticleRandomSubSeeds[ParticleRandomSubSeeds["RotationOverLifetime"] = 0x40eb95e4] = "RotationOverLifetime";
|
|
28375
28450
|
ParticleRandomSubSeeds[ParticleRandomSubSeeds["TextureSheetAnimation"] = 0xbc524e5] = "TextureSheetAnimation";
|
|
28376
28451
|
ParticleRandomSubSeeds[ParticleRandomSubSeeds["Shape"] = 0xaf502044] = "Shape";
|
|
28452
|
+
ParticleRandomSubSeeds[ParticleRandomSubSeeds["GravityModifier"] = 0xa47b8c4d] = "GravityModifier";
|
|
28377
28453
|
})(ParticleRandomSubSeeds || (ParticleRandomSubSeeds = {}));
|
|
28378
28454
|
|
|
28379
28455
|
/**
|
|
@@ -29087,6 +29163,7 @@ var MainModule = /*#__PURE__*/ function() {
|
|
|
29087
29163
|
/** @internal */ this._startColorRand = new Rand(0, ParticleRandomSubSeeds.StartColor);
|
|
29088
29164
|
/** @internal */ this._startSizeRand = new Rand(0, ParticleRandomSubSeeds.StartSize);
|
|
29089
29165
|
/** @internal */ this._startRotationRand = new Rand(0, ParticleRandomSubSeeds.StartRotation);
|
|
29166
|
+
this._gravityModifierRand = new Rand(0, ParticleRandomSubSeeds.GravityModifier);
|
|
29090
29167
|
this._gravity = new Vector3();
|
|
29091
29168
|
this._generator = generator;
|
|
29092
29169
|
}
|
|
@@ -29147,7 +29224,7 @@ var MainModule = /*#__PURE__*/ function() {
|
|
|
29147
29224
|
break;
|
|
29148
29225
|
}
|
|
29149
29226
|
var particleGravity = this._gravity;
|
|
29150
|
-
var gravityModifierValue = this.gravityModifier.evaluate(undefined,
|
|
29227
|
+
var gravityModifierValue = this.gravityModifier.evaluate(undefined, this._gravityModifierRand.random());
|
|
29151
29228
|
Vector3.scale(renderer.scene.physics.gravity, gravityModifierValue, particleGravity);
|
|
29152
29229
|
shaderData.setVector3(MainModule._gravity, particleGravity);
|
|
29153
29230
|
shaderData.setInt(MainModule._simulationSpace, this.simulationSpace);
|
|
@@ -29266,6 +29343,9 @@ __decorate([
|
|
|
29266
29343
|
__decorate([
|
|
29267
29344
|
ignoreClone
|
|
29268
29345
|
], MainModule.prototype, "_startRotationRand", void 0);
|
|
29346
|
+
__decorate([
|
|
29347
|
+
ignoreClone
|
|
29348
|
+
], MainModule.prototype, "_gravityModifierRand", void 0);
|
|
29269
29349
|
__decorate([
|
|
29270
29350
|
ignoreClone
|
|
29271
29351
|
], MainModule.prototype, "_generator", void 0);
|
|
@@ -29936,7 +30016,8 @@ __decorate([
|
|
|
29936
30016
|
var transform = this._renderer.entity.transform;
|
|
29937
30017
|
var shape = this.emission.shape;
|
|
29938
30018
|
for(var i = 0; i < count; i++){
|
|
29939
|
-
|
|
30019
|
+
var _shape;
|
|
30020
|
+
if ((_shape = shape) == null ? void 0 : _shape.enabled) {
|
|
29940
30021
|
shape._generatePositionAndDirection(this.emission._shapeRand, time, position, direction);
|
|
29941
30022
|
var positionScale = this.main._getPositionScale();
|
|
29942
30023
|
position.multiply(positionScale);
|
|
@@ -30516,7 +30597,7 @@ __decorate([
|
|
|
30516
30597
|
* Base class for all particle shapes.
|
|
30517
30598
|
*/ var BaseShape = /*#__PURE__*/ function() {
|
|
30518
30599
|
function BaseShape() {
|
|
30519
|
-
/** Specifies whether the ShapeModule is enabled or disabled. */ this.
|
|
30600
|
+
/** Specifies whether the ShapeModule is enabled or disabled. */ this.enabled = true;
|
|
30520
30601
|
/** Randomizes the starting direction of particles. */ this.randomDirectionAmount = 0;
|
|
30521
30602
|
}
|
|
30522
30603
|
var _proto = BaseShape.prototype;
|
|
@@ -30595,9 +30676,9 @@ __decorate([
|
|
|
30595
30676
|
_inherits(BoxShape, BaseShape1);
|
|
30596
30677
|
function BoxShape() {
|
|
30597
30678
|
var _this;
|
|
30598
|
-
_this = BaseShape1.
|
|
30599
|
-
/** The size of the box. */ _this.size = new Vector3(1, 1, 1);
|
|
30679
|
+
_this = BaseShape1.apply(this, arguments) || this;
|
|
30600
30680
|
_this.shapeType = ParticleShapeType.Box;
|
|
30681
|
+
/** The size of the box. */ _this.size = new Vector3(1, 1, 1);
|
|
30601
30682
|
return _this;
|
|
30602
30683
|
}
|
|
30603
30684
|
var _proto = BoxShape.prototype;
|
|
@@ -30634,12 +30715,12 @@ __decorate([
|
|
|
30634
30715
|
_inherits(CircleShape, BaseShape1);
|
|
30635
30716
|
function CircleShape() {
|
|
30636
30717
|
var _this;
|
|
30637
|
-
_this = BaseShape1.
|
|
30718
|
+
_this = BaseShape1.apply(this, arguments) || this;
|
|
30719
|
+
_this.shapeType = ParticleShapeType.Circle;
|
|
30638
30720
|
/** Radius of the shape to emit particles from. */ _this.radius = 1.0;
|
|
30639
30721
|
/** Angle of the circle arc to emit particles from. */ _this.arc = 360.0;
|
|
30640
30722
|
/** The mode to generate particles around the arc. */ _this.arcMode = ParticleShapeArcMode.Random;
|
|
30641
30723
|
/** The speed of complete 360 degree rotation. */ _this.arcSpeed = 1.0;
|
|
30642
|
-
_this.shapeType = ParticleShapeType.Circle;
|
|
30643
30724
|
return _this;
|
|
30644
30725
|
}
|
|
30645
30726
|
var _proto = CircleShape.prototype;
|
|
@@ -30675,12 +30756,12 @@ __decorate([
|
|
|
30675
30756
|
_inherits(ConeShape, BaseShape1);
|
|
30676
30757
|
function ConeShape() {
|
|
30677
30758
|
var _this;
|
|
30678
|
-
_this = BaseShape1.
|
|
30759
|
+
_this = BaseShape1.apply(this, arguments) || this;
|
|
30760
|
+
_this.shapeType = ParticleShapeType.Cone;
|
|
30679
30761
|
/** Angle of the cone to emit particles from. */ _this.angle = 25.0;
|
|
30680
30762
|
/** Radius of the shape to emit particles from. */ _this.radius = 1.0;
|
|
30681
30763
|
/** Length of the cone to emit particles from. */ _this.length = 5.0;
|
|
30682
30764
|
/** Cone emitter type. */ _this.emitType = /** Emit particles from the base of the cone. */ 0;
|
|
30683
|
-
_this.shapeType = ParticleShapeType.Cone;
|
|
30684
30765
|
return _this;
|
|
30685
30766
|
}
|
|
30686
30767
|
var _proto = ConeShape.prototype;
|
|
@@ -30740,9 +30821,9 @@ var ConeEmitType;
|
|
|
30740
30821
|
_inherits(HemisphereShape, BaseShape1);
|
|
30741
30822
|
function HemisphereShape() {
|
|
30742
30823
|
var _this;
|
|
30743
|
-
_this = BaseShape1.
|
|
30744
|
-
/** Radius of the shape to emit particles from. */ _this.radius = 1.0;
|
|
30824
|
+
_this = BaseShape1.apply(this, arguments) || this;
|
|
30745
30825
|
_this.shapeType = ParticleShapeType.Hemisphere;
|
|
30826
|
+
/** Radius of the shape to emit particles from. */ _this.radius = 1.0;
|
|
30746
30827
|
return _this;
|
|
30747
30828
|
}
|
|
30748
30829
|
var _proto = HemisphereShape.prototype;
|
|
@@ -30765,9 +30846,9 @@ var ConeEmitType;
|
|
|
30765
30846
|
_inherits(SphereShape, BaseShape1);
|
|
30766
30847
|
function SphereShape() {
|
|
30767
30848
|
var _this;
|
|
30768
|
-
_this = BaseShape1.
|
|
30769
|
-
/** Radius of the shape to emit particles from. */ _this.radius = 1.0;
|
|
30849
|
+
_this = BaseShape1.apply(this, arguments) || this;
|
|
30770
30850
|
_this.shapeType = ParticleShapeType.Sphere;
|
|
30851
|
+
/** Radius of the shape to emit particles from. */ _this.radius = 1.0;
|
|
30771
30852
|
return _this;
|
|
30772
30853
|
}
|
|
30773
30854
|
var _proto = SphereShape.prototype;
|
|
@@ -31140,5 +31221,5 @@ var cacheDir = new Vector3();
|
|
|
31140
31221
|
return CubeProbe;
|
|
31141
31222
|
}(Probe);
|
|
31142
31223
|
|
|
31143
|
-
export { AmbientLight, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationRectCurve, AnimationRefCurve, AnimationStringCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorLayerMask, AnimatorState, AnimatorStateMachine, AnimatorStateTransition, AssetPromise, AssetType, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, Basic2DBatcher, BasicRenderPipeline, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlendState, BlinnPhongMaterial, BoolUpdateFlag, BoxColliderShape, BoxShape, Buffer, BufferBindFlag, BufferMesh, BufferUsage, BufferUtil, Burst, Camera, CameraClearFlags, CameraType, Canvas, CapsuleColliderShape, CharacterController, CircleShape, CloneManager, Collider, ColliderShape, ColliderShapeUpAxis, CollisionDetectionMode, ColorOverLifetimeModule, ColorSpace, ColorWriteMask, CompareFunction, Component, ConeEmitType, ConeShape, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, CurveKey, DataType, DependentMode, DepthState, DepthTextureMode, DiffuseMode, DirectLight, DynamicCollider, DynamicColliderConstraints, EmissionModule, Engine, EngineObject, Entity, EventDispatcher, FixedJoint, FogMode, Font, FontStyle, GLCapabilityType, GradientAlphaKey, GradientColorKey, HemisphereShape, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolationType, Joint, JointLimits, JointMotor, Keyframe, Keys, Layer, Light, Loader, Logger, MainModule, Material, Mesh, MeshRenderer, MeshTopology, ModelMesh, OverflowMode, PBRBaseMaterial, PBRMaterial, PBRSpecularMaterial, ParticleCompositeCurve, ParticleCompositeGradient, ParticleCurve, ParticleCurveMode, ParticleGenerator, ParticleGradient, ParticleGradientMode, ParticleMaterial, ParticleRenderMode, ParticleRenderer, ParticleScaleMode, ParticleShapeArcMode, ParticleSimulationSpace, ParticleStopMode, PhysicsMaterial, PhysicsMaterialCombineMode, PhysicsScene, PipelineStage, PlaneColliderShape, Platform, PointLight, Pointer, PointerButton, PointerPhase, Primitive, PrimitiveMesh, Probe, RasterState, ReferResource, RenderBufferDepthFormat, RenderFace, RenderPass, RenderQueue, RenderQueueType, RenderState, RenderStateElementKey as RenderStateDataKey, RenderTarget, RenderTargetBlendState, Renderer, ResourceManager, RotationOverLifetimeModule, Scene, SceneManager, Script, SetDataOptions, Shader, ShaderData, ShaderFactory, ShaderMacro, ShaderMacroCollection, ShaderPass, ShaderProperty, ShaderPropertyType, ShaderTagKey, ShadowCascadesMode, ShadowResolution, ShadowType, SizeOverLifetimeModule, Skin, SkinnedMeshRenderer, Sky, SkyBoxMaterial, SkyProceduralMaterial, SphereColliderShape, SphereShape, SpotLight, SpringJoint, Sprite, SpriteAtlas, SpriteDrawMode, SpriteMask, SpriteMaskInteraction, SpriteMaskLayer, SpriteRenderer, SpriteTileMode, StateMachineScript, StaticCollider, StencilOperation, StencilState, SubMesh, SubShader, SunMode, SystemInfo, TextHorizontalAlignment, TextRenderer, TextUtils, TextVerticalAlignment, Texture, Texture2D, Texture2DArray, TextureCoordinate, TextureCube, TextureCubeFace, TextureDepthCompareFunction, TextureFilterMode, TextureFormat, TextureSheetAnimationModule, TextureUsage, TextureWrapMode, Time, TrailMaterial, TrailRenderer, Transform, UnlitMaterial, Utils, VelocityOverLifetimeModule, VertexAttribute, VertexBufferBinding, VertexElement, VertexElementFormat, WrapMode, XRManager, assignmentClone, deepClone, dependentComponents, ignoreClone, request, resourceLoader, shallowClone };
|
|
31224
|
+
export { AmbientLight, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationRectCurve, AnimationRefCurve, AnimationStringCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorLayerMask, AnimatorState, AnimatorStateMachine, AnimatorStateTransition, AssetPromise, AssetType, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, Basic2DBatcher, BasicRenderPipeline, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlendState, BlinnPhongMaterial, BoolUpdateFlag, BoxColliderShape, BoxShape, Buffer, BufferBindFlag, BufferMesh, BufferUsage, BufferUtil, Burst, Camera, CameraClearFlags, CameraType, Canvas, CapsuleColliderShape, CharacterController, CircleShape, CloneManager, Collider, ColliderShape, ColliderShapeUpAxis, CollisionDetectionMode, ColorOverLifetimeModule, ColorSpace, ColorWriteMask, CompareFunction, Component, ConeEmitType, ConeShape, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, CurveKey, DataType, DependentMode, DepthState, DepthTextureMode, DiffuseMode, DirectLight, DynamicCollider, DynamicColliderConstraints, EmissionModule, Engine, EngineObject, Entity, EventDispatcher, FixedJoint, FogMode, Font, FontStyle, GLCapabilityType, GradientAlphaKey, GradientColorKey, HemisphereShape, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolationType, Joint, JointLimits, JointMotor, Keyframe, Keys, Layer, Light, Loader, Logger, MainModule, Material, Mesh, MeshRenderer, MeshTopology, ModelMesh, OverflowMode, PBRBaseMaterial, PBRMaterial, PBRSpecularMaterial, ParticleCompositeCurve, ParticleCompositeGradient, ParticleCurve, ParticleCurveMode, ParticleGenerator, ParticleGradient, ParticleGradientMode, ParticleMaterial, ParticleRenderMode, ParticleRenderer, ParticleScaleMode, ParticleShapeArcMode, ParticleShapeType, ParticleSimulationSpace, ParticleStopMode, PhysicsMaterial, PhysicsMaterialCombineMode, PhysicsScene, PipelineStage, PlaneColliderShape, Platform, PointLight, Pointer, PointerButton, PointerPhase, Primitive, PrimitiveMesh, Probe, RasterState, ReferResource, RenderBufferDepthFormat, RenderFace, RenderPass, RenderQueue, RenderQueueType, RenderState, RenderStateElementKey as RenderStateDataKey, RenderTarget, RenderTargetBlendState, Renderer, ResourceManager, RotationOverLifetimeModule, Scene, SceneManager, Script, SetDataOptions, Shader, ShaderData, ShaderFactory, ShaderMacro, ShaderMacroCollection, ShaderPass, ShaderProperty, ShaderPropertyType, ShaderTagKey, ShadowCascadesMode, ShadowResolution, ShadowType, SizeOverLifetimeModule, Skin, SkinnedMeshRenderer, Sky, SkyBoxMaterial, SkyProceduralMaterial, SphereColliderShape, SphereShape, SpotLight, SpringJoint, Sprite, SpriteAtlas, SpriteDrawMode, SpriteMask, SpriteMaskInteraction, SpriteMaskLayer, SpriteRenderer, SpriteTileMode, StateMachineScript, StaticCollider, StencilOperation, StencilState, SubMesh, SubShader, SunMode, SystemInfo, TextHorizontalAlignment, TextRenderer, TextUtils, TextVerticalAlignment, Texture, Texture2D, Texture2DArray, TextureCoordinate, TextureCube, TextureCubeFace, TextureDepthCompareFunction, TextureFilterMode, TextureFormat, TextureSheetAnimationModule, TextureUsage, TextureWrapMode, Time, TrailMaterial, TrailRenderer, Transform, UnlitMaterial, Utils, VelocityOverLifetimeModule, VertexAttribute, VertexBufferBinding, VertexElement, VertexElementFormat, WrapMode, XRManager, assignmentClone, deepClone, dependentComponents, ignoreClone, request, resourceLoader, shallowClone };
|
|
31144
31225
|
//# sourceMappingURL=module.js.map
|