Example usage for javax.media.j3d PointLight ALLOW_ATTENUATION_WRITE

List of usage examples for javax.media.j3d PointLight ALLOW_ATTENUATION_WRITE

Introduction

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

Prototype

int ALLOW_ATTENUATION_WRITE

To view the source code for javax.media.j3d PointLight ALLOW_ATTENUATION_WRITE.

Click Source Link

Document

Specifies that this PointLight node allows writing its attenuation information.

Usage

From source file:ExPointLight.java

public Group buildScene() {
    // Get the current color, position, and attenuation
    Color3f color = (Color3f) colors[currentColor].value;
    Point3f pos = (Point3f) positions[currentPosition].value;
    Point3f atten = (Point3f) attenuations[currentAttenuation].value;

    // Turn off the example headlight
    setHeadlightEnable(false);/*  w w  w  .  j ava  2  s.  c o  m*/

    // 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 PointLight();
    light.setEnable(lightOnOff);
    light.setColor(color);
    light.setPosition(pos);
    light.setAttenuation(atten);
    light.setCapability(PointLight.ALLOW_STATE_WRITE);
    light.setCapability(PointLight.ALLOW_COLOR_WRITE);
    light.setCapability(PointLight.ALLOW_POSITION_WRITE);
    light.setCapability(PointLight.ALLOW_ATTENUATION_WRITE);
    light.setInfluencingBounds(worldBounds);
    scene.addChild(light);
    // END EXAMPLE TOPIC

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

    // Add arrows in a fan to show light ray directions
    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  w  w .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 = { PointLight.ALLOW_ATTENUATION_READ, PointLight.ALLOW_ATTENUATION_WRITE,
            PointLight.ALLOW_POSITION_READ, PointLight.ALLOW_POSITION_WRITE };

    return createCompoundArray(superCaps, caps);
}