mirror of
https://github.com/ocornut/imgui.git
synced 2024-12-04 12:08:03 +01:00
Merge remote-tracking branch 'origin' into 2015-04-indexed-rendering
This commit is contained in:
commit
6bdb8719e2
11
imgui.cpp
11
imgui.cpp
@ -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)
|
||||
{
|
||||
const float inv_length = 1.0f / sqrtf(ImLengthSqr(b - a));
|
||||
const ImVec2 hn = (b - a) * (thickness * 0.5f * inv_length);// half normalized
|
||||
const ImVec2 hp0 = ImVec2(+hn.y, -hn.x); // half perpendiculars + user offset
|
||||
const ImVec2 hp1 = ImVec2(-hn.y, +hn.x);
|
||||
const float dx = (b.x - a.x) * (thickness * 0.5f * inv_length); // line direction, halved
|
||||
const float dy = (b.y - a.y) * (thickness * 0.5f * inv_length); // line direction, halved
|
||||
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user