Skip to content

Instantly share code, notes, and snippets.

View ektogamat's full-sized avatar
👋

Anderson Mancini ektogamat

👋
View GitHub Profile
@ektogamat
ektogamat / util.tsx
Last active May 21, 2023 04:55
Utility file for Ultimate LensFlare
// File copy pasted from https://github.com/pmndrs/react-postprocessing/blob/master/src/util.tsx
import React, { forwardRef, useMemo, useLayoutEffect, MutableRefObject } from 'react'
import { Vector2, Object3D } from 'three'
import { ReactThreeFiber, useThree } from '@react-three/fiber'
import { Effect, BlendFunction } from 'postprocessing'
type ObjectRef = MutableRefObject<Object3D>
type DefaultProps = Partial<{ blendFunction: BlendFunction; opacity: number }>
// Created by Anderson Mancini 2023
// React Three Fiber AutoFocus Component to be used
// as an extension for default Depth Of Field from react-three/postprocessing
// HOW TO USE?
// import AutoFocusDOF from './AutoFocusDOF'
//
// And add this component inside the EffectsComposer...
//...
// <EffectComposer>