iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nrt::graphics::ShapeRenderer Class Referenceabstract

#include <nrt/Graphics/ShapeRenderer.H>

Base class for a graphics shape renderer. See, for example, ShapeRendererBasic for derived classes.

The shape renderer is a simplified front-end to OpenGL rendering of shapes in a 3D scene.

Definition at line 60 of file ShapeRenderer.H.

Inheritance diagram for nrt::graphics::ShapeRenderer:
nrt::Component nrt::ParameterRegistry nrt::graphics::ShapeRendererBasic

Classes

struct  KeyboardPress
 A key pressed on the keyboard, along with whether this was a release (true) or press (false) More...
 

Public Member Functions

 ShapeRenderer (std::string const &instanceName="")
 Default constructor. More...
 
virtual ~ShapeRenderer ()
 Virtual destructor for safe inheritance.
 
DisplayListManagerdlManager ()
 Access our DisplayListManager to create/delete/access display lists. More...
 
TextureManagertexManager ()
 Access our TextureManager to create/delete/access textures. More...
 
std::map< std::string,
nrt::graphics::mocap::Skeleton > & 
skeletons ()
 Access our map of skeletons.
 
virtual Dims< int32 > dims () const =0
 Get dimensions of renderer.
 
virtual void drawSphere () const =0
 Primitive shapes optimized as DisplayLists. More...
 
virtual void drawCylinder (bool capped) const =0
 Draw a unit cylinder.
 
- Public Member Functions inherited from nrt::Component
 Component (std::string const &instanceName)
 Constructor. More...
 
void prepareForDeletion ()
 Prepare for deletion: uninit and disconnect from our parent. More...
 
virtual ~Component ()
 Virtual destructor for safe inheritance. More...
 
template<>
std::shared_ptr< ComponentgetSubComponent (std::string const &instanceName) const
 
template<class Comp >
std::shared_ptr< Comp > addSubComponent (std::string const &instanceName="")
 Pseudo-constructor: construct and add another component as a subcomponent of this one. More...
 
template<class Comp >
void removeSubComponent (std::shared_ptr< Comp > &component)
 Remove a sub-Component from this Component, by shared_ptr. More...
 
void removeSubComponent (std::string const &instanceName)
 Remove a sub-Component from this Component, by instance name.
 
template<class Comp = nrt::Component>
std::shared_ptr< Comp > getSubComponent (std::string const &instanceName) const
 Get a sub-component by instance name. More...
 
bool isTopLevel () const
 Returns true if this component is top-level, i.e., its parent is an nrt::Manager (including nrt::Blackboard)
 
bool initialized () const
 Has this component been initialized yet?
 
bool started () const
 Is this component started, i.e., it has passed the start() state and not yet entered the stop() state.
 
bool running () const
 Is this component running, i.e., has passed start() and been launch()ed and not yet entered the stop() state.
 
void wait ()
 Wait until all run() functions decide on their own that they are finished. More...
 
Component::MetaInfo const & meta () const
 Get the metainfo of this Component. More...
 
template<typename T >
std::vector< std::string > setParamVal (std::string const &paramdescriptor, T const &val)
 Set a parameter value. More...
 
template<typename T >
void setParamValUnique (std::string const &paramdescriptor, T const &val)
 Set a parameter value, simple version assuming only one parameter match. More...
 
template<typename T >
std::vector< std::pair
< std::string, T > > 
getParamVal (std::string const &paramdescriptor) const
 Get parameter(s) value(s) by descriptor. More...
 
template<typename T >
getParamValUnique (std::string const &paramdescriptor) const
 Get a parameter value, simple version assuming only one parameter match. More...
 
std::vector< std::string > setParamString (std::string const &paramdescriptor, std::string const &val)
 Set a parameter value, by string. More...
 
void setParamStringUnique (std::string const &paramdescriptor, std::string const &val)
 Set a parameter value by string, simple version assuming only one parameter match. More...
 
std::vector< std::pair
< std::string, std::string > > 
getParamString (std::string const &paramdescriptor) const
 Get a parameter value, by string. More...
 
std::string getParamStringUnique (std::string const &paramdescriptor) const
 Get a parameter value by string, simple version assuming only one parameter match. More...
 
std::string descriptor () const
 Get our full descriptor (including all parents) as [Classname-Instancename]:[...]:[...].
 
std::string parentModuleUID () const
 Get the ModuleUID (as string) of this Component's nearest parent Module, or an empty string.
 
void prettyPrintTree (std::ostream &os, int indent=0) const
 Produce a nice textual hierarchy of this Component's sub-tree.
 
std::vector< std::pair
< std::string,
nrt::ParameterSummary > > 
getParamSummary (std::string const &paramdescriptor) const
 Return a list of parameter summaries for a given descriptor. More...
 
std::vector< std::pair
< std::string,
nrt::ParameterSummary > > 
getParamSummary (bool skipsubmodules=false) const
 Return a list of parameter summaries for all parameters of this Component and its subcomponents. More...
 
void setPath (std::string const &path)
 Assign a filesystem path to this component.
 
std::string absolutePath (std::string const &path)
 If given path is relative (not starting with /), prepend the Component path to it; otherwise, no-op.
 
virtual void notifyAllParamChanged (nrt::ParameterState const state) const
 This method is called by the Blackboard to refresh a ParamChangedListener.
 
virtual void getAllParamSummaries (std::vector< nrt::ParameterSummary > &ps) const
 Recursively get all param summaries.
 
- Public Member Functions inherited from nrt::ParameterRegistry
void addParameter (ParameterBase *const param)
 The parameter class uses this method to register itself on construction with it's owning Component.
 
void removeParameter (ParameterBase *const param)
 The parameter class uses this method to un-register itself on destruction with it's owning Component.
 

Protected Member Functions

virtual void resizeCallback (int width, int height)=0
 Function called when a window resize event is received. More...
 
virtual void mouseCallback (unsigned int button, int x, int y, bool pushed, bool motion)=0
 Abstract mouse movement function.
 
virtual void keyboardCallback (std::vector< KeyboardPress > const &keys)=0
 Abstract keyboard callback function. More...
 
virtual void mouse3dCallback (double const x, double const y, double const z, double const a, double const b, double const c, int const period)=0
 Function called when a 3D mouse (3dConnexion SpacePilot Pro for example) event is received.
 
- Protected Member Functions inherited from nrt::Component
virtual void preInit ()
 Called before all sub-Components are init()ed.
 
virtual void postInit ()
 Called after all sub-Components are init()ed.
 
virtual void preStart ()
 Called before all sub-Components are start()ed.
 
virtual void postStart ()
 Called after all sub-Components are start()ed.
 
virtual void run ()
 Called in its own thread after all Components have been start()ed. More...
 
virtual void preStop ()
 Called before all sub-Components are stop()ed.
 
virtual void postStop ()
 Called after all sub-Components are stop()ed.
 
virtual void preUninit ()
 Called before all sub-Components are uninit()ed.
 
virtual void postUninit ()
 Called after all sub-Components are uninit()ed.
 
virtual void notifyParamChanged (nrt::ParameterState const state, ParameterBase const *const param) const
 This method is called by a Parameter when it has been changed. Users should never overload this method.
 
void populateHelpMessage (std::string const &cname, std::unordered_map< std::string, std::unordered_map< std::string, std::vector< std::pair< std::string, std::string > > > > &helplist) const
 

Protected Attributes

std::shared_ptr
< nrt::graphics::Camera
itsCamera
 Our camera, defines projection and view matrices.
 
- Protected Attributes inherited from nrt::Component
boost::shared_mutex itsMtx
 Mutex used to protect our internals other than subcomponents and parameters.
 
std::vector< std::shared_ptr
< Component > > 
itsSubComponents
 
boost::shared_mutex itsSubMtx
 
Component *const nrt_component_this
 

Constructor & Destructor Documentation

nrt::graphics::ShapeRenderer::ShapeRenderer ( std::string const &  instanceName = "")

Default constructor.

This should do very little, most initialization should happen in preStart().

See Also
Component

Member Function Documentation

DisplayListManager& nrt::graphics::ShapeRenderer::dlManager ( )

Access our DisplayListManager to create/delete/access display lists.

Note
All displaylists are erased on stop()
TextureManager& nrt::graphics::ShapeRenderer::texManager ( )

Access our TextureManager to create/delete/access textures.

Note
All textures are erased on stop()
virtual void nrt::graphics::ShapeRenderer::drawSphere ( ) const
pure virtual

Primitive shapes optimized as DisplayLists.

Before you call any of these functions, you should already have obtained a glX context lock. Mainly, these functions are for the use of programmers that code complex shapes as assemblages of these elementary shapes; end users should just use Shape objects instead. For example, use render() on a Sphere shape instead of calling drawSphere() here (indeed, render() for a Sphere just calls drawSphere() internally after setting up the transform, Brush, Pen, etc). Draw a unit sphere

Implemented in nrt::graphics::ShapeRendererBasic.

virtual void nrt::graphics::ShapeRenderer::resizeCallback ( int  width,
int  height 
)
protectedpure virtual

Function called when a window resize event is received.

Overload this to resize your display to the given width and height

Implemented in nrt::graphics::ShapeRendererBasic.

virtual void nrt::graphics::ShapeRenderer::keyboardCallback ( std::vector< KeyboardPress > const &  keys)
protectedpure virtual

Abstract keyboard callback function.

It is important to realize that the way XEvents happen, this callback will be called with a single key press at a time (either a release or press) in temporal order.

Parameters
[in]keysAll keys pressed or released in the current time interval

Implemented in nrt::graphics::ShapeRendererBasic.


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