Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/EffectComposer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { TextureDataType } from 'three'
import type { Camera, Scene, TextureDataType } from 'three'
import { HalfFloatType, NoToneMapping } from 'three'
import React, {
forwardRef,
Expand Down Expand Up @@ -27,8 +27,8 @@ export const EffectComposerContext = createContext<{
composer: EffectComposerImpl
normalPass: NormalPass | null
downSamplingPass: DepthDownsamplingPass | null
camera: THREE.Camera
scene: THREE.Scene
camera: Camera
scene: Scene
resolutionScale?: number
}>(null!)

Expand All @@ -44,8 +44,8 @@ export type EffectComposerProps = {
multisampling?: number
frameBufferType?: TextureDataType
renderPriority?: number
camera?: THREE.Camera
scene?: THREE.Scene
camera?: Camera
scene?: Scene
}

const isConvolution = (effect: Effect): boolean =>
Expand Down
2 changes: 1 addition & 1 deletion src/effects/ASCII.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class ASCIIEffect extends Effect {
}

/** Draws the characters on a Canvas and returns a texture */
public createCharactersTexture(characters: string, font: string, fontSize: number): THREE.Texture {
public createCharactersTexture(characters: string, font: string, fontSize: number): Texture {
const canvas = document.createElement('canvas')
const SIZE = 1024
const MAX_PER_ROW = 16
Expand Down
48 changes: 29 additions & 19 deletions src/effects/SelectiveBloom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,35 @@ export const SelectiveBloom = forwardRef(function SelectiveBloom(

const invalidate = useThree((state) => state.invalidate)
const { scene, camera } = useContext(EffectComposerContext)
const effect = useMemo(
() => {
const effect = new SelectiveBloomEffect(scene, camera, {
blendFunction: BlendFunction.ADD,
luminanceThreshold,
luminanceSmoothing,
intensity,
width,
height,
kernelSize,
mipmapBlur,
...props,
});
effect.inverted = inverted;
effect.ignoreBackground = ignoreBackground;
return effect;
},
[scene, camera, luminanceThreshold, luminanceSmoothing, intensity, width, height, kernelSize, mipmapBlur, inverted, ignoreBackground, props]
)
const effect = useMemo(() => {
const effect = new SelectiveBloomEffect(scene, camera, {
blendFunction: BlendFunction.ADD,
luminanceThreshold,
luminanceSmoothing,
intensity,
width,
height,
kernelSize,
mipmapBlur,
...props,
})
effect.inverted = inverted
effect.ignoreBackground = ignoreBackground
return effect
}, [
scene,
camera,
luminanceThreshold,
luminanceSmoothing,
intensity,
width,
height,
kernelSize,
mipmapBlur,
inverted,
ignoreBackground,
props,
])

const api = useContext(selectionContext)

Expand Down
Loading