filter-transform: Formatting, Camera improvements and general fixes

This commit is contained in:
Michael Fabian Dirks 2017-08-20 00:31:19 +02:00
parent 6cc1be1b0d
commit 607c8bf170
2 changed files with 224 additions and 131 deletions

View file

@ -65,95 +65,148 @@ Filter::Transform::Transform() {
obs_register_source(&sourceInfo);
}
Filter::Transform::~Transform() {
}
Filter::Transform::~Transform() {}
const char* Filter::Transform::get_name(void *) {
return P_TRANSLATE(P_FILTER_TRANSFORM);
return P_TRANSLATE(S_FILTER_TRANSFORM);
}
void Filter::Transform::get_defaults(obs_data_t *data) {
obs_data_set_default_int(data, P_FILTER_TRANSFORM_CAMERA, 0);
obs_data_set_default_double(data, P_FILTER_TRANSFORM_CAMERA_FIELDOFVIEW, 90.0);
obs_data_set_default_double(data, P_FILTER_TRANSFORM_POSITION_X, 0);
obs_data_set_default_double(data, P_FILTER_TRANSFORM_POSITION_Y, 0);
obs_data_set_default_double(data, P_FILTER_TRANSFORM_POSITION_Z, 0);
obs_data_set_default_double(data, P_FILTER_TRANSFORM_SCALE_X, 100);
obs_data_set_default_double(data, P_FILTER_TRANSFORM_SCALE_Y, 100);
obs_data_set_default_int(data, P_FILTER_TRANSFORM_ROTATION_ORDER, RotationOrder::ZXY); //ZXY
obs_data_set_default_double(data, P_FILTER_TRANSFORM_ROTATION_X, 0);
obs_data_set_default_double(data, P_FILTER_TRANSFORM_ROTATION_Y, 0);
obs_data_set_default_double(data, P_FILTER_TRANSFORM_ROTATION_Z, 0);
obs_data_set_default_int(data, S_FILTER_TRANSFORM_CAMERA, 0);
obs_data_set_default_double(data, S_FILTER_TRANSFORM_CAMERA_FIELDOFVIEW,
90.0);
obs_data_set_default_double(data, S_FILTER_TRANSFORM_POSITION_X, 0);
obs_data_set_default_double(data, S_FILTER_TRANSFORM_POSITION_Y, 0);
obs_data_set_default_double(data, S_FILTER_TRANSFORM_POSITION_Z, 0);
obs_data_set_default_double(data, S_FILTER_TRANSFORM_SCALE_X, 100);
obs_data_set_default_double(data, S_FILTER_TRANSFORM_SCALE_Y, 100);
obs_data_set_default_int(data, S_FILTER_TRANSFORM_ROTATION_ORDER,
RotationOrder::ZXY); //ZXY
obs_data_set_default_double(data, S_FILTER_TRANSFORM_ROTATION_X, 0);
obs_data_set_default_double(data, S_FILTER_TRANSFORM_ROTATION_Y, 0);
obs_data_set_default_double(data, S_FILTER_TRANSFORM_ROTATION_Z, 0);
}
obs_properties_t * Filter::Transform::get_properties(void *) {
obs_properties_t *pr = obs_properties_create();
obs_property_t* p = NULL;
p = obs_properties_add_list(pr, P_FILTER_TRANSFORM_CAMERA, P_TRANSLATE(P_FILTER_TRANSFORM_CAMERA),
p = obs_properties_add_list(pr, S_FILTER_TRANSFORM_CAMERA,
P_TRANSLATE(S_FILTER_TRANSFORM_CAMERA),
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT);
obs_property_set_long_description(p, P_TRANSLATE(P_DESC(P_FILTER_TRANSFORM_CAMERA)));
obs_property_list_add_int(p, P_TRANSLATE(P_FILTER_TRANSFORM_CAMERA_ORTHOGRAPHIC), 0);
obs_property_list_add_int(p, P_TRANSLATE(P_FILTER_TRANSFORM_CAMERA_PERSPECTIVE), 1);
obs_property_set_long_description(p,
P_TRANSLATE(P_DESC(S_FILTER_TRANSFORM_CAMERA)));
obs_property_list_add_int(p,
P_TRANSLATE(S_FILTER_TRANSFORM_CAMERA_ORTHOGRAPHIC), 0);
obs_property_list_add_int(p,
P_TRANSLATE(S_FILTER_TRANSFORM_CAMERA_PERSPECTIVE), 1);
obs_property_set_modified_callback(p, modified_properties);
p = obs_properties_add_float_slider(pr, P_FILTER_TRANSFORM_CAMERA_FIELDOFVIEW, P_TRANSLATE(P_FILTER_TRANSFORM_CAMERA_FIELDOFVIEW),
p = obs_properties_add_float_slider(pr,
S_FILTER_TRANSFORM_CAMERA_FIELDOFVIEW,
P_TRANSLATE(S_FILTER_TRANSFORM_CAMERA_FIELDOFVIEW),
1.0, 179.0, 0.01);
obs_property_set_long_description(p, P_TRANSLATE(P_DESC(P_FILTER_TRANSFORM_CAMERA_FIELDOFVIEW)));
obs_property_set_long_description(p,
P_TRANSLATE(P_DESC(S_FILTER_TRANSFORM_CAMERA_FIELDOFVIEW)));
// Position, Scale, Rotation
{
std::pair<const char*, const char*> entries[] = {
std::make_pair(P_FILTER_TRANSFORM_POSITION_X, P_DESC(P_FILTER_TRANSFORM_POSITION_X)),
std::make_pair(P_FILTER_TRANSFORM_POSITION_Y, P_DESC(P_FILTER_TRANSFORM_POSITION_Y)),
std::make_pair(P_FILTER_TRANSFORM_POSITION_Z, P_DESC(P_FILTER_TRANSFORM_POSITION_Z)),
std::make_pair(P_FILTER_TRANSFORM_SCALE_X, P_DESC(P_FILTER_TRANSFORM_SCALE_X)),
std::make_pair(P_FILTER_TRANSFORM_SCALE_Y, P_DESC(P_FILTER_TRANSFORM_SCALE_Y)),
std::make_pair(S_FILTER_TRANSFORM_POSITION_X,
P_DESC(S_FILTER_TRANSFORM_POSITION_X)),
std::make_pair(S_FILTER_TRANSFORM_POSITION_Y,
P_DESC(S_FILTER_TRANSFORM_POSITION_Y)),
std::make_pair(S_FILTER_TRANSFORM_POSITION_Z,
P_DESC(S_FILTER_TRANSFORM_POSITION_Z)),
};
for (auto kv : entries) {
p = obs_properties_add_float(pr, kv.first, P_TRANSLATE(kv.first),
-valueLimit, valueLimit, 0.01);
obs_property_set_long_description(p, P_TRANSLATE(kv.second));
p = obs_properties_add_float(pr, kv.first,
P_TRANSLATE(kv.first), -10000, 10000, 0.01);
obs_property_set_long_description(p,
P_TRANSLATE(kv.second));
}
}{
std::pair<const char*, const char*> entries[] = {
std::make_pair(S_FILTER_TRANSFORM_ROTATION_X,
P_DESC(S_FILTER_TRANSFORM_ROTATION_X)),
std::make_pair(S_FILTER_TRANSFORM_ROTATION_Y,
P_DESC(S_FILTER_TRANSFORM_ROTATION_Y)),
std::make_pair(S_FILTER_TRANSFORM_ROTATION_Z,
P_DESC(S_FILTER_TRANSFORM_ROTATION_Z)),
};
for (auto kv : entries) {
p = obs_properties_add_float_slider(pr, kv.first,
P_TRANSLATE(kv.first), -180, 180, 0.01);
obs_property_set_long_description(p,
P_TRANSLATE(kv.second));
}
}{
std::pair<const char*, const char*> entries[] = {
std::make_pair(S_FILTER_TRANSFORM_SCALE_X,
P_DESC(S_FILTER_TRANSFORM_SCALE_X)),
std::make_pair(S_FILTER_TRANSFORM_SCALE_Y,
P_DESC(S_FILTER_TRANSFORM_SCALE_Y)),
};
for (auto kv : entries) {
p = obs_properties_add_float_slider(pr, kv.first,
P_TRANSLATE(kv.first), -1000, 1000, 0.01);
obs_property_set_long_description(p,
P_TRANSLATE(kv.second));
}
}
p = obs_properties_add_list(pr, P_FILTER_TRANSFORM_ROTATION_ORDER, P_TRANSLATE(P_FILTER_TRANSFORM_ROTATION_ORDER),
p = obs_properties_add_bool(pr, S_ADVANCED, P_TRANSLATE(S_ADVANCED));
obs_property_set_modified_callback(p, modified_properties);
p = obs_properties_add_list(pr, S_FILTER_TRANSFORM_ROTATION_ORDER,
P_TRANSLATE(S_FILTER_TRANSFORM_ROTATION_ORDER),
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT);
obs_property_set_long_description(p, P_TRANSLATE(P_DESC(P_FILTER_TRANSFORM_ROTATION_ORDER)));
obs_property_list_add_int(p, P_TRANSLATE(P_FILTER_TRANSFORM_ROTATION_ORDER_XYZ), RotationOrder::XYZ);
obs_property_list_add_int(p, P_TRANSLATE(P_FILTER_TRANSFORM_ROTATION_ORDER_XZY), RotationOrder::XZY);
obs_property_list_add_int(p, P_TRANSLATE(P_FILTER_TRANSFORM_ROTATION_ORDER_YXZ), RotationOrder::YXZ);
obs_property_list_add_int(p, P_TRANSLATE(P_FILTER_TRANSFORM_ROTATION_ORDER_YZX), RotationOrder::YZX);
obs_property_list_add_int(p, P_TRANSLATE(P_FILTER_TRANSFORM_ROTATION_ORDER_ZXY), RotationOrder::ZXY);
obs_property_list_add_int(p, P_TRANSLATE(P_FILTER_TRANSFORM_ROTATION_ORDER_ZYX), RotationOrder::ZYX);
obs_property_set_long_description(p,
P_TRANSLATE(P_DESC(S_FILTER_TRANSFORM_ROTATION_ORDER)));
obs_property_list_add_int(p,
P_TRANSLATE(S_FILTER_TRANSFORM_ROTATION_ORDER_XYZ),
RotationOrder::XYZ);
obs_property_list_add_int(p,
P_TRANSLATE(S_FILTER_TRANSFORM_ROTATION_ORDER_XZY),
RotationOrder::XZY);
obs_property_list_add_int(p,
P_TRANSLATE(S_FILTER_TRANSFORM_ROTATION_ORDER_YXZ),
RotationOrder::YXZ);
obs_property_list_add_int(p,
P_TRANSLATE(S_FILTER_TRANSFORM_ROTATION_ORDER_YZX),
RotationOrder::YZX);
obs_property_list_add_int(p,
P_TRANSLATE(S_FILTER_TRANSFORM_ROTATION_ORDER_ZXY),
RotationOrder::ZXY);
obs_property_list_add_int(p,
P_TRANSLATE(S_FILTER_TRANSFORM_ROTATION_ORDER_ZYX),
RotationOrder::ZYX);
{
std::pair<const char*, const char*> entries[] = {
std::make_pair(P_FILTER_TRANSFORM_ROTATION_X, P_DESC(P_FILTER_TRANSFORM_ROTATION_X)),
std::make_pair(P_FILTER_TRANSFORM_ROTATION_Y, P_DESC(P_FILTER_TRANSFORM_ROTATION_Y)),
std::make_pair(P_FILTER_TRANSFORM_ROTATION_Z, P_DESC(P_FILTER_TRANSFORM_ROTATION_Z)),
};
for (auto kv : entries) {
p = obs_properties_add_float_slider(pr, kv.first, P_TRANSLATE(kv.first),
-180, 180, 0.01);
obs_property_set_long_description(p, P_TRANSLATE(kv.second));
}
}
return pr;
}
bool Filter::Transform::modified_properties(obs_properties_t *pr, obs_property_t *, obs_data_t *d) {
switch (obs_data_get_int(d, P_FILTER_TRANSFORM_CAMERA)) {
bool Filter::Transform::modified_properties(obs_properties_t *pr,
obs_property_t *, obs_data_t *d) {
switch (obs_data_get_int(d, S_FILTER_TRANSFORM_CAMERA)) {
case 0:
obs_property_set_visible(obs_properties_get(pr, P_FILTER_TRANSFORM_CAMERA_FIELDOFVIEW), false);
obs_property_set_visible(obs_properties_get(pr, P_FILTER_TRANSFORM_POSITION_Z), false);
obs_property_set_visible(obs_properties_get(pr,
S_FILTER_TRANSFORM_CAMERA_FIELDOFVIEW), false);
obs_property_set_visible(obs_properties_get(pr,
S_FILTER_TRANSFORM_POSITION_Z), false);
break;
case 1:
obs_property_set_visible(obs_properties_get(pr, P_FILTER_TRANSFORM_CAMERA_FIELDOFVIEW), true);
obs_property_set_visible(obs_properties_get(pr, P_FILTER_TRANSFORM_POSITION_Z), true);
obs_property_set_visible(obs_properties_get(pr,
S_FILTER_TRANSFORM_CAMERA_FIELDOFVIEW), true);
obs_property_set_visible(obs_properties_get(pr,
S_FILTER_TRANSFORM_POSITION_Z), true);
break;
}
bool advancedVisible = obs_data_get_bool(d, S_ADVANCED);
obs_property_set_visible(obs_properties_get(pr,
S_FILTER_TRANSFORM_ROTATION_ORDER), advancedVisible);
return false;
}
@ -201,12 +254,14 @@ void Filter::Transform::video_render(void *ptr, gs_effect_t *effect) {
reinterpret_cast<Instance*>(ptr)->video_render(effect);
}
Filter::Transform::Instance::Instance(obs_data_t *data, obs_source_t *context)
: m_sourceContext(context),
m_isCameraOrthographic(true),
m_cameraFieldOfView(90.0f),
m_isMeshUpdateRequired(true),
m_rotationOrder(RotationOrder::ZXY) {
Filter::Transform::Instance::Instance(obs_data_t *data, obs_source_t *context) :
m_sourceContext(context), m_vertexHelper(nullptr), m_vertexBuffer(nullptr),
m_texRender(nullptr), m_shapeRender(nullptr), m_isCameraOrthographic(true),
m_cameraFieldOfView(90.0), m_isInactive(false), m_isHidden(false),
m_isMeshUpdateRequired(false), m_rotationOrder(RotationOrder::ZXY) {
vec3_set(&m_position, 0, 0, 0);
vec3_set(&m_rotation, 0, 0, 0);
vec3_set(&m_scale, 1, 1, 1);
obs_enter_graphics();
m_texRender = gs_texrender_create(GS_RGBA, GS_ZS_NONE);
@ -229,20 +284,31 @@ Filter::Transform::Instance::~Instance() {
void Filter::Transform::Instance::update(obs_data_t *data) {
// Camera
m_isCameraOrthographic = obs_data_get_int(data, P_FILTER_TRANSFORM_CAMERA) == 0;
m_cameraFieldOfView = (float)obs_data_get_double(data, P_FILTER_TRANSFORM_CAMERA_FIELDOFVIEW);
m_isCameraOrthographic = obs_data_get_int(data,
S_FILTER_TRANSFORM_CAMERA) == 0;
m_cameraFieldOfView = (float)obs_data_get_double(data,
S_FILTER_TRANSFORM_CAMERA_FIELDOFVIEW);
// Source
m_position.x = (float)obs_data_get_double(data, P_FILTER_TRANSFORM_POSITION_X) / 100.0f;
m_position.y = (float)obs_data_get_double(data, P_FILTER_TRANSFORM_POSITION_Y) / 100.0f;
m_position.z = (float)obs_data_get_double(data, P_FILTER_TRANSFORM_POSITION_Z) / 100.0f;
m_scale.x = (float)obs_data_get_double(data, P_FILTER_TRANSFORM_SCALE_X) / 100.0f;
m_scale.y = (float)obs_data_get_double(data, P_FILTER_TRANSFORM_SCALE_Y) / 100.0f;
m_position.x = (float)obs_data_get_double(data,
S_FILTER_TRANSFORM_POSITION_X) / 100.0f;
m_position.y = (float)obs_data_get_double(data,
S_FILTER_TRANSFORM_POSITION_Y) / 100.0f;
m_position.z = (float)obs_data_get_double(data,
S_FILTER_TRANSFORM_POSITION_Z) / 100.0f;
m_scale.x = (float)obs_data_get_double(data,
S_FILTER_TRANSFORM_SCALE_X) / 100.0f;
m_scale.y = (float)obs_data_get_double(data,
S_FILTER_TRANSFORM_SCALE_Y) / 100.0f;
m_scale.z = 1.0;
m_rotationOrder = (int)obs_data_get_int(data, P_FILTER_TRANSFORM_ROTATION_ORDER);
m_rotation.x = (float)obs_data_get_double(data, P_FILTER_TRANSFORM_ROTATION_X) / 180.0f * PI;
m_rotation.y = (float)obs_data_get_double(data, P_FILTER_TRANSFORM_ROTATION_Y) / 180.0f * PI;
m_rotation.z = (float)obs_data_get_double(data, P_FILTER_TRANSFORM_ROTATION_Z) / 180.0f * PI;
m_rotationOrder = (int)obs_data_get_int(data,
S_FILTER_TRANSFORM_ROTATION_ORDER);
m_rotation.x = (float)obs_data_get_double(data,
S_FILTER_TRANSFORM_ROTATION_X) / 180.0f * PI;
m_rotation.y = (float)obs_data_get_double(data,
S_FILTER_TRANSFORM_ROTATION_Y) / 180.0f * PI;
m_rotation.z = (float)obs_data_get_double(data,
S_FILTER_TRANSFORM_ROTATION_Z) / 180.0f * PI;
m_isMeshUpdateRequired = true;
}
@ -254,13 +320,21 @@ uint32_t Filter::Transform::Instance::get_height() {
return 0;
}
void Filter::Transform::Instance::activate() {}
void Filter::Transform::Instance::activate() {
m_isInactive = false;
}
void Filter::Transform::Instance::deactivate() {}
void Filter::Transform::Instance::deactivate() {
m_isInactive = true;
}
void Filter::Transform::Instance::show() {}
void Filter::Transform::Instance::show() {
m_isHidden = false;
}
void Filter::Transform::Instance::hide() {}
void Filter::Transform::Instance::hide() {
m_isHidden = true;
}
void Filter::Transform::Instance::video_tick(float) {}
@ -272,8 +346,10 @@ void Filter::Transform::Instance::video_render(gs_effect_t *paramEffect) {
baseH = obs_source_get_base_height(target);
// Skip rendering if our target, parent or context is not valid.
if (!target || !parent || !m_sourceContext || !m_vertexBuffer || !m_texRender
|| !m_shapeRender || !baseW || !baseH) {
if (!target || !parent || !m_sourceContext
|| !baseW || !baseH
|| !m_texRender || !m_shapeRender
|| m_isInactive || m_isHidden) {
obs_source_skip_video_filter(m_sourceContext);
return;
}
@ -282,35 +358,39 @@ void Filter::Transform::Instance::video_render(gs_effect_t *paramEffect) {
// Draw previous filters to texture.
gs_texrender_reset(m_texRender);
if (gs_texrender_begin(m_texRender, baseW, baseH)) {
gs_ortho(0, (float)baseW, 0, (float)baseH, -1, 1);
vec4 black;
vec4_zero(&black);
gs_clear(GS_CLEAR_COLOR | GS_CLEAR_DEPTH, &black, 0, 0);
gs_set_cull_mode(GS_NEITHER);
gs_reset_blend_state();
gs_blend_function_separate(
gs_blend_type::GS_BLEND_ONE,
gs_blend_type::GS_BLEND_ZERO,
gs_blend_type::GS_BLEND_ONE,
gs_blend_type::GS_BLEND_ZERO);
gs_enable_depth_test(false);
gs_enable_stencil_test(false);
gs_enable_stencil_write(false);
gs_enable_color(true, true, true, true);
if (obs_source_process_filter_begin(m_sourceContext, GS_RGBA, OBS_NO_DIRECT_RENDERING)) {
obs_source_process_filter_end(m_sourceContext, paramEffect ? paramEffect : alphaEffect, baseW, baseH);
} else {
obs_source_skip_video_filter(m_sourceContext);
}
gs_texrender_end(m_texRender);
} else {
if (!gs_texrender_begin(m_texRender, baseW, baseH)) {
obs_source_skip_video_filter(m_sourceContext);
return;
}
gs_ortho(0, (float)baseW, 0, (float)baseH, -1, 1);
/// Set up the Scene
vec4 black;
vec4_zero(&black);
gs_clear(GS_CLEAR_COLOR | GS_CLEAR_DEPTH, &black, 0, 0);
gs_set_cull_mode(GS_NEITHER);
gs_reset_blend_state();
gs_blend_function_separate(
gs_blend_type::GS_BLEND_ONE,
gs_blend_type::GS_BLEND_ZERO,
gs_blend_type::GS_BLEND_ONE,
gs_blend_type::GS_BLEND_ZERO);
gs_enable_depth_test(false);
gs_enable_stencil_test(false);
gs_enable_stencil_write(false);
gs_enable_color(true, true, true, true);
/// Render original source
if (obs_source_process_filter_begin(m_sourceContext, GS_RGBA,
OBS_NO_DIRECT_RENDERING)) {
obs_source_process_filter_end(m_sourceContext,
paramEffect ? paramEffect : alphaEffect,
baseW, baseH);
} else {
obs_source_skip_video_filter(m_sourceContext);
}
gs_texrender_end(m_texRender);
gs_texture* filterTexture = gs_texrender_get_texture(m_texRender);
// Update Mesh
@ -322,6 +402,8 @@ void Filter::Transform::Instance::video_render(gs_effect_t *paramEffect) {
} else {
aspectRatioX = 1.0;
}
if (m_isCameraOrthographic)
aspectRatioX = aspectRatioY = 1.0;
// Mesh
matrix4 ident;
@ -399,6 +481,11 @@ void Filter::Transform::Instance::video_render(gs_effect_t *paramEffect) {
vec3_transform(&v.position, &v.position, &ident);
}
m_vertexBuffer = m_vertexHelper->update();
if (!m_vertexBuffer) {
obs_source_skip_video_filter(m_sourceContext);
return;
}
m_isMeshUpdateRequired = false;
}
// Draw shape to texture
@ -407,7 +494,8 @@ void Filter::Transform::Instance::video_render(gs_effect_t *paramEffect) {
if (m_isCameraOrthographic) {
gs_ortho(-1.0, 1.0, -1.0, 1.0, -farZ, farZ);
} else {
gs_perspective(m_cameraFieldOfView, float_t(baseW) / float_t(baseH), nearZ, farZ);
gs_perspective(m_cameraFieldOfView,
float_t(baseW) / float_t(baseH), nearZ, farZ);
// Fix camera pointing at -Z instead of +Z.
gs_matrix_scale3f(1.0, 1.0, -1.0);
// Move backwards so we can actually see stuff.
@ -426,7 +514,9 @@ void Filter::Transform::Instance::video_render(gs_effect_t *paramEffect) {
gs_enable_stencil_write(false);
gs_enable_color(true, true, true, true);
while (gs_effect_loop(alphaEffect, "Draw")) {
gs_effect_set_texture(gs_effect_get_param_by_name(alphaEffect, "image"), filterTexture);
gs_effect_set_texture(
gs_effect_get_param_by_name(alphaEffect,
"image"), filterTexture);
gs_load_vertexbuffer(m_vertexBuffer);
gs_load_indexbuffer(NULL);
gs_draw(GS_TRISTRIP, 0, 4);
@ -443,7 +533,8 @@ void Filter::Transform::Instance::video_render(gs_effect_t *paramEffect) {
gs_reset_blend_state();
gs_enable_depth_test(false);
while (gs_effect_loop(alphaEffect, "Draw")) {
gs_effect_set_texture(gs_effect_get_param_by_name(alphaEffect, "image"), shapeTexture);
gs_effect_set_texture(gs_effect_get_param_by_name(alphaEffect,
"image"), shapeTexture);
gs_draw_sprite(shapeTexture, 0, 0, 0);
}
}

View file

@ -21,29 +21,29 @@
#include "plugin.h"
#include "gs-helper.h"
#define P_FILTER_TRANSFORM "Filter.Transform"
#define P_FILTER_TRANSFORM_CAMERA "Filter.Transform.Camera"
#define P_FILTER_TRANSFORM_CAMERA_ORTHOGRAPHIC "Filter.Transform.Camera.Orthographic"
#define P_FILTER_TRANSFORM_CAMERA_PERSPECTIVE "Filter.Transform.Camera.Perspective"
#define P_FILTER_TRANSFORM_CAMERA_FIELDOFVIEW "Filter.Transform.Camera.FieldOfView"
#define P_FILTER_TRANSFORM_POSITION "Filter.Transform.Position"
#define P_FILTER_TRANSFORM_POSITION_X "Filter.Transform.Position.X"
#define P_FILTER_TRANSFORM_POSITION_Y "Filter.Transform.Position.Y"
#define P_FILTER_TRANSFORM_POSITION_Z "Filter.Transform.Position.Z"
#define P_FILTER_TRANSFORM_ROTATION "Filter.Transform.Rotation"
#define P_FILTER_TRANSFORM_ROTATION_ORDER "Filter.Transform.Rotation.Order"
#define P_FILTER_TRANSFORM_ROTATION_ORDER_XYZ "Filter.Transform.Rotation.Order.XYZ"
#define P_FILTER_TRANSFORM_ROTATION_ORDER_XZY "Filter.Transform.Rotation.Order.XZY"
#define P_FILTER_TRANSFORM_ROTATION_ORDER_YXZ "Filter.Transform.Rotation.Order.YXZ"
#define P_FILTER_TRANSFORM_ROTATION_ORDER_YZX "Filter.Transform.Rotation.Order.YZX"
#define P_FILTER_TRANSFORM_ROTATION_ORDER_ZXY "Filter.Transform.Rotation.Order.ZXY"
#define P_FILTER_TRANSFORM_ROTATION_ORDER_ZYX "Filter.Transform.Rotation.Order.ZYX"
#define P_FILTER_TRANSFORM_ROTATION_X "Filter.Transform.Rotation.X"
#define P_FILTER_TRANSFORM_ROTATION_Y "Filter.Transform.Rotation.Y"
#define P_FILTER_TRANSFORM_ROTATION_Z "Filter.Transform.Rotation.Z"
#define P_FILTER_TRANSFORM_SCALE "Filter.Transform.Scale"
#define P_FILTER_TRANSFORM_SCALE_X "Filter.Transform.Scale.X"
#define P_FILTER_TRANSFORM_SCALE_Y "Filter.Transform.Scale.Y"
#define S_FILTER_TRANSFORM "Filter.Transform"
#define S_FILTER_TRANSFORM_CAMERA "Filter.Transform.Camera"
#define S_FILTER_TRANSFORM_CAMERA_ORTHOGRAPHIC "Filter.Transform.Camera.Orthographic"
#define S_FILTER_TRANSFORM_CAMERA_PERSPECTIVE "Filter.Transform.Camera.Perspective"
#define S_FILTER_TRANSFORM_CAMERA_FIELDOFVIEW "Filter.Transform.Camera.FieldOfView"
#define S_FILTER_TRANSFORM_POSITION "Filter.Transform.Position"
#define S_FILTER_TRANSFORM_POSITION_X "Filter.Transform.Position.X"
#define S_FILTER_TRANSFORM_POSITION_Y "Filter.Transform.Position.Y"
#define S_FILTER_TRANSFORM_POSITION_Z "Filter.Transform.Position.Z"
#define S_FILTER_TRANSFORM_ROTATION "Filter.Transform.Rotation"
#define S_FILTER_TRANSFORM_ROTATION_ORDER "Filter.Transform.Rotation.Order"
#define S_FILTER_TRANSFORM_ROTATION_ORDER_XYZ "Filter.Transform.Rotation.Order.XYZ"
#define S_FILTER_TRANSFORM_ROTATION_ORDER_XZY "Filter.Transform.Rotation.Order.XZY"
#define S_FILTER_TRANSFORM_ROTATION_ORDER_YXZ "Filter.Transform.Rotation.Order.YXZ"
#define S_FILTER_TRANSFORM_ROTATION_ORDER_YZX "Filter.Transform.Rotation.Order.YZX"
#define S_FILTER_TRANSFORM_ROTATION_ORDER_ZXY "Filter.Transform.Rotation.Order.ZXY"
#define S_FILTER_TRANSFORM_ROTATION_ORDER_ZYX "Filter.Transform.Rotation.Order.ZYX"
#define S_FILTER_TRANSFORM_ROTATION_X "Filter.Transform.Rotation.X"
#define S_FILTER_TRANSFORM_ROTATION_Y "Filter.Transform.Rotation.Y"
#define S_FILTER_TRANSFORM_ROTATION_Z "Filter.Transform.Rotation.Z"
#define S_FILTER_TRANSFORM_SCALE "Filter.Transform.Scale"
#define S_FILTER_TRANSFORM_SCALE_X "Filter.Transform.Scale.X"
#define S_FILTER_TRANSFORM_SCALE_Y "Filter.Transform.Scale.Y"
namespace Filter {
class Transform {
@ -54,7 +54,8 @@ namespace Filter {
static const char *get_name(void *);
static void get_defaults(obs_data_t *);
static obs_properties_t *get_properties(void *);
static bool modified_properties(obs_properties_t *, obs_property_t *, obs_data_t *);
static bool modified_properties(obs_properties_t *,
obs_property_t *, obs_data_t *);
static void *create(obs_data_t *, obs_source_t *);
static void destroy(void *);
@ -98,6 +99,7 @@ namespace Filter {
float_t m_cameraFieldOfView;
// Source
bool m_isInactive, m_isHidden;
bool m_isMeshUpdateRequired;
uint32_t m_rotationOrder;
vec3 m_position,