diff options
author | Sven Gothel <[email protected]> | 2023-03-20 07:04:54 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-03-20 07:04:54 +0100 |
commit | 0d7aa5218c36b291b2d24c8c9bb118b2a8d2e71a (patch) | |
tree | a5e756be7f688c406f4f44b3a6023f87408a32d0 | |
parent | 1cb97973a7403fe1b47665e8250bc568444301da (diff) |
GraphUI Scene: Move GLEventListener implementations reshape() and dispose() to the others, init(), display(). Ease review.
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java b/src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java index 47411f60f..d94ff286a 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java @@ -265,6 +265,25 @@ public final class Scene implements GLEventListener { display(drawable, shapesS, false); } + /** + * Reshape scene using {@link #setupMatrix(PMVMatrix, int, int, int, int)} using {@link PMVMatrixSetup}. + * <p> + * {@inheritDoc} + * </p> + * @see PMVMatrixSetup + * @see #setPMVMatrixSetup(PMVMatrixSetup) + * @see #setupMatrix(PMVMatrix, int, int, int, int) + * @see #getBounds() + * @see #getBoundsCenter() + */ + @Override + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { + renderer.reshapeNotify(x, y, width, height); + + setupMatrix(renderer.getMatrix(), x, y, width, height); + pmvMatrixSetup.setPlaneBox(planeBox, renderer.getMatrix(), x, y, width, height); + } + private static final int[] sampleCountGLSelect = { -1 }; private void display(final GLAutoDrawable drawable, final Object[] shapesS, final boolean glSelect) { @@ -339,6 +358,35 @@ public final class Scene implements GLEventListener { } /** + * Disposes all {@link #addShape(Shape) added} {@link Shape}s. + * <p> + * Implementation also issues {@link RegionRenderer#destroy(GL2ES2)} if set + * and {@link #detachInputListenerFrom(GLWindow)} in case the drawable is of type {@link GLWindow}. + * </p> + * <p> + * {@inheritDoc} + * </p> + */ + @Override + public void dispose(final GLAutoDrawable drawable) { + synchronized ( syncDisplayedOnce ) { + displayedOnce = false; + syncDisplayedOnce.notifyAll(); + } + if( drawable instanceof GLWindow ) { + final GLWindow glw = (GLWindow) drawable; + detachInputListenerFrom(glw); + } + final GL2ES2 gl = drawable.getGL().getGL2ES2(); + for(int i=0; i<shapes.size(); i++) { + shapes.get(i).destroy(gl, renderer); + } + shapes.clear(); + cDrawable = null; + renderer.destroy(gl); + } + + /** * Attempt to pick a {@link Shape} using the window coordinates and contained {@ling Shape}'s {@link AABBox} {@link Shape#getBounds() bounds} * using a ray-intersection algorithm. * <p> @@ -498,35 +546,6 @@ public final class Scene implements GLEventListener { } /** - * Disposes all {@link #addShape(Shape) added} {@link Shape}s. - * <p> - * Implementation also issues {@link RegionRenderer#destroy(GL2ES2)} if set - * and {@link #detachInputListenerFrom(GLWindow)} in case the drawable is of type {@link GLWindow}. - * </p> - * <p> - * {@inheritDoc} - * </p> - */ - @Override - public void dispose(final GLAutoDrawable drawable) { - synchronized ( syncDisplayedOnce ) { - displayedOnce = false; - syncDisplayedOnce.notifyAll(); - } - if( drawable instanceof GLWindow ) { - final GLWindow glw = (GLWindow) drawable; - detachInputListenerFrom(glw); - } - final GL2ES2 gl = drawable.getGL().getGL2ES2(); - for(int i=0; i<shapes.size(); i++) { - shapes.get(i).destroy(gl, renderer); - } - shapes.clear(); - cDrawable = null; - renderer.destroy(gl); - } - - /** * Interface providing {@link #set(PMVMatrix, int, int, int, int) a method} to * setup {@link PMVMatrix}'s {@link GLMatrixFunc#GL_PROJECTION} and {@link GLMatrixFunc#GL_MODELVIEW}. * <p> @@ -598,25 +617,6 @@ public final class Scene implements GLEventListener { public static PMVMatrixSetup getDefaultPMVMatrixSetup() { return defaultPMVMatrixSetup; } /** - * Reshape scene using {@link #setupMatrix(PMVMatrix, int, int, int, int)} using {@link PMVMatrixSetup}. - * <p> - * {@inheritDoc} - * </p> - * @see PMVMatrixSetup - * @see #setPMVMatrixSetup(PMVMatrixSetup) - * @see #setupMatrix(PMVMatrix, int, int, int, int) - * @see #getBounds() - * @see #getBoundsCenter() - */ - @Override - public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { - renderer.reshapeNotify(x, y, width, height); - - setupMatrix(renderer.getMatrix(), x, y, width, height); - pmvMatrixSetup.setPlaneBox(planeBox, renderer.getMatrix(), x, y, width, height); - } - - /** * Setup {@link PMVMatrix} {@link GLMatrixFunc#GL_PROJECTION} and {@link GLMatrixFunc#GL_MODELVIEW} * by calling {@link #getPMVMatrixSetup()}'s {@link PMVMatrixSetup#set(PMVMatrix, int, int, int, int)}. * @param pmv the {@link PMVMatrix} to setup |