Added orbital camera

feature-big-polytopes
Mike Lynch 2023-07-24 12:34:48 +10:00
parent 97413eb7bb
commit 6b96d2b519
1 changed files with 12 additions and 1 deletions

13
main.js
View File

@ -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;