Skip to content

Commit

Permalink
feat(Lensflare): fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
andretchen0 committed Sep 7, 2023
1 parent c895fe1 commit 224ecc4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
16 changes: 9 additions & 7 deletions playground/src/pages/LensflareDemo.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { shallowRef } from 'vue'
import { shallowRef, watch } from 'vue'
import { TresCanvas, useRenderLoop } from '@tresjs/core'
import { Levioso, Lensflare, Dodecahedron } from '@tresjs/cientos';
import { Color, MeshPhongMaterial } from 'three';
Expand Down Expand Up @@ -32,7 +32,7 @@ const { onLoop } = useRenderLoop();
onLoop(() => {
if (!lightRef.value) return
if (Math.random() > 0.99) {
if (Math.random() > 0.99) {
lightRef.value.color = new Color(randomColor());
flarePropsRef.value = getFlareProps()
}
Expand Down Expand Up @@ -213,13 +213,15 @@ const rockMaterial = new MeshPhongMaterial({ color: 0x123141, specular: 0xffffff
watch(() => [
seedRef.value,
oversizeSizeMin.value, oversizeSizeMax.value, oversizeLengthMin.value, oversizeLengthMax.value,
oversizeSizeMin.value, oversizeSizeMax.value, oversizeLengthMin.value, oversizeLengthMax.value,
oversizeColorA.value, oversizeColorB.value, oversizeColorC.value, oversizeSeed.value,
bodySizeMin.value, bodySizeMax.value, bodyLengthMin.value, bodyLengthMax.value,
bodySizeMin.value, bodySizeMax.value, bodyLengthMin.value, bodyLengthMax.value,
bodyColorA.value, bodyColorB.value, bodyColorC.value, bodySeed.value,
frontSizeMin.value, frontSizeMax.value, frontLengthMin.value, frontLengthMax.value, frontOffset.value, frontDistance.value,
frontSizeMin.value, frontSizeMax.value, frontLengthMin.value, frontLengthMax.value,
frontOffset.value, frontDistance.value,
frontColorA.value, frontColorB.value, frontColorC.value, frontSeed.value,
backSizeMin.value, backSizeMax.value, backLengthMin.value, backLengthMax.value, backDistance.value, backOffset.value,
backSizeMin.value, backSizeMax.value, backLengthMin.value, backLengthMax.value,
backDistance.value, backOffset.value,
backColorA.value, backColorB.value, backColorC.value, backSeed.value,
], updateSeedProps);
Expand All @@ -240,7 +242,7 @@ const rockMaterial = new MeshPhongMaterial({ color: 0x123141, specular: 0xffffff
</TresPointLight>
</Levioso>
<TresPointLight :color="new Color(1, 1, 1)" :intensity="2000" :position="[10, 5, 0]">
<Lensflare :seed="seedRef" :seedProps="seedPropsRef" />
<Lensflare :seed="seedRef" :seed-props="seedPropsRef" />
</TresPointLight>
<Dodecahedron v-for="{ key, position, rotation, scale } in rocks" :key="key" :material="rockMaterial"
:position="position" :rotation="rotation" :scale="scale" />
Expand Down
6 changes: 3 additions & 3 deletions src/core/abstractions/Lensflare/component.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Lensflare, LensflareElement } from 'three/examples/jsm/objects/Lensflar
import { TextureLoader } from 'three'
import { watch, shallowRef, onMounted, onUnmounted } from 'vue'
import { normalizeColor } from '@tresjs/core'
import { LensflareElementProps, partialLensflarePropsArrayToLensflarePropsArray, SeedProps } from '.'
import { LensflareElementProps, partialLensflarePropsArrayToLensflarePropsArray as fillInProps, SeedProps } from '.'
const props = withDefaults(
defineProps<{
Expand Down Expand Up @@ -102,11 +102,11 @@ onUnmounted(() => {
onMounted(() => {
lensflareRef.value?.add(threeLensflare);
lensflareElementPropsArray.value = partialLensflarePropsArrayToLensflarePropsArray(props.flare, props.seed, props.seedProps);
lensflareElementPropsArray.value = fillInProps(props.flare, props.seed, props.seedProps);
})
watch(() => [props.flare, props.seed, props.seedProps], () => {
lensflareElementPropsArray.value = partialLensflarePropsArrayToLensflarePropsArray(props.flare, props.seed, props.seedProps);
lensflareElementPropsArray.value = fillInProps(props.flare, props.seed, props.seedProps);
})
watch(() => props.scale, () => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/abstractions/Lensflare/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const partialLensflarePropsArrayToLensflarePropsArray = (
partialPropsArrayToPropsArray<LensflareElementProps>(
partialProps,
seed,
(seed) => getSeededLensflareElementProps(seed, seedProps),
seed => getSeededLensflareElementProps(seed, seedProps),
defaultElement,
)

Expand Down

0 comments on commit 224ecc4

Please sign in to comment.