Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.4 KiB

  1. #ifndef STONE_H
  2. #define STONE_H
  3. #include "Color.h"
  4. #include "Point.h"
  5. class Stone {
  6. public:
  7. Stone();
  8. ~Stone();
  9. Stone operator=(Stone a);
  10. void set_dimensions(GLfloat x, GLfloat y, GLfloat z);
  11. void set_dimensions(Point p);
  12. Point get_dimensions() {return dimensions;};
  13. /* p = 0 --> sharp corners, p == 1 --> completely rounded corners */
  14. void erode(float p);
  15. float get_erosion() {return erosion;};
  16. void translate(GLfloat x, GLfloat y, GLfloat z);
  17. void translate(Point p);
  18. /* Angle in degrees */
  19. void rotate_self_aboutz(GLfloat angle);
  20. void draw();
  21. void draw_shadow(Point dlight);
  22. void draw_shadow(Point dlight, GLfloat blur, Color color, Color diffuse);
  23. private:
  24. Point translation;
  25. GLfloat rotation;
  26. /* dimensions contains the length, width, and height of the stone */
  27. Point dimensions;
  28. GLfloat erosion;
  29. Point points[24];
  30. int points_valid;
  31. void compute_points();
  32. int transforms_valid;
  33. inline Point trans_rot_point(Point p, float c, float s);
  34. inline Point transform_point(Point p, float c, float s);
  35. void transform_points();
  36. void draw_faces(int flat = 0);
  37. void draw_faces(Point *p, int flat = 0);
  38. void draw_edges(int flat = 0);
  39. void draw_edges(Point *p, int flat = 0);
  40. void draw_edge(Point n1, Point n2, Point *p, int a, int b, int c, int d,
  41. int flat = 0);
  42. void draw_corners(int flat = 0) {draw_corners(points, flat);};
  43. void draw_corners(Point *p, int flat = 0);
  44. };
  45. #endif