Menge
Modular Pedestrian Simulation Framework for Research and Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | List of all members
Menge::BFSM::VelCompContext Class Reference

Base context for finite state machine velocity components. More...

#include <VelCompContext.h>

Inheritance diagram for Menge::BFSM::VelCompContext:
Menge::SceneGraph::Context Menge::BFSM::ConstDirVCContext Menge::BFSM::ConstVCContext Menge::BFSM::GoalVCContext Menge::BFSM::NavMeshVCContext Menge::BFSM::RoadMapVCContext Menge::BFSM::VecFieldVCContext Menge::BFSM::ZeroVCContext

Public Member Functions

 VelCompContext ()
 Constructor.
 
void destroy ()
 This supplants the destructor. More...
 
virtual std::string getUIText (const std::string &indent="") const
 Provides a string to be printed in the display as a UI element detailing velocity component information. More...
 
virtual void draw3DGL (const Agents::BaseAgent *agt, const Goal *goal)
 Draw context elements into the 3D world. More...
 
- Public Member Functions inherited from Menge::SceneGraph::Context
 Context ()
 Constructor.
 
virtual ~Context ()
 Virtual destructor.
 
virtual void drawGL (int vWidth, int vHeight)
 The draw function for the context. More...
 
virtual bool selectGL (const GLScene *scene, const GLCamera &camera, int vWidth, int vHeight, int *selectPoint)
 Performs selection based on a click on screen space. Uses the OpenGL selection mechanism. More...
 
virtual ContextResult handleMouse (SDL_Event &e)
 Give the context the opportunity to respond to a mouse event. More...
 
virtual ContextResult handleKeyboard (SDL_Event &e)
 Give the context the opportunity to respond to a keyboard event. More...
 
virtual void update ()
 Allow the context to update any time-dependent state it might have to the given global time.
 
virtual void newGLContext ()
 Callback for when the OpenGL context is changed.
 
virtual void activate ()
 Called when the context is activated.
 
virtual void deactivate ()
 Called when the context is deactivated.
 

Protected Member Functions

virtual ~VelCompContext ()
 Destructor.
 
void drawPrefVel (const Agents::PrefVelocity &pVel, const Vector2 &pos, float elevation=0.f)
 Draws the preferred velocity in a consistent way. More...
 
void drawGoal (const Vector2 &goalPoint, const Agents::BaseAgent *agent) const
 Draws the 2d goal point in a consistent manner. More...
 
void drawGoal (const Vector3 &goalPoint, float agtRadius=0.19f) const
 Draws the 3d goal point in a consistent manner. More...
 
- Protected Member Functions inherited from Menge::SceneGraph::Context
void uiSetup (int vWidth, int vHeight)
 UI setup - handles the configuration of the opengl context for orthographic rendering. More...
 
void uiShutdown ()
 Cleans up the OpenGL state after having drawn the UI elements of the context.
 
virtual void drawUIGL (int vWidth, int vHeight, bool select=false)
 Draw UI elements into the context. More...
 
virtual void draw3DGL (bool select=false)
 Draw context elements into the 3D world. More...
 
void getOpenGLView ()
 Updates the various view matrices: modelview, projection, and view.
 
void writeText (const std::string &txt, const Vector2 &pos, bool currColor=false) const
 Writes the given text at the given location. More...
 
void writeText (const std::string &txt, const Vector3 &pos, bool currColor=false) const
 Writes the given text at the given 3D location. More...
 
void writeTextRadially (const std::string &txt, const Vector2 &pos, const Vector2 &dir, bool currColor=false) const
 Writes the given text at the given location, but anchored based on the radial direction given. More...
 
void writeAlignedText (const std::string &txt, const Vector2 &pos, TextWriter::Alignment align, bool currColor=false) const
 Writes the given text aligned to the given location. More...
 
void writeToScreen (const std::string &txt, TextWriter::Alignment align, int fontSize, float hPad=0.f, float vPad=0.f, bool currColor=false, bool trans=true) const
 Writes the given text to the screen based on the given alignment. More...
 

Additional Inherited Members

- Protected Attributes inherited from Menge::SceneGraph::Context
double _modViewMat [16]
 The current model view matrix.
 
double _projMat [16]
 The current projection matrix.
 
int _viewMat [4]
 The current viewport parameters.
 

Detailed Description

Base context for finite state machine velocity components.

This differs from the standard scene graph context by being dependent on an input agent.

Member Function Documentation

void Menge::BFSM::VelCompContext::destroy ( )
inline

This supplants the destructor.

In order to preserve potential problems in windows when dlls do not share the same c-runtime library, the destructor is held to be private. To garbage collect an VelComponent, the destroy method should be called (which in turn, will call the destructor from its own memory space, averting run-time crashes).

Once this has been called, the VelComponent no longer exists. Calling methods or accessing members will produce indetermine behavior (most likely errors).

virtual void Menge::BFSM::VelCompContext::draw3DGL ( const Agents::BaseAgent agt,
const Goal goal 
)
inlinevirtual

Draw context elements into the 3D world.

This should never be called in select mode.

Parameters
agtThe particular agent for which the FSM is being visualized.
goalThe agent's goal (although this may be ignored).

Reimplemented in Menge::BFSM::ConstDirVCContext, Menge::BFSM::NavMeshVCContext, Menge::BFSM::RoadMapVCContext, Menge::BFSM::VecFieldVCContext, Menge::BFSM::ConstVCContext, and Menge::BFSM::GoalVCContext.

void Menge::BFSM::VelCompContext::drawGoal ( const Vector2 goalPoint,
const Agents::BaseAgent agent 
) const
protected

Draws the 2d goal point in a consistent manner.

Parameters
goalPointThe position of the agent's goal
agentThe agent
void Menge::BFSM::VelCompContext::drawGoal ( const Vector3 goalPoint,
float  agtRadius = 0.19f 
) const
protected

Draws the 3d goal point in a consistent manner.

Parameters
agtRadiusThe agent's radius
goalPointThe position of the goal
void Menge::BFSM::VelCompContext::drawPrefVel ( const Agents::PrefVelocity pVel,
const Vector2 pos,
float  elevation = 0.f 
)
protected

Draws the preferred velocity in a consistent way.

Parameters
pVelThe preferred velocity of the agent computed by the vel component.
posThe position of the velocity vector's origin.
elevationThe optional elevation of the velocity.
std::string Menge::BFSM::VelCompContext::getUIText ( const std::string &  indent = "") const
virtual

Provides a string to be printed in the display as a UI element detailing velocity component information.

Parameters
indentAn optional string representing indentation to be applied to the text. It is prefixed at the start of each line.
Returns
The string for printing on the UI layer.

Reimplemented in Menge::BFSM::ZeroVCContext, Menge::BFSM::ConstDirVCContext, Menge::BFSM::NavMeshVCContext, Menge::BFSM::RoadMapVCContext, Menge::BFSM::VecFieldVCContext, Menge::BFSM::ConstVCContext, and Menge::BFSM::GoalVCContext.


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