예제 #1
0
void cursorPosCallback(GLFWwindow* window, double x, double y)
{
  if( !TwEventMousePosGLFW(x, y) )  // Send event to AntTweakBar
  {
    moveTrackball(x, y);
  }
}
예제 #2
0
파일: oglApp.cpp 프로젝트: byhj/byhj-Render
	void OGLApp::glfw_mouse(GLFWwindow* window, double xpos, double ypos)
	{
#ifdef USE_ANT
		TwEventMousePosGLFW(xpos, ypos);
#endif
		app->v_mouseCallback(window, xpos, ypos);
	}
예제 #3
0
// Callback function called by GLFW when mouse has moved
void GLFWCALL OnMousePos(int mouseX, int mouseY)
{
    if( !TwEventMousePosGLFW(mouseX, mouseY) )  // Send event to AntTweakBar
    {
        // Event has not been handled by AntTweakBar
        // Do something if needed.
    }
}
void cursorPos(GLFWwindow* window, double x, double y){
	if (TwEventMousePosGLFW(x, y))
		return;

	float ax = x;
	float ay = gHeight - y;

	gpCamera->handleCursorPos(x, y);

}
예제 #5
0
void mouseMove_Aux(GLFWwindow* pWindow, double xd, double yd)
{
    (void)pWindow;

#ifdef USE_ANTTWEAKBAR
    int ant = TwEventMousePosGLFW(static_cast<int>(xd), static_cast<int>(yd));
    if (ant != 0)
        return;
#endif
    mouseMove(pWindow, xd, yd);
}
예제 #6
0
  //------------------------------------------------------------------------------
  void MyWindow::keyboardchar(unsigned char key, int mods, int x, int y)
  {
      WindowInertiaCamera::keyboardchar(key, mods, x, y);
#ifdef USEANTTWEAKBAR
    //int res = TwEventKeyboardGLUT(key, x,y);
    TwEventMousePosGLFW(x,y);
    int res = TwEventCharGLFW(key, BUTTON_PRESS|mods);
    if(res) {
		postRedisplay();
        return;
	}
#endif
  }
예제 #7
0
 void GLFW_App::s_mouseMove(GLFWwindow* window, double x, double y)
 {
     GLFW_App* app = static_cast<GLFW_App*>(glfwGetWindowUserPointer(window));
     if(app->displayTweakBar())
         TwEventMousePosGLFW((int)x, (int)y);
     uint32_t buttonModifiers, keyModifiers, bothMods;
     s_getModifiers(window, buttonModifiers, keyModifiers);
     bothMods = buttonModifiers | keyModifiers;
     MouseEvent e(buttonModifiers, (int)x, (int)y, bothMods, glm::ivec2(0));
     
     if(buttonModifiers)
         app->mouseDrag(e);
     else
         app->mouseMove(e);
 }
void mouseMove_Aux(GLFWwindow* pWindow, double xd, double yd)
{
    (void)pWindow;

#ifdef USE_ANTTWEAKBAR
    DashboardScene& dash = g_app.m_dashScene;
    if (!dash.m_bDraw)
    {
        const int ant = TwEventMousePosGLFW(static_cast<int>(xd), static_cast<int>(yd));
        if (ant != 0)
            return;
    }
#endif
    mouseMove(pWindow, xd, yd);
}
예제 #9
0
  void MyWindow::keyboard(MyWindow::KeyCode key, ButtonAction action, int mods, int x, int y)
  {
#ifdef USEANTTWEAKBAR
    // to fix some mapping issues with special keys
    // TODO: find the real Fix...
    if(action == MyWindow::BUTTON_PRESS)
    {
        switch(key)
        {
        case NVPWindow::KEY_HOME:
            if(TwEventSpecialGLUT(106/*GLUT_KEY_HOME*/, x,y) ) { postRedisplay(); return; }
            break;
        case NVPWindow::KEY_END:
            if(TwEventSpecialGLUT(107/*GLUT_KEY_END*/, x,y) ) { postRedisplay(); return; }
            break;
        case NVPWindow::KEY_LEFT:
            if(TwEventSpecialGLUT(100/*GLUT_KEY_LEFT*/, x,y) ) { postRedisplay(); return; }
            break;
        case NVPWindow::KEY_RIGHT:
            if(TwEventSpecialGLUT(102/*GLUT_KEY_RIGHT*/, x,y) ) { postRedisplay(); return; }
            break;
        case NVPWindow::KEY_BACKSPACE:
            if(TwEventKeyboardGLUT(TW_KEY_BACKSPACE, x,y) ) { postRedisplay(); return; }
            break;
        case NVPWindow::KEY_DELETE:
            if(TwEventKeyboardGLUT(TW_KEY_DELETE, x,y) ) { postRedisplay(); return; }
            break;
        case NVPWindow::KEY_ENTER:
        case NVPWindow::KEY_KP_ENTER:
            if(TwEventKeyboardGLUT(TW_KEY_RETURN, x,y)) { postRedisplay(); return; }
            break;
        case NVPWindow::KEY_ESCAPE:
            //postQuit();
            break;
        }
    }
    TwEventMousePosGLFW(x,y);
    if(TwEventKeyGLFW(key, action) ) {
    //if(TwEventSpecialGLUT(key, x,y) ) {
		postRedisplay();
        return;
	}
#endif
    WindowInertiaCamera::keyboard(key, action, mods, x, y);
  }
static void onMouseMove(GLFWwindow* window, double xpos, double ypos)
{
	// AntTweakBar event
	if (TwEventMousePosGLFW(int(xpos), int(ypos)))
		return;

	glm::vec2 dpos(xpos - s_prevXPos, s_prevYPos - ypos);

	// Drag mesh
	if (g_drag){
		g_drag->second += 0.01f * glm::vec3(dpos, 0);
	}

	// Camera control
	if (s_camera.getMode() == CameraMode::ARC){
		s_camera.rotate(dpos);
	}
	else if (s_camera.getMode() == CameraMode::PAN){
		s_camera.pan(dpos);
	}	

	s_prevXPos = xpos;
	s_prevYPos = ypos;
}
예제 #11
0
void myTwEventMousePosGLFW(GLFWwindow* window, double xpos, double ypos)
{
	TwEventMousePosGLFW((int)xpos, (int)ypos);
}
예제 #12
0
	void DebugUIMouseMove(int x, int y)
	{
		TwEventMousePosGLFW(x, y);
	}
// return true to prevent m_window updates
bool Sample::mouse_pos(int x, int y)
{
  return !!TwEventMousePosGLFW(x,y); 
}
예제 #14
0
void mouseMotion(GLFWwindow * window, double x, double y) {
    
    if(!TwEventMousePosGLFW(x * 2, y * 2)) {
        scene->updateCameraPosition(x, y);
    }
}
예제 #15
0
void cursorPosCallback(GLFWwindow *window, double x, double y) {
    int tweak = TwEventMousePosGLFW((int) x, (int) y);
}