#ifndef GLCAM_H
#define GLCAM_H

#include <GL/glut.h>
#include "types.h"
#include "glhand.h"

typedef struct glcam_s {
  vector up; /* normalized */
  vector dir; /* normalized */
  vector eye; /* camera position */
  vector target; /* where camera points to */

  coord fov;

  int height; /* screen size */
  int width;
} glcam_t ;

glcam_t* glcam_new       (vector, vector, coord, int , int) ;
void     glcam_delete    (glcam_t*) ;
void     glcam_reshape   (glcam_t*, int w, int h);
void     glcam_update    (glcam_t*) ;
void     glcam_init      (glcam_t*, vector, vector, coord, int , int ) ;

void     glcam_translate (glcam_t*, coord x, coord y, coord z, char target) ;
void     glcam_roll      (glcam_t*, coord angle);
void     glcam_yaw       (glcam_t*, coord angle);
void     glcam_pitch     (glcam_t*, coord angle);
void     glcam_turnaround(glcam_t*, coord x, coord y);

void     glcam_adjustup  (glcam_t*);

zone_t zone_glcam ;
action_t action_glcam_lookat ;
action_t action_glcam_dolly ;
action_t action_glcam_pan ;
action_t action_glcam_mousebutton ;
action_t action_glcam_none ;
action_t action_glcam_keyboard ;

int lookatCallback(void* c, int eventtype, int eventdata, int dx, int dy) ;
int dollyCallback(void* c, int eventtype, int eventdata, int dx, int dy) ;
int panCallback(void* c, int eventtype, int eventdata, int dx, int dy) ;
int noneCallback (void* dummy, int eventtype, int eventdata, int x, int y) ;
int mousebuttonCallback (void* dummy, int t, int eventdata, int x, int y) ;
int keyboardactionCallback (void* d, int t, int e, int x, int y) ;

#endif GLCAM_H


