deepstone
diff src/main.c @ 28:11d14f688485
added clipping
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 22 Sep 2013 06:38:08 +0300 |
parents | dcfe615c4c5f |
children | 03a0b307706a |
line diff
1.1 --- a/src/main.c Sun Sep 22 02:47:46 2013 +0300 1.2 +++ b/src/main.c Sun Sep 22 06:38:08 2013 +0300 1.3 @@ -51,6 +51,12 @@ 1.4 1.5 static int init(void) 1.6 { 1.7 + float vfov, hfov, aspect; 1.8 + 1.9 + aspect = 320.0 / 200.0; 1.10 + vfov = 60.0; 1.11 + hfov = vfov * aspect; 1.12 + 1.13 init_timer(100); 1.14 1.15 set_video_mode(0x13); 1.16 @@ -74,7 +80,18 @@ 1.17 1.18 mgl_matrix_mode(MGL_PROJECTION); 1.19 mgl_load_identity(); 1.20 - mgl_perspective(45.0, 320.0 / 200.0, 0.5, 200.0); 1.21 + mgl_perspective(vfov, aspect, 0.5, 200.0); 1.22 + 1.23 +#if 0 1.24 + mgl_enable(MGL_CLIP_PLANE0); 1.25 + mgl_enable(MGL_CLIP_PLANE1); 1.26 + mgl_enable(MGL_CLIP_PLANE2); 1.27 + mgl_enable(MGL_CLIP_PLANE3); 1.28 + mgl_clip_plane(MGL_CLIP_PLANE0, -1, 0, -1, 0); /* positive X */ 1.29 + mgl_clip_plane(MGL_CLIP_PLANE1, 1, 0, -1, 0); /* negative X */ 1.30 + mgl_clip_plane(MGL_CLIP_PLANE2, 0, -1, -0.5, 0); /* positive Y */ 1.31 + mgl_clip_plane(MGL_CLIP_PLANE3, 0, 1, -0.5, 0); /* negative Y */ 1.32 +#endif 1.33 1.34 /* setup palette */ 1.35 palm_add_color(255, 255, 255);