# HG changeset patch # User John Tsiombikas # Date 1442859156 -10800 # Node ID d4fed8aac9a6786e8f7a892164b26308229bbb4a # Parent dc735bdeeb8a9f8a51f76e96785ea186793ed8d0 fixed all sideways crap in the effect code fixed fov on all orientations fixed inverted tangent vector in bump mapped version diff -r dc735bdeeb8a -r d4fed8aac9a6 src/ios/viewctl.m --- a/src/ios/viewctl.m Mon Sep 21 07:40:34 2015 +0300 +++ b/src/ios/viewctl.m Mon Sep 21 21:12:36 2015 +0300 @@ -81,6 +81,17 @@ return YES; } +- (BOOL)shouldAutorotate +{ + return YES; +} + +- (UIInterfaceOrientationMask)supportedInterfaceOrientations +{ + return UIInterfaceOrientationMaskLandscape; + //return UIInterfaceOrientationMaskAll; +} + - (void)create_ad { ad = [[ADBannerView alloc] initWithAdType: ADAdTypeBanner]; diff -r dc735bdeeb8a -r d4fed8aac9a6 src/istereo.c --- a/src/istereo.c Mon Sep 21 07:40:34 2015 +0300 +++ b/src/istereo.c Mon Sep 21 21:12:36 2015 +0300 @@ -118,16 +118,16 @@ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if(stereo) { - int split_pt = (int)((float)view_ysz * split); + int split_pt = (int)((float)view_xsz * split); /* right eye */ - glViewport(0, 0, view_xsz, split_pt); - cam_aspect((float)split_pt / (float)view_xsz); + glViewport(0, 0, split_pt, view_ysz); + cam_aspect((float)split_pt / (float)view_ysz); gl_matrix_mode(GL_PROJECTION); gl_load_identity(); cam_stereo_proj_matrix(CAM_RIGHT); - gl_rotatef(-90, 0, 0, 1); + //gl_rotatef(-90, 0, 0, 1); gl_matrix_mode(GL_MODELVIEW); gl_load_identity(); @@ -137,13 +137,13 @@ render(tsec); /* left eye */ - glViewport(0, split_pt, view_xsz, view_ysz - split_pt); - cam_aspect((float)(view_ysz - split_pt) / (float)view_xsz); + glViewport(split_pt, 0, view_xsz - split_pt, view_ysz); + cam_aspect((float)(view_xsz - split_pt) / (float)view_ysz); gl_matrix_mode(GL_PROJECTION); gl_load_identity(); cam_stereo_proj_matrix(CAM_LEFT); - gl_rotatef(-90, 0, 0, 1); + //gl_rotatef(-90, 0, 0, 1); gl_matrix_mode(GL_MODELVIEW); gl_load_identity(); @@ -157,7 +157,7 @@ gl_matrix_mode(GL_PROJECTION); gl_load_identity(); - gl_rotatef(-90, 0, 0, 1); + //gl_rotatef(-90, 0, 0, 1); cam_proj_matrix(); gl_matrix_mode(GL_MODELVIEW); @@ -280,7 +280,7 @@ dfdv = v3_sub(pos_dv, pos); norm = v3_cross(dfdv, dfdu); - gl_vertex_attrib3f(tang_loc, dfdu.x, dfdu.y, dfdu.z); + gl_vertex_attrib3f(tang_loc, dfdu.x, -dfdu.y, dfdu.z); gl_normal3f(norm.x, norm.y, norm.z); gl_texcoord2f(u * 2.0, v * 4.0); gl_vertex3f(pos.x, pos.y, pos.z); @@ -348,9 +348,15 @@ { glViewport(0, 0, x, y); + float aspect = (float)x / (float)y; + float maxfov = 40.0; + float vfov = aspect > 1.0 ? maxfov / aspect : maxfov; + + cam_fov(vfov); + gl_matrix_mode(GL_PROJECTION); gl_load_identity(); - glu_perspective(40.0, (float)x / (float)y, 0.5, 500.0); + glu_perspective(vfov, aspect, 0.5, 500.0); view_xsz = x; view_ysz = y;