diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index 123a6697..14ebb9a3 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -1850,6 +1850,7 @@ Proof of concept of ui button calling engine code Script engine direct access to joml vectors Script engine passing objects back into methods successfully Room detection within structures +Structure metadata organization diff --git a/src/main/java/electrosphere/client/block/solver/FurnitureSolver.java b/src/main/java/electrosphere/client/block/solver/FurnitureSolver.java new file mode 100644 index 00000000..2ccda3ed --- /dev/null +++ b/src/main/java/electrosphere/client/block/solver/FurnitureSolver.java @@ -0,0 +1,17 @@ +package electrosphere.client.block.solver; + +import electrosphere.data.block.fab.RoomMetadata; + +/** + * Solves for placement of furniture + */ +public class FurnitureSolver { + + /** + * Solves for furniture placement spots for the given room + */ + public static void solveFurnitureSpots(RoomMetadata room){ + + } + +} diff --git a/src/main/java/electrosphere/data/block/fab/RoomMetadata.java b/src/main/java/electrosphere/data/block/fab/RoomMetadata.java new file mode 100644 index 00000000..faa35d0b --- /dev/null +++ b/src/main/java/electrosphere/data/block/fab/RoomMetadata.java @@ -0,0 +1,87 @@ +package electrosphere.data.block.fab; + +import java.util.LinkedList; + +import org.joml.Vector3d; + +import electrosphere.client.interact.select.AreaSelection; + +/** + * Metadata about a room + */ +public class RoomMetadata { + + /** + * The area encompasing the room + */ + AreaSelection area; + + /** + * The list of slots that can have furniture placed on them + */ + LinkedList furnitureSlots = new LinkedList(); + + /** + * The list of entrypoints to the room + */ + LinkedList entryPoints = new LinkedList(); + + /** + * Constructor + * @param area The area of the room + */ + public RoomMetadata(AreaSelection area){ + this.area = area; + } + + /** + * Gets the area of the room + * @return The area of the room + */ + public AreaSelection getArea() { + return area; + } + + /** + * Sets the area of the room + * @param area The area of the room + */ + public void setArea(AreaSelection area) { + this.area = area; + } + + /** + * Gets the furniture slots of the room + * @return The furniture slots of the room + */ + public LinkedList getFurnitureSlots() { + return furnitureSlots; + } + + /** + * Sets the furniture slots of the room + * @param furnitureSlots The furniture slots + */ + public void setFurnitureSlots(LinkedList furnitureSlots) { + this.furnitureSlots = furnitureSlots; + } + + /** + * Gets the entry points of the room + * @return The entry points of the room + */ + public LinkedList getEntryPoints() { + return entryPoints; + } + + /** + * Sets the entry points of the room + * @param entryPoints The entry points + */ + public void setEntryPoints(LinkedList entryPoints) { + this.entryPoints = entryPoints; + } + + + +} diff --git a/src/main/java/electrosphere/data/block/fab/StructureMetadata.java b/src/main/java/electrosphere/data/block/fab/StructureMetadata.java index 9e7ddfdb..04ffcfc1 100644 --- a/src/main/java/electrosphere/data/block/fab/StructureMetadata.java +++ b/src/main/java/electrosphere/data/block/fab/StructureMetadata.java @@ -30,7 +30,7 @@ public class StructureMetadata { /** * The rooms defined within the structure */ - List rooms = new LinkedList(); + List rooms = new LinkedList(); /** @@ -98,8 +98,8 @@ public class StructureMetadata { //make sure it's not already interecting any solved rooms boolean contained = false; - for(AreaSelection room : rooms){ - if(room.containsPoint(selectionStart)){ + for(RoomMetadata room : rooms){ + if(room.getArea().containsPoint(selectionStart)){ contained = true; break; } @@ -113,7 +113,7 @@ public class StructureMetadata { Vector3i roomCenterBlockPos = ClientWorldData.convertRealToLocalBlockSpace(selectionStart); AreaSelection roomArea = AreaSelection.selectRectangularBlockCavity(roomCenterChunkPos, roomCenterBlockPos, MAX_ROOM_SIZE); - rooms.add(roomArea); + rooms.add(new RoomMetadata(roomArea)); } } @@ -130,7 +130,7 @@ public class StructureMetadata { * Gets the list of areas that encompass rooms * @return The list of areas */ - public List getRooms(){ + public List getRooms(){ return rooms; } diff --git a/src/main/java/electrosphere/renderer/pipelines/debug/DebugContentPipeline.java b/src/main/java/electrosphere/renderer/pipelines/debug/DebugContentPipeline.java index bad7982b..ebbccc29 100644 --- a/src/main/java/electrosphere/renderer/pipelines/debug/DebugContentPipeline.java +++ b/src/main/java/electrosphere/renderer/pipelines/debug/DebugContentPipeline.java @@ -17,6 +17,7 @@ import electrosphere.client.interact.select.AreaSelection; import electrosphere.collision.CollisionEngine; import electrosphere.collision.PhysicsUtils; import electrosphere.collision.collidable.Collidable; +import electrosphere.data.block.fab.RoomMetadata; import electrosphere.data.collidable.CollidableTemplate; import electrosphere.data.collidable.HitboxData; import electrosphere.data.common.CommonEntityType; @@ -109,10 +110,10 @@ public class DebugContentPipeline implements RenderPipeline { Globals.clientState.currentStructureData.getBoundingArea(), AssetDataStrings.TEXTURE_RED_TRANSPARENT ); if(Globals.clientState.currentStructureData.getRooms() != null){ - for(AreaSelection roomArea : Globals.clientState.currentStructureData.getRooms()){ + for(RoomMetadata roomArea : Globals.clientState.currentStructureData.getRooms()){ DebugContentPipeline.renderAreaSelection( openGLState, renderPipelineState, modelTransformMatrix, - roomArea, AssetDataStrings.TEXTURE_TEAL_TRANSPARENT + roomArea.getArea(), AssetDataStrings.TEXTURE_TEAL_TRANSPARENT ); } }