dev #90

Merged
ksenia_mikhailova merged 20 commits from dev into main 2025-03-20 14:15:19 +03:00
5 changed files with 29 additions and 10 deletions
Showing only changes of commit d10e3392e7 - Show all commits

View File

@ -1,5 +1,5 @@
<script setup lang="ts">
import { BufferGeometry, Matrix4, Mesh, Object3D, Vector3 } from 'three';
import { BufferGeometry, Group, Matrix4, Mesh, Object3D, Vector3 } from 'three';
import { getColorHexFromRal } from '../ral';
const props = defineProps(['index', 'models', 'last_element', 'first_element'])
@ -129,19 +129,38 @@ const setBraceCount = () => {
setBraceCount()
watch(lamelles_count, setBraceCount)
const calculateAddScale = (model: Mesh, k = 1): number => {
if (!model.geometry.boundingBox) {
model.geometry.computeBoundingBox(); // Вычисляем boundingBox, если он не был вычислен ранее
}
const boundingBoxHeight = Math.abs(
model.geometry.boundingBox!.max.y - model.geometry.boundingBox!.min.y
);
if (boundingBoxHeight === 0) {
console.warn('Bounding box height is zero. Returning default scale of 1.');
return 1; // Возвращаем 1 при делении на ноль
}
return (lamelle_height.value * k) / boundingBoxHeight;
};
const pillar = ref<Mesh[]>([])
const setPillar = () => {
const top = props.models.pillar_top.children[0];
top.position.setComponent(1, lamelle_height.value * lamelles_count.value + lamelles_count.value * 0.0001 * scale_koef);
top.position.setComponent(1, lamelle_height.value * lamelles_count.value * scale_koef);
const pillar_outer = props.models.pillar_center.children[0];
pillar_outer.scale.setComponent(1, lamelles_count.value);
pillar_outer.scale.setComponent(1, lamelles_count.value * calculateAddScale(pillar_outer));
const pillar_inner = props.models.pillar_inner.children[0];
pillar_inner.scale.setComponent(1, lamelles_count.value);
pillar_inner.scale.setComponent(1, lamelles_count.value * calculateAddScale(pillar_inner));
const bottom = props.models.pillar_bottom.children[0];
bottom.position.setComponent(1, lamelle_height.value * -0.5);
const bottomHeight = Math.abs(bottom.geometry.boundingBox.max.y - bottom.geometry.boundingBox.min.y)
bottom.position.setComponent(1, bottomHeight * -1);
let arr = [top, pillar_outer, pillar_inner, bottom]
arr.map(el => {
@ -186,12 +205,11 @@ const setFastening = () => {
const side_one = props.models.fastening_side.clone().children[0];
side_one.name = 'side_one'
side_one.position.set(pillar_one_pos.value, 0, 0.002 * scale_koef);
side_one.scale.set(1, lamelles_count.value, 1)
console.log(side_one)
side_one.scale.set(1, lamelles_count.value * calculateAddScale(side_one), 1)
const side_two = props.models.fastening_side.clone().children[0];
side_two.name = 'side_two'
side_two.scale.set(-1, lamelles_count.value, -1)
side_two.scale.set(-1, lamelles_count.value * calculateAddScale(side_two), -1)
side_two.position.set(pillar_two_pos.value, 0, -0.005 * scale_koef);
let arr = [top_one, top_two, top, side_one, side_two];

View File

@ -105,7 +105,7 @@ const setTarget = (smooth = false) => {
goto_cam.value = new Vector3(f, f, f)
}
}
watch([lamelles_count, fence_section], () => {
watch([lamelles_count, fence_section, lamelle_height], () => {
setTarget()
open_calc.value = []
})

View File

@ -25,7 +25,8 @@ export default defineNuxtConfig({
],
runtimeConfig: {
public: {
apiBase: process.env.mode == 'DEVELOPMENT' ? "http://localhost:8000" : "https://mns.kustarshina.ru/kp",
// apiBase: process.env.mode == 'DEVELOPMENT' ? "http://localhost:8000" : "https://mns.kustarshina.ru/kp",
apiBase: process.env.mode == 'DEVELOPMENT' ? "http://mns.dev.kustarshina.ru/kp" : "https://mns.kustarshina.ru/kp",
imgBase: 'https://mns.kustarshina.ru',
baseUrl: '',
yandexMetrika: {

Binary file not shown.

Binary file not shown.