ImDrawList: Separating PrimXXX sections from more internals helper in the header file.

This commit is contained in:
ocornut 2020-06-08 18:35:13 +02:00
parent 117d57df5b
commit e35a813d57

19
imgui.h
View File

@ -2057,19 +2057,22 @@ struct ImDrawList
inline void ChannelsMerge() { _Splitter.Merge(this); } inline void ChannelsMerge() { _Splitter.Merge(this); }
inline void ChannelsSetCurrent(int n) { _Splitter.SetCurrentChannel(this, n); } inline void ChannelsSetCurrent(int n) { _Splitter.SetCurrentChannel(this, n); }
// [Internal helpers] // Advanced: Primitives allocations
// NB: all primitives needs to be reserved via PrimReserve() beforehand! // - We render triangles (three vertices)
IMGUI_API void ResetForNewFrame(); // - All primitives needs to be reserved via PrimReserve() beforehand.
IMGUI_API void ClearFreeMemory();
IMGUI_API void PopUnusedDrawCmd();
IMGUI_API void PrimReserve(int idx_count, int vtx_count); IMGUI_API void PrimReserve(int idx_count, int vtx_count);
IMGUI_API void PrimUnreserve(int idx_count, int vtx_count); IMGUI_API void PrimUnreserve(int idx_count, int vtx_count);
IMGUI_API void PrimRect(const ImVec2& a, const ImVec2& b, ImU32 col); // Axis aligned rectangle (composed of two triangles) IMGUI_API void PrimRect(const ImVec2& a, const ImVec2& b, ImU32 col); // Axis aligned rectangle (composed of two triangles)
IMGUI_API void PrimRectUV(const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, ImU32 col); IMGUI_API void PrimRectUV(const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, ImU32 col);
IMGUI_API void PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, const ImVec2& uv_a, const ImVec2& uv_b, const ImVec2& uv_c, const ImVec2& uv_d, ImU32 col); IMGUI_API void PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, const ImVec2& uv_a, const ImVec2& uv_b, const ImVec2& uv_c, const ImVec2& uv_d, ImU32 col);
inline void PrimWriteVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col){ _VtxWritePtr->pos = pos; _VtxWritePtr->uv = uv; _VtxWritePtr->col = col; _VtxWritePtr++; _VtxCurrentIdx++; } inline void PrimWriteVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col) { _VtxWritePtr->pos = pos; _VtxWritePtr->uv = uv; _VtxWritePtr->col = col; _VtxWritePtr++; _VtxCurrentIdx++; }
inline void PrimWriteIdx(ImDrawIdx idx) { *_IdxWritePtr = idx; _IdxWritePtr++; } inline void PrimWriteIdx(ImDrawIdx idx) { *_IdxWritePtr = idx; _IdxWritePtr++; }
inline void PrimVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col) { PrimWriteIdx((ImDrawIdx)_VtxCurrentIdx); PrimWriteVtx(pos, uv, col); } inline void PrimVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col) { PrimWriteIdx((ImDrawIdx)_VtxCurrentIdx); PrimWriteVtx(pos, uv, col); } // Write vertex with unique index
// [Internal helpers]
IMGUI_API void ResetForNewFrame();
IMGUI_API void ClearFreeMemory();
IMGUI_API void PopUnusedDrawCmd();
IMGUI_API void UpdateClipRect(); IMGUI_API void UpdateClipRect();
IMGUI_API void UpdateTextureID(); IMGUI_API void UpdateTextureID();
}; };