--- a/src/parser.cpp Mon Mar 09 22:12:50 2020 +0200 +++ b/src/parser.cpp Mon Mar 09 23:42:26 2020 +0200 @@ -263,6 +263,21 @@ } invertNext = false; } + // Test quadrilateral splitting by splitting all the quadrilaterals + QVector<ldraw::quadrilateralid_t> quadrilateral_ids; + for (int i = 0; i < editor.model().size(); i += 1) + { + const ldraw::id_t id = editor.model().resolve(editor.model().index(i)); + const ldraw::quadrilateralid_t quad_id = editor.model().checkType<ldraw::Quadrilateral>(id); + if (not(quad_id == ldraw::NULL_ID)) + { + quadrilateral_ids.push_back(quad_id); + } + } + for (const ldraw::quadrilateralid_t id : quadrilateral_ids) + { + ldraw::splitQuadrilateral(editor, id); + } } static ldraw::Color colorFromString(const QString& colorString) @@ -376,11 +391,10 @@ throw BodyParseError{"wrong amount of tokens"}; } const ldraw::Color color = colorFromString(tokens[colorPosition]); - QVector<glm::vec3> vertices; - vertices.reserve(NumVertices); + std::array<glm::vec3, NumVertices> vertices; for (int i = 0; i < NumVertices; i += 1) { - vertices.append(vertexFromStrings(tokens, vertexPosition(i))); + vertices[unsigned_cast(i)] = vertexFromStrings(tokens, vertexPosition(i)); } return std::make_unique<T>(vertices, color); }