--- Nageru theme for TFK mini-tournament 2017, based on the default theme.
+-- Nageru theme for ultimate productions, based on the default theme.
local transition_start = -2.0
local transition_end = -1.0
return make_fade_chain(input0_live, input0_deint, input0_scale, input1_live, input1_deint, input1_scale, has_overlay, hq)
end)
-function make_sbs_input(chain, signal, deint, hq)
+function make_sbs_input(chain, signal, deint, has_overlay, hq)
local input = chain:add_live_input(not deint, deint) -- Override bounce only if not deinterlacing.
input:connect_signal(signal)
+ local overlay = nil
+ if has_overlay then
+ overlay = make_overlay(chain, input)
+ end
+
local resample_effect = nil
local resize_effect = nil
if (hq) then
wb_effect = wb_effect,
resample_effect = resample_effect,
resize_effect = resize_effect,
- padding_effect = padding_effect
+ padding_effect = padding_effect,
+ overlay = overlay
}
end
function make_sbs_chain(input0_type, input0_overlay, input1_type, hq)
local chain = EffectChain.new(16, 9)
- local input0 = make_sbs_input(chain, INPUT0_SIGNAL_NUM, input0_type == "livedeint", hq)
- local input1 = make_sbs_input(chain, INPUT1_SIGNAL_NUM, input1_type == "livedeint", hq)
-
- -- FIXME: input0_overlay
+ local input0 = make_sbs_input(chain, INPUT0_SIGNAL_NUM, input0_type == "livedeint", input0_overlay, hq)
+ local input1 = make_sbs_input(chain, INPUT4_SIGNAL_NUM, input1_type == "livedeint", false, hq)
input0.padding_effect:set_vec4("border_color", 0.0, 0.0, 0.0, 1.0)
input1.padding_effect:set_vec4("border_color", 0.0, 0.0, 0.0, 0.0)
return {
chain = chain,
input0 = input0,
- input1 = input1
+ input1 = input1,
+ overlay = input0.overlay -- May be nil.
}
end
if is_plain_signal(signal_num) then
return channel == (signal_num + 2)
end
+ if signal_num == SBS_SIGNAL_NUM then
+ return is_sbs_participating_signal(channel - 2)
+ end
if signal_num == STATIC_SIGNAL_NUM then
return (channel == NUM_CAMERAS)
end
return t >= transition_start and t <= transition_end
end
+function is_sbs_participating_signal(signal_num)
+ return signal_num == INPUT0_SIGNAL_NUM or signal_num == INPUT4_SIGNAL_NUM
+end
+
+function simple_signal_has_overlay(signal_num)
+ -- The commentator output has no overlay on it.
+ return signal_num ~= INPUT4_SIGNAL_NUM
+end
+
-- API ENTRY POINT
-- Called every frame.
function get_transitions(t)
end
-- Various zooms.
- if live_signal_num == SBS_SIGNAL_NUM and is_plain_signal(preview_signal_num) then
+ if live_signal_num == SBS_SIGNAL_NUM and is_sbs_participating_signal(preview_signal_num) then
return {"Cut", "Zoom in"}
- elseif is_plain_signal(live_signal_num) and preview_signal_num == SBS_SIGNAL_NUM then
+ elseif is_sbs_participating_signal(live_signal_num) and preview_signal_num == SBS_SIGNAL_NUM then
return {"Cut", "Zoom out"}
end
return
end
- if (live_signal_num == SBS_SIGNAL_NUM and is_plain_signal(preview_signal_num)) or
- (preview_signal_num == SBS_SIGNAL_NUM and is_plain_signal(live_signal_num)) then
+ if (live_signal_num == SBS_SIGNAL_NUM and is_sbs_participating_signal(preview_signal_num)) or
+ (preview_signal_num == SBS_SIGNAL_NUM and is_sbs_participating_signal(live_signal_num)) then
start_transition(ZOOM_TRANSITION, t, 1.0)
end
elseif num == 2 then
chain.mix_effect:set_float("strength_first", 1.0 - tt)
chain.mix_effect:set_float("strength_second", tt)
- prepare_overlay_live(chain, t)
+
+ -- The commentator output has no overlay on it.
+ local extra_alpha_factor = 1.0
+ if not simple_signal_has_overlay(transition_src_signal) and
+ not simple_signal_has_overlay(transition_dst_signal) then
+ extra_alpha_factor = 0.0
+ elseif not simple_signal_has_overlay(transition_src_signal) then
+ extra_alpha_factor = tt
+ elseif not simple_signal_has_overlay(transition_dst_signal) then
+ extra_alpha_factor = 1.0 - tt
+ end
+ prepare_overlay_live(chain, t, extra_alpha_factor)
end
return chain.chain, prepare
end
-- SBS code (live_signal_num == SBS_SIGNAL_NUM, or in a transition to/from it).
function get_sbs_chain(signals, t, width, height, input_resolution)
local input0_type = get_input_type(signals, INPUT0_SIGNAL_NUM)
- local input1_type = get_input_type(signals, INPUT1_SIGNAL_NUM)
- return sbs_chains[input0_type][false][input1_type][true] -- FIXME: overlay is always false?
+ local input1_type = get_input_type(signals, INPUT4_SIGNAL_NUM)
+ return sbs_chains[input0_type][overlay_enabled][input1_type][true]
end
-- API ENTRY POINT
local chain = get_sbs_chain(signals, t, width, height, input_resolution)
prepare = function()
prepare_sbs_chain(chain, calc_zoom_progress(t), transition_type, transition_src_signal, transition_dst_signal, width, height, input_resolution)
+ prepare_overlay_live(chain, t, 1.0)
end
return chain.chain, prepare
elseif transition_type == NO_TRANSITION and live_signal_num == SBS_SIGNAL_NUM then
local chain = get_sbs_chain(signals, t, width, height, input_resolution)
prepare = function()
prepare_sbs_chain(chain, 0.0, NO_TRANSITION, 0, SBS_SIGNAL_NUM, width, height, input_resolution)
+ prepare_overlay_live(chain, t, 1.0)
end
return chain.chain, prepare
elseif transition_type == FADE_TRANSITION then
elseif is_plain_signal(live_signal_num) then
local input_type = get_input_type(signals, live_signal_num)
local input_scale = needs_scale(signals, live_signal_num, width, height)
- local chain = simple_chains[input_type][input_scale][overlay_enabled][true]
+ local overlay_really_enabled = overlay_enabled and simple_signal_has_overlay(live_signal_num)
+ local chain = simple_chains[input_type][input_scale][overlay_really_enabled][true]
prepare = function()
chain.input:connect_signal(live_signal_num)
set_scale_parameters_if_needed(chain, width, height)
set_neutral_color_from_signal(chain.wb_effect, live_signal_num)
- prepare_overlay_live(chain, t)
+ prepare_overlay_live(chain, t, 1.0)
end
return chain.chain, prepare
elseif live_signal_num == STATIC_SIGNAL_NUM then -- Static picture.
local chain = static_chains[true]
prepare = function()
- prepare_overlay_live(chain, t)
+ prepare_overlay_live(chain, t, 1.0) -- FIXME: Should this ever be here?
end
return chain.chain, prepare
else
end
else
num = preview_signal_num + 2
- show_overlay = overlay_enabled
+ show_overlay = overlay_enabled and simple_signal_has_overlay(preview_signal_num)
end
end
end
if num == SBS_SIGNAL_NUM + 2 then
local input0_type = get_input_type(signals, INPUT0_SIGNAL_NUM)
- local input1_type = get_input_type(signals, INPUT1_SIGNAL_NUM)
+ local input1_type = get_input_type(signals, INPUT4_SIGNAL_NUM)
local chain = sbs_chains[input0_type][show_overlay][input1_type][false]
prepare = function()
prepare_sbs_chain(chain, 0.0, NO_TRANSITION, 0, SBS_SIGNAL_NUM, width, height, input_resolution)
function prepare_sbs_chain(chain, t, transition_type, src_signal, dst_signal, screen_width, screen_height, input_resolution)
chain.input0.input:connect_signal(0)
- chain.input1.input:connect_signal(1)
+ chain.input1.input:connect_signal(4)
set_neutral_color(chain.input0.wb_effect, neutral_colors[1])
- set_neutral_color(chain.input1.wb_effect, neutral_colors[2])
+ set_neutral_color(chain.input1.wb_effect, neutral_colors[5])
-- First input is positioned (16,48) from top-left.
-- Second input is positioned (16,48) from the bottom-right.
if signal == INPUT0_SIGNAL_NUM then
affine_param = find_affine_param(pos0, lerp_pos(pos0, pos_fs, real_t))
- elseif signal == INPUT1_SIGNAL_NUM then
+ elseif signal == INPUT4_SIGNAL_NUM then
affine_param = find_affine_param(pos1, lerp_pos(pos1, pos_fs, real_t))
end
end
end
end
-function prepare_overlay_live(chain, t)
+function prepare_overlay_live(chain, t, extra_alpha_factor)
if chain.overlay then
local tt = calc_fade_progress(t, overlay_transition_start, overlay_transition_end)
overlay_alpha = overlay_alpha_src + tt * (overlay_alpha_dst - overlay_alpha_src)
+ overlay_alpha = overlay_alpha * extra_alpha_factor
--print("overlay_alpha=" .. overlay_alpha .. " [" .. overlay_alpha_src .. "," .. overlay_alpha_dst .. "]@" .. tt)
if t > overlay_transition_end and overlay_alpha_dst == 0.0 then
overlay_enabled = false -- Takes effect next frame.