Skip to content

Commit 104ddfb

Browse files
committed
LODSphereMesh: fix MSVC capture error in buildStitchTriangles
MSVC rejects using the constexpr locals N/stride inside the vid/snap lambdas without an explicit capture (C3493), while capturing them trips Clang's unused-capture warning. Reference the namespace-scope CHUNK_RES directly so no capture is needed on either compiler.
1 parent 3262777 commit 104ddfb

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/celengine/lodspheremesh.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,15 +239,14 @@ static void
239239
buildStitchTriangles(int mask, std::vector<unsigned int>& out)
240240
{
241241
constexpr int N = CHUNK_RES;
242-
constexpr auto stride = static_cast<unsigned int>(N + 1);
243242
auto vid = [](int a, int b) {
244-
return static_cast<unsigned int>(a * static_cast<int>(stride) + b);
243+
return static_cast<unsigned int>(a * (CHUNK_RES + 1) + b);
245244
};
246245
auto snap = [mask](int a, int b) {
247246
if (a == 0 && (mask & EDGE_LEFT) != 0 && (b & 1) != 0) --b;
248-
if (a == N && (mask & EDGE_RIGHT) != 0 && (b & 1) != 0) --b;
247+
if (a == CHUNK_RES && (mask & EDGE_RIGHT) != 0 && (b & 1) != 0) --b;
249248
if (b == 0 && (mask & EDGE_BOTTOM) != 0 && (a & 1) != 0) --a;
250-
if (b == N && (mask & EDGE_TOP) != 0 && (a & 1) != 0) --a;
249+
if (b == CHUNK_RES && (mask & EDGE_TOP) != 0 && (a & 1) != 0) --a;
251250
return std::pair<int, int>(a, b);
252251
};
253252

0 commit comments

Comments
 (0)