加入剖切
This commit is contained in:
28
index.html
28
index.html
@ -4,8 +4,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>3D模型展示SDK - TS版</title>
|
||||
<style>
|
||||
<title>3D Model Showcase SDK - TS</title><style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
@ -44,7 +43,7 @@
|
||||
|
||||
const config = {
|
||||
container: document.querySelector('#renderDom'),
|
||||
modelUrlList: ['https://sdk.zguiy.com/resurces/model/model.glb'],
|
||||
modelUrlList: ['https://sdk.zguiy.com/resurces/model/model_new.glb'],
|
||||
env: { envPath: 'https://sdk.zguiy.com/resurces/hdr/hdr.env', intensity: 1.2, rotationY: 0.3, background: false },
|
||||
};
|
||||
|
||||
@ -67,7 +66,7 @@
|
||||
});
|
||||
|
||||
kernel.on('all:ready', (data) => {
|
||||
console.log('所有模块加载完成', data);
|
||||
console.log('所有模块加载完,', data);
|
||||
kernel.material.apply({
|
||||
target: 'Material__2',
|
||||
attribute: 'alpha',
|
||||
@ -80,6 +79,22 @@
|
||||
|
||||
kernel.on('model:click', (data) => {
|
||||
console.log('模型点击事件', data);
|
||||
|
||||
// 切换卷帘门开关
|
||||
kernel.door.toggle({ speed: 1.2 });
|
||||
|
||||
// Y轴剖切,调整这个高度值来找到合适的剖切位置
|
||||
const clipHeight = 30; // 增加高度,原来是3.5
|
||||
console.log('设置剖切:', clipHeight);
|
||||
kernel.clipping.setY(clipHeight, true);
|
||||
|
||||
// 验证剖切是否生效
|
||||
setTimeout(() => {
|
||||
const scene = kernel.mainApp?.appScene?.object;
|
||||
console.log('Scene:', scene);
|
||||
console.log('Scene clipPlane:', scene?.clipPlane);
|
||||
console.log('Scene meshes count:', scene?.meshes?.length);
|
||||
}, 100);
|
||||
});
|
||||
|
||||
|
||||
@ -87,4 +102,7 @@
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user