From e983a32b5de8cb0debeb1021f36189dc3c8f7f28 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Tue, 16 Jan 2024 20:10:10 -0600 Subject: [PATCH] load mesh data and structure meshes --- src/engine/CollisionEngine/MeshData.java | 14 ++++++++++ src/engine/db/handlers/dbBuildingHandler.java | 26 ++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 src/engine/CollisionEngine/MeshData.java diff --git a/src/engine/CollisionEngine/MeshData.java b/src/engine/CollisionEngine/MeshData.java new file mode 100644 index 00000000..beaf405e --- /dev/null +++ b/src/engine/CollisionEngine/MeshData.java @@ -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; +} diff --git a/src/engine/db/handlers/dbBuildingHandler.java b/src/engine/db/handlers/dbBuildingHandler.java index 75b8f7fe..7043204e 100644 --- a/src/engine/db/handlers/dbBuildingHandler.java +++ b/src/engine/db/handlers/dbBuildingHandler.java @@ -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 { 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 = 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 { } - 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`")) {