@galacean/engine 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/browser.js CHANGED
@@ -5619,6 +5619,11 @@
5619
5619
  if (Utils.isBase64Url(relativeUrl)) {
5620
5620
  return relativeUrl;
5621
5621
  }
5622
+ if (!/^https?:/.test(baseUrl)) {
5623
+ var fileSchema = "files://";
5624
+ baseUrl = fileSchema + baseUrl;
5625
+ return new URL(relativeUrl, baseUrl).href.substring(fileSchema.length);
5626
+ }
5622
5627
  return relativeUrl ? new URL(relativeUrl, baseUrl).href : baseUrl;
5623
5628
  };
5624
5629
  /**
@@ -7138,7 +7143,7 @@
7138
7143
  var rotation_over_lifetime_module = "#define GLSLIFY 1\n#if defined(RENDERER_ROL_CONSTANT_MODE) || defined(RENDERER_ROL_CURVE_MODE)\n#ifdef RENDERER_ROL_CURVE_MODE\nuniform vec2 renderer_ROLMaxCurveZ[4];\n#ifdef RENDERER_ROL_IS_RANDOM_TWO\nuniform vec2 renderer_ROLMinCurveZ[4];\n#endif\n#else\nuniform vec3 renderer_ROLMaxConst;\n#ifdef RENDERER_ROL_IS_RANDOM_TWO\nuniform vec3 renderer_ROLMinConst;\n#endif\n#endif\n#endif\nfloat computeParticleRotationFloat(in float rotation,in float age,in float normalizedAge){\n#if defined(RENDERER_ROL_CONSTANT_MODE) || defined(RENDERER_ROL_CURVE_MODE)\n#ifdef RENDERER_ROL_CURVE_MODE\nfloat lifeRotation=evaluateParticleCurveCumulative(renderer_ROLMaxCurveZ,normalizedAge);\n#ifdef RENDERER_ROL_IS_RANDOM_TWO\nlifeRotation=mix(evaluateParticleCurveCumulative(renderer_ROLMinCurveZ,normalizedAge),lifeRotation,a_Random0.w);\n#endif\nrotation+=lifeRotation*a_ShapePositionStartLifeTime.w;\n#else\nfloat lifeRotation=renderer_ROLMaxConst.z;\n#ifdef RENDERER_ROL_IS_RANDOM_TWO\nlifeRotation=mix(renderer_ROLMinConst.z,lifeRotation,a_Random0.w);\n#endif\nrotation+=lifeRotation*age;\n#endif\n#endif\nreturn rotation;}\n#if defined(RENDERER_MODE_MESH) && (defined(ROTATION_OVER_LIFETIME) || defined(ROTATION_OVER_LIFETIME_SEPARATE))\nvec3 computeParticleRotationVec3(in vec3 rotation,in float age,in float normalizedAge){\n#ifdef ROTATION_OVER_LIFETIME\n#ifdef ROTATION_OVER_LIFETIME_CONSTANT\nfloat ageRot=u_ROLAngularVelocityConst*age;rotation+=ageRot;\n#endif\n#ifdef ROTATION_OVER_LIFETIME_CURVE\nrotation+=getTotalValueFromGradientFloat(u_ROLAngularVelocityGradient,normalizedAge);\n#endif\n#ifdef ROTATION_OVER_LIFETIME_RANDOM_CONSTANTS\nfloat ageRot=mix(u_ROLAngularVelocityConst,u_ROLAngularVelocityConstMax,a_Random0.w)*age;rotation+=ageRot;\n#endif\n#ifdef ROTATION_OVER_LIFETIME_RANDOM_CURVES\nrotation+=mix(getTotalValueFromGradientFloat(u_ROLAngularVelocityGradient,normalizedAge),getTotalValueFromGradientFloat(u_ROLAngularVelocityGradientMax,normalizedAge),a_Random0.w);\n#endif\n#endif\n#ifdef ROTATION_OVER_LIFETIME_SEPARATE\n#ifdef ROTATION_OVER_LIFETIME_CONSTANT\nvec3 ageRot=u_ROLAngularVelocityConstSeparate*age;rotation+=ageRot;\n#endif\n#ifdef ROTATION_OVER_LIFETIME_CURVE\nrotation+=vec3(getTotalValueFromGradientFloat(u_ROLAngularVelocityGradientX,normalizedAge),getTotalValueFromGradientFloat(u_ROLAngularVelocityGradientY,normalizedAge),getTotalValueFromGradientFloat(u_ROLAngularVelocityGradientZ,normalizedAge));\n#endif\n#ifdef ROTATION_OVER_LIFETIME_RANDOM_CONSTANTS\nvec3 ageRot=mix(u_ROLAngularVelocityConstSeparate,renderer_ROLMaxConst,a_Random0.w)*age;rotation+=ageRot;\n#endif\n#ifdef ROTATION_OVER_LIFETIME_RANDOM_CURVES\nrotation+=vec3(mix(getTotalValueFromGradientFloat(u_ROLAngularVelocityGradientX,normalizedAge),getTotalValueFromGradientFloat(renderer_ROLMaxCurveX,normalizedAge),a_Random0.w),mix(getTotalValueFromGradientFloat(u_ROLAngularVelocityGradientY,normalizedAge),getTotalValueFromGradientFloat(renderer_ROLMaxCurveY,normalizedAge),a_Random0.w),mix(getTotalValueFromGradientFloat(u_ROLAngularVelocityGradientZ,normalizedAge),getTotalValueFromGradientFloat(renderer_ROLMaxCurveZ,normalizedAge),a_Random0.w));\n#endif\n#endif\nreturn rotation;}\n#endif\n"; // eslint-disable-line
7139
7144
  var size_over_lifetime_module = "#define GLSLIFY 1\n#ifdef RENDERER_SOL_CURVE_MODE\nuniform vec2 renderer_SOLMaxCurveX[4];\n#ifdef RENDERER_SOL_IS_SEPARATE\nuniform vec2 renderer_SOLMaxCurveY[4];uniform vec2 renderer_SOLMaxCurveZ[4];\n#endif\n#ifdef RENDERER_SOL_IS_RANDOM_TWO\nuniform vec2 renderer_SOLMinCurveX[4];\n#ifdef RENDERER_SOL_IS_SEPARATE\nuniform vec2 renderer_SOLMinCurveY[4];uniform vec2 renderer_SOLMinCurveZ[4];\n#endif\n#endif\n#endif\nvec2 computeParticleSizeBillboard(in vec2 size,in float normalizedAge){\n#ifdef RENDERER_SOL_CURVE_MODE\nfloat lifeSizeX=evaluateParticleCurve(renderer_SOLMaxCurveX,normalizedAge);\n#ifdef RENDERER_SOL_IS_RANDOM_TWO\nlifeSizeX=mix(evaluateParticleCurve(renderer_SOLMinCurveX,normalizedAge),lifeSizeX,a_Random0.z);\n#endif\n#ifdef RENDERER_SOL_IS_SEPARATE\nfloat lifeSizeY=evaluateParticleCurve(renderer_SOLMaxCurveY,normalizedAge);\n#ifdef RENDERER_SOL_IS_RANDOM_TWO\nlifeSizeY=mix(evaluateParticleCurve(renderer_SOLMinCurveY,normalizedAge),lifeSizeY,a_Random0.z);\n#endif\nsize*=vec2(lifeSizeX,lifeSizeY);\n#else\nsize*=lifeSizeX;\n#endif\n#endif\nreturn size;}\n#ifdef RENDERER_MODE_MESH\nvec3 computeParticleSizeMesh(in vec3 size,in float normalizedAge){\n#ifdef RENDERER_SOL_CURVE\nsize*=evaluateParticleCurve(renderer_SOLMaxCurveX,normalizedAge);\n#endif\n#ifdef RENDERER_SOL_RANDOM_CURVES\nsize*=mix(evaluateParticleCurve(renderer_SOLMaxCurveX,normalizedAge),evaluateParticleCurve(u_SOLSizeGradientMax,normalizedAge),a_Random0.z);\n#endif\n#ifdef RENDERER_SOL_CURVE_SEPARATE\nsize*=vec3(evaluateParticleCurve(renderer_SOLMinCurveX,normalizedAge),evaluateParticleCurve(renderer_SOLMinCurveY,normalizedAge),evaluateParticleCurve(renderer_SOLMinCurveZ,normalizedAge));\n#endif\n#ifdef RENDERER_SOL_RANDOM_CURVES_SEPARATE\nsize*=vec3(mix(evaluateParticleCurve(renderer_SOLMinCurveX,normalizedAge),evaluateParticleCurve(renderer_SOLMaxCurveX,normalizedAge),a_Random0.z),mix(evaluateParticleCurve(renderer_SOLMinCurveY,normalizedAge),evaluateParticleCurve(renderer_SOLMaxCurveY,normalizedAge),a_Random0.z),mix(evaluateParticleCurve(renderer_SOLMinCurveZ,normalizedAge),evaluateParticleCurve(renderer_SOLMaxCurveZ,normalizedAge),a_Random0.z));\n#endif\nreturn size;}\n#endif\n"; // eslint-disable-line
7140
7145
  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
7141
- 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 floorTotalULength=floor(tileRow);uv.x+=tileRow-tileRowIndex;uv.y+=tileRowIndex*renderer_TSATillingParams.y;\n#endif\nreturn uv;}"; // eslint-disable-line
7146
+ 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
7142
7147
  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
7143
7148
  var stretched_billboard = "#define GLSLIFY 1\n#ifdef RENDERER_MODE_STRETCHED_BILLBOARD\nvec2 corner=a_CornerTextureCoordinate.xy+renderer_PivotOffset.xy;vec3 velocity;\n#if defined(RENDERER_VOL_CONSTANT) || defined(RENDERER_VOL_CURVE) || defined(RENDERER_VOL_RANDOM_CONSTANT) || defined(RENDERER_VOL_RANDOM_CURVE)\nif(renderer_VOLSpace==0){velocity=rotationByQuaternions(renderer_SizeScale*(startVelocity+lifeVelocity),worldRotation)+gravityVelocity;}else{velocity=rotationByQuaternions(renderer_SizeScale*startVelocity,worldRotation)+lifeVelocity+gravityVelocity;}\n#else\nvelocity=rotationByQuaternions(renderer_SizeScale*startVelocity,worldRotation)+gravityVelocity;\n#endif\nvec3 cameraUpVector=normalize(velocity);vec3 direction=normalize(center-camera_Position);vec3 sideVector=normalize(cross(direction,normalize(velocity)));sideVector=renderer_SizeScale.xzy*sideVector;cameraUpVector=length(vec3(renderer_SizeScale.x,0.0,0.0))*cameraUpVector;vec2 size=computeParticleSizeBillboard(a_StartSize.xy,normalizedAge);const mat2 rotationZHalfPI=mat2(0.0,-1.0,1.0,0.0);corner=rotationZHalfPI*corner;corner.y=corner.y-abs(corner.y);float speed=length(velocity);center+=sign(renderer_SizeScale.x)*(sign(renderer_StretchedBillboardLengthScale)*size.x*corner.x*sideVector+(speed*renderer_StretchedBillboardSpeedScale+size.y*renderer_StretchedBillboardLengthScale)*corner.y*cameraUpVector);\n#endif\n"; // eslint-disable-line
7144
7149
  var vertical_billboard = "#define GLSLIFY 1\n#ifdef RENDERER_MODE_VERTICAL_BILLBOARD\nvec2 corner=a_CornerTextureCoordinate.xy+renderer_PivotOffset.xy;const vec3 cameraUpVector=vec3(0.0,1.0,0.0);vec3 sideVector=normalize(cross(camera_Forward,cameraUpVector));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*cos(0.78539816339744830961566084581988);corner*=computeParticleSizeBillboard(a_StartSize.xy,normalizedAge);center+=renderer_SizeScale.xzy*(corner.x*sideVector+corner.y*cameraUpVector);\n#endif\n"; // eslint-disable-line
@@ -15136,7 +15141,7 @@
15136
15141
  if (background.mode === exports.BackgroundMode.Sky) {
15137
15142
  background.sky._render(context);
15138
15143
  } else if (background.mode === exports.BackgroundMode.Texture && background.texture) {
15139
- this._drawBackgroundTexture(engine, background);
15144
+ this._drawBackgroundTexture(camera, background);
15140
15145
  }
15141
15146
  }
15142
15147
  // Copy opaque texture
@@ -15232,7 +15237,8 @@
15232
15237
  renderElement.renderQueueFlags |= flag;
15233
15238
  }
15234
15239
  };
15235
- _proto._drawBackgroundTexture = function _drawBackgroundTexture(engine, background) {
15240
+ _proto._drawBackgroundTexture = function _drawBackgroundTexture(camera, background) {
15241
+ var engine = camera.engine;
15236
15242
  var rhi = engine._hardwareRenderer;
15237
15243
  var canvas = engine.canvas;
15238
15244
  var material = background._material, mesh = background._mesh;
@@ -15244,6 +15250,7 @@
15244
15250
  var program = pass._getShaderProgram(engine, Shader._compileMacros);
15245
15251
  program.bind();
15246
15252
  program.uploadAll(program.materialUniformBlock, material.shaderData);
15253
+ program.uploadAll(program.cameraUniformBlock, camera.shaderData);
15247
15254
  program.uploadUnGroupTextures();
15248
15255
  (pass._renderState || material.renderState)._applyStates(engine, false, pass._renderStateDataMap, material.shaderData);
15249
15256
  rhi.drawPrimitive(mesh._primitive, mesh.subMesh, program);
@@ -23797,6 +23804,7 @@
23797
23804
  AssetType[/** 2D Texture. */ "Texture2D"] = "Texture2D";
23798
23805
  AssetType[/** Cube Texture. */ "TextureCube"] = "TextureCube";
23799
23806
  AssetType[/** Material. */ "Material"] = "Material";
23807
+ AssetType[/** Shader. */ "Shader"] = "Shader";
23800
23808
  AssetType[/** Mesh. */ "Mesh"] = "Mesh";
23801
23809
  AssetType[/** AnimationClip. */ "AnimationClip"] = "AnimationClip";
23802
23810
  AssetType[/** AnimatorController. */ "AnimatorController"] = "AnimatorController";
@@ -24284,13 +24292,15 @@
24284
24292
  /**
24285
24293
  * @internal
24286
24294
  */ _proto._onSubAssetSuccess = function _onSubAssetSuccess(assetBaseURL, assetSubPath, value) {
24287
- var _this__subAssetPromiseCallbacks_assetBaseURL;
24288
- var subPromiseCallback = (_this__subAssetPromiseCallbacks_assetBaseURL = this._subAssetPromiseCallbacks[assetBaseURL]) == null ? void 0 : _this__subAssetPromiseCallbacks_assetBaseURL[assetSubPath];
24295
+ var _this__subAssetPromiseCallbacks_remoteAssetBaseURL;
24296
+ var _this__virtualPathMap_assetBaseURL;
24297
+ var remoteAssetBaseURL = (_this__virtualPathMap_assetBaseURL = this._virtualPathMap[assetBaseURL]) != null ? _this__virtualPathMap_assetBaseURL : assetBaseURL;
24298
+ var subPromiseCallback = (_this__subAssetPromiseCallbacks_remoteAssetBaseURL = this._subAssetPromiseCallbacks[remoteAssetBaseURL]) == null ? void 0 : _this__subAssetPromiseCallbacks_remoteAssetBaseURL[assetSubPath];
24289
24299
  if (subPromiseCallback) {
24290
24300
  subPromiseCallback.resolve(value);
24291
24301
  } else {
24292
- var _this__subAssetPromiseCallbacks, _assetBaseURL;
24293
- ((_this__subAssetPromiseCallbacks = this._subAssetPromiseCallbacks)[_assetBaseURL = assetBaseURL] || (_this__subAssetPromiseCallbacks[_assetBaseURL] = {}))[assetSubPath] = {
24302
+ var _this__subAssetPromiseCallbacks, _remoteAssetBaseURL;
24303
+ ((_this__subAssetPromiseCallbacks = this._subAssetPromiseCallbacks)[_remoteAssetBaseURL = remoteAssetBaseURL] || (_this__subAssetPromiseCallbacks[_remoteAssetBaseURL] = {}))[assetSubPath] = {
24294
24304
  resolvedValue: value
24295
24305
  };
24296
24306
  }
@@ -24411,33 +24421,34 @@
24411
24421
  var item = this._assignDefaultOptions(typeof itemOrURL === "string" ? {
24412
24422
  url: itemOrURL
24413
24423
  } : itemOrURL);
24414
- // Check url mapping
24415
- var itemURL = item.url;
24416
- var url = this._virtualPathMap[itemURL] ? this._virtualPathMap[itemURL] : itemURL;
24424
+ var url = item.url;
24417
24425
  // Not absolute and base url is set
24418
24426
  if (!Utils.isAbsoluteUrl(url) && this.baseUrl) url = Utils.resolveAbsoluteUrl(this.baseUrl, url);
24419
24427
  // Parse url
24420
24428
  var _this__parseURL = this._parseURL(url), assetBaseURL = _this__parseURL.assetBaseURL, queryPath = _this__parseURL.queryPath;
24421
24429
  var paths = queryPath ? this._parseQueryPath(queryPath) : [];
24430
+ var _this__virtualPathMap_assetBaseURL;
24431
+ // Get remote asset base url
24432
+ var remoteAssetBaseURL = (_this__virtualPathMap_assetBaseURL = this._virtualPathMap[assetBaseURL]) != null ? _this__virtualPathMap_assetBaseURL : assetBaseURL;
24422
24433
  // Check cache
24423
- var cacheObject = this._assetUrlPool[assetBaseURL];
24434
+ var cacheObject = this._assetUrlPool[remoteAssetBaseURL];
24424
24435
  if (cacheObject) {
24425
24436
  return new AssetPromise(function(resolve) {
24426
24437
  resolve(_this._getResolveResource(cacheObject, paths));
24427
24438
  });
24428
24439
  }
24429
24440
  // Get asset url
24430
- var assetURL = assetBaseURL;
24441
+ var remoteAssetURL = remoteAssetBaseURL;
24431
24442
  if (queryPath) {
24432
- assetURL += "?q=" + paths.shift();
24443
+ remoteAssetURL += "?q=" + paths.shift();
24433
24444
  var index;
24434
24445
  while(index = paths.shift()){
24435
- assetURL += "[" + index + "]";
24446
+ remoteAssetURL += "[" + index + "]";
24436
24447
  }
24437
24448
  }
24438
24449
  // Check is loading
24439
24450
  var loadingPromises = this._loadingPromises;
24440
- var loadingPromise = loadingPromises[assetURL];
24451
+ var loadingPromise = loadingPromises[remoteAssetURL];
24441
24452
  if (loadingPromise) {
24442
24453
  return new AssetPromise(function(resolve, reject, setTaskCompleteProgress, setTaskDetailProgress) {
24443
24454
  loadingPromise.onProgress(setTaskCompleteProgress, setTaskDetailProgress).then(function(resource) {
@@ -24455,37 +24466,37 @@
24455
24466
  // Check sub asset
24456
24467
  if (queryPath) {
24457
24468
  // Check whether load main asset
24458
- var mainPromise = loadingPromises[assetBaseURL] || this._loadMainAsset(loader, item, assetBaseURL);
24469
+ var mainPromise = loadingPromises[remoteAssetBaseURL] || this._loadMainAsset(loader, item, remoteAssetBaseURL, assetBaseURL);
24459
24470
  mainPromise.catch(function(e) {
24460
- _this._onSubAssetFail(assetBaseURL, queryPath, e);
24471
+ _this._onSubAssetFail(remoteAssetBaseURL, queryPath, e);
24461
24472
  });
24462
- return this._createSubAssetPromiseCallback(assetBaseURL, assetURL, queryPath);
24473
+ return this._createSubAssetPromiseCallback(remoteAssetBaseURL, remoteAssetURL, queryPath);
24463
24474
  }
24464
- return this._loadMainAsset(loader, item, assetBaseURL);
24475
+ return this._loadMainAsset(loader, item, remoteAssetBaseURL, assetBaseURL);
24465
24476
  };
24466
- _proto._loadMainAsset = function _loadMainAsset(loader, item, assetBaseURL) {
24477
+ _proto._loadMainAsset = function _loadMainAsset(loader, item, remoteAssetBaseURL, assetBaseURL) {
24467
24478
  var _this = this;
24468
24479
  item.url = assetBaseURL;
24469
24480
  var loadingPromises = this._loadingPromises;
24470
24481
  var promise = loader.load(item, this);
24471
- loadingPromises[assetBaseURL] = promise;
24482
+ loadingPromises[remoteAssetBaseURL] = promise;
24472
24483
  promise.then(function(resource) {
24473
24484
  if (loader.useCache) {
24474
- _this._addAsset(assetBaseURL, resource);
24485
+ _this._addAsset(remoteAssetBaseURL, resource);
24475
24486
  }
24476
- delete loadingPromises[assetBaseURL];
24477
- _this._releaseSubAssetPromiseCallback(assetBaseURL);
24487
+ delete loadingPromises[remoteAssetBaseURL];
24488
+ _this._releaseSubAssetPromiseCallback(remoteAssetBaseURL);
24478
24489
  }, function() {
24479
- delete loadingPromises[assetBaseURL];
24480
- _this._releaseSubAssetPromiseCallback(assetBaseURL);
24490
+ delete loadingPromises[remoteAssetBaseURL];
24491
+ _this._releaseSubAssetPromiseCallback(remoteAssetBaseURL);
24481
24492
  });
24482
24493
  return promise;
24483
24494
  };
24484
- _proto._createSubAssetPromiseCallback = function _createSubAssetPromiseCallback(assetBaseURL, assetURL, assetSubPath) {
24495
+ _proto._createSubAssetPromiseCallback = function _createSubAssetPromiseCallback(remoteAssetBaseURL, remoteAssetURL, assetSubPath) {
24485
24496
  var _this = this;
24486
- var _this__subAssetPromiseCallbacks_assetBaseURL, _subPromiseCallback, _subPromiseCallback1;
24497
+ var _this__subAssetPromiseCallbacks_remoteAssetBaseURL, _subPromiseCallback, _subPromiseCallback1;
24487
24498
  var loadingPromises = this._loadingPromises;
24488
- var subPromiseCallback = (_this__subAssetPromiseCallbacks_assetBaseURL = this._subAssetPromiseCallbacks[assetBaseURL]) == null ? void 0 : _this__subAssetPromiseCallbacks_assetBaseURL[assetSubPath];
24499
+ var subPromiseCallback = (_this__subAssetPromiseCallbacks_remoteAssetBaseURL = this._subAssetPromiseCallbacks[remoteAssetBaseURL]) == null ? void 0 : _this__subAssetPromiseCallbacks_remoteAssetBaseURL[assetSubPath];
24489
24500
  var resolvedValue = (_subPromiseCallback = subPromiseCallback) == null ? void 0 : _subPromiseCallback.resolvedValue;
24490
24501
  var rejectedValue = (_subPromiseCallback1 = subPromiseCallback) == null ? void 0 : _subPromiseCallback1.rejectedValue;
24491
24502
  // Already resolved or rejected
@@ -24500,17 +24511,17 @@
24500
24511
  }
24501
24512
  // Pending
24502
24513
  var promise = new AssetPromise(function(resolve, reject) {
24503
- var _this__subAssetPromiseCallbacks, _assetBaseURL;
24504
- ((_this__subAssetPromiseCallbacks = _this._subAssetPromiseCallbacks)[_assetBaseURL = assetBaseURL] || (_this__subAssetPromiseCallbacks[_assetBaseURL] = {}))[assetSubPath] = {
24514
+ var _this__subAssetPromiseCallbacks, _remoteAssetBaseURL;
24515
+ ((_this__subAssetPromiseCallbacks = _this._subAssetPromiseCallbacks)[_remoteAssetBaseURL = remoteAssetBaseURL] || (_this__subAssetPromiseCallbacks[_remoteAssetBaseURL] = {}))[assetSubPath] = {
24505
24516
  resolve: resolve,
24506
24517
  reject: reject
24507
24518
  };
24508
24519
  });
24509
- loadingPromises[assetURL] = promise;
24520
+ loadingPromises[remoteAssetURL] = promise;
24510
24521
  promise.then(function() {
24511
- delete loadingPromises[assetURL];
24522
+ delete loadingPromises[remoteAssetURL];
24512
24523
  }, function() {
24513
- return delete loadingPromises[assetURL];
24524
+ return delete loadingPromises[remoteAssetURL];
24514
24525
  });
24515
24526
  return promise;
24516
24527
  };
@@ -24583,16 +24594,20 @@
24583
24594
  if (obj) {
24584
24595
  promise = Promise.resolve(obj);
24585
24596
  } else {
24586
- var _this__editorResourceConfig_refId;
24587
- var url = (_this__editorResourceConfig_refId = this._editorResourceConfig[refId]) == null ? void 0 : _this__editorResourceConfig_refId.path;
24588
- if (!url) {
24597
+ var resourceConfig = this._editorResourceConfig[refId];
24598
+ if (!resourceConfig) {
24589
24599
  Logger.warn("refId:" + refId + " is not find in this._editorResourceConfig.");
24590
24600
  return Promise.resolve(null);
24591
24601
  }
24592
- url = key ? "" + url + (url.indexOf("?") > -1 ? "&" : "?") + "q=" + key : url;
24602
+ var remoteUrl = resourceConfig.path;
24603
+ var queryPath = new URL(remoteUrl).search;
24604
+ var url = resourceConfig.virtualPath + queryPath;
24605
+ if (key) {
24606
+ url += (url.indexOf("?") > -1 ? "&" : "?") + "q=" + key;
24607
+ }
24593
24608
  promise = this.load({
24594
24609
  url: url,
24595
- type: this._editorResourceConfig[refId].type
24610
+ type: resourceConfig.type
24596
24611
  });
24597
24612
  }
24598
24613
  return promise.then(function(item) {
@@ -27763,13 +27778,13 @@
27763
27778
  var skyProceduralFs = "#define GLSLIFY 1\n#include <common>\nconst float MIE_G=-0.990;const float MIE_G2=0.9801;const float SKY_GROUND_THRESHOLD=0.02;uniform float material_SunSize;uniform float material_SunSizeConvergence;uniform vec4 scene_SunlightColor;uniform vec3 scene_SunlightDirection;varying vec3 v_GroundColor;varying vec3 v_SkyColor;\n#ifdef MATERIAL_SUN_HIGH_QUALITY\nvarying vec3 v_Vertex;\n#elif defined(MATERIAL_SUN_SIMPLE)\nvarying vec3 v_RayDir;\n#else\nvarying float v_SkyGroundFactor;\n#endif\n#if defined(MATERIAL_SUN_HIGH_QUALITY)||defined(MATERIAL_SUN_SIMPLE)\nvarying vec3 v_SunColor;\n#endif\n#if defined(ENGINE_IS_COLORSPACE_GAMMA)\n#define LINEAR_2_OUTPUT(color) sqrt(color)\n#endif\nfloat getMiePhase(float eyeCos,float eyeCos2){float temp=1.0+MIE_G2-2.0*MIE_G*eyeCos;temp=pow(temp,pow(material_SunSize,0.65)*10.0);temp=max(temp,1.0e-4);temp=1.5*((1.0-MIE_G2)/(2.0+MIE_G2))*(1.0+eyeCos2)/temp;return temp;}float calcSunAttenuation(vec3 lightPos,vec3 ray){\n#ifdef MATERIAL_SUN_HIGH_QUALITY\nfloat focusedEyeCos=pow(clamp(dot(lightPos,ray),0.0,1.0),material_SunSizeConvergence);return getMiePhase(-focusedEyeCos,focusedEyeCos*focusedEyeCos);\n#else\nvec3 delta=lightPos-ray;float dist=length(delta);float spot=1.0-smoothstep(0.0,material_SunSize,dist);return spot*spot;\n#endif\n}void main(){vec3 col=vec3(0.0,0.0,0.0);\n#ifdef MATERIAL_SUN_HIGH_QUALITY\nvec3 ray=normalize(v_Vertex);float y=ray.y/SKY_GROUND_THRESHOLD;\n#elif defined(MATERIAL_SUN_SIMPLE)\nvec3 ray=v_RayDir;float y=ray.y/SKY_GROUND_THRESHOLD;\n#else\nfloat y=v_SkyGroundFactor;\n#endif\ncol=mix(v_SkyColor,v_GroundColor,clamp(y,0.0,1.0));\n#if defined(MATERIAL_SUN_HIGH_QUALITY)||defined(MATERIAL_SUN_SIMPLE)\nif(y<0.0)col+=v_SunColor*calcSunAttenuation(-scene_SunlightDirection,-ray);\n#endif\n#ifdef ENGINE_IS_COLORSPACE_GAMMA\ncol=LINEAR_2_OUTPUT(col);\n#endif\ngl_FragColor=vec4(col,1.0);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ngl_FragColor=linearToGamma(gl_FragColor);\n#endif\n}"; // eslint-disable-line
27764
27779
  var skyProceduralVs = "#define GLSLIFY 1\n#define OUTER_RADIUS 1.025\n#define RAYLEIGH (mix(0.0, 0.0025, pow(material_AtmosphereThickness,2.5)))\n#define MIE 0.0010\n#define SUN_BRIGHTNESS 20.0\n#define MAX_SCATTER 50.0\nconst float SKY_GROUND_THRESHOLD=0.02;const float outerRadius=OUTER_RADIUS;const float outerRadius2=OUTER_RADIUS*OUTER_RADIUS;const float innerRadius=1.0;const float innerRadius2=1.0;const float cameraHeight=0.0001;const float HDSundiskIntensityFactor=15.0;const float simpleSundiskIntensityFactor=27.0;const float sunScale=400.0*SUN_BRIGHTNESS;const float kmESun=MIE*SUN_BRIGHTNESS;const float km4PI=MIE*4.0*3.14159265;const float scale=1.0/(OUTER_RADIUS-1.0);const float scaleDepth=0.25;const float scaleOverScaleDepth=(1.0/(OUTER_RADIUS-1.0))/0.25;const float samples=2.0;const vec3 c_DefaultScatteringWavelength=vec3(0.65,0.57,0.475);const vec3 c_VariableRangeForScatteringWavelength=vec3(0.15,0.15,0.15);attribute vec4 POSITION;uniform mat4 camera_VPMat;uniform vec3 material_SkyTint;uniform vec3 material_GroundTint;uniform float material_Exposure;uniform float material_AtmosphereThickness;uniform vec4 scene_SunlightColor;uniform vec3 scene_SunlightDirection;varying vec3 v_GroundColor;varying vec3 v_SkyColor;\n#ifdef MATERIAL_SUN_HIGH_QUALITY\nvarying vec3 v_Vertex;\n#elif defined(MATERIAL_SUN_SIMPLE)\nvarying vec3 v_RayDir;\n#else\nvarying float v_SkyGroundFactor;\n#endif\n#if defined(MATERIAL_SUN_HIGH_QUALITY)||defined(MATERIAL_SUN_SIMPLE)\nvarying vec3 v_SunColor;\n#endif\n#if defined(ENGINE_IS_COLORSPACE_GAMMA)\n#define COLOR_2_GAMMA(color) color\n#define COLOR_2_LINEAR(color) color*color\n#else\n#define GAMMA 2.2\n#define COLOR_2_GAMMA(color) pow(color,vec3(1.0/GAMMA))\n#define COLOR_2_LINEAR(color) color\n#endif\nfloat getRayleighPhase(vec3 light,vec3 ray){float eyeCos=dot(light,ray);return 0.75+0.75*eyeCos*eyeCos;}float scaleAngle(float inCos){float x=1.0-inCos;return 0.25*exp(-0.00287+x*(0.459+x*(3.83+x*(-6.80+x*5.25))));}void main(){gl_Position=camera_VPMat*vec4(POSITION.xyz,1.0);vec3 skyTintInGammaSpace=COLOR_2_GAMMA(material_SkyTint);vec3 scatteringWavelength=mix(c_DefaultScatteringWavelength-c_VariableRangeForScatteringWavelength,c_DefaultScatteringWavelength+c_VariableRangeForScatteringWavelength,vec3(1.0)-skyTintInGammaSpace);vec3 invWavelength=1.0/pow(scatteringWavelength,vec3(4.0));float krESun=RAYLEIGH*SUN_BRIGHTNESS;float kr4PI=RAYLEIGH*4.0*3.14159265;vec3 cameraPos=vec3(0.0,innerRadius+cameraHeight,0.0);vec3 eyeRay=normalize(POSITION.xyz);float far=0.0;vec3 cIn,cOut;if(eyeRay.y>=0.0){far=sqrt(outerRadius2+innerRadius2*eyeRay.y*eyeRay.y-innerRadius2)-innerRadius*eyeRay.y;float height=innerRadius+cameraHeight;float depth=exp(scaleOverScaleDepth*-cameraHeight);float startAngle=dot(eyeRay,cameraPos)/height;float startOffset=depth*scaleAngle(startAngle);float sampleLength=far/samples;float scaledLength=sampleLength*scale;vec3 sampleRay=eyeRay*sampleLength;vec3 samplePoint=cameraPos+sampleRay*0.5;vec3 frontColor=vec3(0.0);{float height=length(samplePoint);float depth=exp(scaleOverScaleDepth*(innerRadius-height));float lightAngle=dot(-scene_SunlightDirection,samplePoint)/height;float cameraAngle=dot(eyeRay,samplePoint)/height;float scatter=(startOffset+depth*(scaleAngle(lightAngle)-scaleAngle(cameraAngle)));vec3 attenuate=exp(-clamp(scatter,0.0,MAX_SCATTER)*(invWavelength*kr4PI+km4PI));frontColor+=attenuate*(depth*scaledLength);samplePoint+=sampleRay;}{float height=length(samplePoint);float depth=exp(scaleOverScaleDepth*(innerRadius-height));float lightAngle=dot(-scene_SunlightDirection,samplePoint)/height;float cameraAngle=dot(eyeRay,samplePoint)/height;float scatter=(startOffset+depth*(scaleAngle(lightAngle)-scaleAngle(cameraAngle)));vec3 attenuate=exp(-clamp(scatter,0.0,MAX_SCATTER)*(invWavelength*kr4PI+km4PI));frontColor+=attenuate*(depth*scaledLength);samplePoint+=sampleRay;}cIn=frontColor*(invWavelength*krESun);cOut=frontColor*kmESun;}else{far=(-cameraHeight)/(min(-0.001,eyeRay.y));vec3 pos=cameraPos+far*eyeRay;float depth=exp((-cameraHeight)*(1.0/scaleDepth));float cameraAngle=dot(-eyeRay,pos);float lightAngle=dot(-scene_SunlightDirection,pos);float cameraScale=scaleAngle(cameraAngle);float lightScale=scaleAngle(lightAngle);float cameraOffset=depth*cameraScale;float temp=lightScale+cameraScale;float sampleLength=far/samples;float scaledLength=sampleLength*scale;vec3 sampleRay=eyeRay*sampleLength;vec3 samplePoint=cameraPos+sampleRay*0.5;vec3 frontColor=vec3(0.0,0.0,0.0);vec3 attenuate;{float height=length(samplePoint);float depth=exp(scaleOverScaleDepth*(innerRadius-height));float scatter=depth*temp-cameraOffset;attenuate=exp(-clamp(scatter,0.0,MAX_SCATTER)*(invWavelength*kr4PI+km4PI));frontColor+=attenuate*(depth*scaledLength);samplePoint+=sampleRay;}cIn=frontColor*(invWavelength*krESun+kmESun);cOut=clamp(attenuate,0.0,1.0);}\n#ifdef MATERIAL_SUN_HIGH_QUALITY\nv_Vertex=-POSITION.xyz;\n#elif defined(MATERIAL_SUN_SIMPLE)\nv_RayDir=-eyeRay;\n#else\nv_SkyGroundFactor=-eyeRay.y/SKY_GROUND_THRESHOLD;\n#endif\nv_GroundColor=material_Exposure*(cIn+COLOR_2_LINEAR(material_GroundTint)*cOut);v_SkyColor=material_Exposure*(cIn*getRayleighPhase(-scene_SunlightDirection,-eyeRay));float lightColorIntensity=clamp(length(scene_SunlightColor.xyz),0.25,1.0);\n#ifdef MATERIAL_SUN_HIGH_QUALITY\nv_SunColor=HDSundiskIntensityFactor*clamp(cOut,0.0,1.0)*scene_SunlightColor.xyz/lightColorIntensity;\n#elif defined(MATERIAL_SUN_SIMPLE)\nv_SunColor=simpleSundiskIntensityFactor*clamp(cOut*sunScale,0.0,1.0)*scene_SunlightColor.xyz/lightColorIntensity;\n#endif\n}"; // eslint-disable-line
27765
27780
  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
27766
- 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
27781
+ 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
27767
27782
  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
27768
27783
  var blinnPhongVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\n#include <blendShape_input>\n#include <uv_share>\n#include <color_share>\n#include <normal_share>\n#include <worldpos_share>\n#include <ShadowVertexDeclaration>\n#include <FogVertexDeclaration>\nvoid main(){\n#include <begin_position_vert>\n#include <begin_normal_vert>\n#include <blendShape_vert>\n#include <skinning_vert>\n#include <uv_vert>\n#include <color_vert>\n#include <normal_vert>\n#include <worldpos_vert>\n#include <position_vert>\n#include <ShadowVertex>\n#include <FogVertex>\n}"; // eslint-disable-line
27769
27784
  var depthOnlyFs = "#define GLSLIFY 1\nvoid main(){}"; // eslint-disable-line
27770
27785
  var depthOnlyVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\n#include <blendShape_input>\nuniform mat4 camera_VPMat;void main(){\n#include <begin_position_vert>\n#include <blendShape_vert>\n#include <skinning_vert>\n#include <position_vert>\n}"; // eslint-disable-line
27771
27786
  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
27772
- 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
27787
+ 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
27773
27788
  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
27774
27789
  var pbrFs = "#define GLSLIFY 1\n#define IS_METALLIC_WORKFLOW\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
27775
27790
  var pbrVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\n#include <blendShape_input>\n#include <uv_share>\n#include <color_share>\n#include <normal_share>\n#include <worldpos_share>\n#include <ShadowVertexDeclaration>\n#include <FogVertexDeclaration>\nvoid main(){\n#include <begin_position_vert>\n#include <begin_normal_vert>\n#include <blendShape_vert>\n#include <skinning_vert>\n#include <uv_vert>\n#include <color_vert>\n#include <normal_vert>\n#include <worldpos_vert>\n#include <position_vert>\n#include <ShadowVertex>\n#include <FogVertex>\n}"; // eslint-disable-line
@@ -31096,7 +31111,12 @@
31096
31111
  */ var Loader = /*#__PURE__*/ function() {
31097
31112
  var Loader = function Loader(useCache) {
31098
31113
  this.useCache = useCache;
31099
- this.request = request;
31114
+ };
31115
+ var _proto = Loader.prototype;
31116
+ _proto.request = function request1(url, resourceManager, config) {
31117
+ var _resourceManager__virtualPathMap_url;
31118
+ var remoteUrl = (_resourceManager__virtualPathMap_url = resourceManager._virtualPathMap[url]) != null ? _resourceManager__virtualPathMap_url : url;
31119
+ return request(remoteUrl, config);
31100
31120
  };
31101
31121
  /**
31102
31122
  * Register a class with a string name for serialization and deserialization.
@@ -35999,6 +36019,7 @@
35999
36019
  })(exports.ParticleScaleMode || (exports.ParticleScaleMode = {}));
36000
36020
  var MainModule = /*#__PURE__*/ function() {
36001
36021
  var MainModule = function MainModule(generator) {
36022
+ this._tempVector40 = new Vector4();
36002
36023
  /** The duration of the Particle Generator in seconds. */ this.duration = 5.0;
36003
36024
  /** Specifies whether the Particle Generator loops. */ this.isLoop = true;
36004
36025
  /** Start delay in seconds. */ this.startDelay = new ParticleCompositeCurve(0);
@@ -36020,7 +36041,6 @@
36020
36041
  this._gravityModifierRand = new Rand(0, ParticleRandomSubSeeds.GravityModifier);
36021
36042
  this._startSize3D = false;
36022
36043
  this._simulationSpace = exports.ParticleSimulationSpace.Local;
36023
- this._gravity = new Vector3();
36024
36044
  this._generator = generator;
36025
36045
  this.startLifetime = new ParticleCompositeCurve(5);
36026
36046
  this.startSpeed = new ParticleCompositeCurve(5);
@@ -36060,8 +36080,7 @@
36060
36080
  case exports.ParticleSimulationSpace.Local:
36061
36081
  shaderData.setVector3(MainModule._worldPosition, transform.worldPosition);
36062
36082
  var worldRotation = transform.worldRotationQuaternion;
36063
- var worldRotationV4 = MainModule._tempVector40;
36064
- worldRotationV4.copyFrom(worldRotation);
36083
+ var worldRotationV4 = this._tempVector40.copyFrom(worldRotation); // Maybe shaderData should support Quaternion
36065
36084
  shaderData.setVector4(MainModule._worldRotation, worldRotationV4);
36066
36085
  break;
36067
36086
  case exports.ParticleSimulationSpace.World:
@@ -36085,10 +36104,7 @@
36085
36104
  shaderData.setVector3(MainModule._sizeScale, MainModule._vector3One);
36086
36105
  break;
36087
36106
  }
36088
- var particleGravity = this._gravity;
36089
- var gravityModifierValue = this.gravityModifier.evaluate(undefined, this._gravityModifierRand.random());
36090
- Vector3.scale(renderer.scene.physics.gravity, gravityModifierValue, particleGravity);
36091
- shaderData.setVector3(MainModule._gravity, particleGravity);
36107
+ shaderData.setVector3(MainModule._gravity, renderer.scene.physics.gravity);
36092
36108
  shaderData.setInt(MainModule._simulationSpace, this.simulationSpace);
36093
36109
  shaderData.setFloat(MainModule._startRotation3D, +this.startRotation3D);
36094
36110
  shaderData.setInt(MainModule._scaleMode, this.scalingMode);
@@ -36256,9 +36272,6 @@
36256
36272
  ]);
36257
36273
  return MainModule;
36258
36274
  }();
36259
- (function() {
36260
- MainModule._tempVector40 = new Vector4();
36261
- })();
36262
36275
  (function() {
36263
36276
  MainModule._vector3One = new Vector3(1, 1, 1);
36264
36277
  })();
@@ -36343,9 +36356,6 @@
36343
36356
  __decorate$1([
36344
36357
  ignoreClone
36345
36358
  ], MainModule.prototype, "_generator", void 0);
36346
- __decorate$1([
36347
- ignoreClone
36348
- ], MainModule.prototype, "_gravity", void 0);
36349
36359
  /**
36350
36360
  * Rotate particles throughout their lifetime.
36351
36361
  */ var RotationOverLifetimeModule = /*#__PURE__*/ function(ParticleGeneratorModule1) {
@@ -37609,8 +37619,15 @@
37609
37619
  }
37610
37620
  // Start speed
37611
37621
  instanceVertices[offset + 18] = startSpeed;
37612
- // Unused, Color, size, rotation,
37613
- // instanceVertices[offset + 19] = rand.random();
37622
+ // Gravity, unused, size, rotation
37623
+ switch(main.gravityModifier.mode){
37624
+ case exports.ParticleCurveMode.Constant:
37625
+ instanceVertices[offset + 19] = main.gravityModifier.constant;
37626
+ break;
37627
+ case exports.ParticleCurveMode.TwoConstants:
37628
+ instanceVertices[offset + 19] = main.gravityModifier.evaluate(undefined, main._gravityModifierRand.random());
37629
+ break;
37630
+ }
37614
37631
  var colorOverLifetime = this.colorOverLifetime;
37615
37632
  if (colorOverLifetime.enabled && colorOverLifetime.color.mode === exports.ParticleGradientMode.TwoGradients) {
37616
37633
  instanceVertices[offset + 20] = colorOverLifetime._colorGradientRand.random();
@@ -42270,6 +42287,17 @@
42270
42287
  exports.AnimationClipDecoder = __decorate([
42271
42288
  decoder("AnimationClip")
42272
42289
  ], exports.AnimationClipDecoder);
42290
+ exports.MaterialLoaderType = void 0;
42291
+ (function(MaterialLoaderType) {
42292
+ MaterialLoaderType["Vector2"] = "Vector2";
42293
+ MaterialLoaderType["Vector3"] = "Vector3";
42294
+ MaterialLoaderType["Vector4"] = "Vector4";
42295
+ MaterialLoaderType["Color"] = "Color";
42296
+ MaterialLoaderType["Float"] = "Float";
42297
+ MaterialLoaderType["Texture"] = "Texture";
42298
+ MaterialLoaderType["Boolean"] = "Boolean";
42299
+ MaterialLoaderType["Integer"] = "Integer";
42300
+ })(exports.MaterialLoaderType || (exports.MaterialLoaderType = {}));
42273
42301
  exports.SpecularMode = void 0;
42274
42302
  (function(SpecularMode) {
42275
42303
  SpecularMode["Sky"] = "Sky";
@@ -42643,31 +42671,6 @@
42643
42671
  };
42644
42672
  return SceneParser;
42645
42673
  }(HierarchyParser);
42646
- exports.MeshLoader = /*#__PURE__*/ function(Loader1) {
42647
- var MeshLoader = function MeshLoader() {
42648
- return Loader1.apply(this, arguments);
42649
- };
42650
- _inherits(MeshLoader, Loader1);
42651
- var _proto = MeshLoader.prototype;
42652
- _proto.load = function load(item, resourceManager) {
42653
- var _this = this;
42654
- return new AssetPromise(function(resolve, reject) {
42655
- _this.request(item.url, _extends({}, item, {
42656
- type: "arraybuffer"
42657
- })).then(function(data) {
42658
- decode(data, resourceManager.engine).then(function(mesh) {
42659
- resolve(mesh);
42660
- });
42661
- }).catch(reject);
42662
- });
42663
- };
42664
- return MeshLoader;
42665
- }(Loader);
42666
- exports.MeshLoader = __decorate([
42667
- resourceLoader("Mesh", [
42668
- "prefab"
42669
- ], true)
42670
- ], exports.MeshLoader);
42671
42674
  exports.EditorTextureLoader = /*#__PURE__*/ function(Loader1) {
42672
42675
  var EditorTextureLoader = function EditorTextureLoader() {
42673
42676
  return Loader1.apply(this, arguments);
@@ -42677,7 +42680,7 @@
42677
42680
  _proto.load = function load(item, resourceManager) {
42678
42681
  var _this = this;
42679
42682
  return new AssetPromise(function(resolve, reject) {
42680
- _this.request(item.url, _extends({}, item, {
42683
+ _this.request(item.url, resourceManager, _extends({}, item, {
42681
42684
  type: "arraybuffer"
42682
42685
  })).then(function(data) {
42683
42686
  decode(data, resourceManager.engine).then(function(texture) {
@@ -42715,7 +42718,7 @@
42715
42718
  _proto.load = function load(item, resourceManager) {
42716
42719
  var _this = this;
42717
42720
  return new AssetPromise(function(resolve, reject) {
42718
- _this.request(item.url, _extends({}, item, {
42721
+ _this.request(item.url, resourceManager, _extends({}, item, {
42719
42722
  type: "arraybuffer"
42720
42723
  })).then(function(data) {
42721
42724
  return decode(data, resourceManager.engine).then(function(clip) {
@@ -42766,7 +42769,7 @@
42766
42769
  _proto.load = function load(item, resourceManager) {
42767
42770
  var _this = this;
42768
42771
  return new AssetPromise(function(resolve, reject) {
42769
- _this.request(item.url, _extends({}, item, {
42772
+ _this.request(item.url, resourceManager, _extends({}, item, {
42770
42773
  type: "json"
42771
42774
  })).then(function(data) {
42772
42775
  var animatorController = new AnimatorController(resourceManager.engine);
@@ -42870,7 +42873,7 @@
42870
42873
  };
42871
42874
  _inherits(BufferLoader, Loader1);
42872
42875
  var _proto = BufferLoader.prototype;
42873
- _proto.load = function load(item) {
42876
+ _proto.load = function load(item, resourceManager) {
42874
42877
  var url = item.url;
42875
42878
  if (isBase64(url)) {
42876
42879
  return new AssetPromise(function(resolve) {
@@ -42881,7 +42884,7 @@
42881
42884
  resolve(result.buffer);
42882
42885
  });
42883
42886
  }
42884
- return this.request(url, _extends({}, item, {
42887
+ return this.request(url, resourceManager, _extends({}, item, {
42885
42888
  type: "arraybuffer"
42886
42889
  }));
42887
42890
  };
@@ -42902,7 +42905,7 @@
42902
42905
  _proto.load = function load(item, resourceManager) {
42903
42906
  var _this = this;
42904
42907
  return new AssetPromise(function(resolve, reject) {
42905
- _this.request(item.url, _extends({}, item, {
42908
+ _this.request(item.url, resourceManager, _extends({}, item, {
42906
42909
  type: "arraybuffer"
42907
42910
  })).then(function(arraybuffer) {
42908
42911
  var _this;
@@ -42978,7 +42981,7 @@
42978
42981
  _proto.load = function load(item, resourceManager) {
42979
42982
  var _this = this;
42980
42983
  return new AssetPromise(function(resolve, reject) {
42981
- _this.request(item.url, _extends({}, item, {
42984
+ _this.request(item.url, resourceManager, _extends({}, item, {
42982
42985
  type: "json"
42983
42986
  })).then(function(data) {
42984
42987
  var fontName = data.fontName, fontUrl = data.fontUrl;
@@ -44622,7 +44625,7 @@
44622
44625
  */ _proto.load = function load(item, resourceManager) {
44623
44626
  var _this = this;
44624
44627
  return new AssetPromise(function(resolve, reject, setTaskCompleteProgress, setTaskDetailProgress) {
44625
- _this.request(item.url, {
44628
+ _this.request(item.url, resourceManager, {
44626
44629
  type: "arraybuffer"
44627
44630
  }).onProgress(setTaskCompleteProgress, setTaskDetailProgress).then(function(buffer) {
44628
44631
  return exports.KTX2Loader._parseBuffer(new Uint8Array(buffer), resourceManager.engine, item.params).then(function(param) {
@@ -45157,8 +45160,11 @@
45157
45160
  var requestConfig = {
45158
45161
  type: "arraybuffer"
45159
45162
  };
45160
- return request(url, requestConfig).onProgress(undefined, context._onTaskDetail).then(function(buffer) {
45161
- restoreBufferRequests.push(new BufferRequestInfo(url, requestConfig));
45163
+ var _context_resourceManager__virtualPathMap_url;
45164
+ // @ts-ignore
45165
+ var remoteUrl = (_context_resourceManager__virtualPathMap_url = context.resourceManager._virtualPathMap[url]) != null ? _context_resourceManager__virtualPathMap_url : url;
45166
+ return request(remoteUrl, requestConfig).onProgress(undefined, context._onTaskDetail).then(function(buffer) {
45167
+ restoreBufferRequests.push(new BufferRequestInfo(remoteUrl, requestConfig));
45162
45168
  return GLTFUtils.parseGLB(context, buffer);
45163
45169
  }).then(function(result) {
45164
45170
  var _result;
@@ -45384,11 +45390,14 @@
45384
45390
  _proto._parseSingleBuffer = function _parseSingleBuffer(context, bufferInfo) {
45385
45391
  var glTFResource = context.glTFResource, contentRestorer = context.contentRestorer;
45386
45392
  var url = glTFResource.url;
45393
+ var _context_resourceManager__virtualPathMap_url;
45394
+ // @ts-ignore
45395
+ var remoteUrl = (_context_resourceManager__virtualPathMap_url = context.resourceManager._virtualPathMap[url]) != null ? _context_resourceManager__virtualPathMap_url : url;
45387
45396
  var restoreBufferRequests = contentRestorer.bufferRequests;
45388
45397
  var requestConfig = {
45389
45398
  type: "arraybuffer"
45390
45399
  };
45391
- var absoluteUrl = Utils.resolveAbsoluteUrl(url, bufferInfo.uri);
45400
+ var absoluteUrl = Utils.resolveAbsoluteUrl(remoteUrl, bufferInfo.uri);
45392
45401
  restoreBufferRequests.push(new BufferRequestInfo(absoluteUrl, requestConfig));
45393
45402
  var promise = request(absoluteUrl, requestConfig).onProgress(undefined, context._onTaskDetail);
45394
45403
  context._addTaskCompletePromise(promise);
@@ -46421,9 +46430,8 @@
46421
46430
  return Promise.resolve();
46422
46431
  };
46423
46432
  _proto.load = function load(item, resourceManager) {
46424
- var url = item.url;
46425
46433
  var params = item.params;
46426
- var glTFResource = new GLTFResource(resourceManager.engine, url);
46434
+ var glTFResource = new GLTFResource(resourceManager.engine, item.url);
46427
46435
  var context = new GLTFParserContext(glTFResource, resourceManager, _extends({
46428
46436
  keepMeshData: false
46429
46437
  }, params));
@@ -46488,7 +46496,7 @@
46488
46496
  var _this = this;
46489
46497
  var engine = resourceManager.engine;
46490
46498
  return new AssetPromise(function(resolve, reject) {
46491
- _this.request(item.url, _extends({}, item, {
46499
+ _this.request(item.url, resourceManager, _extends({}, item, {
46492
46500
  type: "json"
46493
46501
  })).then(function(data) {
46494
46502
  PrefabParser.parse(engine, item.url, data).then(resolve).catch(reject);
@@ -46514,7 +46522,7 @@
46514
46522
  var _this = this;
46515
46523
  return new AssetPromise(function(resolve, reject) {
46516
46524
  var engine = resourceManager.engine;
46517
- _this.request(item.url, _extends({}, item, {
46525
+ _this.request(item.url, resourceManager, _extends({}, item, {
46518
46526
  type: "arraybuffer"
46519
46527
  })).then(function(buffer) {
46520
46528
  var uint8Array = new Uint8Array(buffer);
@@ -46828,8 +46836,8 @@
46828
46836
  };
46829
46837
  _inherits(JSONLoader, Loader1);
46830
46838
  var _proto = JSONLoader.prototype;
46831
- _proto.load = function load(item) {
46832
- return this.request(item.url, _extends({}, item, {
46839
+ _proto.load = function load(item, resourceManager) {
46840
+ return this.request(item.url, resourceManager, _extends({}, item, {
46833
46841
  type: "json"
46834
46842
  }));
46835
46843
  };
@@ -47033,7 +47041,7 @@
47033
47041
  var _this = this;
47034
47042
  return new AssetPromise(function(resolve, reject) {
47035
47043
  Promise.all(item.urls.map(function(url) {
47036
- return _this.request(url, _extends({}, item, {
47044
+ return _this.request(url, resourceManager, _extends({}, item, {
47037
47045
  type: "arraybuffer"
47038
47046
  }));
47039
47047
  })).then(function(data) {
@@ -47068,7 +47076,7 @@
47068
47076
  _proto.load = function load(item, resourceManager) {
47069
47077
  var _this = this;
47070
47078
  return new AssetPromise(function(resolve, reject) {
47071
- _this.request(item.url, _extends({}, item, {
47079
+ _this.request(item.url, resourceManager, _extends({}, item, {
47072
47080
  type: "arraybuffer"
47073
47081
  })).then(function(bin) {
47074
47082
  var parsedData = parseSingleKTX(bin);
@@ -47110,62 +47118,75 @@
47110
47118
  _proto.load = function load(item, resourceManager) {
47111
47119
  var _this = this;
47112
47120
  return new AssetPromise(function(resolve, reject) {
47113
- _this.request(item.url, _extends({}, item, {
47121
+ _this.request(item.url, resourceManager, _extends({}, item, {
47114
47122
  type: "json"
47115
47123
  })).then(function(materialSchema) {
47116
- var _loop = function _loop(key) {
47117
- var _shaderData_key = shaderData[key], type = _shaderData_key.type, value = _shaderData_key.value;
47118
- switch(type){
47119
- case "Vector2":
47120
- materialShaderData.setVector2(key, new Vector2(value.x, value.y));
47121
- break;
47122
- case "Vector3":
47123
- materialShaderData.setVector3(key, new Vector3(value.x, value.y, value.z));
47124
- break;
47125
- case "Vector4":
47126
- materialShaderData.setVector4(key, new Vector4(value.x, value.y, value.z, value.w));
47127
- break;
47128
- case "Color":
47129
- materialShaderData.setColor(key, new Color(value.r, value.g, value.b, value.a));
47130
- break;
47131
- case "Float":
47132
- materialShaderData.setFloat(key, value);
47133
- break;
47134
- case "Texture":
47135
- texturePromises.push(resourceManager.getResourceByRef(value).then(function(texture) {
47136
- materialShaderData.setTexture(key, texture);
47137
- }));
47138
- break;
47139
- case "Boolean":
47140
- materialShaderData.setInt(key, value ? 1 : 0);
47141
- break;
47142
- case "Integer":
47143
- materialShaderData.setInt(key, Number(value));
47144
- break;
47145
- }
47146
- };
47147
47124
  var engine = resourceManager.engine;
47148
- var name = materialSchema.name, shader = materialSchema.shader, shaderData = materialSchema.shaderData, macros = materialSchema.macros, renderState = materialSchema.renderState;
47149
- var material = new Material(engine, Shader.find(shader));
47150
- material.name = name;
47151
- var texturePromises = new Array();
47152
- var materialShaderData = material.shaderData;
47153
- for(var key in shaderData)_loop(key);
47154
- for(var i = 0, length = macros.length; i < length; i++){
47155
- var _macros_i = macros[i], name1 = _macros_i.name, value = _macros_i.value;
47156
- if (value == undefined) {
47157
- materialShaderData.enableMacro(name1);
47158
- } else {
47159
- materialShaderData.enableMacro(name1, value);
47160
- }
47125
+ var shaderRef = materialSchema.shaderRef, shaderName = materialSchema.shader;
47126
+ if (shaderRef) {
47127
+ resolve(resourceManager // @ts-ignore
47128
+ .getResourceByRef(shaderRef).then(function(shader) {
47129
+ return _this.getMaterialByShader(materialSchema, shader, engine);
47130
+ }));
47131
+ } else {
47132
+ // compatible with 1.2-pre version material schema
47133
+ var shader = Shader.find(shaderName);
47134
+ resolve(_this.getMaterialByShader(materialSchema, shader, engine));
47161
47135
  }
47162
- parseProperty(material, "renderState", renderState);
47163
- return Promise.all(texturePromises).then(function() {
47164
- resolve(material);
47165
- });
47166
47136
  }).catch(reject);
47167
47137
  });
47168
47138
  };
47139
+ _proto.getMaterialByShader = function getMaterialByShader(materialSchema, shader, engine) {
47140
+ var _loop = function _loop(key) {
47141
+ var _shaderData_key = shaderData[key], type = _shaderData_key.type, value = _shaderData_key.value;
47142
+ switch(type){
47143
+ case exports.MaterialLoaderType.Vector2:
47144
+ materialShaderData.setVector2(key, new Vector2(value.x, value.y));
47145
+ break;
47146
+ case exports.MaterialLoaderType.Vector3:
47147
+ materialShaderData.setVector3(key, new Vector3(value.x, value.y, value.z));
47148
+ break;
47149
+ case exports.MaterialLoaderType.Vector4:
47150
+ materialShaderData.setVector4(key, new Vector4(value.x, value.y, value.z, value.w));
47151
+ break;
47152
+ case exports.MaterialLoaderType.Color:
47153
+ materialShaderData.setColor(key, new Color(value.r, value.g, value.b, value.a));
47154
+ break;
47155
+ case exports.MaterialLoaderType.Float:
47156
+ materialShaderData.setFloat(key, value);
47157
+ break;
47158
+ case exports.MaterialLoaderType.Texture:
47159
+ texturePromises.push(engine.resourceManager.getResourceByRef(value).then(function(texture) {
47160
+ materialShaderData.setTexture(key, texture);
47161
+ }));
47162
+ break;
47163
+ case exports.MaterialLoaderType.Boolean:
47164
+ materialShaderData.setInt(key, value ? 1 : 0);
47165
+ break;
47166
+ case exports.MaterialLoaderType.Integer:
47167
+ materialShaderData.setInt(key, Number(value));
47168
+ break;
47169
+ }
47170
+ };
47171
+ var name = materialSchema.name, shaderData = materialSchema.shaderData, macros = materialSchema.macros, renderState = materialSchema.renderState;
47172
+ var material = new Material(engine, shader);
47173
+ material.name = name;
47174
+ var texturePromises = new Array();
47175
+ var materialShaderData = material.shaderData;
47176
+ for(var key in shaderData)_loop(key);
47177
+ for(var i = 0, length = macros.length; i < length; i++){
47178
+ var _macros_i = macros[i], name1 = _macros_i.name, value = _macros_i.value;
47179
+ if (value == undefined) {
47180
+ materialShaderData.enableMacro(name1);
47181
+ } else {
47182
+ materialShaderData.enableMacro(name1, value);
47183
+ }
47184
+ }
47185
+ parseProperty(material, "renderState", renderState);
47186
+ return Promise.all(texturePromises).then(function() {
47187
+ return material;
47188
+ });
47189
+ };
47169
47190
  return MaterialLoader;
47170
47191
  }(Loader);
47171
47192
  MaterialLoader = __decorate([
@@ -47173,40 +47194,15 @@
47173
47194
  "json"
47174
47195
  ])
47175
47196
  ], MaterialLoader);
47176
- var MeshLoader = /*#__PURE__*/ function(Loader1) {
47177
- var MeshLoader = function MeshLoader() {
47178
- return Loader1.apply(this, arguments);
47179
- };
47180
- _inherits(MeshLoader, Loader1);
47181
- var _proto = MeshLoader.prototype;
47182
- _proto.load = function load(item, resourceManager) {
47183
- var _this = this;
47184
- return new AssetPromise(function(resolve, reject) {
47185
- _this.request(item.url, _extends({}, item, {
47186
- type: "arraybuffer"
47187
- })).then(function(data) {
47188
- return decode(data, resourceManager.engine);
47189
- }).then(function(mesh) {
47190
- resolve(mesh);
47191
- }).catch(reject);
47192
- });
47193
- };
47194
- return MeshLoader;
47195
- }(Loader);
47196
- MeshLoader = __decorate([
47197
- resourceLoader(exports.AssetType.Mesh, [
47198
- "mesh"
47199
- ])
47200
- ], MeshLoader);
47201
47197
  var PrimitiveMeshLoader = /*#__PURE__*/ function(Loader1) {
47202
47198
  var PrimitiveMeshLoader = function PrimitiveMeshLoader() {
47203
47199
  return Loader1.apply(this, arguments);
47204
47200
  };
47205
47201
  _inherits(PrimitiveMeshLoader, Loader1);
47206
47202
  var _proto = PrimitiveMeshLoader.prototype;
47207
- _proto.load = function load(item, param) {
47208
- var engine = param.engine;
47209
- return this.request(item.url, _extends({}, item, {
47203
+ _proto.load = function load(item, resourceManager) {
47204
+ var engine = resourceManager.engine;
47205
+ return this.request(item.url, resourceManager, _extends({}, item, {
47210
47206
  type: "json"
47211
47207
  })).then(function(data) {
47212
47208
  switch(data.type){
@@ -47254,7 +47250,7 @@
47254
47250
  var _this = this;
47255
47251
  var engine = resourceManager.engine;
47256
47252
  return new AssetPromise(function(resolve, reject) {
47257
- _this.request(item.url, _extends({}, item, {
47253
+ _this.request(item.url, resourceManager, _extends({}, item, {
47258
47254
  type: "json"
47259
47255
  })).then(function(data) {
47260
47256
  // @ts-ignore
@@ -47285,7 +47281,9 @@
47285
47281
  _proto.load = function load(item, resourceManager) {
47286
47282
  var _this = this;
47287
47283
  return new AssetPromise(function(resolve, reject) {
47288
- var url = item.url;
47284
+ var _resourceManager__virtualPathMap_item_url;
47285
+ // @ts-ignore
47286
+ var url = (_resourceManager__virtualPathMap_item_url = resourceManager._virtualPathMap[item.url]) != null ? _resourceManager__virtualPathMap_item_url : item.url;
47289
47287
  _this._registerFont(url, url).then(function() {
47290
47288
  var font = new Font(resourceManager.engine, url);
47291
47289
  resolve(font);
@@ -47344,7 +47342,7 @@
47344
47342
  chainPromises[i].cancel();
47345
47343
  }
47346
47344
  });
47347
- var configPromise = _this.request(item.url, _extends({}, item, {
47345
+ var configPromise = _this.request(item.url, resourceManager, _extends({}, item, {
47348
47346
  type: "json"
47349
47347
  }));
47350
47348
  chainPromises.push(configPromise);
@@ -47426,7 +47424,7 @@
47426
47424
  var _proto = SpriteLoader.prototype;
47427
47425
  _proto.load = function load(item, resourceManager) {
47428
47426
  var _this = this;
47429
- return this.request(item.url, _extends({}, item, {
47427
+ return this.request(item.url, resourceManager, _extends({}, item, {
47430
47428
  type: "json"
47431
47429
  })).then(function(data) {
47432
47430
  return data.belongToAtlas ? _this._loadFromAtlas(resourceManager, data) : _this._loadFromTexture(resourceManager, data);
@@ -47502,7 +47500,7 @@
47502
47500
  var requestConfig = _extends({}, item, {
47503
47501
  type: "image"
47504
47502
  });
47505
- _this.request(url, requestConfig).onProgress(setTaskCompleteProgress, setTaskDetailProgress).then(function(image) {
47503
+ _this.request(url, resourceManager, requestConfig).onProgress(setTaskCompleteProgress, setTaskDetailProgress).then(function(image) {
47506
47504
  var _item_params;
47507
47505
  var _ref = (_item_params = item.params) != null ? _item_params : {}, format = _ref.format, mipmap = _ref.mipmap, anisoLevel = _ref.anisoLevel, wrapModeU = _ref.wrapModeU, wrapModeV = _ref.wrapModeV, filterMode = _ref.filterMode;
47508
47506
  var texture = new Texture2D(resourceManager.engine, image.width, image.height, format, mipmap);
@@ -47578,7 +47576,7 @@
47578
47576
  type: "image"
47579
47577
  });
47580
47578
  Promise.all(urls.map(function(url) {
47581
- return _this.request(url, requestConfig);
47579
+ return _this.request(url, resourceManager, requestConfig);
47582
47580
  })).then(function(images) {
47583
47581
  var _images_ = images[0], width = _images_.width, height = _images_.height;
47584
47582
  if (width !== height) {
@@ -47604,6 +47602,89 @@
47604
47602
  ""
47605
47603
  ])
47606
47604
  ], TextureCubeLoader);
47605
+ var _ShaderChunkLoader;
47606
+ var ShaderChunkLoader = (_ShaderChunkLoader = /*#__PURE__*/ function(Loader1) {
47607
+ var ShaderChunkLoader1 = function ShaderChunkLoader1() {
47608
+ return Loader1.apply(this, arguments);
47609
+ };
47610
+ _inherits(ShaderChunkLoader1, Loader1);
47611
+ var _proto = ShaderChunkLoader1.prototype;
47612
+ _proto.load = function load(item, resourceManager) {
47613
+ var url = item.url;
47614
+ return this.request(url, resourceManager, _extends({}, item, {
47615
+ type: "text"
47616
+ })).then(function(code) {
47617
+ ShaderFactory.registerInclude(url.substring(1), code);
47618
+ return ShaderChunkLoader._loadChunksInCode(code, url, resourceManager);
47619
+ });
47620
+ };
47621
+ /**
47622
+ * @internal
47623
+ */ ShaderChunkLoader1._loadChunksInCode = function _loadChunksInCode(code, basePath, resourceManager) {
47624
+ var shaderChunkPaths = new Array();
47625
+ var matches = code.matchAll(ShaderChunkLoader._shaderIncludeRegex);
47626
+ for(var _iterator = _create_for_of_iterator_helper_loose(matches), _step; !(_step = _iterator()).done;){
47627
+ var match = _step.value;
47628
+ var chunkPath = Utils.resolveAbsoluteUrl(basePath, match[1]);
47629
+ if (!ShaderLib[chunkPath.substring(1)]) {
47630
+ shaderChunkPaths.push(chunkPath);
47631
+ }
47632
+ }
47633
+ return Promise.all(shaderChunkPaths.map(function(chunkPath) {
47634
+ return resourceManager.load({
47635
+ type: "ShaderChunk",
47636
+ url: chunkPath
47637
+ });
47638
+ }));
47639
+ };
47640
+ return ShaderChunkLoader1;
47641
+ }(Loader), function() {
47642
+ _ShaderChunkLoader._shaderIncludeRegex = /\s#include\s+"([./][^\\"]+)"/gm;
47643
+ }(), _ShaderChunkLoader);
47644
+ ShaderChunkLoader = __decorate([
47645
+ resourceLoader("ShaderChunk", [
47646
+ "glsl"
47647
+ ])
47648
+ ], ShaderChunkLoader);
47649
+ var _ShaderLoader;
47650
+ var ShaderLoader = (_ShaderLoader = /*#__PURE__*/ function(Loader1) {
47651
+ var ShaderLoader1 = function ShaderLoader1() {
47652
+ return Loader1.apply(this, arguments);
47653
+ };
47654
+ _inherits(ShaderLoader1, Loader1);
47655
+ var _proto = ShaderLoader1.prototype;
47656
+ _proto.load = function load(item, resourceManager) {
47657
+ var _this = this;
47658
+ var url = item.url;
47659
+ return this.request(url, resourceManager, _extends({}, item, {
47660
+ type: "text"
47661
+ })).then(function(code) {
47662
+ var builtinShader = _this._getBuiltinShader(code);
47663
+ if (builtinShader) {
47664
+ return Shader.find(builtinShader);
47665
+ }
47666
+ return ShaderChunkLoader._loadChunksInCode(code, url, resourceManager).then(function() {
47667
+ var shader = Shader.create(code);
47668
+ // @ts-ignore
47669
+ shader._registerPath(url);
47670
+ return shader;
47671
+ });
47672
+ });
47673
+ };
47674
+ _proto._getBuiltinShader = function _getBuiltinShader(code) {
47675
+ var match = code.match(ShaderLoader._builtinRegex);
47676
+ if (match && match[1]) return match[1];
47677
+ };
47678
+ return ShaderLoader1;
47679
+ }(Loader), function() {
47680
+ _ShaderLoader._builtinRegex = /^\s*\/\/\s*@builtin\s+(\w+)/;
47681
+ }(), _ShaderLoader);
47682
+ ShaderLoader = __decorate([
47683
+ resourceLoader(exports.AssetType.Shader, [
47684
+ "gs",
47685
+ "gsl"
47686
+ ])
47687
+ ], ShaderLoader);
47607
47688
  var SceneLoader = /*#__PURE__*/ function(Loader1) {
47608
47689
  var SceneLoader = function SceneLoader() {
47609
47690
  return Loader1.apply(this, arguments);
@@ -47614,7 +47695,7 @@
47614
47695
  var _this = this;
47615
47696
  var engine = resourceManager.engine;
47616
47697
  return new AssetPromise(function(resolve, reject) {
47617
- _this.request(item.url, _extends({}, item, {
47698
+ _this.request(item.url, resourceManager, _extends({}, item, {
47618
47699
  type: "json"
47619
47700
  })).then(function(data) {
47620
47701
  return SceneParser.parse(engine, data).then(function(scene) {
@@ -48163,7 +48244,7 @@
48163
48244
  ], EXT_texture_webp);
48164
48245
 
48165
48246
  //@ts-ignore
48166
- var version = "1.3.15";
48247
+ var version = "1.3.17";
48167
48248
  console.log("Galacean engine version: " + version);
48168
48249
  for(var key in CoreObjects){
48169
48250
  Loader.registerClass(key, CoreObjects[key]);