Skip to content

Commit

Permalink
fix: no x,y properties on some uniforms (just arrays)
Browse files Browse the repository at this point in the history
  • Loading branch information
abernier committed Jul 20, 2023
1 parent 5c0ffcb commit 25594ab
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/effects/LensFlare.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -480,15 +480,13 @@ export const LensFlare = forwardRef<LensFlareEffect, LensFlareProps>(
let target = 1

if (followMouse) {
uLensPosition.value.x = pointer.x
uLensPosition.value.y = pointer.y
uLensPosition.value = [pointer.x, pointer.y]
target = 0
} else {
projectedPosition.copy(position).project(camera)
if (projectedPosition.z > 1) return

uLensPosition.value.x = projectedPosition.x
uLensPosition.value.y = projectedPosition.y
uLensPosition.value = [projectedPosition.x, projectedPosition.y]

mouse2d.set(projectedPosition.x, projectedPosition.y)
raycaster.setFromCamera(mouse2d, camera)
Expand Down Expand Up @@ -518,8 +516,7 @@ export const LensFlare = forwardRef<LensFlareEffect, LensFlareProps>(
useEffect(() => {
const screenRes = effect.uniforms.get('screenRes')
if (screenRes) {
screenRes.value.x = viewport.width
screenRes.value.y = viewport.height
screenRes.value = [viewport.width, viewport.height]
}
}, [effect, viewport])

Expand Down

0 comments on commit 25594ab

Please sign in to comment.