Laser Sensing Display for UI interfaces in the real world

Dependencies:   mbed

Fork of skinGames_forktest by Alvaro Cassinelli

Revision:
47:199042980678
Parent:
46:e0dd2d1d07c1
--- a/main.cpp	Sun Mar 30 08:58:59 2014 +0000
+++ b/main.cpp	Thu Apr 17 08:04:14 2014 +0000
@@ -140,7 +140,7 @@
 
 // this is a hack for the time being:
 int objectID;
-int xx, yy; // initial position of object
+int xx, yy; // initial position of object or displacement
 bool firstTimeDisplay=true;
 
 // ==============================================================================================================
@@ -626,11 +626,6 @@
             indexStringData = 0;
             objectID=atoi(receivedStringData);
        }
-        
-       else if (command1=="initialPosition") { // this is for setting the POSITION of the object to be created:
-           xx=auxDataBuffer[0]; yy=auxDataBuffer[1];
-           auxDataBuffer_index=0;
-       }
 
     else if (command1 == "mbedReset" ) mbed_reset();
 
@@ -674,7 +669,7 @@
     }
 
 
-// ===================  CREATION and DESTRUCTION of objects =========================================================
+// ===================  CREATION and DESTRUCTION of objects =====================================================
     else if (command1 == "clearScene") {
         clearScene();
     }
@@ -682,6 +677,22 @@
     else if (command1 =="deleteObject") { // second address is object identifier (a string that will be converted
         deleteObject(objectID);
     }
+    
+       else if (command1=="initialPosition") { // this is for setting the POSITION of the object to be created (or displacement):
+           xx=auxDataBuffer[0]; yy=auxDataBuffer[1];
+           auxDataBuffer_index=0;
+       }
+    
+// ===================  TRANSFORMATION OF OBJECT POINTS =========================================================
+// NOTE: this may in the end destroy the object rigidity because approximations... but without an RT per object, this is the only way to 
+// modify object pose independently of the whole scene...
+else if (command1 =="moveObject") {
+       translateObject(objectID,  xx,  yy, 0);
+    }
+
+
+// ==============================================================================================================
+
 
     // Produce a grid of points. The projection is ORTHOGRAPHIC. Also, POSE is reset to identity (i.e., the sent points should have
     // been translated previously - this may be optional, we could first send the pose, then the points...)
@@ -1046,11 +1057,21 @@
             command1="objectID";
             interpretCommand();
        }
+       
+       else if (incomingByte == '[') {
+        command1 =="deleteObject";
+        interpretCommand();
+       }
+       
+       else if (incomingByte == '}') {
+        command1 =="moveObject";
+       interpretCommand();; // xx, yy contains already the necessary displacement
+    }
+
         
        else if (incomingByte == '~') { // this is for setting the POSITION of the object to be created:
             command1="initialPosition";
             interpretCommand();
-            
        }