Skip to content

Commit 2874d0e

Browse files
committed
- added PLY exporter
- improved the DFSPH implementation significantly - added documentation for DFSPH - improved GUI - updated imgui - removed AntTweakBar - bugfixes - implemented an AVX version of XSPH
1 parent f46998f commit 2874d0e

File tree

225 files changed

+33797
-81924
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

225 files changed

+33797
-81924
lines changed

CMakeLists.txt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ endif()
2121

2222
set(TOPLEVEL_INCLUDE_DIR ${PROJECT_SOURCE_DIR})
2323

24-
option(USE_IMGUI "Use imgui instead of AntTweakBar" ON)
25-
2624
################################################################################
2725
# foreign external libraries
2826
################################################################################
@@ -32,11 +30,8 @@ add_subdirectory(extern/md5)
3230
add_subdirectory(extern/tinyexpr)
3331
if (NOT SPH_LIBS_ONLY)
3432
add_subdirectory(extern/glfw)
35-
if (USE_IMGUI)
36-
add_subdirectory(extern/imgui)
37-
else()
38-
add_subdirectory(extern/AntTweakBar)
39-
endif()
33+
add_subdirectory(extern/imgui)
34+
add_subdirectory(extern/nfd)
4035
if (USE_PYTHON_BINDINGS)
4136
add_subdirectory(extern/pybind)
4237
endif ()

Changelog.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
2.12.0
2+
- added PLY exporter
3+
- improved the DFSPH implementation significantly
4+
- added documentation for DFSPH
5+
- improved GUI
6+
- updated imgui
7+
- removed AntTweakBar
8+
- bugfixes
9+
- implemented an avx version of XSPH
10+
111
2.11.6
212
- updated Catch2
313
- fixes for new gcc version

GUI/OpenGL/MiniGL.cpp

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ unsigned char MiniGL::texData[IMAGE_ROWS][IMAGE_COLS][3];
5353
unsigned int MiniGL::m_texId = 0;
5454
void(*MiniGL::selectionfunc)(const Vector2i&, const Vector2i&, void*) = NULL;
5555
void *MiniGL::selectionfuncClientData = NULL;
56+
bool MiniGL::selectionMode = false;
5657
void(*MiniGL::mousefunc)(int, int, void*) = NULL;
5758
int MiniGL::mouseFuncButton;
5859
Vector2i MiniGL::m_selectionStart;
@@ -790,7 +791,10 @@ void MiniGL::mousePress(GLFWwindow* window, int button, int action, int mods)
790791
if (button == GLFW_MOUSE_BUTTON_1)
791792
{
792793
if (action == GLFW_PRESS)
794+
{
793795
m_selectionStart = Vector2i(mouse_pos_x_old, mouse_pos_y_old);
796+
selectionMode = true;
797+
}
794798
else
795799
{
796800
if (m_selectionStart[0] != -1)
@@ -799,6 +803,7 @@ void MiniGL::mousePress(GLFWwindow* window, int button, int action, int mods)
799803
selectionfunc(m_selectionStart, pos, selectionfuncClientData);
800804
}
801805
m_selectionStart = Vector2i(-1, -1);
806+
selectionMode = false;
802807
}
803808
}
804809
}
@@ -948,6 +953,29 @@ void MiniGL::error_callback(int error, const char* description)
948953
LOG_ERR << description;
949954
}
950955

956+
void MiniGL::drawSelectionRect()
957+
{
958+
glDisable(GL_LIGHTING);
959+
glPushMatrix();
960+
glLoadIdentity();
961+
glMatrixMode(GL_PROJECTION);
962+
glPushMatrix();
963+
glLoadIdentity();
964+
glOrtho(0.0f, m_width, m_height, 0.0f, -1.0f, 1.0f);
965+
glBegin(GL_LINE_LOOP);
966+
glColor3f(1, 0, 0); //Set the colour to red
967+
glVertex2f(m_selectionStart[0], m_selectionStart[1]);
968+
glVertex2f(m_selectionStart[0], mouse_pos_y_old);
969+
glVertex2f(mouse_pos_x_old, mouse_pos_y_old);
970+
glVertex2f(mouse_pos_x_old, m_selectionStart[1]);
971+
glEnd();
972+
glPopMatrix();
973+
glMatrixMode(GL_MODELVIEW);
974+
975+
glPopMatrix();
976+
glEnable(GL_LIGHTING);
977+
}
978+
951979
void MiniGL::mainLoop()
952980
{
953981
while (!glfwWindowShouldClose(m_glfw_window))
@@ -963,6 +991,9 @@ void MiniGL::mainLoop()
963991
if (scenefunc != nullptr)
964992
scenefunc();
965993

994+
if (selectionMode)
995+
drawSelectionRect();
996+
966997
glfwSwapBuffers(m_glfw_window);
967998
//glFlush();
968999
}
@@ -988,6 +1019,26 @@ void MiniGL::swapBuffers()
9881019
//glFlush();
9891020
}
9901021

1022+
void MiniGL::getWindowPos(int &x, int &y)
1023+
{
1024+
glfwGetWindowPos(m_glfw_window, &x, &y);
1025+
}
1026+
1027+
void MiniGL::getWindowSize(int& w, int& h)
1028+
{
1029+
glfwGetWindowSize(m_glfw_window, &w, &h);
1030+
}
1031+
1032+
void MiniGL::setWindowPos(int x, int y)
1033+
{
1034+
glfwSetWindowPos(m_glfw_window, x, y);
1035+
}
1036+
1037+
void MiniGL::setWindowSize(int w, int h)
1038+
{
1039+
glfwSetWindowSize(m_glfw_window, w, h);
1040+
}
1041+
9911042
void MiniGL::breakPointMainLoop()
9921043
{
9931044
if (m_breakPointActive)

GUI/OpenGL/MiniGL.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ namespace SPH
107107
static unsigned int m_texId;
108108
static void(*selectionfunc) (const Vector2i&, const Vector2i&, void*);
109109
static void* selectionfuncClientData;
110+
static bool selectionMode;
110111
static void(*mousefunc)(int, int, void*);
111112
static int mouseFuncButton;
112113
static Vector2i m_selectionStart;
@@ -131,6 +132,7 @@ namespace SPH
131132
public:
132133
static void getOpenGLVersion(int &major_version, int &minor_version);
133134
static void coordinateSystem ();
135+
static void drawSelectionRect();
134136
static void drawVector(const Vector3r &a, const Vector3r &b, const float w, float *color);
135137
/** Renders a closed cylinder between two points.
136138
*/
@@ -205,6 +207,10 @@ namespace SPH
205207
static void swapBuffers();
206208

207209
static GLFWwindow* getWindow() { return m_glfw_window; }
210+
static void getWindowPos(int& x, int& y);
211+
static void getWindowSize(int& w, int& h);
212+
static void setWindowPos(int x, int y);
213+
static void setWindowSize(int w, int h);
208214
};
209215
}
210216

GUI/TweakBar/CMakeLists.txt

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)