@galacean/effects-plugin-model 0.0.1-alpha.0

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 (64) hide show
  1. package/README.md +26 -0
  2. package/dist/gesture/controller.d.ts +95 -0
  3. package/dist/gesture/index.d.ts +38 -0
  4. package/dist/gesture/protocol.d.ts +143 -0
  5. package/dist/gltf/index.d.ts +3 -0
  6. package/dist/gltf/loader-ext.d.ts +53 -0
  7. package/dist/gltf/loader-helper.d.ts +18 -0
  8. package/dist/gltf/loader-impl.d.ts +84 -0
  9. package/dist/gltf/protocol.d.ts +90 -0
  10. package/dist/helper/index.d.ts +2 -0
  11. package/dist/index.d.ts +38 -0
  12. package/dist/index.js +16137 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/index.min.js +9 -0
  15. package/dist/index.min.js.map +1 -0
  16. package/dist/index.mjs +16048 -0
  17. package/dist/index.mjs.map +1 -0
  18. package/dist/loader.d.ts +2 -0
  19. package/dist/loader.mjs +12040 -0
  20. package/dist/loader.mjs.map +1 -0
  21. package/dist/math/box3.d.ts +140 -0
  22. package/dist/math/euler.d.ts +139 -0
  23. package/dist/math/index.d.ts +11 -0
  24. package/dist/math/matrix2.d.ts +58 -0
  25. package/dist/math/matrix3.d.ts +113 -0
  26. package/dist/math/matrix4.d.ts +264 -0
  27. package/dist/math/quaternion.d.ts +214 -0
  28. package/dist/math/sphere.d.ts +81 -0
  29. package/dist/math/type.d.ts +29 -0
  30. package/dist/math/utilities/index.d.ts +9 -0
  31. package/dist/math/vector2.d.ts +394 -0
  32. package/dist/math/vector3.d.ts +164 -0
  33. package/dist/math/vector4.d.ts +132 -0
  34. package/dist/plugin/const.d.ts +2 -0
  35. package/dist/plugin/index.d.ts +6 -0
  36. package/dist/plugin/model-plugin.d.ts +48 -0
  37. package/dist/plugin/model-tree-item.d.ts +30 -0
  38. package/dist/plugin/model-tree-plugin.d.ts +13 -0
  39. package/dist/plugin/model-tree-vfx-item.d.ts +15 -0
  40. package/dist/plugin/model-vfx-item.d.ts +25 -0
  41. package/dist/runtime/anim-sampler.d.ts +13 -0
  42. package/dist/runtime/animation.d.ts +189 -0
  43. package/dist/runtime/cache.d.ts +34 -0
  44. package/dist/runtime/camera.d.ts +43 -0
  45. package/dist/runtime/common.d.ts +113 -0
  46. package/dist/runtime/index.d.ts +12 -0
  47. package/dist/runtime/light.d.ts +34 -0
  48. package/dist/runtime/material.d.ts +101 -0
  49. package/dist/runtime/mesh.d.ts +145 -0
  50. package/dist/runtime/object.d.ts +44 -0
  51. package/dist/runtime/scene.d.ts +131 -0
  52. package/dist/runtime/shader-libs/standard-shader-source.d.ts +3 -0
  53. package/dist/runtime/shader-libs/standard-shader.d.ts +6 -0
  54. package/dist/runtime/shader.d.ts +18 -0
  55. package/dist/runtime/shadow.d.ts +227 -0
  56. package/dist/runtime/skybox.d.ts +91 -0
  57. package/dist/utility/debug-helper.d.ts +7 -0
  58. package/dist/utility/hit-test-helper.d.ts +9 -0
  59. package/dist/utility/index.d.ts +6 -0
  60. package/dist/utility/plugin-helper.d.ts +197 -0
  61. package/dist/utility/ri-helper.d.ts +25 -0
  62. package/dist/utility/shader-helper.d.ts +13 -0
  63. package/dist/utility/ts-helper.d.ts +34 -0
  64. package/package.json +56 -0
package/README.md ADDED
@@ -0,0 +1,26 @@
1
+ # Galacean Effects Model Plugin
2
+
3
+ ## 本地开发
4
+
5
+ ### 开始开发
6
+
7
+ ``` bash
8
+ # demo & test
9
+ pnpm --filter @galacean/effects-plugin-model dev
10
+ # demo & test (legacy)
11
+ pnpm --filter @galacean/effects-plugin-model preview
12
+ ```
13
+
14
+ > 浏览器打开:http://localhost:8081/demo/index.html
15
+
16
+ ##### WebGL1 环境
17
+
18
+ > 浏览器打开:http://localhost:8081/demo/index.html?webgl=1
19
+
20
+ ### 单测
21
+
22
+ ``` bash
23
+ # 同上
24
+ ```
25
+
26
+ > 浏览器打开:http://localhost:8081/test/index.html
@@ -0,0 +1,95 @@
1
+ /**
2
+ * 鼠标和键盘控制的封装,主要用于Demo测试。
3
+ * 不可以打包导出,因为有移动端触控的第三方依赖
4
+ */
5
+ import type { Composition } from '@galacean/effects';
6
+ import type { CameraGestureHandler } from './protocol';
7
+ import 'hammerjs';
8
+ export declare enum MouseButtonType {
9
+ left = 1,
10
+ middle = 4,
11
+ right = 2
12
+ }
13
+ export declare enum InputActionType {
14
+ none = 0,
15
+ moveXYPlane = 1,
16
+ moveZAxis = 2,
17
+ rotateCamera = 3,
18
+ rotatePoint = 4
19
+ }
20
+ export interface InputControllerOptions {
21
+ cameraID: string;
22
+ sceneRadius: number;
23
+ moveSpeed?: number;
24
+ rotateSpeed?: number;
25
+ comp: Composition;
26
+ canvas: HTMLCanvasElement;
27
+ }
28
+ /**
29
+ * 鼠标和键盘输入控制器
30
+ */
31
+ export declare class InputController {
32
+ cameraID: string;
33
+ sceneRadius: number;
34
+ moveSpeed: number;
35
+ rotateSpeed: number;
36
+ comp?: Composition;
37
+ canvas?: HTMLCanvasElement;
38
+ gesture?: CameraGestureHandler;
39
+ hammer?: HammerManager;
40
+ keyDownListener?: (e: KeyboardEvent) => any;
41
+ mouseUpListener?: (e: MouseEvent) => any;
42
+ mouseDownListener?: (e: MouseEvent) => any;
43
+ mouseMoveListener?: (e: MouseEvent) => any;
44
+ mouseLeaveListener?: (e: MouseEvent) => any;
45
+ mouseWheelListener?: (e: WheelEvent) => any;
46
+ isMouseDown: boolean;
47
+ isMoveBegin: boolean;
48
+ currentAction: InputActionType;
49
+ /**
50
+ * 相机控制事件的回调,包括开始、持续和结束三种事件
51
+ */
52
+ private beginEventCallback?;
53
+ private moveEventCallback?;
54
+ private endEventCallback?;
55
+ initial(options: InputControllerOptions): void;
56
+ setBeginEventCallback(cb: (eventName: string) => any): void;
57
+ setMoveEventCallback(cb: (eventName: string) => any): void;
58
+ setEndEventCallback(cb: (eventName: string) => any): void;
59
+ /**
60
+ * 注册鼠标回调事件,只有在PC上才会注册,手机上不会注册
61
+ *
62
+ * @param owner 输入控制器对象
63
+ */
64
+ private registerMouseEvent;
65
+ private registerKeyboardEvent;
66
+ /**
67
+ * 注册触控回调事件,只在手机上才会注册,PC上不会注册
68
+ *
69
+ * @param owner 输入控制器对象
70
+ */
71
+ private registerTouchEvent;
72
+ /**
73
+ * 相机开始事件的回调
74
+ *
75
+ * @param eventName 事件名称
76
+ */
77
+ private launchBeginEventCallback;
78
+ /**
79
+ * 相机持续事件的回调
80
+ *
81
+ * @param eventName 事件名称
82
+ */
83
+ private launchMoveEventCallback;
84
+ /**
85
+ * 相机结束事件的回调
86
+ *
87
+ * @param eventName 事件名称
88
+ */
89
+ private launchEndEventCallback;
90
+ dispose(): void;
91
+ getMouseMoveSpeed(): number;
92
+ getKeyMoveSpeed(): number;
93
+ getRotateSpeed(): number;
94
+ getWheelMoveSpeed(): number;
95
+ }
@@ -0,0 +1,38 @@
1
+ import type { Composition, CameraOptions, spec } from '@galacean/effects';
2
+ import { Transform } from '@galacean/effects';
3
+ import type { CameraGestureHandler, CameraKeyEvent } from './protocol';
4
+ import { CameraGestureType } from './protocol';
5
+ import type { ModelVFXItem } from '../plugin/model-vfx-item';
6
+ export declare class CameraGestureHandlerImp implements CameraGestureHandler {
7
+ private composition;
8
+ private cameraTransform;
9
+ private cameraCoordiante;
10
+ private startParams;
11
+ constructor(composition: Composition);
12
+ getItem(): ModelVFXItem | undefined;
13
+ getCurrentTarget(): string;
14
+ getCurrentType(): CameraGestureType;
15
+ onKeyEvent(event: CameraKeyEvent): CameraOptions;
16
+ onXYMoveBegin(x: number, y: number, width: number, height: number, cameraID: string): CameraOptions;
17
+ onXYMoving(x: number, y: number, speed?: number): CameraOptions;
18
+ onXYMoveEnd(): void;
19
+ onZMoveBegin(x: number, y: number, width: number, height: number, cameraID: string): CameraOptions;
20
+ onZMoving(x: number, y: number, speed: number): CameraOptions;
21
+ onZMoveEnd(): void;
22
+ onRotateBegin(x: number, y: number, width: number, height: number, cameraID: string): CameraOptions;
23
+ onRotating(x: number, y: number, speed?: number): CameraOptions;
24
+ onRotateEnd(): void;
25
+ onRotatePointBegin(x: number, y: number, width: number, height: number, point: spec.vec3, cameraID: string): CameraOptions;
26
+ onRotatingPoint(x: number, y: number, speed?: number): CameraOptions;
27
+ onRotatePointEnd(): void;
28
+ moveTo(cameraID: string, position: spec.vec3): void;
29
+ rotateTo(cameraID: string, quat: spec.vec4): void;
30
+ onFocusPoint(cameraID: string, point: spec.vec3, distance?: number): void;
31
+ getCameraTransform(): Transform;
32
+ private initKeyEvent;
33
+ private startGesture;
34
+ private moveGesture;
35
+ private endGesture;
36
+ private updateCameraTransform;
37
+ }
38
+ export * from './protocol';
@@ -0,0 +1,143 @@
1
+ import type { CameraOptions, spec } from '@galacean/effects';
2
+ export interface CameraGestureHandler {
3
+ getCurrentTarget(): string;
4
+ getCurrentType(): CameraGestureType;
5
+ /**
6
+ * 通过按键事件对相机进行平移
7
+ * @param event - 键盘事件信息
8
+ * @returns 当前的相机参数
9
+ */
10
+ onKeyEvent(event: CameraKeyEvent): CameraOptions;
11
+ /**
12
+ * 在 XY 方向上平移相机开始函数,在鼠标按下时调用
13
+ * @param x - 鼠标在 x 坐标上的值
14
+ * @param y - 鼠标在 y 坐标上的值
15
+ * @param width - 当前画布的宽度
16
+ * @param height - 当前画布的高度
17
+ * @param cameraID - 要控制的相机 item id
18
+ * @returns 当前的相机参数
19
+ */
20
+ onXYMoveBegin(x: number, y: number, width: number, height: number, cameraID: string): CameraOptions;
21
+ /**
22
+ * 在 XY 方向上平移相机开始函数,在鼠标按下拖拽时调用
23
+ * @param x - 鼠标在 x 坐标上的值
24
+ * @param y - 鼠标在 y 坐标上的值
25
+ * @param speed - 移动速度,默认是 0.015
26
+ * @returns 更新后的相机参数
27
+ */
28
+ onXYMoving(x: number, y: number, speed?: number): CameraOptions;
29
+ /**
30
+ * 结束在 XY 方向上平移相机
31
+ */
32
+ onXYMoveEnd(): void;
33
+ /**
34
+ * 在 Z 方向上平移相机开始函数,类似缩放 3D 模型,在鼠标按下时调用
35
+ * @param x - 鼠标在 x 坐标上的值
36
+ * @param y - 鼠标在 y 坐标上的值
37
+ * @param width - 当前画布的宽度
38
+ * @param height - 当前画布的高度
39
+ * @param cameraID - 要控制的相机 item id
40
+ * @returns 当前的相机参数
41
+ */
42
+ onZMoveBegin(x: number, y: number, width: number, height: number, cameraID: string): CameraOptions;
43
+ /**
44
+ * 在 Z 方向上平移相机开始函数,类似缩放 3D 模型,在鼠标按下拖拽时调用
45
+ * @param x - 鼠标在 x 坐标上的值
46
+ * @param y - 鼠标在 y 坐标上的值
47
+ * @param speed - 移动速度,默认是 0.015
48
+ * @returns 更新后的相机参数
49
+ */
50
+ onZMoving(x: number, y: number, speed?: number): CameraOptions;
51
+ /**
52
+ * 结束在 Z 方向上平移相机
53
+ */
54
+ onZMoveEnd(): void;
55
+ /**
56
+ * 相机的自旋转,就是镜头漫游的效果,在鼠标按下时调用
57
+ * @param x - 鼠标在 x 坐标上的值
58
+ * @param y - 鼠标在 y 坐标上的值
59
+ * @param width - 当前画布的宽度
60
+ * @param height - 当前画布的高度
61
+ * @param cameraID - 要控制的相机 item id
62
+ * @returns 当前的相机参数
63
+ */
64
+ onRotateBegin(x: number, y: number, width: number, height: number, cameraID: string): CameraOptions;
65
+ /**
66
+ * 相机的自旋转,在鼠标按下拖拽时调用
67
+ * @param x - 鼠标在 x坐标上的值
68
+ * @param y - 鼠标在y坐标上的值
69
+ * @param speed - 移动速度,默认是 1
70
+ * @returns 更新后的相机参数
71
+ */
72
+ onRotating(x: number, y: number, speed?: number): CameraOptions;
73
+ /**
74
+ * 相机的自旋转
75
+ */
76
+ onRotateEnd(): void;
77
+ /**
78
+ * 相机绕某个点旋转,就是拖拽模型的效果,在鼠标按下时调用
79
+ * @param x - 鼠标在 x 坐标上的值
80
+ * @param y - 鼠标在 y 坐标上的值
81
+ * @param width - 当前画布的宽度
82
+ * @param height - 当前画布的高度
83
+ * @param cameraID - 要控制的相机 item id
84
+ * @returns 当前的相机参数
85
+ */
86
+ onRotatePointBegin(x: number, y: number, width: number, height: number, point: spec.vec3, cameraID: string): CameraOptions;
87
+ /**
88
+ * 相机绕某个点旋转,在鼠标按下拖拽时调用
89
+ * @param x - 鼠标在 x 坐标上的值
90
+ * @param y - 鼠标在 y 坐标上的值
91
+ * @param speed - 移动速度,默认是 1
92
+ * @returns 更新后的相机参数
93
+ */
94
+ onRotatingPoint(x: number, y: number, speed?: number): CameraOptions;
95
+ /**
96
+ * 相机绕某个点旋转
97
+ */
98
+ onRotatePointEnd(): void;
99
+ /**
100
+ * 相机移动到指定点
101
+ * @param cameraID -相机 ID
102
+ * @param position - 指定位置
103
+ */
104
+ moveTo(cameraID: string, position: spec.vec3): void;
105
+ /**
106
+ * 相机旋转到指定方向
107
+ * @param cameraID - 相机ID
108
+ * @param quat - 指定旋转
109
+ */
110
+ rotateTo(cameraID: string, quat: spec.vec4): void;
111
+ /**
112
+ * 相机对中心点进行聚焦,先从当前位置 LookAt 过去,然后移到距离中心点给定距离(默认是 5)的位置
113
+ * @param cameraID - 相机 ID
114
+ * @param point - 聚焦的中心点
115
+ * @param distance - 聚焦的距离,默认是 5
116
+ */
117
+ onFocusPoint(cameraID: string, point: spec.vec3, distance?: number): void;
118
+ }
119
+ export declare enum CameraGestureType {
120
+ none = 0,
121
+ translate = 1,
122
+ rotate_focus = 2,
123
+ rotate_self = 3,
124
+ scale = 4
125
+ }
126
+ export interface CameraGestureHandlerParams {
127
+ type: CameraGestureType;
128
+ mouseEvent: boolean;
129
+ clientX: number;
130
+ clientY: number;
131
+ clientWidth: number;
132
+ clientHeight: number;
133
+ target: string;
134
+ focusPoint?: spec.vec3;
135
+ speed?: number;
136
+ }
137
+ export interface CameraKeyEvent {
138
+ cameraID: string;
139
+ xAxis?: -1 | 1;
140
+ yAxis?: -1 | 1;
141
+ zAxis?: -1 | 1;
142
+ speed?: number;
143
+ }
@@ -0,0 +1,3 @@
1
+ export * from './loader-helper';
2
+ export * from './loader-impl';
3
+ export * from './protocol';
@@ -0,0 +1,53 @@
1
+ import type { GLTFResources } from '@vvfx/resource-detection';
2
+ import type { Player, spec } from '@galacean/effects';
3
+ import type { LoadSceneOptions, LoadSceneResult } from './protocol';
4
+ import { LoaderImpl } from './loader-impl';
5
+ export declare class LoaderImplEx extends LoaderImpl {
6
+ loadScene(options: LoadSceneOptions): Promise<LoadSceneResult>;
7
+ /**
8
+ * 检查序列化和反序列逻辑,排查渲染场景中渲染正常和编辑器中渲染错误的问题。
9
+ * 针对Image、Texture、Material、Mesh、Scene、Animation和IBL的检查。
10
+ *
11
+ * @param res 加载的GLTF场景资源
12
+ */
13
+ checkSerializer(res: GLTFResources): Promise<void>;
14
+ }
15
+ export interface LoadGLTFSceneOptions {
16
+ url: string;
17
+ player: Player;
18
+ playAnimation?: number | string;
19
+ camera?: {
20
+ position?: spec.vec3;
21
+ rotation?: spec.vec3;
22
+ };
23
+ }
24
+ export declare function loadGLTFScene(options: LoadGLTFSceneOptions): Promise<{
25
+ compositionId: number;
26
+ requires: never[];
27
+ compositions: {
28
+ name: string;
29
+ id: number;
30
+ duration: number;
31
+ endBehavior: number;
32
+ camera: {
33
+ fov: number;
34
+ far: number;
35
+ near: number;
36
+ position: number[];
37
+ clipMode: number;
38
+ };
39
+ items: spec.BaseItem[];
40
+ meta: {
41
+ previewSize: number[];
42
+ };
43
+ }[];
44
+ gltf: never[];
45
+ images: never[];
46
+ version: string;
47
+ shapes: never[];
48
+ plugins: string[];
49
+ type: string;
50
+ _imgs: {
51
+ '1': never[];
52
+ };
53
+ }>;
@@ -0,0 +1,18 @@
1
+ import type { spec } from '@galacean/effects';
2
+ import type { BaseTransform as Transform } from '../index';
3
+ import { Vector3, Matrix4, Quaternion, Euler } from '../math';
4
+ export declare class LoaderHelper {
5
+ static getTransformFromMat4(mat: Matrix4): Transform;
6
+ static getMarsTransformFromMat4(mat: Matrix4): Transform;
7
+ static getTransformFromTranslation(t: Vector3): Transform;
8
+ static getTransformFromDirection(d: Vector3): Transform;
9
+ static getMarsTransformFromDirection(d: Vector3): Transform;
10
+ static getTransformFromTransDir(t: Vector3, d: Vector3): Transform;
11
+ static getMarsTransformFromTransDir(t: Vector3, d: Vector3): Transform;
12
+ static getEulerFromQuat(q: Quaternion): [number, number, number];
13
+ static getQuatFromEuler(e: Euler): [number, number, number, number];
14
+ static toPlayerColor3(color: spec.vec3): spec.vec3;
15
+ static toPlayerColor4(color: spec.vec4): spec.vec4;
16
+ static scaleTo255(val: number): number;
17
+ static scaleTo1(val: number): number;
18
+ }
@@ -0,0 +1,84 @@
1
+ import type { Texture, Engine } from '@galacean/effects';
2
+ import { spec, Geometry } from '@galacean/effects';
3
+ import type { Loader, LoaderOptions, SkyboxType, LoadSceneOptions, LoadSceneResult } from './protocol';
4
+ import type { MarsAnimationOptions, MarsCameraOptions, MarsMaterialOptions, MarsLightOptions, MarsSkyboxOptions, MarsTreeOptions } from '../index';
5
+ import type { GLTFImage, GLTFMaterial, GLTFTexture, GLTFScene, GLTFPrimitive, GLTFTextureInfo, GLTFLight, GLTFCamera, GLTFAnimation, GLTFImageBasedLight } from '@vvfx/resource-detection';
6
+ import { PSkyboxType } from '../runtime/skybox';
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;
10
+ export declare class LoaderImpl implements Loader {
11
+ private _sceneOptions;
12
+ private _loaderOptions;
13
+ private _gltfScene;
14
+ private _gltfSkins;
15
+ private _gltfMeshs;
16
+ private _gltfLights;
17
+ private _gltfCameras;
18
+ private _gltfImages;
19
+ private _gltfTextures;
20
+ private _gltfMaterials;
21
+ private _gltfAnimations;
22
+ private _gltfImageBasedLights;
23
+ private _textureManager?;
24
+ private _skyboxOptions?;
25
+ engine: Engine;
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[];
32
+ createGeometry(primitive: GLTFPrimitive, hasSkinAnim: boolean): Geometry;
33
+ createMaterial(material: GLTFMaterial): MarsMaterialOptions;
34
+ createTexture2D(image: GLTFImage, texture: GLTFTexture, isBaseColor: boolean): Promise<Texture>;
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[];
40
+ loadScene(options: LoadSceneOptions): Promise<LoadSceneResult>;
41
+ private _preprocess;
42
+ tryAddTexture2D(matIndex: number, texInfo: GLTFTextureInfo | undefined, isBaseColor: boolean): Promise<void> | undefined;
43
+ getTexture2D(matIndex: number, texInfo: GLTFTextureInfo | undefined, isBaseColor: boolean, noWarning?: boolean): Texture | undefined;
44
+ private _gltfData2PlayerData;
45
+ private _createItemTree;
46
+ private _createItemMesh;
47
+ private _createItemLight;
48
+ private _createItemCamera;
49
+ private _createItemSkybox;
50
+ private _computeSceneAABB;
51
+ createLightOptions(light: GLTFLight): MarsLightOptions;
52
+ createCameraOptions(camera: GLTFCamera): MarsCameraOptions | undefined;
53
+ private _clear;
54
+ /**
55
+ * 按照传入的动画播放参数,计算需要播放的动画索引
56
+ *
57
+ * @param treeOptions 节点树属性,需要初始化animations列表。
58
+ * @returns 返回计算的动画索引,-1表示没有动画需要播放,-88888888表示播放所有动画。
59
+ */
60
+ getPlayAnimationIndex(treeOptions: MarsTreeOptions): number;
61
+ isPlayAnimation(): boolean;
62
+ isPlayAllAnimation(): boolean;
63
+ getRemarkString(): string;
64
+ isTiny3dMode(): boolean;
65
+ getTextureManager(): TextureManager;
66
+ getItemDuration(): number;
67
+ getItemEndBehavior(): spec.ItemEndBehavior;
68
+ getSkyboxType(): PSkyboxType | undefined;
69
+ isSkyboxVis(): boolean;
70
+ ignoreSkybox(): boolean;
71
+ isEnvironmentTest(): boolean;
72
+ }
73
+ declare class TextureManager {
74
+ private _owner;
75
+ private _gltfImages;
76
+ private _gltfTextures;
77
+ private _textureMap;
78
+ constructor(owner: LoaderImpl);
79
+ initial(gltfImages: GLTFImage[], gltfTextures: GLTFTexture[]): void;
80
+ dispose(): void;
81
+ addTexture(matIndex: number, texIndex: number, tex: Texture, isBaseColor: boolean): void;
82
+ getTexture(matIndex: number, texIndex: number, isBaseColor: boolean): Texture | undefined;
83
+ }
84
+ export {};
@@ -0,0 +1,90 @@
1
+ import type { GLTFMaterial, GLTFPrimitive, GLTFLight, GLTFScene, GLTFImage, GLTFTexture, GLTFCamera, GLTFAnimation, GLTFImageBasedLight } from '@vvfx/resource-detection';
2
+ import type { CubeImage } from '@vvfx/resource-detection/dist/src/gltf-tools/gltf-image-based-light';
3
+ import type { GLTFResources } from '@vvfx/resource-detection/dist/src/gltf-tools';
4
+ import type { spec, Renderer, Texture, Geometry } from '@galacean/effects';
5
+ import type { MarsAnimationOptions, MarsMaterialOptions, MarsSkyboxOptions, MarsTreeOptions, MarsItemModelBase } from '../index';
6
+ /**
7
+ * glTF 场景文件加载选项,主要用于 Demo 测试或外部测试调用
8
+ */
9
+ export interface LoadSceneOptions {
10
+ gltf: {
11
+ /**
12
+ * 场景数据的备注,可能是url或者二进制数组
13
+ */
14
+ remark?: string | Uint8Array;
15
+ /**
16
+ * 场景资源,可能是url、二进制数组或者加载后的资源
17
+ */
18
+ resource: string | Uint8Array | GLTFResources;
19
+ /**
20
+ * 兼容模式,目前只支持tiny3d
21
+ */
22
+ compatibleMode?: 'gltf' | 'tiny3d' | 'oasis';
23
+ /**
24
+ * 检查ResourceDetection序列化和反序列逻辑
25
+ */
26
+ checkSerializer?: boolean;
27
+ /**
28
+ * 天空盒类型,目前只支持'NFT'和'FARM'
29
+ */
30
+ skyboxType?: string;
31
+ /**
32
+ * 是否显示背景天空盒
33
+ */
34
+ skyboxVis?: boolean;
35
+ /**
36
+ * 是否忽略自带天空盒
37
+ */
38
+ ignoreSkybox?: boolean;
39
+ };
40
+ mars: {
41
+ /**
42
+ * Mars Renderer
43
+ */
44
+ renderer?: Renderer;
45
+ /**
46
+ * 播放时间,单位秒
47
+ */
48
+ duration?: number;
49
+ /**
50
+ * 结束行为
51
+ */
52
+ endBehavior?: spec.ItemEndBehavior;
53
+ /**
54
+ * 播放动画索引或名称
55
+ */
56
+ playAnimation?: number | string;
57
+ /**
58
+ * 是否播放全部动画
59
+ */
60
+ playAllAnimation?: boolean;
61
+ };
62
+ }
63
+ export interface LoadSceneResult {
64
+ source: string;
65
+ items: MarsItemModelBase[];
66
+ sceneAABB: {
67
+ min: spec.vec3;
68
+ max: spec.vec3;
69
+ };
70
+ }
71
+ export interface LoaderOptions {
72
+ compatibleMode?: 'gltf' | 'tiny3d' | 'oasis';
73
+ }
74
+ export type SkyboxType = 'NFT' | 'FARM';
75
+ export interface Loader {
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[];
82
+ createGeometry(primitive: GLTFPrimitive, hasSkinAnim: boolean): Geometry;
83
+ createMaterial(material: GLTFMaterial): MarsMaterialOptions;
84
+ createTexture2D(images: GLTFImage, textures: GLTFTexture, isBaseColor: boolean): Promise<Texture>;
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[];
90
+ }
@@ -0,0 +1,2 @@
1
+ export * from '../gltf/loader-ext';
2
+ export * from '../gesture/controller';
@@ -0,0 +1,38 @@
1
+ import type { spec } from '@galacean/effects';
2
+ export declare const version: string;
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'>;
33
+ export * from './gesture';
34
+ export * from './gltf';
35
+ export * from './math';
36
+ export * from './plugin';
37
+ export * from './runtime';
38
+ export * from './utility';