NL3D::CEvent3dMouseListener Class Reference

CEvent3dMouseListener is a listener that handle a 3d matrix with mouse events. More...

#include <event_mouse_listener.h>

Inherits NLMISC::IEventListener, and NL3D::U3dMouseListener.

List of all members.

Public Member Functions

 CEvent3dMouseListener ()
 Mouse mode.
virtual ~CEvent3dMouseListener ()

Setup



enum  TAxis { xAxis = 0, yAxis = 1, zAxis = 2 }
void setMatrix (const NLMISC::CMatrix &matrix)
 Set both the current view matrix to use.
void setModelMatrix (const NLMISC::CMatrix &matrix)
 Set the model matrix only.
void setFrustrum (const CFrustum &frustrum)
 Set the current frustrum to use.
void setViewport (const NL3D::CViewport &viewport)
 Set the viewport in use in the window.
void setHotSpot (const CVector &hotSpot)
 Set the current hot spot.
void setMouseMode (TMouseMode mouseMode)
 Set the mouse mode.
void enableModelMatrixEdition (bool enable=true)
 enable / disable model matrix edition mode. (the default deals with the with matrix)
void setModelMatrixRotationAxis (TAxis axis)
 set the current axe of rotation for the model matrix
TAxis getModelMatrixRotationAxis (void) const
 get the current axe of rotation for the model matrix
void enableModelTranslationAxis (TAxis axis, bool enabled)
 enable / disable an axe for translation (model matrix)
bool isModelTranslationEnabled (TAxis axis)
 check whether translation on the given axis is permitted
void setModelMatrixTransformMove (const NLMISC::CMatrix &transModelMove)
 Each move of the modelMatrix is first transformed by this matrix before applying.
void getModelMatrixTransformMove (NLMISC::CMatrix &transModelMove) const
 see setModelMatrixTransformMove
void enableTranslateXYInWorld (bool enabled)
 if true, XY translation is made in XY World plane (instead of XY view plane).
bool isTranslateXYInWorldEnabled () const
void setSpeed (float speed)
 Set the speed for first person mode.

Get



TAxis _CurrentModelRotationAxis
bool _XModelTranslateEnabled
bool _YModelTranslateEnabled
bool _ZModelTranslateEnabled
CMatrix _Matrix
CMatrix _ModelMatrix
bool _EnableModelMatrixEdition
CFrustum _Frustrum
CVector _HotSpot
NL3D::CViewport _Viewport
bool _LeftPushed
bool _MiddlePushed
bool _RightPushed
float _X
float _Y
float _Speed
uint64 _LastTime
TMouseMode _MouseMode
bool _TranslateXYInWorld
NLMISC::CEventListenerAsync _AsyncListener
CMatrix _ModelMatrixTransformMove
const NLMISC::CMatrixgetViewMatrix ()
 Get the current view matrix.
const NLMISC::CMatrixgetModelMatrix ()
 Get the current model matrix.
CVector getHotSpot () const
 Get the current hot spot.
void addToServer (NLMISC::CEventServer &server)
 Register the listener to the server.
void removeFromServer (NLMISC::CEventServer &server)
 Unregister the listener to the server.
virtual void operator() (const NLMISC::CEvent &event)
 Internal use.
void truncateVect (CVector &v)
 remove composant of translations that are not permitted
virtual NLMISC::IEventListenergetEventListenerInterface ()

Detailed Description

CEvent3dMouseListener is a listener that handle a 3d matrix with mouse events.

This can be the view matrix, or the matrix of any object.

Author:
Cyril Corvazier
Nevrax France
Date:
2000

Definition at line 50 of file event_mouse_listener.h.


Member Enumeration Documentation

Enumerator:
xAxis 
yAxis 
zAxis 

Definition at line 155 of file event_mouse_listener.h.


Constructor & Destructor Documentation

NL3D::CEvent3dMouseListener::CEvent3dMouseListener (  ) 

Mouse mode.

There is two move modes: 3d editor style and NeL style. Default mode is NeL style.

(nelStyle) NeL style is: MouseRotateHotSpot: CTRL + RIGHTMOUSE MouseTranslateXYHotSpot: CTRL + LEFTMOUSE MouseTranslateZHotSpot: CTRL + SHIFT + LEFTMOUSE MouseZoomHotSpot: ALT + LEFTMOUSE

(edit3dStyle) 3d editor style is: MouseRotateHotSpot: ALT + MIDDLEMOUSE MouseTranslateXYHotSpot: MIDDLEMOUSE MouseTranslateZHotSpot: CTRL + MIDDLEMOUSE

