Skip to content

Commit

Permalink
Merge pull request #147 from Tresjs/feature/86-explore-vue-custom-ren…
Browse files Browse the repository at this point in the history
…der-api-v2

[v2] - feat(core): custom renderer
  • Loading branch information
alvarosabu authored Mar 15, 2023
2 parents 2aa957a + 42ee984 commit 0c5deaf
Show file tree
Hide file tree
Showing 63 changed files with 906 additions and 1,391 deletions.
2 changes: 1 addition & 1 deletion docs/examples/text-3d.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ So the final code would be something like this:
<script setup lang="ts">
import { TextGeometry } from 'three/examples/jsm/geometries/TextGeometry'
import { FontLoader } from 'three/examples/jsm/loaders/FontLoader'
import { useCatalogue, useTexture } from '/@/core'
import { useCatalogue, useTexture } from '/@/composables'
const { extend } = useCatalogue()
extend({ TextGeometry: TextGeometry })
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"@changesets/cli": "^2.25.2",
"@stackblitz/sdk": "^1.8.1",
"@tresjs/cientos": "workspace:^1.8.0",
"@tresjs/core": "workspace:^1.8.1",
"@tresjs/core": "workspace:^2.0.0",
"@typescript-eslint/eslint-plugin": "^5.42.0",
"@typescript-eslint/parser": "^5.42.0",
"conventional-changelog-cli": "^2.2.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/cientos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s"
},
"peerDependencies": {
"@tresjs/core": "workspace:^1.8.1",
"@tresjs/core": "workspace:^2.0.0",
"three": "latest",
"vue": "^3.2.47"
},
Expand All @@ -55,7 +55,7 @@
"vite-plugin-dts": "2.0.0-beta.1"
},
"dependencies": {
"@tresjs/core": "workspace:^1.8.1",
"@tresjs/core": "workspace:^2.0.0",
"three-stdlib": "^2.21.8"
}
}
1 change: 0 additions & 1 deletion packages/cientos/src/core/OrbitControls.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,5 @@ watch(controls, value => {
v-if="state.camera && state.renderer"
ref="controls"
:args="[unref(state.camera) || camera, state.renderer?.domElement || domElement]"
:enabling-dampling="enableDamping"
/>
</template>
10 changes: 8 additions & 2 deletions packages/cientos/src/core/useCientos.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useTres } from '@tresjs/core'
import { inject } from 'vue'
import { inject, watch } from 'vue'

/**
* Allows to use and extend the state of the core package.
Expand All @@ -8,13 +8,19 @@ import { inject } from 'vue'
* @return {*}
*/
export function useCientos() {
const { state, setState } = inject('useTres', useTres())
const extend =
inject<(objects: any) => void>('extend') ||
(() => {
console.warn('No extend function provided')
})

const { state, setState } = inject('useTres', useTres())
watch(
() => state,
() => {
console.log('cientos state changed', state)
},
)
return {
state,
setState,
Expand Down
2 changes: 1 addition & 1 deletion packages/cientos/src/core/usePamCameraMouse/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { watchEffect, computed } from 'vue'
import { Camera } from 'three'
import { useWindowSize, useMouse } from '@vueuse/core'
import { useLogger } from '/@/composables/useLogger'
import { useLogger } from '@tresjs/core'

export function usePamCameraMouse(disabled = false, factor = 5, camera: Camera | undefined) {
const { x, y } = useMouse()
Expand Down
Loading

0 comments on commit 0c5deaf

Please sign in to comment.