Browse Source

load mesh data and structure meshes

server-collision
FatBoy-DOTC 10 months ago
parent
commit
e983a32b5d
  1. 14
      src/engine/CollisionEngine/MeshData.java
  2. 26
      src/engine/db/handlers/dbBuildingHandler.java

14
src/engine/CollisionEngine/MeshData.java

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
package engine.CollisionEngine;
import engine.math.Vector3f;
public class MeshData {
public int propID;
public int meshID;
public Vector3f loc;
public Vector3f scale;
public Vector3f refPoint;
public Vector3f endPoint;
public float maxY;
public float minY;
}

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

@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
package engine.db.handlers;
import engine.CollisionEngine.MeshData;
import engine.Enum;
import engine.Enum.DbObjectType;
import engine.Enum.ProtectionState;
@ -853,6 +854,29 @@ public class dbBuildingHandler extends dbHandlerBase { @@ -853,6 +854,29 @@ public class dbBuildingHandler extends dbHandlerBase {
return false;
}
public void LOAD_MESH_DATA(){
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `final_structure_meshes`")) {
ResultSet rs = preparedStatement.executeQuery();
ArrayList<MeshData> meshData = new ArrayList<>();
while (rs.next()) {
MeshData md = new MeshData();
md.propID = rs.getInt("propID");
md.meshID = rs.getInt("meshID");
md.loc = new Vector3f(rs.getFloat("locX"), rs.getFloat("locY"),rs.getFloat("locz"));
md.scale = new Vector3f(rs.getFloat("scaleX"), rs.getFloat("scaleY"),rs.getFloat("scaleZ"));
md.refPoint = new Vector3f(rs.getFloat("refX"), rs.getFloat("refY"),rs.getFloat("refZ"));
md.endPoint = new Vector3f(rs.getFloat("endX"), rs.getFloat("endY"),rs.getFloat("endZ"));
md.minY = rs.getFloat("minY");
md.maxY = rs.getFloat("maxY");
meshData.add(md);
}
int i = 0; //finished;
} catch (SQLException e) {
Logger.error(e);
}
}
public void LOAD_PROP_MESHES() {
try (Connection connection = DbManager.getConnection();
@ -880,7 +904,7 @@ public class dbBuildingHandler extends dbHandlerBase { @@ -880,7 +904,7 @@ public class dbBuildingHandler extends dbHandlerBase {
}
public void LOAD_MESH_DATA() {
public void LOAD_MESH_DATA_OLD() {
try (Connection connection = DbManager.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_mesh_triangles`")) {

Loading…
Cancel
Save