calc
This commit is contained in:
parent
c472787c8f
commit
976686593f
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { AdditiveBlending, FrontSide, RepeatWrapping } from 'three';
|
import { AdditiveBlending, CanvasTexture, FrontSide, RepeatWrapping } from 'three';
|
||||||
import { TresCanvas, useTexture } from '@tresjs/core'
|
import { TresCanvas, useTexture } from '@tresjs/core'
|
||||||
import { OrbitControls, Environment, useGLTF } from '@tresjs/cientos'
|
import { OrbitControls, Environment, useGLTF } from '@tresjs/cientos'
|
||||||
|
|
||||||
|
@ -65,9 +65,28 @@ const loadAll = async () => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const camera = ref("camera")
|
const camera = ref("camera")
|
||||||
|
const test_texture = reactive({
|
||||||
|
color: 0xff00ff,
|
||||||
|
transparent: true,
|
||||||
|
opacity: 1
|
||||||
|
})
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
cameraStat.aspect = window.innerWidth / (window.innerHeight * 0.5)
|
cameraStat.aspect = window.innerWidth / (window.innerHeight * 0.5)
|
||||||
loadAll()
|
loadAll()
|
||||||
|
const canvas = document.createElement('canvas')
|
||||||
|
const ctx = canvas.getContext('2d') as CanvasRenderingContext2D;
|
||||||
|
canvas.width = 64;
|
||||||
|
canvas.height = 64;
|
||||||
|
// drawing gray scale areas
|
||||||
|
ctx.fillStyle = '#404040';
|
||||||
|
ctx.fillRect(0, 0, 32, 32);
|
||||||
|
ctx.fillStyle = '#808080';
|
||||||
|
ctx.fillRect(32, 0, 32, 32);
|
||||||
|
ctx.fillStyle = '#c0c0c0';
|
||||||
|
ctx.fillRect(0, 32, 32, 32);
|
||||||
|
ctx.fillStyle = '#f0f0f0';
|
||||||
|
ctx.fillRect(32, 32, 32, 32);
|
||||||
|
test_texture.alphaMap = new CanvasTexture(canvas);
|
||||||
})
|
})
|
||||||
watch(section_count, () => {
|
watch(section_count, () => {
|
||||||
let v = (section_count.value + ~~(!!extra_section.value)) * 1.5
|
let v = (section_count.value + ~~(!!extra_section.value)) * 1.5
|
||||||
|
@ -93,6 +112,11 @@ watch(section_count, () => {
|
||||||
<TresCircleGeometry :args="[50, 32]" :rotate-x="-Math.PI * 0.5" />
|
<TresCircleGeometry :args="[50, 32]" :rotate-x="-Math.PI * 0.5" />
|
||||||
<TresMeshStandardMaterial v-bind="groundMaterial" />
|
<TresMeshStandardMaterial v-bind="groundMaterial" />
|
||||||
</TresMesh>
|
</TresMesh>
|
||||||
|
|
||||||
|
<TresMesh>
|
||||||
|
<TresBoxGeometry />
|
||||||
|
<TresMeshBasicMaterial v-bind="test_texture" />
|
||||||
|
</TresMesh>
|
||||||
<template v-if="pointLight">
|
<template v-if="pointLight">
|
||||||
<TresPointLight v-bind="pointLight" :intensity="pointLight.intensity * 0.5"
|
<TresPointLight v-bind="pointLight" :intensity="pointLight.intensity * 0.5"
|
||||||
:position="Object.values(pointLight.position).map((el: any) => el * 3)" cast-shadow />
|
:position="Object.values(pointLight.position).map((el: any) => el * 3)" cast-shadow />
|
||||||
|
|
|
@ -91,23 +91,23 @@ const roubleSign = new Intl.NumberFormat('ru-RU', {
|
||||||
style: 'currency',
|
style: 'currency',
|
||||||
currency: 'RUB',
|
currency: 'RUB',
|
||||||
});
|
});
|
||||||
const { mortgage, pillar, lamella, rivets, bar, guide } = calculatorData.value
|
|
||||||
const pillar_count = (section_count.value + 1)
|
|
||||||
const pil = (parseFloat(mortgage) + parseFloat(pillar)) * pillar_count
|
|
||||||
|
|
||||||
const length = fence_section.value
|
|
||||||
|
|
||||||
const lam_count = lamelles_count.value * section_count.value
|
|
||||||
const lam = (lam_count * length * parseFloat(lamella)) + parseFloat(rivets)
|
|
||||||
|
|
||||||
const top_count = section_count.value
|
|
||||||
const top = top_count * lamella
|
|
||||||
|
|
||||||
const guides_count = section_count.value * 2
|
|
||||||
const guides = guides_count * parseFloat(guide) * lam_count * 0.115
|
|
||||||
|
|
||||||
const total = (!remove_pillar.value ? pil : 0) + lam + guides + top
|
|
||||||
const total_txt = computed(() => {
|
const total_txt = computed(() => {
|
||||||
|
const { mortgage, pillar, lamella, rivets, bar, guide } = calculatorData.value
|
||||||
|
const pillar_count = (section_count.value + 1)
|
||||||
|
const pil = (parseFloat(mortgage) + parseFloat(pillar)) * pillar_count
|
||||||
|
|
||||||
|
const length = fence_section.value
|
||||||
|
|
||||||
|
const lam_count = lamelles_count.value * section_count.value
|
||||||
|
const lam = (lam_count * length * parseFloat(lamella)) + parseFloat(rivets)
|
||||||
|
|
||||||
|
const top_count = section_count.value
|
||||||
|
const top = top_count * lamella
|
||||||
|
|
||||||
|
const guides_count = section_count.value * 2
|
||||||
|
const guides = guides_count * parseFloat(guide) * lam_count * 0.115
|
||||||
|
|
||||||
|
const total = (!remove_pillar.value ? pil : 0) + lam + guides + top
|
||||||
return [
|
return [
|
||||||
!remove_pillar.value && `Столб, ${pillar_count}: (${parseFloat(mortgage)} + ${parseFloat(pillar)}) x ${pillar_count} = ${roubleSign.format(pil)}`,
|
!remove_pillar.value && `Столб, ${pillar_count}: (${parseFloat(mortgage)} + ${parseFloat(pillar)}) x ${pillar_count} = ${roubleSign.format(pil)}`,
|
||||||
`Ламели, ${lam_count}: (${lam_count} x ${length} x ${lamella}) + ${rivets} = ${roubleSign.format(lam)}`,
|
`Ламели, ${lam_count}: (${lam_count} x ${length} x ${lamella}) + ${rivets} = ${roubleSign.format(lam)}`,
|
||||||
|
@ -127,7 +127,7 @@ const total_txt = computed(() => {
|
||||||
<input type="text" placeholder="Ваше имя" v-model="modal_data.name" @keyup="validate" />
|
<input type="text" placeholder="Ваше имя" v-model="modal_data.name" @keyup="validate" />
|
||||||
<input type="phone" placeholder="Номер телефона или e-mail" v-model="modal_data.phone"
|
<input type="phone" placeholder="Номер телефона или e-mail" v-model="modal_data.phone"
|
||||||
@keypress="validateInput" @keyup="validate" />
|
@keypress="validateInput" @keyup="validate" />
|
||||||
Итого: {{ roubleSign.format(total) }}
|
{{ total_txt[total_txt.length - 1] }}
|
||||||
<div class="flex gap-4">
|
<div class="flex gap-4">
|
||||||
<button class="not-prose" :disabled="modal_form.disabled" type="submit">Отправить</button>
|
<button class="not-prose" :disabled="modal_form.disabled" type="submit">Отправить</button>
|
||||||
<button class="not-prose" type="reset" @click="toggleModal">Отмена</button>
|
<button class="not-prose" type="reset" @click="toggleModal">Отмена</button>
|
||||||
|
|
|
@ -22,6 +22,8 @@ box.getSize(size)
|
||||||
const getMaterial = async () => {
|
const getMaterial = async () => {
|
||||||
return new MeshStandardMaterial({
|
return new MeshStandardMaterial({
|
||||||
color: new Color(props.color || '#9c9c9c'),
|
color: new Color(props.color || '#9c9c9c'),
|
||||||
|
transparent: true,
|
||||||
|
opacity:1,
|
||||||
roughness: 0.3,
|
roughness: 0.3,
|
||||||
metalness: 0.3
|
metalness: 0.3
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue