Skip to content

Commit 41246ae

Browse files
committed
Update library for protocol V2
1 parent ae50d63 commit 41246ae

31 files changed

+1180
-994
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,4 @@ application.macosx
4646

4747
examples/Augmenta_2D/settings.json
4848
*.json
49+
/bin/

README.md

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,62 @@
1-
Augmenta for Processing
2-
=======================
1+
# Augmenta for Processing
32

4-
A [Processing][] Augmenta helper library and examples maintained by [Théoriz studio][]
3+
A [Processing][] helper library and examples maintained by [Théoriz studio][] that allows to use the [Augmenta][] tracking system.
54

6-
Install
7-
-------
5+
## Install
86

97
Open [Processing][] and install the OscP5 library
108

119
```
1210
Sketch -> Import Library... -> Add Library -> OscP5
1311
```
1412

15-
Then get AugmentaP5 library from here
13+
### Auto installation
1614

17-
https://github.com/Lyptik/AugmentaP5/archive/master.zip (and rename to AugmentaP5)
15+
**Coming soon:** You can get the *Augmenta for Processing* library within the Processing editor, in Sketch>import a library...>add a library... search for "Augmenta for Processing" and add it to your Processing editor. This is the prefered way of installing it.
16+
17+
### Manual installation
18+
19+
You can also download it manually:
20+
21+
get the library on github at this address: https://github.com/Theoriz/augmenta-for-processing/archive/refs/heads/master.zip and **rename it "Augmenta"**.
1822

1923
or
2024

2125
```
22-
git clone https://github.com/Theoriz/AugmentaP5.git
26+
git clone https://github.com/Theoriz/augmenta-for-processing.git
2327
```
2428

25-
in the following directory
29+
Once you have downloaded the library and **renamed it "Augmenta"**, put it in the following directory
2630

2731
- Mac OSX : /Users/Username/Documents/Processing/libraries
2832
- Windows : C:/My Documents/Processing/libraries
2933
- Linux : /home/Username/sketchbook/libraries
3034

31-
You should now have a folder named *AugmentaP5* in this directory.
32-
33-
Do the same for the TUIO library downloadable here :
34-
35-
http://prdownloads.sourceforge.net/reactivision/TUIO11_Processing-1.1.5.zip?download
35+
You should now have a folder named **Augmenta** in this directory.
3636

3737
Then restart [Processing][]
3838

39-
Use
40-
---
39+
## Usage
40+
4141
In [Processing][]
4242

4343
```
4444
Sketch -> Import Library... -> OscP5 (needed dependency)
45-
Sketch -> Import Library... -> AugmentaP5
45+
Sketch -> Import Library... -> Augmenta for Processing
4646
```
4747

48-
Examples
49-
--------
48+
## Examples
5049

5150
In [Processing][], start your example
5251

5352
```
54-
File -> Examples... -> Contributed Libraries -> AugmentaP5
53+
File -> Examples... -> Contributed Libraries -> Augmenta for Processing
5554
```
5655

5756
### Basic example
5857

5958
Receive and draw Augmenta data without any other library
6059

61-
// TODO add screenshot (insert basic view)
62-
63-
**Install TUIO library** : [TUIO11_Processing.zip](http://prdownloads.sourceforge.net/reactivision/TUIO11_Processing-1.1.5.zip?download)
64-
6560
### 2D and 3D examples
6661

6762
Examples for receiving and drawing Augmenta data including a Syphon/Spout output (Mac/Windows only) and a basic UI
@@ -100,7 +95,7 @@ Documentation
10095

10196
Data protocol is here : https://github.com/Theoriz/Augmenta/wiki
10297

103-
Here is a presentation explaining how to use the API
98+
Here is a presentation explaining how to use the API with an older version of the library. Some methods/members names have changed but the main concepts remain the same.
10499

105100
http://fr.slideshare.net/DavidAlexandreCHANEL/augmentap5-api-59334230
106101

@@ -123,3 +118,4 @@ Thanks to the devs and beta testers whose contribution are vitals to the project
123118
[Théoriz studio]: http://www.theoriz.com/
124119
[OpenTSPS]: https://github.com/labatrockwell/openTSPS/
125120
[Eclipse]: http://www.eclipse.org/
121+
[Augmenta]: https://augmenta-tech.com

examples/Augmenta_2D/Augmenta_2D.pde

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*/
1313

14-
import augmentaP5.*;
14+
import augmenta.*;
1515
import oscP5.*;
1616

1717
boolean mode3D = false;
@@ -23,7 +23,8 @@ void setup() {
2323
setupSyphonSpout();
2424
setupAugmenta();
2525
setupGUI();
26-
26+
// enable the resizable window
27+
surface.setResizable(true);
2728
// Add your code here
2829
}
2930

@@ -38,15 +39,15 @@ void draw() {
3839
canvas.background(0);
3940

4041
// Draw a green disk under the first person entdered in the scene
41-
AugmentaPerson oldest = auReceiver.getOldestPerson();
42+
AugmentaObject oldest = auReceiver.getOldestObject();
4243
if (oldest != null){
4344
canvas.fill(0,255,0); // green disk
4445
canvas.noStroke(); // Without stroke
4546
canvas.ellipse(oldest.centroid.x*canvas.width, oldest.centroid.y*canvas.height, 25, 25); // 25 pixels diameter
4647
}
4748

4849
// Draw a blue disk for every persons
49-
AugmentaPerson[] people = auReceiver.getPeopleArray();
50+
AugmentaObject[] people = auReceiver.getObjectsArray();
5051

5152
for (int i=0; i<people.length; i++) {
5253

@@ -79,14 +80,14 @@ void draw() {
7980

8081
// You can also use these events functions which are triggered automatically
8182

82-
void personEntered (AugmentaPerson p) {
83+
void objectEntered (AugmentaObject o) {
8384
//println("Person entered : "+ p.pid + " at ("+p.centroid.x+","+p.centroid.y+")");
8485
}
8586

86-
void personUpdated (AugmentaPerson p) {
87+
void objectUpdated (AugmentaObject o) {
8788
//println("Person updated : "+ p.pid + " at ("+p.centroid.x+","+p.centroid.y+")");
8889
}
8990

90-
void personWillLeave (AugmentaPerson p) {
91+
void objectWillLeave (AugmentaObject o) {
9192
//println("Person will leave : "+ p.pid + " at ("+p.centroid.x+","+p.centroid.y+")");
9293
}

examples/Augmenta_2D/Augmenta_functions.pde

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ int manualSceneY = 480; // default
2929
float originX;
3030
float originY;
3131

32-
AugmentaP5 auReceiver;
32+
Augmenta auReceiver;
3333
int oscPort = 12000; // OSC default reception port
3434
boolean drawDebugData = false;
3535

@@ -46,7 +46,7 @@ void settings(){
4646
void setupAugmenta() {
4747

4848
// Create the Augmenta receiver
49-
auReceiver= new AugmentaP5(this, oscPort);
49+
auReceiver= new Augmenta(this, oscPort);
5050
auReceiver.setTimeOut(30); // TODO : comment needed here !
5151
auReceiver.setGraphicsTarget(canvas);
5252
// You can set the interactive area (can be set with the mouse in this example)
@@ -98,7 +98,7 @@ void showGUI(boolean val) {
9898
}
9999

100100
boolean changeSize(int a_width, int a_height) {
101-
101+
System.out.println("Changing size");
102102
boolean hasChanged = false;
103103
int minSize = 200;
104104
int maxSize = 16000;
@@ -112,24 +112,24 @@ boolean changeSize(int a_width, int a_height) {
112112
canvas = createGraphics(a_width, a_height, P2D);
113113
}
114114

115-
// Change window size if needed
116-
float ratio = (float)a_width/(float)a_height;
117-
if (a_width >= displayWidth*0.9f || a_height >= displayHeight*0.9f) {
118-
// Resize the window to fit in the screen with the correct ratio
119-
if ( ratio > displayWidth/displayHeight ) {
120-
a_width = (int)(displayWidth*0.8f);
121-
a_height = (int)(a_width/ratio);
122-
} else {
123-
a_height = (int)(displayHeight*0.8f);
124-
a_width = (int)(a_height*ratio);
125-
}
126-
}
115+
// // Change window size if needed
116+
// float ratio = (float)a_width/(float)a_height;
117+
// if (a_width >= displayWidth*0.9f || a_height >= displayHeight*0.9f) {
118+
// // Resize the window to fit in the screen with the correct ratio
119+
// if ( ratio > displayWidth/displayHeight ) {
120+
// a_width = (int)(displayWidth*0.8f);
121+
// a_height = (int)(a_width/ratio);
122+
// } else {
123+
// a_height = (int)(displayHeight*0.8f);
124+
// a_width = (int)(a_height*ratio);
125+
// }
126+
// }
127127

128128
surface.setSize(a_width, a_height);
129129
auReceiver.setGraphicsTarget(canvas);
130130

131131
hasChanged = true;
132-
132+
System.out.println("Size changed");
133133
} else if (a_width < minSize || a_height < minSize || a_width > maxSize || a_height > maxSize) {
134134
println("ERROR : Cannot set a window size of :" + a_width + "x" + a_height + " : smaller than " + minSize + " or greater than " + maxSize);
135135
}
@@ -147,7 +147,7 @@ boolean adjustSceneSize() {
147147
// Auto size
148148
if (autoSceneSize.getBooleanValue()) {
149149

150-
int[] sceneSize = auReceiver.getSceneSize();
150+
int[] sceneSize = auReceiver.getResolution();
151151
newWidth = sceneSize[0];
152152
newHeight = sceneSize[1];
153153

@@ -186,7 +186,7 @@ boolean adjustSceneSize() {
186186
// --------------------------------------
187187
void setUI() {
188188

189-
//Auto scene size + manual scene sihhze
189+
//Auto scene size + manual scene size
190190
autoSceneSize = cp5.addToggle("changeAutoSceneSize")
191191
.setPosition(14, 35)
192192
.setSize(15, 15)
@@ -280,9 +280,7 @@ public void changeInputPort(String s) {
280280
}
281281
reconnectReceiver();
282282
}
283-
public void changeTuio(boolean b) {
284-
reconnectReceiver();
285-
}
283+
286284
public void reconnectReceiver(){
287285
if(portInput != null && auReceiver != null){ // Sanity check
288286
auReceiver.reconnect(oscPort);
@@ -314,15 +312,18 @@ void drawAugmenta() {
314312

315313
// Draw debug data on top with [d] key
316314
if (drawDebugData) {
317-
AugmentaPerson[] people = auReceiver.getPeopleArray();
318-
for (int i=0; i<people.length; i++) {
319-
people[i].draw();
315+
AugmentaObject[] objects = auReceiver.getObjectsArray();
316+
for (int i=0; i<objects.length; i++) {
317+
System.out.println("Debug draw");
318+
objects[i].draw();
320319
}
321320
}
322321

323322
// Draw interactive area
324323
if (drawDebugData) {
325-
auReceiver.interactiveArea.draw();
324+
//String s = auReceiver.interactiveArea.area.x + "," + auReceiver.interactiveArea.area.y + "," + auReceiver.interactiveArea.area.width + "," + auReceiver.interactiveArea.area.height;
325+
//System.out.println(s);
326+
//auReceiver.interactiveArea.draw();
326327
}
327328
}
328329

0 commit comments

Comments
 (0)