@react-three/postprocessing 2.15.0 → 2.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +59 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +59 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -188,25 +188,70 @@ const useVector2 = (props, key) => {
|
|
|
188
188
|
return new THREE.Vector2();
|
|
189
189
|
}, [value]);
|
|
190
190
|
};
|
|
191
|
-
const DepthOfField = forwardRef(function DepthOfField2({
|
|
192
|
-
|
|
191
|
+
const DepthOfField = forwardRef(function DepthOfField2({
|
|
192
|
+
blendFunction,
|
|
193
|
+
worldFocusDistance,
|
|
194
|
+
worldFocusRange,
|
|
195
|
+
focusDistance,
|
|
196
|
+
focusRange,
|
|
197
|
+
focalLength,
|
|
198
|
+
bokehScale,
|
|
199
|
+
resolutionScale,
|
|
200
|
+
resolutionX,
|
|
201
|
+
resolutionY,
|
|
202
|
+
width,
|
|
203
|
+
height,
|
|
204
|
+
target,
|
|
205
|
+
depthTexture,
|
|
206
|
+
...props
|
|
207
|
+
}, ref) {
|
|
193
208
|
const { camera } = useContext(EffectComposerContext);
|
|
209
|
+
const autoFocus = target != null;
|
|
194
210
|
const effect = useMemo(() => {
|
|
195
|
-
const effect2 = new DepthOfFieldEffect(camera,
|
|
211
|
+
const effect2 = new DepthOfFieldEffect(camera, {
|
|
212
|
+
blendFunction,
|
|
213
|
+
worldFocusDistance,
|
|
214
|
+
worldFocusRange,
|
|
215
|
+
focusDistance,
|
|
216
|
+
focusRange,
|
|
217
|
+
focalLength,
|
|
218
|
+
bokehScale,
|
|
219
|
+
resolutionScale,
|
|
220
|
+
resolutionX,
|
|
221
|
+
resolutionY,
|
|
222
|
+
width,
|
|
223
|
+
height
|
|
224
|
+
});
|
|
225
|
+
if (autoFocus)
|
|
226
|
+
effect2.target = new Vector3();
|
|
227
|
+
if (depthTexture)
|
|
228
|
+
effect2.setDepthTexture(depthTexture.texture, depthTexture.packing);
|
|
196
229
|
const maskMaterial = effect2.maskPass.getFullscreenMaterial();
|
|
197
230
|
maskMaterial.maskFunction = MaskFunction.MULTIPLY_RGB_SET_ALPHA;
|
|
198
231
|
return effect2;
|
|
199
|
-
}, [
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
232
|
+
}, [
|
|
233
|
+
camera,
|
|
234
|
+
blendFunction,
|
|
235
|
+
worldFocusDistance,
|
|
236
|
+
worldFocusRange,
|
|
237
|
+
focusDistance,
|
|
238
|
+
focusRange,
|
|
239
|
+
focalLength,
|
|
240
|
+
bokehScale,
|
|
241
|
+
resolutionScale,
|
|
242
|
+
resolutionX,
|
|
243
|
+
resolutionY,
|
|
244
|
+
width,
|
|
245
|
+
height,
|
|
246
|
+
autoFocus,
|
|
247
|
+
depthTexture
|
|
248
|
+
]);
|
|
249
|
+
useEffect(() => {
|
|
250
|
+
return () => {
|
|
251
|
+
effect.dispose();
|
|
252
|
+
};
|
|
253
|
+
}, [effect]);
|
|
254
|
+
return /* @__PURE__ */ jsx("primitive", { ...props, ref, object: effect, target });
|
|
210
255
|
});
|
|
211
256
|
const Autofocus = forwardRef(
|
|
212
257
|
({ target = void 0, mouse: followMouse = false, debug = void 0, manual = false, smoothTime = 0.25, ...props }, fref) => {
|