27 #include "../kernel/WKernel.h"
29 #include "WFiberDrawable.h"
40 setSupportsDisplayList(
false );
80 drawFibers( renderInfo );
86 osg::State& state = *renderInfo.getState();
88 state.disableAllVertexArrays();
89 state.setVertexPointer( 3, GL_FLOAT , 0, &( *m_verts )[0] );
90 state.setColorPointer( 3 , GL_FLOAT , 0, &( *m_colors )[0] );
92 for(
size_t i = 0; i < m_active->size(); ++i )
96 state.glDrawArraysInstanced( GL_LINE_STRIP, (*m_startIndexes)[i], (*m_pointsPerLine)[i], 1);
100 state.disableVertexPointer();
101 state.disableColorPointer();
107 #ifndef GL_ES_VERSION_2_0
108 for(
size_t i = 0; i <
m_active->size(); ++i )
112 glBegin( GL_QUAD_STRIP );
118 glTexCoord1f( -1.0f );
120 glTexCoord1f( 1.0f );
Class implements an osg::Drawable that paints fiber representations either using lines or tubes.
std::shared_ptr< std::vector< float > > m_verts
pointer to the field of vertexes
WFiberDrawable()
The constructor here does nothing.
std::shared_ptr< std::vector< size_t > > m_pointsPerLine
pointer to the field of points per line
virtual void drawImplementation(osg::RenderInfo &renderInfo) const
Real work is done here.
std::shared_ptr< std::vector< float > > m_tangents
pointer to the field of line tangents
virtual osg::Object * clone(const osg::CopyOp ©op) const
clones it
std::shared_ptr< std::vector< bool > > m_active
pointer to the bitfield of active fibers
virtual osg::Object * cloneType() const
See osg documentation for this.
std::shared_ptr< std::vector< size_t > > m_startIndexes
pointer to the field of line start indexes
std::shared_ptr< std::vector< float > > m_colors
pointer to the field of colors per vertex
void drawTubes() const
Draw fibers as fake tubes.
void drawFibers(osg::RenderInfo &renderInfo) const
Draw fibers as ordinary lines.