SuperTuxKart
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
TextureShader< C, NUM_TEXTURES, tp > Class Template Reference

Class C needs to be the newly declared shaders class (necessary for the instance template). More...

#include <texture_shader.hpp>

Inheritance diagram for TextureShader< C, NUM_TEXTURES, tp >:
Inheritance graph
[legend]

Public Member Functions

template<typename... Args>
void assignSamplerNames (Args...args)
 The protected interface for setting sampler names - it is only called from instances.
 
template<int N>
void setTextureUnitsImpl ()
 End of recursion, just check if number of arguments is correct.
 
template<int N, typename... TexIds>
void setTextureUnitsImpl (GLuint tex_id, TexIds... args)
 The recursive implementation.
 
template<typename... TexIds>
void setTextureUnits (TexIds... args)
 Public implementation of setTextureUnits.
 
template<int N>
void setTextureHandlesImpl ()
 End of recursion, just checks at compile time if number of arguments is correct.
 
template<int N, typename... HandlesId>
void setTextureHandlesImpl (uint64_t handle, HandlesId... args)
 Recursive implementation of setTextureHandles.
 
template<typename... HandlesId>
void setTextureHandles (HandlesId... ids)
 The protected interface.
 
 ~TextureShader ()
 Destructor which frees al lsampler ids.
 
- Public Member Functions inherited from Shader< C, tp... >
void setUniforms (const Args &... args) const
 Sets the uniforms for this shader.
 
void assignTextureUnit (GLuint index, const char *uniform, T1... rest)
 Variadic top level/public interface.
 
 Shader ()
 Constructor.
 
void loadProgram (AttributeType type, Types ... args)
 Load a list of shaders and links them all together.
 
void drawFullScreenEffect (Args...args)
 
- Public Member Functions inherited from ShaderBase
 ShaderBase ()
 Constructor, which adds the shader to all instantiated shaders (for the reload-all-shaders debug option).
 
int loadTFBProgram (const std::string &vertex_file_path, const char **varyings, unsigned varyingscount)
 Loads a transform feedback buffer shader with a given number of varying parameters.
 
GLuint createVAO ()
 
void use ()
 Activates the shader calling glUseProgram.
 
GLuint getUniformLocation (const char *name)
 

Public Attributes

std::vector< GLuint > m_sampler_ids
 

Private Member Functions

template<unsigned N, typename... Args>
void assignTextureNamesImpl ()
 End of recursive variadic template AssigTextureNames.
 
template<unsigned N, typename... Args>
void assignTextureNamesImpl (GLuint tex_unit, const char *name, SamplerTypeNew sampler_type, Args...args)
 Recursive implementation, peeling the texture unit and name off the list of arguments.
 

Private Attributes

std::vector< GLuint > m_texture_units
 
std::vector< GLenum > m_texture_type
 
std::vector< GLenum > m_texture_location
 

Additional Inherited Members

- Public Types inherited from TextureShaderBase
typedef std::function< void(GLuint, GLuint)> BindFunction
 
- Static Public Member Functions inherited from ShaderBase
static void killShaders ()
 
- Static Public Member Functions inherited from Singleton< T >
static T * getInstance ()
 Used to get the instance.
 
static void kill ()
 Used to kill the singleton, if needed.
 
- Protected Types inherited from ShaderBase
enum  AttributeType { OBJECT , PARTICLES_SIM , PARTICLES_RENDERING , SKINNED_MESH }
 
- Protected Member Functions inherited from TextureShaderBase
GLuint createSamplers (SamplerTypeNew sampler_type)
 
- Protected Member Functions inherited from Shader< C, tp... >
void assignUniforms (U... rest)
 This variadic template collects all names of uniforms in a std::vector.
 
void printFileList (GLint shader_type, const char *filepath, Types ... args)
 Variadic template to print a list of file names.
 
- Protected Member Functions inherited from ShaderBase
template<typename ... Types>
void loadAndAttachShader ()
 Ends recursion.
 
template<typename ... Types>
void loadAndAttachShader (GLint shader_type, const std::string &name, Types ... args)
 
template<typename ... Types>
void loadAndAttachShader (GLint shader_type, const char *name, Types ... args)
 Convenience interface using const char.
 
- Protected Member Functions inherited from Singleton< T >
 Singleton ()
 Constructor.
 
virtual ~Singleton ()
 Destructor.
 
- Static Protected Member Functions inherited from TextureShaderBase
static void bindTextureNearest (GLuint tex_unit, GLuint tex_id)
 
static void bindTextureBilinear (GLuint texture_unit, GLuint tex_id)
 
static void bindTextureBilinearClamped (GLuint tex_unit, GLuint tex_id)
 
static void bindTextureNearestClamped (GLuint tex_unit, GLuint tex_id)
 
static void bindTextureTrilinearAnisotropic (GLuint tex_unit, GLuint tex_id)
 
static void bindTextureSemiTrilinear (GLuint tex_unit, GLuint tex_id)
 
static void bindCubemapTrilinear (GLuint tex_unit, GLuint tex_id)
 
static void bindTextureShadow (GLuint tex_unit, GLuint tex_id)
 
static void bindTrilinearClampedArrayTexture (GLuint tex_unit, GLuint tex_id)
 
static void bindTextureVolume (GLuint tex_unit, GLuint tex_id)
 
static void bindTextureBuffer (GLuint tex_unit, GLuint tex_id)
 
- Protected Attributes inherited from TextureShaderBase
std::vector< BindFunction > m_bind_functions
 
- Protected Attributes inherited from ShaderBase
GLuint m_program
 OpenGL's program id.
 
std::vector< std::shared_ptr< GLuint > > m_shaders
 
- Static Protected Attributes inherited from TextureShaderBase
static BindFunction m_all_bind_functions []
 
static GLuint m_all_texture_types []
 
- Static Protected Attributes inherited from ShaderBase
static std::vector< void(*)()> m_all_kill_functions
 Maintains a list of all shaders.
 

Detailed Description

template<class C, int NUM_TEXTURES, typename... tp>
class TextureShader< C, NUM_TEXTURES, tp >

Class C needs to be the newly declared shaders class (necessary for the instance template).

NUM_TEXTURES is the number of texture units used in this shader. It is used to test at compile time that the right number of arguments are supplied to the variadic functions.

Member Function Documentation

◆ assignTextureNamesImpl()

template<class C , int NUM_TEXTURES, typename... tp>
template<unsigned N, typename... Args>
void TextureShader< C, NUM_TEXTURES, tp >::assignTextureNamesImpl ( )
inlineprivate

End of recursive variadic template AssigTextureNames.

It just checks if the number of arguments is correct.

◆ setTextureHandles()

template<class C , int NUM_TEXTURES, typename... tp>
template<typename... HandlesId>
void TextureShader< C, NUM_TEXTURES, tp >::setTextureHandles ( HandlesId...  ids)
inline

The protected interface.

Parameters
idsThe ids of all texture handls.

◆ setTextureHandlesImpl() [1/2]

template<class C , int NUM_TEXTURES, typename... tp>
template<int N>
void TextureShader< C, NUM_TEXTURES, tp >::setTextureHandlesImpl ( )
inline

End of recursion, just checks at compile time if number of arguments is correct.

Parameters
Nnumber of arguments.

◆ setTextureHandlesImpl() [2/2]

template<class C , int NUM_TEXTURES, typename... tp>
template<int N, typename... HandlesId>
void TextureShader< C, NUM_TEXTURES, tp >::setTextureHandlesImpl ( uint64_t  handle,
HandlesId...  args 
)
inline

Recursive implementation of setTextureHandles.

Parameters
NThe number of the current argument in the recursion (or the recursion depth).
handleThe texture handle to set.

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