Example usage for javax.media.j3d SpotLight ALLOW_DIRECTION_WRITE

List of usage examples for javax.media.j3d SpotLight ALLOW_DIRECTION_WRITE

Introduction

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

Prototype

int ALLOW_DIRECTION_WRITE

To view the source code for javax.media.j3d SpotLight ALLOW_DIRECTION_WRITE.

Click Source Link

Document

Specifies that the Node allows writing to its spot lights direction information.

Usage

From source file:ExSpotLight.java

public Group buildScene() {
    // Get the current color, position, attenuation,
    // spread angle, and concentration
    Color3f color = (Color3f) colors[currentColor].value;
    Point3f pos = (Point3f) positions[currentPosition].value;
    Vector3f dir = (Vector3f) directions[currentDirection].value;
    Point3f atten = (Point3f) attenuations[currentAttenuation].value;
    float spread = ((Double) spreads[currentSpread].value).floatValue();
    float concen = ((Double) concentrations[currentConcentration].value).floatValue();

    // Turn off the example headlight
    setHeadlightEnable(false);//w w  w. j av a  2  s.  c om

    // Build the scene root
    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 light color and its influencing bounds
    light = new SpotLight();
    light.setEnable(lightOnOff);
    light.setColor(color);
    light.setPosition(pos);
    light.setAttenuation(atten);
    light.setDirection(dir);
    light.setSpreadAngle(spread);
    light.setConcentration(concen);
    light.setCapability(SpotLight.ALLOW_STATE_WRITE);
    light.setCapability(SpotLight.ALLOW_COLOR_WRITE);
    light.setCapability(SpotLight.ALLOW_POSITION_WRITE);
    light.setCapability(SpotLight.ALLOW_ATTENUATION_WRITE);
    light.setCapability(SpotLight.ALLOW_DIRECTION_WRITE);
    light.setCapability(SpotLight.ALLOW_SPREAD_ANGLE_WRITE);
    light.setCapability(SpotLight.ALLOW_CONCENTRATION_WRITE);
    light.setInfluencingBounds(worldBounds);
    scene.addChild(light);
    // END EXAMPLE TOPIC

    // Build foreground geometry
    scene.addChild(new SphereGroup());

    // Add annotation arrows in a fan to show light ray directions,
    // positions, and the spread angle
    scene.addChild(buildArrows());

    return scene;
}

From source file:LightTest.java

protected int[] getCapabilities() {
    int[] superCaps = super.getCapabilities();

    int[] caps = { SpotLight.ALLOW_CONCENTRATION_READ, SpotLight.ALLOW_CONCENTRATION_WRITE,
            SpotLight.ALLOW_DIRECTION_READ, SpotLight.ALLOW_DIRECTION_WRITE, SpotLight.ALLOW_SPREAD_ANGLE_READ,
            SpotLight.ALLOW_SPREAD_ANGLE_WRITE };

    return createCompoundArray(superCaps, caps);
}