sources:


website:
more info here


screenshot:
studies/grafik2/Computergrafik-Code8/Aufgabe22/cgtwopart.h
download file

  1 //
  2 // Computergraphik II
  3 // Prof. Dr. Juergen Doellner
  4 // Wintersemester 2001/02
  5 //
  6 // Rahmenprogramm zu Aufgabenzettel 8
  7 //
  8
  9 #ifndef CG_TWOPART_H
 10 #define CG_TWOPART_H
 11
 12 #include "cgapplication.h"
 13 #include "triangle.h"
 14
 15 class Context;
 16
 17 class CGTwoPart : public CGApplication {
 18 public:
 19     CGTwoPart(char* filename);
 20     virtual ~CGTwoPart();
 21
 22     // Ueberschreibe alle diese Ereignisse:
 23     virtual void onInit();
 24     virtual void onDraw();       
 25     virtual void onIdle();
 26     virtual void onKey(unsigned char key);   
 27     virtual void onSize(unsigned int newWidth, unsigned int newHeight);
 28    
 29 private:
 30     void readImage();
 31     void handleVertex(const Vector& v) const;
 32
 33     // filename of ppm-image
 34     char* filename_;
 35     // dimension of texture
 36     int texWidth_;
 37     int texHeight_;
 38     // image for texture
 39     GLubyte* image_;;
 40     // texture identifier
 41     GLuint texName_;
 42
 43     int size_;
 44     Triangle* tris_;
 45
 46     float zoom_;
 47
 48     // object's center
 49     Vector center_;
 50
 51     // mapping methods
 52     Vector SphereIntersection(const Vector& point) const;
 53     Vector SphereNormal(const Vector& point) const;
 54     Vector SphereSurfaceToTexture(const Vector& surface) const;
 55     Vector CylinderIntersection(const Vector& point) const;
 56     Vector CylinderNormal(const Vector& point) const;
 57     Vector CylinderSurfaceToTexture(const Vector& surface) const;
 58     enum { SPHERE_INTERSECTION, SPHERE_NORMAL, CYLINDER_INTERSECTION, CYLINDER_NORMAL } mapping_;
 59
 60     // state vars
 61     bool stop_;   
 62
 63 };
 64
 65 #endif // CG_TWOPART_H
 66
 67
 68