mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
ImDrawList: inline AddVtx() calls for profit in highly debug builds
This commit is contained in:
parent
334fba2f56
commit
aa1a96f907
58
imgui.cpp
58
imgui.cpp
@ -7711,47 +7711,51 @@ void ImDrawList::PrimReserve(unsigned int vtx_count)
|
||||
void ImDrawList::PrimTriangle(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col)
|
||||
{
|
||||
const ImVec2 uv = GImGui->FontTexUvWhitePixel;
|
||||
AddVtx(a, uv, col);
|
||||
AddVtx(b, uv, col);
|
||||
AddVtx(c, uv, col);
|
||||
vtx_write[0].pos = a; vtx_write[0].uv = uv; vtx_write[0].col = col;
|
||||
vtx_write[1].pos = b; vtx_write[1].uv = uv; vtx_write[1].col = col;
|
||||
vtx_write[2].pos = c; vtx_write[2].uv = uv; vtx_write[2].col = col;
|
||||
vtx_write += 3;
|
||||
}
|
||||
|
||||
void ImDrawList::PrimRect(const ImVec2& a, const ImVec2& c, ImU32 col)
|
||||
{
|
||||
const ImVec2 uv = GImGui->FontTexUvWhitePixel;
|
||||
ImVec2 b(c.x, a.y);
|
||||
ImVec2 d(a.x, c.y);
|
||||
AddVtx(a, uv, col);
|
||||
AddVtx(b, uv, col);
|
||||
AddVtx(c, uv, col);
|
||||
AddVtx(a, uv, col);
|
||||
AddVtx(c, uv, col);
|
||||
AddVtx(d, uv, col);
|
||||
const ImVec2 b(c.x, a.y);
|
||||
const ImVec2 d(a.x, c.y);
|
||||
vtx_write[0].pos = a; vtx_write[0].uv = uv; vtx_write[0].col = col;
|
||||
vtx_write[1].pos = b; vtx_write[1].uv = uv; vtx_write[1].col = col;
|
||||
vtx_write[2].pos = c; vtx_write[2].uv = uv; vtx_write[2].col = col;
|
||||
vtx_write[3].pos = a; vtx_write[3].uv = uv; vtx_write[3].col = col;
|
||||
vtx_write[4].pos = c; vtx_write[4].uv = uv; vtx_write[4].col = col;
|
||||
vtx_write[5].pos = d; vtx_write[5].uv = uv; vtx_write[5].col = col;
|
||||
vtx_write += 6;
|
||||
}
|
||||
|
||||
void ImDrawList::PrimRectUV(const ImVec2& a, const ImVec2& c, const ImVec2& uv_a, const ImVec2& uv_c, ImU32 col)
|
||||
{
|
||||
ImVec2 b(c.x, a.y);
|
||||
ImVec2 d(a.x, c.y);
|
||||
ImVec2 uv_b(uv_c.x, uv_a.y);
|
||||
ImVec2 uv_d(uv_a.x, uv_c.y);
|
||||
AddVtx(a, uv_a, col);
|
||||
AddVtx(b, uv_b, col);
|
||||
AddVtx(c, uv_c, col);
|
||||
AddVtx(a, uv_a, col);
|
||||
AddVtx(c, uv_c, col);
|
||||
AddVtx(d, uv_d, col);
|
||||
const ImVec2 b(c.x, a.y);
|
||||
const ImVec2 d(a.x, c.y);
|
||||
const ImVec2 uv_b(uv_c.x, uv_a.y);
|
||||
const ImVec2 uv_d(uv_a.x, uv_c.y);
|
||||
vtx_write[0].pos = a; vtx_write[0].uv = uv_a; vtx_write[0].col = col;
|
||||
vtx_write[1].pos = b; vtx_write[1].uv = uv_b; vtx_write[1].col = col;
|
||||
vtx_write[2].pos = c; vtx_write[2].uv = uv_c; vtx_write[2].col = col;
|
||||
vtx_write[3].pos = a; vtx_write[3].uv = uv_a; vtx_write[3].col = col;
|
||||
vtx_write[4].pos = c; vtx_write[4].uv = uv_c; vtx_write[4].col = col;
|
||||
vtx_write[5].pos = d; vtx_write[5].uv = uv_d; vtx_write[5].col = col;
|
||||
vtx_write += 6;
|
||||
}
|
||||
|
||||
void ImDrawList::PrimQuad(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col)
|
||||
{
|
||||
const ImVec2 uv = GImGui->FontTexUvWhitePixel;
|
||||
AddVtx(a, uv, col);
|
||||
AddVtx(b, uv, col);
|
||||
AddVtx(c, uv, col);
|
||||
AddVtx(a, uv, col);
|
||||
AddVtx(c, uv, col);
|
||||
AddVtx(d, uv, col);
|
||||
vtx_write[0].pos = a; vtx_write[0].uv = uv; vtx_write[0].col = col;
|
||||
vtx_write[1].pos = b; vtx_write[1].uv = uv; vtx_write[1].col = col;
|
||||
vtx_write[2].pos = c; vtx_write[2].uv = uv; vtx_write[2].col = col;
|
||||
vtx_write[3].pos = a; vtx_write[3].uv = uv; vtx_write[3].col = col;
|
||||
vtx_write[4].pos = c; vtx_write[4].uv = uv; vtx_write[4].col = col;
|
||||
vtx_write[5].pos = d; vtx_write[5].uv = uv; vtx_write[5].col = col;
|
||||
vtx_write += 6;
|
||||
}
|
||||
|
||||
// FIXME-OPT: In many instances the caller could provide a normal.
|
||||
|
Loading…
Reference in New Issue
Block a user