Skip to content

Commit

Permalink
Face: rename texture field to color
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelMure committed Mar 13, 2012
1 parent 90ed5b6 commit 835ca76
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/model/Face.java
Expand Up @@ -11,7 +11,7 @@
public class Face { public class Face {


private DenseMatrix64F shape; private DenseMatrix64F shape;
private DenseMatrix64F texture; private DenseMatrix64F color;
private int[] faceIndices; private int[] faceIndices;
private int vertexCount; private int vertexCount;


Expand All @@ -20,7 +20,7 @@ public Face(Shape3D shape3d) {


vertexCount = array.getVertexCount(); vertexCount = array.getVertexCount();
shape.reshape(vertexCount, 3, false); shape.reshape(vertexCount, 3, false);
texture.reshape(vertexCount, 3, false); color.reshape(vertexCount, 3, false);


double[] shape3dCoords = array.getCoordRefDouble(); double[] shape3dCoords = array.getCoordRefDouble();
byte[] shape3dColors = array.getColorRefByte(); byte[] shape3dColors = array.getColorRefByte();
Expand All @@ -29,9 +29,9 @@ public Face(Shape3D shape3d) {
shape.set(x, 0, shape3dCoords[3*x+0]); shape.set(x, 0, shape3dCoords[3*x+0]);
shape.set(x, 1, shape3dCoords[3*x+1]); shape.set(x, 1, shape3dCoords[3*x+1]);
shape.set(x, 2, shape3dCoords[3*x+2]); shape.set(x, 2, shape3dCoords[3*x+2]);
texture.set(x, 0, shape3dColors[3*x+0]); color.set(x, 0, shape3dColors[3*x+0]);
texture.set(x, 1, shape3dColors[3*x+1]); color.set(x, 1, shape3dColors[3*x+1]);
texture.set(x, 2, shape3dColors[3*x+2]); color.set(x, 2, shape3dColors[3*x+2]);
} }


faceIndices = array.getCoordIndicesRef(); faceIndices = array.getCoordIndicesRef();
Expand All @@ -48,7 +48,7 @@ public Face(DenseMatrix64F shape, DenseMatrix64F texture, int[] faceIndices) {
throw new IllegalArgumentException("Size of shape and texture inconsistent."); throw new IllegalArgumentException("Size of shape and texture inconsistent.");


this.shape = shape; this.shape = shape;
this.texture = texture; this.color = texture;
this.faceIndices = faceIndices; this.faceIndices = faceIndices;
this.vertexCount = shape.numRows; this.vertexCount = shape.numRows;
} }
Expand All @@ -61,12 +61,16 @@ public void setShapeMatrix(DenseMatrix64F shape) {
this.shape = shape; this.shape = shape;
} }


public DenseMatrix64F getTextureMatrix() { public DenseMatrix64F getColorMatrix() {
return texture; return color;
} }


public void setTextureMatrix(DenseMatrix64F texture) { public void setColorMatrix(DenseMatrix64F texture) {
this.texture = texture; this.color = texture;
}

public int[] getFaceIndices() {
return faceIndices;
} }


public IndexedTriangleArray getGeometry() { public IndexedTriangleArray getGeometry() {
Expand All @@ -75,7 +79,7 @@ public IndexedTriangleArray getGeometry() {


for(int x = 0; x < vertexCount; x++) { for(int x = 0; x < vertexCount; x++) {
points[x] = new Point3d(shape.get(x, 0), shape.get(x, 1), shape.get(x, 2)); points[x] = new Point3d(shape.get(x, 0), shape.get(x, 1), shape.get(x, 2));
colors[x] = new Color3b((byte) texture.get(x, 0), (byte) texture.get(x, 1), (byte) texture.get(x, 2)); colors[x] = new Color3b((byte) color.get(x, 0), (byte) color.get(x, 1), (byte) color.get(x, 2));
} }


IndexedTriangleArray face = new IndexedTriangleArray(vertexCount,GeometryArray.COORDINATES | GeometryArray.COLOR_3, faceIndices.length); IndexedTriangleArray face = new IndexedTriangleArray(vertexCount,GeometryArray.COORDINATES | GeometryArray.COLOR_3, faceIndices.length);
Expand Down

0 comments on commit 835ca76

Please sign in to comment.