Cafu Engine
ShaderT Class Referenceabstract

This class represents a shader. More...

#include "Shader.hpp"

Inheritance diagram for ShaderT:

Public Member Functions

virtual const std::string & GetName () const =0
 Returns the name of this shader. More...
 
virtual char CanHandleAmbient (const MaterialT &Material) const =0
 Returns if and how well this shader can handle the ambient parts of the Material (fully, limited, or not at all). More...
 
virtual char CanHandleLighting (const MaterialT &Material) const =0
 Returns if and how well this shader can handle the per-lightsource parts of the Material (fully, limited, or not at all). More...
 
virtual bool CanHandleStencilShadowVolumes () const =0
 Returns if this shader can handle the rendering of stencil shadow volumes. More...
 
virtual void Activate ()=0
 This function activates this shader. More...
 
virtual void Deactivate ()=0
 This function deactivates this shader. More...
 
virtual bool NeedsNormals () const =0
 The caller can use these functions in order to learn what attributes and parameters it has to pass-in with the mesh / mesh vertices for the currently bound / activated Material. More...
 
virtual bool NeedsTangentSpace () const =0
 
virtual bool NeedsXYAttrib () const =0
 
virtual void RenderMesh (const MatSys::MeshT &Mesh)=0
 Renders the Mesh, using the renderers currently bound material. More...
 

Protected Member Functions

 ShaderT ()
 The constructor registers this shader at the global shader repository. More...
 
virtual ~ShaderT ()
 Mark the destructor as being virtual (g++ 4.x raises a warning otherwise). More...
 

Detailed Description

This class represents a shader.

A shader works together with a material for rendering a chunk of geometry with that material. However, a shader does not handle the rendering itself, it only sets up the appropriate API state.

Constructor & Destructor Documentation

ShaderT::ShaderT ( )
protected

The constructor registers this shader at the global shader repository.

It is protected so that only derived classes can be instantiated. TODO: Make the default ctor private, and e.g. ShaderT(std::string Name_) protected?

virtual ShaderT::~ShaderT ( )
inlineprotectedvirtual

Mark the destructor as being virtual (g++ 4.x raises a warning otherwise).

Member Function Documentation

virtual char ShaderT::CanHandleAmbient ( const MaterialT Material) const
pure virtual

Returns if and how well this shader can handle the ambient parts of the Material (fully, limited, or not at all).

Returns 0 if this shader cannot handle the Material at all. Returns 255 if this shader is sure that it can fully handle the Material at maxmimum quality. Returns a number between 1 and 254 if this shader provides limited handling of the Material. The higher the number, the better the provided quality and the less the limitations. The advantage over simple true/false statements is that not every shader needs detail knowledge about every other shader in this renderer.

Implemented in Shader_L_Diff_Norm_Spec, Shader_A_WaterWithCubeReflection, Shader_L_Diff_Norm, Shader_L_Diff_Spec, Shader_L_Diff, Shader_A_Diff_Light_Norm_Luma, Shader_A_Diff_Light_Norm, Shader_A_Terrain, Shader_A_Diff_Light_Luma, Shader_A_SkyDome, Shader_A_Diff_Norm_Luma, Shader_A_Diff_Light, Shader_A_Diff_Luma, Shader_A_Diff_Norm, Shader_A_Diff, Shader_A_Solid, and Shader_StencilShadowVolumes.

virtual char ShaderT::CanHandleLighting ( const MaterialT Material) const
pure virtual

Returns if and how well this shader can handle the per-lightsource parts of the Material (fully, limited, or not at all).

Returns 0 if this shader cannot handle the Material at all. Returns 255 if this shader is sure that it can fully handle the Material at maxmimum quality. Returns a number between 1 and 254 if this shader provides limited handling of the Material. The higher the number, the better the provided quality and the less the limitations. The advantage over simple true/false statements is that not every shader needs detail knowledge about every other shader in this renderer.

Implemented in Shader_L_Diff_Norm_Spec, Shader_A_WaterWithCubeReflection, Shader_L_Diff_Norm, Shader_L_Diff_Spec, Shader_A_Diff_Light_Norm_Luma, Shader_A_Diff_Light_Norm, Shader_L_Diff, Shader_A_Terrain, Shader_A_Diff_Light_Luma, Shader_A_Diff_Norm_Luma, Shader_A_Diff_Light, Shader_A_SkyDome, Shader_A_Diff_Luma, Shader_A_Diff_Norm, Shader_A_Diff, Shader_A_Solid, and Shader_StencilShadowVolumes.

virtual bool ShaderT::CanHandleStencilShadowVolumes ( ) const
pure virtual
virtual const std::string& ShaderT::GetName ( ) const
pure virtual

Returns the name of this shader.

IMPLEMENTORS: Shader names must be unique and renderer-independent, e.g. "MyCarPaintMetallicBlue1" (such that Materials that specify a specific Shader are also renderer-independent).

Implemented in Shader_L_Diff_Norm_Spec, Shader_A_WaterWithCubeReflection, Shader_L_Diff_Norm, Shader_L_Diff_Spec, Shader_L_Diff, Shader_A_Diff_Light_Norm_Luma, Shader_A_Diff_Light_Norm, Shader_A_Terrain, Shader_A_Diff_Light_Luma, Shader_A_SkyDome, Shader_A_Diff_Norm_Luma, Shader_A_Diff_Light, Shader_A_Diff_Luma, Shader_A_Diff_Norm, Shader_A_Diff, Shader_A_Solid, and Shader_StencilShadowVolumes.

virtual bool ShaderT::NeedsNormals ( ) const
pure virtual

The caller can use these functions in order to learn what attributes and parameters it has to pass-in with the mesh / mesh vertices for the currently bound / activated Material.

Implemented in Shader_L_Diff_Norm_Spec, Shader_A_WaterWithCubeReflection, Shader_L_Diff_Norm, Shader_L_Diff_Spec, Shader_L_Diff, Shader_A_Diff_Light_Norm_Luma, Shader_A_Diff_Light_Norm, Shader_A_Terrain, Shader_A_Diff_Light_Luma, Shader_A_Diff_Norm_Luma, Shader_A_Diff_Light, Shader_A_SkyDome, Shader_A_Diff_Luma, Shader_A_Diff_Norm, Shader_A_Diff, Shader_A_Solid, and Shader_StencilShadowVolumes.


The documentation for this class was generated from the following files: