Skip to content

Commit bd38030

Browse files
committed
some initial fixes
1 parent 37e9ca1 commit bd38030

File tree

5 files changed

+33
-31
lines changed

5 files changed

+33
-31
lines changed

core/src/processing/core/PConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public interface PConstants {
5050
static final String OPENGL = P3D;
5151
static final String STEREO = "processing.vr.PGraphicsVRStereo";
5252
static final String MONO = "processing.vr.PGraphicsVRMono";
53-
static final String ARCORE = "processing.ar.PGraphicsARView";
53+
static final String ARCORE = "processing.ar.PGraphicsAR";
5454

5555
// The PDF and DXF renderers are not available for Android.
5656

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package processing.ar;
22

3+
import android.view.SurfaceHolder;
4+
5+
import processing.android.AppComponent;
36
import processing.core.PApplet;
47
import processing.core.PMatrix3D;
58
import processing.core.PSurface;
@@ -16,6 +19,12 @@ public class PGraphicsAR extends PGraphics3D {
1619
public PGraphicsAR() {
1720
}
1821

22+
@Override
23+
public PSurface createSurface(AppComponent appComponent, SurfaceHolder surfaceHolder, boolean b) {
24+
if (b) pgl.resetFBOLayer();
25+
return new PSurfaceAR(this, appComponent, surfaceHolder);
26+
}
27+
1928
@Override
2029
protected PGL createPGL(PGraphicsOpenGL pGraphicsOpenGL) {
2130
return new PGLES(pGraphicsOpenGL);

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

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

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

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ public PSurfaceAR(PGraphics graphics, AppComponent appComponent, SurfaceHolder s
8888
displayRotationHelper = new RotationHandler(activity);
8989
surfaceView = new SurfaceViewAR(activity);
9090

91-
progressdialog.setMessage("Searching for Surfaces");
92-
progressdialog.show();
91+
// progressdialog.setMessage("Searching for Surfaces");
92+
// progressdialog.show();
9393
}
9494

9595
@Override
@@ -161,8 +161,8 @@ public void dispose() {
161161
public class SurfaceViewAR extends GLSurfaceView {
162162
public SurfaceViewAR(Context context) {
163163
super(context);
164-
sketch.setup();
165-
sketch.draw();
164+
// sketch.setup();
165+
// sketch.draw();
166166

167167
final ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
168168
final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
@@ -256,15 +256,15 @@ public void onDrawFrame(GL10 gl) {
256256
}
257257
performRendering();
258258

259-
if (progressdialog != null) {
260-
for (Plane plane : session.getAllTrackables(Plane.class)) {
261-
if (plane.getType() == com.google.ar.core.Plane.Type.HORIZONTAL_UPWARD_FACING
262-
&& plane.getTrackingState() == TrackingState.TRACKING) {
263-
progressdialog.dismiss();
264-
break;
265-
}
266-
}
267-
}
259+
// if (progressdialog != null) {
260+
// for (Plane plane : session.getAllTrackables(Plane.class)) {
261+
// if (plane.getType() == com.google.ar.core.Plane.Type.HORIZONTAL_UPWARD_FACING
262+
// && plane.getTrackingState() == TrackingState.TRACKING) {
263+
// progressdialog.dismiss();
264+
// break;
265+
// }
266+
// }
267+
// }
268268

269269
sketch.calculate();
270270
sketch.handleDraw();
@@ -349,6 +349,11 @@ public void pauseThread() {
349349

350350
@Override
351351
public void resumeThread() {
352+
if (!sketch.hasPermission("android.permission.CAMERA")) {
353+
// sketch.requestPermission("android.permission.CAMERA");
354+
return;
355+
}
356+
352357
if (session == null) {
353358
String message = null;
354359
String exception = null;
@@ -361,6 +366,8 @@ public void resumeThread() {
361366
break;
362367
}
363368

369+
370+
364371
// if (!sketch.hasPermission("android.permission.CAMERA")) {
365372
// sketch.requestPermission("android.permission.CAMERA");
366373
// return;

studio/apps/arscene/src/main/java/arscene/Sketch.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ public void settings() {
1515

1616
public void setup() {
1717
// I think this should go here but not 100% sure
18-
// if (!hasPermission("android.permission.CAMERA")) {
19-
// requestPermission("android.permission.CAMERA");
20-
// }
18+
if (!hasPermission("android.permission.CAMERA")) {
19+
requestPermission("android.permission.CAMERA");
20+
}
2121
// sphere = createShape(SPHERE, 400);
2222

2323
//Initialisation of AR Object

0 commit comments

Comments
 (0)