예제 #1
0
  public void closeSum() {
    Triangulator t = new Triangulator(topPolygon);
    int lastIndex = mesh.vertices.size();
    for (int i = 0; i < t.getIndices().size(); i++) {
      mesh.indices.add(t.getIndices().get(i) + lastIndex);
    }

    for (Point2D point : topPolygon.points) {
      mesh.vertices.add(new Point3D(point, top, 1));
      mesh.normals.add(new Point3D(0, 1, 0));
    }

    mesh.textCoord.addAll(topPolygon.getTextureMap());
  }
예제 #2
0
  public void closeBase() {
    Triangulator t = new Triangulator(bottomPolygon);
    int lastIndex = mesh.vertices.size();
    for (int i = t.getIndices().size() - 1; i >= 0; i--) {
      mesh.indices.add(t.getIndices().get(i) + lastIndex);
    }

    for (Point2D point : bottomPolygon.points) {
      mesh.vertices.add(new Point3D(point, bottom, 1));
      mesh.normals.add(new Point3D(0, -1, 0));
    }

    mesh.textCoord.addAll(bottomPolygon.getTextureMap());
  }