-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove deconstructive props (#124)
* chore: refactor OrbitControls with Defaults and updated deps * chore: combine imports for vue * chore: refactor transform controls with defaults * chore: refactor KeyboardControls with withDefaults * chore: refactor smoke with `withDefaults` * chore: refactor precipitation with `withDefaults` * chore: use `toRefs` on Stars * chore: Text3D refactored * chore: refactor shapes with `withDefaults` * chore: try new cache strategy with pnpm actions for CI
- Loading branch information
1 parent
e4a03a6
commit d83d00d
Showing
37 changed files
with
1,586 additions
and
1,380 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
module.exports = { | ||
...require('@alvarosabu/prettier-config'), | ||
printWidth: 120, | ||
} | ||
|
||
...require('@alvarosabu/prettier-config'), | ||
printWidth: 120, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<script setup lang="ts"> | ||
import { TresCanvas } from '@tresjs/core' | ||
import { BasicShadowMap, NoToneMapping } from 'three' | ||
import { PointerLockControls, KeyboardControls } from '@tresjs/cientos' | ||
const gl = { | ||
clearColor: '#82DBC5', | ||
shadows: true, | ||
alpha: false, | ||
shadowMapType: BasicShadowMap, | ||
toneMapping: NoToneMapping, | ||
} | ||
</script> | ||
|
||
<template> | ||
<TresCanvas v-bind="gl"> | ||
<TresPerspectiveCamera :position="[0, 3, 10]" /> | ||
<PointerLockControls make-default /> | ||
<KeyboardControls head-bobbing /> | ||
|
||
<TresGridHelper :args="[100, 100]" /> | ||
<TresAmbientLight :intensity="1" /> | ||
</TresCanvas> | ||
</template> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<script setup lang="ts"> | ||
import { ref, reactive } from 'vue' | ||
import { TresCanvas } from '@tresjs/core' | ||
import { BasicShadowMap, SRGBColorSpace, NoToneMapping } from 'three' | ||
import { OrbitControls, TransformControls, useTweakPane } from '@tresjs/cientos' | ||
const gl = { | ||
clearColor: '#82DBC5', | ||
shadows: true, | ||
alpha: false, | ||
shadowMapType: BasicShadowMap, | ||
outputColorSpace: SRGBColorSpace, | ||
toneMapping: NoToneMapping, | ||
} | ||
const boxRef = ref() | ||
const sphereRef = ref() | ||
const transformRef = ref() | ||
function changeObject(object: any) { | ||
transformRef.value = object | ||
} | ||
const context = ref() | ||
const controlsState = reactive({ | ||
mode: 'translate', | ||
enabled: true, | ||
space: 'world', | ||
axis: 'XYZ', | ||
size: 1, | ||
showX: true, | ||
showY: true, | ||
showZ: true, | ||
}) | ||
const { pane } = useTweakPane() | ||
pane | ||
.addBlade({ | ||
view: 'list', | ||
label: 'Mode', | ||
options: [ | ||
{ text: 'Translate', value: 'translate' }, | ||
{ text: 'Rotate', value: 'rotate' }, | ||
{ text: 'Scale', value: 'scale' }, | ||
], | ||
value: controlsState.mode, | ||
}) | ||
.on('change', (e: any) => { | ||
controlsState.mode = e.value | ||
}) | ||
pane.addInput(controlsState, 'enabled') | ||
pane | ||
.addBlade({ | ||
view: 'list', | ||
label: 'Space', | ||
options: [ | ||
{ text: 'World', value: 'world' }, | ||
{ text: 'Local', value: 'local' }, | ||
], | ||
value: controlsState.space, | ||
}) | ||
.on('change', (e: any) => { | ||
controlsState.space = e.value | ||
}) | ||
pane.addBlade({ | ||
view: 'list', | ||
label: 'Axis', | ||
options: [ | ||
{ text: 'X', value: 'X' }, | ||
{ text: 'Y', value: 'Y' }, | ||
{ text: 'Z', value: 'Z' }, | ||
{ text: 'XY', value: 'XY' }, | ||
{ text: 'YZ', value: 'YZ' }, | ||
{ text: 'XZ', value: 'XZ' }, | ||
{ text: 'XYZ', value: 'XYZ' }, | ||
], | ||
value: controlsState.axis, | ||
}) | ||
pane.addInput(controlsState, 'size', { | ||
step: 0.01, | ||
min: 0, | ||
max: 10, | ||
}) | ||
pane.addInput(controlsState, 'showX') | ||
pane.addInput(controlsState, 'showY') | ||
pane.addInput(controlsState, 'showZ') | ||
</script> | ||
|
||
<template> | ||
<TresCanvas v-bind="gl" ref="context"> | ||
<TresPerspectiveCamera :position="[3, 3, 3]" /> | ||
<OrbitControls make-default /> | ||
|
||
<TresMesh ref="boxRef" :position="[-2, 1, 0]" @click="changeObject(boxRef)"> | ||
<TresBoxGeometry /> | ||
<TresMeshNormalMaterial /> | ||
</TresMesh> | ||
<TransformControls v-if="transformRef" :object="transformRef" v-bind="controlsState" /> | ||
<TresMesh ref="sphereRef" :position="[2, 1, 0]" @click="changeObject(sphereRef)"> | ||
<TresSphereGeometry /> | ||
<TresMeshNormalMaterial /> | ||
</TresMesh> | ||
<TresAmbientLight :intensity="1" /> | ||
<TresGridHelper /> | ||
</TresCanvas> | ||
</template> |
Oops, something went wrong.