OpenSceneGraph/src/osgPlugins/osg/CullFace.cpp
Robert Osfield 84d2d01163 Added support for osg::MemoryManager which is based upon Paul Nettle's
memory manager published at flipcode.com.  This can be turned on
with the OSG_USE_MEMORY_MANGER option which then uses custom global
new and delete operators as well as provide osgNew and osgDelete macro's
which add ability to log line and file from which calls are made.

Updated osg,osgUtil,osgDB,osgText and osgPlugins/osg to use osgNew/osgDelete,
and fixed memory leaks highlighted by the new memory manager.
2002-03-26 23:52:52 +00:00

70 lines
1.7 KiB
C++

#include "osg/CullFace"
#include "osgDB/Registry"
#include "osgDB/Input"
#include "osgDB/Output"
using namespace osg;
using namespace osgDB;
// forward declare functions to use later.
bool CullFace_readLocalData(Object& obj, Input& fr);
bool CullFace_writeLocalData(const Object& obj, Output& fw);
// register the read and write functions with the osgDB::Registry.
RegisterDotOsgWrapperProxy g_CullFaceFuncProxy
(
osgNew osg::CullFace,
"CullFace",
"Object StateAttribute CullFace",
&CullFace_readLocalData,
&CullFace_writeLocalData
);
bool CullFace_readLocalData(Object& obj,Input& fr)
{
bool iteratorAdvanced = false;
CullFace& cullface = static_cast<CullFace&>(obj);
if (fr[0].matchWord("mode"))
{
if (fr[1].matchWord("FRONT"))
{
cullface.setMode(CullFace::FRONT);
fr+=2;
iteratorAdvanced = true;
}
else if (fr[1].matchWord("BACK"))
{
cullface.setMode(CullFace::BACK);
fr+=2;
iteratorAdvanced = true;
}
else if (fr[1].matchWord("FRONT_AND_BACK"))
{
cullface.setMode(CullFace::FRONT_AND_BACK);
fr+=2;
iteratorAdvanced = true;
}
}
return iteratorAdvanced;
}
bool CullFace_writeLocalData(const Object& obj, Output& fw)
{
const CullFace& cullface = static_cast<const CullFace&>(obj);
switch(cullface.getMode())
{
case(CullFace::FRONT): fw.indent() << "mode FRONT" <<std::endl; break;
case(CullFace::BACK): fw.indent() << "mode BACK" <<std::endl; break;
case(CullFace::FRONT_AND_BACK): fw.indent() << "mode FRONT_AND_BACK" <<std::endl; break;
}
return true;
}