(firstPerson) First person shooter style is: MouseRotateView: MOUSE MOVE KeyUp: MOVE FORWARD KeyDown: MOVE BACKWARD Left: STRAF LEFT Right: STRAF RIGHT PageUp: MOVE UP PageDown: MOVE DOWN Constructor. You should call setMatrix, setFrustrum, setViewport, setHotStop and setMouseMode to initialize the whole object. By default, the viewmatrix is identity, the frustrum is (-1,1,-1,1,1,-1), the hot spot is (0,0,0) and the viewport is fullscreen. The mouse mode is set to the NelStyle.

Definition at line 38 of file event_mouse_listener.cpp.

References _EnableModelMatrixEdition, _Frustrum, _HotSpot, _LastTime, _Matrix, _ModelMatrix, _MouseMode, _TranslateXYInWorld, _Viewport, NLMISC::CTime::getLocalTime(), NLMISC::CMatrix::identity(), NL3D::CFrustum::init(), NL3D::CViewport::initFullScreen(), NL3D::U3dMouseListener::nelStyle, NLMISC::CVector::set(), and setSpeed().

virtual NL3D::CEvent3dMouseListener::~CEvent3dMouseListener (  )  [inline, virtual]

Definition at line 86 of file event_mouse_listener.h.


Member Function Documentation

void NL3D::CEvent3dMouseListener::addToServer ( NLMISC::CEventServer server  ) 
void NL3D::CEvent3dMouseListener::enableModelMatrixEdition ( bool  enable = true  )  [inline]

enable / disable model matrix edition mode. (the default deals with the with matrix)

Definition at line 150 of file event_mouse_listener.h.

References _EnableModelMatrixEdition.

void NL3D::CEvent3dMouseListener::enableModelTranslationAxis ( TAxis  axis,
bool  enabled 
)

enable / disable an axe for translation (model matrix)

Parameters:
axis the axis to enable / diable
enabled true if the trnaslation is permitted on that axis

Definition at line 57 of file event_mouse_listener.cpp.

References _XModelTranslateEnabled, _YModelTranslateEnabled, _ZModelTranslateEnabled, xAxis, yAxis, and zAxis.

void NL3D::CEvent3dMouseListener::enableTranslateXYInWorld ( bool  enabled  ) 

if true, XY translation is made in XY World plane (instead of XY view plane).

false by default.

Definition at line 410 of file event_mouse_listener.cpp.

References _TranslateXYInWorld.

virtual NLMISC::IEventListener& NL3D::CEvent3dMouseListener::getEventListenerInterface (  )  [inline, private, virtual]

Implements NL3D::U3dMouseListener.

Definition at line 283 of file event_mouse_listener.h.

CVector NL3D::CEvent3dMouseListener::getHotSpot (  )  const [inline, virtual]

Get the current hot spot.

Returns:
the target used when the mouse move. It can be for exemple the center. of the selected object. The hotspot is not modified by mouse events.
See also:
getViewMatrix()

Implements NL3D::U3dMouseListener.

Definition at line 233 of file event_mouse_listener.h.

References _HotSpot.

const NLMISC::CMatrix& NL3D::CEvent3dMouseListener::getModelMatrix (  )  [inline]

Get the current model matrix.

Returns:
The current view matrix.
See also:
setModelMatrix()

Definition at line 220 of file event_mouse_listener.h.

References _ModelMatrix.

TAxis NL3D::CEvent3dMouseListener::getModelMatrixRotationAxis ( void   )  const [inline]

get the current axe of rotation for the model matrix

Definition at line 161 of file event_mouse_listener.h.

References _CurrentModelRotationAxis.

void NL3D::CEvent3dMouseListener::getModelMatrixTransformMove ( NLMISC::CMatrix transModelMove  )  const

see setModelMatrixTransformMove

Definition at line 420 of file event_mouse_listener.cpp.

References _ModelMatrixTransformMove.

const NLMISC::CMatrix & NL3D::CEvent3dMouseListener::getViewMatrix ( void   )  [virtual]
bool NL3D::CEvent3dMouseListener::isModelTranslationEnabled ( TAxis  axis  ) 

check whether translation on the given axis is permitted

Parameters:
axis the axis to check
Returns:
true if translation is permitted

Definition at line 67 of file event_mouse_listener.cpp.

References _XModelTranslateEnabled, _YModelTranslateEnabled, _ZModelTranslateEnabled, xAxis, yAxis, and zAxis.

bool NL3D::CEvent3dMouseListener::isTranslateXYInWorldEnabled (  )  const [inline]
See also:
translateXYInWorld()

Definition at line 193 of file event_mouse_listener.h.

References _TranslateXYInWorld.

void NL3D::CEvent3dMouseListener::operator() ( const NLMISC::CEvent event  )  [private, virtual]
void NL3D::CEvent3dMouseListener::removeFromServer ( NLMISC::CEventServer server  ) 
void NL3D::CEvent3dMouseListener::setFrustrum ( const CFrustum frustrum  )  [inline, virtual]

Set the current frustrum to use.

Parameters:
frustrum is the frustrum.

Implements NL3D::U3dMouseListener.

Definition at line 114 of file event_mouse_listener.h.

References _Frustrum.

void NL3D::CEvent3dMouseListener::setHotSpot ( const CVector hotSpot  )  [inline, virtual]

Set the current hot spot.

Parameters:
hotSpot is the target to use when the mouse move. It can be for exemple the center. of the selected object. The hotspot is not modified by mouse events.
See also:
getViewMatrix()

Implements NL3D::U3dMouseListener.

Definition at line 134 of file event_mouse_listener.h.

References _HotSpot.

void NL3D::CEvent3dMouseListener::setMatrix ( const NLMISC::CMatrix matrix  )  [inline, virtual]

Set both the current view matrix to use.

Parameters:
matrix is the matrix to set.
See also:
getViewMatrix()

Implements NL3D::U3dMouseListener.

Definition at line 95 of file event_mouse_listener.h.

References _Matrix.

void NL3D::CEvent3dMouseListener::setModelMatrix ( const NLMISC::CMatrix matrix  )  [inline]

Set the model matrix only.

param matrix is the matrix to set. getModelMatrix()

Definition at line 105 of file event_mouse_listener.h.

References _ModelMatrix.

void NL3D::CEvent3dMouseListener::setModelMatrixRotationAxis ( TAxis  axis  )  [inline]

set the current axe of rotation for the model matrix

Definition at line 158 of file event_mouse_listener.h.

References _CurrentModelRotationAxis.

void NL3D::CEvent3dMouseListener::setModelMatrixTransformMove ( const NLMISC::CMatrix transModelMove  ) 

Each move of the modelMatrix is first transformed by this matrix before applying.

NB: rot are still done in local Trans part is removed

Definition at line 415 of file event_mouse_listener.cpp.

References _ModelMatrixTransformMove.

void NL3D::CEvent3dMouseListener::setMouseMode ( TMouseMode  mouseMode  )  [inline]

Set the mouse mode.

Parameters:
mouseMode is the mode you want to use.
See also:
TMouseMode

Definition at line 144 of file event_mouse_listener.h.

References _MouseMode.

void NL3D::CEvent3dMouseListener::setSpeed ( float  speed  )  [inline, virtual]

Set the speed for first person mode.

Default 10.f;

Parameters:
speed is in unit per second.
See also:
TMouseMode

Implements NL3D::U3dMouseListener.

Definition at line 200 of file event_mouse_listener.h.

References _Speed.

Referenced by CEvent3dMouseListener().

void NL3D::CEvent3dMouseListener::setViewport ( const NL3D::CViewport viewport  )  [inline, virtual]

Set the viewport in use in the window.

By default, the viewport is fullwindow.

Parameters:
viewport is the viewport to use. All events outside the viewport are ignored.

Implements NL3D::U3dMouseListener.

Definition at line 123 of file event_mouse_listener.h.

References _Viewport.

void NL3D::CEvent3dMouseListener::truncateVect ( CVector v  )  [private]

remove composant of translations that are not permitted

See also:
enableModelTranslationAxis()

Definition at line 79 of file event_mouse_listener.cpp.

References _XModelTranslateEnabled, _YModelTranslateEnabled, _ZModelTranslateEnabled, NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z.

Referenced by operator()().


Member Data Documentation

Definition at line 274 of file event_mouse_listener.h.

Referenced by addToServer(), getViewMatrix(), and removeFromServer().

Definition at line 262 of file event_mouse_listener.h.

Referenced by CEvent3dMouseListener(), operator()(), and setFrustrum().

Definition at line 263 of file event_mouse_listener.h.

Referenced by CEvent3dMouseListener(), getHotSpot(), operator()(), and setHotSpot().

Definition at line 271 of file event_mouse_listener.h.

Referenced by CEvent3dMouseListener(), and getViewMatrix().

Definition at line 265 of file event_mouse_listener.h.

Definition at line 266 of file event_mouse_listener.h.

Definition at line 267 of file event_mouse_listener.h.

Definition at line 270 of file event_mouse_listener.h.

Referenced by getViewMatrix(), and setSpeed().

Definition at line 264 of file event_mouse_listener.h.

Referenced by CEvent3dMouseListener(), operator()(), and setViewport().

Definition at line 268 of file event_mouse_listener.h.

Referenced by operator()().

Definition at line 269 of file event_mouse_listener.h.

Referenced by operator()().


The documentation for this class was generated from the following files:

Generated on Thu Jan 7 08:30:04 2010 for NeL by  doxygen 1.6.1