OpenWalnut
1.5.0dev
|
This preprocessor is able to inject code into a shader. More...
#include <WGEShaderCodeInjector.h>
Public Types | |
typedef std::shared_ptr< WGEShaderCodeInjector > | SPtr |
Shortcut for a shared_ptr. More... | |
typedef std::shared_ptr< WGEShaderCodeInjector > | ConstSPtr |
Shortcut for a const shared_ptr. More... | |
Public Types inherited from WGEShaderPreprocessor | |
typedef std::shared_ptr< WGEShaderPreprocessor > | SPtr |
Shared pointer for this class. More... | |
typedef std::shared_ptr< const WGEShaderPreprocessor > | ConstSPtr |
A const shared pointer for this class. More... | |
Public Member Functions | |
WGEShaderCodeInjector (std::string keyword) | |
Default constructor. More... | |
virtual | ~WGEShaderCodeInjector () |
Destructor. More... | |
virtual std::string | process (const std::string &file, const std::string &code) const |
Process the whole code. More... | |
void | setCode (std::string code) |
Define the code that replaces the keyword. 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_code |
the custom code. More... | |
std::string | m_keyword |
What to replace. 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... | |
This preprocessor is able to inject code into a shader.
It therefore replaces a specified keyword with code.
Definition at line 38 of file WGEShaderCodeInjector.h.
typedef std::shared_ptr< WGEShaderCodeInjector > WGEShaderCodeInjector::ConstSPtr |
Shortcut for a const shared_ptr.
Definition at line 49 of file WGEShaderCodeInjector.h.
typedef std::shared_ptr< WGEShaderCodeInjector > WGEShaderCodeInjector::SPtr |
Shortcut for a shared_ptr.
Definition at line 44 of file WGEShaderCodeInjector.h.
|
explicit |
Default constructor.
keyword | this is replaced by the custom code if existing. |
Definition at line 35 of file WGEShaderCodeInjector.cpp.
|
virtual |
Destructor.
Definition at line 41 of file WGEShaderCodeInjector.cpp.
|
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.
code | the code to process |
file | the filename of the shader currently processed. Should be used for debugging output. |
Implements WGEShaderPreprocessor.
Definition at line 46 of file WGEShaderCodeInjector.cpp.
References WGEShaderPreprocessor::getActive(), m_code, and m_keyword.
void WGEShaderCodeInjector::setCode | ( | std::string | code | ) |
Define the code that replaces the keyword.
code | the code. |
Definition at line 74 of file WGEShaderCodeInjector.cpp.
References m_code, and WGEShaderPreprocessor::updated().
|
private |
the custom code.
Definition at line 84 of file WGEShaderCodeInjector.h.
|
private |