|
1 /* |
|
2 * This file is part of the TraKERS\Front Processing package. |
|
3 * |
|
4 * (c) IRI <http://www.iri.centrepompidou.fr/> |
|
5 * |
|
6 * For the full copyright and license information, please view the LICENSE_FRONT |
|
7 * file that was distributed with this source code. |
|
8 */ |
|
9 |
|
10 /*FONCTION DE RECEPTION DES MESSAGES OSC |
|
11 Entrée : |
|
12 Sortie : Appel aux différentes fonctions de dessin si un message est reçu*/ |
|
13 void tuioInput() |
|
14 { |
|
15 noFill(); |
|
16 Vector tuioCursorList = tuioClient.getTuioCursors(); |
|
17 |
|
18 if(tuioCursorList.size() <= 0) |
|
19 { |
|
20 showMask(); |
|
21 refreshText("Les mains sont trop loin ou trop près.", "Je ne détecte aucune main."); |
|
22 } |
|
23 |
|
24 if(tuioCursorList.size() == 1) |
|
25 { |
|
26 handleOneHand((TuioCursor)tuioCursorList.elementAt(0)); |
|
27 fill(255); |
|
28 refreshText("Les mains sont dans la zone de captation.", "Je détecte une main."); |
|
29 } |
|
30 else if(tuioCursorList.size() == 2) |
|
31 { |
|
32 handleBothHands(tuioCursorList); |
|
33 fill(255); |
|
34 refreshText("Les mains sont dans la zone de captation.", "Je détecte les deux mains."); |
|
35 } |
|
36 } |
|
37 |
|
38 /*FONCTION DE GESTION DES COURBES POUR UNE MAIN DETECTEE |
|
39 Entrée : Un curseur TUIO |
|
40 Sortie : Appel aux différentes fonctions de dessin si un message est reçu*/ |
|
41 void handleOneHand(TuioCursor handCursor) |
|
42 { |
|
43 TuioPoint pt = handCursor.getPosition();//(TuioPoint)pointList.get(j); |
|
44 fill(0); |
|
45 drawEllipse(pt.getX(), pt.getY(), pt.getZ(), !oneHandLeft); |
|
46 } |
|
47 |
|
48 /*FONCTION DE GESTION DES COURBES POUR DEUX MAINS DETECTEES |
|
49 Entrée : La liste des curseurs TUIO |
|
50 Sortie : Appel aux différentes fonctions de dessin si un message est reçu*/ |
|
51 void handleBothHands(Vector tuioCursorList) |
|
52 { |
|
53 TuioCursor handLeftCursor = (TuioCursor)tuioCursorList.elementAt(0); |
|
54 TuioCursor handRightCursor = (TuioCursor)tuioCursorList.elementAt(1); |
|
55 TuioPoint pt; |
|
56 |
|
57 pt = (TuioPoint)handLeftCursor.getPosition();//handLeftPointList.get(j); |
|
58 drawEllipse(pt.getX(), pt.getY(), pt.getZ(), true); |
|
59 pt = (TuioPoint)handRightCursor.getPosition();//handRightPointList.get(k); |
|
60 drawEllipse(pt.getX(), pt.getY(), pt.getZ(), false); |
|
61 } |
|
62 |
|
63 |