#pragma once
#include "../../stdafx.h"
#include "glLibObjectMesh.h"
#include "../glLibMaterials.h"

namespace glLib { namespace Object {

//Counts the number of:
//    -vertices, normals, texcoords, and tangents
//Allocates the correct number of:
//    -meshes
//        Counts the number of:
//            -vertex, normal, texcoord, tangent indices
//    -mtllibs
void LoadOBJ_get_metrics(
	const char* file_obj_contents,
	unsigned long* numof_vertices, unsigned long* numof_normals, unsigned long* numof_texcoords, unsigned long* numof_tangents, unsigned long* numof_faces,
	list<glLibInternal_mesh*>* meshes_list,
	list<string>* mtllibs);

//Loads
//    -vertices, normals, texcoords, and tangents
//    -vertex, normal, texcoord, tangent indices
void LoadOBJ_load_data_OBJ(
	const char* file_obj_contents,
	GLfloat* vertices, GLfloat* normals, GLfloat* texcoords, GLfloat* tangents,
	glLibInternal_mesh** meshes_array); //TODO const on this?

//Loads the materials inside a .mtl file
void LoadOBJ_load_data_MTL(
	const string rel_path,
	const char* file_mtl_contents,
	map<string,material*>* mtllib);

//Allocates space in each mesh for indices
glLibInternal_mesh** LoadOBJ_setup_meshes(list<glLibInternal_mesh*>* meshes_list);

};};