Skip to content

Commit 4cc3b33

Browse files
committed
formatting
1 parent c7ad979 commit 4cc3b33

File tree

3 files changed

+443
-413
lines changed

3 files changed

+443
-413
lines changed
Lines changed: 84 additions & 62 deletions
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 android.view.SurfaceHolder;
@@ -16,69 +38,69 @@
1638

1739
public class PGraphicsAR extends PGraphics3D {
1840

19-
public PGraphicsAR() {
20-
}
21-
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-
28-
@Override
29-
protected PGL createPGL(PGraphicsOpenGL pGraphicsOpenGL) {
30-
return new PGLES(pGraphicsOpenGL);
31-
}
32-
33-
@Override
34-
public void beginDraw() {
35-
super.beginDraw();
36-
updateInferences();
37-
}
38-
39-
@Override
40-
protected void backgroundImpl() {
41-
if (session != null) {
42-
PSurfaceAR.performRendering();
43-
}
44-
}
45-
46-
@Override
47-
public void surfaceChanged() {
48-
}
49-
50-
public void updateInferences(){
51-
setAR();
41+
public PGraphicsAR() {
42+
}
43+
44+
@Override
45+
public PSurface createSurface(AppComponent appComponent, SurfaceHolder surfaceHolder, boolean b) {
46+
if (b) pgl.resetFBOLayer();
47+
return new PSurfaceAR(this, appComponent, surfaceHolder);
48+
}
49+
50+
@Override
51+
protected PGL createPGL(PGraphicsOpenGL pGraphicsOpenGL) {
52+
return new PGLES(pGraphicsOpenGL);
53+
}
54+
55+
@Override
56+
public void beginDraw() {
57+
super.beginDraw();
58+
updateInferences();
59+
}
60+
61+
@Override
62+
protected void backgroundImpl() {
63+
if (session != null) {
64+
PSurfaceAR.performRendering();
5265
}
66+
}
67+
68+
@Override
69+
public void surfaceChanged() {
70+
}
71+
72+
public void updateInferences() {
73+
setAR();
74+
}
75+
76+
protected void setAR() {
77+
if (PSurfaceAR.projmtx != null && PSurfaceAR.viewmtx != null && PSurfaceAR.anchorMatrix != null) {
78+
float[] prj = PSurfaceAR.projmtx;
79+
float[] view = PSurfaceAR.viewmtx;
80+
float[] anchor = PSurfaceAR.anchorMatrix;
81+
82+
// Fist, set all matrices to identity
83+
resetProjection();
84+
resetMatrix();
85+
86+
// Apply the projection matrix
87+
applyProjection(prj[0], prj[4], prj[8], prj[12],
88+
prj[1], prj[5], prj[9], prj[13],
89+
prj[2], prj[6], prj[10], prj[14],
90+
prj[3], prj[7], prj[11], prj[15]);
91+
92+
// make modelview = view
93+
applyMatrix(view[0], view[4], view[8], view[12],
94+
view[1], view[5], view[9], view[13],
95+
view[2], view[6], view[10], view[14],
96+
view[3], view[7], view[11], view[15]);
97+
98+
// now, modelview = view * anchor
99+
applyMatrix(anchor[0], anchor[4], anchor[8], anchor[12],
100+
anchor[1], anchor[5], anchor[9], anchor[13],
101+
anchor[2], anchor[6], anchor[10], anchor[14],
102+
anchor[3], anchor[7], anchor[11], anchor[15]);
53103

54-
protected void setAR() {
55-
if (PSurfaceAR.projmtx != null && PSurfaceAR.viewmtx != null && PSurfaceAR.anchorMatrix != null) {
56-
float[] prj = PSurfaceAR.projmtx;
57-
float[] view = PSurfaceAR.viewmtx;
58-
float[] anchor = PSurfaceAR.anchorMatrix;
59-
60-
// Fist, set all matrices to identity
61-
resetProjection();
62-
resetMatrix();
63-
64-
// Apply the projection matrix
65-
applyProjection(prj[0], prj[4], prj[8], prj[12],
66-
prj[1], prj[5], prj[9], prj[13],
67-
prj[2], prj[6], prj[10], prj[14],
68-
prj[3], prj[7], prj[11], prj[15]);
69-
70-
// make modelview = view
71-
applyMatrix(view[0], view[4], view[8], view[12],
72-
view[1], view[5], view[9], view[13],
73-
view[2], view[6], view[10], view[14],
74-
view[3], view[7], view[11], view[15]);
75-
76-
// now, modelview = view * anchor
77-
applyMatrix(anchor[0], anchor[4], anchor[8], anchor[12],
78-
anchor[1], anchor[5], anchor[9], anchor[13],
79-
anchor[2], anchor[6], anchor[10], anchor[14],
80-
anchor[3], anchor[7], anchor[11], anchor[15]);
81-
82-
}
83104
}
105+
}
84106
}

0 commit comments

Comments
 (0)