Example usage for javax.media.j3d ExponentialFog ALLOW_DENSITY_WRITE

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

Introduction

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

Prototype

int ALLOW_DENSITY_WRITE

To view the source code for javax.media.j3d ExponentialFog ALLOW_DENSITY_WRITE.

Click Source Link

Document

Specifies that this ExponentialFog node allows write access to its density information.

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.jav a 2s .  co m*/

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