diff --git a/examples/global-demo.html b/examples/global-demo.html index 97df56c..304b183 100644 --- a/examples/global-demo.html +++ b/examples/global-demo.html @@ -4,20 +4,44 @@ - SDK 全局挂载加载示例 + SDK 全锟街癸拷锟截硷拷锟斤拷示锟斤拷 + - - + - + \ No newline at end of file diff --git a/examples/index.html b/examples/index.html new file mode 100644 index 0000000..304b183 --- /dev/null +++ b/examples/index.html @@ -0,0 +1,69 @@ + + + + + + + SDK 全锟街癸拷锟截硷拷锟斤拷示锟斤拷 + + + + + + + + + + + + \ No newline at end of file diff --git a/index.html b/index.html index 39a5825..bb4b2fc 100644 --- a/index.html +++ b/index.html @@ -45,7 +45,7 @@ const config = { container: document.querySelector('#renderDom'), modelUrlList: ['https://sdk.zguiy.com/resurces/model/model.glb'], - env: { envPath: 'https://sdk.zguiy.com/resurces/hdr/hdr.env', intensity: 1.2, rotationY: 0.3 }, + env: { envPath: 'https://sdk.zguiy.com/resurces/hdr/hdr.env', intensity: 1.2, rotationY: 0.3,background: false }, }; kernel.init(config); diff --git a/src/babylonjs/AppConfig.ts b/src/babylonjs/AppConfig.ts index 058831d..3a51110 100644 --- a/src/babylonjs/AppConfig.ts +++ b/src/babylonjs/AppConfig.ts @@ -11,6 +11,7 @@ export const AppConfig = { env: { envPath: '/hdr/sanGiuseppeBridge.env', intensity: 1.5, - rotationY: 0 + rotationY: 0, + background: true, } }; diff --git a/src/babylonjs/AppEnv.ts b/src/babylonjs/AppEnv.ts index 9646cc2..8fff1e7 100644 --- a/src/babylonjs/AppEnv.ts +++ b/src/babylonjs/AppEnv.ts @@ -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; + } /** diff --git a/src/main.ts b/src/main.ts index 0ccba6a..69e4ec2 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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; }; };