@galacean/engine 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/browser.js +253 -185
- package/dist/browser.min.js +1 -1
- package/dist/main.js +1 -1
- package/dist/miniprogram.js +1 -1
- package/dist/module.js +1 -1
- package/package.json +5 -5
package/dist/browser.js
CHANGED
|
@@ -7639,6 +7639,8 @@
|
|
|
7639
7639
|
var DisorderedArray = function DisorderedArray(count) {
|
|
7640
7640
|
if (count === void 0) count = 0;
|
|
7641
7641
|
this.length = 0;
|
|
7642
|
+
this._isLooping = false;
|
|
7643
|
+
this._blankCount = 0;
|
|
7642
7644
|
this._elements = new Array(count);
|
|
7643
7645
|
};
|
|
7644
7646
|
var _proto = DisorderedArray.prototype;
|
|
@@ -7667,21 +7669,49 @@
|
|
|
7667
7669
|
}
|
|
7668
7670
|
return this._elements[index];
|
|
7669
7671
|
};
|
|
7672
|
+
_proto.startLoop = function startLoop() {
|
|
7673
|
+
this._isLooping = true;
|
|
7674
|
+
};
|
|
7670
7675
|
/**
|
|
7671
7676
|
* Delete the element at the specified index.
|
|
7672
7677
|
* @param index - The index of the element to be deleted
|
|
7673
7678
|
* @returns The replaced item is used to reset its index
|
|
7674
7679
|
*/ _proto.deleteByIndex = function deleteByIndex(index) {
|
|
7675
7680
|
var elements = this._elements;
|
|
7676
|
-
var end
|
|
7677
|
-
|
|
7678
|
-
|
|
7679
|
-
|
|
7680
|
-
|
|
7681
|
+
var end;
|
|
7682
|
+
if (this._isLooping) {
|
|
7683
|
+
this._elements[index] = null;
|
|
7684
|
+
this._blankCount++;
|
|
7685
|
+
} else {
|
|
7686
|
+
var endIndex = this.length - 1;
|
|
7687
|
+
if (index !== endIndex) {
|
|
7688
|
+
end = elements[endIndex];
|
|
7689
|
+
elements[index] = end;
|
|
7690
|
+
}
|
|
7691
|
+
elements[endIndex] = null;
|
|
7692
|
+
this.length--;
|
|
7681
7693
|
}
|
|
7682
|
-
this.length--;
|
|
7683
7694
|
return end;
|
|
7684
7695
|
};
|
|
7696
|
+
_proto.endLoop = function endLoop() {
|
|
7697
|
+
this._isLooping = false;
|
|
7698
|
+
if (this._blankCount) {
|
|
7699
|
+
var elements = this._elements;
|
|
7700
|
+
for(var i = 0, j = 0, n = this.length; i < n; i++){
|
|
7701
|
+
var element = elements[i];
|
|
7702
|
+
if (element) {
|
|
7703
|
+
elements[j++] = element;
|
|
7704
|
+
}
|
|
7705
|
+
}
|
|
7706
|
+
this.length -= this._blankCount;
|
|
7707
|
+
this._blankCount = 0;
|
|
7708
|
+
}
|
|
7709
|
+
};
|
|
7710
|
+
_proto.endLoopAndClear = function endLoopAndClear() {
|
|
7711
|
+
this._isLooping = false;
|
|
7712
|
+
this.length = 0;
|
|
7713
|
+
this._blankCount = 0;
|
|
7714
|
+
};
|
|
7685
7715
|
_proto.garbageCollection = function garbageCollection() {
|
|
7686
7716
|
this._elements.length = this.length;
|
|
7687
7717
|
};
|
|
@@ -8909,11 +8939,13 @@
|
|
|
8909
8939
|
if (!this._isActiveInHierarchy) {
|
|
8910
8940
|
child._isActiveInHierarchy && (inActiveChangeFlag |= ActiveChangeFlag.Hierarchy);
|
|
8911
8941
|
}
|
|
8912
|
-
if (
|
|
8913
|
-
|
|
8914
|
-
|
|
8915
|
-
|
|
8916
|
-
|
|
8942
|
+
if (child._isActiveInScene) {
|
|
8943
|
+
if (this._isActiveInScene) {
|
|
8944
|
+
// Cross scene should inActive first and then active
|
|
8945
|
+
oldScene !== newScene && (inActiveChangeFlag |= ActiveChangeFlag.Scene);
|
|
8946
|
+
} else {
|
|
8947
|
+
inActiveChangeFlag |= ActiveChangeFlag.Scene;
|
|
8948
|
+
}
|
|
8917
8949
|
}
|
|
8918
8950
|
inActiveChangeFlag && child._processInActive(inActiveChangeFlag);
|
|
8919
8951
|
if (child._scene !== newScene) {
|
|
@@ -9840,7 +9872,7 @@
|
|
|
9840
9872
|
var mobile_material_frag = "#define GLSLIFY 1\nuniform vec4 material_EmissiveColor;uniform vec4 material_BaseColor;uniform vec4 material_SpecularColor;uniform float material_Shininess;uniform float material_NormalIntensity;uniform float material_AlphaCutoff;\n#ifdef MATERIAL_HAS_EMISSIVETEXTURE\nuniform sampler2D material_EmissiveTexture;\n#endif\n#ifdef MATERIAL_HAS_BASETEXTURE\nuniform sampler2D material_BaseTexture;\n#endif\n#ifdef MATERIAL_HAS_SPECULAR_TEXTURE\nuniform sampler2D material_SpecularTexture;\n#endif\n#ifdef MATERIAL_HAS_NORMALTEXTURE\nuniform sampler2D material_NormalTexture;\n#endif\n"; // eslint-disable-line
|
|
9841
9873
|
var begin_mobile_frag = "#define GLSLIFY 1\nvec4 ambient=vec4(0.0);vec4 emission=material_EmissiveColor;vec4 diffuse=material_BaseColor;vec4 specular=material_SpecularColor;\n#ifdef MATERIAL_HAS_EMISSIVETEXTURE\nvec4 emissiveTextureColor=texture2D(material_EmissiveTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nemissiveTextureColor=gammaToLinear(emissiveTextureColor);\n#endif\nemission*=emissiveTextureColor;\n#endif\n#ifdef MATERIAL_HAS_BASETEXTURE\nvec4 diffuseTextureColor=texture2D(material_BaseTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ndiffuseTextureColor=gammaToLinear(diffuseTextureColor);\n#endif\ndiffuse*=diffuseTextureColor;\n#endif\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\ndiffuse*=v_color;\n#endif\n#ifdef MATERIAL_HAS_SPECULAR_TEXTURE\nvec4 specularTextureColor=texture2D(material_SpecularTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nspecularTextureColor=gammaToLinear(specularTextureColor);\n#endif\nspecular*=specularTextureColor;\n#endif\nambient=vec4(scene_EnvMapLight.diffuse*scene_EnvMapLight.diffuseIntensity,1.0)*diffuse;"; // eslint-disable-line
|
|
9842
9874
|
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
|
|
9843
|
-
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]))
|
|
9875
|
+
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
|
|
9844
9876
|
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
|
|
9845
9877
|
var noise_cellular_2D = "#define GLSLIFY 1\nvec2 cellular(vec2 P){vec2 Pi=mod289(floor(P));vec2 Pf=fract(P);vec3 oi=vec3(-1.0,0.0,1.0);vec3 of=vec3(-0.5,0.5,1.5);vec3 px=permute(Pi.x+oi);vec3 p=permute(px.x+Pi.y+oi);vec3 ox=fract(p*K)-Ko;vec3 oy=mod7(floor(p*K))*K-Ko;vec3 dx=Pf.x+0.5+jitter*ox;vec3 dy=Pf.y-of+jitter*oy;vec3 d1=dx*dx+dy*dy;p=permute(px.y+Pi.y+oi);ox=fract(p*K)-Ko;oy=mod7(floor(p*K))*K-Ko;dx=Pf.x-0.5+jitter*ox;dy=Pf.y-of+jitter*oy;vec3 d2=dx*dx+dy*dy;p=permute(px.z+Pi.y+oi);ox=fract(p*K)-Ko;oy=mod7(floor(p*K))*K-Ko;dx=Pf.x-1.5+jitter*ox;dy=Pf.y-of+jitter*oy;vec3 d3=dx*dx+dy*dy;vec3 d1a=min(d1,d2);d2=max(d1,d2);d2=min(d2,d3);d1=min(d1a,d2);d2=max(d1a,d2);d1.xy=(d1.x<d1.y)? d1.xy : d1.yx;d1.xz=(d1.x<d1.z)? d1.xz : d1.zx;d1.yz=min(d1.yz,d2.yz);d1.y=min(d1.y,d1.z);d1.y=min(d1.y,d2.x);return sqrt(d1.xy);}"; // eslint-disable-line
|
|
9846
9878
|
var noise_cellular_2x2 = "#define GLSLIFY 1\nvec2 cellular2x2(vec2 P){vec2 Pi=mod289(floor(P));vec2 Pf=fract(P);vec4 Pfx=Pf.x+vec4(-0.5,-1.5,-0.5,-1.5);vec4 Pfy=Pf.y+vec4(-0.5,-0.5,-1.5,-1.5);vec4 p=permute(Pi.x+vec4(0.0,1.0,0.0,1.0));p=permute(p+Pi.y+vec4(0.0,0.0,1.0,1.0));vec4 ox=mod7(p)*K+Kd2;vec4 oy=mod7(floor(p*K))*K+Kd2;vec4 dx=Pfx+jitter1*ox;vec4 dy=Pfy+jitter1*oy;vec4 d=dx*dx+dy*dy;d.xy=(d.x<d.y)? d.xy : d.yx;d.xz=(d.x<d.z)? d.xz : d.zx;d.xw=(d.x<d.w)? d.xw : d.wx;d.y=min(d.y,d.z);d.y=min(d.y,d.w);return sqrt(d.xy);}"; // eslint-disable-line
|
|
@@ -9860,7 +9892,7 @@
|
|
|
9860
9892
|
var pbr_frag_define = "#define GLSLIFY 1\nuniform float material_AlphaCutoff;uniform vec4 material_BaseColor;uniform float material_Metal;uniform float material_Roughness;uniform float material_IOR;uniform vec3 material_PBRSpecularColor;uniform float material_Glossiness;uniform vec3 material_EmissiveColor;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nuniform float material_ClearCoat;uniform float material_ClearCoatRoughness;\n#endif\nuniform float material_NormalIntensity;uniform float material_OcclusionIntensity;uniform float material_OcclusionTextureCoord;\n#ifdef MATERIAL_HAS_BASETEXTURE\nuniform sampler2D material_BaseTexture;\n#endif\n#ifdef MATERIAL_HAS_NORMALTEXTURE\nuniform sampler2D material_NormalTexture;\n#endif\n#ifdef MATERIAL_HAS_EMISSIVETEXTURE\nuniform sampler2D material_EmissiveTexture;\n#endif\n#ifdef MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE\nuniform sampler2D material_RoughnessMetallicTexture;\n#endif\n#ifdef MATERIAL_HAS_SPECULAR_GLOSSINESS_TEXTURE\nuniform sampler2D material_SpecularGlossinessTexture;\n#endif\n#ifdef MATERIAL_HAS_OCCLUSION_TEXTURE\nuniform sampler2D material_OcclusionTexture;\n#endif\n#ifdef MATERIAL_HAS_CLEAR_COAT_TEXTURE\nuniform sampler2D material_ClearCoatTexture;\n#endif\n#ifdef MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE\nuniform sampler2D material_ClearCoatRoughnessTexture;\n#endif\n#ifdef MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE\nuniform sampler2D material_ClearCoatNormalTexture;\n#endif\nstruct ReflectedLight{vec3 directDiffuse;vec3 directSpecular;vec3 indirectDiffuse;vec3 indirectSpecular;};struct Geometry{vec3 position;vec3 normal;vec3 viewDir;float dotNV;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nvec3 clearCoatNormal;float clearCoatDotNV;\n#endif\n};struct Material{vec3 diffuseColor;float roughness;vec3 specularColor;float opacity;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nfloat clearCoat;float clearCoatRoughness;\n#endif\n};"; // eslint-disable-line
|
|
9861
9893
|
var pbr_helper = "#define GLSLIFY 1\n#include <normal_get>\nfloat computeSpecularOcclusion(float ambientOcclusion,float roughness,float dotNV){return saturate(pow(dotNV+ambientOcclusion,exp2(-16.0*roughness-1.0))-1.0+ambientOcclusion);}float getAARoughnessFactor(vec3 normal){\n#ifdef HAS_DERIVATIVES\nvec3 dxy=max(abs(dFdx(normal)),abs(dFdy(normal)));return 0.04+max(max(dxy.x,dxy.y),dxy.z);\n#else\nreturn 0.04;\n#endif\n}void initGeometry(out Geometry geometry,bool isFrontFacing){geometry.position=v_pos;geometry.viewDir=normalize(camera_Position-v_pos);\n#if defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE)\nmat3 tbn=getTBN(isFrontFacing);\n#endif\n#ifdef MATERIAL_HAS_NORMALTEXTURE\ngeometry.normal=getNormalByNormalTexture(tbn,material_NormalTexture,material_NormalIntensity,v_uv,isFrontFacing);\n#else\ngeometry.normal=getNormal(isFrontFacing);\n#endif\ngeometry.dotNV=saturate(dot(geometry.normal,geometry.viewDir));\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\n#ifdef MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE\ngeometry.clearCoatNormal=getNormalByNormalTexture(tbn,material_ClearCoatNormalTexture,material_NormalIntensity,v_uv,isFrontFacing);\n#else\ngeometry.clearCoatNormal=getNormal(isFrontFacing);\n#endif\ngeometry.clearCoatDotNV=saturate(dot(geometry.clearCoatNormal,geometry.viewDir));\n#endif\n}void initMaterial(out Material material,const in Geometry geometry){vec4 baseColor=material_BaseColor;float metal=material_Metal;float roughness=material_Roughness;vec3 specularColor=material_PBRSpecularColor;float glossiness=material_Glossiness;float alphaCutoff=material_AlphaCutoff;float F0=pow2((material_IOR-1.0)/(material_IOR+1.0));\n#ifdef MATERIAL_HAS_BASETEXTURE\nvec4 baseTextureColor=texture2D(material_BaseTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nbaseTextureColor=gammaToLinear(baseTextureColor);\n#endif\nbaseColor*=baseTextureColor;\n#endif\n#ifdef RENDERER_ENABLE_VERTEXCOLOR\nbaseColor*=v_color;\n#endif\n#ifdef MATERIAL_IS_ALPHA_CUTOFF\nif(baseColor.a<alphaCutoff){discard;}\n#endif\n#ifdef MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE\nvec4 metalRoughMapColor=texture2D(material_RoughnessMetallicTexture,v_uv);roughness*=metalRoughMapColor.g;metal*=metalRoughMapColor.b;\n#endif\n#ifdef MATERIAL_HAS_SPECULAR_GLOSSINESS_TEXTURE\nvec4 specularGlossinessColor=texture2D(material_SpecularGlossinessTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nspecularGlossinessColor=gammaToLinear(specularGlossinessColor);\n#endif\nspecularColor*=specularGlossinessColor.rgb;glossiness*=specularGlossinessColor.a;\n#endif\n#ifdef IS_METALLIC_WORKFLOW\nmaterial.diffuseColor=baseColor.rgb*(1.0-metal);material.specularColor=mix(vec3(F0),baseColor.rgb,metal);material.roughness=roughness;\n#else\nfloat specularStrength=max(max(specularColor.r,specularColor.g),specularColor.b);material.diffuseColor=baseColor.rgb*(1.0-specularStrength);material.specularColor=specularColor;material.roughness=1.0-glossiness;\n#endif\nmaterial.roughness=max(material.roughness,getAARoughnessFactor(geometry.normal));\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nmaterial.clearCoat=material_ClearCoat;material.clearCoatRoughness=material_ClearCoatRoughness;\n#ifdef MATERIAL_HAS_CLEAR_COAT_TEXTURE\nmaterial.clearCoat*=texture2D(material_ClearCoatTexture,v_uv).r;\n#endif\n#ifdef MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE\nmaterial.clearCoatRoughness*=texture2D(material_ClearCoatRoughnessTexture,v_uv).g;\n#endif\nmaterial.clearCoat=saturate(material.clearCoat);material.clearCoatRoughness=max(material.clearCoatRoughness,getAARoughnessFactor(geometry.clearCoatNormal));\n#endif\n#ifdef MATERIAL_IS_TRANSPARENT\nmaterial.opacity=baseColor.a;\n#else\nmaterial.opacity=1.0;\n#endif\n}\n#include <brdf>\n#include <direct_irradiance_frag_define>\n#include <ibl_frag_define>\n"; // eslint-disable-line
|
|
9862
9894
|
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
|
|
9863
|
-
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]))
|
|
9895
|
+
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
|
|
9864
9896
|
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
|
|
9865
9897
|
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.viewDir,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.viewDir,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(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
|
|
9866
9898
|
var PBRShaderLib = {
|
|
@@ -16286,19 +16318,20 @@
|
|
|
16286
16318
|
/**
|
|
16287
16319
|
* @internal
|
|
16288
16320
|
*/ _proto.update = function update() {
|
|
16289
|
-
var skin =
|
|
16290
|
-
if (skin) {
|
|
16291
|
-
var ibms = skin.inverseBindMatrices;
|
|
16292
|
-
var worldToLocal = this._rootBone.getInvModelMatrix();
|
|
16293
|
-
var _this = this, bones = _this._bones, jointMatrices = _this._jointMatrices;
|
|
16321
|
+
var _this = this, skin = _this._skin, bones = _this._bones;
|
|
16322
|
+
if (skin && bones) {
|
|
16294
16323
|
// @todo: can optimize when share skin
|
|
16324
|
+
var jointMatrices = this._jointMatrices;
|
|
16325
|
+
var bindMatrices = skin.inverseBindMatrices;
|
|
16326
|
+
var _this__rootBone;
|
|
16327
|
+
var worldToLocal = ((_this__rootBone = this._rootBone) != null ? _this__rootBone : this.entity).getInvModelMatrix();
|
|
16295
16328
|
for(var i = bones.length - 1; i >= 0; i--){
|
|
16296
16329
|
var bone = bones[i];
|
|
16297
16330
|
var offset = i * 16;
|
|
16298
16331
|
if (bone) {
|
|
16299
|
-
Utils._floatMatrixMultiply(bone.transform.worldMatrix,
|
|
16332
|
+
Utils._floatMatrixMultiply(bone.transform.worldMatrix, bindMatrices[i].elements, 0, jointMatrices, offset);
|
|
16300
16333
|
} else {
|
|
16301
|
-
jointMatrices.set(
|
|
16334
|
+
jointMatrices.set(bindMatrices[i].elements, offset);
|
|
16302
16335
|
}
|
|
16303
16336
|
Utils._floatMatrixMultiply(worldToLocal, jointMatrices, offset, jointMatrices, offset);
|
|
16304
16337
|
}
|
|
@@ -16962,6 +16995,40 @@
|
|
|
16962
16995
|
};
|
|
16963
16996
|
return TextRenderData;
|
|
16964
16997
|
}(RenderData);
|
|
16998
|
+
/**
|
|
16999
|
+
* Asset Type.
|
|
17000
|
+
*/ exports.AssetType = void 0;
|
|
17001
|
+
(function(AssetType) {
|
|
17002
|
+
AssetType[/**
|
|
17003
|
+
* Plain text.
|
|
17004
|
+
* @remarks Will not be cached based on url in ResourceManager.
|
|
17005
|
+
*/ "Text"] = "Text";
|
|
17006
|
+
AssetType[/**
|
|
17007
|
+
* JSON.
|
|
17008
|
+
* @remarks Will not be cached based on url in ResourceManager.
|
|
17009
|
+
*/ "JSON"] = "JSON";
|
|
17010
|
+
AssetType[/**
|
|
17011
|
+
* ArrayBuffer.
|
|
17012
|
+
* @remarks Will not be cached based on url in ResourceManager.
|
|
17013
|
+
*/ "Buffer"] = "Buffer";
|
|
17014
|
+
AssetType[/** 2D Texture. */ "Texture2D"] = "Texture2D";
|
|
17015
|
+
AssetType[/** Cube Texture. */ "TextureCube"] = "TextureCube";
|
|
17016
|
+
AssetType[/** Material. */ "Material"] = "Material";
|
|
17017
|
+
AssetType[/** Mesh. */ "Mesh"] = "Mesh";
|
|
17018
|
+
AssetType[/** AnimationClip. */ "AnimationClip"] = "AnimationClip";
|
|
17019
|
+
AssetType[/** AnimatorController. */ "AnimatorController"] = "AnimatorController";
|
|
17020
|
+
AssetType[/** Prefab.*/ "GLTF"] = "GLTF";
|
|
17021
|
+
AssetType[/** Compress Texture. */ "KTX"] = "KTX";
|
|
17022
|
+
AssetType[/** Cube Compress Texture. */ "KTXCube"] = "KTXCube";
|
|
17023
|
+
AssetType[/** KTX2 Compress Texture */ "KTX2"] = "KTX2";
|
|
17024
|
+
AssetType[/** Sprite. */ "Sprite"] = "Sprite";
|
|
17025
|
+
AssetType[/** Sprite Atlas. */ "SpriteAtlas"] = "SpriteAtlas";
|
|
17026
|
+
AssetType[/** Ambient light. */ "Env"] = "Environment";
|
|
17027
|
+
AssetType[/** Scene. */ "Scene"] = "Scene";
|
|
17028
|
+
AssetType[/** HDR to cube. */ "HDR"] = "HDR";
|
|
17029
|
+
AssetType[/** Font. */ "Font"] = "Font";
|
|
17030
|
+
AssetType[/** Source Font, include ttf、 otf and woff. */ "SourceFont"] = "SourceFont";
|
|
17031
|
+
})(exports.AssetType || (exports.AssetType = {}));
|
|
16965
17032
|
var SafeLoopArray = /*#__PURE__*/ function() {
|
|
16966
17033
|
var SafeLoopArray = function SafeLoopArray() {
|
|
16967
17034
|
this._array = [];
|
|
@@ -17073,10 +17140,13 @@
|
|
|
17073
17140
|
*/ _proto.loadScene = function loadScene(url, destroyOldScene) {
|
|
17074
17141
|
if (destroyOldScene === void 0) destroyOldScene = true;
|
|
17075
17142
|
var _this = this;
|
|
17076
|
-
var scenePromise = this.engine.resourceManager.load(
|
|
17143
|
+
var scenePromise = this.engine.resourceManager.load({
|
|
17144
|
+
url: url,
|
|
17145
|
+
type: exports.AssetType.Scene
|
|
17146
|
+
});
|
|
17077
17147
|
scenePromise.then(function(scene) {
|
|
17078
|
-
var scenes = _this._scenes;
|
|
17079
17148
|
if (destroyOldScene) {
|
|
17149
|
+
var scenes = _this._scenes.getArray();
|
|
17080
17150
|
for(var i = 0, n = scenes.length; i < n; i++){
|
|
17081
17151
|
scenes[i].destroy();
|
|
17082
17152
|
}
|
|
@@ -17700,17 +17770,21 @@
|
|
|
17700
17770
|
if (this._currentEnteredEntity !== rayCastEntity) {
|
|
17701
17771
|
if (this._currentEnteredEntity) {
|
|
17702
17772
|
var scripts = this._currentEnteredEntity._scripts;
|
|
17703
|
-
|
|
17704
|
-
|
|
17705
|
-
|
|
17773
|
+
scripts.startLoop();
|
|
17774
|
+
for(var i = 0; i < scripts.length; i++){
|
|
17775
|
+
var _scripts_get;
|
|
17776
|
+
(_scripts_get = scripts.get(i)) == null ? void 0 : _scripts_get.onPointerExit(this);
|
|
17706
17777
|
}
|
|
17778
|
+
scripts.endLoop();
|
|
17707
17779
|
}
|
|
17708
17780
|
if (rayCastEntity) {
|
|
17709
17781
|
var scripts1 = rayCastEntity._scripts;
|
|
17710
|
-
|
|
17711
|
-
|
|
17712
|
-
|
|
17782
|
+
scripts1.startLoop();
|
|
17783
|
+
for(var i1 = 0; i1 < scripts1.length; i1++){
|
|
17784
|
+
var _scripts_get1;
|
|
17785
|
+
(_scripts_get1 = scripts1.get(i1)) == null ? void 0 : _scripts_get1.onPointerEnter(this);
|
|
17713
17786
|
}
|
|
17787
|
+
scripts1.endLoop();
|
|
17714
17788
|
}
|
|
17715
17789
|
this._currentEnteredEntity = rayCastEntity;
|
|
17716
17790
|
}
|
|
@@ -17720,10 +17794,12 @@
|
|
|
17720
17794
|
*/ _proto._firePointerDown = function _firePointerDown(rayCastEntity) {
|
|
17721
17795
|
if (rayCastEntity) {
|
|
17722
17796
|
var scripts = rayCastEntity._scripts;
|
|
17723
|
-
|
|
17724
|
-
|
|
17725
|
-
|
|
17797
|
+
scripts.startLoop();
|
|
17798
|
+
for(var i = 0; i < scripts.length; i++){
|
|
17799
|
+
var _scripts_get;
|
|
17800
|
+
(_scripts_get = scripts.get(i)) == null ? void 0 : _scripts_get.onPointerDown(this);
|
|
17726
17801
|
}
|
|
17802
|
+
scripts.endLoop();
|
|
17727
17803
|
}
|
|
17728
17804
|
this._currentPressedEntity = rayCastEntity;
|
|
17729
17805
|
};
|
|
@@ -17732,10 +17808,12 @@
|
|
|
17732
17808
|
*/ _proto._firePointerDrag = function _firePointerDrag() {
|
|
17733
17809
|
if (this._currentPressedEntity) {
|
|
17734
17810
|
var scripts = this._currentPressedEntity._scripts;
|
|
17735
|
-
|
|
17736
|
-
|
|
17737
|
-
|
|
17811
|
+
scripts.startLoop();
|
|
17812
|
+
for(var i = 0; i < scripts.length; i++){
|
|
17813
|
+
var _scripts_get;
|
|
17814
|
+
(_scripts_get = scripts.get(i)) == null ? void 0 : _scripts_get.onPointerDrag(this);
|
|
17738
17815
|
}
|
|
17816
|
+
scripts.endLoop();
|
|
17739
17817
|
}
|
|
17740
17818
|
};
|
|
17741
17819
|
/**
|
|
@@ -17745,13 +17823,15 @@
|
|
|
17745
17823
|
if (pressedEntity) {
|
|
17746
17824
|
var sameTarget = pressedEntity === rayCastEntity;
|
|
17747
17825
|
var scripts = pressedEntity._scripts;
|
|
17748
|
-
|
|
17826
|
+
scripts.startLoop();
|
|
17827
|
+
for(var i = 0; i < scripts.length; i++){
|
|
17749
17828
|
var script = scripts.get(i);
|
|
17750
|
-
if (
|
|
17829
|
+
if (script) {
|
|
17751
17830
|
sameTarget && script.onPointerClick(this);
|
|
17752
17831
|
script.onPointerUp(this);
|
|
17753
17832
|
}
|
|
17754
17833
|
}
|
|
17834
|
+
scripts.endLoop();
|
|
17755
17835
|
this._currentPressedEntity = null;
|
|
17756
17836
|
}
|
|
17757
17837
|
};
|
|
@@ -18346,114 +18426,138 @@
|
|
|
18346
18426
|
var shape1 = physicalObjectsMap[obj1];
|
|
18347
18427
|
var shape2 = physicalObjectsMap[obj2];
|
|
18348
18428
|
var scripts = shape1.collider.entity._scripts;
|
|
18349
|
-
|
|
18429
|
+
scripts.startLoop();
|
|
18430
|
+
for(var i = 0; i < scripts.length; i++){
|
|
18350
18431
|
var script = scripts.get(i);
|
|
18351
|
-
if (
|
|
18432
|
+
if (script) {
|
|
18352
18433
|
var collision = PhysicsScene._collision;
|
|
18353
18434
|
collision.shape = shape2;
|
|
18354
18435
|
script.onCollisionEnter(collision);
|
|
18355
18436
|
}
|
|
18356
18437
|
}
|
|
18438
|
+
scripts.endLoop();
|
|
18357
18439
|
scripts = shape2.collider.entity._scripts;
|
|
18358
|
-
|
|
18440
|
+
scripts.startLoop();
|
|
18441
|
+
for(var i1 = 0; i1 < scripts.length; i1++){
|
|
18359
18442
|
var script1 = scripts.get(i1);
|
|
18360
|
-
if (
|
|
18443
|
+
if (script1) {
|
|
18361
18444
|
var collision1 = PhysicsScene._collision;
|
|
18362
18445
|
collision1.shape = shape1;
|
|
18363
18446
|
script1.onCollisionEnter(collision1);
|
|
18364
18447
|
}
|
|
18365
18448
|
}
|
|
18449
|
+
scripts.endLoop();
|
|
18366
18450
|
};
|
|
18367
18451
|
this._onContactExit = function(obj1, obj2) {
|
|
18368
18452
|
var physicalObjectsMap = _this._scene.engine._physicalObjectsMap;
|
|
18369
18453
|
var shape1 = physicalObjectsMap[obj1];
|
|
18370
18454
|
var shape2 = physicalObjectsMap[obj2];
|
|
18371
18455
|
var scripts = shape1.collider.entity._scripts;
|
|
18372
|
-
|
|
18456
|
+
scripts.startLoop();
|
|
18457
|
+
for(var i = 0; i < scripts.length; i++){
|
|
18373
18458
|
var script = scripts.get(i);
|
|
18374
|
-
if (
|
|
18459
|
+
if (script) {
|
|
18375
18460
|
var collision = PhysicsScene._collision;
|
|
18376
18461
|
collision.shape = shape2;
|
|
18377
18462
|
script.onCollisionExit(collision);
|
|
18378
18463
|
}
|
|
18379
18464
|
}
|
|
18465
|
+
scripts.endLoop();
|
|
18380
18466
|
scripts = shape2.collider.entity._scripts;
|
|
18381
|
-
|
|
18467
|
+
scripts.startLoop();
|
|
18468
|
+
for(var i1 = 0; i1 < scripts.length; i1++){
|
|
18382
18469
|
var script1 = scripts.get(i1);
|
|
18383
|
-
if (
|
|
18470
|
+
if (script1) {
|
|
18384
18471
|
var collision1 = PhysicsScene._collision;
|
|
18385
18472
|
collision1.shape = shape1;
|
|
18386
18473
|
script1.onCollisionExit(collision1);
|
|
18387
18474
|
}
|
|
18388
18475
|
}
|
|
18476
|
+
scripts.endLoop();
|
|
18389
18477
|
};
|
|
18390
18478
|
this._onContactStay = function(obj1, obj2) {
|
|
18391
18479
|
var physicalObjectsMap = _this._scene.engine._physicalObjectsMap;
|
|
18392
18480
|
var shape1 = physicalObjectsMap[obj1];
|
|
18393
18481
|
var shape2 = physicalObjectsMap[obj2];
|
|
18394
18482
|
var scripts = shape1.collider.entity._scripts;
|
|
18395
|
-
|
|
18483
|
+
scripts.startLoop();
|
|
18484
|
+
for(var i = 0; i < scripts.length; i++){
|
|
18396
18485
|
var script = scripts.get(i);
|
|
18397
|
-
if (
|
|
18486
|
+
if (script) {
|
|
18398
18487
|
var collision = PhysicsScene._collision;
|
|
18399
18488
|
collision.shape = shape2;
|
|
18400
18489
|
script.onCollisionStay(collision);
|
|
18401
18490
|
}
|
|
18402
18491
|
}
|
|
18492
|
+
scripts.endLoop();
|
|
18403
18493
|
scripts = shape2.collider.entity._scripts;
|
|
18404
|
-
|
|
18494
|
+
scripts.startLoop();
|
|
18495
|
+
for(var i1 = 0; i1 < scripts.length; i1++){
|
|
18405
18496
|
var script1 = scripts.get(i1);
|
|
18406
|
-
if (
|
|
18497
|
+
if (script1) {
|
|
18407
18498
|
var collision1 = PhysicsScene._collision;
|
|
18408
18499
|
collision1.shape = shape1;
|
|
18409
18500
|
script1.onCollisionStay(collision1);
|
|
18410
18501
|
}
|
|
18411
18502
|
}
|
|
18503
|
+
scripts.endLoop();
|
|
18412
18504
|
};
|
|
18413
18505
|
this._onTriggerEnter = function(obj1, obj2) {
|
|
18414
18506
|
var physicalObjectsMap = _this._scene.engine._physicalObjectsMap;
|
|
18415
18507
|
var shape1 = physicalObjectsMap[obj1];
|
|
18416
18508
|
var shape2 = physicalObjectsMap[obj2];
|
|
18417
18509
|
var scripts = shape1.collider.entity._scripts;
|
|
18418
|
-
|
|
18419
|
-
|
|
18420
|
-
|
|
18510
|
+
scripts.startLoop();
|
|
18511
|
+
for(var i = 0; i < scripts.length; i++){
|
|
18512
|
+
var _scripts_get;
|
|
18513
|
+
(_scripts_get = scripts.get(i)) == null ? void 0 : _scripts_get.onTriggerEnter(shape2);
|
|
18421
18514
|
}
|
|
18515
|
+
scripts.endLoop();
|
|
18422
18516
|
scripts = shape2.collider.entity._scripts;
|
|
18423
|
-
|
|
18424
|
-
|
|
18425
|
-
|
|
18517
|
+
scripts.startLoop();
|
|
18518
|
+
for(var i1 = 0; i1 < scripts.length; i1++){
|
|
18519
|
+
var _scripts_get1;
|
|
18520
|
+
(_scripts_get1 = scripts.get(i1)) == null ? void 0 : _scripts_get1.onTriggerEnter(shape1);
|
|
18426
18521
|
}
|
|
18522
|
+
scripts.endLoop();
|
|
18427
18523
|
};
|
|
18428
18524
|
this._onTriggerExit = function(obj1, obj2) {
|
|
18429
18525
|
var physicalObjectsMap = _this._scene.engine._physicalObjectsMap;
|
|
18430
18526
|
var shape1 = physicalObjectsMap[obj1];
|
|
18431
18527
|
var shape2 = physicalObjectsMap[obj2];
|
|
18432
18528
|
var scripts = shape1.collider.entity._scripts;
|
|
18433
|
-
|
|
18434
|
-
|
|
18435
|
-
|
|
18529
|
+
scripts.startLoop();
|
|
18530
|
+
for(var i = 0; i < scripts.length; i++){
|
|
18531
|
+
var _scripts_get;
|
|
18532
|
+
(_scripts_get = scripts.get(i)) == null ? void 0 : _scripts_get.onTriggerExit(shape2);
|
|
18436
18533
|
}
|
|
18534
|
+
scripts.endLoop();
|
|
18437
18535
|
scripts = shape2.collider.entity._scripts;
|
|
18438
|
-
|
|
18439
|
-
|
|
18440
|
-
|
|
18536
|
+
scripts.startLoop();
|
|
18537
|
+
for(var i1 = 0; i1 < scripts.length; i1++){
|
|
18538
|
+
var _scripts_get1;
|
|
18539
|
+
(_scripts_get1 = scripts.get(i1)) == null ? void 0 : _scripts_get1.onTriggerExit(shape1);
|
|
18441
18540
|
}
|
|
18541
|
+
scripts.endLoop();
|
|
18442
18542
|
};
|
|
18443
18543
|
this._onTriggerStay = function(obj1, obj2) {
|
|
18444
18544
|
var physicalObjectsMap = _this._scene.engine._physicalObjectsMap;
|
|
18445
18545
|
var shape1 = physicalObjectsMap[obj1];
|
|
18446
18546
|
var shape2 = physicalObjectsMap[obj2];
|
|
18447
18547
|
var scripts = shape1.collider.entity._scripts;
|
|
18448
|
-
|
|
18449
|
-
|
|
18450
|
-
|
|
18548
|
+
scripts.startLoop();
|
|
18549
|
+
for(var i = 0; i < scripts.length; i++){
|
|
18550
|
+
var _scripts_get;
|
|
18551
|
+
(_scripts_get = scripts.get(i)) == null ? void 0 : _scripts_get.onTriggerStay(shape2);
|
|
18451
18552
|
}
|
|
18553
|
+
scripts.endLoop();
|
|
18452
18554
|
scripts = shape2.collider.entity._scripts;
|
|
18453
|
-
|
|
18454
|
-
|
|
18455
|
-
|
|
18555
|
+
scripts.startLoop();
|
|
18556
|
+
for(var i1 = 0; i1 < scripts.length; i1++){
|
|
18557
|
+
var _scripts_get1;
|
|
18558
|
+
(_scripts_get1 = scripts.get(i1)) == null ? void 0 : _scripts_get1.onTriggerStay(shape1);
|
|
18456
18559
|
}
|
|
18560
|
+
scripts.endLoop();
|
|
18457
18561
|
};
|
|
18458
18562
|
this._scene = scene;
|
|
18459
18563
|
this._setGravity = this._setGravity.bind(this);
|
|
@@ -21525,7 +21629,6 @@
|
|
|
21525
21629
|
this._onUpdateScripts = new DisorderedArray();
|
|
21526
21630
|
this._onLateUpdateScripts = new DisorderedArray();
|
|
21527
21631
|
this._onPhysicsUpdateScripts = new DisorderedArray();
|
|
21528
|
-
this._disableScripts = [];
|
|
21529
21632
|
this._pendingDestroyScripts = [];
|
|
21530
21633
|
this._disposeDestroyScripts = [];
|
|
21531
21634
|
// Animation
|
|
@@ -21603,102 +21706,110 @@
|
|
|
21603
21706
|
replaced && (replaced._onUpdateIndex = renderer._onUpdateIndex);
|
|
21604
21707
|
renderer._onUpdateIndex = -1;
|
|
21605
21708
|
};
|
|
21606
|
-
_proto.addDisableScript = function addDisableScript(component) {
|
|
21607
|
-
this._disableScripts.push(component);
|
|
21608
|
-
};
|
|
21609
21709
|
_proto.addPendingDestroyScript = function addPendingDestroyScript(component) {
|
|
21610
21710
|
this._pendingDestroyScripts.push(component);
|
|
21611
21711
|
};
|
|
21612
21712
|
_proto.callScriptOnStart = function callScriptOnStart() {
|
|
21613
21713
|
var onStartScripts = this._onStartScripts;
|
|
21614
21714
|
if (onStartScripts.length > 0) {
|
|
21715
|
+
onStartScripts.startLoop();
|
|
21615
21716
|
var elements = onStartScripts._elements;
|
|
21616
21717
|
// The 'onStartScripts.length' maybe add if you add some Script with addComponent() in some Script's onStart()
|
|
21617
21718
|
for(var i = 0; i < onStartScripts.length; i++){
|
|
21618
21719
|
var script = elements[i];
|
|
21619
|
-
if (
|
|
21720
|
+
if (script) {
|
|
21620
21721
|
script._started = true;
|
|
21621
|
-
script
|
|
21722
|
+
this.removeOnStartScript(script);
|
|
21622
21723
|
script.onStart();
|
|
21623
21724
|
}
|
|
21624
21725
|
}
|
|
21625
|
-
onStartScripts.
|
|
21726
|
+
onStartScripts.endLoopAndClear();
|
|
21626
21727
|
}
|
|
21627
21728
|
};
|
|
21628
21729
|
_proto.callScriptOnUpdate = function callScriptOnUpdate(deltaTime) {
|
|
21629
|
-
var
|
|
21630
|
-
|
|
21730
|
+
var onUpdateScripts = this._onUpdateScripts;
|
|
21731
|
+
onUpdateScripts.startLoop();
|
|
21732
|
+
var elements = onUpdateScripts._elements;
|
|
21733
|
+
for(var i = 0; i < onUpdateScripts.length; i++){
|
|
21631
21734
|
var element = elements[i];
|
|
21632
|
-
if (
|
|
21735
|
+
if (element == null ? void 0 : element._started) {
|
|
21633
21736
|
element.onUpdate(deltaTime);
|
|
21634
21737
|
}
|
|
21635
21738
|
}
|
|
21739
|
+
onUpdateScripts.endLoop();
|
|
21636
21740
|
};
|
|
21637
21741
|
_proto.callScriptOnLateUpdate = function callScriptOnLateUpdate(deltaTime) {
|
|
21638
|
-
var
|
|
21639
|
-
|
|
21742
|
+
var onLateUpdateScripts = this._onLateUpdateScripts;
|
|
21743
|
+
onLateUpdateScripts.startLoop();
|
|
21744
|
+
var elements = onLateUpdateScripts._elements;
|
|
21745
|
+
for(var i = 0; i < onLateUpdateScripts.length; i++){
|
|
21640
21746
|
var element = elements[i];
|
|
21641
|
-
if (
|
|
21747
|
+
if (element == null ? void 0 : element._started) {
|
|
21642
21748
|
element.onLateUpdate(deltaTime);
|
|
21643
21749
|
}
|
|
21644
21750
|
}
|
|
21751
|
+
onLateUpdateScripts.endLoop();
|
|
21645
21752
|
};
|
|
21646
21753
|
_proto.callScriptOnPhysicsUpdate = function callScriptOnPhysicsUpdate() {
|
|
21647
|
-
var
|
|
21648
|
-
|
|
21754
|
+
var onPhysicsUpdateScripts = this._onPhysicsUpdateScripts;
|
|
21755
|
+
onPhysicsUpdateScripts.startLoop();
|
|
21756
|
+
var elements = onPhysicsUpdateScripts._elements;
|
|
21757
|
+
for(var i = 0; i < onPhysicsUpdateScripts.length; i++){
|
|
21649
21758
|
var element = elements[i];
|
|
21650
|
-
if (
|
|
21759
|
+
if (element == null ? void 0 : element._started) {
|
|
21651
21760
|
element.onPhysicsUpdate();
|
|
21652
21761
|
}
|
|
21653
21762
|
}
|
|
21763
|
+
onPhysicsUpdateScripts.endLoop();
|
|
21654
21764
|
};
|
|
21655
21765
|
_proto.callAnimationUpdate = function callAnimationUpdate(deltaTime) {
|
|
21656
|
-
var
|
|
21657
|
-
|
|
21766
|
+
var onUpdateAnimations = this._onUpdateAnimations;
|
|
21767
|
+
onUpdateAnimations.startLoop();
|
|
21768
|
+
var elements = onUpdateAnimations._elements;
|
|
21769
|
+
for(var i = 0; i < onUpdateAnimations.length; i++){
|
|
21658
21770
|
//@ts-ignore
|
|
21659
21771
|
elements[i].update(deltaTime);
|
|
21660
21772
|
}
|
|
21773
|
+
onUpdateAnimations.endLoop();
|
|
21661
21774
|
};
|
|
21662
21775
|
_proto.callRendererOnUpdate = function callRendererOnUpdate(deltaTime) {
|
|
21663
|
-
var
|
|
21664
|
-
|
|
21776
|
+
var onUpdateRenderers = this._onUpdateRenderers;
|
|
21777
|
+
onUpdateRenderers.startLoop();
|
|
21778
|
+
var elements = onUpdateRenderers._elements;
|
|
21779
|
+
for(var i = 0; i < onUpdateRenderers.length; i++){
|
|
21665
21780
|
elements[i].update(deltaTime);
|
|
21666
21781
|
}
|
|
21782
|
+
onUpdateRenderers.endLoop();
|
|
21667
21783
|
};
|
|
21668
21784
|
_proto.handlingInvalidScripts = function handlingInvalidScripts() {
|
|
21669
|
-
var _this = this,
|
|
21670
|
-
var length1 = disableScripts.length;
|
|
21671
|
-
if (length1 > 0) {
|
|
21672
|
-
for(var i = length1 - 1; i >= 0; i--){
|
|
21673
|
-
var disableScript = disableScripts[i];
|
|
21674
|
-
disableScript._waitHandlingInValid && disableScript._handlingInValid();
|
|
21675
|
-
}
|
|
21676
|
-
disableScripts.length = 0;
|
|
21677
|
-
}
|
|
21678
|
-
var _this1 = this, pendingDestroyScripts = _this1._disposeDestroyScripts, disposeDestroyScripts = _this1._pendingDestroyScripts;
|
|
21785
|
+
var _this = this, pendingDestroyScripts = _this._disposeDestroyScripts, disposeDestroyScripts = _this._pendingDestroyScripts;
|
|
21679
21786
|
this._disposeDestroyScripts = disposeDestroyScripts;
|
|
21680
21787
|
this._pendingDestroyScripts = pendingDestroyScripts;
|
|
21681
|
-
|
|
21682
|
-
if (
|
|
21683
|
-
for(var
|
|
21684
|
-
disposeDestroyScripts[
|
|
21788
|
+
length = disposeDestroyScripts.length;
|
|
21789
|
+
if (length > 0) {
|
|
21790
|
+
for(var i = length - 1; i >= 0; i--){
|
|
21791
|
+
disposeDestroyScripts[i].onDestroy();
|
|
21685
21792
|
}
|
|
21686
21793
|
disposeDestroyScripts.length = 0;
|
|
21687
21794
|
}
|
|
21688
21795
|
};
|
|
21689
21796
|
_proto.callCameraOnBeginRender = function callCameraOnBeginRender(camera) {
|
|
21690
21797
|
var scripts = camera.entity._scripts;
|
|
21691
|
-
|
|
21692
|
-
|
|
21693
|
-
|
|
21798
|
+
scripts.startLoop();
|
|
21799
|
+
for(var i = 0; i < scripts.length; i++){
|
|
21800
|
+
var _scripts_get;
|
|
21801
|
+
(_scripts_get = scripts.get(i)) == null ? void 0 : _scripts_get.onBeginRender(camera);
|
|
21694
21802
|
}
|
|
21803
|
+
scripts.endLoop();
|
|
21695
21804
|
};
|
|
21696
21805
|
_proto.callCameraOnEndRender = function callCameraOnEndRender(camera) {
|
|
21697
21806
|
var scripts = camera.entity._scripts;
|
|
21698
|
-
|
|
21699
|
-
|
|
21700
|
-
|
|
21807
|
+
scripts.startLoop();
|
|
21808
|
+
for(var i = 0; i < scripts.length; i++){
|
|
21809
|
+
var _scripts_get;
|
|
21810
|
+
(_scripts_get = scripts.get(i)) == null ? void 0 : _scripts_get.onEndRender(camera);
|
|
21701
21811
|
}
|
|
21812
|
+
scripts.endLoop();
|
|
21702
21813
|
};
|
|
21703
21814
|
_proto.getActiveChangedTempList = function getActiveChangedTempList() {
|
|
21704
21815
|
return this._componentsContainerPool.length ? this._componentsContainerPool.pop() : [];
|
|
@@ -22657,19 +22768,20 @@
|
|
|
22657
22768
|
}
|
|
22658
22769
|
// Process entity active/inActive
|
|
22659
22770
|
var inActiveChangeFlag = ActiveChangeFlag.None;
|
|
22660
|
-
if (
|
|
22661
|
-
|
|
22662
|
-
entity._isActiveInHierarchy && oldScene !== this && (inActiveChangeFlag |= ActiveChangeFlag.Scene);
|
|
22663
|
-
} else {
|
|
22664
|
-
entity._isActiveInHierarchy && (inActiveChangeFlag |= ActiveChangeFlag.Hierarchy);
|
|
22771
|
+
if (entity._isActiveInHierarchy) {
|
|
22772
|
+
this._isActiveInEngine || (inActiveChangeFlag |= ActiveChangeFlag.Hierarchy);
|
|
22665
22773
|
}
|
|
22774
|
+
// Cross scene should inActive first and then active
|
|
22775
|
+
entity._isActiveInScene && oldScene !== this && (inActiveChangeFlag |= ActiveChangeFlag.Scene);
|
|
22666
22776
|
inActiveChangeFlag && entity._processInActive(inActiveChangeFlag);
|
|
22667
22777
|
if (oldScene !== this) {
|
|
22668
22778
|
Entity._traverseSetOwnerScene(entity, this);
|
|
22669
22779
|
}
|
|
22670
22780
|
var activeChangeFlag = ActiveChangeFlag.None;
|
|
22671
|
-
if (
|
|
22672
|
-
|
|
22781
|
+
if (entity._isActive) {
|
|
22782
|
+
if (this._isActiveInEngine) {
|
|
22783
|
+
!entity._isActiveInHierarchy && (activeChangeFlag |= ActiveChangeFlag.Hierarchy);
|
|
22784
|
+
}
|
|
22673
22785
|
(!entity._isActiveInScene || oldScene !== this) && (activeChangeFlag |= ActiveChangeFlag.Scene);
|
|
22674
22786
|
}
|
|
22675
22787
|
activeChangeFlag && entity._processActive(activeChangeFlag);
|
|
@@ -23023,7 +23135,6 @@
|
|
|
23023
23135
|
/** @internal */ _this._onPreRenderIndex = -1;
|
|
23024
23136
|
/** @internal */ _this._onPostRenderIndex = -1;
|
|
23025
23137
|
_this._entityScriptsIndex = -1;
|
|
23026
|
-
_this._waitHandlingInValid = false;
|
|
23027
23138
|
return _this;
|
|
23028
23139
|
};
|
|
23029
23140
|
_inherits$2(Script, Component);
|
|
@@ -23133,37 +23244,30 @@
|
|
|
23133
23244
|
/**
|
|
23134
23245
|
* @internal
|
|
23135
23246
|
*/ _proto._onEnableInScene = function _onEnableInScene() {
|
|
23136
|
-
|
|
23137
|
-
|
|
23138
|
-
|
|
23139
|
-
|
|
23140
|
-
|
|
23141
|
-
|
|
23142
|
-
|
|
23143
|
-
|
|
23144
|
-
|
|
23145
|
-
|
|
23146
|
-
|
|
23147
|
-
|
|
23148
|
-
|
|
23149
|
-
}
|
|
23150
|
-
if (this.onPhysicsUpdate !== prototype.onPhysicsUpdate) {
|
|
23151
|
-
componentsManager.addOnPhysicsUpdateScript(this);
|
|
23152
|
-
}
|
|
23153
|
-
this._entity._addScript(this);
|
|
23247
|
+
var _this_scene = this.scene, componentsManager = _this_scene._componentsManager;
|
|
23248
|
+
var prototype = Script.prototype;
|
|
23249
|
+
if (!this._started) {
|
|
23250
|
+
componentsManager.addOnStartScript(this);
|
|
23251
|
+
}
|
|
23252
|
+
if (this.onUpdate !== prototype.onUpdate) {
|
|
23253
|
+
componentsManager.addOnUpdateScript(this);
|
|
23254
|
+
}
|
|
23255
|
+
if (this.onLateUpdate !== prototype.onLateUpdate) {
|
|
23256
|
+
componentsManager.addOnLateUpdateScript(this);
|
|
23257
|
+
}
|
|
23258
|
+
if (this.onPhysicsUpdate !== prototype.onPhysicsUpdate) {
|
|
23259
|
+
componentsManager.addOnPhysicsUpdateScript(this);
|
|
23154
23260
|
}
|
|
23261
|
+
this._entity._addScript(this);
|
|
23155
23262
|
};
|
|
23156
23263
|
/**
|
|
23157
23264
|
* @internal
|
|
23158
23265
|
*/ _proto._onDisableInScene = function _onDisableInScene() {
|
|
23159
|
-
this._waitHandlingInValid = true;
|
|
23160
|
-
this.scene._componentsManager.addDisableScript(this);
|
|
23161
|
-
};
|
|
23162
|
-
/**
|
|
23163
|
-
* @internal
|
|
23164
|
-
*/ _proto._handlingInValid = function _handlingInValid() {
|
|
23165
23266
|
var componentsManager = this.scene._componentsManager;
|
|
23166
23267
|
var prototype = Script.prototype;
|
|
23268
|
+
if (!this._started) {
|
|
23269
|
+
componentsManager.removeOnStartScript(this);
|
|
23270
|
+
}
|
|
23167
23271
|
if (this.onUpdate !== prototype.onUpdate) {
|
|
23168
23272
|
componentsManager.removeOnUpdateScript(this);
|
|
23169
23273
|
}
|
|
@@ -23174,7 +23278,6 @@
|
|
|
23174
23278
|
componentsManager.removeOnPhysicsUpdateScript(this);
|
|
23175
23279
|
}
|
|
23176
23280
|
this._entity._removeScript(this);
|
|
23177
|
-
this._waitHandlingInValid = false;
|
|
23178
23281
|
};
|
|
23179
23282
|
/**
|
|
23180
23283
|
* @internal
|
|
@@ -23208,9 +23311,6 @@
|
|
|
23208
23311
|
__decorate$1([
|
|
23209
23312
|
ignoreClone
|
|
23210
23313
|
], Script.prototype, "_entityScriptsIndex", void 0);
|
|
23211
|
-
__decorate$1([
|
|
23212
|
-
ignoreClone
|
|
23213
|
-
], Script.prototype, "_waitHandlingInValid", void 0);
|
|
23214
23314
|
/**
|
|
23215
23315
|
* Depth texture mode.
|
|
23216
23316
|
*/ exports.DepthTextureMode = void 0;
|
|
@@ -25507,40 +25607,6 @@
|
|
|
25507
25607
|
(function() {
|
|
25508
25608
|
Loader._engineObjects = {};
|
|
25509
25609
|
})();
|
|
25510
|
-
/**
|
|
25511
|
-
* Asset Type.
|
|
25512
|
-
*/ exports.AssetType = void 0;
|
|
25513
|
-
(function(AssetType) {
|
|
25514
|
-
AssetType[/**
|
|
25515
|
-
* Plain text.
|
|
25516
|
-
* @remarks Will not be cached based on url in ResourceManager.
|
|
25517
|
-
*/ "Text"] = "Text";
|
|
25518
|
-
AssetType[/**
|
|
25519
|
-
* JSON.
|
|
25520
|
-
* @remarks Will not be cached based on url in ResourceManager.
|
|
25521
|
-
*/ "JSON"] = "JSON";
|
|
25522
|
-
AssetType[/**
|
|
25523
|
-
* ArrayBuffer.
|
|
25524
|
-
* @remarks Will not be cached based on url in ResourceManager.
|
|
25525
|
-
*/ "Buffer"] = "Buffer";
|
|
25526
|
-
AssetType[/** 2D Texture. */ "Texture2D"] = "Texture2D";
|
|
25527
|
-
AssetType[/** Cube Texture. */ "TextureCube"] = "TextureCube";
|
|
25528
|
-
AssetType[/** Material. */ "Material"] = "Material";
|
|
25529
|
-
AssetType[/** Mesh. */ "Mesh"] = "Mesh";
|
|
25530
|
-
AssetType[/** AnimationClip. */ "AnimationClip"] = "AnimationClip";
|
|
25531
|
-
AssetType[/** AnimatorController. */ "AnimatorController"] = "AnimatorController";
|
|
25532
|
-
AssetType[/** Prefab.*/ "GLTF"] = "GLTF";
|
|
25533
|
-
AssetType[/** Compress Texture. */ "KTX"] = "KTX";
|
|
25534
|
-
AssetType[/** Cube Compress Texture. */ "KTXCube"] = "KTXCube";
|
|
25535
|
-
AssetType[/** KTX2 Compress Texture */ "KTX2"] = "KTX2";
|
|
25536
|
-
AssetType[/** Sprite. */ "Sprite"] = "Sprite";
|
|
25537
|
-
AssetType[/** Sprite Atlas. */ "SpriteAtlas"] = "SpriteAtlas";
|
|
25538
|
-
AssetType[/** Ambient light. */ "Env"] = "Environment";
|
|
25539
|
-
AssetType[/** Scene. */ "Scene"] = "Scene";
|
|
25540
|
-
AssetType[/** HDR to cube. */ "HDR"] = "HDR";
|
|
25541
|
-
AssetType[/** Font. */ "Font"] = "Font";
|
|
25542
|
-
AssetType[/** Source Font, include ttf、 otf and woff. */ "SourceFont"] = "SourceFont";
|
|
25543
|
-
})(exports.AssetType || (exports.AssetType = {}));
|
|
25544
25610
|
/**
|
|
25545
25611
|
* Alpha blend mode.
|
|
25546
25612
|
*/ exports.BlendMode = void 0;
|
|
@@ -38353,16 +38419,16 @@
|
|
|
38353
38419
|
exports.GLTFBufferParser = __decorate([
|
|
38354
38420
|
registerGLTFParser(exports.GLTFParserType.Buffer)
|
|
38355
38421
|
], exports.GLTFBufferParser);
|
|
38356
|
-
exports.GLTFEntityParser = /*#__PURE__*/ function(
|
|
38422
|
+
exports.GLTFEntityParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
38357
38423
|
var GLTFEntityParser = function GLTFEntityParser() {
|
|
38358
|
-
return
|
|
38424
|
+
return GLTFParser1.apply(this, arguments);
|
|
38359
38425
|
};
|
|
38360
|
-
_inherits(GLTFEntityParser,
|
|
38426
|
+
_inherits(GLTFEntityParser, GLTFParser1);
|
|
38361
38427
|
var _proto = GLTFEntityParser.prototype;
|
|
38362
38428
|
_proto.parse = function parse(context, index) {
|
|
38363
38429
|
var entityInfo = context.glTF.nodes[index];
|
|
38364
38430
|
var engine = context.glTFResource.engine;
|
|
38365
|
-
var matrix = entityInfo.matrix, translation = entityInfo.translation, rotation = entityInfo.rotation, scale = entityInfo.scale;
|
|
38431
|
+
var matrix = entityInfo.matrix, translation = entityInfo.translation, rotation = entityInfo.rotation, scale = entityInfo.scale, extensions = entityInfo.extensions;
|
|
38366
38432
|
var entity = new Entity(engine, entityInfo.name || "_GLTF_ENTITY_" + index);
|
|
38367
38433
|
var transform = entity.transform;
|
|
38368
38434
|
if (matrix) {
|
|
@@ -38388,6 +38454,7 @@
|
|
|
38388
38454
|
entity.addChild(childEntity);
|
|
38389
38455
|
}
|
|
38390
38456
|
}
|
|
38457
|
+
GLTFParser.executeExtensionsAdditiveAndParse(extensions, context, entity, entityInfo);
|
|
38391
38458
|
return entity;
|
|
38392
38459
|
};
|
|
38393
38460
|
return GLTFEntityParser;
|
|
@@ -38782,7 +38849,7 @@
|
|
|
38782
38849
|
var _this = this;
|
|
38783
38850
|
var glTF = context.glTF, glTFResource = context.glTFResource;
|
|
38784
38851
|
var entityInfo = glTF.nodes[index];
|
|
38785
|
-
var cameraID = entityInfo.camera, meshID = entityInfo.mesh
|
|
38852
|
+
var cameraID = entityInfo.camera, meshID = entityInfo.mesh;
|
|
38786
38853
|
var entity = context.get(exports.GLTFParserType.Entity, index);
|
|
38787
38854
|
var promise;
|
|
38788
38855
|
if (cameraID !== undefined) {
|
|
@@ -38799,7 +38866,6 @@
|
|
|
38799
38866
|
promises.push(_this._parseEntityComponent(context, children[i]));
|
|
38800
38867
|
}
|
|
38801
38868
|
}
|
|
38802
|
-
GLTFParser.executeExtensionsAdditiveAndParse(extensions, context, entity, entityInfo);
|
|
38803
38869
|
return Promise.all(promises);
|
|
38804
38870
|
});
|
|
38805
38871
|
};
|
|
@@ -40154,8 +40220,6 @@
|
|
|
40154
40220
|
_this.request(item.url, {
|
|
40155
40221
|
type: "json"
|
|
40156
40222
|
}).then(function(data) {
|
|
40157
|
-
// @ts-ignore
|
|
40158
|
-
engine.resourceManager.initVirtualResources(data.files);
|
|
40159
40223
|
return SceneParser.parse(engine, data).then(function(scene) {
|
|
40160
40224
|
var promises = [];
|
|
40161
40225
|
// parse ambient light
|
|
@@ -40183,6 +40247,10 @@
|
|
|
40183
40247
|
scene.ambientLight.diffuseSolidColor.copyFrom(ambient.diffuseSolidColor);
|
|
40184
40248
|
});
|
|
40185
40249
|
promises.push(ambientLightPromise);
|
|
40250
|
+
} else {
|
|
40251
|
+
scene.ambientLight.diffuseIntensity = ambient.diffuseIntensity;
|
|
40252
|
+
scene.ambientLight.specularIntensity = ambient.specularIntensity;
|
|
40253
|
+
scene.ambientLight.diffuseSolidColor.copyFrom(ambient.diffuseSolidColor);
|
|
40186
40254
|
}
|
|
40187
40255
|
var background = data.scene.background;
|
|
40188
40256
|
scene.background.mode = background.mode;
|
|
@@ -40735,7 +40803,7 @@
|
|
|
40735
40803
|
], GALACEAN_animation_event);
|
|
40736
40804
|
|
|
40737
40805
|
//@ts-ignore
|
|
40738
|
-
var version = "1.1.0-alpha.
|
|
40806
|
+
var version = "1.1.0-alpha.3";
|
|
40739
40807
|
console.log("Galacean engine version: " + version);
|
|
40740
40808
|
for(var key in CoreObjects){
|
|
40741
40809
|
Loader.registerClass(key, CoreObjects[key]);
|