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