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