@galacean/effects-plugin-model 0.0.1-alpha.0 → 0.0.1-alpha.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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT LICENSE
2
+
3
+ Copyright (c) 2019-present Ant Group Co., Ltd. https://www.antgroup.com/
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -43,11 +43,7 @@ export declare function loadGLTFScene(options: LoadGLTFSceneOptions): Promise<{
43
43
  }[];
44
44
  gltf: never[];
45
45
  images: never[];
46
- version: string;
47
46
  shapes: never[];
48
47
  plugins: string[];
49
- type: string;
50
- _imgs: {
51
- '1': never[];
52
- };
48
+ version: string;
53
49
  }>;
@@ -3,12 +3,12 @@ import type { BaseTransform as Transform } from '../index';
3
3
  import { Vector3, Matrix4, Quaternion, Euler } from '../math';
4
4
  export declare class LoaderHelper {
5
5
  static getTransformFromMat4(mat: Matrix4): Transform;
6
- static getMarsTransformFromMat4(mat: Matrix4): Transform;
6
+ static getEffectsTransformFromMat4(mat: Matrix4): Transform;
7
7
  static getTransformFromTranslation(t: Vector3): Transform;
8
8
  static getTransformFromDirection(d: Vector3): Transform;
9
- static getMarsTransformFromDirection(d: Vector3): Transform;
9
+ static getEffectsTransformFromDirection(d: Vector3): Transform;
10
10
  static getTransformFromTransDir(t: Vector3, d: Vector3): Transform;
11
- static getMarsTransformFromTransDir(t: Vector3, d: Vector3): Transform;
11
+ static getEffectsTransformFromTransDir(t: Vector3, d: Vector3): Transform;
12
12
  static getEulerFromQuat(q: Quaternion): [number, number, number];
13
13
  static getQuatFromEuler(e: Euler): [number, number, number, number];
14
14
  static toPlayerColor3(color: spec.vec3): spec.vec3;
@@ -1,12 +1,12 @@
1
1
  import type { Texture, Engine } from '@galacean/effects';
2
2
  import { spec, Geometry } from '@galacean/effects';
3
3
  import type { Loader, LoaderOptions, SkyboxType, LoadSceneOptions, LoadSceneResult } from './protocol';
4
- import type { MarsAnimationOptions, MarsCameraOptions, MarsMaterialOptions, MarsLightOptions, MarsSkyboxOptions, MarsTreeOptions } from '../index';
4
+ import type { ModelAnimationOptions, ModelCameraOptions, ModelMaterialOptions, ModelLightOptions, ModelSkyboxOptions, ModelTreeOptions } from '../index';
5
5
  import type { GLTFImage, GLTFMaterial, GLTFTexture, GLTFScene, GLTFPrimitive, GLTFTextureInfo, GLTFLight, GLTFCamera, GLTFAnimation, GLTFImageBasedLight } from '@vvfx/resource-detection';
6
6
  import { PSkyboxType } from '../runtime/skybox';
7
7
  import type { CubeImage } from '@vvfx/resource-detection/dist/src/gltf-tools/gltf-image-based-light';
8
- export declare function getDefaultMarsGLTFLoader(engine: Engine, options?: LoaderOptions): Loader;
9
- export declare function setDefaultMarsGLTFLoader(loader: Loader): void;
8
+ export declare function getDefaultEffectsGLTFLoader(engine: Engine, options?: LoaderOptions): Loader;
9
+ export declare function setDefaultEffectsGLTFLoader(loader: Loader): void;
10
10
  export declare class LoaderImpl implements Loader {
11
11
  private _sceneOptions;
12
12
  private _loaderOptions;
@@ -24,19 +24,19 @@ export declare class LoaderImpl implements Loader {
24
24
  private _skyboxOptions?;
25
25
  engine: Engine;
26
26
  initial(engine: Engine, options?: LoaderOptions): void;
27
- processLight(lights: GLTFLight[], fromGLTFToMars: boolean): void;
28
- processCamera(cameras: GLTFCamera[], fromGLTFToMars: boolean): void;
29
- processMaterial(materials: GLTFMaterial[], fromGLTFToMars: boolean): void;
30
- createTreeOptions(scene: GLTFScene): MarsTreeOptions;
31
- createAnimations(animations: GLTFAnimation[]): MarsAnimationOptions[];
27
+ processLight(lights: GLTFLight[], fromGLTF: boolean): void;
28
+ processCamera(cameras: GLTFCamera[], fromGLTF: boolean): void;
29
+ processMaterial(materials: GLTFMaterial[], fromGLTF: boolean): void;
30
+ createTreeOptions(scene: GLTFScene): ModelTreeOptions;
31
+ createAnimations(animations: GLTFAnimation[]): ModelAnimationOptions[];
32
32
  createGeometry(primitive: GLTFPrimitive, hasSkinAnim: boolean): Geometry;
33
- createMaterial(material: GLTFMaterial): MarsMaterialOptions;
33
+ createMaterial(material: GLTFMaterial): ModelMaterialOptions;
34
34
  createTexture2D(image: GLTFImage, texture: GLTFTexture, isBaseColor: boolean): Promise<Texture>;
35
35
  createTextureCube(cubeImages: CubeImage[], level0Size?: number): Promise<Texture>;
36
- createSkybox(ibl: GLTFImageBasedLight): Promise<MarsSkyboxOptions>;
37
- createDefaultSkybox(typeName: SkyboxType): Promise<MarsSkyboxOptions>;
38
- scaleColorVal(val: number, fromGLTFToMars: boolean): number;
39
- scaleColorVec(vec: number[], fromGLTFToMars: boolean): number[];
36
+ createSkybox(ibl: GLTFImageBasedLight): Promise<ModelSkyboxOptions>;
37
+ createDefaultSkybox(typeName: SkyboxType): Promise<ModelSkyboxOptions>;
38
+ scaleColorVal(val: number, fromGLTF: boolean): number;
39
+ scaleColorVec(vec: number[], fromGLTF: boolean): number[];
40
40
  loadScene(options: LoadSceneOptions): Promise<LoadSceneResult>;
41
41
  private _preprocess;
42
42
  tryAddTexture2D(matIndex: number, texInfo: GLTFTextureInfo | undefined, isBaseColor: boolean): Promise<void> | undefined;
@@ -48,8 +48,8 @@ export declare class LoaderImpl implements Loader {
48
48
  private _createItemCamera;
49
49
  private _createItemSkybox;
50
50
  private _computeSceneAABB;
51
- createLightOptions(light: GLTFLight): MarsLightOptions;
52
- createCameraOptions(camera: GLTFCamera): MarsCameraOptions | undefined;
51
+ createLightOptions(light: GLTFLight): ModelLightOptions;
52
+ createCameraOptions(camera: GLTFCamera): ModelCameraOptions | undefined;
53
53
  private _clear;
54
54
  /**
55
55
  * 按照传入的动画播放参数,计算需要播放的动画索引
@@ -57,7 +57,7 @@ export declare class LoaderImpl implements Loader {
57
57
  * @param treeOptions 节点树属性,需要初始化animations列表。
58
58
  * @returns 返回计算的动画索引,-1表示没有动画需要播放,-88888888表示播放所有动画。
59
59
  */
60
- getPlayAnimationIndex(treeOptions: MarsTreeOptions): number;
60
+ getPlayAnimationIndex(treeOptions: ModelTreeOptions): number;
61
61
  isPlayAnimation(): boolean;
62
62
  isPlayAllAnimation(): boolean;
63
63
  getRemarkString(): string;
@@ -2,7 +2,7 @@ import type { GLTFMaterial, GLTFPrimitive, GLTFLight, GLTFScene, GLTFImage, GLTF
2
2
  import type { CubeImage } from '@vvfx/resource-detection/dist/src/gltf-tools/gltf-image-based-light';
3
3
  import type { GLTFResources } from '@vvfx/resource-detection/dist/src/gltf-tools';
4
4
  import type { spec, Renderer, Texture, Geometry } from '@galacean/effects';
5
- import type { MarsAnimationOptions, MarsMaterialOptions, MarsSkyboxOptions, MarsTreeOptions, MarsItemModelBase } from '../index';
5
+ import type { ModelAnimationOptions, ModelMaterialOptions, ModelSkyboxOptions, ModelTreeOptions, ModelBaseItem } from '../index';
6
6
  /**
7
7
  * glTF 场景文件加载选项,主要用于 Demo 测试或外部测试调用
8
8
  */
@@ -37,9 +37,9 @@ export interface LoadSceneOptions {
37
37
  */
38
38
  ignoreSkybox?: boolean;
39
39
  };
40
- mars: {
40
+ effects: {
41
41
  /**
42
- * Mars Renderer
42
+ * Renderer
43
43
  */
44
44
  renderer?: Renderer;
45
45
  /**
@@ -62,7 +62,7 @@ export interface LoadSceneOptions {
62
62
  }
63
63
  export interface LoadSceneResult {
64
64
  source: string;
65
- items: MarsItemModelBase[];
65
+ items: ModelBaseItem[];
66
66
  sceneAABB: {
67
67
  min: spec.vec3;
68
68
  max: spec.vec3;
@@ -74,17 +74,17 @@ export interface LoaderOptions {
74
74
  export type SkyboxType = 'NFT' | 'FARM';
75
75
  export interface Loader {
76
76
  loadScene(options: LoadSceneOptions): Promise<LoadSceneResult>;
77
- processLight(lights: GLTFLight[], fromGLTFToMars: boolean): void;
78
- processCamera(cameras: GLTFCamera[], fromGLTFToMars: boolean): void;
79
- processMaterial(materials: GLTFMaterial[], fromGLTFToMars: boolean): void;
80
- createTreeOptions(scene: GLTFScene): MarsTreeOptions;
81
- createAnimations(animations: GLTFAnimation[]): MarsAnimationOptions[];
77
+ processLight(lights: GLTFLight[], fromGLTF: boolean): void;
78
+ processCamera(cameras: GLTFCamera[], fromGLTF: boolean): void;
79
+ processMaterial(materials: GLTFMaterial[], fromGLTF: boolean): void;
80
+ createTreeOptions(scene: GLTFScene): ModelTreeOptions;
81
+ createAnimations(animations: GLTFAnimation[]): ModelAnimationOptions[];
82
82
  createGeometry(primitive: GLTFPrimitive, hasSkinAnim: boolean): Geometry;
83
- createMaterial(material: GLTFMaterial): MarsMaterialOptions;
83
+ createMaterial(material: GLTFMaterial): ModelMaterialOptions;
84
84
  createTexture2D(images: GLTFImage, textures: GLTFTexture, isBaseColor: boolean): Promise<Texture>;
85
85
  createTextureCube(cubeImages: CubeImage[], level0Size?: number): Promise<Texture>;
86
- createSkybox(ibl: GLTFImageBasedLight): Promise<MarsSkyboxOptions>;
87
- createDefaultSkybox(typeName: SkyboxType): Promise<MarsSkyboxOptions>;
88
- scaleColorVal(val: number, fromGLTFToMars: boolean): number;
89
- scaleColorVec(vec: number[], fromGLTFToMars: boolean): number[];
86
+ createSkybox(ibl: GLTFImageBasedLight): Promise<ModelSkyboxOptions>;
87
+ createDefaultSkybox(typeName: SkyboxType): Promise<ModelSkyboxOptions>;
88
+ scaleColorVal(val: number, fromGLTF: boolean): number;
89
+ scaleColorVec(vec: number[], fromGLTF: boolean): number[];
90
90
  }
package/dist/index.d.ts CHANGED
@@ -1,35 +1,35 @@
1
1
  import type { spec } from '@galacean/effects';
2
2
  export declare const version: string;
3
3
  export type BaseTransform = spec.BaseItemTransform;
4
- export type MarsItemModelBase = spec.BaseItem;
5
- export type MarsItemCamera = spec.ModelCameraItem;
6
- export type MarsItemLight = spec.ModelLightItem;
7
- export type MarsTextureTransform = spec.ModelTextureTransform;
8
- export type MarsItemBoundingBox = spec.ModelItemBoundingBox;
9
- export type MarsItemBoundingSphere = spec.ModelItemBoundingSphere;
10
- export type MarsItemBounding = spec.ModelItemBounding;
11
- export type MarsCameraOptions = spec.ModelCameraOptions;
12
- export type MarsLightBaseOptions = spec.ModelLightBaseOptions;
13
- export type MarsLightPointOptions = spec.ModelLightPointOptions;
14
- export type MarsLightSpotOptions = spec.ModelLightSpotOptions;
15
- export type MarsLightDirOptions = spec.ModelLightDirOptions;
16
- export type MarsAmbientOptions = spec.ModelAmbientLightOptions;
17
- export type MarsLightOptions = spec.ModelLightOptions;
18
- export type MarsItemMesh = spec.ModelMeshItem<'studio'>;
19
- export type MarsItemSkybox = spec.ModelSkyboxItem<'studio'>;
20
- export type MarsItemTree = spec.ModelTreeItem<'studio'>;
21
- export type MarsMeshOptions = spec.ModelMeshOptions<'studio'>;
22
- export type MarsSkinOptions = spec.SkinOptions<'studio'>;
23
- export type MarsPrimitiveOptions = spec.PrimitiveOptions<'studio'>;
24
- export type MarsMaterialUnlitOptions = spec.MaterialUnlitOptions<'studio'>;
25
- export type MarsMaterialPBROptions = spec.MaterialPBROptions<'studio'>;
26
- export type MarsMaterialHariOptions = spec.MaterialHairOptions<'studio'>;
27
- export type MarsMaterialOptions = spec.MaterialOptions<'studio'>;
28
- export type MarsSkyboxOptions = spec.SkyboxOptions<'studio'>;
29
- export type MarsTreeOptions = spec.ModelTreeOptions<'studio'>;
30
- export type MarsTreeContent = spec.ModelTreeContent<'studio'>;
31
- export type MarsAnimTrackOptions = spec.ModelAnimTrackOptions<'studio'>;
32
- export type MarsAnimationOptions = spec.ModelAnimationOptions<'studio'>;
4
+ export type ModelBaseItem = spec.BaseItem;
5
+ export type ModelItemCamera = spec.ModelCameraItem;
6
+ export type ModelItemLight = spec.ModelLightItem;
7
+ export type ModelTextureTransform = spec.ModelTextureTransform;
8
+ export type ModelItemBoundingBox = spec.ModelItemBoundingBox;
9
+ export type ModelItemBoundingSphere = spec.ModelItemBoundingSphere;
10
+ export type ModelItemBounding = spec.ModelItemBounding;
11
+ export type ModelCameraOptions = spec.ModelCameraOptions;
12
+ export type ModelLightBaseOptions = spec.ModelLightBaseOptions;
13
+ export type ModelLightPointOptions = spec.ModelLightPointOptions;
14
+ export type ModelLightSpotOptions = spec.ModelLightSpotOptions;
15
+ export type ModelLightDirOptions = spec.ModelLightDirOptions;
16
+ export type ModelAmbientLightOptions = spec.ModelAmbientLightOptions;
17
+ export type ModelLightOptions = spec.ModelLightOptions;
18
+ export type ModelItemMesh = spec.ModelMeshItem<'studio'>;
19
+ export type ModelItemSkybox = spec.ModelSkyboxItem<'studio'>;
20
+ export type ModelItemTree = spec.ModelTreeItem<'studio'>;
21
+ export type ModelMeshOptions = spec.ModelMeshOptions<'studio'>;
22
+ export type ModelSkinOptions = spec.SkinOptions<'studio'>;
23
+ export type ModelPrimitiveOptions = spec.PrimitiveOptions<'studio'>;
24
+ export type ModelMaterialUnlitOptions = spec.MaterialUnlitOptions<'studio'>;
25
+ export type ModelMaterialPBROptions = spec.MaterialPBROptions<'studio'>;
26
+ export type ModelMaterialHariOptions = spec.MaterialHairOptions<'studio'>;
27
+ export type ModelMaterialOptions = spec.MaterialOptions<'studio'>;
28
+ export type ModelSkyboxOptions = spec.SkyboxOptions<'studio'>;
29
+ export type ModelTreeOptions = spec.ModelTreeOptions<'studio'>;
30
+ export type ModelTreeContent = spec.ModelTreeContent<'studio'>;
31
+ export type ModelAnimTrackOptions = spec.ModelAnimTrackOptions<'studio'>;
32
+ export type ModelAnimationOptions = spec.ModelAnimationOptions<'studio'>;
33
33
  export * from './gesture';
34
34
  export * from './gltf';
35
35
  export * from './math';