@galacean/engine-loader 1.2.0-alpha.1 → 1.2.0-alpha.2
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 +80 -33
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +80 -33
- package/dist/module.js +81 -34
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/types/PrimitiveMeshLoader.d.ts +1 -0
- package/types/index.d.ts +3 -2
package/dist/miniprogram.js
CHANGED
|
@@ -5628,6 +5628,86 @@ MeshLoader = __decorate([
|
|
|
5628
5628
|
])
|
|
5629
5629
|
], MeshLoader);
|
|
5630
5630
|
|
|
5631
|
+
var PrimitiveMeshLoader = /*#__PURE__*/ function(Loader1) {
|
|
5632
|
+
_inherits(PrimitiveMeshLoader, Loader1);
|
|
5633
|
+
function PrimitiveMeshLoader() {
|
|
5634
|
+
return Loader1.apply(this, arguments);
|
|
5635
|
+
}
|
|
5636
|
+
var _proto = PrimitiveMeshLoader.prototype;
|
|
5637
|
+
_proto.load = function load(item, param) {
|
|
5638
|
+
var engine = param.engine;
|
|
5639
|
+
return this.request(item.url, _extends({}, item, {
|
|
5640
|
+
type: "json"
|
|
5641
|
+
})).then(function(data) {
|
|
5642
|
+
switch(data.type){
|
|
5643
|
+
case "sphere":
|
|
5644
|
+
return miniprogram.PrimitiveMesh.createSubdivisionSurfaceSphere(engine, data.sphereRadius, data.sphereStep);
|
|
5645
|
+
case "capsule":
|
|
5646
|
+
return miniprogram.PrimitiveMesh.createCapsule(engine, data.capsuleRadius, data.capsuleHeight, data.capsuleRadialSegments, data.capsuleHeightSegments);
|
|
5647
|
+
case "cone":
|
|
5648
|
+
return miniprogram.PrimitiveMesh.createCone(engine, data.coneRadius, data.coneHeight, data.coneRadialSegment, data.coneHeightSegment);
|
|
5649
|
+
case "cuboid":
|
|
5650
|
+
return miniprogram.PrimitiveMesh.createCuboid(engine, data.cuboidWidth, data.cuboidHeight, data.cuboidDepth);
|
|
5651
|
+
case "cylinder":
|
|
5652
|
+
return miniprogram.PrimitiveMesh.createCylinder(engine, data.cylinderRadiusTop, data.cylinderRadiusBottom, data.cylinderHeight, data.cylinderRadialSegment, data.cylinderHeightSegment);
|
|
5653
|
+
case "plane":
|
|
5654
|
+
return miniprogram.PrimitiveMesh.createPlane(engine, data.planeWidth, data.planeHeight, data.planeHorizontalSegments, data.planeVerticalSegments);
|
|
5655
|
+
case "torus":
|
|
5656
|
+
return miniprogram.PrimitiveMesh.createTorus(engine, data.torusRadius, data.torusTubeRadius, data.torusRadialSegments, data.torusTubularSegments, data.torusArc);
|
|
5657
|
+
}
|
|
5658
|
+
});
|
|
5659
|
+
};
|
|
5660
|
+
return PrimitiveMeshLoader;
|
|
5661
|
+
}(miniprogram.Loader);
|
|
5662
|
+
PrimitiveMeshLoader = __decorate([
|
|
5663
|
+
miniprogram.resourceLoader(miniprogram.AssetType.PrimitiveMesh, [
|
|
5664
|
+
"mesh"
|
|
5665
|
+
], false)
|
|
5666
|
+
], PrimitiveMeshLoader);
|
|
5667
|
+
var /** @internal */ PrimitiveMeshType;
|
|
5668
|
+
(function(PrimitiveMeshType) {
|
|
5669
|
+
PrimitiveMeshType["Sphere"] = "sphere";
|
|
5670
|
+
PrimitiveMeshType["Cuboid"] = "cuboid";
|
|
5671
|
+
PrimitiveMeshType["Plane"] = "plane";
|
|
5672
|
+
PrimitiveMeshType["Cylinder"] = "cylinder";
|
|
5673
|
+
PrimitiveMeshType["Torus"] = "torus";
|
|
5674
|
+
PrimitiveMeshType["Cone"] = "cone";
|
|
5675
|
+
PrimitiveMeshType["Capsule"] = "capsule";
|
|
5676
|
+
})(PrimitiveMeshType || (PrimitiveMeshType = {}));
|
|
5677
|
+
|
|
5678
|
+
var ProjectLoader = /*#__PURE__*/ function(Loader1) {
|
|
5679
|
+
_inherits(ProjectLoader, Loader1);
|
|
5680
|
+
function ProjectLoader() {
|
|
5681
|
+
return Loader1.apply(this, arguments);
|
|
5682
|
+
}
|
|
5683
|
+
var _proto = ProjectLoader.prototype;
|
|
5684
|
+
_proto.load = function load(item, resourceManager) {
|
|
5685
|
+
var _this = this;
|
|
5686
|
+
var engine = resourceManager.engine;
|
|
5687
|
+
return new miniprogram.AssetPromise(function(resolve, reject) {
|
|
5688
|
+
_this.request(item.url, {
|
|
5689
|
+
type: "json"
|
|
5690
|
+
}).then(function(data) {
|
|
5691
|
+
// @ts-ignore
|
|
5692
|
+
engine.resourceManager.initVirtualResources(data.files);
|
|
5693
|
+
return resourceManager.load({
|
|
5694
|
+
type: miniprogram.AssetType.Scene,
|
|
5695
|
+
url: data.scene
|
|
5696
|
+
}).then(function(scene) {
|
|
5697
|
+
engine.sceneManager.activeScene = scene;
|
|
5698
|
+
resolve();
|
|
5699
|
+
});
|
|
5700
|
+
}).catch(reject);
|
|
5701
|
+
});
|
|
5702
|
+
};
|
|
5703
|
+
return ProjectLoader;
|
|
5704
|
+
}(miniprogram.Loader);
|
|
5705
|
+
ProjectLoader = __decorate([
|
|
5706
|
+
miniprogram.resourceLoader(miniprogram.AssetType.Project, [
|
|
5707
|
+
"proj"
|
|
5708
|
+
], false)
|
|
5709
|
+
], ProjectLoader);
|
|
5710
|
+
|
|
5631
5711
|
var SourceFontLoader = /*#__PURE__*/ function(Loader1) {
|
|
5632
5712
|
_inherits(SourceFontLoader, Loader1);
|
|
5633
5713
|
function SourceFontLoader() {
|
|
@@ -5963,39 +6043,6 @@ TextureCubeLoader = __decorate([
|
|
|
5963
6043
|
])
|
|
5964
6044
|
], TextureCubeLoader);
|
|
5965
6045
|
|
|
5966
|
-
var ProjectLoader = /*#__PURE__*/ function(Loader1) {
|
|
5967
|
-
_inherits(ProjectLoader, Loader1);
|
|
5968
|
-
function ProjectLoader() {
|
|
5969
|
-
return Loader1.apply(this, arguments);
|
|
5970
|
-
}
|
|
5971
|
-
var _proto = ProjectLoader.prototype;
|
|
5972
|
-
_proto.load = function load(item, resourceManager) {
|
|
5973
|
-
var _this = this;
|
|
5974
|
-
var engine = resourceManager.engine;
|
|
5975
|
-
return new miniprogram.AssetPromise(function(resolve, reject) {
|
|
5976
|
-
_this.request(item.url, {
|
|
5977
|
-
type: "json"
|
|
5978
|
-
}).then(function(data) {
|
|
5979
|
-
// @ts-ignore
|
|
5980
|
-
engine.resourceManager.initVirtualResources(data.files);
|
|
5981
|
-
return resourceManager.load({
|
|
5982
|
-
type: miniprogram.AssetType.Scene,
|
|
5983
|
-
url: data.scene
|
|
5984
|
-
}).then(function(scene) {
|
|
5985
|
-
engine.sceneManager.activeScene = scene;
|
|
5986
|
-
resolve();
|
|
5987
|
-
});
|
|
5988
|
-
}).catch(reject);
|
|
5989
|
-
});
|
|
5990
|
-
};
|
|
5991
|
-
return ProjectLoader;
|
|
5992
|
-
}(miniprogram.Loader);
|
|
5993
|
-
ProjectLoader = __decorate([
|
|
5994
|
-
miniprogram.resourceLoader(miniprogram.AssetType.Project, [
|
|
5995
|
-
"proj"
|
|
5996
|
-
], false)
|
|
5997
|
-
], ProjectLoader);
|
|
5998
|
-
|
|
5999
6046
|
var SceneLoader = /*#__PURE__*/ function(Loader1) {
|
|
6000
6047
|
_inherits(SceneLoader, Loader1);
|
|
6001
6048
|
function SceneLoader() {
|
package/dist/module.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Utils, ModelMesh, BlendShape, Texture2D, Loader, Entity, Transform, Animator, DirectLight, Camera, MeshRenderer, ParticleRenderer, PointLight, SpotLight, Script, SpriteMask, SpriteRenderer, TextRenderer, AnimationClip, AnimationEvent, AnimationStringCurve, Keyframe, AnimationBoolCurve, AnimationRefCurve, AnimationQuaternionCurve, AnimationColorCurve, AnimationVector4Curve, AnimationVector3Curve, AnimationVector2Curve, AnimationFloatArrayCurve, AnimationArrayCurve, AnimationFloatCurve, Scene, resourceLoader, AssetPromise, AssetType, AnimatorController, AnimatorControllerLayer, AnimatorStateMachine, AnimatorStateTransition, TextureCube, TextureFilterMode, TextureCubeFace, AmbientLight, DiffuseMode, Font, ReferResource, IndexFormat, VertexElementFormat, GLCapabilityType, Logger, TextureFormat, request, ContentRestorer, InterpolationType, SkinnedMeshRenderer, PBRMaterial, BlinnPhongMaterial, PBRSpecularMaterial, TextureCoordinate, RenderFace, VertexElement, Buffer, BufferBindFlag, BufferUsage, Skin, TextureWrapMode as TextureWrapMode$1, SystemInfo, Material, Shader, SpriteAtlas, Sprite, BackgroundMode, UnlitMaterial } from '@galacean/engine-core';
|
|
1
|
+
import { Utils, ModelMesh, BlendShape, Texture2D, Loader, Entity, Transform, Animator, DirectLight, Camera, MeshRenderer, ParticleRenderer, PointLight, SpotLight, Script, SpriteMask, SpriteRenderer, TextRenderer, AnimationClip, AnimationEvent, AnimationStringCurve, Keyframe, AnimationBoolCurve, AnimationRefCurve, AnimationQuaternionCurve, AnimationColorCurve, AnimationVector4Curve, AnimationVector3Curve, AnimationVector2Curve, AnimationFloatArrayCurve, AnimationArrayCurve, AnimationFloatCurve, Scene, resourceLoader, AssetPromise, AssetType, AnimatorController, AnimatorControllerLayer, AnimatorStateMachine, AnimatorStateTransition, TextureCube, TextureFilterMode, TextureCubeFace, AmbientLight, DiffuseMode, Font, ReferResource, IndexFormat, VertexElementFormat, GLCapabilityType, Logger, TextureFormat, request, ContentRestorer, InterpolationType, SkinnedMeshRenderer, PBRMaterial, BlinnPhongMaterial, PBRSpecularMaterial, TextureCoordinate, RenderFace, VertexElement, Buffer, BufferBindFlag, BufferUsage, Skin, TextureWrapMode as TextureWrapMode$1, SystemInfo, Material, Shader, PrimitiveMesh, SpriteAtlas, Sprite, BackgroundMode, UnlitMaterial } from '@galacean/engine-core';
|
|
2
2
|
import { Color, Vector4, Vector3, Vector2, Quaternion, SphericalHarmonics3, MathUtil, BoundingBox, Matrix, Rect } from '@galacean/engine-math';
|
|
3
3
|
import { GLCompressedTextureInternalFormat } from '@galacean/engine-rhi-webgl';
|
|
4
4
|
|
|
@@ -5624,6 +5624,86 @@ MeshLoader = __decorate([
|
|
|
5624
5624
|
])
|
|
5625
5625
|
], MeshLoader);
|
|
5626
5626
|
|
|
5627
|
+
var PrimitiveMeshLoader = /*#__PURE__*/ function(Loader1) {
|
|
5628
|
+
_inherits(PrimitiveMeshLoader, Loader1);
|
|
5629
|
+
function PrimitiveMeshLoader() {
|
|
5630
|
+
return Loader1.apply(this, arguments);
|
|
5631
|
+
}
|
|
5632
|
+
var _proto = PrimitiveMeshLoader.prototype;
|
|
5633
|
+
_proto.load = function load(item, param) {
|
|
5634
|
+
var engine = param.engine;
|
|
5635
|
+
return this.request(item.url, _extends({}, item, {
|
|
5636
|
+
type: "json"
|
|
5637
|
+
})).then(function(data) {
|
|
5638
|
+
switch(data.type){
|
|
5639
|
+
case "sphere":
|
|
5640
|
+
return PrimitiveMesh.createSubdivisionSurfaceSphere(engine, data.sphereRadius, data.sphereStep);
|
|
5641
|
+
case "capsule":
|
|
5642
|
+
return PrimitiveMesh.createCapsule(engine, data.capsuleRadius, data.capsuleHeight, data.capsuleRadialSegments, data.capsuleHeightSegments);
|
|
5643
|
+
case "cone":
|
|
5644
|
+
return PrimitiveMesh.createCone(engine, data.coneRadius, data.coneHeight, data.coneRadialSegment, data.coneHeightSegment);
|
|
5645
|
+
case "cuboid":
|
|
5646
|
+
return PrimitiveMesh.createCuboid(engine, data.cuboidWidth, data.cuboidHeight, data.cuboidDepth);
|
|
5647
|
+
case "cylinder":
|
|
5648
|
+
return PrimitiveMesh.createCylinder(engine, data.cylinderRadiusTop, data.cylinderRadiusBottom, data.cylinderHeight, data.cylinderRadialSegment, data.cylinderHeightSegment);
|
|
5649
|
+
case "plane":
|
|
5650
|
+
return PrimitiveMesh.createPlane(engine, data.planeWidth, data.planeHeight, data.planeHorizontalSegments, data.planeVerticalSegments);
|
|
5651
|
+
case "torus":
|
|
5652
|
+
return PrimitiveMesh.createTorus(engine, data.torusRadius, data.torusTubeRadius, data.torusRadialSegments, data.torusTubularSegments, data.torusArc);
|
|
5653
|
+
}
|
|
5654
|
+
});
|
|
5655
|
+
};
|
|
5656
|
+
return PrimitiveMeshLoader;
|
|
5657
|
+
}(Loader);
|
|
5658
|
+
PrimitiveMeshLoader = __decorate([
|
|
5659
|
+
resourceLoader(AssetType.PrimitiveMesh, [
|
|
5660
|
+
"mesh"
|
|
5661
|
+
], false)
|
|
5662
|
+
], PrimitiveMeshLoader);
|
|
5663
|
+
var /** @internal */ PrimitiveMeshType;
|
|
5664
|
+
(function(PrimitiveMeshType) {
|
|
5665
|
+
PrimitiveMeshType["Sphere"] = "sphere";
|
|
5666
|
+
PrimitiveMeshType["Cuboid"] = "cuboid";
|
|
5667
|
+
PrimitiveMeshType["Plane"] = "plane";
|
|
5668
|
+
PrimitiveMeshType["Cylinder"] = "cylinder";
|
|
5669
|
+
PrimitiveMeshType["Torus"] = "torus";
|
|
5670
|
+
PrimitiveMeshType["Cone"] = "cone";
|
|
5671
|
+
PrimitiveMeshType["Capsule"] = "capsule";
|
|
5672
|
+
})(PrimitiveMeshType || (PrimitiveMeshType = {}));
|
|
5673
|
+
|
|
5674
|
+
var ProjectLoader = /*#__PURE__*/ function(Loader1) {
|
|
5675
|
+
_inherits(ProjectLoader, Loader1);
|
|
5676
|
+
function ProjectLoader() {
|
|
5677
|
+
return Loader1.apply(this, arguments);
|
|
5678
|
+
}
|
|
5679
|
+
var _proto = ProjectLoader.prototype;
|
|
5680
|
+
_proto.load = function load(item, resourceManager) {
|
|
5681
|
+
var _this = this;
|
|
5682
|
+
var engine = resourceManager.engine;
|
|
5683
|
+
return new AssetPromise(function(resolve, reject) {
|
|
5684
|
+
_this.request(item.url, {
|
|
5685
|
+
type: "json"
|
|
5686
|
+
}).then(function(data) {
|
|
5687
|
+
// @ts-ignore
|
|
5688
|
+
engine.resourceManager.initVirtualResources(data.files);
|
|
5689
|
+
return resourceManager.load({
|
|
5690
|
+
type: AssetType.Scene,
|
|
5691
|
+
url: data.scene
|
|
5692
|
+
}).then(function(scene) {
|
|
5693
|
+
engine.sceneManager.activeScene = scene;
|
|
5694
|
+
resolve();
|
|
5695
|
+
});
|
|
5696
|
+
}).catch(reject);
|
|
5697
|
+
});
|
|
5698
|
+
};
|
|
5699
|
+
return ProjectLoader;
|
|
5700
|
+
}(Loader);
|
|
5701
|
+
ProjectLoader = __decorate([
|
|
5702
|
+
resourceLoader(AssetType.Project, [
|
|
5703
|
+
"proj"
|
|
5704
|
+
], false)
|
|
5705
|
+
], ProjectLoader);
|
|
5706
|
+
|
|
5627
5707
|
var SourceFontLoader = /*#__PURE__*/ function(Loader1) {
|
|
5628
5708
|
_inherits(SourceFontLoader, Loader1);
|
|
5629
5709
|
function SourceFontLoader() {
|
|
@@ -5959,39 +6039,6 @@ TextureCubeLoader = __decorate([
|
|
|
5959
6039
|
])
|
|
5960
6040
|
], TextureCubeLoader);
|
|
5961
6041
|
|
|
5962
|
-
var ProjectLoader = /*#__PURE__*/ function(Loader1) {
|
|
5963
|
-
_inherits(ProjectLoader, Loader1);
|
|
5964
|
-
function ProjectLoader() {
|
|
5965
|
-
return Loader1.apply(this, arguments);
|
|
5966
|
-
}
|
|
5967
|
-
var _proto = ProjectLoader.prototype;
|
|
5968
|
-
_proto.load = function load(item, resourceManager) {
|
|
5969
|
-
var _this = this;
|
|
5970
|
-
var engine = resourceManager.engine;
|
|
5971
|
-
return new AssetPromise(function(resolve, reject) {
|
|
5972
|
-
_this.request(item.url, {
|
|
5973
|
-
type: "json"
|
|
5974
|
-
}).then(function(data) {
|
|
5975
|
-
// @ts-ignore
|
|
5976
|
-
engine.resourceManager.initVirtualResources(data.files);
|
|
5977
|
-
return resourceManager.load({
|
|
5978
|
-
type: AssetType.Scene,
|
|
5979
|
-
url: data.scene
|
|
5980
|
-
}).then(function(scene) {
|
|
5981
|
-
engine.sceneManager.activeScene = scene;
|
|
5982
|
-
resolve();
|
|
5983
|
-
});
|
|
5984
|
-
}).catch(reject);
|
|
5985
|
-
});
|
|
5986
|
-
};
|
|
5987
|
-
return ProjectLoader;
|
|
5988
|
-
}(Loader);
|
|
5989
|
-
ProjectLoader = __decorate([
|
|
5990
|
-
resourceLoader(AssetType.Project, [
|
|
5991
|
-
"proj"
|
|
5992
|
-
], false)
|
|
5993
|
-
], ProjectLoader);
|
|
5994
|
-
|
|
5995
6042
|
var SceneLoader = /*#__PURE__*/ function(Loader1) {
|
|
5996
6043
|
_inherits(SceneLoader, Loader1);
|
|
5997
6044
|
function SceneLoader() {
|