Example #1
0
 private static void CreateQuad(
     Vector3f bl,
     Vector3f tl,
     Vector3f tr,
     Vector3f br,
     boolean back,
     int width,
     int height,
     Vector3f color,
     List<float[]> floatdata,
     List<int[]> ind) {
   // the positions of the actual quad
   float[] positions =
       new float[] {
         bl.x * VOXEL_SIZE, bl.y * VOXEL_SIZE, bl.z * VOXEL_SIZE,
         br.x * VOXEL_SIZE, br.y * VOXEL_SIZE, br.z * VOXEL_SIZE,
         tl.x * VOXEL_SIZE, tl.y * VOXEL_SIZE, tl.z * VOXEL_SIZE,
         tr.x * VOXEL_SIZE, tr.y * VOXEL_SIZE, tr.z * VOXEL_SIZE,
       };
   // the indices order changes if the voxel is looking backward, so
   // culling don't discard it
   int os = 4 * ind.size();
   int[] indices =
       (!back
           ? new int[] {2 + os, 0 + os, 1 + os, 1 + os, 3 + os, 2 + os}
           : new int[] {2 + os, 3 + os, 1 + os, 1 + os, 0 + os, 2 + os});
   floatdata.add(positions);
   floatdata.add(
       new float[] {
         color.x, color.y, color.z,
         color.x, color.y, color.z,
         color.x, color.y, color.z,
         color.x, color.y, color.z
       });
   ind.add(indices);
 }