Skip to content

Commit

Permalink
feat: 474 vue chrome devtools plugin (#479)
Browse files Browse the repository at this point in the history
* feat: vue chrome devtools

* feat: editable scenes from devtools

* chore(lint): fix lint errors

* feat: highlight material

* chore(lint): fix
  • Loading branch information
alvarosabu authored Dec 22, 2023
1 parent 341faac commit 224ab06
Show file tree
Hide file tree
Showing 12 changed files with 1,112 additions and 1,093 deletions.
6 changes: 3 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"build": "vitepress build",
"preview": "vitepress preview"
},
"dependencies": {
"@tresjs/core": "workspace:3.6.0"
},
"devDependencies": {
"unocss": "^0.58.0",
"vite-svg-loader": "^5.1.0"
},
"dependencies": {
"@tresjs/core": "workspace:3.6.0-next.0"
}
}
3 changes: 2 additions & 1 deletion playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@
},
"dependencies": {
"@tresjs/cientos": "3.6.0",
"@tresjs/core": "workspace:^",
"vue-router": "^4.2.5"
},
"devDependencies": {
"@tresjs/leches": "0.15.0-next.3",
"@tweakpane/plugin-essentials": "^0.2.0",
"vite-plugin-vue-devtools": "1.0.0-rc.6",
"unplugin-auto-import": "^0.17.2",
"vite-plugin-glsl": "^1.2.1",
"vite-plugin-qrcode": "^0.2.3",
"vite-plugin-vue-devtools": "1.0.0-rc.6",
"vue-tsc": "^1.8.25"
}
}
37 changes: 19 additions & 18 deletions playground/src/components/TheExperience.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { ref, watchEffect } from 'vue'
import { BasicShadowMap, SRGBColorSpace, NoToneMapping } from 'three'
import { TresCanvas } from '@tresjs/core'
import { OrbitControls } from '@tresjs/cientos'
import { TresLeches, useControls } from '@tresjs/leches'
import '@tresjs/leches/styles'
import TheSphere from './TheSphere.vue'
const gl = {
Expand All @@ -17,21 +19,21 @@ const gl = {
const wireframe = ref(true)
const canvas = ref()
const meshRef = ref()
const { isVisible } = useControls({
isVisible: true,
})
watchEffect(() => {
if (canvas.value) {
console.log(canvas.value.context)
if (meshRef.value) {
console.log(meshRef.value)
}
})
</script>

<template>
<div>
<button @click="wireframe = !wireframe">
Click
</button>
</div>
<pre>{{ wireframe }}</pre>
<TresLeches />
<TresCanvas
v-bind="gl"
ref="canvas"
Expand All @@ -44,14 +46,10 @@ watchEffect(() => {
:look-at="[0, 4, 0]"
/>
<OrbitControls />
<TresFog
:color="gl.clearColor"
:near="5"
:far="15"
/>
<TresMesh
:position="[-2, 6, 0]"
:rotation="[0, Math.PI, 0]"
name="cone"
cast-shadow
>
<TresConeGeometry :args="[1, 1.5, 3]" />
Expand All @@ -68,19 +66,22 @@ watchEffect(() => {
/>
</TresMesh>
<TresMesh
:rotation="[-Math.PI / 2, 0, 0]"
ref="meshRef"
:rotation="[-Math.PI / 2, 0, Math.PI / 2]"
name="floor"
receive-shadow
>
<TresPlaneGeometry :args="[10, 10, 10, 10]" />
<TresMeshToonMaterial color="#D3FC8A" />
<TresPlaneGeometry :args="[20, 20, 20]" />
<TresMeshToonMaterial
color="#D3FC8A"
/>
</TresMesh>
<TheSphere />
<TheSphere v-if="isVisible" />
<TresAxesHelper :args="[1]" />
<TresDirectionalLight
:position="[0, 2, 4]"
:intensity="2"
cast-shadow
/>
<TresOrthographicCamera />
</TresCanvas>
</template>
1 change: 1 addition & 0 deletions playground/src/components/TheSphere.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<template>
<TresMesh
:position="[2, 2, 0]"
name="sphere"
cast-shadow
>
<TresSphereGeometry />
Expand Down
Loading

0 comments on commit 224ab06

Please sign in to comment.