sa2kit 1.2.0 → 1.2.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/dist/{UniversalFileService-CEZRJ87g.d.mts → UniversalFileService-C1rUWWU-.d.ts} +2 -258
- package/dist/{UniversalFileService-CEZRJ87g.d.ts → UniversalFileService-DrCK0-NL.d.mts} +2 -258
- package/dist/mmd/admin/index.d.mts +1594 -0
- package/dist/mmd/admin/index.d.ts +1594 -0
- package/dist/mmd/admin/index.js +1021 -0
- package/dist/mmd/admin/index.js.map +1 -0
- package/dist/mmd/admin/index.mjs +991 -0
- package/dist/mmd/admin/index.mjs.map +1 -0
- package/dist/mmd/index.d.mts +4 -193
- package/dist/mmd/index.d.ts +4 -193
- package/dist/types-C2ale3d9.d.mts +194 -0
- package/dist/types-C2ale3d9.d.ts +194 -0
- package/dist/types-Dg-U_chI.d.mts +258 -0
- package/dist/types-Dg-U_chI.d.ts +258 -0
- package/dist/universalFile/index.d.mts +3 -2
- package/dist/universalFile/index.d.ts +3 -2
- package/dist/universalFile/server/index.d.mts +3 -2
- package/dist/universalFile/server/index.d.ts +3 -2
- package/package.json +6 -1
package/dist/mmd/index.d.ts
CHANGED
|
@@ -1,196 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { M as MMDPlayerBaseProps, a as MMDPlayerBaseRef, b as MMDPlayerEnhancedProps, c as MMDPlaylistProps, d as MMDPlaylistNode } from '../types-C2ale3d9.js';
|
|
2
|
+
export { j as MMDPlaylistConfig, f as MMDResourceItem, g as MMDResourceOptions, e as MMDResources, h as MMDStage, i as MobileOptimization, R as ResourceOption } from '../types-C2ale3d9.js';
|
|
2
3
|
import React__default from 'react';
|
|
3
|
-
|
|
4
|
-
/** MMD 资源配置 */
|
|
5
|
-
interface MMDResources {
|
|
6
|
-
/** 模型文件路径 (.pmx/.pmd) */
|
|
7
|
-
modelPath: string;
|
|
8
|
-
/** 动作文件路径 (.vmd) - 可选 */
|
|
9
|
-
motionPath?: string;
|
|
10
|
-
/** 相机动画路径 (.vmd) - 可选 */
|
|
11
|
-
cameraPath?: string;
|
|
12
|
-
/** 音频文件路径 - 可选 */
|
|
13
|
-
audioPath?: string;
|
|
14
|
-
/** 舞台/场景模型路径 (.pmx/.x) - 可选 */
|
|
15
|
-
stageModelPath?: string;
|
|
16
|
-
/** 附加动作文件 - 可选 */
|
|
17
|
-
additionalMotions?: string[];
|
|
18
|
-
}
|
|
19
|
-
/** 资源列表项 - 用于预设切换 */
|
|
20
|
-
interface MMDResourceItem {
|
|
21
|
-
id: string;
|
|
22
|
-
name: string;
|
|
23
|
-
resources: MMDResources;
|
|
24
|
-
thumbnail?: string;
|
|
25
|
-
description?: string;
|
|
26
|
-
}
|
|
27
|
-
/** 资源选项 - 用于自由组合 */
|
|
28
|
-
interface ResourceOption {
|
|
29
|
-
id: string;
|
|
30
|
-
name: string;
|
|
31
|
-
path: string;
|
|
32
|
-
thumbnail?: string;
|
|
33
|
-
}
|
|
34
|
-
interface MMDResourceOptions {
|
|
35
|
-
models: ResourceOption[];
|
|
36
|
-
motions: ResourceOption[];
|
|
37
|
-
cameras?: ResourceOption[];
|
|
38
|
-
audios?: ResourceOption[];
|
|
39
|
-
stages?: ResourceOption[];
|
|
40
|
-
}
|
|
41
|
-
/** 舞台/场景配置 */
|
|
42
|
-
interface MMDStage {
|
|
43
|
-
/** 背景颜色 */
|
|
44
|
-
backgroundColor?: string;
|
|
45
|
-
/** 背景图片 URL */
|
|
46
|
-
backgroundImage?: string;
|
|
47
|
-
/** 是否启用物理模拟 (默认 true) */
|
|
48
|
-
enablePhysics?: boolean;
|
|
49
|
-
/** 物理引擎路径 (ammo.wasm.js 的路径) */
|
|
50
|
-
physicsPath?: string;
|
|
51
|
-
/** 是否启用阴影 (默认 true) */
|
|
52
|
-
enableShadow?: boolean;
|
|
53
|
-
/** 环境光强度 (默认 0.5) */
|
|
54
|
-
ambientLightIntensity?: number;
|
|
55
|
-
/** 方向光强度 (默认 0.8) */
|
|
56
|
-
directionalLightIntensity?: number;
|
|
57
|
-
/** 相机初始位置 */
|
|
58
|
-
cameraPosition?: {
|
|
59
|
-
x: number;
|
|
60
|
-
y: number;
|
|
61
|
-
z: number;
|
|
62
|
-
} | Vector3;
|
|
63
|
-
/** 相机目标点 */
|
|
64
|
-
cameraTarget?: {
|
|
65
|
-
x: number;
|
|
66
|
-
y: number;
|
|
67
|
-
z: number;
|
|
68
|
-
} | Vector3;
|
|
69
|
-
}
|
|
70
|
-
/** 移动端优化配置 */
|
|
71
|
-
interface MobileOptimization {
|
|
72
|
-
/** 是否启用优化 (默认 true) */
|
|
73
|
-
enabled: boolean;
|
|
74
|
-
/** 像素比 (默认 1.0, 桌面端通常为 window.devicePixelRatio) */
|
|
75
|
-
pixelRatio?: number;
|
|
76
|
-
/** 是否强制关闭物理引擎 (默认 false) */
|
|
77
|
-
disablePhysics?: boolean;
|
|
78
|
-
/** 是否降低阴影质量 (默认 true) */
|
|
79
|
-
reduceShadowQuality?: boolean;
|
|
80
|
-
}
|
|
81
|
-
/** MMDPlayerBase Ref 接口 */
|
|
82
|
-
interface MMDPlayerBaseRef {
|
|
83
|
-
/** 开始播放 */
|
|
84
|
-
play: () => void;
|
|
85
|
-
/** 暂停播放 */
|
|
86
|
-
pause: () => void;
|
|
87
|
-
/** 停止播放 (重置到开头) */
|
|
88
|
-
stop: () => void;
|
|
89
|
-
/** 跳转到指定时间 (秒) */
|
|
90
|
-
seek: (time: number) => void;
|
|
91
|
-
/** 获取当前播放时间 */
|
|
92
|
-
getCurrentTime: () => number;
|
|
93
|
-
/** 获取总时长 */
|
|
94
|
-
getDuration: () => number;
|
|
95
|
-
/** 获取播放状态 */
|
|
96
|
-
isPlaying: () => boolean;
|
|
97
|
-
/** 截图并返回 Base64 字符串 */
|
|
98
|
-
snapshot: () => string;
|
|
99
|
-
}
|
|
100
|
-
/** 基础播放器属性 */
|
|
101
|
-
interface MMDPlayerBaseProps {
|
|
102
|
-
/** 资源配置 */
|
|
103
|
-
resources: MMDResources;
|
|
104
|
-
/** 舞台配置 */
|
|
105
|
-
stage?: MMDStage;
|
|
106
|
-
/** 移动端优化配置 */
|
|
107
|
-
mobileOptimization?: MobileOptimization;
|
|
108
|
-
/** 播放控制 */
|
|
109
|
-
autoPlay?: boolean;
|
|
110
|
-
loop?: boolean;
|
|
111
|
-
volume?: number;
|
|
112
|
-
muted?: boolean;
|
|
113
|
-
/** 调试与辅助 */
|
|
114
|
-
showAxes?: boolean;
|
|
115
|
-
/** 事件回调 */
|
|
116
|
-
onLoad?: () => void;
|
|
117
|
-
onLoadProgress?: (progress: number, item: string) => void;
|
|
118
|
-
onError?: (error: Error) => void;
|
|
119
|
-
onPlay?: () => void;
|
|
120
|
-
onPause?: () => void;
|
|
121
|
-
onEnded?: () => void;
|
|
122
|
-
onTimeUpdate?: (time: number) => void;
|
|
123
|
-
/** 样式 */
|
|
124
|
-
className?: string;
|
|
125
|
-
style?: React.CSSProperties;
|
|
126
|
-
}
|
|
127
|
-
/** 增强播放器属性 */
|
|
128
|
-
interface MMDPlayerEnhancedProps extends Omit<MMDPlayerBaseProps, 'resources'> {
|
|
129
|
-
/** 单一资源模式 */
|
|
130
|
-
resources?: MMDResources;
|
|
131
|
-
/** 列表模式资源 */
|
|
132
|
-
resourcesList?: MMDResourceItem[];
|
|
133
|
-
/** 自由组合模式选项 */
|
|
134
|
-
resourceOptions?: MMDResourceOptions;
|
|
135
|
-
/** 列表模式下的默认 ID */
|
|
136
|
-
defaultResourceId?: string;
|
|
137
|
-
/** 自由组合模式下的默认选择 */
|
|
138
|
-
defaultSelection?: {
|
|
139
|
-
modelId?: string;
|
|
140
|
-
motionId?: string;
|
|
141
|
-
cameraId?: string;
|
|
142
|
-
audioId?: string;
|
|
143
|
-
stageId?: string;
|
|
144
|
-
};
|
|
145
|
-
/** 是否显示调试信息面板 */
|
|
146
|
-
showDebugInfo?: boolean;
|
|
147
|
-
}
|
|
148
|
-
/** 播放列表节点 */
|
|
149
|
-
interface MMDPlaylistNode {
|
|
150
|
-
id: string;
|
|
151
|
-
name: string;
|
|
152
|
-
resources: MMDResources;
|
|
153
|
-
/** 该节点是否循环播放 */
|
|
154
|
-
loop?: boolean;
|
|
155
|
-
/** 预计时长(秒)- 用于进度计算 */
|
|
156
|
-
duration?: number;
|
|
157
|
-
/** 缩略图 */
|
|
158
|
-
thumbnail?: string;
|
|
159
|
-
}
|
|
160
|
-
/** 播放列表配置 */
|
|
161
|
-
interface MMDPlaylistConfig {
|
|
162
|
-
id: string;
|
|
163
|
-
name: string;
|
|
164
|
-
nodes: MMDPlaylistNode[];
|
|
165
|
-
/** 整个播放列表是否循环 */
|
|
166
|
-
loop?: boolean;
|
|
167
|
-
/** 预加载策略
|
|
168
|
-
* - 'none': 不预加载 (默认)
|
|
169
|
-
* - 'next': 预加载下一个节点
|
|
170
|
-
* - 'all': 预加载所有节点
|
|
171
|
-
*/
|
|
172
|
-
preload?: 'none' | 'next' | 'all';
|
|
173
|
-
/** 是否自动播放 */
|
|
174
|
-
autoPlay?: boolean;
|
|
175
|
-
}
|
|
176
|
-
/** 播放列表组件属性 */
|
|
177
|
-
interface MMDPlaylistProps {
|
|
178
|
-
/** 播放列表配置 */
|
|
179
|
-
playlist: MMDPlaylistConfig;
|
|
180
|
-
/** 舞台配置 */
|
|
181
|
-
stage?: MMDStage;
|
|
182
|
-
/** 移动端优化配置 */
|
|
183
|
-
mobileOptimization?: MobileOptimization;
|
|
184
|
-
/** 事件回调 */
|
|
185
|
-
onNodeChange?: (node: MMDPlaylistNode, index: number) => void;
|
|
186
|
-
onPlaylistComplete?: () => void;
|
|
187
|
-
onError?: (error: Error) => void;
|
|
188
|
-
/** 是否显示调试信息面板 */
|
|
189
|
-
showDebugInfo?: boolean;
|
|
190
|
-
/** 样式 */
|
|
191
|
-
className?: string;
|
|
192
|
-
style?: React.CSSProperties;
|
|
193
|
-
}
|
|
4
|
+
import 'three';
|
|
194
5
|
|
|
195
6
|
declare const MMDPlayerBase: React__default.ForwardRefExoticComponent<MMDPlayerBaseProps & React__default.RefAttributes<MMDPlayerBaseRef>>;
|
|
196
7
|
|
|
@@ -252,4 +63,4 @@ declare global {
|
|
|
252
63
|
*/
|
|
253
64
|
declare const loadAmmo: (path?: string) => Promise<any>;
|
|
254
65
|
|
|
255
|
-
export { MMDPlayerBase,
|
|
66
|
+
export { MMDPlayerBase, MMDPlayerBaseProps, MMDPlayerBaseRef, MMDPlayerEnhanced, MMDPlayerEnhancedDebugInfo, MMDPlayerEnhancedProps, MMDPlaylist, MMDPlaylistDebugInfo, MMDPlaylistNode, MMDPlaylistProps, loadAmmo };
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { Vector3 } from 'three';
|
|
2
|
+
|
|
3
|
+
/** MMD 资源配置 */
|
|
4
|
+
interface MMDResources {
|
|
5
|
+
/** 模型文件路径 (.pmx/.pmd) */
|
|
6
|
+
modelPath: string;
|
|
7
|
+
/** 动作文件路径 (.vmd) - 可选 */
|
|
8
|
+
motionPath?: string;
|
|
9
|
+
/** 相机动画路径 (.vmd) - 可选 */
|
|
10
|
+
cameraPath?: string;
|
|
11
|
+
/** 音频文件路径 - 可选 */
|
|
12
|
+
audioPath?: string;
|
|
13
|
+
/** 舞台/场景模型路径 (.pmx/.x) - 可选 */
|
|
14
|
+
stageModelPath?: string;
|
|
15
|
+
/** 附加动作文件 - 可选 */
|
|
16
|
+
additionalMotions?: string[];
|
|
17
|
+
}
|
|
18
|
+
/** 资源列表项 - 用于预设切换 */
|
|
19
|
+
interface MMDResourceItem {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
resources: MMDResources;
|
|
23
|
+
thumbnail?: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
}
|
|
26
|
+
/** 资源选项 - 用于自由组合 */
|
|
27
|
+
interface ResourceOption {
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
path: string;
|
|
31
|
+
thumbnail?: string;
|
|
32
|
+
}
|
|
33
|
+
interface MMDResourceOptions {
|
|
34
|
+
models: ResourceOption[];
|
|
35
|
+
motions: ResourceOption[];
|
|
36
|
+
cameras?: ResourceOption[];
|
|
37
|
+
audios?: ResourceOption[];
|
|
38
|
+
stages?: ResourceOption[];
|
|
39
|
+
}
|
|
40
|
+
/** 舞台/场景配置 */
|
|
41
|
+
interface MMDStage {
|
|
42
|
+
/** 背景颜色 */
|
|
43
|
+
backgroundColor?: string;
|
|
44
|
+
/** 背景图片 URL */
|
|
45
|
+
backgroundImage?: string;
|
|
46
|
+
/** 是否启用物理模拟 (默认 true) */
|
|
47
|
+
enablePhysics?: boolean;
|
|
48
|
+
/** 物理引擎路径 (ammo.wasm.js 的路径) */
|
|
49
|
+
physicsPath?: string;
|
|
50
|
+
/** 是否启用阴影 (默认 true) */
|
|
51
|
+
enableShadow?: boolean;
|
|
52
|
+
/** 环境光强度 (默认 0.5) */
|
|
53
|
+
ambientLightIntensity?: number;
|
|
54
|
+
/** 方向光强度 (默认 0.8) */
|
|
55
|
+
directionalLightIntensity?: number;
|
|
56
|
+
/** 相机初始位置 */
|
|
57
|
+
cameraPosition?: {
|
|
58
|
+
x: number;
|
|
59
|
+
y: number;
|
|
60
|
+
z: number;
|
|
61
|
+
} | Vector3;
|
|
62
|
+
/** 相机目标点 */
|
|
63
|
+
cameraTarget?: {
|
|
64
|
+
x: number;
|
|
65
|
+
y: number;
|
|
66
|
+
z: number;
|
|
67
|
+
} | Vector3;
|
|
68
|
+
}
|
|
69
|
+
/** 移动端优化配置 */
|
|
70
|
+
interface MobileOptimization {
|
|
71
|
+
/** 是否启用优化 (默认 true) */
|
|
72
|
+
enabled: boolean;
|
|
73
|
+
/** 像素比 (默认 1.0, 桌面端通常为 window.devicePixelRatio) */
|
|
74
|
+
pixelRatio?: number;
|
|
75
|
+
/** 是否强制关闭物理引擎 (默认 false) */
|
|
76
|
+
disablePhysics?: boolean;
|
|
77
|
+
/** 是否降低阴影质量 (默认 true) */
|
|
78
|
+
reduceShadowQuality?: boolean;
|
|
79
|
+
}
|
|
80
|
+
/** MMDPlayerBase Ref 接口 */
|
|
81
|
+
interface MMDPlayerBaseRef {
|
|
82
|
+
/** 开始播放 */
|
|
83
|
+
play: () => void;
|
|
84
|
+
/** 暂停播放 */
|
|
85
|
+
pause: () => void;
|
|
86
|
+
/** 停止播放 (重置到开头) */
|
|
87
|
+
stop: () => void;
|
|
88
|
+
/** 跳转到指定时间 (秒) */
|
|
89
|
+
seek: (time: number) => void;
|
|
90
|
+
/** 获取当前播放时间 */
|
|
91
|
+
getCurrentTime: () => number;
|
|
92
|
+
/** 获取总时长 */
|
|
93
|
+
getDuration: () => number;
|
|
94
|
+
/** 获取播放状态 */
|
|
95
|
+
isPlaying: () => boolean;
|
|
96
|
+
/** 截图并返回 Base64 字符串 */
|
|
97
|
+
snapshot: () => string;
|
|
98
|
+
}
|
|
99
|
+
/** 基础播放器属性 */
|
|
100
|
+
interface MMDPlayerBaseProps {
|
|
101
|
+
/** 资源配置 */
|
|
102
|
+
resources: MMDResources;
|
|
103
|
+
/** 舞台配置 */
|
|
104
|
+
stage?: MMDStage;
|
|
105
|
+
/** 移动端优化配置 */
|
|
106
|
+
mobileOptimization?: MobileOptimization;
|
|
107
|
+
/** 播放控制 */
|
|
108
|
+
autoPlay?: boolean;
|
|
109
|
+
loop?: boolean;
|
|
110
|
+
volume?: number;
|
|
111
|
+
muted?: boolean;
|
|
112
|
+
/** 调试与辅助 */
|
|
113
|
+
showAxes?: boolean;
|
|
114
|
+
/** 事件回调 */
|
|
115
|
+
onLoad?: () => void;
|
|
116
|
+
onLoadProgress?: (progress: number, item: string) => void;
|
|
117
|
+
onError?: (error: Error) => void;
|
|
118
|
+
onPlay?: () => void;
|
|
119
|
+
onPause?: () => void;
|
|
120
|
+
onEnded?: () => void;
|
|
121
|
+
onTimeUpdate?: (time: number) => void;
|
|
122
|
+
/** 样式 */
|
|
123
|
+
className?: string;
|
|
124
|
+
style?: React.CSSProperties;
|
|
125
|
+
}
|
|
126
|
+
/** 增强播放器属性 */
|
|
127
|
+
interface MMDPlayerEnhancedProps extends Omit<MMDPlayerBaseProps, 'resources'> {
|
|
128
|
+
/** 单一资源模式 */
|
|
129
|
+
resources?: MMDResources;
|
|
130
|
+
/** 列表模式资源 */
|
|
131
|
+
resourcesList?: MMDResourceItem[];
|
|
132
|
+
/** 自由组合模式选项 */
|
|
133
|
+
resourceOptions?: MMDResourceOptions;
|
|
134
|
+
/** 列表模式下的默认 ID */
|
|
135
|
+
defaultResourceId?: string;
|
|
136
|
+
/** 自由组合模式下的默认选择 */
|
|
137
|
+
defaultSelection?: {
|
|
138
|
+
modelId?: string;
|
|
139
|
+
motionId?: string;
|
|
140
|
+
cameraId?: string;
|
|
141
|
+
audioId?: string;
|
|
142
|
+
stageId?: string;
|
|
143
|
+
};
|
|
144
|
+
/** 是否显示调试信息面板 */
|
|
145
|
+
showDebugInfo?: boolean;
|
|
146
|
+
}
|
|
147
|
+
/** 播放列表节点 */
|
|
148
|
+
interface MMDPlaylistNode {
|
|
149
|
+
id: string;
|
|
150
|
+
name: string;
|
|
151
|
+
resources: MMDResources;
|
|
152
|
+
/** 该节点是否循环播放 */
|
|
153
|
+
loop?: boolean;
|
|
154
|
+
/** 预计时长(秒)- 用于进度计算 */
|
|
155
|
+
duration?: number;
|
|
156
|
+
/** 缩略图 */
|
|
157
|
+
thumbnail?: string;
|
|
158
|
+
}
|
|
159
|
+
/** 播放列表配置 */
|
|
160
|
+
interface MMDPlaylistConfig {
|
|
161
|
+
id: string;
|
|
162
|
+
name: string;
|
|
163
|
+
nodes: MMDPlaylistNode[];
|
|
164
|
+
/** 整个播放列表是否循环 */
|
|
165
|
+
loop?: boolean;
|
|
166
|
+
/** 预加载策略
|
|
167
|
+
* - 'none': 不预加载 (默认)
|
|
168
|
+
* - 'next': 预加载下一个节点
|
|
169
|
+
* - 'all': 预加载所有节点
|
|
170
|
+
*/
|
|
171
|
+
preload?: 'none' | 'next' | 'all';
|
|
172
|
+
/** 是否自动播放 */
|
|
173
|
+
autoPlay?: boolean;
|
|
174
|
+
}
|
|
175
|
+
/** 播放列表组件属性 */
|
|
176
|
+
interface MMDPlaylistProps {
|
|
177
|
+
/** 播放列表配置 */
|
|
178
|
+
playlist: MMDPlaylistConfig;
|
|
179
|
+
/** 舞台配置 */
|
|
180
|
+
stage?: MMDStage;
|
|
181
|
+
/** 移动端优化配置 */
|
|
182
|
+
mobileOptimization?: MobileOptimization;
|
|
183
|
+
/** 事件回调 */
|
|
184
|
+
onNodeChange?: (node: MMDPlaylistNode, index: number) => void;
|
|
185
|
+
onPlaylistComplete?: () => void;
|
|
186
|
+
onError?: (error: Error) => void;
|
|
187
|
+
/** 是否显示调试信息面板 */
|
|
188
|
+
showDebugInfo?: boolean;
|
|
189
|
+
/** 样式 */
|
|
190
|
+
className?: string;
|
|
191
|
+
style?: React.CSSProperties;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export type { MMDPlayerBaseProps as M, ResourceOption as R, MMDPlayerBaseRef as a, MMDPlayerEnhancedProps as b, MMDPlaylistProps as c, MMDPlaylistNode as d, MMDResources as e, MMDResourceItem as f, MMDResourceOptions as g, MMDStage as h, MobileOptimization as i, MMDPlaylistConfig as j };
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { Vector3 } from 'three';
|
|
2
|
+
|
|
3
|
+
/** MMD 资源配置 */
|
|
4
|
+
interface MMDResources {
|
|
5
|
+
/** 模型文件路径 (.pmx/.pmd) */
|
|
6
|
+
modelPath: string;
|
|
7
|
+
/** 动作文件路径 (.vmd) - 可选 */
|
|
8
|
+
motionPath?: string;
|
|
9
|
+
/** 相机动画路径 (.vmd) - 可选 */
|
|
10
|
+
cameraPath?: string;
|
|
11
|
+
/** 音频文件路径 - 可选 */
|
|
12
|
+
audioPath?: string;
|
|
13
|
+
/** 舞台/场景模型路径 (.pmx/.x) - 可选 */
|
|
14
|
+
stageModelPath?: string;
|
|
15
|
+
/** 附加动作文件 - 可选 */
|
|
16
|
+
additionalMotions?: string[];
|
|
17
|
+
}
|
|
18
|
+
/** 资源列表项 - 用于预设切换 */
|
|
19
|
+
interface MMDResourceItem {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
resources: MMDResources;
|
|
23
|
+
thumbnail?: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
}
|
|
26
|
+
/** 资源选项 - 用于自由组合 */
|
|
27
|
+
interface ResourceOption {
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
path: string;
|
|
31
|
+
thumbnail?: string;
|
|
32
|
+
}
|
|
33
|
+
interface MMDResourceOptions {
|
|
34
|
+
models: ResourceOption[];
|
|
35
|
+
motions: ResourceOption[];
|
|
36
|
+
cameras?: ResourceOption[];
|
|
37
|
+
audios?: ResourceOption[];
|
|
38
|
+
stages?: ResourceOption[];
|
|
39
|
+
}
|
|
40
|
+
/** 舞台/场景配置 */
|
|
41
|
+
interface MMDStage {
|
|
42
|
+
/** 背景颜色 */
|
|
43
|
+
backgroundColor?: string;
|
|
44
|
+
/** 背景图片 URL */
|
|
45
|
+
backgroundImage?: string;
|
|
46
|
+
/** 是否启用物理模拟 (默认 true) */
|
|
47
|
+
enablePhysics?: boolean;
|
|
48
|
+
/** 物理引擎路径 (ammo.wasm.js 的路径) */
|
|
49
|
+
physicsPath?: string;
|
|
50
|
+
/** 是否启用阴影 (默认 true) */
|
|
51
|
+
enableShadow?: boolean;
|
|
52
|
+
/** 环境光强度 (默认 0.5) */
|
|
53
|
+
ambientLightIntensity?: number;
|
|
54
|
+
/** 方向光强度 (默认 0.8) */
|
|
55
|
+
directionalLightIntensity?: number;
|
|
56
|
+
/** 相机初始位置 */
|
|
57
|
+
cameraPosition?: {
|
|
58
|
+
x: number;
|
|
59
|
+
y: number;
|
|
60
|
+
z: number;
|
|
61
|
+
} | Vector3;
|
|
62
|
+
/** 相机目标点 */
|
|
63
|
+
cameraTarget?: {
|
|
64
|
+
x: number;
|
|
65
|
+
y: number;
|
|
66
|
+
z: number;
|
|
67
|
+
} | Vector3;
|
|
68
|
+
}
|
|
69
|
+
/** 移动端优化配置 */
|
|
70
|
+
interface MobileOptimization {
|
|
71
|
+
/** 是否启用优化 (默认 true) */
|
|
72
|
+
enabled: boolean;
|
|
73
|
+
/** 像素比 (默认 1.0, 桌面端通常为 window.devicePixelRatio) */
|
|
74
|
+
pixelRatio?: number;
|
|
75
|
+
/** 是否强制关闭物理引擎 (默认 false) */
|
|
76
|
+
disablePhysics?: boolean;
|
|
77
|
+
/** 是否降低阴影质量 (默认 true) */
|
|
78
|
+
reduceShadowQuality?: boolean;
|
|
79
|
+
}
|
|
80
|
+
/** MMDPlayerBase Ref 接口 */
|
|
81
|
+
interface MMDPlayerBaseRef {
|
|
82
|
+
/** 开始播放 */
|
|
83
|
+
play: () => void;
|
|
84
|
+
/** 暂停播放 */
|
|
85
|
+
pause: () => void;
|
|
86
|
+
/** 停止播放 (重置到开头) */
|
|
87
|
+
stop: () => void;
|
|
88
|
+
/** 跳转到指定时间 (秒) */
|
|
89
|
+
seek: (time: number) => void;
|
|
90
|
+
/** 获取当前播放时间 */
|
|
91
|
+
getCurrentTime: () => number;
|
|
92
|
+
/** 获取总时长 */
|
|
93
|
+
getDuration: () => number;
|
|
94
|
+
/** 获取播放状态 */
|
|
95
|
+
isPlaying: () => boolean;
|
|
96
|
+
/** 截图并返回 Base64 字符串 */
|
|
97
|
+
snapshot: () => string;
|
|
98
|
+
}
|
|
99
|
+
/** 基础播放器属性 */
|
|
100
|
+
interface MMDPlayerBaseProps {
|
|
101
|
+
/** 资源配置 */
|
|
102
|
+
resources: MMDResources;
|
|
103
|
+
/** 舞台配置 */
|
|
104
|
+
stage?: MMDStage;
|
|
105
|
+
/** 移动端优化配置 */
|
|
106
|
+
mobileOptimization?: MobileOptimization;
|
|
107
|
+
/** 播放控制 */
|
|
108
|
+
autoPlay?: boolean;
|
|
109
|
+
loop?: boolean;
|
|
110
|
+
volume?: number;
|
|
111
|
+
muted?: boolean;
|
|
112
|
+
/** 调试与辅助 */
|
|
113
|
+
showAxes?: boolean;
|
|
114
|
+
/** 事件回调 */
|
|
115
|
+
onLoad?: () => void;
|
|
116
|
+
onLoadProgress?: (progress: number, item: string) => void;
|
|
117
|
+
onError?: (error: Error) => void;
|
|
118
|
+
onPlay?: () => void;
|
|
119
|
+
onPause?: () => void;
|
|
120
|
+
onEnded?: () => void;
|
|
121
|
+
onTimeUpdate?: (time: number) => void;
|
|
122
|
+
/** 样式 */
|
|
123
|
+
className?: string;
|
|
124
|
+
style?: React.CSSProperties;
|
|
125
|
+
}
|
|
126
|
+
/** 增强播放器属性 */
|
|
127
|
+
interface MMDPlayerEnhancedProps extends Omit<MMDPlayerBaseProps, 'resources'> {
|
|
128
|
+
/** 单一资源模式 */
|
|
129
|
+
resources?: MMDResources;
|
|
130
|
+
/** 列表模式资源 */
|
|
131
|
+
resourcesList?: MMDResourceItem[];
|
|
132
|
+
/** 自由组合模式选项 */
|
|
133
|
+
resourceOptions?: MMDResourceOptions;
|
|
134
|
+
/** 列表模式下的默认 ID */
|
|
135
|
+
defaultResourceId?: string;
|
|
136
|
+
/** 自由组合模式下的默认选择 */
|
|
137
|
+
defaultSelection?: {
|
|
138
|
+
modelId?: string;
|
|
139
|
+
motionId?: string;
|
|
140
|
+
cameraId?: string;
|
|
141
|
+
audioId?: string;
|
|
142
|
+
stageId?: string;
|
|
143
|
+
};
|
|
144
|
+
/** 是否显示调试信息面板 */
|
|
145
|
+
showDebugInfo?: boolean;
|
|
146
|
+
}
|
|
147
|
+
/** 播放列表节点 */
|
|
148
|
+
interface MMDPlaylistNode {
|
|
149
|
+
id: string;
|
|
150
|
+
name: string;
|
|
151
|
+
resources: MMDResources;
|
|
152
|
+
/** 该节点是否循环播放 */
|
|
153
|
+
loop?: boolean;
|
|
154
|
+
/** 预计时长(秒)- 用于进度计算 */
|
|
155
|
+
duration?: number;
|
|
156
|
+
/** 缩略图 */
|
|
157
|
+
thumbnail?: string;
|
|
158
|
+
}
|
|
159
|
+
/** 播放列表配置 */
|
|
160
|
+
interface MMDPlaylistConfig {
|
|
161
|
+
id: string;
|
|
162
|
+
name: string;
|
|
163
|
+
nodes: MMDPlaylistNode[];
|
|
164
|
+
/** 整个播放列表是否循环 */
|
|
165
|
+
loop?: boolean;
|
|
166
|
+
/** 预加载策略
|
|
167
|
+
* - 'none': 不预加载 (默认)
|
|
168
|
+
* - 'next': 预加载下一个节点
|
|
169
|
+
* - 'all': 预加载所有节点
|
|
170
|
+
*/
|
|
171
|
+
preload?: 'none' | 'next' | 'all';
|
|
172
|
+
/** 是否自动播放 */
|
|
173
|
+
autoPlay?: boolean;
|
|
174
|
+
}
|
|
175
|
+
/** 播放列表组件属性 */
|
|
176
|
+
interface MMDPlaylistProps {
|
|
177
|
+
/** 播放列表配置 */
|
|
178
|
+
playlist: MMDPlaylistConfig;
|
|
179
|
+
/** 舞台配置 */
|
|
180
|
+
stage?: MMDStage;
|
|
181
|
+
/** 移动端优化配置 */
|
|
182
|
+
mobileOptimization?: MobileOptimization;
|
|
183
|
+
/** 事件回调 */
|
|
184
|
+
onNodeChange?: (node: MMDPlaylistNode, index: number) => void;
|
|
185
|
+
onPlaylistComplete?: () => void;
|
|
186
|
+
onError?: (error: Error) => void;
|
|
187
|
+
/** 是否显示调试信息面板 */
|
|
188
|
+
showDebugInfo?: boolean;
|
|
189
|
+
/** 样式 */
|
|
190
|
+
className?: string;
|
|
191
|
+
style?: React.CSSProperties;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export type { MMDPlayerBaseProps as M, ResourceOption as R, MMDPlayerBaseRef as a, MMDPlayerEnhancedProps as b, MMDPlaylistProps as c, MMDPlaylistNode as d, MMDResources as e, MMDResourceItem as f, MMDResourceOptions as g, MMDStage as h, MobileOptimization as i, MMDPlaylistConfig as j };
|