@galacean/engine-core 1.2.0-alpha.3 → 1.2.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +239 -203
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +239 -203
- package/dist/module.js +238 -202
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/Scene.d.ts +5 -0
- package/types/asset/Loader.d.ts +7 -0
- package/types/particle/modules/MainModule.d.ts +2 -0
- package/types/particle/modules/shape/BaseShape.d.ts +1 -1
- package/types/particle/modules/shape/BoxShape.d.ts +2 -1
- package/types/particle/modules/shape/CircleShape.d.ts +2 -1
- package/types/particle/modules/shape/ConeShape.d.ts +2 -1
- package/types/particle/modules/shape/HemisphereShape.d.ts +2 -1
- package/types/particle/modules/shape/SphereShape.d.ts +2 -1
- package/types/particle/modules/shape/index.d.ts +1 -0
- package/types/shadow/CascadedShadowCasterPass.d.ts +0 -1
package/dist/module.js
CHANGED
|
@@ -3288,7 +3288,7 @@ var PBRShaderLib = {
|
|
|
3288
3288
|
|
|
3289
3289
|
var ShadowCoord = "#define GLSLIFY 1\nuniform mat4 scene_ShadowMatrices[SCENE_SHADOW_CASCADED_COUNT+1];uniform vec4 scene_ShadowSplitSpheres[4];mediump int computeCascadeIndex(vec3 positionWS){vec3 fromCenter0=positionWS-scene_ShadowSplitSpheres[0].xyz;vec3 fromCenter1=positionWS-scene_ShadowSplitSpheres[1].xyz;vec3 fromCenter2=positionWS-scene_ShadowSplitSpheres[2].xyz;vec3 fromCenter3=positionWS-scene_ShadowSplitSpheres[3].xyz;mediump vec4 comparison=vec4(dot(fromCenter0,fromCenter0)<scene_ShadowSplitSpheres[0].w,dot(fromCenter1,fromCenter1)<scene_ShadowSplitSpheres[1].w,dot(fromCenter2,fromCenter2)<scene_ShadowSplitSpheres[2].w,dot(fromCenter3,fromCenter3)<scene_ShadowSplitSpheres[3].w);comparison.yzw=clamp(comparison.yzw-comparison.xyz,0.0,1.0);mediump vec4 indexCoefficient=vec4(4.0,3.0,2.0,1.0);mediump int index=4-int(dot(comparison,indexCoefficient));return index;}vec3 getShadowCoord(){\n#if SCENE_SHADOW_CASCADED_COUNT == 1\nmediump int cascadeIndex=0;\n#else\nmediump int cascadeIndex=computeCascadeIndex(v_pos);\n#endif\n#ifdef GRAPHICS_API_WEBGL2\nmat4 shadowMatrix=scene_ShadowMatrices[cascadeIndex];\n#else\nmat4 shadowMatrix;\n#if SCENE_SHADOW_CASCADED_COUNT == 4\nif(cascadeIndex==0){shadowMatrix=scene_ShadowMatrices[0];}else if(cascadeIndex==1){shadowMatrix=scene_ShadowMatrices[1];}else if(cascadeIndex==2){shadowMatrix=scene_ShadowMatrices[2];}else if(cascadeIndex==3){shadowMatrix=scene_ShadowMatrices[3];}else{shadowMatrix=scene_ShadowMatrices[4];}\n#endif\n#if SCENE_SHADOW_CASCADED_COUNT == 2\nif(cascadeIndex==0){shadowMatrix=scene_ShadowMatrices[0];}else if(cascadeIndex==1){shadowMatrix=scene_ShadowMatrices[1];}else{shadowMatrix=scene_ShadowMatrices[2];}\n#endif\n#if SCENE_SHADOW_CASCADED_COUNT == 1\nif(cascadeIndex==0){shadowMatrix=scene_ShadowMatrices[0];}else{shadowMatrix=scene_ShadowMatrices[1];}\n#endif\n#endif\nvec4 shadowCoord=shadowMatrix*vec4(v_pos,1.0);return shadowCoord.xyz;}"; // eslint-disable-line
|
|
3290
3290
|
|
|
3291
|
-
var ShadowFragmentDeclaration = "#define GLSLIFY 1\n#if defined(SCENE_SHADOW_TYPE) && defined(RENDERER_IS_RECEIVE_SHADOWS)\n#define SCENE_IS_CALCULATE_SHADOWS\n#endif\n#ifdef SCENE_IS_CALCULATE_SHADOWS\n#if SCENE_SHADOW_CASCADED_COUNT == 1\nvarying vec3 v_shadowCoord;\n#else\n#include <ShadowCoord>\n#endif\nuniform
|
|
3291
|
+
var ShadowFragmentDeclaration = "#define GLSLIFY 1\n#if defined(SCENE_SHADOW_TYPE) && defined(RENDERER_IS_RECEIVE_SHADOWS)\n#define SCENE_IS_CALCULATE_SHADOWS\n#endif\n#ifdef SCENE_IS_CALCULATE_SHADOWS\n#if SCENE_SHADOW_CASCADED_COUNT == 1\nvarying vec3 v_shadowCoord;\n#else\n#include <ShadowCoord>\n#endif\nuniform vec4 scene_ShadowInfo;uniform vec4 scene_ShadowMapSize;\n#ifdef GRAPHICS_API_WEBGL2\nuniform mediump sampler2DShadow scene_ShadowMap;\n#define SAMPLE_TEXTURE2D_SHADOW(textureName, coord3) textureLod(textureName, coord3 , 0.0)\n#define TEXTURE2D_SHADOW_PARAM(shadowMap) mediump sampler2DShadow shadowMap\n#else\nuniform sampler2D scene_ShadowMap;\n#ifdef ENGINE_NO_DEPTH_TEXTURE\nconst vec4 bitShift=vec4(1.0,1.0/256.0,1.0/(256.0*256.0),1.0/(256.0*256.0*256.0));float unpack(const in vec4 rgbaDepth){return dot(rgbaDepth,bitShift);}\n#define SAMPLE_TEXTURE2D_SHADOW(textureName, coord3) (unpack(texture2D(textureName, coord3.xy)) < coord3.z ? 0.0 : 1.0)\n#else\n#define SAMPLE_TEXTURE2D_SHADOW(textureName, coord3) (texture2D(textureName, coord3.xy).r < coord3.z ? 0.0 : 1.0)\n#endif\n#define TEXTURE2D_SHADOW_PARAM(shadowMap) mediump sampler2D shadowMap\n#endif\n#if SCENE_SHADOW_TYPE == 2\nfloat sampleShadowMapFiltered4(TEXTURE2D_SHADOW_PARAM(shadowMap),vec3 shadowCoord,vec4 shadowMapSize){float attenuation;vec4 attenuation4;vec2 offset=shadowMapSize.xy/2.0;vec3 shadowCoord0=shadowCoord+vec3(-offset,0.0);vec3 shadowCoord1=shadowCoord+vec3(offset.x,-offset.y,0.0);vec3 shadowCoord2=shadowCoord+vec3(-offset.x,offset.y,0.0);vec3 shadowCoord3=shadowCoord+vec3(offset,0.0);attenuation4.x=SAMPLE_TEXTURE2D_SHADOW(shadowMap,shadowCoord0);attenuation4.y=SAMPLE_TEXTURE2D_SHADOW(shadowMap,shadowCoord1);attenuation4.z=SAMPLE_TEXTURE2D_SHADOW(shadowMap,shadowCoord2);attenuation4.w=SAMPLE_TEXTURE2D_SHADOW(shadowMap,shadowCoord3);attenuation=dot(attenuation4,vec4(0.25));return attenuation;}\n#endif\n#if SCENE_SHADOW_TYPE == 3\n#include <shadow_sample_tent>\nfloat sampleShadowMapFiltered9(TEXTURE2D_SHADOW_PARAM(shadowMap),vec3 shadowCoord,vec4 shadowmapSize){float attenuation;float fetchesWeights[9];vec2 fetchesUV[9];sampleShadowComputeSamplesTent5x5(shadowmapSize,shadowCoord.xy,fetchesWeights,fetchesUV);attenuation=fetchesWeights[0]*SAMPLE_TEXTURE2D_SHADOW(shadowMap,vec3(fetchesUV[0].xy,shadowCoord.z));attenuation+=fetchesWeights[1]*SAMPLE_TEXTURE2D_SHADOW(shadowMap,vec3(fetchesUV[1].xy,shadowCoord.z));attenuation+=fetchesWeights[2]*SAMPLE_TEXTURE2D_SHADOW(shadowMap,vec3(fetchesUV[2].xy,shadowCoord.z));attenuation+=fetchesWeights[3]*SAMPLE_TEXTURE2D_SHADOW(shadowMap,vec3(fetchesUV[3].xy,shadowCoord.z));attenuation+=fetchesWeights[4]*SAMPLE_TEXTURE2D_SHADOW(shadowMap,vec3(fetchesUV[4].xy,shadowCoord.z));attenuation+=fetchesWeights[5]*SAMPLE_TEXTURE2D_SHADOW(shadowMap,vec3(fetchesUV[5].xy,shadowCoord.z));attenuation+=fetchesWeights[6]*SAMPLE_TEXTURE2D_SHADOW(shadowMap,vec3(fetchesUV[6].xy,shadowCoord.z));attenuation+=fetchesWeights[7]*SAMPLE_TEXTURE2D_SHADOW(shadowMap,vec3(fetchesUV[7].xy,shadowCoord.z));attenuation+=fetchesWeights[8]*SAMPLE_TEXTURE2D_SHADOW(shadowMap,vec3(fetchesUV[8].xy,shadowCoord.z));return attenuation;}\n#endif\nfloat getShadowFade(vec3 positionWS){vec3 camToPixel=positionWS-camera_Position;float distanceCamToPixel2=dot(camToPixel,camToPixel);return saturate(distanceCamToPixel2*scene_ShadowInfo.z+scene_ShadowInfo.w);}float sampleShadowMap(){\n#if SCENE_SHADOW_CASCADED_COUNT == 1\nvec3 shadowCoord=v_shadowCoord;\n#else\nvec3 shadowCoord=getShadowCoord();\n#endif\nfloat attenuation=1.0;if(shadowCoord.z>0.0&&shadowCoord.z<1.0){\n#if SCENE_SHADOW_TYPE == 1\nattenuation=SAMPLE_TEXTURE2D_SHADOW(scene_ShadowMap,shadowCoord);\n#endif\n#if SCENE_SHADOW_TYPE == 2\nattenuation=sampleShadowMapFiltered4(scene_ShadowMap,shadowCoord,scene_ShadowMapSize);\n#endif\n#if SCENE_SHADOW_TYPE == 3\nattenuation=sampleShadowMapFiltered9(scene_ShadowMap,shadowCoord,scene_ShadowMapSize);\n#endif\nfloat shadowFade=getShadowFade(v_pos);attenuation=mix(1.0,mix(attenuation,1.0,shadowFade),scene_ShadowInfo.x);}return attenuation;}\n#endif\n"; // eslint-disable-line
|
|
3292
3292
|
|
|
3293
3293
|
var shadow_sample_tent = "#define GLSLIFY 1\nfloat sampleShadowGetIRTriangleTexelArea(float triangleHeight){return triangleHeight-0.5;}void sampleShadowGetTexelAreasTent3x3(float offset,out vec4 computedArea,out vec4 computedAreaUncut){float a=offset+0.5;float offsetSquaredHalved=a*a*0.5;computedAreaUncut.x=computedArea.x=offsetSquaredHalved-offset;computedAreaUncut.w=computedArea.w=offsetSquaredHalved;computedAreaUncut.y=sampleShadowGetIRTriangleTexelArea(1.5-offset);float clampedOffsetLeft=min(offset,0.0);float areaOfSmallLeftTriangle=clampedOffsetLeft*clampedOffsetLeft;computedArea.y=computedAreaUncut.y-areaOfSmallLeftTriangle;computedAreaUncut.z=sampleShadowGetIRTriangleTexelArea(1.5+offset);float clampedOffsetRight=max(offset,0.0);float areaOfSmallRightTriangle=clampedOffsetRight*clampedOffsetRight;computedArea.z=computedAreaUncut.z-areaOfSmallRightTriangle;}void sampleShadowGetTexelWeightsTent5x5(float offset,out vec3 texelsWeightsA,out vec3 texelsWeightsB){vec4 areaFrom3texelTriangle;vec4 areaUncutFrom3texelTriangle;sampleShadowGetTexelAreasTent3x3(offset,areaFrom3texelTriangle,areaUncutFrom3texelTriangle);texelsWeightsA.x=0.16*(areaFrom3texelTriangle.x);texelsWeightsA.y=0.16*(areaUncutFrom3texelTriangle.y);texelsWeightsA.z=0.16*(areaFrom3texelTriangle.y+1.0);texelsWeightsB.x=0.16*(areaFrom3texelTriangle.z+1.0);texelsWeightsB.y=0.16*(areaUncutFrom3texelTriangle.z);texelsWeightsB.z=0.16*(areaFrom3texelTriangle.w);}void sampleShadowComputeSamplesTent5x5(vec4 shadowMapTextureTexelSize,vec2 coord,out float fetchesWeights[9],out vec2 fetchesUV[9]){vec2 tentCenterInTexelSpace=coord.xy*shadowMapTextureTexelSize.zw;vec2 centerOfFetchesInTexelSpace=floor(tentCenterInTexelSpace+0.5);vec2 offsetFromTentCenterToCenterOfFetches=tentCenterInTexelSpace-centerOfFetchesInTexelSpace;vec3 texelsWeightsUA,texelsWeightsUB;vec3 texelsWeightsVA,texelsWeightsVB;sampleShadowGetTexelWeightsTent5x5(offsetFromTentCenterToCenterOfFetches.x,texelsWeightsUA,texelsWeightsUB);sampleShadowGetTexelWeightsTent5x5(offsetFromTentCenterToCenterOfFetches.y,texelsWeightsVA,texelsWeightsVB);vec3 fetchesWeightsU=vec3(texelsWeightsUA.xz,texelsWeightsUB.y)+vec3(texelsWeightsUA.y,texelsWeightsUB.xz);vec3 fetchesWeightsV=vec3(texelsWeightsVA.xz,texelsWeightsVB.y)+vec3(texelsWeightsVA.y,texelsWeightsVB.xz);vec3 fetchesOffsetsU=vec3(texelsWeightsUA.y,texelsWeightsUB.xz)/fetchesWeightsU.xyz+vec3(-2.5,-0.5,1.5);vec3 fetchesOffsetsV=vec3(texelsWeightsVA.y,texelsWeightsVB.xz)/fetchesWeightsV.xyz+vec3(-2.5,-0.5,1.5);fetchesOffsetsU*=shadowMapTextureTexelSize.xxx;fetchesOffsetsV*=shadowMapTextureTexelSize.yyy;vec2 bilinearFetchOrigin=centerOfFetchesInTexelSpace*shadowMapTextureTexelSize.xy;fetchesUV[0]=bilinearFetchOrigin+vec2(fetchesOffsetsU.x,fetchesOffsetsV.x);fetchesUV[1]=bilinearFetchOrigin+vec2(fetchesOffsetsU.y,fetchesOffsetsV.x);fetchesUV[2]=bilinearFetchOrigin+vec2(fetchesOffsetsU.z,fetchesOffsetsV.x);fetchesUV[3]=bilinearFetchOrigin+vec2(fetchesOffsetsU.x,fetchesOffsetsV.y);fetchesUV[4]=bilinearFetchOrigin+vec2(fetchesOffsetsU.y,fetchesOffsetsV.y);fetchesUV[5]=bilinearFetchOrigin+vec2(fetchesOffsetsU.z,fetchesOffsetsV.y);fetchesUV[6]=bilinearFetchOrigin+vec2(fetchesOffsetsU.x,fetchesOffsetsV.z);fetchesUV[7]=bilinearFetchOrigin+vec2(fetchesOffsetsU.y,fetchesOffsetsV.z);fetchesUV[8]=bilinearFetchOrigin+vec2(fetchesOffsetsU.z,fetchesOffsetsV.z);fetchesWeights[0]=fetchesWeightsU.x*fetchesWeightsV.x;fetchesWeights[1]=fetchesWeightsU.y*fetchesWeightsV.x;fetchesWeights[2]=fetchesWeightsU.z*fetchesWeightsV.x;fetchesWeights[3]=fetchesWeightsU.x*fetchesWeightsV.y;fetchesWeights[4]=fetchesWeightsU.y*fetchesWeightsV.y;fetchesWeights[5]=fetchesWeightsU.z*fetchesWeightsV.y;fetchesWeights[6]=fetchesWeightsU.x*fetchesWeightsV.z;fetchesWeights[7]=fetchesWeightsU.y*fetchesWeightsV.z;fetchesWeights[8]=fetchesWeightsU.z*fetchesWeightsV.z;}"; // eslint-disable-line
|
|
3294
3294
|
|
|
@@ -20958,6 +20958,10 @@ __decorate([
|
|
|
20958
20958
|
/** The splits of two cascade distribution. */ _this.shadowTwoCascadeSplits = 1.0 / 3.0;
|
|
20959
20959
|
/** The splits of four cascade distribution. */ _this.shadowFourCascadeSplits = new Vector3(1.0 / 15, 3.0 / 15.0, 7.0 / 15.0);
|
|
20960
20960
|
/** Max Shadow distance. */ _this.shadowDistance = 50;
|
|
20961
|
+
/**
|
|
20962
|
+
* Last shadow fade distance in percentage, range [0,1].
|
|
20963
|
+
* @remarks Value 0 is used for no shadow fade.
|
|
20964
|
+
*/ _this.shadowFadeBorder = 0.1;
|
|
20961
20965
|
/* @internal */ _this._lightManager = new LightManager();
|
|
20962
20966
|
/* @internal */ _this._componentsManager = new ComponentsManager();
|
|
20963
20967
|
/** @internal */ _this._isActiveInEngine = false;
|
|
@@ -21582,47 +21586,66 @@ __decorate([
|
|
|
21582
21586
|
DepthTextureMode[DepthTextureMode[/* Generate depth texture by pre-pass rendering. */ "PrePass"] = 1] = "PrePass";
|
|
21583
21587
|
})(DepthTextureMode || (DepthTextureMode = {}));
|
|
21584
21588
|
|
|
21585
|
-
var passNum = 0;
|
|
21586
21589
|
/**
|
|
21587
|
-
*
|
|
21588
|
-
*/ var
|
|
21589
|
-
|
|
21590
|
-
|
|
21591
|
-
|
|
21592
|
-
|
|
21593
|
-
|
|
21594
|
-
|
|
21595
|
-
|
|
21596
|
-
this.enabled = true;
|
|
21597
|
-
this.priority = priority;
|
|
21598
|
-
this.renderTarget = renderTarget;
|
|
21599
|
-
this.replaceMaterial = replaceMaterial;
|
|
21600
|
-
this.mask = mask || Layer.Everything;
|
|
21601
|
-
this.renderOverride = false; // If renderOverride is set to true, you need to implement the render method
|
|
21602
|
-
}
|
|
21603
|
-
var _proto = RenderPass.prototype;
|
|
21604
|
-
/**
|
|
21605
|
-
* Rendering callback, will be executed if renderOverride is set to true.
|
|
21606
|
-
* @param camera - Camera
|
|
21607
|
-
* @param opaqueQueue - Opaque queue
|
|
21608
|
-
* @param alphaTestQueue - Alpha test queue
|
|
21609
|
-
* @param transparentQueue - Transparent queue
|
|
21610
|
-
*/ _proto.render = function render(camera, opaqueQueue, alphaTestQueue, transparentQueue) {};
|
|
21590
|
+
* PipelinePass is a base class for all pipeline passes.
|
|
21591
|
+
*/ var PipelinePass = function PipelinePass(engine) {
|
|
21592
|
+
this._engine = engine;
|
|
21593
|
+
};
|
|
21594
|
+
|
|
21595
|
+
/**
|
|
21596
|
+
* @internal
|
|
21597
|
+
*/ var PipelineUtils = /*#__PURE__*/ function() {
|
|
21598
|
+
function PipelineUtils() {}
|
|
21611
21599
|
/**
|
|
21612
|
-
*
|
|
21613
|
-
* @param
|
|
21614
|
-
* @param
|
|
21615
|
-
* @param
|
|
21616
|
-
* @param
|
|
21617
|
-
|
|
21600
|
+
* Recreate texture if needed.
|
|
21601
|
+
* @param engine - Engine
|
|
21602
|
+
* @param currentTexture - Current texture
|
|
21603
|
+
* @param width - Need texture width
|
|
21604
|
+
* @param height - Need texture height
|
|
21605
|
+
* @param format - Need texture format
|
|
21606
|
+
* @param mipmap - Need texture mipmap
|
|
21607
|
+
* @returns Texture
|
|
21608
|
+
*/ PipelineUtils.recreateTextureIfNeeded = function recreateTextureIfNeeded(engine, currentTexture, width, height, format, mipmap) {
|
|
21609
|
+
if (currentTexture) {
|
|
21610
|
+
if (currentTexture.width !== width || currentTexture.height !== height || currentTexture.format !== format || currentTexture.mipmapCount > 1 !== mipmap) {
|
|
21611
|
+
currentTexture.destroy();
|
|
21612
|
+
var texture = new Texture2D(engine, width, height, format, mipmap);
|
|
21613
|
+
texture.isGCIgnored = true;
|
|
21614
|
+
return texture;
|
|
21615
|
+
} else {
|
|
21616
|
+
return currentTexture;
|
|
21617
|
+
}
|
|
21618
|
+
} else {
|
|
21619
|
+
var texture1 = new Texture2D(engine, width, height, format, mipmap);
|
|
21620
|
+
texture1.isGCIgnored = true;
|
|
21621
|
+
return texture1;
|
|
21622
|
+
}
|
|
21623
|
+
};
|
|
21618
21624
|
/**
|
|
21619
|
-
*
|
|
21620
|
-
* @param
|
|
21621
|
-
* @param
|
|
21622
|
-
* @param
|
|
21623
|
-
* @param
|
|
21624
|
-
|
|
21625
|
-
|
|
21625
|
+
* Recreate render target if needed.
|
|
21626
|
+
* @param engine - Engine
|
|
21627
|
+
* @param currentRenderTarget - Current render target
|
|
21628
|
+
* @param width - Need render target width
|
|
21629
|
+
* @param height - Need render target height
|
|
21630
|
+
* @param colorFormat - Need render target color format
|
|
21631
|
+
* @param depthFormat - Need render target depth format
|
|
21632
|
+
* @param mipmap - Need render target mipmap
|
|
21633
|
+
* @returns Render target
|
|
21634
|
+
*/ PipelineUtils.recreateRenderTargetIfNeeded = function recreateRenderTargetIfNeeded(engine, currentRenderTarget, width, height, colorFormat, depthFormat, mipmap) {
|
|
21635
|
+
var _currentRenderTarget, _currentRenderTarget1;
|
|
21636
|
+
var currentColorTexture = (_currentRenderTarget = currentRenderTarget) == null ? void 0 : _currentRenderTarget.getColorTexture(0);
|
|
21637
|
+
var currentDepthTexture = (_currentRenderTarget1 = currentRenderTarget) == null ? void 0 : _currentRenderTarget1.depthTexture;
|
|
21638
|
+
var colorTexture = colorFormat ? PipelineUtils.recreateTextureIfNeeded(engine, currentColorTexture, width, height, colorFormat, mipmap) : null;
|
|
21639
|
+
var depthTexture = depthFormat ? PipelineUtils.recreateTextureIfNeeded(engine, currentDepthTexture, width, height, depthFormat, mipmap) : null;
|
|
21640
|
+
if (currentColorTexture !== colorTexture || currentDepthTexture !== depthTexture) {
|
|
21641
|
+
var _currentRenderTarget2;
|
|
21642
|
+
(_currentRenderTarget2 = currentRenderTarget) == null ? void 0 : _currentRenderTarget2.destroy();
|
|
21643
|
+
currentRenderTarget = new RenderTarget(engine, width, height, colorTexture, depthTexture);
|
|
21644
|
+
currentRenderTarget.isGCIgnored = true;
|
|
21645
|
+
}
|
|
21646
|
+
return currentRenderTarget;
|
|
21647
|
+
};
|
|
21648
|
+
return PipelineUtils;
|
|
21626
21649
|
}();
|
|
21627
21650
|
|
|
21628
21651
|
/**
|
|
@@ -21929,60 +21952,47 @@ var passNum = 0;
|
|
|
21929
21952
|
return RenderQueue;
|
|
21930
21953
|
}();
|
|
21931
21954
|
|
|
21955
|
+
var passNum = 0;
|
|
21932
21956
|
/**
|
|
21933
|
-
*
|
|
21934
|
-
*/ var
|
|
21935
|
-
function
|
|
21957
|
+
* RenderPass.
|
|
21958
|
+
*/ var RenderPass = /*#__PURE__*/ function() {
|
|
21959
|
+
function RenderPass(name, priority, renderTarget, replaceMaterial, mask) {
|
|
21960
|
+
if (name === void 0) name = "RENDER_PASS" + passNum++;
|
|
21961
|
+
if (priority === void 0) priority = 0;
|
|
21962
|
+
if (renderTarget === void 0) renderTarget = null;
|
|
21963
|
+
if (replaceMaterial === void 0) replaceMaterial = null;
|
|
21964
|
+
if (mask === void 0) mask = null;
|
|
21965
|
+
this.name = name;
|
|
21966
|
+
this.enabled = true;
|
|
21967
|
+
this.priority = priority;
|
|
21968
|
+
this.renderTarget = renderTarget;
|
|
21969
|
+
this.replaceMaterial = replaceMaterial;
|
|
21970
|
+
this.mask = mask || Layer.Everything;
|
|
21971
|
+
this.renderOverride = false; // If renderOverride is set to true, you need to implement the render method
|
|
21972
|
+
}
|
|
21973
|
+
var _proto = RenderPass.prototype;
|
|
21936
21974
|
/**
|
|
21937
|
-
*
|
|
21938
|
-
* @param
|
|
21939
|
-
* @param
|
|
21940
|
-
* @param
|
|
21941
|
-
* @param
|
|
21942
|
-
|
|
21943
|
-
* @param mipmap - Need texture mipmap
|
|
21944
|
-
* @returns Texture
|
|
21945
|
-
*/ PipelineUtils.recreateTextureIfNeeded = function recreateTextureIfNeeded(engine, currentTexture, width, height, format, mipmap) {
|
|
21946
|
-
if (currentTexture) {
|
|
21947
|
-
if (currentTexture.width !== width || currentTexture.height !== height || currentTexture.format !== format || currentTexture.mipmapCount > 1 !== mipmap) {
|
|
21948
|
-
currentTexture.destroy();
|
|
21949
|
-
var texture = new Texture2D(engine, width, height, format, mipmap);
|
|
21950
|
-
texture.isGCIgnored = true;
|
|
21951
|
-
return texture;
|
|
21952
|
-
} else {
|
|
21953
|
-
return currentTexture;
|
|
21954
|
-
}
|
|
21955
|
-
} else {
|
|
21956
|
-
var texture1 = new Texture2D(engine, width, height, format, mipmap);
|
|
21957
|
-
texture1.isGCIgnored = true;
|
|
21958
|
-
return texture1;
|
|
21959
|
-
}
|
|
21960
|
-
};
|
|
21975
|
+
* Rendering callback, will be executed if renderOverride is set to true.
|
|
21976
|
+
* @param camera - Camera
|
|
21977
|
+
* @param opaqueQueue - Opaque queue
|
|
21978
|
+
* @param alphaTestQueue - Alpha test queue
|
|
21979
|
+
* @param transparentQueue - Transparent queue
|
|
21980
|
+
*/ _proto.render = function render(camera, opaqueQueue, alphaTestQueue, transparentQueue) {};
|
|
21961
21981
|
/**
|
|
21962
|
-
*
|
|
21963
|
-
* @param
|
|
21964
|
-
* @param
|
|
21965
|
-
* @param
|
|
21966
|
-
* @param
|
|
21967
|
-
|
|
21968
|
-
|
|
21969
|
-
*
|
|
21970
|
-
* @
|
|
21971
|
-
|
|
21972
|
-
|
|
21973
|
-
|
|
21974
|
-
|
|
21975
|
-
|
|
21976
|
-
var depthTexture = depthFormat ? PipelineUtils.recreateTextureIfNeeded(engine, currentDepthTexture, width, height, depthFormat, mipmap) : null;
|
|
21977
|
-
if (currentColorTexture !== colorTexture || currentDepthTexture !== depthTexture) {
|
|
21978
|
-
var _currentRenderTarget2;
|
|
21979
|
-
(_currentRenderTarget2 = currentRenderTarget) == null ? void 0 : _currentRenderTarget2.destroy();
|
|
21980
|
-
currentRenderTarget = new RenderTarget(engine, width, height, colorTexture, depthTexture);
|
|
21981
|
-
currentRenderTarget.isGCIgnored = true;
|
|
21982
|
-
}
|
|
21983
|
-
return currentRenderTarget;
|
|
21984
|
-
};
|
|
21985
|
-
return PipelineUtils;
|
|
21982
|
+
* Post rendering callback.
|
|
21983
|
+
* @param camera - Camera
|
|
21984
|
+
* @param opaqueQueue - Opaque queue
|
|
21985
|
+
* @param alphaTestQueue - Alpha test queue
|
|
21986
|
+
* @param transparentQueue - Transparent queue
|
|
21987
|
+
*/ _proto.preRender = function preRender(camera, opaqueQueue, alphaTestQueue, transparentQueue) {};
|
|
21988
|
+
/**
|
|
21989
|
+
* Post rendering callback.
|
|
21990
|
+
* @param camera - Camera
|
|
21991
|
+
* @param opaqueQueue - Opaque queue
|
|
21992
|
+
* @param alphaTestQueue - Alpha test queue
|
|
21993
|
+
* @param transparentQueue - Transparent queue
|
|
21994
|
+
*/ _proto.postRender = function postRender(camera, opaqueQueue, alphaTestQueue, transparentQueue) {};
|
|
21995
|
+
return RenderPass;
|
|
21986
21996
|
}();
|
|
21987
21997
|
|
|
21988
21998
|
/**
|
|
@@ -22250,6 +22260,26 @@ var /**
|
|
|
22250
22260
|
var offset = cascadeIndex * 16;
|
|
22251
22261
|
Utils._floatMatrixMultiply(sliceMatrix, outShadowMatrices, offset, outShadowMatrices, offset);
|
|
22252
22262
|
};
|
|
22263
|
+
/**
|
|
22264
|
+
* Extract scale and bias from a fade distance to achieve a linear fading of the fade distance.
|
|
22265
|
+
*/ ShadowUtils.getScaleAndBiasForLinearDistanceFade = function getScaleAndBiasForLinearDistanceFade(fadeDistance, border, outInfo) {
|
|
22266
|
+
// (P^2-N^2)/(F^2-N^2)
|
|
22267
|
+
// To avoid division from zero
|
|
22268
|
+
// This values ensure that fade within cascade will be 0 and outside 1
|
|
22269
|
+
if (border < 0.0001) {
|
|
22270
|
+
var multiplier = 1000; // To avoid blending if difference is in fractions
|
|
22271
|
+
outInfo.z = multiplier;
|
|
22272
|
+
outInfo.w = -fadeDistance * multiplier;
|
|
22273
|
+
return;
|
|
22274
|
+
}
|
|
22275
|
+
border = 1 - border;
|
|
22276
|
+
border *= border;
|
|
22277
|
+
// Fade with distance calculation is just a linear fade from 90% of fade distance to fade distance. 90% arbitrarily chosen but should work well enough.
|
|
22278
|
+
var distanceFadeNear = border * fadeDistance;
|
|
22279
|
+
var fadeRange = fadeDistance - distanceFadeNear;
|
|
22280
|
+
outInfo.z = 1.0 / fadeRange;
|
|
22281
|
+
outInfo.w = -distanceFadeNear / fadeRange;
|
|
22282
|
+
};
|
|
22253
22283
|
return ShadowUtils;
|
|
22254
22284
|
}();
|
|
22255
22285
|
(function() {
|
|
@@ -22494,12 +22524,6 @@ var /**
|
|
|
22494
22524
|
ShadowUtils.atlasBorderSize = 4.0;
|
|
22495
22525
|
})();
|
|
22496
22526
|
|
|
22497
|
-
/**
|
|
22498
|
-
* PipelinePass is a base class for all pipeline passes.
|
|
22499
|
-
*/ var PipelinePass = function PipelinePass(engine) {
|
|
22500
|
-
this._engine = engine;
|
|
22501
|
-
};
|
|
22502
|
-
|
|
22503
22527
|
/**
|
|
22504
22528
|
* Cascade shadow caster pass.
|
|
22505
22529
|
*/ var CascadedShadowCasterPass = /*#__PURE__*/ function(PipelinePass1) {
|
|
@@ -22512,11 +22536,10 @@ var /**
|
|
|
22512
22536
|
_this._shadowSliceData = new ShadowSliceData();
|
|
22513
22537
|
_this._lightUp = new Vector3();
|
|
22514
22538
|
_this._lightSide = new Vector3();
|
|
22515
|
-
_this._existShadowMap = false;
|
|
22516
22539
|
_this._splitBoundSpheres = new Float32Array(CascadedShadowCasterPass._maxCascades * 4);
|
|
22517
22540
|
/** The end is project precision problem in shader. */ _this._shadowMatrices = new Float32Array((CascadedShadowCasterPass._maxCascades + 1) * 16);
|
|
22518
|
-
//
|
|
22519
|
-
_this._shadowInfos = new
|
|
22541
|
+
// intensity, null, fadeScale, fadeBias
|
|
22542
|
+
_this._shadowInfos = new Vector4();
|
|
22520
22543
|
_this._viewportOffsets = [
|
|
22521
22544
|
new Vector2(),
|
|
22522
22545
|
new Vector2(),
|
|
@@ -22532,14 +22555,12 @@ var /**
|
|
|
22532
22555
|
/**
|
|
22533
22556
|
* @internal
|
|
22534
22557
|
*/ _proto.onRender = function onRender(context) {
|
|
22558
|
+
var light = this._camera.scene._lightManager._sunlight;
|
|
22535
22559
|
this._updateShadowSettings();
|
|
22536
|
-
this.
|
|
22537
|
-
this.
|
|
22538
|
-
if (this._existShadowMap) {
|
|
22539
|
-
this._updateReceiversShaderData();
|
|
22540
|
-
}
|
|
22560
|
+
this._renderDirectShadowMap(context, light);
|
|
22561
|
+
this._updateReceiversShaderData(light);
|
|
22541
22562
|
};
|
|
22542
|
-
_proto._renderDirectShadowMap = function _renderDirectShadowMap(context) {
|
|
22563
|
+
_proto._renderDirectShadowMap = function _renderDirectShadowMap(context, light) {
|
|
22543
22564
|
var _this = this, engine = _this._engine, camera = _this._camera, viewports = _this._viewportOffsets, shadowSliceData = _this._shadowSliceData, splitBoundSpheres = _this._splitBoundSpheres, shadowMatrices = _this._shadowMatrices;
|
|
22544
22565
|
var _camera__renderPipeline__cullingResults = camera._renderPipeline._cullingResults, opaqueQueue = _camera__renderPipeline__cullingResults.opaqueQueue, alphaTestQueue = _camera__renderPipeline__cullingResults.alphaTestQueue, transparentQueue = _camera__renderPipeline__cullingResults.transparentQueue;
|
|
22545
22566
|
var scene = camera.scene;
|
|
@@ -22553,91 +22574,87 @@ var /**
|
|
|
22553
22574
|
var lightUp = this._lightUp;
|
|
22554
22575
|
var lightSide = this._lightSide;
|
|
22555
22576
|
var lightForward = shadowSliceData.virtualCamera.forward;
|
|
22556
|
-
|
|
22557
|
-
|
|
22558
|
-
|
|
22559
|
-
|
|
22560
|
-
|
|
22561
|
-
|
|
22562
|
-
|
|
22563
|
-
|
|
22564
|
-
|
|
22565
|
-
|
|
22566
|
-
|
|
22567
|
-
|
|
22568
|
-
|
|
22569
|
-
|
|
22570
|
-
|
|
22571
|
-
|
|
22572
|
-
|
|
22573
|
-
|
|
22574
|
-
|
|
22575
|
-
|
|
22576
|
-
|
|
22577
|
-
|
|
22578
|
-
|
|
22579
|
-
rhi.
|
|
22580
|
-
|
|
22581
|
-
|
|
22582
|
-
|
|
22583
|
-
|
|
22584
|
-
|
|
22585
|
-
|
|
22586
|
-
|
|
22587
|
-
|
|
22588
|
-
|
|
22589
|
-
|
|
22590
|
-
|
|
22591
|
-
|
|
22592
|
-
|
|
22593
|
-
|
|
22594
|
-
|
|
22595
|
-
|
|
22596
|
-
|
|
22597
|
-
|
|
22598
|
-
|
|
22599
|
-
|
|
22600
|
-
|
|
22601
|
-
|
|
22602
|
-
|
|
22603
|
-
|
|
22604
|
-
|
|
22605
|
-
|
|
22606
|
-
|
|
22607
|
-
|
|
22608
|
-
|
|
22609
|
-
|
|
22610
|
-
|
|
22611
|
-
|
|
22612
|
-
|
|
22613
|
-
|
|
22614
|
-
|
|
22615
|
-
|
|
22616
|
-
|
|
22617
|
-
|
|
22618
|
-
|
|
22619
|
-
|
|
22620
|
-
|
|
22621
|
-
|
|
22622
|
-
|
|
22623
|
-
|
|
22624
|
-
|
|
22625
|
-
|
|
22626
|
-
|
|
22627
|
-
|
|
22628
|
-
|
|
22629
|
-
|
|
22630
|
-
|
|
22631
|
-
}
|
|
22632
|
-
}
|
|
22633
|
-
this._existShadowMap = true;
|
|
22634
|
-
}
|
|
22635
|
-
};
|
|
22636
|
-
_proto._updateReceiversShaderData = function _updateReceiversShaderData() {
|
|
22637
|
-
var scene = this._camera.scene;
|
|
22577
|
+
// Prepare render target
|
|
22578
|
+
var _this__shadowMapSize = this._shadowMapSize, width = _this__shadowMapSize.z, height = _this__shadowMapSize.w;
|
|
22579
|
+
var format = this._shadowMapFormat;
|
|
22580
|
+
var renderTarget;
|
|
22581
|
+
var shadowTexture;
|
|
22582
|
+
if (this._supportDepthTexture) {
|
|
22583
|
+
renderTarget = PipelineUtils.recreateRenderTargetIfNeeded(engine, this._renderTarget, width, height, null, format, false);
|
|
22584
|
+
shadowTexture = renderTarget.depthTexture;
|
|
22585
|
+
} else {
|
|
22586
|
+
renderTarget = PipelineUtils.recreateRenderTargetIfNeeded(engine, this._renderTarget, width, height, format, null, false);
|
|
22587
|
+
shadowTexture = renderTarget.getColorTexture(0);
|
|
22588
|
+
}
|
|
22589
|
+
shadowTexture.wrapModeU = shadowTexture.wrapModeV = TextureWrapMode.Clamp;
|
|
22590
|
+
if (engine._hardwareRenderer._isWebGL2) {
|
|
22591
|
+
shadowTexture.depthCompareFunction = TextureDepthCompareFunction.Less;
|
|
22592
|
+
}
|
|
22593
|
+
this._renderTarget = renderTarget;
|
|
22594
|
+
this._depthTexture = shadowTexture;
|
|
22595
|
+
// @todo: shouldn't set viewport and scissor in activeRenderTarget
|
|
22596
|
+
rhi.activeRenderTarget(renderTarget, CascadedShadowCasterPass._viewport, 0);
|
|
22597
|
+
if (this._supportDepthTexture) {
|
|
22598
|
+
rhi.clearRenderTarget(engine, CameraClearFlags.Depth, null);
|
|
22599
|
+
} else {
|
|
22600
|
+
rhi.clearRenderTarget(engine, CameraClearFlags.All, CascadedShadowCasterPass._clearColor);
|
|
22601
|
+
}
|
|
22602
|
+
// prepare light and camera direction
|
|
22603
|
+
Matrix.rotationQuaternion(light.entity.transform.worldRotationQuaternion, lightWorld);
|
|
22604
|
+
lightSide.set(lightWorldE[0], lightWorldE[1], lightWorldE[2]);
|
|
22605
|
+
lightUp.set(lightWorldE[4], lightWorldE[5], lightWorldE[6]);
|
|
22606
|
+
lightForward.set(-lightWorldE[8], -lightWorldE[9], -lightWorldE[10]);
|
|
22607
|
+
var cameraForward = CascadedShadowCasterPass._tempVector;
|
|
22608
|
+
cameraForward.copyFrom(camera.entity.transform.worldForward);
|
|
22609
|
+
var shadowTileResolution = this._shadowTileResolution;
|
|
22610
|
+
for(var j = 0; j < shadowCascades; j++){
|
|
22611
|
+
ShadowUtils.getBoundSphereByFrustum(splitDistance[j], splitDistance[j + 1], camera, cameraForward, shadowSliceData);
|
|
22612
|
+
ShadowUtils.getDirectionLightShadowCullPlanes(camera._frustum, splitDistance[j], camera.nearClipPlane, lightForward, shadowSliceData);
|
|
22613
|
+
ShadowUtils.getDirectionalLightMatrices(lightUp, lightSide, lightForward, j, light.shadowNearPlane, shadowTileResolution, shadowSliceData, shadowMatrices);
|
|
22614
|
+
if (shadowCascades > 1) {
|
|
22615
|
+
ShadowUtils.applySliceTransform(shadowTileResolution, width, height, j, this._viewportOffsets[j], shadowMatrices);
|
|
22616
|
+
}
|
|
22617
|
+
this._updateSingleShadowCasterShaderData(light, shadowSliceData, context);
|
|
22618
|
+
// upload pre-cascade infos.
|
|
22619
|
+
var center = boundSphere.center;
|
|
22620
|
+
var radius = boundSphere.radius;
|
|
22621
|
+
var offset = j * 4;
|
|
22622
|
+
splitBoundSpheres[offset] = center.x;
|
|
22623
|
+
splitBoundSpheres[offset + 1] = center.y;
|
|
22624
|
+
splitBoundSpheres[offset + 2] = center.z;
|
|
22625
|
+
splitBoundSpheres[offset + 3] = radius * radius;
|
|
22626
|
+
opaqueQueue.clear();
|
|
22627
|
+
alphaTestQueue.clear();
|
|
22628
|
+
transparentQueue.clear();
|
|
22629
|
+
var renderers = componentsManager._renderers;
|
|
22630
|
+
var elements = renderers._elements;
|
|
22631
|
+
for(var k = renderers.length - 1; k >= 0; --k){
|
|
22632
|
+
ShadowUtils.shadowCullFrustum(context, light, elements[k], shadowSliceData);
|
|
22633
|
+
}
|
|
22634
|
+
if (opaqueQueue.elements.length || alphaTestQueue.elements.length) {
|
|
22635
|
+
opaqueQueue.sort(RenderQueue._compareFromNearToFar);
|
|
22636
|
+
alphaTestQueue.sort(RenderQueue._compareFromNearToFar);
|
|
22637
|
+
var _viewports_j = viewports[j], x = _viewports_j.x, y = _viewports_j.y;
|
|
22638
|
+
rhi.setGlobalDepthBias(1.0, 1.0);
|
|
22639
|
+
rhi.viewport(x, y, shadowTileResolution, shadowTileResolution);
|
|
22640
|
+
// for no cascade is for the edge,for cascade is for the beyond maxCascade pixel can use (0,0,0) trick sample the shadowMap
|
|
22641
|
+
rhi.scissor(x + 1, y + 1, shadowTileResolution - 2, shadowTileResolution - 2);
|
|
22642
|
+
engine._renderCount++;
|
|
22643
|
+
opaqueQueue.render(camera, Layer.Everything, PipelineStage.ShadowCaster);
|
|
22644
|
+
alphaTestQueue.render(camera, Layer.Everything, PipelineStage.ShadowCaster);
|
|
22645
|
+
rhi.setGlobalDepthBias(0, 0);
|
|
22646
|
+
}
|
|
22647
|
+
}
|
|
22648
|
+
};
|
|
22649
|
+
_proto._updateReceiversShaderData = function _updateReceiversShaderData(light) {
|
|
22650
|
+
var camera = this._camera;
|
|
22651
|
+
var scene = camera.scene;
|
|
22638
22652
|
var splitBoundSpheres = this._splitBoundSpheres;
|
|
22639
22653
|
var shadowMatrices = this._shadowMatrices;
|
|
22640
22654
|
var shadowCascades = scene.shadowCascades;
|
|
22655
|
+
var shadowFar = Math.min(scene.shadowDistance, camera.farClipPlane);
|
|
22656
|
+
ShadowUtils.getScaleAndBiasForLinearDistanceFade(Math.pow(shadowFar, 2), scene.shadowFadeBorder, this._shadowInfos);
|
|
22657
|
+
this._shadowInfos.x = light.shadowStrength;
|
|
22641
22658
|
// set zero matrix to project the index out of max cascade
|
|
22642
22659
|
if (shadowCascades > 1) {
|
|
22643
22660
|
for(var i = shadowCascades * 4, n = splitBoundSpheres.length; i < n; i++){
|
|
@@ -22650,7 +22667,7 @@ var /**
|
|
|
22650
22667
|
}
|
|
22651
22668
|
var shaderData = scene.shaderData;
|
|
22652
22669
|
shaderData.setFloatArray(CascadedShadowCasterPass._shadowMatricesProperty, this._shadowMatrices);
|
|
22653
|
-
shaderData.
|
|
22670
|
+
shaderData.setVector4(CascadedShadowCasterPass._shadowInfosProperty, this._shadowInfos);
|
|
22654
22671
|
shaderData.setTexture(CascadedShadowCasterPass._shadowMapsProperty, this._depthTexture);
|
|
22655
22672
|
shaderData.setFloatArray(CascadedShadowCasterPass._shadowSplitSpheresProperty, this._splitBoundSpheres);
|
|
22656
22673
|
shaderData.setVector4(CascadedShadowCasterPass._shadowMapSize, this._shadowMapSize);
|
|
@@ -22686,10 +22703,13 @@ var /**
|
|
|
22686
22703
|
return Math.sqrt(radius * radius / denominator);
|
|
22687
22704
|
};
|
|
22688
22705
|
_proto._updateShadowSettings = function _updateShadowSettings() {
|
|
22689
|
-
var
|
|
22706
|
+
var camera = this._camera;
|
|
22707
|
+
var scene = camera.scene;
|
|
22690
22708
|
var shadowFormat = ShadowUtils.shadowDepthFormat(scene.shadowResolution, this._supportDepthTexture);
|
|
22691
22709
|
var shadowResolution = ShadowUtils.shadowResolution(scene.shadowResolution);
|
|
22692
22710
|
var shadowCascades = scene.shadowCascades;
|
|
22711
|
+
var shadowFar = Math.min(scene.shadowDistance, camera.farClipPlane);
|
|
22712
|
+
this._getCascadesSplitDistance(shadowFar);
|
|
22693
22713
|
if (shadowFormat !== this._shadowMapFormat || shadowResolution !== this._shadowMapResolution || shadowCascades !== this._shadowCascadeMode) {
|
|
22694
22714
|
this._shadowMapFormat = shadowFormat;
|
|
22695
22715
|
this._shadowMapResolution = shadowResolution;
|
|
@@ -23870,6 +23890,7 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
23870
23890
|
* @param obj - class object
|
|
23871
23891
|
*/ Loader.registerClass = function registerClass(className, classDefine) {
|
|
23872
23892
|
this._engineObjects[className] = classDefine;
|
|
23893
|
+
this._classNameMap.set(classDefine, className);
|
|
23873
23894
|
};
|
|
23874
23895
|
/**
|
|
23875
23896
|
* Get the class object by class name.
|
|
@@ -23878,11 +23899,21 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
23878
23899
|
*/ Loader.getClass = function getClass(className) {
|
|
23879
23900
|
return this._engineObjects[className];
|
|
23880
23901
|
};
|
|
23902
|
+
/**
|
|
23903
|
+
* Get the class name by class object.
|
|
23904
|
+
* @param obj - class object
|
|
23905
|
+
* @returns class name
|
|
23906
|
+
*/ Loader.getClassName = function getClassName(obj) {
|
|
23907
|
+
return this._classNameMap.get(obj);
|
|
23908
|
+
};
|
|
23881
23909
|
return Loader;
|
|
23882
23910
|
}();
|
|
23883
23911
|
(function() {
|
|
23884
23912
|
Loader._engineObjects = {};
|
|
23885
23913
|
})();
|
|
23914
|
+
(function() {
|
|
23915
|
+
Loader._classNameMap = new Map();
|
|
23916
|
+
})();
|
|
23886
23917
|
|
|
23887
23918
|
/**
|
|
23888
23919
|
* Alpha blend mode.
|
|
@@ -27652,7 +27683,7 @@ __decorate([
|
|
|
27652
27683
|
this._clip = clip;
|
|
27653
27684
|
this._clipEndTime = Math.min(this._clipEndTime, 1);
|
|
27654
27685
|
this._onClipChanged();
|
|
27655
|
-
clip._updateFlagManager.addListener(this._onClipChanged);
|
|
27686
|
+
clip && clip._updateFlagManager.addListener(this._onClipChanged);
|
|
27656
27687
|
}
|
|
27657
27688
|
},
|
|
27658
27689
|
{
|
|
@@ -28359,6 +28390,7 @@ __decorate([
|
|
|
28359
28390
|
ParticleRandomSubSeeds[ParticleRandomSubSeeds["RotationOverLifetime"] = 0x40eb95e4] = "RotationOverLifetime";
|
|
28360
28391
|
ParticleRandomSubSeeds[ParticleRandomSubSeeds["TextureSheetAnimation"] = 0xbc524e5] = "TextureSheetAnimation";
|
|
28361
28392
|
ParticleRandomSubSeeds[ParticleRandomSubSeeds["Shape"] = 0xaf502044] = "Shape";
|
|
28393
|
+
ParticleRandomSubSeeds[ParticleRandomSubSeeds["GravityModifier"] = 0xa47b8c4d] = "GravityModifier";
|
|
28362
28394
|
})(ParticleRandomSubSeeds || (ParticleRandomSubSeeds = {}));
|
|
28363
28395
|
|
|
28364
28396
|
/**
|
|
@@ -29072,6 +29104,7 @@ var MainModule = /*#__PURE__*/ function() {
|
|
|
29072
29104
|
/** @internal */ this._startColorRand = new Rand(0, ParticleRandomSubSeeds.StartColor);
|
|
29073
29105
|
/** @internal */ this._startSizeRand = new Rand(0, ParticleRandomSubSeeds.StartSize);
|
|
29074
29106
|
/** @internal */ this._startRotationRand = new Rand(0, ParticleRandomSubSeeds.StartRotation);
|
|
29107
|
+
this._gravityModifierRand = new Rand(0, ParticleRandomSubSeeds.GravityModifier);
|
|
29075
29108
|
this._gravity = new Vector3();
|
|
29076
29109
|
this._generator = generator;
|
|
29077
29110
|
}
|
|
@@ -29132,7 +29165,7 @@ var MainModule = /*#__PURE__*/ function() {
|
|
|
29132
29165
|
break;
|
|
29133
29166
|
}
|
|
29134
29167
|
var particleGravity = this._gravity;
|
|
29135
|
-
var gravityModifierValue = this.gravityModifier.evaluate(undefined,
|
|
29168
|
+
var gravityModifierValue = this.gravityModifier.evaluate(undefined, this._gravityModifierRand.random());
|
|
29136
29169
|
Vector3.scale(renderer.scene.physics.gravity, gravityModifierValue, particleGravity);
|
|
29137
29170
|
shaderData.setVector3(MainModule._gravity, particleGravity);
|
|
29138
29171
|
shaderData.setInt(MainModule._simulationSpace, this.simulationSpace);
|
|
@@ -29251,6 +29284,9 @@ __decorate([
|
|
|
29251
29284
|
__decorate([
|
|
29252
29285
|
ignoreClone
|
|
29253
29286
|
], MainModule.prototype, "_startRotationRand", void 0);
|
|
29287
|
+
__decorate([
|
|
29288
|
+
ignoreClone
|
|
29289
|
+
], MainModule.prototype, "_gravityModifierRand", void 0);
|
|
29254
29290
|
__decorate([
|
|
29255
29291
|
ignoreClone
|
|
29256
29292
|
], MainModule.prototype, "_generator", void 0);
|
|
@@ -30580,9 +30616,9 @@ __decorate([
|
|
|
30580
30616
|
_inherits(BoxShape, BaseShape1);
|
|
30581
30617
|
function BoxShape() {
|
|
30582
30618
|
var _this;
|
|
30583
|
-
_this = BaseShape1.
|
|
30584
|
-
/** The size of the box. */ _this.size = new Vector3(1, 1, 1);
|
|
30619
|
+
_this = BaseShape1.apply(this, arguments) || this;
|
|
30585
30620
|
_this.shapeType = ParticleShapeType.Box;
|
|
30621
|
+
/** The size of the box. */ _this.size = new Vector3(1, 1, 1);
|
|
30586
30622
|
return _this;
|
|
30587
30623
|
}
|
|
30588
30624
|
var _proto = BoxShape.prototype;
|
|
@@ -30619,12 +30655,12 @@ __decorate([
|
|
|
30619
30655
|
_inherits(CircleShape, BaseShape1);
|
|
30620
30656
|
function CircleShape() {
|
|
30621
30657
|
var _this;
|
|
30622
|
-
_this = BaseShape1.
|
|
30658
|
+
_this = BaseShape1.apply(this, arguments) || this;
|
|
30659
|
+
_this.shapeType = ParticleShapeType.Circle;
|
|
30623
30660
|
/** Radius of the shape to emit particles from. */ _this.radius = 1.0;
|
|
30624
30661
|
/** Angle of the circle arc to emit particles from. */ _this.arc = 360.0;
|
|
30625
30662
|
/** The mode to generate particles around the arc. */ _this.arcMode = ParticleShapeArcMode.Random;
|
|
30626
30663
|
/** The speed of complete 360 degree rotation. */ _this.arcSpeed = 1.0;
|
|
30627
|
-
_this.shapeType = ParticleShapeType.Circle;
|
|
30628
30664
|
return _this;
|
|
30629
30665
|
}
|
|
30630
30666
|
var _proto = CircleShape.prototype;
|
|
@@ -30660,12 +30696,12 @@ __decorate([
|
|
|
30660
30696
|
_inherits(ConeShape, BaseShape1);
|
|
30661
30697
|
function ConeShape() {
|
|
30662
30698
|
var _this;
|
|
30663
|
-
_this = BaseShape1.
|
|
30699
|
+
_this = BaseShape1.apply(this, arguments) || this;
|
|
30700
|
+
_this.shapeType = ParticleShapeType.Cone;
|
|
30664
30701
|
/** Angle of the cone to emit particles from. */ _this.angle = 25.0;
|
|
30665
30702
|
/** Radius of the shape to emit particles from. */ _this.radius = 1.0;
|
|
30666
30703
|
/** Length of the cone to emit particles from. */ _this.length = 5.0;
|
|
30667
30704
|
/** Cone emitter type. */ _this.emitType = /** Emit particles from the base of the cone. */ 0;
|
|
30668
|
-
_this.shapeType = ParticleShapeType.Cone;
|
|
30669
30705
|
return _this;
|
|
30670
30706
|
}
|
|
30671
30707
|
var _proto = ConeShape.prototype;
|
|
@@ -30725,9 +30761,9 @@ var ConeEmitType;
|
|
|
30725
30761
|
_inherits(HemisphereShape, BaseShape1);
|
|
30726
30762
|
function HemisphereShape() {
|
|
30727
30763
|
var _this;
|
|
30728
|
-
_this = BaseShape1.
|
|
30729
|
-
/** Radius of the shape to emit particles from. */ _this.radius = 1.0;
|
|
30764
|
+
_this = BaseShape1.apply(this, arguments) || this;
|
|
30730
30765
|
_this.shapeType = ParticleShapeType.Hemisphere;
|
|
30766
|
+
/** Radius of the shape to emit particles from. */ _this.radius = 1.0;
|
|
30731
30767
|
return _this;
|
|
30732
30768
|
}
|
|
30733
30769
|
var _proto = HemisphereShape.prototype;
|
|
@@ -30750,9 +30786,9 @@ var ConeEmitType;
|
|
|
30750
30786
|
_inherits(SphereShape, BaseShape1);
|
|
30751
30787
|
function SphereShape() {
|
|
30752
30788
|
var _this;
|
|
30753
|
-
_this = BaseShape1.
|
|
30754
|
-
/** Radius of the shape to emit particles from. */ _this.radius = 1.0;
|
|
30789
|
+
_this = BaseShape1.apply(this, arguments) || this;
|
|
30755
30790
|
_this.shapeType = ParticleShapeType.Sphere;
|
|
30791
|
+
/** Radius of the shape to emit particles from. */ _this.radius = 1.0;
|
|
30756
30792
|
return _this;
|
|
30757
30793
|
}
|
|
30758
30794
|
var _proto = SphereShape.prototype;
|
|
@@ -31125,5 +31161,5 @@ var cacheDir = new Vector3();
|
|
|
31125
31161
|
return CubeProbe;
|
|
31126
31162
|
}(Probe);
|
|
31127
31163
|
|
|
31128
|
-
export { AmbientLight, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationRectCurve, AnimationRefCurve, AnimationStringCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorLayerMask, AnimatorState, AnimatorStateMachine, AnimatorStateTransition, AssetPromise, AssetType, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, Basic2DBatcher, BasicRenderPipeline, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlendState, BlinnPhongMaterial, BoolUpdateFlag, BoxColliderShape, BoxShape, Buffer, BufferBindFlag, BufferMesh, BufferUsage, BufferUtil, Burst, Camera, CameraClearFlags, CameraType, Canvas, CapsuleColliderShape, CharacterController, CircleShape, CloneManager, Collider, ColliderShape, ColliderShapeUpAxis, CollisionDetectionMode, ColorOverLifetimeModule, ColorSpace, ColorWriteMask, CompareFunction, Component, ConeEmitType, ConeShape, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, CurveKey, DataType, DependentMode, DepthState, DepthTextureMode, DiffuseMode, DirectLight, DynamicCollider, DynamicColliderConstraints, EmissionModule, Engine, EngineObject, Entity, EventDispatcher, FixedJoint, FogMode, Font, FontStyle, GLCapabilityType, GradientAlphaKey, GradientColorKey, HemisphereShape, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolationType, Joint, JointLimits, JointMotor, Keyframe, Keys, Layer, Light, Loader, Logger, MainModule, Material, Mesh, MeshRenderer, MeshTopology, ModelMesh, OverflowMode, PBRBaseMaterial, PBRMaterial, PBRSpecularMaterial, ParticleCompositeCurve, ParticleCompositeGradient, ParticleCurve, ParticleCurveMode, ParticleGenerator, ParticleGradient, ParticleGradientMode, ParticleMaterial, ParticleRenderMode, ParticleRenderer, ParticleScaleMode, ParticleShapeArcMode, ParticleSimulationSpace, ParticleStopMode, PhysicsMaterial, PhysicsMaterialCombineMode, PhysicsScene, PipelineStage, PlaneColliderShape, Platform, PointLight, Pointer, PointerButton, PointerPhase, Primitive, PrimitiveMesh, Probe, RasterState, ReferResource, RenderBufferDepthFormat, RenderFace, RenderPass, RenderQueue, RenderQueueType, RenderState, RenderStateElementKey as RenderStateDataKey, RenderTarget, RenderTargetBlendState, Renderer, ResourceManager, RotationOverLifetimeModule, Scene, SceneManager, Script, SetDataOptions, Shader, ShaderData, ShaderFactory, ShaderMacro, ShaderMacroCollection, ShaderPass, ShaderProperty, ShaderPropertyType, ShaderTagKey, ShadowCascadesMode, ShadowResolution, ShadowType, SizeOverLifetimeModule, Skin, SkinnedMeshRenderer, Sky, SkyBoxMaterial, SkyProceduralMaterial, SphereColliderShape, SphereShape, SpotLight, SpringJoint, Sprite, SpriteAtlas, SpriteDrawMode, SpriteMask, SpriteMaskInteraction, SpriteMaskLayer, SpriteRenderer, SpriteTileMode, StateMachineScript, StaticCollider, StencilOperation, StencilState, SubMesh, SubShader, SunMode, SystemInfo, TextHorizontalAlignment, TextRenderer, TextUtils, TextVerticalAlignment, Texture, Texture2D, Texture2DArray, TextureCoordinate, TextureCube, TextureCubeFace, TextureDepthCompareFunction, TextureFilterMode, TextureFormat, TextureSheetAnimationModule, TextureUsage, TextureWrapMode, Time, TrailMaterial, TrailRenderer, Transform, UnlitMaterial, Utils, VelocityOverLifetimeModule, VertexAttribute, VertexBufferBinding, VertexElement, VertexElementFormat, WrapMode, XRManager, assignmentClone, deepClone, dependentComponents, ignoreClone, request, resourceLoader, shallowClone };
|
|
31164
|
+
export { AmbientLight, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationRectCurve, AnimationRefCurve, AnimationStringCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorLayerMask, AnimatorState, AnimatorStateMachine, AnimatorStateTransition, AssetPromise, AssetType, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, Basic2DBatcher, BasicRenderPipeline, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlendState, BlinnPhongMaterial, BoolUpdateFlag, BoxColliderShape, BoxShape, Buffer, BufferBindFlag, BufferMesh, BufferUsage, BufferUtil, Burst, Camera, CameraClearFlags, CameraType, Canvas, CapsuleColliderShape, CharacterController, CircleShape, CloneManager, Collider, ColliderShape, ColliderShapeUpAxis, CollisionDetectionMode, ColorOverLifetimeModule, ColorSpace, ColorWriteMask, CompareFunction, Component, ConeEmitType, ConeShape, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, CurveKey, DataType, DependentMode, DepthState, DepthTextureMode, DiffuseMode, DirectLight, DynamicCollider, DynamicColliderConstraints, EmissionModule, Engine, EngineObject, Entity, EventDispatcher, FixedJoint, FogMode, Font, FontStyle, GLCapabilityType, GradientAlphaKey, GradientColorKey, HemisphereShape, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolationType, Joint, JointLimits, JointMotor, Keyframe, Keys, Layer, Light, Loader, Logger, MainModule, Material, Mesh, MeshRenderer, MeshTopology, ModelMesh, OverflowMode, PBRBaseMaterial, PBRMaterial, PBRSpecularMaterial, ParticleCompositeCurve, ParticleCompositeGradient, ParticleCurve, ParticleCurveMode, ParticleGenerator, ParticleGradient, ParticleGradientMode, ParticleMaterial, ParticleRenderMode, ParticleRenderer, ParticleScaleMode, ParticleShapeArcMode, ParticleShapeType, ParticleSimulationSpace, ParticleStopMode, PhysicsMaterial, PhysicsMaterialCombineMode, PhysicsScene, PipelineStage, PlaneColliderShape, Platform, PointLight, Pointer, PointerButton, PointerPhase, Primitive, PrimitiveMesh, Probe, RasterState, ReferResource, RenderBufferDepthFormat, RenderFace, RenderPass, RenderQueue, RenderQueueType, RenderState, RenderStateElementKey as RenderStateDataKey, RenderTarget, RenderTargetBlendState, Renderer, ResourceManager, RotationOverLifetimeModule, Scene, SceneManager, Script, SetDataOptions, Shader, ShaderData, ShaderFactory, ShaderMacro, ShaderMacroCollection, ShaderPass, ShaderProperty, ShaderPropertyType, ShaderTagKey, ShadowCascadesMode, ShadowResolution, ShadowType, SizeOverLifetimeModule, Skin, SkinnedMeshRenderer, Sky, SkyBoxMaterial, SkyProceduralMaterial, SphereColliderShape, SphereShape, SpotLight, SpringJoint, Sprite, SpriteAtlas, SpriteDrawMode, SpriteMask, SpriteMaskInteraction, SpriteMaskLayer, SpriteRenderer, SpriteTileMode, StateMachineScript, StaticCollider, StencilOperation, StencilState, SubMesh, SubShader, SunMode, SystemInfo, TextHorizontalAlignment, TextRenderer, TextUtils, TextVerticalAlignment, Texture, Texture2D, Texture2DArray, TextureCoordinate, TextureCube, TextureCubeFace, TextureDepthCompareFunction, TextureFilterMode, TextureFormat, TextureSheetAnimationModule, TextureUsage, TextureWrapMode, Time, TrailMaterial, TrailRenderer, Transform, UnlitMaterial, Utils, VelocityOverLifetimeModule, VertexAttribute, VertexBufferBinding, VertexElement, VertexElementFormat, WrapMode, XRManager, assignmentClone, deepClone, dependentComponents, ignoreClone, request, resourceLoader, shallowClone };
|
|
31129
31165
|
//# sourceMappingURL=module.js.map
|