diff --git a/assets/main.scss b/assets/main.scss
index 23f3939..0319c38 100644
--- a/assets/main.scss
+++ b/assets/main.scss
@@ -345,8 +345,10 @@ button {
&_checkbox {
@apply w-full xl:w-auto flex-row xl:flex-initial flex-nowrap gap-4;
}
+
&_color {
@apply w-full;
+
.color_picker {
@apply ml-4;
}
@@ -374,6 +376,34 @@ button {
}
}
+.list_picker {
+ @apply leading-none;
+
+ &-selected {
+ @apply size-10 rounded border-gray-300 shadow inline-block leading-none;
+
+ &__active {
+ @apply outline outline-2 outline-offset-2 outline-primary;
+ }
+ }
+
+ &-changer {
+ @apply absolute w-80 z-20 p-4 border rounded bg-white flex gap-0 right-0;
+ }
+
+ &-list {
+ @apply flex gap-4 w-full;
+ }
+
+ &-item {
+ @apply w-10 h-10;
+ &--empty {
+ @apply block bg-slate-300;
+ }
+ }
+
+}
+
.feature {
@apply col-span-full flex gap-10 mt-4 justify-center xl:justify-between flex-wrap items-center;
diff --git a/components/calcModels.vue b/components/calc/models.vue
similarity index 100%
rename from components/calcModels.vue
rename to components/calc/models.vue
diff --git a/components/calcValues.vue b/components/calc/values.vue
similarity index 92%
rename from components/calcValues.vue
rename to components/calc/values.vue
index e4b39cb..ad27f40 100644
--- a/components/calcValues.vue
+++ b/components/calc/values.vue
@@ -1,15 +1,16 @@
+
+
+
\ No newline at end of file
diff --git a/components/model/parametric.vue b/components/model/parametric.vue
index 2436b50..6aa58f6 100644
--- a/components/model/parametric.vue
+++ b/components/model/parametric.vue
@@ -13,8 +13,10 @@ import { GainMapLoader, } from '@monogrid/gainmap-js'
//@ts-ignore
import { useGLTF, } from '@tresjs/cientos'
import { getColorHexFromRal, type ralTypes } from '../ral';
+import { getFilename } from '../pattern';
const pillar_color = use_pillar_color()
+const pillar_pattern = use_pattern()
const lamelle_color = use_lamelle_color()
const section_count = use_section_count()
const lamelle_count = use_lamelles_count()
@@ -76,8 +78,6 @@ watch(lamelle_color, () => {
watch(pillar_color, () => {
[top, fastening, fence, fence_bottom, fence_top].map(
(el: Ref) => { set_material(el.value, getColorHexFromRal(pillar_color.value)) });
- [fence_inner].map(
- (el: Ref) => { set_material(el.value, getColorHexFromRal(pillar_color.value), lamelle_count.value) });
const items = [
...seekAll(scene.value, 'name', "pillar_one"),
@@ -90,6 +90,15 @@ watch(pillar_color, () => {
set_material(element, getColorHexFromRal(pillar_color.value))
})
})
+watch([pillar_color, pillar_pattern], () => {
+ [fence_inner].map(
+ (el: Ref) => {
+ set_material(el.value, getColorHexFromRal(pillar_color.value), {
+ pattern: pillar_pattern.value,
+ count: lamelle_count.value
+ })
+ });
+})
const total = ref((section_count.value + ~~(!!extra_section.value)))
const size = ref(Math.ceil(total.value / 4))
@@ -154,8 +163,8 @@ onMounted(async () => {
-
+
\ No newline at end of file
diff --git a/components/pattern.ts b/components/pattern.ts
new file mode 100644
index 0000000..6b6c070
--- /dev/null
+++ b/components/pattern.ts
@@ -0,0 +1,10 @@
+export const patterns = [
+ { name: 'no pattern', },
+ { name: 'pattern1', filename: 'tile1.png' },
+ { name: 'pattern2', filename: 'tile1.png' },
+]
+export const getFilename = (name: patternTypes) => {
+ return `/pattern/${patterns.find(el => el.name == name)?.filename}`
+}
+
+export type patternTypes = typeof patterns[number]['name']
\ No newline at end of file
diff --git a/components/plural.vue b/components/plural.vue
deleted file mode 100644
index aa5a8c1..0000000
--- a/components/plural.vue
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
- {{ props.forms[ruOrdinalRules.select(props.n)] }}
-
\ No newline at end of file
diff --git a/composables/useCalc.ts b/composables/useCalc.ts
index 1ccd5f5..0af1e4c 100644
--- a/composables/useCalc.ts
+++ b/composables/useCalc.ts
@@ -1,4 +1,5 @@
import type { ralTypes } from '@/components/ral'
+import { type patternTypes } from '~/components/pattern'
export const predefPillarColors = ['3004', '7043', '6028', '5013', '8016', '1020', '3005', '4009']
export const predefLamelleColors = ['3009', '9003', '6027', '5024', '9001', '1012', '3007', '4007']
@@ -12,6 +13,7 @@ export const use_fence_section = () => useState('fence_section', () => m
export const use_remove_pillar = () => useState('remove_pillar', () => false)
export const use_pillar_color = () => useState('pillar_color')
export const use_lamelle_color = () => useState('lamelle_color')
+export const use_pattern = () => useState('pattern')
export const use_section_count = () => useState('section_count', () => n)
export const use_extra_section = () => useState('extra_section', () => 0)
export const use_total_length = () => useState('total_length', () => (((min + 104) * n) + 104) * 0.001)
diff --git a/public/fence_one/svg_tile1.svg b/public/pattern/svg_tile1.svg
similarity index 100%
rename from public/fence_one/svg_tile1.svg
rename to public/pattern/svg_tile1.svg
diff --git a/public/fence_one/tile1.png b/public/pattern/tile1.png
similarity index 100%
rename from public/fence_one/tile1.png
rename to public/pattern/tile1.png
diff --git a/utils/material.ts b/utils/material.ts
index b3fddc9..cd9ce2d 100644
--- a/utils/material.ts
+++ b/utils/material.ts
@@ -1,5 +1,6 @@
import { Color, DoubleSide, MeshBasicMaterial, MeshStandardMaterial, RepeatWrapping, TextureLoader, Vector2 } from "three"
import { useLoader, type TresLoader } from '@tresjs/core'
+import { getFilename, type patternTypes } from "~/components/pattern"
const set_metaril_func = (scene: any, material: any) => {
scene.children.forEach((el: any) => {
@@ -19,22 +20,30 @@ const set_metaril_func = (scene: any, material: any) => {
// const texture = await get_texture()
// texture.wrapT = RepeatWrapping;
-export const set_material = (scene: any, color: any, count: number | undefined = undefined) => {
+export const set_material = (scene: any, color: any, pattern: { pattern: patternTypes, count: number } | undefined = undefined) => {
let c = color
- // if (count) {
- // // console.log(texture)
- // texture.repeat.set(1, count);
- // texture.needsUpdate = true
- // }
const material = new MeshStandardMaterial({
color: new Color(c || '#9c9c00'),
- // alphaMap: count ? texture : null,
+ // alphaMap: pattern ? texture : null,
transparent: true,
opacity: 1,
roughness: 0.2,
metalness: 0,
side: DoubleSide,
})
+
+ if (pattern && pattern.pattern !== undefined) {
+ const filename = getFilename(pattern.pattern)
+ const texture = useLoader(TextureLoader, filename)
+ texture.then(res => {
+ res.wrapT = RepeatWrapping;
+ res.repeat.set(1, pattern.count);
+ res.needsUpdate = true
+ // return res
+ material.alphaMap = res
+ })
+ }
+
set_metaril_func(scene, material)
}
\ No newline at end of file