@galacean/engine-core 1.2.0-alpha.1 → 1.2.0-alpha.10
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/main.js
CHANGED
|
@@ -599,7 +599,14 @@ var Utils = /*#__PURE__*/ function() {
|
|
|
599
599
|
* @param url - The url to be judged.
|
|
600
600
|
* @returns Whether the url is absolute url.
|
|
601
601
|
*/ Utils.isAbsoluteUrl = function isAbsoluteUrl(url) {
|
|
602
|
-
return /^(
|
|
602
|
+
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
|
603
|
+
};
|
|
604
|
+
/**
|
|
605
|
+
* Judge whether the url is base64 url.
|
|
606
|
+
* @param url - The url to be judged.
|
|
607
|
+
* @returns Whether the url is base64 url.
|
|
608
|
+
*/ Utils.isBase64Url = function isBase64Url(url) {
|
|
609
|
+
return /^data:.*,.*$/i.test(url);
|
|
603
610
|
};
|
|
604
611
|
/**
|
|
605
612
|
* Get the values of an object.
|
|
@@ -617,7 +624,10 @@ var Utils = /*#__PURE__*/ function() {
|
|
|
617
624
|
if (Utils.isAbsoluteUrl(relativeUrl)) {
|
|
618
625
|
return relativeUrl;
|
|
619
626
|
}
|
|
620
|
-
|
|
627
|
+
if (Utils.isBase64Url(relativeUrl)) {
|
|
628
|
+
return relativeUrl;
|
|
629
|
+
}
|
|
630
|
+
return relativeUrl ? baseUrl.replace(/\/+$/, "") + "/" + relativeUrl.replace(/^\/+/, "") : baseUrl;
|
|
621
631
|
};
|
|
622
632
|
/**
|
|
623
633
|
* @internal
|
|
@@ -3173,7 +3183,7 @@ function _extends() {
|
|
|
3173
3183
|
return _extends.apply(this, arguments);
|
|
3174
3184
|
}
|
|
3175
3185
|
|
|
3176
|
-
var camera_declare = "#define GLSLIFY 1\nuniform vec3 camera_Position;"; // eslint-disable-line
|
|
3186
|
+
var camera_declare = "#define GLSLIFY 1\nuniform vec3 camera_Position;uniform vec3 camera_Forward;"; // eslint-disable-line
|
|
3177
3187
|
|
|
3178
3188
|
var common = "#define GLSLIFY 1\n#define PI 3.14159265359\n#define RECIPROCAL_PI 0.31830988618\n#define EPSILON 1e-6\n#define LOG2 1.442695\n#define saturate( a ) clamp( a, 0.0, 1.0 )\nfloat pow2(float x){return x*x;}vec4 RGBMToLinear(vec4 value,float maxRange){return vec4(value.rgb*value.a*maxRange,1.0);}vec4 gammaToLinear(vec4 srgbIn){return vec4(pow(srgbIn.rgb,vec3(2.2)),srgbIn.a);}vec4 linearToGamma(vec4 linearIn){return vec4(pow(linearIn.rgb,vec3(1.0/2.2)),linearIn.a);}uniform vec4 camera_DepthBufferParams;float remapDepthBufferLinear01(float z){return 1.0/(camera_DepthBufferParams.x*z+camera_DepthBufferParams.y);}\n#ifdef GRAPHICS_API_WEBGL2\n#define INVERSE_MAT(mat) inverse(mat)\n#else\nmat2 inverseMat(mat2 m){return mat2(m[1][1],-m[0][1],-m[1][0],m[0][0])/(m[0][0]*m[1][1]-m[0][1]*m[1][0]);}mat3 inverseMat(mat3 m){float a00=m[0][0],a01=m[0][1],a02=m[0][2];float a10=m[1][0],a11=m[1][1],a12=m[1][2];float a20=m[2][0],a21=m[2][1],a22=m[2][2];float b01=a22*a11-a12*a21;float b11=-a22*a10+a12*a20;float b21=a21*a10-a11*a20;float det=a00*b01+a01*b11+a02*b21;return mat3(b01,(-a22*a01+a02*a21),(a12*a01-a02*a11),b11,(a22*a00-a02*a20),(-a12*a00+a02*a10),b21,(-a21*a00+a01*a20),(a11*a00-a01*a10))/det;}mat4 inverseMat(mat4 m){float a00=m[0][0],a01=m[0][1],a02=m[0][2],a03=m[0][3],a10=m[1][0],a11=m[1][1],a12=m[1][2],a13=m[1][3],a20=m[2][0],a21=m[2][1],a22=m[2][2],a23=m[2][3],a30=m[3][0],a31=m[3][1],a32=m[3][2],a33=m[3][3],b00=a00*a11-a01*a10,b01=a00*a12-a02*a10,b02=a00*a13-a03*a10,b03=a01*a12-a02*a11,b04=a01*a13-a03*a11,b05=a02*a13-a03*a12,b06=a20*a31-a21*a30,b07=a20*a32-a22*a30,b08=a20*a33-a23*a30,b09=a21*a32-a22*a31,b10=a21*a33-a23*a31,b11=a22*a33-a23*a32,det=b00*b11-b01*b10+b02*b09+b03*b08-b04*b07+b05*b06;return mat4(a11*b11-a12*b10+a13*b09,a02*b10-a01*b11-a03*b09,a31*b05-a32*b04+a33*b03,a22*b04-a21*b05-a23*b03,a12*b08-a10*b11-a13*b07,a00*b11-a02*b08+a03*b07,a32*b02-a30*b05-a33*b01,a20*b05-a22*b02+a23*b01,a10*b10-a11*b08+a13*b06,a01*b08-a00*b10-a03*b06,a30*b04-a31*b02+a33*b00,a21*b02-a20*b04-a23*b00,a11*b07-a10*b09-a12*b06,a00*b09-a01*b07+a02*b06,a31*b01-a30*b03-a32*b00,a20*b03-a21*b01+a22*b00)/det;}\n#define INVERSE_MAT(mat) inverseMat(mat)\n#endif\n"; // eslint-disable-line
|
|
3179
3189
|
|
|
@@ -3223,7 +3233,7 @@ var mobile_material_frag = "#define GLSLIFY 1\nuniform vec4 material_EmissiveCol
|
|
|
3223
3233
|
|
|
3224
3234
|
var begin_mobile_frag = "#define GLSLIFY 1\nvec4 ambient=vec4(0.0);vec4 emission=material_EmissiveColor;vec4 diffuse=material_BaseColor;vec4 specular=material_SpecularColor;\n#ifdef MATERIAL_HAS_EMISSIVETEXTURE\nvec4 emissiveTextureColor=texture2D(material_EmissiveTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nemissiveTextureColor=gammaToLinear(emissiveTextureColor);\n#endif\nemission*=emissiveTextureColor;\n#endif\n#ifdef MATERIAL_HAS_BASETEXTURE\nvec4 diffuseTextureColor=texture2D(material_BaseTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ndiffuseTextureColor=gammaToLinear(diffuseTextureColor);\n#endif\ndiffuse*=diffuseTextureColor;\n#endif\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\ndiffuse*=v_color;\n#endif\n#ifdef MATERIAL_HAS_SPECULAR_TEXTURE\nvec4 specularTextureColor=texture2D(material_SpecularTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nspecularTextureColor=gammaToLinear(specularTextureColor);\n#endif\nspecular*=specularTextureColor;\n#endif\nambient=vec4(scene_EnvMapLight.diffuse*scene_EnvMapLight.diffuseIntensity,1.0)*diffuse;"; // eslint-disable-line
|
|
3225
3235
|
|
|
3226
|
-
var begin_viewdir_frag = "#define GLSLIFY 1\n#ifdef MATERIAL_NEED_WORLD_POS\nvec3 V=normalize(camera_Position-v_pos);\n#endif\n"; // eslint-disable-line
|
|
3236
|
+
var begin_viewdir_frag = "#define GLSLIFY 1\n#ifdef CAMERA_ORTHOGRAPHIC\nvec3 V=-camera_Forward;\n#else\n#ifdef MATERIAL_NEED_WORLD_POS\nvec3 V=normalize(camera_Position-v_pos);\n#endif\n#endif\n"; // eslint-disable-line
|
|
3227
3237
|
|
|
3228
3238
|
var mobile_blinnphong_frag = "#define GLSLIFY 1\n#ifdef MATERIAL_HAS_NORMALTEXTURE\nmat3 tbn=getTBN(gl_FrontFacing);vec3 N=getNormalByNormalTexture(tbn,material_NormalTexture,material_NormalIntensity,v_uv,gl_FrontFacing);\n#else\nvec3 N=getNormal(gl_FrontFacing);\n#endif\nvec3 lightDiffuse=vec3(0.0,0.0,0.0);vec3 lightSpecular=vec3(0.0,0.0,0.0);float shadowAttenuation=1.0;\n#ifdef SCENE_DIRECT_LIGHT_COUNT\nshadowAttenuation=1.0;\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nshadowAttenuation*=sampleShadowMap();\n#endif\nDirectLight directionalLight;for(int i=0;i<SCENE_DIRECT_LIGHT_COUNT;i++){if(!isRendererCulledByLight(renderer_Layer.xy,scene_DirectLightCullingMask[i])){directionalLight.color=scene_DirectLightColor[i];\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nif(i==0){directionalLight.color*=shadowAttenuation;}\n#endif\ndirectionalLight.direction=scene_DirectLightDirection[i];float d=max(dot(N,-directionalLight.direction),0.0);lightDiffuse+=directionalLight.color*d;vec3 halfDir=normalize(V-directionalLight.direction);float s=pow(clamp(dot(N,halfDir),0.0,1.0),material_Shininess);lightSpecular+=directionalLight.color*s;}}\n#endif\n#ifdef SCENE_POINT_LIGHT_COUNT\nPointLight pointLight;for(int i=0;i<SCENE_POINT_LIGHT_COUNT;i++){if(!isRendererCulledByLight(renderer_Layer.xy,scene_PointLightCullingMask[i])){pointLight.color=scene_PointLightColor[i];pointLight.position=scene_PointLightPosition[i];pointLight.distance=scene_PointLightDistance[i];vec3 direction=v_pos-pointLight.position;float dist=length(direction);direction/=dist;float decay=clamp(1.0-pow(dist/pointLight.distance,4.0),0.0,1.0);float d=max(dot(N,-direction),0.0)*decay;lightDiffuse+=pointLight.color*d;vec3 halfDir=normalize(V-direction);float s=pow(clamp(dot(N,halfDir),0.0,1.0),material_Shininess)*decay;lightSpecular+=pointLight.color*s;}}\n#endif\n#ifdef SCENE_SPOT_LIGHT_COUNT\nSpotLight spotLight;for(int i=0;i<SCENE_SPOT_LIGHT_COUNT;i++){if(!isRendererCulledByLight(renderer_Layer.xy,scene_SpotLightCullingMask[i])){spotLight.color=scene_SpotLightColor[i];spotLight.position=scene_SpotLightPosition[i];spotLight.direction=scene_SpotLightDirection[i];spotLight.distance=scene_SpotLightDistance[i];spotLight.angleCos=scene_SpotLightAngleCos[i];spotLight.penumbraCos=scene_SpotLightPenumbraCos[i];vec3 direction=spotLight.position-v_pos;float lightDistance=length(direction);direction/=lightDistance;float angleCos=dot(direction,-spotLight.direction);float decay=clamp(1.0-pow(lightDistance/spotLight.distance,4.0),0.0,1.0);float spotEffect=smoothstep(spotLight.penumbraCos,spotLight.angleCos,angleCos);float decayTotal=decay*spotEffect;float d=max(dot(N,direction),0.0)*decayTotal;lightDiffuse+=spotLight.color*d;vec3 halfDir=normalize(V+direction);float s=pow(clamp(dot(N,halfDir),0.0,1.0),material_Shininess)*decayTotal;lightSpecular+=spotLight.color*s;}}\n#endif\ndiffuse*=vec4(lightDiffuse,1.0);specular*=vec4(lightSpecular,1.0);\n#ifdef MATERIAL_IS_ALPHA_CUTOFF\nif(diffuse.a<material_AlphaCutoff){discard;}\n#endif\n"; // eslint-disable-line
|
|
3229
3239
|
|
|
@@ -3261,7 +3271,7 @@ var noise_simplex_4D = "#define GLSLIFY 1\nvec4 grad4(float j,vec4 ip){const vec
|
|
|
3261
3271
|
|
|
3262
3272
|
var pbr_frag_define = "#define GLSLIFY 1\n#define MIN_PERCEPTUAL_ROUGHNESS 0.045\n#define MIN_ROUGHNESS 0.002025\nuniform float material_AlphaCutoff;uniform vec4 material_BaseColor;uniform float material_Metal;uniform float material_Roughness;uniform float material_IOR;uniform vec3 material_PBRSpecularColor;uniform float material_Glossiness;uniform vec3 material_EmissiveColor;uniform float material_NormalIntensity;uniform float material_OcclusionIntensity;uniform float material_OcclusionTextureCoord;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nuniform float material_ClearCoat;uniform float material_ClearCoatRoughness;\n#ifdef MATERIAL_HAS_CLEAR_COAT_TEXTURE\nuniform sampler2D material_ClearCoatTexture;\n#endif\n#ifdef MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE\nuniform sampler2D material_ClearCoatRoughnessTexture;\n#endif\n#ifdef MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE\nuniform sampler2D material_ClearCoatNormalTexture;\n#endif\n#endif\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nuniform vec3 material_AnisotropyInfo;\n#ifdef MATERIAL_HAS_ANISOTROPY_TEXTURE\nuniform sampler2D material_AnisotropyTexture;\n#endif\n#endif\n#ifdef MATERIAL_HAS_BASETEXTURE\nuniform sampler2D material_BaseTexture;\n#endif\n#ifdef MATERIAL_HAS_NORMALTEXTURE\nuniform sampler2D material_NormalTexture;\n#endif\n#ifdef MATERIAL_HAS_EMISSIVETEXTURE\nuniform sampler2D material_EmissiveTexture;\n#endif\n#ifdef MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE\nuniform sampler2D material_RoughnessMetallicTexture;\n#endif\n#ifdef MATERIAL_HAS_SPECULAR_GLOSSINESS_TEXTURE\nuniform sampler2D material_SpecularGlossinessTexture;\n#endif\n#ifdef MATERIAL_HAS_OCCLUSION_TEXTURE\nuniform sampler2D material_OcclusionTexture;\n#endif\nstruct ReflectedLight{vec3 directDiffuse;vec3 directSpecular;vec3 indirectDiffuse;vec3 indirectSpecular;};struct Geometry{vec3 position;vec3 normal;vec3 viewDir;float dotNV;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nvec3 clearCoatNormal;float clearCoatDotNV;\n#endif\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nvec3 anisotropicT;vec3 anisotropicB;vec3 anisotropicN;float anisotropy;\n#endif\n};struct Material{vec3 diffuseColor;float roughness;vec3 specularColor;float opacity;float f0;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nfloat clearCoat;float clearCoatRoughness;\n#endif\n};"; // eslint-disable-line
|
|
3263
3273
|
|
|
3264
|
-
var pbr_helper = "#define GLSLIFY 1\n#include <normal_get>\nfloat computeSpecularOcclusion(float ambientOcclusion,float roughness,float dotNV){return saturate(pow(dotNV+ambientOcclusion,exp2(-16.0*roughness-1.0))-1.0+ambientOcclusion);}float getAARoughnessFactor(vec3 normal){\n#ifdef HAS_DERIVATIVES\nvec3 dxy=max(abs(dFdx(normal)),abs(dFdy(normal)));return MIN_PERCEPTUAL_ROUGHNESS+max(max(dxy.x,dxy.y),dxy.z);\n#else\nreturn MIN_PERCEPTUAL_ROUGHNESS;\n#endif\n}\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nvec3 getAnisotropicBentNormal(Geometry geometry,vec3 n,float roughness){vec3 anisotropyDirection=geometry.anisotropy>=0.0 ? geometry.anisotropicB : geometry.anisotropicT;vec3 anisotropicTangent=cross(anisotropyDirection,geometry.viewDir);vec3 anisotropicNormal=cross(anisotropicTangent,anisotropyDirection);vec3 bentNormal=normalize(mix(n,anisotropicNormal,abs(geometry.anisotropy)*saturate(5.0*roughness)));return bentNormal;}\n#endif\nvoid initGeometry(out Geometry geometry,bool isFrontFacing){geometry.position=v_pos
|
|
3274
|
+
var pbr_helper = "#define GLSLIFY 1\n#include <normal_get>\nfloat computeSpecularOcclusion(float ambientOcclusion,float roughness,float dotNV){return saturate(pow(dotNV+ambientOcclusion,exp2(-16.0*roughness-1.0))-1.0+ambientOcclusion);}float getAARoughnessFactor(vec3 normal){\n#ifdef HAS_DERIVATIVES\nvec3 dxy=max(abs(dFdx(normal)),abs(dFdy(normal)));return MIN_PERCEPTUAL_ROUGHNESS+max(max(dxy.x,dxy.y),dxy.z);\n#else\nreturn MIN_PERCEPTUAL_ROUGHNESS;\n#endif\n}\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nvec3 getAnisotropicBentNormal(Geometry geometry,vec3 n,float roughness){vec3 anisotropyDirection=geometry.anisotropy>=0.0 ? geometry.anisotropicB : geometry.anisotropicT;vec3 anisotropicTangent=cross(anisotropyDirection,geometry.viewDir);vec3 anisotropicNormal=cross(anisotropicTangent,anisotropyDirection);vec3 bentNormal=normalize(mix(n,anisotropicNormal,abs(geometry.anisotropy)*saturate(5.0*roughness)));return bentNormal;}\n#endif\nvoid initGeometry(out Geometry geometry,bool isFrontFacing){geometry.position=v_pos;\n#ifdef CAMERA_ORTHOGRAPHIC\ngeometry.viewDir=-camera_Forward;\n#else\ngeometry.viewDir=normalize(camera_Position-v_pos);\n#endif\n#if defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) || defined(MATERIAL_ENABLE_ANISOTROPY)\nmat3 tbn=getTBN(isFrontFacing);\n#endif\n#ifdef MATERIAL_HAS_NORMALTEXTURE\ngeometry.normal=getNormalByNormalTexture(tbn,material_NormalTexture,material_NormalIntensity,v_uv,isFrontFacing);\n#else\ngeometry.normal=getNormal(isFrontFacing);\n#endif\ngeometry.dotNV=saturate(dot(geometry.normal,geometry.viewDir));\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\n#ifdef MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE\ngeometry.clearCoatNormal=getNormalByNormalTexture(tbn,material_ClearCoatNormalTexture,material_NormalIntensity,v_uv,isFrontFacing);\n#else\ngeometry.clearCoatNormal=getNormal(isFrontFacing);\n#endif\ngeometry.clearCoatDotNV=saturate(dot(geometry.clearCoatNormal,geometry.viewDir));\n#endif\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nfloat anisotropy=material_AnisotropyInfo.z;vec3 anisotropicDirection=vec3(material_AnisotropyInfo.xy,0.0);\n#ifdef MATERIAL_HAS_ANISOTROPY_TEXTURE\nvec3 anisotropyTextureInfo=texture2D(material_AnisotropyTexture,v_uv).rgb;anisotropy*=anisotropyTextureInfo.b;anisotropicDirection.xy*=anisotropyTextureInfo.rg*2.0-1.0;\n#endif\ngeometry.anisotropy=anisotropy;geometry.anisotropicT=normalize(tbn*anisotropicDirection);geometry.anisotropicB=normalize(cross(geometry.normal,geometry.anisotropicT));\n#endif\n}void initMaterial(out Material material,inout Geometry geometry){vec4 baseColor=material_BaseColor;float metal=material_Metal;float roughness=material_Roughness;vec3 specularColor=material_PBRSpecularColor;float glossiness=material_Glossiness;float alphaCutoff=material_AlphaCutoff;float f0=pow2((material_IOR-1.0)/(material_IOR+1.0));material.f0=f0;\n#ifdef MATERIAL_HAS_BASETEXTURE\nvec4 baseTextureColor=texture2D(material_BaseTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nbaseTextureColor=gammaToLinear(baseTextureColor);\n#endif\nbaseColor*=baseTextureColor;\n#endif\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\nbaseColor*=v_color;\n#endif\n#ifdef MATERIAL_IS_ALPHA_CUTOFF\nif(baseColor.a<alphaCutoff){discard;}\n#endif\n#ifdef MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE\nvec4 metalRoughMapColor=texture2D(material_RoughnessMetallicTexture,v_uv);roughness*=metalRoughMapColor.g;metal*=metalRoughMapColor.b;\n#endif\n#ifdef MATERIAL_HAS_SPECULAR_GLOSSINESS_TEXTURE\nvec4 specularGlossinessColor=texture2D(material_SpecularGlossinessTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nspecularGlossinessColor=gammaToLinear(specularGlossinessColor);\n#endif\nspecularColor*=specularGlossinessColor.rgb;glossiness*=specularGlossinessColor.a;\n#endif\n#ifdef IS_METALLIC_WORKFLOW\nmaterial.diffuseColor=baseColor.rgb*(1.0-metal);material.specularColor=mix(vec3(f0),baseColor.rgb,metal);material.roughness=roughness;\n#else\nfloat specularStrength=max(max(specularColor.r,specularColor.g),specularColor.b);material.diffuseColor=baseColor.rgb*(1.0-specularStrength);material.specularColor=specularColor;material.roughness=1.0-glossiness;\n#endif\nmaterial.roughness=max(material.roughness,getAARoughnessFactor(geometry.normal));\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nmaterial.clearCoat=material_ClearCoat;material.clearCoatRoughness=material_ClearCoatRoughness;\n#ifdef MATERIAL_HAS_CLEAR_COAT_TEXTURE\nmaterial.clearCoat*=texture2D(material_ClearCoatTexture,v_uv).r;\n#endif\n#ifdef MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE\nmaterial.clearCoatRoughness*=texture2D(material_ClearCoatRoughnessTexture,v_uv).g;\n#endif\nmaterial.clearCoat=saturate(material.clearCoat);material.clearCoatRoughness=max(material.clearCoatRoughness,getAARoughnessFactor(geometry.clearCoatNormal));\n#endif\n#ifdef MATERIAL_IS_TRANSPARENT\nmaterial.opacity=baseColor.a;\n#else\nmaterial.opacity=1.0;\n#endif\n#ifdef MATERIAL_ENABLE_ANISOTROPY\ngeometry.anisotropicN=getAnisotropicBentNormal(geometry,geometry.normal,material.roughness);\n#endif\n}\n#include <brdf>\n#include <direct_irradiance_frag_define>\n#include <ibl_frag_define>\n"; // eslint-disable-line
|
|
3265
3275
|
|
|
3266
3276
|
var brdf = "#define GLSLIFY 1\nfloat F_Schlick(float f0,float dotLH){return f0+0.96*(pow(1.0-dotLH,5.0));}vec3 F_Schlick(vec3 specularColor,float dotLH){float fresnel=exp2((-5.55473*dotLH-6.98316)*dotLH);return(1.0-specularColor)*fresnel+specularColor;}float G_GGX_SmithCorrelated(float alpha,float dotNL,float dotNV){float a2=pow2(alpha);float gv=dotNL*sqrt(a2+(1.0-a2)*pow2(dotNV));float gl=dotNV*sqrt(a2+(1.0-a2)*pow2(dotNL));return 0.5/max(gv+gl,EPSILON);}\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nfloat G_GGX_SmithCorrelated_Anisotropic(float at,float ab,float ToV,float BoV,float ToL,float BoL,float NoV,float NoL){float lambdaV=NoL*length(vec3(at*ToV,ab*BoV,NoV));float lambdaL=NoV*length(vec3(at*ToL,ab*BoL,NoL));return 0.5/max(lambdaV+lambdaL,EPSILON);}\n#endif\nfloat D_GGX(float alpha,float dotNH){float a2=pow2(alpha);float denom=pow2(dotNH)*(a2-1.0)+1.0;return RECIPROCAL_PI*a2/pow2(denom);}\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nfloat D_GGX_Anisotropic(float at,float ab,float ToH,float BoH,float NoH){float a2=at*ab;highp vec3 d=vec3(ab*ToH,at*BoH,a2*NoH);highp float d2=dot(d,d);float b2=a2/d2;return a2*b2*b2*RECIPROCAL_PI;}\n#endif\nvec3 isotropicLobe(vec3 specularColor,float alpha,float dotNV,float dotNL,float dotNH,float dotLH){vec3 F=F_Schlick(specularColor,dotLH);float D=D_GGX(alpha,dotNH);float G=G_GGX_SmithCorrelated(alpha,dotNL,dotNV);return F*(G*D);}\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nvec3 anisotropicLobe(vec3 h,vec3 l,Geometry geometry,vec3 specularColor,float alpha,float dotNV,float dotNL,float dotNH,float dotLH){vec3 t=geometry.anisotropicT;vec3 b=geometry.anisotropicB;vec3 v=geometry.viewDir;float dotTV=dot(t,v);float dotBV=dot(b,v);float dotTL=dot(t,l);float dotBL=dot(b,l);float dotTH=dot(t,h);float dotBH=dot(b,h);float at=max(alpha*(1.0+geometry.anisotropy),MIN_ROUGHNESS);float ab=max(alpha*(1.0-geometry.anisotropy),MIN_ROUGHNESS);vec3 F=F_Schlick(specularColor,dotLH);float D=D_GGX_Anisotropic(at,ab,dotTH,dotBH,dotNH);float G=G_GGX_SmithCorrelated_Anisotropic(at,ab,dotTV,dotBV,dotTL,dotBL,dotNV,dotNL);return F*(G*D);}\n#endif\nvec3 BRDF_Specular_GGX(vec3 incidentDirection,Geometry geometry,vec3 normal,vec3 specularColor,float roughness){float alpha=pow2(roughness);vec3 halfDir=normalize(incidentDirection+geometry.viewDir);float dotNL=saturate(dot(normal,incidentDirection));float dotNV=saturate(dot(normal,geometry.viewDir));float dotNH=saturate(dot(normal,halfDir));float dotLH=saturate(dot(incidentDirection,halfDir));\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nreturn anisotropicLobe(halfDir,incidentDirection,geometry,specularColor,alpha,dotNV,dotNL,dotNH,dotLH);\n#else\nreturn isotropicLobe(specularColor,alpha,dotNV,dotNL,dotNH,dotLH);\n#endif\n}vec3 BRDF_Diffuse_Lambert(vec3 diffuseColor){return RECIPROCAL_PI*diffuseColor;}"; // eslint-disable-line
|
|
3267
3277
|
|
|
@@ -3282,7 +3292,7 @@ var PBRShaderLib = {
|
|
|
3282
3292
|
|
|
3283
3293
|
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
|
|
3284
3294
|
|
|
3285
|
-
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
|
|
3295
|
+
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
|
|
3286
3296
|
|
|
3287
3297
|
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
|
|
3288
3298
|
|
|
@@ -3397,16 +3407,22 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
3397
3407
|
}
|
|
3398
3408
|
ShaderLib[includeName] = includeSource;
|
|
3399
3409
|
};
|
|
3400
|
-
ShaderFactory.
|
|
3410
|
+
ShaderFactory.unRegisterInclude = function unRegisterInclude(includeName) {
|
|
3411
|
+
delete ShaderLib[includeName];
|
|
3412
|
+
};
|
|
3413
|
+
/**
|
|
3414
|
+
* @param regex The default regex is for engine's builtin glsl `#include` syntax,
|
|
3415
|
+
* since `ShaderLab` use the same parsing function but different syntax for `#include` --- `/^[ \t]*#include +"([\w\d.]+)"/gm`
|
|
3416
|
+
*/ ShaderFactory.parseIncludes = function parseIncludes(src, regex) {
|
|
3417
|
+
if (regex === void 0) regex = /^[ \t]*#include +<([\w\d.]+)>/gm;
|
|
3401
3418
|
var replace = function replace(match, slice) {
|
|
3402
3419
|
var replace = ShaderLib[slice];
|
|
3403
3420
|
if (replace === undefined) {
|
|
3404
3421
|
Logger.error('Shader slice "' + match.trim() + '" not founded.');
|
|
3405
3422
|
return "";
|
|
3406
3423
|
}
|
|
3407
|
-
return ShaderFactory.parseIncludes(replace);
|
|
3424
|
+
return ShaderFactory.parseIncludes(replace, regex);
|
|
3408
3425
|
};
|
|
3409
|
-
var regex = /^[ \t]*#include +<([\w\d.]+)>/gm;
|
|
3410
3426
|
return src.replace(regex, replace);
|
|
3411
3427
|
};
|
|
3412
3428
|
/**
|
|
@@ -3517,16 +3533,6 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
3517
3533
|
return ShaderPart;
|
|
3518
3534
|
}();
|
|
3519
3535
|
|
|
3520
|
-
/**
|
|
3521
|
-
* Shader data grouping.
|
|
3522
|
-
*/ var ShaderDataGroup;
|
|
3523
|
-
(function(ShaderDataGroup) {
|
|
3524
|
-
ShaderDataGroup[ShaderDataGroup[/** Scene group. */ "Scene"] = 0] = "Scene";
|
|
3525
|
-
ShaderDataGroup[ShaderDataGroup[/** Camera group. */ "Camera"] = 1] = "Camera";
|
|
3526
|
-
ShaderDataGroup[ShaderDataGroup[/** Renderer group. */ "Renderer"] = 2] = "Renderer";
|
|
3527
|
-
ShaderDataGroup[ShaderDataGroup[/** material group. */ "Material"] = 3] = "Material";
|
|
3528
|
-
})(ShaderDataGroup || (ShaderDataGroup = {}));
|
|
3529
|
-
|
|
3530
3536
|
/**
|
|
3531
3537
|
* Color Space.
|
|
3532
3538
|
*/ exports.ColorSpace = void 0;
|
|
@@ -3736,6 +3742,16 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
3736
3742
|
this.textureUniforms = [];
|
|
3737
3743
|
};
|
|
3738
3744
|
|
|
3745
|
+
/**
|
|
3746
|
+
* Shader data grouping.
|
|
3747
|
+
*/ var ShaderDataGroup;
|
|
3748
|
+
(function(ShaderDataGroup) {
|
|
3749
|
+
ShaderDataGroup[ShaderDataGroup[/** Scene group. */ "Scene"] = 0] = "Scene";
|
|
3750
|
+
ShaderDataGroup[ShaderDataGroup[/** Camera group. */ "Camera"] = 1] = "Camera";
|
|
3751
|
+
ShaderDataGroup[ShaderDataGroup[/** Renderer group. */ "Renderer"] = 2] = "Renderer";
|
|
3752
|
+
ShaderDataGroup[ShaderDataGroup[/** material group. */ "Material"] = 3] = "Material";
|
|
3753
|
+
})(ShaderDataGroup || (ShaderDataGroup = {}));
|
|
3754
|
+
|
|
3739
3755
|
/**
|
|
3740
3756
|
* Shader program, corresponding to the GPU shader program.
|
|
3741
3757
|
* @internal
|
|
@@ -4031,6 +4047,7 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
4031
4047
|
break;
|
|
4032
4048
|
case gl.SAMPLER_2D:
|
|
4033
4049
|
case gl.SAMPLER_CUBE:
|
|
4050
|
+
case gl.UNSIGNED_INT_SAMPLER_2D:
|
|
4034
4051
|
case gl.SAMPLER_2D_ARRAY:
|
|
4035
4052
|
case gl.SAMPLER_2D_SHADOW:
|
|
4036
4053
|
var defaultTexture;
|
|
@@ -4041,6 +4058,9 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
4041
4058
|
case gl.SAMPLER_CUBE:
|
|
4042
4059
|
defaultTexture = _this._engine._magentaTextureCube;
|
|
4043
4060
|
break;
|
|
4061
|
+
case gl.UNSIGNED_INT_SAMPLER_2D:
|
|
4062
|
+
defaultTexture = _this._engine._uintMagentaTexture2D;
|
|
4063
|
+
break;
|
|
4044
4064
|
case gl.SAMPLER_2D_ARRAY:
|
|
4045
4065
|
defaultTexture = _this._engine._magentaTexture2DArray;
|
|
4046
4066
|
break;
|
|
@@ -5130,6 +5150,57 @@ var GraphicsResource = /*#__PURE__*/ function(ReferResource1) {
|
|
|
5130
5150
|
return GraphicsResource;
|
|
5131
5151
|
}(ReferResource);
|
|
5132
5152
|
|
|
5153
|
+
/**
|
|
5154
|
+
* The filter mode of the texture.
|
|
5155
|
+
*/ exports.TextureFilterMode = void 0;
|
|
5156
|
+
(function(TextureFilterMode) {
|
|
5157
|
+
TextureFilterMode[TextureFilterMode[/** Point filtering. */ "Point"] = 0] = "Point";
|
|
5158
|
+
TextureFilterMode[TextureFilterMode[/** Bilinear filtering. */ "Bilinear"] = 1] = "Bilinear";
|
|
5159
|
+
TextureFilterMode[TextureFilterMode[/** Trilinear filtering. */ "Trilinear"] = 2] = "Trilinear";
|
|
5160
|
+
})(exports.TextureFilterMode || (exports.TextureFilterMode = {}));
|
|
5161
|
+
|
|
5162
|
+
/**
|
|
5163
|
+
* Texture format enumeration.
|
|
5164
|
+
*/ exports.TextureFormat = void 0;
|
|
5165
|
+
(function(TextureFormat) {
|
|
5166
|
+
TextureFormat[TextureFormat[/** RGB format, 8 bits per channel. */ "R8G8B8"] = 0] = "R8G8B8";
|
|
5167
|
+
TextureFormat[TextureFormat[/** RGBA format, 8 bits per channel. */ "R8G8B8A8"] = 1] = "R8G8B8A8";
|
|
5168
|
+
TextureFormat[TextureFormat[/** RGBA format, 4 bits per channel. */ "R4G4B4A4"] = 2] = "R4G4B4A4";
|
|
5169
|
+
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";
|
|
5170
|
+
TextureFormat[TextureFormat[/** RGB format, 5 bits in R channel, 6 bits in G channel, 5 bits in B channel. */ "R5G6B5"] = 4] = "R5G6B5";
|
|
5171
|
+
TextureFormat[TextureFormat[/** Transparent format, 8 bits. */ "Alpha8"] = 5] = "Alpha8";
|
|
5172
|
+
TextureFormat[TextureFormat[/** Luminance/alpha in RGB channel, alpha in A channel. */ "LuminanceAlpha"] = 6] = "LuminanceAlpha";
|
|
5173
|
+
TextureFormat[TextureFormat[/** RGBA format, 16 bits per channel. */ "R16G16B16A16"] = 7] = "R16G16B16A16";
|
|
5174
|
+
TextureFormat[TextureFormat[/** RGBA format, 32 bits per channel. */ "R32G32B32A32"] = 8] = "R32G32B32A32";
|
|
5175
|
+
TextureFormat[TextureFormat[/** RGBA unsigned integer format, 32 bits per channel. */ "R32G32B32A32_UInt"] = 9] = "R32G32B32A32_UInt";
|
|
5176
|
+
TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "BC1"] = 10] = "BC1";
|
|
5177
|
+
TextureFormat[TextureFormat[/** RGBA compressed format, 8 bits per pixel. */ "BC3"] = 11] = "BC3";
|
|
5178
|
+
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 4x4 pixel block. */ "BC7"] = 12] = "BC7";
|
|
5179
|
+
TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "ETC1_RGB"] = 13] = "ETC1_RGB";
|
|
5180
|
+
TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "ETC2_RGB"] = 14] = "ETC2_RGB";
|
|
5181
|
+
TextureFormat[TextureFormat[/** RGBA compressed format, 5 bits per pixel, 4 bit in RGB, 1 bit in A. */ "ETC2_RGBA5"] = 15] = "ETC2_RGBA5";
|
|
5182
|
+
TextureFormat[TextureFormat[/** RGB compressed format, 8 bits per pixel. */ "ETC2_RGBA8"] = 16] = "ETC2_RGBA8";
|
|
5183
|
+
TextureFormat[TextureFormat[/** RGB compressed format, 2 bits per pixel. */ "PVRTC_RGB2"] = 17] = "PVRTC_RGB2";
|
|
5184
|
+
TextureFormat[TextureFormat[/** RGBA compressed format, 2 bits per pixel. */ "PVRTC_RGBA2"] = 18] = "PVRTC_RGBA2";
|
|
5185
|
+
TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "PVRTC_RGB4"] = 19] = "PVRTC_RGB4";
|
|
5186
|
+
TextureFormat[TextureFormat[/** RGBA compressed format, 4 bits per pixel. */ "PVRTC_RGBA4"] = 20] = "PVRTC_RGBA4";
|
|
5187
|
+
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 4x4 pixel block. */ "ASTC_4x4"] = 21] = "ASTC_4x4";
|
|
5188
|
+
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 5x5 pixel block. */ "ASTC_5x5"] = 22] = "ASTC_5x5";
|
|
5189
|
+
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 6x6 pixel block. */ "ASTC_6x6"] = 23] = "ASTC_6x6";
|
|
5190
|
+
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 8x8 pixel block. */ "ASTC_8x8"] = 24] = "ASTC_8x8";
|
|
5191
|
+
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 10x10 pixel block. */ "ASTC_10x10"] = 25] = "ASTC_10x10";
|
|
5192
|
+
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 12x12 pixel block. */ "ASTC_12x12"] = 26] = "ASTC_12x12";
|
|
5193
|
+
TextureFormat[TextureFormat[/** Automatic depth format, engine will automatically select the supported precision. */ "Depth"] = 27] = "Depth";
|
|
5194
|
+
TextureFormat[TextureFormat[/** Automatic depth stencil format, engine will automatically select the supported precision. */ "DepthStencil"] = 28] = "DepthStencil";
|
|
5195
|
+
TextureFormat[TextureFormat[/** 16-bit depth format. */ "Depth16"] = 29] = "Depth16";
|
|
5196
|
+
TextureFormat[TextureFormat[/** 24-bit depth format. */ "Depth24"] = 30] = "Depth24";
|
|
5197
|
+
TextureFormat[TextureFormat[/** 32-bit depth format. */ "Depth32"] = 31] = "Depth32";
|
|
5198
|
+
TextureFormat[TextureFormat[/** 16-bit depth + 8-bit stencil format. */ "Depth24Stencil8"] = 32] = "Depth24Stencil8";
|
|
5199
|
+
TextureFormat[TextureFormat[/** 32-bit depth + 8-bit stencil format. */ "Depth32Stencil8"] = 33] = "Depth32Stencil8";
|
|
5200
|
+
TextureFormat[TextureFormat[/** @deprecated Use `TextureFormat.BC1` instead. */ "DXT1"] = 34] = "DXT1";
|
|
5201
|
+
TextureFormat[TextureFormat[/** @deprecated Use `TextureFormat.BC3` instead. */ "DXT5"] = 35] = "DXT5";
|
|
5202
|
+
})(exports.TextureFormat || (exports.TextureFormat = {}));
|
|
5203
|
+
|
|
5133
5204
|
/**
|
|
5134
5205
|
* The base class of texture, contains some common functions of texture-related classes.
|
|
5135
5206
|
*/ var Texture = /*#__PURE__*/ function(GraphicsResource1) {
|
|
@@ -5186,6 +5257,12 @@ var GraphicsResource = /*#__PURE__*/ function(ReferResource1) {
|
|
|
5186
5257
|
_proto._getMipmapCount = function _getMipmapCount() {
|
|
5187
5258
|
return this._mipmap ? Math.floor(Math.log2(Math.max(this._width, this._height))) + 1 : 1;
|
|
5188
5259
|
};
|
|
5260
|
+
_proto._isIntFormat = function _isIntFormat() {
|
|
5261
|
+
if (exports.TextureFormat.R32G32B32A32_UInt === this._format) {
|
|
5262
|
+
return true;
|
|
5263
|
+
}
|
|
5264
|
+
return false;
|
|
5265
|
+
};
|
|
5189
5266
|
_create_class(Texture, [
|
|
5190
5267
|
{
|
|
5191
5268
|
key: "format",
|
|
@@ -5262,6 +5339,11 @@ var GraphicsResource = /*#__PURE__*/ function(ReferResource1) {
|
|
|
5262
5339
|
},
|
|
5263
5340
|
set: function set(value) {
|
|
5264
5341
|
if (value === this._filterMode) return;
|
|
5342
|
+
if (value !== exports.TextureFilterMode.Point && this._isIntFormat()) {
|
|
5343
|
+
value = exports.TextureFilterMode.Point;
|
|
5344
|
+
Logger.warn("Int or UInt format texture only support TextureFilterMode.Point");
|
|
5345
|
+
return;
|
|
5346
|
+
}
|
|
5265
5347
|
this._filterMode = value;
|
|
5266
5348
|
this._platformTexture.filterMode = value;
|
|
5267
5349
|
}
|
|
@@ -6388,7 +6470,7 @@ SlicedSpriteAssembler = __decorate([
|
|
|
6388
6470
|
_this._byteLength = byteLength;
|
|
6389
6471
|
_this._platformBuffer = engine._hardwareRenderer.createPlatformBuffer(type, byteLength, bufferUsage, data);
|
|
6390
6472
|
if (readable) {
|
|
6391
|
-
var buffer =
|
|
6473
|
+
var buffer = data.constructor === ArrayBuffer ? data.slice(0) : data.buffer.slice(data.byteOffset, data.byteOffset + byteLength);
|
|
6392
6474
|
_this._data = new Uint8Array(buffer);
|
|
6393
6475
|
}
|
|
6394
6476
|
}
|
|
@@ -7565,56 +7647,6 @@ var /**
|
|
|
7565
7647
|
TextureDepthCompareFunction[TextureDepthCompareFunction[/** always pass. */ "Always"] = 7] = "Always";
|
|
7566
7648
|
})(exports.TextureDepthCompareFunction || (exports.TextureDepthCompareFunction = {}));
|
|
7567
7649
|
|
|
7568
|
-
/**
|
|
7569
|
-
* The filter mode of the texture.
|
|
7570
|
-
*/ exports.TextureFilterMode = void 0;
|
|
7571
|
-
(function(TextureFilterMode) {
|
|
7572
|
-
TextureFilterMode[TextureFilterMode[/** Point filtering. */ "Point"] = 0] = "Point";
|
|
7573
|
-
TextureFilterMode[TextureFilterMode[/** Bilinear filtering. */ "Bilinear"] = 1] = "Bilinear";
|
|
7574
|
-
TextureFilterMode[TextureFilterMode[/** Trilinear filtering. */ "Trilinear"] = 2] = "Trilinear";
|
|
7575
|
-
})(exports.TextureFilterMode || (exports.TextureFilterMode = {}));
|
|
7576
|
-
|
|
7577
|
-
/**
|
|
7578
|
-
* Texture format enumeration.
|
|
7579
|
-
*/ exports.TextureFormat = void 0;
|
|
7580
|
-
(function(TextureFormat) {
|
|
7581
|
-
TextureFormat[TextureFormat[/** RGB format, 8 bits per channel. */ "R8G8B8"] = 0] = "R8G8B8";
|
|
7582
|
-
TextureFormat[TextureFormat[/** RGBA format, 8 bits per channel. */ "R8G8B8A8"] = 1] = "R8G8B8A8";
|
|
7583
|
-
TextureFormat[TextureFormat[/** RGBA format, 4 bits per channel. */ "R4G4B4A4"] = 2] = "R4G4B4A4";
|
|
7584
|
-
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";
|
|
7585
|
-
TextureFormat[TextureFormat[/** RGB format, 5 bits in R channel, 6 bits in G channel, 5 bits in B channel. */ "R5G6B5"] = 4] = "R5G6B5";
|
|
7586
|
-
TextureFormat[TextureFormat[/** Transparent format, 8 bits. */ "Alpha8"] = 5] = "Alpha8";
|
|
7587
|
-
TextureFormat[TextureFormat[/** Luminance/alpha in RGB channel, alpha in A channel. */ "LuminanceAlpha"] = 6] = "LuminanceAlpha";
|
|
7588
|
-
TextureFormat[TextureFormat[/** RGBA format, 16 bits per channel. */ "R16G16B16A16"] = 7] = "R16G16B16A16";
|
|
7589
|
-
TextureFormat[TextureFormat[/** RGBA format, 32 bits per channel. */ "R32G32B32A32"] = 8] = "R32G32B32A32";
|
|
7590
|
-
TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "BC1"] = 9] = "BC1";
|
|
7591
|
-
TextureFormat[TextureFormat[/** RGBA compressed format, 8 bits per pixel. */ "BC3"] = 10] = "BC3";
|
|
7592
|
-
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 4x4 pixel block. */ "BC7"] = 11] = "BC7";
|
|
7593
|
-
TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "ETC1_RGB"] = 12] = "ETC1_RGB";
|
|
7594
|
-
TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "ETC2_RGB"] = 13] = "ETC2_RGB";
|
|
7595
|
-
TextureFormat[TextureFormat[/** RGBA compressed format, 5 bits per pixel, 4 bit in RGB, 1 bit in A. */ "ETC2_RGBA5"] = 14] = "ETC2_RGBA5";
|
|
7596
|
-
TextureFormat[TextureFormat[/** RGB compressed format, 8 bits per pixel. */ "ETC2_RGBA8"] = 15] = "ETC2_RGBA8";
|
|
7597
|
-
TextureFormat[TextureFormat[/** RGB compressed format, 2 bits per pixel. */ "PVRTC_RGB2"] = 16] = "PVRTC_RGB2";
|
|
7598
|
-
TextureFormat[TextureFormat[/** RGBA compressed format, 2 bits per pixel. */ "PVRTC_RGBA2"] = 17] = "PVRTC_RGBA2";
|
|
7599
|
-
TextureFormat[TextureFormat[/** RGB compressed format, 4 bits per pixel. */ "PVRTC_RGB4"] = 18] = "PVRTC_RGB4";
|
|
7600
|
-
TextureFormat[TextureFormat[/** RGBA compressed format, 4 bits per pixel. */ "PVRTC_RGBA4"] = 19] = "PVRTC_RGBA4";
|
|
7601
|
-
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 4x4 pixel block. */ "ASTC_4x4"] = 20] = "ASTC_4x4";
|
|
7602
|
-
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 5x5 pixel block. */ "ASTC_5x5"] = 21] = "ASTC_5x5";
|
|
7603
|
-
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 6x6 pixel block. */ "ASTC_6x6"] = 22] = "ASTC_6x6";
|
|
7604
|
-
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 8x8 pixel block. */ "ASTC_8x8"] = 23] = "ASTC_8x8";
|
|
7605
|
-
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 10x10 pixel block. */ "ASTC_10x10"] = 24] = "ASTC_10x10";
|
|
7606
|
-
TextureFormat[TextureFormat[/** RGB(A) compressed format, 128 bits per 12x12 pixel block. */ "ASTC_12x12"] = 25] = "ASTC_12x12";
|
|
7607
|
-
TextureFormat[TextureFormat[/** Automatic depth format, engine will automatically select the supported precision. */ "Depth"] = 26] = "Depth";
|
|
7608
|
-
TextureFormat[TextureFormat[/** Automatic depth stencil format, engine will automatically select the supported precision. */ "DepthStencil"] = 27] = "DepthStencil";
|
|
7609
|
-
TextureFormat[TextureFormat[/** 16-bit depth format. */ "Depth16"] = 28] = "Depth16";
|
|
7610
|
-
TextureFormat[TextureFormat[/** 24-bit depth format. */ "Depth24"] = 29] = "Depth24";
|
|
7611
|
-
TextureFormat[TextureFormat[/** 32-bit depth format. */ "Depth32"] = 30] = "Depth32";
|
|
7612
|
-
TextureFormat[TextureFormat[/** 16-bit depth + 8-bit stencil format. */ "Depth24Stencil8"] = 31] = "Depth24Stencil8";
|
|
7613
|
-
TextureFormat[TextureFormat[/** 32-bit depth + 8-bit stencil format. */ "Depth32Stencil8"] = 32] = "Depth32Stencil8";
|
|
7614
|
-
TextureFormat[TextureFormat[/** @deprecated Use `TextureFormat.BC1` instead. */ "DXT1"] = 33] = "DXT1";
|
|
7615
|
-
TextureFormat[TextureFormat[/** @deprecated Use `TextureFormat.BC3` instead. */ "DXT5"] = 34] = "DXT5";
|
|
7616
|
-
})(exports.TextureFormat || (exports.TextureFormat = {}));
|
|
7617
|
-
|
|
7618
7650
|
/**
|
|
7619
7651
|
* Texture usage.
|
|
7620
7652
|
*/ exports.TextureUsage = void 0;
|
|
@@ -7798,7 +7830,7 @@ var /**
|
|
|
7798
7830
|
_this._mipmapCount = _this._getMipmapCount();
|
|
7799
7831
|
_this._isDepthTexture = format == exports.TextureFormat.Depth || format == exports.TextureFormat.DepthStencil || format == exports.TextureFormat.Depth16 || format == exports.TextureFormat.Depth24 || format == exports.TextureFormat.Depth32 || format == exports.TextureFormat.Depth24Stencil8 || format == exports.TextureFormat.Depth32Stencil8;
|
|
7800
7832
|
_this._platformTexture = engine._hardwareRenderer.createPlatformTexture2D(_assert_this_initialized(_this));
|
|
7801
|
-
_this.filterMode = exports.TextureFilterMode.Bilinear;
|
|
7833
|
+
_this.filterMode = _this._isIntFormat() ? exports.TextureFilterMode.Point : exports.TextureFilterMode.Bilinear;
|
|
7802
7834
|
_this.wrapModeU = _this.wrapModeV = exports.TextureWrapMode.Repeat;
|
|
7803
7835
|
return _this;
|
|
7804
7836
|
}
|
|
@@ -10608,7 +10640,7 @@ var PrimitiveType;
|
|
|
10608
10640
|
var theta = thetaStart + u * thetaRange;
|
|
10609
10641
|
var sinTheta = Math.sin(theta);
|
|
10610
10642
|
var cosTheta = Math.cos(theta);
|
|
10611
|
-
var curRadius = radius -
|
|
10643
|
+
var curRadius = radius - v * radius;
|
|
10612
10644
|
var posX = curRadius * sinTheta;
|
|
10613
10645
|
var posY = y * unitHeight - halfHeight;
|
|
10614
10646
|
var posZ = curRadius * cosTheta;
|
|
@@ -10742,8 +10774,8 @@ var PrimitiveType;
|
|
|
10742
10774
|
indices[indicesOffset++] = d;
|
|
10743
10775
|
indices[indicesOffset++] = c;
|
|
10744
10776
|
}
|
|
10745
|
-
PrimitiveMesh._createCapsuleCap(radius, height, radialSegments, thetaRange, torsoVertexCount, 1, vertices, indices, indicesOffset);
|
|
10746
|
-
PrimitiveMesh._createCapsuleCap(radius, height, radialSegments, -thetaRange, torsoVertexCount + capVertexCount, -1, vertices, indices, indicesOffset + 6 * capRectangleCount);
|
|
10777
|
+
PrimitiveMesh._createCapsuleCap(radius, height, radialSegments, thetaStart, thetaRange, torsoVertexCount, 1, vertices, indices, indicesOffset);
|
|
10778
|
+
PrimitiveMesh._createCapsuleCap(radius, height, radialSegments, thetaStart, -thetaRange, torsoVertexCount + capVertexCount, -1, vertices, indices, indicesOffset + 6 * capRectangleCount);
|
|
10747
10779
|
if (!isRestoreMode) {
|
|
10748
10780
|
var bounds = capsuleMesh.bounds;
|
|
10749
10781
|
bounds.min.set(-radius, -radius - halfHeight, -radius);
|
|
@@ -10784,7 +10816,7 @@ var PrimitiveType;
|
|
|
10784
10816
|
}
|
|
10785
10817
|
return indices;
|
|
10786
10818
|
};
|
|
10787
|
-
PrimitiveMesh._createCapsuleCap = function _createCapsuleCap(radius, height, radialSegments,
|
|
10819
|
+
PrimitiveMesh._createCapsuleCap = function _createCapsuleCap(radius, height, radialSegments, thetaStart, thetaRange, offset, posIndex, vertices, indices, indicesOffset) {
|
|
10788
10820
|
var radialCount = radialSegments + 1;
|
|
10789
10821
|
var halfHeight = height * 0.5 * posIndex;
|
|
10790
10822
|
var capVertexCount = radialCount * radialCount;
|
|
@@ -10797,12 +10829,12 @@ var PrimitiveType;
|
|
|
10797
10829
|
var y = i * radialCountReciprocal | 0;
|
|
10798
10830
|
var u = x * radialSegmentsReciprocal;
|
|
10799
10831
|
var v = y * radialSegmentsReciprocal;
|
|
10800
|
-
var
|
|
10801
|
-
var
|
|
10802
|
-
var
|
|
10803
|
-
var posX =
|
|
10804
|
-
var posY = radius * Math.cos(
|
|
10805
|
-
var posZ = radius * Math.
|
|
10832
|
+
var theta = thetaStart + u * thetaRange;
|
|
10833
|
+
var alpha = v * Math.PI * 0.5;
|
|
10834
|
+
var sinAlpha = Math.sin(alpha);
|
|
10835
|
+
var posX = radius * Math.sin(theta) * sinAlpha;
|
|
10836
|
+
var posY = radius * Math.cos(alpha) * posIndex + halfHeight;
|
|
10837
|
+
var posZ = radius * Math.cos(theta) * sinAlpha;
|
|
10806
10838
|
var index = (i + offset) * vertexFloatCount;
|
|
10807
10839
|
// Position
|
|
10808
10840
|
vertices[index++] = posX;
|
|
@@ -11361,7 +11393,9 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
|
|
|
11361
11393
|
this._batchedQueue = null;
|
|
11362
11394
|
var _this = this, meshes = _this._meshes, vertexBuffers = _this._vertexBuffers, indiceBuffers = _this._indiceBuffers;
|
|
11363
11395
|
for(var i = 0, n = meshes.length; i < n; ++i){
|
|
11364
|
-
meshes[i]
|
|
11396
|
+
var mesh = meshes[i];
|
|
11397
|
+
mesh._addReferCount(-1);
|
|
11398
|
+
mesh.destroy();
|
|
11365
11399
|
}
|
|
11366
11400
|
this._meshes = null;
|
|
11367
11401
|
for(var i1 = 0, n1 = vertexBuffers.length; i1 < n1; ++i1){
|
|
@@ -11384,7 +11418,7 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
|
|
|
11384
11418
|
_proto._createMesh = function _createMesh(engine, index) {
|
|
11385
11419
|
var MAX_VERTEX_COUNT = Basic2DBatcher.MAX_VERTEX_COUNT;
|
|
11386
11420
|
var mesh = new BufferMesh(engine, "BufferMesh" + index);
|
|
11387
|
-
mesh.
|
|
11421
|
+
mesh._addReferCount(1);
|
|
11388
11422
|
var vertexElements = [];
|
|
11389
11423
|
var vertexStride = this.createVertexElements(vertexElements);
|
|
11390
11424
|
// vertices
|
|
@@ -12883,6 +12917,9 @@ var /**
|
|
|
12883
12917
|
var baseline = Math.ceil(context.measureText(TextUtils._measureBaseline).width);
|
|
12884
12918
|
var height = baseline * TextUtils._heightMultiplier;
|
|
12885
12919
|
baseline = TextUtils._baselineMultiplier * baseline | 0;
|
|
12920
|
+
var _extendHeight = TextUtils._extendHeight;
|
|
12921
|
+
height += _extendHeight;
|
|
12922
|
+
baseline += _extendHeight * 0.5;
|
|
12886
12923
|
canvas.width = width;
|
|
12887
12924
|
canvas.height = height;
|
|
12888
12925
|
context.font = fontString;
|
|
@@ -12917,6 +12954,7 @@ var /**
|
|
|
12917
12954
|
}
|
|
12918
12955
|
if (top !== -1 && bottom !== -1) {
|
|
12919
12956
|
ascent = baseline - top;
|
|
12957
|
+
// Baseline belong to descent
|
|
12920
12958
|
descent = bottom - baseline + 1;
|
|
12921
12959
|
size = ascent + descent;
|
|
12922
12960
|
}
|
|
@@ -12993,9 +13031,8 @@ var /**
|
|
|
12993
13031
|
];
|
|
12994
13032
|
})();
|
|
12995
13033
|
(function() {
|
|
12996
|
-
//
|
|
12997
|
-
|
|
12998
|
-
/** @internal */ TextUtils._heightMultiplier = 2;
|
|
13034
|
+
// _extendHeight used to extend the height of canvas, because in miniprogram performance is different from h5.
|
|
13035
|
+
/** @internal */ TextUtils._extendHeight = 0;
|
|
12999
13036
|
})();
|
|
13000
13037
|
(function() {
|
|
13001
13038
|
/** These characters are all tall to help calculate the height required for text. */ TextUtils._measureString = "|\xc9q\xc5";
|
|
@@ -13003,6 +13040,9 @@ var /**
|
|
|
13003
13040
|
(function() {
|
|
13004
13041
|
TextUtils._measureBaseline = "M";
|
|
13005
13042
|
})();
|
|
13043
|
+
(function() {
|
|
13044
|
+
TextUtils._heightMultiplier = 2;
|
|
13045
|
+
})();
|
|
13006
13046
|
(function() {
|
|
13007
13047
|
TextUtils._baselineMultiplier = 1.4;
|
|
13008
13048
|
})();
|
|
@@ -14761,6 +14801,7 @@ var TextRenderData = /*#__PURE__*/ function(RenderData1) {
|
|
|
14761
14801
|
AssetType[/** Cube Compress Texture. */ "KTXCube"] = "KTXCube";
|
|
14762
14802
|
AssetType[/** KTX2 Compress Texture */ "KTX2"] = "KTX2";
|
|
14763
14803
|
AssetType[/** Sprite. */ "Sprite"] = "Sprite";
|
|
14804
|
+
AssetType[/** PrimitiveMesh. */ "PrimitiveMesh"] = "PrimitiveMesh";
|
|
14764
14805
|
AssetType[/** Sprite Atlas. */ "SpriteAtlas"] = "SpriteAtlas";
|
|
14765
14806
|
AssetType[/** Ambient light. */ "Env"] = "Environment";
|
|
14766
14807
|
AssetType[/** Scene. */ "Scene"] = "Scene";
|
|
@@ -15146,6 +15187,7 @@ var /** @internal */ PromiseState;
|
|
|
15146
15187
|
this./** The number of retries after failing to load assets. */ retryCount = 1;
|
|
15147
15188
|
this./** Retry delay time after failed to load assets, in milliseconds. */ retryInterval = 0;
|
|
15148
15189
|
this./** The default timeout period for loading assets, in milliseconds. */ timeout = Infinity;
|
|
15190
|
+
this./** Base url for loading assets. */ baseUrl = null;
|
|
15149
15191
|
this._loadingPromises = {};
|
|
15150
15192
|
this._assetPool = Object.create(null);
|
|
15151
15193
|
this._assetUrlPool = Object.create(null);
|
|
@@ -15349,6 +15391,8 @@ var /** @internal */ PromiseState;
|
|
|
15349
15391
|
// Check url mapping
|
|
15350
15392
|
var itemURL = item.url;
|
|
15351
15393
|
var url = this._virtualPathMap[itemURL] ? this._virtualPathMap[itemURL] : itemURL;
|
|
15394
|
+
// Not absolute and base url is set
|
|
15395
|
+
if (!Utils.isAbsoluteUrl(url) && this.baseUrl) url = Utils.resolveAbsoluteUrl(this.baseUrl, url);
|
|
15352
15396
|
// Parse url
|
|
15353
15397
|
var _this__parseURL = this._parseURL(url), assetBaseURL = _this__parseURL.assetBaseURL, queryPath = _this__parseURL.queryPath;
|
|
15354
15398
|
var paths = queryPath ? this._parseQueryPath(queryPath) : [];
|
|
@@ -15441,10 +15485,20 @@ var /** @internal */ PromiseState;
|
|
|
15441
15485
|
};
|
|
15442
15486
|
_proto._parseURL = function _parseURL(path) {
|
|
15443
15487
|
var _path_split = path.split("?"), baseUrl = _path_split[0], searchStr = _path_split[1];
|
|
15444
|
-
var
|
|
15445
|
-
var
|
|
15446
|
-
|
|
15447
|
-
|
|
15488
|
+
var queryPath = undefined;
|
|
15489
|
+
var assetBaseURL = baseUrl;
|
|
15490
|
+
if (searchStr) {
|
|
15491
|
+
var params = searchStr.split("&");
|
|
15492
|
+
for(var i = 0; i < params.length; i++){
|
|
15493
|
+
var param = params[i];
|
|
15494
|
+
if (param.startsWith("q=")) {
|
|
15495
|
+
queryPath = decodeURIComponent(param.split("=")[1]);
|
|
15496
|
+
params.splice(i, 1);
|
|
15497
|
+
break;
|
|
15498
|
+
}
|
|
15499
|
+
}
|
|
15500
|
+
assetBaseURL = params.length > 0 ? baseUrl + "?" + params.join("&") : baseUrl;
|
|
15501
|
+
}
|
|
15448
15502
|
return {
|
|
15449
15503
|
assetBaseURL: assetBaseURL,
|
|
15450
15504
|
queryPath: queryPath
|
|
@@ -16039,7 +16093,7 @@ SystemInfo._initialize();
|
|
|
16039
16093
|
* Keyboard Manager.
|
|
16040
16094
|
* @internal
|
|
16041
16095
|
*/ var KeyboardManager = /*#__PURE__*/ function() {
|
|
16042
|
-
function KeyboardManager(engine) {
|
|
16096
|
+
function KeyboardManager(engine, target) {
|
|
16043
16097
|
/** @internal */ this._curHeldDownKeyToIndexMap = [];
|
|
16044
16098
|
/** @internal */ this._upKeyToFrameCountMap = [];
|
|
16045
16099
|
/** @internal */ this._downKeyToFrameCountMap = [];
|
|
@@ -16047,17 +16101,11 @@ SystemInfo._initialize();
|
|
|
16047
16101
|
/** @internal */ this._curFrameDownList = new DisorderedArray();
|
|
16048
16102
|
/** @internal */ this._curFrameUpList = new DisorderedArray();
|
|
16049
16103
|
this._nativeEvents = [];
|
|
16050
|
-
this._hadListener = false;
|
|
16051
|
-
// @ts-ignore
|
|
16052
|
-
var htmlCanvas = engine._canvas._webCanvas;
|
|
16053
16104
|
this._engine = engine;
|
|
16054
|
-
this.
|
|
16055
|
-
// Need to set tabIndex to make the canvas focus.
|
|
16056
|
-
htmlCanvas.tabIndex = htmlCanvas.tabIndex;
|
|
16105
|
+
this._onBlur = this._onBlur.bind(this);
|
|
16057
16106
|
this._onKeyEvent = this._onKeyEvent.bind(this);
|
|
16058
|
-
|
|
16059
|
-
|
|
16060
|
-
this._hadListener = true;
|
|
16107
|
+
this._target = target;
|
|
16108
|
+
this._addEventListener();
|
|
16061
16109
|
}
|
|
16062
16110
|
var _proto = KeyboardManager.prototype;
|
|
16063
16111
|
/**
|
|
@@ -16109,35 +16157,8 @@ SystemInfo._initialize();
|
|
|
16109
16157
|
};
|
|
16110
16158
|
/**
|
|
16111
16159
|
* @internal
|
|
16112
|
-
*/ _proto._onFocus = function _onFocus() {
|
|
16113
|
-
if (!this._hadListener) {
|
|
16114
|
-
this._htmlCanvas.addEventListener("keydown", this._onKeyEvent);
|
|
16115
|
-
this._htmlCanvas.addEventListener("keyup", this._onKeyEvent);
|
|
16116
|
-
this._hadListener = true;
|
|
16117
|
-
}
|
|
16118
|
-
};
|
|
16119
|
-
/**
|
|
16120
|
-
* @internal
|
|
16121
|
-
*/ _proto._onBlur = function _onBlur() {
|
|
16122
|
-
if (this._hadListener) {
|
|
16123
|
-
this._htmlCanvas.removeEventListener("keydown", this._onKeyEvent);
|
|
16124
|
-
this._htmlCanvas.removeEventListener("keyup", this._onKeyEvent);
|
|
16125
|
-
this._curHeldDownKeyToIndexMap.length = 0;
|
|
16126
|
-
this._curFrameHeldDownList.length = 0;
|
|
16127
|
-
this._curFrameDownList.length = 0;
|
|
16128
|
-
this._curFrameUpList.length = 0;
|
|
16129
|
-
this._nativeEvents.length = 0;
|
|
16130
|
-
this._hadListener = false;
|
|
16131
|
-
}
|
|
16132
|
-
};
|
|
16133
|
-
/**
|
|
16134
|
-
* @internal
|
|
16135
16160
|
*/ _proto._destroy = function _destroy() {
|
|
16136
|
-
|
|
16137
|
-
this._htmlCanvas.removeEventListener("keydown", this._onKeyEvent);
|
|
16138
|
-
this._htmlCanvas.removeEventListener("keyup", this._onKeyEvent);
|
|
16139
|
-
this._hadListener = false;
|
|
16140
|
-
}
|
|
16161
|
+
this._removeEventListener();
|
|
16141
16162
|
this._curHeldDownKeyToIndexMap.length = 0;
|
|
16142
16163
|
this._curHeldDownKeyToIndexMap = null;
|
|
16143
16164
|
this._upKeyToFrameCountMap.length = 0;
|
|
@@ -16152,12 +16173,30 @@ SystemInfo._initialize();
|
|
|
16152
16173
|
this._curFrameDownList = null;
|
|
16153
16174
|
this._curFrameUpList.length = 0;
|
|
16154
16175
|
this._curFrameUpList = null;
|
|
16155
|
-
this._htmlCanvas = null;
|
|
16156
16176
|
this._engine = null;
|
|
16157
16177
|
};
|
|
16178
|
+
_proto._onBlur = function _onBlur() {
|
|
16179
|
+
this._curHeldDownKeyToIndexMap.length = 0;
|
|
16180
|
+
this._curFrameHeldDownList.length = 0;
|
|
16181
|
+
this._curFrameDownList.length = 0;
|
|
16182
|
+
this._curFrameUpList.length = 0;
|
|
16183
|
+
this._nativeEvents.length = 0;
|
|
16184
|
+
};
|
|
16158
16185
|
_proto._onKeyEvent = function _onKeyEvent(evt) {
|
|
16159
16186
|
this._nativeEvents.push(evt);
|
|
16160
16187
|
};
|
|
16188
|
+
_proto._addEventListener = function _addEventListener() {
|
|
16189
|
+
var _this = this, target = _this._target;
|
|
16190
|
+
target.addEventListener("keydown", this._onKeyEvent);
|
|
16191
|
+
target.addEventListener("keyup", this._onKeyEvent);
|
|
16192
|
+
target.addEventListener("blur", this._onBlur);
|
|
16193
|
+
};
|
|
16194
|
+
_proto._removeEventListener = function _removeEventListener() {
|
|
16195
|
+
var _this = this, target = _this._target;
|
|
16196
|
+
target.removeEventListener("keydown", this._onKeyEvent);
|
|
16197
|
+
target.removeEventListener("keyup", this._onKeyEvent);
|
|
16198
|
+
target.removeEventListener("blur", this._onBlur);
|
|
16199
|
+
};
|
|
16161
16200
|
return KeyboardManager;
|
|
16162
16201
|
}();
|
|
16163
16202
|
|
|
@@ -16460,7 +16499,9 @@ var Collision = function Collision() {
|
|
|
16460
16499
|
};
|
|
16461
16500
|
if (hitResult != undefined) {
|
|
16462
16501
|
var result = this._nativePhysicsScene.raycast(ray, distance, onRaycast, function(idx, distance, position, normal) {
|
|
16463
|
-
|
|
16502
|
+
var hitShape = _this._scene.engine._physicalObjectsMap[idx];
|
|
16503
|
+
hitResult.entity = hitShape._collider.entity;
|
|
16504
|
+
hitResult.shape = hitShape;
|
|
16464
16505
|
hitResult.distance = distance;
|
|
16465
16506
|
hitResult.normal.copyFrom(normal);
|
|
16466
16507
|
hitResult.point.copyFrom(position);
|
|
@@ -16469,6 +16510,7 @@ var Collision = function Collision() {
|
|
|
16469
16510
|
return true;
|
|
16470
16511
|
} else {
|
|
16471
16512
|
hitResult.entity = null;
|
|
16513
|
+
hitResult.shape = null;
|
|
16472
16514
|
hitResult.distance = 0;
|
|
16473
16515
|
hitResult.point.set(0, 0, 0);
|
|
16474
16516
|
hitResult.normal.set(0, 0, 0);
|
|
@@ -17130,6 +17172,7 @@ exports.DynamicColliderConstraints = void 0;
|
|
|
17130
17172
|
/** The distance from the ray's origin to the impact point. */ this.distance = 0;
|
|
17131
17173
|
/** The impact point in world space where the ray hit the collider. */ this.point = new engineMath.Vector3();
|
|
17132
17174
|
/** The normal of the surface the ray hit. */ this.normal = new engineMath.Vector3();
|
|
17175
|
+
/** The shape of the collider that was hit. */ this.shape = null;
|
|
17133
17176
|
};
|
|
17134
17177
|
|
|
17135
17178
|
/**
|
|
@@ -18121,7 +18164,7 @@ __decorate([
|
|
|
18121
18164
|
* Pointer Manager.
|
|
18122
18165
|
* @internal
|
|
18123
18166
|
*/ var PointerManager = /*#__PURE__*/ function() {
|
|
18124
|
-
function PointerManager(engine) {
|
|
18167
|
+
function PointerManager(engine, target) {
|
|
18125
18168
|
/** @internal */ this._pointers = [];
|
|
18126
18169
|
/** @internal */ this._multiPointerEnabled = true;
|
|
18127
18170
|
/** @internal */ this._buttons = exports.PointerButton.None;
|
|
@@ -18130,16 +18173,18 @@ __decorate([
|
|
|
18130
18173
|
/** @internal */ this._upList = new DisorderedArray();
|
|
18131
18174
|
/** @internal */ this._downList = new DisorderedArray();
|
|
18132
18175
|
this._nativeEvents = [];
|
|
18133
|
-
|
|
18134
|
-
|
|
18135
|
-
|
|
18176
|
+
if (_instanceof(target, Window)) {
|
|
18177
|
+
throw "Do not set window as target because window cannot listen to pointer leave event.";
|
|
18178
|
+
}
|
|
18136
18179
|
this._engine = engine;
|
|
18180
|
+
this._target = target;
|
|
18137
18181
|
this._canvas = engine.canvas;
|
|
18138
|
-
|
|
18139
|
-
this.
|
|
18140
|
-
this._onFocus();
|
|
18182
|
+
// @ts-ignore
|
|
18183
|
+
this._htmlCanvas = engine._canvas._webCanvas;
|
|
18141
18184
|
// If there are no compatibility issues, navigator.maxTouchPoints should be used here
|
|
18142
18185
|
this._pointerPool = new Array(11);
|
|
18186
|
+
this._onPointerEvent = this._onPointerEvent.bind(this);
|
|
18187
|
+
this._addEventListener();
|
|
18143
18188
|
}
|
|
18144
18189
|
var _proto = PointerManager.prototype;
|
|
18145
18190
|
/**
|
|
@@ -18209,7 +18254,8 @@ __decorate([
|
|
|
18209
18254
|
var length = events.length;
|
|
18210
18255
|
if (length > 0) {
|
|
18211
18256
|
for(var i1 = 0; i1 < length; i1++){
|
|
18212
|
-
|
|
18257
|
+
var event = events[i1];
|
|
18258
|
+
switch(event.type){
|
|
18213
18259
|
case "pointerdown":
|
|
18214
18260
|
pointer.phase = exports.PointerPhase.Down;
|
|
18215
18261
|
pointer._firePointerDown(rayCastEntity);
|
|
@@ -18231,66 +18277,14 @@ __decorate([
|
|
|
18231
18277
|
};
|
|
18232
18278
|
/**
|
|
18233
18279
|
* @internal
|
|
18234
|
-
*/ _proto._onFocus = function _onFocus() {
|
|
18235
|
-
if (!this._hadListener) {
|
|
18236
|
-
var _this = this, htmlCanvas = _this._htmlCanvas, onPointerEvent = _this._onPointerEvent;
|
|
18237
|
-
htmlCanvas.addEventListener("pointerdown", onPointerEvent);
|
|
18238
|
-
htmlCanvas.addEventListener("pointerup", onPointerEvent);
|
|
18239
|
-
htmlCanvas.addEventListener("pointerleave", onPointerEvent);
|
|
18240
|
-
htmlCanvas.addEventListener("pointermove", onPointerEvent);
|
|
18241
|
-
htmlCanvas.addEventListener("pointercancel", onPointerEvent);
|
|
18242
|
-
this._hadListener = true;
|
|
18243
|
-
}
|
|
18244
|
-
};
|
|
18245
|
-
/**
|
|
18246
|
-
* @internal
|
|
18247
|
-
*/ _proto._onBlur = function _onBlur() {
|
|
18248
|
-
if (this._hadListener) {
|
|
18249
|
-
var _this = this, htmlCanvas = _this._htmlCanvas, onPointerEvent = _this._onPointerEvent;
|
|
18250
|
-
htmlCanvas.removeEventListener("pointerdown", onPointerEvent);
|
|
18251
|
-
htmlCanvas.removeEventListener("pointerup", onPointerEvent);
|
|
18252
|
-
htmlCanvas.removeEventListener("pointerleave", onPointerEvent);
|
|
18253
|
-
htmlCanvas.removeEventListener("pointermove", onPointerEvent);
|
|
18254
|
-
htmlCanvas.removeEventListener("pointercancel", onPointerEvent);
|
|
18255
|
-
this._hadListener = false;
|
|
18256
|
-
this._pointers.length = 0;
|
|
18257
|
-
this._downList.length = 0;
|
|
18258
|
-
this._upList.length = 0;
|
|
18259
|
-
}
|
|
18260
|
-
};
|
|
18261
|
-
/**
|
|
18262
|
-
* @internal
|
|
18263
18280
|
*/ _proto._destroy = function _destroy() {
|
|
18264
|
-
|
|
18265
|
-
if (this._hadListener) {
|
|
18266
|
-
var _this = this, htmlCanvas = _this._htmlCanvas, onPointerEvent = _this._onPointerEvent;
|
|
18267
|
-
htmlCanvas.removeEventListener("pointerdown", onPointerEvent);
|
|
18268
|
-
htmlCanvas.removeEventListener("pointerup", onPointerEvent);
|
|
18269
|
-
htmlCanvas.removeEventListener("pointerleave", onPointerEvent);
|
|
18270
|
-
htmlCanvas.removeEventListener("pointermove", onPointerEvent);
|
|
18271
|
-
htmlCanvas.removeEventListener("pointercancel", onPointerEvent);
|
|
18272
|
-
this._hadListener = false;
|
|
18273
|
-
}
|
|
18281
|
+
this._removeEventListener();
|
|
18274
18282
|
this._pointerPool.length = 0;
|
|
18275
|
-
this._pointerPool = null;
|
|
18276
|
-
this._pointers.length = 0;
|
|
18277
|
-
this._pointers = null;
|
|
18278
|
-
this._downList.length = 0;
|
|
18279
|
-
this._downList = null;
|
|
18280
|
-
this._upList.length = 0;
|
|
18281
|
-
this._upList = null;
|
|
18282
18283
|
this._nativeEvents.length = 0;
|
|
18283
|
-
this._nativeEvents = null;
|
|
18284
|
-
this._upMap.length = 0;
|
|
18285
|
-
this._upMap = null;
|
|
18286
18284
|
this._downMap.length = 0;
|
|
18287
|
-
this.
|
|
18288
|
-
this._htmlCanvas = null;
|
|
18289
|
-
this._canvas = null;
|
|
18290
|
-
this._engine = null;
|
|
18285
|
+
this._upMap.length = 0;
|
|
18291
18286
|
};
|
|
18292
18287
|
_proto._onPointerEvent = function _onPointerEvent(evt) {
|
|
18293
|
-
evt.type === "pointerdown" && this._htmlCanvas.focus();
|
|
18294
18288
|
this._nativeEvents.push(evt);
|
|
18295
18289
|
};
|
|
18296
18290
|
_proto._getPointerByID = function _getPointerByID(pointerId) {
|
|
@@ -18373,6 +18367,26 @@ __decorate([
|
|
|
18373
18367
|
}
|
|
18374
18368
|
return null;
|
|
18375
18369
|
};
|
|
18370
|
+
_proto._addEventListener = function _addEventListener() {
|
|
18371
|
+
var _this = this, target = _this._target, onPointerEvent = _this._onPointerEvent;
|
|
18372
|
+
target.addEventListener("pointerdown", onPointerEvent);
|
|
18373
|
+
target.addEventListener("pointerup", onPointerEvent);
|
|
18374
|
+
target.addEventListener("pointerleave", onPointerEvent);
|
|
18375
|
+
target.addEventListener("pointermove", onPointerEvent);
|
|
18376
|
+
target.addEventListener("pointercancel", onPointerEvent);
|
|
18377
|
+
};
|
|
18378
|
+
_proto._removeEventListener = function _removeEventListener() {
|
|
18379
|
+
var _this = this, target = _this._target, onPointerEvent = _this._onPointerEvent;
|
|
18380
|
+
target.removeEventListener("pointerdown", onPointerEvent);
|
|
18381
|
+
target.removeEventListener("pointerup", onPointerEvent);
|
|
18382
|
+
target.removeEventListener("pointerleave", onPointerEvent);
|
|
18383
|
+
target.removeEventListener("pointermove", onPointerEvent);
|
|
18384
|
+
target.removeEventListener("pointercancel", onPointerEvent);
|
|
18385
|
+
this._nativeEvents.length = 0;
|
|
18386
|
+
this._pointers.length = 0;
|
|
18387
|
+
this._downList.length = 0;
|
|
18388
|
+
this._upList.length = 0;
|
|
18389
|
+
};
|
|
18376
18390
|
return PointerManager;
|
|
18377
18391
|
}();
|
|
18378
18392
|
(function() {
|
|
@@ -18389,15 +18403,12 @@ __decorate([
|
|
|
18389
18403
|
* Wheel Manager.
|
|
18390
18404
|
* @internal
|
|
18391
18405
|
*/ var WheelManager = /*#__PURE__*/ function() {
|
|
18392
|
-
function WheelManager(engine) {
|
|
18406
|
+
function WheelManager(engine, target) {
|
|
18393
18407
|
/** @internal */ this._delta = new engineMath.Vector3();
|
|
18394
18408
|
this._nativeEvents = [];
|
|
18395
|
-
// @ts-ignore
|
|
18396
|
-
var htmlCanvas = engine._canvas._webCanvas;
|
|
18397
18409
|
this._onWheelEvent = this._onWheelEvent.bind(this);
|
|
18398
|
-
|
|
18399
|
-
this.
|
|
18400
|
-
this._hadListener = true;
|
|
18410
|
+
this._target = target;
|
|
18411
|
+
this._addEventListener();
|
|
18401
18412
|
}
|
|
18402
18413
|
var _proto = WheelManager.prototype;
|
|
18403
18414
|
/**
|
|
@@ -18418,35 +18429,24 @@ __decorate([
|
|
|
18418
18429
|
};
|
|
18419
18430
|
/**
|
|
18420
18431
|
* @internal
|
|
18421
|
-
*/ _proto.
|
|
18422
|
-
|
|
18423
|
-
this._canvas.addEventListener("wheel", this._onWheelEvent);
|
|
18424
|
-
this._hadListener = true;
|
|
18425
|
-
}
|
|
18432
|
+
*/ _proto._addEventListener = function _addEventListener() {
|
|
18433
|
+
this._target.addEventListener("wheel", this._onWheelEvent);
|
|
18426
18434
|
};
|
|
18427
18435
|
/**
|
|
18428
18436
|
* @internal
|
|
18429
|
-
*/ _proto.
|
|
18430
|
-
|
|
18431
|
-
|
|
18432
|
-
|
|
18433
|
-
this._delta.set(0, 0, 0);
|
|
18434
|
-
this._hadListener = false;
|
|
18435
|
-
}
|
|
18437
|
+
*/ _proto._removeEventListener = function _removeEventListener() {
|
|
18438
|
+
this._target.removeEventListener("wheel", this._onWheelEvent);
|
|
18439
|
+
this._nativeEvents.length = 0;
|
|
18440
|
+
this._delta.set(0, 0, 0);
|
|
18436
18441
|
};
|
|
18437
18442
|
/**
|
|
18438
18443
|
* @internal
|
|
18439
18444
|
*/ _proto._destroy = function _destroy() {
|
|
18440
|
-
|
|
18441
|
-
this._canvas.removeEventListener("wheel", this._onWheelEvent);
|
|
18442
|
-
this._hadListener = false;
|
|
18443
|
-
}
|
|
18445
|
+
this._removeEventListener();
|
|
18444
18446
|
this._nativeEvents = null;
|
|
18445
|
-
this._canvas = null;
|
|
18446
18447
|
this._delta = null;
|
|
18447
18448
|
};
|
|
18448
18449
|
_proto._onWheelEvent = function _onWheelEvent(evt) {
|
|
18449
|
-
evt.cancelable && evt.preventDefault();
|
|
18450
18450
|
this._nativeEvents.push(evt);
|
|
18451
18451
|
};
|
|
18452
18452
|
return WheelManager;
|
|
@@ -18455,19 +18455,19 @@ __decorate([
|
|
|
18455
18455
|
/**
|
|
18456
18456
|
* InputManager manages device input such as mouse, touch, keyboard, etc.
|
|
18457
18457
|
*/ var InputManager = /*#__PURE__*/ function() {
|
|
18458
|
-
function InputManager(engine) {
|
|
18458
|
+
function InputManager(engine, inputOptions) {
|
|
18459
18459
|
/** Sometimes the input module will not be initialized, such as off-screen rendering. */ this._initialized = false;
|
|
18460
18460
|
this._engine = engine;
|
|
18461
18461
|
// @ts-ignore
|
|
18462
18462
|
var canvas = engine._canvas._webCanvas;
|
|
18463
18463
|
if (typeof OffscreenCanvas === "undefined" || !_instanceof(canvas, OffscreenCanvas)) {
|
|
18464
|
-
|
|
18465
|
-
|
|
18466
|
-
this.
|
|
18467
|
-
|
|
18468
|
-
|
|
18469
|
-
|
|
18470
|
-
|
|
18464
|
+
var _inputOptions, _inputOptions1, _inputOptions2;
|
|
18465
|
+
var _inputOptions_wheelTarget;
|
|
18466
|
+
this._wheelManager = new WheelManager(engine, (_inputOptions_wheelTarget = (_inputOptions = inputOptions) == null ? void 0 : _inputOptions.wheelTarget) != null ? _inputOptions_wheelTarget : canvas);
|
|
18467
|
+
var _inputOptions_pointerTarget;
|
|
18468
|
+
this._pointerManager = new PointerManager(engine, (_inputOptions_pointerTarget = (_inputOptions1 = inputOptions) == null ? void 0 : _inputOptions1.pointerTarget) != null ? _inputOptions_pointerTarget : canvas);
|
|
18469
|
+
var _inputOptions_keyboardTarget;
|
|
18470
|
+
this._keyboardManager = new KeyboardManager(engine, (_inputOptions_keyboardTarget = (_inputOptions2 = inputOptions) == null ? void 0 : _inputOptions2.keyboardTarget) != null ? _inputOptions_keyboardTarget : window);
|
|
18471
18471
|
this._initialized = true;
|
|
18472
18472
|
}
|
|
18473
18473
|
}
|
|
@@ -18580,8 +18580,6 @@ __decorate([
|
|
|
18580
18580
|
* @internal
|
|
18581
18581
|
*/ _proto._destroy = function _destroy() {
|
|
18582
18582
|
if (this._initialized) {
|
|
18583
|
-
window.removeEventListener("blur", this._onBlur);
|
|
18584
|
-
window.removeEventListener("focus", this._onFocus);
|
|
18585
18583
|
this._wheelManager._destroy();
|
|
18586
18584
|
this._wheelManager = null;
|
|
18587
18585
|
this._pointerManager._destroy();
|
|
@@ -18590,16 +18588,6 @@ __decorate([
|
|
|
18590
18588
|
this._keyboardManager = null;
|
|
18591
18589
|
}
|
|
18592
18590
|
};
|
|
18593
|
-
_proto._onBlur = function _onBlur() {
|
|
18594
|
-
this._wheelManager._onBlur();
|
|
18595
|
-
this._pointerManager._onBlur();
|
|
18596
|
-
this._keyboardManager._onBlur();
|
|
18597
|
-
};
|
|
18598
|
-
_proto._onFocus = function _onFocus() {
|
|
18599
|
-
this._wheelManager._onFocus();
|
|
18600
|
-
this._pointerManager._onFocus();
|
|
18601
|
-
this._keyboardManager._onFocus();
|
|
18602
|
-
};
|
|
18603
18591
|
_create_class(InputManager, [
|
|
18604
18592
|
{
|
|
18605
18593
|
key: "pointers",
|
|
@@ -18978,8 +18966,9 @@ var unlitVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\n#in
|
|
|
18978
18966
|
}
|
|
18979
18967
|
return;
|
|
18980
18968
|
}
|
|
18969
|
+
++hierarchy;
|
|
18981
18970
|
for(var k1 in cacheMap){
|
|
18982
|
-
this._recursiveDestroy(
|
|
18971
|
+
this._recursiveDestroy(hierarchy, cacheMap[k1]);
|
|
18983
18972
|
}
|
|
18984
18973
|
};
|
|
18985
18974
|
_proto._resizeCacheMapHierarchy = function _resizeCacheMapHierarchy(cacheMap, hierarchy, currentHierarchy, increaseHierarchy) {
|
|
@@ -19097,7 +19086,7 @@ ShaderPool.init();
|
|
|
19097
19086
|
_this._spriteMaskDefaultMaterial = _this._createSpriteMaskMaterial();
|
|
19098
19087
|
_this._textDefaultFont = Font.createFromOS(_assert_this_initialized(_this), "Arial");
|
|
19099
19088
|
_this._textDefaultFont.isGCIgnored = true;
|
|
19100
|
-
_this.inputManager = new InputManager(_assert_this_initialized(_this));
|
|
19089
|
+
_this.inputManager = new InputManager(_assert_this_initialized(_this), configuration.input);
|
|
19101
19090
|
var xrDevice = configuration.xrDevice;
|
|
19102
19091
|
if (xrDevice) {
|
|
19103
19092
|
_this.xrManager = new XRManager();
|
|
@@ -19391,6 +19380,26 @@ ShaderPool.init();
|
|
|
19391
19380
|
this._magentaTexture2D = magentaTexture2D;
|
|
19392
19381
|
this._magentaTextureCube = magentaTextureCube;
|
|
19393
19382
|
if (hardwareRenderer.isWebGL2) {
|
|
19383
|
+
var magentaPixel32 = new Uint32Array([
|
|
19384
|
+
255,
|
|
19385
|
+
0,
|
|
19386
|
+
255,
|
|
19387
|
+
255
|
|
19388
|
+
]);
|
|
19389
|
+
var uintMagentaTexture2D = new Texture2D(this, 1, 1, exports.TextureFormat.R32G32B32A32_UInt, false);
|
|
19390
|
+
uintMagentaTexture2D.setPixelBuffer(magentaPixel32);
|
|
19391
|
+
uintMagentaTexture2D.isGCIgnored = true;
|
|
19392
|
+
this.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
|
|
19393
|
+
_inherits(_class, ContentRestorer);
|
|
19394
|
+
function _class() {
|
|
19395
|
+
return ContentRestorer.call(this, uintMagentaTexture2D);
|
|
19396
|
+
}
|
|
19397
|
+
var _proto = _class.prototype;
|
|
19398
|
+
_proto.restoreContent = function restoreContent() {
|
|
19399
|
+
this.resource.setPixelBuffer(magentaPixel32);
|
|
19400
|
+
};
|
|
19401
|
+
return _class;
|
|
19402
|
+
}(ContentRestorer))());
|
|
19394
19403
|
var magentaTexture2DArray = new Texture2DArray(this, 1, 1, 1, exports.TextureFormat.R8G8B8A8, false);
|
|
19395
19404
|
magentaTexture2DArray.setPixelBuffer(0, magentaPixel);
|
|
19396
19405
|
magentaTexture2DArray.isGCIgnored = true;
|
|
@@ -19405,6 +19414,7 @@ ShaderPool.init();
|
|
|
19405
19414
|
};
|
|
19406
19415
|
return _class;
|
|
19407
19416
|
}(ContentRestorer))());
|
|
19417
|
+
this._uintMagentaTexture2D = uintMagentaTexture2D;
|
|
19408
19418
|
this._magentaTexture2DArray = magentaTexture2DArray;
|
|
19409
19419
|
}
|
|
19410
19420
|
};
|
|
@@ -19637,8 +19647,8 @@ ShaderPool.init();
|
|
|
19637
19647
|
set: function set(value) {
|
|
19638
19648
|
if (this._width !== value) {
|
|
19639
19649
|
this._width = value;
|
|
19650
|
+
this._onWidthChanged(value);
|
|
19640
19651
|
this._sizeUpdateFlagManager.dispatch();
|
|
19641
|
-
this._onSizeChanged(value, this._width);
|
|
19642
19652
|
}
|
|
19643
19653
|
}
|
|
19644
19654
|
},
|
|
@@ -19652,8 +19662,8 @@ ShaderPool.init();
|
|
|
19652
19662
|
set: function set(value) {
|
|
19653
19663
|
if (this._height !== value) {
|
|
19654
19664
|
this._height = value;
|
|
19665
|
+
this._onHeightChange(value);
|
|
19655
19666
|
this._sizeUpdateFlagManager.dispatch();
|
|
19656
|
-
this._onSizeChanged(this._width, value);
|
|
19657
19667
|
}
|
|
19658
19668
|
}
|
|
19659
19669
|
}
|
|
@@ -21008,6 +21018,10 @@ __decorate([
|
|
|
21008
21018
|
/** The splits of two cascade distribution. */ _this.shadowTwoCascadeSplits = 1.0 / 3.0;
|
|
21009
21019
|
/** The splits of four cascade distribution. */ _this.shadowFourCascadeSplits = new engineMath.Vector3(1.0 / 15, 3.0 / 15.0, 7.0 / 15.0);
|
|
21010
21020
|
/** Max Shadow distance. */ _this.shadowDistance = 50;
|
|
21021
|
+
/**
|
|
21022
|
+
* Last shadow fade distance in percentage, range [0,1].
|
|
21023
|
+
* @remarks Value 0 is used for no shadow fade.
|
|
21024
|
+
*/ _this.shadowFadeBorder = 0.1;
|
|
21011
21025
|
/* @internal */ _this._lightManager = new LightManager();
|
|
21012
21026
|
/* @internal */ _this._componentsManager = new ComponentsManager();
|
|
21013
21027
|
/** @internal */ _this._isActiveInEngine = false;
|
|
@@ -21632,47 +21646,66 @@ __decorate([
|
|
|
21632
21646
|
DepthTextureMode[DepthTextureMode[/* Generate depth texture by pre-pass rendering. */ "PrePass"] = 1] = "PrePass";
|
|
21633
21647
|
})(exports.DepthTextureMode || (exports.DepthTextureMode = {}));
|
|
21634
21648
|
|
|
21635
|
-
var passNum = 0;
|
|
21636
21649
|
/**
|
|
21637
|
-
*
|
|
21638
|
-
*/ var
|
|
21639
|
-
|
|
21640
|
-
|
|
21641
|
-
|
|
21642
|
-
|
|
21643
|
-
|
|
21644
|
-
|
|
21645
|
-
|
|
21646
|
-
this.enabled = true;
|
|
21647
|
-
this.priority = priority;
|
|
21648
|
-
this.renderTarget = renderTarget;
|
|
21649
|
-
this.replaceMaterial = replaceMaterial;
|
|
21650
|
-
this.mask = mask || exports.Layer.Everything;
|
|
21651
|
-
this.renderOverride = false; // If renderOverride is set to true, you need to implement the render method
|
|
21652
|
-
}
|
|
21653
|
-
var _proto = RenderPass.prototype;
|
|
21654
|
-
/**
|
|
21655
|
-
* Rendering callback, will be executed if renderOverride is set to true.
|
|
21656
|
-
* @param camera - Camera
|
|
21657
|
-
* @param opaqueQueue - Opaque queue
|
|
21658
|
-
* @param alphaTestQueue - Alpha test queue
|
|
21659
|
-
* @param transparentQueue - Transparent queue
|
|
21660
|
-
*/ _proto.render = function render(camera, opaqueQueue, alphaTestQueue, transparentQueue) {};
|
|
21650
|
+
* PipelinePass is a base class for all pipeline passes.
|
|
21651
|
+
*/ var PipelinePass = function PipelinePass(engine) {
|
|
21652
|
+
this._engine = engine;
|
|
21653
|
+
};
|
|
21654
|
+
|
|
21655
|
+
/**
|
|
21656
|
+
* @internal
|
|
21657
|
+
*/ var PipelineUtils = /*#__PURE__*/ function() {
|
|
21658
|
+
function PipelineUtils() {}
|
|
21661
21659
|
/**
|
|
21662
|
-
*
|
|
21663
|
-
* @param
|
|
21664
|
-
* @param
|
|
21665
|
-
* @param
|
|
21666
|
-
* @param
|
|
21667
|
-
|
|
21660
|
+
* Recreate texture if needed.
|
|
21661
|
+
* @param engine - Engine
|
|
21662
|
+
* @param currentTexture - Current texture
|
|
21663
|
+
* @param width - Need texture width
|
|
21664
|
+
* @param height - Need texture height
|
|
21665
|
+
* @param format - Need texture format
|
|
21666
|
+
* @param mipmap - Need texture mipmap
|
|
21667
|
+
* @returns Texture
|
|
21668
|
+
*/ PipelineUtils.recreateTextureIfNeeded = function recreateTextureIfNeeded(engine, currentTexture, width, height, format, mipmap) {
|
|
21669
|
+
if (currentTexture) {
|
|
21670
|
+
if (currentTexture.width !== width || currentTexture.height !== height || currentTexture.format !== format || currentTexture.mipmapCount > 1 !== mipmap) {
|
|
21671
|
+
currentTexture.destroy();
|
|
21672
|
+
var texture = new Texture2D(engine, width, height, format, mipmap);
|
|
21673
|
+
texture.isGCIgnored = true;
|
|
21674
|
+
return texture;
|
|
21675
|
+
} else {
|
|
21676
|
+
return currentTexture;
|
|
21677
|
+
}
|
|
21678
|
+
} else {
|
|
21679
|
+
var texture1 = new Texture2D(engine, width, height, format, mipmap);
|
|
21680
|
+
texture1.isGCIgnored = true;
|
|
21681
|
+
return texture1;
|
|
21682
|
+
}
|
|
21683
|
+
};
|
|
21668
21684
|
/**
|
|
21669
|
-
*
|
|
21670
|
-
* @param
|
|
21671
|
-
* @param
|
|
21672
|
-
* @param
|
|
21673
|
-
* @param
|
|
21674
|
-
|
|
21675
|
-
|
|
21685
|
+
* Recreate render target if needed.
|
|
21686
|
+
* @param engine - Engine
|
|
21687
|
+
* @param currentRenderTarget - Current render target
|
|
21688
|
+
* @param width - Need render target width
|
|
21689
|
+
* @param height - Need render target height
|
|
21690
|
+
* @param colorFormat - Need render target color format
|
|
21691
|
+
* @param depthFormat - Need render target depth format
|
|
21692
|
+
* @param mipmap - Need render target mipmap
|
|
21693
|
+
* @returns Render target
|
|
21694
|
+
*/ PipelineUtils.recreateRenderTargetIfNeeded = function recreateRenderTargetIfNeeded(engine, currentRenderTarget, width, height, colorFormat, depthFormat, mipmap) {
|
|
21695
|
+
var _currentRenderTarget, _currentRenderTarget1;
|
|
21696
|
+
var currentColorTexture = (_currentRenderTarget = currentRenderTarget) == null ? void 0 : _currentRenderTarget.getColorTexture(0);
|
|
21697
|
+
var currentDepthTexture = (_currentRenderTarget1 = currentRenderTarget) == null ? void 0 : _currentRenderTarget1.depthTexture;
|
|
21698
|
+
var colorTexture = colorFormat ? PipelineUtils.recreateTextureIfNeeded(engine, currentColorTexture, width, height, colorFormat, mipmap) : null;
|
|
21699
|
+
var depthTexture = depthFormat ? PipelineUtils.recreateTextureIfNeeded(engine, currentDepthTexture, width, height, depthFormat, mipmap) : null;
|
|
21700
|
+
if (currentColorTexture !== colorTexture || currentDepthTexture !== depthTexture) {
|
|
21701
|
+
var _currentRenderTarget2;
|
|
21702
|
+
(_currentRenderTarget2 = currentRenderTarget) == null ? void 0 : _currentRenderTarget2.destroy();
|
|
21703
|
+
currentRenderTarget = new RenderTarget(engine, width, height, colorTexture, depthTexture);
|
|
21704
|
+
currentRenderTarget.isGCIgnored = true;
|
|
21705
|
+
}
|
|
21706
|
+
return currentRenderTarget;
|
|
21707
|
+
};
|
|
21708
|
+
return PipelineUtils;
|
|
21676
21709
|
}();
|
|
21677
21710
|
|
|
21678
21711
|
/**
|
|
@@ -21943,9 +21976,14 @@ var passNum = 0;
|
|
|
21943
21976
|
}
|
|
21944
21977
|
// make suer from the same renderer.
|
|
21945
21978
|
if (componentA.instanceId === componentB.instanceId) {
|
|
21946
|
-
return dataA.material._priority - dataB.material._priority
|
|
21979
|
+
return dataA.material._priority - dataB.material._priority;
|
|
21947
21980
|
} else {
|
|
21948
|
-
|
|
21981
|
+
var distanceDiff = componentA._distanceForSort - componentB._distanceForSort;
|
|
21982
|
+
if (distanceDiff === 0) {
|
|
21983
|
+
return componentA.instanceId - componentB.instanceId;
|
|
21984
|
+
} else {
|
|
21985
|
+
return distanceDiff;
|
|
21986
|
+
}
|
|
21949
21987
|
}
|
|
21950
21988
|
};
|
|
21951
21989
|
/**
|
|
@@ -21961,68 +21999,60 @@ var passNum = 0;
|
|
|
21961
21999
|
}
|
|
21962
22000
|
// make suer from the same renderer.
|
|
21963
22001
|
if (componentA.instanceId === componentB.instanceId) {
|
|
21964
|
-
return dataA.material._priority - dataB.material._priority
|
|
22002
|
+
return dataA.material._priority - dataB.material._priority;
|
|
21965
22003
|
} else {
|
|
21966
|
-
|
|
22004
|
+
var distanceDiff = componentB._distanceForSort - componentA._distanceForSort;
|
|
22005
|
+
if (distanceDiff === 0) {
|
|
22006
|
+
return componentA.instanceId - componentB.instanceId;
|
|
22007
|
+
} else {
|
|
22008
|
+
return distanceDiff;
|
|
22009
|
+
}
|
|
21967
22010
|
}
|
|
21968
22011
|
};
|
|
21969
22012
|
return RenderQueue;
|
|
21970
22013
|
}();
|
|
21971
22014
|
|
|
22015
|
+
var passNum = 0;
|
|
21972
22016
|
/**
|
|
21973
|
-
*
|
|
21974
|
-
*/ var
|
|
21975
|
-
function
|
|
22017
|
+
* RenderPass.
|
|
22018
|
+
*/ var RenderPass = /*#__PURE__*/ function() {
|
|
22019
|
+
function RenderPass(name, priority, renderTarget, replaceMaterial, mask) {
|
|
22020
|
+
if (name === void 0) name = "RENDER_PASS" + passNum++;
|
|
22021
|
+
if (priority === void 0) priority = 0;
|
|
22022
|
+
if (renderTarget === void 0) renderTarget = null;
|
|
22023
|
+
if (replaceMaterial === void 0) replaceMaterial = null;
|
|
22024
|
+
if (mask === void 0) mask = null;
|
|
22025
|
+
this.name = name;
|
|
22026
|
+
this.enabled = true;
|
|
22027
|
+
this.priority = priority;
|
|
22028
|
+
this.renderTarget = renderTarget;
|
|
22029
|
+
this.replaceMaterial = replaceMaterial;
|
|
22030
|
+
this.mask = mask || exports.Layer.Everything;
|
|
22031
|
+
this.renderOverride = false; // If renderOverride is set to true, you need to implement the render method
|
|
22032
|
+
}
|
|
22033
|
+
var _proto = RenderPass.prototype;
|
|
21976
22034
|
/**
|
|
21977
|
-
*
|
|
21978
|
-
* @param
|
|
21979
|
-
* @param
|
|
21980
|
-
* @param
|
|
21981
|
-
* @param
|
|
21982
|
-
|
|
21983
|
-
* @param mipmap - Need texture mipmap
|
|
21984
|
-
* @returns Texture
|
|
21985
|
-
*/ PipelineUtils.recreateTextureIfNeeded = function recreateTextureIfNeeded(engine, currentTexture, width, height, format, mipmap) {
|
|
21986
|
-
if (currentTexture) {
|
|
21987
|
-
if (currentTexture.width !== width || currentTexture.height !== height || currentTexture.format !== format || currentTexture.mipmapCount > 1 !== mipmap) {
|
|
21988
|
-
currentTexture.destroy();
|
|
21989
|
-
var texture = new Texture2D(engine, width, height, format, mipmap);
|
|
21990
|
-
texture.isGCIgnored = true;
|
|
21991
|
-
return texture;
|
|
21992
|
-
} else {
|
|
21993
|
-
return currentTexture;
|
|
21994
|
-
}
|
|
21995
|
-
} else {
|
|
21996
|
-
var texture1 = new Texture2D(engine, width, height, format, mipmap);
|
|
21997
|
-
texture1.isGCIgnored = true;
|
|
21998
|
-
return texture1;
|
|
21999
|
-
}
|
|
22000
|
-
};
|
|
22035
|
+
* Rendering callback, will be executed if renderOverride is set to true.
|
|
22036
|
+
* @param camera - Camera
|
|
22037
|
+
* @param opaqueQueue - Opaque queue
|
|
22038
|
+
* @param alphaTestQueue - Alpha test queue
|
|
22039
|
+
* @param transparentQueue - Transparent queue
|
|
22040
|
+
*/ _proto.render = function render(camera, opaqueQueue, alphaTestQueue, transparentQueue) {};
|
|
22001
22041
|
/**
|
|
22002
|
-
*
|
|
22003
|
-
* @param
|
|
22004
|
-
* @param
|
|
22005
|
-
* @param
|
|
22006
|
-
* @param
|
|
22007
|
-
|
|
22008
|
-
|
|
22009
|
-
*
|
|
22010
|
-
* @
|
|
22011
|
-
|
|
22012
|
-
|
|
22013
|
-
|
|
22014
|
-
|
|
22015
|
-
|
|
22016
|
-
var depthTexture = depthFormat ? PipelineUtils.recreateTextureIfNeeded(engine, currentDepthTexture, width, height, depthFormat, mipmap) : null;
|
|
22017
|
-
if (currentColorTexture !== colorTexture || currentDepthTexture !== depthTexture) {
|
|
22018
|
-
var _currentRenderTarget2;
|
|
22019
|
-
(_currentRenderTarget2 = currentRenderTarget) == null ? void 0 : _currentRenderTarget2.destroy();
|
|
22020
|
-
currentRenderTarget = new RenderTarget(engine, width, height, colorTexture, depthTexture);
|
|
22021
|
-
currentRenderTarget.isGCIgnored = true;
|
|
22022
|
-
}
|
|
22023
|
-
return currentRenderTarget;
|
|
22024
|
-
};
|
|
22025
|
-
return PipelineUtils;
|
|
22042
|
+
* Post rendering callback.
|
|
22043
|
+
* @param camera - Camera
|
|
22044
|
+
* @param opaqueQueue - Opaque queue
|
|
22045
|
+
* @param alphaTestQueue - Alpha test queue
|
|
22046
|
+
* @param transparentQueue - Transparent queue
|
|
22047
|
+
*/ _proto.preRender = function preRender(camera, opaqueQueue, alphaTestQueue, transparentQueue) {};
|
|
22048
|
+
/**
|
|
22049
|
+
* Post rendering callback.
|
|
22050
|
+
* @param camera - Camera
|
|
22051
|
+
* @param opaqueQueue - Opaque queue
|
|
22052
|
+
* @param alphaTestQueue - Alpha test queue
|
|
22053
|
+
* @param transparentQueue - Transparent queue
|
|
22054
|
+
*/ _proto.postRender = function postRender(camera, opaqueQueue, alphaTestQueue, transparentQueue) {};
|
|
22055
|
+
return RenderPass;
|
|
22026
22056
|
}();
|
|
22027
22057
|
|
|
22028
22058
|
/**
|
|
@@ -22290,6 +22320,26 @@ var /**
|
|
|
22290
22320
|
var offset = cascadeIndex * 16;
|
|
22291
22321
|
Utils._floatMatrixMultiply(sliceMatrix, outShadowMatrices, offset, outShadowMatrices, offset);
|
|
22292
22322
|
};
|
|
22323
|
+
/**
|
|
22324
|
+
* Extract scale and bias from a fade distance to achieve a linear fading of the fade distance.
|
|
22325
|
+
*/ ShadowUtils.getScaleAndBiasForLinearDistanceFade = function getScaleAndBiasForLinearDistanceFade(fadeDistance, border, outInfo) {
|
|
22326
|
+
// (P^2-N^2)/(F^2-N^2)
|
|
22327
|
+
// To avoid division from zero
|
|
22328
|
+
// This values ensure that fade within cascade will be 0 and outside 1
|
|
22329
|
+
if (border < 0.0001) {
|
|
22330
|
+
var multiplier = 1000; // To avoid blending if difference is in fractions
|
|
22331
|
+
outInfo.z = multiplier;
|
|
22332
|
+
outInfo.w = -fadeDistance * multiplier;
|
|
22333
|
+
return;
|
|
22334
|
+
}
|
|
22335
|
+
border = 1 - border;
|
|
22336
|
+
border *= border;
|
|
22337
|
+
// 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.
|
|
22338
|
+
var distanceFadeNear = border * fadeDistance;
|
|
22339
|
+
var fadeRange = fadeDistance - distanceFadeNear;
|
|
22340
|
+
outInfo.z = 1.0 / fadeRange;
|
|
22341
|
+
outInfo.w = -distanceFadeNear / fadeRange;
|
|
22342
|
+
};
|
|
22293
22343
|
return ShadowUtils;
|
|
22294
22344
|
}();
|
|
22295
22345
|
(function() {
|
|
@@ -22534,12 +22584,6 @@ var /**
|
|
|
22534
22584
|
ShadowUtils.atlasBorderSize = 4.0;
|
|
22535
22585
|
})();
|
|
22536
22586
|
|
|
22537
|
-
/**
|
|
22538
|
-
* PipelinePass is a base class for all pipeline passes.
|
|
22539
|
-
*/ var PipelinePass = function PipelinePass(engine) {
|
|
22540
|
-
this._engine = engine;
|
|
22541
|
-
};
|
|
22542
|
-
|
|
22543
22587
|
/**
|
|
22544
22588
|
* Cascade shadow caster pass.
|
|
22545
22589
|
*/ var CascadedShadowCasterPass = /*#__PURE__*/ function(PipelinePass1) {
|
|
@@ -22552,11 +22596,10 @@ var /**
|
|
|
22552
22596
|
_this._shadowSliceData = new ShadowSliceData();
|
|
22553
22597
|
_this._lightUp = new engineMath.Vector3();
|
|
22554
22598
|
_this._lightSide = new engineMath.Vector3();
|
|
22555
|
-
_this._existShadowMap = false;
|
|
22556
22599
|
_this._splitBoundSpheres = new Float32Array(CascadedShadowCasterPass._maxCascades * 4);
|
|
22557
22600
|
/** The end is project precision problem in shader. */ _this._shadowMatrices = new Float32Array((CascadedShadowCasterPass._maxCascades + 1) * 16);
|
|
22558
|
-
//
|
|
22559
|
-
_this._shadowInfos = new engineMath.
|
|
22601
|
+
// intensity, null, fadeScale, fadeBias
|
|
22602
|
+
_this._shadowInfos = new engineMath.Vector4();
|
|
22560
22603
|
_this._viewportOffsets = [
|
|
22561
22604
|
new engineMath.Vector2(),
|
|
22562
22605
|
new engineMath.Vector2(),
|
|
@@ -22572,14 +22615,12 @@ var /**
|
|
|
22572
22615
|
/**
|
|
22573
22616
|
* @internal
|
|
22574
22617
|
*/ _proto.onRender = function onRender(context) {
|
|
22618
|
+
var light = this._camera.scene._lightManager._sunlight;
|
|
22575
22619
|
this._updateShadowSettings();
|
|
22576
|
-
this.
|
|
22577
|
-
this.
|
|
22578
|
-
if (this._existShadowMap) {
|
|
22579
|
-
this._updateReceiversShaderData();
|
|
22580
|
-
}
|
|
22620
|
+
this._renderDirectShadowMap(context, light);
|
|
22621
|
+
this._updateReceiversShaderData(light);
|
|
22581
22622
|
};
|
|
22582
|
-
_proto._renderDirectShadowMap = function _renderDirectShadowMap(context) {
|
|
22623
|
+
_proto._renderDirectShadowMap = function _renderDirectShadowMap(context, light) {
|
|
22583
22624
|
var _this = this, engine = _this._engine, camera = _this._camera, viewports = _this._viewportOffsets, shadowSliceData = _this._shadowSliceData, splitBoundSpheres = _this._splitBoundSpheres, shadowMatrices = _this._shadowMatrices;
|
|
22584
22625
|
var _camera__renderPipeline__cullingResults = camera._renderPipeline._cullingResults, opaqueQueue = _camera__renderPipeline__cullingResults.opaqueQueue, alphaTestQueue = _camera__renderPipeline__cullingResults.alphaTestQueue, transparentQueue = _camera__renderPipeline__cullingResults.transparentQueue;
|
|
22585
22626
|
var scene = camera.scene;
|
|
@@ -22593,91 +22634,87 @@ var /**
|
|
|
22593
22634
|
var lightUp = this._lightUp;
|
|
22594
22635
|
var lightSide = this._lightSide;
|
|
22595
22636
|
var lightForward = shadowSliceData.virtualCamera.forward;
|
|
22596
|
-
|
|
22597
|
-
|
|
22598
|
-
|
|
22599
|
-
|
|
22600
|
-
|
|
22601
|
-
|
|
22602
|
-
|
|
22603
|
-
|
|
22604
|
-
|
|
22605
|
-
|
|
22606
|
-
|
|
22607
|
-
|
|
22608
|
-
|
|
22609
|
-
|
|
22610
|
-
|
|
22611
|
-
|
|
22612
|
-
|
|
22613
|
-
|
|
22614
|
-
|
|
22615
|
-
|
|
22616
|
-
|
|
22617
|
-
|
|
22618
|
-
|
|
22619
|
-
rhi.
|
|
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
|
-
|
|
22670
|
-
|
|
22671
|
-
}
|
|
22672
|
-
}
|
|
22673
|
-
this._existShadowMap = true;
|
|
22674
|
-
}
|
|
22675
|
-
};
|
|
22676
|
-
_proto._updateReceiversShaderData = function _updateReceiversShaderData() {
|
|
22677
|
-
var scene = this._camera.scene;
|
|
22637
|
+
// Prepare render target
|
|
22638
|
+
var _this__shadowMapSize = this._shadowMapSize, width = _this__shadowMapSize.z, height = _this__shadowMapSize.w;
|
|
22639
|
+
var format = this._shadowMapFormat;
|
|
22640
|
+
var renderTarget;
|
|
22641
|
+
var shadowTexture;
|
|
22642
|
+
if (this._supportDepthTexture) {
|
|
22643
|
+
renderTarget = PipelineUtils.recreateRenderTargetIfNeeded(engine, this._renderTarget, width, height, null, format, false);
|
|
22644
|
+
shadowTexture = renderTarget.depthTexture;
|
|
22645
|
+
} else {
|
|
22646
|
+
renderTarget = PipelineUtils.recreateRenderTargetIfNeeded(engine, this._renderTarget, width, height, format, null, false);
|
|
22647
|
+
shadowTexture = renderTarget.getColorTexture(0);
|
|
22648
|
+
}
|
|
22649
|
+
shadowTexture.wrapModeU = shadowTexture.wrapModeV = exports.TextureWrapMode.Clamp;
|
|
22650
|
+
if (engine._hardwareRenderer._isWebGL2) {
|
|
22651
|
+
shadowTexture.depthCompareFunction = exports.TextureDepthCompareFunction.Less;
|
|
22652
|
+
}
|
|
22653
|
+
this._renderTarget = renderTarget;
|
|
22654
|
+
this._depthTexture = shadowTexture;
|
|
22655
|
+
// @todo: shouldn't set viewport and scissor in activeRenderTarget
|
|
22656
|
+
rhi.activeRenderTarget(renderTarget, CascadedShadowCasterPass._viewport, 0);
|
|
22657
|
+
if (this._supportDepthTexture) {
|
|
22658
|
+
rhi.clearRenderTarget(engine, exports.CameraClearFlags.Depth, null);
|
|
22659
|
+
} else {
|
|
22660
|
+
rhi.clearRenderTarget(engine, exports.CameraClearFlags.All, CascadedShadowCasterPass._clearColor);
|
|
22661
|
+
}
|
|
22662
|
+
// prepare light and camera direction
|
|
22663
|
+
engineMath.Matrix.rotationQuaternion(light.entity.transform.worldRotationQuaternion, lightWorld);
|
|
22664
|
+
lightSide.set(lightWorldE[0], lightWorldE[1], lightWorldE[2]);
|
|
22665
|
+
lightUp.set(lightWorldE[4], lightWorldE[5], lightWorldE[6]);
|
|
22666
|
+
lightForward.set(-lightWorldE[8], -lightWorldE[9], -lightWorldE[10]);
|
|
22667
|
+
var cameraForward = CascadedShadowCasterPass._tempVector;
|
|
22668
|
+
cameraForward.copyFrom(camera.entity.transform.worldForward);
|
|
22669
|
+
var shadowTileResolution = this._shadowTileResolution;
|
|
22670
|
+
for(var j = 0; j < shadowCascades; j++){
|
|
22671
|
+
ShadowUtils.getBoundSphereByFrustum(splitDistance[j], splitDistance[j + 1], camera, cameraForward, shadowSliceData);
|
|
22672
|
+
ShadowUtils.getDirectionLightShadowCullPlanes(camera._frustum, splitDistance[j], camera.nearClipPlane, lightForward, shadowSliceData);
|
|
22673
|
+
ShadowUtils.getDirectionalLightMatrices(lightUp, lightSide, lightForward, j, light.shadowNearPlane, shadowTileResolution, shadowSliceData, shadowMatrices);
|
|
22674
|
+
if (shadowCascades > 1) {
|
|
22675
|
+
ShadowUtils.applySliceTransform(shadowTileResolution, width, height, j, this._viewportOffsets[j], shadowMatrices);
|
|
22676
|
+
}
|
|
22677
|
+
this._updateSingleShadowCasterShaderData(light, shadowSliceData, context);
|
|
22678
|
+
// upload pre-cascade infos.
|
|
22679
|
+
var center = boundSphere.center;
|
|
22680
|
+
var radius = boundSphere.radius;
|
|
22681
|
+
var offset = j * 4;
|
|
22682
|
+
splitBoundSpheres[offset] = center.x;
|
|
22683
|
+
splitBoundSpheres[offset + 1] = center.y;
|
|
22684
|
+
splitBoundSpheres[offset + 2] = center.z;
|
|
22685
|
+
splitBoundSpheres[offset + 3] = radius * radius;
|
|
22686
|
+
opaqueQueue.clear();
|
|
22687
|
+
alphaTestQueue.clear();
|
|
22688
|
+
transparentQueue.clear();
|
|
22689
|
+
var renderers = componentsManager._renderers;
|
|
22690
|
+
var elements = renderers._elements;
|
|
22691
|
+
for(var k = renderers.length - 1; k >= 0; --k){
|
|
22692
|
+
ShadowUtils.shadowCullFrustum(context, light, elements[k], shadowSliceData);
|
|
22693
|
+
}
|
|
22694
|
+
if (opaqueQueue.elements.length || alphaTestQueue.elements.length) {
|
|
22695
|
+
opaqueQueue.sort(RenderQueue._compareFromNearToFar);
|
|
22696
|
+
alphaTestQueue.sort(RenderQueue._compareFromNearToFar);
|
|
22697
|
+
var _viewports_j = viewports[j], x = _viewports_j.x, y = _viewports_j.y;
|
|
22698
|
+
rhi.setGlobalDepthBias(1.0, 1.0);
|
|
22699
|
+
rhi.viewport(x, y, shadowTileResolution, shadowTileResolution);
|
|
22700
|
+
// for no cascade is for the edge,for cascade is for the beyond maxCascade pixel can use (0,0,0) trick sample the shadowMap
|
|
22701
|
+
rhi.scissor(x + 1, y + 1, shadowTileResolution - 2, shadowTileResolution - 2);
|
|
22702
|
+
engine._renderCount++;
|
|
22703
|
+
opaqueQueue.render(camera, exports.Layer.Everything, exports.PipelineStage.ShadowCaster);
|
|
22704
|
+
alphaTestQueue.render(camera, exports.Layer.Everything, exports.PipelineStage.ShadowCaster);
|
|
22705
|
+
rhi.setGlobalDepthBias(0, 0);
|
|
22706
|
+
}
|
|
22707
|
+
}
|
|
22708
|
+
};
|
|
22709
|
+
_proto._updateReceiversShaderData = function _updateReceiversShaderData(light) {
|
|
22710
|
+
var camera = this._camera;
|
|
22711
|
+
var scene = camera.scene;
|
|
22678
22712
|
var splitBoundSpheres = this._splitBoundSpheres;
|
|
22679
22713
|
var shadowMatrices = this._shadowMatrices;
|
|
22680
22714
|
var shadowCascades = scene.shadowCascades;
|
|
22715
|
+
var shadowFar = Math.min(scene.shadowDistance, camera.farClipPlane);
|
|
22716
|
+
ShadowUtils.getScaleAndBiasForLinearDistanceFade(Math.pow(shadowFar, 2), scene.shadowFadeBorder, this._shadowInfos);
|
|
22717
|
+
this._shadowInfos.x = light.shadowStrength;
|
|
22681
22718
|
// set zero matrix to project the index out of max cascade
|
|
22682
22719
|
if (shadowCascades > 1) {
|
|
22683
22720
|
for(var i = shadowCascades * 4, n = splitBoundSpheres.length; i < n; i++){
|
|
@@ -22690,7 +22727,7 @@ var /**
|
|
|
22690
22727
|
}
|
|
22691
22728
|
var shaderData = scene.shaderData;
|
|
22692
22729
|
shaderData.setFloatArray(CascadedShadowCasterPass._shadowMatricesProperty, this._shadowMatrices);
|
|
22693
|
-
shaderData.
|
|
22730
|
+
shaderData.setVector4(CascadedShadowCasterPass._shadowInfosProperty, this._shadowInfos);
|
|
22694
22731
|
shaderData.setTexture(CascadedShadowCasterPass._shadowMapsProperty, this._depthTexture);
|
|
22695
22732
|
shaderData.setFloatArray(CascadedShadowCasterPass._shadowSplitSpheresProperty, this._splitBoundSpheres);
|
|
22696
22733
|
shaderData.setVector4(CascadedShadowCasterPass._shadowMapSize, this._shadowMapSize);
|
|
@@ -22726,10 +22763,13 @@ var /**
|
|
|
22726
22763
|
return Math.sqrt(radius * radius / denominator);
|
|
22727
22764
|
};
|
|
22728
22765
|
_proto._updateShadowSettings = function _updateShadowSettings() {
|
|
22729
|
-
var
|
|
22766
|
+
var camera = this._camera;
|
|
22767
|
+
var scene = camera.scene;
|
|
22730
22768
|
var shadowFormat = ShadowUtils.shadowDepthFormat(scene.shadowResolution, this._supportDepthTexture);
|
|
22731
22769
|
var shadowResolution = ShadowUtils.shadowResolution(scene.shadowResolution);
|
|
22732
22770
|
var shadowCascades = scene.shadowCascades;
|
|
22771
|
+
var shadowFar = Math.min(scene.shadowDistance, camera.farClipPlane);
|
|
22772
|
+
this._getCascadesSplitDistance(shadowFar);
|
|
22733
22773
|
if (shadowFormat !== this._shadowMapFormat || shadowResolution !== this._shadowMapResolution || shadowCascades !== this._shadowCascadeMode) {
|
|
22734
22774
|
this._shadowMapFormat = shadowFormat;
|
|
22735
22775
|
this._shadowMapResolution = shadowResolution;
|
|
@@ -23177,14 +23217,14 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23177
23217
|
/** @internal */ _this._cameraIndex = -1;
|
|
23178
23218
|
_this._priority = 0;
|
|
23179
23219
|
_this._shaderData = new ShaderData(ShaderDataGroup.Camera);
|
|
23180
|
-
_this.
|
|
23220
|
+
_this._isCustomViewMatrix = false;
|
|
23221
|
+
_this._isCustomProjectionMatrix = false;
|
|
23181
23222
|
_this._nearClipPlane = 0.1;
|
|
23182
23223
|
_this._farClipPlane = 100;
|
|
23183
23224
|
_this._fieldOfView = 45;
|
|
23184
23225
|
_this._orthographicSize = 10;
|
|
23185
23226
|
_this._isProjectionDirty = true;
|
|
23186
23227
|
_this._isInvProjMatDirty = true;
|
|
23187
|
-
_this._isFrustumProjectDirty = true;
|
|
23188
23228
|
_this._customAspectRatio = undefined;
|
|
23189
23229
|
_this._renderTarget = null;
|
|
23190
23230
|
_this._depthBufferParams = new engineMath.Vector4();
|
|
@@ -23196,7 +23236,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23196
23236
|
_this._transform = transform;
|
|
23197
23237
|
_this._isViewMatrixDirty = transform.registerWorldChangeFlag();
|
|
23198
23238
|
_this._isInvViewProjDirty = transform.registerWorldChangeFlag();
|
|
23199
|
-
_this.
|
|
23239
|
+
_this._frustumChangeFlag = transform.registerWorldChangeFlag();
|
|
23200
23240
|
_this._renderPipeline = new BasicRenderPipeline(_assert_this_initialized(_this));
|
|
23201
23241
|
_this._addResourceReferCount(_this.shaderData, 1);
|
|
23202
23242
|
_this._updatePixelViewport();
|
|
@@ -23208,16 +23248,22 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23208
23248
|
}
|
|
23209
23249
|
var _proto = Camera1.prototype;
|
|
23210
23250
|
/**
|
|
23251
|
+
* Restore the view matrix to the world matrix of the entity.
|
|
23252
|
+
*/ _proto.resetViewMatrix = function resetViewMatrix() {
|
|
23253
|
+
this._isCustomViewMatrix = false;
|
|
23254
|
+
this._viewMatrixChange();
|
|
23255
|
+
};
|
|
23256
|
+
/**
|
|
23211
23257
|
* Restore the automatic calculation of projection matrix through fieldOfView, nearClipPlane and farClipPlane.
|
|
23212
23258
|
*/ _proto.resetProjectionMatrix = function resetProjectionMatrix() {
|
|
23213
|
-
this.
|
|
23214
|
-
this.
|
|
23259
|
+
this._isCustomProjectionMatrix = false;
|
|
23260
|
+
this._projectionMatrixChange();
|
|
23215
23261
|
};
|
|
23216
23262
|
/**
|
|
23217
23263
|
* Restore the automatic calculation of the aspect ratio through the viewport aspect ratio.
|
|
23218
23264
|
*/ _proto.resetAspectRatio = function resetAspectRatio() {
|
|
23219
23265
|
this._customAspectRatio = undefined;
|
|
23220
|
-
this.
|
|
23266
|
+
this._projectionMatrixChange();
|
|
23221
23267
|
};
|
|
23222
23268
|
/**
|
|
23223
23269
|
* Transform a point from world space to viewport space.
|
|
@@ -23347,10 +23393,9 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23347
23393
|
context.replacementShader = this._replacementShader;
|
|
23348
23394
|
context.replacementTag = this._replacementSubShaderTag;
|
|
23349
23395
|
// compute cull frustum.
|
|
23350
|
-
if (this.enableFrustumCulling &&
|
|
23396
|
+
if (this.enableFrustumCulling && this._frustumChangeFlag.flag) {
|
|
23351
23397
|
this._frustum.calculateFromMatrix(virtualCamera.viewProjectionMatrix);
|
|
23352
|
-
this.
|
|
23353
|
-
this._isFrustumProjectDirty = false;
|
|
23398
|
+
this._frustumChangeFlag.flag = false;
|
|
23354
23399
|
}
|
|
23355
23400
|
this._updateShaderData();
|
|
23356
23401
|
// union scene and camera macro.
|
|
@@ -23399,13 +23444,16 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23399
23444
|
//@ts-ignore
|
|
23400
23445
|
this._viewport._onValueChanged = null;
|
|
23401
23446
|
this.engine.canvas._sizeUpdateFlagManager.removeListener(this._onPixelViewportChanged);
|
|
23447
|
+
//@ts-ignore
|
|
23448
|
+
this._viewport._onValueChanged = null;
|
|
23449
|
+
this.engine.canvas._sizeUpdateFlagManager.removeListener(this._onPixelViewportChanged);
|
|
23402
23450
|
this._entity = null;
|
|
23403
23451
|
this._globalShaderMacro = null;
|
|
23404
23452
|
this._frustum = null;
|
|
23405
23453
|
this._renderPipeline = null;
|
|
23406
23454
|
this._virtualCamera = null;
|
|
23407
23455
|
this._shaderData = null;
|
|
23408
|
-
this.
|
|
23456
|
+
this._frustumChangeFlag = null;
|
|
23409
23457
|
this._transform = null;
|
|
23410
23458
|
this._isViewMatrixDirty = null;
|
|
23411
23459
|
this._isInvViewProjDirty = null;
|
|
@@ -23427,11 +23475,16 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23427
23475
|
var viewport = this._viewport;
|
|
23428
23476
|
this._pixelViewport.set(viewport.x * width, viewport.y * height, viewport.z * width, viewport.w * height);
|
|
23429
23477
|
};
|
|
23430
|
-
_proto.
|
|
23431
|
-
this.
|
|
23478
|
+
_proto._viewMatrixChange = function _viewMatrixChange() {
|
|
23479
|
+
this._isViewMatrixDirty.flag = true;
|
|
23480
|
+
this._isInvViewProjDirty.flag = true;
|
|
23481
|
+
this._frustumChangeFlag.flag = true;
|
|
23482
|
+
};
|
|
23483
|
+
_proto._projectionMatrixChange = function _projectionMatrixChange() {
|
|
23432
23484
|
this._isProjectionDirty = true;
|
|
23433
23485
|
this._isInvProjMatDirty = true;
|
|
23434
23486
|
this._isInvViewProjDirty.flag = true;
|
|
23487
|
+
this._frustumChangeFlag.flag = true;
|
|
23435
23488
|
};
|
|
23436
23489
|
_proto._innerViewportToWorldPoint = function _innerViewportToWorldPoint(x, y, z, invViewProjMat, out) {
|
|
23437
23490
|
// Depth is a normalized value, 0 is nearPlane, 1 is farClipPlane.
|
|
@@ -23474,7 +23527,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23474
23527
|
_proto._onPixelViewportChanged = function _onPixelViewportChanged() {
|
|
23475
23528
|
this._updatePixelViewport();
|
|
23476
23529
|
var _this__customAspectRatio;
|
|
23477
|
-
(_this__customAspectRatio = this._customAspectRatio) != null ? _this__customAspectRatio : this.
|
|
23530
|
+
(_this__customAspectRatio = this._customAspectRatio) != null ? _this__customAspectRatio : this._projectionMatrixChange();
|
|
23478
23531
|
};
|
|
23479
23532
|
_create_class(Camera1, [
|
|
23480
23533
|
{
|
|
@@ -23494,7 +23547,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23494
23547
|
},
|
|
23495
23548
|
set: function set(value) {
|
|
23496
23549
|
this._nearClipPlane = value;
|
|
23497
|
-
this.
|
|
23550
|
+
this._projectionMatrixChange();
|
|
23498
23551
|
}
|
|
23499
23552
|
},
|
|
23500
23553
|
{
|
|
@@ -23506,7 +23559,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23506
23559
|
},
|
|
23507
23560
|
set: function set(value) {
|
|
23508
23561
|
this._farClipPlane = value;
|
|
23509
|
-
this.
|
|
23562
|
+
this._projectionMatrixChange();
|
|
23510
23563
|
}
|
|
23511
23564
|
},
|
|
23512
23565
|
{
|
|
@@ -23518,7 +23571,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23518
23571
|
},
|
|
23519
23572
|
set: function set(value) {
|
|
23520
23573
|
this._fieldOfView = value;
|
|
23521
|
-
this.
|
|
23574
|
+
this._projectionMatrixChange();
|
|
23522
23575
|
}
|
|
23523
23576
|
},
|
|
23524
23577
|
{
|
|
@@ -23533,7 +23586,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23533
23586
|
},
|
|
23534
23587
|
set: function set(value) {
|
|
23535
23588
|
this._customAspectRatio = value;
|
|
23536
|
-
this.
|
|
23589
|
+
this._projectionMatrixChange();
|
|
23537
23590
|
}
|
|
23538
23591
|
},
|
|
23539
23592
|
{
|
|
@@ -23585,7 +23638,12 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23585
23638
|
},
|
|
23586
23639
|
set: function set(value) {
|
|
23587
23640
|
this._virtualCamera.isOrthographic = value;
|
|
23588
|
-
this.
|
|
23641
|
+
this._projectionMatrixChange();
|
|
23642
|
+
if (value) {
|
|
23643
|
+
this.shaderData.enableMacro("CAMERA_ORTHOGRAPHIC");
|
|
23644
|
+
} else {
|
|
23645
|
+
this.shaderData.disableMacro("CAMERA_ORTHOGRAPHIC");
|
|
23646
|
+
}
|
|
23589
23647
|
}
|
|
23590
23648
|
},
|
|
23591
23649
|
{
|
|
@@ -23597,7 +23655,7 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23597
23655
|
},
|
|
23598
23656
|
set: function set(value) {
|
|
23599
23657
|
this._orthographicSize = value;
|
|
23600
|
-
this.
|
|
23658
|
+
this._projectionMatrixChange();
|
|
23601
23659
|
}
|
|
23602
23660
|
},
|
|
23603
23661
|
{
|
|
@@ -23606,22 +23664,31 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23606
23664
|
* View matrix.
|
|
23607
23665
|
*/ function get() {
|
|
23608
23666
|
var viewMatrix = this._virtualCamera.viewMatrix;
|
|
23609
|
-
if (this._isViewMatrixDirty.flag) {
|
|
23610
|
-
|
|
23611
|
-
|
|
23612
|
-
|
|
23613
|
-
|
|
23614
|
-
|
|
23615
|
-
|
|
23667
|
+
if (!this._isViewMatrixDirty.flag || this._isCustomViewMatrix) {
|
|
23668
|
+
return viewMatrix;
|
|
23669
|
+
}
|
|
23670
|
+
this._isViewMatrixDirty.flag = false;
|
|
23671
|
+
// Ignore scale
|
|
23672
|
+
var transform = this._transform;
|
|
23673
|
+
engineMath.Matrix.rotationTranslation(transform.worldRotationQuaternion, transform.worldPosition, viewMatrix);
|
|
23674
|
+
viewMatrix.invert();
|
|
23616
23675
|
return viewMatrix;
|
|
23676
|
+
},
|
|
23677
|
+
set: function set(value) {
|
|
23678
|
+
this._virtualCamera.viewMatrix.copyFrom(value);
|
|
23679
|
+
this._isCustomViewMatrix = true;
|
|
23680
|
+
this._viewMatrixChange();
|
|
23617
23681
|
}
|
|
23618
23682
|
},
|
|
23619
23683
|
{
|
|
23620
23684
|
key: "projectionMatrix",
|
|
23621
|
-
get:
|
|
23685
|
+
get: /**
|
|
23686
|
+
* The projection matrix is calculated by the relevant parameters of the camera by default.
|
|
23687
|
+
* If it is manually set, the manual value will be maintained. Call resetProjectionMatrix() to restore it.
|
|
23688
|
+
*/ function get() {
|
|
23622
23689
|
var virtualCamera = this._virtualCamera;
|
|
23623
23690
|
var projectionMatrix = virtualCamera.projectionMatrix;
|
|
23624
|
-
if (!this._isProjectionDirty || this.
|
|
23691
|
+
if (!this._isProjectionDirty || this._isCustomProjectionMatrix) {
|
|
23625
23692
|
return projectionMatrix;
|
|
23626
23693
|
}
|
|
23627
23694
|
this._isProjectionDirty = false;
|
|
@@ -23635,13 +23702,10 @@ exports.Camera = (_Camera = /*#__PURE__*/ function(Component1) {
|
|
|
23635
23702
|
}
|
|
23636
23703
|
return projectionMatrix;
|
|
23637
23704
|
},
|
|
23638
|
-
set:
|
|
23639
|
-
* The projection matrix is calculated by the relevant parameters of the camera by default.
|
|
23640
|
-
* If it is manually set, the manual value will be maintained. Call resetProjectionMatrix() to restore it.
|
|
23641
|
-
*/ function set(value) {
|
|
23705
|
+
set: function set(value) {
|
|
23642
23706
|
this._virtualCamera.projectionMatrix.copyFrom(value);
|
|
23643
|
-
this.
|
|
23644
|
-
this.
|
|
23707
|
+
this._isCustomProjectionMatrix = true;
|
|
23708
|
+
this._projectionMatrixChange();
|
|
23645
23709
|
}
|
|
23646
23710
|
},
|
|
23647
23711
|
{
|
|
@@ -23702,7 +23766,7 @@ __decorate([
|
|
|
23702
23766
|
], exports.Camera.prototype, "_cameraIndex", void 0);
|
|
23703
23767
|
__decorate([
|
|
23704
23768
|
ignoreClone
|
|
23705
|
-
], exports.Camera.prototype, "
|
|
23769
|
+
], exports.Camera.prototype, "_frustumChangeFlag", void 0);
|
|
23706
23770
|
__decorate([
|
|
23707
23771
|
ignoreClone
|
|
23708
23772
|
], exports.Camera.prototype, "_transform", void 0);
|
|
@@ -23889,6 +23953,7 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
23889
23953
|
* @param obj - class object
|
|
23890
23954
|
*/ Loader.registerClass = function registerClass(className, classDefine) {
|
|
23891
23955
|
this._engineObjects[className] = classDefine;
|
|
23956
|
+
this._classNameMap.set(classDefine, className);
|
|
23892
23957
|
};
|
|
23893
23958
|
/**
|
|
23894
23959
|
* Get the class object by class name.
|
|
@@ -23897,11 +23962,21 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
23897
23962
|
*/ Loader.getClass = function getClass(className) {
|
|
23898
23963
|
return this._engineObjects[className];
|
|
23899
23964
|
};
|
|
23965
|
+
/**
|
|
23966
|
+
* Get the class name by class object.
|
|
23967
|
+
* @param obj - class object
|
|
23968
|
+
* @returns class name
|
|
23969
|
+
*/ Loader.getClassName = function getClassName(obj) {
|
|
23970
|
+
return this._classNameMap.get(obj);
|
|
23971
|
+
};
|
|
23900
23972
|
return Loader;
|
|
23901
23973
|
}();
|
|
23902
23974
|
(function() {
|
|
23903
23975
|
Loader._engineObjects = {};
|
|
23904
23976
|
})();
|
|
23977
|
+
(function() {
|
|
23978
|
+
Loader._classNameMap = new Map();
|
|
23979
|
+
})();
|
|
23905
23980
|
|
|
23906
23981
|
/**
|
|
23907
23982
|
* Alpha blend mode.
|
|
@@ -27671,7 +27746,7 @@ __decorate([
|
|
|
27671
27746
|
this._clip = clip;
|
|
27672
27747
|
this._clipEndTime = Math.min(this._clipEndTime, 1);
|
|
27673
27748
|
this._onClipChanged();
|
|
27674
|
-
clip._updateFlagManager.addListener(this._onClipChanged);
|
|
27749
|
+
clip && clip._updateFlagManager.addListener(this._onClipChanged);
|
|
27675
27750
|
}
|
|
27676
27751
|
},
|
|
27677
27752
|
{
|
|
@@ -28378,6 +28453,7 @@ __decorate([
|
|
|
28378
28453
|
ParticleRandomSubSeeds[ParticleRandomSubSeeds["RotationOverLifetime"] = 0x40eb95e4] = "RotationOverLifetime";
|
|
28379
28454
|
ParticleRandomSubSeeds[ParticleRandomSubSeeds["TextureSheetAnimation"] = 0xbc524e5] = "TextureSheetAnimation";
|
|
28380
28455
|
ParticleRandomSubSeeds[ParticleRandomSubSeeds["Shape"] = 0xaf502044] = "Shape";
|
|
28456
|
+
ParticleRandomSubSeeds[ParticleRandomSubSeeds["GravityModifier"] = 0xa47b8c4d] = "GravityModifier";
|
|
28381
28457
|
})(ParticleRandomSubSeeds || (ParticleRandomSubSeeds = {}));
|
|
28382
28458
|
|
|
28383
28459
|
/**
|
|
@@ -29091,6 +29167,7 @@ var MainModule = /*#__PURE__*/ function() {
|
|
|
29091
29167
|
/** @internal */ this._startColorRand = new engineMath.Rand(0, ParticleRandomSubSeeds.StartColor);
|
|
29092
29168
|
/** @internal */ this._startSizeRand = new engineMath.Rand(0, ParticleRandomSubSeeds.StartSize);
|
|
29093
29169
|
/** @internal */ this._startRotationRand = new engineMath.Rand(0, ParticleRandomSubSeeds.StartRotation);
|
|
29170
|
+
this._gravityModifierRand = new engineMath.Rand(0, ParticleRandomSubSeeds.GravityModifier);
|
|
29094
29171
|
this._gravity = new engineMath.Vector3();
|
|
29095
29172
|
this._generator = generator;
|
|
29096
29173
|
}
|
|
@@ -29151,7 +29228,7 @@ var MainModule = /*#__PURE__*/ function() {
|
|
|
29151
29228
|
break;
|
|
29152
29229
|
}
|
|
29153
29230
|
var particleGravity = this._gravity;
|
|
29154
|
-
var gravityModifierValue = this.gravityModifier.evaluate(undefined,
|
|
29231
|
+
var gravityModifierValue = this.gravityModifier.evaluate(undefined, this._gravityModifierRand.random());
|
|
29155
29232
|
engineMath.Vector3.scale(renderer.scene.physics.gravity, gravityModifierValue, particleGravity);
|
|
29156
29233
|
shaderData.setVector3(MainModule._gravity, particleGravity);
|
|
29157
29234
|
shaderData.setInt(MainModule._simulationSpace, this.simulationSpace);
|
|
@@ -29270,6 +29347,9 @@ __decorate([
|
|
|
29270
29347
|
__decorate([
|
|
29271
29348
|
ignoreClone
|
|
29272
29349
|
], MainModule.prototype, "_startRotationRand", void 0);
|
|
29350
|
+
__decorate([
|
|
29351
|
+
ignoreClone
|
|
29352
|
+
], MainModule.prototype, "_gravityModifierRand", void 0);
|
|
29273
29353
|
__decorate([
|
|
29274
29354
|
ignoreClone
|
|
29275
29355
|
], MainModule.prototype, "_generator", void 0);
|
|
@@ -29940,7 +30020,8 @@ __decorate([
|
|
|
29940
30020
|
var transform = this._renderer.entity.transform;
|
|
29941
30021
|
var shape = this.emission.shape;
|
|
29942
30022
|
for(var i = 0; i < count; i++){
|
|
29943
|
-
|
|
30023
|
+
var _shape;
|
|
30024
|
+
if ((_shape = shape) == null ? void 0 : _shape.enabled) {
|
|
29944
30025
|
shape._generatePositionAndDirection(this.emission._shapeRand, time, position, direction);
|
|
29945
30026
|
var positionScale = this.main._getPositionScale();
|
|
29946
30027
|
position.multiply(positionScale);
|
|
@@ -30520,7 +30601,7 @@ __decorate([
|
|
|
30520
30601
|
* Base class for all particle shapes.
|
|
30521
30602
|
*/ var BaseShape = /*#__PURE__*/ function() {
|
|
30522
30603
|
function BaseShape() {
|
|
30523
|
-
/** Specifies whether the ShapeModule is enabled or disabled. */ this.
|
|
30604
|
+
/** Specifies whether the ShapeModule is enabled or disabled. */ this.enabled = true;
|
|
30524
30605
|
/** Randomizes the starting direction of particles. */ this.randomDirectionAmount = 0;
|
|
30525
30606
|
}
|
|
30526
30607
|
var _proto = BaseShape.prototype;
|
|
@@ -30584,14 +30665,14 @@ __decorate([
|
|
|
30584
30665
|
|
|
30585
30666
|
/**
|
|
30586
30667
|
* The emission shape.
|
|
30587
|
-
*/
|
|
30668
|
+
*/ exports.ParticleShapeType = void 0;
|
|
30588
30669
|
(function(ParticleShapeType) {
|
|
30589
30670
|
ParticleShapeType[ParticleShapeType[/** Emit from the volume of a box. */ "Box"] = 0] = "Box";
|
|
30590
30671
|
ParticleShapeType[ParticleShapeType[/** Emit from a circle. */ "Circle"] = 1] = "Circle";
|
|
30591
30672
|
ParticleShapeType[ParticleShapeType[/** Emit from the base of a cone. */ "Cone"] = 2] = "Cone";
|
|
30592
30673
|
ParticleShapeType[ParticleShapeType[/** Emit from a half-sphere. */ "Hemisphere"] = 3] = "Hemisphere";
|
|
30593
30674
|
ParticleShapeType[ParticleShapeType[/** Emit from a sphere. */ "Sphere"] = 4] = "Sphere";
|
|
30594
|
-
})(ParticleShapeType || (ParticleShapeType = {}));
|
|
30675
|
+
})(exports.ParticleShapeType || (exports.ParticleShapeType = {}));
|
|
30595
30676
|
|
|
30596
30677
|
/**
|
|
30597
30678
|
* Particle shape that emits particles from a box.
|
|
@@ -30599,9 +30680,9 @@ __decorate([
|
|
|
30599
30680
|
_inherits(BoxShape, BaseShape1);
|
|
30600
30681
|
function BoxShape() {
|
|
30601
30682
|
var _this;
|
|
30602
|
-
_this = BaseShape1.
|
|
30683
|
+
_this = BaseShape1.apply(this, arguments) || this;
|
|
30684
|
+
_this.shapeType = exports.ParticleShapeType.Box;
|
|
30603
30685
|
/** The size of the box. */ _this.size = new engineMath.Vector3(1, 1, 1);
|
|
30604
|
-
_this.shapeType = ParticleShapeType.Box;
|
|
30605
30686
|
return _this;
|
|
30606
30687
|
}
|
|
30607
30688
|
var _proto = BoxShape.prototype;
|
|
@@ -30638,12 +30719,12 @@ __decorate([
|
|
|
30638
30719
|
_inherits(CircleShape, BaseShape1);
|
|
30639
30720
|
function CircleShape() {
|
|
30640
30721
|
var _this;
|
|
30641
|
-
_this = BaseShape1.
|
|
30722
|
+
_this = BaseShape1.apply(this, arguments) || this;
|
|
30723
|
+
_this.shapeType = exports.ParticleShapeType.Circle;
|
|
30642
30724
|
/** Radius of the shape to emit particles from. */ _this.radius = 1.0;
|
|
30643
30725
|
/** Angle of the circle arc to emit particles from. */ _this.arc = 360.0;
|
|
30644
30726
|
/** The mode to generate particles around the arc. */ _this.arcMode = exports.ParticleShapeArcMode.Random;
|
|
30645
30727
|
/** The speed of complete 360 degree rotation. */ _this.arcSpeed = 1.0;
|
|
30646
|
-
_this.shapeType = ParticleShapeType.Circle;
|
|
30647
30728
|
return _this;
|
|
30648
30729
|
}
|
|
30649
30730
|
var _proto = CircleShape.prototype;
|
|
@@ -30679,12 +30760,12 @@ __decorate([
|
|
|
30679
30760
|
_inherits(ConeShape, BaseShape1);
|
|
30680
30761
|
function ConeShape() {
|
|
30681
30762
|
var _this;
|
|
30682
|
-
_this = BaseShape1.
|
|
30763
|
+
_this = BaseShape1.apply(this, arguments) || this;
|
|
30764
|
+
_this.shapeType = exports.ParticleShapeType.Cone;
|
|
30683
30765
|
/** Angle of the cone to emit particles from. */ _this.angle = 25.0;
|
|
30684
30766
|
/** Radius of the shape to emit particles from. */ _this.radius = 1.0;
|
|
30685
30767
|
/** Length of the cone to emit particles from. */ _this.length = 5.0;
|
|
30686
30768
|
/** Cone emitter type. */ _this.emitType = /** Emit particles from the base of the cone. */ 0;
|
|
30687
|
-
_this.shapeType = ParticleShapeType.Cone;
|
|
30688
30769
|
return _this;
|
|
30689
30770
|
}
|
|
30690
30771
|
var _proto = ConeShape.prototype;
|
|
@@ -30744,9 +30825,9 @@ exports.ConeEmitType = void 0;
|
|
|
30744
30825
|
_inherits(HemisphereShape, BaseShape1);
|
|
30745
30826
|
function HemisphereShape() {
|
|
30746
30827
|
var _this;
|
|
30747
|
-
_this = BaseShape1.
|
|
30828
|
+
_this = BaseShape1.apply(this, arguments) || this;
|
|
30829
|
+
_this.shapeType = exports.ParticleShapeType.Hemisphere;
|
|
30748
30830
|
/** Radius of the shape to emit particles from. */ _this.radius = 1.0;
|
|
30749
|
-
_this.shapeType = ParticleShapeType.Hemisphere;
|
|
30750
30831
|
return _this;
|
|
30751
30832
|
}
|
|
30752
30833
|
var _proto = HemisphereShape.prototype;
|
|
@@ -30769,9 +30850,9 @@ exports.ConeEmitType = void 0;
|
|
|
30769
30850
|
_inherits(SphereShape, BaseShape1);
|
|
30770
30851
|
function SphereShape() {
|
|
30771
30852
|
var _this;
|
|
30772
|
-
_this = BaseShape1.
|
|
30853
|
+
_this = BaseShape1.apply(this, arguments) || this;
|
|
30854
|
+
_this.shapeType = exports.ParticleShapeType.Sphere;
|
|
30773
30855
|
/** Radius of the shape to emit particles from. */ _this.radius = 1.0;
|
|
30774
|
-
_this.shapeType = ParticleShapeType.Sphere;
|
|
30775
30856
|
return _this;
|
|
30776
30857
|
}
|
|
30777
30858
|
var _proto = SphereShape.prototype;
|