Skip to content

Commit da9b631

Browse files
committed
removed PAR interface
1 parent ee72172 commit da9b631

File tree

5 files changed

+101
-38
lines changed

5 files changed

+101
-38
lines changed

mode/libraries/ar/src/processing/ar/Anchor.java

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,30 @@
1+
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2+
3+
/*
4+
Part of the Processing project - http://processing.org
5+
6+
Copyright (c) 2019 The Processing Foundation
7+
8+
This library is free software; you can redistribute it and/or
9+
modify it under the terms of the GNU Lesser General Public
10+
License as published by the Free Software Foundation, version 2.1.
11+
12+
This library is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
Lesser General Public License for more details.
16+
17+
You should have received a copy of the GNU Lesser General
18+
Public License along with this library; if not, write to the
19+
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20+
Boston, MA 02111-1307 USA
21+
*/
22+
123
package processing.ar;
224

325
import processing.core.PMatrix3D;
426

5-
public class Anchor implements PAR {
27+
public class Anchor {
628
protected PGraphicsAR g;
729
private boolean disposed = false;
830

@@ -48,15 +70,15 @@ public void detach() {
4870
}
4971

5072
public boolean isTracking() {
51-
return g.anchorStatus(id) == TRACKING;
73+
return g.anchorStatus(id) == PGraphicsAR.TRACKING;
5274
}
5375

5476
public boolean isPaused() {
55-
return g.anchorStatus(id) == PAUSED;
77+
return g.anchorStatus(id) == PGraphicsAR.PAUSED;
5678
}
5779

5880
public boolean isStopped() {
59-
return g.anchorStatus(id) == STOPPED;
81+
return g.anchorStatus(id) == PGraphicsAR.STOPPED;
6082
}
6183

6284
public boolean isDisposed() {

mode/libraries/ar/src/processing/ar/PAR.java

Lines changed: 0 additions & 14 deletions
This file was deleted.

mode/libraries/ar/src/processing/ar/PGraphicsAR.java

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@
4848
import processing.opengl.PShader;
4949

5050
public class PGraphicsAR extends PGraphics3D {
51+
static protected final int UNKNOWN = -1;
52+
53+
static protected final int PLANE_FLOOR = 0;
54+
static protected final int PLANE_CEILING = 1;
55+
static protected final int PLANE_WALL = 2;
56+
static protected final int POINT = 3;
57+
58+
static protected final int TRACKING = 0;
59+
static protected final int PAUSED = 1;
60+
static protected final int STOPPED = 2;
61+
5162
// Convenience reference to the AR surface. It is the same object one gets from PApplet.getSurface().
5263
protected PSurfaceAR surfar;
5364

@@ -216,25 +227,25 @@ public int trackableIndex(int id) {
216227
public int trackableType(int i) {
217228
Plane plane = trackPlanes.get(i);
218229
if (plane.getType() == Plane.Type.HORIZONTAL_UPWARD_FACING) {
219-
return PAR.PLANE_FLOOR;
230+
return PLANE_FLOOR;
220231
} else if (plane.getType() == Plane.Type.HORIZONTAL_DOWNWARD_FACING) {
221-
return PAR.PLANE_CEILING;
232+
return PLANE_CEILING;
222233
} else if (plane.getType() == Plane.Type.VERTICAL) {
223-
return PAR.PLANE_WALL;
234+
return PLANE_WALL;
224235
}
225-
return PAR.UNKNOWN;
236+
return UNKNOWN;
226237
}
227238

228239
public int trackableStatus(int i) {
229240
Plane plane = trackPlanes.get(i);
230241
if (plane.getTrackingState() == TrackingState.PAUSED) {
231-
return PAR.PAUSED;
242+
return PAUSED;
232243
} else if (plane.getTrackingState() == TrackingState.TRACKING) {
233-
return PAR.TRACKING;
244+
return TRACKING;
234245
} else if (plane.getTrackingState() == TrackingState.STOPPED) {
235-
return PAR.STOPPED;
246+
return STOPPED;
236247
}
237-
return PAR.UNKNOWN;
248+
return UNKNOWN;
238249
}
239250

240251
public boolean trackableNew(int i) {
@@ -361,13 +372,13 @@ public int anchorCount() {
361372
public int anchorStatus(int id) {
362373
Anchor anchor = anchors.get(id);
363374
if (anchor.getTrackingState() == TrackingState.PAUSED) {
364-
return PAR.PAUSED;
375+
return PAUSED;
365376
} else if (anchor.getTrackingState() == TrackingState.TRACKING) {
366-
return PAR.TRACKING;
377+
return TRACKING;
367378
} else if (anchor.getTrackingState() == TrackingState.STOPPED) {
368-
return PAR.STOPPED;
379+
return STOPPED;
369380
}
370-
return PAR.UNKNOWN;
381+
return UNKNOWN;
371382
}
372383

373384

mode/libraries/ar/src/processing/ar/Trackable.java

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,32 @@
1+
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2+
3+
/*
4+
Part of the Processing project - http://processing.org
5+
6+
Copyright (c) 2019 The Processing Foundation
7+
8+
This library is free software; you can redistribute it and/or
9+
modify it under the terms of the GNU Lesser General Public
10+
License as published by the Free Software Foundation, version 2.1.
11+
12+
This library is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
Lesser General Public License for more details.
16+
17+
You should have received a copy of the GNU Lesser General
18+
Public License along with this library; if not, write to the
19+
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20+
Boston, MA 02111-1307 USA
21+
*/
22+
123
package processing.ar;
224

325
import processing.core.PMatrix3D;
426

527
import com.google.ar.core.HitResult;
628

7-
public class Trackable implements PAR {
29+
public class Trackable {
830
protected PGraphicsAR g;
931
protected HitResult hit;
1032

@@ -49,17 +71,17 @@ public boolean isNew() {
4971

5072
public boolean isTracking() {
5173
int idx = g.trackableIndex(id);
52-
return g.trackableStatus(idx) == TRACKING;
74+
return g.trackableStatus(idx) == PGraphicsAR.TRACKING;
5375
}
5476

5577
public boolean isPaused() {
5678
int idx = g.trackableIndex(id);
57-
return g.trackableStatus(idx) == PAUSED;
79+
return g.trackableStatus(idx) == PGraphicsAR.PAUSED;
5880
}
5981

6082
public boolean isStopped() {
6183
int idx = g.trackableIndex(id);
62-
return g.trackableStatus(idx) == STOPPED;
84+
return g.trackableStatus(idx) == PGraphicsAR.STOPPED;
6385
}
6486

6587
public boolean isPlane() {
@@ -72,16 +94,16 @@ public boolean isPointCloud() {
7294

7395
public boolean isFloorPlane() {
7496
int idx = g.trackableIndex(id);
75-
return g.trackableType(idx) == PLANE_FLOOR;
97+
return g.trackableType(idx) == PGraphicsAR.PLANE_FLOOR;
7698
}
7799

78100
public boolean isCeilingPlane() {
79101
int idx = g.trackableIndex(id);
80-
return g.trackableType(idx) == PLANE_CEILING;
102+
return g.trackableType(idx) == PGraphicsAR.PLANE_CEILING;
81103
}
82104

83105
public boolean isWallPlane() {
84106
int idx = g.trackableIndex(id);
85-
return g.trackableType(idx) == PLANE_WALL;
107+
return g.trackableType(idx) == PGraphicsAR.PLANE_WALL;
86108
}
87109
}

mode/libraries/ar/src/processing/ar/Tracker.java

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2+
3+
/*
4+
Part of the Processing project - http://processing.org
5+
6+
Copyright (c) 2019 The Processing Foundation
7+
8+
This library is free software; you can redistribute it and/or
9+
modify it under the terms of the GNU Lesser General Public
10+
License as published by the Free Software Foundation, version 2.1.
11+
12+
This library is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
Lesser General Public License for more details.
16+
17+
You should have received a copy of the GNU Lesser General
18+
Public License along with this library; if not, write to the
19+
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20+
Boston, MA 02111-1307 USA
21+
*/
22+
123
package processing.ar;
224

325
import com.google.ar.core.HitResult;
@@ -10,7 +32,7 @@
1032

1133
import processing.core.PApplet;
1234

13-
public class Tracker implements PAR {
35+
public class Tracker {
1436
protected PApplet p;
1537
protected PGraphicsAR g;
1638

0 commit comments

Comments
 (0)