/*! \file object.h \brief Contains the Object Class that handles 3D-Objects */ #ifndef _OBJECT_H #define _OBJECT_H #include #include #include "array.h" #include "material.h" #include "vector.h" #include using namespace std; extern int verbose; //!< Will be removed and added again as a verbose-class. //! Class that handles 3D-Objects. it can also read them in and display them. class Object { public: Object (); Object (char* fileName); Object(char* fileName, float scaling); ~Object (); void draw (void) const; void draw (int groupNumber) const; void draw (char* groupName) const; int getGroupCount() const; private: struct FaceElement { int vertexNumber; int normalNumber; int texCoordNumber; FaceElement* next; }; //! Face struct Face { int vertexCount; FaceElement* firstElem; char* materialString; Face* next; }; //! Group to handle multiple Objects per obj-file struct Group { char* name; GLuint listNumber; Face* firstFace; Face* currentFace; int faceMode; int faceCount; Group* next; }; Array* vertices; int verticesCount; Array* colors; Array* normals; Array* vTexture; Group* firstGroup; //!< the first of all groups. Group* currentGroup; //!< the currentGroup. this is the one we will work with. int groupCount; Material* material; float scaleFactor; char* objPath; char* objFileName; char* mtlFileName; bool initialize (void); bool initGroup(Group* group); bool initFace (Face* face); bool cleanup(void); bool cleanupGroup(Group* group); bool cleanupFace(Face* face); bool cleanupFaceElement(FaceElement* faceElem); ///// readin /// bool importFile (char* fileName); bool readFromObjFile (void); bool readGroup (char* groupString); bool readVertex (char* vertexString); bool readFace (char* faceString); bool readVertexNormal (char* normalString); bool readVertexTexture (char* vTextureString); bool readMtlLib (char* matFile); bool readUseMtl (char* mtlString); bool importToGL (void); bool addGLElement (FaceElement* elem); bool buildVertexNormals (); void BoxObject (void); }; #endif