From 11808862f2d3ecad1b4600f1526e03ef8ce28f7c Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 9 May 2019 18:44:13 +0200 Subject: [PATCH 1/5] showbase: fix BufferViewer when main window is opened later Fixes #648 --- direct/src/showbase/ShowBase.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/direct/src/showbase/ShowBase.py b/direct/src/showbase/ShowBase.py index c0e6d9dd16..ddb7fb48d8 100644 --- a/direct/src/showbase/ShowBase.py +++ b/direct/src/showbase/ShowBase.py @@ -829,9 +829,10 @@ class ShowBase(DirectObject.DirectObject): win.requestProperties(props) mainWindow = False - if self.win == None: + if self.win is None: mainWindow = True self.win = win + self.bufferViewer.win = win self.winList.append(win) From b8b6f2f2dcc7fcbdee76de3fb80c225d51a36292 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 9 May 2019 19:18:25 +0200 Subject: [PATCH 2/5] showbase: fix BufferViewer error when opening window right away --- direct/src/showbase/ShowBase.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/direct/src/showbase/ShowBase.py b/direct/src/showbase/ShowBase.py index ddb7fb48d8..5523d91a98 100644 --- a/direct/src/showbase/ShowBase.py +++ b/direct/src/showbase/ShowBase.py @@ -832,7 +832,8 @@ class ShowBase(DirectObject.DirectObject): if self.win is None: mainWindow = True self.win = win - self.bufferViewer.win = win + if hasattr(self, 'bufferViewer'): + self.bufferViewer.win = win self.winList.append(win) From 73200e0912c04c92b18ac8266e5a8c4763f7e34a Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 12 May 2019 19:16:46 +0200 Subject: [PATCH 3/5] Add Max Voss to BACKERS.md [skip ci] --- BACKERS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/BACKERS.md b/BACKERS.md index b86afc0e71..8c6cd2e965 100644 --- a/BACKERS.md +++ b/BACKERS.md @@ -22,6 +22,7 @@ This is a list of all the people who are contributing financially to Panda3D. I ![Benefactors](https://opencollective.com/panda3d/tiers/benefactor.svg?avatarHeight=48&width=600) * Sam Edwards +* Max Voss ## Backers From c1c74e2cd30e5b090e952bdc3fcd0bbee284ae3b Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 12 May 2019 19:22:26 +0200 Subject: [PATCH 4/5] mathutil: add some more assertion checks to PerlinNoise2 --- panda/src/mathutil/perlinNoise2.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/panda/src/mathutil/perlinNoise2.cxx b/panda/src/mathutil/perlinNoise2.cxx index ef187beb9c..1dc576e08a 100644 --- a/panda/src/mathutil/perlinNoise2.cxx +++ b/panda/src/mathutil/perlinNoise2.cxx @@ -19,6 +19,9 @@ */ double PerlinNoise2:: noise(const LVecBase2d &value) const { + // If this triggers, you passed in 0 for table_size. + nassertr(!_index.empty(), make_nan(0.0)); + // Convert the vector to our local coordinate space. LVecBase2d vec = _input_xform.xform_point(value); @@ -41,9 +44,13 @@ noise(const LVecBase2d &value) const { double v = fade(y); // Hash coordinates of the 4 square corners (A, B, A + 1, and B + 1) + nassertr(X >= 0 && X + 1 < _index.size(), make_nan(0.0)); int A = _index[X] + Y; int B = _index[X + 1] + Y; + nassertr(A >= 0 && A + 1 < _index.size(), make_nan(0.0)); + nassertr(B >= 0 && B + 1 < _index.size(), make_nan(0.0)); + // and add blended results from 4 corners of square. double result = lerp(v, lerp(u, grad(_index[A], x, y), From 750afbb1886796a7daea2974bdfb61ce6d037a4b Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 12 May 2019 20:34:19 +0200 Subject: [PATCH 5/5] device: Linux fixes for Trust GXT 24 and a few other cheap gamepads Fixes #576 --- panda/src/device/evdevInputDevice.cxx | 55 +++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 8 deletions(-) diff --git a/panda/src/device/evdevInputDevice.cxx b/panda/src/device/evdevInputDevice.cxx index fc89b5a5a4..69d2979f7f 100644 --- a/panda/src/device/evdevInputDevice.cxx +++ b/panda/src/device/evdevInputDevice.cxx @@ -65,6 +65,12 @@ enum QuirkBits { // Axes on the right stick are swapped, using x for y and vice versa. QB_right_axes_swapped = 64, + + // Has no trigger axes. + QB_no_analog_triggers = 128, + + // Alternate button mapping. + QB_alt_button_mapping = 256, }; static const struct DeviceMapping { @@ -85,10 +91,14 @@ static const struct DeviceMapping { {0x28de, 0x1142, InputDevice::DeviceClass::unknown, QB_steam_controller}, // Jess Tech Colour Rumble Pad {0x0f30, 0x0111, InputDevice::DeviceClass::gamepad, QB_rstick_from_z | QB_right_axes_swapped}, - // SPEED Link SL-6535-SBK-01 - {0x0079, 0x0006, InputDevice::DeviceClass::gamepad, 0}, + // Trust GXT 24 + {0x0079, 0x0006, InputDevice::DeviceClass::gamepad, QB_no_analog_triggers | QB_alt_button_mapping}, // 8bitdo N30 Pro Controller {0x2dc8, 0x9001, InputDevice::DeviceClass::gamepad, QB_rstick_from_z}, + // Generic gamepad + {0x0810, 0x0001, InputDevice::DeviceClass::gamepad, QB_no_analog_triggers | QB_alt_button_mapping | QB_rstick_from_z | QB_right_axes_swapped}, + // Generic gamepad without sticks + {0x0810, 0xe501, InputDevice::DeviceClass::gamepad, QB_no_analog_triggers | QB_alt_button_mapping}, // 3Dconnexion Space Traveller 3D Mouse {0x046d, 0xc623, InputDevice::DeviceClass::spatial_mouse, 0}, // 3Dconnexion Space Pilot 3D Mouse @@ -497,8 +507,10 @@ init_device() { axis = InputDevice::Axis::right_x; } } else if (_device_class == DeviceClass::gamepad) { - axis = InputDevice::Axis::left_trigger; - have_analog_triggers = true; + if ((quirks & QB_no_analog_triggers) == 0) { + axis = InputDevice::Axis::left_trigger; + have_analog_triggers = true; + } } else if (_device_class == DeviceClass::spatial_mouse) { axis = InputDevice::Axis::z; } else { @@ -527,8 +539,13 @@ init_device() { axis = InputDevice::Axis::right_y; } } else if (_device_class == DeviceClass::gamepad) { - axis = InputDevice::Axis::right_trigger; - have_analog_triggers = true; + if ((quirks & QB_no_analog_triggers) == 0) { + axis = InputDevice::Axis::right_trigger; + have_analog_triggers = true; + } else { + // Special weird case for Trust GXT 24 + axis = InputDevice::Axis::right_y; + } } else { axis = InputDevice::Axis::yaw; } @@ -548,8 +565,10 @@ init_device() { break; case ABS_GAS: if (_device_class == DeviceClass::gamepad) { - axis = InputDevice::Axis::right_trigger; - have_analog_triggers = true; + if ((quirks & QB_no_analog_triggers) == 0) { + axis = InputDevice::Axis::right_trigger; + have_analog_triggers = true; + } } else { axis = InputDevice::Axis::accelerator; } @@ -974,6 +993,26 @@ map_button(int code, DeviceClass device_class, int quirks) { // BTN_THUMB and BTN_THUMB2 detect touching the touchpads. return ButtonHandle::none(); + } else if (device_class == DeviceClass::gamepad && + (quirks & QB_alt_button_mapping) != 0) { + static const ButtonHandle mapping[] = { + GamepadButton::face_y(), + GamepadButton::face_b(), + GamepadButton::face_a(), + GamepadButton::face_x(), + GamepadButton::lshoulder(), + GamepadButton::rshoulder(), + GamepadButton::ltrigger(), + GamepadButton::rtrigger(), + GamepadButton::back(), + GamepadButton::start(), + GamepadButton::lstick(), + GamepadButton::rstick(), + }; + if ((code & 0xf) < 12) { + return mapping[code & 0xf]; + } + } else if (device_class == DeviceClass::gamepad) { // Based on "Jess Tech Colour Rumble Pad" static const ButtonHandle mapping[] = {