计算孔洞间距

This commit is contained in:
Last
2025-05-06 22:12:49 +08:00
parent 986fd6f3e8
commit 54d825ce59
2 changed files with 50 additions and 34 deletions

View File

@@ -13,8 +13,8 @@
</style>
<script type="module">
import * as THREE from 'three';
import { CSGHexNutGeometry } from './objects/育苗盘.js';
import { 六角螺丝帽 } from './objects/螺丝帽.js';
import { 方形育苗盘 } from './objects/育苗盘.js';
// 1. 初始化场景、相机和渲染器
const scene = new THREE.Scene();
@@ -30,10 +30,6 @@
//);
//scene.add(cube);
//// 添加育苗盘
//const 育苗盘模型 = 育苗盘();
//scene.add(育苗盘模型);
// 添加螺丝帽
const 螺丝帽模型 = new THREE.Mesh(
new 六角螺丝帽(1, 0.5, 0.6),
@@ -41,6 +37,14 @@
);
scene.add(螺丝帽模型);
// 添加育苗盘
const 育苗盘模型 = new THREE.Mesh(
new 方形育苗盘(),
new THREE.MeshStandardMaterial({ color: 0x0000ff, roughness: 0.5, metalness: 0.8 })
);
//育苗盘模型.position.set(0, -1, 0); // 设置育苗盘位置
scene.add(育苗盘模型);
// 添加光源
scene.add(new THREE.AmbientLight(0x404040, 1)); // 环境光,柔和的白光
const directionalLight = new THREE.DirectionalLight(0xffffff, 0.8); // 平行光
@@ -55,9 +59,9 @@
//cube.rotation.x += 0.01;
//cube.rotation.y += 0.01;
//// 旋转育苗盘
//育苗盘模型.rotation.x += 0.01;
//育苗盘模型.rotation.y += 0.01;
// 旋转育苗盘
育苗盘模型.rotation.x += 0.01;
育苗盘模型.rotation.y += 0.01;
// 旋转螺丝帽
螺丝帽模型.rotation.x += 0.01;