Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
d6ea81b
feat(AnimatedSprite): add AnimatedSprite, playground, docs
andretchen0 Dec 28, 2023
e7ff5a2
chore(AnimatedSprite): fix linter errors
andretchen0 Jan 11, 2024
c74c332
chore(AnimatedSprite): update docs
andretchen0 Jan 12, 2024
3309d9c
feat(AnimatedSprite): allow [numCols, numRows] as atlas prop
andretchen0 Jan 16, 2024
49380ee
docs(AnimatedSprite): reorder sections, improve clarity
andretchen0 Jan 16, 2024
c2bfd63
docs(AnimatedSprite): format type names
andretchen0 Jan 16, 2024
d4a7528
docs(AnimatedSprite): update no-atlas example to use [cols, rows]
andretchen0 Jan 16, 2024
823c8d7
chore(AnimatedSprite): run linter, remove console.log
andretchen0 Jan 16, 2024
3db5140
refactor(AnimatedSprite): create new animation frames if props.revers…
andretchen0 Jan 17, 2024
970c91b
docs(AtlasAnimationDefinitionParser): change 'delay' to 'duration'
andretchen0 Jan 23, 2024
fbda429
refactor(AtlasAnimationDefinitionParser): make parse function private…
andretchen0 Jan 23, 2024
612c9ba
refactor(AtlasAnimationDefinitionParser): use destructuring
andretchen0 Jan 23, 2024
4adc67a
refactor(AtlasAnimationDefinitionParser): use destructuring
andretchen0 Jan 23, 2024
8c586ad
refactor(AtlasAnimationDefinitionParser): rename returned value 'result'
andretchen0 Jan 23, 2024
db74f59
chore: run linter
andretchen0 Jan 23, 2024
0cb9788
refactor(AtlasAnimationDefinitionParser): rename private error loggin…
andretchen0 Jan 23, 2024
d45ae6d
refactor(Atlas): rename private functions
andretchen0 Jan 23, 2024
e6b147e
fix(Atlas): add missing argument to function call
andretchen0 Jan 23, 2024
9481afe
refactor(AnimatedSprite): merge FrameData types as single type
andretchen0 Jan 25, 2024
f2edc12
refactor(AnimatedSprite): change callbacks to emits
andretchen0 Jan 25, 2024
1adcc1a
chore(AnimatedSprite): run linter
andretchen0 Jan 25, 2024
6daa414
chore(AnimatedSprite): format Atlas error message
andretchen0 Jan 26, 2024
453819e
fix(AnimatedSprite): return nullFrame animation if requested animatio…
andretchen0 Jan 26, 2024
c8f96d7
refactor(AnimatedSprite): simplify component onLoop
andretchen0 Jan 26, 2024
2b71c80
chore(AnimatedSprite): run lint --fix
andretchen0 Jan 26, 2024
6264d13
refactor(AnimatedSprite): add Atlasish type
andretchen0 Jan 26, 2024
d560368
refactor(AnimatedSprite): remove onLoad prop
andretchen0 Jan 26, 2024
fed0f86
feat(app)!: 227 Change the keyboardcontrols implementation
JaimeTorrealba Jan 28, 2024
6a61810
docs(AnimatedSprite): update docs and demos
andretchen0 Jan 28, 2024
1467129
docs(AnimatedSprite): update playground demo
andretchen0 Jan 28, 2024
4e9dc33
refactor(AnimatedSprite): remove TresSprite
andretchen0 Jan 28, 2024
1967cf7
refactor(AnimatedSprite): rename prop, anchor -> center
andretchen0 Jan 29, 2024
e2ae548
refactor(AnimatedSprite): remove asSprite prop, improve clarity
andretchen0 Jan 30, 2024
0d6aa81
docs(AnimatedSprite): update docs
andretchen0 Jan 30, 2024
5bd8756
refactor(AnimatedSprite): update playground
andretchen0 Jan 30, 2024
b211f04
refactor(AnimatedSprite): rename 'page' -> 'atlas'
andretchen0 Jan 30, 2024
5f7a99c
refactor(AnimatedSprite): make definitions reactive
andretchen0 Jan 30, 2024
44831a4
feat(AnimatedSprite): change default fps
andretchen0 Jan 30, 2024
d48080d
docs(AnimatedSprite): mark props as 'not reactive'
andretchen0 Jan 30, 2024
ed16136
feat(AnimatedSprite): always emit last frame name on loop and on end
andretchen0 Jan 30, 2024
661d405
docs(AnimatedSprite): correct and update docs/demos
andretchen0 Jan 30, 2024
9f152c1
chore(AnimatedSprite): run linter
andretchen0 Jan 30, 2024
230621f
chore(AnimatedSprite): merge working branch
andretchen0 Jan 30, 2024
282d375
docs(AnimatedSprite): improve wording
andretchen0 Jan 30, 2024
39e2094
feat: add arrow keys support
JaimeTorrealba Feb 4, 2024
e815be8
refactor(AnimatedSprite): improve variable name
andretchen0 Feb 4, 2024
1f50e99
refactor(AnimatedSprite): use degrees instead of radians in example
andretchen0 Feb 4, 2024
574e3bd
chore(AnimatedSprite): fix linter errors
andretchen0 Feb 4, 2024
8fc4cd5
refactor(app)!: 349 Remove directives from cientos
JaimeTorrealba Feb 9, 2024
4de9f32
docs(app): 227 Add documentation for new KeyboardControls
JaimeTorrealba Feb 23, 2024
6f06213
feat(app): 227 Final details, ready to go
JaimeTorrealba Feb 23, 2024
7c74b93
refactor: move in the right position a piece of code
JaimeTorrealba Feb 27, 2024
021002e
chore: update core to `v4`
alvarosabu Mar 27, 2024
a291c57
chore: release v4.0.0-next.0
alvarosabu Mar 27, 2024
d591632
Merge pull request #339 from Tresjs/feature/227-improve-keyboardcontr…
JaimeTorrealba Apr 3, 2024
be60d9f
Merge pull request #351 from Tresjs/refactor/remove-directives
JaimeTorrealba Apr 3, 2024
58703e3
fix(MeshReflectionMaterial)!: add features/docs, reorganize
andretchen0 Apr 6, 2024
9dd2673
Merge branch 'v4' into feat/animated-sprite
andretchen0 Apr 7, 2024
7a14b55
feat(AnimatedSprite): add asSprite prop
andretchen0 Apr 7, 2024
18d6904
feat(AnimatedSprite): dispose texture onUnmounted
andretchen0 Apr 7, 2024
042c350
feat(AnimatedSprite): remove explicit click event
andretchen0 Apr 7, 2024
082d695
feat(AnimatedSprite): remove unnecessary Suspense
andretchen0 Apr 7, 2024
7d4b274
docs(AnimatedSprite): add asSprite control to demo
andretchen0 Apr 7, 2024
8418b48
docs(AnimatedSprite): update demo code line highlights
andretchen0 Apr 7, 2024
baa8617
docs(AnimatedSprite): update atlas path, image names
andretchen0 Apr 7, 2024
63170ec
Merge pull request #331 from Tresjs/feat/animated-sprite
andretchen0 Apr 10, 2024
6722b69
Merge pull request #377 from Tresjs/fix/mesh-reflection-material
andretchen0 Apr 16, 2024
7020271
refactor: defineExpose
andretchen0 Apr 29, 2024
1c4c569
refactor: change value.value -> value.instance in defineExpose
andretchen0 May 1, 2024
fac2253
fix: uncomment section
andretchen0 May 1, 2024
e48553e
refactor(app): 160 Add Global audio, stats, statsGl
JaimeTorrealba May 3, 2024
1ec19e5
refactor: remove extra semi-colon, lint issue
JaimeTorrealba May 3, 2024
661302c
Merge pull request #392 from Tresjs/refactor/defineExpose
JaimeTorrealba May 5, 2024
1c7a22c
Merge remote-tracking branch 'origin/main' into v4
JaimeTorrealba May 15, 2024
89b4724
chore: Fix Lint (console.logs should be disabled in playground)
JaimeTorrealba May 15, 2024
984b86c
chore: update lint
JaimeTorrealba May 15, 2024
dd5530c
chore: fix lints
JaimeTorrealba May 15, 2024
237763c
chore: fix demos
JaimeTorrealba May 15, 2024
8eaccf6
chore: fix lint
JaimeTorrealba May 15, 2024
24e9812
feat(app): 421 Adapt components to use useLoop instead of useRenderLoop
JaimeTorrealba May 16, 2024
ec12a13
Revert "feat(app): 421 Adapt components to use useLoop instead of use…
alvarosabu May 16, 2024
ad3b290
feat(app): 421 Update components to use useLoop instead of useRenderLoop
JaimeTorrealba May 16, 2024
b2e053d
chore: update statsGl y stats
JaimeTorrealba May 16, 2024
3c95d43
fix lint
JaimeTorrealba May 16, 2024
3d61e4f
chore: update useEnviroment
JaimeTorrealba May 21, 2024
75d4e26
chore: update fbo
JaimeTorrealba May 21, 2024
0ea4a22
chore: lint
JaimeTorrealba May 21, 2024
03a4409
Merge branch 'main' into fix/lint-problems-sky-hologram
JaimeTorrealba May 21, 2024
72284ce
feat: re-remove tweakpane (#425)
JaimeTorrealba May 21, 2024
f35c398
Merge remote-tracking branch 'origin/v4' into fix/lint-problems-sky-h…
JaimeTorrealba May 21, 2024
6794dfe
Merge pull request #426 from Tresjs/fix/lint-problems-sky-hologram
JaimeTorrealba May 21, 2024
e1fa06f
docs: update enviroment and useEnviroment docs
JaimeTorrealba May 23, 2024
e67f3a2
fix: remove hardcoded speed number, that setting at 0 doesn't stop th…
JaimeTorrealba May 27, 2024
c5802f4
Merge remote-tracking branch 'origin/v4' into feature/421-adapt-abstr…
JaimeTorrealba May 27, 2024
c93e013
update lock
JaimeTorrealba May 27, 2024
f8c0619
Merge pull request #422 from Tresjs/feature/421-adapt-abstractions-to…
JaimeTorrealba May 27, 2024
43b0648
Merge pull request #427 from Tresjs/docs/update-enviroment-docs
JaimeTorrealba May 27, 2024
befe2fc
chore: add Cylinder to v4 (#439)
andretchen0 Jun 10, 2024
981de57
fix(Lensflare demo): add camera #435 (#441)
andretchen0 Jun 21, 2024
14b30f9
feat: update to core v4.2
alvarosabu Jul 14, 2024
e8b1bec
chore(ci): update node version to 20 for linting
alvarosabu Jul 14, 2024
b79492c
chore: fix lints
alvarosabu Jul 14, 2024
b3eef40
feat: 423 enable on demand render mode usage (#436)
alvarosabu Jul 15, 2024
57ba9ae
docs: add migration guide from v3 in cientos (to do grammar check, ad…
JaimeTorrealba Jul 17, 2024
62a9bcc
fix(types): fixed types generics for `useGLTF` (#448)
alvarosabu Jul 17, 2024
12d5834
feat(app): Add the option for x and y in mouseparallax component (#444)
JaimeTorrealba Jul 17, 2024
53ff8f2
chore: release v4.0.0-next.1
alvarosabu Jul 17, 2024
ed3cca3
docs(SVG): set playground render-mode to on-demand
andretchen0 Jul 22, 2024
26c2e1a
refactor(HolographicMaterial): remove useOnDemandInvalidation, use in…
andretchen0 Jul 22, 2024
80b2abb
refactor(CustomShaderMaterial): remove useOnDemandInvalidated, use in…
andretchen0 Jul 22, 2024
b419281
refactor(MeshReflectionmaterial): remove useOnDemandInvalidated, use …
andretchen0 Jul 22, 2024
ca69747
refactor: call invalidate on props update
andretchen0 Jul 23, 2024
1a88ebc
docs: add on-demand shapes playground demo
andretchen0 Jul 23, 2024
d71c328
fix: reimplement ContactShadows for v4 (#449)
andretchen0 Jul 24, 2024
cbfd226
feat(Sparkles): invalidate on update (#446)
andretchen0 Jul 24, 2024
c14a0ec
chore: remove on demand composable (#452)
alvarosabu Jul 24, 2024
cc322f5
chore: invalidation refactor leftovers
alvarosabu Jul 24, 2024
a68ca3a
chore(types): fixes some type issues
alvarosabu Jul 24, 2024
42afa6e
fix: update to core v4.2.2 to remove warning on invalidation
alvarosabu Jul 24, 2024
3323cfa
chore: fix lint
alvarosabu Jul 24, 2024
9b0c95b
chore: release v4.0.0-rc.0
alvarosabu Jul 24, 2024
ddcd4ac
feat(fbo): add autoRender flag as an option to useFBO (#458)
nartc Jul 25, 2024
9283045
chore: fix lint
alvarosabu Jul 25, 2024
c01903e
chore: release v4.0.0-rc.1
alvarosabu Jul 25, 2024
33f820b
docs: added recipe for tweakpane to migration guides
alvarosabu Jul 25, 2024
26f6e86
chore(playground): added same scale as default
alvarosabu Jul 26, 2024
5bf9d4a
chore: release v4.0.0-rc.2
alvarosabu Jul 26, 2024
2d8e57e
Merge branch 'main' into v4
alvarosabu Jul 31, 2024
d118d27
chore: linter fix
alvarosabu Jul 31, 2024
50facb1
chore: update deps to fix docs build
alvarosabu Jul 31, 2024
b09180f
feat(app): 393 Add LOD component
JaimeTorrealba Aug 7, 2024
3bd153c
chore: remove unused box
JaimeTorrealba Aug 7, 2024
1526b60
chore: remove unused params
JaimeTorrealba Aug 7, 2024
0f07668
Merge remote-tracking branch 'origin/main' into feature/393-lod
JaimeTorrealba Aug 24, 2024
8ecea81
docs: apply feedback
JaimeTorrealba Sep 3, 2024
b01af1b
Merge remote-tracking branch 'origin/main' into feature/393-lod
JaimeTorrealba Sep 3, 2024
621745d
Merge remote-tracking branch 'origin/main' into feature/393-lod
JaimeTorrealba Oct 2, 2024
5ceca1a
Merge remote-tracking branch 'origin/main' into feature/393-lod
JaimeTorrealba Oct 7, 2024
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
1 change: 1 addition & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export default defineConfig({
{ text: 'StatsGl', link: '/guide/misc/stats-gl' },
{ text: 'useGLTFExporter', link: '/guide/misc/use-gltf-exporter' },
{ text: 'BakeShadows', link: '/guide/misc/bake-shadows' },
{ text: 'LOD', link: '/guide/misc/lod' },
],
},
],
Expand Down
28 changes: 28 additions & 0 deletions docs/.vitepress/theme/components/LODDemo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<script setup lang="ts">
import { TresCanvas } from '@tresjs/core'
import { LOD, OrbitControls, Sphere } from '@tresjs/cientos'
</script>

<template>
<TresCanvas>
<TresPerspectiveCamera :position="[0, 2, 4]" />
<OrbitControls :enablePan="false" :enableDamping="false" :enableRotate="false" />
<LOD :distance="0" name="high">
<Sphere name="sphere" :args="[1, 16]" :position="[-1, 0, 0]">
<TresMeshNormalMaterial wireframe />
</Sphere>
</LOD>

<LOD :distance="5" name="medium">
<Sphere name="sphere" :args="[1, 8]" :position="[-1, 0, 0]">
<TresMeshNormalMaterial wireframe />
</Sphere>
</LOD>

<LOD :distance="10" name="low">
<Sphere name="sphere" :args="[1, 4]" :position="[-1, 0, 0]">
<TresMeshNormalMaterial wireframe />
</Sphere>
</LOD>
</TresCanvas>
</template>
1 change: 1 addition & 0 deletions docs/component-list/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export default [
{ text: 'StatsGl', link: '/guide/misc/stats-gl' },
{ text: 'useGLTFExporter', link: '/guide/misc/use-gltf-exporter' },
{ text: 'BakeShadows', link: '/guide/misc/bake-shadows' },
{ text: 'LOD', link: '/guide/misc/lod' },
],
},
{
Expand Down
30 changes: 30 additions & 0 deletions docs/guide/misc/lod.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# LOD (level of detail)

<DocsDemo>
<LODDemo />
</DocsDemo>

**Cientos** provides a component called `LOD` (Level of Detail) which reduces or increase the resolution of the geometry based on distance from the camera. based on: [LOD](https://threejs.org/docs/index.html?q=lod#api/en/objects/LOD)

Every level is associated with a group, and rendering can be switched between them at the distances specified. Typically you would create, say, three meshes:

- one for far away (lesser detail)
- one for mid-range (medium detail)
- one for close-up (higher detail).

## Basic usage

When using the `<LOD >` component you need to pass a `distance` prop, then you put inside all the components that will be rendered at that distance

<<< @/.vitepress/theme/components/LODDemo.vue{3,10-14,16-20,22-26}

::: warning
Due the nature of the base class on ThreeJs this component is not reactive, that's mean if you make a change you have to manually reload the page for view them.
:::

## Props

| Prop | Type | Default | Description |
| :------------ | -------- | ------- | ------------ |
| **distance** | `number` | required | The distance at which to display this level of detail.. |
| **hysteresis** | `number` | `0` | Threshold used to avoid flickering at LOD boundaries, as a fraction of distance.. |
54 changes: 54 additions & 0 deletions playground/src/pages/misc/LODDemo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<script setup lang="ts">
import { CameraControls, LOD, Sphere } from '@tresjs/cientos'
import { shallowRef, watch } from 'vue'
import { TresCanvas } from '@tresjs/core'
import { NoToneMapping, SRGBColorSpace } from 'three'

const gl = {
clearColor: '#111',
outputColorSpace: SRGBColorSpace,
toneMapping: NoToneMapping,
}

const lodRef = shallowRef()

watch(lodRef, (value) => {
// eslint-disable-next-line no-console
console.log('jaime ~ LOD LEVELS ~ value:', value.instance)
})
</script>

<!-- <Sphere name="sphere" :args="[1, 16]" :position="[-1, 0, 0]">
<TresMeshNormalMaterial wireframe />
</Sphere> -->
<!-- -->
<template>
<TresCanvas v-bind="gl">
<TresPerspectiveCamera :position="[0, 2, 5]" />
<CameraControls :distance="50" />
<LOD ref="lodRef" :distance="0" name="high">
<Sphere name="sphere" :args="[1, 16]" :position="[-1, 0, 0]">
<TresMeshNormalMaterial wireframe />
</Sphere>
<TresMesh name="box" :position="[1, 0, 0]">
<TresBoxGeometry :args="[1, 1, 1, 10, 10, 10]" />
<TresMeshBasicMaterial wireframe :color="0xFF0000" />
</TresMesh>
</LOD>
<LOD :distance="15" name="medium">
<Sphere name="sphere" :args="[1, 8]" :position="[-1, 0, 0]">
<TresMeshNormalMaterial wireframe />
</Sphere>
</LOD>

<LOD :distance="30" name="low">
<Sphere name="sphere" :args="[1, 4]" :position="[-1, 0, 0]">
<TresMeshNormalMaterial wireframe />
</Sphere>
<TresMesh name="box" :position="[1, 0, 0]">
<TresBoxGeometry :args="[1, 1, 1]" />
<TresMeshBasicMaterial wireframe :color="0xFF0000" />
</TresMesh>
</LOD>
</TresCanvas>
</template>
5 changes: 5 additions & 0 deletions playground/vue/src/router/routes/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,9 @@ export const miscRoutes = [
name: 'GLTFExporter',
component: () => import('../../pages/misc/GLTFExporterDemo.vue'),
},
{
path: '/misc/LOD',
name: 'LOD',
component: () => import('../../pages/misc/LODDemo.vue'),
},
]
Loading
Loading