增加环境背景参数
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
yinsx
2026-01-07 15:23:21 +08:00
parent b238139773
commit ae59fbe68b
6 changed files with 123 additions and 12 deletions

View File

@ -11,6 +11,7 @@ export const AppConfig = {
env: {
envPath: '/hdr/sanGiuseppeBridge.env',
intensity: 1.5,
rotationY: 0
rotationY: 0,
background: true,
}
};

View File

@ -37,6 +37,24 @@ export class AppEnv extends Monobehiver {
scene.environmentIntensity = intensity;
scene.environmentTexture = reflectionTexture;
this.object = reflectionTexture;
scene.backgroundTexture = reflectionTexture;
const box = scene.createDefaultSkybox(
reflectionTexture,
true,
512,
0,
true
);
console.log('box', AppConfig.env.background);
if (AppConfig.env.background) {
if (box) box.visibility = 1;
} else {
if (box) box.visibility = 0;
}
// 保存环境纹理的引用
this.object = reflectionTexture;
}
/**

View File

@ -16,12 +16,11 @@ type InitParams = {
container?: string | HTMLCanvasElement;
modelUrlList?: string[];
apiConfig?: ConfiguratorParams;
onSuccess?: () => void;
onError?: (error?: unknown) => void;
env?: {
hdrPath?: string;
intensity?: number;
rotationY?: number;
background?: boolean;
};
};