#ifndef __MODEL_H #define __MODEL_H #include #include #include "../punkt3d.h" #include "../punkt2d.h" #include "../color.h" #include "../quader.h" namespace segl { class Meshpoint { public: Meshpoint(); Meshpoint(Punkt3D v, Punkt2D vt); void set(Punkt3D v, Punkt2D vt); void use() const; Punkt3D vertex; Punkt2D texcoord; }; class Material { public: Material(); Material(std::string _name, Color _a, Color _d, Color _s); void set(std::string _name, Color _a, Color _d, Color _s); void use() const; std::string name; Color ambient, diffuse, specular; }; class Polygonpoint { public: Polygonpoint(); void use() const; Punkt3D *point; Punkt2D *tex; Punkt3D *normal; }; class Meshpolygon { public: Meshpolygon(); Meshpolygon(Meshpoint *a, Meshpoint *b, Meshpoint *c); void set(Meshpoint *a, Meshpoint *b, Meshpoint *c); void render(GLenum mode=GL_TRIANGLES) const; Polygonpoint m1, m2, m3; Meshpoint *a, *b, *c; Material *mat; }; class Model { friend class Modelloader; friend class LoadOBJ; private: bool loaded; unsigned int meshdataanz; unsigned int polydataanz; unsigned int matdataanz; unsigned int texdataanz; unsigned int normdataanz; Punkt3D *meshdata; Meshpolygon *polydata; Material *matdata; Punkt2D *texdata; Punkt3D *normdata; Material backupmat; Quader boundingbox; float boundingrad; public: Model(); ~Model(); bool isLoaded() const; void unload(); void render() const; Quader getBoundingBox() const { return boundingbox; } float getBoundingRad() const { return boundingrad; } const Punkt3D* getMeshData(unsigned int *meshanz) const; const Meshpolygon* getPolygonData(unsigned int *polyanz) const; }; } // namespace segl #endif