|
4 | 4 | <meta charset="utf-8" />
|
5 | 5 | <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
|
6 | 6 | <title>three.js webgpu - HDR Draw</title>
|
7 |
| - <link type="text/css" rel="stylesheet" href="main.css" /> |
| 7 | + <link type="text/css" rel="stylesheet" href="example.css"> |
8 | 8 | <style>
|
| 9 | + body { |
| 10 | + background-color: #fff; |
| 11 | + } |
9 | 12 | #no-hdr {
|
10 | 13 | position: absolute;
|
11 | 14 | font-family: monospace;
|
|
24 | 27 | </head>
|
25 | 28 | <body>
|
26 | 29 |
|
27 |
| - <div id="info" style="color: #000"> |
28 |
| - <a href="https://threejs.org" target="_blank" rel="noopener">threejs</a> - HDR Draw |
| 30 | + <div id="info" class="invert"> |
| 31 | + <a href="https://threejs.org/" target="_blank" rel="noopener" class="logo-link"></a> |
| 32 | + |
| 33 | + <div class="title-wrapper"> |
| 34 | + <a href="https://threejs.org/" target="_blank" rel="noopener">three.js</a><span>HDR</span> |
| 35 | + </div> |
| 36 | + |
| 37 | + <small> |
| 38 | + The demo produces a color output intended for HDR monitors. |
| 39 | + </small> |
29 | 40 | </div>
|
| 41 | + |
30 | 42 | <div id="no-hdr" style="display: none">
|
31 | 43 | <div>
|
32 | 44 | The browser says your device or monitor doesn't support HDR.<br />
|
|
53 | 65 | import { pass, uv, uniform } from 'three/tsl';
|
54 | 66 | import WebGPU from 'three/addons/capabilities/WebGPU.js';
|
55 | 67 | import { afterImage } from 'three/addons/tsl/display/AfterImageNode.js';
|
56 |
| - import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; |
| 68 | + import { Inspector } from 'three/addons/inspector/Inspector.js'; |
57 | 69 |
|
58 | 70 | import { ExtendedSRGBColorSpace, ExtendedSRGBColorSpaceImpl } from 'three/addons/math/ColorSpaces.js';
|
59 | 71 |
|
|
95 | 107 | renderer.outputColorSpace = ExtendedSRGBColorSpace;
|
96 | 108 | renderer.setPixelRatio( window.devicePixelRatio );
|
97 | 109 | renderer.setSize( window.innerWidth, window.innerHeight );
|
| 110 | + renderer.inspector = new Inspector(); |
98 | 111 | document.body.appendChild( renderer.domElement );
|
99 | 112 |
|
100 | 113 | const camera = new THREE.OrthographicCamera( 0, window.innerWidth, window.innerHeight, 0, 1, 2 );
|
|
152 | 165 | renderer.domElement.addEventListener( 'touchend', ( e ) => e.preventDefault(), { passive: false } );
|
153 | 166 |
|
154 | 167 | // GUI setup
|
155 |
| - const gui = new GUI(); |
| 168 | + const gui = renderer.inspector.createParameters( 'Settings' ); |
156 | 169 |
|
157 | 170 | const colorFolder = gui.addFolder( 'HDR' );
|
158 | 171 | colorFolder.add( params.intensity, 'value', 0, 10, 0.1 ).name( 'Intensity' );
|
159 |
| - colorFolder.open(); |
160 | 172 |
|
161 | 173 | const brushFolder = gui.addFolder( 'Brush Settings' );
|
162 | 174 | brushFolder.add( params.hardness, 'value', 0, 0.99, 0.01 ).name( 'Hardness' );
|
163 | 175 | brushFolder.add( params.radius, 'value', 0.1, 2.0, 0.01 ).name( 'Radius' );
|
164 |
| - brushFolder.open(); |
165 | 176 |
|
166 | 177 | const effectFolder = gui.addFolder( 'Effects' );
|
167 |
| - effectFolder |
168 |
| - .add( params.afterImageDecay, 'value', 0.9, 0.999, 0.001 ) |
169 |
| - .name( 'After Image Decay' ); |
170 |
| - effectFolder.open(); |
171 |
| - |
172 |
| - gui.open(); |
| 178 | + effectFolder.add( params.afterImageDecay, 'value', 0.9, 0.999, 0.001 ).name( 'After Image Decay' ); |
173 | 179 |
|
174 | 180 | // Resize handling
|
175 | 181 | function onResize() {
|
|
0 commit comments