19 Cube(
const bool mirror_textures =
false)
21 auto generateTexCoords = [mirror_textures](
const glm::vec2& input) -> glm::vec2
23 return glm::vec2((mirror_textures ? (1.f-input.x) : input.x), input.y);
32 {.position = glm::vec3( 0.5f, 0.5f, -0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(0.0f, 0.0f))},
33 {.position = glm::vec3( 0.5f, -0.5f, -0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(0.0f, 1.0f))},
34 {.position = glm::vec3(-0.5f, -0.5f, -0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(1.0f, 1.0f))},
35 {.position = glm::vec3(-0.5f, -0.5f, -0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(1.0f, 1.0f))},
36 {.position = glm::vec3(-0.5f, 0.5f, -0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(1.0f, 0.0f))},
37 {.position = glm::vec3( 0.5f, 0.5f, -0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(0.0f, 0.0f))},
39 {.position = glm::vec3(-0.5f, -0.5f, 0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(0.0f, 1.0f))},
40 {.position = glm::vec3( 0.5f, -0.5f, 0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(1.0f, 1.0f))},
41 {.position = glm::vec3( 0.5f, 0.5f, 0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(1.0f, 0.0f))},
42 {.position = glm::vec3( 0.5f, 0.5f, 0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(1.0f, 0.0f))},
43 {.position = glm::vec3(-0.5f, 0.5f, 0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(0.0f, 0.0f))},
44 {.position = glm::vec3(-0.5f, -0.5f, 0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(0.0f, 1.0f))},
46 {.position = glm::vec3(-0.5f, 0.5f, 0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(1.0f, 0.0f))},
47 {.position = glm::vec3(-0.5f, 0.5f, -0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(0.0f, 0.0f))},
48 {.position = glm::vec3(-0.5f, -0.5f, -0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(0.0f, 1.0f))},
49 {.position = glm::vec3(-0.5f, -0.5f, -0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(0.0f, 1.0f))},
50 {.position = glm::vec3(-0.5f, -0.5f, 0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(1.0f, 1.0f))},
51 {.position = glm::vec3(-0.5f, 0.5f, 0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(1.0f, 0.0f))},
53 {.position = glm::vec3( 0.5f, -0.5f, -0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(1.0f, 1.0f))},
54 {.position = glm::vec3( 0.5f, 0.5f, -0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(1.0f, 0.0f))},
55 {.position = glm::vec3( 0.5f, 0.5f, 0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(0.0f, 0.0f))},
56 {.position = glm::vec3( 0.5f, 0.5f, 0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(0.0f, 0.0f))},
57 {.position = glm::vec3( 0.5f, -0.5f, 0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(0.0f, 1.0f))},
58 {.position = glm::vec3( 0.5f, -0.5f, -0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(1.0f, 1.0f))},
60 {.position = glm::vec3(-0.5f, -0.5f, -0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(1.0f, 1.0f))},
61 {.position = glm::vec3( 0.5f, -0.5f, -0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(1.0f, 0.0f))},
62 {.position = glm::vec3( 0.5f, -0.5f, 0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(0.0f, 0.0f))},
63 {.position = glm::vec3( 0.5f, -0.5f, 0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(0.0f, 0.0f))},
64 {.position = glm::vec3(-0.5f, -0.5f, 0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(0.0f, 1.0f))},
65 {.position = glm::vec3(-0.5f, -0.5f, -0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(1.0f, 1.0f))},
67 {.position = glm::vec3( 0.5f, 0.5f, 0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(0.0f, 1.0f))},
68 {.position = glm::vec3( 0.5f, 0.5f, -0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(1.0f, 1.0f))},
69 {.position = glm::vec3(-0.5f, 0.5f, -0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(1.0f, 0.0f))},
70 {.position = glm::vec3(-0.5f, 0.5f, -0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(1.0f, 0.0f))},
71 {.position = glm::vec3(-0.5f, 0.5f, 0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(0.0f, 0.0f))},
72 {.position = glm::vec3( 0.5f, 0.5f, 0.5f), .tex_coords_0 = generateTexCoords(glm::vec2(0.0f, 1.0f))}
75 indices.reserve(vertices.size());
77 for (
auto i = 0u; i<vertices.size(); ++i)
82 primitives = {{0, vertices.size()}};