Skip to content

Commit

Permalink
AR/VR Button abstractions
Browse files Browse the repository at this point in the history
  • Loading branch information
KageRyuuu committed Nov 25, 2023
1 parent 1ead057 commit eb693c0
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 18 deletions.
4 changes: 2 additions & 2 deletions playground/src/pages/basics/XR.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script setup lang="ts">
import { TresCanvas } from '@tresjs/core'
import { XRButton } from '@tresjs/xr'
import { VRButton } from '@tresjs/xr'
</script>

<template>
<div>
<XRButton mode="VR">Immersive Experience</XRButton>
<VRButton>Immersive Experience</VRButton>
<TresCanvas window-size>
<TresMesh>
<TresTorusGeometry :args="[1, 0.5, 16, 32]" />
Expand Down
8 changes: 3 additions & 5 deletions src/components/ARButton.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<template>
<XrButton>
Ar
</XrButton>
<XRButton mode="AR" :style="buttonStyles"></XRButton>
</template>

<script setup>
<script setup lang="ts">
import XRButton from './XRButton.vue'
// import buttonStyles from './buttonStyles'
import { buttonStyles } from './buttonStyles'
</script>
10 changes: 6 additions & 4 deletions src/components/VRButton.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<template>
<XrButton>
Vr
</XrButton>
<XRButton mode="VR" v-bind="{sessionInit}" :style="buttonStyles"></XRButton>
</template>

<script setup>
<script setup lang="ts">
import XRButton from './XRButton.vue'
import { buttonStyles } from './buttonStyles'
const sessionInit = { optionalFeatures: ['local-floor', 'bounded-floor', 'hand-tracking', 'layers'] }
</script>
9 changes: 3 additions & 6 deletions src/components/XRButton.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
<template>
<div>
<button @click="handleButtonClick" :style="buttonStyles">
{{ label }}
</button>
</div>
<button @click="handleButtonClick">
{{ label }}
</button>
</template>

<script setup lang="ts">
import { computed, ref, onMounted } from 'vue'
import type { Ref } from 'vue'
import create from 'vue-zustand'
import { buttonStyles } from './buttonStyles'
/**
* Filters to unique entries of an array.
Expand Down
4 changes: 3 additions & 1 deletion src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import ARButton from './ARButton.vue'
import VRButton from './VRButton.vue'
import XRButton from './XRButton.vue'

export {
XRButton
ARButton, VRButton, XRButton
}

0 comments on commit eb693c0

Please sign in to comment.