Initial revision

This commit is contained in:
Don BURNS
2001-01-10 16:32:10 +00:00
parent 7c12eb9361
commit 70208ebc06
461 changed files with 70936 additions and 0 deletions

85
src/osg/PolygonOffset.cpp Normal file
View File

@@ -0,0 +1,85 @@
#include "osg/GL"
#include "osg/PolygonOffset"
#include "osg/Input"
#include "osg/Output"
using namespace osg;
PolygonOffset::PolygonOffset( void )
{
_factor = 0.0f; // are these sensible defaut values?
_units = 0.0f;
}
PolygonOffset::~PolygonOffset( void )
{
}
PolygonOffset* PolygonOffset::instance()
{
static ref_ptr<PolygonOffset> s_PolygonOffset(new PolygonOffset);
return s_PolygonOffset.get();
}
void PolygonOffset::setOffset(float factor,float units)
{
_factor = factor;
_units = units;
}
void PolygonOffset::enable( void )
{
glEnable( GL_POLYGON_OFFSET_FILL);
glEnable( GL_POLYGON_OFFSET_LINE);
glEnable( GL_POLYGON_OFFSET_POINT);
}
void PolygonOffset::disable( void )
{
glDisable( GL_POLYGON_OFFSET_FILL);
glDisable( GL_POLYGON_OFFSET_LINE);
glDisable( GL_POLYGON_OFFSET_POINT);
}
void PolygonOffset::apply( void )
{
glPolygonOffset(_factor,_units);
}
bool PolygonOffset::readLocalData(Input& fr)
{
bool iteratorAdvanced = false;
float data;
if (fr[0].matchWord("factor") && fr[1].getFloat(data))
{
_factor = data;
fr+=2;
iteratorAdvanced = true;
}
if (fr[0].matchWord("units") && fr[1].getFloat(data))
{
_units = data;
fr+=2;
iteratorAdvanced = true;
}
return iteratorAdvanced;
}
bool PolygonOffset::writeLocalData(Output& fw)
{
fw.indent() << "factor " << _factor << endl;
fw.indent() << "units " << _units << endl;
return true;
}