diff --git a/CMakeLists.txt b/CMakeLists.txt index fed2470..6934103 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -279,6 +279,7 @@ set(VMIX_RSC_FILES ./rsc/mesh/circle.ply ./rsc/mesh/icon_video.ply ./rsc/mesh/icon_image.ply + ./rsc/mesh/icon_vimix.ply ) add_executable(${VMIX_BINARY} diff --git a/ImGuiVisitor.cpp b/ImGuiVisitor.cpp index 7fbec0c..c8dff55 100644 --- a/ImGuiVisitor.cpp +++ b/ImGuiVisitor.cpp @@ -265,18 +265,25 @@ void ImGuiVisitor::visit (Source& s) s.groupNode(View::GEOMETRY)->accept(*this); // Action on source - ImGui::Button("Clone", ImVec2(IMGUI_RIGHT_ALIGN, 0)); +// ImGui::Button("Clone", ImVec2(IMGUI_RIGHT_ALIGN, 0)); } void ImGuiVisitor::visit (MediaSource& s) { - if (ImGui::Button("Open Media Player", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) - Settings::application.media_player = !Settings::application.media_player; + 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)) ) + Settings::application.media_player = true; + } } void ImGuiVisitor::visit (SessionSource& s) { // ImGui::Button("Expand", ImVec2(IMGUI_RIGHT_ALIGN, 0)); + ImGui::Text("Session"); if (ImGui::Button("Make Current", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ) - Mixer::manager().open( s.path() ); + Mixer::manager().set( s.detach() ); } diff --git a/MediaSource.cpp b/MediaSource.cpp index ab8f214..7f4d64b 100644 --- a/MediaSource.cpp +++ b/MediaSource.cpp @@ -26,11 +26,9 @@ MediaSource::MediaSource() : Source(), path_("") MediaSource::~MediaSource() { - // TODO delete media surface with visitor + // delete media surface & player delete mediasurface_; - delete mediaplayer_; - // TODO verify that all surfaces and node is deleted in Source destructor } void MediaSource::setPath(const std::string &p) diff --git a/Mixer.cpp b/Mixer.cpp index c2b9895..c07bcfb 100644 --- a/Mixer.cpp +++ b/Mixer.cpp @@ -21,46 +21,43 @@ using namespace tinyxml2; #include "Mixer.h" -// static objects for multithreaded session loading +// static semaphore to prevent multiple threads for load / save static std::atomic sessionThreadActive_ = false; -static std::string sessionThreadFilename_ = ""; -static std::atomic sessionLoadFinished_ = false; +static std::atomic sessionSwapRequested_ = false; +// static multithreaded session loading static void loadSession(const std::string& filename, Session *session) { while (sessionThreadActive_) std::this_thread::sleep_for( std::chrono::milliseconds(50)); sessionThreadActive_ = true; - sessionLoadFinished_ = false; - sessionThreadFilename_ = ""; // actual loading of xml file 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 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; } -// static objects for multithreaded session saving -static std::atomic sessionSaveFinished_ = false; +// static multithreaded session saving static void saveSession(const std::string& filename, Session *session) { // reset while (sessionThreadActive_) std::this_thread::sleep_for( std::chrono::milliseconds(50)); sessionThreadActive_ = true; - sessionSaveFinished_ = false; - sessionThreadFilename_ = ""; // creation of XML doc XMLDocument xmlDoc; @@ -103,27 +100,33 @@ static void saveSession(const std::string& filename, Session *session) } // save file to disk - XMLSaveDoc(&xmlDoc, filename); + if ( XMLSaveDoc(&xmlDoc, filename) ) { + // all ok + session->setFilename(filename); + // 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()); + } - // loaded ok - Log::Notify("Session %s saved.", filename.c_str()); - - // all ok - sessionThreadFilename_ = filename; - sessionSaveFinished_ = true; sessionThreadActive_ = false; } Mixer::Mixer() : session_(nullptr), back_session_(nullptr), current_view_(nullptr) { - // this initializes with a new empty session - newSession(); + // unsused initial empty session + session_ = new Session; // auto load if Settings ask to - if ( Settings::application.recentSessions.load_at_start ) { - if ( Settings::application.recentSessions.filenames.size() > 0 ) - open( Settings::application.recentSessions.filenames.back() ); - } + if ( Settings::application.recentSessions.load_at_start && + Settings::application.recentSessions.filenames.size() > 0 ) + open( Settings::application.recentSessions.filenames.back() ); + else + // initializes with a new empty session + clear(); // this initializes with the 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() { // change session when threaded loading is finished - if (sessionLoadFinished_) { - sessionLoadFinished_ = false; + if (sessionSwapRequested_) { + sessionSwapRequested_ = false; // successfully loading if ( back_session_ ) { // swap front and back sessions swap(); - // set session filename and remember it - sessionFilename_ = sessionThreadFilename_; - Settings::application.recentSessions.push(sessionFilename_); + // set session filename + Rendering::manager().setWindowTitle(session_->filename()); + 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 if (update_time_ == GST_CLOCK_TIME_NONE) update_time_ = gst_util_get_timestamp (); @@ -166,7 +161,6 @@ void Mixer::update() mixing_.update(dt); geometry_.update(dt); layer_.update(dt); - // TODO other views? // optimize the reordering in depth for views View::need_reordering_ = false; @@ -195,7 +189,7 @@ void Mixer::createSourceFile(std::string path) { // create a session source SessionSource *ss = new SessionSource(); - ss->setPath(path); + ss->load(path); s = ss; } else { @@ -358,7 +352,7 @@ void Mixer::setCurrentView(View::Mode m) Settings::application.current_view = (int) m; } -View *Mixer::getView(View::Mode m) +View *Mixer::view(View::Mode m) { switch (m) { case View::GEOMETRY: @@ -379,8 +373,8 @@ View *Mixer::currentView() void Mixer::save() { - if (!sessionFilename_.empty()) - saveas(sessionFilename_); + if (!session_->filename().empty()) + saveas(session_->filename()); } void Mixer::saveas(const std::string& filename) @@ -457,7 +451,7 @@ void Mixer::swap() back_session_ = nullptr; } -void Mixer::newSession() +void Mixer::clear() { // delete previous back session if needed if (back_session_) @@ -467,13 +461,21 @@ void Mixer::newSession() back_session_ = new Session; // swap current with empty - swap(); - - // default view config - mixing_.restoreSettings(); - geometry_.restoreSettings(); - layer_.restoreSettings(); - - // empty session file name (does not save) - sessionFilename_ = ""; + sessionSwapRequested_ = true; +} + +void Mixer::set(Session *s) +{ + if ( s == nullptr ) + return; + + // 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; } diff --git a/Mixer.h b/Mixer.h index 5c84bf3..8dc7238 100644 --- a/Mixer.h +++ b/Mixer.h @@ -35,12 +35,12 @@ public: // manangement of sources void createSourceFile(std::string path); - - void deleteSource(Source *s); - void deleteCurrentSource(); + void createSourceRender() {} + void createSourceClone() {} // operations on sources void renameSource(Source *s, const std::string &newname); + void deleteSource(Source *s); // current source void setCurrentSource(std::string namesource); @@ -48,22 +48,25 @@ public: void setCurrentSource(int index); void setCurrentSource(Source *s); void unsetCurrentSource(); + void deleteCurrentSource(); Source *currentSource(); int indexCurrentSource(); // management of view - View *getView(View::Mode m); + View *view(View::Mode m); void setCurrentView(View::Mode m); View *currentView(); - void setSession(Session *s) { session_ = s; } - Session *session() { return session_; } - - // load and save session - void open(const std::string& filename); - void saveas(const std::string& filename); + // manipulate, load and save sessions + inline Session *session() const { return session_; } + void clear(); 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: @@ -72,11 +75,10 @@ protected: void swap(); // void validateFilename(const std::string& filename); - std::string sessionFilename_; +// std::string currentFilename_; void insertSource(Source *s); void setCurrentSource(SourceList::iterator it); - SourceList::iterator current_source_; int current_source_index_; diff --git a/RenderingManager.cpp b/RenderingManager.cpp index 76ed2db..dd49013 100644 --- a/RenderingManager.cpp +++ b/RenderingManager.cpp @@ -207,6 +207,13 @@ void Rendering::GrabWindow(int dx, int 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) { draw_callbacks_.push_front(function); diff --git a/RenderingManager.h b/RenderingManager.h index 06c2164..1ad0dea 100644 --- a/RenderingManager.h +++ b/RenderingManager.h @@ -68,28 +68,27 @@ public: // get Screenshot class Screenshot *CurrentScreenshot(); + // window management + void setWindowTitle(std::string title); // request fullscreen bool IsFullscreen (); - void ToggleFullscreen(); + void ToggleFullscreen (); // get width of rendering area float Width(); // get height of rendering area float Height(); // get aspect ratio of rendering area float AspectRatio(); + // monitor management + float MonitorWidth(); + float MonitorHeight(); + inline float DPIScale() const { return dpi_scale_; } // get projection matrix (for sharers) => Views glm::mat4 Projection(); // unproject from window coordinate 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: // loop update to begin new frame @@ -110,7 +109,8 @@ private: Screenshot screenshot_; bool request_screenshot_; - + // for opengl pipeline in gstreamer + void LinkPipeline( GstPipeline *pipeline ); }; diff --git a/Session.cpp b/Session.cpp index 39698d1..c03f6ba 100644 --- a/Session.cpp +++ b/Session.cpp @@ -1,19 +1,29 @@ #include #include "defines.h" +#include "Settings.h" #include "FrameBuffer.h" #include "Session.h" #include "GarbageVisitor.h" #include "Log.h" -Session::Session() +Session::Session() : filename_("") { config_[View::RENDERING] = new Group; config_[View::RENDERING]->scale_ = render_.resolution(); + 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]->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]->scale_ = Settings::application.views[View::MIXING].default_scale; + config_[View::MIXING]->translation_ = Settings::application.views[View::MIXING].default_translation; } diff --git a/Session.h b/Session.h index 4a35142..3aa1c1e 100644 --- a/Session.h +++ b/Session.h @@ -19,12 +19,11 @@ public: SourceList::iterator begin (); SourceList::iterator end (); SourceList::iterator find (int index); + int index (SourceList::iterator it) const; SourceList::iterator find (Source *s); SourceList::iterator find (std::string name); SourceList::iterator find (Node *node); - uint numSource() const; - int index (SourceList::iterator it) const; // update all sources void update (float dt); @@ -36,10 +35,14 @@ public: // configuration for group nodes of views 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: RenderView render_; SourceList sources_; - + std::string filename_; std::map config_; }; diff --git a/SessionCreator.cpp b/SessionCreator.cpp index c9c15f6..4e1542a 100644 --- a/SessionCreator.cpp +++ b/SessionCreator.cpp @@ -234,7 +234,7 @@ void SessionCreator::visit (SessionSource& s) XMLElement* pathNode = xmlCurrent_->FirstChildElement("path"); if (pathNode) { std::string path = std::string ( pathNode->GetText() ); - s.setPath(path); + s.load(path); } } diff --git a/SessionSource.cpp b/SessionSource.cpp index 480ab17..7bfe077 100644 --- a/SessionSource.cpp +++ b/SessionSource.cpp @@ -24,12 +24,17 @@ void SessionSource::loadSession(const std::string& filename, SessionSource *sour // actual loading of xml file SessionCreator creator( source->session_ ); - if (!creator.load(filename)) { + if (creator.load(filename)) { + // all ok, validate session filename + source->session_->setFilename(filename); + } + else { // error loading Log::Notify("Failed to load Session file %s.", filename.c_str()); source->loadFailed_ = true; } + // end thread source->loadFinished_ = true; } @@ -49,14 +54,15 @@ SessionSource::SessionSource() : Source(), path_("") SessionSource::~SessionSource() { - // TODO delete media surface with visitor + // delete surface delete sessionsurface_; - // TODO close and delete session - delete session_; + // delete session + if (session_) + delete session_; } -void SessionSource::setPath(const std::string &p) +void SessionSource::load(const std::string &p) { path_ = p; @@ -66,14 +72,15 @@ void SessionSource::setPath(const std::string &p) 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 -{ - return session_; + // work on a new session + session_ = new Session; + + return giveaway; } bool SessionSource::failed() const @@ -89,11 +96,15 @@ void SessionSource::init() // set resolution 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 sessionsurface_->setTextureIndex( session_->frame()->texture() ); // create Frame buffer matching size of media player 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 rendersurface_ = new FrameBufferSurface(renderbuffer_, blendingshader_); @@ -108,8 +119,8 @@ void SessionSource::init() if (is) is->stipple = 1.0; groups_[View::MIXING]->attach(surfacemix); groups_[View::LAYER]->attach(surfacemix); - // TODO icon session -// overlays_[View::MIXING]->attach( new Mesh("mesh/icon_video.ply") ); + // icon session + overlays_[View::MIXING]->attach( new Mesh("mesh/icon_vimix.ply") ); // scale all mixing nodes to match aspect ratio of the media for (NodeSet::iterator node = groups_[View::MIXING]->begin(); @@ -141,13 +152,13 @@ void SessionSource::init() void SessionSource::render() { if (!initialized_) + { init(); + } else { // update session session_->update(dt_); - sessionsurface_->setTextureIndex( session_->frame()->texture() ); - // 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); renderbuffer_->begin(); diff --git a/SessionSource.h b/SessionSource.h index 476d226..e8f8ae9 100644 --- a/SessionSource.h +++ b/SessionSource.h @@ -16,10 +16,12 @@ public: void accept (Visitor& v) override; bool failed() const override; - // Media specific interface - void setPath(const std::string &p); - std::string path() const; - Session *session() const; + // Session Source specific interface + void load(const std::string &p); + Session *detach(); + + inline std::string path() const { return path_; } + inline Session *session() const { return session_; } protected: diff --git a/Settings.h b/Settings.h index 01be91f..609d3bd 100644 --- a/Settings.h +++ b/Settings.h @@ -97,7 +97,7 @@ struct Application current_view = 1; framebuffer_ar = 3; framebuffer_h = 1; - windows.push_back(WindowConfig(APP_TITLE)); + windows.push_back(WindowConfig(APP_NAME APP_TITLE)); } }; diff --git a/UserInterfaceManager.cpp b/UserInterfaceManager.cpp index 265c17e..2e46064 100644 --- a/UserInterfaceManager.cpp +++ b/UserInterfaceManager.cpp @@ -212,11 +212,14 @@ void UserInterface::handleKeyboard() } else if (ImGui::IsKeyPressed( GLFW_KEY_S )) { // Save Session - Mixer::manager().save(); + if (Mixer::manager().session()->filename().empty()) + std::thread (SessionFileDialogSave, Settings::application.recentSessions.path).detach(); + else + Mixer::manager().save(); } else if (ImGui::IsKeyPressed( GLFW_KEY_W )) { // New Session - Mixer::manager().newSession(); + Mixer::manager().clear(); } else if (ImGui::IsKeyPressed( GLFW_KEY_L )) { // Logs @@ -237,6 +240,7 @@ void UserInterface::handleKeyboard() } else { + // TODO make sure no entry / window box is active keyboard_modifier_active = false; // Action keys @@ -472,7 +476,10 @@ void UserInterface::showMenuFile() navigator.hidePannel(); } if (ImGui::MenuItem( ICON_FA_FILE_DOWNLOAD " Save", "Ctrl+S")) { - Mixer::manager().save(); + if (Mixer::manager().session()->filename().empty()) + std::thread (SessionFileDialogSave, Settings::application.recentSessions.path).detach(); + else + Mixer::manager().save(); navigator.hidePannel(); } if (ImGui::MenuItem( ICON_FA_FOLDER_OPEN " Save as")) { @@ -483,7 +490,7 @@ void UserInterface::showMenuFile() ImGui::Separator(); if (ImGui::MenuItem( ICON_FA_FILE " New", "Ctrl+W")) { - Mixer::manager().newSession(); + Mixer::manager().clear(); navigator.hidePannel(); } ImGui::SetNextItemWidth( ImGui::GetContentRegionAvail().x ); diff --git a/defines.h b/defines.h index 8a532d5..f3f5a9b 100644 --- a/defines.h +++ b/defines.h @@ -2,7 +2,7 @@ #define VMIX_DEFINES_H #define APP_NAME "vimix" -#define APP_TITLE "vimix -- Video Live Mixer" +#define APP_TITLE " -- Video Live Mixer" #define APP_SETTINGS "vimix.xml" #define APP_VERSION_MAJOR 0 #define APP_VERSION_MINOR 1 diff --git a/main.cpp b/main.cpp index 042df03..aa5086b 100644 --- a/main.cpp +++ b/main.cpp @@ -45,29 +45,9 @@ #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() { -// Mixer::manager().update(); - Mixer::manager().draw(); - } @@ -102,7 +82,7 @@ int main(int, char**) // test text editor UserInterface::manager().fillShaderEditor( Resource::getText("shaders/image.fs") ); - // init the scene + // draw the scene Rendering::manager().PushFrontDrawCallback(drawScene); // init elements to the scene @@ -135,8 +115,6 @@ int main(int, char**) Rendering::manager().Draw(); } -// Mixer::manager().save("./testsession.vmx"); - UserInterface::manager().Terminate(); Rendering::manager().Terminate(); diff --git a/rsc/mesh/icon_image.ply b/rsc/mesh/icon_image.ply index 75b0dd4..a6fd36f 100644 --- a/rsc/mesh/icon_image.ply +++ b/rsc/mesh/icon_image.ply @@ -12,67 +12,67 @@ property uchar alpha element face 57 property list uchar uint vertex_indices end_header --0.121622 1.052659 0.000000 255 255 255 255 --0.101327 1.214990 0.000000 255 255 255 255 --0.121622 1.235281 0.000000 255 255 255 255 -0.121924 1.235281 0.000000 255 255 255 255 -0.101629 1.214990 0.000000 255 255 255 255 -0.121924 1.052659 0.000000 255 255 255 255 --0.101327 1.072951 0.000000 255 255 255 255 -0.101629 1.072951 0.000000 255 255 255 255 --0.057726 1.194559 0.000000 255 255 255 255 --0.053597 1.194559 0.000000 255 255 255 255 --0.055662 1.194698 0.000000 255 255 255 255 --0.051617 1.194155 0.000000 255 255 255 255 --0.059707 1.194155 0.000000 255 255 255 255 --0.049739 1.193502 0.000000 255 255 255 255 --0.061585 1.193502 0.000000 255 255 255 255 --0.047981 1.192620 0.000000 255 255 255 255 --0.063343 1.192620 0.000000 255 255 255 255 --0.046362 1.191526 0.000000 255 255 255 255 --0.064961 1.191526 0.000000 255 255 255 255 --0.044900 1.190239 0.000000 255 255 255 255 --0.066424 1.190239 0.000000 255 255 255 255 --0.043613 1.188778 0.000000 255 255 255 255 --0.067711 1.188778 0.000000 255 255 255 255 --0.042519 1.187159 0.000000 255 255 255 255 --0.068804 1.187159 0.000000 255 255 255 255 --0.041637 1.185402 0.000000 255 255 255 255 --0.069687 1.185402 0.000000 255 255 255 255 --0.040984 1.183524 0.000000 255 255 255 255 --0.070339 1.183524 0.000000 255 255 255 255 --0.040579 1.181544 0.000000 255 255 255 255 --0.070744 1.181544 0.000000 255 255 255 255 --0.040440 1.179480 0.000000 255 255 255 255 --0.070883 1.179480 0.000000 255 255 255 255 --0.070744 1.177414 0.000000 255 255 255 255 --0.040579 1.177414 0.000000 255 255 255 255 --0.070339 1.175432 0.000000 255 255 255 255 --0.040984 1.175432 0.000000 255 255 255 255 --0.069687 1.173554 0.000000 255 255 255 255 --0.041637 1.173554 0.000000 255 255 255 255 --0.005116 1.133825 0.000000 255 255 255 255 -0.071185 1.093242 0.000000 255 255 255 255 -0.020447 1.174407 0.000000 255 255 255 255 --0.068804 1.171796 0.000000 255 255 255 255 --0.042519 1.171796 0.000000 255 255 255 255 --0.067711 1.170178 0.000000 255 255 255 255 --0.043613 1.170178 0.000000 255 255 255 255 --0.066424 1.168717 0.000000 255 255 255 255 --0.044900 1.168717 0.000000 255 255 255 255 --0.064961 1.167431 0.000000 255 255 255 255 --0.046362 1.167431 0.000000 255 255 255 255 --0.063343 1.166338 0.000000 255 255 255 255 --0.047981 1.166338 0.000000 255 255 255 255 --0.061585 1.165457 0.000000 255 255 255 255 --0.049739 1.165457 0.000000 255 255 255 255 --0.059707 1.164805 0.000000 255 255 255 255 --0.051617 1.164805 0.000000 255 255 255 255 --0.057726 1.164400 0.000000 255 255 255 255 --0.053597 1.164400 0.000000 255 255 255 255 --0.055662 1.164261 0.000000 255 255 255 255 --0.070883 1.093242 0.000000 255 255 255 255 --0.030292 1.153710 0.000000 255 255 255 255 +-0.121043 1.084839 0.000000 255 255 255 255 +-0.100747 1.247170 0.000000 255 255 255 255 +-0.121043 1.267461 0.000000 255 255 255 255 +0.122504 1.267461 0.000000 255 255 255 255 +0.102208 1.247170 0.000000 255 255 255 255 +0.122504 1.084839 0.000000 255 255 255 255 +-0.100747 1.105131 0.000000 255 255 255 255 +0.102208 1.105131 0.000000 255 255 255 255 +-0.057147 1.226739 0.000000 255 255 255 255 +-0.053018 1.226740 0.000000 255 255 255 255 +-0.055082 1.226879 0.000000 255 255 255 255 +-0.051037 1.226335 0.000000 255 255 255 255 +-0.059127 1.226335 0.000000 255 255 255 255 +-0.049159 1.225682 0.000000 255 255 255 255 +-0.061005 1.225682 0.000000 255 255 255 255 +-0.047402 1.224800 0.000000 255 255 255 255 +-0.062763 1.224800 0.000000 255 255 255 255 +-0.045783 1.223706 0.000000 255 255 255 255 +-0.064382 1.223706 0.000000 255 255 255 255 +-0.044321 1.222420 0.000000 255 255 255 255 +-0.065844 1.222420 0.000000 255 255 255 255 +-0.043034 1.220958 0.000000 255 255 255 255 +-0.067131 1.220958 0.000000 255 255 255 255 +-0.041940 1.219339 0.000000 255 255 255 255 +-0.068225 1.219339 0.000000 255 255 255 255 +-0.041057 1.217582 0.000000 255 255 255 255 +-0.069107 1.217582 0.000000 255 255 255 255 +-0.040405 1.215704 0.000000 255 255 255 255 +-0.069760 1.215704 0.000000 255 255 255 255 +-0.040000 1.213724 0.000000 255 255 255 255 +-0.070165 1.213724 0.000000 255 255 255 255 +-0.039861 1.211660 0.000000 255 255 255 255 +-0.070304 1.211660 0.000000 255 255 255 255 +-0.070165 1.209594 0.000000 255 255 255 255 +-0.040000 1.209594 0.000000 255 255 255 255 +-0.069760 1.207612 0.000000 255 255 255 255 +-0.040405 1.207612 0.000000 255 255 255 255 +-0.069107 1.205734 0.000000 255 255 255 255 +-0.041057 1.205734 0.000000 255 255 255 255 +-0.004536 1.166005 0.000000 255 255 255 255 +0.071765 1.125422 0.000000 255 255 255 255 +0.021026 1.206587 0.000000 255 255 255 255 +-0.068225 1.203976 0.000000 255 255 255 255 +-0.041940 1.203976 0.000000 255 255 255 255 +-0.067131 1.202358 0.000000 255 255 255 255 +-0.043034 1.202358 0.000000 255 255 255 255 +-0.065844 1.200897 0.000000 255 255 255 255 +-0.044321 1.200897 0.000000 255 255 255 255 +-0.064382 1.199611 0.000000 255 255 255 255 +-0.045783 1.199611 0.000000 255 255 255 255 +-0.062763 1.198518 0.000000 255 255 255 255 +-0.047402 1.198518 0.000000 255 255 255 255 +-0.061005 1.197637 0.000000 255 255 255 255 +-0.049159 1.197637 0.000000 255 255 255 255 +-0.059127 1.196985 0.000000 255 255 255 255 +-0.051037 1.196985 0.000000 255 255 255 255 +-0.057147 1.196580 0.000000 255 255 255 255 +-0.053018 1.196580 0.000000 255 255 255 255 +-0.055082 1.196442 0.000000 255 255 255 255 +-0.070304 1.125422 0.000000 255 255 255 255 +-0.029713 1.185890 0.000000 255 255 255 255 3 0 1 2 3 1 3 2 3 1 4 3 diff --git a/rsc/mesh/icon_video.ply b/rsc/mesh/icon_video.ply index be0ab96..79b6c7b 100644 --- a/rsc/mesh/icon_video.ply +++ b/rsc/mesh/icon_video.ply @@ -12,70 +12,70 @@ property uchar alpha element face 80 property list uchar uint vertex_indices end_header --0.119887 1.034463 0.000000 255 255 255 255 --0.099881 1.254489 0.000000 255 255 255 255 --0.119887 1.254489 0.000000 255 255 255 255 --0.099881 1.234487 0.000000 255 255 255 255 --0.079874 1.234487 0.000000 255 255 255 255 --0.059867 1.254489 0.000000 255 255 255 255 --0.079874 1.254489 0.000000 255 255 255 255 --0.059867 1.214485 0.000000 255 255 255 255 -0.060172 1.214485 0.000000 255 255 255 255 -0.080179 1.254489 0.000000 255 255 255 255 -0.060172 1.254489 0.000000 255 255 255 255 -0.080179 1.234487 0.000000 255 255 255 255 -0.100185 1.234487 0.000000 255 255 255 255 -0.120192 1.254489 0.000000 255 255 255 255 -0.100185 1.254489 0.000000 255 255 255 255 -0.120192 1.034463 0.000000 255 255 255 255 --0.099881 1.214485 0.000000 255 255 255 255 -0.080179 1.214485 0.000000 255 255 255 255 -0.100185 1.214485 0.000000 255 255 255 255 --0.099881 1.194482 0.000000 255 255 255 255 --0.079874 1.214485 0.000000 255 255 255 255 --0.079874 1.194482 0.000000 255 255 255 255 -0.080179 1.194482 0.000000 255 255 255 255 -0.100185 1.194482 0.000000 255 255 255 255 --0.099881 1.174480 0.000000 255 255 255 255 --0.059867 1.184481 0.000000 255 255 255 255 -0.060172 1.184481 0.000000 255 255 255 255 -0.100185 1.174480 0.000000 255 255 255 255 --0.079874 1.174480 0.000000 255 255 255 255 --0.059867 1.104472 0.000000 255 255 255 255 -0.060172 1.104472 0.000000 255 255 255 255 -0.080179 1.174480 0.000000 255 255 255 255 --0.099881 1.154478 0.000000 255 255 255 255 --0.079874 1.154478 0.000000 255 255 255 255 -0.080179 1.154478 0.000000 255 255 255 255 -0.100185 1.154478 0.000000 255 255 255 255 --0.099881 1.134475 0.000000 255 255 255 255 --0.079874 1.134475 0.000000 255 255 255 255 -0.080179 1.134475 0.000000 255 255 255 255 -0.100185 1.134475 0.000000 255 255 255 255 --0.099881 1.114473 0.000000 255 255 255 255 --0.079874 1.114473 0.000000 255 255 255 255 -0.080179 1.114473 0.000000 255 255 255 255 -0.100185 1.114473 0.000000 255 255 255 255 --0.099881 1.094470 0.000000 255 255 255 255 -0.100185 1.094470 0.000000 255 255 255 255 --0.099881 1.074468 0.000000 255 255 255 255 --0.079874 1.094470 0.000000 255 255 255 255 --0.079874 1.074468 0.000000 255 255 255 255 -0.080179 1.094470 0.000000 255 255 255 255 -0.080179 1.074468 0.000000 255 255 255 255 -0.100185 1.074468 0.000000 255 255 255 255 --0.099881 1.054466 0.000000 255 255 255 255 --0.059867 1.074468 0.000000 255 255 255 255 --0.079874 1.054466 0.000000 255 255 255 255 --0.059867 1.034463 0.000000 255 255 255 255 -0.060172 1.074468 0.000000 255 255 255 255 -0.060172 1.034463 0.000000 255 255 255 255 -0.080179 1.054466 0.000000 255 255 255 255 -0.100185 1.054466 0.000000 255 255 255 255 --0.099881 1.034463 0.000000 255 255 255 255 --0.079874 1.034463 0.000000 255 255 255 255 -0.080179 1.034463 0.000000 255 255 255 255 -0.100185 1.034463 0.000000 255 255 255 255 +-0.119887 1.061288 0.000000 255 255 255 255 +-0.099881 1.281314 0.000000 255 255 255 255 +-0.119887 1.281314 0.000000 255 255 255 255 +-0.099881 1.261312 0.000000 255 255 255 255 +-0.079874 1.261312 0.000000 255 255 255 255 +-0.059867 1.281314 0.000000 255 255 255 255 +-0.079874 1.281314 0.000000 255 255 255 255 +-0.059867 1.241309 0.000000 255 255 255 255 +0.060172 1.241309 0.000000 255 255 255 255 +0.080179 1.281314 0.000000 255 255 255 255 +0.060172 1.281314 0.000000 255 255 255 255 +0.080179 1.261312 0.000000 255 255 255 255 +0.100185 1.261312 0.000000 255 255 255 255 +0.120192 1.281314 0.000000 255 255 255 255 +0.100185 1.281314 0.000000 255 255 255 255 +0.120192 1.061288 0.000000 255 255 255 255 +-0.099881 1.241309 0.000000 255 255 255 255 +0.080179 1.241309 0.000000 255 255 255 255 +0.100185 1.241309 0.000000 255 255 255 255 +-0.099881 1.221307 0.000000 255 255 255 255 +-0.079874 1.241309 0.000000 255 255 255 255 +-0.079874 1.221307 0.000000 255 255 255 255 +0.080179 1.221307 0.000000 255 255 255 255 +0.100185 1.221307 0.000000 255 255 255 255 +-0.099881 1.201305 0.000000 255 255 255 255 +-0.059867 1.211306 0.000000 255 255 255 255 +0.060172 1.211306 0.000000 255 255 255 255 +0.100185 1.201305 0.000000 255 255 255 255 +-0.079874 1.201305 0.000000 255 255 255 255 +-0.059867 1.131296 0.000000 255 255 255 255 +0.060172 1.131296 0.000000 255 255 255 255 +0.080179 1.201305 0.000000 255 255 255 255 +-0.099881 1.181302 0.000000 255 255 255 255 +-0.079874 1.181302 0.000000 255 255 255 255 +0.080179 1.181302 0.000000 255 255 255 255 +0.100185 1.181302 0.000000 255 255 255 255 +-0.099881 1.161300 0.000000 255 255 255 255 +-0.079874 1.161300 0.000000 255 255 255 255 +0.080179 1.161300 0.000000 255 255 255 255 +0.100185 1.161300 0.000000 255 255 255 255 +-0.099881 1.141298 0.000000 255 255 255 255 +-0.079874 1.141298 0.000000 255 255 255 255 +0.080179 1.141298 0.000000 255 255 255 255 +0.100185 1.141298 0.000000 255 255 255 255 +-0.099881 1.121295 0.000000 255 255 255 255 +0.100185 1.121295 0.000000 255 255 255 255 +-0.099881 1.101293 0.000000 255 255 255 255 +-0.079874 1.121295 0.000000 255 255 255 255 +-0.079874 1.101293 0.000000 255 255 255 255 +0.080179 1.121295 0.000000 255 255 255 255 +0.080179 1.101293 0.000000 255 255 255 255 +0.100185 1.101293 0.000000 255 255 255 255 +-0.099881 1.081290 0.000000 255 255 255 255 +-0.059867 1.101293 0.000000 255 255 255 255 +-0.079874 1.081290 0.000000 255 255 255 255 +-0.059867 1.061288 0.000000 255 255 255 255 +0.060172 1.101293 0.000000 255 255 255 255 +0.060172 1.061288 0.000000 255 255 255 255 +0.080179 1.081290 0.000000 255 255 255 255 +0.100185 1.081290 0.000000 255 255 255 255 +-0.099881 1.061288 0.000000 255 255 255 255 +-0.079874 1.061288 0.000000 255 255 255 255 +0.080179 1.061288 0.000000 255 255 255 255 +0.100185 1.061288 0.000000 255 255 255 255 3 0 1 2 3 0 3 1 3 4 5 6 diff --git a/tinyxml2Toolkit.cpp b/tinyxml2Toolkit.cpp index 55cdd79..94f58c4 100644 --- a/tinyxml2Toolkit.cpp +++ b/tinyxml2Toolkit.cpp @@ -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(); doc->InsertFirstChild(pDec); @@ -92,7 +92,7 @@ void tinyxml2::XMLSaveDoc(XMLDocument * const doc, std::string filename) // save session XMLError eResult = doc->SaveFile(filename.c_str()); - XMLResultError(eResult); + return !XMLResultError(eResult); } bool tinyxml2::XMLResultError(int result) diff --git a/tinyxml2Toolkit.h b/tinyxml2Toolkit.h index 66839e4..58bdbf2 100644 --- a/tinyxml2Toolkit.h +++ b/tinyxml2Toolkit.h @@ -18,7 +18,7 @@ void XMLElementToGLM(XMLElement *elem, glm::vec4 &vector); 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); }