Go to the documentation of this file.
17 : perspective_(false),
18 left_(-1), right_(1), bottom_(-1), top_(1), front_(-1), back_(1),
19 fovy_(0), aspect_(0), nearp_(0), farp_(0),
20 eye_(
vec3(0,0,0)), lookat_(
vec3(0,0,-1)), up_(
vec3(0,1,0)), alt_up_(
vec3(0,0,-1)),
21 base_(0), lefteye_(true),
29 void setOrthographic(
double left,
double right,
double bottom,
double top,
double front,
double back)
82 double lambda = dir.
dot(up_);
84 if (fabs(lambda) < 1-0.001)
92 if (left) right = -right;
93 if (!lefteye_) right = -right;
95 return(eye_+0.5*base_*right);
102 if (left) right = -right;
103 if (!lefteye_) right = -right;
105 vec4 eye = eye_+0.5*base_*right;
110 eye = (M*V).invert() * V * eye;
150 double wy = tan(fovy_*PI/360);
151 double wx = aspect_*wy;
153 vec3 dir =
vec3(2.0*wx*mx, 2.0*wy*my, -1);
158 return(
vec3(0,0,-1));
169 double wy = tan(fovy_*PI/360);
170 double wx = aspect_*wy;
242 return(
mat4::ortho(left_, right_, bottom_, top_, front_, back_));
281 lglOrtho(left_, right_, bottom_, top_, front_, back_);
318 double left_, right_, bottom_, top_, front_, back_;
319 double fovy_, aspect_, nearp_, farp_;
320 vec3 eye_, lookat_, up_, alt_up_;
vec3 getEye(bool left=true) const
get eye point
Definition: glvertex_cam.h:89
void setAspect(double aspect)
set camera aspect
Definition: glvertex_cam.h:59
vec3 getRight() const
get right vector
Definition: glvertex_cam.h:128
bool isLeftEye() const
is left eye?
Definition: glvertex_cam.h:225
lgl_Cam()
ctor
Definition: glvertex_cam.h:16
void reset()
reset cam manipulator
Definition: glvertex_cam.h:309
void end() const
pop viewing and projection matrix
Definition: glvertex_cam.h:288
void lglResetManip()
reset the manipulator matrix
Definition: glvertex_api.h:320
void halt(bool yes=true)
halt cam
Definition: glvertex_cam.h:297
void lglOrtho(double left, double right, double bottom, double top, double nearp=-1, double farp=1)
multiply with orthgraphic matrix (as defined by OpenGL 1.2)
Definition: glvertex_api.h:110
mat4 lglGetManip()
get the manipulator matrix
Definition: glvertex_api.h:324
static mat4 perspective(double fovy, double aspect, double znear, double zfar)
create perspective matrix
Definition: glslmath.h:2712
vec3 unprojectViewport(double x, double y)
unproject viewport coordinate into view coordinate direction
Definition: glvertex_cam.h:143
double dot(const vec3 &v) const
inner product
Definition: glslmath.h:429
bool isRightEye() const
is right eye?
Definition: glvertex_cam.h:231
vec3 normalize() const
normalize vector to unit length
Definition: glslmath.h:528
void useRightEye(bool right=true)
use right eye for stereo rendering
Definition: glvertex_cam.h:219
4D double vector
Definition: glslmath.h:713
vec3 unprojectViewportToWorld(double x, double y)
unproject viewport coordinate into world coordinate direction
Definition: glvertex_cam.h:162
mat4 getProjectionMatrix() const
get projection matrix
Definition: glvertex_cam.h:237
void lglPopMatrix()
pop matrix (as defined by OpenGL 1.2)
Definition: glvertex_api.h:78
void lglLoadIdentity()
load identity matrix (as defined by OpenGL 1.2)
Definition: glvertex_api.h:62
void lglLookAt(const vec3 &eye, const vec3 &at, const vec3 &up=vec3(0, 1, 0))
multiply with lookat matrix (as defined by OpenGL 1.2)
Definition: glvertex_api.h:122
void setOrthographic(double left, double right, double bottom, double top, double front, double back)
set camera type to orthographic
Definition: glvertex_cam.h:29
vec3 getUp() const
get up vector
Definition: glvertex_cam.h:134
mat4 getViewMatrix(bool left=true) const
get viewing matrix
Definition: glvertex_cam.h:246
mat4 getViewProjectionMatrix(bool left=true) const
get combined viewing and projection matrix
Definition: glvertex_cam.h:264
void setEye(vec3 eye, vec3 lookat, vec3 up)
set eye and lookat point and up vector
Definition: glvertex_cam.h:65
3D double vector
Definition: glslmath.h:372
void setPerspective(double fovy, double aspect, double nearp, double farp)
set camera type to perspective
Definition: glvertex_cam.h:42
4x4 double matrix
Definition: glslmath.h:2116
void setStereoBase(double base)
set stereo base
Definition: glvertex_cam.h:195
bool isVisible(const vec3 ¢er, double radius)
bounding sphere visibility test
Definition: glvertex_cam.h:183
bool isStereoCam() const
is stereo cam?
Definition: glvertex_cam.h:207
void lglMatrixMode(lgl_matrixmode_enum mode=LGL_MODELVIEW)
specify matrix mode (as defined by OpenGL 1.2)
Definition: glvertex_api.h:58
void begin(bool left=true) const
push viewing and projection matrix
Definition: glvertex_cam.h:273
vec3 getDirection() const
get viewing direction
Definition: glvertex_cam.h:122
void resume(bool yes=true)
resume cam
Definition: glvertex_cam.h:303
mat4 getInverseViewMatrix(bool left=true) const
get inverse viewing matrix
Definition: glvertex_cam.h:252
void lglPerspective(double fovy, double aspect, double nearp, double farp)
multiply with perspective matrix (as defined by OpenGL 1.2)
Definition: glvertex_api.h:118
double dot(const vec2 &a, const vec2 &b)
inner product
Definition: glslmath.h:241
void useLeftEye(bool left=true)
use left eye for stereo rendering
Definition: glvertex_cam.h:213
camera convenience class
Definition: glvertex_cam.h:11
vec3 cross(const vec3 &a, const vec3 &b)
cross product
Definition: glslmath.h:544
vec3 getEyeManip(bool left=true) const
get manipulated eye point
Definition: glvertex_cam.h:99
double getStereoBase() const
get stereo base
Definition: glvertex_cam.h:201
vec2 normalize(const vec2 &v)
normalization to unit length
Definition: glslmath.h:237
mat4 transpose(const mat4 &m)
inline transpose
Definition: glslmath.h:2627
void setPerspective(double fovy, double nearp, double farp)
set camera type to perspective
Definition: glvertex_cam.h:53
void lglPushMatrix()
push matrix (as defined by OpenGL 1.2)
Definition: glvertex_api.h:74
vec3 getLookAt() const
get lookat point
Definition: glvertex_cam.h:116
static mat4 lookat(const vec3 &eye, const vec3 ¢er, const vec3 &up=vec3(0, 1, 0))
create lookat matrix
Definition: glslmath.h:2731
bool isVisible(const vec3 ¢er, const vec3 &extent)
bounding box visibility test
Definition: glvertex_cam.h:189
mat4 getInverseTransposeViewMatrix(bool left=true) const
get inverse transpose viewing matrix
Definition: glvertex_cam.h:258
void setEye(vec3 eye, vec3 lookat)
set eye and lookat point
Definition: glvertex_cam.h:74
static mat4 ortho(double l, double r, double b, double t, double n=-1, double f=1)
create orthographic matrix
Definition: glslmath.h:2677