Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions source/gloperate/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ set(headers
${include_path}/pipeline/Stage.inl
${include_path}/pipeline/Pipeline.h
${include_path}/pipeline/AbstractSlot.h
${include_path}/pipeline/AbstractSlot.inl
${include_path}/pipeline/Slot.h
${include_path}/pipeline/Slot.inl
${include_path}/pipeline/Input.h
Expand Down
16 changes: 16 additions & 0 deletions source/gloperate/include/gloperate/pipeline/AbstractSlot.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,19 @@ class GLOPERATE_API AbstractSlot : public cppexpose::AbstractProperty
*/
virtual void onValueInvalidated() = 0;

/**
* @brief
* Check if the Slot is a slot of any type given by the template argument list
*
* @tparam Types
* The variadic template parameter list of all types to check
*
* @return
* 'true' if the slot is of any type given, else 'false'
*/
template <typename... Types>
bool isOfAnyType() const;


protected:
/**
Expand All @@ -293,3 +306,6 @@ class GLOPERATE_API AbstractSlot : public cppexpose::AbstractProperty


} // namespace cppexpose


#include <gloperate/pipeline/AbstractSlot.inl>
68 changes: 68 additions & 0 deletions source/gloperate/include/gloperate/pipeline/AbstractSlot.inl
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@

#pragma once


#include <gloperate/pipeline/Slot.h>


namespace gloperate
{


template <typename T>
class Slot;


} // namespace gloperate


namespace
{


template <typename... Types>
struct isOfAnyTypeHelper;

template <typename T, typename... Types>
struct isOfAnyTypeHelper<T, Types...>
{
static bool value(const gloperate::AbstractSlot * slot)
{
return isOfAnyTypeHelper<T>::value(slot) || isOfAnyTypeHelper<Types...>::value(slot);
}
};

template <typename T>
struct isOfAnyTypeHelper<T>
{
static bool value(const gloperate::AbstractSlot * slot)
{
return dynamic_cast<const gloperate::Slot<T> *>(slot) != nullptr;
}
};

template <>
struct isOfAnyTypeHelper<>
{
static bool value(const gloperate::AbstractSlot * /*slot*/)
{
return false;
}
};


} // namespace


namespace gloperate
{


template <typename... Types>
bool AbstractSlot::isOfAnyType() const
{
return isOfAnyTypeHelper<Types...>::value(this);
}


} // namespace gloperate
29 changes: 24 additions & 5 deletions source/gloperate/include/gloperate/stages/base/ClearStage.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#pragma once


#include <cppassist/typelist/TypeList.h>

#include <cppexpose/plugin/plugin_api.h>

#include <gloperate/gloperate-version.h>
Expand All @@ -22,6 +24,10 @@ namespace gloperate
{


class AbstractClearInput;
class ClearValueAdder;


/**
* @brief
* Stage that clears the screen with a background color
Expand All @@ -31,6 +37,9 @@ namespace gloperate
*/
class GLOPERATE_API ClearStage : public Stage
{
friend class ClearValueAdder;


public:
CPPEXPOSE_DECLARE_COMPONENT(
ClearStage, gloperate::Stage
Expand All @@ -42,13 +51,19 @@ class GLOPERATE_API ClearStage : public Stage
, "v1.0.0"
)

/**
* @brief
* The list of supported types for framebuffer clearing
*/
using SupportedClearValueTypes = cppassist::TypeList<int, float, std::pair<float, int>, Color>;


public:
// Interfaces
RenderInterface renderInterface; ///< Renderinterface to manage render targets inputs and outputs

// Inputs
Input<bool> clear; ///< Flag if buffers should get cleared
Input<bool> clear; ///< Flag if buffers should get cleared


public:
Expand Down Expand Up @@ -76,12 +91,16 @@ class GLOPERATE_API ClearStage : public Stage
virtual void onContextInit(AbstractGLContext * content) override;
virtual void onContextDeinit(AbstractGLContext * content) override;

/**
* @brief
* Reprocess inputs and build up input helper structure for easy clear value and render target association
*/
void reprocessInputs();


protected:
std::vector<Input<Color> *> m_colorValueInputs; ///< Color clear values
std::vector<Input<float> *> m_depthValueInputs; ///< Depth clear values
std::vector<Input<int> *> m_stencilValueInputs; ///< Stencil clear values
std::vector<Input<std::pair<float, int>> *> m_depthStencilValueInputs; ///< Depth-stencil clear values
bool m_reprocessInputs; ///< Recreate input helper structure upon next process
std::vector<std::unique_ptr<AbstractClearInput>> m_clearInputs; ///< Clear values of differing types
};


Expand Down
Loading