Example usage for javax.media.j3d Clip Clip

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

Introduction

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

Prototype

public Clip() 

Source Link

Document

Constructs a Clip node with default parameters.

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  .ja  v  a  2s. 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;
}