@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.cjs
CHANGED
|
@@ -206,25 +206,70 @@ const useVector2 = (props, key) => {
|
|
|
206
206
|
return new THREE__namespace.Vector2();
|
|
207
207
|
}, [value]);
|
|
208
208
|
};
|
|
209
|
-
const DepthOfField = React.forwardRef(function DepthOfField2({
|
|
210
|
-
|
|
209
|
+
const DepthOfField = React.forwardRef(function DepthOfField2({
|
|
210
|
+
blendFunction,
|
|
211
|
+
worldFocusDistance,
|
|
212
|
+
worldFocusRange,
|
|
213
|
+
focusDistance,
|
|
214
|
+
focusRange,
|
|
215
|
+
focalLength,
|
|
216
|
+
bokehScale,
|
|
217
|
+
resolutionScale,
|
|
218
|
+
resolutionX,
|
|
219
|
+
resolutionY,
|
|
220
|
+
width,
|
|
221
|
+
height,
|
|
222
|
+
target,
|
|
223
|
+
depthTexture,
|
|
224
|
+
...props
|
|
225
|
+
}, ref) {
|
|
211
226
|
const { camera } = React.useContext(EffectComposerContext);
|
|
227
|
+
const autoFocus = target != null;
|
|
212
228
|
const effect = React.useMemo(() => {
|
|
213
|
-
const effect2 = new postprocessing.DepthOfFieldEffect(camera,
|
|
229
|
+
const effect2 = new postprocessing.DepthOfFieldEffect(camera, {
|
|
230
|
+
blendFunction,
|
|
231
|
+
worldFocusDistance,
|
|
232
|
+
worldFocusRange,
|
|
233
|
+
focusDistance,
|
|
234
|
+
focusRange,
|
|
235
|
+
focalLength,
|
|
236
|
+
bokehScale,
|
|
237
|
+
resolutionScale,
|
|
238
|
+
resolutionX,
|
|
239
|
+
resolutionY,
|
|
240
|
+
width,
|
|
241
|
+
height
|
|
242
|
+
});
|
|
243
|
+
if (autoFocus)
|
|
244
|
+
effect2.target = new THREE.Vector3();
|
|
245
|
+
if (depthTexture)
|
|
246
|
+
effect2.setDepthTexture(depthTexture.texture, depthTexture.packing);
|
|
214
247
|
const maskMaterial = effect2.maskPass.getFullscreenMaterial();
|
|
215
248
|
maskMaterial.maskFunction = postprocessing.MaskFunction.MULTIPLY_RGB_SET_ALPHA;
|
|
216
249
|
return effect2;
|
|
217
|
-
}, [
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
250
|
+
}, [
|
|
251
|
+
camera,
|
|
252
|
+
blendFunction,
|
|
253
|
+
worldFocusDistance,
|
|
254
|
+
worldFocusRange,
|
|
255
|
+
focusDistance,
|
|
256
|
+
focusRange,
|
|
257
|
+
focalLength,
|
|
258
|
+
bokehScale,
|
|
259
|
+
resolutionScale,
|
|
260
|
+
resolutionX,
|
|
261
|
+
resolutionY,
|
|
262
|
+
width,
|
|
263
|
+
height,
|
|
264
|
+
autoFocus,
|
|
265
|
+
depthTexture
|
|
266
|
+
]);
|
|
267
|
+
React.useEffect(() => {
|
|
268
|
+
return () => {
|
|
269
|
+
effect.dispose();
|
|
270
|
+
};
|
|
271
|
+
}, [effect]);
|
|
272
|
+
return /* @__PURE__ */ jsxRuntime.jsx("primitive", { ...props, ref, object: effect, target });
|
|
228
273
|
});
|
|
229
274
|
const Autofocus = React.forwardRef(
|
|
230
275
|
({ target = void 0, mouse: followMouse = false, debug = void 0, manual = false, smoothTime = 0.25, ...props }, fref) => {
|