void OPENGL_3D_ENGNIE::DrawFrontBuffer() { int roadIdx,signIdx,charIdx,lineIdx; int frontBufIdx = backBufIdx^1; int charFrontBufIdx = charBackBufIdx^1; //draw all the road glPushMatrix(); for(roadIdx = 0; roadIdx < RoadBuffer[frontBufIdx].number; roadIdx++) { DrawRoad(RoadBuffer[frontBufIdx].buffer[roadIdx]); } glPopMatrix(); //draw all the sign for(signIdx = 0; signIdx < signBuffer[frontBufIdx].number; signIdx++) { DrawSign(signBuffer[frontBufIdx].buffer[signIdx]); } for(lineIdx = 0; lineIdx < lineBuffer[frontBufIdx].number; lineIdx++) { DrawLine(&lineBuffer[frontBufIdx].line[lineIdx]); } //draw all the charater for(charIdx = 0; charIdx < charBuffer[charFrontBufIdx].number; charIdx++) { DrawChar(charBuffer[charFrontBufIdx].buffer[charIdx]); } }
// cGridStructGen::cStructure overrides: virtual void DrawIntoChunk(cChunkDesc & a_Chunk) override { // Iterate over all items // Each intersecting prefab is placed on ground, then drawn // Each intersecting road is drawn by replacing top soil blocks with gravel / sandstone blocks cChunkDef::HeightMap HeightMap; // Heightmap for this chunk, used by roads m_HeightGen->GenHeightMap(a_Chunk.GetChunkX(), a_Chunk.GetChunkZ(), HeightMap); for (cPlacedPieces::iterator itr = m_Pieces.begin(), end = m_Pieces.end(); itr != end; ++itr) { cPrefab & Prefab = (cPrefab &)((*itr)->GetPiece()); if ((*itr)->GetPiece().GetSize().y == 1) { // It's a road, special handling (change top terrain blocks to m_RoadBlock) DrawRoad(a_Chunk, **itr, HeightMap); continue; } if (Prefab.ShouldMoveToGround() && !(*itr)->HasBeenMovedToGround()) { PlacePieceOnGround(**itr); } Prefab.Draw(a_Chunk, *itr); } // for itr - m_PlacedPieces[] }