Cleanup of Session loading, saving, embedding in source and added option

to make sessionSource the current Session.
This commit is contained in:
brunoherbelin
2020-05-21 10:20:40 +02:00
parent 8ad58ebeca
commit f16c1843c3
20 changed files with 295 additions and 267 deletions

View File

@@ -279,6 +279,7 @@ set(VMIX_RSC_FILES
./rsc/mesh/circle.ply ./rsc/mesh/circle.ply
./rsc/mesh/icon_video.ply ./rsc/mesh/icon_video.ply
./rsc/mesh/icon_image.ply ./rsc/mesh/icon_image.ply
./rsc/mesh/icon_vimix.ply
) )
add_executable(${VMIX_BINARY} add_executable(${VMIX_BINARY}

View File

@@ -265,18 +265,25 @@ void ImGuiVisitor::visit (Source& s)
s.groupNode(View::GEOMETRY)->accept(*this); s.groupNode(View::GEOMETRY)->accept(*this);
// Action on source // Action on source
ImGui::Button("Clone", ImVec2(IMGUI_RIGHT_ALIGN, 0)); // ImGui::Button("Clone", ImVec2(IMGUI_RIGHT_ALIGN, 0));
} }
void ImGuiVisitor::visit (MediaSource& s) void ImGuiVisitor::visit (MediaSource& s)
{ {
if ( s.mediaplayer()->duration() == GST_CLOCK_TIME_NONE) {
ImGui::Text("Image");
}
else {
ImGui::Text("Video");
if (ImGui::Button("Open Media Player", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) if (ImGui::Button("Open Media Player", ImVec2(IMGUI_RIGHT_ALIGN, 0)) )
Settings::application.media_player = !Settings::application.media_player; Settings::application.media_player = true;
}
} }
void ImGuiVisitor::visit (SessionSource& s) void ImGuiVisitor::visit (SessionSource& s)
{ {
// ImGui::Button("Expand", ImVec2(IMGUI_RIGHT_ALIGN, 0)); // ImGui::Button("Expand", ImVec2(IMGUI_RIGHT_ALIGN, 0));
ImGui::Text("Session");
if (ImGui::Button("Make Current", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) if (ImGui::Button("Make Current", ImVec2(IMGUI_RIGHT_ALIGN, 0)) )
Mixer::manager().open( s.path() ); Mixer::manager().set( s.detach() );
} }

View File

@@ -26,11 +26,9 @@ MediaSource::MediaSource() : Source(), path_("")
MediaSource::~MediaSource() MediaSource::~MediaSource()
{ {
// TODO delete media surface with visitor // delete media surface & player
delete mediasurface_; delete mediasurface_;
delete mediaplayer_; delete mediaplayer_;
// TODO verify that all surfaces and node is deleted in Source destructor
} }
void MediaSource::setPath(const std::string &p) void MediaSource::setPath(const std::string &p)

114
Mixer.cpp
View File

@@ -21,46 +21,43 @@ using namespace tinyxml2;
#include "Mixer.h" #include "Mixer.h"
// static objects for multithreaded session loading // static semaphore to prevent multiple threads for load / save
static std::atomic<bool> sessionThreadActive_ = false; static std::atomic<bool> sessionThreadActive_ = false;
static std::string sessionThreadFilename_ = ""; static std::atomic<bool> sessionSwapRequested_ = false;
static std::atomic<bool> sessionLoadFinished_ = false;
// static multithreaded session loading
static void loadSession(const std::string& filename, Session *session) static void loadSession(const std::string& filename, Session *session)
{ {
while (sessionThreadActive_) while (sessionThreadActive_)
std::this_thread::sleep_for( std::chrono::milliseconds(50)); std::this_thread::sleep_for( std::chrono::milliseconds(50));
sessionThreadActive_ = true; sessionThreadActive_ = true;
sessionLoadFinished_ = false;
sessionThreadFilename_ = "";
// actual loading of xml file // actual loading of xml file
SessionCreator creator( session ); SessionCreator creator( session );
if (!creator.load(filename)) { if (creator.load(filename)) {
// loaded ok
session->setFilename(filename);
sessionSwapRequested_ = true;
// cosmetics load ok
Log::Notify("Session %s loaded. %d source(s) created.", filename.c_str(), session->numSource());
}
else {
// error loading // error loading
Log::Warning("Failed to load Session file %s.", filename.c_str()); Log::Warning("Failed to load Session file %s.", filename.c_str());
} }
else {
// loaded ok
Log::Notify("Session %s loaded. %d source(s) created.", filename.c_str(), session->numSource());
}
sessionThreadFilename_ = filename;
sessionLoadFinished_ = true;
sessionThreadActive_ = false; sessionThreadActive_ = false;
} }
// static objects for multithreaded session saving // static multithreaded session saving
static std::atomic<bool> sessionSaveFinished_ = false;
static void saveSession(const std::string& filename, Session *session) static void saveSession(const std::string& filename, Session *session)
{ {
// reset // reset
while (sessionThreadActive_) while (sessionThreadActive_)
std::this_thread::sleep_for( std::chrono::milliseconds(50)); std::this_thread::sleep_for( std::chrono::milliseconds(50));
sessionThreadActive_ = true; sessionThreadActive_ = true;
sessionSaveFinished_ = false;
sessionThreadFilename_ = "";
// creation of XML doc // creation of XML doc
XMLDocument xmlDoc; XMLDocument xmlDoc;
@@ -103,27 +100,33 @@ static void saveSession(const std::string& filename, Session *session)
} }
// save file to disk // save file to disk
XMLSaveDoc(&xmlDoc, filename); if ( XMLSaveDoc(&xmlDoc, filename) ) {
// loaded ok
Log::Notify("Session %s saved.", filename.c_str());
// all ok // all ok
sessionThreadFilename_ = filename; session->setFilename(filename);
sessionSaveFinished_ = true; // cosmetics saved ok
Settings::application.recentSessions.push(filename);
Log::Notify("Session %s saved.", filename.c_str());
}
else {
// error loading
Log::Warning("Failed to save Session file %s.", filename.c_str());
}
sessionThreadActive_ = false; sessionThreadActive_ = false;
} }
Mixer::Mixer() : session_(nullptr), back_session_(nullptr), current_view_(nullptr) Mixer::Mixer() : session_(nullptr), back_session_(nullptr), current_view_(nullptr)
{ {
// this initializes with a new empty session // unsused initial empty session
newSession(); session_ = new Session;
// auto load if Settings ask to // auto load if Settings ask to
if ( Settings::application.recentSessions.load_at_start ) { if ( Settings::application.recentSessions.load_at_start &&
if ( Settings::application.recentSessions.filenames.size() > 0 ) Settings::application.recentSessions.filenames.size() > 0 )
open( Settings::application.recentSessions.filenames.back() ); open( Settings::application.recentSessions.filenames.back() );
} else
// initializes with a new empty session
clear();
// this initializes with the current view // this initializes with the current view
setCurrentView( (View::Mode) Settings::application.current_view ); setCurrentView( (View::Mode) Settings::application.current_view );
@@ -132,26 +135,18 @@ Mixer::Mixer() : session_(nullptr), back_session_(nullptr), current_view_(nullpt
void Mixer::update() void Mixer::update()
{ {
// change session when threaded loading is finished // change session when threaded loading is finished
if (sessionLoadFinished_) { if (sessionSwapRequested_) {
sessionLoadFinished_ = false; sessionSwapRequested_ = false;
// successfully loading // successfully loading
if ( back_session_ ) { if ( back_session_ ) {
// swap front and back sessions // swap front and back sessions
swap(); swap();
// set session filename and remember it // set session filename
sessionFilename_ = sessionThreadFilename_; Rendering::manager().setWindowTitle(session_->filename());
Settings::application.recentSessions.push(sessionFilename_); Settings::application.recentSessions.push(session_->filename());
} }
} }
// confirm when threaded saving is finished
if (sessionSaveFinished_) {
sessionSaveFinished_ = false;
// set (new) session filename and remember it
sessionFilename_ = sessionThreadFilename_;
Settings::application.recentSessions.push(sessionFilename_);
}
// compute dt // compute dt
if (update_time_ == GST_CLOCK_TIME_NONE) if (update_time_ == GST_CLOCK_TIME_NONE)
update_time_ = gst_util_get_timestamp (); update_time_ = gst_util_get_timestamp ();
@@ -166,7 +161,6 @@ void Mixer::update()
mixing_.update(dt); mixing_.update(dt);
geometry_.update(dt); geometry_.update(dt);
layer_.update(dt); layer_.update(dt);
// TODO other views?
// optimize the reordering in depth for views // optimize the reordering in depth for views
View::need_reordering_ = false; View::need_reordering_ = false;
@@ -195,7 +189,7 @@ void Mixer::createSourceFile(std::string path)
{ {
// create a session source // create a session source
SessionSource *ss = new SessionSource(); SessionSource *ss = new SessionSource();
ss->setPath(path); ss->load(path);
s = ss; s = ss;
} }
else { else {
@@ -358,7 +352,7 @@ void Mixer::setCurrentView(View::Mode m)
Settings::application.current_view = (int) m; Settings::application.current_view = (int) m;
} }
View *Mixer::getView(View::Mode m) View *Mixer::view(View::Mode m)
{ {
switch (m) { switch (m) {
case View::GEOMETRY: case View::GEOMETRY:
@@ -379,8 +373,8 @@ View *Mixer::currentView()
void Mixer::save() void Mixer::save()
{ {
if (!sessionFilename_.empty()) if (!session_->filename().empty())
saveas(sessionFilename_); saveas(session_->filename());
} }
void Mixer::saveas(const std::string& filename) void Mixer::saveas(const std::string& filename)
@@ -457,7 +451,7 @@ void Mixer::swap()
back_session_ = nullptr; back_session_ = nullptr;
} }
void Mixer::newSession() void Mixer::clear()
{ {
// delete previous back session if needed // delete previous back session if needed
if (back_session_) if (back_session_)
@@ -467,13 +461,21 @@ void Mixer::newSession()
back_session_ = new Session; back_session_ = new Session;
// swap current with empty // swap current with empty
swap(); sessionSwapRequested_ = true;
}
// default view config
mixing_.restoreSettings(); void Mixer::set(Session *s)
geometry_.restoreSettings(); {
layer_.restoreSettings(); if ( s == nullptr )
return;
// empty session file name (does not save)
sessionFilename_ = ""; // delete previous back session if needed
if (back_session_)
delete back_session_;
// set to new given session
back_session_ = s;
// swap current with given session
sessionSwapRequested_ = true;
} }

28
Mixer.h
View File

@@ -35,12 +35,12 @@ public:
// manangement of sources // manangement of sources
void createSourceFile(std::string path); void createSourceFile(std::string path);
void createSourceRender() {}
void deleteSource(Source *s); void createSourceClone() {}
void deleteCurrentSource();
// operations on sources // operations on sources
void renameSource(Source *s, const std::string &newname); void renameSource(Source *s, const std::string &newname);
void deleteSource(Source *s);
// current source // current source
void setCurrentSource(std::string namesource); void setCurrentSource(std::string namesource);
@@ -48,22 +48,25 @@ public:
void setCurrentSource(int index); void setCurrentSource(int index);
void setCurrentSource(Source *s); void setCurrentSource(Source *s);
void unsetCurrentSource(); void unsetCurrentSource();
void deleteCurrentSource();
Source *currentSource(); Source *currentSource();
int indexCurrentSource(); int indexCurrentSource();
// management of view // management of view
View *getView(View::Mode m); View *view(View::Mode m);
void setCurrentView(View::Mode m); void setCurrentView(View::Mode m);
View *currentView(); View *currentView();
void setSession(Session *s) { session_ = s; } // manipulate, load and save sessions
Session *session() { return session_; } inline Session *session() const { return session_; }
void clear();
// load and save session
void open(const std::string& filename);
void saveas(const std::string& filename);
void save(); void save();
void newSession(); void saveas(const std::string& filename);
void open(const std::string& filename);
void import(const std::string& filename) {}
void import(Session *s) {}
void set(Session *s);
// inline std::string currentSessionFile() { return currentFilename_; }
protected: protected:
@@ -72,11 +75,10 @@ protected:
void swap(); void swap();
// void validateFilename(const std::string& filename); // void validateFilename(const std::string& filename);
std::string sessionFilename_; // std::string currentFilename_;
void insertSource(Source *s); void insertSource(Source *s);
void setCurrentSource(SourceList::iterator it); void setCurrentSource(SourceList::iterator it);
SourceList::iterator current_source_; SourceList::iterator current_source_;
int current_source_index_; int current_source_index_;

View File

@@ -207,6 +207,13 @@ void Rendering::GrabWindow(int dx, int dy)
glfwSetWindowPos(main_window_, xpos + dx, ypos + dy); glfwSetWindowPos(main_window_, xpos + dx, ypos + dy);
} }
void Rendering::setWindowTitle(std::string title)
{
std::string window_title = std::string(APP_NAME " -- ") + title;
glfwSetWindowTitle(main_window_, window_title.c_str());
}
void Rendering::PushFrontDrawCallback(RenderingCallback function) void Rendering::PushFrontDrawCallback(RenderingCallback function)
{ {
draw_callbacks_.push_front(function); draw_callbacks_.push_front(function);

View File

@@ -68,28 +68,27 @@ public:
// get Screenshot // get Screenshot
class Screenshot *CurrentScreenshot(); class Screenshot *CurrentScreenshot();
// window management
void setWindowTitle(std::string title);
// request fullscreen // request fullscreen
bool IsFullscreen (); bool IsFullscreen ();
void ToggleFullscreen(); void ToggleFullscreen ();
// get width of rendering area // get width of rendering area
float Width(); float Width();
// get height of rendering area // get height of rendering area
float Height(); float Height();
// get aspect ratio of rendering area // get aspect ratio of rendering area
float AspectRatio(); float AspectRatio();
// monitor management
float MonitorWidth();
float MonitorHeight();
inline float DPIScale() const { return dpi_scale_; }
// get projection matrix (for sharers) => Views // get projection matrix (for sharers) => Views
glm::mat4 Projection(); glm::mat4 Projection();
// unproject from window coordinate // unproject from window coordinate
glm::vec3 unProject(glm::vec2 screen_coordinate, glm::mat4 modelview = glm::mat4(1.f)); glm::vec3 unProject(glm::vec2 screen_coordinate, glm::mat4 modelview = glm::mat4(1.f));
// for opengl pipeline in gstreamer
void LinkPipeline( GstPipeline *pipeline );
float MonitorWidth();
float MonitorHeight();
inline float DPIScale() const { return dpi_scale_; }
private: private:
// loop update to begin new frame // loop update to begin new frame
@@ -110,7 +109,8 @@ private:
Screenshot screenshot_; Screenshot screenshot_;
bool request_screenshot_; bool request_screenshot_;
// for opengl pipeline in gstreamer
void LinkPipeline( GstPipeline *pipeline );
}; };

View File

@@ -1,19 +1,29 @@
#include <algorithm> #include <algorithm>
#include "defines.h" #include "defines.h"
#include "Settings.h"
#include "FrameBuffer.h" #include "FrameBuffer.h"
#include "Session.h" #include "Session.h"
#include "GarbageVisitor.h" #include "GarbageVisitor.h"
#include "Log.h" #include "Log.h"
Session::Session() Session::Session() : filename_("")
{ {
config_[View::RENDERING] = new Group; config_[View::RENDERING] = new Group;
config_[View::RENDERING]->scale_ = render_.resolution(); config_[View::RENDERING]->scale_ = render_.resolution();
config_[View::GEOMETRY] = new Group; config_[View::GEOMETRY] = new Group;
config_[View::GEOMETRY]->scale_ = Settings::application.views[View::GEOMETRY].default_scale;
config_[View::GEOMETRY]->translation_ = Settings::application.views[View::GEOMETRY].default_translation;
config_[View::LAYER] = new Group; config_[View::LAYER] = new Group;
config_[View::LAYER]->scale_ = Settings::application.views[View::LAYER].default_scale;
config_[View::LAYER]->translation_ = Settings::application.views[View::LAYER].default_translation;
config_[View::MIXING] = new Group; config_[View::MIXING] = new Group;
config_[View::MIXING]->scale_ = Settings::application.views[View::MIXING].default_scale;
config_[View::MIXING]->translation_ = Settings::application.views[View::MIXING].default_translation;
} }

View File

@@ -19,12 +19,11 @@ public:
SourceList::iterator begin (); SourceList::iterator begin ();
SourceList::iterator end (); SourceList::iterator end ();
SourceList::iterator find (int index); SourceList::iterator find (int index);
int index (SourceList::iterator it) const;
SourceList::iterator find (Source *s); SourceList::iterator find (Source *s);
SourceList::iterator find (std::string name); SourceList::iterator find (std::string name);
SourceList::iterator find (Node *node); SourceList::iterator find (Node *node);
uint numSource() const; uint numSource() const;
int index (SourceList::iterator it) const;
// update all sources // update all sources
void update (float dt); void update (float dt);
@@ -36,10 +35,14 @@ public:
// configuration for group nodes of views // configuration for group nodes of views
inline Group *config (View::Mode m) const { return config_.at(m); } inline Group *config (View::Mode m) const { return config_.at(m); }
// name of file containing this session
void setFilename(const std::string &filename) { filename_ = filename; }
std::string filename() const { return filename_; }
protected: protected:
RenderView render_; RenderView render_;
SourceList sources_; SourceList sources_;
std::string filename_;
std::map<View::Mode, Group*> config_; std::map<View::Mode, Group*> config_;
}; };

View File

@@ -234,7 +234,7 @@ void SessionCreator::visit (SessionSource& s)
XMLElement* pathNode = xmlCurrent_->FirstChildElement("path"); XMLElement* pathNode = xmlCurrent_->FirstChildElement("path");
if (pathNode) { if (pathNode) {
std::string path = std::string ( pathNode->GetText() ); std::string path = std::string ( pathNode->GetText() );
s.setPath(path); s.load(path);
} }
} }

View File

@@ -24,12 +24,17 @@ void SessionSource::loadSession(const std::string& filename, SessionSource *sour
// actual loading of xml file // actual loading of xml file
SessionCreator creator( source->session_ ); SessionCreator creator( source->session_ );
if (!creator.load(filename)) { if (creator.load(filename)) {
// all ok, validate session filename
source->session_->setFilename(filename);
}
else {
// error loading // error loading
Log::Notify("Failed to load Session file %s.", filename.c_str()); Log::Notify("Failed to load Session file %s.", filename.c_str());
source->loadFailed_ = true; source->loadFailed_ = true;
} }
// end thread
source->loadFinished_ = true; source->loadFinished_ = true;
} }
@@ -49,14 +54,15 @@ SessionSource::SessionSource() : Source(), path_("")
SessionSource::~SessionSource() SessionSource::~SessionSource()
{ {
// TODO delete media surface with visitor // delete surface
delete sessionsurface_; delete sessionsurface_;
// TODO close and delete session // delete session
if (session_)
delete session_; delete session_;
} }
void SessionSource::setPath(const std::string &p) void SessionSource::load(const std::string &p)
{ {
path_ = p; path_ = p;
@@ -66,14 +72,15 @@ void SessionSource::setPath(const std::string &p)
Log::Notify("Opening %s", p.c_str()); Log::Notify("Opening %s", p.c_str());
} }
std::string SessionSource::path() const Session *SessionSource::detach()
{ {
return path_; // remember pointer to give away
} Session *giveaway = session_;
Session *SessionSource::session() const // work on a new session
{ session_ = new Session;
return session_;
return giveaway;
} }
bool SessionSource::failed() const bool SessionSource::failed() const
@@ -89,11 +96,15 @@ void SessionSource::init()
// set resolution // set resolution
session_->setResolution( session_->config(View::RENDERING)->scale_ ); session_->setResolution( session_->config(View::RENDERING)->scale_ );
// update once
session_->update(dt_);
// get the texture index from media player, apply it to the media surface // get the texture index from media player, apply it to the media surface
sessionsurface_->setTextureIndex( session_->frame()->texture() ); sessionsurface_->setTextureIndex( session_->frame()->texture() );
// create Frame buffer matching size of media player // create Frame buffer matching size of media player
renderbuffer_ = new FrameBuffer(session_->frame()->resolution()); renderbuffer_ = new FrameBuffer(session_->frame()->resolution());
renderbuffer_->setClearColor(glm::vec4(0.f, 0.f, 0.f, 1.f));
// create the surfaces to draw the frame buffer in the views // create the surfaces to draw the frame buffer in the views
rendersurface_ = new FrameBufferSurface(renderbuffer_, blendingshader_); rendersurface_ = new FrameBufferSurface(renderbuffer_, blendingshader_);
@@ -108,8 +119,8 @@ void SessionSource::init()
if (is) is->stipple = 1.0; if (is) is->stipple = 1.0;
groups_[View::MIXING]->attach(surfacemix); groups_[View::MIXING]->attach(surfacemix);
groups_[View::LAYER]->attach(surfacemix); groups_[View::LAYER]->attach(surfacemix);
// TODO icon session // icon session
// overlays_[View::MIXING]->attach( new Mesh("mesh/icon_video.ply") ); overlays_[View::MIXING]->attach( new Mesh("mesh/icon_vimix.ply") );
// scale all mixing nodes to match aspect ratio of the media // scale all mixing nodes to match aspect ratio of the media
for (NodeSet::iterator node = groups_[View::MIXING]->begin(); for (NodeSet::iterator node = groups_[View::MIXING]->begin();
@@ -141,13 +152,13 @@ void SessionSource::init()
void SessionSource::render() void SessionSource::render()
{ {
if (!initialized_) if (!initialized_)
{
init(); init();
}
else { else {
// update session // update session
session_->update(dt_); session_->update(dt_);
sessionsurface_->setTextureIndex( session_->frame()->texture() );
// render the media player into frame buffer // render the media player into frame buffer
static glm::mat4 projection = glm::ortho(-1.f, 1.f, -1.f, 1.f, -1.f, 1.f); static glm::mat4 projection = glm::ortho(-1.f, 1.f, -1.f, 1.f, -1.f, 1.f);
renderbuffer_->begin(); renderbuffer_->begin();

View File

@@ -16,10 +16,12 @@ public:
void accept (Visitor& v) override; void accept (Visitor& v) override;
bool failed() const override; bool failed() const override;
// Media specific interface // Session Source specific interface
void setPath(const std::string &p); void load(const std::string &p);
std::string path() const; Session *detach();
Session *session() const;
inline std::string path() const { return path_; }
inline Session *session() const { return session_; }
protected: protected:

View File

@@ -97,7 +97,7 @@ struct Application
current_view = 1; current_view = 1;
framebuffer_ar = 3; framebuffer_ar = 3;
framebuffer_h = 1; framebuffer_h = 1;
windows.push_back(WindowConfig(APP_TITLE)); windows.push_back(WindowConfig(APP_NAME APP_TITLE));
} }
}; };

View File

@@ -212,11 +212,14 @@ void UserInterface::handleKeyboard()
} }
else if (ImGui::IsKeyPressed( GLFW_KEY_S )) { else if (ImGui::IsKeyPressed( GLFW_KEY_S )) {
// Save Session // Save Session
if (Mixer::manager().session()->filename().empty())
std::thread (SessionFileDialogSave, Settings::application.recentSessions.path).detach();
else
Mixer::manager().save(); Mixer::manager().save();
} }
else if (ImGui::IsKeyPressed( GLFW_KEY_W )) { else if (ImGui::IsKeyPressed( GLFW_KEY_W )) {
// New Session // New Session
Mixer::manager().newSession(); Mixer::manager().clear();
} }
else if (ImGui::IsKeyPressed( GLFW_KEY_L )) { else if (ImGui::IsKeyPressed( GLFW_KEY_L )) {
// Logs // Logs
@@ -237,6 +240,7 @@ void UserInterface::handleKeyboard()
} }
else { else {
// TODO make sure no entry / window box is active
keyboard_modifier_active = false; keyboard_modifier_active = false;
// Action keys // Action keys
@@ -472,6 +476,9 @@ void UserInterface::showMenuFile()
navigator.hidePannel(); navigator.hidePannel();
} }
if (ImGui::MenuItem( ICON_FA_FILE_DOWNLOAD " Save", "Ctrl+S")) { if (ImGui::MenuItem( ICON_FA_FILE_DOWNLOAD " Save", "Ctrl+S")) {
if (Mixer::manager().session()->filename().empty())
std::thread (SessionFileDialogSave, Settings::application.recentSessions.path).detach();
else
Mixer::manager().save(); Mixer::manager().save();
navigator.hidePannel(); navigator.hidePannel();
} }
@@ -483,7 +490,7 @@ void UserInterface::showMenuFile()
ImGui::Separator(); ImGui::Separator();
if (ImGui::MenuItem( ICON_FA_FILE " New", "Ctrl+W")) { if (ImGui::MenuItem( ICON_FA_FILE " New", "Ctrl+W")) {
Mixer::manager().newSession(); Mixer::manager().clear();
navigator.hidePannel(); navigator.hidePannel();
} }
ImGui::SetNextItemWidth( ImGui::GetContentRegionAvail().x ); ImGui::SetNextItemWidth( ImGui::GetContentRegionAvail().x );

