@ -549,22 +549,22 @@ public class dbBuildingHandler extends dbHandlerBase {
@@ -549,22 +549,22 @@ public class dbBuildingHandler extends dbHandlerBase {
return false ;
}
public void POPULATE_RENDER _LOOKUP( ) {
public void LOAD_SUBMESH _LOOKUP( ) {
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 ( ) ;
while ( rs . next ( ) ) {
int structureID = rs . getInt ( "structure ID" ) ;
int renderID = rs . getInt ( "render ID" ) ;
int structureID = rs . getInt ( "prop ID" ) ;
int renderID = rs . getInt ( "mesh ID" ) ;
if ( ! BuildingManager . _render_lookup . containsKey ( structureID ) )
BuildingManager . _render_lookup . put ( structureID , new ArrayList < > ( ) ) ;
if ( ! BuildingManager . _prop_subMeshes . containsKey ( structureID ) )
BuildingManager . _prop_subMeshes . put ( structureID , new ArrayList < > ( ) ) ;
BuildingManager . _render_lookup . get ( structureID ) . add ( renderID ) ;
BuildingManager . _prop_subMeshes . get ( structureID ) . add ( renderID ) ;
}
} catch ( SQLException e ) {
@ -572,12 +572,12 @@ public class dbBuildingHandler extends dbHandlerBase {
@@ -572,12 +572,12 @@ public class dbBuildingHandler extends dbHandlerBase {
}
}
public void LOAD_MESH _HULLS ( ) {
public void LOAD_CONVEX _HULLS ( ) {
int recordsRead = 0 ;
try ( Connection connection = DbManager . getConnection ( ) ;
PreparedStatement preparedStatement = connection . prepareStatement ( "SELECT * FROM static_vert s" ) ) {
PreparedStatement preparedStatement = connection . prepareStatement ( "SELECT * FROM static_convex_hull s" ) ) {
ResultSet rs = preparedStatement . executeQuery ( ) ;
@ -585,39 +585,40 @@ public class dbBuildingHandler extends dbHandlerBase {
@@ -585,39 +585,40 @@ public class dbBuildingHandler extends dbHandlerBase {
recordsRead + + ;
int prop ID = rs . getInt ( "prop ID" ) ;
String [ ] vertStrings = rs . getString ( "vertices " ) . split ( ";" ) ;
int mesh ID = rs . getInt ( "mesh ID" ) ;
String [ ] vertStrings = rs . getString ( "convexHull " ) . split ( ";" ) ;
ArrayList < Vector2f > vertArrayList = new ArrayList < > ( ) ;
// Filter things that couldn't be wrapped
if ( vertStrings . length < 3 ) {
Logger . error ( "Prop : " + prop ID + " has less than 3 vertices." ) ;
Logger . error ( "Mesh : " + mesh ID + " has less than 3 vertices." ) ;
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 < > ( ) ;
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 ;
if ( BuildingManager . _hull_data . get ( prop ID) = = null ) {
if ( BuildingManager . _hull_data . get ( mesh ID) = = null ) {
meshList = new ArrayList < > ( ) ;
meshList . add ( vectors ) ;
BuildingManager . _hull_data . put ( prop ID, meshList ) ;
BuildingManager . _hull_data . put ( mesh ID, meshList ) ;
} else {
meshList = BuildingManager . _hull_data . get ( prop ID) ;
meshList = BuildingManager . _hull_data . get ( mesh ID) ;
meshList . add ( vectors ) ;
}
}