forked from inkyblackness/imgui-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDrawListWrapper.cpp
42 lines (36 loc) · 1.3 KB
/
DrawListWrapper.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "imguiWrappedHeader.h"
#include "DrawListWrapper.h"
#include "WrapperConverter.h"
int iggDrawListGetCommandCount(IggDrawList handle)
{
ImDrawList *list = reinterpret_cast<ImDrawList *>(handle);
return list->CmdBuffer.Size;
}
IggDrawCmd iggDrawListGetCommand(IggDrawList handle, int index)
{
ImDrawList *list = reinterpret_cast<ImDrawList *>(handle);
return reinterpret_cast<IggDrawCmd>(&list->CmdBuffer.Data[index]);
}
void iggDrawListGetRawIndexBuffer(IggDrawList handle, void **data, int *byteSize)
{
ImDrawList *list = reinterpret_cast<ImDrawList *>(handle);
*data = list->IdxBuffer.Data;
*byteSize = static_cast<int>(sizeof(ImDrawIdx)) * list->IdxBuffer.Size;
}
void iggDrawListGetRawVertexBuffer(IggDrawList handle, void **data, int *byteSize)
{
ImDrawList *list = reinterpret_cast<ImDrawList *>(handle);
*data = list->VtxBuffer.Data;
*byteSize = static_cast<int>(sizeof(ImDrawVert)) * list->VtxBuffer.Size;
}
void iggGetIndexBufferLayout(size_t *entrySize)
{
*entrySize = sizeof(ImDrawIdx);
}
void iggGetVertexBufferLayout(size_t *entrySize, size_t *posOffset, size_t *uvOffset, size_t *colOffset)
{
*entrySize = sizeof(ImDrawVert);
*posOffset = IM_OFFSETOF(ImDrawVert, pos);
*uvOffset = IM_OFFSETOF(ImDrawVert, uv);
*colOffset = IM_OFFSETOF(ImDrawVert, col);
}