proland::TerrainViewController Class Reference
[util]

A view controller for flat terrains. More...

#include <TerrainViewController.h>

Inheritance diagram for proland::TerrainViewController:
proland::CylinderViewController proland::PlanetViewController

List of all members.

Public Member Functions

 TerrainViewController (ptr< SceneNode > node, double d0)
 Creates a new TerrainViewController to control the given SceneNode.
virtual ~TerrainViewController ()
 Deletes this TerrainViewController.
ptr< SceneNode > getNode ()
 Returns the SceneNode associated with this TerrainViewController.
void setNode (ptr< SceneNode > node)
 Sets the SceneNode associated with this TerrainViewController.
float getGroundHeight ()
 Returns the terrain elevation below the camera.
void setGroundHeight (float groundHeight)
 Sets the terrain elevation below the camera.
virtual double getHeight ()
 Returns the height of the camera above the z=0 surface.
virtual void move (vec3d &oldp, vec3d &p)
 Moves the "look at" point so that "oldp" appears at the position of "p" on screen.
virtual double interpolate (double sx0, double sy0, double stheta, double sphi, double sd, double dx0, double dy0, double dtheta, double dphi, double dd, double t)
 Sets the position as the interpolation of the two given positions with the interpolation parameter t (between 0 and 1).
void interpolateDirection (double slon, double slat, double elon, double elat, double t, double &lon, double &lat)
 Returns a direction interpolated between the two given direction.
virtual void update ()
 Sets the localToParent transform of the SceneNode associated with this TerrainViewController.
virtual void setProjection (float znear=0.0f, float zfar=0.0f, vec4f viewport=vec4f(-1.0f, 1.0f,-1.0f, 1.0f))
 Sets the camera to screen perspective projection.

Public Attributes

double fov
 The field of view angle.
double x0
 The x coordinate of the point the camera is looking at on the ground.
double y0
 The y coordinate of the point the camera is looking at on the ground.
double theta
 The zenith angle of the vector between the "look at" point and the camera.
double phi
 The azimuth angle of the vector between the "look at" point and the camera.
double d
 The distance between the "look at" point and the camera.
double zoom
 Zoom factor (realized by increasing d and decreasing fov).
vec3d position
 The camera position in world space resulting from the x0,y0,theta,phi, and d parameters.

Protected Attributes

ptr< SceneNode > node
 The SceneNode associated with this TerrainViewController.
float groundHeight
 The terrain elevation below the camera.

Detailed Description

A view controller for flat terrains.

The camera position is specified from a "look at" position (x0,y0) on ground, with a distance d between camera and this position, and two angles (theta,phi) for the direction of this vector. The update method sets the localToParent transformation of the SceneNode associated with this controller, which is intended to represent the camera position and orientation in the scene.

Authors:
Eric Bruneton, Antoine Begault, Guillaume Piolat

Constructor & Destructor Documentation

proland::TerrainViewController::TerrainViewController ( ptr< SceneNode >  node,
double  d0 
)

Creates a new TerrainViewController to control the given SceneNode.

Parameters:
node a SceneNode representing a camera position and orientation in the scene.
d0 the initial valued of the d distance.
virtual proland::TerrainViewController::~TerrainViewController (  )  [virtual]

Deletes this TerrainViewController.


Member Function Documentation

float proland::TerrainViewController::getGroundHeight (  ) 

Returns the terrain elevation below the camera.

virtual double proland::TerrainViewController::getHeight (  )  [virtual]

Returns the height of the camera above the z=0 surface.

Reimplemented in proland::CylinderViewController, and proland::PlanetViewController.

ptr<SceneNode> proland::TerrainViewController::getNode (  ) 

Returns the SceneNode associated with this TerrainViewController.

This SceneNode represents a camera position and orientation in the scene.

virtual double proland::TerrainViewController::interpolate ( double  sx0,
double  sy0,
double  stheta,
double  sphi,
double  sd,
double  dx0,
double  dy0,
double  dtheta,
double  dphi,
double  dd,
double  t 
) [virtual]

Sets the position as the interpolation of the two given positions with the interpolation parameter t (between 0 and 1).

The source position is sx0,sy0,stheta,sphi,sd, the destination is dx0,dy0,dtheta,dphi,dd.

Returns:
the new value of the interpolation parameter t.

Reimplemented in proland::PlanetViewController.

void proland::TerrainViewController::interpolateDirection ( double  slon,
double  slat,
double  elon,
double  elat,
double  t,
double &  lon,
double &  lat 
)

Returns a direction interpolated between the two given direction.

Parameters:
slon start longitude.
slat start latitude.
elon end longitude.
elat end latitude.
t interpolation parameter between 0 and 1.
[out] lon interpolated longitude.
[out] lat interpolated latitude.
virtual void proland::TerrainViewController::move ( vec3d &  oldp,
vec3d &  p 
) [virtual]

Moves the "look at" point so that "oldp" appears at the position of "p" on screen.

Parameters:
oldp a terrain point.
p another terrain point.

Reimplemented in proland::CylinderViewController, and proland::PlanetViewController.

void proland::TerrainViewController::setGroundHeight ( float  groundHeight  ) 

Sets the terrain elevation below the camera.

This elevation is used to adjust the camera position so that it is not below the ground.

Parameters:
groundHeight the terrain elevation below the camera.
void proland::TerrainViewController::setNode ( ptr< SceneNode >  node  ) 

Sets the SceneNode associated with this TerrainViewController.

Parameters:
node a SceneNode representing a camera position and orientation in the scene.
virtual void proland::TerrainViewController::setProjection ( float  znear = 0.0f,
float  zfar = 0.0f,
vec4f  viewport = vec4f(-1.0f, 1.0f,-1.0f, 1.0f) 
) [virtual]

Sets the camera to screen perspective projection.

Parameters:
znear an optional znear plane (0.0 means that a default value must be used).
zfar an optional zfar plane (0.0 means that a default value must be used).
viewport an optional viewport to select a part of the image. The default value [-1:1]x[-1:1] selects the whole image.
virtual void proland::TerrainViewController::update (  )  [virtual]

Sets the localToParent transform of the SceneNode associated with this TerrainViewController.

The transform is computed from the view parameters x0,y0,theta,phi and d.

Reimplemented in proland::CylinderViewController, and proland::PlanetViewController.


Member Data Documentation

The distance between the "look at" point and the camera.

The field of view angle.

The terrain elevation below the camera.

ptr<SceneNode> proland::TerrainViewController::node [protected]

The SceneNode associated with this TerrainViewController.

The azimuth angle of the vector between the "look at" point and the camera.

The camera position in world space resulting from the x0,y0,theta,phi, and d parameters.

The zenith angle of the vector between the "look at" point and the camera.

The x coordinate of the point the camera is looking at on the ground.

The y coordinate of the point the camera is looking at on the ground.

Zoom factor (realized by increasing d and decreasing fov).


Generated on Sat May 12 09:41:40 2012 for proland by  doxygen 1.6.1