Browse Source

load mesh data and structure meshes

server-collision
FatBoy-DOTC 10 months ago
parent
commit
d573534f6d
  1. 9
      src/engine/db/handlers/dbBuildingHandler.java

9
src/engine/db/handlers/dbBuildingHandler.java

@ -940,7 +940,8 @@ public class dbBuildingHandler extends dbHandlerBase { @@ -940,7 +940,8 @@ public class dbBuildingHandler extends dbHandlerBase {
ResultSet rs = preparedStatement.executeQuery();
BuildingManager.mesh_bounding_boxes = new HashMap<>();
while (rs.next()) {
if(BuildingManager.mesh_bounding_boxes.containsKey(rs.getInt("meshId")) == false){
int meshID = rs.getInt("meshId");
if(BuildingManager.mesh_bounding_boxes.containsKey(meshID) == false){
float endX = Float.parseFloat(rs.getString("end").split(";")[0]);
float endZ = Float.parseFloat(rs.getString("end").split(";")[1]);
float refX = Float.parseFloat(rs.getString("ref").split(";")[0]);
@ -948,11 +949,11 @@ public class dbBuildingHandler extends dbHandlerBase { @@ -948,11 +949,11 @@ public class dbBuildingHandler extends dbHandlerBase {
Vector2f topLeft = new Vector2f(refX,refZ);
float width = Math.abs(endX-refX);
float height = Math.abs(endZ-refZ);
float width = Math.abs(Math.abs(endX)-Math.abs(refX));
float height = Math.abs(Math.abs(endZ)-Math.abs(refZ));
Rectangle2D boundRect = new Rectangle2D.Float();
boundRect.setRect(topLeft.x,topLeft.y,width,height);
BuildingManager.mesh_bounding_boxes.put(rs.getInt("meshId"),boundRect);
BuildingManager.mesh_bounding_boxes.put(meshID,boundRect);
}
}

Loading…
Cancel
Save