Example usage for javax.media.j3d SpotLight ALLOW_CONCENTRATION_WRITE

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

Introduction

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

Prototype

int ALLOW_CONCENTRATION_WRITE

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

Click Source Link

Document

Specifies that the Node allows writing to its spot lights concentration 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);//from   w  w  w.  j  a v  a2 s . com

    // 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:EnvironmentExplorer.java

void setupLights() {

    lightGroup = new Group();

    // Set up the ambient light
    lightAmbient = new AmbientLight(darkGrey);
    lightAmbient.setInfluencingBounds(infiniteBounds);
    lightAmbient.setCapability(Light.ALLOW_STATE_WRITE);
    lightAmbient.setEnable(true);/*from  w  ww  . j  a  va 2 s  .c o m*/
    lightGroup.addChild(lightAmbient);

    // Set up the directional light
    Vector3f lightDirection = new Vector3f(0.65f, -0.65f, -0.40f);
    lightDirectional = new DirectionalLight(white, lightDirection);
    lightDirectional.setInfluencingBounds(infiniteBounds);
    lightDirectional.setEnable(true);
    lightDirectional.setCapability(Light.ALLOW_STATE_WRITE);
    lightGroup.addChild(lightDirectional);

    // Set up the point light
    Point3f lightPosition = new Point3f(-1.0f, 1.0f, 0.6f);
    lightPoint = new PointLight(white, lightPosition, attenuation);
    lightPoint.setInfluencingBounds(infiniteBounds);
    lightPoint.setEnable(false);
    lightPoint.setCapability(Light.ALLOW_STATE_WRITE);
    lightPoint.setCapability(PointLight.ALLOW_ATTENUATION_WRITE);
    lightGroup.addChild(lightPoint);

    // Set up the spot light
    // Point the light back at the origin
    lightSpot = new SpotLight(white, lightPosition, attenuation, lightDirection,
            (float) Math.toRadians(spotSpreadAngle), spotConcentration);
    lightSpot.setInfluencingBounds(infiniteBounds);
    lightSpot.setEnable(false);
    lightSpot.setCapability(Light.ALLOW_STATE_WRITE);
    lightSpot.setCapability(PointLight.ALLOW_ATTENUATION_WRITE);
    lightSpot.setCapability(SpotLight.ALLOW_CONCENTRATION_WRITE);
    lightSpot.setCapability(SpotLight.ALLOW_SPREAD_ANGLE_WRITE);
    lightGroup.addChild(lightSpot);
}

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