@galacean/engine-loader 1.0.0-beta.0 → 1.0.0-beta.10

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.
Files changed (44) hide show
  1. package/dist/main.js +164 -123
  2. package/dist/main.js.map +1 -1
  3. package/dist/miniprogram.js +164 -123
  4. package/dist/module.js +166 -125
  5. package/dist/module.js.map +1 -1
  6. package/package.json +5 -5
  7. package/types/GLTFContentRestorer.d.ts +1 -4
  8. package/types/GLTFLoader.d.ts +0 -3
  9. package/types/Texture2DContentRestorer.d.ts +0 -3
  10. package/types/TextureCubeContentRestorer.d.ts +0 -3
  11. package/types/gltf/GLTFParser.d.ts +9 -0
  12. package/types/gltf/GLTFResource.d.ts +1 -1
  13. package/types/gltf/GLTFUtil.d.ts +53 -0
  14. package/types/gltf/GLTFUtils.d.ts +1 -1
  15. package/types/gltf/Schema.d.ts +814 -0
  16. package/types/gltf/extensions/ExtensionParser.d.ts +8 -0
  17. package/types/gltf/extensions/GLTFExtensionSchema.d.ts +1 -1
  18. package/types/gltf/extensions/KHR_materials_ior.d.ts +1 -0
  19. package/types/gltf/extensions/Schema.d.ts +142 -0
  20. package/types/gltf/extensions/index.d.ts +1 -0
  21. package/types/gltf/parser/AnimationParser.d.ts +7 -0
  22. package/types/gltf/parser/BufferParser.d.ts +7 -0
  23. package/types/gltf/parser/EntityParser.d.ts +9 -0
  24. package/types/gltf/parser/GLTFMeshParser.d.ts +1 -1
  25. package/types/gltf/parser/GLTFParser.d.ts +1 -1
  26. package/types/gltf/parser/GLTFParserContext.d.ts +1 -1
  27. package/types/gltf/parser/MaterialParser.d.ts +8 -0
  28. package/types/gltf/parser/MeshParser.d.ts +13 -0
  29. package/types/gltf/parser/Parser.d.ts +21 -0
  30. package/types/gltf/parser/ParserContext.d.ts +46 -0
  31. package/types/gltf/parser/SceneParser.d.ts +11 -0
  32. package/types/gltf/parser/SkinParser.d.ts +6 -0
  33. package/types/gltf/parser/TextureParser.d.ts +8 -0
  34. package/types/gltf/parser/Validator.d.ts +5 -0
  35. package/types/resource-deserialize/index.d.ts +3 -3
  36. package/types/resource-deserialize/resources/mesh/MeshDecoder.d.ts +1 -1
  37. package/types/resource-deserialize/resources/parser/PrefabParser.d.ts +5 -0
  38. package/types/resource-deserialize/resources/parser/ReflectionParser.d.ts +14 -0
  39. package/types/resource-deserialize/resources/scene/SceneParser.d.ts +1 -1
  40. package/types/resource-deserialize/resources/scene/SceneParserContext.d.ts +1 -1
  41. package/types/resource-deserialize/resources/schema/BasicSchema.d.ts +61 -0
  42. package/types/resource-deserialize/resources/schema/MaterialSchema.d.ts +91 -0
  43. package/types/resource-deserialize/resources/schema/SceneSchema.d.ts +41 -0
  44. package/types/resource-deserialize/resources/schema/index.d.ts +3 -0
@@ -0,0 +1,8 @@
1
+ import { EngineObject } from "@galacean/engine-core";
2
+ import { ParserContext } from "../parser/ParserContext";
3
+ import { ExtensionSchema } from "./Schema";
4
+ export declare abstract class ExtensionParser {
5
+ initialize(): void;
6
+ parseEngineResource(schema: ExtensionSchema, parseResource: EngineObject, context: ParserContext, ...extra: any[]): void | Promise<void>;
7
+ createEngineResource(schema: ExtensionSchema, context: ParserContext, ...extra: any[]): EngineObject | Promise<EngineObject>;
8
+ }
@@ -1,4 +1,4 @@
1
- import { IMaterialNormalTextureInfo, ITextureInfo } from "../GLTFSchema";
1
+ import type { IMaterialNormalTextureInfo, ITextureInfo } from "../GLTFSchema";
2
2
  /**
3
3
  * Interfaces from the KHR_lights_punctual extension
4
4
  */
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,142 @@
1
+ import { IMaterialNormalTextureInfo, ITextureInfo } from "../Schema";
2
+ /**
3
+ * Interfaces from the KHR_lights_punctual extension
4
+ */
5
+ export interface IKHRLightsPunctual_LightNode {
6
+ light: number;
7
+ }
8
+ export interface IKHRLightsPunctual_Light {
9
+ type: "directional" | "point" | "spot";
10
+ color?: number[];
11
+ intensity?: number;
12
+ range?: number;
13
+ spot?: {
14
+ innerConeAngle?: number;
15
+ outerConeAngle?: number;
16
+ };
17
+ }
18
+ export interface IKHRLightsPunctual {
19
+ lights: IKHRLightsPunctual_Light[];
20
+ }
21
+ /**
22
+ * Interfaces from the KHR_draco_mesh_compression extension
23
+ */
24
+ export interface IKHRDracoMeshCompression {
25
+ bufferView: number;
26
+ attributes: {
27
+ [name: string]: number;
28
+ };
29
+ }
30
+ /**
31
+ * Interfaces from the KHR_materials_clearcoat extension
32
+ */
33
+ export interface IKHRMaterialsClearcoat {
34
+ clearcoatFactor: number;
35
+ clearcoatTexture: ITextureInfo;
36
+ clearcoatRoughnessFactor: number;
37
+ clearcoatRoughnessTexture: ITextureInfo;
38
+ clearcoatNormalTexture: IMaterialNormalTextureInfo;
39
+ }
40
+ /**
41
+ * Interfaces from the KHR_materials_ior extension
42
+ */
43
+ export interface IKHRMaterialsIor {
44
+ ior: number;
45
+ }
46
+ /**
47
+ * Interfaces from the KHR_materials_unlit extension
48
+ */
49
+ export interface IKHRMaterialsUnlit {
50
+ }
51
+ /**
52
+ * Interfaces from the KHR_materials_pbrSpecularGlossiness extension
53
+ */
54
+ export interface IKHRMaterialsPbrSpecularGlossiness {
55
+ diffuseFactor: number[];
56
+ diffuseTexture: ITextureInfo;
57
+ specularFactor: number[];
58
+ glossinessFactor: number;
59
+ specularGlossinessTexture: ITextureInfo;
60
+ }
61
+ /**
62
+ * Interfaces from the KHR_materials_sheen extension
63
+ */
64
+ export interface IKHRMaterialsSheen {
65
+ sheenColorFactor?: number[];
66
+ sheenColorTexture?: ITextureInfo;
67
+ sheenRoughnessFactor?: number;
68
+ sheenRoughnessTexture?: ITextureInfo;
69
+ }
70
+ /**
71
+ * Interfaces from the KHR_materials_specular extension
72
+ */
73
+ export interface IKHRMaterialsSpecular {
74
+ specularFactor: number;
75
+ specularColorFactor: number[];
76
+ specularTexture: ITextureInfo;
77
+ }
78
+ /**
79
+ * Interfaces from the KHR_materials_transmission extension
80
+ */
81
+ export interface IKHRMaterialsTransmission {
82
+ transmissionFactor?: number;
83
+ transmissionTexture?: ITextureInfo;
84
+ }
85
+ /**
86
+ * Interfaces from the KHR_materials_translucency extension
87
+ */
88
+ export interface IKHRMaterialsTranslucency {
89
+ translucencyFactor?: number;
90
+ translucencyTexture?: ITextureInfo;
91
+ }
92
+ /**
93
+ * Interfaces from the KHR_materials_variants extension
94
+ */
95
+ export interface IKHRMaterialVariants_Mapping {
96
+ mappings: Array<{
97
+ variants: number[];
98
+ material: number;
99
+ }>;
100
+ extensions?: any;
101
+ extras?: any;
102
+ }
103
+ export interface IKHRMaterialVariants_Variant {
104
+ name: string;
105
+ extensions?: any;
106
+ extras?: any;
107
+ }
108
+ export interface IKHRMaterialVariants_Variants {
109
+ variants: Array<IKHRMaterialVariants_Variant>;
110
+ }
111
+ /**
112
+ * Interfaces from the KHR_texture_basisu extension
113
+ */
114
+ export interface IKHRTextureBasisU {
115
+ source: number;
116
+ }
117
+ /**
118
+ * Interfaces from the KHR_texture_transform extension
119
+ */
120
+ export interface IKHRTextureTransform {
121
+ offset?: number[];
122
+ rotation?: number;
123
+ scale?: number[];
124
+ texCoord?: number;
125
+ }
126
+ /**
127
+ * Interfaces from the KHR_xmp extension
128
+ */
129
+ export interface IKHRXmp {
130
+ packets: Array<{
131
+ [key: string]: unknown;
132
+ }>;
133
+ }
134
+ export interface IKHRXmp_Node {
135
+ packet: number;
136
+ }
137
+ export interface IGalaceanMaterialRemap {
138
+ refId: string;
139
+ key?: string;
140
+ isClone?: boolean;
141
+ }
142
+ export type ExtensionSchema = IKHRLightsPunctual_Light | IKHRDracoMeshCompression | IKHRMaterialsClearcoat | IKHRMaterialsIor | IKHRMaterialsUnlit | IKHRMaterialsPbrSpecularGlossiness | IKHRMaterialsSheen | IKHRMaterialsSpecular | IKHRMaterialsTransmission | IKHRMaterialsTranslucency | IKHRMaterialVariants_Mapping | IKHRMaterialVariants_Variants | IKHRTextureBasisU | IKHRTextureTransform | IKHRXmp | IKHRXmp_Node;
@@ -11,6 +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 "./KHR_materials_ior";
14
15
  import "./GALACEAN_materials_remap";
15
16
  import "./GALACEAN_animation_event";
16
17
  export { GLTFExtensionParser, GLTFExtensionMode } from "./GLTFExtensionParser";
@@ -0,0 +1,7 @@
1
+ import { AnimationClip, AssetPromise } from "@galacean/engine-core";
2
+ import { Parser } from "./Parser";
3
+ import { ParserContext } from "./ParserContext";
4
+ export declare class AnimationParser extends Parser {
5
+ parse(context: ParserContext): AssetPromise<AnimationClip[]>;
6
+ private _addCurve;
7
+ }
@@ -0,0 +1,7 @@
1
+ import { AssetPromise } from "@galacean/engine-core";
2
+ import { Parser } from "./Parser";
3
+ import { ParserContext } from "./ParserContext";
4
+ export declare class BufferParser extends Parser {
5
+ parse(context: ParserContext): AssetPromise<void>;
6
+ private _isGLB;
7
+ }
@@ -0,0 +1,9 @@
1
+ import { Parser } from "./Parser";
2
+ import { ParserContext } from "./ParserContext";
3
+ export declare class EntityParser extends Parser {
4
+ /** @internal */
5
+ static _defaultName: String;
6
+ parse(context: ParserContext): void;
7
+ private _buildEntityTree;
8
+ private _createSceneRoots;
9
+ }
@@ -1,6 +1,6 @@
1
1
  import { AssetPromise, ModelMesh, TypedArray } from "@galacean/engine-core";
2
2
  import { ModelMeshRestoreInfo } from "../../GLTFContentRestorer";
3
- import { IGLTF, IMesh, IMeshPrimitive } from "../GLTFSchema";
3
+ import type { IGLTF, IMesh, IMeshPrimitive } from "../GLTFSchema";
4
4
  import { GLTFParser } from "./GLTFParser";
5
5
  import { BufferInfo, GLTFParserContext } from "./GLTFParserContext";
6
6
  export declare class GLTFMeshParser extends GLTFParser {
@@ -1,6 +1,6 @@
1
1
  import { AnimationClip, AssetPromise, EngineObject, Material, Mesh } from "@galacean/engine-core";
2
2
  import { GLTFExtensionMode, GLTFExtensionParser } from "../extensions/GLTFExtensionParser";
3
- import { GLTFExtensionOwnerSchema } from "../GLTFSchema";
3
+ import type { GLTFExtensionOwnerSchema } from "../GLTFSchema";
4
4
  import { GLTFParserContext } from "./GLTFParserContext";
5
5
  /**
6
6
  * Base class of glTF parser.
@@ -1,7 +1,7 @@
1
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
- import { IGLTF } from "../GLTFSchema";
4
+ import type { IGLTF } from "../GLTFSchema";
5
5
  /**
6
6
  * @internal
7
7
  */
@@ -0,0 +1,8 @@
1
+ import { AssetPromise, Material } from "@galacean/engine-core";
2
+ import { Parser } from "./Parser";
3
+ import { ParserContext } from "./ParserContext";
4
+ export declare class MaterialParser extends Parser {
5
+ /** @internal */
6
+ static _parseTextureTransform(material: Material, extensions: any, context: ParserContext): void;
7
+ parse(context: ParserContext): AssetPromise<Material[]>;
8
+ }
@@ -0,0 +1,13 @@
1
+ import { AssetPromise, ModelMesh } from "@galacean/engine-core";
2
+ import { Parser } from "./Parser";
3
+ import { ParserContext } from "./ParserContext";
4
+ export declare class MeshParser extends Parser {
5
+ private static _tempVector3;
6
+ parse(context: ParserContext): AssetPromise<ModelMesh[][]>;
7
+ private _parseMeshFromGLTFPrimitive;
8
+ private _createBlendShape;
9
+ /**
10
+ * @deprecated
11
+ */
12
+ private _parseMeshFromGLTFPrimitiveDraco;
13
+ }
@@ -0,0 +1,21 @@
1
+ import { AnimationClip, AssetPromise, EngineObject, Material, Mesh } from "@galacean/engine-core";
2
+ import { ExtensionParser } from "../extensions/ExtensionParser";
3
+ import { ExtensionSchema } from "../extensions/Schema";
4
+ import { ParserContext } from "./ParserContext";
5
+ export declare abstract class Parser {
6
+ private static _extensionParsers;
7
+ static parseEngineResource(extensionName: string, extensionSchema: ExtensionSchema, parseResource: EngineObject, context: ParserContext, ...extra: any[]): void;
8
+ static createEngineResource<T extends EngineObject>(extensionName: string, extensionSchema: ExtensionSchema, context: ParserContext, ...extra: any[]): T | Promise<T>;
9
+ static hasExtensionParser(extensionName: string): boolean;
10
+ static initialize(extensionName: string): void;
11
+ /**
12
+ * @internal
13
+ */
14
+ static _addExtensionParser(extensionName: string, extensionParser: ExtensionParser): void;
15
+ abstract parse(context: ParserContext): AssetPromise<any> | void | Material | AnimationClip | Mesh;
16
+ }
17
+ /**
18
+ * Declare ExtensionParser's decorator.
19
+ * @param extensionName - Extension name
20
+ */
21
+ export declare function registerExtension(extensionName: string): (parser: new () => ExtensionParser) => void;
@@ -0,0 +1,46 @@
1
+ import { AnimationClip, AssetPromise, Buffer, Entity, Material, ModelMesh, Texture2D, TypedArray } from "@galacean/engine-core";
2
+ import { GLTFResource } from "../GLTFResource";
3
+ import { IGLTF } from "../Schema";
4
+ /**
5
+ * @internal
6
+ */
7
+ export declare class ParserContext {
8
+ gltf: IGLTF;
9
+ buffers: ArrayBuffer[];
10
+ glTFResource: GLTFResource;
11
+ keepMeshData: boolean;
12
+ hasSkinned: boolean;
13
+ /** chain asset promise */
14
+ chainPromises: AssetPromise<any>[];
15
+ accessorBufferCache: Record<string, BufferInfo>;
16
+ texturesPromiseInfo: PromiseInfo<Texture2D[]>;
17
+ materialsPromiseInfo: PromiseInfo<Material[]>;
18
+ meshesPromiseInfo: PromiseInfo<ModelMesh[][]>;
19
+ animationClipsPromiseInfo: PromiseInfo<AnimationClip[]>;
20
+ defaultSceneRootPromiseInfo: PromiseInfo<Entity>;
21
+ masterPromiseInfo: PromiseInfo<GLTFResource>;
22
+ promiseMap: Record<string, AssetPromise<any>>;
23
+ constructor(url: string);
24
+ private _initPromiseInfo;
25
+ }
26
+ /**
27
+ * @internal
28
+ */
29
+ export declare class BufferInfo {
30
+ data: TypedArray;
31
+ interleaved: boolean;
32
+ stride: number;
33
+ vertexBuffer: Buffer;
34
+ vertexBindingInfos: Record<number, number>;
35
+ constructor(data: TypedArray, interleaved: boolean, stride: number);
36
+ }
37
+ /**
38
+ * @internal
39
+ */
40
+ export declare class PromiseInfo<T> {
41
+ promise: AssetPromise<T>;
42
+ resolve: (value?: T | PromiseLike<T>) => void;
43
+ reject: (reason?: any) => void;
44
+ setProgress: (progress: number) => void;
45
+ onCancel: (callback: () => void) => void;
46
+ }
@@ -0,0 +1,11 @@
1
+ import { AssetPromise, Entity } from "@galacean/engine-core";
2
+ import { Parser } from "./Parser";
3
+ import { ParserContext } from "./ParserContext";
4
+ export declare class SceneParser extends Parser {
5
+ private static _defaultMaterial;
6
+ private static _getDefaultMaterial;
7
+ parse(context: ParserContext): AssetPromise<Entity>;
8
+ private _createCamera;
9
+ private _createRenderer;
10
+ private _createAnimator;
11
+ }
@@ -0,0 +1,6 @@
1
+ import { Parser } from "./Parser";
2
+ import { ParserContext } from "./ParserContext";
3
+ export declare class SkinParser extends Parser {
4
+ parse(context: ParserContext): void;
5
+ private _findSkeletonRootBone;
6
+ }
@@ -0,0 +1,8 @@
1
+ import { AssetPromise, Texture2D } from "@galacean/engine-core";
2
+ import { Parser } from "./Parser";
3
+ import { ParserContext } from "./ParserContext";
4
+ export declare class TextureParser extends Parser {
5
+ private static _wrapMap;
6
+ parse(context: ParserContext): AssetPromise<Texture2D[]>;
7
+ private _parseSampler;
8
+ }
@@ -0,0 +1,5 @@
1
+ import { Parser } from "./Parser";
2
+ import { ParserContext } from "./ParserContext";
3
+ export declare class Validator extends Parser {
4
+ parse(context: ParserContext): void;
5
+ }
@@ -1,8 +1,8 @@
1
1
  import { Engine } from "@galacean/engine-core";
2
2
  export { MeshDecoder } from "./resources/mesh/MeshDecoder";
3
3
  export { Texture2DDecoder } from "./resources/texture2D/TextureDecoder";
4
- export { ReflectionParser } from "./resources/prefab/ReflectionParser";
5
- export { PrefabParser } from "./resources/prefab/PrefabParser";
4
+ export { ReflectionParser } from "./resources/parser/ReflectionParser";
5
+ export { PrefabParser } from "./resources/parser/PrefabParser";
6
6
  export * from "./resources/animationClip/AnimationClipDecoder";
7
7
  export type { IModelMesh } from "./resources/mesh/IModelMesh";
8
8
  /**
@@ -12,7 +12,7 @@ export type { IModelMesh } from "./resources/mesh/IModelMesh";
12
12
  * @returns
13
13
  */
14
14
  export declare function decode<T>(arrayBuffer: ArrayBuffer, engine: Engine): Promise<T>;
15
- export * from "./resources/prefab/PrefabDesign";
15
+ export * from "./resources/schema";
16
16
  export * from "./resources/scene/SceneParser";
17
17
  export * from "./resources/scene/MeshLoader";
18
18
  export * from "./resources/scene/EditorTextureLoader";
@@ -1,5 +1,5 @@
1
- import { ModelMesh } from "@galacean/engine-core";
2
1
  import type { Engine } from "@galacean/engine-core";
2
+ import { ModelMesh } from "@galacean/engine-core";
3
3
  import type { BufferReader } from "../../utils/BufferReader";
4
4
  /**
5
5
  * @todo refactor
@@ -0,0 +1,5 @@
1
+ import { Entity } from "@galacean/engine-core";
2
+ import type { IEntity } from "../schema";
3
+ export declare class PrefabParser {
4
+ static parseChildren(entitiesConfig: Map<string, IEntity>, entities: Map<string, Entity>, parentId: string): void;
5
+ }
@@ -0,0 +1,14 @@
1
+ import { Engine, Entity } from "@galacean/engine-core";
2
+ import type { IBasicType, IClassObject, IEntity } from "../schema";
3
+ export declare class ReflectionParser {
4
+ static customParseComponentHandles: Map<string, Function>;
5
+ static registerCustomParseComponent(componentType: string, handle: Function): void;
6
+ static parseEntity(entityConfig: IEntity, engine: Engine): Promise<Entity>;
7
+ private static getEntityByConfig;
8
+ static parseClassObject(item: IClassObject, engine: Engine, resourceManager?: any): Promise<any>;
9
+ static parseBasicType(value: IBasicType, engine: Engine, resourceManager?: any): Promise<any>;
10
+ static parsePropsAndMethods(instance: any, item: Omit<IClassObject, "class">, engine: Engine, resourceManager?: any): Promise<any>;
11
+ static parseMethod(instance: any, methodName: string, methodParams: Array<IBasicType>, engine: Engine, resourceManager?: any): Promise<any>;
12
+ private static _isClass;
13
+ private static _isRef;
14
+ }
@@ -1,5 +1,5 @@
1
1
  import { Engine, Scene } from "@galacean/engine-core";
2
- import { IScene } from "../prefab/PrefabDesign";
2
+ import type { IScene } from "../schema";
3
3
  import { SceneParserContext } from "./SceneParserContext";
4
4
  /** @Internal */
5
5
  export declare class SceneParser {
@@ -1,5 +1,5 @@
1
1
  import { Component, Entity, Scene } from "@galacean/engine-core";
2
- import { IEntity, IScene } from "../prefab/PrefabDesign";
2
+ import type { IEntity, IScene } from "../schema";
3
3
  export declare class SceneParserContext {
4
4
  readonly originalData: IScene;
5
5
  readonly scene: Scene;
@@ -0,0 +1,61 @@
1
+ export interface IVector3 {
2
+ x: number;
3
+ y: number;
4
+ z: number;
5
+ }
6
+ export interface IVector2 {
7
+ x: number;
8
+ y: number;
9
+ }
10
+ export interface IVector4 {
11
+ x: number;
12
+ y: number;
13
+ z: number;
14
+ w: number;
15
+ }
16
+ export interface IColor {
17
+ r: number;
18
+ g: number;
19
+ b: number;
20
+ a: number;
21
+ }
22
+ export interface IPrefabFile {
23
+ entities: Array<IEntity>;
24
+ }
25
+ export type IMethodParams = Array<IBasicType>;
26
+ export type IClassObject = {
27
+ class: string;
28
+ constructParams?: IMethodParams;
29
+ methods?: {
30
+ [methodName: string]: Array<IMethodParams>;
31
+ };
32
+ props?: {
33
+ [key: string]: IBasicType | IMethodParams;
34
+ };
35
+ };
36
+ export type IBasicType = string | number | boolean | null | undefined | IAssetRef | IClassObject | IMethodParams;
37
+ export type IAssetRef = {
38
+ key?: string;
39
+ refId: string;
40
+ };
41
+ export interface IBasicEntity {
42
+ name?: string;
43
+ id?: string;
44
+ components?: Array<IComponent>;
45
+ isActive?: boolean;
46
+ position?: IVector3;
47
+ rotation?: IVector3;
48
+ scale?: IVector3;
49
+ children?: Array<string>;
50
+ parent?: string;
51
+ }
52
+ export type IEntity = IBasicEntity | IRefEntity;
53
+ export interface IRefEntity extends IBasicEntity {
54
+ assetRefId: string;
55
+ key?: string;
56
+ isClone?: boolean;
57
+ }
58
+ export type IComponent = {
59
+ id: string;
60
+ refId?: string;
61
+ } & IClassObject;
@@ -0,0 +1,91 @@
1
+ import { BlendFactor, BlendOperation, ColorWriteMask, CompareFunction, CullMode, RenderQueueType, StencilOperation } from "@galacean/engine-core";
2
+ import type { IAssetRef, IColor, IVector2, IVector3 } from "./BasicSchema";
3
+ export interface IRenderState {
4
+ /** Blend state. */
5
+ blendState: {
6
+ /** The blend state of the render target. */
7
+ targetBlendState: {
8
+ /** Whether to enable blend. */
9
+ enabled: boolean;
10
+ /** color (RGB) blend operation. */
11
+ colorBlendOperation: BlendOperation;
12
+ /** alpha (A) blend operation. */
13
+ alphaBlendOperation: BlendOperation;
14
+ /** color blend factor (RGB) for source. */
15
+ sourceColorBlendFactor: BlendFactor;
16
+ /** alpha blend factor (A) for source. */
17
+ sourceAlphaBlendFactor: BlendFactor;
18
+ /** color blend factor (RGB) for destination. */
19
+ destinationColorBlendFactor: BlendFactor;
20
+ /** alpha blend factor (A) for destination. */
21
+ destinationAlphaBlendFactor: BlendFactor;
22
+ /** color mask. */
23
+ colorWriteMask: ColorWriteMask;
24
+ };
25
+ blendColor: IColor;
26
+ /** Whether to use (Alpha-to-Coverage) technology. */
27
+ alphaToCoverage: boolean;
28
+ };
29
+ /** Depth state. */
30
+ depthState: {
31
+ /** Whether to enable the depth test. */
32
+ enabled: boolean;
33
+ /** Whether the depth value can be written.*/
34
+ writeEnabled: boolean;
35
+ /** Depth comparison function. */
36
+ compareFunction: CompareFunction;
37
+ };
38
+ /** Stencil state. */
39
+ stencilState: {
40
+ /** Whether to enable stencil test. */
41
+ enabled: boolean;
42
+ /** Write the reference value of the stencil buffer. */
43
+ referenceValue: number;
44
+ /** Specifying a bit-wise mask that is used to AND the reference value and the stored stencil value when the test is done. */
45
+ mask: number;
46
+ /** Specifying a bit mask to enable or disable writing of individual bits in the stencil planes. */
47
+ writeMask: number;
48
+ /** The comparison function of the reference value of the front face of the geometry and the current buffer storage value. */
49
+ compareFunctionFront: CompareFunction;
50
+ /** The comparison function of the reference value of the back of the geometry and the current buffer storage value. */
51
+ compareFunctionBack: CompareFunction;
52
+ /** specifying the function to use for front face when both the stencil test and the depth test pass. */
53
+ passOperationFront: StencilOperation;
54
+ /** specifying the function to use for back face when both the stencil test and the depth test pass. */
55
+ passOperationBack: StencilOperation;
56
+ /** specifying the function to use for front face when the stencil test fails. */
57
+ failOperationFront: StencilOperation;
58
+ /** specifying the function to use for back face when the stencil test fails. */
59
+ failOperationBack: StencilOperation;
60
+ /** specifying the function to use for front face when the stencil test passes, but the depth test fails. */
61
+ zFailOperationFront: StencilOperation;
62
+ /** specifying the function to use for back face when the stencil test passes, but the depth test fails. */
63
+ zFailOperationBack: StencilOperation;
64
+ };
65
+ /** Raster state. */
66
+ rasterState: {
67
+ /** Specifies whether or not front- and/or back-facing polygons can be culled. */
68
+ cullMode: CullMode;
69
+ /** The multiplier by which an implementation-specific value is multiplied with to create a constant depth offset. */
70
+ depthBias: number;
71
+ /** The scale factor for the variable depth offset for each polygon. */
72
+ slopeScaledDepthBias: number;
73
+ };
74
+ /** Render queue type. */
75
+ renderQueueType: RenderQueueType;
76
+ }
77
+ export interface IMaterialSchema {
78
+ name: string;
79
+ shader: string;
80
+ shaderData: {
81
+ [key: string]: {
82
+ type: "Vector2" | "Vector3" | "Vector4" | "Color" | "Float" | "Texture";
83
+ value: IVector3 | IVector2 | IColor | number | IAssetRef;
84
+ };
85
+ };
86
+ macros: Array<{
87
+ name: string;
88
+ value?: string;
89
+ }>;
90
+ renderState: IRenderState;
91
+ }
@@ -0,0 +1,41 @@
1
+ import { BackgroundMode, DiffuseMode, ShadowCascadesMode, ShadowResolution } from "@galacean/engine-core";
2
+ import type { IReferable } from "@galacean/engine-core/types/asset/IReferable";
3
+ import type { IColor, IPrefabFile } from "./BasicSchema";
4
+ export declare enum SpecularMode {
5
+ Sky = "Sky",
6
+ Custom = "Custom"
7
+ }
8
+ export interface IScene extends IPrefabFile {
9
+ scene: {
10
+ background: {
11
+ mode: BackgroundMode;
12
+ color: IColor;
13
+ texture?: IReferable;
14
+ skyMesh?: IReferable;
15
+ skyMaterial?: IReferable;
16
+ };
17
+ ambient: {
18
+ diffuseMode: DiffuseMode;
19
+ ambientLight: IReferable;
20
+ customAmbientLight: IReferable;
21
+ customSpecularTexture: IReferable;
22
+ diffuseSolidColor: IColor;
23
+ diffuseIntensity: number;
24
+ specularIntensity: number;
25
+ specularMode: SpecularMode;
26
+ bakerResolution: number;
27
+ };
28
+ shadow?: {
29
+ castShadows: boolean;
30
+ shadowResolution: ShadowResolution;
31
+ shadowDistance: number;
32
+ shadowCascades: ShadowCascadesMode;
33
+ };
34
+ };
35
+ files: Array<{
36
+ id: string;
37
+ type: string;
38
+ virtualPath: string;
39
+ path: string;
40
+ }>;
41
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./BasicSchema";
2
+ export * from "./MaterialSchema";
3
+ export * from "./SceneSchema";