@galacean/engine-loader 0.9.0-beta.80 → 1.0.0-alpha.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/engine-loader",
3
- "version": "0.9.0-beta.80",
3
+ "version": "1.0.0-alpha.6",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -15,10 +15,10 @@
15
15
  "types/**/*"
16
16
  ],
17
17
  "dependencies": {
18
- "@galacean/engine-draco": "0.9.0-beta.80",
19
- "@galacean/engine-math": "0.9.0-beta.80",
20
- "@galacean/engine-rhi-webgl": "0.9.0-beta.80",
21
- "@galacean/engine-core": "0.9.0-beta.80"
18
+ "@galacean/engine-core": "1.0.0-alpha.6",
19
+ "@galacean/engine-math": "1.0.0-alpha.6",
20
+ "@galacean/engine-rhi-webgl": "1.0.0-alpha.6",
21
+ "@galacean/engine-draco": "1.0.0-alpha.6"
22
22
  },
23
23
  "scripts": {
24
24
  "b:types": "tsc"
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,6 @@
1
- import { AssetPromise, BlendShape, Buffer, ContentRestorer, ModelMesh, Texture2D } from "@oasis-engine/core";
2
- import { RequestConfig } from "@oasis-engine/core/types/asset/request";
3
- import { Vector2 } from "@oasis-engine/math";
1
+ import { AssetPromise, BlendShape, Buffer, ContentRestorer, ModelMesh, Texture2D } from "@galacean/engine-core";
2
+ import { RequestConfig } from "@galacean/engine-core/types/asset/request";
3
+ import { Vector2 } from "@galacean/engine-math";
4
4
  import { GLTFResource } from "./gltf/GLTFResource";
5
5
  import { IBufferView } from "./gltf/GLTFSchema";
6
6
  /**
@@ -1,6 +1,10 @@
1
1
  import { AssetPromise, Loader, LoadItem, ResourceManager } from "@galacean/engine-core";
2
+ import { GLTFPipeline } from "./gltf/GLTFPipeline";
2
3
  import { GLTFResource } from "./gltf/GLTFResource";
3
4
  export declare class GLTFLoader extends Loader<GLTFResource> {
5
+ /**
6
+ * @override
7
+ */
4
8
  load(item: LoadItem, resourceManager: ResourceManager): Record<string, AssetPromise<any>>;
5
9
  }
6
10
  /**
@@ -9,4 +13,6 @@ export declare class GLTFLoader extends Loader<GLTFResource> {
9
13
  export interface GLTFParams {
10
14
  /** Keep raw mesh data for glTF parser, default is false. */
11
15
  keepMeshData: boolean;
16
+ /** Custom glTF pipeline. */
17
+ pipeline: GLTFPipeline;
12
18
  }
@@ -1,5 +1,5 @@
1
- import { AssetPromise, ContentRestorer, Texture2D } from "@oasis-engine/core";
2
- import { RequestConfig } from "@oasis-engine/core/types/asset/request";
1
+ import { AssetPromise, ContentRestorer, Texture2D } from "@galacean/engine-core";
2
+ import { RequestConfig } from "@galacean/engine-core/types/asset/request";
3
3
  /**
4
4
  * @internal
5
5
  */
@@ -1,5 +1,5 @@
1
- import { AssetPromise, ContentRestorer, TextureCube } from "@oasis-engine/core";
2
- import { RequestConfig } from "@oasis-engine/core/types/asset/request";
1
+ import { AssetPromise, ContentRestorer, TextureCube } from "@galacean/engine-core";
2
+ import { RequestConfig } from "@galacean/engine-core/types/asset/request";
3
3
  /**
4
4
  * @internal
5
5
  */
@@ -1,4 +1,4 @@
1
- import { AssetPromise } from "@oasis-engine/core";
1
+ import { AssetPromise } from "@galacean/engine-core";
2
2
  import { GLTFResource } from "./GLTFResource";
3
3
  import { GLTFParser } from "./parser/GLTFParser";
4
4
  import { GLTFParserContext } from "./parser/GLTFParserContext";
@@ -1,9 +1,9 @@
1
- import { AnimationClip, Camera, Engine, EngineObject, Entity, Light, Material, ModelMesh, Renderer, Skin, Texture2D } from "@galacean/engine-core";
1
+ import { AnimationClip, Camera, Engine, EngineObject, Entity, Light, Material, ModelMesh, Skin, Texture2D } from "@galacean/engine-core";
2
2
  /**
3
- * Product after GLTF parser, usually, `defaultSceneRoot` is only needed to use.
3
+ * Product after glTF parser, usually, `defaultSceneRoot` is only needed to use.
4
4
  */
