本文整理汇总了Java中com.jme3.terrain.noise.filter.SmoothFilter类的典型用法代码示例。如果您正苦于以下问题:Java SmoothFilter类的具体用法?Java SmoothFilter怎么用?Java SmoothFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SmoothFilter类属于com.jme3.terrain.noise.filter包,在下文中一共展示了SmoothFilter类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFractalGenerator
import com.jme3.terrain.noise.filter.SmoothFilter; //导入依赖的package包/类
private Basis createFractalGenerator() {
final FractalSum fractalSum = new FractalSum();
fractalSum.setRoughness(getRoughness());
fractalSum.setFrequency(getFrequency());
fractalSum.setAmplitude(getBrushPower());
fractalSum.setLacunarity(getLacunarity()); // make it greater than 1.0f
fractalSum.setOctaves(getOctaves());
fractalSum.setScale(max(min(getScale(), 1.0F), 0F)); //0.02125f
fractalSum.addModulator((NoiseModulator) in -> ShaderUtils.clamp(in[0] * 0.5f + 0.5f, 0, 1));
final FilteredBasis ground = new FilteredBasis(fractalSum);
final PerturbFilter perturb = new PerturbFilter();
perturb.setMagnitude(0.2f);//0.119 the higher, the slower it is
final OptimizedErode therm = new OptimizedErode();
therm.setRadius(5);
therm.setTalus(0.011f);
final SmoothFilter smooth = new SmoothFilter();
smooth.setRadius(1);
smooth.setEffect(0.1f); // 0.7
final IterativeFilter iterate = new IterativeFilter();
iterate.addPreFilter(perturb);
iterate.addPostFilter(smooth);
iterate.setFilter(therm);
iterate.setIterations(1);
ground.addPreFilter(iterate);
return ground;
}
示例2: createNoiseGenerator
import com.jme3.terrain.noise.filter.SmoothFilter; //导入依赖的package包/类
private FilteredBasis createNoiseGenerator()
{
FractalSum base = new FractalSum();
base.setRoughness(0.7f);
base.setFrequency(1.0f);
base.setAmplitude(1.0f);
base.setLacunarity(3.12f);
base.setOctaves(8);
base.setScale(0.02125f);
base.addModulator(new NoiseModulator()
{
@Override public float value(float... in)
{
return ShaderUtils.clamp(in[0] * 0.5f + 0.5f, 0, 1);
}
});
FilteredBasis ground = new FilteredBasis(base);
PerturbFilter perturb = new PerturbFilter();
perturb.setMagnitude(0.119f);
OptimizedErode therm = new OptimizedErode();
therm.setRadius(5);
therm.setTalus(0.011f);
SmoothFilter smooth = new SmoothFilter();
smooth.setRadius(1);
smooth.setEffect(0.7f);
IterativeFilter iterate = new IterativeFilter();
iterate.addPreFilter(perturb);
iterate.addPostFilter(smooth);
iterate.setFilter(therm);
iterate.setIterations(1);
ground.addPreFilter(iterate);
return ground;
}
示例3: createFractalGenerator
import com.jme3.terrain.noise.filter.SmoothFilter; //导入依赖的package包/类
private Basis createFractalGenerator(RoughExtraToolParams params, float weight) {
FractalSum base = new FractalSum();
base.setRoughness(params.roughness);
base.setFrequency(params.frequency);
base.setAmplitude(weight);
base.setLacunarity(params.lacunarity <= 1 ? 1.1f : params.lacunarity); // make it greater than 1.0f
base.setOctaves(params.octaves);
float scale = params.scale;
if (scale > 1.0f)
scale = 1.0f;
if (scale < 0)
scale = 0;
base.setScale(scale);//0.02125f
base.addModulator(new NoiseModulator() {
@Override
public float value(float... in) {
return ShaderUtils.clamp(in[0] * 0.5f + 0.5f, 0, 1);
}
});
FilteredBasis ground = new FilteredBasis(base);
PerturbFilter perturb = new PerturbFilter();
perturb.setMagnitude(0.2f);//0.119 the higher, the slower it is
OptimizedErode therm = new OptimizedErode();
therm.setRadius(5);
therm.setTalus(0.011f);
SmoothFilter smooth = new SmoothFilter();
smooth.setRadius(1);
smooth.setEffect(0.1f); // 0.7
IterativeFilter iterate = new IterativeFilter();
iterate.addPreFilter(perturb);
iterate.addPostFilter(smooth);
iterate.setFilter(therm);
iterate.setIterations(1);
ground.addPreFilter(iterate);
return ground;
}
示例4: createWorldWithNoise
import com.jme3.terrain.noise.filter.SmoothFilter; //导入依赖的package包/类
private void createWorldWithNoise()
{
NoiseBasedWorld newWorld = new NoiseBasedWorld(app, bulletAppState.getPhysicsSpace(), tileSize, blockSize);
newWorld.setWorldHeight(192f);
newWorld.setViewDistance(2);
// newWorld.setViewDistance(14, 1, 2, 1);
newWorld.setCacheTime(5000);
Material terrainMaterial = createTerrainMaterial();
newWorld.setMaterial(terrainMaterial);
// create a noise generator
FractalSum base = new FractalSum();
base.setRoughness(0.7f);
base.setFrequency(1.0f);
base.setAmplitude(1.0f);
base.setLacunarity(3.12f);
base.setOctaves(8);
base.setScale(0.02125f);
base.addModulator(new NoiseModulator()
{
@Override
public float value(float... in) {
return ShaderUtils.clamp(in[0] * 0.5f + 0.5f, 0, 1);
}
});
FilteredBasis ground = new FilteredBasis(base);
PerturbFilter perturb = new PerturbFilter();
perturb.setMagnitude(0.119f);
OptimizedErode therm = new OptimizedErode();
therm.setRadius(5);
therm.setTalus(0.011f);
SmoothFilter smooth = new SmoothFilter();
smooth.setRadius(1);
smooth.setEffect(0.7f);
IterativeFilter iterate = new IterativeFilter();
iterate.addPreFilter(perturb);
iterate.addPostFilter(smooth);
iterate.setFilter(therm);
iterate.setIterations(1);
ground.addPreFilter(iterate);
newWorld.setFilteredBasis(ground);
this.world = newWorld;
}