@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/main.js
CHANGED
|
@@ -3000,6 +3000,45 @@ exports.ShaderPlatformTarget = void 0;
|
|
|
3000
3000
|
ShaderPlatformTarget[ShaderPlatformTarget["GLES300"] = 1] = "GLES300";
|
|
3001
3001
|
})(exports.ShaderPlatformTarget || (exports.ShaderPlatformTarget = {}));
|
|
3002
3002
|
|
|
3003
|
+
function _array_like_to_array(arr, len) {
|
|
3004
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3005
|
+
|
|
3006
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
3007
|
+
|
|
3008
|
+
return arr2;
|
|
3009
|
+
}
|
|
3010
|
+
|
|
3011
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
3012
|
+
if (!o) return;
|
|
3013
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
3014
|
+
|
|
3015
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3016
|
+
|
|
3017
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
3018
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
3019
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
3020
|
+
}
|
|
3021
|
+
|
|
3022
|
+
function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
3023
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
3024
|
+
|
|
3025
|
+
if (it) return (it = it.call(o)).next.bind(it);
|
|
3026
|
+
// Fallback for engines without symbol support
|
|
3027
|
+
if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
3028
|
+
if (it) o = it;
|
|
3029
|
+
|
|
3030
|
+
var i = 0;
|
|
3031
|
+
|
|
3032
|
+
return function() {
|
|
3033
|
+
if (i >= o.length) return { done: true };
|
|
3034
|
+
|
|
3035
|
+
return { done: false, value: o[i++] };
|
|
3036
|
+
};
|
|
3037
|
+
}
|
|
3038
|
+
|
|
3039
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3040
|
+
}
|
|
3041
|
+
|
|
3003
3042
|
/**
|
|
3004
3043
|
* Shader macro。
|
|
3005
3044
|
*/ var ShaderMacro = /*#__PURE__*/ function() {
|
|
@@ -3243,7 +3282,7 @@ function _extends() {
|
|
|
3243
3282
|
|
|
3244
3283
|
var camera_declare = "#define GLSLIFY 1\nuniform vec3 camera_Position;uniform vec3 camera_Forward;uniform vec4 camera_ProjectionParams;"; // eslint-disable-line
|
|
3245
3284
|
|
|
3246
|
-
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
|
|
3285
|
+
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
|
|
3247
3286
|
|
|
3248
3287
|
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
|
|
3249
3288
|
|
|
@@ -3335,7 +3374,7 @@ var brdf = "#define GLSLIFY 1\nfloat F_Schlick(float f0,float dotLH){return f0+0
|
|
|
3335
3374
|
|
|
3336
3375
|
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
|
|
3337
3376
|
|
|
3338
|
-
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
|
|
3377
|
+
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
|
|
3339
3378
|
|
|
3340
3379
|
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
|
|
3341
3380
|
|
|
@@ -4260,6 +4299,7 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
4260
4299
|
/** @internal */ _this._shaderPassId = 0;
|
|
4261
4300
|
/** @internal */ _this._renderStateDataMap = {};
|
|
4262
4301
|
/** @internal */ _this._shaderProgramPools = [];
|
|
4302
|
+
/** @internal */ _this._path = "";
|
|
4263
4303
|
_this._platformMacros = [];
|
|
4264
4304
|
_this._shaderPassId = ShaderPass._shaderPassCounter++;
|
|
4265
4305
|
_this._type = ShaderType.Canonical;
|
|
@@ -4321,23 +4361,24 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
4321
4361
|
/**
|
|
4322
4362
|
* Shader Lab compilation
|
|
4323
4363
|
*/ _proto._compileShaderProgram = function _compileShaderProgram(engine, macroCollection, vertexEntry, fragmentEntry) {
|
|
4364
|
+
var _this = this, path = _this._path, platformMacros = _this._platformMacros;
|
|
4324
4365
|
var isWebGL2 = engine._hardwareRenderer.isWebGL2;
|
|
4325
4366
|
var macros = new Array();
|
|
4326
4367
|
ShaderMacro._getMacrosElements(macroCollection, macros);
|
|
4327
|
-
|
|
4368
|
+
platformMacros.length = 0;
|
|
4328
4369
|
if (engine._hardwareRenderer.canIUse(exports.GLCapabilityType.shaderTextureLod)) {
|
|
4329
|
-
|
|
4370
|
+
platformMacros.push("HAS_TEX_LOD");
|
|
4330
4371
|
}
|
|
4331
4372
|
if (engine._hardwareRenderer.canIUse(exports.GLCapabilityType.standardDerivatives)) {
|
|
4332
|
-
|
|
4373
|
+
platformMacros.push("HAS_DERIVATIVES");
|
|
4333
4374
|
}
|
|
4334
4375
|
if (isWebGL2) {
|
|
4335
|
-
|
|
4376
|
+
platformMacros.push("GRAPHICS_API_WEBGL2");
|
|
4336
4377
|
} else {
|
|
4337
|
-
|
|
4378
|
+
platformMacros.push("GRAPHICS_API_WEBGL1");
|
|
4338
4379
|
}
|
|
4339
4380
|
var start = performance.now();
|
|
4340
|
-
var _Shader__shaderLab__parseShaderPass = Shader._shaderLab._parseShaderPass(this._shaderLabSource, vertexEntry, fragmentEntry, macros, isWebGL2 ? exports.ShaderPlatformTarget.GLES300 : exports.ShaderPlatformTarget.GLES100,
|
|
4381
|
+
var _Shader__shaderLab__parseShaderPass = Shader._shaderLab._parseShaderPass(this._shaderLabSource, vertexEntry, fragmentEntry, macros, isWebGL2 ? exports.ShaderPlatformTarget.GLES300 : exports.ShaderPlatformTarget.GLES100, platformMacros, new URL(path, ShaderPass._shaderRootPath).href), vertex = _Shader__shaderLab__parseShaderPass.vertex, fragment = _Shader__shaderLab__parseShaderPass.fragment;
|
|
4341
4382
|
Logger.info("[ShaderLab compilation] cost time: " + (performance.now() - start) + "ms");
|
|
4342
4383
|
return new ShaderProgram(engine, vertex, fragment);
|
|
4343
4384
|
};
|
|
@@ -4370,6 +4411,9 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
4370
4411
|
(function() {
|
|
4371
4412
|
ShaderPass._shaderPassCounter = 0;
|
|
4372
4413
|
})();
|
|
4414
|
+
(function() {
|
|
4415
|
+
/** @internal */ ShaderPass._shaderRootPath = "shaders://root/";
|
|
4416
|
+
})();
|
|
4373
4417
|
|
|
4374
4418
|
/**
|
|
4375
4419
|
* Sub shader.
|
|
@@ -5006,6 +5050,18 @@ __decorate([
|
|
|
5006
5050
|
}
|
|
5007
5051
|
var _proto = Shader.prototype;
|
|
5008
5052
|
/**
|
|
5053
|
+
* @internal
|
|
5054
|
+
* path should follow the specifications of [URL.origin](https://developer.mozilla.org/en-US/docs/Web/API/URL/origin), like: `shaders://root/`
|
|
5055
|
+
*/ _proto._registerPath = function _registerPath(path) {
|
|
5056
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this._subShaders), _step; !(_step = _iterator()).done;){
|
|
5057
|
+
var subShader = _step.value;
|
|
5058
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(subShader.passes), _step1; !(_step1 = _iterator1()).done;){
|
|
5059
|
+
var shaderPass = _step1.value;
|
|
5060
|
+
shaderPass._path = path;
|
|
5061
|
+
}
|
|
5062
|
+
}
|
|
5063
|
+
};
|
|
5064
|
+
/**
|
|
5009
5065
|
* Compile shader variant by macro name list.
|
|
5010
5066
|
*
|
|
5011
5067
|
* @remarks
|
|
@@ -10264,14 +10320,17 @@ var /**
|
|
|
10264
10320
|
var replacementSubShaders = replacementShader.subShaders;
|
|
10265
10321
|
var replacementTag = context.replacementTag;
|
|
10266
10322
|
if (replacementTag) {
|
|
10323
|
+
var replacementSuccess = false;
|
|
10267
10324
|
for(var j = 0, m = replacementSubShaders.length; j < m; j++){
|
|
10268
10325
|
var subShader = replacementSubShaders[j];
|
|
10269
10326
|
if (subShader.getTagValue(replacementTag) === materialSubShader.getTagValue(replacementTag)) {
|
|
10270
10327
|
this.pushRenderElementByType(renderElement, subRenderElement, subShader.passes, renderStates);
|
|
10271
|
-
|
|
10328
|
+
replacementSuccess = true;
|
|
10272
10329
|
}
|
|
10273
10330
|
}
|
|
10274
|
-
context.replacementFailureStrategy === exports.ReplacementFailureStrategy.KeepOriginalShader
|
|
10331
|
+
if (!replacementSuccess && context.replacementFailureStrategy === exports.ReplacementFailureStrategy.KeepOriginalShader) {
|
|
10332
|
+
this.pushRenderElementByType(renderElement, subRenderElement, materialSubShader.passes, renderStates);
|
|
10333
|
+
}
|
|
10275
10334
|
} else {
|
|
10276
10335
|
this.pushRenderElementByType(renderElement, subRenderElement, replacementSubShaders[0].passes, renderStates);
|
|
10277
10336
|
}
|
|
@@ -10855,7 +10914,7 @@ var /**
|
|
|
10855
10914
|
if (info) {
|
|
10856
10915
|
return info;
|
|
10857
10916
|
}
|
|
10858
|
-
info = TextUtils._measureFontOrChar(fontString);
|
|
10917
|
+
info = TextUtils._measureFontOrChar(fontString, TextUtils._measureString, false);
|
|
10859
10918
|
fontSizeInfoCache[fontString] = info;
|
|
10860
10919
|
return info;
|
|
10861
10920
|
};
|
|
@@ -10876,7 +10935,7 @@ var /**
|
|
|
10876
10935
|
return str;
|
|
10877
10936
|
};
|
|
10878
10937
|
TextUtils.measureChar = function measureChar(char, fontString) {
|
|
10879
|
-
return TextUtils._measureFontOrChar(fontString, char);
|
|
10938
|
+
return TextUtils._measureFontOrChar(fontString, char, true);
|
|
10880
10939
|
};
|
|
10881
10940
|
TextUtils.measureTextWithWrap = function measureTextWithWrap(renderer) {
|
|
10882
10941
|
var subFont = renderer._getSubFont();
|
|
@@ -11095,15 +11154,15 @@ var /**
|
|
|
11095
11154
|
};
|
|
11096
11155
|
/**
|
|
11097
11156
|
* @internal
|
|
11098
|
-
*/ TextUtils._measureFontOrChar = function _measureFontOrChar(fontString,
|
|
11099
|
-
if (char === void 0) char = "";
|
|
11157
|
+
*/ TextUtils._measureFontOrChar = function _measureFontOrChar(fontString, measureString, isChar) {
|
|
11100
11158
|
var _TextUtils_textContext = TextUtils.textContext(), canvas = _TextUtils_textContext.canvas, context = _TextUtils_textContext.context;
|
|
11101
11159
|
context.font = fontString;
|
|
11102
|
-
var measureString = char || TextUtils._measureString;
|
|
11103
11160
|
// Safari gets data confusion through getImageData when the canvas width is not an integer.
|
|
11104
11161
|
// The measure text width of some special invisible characters may be 0, so make sure the width is at least 1.
|
|
11105
11162
|
// @todo: Text layout may vary from standard and not support emoji.
|
|
11106
|
-
var
|
|
11163
|
+
var textMetrics = context.measureText(measureString);
|
|
11164
|
+
// In some case (ex: " "), actualBoundingBoxRight and actualBoundingBoxLeft will be 0, so use width.
|
|
11165
|
+
var width = Math.max(1, Math.round(textMetrics.actualBoundingBoxRight - textMetrics.actualBoundingBoxLeft || textMetrics.width));
|
|
11107
11166
|
var baseline = Math.ceil(context.measureText(TextUtils._measureBaseline).width);
|
|
11108
11167
|
var height = baseline * TextUtils._heightMultiplier;
|
|
11109
11168
|
baseline = TextUtils._baselineMultiplier * baseline | 0;
|
|
@@ -11148,12 +11207,7 @@ var /**
|
|
|
11148
11207
|
descent = bottom - baseline + 1;
|
|
11149
11208
|
size = ascent + descent;
|
|
11150
11209
|
}
|
|
11151
|
-
|
|
11152
|
-
ascent: ascent,
|
|
11153
|
-
descent: descent,
|
|
11154
|
-
size: size
|
|
11155
|
-
};
|
|
11156
|
-
if (char) {
|
|
11210
|
+
if (isChar) {
|
|
11157
11211
|
var data = null;
|
|
11158
11212
|
if (size > 0) {
|
|
11159
11213
|
var lineIntegerW = integerW * 4;
|
|
@@ -11161,7 +11215,7 @@ var /**
|
|
|
11161
11215
|
data = new Uint8Array(colorData.buffer, top * lineIntegerW, size * lineIntegerW);
|
|
11162
11216
|
}
|
|
11163
11217
|
return {
|
|
11164
|
-
char:
|
|
11218
|
+
char: measureString,
|
|
11165
11219
|
x: 0,
|
|
11166
11220
|
y: 0,
|
|
11167
11221
|
w: width,
|
|
@@ -11181,7 +11235,11 @@ var /**
|
|
|
11181
11235
|
data: data
|
|
11182
11236
|
};
|
|
11183
11237
|
} else {
|
|
11184
|
-
return
|
|
11238
|
+
return {
|
|
11239
|
+
ascent: ascent,
|
|
11240
|
+
descent: descent,
|
|
11241
|
+
size: size
|
|
11242
|
+
};
|
|
11185
11243
|
}
|
|
11186
11244
|
};
|
|
11187
11245
|
/**
|
|
@@ -17374,6 +17432,38 @@ var PrimitiveType;
|
|
|
17374
17432
|
PrimitiveMesh._spherePoleIdx = 0;
|
|
17375
17433
|
})();
|
|
17376
17434
|
|
|
17435
|
+
function _is_native_reflect_construct() {
|
|
17436
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
17437
|
+
if (Reflect.construct.sham) return false;
|
|
17438
|
+
if (typeof Proxy === "function") return true;
|
|
17439
|
+
|
|
17440
|
+
try {
|
|
17441
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
17442
|
+
|
|
17443
|
+
return true;
|
|
17444
|
+
} catch (e) {
|
|
17445
|
+
return false;
|
|
17446
|
+
}
|
|
17447
|
+
}
|
|
17448
|
+
|
|
17449
|
+
function _construct(Parent, args, Class) {
|
|
17450
|
+
if (_is_native_reflect_construct()) _construct = Reflect.construct;
|
|
17451
|
+
else {
|
|
17452
|
+
_construct = function construct(Parent, args, Class) {
|
|
17453
|
+
var a = [null];
|
|
17454
|
+
a.push.apply(a, args);
|
|
17455
|
+
var Constructor = Function.bind.apply(Parent, a);
|
|
17456
|
+
var instance = new Constructor();
|
|
17457
|
+
|
|
17458
|
+
if (Class) _set_prototype_of(instance, Class.prototype);
|
|
17459
|
+
|
|
17460
|
+
return instance;
|
|
17461
|
+
};
|
|
17462
|
+
}
|
|
17463
|
+
|
|
17464
|
+
return _construct.apply(null, arguments);
|
|
17465
|
+
}
|
|
17466
|
+
|
|
17377
17467
|
var ComponentCloner = /*#__PURE__*/ function() {
|
|
17378
17468
|
function ComponentCloner() {}
|
|
17379
17469
|
/**
|
|
@@ -17421,10 +17511,14 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
17421
17511
|
/**
|
|
17422
17512
|
* Add component based on the component type.
|
|
17423
17513
|
* @param type - The type of the component
|
|
17514
|
+
* @param args - The arguments of the component
|
|
17424
17515
|
* @returns The component which has been added
|
|
17425
17516
|
*/ _proto.addComponent = function addComponent(type) {
|
|
17517
|
+
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
17518
|
+
args[_key - 1] = arguments[_key];
|
|
17519
|
+
}
|
|
17426
17520
|
ComponentsDependencies._addCheck(this, type);
|
|
17427
|
-
var component =
|
|
17521
|
+
var component = _construct(type, [].concat(this, args));
|
|
17428
17522
|
this._components.push(component);
|
|
17429
17523
|
component._setActive(true, ActiveChangeFlag.All);
|
|
17430
17524
|
return component;
|
|
@@ -18950,6 +19044,15 @@ var SafeLoopArray = /*#__PURE__*/ function() {
|
|
|
18950
19044
|
this._loopArrayDirty = true;
|
|
18951
19045
|
};
|
|
18952
19046
|
/**
|
|
19047
|
+
* Remove item from array that pass the specified comparison function.
|
|
19048
|
+
* @param filter - The comparison function
|
|
19049
|
+
*/ _proto.findAndRemove = function findAndRemove(filter) {
|
|
19050
|
+
var array = this._array;
|
|
19051
|
+
for(var i = array.length - 1; i >= 0; i--){
|
|
19052
|
+
filter(array[i]) && this.removeByIndex(i);
|
|
19053
|
+
}
|
|
19054
|
+
};
|
|
19055
|
+
/**
|
|
18953
19056
|
* The index of the item.
|
|
18954
19057
|
* @param item - The item which want to get the index
|
|
18955
19058
|
* @returns Index of the item
|
|
@@ -19383,17 +19486,35 @@ var /** @internal */ PromiseState;
|
|
|
19383
19486
|
};
|
|
19384
19487
|
/**
|
|
19385
19488
|
* @internal
|
|
19386
|
-
*/ _proto._onSubAssetSuccess = function _onSubAssetSuccess(
|
|
19387
|
-
var
|
|
19388
|
-
(
|
|
19389
|
-
|
|
19489
|
+
*/ _proto._onSubAssetSuccess = function _onSubAssetSuccess(assetBaseURL, assetSubPath, value) {
|
|
19490
|
+
var _this__subAssetPromiseCallbacks_assetBaseURL;
|
|
19491
|
+
var subPromiseCallback = (_this__subAssetPromiseCallbacks_assetBaseURL = this._subAssetPromiseCallbacks[assetBaseURL]) == null ? void 0 : _this__subAssetPromiseCallbacks_assetBaseURL[assetSubPath];
|
|
19492
|
+
if (subPromiseCallback) {
|
|
19493
|
+
// Already resolved
|
|
19494
|
+
subPromiseCallback.resolve(value);
|
|
19495
|
+
} else {
|
|
19496
|
+
var // Pending
|
|
19497
|
+
_this__subAssetPromiseCallbacks, _assetBaseURL;
|
|
19498
|
+
((_this__subAssetPromiseCallbacks = this._subAssetPromiseCallbacks)[_assetBaseURL = assetBaseURL] || (_this__subAssetPromiseCallbacks[_assetBaseURL] = {}))[assetSubPath] = {
|
|
19499
|
+
resolve: value
|
|
19500
|
+
};
|
|
19501
|
+
}
|
|
19390
19502
|
};
|
|
19391
19503
|
/**
|
|
19392
19504
|
* @internal
|
|
19393
|
-
*/ _proto._onSubAssetFail = function _onSubAssetFail(
|
|
19394
|
-
var
|
|
19395
|
-
(
|
|
19396
|
-
|
|
19505
|
+
*/ _proto._onSubAssetFail = function _onSubAssetFail(assetBaseURL, assetSubPath, value) {
|
|
19506
|
+
var _this__subAssetPromiseCallbacks_assetBaseURL;
|
|
19507
|
+
var subPromiseCallback = (_this__subAssetPromiseCallbacks_assetBaseURL = this._subAssetPromiseCallbacks[assetBaseURL]) == null ? void 0 : _this__subAssetPromiseCallbacks_assetBaseURL[assetSubPath];
|
|
19508
|
+
if (subPromiseCallback) {
|
|
19509
|
+
// Already rejected
|
|
19510
|
+
subPromiseCallback.reject(value);
|
|
19511
|
+
} else {
|
|
19512
|
+
var // Pending
|
|
19513
|
+
_this__subAssetPromiseCallbacks, _assetBaseURL;
|
|
19514
|
+
((_this__subAssetPromiseCallbacks = this._subAssetPromiseCallbacks)[_assetBaseURL = assetBaseURL] || (_this__subAssetPromiseCallbacks[_assetBaseURL] = {}))[assetSubPath] = {
|
|
19515
|
+
reject: value
|
|
19516
|
+
};
|
|
19517
|
+
}
|
|
19397
19518
|
};
|
|
19398
19519
|
/**
|
|
19399
19520
|
* @internal
|
|
@@ -19538,8 +19659,21 @@ var /** @internal */ PromiseState;
|
|
|
19538
19659
|
if (!loader) {
|
|
19539
19660
|
throw "loader not found: " + item.type;
|
|
19540
19661
|
}
|
|
19541
|
-
//
|
|
19662
|
+
// Check sub asset
|
|
19663
|
+
if (queryPath) {
|
|
19664
|
+
// Check whether load main asset
|
|
19665
|
+
var mainPromise = loadingPromises[assetBaseURL] || this._loadMainAsset(loader, item, assetBaseURL);
|
|
19666
|
+
mainPromise.catch(function(e) {
|
|
19667
|
+
_this._onSubAssetFail(assetBaseURL, queryPath, e);
|
|
19668
|
+
});
|
|
19669
|
+
return this._createSubAssetPromiseCallback(assetBaseURL, assetURL, queryPath);
|
|
19670
|
+
}
|
|
19671
|
+
return this._loadMainAsset(loader, item, assetBaseURL);
|
|
19672
|
+
};
|
|
19673
|
+
_proto._loadMainAsset = function _loadMainAsset(loader, item, assetBaseURL) {
|
|
19674
|
+
var _this = this;
|
|
19542
19675
|
item.url = assetBaseURL;
|
|
19676
|
+
var loadingPromises = this._loadingPromises;
|
|
19543
19677
|
var promise = loader.load(item, this);
|
|
19544
19678
|
loadingPromises[assetBaseURL] = promise;
|
|
19545
19679
|
promise.then(function(resource) {
|
|
@@ -19547,32 +19681,46 @@ var /** @internal */ PromiseState;
|
|
|
19547
19681
|
_this._addAsset(assetBaseURL, resource);
|
|
19548
19682
|
}
|
|
19549
19683
|
delete loadingPromises[assetBaseURL];
|
|
19684
|
+
_this._releaseSubAssetPromiseCallback(assetBaseURL);
|
|
19550
19685
|
}, function() {
|
|
19551
|
-
|
|
19686
|
+
delete loadingPromises[assetBaseURL];
|
|
19687
|
+
_this._releaseSubAssetPromiseCallback(assetBaseURL);
|
|
19552
19688
|
});
|
|
19553
|
-
|
|
19554
|
-
|
|
19555
|
-
|
|
19556
|
-
|
|
19557
|
-
|
|
19558
|
-
|
|
19689
|
+
return promise;
|
|
19690
|
+
};
|
|
19691
|
+
_proto._createSubAssetPromiseCallback = function _createSubAssetPromiseCallback(assetBaseURL, assetURL, assetSubPath) {
|
|
19692
|
+
var _this = this;
|
|
19693
|
+
var _this__subAssetPromiseCallbacks_assetBaseURL, _subPromiseCallback, _subPromiseCallback1;
|
|
19694
|
+
var loadingPromises = this._loadingPromises;
|
|
19695
|
+
var subPromiseCallback = (_this__subAssetPromiseCallbacks_assetBaseURL = this._subAssetPromiseCallbacks[assetBaseURL]) == null ? void 0 : _this__subAssetPromiseCallbacks_assetBaseURL[assetSubPath];
|
|
19696
|
+
var resolvedValue = (_subPromiseCallback = subPromiseCallback) == null ? void 0 : _subPromiseCallback.resolve;
|
|
19697
|
+
var rejectedValue = (_subPromiseCallback1 = subPromiseCallback) == null ? void 0 : _subPromiseCallback1.reject;
|
|
19698
|
+
var promise = new AssetPromise(function(resolve, reject) {
|
|
19699
|
+
if (resolvedValue) {
|
|
19700
|
+
// Already resolved
|
|
19701
|
+
resolve(resolvedValue);
|
|
19702
|
+
} else if (rejectedValue) {
|
|
19703
|
+
// Already rejected
|
|
19704
|
+
reject(rejectedValue);
|
|
19705
|
+
} else {
|
|
19706
|
+
var _this__subAssetPromiseCallbacks, _assetBaseURL;
|
|
19707
|
+
// Pending
|
|
19708
|
+
loadingPromises[assetURL] = promise;
|
|
19709
|
+
((_this__subAssetPromiseCallbacks = _this._subAssetPromiseCallbacks)[_assetBaseURL = assetBaseURL] || (_this__subAssetPromiseCallbacks[_assetBaseURL] = {}))[assetSubPath] = {
|
|
19710
|
+
resolve: resolve,
|
|
19711
|
+
reject: reject
|
|
19712
|
+
};
|
|
19713
|
+
}
|
|
19714
|
+
});
|
|
19715
|
+
if (!resolvedValue && !rejectedValue) {
|
|
19716
|
+
promise.then(function() {
|
|
19559
19717
|
delete loadingPromises[assetURL];
|
|
19560
19718
|
}, function() {
|
|
19561
19719
|
return delete loadingPromises[assetURL];
|
|
19562
19720
|
});
|
|
19563
|
-
promise.catch(function(e) {
|
|
19564
|
-
_this._onSubAssetFail(assetURL, e);
|
|
19565
|
-
});
|
|
19566
|
-
return subPromise;
|
|
19567
19721
|
}
|
|
19568
19722
|
return promise;
|
|
19569
19723
|
};
|
|
19570
|
-
_proto._pushSubAssetPromiseCallback = function _pushSubAssetPromiseCallback(assetURL, resolve, reject) {
|
|
19571
|
-
this._subAssetPromiseCallbacks[assetURL] = {
|
|
19572
|
-
resolve: resolve,
|
|
19573
|
-
reject: reject
|
|
19574
|
-
};
|
|
19575
|
-
};
|
|
19576
19724
|
_proto._gc = function _gc(forceDestroy) {
|
|
19577
19725
|
var objects = Utils.objectValues(this._referResourcePool);
|
|
19578
19726
|
for(var i = 0, n = objects.length; i < n; i++){
|
|
@@ -19629,6 +19777,9 @@ var /** @internal */ PromiseState;
|
|
|
19629
19777
|
});
|
|
19630
19778
|
return result;
|
|
19631
19779
|
};
|
|
19780
|
+
_proto._releaseSubAssetPromiseCallback = function _releaseSubAssetPromiseCallback(assetBaseURL) {
|
|
19781
|
+
delete this._subAssetPromiseCallbacks[assetBaseURL];
|
|
19782
|
+
};
|
|
19632
19783
|
/**
|
|
19633
19784
|
* @internal
|
|
19634
19785
|
* @beta Just for internal editor, not recommended for developers.
|
|
@@ -24423,9 +24574,9 @@ ShaderPool.init();
|
|
|
24423
24574
|
/** Shadow bias.*/ _this.shadowBias = 1;
|
|
24424
24575
|
/** Shadow mapping normal-based bias. */ _this.shadowNormalBias = 1;
|
|
24425
24576
|
/** Near plane value to use for shadow frustums. */ _this.shadowNearPlane = 0.1;
|
|
24426
|
-
/** Shadow intensity, the larger the value, the clearer and darker the shadow. */ _this.shadowStrength = 1.0;
|
|
24427
24577
|
/** @internal */ _this._lightIndex = -1;
|
|
24428
24578
|
/** @internal */ _this._lightColor = new engineMath.Color();
|
|
24579
|
+
_this._shadowStrength = 1.0;
|
|
24429
24580
|
_this._color = new engineMath.Color(1, 1, 1, 1);
|
|
24430
24581
|
return _this;
|
|
24431
24582
|
}
|
|
@@ -24441,6 +24592,15 @@ ShaderPool.init();
|
|
|
24441
24592
|
return this._lightColor;
|
|
24442
24593
|
};
|
|
24443
24594
|
_create_class(Light, [
|
|
24595
|
+
{
|
|
24596
|
+
key: "shadowStrength",
|
|
24597
|
+
get: /** Shadow intensity, the larger the value, the clearer and darker the shadow, range [0,1]. */ function get() {
|
|
24598
|
+
return this._shadowStrength;
|
|
24599
|
+
},
|
|
24600
|
+
set: function set(value) {
|
|
24601
|
+
this._shadowStrength = engineMath.MathUtil.clamp(value, 0, 1);
|
|
24602
|
+
}
|
|
24603
|
+
},
|
|
24444
24604
|
{
|
|
24445
24605
|
key: "color",
|
|
24446
24606
|
get: /**
|
|
@@ -25156,7 +25316,7 @@ var BloomEffect = /*#__PURE__*/ function() {
|
|
|
25156
25316
|
return this._scatter;
|
|
25157
25317
|
},
|
|
25158
25318
|
set: function set(value) {
|
|
25159
|
-
value =
|
|
25319
|
+
value = engineMath.MathUtil.clamp(value, 0, 1);
|
|
25160
25320
|
if (value !== this._scatter) {
|
|
25161
25321
|
this._scatter = value;
|
|
25162
25322
|
var params = this._bloomMaterial.shaderData.getVector4(BloomEffect._bloomParams);
|
|
@@ -28264,10 +28424,7 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
28264
28424
|
/**
|
|
28265
28425
|
* @internal
|
|
28266
28426
|
*/ _proto._onEnable = function _onEnable() {
|
|
28267
|
-
|
|
28268
|
-
for(var i = 0, n = layersData.length; i < n; i++){
|
|
28269
|
-
layersData[i].layerState = LayerState.Standby;
|
|
28270
|
-
}
|
|
28427
|
+
this._reset();
|
|
28271
28428
|
this._entity.getComponentsIncludeChildren(exports.Renderer, this._controlledRenderers);
|
|
28272
28429
|
};
|
|
28273
28430
|
/**
|
|
@@ -28821,8 +28978,11 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
28821
28978
|
if (exitTime >= lastClipTime) {
|
|
28822
28979
|
playState.currentTransitionIndex = Math.min(transitionIndex + 1, n - 1);
|
|
28823
28980
|
if (this._checkConditions(state, transition)) {
|
|
28824
|
-
this._applyTransition(layerIndex, layerData, stateMachine, transition)
|
|
28825
|
-
|
|
28981
|
+
if (this._applyTransition(layerIndex, layerData, stateMachine, transition)) {
|
|
28982
|
+
return transition;
|
|
28983
|
+
} else {
|
|
28984
|
+
return null;
|
|
28985
|
+
}
|
|
28826
28986
|
}
|
|
28827
28987
|
}
|
|
28828
28988
|
}
|
|
@@ -28841,8 +29001,11 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
28841
29001
|
if (exitTime <= lastClipTime) {
|
|
28842
29002
|
playState.currentTransitionIndex = Math.max(transitionIndex - 1, 0);
|
|
28843
29003
|
if (this._checkConditions(state, transition)) {
|
|
28844
|
-
this._applyTransition(layerIndex, layerData, stateMachine, transition)
|
|
28845
|
-
|
|
29004
|
+
if (this._applyTransition(layerIndex, layerData, stateMachine, transition)) {
|
|
29005
|
+
return transition;
|
|
29006
|
+
} else {
|
|
29007
|
+
return null;
|
|
29008
|
+
}
|
|
28846
29009
|
}
|
|
28847
29010
|
}
|
|
28848
29011
|
}
|
|
@@ -28852,8 +29015,11 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
28852
29015
|
for(var i = 0, n = transitions.length; i < n; i++){
|
|
28853
29016
|
var transition = transitions[i];
|
|
28854
29017
|
if (this._checkConditions(state, transition)) {
|
|
28855
|
-
this._applyTransition(layerIndex, layerData, stateMachine, transition)
|
|
28856
|
-
|
|
29018
|
+
if (this._applyTransition(layerIndex, layerData, stateMachine, transition)) {
|
|
29019
|
+
return transition;
|
|
29020
|
+
} else {
|
|
29021
|
+
return null;
|
|
29022
|
+
}
|
|
28857
29023
|
}
|
|
28858
29024
|
}
|
|
28859
29025
|
};
|
|
@@ -28873,11 +29039,12 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
28873
29039
|
};
|
|
28874
29040
|
_proto._applyTransition = function _applyTransition(layerIndex, layerData, stateMachine, transition) {
|
|
28875
29041
|
// Need prepare first, it should crossFade when to exit
|
|
28876
|
-
this._prepareCrossFadeByTransition(transition, layerIndex);
|
|
29042
|
+
var success = this._prepareCrossFadeByTransition(transition, layerIndex);
|
|
28877
29043
|
if (transition.isExit) {
|
|
28878
29044
|
this._checkAnyAndEntryState(layerIndex, layerData, stateMachine);
|
|
28879
|
-
return;
|
|
29045
|
+
return true;
|
|
28880
29046
|
}
|
|
29047
|
+
return success;
|
|
28881
29048
|
};
|
|
28882
29049
|
_proto._checkConditions = function _checkConditions(state, transition) {
|
|
28883
29050
|
var _state;
|
|
@@ -28889,6 +29056,9 @@ exports.AnimatorLayerBlendingMode = void 0;
|
|
|
28889
29056
|
var pass = false;
|
|
28890
29057
|
var _conditions_i = conditions[i], mode = _conditions_i.mode, name1 = _conditions_i.parameterName, threshold = _conditions_i.threshold;
|
|
28891
29058
|
var parameter = this.getParameter(name1);
|
|
29059
|
+
if (!parameter) {
|
|
29060
|
+
return false;
|
|
29061
|
+
}
|
|
28892
29062
|
switch(mode){
|
|
28893
29063
|
case exports.AnimatorConditionMode.Equals:
|
|
28894
29064
|
if (parameter.value === threshold) {
|
|
@@ -34189,8 +34359,10 @@ exports.AnimationClipCurveBinding = AnimationClipCurveBinding;
|
|
|
34189
34359
|
exports.AnimationCurve = AnimationCurve;
|
|
34190
34360
|
exports.AnimationEvent = AnimationEvent;
|
|
34191
34361
|
exports.Animator = Animator;
|
|
34362
|
+
exports.AnimatorCondition = AnimatorCondition;
|
|
34192
34363
|
exports.AnimatorController = AnimatorController;
|
|
34193
34364
|
exports.AnimatorControllerLayer = AnimatorControllerLayer;
|
|
34365
|
+
exports.AnimatorControllerParameter = AnimatorControllerParameter;
|
|
34194
34366
|
exports.AnimatorLayerMask = AnimatorLayerMask;
|
|
34195
34367
|
exports.AnimatorState = AnimatorState;
|
|
34196
34368
|
exports.AnimatorStateMachine = AnimatorStateMachine;
|
|
@@ -34244,6 +34416,7 @@ exports.InputManager = InputManager;
|
|
|
34244
34416
|
exports.JointLimits = JointLimits;
|
|
34245
34417
|
exports.JointMotor = JointMotor;
|
|
34246
34418
|
exports.Keyframe = Keyframe;
|
|
34419
|
+
exports.LayerPathMask = LayerPathMask;
|
|
34247
34420
|
exports.Light = Light;
|
|
34248
34421
|
exports.Loader = Loader;
|
|
34249
34422
|
exports.Logger = Logger;
|
|
@@ -34279,6 +34452,7 @@ exports.RenderTargetBlendState = RenderTargetBlendState;
|
|
|
34279
34452
|
exports.ResourceManager = ResourceManager;
|
|
34280
34453
|
exports.ReturnableObjectPool = ReturnableObjectPool;
|
|
34281
34454
|
exports.RotationOverLifetimeModule = RotationOverLifetimeModule;
|
|
34455
|
+
exports.SafeLoopArray = SafeLoopArray;
|
|
34282
34456
|
exports.Scene = Scene;
|
|
34283
34457
|
exports.SceneManager = SceneManager;
|
|
34284
34458
|
exports.Script = Script;
|