# HG changeset patch # User Teemu Piippo # Date 1680991009 -10800 # Node ID ef90ed0a572075646885a9fed0dc1329aa9fd8fa # Parent 66c75604f5b81f20f5f40c4c48d2f483b2a04fdb Hopefully fixed all problems with determining polygon winding diff -r 66c75604f5b8 -r ef90ed0a5720 src/parser.cpp --- a/src/parser.cpp Sat Apr 08 22:09:29 2023 +0300 +++ b/src/parser.cpp Sun Apr 09 00:56:49 2023 +0300 @@ -107,6 +107,10 @@ parsed->content = match.captured(0); return parsed; }; + if (auto line1Match = tryRe(exprs().commentRe)) { + LineType0* const parsed = init(LineType0{}, *line1Match); + parsed->value = Comment{attrib(*parsed)}; + } if (auto line1Match = tryRe(exprs().subfileRe)) { LineType1* const parsed = init(LineType1{}, *line1Match); parsed->value = { @@ -116,7 +120,7 @@ glm::vec4{vectorAttrib(*parsed), 0}, glm::vec4{vectorAttrib(*parsed), 0}, glm::vec4{vectorAttrib(*parsed), 0}, - glm::vec4{vectorAttrib(*parsed), 0} + glm::vec4{vectorAttrib(*parsed), 1} }, }, colorAttrib(parsed), diff -r 66c75604f5b8 -r ef90ed0a5720 src/parser.h --- a/src/parser.h Sat Apr 08 22:09:29 2023 +0300 +++ b/src/parser.h Sun Apr 09 00:56:49 2023 +0300 @@ -55,7 +55,7 @@ T value; }; -using LineType0 = LineType; +using LineType0 = LineType; using LineType1 = LineType, Attribute::LineType, Attribute::Color, diff -r 66c75604f5b8 -r ef90ed0a5720 src/polygoncache.cpp --- a/src/polygoncache.cpp Sat Apr 08 22:09:29 2023 +0300 +++ b/src/polygoncache.cpp Sun Apr 09 00:56:49 2023 +0300 @@ -70,7 +70,7 @@ if (polygon.color == MAIN_COLOR) { polygon.color = ref.color; } - add(polygon); + add(1, polygon); } } @@ -106,16 +106,16 @@ } }, [&](const LineType2& line2) { - add({line2.value, line2.value.color}); + add(2, {line2.value, line2.value.color}); }, [&](const LineType3& line3) { - add({line3.value, line3.value.color}); + add(3, {line3.value, line3.value.color}); }, [&](const LineType4& line4) { - add({line4.value, line4.value.color}); + add(4, {line4.value, line4.value.color}); }, [&](const LineType5& line5) { - add({line5.value, line5.value.color}); + add(5, {line5.value, line5.value.color}); }, [&add, context, &reserve](const LineType1& line1) { QTextDocument* const dependency = findDependency(line1.value, context); @@ -150,9 +150,9 @@ Winding winding = NoWinding; std::vector> result; int i = 0; - const auto add = [&result, winding, i](const PolygonElement& poly){ + const auto add = [&result, &winding, &i](int lineno, const PolygonElement& poly){ result.push_back({poly, i}); - if (winding == Winding::Clockwise) { + if (lineno != 1 and winding == Winding::Clockwise) { gl::invert(result.back()); } };