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.

104 lines
2.1 KiB

  1. #include <windows.h>
  2. #include <GL/glu.h>
  3. #ifdef X11
  4. #include <GL/glx.h>
  5. #endif
  6. #include <stdio.h>
  7. #ifdef WIN32
  8. #include "stonehen.h"
  9. #endif
  10. #include "Ellipse.h"
  11. EllipseSt::EllipseSt()
  12. {
  13. Point sar_dim, lin_dim;
  14. sar_dim.set(.3, .5, 1.2);
  15. lin_dim.set(.3, 1.2, .2);
  16. sarcens[0].set_dimensions(sar_dim);
  17. lintels[0].set_dimensions(lin_dim);
  18. sarcens[0].translate(5, 0, sar_dim.pt[2]);
  19. lintels[0].translate(4.9, 0, 2.*sar_dim.pt[2] + lin_dim.pt[2]);
  20. copy_zero();
  21. sarcens[0].rotate_self_aboutz(17);
  22. sarcens[1].rotate_self_aboutz(33);
  23. lintels[0].rotate_self_aboutz(25);
  24. sarcens[2].rotate_self_aboutz(-17);
  25. sarcens[3].rotate_self_aboutz(-33);
  26. lintels[1].rotate_self_aboutz(-25);
  27. sarcens[4].rotate_self_aboutz(197);
  28. sarcens[5].rotate_self_aboutz(213);
  29. lintels[2].rotate_self_aboutz(205);
  30. sarcens[6].rotate_self_aboutz(-197);
  31. sarcens[7].rotate_self_aboutz(-213);
  32. lintels[3].rotate_self_aboutz(-205);
  33. }
  34. void EllipseSt::erode(float p)
  35. {
  36. int i;
  37. for (i = 0; i < nsarcens; i++) sarcens[i].erode(p);
  38. for (i = 0; i < nlintels; i++) lintels[i].erode(p);
  39. }
  40. void EllipseSt::draw()
  41. {
  42. glPushMatrix();
  43. glScalef(1, 1.1, 1);
  44. draw_sarcens();
  45. draw_lintels();
  46. glPopMatrix();
  47. }
  48. void EllipseSt::draw_sarcens()
  49. {
  50. int i;
  51. for (i = 0; i < nsarcens; i++) sarcens[i].draw();
  52. }
  53. void EllipseSt::draw_lintels()
  54. {
  55. int i;
  56. for (i = 0; i < nlintels; i++) lintels[i].draw();
  57. }
  58. void EllipseSt::draw_shadow(Point dlight, GLfloat blur,
  59. Color color, Color diffuse)
  60. {
  61. draw_sarcens_shadows(dlight, blur, color, diffuse);
  62. draw_lintels_shadows(dlight, blur, color, diffuse);
  63. }
  64. void EllipseSt::draw_sarcens_shadows(Point dlight, GLfloat blur,
  65. Color color, Color diffuse)
  66. {
  67. int i;
  68. for (i = 0; i < nsarcens; i++)
  69. sarcens[i].draw_shadow(dlight, blur, color, diffuse);
  70. }
  71. void EllipseSt::draw_lintels_shadows(Point dlight, GLfloat blur,
  72. Color color, Color diffuse)
  73. {
  74. int i;
  75. for (i = 0; i < nlintels; i++)
  76. lintels[i].draw_shadow(dlight, blur, color, diffuse);
  77. }
  78. void EllipseSt::copy_zero()
  79. {
  80. int i;
  81. for (i = 1; i < nsarcens; i++) sarcens[i] = sarcens[0];
  82. for (i = 1; i < nlintels; i++) lintels[i] = lintels[0];
  83. }