Browse Source

shape

hull4
FatBoy-DOTC 1 year ago
parent
commit
1ee8851fe0
  1. 19
      src/engine/db/handlers/dbBuildingHandler.java

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

@ -28,6 +28,7 @@ import java.sql.SQLException;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@ -572,20 +573,30 @@ public class dbBuildingHandler extends dbHandlerBase {
Logger.error("Prop : " + propID + " has less than 3 vertices."); Logger.error("Prop : " + propID + " has less than 3 vertices.");
continue; continue;
} }
ArrayList<Vector2f> vectors = new ArrayList<>();
ArrayList<Float> floats = new ArrayList<>();
for(String read : vertStrings){
floats.add(Float.parseFloat(read));
if(floats.size() == 2) {
vectors.add(new Vector2f(floats.get(0), floats.get(1)));
floats = new ArrayList<>();
}
}
for (int i = 0; i < vertStrings.length; i += 2) //for (int i = 0; i < vertStrings.length; i += 2)
vertArrayList.add(new Vector2f(Float.parseFloat(vertStrings[i]), Float.parseFloat(vertStrings[1 + 1]))); // 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(propID) == null) {
meshList = new ArrayList<>(); meshList = new ArrayList<>();
meshList.add(vertArrayList); meshList.add(vectors);
BuildingManager._hull_data.put(propID, meshList); BuildingManager._hull_data.put(propID, meshList);
} else { } else {
meshList = BuildingManager._hull_data.get(propID); meshList = BuildingManager._hull_data.get(propID);
meshList.add(vertArrayList); meshList.add(vectors);
} }
} }

Loading…
Cancel
Save