View File

@@ -2,7 +2,7 @@
#define VMIX_DEFINES_H #define VMIX_DEFINES_H
#define APP_NAME "vimix" #define APP_NAME "vimix"
#define APP_TITLE "vimix -- Video Live Mixer" #define APP_TITLE " -- Video Live Mixer"
#define APP_SETTINGS "vimix.xml" #define APP_SETTINGS "vimix.xml"
#define APP_VERSION_MAJOR 0 #define APP_VERSION_MAJOR 0
#define APP_VERSION_MINOR 1 #define APP_VERSION_MINOR 1

View File

@@ -45,29 +45,9 @@
#define PI 3.14159265358979323846 #define PI 3.14159265358979323846
void drawCustomGui()
{
ImGui::SetNextWindowPos(ImVec2(200, 200), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(300, 300), ImGuiCond_FirstUseEver);
if ( !ImGui::Begin("Custom"))
{
ImGui::End();
return;
}
ImGui::End();
}
void drawScene() void drawScene()
{ {
// Mixer::manager().update();
Mixer::manager().draw(); Mixer::manager().draw();
} }
@@ -102,7 +82,7 @@ int main(int, char**)
// test text editor // test text editor
UserInterface::manager().fillShaderEditor( Resource::getText("shaders/image.fs") ); UserInterface::manager().fillShaderEditor( Resource::getText("shaders/image.fs") );
// init the scene // draw the scene
Rendering::manager().PushFrontDrawCallback(drawScene); Rendering::manager().PushFrontDrawCallback(drawScene);
// init elements to the scene // init elements to the scene
@@ -135,8 +115,6 @@ int main(int, char**)
Rendering::manager().Draw(); Rendering::manager().Draw();
} }
// Mixer::manager().save("./testsession.vmx");
UserInterface::manager().Terminate(); UserInterface::manager().Terminate();
Rendering::manager().Terminate(); Rendering::manager().Terminate();

