Main Page Namespace List Class Hierarchy Compound List File List Namespace Members Compound Members
WPCG::WP_Camera Class Reference
#include <WP_Camera.h>
List of all members.
Public Methods |
| ~WP_Camera () |
void | slide (scalar deltaU, scalar deltaV, scalar deltaN) |
void | rotate (scalar angleU, scalar angleV, scalar angleN) |
void | pitch (scalar angle) |
void | roll (scalar angle) |
void | yaw (scalar angle) |
void | followObject () |
void | setFrustumAndCamera (scalar _viewAngle, unsigned int width, unsigned int height, scalar _nearPlane, scalar _farPlane, const WP_Point3D &_eye, const WP_Point3D &_look, const WP_Vector3D &_up) |
void | setPickingVolume (int width, int height, int x, int y) |
void | setRenderVolume () |
WP_Ray3D | createRayForTracing (int x, int y) const |
Plane * | getFrustum () |
Static Public Methods |
WP_Camera * | getInstance () |
Public Attributes |
WP_Point3D | eye |
WP_Point3D | look |
WP_Vector3D | up |
WP_Matrix3D | matrix |
const WP_Object * | fixed_object |
scalar | follow_distance |
int | follow_angleX |
int | follow_angleY |
int | follow_angleZ |
int | objects_in_frustum |
unsigned int | screen_width |
unsigned int | screen_height |
bool | normal_viewing_volume |
Detailed Description
this singleton class represents a camera used for viewing a 3D scene. The camera has its own coordinate system and three vectors represent the axis of this coordinate system. u = x-axis, v = y-axis and n = z-axis. The camera is looking along the negative n-axis. See F.S. Hill, JR, Computer Graphics using OpenGL, second edition, chapter 7
-
Author:
-
Copyright (C) 2001 W.P. van Paassen peter@paassen.tmfweb.nl
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Constructor & Destructor Documentation
WPCG::WP_Camera::~WP_Camera |
( |
|
) |
[inline] |
|
Member Function Documentation
WP_Ray3D WPCG::WP_Camera::createRayForTracing |
( |
int |
x, |
|
|
int |
y |
|
) |
const [inline] |
|
|
this function creates a WP_Ray3D object which represents a 3D ray starting at the eye of the camera's and passing through pixel x y on the nearplane N. See F.S. Hill, Computer Graphics using OpenGL, page 743/735 -
Parameters:
-
x |
the x position of the pixel on the nearplane through which the ray passes |
y |
the y position of the pixel on the nearplane through which the ray passes |
-
Returns:
-
a WP_Ray3D object representing the ray which starts at the eye of the camera and passes through pixels x y on the nearplane N
|
void WPCG::WP_Camera::followObject |
( |
|
) |
|
|
|
this function moves the camera to follow the attached fixed_object. It keeps a certain distance from the object defined by looking_distanceX, looking_distanceY and looking_distanceZ |
Plane* WPCG::WP_Camera::getFrustum |
( |
|
) |
[inline] |
|
WP_Camera* WPCG::WP_Camera::getInstance |
( |
|
) |
[inline, static] |
|
|
this function is used to obtain a pointer to the only instance of this class (singleton) -
Returns:
-
a pointer to the only instance of this class
|
void WPCG::WP_Camera::pitch |
( |
scalar |
angle |
) |
[inline] |
|
|
this function pitches the camera. Pitch is an aviation term and the pitch of an airplane is the angle that its longitudinal axis (running from tail to nose and having direction -n makes with the horizontal plane -
Parameters:
-
|
void WPCG::WP_Camera::roll |
( |
scalar |
angle |
) |
[inline] |
|
|
this function rolls the camera. Roll is an aviation term and an airplane rolls by rotating about its longitudinal axis (n. The roll is the amount of rotation relative to the horizontal plane. -
Parameters:
-
|
|
this function rotates the camera first around u, then around v and finally around n -
Parameters:
-
angleU |
the angle in degrees of rotation around u |
angleV |
the angle in degrees of rotation around v |
angleN |
the angle in degrees of rotation around n |
|
|
this function sets the view volume and the camera in OpenGL. See F.S. Hill,JR Computer Graphics using OpenGL, page 360 -
Parameters:
-
v |
the viewangle in degrees, this sets the angle between the top and bottom walls of the view volume (frustum) |
width |
the screen width |
height |
the screen height |
n |
the near plane, this sets the distance from the eye to the near plane |
f |
the far plane, this sets the distance from the eye to the far plane |
_eye |
a WP_point3D object representing the eye and therefore the position of the camera |
_look |
a WP_Point3D object representing the point at which the camera is looking |
_up |
a WP_Vector3D object representing the upward direction of the camera |
|
void WPCG::WP_Camera::setPickingVolume |
( |
int |
width, |
|
|
int |
height, |
|
|
int |
x, |
|
|
int |
y |
|
) |
|
|
|
this function sets a viewing volume with the according perspective projection which is used for object picking. See OpenGL's red book about object picking -
Parameters:
-
width |
the width of the view volume in pixels |
height |
the height of the view volume in pixels |
x |
the x position of the picking device (e.g. mouse) |
y |
the y position of the picking device. Note that this y position is in normal window coordinates, so y = 0 is in the top area of the application window |
|
void WPCG::WP_Camera::setRenderVolume |
( |
|
) |
[inline] |
|
|
this function sets the framebuffer render volume but it only has to be called when object picking is needed and you want to switch back from the selection buffer viewing volume to the normal framebuffer rendering view volume. This call has therefor only effect when currently the picking view volume is defined. |
|
this function is used for moving the camera along one of its own axes in the u, v or n direction. Movement along n is forward or backward. Movement along u is left or right. Movement along v is up or down -
Parameters:
-
deltaU |
the amount of movement along u |
deltaV |
the amount of movement along v |
deltaN |
the amount of movement along n |
|
void WPCG::WP_Camera::yaw |
( |
scalar |
angle |
) |
[inline] |
|
|
this function yaws the camera. Yaw is an aviation term and it means changing the heading of the plane by rotating about v -
Parameters:
-
|
Member Data Documentation
|
a WP_Point3D object representing the eye (position) of the camera |
const WP_Object* WPCG::WP_Camera::fixed_object
|
|
|
a pointer to a WP_Object, if this object points to WP_Object, the camera is attached to this object and will follow it |
int WPCG::WP_Camera::follow_angleX
|
|
|
if the camera is attached to an object, this represents the rotation in degrees about the object's x-axis |
int WPCG::WP_Camera::follow_angleY
|
|
|
if the camera is attached to an object, this represents the rotation in degrees about the object's y-axis |
int WPCG::WP_Camera::follow_angleZ
|
|
|
if the camera is attached to an object, this represents the rotation in degrees about the object's z-axis |
scalar WPCG::WP_Camera::follow_distance
|
|
|
if the camera is attached to an object, this represents the distance the camera keeps between itself and the object |
|
a WP_Point3D object representing the point at which the camera is looking |
|
a WP_Matrix3D object representing the camera's camera matrix which will be loaded to OpenGL to transform objects from world space to camera space |
bool WPCG::WP_Camera::normal_viewing_volume
|
|
|
this boolean is used for telling if the current viewing volume is defined for selection or framebuffer rendering |
int WPCG::WP_Camera::objects_in_frustum
|
|
|
this variable keeps track of the object meshes currently in the camera's viewing volume (frustum) |
unsigned int WPCG::WP_Camera::screen_height
|
|
|
this variable describes the screen height and thus the height of the viewport |
unsigned int WPCG::WP_Camera::screen_width
|
|
|
this variable describes the screen width and thus the width of the viewport |
|
a WP_Vector3D object representing the upward direction of the camera |
The documentation for this class was generated from the following files:
Generated on Tue Jan 28 20:26:38 2003 by
1.2.14 written by Dimitri van Heesch,
© 1997-2002