List of usage examples for javax.media.j3d Shape3D Shape3D
public Shape3D()
From source file:ExSpotLight.java
public AnnotationLine(float x, float y, float z, float x2, float y2, float z2) { float[] coord = new float[3]; float[] texcoord = new float[2]; // Build a shape shape = new Shape3D(); shape.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE); // Create geometry for a 2-vertex straight line line = new LineArray(2, GeometryArray.COORDINATES | GeometryArray.TEXTURE_COORDINATE_2); line.setCapability(GeometryArray.ALLOW_COLOR_WRITE); // Starting point coord[0] = x;//from w w w. ja va 2 s . c o m coord[1] = y; coord[2] = z; texcoord[0] = 0.0f; texcoord[1] = 0.0f; line.setCoordinate(0, coord); line.setTextureCoordinate(0, texcoord); // Ending point coord[0] = x2; coord[1] = y2; coord[2] = z2; texcoord[0] = 1.0f; texcoord[1] = 0.0f; line.setCoordinate(1, coord); line.setTextureCoordinate(1, texcoord); shape.setGeometry(line); // Create an appearance mainAppearance = new Appearance(); mainAppearance.setCapability(Appearance.ALLOW_LINE_ATTRIBUTES_WRITE); mainAppearance.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE); lineAttributes = new LineAttributes(); lineAttributes.setLineWidth(lineWidth); mainAppearance.setLineAttributes(lineAttributes); coloringAttributes = new ColoringAttributes(); coloringAttributes.setColor(lineColor); coloringAttributes.setShadeModel(ColoringAttributes.SHADE_FLAT); mainAppearance.setColoringAttributes(coloringAttributes); addChild(shape); }