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

Method UploadTileData

src/game/map/render_layer.cpp:582–864  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

580}
581
582void CRenderLayerTile::UploadTileData(std::optional<CTileLayerVisuals> &VisualsOptional, int CurOverlay, bool AddAsSpeedup, bool IsGameLayer)
583{
584 if(!Graphics()->IsTileBufferingEnabled())
585 return;
586
587 // prepare all visuals for all tile layers
588 std::vector<CGraphicTile> vTmpTiles;
589 std::vector<CGraphicTileTextureCoords> vTmpTileTexCoords;
590 std::vector<CGraphicTile> vTmpBorderTopTiles;
591 std::vector<CGraphicTileTextureCoords> vTmpBorderTopTilesTexCoords;
592 std::vector<CGraphicTile> vTmpBorderLeftTiles;
593 std::vector<CGraphicTileTextureCoords> vTmpBorderLeftTilesTexCoords;
594 std::vector<CGraphicTile> vTmpBorderRightTiles;
595 std::vector<CGraphicTileTextureCoords> vTmpBorderRightTilesTexCoords;
596 std::vector<CGraphicTile> vTmpBorderBottomTiles;
597 std::vector<CGraphicTileTextureCoords> vTmpBorderBottomTilesTexCoords;
598 std::vector<CGraphicTile> vTmpBorderCorners;
599 std::vector<CGraphicTileTextureCoords> vTmpBorderCornersTexCoords;
600
601 const bool DoTextureCoords = GetTexture().IsValid();
602
603 // create the visual and set it in the optional, afterwards get it
604 CTileLayerVisuals v;
605 v.OnInit(this);
606 VisualsOptional = v;
607 CTileLayerVisuals &Visuals = VisualsOptional.value();
608
609 if(!Visuals.Init(m_pLayerTilemap->m_Width, m_pLayerTilemap->m_Height))
610 return;
611
612 Visuals.m_IsTextured = DoTextureCoords;
613
614 if(!DoTextureCoords)
615 {
616 vTmpTiles.reserve((size_t)m_pLayerTilemap->m_Width * m_pLayerTilemap->m_Height);
617 vTmpBorderTopTiles.reserve((size_t)m_pLayerTilemap->m_Width);
618 vTmpBorderBottomTiles.reserve((size_t)m_pLayerTilemap->m_Width);
619 vTmpBorderLeftTiles.reserve((size_t)m_pLayerTilemap->m_Height);
620 vTmpBorderRightTiles.reserve((size_t)m_pLayerTilemap->m_Height);
621 vTmpBorderCorners.reserve((size_t)4);
622 }
623 else
624 {
625 vTmpTileTexCoords.reserve((size_t)m_pLayerTilemap->m_Width * m_pLayerTilemap->m_Height);
626 vTmpBorderTopTilesTexCoords.reserve((size_t)m_pLayerTilemap->m_Width);
627 vTmpBorderBottomTilesTexCoords.reserve((size_t)m_pLayerTilemap->m_Width);
628 vTmpBorderLeftTilesTexCoords.reserve((size_t)m_pLayerTilemap->m_Height);
629 vTmpBorderRightTilesTexCoords.reserve((size_t)m_pLayerTilemap->m_Height);
630 vTmpBorderCornersTexCoords.reserve((size_t)4);
631 }
632
633 int DrawLeft = m_pLayerTilemap->m_Width;
634 int DrawRight = 0;
635 int DrawTop = m_pLayerTilemap->m_Height;
636 int DrawBottom = 0;
637
638 int x = 0;
639 int y = 0;

Callers

nothing calls this directly

Calls 15

GraphicsFunction · 0.85
AddTileFunction · 0.85
mem_copyFunction · 0.85
endMethod · 0.80
beginMethod · 0.80
CreateBufferContainerMethod · 0.80
IsValidMethod · 0.45
OnInitMethod · 0.45

Tested by

no test coverage detected