use of org.terasology.world.generation.Border3D in project Terasology by MovingBlocks.
the class DefaultTreeProvider method process.
@Override
public void process(GeneratingRegion region) {
SurfaceHeightFacet surface = region.getRegionFacet(SurfaceHeightFacet.class);
BiomeFacet biome = region.getRegionFacet(BiomeFacet.class);
List<Predicate<Vector3i>> filters = getFilters(region);
// these value are derived from the maximum tree extents as
// computed by the TreeTests class. Birch is the highest with 32
// and Pine has 13 radius.
// These values must be identical in the class annotations.
int maxRad = 13;
int maxHeight = 32;
Border3D borderForTreeFacet = region.getBorderForFacet(TreeFacet.class);
TreeFacet facet = new TreeFacet(region.getRegion(), borderForTreeFacet.extendBy(0, maxHeight, maxRad));
populateFacet(facet, surface, biome, filters);
region.setRegionFacet(TreeFacet.class, facet);
}
use of org.terasology.world.generation.Border3D in project Terasology by MovingBlocks.
the class PerlinBaseSurfaceProvider method process.
@Override
public void process(GeneratingRegion region) {
Border3D border = region.getBorderForFacet(SurfaceHeightFacet.class);
SurfaceHeightFacet facet = new SurfaceHeightFacet(region.getRegion(), border);
SeaLevelFacet seaLevelFacet = region.getRegionFacet(SeaLevelFacet.class);
float seaLevel = seaLevelFacet.getSeaLevel();
Rect2i processRegion = facet.getWorldRegion();
float[] noise = surfaceNoise.noise(processRegion);
for (int i = 0; i < noise.length; ++i) {
noise[i] = seaLevel + seaLevel * ((noise[i] * 2.11f + 1f) / 2f);
}
facet.set(noise);
region.setRegionFacet(SurfaceHeightFacet.class, facet);
}
use of org.terasology.world.generation.Border3D in project Terasology by MovingBlocks.
the class PerlinHumidityProvider method process.
@Override
public void process(GeneratingRegion region) {
Border3D border = region.getBorderForFacet(SurfaceHumidityFacet.class);
SurfaceHumidityFacet facet = new SurfaceHumidityFacet(region.getRegion(), border);
float[] noise = humidityNoise.noise(facet.getWorldRegion());
for (int i = 0; i < noise.length; ++i) {
noise[i] = TeraMath.clamp((noise[i] * 2.11f + 1f) * 0.5f);
}
facet.set(noise);
region.setRegionFacet(SurfaceHumidityFacet.class, facet);
}
use of org.terasology.world.generation.Border3D in project Terasology by MovingBlocks.
the class FieldFacetTest method setup.
@Before
public void setup() {
Border3D border = new Border3D(0, 0, 0).extendBy(0, 15, 10);
Vector3i min = new Vector3i(10, 20, 30);
Vector3i size = new Vector3i(40, 50, 60);
Region3i region = Region3i.createFromMinAndSize(min, size);
facet = createFacet(region, border);
// facet = [worldMin=(0, 5, 20), relativeMin=(-10, -15, -10), size=(60, 65, 80)]
}
use of org.terasology.world.generation.Border3D in project Terasology by MovingBlocks.
the class ObjectFacetTest method setup.
@Before
public void setup() {
Border3D border = new Border3D(0, 0, 0).extendBy(0, 15, 10);
Vector3i min = new Vector3i(10, 20, 30);
Vector3i size = new Vector3i(40, 50, 60);
Region3i region = Region3i.createFromMinAndSize(min, size);
facet = createFacet(region, border);
// facet = [worldMin=(0, 5, 20), relativeMin=(-10, -15, -10), size=(60, 65, 80)]
}
Aggregations