MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / renderToMesh

Method renderToMesh

src/main/java/field/graphics/FLine.java:1120–1185  ·  view source on GitHub ↗
(MeshBuilder m, Curry.Function3<MeshAcceptor, Node, MoveTo, Node> moveTo, Curry.Function3<MeshAcceptor, Node, LineTo, Node> lineTo, Curry.Function3<MeshAcceptor,
            Node, CubicTo, Node> cubicTo)

Source from the content-addressed store, hash-verified

1118
1119 return m.skipTo(c.start, c.end, mod, () -> {
1120
1121 MeshBuilder_tesselationSupport ts = m.getTessSupport();
1122 flattenAuxProperties();
1123
1124 boolean noContours = attributes.isTrue(StandardFLineDrawing.noContours, false);
1125
1126 m.open();
1127 try {
1128 MeshBuilder.Bookmark start = null;
1129
1130 Node a = null;
1131 if (!noContours)
1132 ts.begin();
1133
1134 for (int i = 0; i < nodes.size(); i++) {
1135 Node b = nodes.get(i);
1136
1137 if (b instanceof MoveTo) {
1138
1139 if (start != null) {
1140 if (!noContours)
1141 ts.endContour();
1142 else ts.end();
1143 }
1144 if (!noContours)
1145 ts.beginContour();
1146 else ts.begin();
1147
1148
1149 a = moveTo.apply(ts, a, (MoveTo) b);
1150 start = m.bookmark();
1151 } else {
1152 if (b instanceof LineTo) a = lineTo.apply(ts, a, (LineTo) b);
1153 else if (b instanceof CubicTo) a = cubicTo.apply(ts, a, (CubicTo) b);
1154 else throw new IllegalArgumentException(" unknown subclass ");
1155 if (start == null) {
1156 start = m.bookmark();
1157 if (!noContours)
1158 ts.beginContour();
1159 else ts.begin();
1160 }
1161
1162 }
1163 }
1164
1165 MeshBuilder.Bookmark end = m.bookmark();
1166
1167 if (start != null && start.at() != end.at()) {
1168 if (!noContours)
1169 ts.endContour();
1170 else ts.end();
1171 }
1172 if (!noContours)
1173 ts.end();
1174 } finally {
1175 m.close();
1176 }
1177 });

Callers 2

dispatchLineMethod · 0.80

Calls 15

flattenAuxPropertiesMethod · 0.95
beginMethod · 0.95
endContourMethod · 0.95
endMethod · 0.95
beginContourMethod · 0.95
renderCubicToMethod · 0.95
computeIfAbsentMethod · 0.80
getTessSupportMethod · 0.80
isTrueMethod · 0.80
bookmarkMethod · 0.80
openMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected