Moved the body of the getNumPrimitives() into the .cpp.

This commit is contained in:
Robert Osfield
2005-12-03 00:03:31 +00:00
parent 85f79a6639
commit b16f40e5ab
2 changed files with 38 additions and 34 deletions

View File

@@ -17,6 +17,24 @@
using namespace osg;
unsigned int PrimitiveSet::getNumPrimitives() const
{
switch(_mode)
{
case(POINTS): return getNumIndices();
case(LINES): return getNumIndices()/2;
case(TRIANGLES): return getNumIndices()/3;
case(QUADS): return getNumIndices()/4;
case(LINE_STRIP):
case(LINE_LOOP):
case(TRIANGLE_STRIP):
case(TRIANGLE_FAN):
case(QUAD_STRIP):
case(POLYGON): return 1;
}
return 0;
}
void DrawArrays::draw(State&, bool) const
{
glDrawArrays(_mode,_first,_count);
@@ -32,6 +50,24 @@ void DrawArrays::accept(PrimitiveIndexFunctor& functor) const
functor.drawArrays(_mode,_first,_count);
}
unsigned int DrawArrayLengths::getNumPrimitives() const
{
switch(_mode)
{
case(POINTS): return getNumIndices();
case(LINES): return getNumIndices()/2;
case(TRIANGLES): return getNumIndices()/3;
case(QUADS): return getNumIndices()/4;
case(LINE_STRIP):
case(LINE_LOOP):
case(TRIANGLE_STRIP):
case(TRIANGLE_FAN):
case(QUAD_STRIP):
case(POLYGON): return size();
}
return 0;
}
void DrawArrayLengths::draw(State&, bool) const
{
GLint first = _first;