1
This commit is contained in:
16
index.js
16
index.js
@ -16,10 +16,9 @@ const config = {
|
||||
|
||||
kernel.init(config);
|
||||
|
||||
kernel.model.add("百叶窗小","https://sdk.zguiy.com/resurces/model/百叶窗小.glb")
|
||||
kernel.model.add("卷帘大","https://sdk.zguiy.com/resurces/model/卷帘大.glb")
|
||||
kernel.model.add("卷帘小","https://sdk.zguiy.com/resurces/model/卷帘小.glb")
|
||||
kernel.model.add("小桌","https://sdk.zguiy.com/resurces/model/小桌.glb")
|
||||
kernel.model.add("卷帘大", "https://sdk.zguiy.com/resurces/model/卷帘大.glb")
|
||||
kernel.model.add("卷帘小", "https://sdk.zguiy.com/resurces/model/卷帘小.glb")
|
||||
kernel.model.add("小桌", "https://sdk.zguiy.com/resurces/model/小桌.glb")
|
||||
|
||||
kernel.on('model:load:progress', (data) => {
|
||||
console.log('模型加载事件', data);
|
||||
@ -34,9 +33,6 @@ kernel.on('model:loaded', (data) => {
|
||||
if (progressContainer) {
|
||||
progressContainer.style.display = 'none';
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
kernel.on('all:ready', (data) => {
|
||||
@ -46,12 +42,10 @@ kernel.on('all:ready', (data) => {
|
||||
attribute: 'alpha',
|
||||
value: 0.5,
|
||||
});
|
||||
|
||||
|
||||
kernel.hotspot.render([
|
||||
{
|
||||
id: "h1",
|
||||
type:'hotspot',
|
||||
type: 'hotspot',
|
||||
name: "卷帘门",
|
||||
meshName: "Valve_01",
|
||||
icon: "https://bpic.588ku.com/element_pic/20/06/30/d1046b01afc0b9586844350d131f4daf.jpg!/fw/253/quality/90/unsharp/true/compress/true",
|
||||
@ -90,7 +84,7 @@ kernel.on('model:click', (data) => {
|
||||
document.getElementById('info-position').textContent = `坐标: [${position.x.toFixed(2)}, ${position.y.toFixed(2)}, ${position.z.toFixed(2)}]`;
|
||||
|
||||
// 将DOM附加到点击的3D坐标(会自动显示)
|
||||
kernel.domTo3D.attach('model-info', infoDiv, [position.x, position.y, position.z], { x: -2, y: -2});
|
||||
kernel.domTo3D.attach('model-info', infoDiv, [position.x, position.y, position.z], { x: -2, y: -2 });
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user