@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/module.js
CHANGED
|
@@ -2996,6 +2996,45 @@ var ShaderPlatformTarget;
|
|
|
2996
2996
|
ShaderPlatformTarget[ShaderPlatformTarget["GLES300"] = 1] = "GLES300";
|
|
2997
2997
|
})(ShaderPlatformTarget || (ShaderPlatformTarget = {}));
|
|
2998
2998
|
|
|
2999
|
+
function _array_like_to_array(arr, len) {
|
|
3000
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3001
|
+
|
|
3002
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
3003
|
+
|
|
3004
|
+
return arr2;
|
|
3005
|
+
}
|
|
3006
|
+
|
|
3007
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
3008
|
+
if (!o) return;
|
|
3009
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
3010
|
+
|
|
3011
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3012
|
+
|
|
3013
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
3014
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
3015
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
3016
|
+
}
|
|
3017
|
+
|
|
3018
|
+
function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
3019
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
3020
|
+
|
|
3021
|
+
if (it) return (it = it.call(o)).next.bind(it);
|
|
3022
|
+
// Fallback for engines without symbol support
|
|
3023
|
+
if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
3024
|
+
if (it) o = it;
|
|
3025
|
+
|
|
3026
|
+
var i = 0;
|
|
3027
|
+
|
|
3028
|
+
return function() {
|
|
3029
|
+
if (i >= o.length) return { done: true };
|
|
3030
|
+
|
|
3031
|
+
return { done: false, value: o[i++] };
|
|
3032
|
+
};
|
|
3033
|
+
}
|
|
3034
|
+
|
|
3035
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3036
|
+
}
|
|
3037
|
+
|
|
2999
3038
|
/**
|
|
3000
3039
|
* Shader macro。
|
|
3001
3040
|
*/ var ShaderMacro = /*#__PURE__*/ function() {
|
|
@@ -3239,7 +3278,7 @@ function _extends() {
|
|
|
3239
3278
|
|
|
3240
3279
|
var camera_declare = "#define GLSLIFY 1\nuniform vec3 camera_Position;uniform vec3 camera_Forward;uniform vec4 camera_ProjectionParams;"; // eslint-disable-line
|
|
3241
3280
|
|
|
3242
|
-
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
|
|
3281
|
+
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
|
|
3243
3282
|
|
|
3244
3283
|
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
|
|
3245
3284
|
|
|
@@ -3331,7 +3370,7 @@ var brdf = "#define GLSLIFY 1\nfloat F_Schlick(float f0,float dotLH){return f0+0
|
|
|
3331
3370
|
|
|
3332
3371
|
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
|
|
3333
3372
|
|
|
3334
|
-
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
|
|
3373
|
+
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
|
|
3335
3374
|
|
|
3336
3375
|
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
|
|
3337
3376
|
|
|
@@ -4256,6 +4295,7 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
4256
4295
|
/** @internal */ _this._shaderPassId = 0;
|
|
4257
4296
|
/** @internal */ _this._renderStateDataMap = {};
|
|
4258
4297
|
/** @internal */ _this._shaderProgramPools = [];
|
|
4298
|
+
/** @internal */ _this._path = "";
|
|
4259
4299
|
_this._platformMacros = [];
|
|
4260
4300
|
_this._shaderPassId = ShaderPass._shaderPassCounter++;
|
|
4261
4301
|
_this._type = ShaderType.Canonical;
|
|
@@ -4317,23 +4357,24 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
4317
4357
|
/**
|
|
4318
4358
|
* Shader Lab compilation
|
|
4319
4359
|
*/ _proto._compileShaderProgram = function _compileShaderProgram(engine, macroCollection, vertexEntry, fragmentEntry) {
|
|
4360
|
+
var _this = this, path = _this._path, platformMacros = _this._platformMacros;
|
|
4320
4361
|
var isWebGL2 = engine._hardwareRenderer.isWebGL2;
|
|
4321
4362
|
var macros = new Array();
|
|
4322
4363
|
ShaderMacro._getMacrosElements(macroCollection, macros);
|
|
4323
|
-
|
|
4364
|
+
platformMacros.length = 0;
|
|
4324
4365
|
if (engine._hardwareRenderer.canIUse(GLCapabilityType.shaderTextureLod)) {
|
|
4325
|
-
|
|
4366
|
+
platformMacros.push("HAS_TEX_LOD");
|
|
4326
4367
|
}
|
|
4327
4368
|
if (engine._hardwareRenderer.canIUse(GLCapabilityType.standardDerivatives)) {
|
|
4328
|
-
|
|
4369
|
+
platformMacros.push("HAS_DERIVATIVES");
|
|
4329
4370
|
}
|
|
4330
4371
|
if (isWebGL2) {
|
|
4331
|
-
|
|
4372
|
+
platformMacros.push("GRAPHICS_API_WEBGL2");
|
|
4332
4373
|
} else {
|
|
4333
|
-
|
|
4374
|
+
platformMacros.push("GRAPHICS_API_WEBGL1");
|
|
4334
4375
|
}
|
|
4335
4376
|
var start = performance.now();
|
|
4336
|
-
var _Shader__shaderLab__parseShaderPass = Shader._shaderLab._parseShaderPass(this._shaderLabSource, vertexEntry, fragmentEntry, macros, isWebGL2 ? ShaderPlatformTarget.GLES300 : ShaderPlatformTarget.GLES100,
|
|
4377
|
+
var _Shader__shaderLab__parseShaderPass = Shader._shaderLab._parseShaderPass(this._shaderLabSource, vertexEntry, fragmentEntry, macros, isWebGL2 ? ShaderPlatformTarget.GLES300 : ShaderPlatformTarget.GLES100, platformMacros, new URL(path, ShaderPass._shaderRootPath).href), vertex = _Shader__shaderLab__parseShaderPass.vertex, fragment = _Shader__shaderLab__parseShaderPass.fragment;
|
|
4337
4378
|
Logger.info("[ShaderLab compilation] cost time: " + (performance.now() - start) + "ms");
|
|
4338
4379
|
return new ShaderProgram(engine, vertex, fragment);
|
|
4339
4380
|
};
|
|
@@ -4366,6 +4407,9 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
4366
4407
|
(function() {
|
|
4367
4408
|
ShaderPass._shaderPassCounter = 0;
|
|
4368
4409
|
})();
|
|
4410
|
+
(function() {
|
|
4411
|
+
/** @internal */ ShaderPass._shaderRootPath = "shaders://root/";
|
|
4412
|
+
})();
|
|
4369
4413
|
|
|
4370
4414
|
/**
|
|
4371
4415
|
* Sub shader.
|
|
@@ -5002,6 +5046,18 @@ __decorate([
|
|
|
5002
5046
|
}
|
|
5003
5047
|
var _proto = Shader.prototype;
|
|
5004
5048
|
/**
|
|
5049
|
+
* @internal
|
|
5050
|
+
* path should follow the specifications of [URL.origin](https://developer.mozilla.org/en-US/docs/Web/API/URL/origin), like: `shaders://root/`
|
|
5051
|
+
*/ _proto._registerPath = function _registerPath(path) {
|
|
5052
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this._subShaders), _step; !(_step = _iterator()).done;){
|
|
5053
|
+
var subShader = _step.value;
|
|
5054
|
+
for(var _iterator1 = _create_for_of_iterator_helper_loose(subShader.passes), _step1; !(_step1 = _iterator1()).done;){
|
|
5055
|
+
var shaderPass = _step1.value;
|
|
5056
|
+
shaderPass._path = path;
|
|
5057
|
+
}
|
|
5058
|
+
}
|
|
5059
|
+
};
|
|
5060
|
+
/**
|
|
5005
5061
|
* Compile shader variant by macro name list.
|
|
5006
5062
|
*
|
|
5007
5063
|
* @remarks
|
|
@@ -10260,14 +10316,17 @@ var /**
|
|
|
10260
10316
|
var replacementSubShaders = replacementShader.subShaders;
|
|
10261
10317
|
var replacementTag = context.replacementTag;
|
|
10262
10318
|
if (replacementTag) {
|
|
10319
|
+
var replacementSuccess = false;
|
|
10263
10320
|
for(var j = 0, m = replacementSubShaders.length; j < m; j++){
|
|
10264
10321
|
var subShader = replacementSubShaders[j];
|
|
10265
10322
|
if (subShader.getTagValue(replacementTag) === materialSubShader.getTagValue(replacementTag)) {
|
|
10266
10323
|
this.pushRenderElementByType(renderElement, subRenderElement, subShader.passes, renderStates);
|
|
10267
|
-
|
|
10324
|
+
replacementSuccess = true;
|
|
10268
10325
|
}
|
|
10269
10326
|
}
|
|
10270
|
-
context.replacementFailureStrategy === ReplacementFailureStrategy.KeepOriginalShader
|
|
10327
|
+
if (!replacementSuccess && context.replacementFailureStrategy === ReplacementFailureStrategy.KeepOriginalShader) {
|
|
10328
|
+
this.pushRenderElementByType(renderElement, subRenderElement, materialSubShader.passes, renderStates);
|
|
10329
|
+
}
|
|
10271
10330
|
} else {
|
|
10272
10331
|
this.pushRenderElementByType(renderElement, subRenderElement, replacementSubShaders[0].passes, renderStates);
|
|
10273
10332
|
}
|
|
@@ -10851,7 +10910,7 @@ var /**
|
|
|
10851
10910
|
if (info) {
|
|
10852
10911
|
return info;
|
|
10853
10912
|
}
|
|
10854
|
-
info = TextUtils._measureFontOrChar(fontString);
|
|
10913
|
+
info = TextUtils._measureFontOrChar(fontString, TextUtils._measureString, false);
|
|
10855
10914
|
fontSizeInfoCache[fontString] = info;
|
|
10856
10915
|
return info;
|
|
10857
10916
|
};
|
|
@@ -10872,7 +10931,7 @@ var /**
|
|
|
10872
10931
|
return str;
|
|
10873
10932
|
};
|
|
10874
10933
|
TextUtils.measureChar = function measureChar(char, fontString) {
|
|
10875
|
-
return TextUtils._measureFontOrChar(fontString, char);
|
|
10934
|
+
return TextUtils._measureFontOrChar(fontString, char, true);
|
|
10876
10935
|
};
|
|
10877
10936
|
TextUtils.measureTextWithWrap = function measureTextWithWrap(renderer) {
|
|
10878
10937
|
var subFont = renderer._getSubFont();
|
|
@@ -11091,15 +11150,15 @@ var /**
|
|
|
11091
11150
|
};
|
|
11092
11151
|
/**
|
|
11093
11152
|
* @internal
|
|
11094
|
-
*/ TextUtils._measureFontOrChar = function _measureFontOrChar(fontString,
|
|
11095
|
-
if (char === void 0) char = "";
|
|
11153
|
+
*/ TextUtils._measureFontOrChar = function _measureFontOrChar(fontString, measureString, isChar) {
|
|
11096
11154
|
var _TextUtils_textContext = TextUtils.textContext(), canvas = _TextUtils_textContext.canvas, context = _TextUtils_textContext.context;
|
|
11097
11155
|
context.font = fontString;
|
|
11098
|
-
var measureString = char || TextUtils._measureString;
|
|
11099
11156
|
// Safari gets data confusion through getImageData when the canvas width is not an integer.
|
|
11100
11157
|
// The measure text width of some special invisible characters may be 0, so make sure the width is at least 1.
|
|
11101
11158
|
// @todo: Text layout may vary from standard and not support emoji.
|
|
11102
|
-
var
|
|
11159
|
+
var textMetrics = context.measureText(measureString);
|
|
11160
|
+
// In some case (ex: " "), actualBoundingBoxRight and actualBoundingBoxLeft will be 0, so use width.
|
|
11161
|
+
var width = Math.max(1, Math.round(textMetrics.actualBoundingBoxRight - textMetrics.actualBoundingBoxLeft || textMetrics.width));
|
|
11103
11162
|
var baseline = Math.ceil(context.measureText(TextUtils._measureBaseline).width);
|
|
11104
11163
|
var height = baseline * TextUtils._heightMultiplier;
|
|
11105
11164
|
baseline = TextUtils._baselineMultiplier * baseline | 0;
|
|
@@ -11144,12 +11203,7 @@ var /**
|
|
|
11144
11203
|
descent = bottom - baseline + 1;
|
|
11145
11204
|
size = ascent + descent;
|
|
11146
11205
|
}
|
|
11147
|
-
|
|
11148
|
-
ascent: ascent,
|
|
11149
|
-
descent: descent,
|
|
11150
|
-
size: size
|
|
11151
|
-
};
|
|
11152
|
-
if (char) {
|
|
11206
|
+
if (isChar) {
|
|
11153
11207
|
var data = null;
|
|
11154
11208
|
if (size > 0) {
|
|
11155
11209
|
var lineIntegerW = integerW * 4;
|
|
@@ -11157,7 +11211,7 @@ var /**
|
|
|
11157
11211
|
data = new Uint8Array(colorData.buffer, top * lineIntegerW, size * lineIntegerW);
|
|
11158
11212
|
}
|
|
11159
11213
|
return {
|
|
11160
|
-
char:
|
|
11214
|
+
char: measureString,
|
|
11161
11215
|
x: 0,
|
|
11162
11216
|
y: 0,
|
|
11163
11217
|
w: width,
|
|
@@ -11177,7 +11231,11 @@ var /**
|
|
|
11177
11231
|
data: data
|
|
11178
11232
|
};
|
|
11179
11233
|
} else {
|
|
11180
|
-
return
|
|
11234
|
+
return {
|
|
11235
|
+
ascent: ascent,
|
|
11236
|
+
descent: descent,
|
|
11237
|
+
size: size
|
|
11238
|
+
};
|
|
11181
11239
|
}
|
|
11182
11240
|
};
|
|
11183
11241
|
/**
|
|
@@ -17370,6 +17428,38 @@ var PrimitiveType;
|
|
|
17370
17428
|
PrimitiveMesh._spherePoleIdx = 0;
|
|
17371
17429
|
})();
|
|
17372
17430
|
|
|
17431
|
+
function _is_native_reflect_construct() {
|
|
17432
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
17433
|
+
if (Reflect.construct.sham) return false;
|
|
17434
|
+
if (typeof Proxy === "function") return true;
|
|
17435
|
+
|
|
17436
|
+
try {
|
|
17437
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
17438
|
+
|
|
17439
|
+
return true;
|
|
17440
|
+
} catch (e) {
|
|
17441
|
+
return false;
|
|
17442
|
+
}
|
|
17443
|
+
}
|
|
17444
|
+
|
|
17445
|
+
function _construct(Parent, args, Class) {
|
|
17446
|
+
if (_is_native_reflect_construct()) _construct = Reflect.construct;
|
|
17447
|
+
else {
|
|
17448
|
+
_construct = function construct(Parent, args, Class) {
|
|
17449
|
+
var a = [null];
|
|
17450
|
+
a.push.apply(a, args);
|
|
17451
|
+
var Constructor = Function.bind.apply(Parent, a);
|
|
17452
|
+
var instance = new Constructor();
|
|
17453
|
+
|
|
17454
|
+
if (Class) _set_prototype_of(instance, Class.prototype);
|
|
17455
|
+
|
|
17456
|
+
return instance;
|
|
17457
|
+
};
|
|
17458
|
+
}
|
|
17459
|
+
|
|
17460
|
+
return _construct.apply(null, arguments);
|
|
17461
|
+
}
|
|
17462
|
+
|
|
17373
17463
|
var ComponentCloner = /*#__PURE__*/ function() {
|
|
17374
17464
|
function ComponentCloner() {}
|
|
17375
17465
|
/**
|
|
@@ -17417,10 +17507,14 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
17417
17507
|
/**
|
|
17418
17508
|
* Add component based on the component type.
|
|
17419
17509
|
* @param type - The type of the component
|
|
17510
|
+
* @param args - The arguments of the component
|
|
17420
17511
|
* @returns The component which has been added
|
|
17421
17512
|
*/ _proto.addComponent = function addComponent(type) {
|
|
17513
|
+
for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
17514
|
+
args[_key - 1] = arguments[_key];
|
|
17515
|
+
}
|
|
17422
17516
|
ComponentsDependencies._addCheck(this, type);
|
|
17423
|
-
var component =
|
|
17517
|
+
var component = _construct(type, [].concat(this, args));
|
|
17424
17518
|
this._components.push(component);
|
|
17425
17519
|
component._setActive(true, ActiveChangeFlag.All);
|
|
17426
17520
|
return component;
|
|
@@ -18946,6 +19040,15 @@ var SafeLoopArray = /*#__PURE__*/ function() {
|
|
|
18946
19040
|
this._loopArrayDirty = true;
|
|
18947
19041
|
};
|
|
18948
19042
|
/**
|
|
19043
|
+
* Remove item from array that pass the specified comparison function.
|
|
19044
|
+
* @param filter - The comparison function
|
|
19045
|
+
*/ _proto.findAndRemove = function findAndRemove(filter) {
|
|
19046
|
+
var array = this._array;
|
|
19047
|
+
for(var i = array.length - 1; i >= 0; i--){
|
|
19048
|
+
filter(array[i]) && this.removeByIndex(i);
|
|
19049
|
+
}
|
|
19050
|
+
};
|
|
19051
|
+
/**
|
|
18949
19052
|
* The index of the item.
|
|
18950
19053
|
* @param item - The item which want to get the index
|
|
18951
19054
|
* @returns Index of the item
|
|
@@ -19379,17 +19482,35 @@ var /** @internal */ PromiseState;
|
|
|
19379
19482
|
};
|
|
19380
19483
|
/**
|
|
19381
19484
|
* @internal
|
|
19382
|
-
*/ _proto._onSubAssetSuccess = function _onSubAssetSuccess(
|
|
19383
|
-
var
|
|
19384
|
-
(
|
|
19385
|
-
|
|
19485
|
+
*/ _proto._onSubAssetSuccess = function _onSubAssetSuccess(assetBaseURL, assetSubPath, value) {
|
|
19486
|
+
var _this__subAssetPromiseCallbacks_assetBaseURL;
|
|
19487
|
+
var subPromiseCallback = (_this__subAssetPromiseCallbacks_assetBaseURL = this._subAssetPromiseCallbacks[assetBaseURL]) == null ? void 0 : _this__subAssetPromiseCallbacks_assetBaseURL[assetSubPath];
|
|
19488
|
+
if (subPromiseCallback) {
|
|
19489
|
+
// Already resolved
|
|
19490
|
+
subPromiseCallback.resolve(value);
|
|
19491
|
+
} else {
|
|
19492
|
+
var // Pending
|
|
19493
|
+
_this__subAssetPromiseCallbacks, _assetBaseURL;
|
|
19494
|
+
((_this__subAssetPromiseCallbacks = this._subAssetPromiseCallbacks)[_assetBaseURL = assetBaseURL] || (_this__subAssetPromiseCallbacks[_assetBaseURL] = {}))[assetSubPath] = {
|
|
19495
|
+
resolve: value
|
|
19496
|
+
};
|
|
19497
|
+
}
|
|
19386
19498
|
};
|
|
19387
19499
|
/**
|
|
19388
19500
|
* @internal
|
|
19389
|
-
*/ _proto._onSubAssetFail = function _onSubAssetFail(
|
|
19390
|
-
var
|
|
19391
|
-
(
|
|
19392
|
-
|
|
19501
|
+
*/ _proto._onSubAssetFail = function _onSubAssetFail(assetBaseURL, assetSubPath, value) {
|
|
19502
|
+
var _this__subAssetPromiseCallbacks_assetBaseURL;
|
|
19503
|
+
var subPromiseCallback = (_this__subAssetPromiseCallbacks_assetBaseURL = this._subAssetPromiseCallbacks[assetBaseURL]) == null ? void 0 : _this__subAssetPromiseCallbacks_assetBaseURL[assetSubPath];
|
|
19504
|
+
if (subPromiseCallback) {
|
|
19505
|
+
// Already rejected
|
|
19506
|
+
subPromiseCallback.reject(value);
|
|
19507
|
+
} else {
|
|
19508
|
+
var // Pending
|
|
19509
|
+
_this__subAssetPromiseCallbacks, _assetBaseURL;
|
|
19510
|
+
((_this__subAssetPromiseCallbacks = this._subAssetPromiseCallbacks)[_assetBaseURL = assetBaseURL] || (_this__subAssetPromiseCallbacks[_assetBaseURL] = {}))[assetSubPath] = {
|
|
19511
|
+
reject: value
|
|
19512
|
+
};
|
|
19513
|
+
}
|
|
19393
19514
|
};
|
|
19394
19515
|
/**
|
|
19395
19516
|
* @internal
|
|
@@ -19534,8 +19655,21 @@ var /** @internal */ PromiseState;
|
|
|
19534
19655
|
if (!loader) {
|
|
19535
19656
|
throw "loader not found: " + item.type;
|
|
19536
19657
|
}
|
|
19537
|
-
//
|
|
19658
|
+
// Check sub asset
|
|
19659
|
+
if (queryPath) {
|
|
19660
|
+
// Check whether load main asset
|
|
19661
|
+
var mainPromise = loadingPromises[assetBaseURL] || this._loadMainAsset(loader, item, assetBaseURL);
|
|
19662
|
+
mainPromise.catch(function(e) {
|
|
19663
|
+
_this._onSubAssetFail(assetBaseURL, queryPath, e);
|
|
19664
|
+
});
|
|
19665
|
+
return this._createSubAssetPromiseCallback(assetBaseURL, assetURL, queryPath);
|
|
19666
|
+
}
|
|
19667
|
+
return this._loadMainAsset(loader, item, assetBaseURL);
|
|
19668
|
+
};
|
|
19669
|
+
_proto._loadMainAsset = function _loadMainAsset(loader, item, assetBaseURL) {
|
|
19670
|
+
var _this = this;
|
|
19538
19671
|
item.url = assetBaseURL;
|
|
19672
|
+
var loadingPromises = this._loadingPromises;
|
|
19539
19673
|
var promise = loader.load(item, this);
|
|
19540
19674
|
loadingPromises[assetBaseURL] = promise;
|
|
19541
19675
|
promise.then(function(resource) {
|
|
@@ -19543,32 +19677,46 @@ var /** @internal */ PromiseState;
|
|
|
19543
19677
|
_this._addAsset(assetBaseURL, resource);
|
|
19544
19678
|
}
|
|
19545
19679
|
delete loadingPromises[assetBaseURL];
|
|
19680
|
+
_this._releaseSubAssetPromiseCallback(assetBaseURL);
|
|
19546
19681
|
}, function() {
|
|
19547
|
-
|
|
19682
|
+
delete loadingPromises[assetBaseURL];
|
|
19683
|
+
_this._releaseSubAssetPromiseCallback(assetBaseURL);
|
|
19548
19684
|
});
|
|
19549
|
-
|
|
19550
|
-
|
|
19551
|
-
|
|
19552
|
-
|
|
19553
|
-
|
|
19554
|
-
|
|
19685
|
+
return promise;
|
|
19686
|
+
};
|
|
19687
|
+
_proto._createSubAssetPromiseCallback = function _createSubAssetPromiseCallback(assetBaseURL, assetURL, assetSubPath) {
|
|
19688
|
+
var _this = this;
|
|
19689
|
+
var _this__subAssetPromiseCallbacks_assetBaseURL, _subPromiseCallback, _subPromiseCallback1;
|
|
19690
|
+
var loadingPromises = this._loadingPromises;
|
|
19691
|
+
var subPromiseCallback = (_this__subAssetPromiseCallbacks_assetBaseURL = this._subAssetPromiseCallbacks[assetBaseURL]) == null ? void 0 : _this__subAssetPromiseCallbacks_assetBaseURL[assetSubPath];
|
|
19692
|
+
var resolvedValue = (_subPromiseCallback = subPromiseCallback) == null ? void 0 : _subPromiseCallback.resolve;
|
|
19693
|
+
var rejectedValue = (_subPromiseCallback1 = subPromiseCallback) == null ? void 0 : _subPromiseCallback1.reject;
|
|
19694
|
+
var promise = new AssetPromise(function(resolve, reject) {
|
|
19695
|
+
if (resolvedValue) {
|
|
19696
|
+
// Already resolved
|
|
19697
|
+
resolve(resolvedValue);
|
|
19698
|
+
} else if (rejectedValue) {
|
|
19699
|
+
// Already rejected
|
|
19700
|
+
reject(rejectedValue);
|
|
19701
|
+
} else {
|
|
19702
|
+
var _this__subAssetPromiseCallbacks, _assetBaseURL;
|
|
19703
|
+
// Pending
|
|
19704
|
+
loadingPromises[assetURL] = promise;
|
|
19705
|
+
((_this__subAssetPromiseCallbacks = _this._subAssetPromiseCallbacks)[_assetBaseURL = assetBaseURL] || (_this__subAssetPromiseCallbacks[_assetBaseURL] = {}))[assetSubPath] = {
|
|
19706
|
+
resolve: resolve,
|
|
19707
|
+
reject: reject
|
|
19708
|
+
};
|
|
19709
|
+
}
|
|
19710
|
+
});
|
|
19711
|
+
if (!resolvedValue && !rejectedValue) {
|
|
19712
|
+
promise.then(function() {
|
|
19555
19713
|
delete loadingPromises[assetURL];
|
|
19556
19714
|
}, function() {
|
|
19557
19715
|
return delete loadingPromises[assetURL];
|
|
19558
19716
|
});
|
|
19559
|
-
promise.catch(function(e) {
|
|
19560
|
-
_this._onSubAssetFail(assetURL, e);
|
|
19561
|
-
});
|
|
19562
|
-
return subPromise;
|
|
19563
19717
|
}
|
|
19564
19718
|
return promise;
|
|
19565
19719
|
};
|
|
19566
|
-
_proto._pushSubAssetPromiseCallback = function _pushSubAssetPromiseCallback(assetURL, resolve, reject) {
|
|
19567
|
-
this._subAssetPromiseCallbacks[assetURL] = {
|
|
19568
|
-
resolve: resolve,
|
|
19569
|
-
reject: reject
|
|
19570
|
-
};
|
|
19571
|
-
};
|
|
19572
19720
|
_proto._gc = function _gc(forceDestroy) {
|
|
19573
19721
|
var objects = Utils.objectValues(this._referResourcePool);
|
|
19574
19722
|
for(var i = 0, n = objects.length; i < n; i++){
|
|
@@ -19625,6 +19773,9 @@ var /** @internal */ PromiseState;
|
|
|
19625
19773
|
});
|
|
19626
19774
|
return result;
|
|
19627
19775
|
};
|
|
19776
|
+
_proto._releaseSubAssetPromiseCallback = function _releaseSubAssetPromiseCallback(assetBaseURL) {
|
|
19777
|
+
delete this._subAssetPromiseCallbacks[assetBaseURL];
|
|
19778
|
+
};
|
|
19628
19779
|
/**
|
|
19629
19780
|
* @internal
|
|
19630
19781
|
* @beta Just for internal editor, not recommended for developers.
|
|
@@ -24419,9 +24570,9 @@ ShaderPool.init();
|
|
|
24419
24570
|
/** Shadow bias.*/ _this.shadowBias = 1;
|
|
24420
24571
|
/** Shadow mapping normal-based bias. */ _this.shadowNormalBias = 1;
|
|
24421
24572
|
/** Near plane value to use for shadow frustums. */ _this.shadowNearPlane = 0.1;
|
|
24422
|
-
/** Shadow intensity, the larger the value, the clearer and darker the shadow. */ _this.shadowStrength = 1.0;
|
|
24423
24573
|
/** @internal */ _this._lightIndex = -1;
|
|
24424
24574
|
/** @internal */ _this._lightColor = new Color();
|
|
24575
|
+
_this._shadowStrength = 1.0;
|
|
24425
24576
|
_this._color = new Color(1, 1, 1, 1);
|
|
24426
24577
|
return _this;
|
|
24427
24578
|
}
|
|
@@ -24437,6 +24588,15 @@ ShaderPool.init();
|
|
|
24437
24588
|
return this._lightColor;
|
|
24438
24589
|
};
|
|
24439
24590
|
_create_class(Light, [
|
|
24591
|
+
{
|
|
24592
|
+
key: "shadowStrength",
|
|
24593
|
+
get: /** Shadow intensity, the larger the value, the clearer and darker the shadow, range [0,1]. */ function get() {
|
|
24594
|
+
return this._shadowStrength;
|
|
24595
|
+
},
|
|
24596
|
+
set: function set(value) {
|
|
24597
|
+
this._shadowStrength = MathUtil.clamp(value, 0, 1);
|
|
24598
|
+
}
|
|
24599
|
+
},
|
|
24440
24600
|
{
|
|
24441
24601
|
key: "color",
|
|
24442
24602
|
get: /**
|
|
@@ -25152,7 +25312,7 @@ var BloomEffect = /*#__PURE__*/ function() {
|
|
|
25152
25312
|
return this._scatter;
|
|
25153
25313
|
},
|
|
25154
25314
|
set: function set(value) {
|
|
25155
|
-
value =
|
|
25315
|
+
value = MathUtil.clamp(value, 0, 1);
|
|
25156
25316
|
if (value !== this._scatter) {
|
|
25157
25317
|
this._scatter = value;
|
|
25158
25318
|
var params = this._bloomMaterial.shaderData.getVector4(BloomEffect._bloomParams);
|
|
@@ -28260,10 +28420,7 @@ var AnimatorLayerBlendingMode;
|
|
|
28260
28420
|
/**
|
|
28261
28421
|
* @internal
|
|
28262
28422
|
*/ _proto._onEnable = function _onEnable() {
|
|
28263
|
-
|
|
28264
|
-
for(var i = 0, n = layersData.length; i < n; i++){
|
|
28265
|
-
layersData[i].layerState = LayerState.Standby;
|
|
28266
|
-
}
|
|
28423
|
+
this._reset();
|
|
28267
28424
|
this._entity.getComponentsIncludeChildren(Renderer, this._controlledRenderers);
|
|
28268
28425
|
};
|
|
28269
28426
|
/**
|
|
@@ -28817,8 +28974,11 @@ var AnimatorLayerBlendingMode;
|
|
|
28817
28974
|
if (exitTime >= lastClipTime) {
|
|
28818
28975
|
playState.currentTransitionIndex = Math.min(transitionIndex + 1, n - 1);
|
|
28819
28976
|
if (this._checkConditions(state, transition)) {
|
|
28820
|
-
this._applyTransition(layerIndex, layerData, stateMachine, transition)
|
|
28821
|
-
|
|
28977
|
+
if (this._applyTransition(layerIndex, layerData, stateMachine, transition)) {
|
|
28978
|
+
return transition;
|
|
28979
|
+
} else {
|
|
28980
|
+
return null;
|
|
28981
|
+
}
|
|
28822
28982
|
}
|
|
28823
28983
|
}
|
|
28824
28984
|
}
|
|
@@ -28837,8 +28997,11 @@ var AnimatorLayerBlendingMode;
|
|
|
28837
28997
|
if (exitTime <= lastClipTime) {
|
|
28838
28998
|
playState.currentTransitionIndex = Math.max(transitionIndex - 1, 0);
|
|
28839
28999
|
if (this._checkConditions(state, transition)) {
|
|
28840
|
-
this._applyTransition(layerIndex, layerData, stateMachine, transition)
|
|
28841
|
-
|
|
29000
|
+
if (this._applyTransition(layerIndex, layerData, stateMachine, transition)) {
|
|
29001
|
+
return transition;
|
|
29002
|
+
} else {
|
|
29003
|
+
return null;
|
|
29004
|
+
}
|
|
28842
29005
|
}
|
|
28843
29006
|
}
|
|
28844
29007
|
}
|
|
@@ -28848,8 +29011,11 @@ var AnimatorLayerBlendingMode;
|
|
|
28848
29011
|
for(var i = 0, n = transitions.length; i < n; i++){
|
|
28849
29012
|
var transition = transitions[i];
|
|
28850
29013
|
if (this._checkConditions(state, transition)) {
|
|
28851
|
-
this._applyTransition(layerIndex, layerData, stateMachine, transition)
|
|
28852
|
-
|
|
29014
|
+
if (this._applyTransition(layerIndex, layerData, stateMachine, transition)) {
|
|
29015
|
+
return transition;
|
|
29016
|
+
} else {
|
|
29017
|
+
return null;
|
|
29018
|
+
}
|
|
28853
29019
|
}
|
|
28854
29020
|
}
|
|
28855
29021
|
};
|
|
@@ -28869,11 +29035,12 @@ var AnimatorLayerBlendingMode;
|
|
|
28869
29035
|
};
|
|
28870
29036
|
_proto._applyTransition = function _applyTransition(layerIndex, layerData, stateMachine, transition) {
|
|
28871
29037
|
// Need prepare first, it should crossFade when to exit
|
|
28872
|
-
this._prepareCrossFadeByTransition(transition, layerIndex);
|
|
29038
|
+
var success = this._prepareCrossFadeByTransition(transition, layerIndex);
|
|
28873
29039
|
if (transition.isExit) {
|
|
28874
29040
|
this._checkAnyAndEntryState(layerIndex, layerData, stateMachine);
|
|
28875
|
-
return;
|
|
29041
|
+
return true;
|
|
28876
29042
|
}
|
|
29043
|
+
return success;
|
|
28877
29044
|
};
|
|
28878
29045
|
_proto._checkConditions = function _checkConditions(state, transition) {
|
|
28879
29046
|
var _state;
|
|
@@ -28885,6 +29052,9 @@ var AnimatorLayerBlendingMode;
|
|
|
28885
29052
|
var pass = false;
|
|
28886
29053
|
var _conditions_i = conditions[i], mode = _conditions_i.mode, name1 = _conditions_i.parameterName, threshold = _conditions_i.threshold;
|
|
28887
29054
|
var parameter = this.getParameter(name1);
|
|
29055
|
+
if (!parameter) {
|
|
29056
|
+
return false;
|
|
29057
|
+
}
|
|
28888
29058
|
switch(mode){
|
|
28889
29059
|
case AnimatorConditionMode.Equals:
|
|
28890
29060
|
if (parameter.value === threshold) {
|
|
@@ -34179,5 +34349,5 @@ var cacheDir = new Vector3();
|
|
|
34179
34349
|
return CubeProbe;
|
|
34180
34350
|
}(Probe);
|
|
34181
34351
|
|
|
34182
|
-
export { AmbientLight, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationRectCurve, AnimationRefCurve, AnimationStringCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorLayerMask, AnimatorState, AnimatorStateMachine, AnimatorStateTransition, AssetPromise, AssetType, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, BasicRenderPipeline, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlendState, BlinnPhongMaterial, BloomDownScaleMode, BloomEffect, BoolUpdateFlag, BoxColliderShape, BoxShape, Buffer, BufferBindFlag, BufferMesh, BufferUsage, BufferUtil, Burst, Camera, CameraClearFlags, CameraType, Canvas, CapsuleColliderShape, CharacterController, CircleShape, ClearableObjectPool, CloneManager, Collider, ColliderShape, ColliderShapeUpAxis, CollisionDetectionMode, ColorOverLifetimeModule, ColorSpace, ColorWriteMask, CompareFunction, Component, ConeEmitType, ConeShape, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, CurveKey, DataType, DependentMode, DepthState, DepthTextureMode, DiffuseMode, DirectLight, Downsampling, DynamicCollider, DynamicColliderConstraints, EmissionModule, Engine, EngineObject, Entity, EventDispatcher, FixedJoint, FogMode, Font, FontStyle, GLCapabilityType, GradientAlphaKey, GradientColorKey, HemisphereShape, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolationType, Joint, JointLimits, JointMotor, Keyframe, Keys, Layer, Light, Loader, Logger, MSAASamples, MainModule, Material, Mesh, MeshRenderer, MeshTopology, ModelMesh, OverflowMode, PBRBaseMaterial, PBRMaterial, PBRSpecularMaterial, ParticleCompositeCurve, ParticleCompositeGradient, ParticleCurve, ParticleCurveMode, ParticleGenerator, ParticleGradient, ParticleGradientMode, ParticleMaterial, ParticleRenderMode, ParticleRenderer, ParticleScaleMode, ParticleShapeArcMode, ParticleShapeType, ParticleSimulationSpace, ParticleStopMode, PhysicsMaterial, PhysicsMaterialCombineMode, PhysicsScene, PipelineStage, PlaneColliderShape, Platform, PointLight, Pointer, PointerButton, PointerPhase, Primitive, PrimitiveMesh, Probe, RasterState, ReferResource, RenderBufferDepthFormat, RenderFace, RenderQueue, RenderQueueType, RenderState, RenderStateElementKey as RenderStateDataKey, RenderTarget, RenderTargetBlendState, Renderer, ReplacementFailureStrategy, ResourceManager, ReturnableObjectPool, RotationOverLifetimeModule, Scene, SceneManager, Script, SetDataOptions, Shader, ShaderData, ShaderFactory, ShaderLib, ShaderMacro, ShaderMacroCollection, ShaderPass, ShaderPlatformTarget, ShaderProperty, ShaderPropertyType, ShaderTagKey, ShadowCascadesMode, ShadowResolution, ShadowType, SizeOverLifetimeModule, Skin, SkinnedMeshRenderer, Sky, SkyBoxMaterial, SkyProceduralMaterial, SphereColliderShape, SphereShape, SpotLight, SpringJoint, Sprite, SpriteAtlas, SpriteDrawMode, SpriteMask, SpriteMaskInteraction, SpriteMaskLayer, SpriteRenderer, SpriteTileMode, StateMachineScript, StaticCollider, StencilOperation, StencilState, SubMesh, SubPrimitive, SubShader, SunMode, SystemInfo, TextHorizontalAlignment, TextRenderer, TextUtils, TextVerticalAlignment, Texture, Texture2D, Texture2DArray, TextureCoordinate, TextureCube, TextureCubeFace, TextureDepthCompareFunction, TextureFilterMode, TextureFormat, TextureSheetAnimationModule, TextureUsage, TextureWrapMode, Time, TonemappingEffect, TonemappingMode, TrailMaterial, TrailRenderer, Transform, UnlitMaterial, Utils, VelocityOverLifetimeModule, VertexAttribute, VertexBufferBinding, VertexElement, VertexElementFormat, WrapMode, XRManager, _PostProcessManager, assignmentClone, deepClone, dependentComponents, ignoreClone, request, resourceLoader, shallowClone };
|
|
34352
|
+
export { AmbientLight, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationRectCurve, AnimationRefCurve, AnimationStringCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorCondition, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorControllerParameter, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorLayerMask, AnimatorState, AnimatorStateMachine, AnimatorStateTransition, AssetPromise, AssetType, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, BasicRenderPipeline, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlendState, BlinnPhongMaterial, BloomDownScaleMode, BloomEffect, BoolUpdateFlag, BoxColliderShape, BoxShape, Buffer, BufferBindFlag, BufferMesh, BufferUsage, BufferUtil, Burst, Camera, CameraClearFlags, CameraType, Canvas, CapsuleColliderShape, CharacterController, CircleShape, ClearableObjectPool, CloneManager, Collider, ColliderShape, ColliderShapeUpAxis, CollisionDetectionMode, ColorOverLifetimeModule, ColorSpace, ColorWriteMask, CompareFunction, Component, ConeEmitType, ConeShape, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, CurveKey, DataType, DependentMode, DepthState, DepthTextureMode, DiffuseMode, DirectLight, Downsampling, DynamicCollider, DynamicColliderConstraints, EmissionModule, Engine, EngineObject, Entity, EventDispatcher, FixedJoint, FogMode, Font, FontStyle, GLCapabilityType, GradientAlphaKey, GradientColorKey, HemisphereShape, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolationType, Joint, JointLimits, JointMotor, Keyframe, Keys, Layer, LayerPathMask, Light, Loader, Logger, MSAASamples, MainModule, Material, Mesh, MeshRenderer, MeshTopology, ModelMesh, OverflowMode, PBRBaseMaterial, PBRMaterial, PBRSpecularMaterial, ParticleCompositeCurve, ParticleCompositeGradient, ParticleCurve, ParticleCurveMode, ParticleGenerator, ParticleGradient, ParticleGradientMode, ParticleMaterial, ParticleRenderMode, ParticleRenderer, ParticleScaleMode, ParticleShapeArcMode, ParticleShapeType, ParticleSimulationSpace, ParticleStopMode, PhysicsMaterial, PhysicsMaterialCombineMode, PhysicsScene, PipelineStage, PlaneColliderShape, Platform, PointLight, Pointer, PointerButton, PointerPhase, Primitive, PrimitiveMesh, Probe, RasterState, ReferResource, RenderBufferDepthFormat, RenderFace, RenderQueue, RenderQueueType, RenderState, RenderStateElementKey as RenderStateDataKey, RenderTarget, RenderTargetBlendState, Renderer, ReplacementFailureStrategy, ResourceManager, ReturnableObjectPool, RotationOverLifetimeModule, SafeLoopArray, Scene, SceneManager, Script, SetDataOptions, Shader, ShaderData, ShaderFactory, ShaderLib, ShaderMacro, ShaderMacroCollection, ShaderPass, ShaderPlatformTarget, ShaderProperty, ShaderPropertyType, ShaderTagKey, ShadowCascadesMode, ShadowResolution, ShadowType, SizeOverLifetimeModule, Skin, SkinnedMeshRenderer, Sky, SkyBoxMaterial, SkyProceduralMaterial, SphereColliderShape, SphereShape, SpotLight, SpringJoint, Sprite, SpriteAtlas, SpriteDrawMode, SpriteMask, SpriteMaskInteraction, SpriteMaskLayer, SpriteRenderer, SpriteTileMode, StateMachineScript, StaticCollider, StencilOperation, StencilState, SubMesh, SubPrimitive, SubShader, SunMode, SystemInfo, TextHorizontalAlignment, TextRenderer, TextUtils, TextVerticalAlignment, Texture, Texture2D, Texture2DArray, TextureCoordinate, TextureCube, TextureCubeFace, TextureDepthCompareFunction, TextureFilterMode, TextureFormat, TextureSheetAnimationModule, TextureUsage, TextureWrapMode, Time, TonemappingEffect, TonemappingMode, TrailMaterial, TrailRenderer, Transform, UnlitMaterial, Utils, VelocityOverLifetimeModule, VertexAttribute, VertexBufferBinding, VertexElement, VertexElementFormat, WrapMode, XRManager, _PostProcessManager, assignmentClone, deepClone, dependentComponents, ignoreClone, request, resourceLoader, shallowClone };
|
|
34183
34353
|
//# sourceMappingURL=module.js.map
|