wrap/gl camera and shot const correctness

This commit is contained in:
alemuntoni 2021-07-13 16:46:02 +02:00
parent cfe0511f35
commit f1530c585b
2 changed files with 19 additions and 19 deletions

View File

@ -139,13 +139,13 @@ static void SetGLIsometricProj(float x1, float x2, float y1, float y2, float z1,
} }
/// get OpenGL-like frustum from a vcg camera (intrinsics) /// get OpenGL-like frustum from a vcg camera (intrinsics)
static void GetFrustum(vcg::Camera<S> & intrinsics, S & sx,S & dx,S & bt,S & tp,S & f) static void GetFrustum(const vcg::Camera<S> & intrinsics, S & sx,S & dx,S & bt,S & tp,S & f)
{ {
intrinsics.GetFrustum(sx,dx,bt,tp,f); intrinsics.GetFrustum(sx,dx,bt,tp,f);
} }
/// set the OpenGL PROJECTION matrix to match the camera (intrinsics). requires near and far plane /// set the OpenGL PROJECTION matrix to match the camera (intrinsics). requires near and far plane
static void TransformGL(vcg::Camera<S> & camera, S nearDist, S farDist ) static void TransformGL(const vcg::Camera<S> & camera, S nearDist, S farDist )
{ {
S sx,dx,bt,tp,nr; S sx,dx,bt,tp,nr;
camera.GetFrustum(sx,dx,bt,tp,nr); camera.GetFrustum(sx,dx,bt,tp,nr);

View File

@ -95,13 +95,13 @@ struct GlShot {
typedef GlCamera<typename ShotType::CameraType> GlCameraType; typedef GlCamera<typename ShotType::CameraType> GlCameraType;
/// returns the OpenGL 4x4 MODELVIEW matrix that describes the shot position and orientation (extrinsics) /// returns the OpenGL 4x4 MODELVIEW matrix that describes the shot position and orientation (extrinsics)
static void MatrixGL(ShotType & shot,vcg::Matrix44<ScalarType> & m) static void MatrixGL(const ShotType & shot,vcg::Matrix44<ScalarType> & m)
{ {
m = shot.GetWorldToExtrinsicsMatrix(); m = shot.GetWorldToExtrinsicsMatrix();
} }
/// set the OpenGL MODELVIEW matrix to match the shot (extrinsics) /// set the OpenGL MODELVIEW matrix to match the shot (extrinsics)
static void TransformGL(vcg::Shot<ScalarType> & shot) static void TransformGL(const vcg::Shot<ScalarType> & shot)
{ {
vcg::Matrix44<ScalarType> m; vcg::Matrix44<ScalarType> m;
MatrixGL(shot,m); MatrixGL(shot,m);
@ -109,7 +109,7 @@ static void TransformGL(vcg::Shot<ScalarType> & shot)
} }
/// set the OpenGL PROJECTION and MODELVIEW matrix to match camera+shot. requires near and far plane /// set the OpenGL PROJECTION and MODELVIEW matrix to match camera+shot. requires near and far plane
static void SetView(vcg::Shot<ScalarType> & shot, ScalarType nearDist, ScalarType farDist) static void SetView(const vcg::Shot<ScalarType> & shot, ScalarType nearDist, ScalarType farDist)
{ {
assert(glGetError() == 0); assert(glGetError() == 0);
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
@ -170,7 +170,7 @@ static ScalarType GetFarPlane(vcg::Shot<ScalarType> & shot, vcg::Box3<ScalarType
/// given a shot and the mesh bounding box, return near and far plane (exact) /// given a shot and the mesh bounding box, return near and far plane (exact)
static void GetNearFarPlanes(vcg::Shot<ScalarType> & shot, vcg::Box3<ScalarType> bbox, ScalarType &nr, ScalarType &fr) static void GetNearFarPlanes(const vcg::Shot<ScalarType> & shot, vcg::Box3<ScalarType> bbox, ScalarType &nr, ScalarType &fr)
{ {
vcg::Point3<ScalarType> zaxis = shot.Axis(2); vcg::Point3<ScalarType> zaxis = shot.Axis(2);
ScalarType offset = zaxis * shot.GetViewPoint(); ScalarType offset = zaxis * shot.GetViewPoint();