mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
Unified implementation of filters for CloneSources
All filters now derive from FrameBufferFilter, which is always used in a CloneSource. Default FrameBufferFilter is Passthrough filter. Others are Delay and Image filters. Implemented UI selection of filter type, XML session save and load. Linked ImageFilter to Code editor.
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
#include "FrameBuffer.h"
|
||||
#include "Resource.h"
|
||||
#include "Visitor.h"
|
||||
|
||||
#include "FrameBufferFilter.h"
|
||||
#include "FrameBufferFilter.h"
|
||||
|
||||
const char* FrameBufferFilter::type_label[FrameBufferFilter::FILTER_INVALID] = {
|
||||
"None", "Delay", "Custom"
|
||||
};
|
||||
|
||||
FrameBufferFilter::FrameBufferFilter() : enabled_(true), input_(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void FrameBufferFilter::draw (FrameBuffer *input)
|
||||
{
|
||||
input_ = input;
|
||||
}
|
||||
|
||||
void FrameBufferFilter::accept(Visitor& v)
|
||||
{
|
||||
if (input_)
|
||||
v.visit(*this);
|
||||
}
|
||||
|
||||
PassthroughFilter::PassthroughFilter() : FrameBufferFilter()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
uint PassthroughFilter::texture() const
|
||||
{
|
||||
if (input_)
|
||||
return input_->texture();
|
||||
else
|
||||
return Resource::getTextureBlack();
|
||||
}
|
||||
|
||||
glm::vec3 PassthroughFilter::resolution() const
|
||||
{
|
||||
if (input_)
|
||||
return input_->resolution();
|
||||
else
|
||||
return glm::vec3(1,1,0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user