Example usage for javax.media.j3d ExponentialFog ExponentialFog

List of usage examples for javax.media.j3d ExponentialFog ExponentialFog

Introduction

In this page you can find the example usage for javax.media.j3d ExponentialFog ExponentialFog.

Prototype

public ExponentialFog(Color3f color, float density) 

Source Link

Document

Constructs an ExponentialFog node with the specified fog color and density.

Usage

From source file:EnvironmentExplorer.java

void setupFogs() {
    fogSwitch = new Switch(Switch.CHILD_NONE);
    fogSwitch.setCapability(Switch.ALLOW_SWITCH_WRITE);

    // set up the linear fog
    LinearFog fogLinear = new LinearFog(skyBlue, 6.0f, 12.0f);
    fogLinear.setInfluencingBounds(infiniteBounds);
    fogSwitch.addChild(fogLinear);//from  ww  w.jav  a2  s  .com

    // set up the exponential fog
    ExponentialFog fogExp = new ExponentialFog(skyBlue, 0.3f);
    fogExp.setInfluencingBounds(infiniteBounds);
    fogSwitch.addChild(fogExp);

    // Create the chooser GUI
    String[] fogNames = { "None", "Linear", "Exponential", };
    int[] fogValues = { Switch.CHILD_NONE, 0, 1 };

    fogChooser = new IntChooser("Fog:", fogNames, fogValues, 0);
    fogChooser.addIntListener(new IntListener() {
        public void intChanged(IntEvent event) {
            int value = event.getValue();
            fogSwitch.setWhichChild(value);
        }
    });
    fogChooser.setValue(Switch.CHILD_NONE);
}