-
-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: internal playground organisation (#601)
* chore: new internal playground org and testing pages * chore: fix lint * chore: better styling of playground landing page * chore: lint
- Loading branch information
1 parent
cd0c3bc
commit a6578a7
Showing
30 changed files
with
446 additions
and
154 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,7 +1,17 @@ | ||
<script setup lang="ts"> | ||
import { watch } from 'vue' | ||
import { useRoute } from 'vue-router' | ||
const route = useRoute() | ||
function setBodyClass(routeName: string) { | ||
document.title = `Core Playground - ${routeName}` | ||
document.body.className = routeName | ||
} | ||
watch([route], () => setBodyClass(route.name?.toString() ?? '')) | ||
</script> | ||
|
||
<template> | ||
<router-view /> | ||
<Suspense> | ||
<router-view /> | ||
</Suspense> | ||
</template> | ||
|
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,18 @@ | ||
<script setup lang="ts"> | ||
import { useTresContext } from '@tresjs/core' | ||
import { useGLTF } from '@tresjs/cientos' | ||
const { nodes } = await useGLTF('https://raw.githubusercontent.com/Tresjs/assets/main/models/gltf/blender-cube.glb', | ||
{ draco: true }) | ||
const model = nodes.Cube | ||
model.position.set(0, 1, 0) | ||
const state = useTresContext() | ||
state.invalidate() | ||
</script> | ||
|
||
<template> | ||
<primitive :object="model" /> | ||
</template> |
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,101 @@ | ||
<script lang="ts" setup> | ||
import { ref } from 'vue' | ||
import { useRafFn } from '@vueuse/core' | ||
import { useState } from '../composables/state' | ||
const width = 160 | ||
const height = 40 | ||
const strokeWidth = 2 | ||
const updateInterval = 100 // Update interval in milliseconds | ||
const topOffset = 0 // Offset from the top | ||
const points = ref('') | ||
const frameTimes = ref([]) | ||
const maxFrames = ref(width / strokeWidth) | ||
let lastUpdateTime = performance.now() | ||
const { renderingTimes } = useState() | ||
useRafFn(({ timestamp }) => { | ||
if (timestamp - lastUpdateTime >= updateInterval) { | ||
lastUpdateTime = timestamp | ||
frameTimes.value.push(renderingTimes?.value) | ||
renderingTimes.value = 0 | ||
if (frameTimes.value.length > maxFrames.value) { | ||
frameTimes.value.shift() | ||
} | ||
points.value = frameTimes.value | ||
.map( | ||
(value, index) => | ||
`${index * strokeWidth},${ | ||
height + topOffset - strokeWidth / 2 - (value * (height + topOffset - strokeWidth)) / 2 | ||
}`, | ||
) | ||
.join(' ') | ||
} | ||
}) | ||
</script> | ||
|
||
<template> | ||
<div | ||
class="absolute | ||
right-2 | ||
top-2 | ||
flex | ||
px-4 | ||
py-1 | ||
justify-between | ||
gap-4 | ||
items-center | ||
mb-2 | ||
z-10 | ||
bg-white | ||
dark:bg-dark | ||
shadow-xl | ||
rounded | ||
border-4 | ||
border-solid | ||
bg-primary | ||
border-primary | ||
pointer-events-none | ||
overflow-hidden" | ||
> | ||
<label class="text-secondary text-xs w-1/3">Rendering Activity</label> | ||
|
||
<div | ||
class=" | ||
bg-gray-100 | ||
dark:bg-gray-600 | ||
relative | ||
w-2/3 | ||
p-1 | ||
rounded | ||
text-right | ||
text-xs | ||
focus:border-gray-200 | ||
outline-none | ||
border-none | ||
font-sans | ||
" | ||
> | ||
<svg | ||
:width="width" | ||
:height="height" | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="none" | ||
> | ||
<polyline | ||
:points="points" | ||
stroke="lightgray" | ||
:stroke-width="strokeWidth" | ||
stroke-linecap="round" | ||
stroke-linejoin="round" | ||
/> | ||
</svg> | ||
</div> | ||
</div> | ||
</template> |
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 { useRenderLoop, useTresContext } from '@tresjs/core' | ||
import { OrbitControls } from '@tresjs/cientos' | ||
import { onMounted } from 'vue' | ||
import { useState } from '../composables/state' | ||
const { renderingTimes } = useState() | ||
const state = useTresContext() | ||
function manualInvalidate() { | ||
state.invalidate() | ||
} | ||
onMounted(() => { | ||
manualInvalidate() | ||
}) | ||
</script> | ||
|
||
<template> | ||
<OrbitControls | ||
@change="manualInvalidate" | ||
/> | ||
</template> |
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,11 @@ | ||
import { reactive, toRefs } from 'vue' | ||
|
||
const state = reactive({ | ||
renderingTimes: 0, | ||
}) | ||
export function useState() { | ||
return { | ||
...toRefs(state), | ||
|
||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
playground/src/pages/Responsiveness.vue → ...ground/src/pages/basic/Responsiveness.vue
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.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
Oops, something went wrong.