14 #include <glm/geometric.hpp>
15 #include <glm/vec3.hpp>
21 #include <unordered_map>
29 glm::vec3 pos = glm::vec3(0.f);
30 glm::vec3 normal = glm::vec3(0.f);
31 glm::vec3 tangent = glm::vec3(0.f);
34 using index_type =
u32;
35 using vertices = std::vector<vertex>;
36 using indices = std::vector<index_type>;
37 using indices_view = std::span<const index_type>;
47 namespace shape_indices
50 constexpr std::array<index_type, 60> icosahedron { {
51 1, 4, 0, 4, 9, 0, 4, 5, 9, 8, 5, 4, 1, 8, 4, 1, 10, 8, 10, 3, 8, 8, 3, 5, 3, 2, 5, 3, 7, 2,
52 3, 10, 7, 10, 6, 7, 6, 11, 7, 6, 0, 11, 6, 1, 0, 10, 1, 6, 11, 0, 9, 2, 11, 9, 5, 2, 9, 11, 2, 7,
55 constexpr std::array<index_type, 36> parallelogram = {
56 3, 1, 0, 2, 1, 3, 2, 5, 1, 6, 5, 2, 6, 4, 5, 7, 4, 6, 7, 0, 4, 3, 0, 7, 7, 2, 3, 6, 2, 7, 0, 5, 4, 1, 5, 0,
59 constexpr std::array<index_type, 6>
rect = { 0, 1, 3, 1, 2, 3 };
85 geometry
create_parallelogram(
float fSide1,
float fSide2,
float fSide3,
bool bFlatNormals =
true);
102 geometry
create_cube(
float fSide,
bool bFlatNormals =
true);
133 geometry
create_icosphere(
float fRadius,
size_t nDivides,
bool bFlatNormals =
false);
181 geometry
create_ellipse(
float fHorRadius,
float fVertRadius,
size_t nSides);
geometry create_cube(float fSide, bool bFlatNormals=true)
Create cube geometry.
geometry create_circle_lines(float fRadius, size_t nSides)
Create circle geometry for lines drawing.
geometry create_ellipse(float fHorRadius, float fVertRadius, size_t nSides)
Create ellipse geometry.
geometry create_icosahedron(float fRadius, bool bFlatNormals=true)
Create icosahedron geometry.
geometry create_square_lines(float fSideLength)
Create square geometry for lines drawing.
geometry create_parallelogram_lines(float fSide1, float fSide2, float fSide3)
Create parallelogram geometry for lines drawing.
geometry create_icosphere_lines(float fRadius, size_t nDivides)
Create icosphere geometry for lines drawing.
geometry create_ellipse_lines(float fHorRadius, float fVertRadius, size_t nSides)
Create ellipse geometry for lines drawing.
glm::vec3 create_tangent(const glm::vec3 &normal)
Create tangent vector for a given normal.
geometry create_parallelogram(float fSide1, float fSide2, float fSide3, bool bFlatNormals=true)
Create parallelogram geometry.
geometry create_square(float fSideLength)
Create square geometry.
geometry create_cube_lines(float fSide)
Create cube geometry for lines drawing.
indices transform_triangle_indices_to_lines(indices_view triangles)
Transform triangle indices to line indices.
geometry create_icosahedron_lines(float fRadius)
Create icosahedron geometry for lines drawing.
geometry create_circle(float fRadius, size_t nSides)
Create circle geometry for lines drawing.
geometry create_icosphere(float fRadius, size_t nDivides, bool bFlatNormals=false)
Create icosphere geometry.
geometry create_rect(float fWidth, float fHeight)
Create rectangle geometry.
geometry create_rect_lines(float fWidth, float fHeight)
Create rectangle geometry for lines drawing.
indices geomIndices
indices array
vertices geomVertices
vertices array
glm::vec3 offset
offset of the center
draw_mode eDrawMode
draw mode
uint32_t u32
0 .. 18 446 744 073 709 551 615