mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-26 02:03:48 +00:00
parent
5a24f2868b
commit
cd46cc24fa
1 changed files with 17 additions and 15 deletions
|
@ -95,25 +95,27 @@ void GridRender::rebuildBuffers(const std::vector<ObsRow>& rows)
|
||||||
{
|
{
|
||||||
const size_t H = game->getGridSize().y;
|
const size_t H = game->getGridSize().y;
|
||||||
primIndexInLine.resize(H);
|
primIndexInLine.resize(H);
|
||||||
|
if(H)
|
||||||
size_t lasty = 0;
|
|
||||||
size_t lastidx = 0;
|
|
||||||
for(size_t i = 0; i < N; ++i)
|
|
||||||
{
|
{
|
||||||
const ObsRow& row = rows[i];
|
size_t lasty = 0;
|
||||||
assert(row.ty >= lasty); // rows must be sorted, lowest y first
|
size_t lastidx = 0;
|
||||||
if(row.ty > lasty)
|
for(size_t i = 0; i < N; ++i)
|
||||||
{
|
{
|
||||||
// Handle this correctly even if there is no row on some lines
|
const ObsRow& row = rows[i];
|
||||||
for(size_t y = lasty; y < row.ty; ++y)
|
assert(row.ty >= lasty); // rows must be sorted, lowest y first
|
||||||
primIndexInLine[y] = lastidx;
|
if(row.ty > lasty)
|
||||||
lasty = row.ty;
|
{
|
||||||
lastidx = i * 6;
|
// Handle this correctly even if there is no row on some lines
|
||||||
|
for(size_t y = lasty; y < row.ty; ++y)
|
||||||
|
primIndexInLine[y] = lastidx;
|
||||||
|
lasty = row.ty;
|
||||||
|
lastidx = i * 6;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Don't bother filling the rest, anything beyond the end is eval'd as primsToDraw
|
// Don't bother filling the rest, anything beyond the end is eval'd as primsToDraw
|
||||||
primIndexInLine.resize(lasty);
|
primIndexInLine.resize(lasty);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2 tris = 6 verts per ObsRow, each vertex is 2x uint16, makes 24b per quad.
|
// 2 tris = 6 verts per ObsRow, each vertex is 2x uint16, makes 24b per quad.
|
||||||
|
|
Loading…
Reference in a new issue