#pragma once #include #include #include #include #include "Vector.h" #include "Vertex.h" class Model { private: class VertexIndex { public: int position; int normal; int texcoord; }; class Face { public: std::list vertices; }; class Texture { GLuint index; public: Texture(const std::string &fileName); void bind(); }; class MaterialInfo { public: MaterialInfo(); std::string name; Texture* texture; bool hasTexture; bool hasDiffuse; Vec3f diffuseColor; bool hasAmbient; Vec3f ambientColor; bool hasSpecular; Vec3f specularColor; }; class ObjGroup { public: std::string name; int materialIndex; std::list faces; std::vector VertexArray; }; std::vector vertices; std::vector normals; std::vector texcoords; std::vector groups; std::vector materials; void loadMaterialFile(std::string fileName, std::string dirName); Model(std::string filename); ~Model(void); public: static std::map > cache; static Model* load(const std::string &fileName); static void unload(Model* model); void draw(); void Optimise(ObjGroup *t); Vec3f minVertex; Vec3f maxVertex; Vec3f center; float radius; };