diff options
author | Matt Turner <mattst88@gmail.com> | 2012-10-24 13:09:59 -0700 |
---|---|---|
committer | Matt Turner <mattst88@gmail.com> | 2012-10-24 13:09:59 -0700 |
commit | a645d75861bd8db86172007be011df17d2c51fac (patch) | |
tree | 551b9daa3a6968b7c6be116cfd29c9bd522a023b /src/main.cpp | |
parent | 67050b3ae4b7b8878c38b9d4e70a50ff219f6766 (diff) |
Add rotate_x/y_axis functions and unit tests
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index 0cc151b..a9d4c74 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -42,6 +42,22 @@ static float orbit_angle = 0.0f; static float eye_distance = 15.0f; static float fov = 45.0f; +GLUmat4 rotate_x_axis(float theta) +{ + return GLUmat4 (GLUvec4 (1.0f, 0.0f, 0.0f, 0.0f), + GLUvec4 (0.0f, cosf(theta), sinf(theta), 0.0f), + GLUvec4 (0.0f, -sinf(theta), cosf(theta), 0.0f), + GLUvec4 (0.0f, 0.0f, 0.0f, 1.0f)); +} + +GLUmat4 rotate_y_axis(float theta) +{ + return GLUmat4 (GLUvec4 (cosf(theta), 0.0f, -sinf(theta), 0.0f), + GLUvec4 (0.0f, 1.0f, 0.0f, 0.0f), + GLUvec4 (sinf(theta), 0.0f, cosf(theta), 0.0f), + GLUvec4 (0.0f, 0.0f, 0.0f, 1.0f)); +} + static Uint32 t0; static GLuint bo; @@ -473,6 +489,7 @@ timer_callback(Uint32 interval, void *not_used) return interval; } +extern void check_rotation(void); int main(int argc, char **argv) @@ -480,6 +497,8 @@ main(int argc, char **argv) (void) argc; (void) argv; + check_rotation(); + if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0) { exit(1); } |