@galacean/engine-loader 2.0.0-alpha.30 → 2.0.0-alpha.32

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": "2.0.0-alpha.30",
3
+ "version": "2.0.0-alpha.32",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -19,9 +19,9 @@
19
19
  "libs/**/*"
20
20
  ],
21
21
  "dependencies": {
22
- "@galacean/engine-core": "2.0.0-alpha.30",
23
- "@galacean/engine-math": "2.0.0-alpha.30",
24
- "@galacean/engine-rhi-webgl": "2.0.0-alpha.30"
22
+ "@galacean/engine-core": "2.0.0-alpha.32",
23
+ "@galacean/engine-rhi-webgl": "2.0.0-alpha.32",
24
+ "@galacean/engine-math": "2.0.0-alpha.32"
25
25
  },
26
26
  "scripts": {
27
27
  "b:types": "tsc"
package/types/index.d.ts CHANGED
@@ -20,7 +20,6 @@ import "./TextureLoader";
20
20
  import "./AudioLoader";
21
21
  import "./ktx2/KTX2Loader";
22
22
  import "./ShaderLoader";
23
- import "./ShaderChunkLoader";
24
23
  import "./PhysicsMaterialLoader";
25
24
  import "./RenderTargetLoader";
26
25
  export { GLTFLoader } from "./GLTFLoader";
@@ -14,7 +14,7 @@ export declare abstract class HierarchyParser<T extends Scene | PrefabResource,
14
14
  protected _reflectionParser: ReflectionParser;
15
15
  constructor(data: HierarchyFile, context: V);
16
16
  start(): void;
17
- /** Root entity indices for this hierarchy (scene.entities or [prefab.root]). */
17
+ /** Root entity indices for this hierarchy (scene.rootEntities or [prefab.root]). */
18
18
  protected abstract _getRootIndices(): number[];
19
19
  protected abstract _handleRootEntity(index: number): void;
20
20
  protected abstract _clearAndResolve(): Scene | PrefabResource;
@@ -9,7 +9,7 @@ export declare class ReflectionParser {
9
9
  constructor(_context: ParserContext, _refs: RefItem[]);
10
10
  /**
11
11
  * Apply v2 props to a component/object instance.
12
- * Each prop value is resolved recursively (handling $ref, $type, $entity, $component, $signal).
12
+ * Each prop value is resolved recursively (handling $ref, $type, $class, $entity, $component, $signal).
13
13
  */
14
14
  parseProps(instance: any, props?: Record<string, unknown>): Promise<any>;
15
15
  /**
@@ -29,12 +29,16 @@ export declare class ReflectionParser {
29
29
  * 2. Array → recurse each element
30
30
  * 3. { $ref } → asset reference
31
31
  * 4. { $type } → polymorphic type construct
32
- * 5. { $entity } entity reference by path (flat index + optional children descent)
33
- * 6. { $component } component reference
34
- * 7. { $signal } signal binding
35
- * 8. plain object recurse values (modify originValue in place if exists)
32
+ * 5. { $class } registered class constructor
33
+ * 6. { $entity } entity reference by path (flat index + optional children descent)
34
+ * 7. { $component } component reference
35
+ * 8. { $signal } signal binding
36
+ * 9. plain object → recurse values (modify originValue in place if exists)
36
37
  */
37
38
  private _resolveValue;
39
+ private _getRegisteredClass;
40
+ /** Promise-adapt {@link _getRegisteredClass} so $type/$class branches can fold into the resolver chain. */
41
+ private _resolveRegisteredClass;
38
42
  private _resolveSignal;
39
43
  private _resolveComponent;
40
44
  private _resolveEntityRef;
@@ -11,6 +11,10 @@ export interface ComponentRef {
11
11
  type: string;
12
12
  index: number;
13
13
  }
14
+ /** Reference to a registered runtime class constructor. */
15
+ export interface ClassRef {
16
+ $class: string;
17
+ }
14
18
  export interface SignalListener {
15
19
  target: {
16
20
  $component: ComponentRef;
@@ -1,47 +1,5 @@
1
- import { BlendFactor, BlendOperation, ColorWriteMask, CompareFunction, CullMode, RenderQueueType, StencilOperation } from "@galacean/engine-core";
2
1
  import type { RefItem } from "./CommonSchema";
3
2
  import type { IColor, IVector2, IVector3 } from "./BasicSchema";
4
- export interface IRenderState {
5
- blendState: {
6
- targetBlendState: {
7
- enabled: boolean;
8
- colorBlendOperation: BlendOperation;
9
- alphaBlendOperation: BlendOperation;
10
- sourceColorBlendFactor: BlendFactor;
11
- sourceAlphaBlendFactor: BlendFactor;
12
- destinationColorBlendFactor: BlendFactor;
13
- destinationAlphaBlendFactor: BlendFactor;
14
- colorWriteMask: ColorWriteMask;
15
- };
16
- blendColor: IColor;
17
- alphaToCoverage: boolean;
18
- };
19
- depthState: {
20
- enabled: boolean;
21
- writeEnabled: boolean;
22
- compareFunction: CompareFunction;
23
- };
24
- stencilState: {
25
- enabled: boolean;
26
- referenceValue: number;
27
- mask: number;
28
- writeMask: number;
29
- compareFunctionFront: CompareFunction;
30
- compareFunctionBack: CompareFunction;
31
- passOperationFront: StencilOperation;
32
- passOperationBack: StencilOperation;
33
- failOperationFront: StencilOperation;
34
- failOperationBack: StencilOperation;
35
- zFailOperationFront: StencilOperation;
36
- zFailOperationBack: StencilOperation;
37
- };
38
- rasterState: {
39
- cullMode: CullMode;
40
- depthBias: number;
41
- slopeScaledDepthBias: number;
42
- };
43
- renderQueueType: RenderQueueType;
44
- }
45
3
  export interface IMaterialSchema {
46
4
  name: string;
47
5
  shader: string;
@@ -55,7 +13,6 @@ export interface IMaterialSchema {
55
13
  name: string;
56
14
  value?: string;
57
15
  }>;
58
- renderState: IRenderState;
59
16
  shaderRef: RefItem;
60
17
  }
61
18
  export declare enum MaterialLoaderType {
@@ -2,13 +2,13 @@ import { BackgroundMode, BackgroundTextureFillMode, DiffuseMode, FogMode, Shadow
2
2
  import type { HierarchyFile } from "./HierarchySchema";
3
3
  import type { Vec3Tuple, Vec4Tuple } from "./CommonSchema";
4
4
  export declare enum SpecularMode {
5
- Sky = "Sky",
6
- Custom = "Custom"
5
+ Sky = 0,
6
+ Custom = 1
7
7
  }
8
8
  export interface SceneFile extends HierarchyFile {
9
9
  scene: {
10
10
  name?: string;
11
- entities: number[];
11
+ rootEntities: number[];
12
12
  background: {
13
13
  mode: BackgroundMode;
14
14
  color: Vec4Tuple;
@@ -1,9 +0,0 @@
1
- import { AssetPromise, LoadItem, Loader, ResourceManager } from "@galacean/engine-core";
2
- export declare class ShaderChunkLoader extends Loader<void[]> {
3
- private static _shaderIncludeRegex;
4
- /**
5
- * @internal
6
- */
7
- static _loadChunksInCode(code: string, basePath: string, resourceManager: ResourceManager): Promise<void[]>;
8
- load(item: LoadItem, resourceManager: ResourceManager): AssetPromise<void[]>;
9
- }