From cd845589eea6c7773007e013bd5f2f37242cbe1a Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 18 Apr 2023 04:39:07 +0200 Subject: GraphUI Demos: Move GraphUIDemoArgs to sub-package util --- .../opengl/demos/graph/ui/GraphUIDemoArgs.java | 115 --------------------- .../opengl/demos/graph/ui/UISceneDemo00.java | 1 + .../opengl/demos/graph/ui/UISceneDemo01.java | 1 + .../opengl/demos/graph/ui/UISceneDemo01b.java | 1 + .../opengl/demos/graph/ui/UISceneDemo03.java | 1 + .../opengl/demos/graph/ui/UISceneDemo03b.java | 1 + .../opengl/demos/graph/ui/UISceneDemo10.java | 1 + .../opengl/demos/graph/ui/UISceneDemo11.java | 2 +- .../opengl/demos/graph/ui/UISceneDemo20.java | 1 + .../demos/graph/ui/util/GraphUIDemoArgs.java | 115 +++++++++++++++++++++ 10 files changed, 123 insertions(+), 116 deletions(-) delete mode 100644 src/demos/com/jogamp/opengl/demos/graph/ui/GraphUIDemoArgs.java create mode 100644 src/demos/com/jogamp/opengl/demos/graph/ui/util/GraphUIDemoArgs.java (limited to 'src/demos/com/jogamp') diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/GraphUIDemoArgs.java b/src/demos/com/jogamp/opengl/demos/graph/ui/GraphUIDemoArgs.java deleted file mode 100644 index a646ab691..000000000 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/GraphUIDemoArgs.java +++ /dev/null @@ -1,115 +0,0 @@ -/** - * Copyright 2023 JogAmp Community. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of JogAmp Community. - */ -package com.jogamp.opengl.demos.graph.ui; - -import com.jogamp.graph.curve.Region; -import com.jogamp.opengl.GLProfile; -import com.jogamp.opengl.demos.util.MiscUtils; - -public class GraphUIDemoArgs { - public int surface_width, surface_height; - public String glProfileName = GLProfile.GL2ES2; - public boolean wait_to_start = false; - public boolean keepRunning = false; - public boolean stayOpen = false; - public int renderModes; - public int sceneMSAASamples = 0; - public float debugBoxThickness = 0f; - - public GraphUIDemoArgs(final int width, final int height, final int renderModes) { - this.surface_width = width; - this.surface_height = height; - this.renderModes = renderModes; - } - public void parse(final String[] args) { - final int[] idx = { 0 }; - for (idx[0] = 0; idx[0] < args.length; ++idx[0]) { - parse(args, idx); - } - } - public boolean parse(final String[] args, final int[] idx) { - if( 0 > idx[0] || idx[0] >= args.length ) { - return false; - } - boolean res = true; - if (args[idx[0]].equals("-hhd")) { - surface_width = 1280; - surface_height = 720; - } else if (args[idx[0]].equals("-fhd")) { - surface_width = 1920; - surface_height = 1080; - } else if (args[idx[0]].equals("-w")) { - ++idx[0]; - surface_width = MiscUtils.atoi(args[idx[0]], surface_width); - } else if (args[idx[0]].equals("-h")) { - ++idx[0]; - surface_height = MiscUtils.atoi(args[idx[0]], surface_height); - } else if(args[idx[0]].equals("-es2")) { - glProfileName = GLProfile.GLES2; - } else if(args[idx[0]].equals("-es3")) { - glProfileName = GLProfile.GLES3; - } else if(args[idx[0]].equals("-gl3")) { - glProfileName = GLProfile.GL3; - } else if(args[idx[0]].equals("-gldef")) { - glProfileName = null; - } else if(args[idx[0]].equals("-wait")) { - wait_to_start = true; - } else if (args[idx[0]].equals("-keep")) { - keepRunning = true; - stayOpen = true; - } else if (args[idx[0]].equals("-stay")) { - stayOpen = true; - } else if(args[idx[0]].equals("-gnone")) { - sceneMSAASamples = 0; - renderModes = 0; - } else if(args[idx[0]].equals("-smsaa")) { - ++idx[0]; - sceneMSAASamples = MiscUtils.atoi(args[idx[0]], 4); - renderModes = 0; - } else if(args[idx[0]].equals("-gmsaa")) { - sceneMSAASamples = 0; - renderModes = Region.MSAA_RENDERING_BIT; - } else if(args[idx[0]].equals("-gvbaa")) { - sceneMSAASamples = 0; - renderModes = Region.VBAA_RENDERING_BIT; - } else if (args[idx[0]].equals("-dbgbox")) { - ++idx[0]; - debugBoxThickness = MiscUtils.atof(args[idx[0]], debugBoxThickness); - } else { - res = false; - } - return res; - } - @Override - public String toString() { - return "Options{surface[width "+surface_width+" x "+surface_height+"], glp "+glProfileName+ - ", wait "+wait_to_start+", keep "+keepRunning+", stay "+stayOpen+ - ", renderModes "+Region.getRenderModeString(renderModes)+ - ", smsaa "+sceneMSAASamples+", dbgbox "+debugBoxThickness+"}"; - } -} diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java index ea64bd89e..9c8177699 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java @@ -43,6 +43,7 @@ import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.GL; import com.jogamp.opengl.GLCapabilities; import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.demos.graph.ui.util.GraphUIDemoArgs; import com.jogamp.opengl.math.geom.AABBox; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.util.PMVMatrix; diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java index 153dd5b51..1bebb8e40 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java @@ -46,6 +46,7 @@ import com.jogamp.opengl.GL; import com.jogamp.opengl.GLCapabilities; import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.demos.es2.GearsES2; +import com.jogamp.opengl.demos.graph.ui.util.GraphUIDemoArgs; import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.opengl.math.Recti; import com.jogamp.opengl.math.geom.AABBox; diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01b.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01b.java index 568a5059c..5144d9150 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01b.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01b.java @@ -47,6 +47,7 @@ import com.jogamp.opengl.GL; import com.jogamp.opengl.GLCapabilities; import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.demos.es2.GearsES2; +import com.jogamp.opengl.demos.graph.ui.util.GraphUIDemoArgs; import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.opengl.math.FloatUtil; import com.jogamp.opengl.math.Recti; diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java index 6a99fea71..c5aa32d55 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03.java @@ -53,6 +53,7 @@ import com.jogamp.opengl.GL2ES2; import com.jogamp.opengl.GLCapabilities; import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.demos.graph.FontSetDemos; +import com.jogamp.opengl.demos.graph.ui.util.GraphUIDemoArgs; import com.jogamp.opengl.demos.util.MiscUtils; import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.opengl.math.FloatUtil; diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03b.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03b.java index 572592b48..1668ec883 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03b.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo03b.java @@ -58,6 +58,7 @@ import com.jogamp.opengl.GLCapabilities; import com.jogamp.opengl.GLEventListener; import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.demos.graph.FontSetDemos; +import com.jogamp.opengl.demos.graph.ui.util.GraphUIDemoArgs; import com.jogamp.opengl.demos.util.MiscUtils; import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.opengl.math.FloatUtil; diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java index dbbde184f..30babc583 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java @@ -55,6 +55,7 @@ import com.jogamp.opengl.GLCapabilities; import com.jogamp.opengl.GLEventListener; import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.demos.es2.GearsES2; +import com.jogamp.opengl.demos.graph.ui.util.GraphUIDemoArgs; import com.jogamp.opengl.math.Recti; import com.jogamp.opengl.math.Vec3f; import com.jogamp.opengl.math.geom.AABBox; diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo11.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo11.java index 0479349b7..68ee8da94 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo11.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo11.java @@ -48,7 +48,7 @@ import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.GL; import com.jogamp.opengl.GLCapabilities; import com.jogamp.opengl.GLProfile; -import com.jogamp.opengl.demos.es2.GearsES2; +import com.jogamp.opengl.demos.graph.ui.util.GraphUIDemoArgs; import com.jogamp.opengl.math.geom.AABBox; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.util.PMVMatrix; diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java index aa851482f..143b40651 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java @@ -80,6 +80,7 @@ import com.jogamp.opengl.JoglVersion; import com.jogamp.opengl.demos.es2.GearsES2; import com.jogamp.opengl.demos.graph.FontSetDemos; import com.jogamp.opengl.demos.graph.MSAATool; +import com.jogamp.opengl.demos.graph.ui.util.GraphUIDemoArgs; import com.jogamp.opengl.demos.util.MiscUtils; import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.opengl.math.FloatUtil; diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/util/GraphUIDemoArgs.java b/src/demos/com/jogamp/opengl/demos/graph/ui/util/GraphUIDemoArgs.java new file mode 100644 index 000000000..747ee771a --- /dev/null +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/util/GraphUIDemoArgs.java @@ -0,0 +1,115 @@ +/** + * Copyright 2023 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ +package com.jogamp.opengl.demos.graph.ui.util; + +import com.jogamp.graph.curve.Region; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.demos.util.MiscUtils; + +public class GraphUIDemoArgs { + public int surface_width, surface_height; + public String glProfileName = GLProfile.GL2ES2; + public boolean wait_to_start = false; + public boolean keepRunning = false; + public boolean stayOpen = false; + public int renderModes; + public int sceneMSAASamples = 0; + public float debugBoxThickness = 0f; + + public GraphUIDemoArgs(final int width, final int height, final int renderModes) { + this.surface_width = width; + this.surface_height = height; + this.renderModes = renderModes; + } + public void parse(final String[] args) { + final int[] idx = { 0 }; + for (idx[0] = 0; idx[0] < args.length; ++idx[0]) { + parse(args, idx); + } + } + public boolean parse(final String[] args, final int[] idx) { + if( 0 > idx[0] || idx[0] >= args.length ) { + return false; + } + boolean res = true; + if (args[idx[0]].equals("-hhd")) { + surface_width = 1280; + surface_height = 720; + } else if (args[idx[0]].equals("-fhd")) { + surface_width = 1920; + surface_height = 1080; + } else if (args[idx[0]].equals("-w")) { + ++idx[0]; + surface_width = MiscUtils.atoi(args[idx[0]], surface_width); + } else if (args[idx[0]].equals("-h")) { + ++idx[0]; + surface_height = MiscUtils.atoi(args[idx[0]], surface_height); + } else if(args[idx[0]].equals("-es2")) { + glProfileName = GLProfile.GLES2; + } else if(args[idx[0]].equals("-es3")) { + glProfileName = GLProfile.GLES3; + } else if(args[idx[0]].equals("-gl3")) { + glProfileName = GLProfile.GL3; + } else if(args[idx[0]].equals("-gldef")) { + glProfileName = null; + } else if(args[idx[0]].equals("-wait")) { + wait_to_start = true; + } else if (args[idx[0]].equals("-keep")) { + keepRunning = true; + stayOpen = true; + } else if (args[idx[0]].equals("-stay")) { + stayOpen = true; + } else if(args[idx[0]].equals("-gnone")) { + sceneMSAASamples = 0; + renderModes = 0; + } else if(args[idx[0]].equals("-smsaa")) { + ++idx[0]; + sceneMSAASamples = MiscUtils.atoi(args[idx[0]], 4); + renderModes = 0; + } else if(args[idx[0]].equals("-gmsaa")) { + sceneMSAASamples = 0; + renderModes = Region.MSAA_RENDERING_BIT; + } else if(args[idx[0]].equals("-gvbaa")) { + sceneMSAASamples = 0; + renderModes = Region.VBAA_RENDERING_BIT; + } else if (args[idx[0]].equals("-dbgbox")) { + ++idx[0]; + debugBoxThickness = MiscUtils.atof(args[idx[0]], debugBoxThickness); + } else { + res = false; + } + return res; + } + @Override + public String toString() { + return "Options{surface[width "+surface_width+" x "+surface_height+"], glp "+glProfileName+ + ", wait "+wait_to_start+", keep "+keepRunning+", stay "+stayOpen+ + ", renderModes "+Region.getRenderModeString(renderModes)+ + ", smsaa "+sceneMSAASamples+", dbgbox "+debugBoxThickness+"}"; + } +} -- cgit v1.2.3