-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest.html
94 lines (60 loc) · 1.84 KB
/
test.html
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!DOCTYPE html>
<html lang="en">
<head>
<title>test</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
</head>
<body>
<div id="container"></div>
<!-- <script src="three.min.js"></script> -->
<script src="three.js"></script>
<script src="OrbitControls.js"></script>
<script src="stats.min.js"></script>
<script src="Detector.js"></script>
<script>
var container, stats;
var camera, controls, scene, renderer;
//var cross;
init();
animate();
function init()
{
// LILLA ORGINAL CAMERA TRANSLATION
camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 1000 );
camera.position.z = 10;
controls = new THREE.OrbitControls( camera ); // -----------------
controls.addEventListener( 'change', render ); //----------------
scene = new THREE.Scene();
// world
var geometryBlock = new THREE.BoxGeometry( 2, 2, 2 );
var materialBlock = new THREE.MeshBasicMaterial({ color: 0xff0000, wireframe: false });
materialBlock.wireframe = true;
block = new THREE.Mesh( geometryBlock, materialBlock );
scene.add( block );
// renderer
renderer = new THREE.WebGLRenderer( { antialias: false } );
renderer.setSize( window.innerWidth, window.innerHeight );
container = document.getElementById( 'container' );
container.appendChild( renderer.domElement );
window.addEventListener( 'resize', onWindowResize, false );
}
function onWindowResize()
{
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize( window.innerWidth, window.innerHeight );
render();
}
function animate()
{
requestAnimationFrame( animate );
controls.update(); //---------------------
}
function render()
{
renderer.render( scene, camera );
}
</script>
</body>
</html>