mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 16:13:28 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into tablet-ui-edit-js
This commit is contained in:
commit
b938579598
4 changed files with 36 additions and 8 deletions
|
@ -163,7 +163,7 @@ void ShapeEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBit
|
|||
// This value specifes how the shape should be treated by physics calculations.
|
||||
// For now, all polys will act as spheres
|
||||
ShapeType ShapeEntityItem::getShapeType() const {
|
||||
return (_shape == entity::Shape::Cube) ? SHAPE_TYPE_BOX : SHAPE_TYPE_SPHERE;
|
||||
return (_shape == entity::Shape::Cube) ? SHAPE_TYPE_BOX : SHAPE_TYPE_ELLIPSOID;
|
||||
}
|
||||
|
||||
void ShapeEntityItem::setColor(const rgbColor& value) {
|
||||
|
|
|
@ -256,9 +256,20 @@ const btCollisionShape* ShapeFactory::createShapeFromInfo(const ShapeInfo& info)
|
|||
}
|
||||
break;
|
||||
case SHAPE_TYPE_SPHERE: {
|
||||
glm::vec3 halfExtents = info.getHalfExtents();
|
||||
float radius = glm::max(halfExtents.x, glm::max(halfExtents.y, halfExtents.z));
|
||||
shape = new btSphereShape(radius);
|
||||
}
|
||||
break;
|
||||
case SHAPE_TYPE_ELLIPSOID: {
|
||||
glm::vec3 halfExtents = info.getHalfExtents();
|
||||
float radius = halfExtents.x;
|
||||
if (radius == halfExtents.y && radius == halfExtents.z) {
|
||||
const float MIN_RADIUS = 0.001f;
|
||||
const float MIN_RELATIVE_SPHERICAL_ERROR = 0.001f;
|
||||
if (radius > MIN_RADIUS
|
||||
&& fabsf(radius - halfExtents.y) / radius < MIN_RELATIVE_SPHERICAL_ERROR
|
||||
&& fabsf(radius - halfExtents.z) / radius < MIN_RELATIVE_SPHERICAL_ERROR) {
|
||||
// close enough to true sphere
|
||||
shape = new btSphereShape(radius);
|
||||
} else {
|
||||
ShapeInfo::PointList points;
|
||||
|
|
|
@ -45,7 +45,8 @@ enum ShapeType {
|
|||
SHAPE_TYPE_COMPOUND,
|
||||
SHAPE_TYPE_SIMPLE_HULL,
|
||||
SHAPE_TYPE_SIMPLE_COMPOUND,
|
||||
SHAPE_TYPE_STATIC_MESH
|
||||
SHAPE_TYPE_STATIC_MESH,
|
||||
SHAPE_TYPE_ELLIPSOID
|
||||
};
|
||||
|
||||
class ShapeInfo {
|
||||
|
|
|
@ -51,7 +51,9 @@ const OUTPUT_DEVICE_SETTING = "audio_output_device";
|
|||
var selectedInputMenu = "";
|
||||
var selectedOutputMenu = "";
|
||||
|
||||
var audioDevicesList = [];
|
||||
function setupAudioMenus() {
|
||||
removeAudioMenus();
|
||||
Menu.addSeparator("Audio", "Input Audio Device");
|
||||
|
||||
var inputDeviceSetting = Settings.getValue(INPUT_DEVICE_SETTING);
|
||||
|
@ -67,11 +69,12 @@ function setupAudioMenus() {
|
|||
var thisDeviceSelected = (inputDevices[i] == selectedInputDevice);
|
||||
var menuItem = "Use " + inputDevices[i] + " for Input";
|
||||
Menu.addMenuItem({
|
||||
menuName: "Audio",
|
||||
menuItemName: menuItem,
|
||||
isCheckable: true,
|
||||
isChecked: thisDeviceSelected
|
||||
});
|
||||
menuName: "Audio",
|
||||
menuItemName: menuItem,
|
||||
isCheckable: true,
|
||||
isChecked: thisDeviceSelected
|
||||
});
|
||||
audioDevicesList.push(menuItem);
|
||||
if (thisDeviceSelected) {
|
||||
selectedInputMenu = menuItem;
|
||||
}
|
||||
|
@ -97,12 +100,24 @@ function setupAudioMenus() {
|
|||
isCheckable: true,
|
||||
isChecked: thisDeviceSelected
|
||||
});
|
||||
audioDevicesList.push(menuItem);
|
||||
if (thisDeviceSelected) {
|
||||
selectedOutputMenu = menuItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function removeAudioMenus() {
|
||||
Menu.removeSeparator("Audio", "Input Audio Device");
|
||||
Menu.removeSeparator("Audio", "Output Audio Device");
|
||||
|
||||
for (var index = 0; index < audioDevicesList.length; index++) {
|
||||
Menu.removeMenuItem("Audio", audioDevicesList[index]);
|
||||
}
|
||||
|
||||
audioDevicesList = [];
|
||||
}
|
||||
|
||||
function onDevicechanged() {
|
||||
print("audio devices changed, removing Audio > Devices menu...");
|
||||
Menu.removeMenu("Audio > Devices");
|
||||
|
@ -218,6 +233,7 @@ Script.update.connect(checkHMDAudio);
|
|||
|
||||
Script.scriptEnding.connect(function () {
|
||||
restoreAudio();
|
||||
removeAudioMenus();
|
||||
Menu.menuItemEvent.disconnect(menuItemEvent);
|
||||
Script.update.disconnect(checkHMDAudio);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue