osgEarth 2.1.1
|
Public Member Functions | |
LineFunctor () | |
virtual | ~LineFunctor () |
void | setTreatVertexDataAsTemporary (bool treatVertexDataAsTemporary) |
bool | getTreatVertexDataAsTemporary () const |
virtual void | setVertexArray (unsigned int count, const osg::Vec3 *vertices) |
virtual void | setVertexArray (unsigned int, const osg::Vec2 *) |
virtual void | setVertexArray (unsigned int, const osg::Vec4 *) |
virtual void | setVertexArray (unsigned int, const osg::Vec2d *) |
virtual void | setVertexArray (unsigned int, const osg::Vec3d *) |
virtual void | setVertexArray (unsigned int, const osg::Vec4d *) |
virtual void | drawArrays (GLenum mode, GLint first, GLsizei count) |
virtual void | drawElements (GLenum mode, GLsizei count, const GLubyte *indicies) |
virtual void | drawElements (GLenum mode, GLsizei count, const GLushort *indicies) |
virtual void | drawElements (GLenum mode, GLsizei count, const GLuint *indicies) |
virtual void | begin (GLenum mode) |
virtual void | vertex (const osg::Vec2 &vert) |
virtual void | vertex (const osg::Vec3 &vert) |
virtual void | vertex (const osg::Vec4 &vert) |
virtual void | vertex (float x, float y) |
virtual void | vertex (float x, float y, float z) |
virtual void | vertex (float x, float y, float z, float w) |
virtual void | end () |
Protected Attributes | |
unsigned int | _vertexArraySize |
const osg::Vec3 * | _vertexArrayPtr |
GLenum | _modeCache |
std::vector< osg::Vec3 > | _vertexCache |
bool | _treatVertexDataAsTemporary |
This is basically the same thing as osg::TriangleFunctor, but for lines.
Definition at line 34 of file LineFunctor.
osgEarth::Symbology::LineFunctor< T >::LineFunctor | ( | ) | [inline] |
Definition at line 38 of file LineFunctor.
{ _vertexArraySize=0; _vertexArrayPtr=0; _modeCache=0; _treatVertexDataAsTemporary=false; }
virtual osgEarth::Symbology::LineFunctor< T >::~LineFunctor | ( | ) | [inline, virtual] |
Definition at line 46 of file LineFunctor.
{}
virtual void osgEarth::Symbology::LineFunctor< T >::begin | ( | GLenum | mode | ) | [inline, virtual] |
Note: begin(..),vertex(..) & end() are convenience methods for adapting non vertex array primitives to vertex array based primitives. This is done to simplify the implementation of primitive functor subclasses - users only need override drawArray and drawElements.
Definition at line 262 of file LineFunctor.
{ _modeCache = mode; _vertexCache.clear(); }
virtual void osgEarth::Symbology::LineFunctor< T >::drawArrays | ( | GLenum | mode, |
GLint | first, | ||
GLsizei | count | ||
) | [inline, virtual] |
Definition at line 64 of file LineFunctor.
{ if (_vertexArrayPtr==0 || count==0) return; switch(mode) { case(GL_LINES): { const osg::Vec3* vlast = &_vertexArrayPtr[first+count]; for(const osg::Vec3* vptr = &_vertexArrayPtr[first]; vptr<vlast; vptr+=2) this->operator()( *(vptr), *(vptr+1), _treatVertexDataAsTemporary ); } break; case(GL_LINE_STRIP): { const osg::Vec3* vlast = &_vertexArrayPtr[first+count-1]; for(const osg::Vec3* vptr = &_vertexArrayPtr[first]; vptr<vlast; vptr++) this->operator()( *(vptr), *(vptr+1), _treatVertexDataAsTemporary ); } break; case(GL_LINE_LOOP): { const osg::Vec3* vlast = &_vertexArrayPtr[first+count-1]; const osg::Vec3* vptr; for(vptr = &_vertexArrayPtr[first]; vptr<vlast; vptr++) this->operator()( *(vptr), *(vptr+1), _treatVertexDataAsTemporary ); if ( count >= 2 ) this->operator()( *vptr, _vertexArrayPtr[first], _treatVertexDataAsTemporary ); } break; case(GL_TRIANGLES): case(GL_TRIANGLE_STRIP): case(GL_QUADS): case(GL_QUAD_STRIP): case(GL_POLYGON): case(GL_TRIANGLE_FAN): case(GL_POINTS): default: // can't be converted into to line segments. break; } }
virtual void osgEarth::Symbology::LineFunctor< T >::drawElements | ( | GLenum | mode, |
GLsizei | count, | ||
const GLubyte * | indicies | ||
) | [inline, virtual] |
Definition at line 110 of file LineFunctor.
{ if (indicies==0 || count==0) return; typedef const GLubyte* IndexPointer; switch(mode) { case(GL_LINES): { IndexPointer ilast = &indicies[count]; for(IndexPointer iptr=indicies; iptr<ilast; iptr+=2) this->operator()( _vertexArrayPtr[*iptr], _vertexArrayPtr[*(iptr+1)], _treatVertexDataAsTemporary ); } break; case(GL_LINE_STRIP): { IndexPointer ilast = &indicies[count-1]; for(IndexPointer iptr=indicies; iptr<ilast; iptr++) this->operator()( _vertexArrayPtr[*iptr], _vertexArrayPtr[*(iptr+1)], _treatVertexDataAsTemporary ); } break; case(GL_LINE_LOOP): { IndexPointer ilast = &indicies[count-1]; IndexPointer iptr; for(iptr=indicies; iptr<ilast; iptr++) this->operator()( _vertexArrayPtr[*iptr], _vertexArrayPtr[*(iptr+1)], _treatVertexDataAsTemporary ); if (count >= 2) this->operator()( _vertexArrayPtr[*iptr], _vertexArrayPtr[indicies[0]], _treatVertexDataAsTemporary ); } break; case(GL_TRIANGLES): case(GL_TRIANGLE_STRIP): case(GL_QUADS): case(GL_QUAD_STRIP): case(GL_POLYGON): case(GL_TRIANGLE_FAN): case(GL_POINTS): default: // can't be converted into to lines. break; } }
virtual void osgEarth::Symbology::LineFunctor< T >::drawElements | ( | GLenum | mode, |
GLsizei | count, | ||
const GLushort * | indicies | ||
) | [inline, virtual] |
Definition at line 158 of file LineFunctor.
{ if (indicies==0 || count==0) return; typedef const GLushort* IndexPointer; switch(mode) { case(GL_LINES): { IndexPointer ilast = &indicies[count]; for(IndexPointer iptr=indicies; iptr<ilast; iptr+=2) this->operator()( _vertexArrayPtr[*iptr], _vertexArrayPtr[*(iptr+1)], _treatVertexDataAsTemporary ); } break; case(GL_LINE_STRIP): { IndexPointer ilast = &indicies[count-1]; for(IndexPointer iptr=indicies; iptr<ilast; iptr++) this->operator()( _vertexArrayPtr[*iptr], _vertexArrayPtr[*(iptr+1)], _treatVertexDataAsTemporary ); } break; case(GL_LINE_LOOP): { IndexPointer ilast = &indicies[count-1]; IndexPointer iptr; for(iptr=indicies; iptr<ilast; iptr++) this->operator()( _vertexArrayPtr[*iptr], _vertexArrayPtr[*(iptr+1)], _treatVertexDataAsTemporary ); if (count >= 2) this->operator()( _vertexArrayPtr[*iptr], _vertexArrayPtr[indicies[0]], _treatVertexDataAsTemporary ); } break; case(GL_TRIANGLES): case(GL_TRIANGLE_STRIP): case(GL_QUADS): case(GL_QUAD_STRIP): case(GL_POLYGON): case(GL_TRIANGLE_FAN): case(GL_POINTS): default: // can't be converted into to lines. break; } }
virtual void osgEarth::Symbology::LineFunctor< T >::drawElements | ( | GLenum | mode, |
GLsizei | count, | ||
const GLuint * | indicies | ||
) | [inline, virtual] |
Definition at line 206 of file LineFunctor.
{ if (indicies==0 || count==0) return; typedef const GLuint* IndexPointer; switch(mode) { case(GL_LINES): { IndexPointer ilast = &indicies[count]; for(IndexPointer iptr=indicies; iptr<ilast; iptr+=2) this->operator()( _vertexArrayPtr[*iptr], _vertexArrayPtr[*(iptr+1)], _treatVertexDataAsTemporary ); } break; case(GL_LINE_STRIP): { IndexPointer ilast = &indicies[count-1]; for(IndexPointer iptr=indicies; iptr<ilast; iptr++) this->operator()( _vertexArrayPtr[*iptr], _vertexArrayPtr[*(iptr+1)], _treatVertexDataAsTemporary ); } break; case(GL_LINE_LOOP): { IndexPointer ilast = &indicies[count-1]; IndexPointer iptr; for(iptr=indicies; iptr<ilast; iptr++) this->operator()( _vertexArrayPtr[*iptr], _vertexArrayPtr[*(iptr+1)], _treatVertexDataAsTemporary ); if (count >= 2) this->operator()( _vertexArrayPtr[*iptr], _vertexArrayPtr[indicies[0]], _treatVertexDataAsTemporary ); } break; case(GL_TRIANGLES): case(GL_TRIANGLE_STRIP): case(GL_QUADS): case(GL_QUAD_STRIP): case(GL_POLYGON): case(GL_TRIANGLE_FAN): case(GL_POINTS): default: // can't be converted into to lines. break; } }
virtual void osgEarth::Symbology::LineFunctor< T >::end | ( | ) | [inline, virtual] |
Definition at line 274 of file LineFunctor.
{ if (!_vertexCache.empty()) { setVertexArray(_vertexCache.size(),&_vertexCache.front()); _treatVertexDataAsTemporary = true; drawArrays(_modeCache,0,_vertexCache.size()); } }
bool osgEarth::Symbology::LineFunctor< T >::getTreatVertexDataAsTemporary | ( | ) | const [inline] |
Definition at line 49 of file LineFunctor.
{ return _treatVertexDataAsTemporary; }
void osgEarth::Symbology::LineFunctor< T >::setTreatVertexDataAsTemporary | ( | bool | treatVertexDataAsTemporary | ) | [inline] |
Definition at line 48 of file LineFunctor.
{ _treatVertexDataAsTemporary=treatVertexDataAsTemporary; }
virtual void osgEarth::Symbology::LineFunctor< T >::setVertexArray | ( | unsigned int | count, |
const osg::Vec3 * | vertices | ||
) | [inline, virtual] |
Definition at line 52 of file LineFunctor.
{ _vertexArraySize = count; _vertexArrayPtr = vertices; }
virtual void osgEarth::Symbology::LineFunctor< T >::setVertexArray | ( | unsigned | int, |
const osg::Vec4d * | |||
) | [inline, virtual] |
Definition at line 62 of file LineFunctor.
{ }
virtual void osgEarth::Symbology::LineFunctor< T >::setVertexArray | ( | unsigned | int, |
const osg::Vec2 * | |||
) | [inline, virtual] |
Definition at line 58 of file LineFunctor.
{ }
virtual void osgEarth::Symbology::LineFunctor< T >::setVertexArray | ( | unsigned | int, |
const osg::Vec4 * | |||
) | [inline, virtual] |
Definition at line 59 of file LineFunctor.
{ }
virtual void osgEarth::Symbology::LineFunctor< T >::setVertexArray | ( | unsigned | int, |
const osg::Vec2d * | |||
) | [inline, virtual] |
Definition at line 60 of file LineFunctor.
{ }
virtual void osgEarth::Symbology::LineFunctor< T >::setVertexArray | ( | unsigned | int, |
const osg::Vec3d * | |||
) | [inline, virtual] |
Definition at line 61 of file LineFunctor.
{ }
virtual void osgEarth::Symbology::LineFunctor< T >::vertex | ( | const osg::Vec2 & | vert | ) | [inline, virtual] |
Definition at line 268 of file LineFunctor.
{ _vertexCache.push_back(osg::Vec3(vert[0],vert[1],0.0f)); }
virtual void osgEarth::Symbology::LineFunctor< T >::vertex | ( | float | x, |
float | y, | ||
float | z, | ||
float | w | ||
) | [inline, virtual] |
Definition at line 273 of file LineFunctor.
{ _vertexCache.push_back(osg::Vec3(x,y,z)/w); }
virtual void osgEarth::Symbology::LineFunctor< T >::vertex | ( | const osg::Vec4 & | vert | ) | [inline, virtual] |
Definition at line 270 of file LineFunctor.
{ _vertexCache.push_back(osg::Vec3(vert[0],vert[1],vert[2])/vert[3]); }
virtual void osgEarth::Symbology::LineFunctor< T >::vertex | ( | float | x, |
float | y | ||
) | [inline, virtual] |
Definition at line 271 of file LineFunctor.
{ _vertexCache.push_back(osg::Vec3(x,y,0.0f)); }
virtual void osgEarth::Symbology::LineFunctor< T >::vertex | ( | const osg::Vec3 & | vert | ) | [inline, virtual] |
Definition at line 269 of file LineFunctor.
{ _vertexCache.push_back(vert); }
virtual void osgEarth::Symbology::LineFunctor< T >::vertex | ( | float | x, |
float | y, | ||
float | z | ||
) | [inline, virtual] |
Definition at line 272 of file LineFunctor.
{ _vertexCache.push_back(osg::Vec3(x,y,z)); }
GLenum osgEarth::Symbology::LineFunctor< T >::_modeCache [protected] |
Definition at line 290 of file LineFunctor.
bool osgEarth::Symbology::LineFunctor< T >::_treatVertexDataAsTemporary [protected] |
Definition at line 292 of file LineFunctor.
const osg::Vec3* osgEarth::Symbology::LineFunctor< T >::_vertexArrayPtr [protected] |
Definition at line 288 of file LineFunctor.
unsigned int osgEarth::Symbology::LineFunctor< T >::_vertexArraySize [protected] |
Definition at line 287 of file LineFunctor.
std::vector<osg::Vec3> osgEarth::Symbology::LineFunctor< T >::_vertexCache [protected] |
Definition at line 291 of file LineFunctor.