本文整理汇总了Java中com.jme3.water.WaterFilter.setWaterHeight方法的典型用法代码示例。如果您正苦于以下问题:Java WaterFilter.setWaterHeight方法的具体用法?Java WaterFilter.setWaterHeight怎么用?Java WaterFilter.setWaterHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.water.WaterFilter
的用法示例。
在下文中一共展示了WaterFilter.setWaterHeight方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createWater
import com.jme3.water.WaterFilter; //导入方法依赖的package包/类
private void createWater() {
water = new WaterFilter(rootNode, new Vector3f(-0.1f, -0.1f, -0.1f));
water.setWaterColor(new ColorRGBA().setAsSrgb(0.0078f, 0.3176f, 0.5f, 1.0f));
water.setDeepWaterColor(new ColorRGBA().setAsSrgb(0.0039f, 0.00196f, 0.145f, 1.0f));
water.setUnderWaterFogDistance(80);
water.setWaterTransparency(0.12f);
water.setFoamIntensity(0.4f);
water.setFoamHardness(0.3f);
water.setFoamExistence(new Vector3f(0.8f, 8f, 1f));
water.setReflectionDisplace(50);
water.setRefractionConstant(0.25f);
water.setColorExtinction(new Vector3f(30, 50, 70));
water.setCausticsIntensity(0.4f);
water.setWaveScale(0.003f);
water.setMaxAmplitude(2f);
water.setFoamTexture((Texture2D) assetManager.loadTexture("Common/MatDefs/Water/Textures/foam2.jpg"));
water.setRefractionStrength(0.2f);
water.setWaterHeight(0);
waterFilter = new FilterPostProcessor(assetManager);
waterFilter.addFilter(water);
}
示例2: setWater
import com.jme3.water.WaterFilter; //导入方法依赖的package包/类
/**
* Creates a new water to add to the view
* @param height
* The height of the water
* @param color
* The color of the water
* @param deepColor
* The color of the deep water, i.e. that which is really deep
* @param waves
* True if you want there to be a tide
* @param waveHeight
* The height of the tide, given that it is being used
*/
public void setWater(float height, ColorRGBA color, ColorRGBA deepColor, boolean waves, float waveHeight){
water = new WaterFilter();
water.setWaterHeight(height);
baseWaterHeight = height;
if(color != null){
water.setWaterColor(color);
}
if(deepColor != null){
water.setDeepWaterColor(deepColor);
}
if(waves){
this.waveHeight = waveHeight;
} else{
waveHeight = -1;
}
}
示例3: simpleInitApp
import com.jme3.water.WaterFilter; //导入方法依赖的package包/类
public void simpleInitApp() {
this.flyCam.setMoveSpeed(10);
cam.setLocation(new Vector3f(-27.0f, 1.0f, 75.0f));
// cam.setRotation(new Quaternion(0.03f, 0.9f, 0f, 0.4f));
// load sky
rootNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false));
File file = new File("wildhouse.zip");
if (file.exists()) {
useHttp = false;
}
// create the geometry and attach it
// load the level from zip or http zip
if (useHttp) {
assetManager.registerLocator("http://jmonkeyengine.googlecode.com/files/wildhouse.zip", HttpZipLocator.class.getName());
} else {
assetManager.registerLocator("wildhouse.zip", ZipLocator.class.getName());
}
Spatial scene = assetManager.loadModel("main.scene");
rootNode.attachChild(scene);
DirectionalLight sun = new DirectionalLight();
Vector3f lightDir = new Vector3f(-0.37352666f, -0.50444174f, -0.7784704f);
sun.setDirection(lightDir);
sun.setColor(ColorRGBA.White.clone().multLocal(2));
scene.addLight(sun);
FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
final WaterFilter water = new WaterFilter(rootNode, lightDir);
water.setWaterHeight(-20);
water.setUseFoam(false);
water.setUseRipples(false);
water.setDeepWaterColor(ColorRGBA.Brown);
water.setWaterColor(ColorRGBA.Brown.mult(2.0f));
water.setWaterTransparency(0.2f);
water.setMaxAmplitude(0.3f);
water.setWaveScale(0.008f);
water.setSpeed(0.7f);
water.setShoreHardness(1.0f);
water.setRefractionConstant(0.2f);
water.setShininess(0.3f);
water.setSunScale(1.0f);
water.setColorExtinction(new Vector3f(10.0f, 20.0f, 30.0f));
fpp.addFilter(water);
viewPort.addProcessor(fpp);
inputManager.addListener(new ActionListener() {
public void onAction(String name, boolean isPressed, float tpf) {
if(isPressed){
if(water.isUseHQShoreline()){
water.setUseHQShoreline(false);
}else{
water.setUseHQShoreline(true);
}
}
}
}, "HQ");
inputManager.addMapping("HQ", new KeyTrigger(keyInput.KEY_SPACE));
}
示例4: initEntity
import com.jme3.water.WaterFilter; //导入方法依赖的package包/类
@Override
public void initEntity() {
water = new WaterFilter();
water.setEnabled(isEnabled());
water.setCausticsIntensity(data.getAsFloat("causticsIntensity", water.getCausticsIntensity()));
Vector3f center = data.getAsVector3f("center");
if (center != null) {
water.setCenter(center);
}
water.setColorExtinction(data.getAsVector3f("colorExtinction", water.getColorExtinction()));
water.setDeepWaterColor(data.getAsColor("deepWaterColor", water.getDeepWaterColor()));
water.setFoamExistence(data.getAsVector3f("foamExistence", water.getFoamExistence()));
water.setFoamHardness(data.getAsFloat("foamHardness", water.getFoamHardness()));
water.setFoamIntensity(data.getAsFloat("foamIntensity", water.getFoamIntensity()));
water.setLightColor(data.getAsColor("lightColor", water.getLightColor()));
water.setLightDirection(data.getAsVector3f("lightDirection", water.getLightDirection()));
water.setMaxAmplitude(data.getAsFloat("maxAmplitude", water.getMaxAmplitude()));
water.setNormalScale(data.getAsFloat("normalScale", water.getNormalScale()));
water.setRadius(data.getAsFloat("radius", water.getRadius()));
water.setReflectionDisplace(data.getAsFloat("reflectionDisplace", water.getReflectionDisplace()));
water.setReflectionMapSize(data.getAsInteger("reflectionMapSize", water.getReflectionMapSize()));
water.setRefractionConstant(data.getAsFloat("refractionConstant", water.getRefractionConstant()));
water.setRefractionStrength(data.getAsFloat("refractionStrength", water.getRefractionStrength()));
String shapeType = data.getAsString("shapeType");
if (AreaShape.Square.name().equals(shapeType)) {
water.setShapeType(AreaShape.Square);
} else if (AreaShape.Circular.name().equals(shapeType)) {
water.setShapeType(AreaShape.Circular);
}
water.setShininess(data.getAsFloat("shininess", water.getShininess()));
water.setShoreHardness(data.getAsFloat("shoreHardness", water.getShoreHardness()));
water.setSpeed(data.getAsFloat("speed", water.getSpeed()));
water.setSunScale(data.getAsFloat("sunScale", water.getSunScale()));
water.setUnderWaterFogDistance(data.getAsFloat("underWaterFogDistance", water.getUnderWaterFogDistance()));
water.setUseCaustics(data.getAsBoolean("useCaustics", water.isUseCaustics()));
water.setUseFoam(data.getAsBoolean("useFoam", water.isUseFoam()));
water.setUseHQShoreline(data.getAsBoolean("useHQShoreline", water.isUseHQShoreline()));
water.setUseRefraction(data.getAsBoolean("useRefraction", water.isUseRefraction()));
water.setUseRipples(data.getAsBoolean("useRipples", water.isUseRipples()));
water.setUseSpecular(data.getAsBoolean("useSpecular", water.isUseSpecular()));
water.setWaterColor(data.getAsColor("waterColor", water.getWaterColor()));
water.setWaterHeight(data.getAsFloat("waterHeight", water.getWaterHeight()));
water.setWaterTransparency(data.getAsFloat("waterTransparency", water.getWaterTransparency()));
water.setWaveScale(data.getAsFloat("waveScale", water.getWaveScale()));
water.setWindDirection(data.getAsVector2f("windDirection", water.getWindDirection()));
radiusSquared = water.getRadius() * water.getRadius();
String causticsTexture = data.getAsString("causticsTexture");
if (causticsTexture != null) {
water.setCausticsTexture((Texture2D) LuoYing.getApp().getAssetManager().loadTexture(causticsTexture));
}
String foamTexture = data.getAsString("foamTexture");
if (foamTexture != null) {
water.setFoamTexture((Texture2D) LuoYing.getApp().getAssetManager().loadTexture(foamTexture));
}
String heightTexture = data.getAsString("heightTexture");
if (heightTexture != null) {
water.setHeightTexture((Texture2D) LuoYing.getApp().getAssetManager().loadTexture(heightTexture));
}
String normalTexture = data.getAsString("normalTexture");
if (normalTexture != null) {
water.setNormalTexture((Texture2D) LuoYing.getApp().getAssetManager().loadTexture(normalTexture));
}
// LOG.log(Level.INFO, "---->waterColor={0}", water.getWaterColor());
}