31 #include "../../common/exceptions/WPreconditionNotMet.h"
32 #include "WGEShaderDefineOptions.h"
35 std::string option2, std::string option3, std::string option4, std::string option5,
36 std::string option6, std::string option7, std::string option8, std::string option9,
37 std::string option10 ):
39 m_options( 1, first ),
43 if( !option2.empty() )
47 if( !option3.empty() )
51 if( !option4.empty() )
55 if( !option5.empty() )
59 if( !option6.empty() )
63 if( !option7.empty() )
67 if( !option8.empty() )
71 if( !option9.empty() )
75 if( !option10.empty() )
86 WPrecond( options.size() >= 1,
"You need to specify at least one option." );
102 std::stringstream ss;
103 for( IdxList::const_iterator iter =
m_idx.begin(); iter !=
m_idx.end(); ++iter )
120 WPrecond( idx <
m_options.size(),
"Index invalid." );
126 WPrecond( idx <
m_options.size(),
"Index invalid." );
129 if( (
m_idx.size() == 1 ) && (
m_idx[ 0 ] == idx ) )
142 m_idx.push_back( idx );
149 IdxList::iterator iter = std::find(
m_idx.begin(),
m_idx.end(), idx );
150 if( iter !=
m_idx.end() )
160 for(
size_t i = 0; i <
m_options.size(); ++i )
162 m_idx.push_back( i );
177 WPrecond( !opt.empty(),
"Options need to have a non-empty name." );
189 if(
m_idx != newList )
void activateAllOptions()
Activates all the options.
virtual ~WGEShaderDefineOptions()
Destructor.
void deactivateOption(size_t idx)
De-activates the specified option.
WGEShaderDefineOptions(std::string first, std::string option2="", std::string option3="", std::string option4="", std::string option5="", std::string option6="", std::string option7="", std::string option8="", std::string option9="", std::string option10="")
Create a new instance of this class.
std::vector< std::string > m_options
The list of options.
IdxList m_idx
The currently selected options.
const IdxList & getActiveOptions() const
Returns the currently active option as index.
void deactivateAllOptions()
De-activates all the options.
std::vector< size_t > IdxList
The type of the index list.
std::string getOptionName(size_t idx) const
Returns the name of the specified option.
void setActivationList(const IdxList &newList)
Sets the specified index list as the new activation list.
virtual std::string process(const std::string &file, const std::string &code) const
Process the whole code.
void addOption(std::string opt)
Adds the specified string as option which is inserted to the code as "#define NAME" if active.
void activateOption(size_t idx, bool exclusive=true)
Activates the option specified.
Base class for each preprocessing possible to shader code.
virtual void updated()
Fires m_updateCondition which should denote an update in the preprocessor filter.
bool getActive() const
If the preprocessor is active, this returns true.