-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
45 lines (32 loc) · 1.07 KB
/
main.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
40
41
42
43
44
45
var scene, camera, renderer;
init();
function init() {
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 10000);
camera.position.z = 1000;
var light = new THREE.DirectionalLight(0xffffff, 1, 100);
light.position.set(0, 1, 0); //default; light shining from top
scene.add(light);
renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setClearColor(0xEEEEEE);
// var manager = new THREE.LoadingManager();
// manager.onProgress = function(item, loaded, total) {
// console.log(item, loaded, total);
// };
var loader = new THREE.OBJLoader();
loader.load('models/Stick_Figure_by_Swp.OBJ',
function(object) {
object.position.set(0, 0, 0);
scene.add(object);
}
);
window.onload = function() {
document.body.appendChild(renderer.domElement);
}
render();
}
function render() {
requestAnimationFrame(render);
renderer.render(scene, camera);
}