#ifndef __MODEL_H__ #define __MODEL_H__ #include #include #include "geometry.h" #include "tgaimage.h" class Model { private: std::vector verts_; std::vector > faces_; // attention, this Vec3i means vertex/uv/normal std::vector norms_; std::vector uv_; TGAImage diffusemap_; TGAImage normalmap_; TGAImage specularmap_; void load_texture(std::string filename, const char *suffix, TGAImage &img); public: Model(const char *filename); Model(); void loadDiffuseTexture(const char* relativeFileName); void addVertex(float x,float y,float z, float normalX, float normalY, float normalZ, float u, float v); void addTriangle(int vertexposIndex0, int normalIndex0, int uvIndex0, int vertexposIndex1, int normalIndex1, int uvIndex1, int vertexposIndex2, int normalIndex2, int uvIndex2); ~Model(); int nverts(); int nfaces(); Vec3f normal(int iface, int nthvert); Vec3f normal(Vec2f uv); Vec3f vert(int i); Vec3f vert(int iface, int nthvert); Vec2f uv(int iface, int nthvert); TGAColor diffuse(Vec2f uv); float specular(Vec2f uv); std::vector face(int idx); }; #endif //__MODEL_H__