OpenWalnut  1.4.0
Public Member Functions | Private Member Functions | Private Attributes
WFiberDrawable Class Reference

Class implements an osg::Drawable that paints fiber representations either using lines or tubes. More...

#include <WFiberDrawable.h>

+ Inheritance diagram for WFiberDrawable:

List of all members.

Public Member Functions

 WFiberDrawable ()
 The constructor here does nothing.
 WFiberDrawable (const WFiberDrawable &pg, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
 I can't say much about the methods below, but OSG seems to expect that we implement them.
virtual osg::Object * cloneType () const
 See osg documentation for this.
virtual osg::Object * clone (const osg::CopyOp &copyop) const
 clones it
virtual void drawImplementation (osg::RenderInfo &renderInfo) const
 Real work is done here.
void setUseTubes (bool flag)
 toggles drawing of tubes
void setBitfield (boost::shared_ptr< std::vector< bool > > bitField)
 setter
void setStartIndexes (boost::shared_ptr< std::vector< size_t > > idx)
 setter
void setPointsPerLine (boost::shared_ptr< std::vector< size_t > > ppl)
 setter
void setVerts (boost::shared_ptr< std::vector< float > > verts)
 setter
void setTangents (boost::shared_ptr< std::vector< float > > tangents)
 setter
void setColor (boost::shared_ptr< std::vector< float > > color)
 setter

Private Member Functions

void drawFibers (osg::RenderInfo &renderInfo) const
 Draw fibers as ordinary lines.
void drawTubes () const
 Draw fibers as fake tubes.

Private Attributes

boost::shared_mutex m_recalcLock
 lock
bool m_useTubes
 flag
boost::shared_ptr< std::vector
< bool > > 
m_active
 pointer to the bitfield of active fibers
boost::shared_ptr< std::vector
< size_t > > 
m_startIndexes
 pointer to the field of line start indexes
boost::shared_ptr< std::vector
< size_t > > 
m_pointsPerLine
 pointer to the field of points per line
boost::shared_ptr< std::vector
< float > > 
m_verts
 pointer to the field of vertexes
boost::shared_ptr< std::vector
< float > > 
m_tangents
 pointer to the field of line tangents
boost::shared_ptr< std::vector
< float > > 
m_colors
 pointer to the field of colors per vertex

Detailed Description

Class implements an osg::Drawable that paints fiber representations either using lines or tubes.

Definition at line 41 of file WFiberDrawable.h.


Constructor & Destructor Documentation

The constructor here does nothing.

One thing that may be necessary is disabling display lists. This can be done by calling setSupportsDisplayList (false); Display lists should be disabled for 'Drawable's that can change over time (that is, the vertices drawn change from time to time).

Definition at line 36 of file WFiberDrawable.cpp.

Referenced by clone(), and cloneType().

WFiberDrawable::WFiberDrawable ( const WFiberDrawable pg,
const osg::CopyOp &  copyop = osg::CopyOp::SHALLOW_COPY 
)

I can't say much about the methods below, but OSG seems to expect that we implement them.

Parameters:
pg
copyop

Definition at line 46 of file WFiberDrawable.cpp.


Member Function Documentation

osg::Object * WFiberDrawable::clone ( const osg::CopyOp &  copyop) const [virtual]

clones it

Parameters:
copyopcopy operation. See osg doc for details
Returns:
the cloned object

Definition at line 56 of file WFiberDrawable.cpp.

References WFiberDrawable().

osg::Object * WFiberDrawable::cloneType ( ) const [virtual]

See osg documentation for this.

Returns:
the cloned object

Definition at line 51 of file WFiberDrawable.cpp.

References WFiberDrawable().

void WFiberDrawable::drawFibers ( osg::RenderInfo &  renderInfo) const [private]

Draw fibers as ordinary lines.

Parameters:
renderInfo

Definition at line 84 of file WFiberDrawable.cpp.

void WFiberDrawable::drawImplementation ( osg::RenderInfo &  renderInfo) const [virtual]

Real work is done here.

THERE IS A VERY IMPORTANT THING TO NOTE HERE: the drawImplementation method receives an state as parameter. This can be used to change the OpenGL state, but changing the OpenGL state here is something to be avoided as much as possible. Do this *only* if it is *absolutely* necessary to make your rendering algorithm work. The "right" (most efficient and flexible) way to change the OpenGL state in OSG is by attaching 'StateSet's to 'Node's and 'Drawable's. That said, the example below shows how to change the OpenGL state in these rare cases in which it is necessary. But always keep in mind: *Change the OpenGL state only if strictly necessary*.

Parameters:
renderInfothe render info object. See osg doc for details

Definition at line 72 of file WFiberDrawable.cpp.

void WFiberDrawable::drawTubes ( ) const [private]

Draw fibers as fake tubes.

Definition at line 104 of file WFiberDrawable.cpp.

References m_active, m_colors, m_pointsPerLine, m_startIndexes, m_tangents, and m_verts.

void WFiberDrawable::setBitfield ( boost::shared_ptr< std::vector< bool > >  bitField) [inline]

setter

Parameters:
bitFieldselected fibers to draw

Definition at line 171 of file WFiberDrawable.h.

References m_active.

void WFiberDrawable::setColor ( boost::shared_ptr< std::vector< float > >  color) [inline]

setter

Parameters:
color

Definition at line 196 of file WFiberDrawable.h.

References m_colors.

void WFiberDrawable::setPointsPerLine ( boost::shared_ptr< std::vector< size_t > >  ppl) [inline]

setter

Parameters:
ppl

Definition at line 181 of file WFiberDrawable.h.

References m_pointsPerLine.

void WFiberDrawable::setStartIndexes ( boost::shared_ptr< std::vector< size_t > >  idx) [inline]

setter

Parameters:
idx

Definition at line 176 of file WFiberDrawable.h.

References m_startIndexes.

void WFiberDrawable::setTangents ( boost::shared_ptr< std::vector< float > >  tangents) [inline]

setter

Parameters:
tangents

Definition at line 191 of file WFiberDrawable.h.

References m_tangents.

void WFiberDrawable::setUseTubes ( bool  flag) [inline]

toggles drawing of tubes

Parameters:
flag

Definition at line 166 of file WFiberDrawable.h.

References m_useTubes.

void WFiberDrawable::setVerts ( boost::shared_ptr< std::vector< float > >  verts) [inline]

setter

Parameters:
verts

Definition at line 186 of file WFiberDrawable.h.

References m_verts.


Member Data Documentation

boost::shared_ptr< std::vector< bool > > WFiberDrawable::m_active [private]

pointer to the bitfield of active fibers

Definition at line 157 of file WFiberDrawable.h.

Referenced by drawTubes(), and setBitfield().

boost::shared_ptr< std::vector< float > > WFiberDrawable::m_colors [private]

pointer to the field of colors per vertex

Definition at line 163 of file WFiberDrawable.h.

Referenced by drawTubes(), and setColor().

boost::shared_ptr< std::vector< size_t > > WFiberDrawable::m_pointsPerLine [private]

pointer to the field of points per line

Definition at line 160 of file WFiberDrawable.h.

Referenced by drawTubes(), and setPointsPerLine().

boost::shared_mutex WFiberDrawable::m_recalcLock [private]

lock

Definition at line 153 of file WFiberDrawable.h.

boost::shared_ptr< std::vector< size_t > > WFiberDrawable::m_startIndexes [private]

pointer to the field of line start indexes

Definition at line 159 of file WFiberDrawable.h.

Referenced by drawTubes(), and setStartIndexes().

boost::shared_ptr< std::vector< float > > WFiberDrawable::m_tangents [private]

pointer to the field of line tangents

Definition at line 162 of file WFiberDrawable.h.

Referenced by drawTubes(), and setTangents().

flag

Definition at line 155 of file WFiberDrawable.h.

Referenced by setUseTubes().

boost::shared_ptr< std::vector< float > > WFiberDrawable::m_verts [private]

pointer to the field of vertexes

Definition at line 161 of file WFiberDrawable.h.

Referenced by drawTubes(), and setVerts().


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