diff options
-rw-r--r-- | src/mbgl/renderer/buckets/fill_extrusion_bucket.cpp | 12 | ||||
-rw-r--r-- | src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp | 2 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/mbgl/renderer/buckets/fill_extrusion_bucket.cpp b/src/mbgl/renderer/buckets/fill_extrusion_bucket.cpp index fe742828b8..fb491e0db2 100644 --- a/src/mbgl/renderer/buckets/fill_extrusion_bucket.cpp +++ b/src/mbgl/renderer/buckets/fill_extrusion_bucket.cpp @@ -126,7 +126,12 @@ void FillExtrusionBucket::addFeature(const GeometryTileFeature& feature, vertices.emplace_back( FillExtrusionProgram::layoutVertex(p2, perp.x, perp.y, 0, 1, edgeDistance)); - triangles.emplace_back(triangleIndex, triangleIndex + 1, triangleIndex + 2); + // ┌──────┐ + // │ 0 1 │ Counter-Clockwise winding order. + // │ │ Triangle 1: 0 => 2 => 1 + // │ 2 3 │ Triangle 2: 1 => 2 => 3 + // └──────┘ + triangles.emplace_back(triangleIndex, triangleIndex + 2, triangleIndex + 1); triangles.emplace_back(triangleIndex + 1, triangleIndex + 2, triangleIndex + 3); triangleIndex += 4; triangleSegment.vertexLength += 4; @@ -141,8 +146,9 @@ void FillExtrusionBucket::addFeature(const GeometryTileFeature& feature, assert(nIndices % 3 == 0); for (uint32_t i = 0; i < nIndices; i += 3) { - triangles.emplace_back(flatIndices[indices[i]], flatIndices[indices[i + 1]], - flatIndices[indices[i + 2]]); + // Counter-Clockwise winding order. + triangles.emplace_back(flatIndices[indices[i]], flatIndices[indices[i + 2]], + flatIndices[indices[i + 1]]); } triangleSegment.vertexLength += totalVertices; diff --git a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp index 0b5c05759c..717408fbd1 100644 --- a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp @@ -109,7 +109,7 @@ void RenderFillExtrusionLayer::render(PaintParameters& parameters, RenderSource* parameters.depthModeFor3D(gl::DepthMode::ReadWrite), gl::StencilMode::disabled(), parameters.colorModeForRenderPass(), - gl::CullFaceMode::disabled(), + gl::CullFaceMode::backCCW(), *tileBucket.indexBuffer, tileBucket.triangleSegments, allUniformValues, |