polyadvent

A game engine from scratch in C
git clone git://jb55.com/polyadvent
Log | Files | Refs | README

camera.c (646B)


      1 
      2 #include "camera.h"
      3 #include "input.h"
      4 #include "mat_util.h"
      5 
      6 // should probably be a scene node
      7 struct camera *camera_init(struct camera *cam) {
      8   return 0;
      9 }
     10 
     11 
     12 void
     13 camera_follow(vec3 *cam_pos, vec3 *target, mat4 *cam) {
     14   /* cam_pos[0] = target[0] - 10; */
     15   /* cam_pos[1] = target[1] - 20; */
     16   /* cam_pos[2] = target[2] + 15; */
     17   /* printf("cam %f %f %f looking at player %f %f %f\n", */
     18   /*        cam_pos[0], cam_pos[1], cam_pos[2], */
     19   /*        target[0], target[1], target[2]); */
     20 
     21   /* look_at(cam_pos, target, V3(0,1,0), cam); */
     22   /* cam_pos[0] = -target[0]; */
     23   /* cam_pos[1] = -target[1]; */
     24   /* cam_pos[2] = target[2]; */
     25 }