fix fence calc
This commit is contained in:
parent
9f29161981
commit
0102392b3a
|
@ -13,7 +13,7 @@ if (props.modelUrl) {
|
||||||
scene.receiveShadow = true
|
scene.receiveShadow = true
|
||||||
scene.castShadow = true
|
scene.castShadow = true
|
||||||
|
|
||||||
const target = ref(props.target ? new Vector3(...props.target) : new Vector3(0, 0, 0))
|
const target = ref(props.target ? new Vector3(...props.target) : null)
|
||||||
|
|
||||||
function shadows_and_pos(scene: any) {
|
function shadows_and_pos(scene: any) {
|
||||||
scene.children.forEach((el: any) => {
|
scene.children.forEach((el: any) => {
|
||||||
|
@ -37,13 +37,15 @@ type vectorType = 'x' | 'y' | 'z';
|
||||||
onLoop(() => {
|
onLoop(() => {
|
||||||
if (model.value && target.value) {
|
if (model.value && target.value) {
|
||||||
axis.forEach(element => {
|
axis.forEach(element => {
|
||||||
const point = model.value.position[element.axis]
|
if(target.value) {
|
||||||
let step = stepbase * target.value[element.axis as vectorType]
|
const point = model.value.position[element.axis]
|
||||||
if (step !== 0) {
|
let step = stepbase * target.value[element.axis as vectorType]
|
||||||
if (Math.abs(point) >= Math.abs(target.value[element.axis as vectorType])) {
|
if (step !== 0) {
|
||||||
step = 0
|
if (Math.abs(point) >= Math.abs(target.value[element.axis as vectorType])) {
|
||||||
|
step = 0
|
||||||
|
}
|
||||||
|
model.value[element.func](step)
|
||||||
}
|
}
|
||||||
model.value[element.func](step)
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ watch(lamelle_color, () => {
|
||||||
items.forEach(element => {
|
items.forEach(element => {
|
||||||
set_material(element, getColorHexFromRal(lamelle_color.value))
|
set_material(element, getColorHexFromRal(lamelle_color.value))
|
||||||
});
|
});
|
||||||
|
set_material(lamelle, getColorHexFromRal(lamelle_color.value));
|
||||||
})
|
})
|
||||||
watch(pillar_color, () => {
|
watch(pillar_color, () => {
|
||||||
const items = [
|
const items = [
|
||||||
|
@ -47,6 +48,7 @@ watch(pillar_color, () => {
|
||||||
items.forEach(element => {
|
items.forEach(element => {
|
||||||
set_material(element, getColorHexFromRal(pillar_color.value))
|
set_material(element, getColorHexFromRal(pillar_color.value))
|
||||||
});
|
});
|
||||||
|
[top, fence, fastening].map((el: any) => { set_material(el, getColorHexFromRal(pillar_color.value)) })
|
||||||
})
|
})
|
||||||
watch([section_count, extra_section], () => {
|
watch([section_count, extra_section], () => {
|
||||||
const base = seek(scene.value, 'name', 'base')
|
const base = seek(scene.value, 'name', 'base')
|
||||||
|
@ -78,7 +80,7 @@ onMounted(() => {
|
||||||
<template v-for="i in (section_count + ~~(!!extra_section))">
|
<template v-for="i in (section_count + ~~(!!extra_section))">
|
||||||
<template v-if="i <= max_size">
|
<template v-if="i <= max_size">
|
||||||
<ModelFence :index="i"
|
<ModelFence :index="i"
|
||||||
:models="{ top: top.clone(), fence: fence.clone(), fastening: fastening.clone(), lamelle }" />
|
:models="{ top, fence, fastening, lamelle }" />
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</TresGroup>
|
</TresGroup>
|
||||||
|
|
|
@ -3,14 +3,16 @@ import type { ralTypes } from '@/components/ral'
|
||||||
export const predefPillarColors = ['3004', '7043', '6028', '5013', '8016', '1020', '3005', '4009']
|
export const predefPillarColors = ['3004', '7043', '6028', '5013', '8016', '1020', '3005', '4009']
|
||||||
export const predefLamelleColors = ['3009', '9003', '6027', '5024', '9001', '1012', '3007', '4007']
|
export const predefLamelleColors = ['3009', '9003', '6027', '5024', '9001', '1012', '3007', '4007']
|
||||||
|
|
||||||
|
const n = 2
|
||||||
|
const min = 1300
|
||||||
export const use_lamelles_count = () => useState('lamelles_count', () => 14)
|
export const use_lamelles_count = () => useState('lamelles_count', () => 14)
|
||||||
export const use_fence_section = () => useState<number>('fence_section', () => 1000 * 0.001)
|
export const use_fence_section = () => useState<number>('fence_section', () => min * 0.001)
|
||||||
export const use_remove_pillar = () => useState<boolean>('remove_pillar', () => false)
|
export const use_remove_pillar = () => useState<boolean>('remove_pillar', () => false)
|
||||||
export const use_pillar_color = () => useState<ralTypes>('pillar_color', () => predefPillarColors[Math.floor(Math.random() * predefPillarColors.length)] as ralTypes)
|
export const use_pillar_color = () => useState<ralTypes>('pillar_color', () => predefPillarColors[Math.floor(Math.random() * predefPillarColors.length)] as ralTypes)
|
||||||
export const use_lamelle_color = () => useState<ralTypes>('lamelle_color', () => predefLamelleColors[Math.floor(Math.random() * predefLamelleColors.length)] as ralTypes)
|
export const use_lamelle_color = () => useState<ralTypes>('lamelle_color', () => predefLamelleColors[Math.floor(Math.random() * predefLamelleColors.length)] as ralTypes)
|
||||||
export const use_section_count = () => useState('section_count', () => 5)
|
export const use_section_count = () => useState('section_count', () => n)
|
||||||
export const use_extra_section = () => useState('extra_section', () => 0)
|
export const use_extra_section = () => useState('extra_section', () => 0)
|
||||||
export const use_total_length = () => useState('total_length', () => (1000 * 5 - 100) * 0.001)
|
export const use_total_length = () => useState('total_length', () => ((min * n) - 100) * 0.001)
|
||||||
export const use_min_length = () => useState('min_length', () => 1000)
|
export const use_min_length = () => useState('min_length', () => 1000)
|
||||||
export const use_max_size = () => useState<number>('max_size', () => 13)
|
export const use_max_size = () => useState<number>('max_size', () => 13)
|
||||||
export const use_explosion_state = () => useState<boolean>('explosion_state', () => false)
|
export const use_explosion_state = () => useState<boolean>('explosion_state', () => false)
|
Loading…
Reference in New Issue