1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-12-05 04:28:01 +01:00

Merge remote-tracking branch 'origin' into 2015-04-indexed-rendering

This commit is contained in:
ocornut 2015-04-09 22:50:18 +01:00
commit 6bdb8719e2

View File

@ -7782,11 +7782,14 @@ void ImDrawList::PrimQuad(const ImVec2& a, const ImVec2& b, const ImVec2& c, con
void ImDrawList::PrimLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness) void ImDrawList::PrimLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness)
{ {
const float inv_length = 1.0f / sqrtf(ImLengthSqr(b - a)); const float inv_length = 1.0f / sqrtf(ImLengthSqr(b - a));
const ImVec2 hn = (b - a) * (thickness * 0.5f * inv_length);// half normalized const float dx = (b.x - a.x) * (thickness * 0.5f * inv_length); // line direction, halved
const ImVec2 hp0 = ImVec2(+hn.y, -hn.x); // half perpendiculars + user offset const float dy = (b.y - a.y) * (thickness * 0.5f * inv_length); // line direction, halved
const ImVec2 hp1 = ImVec2(-hn.y, +hn.x);
PrimQuad(a + hp0, b + hp0, b + hp1, a + hp1, col); const ImVec2 pa(a.x + dy, a.y - dx);
const ImVec2 pb(b.x + dy, b.y - dx);
const ImVec2 pc(b.x - dy, b.y + dx);
const ImVec2 pd(a.x - dy, a.y + dx);
PrimQuad(pa, pb, pc, pd, col);
} }
void ImDrawList::AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness) void ImDrawList::AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness)