polyadvent

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

camera.c (627B)


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