-
Notifications
You must be signed in to change notification settings - Fork 0
/
walls.js
56 lines (48 loc) · 1.4 KB
/
walls.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
var wallWidth = 10.36, wallHeight = 6.84;
var wallVertices = [
[-wallWidth/2, -wallHeight/2, 2., 1.],
[-wallWidth/2, wallHeight/2, 2., 1.],
[ wallWidth/2, wallHeight/2, 2., 1.],
[ wallWidth/2, -wallHeight/2, 2., 1.],
[-wallWidth/2, -wallHeight/2, -9.1, 1.],
[-wallWidth/2, wallHeight/2, -9.1, 1.],
[ wallWidth/2, wallHeight/2, -9.1, 1.],
[ wallWidth/2, -wallHeight/2, -9.1, 1.]
];
function quad(a, b, c, d, v, t, n, buf,tan) {
buf.vArr.push(v[a]);
buf.tArr.push(t[1]);
buf.nArr.push(n);
buf.tanArr.push(tan);
buf.vArr.push(v[b]);
buf.tArr.push(t[0]);
buf.nArr.push(n);
buf.tanArr.push(tan);
buf.vArr.push(v[c]);
buf.tArr.push(t[3]);
buf.nArr.push(n);
buf.tanArr.push(tan);
buf.vArr.push(v[a]);
buf.tArr.push(t[1]);
buf.nArr.push(n);
buf.tanArr.push(tan);
buf.vArr.push(v[c]);
buf.tArr.push(t[3]);
buf.nArr.push(n);
buf.tanArr.push(tan);
buf.vArr.push(v[d]);
buf.tArr.push(t[2]);
buf.nArr.push(n);
buf.tanArr.push(tan);
}
function initWallBufs(v, t, buf)
{
quad(3, 2, 6, 7, v, t, [-1., 0., 0.], buf,[0.,1.,0.]);
quad(0, 3, 7, 4, v, t, [0., 1., 0.], buf,[1.,0.,0.]);
quad(2, 1, 5, 6, v, t, [0., -1., 0.], buf,[-1.,0.,0.]);
quad(1, 0, 4, 5, v, t, [1., 0., 0.], buf,[0.,-1.,0.]);
buf.vArr = flatten(buf.vArr);
buf.tArr = flatten(buf.tArr);
buf.nArr = flatten(buf.nArr);
buf.tanArr = flatten(buf.tanArr);
}