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

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": "1.0.0-alpha.6",
3
+ "version": "1.0.0-beta.1",
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-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"
18
+ "@galacean/engine-draco": "1.0.0-beta.1",
19
+ "@galacean/engine-math": "1.0.0-beta.1",
20
+ "@galacean/engine-rhi-webgl": "1.0.0-beta.1",
21
+ "@galacean/engine-core": "1.0.0-beta.1"
22
22
  },
23
23
  "scripts": {
24
24
  "b:types": "tsc"
@@ -12,9 +12,6 @@ export declare class GLTFContentRestorer extends ContentRestorer<GLTFResource> {
12
12
  glbBufferSlices: Vector2[];
13
13
  bufferTextures: BufferTextureRestoreInfo[];
14
14
  meshes: ModelMeshRestoreInfo[];
15
- /**
16
- * @override
17
- */
18
15
  restoreContent(): AssetPromise<GLTFResource>;
19
16
  private _getBufferData;
20
17
  }
@@ -2,16 +2,16 @@ import { AssetPromise, Loader, LoadItem, ResourceManager } from "@galacean/engin
2
2
  import { GLTFPipeline } from "./gltf/GLTFPipeline";
3
3
  import { GLTFResource } from "./gltf/GLTFResource";
4
4
  export declare class GLTFLoader extends Loader<GLTFResource> {
5
- /**
6
- * @override
7
- */
8
5
  load(item: LoadItem, resourceManager: ResourceManager): Record<string, AssetPromise<any>>;
9
6
  }
10
7
  /**
11
8
  * GlTF loader params.
12
9
  */
13
10
  export interface GLTFParams {
14
- /** Keep raw mesh data for glTF parser, default is false. */
11
+ /**
12
+ * @beta Now only contains vertex information, need to improve.
13
+ * Keep raw mesh data for glTF parser, default is false.
14
+ */
15
15
  keepMeshData: boolean;
16
16
  /** Custom glTF pipeline. */
17
17
  pipeline: GLTFPipeline;
@@ -7,8 +7,5 @@ export declare class Texture2DContentRestorer extends ContentRestorer<Texture2D>
7
7
  url: string;
8
8
  requestConfig: RequestConfig;
9
9
  constructor(resource: Texture2D, url: string, requestConfig: RequestConfig);
10
- /**
11
- * @override
12
- */
13
10
  restoreContent(): AssetPromise<Texture2D>;
14
11
  }
@@ -7,8 +7,5 @@ export declare class TextureCubeContentRestorer extends ContentRestorer<TextureC
7
7
  urls: string[];
8
8
  requestConfig: RequestConfig;
9
9
  constructor(resource: TextureCube, urls: string[], requestConfig: RequestConfig);
10
- /**
11
- * @override
12
- */
13
10
  restoreContent(): AssetPromise<TextureCube>;
14
11
  }
@@ -28,8 +28,5 @@ export declare class GLTFResource extends EngineObject {
28
28
  /** Extensions data. */
29
29
  extensionsData: Record<string, any>;
30
30
  constructor(engine: Engine, url: string);
31
- /**
32
- * @override
33
- */
34
31
  protected _onDestroy(): void;
35
32
  }
@@ -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 { AccessorComponentType, AccessorType, IAccessor, IBufferView, IGLTF } from "./GLTFSchema";
4
- import { BufferInfo, GLTFParserContext } from "./parser/GLTFParserContext";
3
+ import { BufferInfo, ParserContext } from "./parser/ParserContext";
4
+ import { AccessorComponentType, AccessorType, IAccessor, IBufferView, IGLTF } from "./Schema";
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 | Int8ArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor;
24
+ static getComponentType(componentType: AccessorComponentType): Uint8ArrayConstructor | Float32ArrayConstructor | Uint16ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Uint32ArrayConstructor;
25
25
  static getNormalizedComponentScale(componentType: AccessorComponentType): number;
