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() 

Source Link

Document

Constructs an ExponentialFog node with default parameters.

Usage

From source file:ExExponentialFog.java

public Group buildScene() {
    // Get the current color
    Color3f color = (Color3f) colors[currentColor].value;
    float density = ((Float) densities[currentDensity].value).floatValue();

    // Turn off the example headlight
    setHeadlightEnable(false);//from   w w w.j  a v  a 2  s  .com

    // Default to walk navigation
    setNavigationType(Walk);

    // Create the scene group
    Group scene = new Group();

    // BEGIN EXAMPLE TOPIC
    // Create influencing bounds
    BoundingSphere worldBounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), // Center
            1000.0); // Extent

    // Set the fog color, density, and its influencing bounds
    fog = new ExponentialFog();
    fog.setColor(color);
    fog.setDensity(density);
    fog.setCapability(Fog.ALLOW_COLOR_WRITE);
    fog.setCapability(ExponentialFog.ALLOW_DENSITY_WRITE);
    fog.setInfluencingBounds(worldBounds);
    scene.addChild(fog);
    // END EXAMPLE TOPIC

    // Set the background color and its application bounds
    //   Usually, the background color should match the fog color
    //   or the results look odd.
    background = new Background();
    background.setColor(color);
    background.setApplicationBounds(worldBounds);
    background.setCapability(Background.ALLOW_COLOR_WRITE);
    scene.addChild(background);

    // Build foreground geometry
    scene.addChild(new ColumnScene(this));

    return scene;
}