This commit is contained in:
@ -15,7 +15,7 @@ export class AppEnv extends Monobehiver {
|
||||
|
||||
/** 初始化 - 创建默认HDR环境 */
|
||||
Awake(): void {
|
||||
|
||||
this.createHDR();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -45,9 +45,10 @@ export class MainApp {
|
||||
loadAConfig(config: any): void {
|
||||
AppConfig.container = config.container || 'renderDom';
|
||||
AppConfig.modelUrlList = config.modelUrlList || [];
|
||||
AppConfig.env = config.env
|
||||
AppConfig.success = config.success;
|
||||
AppConfig.error = config.error;
|
||||
AppConfig.env = config.env
|
||||
|
||||
}
|
||||
|
||||
loadModel(): void {
|
||||
|
||||
20
src/main.ts
20
src/main.ts
@ -14,13 +14,10 @@ declare global {
|
||||
type InitParams = {
|
||||
container?: string;
|
||||
modelUrlList?: string[];
|
||||
animationUrlList?: string[];
|
||||
idleAnimationUrlList?: string[];
|
||||
onSuccess?: () => void;
|
||||
onError?: (error?: unknown) => void;
|
||||
apiConfig?: ConfiguratorParams;
|
||||
envConfig?: {
|
||||
hdrPath?: string;
|
||||
env?: {
|
||||
envPath?: string;
|
||||
intensity?: number;
|
||||
rotationY?: number;
|
||||
};
|
||||
@ -33,24 +30,13 @@ const kernel = {
|
||||
init: async function (params: InitParams): Promise<void> {
|
||||
if (!params) { console.error('params is required'); return; }
|
||||
|
||||
if (params.apiConfig) {
|
||||
await configurator.init(params.apiConfig);
|
||||
if (params.apiConfig.name) {
|
||||
const userInfo = await auth.login(params.apiConfig.name);
|
||||
if (!userInfo) {
|
||||
console.error('failed to fetch user');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mainApp = new MainApp();
|
||||
mainApp.loadAConfig({
|
||||
container: params.container || 'renderDom',
|
||||
modelUrlList: params.modelUrlList || [],
|
||||
success: params.onSuccess ?? null,
|
||||
error: params.onError ?? null,
|
||||
envConfig: params.envConfig
|
||||
env: params.env
|
||||
});
|
||||
|
||||
await mainApp.Awake();
|
||||
|
||||
Reference in New Issue
Block a user