static ERROR_T Calibrate(IvhSensor* me) { ERROR_T retVal = ERROR_OK; IvhSensorData temp; pIvhSensorOrientation sensor = (pIvhSensorOrientation)(me); SAFE_MEMCPY(&temp, &sensor->input); CalculateRotation(sensor); UpdateData(sensor, &temp); SAFE_MEMCPY(&sensor->output, &temp); me->Notify(me); return retVal; }
void FlyCamera::HandleMouseInput(double dt) { if (glfwGetMouseButton(m_window, GLFW_MOUSE_BUTTON_3) == GLFW_PRESS) { if (m_bViewButtonClicked == false) { int width, height; glfwGetFramebufferSize(m_window, &width, &height); m_dCursorX = width / 2.0; m_dCursorY = height / 2.0; glfwSetCursorPos(m_window, m_dCursorX, m_dCursorY); m_bViewButtonClicked = true; } else { double mouseX, mouseY; glfwGetCursorPos(m_window, &mouseX, &mouseY); double xOffset = mouseX - m_dCursorX; double yOffset = mouseY - m_dCursorY; m_dCursorX = mouseX; m_dCursorY = mouseY; CalculateRotation(dt, xOffset, yOffset); } } else { m_bViewButtonClicked = false; } }
void SceneObject::RotationTo(const _3point& rotation) { CalculateRotation(rotation); }
void SceneObject::RotationZ(const _point& angle) { CalculateRotation(m_Rotation + _3point(0.0f, 0.0f, angle)); }
// Rotation void SceneObject::Rotation(const _3point& rotation) { CalculateRotation(m_Rotation + rotation); }
void FlyCamera::HandleMouseInput( real64_t dt ) { real64_t xOffset = clgState.viewDelta[1] / 360.0; real64_t yOffset = clgState.viewDelta[0] / 360.0; CalculateRotation( dt, xOffset, yOffset ); }