From Stephane Lamoliatte, "Here is a patch wich improves the support for geometry shaders in OpenSceneGraph.
It adds new PrimitiveSet constants for the specific geometry shader primitive types : - LINES_ADJACENCY - LINE_STRIP_ADJACENCY - TRIANGLES_ADJACENCY - TRIANGLE_STRIP_ADJACENCY It also adds some missing features to the glsl reader plug'in. "
This commit is contained in:
parent
41b0c923e6
commit
10deffdc41
@ -172,7 +172,11 @@ class OSG_EXPORT PrimitiveSet : public BufferData
|
|||||||
TRIANGLE_FAN = GL_TRIANGLE_FAN,
|
TRIANGLE_FAN = GL_TRIANGLE_FAN,
|
||||||
QUADS = GL_QUADS,
|
QUADS = GL_QUADS,
|
||||||
QUAD_STRIP = GL_QUAD_STRIP,
|
QUAD_STRIP = GL_QUAD_STRIP,
|
||||||
POLYGON = GL_POLYGON
|
POLYGON = GL_POLYGON,
|
||||||
|
LINES_ADJACENCY = GL_LINES_ADJACENCY_EXT,
|
||||||
|
LINE_STRIP_ADJACENCY = GL_LINE_STRIP_ADJACENCY_EXT,
|
||||||
|
TRIANGLES_ADJACENCY = GL_TRIANGLES_ADJACENCY_EXT,
|
||||||
|
TRIANGLE_STRIP_ADJECENCY = GL_TRIANGLE_STRIP_ADJACENCY_EXT,
|
||||||
};
|
};
|
||||||
|
|
||||||
PrimitiveSet(Type primType=PrimitiveType,GLenum mode=0, int numInstances=0):
|
PrimitiveSet(Type primType=PrimitiveType,GLenum mode=0, int numInstances=0):
|
||||||
|
@ -17,6 +17,7 @@ class ReaderWriterGLSL : public osgDB::ReaderWriter
|
|||||||
supportsExtension("gl","OpenGL Shader Language format");
|
supportsExtension("gl","OpenGL Shader Language format");
|
||||||
supportsExtension("frag","OpenGL Shader Language format");
|
supportsExtension("frag","OpenGL Shader Language format");
|
||||||
supportsExtension("vert","OpenGL Shader Language format");
|
supportsExtension("vert","OpenGL Shader Language format");
|
||||||
|
supportsExtension("geom","OpenGL Shader Language format");
|
||||||
supportsExtension("glsl","OpenGL Shader Language format");
|
supportsExtension("glsl","OpenGL Shader Language format");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,6 +72,7 @@ class ReaderWriterGLSL : public osgDB::ReaderWriter
|
|||||||
// set type based on filename extension, where possible
|
// set type based on filename extension, where possible
|
||||||
if (ext == "frag") shader->setType(osg::Shader::FRAGMENT);
|
if (ext == "frag") shader->setType(osg::Shader::FRAGMENT);
|
||||||
if (ext == "vert") shader->setType(osg::Shader::VERTEX);
|
if (ext == "vert") shader->setType(osg::Shader::VERTEX);
|
||||||
|
if (ext == "geom") shader->setType(osg::Shader::GEOMETRY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rr;
|
return rr;
|
||||||
|
@ -1441,6 +1441,10 @@ bool Geometry_matchPrimitiveModeStr(const char* str,GLenum& mode)
|
|||||||
else if (strcmp(str,"QUADS")==0) mode = PrimitiveSet::QUADS;
|
else if (strcmp(str,"QUADS")==0) mode = PrimitiveSet::QUADS;
|
||||||
else if (strcmp(str,"QUAD_STRIP")==0) mode = PrimitiveSet::QUAD_STRIP;
|
else if (strcmp(str,"QUAD_STRIP")==0) mode = PrimitiveSet::QUAD_STRIP;
|
||||||
else if (strcmp(str,"POLYGON")==0) mode = PrimitiveSet::POLYGON;
|
else if (strcmp(str,"POLYGON")==0) mode = PrimitiveSet::POLYGON;
|
||||||
|
else if (strcmp(str,"LINES_ADJACENCY")==0) mode = PrimitiveSet::LINES_ADJACENCY;
|
||||||
|
else if (strcmp(str,"LINE_STRIP_ADJACENCY")==0) mode = PrimitiveSet::LINE_STRIP_ADJACENCY;
|
||||||
|
else if (strcmp(str,"TRIANGLES_ADJACENCY")==0) mode = PrimitiveSet::TRIANGLES_ADJACENCY;
|
||||||
|
else if (strcmp(str,"TRIANGLE_STRIP_ADJECENCY")==0) mode = PrimitiveSet::TRIANGLE_STRIP_ADJECENCY;
|
||||||
else return false;
|
else return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1460,6 +1464,10 @@ const char* Geometry_getPrimitiveModeStr(GLenum mode)
|
|||||||
case (PrimitiveSet::QUADS) : return "QUADS";
|
case (PrimitiveSet::QUADS) : return "QUADS";
|
||||||
case (PrimitiveSet::QUAD_STRIP) : return "QUAD_STRIP";
|
case (PrimitiveSet::QUAD_STRIP) : return "QUAD_STRIP";
|
||||||
case (PrimitiveSet::POLYGON) : return "POLYGON";
|
case (PrimitiveSet::POLYGON) : return "POLYGON";
|
||||||
|
case (PrimitiveSet::LINES_ADJACENCY) : return "LINES_ADJACENCY";
|
||||||
|
case (PrimitiveSet::LINE_STRIP_ADJACENCY) : return "LINE_STRIP_ADJACENCY";
|
||||||
|
case (PrimitiveSet::TRIANGLES_ADJACENCY) : return "TRIANGLES_ADJACENCY";
|
||||||
|
case (PrimitiveSet::TRIANGLE_STRIP_ADJECENCY) : return "TRIANGLE_STRIP_ADJECENCY";
|
||||||
default : return "UnknownPrimitveType";
|
default : return "UnknownPrimitveType";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user