mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-05 15:30:00 +01:00
Intregration of session fading with transition and session source
management.
This commit is contained in:
@@ -302,6 +302,14 @@ void ImGuiVisitor::visit (SessionSource& s)
|
||||
ImGuiToolkit::Icon(4,9);
|
||||
ImGui::SameLine(0, 10);
|
||||
ImGui::Text("Session File");
|
||||
|
||||
if (ImGuiToolkit::ButtonIcon(3, 2)) s.session()->setFading(0.f);
|
||||
float f = s.session()->fading();
|
||||
ImGui::SameLine(0, 10);
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
if (ImGui::SliderFloat("Fading", &f, 0.0, 1.0, f < 0.001 ? "None" : "%.2f") )
|
||||
s.session()->setFading(f);
|
||||
|
||||
if ( ImGui::Button( ICON_FA_FILE_UPLOAD " Make Current", ImVec2(IMGUI_RIGHT_ALIGN, 0)) )
|
||||
Mixer::manager().set( s.detach() );
|
||||
if ( ImGui::Button( ICON_FA_FILE_EXPORT " Import", ImVec2(IMGUI_RIGHT_ALIGN, 0)) )
|
||||
|
||||
@@ -552,7 +552,8 @@ void Mixer::setView(View::Mode m)
|
||||
case View::MIXING:
|
||||
default:
|
||||
current_view_ = &mixing_;
|
||||
mixing_.setFading( session_->fading() );
|
||||
// need to deeply update mixer view to apply fading change
|
||||
View::need_deep_update_ = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -691,6 +692,9 @@ void Mixer::swap()
|
||||
// set resolution
|
||||
session_->setResolution( session_->config(View::RENDERING)->scale_ );
|
||||
|
||||
// transfer fading
|
||||
session_->setFading( MAX(back_session_->fading(), session_->fading()), true );
|
||||
|
||||
// request complete update for views
|
||||
View::need_deep_update_ = true;
|
||||
|
||||
|
||||
19
Session.cpp
19
Session.cpp
@@ -156,25 +156,14 @@ void Session::setResolution(glm::vec3 resolution)
|
||||
config_[View::RENDERING]->scale_ = resolution;
|
||||
}
|
||||
|
||||
void Session::setFading(float f)
|
||||
void Session::setFading(float f, bool forcenow)
|
||||
{
|
||||
if (forcenow)
|
||||
render_.setFading( f );
|
||||
|
||||
fading_target_ = CLAMP(f, 0.f, 1.f);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//void Session::fadeIn() {
|
||||
// float f = render_.fading();
|
||||
// if ( f > EPSILON)
|
||||
// render_.setFading( f / 2.f);
|
||||
//}
|
||||
|
||||
//void Session::fadeOut() {
|
||||
// float f = render_.fading();
|
||||
// if ( f < 1.f - EPSILON)
|
||||
// render_.setFading( f * 2.f);
|
||||
//}
|
||||
|
||||
SourceList::iterator Session::begin()
|
||||
{
|
||||
return sources_.begin();
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
void setResolution(glm::vec3 resolution);
|
||||
|
||||
// manipulate fading of output
|
||||
void setFading(float f);
|
||||
void setFading(float f, bool forcenow = false);
|
||||
inline float fading() const { return fading_target_; }
|
||||
|
||||
// configuration for group nodes of views
|
||||
|
||||
24
View.cpp
24
View.cpp
@@ -305,15 +305,23 @@ void MixingView::selectAll()
|
||||
}
|
||||
}
|
||||
|
||||
void MixingView::setFading(float f)
|
||||
void MixingView::update(float dt)
|
||||
{
|
||||
// reverse calculate angle from fading
|
||||
float angle = SIGN(slider_root_->rotation_.z) * asin(f) * 2.f;
|
||||
// move slider
|
||||
slider_root_->rotation_.z = angle;
|
||||
// visual feedback on mixing circle
|
||||
f = 1.f - f;
|
||||
mixingCircle_->shader()->color = glm::vec4(f, f, f, 1.f);
|
||||
View::update(dt);
|
||||
|
||||
// a more complete update is requested
|
||||
if (View::need_deep_update_) {
|
||||
|
||||
// reverse calculate angle from fading
|
||||
float f = Mixer::manager().session()->fading();
|
||||
float angle = SIGN(slider_root_->rotation_.z) * asin(f) * 2.f;
|
||||
// move slider
|
||||
slider_root_->rotation_.z = angle;
|
||||
// visual feedback on mixing circle
|
||||
f = 1.f - f;
|
||||
mixingCircle_->shader()->color = glm::vec4(f, f, f, 1.f);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
View::Cursor MixingView::grab (Source *s, glm::vec2 from, glm::vec2 to, std::pair<Node *, glm::vec2> pick)
|
||||
|
||||
6
View.h
6
View.h
@@ -24,6 +24,7 @@ public:
|
||||
virtual void draw ();
|
||||
|
||||
virtual void zoom (float) {}
|
||||
virtual void recenter();
|
||||
virtual void centerSource(Source *) {}
|
||||
|
||||
typedef enum {
|
||||
@@ -66,8 +67,6 @@ public:
|
||||
return Cursor();
|
||||
}
|
||||
|
||||
virtual void recenter();
|
||||
|
||||
// accessible scene
|
||||
Scene scene;
|
||||
|
||||
@@ -89,6 +88,7 @@ public:
|
||||
MixingView();
|
||||
|
||||
void draw () override;
|
||||
void update (float dt) override;
|
||||
void zoom (float factor) override;
|
||||
void centerSource(Source *) override;
|
||||
void selectAll() override;
|
||||
@@ -99,7 +99,6 @@ public:
|
||||
void setAlpha (Source *s);
|
||||
inline float limboScale() { return limbo_scale_; }
|
||||
|
||||
void setFading (float f);
|
||||
|
||||
private:
|
||||
uint textureMixingQuadratic();
|
||||
@@ -112,6 +111,7 @@ private:
|
||||
|
||||
class RenderView : public View
|
||||
{
|
||||
FrameBuffer *intermediate_buffer_;
|
||||
FrameBuffer *frame_buffer_;
|
||||
Surface *fading_overlay_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user