AGXDynamics  2.31.1.0
agxOSG::GraphRenderer Class Reference

#include <GraphRenderer.h>

+ Inheritance diagram for agxOSG::GraphRenderer:

Classes

struct  OSGChannel
 

Public Member Functions

 GraphRenderer (agxRender::RenderManager *renderManager)
 
void addChannel ()
 Setup structures/data for another data channel. More...
 
template<typename T >
T * as ()
 Subclass casting. More...
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match. More...
 
template<typename T >
const T * asSafe () const
 
void clear ()
 Destruction of any data for this graph. More...
 
void drawData (size_t channelIndex, const agxRender::Graph::DataVector &data)
 Update the line geometry for a specified channel given the data (points) More...
 
void drawLine (const agx::Vec2 &p1, const agx::Vec2 &p2) const
 Draw a line from p1 to p2. More...
 
void drawText (const agx::Vec2 &pos, const agx::String &str)
 Called when text should be drawn. More...
 
osg::Node * getNode ()
 
size_t getNumChannels () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test. More...
 
void postDraw ()
 If the rendering of this graph requires some cleanup to be done it can be done in this method. More...
 
void preDraw ()
 If the rendering of this graph requires some pre-state to be set (orthographic projection etc) this can be done in this method. More...
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void removeChannel ()
 Tear down data for the last added channel. More...
 
void setColor (const agx::Vec4 &color)
 Set the current color for items to be drawn next. More...
 
virtual void setEnable (bool flag)
 Implement functionality for enabling/disabling the rendering of this graph. More...
 
void setRenderManager (agxRender::RenderManager *mgr)
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 

Static Public Member Functions

template<typename T >
static bool ValidateCast (const Referenced *object)
 

Protected Types

typedef agx::Vector< OSGChannel > Channels
 

Protected Member Functions

virtual ~GraphRenderer ()
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
void updateLineGeometry (size_t channelIndex, const agxRender::Graph::DataVector &data)
 

Static Protected Member Functions

static DeleteHandler * getDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. More...
 

Protected Attributes

Channels m_channels
 
agx::Vec4 m_currentColor
 
agx::observer_ptr< Graph > m_graph
 
agxRender::RenderManager * m_mgr
 
Mutex m_mutex
 
ObserverContainer m_observers
 
osg::ref_ptr< osg::Group > m_parent
 
AtomicValue m_refCount
 

Detailed Description

Definition at line 36 of file GraphRenderer.h.

Member Typedef Documentation

◆ Channels

Definition at line 77 of file GraphRenderer.h.

Constructor & Destructor Documentation

◆ GraphRenderer()

agxOSG::GraphRenderer::GraphRenderer ( agxRender::RenderManager *  renderManager)

◆ ~GraphRenderer()

virtual agxOSG::GraphRenderer::~GraphRenderer ( )
protectedvirtual

Reimplemented from agxRender::Graph::GraphRenderer.

Member Function Documentation

◆ addChannel()

void agxOSG::GraphRenderer::addChannel ( )
virtual

Setup structures/data for another data channel.

Will later be indexed from the drawData method.

Implements agxRender::Graph::GraphRenderer.

◆ allocateObserverVector()

void agx::Referenced::allocateObserverVector ( ) const
protectedinherited

◆ as() [1/2]

template<typename T >
T* agx::Referenced::as ( )
inherited

Subclass casting.

Template type must match actual type, dynamic_cast assertion will fail otherwise.

Referenced by agx::InternalData::get(), agxVehicle::Track::getNode(), agx::InternalData::getOrCreate(), and agx::InternalData::hasData().

◆ as() [2/2]

template<typename T >
const T* agx::Referenced::as ( ) const
inherited

◆ asSafe() [1/2]

template<typename T >
T* agx::Referenced::asSafe ( )
inherited

Safe subclass casting, return nullptr if template type does not match.

Referenced by agxUtil::CollectBodiesAndWiresVisitor::visit().

◆ asSafe() [2/2]

template<typename T >
const T* agx::Referenced::asSafe ( ) const
inherited

◆ clear()

void agxOSG::GraphRenderer::clear ( )
virtual

Destruction of any data for this graph.

After this, no more calls to draw will be done.

Implements agxRender::Graph::GraphRenderer.

◆ deleteUsingDeleteHandler()

void agx::Referenced::deleteUsingDeleteHandler ( ) const
protectedinherited

◆ drawData()

void agxOSG::GraphRenderer::drawData ( size_t  channelIndex,
const agxRender::Graph::DataVector &  data 
)
virtual

Update the line geometry for a specified channel given the data (points)

Implements agxRender::Graph::GraphRenderer.

◆ drawLine()

void agxOSG::GraphRenderer::drawLine ( const agx::Vec2 &  p1,
const agx::Vec2 &  p2 
) const
virtual

Draw a line from p1 to p2.

Implements agxRender::Graph::GraphRenderer.

◆ drawText()

void agxOSG::GraphRenderer::drawText ( const agx::Vec2 &  pos,
const agx::String &  str 
)
virtual

