Commit 38c06a9a authored by Jan Möbius's avatar Jan Möbius
Browse files

Some more documentation

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@15864 383ad7c9-94d9-4d36-a494-682f7c89f535
parent b2c7f79e
......@@ -22,8 +22,13 @@ The ShaderGenerator class can be used to generate default GLSL shader code.
Via shader specific information stored in the ShaderGenDesc struct in the RenderObject attached to a scene node, we can specify the shader input and output
with the functions ShaderGenerator::initVertexShaderIO and ShaderGenerator::initFragmentShaderIO.
\subsection shaderCache The Shader Cache
The ShaderCache singleton.
The Shader Cache singleton class should be used to manage the used shaders. You can query a shader
from the cache via a shader description. If it is already available, it will be returned from
the cache. Otherwise, it is compiled and linked. This ensures more efficient and
redundancy free shader management. ( ACG::ShaderCache )
\subsection glslShader The GLSL Shader
The Shader class is a helper class for building and using GLSL programs
......
......@@ -59,21 +59,35 @@ namespace ACG {
/** \brief Cache for shaders
*
* This class is a singleton
*
* Query a GLSL::Program via getProgram by specifying a ShaderGenDesc.
* Generates and compiles the shader eventually.
* This class provides a cache for shaders. You can query a GLSL::Program via getProgram
* by specifying a ShaderGenDesc. If the program has already been compiled, it is returned
* from the cache. Otherwise it will be compiled and linked, added to the cache and returned.
* This ensures, that the shader is not compiled and linked every time, it is used.
*
* \note This class is a singleton
*
*/
class ACGDLLEXPORT ShaderCache
{
public:
/// Destructor
virtual ~ShaderCache();
/** \brief Return instance of the ShaderCache singleton
*
* @return Instance
*/
static ShaderCache* getInstance();
/** \brief Query a program from cache
*
* @param _desc Shader description
* @param _usage Additional usage identifier
* @return The program (Either from cache or newly compiled and linked)
*/
GLSL::Program* getProgram(const ShaderGenDesc* _desc, unsigned int _usage = 0);
protected:
......
......@@ -100,7 +100,6 @@ ShaderGenerator is used to collect shader io, uniforms, defines and includes.
The shader main-function is not generated here and must be provided
as a parameter to the buildShaderCode function.
*/
class ACGDLLEXPORT ShaderGenerator
{
public:
......@@ -205,15 +204,15 @@ private:
QStringList genDefines_;
};
/**
ShaderProgGenerator is responsible for generating a matching pair of vertex and fragment shaders.
*/
// A shader modifier can modify uniforms, in/outputs
// and glsl code of vertex and fragment shaders.
// This is useful for global effects like shadow mapping
// and depth peeling, where only a little changes in code are necessary.
/**
*
* A shader modifier can modify uniforms, in/outputs
* and glsl code of vertex and fragment shaders.
* This is useful for global effects like shadow mapping
* and depth peeling, where only a little changes in code are necessary.
*/
class ACGDLLEXPORT ShaderModifier
{
friend class ShaderProgGenerator;
......@@ -230,7 +229,6 @@ public:
virtual void modifyFragmentBeginCode(QStringList* _code) {}
virtual void modifyFragmentEndCode(QStringList* _code) {}
unsigned int getID() {return modifierID_;}
operator unsigned int() const {return modifierID_;}
......@@ -239,6 +237,10 @@ private:
unsigned int modifierID_;
};
/**
ShaderProgGenerator is responsible for generating a matching pair of vertex and fragment shaders.
*/
class ACGDLLEXPORT ShaderProgGenerator
{
public:
......
......@@ -103,10 +103,10 @@ MeshNodeT(const Mesh& _mesh,
bbMin_(FLT_MAX, FLT_MAX, FLT_MAX),
bbMax_(-FLT_MAX, -FLT_MAX, -FLT_MAX)
{
faceList_ = glGenLists (1);
faceList_ = glGenLists (1);
vertexList_ = glGenLists (1);
edgeList_ = glGenLists (1);
anyList_ = glGenLists (3);
edgeList_ = glGenLists (1);
anyList_ = glGenLists (3);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment