diff --git a/wrap/gl/camera.h b/wrap/gl/camera.h index a72d15d4..debf7252 100644 --- a/wrap/gl/camera.h +++ b/wrap/gl/camera.h @@ -139,35 +139,35 @@ static void SetGLIsometricProj(float x1, float x2, float y1, float y2, float z1, } /// get OpenGL-like frustum from a vcg camera (intrinsics) -static void GetFrustum(vcg::Camera & intrinsics, S & sx,S & dx,S & bt,S & tp,S & f) +static void GetFrustum(const vcg::Camera & intrinsics, S & sx,S & dx,S & bt,S & tp,S & f) { intrinsics.GetFrustum(sx,dx,bt,tp,f); } /// set the OpenGL PROJECTION matrix to match the camera (intrinsics). requires near and far plane -static void TransformGL(vcg::Camera & camera, S nearDist, S farDist ) +static void TransformGL(const vcg::Camera & camera, S nearDist, S farDist ) { S sx,dx,bt,tp,nr; camera.GetFrustum(sx,dx,bt,tp,nr); - if(camera.cameraType == CameraType::PERSPECTIVE) { - S ratio = nearDist/nr; - sx *= ratio; - dx *= ratio; - bt *= ratio; - tp *= ratio; - } + if(camera.cameraType == CameraType::PERSPECTIVE) { + S ratio = nearDist/nr; + sx *= ratio; + dx *= ratio; + bt *= ratio; + tp *= ratio; + } assert(glGetError()==0); - switch(camera.cameraType) + switch(camera.cameraType) { - case CameraType::PERSPECTIVE: glFrustum(sx,dx,bt,tp,nearDist,farDist); break; - case CameraType::ORTHO: glOrtho(sx,dx,bt,tp,nearDist,farDist); break; - case CameraType::ISOMETRIC: SetGLIsometricProj(sx,dx,bt,tp,nearDist,farDist); break; - case CameraType::CAVALIERI: SetGLCavalieriProj(sx,dx,bt,tp,nearDist,farDist); break; + case CameraType::PERSPECTIVE: glFrustum(sx,dx,bt,tp,nearDist,farDist); break; + case CameraType::ORTHO: glOrtho(sx,dx,bt,tp,nearDist,farDist); break; + case CameraType::ISOMETRIC: SetGLIsometricProj(sx,dx,bt,tp,nearDist,farDist); break; + case CameraType::CAVALIERI: SetGLCavalieriProj(sx,dx,bt,tp,nearDist,farDist); break; } - + assert(glGetError()==0); }; diff --git a/wrap/gl/shot.h b/wrap/gl/shot.h index b175c3d6..4f4baade 100644 --- a/wrap/gl/shot.h +++ b/wrap/gl/shot.h @@ -95,13 +95,13 @@ struct GlShot { typedef GlCamera GlCameraType; /// returns the OpenGL 4x4 MODELVIEW matrix that describes the shot position and orientation (extrinsics) -static void MatrixGL(ShotType & shot,vcg::Matrix44 & m) +static void MatrixGL(const ShotType & shot,vcg::Matrix44 & m) { m = shot.GetWorldToExtrinsicsMatrix(); } /// set the OpenGL MODELVIEW matrix to match the shot (extrinsics) -static void TransformGL(vcg::Shot & shot) +static void TransformGL(const vcg::Shot & shot) { vcg::Matrix44 m; MatrixGL(shot,m); @@ -109,7 +109,7 @@ static void TransformGL(vcg::Shot & shot) } /// set the OpenGL PROJECTION and MODELVIEW matrix to match camera+shot. requires near and far plane -static void SetView(vcg::Shot & shot, ScalarType nearDist, ScalarType farDist) +static void SetView(const vcg::Shot & shot, ScalarType nearDist, ScalarType farDist) { assert(glGetError() == 0); glMatrixMode(GL_PROJECTION); @@ -170,7 +170,7 @@ static ScalarType GetFarPlane(vcg::Shot & shot, vcg::Box3 & shot, vcg::Box3 bbox, ScalarType &nr, ScalarType &fr) +static void GetNearFarPlanes(const vcg::Shot & shot, vcg::Box3 bbox, ScalarType &nr, ScalarType &fr) { vcg::Point3 zaxis = shot.Axis(2); ScalarType offset = zaxis * shot.GetViewPoint();