mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 10:12:53 +00:00
Image maps
This commit is contained in:
parent
8ee17150b8
commit
28ef4a0b2b
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2021 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.volmit.iris.engine.object;
|
||||
|
||||
import com.volmit.iris.engine.object.annotations.Desc;
|
||||
|
||||
@Desc("Determines a derived channel of an image to read")
|
||||
public enum IrisImageChannel {
|
||||
@Desc("The red channel of the image")
|
||||
RED,
|
||||
@Desc("Thge green channel of the image")
|
||||
GREEN,
|
||||
@Desc("The blue channel of the image")
|
||||
BLUE,
|
||||
@Desc("The saturation as a channel of the image")
|
||||
SATURATION,
|
||||
@Desc("The hue as a channel of the image")
|
||||
HUE,
|
||||
@Desc("The brightness as a channel of the image")
|
||||
BRIGHTNESS,
|
||||
@Desc("The composite of RGB as a channel of the image. Takes the average channel value (adding)")
|
||||
COMPOSITE_ADD_RGB,
|
||||
@Desc("The composite of RGB as a channel of the image. Multiplies the channels")
|
||||
COMPOSITE_MUL_RGB,
|
||||
@Desc("The composite of RGB as a channel of the image. Picks the highest channel")
|
||||
COMPOSITE_MAX_RGB,
|
||||
@Desc("The composite of HSB as a channel of the image Takes the average channel value (adding)")
|
||||
COMPOSITE_ADD_HSB,
|
||||
@Desc("The composite of HSB as a channel of the image Multiplies the channels")
|
||||
COMPOSITE_MUL_HSB,
|
||||
@Desc("The composite of HSB as a channel of the image Picks the highest channel")
|
||||
COMPOSITE_MAX_HSB,
|
||||
@Desc("The raw value as a channel (probably doesnt look very good)")
|
||||
RAW
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2021 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.volmit.iris.engine.object;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.mantle.MantleWriter;
|
||||
import com.volmit.iris.engine.object.annotations.ArrayType;
|
||||
import com.volmit.iris.engine.object.annotations.Desc;
|
||||
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
||||
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||
import com.volmit.iris.util.interpolation.InterpolationMethod;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Snippet("carving")
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Desc("Represents a carving configuration")
|
||||
@Data
|
||||
public class IrisImageMap {
|
||||
@RegistryListResource(IrisImage.class)
|
||||
@Desc("Define the png image to read in this noise map")
|
||||
private String image = "";
|
||||
|
||||
@MinNumber(1)
|
||||
@Desc("The amount of distance a single pixel is when reading this map, reading x=13, would still read pixel 0 if the scale is 32. You can zoom this externally through noise styles for zooming out.")
|
||||
private double coordinateScale = 32;
|
||||
|
||||
@Desc("The interpolation method if the coordinateScale is greater than 1. This blends the image into noise. For nearest neighbor, use NONE.")
|
||||
private InterpolationMethod interpolationMethod = InterpolationMethod.BILINEAR_STARCAST_6;
|
||||
|
||||
@Desc("The color of the sky, top half of sky. (hex format)")
|
||||
private IrisImageChannel channel = IrisImageChannel.COMPOSITE_HSB;
|
||||
|
||||
@Desc("Invert the channel input")
|
||||
private boolean inverted = false;
|
||||
|
||||
private AtomicCache<IrisImage> imageCache = new AtomicCache<IrisImage>();
|
||||
|
||||
public double getNoise(IrisData data, int x, int z)
|
||||
{
|
||||
IrisImage i = imageCache.aquire(() -> data.getImageLoader().load(image));
|
||||
|
||||
if(coordinateScale <= 1)
|
||||
{
|
||||
return i.getImage
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user