proland::MousePositionHandler Class Reference
[ui]

An EventHandler that can determine the position of the mouse in world space. More...

#include <MousePositionHandler.h>

List of all members.

Public Member Functions

 MousePositionHandler (map< ptr< SceneNode >, ptr< TerrainNode > > terrains, ptr< EventHandler > next)
 Creates a new MousePositionhandler.
virtual ~MousePositionHandler ()
 Deletes this MousePositionHandler.
ptr< TerrainQuadfindTile (float x, float y, ptr< TerrainQuad > quad)
 Finds the TerrainQuad that contains the given coordinates.
void getWorldCoordinates (int x, int y)
 Determines the terrain and the terrain tile that contains the given coordinates.

Protected Member Functions

 MousePositionHandler ()
 Creates a new MousePositionHandler.
void init (map< ptr< SceneNode >, ptr< TerrainNode > > terrains, ptr< EventHandler > next)
 Initializes this MousePositionHandler.

Protected Attributes

map< ptr< SceneNode >, ptr
< TerrainNode > > 
terrains
 The list of SceneNodes contained in the scene mapped to their TerrainNodes.

Private Attributes

vec2i mousePosition
 Displayed mouse position.
int currentTerrain
 The terrain pointed by the cursor.
vec3d terrainPosition
 Local position inside the terrain pointer by the cursor.
vec3i tile
 Coordinates of the tile (level, tx, ty) pointed inside the terrain.
ptr< EventHandler > next
 The EventHandler that must handle the events.

Detailed Description

An EventHandler that can determine the position of the mouse in world space.

It can determine on which TerrainNode the cursor is, and the position inside it. This EventHandler is only for debug purpose, since it requires costly operations. (DepthBuffer read...). It then uses the ShowInfoTask to display the mouse position.

Author:
Antoine Begault

Constructor & Destructor Documentation

proland::MousePositionHandler::MousePositionHandler ( map< ptr< SceneNode >, ptr< TerrainNode > >  terrains,
ptr< EventHandler >  next 
)

Creates a new MousePositionhandler.

Parameters:
terrains the list of SceneNodes contained in the scene mapped to their TerrainNodes. These SceneNodes are used to determine the transformation matrices, and the TerrainNodes are used to determine if the point is inside the terrain.
next the EventHandler that must handle the events.
virtual proland::MousePositionHandler::~MousePositionHandler (  )  [virtual]

Deletes this MousePositionHandler.

proland::MousePositionHandler::MousePositionHandler (  )  [protected]

Creates a new MousePositionHandler.


Member Function Documentation

ptr<TerrainQuad> proland::MousePositionHandler::findTile ( float  x,
float  y,
ptr< TerrainQuad quad 
)

Finds the TerrainQuad that contains the given coordinates.

void proland::MousePositionHandler::getWorldCoordinates ( int  x,
int  y 
)

Determines the terrain and the terrain tile that contains the given coordinates.

It will set mousePosition, currentTerrain, terrainPosition, and tile.

void proland::MousePositionHandler::init ( map< ptr< SceneNode >, ptr< TerrainNode > >  terrains,
ptr< EventHandler >  next 
) [protected]

Member Data Documentation

The terrain pointed by the cursor.

If no terrain is under the cursor, it will be set to -1 and no terrain coordinates will be displayed, only mouse coordinates.

Displayed mouse position.

Retrieved when the mouse moves.

ptr<EventHandler> proland::MousePositionHandler::next [private]

The EventHandler that must handle the events.

Local position inside the terrain pointer by the cursor.

map<ptr<SceneNode>, ptr<TerrainNode> > proland::MousePositionHandler::terrains [protected]

The list of SceneNodes contained in the scene mapped to their TerrainNodes.

These SceneNodes are used to determine the transformation matrices, and the TerrainNodes are used to determine if the point is inside the terrain.

Coordinates of the tile (level, tx, ty) pointed inside the terrain.


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