@galacean/effects-plugin-model 2.0.0-alpha.10 → 2.0.0-alpha.12

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.
@@ -1,3 +1,4 @@
1
1
  export * from './loader-helper';
2
2
  export * from './loader-impl';
3
3
  export * from './protocol';
4
+ export * from './json-converter';
@@ -0,0 +1,36 @@
1
+ import { spec, Downloader } from '@galacean/effects';
2
+ import type { Engine, Player, Renderer, GeometryProps } from '@galacean/effects';
3
+ export declare class JSONConverter {
4
+ newScene: spec.JSONScene;
5
+ engine: Engine;
6
+ renderer: Renderer;
7
+ downloader: Downloader;
8
+ treeItemList: spec.VFXItemData[];
9
+ constructor(player: Player);
10
+ processScene(sceneData: string | Object): Promise<spec.JSONScene>;
11
+ setImage(newScene: spec.JSONScene, oldScene: spec.JSONScene): void;
12
+ setTexture(newScene: spec.JSONScene, oldScene: spec.JSONScene): Promise<void>;
13
+ setComponent(newScene: spec.JSONScene, oldScene: spec.JSONScene): void;
14
+ setItem(newScene: spec.JSONScene, oldScene: spec.JSONScene): void;
15
+ setComposition(newScene: spec.JSONScene, oldScene: spec.JSONScene): void;
16
+ private loadJSON;
17
+ private loadBins;
18
+ private loadMipmapImage;
19
+ private createSkyboxComponent;
20
+ private createMeshComponent;
21
+ private createItemsFromTreeComponent;
22
+ private createLightComponent;
23
+ private getMaterialData;
24
+ private getStringTags;
25
+ private getTextureData;
26
+ private getTransformData;
27
+ }
28
+ export interface ModelData {
29
+ vertices: spec.TypedArray;
30
+ uvs: spec.TypedArray;
31
+ normals: spec.TypedArray;
32
+ indices: spec.TypedArray;
33
+ name: string;
34
+ }
35
+ export declare function getGeometryDataFromOptions(geomOptions: GeometryProps): spec.GeometryData;
36
+ export declare function getGeometryDataFromPropsList(geomPropsList: GeometryProps[]): spec.GeometryData | undefined;
@@ -1,16 +1,8 @@
1
- import type { GLTFResources } from '@vvfx/resource-detection';
2
1
  import type { Player, spec } from '@galacean/effects';
3
2
  import type { LoadSceneOptions, LoadSceneECSResult } from './protocol';
4
3
  import { LoaderECSImpl } from './loader-ecs';
5
4
  export declare class LoaderECSEx extends LoaderECSImpl {
6
5
  loadScene(options: LoadSceneOptions): Promise<LoadSceneECSResult>;
7
- /**
8
- * 检查序列化和反序列逻辑,排查渲染场景中渲染正常和编辑器中渲染错误的问题。
9
- * 针对Image、Texture、Material、Mesh、Scene、Animation和IBL的检查。
10
- *
11
- * @param res 加载的GLTF场景资源
12
- */
13
- checkSerializer(res: GLTFResources): Promise<void>;
14
6
  }
15
7
  export interface LoadGLTFSceneECSOptions {
16
8
  url: string;
@@ -1,7 +1,7 @@
1
1
  import { spec } from '@galacean/effects';
2
- import type { Texture, Engine, EffectComponentData, TextureSourceOptions, MaterialData } from '@galacean/effects';
2
+ import type { Texture, Engine, EffectComponentData, TextureSourceOptions } from '@galacean/effects';
3
3
  import type { LoaderOptions, SkyboxType, LoadSceneOptions, LoadSceneECSResult, LoaderECS } from './protocol';
4
- import type { ModelMeshComponentData, ModelSkyboxComponentData, ModelAnimationOptions, ModelCameraOptions, ModelLightOptions, ModelSkyboxOptions, ModelTreeOptions, ModelLightComponentData, ModelCameraComponentData } from '../index';
4
+ import type { ModelMeshComponentData, ModelSkyboxComponentData, ModelAnimationOptions, ModelCameraOptions, ModelLightOptions, ModelTreeOptions, ModelLightComponentData, ModelCameraComponentData } from '../index';
5
5
  import type { GLTFImage, GLTFTexture, GLTFScene, GLTFLight, GLTFCamera, GLTFAnimation, GLTFResources } from '@vvfx/resource-detection';
6
6
  import { PSkyboxType } from '../runtime/skybox';
7
7
  export declare class LoaderECSImpl implements LoaderECS {
@@ -34,16 +34,21 @@ export declare class LoaderECSImpl implements LoaderECS {
34
34
  processCameraComponentData(camera: ModelCameraComponentData): void;
35
35
  processMeshComponentData(mesh: ModelMeshComponentData): void;
36
36
  processSkyboxComponentData(skybox: ModelSkyboxComponentData): void;
37
- processMaterialData(material: MaterialData): void;
37
+ processMaterialData(material: spec.MaterialData): void;
38
38
  processTextureOptions(options: TextureSourceOptions, isBaseColor: boolean): void;
39
- processMaterialTexture(material: MaterialData, textureName: string, isBaseColor: boolean, dataMap: Record<string, TextureSourceOptions>): void;
39
+ processMaterialTexture(material: spec.MaterialData, textureName: string, isBaseColor: boolean, dataMap: Record<string, TextureSourceOptions>): void;
40
40
  getLoadResult(): LoadSceneECSResult;
41
41
  addLight(data: ModelLight): void;
42
42
  addCamera(camera: ModelCamera): void;
43
+ addSkybox(skybox: ModelSkybox): Promise<void>;
43
44
  createTreeOptions(scene: GLTFScene): ModelTreeOptions;
44
45
  createAnimations(animations: GLTFAnimation[]): ModelAnimationOptions[];
45
46
  createTexture2D(image: GLTFImage, texture: GLTFTexture, isBaseColor: boolean): Promise<Texture>;
46
- createDefaultSkybox(typeName: SkyboxType): Promise<ModelSkyboxOptions>;
47
+ createSkyboxComponentData(typeName: SkyboxType): {
48
+ imageList: spec.Image[];
49
+ textureOptionsList: TextureSourceOptions[];
50
+ component: spec.SkyboxComponentData;
51
+ };
47
52
  scaleColorVal(val: number, fromGLTF: boolean): number;
48
53
  scaleColorVec(vec: number[], fromGLTF: boolean): number[];
49
54
  createLightOptions(light: GLTFLight): ModelLightOptions;
@@ -59,6 +64,7 @@ export declare class LoaderECSImpl implements LoaderECS {
59
64
  isPlayAnimation(): boolean;
60
65
  isPlayAllAnimation(): boolean;
61
66
  getRemarkString(): string;
67
+ getCompositionDuration(): number;
62
68
  isTiny3dMode(): boolean;
63
69
  getItemDuration(): number;
64
70
  getItemEndBehavior(): spec.ItemEndBehavior;
@@ -92,9 +98,16 @@ export interface ModelLight {
92
98
  duration: number;
93
99
  endBehavior: spec.ItemEndBehavior;
94
100
  }
101
+ export interface ModelSkybox {
102
+ skyboxType: string;
103
+ renderable?: boolean;
104
+ intensity?: number;
105
+ reflectionsIntensity?: number;
106
+ duration?: number;
107
+ }
95
108
  export declare function getDefaultEffectsGLTFLoaderECS(engine: Engine, options?: LoaderOptions): LoaderECS;
96
109
  export declare function setDefaultEffectsGLTFLoaderECS(loader: LoaderECS): void;
97
110
  export declare function getPBRShaderProperties(): string;
98
111
  export declare function getUnlitShaderProperties(): string;
99
- export declare function getDefaultPBRMaterialData(): MaterialData;
100
- export declare function getDefaultUnlitMaterialData(): MaterialData;
112
+ export declare function getDefaultPBRMaterialData(): spec.MaterialData;
113
+ export declare function getDefaultUnlitMaterialData(): spec.MaterialData;
@@ -1,6 +1,6 @@
1
1
  import type { GLTFMaterial, GLTFPrimitive, GLTFLight, GLTFScene, GLTFImage, GLTFTexture, GLTFCamera, GLTFAnimation, GLTFImageBasedLight, GLTFResources } from '@vvfx/resource-detection';
2
2
  import type { CubeImage } from '@vvfx/resource-detection/dist/src/gltf-tools/gltf-image-based-light';
3
- import type { spec, Renderer, Texture, Geometry, TextureSourceOptions, EffectComponentData, MaterialData } from '@galacean/effects';
3
+ import type { spec, Renderer, Texture, Geometry, TextureSourceOptions, EffectComponentData } from '@galacean/effects';
4
4
  import type { ModelAnimationOptions, ModelMaterialOptions, ModelSkyboxOptions, ModelTreeOptions, ModelBaseItem, ModelLightComponentData, ModelCameraComponentData, ModelMeshComponentData, ModelSkyboxComponentData } from '../index';
5
5
  /**
6
6
  * glTF 场景文件加载选项,主要用于 Demo 测试或外部测试调用
@@ -103,6 +103,6 @@ export interface LoaderECS {
103
103
  processCameraComponentData(camera: ModelCameraComponentData): void;
104
104
  processMeshComponentData(mesh: ModelMeshComponentData): void;
105
105
  processSkyboxComponentData(skybox: ModelSkyboxComponentData): void;
106
- processMaterialData(material: MaterialData): void;
106
+ processMaterialData(material: spec.MaterialData): void;
107
107
  processTextureOptions(options: TextureSourceOptions, isBaseColor: boolean): void;
108
108
  }