MCPcopy Create free account
hub / github.com/OneLoneCoder/olcPixelGameEngine / HW3D_DrawLineBox

Method HW3D_DrawLineBox

olcPixelGameEngine.h:3743–3788  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3741 }
3742
3743 void PixelGameEngine::HW3D_DrawLineBox(const std::array<float, 16>& matModelView, const std::array<float, 4>& pos, const std::array<float, 4>& size, const olc::Pixel col)
3744 {
3745 GPUTask task;
3746 task.decal = nullptr;
3747 task.mode = nDecalMode;
3748 task.structure = olc::DecalStructure::LINE;
3749 task.depth = bHW3DDepthTest;
3750 task.cull = nHW3DCullMode;
3751 task.mvp = matModelView;
3752 task.tint = olc::WHITE;
3753
3754 const float ox = pos[0];
3755 const float oy = pos[1];
3756 const float oz = pos[2];
3757 const float sx = size[0];
3758 const float sy = size[1];
3759 const float sz = size[2];
3760
3761 const std::array<float, 3> p0 = { {ox, oy, oz} };
3762 const std::array<float, 3> p1 = { {ox+sx, oy, oz} };
3763 const std::array<float, 3> p2 = { {ox+sx, oy+sy, oz} };
3764 const std::array<float, 3> p3 = { {ox, oy+sy, oz} };
3765
3766 const std::array<float, 3> p4 = { {ox, oy, oz+sz} };
3767 const std::array<float, 3> p5 = { {ox+sx, oy, oz+sz} };
3768 const std::array<float, 3> p6 = { {ox+sx, oy+sy, oz+sz} };
3769 const std::array<float, 3> p7 = { {ox, oy+sy, oz+sz} };
3770
3771 task.vb =
3772 {
3773 { p0[0], p0[1], p0[2], 1.0f, 0.0f, 0.0f, col.n }, { p1[0], p1[1], p1[2], 1.0f, 0.0f, 0.0f, col.n },
3774 { p1[0], p1[1], p1[2], 1.0f, 0.0f, 0.0f, col.n }, { p2[0], p2[1], p2[2], 1.0f, 0.0f, 0.0f, col.n },
3775 { p2[0], p2[1], p2[2], 1.0f, 0.0f, 0.0f, col.n }, { p3[0], p3[1], p3[2], 1.0f, 0.0f, 0.0f, col.n },
3776 { p3[0], p3[1], p3[2], 1.0f, 0.0f, 0.0f, col.n }, { p0[0], p0[1], p0[2], 1.0f, 0.0f, 0.0f, col.n },
3777 { p4[0], p4[1], p4[2], 1.0f, 0.0f, 0.0f, col.n }, { p5[0], p5[1], p5[2], 1.0f, 0.0f, 0.0f, col.n },
3778 { p5[0], p5[1], p5[2], 1.0f, 0.0f, 0.0f, col.n }, { p6[0], p6[1], p6[2], 1.0f, 0.0f, 0.0f, col.n },
3779 { p6[0], p6[1], p6[2], 1.0f, 0.0f, 0.0f, col.n }, { p7[0], p7[1], p7[2], 1.0f, 0.0f, 0.0f, col.n },
3780 { p7[0], p7[1], p7[2], 1.0f, 0.0f, 0.0f, col.n }, { p4[0], p4[1], p4[2], 1.0f, 0.0f, 0.0f, col.n },
3781 { p0[0], p0[1], p0[2], 1.0f, 0.0f, 0.0f, col.n }, { p4[0], p4[1], p4[2], 1.0f, 0.0f, 0.0f, col.n },
3782 { p1[0], p1[1], p1[2], 1.0f, 0.0f, 0.0f, col.n }, { p5[0], p5[1], p5[2], 1.0f, 0.0f, 0.0f, col.n },
3783 { p2[0], p2[1], p2[2], 1.0f, 0.0f, 0.0f, col.n }, { p6[0], p6[1], p6[2], 1.0f, 0.0f, 0.0f, col.n },
3784 { p3[0], p3[1], p3[2], 1.0f, 0.0f, 0.0f, col.n }, { p7[0], p7[1], p7[2], 1.0f, 0.0f, 0.0f, col.n },
3785 };
3786
3787 vLayers[nTargetLayer].vecGPUTasks.push_back(task);
3788 }
3789
3790 void PixelGameEngine::DrawLineDecal(const olc::vf2d& pos1, const olc::vf2d& pos2, Pixel p)
3791 {

Callers

nothing calls this directly

Calls 1

push_backMethod · 0.80

Tested by

no test coverage detected