Move ui::painter_impl internals to anonymous namespace

This commit is contained in:
Nikita Lisitsa 2021-10-14 21:48:03 +03:00
parent 3a5e29835f
commit 3ec4d1ed90

View file

@ -10,7 +10,10 @@
namespace psemek::ui namespace psemek::ui
{ {
static char const colored_vs[] = namespace
{
char const colored_vs[] =
R"(#version 330 R"(#version 330
uniform mat4 u_transform; uniform mat4 u_transform;
@ -28,7 +31,7 @@ void main()
} }
)"; )";
static char const colored_fs[] = char const colored_fs[] =
R"(#version 330 R"(#version 330
in vec4 color; in vec4 color;
@ -41,7 +44,7 @@ void main()
} }
)"; )";
static char const bitmap_text_vs[] = char const bitmap_text_vs[] =
R"(#version 330 R"(#version 330
uniform mat4 u_transform; uniform mat4 u_transform;
@ -64,7 +67,7 @@ void main()
} }
)"; )";
static char const bitmap_text_fs[] = char const bitmap_text_fs[] =
R"(#version 330 R"(#version 330
uniform sampler2D u_atlas; uniform sampler2D u_atlas;
@ -80,7 +83,7 @@ void main()
} }
)"; )";
static char const textured_vs[] = char const textured_vs[] =
R"(#version 330 R"(#version 330
uniform mat4 u_transform; uniform mat4 u_transform;
@ -103,7 +106,7 @@ void main()
} }
)"; )";
static char const textured_fs[] = char const textured_fs[] =
R"(#version 330 R"(#version 330
uniform sampler2D u_texture; uniform sampler2D u_texture;
@ -119,66 +122,67 @@ void main()
} }
)"; )";
struct colored_vertex
{
geom::point<float, 2> position;
std::uint32_t depth;
gfx::color_rgba color;
};
static_assert(sizeof(colored_vertex) == 16);
struct colored_vertex struct colored_batch
{ {
geom::point<float, 2> position; std::vector<colored_vertex> vertices;
std::uint32_t depth; std::vector<std::uint32_t> indices;
gfx::color_rgba color; };
};
static_assert(sizeof(colored_vertex) == 16);
struct colored_batch bool operator == (colored_batch const &, colored_batch const &)
{ {
std::vector<colored_vertex> vertices; return true;
std::vector<std::uint32_t> indices; }
};
bool operator == (colored_batch const &, colored_batch const &) struct bitmap_text_vertex
{ {
return true; geom::point<float, 2> position;
} std::uint32_t depth;
gfx::color_rgba color;
geom::vector<std::uint16_t, 2> texcoords;
};
static_assert(sizeof(bitmap_text_vertex) == 20);
struct bitmap_text_vertex struct bitmap_text_batch
{ {
geom::point<float, 2> position; gfx::texture_2d const * atlas = nullptr;
std::uint32_t depth; std::vector<bitmap_text_vertex> vertices{};
gfx::color_rgba color; std::vector<std::uint32_t> indices{};
geom::vector<std::uint16_t, 2> texcoords; };
};
static_assert(sizeof(bitmap_text_vertex) == 20);
struct bitmap_text_batch bool operator == (bitmap_text_batch const & b1, bitmap_text_batch const & b2)
{ {
gfx::texture_2d const * atlas = nullptr; return b1.atlas == b2.atlas;
std::vector<bitmap_text_vertex> vertices{}; }
std::vector<std::uint32_t> indices{};
};
bool operator == (bitmap_text_batch const & b1, bitmap_text_batch const & b2) struct textured_vertex
{ {
return b1.atlas == b2.atlas; geom::point<float, 2> position;
} std::uint32_t depth;
gfx::color_rgba color;
geom::point<float, 2> texcoords;
};
static_assert(sizeof(textured_vertex) == 24);
struct textured_vertex struct textured_batch
{ {
geom::point<float, 2> position; gfx::texture_2d const * texture = nullptr;
std::uint32_t depth; std::vector<textured_vertex> vertices{};
gfx::color_rgba color; std::vector<std::uint32_t> indices{};
geom::point<float, 2> texcoords; };
};
static_assert(sizeof(textured_vertex) == 24);
struct textured_batch bool operator == (textured_batch const & b1, textured_batch const & b2)
{ {
gfx::texture_2d const * texture = nullptr; return b1.texture == b2.texture;
std::vector<textured_vertex> vertices{}; }
std::vector<std::uint32_t> indices{};
};
bool operator == (textured_batch const & b1, textured_batch const & b2)
{
return b1.texture == b2.texture;
} }
struct painter_impl::impl struct painter_impl::impl