1. package net.test;
  2.  
  3. public class Vertex {
  4.  
  5.     private float[] xyzw = new float[] { 0f, 0f, 0f, 1f };
  6.     private float[] rgba = new float[] { 1f, 1f, 1f, 1f };
  7.  
  8.     public static final int ELEMENT_COUNT = 8;
  9.     public static final int ELEMENT_BYTES = 4;
  10.     public static final int SIZE_IN_BYTES = ELEMENT_COUNT * ELEMENT_BYTES;
  11.  
  12.     public Vertex(float x, float y, float z) {
  13.         setXYZ(x, y, z);
  14.     }
  15.  
  16.     public final Vertex setXYZ(float x, float y, float z) {
  17.         return this.setXYZW(x, y, z, 1f);
  18.     }
  19.  
  20.     public final Vertex setRGB(float r, float g, float b) {
  21.         return this.setRGBA(r, g, b, 1f);
  22.     }
  23.  
  24.     public final Vertex setXYZW(float x, float y, float z, float w) {
  25.         this.xyzw = new float[] { x, y, z, w };
  26.         return this;
  27.     }
  28.  
  29.     public final Vertex setRGBA(float r, float g, float b, float a) {
  30.         this.rgba = new float[] { r, g, b, 1f };
  31.         return this;
  32.     }
  33.  
  34.     public final float[] getXYZW() {
  35.         return new float[] { this.xyzw[0], this.xyzw[1], this.xyzw[2],
  36.                 this.xyzw[3] };
  37.     }
  38.  
  39.     public final float[] getRGBA() {
  40.         return new float[] { this.rgba[0], this.rgba[1], this.rgba[2],
  41.                 this.rgba[3] };
  42.     }
  43. }