schlangen avatar schlangen committed 1fb619c

some clean up

Comments (0)

Files changed (4)

     ALL_CPPFLAGS += -I/opt/local/include
 endif
 
+ifeq ($(ENABLE_TILT),kinect)
+
+ifeq ($(shell uname),Linux)
+     ALL_CPPFLAGS += -Dlinux=1 -Di386=1
+else
+$info("currently, kinect bindings have only been set up and tested on linux!");
+endif
+endif
+
 ALL_CPPFLAGS += $(CPPFLAGS)
 
 #------------------------------------------------------------------------------

share/tilt_kinect.c

 /*
  * Copyright (C) 2003 Robert Kooima
+ * Copyright (C) 2012 Julian Habrock
  *
  * NEVERBALL is  free software; you can redistribute  it and/or modify
  * it under the  terms of the GNU General  Public License as published
  * General Public License for more details.
  */
 
-#define linux 1
-#define i386  1
-
 #include <SDL.h>
 #include <SDL_thread.h>
 #include <math.h>
 
 #include "config.h"
 
-//#include <cstdio>
-//#include <csignal>
-//#include <iostream>
-//#include <fstream>
 #include <stdlib.h>
 
 
 	XnSkeletonJointTransformation jointTrans;
 
 	//userGenerator.GetSkeletonCap().GetSkeletonJoint(player, eJoint, jointTrans);
-	
 	xnGetSkeletonJoint(hUserGenerator, player, eJoint, &jointTrans);
 
-	//cout<< jointTrans.position.fConfidence << endl;
-	//recentConfidence[eJoint-1] = jointTrans.position.fConfidence;
-
-	//userID = player;
 
 	//if (jointTrans.position.fConfidence < 0.5) {
 	//	return 0;
 	//}
 
-	
 	XnPoint3D realwordPoint;
 	realwordPoint.X = 0; realwordPoint.Y = 0; realwordPoint.Z = 0;
 	
         int userCount = xnGetNumberOfUsers(hUserGenerator);
 	XnUserID *aUsers = malloc(userCount*sizeof(XnUserID));
 	XnUInt16 nUsers = userCount * sizeof(XnUserID);
-	//userGenerator.GetUsers(aUsers, nUsers);
 	for(int i = 0;i<userCount;i++){
 	  aUsers[i] = 0;
 	}
 	xnGetUsers(hUserGenerator, aUsers, &nUsers);
 	if (nUsers > 0){
-	
 		//if (userGenerator.GetSkeletonCap().IsTracking(aUsers[0])) {
 		 if (xnIsSkeletonTracking(hUserGenerator,aUsers[0])){
 		  printf("is skeleton tracking");
 	free(aUsers);
 }
 
-
 void checkRetVal(XnStatus nRetVal) {
 	if (nRetVal != XN_STATUS_OK) {
 		printf("There was a problem initializing kinect... Make sure you have \
 	}
 }
 
-
-
-
 void main_loop() {
 	// Read next available data
 	//context.WaitAnyUpdateAll();
 	xnWaitAnyUpdateAll(pContext);
+	
 	// Process the data
 	//depth.GetMetaData(depthMD);
-
 	xnGetDepthMetaData(hDepth, pDepthMD);
 	
 	get_body_positions();
-	
 }
 
 
-
 void init_kinect() {
 	printf("Initializing...\n");
 	
-//	XnMapOutputMode mapMode;
 	XnStatus nRetVal = XN_STATUS_OK;
 	XnCallbackHandle hUserCallbacks, hCalibrationCallbacks, hPoseCallbacks;
 
                 state.x = -deltaZ;
                 state.z = -deltaX;
 		
-		set_button(&state.U, button == 1);  // <- make this rotate the camera (needs further changes in main neverball code)
+		set_button(&state.U, button == 1);  // <- make this rotate the camera (needs further changes in main neverball code as rotate-buttons are not in state)
 		set_button(&state.D, button == 2);
 		
             }
             SDL_mutexV(mutex);
-     //   printf("test");
-
     }
 
-    //context.Shutdown();
     free_kinect();
     return 0;
 }

share/tilt_kinect.c~

 /*
  * Copyright (C) 2003 Robert Kooima
+ * Copyright (C) 2012 Julian Habrock
  *
  * NEVERBALL is  free software; you can redistribute  it and/or modify
  * it under the  terms of the GNU General  Public License as published
  * General Public License for more details.
  */
 
-#define linux 1
-#define i386  1
-
 #include <SDL.h>
 #include <SDL_thread.h>
 #include <math.h>
 
 #include "config.h"
 
-//#include <cstdio>
-//#include <csignal>
-//#include <iostream>
-//#include <fstream>
 #include <stdlib.h>
 
 
 	XnSkeletonJointTransformation jointTrans;
 
 	//userGenerator.GetSkeletonCap().GetSkeletonJoint(player, eJoint, jointTrans);
-	
 	xnGetSkeletonJoint(hUserGenerator, player, eJoint, &jointTrans);
 
-	//cout<< jointTrans.position.fConfidence << endl;
-	//recentConfidence[eJoint-1] = jointTrans.position.fConfidence;
-
-	//userID = player;
 
 	//if (jointTrans.position.fConfidence < 0.5) {
 	//	return 0;
 	//}
 
-	
 	XnPoint3D realwordPoint;
 	realwordPoint.X = 0; realwordPoint.Y = 0; realwordPoint.Z = 0;
 	
         int userCount = xnGetNumberOfUsers(hUserGenerator);
 	XnUserID *aUsers = malloc(userCount*sizeof(XnUserID));
 	XnUInt16 nUsers = userCount * sizeof(XnUserID);
-	//userGenerator.GetUsers(aUsers, nUsers);
 	for(int i = 0;i<userCount;i++){
 	  aUsers[i] = 0;
 	}
 	xnGetUsers(hUserGenerator, aUsers, &nUsers);
 	if (nUsers > 0){
-	
 		//if (userGenerator.GetSkeletonCap().IsTracking(aUsers[0])) {
 		 if (xnIsSkeletonTracking(hUserGenerator,aUsers[0])){
 		  printf("is skeleton tracking");
 	free(aUsers);
 }
 
-
 void checkRetVal(XnStatus nRetVal) {
 	if (nRetVal != XN_STATUS_OK) {
 		printf("There was a problem initializing kinect... Make sure you have \
 	}
 }
 
-
-
-
 void main_loop() {
 	// Read next available data
 	//context.WaitAnyUpdateAll();
 	xnWaitAnyUpdateAll(pContext);
+	
 	// Process the data
 	//depth.GetMetaData(depthMD);
-
 	xnGetDepthMetaData(hDepth, pDepthMD);
 	
 	get_body_positions();
-	
 }
 
 
-
 void init_kinect() {
 	printf("Initializing...\n");
 	
-//	XnMapOutputMode mapMode;
 	XnStatus nRetVal = XN_STATUS_OK;
 	XnCallbackHandle hUserCallbacks, hCalibrationCallbacks, hPoseCallbacks;
 
                 state.x = -deltaZ;
                 state.z = -deltaX;
 		
-		set_button(&state.U, button == 1);  // <- make this rotate the camera (needs further changes in main neverball code)
+		set_button(&state.U, button == 1);  // <- make this rotate the camera (needs further changes in main neverball code as rotate-buttons are not in state)
 		set_button(&state.D, button == 2);
 		
             }

Binary file modified.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.