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

80
src/osg/CullFace.cpp Normal file
View File

@@ -0,0 +1,80 @@
#include "osg/GL"
#include "osg/CullFace"
#include "osg/Output"
#include "osg/Input"
using namespace osg;
CullFace::CullFace()
{
_mode = BACK;
}
CullFace::~CullFace()
{
}
CullFace* CullFace::instance()
{
static ref_ptr<CullFace> s_CullFace(new CullFace);
return s_CullFace.get();
}
void CullFace::enable( void )
{
glEnable( GL_CULL_FACE );
}
void CullFace::disable( void )
{
glDisable( GL_CULL_FACE );
}
void CullFace::apply()
{
glCullFace((GLenum)_mode);
}
bool CullFace::readLocalData(Input& fr)
{
bool iteratorAdvanced = false;
if (fr[0].matchWord("mode"))
{
if (fr[1].matchWord("FRONT"))
{
_mode = FRONT;
fr+=2;
iteratorAdvanced = true;
}
else if (fr[1].matchWord("BACK"))
{
_mode = BACK;
fr+=2;
iteratorAdvanced = true;
}
else if (fr[1].matchWord("FRONT_AND_BACK"))
{
_mode = FRONT_AND_BACK;
fr+=2;
iteratorAdvanced = true;
}
}
return iteratorAdvanced;
}
bool CullFace::writeLocalData(Output& fw)
{
switch(_mode)
{
case(FRONT): fw.indent() << "mode FRONT" << endl; break;
case(BACK): fw.indent() << "mode BACK" << endl; break;
case(FRONT_AND_BACK): fw.indent() << "mode FRONT_AND_BACK" << endl; break;
}
return true;
}