KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
KGDrawList Struct Reference

Draw command list. More...

#include <KarmaGui.h>

Collaboration diagram for KGDrawList:

Public Member Functions

 KGDrawList (KGDrawListSharedData *shared_data)
 
void PushClipRect (const KGVec2 &clip_rect_min, const KGVec2 &clip_rect_max, bool intersect_with_current_clip_rect=false)
 
void PushClipRectFullScreen ()
 
void PopClipRect ()
 
void PushTextureID (KGTextureID texture_id)
 
void PopTextureID ()
 
KGVec2 GetClipRectMin () const
 
KGVec2 GetClipRectMax () const
 
void AddLine (const KGVec2 &p1, const KGVec2 &p2, KGU32 col, float thickness=1.0f)
 
void AddRect (const KGVec2 &p_min, const KGVec2 &p_max, KGU32 col, float rounding=0.0f, KGDrawFlags flags=0, float thickness=1.0f)
 
void AddRectFilled (const KGVec2 &p_min, const KGVec2 &p_max, KGU32 col, float rounding=0.0f, KGDrawFlags flags=0)
 
void AddRectFilledMultiColor (const KGVec2 &p_min, const KGVec2 &p_max, KGU32 col_upr_left, KGU32 col_upr_right, KGU32 col_bot_right, KGU32 col_bot_left)
 
void AddQuad (const KGVec2 &p1, const KGVec2 &p2, const KGVec2 &p3, const KGVec2 &p4, KGU32 col, float thickness=1.0f)
 
void AddQuadFilled (const KGVec2 &p1, const KGVec2 &p2, const KGVec2 &p3, const KGVec2 &p4, KGU32 col)
 
void AddTriangle (const KGVec2 &p1, const KGVec2 &p2, const KGVec2 &p3, KGU32 col, float thickness=1.0f)
 
void AddTriangleFilled (const KGVec2 &p1, const KGVec2 &p2, const KGVec2 &p3, KGU32 col)
 
void AddCircle (const KGVec2 &center, float radius, KGU32 col, int num_segments=0, float thickness=1.0f)
 
void AddCircleFilled (const KGVec2 &center, float radius, KGU32 col, int num_segments=0)
 
void AddNgon (const KGVec2 &center, float radius, KGU32 col, int num_segments, float thickness=1.0f)
 
void AddNgonFilled (const KGVec2 &center, float radius, KGU32 col, int num_segments)
 
void AddText (const KGVec2 &pos, KGU32 col, const char *text_begin, const char *text_end=NULL)
 
void AddText (const KGFont *font, float font_size, const KGVec2 &pos, KGU32 col, const char *text_begin, const char *text_end=NULL, float wrap_width=0.0f, const KGVec4 *cpu_fine_clip_rect=NULL)
 
void AddPolyline (const KGVec2 *points, int num_points, KGU32 col, KGDrawFlags flags, float thickness)
 
void AddConvexPolyFilled (const KGVec2 *points, int num_points, KGU32 col)
 
void AddBezierCubic (const KGVec2 &p1, const KGVec2 &p2, const KGVec2 &p3, const KGVec2 &p4, KGU32 col, float thickness, int num_segments=0)
 
void AddBezierQuadratic (const KGVec2 &p1, const KGVec2 &p2, const KGVec2 &p3, KGU32 col, float thickness, int num_segments=0)
 
void AddImage (KGTextureID user_texture_id, const KGVec2 &p_min, const KGVec2 &p_max, const KGVec2 &uv_min=KGVec2(0, 0), const KGVec2 &uv_max=KGVec2(1, 1), KGU32 col=KG_COL32_WHITE)
 
void AddImageQuad (KGTextureID user_texture_id, const KGVec2 &p1, const KGVec2 &p2, const KGVec2 &p3, const KGVec2 &p4, const KGVec2 &uv1=KGVec2(0, 0), const KGVec2 &uv2=KGVec2(1, 0), const KGVec2 &uv3=KGVec2(1, 1), const KGVec2 &uv4=KGVec2(0, 1), KGU32 col=KG_COL32_WHITE)
 
void AddImageRounded (KGTextureID user_texture_id, const KGVec2 &p_min, const KGVec2 &p_max, const KGVec2 &uv_min, const KGVec2 &uv_max, KGU32 col, float rounding, KGDrawFlags flags=0)
 
void SetWindowBackgroundColor (KGVec4 bgColor)
 
void PathClear ()
 
void PathLineTo (const KGVec2 &pos)
 
void PathLineToMergeDuplicate (const KGVec2 &pos)
 
void PathFillConvex (KGU32 col)
 
void PathStroke (KGU32 col, KGDrawFlags flags=0, float thickness=1.0f)
 
void PathArcTo (const KGVec2 &center, float radius, float a_min, float a_max, int num_segments=0)
 
void PathArcToFast (const KGVec2 &center, float radius, int a_min_of_12, int a_max_of_12)
 
void PathBezierCubicCurveTo (const KGVec2 &p2, const KGVec2 &p3, const KGVec2 &p4, int num_segments=0)
 
void PathBezierQuadraticCurveTo (const KGVec2 &p2, const KGVec2 &p3, int num_segments=0)
 
void PathRect (const KGVec2 &rect_min, const KGVec2 &rect_max, float rounding=0.0f, KGDrawFlags flags=0)
 
void AddCallback (KGDrawCallback callback, void *callback_data)
 
void AddDrawCmd ()
 
KGDrawListCloneOutput () const
 
void ChannelsSplit (int count)
 
void ChannelsMerge ()
 
void ChannelsSetCurrent (int n)
 
void PrimReserve (int idx_count, int vtx_count)
 
void PrimUnreserve (int idx_count, int vtx_count)
 
void PrimRect (const KGVec2 &a, const KGVec2 &b, KGU32 col)
 
void PrimRectUV (const KGVec2 &a, const KGVec2 &b, const KGVec2 &uv_a, const KGVec2 &uv_b, KGU32 col)
 
void PrimQuadUV (const KGVec2 &a, const KGVec2 &b, const KGVec2 &c, const KGVec2 &d, const KGVec2 &uv_a, const KGVec2 &uv_b, const KGVec2 &uv_c, const KGVec2 &uv_d, KGU32 col)
 
void PrimWriteVtx (const KGVec2 &pos, const KGVec2 &uv, KGU32 col)
 
void PrimWriteIdx (KGDrawIdx idx)
 
void PrimVtx (const KGVec2 &pos, const KGVec2 &uv, KGU32 col)
 
void _ResetForNewFrame ()
 
void _ClearFreeMemory ()
 
void _PopUnusedDrawCmd ()
 
void _TryMergeDrawCmds ()
 
void _OnChangedClipRect ()
 
void _OnChangedTextureID ()
 
void _OnChangedVtxOffset ()
 
int _CalcCircleAutoSegmentCount (float radius) const
 
void _PathArcToFastEx (const KGVec2 &center, float radius, int a_min_sample, int a_max_sample, int a_step)
 
void _PathArcToN (const KGVec2 &center, float radius, float a_min, float a_max, int num_segments)
 

Public Attributes

KGVector< KGDrawCmdCmdBuffer
 
KGVector< KGDrawIdx > IdxBuffer
 
KGVector< KGDrawVertVtxBuffer
 
KGDrawListFlags Flags
 
unsigned int _VtxCurrentIdx
 
KGDrawListSharedData_Data
 
const char * _OwnerName
 
KGDrawVert_VtxWritePtr
 
KGDrawIdx * _IdxWritePtr
 
KGVector< KGVec4_ClipRectStack
 
KGVector< KGTextureID > _TextureIdStack
 
KGVector< KGVec2_Path
 
ImDrawCmdHeader _CmdHeader
 
KGDrawListSplitter _Splitter
 
float _FringeScale
 

Detailed Description

Draw command list.

This is the low-level list of polygons that KarmaGui:: functions are filling. At the end of the frame, all command lists are passed to your KarmaGuiIO::RenderDrawListFn function for rendering. Each KarmaGui window contains its own KGDrawList. You can use ImGui::GetWindowDrawList() to access the current window draw list and draw custom primitives. You can interleave normal KarmaGui:: calls and adding primitives to the current draw list. In single viewport mode, top-left is == GetMainViewport()->Pos (generally 0,0), bottom-right is == GetMainViewport()->Pos+Size (generally io.DisplaySize). You are totally free to apply whatever transformation matrix to want to the data (depending on the use of the transformation you may want to apply it to ClipRect as well!)

Note
Primitives are always added to the list and not culled (culling is done at higher-level by KarmaGui:: functions), if you use this API a lot consider coarse culling your drawn objects.
Since
Karma 1.0.0

The documentation for this struct was generated from the following files: