Fix defaults for DrawMatrix

master
Palana 2014-04-24 22:33:02 +02:00
parent 12cc06b560
commit 52b9f5fe52
2 changed files with 10 additions and 13 deletions

View File

@ -1,7 +1,7 @@
uniform float4x4 ViewProj;
uniform float4x4 color_matrix;
uniform float3 color_range_min;
uniform float3 color_range_max;
uniform float3 color_range_min = {0.0, 0.0, 0.0};
uniform float3 color_range_max = {1.0, 1.0, 1.0};
uniform texture2d image;
sampler_state def_sampler {

View File

@ -822,9 +822,6 @@ static bool update_async_texture(struct obs_source *source,
return true;
}
static float const full_range_min[] = {0., 0., 0.};
static float const full_range_max[] = {1., 1., 1.};
static inline void obs_source_draw_texture(struct obs_source *source,
effect_t effect, float *color_matrix,
float const *color_range_min, float const *color_range_max)
@ -835,19 +832,19 @@ static inline void obs_source_draw_texture(struct obs_source *source,
if (source->async_convert_texrender)
tex = texrender_gettexture(source->async_convert_texrender);
if (color_matrix) {
if (color_range_min) {
size_t const size = sizeof(float) * 3;
if (!color_range_min)
color_range_min = full_range_min;
if (!color_range_max)
color_range_max = full_range_max;
param = effect_getparambyname(effect, "color_range_min");
effect_setval(effect, param, color_range_min, size);
}
if (color_range_max) {
size_t const size = sizeof(float) * 3;
param = effect_getparambyname(effect, "color_range_max");
effect_setval(effect, param, color_range_max, size);
}
if (color_matrix) {
param = effect_getparambyname(effect, "color_matrix");
effect_setval(effect, param, color_matrix, sizeof(float) * 16);
}