ShaderDataFile Class Reference

The underlying data of a shader is loaded from shader files. More...

#include <ShaderDataFile.h>

Inherits IShaderData.

Public Member Functions

 ShaderDataFile (const std::string &shaderFileName, const std::string &shaderVersionDesktop, const std::string &shaderVersionES, GLuint maxLights, bool variableNumberOfLights, bool ambientLighting, bool diffuseLighting, bool specularLighting, bool cubicReflectionMap)
 Constructor. More...
 
 ShaderDataFile (const std::string &vertShaderFileName, const std::string &fragShaderFileName, const std::string &shaderVersionDesktop, const std::string &shaderVersionES, GLuint maxLights, bool variableNumberOfLights, bool ambientLighting, bool diffuseLighting, bool specularLighting, bool cubicReflectionMap)
 Constructor. More...
 
virtual ~ShaderDataFile ()
 Virtual destructor. More...
 
ShaderDataFileload (const std::string &shaderFileName)
 Loads shader from file. More...
 
ShaderDataFileload (const std::string &vertShaderFileName, const std::string &fragShaderFileName)
 Loads shader from file. More...
 
std::string getVertShaderSrc () const
 Gets the source code of the vertex shader as a string. More...
 
std::string getFragShaderSrc () const
 Gets the source code of the fragment shader as a string. More...
 
GLuint getMaxLights () const
 Get the maximum number of lights. More...
 
bool supportsVariableNumberOfLights () const
 Returns true if the number of lights is variable in the shader. More...
 
bool supportsAmbientLighting () const
 Returns true if the shader supports ambient lighting. More...
 
bool supportsDiffuseLighting () const
 Returns true if the shader supports diffuse lighting. More...
 
bool supportsSpecularLighting () const
 Returns true if the shader supports specular lighting. More...
 
bool supportsCubicReflectionMap () const
 Returns true if the shader supports a cubic reflection map. More...
 
bool isValid () const
 Returns true if the shader is valid. More...
 
- Public Member Functions inherited from IShaderData
virtual ~IShaderData ()
 Virtual destructor. More...
 

Detailed Description

The underlying data of a shader is loaded from shader files.

Author
David Steiner

Constructor & Destructor Documentation

ShaderDataFile::ShaderDataFile ( const std::string &  shaderFileName,
const std::string &  shaderVersionDesktop,
const std::string &  shaderVersionES,
GLuint  maxLights,
bool  variableNumberOfLights,
bool  ambientLighting,
bool  diffuseLighting,
bool  specularLighting,
bool  cubicReflectionMap 
)

Constructor.

Parameters
[in]shaderFileNameThe filename of both the vertex and fragment shader (without filename extension!)
[in]shaderVersionDesktopThe shader version to be used for desktop systems
[in]shaderVersionESThe shader version to be used for embedded systems (iOS)
[in]maxLightsThe maximum number of light sources to be used
[in]variableNumberOfLightsTrue if the number of lights may vary, otherwise the number of lights has to be the same as specified as maximum number of lights
[in]ambientLightingSet true if the shader supports ambient lighting
[in]diffuseLightingSet true if the shader supports diffuse lighting
[in]specularLightingSet true if the shader supports specular lighting
[in]cubicReflectionMapSet true if the shader supports a cubic reflection map
ShaderDataFile::ShaderDataFile ( const std::string &  vertShaderFileName,
const std::string &  fragShaderFileName,
const std::string &  shaderVersionDesktop,
const std::string &  shaderVersionES,
GLuint  maxLights,
bool  variableNumberOfLights,
bool  ambientLighting,
bool  diffuseLighting,
bool  specularLighting,
bool  cubicReflectionMap 
)

Constructor.

Parameters
[in]vertShaderFileNameThe filename of the vertex shader (including filename extension!)
[in]fragShaderFileNameThe filename of the fragment shader (including filename extension!)
[in]shaderVersionDesktopThe shader version to be used for desktop systems
[in]shaderVersionESThe shader version to be used for embedded systems (iOS)
[in]maxLightsThe maximum number of light sources to be used
[in]variableNumberOfLightsTrue if the number of lights may vary, otherwise the number of lights has to be the same as specified as maximum number of lights
[in]ambientLightingSet true if the shader supports ambient lighting
[in]diffuseLightingSet true if the shader supports diffuse lighting
[in]specularLightingSet true if the shader supports specular lighting
[in]cubicReflectionMapSet true if the shader supports a cubic reflection map
virtual ShaderDataFile::~ShaderDataFile ( )
inlinevirtual

Virtual destructor.

Member Function Documentation

std::string ShaderDataFile::getFragShaderSrc ( ) const
inlinevirtual

Gets the source code of the fragment shader as a string.

Implements IShaderData.

GLuint ShaderDataFile::getMaxLights ( ) const
inlinevirtual

Get the maximum number of lights.

Implements IShaderData.

std::string ShaderDataFile::getVertShaderSrc ( ) const
inlinevirtual

Gets the source code of the vertex shader as a string.

Implements IShaderData.

bool ShaderDataFile::isValid ( ) const
inlinevirtual

Returns true if the shader is valid.

Implements IShaderData.

ShaderDataFile & ShaderDataFile::load ( const std::string &  shaderFileName)

Loads shader from file.

Parameters
[in]shaderFileNameThe filename of both the vertex and fragment shader (without filename extension!)
ShaderDataFile & ShaderDataFile::load ( const std::string &  vertShaderFileName,
const std::string &  fragShaderFileName 
)

Loads shader from file.

Parameters
[in]vertShaderFileNameThe filename of the vertex shader (including filename extension!)
[in]fragShaderFileNameThe filename of the fragment shader (including filename extension!)
bool ShaderDataFile::supportsAmbientLighting ( ) const
inlinevirtual

Returns true if the shader supports ambient lighting.

Implements IShaderData.

bool ShaderDataFile::supportsCubicReflectionMap ( ) const
inlinevirtual

Returns true if the shader supports a cubic reflection map.

Implements IShaderData.

bool ShaderDataFile::supportsDiffuseLighting ( ) const
inlinevirtual

Returns true if the shader supports diffuse lighting.

Implements IShaderData.

bool ShaderDataFile::supportsSpecularLighting ( ) const
inlinevirtual

Returns true if the shader supports specular lighting.

Implements IShaderData.

bool ShaderDataFile::supportsVariableNumberOfLights ( ) const
inlinevirtual

Returns true if the number of lights is variable in the shader.

Implements IShaderData.