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