|
|
|
@ -998,16 +998,22 @@ public enum BuildingManager {
@@ -998,16 +998,22 @@ public enum BuildingManager {
|
|
|
|
|
|
|
|
|
|
if (mesh_bounding_boxes.containsKey(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<>(); |
|
|
|
|
float maxX = building.loc.x + (float) boundingBox.getMaxX(); |
|
|
|
|
float minX = building.loc.x + (float) boundingBox.getMinX(); |
|
|
|
|
float maxY = building.loc.z + (float) boundingBox.getMaxY(); |
|
|
|
|
float minY = building.loc.z + (float) boundingBox.getMinY(); |
|
|
|
|
Point2D.Float p1 = new Point2D.Float(minX, maxY); |
|
|
|
|
Point2D.Float p2 = new Point2D.Float(maxX, maxY); |
|
|
|
|
Point2D.Float p3 = new Point2D.Float(maxX, minY); |
|
|
|
|
Point2D.Float p4 = new Point2D.Float(minX, minY); |
|
|
|
|
boundingBox.setRect(p1.x,p1.y,Math.abs(maxX - minX), Math.abs(maxY - minY)); |
|
|
|
|
Point2D.Float p1 = new Point2D.Float(topLeft.x, topLeft.z); |
|
|
|
|
Point2D.Float p2 = new Point2D.Float(topRight.x, topRight.z); |
|
|
|
|
Point2D.Float p3 = new Point2D.Float(bottomRight.x, bottomRight.z); |
|
|
|
|
Point2D.Float p4 = new Point2D.Float(bottomLeft.x, bottomLeft.z); |
|
|
|
|
float rectWidth = topLeft.distance(topRight); |
|
|
|
|
float rectHeight = topLeft.distance(bottomLeft); |
|
|
|
|
boundingBox.setRect(p1.x,p1.y,rectWidth, rectHeight); |
|
|
|
|
generatedMesh.BoundingLines.add(new Line2D.Float(p1, p2)); |
|
|
|
|
generatedMesh.BoundingLines.add(new Line2D.Float(p2, p3)); |
|
|
|
|
generatedMesh.BoundingLines.add(new Line2D.Float(p3, p4)); |
|
|
|
|