103 for (const RingFinder::Component& component : g_RingFinder.bestSolution()->getComponents()) |
103 for (const RingFinder::Component& component : g_RingFinder.bestSolution()->getComponents()) |
104 { |
104 { |
105 primitiveModel.ringNumber = component.num; |
105 primitiveModel.ringNumber = component.num; |
106 primitiveFile = primitives()->getPrimitive(primitiveModel); |
106 primitiveFile = primitives()->getPrimitive(primitiveModel); |
107 Matrix matrix = Matrix::fromRotationMatrix(renderer()->currentCamera().transformationMatrix(component.scale)); |
107 Matrix matrix = Matrix::fromRotationMatrix(renderer()->currentCamera().transformationMatrix(component.scale)); |
108 model.emplace<LDSubfileReference>(primitiveFile, matrix, m_drawedVerts.first()); |
108 model.append<LDSubfileReference>(primitiveFile, matrix, m_drawedVerts.first()); |
109 } |
109 } |
110 } |
110 } |
111 else |
111 else |
112 { |
112 { |
113 // Ring finder failed, last resort: draw the ring with quads |
113 // Ring finder failed, last resort: draw the ring with quads |
137 v2.setCoordinate (localx, v2[localx] + c1[i].x2()); |
137 v2.setCoordinate (localx, v2[localx] + c1[i].x2()); |
138 v2.setCoordinate (localy, v2[localy] + c1[i].y2()); |
138 v2.setCoordinate (localy, v2[localy] + c1[i].y2()); |
139 v3.setCoordinate (localx, v3[localx] + c1[i].x1()); |
139 v3.setCoordinate (localx, v3[localx] + c1[i].x1()); |
140 v3.setCoordinate (localy, v3[localy] + c1[i].y1()); |
140 v3.setCoordinate (localy, v3[localy] + c1[i].y1()); |
141 |
141 |
142 LDQuadrilateral* quad = model.emplace<LDQuadrilateral>(v0, v1, v2, v3); |
142 LDQuadrilateral* quad = model.append<LDQuadrilateral>(v0, v1, v2, v3); |
143 quad->setColor(MainColor); |
143 quad->setColor(MainColor); |
144 |
144 |
145 // Ensure the quads always are BFC-front towards the camera |
145 // Ensure the quads always are BFC-front towards the camera |
146 if (static_cast<int>(renderer()->camera()) % 3 <= 0) |
146 if (static_cast<int>(renderer()->camera()) % 3 <= 0) |
147 quad->invert(); |
147 quad->invert(); |
148 } |
148 } |
149 } |
149 } |
150 |
150 |
151 if (circleOrDisc and primitiveFile) |
151 if (circleOrDisc and primitiveFile) |
152 model.emplace<LDSubfileReference>(primitiveFile, transform, m_drawedVerts.first()); |
152 model.append<LDSubfileReference>(primitiveFile, transform, m_drawedVerts.first()); |
153 |
153 |
154 finishDraw (model); |
154 finishDraw (model); |
155 } |
155 } |
156 |
156 |
157 /* |
157 /* |