Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.
C++ 3d3d-sculptingcppdear-imguidigital-sculptingfbxgame-developmentgaussian-splattinggltfimage-to-3dmcpopenglopenusdsculptingtext-to-3dunreal-engine
SpaceMouse with redraw on demand: axis jitter inside the dead zone wakes no frame (a hand resting on the cap keeps the app idle)
islandmed279864e4887b
diff --git a/src/app/App.cpp b/src/app/App.cppindex 596fb1f2..5a1a4a8c 100644--- a/src/app/App.cpp+++ b/src/app/App.cpp@@ -660,8 +660,9 @@ int App::run() {handleEvent(ev);if (ev.type == SDL_EVENT_KEYMAP_CHANGED || ev.type == SDL_EVENT_KEYBOARD_ADDED ||ev.type == SDL_EVENT_KEYBOARD_REMOVED || ev.type == SDL_EVENT_MOUSE_ADDED ||- ev.type == SDL_EVENT_MOUSE_REMOVED || ev.type == SDL_EVENT_CLIPBOARD_UPDATE)- return; // nothing on screen changes+ ev.type == SDL_EVENT_MOUSE_REMOVED || ev.type == SDL_EVENT_CLIPBOARD_UPDATE ||+ (ev.type == SDL_EVENT_JOYSTICK_AXIS_MOTION && !spaceMouseDeflected()))+ return; // nothing on screen changes (a hand resting on a SpaceMouse: inside its dead zone)draw = true;if (logRedraw) SDL_Log("redraw: event 0x%x", unsigned(ev.type));const bool input = (ev.type >= SDL_EVENT_KEY_DOWN && ev.type < SDL_EVENT_JOYSTICK_AXIS_MOTION) ||diff --git a/src/app/App.h b/src/app/App.hindex f8224d76..a6229e05 100644--- a/src/app/App.h+++ b/src/app/App.h@@ -1179,6 +1179,7 @@ private:void spaceMouseClose();void updateSpaceMouse(float dt); // once a frame: move the camera by the held axesbool spaceMouseMoving() const { return spaceMouseMoving_; } // keep frames coming while the cap is pushed+ bool spaceMouseDeflected() const; // the cap is pushed past the dead zone now (an axis event worth a frame)void drawSpaceMouseSection(); // Preferences > Input > SpaceMouseSDL_Joystick* spaceMouse_ = nullptr;SDL_JoystickID spaceMouseId_ = 0;diff --git a/src/app/SpaceMouse.cpp b/src/app/SpaceMouse.cppindex 498cf788..d850959f 100644--- a/src/app/SpaceMouse.cpp+++ b/src/app/SpaceMouse.cpp@@ -93,6 +93,14 @@ void App::spaceMouseClose() {spaceMouseMoving_ = false;}+bool App::spaceMouseDeflected() const {+ if (!spaceMouse_) return false;+ std::array<float, kSmAxes> axes{};+ for (int i = 0; i < kSmAxes; ++i)+ axes[size_t(i)] = std::clamp(float(SDL_GetJoystickAxis(spaceMouse_, i)) / 32767.0f, -1.0f, 1.0f);+ return spaceMouseMotion(axes, 1.0f / 60.0f, uiPrefs_.spaceMouse).any();+}+void App::spaceMouseEvent(const SDL_Event& e) {switch (e.type) {case SDL_EVENT_JOYSTICK_ADDED: