本文整理汇总了Java中com.sudoplay.joise.module.ModuleBasisFunction.InterpolationType类的典型用法代码示例。如果您正苦于以下问题:Java InterpolationType类的具体用法?Java InterpolationType怎么用?Java InterpolationType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InterpolationType类属于com.sudoplay.joise.module.ModuleBasisFunction包,在下文中一共展示了InterpolationType类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ModuleFractal
import com.sudoplay.joise.module.ModuleBasisFunction.InterpolationType; //导入依赖的package包/类
public ModuleFractal(FractalType type, BasisType basisType,
InterpolationType interpolationType) {
for (int i = 0; i < MAX_SOURCES; i++) {
basis[i] = new ModuleBasisFunction();
}
setNumOctaves(2);
setFrequency(1.0);
setLacunarity(2.0);
setType(type);
setAllSourceTypes(basisType, interpolationType);
resetAllSources();
}
示例2: setAllSourceTypes
import com.sudoplay.joise.module.ModuleBasisFunction.InterpolationType; //导入依赖的package包/类
public void setAllSourceTypes(BasisType basisType,
InterpolationType interpolationType) {
for (int i = 0; i < MAX_SOURCES; i++) {
basis[i].setType(basisType);
basis[i].setInterpolation(interpolationType);
}
}
示例3: generate
import com.sudoplay.joise.module.ModuleBasisFunction.InterpolationType; //导入依赖的package包/类
@Override
public void generate(WorldGenerator generator, long seed) {
// Base the terrain height on fractal noise
ModuleFractal fractal = new ModuleFractal();
fractal.setType(FractalType.FBM);
fractal.setAllSourceBasisTypes(BasisType.GRADIENT);
fractal.setAllSourceInterpolationTypes(InterpolationType.QUINTIC);
fractal.setFrequency(1f / 100f);
fractal.setNumOctaves(2);
fractal.setSeed(seed);
final Module source = fractal;
int baseSurfaceLevel = generator.getHeight() * 2 / 3;
for (int i = 0; i < generator.getWidth(); ++i) {
// Sample the noise at Y level 0, as the joise
// library dosen't support 1D noise.
double noise = source.get(i, 0f);
// Returns values in the range [-32, 32]
int surfaceOffset = (int) (noise * 32.0);
int surfaceLevel = baseSurfaceLevel + surfaceOffset;
generator.setSurfaceLevel(i, surfaceLevel);
for (int j = 0; j < surfaceLevel; ++j) {
generator.setTileType(i, j, terrain);
}
}
}
示例4: setAllSourceInterpolationTypes
import com.sudoplay.joise.module.ModuleBasisFunction.InterpolationType; //导入依赖的package包/类
public void setAllSourceInterpolationTypes(InterpolationType interpolationType) {
for (int i = 0; i < MAX_SOURCES; i++) {
basis[i].setInterpolation(interpolationType);
}
}
示例5: setSourceType
import com.sudoplay.joise.module.ModuleBasisFunction.InterpolationType; //导入依赖的package包/类
public void setSourceType(int index, BasisType basisType,
InterpolationType interpolationType) {
assertMaxSources(index);
basis[index].setType(basisType);
basis[index].setInterpolation(interpolationType);
}
示例6: generate
import com.sudoplay.joise.module.ModuleBasisFunction.InterpolationType; //导入依赖的package包/类
@Override
public void generate(WorldGenerator generator, long seed) {
ModuleFractal fractal = new ModuleFractal();
fractal.setType(FractalType.FBM);
fractal.setAllSourceBasisTypes(BasisType.GRADIENT);
fractal.setAllSourceInterpolationTypes(InterpolationType.QUINTIC);
fractal.setFrequency(1f / 20f);
fractal.setNumOctaves(2);
fractal.setSeed(seed);
ModuleGradient gradient = new ModuleGradient();
gradient.setGradient(0, 0, 0, generator.getHeight() * 0.75);
ModuleCombiner combiner = new ModuleCombiner();
combiner.setType(CombinerType.ADD);
combiner.setSource(0, fractal);
combiner.setSource(1, gradient);
ModuleFractal perturbFractalX = new ModuleFractal();
perturbFractalX.setType(FractalType.FBM);
perturbFractalX.setAllSourceBasisTypes(BasisType.GRADIENT);
perturbFractalX.setAllSourceInterpolationTypes(InterpolationType.QUINTIC);
perturbFractalX.setFrequency(1f / 20f);
perturbFractalX.setNumOctaves(2);
perturbFractalX.setSeed(seed);
ModuleCombiner perturbFractalXMult = new ModuleCombiner();
perturbFractalXMult.setType(CombinerType.MULT);
perturbFractalXMult.setSource(0, perturbFractalX);
perturbFractalXMult.setSource(1, 40.0);
ModuleFractal perturbFractalY = new ModuleFractal();
perturbFractalY.setType(FractalType.FBM);
perturbFractalY.setAllSourceBasisTypes(BasisType.GRADIENT);
perturbFractalY.setAllSourceInterpolationTypes(InterpolationType.QUINTIC);
perturbFractalY.setFrequency(1f / 20f);
perturbFractalY.setNumOctaves(2);
perturbFractalY.setSeed(seed * 31);
ModuleCombiner perturbFractalYMult = new ModuleCombiner();
perturbFractalYMult.setType(CombinerType.MULT);
perturbFractalYMult.setSource(0, perturbFractalY);
perturbFractalYMult.setSource(1, 40.0);
ModuleTranslateDomain perturb = new ModuleTranslateDomain();
perturb.setAxisXSource(perturbFractalXMult);
perturb.setAxisYSource(perturbFractalYMult);
perturb.setSource(combiner);
ModuleSelect select = new ModuleSelect();
select.setControlSource(perturb);
select.setThreshold(0.5);
select.setLowSource(0.0);
select.setHighSource(1.0);
for (int i = 0; i < generator.getWidth(); ++i) {
for (int j = 0; j < generator.getHeight(); ++j) {
if (generator.getTileType(i, j) == target && select.get(i, j) == 1.0) {
generator.setTileType(i, j, replacement);
}
}
}
}
示例7: saveToFile
import com.sudoplay.joise.module.ModuleBasisFunction.InterpolationType; //导入依赖的package包/类
private void saveToFile(String location) {
ModuleGradient groundGradient = new ModuleGradient();
groundGradient.setGradient(0, 0, 0, 1, 0, 0);
ModuleFractal groundShape = new ModuleFractal();
groundShape.setAllSourceBasisTypes(BasisType.GRADIENT);
groundShape.setAllSourceInterpolationTypes(InterpolationType.QUINTIC);
groundShape.setType(FractalType.FBM);
groundShape.setFrequency(0.75);
groundShape.setNumOctaves(1);
groundShape.setSeed(seed);
groundShape.resetAllSources();
ModuleTranslateDomain translate = new ModuleTranslateDomain();
translate.setAxisYSource(groundShape);
translate.setSource(groundGradient);
/*
ModuleSelect select = new ModuleSelect();
select.setControlSource(translate);
select.setHighSource(1);//Air
select.setLowSource(translate); //GrassStoneDirt
select.setThreshold(0.5);
select.setFalloff(0);
*/
joise = new Joise(translate);
/*
JoiseJSONConverter converter = new JoiseJSONConverter();
ModuleMap map = new ModuleMap();
converter.toJson(map);
String json = converter.toJson(joise.getModuleMap());
try {
FileOutputStream stream = new FileOutputStream(new File(location));
stream.write(json.getBytes());
stream.close();
} catch (IOException e) {
e.printStackTrace();
}*/
}