Example usage for javax.media.j3d Shape3D ALLOW_APPEARANCE_OVERRIDE_WRITE

List of usage examples for javax.media.j3d Shape3D ALLOW_APPEARANCE_OVERRIDE_WRITE

Introduction

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

Prototype

int ALLOW_APPEARANCE_OVERRIDE_WRITE

To view the source code for javax.media.j3d Shape3D ALLOW_APPEARANCE_OVERRIDE_WRITE.

Click Source Link

Document

Specifies that this node allows writing its appearance override enable flag.

Usage

From source file:AlternateAppearanceScopeTest.java

public SphereGroup(float radius, float xSpacing, float ySpacing, int xCount, int yCount, Appearance app,
        boolean overrideflag) {
    if (app == null) {
        app = new Appearance();
        Material material = new Material();
        material.setDiffuseColor(new Color3f(0.8f, 0.8f, 0.8f));
        material.setSpecularColor(new Color3f(0.0f, 0.0f, 0.0f));
        material.setShininess(0.0f);/* ww w . j  a v  a  2s . c o  m*/
        app.setMaterial(material);
    }

    double xStart = -xSpacing * (double) (xCount - 1) / 2.0;
    double yStart = -ySpacing * (double) (yCount - 1) / 2.0;

    Sphere sphere = null;
    TransformGroup trans = null;
    Transform3D t3d = new Transform3D();
    Vector3d vec = new Vector3d();
    double x, y = yStart, z = 0.0;
    shapes = new Shape3D[xCount * yCount];
    for (int i = 0; i < yCount; i++) {
        x = xStart;
        for (int j = 0; j < xCount; j++) {
            vec.set(x, y, z);
            t3d.setTranslation(vec);
            trans = new TransformGroup(t3d);
            addChild(trans);

            sphere = new Sphere(radius, // sphere radius
                    Primitive.GENERATE_NORMALS, // generate normals
                    16, // 16 divisions radially
                    app); // it's appearance
            trans.addChild(sphere);
            x += xSpacing;
            shapes[numShapes] = sphere.getShape();
            if (overrideflag)
                shapes[numShapes].setCapability(Shape3D.ALLOW_APPEARANCE_OVERRIDE_WRITE);
            numShapes++;
        }
        y += ySpacing;
    }
}