@galacean/engine-loader 2.0.0-alpha.12 → 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 +49 -21
- package/dist/main.js.map +1 -1
- package/dist/module.js +50 -22
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/types/RenderTargetLoader.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/resource-deserialize/resources/parser/ReflectionParser.d.ts +0 -2
package/dist/module.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Utils, AssetPromise, AnimationClip, AnimationEvent, Loader, AnimationStringCurve, Keyframe, AnimationBoolCurve, AnimationRefCurve, AnimationQuaternionCurve, AnimationColorCurve, AnimationVector4Curve, AnimationVector3Curve, AnimationVector2Curve, AnimationFloatArrayCurve, AnimationArrayCurve, AnimationFloatCurve, ModelMesh, BlendShape, Entity, Transform, Texture2D, ReferResource, DiffuseMode, BackgroundMode, resourceLoader, AssetType, AnimatorController, AnimatorControllerLayer, AnimatorStateTransition, BufferAsset, GLCapabilityType, TextureCube, TextureCubeFace, Logger, TextureFormat, ContentRestorer, AmbientLight, TextureFilterMode, Font, SystemInfo, Animator, IndexFormat, VertexElementFormat, request, InterpolationType, SkinnedMeshRenderer, PBRMaterial, TextureCoordinate, RenderFace, VertexElement, Buffer, BufferBindFlag, BufferUsage, Camera, MeshRenderer, Skin, TextureWrapMode as TextureWrapMode$1, TextureUtils, AnimatorStateMachine, JSONAsset, Shader, Material, PrimitiveMesh, SpriteAtlas, Sprite, TextAsset, AudioClip, AudioManager, ShaderFactory, ShaderLib, PhysicsMaterial, Scene, DirectLight, PointLight, SpotLight, UnlitMaterial } from '@galacean/engine-core';
|
|
1
|
+
import { Utils, AssetPromise, AnimationClip, AnimationEvent, Loader, AnimationStringCurve, Keyframe, AnimationBoolCurve, AnimationRefCurve, AnimationQuaternionCurve, AnimationColorCurve, AnimationVector4Curve, AnimationVector3Curve, AnimationVector2Curve, AnimationFloatArrayCurve, AnimationArrayCurve, AnimationFloatCurve, ModelMesh, BlendShape, Entity, Transform, Texture2D, ReferResource, DiffuseMode, BackgroundMode, resourceLoader, AssetType, AnimatorController, AnimatorControllerLayer, AnimatorStateTransition, BufferAsset, GLCapabilityType, TextureCube, TextureCubeFace, Logger, TextureFormat, ContentRestorer, AmbientLight, TextureFilterMode, Font, SystemInfo, Animator, IndexFormat, VertexElementFormat, request, InterpolationType, SkinnedMeshRenderer, PBRMaterial, TextureCoordinate, RenderFace, VertexElement, Buffer, BufferBindFlag, BufferUsage, Camera, MeshRenderer, Skin, TextureWrapMode as TextureWrapMode$1, TextureUtils, AnimatorStateMachine, JSONAsset, Shader, Material, PrimitiveMesh, SpriteAtlas, Sprite, TextAsset, AudioClip, AudioManager, ShaderFactory, ShaderLib, PhysicsMaterial, RenderTarget, Scene, DirectLight, PointLight, SpotLight, UnlitMaterial } from '@galacean/engine-core';
|
|
2
2
|
import { Quaternion, Vector4, Color, Vector3, Vector2, MathUtil, SphericalHarmonics3, BoundingBox, Matrix, Rect } from '@galacean/engine-math';
|
|
3
3
|
import { GLCompressedTextureInternalFormat } from '@galacean/engine-rhi-webgl';
|
|
4
4
|
|
|
@@ -780,9 +780,7 @@ var ReflectionParser = /*#__PURE__*/ function() {
|
|
|
780
780
|
for(var key in item.props)_this = this, _loop(key);
|
|
781
781
|
}
|
|
782
782
|
return Promise.all(promises).then(function() {
|
|
783
|
-
|
|
784
|
-
if (handle) return handle(instance, item);
|
|
785
|
-
else return instance;
|
|
783
|
+
return instance;
|
|
786
784
|
});
|
|
787
785
|
};
|
|
788
786
|
_proto.parseMethod = function parseMethod(instance, methodName, methodParams) {
|
|
@@ -885,9 +883,6 @@ var ReflectionParser = /*#__PURE__*/ function() {
|
|
|
885
883
|
return Promise.resolve(entity);
|
|
886
884
|
}
|
|
887
885
|
};
|
|
888
|
-
ReflectionParser.registerCustomParseComponent = function registerCustomParseComponent(componentType, handle) {
|
|
889
|
-
this.customParseComponentHandles[componentType] = handle;
|
|
890
|
-
};
|
|
891
886
|
ReflectionParser._isClass = function _isClass(value) {
|
|
892
887
|
return value["class"] !== undefined;
|
|
893
888
|
};
|
|
@@ -908,7 +903,6 @@ var ReflectionParser = /*#__PURE__*/ function() {
|
|
|
908
903
|
};
|
|
909
904
|
return ReflectionParser;
|
|
910
905
|
}();
|
|
911
|
-
ReflectionParser.customParseComponentHandles = new Map();
|
|
912
906
|
|
|
913
907
|
var Texture2DDecoder = /*#__PURE__*/ function() {
|
|
914
908
|
function Texture2DDecoder() {}
|
|
@@ -6641,6 +6635,54 @@ PhysicsMaterialLoader = __decorate([
|
|
|
6641
6635
|
])
|
|
6642
6636
|
], PhysicsMaterialLoader);
|
|
6643
6637
|
|
|
6638
|
+
var RenderTargetLoader = /*#__PURE__*/ function(Loader) {
|
|
6639
|
+
_inherits(RenderTargetLoader, Loader);
|
|
6640
|
+
function RenderTargetLoader() {
|
|
6641
|
+
return Loader.apply(this, arguments) || this;
|
|
6642
|
+
}
|
|
6643
|
+
var _proto = RenderTargetLoader.prototype;
|
|
6644
|
+
_proto.load = function load(item, resourceManager) {
|
|
6645
|
+
var engine = resourceManager.engine;
|
|
6646
|
+
return resourceManager// @ts-ignore
|
|
6647
|
+
._request(item.url, _extends({}, item, {
|
|
6648
|
+
type: "json"
|
|
6649
|
+
})).then(function(data) {
|
|
6650
|
+
var width = data.width, height = data.height, colorFormats = data.colorFormats, depthFormat = data.depthFormat, antiAliasing = data.antiAliasing, autoGenerateMipmaps = data.autoGenerateMipmaps;
|
|
6651
|
+
var colorTextureProps = data.colorTextures;
|
|
6652
|
+
var colorTextures = colorFormats.map(function(format, i) {
|
|
6653
|
+
var props = colorTextureProps == null ? void 0 : colorTextureProps[i];
|
|
6654
|
+
var _props_mipmap;
|
|
6655
|
+
var mipmap = (_props_mipmap = props == null ? void 0 : props.mipmap) != null ? _props_mipmap : true;
|
|
6656
|
+
var _props_isSRGBColorSpace;
|
|
6657
|
+
var isSRGB = (_props_isSRGBColorSpace = props == null ? void 0 : props.isSRGBColorSpace) != null ? _props_isSRGBColorSpace : format === TextureFormat.R8G8B8A8;
|
|
6658
|
+
var texture = new Texture2D(engine, width, height, format, mipmap, isSRGB);
|
|
6659
|
+
if (props) {
|
|
6660
|
+
if (props.filterMode != null) texture.filterMode = props.filterMode;
|
|
6661
|
+
if (props.wrapModeU != null) texture.wrapModeU = props.wrapModeU;
|
|
6662
|
+
if (props.wrapModeV != null) texture.wrapModeV = props.wrapModeV;
|
|
6663
|
+
if (props.anisoLevel != null) texture.anisoLevel = props.anisoLevel;
|
|
6664
|
+
}
|
|
6665
|
+
return texture;
|
|
6666
|
+
});
|
|
6667
|
+
var depth = depthFormat === -1 ? null : depthFormat;
|
|
6668
|
+
var rt = new RenderTarget(engine, width, height, colorTextures, depth, antiAliasing);
|
|
6669
|
+
if (autoGenerateMipmaps != null) rt.autoGenerateMipmaps = autoGenerateMipmaps;
|
|
6670
|
+
// Notify pending sub-asset requests for colorTextures
|
|
6671
|
+
for(var i = 0, n = colorTextures.length; i < n; i++){
|
|
6672
|
+
// @ts-ignore
|
|
6673
|
+
resourceManager._onSubAssetSuccess(item.url, "colorTextures[" + i + "]", colorTextures[i]);
|
|
6674
|
+
}
|
|
6675
|
+
return rt;
|
|
6676
|
+
});
|
|
6677
|
+
};
|
|
6678
|
+
return RenderTargetLoader;
|
|
6679
|
+
}(Loader);
|
|
6680
|
+
RenderTargetLoader = __decorate([
|
|
6681
|
+
resourceLoader(AssetType.RenderTarget, [
|
|
6682
|
+
"renderTarget"
|
|
6683
|
+
])
|
|
6684
|
+
], RenderTargetLoader);
|
|
6685
|
+
|
|
6644
6686
|
var SceneLoader = /*#__PURE__*/ function(Loader) {
|
|
6645
6687
|
_inherits(SceneLoader, Loader);
|
|
6646
6688
|
function SceneLoader() {
|
|
@@ -6783,20 +6825,6 @@ SceneLoader = __decorate([
|
|
|
6783
6825
|
"scene"
|
|
6784
6826
|
], true)
|
|
6785
6827
|
], SceneLoader);
|
|
6786
|
-
ReflectionParser.registerCustomParseComponent("TextRenderer", /*#__PURE__*/ _async_to_generator(function(instance, item) {
|
|
6787
|
-
var props;
|
|
6788
|
-
return __generator(this, function(_state) {
|
|
6789
|
-
props = item.props;
|
|
6790
|
-
if (!props.font) {
|
|
6791
|
-
// @ts-ignore
|
|
6792
|
-
instance.font = Font.createFromOS(instance.engine, props.fontFamily || "Arial");
|
|
6793
|
-
}
|
|
6794
|
-
return [
|
|
6795
|
-
2,
|
|
6796
|
-
instance
|
|
6797
|
-
];
|
|
6798
|
-
});
|
|
6799
|
-
}));
|
|
6800
6828
|
|
|
6801
6829
|
var KHR_lights_punctual = /*#__PURE__*/ function(GLTFExtensionParser) {
|
|
6802
6830
|
_inherits(KHR_lights_punctual, GLTFExtensionParser);
|