remove macro area object redundant methods
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2025-05-20 12:14:25 -04:00
parent 97e32fabdb
commit 36f5d67241
8 changed files with 12 additions and 51 deletions

View File

@ -1914,6 +1914,7 @@ Delete unused class
Calculate road-interection nodes for town layout
Place roads using line segments instead of splines
Town layout tries to connect intersection nodes with roads
Macro area objects don't store start/end bounds separate from aabb anymore

View File

@ -1,5 +1,6 @@
package electrosphere.server.ai.nodes.solvers;
import org.joml.AABBd;
import org.joml.Vector3d;
import org.joml.Vector3i;
@ -41,7 +42,8 @@ public class SolveBuildMaterialNode implements AITreeNode {
String itemId = Item.getBlockTypeId(blockType);
//store the position of the block we want to place
Vector3d realPos = new Vector3d(struct.getStartPos()).add(
AABBd structAABB = struct.getAABB();
Vector3d realPos = new Vector3d(structAABB.minX,structAABB.minY,structAABB.minZ).add(
repairPos.x * BlockChunkData.BLOCK_SIZE_MULTIPLIER,
repairPos.y * BlockChunkData.BLOCK_SIZE_MULTIPLIER,
repairPos.z * BlockChunkData.BLOCK_SIZE_MULTIPLIER

View File

@ -159,16 +159,6 @@ public class Road implements MacroAreaObject {
throw new UnsupportedOperationException("Unimplemented method 'setPos'");
}
@Override
public Vector3d getStartPos() {
return new Vector3d(aabb.minX, aabb.minY, aabb.minZ);
}
@Override
public Vector3d getEndPos() {
return new Vector3d(aabb.maxX, aabb.maxY, aabb.maxZ);
}
@Override
public AABBd getAABB() {
return aabb;

View File

@ -1,24 +1,11 @@
package electrosphere.server.macro.spatial;
import org.joml.AABBd;
import org.joml.Vector3d;
/**
* A macro object that takes up an area of space instead of just a point
*/
public interface MacroAreaObject extends MacroObject {
/**
* Gets the start position of the AABB for the object
* @return The start position
*/
public Vector3d getStartPos();
/**
* Gets the end position of the AABB for the object
* @return The end position
*/
public Vector3d getEndPos();
/**
* Gets the AABB for the object

View File

@ -85,16 +85,6 @@ public class VirtualStructure implements MacroAreaObject {
this.position = pos;
}
@Override
public Vector3d getStartPos() {
return new Vector3d(aabb.minX,aabb.minY,aabb.minZ);
}
@Override
public Vector3d getEndPos() {
return new Vector3d(aabb.maxX,aabb.maxY,aabb.maxZ);
}
@Override
public AABBd getAABB() {
return this.aabb;

View File

@ -164,19 +164,9 @@ public class Town implements MacroAreaObject {
this.position = pos;
}
@Override
public Vector3d getStartPos() {
return new Vector3d(this.position).sub(this.radius,this.radius,this.radius);
}
@Override
public Vector3d getEndPos() {
return new Vector3d(this.position).add(this.radius,this.radius,this.radius);
}
@Override
public AABBd getAABB() {
return new AABBd(this.getStartPos(), this.getEndPos());
return new AABBd(new Vector3d(this.position).sub(this.radius,this.radius,this.radius), new Vector3d(this.position).add(this.radius,this.radius,this.radius));
}
/**

View File

@ -31,7 +31,7 @@ public class StructureRepairUtils {
}
BlockFab fab = struct.getFab();
Vector3d structStartPos = struct.getStartPos();
Vector3d structStartPos = new Vector3d(struct.getAABB().minX,struct.getAABB().minY,struct.getAABB().minZ);
GriddedDataCellManager griddedDataCellManager = (GriddedDataCellManager)realm.getDataCellManager();
for(int x = 0; x < fab.getDimensions().x; x++){
for(int y = 0; y < fab.getDimensions().y; y++){
@ -92,7 +92,7 @@ public class StructureRepairUtils {
struct.setRepairable(false);
BlockFab fab = struct.getFab();
Vector3d structStartPos = struct.getStartPos();
Vector3d structStartPos = new Vector3d(struct.getAABB().minX,struct.getAABB().minY,struct.getAABB().minZ);
GriddedDataCellManager griddedDataCellManager = (GriddedDataCellManager)realm.getDataCellManager();
for(int x = 0; x < fab.getDimensions().x; x++){
for(int y = 0; y < fab.getDimensions().y; y++){
@ -123,7 +123,7 @@ public class StructureRepairUtils {
}
BlockFab fab = struct.getFab();
Vector3d structStartPos = struct.getStartPos();
Vector3d structStartPos = new Vector3d(struct.getAABB().minX,struct.getAABB().minY,struct.getAABB().minZ);
GriddedDataCellManager griddedDataCellManager = (GriddedDataCellManager)realm.getDataCellManager();
for(int x = 0; x < fab.getDimensions().x; x++){
for(int y = 0; y < fab.getDimensions().y; y++){

View File

@ -181,10 +181,11 @@ public class ServerBlockChunkGenerationThread implements Runnable {
Vector3d currRealPoint = ServerWorldData.convertLocalBlockToRealSpace(chunkPos, blockPos);
for(VirtualStructure struct : filtered){
if(struct.getAABB().testPoint(currRealPoint.x, currRealPoint.y, currRealPoint.z)){
AABBd aabb = struct.getAABB();
localBlockPos.set(
(int)((chunkRealPos.x + (x * BlockChunkData.BLOCK_SIZE_MULTIPLIER) - struct.getStartPos().x) / BlockChunkData.BLOCK_SIZE_MULTIPLIER),
(int)((chunkRealPos.y + (y * BlockChunkData.BLOCK_SIZE_MULTIPLIER) - struct.getStartPos().y) / BlockChunkData.BLOCK_SIZE_MULTIPLIER),
(int)((chunkRealPos.z + (z * BlockChunkData.BLOCK_SIZE_MULTIPLIER) - struct.getStartPos().z) / BlockChunkData.BLOCK_SIZE_MULTIPLIER)
(int)((chunkRealPos.x + (x * BlockChunkData.BLOCK_SIZE_MULTIPLIER) - aabb.minX) / BlockChunkData.BLOCK_SIZE_MULTIPLIER),
(int)((chunkRealPos.y + (y * BlockChunkData.BLOCK_SIZE_MULTIPLIER) - aabb.minY) / BlockChunkData.BLOCK_SIZE_MULTIPLIER),
(int)((chunkRealPos.z + (z * BlockChunkData.BLOCK_SIZE_MULTIPLIER) - aabb.minZ) / BlockChunkData.BLOCK_SIZE_MULTIPLIER)
);
//structure file might have dimensions larger than fab, so need to make sure we're inbounds on fab file to draw data from fab file
if(localBlockPos.x < struct.getFab().getDimensions().x && localBlockPos.y < struct.getFab().getDimensions().y && localBlockPos.z < struct.getFab().getDimensions().z){