File tree Expand file tree Collapse file tree 1 file changed +23
-3
lines changed
libraries/vr/src/processing/vr Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Original file line number Diff line number Diff line change 28
28
29
29
import processing .core .PApplet ;
30
30
import processing .core .PGraphics ;
31
+ import processing .core .PMatrix3D ;
31
32
import processing .opengl .PGL ;
32
33
import processing .opengl .PGLES ;
33
34
import processing .opengl .PGraphics3D ;
@@ -43,18 +44,36 @@ public class PGraphicsVR extends PGraphics3D {
43
44
public float forwardY ;
44
45
public float forwardZ ;
45
46
46
- // Eye properties
47
- private Viewport eyeViewport ;
48
47
private float [] forwardVector ;
48
+ private Viewport eyeViewport ;
49
49
private float [] eyeView ;
50
50
private float [] eyePerspective ;
51
51
52
+
52
53
@ Override
53
54
protected PGL createPGL (PGraphicsOpenGL pg ) {
54
55
return new PGLES (pg );
55
56
}
56
57
57
58
59
+ public PMatrix3D getObjectMatrix () {
60
+ PMatrix3D mat = new PMatrix3D ();
61
+ mat .set (modelviewInv );
62
+ mat .apply (camera );
63
+ return mat ;
64
+ }
65
+
66
+
67
+ public PMatrix3D getObjectMatrix (PMatrix3D target ) {
68
+ if (target == null ) {
69
+ target = new PMatrix3D ();
70
+ }
71
+ target .set (modelviewInv );
72
+ target .apply (camera );
73
+ return target ;
74
+ }
75
+
76
+
58
77
@ Override
59
78
public void beginDraw () {
60
79
super .beginDraw ();
@@ -196,13 +215,14 @@ protected void eyeTransform(Eye e) {
196
215
}
197
216
198
217
199
- private void initVR () {
218
+ protected void initVR () {
200
219
if (!initialized ) {
201
220
forwardVector = new float [3 ];
202
221
initialized = true ;
203
222
}
204
223
}
205
224
225
+
206
226
@ Override
207
227
protected void updateGLNormal () {
208
228
if (glNormal == null ) {
You can’t perform that action at this time.
0 commit comments