This commit is contained in:
@ -11,7 +11,7 @@ export const AppConfig = {
|
||||
success: null as OptionalCallback,
|
||||
error: null as ErrorCallback,
|
||||
env: {
|
||||
hdrPath:"",
|
||||
envPath:"",
|
||||
intensity: 1,
|
||||
rotationY: 0
|
||||
}
|
||||
|
||||
@ -15,17 +15,17 @@ export class AppEnv extends Monobehiver {
|
||||
|
||||
/** 初始化 - 创建默认HDR环境 */
|
||||
Awake(): void {
|
||||
this.createHDR(AppConfig.env);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建HDR环境贴图
|
||||
* @param hdrPath HDR文件路径
|
||||
*/
|
||||
createHDR(options?: { hdrPath?: string; intensity?: number; rotationY?: number }): void {
|
||||
const hdrPath = options?.hdrPath || AppConfig.env.hdrPath || '/hdr/sanGiuseppeBridge.env';
|
||||
const intensity = options?.intensity ?? AppConfig.env.intensity ?? 1.5;
|
||||
const rotationY = options?.rotationY ?? AppConfig.env.rotationY ?? 0;
|
||||
createHDR(): void {
|
||||
const hdrPath = AppConfig.env.envPath;
|
||||
const intensity = AppConfig.env.intensity ?? 1.5;
|
||||
const rotationY = AppConfig.env.rotationY ?? 0;
|
||||
const scene = this.mainApp.appScene.object;
|
||||
if (!scene) return;
|
||||
if (this.object) {
|
||||
@ -57,13 +57,6 @@ export class AppEnv extends Monobehiver {
|
||||
if (this.object) this.object.rotationY = angle;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新环境配置
|
||||
*/
|
||||
updateEnvironment(options: { hdrPath?: string; intensity?: number; rotationY?: number }): void {
|
||||
this.createHDR(options);
|
||||
}
|
||||
|
||||
/** 清理资源 */
|
||||
clean(): void {
|
||||
if (this.object) {
|
||||
|
||||
11
src/main.ts
11
src/main.ts
@ -57,17 +57,6 @@ const kernel = {
|
||||
await mainApp.loadModel();
|
||||
},
|
||||
|
||||
/** 更新环境贴图配置(路径/强度/旋转) */
|
||||
setEnvironment: function (envConfig: { hdrPath?: string; intensity?: number; rotationY?: number }): void {
|
||||
if (!mainApp) {
|
||||
console.warn('mainApp is not initialized yet');
|
||||
return;
|
||||
}
|
||||
if (envConfig) {
|
||||
AppConfig.env = { ...AppConfig.env, ...envConfig };
|
||||
mainApp.appEnv.updateEnvironment(AppConfig.env);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (!window.faceSDK) {
|
||||
|
||||
Reference in New Issue
Block a user