OpenWalnut  1.5.0dev
Public Member Functions | Private Member Functions | Private Attributes | List of all members
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:
+ Collaboration diagram for WFiberDrawable:

Public Member Functions

 WFiberDrawable ()
 The constructor here does nothing. More...
 
 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. More...
 
virtual osg::Object * cloneType () const
 See osg documentation for this. More...
 
virtual osg::Object * clone (const osg::CopyOp &copyop) const
 clones it More...
 
virtual void drawImplementation (osg::RenderInfo &renderInfo) const
 Real work is done here. More...
 
void setUseTubes (bool flag)
 toggles drawing of tubes More...
 
void setBitfield (std::shared_ptr< std::vector< bool > > bitField)
 setter More...
 
void setStartIndexes (std::shared_ptr< std::vector< size_t > > idx)
 setter More...
 
void setPointsPerLine (std::shared_ptr< std::vector< size_t > > ppl)
 setter More...
 
void setVerts (std::shared_ptr< std::vector< float > > verts)
 setter More...
 
void setTangents (std::shared_ptr< std::vector< float > > tangents)
 setter More...
 
void setColor (std::shared_ptr< std::vector< float > > color)
 setter More...
 

Private Member Functions

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

Private Attributes

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

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

◆ WFiberDrawable() [1/2]

WFiberDrawable::WFiberDrawable ( )

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().

+ Here is the caller graph for this function:

◆ WFiberDrawable() [2/2]

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

◆ clone()

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().

+ Here is the call graph for this function:

◆ cloneType()

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().

+ Here is the call graph for this function:

◆ drawFibers()

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

Draw fibers as ordinary lines.

Parameters
renderInfo

Definition at line 84 of file WFiberDrawable.cpp.

◆ drawImplementation()

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.

◆ drawTubes()

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.

◆ setBitfield()

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

setter

Parameters
bitFieldselected fibers to draw

Definition at line 171 of file WFiberDrawable.h.

References m_active.

◆ setColor()

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

setter

Parameters
color

Definition at line 196 of file WFiberDrawable.h.

References m_colors.

◆ setPointsPerLine()

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

setter

Parameters
ppl

Definition at line 181 of file WFiberDrawable.h.

References m_pointsPerLine.

◆ setStartIndexes()

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

setter

Parameters
idx

Definition at line 176 of file WFiberDrawable.h.

References m_startIndexes.

◆ setTangents()

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

setter

Parameters
tangents

Definition at line 191 of file WFiberDrawable.h.

References m_tangents.

◆ setUseTubes()

void WFiberDrawable::setUseTubes ( bool  flag)
inline

toggles drawing of tubes

Parameters
flag

Definition at line 166 of file WFiberDrawable.h.

References m_useTubes.

◆ setVerts()

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

setter

Parameters
verts

Definition at line 186 of file WFiberDrawable.h.

References m_verts.

Member Data Documentation

◆ m_active

std::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().

◆ m_colors

std::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().

◆ m_pointsPerLine

std::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().

◆ m_recalcLock

std::shared_mutex WFiberDrawable::m_recalcLock
private

lock

Definition at line 153 of file WFiberDrawable.h.

◆ m_startIndexes

std::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().

◆ m_tangents

std::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().

◆ m_useTubes

bool WFiberDrawable::m_useTubes
private

flag

Definition at line 155 of file WFiberDrawable.h.

Referenced by setUseTubes().

◆ m_verts

std::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: