macro structures block regular foliage generation
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
3a34dc28ce
commit
69b7fe2f77
@ -4,9 +4,9 @@
|
|||||||
"id" : "test1",
|
"id" : "test1",
|
||||||
"fabPath" : "Data/fab/disjointedroom1.block",
|
"fabPath" : "Data/fab/disjointedroom1.block",
|
||||||
"dimensions" : {
|
"dimensions" : {
|
||||||
"x" : 10,
|
"x" : 100,
|
||||||
"y" : 10,
|
"y" : 100,
|
||||||
"z" : 10
|
"z" : 100
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@ -1587,6 +1587,7 @@ Reduce physics generation calls on GriddedDataCellManager
|
|||||||
Fab selection doesn't overflow anymore
|
Fab selection doesn't overflow anymore
|
||||||
Cleaning up parts of Main class
|
Cleaning up parts of Main class
|
||||||
Spawn test structure in macro data on creation
|
Spawn test structure in macro data on creation
|
||||||
|
Macro data structures block regular foliage generation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import electrosphere.game.data.biome.BiomeFoliageDescription;
|
|||||||
import electrosphere.server.datacell.Realm;
|
import electrosphere.server.datacell.Realm;
|
||||||
import electrosphere.server.datacell.ServerDataCell;
|
import electrosphere.server.datacell.ServerDataCell;
|
||||||
import electrosphere.server.macro.MacroData;
|
import electrosphere.server.macro.MacroData;
|
||||||
|
import electrosphere.server.macro.spatial.MacroAreaObject;
|
||||||
import electrosphere.server.physics.terrain.manager.ServerTerrainChunk;
|
import electrosphere.server.physics.terrain.manager.ServerTerrainChunk;
|
||||||
import io.github.studiorailgun.NoiseUtils;
|
import io.github.studiorailgun.NoiseUtils;
|
||||||
|
|
||||||
@ -53,6 +54,9 @@ public class ServerContentGenerator {
|
|||||||
//setup
|
//setup
|
||||||
Random random = new Random(randomizer);
|
Random random = new Random(randomizer);
|
||||||
|
|
||||||
|
//fetches the list of macro data content blockers
|
||||||
|
List<MacroAreaObject> macroContentBlockers = macroData.getContentBlockers();
|
||||||
|
|
||||||
|
|
||||||
//generate foliage
|
//generate foliage
|
||||||
BiomeData biome = null;
|
BiomeData biome = null;
|
||||||
@ -72,6 +76,22 @@ public class ServerContentGenerator {
|
|||||||
double foundPriority = -1;
|
double foundPriority = -1;
|
||||||
double realX = realm.getServerWorldData().convertVoxelToRealSpace(x, worldPos.x);
|
double realX = realm.getServerWorldData().convertVoxelToRealSpace(x, worldPos.x);
|
||||||
double realZ = realm.getServerWorldData().convertVoxelToRealSpace(z, worldPos.z);
|
double realZ = realm.getServerWorldData().convertVoxelToRealSpace(z, worldPos.z);
|
||||||
|
|
||||||
|
//check if a macro object is blocking content here
|
||||||
|
boolean macroBlockingContent = false;
|
||||||
|
if(macroContentBlockers != null){
|
||||||
|
for(MacroAreaObject blocker : macroContentBlockers){
|
||||||
|
if(blocker.getAABB().testPoint(realX, height, realZ)){
|
||||||
|
macroBlockingContent = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(macroBlockingContent){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//figure out which foliage to place
|
||||||
for(BiomeFoliageDescription foliageDescription : foliageDescriptions){
|
for(BiomeFoliageDescription foliageDescription : foliageDescriptions){
|
||||||
double scale = foliageDescription.getScale();
|
double scale = foliageDescription.getScale();
|
||||||
double regularity = foliageDescription.getRegularity();
|
double regularity = foliageDescription.getRegularity();
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import electrosphere.server.macro.character.diety.Diety;
|
|||||||
import electrosphere.server.macro.civilization.Civilization;
|
import electrosphere.server.macro.civilization.Civilization;
|
||||||
import electrosphere.server.macro.race.Race;
|
import electrosphere.server.macro.race.Race;
|
||||||
import electrosphere.server.macro.race.RaceMap;
|
import electrosphere.server.macro.race.RaceMap;
|
||||||
|
import electrosphere.server.macro.spatial.MacroAreaObject;
|
||||||
import electrosphere.server.macro.structure.Structure;
|
import electrosphere.server.macro.structure.Structure;
|
||||||
import electrosphere.server.macro.symbolism.Symbol;
|
import electrosphere.server.macro.symbolism.Symbol;
|
||||||
import electrosphere.server.macro.town.Town;
|
import electrosphere.server.macro.town.Town;
|
||||||
@ -111,7 +112,7 @@ public class MacroData {
|
|||||||
//add a test character
|
//add a test character
|
||||||
Structure struct = Structure.createStructure(
|
Structure struct = Structure.createStructure(
|
||||||
Globals.gameConfigCurrent.getStructureData().getType("test1"),
|
Globals.gameConfigCurrent.getStructureData().getType("test1"),
|
||||||
new Vector3d(ServerWorldData.convertChunkToRealSpace(new Vector3i(32774, 1, 32770)))
|
new Vector3d(ServerWorldData.convertChunkToRealSpace(new Vector3i(32774, 1, 32770)).sub(0,10,0))
|
||||||
);
|
);
|
||||||
rVal.structures.add(struct);
|
rVal.structures.add(struct);
|
||||||
|
|
||||||
@ -290,5 +291,15 @@ public class MacroData {
|
|||||||
}
|
}
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the list of content-blocking macro objects
|
||||||
|
* @return The list
|
||||||
|
*/
|
||||||
|
public List<MacroAreaObject> getContentBlockers(){
|
||||||
|
List<MacroAreaObject> blockers = new LinkedList<MacroAreaObject>();
|
||||||
|
blockers.addAll(this.structures);
|
||||||
|
return blockers;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package electrosphere.server.macro.spatial;
|
package electrosphere.server.macro.spatial;
|
||||||
|
|
||||||
|
import org.joml.AABBd;
|
||||||
import org.joml.Vector3d;
|
import org.joml.Vector3d;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -18,6 +19,12 @@ public interface MacroAreaObject extends MacroObject {
|
|||||||
* @return The end position
|
* @return The end position
|
||||||
*/
|
*/
|
||||||
public Vector3d getEndPos();
|
public Vector3d getEndPos();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the AABB for the object
|
||||||
|
* @return The AABB
|
||||||
|
*/
|
||||||
|
public AABBd getAABB();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,7 +66,7 @@ public class Structure extends CharacterData implements MacroAreaObject {
|
|||||||
rVal.fabPath = data.getFabPath();
|
rVal.fabPath = data.getFabPath();
|
||||||
rVal.type = data.getId();
|
rVal.type = data.getId();
|
||||||
rVal.position = position;
|
rVal.position = position;
|
||||||
rVal.aabb = new AABBd(new Vector3d(0,0,0), data.getDimensions());
|
rVal.aabb = new AABBd(new Vector3d(position), new Vector3d(position).add(data.getDimensions()));
|
||||||
return rVal;
|
return rVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,6 +129,11 @@ public class Structure extends CharacterData implements MacroAreaObject {
|
|||||||
public Vector3d getEndPos() {
|
public Vector3d getEndPos() {
|
||||||
return new Vector3d(aabb.maxX,aabb.maxY,aabb.maxZ);
|
return new Vector3d(aabb.maxX,aabb.maxY,aabb.maxZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AABBd getAABB() {
|
||||||
|
return this.aabb;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user