@galacean/engine-core 1.3.15 → 1.3.17
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 +74 -57
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +74 -57
- package/dist/module.js +74 -57
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/asset/AssetType.d.ts +2 -0
- package/types/asset/Loader.d.ts +1 -1
- package/types/particle/modules/MainModule.d.ts +1 -2
package/dist/miniprogram.js
CHANGED
|
@@ -639,6 +639,11 @@ var Utils = /*#__PURE__*/ function() {
|
|
|
639
639
|
if (Utils.isBase64Url(relativeUrl)) {
|
|
640
640
|
return relativeUrl;
|
|
641
641
|
}
|
|
642
|
+
if (!/^https?:/.test(baseUrl)) {
|
|
643
|
+
var fileSchema = "files://";
|
|
644
|
+
baseUrl = fileSchema + baseUrl;
|
|
645
|
+
return new engineMiniprogramAdapter.URL(relativeUrl, baseUrl).href.substring(fileSchema.length);
|
|
646
|
+
}
|
|
642
647
|
return relativeUrl ? new engineMiniprogramAdapter.URL(relativeUrl, baseUrl).href : baseUrl;
|
|
643
648
|
};
|
|
644
649
|
/**
|
|
@@ -2253,7 +2258,7 @@ var size_over_lifetime_module = "#define GLSLIFY 1\n#ifdef RENDERER_SOL_CURVE_MO
|
|
|
2253
2258
|
|
|
2254
2259
|
var color_over_lifetime_module = "#define GLSLIFY 1\n#if defined(RENDERER_COL_GRADIENT) || defined(RENDERER_COL_RANDOM_GRADIENTS)\nuniform vec4 renderer_COLMaxGradientColor[4];uniform vec2 renderer_COLMaxGradientAlpha[4];\n#ifdef RENDERER_COL_RANDOM_GRADIENTS\nuniform vec4 renderer_COLMinGradientColor[4];uniform vec2 renderer_COLMinGradientAlpha[4];\n#endif\nuniform vec4 renderer_COLGradientKeysMaxTime;\n#endif\n#if defined(RENDERER_COL_GRADIENT) || defined(RENDERER_COL_RANDOM_GRADIENTS)\nvec4 evaluateParticleGradient(in vec4 colorKeys[4],in float colorKeysMaxTime,in vec2 alphaKeys[4],in float alphaKeysMaxTime,in float normalizedAge){vec4 value;float alphaAge=min(normalizedAge,alphaKeysMaxTime);for(int i=0;i<4;i++){vec2 key=alphaKeys[i];float time=key.x;if(alphaAge<=time){if(i==0){value.a=alphaKeys[0].y;}else{vec2 lastKey=alphaKeys[i-1];float lastTime=lastKey.x;float age=(alphaAge-lastTime)/(time-lastTime);value.a=mix(lastKey.y,key.y,age);}break;}}float colorAge=min(normalizedAge,colorKeysMaxTime);for(int i=0;i<4;i++){vec4 key=colorKeys[i];float time=key.x;if(colorAge<=time){if(i==0){value.rgb=colorKeys[0].yzw;}else{vec4 lastKey=colorKeys[i-1];float lastTime=lastKey.x;float age=(colorAge-lastTime)/(time-lastTime);value.rgb=mix(lastKey.yzw,key.yzw,age);}break;}}return value;}\n#endif\nvec4 computeParticleColor(in vec4 color,in float normalizedAge){\n#if defined(RENDERER_COL_GRADIENT) || defined(RENDERER_COL_RANDOM_GRADIENTS)\nvec4 gradientColor=evaluateParticleGradient(renderer_COLMaxGradientColor,renderer_COLGradientKeysMaxTime.z,renderer_COLMaxGradientAlpha,renderer_COLGradientKeysMaxTime.w,normalizedAge);\n#endif\n#ifdef RENDERER_COL_RANDOM_GRADIENTS\ngradientColor=mix(evaluateParticleGradient(renderer_COLMinGradientColor,renderer_COLGradientKeysMaxTime.x,renderer_COLMinGradientAlpha,renderer_COLGradientKeysMaxTime.y,normalizedAge),gradientColor,a_Random0.y);\n#endif\n#if defined(RENDERER_COL_GRADIENT) || defined(RENDERER_COL_RANDOM_GRADIENTS)\ncolor*=gradientColor;\n#endif\nreturn color;}"; // eslint-disable-line
|
|
2255
2260
|
|
|
2256
|
-
var texture_sheet_animation_module = "#define GLSLIFY 1\n#if defined(RENDERER_TSA_FRAME_CURVE) || defined(RENDERER_TSA_FRAME_RANDOM_CURVES)\nuniform float renderer_TSACycles;uniform vec3 renderer_TSATillingParams;uniform vec2 renderer_TSAFrameMaxCurve[4];\n#ifdef RENDERER_TSA_FRAME_RANDOM_CURVES\nuniform vec2 renderer_TSAFrameMinCurve[4];\n#endif\n#endif\nvec2 computeParticleUV(in vec2 uv,in float normalizedAge){\n#if defined(RENDERER_TSA_FRAME_CURVE) || defined(RENDERER_TSA_FRAME_RANDOM_CURVES)\nfloat scaledNormalizedAge=normalizedAge*renderer_TSACycles;float cycleNormalizedAge=scaledNormalizedAge-floor(scaledNormalizedAge);float normalizedFrame=evaluateParticleCurve(renderer_TSAFrameMaxCurve,cycleNormalizedAge);\n#ifdef RENDERER_TSA_FRAME_RANDOM_CURVES\nnormalizedFrame=mix(evaluateParticleCurve(renderer_TSAFrameMinCurve,cycleNormalizedAge),normalizedFrame,a_Random1.x);\n#endif\nfloat frame=floor(normalizedFrame*renderer_TSATillingParams.z);float tileRow=frame*renderer_TSATillingParams.x;float
|
|
2261
|
+
var texture_sheet_animation_module = "#define GLSLIFY 1\n#if defined(RENDERER_TSA_FRAME_CURVE) || defined(RENDERER_TSA_FRAME_RANDOM_CURVES)\nuniform float renderer_TSACycles;uniform vec3 renderer_TSATillingParams;uniform vec2 renderer_TSAFrameMaxCurve[4];\n#ifdef RENDERER_TSA_FRAME_RANDOM_CURVES\nuniform vec2 renderer_TSAFrameMinCurve[4];\n#endif\n#endif\nvec2 computeParticleUV(in vec2 uv,in float normalizedAge){\n#if defined(RENDERER_TSA_FRAME_CURVE) || defined(RENDERER_TSA_FRAME_RANDOM_CURVES)\nfloat scaledNormalizedAge=normalizedAge*renderer_TSACycles;float cycleNormalizedAge=scaledNormalizedAge-floor(scaledNormalizedAge);float normalizedFrame=evaluateParticleCurve(renderer_TSAFrameMaxCurve,cycleNormalizedAge);\n#ifdef RENDERER_TSA_FRAME_RANDOM_CURVES\nnormalizedFrame=mix(evaluateParticleCurve(renderer_TSAFrameMinCurve,cycleNormalizedAge),normalizedFrame,a_Random1.x);\n#endif\nfloat frame=floor(normalizedFrame*renderer_TSATillingParams.z);float tileRow=frame*renderer_TSATillingParams.x;float tileRowIndex=floor(tileRow);uv.x+=tileRow-tileRowIndex;uv.y+=tileRowIndex*renderer_TSATillingParams.y;\n#endif\nreturn uv;}"; // eslint-disable-line
|
|
2257
2262
|
|
|
2258
2263
|
var sphere_billboard = "#define GLSLIFY 1\n#ifdef RENDERER_MODE_SPHERE_BILLBOARD\nvec2 corner=a_CornerTextureCoordinate.xy+renderer_PivotOffset.xy;vec3 sideVector=normalize(cross(camera_Forward,camera_Up));vec3 upVector=normalize(cross(sideVector,camera_Forward));corner*=computeParticleSizeBillboard(a_StartSize.xy,normalizedAge);\n#if defined(RENDERER_ROL_CONSTANT_MODE) || defined(RENDERER_ROL_CURVE_MODE)\nif(renderer_ThreeDStartRotation){vec3 rotation=vec3(a_StartRotation0.xy,computeParticleRotationFloat(a_StartRotation0.z,age,normalizedAge));center+=renderer_SizeScale.xzy*rotationByEuler(corner.x*sideVector+corner.y*upVector,rotation);}else{float rot=computeParticleRotationFloat(a_StartRotation0.x,age,normalizedAge);float c=cos(rot);float s=sin(rot);mat2 rotation=mat2(c,-s,s,c);corner=rotation*corner;center+=renderer_SizeScale.xzy*(corner.x*sideVector+corner.y*upVector);}\n#else\nif(renderer_ThreeDStartRotation){center+=renderer_SizeScale.xzy*rotationByEuler(corner.x*sideVector+corner.y*upVector,a_StartRotation0);}else{float c=cos(a_StartRotation0.x);float s=sin(a_StartRotation0.x);mat2 rotation=mat2(c,-s,s,c);corner=rotation*corner;center+=renderer_SizeScale.xzy*(corner.x*sideVector+corner.y*upVector);}\n#endif\n#endif\n"; // eslint-disable-line
|
|
2259
2264
|
|
|
@@ -10333,7 +10338,7 @@ var /**
|
|
|
10333
10338
|
if (background.mode === exports.BackgroundMode.Sky) {
|
|
10334
10339
|
background.sky._render(context);
|
|
10335
10340
|
} else if (background.mode === exports.BackgroundMode.Texture && background.texture) {
|
|
10336
|
-
this._drawBackgroundTexture(
|
|
10341
|
+
this._drawBackgroundTexture(camera, background);
|
|
10337
10342
|
}
|
|
10338
10343
|
}
|
|
10339
10344
|
// Copy opaque texture
|
|
@@ -10429,7 +10434,8 @@ var /**
|
|
|
10429
10434
|
renderElement.renderQueueFlags |= flag;
|
|
10430
10435
|
}
|
|
10431
10436
|
};
|
|
10432
|
-
_proto._drawBackgroundTexture = function _drawBackgroundTexture(
|
|
10437
|
+
_proto._drawBackgroundTexture = function _drawBackgroundTexture(camera, background) {
|
|
10438
|
+
var engine = camera.engine;
|
|
10433
10439
|
var rhi = engine._hardwareRenderer;
|
|
10434
10440
|
var canvas = engine.canvas;
|
|
10435
10441
|
var material = background._material, mesh = background._mesh;
|
|
@@ -10441,6 +10447,7 @@ var /**
|
|
|
10441
10447
|
var program = pass._getShaderProgram(engine, Shader._compileMacros);
|
|
10442
10448
|
program.bind();
|
|
10443
10449
|
program.uploadAll(program.materialUniformBlock, material.shaderData);
|
|
10450
|
+
program.uploadAll(program.cameraUniformBlock, camera.shaderData);
|
|
10444
10451
|
program.uploadUnGroupTextures();
|
|
10445
10452
|
(pass._renderState || material.renderState)._applyStates(engine, false, pass._renderStateDataMap, material.shaderData);
|
|
10446
10453
|
rhi.drawPrimitive(mesh._primitive, mesh.subMesh, program);
|
|
@@ -19061,6 +19068,7 @@ var ObjectPool = /*#__PURE__*/ function() {
|
|
|
19061
19068
|
AssetType[/** 2D Texture. */ "Texture2D"] = "Texture2D";
|
|
19062
19069
|
AssetType[/** Cube Texture. */ "TextureCube"] = "TextureCube";
|
|
19063
19070
|
AssetType[/** Material. */ "Material"] = "Material";
|
|
19071
|
+
AssetType[/** Shader. */ "Shader"] = "Shader";
|
|
19064
19072
|
AssetType[/** Mesh. */ "Mesh"] = "Mesh";
|
|
19065
19073
|
AssetType[/** AnimationClip. */ "AnimationClip"] = "AnimationClip";
|
|
19066
19074
|
AssetType[/** AnimatorController. */ "AnimatorController"] = "AnimatorController";
|
|
@@ -19553,14 +19561,16 @@ var /** @internal */ PromiseState;
|
|
|
19553
19561
|
/**
|
|
19554
19562
|
* @internal
|
|
19555
19563
|
*/ _proto._onSubAssetSuccess = function _onSubAssetSuccess(assetBaseURL, assetSubPath, value) {
|
|
19556
|
-
var
|
|
19557
|
-
var
|
|
19564
|
+
var _this__subAssetPromiseCallbacks_remoteAssetBaseURL;
|
|
19565
|
+
var _this__virtualPathMap_assetBaseURL;
|
|
19566
|
+
var remoteAssetBaseURL = (_this__virtualPathMap_assetBaseURL = this._virtualPathMap[assetBaseURL]) != null ? _this__virtualPathMap_assetBaseURL : assetBaseURL;
|
|
19567
|
+
var subPromiseCallback = (_this__subAssetPromiseCallbacks_remoteAssetBaseURL = this._subAssetPromiseCallbacks[remoteAssetBaseURL]) == null ? void 0 : _this__subAssetPromiseCallbacks_remoteAssetBaseURL[assetSubPath];
|
|
19558
19568
|
if (subPromiseCallback) {
|
|
19559
19569
|
subPromiseCallback.resolve(value);
|
|
19560
19570
|
} else {
|
|
19561
19571
|
var // Pending
|
|
19562
|
-
_this__subAssetPromiseCallbacks,
|
|
19563
|
-
((_this__subAssetPromiseCallbacks = this._subAssetPromiseCallbacks)[
|
|
19572
|
+
_this__subAssetPromiseCallbacks, _remoteAssetBaseURL;
|
|
19573
|
+
((_this__subAssetPromiseCallbacks = this._subAssetPromiseCallbacks)[_remoteAssetBaseURL = remoteAssetBaseURL] || (_this__subAssetPromiseCallbacks[_remoteAssetBaseURL] = {}))[assetSubPath] = {
|
|
19564
19574
|
resolvedValue: value
|
|
19565
19575
|
};
|
|
19566
19576
|
}
|
|
@@ -19682,33 +19692,34 @@ var /** @internal */ PromiseState;
|
|
|
19682
19692
|
var item = this._assignDefaultOptions(typeof itemOrURL === "string" ? {
|
|
19683
19693
|
url: itemOrURL
|
|
19684
19694
|
} : itemOrURL);
|
|
19685
|
-
|
|
19686
|
-
var itemURL = item.url;
|
|
19687
|
-
var url = this._virtualPathMap[itemURL] ? this._virtualPathMap[itemURL] : itemURL;
|
|
19695
|
+
var url = item.url;
|
|
19688
19696
|
// Not absolute and base url is set
|
|
19689
19697
|
if (!Utils.isAbsoluteUrl(url) && this.baseUrl) url = Utils.resolveAbsoluteUrl(this.baseUrl, url);
|
|
19690
19698
|
// Parse url
|
|
19691
19699
|
var _this__parseURL = this._parseURL(url), assetBaseURL = _this__parseURL.assetBaseURL, queryPath = _this__parseURL.queryPath;
|
|
19692
19700
|
var paths = queryPath ? this._parseQueryPath(queryPath) : [];
|
|
19701
|
+
var _this__virtualPathMap_assetBaseURL;
|
|
19702
|
+
// Get remote asset base url
|
|
19703
|
+
var remoteAssetBaseURL = (_this__virtualPathMap_assetBaseURL = this._virtualPathMap[assetBaseURL]) != null ? _this__virtualPathMap_assetBaseURL : assetBaseURL;
|
|
19693
19704
|
// Check cache
|
|
19694
|
-
var cacheObject = this._assetUrlPool[
|
|
19705
|
+
var cacheObject = this._assetUrlPool[remoteAssetBaseURL];
|
|
19695
19706
|
if (cacheObject) {
|
|
19696
19707
|
return new AssetPromise(function(resolve) {
|
|
19697
19708
|
resolve(_this._getResolveResource(cacheObject, paths));
|
|
19698
19709
|
});
|
|
19699
19710
|
}
|
|
19700
19711
|
// Get asset url
|
|
19701
|
-
var
|
|
19712
|
+
var remoteAssetURL = remoteAssetBaseURL;
|
|
19702
19713
|
if (queryPath) {
|
|
19703
|
-
|
|
19714
|
+
remoteAssetURL += "?q=" + paths.shift();
|
|
19704
19715
|
var index;
|
|
19705
19716
|
while(index = paths.shift()){
|
|
19706
|
-
|
|
19717
|
+
remoteAssetURL += "[" + index + "]";
|
|
19707
19718
|
}
|
|
19708
19719
|
}
|
|
19709
19720
|
// Check is loading
|
|
19710
19721
|
var loadingPromises = this._loadingPromises;
|
|
19711
|
-
var loadingPromise = loadingPromises[
|
|
19722
|
+
var loadingPromise = loadingPromises[remoteAssetURL];
|
|
19712
19723
|
if (loadingPromise) {
|
|
19713
19724
|
return new AssetPromise(function(resolve, reject, setTaskCompleteProgress, setTaskDetailProgress) {
|
|
19714
19725
|
loadingPromise.onProgress(setTaskCompleteProgress, setTaskDetailProgress).then(function(resource) {
|
|
@@ -19726,37 +19737,37 @@ var /** @internal */ PromiseState;
|
|
|
19726
19737
|
// Check sub asset
|
|
19727
19738
|
if (queryPath) {
|
|
19728
19739
|
// Check whether load main asset
|
|
19729
|
-
var mainPromise = loadingPromises[
|
|
19740
|
+
var mainPromise = loadingPromises[remoteAssetBaseURL] || this._loadMainAsset(loader, item, remoteAssetBaseURL, assetBaseURL);
|
|
19730
19741
|
mainPromise.catch(function(e) {
|
|
19731
|
-
_this._onSubAssetFail(
|
|
19742
|
+
_this._onSubAssetFail(remoteAssetBaseURL, queryPath, e);
|
|
19732
19743
|
});
|
|
19733
|
-
return this._createSubAssetPromiseCallback(
|
|
19744
|
+
return this._createSubAssetPromiseCallback(remoteAssetBaseURL, remoteAssetURL, queryPath);
|
|
19734
19745
|
}
|
|
19735
|
-
return this._loadMainAsset(loader, item, assetBaseURL);
|
|
19746
|
+
return this._loadMainAsset(loader, item, remoteAssetBaseURL, assetBaseURL);
|
|
19736
19747
|
};
|
|
19737
|
-
_proto._loadMainAsset = function _loadMainAsset(loader, item, assetBaseURL) {
|
|
19748
|
+
_proto._loadMainAsset = function _loadMainAsset(loader, item, remoteAssetBaseURL, assetBaseURL) {
|
|
19738
19749
|
var _this = this;
|
|
19739
19750
|
item.url = assetBaseURL;
|
|
19740
19751
|
var loadingPromises = this._loadingPromises;
|
|
19741
19752
|
var promise = loader.load(item, this);
|
|
19742
|
-
loadingPromises[
|
|
19753
|
+
loadingPromises[remoteAssetBaseURL] = promise;
|
|
19743
19754
|
promise.then(function(resource) {
|
|
19744
19755
|
if (loader.useCache) {
|
|
19745
|
-
_this._addAsset(
|
|
19756
|
+
_this._addAsset(remoteAssetBaseURL, resource);
|
|
19746
19757
|
}
|
|
19747
|
-
delete loadingPromises[
|
|
19748
|
-
_this._releaseSubAssetPromiseCallback(
|
|
19758
|
+
delete loadingPromises[remoteAssetBaseURL];
|
|
19759
|
+
_this._releaseSubAssetPromiseCallback(remoteAssetBaseURL);
|
|
19749
19760
|
}, function() {
|
|
19750
|
-
delete loadingPromises[
|
|
19751
|
-
_this._releaseSubAssetPromiseCallback(
|
|
19761
|
+
delete loadingPromises[remoteAssetBaseURL];
|
|
19762
|
+
_this._releaseSubAssetPromiseCallback(remoteAssetBaseURL);
|
|
19752
19763
|
});
|
|
19753
19764
|
return promise;
|
|
19754
19765
|
};
|
|
19755
|
-
_proto._createSubAssetPromiseCallback = function _createSubAssetPromiseCallback(
|
|
19766
|
+
_proto._createSubAssetPromiseCallback = function _createSubAssetPromiseCallback(remoteAssetBaseURL, remoteAssetURL, assetSubPath) {
|
|
19756
19767
|
var _this = this;
|
|
19757
|
-
var
|
|
19768
|
+
var _this__subAssetPromiseCallbacks_remoteAssetBaseURL, _subPromiseCallback, _subPromiseCallback1;
|
|
19758
19769
|
var loadingPromises = this._loadingPromises;
|
|
19759
|
-
var subPromiseCallback = (
|
|
19770
|
+
var subPromiseCallback = (_this__subAssetPromiseCallbacks_remoteAssetBaseURL = this._subAssetPromiseCallbacks[remoteAssetBaseURL]) == null ? void 0 : _this__subAssetPromiseCallbacks_remoteAssetBaseURL[assetSubPath];
|
|
19760
19771
|
var resolvedValue = (_subPromiseCallback = subPromiseCallback) == null ? void 0 : _subPromiseCallback.resolvedValue;
|
|
19761
19772
|
var rejectedValue = (_subPromiseCallback1 = subPromiseCallback) == null ? void 0 : _subPromiseCallback1.rejectedValue;
|
|
19762
19773
|
// Already resolved or rejected
|
|
@@ -19771,17 +19782,17 @@ var /** @internal */ PromiseState;
|
|
|
19771
19782
|
}
|
|
19772
19783
|
// Pending
|
|
19773
19784
|
var promise = new AssetPromise(function(resolve, reject) {
|
|
19774
|
-
var _this__subAssetPromiseCallbacks,
|
|
19775
|
-
((_this__subAssetPromiseCallbacks = _this._subAssetPromiseCallbacks)[
|
|
19785
|
+
var _this__subAssetPromiseCallbacks, _remoteAssetBaseURL;
|
|
19786
|
+
((_this__subAssetPromiseCallbacks = _this._subAssetPromiseCallbacks)[_remoteAssetBaseURL = remoteAssetBaseURL] || (_this__subAssetPromiseCallbacks[_remoteAssetBaseURL] = {}))[assetSubPath] = {
|
|
19776
19787
|
resolve: resolve,
|
|
19777
19788
|
reject: reject
|
|
19778
19789
|
};
|
|
19779
19790
|
});
|
|
19780
|
-
loadingPromises[
|
|
19791
|
+
loadingPromises[remoteAssetURL] = promise;
|
|
19781
19792
|
promise.then(function() {
|
|
19782
|
-
delete loadingPromises[
|
|
19793
|
+
delete loadingPromises[remoteAssetURL];
|
|
19783
19794
|
}, function() {
|
|
19784
|
-
return delete loadingPromises[
|
|
19795
|
+
return delete loadingPromises[remoteAssetURL];
|
|
19785
19796
|
});
|
|
19786
19797
|
return promise;
|
|
19787
19798
|
};
|
|
@@ -19854,16 +19865,20 @@ var /** @internal */ PromiseState;
|
|
|
19854
19865
|
if (obj) {
|
|
19855
19866
|
promise = Promise.resolve(obj);
|
|
19856
19867
|
} else {
|
|
19857
|
-
var
|
|
19858
|
-
|
|
19859
|
-
if (!url) {
|
|
19868
|
+
var resourceConfig = this._editorResourceConfig[refId];
|
|
19869
|
+
if (!resourceConfig) {
|
|
19860
19870
|
Logger.warn("refId:" + refId + " is not find in this._editorResourceConfig.");
|
|
19861
19871
|
return Promise.resolve(null);
|
|
19862
19872
|
}
|
|
19863
|
-
|
|
19873
|
+
var remoteUrl = resourceConfig.path;
|
|
19874
|
+
var queryPath = new engineMiniprogramAdapter.URL(remoteUrl).search;
|
|
19875
|
+
var url = resourceConfig.virtualPath + queryPath;
|
|
19876
|
+
if (key) {
|
|
19877
|
+
url += (url.indexOf("?") > -1 ? "&" : "?") + "q=" + key;
|
|
19878
|
+
}
|
|
19864
19879
|
promise = this.load({
|
|
19865
19880
|
url: url,
|
|
19866
|
-
type:
|
|
19881
|
+
type: resourceConfig.type
|
|
19867
19882
|
});
|
|
19868
19883
|
}
|
|
19869
19884
|
return promise.then(function(item) {
|
|
@@ -23079,7 +23094,7 @@ var skyProceduralVs = "#define GLSLIFY 1\n#define OUTER_RADIUS 1.025\n#define RA
|
|
|
23079
23094
|
|
|
23080
23095
|
var backgroundTextureFs = "#define GLSLIFY 1\nuniform sampler2D material_BaseTexture;varying vec2 v_uv;void main(){gl_FragColor=texture2D(material_BaseTexture,v_uv);}"; // eslint-disable-line
|
|
23081
23096
|
|
|
23082
|
-
var backgroundTextureVs = "#define GLSLIFY 1\nattribute vec3 POSITION;attribute vec2 TEXCOORD_0;varying vec2 v_uv;void main(){gl_Position=vec4(POSITION,1.0);v_uv=TEXCOORD_0;}"; // eslint-disable-line
|
|
23097
|
+
var backgroundTextureVs = "#define GLSLIFY 1\nattribute vec3 POSITION;attribute vec2 TEXCOORD_0;varying vec2 v_uv;uniform vec4 camera_ProjectionParams;void main(){gl_Position=vec4(POSITION,1.0);gl_Position.y*=camera_ProjectionParams.x;v_uv=TEXCOORD_0;}"; // eslint-disable-line
|
|
23083
23098
|
|
|
23084
23099
|
var blinnPhongFs = "#define GLSLIFY 1\n#include <common>\n#include <camera_declare>\n#include <uv_share>\n#include <normal_share>\n#include <color_share>\n#include <worldpos_share>\n#include <light_frag_define>\n#include <ShadowFragmentDeclaration>\n#include <mobile_material_frag>\n#include <FogFragmentDeclaration>\n#include <normal_get>\nvoid main(){\n#include <begin_mobile_frag>\n#include <begin_viewdir_frag>\n#include <mobile_blinnphong_frag>\ngl_FragColor=emission+ambient+diffuse+specular;\n#ifdef MATERIAL_IS_TRANSPARENT\ngl_FragColor.a=diffuse.a;\n#else\ngl_FragColor.a=1.0;\n#endif\n#include <FogFragment>\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ngl_FragColor=linearToGamma(gl_FragColor);\n#endif\n}"; // eslint-disable-line
|
|
23085
23100
|
|
|
@@ -23091,7 +23106,7 @@ var depthOnlyVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\
|
|
|
23091
23106
|
|
|
23092
23107
|
var particleFs = "#define GLSLIFY 1\n#include <common>\nvarying vec4 v_Color;varying vec2 v_TextureCoordinate;uniform sampler2D material_BaseTexture;uniform vec4 material_BaseColor;\n#ifdef RENDERER_MODE_MESH\nvarying vec4 v_MeshColor;\n#endif\nvoid main(){vec4 color=material_BaseColor*v_Color;\n#ifdef RENDERER_MODE_MESH\ncolor*=v_MeshColor;\n#endif\n#ifdef MATERIAL_HAS_BASETEXTURE\nvec4 textureColor=texture2D(material_BaseTexture,v_TextureCoordinate);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ntextureColor=gammaToLinear(textureColor);\n#endif\ncolor*=textureColor;\n#endif\ngl_FragColor=color;\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ngl_FragColor=linearToGamma(gl_FragColor);\n#endif\n}"; // eslint-disable-line
|
|
23093
23108
|
|
|
23094
|
-
var particleVs = "#define GLSLIFY 1\n#if defined(RENDERER_MODE_SPHERE_BILLBOARD) || defined(RENDERER_MODE_STRETCHED_BILLBOARD) || defined(RENDERER_MODE_HORIZONTAL_BILLBOARD) || defined(RENDERER_MODE_VERTICAL_BILLBOARD)\nattribute vec4 a_CornerTextureCoordinate;\n#endif\n#ifdef RENDERER_MODE_MESH\nattribute vec3 a_MeshPosition;attribute vec4 a_MeshColor;attribute vec2 a_MeshTextureCoordinate;varying vec4 v_MeshColor;\n#endif\nattribute vec4 a_ShapePositionStartLifeTime;attribute vec4 a_DirectionTime;attribute vec4 a_StartColor;attribute vec3 a_StartSize;attribute vec3 a_StartRotation0;attribute float a_StartSpeed;attribute vec4 a_Random0;\n#if defined(RENDERER_TSA_FRAME_RANDOM_CURVES) || defined(RENDERER_VOL_RANDOM_CONSTANT) || defined(RENDERER_VOL_RANDOM_CURVE)\nattribute vec4 a_Random1;\n#endif\nattribute vec3 a_SimulationWorldPosition;attribute vec4 a_SimulationWorldRotation;varying vec4 v_Color;\n#ifdef MATERIAL_HAS_BASETEXTURE\nattribute vec4 a_SimulationUV;varying vec2 v_TextureCoordinate;\n#endif\nuniform float renderer_CurrentTime;uniform vec3 renderer_Gravity;uniform vec2 u_DragConstant;uniform vec3 renderer_WorldPosition;uniform vec4 renderer_WorldRotation;uniform bool renderer_ThreeDStartRotation;uniform int renderer_ScalingMode;uniform vec3 renderer_PositionScale;uniform vec3 renderer_SizeScale;uniform vec3 renderer_PivotOffset;uniform mat4 camera_ViewMat;uniform mat4 camera_ProjMat;\n#ifdef RENDERER_MODE_STRETCHED_BILLBOARD\nuniform vec3 camera_Position;\n#endif\nuniform vec3 camera_Forward;uniform vec3 camera_Up;uniform float renderer_StretchedBillboardLengthScale;uniform float renderer_StretchedBillboardSpeedScale;uniform int renderer_SimulationSpace;\n#include <particle_common>\n#include <velocity_over_lifetime_module>\n#include <color_over_lifetime_module>\n#include <size_over_lifetime_module>\n#include <rotation_over_lifetime_module>\n#include <texture_sheet_animation_module>\nvoid main(){float age=renderer_CurrentTime-a_DirectionTime.w;float normalizedAge=age/a_ShapePositionStartLifeTime.w;vec3 lifeVelocity;if(normalizedAge<1.0){vec3 startVelocity=a_DirectionTime.xyz*a_StartSpeed;\n#if defined(RENDERER_VOL_CONSTANT) || defined(RENDERER_VOL_CURVE) || defined(RENDERER_VOL_RANDOM_CONSTANT) || defined(RENDERER_VOL_RANDOM_CURVE)\nlifeVelocity=computeParticleLifeVelocity(normalizedAge);\n#endif\nvec3 gravityVelocity=renderer_Gravity*age;vec4 worldRotation;if(renderer_SimulationSpace==0){worldRotation=renderer_WorldRotation;}else{worldRotation=a_SimulationWorldRotation;}vec3 dragData=a_DirectionTime.xyz*mix(u_DragConstant.x,u_DragConstant.y,a_Random0.x);vec3 center=computeParticlePosition(startVelocity,lifeVelocity,age,normalizedAge,gravityVelocity,worldRotation,dragData);\n#include <sphere_billboard>\n#include <stretched_billboard>\n#include <horizontal_billboard>\n#include <vertical_billboard>\n#include <particle_mesh>\ngl_Position=camera_ProjMat*camera_ViewMat*vec4(center,1.0);v_Color=computeParticleColor(a_StartColor,normalizedAge);\n#ifdef MATERIAL_HAS_BASETEXTURE\nvec2 simulateUV;\n#if defined(RENDERER_MODE_SPHERE_BILLBOARD) || defined(RENDERER_MODE_STRETCHED_BILLBOARD) || defined(RENDERER_MODE_HORIZONTAL_BILLBOARD) || defined(RENDERER_MODE_VERTICAL_BILLBOARD)\nsimulateUV=a_CornerTextureCoordinate.zw*a_SimulationUV.xy+a_SimulationUV.zw;v_TextureCoordinate=computeParticleUV(simulateUV,normalizedAge);\n#endif\n#ifdef RENDERER_MODE_MESH\nsimulateUV=a_SimulationUV.xy+a_MeshTextureCoordinate*a_SimulationUV.zw;v_TextureCoordinate=computeParticleUV(simulateUV,normalizedAge);\n#endif\n#endif\n}else{gl_Position=vec4(2.0,2.0,2.0,1.0);}}"; // eslint-disable-line
|
|
23109
|
+
var particleVs = "#define GLSLIFY 1\n#if defined(RENDERER_MODE_SPHERE_BILLBOARD) || defined(RENDERER_MODE_STRETCHED_BILLBOARD) || defined(RENDERER_MODE_HORIZONTAL_BILLBOARD) || defined(RENDERER_MODE_VERTICAL_BILLBOARD)\nattribute vec4 a_CornerTextureCoordinate;\n#endif\n#ifdef RENDERER_MODE_MESH\nattribute vec3 a_MeshPosition;attribute vec4 a_MeshColor;attribute vec2 a_MeshTextureCoordinate;varying vec4 v_MeshColor;\n#endif\nattribute vec4 a_ShapePositionStartLifeTime;attribute vec4 a_DirectionTime;attribute vec4 a_StartColor;attribute vec3 a_StartSize;attribute vec3 a_StartRotation0;attribute float a_StartSpeed;attribute vec4 a_Random0;\n#if defined(RENDERER_TSA_FRAME_RANDOM_CURVES) || defined(RENDERER_VOL_RANDOM_CONSTANT) || defined(RENDERER_VOL_RANDOM_CURVE)\nattribute vec4 a_Random1;\n#endif\nattribute vec3 a_SimulationWorldPosition;attribute vec4 a_SimulationWorldRotation;varying vec4 v_Color;\n#ifdef MATERIAL_HAS_BASETEXTURE\nattribute vec4 a_SimulationUV;varying vec2 v_TextureCoordinate;\n#endif\nuniform float renderer_CurrentTime;uniform vec3 renderer_Gravity;uniform vec2 u_DragConstant;uniform vec3 renderer_WorldPosition;uniform vec4 renderer_WorldRotation;uniform bool renderer_ThreeDStartRotation;uniform int renderer_ScalingMode;uniform vec3 renderer_PositionScale;uniform vec3 renderer_SizeScale;uniform vec3 renderer_PivotOffset;uniform mat4 camera_ViewMat;uniform mat4 camera_ProjMat;\n#ifdef RENDERER_MODE_STRETCHED_BILLBOARD\nuniform vec3 camera_Position;\n#endif\nuniform vec3 camera_Forward;uniform vec3 camera_Up;uniform float renderer_StretchedBillboardLengthScale;uniform float renderer_StretchedBillboardSpeedScale;uniform int renderer_SimulationSpace;\n#include <particle_common>\n#include <velocity_over_lifetime_module>\n#include <color_over_lifetime_module>\n#include <size_over_lifetime_module>\n#include <rotation_over_lifetime_module>\n#include <texture_sheet_animation_module>\nvoid main(){float age=renderer_CurrentTime-a_DirectionTime.w;float normalizedAge=age/a_ShapePositionStartLifeTime.w;vec3 lifeVelocity;if(normalizedAge<1.0){vec3 startVelocity=a_DirectionTime.xyz*a_StartSpeed;\n#if defined(RENDERER_VOL_CONSTANT) || defined(RENDERER_VOL_CURVE) || defined(RENDERER_VOL_RANDOM_CONSTANT) || defined(RENDERER_VOL_RANDOM_CURVE)\nlifeVelocity=computeParticleLifeVelocity(normalizedAge);\n#endif\nvec3 gravityVelocity=renderer_Gravity*a_Random0.x*age;vec4 worldRotation;if(renderer_SimulationSpace==0){worldRotation=renderer_WorldRotation;}else{worldRotation=a_SimulationWorldRotation;}vec3 dragData=a_DirectionTime.xyz*mix(u_DragConstant.x,u_DragConstant.y,a_Random0.x);vec3 center=computeParticlePosition(startVelocity,lifeVelocity,age,normalizedAge,gravityVelocity,worldRotation,dragData);\n#include <sphere_billboard>\n#include <stretched_billboard>\n#include <horizontal_billboard>\n#include <vertical_billboard>\n#include <particle_mesh>\ngl_Position=camera_ProjMat*camera_ViewMat*vec4(center,1.0);v_Color=computeParticleColor(a_StartColor,normalizedAge);\n#ifdef MATERIAL_HAS_BASETEXTURE\nvec2 simulateUV;\n#if defined(RENDERER_MODE_SPHERE_BILLBOARD) || defined(RENDERER_MODE_STRETCHED_BILLBOARD) || defined(RENDERER_MODE_HORIZONTAL_BILLBOARD) || defined(RENDERER_MODE_VERTICAL_BILLBOARD)\nsimulateUV=a_CornerTextureCoordinate.zw*a_SimulationUV.xy+a_SimulationUV.zw;v_TextureCoordinate=computeParticleUV(simulateUV,normalizedAge);\n#endif\n#ifdef RENDERER_MODE_MESH\nsimulateUV=a_SimulationUV.xy+a_MeshTextureCoordinate*a_SimulationUV.zw;v_TextureCoordinate=computeParticleUV(simulateUV,normalizedAge);\n#endif\n#endif\n}else{gl_Position=vec4(2.0,2.0,2.0,1.0);}}"; // eslint-disable-line
|
|
23095
23110
|
|
|
23096
23111
|
var pbrSpecularFs = "#define GLSLIFY 1\n#include <common>\n#include <camera_declare>\n#include <FogFragmentDeclaration>\n#include <uv_share>\n#include <normal_share>\n#include <color_share>\n#include <worldpos_share>\n#include <light_frag_define>\n#include <pbr_frag_define>\n#include <pbr_helper>\nvoid main(){\n#include <pbr_frag>\n#include <FogFragment>\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ngl_FragColor=linearToGamma(gl_FragColor);\n#endif\n}"; // eslint-disable-line
|
|
23097
23112
|
|
|
@@ -26471,8 +26486,13 @@ var MultiExecutor = /*#__PURE__*/ function() {
|
|
|
26471
26486
|
*/ var Loader = /*#__PURE__*/ function() {
|
|
26472
26487
|
function Loader(useCache) {
|
|
26473
26488
|
this.useCache = useCache;
|
|
26474
|
-
this.request = request;
|
|
26475
26489
|
}
|
|
26490
|
+
var _proto = Loader.prototype;
|
|
26491
|
+
_proto.request = function request1(url, resourceManager, config) {
|
|
26492
|
+
var _resourceManager__virtualPathMap_url;
|
|
26493
|
+
var remoteUrl = (_resourceManager__virtualPathMap_url = resourceManager._virtualPathMap[url]) != null ? _resourceManager__virtualPathMap_url : url;
|
|
26494
|
+
return request(remoteUrl, config);
|
|
26495
|
+
};
|
|
26476
26496
|
/**
|
|
26477
26497
|
* Register a class with a string name for serialization and deserialization.
|
|
26478
26498
|
* @param key - class name
|
|
@@ -31449,6 +31469,7 @@ __decorate([
|
|
|
31449
31469
|
|
|
31450
31470
|
var MainModule = /*#__PURE__*/ function() {
|
|
31451
31471
|
function MainModule(generator) {
|
|
31472
|
+
this._tempVector40 = new miniprogram.Vector4();
|
|
31452
31473
|
/** The duration of the Particle Generator in seconds. */ this.duration = 5.0;
|
|
31453
31474
|
/** Specifies whether the Particle Generator loops. */ this.isLoop = true;
|
|
31454
31475
|
/** Start delay in seconds. */ this.startDelay = new ParticleCompositeCurve(0);
|
|
@@ -31470,7 +31491,6 @@ var MainModule = /*#__PURE__*/ function() {
|
|
|
31470
31491
|
this._gravityModifierRand = new miniprogram.Rand(0, ParticleRandomSubSeeds.GravityModifier);
|
|
31471
31492
|
this._startSize3D = false;
|
|
31472
31493
|
this._simulationSpace = exports.ParticleSimulationSpace.Local;
|
|
31473
|
-
this._gravity = new miniprogram.Vector3();
|
|
31474
31494
|
this._generator = generator;
|
|
31475
31495
|
this.startLifetime = new ParticleCompositeCurve(5);
|
|
31476
31496
|
this.startSpeed = new ParticleCompositeCurve(5);
|
|
@@ -31510,8 +31530,7 @@ var MainModule = /*#__PURE__*/ function() {
|
|
|
31510
31530
|
case exports.ParticleSimulationSpace.Local:
|
|
31511
31531
|
shaderData.setVector3(MainModule._worldPosition, transform.worldPosition);
|
|
31512
31532
|
var worldRotation = transform.worldRotationQuaternion;
|
|
31513
|
-
var worldRotationV4 =
|
|
31514
|
-
worldRotationV4.copyFrom(worldRotation);
|
|
31533
|
+
var worldRotationV4 = this._tempVector40.copyFrom(worldRotation); // Maybe shaderData should support Quaternion
|
|
31515
31534
|
shaderData.setVector4(MainModule._worldRotation, worldRotationV4);
|
|
31516
31535
|
break;
|
|
31517
31536
|
case exports.ParticleSimulationSpace.World:
|
|
@@ -31535,10 +31554,7 @@ var MainModule = /*#__PURE__*/ function() {
|
|
|
31535
31554
|
shaderData.setVector3(MainModule._sizeScale, MainModule._vector3One);
|
|
31536
31555
|
break;
|
|
31537
31556
|
}
|
|
31538
|
-
|
|
31539
|
-
var gravityModifierValue = this.gravityModifier.evaluate(undefined, this._gravityModifierRand.random());
|
|
31540
|
-
miniprogram.Vector3.scale(renderer.scene.physics.gravity, gravityModifierValue, particleGravity);
|
|
31541
|
-
shaderData.setVector3(MainModule._gravity, particleGravity);
|
|
31557
|
+
shaderData.setVector3(MainModule._gravity, renderer.scene.physics.gravity);
|
|
31542
31558
|
shaderData.setInt(MainModule._simulationSpace, this.simulationSpace);
|
|
31543
31559
|
shaderData.setFloat(MainModule._startRotation3D, +this.startRotation3D);
|
|
31544
31560
|
shaderData.setInt(MainModule._scaleMode, this.scalingMode);
|
|
@@ -31706,9 +31722,6 @@ var MainModule = /*#__PURE__*/ function() {
|
|
|
31706
31722
|
]);
|
|
31707
31723
|
return MainModule;
|
|
31708
31724
|
}();
|
|
31709
|
-
(function() {
|
|
31710
|
-
MainModule._tempVector40 = new miniprogram.Vector4();
|
|
31711
|
-
})();
|
|
31712
31725
|
(function() {
|
|
31713
31726
|
MainModule._vector3One = new miniprogram.Vector3(1, 1, 1);
|
|
31714
31727
|
})();
|
|
@@ -31793,9 +31806,6 @@ __decorate([
|
|
|
31793
31806
|
__decorate([
|
|
31794
31807
|
ignoreClone
|
|
31795
31808
|
], MainModule.prototype, "_generator", void 0);
|
|
31796
|
-
__decorate([
|
|
31797
|
-
ignoreClone
|
|
31798
|
-
], MainModule.prototype, "_gravity", void 0);
|
|
31799
31809
|
|
|
31800
31810
|
/**
|
|
31801
31811
|
* Rotate particles throughout their lifetime.
|
|
@@ -33065,8 +33075,15 @@ __decorate([
|
|
|
33065
33075
|
}
|
|
33066
33076
|
// Start speed
|
|
33067
33077
|
instanceVertices[offset + 18] = startSpeed;
|
|
33068
|
-
//
|
|
33069
|
-
|
|
33078
|
+
// Gravity, unused, size, rotation
|
|
33079
|
+
switch(main.gravityModifier.mode){
|
|
33080
|
+
case exports.ParticleCurveMode.Constant:
|
|
33081
|
+
instanceVertices[offset + 19] = main.gravityModifier.constant;
|
|
33082
|
+
break;
|
|
33083
|
+
case exports.ParticleCurveMode.TwoConstants:
|
|
33084
|
+
instanceVertices[offset + 19] = main.gravityModifier.evaluate(undefined, main._gravityModifierRand.random());
|
|
33085
|
+
break;
|
|
33086
|
+
}
|
|
33070
33087
|
var colorOverLifetime = this.colorOverLifetime;
|
|
33071
33088
|
if (colorOverLifetime.enabled && colorOverLifetime.color.mode === exports.ParticleGradientMode.TwoGradients) {
|
|
33072
33089
|
instanceVertices[offset + 20] = colorOverLifetime._colorGradientRand.random();
|