View File

@@ -12,67 +12,67 @@ property uchar alpha
element face 57 element face 57
property list uchar uint vertex_indices property list uchar uint vertex_indices
end_header end_header
-0.121622 1.052659 0.000000 255 255 255 255 -0.121043 1.084839 0.000000 255 255 255 255
-0.101327 1.214990 0.000000 255 255 255 255 -0.100747 1.247170 0.000000 255 255 255 255
-0.121622 1.235281 0.000000 255 255 255 255 -0.121043 1.267461 0.000000 255 255 255 255
0.121924 1.235281 0.000000 255 255 255 255 0.122504 1.267461 0.000000 255 255 255 255
0.101629 1.214990 0.000000 255 255 255 255 0.102208 1.247170 0.000000 255 255 255 255
0.121924 1.052659 0.000000 255 255 255 255 0.122504 1.084839 0.000000 255 255 255 255
-0.101327 1.072951 0.000000 255 255 255 255 -0.100747 1.105131 0.000000 255 255 255 255
0.101629 1.072951 0.000000 255 255 255 255 0.102208 1.105131 0.000000 255 255 255 255
-0.057726 1.194559 0.000000 255 255 255 255 -0.057147 1.226739 0.000000 255 255 255 255
-0.053597 1.194559 0.000000 255 255 255 255 -0.053018 1.226740 0.000000 255 255 255 255
-0.055662 1.194698 0.000000 255 255 255 255 -0.055082 1.226879 0.000000 255 255 255 255
-0.051617 1.194155 0.000000 255 255 255 255 -0.051037 1.226335 0.000000 255 255 255 255
-0.059707 1.194155 0.000000 255 255 255 255 -0.059127 1.226335 0.000000 255 255 255 255
-0.049739 1.193502 0.000000 255 255 255 255 -0.049159 1.225682 0.000000 255 255 255 255
-0.061585 1.193502 0.000000 255 255 255 255 -0.061005 1.225682 0.000000 255 255 255 255
-0.047981 1.192620 0.000000 255 255 255 255 -0.047402 1.224800 0.000000 255 255 255 255
-0.063343 1.192620 0.000000 255 255 255 255 -0.062763 1.224800 0.000000 255 255 255 255
-0.046362 1.191526 0.000000 255 255 255 255 -0.045783 1.223706 0.000000 255 255 255 255
-0.064961 1.191526 0.000000 255 255 255 255 -0.064382 1.223706 0.000000 255 255 255 255
-0.044900 1.190239 0.000000 255 255 255 255 -0.044321 1.222420 0.000000 255 255 255 255
-0.066424 1.190239 0.000000 255 255 255 255 -0.065844 1.222420 0.000000 255 255 255 255
-0.043613 1.188778 0.000000 255 255 255 255 -0.043034 1.220958 0.000000 255 255 255 255
-0.067711 1.188778 0.000000 255 255 255 255 -0.067131 1.220958 0.000000 255 255 255 255
-0.042519 1.187159 0.000000 255 255 255 255 -0.041940 1.219339 0.000000 255 255 255 255
-0.068804 1.187159 0.000000 255 255 255 255 -0.068225 1.219339 0.000000 255 255 255 255
-0.041637 1.185402 0.000000 255 255 255 255 -0.041057 1.217582 0.000000 255 255 255 255
-0.069687 1.185402 0.000000 255 255 255 255 -0.069107 1.217582 0.000000 255 255 255 255
-0.040984 1.183524 0.000000 255 255 255 255 -0.040405 1.215704 0.000000 255 255 255 255
-0.070339 1.183524 0.000000 255 255 255 255 -0.069760 1.215704 0.000000 255 255 255 255
-0.040579 1.181544 0.000000 255 255 255 255 -0.040000 1.213724 0.000000 255 255 255 255
-0.070744 1.181544 0.000000 255 255 255 255 -0.070165 1.213724 0.000000 255 255 255 255
-0.040440 1.179480 0.000000 255 255 255 255 -0.039861 1.211660 0.000000 255 255 255 255
-0.070883 1.179480 0.000000 255 255 255 255 -0.070304 1.211660 0.000000 255 255 255 255
-0.070744 1.177414 0.000000 255 255 255 255 -0.070165 1.209594 0.000000 255 255 255 255
-0.040579 1.177414 0.000000 255 255 255 255 -0.040000 1.209594 0.000000 255 255 255 255
-0.070339 1.175432 0.000000 255 255 255 255 -0.069760 1.207612 0.000000 255 255 255 255
-0.040984 1.175432 0.000000 255 255 255 255 -0.040405 1.207612 0.000000 255 255 255 255
-0.069687 1.173554 0.000000 255 255 255 255 -0.069107 1.205734 0.000000 255 255 255 255
-0.041637 1.173554 0.000000 255 255 255 255 -0.041057 1.205734 0.000000 255 255 255 255
-0.005116 1.133825 0.000000 255 255 255 255 -0.004536 1.166005 0.000000 255 255 255 255
0.071185 1.093242 0.000000 255 255 255 255 0.071765 1.125422 0.000000 255 255 255 255
0.020447 1.174407 0.000000 255 255 255 255 0.021026 1.206587 0.000000 255 255 255 255
-0.068804 1.171796 0.000000 255 255 255 255 -0.068225 1.203976 0.000000 255 255 255 255
-0.042519 1.171796 0.000000 255 255 255 255 -0.041940 1.203976 0.000000 255 255 255 255
-0.067711 1.170178 0.000000 255 255 255 255 -0.067131 1.202358 0.000000 255 255 255 255
-0.043613 1.170178 0.000000 255 255 255 255 -0.043034 1.202358 0.000000 255 255 255 255
-0.066424 1.168717 0.000000 255 255 255 255 -0.065844 1.200897 0.000000 255 255 255 255
-0.044900 1.168717 0.000000 255 255 255 255 -0.044321 1.200897 0.000000 255 255 255 255
-0.064961 1.167431 0.000000 255 255 255 255 -0.064382 1.199611 0.000000 255 255 255 255
-0.046362 1.167431 0.000000 255 255 255 255 -0.045783 1.199611 0.000000 255 255 255 255
-0.063343 1.166338 0.000000 255 255 255 255 -0.062763 1.198518 0.000000 255 255 255 255
-0.047981 1.166338 0.000000 255 255 255 255 -0.047402 1.198518 0.000000 255 255 255 255
-0.061585 1.165457 0.000000 255 255 255 255 -0.061005 1.197637 0.000000 255 255 255 255
-0.049739 1.165457 0.000000 255 255 255 255 -0.049159 1.197637 0.000000 255 255 255 255
-0.059707 1.164805 0.000000 255 255 255 255 -0.059127 1.196985 0.000000 255 255 255 255
-0.051617 1.164805 0.000000 255 255 255 255 -0.051037 1.196985 0.000000 255 255 255 255
-0.057726 1.164400 0.000000 255 255 255 255 -0.057147 1.196580 0.000000 255 255 255 255
-0.053597 1.164400 0.000000 255 255 255 255 -0.053018 1.196580 0.000000 255 255 255 255
-0.055662 1.164261 0.000000 255 255 255 255 -0.055082 1.196442 0.000000 255 255 255 255
-0.070883 1.093242 0.000000 255 255 255 255 -0.070304 1.125422 0.000000 255 255 255 255
-0.030292 1.153710 0.000000 255 255 255 255 -0.029713 1.185890 0.000000 255 255 255 255
3 0 1 2 3 0 1 2
3 1 3 2 3 1 3 2
3 1 4 3 3 1 4 3

