summaryrefslogtreecommitdiff
path: root/gen.cpp
blob: 5ac79d0336f20d814cd25b103cb7f966e4e8b116 (plain)
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
#include <stdio.h>
int main () {
	float vertexdata[] = {
		-0.5, 0.5, -.5, // x y z
		0.5, 0.5, -.5,
		0.5, -0.5, -.5,
		-0.5, -0.5, -.5,
		-0.5, 0.5, 0.5, // x y z
		0.5, 0.5, 0.5,
		0.5, -0.5, 0.5,
		-0.5, -0.5, 0.5,
		//normal positions : 8
		1.0, 0.0, 0.0,
		-1.0, 0.0, 0.0,
		0.0, 1.0, 0.0,
		0.0, -1.0, 0.0,
		0.0, 0.0, 1.0,
		0.0, 0.0, -1.0,
		//texcoords : 14
		0.0, 0.0, 0.0,
		1.0, 0.0, 0.0,
		0.0, 1.0, 0.0,
		1.0, 1.0, 0.0,
	};
	//polygons of the box mode based on the vertex data.
	//they must be clockwise from the front so that they are culled when not
	//seen
	int elementdata[] = {
		0,13,16, 1,13,17, 3,13,14,
		3,13,14, 1,13,17, 2,13,15,

		1,8,16, 5,8,17, 2,8,14,
		2,8,14, 5,8,17, 6,8,15,

		5,12,16, 4,12,17, 6,12,14,
		4,12,17, 7,12,15, 6,12,14,

		4,9,16, 0,9,17, 7,9,14,
		0,9,17, 3,9,15, 7,9,14,

		3,11,14, 6,11,17, 7,11,16,
		2,11,15, 6,11,17, 3,11,14,

		0,10,14, 4,10,15, 5,10,17,
		5,10,17, 1,10,16, 0,10,14,
	};
	int i = 0;
	printf("float vertexdata[] = {\n");
	while (i < 108) {
		printf("%f,%f,%f, ",vertexdata[(elementdata[i] * 3)],vertexdata[(elementdata[i] * 3) + 1],vertexdata[(elementdata[i] * 3 )+ 2]);
		if (((i + 1) % 9) == 0) {
			printf("\n");
		} else if (((i + 1) % 3) == 0) {
			printf("\t");
		}
		i++;
	}
	printf("};");
	return 0;
}