80 lines
2.1 KiB
C
80 lines
2.1 KiB
C
#include <glm/glm.hpp>
|
|
// set up vertex data (and buffer(s)) and configure vertex attributes
|
|
// ------------------------------------------------------------------
|
|
float vertices[] = {
|
|
// back
|
|
-0.5f, -0.5f, -0.5f, 0.0f, 0.0f,
|
|
0.5f, -0.5f, -0.5f, 1.0f, 0.0f,
|
|
0.5f, 0.5f, -0.5f, 1.0f, 1.0f,
|
|
|
|
0.5f, 0.5f, -0.5f, 1.0f, 1.0f,
|
|
-0.5f, 0.5f, -0.5f, 0.0f, 1.0f,
|
|
-0.5f, -0.5f, -0.5f, 0.0f, 0.0f,
|
|
|
|
// front
|
|
-0.5f, -0.5f, 0.5f, 0.0f, 0.0f,
|
|
0.5f, -0.5f, 0.5f, 1.0f, 0.0f,
|
|
0.5f, 0.5f, 0.5f, 1.0f, 1.0f,
|
|
|
|
0.5f, 0.5f, 0.5f, 1.0f, 1.0f,
|
|
-0.5f, 0.5f, 0.5f, 0.0f, 1.0f,
|
|
-0.5f, -0.5f, 0.5f, 0.0f, 0.0f,
|
|
|
|
// left
|
|
-0.5f, 0.5f, 0.5f, 1.0f, 1.0f,
|
|
-0.5f, 0.5f, -0.5f, 0.0f, 1.0f,
|
|
-0.5f, -0.5f, -0.5f, 0.0f, 0.0f,
|
|
|
|
-0.5f, -0.5f, -0.5f, 0.0f, 0.0f,
|
|
-0.5f, -0.5f, 0.5f, 1.0f, 0.0f,
|
|
-0.5f, 0.5f, 0.5f, 1.0f, 1.0f,
|
|
|
|
// right
|
|
0.5f, 0.5f, 0.5f, 1.0f, 1.0f,
|
|
0.5f, 0.5f, -0.5f, 0.0f, 1.0f,
|
|
0.5f, -0.5f, -0.5f, 0.0f, 0.0f,
|
|
|
|
0.5f, -0.5f, -0.5f, 0.0f, 0.0f,
|
|
0.5f, -0.5f, 0.5f, 1.0f, 0.0f,
|
|
0.5f, 0.5f, 0.5f, 1.0f, 1.0f,
|
|
|
|
// down
|
|
-0.5f, -0.5f, -0.5f, 0.0f, 1.0f,
|
|
0.5f, -0.5f, -0.5f, 1.0f, 1.0f,
|
|
0.5f, -0.5f, 0.5f, 1.0f, 0.0f,
|
|
0.5f, -0.5f, 0.5f, 1.0f, 0.0f,
|
|
-0.5f, -0.5f, 0.5f, 0.0f, 0.0f,
|
|
-0.5f, -0.5f, -0.5f, 0.0f, 1.0f,
|
|
|
|
// up
|
|
-0.5f, 0.5f, -0.5f, 0.0f, 1.0f,
|
|
0.5f, 0.5f, -0.5f, 1.0f, 1.0f,
|
|
0.5f, 0.5f, 0.5f, 1.0f, 0.0f,
|
|
0.5f, 0.5f, 0.5f, 1.0f, 0.0f,
|
|
-0.5f, 0.5f, 0.5f, 0.0f, 0.0f,
|
|
-0.5f, 0.5f, -0.5f, 0.0f, 1.0f};
|
|
// world space positions of our cubes
|
|
glm::ivec3 cubePositions[] = {
|
|
glm::ivec3(0, 0, 0),
|
|
glm::ivec3(2, 5, -15),
|
|
glm::ivec3(-1, -2, -2),
|
|
glm::ivec3(-3, -2, -12),
|
|
glm::ivec3(2, -0, -3),
|
|
glm::ivec3(-1, 3, -7),
|
|
glm::ivec3(1, -2, -2),
|
|
glm::ivec3(1, 2, -2),
|
|
glm::ivec3(1, 0, -1),
|
|
glm::ivec3(-1, 1, -1)};
|
|
|
|
glm::ivec2 cubeTextures[] = {
|
|
glm::ivec2(1, 14),
|
|
glm::ivec2(8, 3),
|
|
glm::ivec2(0, 4),
|
|
glm::ivec2(1, 12),
|
|
glm::ivec2(1, 6),
|
|
|
|
glm::ivec2(0, 6),
|
|
glm::ivec2(1, 2),
|
|
glm::ivec2(0, 14),
|
|
glm::ivec2(3, 12),
|
|
glm::ivec2(1, 12)}; |