@galacean/engine-loader 2.0.0-alpha.1 → 2.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +42 -17
- package/dist/main.js.map +1 -1
- package/dist/module.js +43 -18
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/types/index.d.ts +1 -0
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, resourceLoader, ContentRestorer, DiffuseMode, BackgroundMode, AssetType, AnimatorController, AnimatorControllerLayer, AnimatorStateTransition, AmbientLight, TextureCube, TextureFilterMode, TextureCubeFace, Font, SystemInfo, Animator, Logger, IndexFormat, VertexElementFormat, GLCapabilityType, TextureFormat, request, InterpolationType, SkinnedMeshRenderer, PBRMaterial, TextureCoordinate, RenderFace, VertexElement, Buffer, BufferBindFlag, BufferUsage, Camera, MeshRenderer, Skin, TextureWrapMode as TextureWrapMode$1, TextureUtils, AnimatorStateMachine, Shader, Material, PrimitiveMesh, SpriteAtlas, Sprite, 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, resourceLoader, ContentRestorer, DiffuseMode, BackgroundMode, AssetType, AnimatorController, AnimatorControllerLayer, AnimatorStateTransition, BufferAsset, AmbientLight, TextureCube, TextureFilterMode, TextureCubeFace, Font, SystemInfo, Animator, Logger, IndexFormat, VertexElementFormat, GLCapabilityType, TextureFormat, 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';
|
|
2
2
|
import { Quaternion, Vector4, Color, Vector3, Vector2, SphericalHarmonics3, MathUtil, BoundingBox, Matrix, Rect } from '@galacean/engine-math';
|
|
3
3
|
import { GLCompressedTextureInternalFormat } from '@galacean/engine-rhi-webgl';
|
|
4
4
|
|
|
@@ -1702,9 +1702,7 @@ AnimatorControllerLoader = __decorate([
|
|
|
1702
1702
|
], false)
|
|
1703
1703
|
], AnimatorControllerLoader);
|
|
1704
1704
|
|
|
1705
|
-
|
|
1706
|
-
return /^data:(.+?);base64,/.test(url);
|
|
1707
|
-
}
|
|
1705
|
+
var base64Regex = /^data:(.+?);base64,/;
|
|
1708
1706
|
var BufferLoader = /*#__PURE__*/ function(Loader) {
|
|
1709
1707
|
_inherits(BufferLoader, Loader);
|
|
1710
1708
|
function BufferLoader() {
|
|
@@ -1713,19 +1711,17 @@ var BufferLoader = /*#__PURE__*/ function(Loader) {
|
|
|
1713
1711
|
var _proto = BufferLoader.prototype;
|
|
1714
1712
|
_proto.load = function load(item, resourceManager) {
|
|
1715
1713
|
var url = item.url;
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
return c.charCodeAt(0);
|
|
1721
|
-
});
|
|
1722
|
-
resolve(result.buffer);
|
|
1723
|
-
});
|
|
1724
|
-
}
|
|
1725
|
-
// @ts-ignore
|
|
1726
|
-
return resourceManager._request(url, _extends({}, item, {
|
|
1714
|
+
var base64Match = base64Regex.exec(url);
|
|
1715
|
+
var bufferPromise = base64Match ? Promise.resolve(Uint8Array.from(atob(url.slice(13 + base64Match[1].length)), function(c) {
|
|
1716
|
+
return c.charCodeAt(0);
|
|
1717
|
+
}).buffer) : resourceManager._request(url, _extends({}, item, {
|
|
1727
1718
|
type: "arraybuffer"
|
|
1728
1719
|
}));
|
|
1720
|
+
return AssetPromise.resolve(bufferPromise).then(function(buffer) {
|
|
1721
|
+
var asset = new BufferAsset(resourceManager.engine);
|
|
1722
|
+
asset.buffer = buffer;
|
|
1723
|
+
return asset;
|
|
1724
|
+
});
|
|
1729
1725
|
};
|
|
1730
1726
|
return BufferLoader;
|
|
1731
1727
|
}(Loader);
|
|
@@ -1733,7 +1729,7 @@ BufferLoader = __decorate([
|
|
|
1733
1729
|
resourceLoader(AssetType.Buffer, [
|
|
1734
1730
|
"bin",
|
|
1735
1731
|
"r3bin"
|
|
1736
|
-
]
|
|
1732
|
+
])
|
|
1737
1733
|
], BufferLoader);
|
|
1738
1734
|
|
|
1739
1735
|
var EnvLoader = /*#__PURE__*/ function(Loader) {
|
|
@@ -5655,14 +5651,18 @@ var JSONLoader = /*#__PURE__*/ function(Loader) {
|
|
|
5655
5651
|
// @ts-ignore
|
|
5656
5652
|
return resourceManager._request(item.url, _extends({}, item, {
|
|
5657
5653
|
type: "json"
|
|
5658
|
-
}))
|
|
5654
|
+
})).then(function(data) {
|
|
5655
|
+
var asset = new JSONAsset(resourceManager.engine);
|
|
5656
|
+
asset.data = data;
|
|
5657
|
+
return asset;
|
|
5658
|
+
});
|
|
5659
5659
|
};
|
|
5660
5660
|
return JSONLoader;
|
|
5661
5661
|
}(Loader);
|
|
5662
5662
|
JSONLoader = __decorate([
|
|
5663
5663
|
resourceLoader(AssetType.JSON, [
|
|
5664
5664
|
"json"
|
|
5665
|
-
]
|
|
5665
|
+
])
|
|
5666
5666
|
], JSONLoader);
|
|
5667
5667
|
|
|
5668
5668
|
var HEADER_LEN = 12 + 13 * 4; // identifier + header elements (not including key value meta-data pairs)
|
|
@@ -6363,6 +6363,30 @@ SpriteLoader = __decorate([
|
|
|
6363
6363
|
])
|
|
6364
6364
|
], SpriteLoader);
|
|
6365
6365
|
|
|
6366
|
+
var TextLoader = /*#__PURE__*/ function(Loader) {
|
|
6367
|
+
_inherits(TextLoader, Loader);
|
|
6368
|
+
function TextLoader() {
|
|
6369
|
+
return Loader.apply(this, arguments) || this;
|
|
6370
|
+
}
|
|
6371
|
+
var _proto = TextLoader.prototype;
|
|
6372
|
+
_proto.load = function load(item, resourceManager) {
|
|
6373
|
+
// @ts-ignore
|
|
6374
|
+
return resourceManager._request(item.url, _extends({}, item, {
|
|
6375
|
+
type: "text"
|
|
6376
|
+
})).then(function(text) {
|
|
6377
|
+
var asset = new TextAsset(resourceManager.engine);
|
|
6378
|
+
asset.text = text;
|
|
6379
|
+
return asset;
|
|
6380
|
+
});
|
|
6381
|
+
};
|
|
6382
|
+
return TextLoader;
|
|
6383
|
+
}(Loader);
|
|
6384
|
+
TextLoader = __decorate([
|
|
6385
|
+
resourceLoader(AssetType.Text, [
|
|
6386
|
+
"txt"
|
|
6387
|
+
])
|
|
6388
|
+
], TextLoader);
|
|
6389
|
+
|
|
6366
6390
|
/**
|
|
6367
6391
|
* @internal
|
|
6368
6392
|
*/ var Texture2DContentRestorer = /*#__PURE__*/ function(ContentRestorer) {
|
|
@@ -6583,6 +6607,7 @@ var ShaderChunkLoader = /*#__PURE__*/ function(Loader) {
|
|
|
6583
6607
|
}
|
|
6584
6608
|
}
|
|
6585
6609
|
return Promise.all(shaderChunkPaths.map(function(chunkPath) {
|
|
6610
|
+
// @ts-ignore
|
|
6586
6611
|
return resourceManager.load({
|
|
6587
6612
|
type: "ShaderChunk",
|
|
6588
6613
|
url: chunkPath
|