|
ContRap-Libraries
|
Class GLCamera represents a camera with it's coordinates, direction, and internal and external characteristics. More...
#include <glcamera.h>
Public Member Functions | |
| GLCamera (double fov=45.0, double ratio=1.3, double w=640.0, double h=480.0) | |
| Constructs a new camera object with the given field of view and a ratio between the width and height of the square plane the picture is projected onto. | |
| GLCamera (const GLCamera &camera) | |
| Copy constructor of the camera. | |
| void | set_FOV (double nfov, double nratio, int w, int h) |
| Sets the given field of view and a ratio between the width and height of the square plane the picture is projected onto. | |
| void | set_projection (double alpha, double beta, double xc, double yc, int w, int h) |
| Sets the camera parameters from a pinhole camera model. | |
| void | move (double x, double y, double z) |
| Moves the camera to a new point. | |
| void | look_at (double x, double y, double z) |
| Makes the camera looking at a given point in the coordinate system. | |
| void | look_at_up (double x, double y, double z, double ux, double uy, double uz) |
| Makes the camera looking at a given point in the coordinate system with orinetation given by a up-vector. | |
| void | set_up (const GLVertex &up) |
| Sets the up vector of the camera. | |
| void | rotate (double yaw, double pitch, double roll) |
| Rotates the camera to the given direction. | |
| void | backproject_point (double x, double y, double &dx, double &dy, double &dz) |
| Computes the ray direction through an image point. | |
| void | configure () |
| Performs the camera immanent modifications for configuration of a camera, e.g. | |
| void | project () |
| Performs the camera immanent modifications of the projection matrix. | |
| void | set_smoothing (bool on) |
| Sets smoothing while changing the moving point. | |
| void | render_depth (float *array) |
| Renders a depth image of the lastly drawn scene into an array. | |
| void | render_RGBA (char *array) |
| Renders the RGBA image into an array. | |
| bool | is_target_reached () |
| Returns true if the target position has been reached. | |
| GLMatrix4x4 & | get_modelview_matrix () |
| Retruns the currently applied modelview matrix. | |
| void | set_modelview_matrix (const GLMatrix4x4 &matrix) |
| Sets a new target matrix. | |
| int | get_width () |
| Returns the width of the currently configured camera image. | |
| int | get_height () |
| Returns the width of the currently configured camera image. | |
Class GLCamera represents a camera with it's coordinates, direction, and internal and external characteristics.
| crp::GLCamera::GLCamera | ( | double | fov = 45.0, |
| double | ratio = 1.3, |
||
| double | w = 640.0, |
||
| double | h = 480.0 |
||
| ) |
Constructs a new camera object with the given field of view and a ratio between the width and height of the square plane the picture is projected onto.
| fov | is the field of view. |
| ratio | is the screen width/height ratio. |
| w | Width of the image in pixels |
| h | Height of the image in pixels |
| crp::GLCamera::GLCamera | ( | const GLCamera & | camera | ) |
Copy constructor of the camera.
This constructor does not copy rgba maps or range maps.
| camera | Camera to copy from |
| void crp::GLCamera::backproject_point | ( | double | x, |
| double | y, | ||
| double & | dx, | ||
| double & | dy, | ||
| double & | dz | ||
| ) |
Computes the ray direction through an image point.
| x | X-Coordinate of the image point |
| y | Y-Coordinate of the image point |
| dx | X-Coordinate of the ray direction |
| dy | Y-Coordinate of the ray direction |
| dz | Z-Coordinate of the ray direction |
| void crp::GLCamera::configure | ( | ) |
Performs the camera immanent modifications for configuration of a camera, e.g.
as viewport setting
| int crp::GLCamera::get_height | ( | ) | [inline] |
Returns the width of the currently configured camera image.
| GLMatrix4x4& crp::GLCamera::get_modelview_matrix | ( | ) |
Retruns the currently applied modelview matrix.
| int crp::GLCamera::get_width | ( | ) | [inline] |
Returns the width of the currently configured camera image.
| bool crp::GLCamera::is_target_reached | ( | ) |
Returns true if the target position has been reached.
| void crp::GLCamera::look_at | ( | double | x, |
| double | y, | ||
| double | z | ||
| ) |
Makes the camera looking at a given point in the coordinate system.
| x | X-coordinate of the new looking direction |
| y | Y-coordinate of the new looking direction |
| z | Z-coordinate of the new looking direction |
| void crp::GLCamera::look_at_up | ( | double | x, |
| double | y, | ||
| double | z, | ||
| double | ux, | ||
| double | uy, | ||
| double | uz | ||
| ) |
Makes the camera looking at a given point in the coordinate system with orinetation given by a up-vector.
| x | X-coordinate of the new looking direction |
| y | Y-coordinate of the new looking direction |
| z | Z-coordinate of the new looking direction |
| ux | X-coordinate of the new up-dircetion |
| uy | Y-coordinate of the new up-direction |
| uz | Z-coordinate of the new up-direction |
| void crp::GLCamera::move | ( | double | x, |
| double | y, | ||
| double | z | ||
| ) |
Moves the camera to a new point.
| x | X-coordinate of the new position |
| y | Y-coordinate of the new position |
| z | Z-coordinate of the new position |
| void crp::GLCamera::project | ( | ) |
Performs the camera immanent modifications of the projection matrix.
| void crp::GLCamera::render_depth | ( | float * | array | ) |
| void crp::GLCamera::render_RGBA | ( | char * | array | ) |
Renders the RGBA image into an array.
| array | Array to render the data (must be sufficiently large, at least width*height*4) |
| void crp::GLCamera::rotate | ( | double | yaw, |
| double | pitch, | ||
| double | roll | ||
| ) |
Rotates the camera to the given direction.
| yaw | Yaw of the new rotation |
| pitch | Pitch of the new rotation |
| roll | Roll of the new rotation |
| void crp::GLCamera::set_FOV | ( | double | nfov, |
| double | nratio, | ||
| int | w, | ||
| int | h | ||
| ) |
Sets the given field of view and a ratio between the width and height of the square plane the picture is projected onto.
| nfov | is the new field of view. |
| nratio | is the new screen width/height ratio. |
| w | Width of the image in pixels |
| h | Height of the image in pixels |
| void crp::GLCamera::set_modelview_matrix | ( | const GLMatrix4x4 & | matrix | ) |
Sets a new target matrix.
| matrix | New model view matrix |
| void crp::GLCamera::set_projection | ( | double | alpha, |
| double | beta, | ||
| double | xc, | ||
| double | yc, | ||
| int | w, | ||
| int | h | ||
| ) |
Sets the camera parameters from a pinhole camera model.
| alpha | Focal length divided by the pixel width |
| beta | Focal length divided by the pixel height |
| xc | X-Coordinate of the image center |
| yc | Y-Coordinate of the image center |
| w | Width of the image in pixels |
| h | Height of the image in pixels |
| void crp::GLCamera::set_smoothing | ( | bool | on | ) |
Sets smoothing while changing the moving point.
That means that each time move or lookAt or rotate is called the camera data is changed slightly.
| on | is the turn flag |
| void crp::GLCamera::set_up | ( | const GLVertex & | up | ) |
Sets the up vector of the camera.
| direction | New up direction. |
1.7.3