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.
75 lines
1.7 KiB
C++
75 lines
1.7 KiB
C++
#if defined(_MSC_VER)
|
|
#pragma warning( disable : 4786 )
|
|
#endif
|
|
|
|
#include "osg/ClipPlane"
|
|
|
|
#include "osgDB/Registry"
|
|
#include "osgDB/Input"
|
|
#include "osgDB/Output"
|
|
|
|
using namespace osg;
|
|
using namespace osgDB;
|
|
|
|
// forward declare functions to use later.
|
|
bool ClipPlane_readLocalData(Object& obj, Input& fr);
|
|
bool ClipPlane_writeLocalData(const Object& obj, Output& fw);
|
|
|
|
// register the read and write functions with the osgDB::Registry.
|
|
RegisterDotOsgWrapperProxy g_ClipPlaneProxy
|
|
(
|
|
osgNew osg::ClipPlane,
|
|
"ClipPlane",
|
|
"Object StateAttribute ClipPlane",
|
|
&ClipPlane_readLocalData,
|
|
&ClipPlane_writeLocalData
|
|
);
|
|
|
|
|
|
bool ClipPlane_readLocalData(Object& obj, Input& fr)
|
|
{
|
|
bool iteratorAdvanced = false;
|
|
|
|
ClipPlane& clipplane = static_cast<ClipPlane&>(obj);
|
|
|
|
if (fr.matchSequence("clipPlaneNum %i"))
|
|
{
|
|
unsigned int num;
|
|
fr[1].getUInt(num);
|
|
clipplane.setClipPlaneNum(num);
|
|
|
|
fr+=2;
|
|
iteratorAdvanced = true;
|
|
}
|
|
|
|
|
|
if (fr.matchSequence("plane %f %f %f %f"))
|
|
{
|
|
double plane[4];
|
|
fr[1].getDouble(plane[0]);
|
|
fr[2].getDouble(plane[1]);
|
|
fr[3].getDouble(plane[2]);
|
|
fr[4].getDouble(plane[3]);
|
|
clipplane.setClipPlane(plane);
|
|
|
|
fr+=5;
|
|
iteratorAdvanced = true;
|
|
}
|
|
|
|
return iteratorAdvanced;
|
|
}
|
|
|
|
|
|
bool ClipPlane_writeLocalData(const Object& obj,Output& fw)
|
|
{
|
|
const ClipPlane& clipplane = static_cast<const ClipPlane&>(obj);
|
|
|
|
fw.indent() << "clipPlaneNum " << clipplane.getClipPlaneNum() <<std::endl;
|
|
|
|
double plane[4];
|
|
clipplane.getClipPlane(plane);
|
|
fw.indent() << "plane " << plane[0] << ' ' << plane[1] << ' ' << plane[2] << ' ' << plane[3] << std::endl;
|
|
return true;
|
|
}
|
|
|