package net.test;
public class Vertex {
private float[] xyzw = new float[] { 0f, 0f, 0f, 1f };
private float[] rgba = new float[] { 1f, 1f, 1f, 1f };
public static final int ELEMENT_COUNT = 8;
public static final int ELEMENT_BYTES = 4;
public static final int SIZE_IN_BYTES = ELEMENT_COUNT * ELEMENT_BYTES;
public Vertex(float x, float y, float z) {
setXYZ(x, y, z);
}
public final Vertex setXYZ(float x, float y, float z) {
return this.setXYZW(x, y, z, 1f);
}
public final Vertex setRGB(float r, float g, float b) {
return this.setRGBA(r, g, b, 1f);
}
public final Vertex setXYZW(float x, float y, float z, float w) {
this.xyzw = new float[] { x, y, z, w };
return this;
}
public final Vertex setRGBA(float r, float g, float b, float a) {
this.rgba = new float[] { r, g, b, 1f };
return this;
}
public final float[] getXYZW() {
return new float[] { this.xyzw[0], this.xyzw[1], this.xyzw[2],
this.xyzw[3] };
}
public final float[] getRGBA() {
return new float[] { this.rgba[0], this.rgba[1], this.rgba[2],
this.rgba[3] };
}
}