OpenWalnut
1.5.0dev
|
This is a WGEShaderDefineOptions class which additionally uses a property to automatically control the active options. More...
#include <WGEShaderPropertyDefineOptions.h>
Public Types | |
typedef std::shared_ptr< WGEShaderPropertyDefineOptions > | SPtr |
Convenience typedef for a boost_shared_ptr< WGEShaderPropertyDefineOptions >. More... | |
typedef std::shared_ptr< const WGEShaderPropertyDefineOptions > | ConstSPtr |
Convenience typedef for a boost_shared_ptr< const WGEShaderPropertyDefineOptions >. More... | |
Public Types inherited from WGEShaderDefineOptions | |
typedef std::shared_ptr< WGEShaderDefineOptions > | SPtr |
Shared pointer for this class. More... | |
typedef std::shared_ptr< const WGEShaderDefineOptions > | ConstSPtr |
A const shared pointer for this class. More... | |
typedef std::vector< size_t > | IdxList |
The type of the index list. 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 | |
WGEShaderPropertyDefineOptions (PropType prop, 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. More... | |
WGEShaderPropertyDefineOptions (PropType prop, std::vector< std::string > options) | |
Create a new instance of this class. More... | |
virtual | ~WGEShaderPropertyDefineOptions () |
Destructor. More... | |
PropType | getProperty () const |
Returns the property associated with this instance. More... | |
Public Member Functions inherited from WGEShaderDefineOptions | |
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. More... | |
WGEShaderDefineOptions (std::vector< std::string > options) | |
Create a new instance of this class. More... | |
virtual | ~WGEShaderDefineOptions () |
Destructor. More... | |
virtual std::string | process (const std::string &file, const std::string &code) const |
Process the whole code. More... | |
const IdxList & | getActiveOptions () const |
Returns the currently active option as index. More... | |
std::string | getOptionName (size_t idx) const |
Returns the name of the specified option. More... | |
void | activateOption (size_t idx, bool exclusive=true) |
Activates the option specified. More... | |
void | deactivateOption (size_t idx) |
De-activates the specified option. More... | |
void | activateAllOptions () |
Activates all the options. More... | |
void | deactivateAllOptions () |
De-activates all the options. More... | |
void | addOption (std::string opt) |
Adds the specified string as option which is inserted to the code as "#define NAME" if active. 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 Member Functions | |
void | propUpdated () |
Called by the property update mechanism. More... | |
Private Attributes | |
PropType | m_property |
The property controlling this instance and the active options list. More... | |
boost::signals2::connection | m_connection |
The connection associated with the properties update condition. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from WGEShaderDefineOptions | |
void | setActivationList (const IdxList &newList) |
Sets the specified index list as the new activation list. More... | |
Protected Member Functions inherited from WGEShaderPreprocessor | |
virtual void | updated () |
Fires m_updateCondition which should denote an update in the preprocessor filter. More... | |
This is a WGEShaderDefineOptions class which additionally uses a property to automatically control the active options.
This is very useful if you have some WPropInt or WPropSelection which controls some features in your shader. Especially with WPropSelection Instances, you can even activate multiple options if your selection allows this ( see WPropertyVariable<>::PropertyConstraint for details ). If used with a WPropBool, it is useful to switch on/off an option for example.
Definition at line 54 of file WGEShaderPropertyDefineOptions.h.
typedef std::shared_ptr< const WGEShaderPropertyDefineOptions > WGEShaderPropertyDefineOptions< PropType, PropIndexAdapter >::ConstSPtr |
Convenience typedef for a boost_shared_ptr< const WGEShaderPropertyDefineOptions >.
Definition at line 65 of file WGEShaderPropertyDefineOptions.h.
typedef std::shared_ptr< WGEShaderPropertyDefineOptions > WGEShaderPropertyDefineOptions< PropType, PropIndexAdapter >::SPtr |
Convenience typedef for a boost_shared_ptr< WGEShaderPropertyDefineOptions >.
Definition at line 60 of file WGEShaderPropertyDefineOptions.h.
WGEShaderPropertyDefineOptions< PropType, PropIndexAdapter >::WGEShaderPropertyDefineOptions | ( | PropType | prop, |
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.
The first option is mandatory and is set as default. The specified property controls the activations.
prop | the property controlling this thing. |
first | fist option. Is default. |
option2 | another option |
option3 | another option |
option4 | another option |
option5 | another option |
option6 | another option |
option7 | another option |
option8 | another option |
option9 | another option |
option10 | another option |
Definition at line 209 of file WGEShaderPropertyDefineOptions.h.
References WGEShaderPropertyDefineOptions< PropType, PropIndexAdapter >::m_connection, WGEShaderPropertyDefineOptions< PropType, PropIndexAdapter >::m_property, and WGEShaderPropertyDefineOptions< PropType, PropIndexAdapter >::propUpdated().
WGEShaderPropertyDefineOptions< PropType, PropIndexAdapter >::WGEShaderPropertyDefineOptions | ( | PropType | prop, |
std::vector< std::string > | options | ||
) |
Create a new instance of this class.
The first option is mandatory and is set as default. The specified property controls the activations.
prop | the property controlling this thing. |
options | the list of options. Must have a size greater 0. |
Definition at line 224 of file WGEShaderPropertyDefineOptions.h.
References WGEShaderPropertyDefineOptions< PropType, PropIndexAdapter >::m_connection, WGEShaderPropertyDefineOptions< PropType, PropIndexAdapter >::m_property, and WGEShaderPropertyDefineOptions< PropType, PropIndexAdapter >::propUpdated().
|
virtual |
Destructor.
Definition at line 236 of file WGEShaderPropertyDefineOptions.h.
PropType WGEShaderPropertyDefineOptions< PropType, PropIndexAdapter >::getProperty |
Returns the property associated with this instance.
Definition at line 250 of file WGEShaderPropertyDefineOptions.h.
|
private |
Called by the property update mechanism.
This handles the new value in the property.
Definition at line 243 of file WGEShaderPropertyDefineOptions.h.
Referenced by WGEShaderPropertyDefineOptions< PropType, PropIndexAdapter >::WGEShaderPropertyDefineOptions().
|
private |
The connection associated with the properties update condition.
Definition at line 119 of file WGEShaderPropertyDefineOptions.h.
Referenced by WGEShaderPropertyDefineOptions< PropType, PropIndexAdapter >::WGEShaderPropertyDefineOptions().
|
private |
The property controlling this instance and the active options list.
Definition at line 114 of file WGEShaderPropertyDefineOptions.h.
Referenced by WGEShaderPropertyDefineOptions< PropType, PropIndexAdapter >::WGEShaderPropertyDefineOptions().