Write a small filter, that pads every shader into a class and set a namespace that acts kinda like a category (e.g. class Gauss
in namespace GLSL::FILTER::BLUR
). The result is my glslfilter.py python-script.
FILE_PATTERNS: *.frag, *.vert
FILTER_PATTERNS: "*.frag=./glslfilter.py", "*.vert=./glslfilter.py"
EXTENSION_MAPPING=.frag=C++, .vert=C++
(thanks the_summer)@class
to set the class name@namespace
to set the namespace – a categoryIf you set no name, the script will use the bare filename and the default namespace is “GLSL”.
Of course you can further document your shader with doxytags – they are fully processed by Doxygen. The only limitation here (blame my lazyness or my thought it just wasn’t worth it) is that you have to put the “class” comment (= the shader information) at the very beginning in one big blockcomment starting with /*
or /**
. But seriously – why would you comment it in any other way? ;-)
To better illustrate the procedure here’s a little GLSL fragment shader:
/** * A simple 3x3 gaussian convolution filter, non-separated version * @author Sebastian Schaefer * @date 2012 * @namespace GLSL::FILTER::BLUR * @class Gauss3x3 */ #version 150 core uniform sampler2D image; ///< the input image in vec2 tex; ///< texture coordinated out vec4 color; ///< the color output /** * The main routine: read the 3x3 neighbours and multiply with kernel */ void main() { ... }
Click here to see how the above example can look like.
Grab the filter at my github-repository github.com/numb3r23/glslAdditions
This page might get updated so please link to this page only, not the direct download. thank you!
—
edit: moved source to github