bx-1379-redesign #15

Merged
ksenia_mikhailova merged 124 commits from bx-1379-redesign into dev 2024-09-06 15:39:13 +03:00
1 changed files with 10 additions and 5 deletions
Showing only changes of commit 07a033f48f - Show all commits

View File

@ -174,7 +174,10 @@ const loadModels = async () => {
if (!find_element) continue if (!find_element) continue
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); const size = new Vector3()
const boundingBox = ((find_element as Mesh).geometry.boundingBox as any)
boundingBox.getCenter(world_position);
boundingBox.getCenter(size);
(find_element as Mesh).localToWorld(world_position); (find_element as Mesh).localToWorld(world_position);
const p = raw_dataStore.data.min_distance * 0.05; const p = raw_dataStore.data.min_distance * 0.05;
@ -182,14 +185,16 @@ const loadModels = async () => {
const hsl_color = { h: 0, s: 0, l: 0 } const hsl_color = { h: 0, s: 0, l: 0 }
new Color(envVars.clear_color).getHSL(hsl_color) new Color(envVars.clear_color).getHSL(hsl_color)
// hsl_color.h = 1 - degrees = radians × 180° / π const rad = Math.PI / 180
console.log(hsl_color) hsl_color.h = (((hsl_color.h * rad) + 180) % 360) * rad
hsl_color.s = hsl_color.s + 0.2
// console.log(size)
point_mesh_obj.traverse((el: Group | Mesh) => { point_mesh_obj.traverse((el: Group | Mesh) => {
if (el instanceof Mesh && el.material) { if (el instanceof Mesh && el.material && el.material instanceof MeshStandardMaterial) {
el.material.color = new Color().setHSL(hsl_color.h, hsl_color.s, hsl_color.l) el.material.color = new Color().setHSL(hsl_color.h, hsl_color.s, hsl_color.l)
} }
}) })
point.position.set(world_position.x, p * 1, world_position.z * 2) point.position.set(world_position.x, size.y, world_position.z)
point.updateMatrixWorld() point.updateMatrixWorld()
point.name = `${element.id}_clickable` point.name = `${element.id}_clickable`