added drag n drop function,

need to clean up before loading the next mesh
This commit is contained in:
Anakin 2016-11-12 12:14:45 +01:00
parent b4bd314450
commit 91b65bf6e3
3 changed files with 11 additions and 1 deletions

View File

@ -8,4 +8,6 @@ extern void mouseMove(GLFWwindow *window, double xpos, double ypos);
extern void mouseWheel(GLFWwindow *window, double xoffset, double yoffset);
extern void keyPress(GLFWwindow *window, int key, int scancode, int action, int mods);
extern void keyPress(GLFWwindow *window, int key, int scancode, int action, int mods);
extern void dragNdrop(GLFWwindow* window, int count, const char** paths);

View File

@ -179,6 +179,7 @@ void OpenGLController::setCallbackFunctions()
glfwSetWindowSizeCallback(pWindow, windowResize);
glfwSetScrollCallback(pWindow, mouseWheel);
glfwSetKeyCallback(pWindow, keyPress);
glfwSetDropCallback(pWindow, dragNdrop);
}
glm::mat4 OpenGLController::getModelMatrix(unsigned int index)

View File

@ -98,3 +98,10 @@ void keyPress(GLFWwindow *window, int key, int scancode, int action, int mods)
}
}
}
void dragNdrop(GLFWwindow* window, int count, const char** paths)
{
OpenGLController* controller = reinterpret_cast<OpenGLController*>(glfwGetWindowUserPointer(window));
if(count > 0)
controller->loadMsh(paths[0]);
}