polyadvent

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

orbit.h (550B)


      1 
      2 #ifndef ORBIT_H
      3 #define ORBIT_H
      4 
      5 #include "vec3.h"
      6 #include "node.h"
      7 #include "mat4.h"
      8 
      9 struct spherical {
     10     float radius;
     11     float inclination;
     12     float azimuth;
     13 };
     14 
     15 struct orbit {
     16     struct spherical coords;
     17     node_id node_id;
     18 };
     19 
     20 void new_orbit(struct orbit *orbit);
     21 
     22 vec3 *spherical_dir(struct spherical s, vec3 *dir);
     23 vec3 *spherical_pos(struct spherical *s, vec3 *from, vec3 *to);
     24 vec3 *spherical_look_at(struct spherical *s, vec3 *target, mat4 *mat);
     25 vec3 *spherical_to_cartesian(struct spherical *s, float *v3);
     26 
     27 #endif /* ORBIT_H */