// Author: Juan Carlos De Abreu (jcabreur@gmail.com)
//
// This file define a interface inherent form IMMOject that allow have 
// geoemtries in the app.

#ifndef MODEL_MODEL_H__
#define MODEL_MODEL_H__

#include "../global.h"
#include "Group.h"
#include "../Material/Material.h"
#include "../Util/Funcs.h"
#include "../Base/Memory/MMObject.h"
#include "../Base/Memory/SmartPointer.h"

#include "../collision_detection/aabb_tree.h"

BEGIN_TEG_NAMESPACE();

class IModel : public IMMObject {
public:
	// Attributes
	GLuint pointDL;				// Display list of the model points 
	GLuint gridDL;				// Display List of the model grid
	GLuint surfaceDL;			// Display List of the model surface
	GLuint boundingBoxDL;		// Display list of the model Bonding box

public:
	AABBTree bb;

	// Attributes
	// Groups of data of the model
	std::vector<Group> groupList;
	// BoundingBox of the vertex in the group
	Vec3f vMin, vMax;

	std::tstring path;

	// IModel constructor and destructor.
	IModel();
	virtual ~IModel();

	// Method to load a file that contain a info of a model
	virtual void load(const _TCHAR* lpszPathName) = 0;

	// Method to normalize the model
	void process();

	// Method to create the display list the object ...
	void createGridDL();
	void createPointDL();
	void createSurfaceDL();
	void createBoundingBoxDL();

	void drawGrid() const;
	void drawPoint() const;
	void drawSurface(int renderMode);
	void drawBoundingBox() const;

	// Method to make the render the model surface with a specific material.
	void drawSurface(const int& renderMode, const SmartPointer<Material>& customMaterial) const;

 private:
  DISALLOW_COPY_AND_ASSIGN(IModel);
};

END_TEG_NAMESPACE();

#endif  // MODEL_MODEL_H__
