shuffling data
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2025-05-18 11:36:54 -04:00
parent 5ca9310d3e
commit 009af5cc3e
4 changed files with 56 additions and 23 deletions

View File

@ -19,7 +19,6 @@ import electrosphere.client.terrain.cells.ClientDrawCellManager;
import electrosphere.client.terrain.foliage.FoliageCellManager; import electrosphere.client.terrain.foliage.FoliageCellManager;
import electrosphere.client.terrain.manager.ClientTerrainManager; import electrosphere.client.terrain.manager.ClientTerrainManager;
import electrosphere.collision.CollisionEngine; import electrosphere.collision.CollisionEngine;
import electrosphere.data.block.fab.StructureMetadata;
import electrosphere.data.common.CommonEntityType; import electrosphere.data.common.CommonEntityType;
import electrosphere.data.voxel.VoxelType; import electrosphere.data.voxel.VoxelType;
import electrosphere.entity.Entity; import electrosphere.entity.Entity;
@ -188,11 +187,6 @@ public class ClientState {
*/ */
public int openInventoriesCount = 0; public int openInventoriesCount = 0;
/**
* The currently selected structure's data
*/
public StructureMetadata currentStructureData;
/** /**
* Constructor * Constructor
*/ */

View File

@ -9,6 +9,7 @@ import electrosphere.client.block.solver.RoomSolver;
import electrosphere.client.interact.select.AreaSelection; import electrosphere.client.interact.select.AreaSelection;
import electrosphere.data.block.fab.BlockFab; import electrosphere.data.block.fab.BlockFab;
import electrosphere.data.block.fab.BlockFabMetadata; import electrosphere.data.block.fab.BlockFabMetadata;
import electrosphere.data.block.fab.RoomMetadata;
import electrosphere.data.block.fab.StructureMetadata; import electrosphere.data.block.fab.StructureMetadata;
import electrosphere.engine.Globals; import electrosphere.engine.Globals;
import imgui.ImGui; import imgui.ImGui;
@ -35,19 +36,12 @@ public class ImGuiStructureTab {
} }
} else { } else {
BlockFab currentFab = Globals.clientState.clientLevelEditorData.getCurrentFab(); BlockFab currentFab = Globals.clientState.clientLevelEditorData.getCurrentFab();
if(Globals.clientState.currentStructureData == null){ if(ImGui.button("Create Structure Data")){
if(ImGui.button("Create Structure Data")){ StructureMetadata structureData = StructureMetadata.create(Globals.cursorState.getAreaSelection());
Globals.clientState.currentStructureData = StructureMetadata.create(Globals.cursorState.getAreaSelection()); currentFab.getFabMetadata().setStructureData(structureData);
}
} }
if(Globals.clientState.currentStructureData != null && ImGui.button("Calculate Rooms")){ if(currentFab.getFabMetadata().getStructureData() != null && ImGui.button("Calculate Rooms")){
RoomSolver.computeRoomsFromSelection(Globals.cursorState.getAreaSelection(),Globals.clientState.currentStructureData); RoomSolver.computeRoomsFromSelection(Globals.cursorState.getAreaSelection(),currentFab.getFabMetadata().getStructureData());
}
if(ImGui.button("Convert current selection to room")){
AreaSelection currentSelection = Globals.cursorState.getAreaSelection();
if(currentSelection != null){
currentFab.getFabMetadata().getAreas().add(currentSelection);
}
} }
if(ImGui.button("Save")){ if(ImGui.button("Save")){
File exportLoc = new File("./assets/Data/fab/struct.block"); File exportLoc = new File("./assets/Data/fab/struct.block");
@ -79,6 +73,25 @@ public class ImGuiStructureTab {
} else { } else {
ImGui.text("Areas undefined in metadata"); ImGui.text("Areas undefined in metadata");
} }
if(fabMetadata.getStructureData() != null){
StructureMetadata structureMetadata = fabMetadata.getStructureData();
if(ImGui.collapsingHeader("Rooms in structure: " + structureMetadata.getRooms().size())){
int i = 0;
ImGui.indent();
for(RoomMetadata room : structureMetadata.getRooms()){
if(ImGui.collapsingHeader("Room " + i)){
ImGui.indent();
ImGui.text("Entry points: " + room.getEntryPoints().size());
ImGui.text("Furniture slots: " + room.getFurnitureSlots().size());
ImGui.unindent();
}
i++;
}
ImGui.unindent();
}
} else {
ImGui.text("Structure Data undefined in metadata");
}
} }
} }

View File

@ -15,6 +15,11 @@ public class BlockFabMetadata {
*/ */
private List<AreaSelection> areas; private List<AreaSelection> areas;
/**
* The structure metadata for the fab
*/
private StructureMetadata structureData;
/** /**
* Constructor * Constructor
*/ */
@ -38,5 +43,20 @@ public class BlockFabMetadata {
this.areas = areas; this.areas = areas;
} }
/**
* Gets the structure data for the fab
* @return The structure data
*/
public StructureMetadata getStructureData(){
return structureData;
}
/**
* Sets the structure data for the fab
* @param structureMetadata The structure data
*/
public void setStructureData(StructureMetadata structureData){
this.structureData = structureData;
}
} }

View File

@ -19,6 +19,7 @@ import electrosphere.collision.PhysicsUtils;
import electrosphere.collision.collidable.Collidable; import electrosphere.collision.collidable.Collidable;
import electrosphere.data.block.fab.FurnitureSlotMetadata; import electrosphere.data.block.fab.FurnitureSlotMetadata;
import electrosphere.data.block.fab.RoomMetadata; import electrosphere.data.block.fab.RoomMetadata;
import electrosphere.data.block.fab.StructureMetadata;
import electrosphere.data.collidable.CollidableTemplate; import electrosphere.data.collidable.CollidableTemplate;
import electrosphere.data.collidable.HitboxData; import electrosphere.data.collidable.HitboxData;
import electrosphere.data.common.CommonEntityType; import electrosphere.data.common.CommonEntityType;
@ -105,14 +106,19 @@ public class DebugContentPipeline implements RenderPipeline {
} }
//render current structure data //render current structure data
if(Globals.clientState.currentStructureData != null){ if(
if(Globals.clientState.currentStructureData.getBoundingArea() != null){ Globals.clientState.clientLevelEditorData.getCurrentFab() != null &&
Globals.clientState.clientLevelEditorData.getCurrentFab().getFabMetadata() != null &&
Globals.clientState.clientLevelEditorData.getCurrentFab().getFabMetadata().getStructureData() != null
){
StructureMetadata structureData = Globals.clientState.clientLevelEditorData.getCurrentFab().getFabMetadata().getStructureData();
if(structureData.getBoundingArea() != null){
DebugContentPipeline.renderAreaSelection( DebugContentPipeline.renderAreaSelection(
openGLState, renderPipelineState, modelTransformMatrix, openGLState, renderPipelineState, modelTransformMatrix,
Globals.clientState.currentStructureData.getBoundingArea(), AssetDataStrings.TEXTURE_RED_TRANSPARENT structureData.getBoundingArea(), AssetDataStrings.TEXTURE_RED_TRANSPARENT
); );
if(Globals.clientState.currentStructureData.getRooms() != null){ if(structureData.getRooms() != null){
for(RoomMetadata roomArea : Globals.clientState.currentStructureData.getRooms()){ for(RoomMetadata roomArea : structureData.getRooms()){
DebugContentPipeline.renderAreaSelection( DebugContentPipeline.renderAreaSelection(
openGLState, renderPipelineState, modelTransformMatrix, openGLState, renderPipelineState, modelTransformMatrix,
roomArea.getArea(), AssetDataStrings.TEXTURE_TEAL_TRANSPARENT roomArea.getArea(), AssetDataStrings.TEXTURE_TEAL_TRANSPARENT