mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 13:03:36 +00:00
Format all C++ and Java code via clang-format
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
@@ -4,8 +4,8 @@
|
||||
|
||||
#include "drape/drape_global.hpp"
|
||||
#include "drape/glsl_types.hpp"
|
||||
#include "drape/graphics_context.hpp"
|
||||
#include "drape/gpu_program.hpp"
|
||||
#include "drape/graphics_context.hpp"
|
||||
#include "drape/pointers.hpp"
|
||||
|
||||
#include "base/assert.hpp"
|
||||
@@ -28,22 +28,24 @@ private:
|
||||
static std::map<std::string, std::string> m_boundParams;
|
||||
};
|
||||
|
||||
#define BIND_PROGRAMS(ParamsType, ...) \
|
||||
static std::vector<gpu::Program> const & GetBoundPrograms() \
|
||||
{ \
|
||||
static std::vector<gpu::Program> programs = {__VA_ARGS__}; \
|
||||
return programs; \
|
||||
} \
|
||||
static std::string GetName() { return std::string(#ParamsType); } \
|
||||
static void BindPrograms(std::map<std::string, std::string> & params) \
|
||||
{ \
|
||||
for (auto const p : GetBoundPrograms()) \
|
||||
{ \
|
||||
auto const programName = DebugPrint(p); \
|
||||
CHECK(params.find(programName) == params.cend(), \
|
||||
("Program has already bound", programName)); \
|
||||
params[programName] = GetName(); \
|
||||
} \
|
||||
#define BIND_PROGRAMS(ParamsType, ...) \
|
||||
static std::vector<gpu::Program> const & GetBoundPrograms() \
|
||||
{ \
|
||||
static std::vector<gpu::Program> programs = {__VA_ARGS__}; \
|
||||
return programs; \
|
||||
} \
|
||||
static std::string GetName() \
|
||||
{ \
|
||||
return std::string(#ParamsType); \
|
||||
} \
|
||||
static void BindPrograms(std::map<std::string, std::string> & params) \
|
||||
{ \
|
||||
for (auto const p : GetBoundPrograms()) \
|
||||
{ \
|
||||
auto const programName = DebugPrint(p); \
|
||||
CHECK(params.find(programName) == params.cend(), ("Program has already bound", programName)); \
|
||||
params[programName] = GetName(); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define ALIGNMENT alignas(16)
|
||||
@@ -63,37 +65,15 @@ struct ALIGNMENT MapProgramParams
|
||||
float m_zScale = 1.0f;
|
||||
float m_interpolation = 1.0f;
|
||||
float m_isOutlinePass = 1.0f;
|
||||
|
||||
BIND_PROGRAMS(MapProgramParams,
|
||||
Program::Area,
|
||||
Program::Area3d,
|
||||
Program::Area3dOutline,
|
||||
Program::AreaOutline,
|
||||
Program::Bookmark,
|
||||
Program::BookmarkAnim,
|
||||
Program::BookmarkAnimBillboard,
|
||||
Program::BookmarkBillboard,
|
||||
Program::CapJoin,
|
||||
Program::CirclePoint,
|
||||
Program::ColoredSymbol,
|
||||
Program::ColoredSymbolBillboard,
|
||||
Program::DashedLine,
|
||||
Program::TransparentArea,
|
||||
Program::HatchingArea,
|
||||
Program::Line,
|
||||
Program::MaskedTexturing,
|
||||
Program::MaskedTexturingBillboard,
|
||||
Program::PathSymbol,
|
||||
Program::Text,
|
||||
Program::TextBillboard,
|
||||
Program::TextOutlined,
|
||||
Program::TextOutlinedBillboard,
|
||||
Program::Texturing,
|
||||
Program::TexturingBillboard,
|
||||
Program::BookmarkAboveText,
|
||||
Program::BookmarkAnimAboveText,
|
||||
Program::BookmarkAnimAboveTextBillboard,
|
||||
Program::BookmarkAboveTextBillboard)
|
||||
|
||||
BIND_PROGRAMS(MapProgramParams, Program::Area, Program::Area3d, Program::Area3dOutline, Program::AreaOutline,
|
||||
Program::Bookmark, Program::BookmarkAnim, Program::BookmarkAnimBillboard, Program::BookmarkBillboard,
|
||||
Program::CapJoin, Program::CirclePoint, Program::ColoredSymbol, Program::ColoredSymbolBillboard,
|
||||
Program::DashedLine, Program::TransparentArea, Program::HatchingArea, Program::Line,
|
||||
Program::MaskedTexturing, Program::MaskedTexturingBillboard, Program::PathSymbol, Program::Text,
|
||||
Program::TextBillboard, Program::TextOutlined, Program::TextOutlinedBillboard, Program::Texturing,
|
||||
Program::TexturingBillboard, Program::BookmarkAboveText, Program::BookmarkAnimAboveText,
|
||||
Program::BookmarkAnimAboveTextBillboard, Program::BookmarkAboveTextBillboard)
|
||||
};
|
||||
|
||||
struct ALIGNMENT RouteProgramParams
|
||||
@@ -112,12 +92,8 @@ struct ALIGNMENT RouteProgramParams
|
||||
glsl::vec2 m_angleCosSin;
|
||||
float m_arrowHalfWidth = 0.0f;
|
||||
float m_opacity = 1.0f;
|
||||
|
||||
BIND_PROGRAMS(RouteProgramParams,
|
||||
Program::Route,
|
||||
Program::RouteDash,
|
||||
Program::RouteArrow,
|
||||
Program::RouteMarker)
|
||||
|
||||
BIND_PROGRAMS(RouteProgramParams, Program::Route, Program::RouteDash, Program::RouteArrow, Program::RouteMarker)
|
||||
};
|
||||
|
||||
struct ALIGNMENT TrafficProgramParams
|
||||
@@ -144,16 +120,13 @@ struct ALIGNMENT TrafficProgramParams
|
||||
float m_outline = 0.0f;
|
||||
float m_opacity = 1.0f;
|
||||
|
||||
TrafficProgramParams()
|
||||
TrafficProgramParams()
|
||||
: m_outlineColorAligned(0.0f, 0.0f, 0.0f, 0.0f)
|
||||
, m_lightArrowColorAligned(0.0f, 0.0f, 0.0f, 0.0f)
|
||||
, m_darkArrowColorAligned(0.0f, 0.0f, 0.0f, 0.0f)
|
||||
{}
|
||||
|
||||
BIND_PROGRAMS(TrafficProgramParams,
|
||||
Program::Traffic,
|
||||
Program::TrafficLine,
|
||||
Program::TrafficCircle)
|
||||
BIND_PROGRAMS(TrafficProgramParams, Program::Traffic, Program::TrafficLine, Program::TrafficCircle)
|
||||
};
|
||||
|
||||
struct ALIGNMENT TransitProgramParams
|
||||
@@ -171,10 +144,7 @@ struct ALIGNMENT TransitProgramParams
|
||||
|
||||
TransitProgramParams() : m_paramsAligned(0.0f, 0.0f, 0.0f, 0.0f) {}
|
||||
|
||||
BIND_PROGRAMS(TransitProgramParams,
|
||||
Program::Transit,
|
||||
Program::TransitCircle,
|
||||
Program::TransitMarker)
|
||||
BIND_PROGRAMS(TransitProgramParams, Program::Transit, Program::TransitCircle, Program::TransitMarker)
|
||||
};
|
||||
|
||||
struct ALIGNMENT GuiProgramParams
|
||||
@@ -187,11 +157,8 @@ struct ALIGNMENT GuiProgramParams
|
||||
float m_opacity = 1.0f;
|
||||
float m_length = 0.0f;
|
||||
|
||||
BIND_PROGRAMS(GuiProgramParams,
|
||||
Program::TextStaticOutlinedGui,
|
||||
Program::TextOutlinedGui,
|
||||
Program::TexturingGui,
|
||||
Program::Ruler)
|
||||
BIND_PROGRAMS(GuiProgramParams, Program::TextStaticOutlinedGui, Program::TextOutlinedGui, Program::TexturingGui,
|
||||
Program::Ruler)
|
||||
};
|
||||
|
||||
struct ALIGNMENT ShapesProgramParams
|
||||
@@ -212,10 +179,7 @@ struct ALIGNMENT ShapesProgramParams
|
||||
|
||||
ShapesProgramParams() : m_positionAligned(0.0f, 0.0f, 0.0f, 0.0f) {}
|
||||
|
||||
BIND_PROGRAMS(ShapesProgramParams,
|
||||
Program::Accuracy,
|
||||
Program::MyPosition,
|
||||
Program::SelectionLine)
|
||||
BIND_PROGRAMS(ShapesProgramParams, Program::Accuracy, Program::MyPosition, Program::SelectionLine)
|
||||
};
|
||||
|
||||
struct ALIGNMENT Arrow3dProgramParams
|
||||
@@ -225,11 +189,8 @@ struct ALIGNMENT Arrow3dProgramParams
|
||||
glsl::vec4 m_color;
|
||||
glsl::vec2 m_texCoordFlipping;
|
||||
|
||||
BIND_PROGRAMS(Arrow3dProgramParams,
|
||||
Program::Arrow3d,
|
||||
Program::Arrow3dTextured,
|
||||
Program::Arrow3dShadow,
|
||||
Program::Arrow3dOutline)
|
||||
BIND_PROGRAMS(Arrow3dProgramParams, Program::Arrow3d, Program::Arrow3dTextured, Program::Arrow3dShadow,
|
||||
Program::Arrow3dOutline)
|
||||
};
|
||||
|
||||
struct ALIGNMENT DebugRectProgramParams
|
||||
@@ -251,18 +212,14 @@ struct ALIGNMENT SMAAProgramParams
|
||||
{
|
||||
glsl::vec4 m_framebufferMetrics;
|
||||
|
||||
BIND_PROGRAMS(SMAAProgramParams,
|
||||
Program::SmaaEdges,
|
||||
Program::SmaaBlendingWeight,
|
||||
Program::SmaaFinal)
|
||||
BIND_PROGRAMS(SMAAProgramParams, Program::SmaaEdges, Program::SmaaBlendingWeight, Program::SmaaFinal)
|
||||
};
|
||||
|
||||
struct ALIGNMENT ImGuiProgramParams
|
||||
{
|
||||
glsl::mat4 m_projection;
|
||||
|
||||
BIND_PROGRAMS(ImGuiProgramParams,
|
||||
Program::ImGui)
|
||||
BIND_PROGRAMS(ImGuiProgramParams, Program::ImGui)
|
||||
};
|
||||
|
||||
#undef ALIGNMENT
|
||||
@@ -271,27 +228,27 @@ class ProgramParamsSetter
|
||||
{
|
||||
public:
|
||||
virtual ~ProgramParamsSetter() = default;
|
||||
virtual void Apply(ref_ptr<dp::GraphicsContext> context,
|
||||
ref_ptr<dp::GpuProgram> program, MapProgramParams const & params) = 0;
|
||||
virtual void Apply(ref_ptr<dp::GraphicsContext> context,
|
||||
ref_ptr<dp::GpuProgram> program, RouteProgramParams const & params) = 0;
|
||||
virtual void Apply(ref_ptr<dp::GraphicsContext> context,
|
||||
ref_ptr<dp::GpuProgram> program, TrafficProgramParams const & params) = 0;
|
||||
virtual void Apply(ref_ptr<dp::GraphicsContext> context,
|
||||
ref_ptr<dp::GpuProgram> program, TransitProgramParams const & params) = 0;
|
||||
virtual void Apply(ref_ptr<dp::GraphicsContext> context,
|
||||
ref_ptr<dp::GpuProgram> program, GuiProgramParams const & params) = 0;
|
||||
virtual void Apply(ref_ptr<dp::GraphicsContext> context,
|
||||
ref_ptr<dp::GpuProgram> program, ShapesProgramParams const & params) = 0;
|
||||
virtual void Apply(ref_ptr<dp::GraphicsContext> context,
|
||||
ref_ptr<dp::GpuProgram> program, Arrow3dProgramParams const & params) = 0;
|
||||
virtual void Apply(ref_ptr<dp::GraphicsContext> context,
|
||||
ref_ptr<dp::GpuProgram> program, DebugRectProgramParams const & params) = 0;
|
||||
virtual void Apply(ref_ptr<dp::GraphicsContext> context,
|
||||
ref_ptr<dp::GpuProgram> program, ScreenQuadProgramParams const & params) = 0;
|
||||
virtual void Apply(ref_ptr<dp::GraphicsContext> context,
|
||||
ref_ptr<dp::GpuProgram> program, SMAAProgramParams const & params) = 0;
|
||||
virtual void Apply(ref_ptr<dp::GraphicsContext> context,
|
||||
ref_ptr<dp::GpuProgram> program, ImGuiProgramParams const & params) = 0;
|
||||
virtual void Apply(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::GpuProgram> program,
|
||||
MapProgramParams const & params) = 0;
|
||||
virtual void Apply(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::GpuProgram> program,
|
||||
RouteProgramParams const & params) = 0;
|
||||
virtual void Apply(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::GpuProgram> program,
|
||||
TrafficProgramParams const & params) = 0;
|
||||
virtual void Apply(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::GpuProgram> program,
|
||||
TransitProgramParams const & params) = 0;
|
||||
virtual void Apply(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::GpuProgram> program,
|
||||
GuiProgramParams const & params) = 0;
|
||||
virtual void Apply(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::GpuProgram> program,
|
||||
ShapesProgramParams const & params) = 0;
|
||||
virtual void Apply(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::GpuProgram> program,
|
||||
Arrow3dProgramParams const & params) = 0;
|
||||
virtual void Apply(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::GpuProgram> program,
|
||||
DebugRectProgramParams const & params) = 0;
|
||||
virtual void Apply(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::GpuProgram> program,
|
||||
ScreenQuadProgramParams const & params) = 0;
|
||||
virtual void Apply(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::GpuProgram> program,
|
||||
SMAAProgramParams const & params) = 0;
|
||||
virtual void Apply(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::GpuProgram> program,
|
||||
ImGuiProgramParams const & params) = 0;
|
||||
};
|
||||
} // namespace gpu
|
||||
|
||||
Reference in New Issue
Block a user