Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: decal (WIP) #577

Open
wants to merge 36 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
2814365
feat(cientos): Add first version Decal component
damienmontastier Mar 7, 2024
66e4403
Merge branch 'Tresjs:main' into feature/282-add-decal-component
damienmontastier Mar 7, 2024
5154631
feat(cientos): Add first version Decal component console.log
damienmontastier Mar 7, 2024
224d9df
feat(cientos/decal): pre-alpha with corrections
damienmontastier Mar 10, 2024
f7865fd
feat(cientos/decal): add logos, datas json, reorder
damienmontastier Mar 10, 2024
34fa040
feat(cientos/decal): clean up
damienmontastier Mar 11, 2024
672ba67
feat(cientos/decal): clean up v2
damienmontastier Mar 11, 2024
1c67ff5
feat(cientos/decal): clean up, start writing documenation
damienmontastier Mar 12, 2024
690894c
feat(cientos/decal): writing documenation and examples
damienmontastier Mar 12, 2024
64c5a45
feat(cientos/decal): little test
damienmontastier Mar 12, 2024
5f74e76
update
damienmontastier Dec 14, 2024
6ac2810
wip decal debug
damienmontastier Dec 18, 2024
075c61e
wip debug
damienmontastier Dec 18, 2024
0bc13f8
wip debug
damienmontastier Dec 19, 2024
930ca96
wip debug
damienmontastier Dec 21, 2024
2b16a10
wip debug
damienmontastier Dec 21, 2024
aef6f45
wip debug
damienmontastier Dec 21, 2024
ae9ac2a
first version
damienmontastier Dec 21, 2024
8322071
first version
damienmontastier Dec 21, 2024
3ef9aeb
lint index decal
damienmontastier Dec 21, 2024
29d29d5
importDecals from export
damienmontastier Dec 21, 2024
c763288
importDecals from export
damienmontastier Dec 21, 2024
e39b300
fix some issue, add utils file
damienmontastier Dec 21, 2024
0760662
wip ts
damienmontastier Dec 30, 2024
6af05f3
Merge branch 'main' into feature/282-add-decal-component
damienmontastier Dec 30, 2024
cdce104
wip lint fix
damienmontastier Dec 30, 2024
70aee8b
fix eslint and array decals
damienmontastier Dec 30, 2024
8001924
fix eslint and array decals
damienmontastier Dec 30, 2024
cd0f160
fix eslint/ts
damienmontastier Jan 2, 2025
1b7eda9
Merge branch 'main' into feature/282-add-decal-component
damienmontastier Jan 2, 2025
67b6f40
fix eslint/ts
damienmontastier Jan 2, 2025
e573eec
fix eslint/ts
damienmontastier Jan 2, 2025
33aee9c
wip documentation
damienmontastier Jan 3, 2025
b85391e
merge
damienmontastier Jan 24, 2025
5db0c4b
merge main
damienmontastier Feb 13, 2025
260ba1b
add resizer component for debug, test with html abstraction
damienmontastier Feb 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat(cientos): Add first version Decal component
damienmontastier committed Mar 7, 2024
commit 2814365a9b7861f055ae948432113fb317c07210
Binary file added playground/public/decal/LeePerrySmith.glb
Binary file not shown.
Binary file added playground/public/decal/nuxtjs-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added playground/public/decal/vuejs-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
87 changes: 87 additions & 0 deletions playground/src/pages/abstractions/Decal.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<script setup lang="ts">
import { TresCanvas, useTexture } from '@tresjs/core'
import { OrbitControls, Dodecahedron, Tetrahedron, Decal, Sphere, Torus, Cone, Box, GLTFModel, useGLTF } from '@tresjs/cientos'
import { BasicShadowMap, SRGBColorSpace, NoToneMapping, Vector3, Euler } from 'three'
import { shallowRef, shallowReactive } from 'vue'
import { TresLeches, useControls } from '@tresjs/leches'
import '@tresjs/leches/styles'

const gl = {
clearColor: '#82DBC5',
shadows: true,
alpha: false,
shadowMapType: BasicShadowMap,
outputColorSpace: SRGBColorSpace,
toneMapping: NoToneMapping,
}

const modelRef = shallowRef(null);

const texture = await useTexture(['/decal/vuejs-logo.png'])
const texturebis = await useTexture(['/decal/nuxtjs-logo.png'])
const model = await useGLTF('/decal/LeePerrySmith.glb')

modelRef.value = model.nodes.LeePerrySmith
// console.log(model)
// console.log(modelRef.value)

useControls({})

</script>

<template>
<TresLeches />

<TresCanvas v-bind="gl">
<TresPerspectiveCamera :position="[35, 11, 70]" />
<OrbitControls :enable-damping="true" make-default />

<!--
<Dodecahedron :args="[10, 0]" :position="[10, 0, -0]">
<TresMeshNormalMaterial wireframe />
<Decal :map="texture" debug :scale="new Vector3(5, 5, 5)" />
<Decal :map="texture" :rotation="new Euler(-1.017222013725818, 0, 0)" :position="new Vector3(-2.930609056916019,
3.947917618871017, 7.530507562733906)" :scale="new Vector3(3, 3, 3)" />
</Dodecahedron> -->

<Suspense>
<TresMesh :position="[50, 0, -0]" :scale="[6, 6, 6]" :geometry="modelRef.geometry">
<TresMeshNormalMaterial />
<Decal :map="texture" debug :scale="[5, 5, 5]" />
</TresMesh>
</Suspense>

<Suspense>
<TresMesh :position="[-10, 0, -0]" :scale="[6, 6, 6]" :geometry="modelRef.geometry">
<TresMeshNormalMaterial />
<Decal :map="texture" :rotation="new Euler(-0.21887339457828184, 1.1551680262780277, 0.2007578384863383)"
:position="[-2.0693223613820395, 16.600586851315583, 4.175786740084341]" :scale="[5, 5, 5]" />
</TresMesh>
</Suspense>

<!-- <Sphere :position="[-10, 0, -0]" :args="[10, 32, 16]">
<TresMeshNormalMaterial />
<Decal :map="texture" debug :scale="new Vector3(10, 10, 10)" />
</Sphere> -->

<!-- <Torus :args="[10, 3, 16, 80]" :position="[-15, 0, -20]">
<TresMeshNormalMaterial />
<Decal :map="texture" debug :scale="new Vector3(3, 3, 3)" />
</Torus> -->

<!-- <Cone :args="[10, 2, 8]" :position="[20, 0, 20]">
<TresMeshNormalMaterial />
<Decal :map="texture" debug :scale="new Vector3(5, 5, 5)" />
</Cone> -->

<!-- <Box :args="[10, 10, 10]" :position="[30, 0, -20]">
<TresMeshNormalMaterial />
<Decal :map="texture" debug :scale="new Vector3(5, 5, 5)" />
</Box> -->

<!-- <TresGridHelper :args="[100, 100]" /> -->
<TresAmbientLight :intensity="1" />

<TresSpotLight :decay="0" :position="[10, 10, 10]" :angle="0.15" />
</TresCanvas>
</template>
5 changes: 5 additions & 0 deletions playground/src/router/routes/abstractions.ts
Original file line number Diff line number Diff line change
@@ -49,4 +49,9 @@ export const abstractionsRoutes = [
name: 'Sampler',
component: () => import('../../pages/abstractions/Sampler.vue'),
},
{
path: '/abstractions/decal',
name: 'Decal',
component: () => import('../../pages/abstractions/Decal.vue'),
},
]
Loading