MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/FleX / imguiGraphDraw

Function imguiGraphDraw

demo/d3d11/imguiGraph.cpp:397–471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

395
396
397void imguiGraphDraw()
398{
399 const imguiGfxCmd* q = imguiGetRenderQueue();
400 int nq = imguiGetRenderQueueSize();
401
402 const float s = 1.0f / 8.0f;
403
404 imguiGraphRecordBegin();
405
406 imguiGraphDisableScissor();
407 for (int i = 0; i < nq; ++i)
408 {
409 const imguiGfxCmd& cmd = q[i];
410 if (cmd.type == IMGUI_GFXCMD_RECT)
411 {
412 if (cmd.rect.r == 0)
413 {
414 drawRect((float)cmd.rect.x*s + 0.5f, (float)cmd.rect.y*s + 0.5f,
415 (float)cmd.rect.w*s - 1, (float)cmd.rect.h*s - 1,
416 1.0f, cmd.col);
417 }
418 else
419 {
420 drawRoundedRect((float)cmd.rect.x*s + 0.5f, (float)cmd.rect.y*s + 0.5f,
421 (float)cmd.rect.w*s - 1, (float)cmd.rect.h*s - 1,
422 (float)cmd.rect.r*s, 1.0f, cmd.col);
423 }
424 }
425 else if (cmd.type == IMGUI_GFXCMD_LINE)
426 {
427 drawLine(cmd.line.x0*s, cmd.line.y0*s, cmd.line.x1*s, cmd.line.y1*s, cmd.line.r*s, 1.0f, cmd.col);
428 }
429 else if (cmd.type == IMGUI_GFXCMD_TRIANGLE)
430 {
431 if (cmd.flags == 1)
432 {
433 const float verts[3 * 2] =
434 {
435 (float)cmd.rect.x*s + 0.5f, (float)cmd.rect.y*s + 0.5f,
436 (float)cmd.rect.x*s + 0.5f + (float)cmd.rect.w*s - 1, (float)cmd.rect.y*s + 0.5f + (float)cmd.rect.h*s / 2 - 0.5f,
437 (float)cmd.rect.x*s + 0.5f, (float)cmd.rect.y*s + 0.5f + (float)cmd.rect.h*s - 1,
438 };
439 drawPolygon(verts, 3, 1.0f, cmd.col);
440 }
441 if (cmd.flags == 2)
442 {
443 const float verts[3 * 2] =
444 {
445 (float)cmd.rect.x*s + 0.5f, (float)cmd.rect.y*s + 0.5f + (float)cmd.rect.h*s - 1,
446 (float)cmd.rect.x*s + 0.5f + (float)cmd.rect.w*s / 2 - 0.5f, (float)cmd.rect.y*s + 0.5f,
447 (float)cmd.rect.x*s + 0.5f + (float)cmd.rect.w*s - 1, (float)cmd.rect.y*s + 0.5f + (float)cmd.rect.h*s - 1,
448 };
449 drawPolygon(verts, 3, 1.0f, cmd.col);
450 }
451 }
452 else if (cmd.type == IMGUI_GFXCMD_TEXT)
453 {
454 drawText(cmd.text.x, cmd.text.y, cmd.text.text, cmd.text.align, cmd.col);

Callers

nothing calls this directly

Calls 11

imguiGetRenderQueueFunction · 0.85
imguiGetRenderQueueSizeFunction · 0.85
imguiGraphRecordBeginFunction · 0.85
imguiGraphDisableScissorFunction · 0.85
imguiGraphEnableScissorFunction · 0.85
imguiGraphRecordEndFunction · 0.85
drawRectFunction · 0.70
drawRoundedRectFunction · 0.70
drawLineFunction · 0.70
drawPolygonFunction · 0.70
drawTextFunction · 0.70

Tested by

no test coverage detected