-
Notifications
You must be signed in to change notification settings - Fork 6
/
scene.js
39 lines (30 loc) · 1.27 KB
/
scene.js
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
require('three/examples/js/geometries/TeapotBufferGeometry')
const scene = new THREE.Scene();
const light1 = new THREE.PointLight( 0xffffff );
light1.position.set( 500, 500, 500 );
scene.add( light1 );
const light2 = new THREE.PointLight( 0xffffff, 0.25 );
light2.position.set( - 500, - 500, - 500 );
scene.add( light2 );
wireframeMaterial = new THREE.MeshLambertMaterial({ wireframe: !true, color: 0x9900ee})
basicMaterial = new THREE.MeshBasicMaterial( { color: 0xe0e0e0 } )
sphere = new THREE.Mesh( new THREE.SphereGeometry( 200, 20, 10 ), wireframeMaterial );
scene.add( sphere );
plane = new THREE.Mesh( new THREE.PlaneBufferGeometry( 400, 400 ), wireframeMaterial );
plane.position.y = - 200;
plane.rotation.x = - Math.PI / 2;
scene.add( plane );
teapot = require('./teapot');
scene.add( teapot );
var geometry = new THREE.BoxGeometry( 200, 200, 200 );
for ( var i = 0; i < geometry.faces.length; i += 2 ) {
var hex = Math.random() * 0xffffff;
geometry.faces[ i ].color.setHex( hex );
geometry.faces[ i + 1 ].color.setHex( hex );
}
var material = new THREE.MeshBasicMaterial( { vertexColors: THREE.FaceColors, overdraw: 0.5 } );
cube = new THREE.Mesh( geometry, material );
cube.position.y = 150;
scene.add( cube );
objects = [cube, sphere, teapot];
module.exports = { scene };