add extra debugging to the kinect plugin

This commit is contained in:
ZappoMan 2017-03-28 18:42:15 -07:00
parent a659b73edf
commit 80fb7bc287
2 changed files with 22 additions and 2 deletions

View file

@ -239,6 +239,14 @@ void KinectPlugin::init() {
auto preference = new CheckPreference(KINECT_PLUGIN, "Enabled", getter, setter);
preferences->addPreference(preference);
}
{
auto debugGetter = [this]()->bool { return _enabled; };
auto debugSetter = [this](bool value) {
_debug = value; saveSettings();
};
auto preference = new CheckPreference(KINECT_PLUGIN, "Extra Debugging", debugGetter, debugSetter);
preferences->addPreference(preference);
}
}
bool KinectPlugin::isSupported() const {
@ -389,9 +397,11 @@ void KinectPlugin::ProcessBody(INT64 time, int bodyCount, IBody** bodies) {
if (SUCCEEDED(hr)) {
auto jointCount = _countof(joints);
//qDebug() << __FUNCTION__ << "nBodyCount:" << nBodyCount << "body:" << i << "jointCount:" << jointCount;
if (_debug) {
qDebug() << __FUNCTION__ << "nBodyCount:" << nBodyCount << "body:" << i << "jointCount:" << jointCount;
}
for (int j = 0; j < jointCount; ++j) {
//QString jointName = kinectJointNames[joints[j].JointType];
glm::vec3 jointPosition { joints[j].Position.X,
joints[j].Position.Y,
@ -404,6 +414,14 @@ void KinectPlugin::ProcessBody(INT64 time, int bodyCount, IBody** bodies) {
jointOrientations[j].Orientation.y,
jointOrientations[j].Orientation.z };
if (_debug) {
QString jointName = kinectJointNames[joints[j].JointType];
qDebug() << __FUNCTION__ << "joint[" << j << "]:" << jointName
<< "position:" << jointPosition
<< "orientation:" << jointOrientation
<< "isTracked:" << joints[j].TrackingState != TrackingState_NotTracked;
}
// filling in the _joints data...
if (joints[j].TrackingState != TrackingState_NotTracked) {
_joints[j].position = jointPosition;
@ -545,6 +563,7 @@ void KinectPlugin::saveSettings() const {
settings.beginGroup(idString);
{
settings.setValue(QString("enabled"), _enabled);
settings.setValue(QString("extraDebug"), _debug);
}
settings.endGroup();
}

View file

@ -89,6 +89,7 @@ protected:
static const char* KINECT_ID_STRING;
bool _enabled { false };
bool _debug { false };
mutable bool _initialized { false };
// copy of data directly from the KinectDataReader SDK