// Path: src/main/java/com/owens/oobjloader/builder/Face.java
// public class Face {
// 
//     public ArrayList<FaceVertex> vertices = new ArrayList<FaceVertex>();
//     public Material material = null;
//     public Material map = null;
//     public VertexNormal faceNormal = new VertexNormal(0, 0, 0);
//     public String objectName;
// 
//     public Face() {
//     }
// 
//     public void add(FaceVertex vertex) {
//         vertices.add(vertex);
//     }
// 
//     // @TODO: This code assumes the face is a triangle.  
//     public void calculateTriangleNormal() {
//         float[] edge1 = new float[3];
//         float[] edge2 = new float[3];
//         float[] normal = new float[3];
//         VertexGeometric v1 = vertices.get(0).v;
//         VertexGeometric v2 = vertices.get(1).v;
//         VertexGeometric v3 = vertices.get(2).v;
//         float[] p1 = {v1.x, v1.y, v1.z};
//         float[] p2 = {v2.x, v2.y, v2.z};
//         float[] p3 = {v3.x, v3.y, v3.z};
// 
//         edge1[0] = p2[0] - p1[0];
//         edge1[1] = p2[1] - p1[1];
//         edge1[2] = p2[2] - p1[2];
// 
//         edge2[0] = p3[0] - p2[0];
//         edge2[1] = p3[1] - p2[1];
//         edge2[2] = p3[2] - p2[2];
// 
//         normal[0] = edge1[1] * edge2[2] - edge1[2] * edge2[1];
//         normal[1] = edge1[2] * edge2[0] - edge1[0] * edge2[2];
//         normal[2] = edge1[0] * edge2[1] - edge1[1] * edge2[0];
// 
//         faceNormal.x = normal[0];
//         faceNormal.y = normal[1];
//         faceNormal.z = normal[2];
//     }
//     
//     public String toString() { 
//         String result = "\tvertices: "+vertices.size()+" :\n";
//         for(FaceVertex f : vertices) {
//             result += " \t\t( "+f.toString()+" )\n";
//         }
//         return result;
//     }
// 
// }   
// 
// Path: src/main/java/com/owens/oobjloader/builder/FaceVertex.java
// public class FaceVertex {
// 
//     int index = -1;
//     public VertexGeometric v = null;
//     public VertexTexture t = null;
//     public VertexNormal n = null;
// 
//     public String toString() {
//         return v + "|" + n + "|" + t;
//     }
// }
// 
// Path: src/main/java/com/owens/oobjloader/builder/Material.java
// public class Material {
// 
//     public String name;
//     public ReflectivityTransmiss ka = new ReflectivityTransmiss();
//     public ReflectivityTransmiss kd = new ReflectivityTransmiss();
//     public ReflectivityTransmiss ks = new ReflectivityTransmiss();
//     public ReflectivityTransmiss tf = new ReflectivityTransmiss();
//     public int illumModel = 0;
//     public boolean dHalo = false;
//     public double dFactor = 0.0;
//     public double nsExponent = 0.0;
//     public double sharpnessValue = 0.0;
//     public double niOpticalDensity = 0.0;
//     public String mapKaFilename = null;
//     public String mapKdFilename = null;
//     public String mapKsFilename = null;
//     public String mapNsFilename = null;
//     public String mapDFilename = null;
//     public String decalFilename = null;
//     public String dispFilename = null;
//     public String bumpFilename = null;
//     public int reflType = BuilderInterface.MTL_REFL_TYPE_UNKNOWN;
//     public String reflFilename = null;
// 
//     public Material(String name) {
//         this.name = name;
//     }
// }


import com.owens.oobjloader.builder.Face;
import com.owens.oobjloader.builder.FaceVertex;
import com.owens.oobjloader.builder.Material;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.ARBVertexBufferObject;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.logging.Logger;
import static java.util.logging.Level.INFO;
import static java.util.logging.Level.SEVERE;
package com.owens.oobjloader.lwjgl;

// This code was written by myself, Sean R. Owens, sean at guild dot net,
// and is released to the public domain. Share and enjoy. Since some
// people argue that it is impossible to release software to the public
// domain, you are also free to use this code under any version of the
// GPL, LPGL, Apache, or BSD licenses, or contact me for use of another
// license.  (I generally don't care so I'll almost certainly say yes.)
// In addition this code may also be used under the "unlicense" described
// at http://unlicense.org/ .  See the file UNLICENSE in the repo.




public class VBOFactory {
    
    private static Logger log = Logger.getLogger(VBOFactory.class.getName());


// Path: src/main/java/com/owens/oobjloader/builder/Face.java
// public class Face {
// 
//     public ArrayList<FaceVertex> vertices = new ArrayList<FaceVertex>();
//     public Material material = null;
//     public Material map = null;
//     public VertexNormal faceNormal = new VertexNormal(0, 0, 0);
//     public String objectName;
// 
//     public Face() {
//     }
// 
//     public void add(FaceVertex vertex) {
//         vertices.add(vertex);
//     }
// 
//     // @TODO: This code assumes the face is a triangle.  
//     public void calculateTriangleNormal() {
//         float[] edge1 = new float[3];
//         float[] edge2 = new float[3];
//         float[] normal = new float[3];
//         VertexGeometric v1 = vertices.get(0).v;
//         VertexGeometric v2 = vertices.get(1).v;
//         VertexGeometric v3 = vertices.get(2).v;
//         float[] p1 = {v1.x, v1.y, v1.z};
//         float[] p2 = {v2.x, v2.y, v2.z};
//         float[] p3 = {v3.x, v3.y, v3.z};
// 
//         edge1[0] = p2[0] - p1[0];
//         edge1[1] = p2[1] - p1[1];
//         edge1[2] = p2[2] - p1[2];
// 
//         edge2[0] = p3[0] - p2[0];
//         edge2[1] = p3[1] - p2[1];
//         edge2[2] = p3[2] - p2[2];
// 
//         normal[0] = edge1[1] * edge2[2] - edge1[2] * edge2[1];
//         normal[1] = edge1[2] * edge2[0] - edge1[0] * edge2[2];
//         normal[2] = edge1[0] * edge2[1] - edge1[1] * edge2[0];
// 
//         faceNormal.x = normal[0];
//         faceNormal.y = normal[1];
//         faceNormal.z = normal[2];
//     }
//     
//     public String toString() { 
//         String result = "\tvertices: "+vertices.size()+" :\n";
//         for(FaceVertex f : vertices) {
//             result += " \t\t( "+f.toString()+" )\n";
//         }
//         return result;
//     }
// 
// }   
// 
// Path: src/main/java/com/owens/oobjloader/builder/FaceVertex.java
// public class FaceVertex {
// 
//     int index = -1;
//     public VertexGeometric v = null;
//     public VertexTexture t = null;
//     public VertexNormal n = null;
// 
//     public String toString() {
//         return v + "|" + n + "|" + t;
//     }
// }
// 
// Path: src/main/java/com/owens/oobjloader/builder/Material.java
// public class Material {
// 
//     public String name;
//     public ReflectivityTransmiss ka = new ReflectivityTransmiss();
//     public ReflectivityTransmiss kd = new ReflectivityTransmiss();
//     public ReflectivityTransmiss ks = new ReflectivityTransmiss();
//     public ReflectivityTransmiss tf = new ReflectivityTransmiss();
//     public int illumModel = 0;
//     public boolean dHalo = false;
//     public double dFactor = 0.0;
//     public double nsExponent = 0.0;
//     public double sharpnessValue = 0.0;
//     public double niOpticalDensity = 0.0;
//     public String mapKaFilename = null;
//     public String mapKdFilename = null;
//     public String mapKsFilename = null;
//     public String mapNsFilename = null;
//     public String mapDFilename = null;
//     public String decalFilename = null;
//     public String dispFilename = null;
//     public String bumpFilename = null;
//     public int reflType = BuilderInterface.MTL_REFL_TYPE_UNKNOWN;
//     public String reflFilename = null;
// 
//     public Material(String name) {
//         this.name = name;
//     }
// }


// Path: src/main/java/com/owens/oobjloader/lwjgl/VBOFactory.java
import com.owens.oobjloader.builder.Face;
import com.owens.oobjloader.builder.FaceVertex;
import com.owens.oobjloader.builder.Material;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.ARBVertexBufferObject;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.logging.Logger;
import static java.util.logging.Level.INFO;
import static java.util.logging.Level.SEVERE;

package com.owens.oobjloader.lwjgl;

// This code was written by myself, Sean R. Owens, sean at guild dot net,
// and is released to the public domain. Share and enjoy. Since some
// people argue that it is impossible to release software to the public
// domain, you are also free to use this code under any version of the
// GPL, LPGL, Apache, or BSD licenses, or contact me for use of another
// license.  (I generally don't care so I'll almost certainly say yes.)
// In addition this code may also be used under the "unlicense" described
// at http://unlicense.org/ .  See the file UNLICENSE in the repo.




public class VBOFactory {
    
    private static Logger log = Logger.getLogger(VBOFactory.class.getName());


    public static VBO build(int textureID, Material material, ArrayList<Face> triangles) {