#include <HumanMatrixGetter.h>
Public Member Functions | |
HumanMatrixGetter () | |
virtual bool | handleEvent (NetControlEvent *pEvent, TNL::EventConnection *pConnection) |
Handle "one-shot" events (Key pressed for firing, for example). | |
virtual void | handleFrame (double elapsed) |
Handle on-frame (Coninuous) update for inputs. | |
void | setByFrame (const osg::Vec3 &EyePos, const osg::Vec3 &Dir, const osg::Vec3 &Up) |
Vectors Dir & Up do not need to be normalized. | |
virtual osg::Matrix | getMatrix () const |
virtual osg::Matrix | getInverseMatrix () const |
osg::Matrix | yawPitchRoll (osg::Vec3::value_type yaw, osg::Vec3::value_type pitch, osg::Vec3::value_type roll) const |
Performs a triple rotation as osg::Matrix::rotate(double, Vec3, double, Vec3, double, Vec3) does, but with a limit on pitch rotation. | |
Protected Attributes | |
osg::Vec3 | EyePos |
osg::Vec3 | Dir |
osg::Vec3 | Up |
Defines a frame and a reference point (The last vector, named 'Right', is = Up^Dir). | |
osg::Vec3::value_type | MovingSpeed |
Camera speed in world units. | |
Static Protected Attributes | |
static const osg::Vec3::value_type | AlphaMin = 0.008 |
Minumum angle for pitch. |
Definition at line 40 of file HumanMatrixGetter.h.
HumanMatrixGetter::HumanMatrixGetter | ( | ) | [inline] |
Definition at line 42 of file HumanMatrixGetter.h.
virtual osg::Matrix HumanMatrixGetter::getInverseMatrix | ( | ) | const [inline, virtual] |
virtual osg::Matrix HumanMatrixGetter::getMatrix | ( | ) | const [inline, virtual] |
Implements MatrixGetter.
Definition at line 57 of file HumanMatrixGetter.h.
References MatrixGetter::getInverseMatrix().
virtual bool HumanMatrixGetter::handleEvent | ( | NetControlEvent * | pEvent, | |
TNL::EventConnection * | pConnection | |||
) | [inline, virtual] |
Handle "one-shot" events (Key pressed for firing, for example).
If pConnection parameter is not NULL, then the event should be considered as a client event (generally sent instead if processed).
true
if the event is handled, ie. should not be processed by other handlers. Returning true
DOES NOT MEAN that the corresponding (mapped) OSG input is handled ! Handling controls is different from OSG. Implements ControlEventHandler.
Definition at line 44 of file HumanMatrixGetter.h.
void HumanMatrixGetter::handleFrame | ( | double | elapsed | ) | [virtual] |
Handle on-frame (Coninuous) update for inputs.
For units, this method is the interface between controls (= mapped inputs) and the unit piloting/driving. Be careful to test the nullity of the pointer to the Controler (pControler).
Implements ControlHandler.
Definition at line 35 of file HumanMatrixGetter.cpp.
References ASSERT, ControlState::AXIS_X, ControlState::AXIS_Y, ControlState::BACKWARD, Controler::clearEvents(), ControlState::CROUCH, Dir, ControlState::DOWN, EyePos, ControlState::FAST_TOGGLE, ControlState::FASTER, ControlState::FORWARD, ControlState::getAxis(), Controler::getControlState(), Controler::getEventBegin(), Controler::getEventEnd(), ControlState::JUMP, MovingSpeed, ControlHandler::pControler, ControlState::SLOWER, ControlState::STRAFE_LEFT, ControlState::STRAFE_RIGHT, ControlEvent::SWITCH_DOWN, ControlState::UP, Up, and yawPitchRoll().
void HumanMatrixGetter::setByFrame | ( | const osg::Vec3 & | EyePos, | |
const osg::Vec3 & | Dir, | |||
const osg::Vec3 & | Up | |||
) | [inline] |
osg::Matrix HumanMatrixGetter::yawPitchRoll | ( | osg::Vec3::value_type | yaw, | |
osg::Vec3::value_type | pitch, | |||
osg::Vec3::value_type | roll | |||
) | const |
Performs a triple rotation as osg::Matrix::rotate(double, Vec3, double, Vec3, double, Vec3) does, but with a limit on pitch rotation.
Definition at line 81 of file HumanMatrixGetter.cpp.
References AlphaMin, ASSERT, Dir, and Up.
Referenced by handleFrame().
const osg::Vec3::value_type HumanMatrixGetter::AlphaMin = 0.008 [static, protected] |
Minumum angle for pitch.
Definition at line 67 of file HumanMatrixGetter.h.
Referenced by yawPitchRoll().
osg::Vec3 HumanMatrixGetter::Dir [protected] |
osg::Vec3 HumanMatrixGetter::EyePos [protected] |
osg::Vec3::value_type HumanMatrixGetter::MovingSpeed [protected] |
Camera speed in world units.
Definition at line 66 of file HumanMatrixGetter.h.
Referenced by handleFrame().
osg::Vec3 HumanMatrixGetter::Up [protected] |
Defines a frame and a reference point (The last vector, named 'Right', is = Up^Dir).
Definition at line 64 of file HumanMatrixGetter.h.
Referenced by handleFrame(), and yawPitchRoll().