From Mike Weiblen, "adds sourcefiles for beginnings of .osg fileformat i/o support

> - enhancemens to core GLSL classes to support file i/o"
This commit is contained in:
Robert Osfield
2005-04-07 20:23:58 +00:00
parent c8a3198129
commit 84e8338be1
11 changed files with 373 additions and 34 deletions

View File

@@ -0,0 +1,63 @@
#include "osg/Uniform"
#include "osgDB/Registry"
#include "osgDB/Input"
#include "osgDB/Output"
using namespace osg;
using namespace osgDB;
using namespace std;
// forward declare functions to use later.
bool Uniform_readLocalData(Object& obj, Input& fr);
bool Uniform_writeLocalData(const Object& obj, Output& fw);
// register the read and write functions with the osgDB::Registry.
RegisterDotOsgWrapperProxy g_UniformProxy
(
new osg::Uniform,
"Uniform",
"Object Uniform",
&Uniform_readLocalData,
&Uniform_writeLocalData
);
bool Uniform_readLocalData(Object& obj, Input& fr)
{
bool iteratorAdvanced = false;
Uniform& uniform = static_cast<Uniform&>(obj);
if (fr.matchSequence("type %s"))
{
uniform.setType( Uniform::getTypeId(fr[1].getStr()) );
fr+=2;
iteratorAdvanced = true;
}
if (fr.matchSequence("name %s"))
{
uniform.setName(fr[1].getStr());
fr+=2;
iteratorAdvanced = true;
}
// TODO read uniform value based on type
return iteratorAdvanced;
}
bool Uniform_writeLocalData(const Object& obj,Output& fw)
{
const Uniform& uniform = static_cast<const Uniform&>(obj);
fw.indent() << "type " << uniform.getTypename( uniform.getType() ) << std::endl;
fw.indent() << "name "<< uniform.getName() << std::endl;
// TODO write uniform value based on type
return true;
}