@galacean/engine-core 1.3.0-alpha.2 → 1.3.0-beta.5
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 +239 -65
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +239 -65
- package/dist/module.js +236 -66
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/Entity.d.ts +4 -1
- package/types/animation/index.d.ts +3 -0
- package/types/asset/ResourceManager.d.ts +3 -1
- package/types/lighting/Light.d.ts +4 -2
- package/types/utils/SafeLoopArray.d.ts +5 -0
- package/types/utils/index.d.ts +1 -0
package/dist/miniprogram.js
CHANGED
|
@@ -3001,6 +3001,45 @@ exports.ShaderPlatformTarget = void 0;
|
|
|
3001
3001
|
ShaderPlatformTarget[ShaderPlatformTarget["GLES300"] = 1] = "GLES300";
|
|
3002
3002
|
})(exports.ShaderPlatformTarget || (exports.ShaderPlatformTarget = {}));
|
|
3003
3003
|
|
|
3004
|
+
function _array_like_to_array(arr, len) {
|
|
3005
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3006
|
+
|
|
3007
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
3008
|
+
|
|
3009
|
+
return arr2;
|
|
3010
|
+
}
|
|
3011
|
+
|
|
3012
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
3013
|
+
if (!o) return;
|
|
3014
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
3015
|
+
|
|
3016
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3017
|
+
|
|
3018
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
3019
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
3020
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
3021
|
+
}
|
|
3022
|
+
|
|
3023
|
+
function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
3024
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
3025
|
+
|
|
3026
|
+
if (it) return (it = it.call(o)).next.bind(it);
|
|
3027
|
+
// Fallback for engines without symbol support
|
|
3028
|
+
if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
3029
|
+
if (it) o = it;
|
|
3030
|
+
|
|
3031
|
+
var i = 0;
|
|
3032
|
+
|
|
3033
|
+
return function() {
|
|
3034
|
+
if (i >= o.length) return { done: true };
|
|
3035
|
+
|
|
3036
|
+
return { done: false, value: o[i++] };
|
|
3037
|
+
};
|
|
3038
|
+
}
|
|
3039
|
+
|
|
3040
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3041
|
+
}
|
|
3042
|
+
|
|
3004
3043
|
/**
|
|
3005
3044
|
* Shader macro。
|
|
3006
3045
|
*/ var ShaderMacro = /*#__PURE__*/ function() {
|
|
@@ -3244,7 +3283,7 @@ function _extends() {
|
|
|
3244
3283
|
|
|
3245
3284
|
var camera_declare = "#define GLSLIFY 1\nuniform vec3 camera_Position;uniform vec3 camera_Forward;uniform vec4 camera_ProjectionParams;"; // eslint-disable-line
|
|
3246
3285
|
|
|
3247
|
-
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
|
|
3286
|
+
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){linearIn=max(linearIn,0.0);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
|
|
3248
3287
|
|
|
3249
3288
|
var common_vert = "#define GLSLIFY 1\nattribute vec3 POSITION;\n#ifdef RENDERER_HAS_UV\nattribute vec2 TEXCOORD_0;\n#endif\n#ifdef RENDERER_HAS_UV1\nattribute vec2 TEXCOORD_1;\n#endif\n#ifdef RENDERER_HAS_SKIN\nattribute vec4 JOINTS_0;attribute vec4 WEIGHTS_0;\n#ifdef RENDERER_USE_JOINT_TEXTURE\nuniform sampler2D renderer_JointSampler;uniform float renderer_JointCount;mat4 getJointMatrix(sampler2D smp,float index){float base=index/renderer_JointCount;float hf=0.5/renderer_JointCount;float v=base+hf;vec4 m0=texture2D(smp,vec2(0.125,v));vec4 m1=texture2D(smp,vec2(0.375,v));vec4 m2=texture2D(smp,vec2(0.625,v));vec4 m3=texture2D(smp,vec2(0.875,v));return mat4(m0,m1,m2,m3);}\n#else\nuniform mat4 renderer_JointMatrix[RENDERER_JOINTS_NUM];\n#endif\n#endif\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\nattribute vec4 COLOR_0;\n#endif\n#include <transform_declare>\n#include <camera_declare>\nuniform vec4 material_TilingOffset;\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef RENDERER_HAS_NORMAL\nattribute vec3 NORMAL;\n#endif\n#ifdef RENDERER_HAS_TANGENT\nattribute vec4 TANGENT;\n#endif\n#endif\n"; // eslint-disable-line
|
|
3250
3289
|
|
|
@@ -3336,7 +3375,7 @@ var brdf = "#define GLSLIFY 1\nfloat F_Schlick(float f0,float dotLH){return f0+0
|
|
|
3336
3375
|
|
|
3337
3376
|
var direct_irradiance_frag_define = "#define GLSLIFY 1\n#include <ShadowFragmentDeclaration>\nvoid addDirectRadiance(vec3 incidentDirection,vec3 color,Geometry geometry,Material material,inout ReflectedLight reflectedLight){float attenuation=1.0;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nfloat clearCoatDotNL=saturate(dot(geometry.clearCoatNormal,incidentDirection));vec3 clearCoatIrradiance=clearCoatDotNL*color;reflectedLight.directSpecular+=material.clearCoat*clearCoatIrradiance*BRDF_Specular_GGX(incidentDirection,geometry,geometry.clearCoatNormal,vec3(0.04),material.clearCoatRoughness);attenuation-=material.clearCoat*F_Schlick(material.f0,geometry.clearCoatDotNV);\n#endif\nfloat dotNL=saturate(dot(geometry.normal,incidentDirection));vec3 irradiance=dotNL*color*PI;reflectedLight.directSpecular+=attenuation*irradiance*BRDF_Specular_GGX(incidentDirection,geometry,geometry.normal,material.specularColor,material.roughness);reflectedLight.directDiffuse+=attenuation*irradiance*BRDF_Diffuse_Lambert(material.diffuseColor);}\n#ifdef SCENE_DIRECT_LIGHT_COUNT\nvoid addDirectionalDirectLightRadiance(DirectLight directionalLight,Geometry geometry,Material material,inout ReflectedLight reflectedLight){vec3 color=directionalLight.color;vec3 direction=-directionalLight.direction;addDirectRadiance(direction,color,geometry,material,reflectedLight);}\n#endif\n#ifdef SCENE_POINT_LIGHT_COUNT\nvoid addPointDirectLightRadiance(PointLight pointLight,Geometry geometry,Material material,inout ReflectedLight reflectedLight){vec3 lVector=pointLight.position-geometry.position;vec3 direction=normalize(lVector);float lightDistance=length(lVector);vec3 color=pointLight.color;color*=clamp(1.0-pow(lightDistance/pointLight.distance,4.0),0.0,1.0);addDirectRadiance(direction,color,geometry,material,reflectedLight);}\n#endif\n#ifdef SCENE_SPOT_LIGHT_COUNT\nvoid addSpotDirectLightRadiance(SpotLight spotLight,Geometry geometry,Material material,inout ReflectedLight reflectedLight){vec3 lVector=spotLight.position-geometry.position;vec3 direction=normalize(lVector);float lightDistance=length(lVector);float angleCos=dot(direction,-spotLight.direction);float spotEffect=smoothstep(spotLight.penumbraCos,spotLight.angleCos,angleCos);float decayEffect=clamp(1.0-pow(lightDistance/spotLight.distance,4.0),0.0,1.0);vec3 color=spotLight.color;color*=spotEffect*decayEffect;addDirectRadiance(direction,color,geometry,material,reflectedLight);}\n#endif\nvoid addTotalDirectRadiance(Geometry geometry,Material material,inout ReflectedLight reflectedLight){float shadowAttenuation=1.0;\n#ifdef SCENE_DIRECT_LIGHT_COUNT\nshadowAttenuation=1.0;\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nshadowAttenuation*=sampleShadowMap();\n#endif\nDirectLight directionalLight;for(int i=0;i<SCENE_DIRECT_LIGHT_COUNT;i++){if(!isRendererCulledByLight(renderer_Layer.xy,scene_DirectLightCullingMask[i])){directionalLight.color=scene_DirectLightColor[i];\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nif(i==0){directionalLight.color*=shadowAttenuation;}\n#endif\ndirectionalLight.direction=scene_DirectLightDirection[i];addDirectionalDirectLightRadiance(directionalLight,geometry,material,reflectedLight);}}\n#endif\n#ifdef SCENE_POINT_LIGHT_COUNT\nPointLight pointLight;for(int i=0;i<SCENE_POINT_LIGHT_COUNT;i++){if(!isRendererCulledByLight(renderer_Layer.xy,scene_PointLightCullingMask[i])){pointLight.color=scene_PointLightColor[i];pointLight.position=scene_PointLightPosition[i];pointLight.distance=scene_PointLightDistance[i];addPointDirectLightRadiance(pointLight,geometry,material,reflectedLight);}}\n#endif\n#ifdef SCENE_SPOT_LIGHT_COUNT\nSpotLight spotLight;for(int i=0;i<SCENE_SPOT_LIGHT_COUNT;i++){if(!isRendererCulledByLight(renderer_Layer.xy,scene_SpotLightCullingMask[i])){spotLight.color=scene_SpotLightColor[i];spotLight.position=scene_SpotLightPosition[i];spotLight.direction=scene_SpotLightDirection[i];spotLight.distance=scene_SpotLightDistance[i];spotLight.angleCos=scene_SpotLightAngleCos[i];spotLight.penumbraCos=scene_SpotLightPenumbraCos[i];addSpotDirectLightRadiance(spotLight,geometry,material,reflectedLight);}}\n#endif\n}"; // eslint-disable-line
|
|
3338
3377
|
|
|
3339
|
-
var ibl_frag_define = "#define GLSLIFY 1\nvec3 getLightProbeIrradiance(vec3 sh[9],vec3 normal){normal.x=-normal.x;vec3 result=sh[0]+sh[1]*(normal.y)+sh[2]*(normal.z)+sh[3]*(normal.x)+sh[4]*(normal.y*normal.x)+sh[5]*(normal.y*normal.z)+sh[6]*(3.0*normal.z*normal.z-1.0)+sh[7]*(normal.z*normal.x)+sh[8]*(normal.x*normal.x-normal.y*normal.y);return max(result,vec3(0.0));}vec3 envBRDFApprox(vec3 specularColor,float roughness,float dotNV){const vec4 c0=vec4(-1,-0.0275,-0.572,0.022);const vec4 c1=vec4(1,0.0425,1.04,-0.04);vec4 r=roughness*c0+c1;float a004=min(r.x*r.x,exp2(-9.28*dotNV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return
|
|
3378
|
+
var ibl_frag_define = "#define GLSLIFY 1\nvec3 getLightProbeIrradiance(vec3 sh[9],vec3 normal){normal.x=-normal.x;vec3 result=sh[0]+sh[1]*(normal.y)+sh[2]*(normal.z)+sh[3]*(normal.x)+sh[4]*(normal.y*normal.x)+sh[5]*(normal.y*normal.z)+sh[6]*(3.0*normal.z*normal.z-1.0)+sh[7]*(normal.z*normal.x)+sh[8]*(normal.x*normal.x-normal.y*normal.y);return max(result,vec3(0.0));}vec3 envBRDFApprox(vec3 specularColor,float roughness,float dotNV){const vec4 c0=vec4(-1,-0.0275,-0.572,0.022);const vec4 c1=vec4(1,0.0425,1.04,-0.04);vec4 r=roughness*c0+c1;float a004=min(r.x*r.x,exp2(-9.28*dotNV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}float getSpecularMIPLevel(float roughness,int maxMIPLevel){return roughness*float(maxMIPLevel);}vec3 getReflectedVector(Geometry geometry,vec3 n){\n#ifdef MATERIAL_ENABLE_ANISOTROPY\nvec3 r=reflect(-geometry.viewDir,geometry.anisotropicN);\n#else\nvec3 r=reflect(-geometry.viewDir,n);\n#endif\nreturn r;}vec3 getLightProbeRadiance(Geometry geometry,vec3 normal,float roughness,int maxMIPLevel,float specularIntensity){\n#ifndef SCENE_USE_SPECULAR_ENV\nreturn vec3(0);\n#else\nvec3 reflectVec=getReflectedVector(geometry,normal);reflectVec.x=-reflectVec.x;float specularMIPLevel=getSpecularMIPLevel(roughness,maxMIPLevel);\n#ifdef HAS_TEX_LOD\nvec4 envMapColor=textureCubeLodEXT(scene_EnvSpecularSampler,reflectVec,specularMIPLevel);\n#else\nvec4 envMapColor=textureCube(scene_EnvSpecularSampler,reflectVec,specularMIPLevel);\n#endif\n#ifdef SCENE_IS_DECODE_ENV_RGBM\nenvMapColor.rgb=RGBMToLinear(envMapColor,5.0).rgb;\n#ifdef ENGINE_IS_COLORSPACE_GAMMA\nenvMapColor=linearToGamma(envMapColor);\n#endif\n#else\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nenvMapColor=gammaToLinear(envMapColor);\n#endif\n#endif\nreturn envMapColor.rgb*specularIntensity;\n#endif\n}"; // eslint-disable-line
|
|
3340
3379
|
|
|
3341
3380
|
var pbr_frag = "#define GLSLIFY 1\nGeometry geometry;Material material;ReflectedLight reflectedLight=ReflectedLight(vec3(0.0),vec3(0.0),vec3(0.0),vec3(0.0));initGeometry(geometry,gl_FrontFacing);initMaterial(material,geometry);addTotalDirectRadiance(geometry,material,reflectedLight);\n#ifdef SCENE_USE_SH\nvec3 irradiance=getLightProbeIrradiance(scene_EnvSH,geometry.normal);\n#ifdef ENGINE_IS_COLORSPACE_GAMMA\nirradiance=linearToGamma(vec4(irradiance,1.0)).rgb;\n#endif\nirradiance*=scene_EnvMapLight.diffuseIntensity;\n#else\nvec3 irradiance=scene_EnvMapLight.diffuse*scene_EnvMapLight.diffuseIntensity;irradiance*=PI;\n#endif\nreflectedLight.indirectDiffuse+=irradiance*BRDF_Diffuse_Lambert(material.diffuseColor);vec3 radiance=getLightProbeRadiance(geometry,geometry.normal,material.roughness,int(scene_EnvMapLight.mipMapLevel),scene_EnvMapLight.specularIntensity);float radianceAttenuation=1.0;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nvec3 clearCoatRadiance=getLightProbeRadiance(geometry,geometry.clearCoatNormal,material.clearCoatRoughness,int(scene_EnvMapLight.mipMapLevel),scene_EnvMapLight.specularIntensity);reflectedLight.indirectSpecular+=clearCoatRadiance*material.clearCoat*envBRDFApprox(vec3(0.04),material.clearCoatRoughness,geometry.clearCoatDotNV);radianceAttenuation-=material.clearCoat*F_Schlick(material.f0,geometry.clearCoatDotNV);\n#endif\nreflectedLight.indirectSpecular+=radianceAttenuation*radiance*envBRDFApprox(material.specularColor,material.roughness,geometry.dotNV);\n#ifdef MATERIAL_HAS_OCCLUSION_TEXTURE\nvec2 aoUV=v_uv;\n#ifdef RENDERER_HAS_UV1\nif(material_OcclusionTextureCoord==1.0){aoUV=v_uv1;}\n#endif\nfloat ambientOcclusion=(texture2D(material_OcclusionTexture,aoUV).r-1.0)*material_OcclusionIntensity+1.0;reflectedLight.indirectDiffuse*=ambientOcclusion;\n#ifdef SCENE_USE_SPECULAR_ENV\nreflectedLight.indirectSpecular*=computeSpecularOcclusion(ambientOcclusion,material.roughness,geometry.dotNV);\n#endif\n#endif\nvec3 emissiveRadiance=material_EmissiveColor;\n#ifdef MATERIAL_HAS_EMISSIVETEXTURE\nvec4 emissiveColor=texture2D(material_EmissiveTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nemissiveColor=gammaToLinear(emissiveColor);\n#endif\nemissiveRadiance*=emissiveColor.rgb;\n#endif\nvec3 totalRadiance=reflectedLight.directDiffuse+reflectedLight.indirectDiffuse+reflectedLight.directSpecular+reflectedLight.indirectSpecular+emissiveRadiance;vec4 targetColor=vec4(totalRadiance,material.opacity);gl_FragColor=targetColor;"; // eslint-disable-line
|
|
3342
3381
|
|
|
@@ -4261,6 +4300,7 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
4261
4300
|
/** @internal */ _this._shaderPassId = 0;
|
|
4262
4301
|
/** @internal */ _this._renderStateDataMap = {};
|
|
4263
4302
|
/** @internal */ _this._shaderProgramPools = [];
|
|
4303
|
+
/** @internal */ _this._path = "";
|
|
4264
4304
|
_this._platformMacros = [];
|
|
4265
4305
|
_this._shaderPassId = ShaderPass._shaderPassCounter++;
|
|
4266
4306
|
_this._type = ShaderType.Canonical;
|
|
@@ -4322,23 +4362,24 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
4322
4362
|
/**
|
|
4323
4363
|
* Shader Lab compilation
|
|
4324
4364
|
*/ _proto._compileShaderProgram = function _compileShaderProgram(engine, macroCollection, vertexEntry, fragmentEntry) {
|
|
4365
|
+
var _this = this, path = _this._path, platformMacros = _this._platformMacros;
|
|
4325
4366
|
var isWebGL2 = engine._hardwareRenderer.isWebGL2;
|
|
4326
4367
|
var macros = new Array();
|
|
4327
4368
|
ShaderMacro._getMacrosElements(macroCollection, macros);
|
|
4328
|
-
|
|
4369
|
+
platformMacros.length = 0;
|
|
4329
4370
|
if (engine._hardwareRenderer.canIUse(exports.GLCapabilityType.shaderTextureLod)) {
|
|
4330
|
-
|
|
4371
|
+
platformMacros.push("HAS_TEX_LOD");
|
|
4331
4372
|
}
|
|
4332
4373
|
if (engine._hardwareRenderer.canIUse(exports.GLCapabilityType.standardDerivatives)) {
|
|
4333
|
-
|
|
4374
|
+
platformMacros.push("HAS_DERIVATIVES");
|
|
4334
4375
|
}
|
|
4335
4376
|
if (isWebGL2) {
|
|
4336
|
-
|
|
4377
|
+
platformMacros.push("GRAPHICS_API_WEBGL2");
|
|
4337
4378
|
} else {
|
|
4338
|
-
|
|
4379
|
+
platformMacros.push("GRAPHICS_API_WEBGL1");
|
|
4339
4380
|
}
|
|
4340
4381
|
var start = engineMiniprogramAdapter.performance.now();
|
|
4341
|
-
var _Shader__shaderLab__parseShaderPass = Shader._shaderLab._parseShaderPass(this._shaderLabSource, vertexEntry, fragmentEntry, macros, isWebGL2 ? exports.ShaderPlatformTarget.GLES300 : exports.ShaderPlatformTarget.GLES100,
|
|
4382
|
+
var _Shader__shaderLab__parseShaderPass = Shader._shaderLab._parseShaderPass(this._shaderLabSource, vertexEntry, fragmentEntry, macros, isWebGL2 ? exports.ShaderPlatformTarget.GLES300 : exports.ShaderPlatformTarget.GLES100, platformMacros, new engineMiniprogramAdapter.URL(path, ShaderPass._shaderRootPath).href), vertex = _Shader__shaderLab__parseShaderPass.vertex, fragment = _Shader__shaderLab__parseShaderPass.fragment;
|
|
4342
4383
|
Logger.info("[ShaderLab compilation] cost time: " + (engineMiniprogramAdapter.performance.now() - start) + "ms");
|
|
4343
4384
|
return new ShaderProgram(engine, vertex, fragment);
|
|
4344
4385
|
};
|
|
@@ -4371,6 +4412,9 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
4371
4412
|
(function() {
|
|
4372
4413
|
ShaderPass._shaderPassCounter = 0;
|
|
4373
4414
|
})();
|
|
4415
|
+
(function() {
|
|
4416
|
+
/** @internal */ ShaderPass._shaderRootPath = "shaders://root/";
|
|
4417
|
+
})();
|
|
4374
4418
|
|
|
4375
4419
|
/**
|
|
4376
4420
|
* Sub shader.
|
|
@@ -5007,6 +5051,18 @@ __decorate([
|
|
|
5007
5051
|
}
|
|
5008
5052
|
var _proto = Shader.prototype;
|
|
5009
5053
|
/**
|
|
5054
|
+
* @internal
|
|
5055
|
+
* path should follow the specifications of [URL.origin](https://developer.mozilla.org/en-US/docs/Web/API/URL/origin), like: `shaders://root/`
|
|
5056
|
+
*/ _proto._registerPath = function _registerPath(path) {
|
|
5057
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this._subShaders), _step; !(_step = _iterator()).done;){
|
|
5058
|
+
var subShader = _step.value;
|
|
5059
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(subShader.passes), _step1; !(_step1 = _iterator1()).done;){
|
|
5060
|
+
var shaderPass = _step1.value;
|
|
5061
|
+
shaderPass._path = path;
|
|
5062
|
+
}
|
|
5063
|
+
}
|
|
5064
|
+
};
|
|
5065
|
+
/**
|
|
5010
5066
|
* Compile shader variant by macro name list.
|
|
5011
5067
|
*
|
|
5012
5068
|
* @remarks
|
|
@@ -10265,14 +10321,17 @@ var /**
|
|
|
10265
10321
|
var replacementSubShaders = replacementShader.subShaders;
|
|
10266
10322
|
var replacementTag = context.replacementTag;
|
|
10267
10323
|
if (replacementTag) {
|
|
10324
|
+
var replacementSuccess = false;
|
|
10268
10325
|
for(var j = 0, m = replacementSubShaders.length; j < m; j++){
|
|
10269
10326
|
var subShader = replacementSubShaders[j];
|
|
10270
10327
|
if (subShader.getTagValue(replacementTag) === materialSubShader.getTagValue(replacementTag)) {
|
|
10271
10328
|
this.pushRenderElementByType(renderElement, subRenderElement, subShader.passes, renderStates);
|
|
10272
|
-
|
|
10329
|
+
replacementSuccess = true;
|
|
10273
10330
|
}
|
|
10274
10331
|
}
|
|
10275
|
-
context.replacementFailureStrategy === exports.ReplacementFailureStrategy.KeepOriginalShader
|
|
10332
|
+
if (!replacementSuccess && context.replacementFailureStrategy === exports.ReplacementFailureStrategy.KeepOriginalShader) {
|
|
10333
|
+
this.pushRenderElementByType(renderElement, subRenderElement, materialSubShader.passes, renderStates);
|
|
10334
|
+
}
|
|
10276
10335
|
} else {
|
|
10277
10336
|
this.pushRenderElementByType(renderElement, subRenderElement, replacementSubShaders[0].passes, renderStates);
|
|
10278
10337
|
}
|
|
@@ -10856,7 +10915,7 @@ var /**
|
|
|
10856
10915
|
if (info) {
|
|
10857
10916
|
return info;
|
|
10858
10917
|
}
|
|
10859
|
-
info = TextUtils._measureFontOrChar(fontString);
|
|
10918
|
+
info = TextUtils._measureFontOrChar(fontString, TextUtils._measureString, false);
|
|
10860
10919
|
fontSizeInfoCache[fontString] = info;
|
|
10861
10920
|
return info;
|
|
10862
10921
|
};
|
|
@@ -10877,7 +10936,7 @@ var /**
|
|
|
10877
10936
|
return str;
|
|
10878
10937
|
};
|
|
10879
10938
|
TextUtils.measureChar = function measureChar(char, fontString) {
|
|
10880
|
-
return TextUtils._measureFontOrChar(fontString, char);
|
|
10939
|
+
return TextUtils._measureFontOrChar(fontString, char, true);
|
|
10881
10940
|
};
|
|
10882
10941
|
TextUtils.measureTextWithWrap = function measureTextWithWrap(renderer) {
|
|
10883
10942
|
var subFont = renderer._getSubFont();
|
|
@@ -11096,15 +11155,15 @@ var /**
|
|
|
11096
11155
|
};
|
|
11097
11156
|
/**
|
|
11098
11157
|
* @internal
|
|
11099
|
-
*/ TextUtils._measureFontOrChar = function _measureFontOrChar(fontString,
|
|
11100
|
-
if (char === void 0) char = "";
|
|
11158
|
+
*/ TextUtils._measureFontOrChar = function _measureFontOrChar(fontString, measureString, isChar) {
|
|
11101
11159
|
var _TextUtils_textContext = TextUtils.textContext(), canvas = _TextUtils_textContext.canvas, context = _TextUtils_textContext.context;
|
|
11102
11160
|
context.font = fontString;
|
|
11103
|
-
var measureString = char || TextUtils._measureString;
|
|
11104
11161
|
// Safari gets data confusion through getImageData when the canvas width is not an integer.
|
|
11105
11162
|
// The measure text width of some special invisible characters may be 0, so make sure the width is at least 1.
|
|
11106
11163
|
// @todo: Text layout may vary from standard and not support emoji.
|
|
11107
|
-
var
|
|
11164
|
+
var textMetrics = context.measureText(measureString);
|
|
11165
|
+
// In some case (ex: " "), actualBoundingBoxRight and actualBoundingBoxLeft will be 0, so use width.
|
|
11166
|
+
var width = Math.max(1, Math.round(textMetrics.actualBoundingBoxRight - textMetrics.actualBoundingBoxLeft || textMetrics.width));
|
|
11108
11167
|
var baseline = Math.ceil(context.measureText(TextUtils._measureBaseline).width);
|
|
11109
11168
|
var height = baseline * TextUtils._heightMultiplier;
|
|
11110
11169
|
baseline = TextUtils._baselineMultiplier * baseline | 0;
|
|
@@ -11149,12 +11208,7 @@ var /**
|
|
|
11149
11208
|
descent = bottom - baseline + 1;
|
|
11150
11209
|
size = ascent + descent;
|
|
11151
11210
|
}
|
|
11152
|
-
|
|
11153
|
-
ascent: ascent,
|
|
11154
|
-
descent: descent,
|
|
11155
|
-
size: size
|
|
11156
|
-
};
|
|
11157
|
-
if (char) {
|
|
11211
|
+
if (isChar) {
|
|
11158
11212
|
var data = null;
|
|
11159
11213
|
if (size > 0) {
|
|
11160
11214
|
var lineIntegerW = integerW * 4;
|
|
@@ -11162,7 +11216,7 @@ var /**
|
|
|
11162
11216
|
data = new Uint8Array(colorData.buffer, top * lineIntegerW, size * lineIntegerW);
|
|
11163
11217
|
}
|
|
11164
11218
|
return {
|
|
11165
|
-
char:
|
|
11219
|
+
char: measureString,
|
|
11166
11220
|
x: 0,
|
|
11167
11221
|
y: 0,
|
|
11168
11222
|
w: width,
|
|
@@ -11182,7 +11236,11 @@ var /**
|
|
|
11182
11236
|
data: data
|
|
11183
11237
|
};
|
|
11184
11238
|
} else {
|
|
11185
|
-
return
|
|
11239
|
+
return {
|
|
11240
|
+
ascent: ascent,
|
|
11241
|
+
descent: descent,
|
|
11242
|
+
size: size
|
|
11243
|
+
};
|
|
11186
11244
|
}
|
|
11187
11245
|
};
|
|
11188
11246
|
/**
|
|
@@ -17375,6 +17433,38 @@ var PrimitiveType;
|
|
|
17375
17433
|
PrimitiveMesh._spherePoleIdx = 0;
|
|
17376
17434
|
})();
|
|
17377
17435
|
|
|
17436
|
+
function _is_native_reflect_construct() {
|
|
17437
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
17438
|
+
if (Reflect.construct.sham) return false;
|
|
17439
|
+
if (typeof Proxy === "function") return true;
|
|
17440
|
+
|
|
17441
|
+
try {
|
|
17442
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
17443
|
+
|
|
17444
|
+
return true;
|
|
17445
|
+
} catch (e) {
|
|
17446
|
+
return false;
|
|
17447
|
+
}
|
|
17448
|
+
}
|
|
17449
|
+
|
|
17450
|
+
function _construct(Parent, args, Class) {
|
|
17451
|
+
if (_is_native_reflect_construct()) _construct = Reflect.construct;
|
|
17452
|
+
else {
|
|
17453
|
+
_construct = function construct(Parent, args, Class) {
|
|
17454
|
+
var a = [null];
|
|
17455
|
+
a.push.apply(a, args);
|
|
17456
|
+
var Constructor = Function.bind.apply(Parent, a);
|
|
17457
|
+
var instance = new Constructor();
|
|
17458
|
+
|
|
17459
|
+
if (Class) _set_prototype_of(instance, Class.prototype);
|
|
17460
|
+
|
|
17461
|
+
return instance;
|
|
17462
|
+
};
|
|
17463
|
+
}
|
|
17464
|
+
|
|
17465
|
+
return _construct.apply(null, arguments);
|
|
17466
|
+
}
|
|
17467
|
+
|
|
17378
17468
|
var ComponentCloner = /*#__PURE__*/ function() {
|
|
17379
17469
|
function ComponentCloner() {}
|
|
17380
17470
|
/**
|
|
@@ -17422,10 +17512,14 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
17422
17512
|
/**
|
|
17423
17513
|
* Add component based on the component type.
|
|
17424
17514
|
* @param type - The type of the component
|
|
17515
|
+
* @param args - The arguments of the component
|
|
17425
17516
|
* @returns The component which has been added
|
|
17426
17517
|
*/ _proto.addComponent = function addComponent(type) {
|
|
17518
|
+
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
17519
|
+
args[_key - 1] = arguments[_key];
|
|
17520
|
+
}
|
|
17427
17521
|
ComponentsDependencies._addCheck(this, type);
|
|
17428
|
-
var component =
|
|
17522
|
+
var component = _construct(type, [].concat(this, args));
|
|
17429
17523
|
this._components.push(component);
|
|
17430
17524
|
component._setActive(true, ActiveChangeFlag.All);
|
|
17431
17525
|
return component;
|
|
@@ -18951,6 +19045,15 @@ var SafeLoopArray = /*#__PURE__*/ function() {
|
|
|
18951
19045
|
this._loopArrayDirty = true;
|
|
18952
19046
|
};
|
|
18953
19047
|
/**
|
|
19048
|
+
* Remove item from array that pass the specified comparison function.
|
|
19049
|
+
* @param filter - The comparison function
|
|
19050
|
+
*/ _proto.findAndRemove = function findAndRemove(filter) {
|
|
19051
|
+
var array = this._array;
|
|
19052
|
+
for(var i = array.length - 1; i >= 0; i--){
|
|
19053
|
+
filter(array[i]) && this.removeByIndex(i);
|
|
19054
|
+
}
|
|
19055
|
+
};
|
|
19056
|
+
/**
|
|
18954
19057
|
* The index of the item.
|
|
18955
19058
|
* @param item - The item which want to get the index
|
|
18956
19059
|
* @returns Index of the item
|
|
@@ -19384,17 +19487,35 @@ var /** @internal */ PromiseState;
|
|
|
19384
19487
|
};
|
|
19385
19488
|
/**
|
|
19386
19489
|
* @internal
|
|
19387
|
-
*/ _proto._onSubAssetSuccess = function _onSubAssetSuccess(
|
|
19388
|
-
var
|
|
19389
|
-
(
|
|
19390
|
-
|
|
19490
|
+
*/ _proto._onSubAssetSuccess = function _onSubAssetSuccess(assetBaseURL, assetSubPath, value) {
|
|
19491
|
+
var _this__subAssetPromiseCallbacks_assetBaseURL;
|
|
19492
|
+
var subPromiseCallback = (_this__subAssetPromiseCallbacks_assetBaseURL = this._subAssetPromiseCallbacks[assetBaseURL]) == null ? void 0 : _this__subAssetPromiseCallbacks_assetBaseURL[assetSubPath];
|
|
19493
|
+
if (subPromiseCallback) {
|
|
19494
|
+
// Already resolved
|
|
19495
|
+
subPromiseCallback.resolve(value);
|
|
19496
|
+
} else {
|
|
19497
|
+
var // Pending
|
|
19498
|
+
_this__subAssetPromiseCallbacks, _assetBaseURL;
|
|
19499
|
+
((_this__subAssetPromiseCallbacks = this._subAssetPromiseCallbacks)[_assetBaseURL = assetBaseURL] || (_this__subAssetPromiseCallbacks[_assetBaseURL] = {}))[assetSubPath] = {
|
|
19500
|
+
resolve: value
|
|
19501
|
+
};
|
|
19502
|
+
}
|
|
19391
19503
|
};
|
|
19392
19504
|
/**
|
|
19393
19505
|
* @internal
|
|
19394
|
-
*/ _proto._onSubAssetFail = function _onSubAssetFail(
|
|
19395
|
-
var
|
|
19396
|
-
(
|
|
19397
|
-
|
|
19506
|
+
*/ _proto._onSubAssetFail = function _onSubAssetFail(assetBaseURL, assetSubPath, value) {
|
|
19507
|
+
var _this__subAssetPromiseCallbacks_assetBaseURL;
|
|
19508
|
+
var subPromiseCallback = (_this__subAssetPromiseCallbacks_assetBaseURL = this._subAssetPromiseCallbacks[assetBaseURL]) == null ? void 0 : _this__subAssetPromiseCallbacks_assetBaseURL[assetSubPath];
|
|
19509
|
+
if (subPromiseCallback) {
|
|
19510
|
+
// Already rejected
|
|
19511
|
+
subPromiseCallback.reject(value);
|
|
19512
|
+
} else {
|
|
19513
|
+
var // Pending
|
|
19514
|
+
_this__subAssetPromiseCallbacks, _assetBaseURL;
|
|
19515
|
+
((_this__subAssetPromiseCallbacks = this._subAssetPromiseCallbacks)[_assetBaseURL = assetBaseURL] || (_this__subAssetPromiseCallbacks[_assetBaseURL] = {}))[assetSubPath] = {
|
|
19516
|
+
reject: value
|
|
19517
|
+
};
|
|
19518
|
+
}
|
|
19398
19519
|
};
|
|
19399
19520
|
/**
|
|
19400
19521
|
* @internal
|
|
@@ -19539,8 +19660,21 @@ var /** @internal */ PromiseState;
|
|
|
19539
19660
|
if (!loader) {
|
|
19540
19661
|
throw "loader not found: " + item.type;
|
|
19541
19662
|
}
|
|
19542
|
-
//
|
|
19663
|
+
// Check sub asset
|
|
19664
|
+
if (queryPath) {
|
|
19665
|
+
// Check whether load main asset
|
|
19666
|
+
var mainPromise = loadingPromises[assetBaseURL] || this._loadMainAsset(loader, item, assetBaseURL);
|
|
19667
|
+
mainPromise.catch(function(e) {
|
|
19668
|
+
_this._onSubAssetFail(assetBaseURL, queryPath, e);
|
|
19669
|
+
});
|
|
19670
|
+
return this._createSubAssetPromiseCallback(assetBaseURL, assetURL, queryPath);
|
|
19671
|
+
}
|
|
19672
|
+
return this._loadMainAsset(loader, item, assetBaseURL);
|
|
19673
|
+
};
|
|
19674
|
+
_proto._loadMainAsset = function _loadMainAsset(loader, item, assetBaseURL) {
|
|
19675
|
+
var _this = this;
|
|
19543
19676
|
item.url = assetBaseURL;
|
|
19677
|
+
var loadingPromises = this._loadingPromises;
|
|
19544
19678
|
var promise = loader.load(item, this);
|
|
19545
19679
|
loadingPromises[assetBaseURL] = promise;
|
|
19546
19680
|
promise.then(function(resource) {
|
|
@@ -19548,32 +19682,46 @@ var /** @internal */ PromiseState;
|
|
|
19548
19682
|
_this._addAsset(assetBaseURL, resource);
|
|
19549
19683
|
}
|
|
19550
19684
|
delete loadingPromises[assetBaseURL];
|
|
19685
|
+
_this._releaseSubAssetPromiseCallback(assetBaseURL);
|
|
19551
19686
|
}, function() {
|
|
19552
|
-
|
|
19687
|
+
delete loadingPromises[assetBaseURL];
|
|
19688
|
+
_this._releaseSubAssetPromiseCallback(assetBaseURL);
|
|
19553
19689
|
});
|
|
19554
|
-
|
|
19555
|
-
|
|
19556
|
-
|
|
19557
|
-
|
|
19558
|
-
|
|
19559
|
-
|
|
19690
|
+
return promise;
|
|
19691
|
+
};
|
|
19692
|
+
_proto._createSubAssetPromiseCallback = function _createSubAssetPromiseCallback(assetBaseURL, assetURL, assetSubPath) {
|
|
19693
|
+
var _this = this;
|
|
19694
|
+
var _this__subAssetPromiseCallbacks_assetBaseURL, _subPromiseCallback, _subPromiseCallback1;
|
|
19695
|
+
var loadingPromises = this._loadingPromises;
|
|
19696
|
+
var subPromiseCallback = (_this__subAssetPromiseCallbacks_assetBaseURL = this._subAssetPromiseCallbacks[assetBaseURL]) == null ? void 0 : _this__subAssetPromiseCallbacks_assetBaseURL[assetSubPath];
|
|
19697
|
+
var resolvedValue = (_subPromiseCallback = subPromiseCallback) == null ? void 0 : _subPromiseCallback.resolve;
|
|
19698
|
+
var rejectedValue = (_subPromiseCallback1 = subPromiseCallback) == null ? void 0 : _subPromiseCallback1.reject;
|
|
19699
|
+
var promise = new AssetPromise(function(resolve, reject) {
|
|
19700
|
+
if (resolvedValue) {
|
|
19701
|
+
// Already resolved
|
|
19702
|
+
resolve(resolvedValue);
|
|
19703
|
+
} else if (rejectedValue) {
|
|
19704
|
+
// Already rejected
|
|
19705
|
+
reject(rejectedValue);
|
|
19706
|
+
} else {
|
|
19707
|
+
var _this__subAssetPromiseCallbacks, _assetBaseURL;
|
|
19708
|
+
// Pending
|
|
19709
|
+
loadingPromises[assetURL] = promise;
|
|
19710
|
+
((_this__subAssetPromiseCallbacks = _this._subAssetPromiseCallbacks)[_assetBaseURL = assetBaseURL] || (_this__subAssetPromiseCallbacks[_assetBaseURL] = {}))[assetSubPath] = {
|
|
19711
|
+
resolve: resolve,
|
|
19712
|
+
reject: reject
|
|
19713
|
+
};
|
|
19714
|
+
}
|
|
19715
|
+
});
|
|
19716
|
+
if (!resolvedValue && !rejectedValue) {
|
|
19717
|
+
promise.then(function() {
|
|
19560
19718
|
delete loadingPromises[assetURL];
|
|
19561
19719
|
}, function() {
|
|
19562
19720
|
return delete loadingPromises[assetURL];
|
|
19563
19721
|
});
|
|
19564
|
-
promise.catch(function(e) {
|
|
19565
|
-
_this._onSubAssetFail(assetURL, e);
|
|
19566
|
-
});
|
|
19567
|
-
return subPromise;
|
|
19568
19722
|
}
|
|
19569
19723
|
return promise;
|
|
19570
19724
|
};
|
|
19571
|
-
_proto._pushSubAssetPromiseCallback = function _pushSubAssetPromiseCallback(assetURL, resolve, reject) {
|
|
19572
|
-
this._subAssetPromiseCallbacks[assetURL] = {
|
|
19573
|
-
resolve: resolve,
|
|
19574
|
-
reject: reject
|
|
19575
|
-
};
|
|
19576
|
-
};
|
|
19577
19725
|
_proto._gc = function _gc(forceDestroy) {
|
|
19578
19726
|
var objects = Utils.objectValues(this._referResourcePool);
|
|
19579
19727
|
for(var i = 0, n = objects.length; i < n; i++){
|
|
@@ -19630,6 +19778,9 @@ var /** @internal */ PromiseState;
|
|
|
19630
19778
|
});
|
|
19631
19779
|
return result;
|
|
19632
19780
|
};
|
|
19781
|
+
_proto._releaseSubAssetPromiseCallback = function _releaseSubAssetPromiseCallback(assetBaseURL) {
|
|
19782
|
+
delete this._subAssetPromiseCallbacks[assetBaseURL];
|
|
19783
|
+
};
|
|
19633
19784
|
/**
|
|
19634
19785
|
* @internal
|
|
19635
19786
|
* @beta Just for internal editor, not recommended for developers.
|
|
@@ -24424,9 +24575,9 @@ ShaderPool.init();
|
|
|
24424
24575
|
/** Shadow bias.*/ _this.shadowBias = 1;
|
|
24425
24576
|
/** Shadow mapping normal-based bias. */ _this.shadowNormalBias = 1;
|
|
24426
24577
|
/** Near plane value to use for shadow frustums. */ _this.shadowNearPlane = 0.1;
|
|
24427
|
-
/** Shadow intensity, the larger the value, the clearer and darker the shadow. */ _this.shadowStrength = 1.0;
|
|
24428
24578
|
/** @internal */ _this._lightIndex = -1;
|
|
24429
24579
|
/** @internal */ _this._lightColor = new miniprogram.Color();
|
|
24580
|
+
_this._shadowStrength = 1.0;
|
|
24430
24581
|
_this._color = new miniprogram.Color(1, 1, 1, 1);
|
|
24431
24582
|
return _this;
|
|
24432
24583
|
}
|
|
@@ -24442,6 +24593,15 @@ ShaderPool.init();
|
|
|
24442
24593
|
return this._lightColor;
|
|
24443
24594
|
};
|
|
24444
24595
|
_create_class(Light, [
|
|
24596
|
+
{
|
|
24597
|
+
key: "shadowStrength",
|
|
24598
|
+
get: /** Shadow intensity, the larger the value, the clearer and darker the shadow, range [0,1]. */ function get() {
|
|
24599
|
+
return this._shadowStrength;
|
|
24600
|
+
},
|
|
24601
|
+
set: function set(value) {
|
|
24602
|
+
this._shadowStrength = miniprogram.MathUtil.clamp(value, 0, 1);
|
|
24603
|
+
}
|
|
24604
|
+
},
|
|
24445
24605
|
{
|
|
24446
24606
|
key: "color",
|
|
24447
24607
|
get: /**
|
|
@@ -25157,7 +25317,7 @@ var BloomEffect = /*#__PURE__*/ function() {
|
|
|
25157
25317
|
return this._scatter;
|
|
25158
25318
|
},
|
|
25159
25319
|
set: function set(value) {
|
|
25160
|
-
value =
|
|
25320
|
+
value = miniprogram.MathUtil.clamp(value, 0, 1);
|
|
25161
25321
|
if (value !== this._scatter) {
|
|
25162
25322
|
this._scatter = value;
|
|
25163
25323
|
var params = this._bloomMaterial.shaderData.getVector4(BloomEffect._bloomParams);
|
|
@@ -28265,10 +28425,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
28265
28425
|
/**
|
|
28266
28426
|
* @internal
|
|
28267
28427
|
*/ _proto._onEnable = function _onEnable() {
|
|
28268
|
-
|
|
28269
|
-
for(var i = 0, n = layersData.length; i < n; i++){
|
|
28270
|
-
layersData[i].layerState = LayerState.Standby;
|
|
28271
|
-
}
|
|
28428
|
+
this._reset();
|
|
28272
28429
|
this._entity.getComponentsIncludeChildren(exports.Renderer, this._controlledRenderers);
|
|
28273
28430
|
};
|
|
28274
28431
|
/**
|
|
@@ -28822,8 +28979,11 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
28822
28979
|
if (exitTime >= lastClipTime) {
|
|
28823
28980
|
playState.currentTransitionIndex = Math.min(transitionIndex + 1, n - 1);
|
|
28824
28981
|
if (this._checkConditions(state, transition)) {
|
|
28825
|
-
this._applyTransition(layerIndex, layerData, stateMachine, transition)
|
|
28826
|
-
|
|
28982
|
+
if (this._applyTransition(layerIndex, layerData, stateMachine, transition)) {
|
|
28983
|
+
return transition;
|
|
28984
|
+
} else {
|
|
28985
|
+
return null;
|
|
28986
|
+
}
|
|
28827
28987
|
}
|
|
28828
28988
|
}
|
|
28829
28989
|
}
|
|
@@ -28842,8 +29002,11 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
28842
29002
|
if (exitTime <= lastClipTime) {
|
|
28843
29003
|
playState.currentTransitionIndex = Math.max(transitionIndex - 1, 0);
|
|
28844
29004
|
if (this._checkConditions(state, transition)) {
|
|
28845
|
-
this._applyTransition(layerIndex, layerData, stateMachine, transition)
|
|
28846
|
-
|
|
29005
|
+
if (this._applyTransition(layerIndex, layerData, stateMachine, transition)) {
|
|
29006
|
+
return transition;
|
|
29007
|
+
} else {
|
|
29008
|
+
return null;
|
|
29009
|
+
}
|
|
28847
29010
|
}
|
|
28848
29011
|
}
|
|
28849
29012
|
}
|
|
@@ -28853,8 +29016,11 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
28853
29016
|
for(var i = 0, n = transitions.length; i < n; i++){
|
|
28854
29017
|
var transition = transitions[i];
|
|
28855
29018
|
if (this._checkConditions(state, transition)) {
|
|
28856
|
-
this._applyTransition(layerIndex, layerData, stateMachine, transition)
|
|
28857
|
-
|
|
29019
|
+
if (this._applyTransition(layerIndex, layerData, stateMachine, transition)) {
|
|
29020
|
+
return transition;
|
|
29021
|
+
} else {
|
|
29022
|
+
return null;
|
|
29023
|
+
}
|
|
28858
29024
|
}
|
|
28859
29025
|
}
|
|
28860
29026
|
};
|
|
@@ -28874,11 +29040,12 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
28874
29040
|
};
|
|
28875
29041
|
_proto._applyTransition = function _applyTransition(layerIndex, layerData, stateMachine, transition) {
|
|
28876
29042
|
// Need prepare first, it should crossFade when to exit
|
|
28877
|
-
this._prepareCrossFadeByTransition(transition, layerIndex);
|
|
29043
|
+
var success = this._prepareCrossFadeByTransition(transition, layerIndex);
|
|
28878
29044
|
if (transition.isExit) {
|
|
28879
29045
|
this._checkAnyAndEntryState(layerIndex, layerData, stateMachine);
|
|
28880
|
-
return;
|
|
29046
|
+
return true;
|
|
28881
29047
|
}
|
|
29048
|
+
return success;
|
|
28882
29049
|
};
|
|
28883
29050
|
_proto._checkConditions = function _checkConditions(state, transition) {
|
|
28884
29051
|
var _state;
|
|
@@ -28890,6 +29057,9 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
28890
29057
|
var pass = false;
|
|
28891
29058
|
var _conditions_i = conditions[i], mode = _conditions_i.mode, name1 = _conditions_i.parameterName, threshold = _conditions_i.threshold;
|
|
28892
29059
|
var parameter = this.getParameter(name1);
|
|
29060
|
+
if (!parameter) {
|
|
29061
|
+
return false;
|
|
29062
|
+
}
|
|
28893
29063
|
switch(mode){
|
|
28894
29064
|
case exports.AnimatorConditionMode.Equals:
|
|
28895
29065
|
if (parameter.value === threshold) {
|
|
@@ -34190,8 +34360,10 @@ exports.AnimationClipCurveBinding = AnimationClipCurveBinding;
|
|
|
34190
34360
|
exports.AnimationCurve = AnimationCurve;
|
|
34191
34361
|
exports.AnimationEvent = AnimationEvent;
|
|
34192
34362
|
exports.Animator = Animator;
|
|
34363
|
+
exports.AnimatorCondition = AnimatorCondition;
|
|
34193
34364
|
exports.AnimatorController = AnimatorController;
|
|
34194
34365
|
exports.AnimatorControllerLayer = AnimatorControllerLayer;
|
|
34366
|
+
exports.AnimatorControllerParameter = AnimatorControllerParameter;
|
|
34195
34367
|
exports.AnimatorLayerMask = AnimatorLayerMask;
|
|
34196
34368
|
exports.AnimatorState = AnimatorState;
|
|
34197
34369
|
exports.AnimatorStateMachine = AnimatorStateMachine;
|
|
@@ -34245,6 +34417,7 @@ exports.InputManager = InputManager;
|
|
|
34245
34417
|
exports.JointLimits = JointLimits;
|
|
34246
34418
|
exports.JointMotor = JointMotor;
|
|
34247
34419
|
exports.Keyframe = Keyframe;
|
|
34420
|
+
exports.LayerPathMask = LayerPathMask;
|
|
34248
34421
|
exports.Light = Light;
|
|
34249
34422
|
exports.Loader = Loader;
|
|
34250
34423
|
exports.Logger = Logger;
|
|
@@ -34280,6 +34453,7 @@ exports.RenderTargetBlendState = RenderTargetBlendState;
|
|
|
34280
34453
|
exports.ResourceManager = ResourceManager;
|
|
34281
34454
|
exports.ReturnableObjectPool = ReturnableObjectPool;
|
|
34282
34455
|
exports.RotationOverLifetimeModule = RotationOverLifetimeModule;
|
|
34456
|
+
exports.SafeLoopArray = SafeLoopArray;
|
|
34283
34457
|
exports.Scene = Scene;
|
|
34284
34458
|
exports.SceneManager = SceneManager;
|
|
34285
34459
|
exports.Script = Script;
|