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.

106 lines
3.4KB

  1. /*
  2. * fracviewer.h [from agviewer.h (version 1.0)]
  3. *
  4. * AGV: a glut viewer. Routines for viewing a 3d scene w/ glut
  5. *
  6. * The two view movement modes are POLAR and FLYING. Both move the eye, NOT
  7. * THE OBJECT. You can never be upside down or twisted (roll) in either mode.
  8. *
  9. * A nice addition would be an examiner type trackball mode where you are
  10. * moving the object and so could see it from any angle. Also less restricted
  11. * flying and polar modes (fly upside down, do rolls, etc.).
  12. *
  13. * Controls for Polar are just left and middle buttons -- for flying it's
  14. * those plus 0-9 number keys and +/- for speed adjustment.
  15. *
  16. * See agv_example.c and agviewer.c for more info. Probably want to make
  17. * a copy of these and then edit for each program. This isn't meant to be
  18. * a library, just something to graft onto your own programs.
  19. *
  20. * I welcome any feedback or improved versions.
  21. *
  22. * Philip Winston - 4/11/95
  23. * pwinston@hmc.edu
  24. * http://www.cs.hmc.edu/people/pwinston
  25. */
  26. /*
  27. * Call agvInit() with glut's current window set to the window in
  28. * which you want to run the viewer. Right after creating it is fine. It
  29. * will remember that window for possible later use (see below) and
  30. * registers mouse, motion, and keyboard handlers for that window (see below).
  31. *
  32. * allowidle is 1 or 0 depnding on whether you will let AGV install
  33. * and uninstall an idle function. 0 means you will not let it (because
  34. * you will be having your own idle function). In this case it is your
  35. * responsibility to put a statement like:
  36. *
  37. * if (agvMoving)
  38. * agvMove();
  39. *
  40. * at the end of your idle function, to let AGV update the viewpoint if it
  41. * is moving.
  42. *
  43. * If allowidle is 1 it means AGV will install its own idle which
  44. * will update the viewpoint as needed and send glutPostRedisplay() to the
  45. * window which was current when agvInit() was called.
  46. *
  47. * agvSetIdleAllow changes this value so you can let AGV install its idle
  48. * when your idle isn't installed.
  49. *
  50. */
  51. void agvInit(int allowidle);
  52. void agvSetAllowIdle(int allowidle);
  53. /*
  54. * Set which movement mode you are in.
  55. */
  56. typedef enum { FLYING, POLAR } MovementType;
  57. void agvSwitchMoveMode(int move);
  58. /*
  59. * agvViewTransform basically does the appropriate gluLookAt() for the
  60. * current position. So call it in your display on the projection matrix
  61. */
  62. void agvViewTransform(void);
  63. /*
  64. * agvMoving will be set by AGV according to whether it needs you to call
  65. * agvMove() at the end of your idle function. You only need these if
  66. * you aren't allowing AGV to do its own idle.
  67. * (Don't change the value of agvMoving)
  68. */
  69. extern int agvMoving;
  70. void agvMove(void);
  71. /*
  72. * These are the routines AGV registers to deal with mouse and keyboard input.
  73. * Keyboard input only matters in flying mode, and then only to set speed.
  74. * Mouse input only uses left two buttons in both modes.
  75. * These are all registered with agvInit(), but you could register
  76. * something else which called these, or reregister these as needed
  77. */
  78. void agvHandleButton(int button, int state, int x, int y);
  79. void agvHandleMotion(int x, int y);
  80. void agvHandleKeys(unsigned char key, int x, int y);
  81. /*
  82. * Just an extra routine which makes an x-y-z axes (about 10x10x10)
  83. * which is nice for aligning things and debugging. Pass it an available
  84. * displaylist number.
  85. */
  86. void agvMakeAxesList(int displaylist);
  87. void ncrossprod(float v1[3], float v2[3], float cp[3]);