Skip to content

Commit

Permalink
chore: merge v4 updates
Browse files Browse the repository at this point in the history
  • Loading branch information
andretchen0 committed Apr 26, 2024
2 parents 6fd8c08 + 17d3b29 commit a3d7bbe
Show file tree
Hide file tree
Showing 55 changed files with 2,468 additions and 1,822 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [16]
node-version: [18]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [16]
node-version: [18]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
65 changes: 65 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,74 @@


## [4.0.0-rc.0](https://github.com/Tresjs/tres/compare/3.9.0...4.0.0-rc.0) (2024-04-25)


### ⚠ BREAKING CHANGES

* **events:** pointerevents manager and state (#529)

### Features

* 499 better memory management ([#606](https://github.com/Tresjs/tres/issues/606)) ([e98ca6d](https://github.com/Tresjs/tres/commit/e98ca6dea15973b3a00e4b485199d9906eb772eb))
* devtools renderer improvements ([#614](https://github.com/Tresjs/tres/issues/614)) ([cdf6b6f](https://github.com/Tresjs/tres/commit/cdf6b6fefbd58dbf1dfbe396f219ac6f7c6fc92d))
* **events:** pointerevents manager and state ([#529](https://github.com/Tresjs/tres/issues/529)) ([b536ab1](https://github.com/Tresjs/tres/commit/b536ab19d1f4082c2db926e24d8c52f92949964b))


### Bug Fixes

* do not change pierced props case ([#608](https://github.com/Tresjs/tres/issues/608)) ([906f2e1](https://github.com/Tresjs/tres/commit/906f2e157aab7aa6daef5682c3282cf6e84fa891))

## [4.0.0-next.2](https://github.com/Tresjs/tres/compare/3.9.0...4.0.0-rc.0) (2024-03-27)


### Bug Fixes

* refactor nodeOps to return methods at the end of the function ([#602](https://github.com/Tresjs/tres/issues/602)) ([cd0c3bc](https://github.com/Tresjs/tres/commit/cd0c3bcd891f019cf91f30e5fdd547630332a065))

## [4.0.0-next.1](https://github.com/Tresjs/tres/compare/3.9.0...4.0.0-rc.0) (2024-03-18)


### Features

* 140 on demand rendering ([#497](https://github.com/Tresjs/tres/issues/497)) ([f688c64](https://github.com/Tresjs/tres/commit/f688c6447be887c4675a57ecabb5182d8b7d02cf))
* 492 set tone mapping default to acesfilmictonemapping ([#498](https://github.com/Tresjs/tres/issues/498)) ([c4547f9](https://github.com/Tresjs/tres/commit/c4547f92615a43b7b56b34c0e1ee9f4b78a2230b))
* 503 conditional rendering of primitives ([#514](https://github.com/Tresjs/tres/issues/514)) ([79d8a76](https://github.com/Tresjs/tres/commit/79d8a762da6b6e23771a20314f7902eff4635acf))
* 516 localstate for custom renderer node instances instead of userdata ([#522](https://github.com/Tresjs/tres/issues/522)) ([08717ef](https://github.com/Tresjs/tres/commit/08717efd0f631c085340b1fea4eb6c154c63608b))
* remove default camera warning ([#499](https://github.com/Tresjs/tres/issues/499)) ([8bbafde](https://github.com/Tresjs/tres/commit/8bbafde48a33753f0b6560da36a4d128aaa83cc6))
* update to three `v160` and vue `v3.4` ([#488](https://github.com/Tresjs/tres/issues/488)) ([5fad3b8](https://github.com/Tresjs/tres/commit/5fad3b8095c09cfe758e2553da3df49b29b1ce1a))


### Bug Fixes

* `nodeOps` is now a function ([#579](https://github.com/Tresjs/tres/issues/579)) ([ddc229e](https://github.com/Tresjs/tres/commit/ddc229e6e492b9e7887add0fcc679a9ae4e47f5c))
* camera aspect ([52dad5c](https://github.com/Tresjs/tres/commit/52dad5c98271f80f4d454bbcce1bb5844960f943))
* **types:** added `Object3DEventMap` to `Object3D` generics for point event handling ([#491](https://github.com/Tresjs/tres/issues/491)) ([a63eb90](https://github.com/Tresjs/tres/commit/a63eb9099fcaf97b1c96abe5667ee71ca2fd611f))

## [4.0.0-next.0](https://github.com/Tresjs/tres/compare/3.9.0...4.0.0-rc.0) (2023-12-22)


### Features

* 474 vue chrome devtools plugin ([#479](https://github.com/Tresjs/tres/issues/479)) ([224ab06](https://github.com/Tresjs/tres/commit/224ab06a4404e2ae5a0cbd2f43041961862b09fd))

## [4.0.0-next.2](https://github.com/Tresjs/tres/compare/4.0.0-next.1...4.0.0-next.2) (2024-03-27)

## [4.0.0-next.1](https://github.com/Tresjs/tres/compare/3.7.0...4.0.0-next.1) (2024-03-18)
* correct type exporting issues ([#625](https://github.com/Tresjs/tres/issues/625)) ([8e52cf1](https://github.com/Tresjs/tres/commit/8e52cf1935d7b725b87c9a41e44ba61e33bd3e85))


## [3.9.0](https://github.com/Tresjs/tres/compare/3.8.1...3.9.0) (2024-04-24)


### Features

* **app:** Add a new directive, v-rotate ([ccf5313](https://github.com/Tresjs/tres/commit/ccf53135a81c795bc08b343baaa823fa33bd064d))


### Bug Fixes

* **deps:** update dependency vue-router to v4.3.1 ([#650](https://github.com/Tresjs/tres/issues/650)) ([9bbb676](https://github.com/Tresjs/tres/commit/9bbb6768a5a7400bf163c06b3688505915bfd074))

## [3.8.1](https://github.com/Tresjs/tres/compare/3.8.0...3.8.1) (2024-04-08)


Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Thanks from the heart 💚 for taking the time to help out. This guide will help

## Setup

All the packages in the ecosystem use [pnpm workspaces](https://pnpm.io/workspaces). PnPM is a package manager that is faster than npm and yarn. It also uses symlinks to avoid code duplication.
All the packages in the ecosystem use [pnpm workspaces](https://pnpm.io/workspaces). Pnpm is a package manager that is faster than npm and yarn. It also uses symlinks to avoid code duplication.

The `workspace` has the following structure:

Expand Down
3 changes: 2 additions & 1 deletion docs/.vitepress/config/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { DefaultTheme, LocaleSpecificConfig } from 'vitepress'
export const deConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
themeConfig: {
editLink: {
pattern: 'https://github.com/tresjs/tres/edit/main/packages/docs/:path',
pattern: 'https://github.com/tresjs/tres/edit/main/docs/:path',
text: 'Änderungen an dieser Seite vorschlagen',
},
sidebar: [
Expand Down Expand Up @@ -77,6 +77,7 @@ export const deConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
{ text: 'v-light-helper', link: '/de/directives/v-light-helper' },
{ text: 'v-always-look-at', link: '/de/directives/v-always-look-at' },
{ text: 'v-distance-to', link: '/de/directives/v-distance-to' },
{ text: 'v-rotate', link: '/directives/v-rotate' },
],
},
{
Expand Down
6 changes: 4 additions & 2 deletions docs/.vitepress/config/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { DefaultTheme, LocaleSpecificConfig } from 'vitepress'
export const enConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
themeConfig: {
editLink: {
pattern: 'https://github.com/tresjs/tres/edit/main/packages/docs/:path',
pattern: 'https://github.com/tresjs/tres/edit/main/docs/:path',
text: 'Suggest changes to this page',
},
sidebar: [
Expand Down Expand Up @@ -43,7 +43,8 @@ export const enConfig: LocaleSpecificConfig<DefaultTheme.Config> = {

items: [
{ text: 'Extending', link: '/advanced/extending' },
{ text: 'Primitive', link: '/advanced/primitive' },
{ text: 'Primitives', link: '/advanced/primitive' },
{ text: 'Scaling Performance 🚀', link: '/advanced/performance' },
{
text: 'Caveats',
link: '/advanced/caveats',
Expand Down Expand Up @@ -78,6 +79,7 @@ export const enConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
{ text: 'v-light-helper', link: '/directives/v-light-helper' },
{ text: 'v-always-look-at', link: '/directives/v-always-look-at' },
{ text: 'v-distance-to', link: '/directives/v-distance-to' },
{ text: 'v-rotate', link: '/directives/v-rotate' },
],
},
{
Expand Down
3 changes: 2 additions & 1 deletion docs/.vitepress/config/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { DefaultTheme, LocaleSpecificConfig } from 'vitepress'
export const esConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
themeConfig: {
editLink: {
pattern: 'https://github.com/tresjs/tres/edit/main/packages/docs/:path',
pattern: 'https://github.com/tresjs/tres/edit/main/docs/:path',
text: 'Sugerir cambios a esta página',
},
sidebar: [
Expand Down Expand Up @@ -78,6 +78,7 @@ export const esConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
{ text: 'v-light-helper', link: '/es/directives/v-light-helper' },
{ text: 'v-always-look-at', link: '/es/directives/v-always-look-at' },
{ text: 'v-distance-to', link: '/es/directives/v-distance-to' },
{ text: 'v-rotate', link: '/directives/v-rotate' },
],
},
{
Expand Down
3 changes: 2 additions & 1 deletion docs/.vitepress/config/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { DefaultTheme, LocaleSpecificConfig } from 'vitepress'
export const frConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
themeConfig: {
editLink: {
pattern: 'https://github.com/tresjs/tres/edit/main/packages/docs/:path',
pattern: 'https://github.com/tresjs/tres/edit/main/docs/:path',
text: 'Suggérer un changement à cette page.',
},
sidebar: [
Expand Down Expand Up @@ -79,6 +79,7 @@ export const frConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
{ text: 'v-light-helper', link: '/fr/directives/v-light-helper' },
{ text: 'v-always-look-at', link: '/fr/directives/v-always-look-at' },
{ text: 'v-distance-to', link: '/fr/directives/v-distance-to' },
{ text: 'v-rotate', link: '/directives/v-rotate' },
],
},
{
Expand Down
3 changes: 2 additions & 1 deletion docs/.vitepress/config/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { DefaultTheme, LocaleSpecificConfig } from 'vitepress'
export const nlConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
themeConfig: {
editLink: {
pattern: 'https://github.com/tresjs/tres/edit/main/packages/docs/:path',
pattern: 'https://github.com/tresjs/tres/edit/main/docs/:path',
text: 'Stel wijzigingen op deze pagina voor',
},
sidebar: [
Expand Down Expand Up @@ -78,6 +78,7 @@ export const nlConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
{ text: 'v-light-helper', link: '/nl/directives/v-light-helper' },
{ text: 'v-always-look-at', link: '/nl/directives/v-always-look-at' },
{ text: 'v-distance-to', link: '/nl/directives/v-distance-to' },
{ text: 'v-rotate', link: '/directives/v-rotate' },
],
},
{
Expand Down
3 changes: 2 additions & 1 deletion docs/.vitepress/config/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { DefaultTheme, LocaleSpecificConfig } from 'vitepress'
export const zhConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
themeConfig: {
editLink: {
pattern: 'https://github.com/tresjs/tres/edit/main/packages/docs/:path',
pattern: 'https://github.com/tresjs/tres/edit/main/docs/:path',
text: '对本页内容给出建议',
},
sidebar: [
Expand Down Expand Up @@ -77,6 +77,7 @@ export const zhConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
{ text: 'v-light-helper', link: '/zh/directives/v-light-helper' },
{ text: 'v-always-look-at', link: '/zh/directives/v-always-look-at' },
{ text: 'v-distance-to', link: '/zh/directives/v-distance-to' },
{ text: 'v-rotate', link: '/directives/v-rotate' },
],
},
{
Expand Down
97 changes: 91 additions & 6 deletions docs/.vitepress/theme/components/HomeSponsors.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
<script setup lang="ts">
import { VPHomeSponsors } from 'vitepress/theme'
import { useSponsor } from '../composables/sponsor'
const { data } = useSponsor()
/* const { data } = useSponsor() */
</script>

<template>
<VPHomeSponsors
v-if="data"
message="TresJS is free and open source, made possible by wonderful sponsors."
:data="data"
:data="[]"
/>
<div class="action">
<a
Expand All @@ -18,9 +16,94 @@ const { data } = useSponsor()
target="_blank"
rel="noreferrer"
>
Become a sponsor <i class="i-carbon-heart"></i>
Become a sponsor
</a>
</div>
<div class="action">
<p class="message">Consider supporting our friends</p>
</div>
<ul class="action flex flex-wrap w-full sm:w-2/3 md:1/3 mx-auto">
<li>
<a
class="sponsor"
href="https://github.com/sponsors/vitejs"
target="_blank"
rel="noreferrer"
>
Vite <i class="i-logos-vitejs ml-2"></i>
</a>
</li>
<li>
<a
class="sponsor"
href="https://github.com/sponsors/patak-dev"
target="_blank"
rel="noreferrer"
>
Patak <img class="w-5 h-5 rounded ml-2" src="https://avatars.githubusercontent.com/u/583075?v=4" alt="" />
</a>
</li>
<li>
<a
class="sponsor"
href="https://github.com/sponsors/antfu"
target="_blank"
rel="noreferrer"
>
Anthony Fu <img class="w-5 h-5 rounded ml-2" src="https://avatars.githubusercontent.com/u/11247099?v=4" alt="" />
</a>
</li>
<li>
<a
class="sponsor"
href="https://github.com/sponsors/posva"
target="_blank"
rel="noreferrer"
>
posva <img class="w-5 h-5 rounded ml-2" src="https://avatars.githubusercontent.com/u/664177?v=4" alt="" />
</a>
</li>
<li>
<a
class="sponsor"
href="https://github.com/sponsors/johnsoncodehk"
target="_blank"
rel="noreferrer"
>
Johnson Chu <img class="w-5 h-5 rounded ml-2" src="https://avatars.githubusercontent.com/u/16279759?v=4" alt="" />
</a>
</li>
<li>
<a
class="sponsor"
href="https://github.com/sponsors/CodyJasonBennett"
target="_blank"
rel="noreferrer"
>
Cody Bennet <img class="w-5 h-5 rounded ml-2" src="https://avatars.githubusercontent.com/u/23324155?v=4" alt="" />
</a>
</li>
<li>
<a
class="sponsor"
href="https://github.com/sponsors/nuxt"
target="_blank"
rel="noreferrer"
>
Daniel Roe <img class="w-5 h-5 rounded ml-2" src="https://avatars.githubusercontent.com/u/23360933?s=160&v=4" alt="" />
</a>
</li>
<li>
<a
class="sponsor"
href="https://github.com/sponsors/danielroe"
target="_blank"
rel="noreferrer"
>
Nuxt <img class="w-5 h-5 rounded ml-2" src="https://avatars.githubusercontent.com/u/28706372?v=4" alt="" />
</a>
</li>
</ul>
</template>

<style scoped>
Expand All @@ -33,7 +116,9 @@ const { data } = useSponsor()
.sponsor {
/* .VPButton */
display: inline-block;
display: flex;
align-items: center;
justify-content: space-between;
border: 1px solid transparent;
text-align: center;
font-weight: 600;
Expand Down
4 changes: 4 additions & 0 deletions docs/.vitepress/theme/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,7 @@
color: var(--vp-button-alt-text);
background-color: var(--vp-button-alt-bg);
}

.VPHomeSponsors {
margin-bottom: 0px !important;
}
31 changes: 31 additions & 0 deletions docs/advanced/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,34 @@ const { advance } = useTres()
advance()
</script>
```

## Dispose resources `dispose()` <Badge type="tip" text="^4.0.0" />

When you are done with a resource, like a texture, geometry, or material, you should dispose of it to free up memory. This is especially important when you are creating and destroying resources frequently, like in a game.

TresJS will automatically dispose of resources recursively when the component is unmounted, but you can also perform this manually by calling the `dispose()` directly from the package:

::: warning
To avoid errors and unwanted sideeffects, resources created programatically with the use of `primitives` need to be manually disposed.
:::

```html {2,12}
<script setup lang="ts">
import { dispose } from '@tresjs/core'
import { useGLTF } from '@tresjs/cientos'
const { nodes } = await useGLTF(
'https://raw.githubusercontent.com/Tresjs/assets/main/models/gltf/blender-cube.glb',
{ draco: true },
)
const model = nodes.Cube
onUnmounted(() => {
dispose(model)
})
</script>

<template>
<primitive :object="model" />
</template>
```
Loading

0 comments on commit a3d7bbe

Please sign in to comment.