@galacean/engine-loader 2.0.0-alpha.13 → 2.0.0-alpha.14

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 CHANGED
@@ -784,9 +784,7 @@ var ReflectionParser = /*#__PURE__*/ function() {
784
784
  for(var key in item.props)_this = this, _loop(key);
785
785
  }
786
786
  return Promise.all(promises).then(function() {
787
- var handle = ReflectionParser.customParseComponentHandles[instance.constructor.name];
788
- if (handle) return handle(instance, item);
789
- else return instance;
787
+ return instance;
790
788
  });
791
789
  };
792
790
  _proto.parseMethod = function parseMethod(instance, methodName, methodParams) {
@@ -889,9 +887,6 @@ var ReflectionParser = /*#__PURE__*/ function() {
889
887
  return Promise.resolve(entity);
890
888
  }
891
889
  };
892
- ReflectionParser.registerCustomParseComponent = function registerCustomParseComponent(componentType, handle) {
893
- this.customParseComponentHandles[componentType] = handle;
894
- };
895
890
  ReflectionParser._isClass = function _isClass(value) {
896
891
  return value["class"] !== undefined;
897
892
  };
@@ -912,7 +907,6 @@ var ReflectionParser = /*#__PURE__*/ function() {
912
907
  };
913
908
  return ReflectionParser;
914
909
  }();
915
- ReflectionParser.customParseComponentHandles = new Map();
916
910
 
917
911
  exports.Texture2DDecoder = /*#__PURE__*/ function() {
918
912
  function Texture2DDecoder() {}
@@ -6645,6 +6639,54 @@ PhysicsMaterialLoader = __decorate([
6645
6639
  ])
6646
6640
  ], PhysicsMaterialLoader);
6647
6641
 
6642
+ var RenderTargetLoader = /*#__PURE__*/ function(Loader) {
6643
+ _inherits(RenderTargetLoader, Loader);
6644
+ function RenderTargetLoader() {
6645
+ return Loader.apply(this, arguments) || this;
6646
+ }
6647
+ var _proto = RenderTargetLoader.prototype;
6648
+ _proto.load = function load(item, resourceManager) {
6649
+ var engine = resourceManager.engine;
6650
+ return resourceManager// @ts-ignore
6651
+ ._request(item.url, _extends({}, item, {
6652
+ type: "json"
6653
+ })).then(function(data) {
6654
+ var width = data.width, height = data.height, colorFormats = data.colorFormats, depthFormat = data.depthFormat, antiAliasing = data.antiAliasing, autoGenerateMipmaps = data.autoGenerateMipmaps;
6655
+ var colorTextureProps = data.colorTextures;
6656
+ var colorTextures = colorFormats.map(function(format, i) {
6657
+ var props = colorTextureProps == null ? void 0 : colorTextureProps[i];
6658
+ var _props_mipmap;
6659
+ var mipmap = (_props_mipmap = props == null ? void 0 : props.mipmap) != null ? _props_mipmap : true;
6660
+ var _props_isSRGBColorSpace;
6661
+ var isSRGB = (_props_isSRGBColorSpace = props == null ? void 0 : props.isSRGBColorSpace) != null ? _props_isSRGBColorSpace : format === engineCore.TextureFormat.R8G8B8A8;
6662
+ var texture = new engineCore.Texture2D(engine, width, height, format, mipmap, isSRGB);
6663
+ if (props) {
6664
+ if (props.filterMode != null) texture.filterMode = props.filterMode;
6665
+ if (props.wrapModeU != null) texture.wrapModeU = props.wrapModeU;
6666
+ if (props.wrapModeV != null) texture.wrapModeV = props.wrapModeV;
6667
+ if (props.anisoLevel != null) texture.anisoLevel = props.anisoLevel;
6668
+ }
6669
+ return texture;
6670
+ });
6671
+ var depth = depthFormat === -1 ? null : depthFormat;
6672
+ var rt = new engineCore.RenderTarget(engine, width, height, colorTextures, depth, antiAliasing);
6673
+ if (autoGenerateMipmaps != null) rt.autoGenerateMipmaps = autoGenerateMipmaps;
6674
+ // Notify pending sub-asset requests for colorTextures
6675
+ for(var i = 0, n = colorTextures.length; i < n; i++){
6676
+ // @ts-ignore
6677
+ resourceManager._onSubAssetSuccess(item.url, "colorTextures[" + i + "]", colorTextures[i]);
6678
+ }
6679
+ return rt;
6680
+ });
6681
+ };
6682
+ return RenderTargetLoader;
6683
+ }(engineCore.Loader);
6684
+ RenderTargetLoader = __decorate([
6685
+ engineCore.resourceLoader(engineCore.AssetType.RenderTarget, [
6686
+ "renderTarget"
6687
+ ])
6688
+ ], RenderTargetLoader);
6689
+
6648
6690
  var SceneLoader = /*#__PURE__*/ function(Loader) {
6649
6691
  _inherits(SceneLoader, Loader);
6650
6692
  function SceneLoader() {
@@ -6787,20 +6829,6 @@ SceneLoader = __decorate([
6787
6829
  "scene"
6788
6830
  ], true)
6789
6831
  ], SceneLoader);
6790
- ReflectionParser.registerCustomParseComponent("TextRenderer", /*#__PURE__*/ _async_to_generator(function(instance, item) {
6791
- var props;
6792
- return __generator(this, function(_state) {
6793
- props = item.props;
6794
- if (!props.font) {
6795
- // @ts-ignore
6796
- instance.font = engineCore.Font.createFromOS(instance.engine, props.fontFamily || "Arial");
6797
- }
6798
- return [
6799
- 2,
6800
- instance
6801
- ];
6802
- });
6803
- }));
6804
6832
 
6805
6833
  var KHR_lights_punctual = /*#__PURE__*/ function(GLTFExtensionParser) {
6806
6834
  _inherits(KHR_lights_punctual, GLTFExtensionParser);