-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScene.js
More file actions
50 lines (36 loc) · 1.44 KB
/
Scene.js
File metadata and controls
50 lines (36 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import * as THREE from 'three'
import { buildAxes } from './Axes'
export default function initScene () {
const scene = new THREE.Scene();
scene.fog = new THREE.FogExp2(0x000000, 0.005);
scene.add(new THREE.AmbientLight(0xcccccc));
const directionalLight = new THREE.DirectionalLight(0xeeeeee);
directionalLight.position.x = Math.random() - 0.5;
directionalLight.position.y = Math.random();
directionalLight.position.z = Math.random() - 0.5;
directionalLight.position.normalize();
scene.add(directionalLight);
const axes = buildAxes(6);
scene.add(axes);
const grids = new THREE.Object3D();
const gridX = new THREE.GridHelper(20, 50);
grids.add(gridX);
//const gridY = new THREE.GridHelper(20, 50);
//gridY.rotateX(Math.PI / 2);
//grids.add(gridY);
//const gridZ = new THREE.GridHelper(20, 50);
//gridZ.rotateZ(Math.PI / 2);
//grids.add(gridZ);
scene.add(grids);
//const clock = new THREE.Clock();
//stats = new Stats();
//container.appendChild(stats.dom);
//window.addEventListener('resize', onWindowResize, false);
//document.addEventListener('mousewheel', onDocumentMouseWheel, false);
////Firefox
//document.addEventListener('DOMMouseScroll', onDocumentMouseWheel, false);
//document.addEventListener('mousemove', onDocumentMouseMove, false);
//document.addEventListener('mousedown', onDocumentMouseDown, false);
//document.addEventListener('mouseup', onDocumentMouseUp, false);
return scene
}