mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Merge branch 'controllers' of https://github.com/highfidelity/hifi into controllers
This commit is contained in:
commit
a0104884f5
22 changed files with 107 additions and 67 deletions
|
@ -33,12 +33,17 @@
|
||||||
var MIN_POINT_DISTANCE = 0.01;
|
var MIN_POINT_DISTANCE = 0.01;
|
||||||
var STROKE_WIDTH = 0.02;
|
var STROKE_WIDTH = 0.02;
|
||||||
|
|
||||||
|
var TRIGGER_CONTROLS = [
|
||||||
|
Controller.Standard.LT,
|
||||||
|
Controller.Standard.RT,
|
||||||
|
];
|
||||||
|
|
||||||
this.setRightHand = function () {
|
this.setRightHand = function () {
|
||||||
this.hand = 'RIGHT';
|
this.hand = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setLeftHand = function () {
|
this.setLeftHand = function () {
|
||||||
this.hand = 'LEFT';
|
this.hand = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.startNearGrab = function () {
|
this.startNearGrab = function () {
|
||||||
|
@ -46,11 +51,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.toggleWithTriggerPressure = function () {
|
this.toggleWithTriggerPressure = function () {
|
||||||
var handClickString = this.whichHand + "_HAND_CLICK";
|
this.triggerValue = Controller.getValue(TRIGGER_CONTROLS[this.whichHand]);
|
||||||
|
|
||||||
var handClick = Controller.findAction(handClickString);
|
|
||||||
|
|
||||||
this.triggerValue = Controller.getActionValue(handClick);
|
|
||||||
if (this.triggerValue < DISABLE_SPRAY_THRESHOLD && this.spraying === true) {
|
if (this.triggerValue < DISABLE_SPRAY_THRESHOLD && this.spraying === true) {
|
||||||
this.spraying = false;
|
this.spraying = false;
|
||||||
this.disableStream();
|
this.disableStream();
|
||||||
|
|
|
@ -1,28 +1,53 @@
|
||||||
{
|
{
|
||||||
"name": "Keyboard/Mouse to Actions",
|
"name": "Keyboard/Mouse to Actions",
|
||||||
"channels": [
|
"channels": [
|
||||||
{ "from": "Keyboard.A", "when": "Keyboard.Shift", "to": "Actions.LATERAL_LEFT" },
|
{ "from": "Keyboard.A", "when": "Keyboard.Shift", "to": "Actions.LATERAL_LEFT" },
|
||||||
{ "from": "Keyboard.D", "when": "Keyboard.Shift", "to": "Actions.LATERAL_RIGHT" },
|
{ "from": "Keyboard.D", "when": "Keyboard.Shift", "to": "Actions.LATERAL_RIGHT" },
|
||||||
{ "from": "Keyboard.A", "when": "Keyboard.RightMouseClick", "to": "Actions.LATERAL_LEFT" },
|
{ "from": "Keyboard.A", "when": "Keyboard.RightMouseClick", "to": "Actions.LATERAL_LEFT" },
|
||||||
{ "from": "Keyboard.D", "when": "Keyboard.RightMouseClick", "to": "Actions.LATERAL_RIGHT" },
|
{ "from": "Keyboard.D", "when": "Keyboard.RightMouseClick", "to": "Actions.LATERAL_RIGHT" },
|
||||||
|
{ "from": "Keyboard.E", "when": "Keyboard.Shift", "to": "Actions.BOOM_IN", "filters": [ { "type": "scale", "scale": 0.05 } ] },
|
||||||
|
{ "from": "Keyboard.C", "when": "Keyboard.Shift", "to": "Actions.BOOM_OUT", "filters": [ { "type": "scale", "scale": 0.05 } ] },
|
||||||
|
{ "from": "Keyboard.S", "when": "Keyboard.Shift", "to": "Actions.PITCH_DOWN" },
|
||||||
|
{ "from": "Keyboard.W", "when": "Keyboard.Shift", "to": "Actions.PITCH_UP" },
|
||||||
|
|
||||||
{ "from": "Keyboard.W", "to": "Actions.LONGITUDINAL_FORWARD" },
|
{ "from": "Keyboard.W", "to": "Actions.LONGITUDINAL_FORWARD" },
|
||||||
{ "from": "Keyboard.S", "to": "Actions.LONGITUDINAL_BACKWARD" },
|
{ "from": "Keyboard.S", "to": "Actions.LONGITUDINAL_BACKWARD" },
|
||||||
{ "from": "Keyboard.A", "to": "Actions.YAW_LEFT" },
|
{ "from": "Keyboard.A", "to": "Actions.YAW_LEFT" },
|
||||||
{ "from": "Keyboard.D", "to": "Actions.YAW_RIGHT" },
|
{ "from": "Keyboard.D", "to": "Actions.YAW_RIGHT" },
|
||||||
{ "from": "Keyboard.C", "to": "Actions.VERTICAL_DOWN" },
|
{ "from": "Keyboard.C", "to": "Actions.VERTICAL_DOWN" },
|
||||||
{ "from": "Keyboard.E", "to": "Actions.VERTICAL_UP" },
|
{ "from": "Keyboard.E", "to": "Actions.VERTICAL_UP" },
|
||||||
|
|
||||||
|
{ "from": "Keyboard.Left", "when": "Keyboard.RightMouseClick", "to": "Actions.LATERAL_LEFT" },
|
||||||
|
{ "from": "Keyboard.Right", "when": "Keyboard.RightMouseClick", "to": "Actions.LATERAL_RIGHT" },
|
||||||
|
{ "from": "Keyboard.Left", "when": "Keyboard.Shift", "to": "Actions.LATERAL_LEFT" },
|
||||||
|
{ "from": "Keyboard.Right", "when": "Keyboard.Shift", "to": "Actions.LATERAL_RIGHT" },
|
||||||
|
{ "from": "Keyboard.Down", "when": "Keyboard.Shift", "to": "Actions.PITCH_DOWN" },
|
||||||
|
{ "from": "Keyboard.Up", "when": "Keyboard.Shift", "to": "Actions.PITCH_UP" },
|
||||||
|
|
||||||
{ "from": "Keyboard.Up", "to": "Actions.LONGITUDINAL_FORWARD" },
|
{ "from": "Keyboard.Up", "to": "Actions.LONGITUDINAL_FORWARD" },
|
||||||
{ "from": "Keyboard.Down", "to": "Actions.LONGITUDINAL_BACKWARD" },
|
{ "from": "Keyboard.Down", "to": "Actions.LONGITUDINAL_BACKWARD" },
|
||||||
{ "from": "Keyboard.Left", "to": "Actions.YAW_LEFT" },
|
{ "from": "Keyboard.Left", "to": "Actions.YAW_LEFT" },
|
||||||
{ "from": "Keyboard.Right", "to": "Actions.YAW_RIGHT" },
|
{ "from": "Keyboard.Right", "to": "Actions.YAW_RIGHT" },
|
||||||
{ "from": "Keyboard.PgDown", "to": "Actions.VERTICAL_DOWN" },
|
{ "from": "Keyboard.PgDown", "to": "Actions.VERTICAL_DOWN" },
|
||||||
{ "from": "Keyboard.PgUp", "to": "Actions.VERTICAL_UP" },
|
{ "from": "Keyboard.PgUp", "to": "Actions.VERTICAL_UP" },
|
||||||
|
|
||||||
{ "from": "Keyboard.MouseMoveLeft", "when": "Keyboard.RightMouseClick", "to": "Actions.YAW_LEFT" },
|
{ "from": "Keyboard.MouseMoveLeft", "when": "Keyboard.RightMouseClick", "to": "Actions.YAW_LEFT" },
|
||||||
{ "from": "Keyboard.MouseMoveRight", "when": "Keyboard.RightMouseClick", "to": "Actions.YAW_RIGHT" },
|
{ "from": "Keyboard.MouseMoveRight", "when": "Keyboard.RightMouseClick", "to": "Actions.YAW_RIGHT" },
|
||||||
{ "from": "Keyboard.MouseMoveUp", "when": "Keyboard.RightMouseClick", "to": "Actions.PITCH_UP" },
|
{ "from": "Keyboard.MouseMoveUp", "when": "Keyboard.RightMouseClick", "to": "Actions.PITCH_UP" },
|
||||||
{ "from": "Keyboard.MouseMoveDown", "when": "Keyboard.RightMouseClick", "to": "Actions.PITCH_DOWN" }
|
{ "from": "Keyboard.MouseMoveDown", "when": "Keyboard.RightMouseClick", "to": "Actions.PITCH_DOWN" },
|
||||||
|
|
||||||
|
{ "from": "Keyboard.TouchpadDown", "to": "Actions.PITCH_DOWN" },
|
||||||
|
{ "from": "Keyboard.TouchpadUp", "to": "Actions.PITCH_UP" },
|
||||||
|
{ "from": "Keyboard.TouchpadLeft", "to": "Actions.YAW_LEFT" },
|
||||||
|
{ "from": "Keyboard.TouchpadRight", "to": "Actions.YAW_RIGHT" },
|
||||||
|
|
||||||
|
{ "from": "Keyboard.MouseWheelUp", "to": "Actions.LATERAL_RIGHT" },
|
||||||
|
{ "from": "Keyboard.MouseWheelDown", "to": "Actions.LATERAL_LEFT" },
|
||||||
|
{ "from": "Keyboard.MouseWheelLeft", "to": "Actions.BOOM_OUT", "filters": [ { "type": "scale", "scale": 0.02 } ]},
|
||||||
|
{ "from": "Keyboard.MouseWheelRight", "to": "Actions.BOOM_IN", "filters": [ { "type": "scale", "scale": 0.02 } ]},
|
||||||
|
|
||||||
|
{ "from": "Keyboard.Space", "to": "Actions.SHIFT" },
|
||||||
|
{ "from": "Keyboard.R", "to": "Actions.ACTION1" },
|
||||||
|
{ "from": "Keyboard.T", "to": "Actions.ACTION2" }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -366,7 +366,7 @@ const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars
|
||||||
if (offsetLength > MIN_HIPS_OFFSET_LENGTH) {
|
if (offsetLength > MIN_HIPS_OFFSET_LENGTH) {
|
||||||
// but only if offset is long enough
|
// but only if offset is long enough
|
||||||
float scaleFactor = ((offsetLength - MIN_HIPS_OFFSET_LENGTH) / offsetLength);
|
float scaleFactor = ((offsetLength - MIN_HIPS_OFFSET_LENGTH) / offsetLength);
|
||||||
_relativePoses[0].trans = underPoses[0].trans + scaleFactor * _hipsOffset;
|
_relativePoses[_hipsIndex].trans = underPoses[_hipsIndex].trans + scaleFactor * _hipsOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
solveWithCyclicCoordinateDescent(targets);
|
solveWithCyclicCoordinateDescent(targets);
|
||||||
|
@ -758,8 +758,10 @@ void AnimInverseKinematics::setSkeletonInternal(AnimSkeleton::ConstPointer skele
|
||||||
if (skeleton) {
|
if (skeleton) {
|
||||||
initConstraints();
|
initConstraints();
|
||||||
_headIndex = _skeleton->nameToJointIndex("Head");
|
_headIndex = _skeleton->nameToJointIndex("Head");
|
||||||
|
_hipsIndex = _skeleton->nameToJointIndex("Hips");
|
||||||
} else {
|
} else {
|
||||||
clearConstraints();
|
clearConstraints();
|
||||||
_headIndex = -1;
|
_headIndex = -1;
|
||||||
|
_hipsIndex = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,7 @@ protected:
|
||||||
|
|
||||||
// experimental data for moving hips during IK
|
// experimental data for moving hips during IK
|
||||||
int _headIndex = -1;
|
int _headIndex = -1;
|
||||||
|
int _hipsIndex = -1;
|
||||||
glm::vec3 _hipsOffset = Vectors::ZERO;
|
glm::vec3 _hipsOffset = Vectors::ZERO;
|
||||||
|
|
||||||
// _maxTargetIndex is tracked to help optimize the recalculation of absolute poses
|
// _maxTargetIndex is tracked to help optimize the recalculation of absolute poses
|
||||||
|
|
|
@ -529,7 +529,7 @@ bool UserInputMapper::applyRoute(const Route::Pointer& route, bool force) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// no filters yet for pose
|
// no filters yet for pose
|
||||||
destination->apply(value, Pose(), source);
|
destination->apply(value, source);
|
||||||
} else {
|
} else {
|
||||||
// Fetch the value, may have been overriden by previous loopback routes
|
// Fetch the value, may have been overriden by previous loopback routes
|
||||||
float value = getValue(source);
|
float value = getValue(source);
|
||||||
|
@ -546,7 +546,7 @@ bool UserInputMapper::applyRoute(const Route::Pointer& route, bool force) {
|
||||||
qCDebug(controllers) << "Filtered value was " << value;
|
qCDebug(controllers) << "Filtered value was " << value;
|
||||||
}
|
}
|
||||||
|
|
||||||
destination->apply(value, 0, source);
|
destination->apply(value, source);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,9 +37,9 @@ namespace controller {
|
||||||
|
|
||||||
Endpoint(const Input& input) : _input(input) {}
|
Endpoint(const Input& input) : _input(input) {}
|
||||||
virtual float value() = 0;
|
virtual float value() = 0;
|
||||||
virtual void apply(float newValue, float oldValue, const Pointer& source) = 0;
|
virtual void apply(float value, const Pointer& source) = 0;
|
||||||
virtual Pose pose() { return Pose(); }
|
virtual Pose pose() { return Pose(); }
|
||||||
virtual void apply(const Pose& newValue, const Pose& oldValue, const Pointer& source) {}
|
virtual void apply(const Pose& value, const Pointer& source) {}
|
||||||
virtual const bool isPose() { return _input.isPose(); }
|
virtual const bool isPose() { return _input.isPose(); }
|
||||||
|
|
||||||
virtual bool writeable() const { return true; }
|
virtual bool writeable() const { return true; }
|
||||||
|
@ -58,7 +58,7 @@ namespace controller {
|
||||||
: Endpoint(Input::INVALID_INPUT), _readLambda(readLambda), _writeLambda(writeLambda) { }
|
: Endpoint(Input::INVALID_INPUT), _readLambda(readLambda), _writeLambda(writeLambda) { }
|
||||||
|
|
||||||
virtual float value() override { return _readLambda(); }
|
virtual float value() override { return _readLambda(); }
|
||||||
virtual void apply(float newValue, float oldValue, const Pointer& source) override { _writeLambda(newValue); }
|
virtual void apply(float value, const Pointer& source) override { _writeLambda(value); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ReadLambda _readLambda;
|
ReadLambda _readLambda;
|
||||||
|
@ -73,11 +73,11 @@ namespace controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual float value() override { return _currentValue; }
|
virtual float value() override { return _currentValue; }
|
||||||
virtual void apply(float newValue, float oldValue, const Pointer& source) override { _currentValue = newValue; }
|
virtual void apply(float value, const Pointer& source) override { _currentValue = value; }
|
||||||
|
|
||||||
virtual Pose pose() override { return _currentPose; }
|
virtual Pose pose() override { return _currentPose; }
|
||||||
virtual void apply(const Pose& newValue, const Pose& oldValue, const Pointer& source) override {
|
virtual void apply(const Pose& value, const Pointer& source) override {
|
||||||
_currentPose = newValue;
|
_currentPose = value;
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
float _currentValue { 0.0f };
|
float _currentValue { 0.0f };
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
using namespace controller;
|
using namespace controller;
|
||||||
|
|
||||||
void ActionEndpoint::apply(float newValue, float oldValue, const Pointer& source) {
|
void ActionEndpoint::apply(float newValue, const Pointer& source) {
|
||||||
_currentValue += newValue;
|
_currentValue += newValue;
|
||||||
if (_input != Input::INVALID_INPUT) {
|
if (_input != Input::INVALID_INPUT) {
|
||||||
auto userInputMapper = DependencyManager::get<UserInputMapper>();
|
auto userInputMapper = DependencyManager::get<UserInputMapper>();
|
||||||
|
@ -22,8 +22,8 @@ void ActionEndpoint::apply(float newValue, float oldValue, const Pointer& source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionEndpoint::apply(const Pose& newValue, const Pose& oldValue, const Pointer& source) {
|
void ActionEndpoint::apply(const Pose& value, const Pointer& source) {
|
||||||
_currentPose = newValue;
|
_currentPose = value;
|
||||||
if (!_currentPose.isValid()) {
|
if (!_currentPose.isValid()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,10 +24,10 @@ public:
|
||||||
ActionEndpoint(const Input& id = Input::INVALID_INPUT) : Endpoint(id) { }
|
ActionEndpoint(const Input& id = Input::INVALID_INPUT) : Endpoint(id) { }
|
||||||
|
|
||||||
virtual float value() override { return _currentValue; }
|
virtual float value() override { return _currentValue; }
|
||||||
virtual void apply(float newValue, float oldValue, const Pointer& source) override;
|
virtual void apply(float newValue, const Pointer& source) override;
|
||||||
|
|
||||||
virtual Pose pose() override { return _currentPose; }
|
virtual Pose pose() override { return _currentPose; }
|
||||||
virtual void apply(const Pose& newValue, const Pose& oldValue, const Pointer& source) override;
|
virtual void apply(const Pose& value, const Pointer& source) override;
|
||||||
|
|
||||||
virtual void reset() override;
|
virtual void reset() override;
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ float AnyEndpoint::value() {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnyEndpoint::apply(float newValue, float oldValue, const Endpoint::Pointer& source) {
|
void AnyEndpoint::apply(float newValue, const Endpoint::Pointer& source) {
|
||||||
qFatal("AnyEndpoint is read only");
|
qFatal("AnyEndpoint is read only");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ class AnyEndpoint : public Endpoint {
|
||||||
public:
|
public:
|
||||||
AnyEndpoint(Endpoint::List children);
|
AnyEndpoint(Endpoint::List children);
|
||||||
virtual float value() override;
|
virtual float value() override;
|
||||||
virtual void apply(float newValue, float oldValue, const Endpoint::Pointer& source) override;
|
virtual void apply(float newValue, const Endpoint::Pointer& source) override;
|
||||||
virtual bool writeable() const override;
|
virtual bool writeable() const override;
|
||||||
virtual bool readable() const override;
|
virtual bool readable() const override;
|
||||||
|
|
||||||
|
|
|
@ -24,10 +24,10 @@ public:
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void apply(float newValue, float oldValue, const Endpoint::Pointer& source) override {
|
virtual void apply(float value, const Endpoint::Pointer& source) override {
|
||||||
for (auto& child : _children) {
|
for (auto& child : _children) {
|
||||||
if (child->writeable()) {
|
if (child->writeable()) {
|
||||||
child->apply(newValue, oldValue, source);
|
child->apply(value, source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ float CompositeEndpoint::value() {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompositeEndpoint::apply(float newValue, float oldValue, const Pointer& source) {
|
void CompositeEndpoint::apply(float newValue, const Pointer& source) {
|
||||||
// Composites are read only
|
// Composites are read only
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace controller {
|
||||||
CompositeEndpoint(Endpoint::Pointer first, Endpoint::Pointer second);
|
CompositeEndpoint(Endpoint::Pointer first, Endpoint::Pointer second);
|
||||||
|
|
||||||
virtual float value() override;
|
virtual float value() override;
|
||||||
virtual void apply(float newValue, float oldValue, const Pointer& source) override;
|
virtual void apply(float newValue, const Pointer& source) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,9 +22,9 @@ public:
|
||||||
|
|
||||||
virtual float value() override;
|
virtual float value() override;
|
||||||
// FIXME need support for writing back to vibration / force feedback effects
|
// FIXME need support for writing back to vibration / force feedback effects
|
||||||
virtual void apply(float newValue, float oldValue, const Pointer& source) override {}
|
virtual void apply(float newValue, const Pointer& source) override {}
|
||||||
virtual Pose pose() override;
|
virtual Pose pose() override;
|
||||||
virtual void apply(const Pose& newValue, const Pose& oldValue, const Pointer& source) override { }
|
virtual void apply(const Pose& value, const Pointer& source) override { }
|
||||||
|
|
||||||
virtual bool writeable() const { return false; }
|
virtual bool writeable() const { return false; }
|
||||||
virtual bool readable() const { return !_read; }
|
virtual bool readable() const { return !_read; }
|
||||||
|
|
|
@ -28,7 +28,7 @@ public:
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void apply(float newValue, float oldValue, const Pointer& source) {
|
virtual void apply(float newValue, const Pointer& source) {
|
||||||
_callable.call(QJSValueList({ QJSValue(newValue) }));
|
_callable.call(QJSValueList({ QJSValue(newValue) }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,22 +26,21 @@ void ScriptEndpoint::updateValue() {
|
||||||
_lastValueRead = (float)_callable.call().toNumber();
|
_lastValueRead = (float)_callable.call().toNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEndpoint::apply(float newValue, float oldValue, const Pointer& source) {
|
void ScriptEndpoint::apply(float value, const Pointer& source) {
|
||||||
if (newValue == _lastValueWritten) {
|
if (value == _lastValueWritten) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
internalApply(newValue, oldValue, source->getInput().getID());
|
internalApply(value, source->getInput().getID());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEndpoint::internalApply(float newValue, float oldValue, int sourceID) {
|
void ScriptEndpoint::internalApply(float value, int sourceID) {
|
||||||
_lastValueWritten = newValue;
|
_lastValueWritten = value;
|
||||||
if (QThread::currentThread() != thread()) {
|
if (QThread::currentThread() != thread()) {
|
||||||
QMetaObject::invokeMethod(this, "internalApply", Qt::QueuedConnection,
|
QMetaObject::invokeMethod(this, "internalApply", Qt::QueuedConnection,
|
||||||
Q_ARG(float, newValue),
|
Q_ARG(float, value),
|
||||||
Q_ARG(float, oldValue),
|
|
||||||
Q_ARG(int, sourceID));
|
Q_ARG(int, sourceID));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_callable.call(QScriptValue(),
|
_callable.call(QScriptValue(),
|
||||||
QScriptValueList({ QScriptValue(newValue), QScriptValue(oldValue), QScriptValue(sourceID) }));
|
QScriptValueList({ QScriptValue(value), QScriptValue(sourceID) }));
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,11 +24,11 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual float value();
|
virtual float value();
|
||||||
virtual void apply(float newValue, float oldValue, const Pointer& source);
|
virtual void apply(float newValue, const Pointer& source);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Q_INVOKABLE void updateValue();
|
Q_INVOKABLE void updateValue();
|
||||||
Q_INVOKABLE virtual void internalApply(float newValue, float oldValue, int sourceID);
|
Q_INVOKABLE virtual void internalApply(float newValue, int sourceID);
|
||||||
private:
|
private:
|
||||||
QScriptValue _callable;
|
QScriptValue _callable;
|
||||||
float _lastValueRead { 0.0f };
|
float _lastValueRead { 0.0f };
|
||||||
|
|
|
@ -20,8 +20,8 @@ public:
|
||||||
virtual bool writeable() const override { return !_written; }
|
virtual bool writeable() const override { return !_written; }
|
||||||
virtual bool readable() const override { return !_read; }
|
virtual bool readable() const override { return !_read; }
|
||||||
virtual void reset() override {
|
virtual void reset() override {
|
||||||
apply(0.0f, 0.0f, Endpoint::Pointer());
|
apply(0.0f, Endpoint::Pointer());
|
||||||
apply(Pose(), Pose(), Endpoint::Pointer());
|
apply(Pose(), Endpoint::Pointer());
|
||||||
_written = _read = false;
|
_written = _read = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,12 +30,12 @@ public:
|
||||||
return VirtualEndpoint::value();
|
return VirtualEndpoint::value();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void apply(float newValue, float oldValue, const Pointer& source) override {
|
virtual void apply(float value, const Pointer& source) override {
|
||||||
// For standard endpoints, the first NON-ZERO write counts.
|
// For standard endpoints, the first NON-ZERO write counts.
|
||||||
if (newValue != 0.0) {
|
if (value != 0.0) {
|
||||||
_written = true;
|
_written = true;
|
||||||
}
|
}
|
||||||
VirtualEndpoint::apply(newValue, oldValue, source);
|
VirtualEndpoint::apply(value, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Pose pose() override {
|
virtual Pose pose() override {
|
||||||
|
@ -43,11 +43,11 @@ public:
|
||||||
return VirtualEndpoint::pose();
|
return VirtualEndpoint::pose();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void apply(const Pose& newValue, const Pose& oldValue, const Pointer& source) override {
|
virtual void apply(const Pose& value, const Pointer& source) override {
|
||||||
if (newValue != Pose()) {
|
if (value != Pose()) {
|
||||||
_written = true;
|
_written = true;
|
||||||
}
|
}
|
||||||
VirtualEndpoint::apply(newValue, oldValue, source);
|
VirtualEndpoint::apply(value, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -177,14 +177,26 @@ void SixenseManager::update(float deltaTime, bool jointsCaptured) {
|
||||||
auto userInputMapper = DependencyManager::get<controller::UserInputMapper>();
|
auto userInputMapper = DependencyManager::get<controller::UserInputMapper>();
|
||||||
|
|
||||||
if (sixenseGetNumActiveControllers() == 0) {
|
if (sixenseGetNumActiveControllers() == 0) {
|
||||||
_poseStateMap.clear();
|
if (_hydrasConnected) {
|
||||||
_collectedSamples.clear();
|
qCDebug(inputplugins) << "hydra disconnected" << _badDataCount;
|
||||||
|
if (_badDataCount++ < _allowedBadDataCount) { // gotta get some no-active in a row before we shut things down
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_hydrasConnected = false;
|
||||||
|
if (_deviceID != 0) {
|
||||||
|
userInputMapper->removeDevice(_deviceID);
|
||||||
|
_deviceID = 0;
|
||||||
|
_poseStateMap.clear();
|
||||||
|
_collectedSamples.clear();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PerformanceTimer perfTimer("sixense");
|
PerformanceTimer perfTimer("sixense");
|
||||||
if (!_hydrasConnected) {
|
if (!_hydrasConnected) {
|
||||||
_hydrasConnected = true;
|
_hydrasConnected = true;
|
||||||
|
_badDataCount = 0;
|
||||||
UserActivityLogger::getInstance().connectedDevice("spatial_controller", "hydra");
|
UserActivityLogger::getInstance().connectedDevice("spatial_controller", "hydra");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -588,6 +600,7 @@ void SixenseManager::saveSettings() const {
|
||||||
settings.setVec3Value(QString("avatarPosition"), _avatarPosition);
|
settings.setVec3Value(QString("avatarPosition"), _avatarPosition);
|
||||||
settings.setQuatValue(QString("avatarRotation"), _avatarRotation);
|
settings.setQuatValue(QString("avatarRotation"), _avatarRotation);
|
||||||
settings.setValue(QString("reachLength"), QVariant(_reachLength));
|
settings.setValue(QString("reachLength"), QVariant(_reachLength));
|
||||||
|
settings.setValue(QString("allowedHydraFailures"), 120);
|
||||||
}
|
}
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
@ -600,6 +613,7 @@ void SixenseManager::loadSettings() {
|
||||||
settings.getVec3ValueIfValid(QString("avatarPosition"), _avatarPosition);
|
settings.getVec3ValueIfValid(QString("avatarPosition"), _avatarPosition);
|
||||||
settings.getQuatValueIfValid(QString("avatarRotation"), _avatarRotation);
|
settings.getQuatValueIfValid(QString("avatarRotation"), _avatarRotation);
|
||||||
settings.getFloatValueIfValid(QString("reachLength"), _reachLength);
|
settings.getFloatValueIfValid(QString("reachLength"), _reachLength);
|
||||||
|
_allowedBadDataCount = settings.value(QString("allowedHydraFailures"), 120).toInt();
|
||||||
}
|
}
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,6 +108,8 @@ private:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool _hydrasConnected;
|
bool _hydrasConnected;
|
||||||
|
int _badDataCount;
|
||||||
|
int _allowedBadDataCount;
|
||||||
|
|
||||||
static const QString NAME;
|
static const QString NAME;
|
||||||
static const QString HYDRA_ID_STRING;
|
static const QString HYDRA_ID_STRING;
|
||||||
|
|
|
@ -8,6 +8,4 @@ set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "Tests/manual-tests/")
|
||||||
# link in the shared libraries
|
# link in the shared libraries
|
||||||
link_hifi_libraries(render-utils gpu shared)
|
link_hifi_libraries(render-utils gpu shared)
|
||||||
|
|
||||||
message(${PROJECT_BINARY_DIR})
|
|
||||||
|
|
||||||
copy_dlls_beside_windows_executable()
|
copy_dlls_beside_windows_executable()
|
||||||
|
|
|
@ -17,6 +17,4 @@ include_directories("${PROJECT_BINARY_DIR}/../../libraries/render-utils/")
|
||||||
include_directories("${PROJECT_BINARY_DIR}/../../libraries/entities-renderer/")
|
include_directories("${PROJECT_BINARY_DIR}/../../libraries/entities-renderer/")
|
||||||
include_directories("${PROJECT_BINARY_DIR}/../../libraries/model/")
|
include_directories("${PROJECT_BINARY_DIR}/../../libraries/model/")
|
||||||
|
|
||||||
message(${PROJECT_BINARY_DIR})
|
|
||||||
|
|
||||||
copy_dlls_beside_windows_executable()
|
copy_dlls_beside_windows_executable()
|
||||||
|
|
Loading…
Reference in a new issue