mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 15:40:04 +00:00
Fix GLEW clang-tidy issues
This commit is contained in:
parent
331b2d855f
commit
a6f8547455
15 changed files with 176 additions and 95 deletions
|
|
@ -30,8 +30,8 @@ static const std::string logPrefix_ = "scwx::qt::gl::draw::draw_item";
|
||||||
class DrawItem::Impl
|
class DrawItem::Impl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Impl() {}
|
explicit Impl() = default;
|
||||||
~Impl() {}
|
~Impl() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
DrawItem::DrawItem() : p(std::make_unique<Impl>()) {}
|
DrawItem::DrawItem() : p(std::make_unique<Impl>()) {}
|
||||||
|
|
|
||||||
|
|
@ -186,6 +186,10 @@ void GeoIcons::Initialize()
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
|
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
|
||||||
glBufferData(GL_ARRAY_BUFFER, 0u, nullptr, GL_DYNAMIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, 0u, nullptr, GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
|
// NOLINTBEGIN(modernize-use-nullptr)
|
||||||
|
// NOLINTBEGIN(performance-no-int-to-ptr)
|
||||||
|
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
// aLatLong
|
// aLatLong
|
||||||
glVertexAttribPointer(0,
|
glVertexAttribPointer(0,
|
||||||
2,
|
2,
|
||||||
|
|
@ -261,6 +265,10 @@ void GeoIcons::Initialize()
|
||||||
reinterpret_cast<void*>(3 * sizeof(GLint)));
|
reinterpret_cast<void*>(3 * sizeof(GLint)));
|
||||||
glEnableVertexAttribArray(7);
|
glEnableVertexAttribArray(7);
|
||||||
|
|
||||||
|
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
// NOLINTEND(performance-no-int-to-ptr)
|
||||||
|
// NOLINTEND(modernize-use-nullptr)
|
||||||
|
|
||||||
p->dirty_ = true;
|
p->dirty_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -857,10 +865,11 @@ void GeoIcons::Impl::Update(bool textureAtlasChanged)
|
||||||
|
|
||||||
// Buffer texture data
|
// Buffer texture data
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_[1]);
|
glBindBuffer(GL_ARRAY_BUFFER, vbo_[1]);
|
||||||
glBufferData(GL_ARRAY_BUFFER,
|
glBufferData(
|
||||||
sizeof(float) * textureBuffer_.size(),
|
GL_ARRAY_BUFFER,
|
||||||
textureBuffer_.data(),
|
static_cast<GLsizeiptr>(sizeof(float) * textureBuffer_.size()),
|
||||||
GL_DYNAMIC_DRAW);
|
textureBuffer_.data(),
|
||||||
|
GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
lastTextureAtlasChanged_ = false;
|
lastTextureAtlasChanged_ = false;
|
||||||
}
|
}
|
||||||
|
|
@ -870,17 +879,19 @@ void GeoIcons::Impl::Update(bool textureAtlasChanged)
|
||||||
{
|
{
|
||||||
// Buffer vertex data
|
// Buffer vertex data
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_[0]);
|
glBindBuffer(GL_ARRAY_BUFFER, vbo_[0]);
|
||||||
glBufferData(GL_ARRAY_BUFFER,
|
glBufferData(
|
||||||
sizeof(float) * currentIconBuffer_.size(),
|
GL_ARRAY_BUFFER,
|
||||||
currentIconBuffer_.data(),
|
static_cast<GLsizeiptr>(sizeof(float) * currentIconBuffer_.size()),
|
||||||
GL_DYNAMIC_DRAW);
|
currentIconBuffer_.data(),
|
||||||
|
GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
// Buffer threshold data
|
// Buffer threshold data
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_[2]);
|
glBindBuffer(GL_ARRAY_BUFFER, vbo_[2]);
|
||||||
glBufferData(GL_ARRAY_BUFFER,
|
glBufferData(
|
||||||
sizeof(GLint) * currentIntegerBuffer_.size(),
|
GL_ARRAY_BUFFER,
|
||||||
currentIntegerBuffer_.data(),
|
static_cast<GLsizeiptr>(sizeof(GLint) * currentIntegerBuffer_.size()),
|
||||||
GL_DYNAMIC_DRAW);
|
currentIntegerBuffer_.data(),
|
||||||
|
GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
numVertices_ =
|
numVertices_ =
|
||||||
static_cast<GLsizei>(currentIconBuffer_.size() / kPointsPerVertex);
|
static_cast<GLsizei>(currentIconBuffer_.size() / kPointsPerVertex);
|
||||||
|
|
|
||||||
|
|
@ -175,6 +175,10 @@ void GeoLines::Initialize()
|
||||||
nullptr,
|
nullptr,
|
||||||
GL_DYNAMIC_DRAW);
|
GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
|
// NOLINTBEGIN(modernize-use-nullptr)
|
||||||
|
// NOLINTBEGIN(performance-no-int-to-ptr)
|
||||||
|
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
// aLatLong
|
// aLatLong
|
||||||
glVertexAttribPointer(0,
|
glVertexAttribPointer(0,
|
||||||
2,
|
2,
|
||||||
|
|
@ -238,6 +242,10 @@ void GeoLines::Initialize()
|
||||||
reinterpret_cast<void*>(3 * sizeof(GLint)));
|
reinterpret_cast<void*>(3 * sizeof(GLint)));
|
||||||
glEnableVertexAttribArray(7);
|
glEnableVertexAttribArray(7);
|
||||||
|
|
||||||
|
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
// NOLINTEND(performance-no-int-to-ptr)
|
||||||
|
// NOLINTEND(modernize-use-nullptr)
|
||||||
|
|
||||||
p->dirty_ = true;
|
p->dirty_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -667,17 +675,19 @@ void GeoLines::Impl::Update()
|
||||||
{
|
{
|
||||||
// Buffer lines data
|
// Buffer lines data
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_[0]);
|
glBindBuffer(GL_ARRAY_BUFFER, vbo_[0]);
|
||||||
glBufferData(GL_ARRAY_BUFFER,
|
glBufferData(
|
||||||
sizeof(float) * currentLinesBuffer_.size(),
|
GL_ARRAY_BUFFER,
|
||||||
currentLinesBuffer_.data(),
|
static_cast<GLsizeiptr>(sizeof(float) * currentLinesBuffer_.size()),
|
||||||
GL_DYNAMIC_DRAW);
|
currentLinesBuffer_.data(),
|
||||||
|
GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
// Buffer threshold data
|
// Buffer threshold data
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_[1]);
|
glBindBuffer(GL_ARRAY_BUFFER, vbo_[1]);
|
||||||
glBufferData(GL_ARRAY_BUFFER,
|
glBufferData(
|
||||||
sizeof(GLint) * currentIntegerBuffer_.size(),
|
GL_ARRAY_BUFFER,
|
||||||
currentIntegerBuffer_.data(),
|
static_cast<GLsizeiptr>(sizeof(GLint) * currentIntegerBuffer_.size()),
|
||||||
GL_DYNAMIC_DRAW);
|
currentIntegerBuffer_.data(),
|
||||||
|
GL_DYNAMIC_DRAW);
|
||||||
}
|
}
|
||||||
|
|
||||||
dirty_ = false;
|
dirty_ = false;
|
||||||
|
|
|
||||||
|
|
@ -140,6 +140,10 @@ void Icons::Initialize()
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
|
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
|
||||||
glBufferData(GL_ARRAY_BUFFER, 0u, nullptr, GL_DYNAMIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, 0u, nullptr, GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
|
// NOLINTBEGIN(modernize-use-nullptr)
|
||||||
|
// NOLINTBEGIN(performance-no-int-to-ptr)
|
||||||
|
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
// aVertex
|
// aVertex
|
||||||
glVertexAttribPointer(0,
|
glVertexAttribPointer(0,
|
||||||
2,
|
2,
|
||||||
|
|
@ -197,6 +201,10 @@ void Icons::Initialize()
|
||||||
static_cast<void*>(0));
|
static_cast<void*>(0));
|
||||||
glEnableVertexAttribArray(2);
|
glEnableVertexAttribArray(2);
|
||||||
|
|
||||||
|
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
// NOLINTEND(performance-no-int-to-ptr)
|
||||||
|
// NOLINTEND(modernize-use-nullptr)
|
||||||
|
|
||||||
p->dirty_ = true;
|
p->dirty_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -689,10 +697,11 @@ void Icons::Impl::Update(bool textureAtlasChanged)
|
||||||
|
|
||||||
// Buffer texture data
|
// Buffer texture data
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_[1]);
|
glBindBuffer(GL_ARRAY_BUFFER, vbo_[1]);
|
||||||
glBufferData(GL_ARRAY_BUFFER,
|
glBufferData(
|
||||||
sizeof(float) * textureBuffer_.size(),
|
GL_ARRAY_BUFFER,
|
||||||
textureBuffer_.data(),
|
static_cast<GLsizeiptr>(sizeof(float) * textureBuffer_.size()),
|
||||||
GL_DYNAMIC_DRAW);
|
textureBuffer_.data(),
|
||||||
|
GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
lastTextureAtlasChanged_ = false;
|
lastTextureAtlasChanged_ = false;
|
||||||
}
|
}
|
||||||
|
|
@ -702,10 +711,11 @@ void Icons::Impl::Update(bool textureAtlasChanged)
|
||||||
{
|
{
|
||||||
// Buffer vertex data
|
// Buffer vertex data
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_[0]);
|
glBindBuffer(GL_ARRAY_BUFFER, vbo_[0]);
|
||||||
glBufferData(GL_ARRAY_BUFFER,
|
glBufferData(
|
||||||
sizeof(float) * currentIconBuffer_.size(),
|
GL_ARRAY_BUFFER,
|
||||||
currentIconBuffer_.data(),
|
static_cast<GLsizeiptr>(sizeof(float) * currentIconBuffer_.size()),
|
||||||
GL_DYNAMIC_DRAW);
|
currentIconBuffer_.data(),
|
||||||
|
GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
numVertices_ =
|
numVertices_ =
|
||||||
static_cast<GLsizei>(currentIconBuffer_.size() / kPointsPerVertex);
|
static_cast<GLsizei>(currentIconBuffer_.size() / kPointsPerVertex);
|
||||||
|
|
|
||||||
|
|
@ -63,14 +63,12 @@ class LinkedVectors::Impl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Impl(std::shared_ptr<GlContext> context) :
|
explicit Impl(std::shared_ptr<GlContext> context) :
|
||||||
context_ {context}, geoLines_ {std::make_shared<GeoLines>(context)}
|
geoLines_ {std::make_shared<GeoLines>(context)}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
~Impl() {}
|
~Impl() {}
|
||||||
|
|
||||||
std::shared_ptr<GlContext> context_;
|
|
||||||
|
|
||||||
bool borderEnabled_ {true};
|
bool borderEnabled_ {true};
|
||||||
bool visible_ {true};
|
bool visible_ {true};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -182,6 +182,10 @@ void PlacefileIcons::Initialize()
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
|
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
|
||||||
glBufferData(GL_ARRAY_BUFFER, 0u, nullptr, GL_DYNAMIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, 0u, nullptr, GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
|
// NOLINTBEGIN(modernize-use-nullptr)
|
||||||
|
// NOLINTBEGIN(performance-no-int-to-ptr)
|
||||||
|
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
// aLatLong
|
// aLatLong
|
||||||
glVertexAttribPointer(0,
|
glVertexAttribPointer(0,
|
||||||
2,
|
2,
|
||||||
|
|
@ -252,6 +256,10 @@ void PlacefileIcons::Initialize()
|
||||||
// aDisplayed
|
// aDisplayed
|
||||||
glVertexAttribI1i(7, 1);
|
glVertexAttribI1i(7, 1);
|
||||||
|
|
||||||
|
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
// NOLINTEND(performance-no-int-to-ptr)
|
||||||
|
// NOLINTEND(modernize-use-nullptr)
|
||||||
|
|
||||||
p->dirty_ = true;
|
p->dirty_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -649,10 +657,11 @@ void PlacefileIcons::Impl::Update(bool textureAtlasChanged)
|
||||||
|
|
||||||
// Buffer texture data
|
// Buffer texture data
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_[1]);
|
glBindBuffer(GL_ARRAY_BUFFER, vbo_[1]);
|
||||||
glBufferData(GL_ARRAY_BUFFER,
|
glBufferData(
|
||||||
sizeof(float) * textureBuffer_.size(),
|
GL_ARRAY_BUFFER,
|
||||||
textureBuffer_.data(),
|
static_cast<GLsizeiptr>(sizeof(float) * textureBuffer_.size()),
|
||||||
GL_DYNAMIC_DRAW);
|
textureBuffer_.data(),
|
||||||
|
GL_DYNAMIC_DRAW);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If buffers need updating
|
// If buffers need updating
|
||||||
|
|
@ -660,17 +669,19 @@ void PlacefileIcons::Impl::Update(bool textureAtlasChanged)
|
||||||
{
|
{
|
||||||
// Buffer vertex data
|
// Buffer vertex data
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_[0]);
|
glBindBuffer(GL_ARRAY_BUFFER, vbo_[0]);
|
||||||
glBufferData(GL_ARRAY_BUFFER,
|
glBufferData(
|
||||||
sizeof(float) * currentIconBuffer_.size(),
|
GL_ARRAY_BUFFER,
|
||||||
currentIconBuffer_.data(),
|
static_cast<GLsizeiptr>(sizeof(float) * currentIconBuffer_.size()),
|
||||||
GL_DYNAMIC_DRAW);
|
currentIconBuffer_.data(),
|
||||||
|
GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
// Buffer threshold data
|
// Buffer threshold data
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_[2]);
|
glBindBuffer(GL_ARRAY_BUFFER, vbo_[2]);
|
||||||
glBufferData(GL_ARRAY_BUFFER,
|
glBufferData(
|
||||||
sizeof(GLint) * currentIntegerBuffer_.size(),
|
GL_ARRAY_BUFFER,
|
||||||
currentIntegerBuffer_.data(),
|
static_cast<GLsizeiptr>(sizeof(GLint) * currentIntegerBuffer_.size()),
|
||||||
GL_DYNAMIC_DRAW);
|
currentIntegerBuffer_.data(),
|
||||||
|
GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
numVertices_ =
|
numVertices_ =
|
||||||
static_cast<GLsizei>(currentIconBuffer_.size() / kPointsPerVertex);
|
static_cast<GLsizei>(currentIconBuffer_.size() / kPointsPerVertex);
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,10 @@ void PlacefileImages::Initialize()
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
|
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
|
||||||
glBufferData(GL_ARRAY_BUFFER, 0u, nullptr, GL_DYNAMIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, 0u, nullptr, GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
|
// NOLINTBEGIN(modernize-use-nullptr)
|
||||||
|
// NOLINTBEGIN(performance-no-int-to-ptr)
|
||||||
|
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
// aLatLong
|
// aLatLong
|
||||||
glVertexAttribPointer(0,
|
glVertexAttribPointer(0,
|
||||||
2,
|
2,
|
||||||
|
|
@ -221,6 +225,10 @@ void PlacefileImages::Initialize()
|
||||||
// aDisplayed
|
// aDisplayed
|
||||||
glVertexAttribI1i(7, 1);
|
glVertexAttribI1i(7, 1);
|
||||||
|
|
||||||
|
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
// NOLINTEND(performance-no-int-to-ptr)
|
||||||
|
// NOLINTEND(modernize-use-nullptr)
|
||||||
|
|
||||||
p->dirty_ = true;
|
p->dirty_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -446,10 +454,11 @@ void PlacefileImages::Impl::Update(bool textureAtlasChanged)
|
||||||
|
|
||||||
// Buffer texture data
|
// Buffer texture data
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_[1]);
|
glBindBuffer(GL_ARRAY_BUFFER, vbo_[1]);
|
||||||
glBufferData(GL_ARRAY_BUFFER,
|
glBufferData(
|
||||||
sizeof(float) * textureBuffer_.size(),
|
GL_ARRAY_BUFFER,
|
||||||
textureBuffer_.data(),
|
static_cast<GLsizeiptr>(sizeof(float) * textureBuffer_.size()),
|
||||||
GL_DYNAMIC_DRAW);
|
textureBuffer_.data(),
|
||||||
|
GL_DYNAMIC_DRAW);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If buffers need updating
|
// If buffers need updating
|
||||||
|
|
@ -457,17 +466,19 @@ void PlacefileImages::Impl::Update(bool textureAtlasChanged)
|
||||||
{
|
{
|
||||||
// Buffer vertex data
|
// Buffer vertex data
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_[0]);
|
glBindBuffer(GL_ARRAY_BUFFER, vbo_[0]);
|
||||||
glBufferData(GL_ARRAY_BUFFER,
|
glBufferData(
|
||||||
sizeof(float) * currentImageBuffer_.size(),
|
GL_ARRAY_BUFFER,
|
||||||
currentImageBuffer_.data(),
|
static_cast<GLsizeiptr>(sizeof(float) * currentImageBuffer_.size()),
|
||||||
GL_DYNAMIC_DRAW);
|
currentImageBuffer_.data(),
|
||||||
|
GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
// Buffer threshold data
|
// Buffer threshold data
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_[2]);
|
glBindBuffer(GL_ARRAY_BUFFER, vbo_[2]);
|
||||||
glBufferData(GL_ARRAY_BUFFER,
|
glBufferData(
|
||||||
sizeof(GLint) * currentIntegerBuffer_.size(),
|
GL_ARRAY_BUFFER,
|
||||||
currentIntegerBuffer_.data(),
|
static_cast<GLsizeiptr>(sizeof(GLint) * currentIntegerBuffer_.size()),
|
||||||
GL_DYNAMIC_DRAW);
|
currentIntegerBuffer_.data(),
|
||||||
|
GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
numVertices_ =
|
numVertices_ =
|
||||||
static_cast<GLsizei>(currentImageBuffer_.size() / kPointsPerVertex);
|
static_cast<GLsizei>(currentImageBuffer_.size() / kPointsPerVertex);
|
||||||
|
|
|
||||||
|
|
@ -148,6 +148,10 @@ void PlacefileLines::Initialize()
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
|
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
|
||||||
glBufferData(GL_ARRAY_BUFFER, 0u, nullptr, GL_DYNAMIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, 0u, nullptr, GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
|
// NOLINTBEGIN(modernize-use-nullptr)
|
||||||
|
// NOLINTBEGIN(performance-no-int-to-ptr)
|
||||||
|
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
// aLatLong
|
// aLatLong
|
||||||
glVertexAttribPointer(0,
|
glVertexAttribPointer(0,
|
||||||
2,
|
2,
|
||||||
|
|
@ -206,6 +210,10 @@ void PlacefileLines::Initialize()
|
||||||
// aDisplayed
|
// aDisplayed
|
||||||
glVertexAttribI1i(7, 1);
|
glVertexAttribI1i(7, 1);
|
||||||
|
|
||||||
|
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
// NOLINTEND(performance-no-int-to-ptr)
|
||||||
|
// NOLINTEND(modernize-use-nullptr)
|
||||||
|
|
||||||
p->dirty_ = true;
|
p->dirty_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -470,17 +478,19 @@ void PlacefileLines::Impl::Update()
|
||||||
{
|
{
|
||||||
// Buffer lines data
|
// Buffer lines data
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_[0]);
|
glBindBuffer(GL_ARRAY_BUFFER, vbo_[0]);
|
||||||
glBufferData(GL_ARRAY_BUFFER,
|
glBufferData(
|
||||||
sizeof(float) * currentLinesBuffer_.size(),
|
GL_ARRAY_BUFFER,
|
||||||
currentLinesBuffer_.data(),
|
static_cast<GLsizeiptr>(sizeof(float) * currentLinesBuffer_.size()),
|
||||||
GL_DYNAMIC_DRAW);
|
currentLinesBuffer_.data(),
|
||||||
|
GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
// Buffer threshold data
|
// Buffer threshold data
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_[1]);
|
glBindBuffer(GL_ARRAY_BUFFER, vbo_[1]);
|
||||||
glBufferData(GL_ARRAY_BUFFER,
|
glBufferData(
|
||||||
sizeof(GLint) * currentIntegerBuffer_.size(),
|
GL_ARRAY_BUFFER,
|
||||||
currentIntegerBuffer_.data(),
|
static_cast<GLsizeiptr>(sizeof(GLint) * currentIntegerBuffer_.size()),
|
||||||
GL_DYNAMIC_DRAW);
|
currentIntegerBuffer_.data(),
|
||||||
|
GL_DYNAMIC_DRAW);
|
||||||
}
|
}
|
||||||
|
|
||||||
dirty_ = false;
|
dirty_ = false;
|
||||||
|
|
|
||||||
|
|
@ -173,6 +173,10 @@ void PlacefilePolygons::Initialize()
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
|
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
|
||||||
glBufferData(GL_ARRAY_BUFFER, 0u, nullptr, GL_DYNAMIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, 0u, nullptr, GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
|
// NOLINTBEGIN(modernize-use-nullptr)
|
||||||
|
// NOLINTBEGIN(performance-no-int-to-ptr)
|
||||||
|
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
// aScreenCoord
|
// aScreenCoord
|
||||||
glVertexAttribPointer(0,
|
glVertexAttribPointer(0,
|
||||||
2,
|
2,
|
||||||
|
|
@ -219,6 +223,10 @@ void PlacefilePolygons::Initialize()
|
||||||
reinterpret_cast<void*>(1 * sizeof(GLint)));
|
reinterpret_cast<void*>(1 * sizeof(GLint)));
|
||||||
glEnableVertexAttribArray(4);
|
glEnableVertexAttribArray(4);
|
||||||
|
|
||||||
|
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
// NOLINTEND(performance-no-int-to-ptr)
|
||||||
|
// NOLINTEND(modernize-use-nullptr)
|
||||||
|
|
||||||
p->dirty_ = true;
|
p->dirty_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -316,17 +324,19 @@ void PlacefilePolygons::Impl::Update()
|
||||||
|
|
||||||
// Buffer vertex data
|
// Buffer vertex data
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_[0]);
|
glBindBuffer(GL_ARRAY_BUFFER, vbo_[0]);
|
||||||
glBufferData(GL_ARRAY_BUFFER,
|
glBufferData(
|
||||||
sizeof(GLfloat) * currentBuffer_.size(),
|
GL_ARRAY_BUFFER,
|
||||||
currentBuffer_.data(),
|
static_cast<GLsizeiptr>(sizeof(GLfloat) * currentBuffer_.size()),
|
||||||
GL_DYNAMIC_DRAW);
|
currentBuffer_.data(),
|
||||||
|
GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
// Buffer threshold data
|
// Buffer threshold data
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_[1]);
|
glBindBuffer(GL_ARRAY_BUFFER, vbo_[1]);
|
||||||
glBufferData(GL_ARRAY_BUFFER,
|
glBufferData(
|
||||||
sizeof(GLint) * currentIntegerBuffer_.size(),
|
GL_ARRAY_BUFFER,
|
||||||
currentIntegerBuffer_.data(),
|
static_cast<GLsizeiptr>(sizeof(GLint) * currentIntegerBuffer_.size()),
|
||||||
GL_DYNAMIC_DRAW);
|
currentIntegerBuffer_.data(),
|
||||||
|
GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
numVertices_ =
|
numVertices_ =
|
||||||
static_cast<GLsizei>(currentBuffer_.size() / kPointsPerVertex);
|
static_cast<GLsizei>(currentBuffer_.size() / kPointsPerVertex);
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,8 @@ static const auto logger_ = scwx::util::Logger::Create(logPrefix_);
|
||||||
class PlacefileText::Impl
|
class PlacefileText::Impl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Impl(const std::shared_ptr<GlContext>& context,
|
explicit Impl(const std::string& placefileName) :
|
||||||
const std::string& placefileName) :
|
placefileName_ {placefileName}
|
||||||
context_ {context}, placefileName_ {placefileName}
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -43,8 +42,6 @@ public:
|
||||||
float x,
|
float x,
|
||||||
float y);
|
float y);
|
||||||
|
|
||||||
std::shared_ptr<GlContext> context_;
|
|
||||||
|
|
||||||
std::string placefileName_;
|
std::string placefileName_;
|
||||||
|
|
||||||
bool thresholded_ {false};
|
bool thresholded_ {false};
|
||||||
|
|
@ -70,9 +67,8 @@ public:
|
||||||
std::vector<std::shared_ptr<types::ImGuiFont>> newFonts_ {};
|
std::vector<std::shared_ptr<types::ImGuiFont>> newFonts_ {};
|
||||||
};
|
};
|
||||||
|
|
||||||
PlacefileText::PlacefileText(const std::shared_ptr<GlContext>& context,
|
PlacefileText::PlacefileText(const std::string& placefileName) :
|
||||||
const std::string& placefileName) :
|
DrawItem(), p(std::make_unique<Impl>(placefileName))
|
||||||
DrawItem(), p(std::make_unique<Impl>(context, placefileName))
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
PlacefileText::~PlacefileText() = default;
|
PlacefileText::~PlacefileText() = default;
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,7 @@ namespace draw
|
||||||
class PlacefileText : public DrawItem
|
class PlacefileText : public DrawItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit PlacefileText(const std::shared_ptr<GlContext>& context,
|
explicit PlacefileText(const std::string& placefileName);
|
||||||
const std::string& placefileName);
|
|
||||||
~PlacefileText();
|
~PlacefileText();
|
||||||
|
|
||||||
PlacefileText(const PlacefileText&) = delete;
|
PlacefileText(const PlacefileText&) = delete;
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,10 @@ void PlacefileTriangles::Initialize()
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
|
glBindBuffer(GL_ARRAY_BUFFER, p->vbo_[0]);
|
||||||
glBufferData(GL_ARRAY_BUFFER, 0u, nullptr, GL_DYNAMIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, 0u, nullptr, GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
|
// NOLINTBEGIN(modernize-use-nullptr)
|
||||||
|
// NOLINTBEGIN(performance-no-int-to-ptr)
|
||||||
|
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
|
||||||
// aScreenCoord
|
// aScreenCoord
|
||||||
glVertexAttribPointer(0,
|
glVertexAttribPointer(0,
|
||||||
2,
|
2,
|
||||||
|
|
@ -163,6 +167,10 @@ void PlacefileTriangles::Initialize()
|
||||||
reinterpret_cast<void*>(1 * sizeof(GLint)));
|
reinterpret_cast<void*>(1 * sizeof(GLint)));
|
||||||
glEnableVertexAttribArray(4);
|
glEnableVertexAttribArray(4);
|
||||||
|
|
||||||
|
// NOLINTEND(cppcoreguidelines-avoid-magic-numbers)
|
||||||
|
// NOLINTEND(performance-no-int-to-ptr)
|
||||||
|
// NOLINTEND(modernize-use-nullptr)
|
||||||
|
|
||||||
p->dirty_ = true;
|
p->dirty_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -318,17 +326,19 @@ void PlacefileTriangles::Impl::Update()
|
||||||
|
|
||||||
// Buffer vertex data
|
// Buffer vertex data
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_[0]);
|
glBindBuffer(GL_ARRAY_BUFFER, vbo_[0]);
|
||||||
glBufferData(GL_ARRAY_BUFFER,
|
glBufferData(
|
||||||
sizeof(GLfloat) * currentBuffer_.size(),
|
GL_ARRAY_BUFFER,
|
||||||
currentBuffer_.data(),
|
static_cast<GLsizeiptr>(sizeof(GLfloat) * currentBuffer_.size()),
|
||||||
GL_DYNAMIC_DRAW);
|
currentBuffer_.data(),
|
||||||
|
GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
// Buffer threshold data
|
// Buffer threshold data
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_[1]);
|
glBindBuffer(GL_ARRAY_BUFFER, vbo_[1]);
|
||||||
glBufferData(GL_ARRAY_BUFFER,
|
glBufferData(
|
||||||
sizeof(GLint) * currentIntegerBuffer_.size(),
|
GL_ARRAY_BUFFER,
|
||||||
currentIntegerBuffer_.data(),
|
static_cast<GLsizeiptr>(sizeof(GLint) * currentIntegerBuffer_.size()),
|
||||||
GL_DYNAMIC_DRAW);
|
currentIntegerBuffer_.data(),
|
||||||
|
GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
numVertices_ =
|
numVertices_ =
|
||||||
static_cast<GLsizei>(currentBuffer_.size() / kPointsPerVertex);
|
static_cast<GLsizei>(currentBuffer_.size() / kPointsPerVertex);
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,8 @@ void Rectangle::Initialize()
|
||||||
glBufferData(
|
glBufferData(
|
||||||
GL_ARRAY_BUFFER, sizeof(float) * BUFFER_LENGTH, nullptr, GL_DYNAMIC_DRAW);
|
GL_ARRAY_BUFFER, sizeof(float) * BUFFER_LENGTH, nullptr, GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
|
// NOLINTBEGIN(performance-no-int-to-ptr)
|
||||||
|
|
||||||
glVertexAttribPointer(0,
|
glVertexAttribPointer(0,
|
||||||
3,
|
3,
|
||||||
GL_FLOAT,
|
GL_FLOAT,
|
||||||
|
|
@ -117,6 +119,8 @@ void Rectangle::Initialize()
|
||||||
reinterpret_cast<void*>(3 * sizeof(float)));
|
reinterpret_cast<void*>(3 * sizeof(float)));
|
||||||
glEnableVertexAttribArray(1);
|
glEnableVertexAttribArray(1);
|
||||||
|
|
||||||
|
// NOLINTEND(performance-no-int-to-ptr)
|
||||||
|
|
||||||
p->dirty_ = true;
|
p->dirty_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -134,12 +138,14 @@ void Rectangle::Render(const QMapLibre::CustomLayerRenderParameters& params)
|
||||||
if (p->fillColor_.has_value())
|
if (p->fillColor_.has_value())
|
||||||
{
|
{
|
||||||
// Draw fill
|
// Draw fill
|
||||||
|
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
|
||||||
glDrawArrays(GL_TRIANGLES, 24, 6);
|
glDrawArrays(GL_TRIANGLES, 24, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->borderWidth_ > 0.0f)
|
if (p->borderWidth_ > 0.0f)
|
||||||
{
|
{
|
||||||
// Draw border
|
// Draw border
|
||||||
|
// NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers)
|
||||||
glDrawArrays(GL_TRIANGLES, 0, 24);
|
glDrawArrays(GL_TRIANGLES, 0, 24);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -283,7 +289,7 @@ void Rectangle::Impl::Update()
|
||||||
|
|
||||||
glBufferData(GL_ARRAY_BUFFER,
|
glBufferData(GL_ARRAY_BUFFER,
|
||||||
sizeof(float) * BUFFER_LENGTH,
|
sizeof(float) * BUFFER_LENGTH,
|
||||||
buffer,
|
static_cast<const void*>(buffer),
|
||||||
GL_DYNAMIC_DRAW);
|
GL_DYNAMIC_DRAW);
|
||||||
|
|
||||||
dirty_ = false;
|
dirty_ = false;
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ void GlContext::Impl::InitializeGL()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLenum error = glewInit();
|
const GLenum error = glewInit();
|
||||||
if (error != GLEW_OK)
|
if (error != GLEW_OK)
|
||||||
{
|
{
|
||||||
logger_->error("glewInit failed: {}",
|
logger_->error("glewInit failed: {}",
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,7 @@ public:
|
||||||
std::make_shared<gl::draw::PlacefilePolygons>(glContext)},
|
std::make_shared<gl::draw::PlacefilePolygons>(glContext)},
|
||||||
placefileTriangles_ {
|
placefileTriangles_ {
|
||||||
std::make_shared<gl::draw::PlacefileTriangles>(glContext)},
|
std::make_shared<gl::draw::PlacefileTriangles>(glContext)},
|
||||||
placefileText_ {
|
placefileText_ {std::make_shared<gl::draw::PlacefileText>(placefileName)}
|
||||||
std::make_shared<gl::draw::PlacefileText>(glContext, placefileName)}
|
|
||||||
{
|
{
|
||||||
ConnectSignals();
|
ConnectSignals();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue