|
|
@ -85,6 +85,10 @@ import Split from '@/components/split/split.vue' |
|
|
import SplitArea from '@/components/split/split-area.vue' |
|
|
import SplitArea from '@/components/split/split-area.vue' |
|
|
import { renderIcon } from '@/utils/webutils.js' |
|
|
import { renderIcon } from '@/utils/webutils.js' |
|
|
import textureUrl from '@/assets/images/conveyor/shapes/RibSideSkirtThumbnail.jpg' |
|
|
import textureUrl from '@/assets/images/conveyor/shapes/RibSideSkirtThumbnail.jpg' |
|
|
|
|
|
import textureUrl2 from '@/assets/images/conveyor/shapes/logo.png' |
|
|
|
|
|
import moveUrl from '@/assets/images/conveyor/shapes/move.svg' |
|
|
|
|
|
import arrowRightUrl from '@/assets/images/conveyor/shapes/arrow-right.svg' |
|
|
|
|
|
// import pointImg from '@/assets/images/logo.png' arrow-right.svg |
|
|
|
|
|
|
|
|
// DOM refs |
|
|
// DOM refs |
|
|
const canvasContainer = ref(null) |
|
|
const canvasContainer = ref(null) |
|
|
@ -165,7 +169,7 @@ watch(() => restate.mode, (newVal) => { |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
function addConveyor(){ |
|
|
function addConveyor(){//输送线 |
|
|
// 1. 创建几何体:长 10 米,宽 0.8 米 |
|
|
// 1. 创建几何体:长 10 米,宽 0.8 米 |
|
|
const length = 20; // 长度 (X轴) |
|
|
const length = 20; // 长度 (X轴) |
|
|
const width = 0.8; // 宽度 (Y轴) |
|
|
const width = 0.8; // 宽度 (Y轴) |
|
|
@ -202,8 +206,11 @@ function addConveyor(){ |
|
|
|
|
|
|
|
|
// 放置到合适的位置(如果需要) |
|
|
// 放置到合适的位置(如果需要) |
|
|
conveyorBelt.position.y = height / 2; // 让底部贴地 |
|
|
conveyorBelt.position.y = height / 2; // 让底部贴地 |
|
|
|
|
|
// // 示例:在输送线不同位置添加多个标记 |
|
|
|
|
|
addMarkerAt(-9.5, height,0,moveUrl); // 起点 |
|
|
|
|
|
addMarkerAt(0, height,0,arrowRightUrl); // 中间 |
|
|
|
|
|
addMarkerAt(9.5, height,0,moveUrl); // 终点 |
|
|
scene.add(conveyorBelt) |
|
|
scene.add(conveyorBelt) |
|
|
|
|
|
|
|
|
// 动画函数 |
|
|
// 动画函数 |
|
|
let offsetSpeed = 0.01; // 控制滚动速度 |
|
|
let offsetSpeed = 0.01; // 控制滚动速度 |
|
|
function animate() { |
|
|
function animate() { |
|
|
@ -225,8 +232,32 @@ function addConveyor(){ |
|
|
} |
|
|
} |
|
|
animate(); |
|
|
animate(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function addMarkerAt(x, y,z,textUrl, scale = 1) { |
|
|
|
|
|
const loader = new THREE.TextureLoader(); |
|
|
|
|
|
loader.load(textUrl, (texture) => { |
|
|
|
|
|
// 创建一个平面作为标记(大小可以调整) |
|
|
|
|
|
const markerGeometry = new THREE.PlaneGeometry(.6 * scale, 0.5 * scale); // 宽高比例保持一致 |
|
|
|
|
|
|
|
|
|
|
|
const markerMaterial = new THREE.MeshBasicMaterial({ |
|
|
|
|
|
map: texture, |
|
|
|
|
|
transparent: true, |
|
|
|
|
|
opacity: 1, |
|
|
|
|
|
depthWrite: false, |
|
|
|
|
|
side: THREE.DoubleSide |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const marker = new THREE.Mesh(markerGeometry, markerMaterial); |
|
|
|
|
|
let yHeight=y+0.01 |
|
|
|
|
|
// 设置位置:位于输送线表面(Y轴略高于输送线一点) |
|
|
|
|
|
marker.position.set(x, yHeight, z); // Y = 输送线高度 + 一点间距 |
|
|
|
|
|
|
|
|
|
|
|
// 旋转为 X/Z 平面方向(与输送线一致) |
|
|
|
|
|
marker.rotation.x = -Math.PI / 2; // 和 conveyorBelt 一样旋转角度 |
|
|
|
|
|
marker.rotation.z = Math.PI / 2; // 在平面上旋转 90 度 |
|
|
|
|
|
scene.add(marker); |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function initThree() { |
|
|
function initThree() { |
|
|
|