OpenWalnut  1.5.0dev
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
WGEShaderPropertyDefineOptions< PropType, PropIndexAdapter > Class Template Reference

This is a WGEShaderDefineOptions class which additionally uses a property to automatically control the active options. More...

#include <WGEShaderPropertyDefineOptions.h>

+ Inheritance diagram for WGEShaderPropertyDefineOptions< PropType, PropIndexAdapter >:
+ Collaboration diagram for WGEShaderPropertyDefineOptions< PropType, PropIndexAdapter >:

Public Types

typedef std::shared_ptr< WGEShaderPropertyDefineOptionsSPtr
 Convenience typedef for a boost_shared_ptr< WGEShaderPropertyDefineOptions >. More...
 
typedef std::shared_ptr< const WGEShaderPropertyDefineOptionsConstSPtr
 Convenience typedef for a boost_shared_ptr< const WGEShaderPropertyDefineOptions >. More...
 
- Public Types inherited from WGEShaderDefineOptions
typedef std::shared_ptr< WGEShaderDefineOptionsSPtr
 Shared pointer for this class. More...
 
typedef std::shared_ptr< const WGEShaderDefineOptionsConstSPtr
 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< WGEShaderPreprocessorSPtr
 Shared pointer for this class. More...
 
typedef std::shared_ptr< const WGEShaderPreprocessorConstSPtr
 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 IdxListgetActiveOptions () 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...
 

Detailed Description

template<typename PropType = WPropSelection, typename PropIndexAdapter = WGEShaderPropertyDefineOptionsIndexAdapter< PropType >>
class WGEShaderPropertyDefineOptions< PropType, PropIndexAdapter >

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.

Note
You can use inherited WGEShaderDefineOptions methods too. This might create some kind of inconsistency since they of course do not update the property.

Definition at line 54 of file WGEShaderPropertyDefineOptions.h.

Member Typedef Documentation

◆ ConstSPtr

template<typename PropType = WPropSelection, typename PropIndexAdapter = WGEShaderPropertyDefineOptionsIndexAdapter< PropType >>
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.

◆ SPtr

template<typename PropType = WPropSelection, typename PropIndexAdapter = WGEShaderPropertyDefineOptionsIndexAdapter< PropType >>
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.

Constructor & Destructor Documentation

◆ WGEShaderPropertyDefineOptions() [1/2]

template<typename PropType , typename PropIndexAdapter >
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.

Parameters
propthe property controlling this thing.
firstfist option. Is default.
option2another option
option3another option
option4another option
option5another option
option6another option
option7another option
option8another option
option9another option
option10another 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().

+ Here is the call graph for this function:

◆ WGEShaderPropertyDefineOptions() [2/2]

template<typename PropType , typename PropIndexAdapter >
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.

Parameters
propthe property controlling this thing.
optionsthe 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().

+ Here is the call graph for this function:

◆ ~WGEShaderPropertyDefineOptions()

template<typename PropType , typename PropIndexAdapter >
WGEShaderPropertyDefineOptions< PropType, PropIndexAdapter >::~WGEShaderPropertyDefineOptions
virtual

Destructor.

Definition at line 236 of file WGEShaderPropertyDefineOptions.h.

Member Function Documentation

◆ getProperty()

template<typename PropType , typename PropIndexAdapter >
PropType WGEShaderPropertyDefineOptions< PropType, PropIndexAdapter >::getProperty

Returns the property associated with this instance.

Returns

Definition at line 250 of file WGEShaderPropertyDefineOptions.h.

◆ propUpdated()

template<typename PropType , typename PropIndexAdapter >
void WGEShaderPropertyDefineOptions< PropType, PropIndexAdapter >::propUpdated
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().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_connection

template<typename PropType = WPropSelection, typename PropIndexAdapter = WGEShaderPropertyDefineOptionsIndexAdapter< PropType >>
boost::signals2::connection WGEShaderPropertyDefineOptions< PropType, PropIndexAdapter >::m_connection
private

The connection associated with the properties update condition.

Definition at line 119 of file WGEShaderPropertyDefineOptions.h.

Referenced by WGEShaderPropertyDefineOptions< PropType, PropIndexAdapter >::WGEShaderPropertyDefineOptions().

◆ m_property

template<typename PropType = WPropSelection, typename PropIndexAdapter = WGEShaderPropertyDefineOptionsIndexAdapter< PropType >>
PropType WGEShaderPropertyDefineOptions< PropType, PropIndexAdapter >::m_property
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().


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