5
5
  export declare class GLTFResource extends EngineObject {
6
- /** GLTF file url. */
6
+ /** glTF file url. */
7
7
  url: string;
8
8
  /** Texture2D after TextureParser. */
9
9
  textures?: Texture2D[];
@@ -19,21 +19,17 @@ export declare class GLTFResource extends EngineObject {
19
19
  entities: Entity[];
20
20
  /** Camera after SceneParser. */
21
21
  cameras?: Camera[];
22
- /** Export lights in extension KHR_lights_punctual */
22
+ /** Export lights in extension KHR_lights_punctual. */
23
23
  lights?: Light[];
24
24
  /** RootEntities after SceneParser. */
25
25
  sceneRoots: Entity[];
26
26
  /** RootEntity after SceneParser. */
27
27
  defaultSceneRoot: Entity;
28
- /** Renderer can replace material by `renderer.setMaterial` if gltf use plugin-in KHR_materials_variants. */
29
- variants?: {
30
- renderer: Renderer;
31
- material: Material;
32
- variants: string[];
33
- }[];
28
+ /** Extensions data. */
29
+ extensionsData: Record<string, any>;
34
30
  constructor(engine: Engine, url: string);
35
31
  /**
36
32
  * @override
37
33
  */
38
- destroy(): void;
34
+ protected _onDestroy(): void;
39
35
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Module for glTF 2.0 Interface
3
3
  */
4
- import { MeshTopology } from "@oasis-engine/core";
4
+ import { MeshTopology } from "@galacean/engine-core";
5
5
  /**
6
6
  * The datatype of the components in the attribute
7
7
  */
@@ -1,7 +1,7 @@
1
1
  import { IndexFormat, TypedArray, VertexElementFormat } from "@galacean/engine-core";
2
2
  import { Color, Vector2, Vector3, Vector4 } from "@galacean/engine-math";
3
- import { BufferInfo, ParserContext } from "./parser/ParserContext";
4
- import { AccessorComponentType, AccessorType, IAccessor, IBufferView, IGLTF } from "./Schema";
3
+ import { AccessorComponentType, AccessorType, IAccessor, IBufferView, IGLTF } from "./GLTFSchema";
4
+ import { BufferInfo, GLTFParserContext } from "./parser/GLTFParserContext";
5
5
  /**
6
6
  * @internal
7
7
  */
@@ -21,19 +21,19 @@ export declare class GLTFUtil {
21
21
  /**
22
22
  * Get the TypedArray corresponding to the component type.
23
23
  */
24
- static getComponentType(componentType: AccessorComponentType): Uint8ArrayConstructor | Float32ArrayConstructor | Uint16ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Uint32ArrayConstructor;
24
+ static getComponentType(componentType: AccessorComponentType): Uint8ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor;
25
25
  static getNormalizedComponentScale(componentType: AccessorComponentType): number;
26
- static getAccessorBuffer(context: ParserContext, gltf: IGLTF, accessor: IAccessor): BufferInfo;
26
+ static getAccessorBuffer(context: GLTFParserContext, bufferViews: IBufferView[], accessor: IAccessor): BufferInfo;
27
27
  /**
28
28
  * @deprecated
29
29
  * Get accessor data.
30
30
  */
31
- static getAccessorData(gltf: IGLTF, accessor: IAccessor, buffers: ArrayBuffer[]): TypedArray;
31
+ static getAccessorData(glTF: IGLTF, accessor: IAccessor, buffers: ArrayBuffer[]): TypedArray;
32
32
  static getBufferViewData(bufferView: IBufferView, buffers: ArrayBuffer[]): ArrayBuffer;
33
33
  /**
34
34
  * Get accessor data.
35
35
  */
36
- static processingSparseData(gltf: IGLTF, accessor: IAccessor, buffers: ArrayBuffer[], originData: TypedArray): TypedArray;
36
+ static processingSparseData(bufferViews: IBufferView[], accessor: IAccessor, buffers: ArrayBuffer[], bufferInfo: BufferInfo): void;
37
37
  static getIndexFormat(type: AccessorComponentType): IndexFormat;
38
38
  static getElementFormat(type: AccessorComponentType, size: number, normalized?: boolean): VertexElementFormat;
39
39
  /**
@@ -45,8 +45,8 @@ export declare class GLTFUtil {
45
45
  /**
46
46
  * Parse the glb format.
47
47
  */
48
- static parseGLB(glb: ArrayBuffer): {
49
- gltf: IGLTF;
48
+ static parseGLB(context: GLTFParserContext, glb: ArrayBuffer): {
49
+ glTF: IGLTF;
50
50
  buffers: ArrayBuffer[];
51
51
  };
52
52
  private static _formatRelativePath;
@@ -1,4 +1,4 @@
1
- import { EngineObject } from "@oasis-engine/core";
1
+ import { EngineObject } from "@galacean/engine-core";
2
2
  import { GLTFExtensionOwnerSchema } from "../GLTFSchema";
3
3
  import { GLTFParserContext } from "../parser/GLTFParserContext";
4
4
  import { GLTFExtensionSchema } from "./GLTFExtensionSchema";
@@ -134,7 +134,7 @@ export interface IKHRXmp {
134
134
  export interface IKHRXmp_Node {
135
135
  packet: number;
136
136
  }
137
- export interface IOasisMaterialRemap {
137
+ export interface IGalaceanMaterialRemap {
138
138
  refId: string;
139
139
  key?: string;
140
140
  isClone?: boolean;
@@ -1 +1,6 @@
1
- export {};
1
+ import { Material, Renderer } from "@galacean/engine-core";
2
+ export type IGLTFExtensionVariants = Array<{
3
+ renderer: Renderer;
4
+ material: Material;
5
+ variants: string[];
6
+ }>;
@@ -6,9 +6,12 @@ import "./KHR_materials_pbrSpecularGlossiness";
6
6
  import "./KHR_materials_sheen";
7
7
  import "./KHR_materials_transmission";
8
8
  import "./KHR_materials_unlit";
9
- import "./KHR_materials_variants";
9
+ export type { IGLTFExtensionVariants } from "./KHR_materials_variants";
10
10
  import "./KHR_materials_volume";
11
11
  import "./KHR_mesh_quantization";
12
12
  import "./KHR_texture_basisu";
13
13
  import "./KHR_texture_transform";
14
- import "./GALACEAN_materials_remap";
14
+ import "./Galacean_materials_remap";
15
+ import "./OASIS_animation_event";
16
+ export { GLTFExtensionParser, GLTFExtensionMode } from "./GLTFExtensionParser";
17
+ export * from "./GLTFExtensionSchema";
@@ -1,4 +1,4 @@
1
- import { AnimationClip, AssetPromise } from "@oasis-engine/core";
1
+ import { AnimationClip, AssetPromise } from "@galacean/engine-core";
2
2
  import { IAnimation } from "../GLTFSchema";
3
3
  import { GLTFParser } from "./GLTFParser";
4
4
  import { GLTFParserContext } from "./GLTFParserContext";
@@ -1,4 +1,4 @@
1
- import { AssetPromise } from "@oasis-engine/core";
1
+ import { AssetPromise } from "@galacean/engine-core";
2
2
  import { GLTFParser } from "./GLTFParser";
3
3
  import { GLTFParserContext } from "./GLTFParserContext";
4
4
  export declare class GLTFBufferParser extends GLTFParser {
@@ -1,4 +1,4 @@
1
- import { AssetPromise, Material, PBRMaterial, PBRSpecularMaterial, UnlitMaterial } from "@oasis-engine/core";
1
+ import { AssetPromise, Material, PBRMaterial, PBRSpecularMaterial, UnlitMaterial } from "@galacean/engine-core";
2
2
  import { IMaterial, ITextureInfo } from "../GLTFSchema";
3
3
  import { GLTFParser } from "./GLTFParser";
4
4
  import { GLTFParserContext } from "./GLTFParserContext";
@@ -1,4 +1,4 @@
1
- import { AssetPromise, ModelMesh, TypedArray } from "@oasis-engine/core";
1
+ import { AssetPromise, ModelMesh, TypedArray } from "@galacean/engine-core";
2
2
  import { ModelMeshRestoreInfo } from "../../GLTFContentRestorer";
3
3
  import { IGLTF, IMesh, IMeshPrimitive } from "../GLTFSchema";
4
4
  import { GLTFParser } from "./GLTFParser";
@@ -1,4 +1,4 @@
1
- import { AnimationClip, AssetPromise, EngineObject, Material, Mesh } from "@oasis-engine/core";
1
+ import { AnimationClip, AssetPromise, EngineObject, Material, Mesh } from "@galacean/engine-core";
2
2
  import { GLTFExtensionMode, GLTFExtensionParser } from "../extensions/GLTFExtensionParser";
3
3
  import { GLTFExtensionOwnerSchema } from "../GLTFSchema";
4
4
  import { GLTFParserContext } from "./GLTFParserContext";
@@ -1,4 +1,4 @@
1
- import { AnimationClip, AssetPromise, Buffer, Entity, Material, ModelMesh, Texture2D, TypedArray } from "@oasis-engine/core";
1
+ import { AnimationClip, AssetPromise, Buffer, Entity, Material, ModelMesh, Texture2D, TypedArray } from "@galacean/engine-core";
2
2
  import { BufferDataRestoreInfo, GLTFContentRestorer } from "../../GLTFContentRestorer";
3
3
  import { GLTFResource } from "../GLTFResource";
4
4
  import { IGLTF } from "../GLTFSchema";
@@ -1,10 +1,10 @@
1
- import { Entity } from "@oasis-engine/core";
1
+ import { Entity } from "@galacean/engine-core";
2
2
  import { GLTFParser } from "./GLTFParser";
3
3
  import { GLTFParserContext } from "./GLTFParserContext";
4
4
  export declare class GLTFSceneParser extends GLTFParser {
5
5
  private static _defaultMaterial;
6
6
  private static _getDefaultMaterial;
7
- parse(context: GLTFParserContext): import("@oasis-engine/core").AssetPromise<Entity>;
7
+ parse(context: GLTFParserContext): import("@galacean/engine-core").AssetPromise<Entity>;
8
8
  private _createCamera;
9
9
  private _createRenderer;
10
10
  private _createAnimator;
@@ -1,4 +1,4 @@
1
- import { AssetPromise, Texture2D } from "@oasis-engine/core";
1
+ import { AssetPromise, Texture2D } from "@galacean/engine-core";
2
2
  import { GLTFParser } from "./GLTFParser";
3
3
  import { GLTFParserContext } from ".";
4
4
  export declare class GLTFTextureParser extends GLTFParser {
@@ -1,4 +1,4 @@
1
- import { AssetPromise } from "@oasis-engine/core";
1
+ import { AssetPromise } from "@galacean/engine-core";
2
2
  import { GLTFParser } from "./GLTFParser";
3
3
  import { GLTFParserContext } from "./GLTFParserContext";
4
4
  export declare class GLTFValidator extends GLTFParser {
package/types/index.d.ts CHANGED
@@ -2,7 +2,6 @@ import "./AnimatorControllerLoader";
2
2
  import "./BufferLoader";
3
3
  import "./EnvLoader";
4
4
  import "./FontLoader";
5
- import "./gltf/extensions/index";
6
5
  import "./GLTFLoader";
7
6
  import "./HDRLoader";
8
7
  import "./JSONLoader";
@@ -15,9 +14,10 @@ import "./SpriteAtlasLoader";
15
14
  import "./SpriteLoader";
16
15
  import "./Texture2DLoader";
17
16
  import "./TextureCubeLoader";
17
+ import "./AnimationClipLoader";
18
18
  export { parseSingleKTX } from "./compressed-texture";
19
- export { GLTFResource } from "./gltf/GLTFResource";
20
19
  export type { GLTFParams } from "./GLTFLoader";
21
20
  export * from "./resource-deserialize";
22
21
  export * from "./SceneLoader";
23
22
  export type { Texture2DParams } from "./Texture2DLoader";
23
+ export * from "./gltf";
@@ -1,5 +1,5 @@
1
1
  import type { BackgroundMode } from "@galacean/engine-core";
2
- import { IRefObject } from "@galacean/engine-core/types/asset/IRefObject";
2
+ import { IReferable } from "@galacean/engine-core/types/asset/IReferable";
3
3
  import { IColor } from "../mesh/IModelMesh";
4
4
  export interface IPrefabFile {
5
5
  entities: Array<IEntity>;
@@ -9,11 +9,11 @@ export interface IScene extends IPrefabFile {
9
9
  background: {
10
10
  mode: BackgroundMode;
11
11
  color: IColor;
12
- texture?: IRefObject;
13
- sky?: IRefObject;
12
+ texture?: IReferable;
13
+ sky?: IReferable;
14
14
  };
15
15
  ambient: {
16
- ambientLight: IRefObject;
16
+ ambientLight: IReferable;
17
17
  diffuseSolidColor: IColor;
18
18
  diffuseIntensity: number;
19
19
  specularIntensity: number;