From f359a633b6678329392529db1d5ca0934cd8462b Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 4 Jul 2013 17:10:43 +0200 Subject: [PATCH] (OSX) BasicOpenGLView - remove unneeded camera stuff --- osx/BasicOpenGLView.h | 12 ------------ osx/BasicOpenGLView.m | 38 +++++++++++--------------------------- 2 files changed, 11 insertions(+), 39 deletions(-) diff --git a/osx/BasicOpenGLView.h b/osx/BasicOpenGLView.h index 585a155a85..86c28f1205 100755 --- a/osx/BasicOpenGLView.h +++ b/osx/BasicOpenGLView.h @@ -70,15 +70,6 @@ typedef struct { GLdouble x,y,z; } recVec; -typedef struct { - recVec viewPos; // View position - recVec viewDir; // View direction vector - recVec viewUp; // View up direction - recVec rotPoint; // Point to rotate about - GLdouble aperture; // pContextInfo->camera aperture - GLint viewWidth, viewHeight; // current window/screen height and width -} recCamera; - @interface BasicOpenGLView : NSOpenGLView { // string attributes @@ -101,9 +92,6 @@ typedef struct { bool fDrawHelp; CFAbsoluteTime time; - - // camera handling - recCamera camera; GLfloat shapeSize; } diff --git a/osx/BasicOpenGLView.m b/osx/BasicOpenGLView.m index 347c3cc97f..47f6e30d8e 100755 --- a/osx/BasicOpenGLView.m +++ b/osx/BasicOpenGLView.m @@ -145,17 +145,21 @@ GLenum glReportError (void) // handles resizing of GL need context update and if the window dimensions change, a // a window dimension update, reseting of viewport and an update of the projection matrix + +unsigned viewWidth = 0; +unsigned viewHeight = 0; + - (void) resizeGL { NSRect rectView = [self bounds]; // ensure camera knows size changed - if ((camera.viewHeight != rectView.size.height) || - (camera.viewWidth != rectView.size.width)) { - camera.viewHeight = rectView.size.height; - camera.viewWidth = rectView.size.width; + if ((viewHeight != rectView.size.height) || + (viewWidth != rectView.size.width)) { + viewHeight = rectView.size.height; + viewWidth = rectView.size.width; - glViewport (0, 0, camera.viewWidth, camera.viewHeight); + glViewport (0, 0, viewWidth, viewHeight); [[self openGLContext] makeCurrentContext]; [self updateInfoString]; } @@ -163,25 +167,6 @@ GLenum glReportError (void) // --------------------------------- -// sets the camera data to initial conditions -- (void) resetCamera -{ - camera.aperture = 40; - - camera.viewPos.x = 0.0; - camera.viewPos.y = 0.0; - camera.viewPos.z = -10.0; - camera.viewDir.x = -camera.viewPos.x; - camera.viewDir.y = -camera.viewPos.y; - camera.viewDir.z = -camera.viewPos.z; - - camera.viewUp.x = 0; - camera.viewUp.y = 1; - camera.viewUp.z = 0; -} - -// --------------------------------- - // per-window timer function, basic time based animation preformed here - (void)animationTimer:(NSTimer *)timer { @@ -247,8 +232,8 @@ GLenum glReportError (void) GLboolean depthTest = glIsEnabled (GL_DEPTH_TEST); GLfloat height, width, messageTop = 10.0f; - height = camera.viewHeight; - width = camera.viewWidth; + height = viewHeight; + width = viewWidth; // set orthograhic 1:1 pixel transform in local view coords glGetIntegerv (GL_MATRIX_MODE, &matrixMode); @@ -426,7 +411,6 @@ GLenum glReportError (void) [[self openGLContext] setValues:&swapInt forParameter:NSOpenGLCPSwapInterval]; // set to vbl sync - [self resetCamera]; shapeSize = 7.0f; // max radius of of objects // init fonts for use with strings