Skip to content

Commit 698dfcd

Browse files
committed
Examples: Added OrbitControls to webgpu_postprocessing_dof_basic.
1 parent 325557f commit 698dfcd

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed
Loading

examples/webgpu_postprocessing_dof_basic.html

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
body {
1010
touch-action: none;
1111
color: #000000;
12+
background: #90D5FF;
1213
}
1314
a {
1415
color: #2983ff;
@@ -42,14 +43,15 @@
4243
import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js';
4344
import { fxaa } from 'three/addons/tsl/display/FXAANode.js';
4445

46+
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
4547
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
4648
import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js';
4749
import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js';
4850

4951
import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
5052
import TWEEN from 'three/addons/libs/tween.module.js';
5153

52-
let camera, scene, timer, renderer, model, mixer, raycaster, postProcessing;
54+
let camera, controls, scene, timer, renderer, model, mixer, raycaster, postProcessing;
5355

5456
const pointerCoords = new THREE.Vector2();
5557
const focusPoint = new THREE.Vector3( 1, 1.75, - 0.4 );
@@ -60,8 +62,12 @@
6062
async function init() {
6163

6264
camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 0.1, 100 );
63-
camera.position.set( - 5, 4, 5 );
64-
camera.lookAt( 0, 1.5, 0 );
65+
camera.position.set( - 6, 5, 6 );
66+
67+
controls = new OrbitControls( camera );
68+
controls.target.set( 0, 2, 0 );
69+
controls.enableDamping = true;
70+
controls.update();
6571

6672
scene = new THREE.Scene();
6773
scene.background = new THREE.Color( 0x90D5FF );
@@ -138,6 +144,8 @@
138144

139145
//
140146

147+
controls.connect( renderer.domElement );
148+
141149
renderer.domElement.addEventListener( 'pointerdown', onPointerDown );
142150

143151
window.addEventListener( 'resize', onWindowResize );
@@ -181,6 +189,8 @@
181189

182190
TWEEN.update();
183191

192+
controls.update();
193+
184194
timer.update();
185195

186196
mixer.update( timer.getDelta() );

0 commit comments

Comments
 (0)