Skip to content

Commit e73624d

Browse files
project clean_up
1 parent 4e3eb55 commit e73624d

File tree

10 files changed

+33
-123
lines changed

10 files changed

+33
-123
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:versionCode="1" android:versionName="1.0" package="">
3+
<uses-sdk android:minSdkVersion="24" android:targetSdkVersion="26"/>
4+
<uses-permission android:name="android.permission.CAMERA"/>
5+
<uses-feature android:name="android.hardware.camera.ar" android:required="true"/>
6+
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
7+
<application android:allowBackup="false" android:icon="@drawable/icon" android:label="" android:theme="@style/ArActivityTheme" android:usesCleartextTraffic="false" tools:ignore="GoogleAppIndexingWarning">
8+
<activity android:configChanges="orientation|screenSize" android:exported="true" android:name=".MainActivity" android:screenOrientation="locked" android:theme="@style/Theme.AppCompat.NoActionBar">
9+
<intent-filter>
10+
<action android:name="android.intent.action.MAIN"/>
11+
<category android:name="android.intent.category.LAUNCHER"/>
12+
</intent-filter>
13+
</activity>
14+
<meta-data android:name="com.google.ar.core" android:value="required"/>
15+
</application>
16+
</manifest>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import processing.ar.*;
2+
import processing.ar.render.*;
3+
PShape cube;
4+
public void setup() {
5+
fullScreen(AR);
6+
cube = createShape(BOX, 0.25f);
7+
}
8+
public void draw() {
9+
lights();
10+
background(0);
11+
PPlane.setPlaneColor(0x00BCD4FF);
12+
shape(cube);
13+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
component=ar
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
mode=Android
2+
mode.id=processing.mode.android.AndroidMode

mode/libraries/ar/examples/Sphere/Sphere.pde

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import processing.ar.render.*;
33
PShape sphere;
44
public void setup() {
55
fullScreen(AR);
6-
sphere = createShape(SPHERE, 400);
6+
sphere = createShape(SPHERE, 0.25f);
77
}
88
public void draw() {
99
lights();

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

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,29 @@
1313

1414
public class PGraphicsAR extends PGraphics3D {
1515

16-
PMatrix3D modelViewMatrix;
17-
PMatrix3D projectionMatrix;
18-
PMatrix3D projModelMatrix;
19-
2016
public PGraphicsAR() {
2117
}
2218

2319
@Override
2420
protected PGL createPGL(PGraphicsOpenGL pGraphicsOpenGL) {
25-
PGraphicsAR.showWarning("Graphics: Creation");
2621
return new PGLES(pGraphicsOpenGL);
2722
}
2823

2924
@Override
3025
public void beginDraw() {
3126
super.beginDraw();
3227
updateInferences();
33-
PGraphicsAR.showWarning("Graphics: BeginDraw()");
3428
}
3529

3630
@Override
3731
protected void backgroundImpl() {
3832
if (session != null) {
3933
PSurfaceAR.performRendering();
4034
}
41-
PGraphicsAR.showWarning("Graphics: background()");
4235
}
4336

4437
@Override
4538
public void surfaceChanged() {
46-
PGraphicsAR.showWarning("Graphics: surfaceChanged()");
4739
}
4840

4941
public void updateInferences(){
@@ -52,15 +44,10 @@ public void updateInferences(){
5244

5345
protected void setAR() {
5446
if (PSurfaceAR.projmtx != null && PSurfaceAR.viewmtx != null && PSurfaceAR.anchorMatrix != null) {
55-
// if(PSurfaceAR.viewmtx != null) {
5647
float[] prj = PSurfaceAR.projmtx;
5748
float[] view = PSurfaceAR.viewmtx;
5849
float[] anchor = PSurfaceAR.anchorMatrix;
5950

60-
PApplet.println("Applying AR transformations");
61-
62-
// ARCore are column-major, so the following indexing is correct:
63-
6451
// Fist, set all matrices to identity
6552
resetProjection();
6653
resetMatrix();
@@ -83,78 +70,6 @@ protected void setAR() {
8370
anchor[2], anchor[6], anchor[10], anchor[14],
8471
anchor[3], anchor[7], anchor[11], anchor[15]);
8572

86-
87-
88-
89-
/*
90-
// Testing row-major order, just in case...
91-
applyProjection(prj[0], prj[1], prj[2], prj[3],
92-
prj[4], prj[5], prj[6], prj[7],
93-
prj[8], prj[9], prj[10], prj[11],
94-
prj[12], prj[13], prj[14], prj[15]);
95-
applyMatrix(view[0], view[1], view[2], view[3],
96-
view[4], view[5], view[6], view[7],
97-
view[8], view[9], view[10], view[11],
98-
view[12], view[13], view[14], view[15]);
99-
applyMatrix(anchor[0], anchor[1], anchor[2], anchor[3],
100-
anchor[4], anchor[5], anchor[6], anchor[7],
101-
anchor[8], anchor[9], anchor[10], anchor[11],
102-
anchor[12], anchor[13], anchor[14], anchor[15]);
103-
*/
104-
105-
PApplet.println("Anchor matrix: ", anchor[0], anchor[4], anchor[8], anchor[12],
106-
anchor[1], anchor[5], anchor[9], anchor[13],
107-
anchor[2], anchor[6], anchor[10], anchor[14],
108-
anchor[3], anchor[7], anchor[11], anchor[15]);
109-
110-
111-
112-
113-
/*
114-
modelview.set(PSurfaceAR.viewmtx[0], PSurfaceAR.viewmtx[4], PSurfaceAR.viewmtx[8], PSurfaceAR.viewmtx[12],
115-
PSurfaceAR.viewmtx[1], PSurfaceAR.viewmtx[5], PSurfaceAR.viewmtx[9], PSurfaceAR.viewmtx[13],
116-
PSurfaceAR.viewmtx[2], PSurfaceAR.viewmtx[6], PSurfaceAR.viewmtx[10], PSurfaceAR.viewmtx[14],
117-
PSurfaceAR.viewmtx[3], PSurfaceAR.viewmtx[7], PSurfaceAR.viewmtx[11], PSurfaceAR.viewmtx[15]);
118-
119-
modelViewMatrix = modelview.get();
120-
projModelMatrix = projmodelview.get();
121-
projectionMatrix = projection.get();
122-
123-
float tx = -defCameraX + mainPose.tx();
124-
float ty = -defCameraY + mainPose.ty();
125-
float tz = -defCameraZ + mainPose.tz();
126-
modelview.translate(tx, ty, tz);
127-
128-
camera.set(modelViewMatrix);
129-
updateProjmodelview();
130-
*/
131-
132-
133-
/*
134-
virtualObject.updateModelMatrix(anchorMatrix, scaleFactor);
135-
updateModelMatrix(float[] modelMatrix, float scaleFactor)
136-
137-
float[] scaleMatrix = new float[16];
138-
Matrix.setIdentityM(scaleMatrix, 0);
139-
scaleMatrix[0] = scaleFactor;
140-
scaleMatrix[5] = scaleFactor;
141-
scaleMatrix[10] = scaleFactor;
142-
Matrix.multiplyMM(this.modelMatrix, 0, modelMatrix, 0, scaleMatrix, 0);
143-
144-
*/
145-
146-
/*
147-
virtualObject.draw(viewmtx, projmtx, lightIntensity);
148-
draw(float[] cameraView, float[] cameraPerspective, float lightIntensity)
149-
Matrix.multiplyMM(modelViewMatrix, 0, cameraView, 0, modelMatrix, 0);
150-
Matrix.multiplyMM(modelViewProjectionMatrix, 0, cameraPerspective, 0, modelViewMatrix, 0);
151-
152-
153-
*/
154-
15573
}
156-
// PGraphicsAR.showWarning("Graphics: ARCamera()");
157-
// PGraphicsAR.showWarning("MV === "+modelViewMatrix+"\nPMM === "+projModelMatrix+"\nPM === "+projectionMatrix+"\n");
158-
// PGraphicsAR.showWarning("+++ "+PSurfaceAR.viewmtx);
15974
}
16075
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ public class PGraphicsARView extends PGraphicsAR {
99
@Override
1010
public PSurface createSurface(AppComponent appComponent, SurfaceHolder surfaceHolder, boolean b) {
1111
if (b) pgl.resetFBOLayer();
12-
PGraphics.showWarning("Reached - 1");
1312
return new PSurfaceAR(this, appComponent, surfaceHolder);
1413
}
1514
}

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

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -87,33 +87,28 @@ public PSurfaceAR(PGraphics graphics, AppComponent appComponent, SurfaceHolder s
8787

8888
displayRotationHelper = new RotationHandler(activity);
8989
surfaceView = new SurfaceViewAR(activity);
90-
PGraphics.showWarning("Reached - 2");
9190

9291
progressdialog.setMessage("Searching for Surfaces");
9392
progressdialog.show();
9493
}
9594

9695
@Override
9796
public Context getContext() {
98-
PGraphics.showWarning("Reached - 5");
9997
return activity;
10098
}
10199

102100
@Override
103101
public void finish() {
104-
PGraphics.showWarning("Reached - 6");
105102
sketch.getActivity().finish();
106103
}
107104

108105
@Override
109106
public AssetManager getAssets() {
110-
PGraphics.showWarning("Reached - 7");
111107
return sketch.getContext().getAssets();
112108
}
113109

114110
@Override
115111
public void startActivity(Intent intent) {
116-
PGraphics.showWarning("Reached - 8");
117112
sketch.getContext().startActivity(intent);
118113
}
119114

@@ -132,41 +127,34 @@ public void initView(int sketchWidth, int sketchHeight) {
132127
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
133128

134129
window.setContentView(surfaceView);
135-
PGraphics.showWarning("Reached - 9");
136130
}
137131

138132
@Override
139133
public String getName() {
140-
PGraphics.showWarning("Reached - 10");
141134
return sketch.getActivity().getComponentName().getPackageName();
142135
}
143136

144137
@Override
145138
public void setOrientation(int which) {
146-
PGraphics.showWarning("Reached - 11");
147139
}
148140

149141
@Override
150142
public File getFilesDir() {
151-
PGraphics.showWarning("Reached - 12");
152143
return sketch.getActivity().getFilesDir();
153144
}
154145

155146
@Override
156147
public InputStream openFileInput(String filename) {
157-
PGraphics.showWarning("Reached - 13");
158148
return null;
159149
}
160150

161151
@Override
162152
public File getFileStreamPath(String path) {
163-
PGraphics.showWarning("Reached - 14");
164153
return sketch.getActivity().getFileStreamPath(path);
165154
}
166155

167156
@Override
168157
public void dispose() {
169-
PGraphics.showWarning("Reached - 15");
170158
}
171159

172160

@@ -175,7 +163,6 @@ public SurfaceViewAR(Context context) {
175163
super(context);
176164
sketch.setup();
177165
sketch.draw();
178-
PGraphics.showWarning("Reached - 4");
179166

180167
final ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
181168
final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
@@ -200,7 +187,6 @@ public SurfaceViewAR(Context context) {
200187
@Override
201188
public boolean onTouchEvent(MotionEvent event) {
202189
queuedTaps.offer(event);
203-
PGraphics.showWarning("Reached - onTouchEvent()");
204190
return sketch.surfaceTouchEvent(event);
205191
}
206192

@@ -226,13 +212,11 @@ public AndroidARRenderer getARRenderer() {
226212

227213
protected class AndroidARRenderer implements GLSurfaceView.Renderer {
228214
public AndroidARRenderer() {
229-
PGraphics.showWarning("Reached - 3");
230215
}
231216

232217
@Override
233218
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
234219
pgl.getGL(null);
235-
PGraphics.showWarning("Reached - 16");
236220
GLES20.glClearColor(0.1f, 0.1f, 0.1f, 1.0f);
237221
backgroundRenderer.createOnGlThread(activity);
238222
if(OBJ_NAME != null && OBJ_TEX != null) {
@@ -245,17 +229,14 @@ public void onSurfaceCreated(GL10 gl, EGLConfig config) {
245229
}
246230
try {
247231
planeRenderer.createOnGlThread(activity, PLANE_TEXTURE);
248-
PGraphics.showWarning("Reached - 22"+" ===== "+PLANE_TEXTURE);
249232
} catch (IOException e) {
250233
PGraphics.showWarning("Failed to read plane texture");
251-
PGraphics.showWarning("Reached - 23");
252234
}
253235
pointCloud.createOnGlThread(activity);
254236
}
255237

256238
@Override
257239
public void onSurfaceChanged(GL10 gl, int width, int height) {
258-
PGraphics.showWarning("Reached - 20");
259240
displayRotationHelper.onSurfaceChanged(width, height);
260241
GLES20.glViewport(0, 0, width, height);
261242

@@ -268,7 +249,6 @@ public void onSurfaceChanged(GL10 gl, int width, int height) {
268249

269250
@Override
270251
public void onDrawFrame(GL10 gl) {
271-
PGraphics.showWarning("Reached - 21");
272252
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
273253

274254
if (session == null) {
@@ -327,9 +307,6 @@ public static void performRendering(){
327307
viewmtx = new float[16];
328308
camera.getViewMatrix(viewmtx, 0);
329309
lightIntensity = frame.getLightEstimate().getPixelIntensity();
330-
// for(int i=0;i<16;i++){
331-
// PGraphics.showWarning(i+") Proj value: "+projmtx[i]+"\n"+i+") View mat: "+viewmtx[i]+"\n");
332-
// }
333310
PointCloud foundPointCloud = frame.acquirePointCloud();
334311
pointCloud.update(foundPointCloud);
335312
pointCloud.draw(viewmtx, projmtx);
@@ -352,22 +329,17 @@ public static void performRendering(){
352329
virtualObject.draw(viewmtx, projmtx, lightIntensity);
353330
}
354331
}
355-
356-
PGraphics.showWarning("Reached - 24");
357332
} catch (Throwable t) {
358333
PGraphics.showWarning("Exception on the OpenGL thread");
359-
PGraphics.showWarning("Reached - 25");
360334
}
361335
}
362336

363337
@Override
364338
public void startThread() {
365-
PGraphics.showWarning("Reached - 17");
366339
}
367340

368341
@Override
369342
public void pauseThread() {
370-
PGraphics.showWarning("Reached - 18");
371343
if (session != null) {
372344
displayRotationHelper.onPause();
373345
surfaceView.onPause();
@@ -377,7 +349,6 @@ public void pauseThread() {
377349

378350
@Override
379351
public void resumeThread() {
380-
PGraphics.showWarning("Reached - 19");
381352
if (session == null) {
382353
String message = null;
383354
String exception = null;

mode/libraries/ar/src/processing/ar/render/PObject.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,10 @@ private static void normalizeVec3(float[] v) {
253253
public void load(String obj_name,String obj_texture){
254254
OBJ_NAME = obj_name;
255255
OBJ_TEX = obj_texture;
256-
PGraphics.showWarning("Object LOAD reached ========= "+OBJ_NAME+" ======== "+OBJ_TEX);
257256
}
258257

259258
public void place(){
260259
PLACED = true;
261-
PGraphics.showWarning("Object place() command received");
262260
}
263261

264262
}

mode/libraries/ar/src/processing/ar/render/PPlane.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,7 @@ public int compare(SortablePlane a, SortablePlane b) {
314314
planeIndexMap.put(plane, planeIndex);
315315
}
316316

317-
// setPlaneColor(0xFFFFFFFF);
318-
319317
colorRgbaToFloat(planeColor, colorValue);
320-
PGraphics.showWarning("Value assigned Max effort");
321318
GLES20.glUniform4fv(lineColorUniform, 1, planeColor, 0);
322319
GLES20.glUniform4fv(dotColorUniform, 1, planeColor, 0);
323320

@@ -350,12 +347,10 @@ private static void colorRgbaToFloat(float[] planeColor, int colorRgba) {
350347

351348
public static void setPlaneColor(int color){
352349
colorValue = color;
353-
PGraphics.showWarning("Value assigned");
354350
}
355351

356352
public static void setPlaneTexture(String planeTexture){
357353
PLANE_TEXTURE = planeTexture;
358-
PGraphics.showWarning("Texture assigned ======= "+PLANE_TEXTURE);
359354
}
360355

361356
}

0 commit comments

Comments
 (0)