From Stephane Lamoliatte, "I added the osg::Program parameters support for the osg plug'in.
Now we could correctly configure geometry shaders in osg files." Notes from Robert Osfield, renamed the names of the parameters to be less GL centric and more human readable.
This commit is contained in:
parent
38f6cddc2c
commit
7cd4641ece
@ -9,6 +9,9 @@ using namespace osg;
|
||||
using namespace osgDB;
|
||||
using namespace std;
|
||||
|
||||
extern bool Geometry_matchPrimitiveModeStr(const char* str, GLenum& mode);
|
||||
extern const char* Geometry_getPrimitiveModeStr(GLenum mode);
|
||||
|
||||
// forward declare functions to use later.
|
||||
bool Program_readLocalData(Object& obj, Input& fr);
|
||||
bool Program_writeLocalData(const Object& obj, Output& fw);
|
||||
@ -29,6 +32,35 @@ bool Program_readLocalData(Object& obj, Input& fr)
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
Program& program = static_cast<Program&>(obj);
|
||||
|
||||
if(fr.matchSequence("GeometryVerticesOut %i"))
|
||||
{
|
||||
unsigned int verticesOut;
|
||||
fr[1].getUInt(verticesOut);
|
||||
program.setParameter(GL_GEOMETRY_VERTICES_OUT_EXT, verticesOut);
|
||||
fr += 2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if(fr.matchSequence("GeometryInputType %w"))
|
||||
{
|
||||
std::string primitiveMode = fr[1].getStr();
|
||||
GLenum mode;
|
||||
if(Geometry_matchPrimitiveModeStr(primitiveMode.c_str(), mode))
|
||||
program.setParameter(GL_GEOMETRY_INPUT_TYPE_EXT, mode);
|
||||
fr += 2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if(fr.matchSequence("GeometryOutputType %w"))
|
||||
{
|
||||
std::string primitiveMode = fr[1].getStr();
|
||||
GLenum mode;
|
||||
if(Geometry_matchPrimitiveModeStr(primitiveMode.c_str(), mode))
|
||||
program.setParameter(GL_GEOMETRY_OUTPUT_TYPE_EXT, mode);
|
||||
fr += 2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
while(fr.matchSequence("AttribBindingLocation %i %w"))
|
||||
{
|
||||
@ -72,6 +104,10 @@ bool Program_readLocalData(Object& obj, Input& fr)
|
||||
bool Program_writeLocalData(const Object& obj,Output& fw)
|
||||
{
|
||||
const Program& program = static_cast<const Program&>(obj);
|
||||
|
||||
fw.indent() << "GeometryVerticesOut " << program.getParameter(GL_GEOMETRY_VERTICES_OUT_EXT) << std::endl;
|
||||
fw.indent() << "GeometryInputType " << Geometry_getPrimitiveModeStr(program.getParameter(GL_GEOMETRY_INPUT_TYPE_EXT)) << std::endl;
|
||||
fw.indent() << "GeometryOutputType " << Geometry_getPrimitiveModeStr(program.getParameter(GL_GEOMETRY_OUTPUT_TYPE_EXT)) << std::endl;
|
||||
|
||||
const Program::AttribBindingList& abl = program.getAttribBindingList();
|
||||
Program::AttribBindingList::const_iterator i;
|
||||
|
Loading…
Reference in New Issue
Block a user