load mesh data and structure meshes

This commit is contained in:
2024-01-17 21:47:15 -06:00
parent 83606046ba
commit 8b095976ef
2 changed files with 11 additions and 9 deletions
+4 -5
View File
@@ -53,12 +53,11 @@ public class Mesh {
}
}
public void MakeBounds(float rotation){
int degrees = (int)Math.toDegrees(rotation);
Vector3f rotatedEnd = Vector3f.rotateAroundPoint(new Vector3f(this.mesh_end_point.x,mesh_location.y,this.mesh_end_point.z),mesh_location,degrees);
Vector3f rotatedRef = Vector3f.rotateAroundPoint(new Vector3f(this.mesh_ref_point.x,mesh_location.y,this.mesh_ref_point.z),mesh_location,degrees);
public void MakeBounds(){
this.mesh_bounds = new Rectangle2D.Float();
this.mesh_bounds.setRect(rotatedEnd.x,rotatedEnd.z,Math.abs(Math.abs(rotatedRef.x) - rotatedEnd.x),Math.abs(rotatedEnd.z) - Math.abs(rotatedRef.z));
float width = this.mesh_ref_point.subtract(this.mesh_location).x * 2;
float height = this.mesh_ref_point.subtract(this.mesh_location).z * 2;
this.mesh_bounds.setRect(this.mesh_ref_point.x,this.mesh_ref_point.z,width, height);
}
}
+7 -4
View File
@@ -993,10 +993,13 @@ public enum BuildingManager {
if(meshData.meshID == 0)
continue;
int degrees = (int)Math.toDegrees(building.getBounds().getQuaternion().angleY);
Mesh generatedMesh = new Mesh();
generatedMesh.mesh_end_point = new Vector3f(building.loc.x,building.loc.y,building.loc.z).add(meshData.loc).add(meshData.endPoint);
generatedMesh.mesh_ref_point = new Vector3f(building.loc.x,building.loc.y,building.loc.z).add(meshData.loc).add(meshData.refPoint);
generatedMesh.mesh_location = new Vector3f(building.loc.x,building.loc.y,building.loc.z).add(meshData.loc);
generatedMesh.mesh_end_point = Vector3f.rotateAroundPoint(new Vector3f(building.loc.x,building.loc.y,building.loc.z).add(meshData.loc.add(meshData.endPoint)),new Vector3f(building.loc.x,building.loc.y,building.loc.z),degrees);
generatedMesh.mesh_ref_point = Vector3f.rotateAroundPoint(new Vector3f(building.loc.x,building.loc.y,building.loc.z).add(meshData.loc.add(meshData.refPoint)),new Vector3f(building.loc.x,building.loc.y,building.loc.z),degrees);
generatedMesh.mesh_location = Vector3f.rotateAroundPoint(new Vector3f(building.loc.x,building.loc.y,building.loc.z).add(meshData.loc),new Vector3f(building.loc.x,building.loc.y,building.loc.z),degrees);
generatedMesh.mesh_max_y = building.loc.y + meshData.maxY;
generatedMesh.mesh_min_y = building.loc.y + meshData.minY;
generatedMesh.mesh_scale = meshData.scale;
@@ -1005,7 +1008,7 @@ public enum BuildingManager {
generatedMesh.parent_structure_id = building.meshUUID;
generatedMesh.parentUUID = building.getObjectUUID();
generatedMesh.AdoptTriangles(building.getBounds().getQuaternion().angleY);
generatedMesh.MakeBounds(building.getBounds().getQuaternion().angleY);
generatedMesh.MakeBounds();
building.buildingMeshes.add(generatedMesh);
}
}