#include <Camera.h>
The Camera class implements a simple viewpoint transformation, and its update using the mouse. Currently only one displacement mode is implemented, and it is not extensively tested. More...
The Camera class implements a simple viewpoint transformation, and its update using the mouse. Currently only one displacement mode is implemented, and it is not extensively tested.
Protected Attributes | |
Transform | transform |
Viewing transform: world wrt camera, i.e. inverse of the camera pose. More... | |
float | fovy |
float | ratio |
float | znear |
float | zfar |
int | tb_ancienX |
int | tb_ancienY |
int | tb_tournerXY |
int | tb_translaterXY |
int | tb_bougerZ |
Public Member Functions | |
Camera () | |
void | setlookAt (float eyeX, float eyeY, float eyeZ, float targetX, float targetY, float targetZ, float upX, float upY, float upZ) |
void | lookAt () |
Apply the viewing transform, typically just after glLoadIdentity() in the draw function. More... | |
void | viewAll (float xmin, float ymin, float zmin, float xmax, float ymax, float zmax) |
void | perspective (float fovy, float ratio, float znear, float zfar) |
void | setPerspective (float fovy, float ratio, float znear, float zfar) |
void | perspective () |
Apply the projection matrix defined in setPerspective, typically in the reshape function. More... | |
bool | handleMouseButton (int button, int state, int x, int y) |
Set the camera displacement modes and return true. More... | |
bool | handleMouseMotion (int x, int y) |
Displace the camera based on the mouse motion and return true. More... | |
Vec3 | eye () const |
Center of the camera in world coordinates. More... | |
const Transform & | getTransform () const |
Viewing matrix. More... | |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Viewing transform: world wrt camera, i.e. inverse of the camera pose.
|
protected |
|
protected |
sofa::simplegui::Camera::Camera | ( | ) |
Camera::Vec3 sofa::simplegui::Camera::eye | ( | ) | const |
Center of the camera in world coordinates.
|
inline |
Viewing matrix.
bool sofa::simplegui::Camera::handleMouseButton | ( | int | button, |
int | state, | ||
int | x, | ||
int | y | ||
) |
Set the camera displacement modes and return true.
bool sofa::simplegui::Camera::handleMouseMotion | ( | int | x, |
int | y | ||
) |
Displace the camera based on the mouse motion and return true.
void sofa::simplegui::Camera::lookAt | ( | ) |
Apply the viewing transform, typically just after glLoadIdentity() in the draw function.
void sofa::simplegui::Camera::perspective | ( | ) |
Apply the projection matrix defined in setPerspective, typically in the reshape function.
void sofa::simplegui::Camera::perspective | ( | float | fovy, |
float | ratio, | ||
float | znear, | ||
float | zfar | ||
) |
Equivalent of gluPerspective. Alternatively, the definition and the application of the projection matrix can be done separately using other functions.
void sofa::simplegui::Camera::setlookAt | ( | float | eyeX, |
float | eyeY, | ||
float | eyeZ, | ||
float | targetX, | ||
float | targetY, | ||
float | targetZ, | ||
float | upX, | ||
float | upY, | ||
float | upZ | ||
) |
Set the view point. Parameters correspond to gluLookAt. Note that this just sets the parameters. The actual viewing transform is applied in void lookAt() .
void sofa::simplegui::Camera::setPerspective | ( | float | fovy, |
float | ratio, | ||
float | znear, | ||
float | zfar | ||
) |
Set the projection matrix, without applying it. Parameters correspond to gluPerspective. Note that this just sets the parameters. The actual projection transform is applied in void perspective() .
void sofa::simplegui::Camera::viewAll | ( | float | xmin, |
float | ymin, | ||
float | zmin, | ||
float | xmax, | ||
float | ymax, | ||
float | zmax | ||
) |