@react-three/postprocessing 2.11.4 → 2.11.6
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 +20 -6
- package/dist/index.js +21 -7
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -79,19 +79,33 @@ const EffectComposer = React.memo(React.forwardRef(({ children, camera: _camera,
|
|
|
79
79
|
const group = React.useRef(null);
|
|
80
80
|
const instance = fiber.useInstanceHandle(group);
|
|
81
81
|
React.useLayoutEffect(() => {
|
|
82
|
-
|
|
82
|
+
const passes = [];
|
|
83
83
|
if (group.current && instance.current && composer) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
const children = instance.current.objects;
|
|
85
|
+
for (let i = 0; i < children.length; i++) {
|
|
86
|
+
const child = children[i];
|
|
87
|
+
if (child instanceof postprocessing.Effect) {
|
|
88
|
+
const effects = [];
|
|
89
|
+
while (children[i] instanceof postprocessing.Effect)
|
|
90
|
+
effects.push(children[i++]);
|
|
91
|
+
i--;
|
|
92
|
+
const pass = new postprocessing.EffectPass(camera, ...effects);
|
|
93
|
+
passes.push(pass);
|
|
94
|
+
}
|
|
95
|
+
else if (child instanceof postprocessing.Pass) {
|
|
96
|
+
passes.push(child);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
for (const pass of passes)
|
|
100
|
+
composer === null || composer === void 0 ? void 0 : composer.addPass(pass);
|
|
87
101
|
if (normalPass)
|
|
88
102
|
normalPass.enabled = true;
|
|
89
103
|
if (downSamplingPass)
|
|
90
104
|
downSamplingPass.enabled = true;
|
|
91
105
|
}
|
|
92
106
|
return () => {
|
|
93
|
-
|
|
94
|
-
composer === null || composer === void 0 ? void 0 : composer.removePass(
|
|
107
|
+
for (const pass of passes)
|
|
108
|
+
composer === null || composer === void 0 ? void 0 : composer.removePass(pass);
|
|
95
109
|
if (normalPass)
|
|
96
110
|
normalPass.enabled = false;
|
|
97
111
|
if (downSamplingPass)
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import * as THREE from 'three';
|
|
|
3
3
|
import { HalfFloatType, Vector3, TextureLoader, sRGBEncoding, RepeatWrapping, Uniform } from 'three';
|
|
4
4
|
import React, { createContext, forwardRef, useMemo, useEffect, useRef, useLayoutEffect, useImperativeHandle, useContext, useState, useCallback } from 'react';
|
|
5
5
|
import { useThree, useFrame, useInstanceHandle, createPortal, extend, useLoader } from '@react-three/fiber';
|
|
6
|
-
import { EffectComposer as EffectComposer$1, RenderPass, NormalPass, DepthDownsamplingPass, EffectPass, 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,
|
|
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
9
|
import { SSREffect } from 'screen-space-reflections';
|
|
@@ -59,19 +59,33 @@ const EffectComposer = React.memo(forwardRef(({ children, camera: _camera, scene
|
|
|
59
59
|
const group = useRef(null);
|
|
60
60
|
const instance = useInstanceHandle(group);
|
|
61
61
|
useLayoutEffect(() => {
|
|
62
|
-
|
|
62
|
+
const passes = [];
|
|
63
63
|
if (group.current && instance.current && composer) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
const children = instance.current.objects;
|
|
65
|
+
for (let i = 0; i < children.length; i++) {
|
|
66
|
+
const child = children[i];
|
|
67
|
+
if (child instanceof Effect) {
|
|
68
|
+
const effects = [];
|
|
69
|
+
while (children[i] instanceof Effect)
|
|
70
|
+
effects.push(children[i++]);
|
|
71
|
+
i--;
|
|
72
|
+
const pass = new EffectPass(camera, ...effects);
|
|
73
|
+
passes.push(pass);
|
|
74
|
+
}
|
|
75
|
+
else if (child instanceof Pass) {
|
|
76
|
+
passes.push(child);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
for (const pass of passes)
|
|
80
|
+
composer === null || composer === void 0 ? void 0 : composer.addPass(pass);
|
|
67
81
|
if (normalPass)
|
|
68
82
|
normalPass.enabled = true;
|
|
69
83
|
if (downSamplingPass)
|
|
70
84
|
downSamplingPass.enabled = true;
|
|
71
85
|
}
|
|
72
86
|
return () => {
|
|
73
|
-
|
|
74
|
-
composer === null || composer === void 0 ? void 0 : composer.removePass(
|
|
87
|
+
for (const pass of passes)
|
|
88
|
+
composer === null || composer === void 0 ? void 0 : composer.removePass(pass);
|
|
75
89
|
if (normalPass)
|
|
76
90
|
normalPass.enabled = false;
|
|
77
91
|
if (downSamplingPass)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-three/postprocessing",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.6",
|
|
4
4
|
"description": "postprocessing wrapper for React and @react-three/fiber",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"postprocessing",
|
|
@@ -95,6 +95,6 @@
|
|
|
95
95
|
"peerDependencies": {
|
|
96
96
|
"@react-three/fiber": ">=8.0",
|
|
97
97
|
"react": ">=18.0",
|
|
98
|
-
"three": ">= 0.138.0
|
|
98
|
+
"three": ">= 0.138.0"
|
|
99
99
|
}
|
|
100
100
|
}
|