mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 19:10:06 +00:00
Moving sweep time to upper right
This commit is contained in:
parent
22efc9b9f1
commit
a6f50d74e0
1 changed files with 37 additions and 25 deletions
|
|
@ -110,7 +110,7 @@ void OverlayLayer::initialize()
|
||||||
|
|
||||||
gl.glBindVertexArray(p->vao_);
|
gl.glBindVertexArray(p->vao_);
|
||||||
|
|
||||||
// Bottom panel (dynamic sized)
|
// Upper right panel (dynamic sized)
|
||||||
gl.glBindBuffer(GL_ARRAY_BUFFER, p->vbo_);
|
gl.glBindBuffer(GL_ARRAY_BUFFER, p->vbo_);
|
||||||
gl.glBufferData(
|
gl.glBufferData(
|
||||||
GL_ARRAY_BUFFER, sizeof(float) * 6 * 2, nullptr, GL_DYNAMIC_DRAW);
|
GL_ARRAY_BUFFER, sizeof(float) * 6 * 2, nullptr, GL_DYNAMIC_DRAW);
|
||||||
|
|
@ -118,7 +118,7 @@ void OverlayLayer::initialize()
|
||||||
gl.glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, static_cast<void*>(0));
|
gl.glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, static_cast<void*>(0));
|
||||||
gl.glEnableVertexAttribArray(0);
|
gl.glEnableVertexAttribArray(0);
|
||||||
|
|
||||||
// Bottom panel color
|
// Upper right panel color
|
||||||
gl.glUniform4f(p->uColorLocation_, 0.0f, 0.0f, 0.0f, 0.75f);
|
gl.glUniform4f(p->uColorLocation_, 0.0f, 0.0f, 0.0f, 0.75f);
|
||||||
|
|
||||||
connect(p->radarProductView_.get(),
|
connect(p->radarProductView_.get(),
|
||||||
|
|
@ -160,31 +160,43 @@ void OverlayLayer::render(const QMapbox::CustomLayerRenderParameters& params)
|
||||||
gl.glUniformMatrix4fv(
|
gl.glUniformMatrix4fv(
|
||||||
p->uMVPMatrixLocation_, 1, GL_FALSE, glm::value_ptr(projection));
|
p->uMVPMatrixLocation_, 1, GL_FALSE, glm::value_ptr(projection));
|
||||||
|
|
||||||
// Bottom panel vertices
|
if (sweepTimeString.length() > 0)
|
||||||
float vertices[6][2] = {{0.0f, 0.0f},
|
{
|
||||||
{0.0f, 24.0f},
|
const float fontSize = 16.0f;
|
||||||
{static_cast<float>(params.width), 0.0f}, //
|
const float textLength = p->font_->TextLength(sweepTimeString, fontSize);
|
||||||
//
|
|
||||||
{0.0f, 24.0f},
|
|
||||||
{static_cast<float>(params.width), 0.0f},
|
|
||||||
{static_cast<float>(params.width), 24.0f}};
|
|
||||||
|
|
||||||
// Draw vertices
|
// Upper right panel vertices
|
||||||
gl.glBindVertexArray(p->vao_);
|
const float vertexLX =
|
||||||
gl.glBindBuffer(GL_ARRAY_BUFFER, p->vbo_);
|
static_cast<float>(params.width) - textLength - 14.0f;
|
||||||
gl.glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertices), vertices);
|
const float vertexRX = static_cast<float>(params.width);
|
||||||
gl.glDrawArrays(GL_TRIANGLES, 0, 6);
|
const float vertexTY = static_cast<float>(params.height);
|
||||||
|
const float vertexBY = static_cast<float>(params.height) - 22.0f;
|
||||||
|
const float vertices[6][2] = {{vertexLX, vertexTY}, // TL
|
||||||
|
{vertexLX, vertexBY}, // BL
|
||||||
|
{vertexRX, vertexTY}, // TR
|
||||||
|
//
|
||||||
|
{vertexLX, vertexBY}, // BL
|
||||||
|
{vertexRX, vertexTY}, // TR
|
||||||
|
{vertexRX, vertexBY}}; // BR
|
||||||
|
|
||||||
// Render time
|
// Draw vertices
|
||||||
p->textShader_.RenderText(sweepTimeString,
|
gl.glBindVertexArray(p->vao_);
|
||||||
params.width - 7.0f,
|
gl.glBindBuffer(GL_ARRAY_BUFFER, p->vbo_);
|
||||||
7.0f,
|
gl.glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertices), vertices);
|
||||||
16.0f,
|
gl.glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||||
projection,
|
|
||||||
boost::gil::rgba8_pixel_t(255, 255, 255, 204),
|
// Render time
|
||||||
p->font_,
|
p->textShader_.RenderText(sweepTimeString,
|
||||||
p->texture_,
|
params.width - 7.0f,
|
||||||
gl::TextAlign::Right);
|
static_cast<float>(params.height) -
|
||||||
|
16.0f, // 7.0f,
|
||||||
|
fontSize,
|
||||||
|
projection,
|
||||||
|
boost::gil::rgba8_pixel_t(255, 255, 255, 204),
|
||||||
|
p->font_,
|
||||||
|
p->texture_,
|
||||||
|
gl::TextAlign::Right);
|
||||||
|
}
|
||||||
|
|
||||||
SCWX_GL_CHECK_ERROR();
|
SCWX_GL_CHECK_ERROR();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue