-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotMyThree.js
111 lines (76 loc) · 2.63 KB
/
notMyThree.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
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
function loc() {
var geometry = new THREE.Geometry();
var min = size / 2 * -1;
var max = size / 2;
geometry.vertices.push(
new THREE.Vector3(min,min,min),
new THREE.Vector3(min, min, max),
new THREE.Vector3(max,min,min),
new THREE.Vector3(max, min, max),
new THREE.Vector3(min, max, min),
new THREE.Vector3(min, max, max),
new THREE.Vector3(max,max,min),
new THREE.Vector3(max, max, max),
new THREE.Vector3(min,min,min),
new THREE.Vector3(max, min, min),
new THREE.Vector3(max,min,min),
new THREE.Vector3(max, max, min),
new THREE.Vector3(min,max,min),
new THREE.Vector3(max, max, min),
new THREE.Vector3(min,max,min),
new THREE.Vector3(min, min, min),
new THREE.Vector3(min,min,max),
new THREE.Vector3(max, min, max),
new THREE.Vector3(max,min,max),
new THREE.Vector3(max, max, max),
new THREE.Vector3(min,max,max),
new THREE.Vector3(max, max, max),
new THREE.Vector3(min,max,max),
new THREE.Vector3(min, min, max)
);
return geometry;
}
function cube(size) {
var h = size * .5;
var geometry = new THREE.Geometry();
geometry.vertices.push(
new THREE.Vector3(-h, -h, -h),
new THREE.Vector3(-h, h, -h),
new THREE.Vector3(-h, h, -h),
new THREE.Vector3(h, h, -h),
new THREE.Vector3(h, h, -h),
new THREE.Vector3(h, -h, -h),
new THREE.Vector3(h, -h, -h),
new THREE.Vector3(-h, -h, -h),
new THREE.Vector3(-h, -h, h),
new THREE.Vector3(-h, h, h),
new THREE.Vector3(-h, h, h),
new THREE.Vector3(h, h, h),
new THREE.Vector3(h, h, h),
new THREE.Vector3(h, -h, h),
new THREE.Vector3(h, -h, h),
new THREE.Vector3(-h, -h, h),
new THREE.Vector3(-h, -h, -h),
new THREE.Vector3(-h, -h, h),
new THREE.Vector3(-h, h, -h),
new THREE.Vector3(-h, h, h),
new THREE.Vector3(h, h, -h),
new THREE.Vector3(h, h, h),
new THREE.Vector3(h, -h, -h),
new THREE.Vector3(h, -h, h)
);
return geometry;
}
function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
}
function animate() {
requestAnimationFrame(animate);
render();
}
function render() {
var time = Date.now() * 0.001;
renderer.render(scene, camera);
}