Create openMVS.build
This commit is contained in:
commit
365aa390ba
1856 files changed
+839085
No files matched your search
@@ -0,0 +1,50 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(imguiViewer)
|
||||
|
||||
# Set the C++ standard to C++17
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
if(WIN32)
|
||||
message("Windows specific stuff")
|
||||
elseif(APPLE)
|
||||
message("Apple specific stuff")
|
||||
add_compile_definitions(GL_SILENCE_DEPRECATION)
|
||||
elseif(UNIX)
|
||||
message("Linux specific stuff")
|
||||
endif()
|
||||
|
||||
|
||||
find_package(GLFW3 REQUIRED)
|
||||
find_package(GLEW 2.0 REQUIRED)
|
||||
find_package(EIGEN3 REQUIRED NO_MODULE)
|
||||
|
||||
set(IMGUI_DIR "../../../github/imgui" CACHE INTERNAL "Path to imgui")
|
||||
set(VCGLIB_DIR "../.." CACHE INTERNAL "Path to vcglib")
|
||||
set(EIGEN_DIR = "${VCGLIB_DIR}/eigenlib" CACHE INTERNAL "")
|
||||
|
||||
|
||||
add_executable(${PROJECT_NAME} main.cpp
|
||||
${VCGLIB_DIR}/wrap/gui/trackball.cpp
|
||||
${VCGLIB_DIR}/wrap/gui/trackmode.cpp
|
||||
${VCGLIB_DIR}/wrap/ply/plylib.cpp
|
||||
${IMGUI_DIR}/imgui.cpp
|
||||
${IMGUI_DIR}/imgui_demo.cpp
|
||||
${IMGUI_DIR}/imgui_draw.cpp
|
||||
${IMGUI_DIR}/imgui_tables.cpp
|
||||
${IMGUI_DIR}/imgui_widgets.cpp
|
||||
${IMGUI_DIR}/backends/imgui_impl_glfw.cpp
|
||||
${IMGUI_DIR}/backends/imgui_impl_opengl2.cpp
|
||||
FileBrowser/ImGuiFileBrowser.cpp)
|
||||
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${IMGUI_DIR})
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${IMGUI_DIR}/backends)
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${GLEW_INCLUDE_DIRS})
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${VCGLIB_DIR})
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${EIGEN_DIR})
|
||||
target_link_directories(${PROJECT_NAME} PRIVATE ${GLEW_LIBRARY_DIRS})
|
||||
target_link_directories(${PROJECT_NAME} PRIVATE ${GLFW3_LIBRARY_DIRS})
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
GLEW::GLEW
|
||||
glfw
|
||||
)
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,122 @@
|
||||
#ifndef IMGUIFILEBROWSER_H
|
||||
#define IMGUIFILEBROWSER_H
|
||||
|
||||
#include <imgui.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace imgui_addons
|
||||
{
|
||||
class ImGuiFileBrowser
|
||||
{
|
||||
public:
|
||||
ImGuiFileBrowser();
|
||||
~ImGuiFileBrowser();
|
||||
|
||||
enum class DialogMode
|
||||
{
|
||||
SELECT, //Select Directory Mode
|
||||
OPEN, //Open File mode
|
||||
SAVE //Save File mode.
|
||||
};
|
||||
|
||||
/* Use this to show an open file dialog. The function takes label for the window,
|
||||
* the size, a DialogMode enum value defining in which mode the dialog should operate and optionally the extensions that are valid for opening.
|
||||
* Note that the select directory mode doesn't need any extensions.
|
||||
*/
|
||||
bool showFileDialog(const std::string& label, const DialogMode mode, const ImVec2& sz_xy = ImVec2(0,0), const std::string& valid_types = "*.*");
|
||||
|
||||
/* Store the opened/saved file name or dir name (incase of selectDirectoryDialog) and the absolute path to the selection
|
||||
* Should only be accessed when above functions return true else may contain garbage.
|
||||
*/
|
||||
std::string selected_fn;
|
||||
std::string selected_path;
|
||||
std::string ext; // Store the saved file extension
|
||||
|
||||
|
||||
private:
|
||||
struct Info
|
||||
{
|
||||
Info(std::string name, bool is_hidden) : name(name), is_hidden(is_hidden)
|
||||
{
|
||||
}
|
||||
std::string name;
|
||||
bool is_hidden;
|
||||
};
|
||||
|
||||
//Enum used as bit flags.
|
||||
enum FilterMode
|
||||
{
|
||||
FilterMode_Files = 0x01,
|
||||
FilterMode_Dirs = 0x02
|
||||
};
|
||||
|
||||
//Helper Functions
|
||||
static std::string wStringToString(const wchar_t* wchar_arr);
|
||||
static bool alphaSortComparator(const Info& a, const Info& b);
|
||||
ImVec2 getButtonSize(std::string button_text);
|
||||
|
||||
/* Helper Functions that render secondary modals
|
||||
* and help in validating file extensions and for filtering, parsing top navigation bar.
|
||||
*/
|
||||
void setValidExtTypes(const std::string& valid_types_string);
|
||||
bool validateFile();
|
||||
void showErrorModal();
|
||||
void showInvalidFileModal();
|
||||
bool showReplaceFileModal();
|
||||
void showHelpMarker(std::string desc);
|
||||
void parsePathTabs(std::string str);
|
||||
void filterFiles(int filter_mode);
|
||||
|
||||
/* Core Functions that render the 4 different regions making up
|
||||
* a simple file dialog
|
||||
*/
|
||||
bool renderNavAndSearchBarRegion();
|
||||
bool renderFileListRegion();
|
||||
bool renderInputTextAndExtRegion();
|
||||
bool renderButtonsAndCheckboxRegion();
|
||||
bool renderInputComboBox();
|
||||
void renderExtBox();
|
||||
|
||||
/* Core Functions that handle navigation and
|
||||
* reading directories/files
|
||||
*/
|
||||
bool readDIR(std::string path);
|
||||
bool onNavigationButtonClick(int idx);
|
||||
bool onDirClick(int idx);
|
||||
|
||||
// Functions that reset state and/or clear file list when reading new directory
|
||||
void clearFileList();
|
||||
void closeDialog();
|
||||
|
||||
#if defined (WIN32) || defined (_WIN32) || defined (__WIN32)
|
||||
bool loadWindowsDrives(); // Helper Function for Windows to load Drive Letters.
|
||||
#endif
|
||||
|
||||
#if defined(unix) || defined(__unix__) || defined(__unix) || defined(__APPLE__)
|
||||
void initCurrentPath(); // Helper function for UNIX based system to load Absolute path using realpath
|
||||
#endif
|
||||
|
||||
ImVec2 min_size, max_size, input_combobox_pos, input_combobox_sz;
|
||||
DialogMode dialog_mode;
|
||||
int filter_mode, col_items_limit, selected_idx, selected_ext_idx;
|
||||
float col_width, ext_box_width;
|
||||
bool show_hidden, show_inputbar_combobox, is_dir, is_appearing, filter_dirty, validate_file, show_all_valid_files;
|
||||
char input_fn[256];
|
||||
|
||||
std::vector<std::string> valid_exts;
|
||||
std::vector<std::string> current_dirlist;
|
||||
std::vector<Info> subdirs;
|
||||
std::vector<Info> subfiles;
|
||||
std::string current_path, error_msg, error_title, invfile_modal_id, repfile_modal_id;
|
||||
|
||||
ImGuiTextFilter filter;
|
||||
std::string valid_types;
|
||||
std::vector<const Info*> filtered_dirs; // Note: We don't need to call delete. It's just for storing filtered items from subdirs and subfiles so we don't use PassFilter every frame.
|
||||
std::vector<const Info*> filtered_files;
|
||||
std::vector< std::reference_wrapper<std::string> > inputcb_filter_files;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif // IMGUIFILEBROWSER_H
|
||||
@@ -0,0 +1,363 @@
|
||||
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
#include "imgui.h"
|
||||
#include "imgui_impl_glfw.h"
|
||||
#include "imgui_impl_opengl2.h"
|
||||
#include <stdio.h>
|
||||
#include "FileBrowser/ImGuiFileBrowser.h"
|
||||
#include "triangle_mesh_type.h"
|
||||
#include <wrap/gui/trackball.h>
|
||||
#include <wrap/gl/trimesh.h>
|
||||
|
||||
// Interface variables
|
||||
GLFWwindow* window;
|
||||
vcg::GlTrimesh<MyTriMesh> glWrap;
|
||||
vcg::Trackball trackball;
|
||||
imgui_addons::ImGuiFileBrowser file_dialog;
|
||||
std::ostringstream oss; // String stream used for the log
|
||||
|
||||
// Interface options
|
||||
ImVec4 clear_color = ImVec4(0.33f, 0.33f, 0.33f, 1.00f);
|
||||
ImVec4 mesh_color = ImVec4(0.79f, 0.9f, 0.87f, 1.00f);
|
||||
float line_thick=1.f;
|
||||
int selected_rend_mode = 5;
|
||||
bool showMesh=true;
|
||||
bool showTrackBall=true;
|
||||
vcg::GLW::DrawMode DMode=vcg::GLW::DMSmooth;
|
||||
std::string PathMesh="../../meshes/fertility_tri.off";
|
||||
|
||||
// Mesh data
|
||||
MyTriMesh mesh;
|
||||
|
||||
void LoadMesh(std::string path)
|
||||
{
|
||||
oss<<"Loading "<<path.c_str()<<std::endl;
|
||||
int ret = vcg::tri::io::Importer<MyTriMesh>::Open(mesh,path.c_str());
|
||||
vcg::tri::UpdateBounding<MyTriMesh>::Box(mesh);
|
||||
vcg::tri::UpdateNormal<MyTriMesh>::PerVertexNormalizedPerFaceNormalized(mesh);
|
||||
|
||||
|
||||
if (ret==0)
|
||||
oss<<"Loaded "<<mesh.fn<<" faces "<<mesh.vn<<" vertices"<<std::endl;
|
||||
else
|
||||
oss<<"Mesh not loaded"<<std::endl;
|
||||
}
|
||||
|
||||
static void glfw_error_callback(int error, const char* description)
|
||||
{
|
||||
fprintf(stderr, "Glfw Error %d: %s\n", error, description);
|
||||
}
|
||||
|
||||
static void cursor_position_callback(GLFWwindow* window, double xpos, double ypos)
|
||||
{
|
||||
if(ImGui::GetIO().WantCaptureMouse) return;
|
||||
|
||||
int display_w, display_h;
|
||||
glfwGetFramebufferSize(window, &display_w, &display_h);
|
||||
float xscale, yscale;
|
||||
glfwGetWindowContentScale(window, &xscale, &yscale);
|
||||
xpos*=xscale;
|
||||
ypos*=yscale;
|
||||
ypos=(display_h)-ypos;
|
||||
trackball.MouseMove((int)xpos,(int)ypos);
|
||||
}
|
||||
|
||||
void mouse_button_callback(GLFWwindow* window, int button, int action, int mods)
|
||||
{
|
||||
if(ImGui::GetIO().WantCaptureMouse) return;
|
||||
|
||||
int display_w, display_h;
|
||||
glfwGetFramebufferSize(window, &display_w, &display_h);
|
||||
float xscale, yscale;
|
||||
glfwGetWindowContentScale(window, &xscale, &yscale);
|
||||
double xpos, ypos;
|
||||
glfwGetCursorPos(window, &xpos, &ypos);
|
||||
xpos*=xscale;
|
||||
ypos*=yscale;
|
||||
ypos=(display_h)-ypos;
|
||||
|
||||
if (button == GLFW_MOUSE_BUTTON_LEFT && action == GLFW_PRESS)
|
||||
trackball.MouseDown((int)xpos,(int)ypos,vcg::Trackball::BUTTON_LEFT);
|
||||
|
||||
if (button == GLFW_MOUSE_BUTTON_LEFT && action == GLFW_RELEASE)
|
||||
trackball.MouseUp((int)xpos,(int)ypos,vcg::Trackball::BUTTON_LEFT);
|
||||
|
||||
}
|
||||
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
trackball.MouseWheel(yoffset/4);
|
||||
}
|
||||
|
||||
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||
{
|
||||
if (key == GLFW_KEY_LEFT_SHIFT && action == GLFW_PRESS)
|
||||
trackball.ButtonDown(vcg::Trackball::KEY_SHIFT);
|
||||
if (key == GLFW_KEY_LEFT_SHIFT && action == GLFW_RELEASE)
|
||||
trackball.ButtonUp(vcg::Trackball::KEY_SHIFT);
|
||||
|
||||
if (key == GLFW_KEY_LEFT_CONTROL && action == GLFW_PRESS)
|
||||
trackball.ButtonDown(vcg::Trackball::KEY_CTRL);
|
||||
if (key == GLFW_KEY_LEFT_CONTROL && action == GLFW_RELEASE)
|
||||
trackball.ButtonUp(vcg::Trackball::KEY_CTRL);
|
||||
|
||||
if (key == GLFW_KEY_LEFT_ALT && action == GLFW_PRESS)
|
||||
trackball.ButtonDown(vcg::Trackball::KEY_ALT);
|
||||
if (key == GLFW_KEY_LEFT_ALT && action == GLFW_RELEASE)
|
||||
trackball.ButtonUp(vcg::Trackball::KEY_ALT);
|
||||
}
|
||||
|
||||
// Now inside any function
|
||||
void showMainMenu()
|
||||
{
|
||||
bool open = false, save = false;
|
||||
if(ImGui::BeginMainMenuBar())
|
||||
{
|
||||
if (ImGui::BeginMenu("File"))
|
||||
{
|
||||
if (ImGui::MenuItem("Open", NULL))
|
||||
open = true;
|
||||
if (ImGui::MenuItem("Quit", NULL))
|
||||
exit(0);
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
ImGui::EndMainMenuBar();
|
||||
}
|
||||
|
||||
//Remember the name to ImGui::OpenPopup() and showFileDialog() must be same...
|
||||
if(open)
|
||||
ImGui::OpenPopup("Open File");
|
||||
|
||||
if(file_dialog.showFileDialog("Open File", imgui_addons::ImGuiFileBrowser::DialogMode::OPEN, ImVec2(700, 310), ".obj,.ply,.off"))
|
||||
{
|
||||
LoadMesh(file_dialog.selected_path);
|
||||
PathMesh= file_dialog.selected_path;
|
||||
}
|
||||
}
|
||||
|
||||
void InitGLFW_Window()
|
||||
{
|
||||
if (!glfwInit())
|
||||
{
|
||||
std::cout<<"Error Initializing GLFW"<<std::endl;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
window = glfwCreateWindow(1280, 720, "Dear ImGui GLFW+OpenGL2 example", NULL, NULL);
|
||||
if (window == NULL)
|
||||
{
|
||||
std::cout<<"Error Initializing GLFW Window"<<std::endl;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
glfwSwapInterval(1); // Enable vsync
|
||||
|
||||
// Setup window
|
||||
glfwSetErrorCallback(glfw_error_callback);
|
||||
glfwSetCursorPosCallback(window, cursor_position_callback);
|
||||
glfwSetMouseButtonCallback(window, mouse_button_callback);
|
||||
glfwSetScrollCallback(window, scroll_callback);
|
||||
glfwSetKeyCallback(window, key_callback);
|
||||
}
|
||||
|
||||
void InitIMGui()
|
||||
{
|
||||
// Setup Dear ImGui context
|
||||
IMGUI_CHECKVERSION();
|
||||
ImGui::CreateContext();
|
||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||
|
||||
// Setup Dear ImGui style
|
||||
// ImGui::StyleColorsClassic();
|
||||
ImGui::StyleColorsDark();
|
||||
|
||||
// Setup Platform/Renderer backends
|
||||
ImGui_ImplGlfw_InitForOpenGL(window, true);
|
||||
ImGui_ImplOpenGL2_Init();
|
||||
}
|
||||
|
||||
void SetRenderBar()
|
||||
{
|
||||
ImGui::Begin("Simple VCG Mesh Visualizer",NULL,ImGuiWindowFlags_AlwaysAutoResize); // Create a window called "Hello, world!" and append into it.
|
||||
|
||||
ImGui::Checkbox("Show Mesh", &showMesh);
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("Show TBall", &showTrackBall);
|
||||
|
||||
ImGui::ColorEdit3("mesh color", (float*)&mesh_color); // Edit 3 floats representing a color
|
||||
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
||||
const char* items[] = { "Box", "Points", "DMWire",
|
||||
"Hidden", "Flat", "Smooth",
|
||||
"FlatWire","Radar"
|
||||
};
|
||||
|
||||
if (ImGui::BeginCombo("Rendering", items[selected_rend_mode]))
|
||||
{
|
||||
for (int i = 0; i < IM_ARRAYSIZE(items); i++)
|
||||
{
|
||||
bool is_selected = (selected_rend_mode == i);
|
||||
if (ImGui::Selectable(items[i], is_selected))
|
||||
{
|
||||
selected_rend_mode = i;
|
||||
|
||||
switch(selected_rend_mode)
|
||||
{
|
||||
case 0 : DMode=vcg::GLW::DMBox; break;
|
||||
case 1 : DMode=vcg::GLW::DMPoints; break;
|
||||
case 2 : DMode=vcg::GLW::DMWire; break;
|
||||
case 3 : DMode=vcg::GLW::DMHidden; break;
|
||||
case 4 : DMode=vcg::GLW::DMFlat; break;
|
||||
case 5 : DMode=vcg::GLW::DMSmooth; break;
|
||||
case 6 : DMode=vcg::GLW::DMFlatWire; break;
|
||||
default : DMode=vcg::GLW::DMFlatWire;
|
||||
}
|
||||
}
|
||||
if (is_selected)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
ImGui::SliderFloat("thickness", &line_thick, 0.5f, 20.0f);
|
||||
|
||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void SetLogWindow()
|
||||
{
|
||||
ImGui::Begin("Log",NULL,ImGuiWindowFlags_AlwaysAutoResize);
|
||||
std::string LogPrint= oss.str();
|
||||
ImGui::Text("%s",LogPrint.c_str());
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void SetUserBar()
|
||||
{
|
||||
ImGui::Begin("User",NULL,ImGuiWindowFlags_AlwaysAutoResize);
|
||||
if(ImGui::Button("Reload Mesh"))
|
||||
{
|
||||
LoadMesh(PathMesh);
|
||||
oss<<"Reloaded mesh";
|
||||
}
|
||||
|
||||
if(ImGui::Button("Smooth Mesh"))
|
||||
{
|
||||
vcg::tri::Smooth<MyTriMesh>::VertexCoordLaplacian(mesh, 1, false);
|
||||
vcg::tri::UpdateNormal<MyTriMesh>::PerVertexNormalizedPerFaceNormalized(mesh);
|
||||
oss<<"Smoothed mesh";
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
|
||||
void GLDrawMesh()
|
||||
{
|
||||
int display_w, display_h;
|
||||
glfwGetFramebufferSize(window, &display_w, &display_h);
|
||||
glViewport(0, 0, display_w, display_h);
|
||||
glClearColor(clear_color.x * clear_color.w, clear_color.y * clear_color.w, clear_color.z * clear_color.w, clear_color.w);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
|
||||
glEnable(GL_NORMALIZE);
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
glEnable(GL_CULL_FACE);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
|
||||
gluPerspective(40, (GLdouble)display_w/(GLdouble)display_h, 0.1, 100);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
gluLookAt(0,0,4.f, 0,0,0, 0,1,0);
|
||||
|
||||
trackball.GetView();
|
||||
trackball.Apply();
|
||||
glDisable(GL_CULL_FACE);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
|
||||
|
||||
// save modelview matrix
|
||||
glPushMatrix();
|
||||
vcg::glScale(2.0f/mesh.bbox.Diag());
|
||||
vcg::glTranslate(-mesh.bbox.Center());
|
||||
if (showMesh)
|
||||
{
|
||||
glColor4f(mesh_color.x * mesh_color.w, mesh_color.y * mesh_color.w, mesh_color.z * mesh_color.w, mesh_color.w);
|
||||
glPushAttrib(GL_ALL_ATTRIB_BITS);
|
||||
glLineWidth(line_thick);
|
||||
glWrap.SetHintParamf(vcg::GLW::HNPPointSize,line_thick);
|
||||
glWrap.Draw(DMode,vcg::GLW::CMNone,vcg::GLW::TMNone);
|
||||
glPopAttrib();
|
||||
}
|
||||
glPopMatrix();
|
||||
if (showTrackBall) trackball.DrawPostApply();
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
LoadMesh(PathMesh);
|
||||
|
||||
glWrap.m=&mesh;
|
||||
|
||||
InitGLFW_Window();
|
||||
|
||||
InitIMGui();
|
||||
glewInit();
|
||||
|
||||
// Main loop
|
||||
while (!glfwWindowShouldClose(window))
|
||||
{
|
||||
// Poll and handle events (inputs, window resize, etc.)
|
||||
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
|
||||
// - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application, or clear/overwrite your copy of the mouse data.
|
||||
// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application, or clear/overwrite your copy of the keyboard data.
|
||||
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
|
||||
glfwPollEvents();
|
||||
|
||||
// Start the Dear ImGui frame
|
||||
ImGui_ImplOpenGL2_NewFrame();
|
||||
ImGui_ImplGlfw_NewFrame();
|
||||
ImGui::NewFrame();
|
||||
{
|
||||
SetRenderBar();
|
||||
SetLogWindow();
|
||||
SetUserBar();
|
||||
showMainMenu();
|
||||
}
|
||||
// Rendering
|
||||
ImGui::Render();
|
||||
|
||||
GLDrawMesh();
|
||||
|
||||
// If you are using this code with non-legacy OpenGL header/contexts (which you should not, prefer using imgui_impl_opengl3.cpp!!),
|
||||
// you may need to backup/reset/restore other state, e.g. for current shader using the commented lines below.
|
||||
ImGui_ImplOpenGL2_RenderDrawData(ImGui::GetDrawData());
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
glfwSwapBuffers(window);
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
ImGui_ImplOpenGL2_Shutdown();
|
||||
ImGui_ImplGlfw_Shutdown();
|
||||
ImGui::DestroyContext();
|
||||
|
||||
glfwDestroyWindow(window);
|
||||
glfwTerminate();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
#ifndef MY_TRI_MESH_TYPE
|
||||
#define MY_TRI_MESH_TYPE
|
||||
|
||||
#include <vcg/complex/complex.h>
|
||||
#include <vcg/complex/algorithms/update/bounding.h>
|
||||
#include <vcg/complex/algorithms/smooth.h>
|
||||
#include <wrap/io_trimesh/import.h>
|
||||
#include <wrap/gl/trimesh.h>
|
||||
|
||||
class MyTriFace;
|
||||
class MyTriEdge;
|
||||
class MyTriVertex;
|
||||
|
||||
struct TriUsedTypes : public vcg::UsedTypes<vcg::Use<MyTriVertex>::AsVertexType,
|
||||
vcg::Use<MyTriEdge>::AsEdgeType,
|
||||
vcg::Use<MyTriFace>::AsFaceType>
|
||||
{
|
||||
};
|
||||
|
||||
class MyTriVertex : public vcg::Vertex<TriUsedTypes,
|
||||
vcg::vertex::Coord3f,
|
||||
vcg::vertex::Normal3f,
|
||||
vcg::vertex::BitFlags>
|
||||
{
|
||||
};
|
||||
|
||||
class MyTriEdge : public vcg::Edge<
|
||||
TriUsedTypes,
|
||||
vcg::edge::VertexRef,
|
||||
vcg::edge::BitFlags>
|
||||
{
|
||||
};
|
||||
|
||||
class MyTriFace : public vcg::Face<TriUsedTypes,
|
||||
vcg::face::VertexRef,
|
||||
vcg::face::BitFlags,
|
||||
vcg::face::Normal3f>
|
||||
{
|
||||
};
|
||||
|
||||
class MyTriMesh : public vcg::tri::TriMesh<std::vector<MyTriVertex>,
|
||||
std::vector<MyTriEdge>,
|
||||
std::vector<MyTriFace>>
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user