|
|
@ -998,16 +998,22 @@ public enum BuildingManager { |
|
|
|
|
|
|
|
|
|
|
|
if (mesh_bounding_boxes.containsKey(mesh)) { |
|
|
|
if (mesh_bounding_boxes.containsKey(mesh)) { |
|
|
|
Rectangle2D boundingBox = mesh_bounding_boxes.get(mesh); |
|
|
|
Rectangle2D boundingBox = mesh_bounding_boxes.get(mesh); |
|
|
|
|
|
|
|
//Bounds buildingBounds = building.getBounds();
|
|
|
|
|
|
|
|
float halfX = (float) boundingBox.getWidth() * 0.5f; |
|
|
|
|
|
|
|
float halfZ = (float)boundingBox.getHeight() * 0.5f; |
|
|
|
|
|
|
|
Vector3f bottomRight = new Vector3f(building.loc.x + halfX,building.loc.y,building.loc.z + halfZ); |
|
|
|
|
|
|
|
Vector3f topLeft = new Vector3f(building.loc.x - halfX,building.loc.y,building.loc.z - halfZ); |
|
|
|
|
|
|
|
Vector3f topRight = new Vector3f(building.loc.x + halfX,building.loc.y,building.loc.z - halfZ); |
|
|
|
|
|
|
|
Vector3f bottomLeft = new Vector3f(building.loc.x - halfX,building.loc.y,building.loc.z + halfZ); |
|
|
|
|
|
|
|
|
|
|
|
generatedMesh.BoundingLines = new ArrayList<>(); |
|
|
|
generatedMesh.BoundingLines = new ArrayList<>(); |
|
|
|
float maxX = building.loc.x + (float) boundingBox.getMaxX(); |
|
|
|
Point2D.Float p1 = new Point2D.Float(topLeft.x, topLeft.z); |
|
|
|
float minX = building.loc.x + (float) boundingBox.getMinX(); |
|
|
|
Point2D.Float p2 = new Point2D.Float(topRight.x, topRight.z); |
|
|
|
float maxY = building.loc.z + (float) boundingBox.getMaxY(); |
|
|
|
Point2D.Float p3 = new Point2D.Float(bottomRight.x, bottomRight.z); |
|
|
|
float minY = building.loc.z + (float) boundingBox.getMinY(); |
|
|
|
Point2D.Float p4 = new Point2D.Float(bottomLeft.x, bottomLeft.z); |
|
|
|
Point2D.Float p1 = new Point2D.Float(minX, maxY); |
|
|
|
float rectWidth = topLeft.distance(topRight); |
|
|
|
Point2D.Float p2 = new Point2D.Float(maxX, maxY); |
|
|
|
float rectHeight = topLeft.distance(bottomLeft); |
|
|
|
Point2D.Float p3 = new Point2D.Float(maxX, minY); |
|
|
|
boundingBox.setRect(p1.x,p1.y,rectWidth, rectHeight); |
|
|
|
Point2D.Float p4 = new Point2D.Float(minX, minY); |
|
|
|
|
|
|
|
boundingBox.setRect(p1.x,p1.y,Math.abs(maxX - minX), Math.abs(maxY - minY)); |
|
|
|
|
|
|
|
generatedMesh.BoundingLines.add(new Line2D.Float(p1, p2)); |
|
|
|
generatedMesh.BoundingLines.add(new Line2D.Float(p1, p2)); |
|
|
|
generatedMesh.BoundingLines.add(new Line2D.Float(p2, p3)); |
|
|
|
generatedMesh.BoundingLines.add(new Line2D.Float(p2, p3)); |
|
|
|
generatedMesh.BoundingLines.add(new Line2D.Float(p3, p4)); |
|
|
|
generatedMesh.BoundingLines.add(new Line2D.Float(p3, p4)); |
|
|
|