added drag n drop function,
need to clean up before loading the next mesh
This commit is contained in:
parent
b4bd314450
commit
91b65bf6e3
|
@ -8,4 +8,6 @@ extern void mouseMove(GLFWwindow *window, double xpos, double ypos);
|
||||||
|
|
||||||
extern void mouseWheel(GLFWwindow *window, double xoffset, double yoffset);
|
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);
|
|
@ -179,6 +179,7 @@ void OpenGLController::setCallbackFunctions()
|
||||||
glfwSetWindowSizeCallback(pWindow, windowResize);
|
glfwSetWindowSizeCallback(pWindow, windowResize);
|
||||||
glfwSetScrollCallback(pWindow, mouseWheel);
|
glfwSetScrollCallback(pWindow, mouseWheel);
|
||||||
glfwSetKeyCallback(pWindow, keyPress);
|
glfwSetKeyCallback(pWindow, keyPress);
|
||||||
|
glfwSetDropCallback(pWindow, dragNdrop);
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::mat4 OpenGLController::getModelMatrix(unsigned int index)
|
glm::mat4 OpenGLController::getModelMatrix(unsigned int index)
|
||||||
|
|
|
@ -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]);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue