Checked in Macro Jez's additions to osgText to support .osg IO make it
a fully functioning NodeKit. Also reimplement notify() to try an prevent a crash which has been caused by to objects in notify.cpp being initiliazed twice, the second time the auto_ptr holding the dev/null ofstream was being initilized to 0.
This commit is contained in:
49
src/osgPlugins/osg/Projection.cpp
Normal file
49
src/osgPlugins/osg/Projection.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
#include <osg/Projection>
|
||||
#include <osg/Matrix>
|
||||
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgDB;
|
||||
|
||||
// forward declare functions to use later.
|
||||
bool Projection_readLocalData(Object& obj, Input& fr);
|
||||
bool Projection_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_ProjectionProxy
|
||||
(
|
||||
osgNew osg::Projection,
|
||||
"Projection",
|
||||
"Object Node Group Projection",
|
||||
&Projection_readLocalData,
|
||||
&Projection_writeLocalData
|
||||
);
|
||||
|
||||
bool Projection_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
Projection &myobj = static_cast<Projection &>(obj);
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
static Matrix s_matrix;
|
||||
|
||||
if (Matrix* tmpMatrix = static_cast<Matrix*>(fr.readObjectOfType(s_matrix)))
|
||||
{
|
||||
myobj.setMatrix(*tmpMatrix);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
|
||||
bool Projection_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const Projection& myobj = static_cast<const Projection&>(obj);
|
||||
|
||||
fw.writeObject(myobj.getMatrix());
|
||||
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user