MCPcopy Create free account
hub / github.com/ddnet/ddnet / RenderQuadContainerEx

Method RenderQuadContainerEx

src/engine/client/graphics_threaded.cpp:1730–1848  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1728}
1729
1730void CGraphics_Threaded::RenderQuadContainerEx(int ContainerIndex, int QuadOffset, int QuadDrawNum, float X, float Y, float ScaleX, float ScaleY)
1731{
1732 SQuadContainer &Container = m_vQuadContainers[ContainerIndex];
1733
1734 if((int)Container.m_vQuads.size() < QuadOffset + 1)
1735 return;
1736
1737 if(QuadDrawNum == -1)
1738 QuadDrawNum = (int)Container.m_vQuads.size() - QuadOffset;
1739
1740 if(IsQuadContainerBufferingEnabled())
1741 {
1742 if(Container.m_QuadBufferContainerIndex == -1)
1743 return;
1744
1745 SQuadContainer::SQuad &Quad = Container.m_vQuads[QuadOffset];
1746 CCommandBuffer::SCommand_RenderQuadContainerEx Cmd;
1747
1748 WrapClamp();
1749
1750 float ScreenX0, ScreenY0, ScreenX1, ScreenY1;
1751 GetScreen(&ScreenX0, &ScreenY0, &ScreenX1, &ScreenY1);
1752 MapScreen((ScreenX0 - X) / ScaleX, (ScreenY0 - Y) / ScaleY, (ScreenX1 - X) / ScaleX, (ScreenY1 - Y) / ScaleY);
1753 Cmd.m_State = m_State;
1754 MapScreen(ScreenX0, ScreenY0, ScreenX1, ScreenY1);
1755
1756 Cmd.m_DrawNum = QuadDrawNum * 6;
1757 Cmd.m_pOffset = (void *)(QuadOffset * 6 * sizeof(unsigned int));
1758 Cmd.m_BufferContainerIndex = Container.m_QuadBufferContainerIndex;
1759
1760 Cmd.m_VertexColor.r = (float)m_aColor[0].r / 255.f;
1761 Cmd.m_VertexColor.g = (float)m_aColor[0].g / 255.f;
1762 Cmd.m_VertexColor.b = (float)m_aColor[0].b / 255.f;
1763 Cmd.m_VertexColor.a = (float)m_aColor[0].a / 255.f;
1764
1765 Cmd.m_Rotation = m_Rotation;
1766
1767 // rotate before positioning
1768 Cmd.m_Center.x = Quad.m_aVertices[0].m_Pos.x + (Quad.m_aVertices[1].m_Pos.x - Quad.m_aVertices[0].m_Pos.x) / 2.f;
1769 Cmd.m_Center.y = Quad.m_aVertices[0].m_Pos.y + (Quad.m_aVertices[2].m_Pos.y - Quad.m_aVertices[0].m_Pos.y) / 2.f;
1770
1771 AddCmd(Cmd);
1772 m_pCommandBuffer->AddRenderCalls(1);
1773 }
1774 else
1775 {
1776 if(g_Config.m_GfxQuadAsTriangle)
1777 {
1778 for(int i = 0; i < QuadDrawNum; ++i)
1779 {
1780 SQuadContainer::SQuad &Quad = Container.m_vQuads[QuadOffset + i];
1781 m_aVertices[i * 6 + 0] = Quad.m_aVertices[0];
1782 m_aVertices[i * 6 + 1] = Quad.m_aVertices[1];
1783 m_aVertices[i * 6 + 2] = Quad.m_aVertices[2];
1784 m_aVertices[i * 6 + 3] = Quad.m_aVertices[0];
1785 m_aVertices[i * 6 + 4] = Quad.m_aVertices[2];
1786 m_aVertices[i * 6 + 5] = Quad.m_aVertices[3];
1787

Callers 7

DrawMethod · 0.80
RenderPlayerStateMethod · 0.80
chat.cppFile · 0.80
RenderMethod · 0.80
RenderLaserMethod · 0.80
RenderTextContainerMethod · 0.80

Calls 3

mem_copyFunction · 0.85
AddRenderCallsMethod · 0.80
RotateFunction · 0.50

Tested by

no test coverage detected