diff --git a/main.js b/main.js index 52f3fb0..349eeff 100644 --- a/main.js +++ b/main.js @@ -2,6 +2,8 @@ import * as THREE from 'three'; import * as SHAPES from './shapes.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + const NODE_SIZE = 0.07; const LINK_SIZE = 0.03; const NODE_OPACITY = 1.0; @@ -188,7 +190,7 @@ light.position.set(10, 10, 10); scene.add(light); -const amblight = new THREE.AmbientLight(0xffffff, 0.2); +const amblight = new THREE.AmbientLight(0xffffff, 0.5); scene.add(amblight); scene.background = new THREE.Color(0xdddddd); @@ -197,6 +199,14 @@ const renderer = new THREE.WebGLRenderer({antialias: true}); renderer.setSize( window.innerWidth, window.innerHeight ); document.body.appendChild( renderer.domElement ); + +const controls = new OrbitControls( camera, renderer.domElement ); +controls.target.set( 0, 0, 0 ); +controls.update(); +controls.enablePan = false; +controls.enableDamping = true; + + const node_m = new THREE.MeshStandardMaterial( { color: 0x990044 } ); @@ -228,6 +238,7 @@ scene.add(shape); camera.position.z = 4; + let theta = 0;