Carving & undercarriage

This commit is contained in:
Daniel Mills 2020-10-31 19:24:25 -04:00
parent f2339f26ca
commit 7f3b9ec89a
9 changed files with 105 additions and 19 deletions

26
.idea/workspace.xml generated
View File

@ -44,7 +44,7 @@
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="dart.analysis.tool.window.visible" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/src/main/java/com/volmit/iris/gen/v2/scaffold/hunk" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/src/main/java/com/volmit/iris/v2/nms" />
<property name="project.structure.last.edited" value="Modules" />
<property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.23643054" />
@ -67,6 +67,10 @@
<recent name="com.volmit.iris.v2.scaffold.stream.utility" />
</key>
<key name="CopyFile.RECENT_KEYS">
<recent name="C:\Users\cyberpwn\Documents\development\workspace\Iris\src\main\java\com\volmit\iris\v2\nms" />
<recent name="C:\Users\cyberpwn\Documents\development\workspace\Iris\src\main\java\com\volmit\iris\v2\nms\mc16\r2" />
<recent name="C:\Users\cyberpwn\Documents\development\workspace\Iris\src\main\java\com\volmit\iris\v2\nms\abstract" />
<recent name="C:\Users\cyberpwn\Documents\development\workspace\Iris\src\main\java\com\volmit\iris\v2\nms\mc16" />
<recent name="C:\Users\cyberpwn\Documents\development\workspace\Iris\src\main\java\com\volmit\iris\gen\v2\scaffold\hunk" />
</key>
</component>
@ -123,10 +127,10 @@
<screen x="0" y="0" width="1920" height="1050" />
</state>
<state x="410" y="171" width="1234" height="708" key="#com.intellij.execution.impl.EditConfigurationsDialog/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1603947263834" />
<state x="718" y="163" key="#com.intellij.ide.util.MemberChooser" timestamp="1604143067494">
<state x="718" y="163" key="#com.intellij.ide.util.MemberChooser" timestamp="1604186001966">
<screen x="0" y="0" width="1920" height="1050" />
</state>
<state x="718" y="163" key="#com.intellij.ide.util.MemberChooser/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1604143067494" />
<state x="718" y="163" key="#com.intellij.ide.util.MemberChooser/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1604186001966" />
<state x="675" y="394" key="#com.intellij.refactoring.move.moveClassesOrPackages.MoveClassesOrPackagesDialog.classes" timestamp="1603943257126">
<screen x="0" y="0" width="1920" height="1050" />
</state>
@ -143,22 +147,22 @@
<screen x="0" y="0" width="1920" height="1050" />
</state>
<state x="485" y="234" key="#com.intellij.structuralsearch.plugin.ui.StructuralSearchDialog/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1603860057506" />
<state width="1921" height="983" key="GridCell.Tab.0.bottom" timestamp="1604168119276">
<state width="1921" height="983" key="GridCell.Tab.0.bottom" timestamp="1604185046457">
<screen x="0" y="0" width="1920" height="1050" />
</state>
<state width="1921" height="983" key="GridCell.Tab.0.bottom/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1604168119276" />
<state width="1921" height="983" key="GridCell.Tab.0.center" timestamp="1604168119275">
<state width="1921" height="983" key="GridCell.Tab.0.bottom/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1604185046457" />
<state width="1921" height="983" key="GridCell.Tab.0.center" timestamp="1604185046457">
<screen x="0" y="0" width="1920" height="1050" />
</state>
<state width="1921" height="983" key="GridCell.Tab.0.center/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1604168119275" />
<state width="1921" height="983" key="GridCell.Tab.0.left" timestamp="1604168119274">
<state width="1921" height="983" key="GridCell.Tab.0.center/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1604185046457" />
<state width="1921" height="983" key="GridCell.Tab.0.left" timestamp="1604185046457">
<screen x="0" y="0" width="1920" height="1050" />
</state>
<state width="1921" height="983" key="GridCell.Tab.0.left/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1604168119274" />
<state width="1921" height="983" key="GridCell.Tab.0.right" timestamp="1604168119275">
<state width="1921" height="983" key="GridCell.Tab.0.left/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1604185046457" />
<state width="1921" height="983" key="GridCell.Tab.0.right" timestamp="1604185046457">
<screen x="0" y="0" width="1920" height="1050" />
</state>
<state width="1921" height="983" key="GridCell.Tab.0.right/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1604168119275" />
<state width="1921" height="983" key="GridCell.Tab.0.right/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1604185046457" />
<state x="312" y="0" key="SettingsEditor" timestamp="1603947206451">
<screen x="0" y="0" width="1920" height="1050" />
</state>

View File

@ -34,6 +34,12 @@ public class IrisCarveLayer
@Desc("The max height")
private int maxHeight = 220;
@MinNumber(0.0)
@MaxNumber(1.0)
@DontObfuscate
@Desc("The full percentage means the 4D opacity of this carver will decay from 100% to 0% at the min & max vertical ranges. Setting the percent to 1.0 will make a very drastic & charp change at the edge of the vertical min & max. Where as 0.15 means only 15% of the vertical range will actually be 100% opacity.")
private double fullPercent = 0.5;
@MaxNumber(512)
@MinNumber(-128)
@DontObfuscate
@ -55,7 +61,19 @@ public class IrisCarveLayer
return false;
}
double opacity = Math.pow(IrisInterpolation.sinCenter(M.lerpInverse(getMinHeight(), getMaxHeight(), y)), 4);
double innerRange = fullPercent * (maxHeight - minHeight);
double opacity = 1D;
if(y <= minHeight+innerRange)
{
opacity = IrisInterpolation.bezier(M.lerpInverse(getMinHeight(), minHeight+innerRange, y));
}
else if(y >=maxHeight - innerRange)
{
opacity = IrisInterpolation.bezier(1D - M.lerpInverse(maxHeight-innerRange, getMaxHeight(), y));
}
return cng.aquire(() -> getStyle().create(rng.nextParallelRNG(-2340 * getMaxHeight() * getMinHeight()))).fitDouble(0D, 1D, x, y, z) * opacity > getThreshold();
}
}

View File

@ -1,5 +1,6 @@
package com.volmit.iris.object;
import net.royawesome.jlibnoise.Noise;
import org.bukkit.Material;
import org.bukkit.World.Environment;
import org.bukkit.block.data.BlockData;
@ -62,6 +63,10 @@ public class IrisDimension extends IrisRegistrant
@Desc("Improves the biome grid variation by shuffling the cell grid more depending on the seed. This makes biomes across multiple seeds look far different than before.")
private boolean aggressiveBiomeReshuffle = false;
@DontObfuscate
@Desc("Instead of a flat bottom, applies a clamp (using this noise style) to the bottom instead of a flat bottom. Useful for carving out center-dimensions in a dimension composite world.")
private IrisShapedGeneratorStyle undercarriage = null;
@DontObfuscate
@Desc("Upon joining this world, Iris will send a resource pack request to the client. If they have previously selected yes, it will auto-switch depending on which dimension they go to.")
private String resourcePack = "";
@ -367,6 +372,22 @@ public class IrisDimension extends IrisRegistrant
return rad.aquire(() -> Math.toRadians(dimensionAngleDeg));
}
public boolean isCarved(int x, int y, int z, RNG rng, int terrainHeight)
{
if(isCarving() && terrainHeight > getFluidHeight() || y < terrainHeight)
{
for(IrisCarveLayer j : getCarveLayers())
{
if(j.isCarved(rng, x, y, z))
{
return true;
}
}
}
return false;
}
public double sinRotate()
{
return sinr.aquire(() -> Math.sin(getDimensionAngle()));

View File

@ -36,7 +36,6 @@ public class IrisShapedGeneratorStyle
@Required
@MinNumber(-256)
@MaxNumber(256)
@DontObfuscate
@Desc("The max block value")
private int max = 0;

View File

@ -13,6 +13,6 @@ public class TestGen
public static void gen(Player p)
{
p.teleport(new Location(new WorldCreator("t/" + UUID.randomUUID().toString())
.generator(EngineCompositeGenerator.newStudioWorld("overworld")).createWorld(), 0, 70, 0));
.generator(EngineCompositeGenerator.newStudioWorld("iris")).createWorld(), 0, 70, 0));
}
}

View File

@ -8,9 +8,12 @@ import com.volmit.iris.v2.scaffold.hunk.Hunk;
import com.volmit.iris.v2.scaffold.parallel.MultiBurst;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.server.v1_16_R2.*;
import org.bukkit.block.Biome;
import org.bukkit.block.data.BlockData;
import java.util.Iterator;
public class IrisEngine implements Engine
{
@Getter
@ -43,8 +46,16 @@ public class IrisEngine implements Engine
})
);
generateStructureReferences();
generateStructures();
getFramework().getEngineParallax().insertParallax(x, z, blocks);
System.out.println("Regions: " + getParallax().getRegionCount() + ", Chunks: " + getParallax().getChunkCount());
getParallax().cleanup();
}
private void generateStructureReferences() {
}
private void generateStructures() {
}
}

View File

@ -37,8 +37,11 @@ public class IrisEngineCompound implements EngineCompound {
@Getter
private final MultiBurst burster;
private IrisDimension root;
public IrisEngineCompound(World world, IrisDimension rootDimension, IrisDataManager data, int maximumThreads)
{
this.root = rootDimension;
Iris.info("Initializing Engine Composite for " + world.getName());
this.world = world;
engineMetadata = EngineData.load(getEngineMetadataFile());
@ -91,6 +94,11 @@ public class IrisEngineCompound implements EngineCompound {
return new File(world.getWorldFolder(), "iris/engine-metadata.json");
}
@Override
public IrisDimension getRootDimension() {
return root;
}
@Override
public void generate(int x, int z, Hunk<BlockData> blocks, Hunk<Biome> biomes)
{

View File

@ -1,29 +1,34 @@
package com.volmit.iris.v2.generator.actuator;
import com.volmit.iris.noise.CNG;
import com.volmit.iris.object.IrisBiome;
import com.volmit.iris.object.IrisBiomePaletteLayer;
import com.volmit.iris.object.IrisCarveLayer;
import com.volmit.iris.object.IrisNoiseGenerator;
import com.volmit.iris.util.KList;
import com.volmit.iris.util.RNG;
import com.volmit.iris.v2.scaffold.engine.Engine;
import com.volmit.iris.v2.scaffold.engine.EngineAssignedActuator;
import com.volmit.iris.v2.scaffold.hunk.Hunk;
import org.bukkit.Material;
import org.bukkit.block.Biome;
import org.bukkit.block.data.BlockData;
public class IrisTerrainActuator extends EngineAssignedActuator<BlockData>
{
private static final BlockData AIR = Material.AIR.createBlockData();
private static final BlockData BEDROCK = Material.BEDROCK.createBlockData();
private static final BlockData CAVE_AIR = Material.CAVE_AIR.createBlockData();
private final RNG rng;
private final boolean hasUnder;
public IrisTerrainActuator(Engine engine) {
super(engine, "Terrain");
rng = new RNG(engine.getWorld().getSeed());
hasUnder = getDimension().getUndercarriage() != null && !getDimension().getUndercarriage().getGenerator().isFlat();
}
@Override
public void onActuate(int x, int z, Hunk<BlockData> h) {
int i,zf, depth, realX, realZ,hf, he;
int i,zf, depth, realX, realZ,hf, he, b;
IrisBiome biome;
KList<BlockData> blocks;
@ -33,13 +38,30 @@ public class IrisTerrainActuator extends EngineAssignedActuator<BlockData>
{
realX = xf + x;
realZ = zf + z;
b = hasUnder ? (int) Math.round(getDimension().getUndercarriage().get(rng, realX, realZ)) : 0;
he = (int) Math.round(Math.min(h.getHeight(), getComplex().getHeightStream().get(realX, realZ)));
hf = (int) Math.round(Math.max(Math.min(h.getHeight(), getDimension().getFluidHeight()), he));
biome = getComplex().getTrueBiomeStream().get(realX, realZ);
blocks = null;
for(i = hf; i >= 0; i--)
if(hf < b)
{
continue;
}
for(i = hf; i >= b; i--)
{
if(i == b && getDimension().isBedrock())
{
h.set(xf, i, zf, BEDROCK);
continue;
}
if(getDimension().isCarved(realX, i, realZ, rng, he))
{
continue;
}
if(i > he && i <= hf)
{
h.set(xf, i, zf, getComplex().getFluidStream().get(realX, +realZ));

View File

@ -1,5 +1,6 @@
package com.volmit.iris.v2.scaffold.engine;
import com.volmit.iris.object.IrisDimension;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.block.data.BlockData;
@ -10,6 +11,8 @@ import com.volmit.iris.v2.scaffold.parallel.MultiBurst;
public interface EngineCompound extends Listener
{
public IrisDimension getRootDimension();
public void generate(int x, int z, Hunk<BlockData> blocks, Hunk<Biome> biomes);
public World getWorld();