Files
zhengte.babylonjs-sdk/examples/global-demo.html
2026-04-24 11:20:27 +08:00

92 lines
2.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SDK ȫ<>ֹ<EFBFBD><D6B9>ؼ<EFBFBD><D8BC><EFBFBD>ʾ<EFBFBD><CABE></title>
</head>
<body>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
overflow: hidden;
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}
#app {
width: 100vw;
height: 100vh;
position: relative;
}
#renderDom {
width: 100%;
height: 100%;
display: block;
}
</style>
<canvas id="renderDom"></canvas>
<script src="https://sdk.zguiy.com/zt/assets/index.global.js"></script>
<script>
const config = {
container: '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 },
};
const sdkKernel = window.faceSDK && window.faceSDK.kernel;
if (!sdkKernel) {
console.error('faceSDK kernel is not available. Confirm index.global.js loaded correctly.');
} else {
sdkKernel.init(config);
sdkKernel.on('model:load:progress', (data) => {
console.log('加载模型中', data);
});
sdkKernel.on('model:loaded', (data) => {
console.log('模型加载完成', data);
});
sdkKernel.on('model:click', (data) => {
console.log('模型点击事件', data);
});
sdkKernel.on('all:ready', (data) => {
console.log('所有模块加载完,', data);
sdkKernel.material.apply({
target: 'Material__2',
attribute: 'alpha',
value: 0.5,
});
sdkKernel.hotspot.render([
{
id: "h1",
name: "卷帘门",
meshName: "Valve_01",
icon: "https://bpic.588ku.com/element_pic/20/06/30/d1046b01afc0b9586844350d131f4daf.jpg!/fw/253/quality/90/unsharp/true/compress/true",
offset: [25, 25, 0],
radius: 20,
color: "#21c7ff",
payload: { type: "valve", code: "A" },
},
]);
});
}
</script>
</body>
</html>