@galacean/engine-core 1.2.0-alpha.3 → 1.2.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +240 -204
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +240 -204
- package/dist/module.js +239 -203
- 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/main.js
CHANGED
|
@@ -3292,7 +3292,7 @@ var PBRShaderLib = {
|
|
|
3292
3292
|
|
|
3293
3293
|
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
|
|
3294
3294
|
|
|
3295
|
-
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
|
|
3295
|
+
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
|
|
3296
3296
|
|
|
3297
3297
|
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
|
|
3298
3298
|
|
|
@@ -3418,7 +3418,7 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
3418
3418
|
Logger.error('Shader slice "' + match.trim() + '" not founded.');
|
|
3419
3419
|
return "";
|
|
3420
3420
|
}
|
|
3421
|
-
return ShaderFactory.parseIncludes(replace);
|
|
3421
|
+
return ShaderFactory.parseIncludes(replace, regex);
|
|
3422
3422
|
};
|
|
3423
3423
|
return src.replace(regex, replace);
|
|
3424
3424
|
};
|
|
@@ -20962,6 +20962,10 @@ __decorate([
|
|
|
20962
20962
|
/** The splits of two cascade distribution. */ _this.shadowTwoCascadeSplits = 1.0 / 3.0;
|
|
20963
20963
|
/** The splits of four cascade distribution. */ _this.shadowFourCascadeSplits = new engineMath.Vector3(1.0 / 15, 3.0 / 15.0, 7.0 / 15.0);
|
|
20964
20964
|
/** Max Shadow distance. */ _this.shadowDistance = 50;
|
|
20965
|
+
/**
|
|
20966
|
+
* Last shadow fade distance in percentage, range [0,1].
|
|
20967
|
+
* @remarks Value 0 is used for no shadow fade.
|
|
20968
|
+
*/ _this.shadowFadeBorder = 0.1;
|
|
20965
20969
|
/* @internal */ _this._lightManager = new LightManager();
|
|
20966
20970
|
/* @internal */ _this._componentsManager = new ComponentsManager();
|
|
20967
20971
|
/** @internal */ _this._isActiveInEngine = false;
|
|
@@ -21586,47 +21590,66 @@ __decorate([
|
|
|
21586
21590
|
DepthTextureMode[DepthTextureMode[/* Generate depth texture by pre-pass rendering. */ "PrePass"] = 1] = "PrePass";
|
|
21587
21591
|
})(exports.DepthTextureMode || (exports.DepthTextureMode = {}));
|
|
21588
21592
|
|
|
21589
|
-
var passNum = 0;
|
|
21590
21593
|
/**
|
|
21591
|
-
*
|
|
21592
|
-
*/ var
|
|
21593
|
-
|
|
21594
|
-
|
|
21595
|
-
|
|
21596
|
-
|
|
21597
|
-
|
|
21598
|
-
|
|
21599
|
-
|
|
21600
|
-
this.enabled = true;
|
|
21601
|
-
this.priority = priority;
|
|
21602
|
-
this.renderTarget = renderTarget;
|
|
21603
|
-
this.replaceMaterial = replaceMaterial;
|
|
21604
|
-
this.mask = mask || exports.Layer.Everything;
|
|
21605
|
-
this.renderOverride = false; // If renderOverride is set to true, you need to implement the render method
|
|
21606
|
-
}
|
|
21607
|
-
var _proto = RenderPass.prototype;
|
|
21608
|
-
/**
|
|
21609
|
-
* Rendering callback, will be executed if renderOverride is set to true.
|
|
21610
|
-
* @param camera - Camera
|
|
21611
|
-
* @param opaqueQueue - Opaque queue
|
|
21612
|
-
* @param alphaTestQueue - Alpha test queue
|
|
21613
|
-
* @param transparentQueue - Transparent queue
|
|
21614
|
-
*/ _proto.render = function render(camera, opaqueQueue, alphaTestQueue, transparentQueue) {};
|
|
21594
|
+
* PipelinePass is a base class for all pipeline passes.
|
|
21595
|
+
*/ var PipelinePass = function PipelinePass(engine) {
|
|
21596
|
+
this._engine = engine;
|
|
21597
|
+
};
|
|
21598
|
+
|
|
21599
|
+
/**
|
|
21600
|
+
* @internal
|
|
21601
|
+
*/ var PipelineUtils = /*#__PURE__*/ function() {
|
|
21602
|
+
function PipelineUtils() {}
|
|
21615
21603
|
/**
|
|
21616
|
-
*
|
|
21617
|
-
* @param
|
|
21618
|
-
* @param
|
|
21619
|
-
* @param
|
|
21620
|
-
* @param
|
|
21621
|
-
|
|
21604
|
+
* Recreate texture if needed.
|
|
21605
|
+
* @param engine - Engine
|
|
21606
|
+
* @param currentTexture - Current texture
|
|
21607
|
+
* @param width - Need texture width
|
|
21608
|
+
* @param height - Need texture height
|
|
21609
|
+
* @param format - Need texture format
|
|
21610
|
+
* @param mipmap - Need texture mipmap
|
|
21611
|
+
* @returns Texture
|
|
21612
|
+
*/ PipelineUtils.recreateTextureIfNeeded = function recreateTextureIfNeeded(engine, currentTexture, width, height, format, mipmap) {
|
|
21613
|
+
if (currentTexture) {
|
|
21614
|
+
if (currentTexture.width !== width || currentTexture.height !== height || currentTexture.format !== format || currentTexture.mipmapCount > 1 !== mipmap) {
|
|
21615
|
+
currentTexture.destroy();
|
|
21616
|
+
var texture = new Texture2D(engine, width, height, format, mipmap);
|
|
21617
|
+
texture.isGCIgnored = true;
|
|
21618
|
+
return texture;
|
|
21619
|
+
} else {
|
|
21620
|
+
return currentTexture;
|
|
21621
|
+
}
|
|
21622
|
+
} else {
|
|
21623
|
+
var texture1 = new Texture2D(engine, width, height, format, mipmap);
|
|
21624
|
+
texture1.isGCIgnored = true;
|
|
21625
|
+
return texture1;
|
|
21626
|
+
}
|
|
21627
|
+
};
|
|
21622
21628
|
/**
|
|
21623
|
-
*
|
|
21624
|
-
* @param
|
|
21625
|
-
* @param
|
|
21626
|
-
* @param
|
|
21627
|
-
* @param
|
|
21628
|
-
|
|
21629
|
-
|
|
21629
|
+
* Recreate render target if needed.
|
|
21630
|
+
* @param engine - Engine
|
|
21631
|
+
* @param currentRenderTarget - Current render target
|
|
21632
|
+
* @param width - Need render target width
|
|
21633
|
+
* @param height - Need render target height
|
|
21634
|
+
* @param colorFormat - Need render target color format
|
|
21635
|
+
* @param depthFormat - Need render target depth format
|
|
21636
|
+
* @param mipmap - Need render target mipmap
|
|
21637
|
+
* @returns Render target
|
|
21638
|
+
*/ PipelineUtils.recreateRenderTargetIfNeeded = function recreateRenderTargetIfNeeded(engine, currentRenderTarget, width, height, colorFormat, depthFormat, mipmap) {
|
|
21639
|
+
var _currentRenderTarget, _currentRenderTarget1;
|
|
21640
|
+
var currentColorTexture = (_currentRenderTarget = currentRenderTarget) == null ? void 0 : _currentRenderTarget.getColorTexture(0);
|
|
21641
|
+
var currentDepthTexture = (_currentRenderTarget1 = currentRenderTarget) == null ? void 0 : _currentRenderTarget1.depthTexture;
|
|
21642
|
+
var colorTexture = colorFormat ? PipelineUtils.recreateTextureIfNeeded(engine, currentColorTexture, width, height, colorFormat, mipmap) : null;
|
|
21643
|
+
var depthTexture = depthFormat ? PipelineUtils.recreateTextureIfNeeded(engine, currentDepthTexture, width, height, depthFormat, mipmap) : null;
|
|
21644
|
+
if (currentColorTexture !== colorTexture || currentDepthTexture !== depthTexture) {
|
|
21645
|
+
var _currentRenderTarget2;
|
|
21646
|
+
(_currentRenderTarget2 = currentRenderTarget) == null ? void 0 : _currentRenderTarget2.destroy();
|
|
21647
|
+
currentRenderTarget = new RenderTarget(engine, width, height, colorTexture, depthTexture);
|
|
21648
|
+
currentRenderTarget.isGCIgnored = true;
|
|
21649
|
+
}
|
|
21650
|
+
return currentRenderTarget;
|
|
21651
|
+
};
|
|
21652
|
+
return PipelineUtils;
|
|
21630
21653
|
}();
|
|
21631
21654
|
|
|
21632
21655
|
/**
|
|
@@ -21933,60 +21956,47 @@ var passNum = 0;
|
|
|
21933
21956
|
return RenderQueue;
|
|
21934
21957
|
}();
|
|
21935
21958
|
|
|
21959
|
+
var passNum = 0;
|
|
21936
21960
|
/**
|
|
21937
|
-
*
|
|
21938
|
-
*/ var
|
|
21939
|
-
function
|
|
21961
|
+
* RenderPass.
|
|
21962
|
+
*/ var RenderPass = /*#__PURE__*/ function() {
|
|
21963
|
+
function RenderPass(name, priority, renderTarget, replaceMaterial, mask) {
|
|
21964
|
+
if (name === void 0) name = "RENDER_PASS" + passNum++;
|
|
21965
|
+
if (priority === void 0) priority = 0;
|
|
21966
|
+
if (renderTarget === void 0) renderTarget = null;
|
|
21967
|
+
if (replaceMaterial === void 0) replaceMaterial = null;
|
|
21968
|
+
if (mask === void 0) mask = null;
|
|
21969
|
+
this.name = name;
|
|
21970
|
+
this.enabled = true;
|
|
21971
|
+
this.priority = priority;
|
|
21972
|
+
this.renderTarget = renderTarget;
|
|
21973
|
+
this.replaceMaterial = replaceMaterial;
|
|
21974
|
+
this.mask = mask || exports.Layer.Everything;
|
|
21975
|
+
this.renderOverride = false; // If renderOverride is set to true, you need to implement the render method
|
|
21976
|
+
}
|
|
21977
|
+
var _proto = RenderPass.prototype;
|
|
21940
21978
|
/**
|
|
21941
|
-
*
|
|
21942
|
-
* @param
|
|
21943
|
-
* @param
|
|
21944
|
-
* @param
|
|
21945
|
-
* @param
|
|
21946
|
-
|
|
21947
|
-
* @param mipmap - Need texture mipmap
|
|
21948
|
-
* @returns Texture
|
|
21949
|
-
*/ PipelineUtils.recreateTextureIfNeeded = function recreateTextureIfNeeded(engine, currentTexture, width, height, format, mipmap) {
|
|
21950
|
-
if (currentTexture) {
|
|
21951
|
-
if (currentTexture.width !== width || currentTexture.height !== height || currentTexture.format !== format || currentTexture.mipmapCount > 1 !== mipmap) {
|
|
21952
|
-
currentTexture.destroy();
|
|
21953
|
-
var texture = new Texture2D(engine, width, height, format, mipmap);
|
|
21954
|
-
texture.isGCIgnored = true;
|
|
21955
|
-
return texture;
|
|
21956
|
-
} else {
|
|
21957
|
-
return currentTexture;
|
|
21958
|
-
}
|
|
21959
|
-
} else {
|
|
21960
|
-
var texture1 = new Texture2D(engine, width, height, format, mipmap);
|
|
21961
|
-
texture1.isGCIgnored = true;
|
|
21962
|
-
return texture1;
|
|
21963
|
-
}
|
|
21964
|
-
};
|
|
21979
|
+
* Rendering callback, will be executed if renderOverride is set to true.
|
|
21980
|
+
* @param camera - Camera
|
|
21981
|
+
* @param opaqueQueue - Opaque queue
|
|
21982
|
+
* @param alphaTestQueue - Alpha test queue
|
|
21983
|
+
* @param transparentQueue - Transparent queue
|
|
21984
|
+
*/ _proto.render = function render(camera, opaqueQueue, alphaTestQueue, transparentQueue) {};
|
|
21965
21985
|
/**
|
|
21966
|
-
*
|
|
21967
|
-
* @param
|
|
21968
|
-
* @param
|
|
21969
|
-
* @param
|
|
21970
|
-
* @param
|
|
21971
|
-
|
|
21972
|
-
|
|
21973
|
-
*
|
|
21974
|
-
* @
|
|
21975
|
-
|
|
21976
|
-
|
|
21977
|
-
|
|
21978
|
-
|
|
21979
|
-
|
|
21980
|
-
var depthTexture = depthFormat ? PipelineUtils.recreateTextureIfNeeded(engine, currentDepthTexture, width, height, depthFormat, mipmap) : null;
|
|
21981
|
-
if (currentColorTexture !== colorTexture || currentDepthTexture !== depthTexture) {
|
|
21982
|
-
var _currentRenderTarget2;
|
|
21983
|
-
(_currentRenderTarget2 = currentRenderTarget) == null ? void 0 : _currentRenderTarget2.destroy();
|
|
21984
|
-
currentRenderTarget = new RenderTarget(engine, width, height, colorTexture, depthTexture);
|
|
21985
|
-
currentRenderTarget.isGCIgnored = true;
|
|
21986
|
-
}
|
|
21987
|
-
return currentRenderTarget;
|
|
21988
|
-
};
|
|
21989
|
-
return PipelineUtils;
|
|
21986
|
+
* Post rendering callback.
|
|
21987
|
+
* @param camera - Camera
|
|
21988
|
+
* @param opaqueQueue - Opaque queue
|
|
21989
|
+
* @param alphaTestQueue - Alpha test queue
|
|
21990
|
+
* @param transparentQueue - Transparent queue
|
|
21991
|
+
*/ _proto.preRender = function preRender(camera, opaqueQueue, alphaTestQueue, transparentQueue) {};
|
|
21992
|
+
/**
|
|
21993
|
+
* Post rendering callback.
|
|
21994
|
+
* @param camera - Camera
|
|
21995
|
+
* @param opaqueQueue - Opaque queue
|
|
21996
|
+
* @param alphaTestQueue - Alpha test queue
|
|
21997
|
+
* @param transparentQueue - Transparent queue
|
|
21998
|
+
*/ _proto.postRender = function postRender(camera, opaqueQueue, alphaTestQueue, transparentQueue) {};
|
|
21999
|
+
return RenderPass;
|
|
21990
22000
|
}();
|
|
21991
22001
|
|
|
21992
22002
|
/**
|
|
@@ -22254,6 +22264,26 @@ var /**
|
|
|
22254
22264
|
var offset = cascadeIndex * 16;
|
|
22255
22265
|
Utils._floatMatrixMultiply(sliceMatrix, outShadowMatrices, offset, outShadowMatrices, offset);
|
|
22256
22266
|
};
|
|
22267
|
+
/**
|
|
22268
|
+
* Extract scale and bias from a fade distance to achieve a linear fading of the fade distance.
|
|
22269
|
+
*/ ShadowUtils.getScaleAndBiasForLinearDistanceFade = function getScaleAndBiasForLinearDistanceFade(fadeDistance, border, outInfo) {
|
|
22270
|
+
// (P^2-N^2)/(F^2-N^2)
|
|
22271
|
+
// To avoid division from zero
|
|
22272
|
+
// This values ensure that fade within cascade will be 0 and outside 1
|
|
22273
|
+
if (border < 0.0001) {
|
|
22274
|
+
var multiplier = 1000; // To avoid blending if difference is in fractions
|
|
22275
|
+
outInfo.z = multiplier;
|
|
22276
|
+
outInfo.w = -fadeDistance * multiplier;
|
|
22277
|
+
return;
|
|
22278
|
+
}
|
|
22279
|
+
border = 1 - border;
|
|
22280
|
+
border *= border;
|
|
22281
|
+
// 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.
|
|
22282
|
+
var distanceFadeNear = border * fadeDistance;
|
|
22283
|
+
var fadeRange = fadeDistance - distanceFadeNear;
|
|
22284
|
+
outInfo.z = 1.0 / fadeRange;
|
|
22285
|
+
outInfo.w = -distanceFadeNear / fadeRange;
|
|
22286
|
+
};
|
|
22257
22287
|
return ShadowUtils;
|
|
22258
22288
|
}();
|
|
22259
22289
|
(function() {
|
|
@@ -22498,12 +22528,6 @@ var /**
|
|
|
22498
22528
|
ShadowUtils.atlasBorderSize = 4.0;
|
|
22499
22529
|
})();
|
|
22500
22530
|
|
|
22501
|
-
/**
|
|
22502
|
-
* PipelinePass is a base class for all pipeline passes.
|
|
22503
|
-
*/ var PipelinePass = function PipelinePass(engine) {
|
|
22504
|
-
this._engine = engine;
|
|
22505
|
-
};
|
|
22506
|
-
|
|
22507
22531
|
/**
|
|
22508
22532
|
* Cascade shadow caster pass.
|
|
22509
22533
|
*/ var CascadedShadowCasterPass = /*#__PURE__*/ function(PipelinePass1) {
|
|
@@ -22516,11 +22540,10 @@ var /**
|
|
|
22516
22540
|
_this._shadowSliceData = new ShadowSliceData();
|
|
22517
22541
|
_this._lightUp = new engineMath.Vector3();
|
|
22518
22542
|
_this._lightSide = new engineMath.Vector3();
|
|
22519
|
-
_this._existShadowMap = false;
|
|
22520
22543
|
_this._splitBoundSpheres = new Float32Array(CascadedShadowCasterPass._maxCascades * 4);
|
|
22521
22544
|
/** The end is project precision problem in shader. */ _this._shadowMatrices = new Float32Array((CascadedShadowCasterPass._maxCascades + 1) * 16);
|
|
22522
|
-
//
|
|
22523
|
-
_this._shadowInfos = new engineMath.
|
|
22545
|
+
// intensity, null, fadeScale, fadeBias
|
|
22546
|
+
_this._shadowInfos = new engineMath.Vector4();
|
|
22524
22547
|
_this._viewportOffsets = [
|
|
22525
22548
|
new engineMath.Vector2(),
|
|
22526
22549
|
new engineMath.Vector2(),
|
|
@@ -22536,14 +22559,12 @@ var /**
|
|
|
22536
22559
|
/**
|
|
22537
22560
|
* @internal
|
|
22538
22561
|
*/ _proto.onRender = function onRender(context) {
|
|
22562
|
+
var light = this._camera.scene._lightManager._sunlight;
|
|
22539
22563
|
this._updateShadowSettings();
|
|
22540
|
-
this.
|
|
22541
|
-
this.
|
|
22542
|
-
if (this._existShadowMap) {
|
|
22543
|
-
this._updateReceiversShaderData();
|
|
22544
|
-
}
|
|
22564
|
+
this._renderDirectShadowMap(context, light);
|
|
22565
|
+
this._updateReceiversShaderData(light);
|
|
22545
22566
|
};
|
|
22546
|
-
_proto._renderDirectShadowMap = function _renderDirectShadowMap(context) {
|
|
22567
|
+
_proto._renderDirectShadowMap = function _renderDirectShadowMap(context, light) {
|
|
22547
22568
|
var _this = this, engine = _this._engine, camera = _this._camera, viewports = _this._viewportOffsets, shadowSliceData = _this._shadowSliceData, splitBoundSpheres = _this._splitBoundSpheres, shadowMatrices = _this._shadowMatrices;
|
|
22548
22569
|
var _camera__renderPipeline__cullingResults = camera._renderPipeline._cullingResults, opaqueQueue = _camera__renderPipeline__cullingResults.opaqueQueue, alphaTestQueue = _camera__renderPipeline__cullingResults.alphaTestQueue, transparentQueue = _camera__renderPipeline__cullingResults.transparentQueue;
|
|
22549
22570
|
var scene = camera.scene;
|
|
@@ -22557,91 +22578,87 @@ var /**
|
|
|
22557
22578
|
var lightUp = this._lightUp;
|
|
22558
22579
|
var lightSide = this._lightSide;
|
|
22559
22580
|
var lightForward = shadowSliceData.virtualCamera.forward;
|
|
22560
|
-
|
|
22561
|
-
|
|
22562
|
-
|
|
22563
|
-
|
|
22564
|
-
|
|
22565
|
-
|
|
22566
|
-
|
|
22567
|
-
|
|
22568
|
-
|
|
22569
|
-
|
|
22570
|
-
|
|
22571
|
-
|
|
22572
|
-
|
|
22573
|
-
|
|
22574
|
-
|
|
22575
|
-
|
|
22576
|
-
|
|
22577
|
-
|
|
22578
|
-
|
|
22579
|
-
|
|
22580
|
-
|
|
22581
|
-
|
|
22582
|
-
|
|
22583
|
-
rhi.
|
|
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
|
-
|
|
22634
|
-
|
|
22635
|
-
}
|
|
22636
|
-
}
|
|
22637
|
-
this._existShadowMap = true;
|
|
22638
|
-
}
|
|
22639
|
-
};
|
|
22640
|
-
_proto._updateReceiversShaderData = function _updateReceiversShaderData() {
|
|
22641
|
-
var scene = this._camera.scene;
|
|
22581
|
+
// Prepare render target
|
|
22582
|
+
var _this__shadowMapSize = this._shadowMapSize, width = _this__shadowMapSize.z, height = _this__shadowMapSize.w;
|
|
22583
|
+
var format = this._shadowMapFormat;
|
|
22584
|
+
var renderTarget;
|
|
22585
|
+
var shadowTexture;
|
|
22586
|
+
if (this._supportDepthTexture) {
|
|
22587
|
+
renderTarget = PipelineUtils.recreateRenderTargetIfNeeded(engine, this._renderTarget, width, height, null, format, false);
|
|
22588
|
+
shadowTexture = renderTarget.depthTexture;
|
|
22589
|
+
} else {
|
|
22590
|
+
renderTarget = PipelineUtils.recreateRenderTargetIfNeeded(engine, this._renderTarget, width, height, format, null, false);
|
|
22591
|
+
shadowTexture = renderTarget.getColorTexture(0);
|
|
22592
|
+
}
|
|
22593
|
+
shadowTexture.wrapModeU = shadowTexture.wrapModeV = exports.TextureWrapMode.Clamp;
|
|
22594
|
+
if (engine._hardwareRenderer._isWebGL2) {
|
|
22595
|
+
shadowTexture.depthCompareFunction = exports.TextureDepthCompareFunction.Less;
|
|
22596
|
+
}
|
|
22597
|
+
this._renderTarget = renderTarget;
|
|
22598
|
+
this._depthTexture = shadowTexture;
|
|
22599
|
+
// @todo: shouldn't set viewport and scissor in activeRenderTarget
|
|
22600
|
+
rhi.activeRenderTarget(renderTarget, CascadedShadowCasterPass._viewport, 0);
|
|
22601
|
+
if (this._supportDepthTexture) {
|
|
22602
|
+
rhi.clearRenderTarget(engine, exports.CameraClearFlags.Depth, null);
|
|
22603
|
+
} else {
|
|
22604
|
+
rhi.clearRenderTarget(engine, exports.CameraClearFlags.All, CascadedShadowCasterPass._clearColor);
|
|
22605
|
+
}
|
|
22606
|
+
// prepare light and camera direction
|
|
22607
|
+
engineMath.Matrix.rotationQuaternion(light.entity.transform.worldRotationQuaternion, lightWorld);
|
|
22608
|
+
lightSide.set(lightWorldE[0], lightWorldE[1], lightWorldE[2]);
|
|
22609
|
+
lightUp.set(lightWorldE[4], lightWorldE[5], lightWorldE[6]);
|
|
22610
|
+
lightForward.set(-lightWorldE[8], -lightWorldE[9], -lightWorldE[10]);
|
|
22611
|
+
var cameraForward = CascadedShadowCasterPass._tempVector;
|
|
22612
|
+
cameraForward.copyFrom(camera.entity.transform.worldForward);
|
|
22613
|
+
var shadowTileResolution = this._shadowTileResolution;
|
|
22614
|
+
for(var j = 0; j < shadowCascades; j++){
|
|
22615
|
+
ShadowUtils.getBoundSphereByFrustum(splitDistance[j], splitDistance[j + 1], camera, cameraForward, shadowSliceData);
|
|
22616
|
+
ShadowUtils.getDirectionLightShadowCullPlanes(camera._frustum, splitDistance[j], camera.nearClipPlane, lightForward, shadowSliceData);
|
|
22617
|
+
ShadowUtils.getDirectionalLightMatrices(lightUp, lightSide, lightForward, j, light.shadowNearPlane, shadowTileResolution, shadowSliceData, shadowMatrices);
|
|
22618
|
+
if (shadowCascades > 1) {
|
|
22619
|
+
ShadowUtils.applySliceTransform(shadowTileResolution, width, height, j, this._viewportOffsets[j], shadowMatrices);
|
|
22620
|
+
}
|
|
22621
|
+
this._updateSingleShadowCasterShaderData(light, shadowSliceData, context);
|
|
22622
|
+
// upload pre-cascade infos.
|
|
22623
|
+
var center = boundSphere.center;
|
|
22624
|
+
var radius = boundSphere.radius;
|
|
22625
|
+
var offset = j * 4;
|
|
22626
|
+
splitBoundSpheres[offset] = center.x;
|
|
22627
|
+
splitBoundSpheres[offset + 1] = center.y;
|
|
22628
|
+
splitBoundSpheres[offset + 2] = center.z;
|
|
22629
|
+
splitBoundSpheres[offset + 3] = radius * radius;
|
|
22630
|
+
opaqueQueue.clear();
|
|
22631
|
+
alphaTestQueue.clear();
|
|
22632
|
+
transparentQueue.clear();
|
|
22633
|
+
var renderers = componentsManager._renderers;
|
|
22634
|
+
var elements = renderers._elements;
|
|
22635
|
+
for(var k = renderers.length - 1; k >= 0; --k){
|
|
22636
|
+
ShadowUtils.shadowCullFrustum(context, light, elements[k], shadowSliceData);
|
|
22637
|
+
}
|
|
22638
|
+
if (opaqueQueue.elements.length || alphaTestQueue.elements.length) {
|
|
22639
|
+
opaqueQueue.sort(RenderQueue._compareFromNearToFar);
|
|
22640
|
+
alphaTestQueue.sort(RenderQueue._compareFromNearToFar);
|
|
22641
|
+
var _viewports_j = viewports[j], x = _viewports_j.x, y = _viewports_j.y;
|
|
22642
|
+
rhi.setGlobalDepthBias(1.0, 1.0);
|
|
22643
|
+
rhi.viewport(x, y, shadowTileResolution, shadowTileResolution);
|
|
22644
|
+
// for no cascade is for the edge,for cascade is for the beyond maxCascade pixel can use (0,0,0) trick sample the shadowMap
|
|
22645
|
+
rhi.scissor(x + 1, y + 1, shadowTileResolution - 2, shadowTileResolution - 2);
|
|
22646
|
+
engine._renderCount++;
|
|
22647
|
+
opaqueQueue.render(camera, exports.Layer.Everything, exports.PipelineStage.ShadowCaster);
|
|
22648
|
+
alphaTestQueue.render(camera, exports.Layer.Everything, exports.PipelineStage.ShadowCaster);
|
|
22649
|
+
rhi.setGlobalDepthBias(0, 0);
|
|
22650
|
+
}
|
|
22651
|
+
}
|
|
22652
|
+
};
|
|
22653
|
+
_proto._updateReceiversShaderData = function _updateReceiversShaderData(light) {
|
|
22654
|
+
var camera = this._camera;
|
|
22655
|
+
var scene = camera.scene;
|
|
22642
22656
|
var splitBoundSpheres = this._splitBoundSpheres;
|
|
22643
22657
|
var shadowMatrices = this._shadowMatrices;
|
|
22644
22658
|
var shadowCascades = scene.shadowCascades;
|
|
22659
|
+
var shadowFar = Math.min(scene.shadowDistance, camera.farClipPlane);
|
|
22660
|
+
ShadowUtils.getScaleAndBiasForLinearDistanceFade(Math.pow(shadowFar, 2), scene.shadowFadeBorder, this._shadowInfos);
|
|
22661
|
+
this._shadowInfos.x = light.shadowStrength;
|
|
22645
22662
|
// set zero matrix to project the index out of max cascade
|
|
22646
22663
|
if (shadowCascades > 1) {
|
|
22647
22664
|
for(var i = shadowCascades * 4, n = splitBoundSpheres.length; i < n; i++){
|
|
@@ -22654,7 +22671,7 @@ var /**
|
|
|
22654
22671
|
}
|
|
22655
22672
|
var shaderData = scene.shaderData;
|
|
22656
22673
|
shaderData.setFloatArray(CascadedShadowCasterPass._shadowMatricesProperty, this._shadowMatrices);
|
|
22657
|
-
shaderData.
|
|
22674
|
+
shaderData.setVector4(CascadedShadowCasterPass._shadowInfosProperty, this._shadowInfos);
|
|
22658
22675
|
shaderData.setTexture(CascadedShadowCasterPass._shadowMapsProperty, this._depthTexture);
|
|
22659
22676
|
shaderData.setFloatArray(CascadedShadowCasterPass._shadowSplitSpheresProperty, this._splitBoundSpheres);
|
|
22660
22677
|
shaderData.setVector4(CascadedShadowCasterPass._shadowMapSize, this._shadowMapSize);
|
|
@@ -22690,10 +22707,13 @@ var /**
|
|
|
22690
22707
|
return Math.sqrt(radius * radius / denominator);
|
|
22691
22708
|
};
|
|
22692
22709
|
_proto._updateShadowSettings = function _updateShadowSettings() {
|
|
22693
|
-
var
|
|
22710
|
+
var camera = this._camera;
|
|
22711
|
+
var scene = camera.scene;
|
|
22694
22712
|
var shadowFormat = ShadowUtils.shadowDepthFormat(scene.shadowResolution, this._supportDepthTexture);
|
|
22695
22713
|
var shadowResolution = ShadowUtils.shadowResolution(scene.shadowResolution);
|
|
22696
22714
|
var shadowCascades = scene.shadowCascades;
|
|
22715
|
+
var shadowFar = Math.min(scene.shadowDistance, camera.farClipPlane);
|
|
22716
|
+
this._getCascadesSplitDistance(shadowFar);
|
|
22697
22717
|
if (shadowFormat !== this._shadowMapFormat || shadowResolution !== this._shadowMapResolution || shadowCascades !== this._shadowCascadeMode) {
|
|
22698
22718
|
this._shadowMapFormat = shadowFormat;
|
|
22699
22719
|
this._shadowMapResolution = shadowResolution;
|
|
@@ -23874,6 +23894,7 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
23874
23894
|
* @param obj - class object
|
|
23875
23895
|
*/ Loader.registerClass = function registerClass(className, classDefine) {
|
|
23876
23896
|
this._engineObjects[className] = classDefine;
|
|
23897
|
+
this._classNameMap.set(classDefine, className);
|
|
23877
23898
|
};
|
|
23878
23899
|
/**
|
|
23879
23900
|
* Get the class object by class name.
|
|
@@ -23882,11 +23903,21 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
23882
23903
|
*/ Loader.getClass = function getClass(className) {
|
|
23883
23904
|
return this._engineObjects[className];
|
|
23884
23905
|
};
|
|
23906
|
+
/**
|
|
23907
|
+
* Get the class name by class object.
|
|
23908
|
+
* @param obj - class object
|
|
23909
|
+
* @returns class name
|
|
23910
|
+
*/ Loader.getClassName = function getClassName(obj) {
|
|
23911
|
+
return this._classNameMap.get(obj);
|
|
23912
|
+
};
|
|
23885
23913
|
return Loader;
|
|
23886
23914
|
}();
|
|
23887
23915
|
(function() {
|
|
23888
23916
|
Loader._engineObjects = {};
|
|
23889
23917
|
})();
|
|
23918
|
+
(function() {
|
|
23919
|
+
Loader._classNameMap = new Map();
|
|
23920
|
+
})();
|
|
23890
23921
|
|
|
23891
23922
|
/**
|
|
23892
23923
|
* Alpha blend mode.
|
|
@@ -27656,7 +27687,7 @@ __decorate([
|
|
|
27656
27687
|
this._clip = clip;
|
|
27657
27688
|
this._clipEndTime = Math.min(this._clipEndTime, 1);
|
|
27658
27689
|
this._onClipChanged();
|
|
27659
|
-
clip._updateFlagManager.addListener(this._onClipChanged);
|
|
27690
|
+
clip && clip._updateFlagManager.addListener(this._onClipChanged);
|
|
27660
27691
|
}
|
|
27661
27692
|
},
|
|
27662
27693
|
{
|
|
@@ -28363,6 +28394,7 @@ __decorate([
|
|
|
28363
28394
|
ParticleRandomSubSeeds[ParticleRandomSubSeeds["RotationOverLifetime"] = 0x40eb95e4] = "RotationOverLifetime";
|
|
28364
28395
|
ParticleRandomSubSeeds[ParticleRandomSubSeeds["TextureSheetAnimation"] = 0xbc524e5] = "TextureSheetAnimation";
|
|
28365
28396
|
ParticleRandomSubSeeds[ParticleRandomSubSeeds["Shape"] = 0xaf502044] = "Shape";
|
|
28397
|
+
ParticleRandomSubSeeds[ParticleRandomSubSeeds["GravityModifier"] = 0xa47b8c4d] = "GravityModifier";
|
|
28366
28398
|
})(ParticleRandomSubSeeds || (ParticleRandomSubSeeds = {}));
|
|
28367
28399
|
|
|
28368
28400
|
/**
|
|
@@ -29076,6 +29108,7 @@ var MainModule = /*#__PURE__*/ function() {
|
|
|
29076
29108
|
/** @internal */ this._startColorRand = new engineMath.Rand(0, ParticleRandomSubSeeds.StartColor);
|
|
29077
29109
|
/** @internal */ this._startSizeRand = new engineMath.Rand(0, ParticleRandomSubSeeds.StartSize);
|
|
29078
29110
|
/** @internal */ this._startRotationRand = new engineMath.Rand(0, ParticleRandomSubSeeds.StartRotation);
|
|
29111
|
+
this._gravityModifierRand = new engineMath.Rand(0, ParticleRandomSubSeeds.GravityModifier);
|
|
29079
29112
|
this._gravity = new engineMath.Vector3();
|
|
29080
29113
|
this._generator = generator;
|
|
29081
29114
|
}
|
|
@@ -29136,7 +29169,7 @@ var MainModule = /*#__PURE__*/ function() {
|
|
|
29136
29169
|
break;
|
|
29137
29170
|
}
|
|
29138
29171
|
var particleGravity = this._gravity;
|
|
29139
|
-
var gravityModifierValue = this.gravityModifier.evaluate(undefined,
|
|
29172
|
+
var gravityModifierValue = this.gravityModifier.evaluate(undefined, this._gravityModifierRand.random());
|
|
29140
29173
|
engineMath.Vector3.scale(renderer.scene.physics.gravity, gravityModifierValue, particleGravity);
|
|
29141
29174
|
shaderData.setVector3(MainModule._gravity, particleGravity);
|
|
29142
29175
|
shaderData.setInt(MainModule._simulationSpace, this.simulationSpace);
|
|
@@ -29255,6 +29288,9 @@ __decorate([
|
|
|
29255
29288
|
__decorate([
|
|
29256
29289
|
ignoreClone
|
|
29257
29290
|
], MainModule.prototype, "_startRotationRand", void 0);
|
|
29291
|
+
__decorate([
|
|
29292
|
+
ignoreClone
|
|
29293
|
+
], MainModule.prototype, "_gravityModifierRand", void 0);
|
|
29258
29294
|
__decorate([
|
|
29259
29295
|
ignoreClone
|
|
29260
29296
|
], MainModule.prototype, "_generator", void 0);
|
|
@@ -30569,14 +30605,14 @@ __decorate([
|
|
|
30569
30605
|
|
|
30570
30606
|
/**
|
|
30571
30607
|
* The emission shape.
|
|
30572
|
-
*/
|
|
30608
|
+
*/ exports.ParticleShapeType = void 0;
|
|
30573
30609
|
(function(ParticleShapeType) {
|
|
30574
30610
|
ParticleShapeType[ParticleShapeType[/** Emit from the volume of a box. */ "Box"] = 0] = "Box";
|
|
30575
30611
|
ParticleShapeType[ParticleShapeType[/** Emit from a circle. */ "Circle"] = 1] = "Circle";
|
|
30576
30612
|
ParticleShapeType[ParticleShapeType[/** Emit from the base of a cone. */ "Cone"] = 2] = "Cone";
|
|
30577
30613
|
ParticleShapeType[ParticleShapeType[/** Emit from a half-sphere. */ "Hemisphere"] = 3] = "Hemisphere";
|
|
30578
30614
|
ParticleShapeType[ParticleShapeType[/** Emit from a sphere. */ "Sphere"] = 4] = "Sphere";
|
|
30579
|
-
})(ParticleShapeType || (ParticleShapeType = {}));
|
|
30615
|
+
})(exports.ParticleShapeType || (exports.ParticleShapeType = {}));
|
|
30580
30616
|
|
|
30581
30617
|
/**
|
|
30582
30618
|
* Particle shape that emits particles from a box.
|
|
@@ -30584,9 +30620,9 @@ __decorate([
|
|
|
30584
30620
|
_inherits(BoxShape, BaseShape1);
|
|
30585
30621
|
function BoxShape() {
|
|
30586
30622
|
var _this;
|
|
30587
|
-
_this = BaseShape1.
|
|
30623
|
+
_this = BaseShape1.apply(this, arguments) || this;
|
|
30624
|
+
_this.shapeType = exports.ParticleShapeType.Box;
|
|
30588
30625
|
/** The size of the box. */ _this.size = new engineMath.Vector3(1, 1, 1);
|
|
30589
|
-
_this.shapeType = ParticleShapeType.Box;
|
|
30590
30626
|
return _this;
|
|
30591
30627
|
}
|
|
30592
30628
|
var _proto = BoxShape.prototype;
|
|
@@ -30623,12 +30659,12 @@ __decorate([
|
|
|
30623
30659
|
_inherits(CircleShape, BaseShape1);
|
|
30624
30660
|
function CircleShape() {
|
|
30625
30661
|
var _this;
|
|
30626
|
-
_this = BaseShape1.
|
|
30662
|
+
_this = BaseShape1.apply(this, arguments) || this;
|
|
30663
|
+
_this.shapeType = exports.ParticleShapeType.Circle;
|
|
30627
30664
|
/** Radius of the shape to emit particles from. */ _this.radius = 1.0;
|
|
30628
30665
|
/** Angle of the circle arc to emit particles from. */ _this.arc = 360.0;
|
|
30629
30666
|
/** The mode to generate particles around the arc. */ _this.arcMode = exports.ParticleShapeArcMode.Random;
|
|
30630
30667
|
/** The speed of complete 360 degree rotation. */ _this.arcSpeed = 1.0;
|
|
30631
|
-
_this.shapeType = ParticleShapeType.Circle;
|
|
30632
30668
|
return _this;
|
|
30633
30669
|
}
|
|
30634
30670
|
var _proto = CircleShape.prototype;
|
|
@@ -30664,12 +30700,12 @@ __decorate([
|
|
|
30664
30700
|
_inherits(ConeShape, BaseShape1);
|
|
30665
30701
|
function ConeShape() {
|
|
30666
30702
|
var _this;
|
|
30667
|
-
_this = BaseShape1.
|
|
30703
|
+
_this = BaseShape1.apply(this, arguments) || this;
|
|
30704
|
+
_this.shapeType = exports.ParticleShapeType.Cone;
|
|
30668
30705
|
/** Angle of the cone to emit particles from. */ _this.angle = 25.0;
|
|
30669
30706
|
/** Radius of the shape to emit particles from. */ _this.radius = 1.0;
|
|
30670
30707
|
/** Length of the cone to emit particles from. */ _this.length = 5.0;
|
|
30671
30708
|
/** Cone emitter type. */ _this.emitType = /** Emit particles from the base of the cone. */ 0;
|
|
30672
|
-
_this.shapeType = ParticleShapeType.Cone;
|
|
30673
30709
|
return _this;
|
|
30674
30710
|
}
|
|
30675
30711
|
var _proto = ConeShape.prototype;
|
|
@@ -30729,9 +30765,9 @@ exports.ConeEmitType = void 0;
|
|
|
30729
30765
|
_inherits(HemisphereShape, BaseShape1);
|
|
30730
30766
|
function HemisphereShape() {
|
|
30731
30767
|
var _this;
|
|
30732
|
-
_this = BaseShape1.
|
|
30768
|
+
_this = BaseShape1.apply(this, arguments) || this;
|
|
30769
|
+
_this.shapeType = exports.ParticleShapeType.Hemisphere;
|
|
30733
30770
|
/** Radius of the shape to emit particles from. */ _this.radius = 1.0;
|
|
30734
|
-
_this.shapeType = ParticleShapeType.Hemisphere;
|
|
30735
30771
|
return _this;
|
|
30736
30772
|
}
|
|
30737
30773
|
var _proto = HemisphereShape.prototype;
|
|
@@ -30754,9 +30790,9 @@ exports.ConeEmitType = void 0;
|
|
|
30754
30790
|
_inherits(SphereShape, BaseShape1);
|
|
30755
30791
|
function SphereShape() {
|
|
30756
30792
|
var _this;
|
|
30757
|
-
_this = BaseShape1.
|
|
30793
|
+
_this = BaseShape1.apply(this, arguments) || this;
|
|
30794
|
+
_this.shapeType = exports.ParticleShapeType.Sphere;
|
|
30758
30795
|
/** Radius of the shape to emit particles from. */ _this.radius = 1.0;
|
|
30759
|
-
_this.shapeType = ParticleShapeType.Sphere;
|
|
30760
30796
|
return _this;
|
|
30761
30797
|
}
|
|
30762
30798
|
var _proto = SphereShape.prototype;
|