Merge branch 'release/1.10.x'

This commit is contained in:
rdb 2019-05-12 21:03:14 +02:00
commit 3f312eccd9
4 changed files with 58 additions and 9 deletions

View File

@ -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) ![Benefactors](https://opencollective.com/panda3d/tiers/benefactor.svg?avatarHeight=48&width=600)
* Sam Edwards * Sam Edwards
* Max Voss
## Backers ## Backers

View File

@ -829,9 +829,11 @@ class ShowBase(DirectObject.DirectObject):
win.requestProperties(props) win.requestProperties(props)
mainWindow = False mainWindow = False
if self.win == None: if self.win is None:
mainWindow = True mainWindow = True
self.win = win self.win = win
if hasattr(self, 'bufferViewer'):
self.bufferViewer.win = win
self.winList.append(win) self.winList.append(win)

View File

@ -65,6 +65,12 @@ enum QuirkBits {
// Axes on the right stick are swapped, using x for y and vice versa. // Axes on the right stick are swapped, using x for y and vice versa.
QB_right_axes_swapped = 64, 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 { static const struct DeviceMapping {
@ -85,10 +91,14 @@ static const struct DeviceMapping {
{0x28de, 0x1142, InputDevice::DeviceClass::unknown, QB_steam_controller}, {0x28de, 0x1142, InputDevice::DeviceClass::unknown, QB_steam_controller},
// Jess Tech Colour Rumble Pad // Jess Tech Colour Rumble Pad
{0x0f30, 0x0111, InputDevice::DeviceClass::gamepad, QB_rstick_from_z | QB_right_axes_swapped}, {0x0f30, 0x0111, InputDevice::DeviceClass::gamepad, QB_rstick_from_z | QB_right_axes_swapped},
// SPEED Link SL-6535-SBK-01 // Trust GXT 24
{0x0079, 0x0006, InputDevice::DeviceClass::gamepad, 0}, {0x0079, 0x0006, InputDevice::DeviceClass::gamepad, QB_no_analog_triggers | QB_alt_button_mapping},
// 8bitdo N30 Pro Controller // 8bitdo N30 Pro Controller
{0x2dc8, 0x9001, InputDevice::DeviceClass::gamepad, QB_rstick_from_z}, {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 // 3Dconnexion Space Traveller 3D Mouse
{0x046d, 0xc623, InputDevice::DeviceClass::spatial_mouse, 0}, {0x046d, 0xc623, InputDevice::DeviceClass::spatial_mouse, 0},
// 3Dconnexion Space Pilot 3D Mouse // 3Dconnexion Space Pilot 3D Mouse
@ -497,8 +507,10 @@ init_device() {
axis = InputDevice::Axis::right_x; axis = InputDevice::Axis::right_x;
} }
} else if (_device_class == DeviceClass::gamepad) { } else if (_device_class == DeviceClass::gamepad) {
axis = InputDevice::Axis::left_trigger; if ((quirks & QB_no_analog_triggers) == 0) {
have_analog_triggers = true; axis = InputDevice::Axis::left_trigger;
have_analog_triggers = true;
}
} else if (_device_class == DeviceClass::spatial_mouse) { } else if (_device_class == DeviceClass::spatial_mouse) {
axis = InputDevice::Axis::z; axis = InputDevice::Axis::z;
} else { } else {
@ -527,8 +539,13 @@ init_device() {
axis = InputDevice::Axis::right_y; axis = InputDevice::Axis::right_y;
} }
} else if (_device_class == DeviceClass::gamepad) { } else if (_device_class == DeviceClass::gamepad) {
axis = InputDevice::Axis::right_trigger; if ((quirks & QB_no_analog_triggers) == 0) {
have_analog_triggers = true; axis = InputDevice::Axis::right_trigger;
have_analog_triggers = true;
} else {
// Special weird case for Trust GXT 24
axis = InputDevice::Axis::right_y;
}
} else { } else {
axis = InputDevice::Axis::yaw; axis = InputDevice::Axis::yaw;
} }
@ -548,8 +565,10 @@ init_device() {
break; break;
case ABS_GAS: case ABS_GAS:
if (_device_class == DeviceClass::gamepad) { if (_device_class == DeviceClass::gamepad) {
axis = InputDevice::Axis::right_trigger; if ((quirks & QB_no_analog_triggers) == 0) {
have_analog_triggers = true; axis = InputDevice::Axis::right_trigger;
have_analog_triggers = true;
}
} else { } else {
axis = InputDevice::Axis::accelerator; 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. // BTN_THUMB and BTN_THUMB2 detect touching the touchpads.
return ButtonHandle::none(); 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) { } else if (device_class == DeviceClass::gamepad) {
// Based on "Jess Tech Colour Rumble Pad" // Based on "Jess Tech Colour Rumble Pad"
static const ButtonHandle mapping[] = { static const ButtonHandle mapping[] = {

View File

@ -19,6 +19,9 @@
*/ */
double PerlinNoise2:: double PerlinNoise2::
noise(const LVecBase2d &value) const { 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. // Convert the vector to our local coordinate space.
LVecBase2d vec = _input_xform.xform_point(value); LVecBase2d vec = _input_xform.xform_point(value);
@ -41,9 +44,13 @@ noise(const LVecBase2d &value) const {
double v = fade(y); double v = fade(y);
// Hash coordinates of the 4 square corners (A, B, A + 1, and B + 1) // 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 A = _index[X] + Y;
int B = _index[X + 1] + 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. // and add blended results from 4 corners of square.
double result = double result =
lerp(v, lerp(u, grad(_index[A], x, y), lerp(v, lerp(u, grad(_index[A], x, y),