Skip to content

Commit 9eb6982

Browse files
fix(SelectiveBloom): apply ignoreBackground and inverted props (#297)
1 parent 1c4f72f commit 9eb6982

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/effects/SelectiveBloom.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ export type SelectiveBloomProps = BloomEffectOptions &
1414
lights: Object3D[] | ObjectRef[]
1515
selection: Object3D | Object3D[] | ObjectRef | ObjectRef[]
1616
selectionLayer: number
17+
inverted: boolean
18+
ignoreBackground: boolean
1719
}>
1820

1921
const addLight = (light: Object3D, effect: SelectiveBloomEffect) => light.layers.enable(effect.selection.layer)
@@ -24,6 +26,8 @@ export const SelectiveBloom = forwardRef(function SelectiveBloom(
2426
selection = [],
2527
selectionLayer = 10,
2628
lights = [],
29+
inverted = false,
30+
ignoreBackground = false,
2731
luminanceThreshold,
2832
luminanceSmoothing,
2933
intensity,
@@ -43,8 +47,8 @@ export const SelectiveBloom = forwardRef(function SelectiveBloom(
4347
const invalidate = useThree((state) => state.invalidate)
4448
const { scene, camera } = useContext(EffectComposerContext)
4549
const effect = useMemo(
46-
() =>
47-
new SelectiveBloomEffect(scene, camera, {
50+
() => {
51+
const effect = new SelectiveBloomEffect(scene, camera, {
4852
blendFunction: BlendFunction.ADD,
4953
luminanceThreshold,
5054
luminanceSmoothing,
@@ -54,8 +58,12 @@ export const SelectiveBloom = forwardRef(function SelectiveBloom(
5458
kernelSize,
5559
mipmapBlur,
5660
...props,
57-
}),
58-
[scene, camera, luminanceThreshold, luminanceSmoothing, intensity, width, height, kernelSize, mipmapBlur, props]
61+
});
62+
effect.inverted = inverted;
63+
effect.ignoreBackground = ignoreBackground;
64+
return effect;
65+
},
66+
[scene, camera, luminanceThreshold, luminanceSmoothing, intensity, width, height, kernelSize, mipmapBlur, inverted, ignoreBackground, props]
5967
)
6068

6169
const api = useContext(selectionContext)

0 commit comments

Comments
 (0)