Commit 76ca05b8 by Adrian Hoppe

test

parent f3db4192
Pipeline #255 passed with stage
in 22 seconds
...@@ -54,6 +54,7 @@ ICoordinateMapper* mapper; // Converts between depth, color, and 3d coor ...@@ -54,6 +54,7 @@ ICoordinateMapper* mapper; // Converts between depth, color, and 3d coor
SteamTracking* steamTracking = nullptr; SteamTracking* steamTracking = nullptr;
glm::mat4x4* currentControlerPos = nullptr; glm::mat4x4* currentControlerPos = nullptr;
glm::mat4x4 controlerToKinect;
Camera mainCam; Camera mainCam;
...@@ -198,7 +199,7 @@ void processCurrentFrameForExport() { ...@@ -198,7 +199,7 @@ void processCurrentFrameForExport() {
for (unsigned int i = 0; i < width*height; i++) { for (unsigned int i = 0; i < width*height; i++) {
if (frameValidPoints[i]) { if (frameValidPoints[i]) {
points.push_back(glm::vec3(*currentControlerPos * glm::vec4(framePositions[i], 1.0f))); points.push_back(glm::vec3( *currentControlerPos * controlerToKinect * glm::vec4(framePositions[i], 1.0f)));
colors.push_back(frameColors[i * 3]); colors.push_back(frameColors[i * 3]);
colors.push_back(frameColors[i * 3 + 1]); colors.push_back(frameColors[i * 3 + 1]);
colors.push_back(frameColors[i * 3 + 2]); colors.push_back(frameColors[i * 3 + 2]);
...@@ -300,6 +301,7 @@ void mainRenderLoop() { ...@@ -300,6 +301,7 @@ void mainRenderLoop() {
glLoadIdentity(); glLoadIdentity();
//rotateCamera(); //todo //rotateCamera(); //todo
mainCam.applyMatrix(); mainCam.applyMatrix();
//glTranslatef(0.0, 5, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_VERTEX_ARRAY);
...@@ -316,18 +318,22 @@ void mainRenderLoop() { ...@@ -316,18 +318,22 @@ void mainRenderLoop() {
glPushMatrix(); glPushMatrix();
//draw current Frame //draw current Frame
if(currentControlerPos) //applay controler Transformation if (currentControlerPos) { //applay controler Transformation
glMultMatrixf(glm::value_ptr(controlerToKinect));
glMultMatrixf(glm::value_ptr(*currentControlerPos)); glMultMatrixf(glm::value_ptr(*currentControlerPos));
}
glPointSize(1.f); glPointSize(1.f);
drawElementArray(framePoints, GL_POINTS); drawElementArray(framePoints, GL_POINTS);
drawElementArray(arrowData, GL_TRIANGLES); drawElementArray(arrowData, GL_TRIANGLES);
// draw hud arrow // draw hud arrow
glTranslatef(0.0f, 1.5f, 0.0f); //glTranslatef(0.0f, 1.5f, 0.0f);
float scale = 1.0f ; float scale = 0.1f ;
glScalef(scale, scale, scale); glScalef(scale, scale, scale);
glRotatef(-90, 0.0, 1.0, 0.0);
glDisableClientState(GL_COLOR_ARRAY); glDisableClientState(GL_COLOR_ARRAY);
//drawArrow(); //drawArrow();
...@@ -379,7 +385,7 @@ void mouseMove(int x, int y) { ...@@ -379,7 +385,7 @@ void mouseMove(int x, int y) {
void captureNextFrame(vr::VREvent_t event) void captureNextFrame(vr::VREvent_t event)
{ {
if (event.trackedDeviceIndex == 1 && event.data.controller.button == 33) { if (event.trackedDeviceIndex == 1 && event.data.controller.button == 33) {
std::cout << "Caturing Frame controler Button" << std::endl; std::cout << "Capturing Frame Controler Button" << std::endl;
captureFrame = true; captureFrame = true;
} }
} }
...@@ -416,6 +422,22 @@ int main(int argc, char* argv[]) { ...@@ -416,6 +422,22 @@ int main(int argc, char* argv[]) {
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadIdentity(); glLoadIdentity();
//kienct: https://msdn.microsoft.com/de-de/library/dn785530.aspx
// 1 unit = 1 meter
// z ist nach vorne, y up, x links aka -90 um die y achse gedreht
// The Camera Space origin (x=0, y=0, z=0) is located at the center of the IR sensor on Kinect
//von links 82,5 mm ist origin (siehe bild kinect mesures), kinect v2: 24,9 cm x 6,6 cm x 6,7cm
//
// http://www.opengl-tutorial.org/beginners-tutorials/tutorial-7-model-loading/
//C:\Program Files (x86)\Steam\steamapps\common\SteamVR\resources\rendermodels\vr_controller_vive_1_5
//HKEY_CURRENT_USER/Software/Valve/SteamPath.
controlerToKinect = glm::translate(glm::mat4x4(), (glm::vec3(-4.0f, 4.0f, 12.0f)*0.01f));
// Main loop // Main loop
atexit(close); atexit(close);
execute(); execute();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment