farm plots place farmland voxel type
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
c863365c26
commit
3f401dfde3
@ -46,6 +46,11 @@
|
||||
"id" : 8,
|
||||
"name" : "Rock (Slate)",
|
||||
"texture" : "/Textures/Ground/rock3_256.png"
|
||||
},
|
||||
{
|
||||
"id" : 9,
|
||||
"name" : "Farmland",
|
||||
"texture" : "/Textures/Ground/farmland_1.png"
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
assets/Textures/Ground/farmland_1.png
Normal file
BIN
assets/Textures/Ground/farmland_1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 452 KiB |
@ -2044,6 +2044,8 @@ Utilities for turning mesh gen algos into renderable entities
|
||||
Back off farm plots from roads by road radius
|
||||
Farm plots properly save/load to/from disk
|
||||
Farm plots place dirt
|
||||
Farmland voxel type
|
||||
Farm plots place farmland
|
||||
|
||||
|
||||
|
||||
|
||||
@ -226,7 +226,7 @@ public class ProceduralChunkGenerator implements ChunkGenerator {
|
||||
values[x][y][z] = voxel.type;
|
||||
}
|
||||
//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;
|
||||
values[x][y][z] = voxel.type;
|
||||
}
|
||||
@ -274,6 +274,7 @@ public class ProceduralChunkGenerator implements ChunkGenerator {
|
||||
private boolean applyMacroData(
|
||||
List<MacroObject> objects,
|
||||
double realX, double realY, double realZ,
|
||||
double surfaceHeight,
|
||||
GeneratedVoxel voxel
|
||||
){
|
||||
boolean rVal = false;
|
||||
@ -282,11 +283,13 @@ public class ProceduralChunkGenerator implements ChunkGenerator {
|
||||
if(object instanceof Road){
|
||||
Road road = (Road)object;
|
||||
//broad phase intersection
|
||||
if(road.getAABB().testPoint(realX, realY, realZ)){
|
||||
if(GeomUtils.pointIntersectsLineSegment(realPt, road.getPoint1(), road.getPoint2(), road.getRadius())){
|
||||
if(voxel.type != ServerTerrainChunk.VOXEL_TYPE_AIR){
|
||||
voxel.type = 1;
|
||||
rVal = true;
|
||||
if(Math.abs(realY - surfaceHeight) < 3){
|
||||
if(road.getAABB().testPoint(realX, realY, realZ)){
|
||||
if(GeomUtils.pointIntersectsLineSegment(realPt, road.getPoint1(), road.getPoint2(), road.getRadius())){
|
||||
if(voxel.type != ServerTerrainChunk.VOXEL_TYPE_AIR){
|
||||
voxel.type = 1;
|
||||
rVal = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -309,11 +312,13 @@ public class ProceduralChunkGenerator implements ChunkGenerator {
|
||||
}
|
||||
} else if(object instanceof Town){
|
||||
} else if(object instanceof MacroRegion region){
|
||||
if(region.getRegion().getAABB().testPoint(realPt)){
|
||||
if(region.getRegion().intersects(realPt)){
|
||||
if(voxel.type != ServerTerrainChunk.VOXEL_TYPE_AIR){
|
||||
voxel.type = 1;
|
||||
rVal = true;
|
||||
if(Math.abs(realY - surfaceHeight) < 3){
|
||||
if(region.getRegion().getAABB().testPoint(realPt)){
|
||||
if(region.getRegion().intersects(realPt)){
|
||||
if(voxel.type != ServerTerrainChunk.VOXEL_TYPE_AIR){
|
||||
voxel.type = 9;
|
||||
rVal = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user