5 #ifndef VART_VIEWERGLUTOGL_H
6 #define VART_VIEWERGLUTOGL_H
8 #include "vart/scene.h"
13 const int KEY_F1 = GLUT_KEY_F1 + 255;
14 const int KEY_F2 = GLUT_KEY_F2 + 255;
15 const int KEY_F3 = GLUT_KEY_F3 + 255;
16 const int KEY_F4 = GLUT_KEY_F4 + 255;
17 const int KEY_F5 = GLUT_KEY_F5 + 255;
18 const int KEY_F6 = GLUT_KEY_F6 + 255;
19 const int KEY_F7 = GLUT_KEY_F7 + 255;
20 const int KEY_F8 = GLUT_KEY_F8 + 255;
21 const int KEY_F9 = GLUT_KEY_F9 + 255;
26 const int KEY_UP = GLUT_KEY_UP + 255;
169 void SetSize(
int newWidth,
int newHeight);
188 void SetTitle(
const std::string& newTitle);
211 static void Init(
int* argcPtr,
char* argv[]);
244 static void DrawCB0();
245 static void DrawCB1();
246 static void DrawCB2();
247 static void DrawCB3();
248 static void DrawCB4();
249 static void DrawCB5();
251 static void MouseCB0(
int,
int,
int,
int);
252 static void MouseCB1(
int,
int,
int,
int);
253 static void MouseCB2(
int,
int,
int,
int);
254 static void MouseCB3(
int,
int,
int,
int);
255 static void MouseCB4(
int,
int,
int,
int);
256 static void MouseCB5(
int,
int,
int,
int);
258 static void DragMouseCB0(
int x,
int y);
259 static void DragMouseCB1(
int x,
int y);
260 static void DragMouseCB2(
int x,
int y);
261 static void DragMouseCB3(
int x,
int y);
262 static void DragMouseCB4(
int x,
int y);
263 static void DragMouseCB5(
int x,
int y);
265 static void SpecialKeyCB0(
int key,
int x,
int y);
266 static void SpecialKeyCB1(
int key,
int x,
int y);
267 static void SpecialKeyCB2(
int key,
int x,
int y);
268 static void SpecialKeyCB3(
int key,
int x,
int y);
269 static void SpecialKeyCB4(
int key,
int x,
int y);
270 static void SpecialKeyCB5(
int key,
int x,
int y);
272 static void SpecialKeyUpCB0(
int key,
int x,
int y);
273 static void SpecialKeyUpCB1(
int key,
int x,
int y);
274 static void SpecialKeyUpCB2(
int key,
int x,
int y);
275 static void SpecialKeyUpCB3(
int key,
int x,
int y);
276 static void SpecialKeyUpCB4(
int key,
int x,
int y);
277 static void SpecialKeyUpCB5(
int key,
int x,
int y);
279 static void KeyboardCB0(
unsigned char key,
int x,
int y);
280 static void KeyboardCB1(
unsigned char key,
int x,
int y);
281 static void KeyboardCB2(
unsigned char key,
int x,
int y);
282 static void KeyboardCB3(
unsigned char key,
int x,
int y);
283 static void KeyboardCB4(
unsigned char key,
int x,
int y);
284 static void KeyboardCB5(
unsigned char key,
int x,
int y);
286 static void OnKeyUpCB0(
unsigned char key,
int x,
int y);
287 static void OnKeyUpCB1(
unsigned char key,
int x,
int y);
288 static void OnKeyUpCB2(
unsigned char key,
int x,
int y);
289 static void OnKeyUpCB3(
unsigned char key,
int x,
int y);
290 static void OnKeyUpCB4(
unsigned char key,
int x,
int y);
291 static void OnKeyUpCB5(
unsigned char key,
int x,
int y);
293 static void ResizeCB0(
int newWidth,
int newHeight);
294 static void ResizeCB1(
int newWidth,
int newHeight);
295 static void ResizeCB2(
int newWidth,
int newHeight);
296 static void ResizeCB3(
int newWidth,
int newHeight);
297 static void ResizeCB4(
int newWidth,
int newHeight);
298 static void ResizeCB5(
int newWidth,
int newHeight);
300 static void IdleMngr();
302 static int glutIDVec[6];
305 void RegisterCallbacks();
306 void CommonConstructor();
307 void HandleKey(
unsigned char key);
virtual void HandleKey(unsigned char key)
Called when a key is pressed.
void ClearOGLBuffers()
Sets clear color and clears OpenGL buffers.
void SetDragHandler(MouseControl::DragHandler *newDHPtr)
Sets the mouse drag handler.
virtual void OnDraw()=0
Called when the window is redrawn.
ViewerGlutOGL * viewerPtr
Points to the viewer on which the handler was attached.
void SetCamera(Camera *camPtr)
Sets the camera used to view the scene.
ViewerGlutOGL * viewerPtr
Points to the viewer on which the handler was attached.
V-ART Viewer that uses GLUT/OpenGL.
void Iconify()
Iconifies (minimizes) the viewer window.
void Show()
Shows the viewer.
void SetSize(int newWidth, int newHeight)
Sets the window size of the viewer.
virtual void OnIdle()=0
Called when the application is idle.
void Idle()
Idle Management.
ViewerGlutOGL()
Creates an empty, unusable viewer positioned at (0,0).
virtual void HandleSpecialKey(int key)
Called when a special key is pressed.
static void Init(int *argcPtr, char *argv[])
Initializes GLUT Library.
const Camera * GetCurrentCamera() const
Returns the current camera or NULL if no camera exists.
void SetPosition(int x, int y)
Changes the position of a viewer.
void SetClickHandler(MouseControl::ClickHandler *newCHPtr)
Sets the mouse click handler.
void TurnIntoCurrentWindow()
Make the viewer become the current window.
Keeps track of mouse events and state.
static void MainLoop()
Enters main rendering loop.
void SetMotionHandler(MouseControl::MotionHandler *newMHPtr)
Sets the mouse motion handler.
bool redrawOnIdle
Sets whether the viewer should redraw at every Idle call.
void SetDrawHandler(DrawHandler *newDHPtr)
Sets the drawing handler.
void SetIdleHandler(IdleHandler *newIHPtr)
Sets the idle time handler.
bool autoChangeCameraAspect
void SetTitle(const std::string &newTitle)
Changes window title.
ViewerGlutOGL * viewerPtr
Points to the viewer on which the handler was attached.
float walkStep
How much to walk at each step (mouse movement).
void PostRedisplay()
Marks the viewer window for redisplay.
void SetKbHandler(KbHandler *ptrKbH)
Add a keyboard handler to the viewer.
void Hide()
Hides the viewer.
Header file for V-ART class "MouseControl".
virtual void OnKeyDown(int key)
Called when a key is pressed.
void UseNextCamera()
Tells the scene to use next camera in its list.
void SetScene(Scene &scene)
Attaches a scene to the viewer.
virtual void OnKeyUp(int key)
Called when a key is released.
int GetWidth()
Returns current window width.
bool autoNavigationEnabled
Sets whether the built-in navigation is enabled. This is set to "true" by default.
static void RedisplayAll()
Marks all viewers for redisplay.
int GetHeight()
Returns current window height.