Skip to content

Commit b807f5c

Browse files
committed
Fix unreal bloom pass import.
1 parent 849ad18 commit b807f5c

File tree

1 file changed

+32
-33
lines changed

1 file changed

+32
-33
lines changed

example/bloom-effect/index.html

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,47 +5,46 @@
55
<script src="//unpkg.com/react-dom/umd/react-dom.production.min.js"></script>
66
<script src="//unpkg.com/babel-standalone"></script>
77

8+
<script src="//unpkg.com/three"></script>
9+
<script src="//unpkg.com/three/examples/js/postprocessing/Pass.js"></script>
10+
<script src="//unpkg.com/three/examples/js/shaders/CopyShader.js"></script>
11+
<script src="//unpkg.com/three/examples/js/shaders/LuminosityHighPassShader.js"></script>
12+
<script src="//unpkg.com/three/examples/js/postprocessing/UnrealBloomPass.js"></script>
13+
814
<script src="//unpkg.com/react-force-graph-3d"></script>
915
<!--<script src="../../src/packages/react-force-graph-3d/dist/react-force-graph-3d.js"></script>-->
1016
</head>
1117

1218
<body>
1319
<div id="graph"></div>
1420

15-
<script>
16-
UnrealBloomPassPromise = import('//cdn.skypack.dev/[email protected]/examples/jsm/postprocessing/UnrealBloomPass.js')
17-
.then(m => m.UnrealBloomPass);
18-
</script>
19-
2021
<script type="text/jsx">
21-
UnrealBloomPassPromise.then(UnrealBloomPass => {
22-
const { useRef, useEffect } = React;
23-
24-
fetch('../datasets/miserables.json').then(res => res.json()).then(data => {
25-
const FocusGraph = () => {
26-
const fgRef = useRef();
27-
28-
useEffect(() => {
29-
const bloomPass = new UnrealBloomPass();
30-
bloomPass.strength = 3;
31-
bloomPass.radius = 1;
32-
bloomPass.threshold = 0.1;
33-
fgRef.current.postProcessingComposer().addPass(bloomPass);
34-
}, []);
35-
36-
return <ForceGraph3D
37-
ref={fgRef}
38-
graphData={data}
39-
nodeLabel="id"
40-
nodeAutoColorBy="group"
41-
/>;
42-
};
43-
44-
ReactDOM.render(
45-
<FocusGraph/>,
46-
document.getElementById('graph')
47-
);
48-
});
22+
const { useRef, useEffect } = React;
23+
24+
fetch('../datasets/miserables.json').then(res => res.json()).then(data => {
25+
const FocusGraph = () => {
26+
const fgRef = useRef();
27+
28+
useEffect(() => {
29+
const bloomPass = new THREE.UnrealBloomPass();
30+
bloomPass.strength = 3;
31+
bloomPass.radius = 1;
32+
bloomPass.threshold = 0.1;
33+
fgRef.current.postProcessingComposer().addPass(bloomPass);
34+
}, []);
35+
36+
return <ForceGraph3D
37+
ref={fgRef}
38+
graphData={data}
39+
nodeLabel="id"
40+
nodeAutoColorBy="group"
41+
/>;
42+
};
43+
44+
ReactDOM.render(
45+
<FocusGraph/>,
46+
document.getElementById('graph')
47+
);
4948
});
5049
</script>
5150
</body>

0 commit comments

Comments
 (0)