Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Tresjs/tres
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4.2.7
Choose a base ref
...
head repository: Tresjs/tres
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4.2.8
Choose a head ref
  • 2 commits
  • 142 files changed
  • 1 contributor

Commits on Aug 30, 2024

  1. fix: use CubeTextureLoader correctly with array of files (#807)

    * chore(playground): re-organize playgrounds, add nuxt one
    
    * chore(playground-nuxt): nuxt environment reproduction
    
    * fix(useLoader): use CubeTextureLoader correctly with array of files
    
    * chore: fix lint
    alvarosabu authored Aug 30, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    38f05b0 View commit details
  2. chore: release v4.2.8

    alvarosabu committed Aug 30, 2024
    Copy the full SHA
    be1f484 View commit details
Showing with 15,473 additions and 758 deletions.
  1. +7 −0 CHANGELOG.md
  2. +3 −3 package.json
  3. +4 −4 playground/.eslintrc-auto-import.json
  4. +0 −21 playground/components.d.ts
  5. +2 −0 playground/nuxt/.github/FUNDING.yml
  6. +27 −0 playground/nuxt/.github/workflows/actions/pnpm/action.yml
  7. +17 −0 playground/nuxt/.github/workflows/lint-pr.yml
  8. +23 −0 playground/nuxt/.gitignore
  9. +2 −0 playground/nuxt/.npmrc
  10. +3 −0 playground/nuxt/.stackblitzrc
  11. +21 −0 playground/nuxt/LICENSE
  12. +67 −0 playground/nuxt/README.md
  13. +29 −0 playground/nuxt/app.vue
  14. +41 −0 playground/nuxt/components/EnvironmentLocal.vue
  15. +19 −0 playground/nuxt/components/TheExperience.vue
  16. +21 −0 playground/nuxt/nuxt.config.ts
  17. +36 −0 playground/nuxt/package.json
  18. +6,683 −0 playground/nuxt/pnpm-lock.yaml
  19. BIN playground/nuxt/public/LittleRocksBaked.png
  20. BIN playground/nuxt/public/RockBaked.png
  21. BIN playground/nuxt/public/favicon-16x16.png
  22. BIN playground/nuxt/public/favicon-32x32.png
  23. +6 −0 playground/nuxt/public/favicon-dark.svg
  24. BIN playground/nuxt/public/favicon.ico
  25. +5 −0 playground/nuxt/public/favicon.svg
  26. BIN playground/nuxt/public/nuxt-stones.glb
  27. BIN playground/nuxt/public/repo-banner.png
  28. +6 −0 playground/nuxt/renovate.json
  29. +3 −0 playground/nuxt/server/tsconfig.json
  30. +4 −0 playground/nuxt/tsconfig.json
  31. +67 −0 playground/vue/.eslintrc-auto-import.json
  32. 0 playground/{ → vue}/.eslintrc.json
  33. 0 playground/{ → vue}/.gitignore
  34. 0 playground/{ → vue}/.vscode/extensions.json
  35. 0 playground/{ → vue}/README.md
  36. 0 playground/{ → vue}/auto-imports.d.ts
  37. +34 −0 playground/vue/components.d.ts
  38. 0 playground/{ → vue}/index.html
  39. 0 playground/{ → vue}/package.json
  40. 0 playground/{ → vue}/public/blender-cube.svg
  41. 0 playground/{ → vue}/public/cientos.svg
  42. 0 playground/{ → vue}/public/logo.svg
  43. 0 playground/{ → vue}/public/vite.svg
  44. 0 playground/{ → vue}/src/App.vue
  45. 0 playground/{ → vue}/src/assets/vue.svg
  46. 0 playground/{ → vue}/src/components/AnimatedObjectUseUpdate.vue
  47. 0 playground/{ → vue}/src/components/BlenderCube.vue
  48. 0 playground/{ → vue}/src/components/DynamicModel.vue
  49. 0 playground/{ → vue}/src/components/GraphPane.vue
  50. 0 playground/{ → vue}/src/components/OverlayInfo.vue
  51. 0 playground/{ → vue}/src/components/PbrSphere.vue
  52. 0 playground/{ → vue}/src/components/TestResult.vue
  53. 0 playground/{ → vue}/src/components/Tests.vue
  54. 0 playground/{ → vue}/src/components/TheExperience.vue
  55. 0 playground/{ → vue}/src/components/TheSphere.vue
  56. 0 playground/{ → vue}/src/composables/state.ts
  57. 0 playground/{ → vue}/src/composables/useFBX.ts
  58. 0 playground/{ → vue}/src/composables/useGLTF.ts
  59. 0 playground/{ → vue}/src/main.ts
  60. 0 playground/{ → vue}/src/pages/advanced/Memory.vue
  61. 0 playground/{ → vue}/src/pages/advanced/devicePixelRatio/index.vue
  62. 0 playground/{ → vue}/src/pages/advanced/disposal/index.vue
  63. 0 playground/{ → vue}/src/pages/advanced/fbo/FBOCube.vue
  64. 0 playground/{ → vue}/src/pages/advanced/fbo/index.vue
  65. 0 playground/{ → vue}/src/pages/advanced/fbo/useFBO.ts
  66. 0 playground/{ → vue}/src/pages/advanced/manual/experience.vue
  67. 0 playground/{ → vue}/src/pages/advanced/manual/index.vue
  68. 0 playground/{ → vue}/src/pages/advanced/materialArray/index.vue
  69. 0 playground/{ → vue}/src/pages/advanced/on-demand/experience.vue
  70. 0 playground/{ → vue}/src/pages/advanced/on-demand/index.vue
  71. 0 playground/{ → vue}/src/pages/advanced/suspense/AsyncComponent.vue
  72. 0 playground/{ → vue}/src/pages/advanced/suspense/index.vue
  73. 0 playground/{ → vue}/src/pages/advanced/takeOverRender/TakeOverRenderExperience.vue
  74. 0 playground/{ → vue}/src/pages/advanced/takeOverRender/index.vue
  75. 0 playground/{ → vue}/src/pages/basic/Conditional.vue
  76. 0 playground/{ → vue}/src/pages/basic/Groups.vue
  77. 0 playground/{ → vue}/src/pages/basic/Lights.vue
  78. 0 playground/{ → vue}/src/pages/basic/Multiple.vue
  79. 0 playground/{ → vue}/src/pages/basic/OnCallbacks.vue
  80. 0 playground/{ → vue}/src/pages/basic/PiercedProps.vue
  81. 0 playground/{ → vue}/src/pages/basic/Primitives.vue
  82. 0 playground/{ → vue}/src/pages/basic/Responsiveness.vue
  83. 0 playground/{ → vue}/src/pages/basic/example.vue
  84. 0 playground/{ → vue}/src/pages/basic/index.vue
  85. 0 playground/{ → vue}/src/pages/basic/ready/LoopCallbackWatcher.vue
  86. 0 playground/{ → vue}/src/pages/basic/ready/OnTresReadyWatcher.vue
  87. 0 playground/{ → vue}/src/pages/basic/ready/index.vue
  88. 0 playground/{ → vue}/src/pages/cameras/NoCamera.vue
  89. 0 playground/{ → vue}/src/pages/cameras/index.vue
  90. 0 playground/{ → vue}/src/pages/cameras/multipleCameras/TheCameraOperator.vue
  91. 0 playground/{ → vue}/src/pages/cameras/multipleCameras/index.vue
  92. 0 playground/{ → vue}/src/pages/empty.vue
  93. 0 playground/{ → vue}/src/pages/events/DynamicObjects.vue
  94. 0 playground/{ → vue}/src/pages/events/FpsDropsReproduction.vue
  95. 0 playground/{ → vue}/src/pages/events/index.vue
  96. 0 playground/{ → vue}/src/pages/events/propagation/Box.vue
  97. 0 playground/{ → vue}/src/pages/events/propagation/index.vue
  98. 0 playground/{ → vue}/src/pages/index.vue
  99. 0 playground/{ → vue}/src/pages/issues/701-cientos-v4/TheExperience.vue
  100. 0 playground/{ → vue}/src/pages/issues/701-cientos-v4/index.vue
  101. 0 playground/{ → vue}/src/pages/issues/701/TheExperience.vue
  102. 0 playground/{ → vue}/src/pages/issues/701/index.vue
  103. 0 playground/{ → vue}/src/pages/issues/717/MyBox.vue
  104. 0 playground/{ → vue}/src/pages/issues/717/index.vue
  105. 0 playground/{ → vue}/src/pages/issues/749/TheExperience.vue
  106. 0 playground/{ → vue}/src/pages/issues/749/index.vue
  107. 0 playground/{ → vue}/src/pages/issues/796/TheBox.vue
  108. 0 playground/{ → vue}/src/pages/issues/796/TheExperience.vue
  109. 0 playground/{ → vue}/src/pages/issues/796/index.vue
  110. 0 playground/{ → vue}/src/pages/loaders/fbx-loader/TheExperience.vue
  111. 0 playground/{ → vue}/src/pages/loaders/fbx-loader/TheModel.vue
  112. 0 playground/{ → vue}/src/pages/loaders/fbx-loader/index.vue
  113. 0 playground/{ → vue}/src/pages/loaders/gltf-loader/TheExperience.vue
  114. 0 playground/{ → vue}/src/pages/loaders/gltf-loader/TheModel.vue
  115. 0 playground/{ → vue}/src/pages/loaders/gltf-loader/index.vue
  116. 0 playground/{ → vue}/src/pages/misc/GUI.vue
  117. 0 playground/{ → vue}/src/pages/misc/TheParticles.vue
  118. 0 playground/{ → vue}/src/pages/misc/directives/DirectiveSubComponent.vue
  119. 0 playground/{ → vue}/src/pages/misc/directives/index.vue
  120. 0 playground/{ → vue}/src/pages/misc/text3D/Text3D.vue
  121. 0 playground/{ → vue}/src/pages/misc/text3D/index.vue
  122. 0 playground/{ → vue}/src/pages/models/PrimitivesModel.vue
  123. 0 playground/{ → vue}/src/pages/models/RiggedModel/UgglyBunny.vue
  124. 0 playground/{ → vue}/src/pages/models/RiggedModel/index.vue
  125. 0 playground/{ → vue}/src/router/index.ts
  126. 0 playground/{ → vue}/src/router/routes/advanced.ts
  127. 0 playground/{ → vue}/src/router/routes/basic.ts
  128. 0 playground/{ → vue}/src/router/routes/cameras.ts
  129. 0 playground/{ → vue}/src/router/routes/events.ts
  130. 0 playground/{ → vue}/src/router/routes/index.ts
  131. 0 playground/{ → vue}/src/router/routes/issues.ts
  132. 0 playground/{ → vue}/src/router/routes/loaders.ts
  133. 0 playground/{ → vue}/src/router/routes/misc.ts
  134. 0 playground/{ → vue}/src/router/routes/models.ts
  135. 0 playground/{ → vue}/src/style.css
  136. 0 playground/{ → vue}/src/vite-env.d.ts
  137. +1 −1 playground/{ → vue}/tsconfig.json
  138. 0 playground/{ → vue}/tsconfig.node.json
  139. +1 −1 playground/{ → vue}/vite.config.ts
  140. +8,322 −706 pnpm-lock.yaml
  141. +1 −1 pnpm-workspace.yaml
  142. +18 −21 src/composables/useLoader/index.ts
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@


## [4.2.8](https://github.com/Tresjs/tres/compare/4.2.7...4.2.8) (2024-08-30)


### Bug Fixes

* use CubeTextureLoader correctly with array of files ([#807](https://github.com/Tresjs/tres/issues/807)) ([38f05b0](https://github.com/Tresjs/tres/commit/38f05b03d7d2b9934f8893a5f4858b09b7188782))

## [4.2.7](https://github.com/Tresjs/tres/compare/4.2.6...4.2.7) (2024-08-19)

## [4.2.6](https://github.com/Tresjs/tres/compare/4.2.5...4.2.6) (2024-08-15)
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tresjs/core",
"type": "module",
"version": "4.2.7",
"version": "4.2.8",
"packageManager": "pnpm@9.1.4",
"description": "Declarative ThreeJS using Vue Components",
"author": "Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)",
@@ -49,9 +49,9 @@
"access": "public"
},
"scripts": {
"dev": "cd playground && npm run dev",
"dev": "cd playground/vue && npm run dev",
"dev:nuxt": "cd playground/nuxt && npm run dev",
"build": "vite build",
"playground": "cd playground && npm run dev",
"test": "vitest",
"test:ci": "vitest run",
"test:ui": "vitest --ui --coverage.enabled=true",
8 changes: 4 additions & 4 deletions playground/.eslintrc-auto-import.json
Original file line number Diff line number Diff line change
@@ -4,6 +4,9 @@
"ComponentPublicInstance": true,
"ComputedRef": true,
"EffectScope": true,
"ExtractDefaultPropTypes": true,
"ExtractPropTypes": true,
"ExtractPublicPropTypes": true,
"InjectionKey": true,
"PropType": true,
"Ref": true,
@@ -59,9 +62,6 @@
"watch": true,
"watchEffect": true,
"watchPostEffect": true,
"watchSyncEffect": true,
"ExtractDefaultPropTypes": true,
"ExtractPropTypes": true,
"ExtractPublicPropTypes": true
"watchSyncEffect": true
}
}
21 changes: 0 additions & 21 deletions playground/components.d.ts
Original file line number Diff line number Diff line change
@@ -7,28 +7,7 @@ export {}
/* prettier-ignore */
declare module 'vue' {
export interface GlobalComponents {
AkuAku: typeof import('./src/components/AkuAku.vue')['default']
AnimatedObjectUseUpdate: typeof import('./src/components/AnimatedObjectUseUpdate.vue')['default']
BlenderCube: typeof import('./src/components/BlenderCube.vue')['default']
Box: typeof import('./src/components/Box.vue')['default']
DirectiveSubComponent: typeof import('./src/components/DirectiveSubComponent.vue')['default']
DynamicModel: typeof import('./src/components/DynamicModel.vue')['default']
FBOCube: typeof import('./src/components/FBOCube.vue')['default']
GraphPane: typeof import('./src/components/GraphPane.vue')['default']
LocalOrbitControls: typeof import('./src/components/LocalOrbitControls.vue')['default']
Overlay: typeof import('./src/components/Overlay.vue')['default']
OverlayInfo: typeof import('./src/components/OverlayInfo.vue')['default']
PbrSphere: typeof import('./src/components/PbrSphere.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
TakeOverLoopExperience: typeof import('./src/components/TakeOverLoopExperience.vue')['default']
TestResult: typeof import('./src/components/TestResult.vue')['default']
Tests: typeof import('./src/components/Tests.vue')['default']
TestSphere: typeof import('./src/components/TestSphere.vue')['default']
Text3D: typeof import('./src/components/Text3D.vue')['default']
TheCameraOperator: typeof import('./src/components/TheCameraOperator.vue')['default']
TheExperience: typeof import('./src/components/TheExperience.vue')['default']
TheSphere: typeof import('./src/components/TheSphere.vue')['default']
UgglyBunny: typeof import('./src/components/UgglyBunny.vue')['default']
}
}
2 changes: 2 additions & 0 deletions playground/nuxt/.github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: [alvarosabu]
ko_fi: alvarosaburido
27 changes: 27 additions & 0 deletions playground/nuxt/.github/workflows/actions/pnpm/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# From https://github.com/remirror/template/blob/4f8c5f5629a081217672a8cce1df085510f43913/.github/actions/pnpm/action.yml
name: pnpm installation
description: Install and audit dependencies for pnpm
inputs:
cache: # id of input
description: The location of the pnpm cache
required: true
default: .pnpm-store
version: # id of input
description: The version to use
required: false
default: 6.10.0

runs:
using: composite
steps:
- name: install pnpm
run: npm install pnpm@${{ inputs.version }} -g
shell: bash

- name: setup pnpm config
run: pnpm config set store-dir ${{ inputs.cache }}
shell: bash

- name: install dependencies
run: pnpm install --shamefully-hoist
shell: bash
17 changes: 17 additions & 0 deletions playground/nuxt/.github/workflows/lint-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Lint PR

on:
pull_request_target:
types:
- opened
- edited
- synchronize

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23 changes: 23 additions & 0 deletions playground/nuxt/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Nuxt dev/build outputs
.output
.nuxt
.nitro
.cache
dist

# Node dependencies
node_modules

# Logs
logs
*.log

# Misc
.DS_Store
.fleet
.idea

# Local env files
.env
.env.*
!.env.example
2 changes: 2 additions & 0 deletions playground/nuxt/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
shamefully-hoist=true
strict-peer-dependencies=false
3 changes: 3 additions & 0 deletions playground/nuxt/.stackblitzrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"installDependencies": true
}
21 changes: 21 additions & 0 deletions playground/nuxt/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022-present, (alvarosabu) Alvaro Saburido and Tres contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
67 changes: 67 additions & 0 deletions playground/nuxt/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
![repo-banner](/public/repo-banner.png)

# TresJS 🚀 Starter + Nuxt

> Quick start repo for [Nuxt](https://nuxt.com) projects with [TresJS](https://tresjs.org) integration via [`@tresjs/nuxt` module](https://tresjs.org/guide/nuxt.html).
Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.

## Setup

Make sure to install the dependencies:

```bash
# npm
npm install

# pnpm
pnpm install

# yarn
yarn install
```

## Development Server

Start the development server on `http://localhost:3000`:

```bash
# npm
npm run dev

# pnpm
pnpm run dev

# yarn
yarn dev
```

## Production

Build the application for production:

```bash
# npm
npm run build

# pnpm
pnpm run build

# yarn
yarn build
```

Locally preview production build:

```bash
# npm
npm run preview

# pnpm
pnpm run preview

# yarn
yarn preview
```

Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
29 changes: 29 additions & 0 deletions playground/nuxt/app.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<script setup lang="ts">
import { BasicShadowMap, NoToneMapping, SRGBColorSpace } from 'three'
const gl = {
clearColor: '#c0ffee',
shadows: true,
alpha: false,
shadowMapType: BasicShadowMap,
outputColorSpace: SRGBColorSpace,
toneMapping: NoToneMapping,
}
</script>

<template>
<div style="height: 100vh">
<TresCanvas v-bind="gl">
<TheExperience />
</TresCanvas>
</div>
</template>

<style>
html,
body {
margin: 0;
padding: 0;
overflow: hidden;
}
</style>
41 changes: 41 additions & 0 deletions playground/nuxt/components/EnvironmentLocal.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<script setup lang="ts">
import { CubeReflectionMapping, type CubeTexture, CubeTextureLoader, EquirectangularReflectionMapping, type Texture } from 'three'
import type { LoaderProto } from '@tresjs/core'
import { useLoader, useTresContext } from '@tresjs/core'
import { RGBELoader } from 'three-stdlib'
/* const files = ref(['/px.jpg', '/nx.jpg', '/py.jpg', '/ny.jpg', '/pz.jpg', '/nz.jpg']) */
const files = ref('venice/venice_sunset_1k.hdr')
const path = 'https://raw.githubusercontent.com/Tresjs/assets/main/textures/hdr/'
const texture: Ref<Texture | CubeTexture | null> = ref(null)
const { scene } = useTresContext()
const isCubeMap = computed(() => Array.isArray((files as Ref<string[]>).value))
const result = ref()
const loader = computed(() => isCubeMap.value ? CubeTextureLoader as unknown as LoaderProto<CubeTexture | RGBELoader> : RGBELoader as unknown as LoaderProto<CubeTexture | RGBELoader>)
result.value = await useLoader<CubeTexture | RGBELoader>(
loader.value,
isCubeMap.value ? [...unref(files)] : unref(files),
(loader: any) => {
if (path) { loader.setPath(unref(path)) }
/* if (colorSpace) loader.colorSpace = colorSpace */
},
)
if (result.value) {
texture.value = result.value
if (texture.value) {
texture.value.mapping = isCubeMap.value ? CubeReflectionMapping : EquirectangularReflectionMapping
scene.value.environment = texture.value
scene.value.background = texture.value
}
}
</script>

<template>
<TresMesh>
<TresSphereGeometry args="[1, 64, 32]" />
<TresMeshStandardMaterial :envMap="texture" />
</TresMesh>
</template>
19 changes: 19 additions & 0 deletions playground/nuxt/components/TheExperience.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<script setup lang="ts">
</script>

<template>
<TresPerspectiveCamera
:position="[-5.3, 8.3, 10.6]"
:look-at="[0, 0, 0]"
/>
<Suspense>
<EnvironmentLocal />
</Suspense>
<TresMesh :position="[0, 2, 0]">
<TresBoxGeometry />
<TresMeshNormalMaterial />
</TresMesh>
<TresGridHelper />
<OrbitControls />
</template>
21 changes: 21 additions & 0 deletions playground/nuxt/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
import { resolve } from 'pathe'

export default defineNuxtConfig({
modules: ['@tresjs/nuxt'],
devtools: { enabled: true },

vite: {
resolve: {
alias: {
'@tresjs/core': resolve(__dirname, '../../src/'),
},
},
},

tres: {
glsl: true,
},

compatibilityDate: '2024-08-30',
})
Loading