修复
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
yinsx
2026-01-05 14:11:45 +08:00
parent 8e65eeb501
commit 58cd883720
5 changed files with 16 additions and 36 deletions

View File

@ -15,7 +15,7 @@
const config = { const config = {
container: 'renderDom', container: 'renderDom',
modelUrlList: ['/public/model/model.glb'], modelUrlList: ['/public/model/model.glb'],
env: '/public/model/model.glb', env: { hdrPath: '/hdr/hdr.env', intensity: 1.2, rotationY: 0.3 },
onSuccess: () => console.log('SDK initialized (module)'), onSuccess: () => console.log('SDK initialized (module)'),
onError: (err) => console.error('SDK init error', err), onError: (err) => console.error('SDK init error', err),
}; };

View File

@ -21,19 +21,17 @@
</div> </div>
<script type="module"> <script type="module">
import { kernel } from '/src/main.ts'; import { kernel } from 'https://sdk.zguiy.com/zt/assets/index.js';
const config = { const config = {
container: 'renderDom', container: 'renderDom',
modelUrlList: ["/model/model.glb"], modelUrlList: ['/public/model/model.glb'],
animationUrlList: [], env: { envPath: '/hdr/hdr.env', intensity: 1.2, rotationY: 0.3 },
idleAnimationUrlList: [], onSuccess: () => console.log('SDK initialized (module)'),
onSuccess: () => console.log('SDK initialized'), onError: (err) => console.error('SDK init error', err),
onError: (err) => console.error('SDK init error', err), };
};
kernel.init(config);
kernel.init(config);
</script> </script>
</body> </body>

View File

@ -11,7 +11,7 @@ export const AppConfig = {
success: null as OptionalCallback, success: null as OptionalCallback,
error: null as ErrorCallback, error: null as ErrorCallback,
env: { env: {
hdrPath:"", envPath:"",
intensity: 1, intensity: 1,
rotationY: 0 rotationY: 0
} }

View File

@ -15,17 +15,17 @@ export class AppEnv extends Monobehiver {
/** 初始化 - 创建默认HDR环境 */ /** 初始化 - 创建默认HDR环境 */
Awake(): void { Awake(): void {
this.createHDR(AppConfig.env);
} }
/** /**
* 创建HDR环境贴图 * 创建HDR环境贴图
* @param hdrPath HDR文件路径 * @param hdrPath HDR文件路径
*/ */
createHDR(options?: { hdrPath?: string; intensity?: number; rotationY?: number }): void { createHDR(): void {
const hdrPath = options?.hdrPath || AppConfig.env.hdrPath || '/hdr/sanGiuseppeBridge.env'; const hdrPath = AppConfig.env.envPath;
const intensity = options?.intensity ?? AppConfig.env.intensity ?? 1.5; const intensity = AppConfig.env.intensity ?? 1.5;
const rotationY = options?.rotationY ?? AppConfig.env.rotationY ?? 0; const rotationY = AppConfig.env.rotationY ?? 0;
const scene = this.mainApp.appScene.object; const scene = this.mainApp.appScene.object;
if (!scene) return; if (!scene) return;
if (this.object) { if (this.object) {
@ -57,13 +57,6 @@ export class AppEnv extends Monobehiver {
if (this.object) this.object.rotationY = angle; if (this.object) this.object.rotationY = angle;
} }
/**
* 更新环境配置
*/
updateEnvironment(options: { hdrPath?: string; intensity?: number; rotationY?: number }): void {
this.createHDR(options);
}
/** 清理资源 */ /** 清理资源 */
clean(): void { clean(): void {
if (this.object) { if (this.object) {

View File

@ -57,17 +57,6 @@ const kernel = {
await mainApp.loadModel(); 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) { if (!window.faceSDK) {