From 3a46a01b9bb1fa07719be7f15695b0ec8fb3b7c8 Mon Sep 17 00:00:00 2001 From: mdfeist Date: Fri, 21 Jun 2013 12:01:11 -0600 Subject: [PATCH] Added support for recording the eye vector. (Untested with Dikablis) --- BlinkAnalysis/Recording.cpp | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/BlinkAnalysis/Recording.cpp b/BlinkAnalysis/Recording.cpp index 3eb340a..2ae66b6 100644 --- a/BlinkAnalysis/Recording.cpp +++ b/BlinkAnalysis/Recording.cpp @@ -164,6 +164,48 @@ void Recording:: addFrame() { if (!client->lock()) return; + // Get current position of head + RigidBody* head = client->getHead(); + + if (head != NULL) { + fileStream << "\n"; + + osg::Vec3 pos = head->getPosition(); + + // Add to the head point + fileStream << ""; + + osg::Matrixf headMatrix; + headMatrix.makeIdentity(); + float qx = -head->getRotation().x(); + float qy = -head->getRotation().y(); + float qz = -head->getRotation().z(); + float qw = head->getRotation().w(); + headMatrix.makeRotate(osg::Quat(qx, qy, qz, qw)); + + Dikablis::journal_struct journal = Dikablis::getJournal(); + + int x = journal.field_x; + int y = journal.field_y; + + osg::Vec3 ray = client->getRay(x, y); + + ray = headMatrix * ray; + ray = (ray + pos); + + fileStream << ""; + + fileStream << "\n"; + } + std::map* rigidBodies = client->getRigidBodyMap(); for (RigidBody_iterator it = rigidBodies->begin(); it != rigidBodies->end(); ++it) {