@react-three/postprocessing 2.12.1 → 2.12.3

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.
@@ -3,6 +3,10 @@ type N8AOProps = {
3
3
  aoRadius?: number;
4
4
  distanceFalloff?: number;
5
5
  intensity?: number;
6
+ quality?: 'performance' | 'low' | 'medium' | 'high' | 'ultra';
7
+ aoSamples?: number;
8
+ denoiseSamples?: number;
9
+ denoiseRadius?: number;
6
10
  };
7
11
  export declare const N8AO: import("react").ForwardRefExoticComponent<N8AOProps & import("react").RefAttributes<N8AOPostPass>>;
8
12
  export {};
package/dist/index.cjs CHANGED
@@ -510,12 +510,23 @@ const SSAO = React.forwardRef(function SSAO(props, ref) {
510
510
  return jsxRuntime.jsx("primitive", { ref: ref, object: effect, dispose: null });
511
511
  });
512
512
 
513
- const N8AO = React.forwardRef((props, ref) => {
513
+ const N8AO = React.forwardRef(({ quality, aoRadius = 5, aoSamples = 16, denoiseSamples = 4, denoiseRadius = 12, distanceFalloff = 1, intensity = 1, }, ref) => {
514
514
  const { camera, scene } = fiber.useThree();
515
515
  const effect = React.useMemo(() => new n8ao.N8AOPostPass(scene, camera), []);
516
516
  React.useLayoutEffect(() => {
517
- Object.assign(effect.configuration, props);
518
- }, [props]);
517
+ Object.assign(effect.configuration, {
518
+ aoRadius,
519
+ distanceFalloff,
520
+ intensity,
521
+ aoSamples,
522
+ denoiseSamples,
523
+ denoiseRadius,
524
+ });
525
+ }, [aoRadius, distanceFalloff, intensity, aoSamples, denoiseSamples, denoiseRadius]);
526
+ React.useLayoutEffect(() => {
527
+ if (quality)
528
+ effect.setQualityMode(quality.charAt(0).toUpperCase() + quality.slice(1));
529
+ }, [quality]);
519
530
  return jsxRuntime.jsx("primitive", { ref: ref, object: effect });
520
531
  });
521
532
 
package/dist/index.js CHANGED
@@ -490,12 +490,23 @@ const SSAO = forwardRef(function SSAO(props, ref) {
490
490
  return jsx("primitive", { ref: ref, object: effect, dispose: null });
491
491
  });
492
492
 
493
- const N8AO = forwardRef((props, ref) => {
493
+ const N8AO = forwardRef(({ quality, aoRadius = 5, aoSamples = 16, denoiseSamples = 4, denoiseRadius = 12, distanceFalloff = 1, intensity = 1, }, ref) => {
494
494
  const { camera, scene } = useThree();
495
495
  const effect = useMemo(() => new N8AOPostPass(scene, camera), []);
496
496
  useLayoutEffect(() => {
497
- Object.assign(effect.configuration, props);
498
- }, [props]);
497
+ Object.assign(effect.configuration, {
498
+ aoRadius,
499
+ distanceFalloff,
500
+ intensity,
501
+ aoSamples,
502
+ denoiseSamples,
503
+ denoiseRadius,
504
+ });
505
+ }, [aoRadius, distanceFalloff, intensity, aoSamples, denoiseSamples, denoiseRadius]);
506
+ useLayoutEffect(() => {
507
+ if (quality)
508
+ effect.setQualityMode(quality.charAt(0).toUpperCase() + quality.slice(1));
509
+ }, [quality]);
499
510
  return jsx("primitive", { ref: ref, object: effect });
500
511
  });
501
512
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-three/postprocessing",
3
- "version": "2.12.1",
3
+ "version": "2.12.3",
4
4
  "description": "postprocessing wrapper for React and @react-three/fiber",
5
5
  "keywords": [
6
6
  "postprocessing",