2 * fracviewer.h [from agviewer.h (version 1.0)]
4 * AGV: a glut viewer. Routines for viewing a 3d scene w/ glut
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.
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.).
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.
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.
20 * I welcome any feedback or improved versions.
22 * Philip Winston - 4/11/95
24 * http://www.cs.hmc.edu/people/pwinston
29 * Call agvInit() with glut's current window set to the window in
30 * which you want to run the viewer. Right after creating it is fine. It
31 * will remember that window for possible later use (see below) and
32 * registers mouse, motion, and keyboard handlers for that window (see below).
34 * allowidle is 1 or 0 depnding on whether you will let AGV install
35 * and uninstall an idle function. 0 means you will not let it (because
36 * you will be having your own idle function). In this case it is your
37 * responsibility to put a statement like:
42 * at the end of your idle function, to let AGV update the viewpoint if it
45 * If allowidle is 1 it means AGV will install its own idle which
46 * will update the viewpoint as needed and send glutPostRedisplay() to the
47 * window which was current when agvInit() was called.
49 * agvSetIdleAllow changes this value so you can let AGV install its idle
50 * when your idle isn't installed.
53 void agvInit(int allowidle
);
54 void agvSetAllowIdle(int allowidle
);
58 * Set which movement mode you are in.
60 typedef enum { FLYING
, POLAR
} MovementType
;
61 void agvSwitchMoveMode(int move
);
64 * agvViewTransform basically does the appropriate gluLookAt() for the
65 * current position. So call it in your display on the projection matrix
67 void agvViewTransform(void);
70 * agvMoving will be set by AGV according to whether it needs you to call
71 * agvMove() at the end of your idle function. You only need these if
72 * you aren't allowing AGV to do its own idle.
73 * (Don't change the value of agvMoving)
79 * These are the routines AGV registers to deal with mouse and keyboard input.
80 * Keyboard input only matters in flying mode, and then only to set speed.
81 * Mouse input only uses left two buttons in both modes.
82 * These are all registered with agvInit(), but you could register
83 * something else which called these, or reregister these as needed
85 void agvHandleButton(int button
, int state
, int x
, int y
);
86 void agvHandleMotion(int x
, int y
);
87 void agvHandleKeys(unsigned char key
, int x
, int y
);
90 * Just an extra routine which makes an x-y-z axes (about 10x10x10)
91 * which is nice for aligning things and debugging. Pass it an available
94 void agvMakeAxesList(int displaylist
);
98 void ncrossprod(float v1
[3], float v2
[3], float cp
[3]);