-
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: do not change pierced props case (#608)
- Loading branch information
1 parent
05069ab
commit 906f2e1
Showing
4 changed files
with
83 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<script setup lang="ts"> | ||
import { shallowRef } from 'vue' | ||
import { TresCanvas, useRenderLoop } from '@tresjs/core' | ||
const x = shallowRef(1) | ||
const y = shallowRef(1) | ||
const z = shallowRef(1) | ||
const rx = shallowRef(1) | ||
const ry = shallowRef(1) | ||
const rz = shallowRef(1) | ||
const sx = shallowRef(1) | ||
const sy = shallowRef(1) | ||
const sz = shallowRef(1) | ||
const label = shallowRef('') | ||
const refs = [x, y, z, rx, ry, rz, sx, sy, sz] | ||
const labels = [ | ||
'position-x', 'position-y', 'position-z', | ||
'rotation-x', 'rotation-y', 'rotation-z', | ||
'scale-x', 'scale-y', 'scale-z', | ||
] | ||
const PI2 = Math.PI * 2 | ||
useRenderLoop().onLoop(({ elapsed }) => { | ||
const i = Math.floor(elapsed % refs.length) | ||
refs[i].value = Math.cos(elapsed * Math.PI * 2) | ||
label.value = `${labels[i]} ${Math.trunc(refs[i].value * 10) / 10}` | ||
}) | ||
</script> | ||
|
||
<template> | ||
<div class="overlay"> | ||
<p>Demonstrate pierced props</p> | ||
{{ label }} | ||
</div> | ||
<TresCanvas> | ||
<TresMesh | ||
:position-x="x" | ||
:position-y="y" | ||
:position-z="z" | ||
:rotation-x="rx" | ||
:rotation-y="ry" | ||
:rotation-z="rz" | ||
:scale-x="sx" | ||
:scale-y="sy" | ||
:scale-z="sz" | ||
> | ||
<TresBoxGeometry /> | ||
<TresMeshNormalMaterial /> | ||
</TresMesh> | ||
</TresCanvas> | ||
</template> | ||
|
||
<style> | ||
.overlay { | ||
position: fixed; | ||
padding: 10px; | ||
font-family: sans-serif; | ||
} | ||
</style> |
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