Example usage for javax.media.j3d Clip ALLOW_BACK_DISTANCE_WRITE

List of usage examples for javax.media.j3d Clip ALLOW_BACK_DISTANCE_WRITE

Introduction

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

Prototype

int ALLOW_BACK_DISTANCE_WRITE

To view the source code for javax.media.j3d Clip ALLOW_BACK_DISTANCE_WRITE.

Click Source Link

Document

Specifies that the Clip allows write access to its back distance at runtime.

Usage

From source file:ExClip.java

public Group buildScene() {
    // Get the current color
    Color3f color = (Color3f) colors[currentColor].value;
    float front = ((Float) fronts[currentFront].value).floatValue();
    float back = ((Float) backs[currentBack].value).floatValue();

    // Turn off the example headlight
    setHeadlightEnable(false);/*from  w  w  w  .  j  a va 2  s .  c o  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, front & back distances, and
    // its influencing bounds
    fog = new LinearFog();
    fog.setColor(color);
    fog.setFrontDistance(front);
    fog.setBackDistance(back);
    fog.setCapability(Fog.ALLOW_COLOR_WRITE);
    fog.setCapability(LinearFog.ALLOW_DISTANCE_WRITE);
    fog.setInfluencingBounds(worldBounds);
    scene.addChild(fog);

    // Add a clip node with it's clip distance (back
    // distance) set to the fog's back distance. This
    // insures that shapes are clipped off, and not drawn,
    // from the fog back (maximum density) onwards into
    // the distance.
    clip = new Clip();
    clip.setBackDistance(back);
    clip.setCapability(Clip.ALLOW_BACK_DISTANCE_WRITE);
    clip.setApplicationBounds(worldBounds);
    scene.addChild(clip);
    // 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;
}