WIP 3Dconnexion refactoring: Fixing compilation on OSX

This commit is contained in:
bubnikv 2020-03-04 12:18:59 +01:00
parent c9df6e5cf8
commit cbe9216d79
2 changed files with 12 additions and 16 deletions

View File

@ -389,10 +389,10 @@ void Mouse3DController::disconnected()
m_connected = false;
}
bool Mouse3DController::handle_input(const DataPacketAxis& packet, const Params &params, State &state_in_out)
bool Mouse3DController::handle_input(const DataPacketAxis& packet)
{
if (! wxGetApp().IsActive())
return;
return false;
{
// Synchronize parameters between the UI thread and the background thread.
@ -405,34 +405,30 @@ bool Mouse3DController::handle_input(const DataPacketAxis& packet, const Params
}
bool updated = false;
//translation
double deadzone = params.translation.deadzone;
// translation
double deadzone = m_params.translation.deadzone;
Vec3d translation(std::abs(packet[0]) > deadzone ? -packet[0] : 0.0,
std::abs(packet[1]) > deadzone ? packet[1] : 0.0,
std::abs(packet[2]) > deadzone ? packet[2] : 0.0);
if (!translation.isApprox(Vec3d::Zero()))
{
state_in_out.append_translation(translation, params.input_queue_max_size);
if (! translation.isApprox(Vec3d::Zero())) {
m_state.append_translation(translation, m_params.input_queue_max_size);
updated = true;
}
//rotation
deadzone = params.rotation.deadzone;
// rotation
deadzone = m_params.rotation.deadzone;
Vec3f rotation(std::abs(packet[3]) > deadzone ? (float)packet[3] : 0.0,
std::abs(packet[4]) > deadzone ? (float)packet[4] : 0.0,
std::abs(packet[5]) > deadzone ? (float)packet[5] : 0.0);
if (!rotation.isApprox(Vec3f::Zero()))
{
state_in_out.append_rotation(rotation, params.input_queue_max_size);
if (! rotation.isApprox(Vec3f::Zero())) {
m_state.append_rotation(rotation, m_params.input_queue_max_size);
updated = true;
}
#if 1
if (updated) {
wxGetApp().plater()->set_current_canvas_as_dirty();
// ask for an idle event to update 3D scene
wxWakeUpIdle();
}
#endif
return updated;
}

View File

@ -2,7 +2,7 @@
#define slic3r_Mouse3DController_hpp_
// Enabled debug output to console and extended imgui dialog
#define ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT 1
#define ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT 0
#include "libslic3r/Point.hpp"
@ -180,7 +180,7 @@ public:
void disconnected();
typedef std::array<double, 6> DataPacketAxis;
// Unpack a 3DConnexion packet provided by the 3DConnexion driver into m_state. Called by Mouse3DHandlerMac.mm
static bool handle_input(const DataPacketAxis& packet, const Params &params, State &state_in_out);
bool handle_input(const DataPacketAxis& packet);
#endif // __APPLE__
#ifdef WIN32