mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 18:22:55 +02:00
commit
2c4bd7e441
11 changed files with 13 additions and 6 deletions
|
@ -44,7 +44,7 @@ QScriptValue AnimVariantMap::animVariantMapToScriptValue(QScriptEngine* engine,
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Note that we don't do mat4 in Javascript currently, and there's not yet a reason to start now.
|
// Note that we don't do mat4 in Javascript currently, and there's not yet a reason to start now.
|
||||||
assert("AnimVariant::Type" == "valid");
|
assert(QString("AnimVariant::Type") == QString("valid"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (useNames) { // copy only the requested names
|
if (useNames) { // copy only the requested names
|
||||||
|
|
|
@ -74,7 +74,7 @@ void UserInputMapper::registerDevice(InputDevice::Pointer device) {
|
||||||
}
|
}
|
||||||
const auto& deviceID = device->_deviceID;
|
const auto& deviceID = device->_deviceID;
|
||||||
|
|
||||||
int numberOfType = recordDeviceOfType(device->getName());
|
recordDeviceOfType(device->getName());
|
||||||
|
|
||||||
qCDebug(controllers) << "Registered input device <" << device->getName() << "> deviceID = " << deviceID;
|
qCDebug(controllers) << "Registered input device <" << device->getName() << "> deviceID = " << deviceID;
|
||||||
for (const auto& inputMapping : device->getAvailableInputs()) {
|
for (const auto& inputMapping : device->getAvailableInputs()) {
|
||||||
|
@ -266,7 +266,7 @@ void UserInputMapper::update(float deltaTime) {
|
||||||
}
|
}
|
||||||
|
|
||||||
auto standardInputs = getStandardInputs();
|
auto standardInputs = getStandardInputs();
|
||||||
if (_lastStandardStates.size() != standardInputs.size()) {
|
if ((int)_lastStandardStates.size() != standardInputs.size()) {
|
||||||
_lastStandardStates.resize(standardInputs.size());
|
_lastStandardStates.resize(standardInputs.size());
|
||||||
for (auto& lastValue : _lastStandardStates) {
|
for (auto& lastValue : _lastStandardStates) {
|
||||||
lastValue = 0;
|
lastValue = 0;
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace controller {
|
||||||
virtual void apply(float value, 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& value, const Pointer& source) {}
|
virtual void apply(const Pose& value, const Pointer& source) {}
|
||||||
virtual const bool isPose() { return _input.isPose(); }
|
virtual bool isPose() { return _input.isPose(); }
|
||||||
|
|
||||||
virtual bool writeable() const { return true; }
|
virtual bool writeable() const { return true; }
|
||||||
virtual bool readable() const { return true; }
|
virtual bool readable() const { return true; }
|
||||||
|
@ -54,6 +54,7 @@ namespace controller {
|
||||||
|
|
||||||
class LambdaEndpoint : public Endpoint {
|
class LambdaEndpoint : public Endpoint {
|
||||||
public:
|
public:
|
||||||
|
using Endpoint::apply;
|
||||||
LambdaEndpoint(ReadLambda readLambda, WriteLambda writeLambda = [](float) {})
|
LambdaEndpoint(ReadLambda readLambda, WriteLambda writeLambda = [](float) {})
|
||||||
: Endpoint(Input::INVALID_INPUT), _readLambda(readLambda), _writeLambda(writeLambda) { }
|
: Endpoint(Input::INVALID_INPUT), _readLambda(readLambda), _writeLambda(writeLambda) { }
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace controller {
|
||||||
class EndpointConditional : public Conditional {
|
class EndpointConditional : public Conditional {
|
||||||
public:
|
public:
|
||||||
EndpointConditional(Endpoint::Pointer endpoint) : _endpoint(endpoint) {}
|
EndpointConditional(Endpoint::Pointer endpoint) : _endpoint(endpoint) {}
|
||||||
virtual bool satisfied() override { return _endpoint && _endpoint->value() != 0.0; }
|
virtual bool satisfied() override { return _endpoint && _endpoint->value() != 0.0f; }
|
||||||
private:
|
private:
|
||||||
Endpoint::Pointer _endpoint;
|
Endpoint::Pointer _endpoint;
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,6 +17,7 @@ namespace controller {
|
||||||
class AnyEndpoint : public Endpoint {
|
class AnyEndpoint : public Endpoint {
|
||||||
friend class UserInputMapper;
|
friend class UserInputMapper;
|
||||||
public:
|
public:
|
||||||
|
using Endpoint::apply;
|
||||||
AnyEndpoint(Endpoint::List children);
|
AnyEndpoint(Endpoint::List children);
|
||||||
virtual float value() override;
|
virtual float value() override;
|
||||||
virtual void apply(float newValue, const Endpoint::Pointer& source) override;
|
virtual void apply(float newValue, const Endpoint::Pointer& source) override;
|
||||||
|
|
|
@ -17,6 +17,7 @@ namespace controller {
|
||||||
class ArrayEndpoint : public Endpoint {
|
class ArrayEndpoint : public Endpoint {
|
||||||
friend class UserInputMapper;
|
friend class UserInputMapper;
|
||||||
public:
|
public:
|
||||||
|
using Endpoint::apply;
|
||||||
using Pointer = std::shared_ptr<ArrayEndpoint>;
|
using Pointer = std::shared_ptr<ArrayEndpoint>;
|
||||||
ArrayEndpoint() : Endpoint(Input::INVALID_INPUT) { }
|
ArrayEndpoint() : Endpoint(Input::INVALID_INPUT) { }
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
namespace controller {
|
namespace controller {
|
||||||
class CompositeEndpoint : public Endpoint, Endpoint::Pair {
|
class CompositeEndpoint : public Endpoint, Endpoint::Pair {
|
||||||
public:
|
public:
|
||||||
|
using Endpoint::apply;
|
||||||
CompositeEndpoint(Endpoint::Pointer first, Endpoint::Pointer second);
|
CompositeEndpoint(Endpoint::Pointer first, Endpoint::Pointer second);
|
||||||
|
|
||||||
virtual float value() override;
|
virtual float value() override;
|
||||||
|
|
|
@ -19,6 +19,7 @@ namespace controller {
|
||||||
|
|
||||||
class JSEndpoint : public Endpoint {
|
class JSEndpoint : public Endpoint {
|
||||||
public:
|
public:
|
||||||
|
using Endpoint::apply;
|
||||||
JSEndpoint(const QJSValue& callable)
|
JSEndpoint(const QJSValue& callable)
|
||||||
: Endpoint(Input::INVALID_INPUT), _callable(callable) {
|
: Endpoint(Input::INVALID_INPUT), _callable(callable) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ namespace controller {
|
||||||
class ScriptEndpoint : public Endpoint {
|
class ScriptEndpoint : public Endpoint {
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
public:
|
public:
|
||||||
|
using Endpoint::apply;
|
||||||
ScriptEndpoint(const QScriptValue& callable)
|
ScriptEndpoint(const QScriptValue& callable)
|
||||||
: Endpoint(Input::INVALID_INPUT), _callable(callable) {
|
: Endpoint(Input::INVALID_INPUT), _callable(callable) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ public:
|
||||||
|
|
||||||
virtual void apply(float value, 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 (value != 0.0) {
|
if (value != 0.0f) {
|
||||||
_written = true;
|
_written = true;
|
||||||
}
|
}
|
||||||
VirtualEndpoint::apply(value, source);
|
VirtualEndpoint::apply(value, source);
|
||||||
|
|
|
@ -17,6 +17,7 @@ namespace controller {
|
||||||
class InvertFilter : public ScaleFilter {
|
class InvertFilter : public ScaleFilter {
|
||||||
REGISTER_FILTER_CLASS(InvertFilter);
|
REGISTER_FILTER_CLASS(InvertFilter);
|
||||||
public:
|
public:
|
||||||
|
using ScaleFilter::parseParameters;
|
||||||
InvertFilter() : ScaleFilter(-1.0f) {}
|
InvertFilter() : ScaleFilter(-1.0f) {}
|
||||||
|
|
||||||
virtual bool parseParameters(const QJsonArray& parameters) { return true; }
|
virtual bool parseParameters(const QJsonArray& parameters) { return true; }
|
||||||
|
|
Loading…
Reference in a new issue