Commit 212980db authored by Matthias Betz's avatar Matthias Betz
Browse files

Fix code-review findings in OpenGL view wiring

- resetCamera re-fits the loaded model's bounding box (regression fix)
- remove dead allPolygons local in SceneBuilder.fromModel
- HighlightController: single GPU upload per highlight (no empty intermediate push)
parent 913a2941
......@@ -44,11 +44,15 @@ public class HighlightController {
return c == null ? new double[3] : c;
}
public void clearHighlights() {
private void resetBuffers() {
points.clear();
pointColors.clear();
lines.clear();
lineColors.clear();
}
public void clearHighlights() {
resetBuffers();
push();
}
......@@ -83,10 +87,10 @@ public class HighlightController {
lineColors.add(r, g, b);
}
// ---- public highlight API (no TriangulatedGeometry) ----
// ---- public highlight API ----
public void highlight(Polygon p) {
clearHighlights();
resetBuffers();
addHighlight(p, Color.RED, Color.BLUE);
push();
}
......@@ -102,7 +106,7 @@ public class HighlightController {
}
public void highlight(LinearRing ring) {
clearHighlights();
resetBuffers();
if (ring.getType() == LinearRingType.EXTERIOR) {
addHighlight(ring, Color.RED);
} else {
......@@ -112,7 +116,7 @@ public class HighlightController {
}
public void highlight(List<LinearRing> rings) {
clearHighlights();
resetBuffers();
for (LinearRing lr : rings) {
if (lr.getType() == LinearRingType.EXTERIOR) {
addHighlight(lr, Color.RED);
......@@ -138,7 +142,7 @@ public class HighlightController {
}
public void highlight(Edge e) {
clearHighlights();
resetBuffers();
addHighlight(e);
push();
}
......@@ -153,7 +157,7 @@ public class HighlightController {
}
public void highlight(Vertex v) {
clearHighlights();
resetBuffers();
addPoint(v, Color.RED);
push();
}
......@@ -167,7 +171,7 @@ public class HighlightController {
}
public void highlightEdges(List<Edge> errorEdges) {
clearHighlights();
resetBuffers();
for (Edge e : errorEdges) {
addHighlight(e);
}
......@@ -175,7 +179,7 @@ public class HighlightController {
}
public void highlightPolygons(List<List<Polygon>> components) {
clearHighlights();
resetBuffers();
for (int i = 0; i < components.size(); i++) {
Color extColor;
Color intColor = switch (i % 3) {
......
......@@ -892,6 +892,9 @@ public class MainWindow extends Application {
public void resetCamera() {
glViewport.resetCamera();
if (controller.getOriginBB() != null) {
zoomOutForBoundingBox(controller.getOriginBB());
}
alignNorthArrow();
}
......
......@@ -64,7 +64,6 @@ public final class SceneBuilder {
* {@code TriangulatedGeometry.of(model, filters)}.
*/
public static SceneData fromModel(CityDoctorModel model) {
List<Polygon> allPolygons = new ArrayList<>();
Vector3d center = findCenterOfModel(model);
MeshAccumulator acc = new MeshAccumulator(center);
PickRegistry registry = new PickRegistry();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment