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


Java WaterFilter.setRefractionConstant方法代码示例

本文整理汇总了Java中com.jme3.water.WaterFilter.setRefractionConstant方法的典型用法代码示例。如果您正苦于以下问题:Java WaterFilter.setRefractionConstant方法的具体用法?Java WaterFilter.setRefractionConstant怎么用?Java WaterFilter.setRefractionConstant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jme3.water.WaterFilter的用法示例。


在下文中一共展示了WaterFilter.setRefractionConstant方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
 
开发者ID:shamanDevel,项目名称:ProceduralTerrain,代码行数:22,代码来源:TerrainHeighmapCreator.java

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

示例3: 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());
    }
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:73,代码来源:AdvanceWaterEntity.java


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