@react-three/postprocessing 2.11.5 → 2.12.0

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.
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ type N8AOProps = {
3
+ aoRadius?: number;
4
+ distanceFalloff?: number;
5
+ intensity?: number;
6
+ };
7
+ export declare const N8AO: import("react").ForwardRefExoticComponent<N8AOProps & import("react").RefAttributes<N8AOPostPass>>;
8
+ export {};
package/dist/index.cjs CHANGED
@@ -7,6 +7,7 @@ var fiber = require('@react-three/fiber');
7
7
  var postprocessing = require('postprocessing');
8
8
  var maath = require('maath');
9
9
  var threeStdlib = require('three-stdlib');
10
+ var n8ao = require('n8ao');
10
11
  var screenSpaceReflections = require('screen-space-reflections');
11
12
 
12
13
  function _interopNamespaceDefault(e) {
@@ -509,6 +510,15 @@ const SSAO = React.forwardRef(function SSAO(props, ref) {
509
510
  return jsxRuntime.jsx("primitive", { ref: ref, object: effect, dispose: null });
510
511
  });
511
512
 
513
+ const N8AO = React.forwardRef((props, ref) => {
514
+ const { camera, scene, size } = fiber.useThree();
515
+ const effect = React.useMemo(() => new n8ao.N8AOPostPass(scene, camera, size.width, size.height), []);
516
+ React.useLayoutEffect(() => {
517
+ Object.assign(effect.configuration, props);
518
+ }, [props]);
519
+ return jsxRuntime.jsx("primitive", { ref: ref, object: effect });
520
+ });
521
+
512
522
  const SMAA = wrapEffect(postprocessing.SMAAEffect);
513
523
 
514
524
  const Texture = React.forwardRef(function Texture({ textureSrc, texture, ...props }, ref) {
@@ -662,6 +672,7 @@ exports.GodRays = GodRays;
662
672
  exports.Grid = Grid;
663
673
  exports.HueSaturation = HueSaturation;
664
674
  exports.LUT = LUT;
675
+ exports.N8AO = N8AO;
665
676
  exports.Noise = Noise;
666
677
  exports.Outline = Outline;
667
678
  exports.Pixelation = Pixelation;
package/dist/index.d.ts CHANGED
@@ -18,6 +18,7 @@ export * from './effects/ScanlineEffect';
18
18
  export * from './effects/SelectiveBloom';
19
19
  export * from './effects/Sepia';
20
20
  export * from './effects/SSAO';
21
+ export * from './effects/N8AO';
21
22
  export * from './effects/SMAA';
22
23
  export * from './effects/Texture';
23
24
  export * from './effects/ToneMapping';
package/dist/index.js CHANGED
@@ -6,6 +6,7 @@ import { useThree, useFrame, useInstanceHandle, createPortal, extend, useLoader
6
6
  import { EffectComposer as EffectComposer$1, RenderPass, NormalPass, DepthDownsamplingPass, Effect, EffectPass, Pass, DepthOfFieldEffect, MaskFunction, DepthPickingPass, CopyPass, BlendFunction, BloomEffect, BrightnessContrastEffect, ChromaticAberrationEffect, ColorAverageEffect, ColorDepthEffect, DepthEffect, DotScreenEffect, GlitchEffect, GlitchMode, GodRaysEffect, GridEffect, HueSaturationEffect, NoiseEffect, OutlineEffect, PixelationEffect, ScanlineEffect, SelectiveBloomEffect, SepiaEffect, SSAOEffect, SMAAEffect, TextureEffect, ToneMappingEffect, VignetteEffect, ShockWaveEffect, LUT3DEffect, TiltShiftEffect as TiltShiftEffect$1, EffectAttribute } from 'postprocessing';
7
7
  import { easing } from 'maath';
8
8
  import { isWebGL2Available } from 'three-stdlib';
9
+ import { N8AOPostPass } from 'n8ao';
9
10
  import { SSREffect } from 'screen-space-reflections';
10
11
 
11
12
  const EffectComposerContext = createContext(null);
@@ -489,6 +490,15 @@ const SSAO = forwardRef(function SSAO(props, ref) {
489
490
  return jsx("primitive", { ref: ref, object: effect, dispose: null });
490
491
  });
491
492
 
493
+ const N8AO = forwardRef((props, ref) => {
494
+ const { camera, scene, size } = useThree();
495
+ const effect = useMemo(() => new N8AOPostPass(scene, camera, size.width, size.height), []);
496
+ useLayoutEffect(() => {
497
+ Object.assign(effect.configuration, props);
498
+ }, [props]);
499
+ return jsx("primitive", { ref: ref, object: effect });
500
+ });
501
+
492
502
  const SMAA = wrapEffect(SMAAEffect);
493
503
 
494
504
  const Texture = forwardRef(function Texture({ textureSrc, texture, ...props }, ref) {
@@ -626,4 +636,4 @@ const SSR = forwardRef(function SSR({ ENABLE_BLUR = true, USE_MRT = true, ...pro
626
636
  return jsx("primitive", { ref: ref, object: effect, ...props });
627
637
  });
628
638
 
629
- export { Autofocus, Bloom, BrightnessContrast, ChromaticAberration, ColorAverage, ColorDepth, Depth, DepthOfField, DotScreen, EffectComposer, EffectComposerContext, Glitch, GodRays, Grid, HueSaturation, LUT, Noise, Outline, Pixelation, SMAA, SSAO, SSR, Scanline, Select, Selection, SelectiveBloom, Sepia, ShockWave, Texture, TiltShift, TiltShift2, TiltShiftEffect, ToneMapping, Vignette, resolveRef, selectionContext, useVector2, wrapEffect };
639
+ export { Autofocus, Bloom, BrightnessContrast, ChromaticAberration, ColorAverage, ColorDepth, Depth, DepthOfField, DotScreen, EffectComposer, EffectComposerContext, Glitch, GodRays, Grid, HueSaturation, LUT, N8AO, Noise, Outline, Pixelation, SMAA, SSAO, SSR, Scanline, Select, Selection, SelectiveBloom, Sepia, ShockWave, Texture, TiltShift, TiltShift2, TiltShiftEffect, ToneMapping, Vignette, resolveRef, selectionContext, useVector2, wrapEffect };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-three/postprocessing",
3
- "version": "2.11.5",
3
+ "version": "2.12.0",
4
4
  "description": "postprocessing wrapper for React and @react-three/fiber",
5
5
  "keywords": [
6
6
  "postprocessing",
@@ -48,6 +48,7 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "maath": "^0.5.3",
51
+ "n8ao": "^1.2.1",
51
52
  "postprocessing": "^6.30.2",
52
53
  "screen-space-reflections": "2.5.0",
53
54
  "three-stdlib": "^2.21.10"
@@ -95,6 +96,6 @@
95
96
  "peerDependencies": {
96
97
  "@react-three/fiber": ">=8.0",
97
98
  "react": ">=18.0",
98
- "three": ">= 0.138.0 < 0.152.0"
99
+ "three": ">= 0.138.0"
99
100
  }
100
101
  }