@galacean/engine-core 1.1.0-alpha.2 → 1.1.0-alpha.3
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 +241 -175
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +241 -175
- package/dist/module.js +241 -175
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/ComponentsManager.d.ts +0 -2
- package/types/DisorderedArray.d.ts +6 -1
- package/types/Script.d.ts +0 -1
- package/types/particle/ParticleGenerator.d.ts +5 -5
- package/types/particle/enums/ParticleRenderMode.d.ts +12 -12
- package/types/particle/enums/ParticleScaleMode.d.ts +3 -3
- package/types/particle/modules/EmissionModule.d.ts +1 -1
- package/types/particle/modules/MainModule.d.ts +11 -11
package/dist/main.js
CHANGED
|
@@ -2765,6 +2765,8 @@ exports.DependentMode = void 0;
|
|
|
2765
2765
|
function DisorderedArray(count) {
|
|
2766
2766
|
if (count === void 0) count = 0;
|
|
2767
2767
|
this.length = 0;
|
|
2768
|
+
this._isLooping = false;
|
|
2769
|
+
this._blankCount = 0;
|
|
2768
2770
|
this._elements = new Array(count);
|
|
2769
2771
|
}
|
|
2770
2772
|
var _proto = DisorderedArray.prototype;
|
|
@@ -2793,21 +2795,49 @@ exports.DependentMode = void 0;
|
|
|
2793
2795
|
}
|
|
2794
2796
|
return this._elements[index];
|
|
2795
2797
|
};
|
|
2798
|
+
_proto.startLoop = function startLoop() {
|
|
2799
|
+
this._isLooping = true;
|
|
2800
|
+
};
|
|
2796
2801
|
/**
|
|
2797
2802
|
* Delete the element at the specified index.
|
|
2798
2803
|
* @param index - The index of the element to be deleted
|
|
2799
2804
|
* @returns The replaced item is used to reset its index
|
|
2800
2805
|
*/ _proto.deleteByIndex = function deleteByIndex(index) {
|
|
2801
2806
|
var elements = this._elements;
|
|
2802
|
-
var end
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
+
var end;
|
|
2808
|
+
if (this._isLooping) {
|
|
2809
|
+
this._elements[index] = null;
|
|
2810
|
+
this._blankCount++;
|
|
2811
|
+
} else {
|
|
2812
|
+
var endIndex = this.length - 1;
|
|
2813
|
+
if (index !== endIndex) {
|
|
2814
|
+
end = elements[endIndex];
|
|
2815
|
+
elements[index] = end;
|
|
2816
|
+
}
|
|
2817
|
+
elements[endIndex] = null;
|
|
2818
|
+
this.length--;
|
|
2807
2819
|
}
|
|
2808
|
-
this.length--;
|
|
2809
2820
|
return end;
|
|
2810
2821
|
};
|
|
2822
|
+
_proto.endLoop = function endLoop() {
|
|
2823
|
+
this._isLooping = false;
|
|
2824
|
+
if (this._blankCount) {
|
|
2825
|
+
var elements = this._elements;
|
|
2826
|
+
for(var i = 0, j = 0, n = this.length; i < n; i++){
|
|
2827
|
+
var element = elements[i];
|
|
2828
|
+
if (element) {
|
|
2829
|
+
elements[j++] = element;
|
|
2830
|
+
}
|
|
2831
|
+
}
|
|
2832
|
+
this.length -= this._blankCount;
|
|
2833
|
+
this._blankCount = 0;
|
|
2834
|
+
}
|
|
2835
|
+
};
|
|
2836
|
+
_proto.endLoopAndClear = function endLoopAndClear() {
|
|
2837
|
+
this._isLooping = false;
|
|
2838
|
+
this.length = 0;
|
|
2839
|
+
this._blankCount = 0;
|
|
2840
|
+
};
|
|
2811
2841
|
_proto.garbageCollection = function garbageCollection() {
|
|
2812
2842
|
this._elements.length = this.length;
|
|
2813
2843
|
};
|
|
@@ -4044,11 +4074,13 @@ var ComponentCloner = /*#__PURE__*/ function() {
|
|
|
4044
4074
|
if (!this._isActiveInHierarchy) {
|
|
4045
4075
|
child._isActiveInHierarchy && (inActiveChangeFlag |= ActiveChangeFlag.Hierarchy);
|
|
4046
4076
|
}
|
|
4047
|
-
if (
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4077
|
+
if (child._isActiveInScene) {
|
|
4078
|
+
if (this._isActiveInScene) {
|
|
4079
|
+
// Cross scene should inActive first and then active
|
|
4080
|
+
oldScene !== newScene && (inActiveChangeFlag |= ActiveChangeFlag.Scene);
|
|
4081
|
+
} else {
|
|
4082
|
+
inActiveChangeFlag |= ActiveChangeFlag.Scene;
|
|
4083
|
+
}
|
|
4052
4084
|
}
|
|
4053
4085
|
inActiveChangeFlag && child._processInActive(inActiveChangeFlag);
|
|
4054
4086
|
if (child._scene !== newScene) {
|
|
@@ -5021,7 +5053,7 @@ var begin_mobile_frag = "#define GLSLIFY 1\nvec4 ambient=vec4(0.0);vec4 emission
|
|
|
5021
5053
|
|
|
5022
5054
|
var begin_viewdir_frag = "#define GLSLIFY 1\n#ifdef MATERIAL_NEED_WORLD_POS\nvec3 V=normalize(camera_Position-v_pos);\n#endif\n"; // eslint-disable-line
|
|
5023
5055
|
|
|
5024
|
-
var mobile_blinnphong_frag = "#define GLSLIFY 1\n#ifdef MATERIAL_HAS_NORMALTEXTURE\nmat3 tbn=getTBN(gl_FrontFacing);vec3 N=getNormalByNormalTexture(tbn,material_NormalTexture,material_NormalIntensity,v_uv,gl_FrontFacing);\n#else\nvec3 N=getNormal(gl_FrontFacing);\n#endif\nvec3 lightDiffuse=vec3(0.0,0.0,0.0);vec3 lightSpecular=vec3(0.0,0.0,0.0);float shadowAttenuation=1.0;\n#ifdef SCENE_DIRECT_LIGHT_COUNT\nshadowAttenuation=1.0;\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nshadowAttenuation*=sampleShadowMap();\n#endif\nDirectLight directionalLight;for(int i=0;i<SCENE_DIRECT_LIGHT_COUNT;i++){if(isRendererCulledByLight(renderer_Layer.xy,scene_DirectLightCullingMask[i]))
|
|
5056
|
+
var mobile_blinnphong_frag = "#define GLSLIFY 1\n#ifdef MATERIAL_HAS_NORMALTEXTURE\nmat3 tbn=getTBN(gl_FrontFacing);vec3 N=getNormalByNormalTexture(tbn,material_NormalTexture,material_NormalIntensity,v_uv,gl_FrontFacing);\n#else\nvec3 N=getNormal(gl_FrontFacing);\n#endif\nvec3 lightDiffuse=vec3(0.0,0.0,0.0);vec3 lightSpecular=vec3(0.0,0.0,0.0);float shadowAttenuation=1.0;\n#ifdef SCENE_DIRECT_LIGHT_COUNT\nshadowAttenuation=1.0;\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nshadowAttenuation*=sampleShadowMap();\n#endif\nDirectLight directionalLight;for(int i=0;i<SCENE_DIRECT_LIGHT_COUNT;i++){if(!isRendererCulledByLight(renderer_Layer.xy,scene_DirectLightCullingMask[i])){directionalLight.color=scene_DirectLightColor[i];\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nif(i==0){directionalLight.color*=shadowAttenuation;}\n#endif\ndirectionalLight.direction=scene_DirectLightDirection[i];float d=max(dot(N,-directionalLight.direction),0.0);lightDiffuse+=directionalLight.color*d;vec3 halfDir=normalize(V-directionalLight.direction);float s=pow(clamp(dot(N,halfDir),0.0,1.0),material_Shininess);lightSpecular+=directionalLight.color*s;}}\n#endif\n#ifdef SCENE_POINT_LIGHT_COUNT\nPointLight pointLight;for(int i=0;i<SCENE_POINT_LIGHT_COUNT;i++){if(!isRendererCulledByLight(renderer_Layer.xy,scene_PointLightCullingMask[i])){pointLight.color=scene_PointLightColor[i];pointLight.position=scene_PointLightPosition[i];pointLight.distance=scene_PointLightDistance[i];vec3 direction=v_pos-pointLight.position;float dist=length(direction);direction/=dist;float decay=clamp(1.0-pow(dist/pointLight.distance,4.0),0.0,1.0);float d=max(dot(N,-direction),0.0)*decay;lightDiffuse+=pointLight.color*d;vec3 halfDir=normalize(V-direction);float s=pow(clamp(dot(N,halfDir),0.0,1.0),material_Shininess)*decay;lightSpecular+=pointLight.color*s;}}\n#endif\n#ifdef SCENE_SPOT_LIGHT_COUNT\nSpotLight spotLight;for(int i=0;i<SCENE_SPOT_LIGHT_COUNT;i++){if(!isRendererCulledByLight(renderer_Layer.xy,scene_SpotLightCullingMask[i])){spotLight.color=scene_SpotLightColor[i];spotLight.position=scene_SpotLightPosition[i];spotLight.direction=scene_SpotLightDirection[i];spotLight.distance=scene_SpotLightDistance[i];spotLight.angleCos=scene_SpotLightAngleCos[i];spotLight.penumbraCos=scene_SpotLightPenumbraCos[i];vec3 direction=spotLight.position-v_pos;float lightDistance=length(direction);direction/=lightDistance;float angleCos=dot(direction,-spotLight.direction);float decay=clamp(1.0-pow(lightDistance/spotLight.distance,4.0),0.0,1.0);float spotEffect=smoothstep(spotLight.penumbraCos,spotLight.angleCos,angleCos);float decayTotal=decay*spotEffect;float d=max(dot(N,direction),0.0)*decayTotal;lightDiffuse+=spotLight.color*d;vec3 halfDir=normalize(V+direction);float s=pow(clamp(dot(N,halfDir),0.0,1.0),material_Shininess)*decayTotal;lightSpecular+=spotLight.color*s;}}\n#endif\ndiffuse*=vec4(lightDiffuse,1.0);specular*=vec4(lightSpecular,1.0);\n#ifdef MATERIAL_IS_ALPHA_CUTOFF\nif(diffuse.a<material_AlphaCutoff){discard;}\n#endif\n"; // eslint-disable-line
|
|
5025
5057
|
|
|
5026
5058
|
var noise_cellular = "#define GLSLIFY 1\n#include <noise_cellular_2D>\n#include <noise_cellular_3D>\n#include <noise_cellular_2x2>\n#include <noise_cellular_2x2x2>\n"; // eslint-disable-line
|
|
5027
5059
|
|
|
@@ -5061,7 +5093,7 @@ var pbr_helper = "#define GLSLIFY 1\n#include <normal_get>\nfloat computeSpecula
|
|
|
5061
5093
|
|
|
5062
5094
|
var brdf = "#define GLSLIFY 1\nfloat F_Schlick(float dotLH){return 0.04+0.96*(pow(1.0-dotLH,5.0));}vec3 F_Schlick(vec3 specularColor,float dotLH){float fresnel=exp2((-5.55473*dotLH-6.98316)*dotLH);return(1.0-specularColor)*fresnel+specularColor;}float G_GGX_SmithCorrelated(float alpha,float dotNL,float dotNV){float a2=pow2(alpha);float gv=dotNL*sqrt(a2+(1.0-a2)*pow2(dotNV));float gl=dotNV*sqrt(a2+(1.0-a2)*pow2(dotNL));return 0.5/max(gv+gl,EPSILON);}float D_GGX(float alpha,float dotNH){float a2=pow2(alpha);float denom=pow2(dotNH)*(a2-1.0)+1.0;return RECIPROCAL_PI*a2/pow2(denom);}vec3 BRDF_Specular_GGX(vec3 incidentDirection,vec3 viewDir,vec3 normal,vec3 specularColor,float roughness){float alpha=pow2(roughness);vec3 halfDir=normalize(incidentDirection+viewDir);float dotNL=saturate(dot(normal,incidentDirection));float dotNV=saturate(dot(normal,viewDir));float dotNH=saturate(dot(normal,halfDir));float dotLH=saturate(dot(incidentDirection,halfDir));vec3 F=F_Schlick(specularColor,dotLH);float G=G_GGX_SmithCorrelated(alpha,dotNL,dotNV);float D=D_GGX(alpha,dotNH);return F*(G*D);}vec3 BRDF_Diffuse_Lambert(vec3 diffuseColor){return RECIPROCAL_PI*diffuseColor;}"; // eslint-disable-line
|
|
5063
5095
|
|
|
5064
|
-
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.viewDir,geometry.clearCoatNormal,vec3(0.04),material.clearCoatRoughness);attenuation-=material.clearCoat*F_Schlick(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.viewDir,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]))
|
|
5096
|
+
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.viewDir,geometry.clearCoatNormal,vec3(0.04),material.clearCoatRoughness);attenuation-=material.clearCoat*F_Schlick(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.viewDir,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
|
|
5065
5097
|
|
|
5066
5098
|
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 getLightProbeRadiance(vec3 viewDir,vec3 normal,float roughness,int maxMIPLevel,float specularIntensity){\n#ifndef SCENE_USE_SPECULAR_ENV\nreturn vec3(0);\n#else\nvec3 reflectVec=reflect(-viewDir,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
|
|
5067
5099
|
|
|
@@ -11556,19 +11588,20 @@ var PrimitiveType;
|
|
|
11556
11588
|
/**
|
|
11557
11589
|
* @internal
|
|
11558
11590
|
*/ _proto.update = function update() {
|
|
11559
|
-
var skin =
|
|
11560
|
-
if (skin) {
|
|
11561
|
-
var ibms = skin.inverseBindMatrices;
|
|
11562
|
-
var worldToLocal = this._rootBone.getInvModelMatrix();
|
|
11563
|
-
var _this = this, bones = _this._bones, jointMatrices = _this._jointMatrices;
|
|
11591
|
+
var _this = this, skin = _this._skin, bones = _this._bones;
|
|
11592
|
+
if (skin && bones) {
|
|
11564
11593
|
// @todo: can optimize when share skin
|
|
11594
|
+
var jointMatrices = this._jointMatrices;
|
|
11595
|
+
var bindMatrices = skin.inverseBindMatrices;
|
|
11596
|
+
var _this__rootBone;
|
|
11597
|
+
var worldToLocal = ((_this__rootBone = this._rootBone) != null ? _this__rootBone : this.entity).getInvModelMatrix();
|
|
11565
11598
|
for(var i = bones.length - 1; i >= 0; i--){
|
|
11566
11599
|
var bone = bones[i];
|
|
11567
11600
|
var offset = i * 16;
|
|
11568
11601
|
if (bone) {
|
|
11569
|
-
Utils._floatMatrixMultiply(bone.transform.worldMatrix,
|
|
11602
|
+
Utils._floatMatrixMultiply(bone.transform.worldMatrix, bindMatrices[i].elements, 0, jointMatrices, offset);
|
|
11570
11603
|
} else {
|
|
11571
|
-
jointMatrices.set(
|
|
11604
|
+
jointMatrices.set(bindMatrices[i].elements, offset);
|
|
11572
11605
|
}
|
|
11573
11606
|
Utils._floatMatrixMultiply(worldToLocal, jointMatrices, offset, jointMatrices, offset);
|
|
11574
11607
|
}
|
|
@@ -12239,6 +12272,41 @@ var TextRenderData = /*#__PURE__*/ function(RenderData) {
|
|
|
12239
12272
|
return TextRenderData;
|
|
12240
12273
|
}(RenderData);
|
|
12241
12274
|
|
|
12275
|
+
/**
|
|
12276
|
+
* Asset Type.
|
|
12277
|
+
*/ exports.AssetType = void 0;
|
|
12278
|
+
(function(AssetType) {
|
|
12279
|
+
AssetType[/**
|
|
12280
|
+
* Plain text.
|
|
12281
|
+
* @remarks Will not be cached based on url in ResourceManager.
|
|
12282
|
+
*/ "Text"] = "Text";
|
|
12283
|
+
AssetType[/**
|
|
12284
|
+
* JSON.
|
|
12285
|
+
* @remarks Will not be cached based on url in ResourceManager.
|
|
12286
|
+
*/ "JSON"] = "JSON";
|
|
12287
|
+
AssetType[/**
|
|
12288
|
+
* ArrayBuffer.
|
|
12289
|
+
* @remarks Will not be cached based on url in ResourceManager.
|
|
12290
|
+
*/ "Buffer"] = "Buffer";
|
|
12291
|
+
AssetType[/** 2D Texture. */ "Texture2D"] = "Texture2D";
|
|
12292
|
+
AssetType[/** Cube Texture. */ "TextureCube"] = "TextureCube";
|
|
12293
|
+
AssetType[/** Material. */ "Material"] = "Material";
|
|
12294
|
+
AssetType[/** Mesh. */ "Mesh"] = "Mesh";
|
|
12295
|
+
AssetType[/** AnimationClip. */ "AnimationClip"] = "AnimationClip";
|
|
12296
|
+
AssetType[/** AnimatorController. */ "AnimatorController"] = "AnimatorController";
|
|
12297
|
+
AssetType[/** Prefab.*/ "GLTF"] = "GLTF";
|
|
12298
|
+
AssetType[/** Compress Texture. */ "KTX"] = "KTX";
|
|
12299
|
+
AssetType[/** Cube Compress Texture. */ "KTXCube"] = "KTXCube";
|
|
12300
|
+
AssetType[/** KTX2 Compress Texture */ "KTX2"] = "KTX2";
|
|
12301
|
+
AssetType[/** Sprite. */ "Sprite"] = "Sprite";
|
|
12302
|
+
AssetType[/** Sprite Atlas. */ "SpriteAtlas"] = "SpriteAtlas";
|
|
12303
|
+
AssetType[/** Ambient light. */ "Env"] = "Environment";
|
|
12304
|
+
AssetType[/** Scene. */ "Scene"] = "Scene";
|
|
12305
|
+
AssetType[/** HDR to cube. */ "HDR"] = "HDR";
|
|
12306
|
+
AssetType[/** Font. */ "Font"] = "Font";
|
|
12307
|
+
AssetType[/** Source Font, include ttf、 otf and woff. */ "SourceFont"] = "SourceFont";
|
|
12308
|
+
})(exports.AssetType || (exports.AssetType = {}));
|
|
12309
|
+
|
|
12242
12310
|
var SafeLoopArray = /*#__PURE__*/ function() {
|
|
12243
12311
|
function SafeLoopArray() {
|
|
12244
12312
|
this._array = [];
|
|
@@ -12351,10 +12419,13 @@ var SafeLoopArray = /*#__PURE__*/ function() {
|
|
|
12351
12419
|
*/ _proto.loadScene = function loadScene(url, destroyOldScene) {
|
|
12352
12420
|
if (destroyOldScene === void 0) destroyOldScene = true;
|
|
12353
12421
|
var _this = this;
|
|
12354
|
-
var scenePromise = this.engine.resourceManager.load(
|
|
12422
|
+
var scenePromise = this.engine.resourceManager.load({
|
|
12423
|
+
url: url,
|
|
12424
|
+
type: exports.AssetType.Scene
|
|
12425
|
+
});
|
|
12355
12426
|
scenePromise.then(function(scene) {
|
|
12356
|
-
var scenes = _this._scenes;
|
|
12357
12427
|
if (destroyOldScene) {
|
|
12428
|
+
var scenes = _this._scenes.getArray();
|
|
12358
12429
|
for(var i = 0, n = scenes.length; i < n; i++){
|
|
12359
12430
|
scenes[i].destroy();
|
|
12360
12431
|
}
|
|
@@ -12984,17 +13055,21 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
12984
13055
|
if (this._currentEnteredEntity !== rayCastEntity) {
|
|
12985
13056
|
if (this._currentEnteredEntity) {
|
|
12986
13057
|
var scripts = this._currentEnteredEntity._scripts;
|
|
12987
|
-
|
|
12988
|
-
|
|
12989
|
-
|
|
13058
|
+
scripts.startLoop();
|
|
13059
|
+
for(var i = 0; i < scripts.length; i++){
|
|
13060
|
+
var _scripts_get;
|
|
13061
|
+
(_scripts_get = scripts.get(i)) == null ? void 0 : _scripts_get.onPointerExit(this);
|
|
12990
13062
|
}
|
|
13063
|
+
scripts.endLoop();
|
|
12991
13064
|
}
|
|
12992
13065
|
if (rayCastEntity) {
|
|
12993
13066
|
var scripts1 = rayCastEntity._scripts;
|
|
12994
|
-
|
|
12995
|
-
|
|
12996
|
-
|
|
13067
|
+
scripts1.startLoop();
|
|
13068
|
+
for(var i1 = 0; i1 < scripts1.length; i1++){
|
|
13069
|
+
var _scripts_get1;
|
|
13070
|
+
(_scripts_get1 = scripts1.get(i1)) == null ? void 0 : _scripts_get1.onPointerEnter(this);
|
|
12997
13071
|
}
|
|
13072
|
+
scripts1.endLoop();
|
|
12998
13073
|
}
|
|
12999
13074
|
this._currentEnteredEntity = rayCastEntity;
|
|
13000
13075
|
}
|
|
@@ -13004,10 +13079,12 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13004
13079
|
*/ _proto._firePointerDown = function _firePointerDown(rayCastEntity) {
|
|
13005
13080
|
if (rayCastEntity) {
|
|
13006
13081
|
var scripts = rayCastEntity._scripts;
|
|
13007
|
-
|
|
13008
|
-
|
|
13009
|
-
|
|
13082
|
+
scripts.startLoop();
|
|
13083
|
+
for(var i = 0; i < scripts.length; i++){
|
|
13084
|
+
var _scripts_get;
|
|
13085
|
+
(_scripts_get = scripts.get(i)) == null ? void 0 : _scripts_get.onPointerDown(this);
|
|
13010
13086
|
}
|
|
13087
|
+
scripts.endLoop();
|
|
13011
13088
|
}
|
|
13012
13089
|
this._currentPressedEntity = rayCastEntity;
|
|
13013
13090
|
};
|
|
@@ -13016,10 +13093,12 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13016
13093
|
*/ _proto._firePointerDrag = function _firePointerDrag() {
|
|
13017
13094
|
if (this._currentPressedEntity) {
|
|
13018
13095
|
var scripts = this._currentPressedEntity._scripts;
|
|
13019
|
-
|
|
13020
|
-
|
|
13021
|
-
|
|
13096
|
+
scripts.startLoop();
|
|
13097
|
+
for(var i = 0; i < scripts.length; i++){
|
|
13098
|
+
var _scripts_get;
|
|
13099
|
+
(_scripts_get = scripts.get(i)) == null ? void 0 : _scripts_get.onPointerDrag(this);
|
|
13022
13100
|
}
|
|
13101
|
+
scripts.endLoop();
|
|
13023
13102
|
}
|
|
13024
13103
|
};
|
|
13025
13104
|
/**
|
|
@@ -13029,13 +13108,15 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13029
13108
|
if (pressedEntity) {
|
|
13030
13109
|
var sameTarget = pressedEntity === rayCastEntity;
|
|
13031
13110
|
var scripts = pressedEntity._scripts;
|
|
13032
|
-
|
|
13111
|
+
scripts.startLoop();
|
|
13112
|
+
for(var i = 0; i < scripts.length; i++){
|
|
13033
13113
|
var script = scripts.get(i);
|
|
13034
|
-
if (
|
|
13114
|
+
if (script) {
|
|
13035
13115
|
sameTarget && script.onPointerClick(this);
|
|
13036
13116
|
script.onPointerUp(this);
|
|
13037
13117
|
}
|
|
13038
13118
|
}
|
|
13119
|
+
scripts.endLoop();
|
|
13039
13120
|
this._currentPressedEntity = null;
|
|
13040
13121
|
}
|
|
13041
13122
|
};
|
|
@@ -13639,114 +13720,138 @@ var Collision = function Collision() {
|
|
|
13639
13720
|
var shape1 = physicalObjectsMap[obj1];
|
|
13640
13721
|
var shape2 = physicalObjectsMap[obj2];
|
|
13641
13722
|
var scripts = shape1.collider.entity._scripts;
|
|
13642
|
-
|
|
13723
|
+
scripts.startLoop();
|
|
13724
|
+
for(var i = 0; i < scripts.length; i++){
|
|
13643
13725
|
var script = scripts.get(i);
|
|
13644
|
-
if (
|
|
13726
|
+
if (script) {
|
|
13645
13727
|
var collision = PhysicsScene._collision;
|
|
13646
13728
|
collision.shape = shape2;
|
|
13647
13729
|
script.onCollisionEnter(collision);
|
|
13648
13730
|
}
|
|
13649
13731
|
}
|
|
13732
|
+
scripts.endLoop();
|
|
13650
13733
|
scripts = shape2.collider.entity._scripts;
|
|
13651
|
-
|
|
13734
|
+
scripts.startLoop();
|
|
13735
|
+
for(var i1 = 0; i1 < scripts.length; i1++){
|
|
13652
13736
|
var script1 = scripts.get(i1);
|
|
13653
|
-
if (
|
|
13737
|
+
if (script1) {
|
|
13654
13738
|
var collision1 = PhysicsScene._collision;
|
|
13655
13739
|
collision1.shape = shape1;
|
|
13656
13740
|
script1.onCollisionEnter(collision1);
|
|
13657
13741
|
}
|
|
13658
13742
|
}
|
|
13743
|
+
scripts.endLoop();
|
|
13659
13744
|
};
|
|
13660
13745
|
this._onContactExit = function(obj1, obj2) {
|
|
13661
13746
|
var physicalObjectsMap = _this._scene.engine._physicalObjectsMap;
|
|
13662
13747
|
var shape1 = physicalObjectsMap[obj1];
|
|
13663
13748
|
var shape2 = physicalObjectsMap[obj2];
|
|
13664
13749
|
var scripts = shape1.collider.entity._scripts;
|
|
13665
|
-
|
|
13750
|
+
scripts.startLoop();
|
|
13751
|
+
for(var i = 0; i < scripts.length; i++){
|
|
13666
13752
|
var script = scripts.get(i);
|
|
13667
|
-
if (
|
|
13753
|
+
if (script) {
|
|
13668
13754
|
var collision = PhysicsScene._collision;
|
|
13669
13755
|
collision.shape = shape2;
|
|
13670
13756
|
script.onCollisionExit(collision);
|
|
13671
13757
|
}
|
|
13672
13758
|
}
|
|
13759
|
+
scripts.endLoop();
|
|
13673
13760
|
scripts = shape2.collider.entity._scripts;
|
|
13674
|
-
|
|
13761
|
+
scripts.startLoop();
|
|
13762
|
+
for(var i1 = 0; i1 < scripts.length; i1++){
|
|
13675
13763
|
var script1 = scripts.get(i1);
|
|
13676
|
-
if (
|
|
13764
|
+
if (script1) {
|
|
13677
13765
|
var collision1 = PhysicsScene._collision;
|
|
13678
13766
|
collision1.shape = shape1;
|
|
13679
13767
|
script1.onCollisionExit(collision1);
|
|
13680
13768
|
}
|
|
13681
13769
|
}
|
|
13770
|
+
scripts.endLoop();
|
|
13682
13771
|
};
|
|
13683
13772
|
this._onContactStay = function(obj1, obj2) {
|
|
13684
13773
|
var physicalObjectsMap = _this._scene.engine._physicalObjectsMap;
|
|
13685
13774
|
var shape1 = physicalObjectsMap[obj1];
|
|
13686
13775
|
var shape2 = physicalObjectsMap[obj2];
|
|
13687
13776
|
var scripts = shape1.collider.entity._scripts;
|
|
13688
|
-
|
|
13777
|
+
scripts.startLoop();
|
|
13778
|
+
for(var i = 0; i < scripts.length; i++){
|
|
13689
13779
|
var script = scripts.get(i);
|
|
13690
|
-
if (
|
|
13780
|
+
if (script) {
|
|
13691
13781
|
var collision = PhysicsScene._collision;
|
|
13692
13782
|
collision.shape = shape2;
|
|
13693
13783
|
script.onCollisionStay(collision);
|
|
13694
13784
|
}
|
|
13695
13785
|
}
|
|
13786
|
+
scripts.endLoop();
|
|
13696
13787
|
scripts = shape2.collider.entity._scripts;
|
|
13697
|
-
|
|
13788
|
+
scripts.startLoop();
|
|
13789
|
+
for(var i1 = 0; i1 < scripts.length; i1++){
|
|
13698
13790
|
var script1 = scripts.get(i1);
|
|
13699
|
-
if (
|
|
13791
|
+
if (script1) {
|
|
13700
13792
|
var collision1 = PhysicsScene._collision;
|
|
13701
13793
|
collision1.shape = shape1;
|
|
13702
13794
|
script1.onCollisionStay(collision1);
|
|
13703
13795
|
}
|
|
13704
13796
|
}
|
|
13797
|
+
scripts.endLoop();
|
|
13705
13798
|
};
|
|
13706
13799
|
this._onTriggerEnter = function(obj1, obj2) {
|
|
13707
13800
|
var physicalObjectsMap = _this._scene.engine._physicalObjectsMap;
|
|
13708
13801
|
var shape1 = physicalObjectsMap[obj1];
|
|
13709
13802
|
var shape2 = physicalObjectsMap[obj2];
|
|
13710
13803
|
var scripts = shape1.collider.entity._scripts;
|
|
13711
|
-
|
|
13712
|
-
|
|
13713
|
-
|
|
13804
|
+
scripts.startLoop();
|
|
13805
|
+
for(var i = 0; i < scripts.length; i++){
|
|
13806
|
+
var _scripts_get;
|
|
13807
|
+
(_scripts_get = scripts.get(i)) == null ? void 0 : _scripts_get.onTriggerEnter(shape2);
|
|
13714
13808
|
}
|
|
13809
|
+
scripts.endLoop();
|
|
13715
13810
|
scripts = shape2.collider.entity._scripts;
|
|
13716
|
-
|
|
13717
|
-
|
|
13718
|
-
|
|
13811
|
+
scripts.startLoop();
|
|
13812
|
+
for(var i1 = 0; i1 < scripts.length; i1++){
|
|
13813
|
+
var _scripts_get1;
|
|
13814
|
+
(_scripts_get1 = scripts.get(i1)) == null ? void 0 : _scripts_get1.onTriggerEnter(shape1);
|
|
13719
13815
|
}
|
|
13816
|
+
scripts.endLoop();
|
|
13720
13817
|
};
|
|
13721
13818
|
this._onTriggerExit = function(obj1, obj2) {
|
|
13722
13819
|
var physicalObjectsMap = _this._scene.engine._physicalObjectsMap;
|
|
13723
13820
|
var shape1 = physicalObjectsMap[obj1];
|
|
13724
13821
|
var shape2 = physicalObjectsMap[obj2];
|
|
13725
13822
|
var scripts = shape1.collider.entity._scripts;
|
|
13726
|
-
|
|
13727
|
-
|
|
13728
|
-
|
|
13823
|
+
scripts.startLoop();
|
|
13824
|
+
for(var i = 0; i < scripts.length; i++){
|
|
13825
|
+
var _scripts_get;
|
|
13826
|
+
(_scripts_get = scripts.get(i)) == null ? void 0 : _scripts_get.onTriggerExit(shape2);
|
|
13729
13827
|
}
|
|
13828
|
+
scripts.endLoop();
|
|
13730
13829
|
scripts = shape2.collider.entity._scripts;
|
|
13731
|
-
|
|
13732
|
-
|
|
13733
|
-
|
|
13830
|
+
scripts.startLoop();
|
|
13831
|
+
for(var i1 = 0; i1 < scripts.length; i1++){
|
|
13832
|
+
var _scripts_get1;
|
|
13833
|
+
(_scripts_get1 = scripts.get(i1)) == null ? void 0 : _scripts_get1.onTriggerExit(shape1);
|
|
13734
13834
|
}
|
|
13835
|
+
scripts.endLoop();
|
|
13735
13836
|
};
|
|
13736
13837
|
this._onTriggerStay = function(obj1, obj2) {
|
|
13737
13838
|
var physicalObjectsMap = _this._scene.engine._physicalObjectsMap;
|
|
13738
13839
|
var shape1 = physicalObjectsMap[obj1];
|
|
13739
13840
|
var shape2 = physicalObjectsMap[obj2];
|
|
13740
13841
|
var scripts = shape1.collider.entity._scripts;
|
|
13741
|
-
|
|
13742
|
-
|
|
13743
|
-
|
|
13842
|
+
scripts.startLoop();
|
|
13843
|
+
for(var i = 0; i < scripts.length; i++){
|
|
13844
|
+
var _scripts_get;
|
|
13845
|
+
(_scripts_get = scripts.get(i)) == null ? void 0 : _scripts_get.onTriggerStay(shape2);
|
|
13744
13846
|
}
|
|
13847
|
+
scripts.endLoop();
|
|
13745
13848
|
scripts = shape2.collider.entity._scripts;
|
|
13746
|
-
|
|
13747
|
-
|
|
13748
|
-
|
|
13849
|
+
scripts.startLoop();
|
|
13850
|
+
for(var i1 = 0; i1 < scripts.length; i1++){
|
|
13851
|
+
var _scripts_get1;
|
|
13852
|
+
(_scripts_get1 = scripts.get(i1)) == null ? void 0 : _scripts_get1.onTriggerStay(shape1);
|
|
13749
13853
|
}
|
|
13854
|
+
scripts.endLoop();
|
|
13750
13855
|
};
|
|
13751
13856
|
this._scene = scene;
|
|
13752
13857
|
this._setGravity = this._setGravity.bind(this);
|
|
@@ -16884,7 +16989,6 @@ ShaderPool.init();
|
|
|
16884
16989
|
this._onUpdateScripts = new DisorderedArray();
|
|
16885
16990
|
this._onLateUpdateScripts = new DisorderedArray();
|
|
16886
16991
|
this._onPhysicsUpdateScripts = new DisorderedArray();
|
|
16887
|
-
this._disableScripts = [];
|
|
16888
16992
|
this._pendingDestroyScripts = [];
|
|
16889
16993
|
this._disposeDestroyScripts = [];
|
|
16890
16994
|
// Animation
|
|
@@ -16962,102 +17066,110 @@ ShaderPool.init();
|
|
|
16962
17066
|
replaced && (replaced._onUpdateIndex = renderer._onUpdateIndex);
|
|
16963
17067
|
renderer._onUpdateIndex = -1;
|
|
16964
17068
|
};
|
|
16965
|
-
_proto.addDisableScript = function addDisableScript(component) {
|
|
16966
|
-
this._disableScripts.push(component);
|
|
16967
|
-
};
|
|
16968
17069
|
_proto.addPendingDestroyScript = function addPendingDestroyScript(component) {
|
|
16969
17070
|
this._pendingDestroyScripts.push(component);
|
|
16970
17071
|
};
|
|
16971
17072
|
_proto.callScriptOnStart = function callScriptOnStart() {
|
|
16972
17073
|
var onStartScripts = this._onStartScripts;
|
|
16973
17074
|
if (onStartScripts.length > 0) {
|
|
17075
|
+
onStartScripts.startLoop();
|
|
16974
17076
|
var elements = onStartScripts._elements;
|
|
16975
17077
|
// The 'onStartScripts.length' maybe add if you add some Script with addComponent() in some Script's onStart()
|
|
16976
17078
|
for(var i = 0; i < onStartScripts.length; i++){
|
|
16977
17079
|
var script = elements[i];
|
|
16978
|
-
if (
|
|
17080
|
+
if (script) {
|
|
16979
17081
|
script._started = true;
|
|
16980
|
-
script
|
|
17082
|
+
this.removeOnStartScript(script);
|
|
16981
17083
|
script.onStart();
|
|
16982
17084
|
}
|
|
16983
17085
|
}
|
|
16984
|
-
onStartScripts.
|
|
17086
|
+
onStartScripts.endLoopAndClear();
|
|
16985
17087
|
}
|
|
16986
17088
|
};
|
|
16987
17089
|
_proto.callScriptOnUpdate = function callScriptOnUpdate(deltaTime) {
|
|
16988
|
-
var
|
|
16989
|
-
|
|
17090
|
+
var onUpdateScripts = this._onUpdateScripts;
|
|
17091
|
+
onUpdateScripts.startLoop();
|
|
17092
|
+
var elements = onUpdateScripts._elements;
|
|
17093
|
+
for(var i = 0; i < onUpdateScripts.length; i++){
|
|
16990
17094
|
var element = elements[i];
|
|
16991
|
-
if (
|
|
17095
|
+
if (element == null ? void 0 : element._started) {
|
|
16992
17096
|
element.onUpdate(deltaTime);
|
|
16993
17097
|
}
|
|
16994
17098
|
}
|
|
17099
|
+
onUpdateScripts.endLoop();
|
|
16995
17100
|
};
|
|
16996
17101
|
_proto.callScriptOnLateUpdate = function callScriptOnLateUpdate(deltaTime) {
|
|
16997
|
-
var
|
|
16998
|
-
|
|
17102
|
+
var onLateUpdateScripts = this._onLateUpdateScripts;
|
|
17103
|
+
onLateUpdateScripts.startLoop();
|
|
17104
|
+
var elements = onLateUpdateScripts._elements;
|
|
17105
|
+
for(var i = 0; i < onLateUpdateScripts.length; i++){
|
|
16999
17106
|
var element = elements[i];
|
|
17000
|
-
if (
|
|
17107
|
+
if (element == null ? void 0 : element._started) {
|
|
17001
17108
|
element.onLateUpdate(deltaTime);
|
|
17002
17109
|
}
|
|
17003
17110
|
}
|
|
17111
|
+
onLateUpdateScripts.endLoop();
|
|
17004
17112
|
};
|
|
17005
17113
|
_proto.callScriptOnPhysicsUpdate = function callScriptOnPhysicsUpdate() {
|
|
17006
|
-
var
|
|
17007
|
-
|
|
17114
|
+
var onPhysicsUpdateScripts = this._onPhysicsUpdateScripts;
|
|
17115
|
+
onPhysicsUpdateScripts.startLoop();
|
|
17116
|
+
var elements = onPhysicsUpdateScripts._elements;
|
|
17117
|
+
for(var i = 0; i < onPhysicsUpdateScripts.length; i++){
|
|
17008
17118
|
var element = elements[i];
|
|
17009
|
-
if (
|
|
17119
|
+
if (element == null ? void 0 : element._started) {
|
|
17010
17120
|
element.onPhysicsUpdate();
|
|
17011
17121
|
}
|
|
17012
17122
|
}
|
|
17123
|
+
onPhysicsUpdateScripts.endLoop();
|
|
17013
17124
|
};
|
|
17014
17125
|
_proto.callAnimationUpdate = function callAnimationUpdate(deltaTime) {
|
|
17015
|
-
var
|
|
17016
|
-
|
|
17126
|
+
var onUpdateAnimations = this._onUpdateAnimations;
|
|
17127
|
+
onUpdateAnimations.startLoop();
|
|
17128
|
+
var elements = onUpdateAnimations._elements;
|
|
17129
|
+
for(var i = 0; i < onUpdateAnimations.length; i++){
|
|
17017
17130
|
//@ts-ignore
|
|
17018
17131
|
elements[i].update(deltaTime);
|
|
17019
17132
|
}
|
|
17133
|
+
onUpdateAnimations.endLoop();
|
|
17020
17134
|
};
|
|
17021
17135
|
_proto.callRendererOnUpdate = function callRendererOnUpdate(deltaTime) {
|
|
17022
|
-
var
|
|
17023
|
-
|
|
17136
|
+
var onUpdateRenderers = this._onUpdateRenderers;
|
|
17137
|
+
onUpdateRenderers.startLoop();
|
|
17138
|
+
var elements = onUpdateRenderers._elements;
|
|
17139
|
+
for(var i = 0; i < onUpdateRenderers.length; i++){
|
|
17024
17140
|
elements[i].update(deltaTime);
|
|
17025
17141
|
}
|
|
17142
|
+
onUpdateRenderers.endLoop();
|
|
17026
17143
|
};
|
|
17027
17144
|
_proto.handlingInvalidScripts = function handlingInvalidScripts() {
|
|
17028
|
-
var _this = this,
|
|
17029
|
-
var length = disableScripts.length;
|
|
17030
|
-
if (length > 0) {
|
|
17031
|
-
for(var i = length - 1; i >= 0; i--){
|
|
17032
|
-
var disableScript = disableScripts[i];
|
|
17033
|
-
disableScript._waitHandlingInValid && disableScript._handlingInValid();
|
|
17034
|
-
}
|
|
17035
|
-
disableScripts.length = 0;
|
|
17036
|
-
}
|
|
17037
|
-
var _this1 = this, pendingDestroyScripts = _this1._disposeDestroyScripts, disposeDestroyScripts = _this1._pendingDestroyScripts;
|
|
17145
|
+
var _this = this, pendingDestroyScripts = _this._disposeDestroyScripts, disposeDestroyScripts = _this._pendingDestroyScripts;
|
|
17038
17146
|
this._disposeDestroyScripts = disposeDestroyScripts;
|
|
17039
17147
|
this._pendingDestroyScripts = pendingDestroyScripts;
|
|
17040
17148
|
length = disposeDestroyScripts.length;
|
|
17041
17149
|
if (length > 0) {
|
|
17042
|
-
for(var
|
|
17043
|
-
disposeDestroyScripts[
|
|
17150
|
+
for(var i = length - 1; i >= 0; i--){
|
|
17151
|
+
disposeDestroyScripts[i].onDestroy();
|
|
17044
17152
|
}
|
|
17045
17153
|
disposeDestroyScripts.length = 0;
|
|
17046
17154
|
}
|
|
17047
17155
|
};
|
|
17048
17156
|
_proto.callCameraOnBeginRender = function callCameraOnBeginRender(camera) {
|
|
17049
17157
|
var scripts = camera.entity._scripts;
|
|
17050
|
-
|
|
17051
|
-
|
|
17052
|
-
|
|
17158
|
+
scripts.startLoop();
|
|
17159
|
+
for(var i = 0; i < scripts.length; i++){
|
|
17160
|
+
var _scripts_get;
|
|
17161
|
+
(_scripts_get = scripts.get(i)) == null ? void 0 : _scripts_get.onBeginRender(camera);
|
|
17053
17162
|
}
|
|
17163
|
+
scripts.endLoop();
|
|
17054
17164
|
};
|
|
17055
17165
|
_proto.callCameraOnEndRender = function callCameraOnEndRender(camera) {
|
|
17056
17166
|
var scripts = camera.entity._scripts;
|
|
17057
|
-
|
|
17058
|
-
|
|
17059
|
-
|
|
17167
|
+
scripts.startLoop();
|
|
17168
|
+
for(var i = 0; i < scripts.length; i++){
|
|
17169
|
+
var _scripts_get;
|
|
17170
|
+
(_scripts_get = scripts.get(i)) == null ? void 0 : _scripts_get.onEndRender(camera);
|
|
17060
17171
|
}
|
|
17172
|
+
scripts.endLoop();
|
|
17061
17173
|
};
|
|
17062
17174
|
_proto.getActiveChangedTempList = function getActiveChangedTempList() {
|
|
17063
17175
|
return this._componentsContainerPool.length ? this._componentsContainerPool.pop() : [];
|
|
@@ -18028,19 +18140,20 @@ __decorate([
|
|
|
18028
18140
|
}
|
|
18029
18141
|
// Process entity active/inActive
|
|
18030
18142
|
var inActiveChangeFlag = ActiveChangeFlag.None;
|
|
18031
|
-
if (
|
|
18032
|
-
|
|
18033
|
-
entity._isActiveInHierarchy && oldScene !== this && (inActiveChangeFlag |= ActiveChangeFlag.Scene);
|
|
18034
|
-
} else {
|
|
18035
|
-
entity._isActiveInHierarchy && (inActiveChangeFlag |= ActiveChangeFlag.Hierarchy);
|
|
18143
|
+
if (entity._isActiveInHierarchy) {
|
|
18144
|
+
this._isActiveInEngine || (inActiveChangeFlag |= ActiveChangeFlag.Hierarchy);
|
|
18036
18145
|
}
|
|
18146
|
+
// Cross scene should inActive first and then active
|
|
18147
|
+
entity._isActiveInScene && oldScene !== this && (inActiveChangeFlag |= ActiveChangeFlag.Scene);
|
|
18037
18148
|
inActiveChangeFlag && entity._processInActive(inActiveChangeFlag);
|
|
18038
18149
|
if (oldScene !== this) {
|
|
18039
18150
|
Entity._traverseSetOwnerScene(entity, this);
|
|
18040
18151
|
}
|
|
18041
18152
|
var activeChangeFlag = ActiveChangeFlag.None;
|
|
18042
|
-
if (
|
|
18043
|
-
|
|
18153
|
+
if (entity._isActive) {
|
|
18154
|
+
if (this._isActiveInEngine) {
|
|
18155
|
+
!entity._isActiveInHierarchy && (activeChangeFlag |= ActiveChangeFlag.Hierarchy);
|
|
18156
|
+
}
|
|
18044
18157
|
(!entity._isActiveInScene || oldScene !== this) && (activeChangeFlag |= ActiveChangeFlag.Scene);
|
|
18045
18158
|
}
|
|
18046
18159
|
activeChangeFlag && entity._processActive(activeChangeFlag);
|
|
@@ -18396,7 +18509,6 @@ __decorate([
|
|
|
18396
18509
|
/** @internal */ _this._onPreRenderIndex = -1;
|
|
18397
18510
|
/** @internal */ _this._onPostRenderIndex = -1;
|
|
18398
18511
|
_this._entityScriptsIndex = -1;
|
|
18399
|
-
_this._waitHandlingInValid = false;
|
|
18400
18512
|
return _this;
|
|
18401
18513
|
}
|
|
18402
18514
|
var _proto = Script.prototype;
|
|
@@ -18505,37 +18617,30 @@ __decorate([
|
|
|
18505
18617
|
/**
|
|
18506
18618
|
* @internal
|
|
18507
18619
|
*/ _proto._onEnableInScene = function _onEnableInScene() {
|
|
18508
|
-
|
|
18509
|
-
|
|
18510
|
-
|
|
18511
|
-
|
|
18512
|
-
|
|
18513
|
-
|
|
18514
|
-
|
|
18515
|
-
|
|
18516
|
-
|
|
18517
|
-
|
|
18518
|
-
|
|
18519
|
-
|
|
18520
|
-
|
|
18521
|
-
}
|
|
18522
|
-
if (this.onPhysicsUpdate !== prototype.onPhysicsUpdate) {
|
|
18523
|
-
componentsManager.addOnPhysicsUpdateScript(this);
|
|
18524
|
-
}
|
|
18525
|
-
this._entity._addScript(this);
|
|
18620
|
+
var _this_scene = this.scene, componentsManager = _this_scene._componentsManager;
|
|
18621
|
+
var prototype = Script.prototype;
|
|
18622
|
+
if (!this._started) {
|
|
18623
|
+
componentsManager.addOnStartScript(this);
|
|
18624
|
+
}
|
|
18625
|
+
if (this.onUpdate !== prototype.onUpdate) {
|
|
18626
|
+
componentsManager.addOnUpdateScript(this);
|
|
18627
|
+
}
|
|
18628
|
+
if (this.onLateUpdate !== prototype.onLateUpdate) {
|
|
18629
|
+
componentsManager.addOnLateUpdateScript(this);
|
|
18630
|
+
}
|
|
18631
|
+
if (this.onPhysicsUpdate !== prototype.onPhysicsUpdate) {
|
|
18632
|
+
componentsManager.addOnPhysicsUpdateScript(this);
|
|
18526
18633
|
}
|
|
18634
|
+
this._entity._addScript(this);
|
|
18527
18635
|
};
|
|
18528
18636
|
/**
|
|
18529
18637
|
* @internal
|
|
18530
18638
|
*/ _proto._onDisableInScene = function _onDisableInScene() {
|
|
18531
|
-
this._waitHandlingInValid = true;
|
|
18532
|
-
this.scene._componentsManager.addDisableScript(this);
|
|
18533
|
-
};
|
|
18534
|
-
/**
|
|
18535
|
-
* @internal
|
|
18536
|
-
*/ _proto._handlingInValid = function _handlingInValid() {
|
|
18537
18639
|
var componentsManager = this.scene._componentsManager;
|
|
18538
18640
|
var prototype = Script.prototype;
|
|
18641
|
+
if (!this._started) {
|
|
18642
|
+
componentsManager.removeOnStartScript(this);
|
|
18643
|
+
}
|
|
18539
18644
|
if (this.onUpdate !== prototype.onUpdate) {
|
|
18540
18645
|
componentsManager.removeOnUpdateScript(this);
|
|
18541
18646
|
}
|
|
@@ -18546,7 +18651,6 @@ __decorate([
|
|
|
18546
18651
|
componentsManager.removeOnPhysicsUpdateScript(this);
|
|
18547
18652
|
}
|
|
18548
18653
|
this._entity._removeScript(this);
|
|
18549
|
-
this._waitHandlingInValid = false;
|
|
18550
18654
|
};
|
|
18551
18655
|
/**
|
|
18552
18656
|
* @internal
|
|
@@ -18580,9 +18684,6 @@ __decorate([
|
|
|
18580
18684
|
__decorate([
|
|
18581
18685
|
ignoreClone
|
|
18582
18686
|
], Script.prototype, "_entityScriptsIndex", void 0);
|
|
18583
|
-
__decorate([
|
|
18584
|
-
ignoreClone
|
|
18585
|
-
], Script.prototype, "_waitHandlingInValid", void 0);
|
|
18586
18687
|
|
|
18587
18688
|
/**
|
|
18588
18689
|
* Depth texture mode.
|
|
@@ -20897,41 +20998,6 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
20897
20998
|
Loader._engineObjects = {};
|
|
20898
20999
|
})();
|
|
20899
21000
|
|
|
20900
|
-
/**
|
|
20901
|
-
* Asset Type.
|
|
20902
|
-
*/ exports.AssetType = void 0;
|
|
20903
|
-
(function(AssetType) {
|
|
20904
|
-
AssetType[/**
|
|
20905
|
-
* Plain text.
|
|
20906
|
-
* @remarks Will not be cached based on url in ResourceManager.
|
|
20907
|
-
*/ "Text"] = "Text";
|
|
20908
|
-
AssetType[/**
|
|
20909
|
-
* JSON.
|
|
20910
|
-
* @remarks Will not be cached based on url in ResourceManager.
|
|
20911
|
-
*/ "JSON"] = "JSON";
|
|
20912
|
-
AssetType[/**
|
|
20913
|
-
* ArrayBuffer.
|
|
20914
|
-
* @remarks Will not be cached based on url in ResourceManager.
|
|
20915
|
-
*/ "Buffer"] = "Buffer";
|
|
20916
|
-
AssetType[/** 2D Texture. */ "Texture2D"] = "Texture2D";
|
|
20917
|
-
AssetType[/** Cube Texture. */ "TextureCube"] = "TextureCube";
|
|
20918
|
-
AssetType[/** Material. */ "Material"] = "Material";
|
|
20919
|
-
AssetType[/** Mesh. */ "Mesh"] = "Mesh";
|
|
20920
|
-
AssetType[/** AnimationClip. */ "AnimationClip"] = "AnimationClip";
|
|
20921
|
-
AssetType[/** AnimatorController. */ "AnimatorController"] = "AnimatorController";
|
|
20922
|
-
AssetType[/** Prefab.*/ "GLTF"] = "GLTF";
|
|
20923
|
-
AssetType[/** Compress Texture. */ "KTX"] = "KTX";
|
|
20924
|
-
AssetType[/** Cube Compress Texture. */ "KTXCube"] = "KTXCube";
|
|
20925
|
-
AssetType[/** KTX2 Compress Texture */ "KTX2"] = "KTX2";
|
|
20926
|
-
AssetType[/** Sprite. */ "Sprite"] = "Sprite";
|
|
20927
|
-
AssetType[/** Sprite Atlas. */ "SpriteAtlas"] = "SpriteAtlas";
|
|
20928
|
-
AssetType[/** Ambient light. */ "Env"] = "Environment";
|
|
20929
|
-
AssetType[/** Scene. */ "Scene"] = "Scene";
|
|
20930
|
-
AssetType[/** HDR to cube. */ "HDR"] = "HDR";
|
|
20931
|
-
AssetType[/** Font. */ "Font"] = "Font";
|
|
20932
|
-
AssetType[/** Source Font, include ttf、 otf and woff. */ "SourceFont"] = "SourceFont";
|
|
20933
|
-
})(exports.AssetType || (exports.AssetType = {}));
|
|
20934
|
-
|
|
20935
21001
|
/**
|
|
20936
21002
|
* Alpha blend mode.
|
|
20937
21003
|
*/ exports.BlendMode = void 0;
|