-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcobble.h
79 lines (74 loc) · 2.57 KB
/
cobble.h
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
// This file was generated by obj2h.py
// OBJ file: cobble.obj
#include "renderer/mesh.h"
#include "image.h"
vector3 vertices[] = {
{1.0, 1.0, -1.0},
{1.0, -1.0, -1.0},
{1.0, 1.0, 1.0},
{1.0, -1.0, 1.0},
{-1.0, 1.0, -1.0},
{-1.0, -1.0, -1.0},
{-1.0, 1.0, 1.0},
{-1.0, -1.0, 1.0},
};
// Texture coordinates
vector2 textureCoords[] = {
{1.0, 0.0},
{0.0, 1.0},
{0.0, 0.0},
{1.0, 0.0},
{0.0, 1.0},
{0.0, 0.0},
{1.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},
{0.0, 0.0},
{0.0, 1.0},
{1.0, 1.0},
{1.0, 1.0},
{1.0, 1.0},
{1.0, 1.0},
{1.0, 1.0},
};
triangle faces[] = {
{vertices[4], vertices[2], vertices[0], textureCoords[0], textureCoords[1], textureCoords[2]},
{vertices[2], vertices[7], vertices[3], textureCoords[3], textureCoords[4], textureCoords[5]},
{vertices[6], vertices[5], vertices[7], textureCoords[6], textureCoords[7], textureCoords[8]},
{vertices[1], vertices[7], vertices[5], textureCoords[9], textureCoords[4], textureCoords[10]},
{vertices[0], vertices[3], vertices[1], textureCoords[11], textureCoords[12], textureCoords[13]},
{vertices[4], vertices[1], vertices[5], textureCoords[0], textureCoords[14], textureCoords[10]},
{vertices[4], vertices[6], vertices[2], textureCoords[0], textureCoords[15], textureCoords[1]},
{vertices[2], vertices[6], vertices[7], textureCoords[3], textureCoords[15], textureCoords[4]},
{vertices[6], vertices[4], vertices[5], textureCoords[6], textureCoords[16], textureCoords[7]},
{vertices[1], vertices[3], vertices[7], textureCoords[9], textureCoords[17], textureCoords[4]},
{vertices[0], vertices[2], vertices[3], textureCoords[11], textureCoords[18], textureCoords[12]},
{vertices[4], vertices[0], vertices[1], textureCoords[0], textureCoords[19], textureCoords[14]},
};
// mesh cobble = {
// faces,
// 12,
// new transformation({
// new vector3({0, 0, 0}), // Rotation
// new vector3({0, 0, 200}), // Translation
// new vector3({100, 100, 100}), // Scale
// }),
// &texture_image
// };
mesh *genCobble(double x, double y, double z, double scale)
{
mesh *cobble = new mesh();
cobble->triangles = faces;
cobble->numTriangles = 12;
cobble->transformation = new transformation({
new vector3({0, 0, 0}), // Rotation
new vector3({x*scale, y*scale, z*scale + 100}), // Translation
new vector3({scale/2, scale/2, scale/2}), // Scale
});
cobble->texture = &texture_image;
return cobble;
}