Example usage for javax.media.j3d LinearFog LinearFog

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

Introduction

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

Prototype

public LinearFog(float r, float g, float b) 

Source Link

Document

Constructs a LinearFog node with the specified fog color.

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  . java  2 s  . c o  m

    // 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);
}