Skip to content

Commit c1241a4

Browse files
Merge pull request #63 from ArtifactForms/working2
UV support
2 parents 539ec20 + 8212d8b commit c1241a4

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/main/java/mesh/Face3D.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ public Face3D(int... indices) {
2525
this(indices, new int[0]);
2626
}
2727

28+
public Face3D(Face3D f) {
29+
this(f.indices);
30+
this.tag = new String(f.tag);
31+
}
32+
2833
public Face3D(int[] indices, int[] uvIndices) {
2934
this.color = new Color();
3035
this.indices = new int[indices.length];
@@ -54,13 +59,12 @@ public int getUvIndexAt(int index) {
5459
return uvIndices[index % uvIndices.length];
5560
}
5661

57-
public int getVertexCount() {
58-
return indices.length;
62+
public void setUvIndices(int... uvIndices) {
63+
this.uvIndices = uvIndices;
5964
}
6065

61-
public Face3D(Face3D f) {
62-
this(f.indices);
63-
this.tag = new String(f.tag);
66+
public int getVertexCount() {
67+
return indices.length;
6468
}
6569

6670
@Override

src/main/java/mesh/Mesh3D.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,10 @@ public void addVertex(float x, float y, float z) {
215215
public void addFace(int... indices) {
216216
faces.add(new Face3D(indices));
217217
}
218+
219+
public void addFace(boolean uvs, int... indices) {
220+
faces.add(new Face3D(indices, indices));
221+
}
218222

219223
public void addVertices(Collection<Vector3f> vertices) {
220224
this.vertices.addAll(vertices);

0 commit comments

Comments
 (0)