-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: 581 environment lightformers are not working (#584)
* fix(Environment): add EnvironmentDemo and Lightformers components, update routing and environment handling - Enhanced environment handling in `useEnvironment` with improved texture management and disposal methods. - Refactored `EnvSence` class to use `dispose` method for better resource management. - Updated lightformer properties for consistency and improved functionality. * chore: fix lint * chore(EnvironmentDemo): set lightformers controls to false as default * fix(useEnvironment): replace EnvSence with EnvironmentScene class for improved resource management and texture handling * fix(useEnvironment): improve environment mesh handling by reusing existing meshes and updating background properties to avoid memory leaks
- Loading branch information
1 parent
09584be
commit 653a5df
Showing
6 changed files
with
139 additions
and
63 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
50 changes: 50 additions & 0 deletions
50
playground/vue/src/pages/staging/environment/Lightformers.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<script setup lang="ts"> | ||
import { useControls } from '@tresjs/leches' | ||
import { useLoop } from '@tresjs/core' | ||
import { ref } from 'vue' | ||
import { Lightformer } from '@tresjs/cientos' | ||
const { lightformers } = useControls({ | ||
lightformers: false, | ||
}) | ||
const lightformerRef = ref(null) | ||
const { onBeforeRender } = useLoop() | ||
onBeforeRender(({ elapsed }) => { | ||
if (lightformerRef.value) { | ||
lightformerRef.value.mesh.position.y = Math.sin(elapsed) * 2 | ||
} | ||
}) | ||
</script> | ||
|
||
<template> | ||
<TresGroup v-if="lightformers"> | ||
<Lightformer | ||
ref="lightformerRef" | ||
:intensity="1" | ||
color="red" | ||
form="ring" | ||
:rotation-x="Math.PI / 2" | ||
:position="[0, 5, -9]" | ||
:scale="[10, 10, 1]" | ||
/> | ||
<Lightformer | ||
:intensity="4" | ||
:rotation-y="Math.PI / 2" | ||
:position="[-5, 1, -1]" | ||
:scale="[20, 0.1, 1]" | ||
/> | ||
<Lightformer | ||
:rotation-y="Math.PI / 2" | ||
:position="[-5, -1, -1]" | ||
:scale="[20, 0.5, 1]" | ||
/> | ||
<Lightformer | ||
:rotation-y="-Math.PI / 2" | ||
:position="[10, 1, 0]" | ||
:scale="[20, 11, 1]" | ||
/> | ||
</TresGroup> | ||
</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
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