dev #10

Merged
ksenia_mikhailova merged 46 commits from dev into main 2024-07-24 12:58:58 +03:00
2 changed files with 12 additions and 4 deletions
Showing only changes of commit 281a229b58 - Show all commits

View File

@ -73,18 +73,24 @@ const loadModels = async () => {
const element = clickable.value[index]; const element = clickable.value[index];
const find_element = seekByName(scene.value, element.object_name) const find_element = seekByName(scene.value, element.object_name)
if (!find_element) continue if (!find_element) continue
const res_array = (find_element as Group).isGroup ? find_element?.children : [find_element] // const res_array = (find_element as Group).isGroup ? find_element?.children : [find_element]
if (find_element && !(find_element as Group).isGroup) { if (find_element && !(find_element as Group).isGroup) {
const world_position = new Vector3(); const world_position = new Vector3();
((find_element as Mesh).geometry.boundingBox as any).getCenter(world_position); ((find_element as Mesh).geometry.boundingBox as any).getCenter(world_position);
(find_element as Mesh).localToWorld(world_position); (find_element as Mesh).localToWorld(world_position);
const map = new TextureLoader().load('sprite.png');
const p = raw_data.min_distance * 0.05 const p = raw_data.min_distance * 0.05
const material = new MeshBasicMaterial({ color: new Color('red'), side: DoubleSide });
const plane = new PlaneGeometry(p, p) const plane = new PlaneGeometry(p, p)
const point = new Mesh(plane, material); const mesh_material = new MeshBasicMaterial({side: DoubleSide})
if(element.image) {
const map = new TextureLoader().load(`${IMAGE_URL}/${element.image}`);
mesh_material.map = map
} else {
mesh_material.color = new Color('red')
}
const point = new Mesh(plane, mesh_material);
point.position.set(world_position.x, p * 3, world_position.z) point.position.set(world_position.x, p * 3, world_position.z)
point.name = `${element.id}_clickable` point.name = `${element.id}_clickable`
point.renderOrder = 1 point.renderOrder = 1
@ -130,6 +136,7 @@ watch(() => props.source, () => {
if (loaded) { if (loaded) {
loaded.children = [] loaded.children = []
} }
sidebar.close()
loadModels() loadModels()
}) })

View File

@ -38,6 +38,7 @@ interface clickableAreaType {
id: number; id: number;
name: string; name: string;
object_name: string; object_name: string;
image?: string;
source: number; source: number;
target: number; target: number;
target_name?: string target_name?: string