structure metadata organization
This commit is contained in:
parent
2d005f4750
commit
d1ab990a63
@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
@ -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){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
87
src/main/java/electrosphere/data/block/fab/RoomMetadata.java
Normal file
87
src/main/java/electrosphere/data/block/fab/RoomMetadata.java
Normal file
@ -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<AreaSelection> furnitureSlots = new LinkedList<AreaSelection>();
|
||||
|
||||
/**
|
||||
* The list of entrypoints to the room
|
||||
*/
|
||||
LinkedList<Vector3d> entryPoints = new LinkedList<Vector3d>();
|
||||
|
||||
/**
|
||||
* 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<AreaSelection> getFurnitureSlots() {
|
||||
return furnitureSlots;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the furniture slots of the room
|
||||
* @param furnitureSlots The furniture slots
|
||||
*/
|
||||
public void setFurnitureSlots(LinkedList<AreaSelection> furnitureSlots) {
|
||||
this.furnitureSlots = furnitureSlots;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entry points of the room
|
||||
* @return The entry points of the room
|
||||
*/
|
||||
public LinkedList<Vector3d> getEntryPoints() {
|
||||
return entryPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the entry points of the room
|
||||
* @param entryPoints The entry points
|
||||
*/
|
||||
public void setEntryPoints(LinkedList<Vector3d> entryPoints) {
|
||||
this.entryPoints = entryPoints;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -30,7 +30,7 @@ public class StructureMetadata {
|
||||
/**
|
||||
* The rooms defined within the structure
|
||||
*/
|
||||
List<AreaSelection> rooms = new LinkedList<AreaSelection>();
|
||||
List<RoomMetadata> rooms = new LinkedList<RoomMetadata>();
|
||||
|
||||
|
||||
/**
|
||||
@ -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<AreaSelection> getRooms(){
|
||||
public List<RoomMetadata> getRooms(){
|
||||
return rooms;
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user