libobs: Allow transitions to give placeholder

The fade transition could benefit by providing NULL to differentiate a
real source texture from the transparent placeholder. This would give it
a chance to fade correctly for source transitions.
master
jpark37 2022-04-06 23:51:52 -07:00 committed by Jim
parent 42c7e29d25
commit 8194e9431e
3 changed files with 21 additions and 2 deletions

View File

@ -1576,6 +1576,7 @@ Functions used by transitions
---------------------
.. function:: void obs_transition_video_render(obs_source_t *transition, obs_transition_video_render_callback_t callback)
void obs_transition_video_render2(obs_source_t *transition, obs_transition_video_render_callback_t callback, gs_texture_t *placeholder_texture)
Helper function used for rendering transitions. This function will
render two distinct textures for source A and source B of the
@ -1587,6 +1588,10 @@ Functions used by transitions
(0.0f..1.0f), *cx* and *cy* are the current dimensions of the
transition, and *data* is the implementation's private data.
The *placeholder_texture* parameter allows a callback to receive
a replacement that isn't the default transparent texture, including
NULL if the caller desires.
Relevant data types used with this function:
.. code:: cpp

View File

@ -725,6 +725,15 @@ void obs_transition_force_stop(obs_source_t *transition)
void obs_transition_video_render(obs_source_t *transition,
obs_transition_video_render_callback_t callback)
{
obs_transition_video_render2(transition, callback,
obs->video.transparent_texture);
}
void obs_transition_video_render2(
obs_source_t *transition,
obs_transition_video_render_callback_t callback,
gs_texture_t *placeholder_texture)
{
struct transition_state state;
struct matrix4 matrices[2];
@ -773,9 +782,9 @@ void obs_transition_video_render(obs_source_t *transition,
source_space);
tex[i] = get_texture(transition, i);
if (!tex[i])
tex[i] = obs->video.transparent_texture;
tex[i] = placeholder_texture;
} else {
tex[i] = obs->video.transparent_texture;
tex[i] = placeholder_texture;
}
}

View File

@ -1587,6 +1587,11 @@ EXPORT void
obs_transition_video_render(obs_source_t *transition,
obs_transition_video_render_callback_t callback);
EXPORT void
obs_transition_video_render2(obs_source_t *transition,
obs_transition_video_render_callback_t callback,
gs_texture_t *placeholder_texture);
EXPORT enum gs_color_space
obs_transition_video_get_color_space(obs_source_t *transition);