View File

@@ -12,70 +12,70 @@ property uchar alpha
element face 80 element face 80
property list uchar uint vertex_indices property list uchar uint vertex_indices
end_header end_header
-0.119887 1.034463 0.000000 255 255 255 255 -0.119887 1.061288 0.000000 255 255 255 255
-0.099881 1.254489 0.000000 255 255 255 255 -0.099881 1.281314 0.000000 255 255 255 255
-0.119887 1.254489 0.000000 255 255 255 255 -0.119887 1.281314 0.000000 255 255 255 255
-0.099881 1.234487 0.000000 255 255 255 255 -0.099881 1.261312 0.000000 255 255 255 255
-0.079874 1.234487 0.000000 255 255 255 255 -0.079874 1.261312 0.000000 255 255 255 255
-0.059867 1.254489 0.000000 255 255 255 255 -0.059867 1.281314 0.000000 255 255 255 255
-0.079874 1.254489 0.000000 255 255 255 255 -0.079874 1.281314 0.000000 255 255 255 255
-0.059867 1.214485 0.000000 255 255 255 255 -0.059867 1.241309 0.000000 255 255 255 255
0.060172 1.214485 0.000000 255 255 255 255 0.060172 1.241309 0.000000 255 255 255 255
0.080179 1.254489 0.000000 255 255 255 255 0.080179 1.281314 0.000000 255 255 255 255
0.060172 1.254489 0.000000 255 255 255 255 0.060172 1.281314 0.000000 255 255 255 255
0.080179 1.234487 0.000000 255 255 255 255 0.080179 1.261312 0.000000 255 255 255 255
0.100185 1.234487 0.000000 255 255 255 255 0.100185 1.261312 0.000000 255 255 255 255
0.120192 1.254489 0.000000 255 255 255 255 0.120192 1.281314 0.000000 255 255 255 255
0.100185 1.254489 0.000000 255 255 255 255 0.100185 1.281314 0.000000 255 255 255 255
0.120192 1.034463 0.000000 255 255 255 255 0.120192 1.061288 0.000000 255 255 255 255
-0.099881 1.214485 0.000000 255 255 255 255 -0.099881 1.241309 0.000000 255 255 255 255
0.080179 1.214485 0.000000 255 255 255 255 0.080179 1.241309 0.000000 255 255 255 255
0.100185 1.214485 0.000000 255 255 255 255 0.100185 1.241309 0.000000 255 255 255 255
-0.099881 1.194482 0.000000 255 255 255 255 -0.099881 1.221307 0.000000 255 255 255 255
-0.079874 1.214485 0.000000 255 255 255 255 -0.079874 1.241309 0.000000 255 255 255 255
-0.079874 1.194482 0.000000 255 255 255 255 -0.079874 1.221307 0.000000 255 255 255 255
0.080179 1.194482 0.000000 255 255 255 255 0.080179 1.221307 0.000000 255 255 255 255
0.100185 1.194482 0.000000 255 255 255 255 0.100185 1.221307 0.000000 255 255 255 255
-0.099881 1.174480 0.000000 255 255 255 255 -0.099881 1.201305 0.000000 255 255 255 255
-0.059867 1.184481 0.000000 255 255 255 255 -0.059867 1.211306 0.000000 255 255 255 255
0.060172 1.184481 0.000000 255 255 255 255 0.060172 1.211306 0.000000 255 255 255 255
0.100185 1.174480 0.000000 255 255 255 255 0.100185 1.201305 0.000000 255 255 255 255
-0.079874 1.174480 0.000000 255 255 255 255 -0.079874 1.201305 0.000000 255 255 255 255
-0.059867 1.104472 0.000000 255 255 255 255 -0.059867 1.131296 0.000000 255 255 255 255
0.060172 1.104472 0.000000 255 255 255 255 0.060172 1.131296 0.000000 255 255 255 255
0.080179 1.174480 0.000000 255 255 255 255 0.080179 1.201305 0.000000 255 255 255 255
-0.099881 1.154478 0.000000 255 255 255 255 -0.099881 1.181302 0.000000 255 255 255 255
-0.079874 1.154478 0.000000 255 255 255 255 -0.079874 1.181302 0.000000 255 255 255 255
0.080179 1.154478 0.000000 255 255 255 255 0.080179 1.181302 0.000000 255 255 255 255
0.100185 1.154478 0.000000 255 255 255 255 0.100185 1.181302 0.000000 255 255 255 255
-0.099881 1.134475 0.000000 255 255 255 255 -0.099881 1.161300 0.000000 255 255 255 255
-0.079874 1.134475 0.000000 255 255 255 255 -0.079874 1.161300 0.000000 255 255 255 255
0.080179 1.134475 0.000000 255 255 255 255 0.080179 1.161300 0.000000 255 255 255 255
0.100185 1.134475 0.000000 255 255 255 255 0.100185 1.161300 0.000000 255 255 255 255
-0.099881 1.114473 0.000000 255 255 255 255 -0.099881 1.141298 0.000000 255 255 255 255
-0.079874 1.114473 0.000000 255 255 255 255 -0.079874 1.141298 0.000000 255 255 255 255
0.080179 1.114473 0.000000 255 255 255 255 0.080179 1.141298 0.000000 255 255 255 255
0.100185 1.114473 0.000000 255 255 255 255 0.100185 1.141298 0.000000 255 255 255 255
-0.099881 1.094470 0.000000 255 255 255 255 -0.099881 1.121295 0.000000 255 255 255 255
0.100185 1.094470 0.000000 255 255 255 255 0.100185 1.121295 0.000000 255 255 255 255
-0.099881 1.074468 0.000000 255 255 255 255 -0.099881 1.101293 0.000000 255 255 255 255
-0.079874 1.094470 0.000000 255 255 255 255 -0.079874 1.121295 0.000000 255 255 255 255
-0.079874 1.074468 0.000000 255 255 255 255 -0.079874 1.101293 0.000000 255 255 255 255
0.080179 1.094470 0.000000 255 255 255 255 0.080179 1.121295 0.000000 255 255 255 255
0.080179 1.074468 0.000000 255 255 255 255 0.080179 1.101293 0.000000 255 255 255 255
0.100185 1.074468 0.000000 255 255 255 255 0.100185 1.101293 0.000000 255 255 255 255
-0.099881 1.054466 0.000000 255 255 255 255 -0.099881 1.081290 0.000000 255 255 255 255
-0.059867 1.074468 0.000000 255 255 255 255 -0.059867 1.101293 0.000000 255 255 255 255
-0.079874 1.054466 0.000000 255 255 255 255 -0.079874 1.081290 0.000000 255 255 255 255
-0.059867 1.034463 0.000000 255 255 255 255 -0.059867 1.061288 0.000000 255 255 255 255
0.060172 1.074468 0.000000 255 255 255 255 0.060172 1.101293 0.000000 255 255 255 255
0.060172 1.034463 0.000000 255 255 255 255 0.060172 1.061288 0.000000 255 255 255 255
0.080179 1.054466 0.000000 255 255 255 255 0.080179 1.081290 0.000000 255 255 255 255
0.100185 1.054466 0.000000 255 255 255 255 0.100185 1.081290 0.000000 255 255 255 255
-0.099881 1.034463 0.000000 255 255 255 255 -0.099881 1.061288 0.000000 255 255 255 255
-0.079874 1.034463 0.000000 255 255 255 255 -0.079874 1.061288 0.000000 255 255 255 255
0.080179 1.034463 0.000000 255 255 255 255 0.080179 1.061288 0.000000 255 255 255 255
0.100185 1.034463 0.000000 255 255 255 255 0.100185 1.061288 0.000000 255 255 255 255
3 0 1 2 3 0 1 2
3 0 3 1 3 0 3 1
3 4 5 6 3 4 5 6

