|
|
@ -549,29 +549,6 @@ public class dbBuildingHandler extends dbHandlerBase { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void LOAD_SUBMESH_LOOKUP() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try (Connection connection = DbManager.getConnection(); |
|
|
|
|
|
|
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_render_submesh`")) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ResultSet rs = preparedStatement.executeQuery(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (rs.next()) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int structureID = rs.getInt("propID"); |
|
|
|
|
|
|
|
int renderID = rs.getInt("meshID"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!BuildingManager._prop_subMeshes.containsKey(structureID)) |
|
|
|
|
|
|
|
BuildingManager._prop_subMeshes.put(structureID, new ArrayList<>()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BuildingManager._prop_subMeshes.get(structureID).add(renderID); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (SQLException e) { |
|
|
|
|
|
|
|
Logger.error(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void LOAD_CONVEX_HULLS() { |
|
|
|
public void LOAD_CONVEX_HULLS() { |
|
|
|
|
|
|
|
|
|
|
|
int recordsRead = 0; |
|
|
|
int recordsRead = 0; |
|
|
@ -586,40 +563,39 @@ public class dbBuildingHandler extends dbHandlerBase { |
|
|
|
recordsRead++; |
|
|
|
recordsRead++; |
|
|
|
|
|
|
|
|
|
|
|
int meshID = rs.getInt("meshID"); |
|
|
|
int meshID = rs.getInt("meshID"); |
|
|
|
String[] vertStrings = rs.getString("convexHull").split(";"); |
|
|
|
String[] hullString = rs.getString("vertices").split(";"); |
|
|
|
ArrayList<Vector2f> vertArrayList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Filter things that couldn't be wrapped
|
|
|
|
// Filter things that couldn't be wrapped
|
|
|
|
|
|
|
|
|
|
|
|
if (vertStrings.length < 3) { |
|
|
|
if (hullString.length < 3) { |
|
|
|
Logger.error("Mesh : " + meshID + " has less than 3 vertices."); |
|
|
|
Logger.error("Mesh : " + meshID + " has less than 3 vertices."); |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ArrayList<Vector2f> vectors = new ArrayList<>(); |
|
|
|
ArrayList<Vector2f> convexHull = new ArrayList<>(); |
|
|
|
ArrayList<Float> floats = new ArrayList<>(); |
|
|
|
ArrayList<Float> floats = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
for(String read : vertStrings){ |
|
|
|
for (String read : hullString) { |
|
|
|
|
|
|
|
|
|
|
|
floats.add(Float.parseFloat(read)); |
|
|
|
floats.add(Float.parseFloat(read)); |
|
|
|
|
|
|
|
|
|
|
|
if(floats.size() == 2) { |
|
|
|
if (floats.size() == 2) { |
|
|
|
vectors.add(new Vector2f(floats.get(0), floats.get(1))); |
|
|
|
convexHull.add(new Vector2f(floats.get(0), floats.get(1))); |
|
|
|
floats.clear(); |
|
|
|
floats.clear(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ArrayList<ArrayList<Vector2f>> meshList; |
|
|
|
ArrayList<ArrayList<Vector2f>> hullList; |
|
|
|
|
|
|
|
|
|
|
|
if (BuildingManager._hull_data.get(meshID) == null) { |
|
|
|
if (BuildingManager._hull_data.get(meshID) == null) { |
|
|
|
meshList = new ArrayList<>(); |
|
|
|
hullList = new ArrayList<>(); |
|
|
|
meshList.add(vectors); |
|
|
|
hullList.add(convexHull); |
|
|
|
BuildingManager._hull_data.put(meshID, meshList); |
|
|
|
BuildingManager._hull_data.put(meshID, hullList); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
meshList = BuildingManager._hull_data.get(meshID); |
|
|
|
hullList = BuildingManager._hull_data.get(meshID); |
|
|
|
meshList.add(vectors); |
|
|
|
hullList.add(convexHull); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|