topper
Deploy / build_and_push_images (push) Successful in 1m20s Details
Deploy / deploy_to_server_dev (push) Successful in 40s Details

This commit is contained in:
Kseninia Mikhaylova 2024-09-30 10:16:02 +03:00
parent 3f31a2c8a0
commit 7d9792f279
5 changed files with 25 additions and 12 deletions

View File

@ -3,11 +3,15 @@ import { getFilename as getPattern, patterns } from '../pattern';
import { getFilename as getTopper, toppers } from '../topper'; import { getFilename as getTopper, toppers } from '../topper';
const props = defineProps(['cb', 'patterns']); const props = defineProps(['cb', 'patterns']);
type pType = {
const p = { list: typeof patterns | typeof toppers,
list: undefined, func: any
func: undefined
} }
const p = {
list: [],
func: () => { }
} as pType
if (props.patterns == 'pattern') { if (props.patterns == 'pattern') {
p.list = patterns; p.list = patterns;
p.func = getPattern p.func = getPattern

View File

@ -132,6 +132,7 @@ watch(lamelles_count, setBraceCount)
const pillar = ref<Mesh[]>([]) const pillar = ref<Mesh[]>([])
const setPillar = () => { const setPillar = () => {
console.log(props.models.pillar_top)
const top = props.models.pillar_top.children[0]; const top = props.models.pillar_top.children[0];
top.position.setComponent(1, lSize * lamelles_count.value + lamelles_count.value * 0.0001 * scale_koef); top.position.setComponent(1, lSize * lamelles_count.value + lamelles_count.value * 0.0001 * scale_koef);
@ -156,7 +157,7 @@ const setPillar = () => {
pillar.value = arr.map(el => el.clone()) pillar.value = arr.map(el => el.clone())
} }
setPillar() setPillar()
watch([pillar_pattern, pillar_color, fence_section, lamelles_count], setPillar) watch([pillar_pattern, pillar_color, pillar_topper, fence_section, lamelles_count], setPillar)
const fastening = ref<Object3D[]>([]) const fastening = ref<Object3D[]>([])
const setFastening = () => { const setFastening = () => {

View File

@ -1,9 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { Vector3 } from 'three'; import { Object3D, Vector3 } from 'three';
//@ts-ignore //@ts-ignore
import { useGLTF, } from '@tresjs/cientos' import { useGLTF, } from '@tresjs/cientos'
import type { OrbitControlsProps } from '@tresjs/cientos/dist/core/controls/OrbitControls.vue.js'; import type { OrbitControlsProps } from '@tresjs/cientos/dist/core/controls/OrbitControls.vue.js';
import { getModel } from '../topper'; import { getModel, toppers, type toppersIds } from '../topper';
const section_count = use_section_count() const section_count = use_section_count()
const extra_section = use_extra_section() const extra_section = use_extra_section()
@ -20,7 +20,12 @@ const goto_target = use_goto_target()
const { scene, controls } = useTresContext() const { scene, controls } = useTresContext()
const { seek, seekAll } = useSeek() const { seek, seekAll } = useSeek()
const { scene: model_pillar_top } = await useGLTF(getModel(pillar_topper.value)) const topper_models = {} as {[key:toppersIds]:Object3D}
for await (const element of toppers) {
const { scene } = await useGLTF(getModel(element.id))
topper_models[element.id] = scene
}
const { scene: model_pillar_center } = await useGLTF('/models_one/pillar/center.glb') const { scene: model_pillar_center } = await useGLTF('/models_one/pillar/center.glb')
const { scene: model_pillar_bottom } = await useGLTF('/models_one/pillar/bottom.glb') const { scene: model_pillar_bottom } = await useGLTF('/models_one/pillar/bottom.glb')
const { scene: model_pillar_inner } = await useGLTF('/models_one/pillar/inner.glb') const { scene: model_pillar_inner } = await useGLTF('/models_one/pillar/inner.glb')
@ -34,8 +39,8 @@ const { scene: top_model } = await useGLTF('/models_one/top_100.glb', { draco: t
const { scene: lamelle_model } = await useGLTF('/models_one/lamel_100.glb', { draco: true }); const { scene: lamelle_model } = await useGLTF('/models_one/lamel_100.glb', { draco: true });
const top = ref(top_model) const top = ref(top_model)
const pillar_top = ref(topper_models[pillar_topper.value])
const pillar_center = ref(model_pillar_center) const pillar_center = ref(model_pillar_center)
const pillar_top = ref(model_pillar_top)
const pillar_bottom = ref(model_pillar_bottom) const pillar_bottom = ref(model_pillar_bottom)
const pillar_inner = ref(model_pillar_inner) const pillar_inner = ref(model_pillar_inner)
const pillar_brace = ref(model_pillar_brace) const pillar_brace = ref(model_pillar_brace)
@ -44,6 +49,10 @@ const fastening_side = ref(model_fastening_side)
const fixing = ref(model_fixing) const fixing = ref(model_fixing)
const lamelle = ref(lamelle_model) const lamelle = ref(lamelle_model)
watch(pillar_topper, async () => {
pillar_top.value = topper_models[pillar_topper.value]
})
const total = ref((section_count.value + ~~(!!extra_section.value))) const total = ref((section_count.value + ~~(!!extra_section.value)))
const size = ref(Math.ceil(total.value / 4)) const size = ref(Math.ceil(total.value / 4))
const count = ref((total.value >= 4) ? size.value : total.value) const count = ref((total.value >= 4) ? size.value : total.value)

View File

@ -1,8 +1,7 @@
export const toppers = [ export const toppers = [
{ name: 'Ровный', filename: 'icon_stolb_verh_1.svg', model: 'top' }, { name: 'Ровный', filename: 'icon_stolb_verh_3.svg', model: 'top' },
{ name: 'Вершина 1', filename: 'icon_stolb_verh_2.svg', model: 'decor1' }, { name: 'Вершина 1', filename: 'icon_stolb_verh_2.svg', model: 'decor1' },
{ name: 'Вершина 2', filename: 'icon_stolb_verh_3.svg', model: 'decor2' }, { name: 'Вершина 2', filename: 'icon_stolb_verh_1.svg', model: 'decor3' },
{ name: 'Вершина 3', filename: 'icon_stolb_verh_3.svg', model: 'decor3' },
].map((el, i) => Object.assign(el, { id: i })) ].map((el, i) => Object.assign(el, { id: i }))
export const getFilename = (id: toppersIds) => { export const getFilename = (id: toppersIds) => {