feat(p_cube.hpp): add vertice & indice length

This commit is contained in:
2026-01-06 22:13:09 +01:00
parent cc956449c7
commit 92e190c1a4
11 changed files with 175 additions and 169 deletions

View File

@@ -1,65 +1,86 @@
#ifndef P_CUBE_HPP
#define P_CUBE_HPP
#include <cstddef>
#include "GLFW/glfw3.h"
constexpr GLfloat P_CUBE_VERTICE[] = {
// Positions // normales // texture coordinate
// front side
-0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f,
0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,
-0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f,
namespace mesh
{
// clang-format off
constexpr GLfloat P_CUBE_VERTICE[] = {
// Positions // normales // texture coordinate
// front side
-0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f,
0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,
-0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f,
// back side
-0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f,
0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f,
0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f,
-0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f,
// left side
-0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f,
-0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f,
-0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f,
-0.5f, 0.5f, -0.5f, -1.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.0f,
// right side
0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,
0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,
0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,
// bottom side
-0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f,
0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f,
0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f,
-0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f,
// up side
-0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f,
0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f,
0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f,
-0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,
};
constexpr const std::size_t P_CUBE_VERTICE_LEN =
sizeof(P_CUBE_VERTICE) / sizeof(GLfloat);
constexpr unsigned int P_CUBE_INDICE[] = {
0, 1, 2, // 1
2, 3, 0, // 2
0, 1, 2, // 1
2, 3, 0, // 2
4, 5, 6, // 3
6, 7, 4, // 4
4, 5, 6, // 3
6, 7, 4, // 4
8, 9, 10, // 5
10, 11, 8, // 6
8, 9, 10, // 5
10, 11, 8, // 6
12, 13, 14, // 7
14, 15, 12, // 8
12, 13, 14, // 7
14, 15, 12, // 8
16, 17, 18, // 9
18, 19, 16, // 10
16, 17, 18, // 9
18, 19, 16, // 10
20, 21, 22, // 11
22, 23, 20 // 12
};
20, 21, 22, // 11
22, 23, 20 // 12
};
extern "C" const unsigned char P_CUBE_FRAG[];
extern "C" const unsigned int P_CUBE_FRAG_LEN;
extern "C" const unsigned char P_CUBE_VERT[];
extern "C" const unsigned int P_CUBE_VERT_LEN;
constexpr const std::size_t P_CUBE_INDICE_LEN =
sizeof(P_CUBE_VERTICE) / sizeof(unsigned int);
extern "C"
{
extern const unsigned char CUBE_VERT[];
extern const unsigned int CUBE_VERT_LEN;
extern const unsigned char CUBE_FRAG[];
extern const unsigned int CUBE_FRAG_LEN;
}
} // namespace mesh
#endif