@galacean/engine-loader 1.0.3 → 1.0.4

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.3",
3
+ "version": "1.0.4",
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.3",
19
- "@galacean/engine-draco": "1.0.3",
20
- "@galacean/engine-math": "1.0.3",
21
- "@galacean/engine-rhi-webgl": "1.0.3"
18
+ "@galacean/engine-core": "1.0.4",
19
+ "@galacean/engine-draco": "1.0.4",
20
+ "@galacean/engine-math": "1.0.4",
21
+ "@galacean/engine-rhi-webgl": "1.0.4"
22
22
  },
23
23
  "scripts": {
24
24
  "b:types": "tsc"
@@ -0,0 +1,6 @@
1
+ import { Entity } from "@galacean/engine-core";
2
+ import { PrefabParserContext } from "./resource-deserialize/resources/parser/PrefabParserContext";
3
+ export interface IPrefabContextData {
4
+ context: PrefabParserContext;
5
+ entity: Entity;
6
+ }
@@ -21,7 +21,7 @@ export declare class GLTFUtil {
21
21
  /**
22
22
  * Get the TypedArray corresponding to the component type.
23
23
  */
24
- static getComponentType(componentType: AccessorComponentType): Int8ArrayConstructor | Uint8ArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor;
24
+ static getComponentType(componentType: AccessorComponentType): Uint8ArrayConstructor | Float32ArrayConstructor | Uint16ArrayConstructor | Int8ArrayConstructor | Int16ArrayConstructor | Uint32ArrayConstructor;
25
25
  static getNormalizedComponentScale(componentType: AccessorComponentType): number;
26
26
  static getAccessorBuffer(context: ParserContext, gltf: IGLTF, accessor: IAccessor): BufferInfo;
27
27
  /**
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ declare const MeshoptDecoder: {
2
+ ready: Promise<void>;
3
+ supported: boolean;
4
+ useWorkers: (count: any) => void;
5
+ decodeVertexBuffer: (target: any, count: any, size: any, source: any, filter: any) => void;
6
+ decodeIndexBuffer: (target: any, count: any, size: any, source: any) => void;
7
+ decodeIndexSequence: (target: any, count: any, size: any, source: any) => void;
8
+ decodeGltfBuffer: (target: any, count: any, size: any, source: any, mode: any, filter: any) => void;
9
+ decodeGltfBufferAsync: (count: number, stride: number, source: Uint8Array, mode: any, filter: any) => Promise<Uint8Array>;
10
+ release(): void;
11
+ };
12
+ export { MeshoptDecoder };
@@ -0,0 +1,4 @@
1
+ export declare enum ColorModel {
2
+ ETC1S = 163,
3
+ UASTC = 166
4
+ }
@@ -0,0 +1,8 @@
1
+ export declare enum TargetFormat {
2
+ ASTC = 0,
3
+ BC7 = 1,
4
+ DXT = 2,
5
+ PVRTC = 3,
6
+ ETC = 4,
7
+ RGBA8 = 5
8
+ }
@@ -20,7 +20,7 @@ export interface InitMessage extends BaseMessage {
20
20
  export interface BinomialTranscodeMessage extends BaseMessage {
21
21
  type: "transcode";
22
22
  format: number;
23
- buffer: ArrayBuffer;
23
+ buffer: Uint8Array;
24
24
  }
25
25
  export type IBinomialMessage = InitMessage | BinomialTranscodeMessage;
26
26
  export type TranscodeResult = {
@@ -4,5 +4,5 @@ import { AbstractTranscoder, TranscodeResult } from "./AbstractTranscoder";
4
4
  export declare class BinomialLLCTranscoder extends AbstractTranscoder {
5
5
  constructor(workerLimitCount: number);
6
6
  _initTranscodeWorkerPool(): Promise<any>;
7
- transcode(buffer: ArrayBuffer, format: KTX2TargetFormat): Promise<TranscodeResult>;
7
+ transcode(buffer: Uint8Array, format: KTX2TargetFormat): Promise<TranscodeResult>;
8
8
  }
@@ -3,4 +3,4 @@ import { TranscodeResult } from "./AbstractTranscoder";
3
3
  export declare function TranscodeWorkerCode(): void;
4
4
  export declare const _init: () => (wasmBinary?: ArrayBuffer) => any;
5
5
  export declare const init: (wasmBinary?: ArrayBuffer) => any;
6
- export declare function transcode(buffer: ArrayBuffer, targetFormat: any, KTX2File: any): TranscodeResult;
6
+ export declare function transcode(buffer: Uint8Array, targetFormat: any, KTX2File: any): TranscodeResult;
@@ -0,0 +1,43 @@
1
+ import { Entity, Engine, Scene } from "@galacean/engine-core";
2
+ import type { IPrefabFile } from "../schema";
3
+ import { ParserContext } from "./ParserContext";
4
+ /**
5
+ * HierarchyParser parser.
6
+ * Any HierarchyParser parser should extends this class, like scene parser, prefab parser, etc.
7
+ * @export
8
+ * @abstract
9
+ * @class HierarchyParserParser
10
+ * @template T
11
+ */
12
+ export default abstract class HierarchyParser<T extends Scene | Entity> {
13
+ readonly context: ParserContext<T, IPrefabFile>;
14
+ /**
15
+ * The promise of parsed object.
16
+ */
17
+ readonly promise: Promise<T>;
18
+ protected _engine: Engine;
19
+ protected _resolve: (prefab: T) => void;
20
+ protected _reject: (reason: any) => void;
21
+ private childrenContextMap;
22
+ constructor(context: ParserContext<T, IPrefabFile>);
23
+ /** start parse the scene or prefab or others */
24
+ start(): void;
25
+ /**
26
+ * Append child entity to target.
27
+ * @abstract
28
+ * @param {Entity} entity
29
+ * @memberof ParserContext
30
+ */
31
+ protected abstract appendChild(entity: Entity): void;
32
+ private _parseEntities;
33
+ private _parseComponents;
34
+ private _parsePrefabModification;
35
+ private _clearAndResolve;
36
+ private _organizeEntities;
37
+ private _getEntityByConfig;
38
+ private _parseEntity;
39
+ private _parseGLTF;
40
+ private _parsePrefab;
41
+ private _parseChildren;
42
+ private _applyEntityData;
43
+ }
@@ -0,0 +1,26 @@
1
+ import { Component, Entity } from "@galacean/engine-core";
2
+ import type { IEntity } from "../schema";
3
+ /**
4
+ * Parser context
5
+ * @export
6
+ * @abstract
7
+ * @class ParserContext
8
+ * @template T
9
+ * @template I
10
+ */
11
+ export declare abstract class ParserContext<T, I> {
12
+ readonly originalData: I;
13
+ readonly target: T;
14
+ entityMap: Map<string, Entity>;
15
+ components: Map<string, Component>;
16
+ assets: Map<string, any>;
17
+ entityConfigMap: Map<string, IEntity>;
18
+ rootIds: string[];
19
+ constructor(originalData: I, target: T);
20
+ /**
21
+ * Destroy the context.
22
+ * @abstract
23
+ * @memberof ParserContext
24
+ */
25
+ destroy(): void;
26
+ }
@@ -0,0 +1,5 @@
1
+ import { Entity } from "@galacean/engine-core";
2
+ import { IPrefabFile } from "../schema";
3
+ import { ParserContext } from "./ParserContext";
4
+ export declare class PrefabParserContext extends ParserContext<Entity, IPrefabFile> {
5
+ }
@@ -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;