diff --git a/scwx-qt/gl/geo_texture2d.vert b/scwx-qt/gl/geo_texture2d.vert index 35bc85fb..d8bd9b09 100644 --- a/scwx-qt/gl/geo_texture2d.vert +++ b/scwx-qt/gl/geo_texture2d.vert @@ -37,6 +37,6 @@ void main() vec2 p = latLngToScreenCoordinate(aLatLong) - uMapScreenCoord; // Transform the position to screen coordinates - gl_Position = uMapMatrix * vec4(p, 0.0f, 1.0f) - + gl_Position = uMapMatrix * vec4(p, 0.0f, 1.0f) + uMVPMatrix * vec4(aXYOffset, 0.0f, 0.0f); } diff --git a/scwx-qt/source/scwx/qt/gl/draw/placefile_icons.cpp b/scwx-qt/source/scwx/qt/gl/draw/placefile_icons.cpp index b23ec909..41881ebd 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/placefile_icons.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/placefile_icons.cpp @@ -311,16 +311,19 @@ void PlacefileIcons::Impl::Update() const float x = static_cast(di->x_); const float y = static_cast(di->y_); - // Half icon size - const float hw = static_cast(icon.iconFile_->iconWidth_) * 0.5f; - const float hh = - static_cast(icon.iconFile_->iconHeight_) * 0.5f; + // Icon size + const float iw = static_cast(icon.iconFile_->iconWidth_); + const float ih = static_cast(icon.iconFile_->iconHeight_); + + // Hot X/Y (zero-based icon center) + const float hx = static_cast(icon.iconFile_->hotX_); + const float hy = static_cast(icon.iconFile_->hotY_); // Final X/Y offsets in pixels - const float lx = std::roundf(x - hw); - const float rx = std::roundf(x + hw); - const float by = std::roundf(y - hh); - const float ty = std::roundf(y + hh); + const float lx = std::roundf(x - hx); + const float rx = std::roundf(lx + iw); + const float ty = std::roundf(y + hy); + const float by = std::roundf(ty - ih); // Angle in degrees // TODO: Properly convert @@ -347,12 +350,12 @@ void PlacefileIcons::Impl::Update() buffer.insert(buffer.end(), { // Icon - lat, lon, lx, by, rs, tt, mc0, mc1, mc2, mc3, a, // BL - lat, lon, lx, ty, rs, bt, mc0, mc1, mc2, mc3, a, // TL - lat, lon, rx, by, ls, tt, mc0, mc1, mc2, mc3, a, // BR - lat, lon, rx, by, ls, tt, mc0, mc1, mc2, mc3, a, // BR - lat, lon, rx, ty, ls, bt, mc0, mc1, mc2, mc3, a, // TR - lat, lon, lx, ty, rs, bt, mc0, mc1, mc2, mc3, a // TL + lat, lon, lx, by, ls, bt, mc0, mc1, mc2, mc3, a, // BL + lat, lon, lx, ty, ls, tt, mc0, mc1, mc2, mc3, a, // TL + lat, lon, rx, by, rs, bt, mc0, mc1, mc2, mc3, a, // BR + lat, lon, rx, by, rs, bt, mc0, mc1, mc2, mc3, a, // BR + lat, lon, rx, ty, rs, tt, mc0, mc1, mc2, mc3, a, // TR + lat, lon, lx, ty, ls, tt, mc0, mc1, mc2, mc3, a // TL }); numVertices_ += 6;