Skip to content

Commit cf2aa5d

Browse files
feat(cientos): initial test implementation of the new component with debug setup
1 parent 89659bf commit cf2aa5d

9 files changed

Lines changed: 1439 additions & 0 deletions

File tree

905 Bytes
Loading
7.87 KB
Loading
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<script setup lang="ts">
2+
import { TresCanvas } from '@tresjs/core'
3+
import { Box, Decal,DecalDebugUI, OrbitControls } from '@tresjs/cientos'
4+
import { TresLeches, useControls } from '@tresjs/leches'
5+
import { useTexture } from '@tresjs/cientos'
6+
import { SRGBColorSpace } from 'three'
7+
8+
const gl = {
9+
clearColor: '#F6B03B',
10+
}
11+
12+
const { enabled, edgeColor, edgeThreshold } = useControls({
13+
enabled: { value: true, type: 'boolean', label: 'Enabled' },
14+
edgeColor: { value: '#292929', type: 'color', label: 'Color' },
15+
edgeThreshold: {
16+
label: 'Threshold Angle',
17+
value: 15,
18+
min: 1,
19+
max: 100,
20+
step: 1,
21+
},
22+
})
23+
24+
const { state: texture } = useTexture('/decal/tresjs-dark.png')
25+
const { state: textureVue } = useTexture('/decal/vue.png')
26+
27+
watch(texture, () => {
28+
if(!texture.value?.image) return
29+
30+
texture.value.colorSpace = SRGBColorSpace
31+
})
32+
33+
</script>
34+
35+
<template>
36+
<TresLeches />
37+
38+
<DecalDebugUI />
39+
40+
<TresCanvas
41+
v-bind="gl"
42+
>
43+
<TresPerspectiveCamera
44+
:position="[0, 2, 8]"
45+
/>
46+
47+
<OrbitControls
48+
make-default
49+
/>
50+
51+
<TresGridHelper
52+
:args="[10, 10]"
53+
:position-y="-.5"
54+
/>
55+
56+
<TresMesh :scale="2" :position-x="-2">
57+
<TresBoxGeometry />
58+
<TresMeshBasicMaterial color="#f6f6f6" />
59+
<Decal
60+
:map="textureVue"
61+
debug
62+
>
63+
</Decal>
64+
</TresMesh>
65+
66+
<TresMesh :scale="2" :position-x="2">
67+
<TresBoxGeometry />
68+
<TresMeshBasicMaterial color="#f6f6f6" />
69+
<Decal
70+
:map="texture"
71+
debug
72+
>
73+
</Decal>
74+
</TresMesh>
75+
76+
</TresCanvas>
77+
</template>

‎packages/cientos/playground/vue/src/router/routes/abstractions.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ export const abstractionsRoutes = [
5454
name: 'Edges',
5555
component: () => import('../../pages/abstractions/EdgesDemo.vue'),
5656
},
57+
{
58+
path: '/abstractions/decal',
59+
name: 'Decal',
60+
component: () => import('../../pages/abstractions/DecalDemo.vue'),
61+
},
5762
{
5863
path: '/abstractions/positional-audio',
5964
name: 'PositionalAudio',

0 commit comments

Comments
 (0)