OpenWalnut  1.5.0dev
Public Types | Public Member Functions | Private Attributes | List of all members
WGEShaderDefine< ValueType > Class Template Reference

This class is able to provide arbitrary values as define statements in GLSL code. More...

#include <WGEShaderDefine.h>

+ Inheritance diagram for WGEShaderDefine< ValueType >:
+ Collaboration diagram for WGEShaderDefine< ValueType >:

Public Types

typedef std::shared_ptr< WGEShaderDefine< ValueType > > SPtr
 Shared pointer for this class. More...
 
typedef std::shared_ptr< const WGEShaderDefine< ValueType > > ConstSPtr
 A const shared pointer for this class. More...
 
- Public Types inherited from WGEShaderPreprocessor
typedef std::shared_ptr< WGEShaderPreprocessorSPtr
 Shared pointer for this class. More...
 
typedef std::shared_ptr< const WGEShaderPreprocessorConstSPtr
 A const shared pointer for this class. More...
 

Public Member Functions

 WGEShaderDefine (std::string name, ValueType value=ValueType(0))
 Constructs a define with a given name and initial value. More...
 
virtual ~WGEShaderDefine ()
 Destructor. More...
 
virtual std::string process (const std::string &file, const std::string &code) const
 Process the whole code. More...
 
std::string getName () const
 Returns the name of the define. More...
 
const ValueType & getValue () const
 Returns the current value. More...
 
void setValue (const ValueType &value)
 Sets the new value for this define. More...
 
- Public Member Functions inherited from WGEShaderPreprocessor
 WGEShaderPreprocessor ()
 Default constructor. More...
 
virtual ~WGEShaderPreprocessor ()
 Destructor. More...
 
virtual WCondition::SPtr getChangeCondition () const
 Returns the condition denoting a change in this preprocessor filter. More...
 
void setActive (bool active=true)
 (De-)activates the preprocessor. More...
 
bool getActive () const
 If the preprocessor is active, this returns true. More...
 

Private Attributes

std::string m_name
 The name of the define. More...
 
ValueType m_value
 The value of the define as a string. More...
 

Additional Inherited Members

- Protected Member Functions inherited from WGEShaderPreprocessor
virtual void updated ()
 Fires m_updateCondition which should denote an update in the preprocessor filter. More...
 

Detailed Description

template<typename ValueType = bool>
class WGEShaderDefine< ValueType >

This class is able to provide arbitrary values as define statements in GLSL code.

Definition at line 40 of file WGEShaderDefine.h.

Member Typedef Documentation

◆ ConstSPtr

template<typename ValueType = bool>
typedef std::shared_ptr< const WGEShaderDefine< ValueType > > WGEShaderDefine< ValueType >::ConstSPtr

A const shared pointer for this class.

Definition at line 51 of file WGEShaderDefine.h.

◆ SPtr

template<typename ValueType = bool>
typedef std::shared_ptr< WGEShaderDefine< ValueType > > WGEShaderDefine< ValueType >::SPtr

Shared pointer for this class.

Definition at line 46 of file WGEShaderDefine.h.

Constructor & Destructor Documentation

◆ WGEShaderDefine()

template<typename ValueType >
WGEShaderDefine< ValueType >::WGEShaderDefine ( std::string  name,
ValueType  value = ValueType( 0 ) 
)

Constructs a define with a given name and initial value.

Parameters
namename of the define
valuethe initial value.

Definition at line 111 of file WGEShaderDefine.h.

◆ ~WGEShaderDefine()

template<typename ValueType >
WGEShaderDefine< ValueType >::~WGEShaderDefine
virtual

Destructor.

Definition at line 120 of file WGEShaderDefine.h.

Member Function Documentation

◆ getName()

template<typename ValueType >
std::string WGEShaderDefine< ValueType >::getName

Returns the name of the define.

Returns
the name

Definition at line 136 of file WGEShaderDefine.h.

Referenced by WGEShader::setDefine().

+ Here is the caller graph for this function:

◆ getValue()

template<typename ValueType >
const ValueType & WGEShaderDefine< ValueType >::getValue

Returns the current value.

Returns
the current value

Definition at line 142 of file WGEShaderDefine.h.

◆ process()

template<typename ValueType >
std::string WGEShaderDefine< ValueType >::process ( const std::string &  file,
const std::string &  code 
) const
virtual

Process the whole code.

It is not allowed to modify some internal state in this function because it might be called by several shaders.

Parameters
codethe code to process
filethe filename of the shader currently processed. Should be used for debugging output.
Returns
the resulting new code

Implements WGEShaderPreprocessor.

Definition at line 126 of file WGEShaderDefine.h.

References string_utils::toString().

+ Here is the call graph for this function:

◆ setValue()

template<typename ValueType >
void WGEShaderDefine< ValueType >::setValue ( const ValueType &  value)

Sets the new value for this define.

Causes an reload of all associated shaders.

Parameters
valuethe new value.

Definition at line 148 of file WGEShaderDefine.h.

Referenced by WMDirectVolumeRendering::moduleMain(), WMTemplateShaders::moduleMain(), WGEShader::setDefine(), and WGEShaderPropertyDefine< PropertyType >::setNewValue().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_name

template<typename ValueType = bool>
std::string WGEShaderDefine< ValueType >::m_name
private

The name of the define.

Definition at line 102 of file WGEShaderDefine.h.

◆ m_value

template<typename ValueType = bool>
ValueType WGEShaderDefine< ValueType >::m_value
private

The value of the define as a string.

Definition at line 107 of file WGEShaderDefine.h.


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