project: Rename 'Filter' to 'filter'

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2018-09-30 18:49:52 +02:00
parent da22e72da7
commit 8296af68c6
11 changed files with 167 additions and 167 deletions

View file

@ -58,10 +58,10 @@ extern "C" {
#define S_FILTER_BLUR_COLORFORMAT "Filter.Blur.ColorFormat" #define S_FILTER_BLUR_COLORFORMAT "Filter.Blur.ColorFormat"
// Initializer & Finalizer // Initializer & Finalizer
static Filter::Blur* filterBlurInstance; static filter::Blur* filterBlurInstance;
INITIALIZER(FilterBlurInit) { INITIALIZER(FilterBlurInit) {
initializerFunctions.push_back([] { initializerFunctions.push_back([] {
filterBlurInstance = new Filter::Blur(); filterBlurInstance = new filter::Blur();
}); });
finalizerFunctions.push_back([] { finalizerFunctions.push_back([] {
delete filterBlurInstance; delete filterBlurInstance;
@ -74,7 +74,7 @@ enum ColorFormat : uint64_t {
}; };
// Global Data // Global Data
Filter::Blur::Blur() { filter::Blur::Blur() {
memset(&m_sourceInfo, 0, sizeof(obs_source_info)); memset(&m_sourceInfo, 0, sizeof(obs_source_info));
m_sourceInfo.id = "obs-stream-effects-filter-blur"; m_sourceInfo.id = "obs-stream-effects-filter-blur";
m_sourceInfo.type = OBS_SOURCE_TYPE_FILTER; m_sourceInfo.type = OBS_SOURCE_TYPE_FILTER;
@ -117,11 +117,11 @@ Filter::Blur::Blur() {
obs_register_source(&m_sourceInfo); obs_register_source(&m_sourceInfo);
} }
Filter::Blur::~Blur() { filter::Blur::~Blur() {
m_effects.clear(); m_effects.clear();
} }
void Filter::Blur::generate_gaussian_kernels() { void filter::Blur::generate_gaussian_kernels() {
// 2D texture, horizontal is value, vertical is kernel size. // 2D texture, horizontal is value, vertical is kernel size.
size_t textureSizePOT = GetNearestPowerOfTwoAbove(max_kernel_size); size_t textureSizePOT = GetNearestPowerOfTwoAbove(max_kernel_size);
std::vector<float_t> textureBuffer(textureSizePOT * textureSizePOT); std::vector<float_t> textureBuffer(textureSizePOT * textureSizePOT);
@ -156,17 +156,17 @@ void Filter::Blur::generate_gaussian_kernels() {
} }
} }
void Filter::Blur::generate_kernel_textures() { void filter::Blur::generate_kernel_textures() {
generate_gaussian_kernels(); generate_gaussian_kernels();
} }
const char * Filter::Blur::get_name(void *) { const char * filter::Blur::get_name(void *) {
return P_TRANSLATE(S_FILTER_BLUR); return P_TRANSLATE(S_FILTER_BLUR);
} }
void Filter::Blur::get_defaults(obs_data_t *data) { void filter::Blur::get_defaults(obs_data_t *data) {
obs_data_set_default_int(data, S_TYPE, Filter::Blur::Type::Box); obs_data_set_default_int(data, S_TYPE, filter::Blur::Type::Box);
obs_data_set_default_int(data, S_SIZE, 5); obs_data_set_default_int(data, S_SIZE, 5);
// Bilateral Only // Bilateral Only
@ -188,16 +188,16 @@ void Filter::Blur::get_defaults(obs_data_t *data) {
obs_data_set_default_int(data, S_FILTER_BLUR_COLORFORMAT, ColorFormat::RGB); obs_data_set_default_int(data, S_FILTER_BLUR_COLORFORMAT, ColorFormat::RGB);
} }
obs_properties_t * Filter::Blur::get_properties(void *) { obs_properties_t * filter::Blur::get_properties(void *) {
obs_properties_t *pr = obs_properties_create(); obs_properties_t *pr = obs_properties_create();
obs_property_t* p = NULL; obs_property_t* p = NULL;
p = obs_properties_add_list(pr, S_TYPE, P_TRANSLATE(S_TYPE), OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT); p = obs_properties_add_list(pr, S_TYPE, P_TRANSLATE(S_TYPE), OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT);
obs_property_set_long_description(p, P_TRANSLATE(P_DESC(S_TYPE))); obs_property_set_long_description(p, P_TRANSLATE(P_DESC(S_TYPE)));
obs_property_set_modified_callback(p, modified_properties); obs_property_set_modified_callback(p, modified_properties);
obs_property_list_add_int(p, P_TRANSLATE(S_TYPE_BOX), Filter::Blur::Type::Box); obs_property_list_add_int(p, P_TRANSLATE(S_TYPE_BOX), filter::Blur::Type::Box);
obs_property_list_add_int(p, P_TRANSLATE(S_TYPE_GAUSSIAN), Filter::Blur::Type::Gaussian); obs_property_list_add_int(p, P_TRANSLATE(S_TYPE_GAUSSIAN), filter::Blur::Type::Gaussian);
obs_property_list_add_int(p, P_TRANSLATE(S_TYPE_BILATERAL), Filter::Blur::Type::Bilateral); obs_property_list_add_int(p, P_TRANSLATE(S_TYPE_BILATERAL), filter::Blur::Type::Bilateral);
p = obs_properties_add_int_slider(pr, S_SIZE, P_TRANSLATE(S_SIZE), 1, 25, 1); p = obs_properties_add_int_slider(pr, S_SIZE, P_TRANSLATE(S_SIZE), 1, 25, 1);
obs_property_set_long_description(p, P_TRANSLATE(P_DESC(S_SIZE))); obs_property_set_long_description(p, P_TRANSLATE(P_DESC(S_SIZE)));
@ -241,15 +241,15 @@ obs_properties_t * Filter::Blur::get_properties(void *) {
return pr; return pr;
} }
bool Filter::Blur::modified_properties(obs_properties_t *pr, obs_property_t *, obs_data_t *d) { bool filter::Blur::modified_properties(obs_properties_t *pr, obs_property_t *, obs_data_t *d) {
bool showBilateral = false; bool showBilateral = false;
switch (obs_data_get_int(d, S_TYPE)) { switch (obs_data_get_int(d, S_TYPE)) {
case Filter::Blur::Type::Box: case filter::Blur::Type::Box:
break; break;
case Filter::Blur::Type::Gaussian: case filter::Blur::Type::Gaussian:
break; break;
case Filter::Blur::Type::Bilateral: case filter::Blur::Type::Bilateral:
showBilateral = true; showBilateral = true;
break; break;
} }
@ -279,43 +279,43 @@ bool Filter::Blur::modified_properties(obs_properties_t *pr, obs_property_t *, o
return true; return true;
} }
void * Filter::Blur::create(obs_data_t *data, obs_source_t *source) { void * filter::Blur::create(obs_data_t *data, obs_source_t *source) {
return new Instance(data, source); return new Instance(data, source);
} }
void Filter::Blur::destroy(void *ptr) { void filter::Blur::destroy(void *ptr) {
delete reinterpret_cast<Instance*>(ptr); delete reinterpret_cast<Instance*>(ptr);
} }
uint32_t Filter::Blur::get_width(void *ptr) { uint32_t filter::Blur::get_width(void *ptr) {
return reinterpret_cast<Instance*>(ptr)->get_width(); return reinterpret_cast<Instance*>(ptr)->get_width();
} }
uint32_t Filter::Blur::get_height(void *ptr) { uint32_t filter::Blur::get_height(void *ptr) {
return reinterpret_cast<Instance*>(ptr)->get_height(); return reinterpret_cast<Instance*>(ptr)->get_height();
} }
void Filter::Blur::update(void *ptr, obs_data_t *data) { void filter::Blur::update(void *ptr, obs_data_t *data) {
reinterpret_cast<Instance*>(ptr)->update(data); reinterpret_cast<Instance*>(ptr)->update(data);
} }
void Filter::Blur::activate(void *ptr) { void filter::Blur::activate(void *ptr) {
reinterpret_cast<Instance*>(ptr)->activate(); reinterpret_cast<Instance*>(ptr)->activate();
} }
void Filter::Blur::deactivate(void *ptr) { void filter::Blur::deactivate(void *ptr) {
reinterpret_cast<Instance*>(ptr)->deactivate(); reinterpret_cast<Instance*>(ptr)->deactivate();
} }
void Filter::Blur::video_tick(void *ptr, float time) { void filter::Blur::video_tick(void *ptr, float time) {
reinterpret_cast<Instance*>(ptr)->video_tick(time); reinterpret_cast<Instance*>(ptr)->video_tick(time);
} }
void Filter::Blur::video_render(void *ptr, gs_effect_t *effect) { void filter::Blur::video_render(void *ptr, gs_effect_t *effect) {
reinterpret_cast<Instance*>(ptr)->video_render(effect); reinterpret_cast<Instance*>(ptr)->video_render(effect);
} }
Filter::Blur::Instance::Instance(obs_data_t *data, obs_source_t *context) : m_source(context) { filter::Blur::Instance::Instance(obs_data_t *data, obs_source_t *context) : m_source(context) {
obs_enter_graphics(); obs_enter_graphics();
m_effect = filterBlurInstance->m_effects.at("Box Blur"); m_effect = filterBlurInstance->m_effects.at("Box Blur");
m_primaryRT = gs_texrender_create(GS_RGBA, GS_ZS_NONE); m_primaryRT = gs_texrender_create(GS_RGBA, GS_ZS_NONE);
@ -336,7 +336,7 @@ Filter::Blur::Instance::Instance(obs_data_t *data, obs_source_t *context) : m_so
update(data); update(data);
} }
Filter::Blur::Instance::~Instance() { filter::Blur::Instance::~Instance() {
obs_enter_graphics(); obs_enter_graphics();
gs_texrender_destroy(m_primaryRT); gs_texrender_destroy(m_primaryRT);
gs_texrender_destroy(m_secondaryRT); gs_texrender_destroy(m_secondaryRT);
@ -345,16 +345,16 @@ Filter::Blur::Instance::~Instance() {
obs_leave_graphics(); obs_leave_graphics();
} }
void Filter::Blur::Instance::update(obs_data_t *data) { void filter::Blur::Instance::update(obs_data_t *data) {
m_type = (Type)obs_data_get_int(data, S_TYPE); m_type = (Type)obs_data_get_int(data, S_TYPE);
switch (m_type) { switch (m_type) {
case Filter::Blur::Type::Box: case filter::Blur::Type::Box:
m_effect = filterBlurInstance->m_effects.at("Box Blur"); m_effect = filterBlurInstance->m_effects.at("Box Blur");
break; break;
case Filter::Blur::Type::Gaussian: case filter::Blur::Type::Gaussian:
m_effect = filterBlurInstance->m_effects.at("Gaussian Blur"); m_effect = filterBlurInstance->m_effects.at("Gaussian Blur");
break; break;
case Filter::Blur::Type::Bilateral: case filter::Blur::Type::Bilateral:
m_effect = filterBlurInstance->m_effects.at("Bilateral Blur"); m_effect = filterBlurInstance->m_effects.at("Bilateral Blur");
break; break;
} }
@ -384,21 +384,21 @@ void Filter::Blur::Instance::update(obs_data_t *data) {
} }
} }
uint32_t Filter::Blur::Instance::get_width() { uint32_t filter::Blur::Instance::get_width() {
return 0; return 0;
} }
uint32_t Filter::Blur::Instance::get_height() { uint32_t filter::Blur::Instance::get_height() {
return 0; return 0;
} }
void Filter::Blur::Instance::activate() {} void filter::Blur::Instance::activate() {}
void Filter::Blur::Instance::deactivate() {} void filter::Blur::Instance::deactivate() {}
void Filter::Blur::Instance::video_tick(float) {} void filter::Blur::Instance::video_tick(float) {}
void Filter::Blur::Instance::video_render(gs_effect_t *effect) { void filter::Blur::Instance::video_render(gs_effect_t *effect) {
bool failed = false; bool failed = false;
vec4 black; vec4_zero(&black); vec4 black; vec4_zero(&black);
obs_source_t obs_source_t
@ -635,7 +635,7 @@ void Filter::Blur::Instance::video_render(gs_effect_t *effect) {
} }
} }
bool Filter::Blur::Instance::apply_shared_param(gs_texture_t* input, float texelX, float texelY) { bool filter::Blur::Instance::apply_shared_param(gs_texture_t* input, float texelX, float texelY) {
bool result = true; bool result = true;
result = result && gs_set_param_texture(m_effect->get_object(), "u_image", input); result = result && gs_set_param_texture(m_effect->get_object(), "u_image", input);
@ -681,7 +681,7 @@ bool Filter::Blur::Instance::apply_shared_param(gs_texture_t* input, float texel
return result; return result;
} }
bool Filter::Blur::Instance::apply_bilateral_param() { bool filter::Blur::Instance::apply_bilateral_param() {
gs_eparam_t *param; gs_eparam_t *param;
if (m_type != Type::Bilateral) if (m_type != Type::Bilateral)
@ -708,7 +708,7 @@ bool Filter::Blur::Instance::apply_bilateral_param() {
return true; return true;
} }
bool Filter::Blur::Instance::apply_gaussian_param() { bool filter::Blur::Instance::apply_gaussian_param() {
if (m_effect->has_parameter("kernel")) { if (m_effect->has_parameter("kernel")) {
m_effect->get_parameter("kernel").set_texture(filterBlurInstance->m_gaussianKernelTexture); m_effect->get_parameter("kernel").set_texture(filterBlurInstance->m_gaussianKernelTexture);
} else { } else {

View file

@ -25,7 +25,7 @@
#include <memory> #include <memory>
#include <map> #include <map>
namespace Filter { namespace filter {
class Blur { class Blur {
public: public:
Blur(); Blur();

View file

@ -58,17 +58,17 @@ enum class ShaderType : int64_t {
File File
}; };
static Filter::CustomShader* handler; static filter::CustomShader* handler;
INITIALIZER(HandlerInit) { INITIALIZER(HandlerInit) {
initializerFunctions.push_back([] { initializerFunctions.push_back([] {
handler = new Filter::CustomShader(); handler = new filter::CustomShader();
}); });
finalizerFunctions.push_back([] { finalizerFunctions.push_back([] {
delete handler; delete handler;
}); });
} }
Filter::CustomShader::CustomShader() { filter::CustomShader::CustomShader() {
memset(&sourceInfo, 0, sizeof(obs_source_info)); memset(&sourceInfo, 0, sizeof(obs_source_info));
sourceInfo.id = "obs-stream-effects-filter-custom-shader"; sourceInfo.id = "obs-stream-effects-filter-custom-shader";
sourceInfo.type = OBS_SOURCE_TYPE_FILTER; sourceInfo.type = OBS_SOURCE_TYPE_FILTER;
@ -88,74 +88,74 @@ Filter::CustomShader::CustomShader() {
obs_register_source(&sourceInfo); obs_register_source(&sourceInfo);
} }
Filter::CustomShader::~CustomShader() {} filter::CustomShader::~CustomShader() {}
const char * Filter::CustomShader::get_name(void *) { const char * filter::CustomShader::get_name(void *) {
return P_TRANSLATE(S); return P_TRANSLATE(S);
} }
void Filter::CustomShader::get_defaults(obs_data_t *data) { void filter::CustomShader::get_defaults(obs_data_t *data) {
gfx::effect_source::get_defaults(data); gfx::effect_source::get_defaults(data);
} }
obs_properties_t * Filter::CustomShader::get_properties(void *ptr) { obs_properties_t * filter::CustomShader::get_properties(void *ptr) {
obs_properties_t *pr = obs_properties_create_param(ptr, nullptr); obs_properties_t *pr = obs_properties_create_param(ptr, nullptr);
reinterpret_cast<Instance*>(ptr)->get_properties(pr); reinterpret_cast<Instance*>(ptr)->get_properties(pr);
return pr; return pr;
} }
void * Filter::CustomShader::create(obs_data_t *data, obs_source_t *src) { void * filter::CustomShader::create(obs_data_t *data, obs_source_t *src) {
return new Instance(data, src); return new Instance(data, src);
} }
void Filter::CustomShader::destroy(void *ptr) { void filter::CustomShader::destroy(void *ptr) {
delete reinterpret_cast<Instance*>(ptr); delete reinterpret_cast<Instance*>(ptr);
} }
uint32_t Filter::CustomShader::get_width(void *ptr) { uint32_t filter::CustomShader::get_width(void *ptr) {
return reinterpret_cast<Instance*>(ptr)->get_width(); return reinterpret_cast<Instance*>(ptr)->get_width();
} }
uint32_t Filter::CustomShader::get_height(void *ptr) { uint32_t filter::CustomShader::get_height(void *ptr) {
return reinterpret_cast<Instance*>(ptr)->get_height(); return reinterpret_cast<Instance*>(ptr)->get_height();
} }
void Filter::CustomShader::update(void *ptr, obs_data_t *data) { void filter::CustomShader::update(void *ptr, obs_data_t *data) {
reinterpret_cast<Instance*>(ptr)->update(data); reinterpret_cast<Instance*>(ptr)->update(data);
} }
void Filter::CustomShader::activate(void *ptr) { void filter::CustomShader::activate(void *ptr) {
reinterpret_cast<Instance*>(ptr)->activate(); reinterpret_cast<Instance*>(ptr)->activate();
} }
void Filter::CustomShader::deactivate(void *ptr) { void filter::CustomShader::deactivate(void *ptr) {
reinterpret_cast<Instance*>(ptr)->deactivate(); reinterpret_cast<Instance*>(ptr)->deactivate();
} }
void Filter::CustomShader::video_tick(void *ptr, float time) { void filter::CustomShader::video_tick(void *ptr, float time) {
reinterpret_cast<Instance*>(ptr)->video_tick(time); reinterpret_cast<Instance*>(ptr)->video_tick(time);
} }
void Filter::CustomShader::video_render(void *ptr, gs_effect_t *effect) { void filter::CustomShader::video_render(void *ptr, gs_effect_t *effect) {
reinterpret_cast<Instance*>(ptr)->video_render(effect); reinterpret_cast<Instance*>(ptr)->video_render(effect);
} }
Filter::CustomShader::Instance::Instance(obs_data_t *data, obs_source_t *source) : gfx::effect_source(data, source) { filter::CustomShader::Instance::Instance(obs_data_t *data, obs_source_t *source) : gfx::effect_source(data, source) {
m_defaultShaderPath = "shaders/filter/example.effect"; m_defaultShaderPath = "shaders/filter/example.effect";
m_renderTarget = std::make_shared<gs::rendertarget>(GS_RGBA, GS_ZS_NONE); m_renderTarget = std::make_shared<gs::rendertarget>(GS_RGBA, GS_ZS_NONE);
update(data); update(data);
} }
Filter::CustomShader::Instance::~Instance() {} filter::CustomShader::Instance::~Instance() {}
//void Filter::CustomShader::Instance::update(obs_data_t *data) { //void filter::CustomShader::Instance::update(obs_data_t *data) {
// ShaderType shaderType = (ShaderType)obs_data_get_int(data, S_TYPE); // ShaderType shaderType = (ShaderType)obs_data_get_int(data, S_TYPE);
// if (shaderType == ShaderType::Text) { // if (shaderType == ShaderType::Text) {
// const char* shaderText = obs_data_get_string(data, S_CONTENT_TEXT); // const char* shaderText = obs_data_get_string(data, S_CONTENT_TEXT);
// try { // try {
// m_effect.effect = std::make_unique<gs::effect>(shaderText, "Text Shader"); // m_effect.effect = std::make_unique<gs::effect>(shaderText, "Text Shader");
// } catch (std::runtime_error& ex) { // } catch (std::runtime_error& ex) {
// const char* filterName = obs_source_get_name(m_source); // const char* filterName = obs_source_get_name(source);
// P_LOG_ERROR("[%s] Shader loading failed with error(s): %s", filterName, ex.what()); // P_LOG_ERROR("[%s] Shader loading failed with error(s): %s", filterName, ex.what());
// } // }
// } else if (shaderType == ShaderType::File) { // } else if (shaderType == ShaderType::File) {
@ -299,15 +299,15 @@ Filter::CustomShader::Instance::~Instance() {}
// } // }
//} //}
uint32_t Filter::CustomShader::Instance::get_width() { uint32_t filter::CustomShader::Instance::get_width() {
return 0; return 0;
} }
uint32_t Filter::CustomShader::Instance::get_height() { uint32_t filter::CustomShader::Instance::get_height() {
return 0; return 0;
} }
bool Filter::CustomShader::Instance::is_special_parameter(std::string name, gs::effect_parameter::type type) { bool filter::CustomShader::Instance::is_special_parameter(std::string name, gs::effect_parameter::type type) {
std::pair<std::string, gs::effect_parameter::type> reservedParameters[] = { std::pair<std::string, gs::effect_parameter::type> reservedParameters[] = {
{ "ViewProj", gs::effect_parameter::type::Matrix }, { "ViewProj", gs::effect_parameter::type::Matrix },
{ "ViewSize", gs::effect_parameter::type::Float2 }, { "ViewSize", gs::effect_parameter::type::Float2 },
@ -350,7 +350,7 @@ bool Filter::CustomShader::Instance::is_special_parameter(std::string name, gs::
return false; return false;
} }
bool Filter::CustomShader::Instance::apply_special_parameters(uint32_t viewW, uint32_t viewH) { bool filter::CustomShader::Instance::apply_special_parameters(uint32_t viewW, uint32_t viewH) {
std::unique_ptr<gs::texture> imageTexture; std::unique_ptr<gs::texture> imageTexture;
m_renderTarget->get_texture(imageTexture); m_renderTarget->get_texture(imageTexture);
@ -378,11 +378,11 @@ bool Filter::CustomShader::Instance::apply_special_parameters(uint32_t viewW, ui
return true; return true;
} }
bool Filter::CustomShader::Instance::video_tick_impl(float_t time) { bool filter::CustomShader::Instance::video_tick_impl(float_t time) {
return true; return true;
} }
bool Filter::CustomShader::Instance::video_render_impl(gs_effect_t* parent_effect, uint32_t viewW, uint32_t viewH) { bool filter::CustomShader::Instance::video_render_impl(gs_effect_t* parent_effect, uint32_t viewW, uint32_t viewH) {
// Render original source to render target. // Render original source to render target.
{ {
auto op = m_renderTarget->render(viewW, viewH); auto op = m_renderTarget->render(viewW, viewH);
@ -406,7 +406,7 @@ bool Filter::CustomShader::Instance::video_render_impl(gs_effect_t* parent_effec
return true; return true;
} }
//void Filter::CustomShader::Instance::video_render(gs_effect_t *effect) { //void filter::CustomShader::Instance::video_render(gs_effect_t *effect) {
// for (Parameter& prm : m_effectParameters) { // for (Parameter& prm : m_effectParameters) {
// gs::effect_parameter eprm = m_effect.effect->get_parameter(prm.name); // gs::effect_parameter eprm = m_effect.effect->get_parameter(prm.name);
// switch (prm.type) { // switch (prm.type) {
@ -436,7 +436,7 @@ bool Filter::CustomShader::Instance::video_render_impl(gs_effect_t* parent_effec
// //
//} //}
//void Filter::CustomShader::Instance::CheckTextures(float_t time) { //void filter::CustomShader::Instance::CheckTextures(float_t time) {
// //
// for (Parameter& prm : m_effectParameters) { // for (Parameter& prm : m_effectParameters) {
// if (prm.type != gs::effect_parameter::type::Texture) // if (prm.type != gs::effect_parameter::type::Texture)
@ -446,7 +446,7 @@ bool Filter::CustomShader::Instance::video_render_impl(gs_effect_t* parent_effec
// // If the source field is empty, simply clear the source reference. // // If the source field is empty, simply clear the source reference.
// if (prm.value.source.name.empty()) { // if (prm.value.source.name.empty()) {
// if (prm.value.source.source) // if (prm.value.source.source)
// obs_source_release(m_source); // obs_source_release(source);
// prm.value.source.source = nullptr; // prm.value.source.source = nullptr;
// continue; // continue;
// } // }
@ -502,7 +502,7 @@ bool Filter::CustomShader::Instance::video_render_impl(gs_effect_t* parent_effec
// try { // try {
// prm.value.file.texture = std::make_shared<gs::texture>(prm.value.file.path); // prm.value.file.texture = std::make_shared<gs::texture>(prm.value.file.path);
// } catch (std::runtime_error& ex) { // } catch (std::runtime_error& ex) {
// const char* filterName = obs_source_get_name(m_source); // const char* filterName = obs_source_get_name(source);
// P_LOG_ERROR("[%s] Loading texture file '%s' failed with error(s): %s", // P_LOG_ERROR("[%s] Loading texture file '%s' failed with error(s): %s",
// filterName, prm.value.file.path.c_str(), ex.what()); // filterName, prm.value.file.path.c_str(), ex.what());
// } // }

View file

@ -26,7 +26,7 @@
#include <inttypes.h> #include <inttypes.h>
#include "gfx-effect-source.h" #include "gfx-effect-source.h"
namespace Filter { namespace filter {
class CustomShader { class CustomShader {
public: public:
CustomShader(); CustomShader();

View file

@ -21,17 +21,17 @@
#include "strings.h" #include "strings.h"
// Initializer & Finalizer // Initializer & Finalizer
static Filter::Displacement* filterDisplacementInstance; static filter::Displacement* filterDisplacementInstance;
INITIALIZER(FilterDisplacementInit) { INITIALIZER(FilterDisplacementInit) {
initializerFunctions.push_back([] { initializerFunctions.push_back([] {
filterDisplacementInstance = new Filter::Displacement(); filterDisplacementInstance = new filter::Displacement();
}); });
finalizerFunctions.push_back([] { finalizerFunctions.push_back([] {
delete filterDisplacementInstance; delete filterDisplacementInstance;
}); });
} }
Filter::Displacement::Displacement() { filter::Displacement::Displacement() {
memset(&sourceInfo, 0, sizeof(obs_source_info)); memset(&sourceInfo, 0, sizeof(obs_source_info));
sourceInfo.id = "obs-stream-effects-filter-displacement"; sourceInfo.id = "obs-stream-effects-filter-displacement";
sourceInfo.type = OBS_SOURCE_TYPE_FILTER; sourceInfo.type = OBS_SOURCE_TYPE_FILTER;
@ -53,31 +53,31 @@ Filter::Displacement::Displacement() {
obs_register_source(&sourceInfo); obs_register_source(&sourceInfo);
} }
Filter::Displacement::~Displacement() { filter::Displacement::~Displacement() {
} }
const char * Filter::Displacement::get_name(void *) { const char * filter::Displacement::get_name(void *) {
return P_TRANSLATE(S_FILTER_DISPLACEMENT); return P_TRANSLATE(S_FILTER_DISPLACEMENT);
} }
void * Filter::Displacement::create(obs_data_t *data, obs_source_t *source) { void * filter::Displacement::create(obs_data_t *data, obs_source_t *source) {
return new Instance(data, source); return new Instance(data, source);
} }
void Filter::Displacement::destroy(void *ptr) { void filter::Displacement::destroy(void *ptr) {
delete reinterpret_cast<Instance*>(ptr); delete reinterpret_cast<Instance*>(ptr);
} }
uint32_t Filter::Displacement::get_width(void *ptr) { uint32_t filter::Displacement::get_width(void *ptr) {
return reinterpret_cast<Instance*>(ptr)->get_width(); return reinterpret_cast<Instance*>(ptr)->get_width();
} }
uint32_t Filter::Displacement::get_height(void *ptr) { uint32_t filter::Displacement::get_height(void *ptr) {
return reinterpret_cast<Instance*>(ptr)->get_height(); return reinterpret_cast<Instance*>(ptr)->get_height();
} }
void Filter::Displacement::get_defaults(obs_data_t *data) { void filter::Displacement::get_defaults(obs_data_t *data) {
char* disp = obs_module_file("filter-displacement/neutral.png"); char* disp = obs_module_file("filter-displacement/neutral.png");
obs_data_set_default_string(data, S_FILTER_DISPLACEMENT_FILE, disp); obs_data_set_default_string(data, S_FILTER_DISPLACEMENT_FILE, disp);
obs_data_set_default_double(data, S_FILTER_DISPLACEMENT_RATIO, 0); obs_data_set_default_double(data, S_FILTER_DISPLACEMENT_RATIO, 0);
@ -85,7 +85,7 @@ void Filter::Displacement::get_defaults(obs_data_t *data) {
bfree(disp); bfree(disp);
} }
obs_properties_t * Filter::Displacement::get_properties(void *ptr) { obs_properties_t * filter::Displacement::get_properties(void *ptr) {
obs_properties_t *pr = obs_properties_create(); obs_properties_t *pr = obs_properties_create();
std::string path = ""; std::string path = "";
@ -103,35 +103,35 @@ obs_properties_t * Filter::Displacement::get_properties(void *ptr) {
return pr; return pr;
} }
void Filter::Displacement::update(void *ptr, obs_data_t *data) { void filter::Displacement::update(void *ptr, obs_data_t *data) {
reinterpret_cast<Instance*>(ptr)->update(data); reinterpret_cast<Instance*>(ptr)->update(data);
} }
void Filter::Displacement::activate(void *ptr) { void filter::Displacement::activate(void *ptr) {
reinterpret_cast<Instance*>(ptr)->activate(); reinterpret_cast<Instance*>(ptr)->activate();
} }
void Filter::Displacement::deactivate(void *ptr) { void filter::Displacement::deactivate(void *ptr) {
reinterpret_cast<Instance*>(ptr)->deactivate(); reinterpret_cast<Instance*>(ptr)->deactivate();
} }
void Filter::Displacement::show(void *ptr) { void filter::Displacement::show(void *ptr) {
reinterpret_cast<Instance*>(ptr)->show(); reinterpret_cast<Instance*>(ptr)->show();
} }
void Filter::Displacement::hide(void *ptr) { void filter::Displacement::hide(void *ptr) {
reinterpret_cast<Instance*>(ptr)->hide(); reinterpret_cast<Instance*>(ptr)->hide();
} }
void Filter::Displacement::video_tick(void *ptr, float time) { void filter::Displacement::video_tick(void *ptr, float time) {
reinterpret_cast<Instance*>(ptr)->video_tick(time); reinterpret_cast<Instance*>(ptr)->video_tick(time);
} }
void Filter::Displacement::video_render(void *ptr, gs_effect_t *effect) { void filter::Displacement::video_render(void *ptr, gs_effect_t *effect) {
reinterpret_cast<Instance*>(ptr)->video_render(effect); reinterpret_cast<Instance*>(ptr)->video_render(effect);
} }
Filter::Displacement::Instance::Instance(obs_data_t *data, filter::Displacement::Instance::Instance(obs_data_t *data,
obs_source_t *context) { obs_source_t *context) {
this->dispmap.texture = nullptr; this->dispmap.texture = nullptr;
this->dispmap.createTime = 0; this->dispmap.createTime = 0;
@ -155,14 +155,14 @@ Filter::Displacement::Instance::Instance(obs_data_t *data,
update(data); update(data);
} }
Filter::Displacement::Instance::~Instance() { filter::Displacement::Instance::~Instance() {
obs_enter_graphics(); obs_enter_graphics();
gs_effect_destroy(customEffect); gs_effect_destroy(customEffect);
gs_texture_destroy(dispmap.texture); gs_texture_destroy(dispmap.texture);
obs_leave_graphics(); obs_leave_graphics();
} }
void Filter::Displacement::Instance::update(obs_data_t *data) { void filter::Displacement::Instance::update(obs_data_t *data) {
updateDisplacementMap(obs_data_get_string(data, updateDisplacementMap(obs_data_get_string(data,
S_FILTER_DISPLACEMENT_FILE)); S_FILTER_DISPLACEMENT_FILE));
@ -174,23 +174,23 @@ void Filter::Displacement::Instance::update(obs_data_t *data) {
); );
} }
uint32_t Filter::Displacement::Instance::get_width() { uint32_t filter::Displacement::Instance::get_width() {
return 0; return 0;
} }
uint32_t Filter::Displacement::Instance::get_height() { uint32_t filter::Displacement::Instance::get_height() {
return 0; return 0;
} }
void Filter::Displacement::Instance::activate() {} void filter::Displacement::Instance::activate() {}
void Filter::Displacement::Instance::deactivate() {} void filter::Displacement::Instance::deactivate() {}
void Filter::Displacement::Instance::show() {} void filter::Displacement::Instance::show() {}
void Filter::Displacement::Instance::hide() {} void filter::Displacement::Instance::hide() {}
void Filter::Displacement::Instance::video_tick(float time) { void filter::Displacement::Instance::video_tick(float time) {
timer += time; timer += time;
if (timer >= 1.0) { if (timer >= 1.0) {
timer -= 1.0; timer -= 1.0;
@ -202,7 +202,7 @@ float interp(float a, float b, float v) {
return (a * (1.0f - v)) + (b * v); return (a * (1.0f - v)) + (b * v);
} }
void Filter::Displacement::Instance::video_render(gs_effect_t *) { void filter::Displacement::Instance::video_render(gs_effect_t *) {
obs_source_t *parent = obs_filter_get_parent(context); obs_source_t *parent = obs_filter_get_parent(context);
obs_source_t *target = obs_filter_get_target(context); obs_source_t *target = obs_filter_get_target(context);
uint32_t uint32_t
@ -247,11 +247,11 @@ void Filter::Displacement::Instance::video_render(gs_effect_t *) {
obs_source_process_filter_end(context, customEffect, baseW, baseH); obs_source_process_filter_end(context, customEffect, baseW, baseH);
} }
std::string Filter::Displacement::Instance::get_file() { std::string filter::Displacement::Instance::get_file() {
return dispmap.file; return dispmap.file;
} }
void Filter::Displacement::Instance::updateDisplacementMap(std::string file) { void filter::Displacement::Instance::updateDisplacementMap(std::string file) {
bool shouldUpdateTexture = false; bool shouldUpdateTexture = false;
// Different File // Different File

View file

@ -36,7 +36,7 @@ extern "C" {
#define S_FILTER_DISPLACEMENT_RATIO "Filter.Displacement.Ratio" #define S_FILTER_DISPLACEMENT_RATIO "Filter.Displacement.Ratio"
#define S_FILTER_DISPLACEMENT_SCALE "Filter.Displacement.Scale" #define S_FILTER_DISPLACEMENT_SCALE "Filter.Displacement.Scale"
namespace Filter { namespace filter {
class Displacement { class Displacement {
public: public:
Displacement(); Displacement();

View file

@ -34,10 +34,10 @@ extern "C" {
} }
// Initializer & Finalizer // Initializer & Finalizer
static Filter::Shape* filterShapeInstance; static filter::Shape* filterShapeInstance;
INITIALIZER(FilterShapeInit) { INITIALIZER(FilterShapeInit) {
initializerFunctions.push_back([] { initializerFunctions.push_back([] {
filterShapeInstance = new Filter::Shape(); filterShapeInstance = new filter::Shape();
}); });
finalizerFunctions.push_back([] { finalizerFunctions.push_back([] {
delete filterShapeInstance; delete filterShapeInstance;
@ -75,7 +75,7 @@ static void initialize() {
} }
} }
Filter::Shape::Shape() { filter::Shape::Shape() {
return; // Disabled for the time being. 3D Transform is better for this. return; // Disabled for the time being. 3D Transform is better for this.
memset(&sourceInfo, 0, sizeof(obs_source_info)); memset(&sourceInfo, 0, sizeof(obs_source_info));
sourceInfo.id = "obs-stream-effects-filter-shape"; sourceInfo.id = "obs-stream-effects-filter-shape";
@ -100,15 +100,15 @@ Filter::Shape::Shape() {
initialize(); initialize();
} }
Filter::Shape::~Shape() { filter::Shape::~Shape() {
} }
const char * Filter::Shape::get_name(void *) { const char * filter::Shape::get_name(void *) {
return "Shape"; return "Shape";
} }
void Filter::Shape::get_defaults(obs_data_t *data) { void filter::Shape::get_defaults(obs_data_t *data) {
obs_data_set_default_bool(data, P_SHAPE_LOOP, true); obs_data_set_default_bool(data, P_SHAPE_LOOP, true);
obs_data_set_default_int(data, P_SHAPE_POINTS, minimumPoints); obs_data_set_default_int(data, P_SHAPE_POINTS, minimumPoints);
@ -129,7 +129,7 @@ void Filter::Shape::get_defaults(obs_data_t *data) {
} }
} }
obs_properties_t * Filter::Shape::get_properties(void *) { obs_properties_t * filter::Shape::get_properties(void *) {
obs_properties_t *pr = obs_properties_create(); obs_properties_t *pr = obs_properties_create();
obs_property_t* p = NULL; obs_property_t* p = NULL;
@ -185,7 +185,7 @@ obs_properties_t * Filter::Shape::get_properties(void *) {
return pr; return pr;
} }
bool Filter::Shape::modified_properties(obs_properties_t *pr, obs_property_t *, bool filter::Shape::modified_properties(obs_properties_t *pr, obs_property_t *,
obs_data_t *data) { obs_data_t *data) {
uint32_t points = (uint32_t)obs_data_get_int(data, P_SHAPE_POINTS); uint32_t points = (uint32_t)obs_data_get_int(data, P_SHAPE_POINTS);
for (uint32_t point = 0; point < maximumPoints; point++) { for (uint32_t point = 0; point < maximumPoints; point++) {
@ -208,51 +208,51 @@ bool Filter::Shape::modified_properties(obs_properties_t *pr, obs_property_t *,
return true; return true;
} }
void * Filter::Shape::create(obs_data_t *data, obs_source_t *source) { void * filter::Shape::create(obs_data_t *data, obs_source_t *source) {
return new Instance(data, source); return new Instance(data, source);
} }
void Filter::Shape::destroy(void *ptr) { void filter::Shape::destroy(void *ptr) {
delete reinterpret_cast<Instance*>(ptr); delete reinterpret_cast<Instance*>(ptr);
} }
uint32_t Filter::Shape::get_width(void *ptr) { uint32_t filter::Shape::get_width(void *ptr) {
return reinterpret_cast<Instance*>(ptr)->get_width(); return reinterpret_cast<Instance*>(ptr)->get_width();
} }
uint32_t Filter::Shape::get_height(void *ptr) { uint32_t filter::Shape::get_height(void *ptr) {
return reinterpret_cast<Instance*>(ptr)->get_height(); return reinterpret_cast<Instance*>(ptr)->get_height();
} }
void Filter::Shape::update(void *ptr, obs_data_t *data) { void filter::Shape::update(void *ptr, obs_data_t *data) {
reinterpret_cast<Instance*>(ptr)->update(data); reinterpret_cast<Instance*>(ptr)->update(data);
} }
void Filter::Shape::activate(void *ptr) { void filter::Shape::activate(void *ptr) {
reinterpret_cast<Instance*>(ptr)->activate(); reinterpret_cast<Instance*>(ptr)->activate();
} }
void Filter::Shape::deactivate(void *ptr) { void filter::Shape::deactivate(void *ptr) {
reinterpret_cast<Instance*>(ptr)->deactivate(); reinterpret_cast<Instance*>(ptr)->deactivate();
} }
void Filter::Shape::show(void *ptr) { void filter::Shape::show(void *ptr) {
reinterpret_cast<Instance*>(ptr)->show(); reinterpret_cast<Instance*>(ptr)->show();
} }
void Filter::Shape::hide(void *ptr) { void filter::Shape::hide(void *ptr) {
reinterpret_cast<Instance*>(ptr)->hide(); reinterpret_cast<Instance*>(ptr)->hide();
} }
void Filter::Shape::video_tick(void *ptr, float time) { void filter::Shape::video_tick(void *ptr, float time) {
reinterpret_cast<Instance*>(ptr)->video_tick(time); reinterpret_cast<Instance*>(ptr)->video_tick(time);
} }
void Filter::Shape::video_render(void *ptr, gs_effect_t *effect) { void filter::Shape::video_render(void *ptr, gs_effect_t *effect) {
reinterpret_cast<Instance*>(ptr)->video_render(effect); reinterpret_cast<Instance*>(ptr)->video_render(effect);
} }
Filter::Shape::Instance::Instance(obs_data_t *data, obs_source_t *context) filter::Shape::Instance::Instance(obs_data_t *data, obs_source_t *context)
: context(context) { : context(context) {
obs_enter_graphics(); obs_enter_graphics();
m_vertexHelper = new gs::vertex_buffer(maximumPoints); m_vertexHelper = new gs::vertex_buffer(maximumPoints);
@ -263,13 +263,13 @@ Filter::Shape::Instance::Instance(obs_data_t *data, obs_source_t *context)
update(data); update(data);
} }
Filter::Shape::Instance::~Instance() { filter::Shape::Instance::~Instance() {
obs_enter_graphics(); obs_enter_graphics();
delete m_vertexHelper; delete m_vertexHelper;
obs_leave_graphics(); obs_leave_graphics();
} }
void Filter::Shape::Instance::update(obs_data_t *data) { void filter::Shape::Instance::update(obs_data_t *data) {
uint32_t points = (uint32_t)obs_data_get_int(data, P_SHAPE_POINTS); uint32_t points = (uint32_t)obs_data_get_int(data, P_SHAPE_POINTS);
m_vertexHelper->resize(points); m_vertexHelper->resize(points);
for (uint32_t point = 0; point < points; point++) { for (uint32_t point = 0; point < points; point++) {
@ -315,25 +315,25 @@ void Filter::Shape::Instance::update(obs_data_t *data) {
obs_leave_graphics(); obs_leave_graphics();
} }
uint32_t Filter::Shape::Instance::get_width() { uint32_t filter::Shape::Instance::get_width() {
return 0; return 0;
} }
uint32_t Filter::Shape::Instance::get_height() { uint32_t filter::Shape::Instance::get_height() {
return 0; return 0;
} }
void Filter::Shape::Instance::activate() {} void filter::Shape::Instance::activate() {}
void Filter::Shape::Instance::deactivate() {} void filter::Shape::Instance::deactivate() {}
void Filter::Shape::Instance::show() {} void filter::Shape::Instance::show() {}
void Filter::Shape::Instance::hide() {} void filter::Shape::Instance::hide() {}
void Filter::Shape::Instance::video_tick(float) {} void filter::Shape::Instance::video_tick(float) {}
void Filter::Shape::Instance::video_render(gs_effect_t *effect) { void filter::Shape::Instance::video_render(gs_effect_t *effect) {
obs_source_t *parent = obs_filter_get_parent(context); obs_source_t *parent = obs_filter_get_parent(context);
obs_source_t *target = obs_filter_get_target(context); obs_source_t *target = obs_filter_get_target(context);
uint32_t uint32_t

View file

@ -33,7 +33,7 @@
#define P_SHAPE_POINT_U "Shape.Point.U" #define P_SHAPE_POINT_U "Shape.Point.U"
#define P_SHAPE_POINT_V "Shape.Point.V" #define P_SHAPE_POINT_V "Shape.Point.V"
namespace Filter { namespace filter {
class Shape { class Shape {
public: public:
Shape(); Shape();

View file

@ -31,10 +31,10 @@ extern "C" {
} }
// Initializer & Finalizer // Initializer & Finalizer
static Filter::Transform* filterTransformInstance; static filter::Transform* filterTransformInstance;
INITIALIZER(FilterTransformInit) INITIALIZER(FilterTransformInit)
{ {
initializerFunctions.push_back([] { filterTransformInstance = new Filter::Transform(); }); initializerFunctions.push_back([] { filterTransformInstance = new filter::Transform(); });
finalizerFunctions.push_back([] { delete filterTransformInstance; }); finalizerFunctions.push_back([] { delete filterTransformInstance; });
} }
@ -81,7 +81,7 @@ enum RotationOrder : int64_t {
ZYX, ZYX,
}; };
Filter::Transform::Transform() filter::Transform::Transform()
{ {
memset(&sourceInfo, 0, sizeof(obs_source_info)); memset(&sourceInfo, 0, sizeof(obs_source_info));
sourceInfo.id = "obs-stream-effects-filter-transform"; sourceInfo.id = "obs-stream-effects-filter-transform";
@ -102,14 +102,14 @@ Filter::Transform::Transform()
obs_register_source(&sourceInfo); obs_register_source(&sourceInfo);
} }
Filter::Transform::~Transform() {} filter::Transform::~Transform() {}
const char* Filter::Transform::get_name(void*) const char* filter::Transform::get_name(void*)
{ {
return P_TRANSLATE(ST); return P_TRANSLATE(ST);
} }
void Filter::Transform::get_defaults(obs_data_t* data) void filter::Transform::get_defaults(obs_data_t* data)
{ {
obs_data_set_default_int(data, ST_CAMERA, (int64_t)CameraMode::Orthographic); obs_data_set_default_int(data, ST_CAMERA, (int64_t)CameraMode::Orthographic);
obs_data_set_default_double(data, ST_CAMERA_FIELDOFVIEW, 90.0); obs_data_set_default_double(data, ST_CAMERA_FIELDOFVIEW, 90.0);
@ -128,7 +128,7 @@ void Filter::Transform::get_defaults(obs_data_t* data)
RotationOrder::ZXY); //ZXY RotationOrder::ZXY); //ZXY
} }
obs_properties_t* Filter::Transform::get_properties(void*) obs_properties_t* filter::Transform::get_properties(void*)
{ {
obs_properties_t* pr = obs_properties_create(); obs_properties_t* pr = obs_properties_create();
obs_property_t* p = NULL; obs_property_t* p = NULL;
@ -228,7 +228,7 @@ obs_properties_t* Filter::Transform::get_properties(void*)
return pr; return pr;
} }
bool Filter::Transform::modified_properties(obs_properties_t* pr, obs_property_t*, obs_data_t* d) bool filter::Transform::modified_properties(obs_properties_t* pr, obs_property_t*, obs_data_t* d)
{ {
switch ((CameraMode)obs_data_get_int(d, ST_CAMERA)) { switch ((CameraMode)obs_data_get_int(d, ST_CAMERA)) {
case CameraMode::Orthographic: case CameraMode::Orthographic:
@ -252,52 +252,52 @@ bool Filter::Transform::modified_properties(obs_properties_t* pr, obs_property_t
return true; return true;
} }
void* Filter::Transform::create(obs_data_t* data, obs_source_t* source) void* filter::Transform::create(obs_data_t* data, obs_source_t* source)
{ {
return new Instance(data, source); return new Instance(data, source);
} }
void Filter::Transform::destroy(void* ptr) void filter::Transform::destroy(void* ptr)
{ {
delete reinterpret_cast<Instance*>(ptr); delete reinterpret_cast<Instance*>(ptr);
} }
uint32_t Filter::Transform::get_width(void* ptr) uint32_t filter::Transform::get_width(void* ptr)
{ {
return reinterpret_cast<Instance*>(ptr)->get_width(); return reinterpret_cast<Instance*>(ptr)->get_width();
} }
uint32_t Filter::Transform::get_height(void* ptr) uint32_t filter::Transform::get_height(void* ptr)
{ {
return reinterpret_cast<Instance*>(ptr)->get_height(); return reinterpret_cast<Instance*>(ptr)->get_height();
} }
void Filter::Transform::update(void* ptr, obs_data_t* data) void filter::Transform::update(void* ptr, obs_data_t* data)
{ {
reinterpret_cast<Instance*>(ptr)->update(data); reinterpret_cast<Instance*>(ptr)->update(data);
} }
void Filter::Transform::activate(void* ptr) void filter::Transform::activate(void* ptr)
{ {
reinterpret_cast<Instance*>(ptr)->activate(); reinterpret_cast<Instance*>(ptr)->activate();
} }
void Filter::Transform::deactivate(void* ptr) void filter::Transform::deactivate(void* ptr)
{ {
reinterpret_cast<Instance*>(ptr)->deactivate(); reinterpret_cast<Instance*>(ptr)->deactivate();
} }
void Filter::Transform::video_tick(void* ptr, float time) void filter::Transform::video_tick(void* ptr, float time)
{ {
reinterpret_cast<Instance*>(ptr)->video_tick(time); reinterpret_cast<Instance*>(ptr)->video_tick(time);
} }
void Filter::Transform::video_render(void* ptr, gs_effect_t* effect) void filter::Transform::video_render(void* ptr, gs_effect_t* effect)
{ {
reinterpret_cast<Instance*>(ptr)->video_render(effect); reinterpret_cast<Instance*>(ptr)->video_render(effect);
} }
Filter::Transform::Instance::Instance(obs_data_t* data, obs_source_t* context) filter::Transform::Instance::Instance(obs_data_t* data, obs_source_t* context)
: source_context(context), is_orthographic(true), field_of_view(90.0), is_inactive(false), is_hidden(false), : source_context(context), is_orthographic(true), field_of_view(90.0), is_inactive(false), is_hidden(false),
is_mesh_update_required(false), rotation_order(RotationOrder::ZXY) is_mesh_update_required(false), rotation_order(RotationOrder::ZXY)
{ {
@ -323,7 +323,7 @@ Filter::Transform::Instance::Instance(obs_data_t* data, obs_source_t* context)
update(data); update(data);
} }
Filter::Transform::Instance::~Instance() filter::Transform::Instance::~Instance()
{ {
obs_enter_graphics(); obs_enter_graphics();
shape_rt.reset(); shape_rt.reset();
@ -332,7 +332,7 @@ Filter::Transform::Instance::~Instance()
obs_leave_graphics(); obs_leave_graphics();
} }
void Filter::Transform::Instance::update(obs_data_t* data) void filter::Transform::Instance::update(obs_data_t* data)
{ {
// Camera // Camera
is_orthographic = obs_data_get_int(data, ST_CAMERA) == 0; is_orthographic = obs_data_get_int(data, ST_CAMERA) == 0;
@ -361,29 +361,29 @@ void Filter::Transform::Instance::update(obs_data_t* data)
is_mesh_update_required = true; is_mesh_update_required = true;
} }
uint32_t Filter::Transform::Instance::get_width() uint32_t filter::Transform::Instance::get_width()
{ {
return 0; return 0;
} }
uint32_t Filter::Transform::Instance::get_height() uint32_t filter::Transform::Instance::get_height()
{ {
return 0; return 0;
} }
void Filter::Transform::Instance::activate() void filter::Transform::Instance::activate()
{ {
is_inactive = false; is_inactive = false;
} }
void Filter::Transform::Instance::deactivate() void filter::Transform::Instance::deactivate()
{ {
is_inactive = true; is_inactive = true;
} }
void Filter::Transform::Instance::video_tick(float) {} void filter::Transform::Instance::video_tick(float) {}
void Filter::Transform::Instance::video_render(gs_effect_t* paramEffect) void filter::Transform::Instance::video_render(gs_effect_t* paramEffect)
{ {
std::shared_ptr<gs::texture> source_tex; std::shared_ptr<gs::texture> source_tex;
std::shared_ptr<gs::texture> shape_tex; std::shared_ptr<gs::texture> shape_tex;

View file

@ -26,7 +26,7 @@
#include "gs-vertexbuffer.h" #include "gs-vertexbuffer.h"
#include "plugin.h" #include "plugin.h"
namespace Filter { namespace filter {
class Transform { class Transform {
obs_source_info sourceInfo; obs_source_info sourceInfo;
@ -98,4 +98,4 @@ namespace Filter {
void video_render(gs_effect_t*); void video_render(gs_effect_t*);
}; };
}; };
} // namespace Filter } // namespace filter

View file

@ -27,9 +27,9 @@ OBS_DECLARE_MODULE();
OBS_MODULE_AUTHOR("Michael Fabian Dirks"); OBS_MODULE_AUTHOR("Michael Fabian Dirks");
OBS_MODULE_USE_DEFAULT_LOCALE("obs-stream-effects", "en-US"); OBS_MODULE_USE_DEFAULT_LOCALE("obs-stream-effects", "en-US");
Filter::Displacement *filterDisplacement; filter::Displacement *filterDisplacement;
Filter::Shape *filterShape; filter::Shape *filterShape;
Filter::Transform *filterTransform; filter::Transform *filterTransform;
std::list<std::function<void()>> initializerFunctions; std::list<std::function<void()>> initializerFunctions;
std::list<std::function<void()>> finalizerFunctions; std::list<std::function<void()>> finalizerFunctions;