diff options
author | Sven Gothel <[email protected]> | 2023-03-20 06:15:38 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-03-20 06:15:38 +0100 |
commit | ac53d2e06c14e808529d8e653a9ec6a1438acfc0 (patch) | |
tree | 999f996eaecff929f91996598fe07256def5fa24 /src/demos | |
parent | 8f9aedd75946fabfa56f3b58a097ab434a83f1d2 (diff) |
Demos GearsES2: Expose view rotation vars and listener
Diffstat (limited to 'src/demos')
-rw-r--r-- | src/demos/com/jogamp/opengl/demos/es2/GearsES2.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/es2/GearsES2.java b/src/demos/com/jogamp/opengl/demos/es2/GearsES2.java index 23cd8978d..02c451e9f 100644 --- a/src/demos/com/jogamp/opengl/demos/es2/GearsES2.java +++ b/src/demos/com/jogamp/opengl/demos/es2/GearsES2.java @@ -67,7 +67,7 @@ public class GearsES2 implements StereoGLEventListener, TileRendererBase.TileRen private PMVMatrix pmvMatrix = null; private GLUniformData pmvMatrixUniform = null; private GLUniformData colorU = null; - private float view_rotx = 20.0f, view_roty = 30.0f; + private volatile float view_rotx = 20.0f, view_roty = 30.0f; private boolean flipVerticalInGLOrientation = false; private final boolean customRendering = false; @@ -149,6 +149,11 @@ public class GearsES2 implements StereoGLEventListener, TileRendererBase.TileRen syncObjects = sync; } + public float getRotX() { return view_rotx; } + public float getRotY() { return view_roty; } + public void setRotX(final float v) { view_rotx = v; } + public void setRotY(final float v) { view_roty = v; } + /** * @return gear1 */ @@ -564,7 +569,11 @@ public class GearsES2 implements StereoGLEventListener, TileRendererBase.TileRen return "GearsES2[obj "+sid()+" isInit "+isInit+", usesShared "+usesSharedGears+", 1 "+gear1+", 2 "+gear2+", 3 "+gear3+", sharedGears "+sharedGears+"]"; } + public KeyListener getKeyListener() { return this.gearsKeys; } + public MouseListener getMouseListener() { return this.gearsMouse; } + class GearsKeyAdapter extends KeyAdapter { + @Override public void keyPressed(final KeyEvent e) { final int kc = e.getKeyCode(); if(KeyEvent.VK_LEFT == kc) { @@ -609,6 +618,7 @@ public class GearsES2 implements StereoGLEventListener, TileRendererBase.TileRen } } + @Override public void mousePressed(final MouseEvent e) { if( e.getPointerCount()==1 ) { prevMouseX = e.getX(); @@ -621,9 +631,11 @@ public class GearsES2 implements StereoGLEventListener, TileRendererBase.TileRen } } + @Override public void mouseReleased(final MouseEvent e) { } + @Override public void mouseMoved(final MouseEvent e) { if( e.isConfined() ) { navigate(e); @@ -635,6 +647,7 @@ public class GearsES2 implements StereoGLEventListener, TileRendererBase.TileRen } } + @Override public void mouseDragged(final MouseEvent e) { navigate(e); } |