This commit is contained in:
cyberpwn
2021-08-19 22:26:40 -04:00
parent bbf660d80e
commit bbf441c3b4
3 changed files with 12 additions and 88 deletions

View File

@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.engine.object.cave;
package com.volmit.iris.engine.object.noise;
import com.volmit.iris.core.project.loader.IrisData;
import com.volmit.iris.engine.data.cache.AtomicCache;
@@ -44,14 +44,14 @@ import lombok.experimental.Accessors;
@AllArgsConstructor
@Desc("Generate worms")
@Data
public class IrisWormGenerator implements IRare {
public class IrisWorm implements IRare {
@Required
@Desc("Typically a 1 in RARITY on a per chunk basis")
@MinNumber(1)
private int rarity = 15;
@Desc("The style used to determine the curvature of this worm")
private IrisGeneratorStyle angleStyle = new IrisGeneratorStyle();
private IrisGeneratorStyle angleStyle = new IrisGeneratorStyle(NoiseStyle.PERLIN);
@Desc("The max block distance this worm can travel from its start. This can have performance implications at ranges over 1,000 blocks but it's not too serious, test.")
private int maxDistance = 128;
@@ -59,20 +59,19 @@ public class IrisWormGenerator implements IRare {
@Desc("The max segments, or iterations this worm can execute on. Setting this to -1 will allow it to run up to the maxDistance's value of iterations (default)")
private int maxSegments = -1;
@Desc("The thickness of the worm over distance")
private IrisStyledRange girth = new IrisStyledRange().setMin(3).setMax(7)
.setStyle(new IrisGeneratorStyle(NoiseStyle.SIMPLEX));
@Desc("The distance between segments")
private IrisStyledRange segmentDistance = new IrisStyledRange().setMin(4).setMax(7)
.setStyle(new IrisGeneratorStyle(NoiseStyle.PERLIN));
@Desc("The thickness of the worms. Each individual worm has the same thickness while traveling however, each spawned worm will vary in thickness.")
private IrisStyledRange girth = new IrisStyledRange().setMin(3).setMax(5)
.setStyle(new IrisGeneratorStyle(NoiseStyle.PERLIN));
private transient final AtomicCache<NoiseProvider> angleProviderCache = new AtomicCache<>();
public void test()
{
}
public NoiseProvider getAngleProvider(RNG rng, IrisData data)
{
return angleProviderCache.aquire(() -> (xx, zz) -> angleStyle.create(rng, data).noise(xx, zz));
return angleProviderCache.aquire(() -> (xx, zz) -> angleStyle.create(rng, data).noise(xx, zz) * segmentDistance.get(rng, xx, zz, data));
}
public WormIterator2 iterate2D(RNG rng, IrisData data, int x, int z)