OpenWalnut  1.4.0
Public Types | Public Member Functions | Private Attributes
WGEShaderCodeInjector Class Reference

This preprocessor is able to inject code into a shader. More...

#include <WGEShaderCodeInjector.h>

+ Inheritance diagram for WGEShaderCodeInjector:

List of all members.

Public Types

typedef boost::shared_ptr
< WGEShaderCodeInjector
SPtr
 Shortcut for a shared_ptr.
typedef boost::shared_ptr
< WGEShaderCodeInjector
ConstSPtr
 Shortcut for a const shared_ptr.

Public Member Functions

 WGEShaderCodeInjector (std::string keyword)
 Default constructor.
virtual ~WGEShaderCodeInjector ()
 Destructor.
virtual std::string process (const std::string &file, const std::string &code) const
 Process the whole code.
void setCode (std::string code)
 Define the code that replaces the keyword.

Private Attributes

std::string m_code
 the custom code.
std::string m_keyword
 What to replace.

Detailed Description

This preprocessor is able to inject code into a shader.

It therefore replaces a specified keyword with code.

Definition at line 37 of file WGEShaderCodeInjector.h.


Member Typedef Documentation

Shortcut for a const shared_ptr.

Reimplemented from WGEShaderPreprocessor.

Definition at line 48 of file WGEShaderCodeInjector.h.

typedef boost::shared_ptr< WGEShaderCodeInjector > WGEShaderCodeInjector::SPtr

Shortcut for a shared_ptr.

Reimplemented from WGEShaderPreprocessor.

Definition at line 43 of file WGEShaderCodeInjector.h.


Constructor & Destructor Documentation

WGEShaderCodeInjector::WGEShaderCodeInjector ( std::string  keyword) [explicit]

Default constructor.

Parameters:
keywordthis is replaced by the custom code if existing.

Definition at line 35 of file WGEShaderCodeInjector.cpp.

Destructor.

Definition at line 41 of file WGEShaderCodeInjector.cpp.


Member Function Documentation

std::string WGEShaderCodeInjector::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 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.

Parameters:
codethe code.

Definition at line 74 of file WGEShaderCodeInjector.cpp.

References m_code, and WGEShaderPreprocessor::updated().


Member Data Documentation

std::string WGEShaderCodeInjector::m_code [private]

the custom code.

Definition at line 83 of file WGEShaderCodeInjector.h.

Referenced by process(), and setCode().

std::string WGEShaderCodeInjector::m_keyword [private]

What to replace.

Definition at line 88 of file WGEShaderCodeInjector.h.

Referenced by process().


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