89

Building 3D shapes
QuadArray example code

  • Create lists of 3D coordinates and normals for the vertices
    Point3f[] myCoords = {
        new Point3f(  0.0f, 0.0f, 0.0f ),
        . . .
    }
    Vector3f[] myNormals = {
        new Vector3f(  0.0f, 1.0f, 0.0f ),
        . . .
    }
  • Create a QuadArray and set the vertex coordinates and normals
    QuadArray myQuads = new QuadArray(
        myCoords.length,
        GeometryArray.COORDINATES |
        GeometryArray.NORMALS );
    myQuads.setCoordinates( 0, myCoords );
    myQuads.setNormals( 0, myNormals );

  • Assemble the shape
    Shape3D myShape = new Shape3D( myQuads, myAppear );