26
- static getAccessorBuffer(context: GLTFParserContext, bufferViews: IBufferView[], accessor: IAccessor): BufferInfo;
26
+ static getAccessorBuffer(context: ParserContext, gltf: IGLTF, 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(bufferViews: IBufferView[], accessor: IAccessor, buffers: ArrayBuffer[], bufferInfo: BufferInfo): void;
36
+ static processingSparseData(gltf: IGLTF, accessor: IAccessor, buffers: ArrayBuffer[], originData: TypedArray): TypedArray;
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(context: GLTFParserContext, glb: ArrayBuffer): {
49
- glTF: IGLTF;
48
+ static parseGLB(glb: ArrayBuffer): {
49
+ gltf: IGLTF;
50
50
  buffers: ArrayBuffer[];
51
51
  };
52
52
  private static _formatRelativePath;
@@ -0,0 +1,47 @@
1
+ import { IndexFormat, TypedArray, VertexElementFormat } from "@galacean/engine-core";
2
+ import { Color, Vector2, Vector3, Vector4 } from "@galacean/engine-math";
3
+ import { AccessorComponentType, AccessorType, IAccessor, IBufferView, IGLTF } from "./GLTFSchema";
4
+ import { BufferInfo, GLTFParserContext } from "./parser/GLTFParserContext";
5
+ /**
6
+ * @internal
7
+ */
8
+ export declare class GLTFUtils {
9
+ static floatBufferToVector2Array(buffer: Float32Array): Vector2[];
10
+ static floatBufferToVector3Array(buffer: Float32Array): Vector3[];
11
+ static floatBufferToVector4Array(buffer: Float32Array): Vector4[];
12
+ static floatBufferToColorArray(buffer: Float32Array, isColor3: boolean): Color[];
13
+ /**
14
+ * Get the number of bytes occupied by accessor type.
15
+ */
16
+ static getAccessorTypeSize(accessorType: AccessorType): number;
17
+ /**
18
+ * Get the TypedArray corresponding to the component type.
19
+ */
20
+ static getComponentType(componentType: AccessorComponentType): Uint8ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor;
21
+ static getNormalizedComponentScale(componentType: AccessorComponentType): number;
22
+ static getAccessorBuffer(context: GLTFParserContext, bufferViews: IBufferView[], accessor: IAccessor): BufferInfo;
23
+ /**
24
+ * @deprecated
25
+ * Get accessor data.
26
+ */
27
+ static getAccessorData(glTF: IGLTF, accessor: IAccessor, buffers: ArrayBuffer[]): TypedArray;
28
+ static getBufferViewData(bufferView: IBufferView, buffers: ArrayBuffer[]): ArrayBuffer;
29
+ /**
30
+ * Get accessor data.
31
+ */
32
+ static processingSparseData(bufferViews: IBufferView[], accessor: IAccessor, buffers: ArrayBuffer[], bufferInfo: BufferInfo): void;
33
+ static getIndexFormat(type: AccessorComponentType): IndexFormat;
34
+ static getElementFormat(type: AccessorComponentType, size: number, normalized?: boolean): VertexElementFormat;
35
+ /**
36
+ * Load image buffer
37
+ */
38
+ static loadImageBuffer(imageBuffer: ArrayBuffer, type: string): Promise<HTMLImageElement>;
39
+ /**
40
+ * Parse the glb format.
41
+ */
42
+ static parseGLB(context: GLTFParserContext, glb: ArrayBuffer): {
43
+ glTF: IGLTF;
44
+ buffers: ArrayBuffer[];
45
+ };
46
+ private static _formatRelativePath;
47
+ }
@@ -139,11 +139,11 @@ export interface IGalaceanMaterialRemap {
139
139
  key?: string;
140
140
  isClone?: boolean;
141
141
  }
142
- export interface IOasisAnimation {
142
+ export interface IGalaceanAnimation {
143
143
  events: {
144
144
  time: number;
145
145
  functionName: string;
146
146
  parameter: any;
147
147
  }[];
148
148
  }
149
- export type GLTFExtensionSchema = IKHRLightsPunctual_Light | IKHRDracoMeshCompression | IKHRMaterialsClearcoat | IKHRMaterialsIor | IKHRMaterialsUnlit | IKHRMaterialsPbrSpecularGlossiness | IKHRMaterialsSheen | IKHRMaterialsSpecular | IKHRMaterialsTransmission | IKHRMaterialsTranslucency | IKHRMaterialVariants_Mapping | IKHRMaterialVariants_Variants | IKHRTextureBasisU | IKHRTextureTransform | IKHRXmp | IKHRXmp_Node | IOasisAnimation | Object;
149
+ export type GLTFExtensionSchema = IKHRLightsPunctual_Light | IKHRDracoMeshCompression | IKHRMaterialsClearcoat | IKHRMaterialsIor | IKHRMaterialsUnlit | IKHRMaterialsPbrSpecularGlossiness | IKHRMaterialsSheen | IKHRMaterialsSpecular | IKHRMaterialsTransmission | IKHRMaterialsTranslucency | IKHRMaterialVariants_Mapping | IKHRMaterialVariants_Variants | IKHRTextureBasisU | IKHRTextureTransform | IKHRXmp | IKHRXmp_Node | IGalaceanAnimation | Object;
@@ -11,7 +11,7 @@ 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";
15
- import "./OASIS_animation_event";
14
+ import "./GALACEAN_materials_remap";
15
+ import "./GALACEAN_animation_event";
16
16
  export { GLTFExtensionParser, GLTFExtensionMode } from "./GLTFExtensionParser";
17
17
  export * from "./GLTFExtensionSchema";
@@ -1,6 +1,6 @@
1
1
  export { GLTFPipeline } from "./GLTFPipeline";
2
2
  export { GLTFResource } from "./GLTFResource";
3
- export { GLTFUtil } from "./GLTFUtil";
3
+ export { GLTFUtils } from "./GLTFUtils";
4
4
  export * from "./parser";
5
5
  export * from "./extensions/index";
6
6
  export type { IMaterial, IMeshPrimitive, ITextureInfo, INode, GLTFExtensionOwnerSchema } from "./GLTFSchema";
@@ -1 +0,0 @@
1
- export {};