View File

@@ -81,7 +81,7 @@ void tinyxml2::XMLElementToGLM(XMLElement *elem, glm::mat4 &matrix)
} }
} }
void tinyxml2::XMLSaveDoc(XMLDocument * const doc, std::string filename) bool tinyxml2::XMLSaveDoc(XMLDocument * const doc, std::string filename)
{ {
XMLDeclaration *pDec = doc->NewDeclaration(); XMLDeclaration *pDec = doc->NewDeclaration();
doc->InsertFirstChild(pDec); doc->InsertFirstChild(pDec);
@@ -92,7 +92,7 @@ void tinyxml2::XMLSaveDoc(XMLDocument * const doc, std::string filename)
// save session // save session
XMLError eResult = doc->SaveFile(filename.c_str()); XMLError eResult = doc->SaveFile(filename.c_str());
XMLResultError(eResult); return !XMLResultError(eResult);
} }
bool tinyxml2::XMLResultError(int result) bool tinyxml2::XMLResultError(int result)

View File

@@ -18,7 +18,7 @@ void XMLElementToGLM(XMLElement *elem, glm::vec4 &vector);
void XMLElementToGLM(XMLElement *elem, glm::mat4 &matrix); void XMLElementToGLM(XMLElement *elem, glm::mat4 &matrix);
void XMLSaveDoc(tinyxml2::XMLDocument * const doc, std::string filename); bool XMLSaveDoc(tinyxml2::XMLDocument * const doc, std::string filename);
bool XMLResultError(int result); bool XMLResultError(int result);
} }