Ejemplo n.º 1
0
OVR_PUBLIC_FUNCTION(ovrTrackingState) ovr_GetTrackingState(ovrSession session, double absTime, ovrBool latencyMarker) {
	ovrTrackingState1_3 state = ovr_GetTrackingState1_3((ovrSession1_3)session, absTime, latencyMarker);
	ovrTrackerPose1_3 tpose = ovr_GetTrackerPose1_3((ovrSession1_3)session, 0);

	ovrTrackingState r;	
	copyPose(&(r.CameraPose), &(tpose.Pose));
	r.CameraPose.Orientation = tpose.Pose.Orientation;
	r.CameraPose.Position = tpose.Pose.Position;
	copyPoseState(&(r.HandPoses[0]), &(state.HandPoses[0]));
	copyPoseState(&(r.HandPoses[1]), &(state.HandPoses[1]));

	r.HandStatusFlags[0] = state.HandStatusFlags[0];
	r.HandStatusFlags[1] = state.HandStatusFlags[1];

	copyPoseState(&(r.HeadPose), &(state.HeadPose));

	//r.LastCameraFrameCounter not filled

	copyPose(&(r.LeveledCameraPose), &(tpose.LeveledPose));

	//r.RawSensorData not filled
	r.StatusFlags = state.StatusFlags | ovrStatus_CameraPoseTracked | ovrStatus_PositionConnected | ovrStatus_HmdConnected;
	
	return r;
}
Ejemplo n.º 2
0
void copyPoseState(ovrPoseStatef* dest, const ovrPoseStatef1_3* source) {
	dest->AngularAcceleration = source->AngularAcceleration;
	dest->AngularVelocity = source->AngularVelocity;
	dest->LinearAcceleration = source->LinearAcceleration;
	dest->LinearVelocity = source->LinearVelocity;
	copyPose(&(dest->ThePose), &(source->ThePose));
	dest->TimeInSeconds = source->TimeInSeconds;
}
Ejemplo n.º 3
0
PoseEditor::PoseEditor(QWidget *parent) :
    QWidget(parent)
{
    ij[0] = new InputJoint(tr("hj1"), -120, 120, this);
    ij[1] = new InputJoint(tr("hj2"), -45, 45, this);
    ij[2] = new InputJoint(tr("laj1"), -120, 120, this);
    ij[3] = new InputJoint(tr("raj1"), -120, 120, this);
    ij[4] = new InputJoint(tr("laj2"), -1, 95, this);
    ij[5] = new InputJoint(tr("raj2"), -95, 1, this);
    ij[6] = new InputJoint(tr("laj3"), -120, 120, this);
    ij[7] = new InputJoint(tr("raj3"), -120, 120, this);
    ij[8] = new InputJoint(tr("laj4"), -90, 1, this);
    ij[9] = new InputJoint(tr("raj4"), -1, 90, this);
    ij[10] = new InputJoint(tr("llj1"), -90, 1, this);
    ij[11] = new InputJoint(tr("rlj1"), -90, 1, this);
    ij[12] = new InputJoint(tr("llj2"), -25, 45, this);
    ij[13] = new InputJoint(tr("rlj2"), -45, 25, this);
    ij[14] = new InputJoint(tr("llj3"), -25, 100, this);
    ij[15] = new InputJoint(tr("rlj3"), -25, 100, this);
    ij[16] = new InputJoint(tr("llj4"), -130, 1, this);
    ij[17] = new InputJoint(tr("rlj4"), -130, 1, this);
    ij[18] = new InputJoint(tr("llj5"), -45, 75, this);
    ij[19] = new InputJoint(tr("rlj5"), -45, 75, this);
    ij[20] = new InputJoint(tr("llj6"), -45, 25, this);
    ij[21]= new InputJoint(tr("rlj6"), -25, 45, this);

    posesList = new QListWidget();
    /*
    posesList->addItem(tr("pose0")); // using for(i ; i< length_of_posesList; i++) is better
    posesList->addItem(tr("pose1"));
    posesList->addItem(tr("pose2"));
    posesList->addItem(tr("pose3"));
    posesList->addItem(tr("pose4"));
    posesList->addItem(tr("pose5"));
    posesList->addItem(tr("pose6"));
    posesList->addItem(tr("pose7"));
    posesList->addItem(tr("pose8"));
    posesList->addItem(tr("pose9"));
    posesList->setCurrentRow(0);
    for(int i=0; i< 10; i++){
        posesList->item(i)->setFlags(posesList->item(i)->flags() | Qt::ItemIsEditable);
        posesList->item(i)->setData(Qt::UserRole, QVariant::fromValue(poseEditorList[i]));
    }
    */
    for(int i=0; i<10; i++) {
        Pose tempP;
        addPoseItem("pose"+QString::number(i), tempP);
    }
    posesList->setCurrentRow(0);

    //    posesList->setEditTriggers(QAbstractItemView::DoubleClicked);
    QPushButton *saveProjectButton = new QPushButton(tr("save project"));
    QPushButton *loadProjectButton = new QPushButton(tr("load project"));

    fromComboBox = new QComboBox();
    toComboBox = new QComboBox();
    QPushButton* copyButton = new QPushButton(tr("copy"));

    for(int i=0; i < posesList->count(); i++) {
        fromComboBox->addItem(posesList->item(i)->text());
        toComboBox->addItem(posesList->item(i)->text());
    }

    QHBoxLayout *copyerLayout = new QHBoxLayout();
    copyerLayout->addWidget(fromComboBox);
    copyerLayout->addWidget(new QLabel(tr("to")));
    copyerLayout->addWidget(toComboBox);
    copyerLayout->addWidget(copyButton);

    QVBoxLayout *utilityLayout = new QVBoxLayout();
    utilityLayout->addWidget(posesList);
    utilityLayout->addWidget(saveProjectButton);
    utilityLayout->addWidget(loadProjectButton);
    utilityLayout->addLayout(copyerLayout);

    QGridLayout *jointLayout = new QGridLayout();
    jointLayout->addWidget(ij[0], 0, 0, 1, 2);
    jointLayout->addWidget(ij[1], 1, 0, 1, 2);
    for(int i=1; i<11; i++) {
        jointLayout->addWidget(ij[i*2], i+2, 0);
        jointLayout->addWidget(ij[i*2+1], i+2, 1);
    }

    QHBoxLayout *entireLayout = new QHBoxLayout();
    entireLayout->addLayout(utilityLayout);
    entireLayout->addLayout(jointLayout);

    this->setLayout(entireLayout);
    this->setMinimumSize(300, 350);
    posesList->setMaximumWidth(250);

    //signal slot connection
    // if value changed, modify shared information
    /*
        "check which joint is modified" is better,
        but "if some joint is modified, reread all data" is easier
    */

    for(int i=0; i<22; i++) {
        connect(ij[i], SIGNAL(valueChanged(double)), this, SLOT(makeNewPose()));
    }

    connect(posesList, SIGNAL(currentRowChanged(int)), this, SLOT(changePoseListRow(int)));

    connect(saveProjectButton, SIGNAL(clicked()), this, SLOT(saveProject()));
    connect(loadProjectButton, SIGNAL(clicked()), this, SLOT(loadProject()));
    connect(copyButton, SIGNAL(clicked()), this, SLOT(copyPose()));
//    connect(posesList, SIGNAL(currentRowChanged(int)), this, SLOT(renameComboBox()));
    connect(posesList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(renameComboBox()));
    connect(posesList, SIGNAL(currentRowChanged(int)), fromComboBox, SLOT(setCurrentIndex(int)));
}