This commit is contained in:
2023-11-07 21:04:01 -06:00
parent d502a889a6
commit 1b5738f9b3
+2 -11
View File
@@ -985,27 +985,18 @@ public enum BuildingManager {
} }
for (ArrayList<Vector2f> meshEntry : convexHullList) { for (ArrayList<Vector2f> meshEntry : convexHullList) {
ArrayList<Vector3fImmutable> rotatedPoints = new ArrayList<>();
for (Vector2f vect : meshEntry) {
Vector3fImmutable offsetVect = new Vector3fImmutable(vect.x + building.loc.x, building.loc.y,vect.y + building.loc.z);
Vector3fImmutable rotatedVect = Vector3fImmutable.rotateAroundPoint(offsetVect,building.loc,building.getRot().y);
rotatedPoints.add(rotatedVect);
}
Path2D.Float meshBound = new Path2D.Float(); Path2D.Float meshBound = new Path2D.Float();
Polygon poly = new Polygon();
Vector3fImmutable offsetVect = new Vector3fImmutable(meshEntry.get(0).x + building.loc.x, building.loc.y,meshEntry.get(0).y + building.loc.z); Vector3fImmutable offsetVect = new Vector3fImmutable(meshEntry.get(0).x + building.loc.x, building.loc.y,meshEntry.get(0).y + building.loc.z);
Vector3fImmutable rotatedStart = Vector3fImmutable.rotateAroundPoint(offsetVect,building.loc,building.getRot().getRotation()); Vector3fImmutable rotatedStart = Vector3fImmutable.rotateAroundPoint(building.loc,offsetVect,building.getRot().y);
meshBound.moveTo(rotatedStart.x,rotatedStart.z); meshBound.moveTo(rotatedStart.x,rotatedStart.z);
for (Vector2f vect : meshEntry) { for (Vector2f vect : meshEntry) {
if(meshEntry.indexOf(vect) == 0){ if(meshEntry.indexOf(vect) == 0){
continue; continue;
} }
Vector3fImmutable pos = new Vector3fImmutable(vect.x + building.loc.x, building.loc.y,vect.y + building.loc.z); Vector3fImmutable pos = new Vector3fImmutable(vect.x + building.loc.x, building.loc.y,vect.y + building.loc.z);
Vector3fImmutable rotatedPos = Vector3fImmutable.rotateAroundPoint(pos,building.loc,building.getRot().getRotation()); Vector3fImmutable rotatedPos = Vector3fImmutable.rotateAroundPoint(building.loc,pos,building.getRot().getRotation());
poly.addPoint((int)rotatedPos.x,(int)rotatedPos.z);
meshBound.lineTo(rotatedPos.x,rotatedPos.z); meshBound.lineTo(rotatedPos.x,rotatedPos.z);
} }
Area area = new Area(poly);
meshBound.lineTo(rotatedStart.x,rotatedStart.z); meshBound.lineTo(rotatedStart.x,rotatedStart.z);
meshBound.closePath(); meshBound.closePath();
building.meshes.add(meshBound); building.meshes.add(meshBound);