// // Computergraphik II // Prof. Dr. Juergen Doellner // Wintersemester 2001/02 // // Rahmenprogramm zu Aufgabenzettel 8 // #ifndef CG_TWOPART_H #define CG_TWOPART_H #include "cgapplication.h" #include "triangle.h" class Context; class CGTwoPart : public CGApplication { public: CGTwoPart(char* filename); virtual ~CGTwoPart(); // Ueberschreibe alle diese Ereignisse: virtual void onInit(); virtual void onDraw(); virtual void onIdle(); virtual void onKey(unsigned char key); virtual void onSize(unsigned int newWidth, unsigned int newHeight); private: void readImage(); void handleVertex(const Vector& v) const; // filename of ppm-image char* filename_; // dimension of texture int texWidth_; int texHeight_; // image for texture GLubyte* image_;; // texture identifier GLuint texName_; int size_; Triangle* tris_; float zoom_; // object's center Vector center_; // mapping methods Vector SphereIntersection(const Vector& point) const; Vector SphereNormal(const Vector& point) const; Vector SphereSurfaceToTexture(const Vector& surface) const; Vector CylinderIntersection(const Vector& point) const; Vector CylinderNormal(const Vector& point) const; Vector CylinderSurfaceToTexture(const Vector& surface) const; enum { SPHERE_INTERSECTION, SPHERE_NORMAL, CYLINDER_INTERSECTION, CYLINDER_NORMAL } mapping_; // state vars bool stop_; }; #endif // CG_TWOPART_H