Called when text should be drawn.

Parameters
pos- position in x,y in the range [0..1]
str- text to draw

Implements agxRender::Graph::GraphRenderer.

◆ getDeleteHandler()

static DeleteHandler* agx::Referenced::getDeleteHandler ( )
staticprotectedinherited
Returns
a DeleteHandler.

◆ getNode()

osg::Node* agxOSG::GraphRenderer::getNode ( )
inline

Definition at line 54 of file GraphRenderer.h.

References agxTerrain::Profiler::clear().

◆ getNumChannels()

size_t agxOSG::GraphRenderer::getNumChannels ( ) const
virtual
Returns
number of added channels

Implements agxRender::Graph::GraphRenderer.

◆ getReferenceCount()

int agx::Referenced::getReferenceCount ( ) const
inherited
Returns
the number pointers currently referencing this object.

◆ is()

template<typename T >
bool agx::Referenced::is ( ) const
inherited

◆ postDraw()

void agxOSG::GraphRenderer::postDraw ( )
virtual

If the rendering of this graph requires some cleanup to be done it can be done in this method.

It will be called AFTER any draw* calls.

Implements agxRender::Graph::GraphRenderer.

◆ preDraw()

void agxOSG::GraphRenderer::preDraw ( )
virtual

If the rendering of this graph requires some pre-state to be set (orthographic projection etc) this can be done in this method.

It will be called before any draw* methods

Implements agxRender::Graph::GraphRenderer.

◆ reference()

void agx::Referenced::reference ( void *  ptr = nullptr) const
inherited

Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.

This method should be used with care, always balanced with the same number of calls to unreference.

◆ removeChannel()

void agxOSG::GraphRenderer::removeChannel ( )
virtual

Tear down data for the last added channel.

Implements agxRender::Graph::GraphRenderer.

◆ setColor()

void agxOSG::GraphRenderer::setColor ( const agx::Vec4 &  color)
virtual

Set the current color for items to be drawn next.

Parameters
color- Color to draw

Implements agxRender::Graph::GraphRenderer.

◆ setDeleteHandler()

static void agx::Referenced::setDeleteHandler ( DeleteHandler *  handler)
staticprotectedinherited

Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.

◆ setEnable()

virtual void agxOSG::GraphRenderer::setEnable ( bool  flag)
virtual

Implement functionality for enabling/disabling the rendering of this graph.

Might involve removing stuff from your specific scenegraph or similar.

Implements agxRender::Graph::GraphRenderer.

◆ setRenderManager()

void agxOSG::GraphRenderer::setRenderManager ( agxRender::RenderManager *  mgr)
inline

Definition at line 58 of file GraphRenderer.h.

◆ unreference()

void agx::Referenced::unreference ( void *  ptr = nullptr) const
inherited

Decrement the reference count by one, indicating that a pointer to this object is referencing it.

If the reference count goes to zero, it is assumed that this object is no longer referenced and is automatically deleted.

This method should be used with care, always balanced with the same number of calls to reference.

Referenced by agxData::EntityRef< ContactMaterialPtr >::~EntityRef().

◆ unreference_nodelete()

void agx::Referenced::unreference_nodelete ( ) const
inherited

Decrement the reference count by one, indicating that a pointer to this object is referencing it.

However, do not delete it, even if ref count goes to 0. Warning, unref_nodelete() should only be called if the user knows exactly who will be responsible for, one should prefer unref() over unref_nodelete() as the later can lead to memory leaks.

◆ updateLineGeometry()

void agxOSG::GraphRenderer::updateLineGeometry ( size_t  channelIndex,
const agxRender::Graph::DataVector &  data 
)
protected

◆ ValidateCast()

template<typename T >
static bool agx::Referenced::ValidateCast ( const Referenced *  object)
staticinherited

Member Data Documentation

◆ m_channels

Channels agxOSG::GraphRenderer::m_channels
protected

Definition at line 78 of file GraphRenderer.h.

◆ m_currentColor

agx::Vec4 agxOSG::GraphRenderer::m_currentColor
protected

Definition at line 67 of file GraphRenderer.h.

◆ m_graph

agx::observer_ptr<Graph> agxRender::Graph::GraphRenderer::m_graph
protectedinherited

Definition at line 113 of file Graph.h.

Referenced by agxRender::Graph::setRenderer().

◆ m_mgr

agxRender::RenderManager* agxOSG::GraphRenderer::m_mgr
protected

Definition at line 66 of file GraphRenderer.h.

◆ m_mutex

Mutex agx::Referenced::m_mutex
mutableprotectedinherited

Definition at line 240 of file Referenced.h.

◆ m_observers

ObserverContainer agx::Referenced::m_observers
mutableprotectedinherited

Definition at line 239 of file Referenced.h.

◆ m_parent

osg::ref_ptr<osg::Group> agxOSG::GraphRenderer::m_parent
protected

Definition at line 65 of file GraphRenderer.h.

◆ m_refCount

AtomicValue agx::Referenced::m_refCount
mutableprotectedinherited

Definition at line 241 of file Referenced.h.


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