Ejemplo n.º 1
0
  private void createGeometry(ArrayList<Point3f> coords, Color3f col) {
    int numPoints = coords.size();

    Point3f[] points = new Point3f[numPoints];
    coords.toArray(points); // ArrayList --> array
    plane.setCoordinates(0, points);

    Color3f cols[] = new Color3f[numPoints];
    for (int i = 0; i < numPoints; i++) cols[i] = col;
    plane.setColors(0, cols);

    setGeometry(plane);
  } // end of createGeometry()
Ejemplo n.º 2
0
  public CubeShape() {
    super();

    int i;

    QuadArray cube = new QuadArray(24, QuadArray.COORDINATES | QuadArray.NORMALS);

    cube.setCoordinates(0, verts);
    for (i = 0; i < 24; i++) {
      cube.setNormal(i, normals[i / 4]);
    }

    cube.setCapability(Geometry.ALLOW_INTERSECT);
    setAppearance(new Appearance());
    setGeometry(cube);
  }