Moved the ORTHO, PERSPECTIVE enums from the vcg namespace to the camera class namespace.
This commit is contained in:
parent
a8a2e61f58
commit
343493ef11
|
@ -136,19 +136,18 @@ creation
|
||||||
|
|
||||||
namespace vcg{
|
namespace vcg{
|
||||||
|
|
||||||
enum {
|
|
||||||
PERSPECTIVE = 0,
|
|
||||||
ORTHO = 1,
|
|
||||||
ISOMETRIC = 2,
|
|
||||||
CAVALIERI = 3
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
template<class S>
|
template<class S>
|
||||||
class Camera
|
class Camera
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef S ScalarType;
|
typedef S ScalarType;
|
||||||
|
enum {
|
||||||
|
PERSPECTIVE = 0,
|
||||||
|
ORTHO = 1,
|
||||||
|
ISOMETRIC = 2,
|
||||||
|
CAVALIERI = 3
|
||||||
|
};
|
||||||
|
|
||||||
Camera():
|
Camera():
|
||||||
FocalMm(0.f),
|
FocalMm(0.f),
|
||||||
|
|
|
@ -150,7 +150,7 @@ static void TransformGL(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);
|
||||||
|
|
||||||
if(camera.cameraType == vcg::PERSPECTIVE) {
|
if(camera.cameraType == CameraType::PERSPECTIVE) {
|
||||||
S ratio = nearDist/nr;
|
S ratio = nearDist/nr;
|
||||||
sx *= ratio;
|
sx *= ratio;
|
||||||
dx *= ratio;
|
dx *= ratio;
|
||||||
|
@ -162,10 +162,10 @@ static void TransformGL(vcg::Camera<S> & camera, S nearDist, S farDist )
|
||||||
|
|
||||||
switch(camera.cameraType)
|
switch(camera.cameraType)
|
||||||
{
|
{
|
||||||
case vcg::PERSPECTIVE: glFrustum(sx,dx,bt,tp,nearDist,farDist); break;
|
case CameraType::PERSPECTIVE: glFrustum(sx,dx,bt,tp,nearDist,farDist); break;
|
||||||
case vcg::ORTHO: glOrtho(sx,dx,bt,tp,nearDist,farDist); break;
|
case CameraType::ORTHO: glOrtho(sx,dx,bt,tp,nearDist,farDist); break;
|
||||||
case vcg::ISOMETRIC: SetGLIsometricProj(sx,dx,bt,tp,nearDist,farDist); break;
|
case CameraType::ISOMETRIC: SetGLIsometricProj(sx,dx,bt,tp,nearDist,farDist); break;
|
||||||
case vcg::CAVALIERI: SetGLCavalieriProj(sx,dx,bt,tp,nearDist,farDist); break;
|
case CameraType::CAVALIERI: SetGLCavalieriProj(sx,dx,bt,tp,nearDist,farDist); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(glGetError()==0);
|
assert(glGetError()==0);
|
||||||
|
@ -195,8 +195,8 @@ static void SetSubView(vcg::Camera<S> & camera,vcg::Point2<S> p0,S nearDist, S f
|
||||||
|
|
||||||
switch(camera.cameraType)
|
switch(camera.cameraType)
|
||||||
{
|
{
|
||||||
case vcg::PERSPECTIVE: glFrustum( width* p0[0]+ sx, width* p1[0]+ sx, height* p0[1]+ bt, height* p1[1]+bt,nearDist,farDist); break;
|
case CameraType::PERSPECTIVE: glFrustum( width* p0[0]+ sx, width* p1[0]+ sx, height* p0[1]+ bt, height* p1[1]+bt,nearDist,farDist); break;
|
||||||
case vcg::ORTHO: glOrtho(width* p0[0]+sx, width* p1[0]+sx, height* p0[1]+ bt, height* p1[1]+bt,nearDist,farDist); break;
|
case CameraType::ORTHO: glOrtho(width* p0[0]+sx, width* p1[0]+sx, height* p0[1]+ bt, height* p1[1]+bt,nearDist,farDist); break;
|
||||||
//case vcg::ISOMETRIC: IsometricProj(dx-width* p1[0], dx-width* p0[0], tp-height* p1[1], tp-height* p0[1],nearDist,farDist); break;
|
//case vcg::ISOMETRIC: IsometricProj(dx-width* p1[0], dx-width* p0[0], tp-height* p1[1], tp-height* p0[1],nearDist,farDist); break;
|
||||||
//case vcg::CAVALIERI: CavalieriProj(dx-width* p1[0], dx-width* p0[0], tp-height* p1[1], tp-height* p0[1],nearDist,farDist); break;
|
//case vcg::CAVALIERI: CavalieriProj(dx-width* p1[0], dx-width* p0[0], tp-height* p1[1], tp-height* p0[1],nearDist,farDist); break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue