2017-11-06 11:36:01 +00:00
|
|
|
/*
|
|
|
|
* Modern effects for a modern Streamer
|
|
|
|
* Copyright (C) 2017 Michael Fabian Dirks
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2019-08-07 10:43:23 +00:00
|
|
|
|
2019-01-14 10:23:21 +00:00
|
|
|
#include "plugin.hpp"
|
2017-11-06 11:36:01 +00:00
|
|
|
|
2019-08-07 10:43:23 +00:00
|
|
|
extern "C" {
|
|
|
|
#include <obs.h>
|
|
|
|
}
|
|
|
|
|
2018-09-30 16:49:52 +00:00
|
|
|
namespace filter {
|
2019-08-07 10:43:23 +00:00
|
|
|
namespace shader {
|
|
|
|
class shader_factory {
|
|
|
|
obs_source_info _source_info;
|
|
|
|
|
|
|
|
public: // Singleton
|
|
|
|
static void initialize();
|
|
|
|
static void finalize();
|
|
|
|
static std::shared_ptr<shader_factory> get();
|
|
|
|
|
|
|
|
public:
|
|
|
|
shader_factory();
|
|
|
|
~shader_factory();
|
|
|
|
};
|
2017-11-06 11:36:01 +00:00
|
|
|
|
2019-08-07 10:43:23 +00:00
|
|
|
class shader_instance {
|
|
|
|
obs_source_t* _self;
|
|
|
|
bool _active;
|
2017-11-06 11:36:01 +00:00
|
|
|
|
2019-08-07 10:43:23 +00:00
|
|
|
uint32_t _width, _height;
|
2017-11-06 11:36:01 +00:00
|
|
|
|
2019-08-07 10:43:23 +00:00
|
|
|
public:
|
|
|
|
shader_instance(obs_data_t* data, obs_source_t* self);
|
|
|
|
~shader_instance();
|
2017-11-06 11:36:01 +00:00
|
|
|
|
2019-08-07 10:43:23 +00:00
|
|
|
uint32_t width();
|
|
|
|
uint32_t height();
|
2018-04-09 11:28:13 +00:00
|
|
|
|
2019-08-07 10:43:23 +00:00
|
|
|
void properties(obs_properties_t* props);
|
2018-04-09 11:28:13 +00:00
|
|
|
|
2019-08-07 10:43:23 +00:00
|
|
|
void update(obs_data_t* data);
|
2018-04-09 11:28:13 +00:00
|
|
|
|
2019-08-07 10:43:23 +00:00
|
|
|
void activate();
|
|
|
|
void deactivate();
|
2018-11-07 14:24:25 +00:00
|
|
|
|
2019-08-07 10:43:23 +00:00
|
|
|
void video_tick(float_t sec_since_last);
|
|
|
|
void video_render(gs_effect_t* effect);
|
2017-11-06 11:36:01 +00:00
|
|
|
};
|
2019-08-07 10:43:23 +00:00
|
|
|
} // namespace shader
|
2018-11-07 14:24:25 +00:00
|
|
|
} // namespace filter
|