mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 11:28:03 +02:00
cleanup Leapmotion initialization removes warning
about unused variable
This commit is contained in:
parent
85bfcf0eea
commit
456a3c3739
3 changed files with 21 additions and 20 deletions
|
@ -1722,7 +1722,7 @@ void Application::init() {
|
||||||
_faceplus.init();
|
_faceplus.init();
|
||||||
_visage.init();
|
_visage.init();
|
||||||
|
|
||||||
Leapmotion* leap = Leapmotion::create();
|
Leapmotion::init();
|
||||||
|
|
||||||
// fire off an immediate domain-server check in now that settings are loaded
|
// fire off an immediate domain-server check in now that settings are loaded
|
||||||
NodeList::getInstance()->sendDomainServerCheckIn();
|
NodeList::getInstance()->sendDomainServerCheckIn();
|
||||||
|
|
|
@ -36,27 +36,26 @@ MotionTracker::Index evalJointIndex(bool isRightSide, int finger, int bone) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Leapmotion* Leapmotion::create() {
|
// static
|
||||||
// check that the Leapmotion hasn't been created yet
|
void Leapmotion::init() {
|
||||||
|
DeviceTracker* device = DeviceTracker::getDevice(NAME);
|
||||||
|
|
||||||
|
if (!device) {
|
||||||
|
// create a new Leapmotion and register it
|
||||||
|
Leapmotion* leap = new Leapmotion();
|
||||||
|
DeviceTracker::registerDevice(NAME, leap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
Leapmotion* Leapmotion::getInstance() {
|
||||||
DeviceTracker* device = DeviceTracker::getDevice(NAME);
|
DeviceTracker* device = DeviceTracker::getDevice(NAME);
|
||||||
if (!device) {
|
if (!device) {
|
||||||
// create a new Leapmotion
|
// create a new Leapmotion and register it
|
||||||
Leapmotion* leap = new Leapmotion();
|
device = new Leapmotion();
|
||||||
|
DeviceTracker::registerDevice(NAME, device);
|
||||||
// register it
|
|
||||||
DeviceTracker::registerDevice(NAME, leap);
|
|
||||||
|
|
||||||
return leap;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Leapmotion* leap = dynamic_cast< Leapmotion* > (device);
|
|
||||||
if (leap) {
|
|
||||||
return leap;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
return dynamic_cast< Leapmotion* > (device);
|
||||||
}
|
}
|
||||||
|
|
||||||
Leapmotion::Leapmotion() :
|
Leapmotion::Leapmotion() :
|
||||||
|
|
|
@ -25,8 +25,10 @@ class Leapmotion : public MotionTracker {
|
||||||
public:
|
public:
|
||||||
static const Name NAME;
|
static const Name NAME;
|
||||||
|
|
||||||
|
static void init();
|
||||||
|
|
||||||
/// Leapmotion MotionTracker factory
|
/// Leapmotion MotionTracker factory
|
||||||
static Leapmotion* create();
|
static Leapmotion* getInstance();
|
||||||
|
|
||||||
bool isActive() const { return _active; }
|
bool isActive() const { return _active; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue