farm plots place farmland voxel type
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2025-05-28 22:22:07 -04:00
parent c863365c26
commit 3f401dfde3
4 changed files with 23 additions and 11 deletions

View File

@ -46,6 +46,11 @@
"id" : 8, "id" : 8,
"name" : "Rock (Slate)", "name" : "Rock (Slate)",
"texture" : "/Textures/Ground/rock3_256.png" "texture" : "/Textures/Ground/rock3_256.png"
},
{
"id" : 9,
"name" : "Farmland",
"texture" : "/Textures/Ground/farmland_1.png"
} }
] ]
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 KiB

View File

@ -2044,6 +2044,8 @@ Utilities for turning mesh gen algos into renderable entities
Back off farm plots from roads by road radius Back off farm plots from roads by road radius
Farm plots properly save/load to/from disk Farm plots properly save/load to/from disk
Farm plots place dirt Farm plots place dirt
Farmland voxel type
Farm plots place farmland

View File

@ -226,7 +226,7 @@ public class ProceduralChunkGenerator implements ChunkGenerator {
values[x][y][z] = voxel.type; values[x][y][z] = voxel.type;
} }
//apply macro data //apply macro data
if(macroData != null && this.applyMacroData(macroData, realX, realY, realZ, voxel)){ if(macroData != null && this.applyMacroData(macroData, realX, realY, realZ, surfaceHeight, voxel)){
weights[x][y][z] = voxel.weight; weights[x][y][z] = voxel.weight;
values[x][y][z] = voxel.type; values[x][y][z] = voxel.type;
} }
@ -274,6 +274,7 @@ public class ProceduralChunkGenerator implements ChunkGenerator {
private boolean applyMacroData( private boolean applyMacroData(
List<MacroObject> objects, List<MacroObject> objects,
double realX, double realY, double realZ, double realX, double realY, double realZ,
double surfaceHeight,
GeneratedVoxel voxel GeneratedVoxel voxel
){ ){
boolean rVal = false; boolean rVal = false;
@ -282,11 +283,13 @@ public class ProceduralChunkGenerator implements ChunkGenerator {
if(object instanceof Road){ if(object instanceof Road){
Road road = (Road)object; Road road = (Road)object;
//broad phase intersection //broad phase intersection
if(road.getAABB().testPoint(realX, realY, realZ)){ if(Math.abs(realY - surfaceHeight) < 3){
if(GeomUtils.pointIntersectsLineSegment(realPt, road.getPoint1(), road.getPoint2(), road.getRadius())){ if(road.getAABB().testPoint(realX, realY, realZ)){
if(voxel.type != ServerTerrainChunk.VOXEL_TYPE_AIR){ if(GeomUtils.pointIntersectsLineSegment(realPt, road.getPoint1(), road.getPoint2(), road.getRadius())){
voxel.type = 1; if(voxel.type != ServerTerrainChunk.VOXEL_TYPE_AIR){
rVal = true; voxel.type = 1;
rVal = true;
}
} }
} }
} }
@ -309,11 +312,13 @@ public class ProceduralChunkGenerator implements ChunkGenerator {
} }
} else if(object instanceof Town){ } else if(object instanceof Town){
} else if(object instanceof MacroRegion region){ } else if(object instanceof MacroRegion region){
if(region.getRegion().getAABB().testPoint(realPt)){ if(Math.abs(realY - surfaceHeight) < 3){
if(region.getRegion().intersects(realPt)){ if(region.getRegion().getAABB().testPoint(realPt)){
if(voxel.type != ServerTerrainChunk.VOXEL_TYPE_AIR){ if(region.getRegion().intersects(realPt)){
voxel.type = 1; if(voxel.type != ServerTerrainChunk.VOXEL_TYPE_AIR){
rVal = true; voxel.type = 9;
rVal = true;
}
} }
} }
} }