mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 18:00:06 +00:00
Rotate placefile icons
This commit is contained in:
parent
e66c202edf
commit
6c0b62709f
4 changed files with 29 additions and 3 deletions
|
|
@ -54,6 +54,23 @@ void DrawItem::UseDefaultProjection(
|
|||
uMVPMatrixLocation, 1, GL_FALSE, glm::value_ptr(projection));
|
||||
}
|
||||
|
||||
void DrawItem::UseRotationProjection(
|
||||
const QMapLibreGL::CustomLayerRenderParameters& params,
|
||||
GLint uMVPMatrixLocation)
|
||||
{
|
||||
glm::mat4 projection = glm::ortho(0.0f,
|
||||
static_cast<float>(params.width),
|
||||
0.0f,
|
||||
static_cast<float>(params.height));
|
||||
|
||||
projection = glm::rotate(projection,
|
||||
glm::radians<float>(params.bearing),
|
||||
glm::vec3(0.0f, 0.0f, 1.0f));
|
||||
|
||||
p->gl_.glUniformMatrix4fv(
|
||||
uMVPMatrixLocation, 1, GL_FALSE, glm::value_ptr(projection));
|
||||
}
|
||||
|
||||
// TODO: Refactor to utility class
|
||||
static glm::vec2
|
||||
LatLongToScreenCoordinate(const QMapLibreGL::Coordinate& coordinate)
|
||||
|
|
|
|||
|
|
@ -36,6 +36,9 @@ protected:
|
|||
void
|
||||
UseDefaultProjection(const QMapLibreGL::CustomLayerRenderParameters& params,
|
||||
GLint uMVPMatrixLocation);
|
||||
void
|
||||
UseRotationProjection(const QMapLibreGL::CustomLayerRenderParameters& params,
|
||||
GLint uMVPMatrixLocation);
|
||||
void UseMapProjection(const QMapLibreGL::CustomLayerRenderParameters& params,
|
||||
GLint uMVPMatrixLocation,
|
||||
GLint uMapScreenCoordLocation);
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ void PlacefileIcons::Render(
|
|||
|
||||
p->Update();
|
||||
p->shaderProgram_->Use();
|
||||
UseDefaultProjection(params, p->uMVPMatrixLocation_);
|
||||
UseRotationProjection(params, p->uMVPMatrixLocation_);
|
||||
UseMapProjection(
|
||||
params, p->uMapMatrixLocation_, p->uMapScreenCoordLocation_);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue