当前位置: 首页>>代码示例>>Java>>正文


Java InterpolationType类代码示例

本文整理汇总了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();
}
 
开发者ID:BenjaminRSergent,项目名称:TileMapExample,代码行数:13,代码来源:ModuleFractal.java

示例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);
  }
}
 
开发者ID:BenjaminRSergent,项目名称:TileMapExample,代码行数:8,代码来源:ModuleFractal.java

示例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);
		}
	}
}
 
开发者ID:antag99,项目名称:aquarria,代码行数:32,代码来源:TerrainGeneratorTask.java

示例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);
  }
}
 
开发者ID:BenjaminRSergent,项目名称:TileMapExample,代码行数:6,代码来源:ModuleFractal.java

示例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);
}
 
开发者ID:BenjaminRSergent,项目名称:TileMapExample,代码行数:7,代码来源:ModuleFractal.java

示例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);
			}
		}
	}
}
 
开发者ID:antag99,项目名称:aquarria,代码行数:64,代码来源:DirtGeneratorTask.java

示例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();
	}*/
	
}
 
开发者ID:jaxfrank,项目名称:Voxel-Based-Game-Engine-Java,代码行数:42,代码来源:WorldGenerator.java


注:本文中的com.sudoplay.joise.module.ModuleBasisFunction.InterpolationType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。