51 lines
1.8 KiB
TypeScript
51 lines
1.8 KiB
TypeScript
import type { DeepReadonly } from "vue"
|
||
import type { MaterialRequest } from "../components/MaterialAdjuster.vue"
|
||
|
||
let _libOutputConfig = {
|
||
host:'https://tapi.cfcad.cn:7779',
|
||
textureSrc: [],
|
||
file: undefined,
|
||
submitCallback: undefined,
|
||
cancelCallback: undefined,
|
||
envTextureSrc: ['./right.webp', './left.webp', './top.webp', './bottom.webp', './front.webp', './back.webp'],
|
||
grayEnvTextureSrc: ['./right-gray.webp', './left-gray.webp', './top-gray.webp', './bottom-gray.webp', './front-gray.webp', './back-gray.webp'],
|
||
} as LibOutputConfig
|
||
|
||
export function ConfigureLibOutput(config: Partial<LibOutputConfig>) {
|
||
Object.assign(_libOutputConfig, {
|
||
...config
|
||
});
|
||
// _libOutputConfig = config;
|
||
}
|
||
|
||
export type LibOutputConfig = {
|
||
/**
|
||
* 材质文件域名,用来获取贴图文件
|
||
*/
|
||
host: string,
|
||
/** 材质贴图链接列表,用与批量提交,场景会只会载入第一个链接作为纹理预览,但是导出提交时会为所有链接创建材质 */
|
||
textureSrc: Array<string>,
|
||
/** 更新模型,对材质进行编辑时赋值 */
|
||
updateModel?: {
|
||
/** 材质名 */
|
||
name: string;
|
||
/** 材质预设数据,base64编码 */
|
||
file: string;
|
||
}
|
||
/** 环境贴图链接(立方体贴图,按照顺序输入[右左上下前后]) */
|
||
envTextureSrc: string[],
|
||
/** 灰度环境贴图链接,输入格式与环境贴图一致 */
|
||
grayEnvTextureSrc: string[],
|
||
/** 提交材质时的回调 */
|
||
submitCallback?: (data: Array<MaterialRequest>) => void,
|
||
/**
|
||
* 取消材质编辑时的回调
|
||
* @deprecated 不需要使用
|
||
*/
|
||
cancelCallback?: () => void
|
||
}
|
||
|
||
export function GetConfig(): DeepReadonly<typeof _libOutputConfig>
|
||
{
|
||
return _libOutputConfig;
|
||
}
|