-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcamera.h
74 lines (56 loc) · 1.32 KB
/
camera.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef CAMERA_H
#define CAMERA_H
#include "sampler.h"
#include "vector.h"
enum CamType {ORTHO, PERSP};
///
/// class Camera
///
class Camera
{
public:
Camera(vect3d &pCtrPos, vect3d &pUpVec, vect3d &pViewVec, float fNtoF, float fPlaneRatio);
virtual ~Camera()
{
if(_pSampler)
{
delete _pSampler;
_pSampler = NULL;
}
}
// caller new
void setSampler(SamplingType eType);
void setMultiSamplingCount(unsigned nCount)
{
_nMultiSamplingCount = nCount;
}
unsigned getMultiSamplingCount(){ return _nMultiSamplingCount; }
//protected:
float _fPlaneRatio; // by length
vect3d _ctrPos; // The center point of the near view plane
vect3d _upVec;
vect3d _rightVec;
vect3d _dir; // viewing vector (normalized)
float _fN2F; // the distance from near view plane to far view plane
Sampler *_pSampler;
unsigned _nMultiSamplingCount; // sampling count per pixel
};
//
// class Orthogonal Camera
//
class OrthoCamera : public Camera
{
public:
OrthoCamera(vect3d &pCtrPos, vect3d &pUpVec, vect3d &pViewVec, float fNtoF, float fPlaneRatio);
};
//
// class Perspective Camera
//
class PerpCamera : public Camera
{
public:
PerpCamera(float fEye2Near, vect3d &pCtrPos, vect3d &pUpVec, vect3d &pViewVec, float fNtoF, float fPlaneRatio);
//private:
vect3d _eyePos; // the distance from 'eye' to the near view plane
};
#endif