From 91a49ecb3f831ab1a91cc040bc013ad5da5dc5c4 Mon Sep 17 00:00:00 2001 From: kevin Date: Sun, 21 Nov 2021 23:33:56 -0600 Subject: [PATCH 01/18] =?UTF-8?q?This=20is=20a=20very=20simple=20addition.?= =?UTF-8?q?=20It=20allows=20a=20person=20to=20set=203=20variables=20in=20A?= =?UTF-8?q?ppSettings.=20=E2=80=98CenterWindow=E2=80=99,=20=E2=80=98Window?= =?UTF-8?q?XPosition=E2=80=99=20and=20=E2=80=98WindowYPosition=E2=80=99=20?= =?UTF-8?q?variables.=20This=20way=20these=20variable=20will=20be=20saved?= =?UTF-8?q?=20in=20the=20profile=20when=20the=20profile=20is=20saved,=20an?= =?UTF-8?q?d=20be=20reloaded.=20I=20added=20=E2=80=98CenterWindow=E2=80=99?= =?UTF-8?q?=20to=20be=20added=20with=20a=20=E2=80=98true=E2=80=99=20value?= =?UTF-8?q?=20for=20the=20default=20value=20so=20it=20will=20run=20just=20?= =?UTF-8?q?like=20it=20did=20before.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit But if you set ‘CenterWindow’ to ‘false’ then inside LwjglWindow.java (lwjgl3 code) it will look at these new values, it will determine to center the window or use the position values to place the window back at the location the user last moved it to. Of course, these values are only updated if the “program” updates this value. So if you want to save screen position, you can save them on closing to and on restart put the window back into the same location. --- .../java/com/jme3/system/AppSettings.java | 62 +++++++++++++++++++ .../com/jme3/system/lwjgl/LwjglWindow.java | 9 ++- 2 files changed, 69 insertions(+), 2 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/system/AppSettings.java b/jme3-core/src/main/java/com/jme3/system/AppSettings.java index 7617b1d38b..9c89260a33 100644 --- a/jme3-core/src/main/java/com/jme3/system/AppSettings.java +++ b/jme3-core/src/main/java/com/jme3/system/AppSettings.java @@ -266,6 +266,7 @@ public final class AppSettings extends HashMap { public static final String JOAL = "JOAL"; static { + defaults.put("CenterWindow", true); defaults.put("Width", 640); defaults.put("Height", 480); defaults.put("BitsPerPixel", 24); @@ -1350,4 +1351,65 @@ public boolean isUseRetinaFrameBuffer() { public void setUseRetinaFrameBuffer(boolean useRetinaFrameBuffer) { putBoolean("UseRetinaFrameBuffer", useRetinaFrameBuffer); } + + /** + * Get the Center Window state + * + * @return true for center the window in the middle of the screen + * @see #setCenterWindow(boolean) + */ + public boolean getCenterWindow() { + return getBoolean("CenterWindow"); + } + + /** + * True to enable center the window. + * + * @param center whether to center the window or not. + */ + public void setCenterWindow(boolean center) { + putBoolean("CenterWindow", center); + } + + + /** + * Get the position of the window's X Position + * + * @return int screen coordinates of the X Position of the window + * @see #setWindowXPosition(int) + */ + public int getWindowXPosition() { + return getInteger("windowXpos"); + } + + /** + * The position of the window's X Position. + * + * @param pos screen coordinates for the X position. + */ + public void setWindowXPosition(int pos) { + putInteger("windowXpos", pos); + } + + + /** + * Get the position of the window's Y Position + * + * @return int screen coordinates of the Y Position of the window + * @see #setWindowXPosition(int) + */ + public int getWindowYPosition() { + return getInteger("windowYpos"); + } + + /** + * The position of the window's Y Position. + * + * @param pos screen coordinates for the Y position. + */ + public void setWindowYPosition(int pos) { + putInteger("windowYpos", pos); + } + + } diff --git a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java index abf13eb1c5..19be449111 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java @@ -276,11 +276,16 @@ public void invoke(final long window, final boolean focus) { } }); - // Center the window if (!settings.isFullscreen()) { - glfwSetWindowPos(window, + if (settings.getCenterWindow()) + { + // Center the window + glfwSetWindowPos(window, (videoMode.width() - settings.getWidth()) / 2, (videoMode.height() - settings.getHeight()) / 2); + } else { + glfwSetWindowPos(window,settings.getWindowXPosition(), settings.getWindowYPosition()); + } } // Make the OpenGL context current From ce2471656fe8d3874ab5a1d4f1f87753839508cb Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 23 Nov 2021 23:43:34 -0600 Subject: [PATCH 02/18] formatting and comments changes. --- .../java/com/jme3/system/AppSettings.java | 26 +++++++++++++------ .../com/jme3/system/lwjgl/LwjglWindow.java | 3 +-- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/system/AppSettings.java b/jme3-core/src/main/java/com/jme3/system/AppSettings.java index 9c89260a33..4ecf733682 100644 --- a/jme3-core/src/main/java/com/jme3/system/AppSettings.java +++ b/jme3-core/src/main/java/com/jme3/system/AppSettings.java @@ -291,6 +291,8 @@ public final class AppSettings extends HashMap { defaults.put("OpenCL", false); defaults.put("OpenCLPlatformChooser", DefaultPlatformChooser.class.getName()); defaults.put("UseRetinaFrameBuffer", true);// MacOS spec + defaults.put("windowYpos", 0); + defaults.put("windowXpos", 0); // defaults.put("Icons", null); } @@ -1353,9 +1355,9 @@ public void setUseRetinaFrameBuffer(boolean useRetinaFrameBuffer) { } /** - * Get the Center Window state + * Get the Centering Window state * - * @return true for center the window in the middle of the screen + * @return true to center the window in the middle of the screen * @see #setCenterWindow(boolean) */ public boolean getCenterWindow() { @@ -1363,7 +1365,7 @@ public boolean getCenterWindow() { } /** - * True to enable center the window. + * True to enable centering the window. * * @param center whether to center the window or not. */ @@ -1373,7 +1375,9 @@ public void setCenterWindow(boolean center) { /** - * Get the position of the window's X Position + * Get the window's X Position on the screen. + * This value is ignored when CenterWindow is set to true + * @see #setCenterWindow(boolean) * * @return int screen coordinates of the X Position of the window * @see #setWindowXPosition(int) @@ -1383,7 +1387,9 @@ public int getWindowXPosition() { } /** - * The position of the window's X Position. + * Set the window's X Position on the screen. + * This value is ignored when CenterWindow is set to true + * @see #setCenterWindow(boolean) * * @param pos screen coordinates for the X position. */ @@ -1393,7 +1399,9 @@ public void setWindowXPosition(int pos) { /** - * Get the position of the window's Y Position + * Get the window's Y Position on the screen. + * This value is ignored when CenterWindow is set to true + * @see #setCenterWindow(boolean) * * @return int screen coordinates of the Y Position of the window * @see #setWindowXPosition(int) @@ -1403,9 +1411,11 @@ public int getWindowYPosition() { } /** - * The position of the window's Y Position. + * Set the window's Y Position on the screen. + * This value is ignored when CenterWindow is set to true + * @see #setCenterWindow(boolean) * - * @param pos screen coordinates for the Y position. + * @param pos screen coordinates for the Y position of the window. */ public void setWindowYPosition(int pos) { putInteger("windowYpos", pos); diff --git a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java index 19be449111..36345b8883 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java @@ -277,8 +277,7 @@ public void invoke(final long window, final boolean focus) { }); if (!settings.isFullscreen()) { - if (settings.getCenterWindow()) - { + if (settings.getCenterWindow()) { // Center the window glfwSetWindowPos(window, (videoMode.width() - settings.getWidth()) / 2, From aef358f1e13a81b9092cbcc8f109876aaa303a15 Mon Sep 17 00:00:00 2001 From: kevin Date: Wed, 24 Nov 2021 12:52:37 -0600 Subject: [PATCH 03/18] jme3test.app.TestApplication hangs with LWJGL3 #1193 LWJGL3-JME library would block the current thread when executing LWJGL3. Instead of calling run() that is blocking, made it work like LWJGL2-JME library when they start it as a thread so run gets called. I commented out the run() function and replaced it with Thread.start(). --- .../src/main/java/com/jme3/system/lwjgl/LwjglWindow.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java index 36345b8883..83c919df76 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java @@ -478,7 +478,8 @@ public void create(boolean waitFor) { // NOTE: this is required for Mac OS X! mainThread = Thread.currentThread(); mainThread.setName("jME3 Main"); - run(); + new Thread(this, "jME3 Main").start(); +// run(); } /** From f0489b89dffb71338db3d6d084b800a330f81817 Mon Sep 17 00:00:00 2001 From: kevin Date: Wed, 24 Nov 2021 19:47:31 -0600 Subject: [PATCH 04/18] removing unwanted changes, since you can't do multiple pull requests at once. --- .../src/main/java/com/jme3/system/lwjgl/LwjglWindow.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java index 83c919df76..a6b3636dd3 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java @@ -280,8 +280,8 @@ public void invoke(final long window, final boolean focus) { if (settings.getCenterWindow()) { // Center the window glfwSetWindowPos(window, - (videoMode.width() - settings.getWidth()) / 2, - (videoMode.height() - settings.getHeight()) / 2); + (videoMode.width() - settings.getWidth()) / 2, + (videoMode.height() - settings.getHeight()) / 2); } else { glfwSetWindowPos(window,settings.getWindowXPosition(), settings.getWindowYPosition()); } @@ -478,8 +478,7 @@ public void create(boolean waitFor) { // NOTE: this is required for Mac OS X! mainThread = Thread.currentThread(); mainThread.setName("jME3 Main"); - new Thread(this, "jME3 Main").start(); -// run(); + run(); } /** From a5b0e37ce5f5242d54026247492703dbae776b6a Mon Sep 17 00:00:00 2001 From: kevin Date: Wed, 24 Nov 2021 19:50:32 -0600 Subject: [PATCH 05/18] formatting issues. --- .../src/main/java/com/jme3/system/lwjgl/LwjglWindow.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java index a6b3636dd3..e3030e0471 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java @@ -283,7 +283,8 @@ public void invoke(final long window, final boolean focus) { (videoMode.width() - settings.getWidth()) / 2, (videoMode.height() - settings.getHeight()) / 2); } else { - glfwSetWindowPos(window,settings.getWindowXPosition(), settings.getWindowYPosition()); + glfwSetWindowPos(window,settings.getWindowXPosition(), + settings.getWindowYPosition()); } } From 26937cac7d68cff1400e7e33c6f531637bf86200 Mon Sep 17 00:00:00 2001 From: kevin Date: Wed, 24 Nov 2021 19:53:02 -0600 Subject: [PATCH 06/18] changed parameter naming to be more consistency with other items. --- .../src/main/java/com/jme3/system/AppSettings.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/system/AppSettings.java b/jme3-core/src/main/java/com/jme3/system/AppSettings.java index 4ecf733682..dbc5ebdc93 100644 --- a/jme3-core/src/main/java/com/jme3/system/AppSettings.java +++ b/jme3-core/src/main/java/com/jme3/system/AppSettings.java @@ -291,8 +291,8 @@ public final class AppSettings extends HashMap { defaults.put("OpenCL", false); defaults.put("OpenCLPlatformChooser", DefaultPlatformChooser.class.getName()); defaults.put("UseRetinaFrameBuffer", true);// MacOS spec - defaults.put("windowYpos", 0); - defaults.put("windowXpos", 0); + defaults.put("windowYPosition", 0); + defaults.put("windowXPosition", 0); // defaults.put("Icons", null); } @@ -1383,7 +1383,7 @@ public void setCenterWindow(boolean center) { * @see #setWindowXPosition(int) */ public int getWindowXPosition() { - return getInteger("windowXpos"); + return getInteger("windowXPosition"); } /** @@ -1394,7 +1394,7 @@ public int getWindowXPosition() { * @param pos screen coordinates for the X position. */ public void setWindowXPosition(int pos) { - putInteger("windowXpos", pos); + putInteger("windowXPosition", pos); } @@ -1407,7 +1407,7 @@ public void setWindowXPosition(int pos) { * @see #setWindowXPosition(int) */ public int getWindowYPosition() { - return getInteger("windowYpos"); + return getInteger("windowYPosition"); } /** @@ -1418,7 +1418,7 @@ public int getWindowYPosition() { * @param pos screen coordinates for the Y position of the window. */ public void setWindowYPosition(int pos) { - putInteger("windowYpos", pos); + putInteger("windowYPosition", pos); } From 3832d372f43d0fd3569a37f62ecf334094bdeb82 Mon Sep 17 00:00:00 2001 From: kevin Date: Wed, 24 Nov 2021 20:15:40 -0600 Subject: [PATCH 07/18] jme3test.app.TestApplication hangs with LWJGL3 #1193 LWJGL3-JME projects was doing a call that is blocking the current thread. I changed it to match how LWJGL2-JME project launches the Context Window. --- .../src/main/java/com/jme3/system/lwjgl/LwjglWindow.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java index e3030e0471..a7ab37ec9e 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java @@ -479,7 +479,7 @@ public void create(boolean waitFor) { // NOTE: this is required for Mac OS X! mainThread = Thread.currentThread(); mainThread.setName("jME3 Main"); - run(); + new Thread(this, "jME3 Main").start(); } /** From 811493c4f2bc343e0ff589bfbde99079d7219a5c Mon Sep 17 00:00:00 2001 From: bob0bob <30982580+bob0bob@users.noreply.github.com> Date: Wed, 24 Nov 2021 20:42:39 -0600 Subject: [PATCH 08/18] jme3test.app.TestApplication hangs with LWJGL3 #1193 (#3) LWJGL3-JME projects was doing a call that is blocking the current thread. I changed it to match how LWJGL2-JME project launches the Context Window. From db0d9ffb1beb45ec377947ef85874366f09f1024 Mon Sep 17 00:00:00 2001 From: kevin Date: Wed, 24 Nov 2021 21:03:52 -0600 Subject: [PATCH 09/18] removing unwanted changes. --- .../src/main/java/com/jme3/system/lwjgl/LwjglWindow.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java index a7ab37ec9e..e3030e0471 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java @@ -479,7 +479,7 @@ public void create(boolean waitFor) { // NOTE: this is required for Mac OS X! mainThread = Thread.currentThread(); mainThread.setName("jME3 Main"); - new Thread(this, "jME3 Main").start(); + run(); } /** From 5eb269079ebb90705f4dfdc6faaf63502527e90d Mon Sep 17 00:00:00 2001 From: Stephen Gold Date: Tue, 30 Nov 2021 10:45:49 -0800 Subject: [PATCH 10/18] AppSettings: enhance the new javadoc --- .../java/com/jme3/system/AppSettings.java | 68 ++++++++++++------- 1 file changed, 45 insertions(+), 23 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/system/AppSettings.java b/jme3-core/src/main/java/com/jme3/system/AppSettings.java index dbc5ebdc93..21c8373d46 100644 --- a/jme3-core/src/main/java/com/jme3/system/AppSettings.java +++ b/jme3-core/src/main/java/com/jme3/system/AppSettings.java @@ -1355,9 +1355,13 @@ public void setUseRetinaFrameBuffer(boolean useRetinaFrameBuffer) { } /** - * Get the Centering Window state + * Tests the state of the Center Window flag. * - * @return true to center the window in the middle of the screen + *

The Center Window flag is used only with LWJGL3 and has no effect on + * fullscreen windows. + * + * @return true to center the window on the desktop, false to position the + * window at (WindowXPosition, WindowYPosition) * @see #setCenterWindow(boolean) */ public boolean getCenterWindow() { @@ -1365,61 +1369,79 @@ public boolean getCenterWindow() { } /** - * True to enable centering the window. + * Enables or disables the Center Window flag. + * + *

The Center Window flag is used only with LWJGL3 and has no effect on + * fullscreen windows. It defaults to true. * - * @param center whether to center the window or not. + * @param center true to center the window on the desktop, false to position + * the window at (WindowXPosition, WindowYPosition) */ public void setCenterWindow(boolean center) { putBoolean("CenterWindow", center); } - /** - * Get the window's X Position on the screen. - * This value is ignored when CenterWindow is set to true + * Gets the window's initial X position on the desktop. + * + *

This setting is used only with LWJGL3, has no effect on fullscreen + * windows, and is ignored if the Center Window flag is true. + * * @see #setCenterWindow(boolean) * - * @return int screen coordinates of the X Position of the window + * @return the initial position of the window's left edge relative to the + * left edge of the desktop * @see #setWindowXPosition(int) */ public int getWindowXPosition() { return getInteger("windowXPosition"); } - + /** - * Set the window's X Position on the screen. - * This value is ignored when CenterWindow is set to true + * Sets the window's initial X position on the desktop. + * + *

This setting is used only with LWJGL3, has no effect on fullscreen + * windows, and is ignored if the Center Window flag is true. Its default + * value is 0. + * * @see #setCenterWindow(boolean) * - * @param pos screen coordinates for the X position. + * @param pos the desired initial position of the window's left edge + * relative to the left edge of the desktop */ public void setWindowXPosition(int pos) { putInteger("windowXPosition", pos); } - /** - * Get the window's Y Position on the screen. - * This value is ignored when CenterWindow is set to true + * Gets the window's initial Y position on the desktop. + * + *

This setting is used only with LWJGL3, has no effect on fullscreen + * windows, and is ignored if the Center Window flag is true. + * * @see #setCenterWindow(boolean) * - * @return int screen coordinates of the Y Position of the window - * @see #setWindowXPosition(int) + * @return the initial position of the window's upper edge relative to the + * upper edge of the desktop + * @see #setWindowYPosition(int) */ public int getWindowYPosition() { return getInteger("windowYPosition"); } - + /** - * Set the window's Y Position on the screen. - * This value is ignored when CenterWindow is set to true + * Sets the window's initial Y position on the desktop. + * + *

This setting is used only with LWJGL3, has no effect on fullscreen + * windows, and is ignored if the Center Window flag is true. Its default + * value is 0. + * * @see #setCenterWindow(boolean) * - * @param pos screen coordinates for the Y position of the window. + * @param pos the desired initial position of the window's upper edge + * relative to the upper edge of the desktop */ public void setWindowYPosition(int pos) { putInteger("windowYPosition", pos); } - - } From 72d008dbe40fb1e2d442bce821b0fa5e80162398 Mon Sep 17 00:00:00 2001 From: Stephen Gold Date: Tue, 30 Nov 2021 10:54:25 -0800 Subject: [PATCH 11/18] AppSettings: capitalize Window{X/Y}Position consistent w/other settings --- .../src/main/java/com/jme3/system/AppSettings.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/system/AppSettings.java b/jme3-core/src/main/java/com/jme3/system/AppSettings.java index 21c8373d46..e45eb51945 100644 --- a/jme3-core/src/main/java/com/jme3/system/AppSettings.java +++ b/jme3-core/src/main/java/com/jme3/system/AppSettings.java @@ -291,8 +291,8 @@ public final class AppSettings extends HashMap { defaults.put("OpenCL", false); defaults.put("OpenCLPlatformChooser", DefaultPlatformChooser.class.getName()); defaults.put("UseRetinaFrameBuffer", true);// MacOS spec - defaults.put("windowYPosition", 0); - defaults.put("windowXPosition", 0); + defaults.put("WindowYPosition", 0); + defaults.put("WindowXPosition", 0); // defaults.put("Icons", null); } @@ -1394,7 +1394,7 @@ public void setCenterWindow(boolean center) { * @see #setWindowXPosition(int) */ public int getWindowXPosition() { - return getInteger("windowXPosition"); + return getInteger("WindowXPosition"); } /** @@ -1410,7 +1410,7 @@ public int getWindowXPosition() { * relative to the left edge of the desktop */ public void setWindowXPosition(int pos) { - putInteger("windowXPosition", pos); + putInteger("WindowXPosition", pos); } /** @@ -1426,7 +1426,7 @@ public void setWindowXPosition(int pos) { * @see #setWindowYPosition(int) */ public int getWindowYPosition() { - return getInteger("windowYPosition"); + return getInteger("WindowYPosition"); } /** @@ -1442,6 +1442,6 @@ public int getWindowYPosition() { * relative to the upper edge of the desktop */ public void setWindowYPosition(int pos) { - putInteger("windowYPosition", pos); + putInteger("WindowYPosition", pos); } } From f7c5ec7eeeb349e319c79bf817428654e3f7ee21 Mon Sep 17 00:00:00 2001 From: Stephen Gold Date: Tue, 30 Nov 2021 11:36:00 -0800 Subject: [PATCH 12/18] LwjglWindow: convert tabs to spaces --- .../src/main/java/com/jme3/system/lwjgl/LwjglWindow.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java index e3030e0471..e47c9e3a69 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/system/lwjgl/LwjglWindow.java @@ -280,11 +280,12 @@ public void invoke(final long window, final boolean focus) { if (settings.getCenterWindow()) { // Center the window glfwSetWindowPos(window, - (videoMode.width() - settings.getWidth()) / 2, - (videoMode.height() - settings.getHeight()) / 2); + (videoMode.width() - settings.getWidth()) / 2, + (videoMode.height() - settings.getHeight()) / 2); } else { - glfwSetWindowPos(window,settings.getWindowXPosition(), - settings.getWindowYPosition()); + glfwSetWindowPos(window, + settings.getWindowXPosition(), + settings.getWindowYPosition()); } } From 4544d6446ffa0d4499085fc822d7b6ec45d57322 Mon Sep 17 00:00:00 2001 From: Stephen Gold Date: Tue, 30 Nov 2021 11:45:50 -0800 Subject: [PATCH 13/18] AppSettings: re-arrange @see tags in javadoc --- .../src/main/java/com/jme3/system/AppSettings.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/system/AppSettings.java b/jme3-core/src/main/java/com/jme3/system/AppSettings.java index e45eb51945..4400baf376 100644 --- a/jme3-core/src/main/java/com/jme3/system/AppSettings.java +++ b/jme3-core/src/main/java/com/jme3/system/AppSettings.java @@ -1387,10 +1387,9 @@ public void setCenterWindow(boolean center) { *

This setting is used only with LWJGL3, has no effect on fullscreen * windows, and is ignored if the Center Window flag is true. * - * @see #setCenterWindow(boolean) - * * @return the initial position of the window's left edge relative to the * left edge of the desktop + * @see #setCenterWindow(boolean) * @see #setWindowXPosition(int) */ public int getWindowXPosition() { @@ -1404,10 +1403,9 @@ public int getWindowXPosition() { * windows, and is ignored if the Center Window flag is true. Its default * value is 0. * - * @see #setCenterWindow(boolean) - * * @param pos the desired initial position of the window's left edge * relative to the left edge of the desktop + * @see #setCenterWindow(boolean) */ public void setWindowXPosition(int pos) { putInteger("WindowXPosition", pos); @@ -1419,10 +1417,9 @@ public void setWindowXPosition(int pos) { *

This setting is used only with LWJGL3, has no effect on fullscreen * windows, and is ignored if the Center Window flag is true. * - * @see #setCenterWindow(boolean) - * * @return the initial position of the window's upper edge relative to the * upper edge of the desktop + * @see #setCenterWindow(boolean) * @see #setWindowYPosition(int) */ public int getWindowYPosition() { @@ -1436,10 +1433,9 @@ public int getWindowYPosition() { * windows, and is ignored if the Center Window flag is true. Its default * value is 0. * - * @see #setCenterWindow(boolean) - * * @param pos the desired initial position of the window's upper edge * relative to the upper edge of the desktop + * @see #setCenterWindow(boolean) */ public void setWindowYPosition(int pos) { putInteger("WindowYPosition", pos); From ef6d02e8f77b1ebc5cce59241a1955b1fdf8ff68 Mon Sep 17 00:00:00 2001 From: kevin Date: Fri, 3 Dec 2021 02:05:40 -0600 Subject: [PATCH 14/18] using deprecated FrameBuffer methods in jme3-core and jme3-desktop #1657 Updating all references to setDepthTexture and setColorTexture from old system to the new system. --- .../src/main/java/com/jme3/post/Filter.java | 12 ++++--- .../com/jme3/post/FilterPostProcessor.java | 17 +++++---- .../jme3/shadow/AbstractShadowRenderer.java | 5 +-- .../java/com/jme3/texture/FrameBuffer.java | 35 +++++++++++++++++++ .../com/jme3/water/SimpleWaterProcessor.java | 12 ++++--- .../jme3test/niftygui/TestNiftyToMesh.java | 7 ++-- .../jme3test/post/TestFBOPassthrough.java | 8 +++-- .../post/TestPostFiltersCompositing.java | 9 +++-- .../jme3test/post/TestRenderToCubemap.java | 19 +++++----- .../jme3test/post/TestRenderToMemory.java | 8 +++-- .../jme3test/post/TestRenderToTexture.java | 8 +++-- .../jme3test/renderer/TestDepthStencil.java | 7 ++-- .../jme3/shadow/AbstractShadowRendererVR.java | 9 +++-- 13 files changed, 113 insertions(+), 43 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/post/Filter.java b/jme3-core/src/main/java/com/jme3/post/Filter.java index 658a71877f..365c5c3b5a 100644 --- a/jme3-core/src/main/java/com/jme3/post/Filter.java +++ b/jme3-core/src/main/java/com/jme3/post/Filter.java @@ -43,6 +43,8 @@ import com.jme3.texture.Image.Format; import com.jme3.texture.Texture; import com.jme3.texture.Texture2D; +import com.jme3.texture.FrameBuffer.FrameBufferTarget; + import java.io.IOException; import java.util.Collection; import java.util.Iterator; @@ -110,22 +112,22 @@ public void init(Renderer renderer, int width, int height, Format textureFormat, if (numSamples > 1 && caps.contains(Caps.FrameBufferMultisample) && caps.contains(Caps.OpenGL31)) { renderFrameBuffer = new FrameBuffer(width, height, numSamples); renderedTexture = new Texture2D(width, height, numSamples, textureFormat); - renderFrameBuffer.setDepthBuffer(depthBufferFormat); + renderFrameBuffer.setDepthTarget(FrameBufferTarget.newTarget(depthBufferFormat)); if (renderDepth) { depthTexture = new Texture2D(width, height, numSamples, depthBufferFormat); - renderFrameBuffer.setDepthTexture(depthTexture); + renderFrameBuffer.setDepthTarget(FrameBufferTarget.newTarget(depthTexture)); } } else { renderFrameBuffer = new FrameBuffer(width, height, 1); renderedTexture = new Texture2D(width, height, textureFormat); - renderFrameBuffer.setDepthBuffer(depthBufferFormat); + renderFrameBuffer.setDepthTarget(FrameBufferTarget.newTarget(depthBufferFormat)); if (renderDepth) { depthTexture = new Texture2D(width, height, depthBufferFormat); - renderFrameBuffer.setDepthTexture(depthTexture); + renderFrameBuffer.setDepthTarget(FrameBufferTarget.newTarget(depthTexture)); } } - renderFrameBuffer.setColorTexture(renderedTexture); + renderFrameBuffer.addColorTarget(FrameBufferTarget.newTarget(renderedTexture)); } diff --git a/jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java b/jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java index db57d96f26..3f3bba0ba2 100644 --- a/jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java +++ b/jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java @@ -41,6 +41,8 @@ import com.jme3.texture.Image.Format; import com.jme3.texture.Texture; import com.jme3.texture.Texture2D; +import com.jme3.texture.FrameBuffer.FrameBufferBufferTarget; +import com.jme3.texture.FrameBuffer.FrameBufferTarget; import com.jme3.ui.Picture; import com.jme3.util.SafeArrayList; import java.io.IOException; @@ -182,7 +184,8 @@ private void initFilter(Filter filter, ViewPort vp) { if (filter.isRequiresDepthTexture()) { if (!computeDepth && renderFrameBuffer != null) { depthTexture = new Texture2D(width, height, depthFormat); - renderFrameBuffer.setDepthTexture(depthTexture); + + renderFrameBuffer.setDepthTarget(FrameBufferTarget.newTarget(depthTexture)); } computeDepth = true; filter.init(assetManager, renderManager, vp, width, height); @@ -488,21 +491,21 @@ public void reshape(ViewPort vp, int w, int h) { if (caps.contains(Caps.OpenGL32)) { Texture2D msColor = new Texture2D(width, height, numSamples, fbFormat); Texture2D msDepth = new Texture2D(width, height, numSamples, depthFormat); - renderFrameBufferMS.setDepthTexture(msDepth); - renderFrameBufferMS.setColorTexture(msColor); + renderFrameBufferMS.setDepthTarget(FrameBufferTarget.newTarget(msDepth)); + renderFrameBufferMS.addColorTarget(FrameBufferTarget.newTarget(msColor)); filterTexture = msColor; depthTexture = msDepth; } else { - renderFrameBufferMS.setDepthBuffer(depthFormat); - renderFrameBufferMS.setColorBuffer(fbFormat); + renderFrameBufferMS.setDepthTarget(FrameBufferTarget.newTarget(depthFormat)); + renderFrameBufferMS.addColorTarget(FrameBufferTarget.newTarget(fbFormat)); } } if (numSamples <= 1 || !caps.contains(Caps.OpenGL32)) { renderFrameBuffer = new FrameBuffer(width, height, 1); - renderFrameBuffer.setDepthBuffer(depthFormat); + renderFrameBuffer.setDepthTarget(FrameBufferTarget.newTarget(depthFormat)); filterTexture = new Texture2D(width, height, fbFormat); - renderFrameBuffer.setColorTexture(filterTexture); + renderFrameBuffer.addColorTarget(FrameBufferTarget.newTarget(filterTexture)); } for (Filter filter : filters.getArray()) { diff --git a/jme3-core/src/main/java/com/jme3/shadow/AbstractShadowRenderer.java b/jme3-core/src/main/java/com/jme3/shadow/AbstractShadowRenderer.java index 89bc821ab7..eed55e3dc0 100644 --- a/jme3-core/src/main/java/com/jme3/shadow/AbstractShadowRenderer.java +++ b/jme3-core/src/main/java/com/jme3/shadow/AbstractShadowRenderer.java @@ -58,6 +58,7 @@ import com.jme3.texture.Texture.MinFilter; import com.jme3.texture.Texture.ShadowCompareMode; import com.jme3.texture.Texture2D; +import com.jme3.texture.FrameBuffer.FrameBufferTarget; import com.jme3.ui.Picture; import com.jme3.util.clone.Cloner; import com.jme3.util.clone.JmeCloneable; @@ -170,10 +171,10 @@ private void init(AssetManager assetManager, int nbShadowMaps, int shadowMapSize shadowFB[i] = new FrameBuffer(shadowMapSize, shadowMapSize, 1); shadowMaps[i] = new Texture2D(shadowMapSize, shadowMapSize, Format.Depth); - shadowFB[i].setDepthTexture(shadowMaps[i]); + shadowFB[i].setDepthTarget(FrameBufferTarget.newTarget(shadowMaps[i])); //DO NOT COMMENT THIS (it prevent the OSX incomplete read buffer crash) - shadowFB[i].setColorTexture(dummyTex); + shadowFB[i].addColorTarget(FrameBufferTarget.newTarget(dummyTex)); shadowMapStringCache[i] = "ShadowMap" + i; lightViewStringCache[i] = "LightViewProjectionMatrix" + i; diff --git a/jme3-core/src/main/java/com/jme3/texture/FrameBuffer.java b/jme3-core/src/main/java/com/jme3/texture/FrameBuffer.java index 0d1010b28c..f472feb87a 100644 --- a/jme3-core/src/main/java/com/jme3/texture/FrameBuffer.java +++ b/jme3-core/src/main/java/com/jme3/texture/FrameBuffer.java @@ -231,6 +231,24 @@ public static FrameBufferBufferTarget newTarget(Format format){ t.setFormat(format); return t; } + + /** + * Creates a frame buffer texture and sets the face position + * by using the face parameter. + * It uses {@link TextureCubeMap} ordinal number for the + * face position. + * + * @param tx texture to add to the frame buffer + * @param face face to add to the color buffer to + * @return FrameBufferTexture Target + */ + public static FrameBufferTextureTarget newTarget(Texture tx, TextureCubeMap.Face face){ + FrameBufferTextureTarget t=new FrameBufferTextureTarget(); + t.face = face.ordinal(); + t.setTexture(tx); + return t; + } + } /** @@ -250,6 +268,23 @@ public void addColorTarget(FrameBufferTextureTarget colorBuf){ colorBufs.add(colorBuf); } + + /** + * Adds a texture to one of the color Buffers Array. + * It uses {@link TextureCubeMap} ordinal number for the + * position in the color buffer ArrayList. + * + * @param colorBuf texture to add to the color Buffer + * @param face position to add to the color buffer + */ + public void addColorTarget(FrameBufferTextureTarget colorBuf, TextureCubeMap.Face face){ + // checkSetTexture(colorBuf.getTexture(), false); // TODO: this won't work for levels. + colorBuf.slot=colorBufs.size(); + colorBuf.face = face.ordinal(); + colorBufs.add(colorBuf); + } + + public void setDepthTarget(FrameBufferBufferTarget depthBuf){ if (!depthBuf.getFormat().isDepthFormat()) throw new IllegalArgumentException("Depth buffer format must be depth."); diff --git a/jme3-effects/src/main/java/com/jme3/water/SimpleWaterProcessor.java b/jme3-effects/src/main/java/com/jme3/water/SimpleWaterProcessor.java index 19d3924470..6ce563042d 100644 --- a/jme3-effects/src/main/java/com/jme3/water/SimpleWaterProcessor.java +++ b/jme3-effects/src/main/java/com/jme3/water/SimpleWaterProcessor.java @@ -42,6 +42,9 @@ import com.jme3.scene.Spatial; import com.jme3.scene.shape.Quad; import com.jme3.texture.*; +import com.jme3.texture.FrameBuffer.FrameBufferBufferTarget; +import com.jme3.texture.FrameBuffer.FrameBufferTarget; +import com.jme3.texture.FrameBuffer.FrameBufferTextureTarget; import com.jme3.texture.Image.Format; import com.jme3.texture.Texture.WrapMode; import com.jme3.ui.Picture; @@ -282,8 +285,8 @@ protected void createPreViews() { // create offscreen framebuffer reflectionBuffer = new FrameBuffer(renderWidth, renderHeight, 1); //setup framebuffer to use texture - reflectionBuffer.setDepthBuffer(Format.Depth); - reflectionBuffer.setColorTexture(reflectionTexture); + reflectionBuffer.setDepthTarget(FrameBufferTarget.newTarget(Format.Depth)); + reflectionBuffer.addColorTarget(FrameBufferTarget.newTarget(reflectionTexture)); //set viewport to render to offscreen framebuffer reflectionView.setOutputFrameBuffer(reflectionBuffer); @@ -298,9 +301,8 @@ protected void createPreViews() { // create offscreen framebuffer refractionBuffer = new FrameBuffer(renderWidth, renderHeight, 1); //setup framebuffer to use texture - refractionBuffer.setDepthBuffer(Format.Depth); - refractionBuffer.setColorTexture(refractionTexture); - refractionBuffer.setDepthTexture(depthTexture); + refractionBuffer.addColorTarget(FrameBufferTarget.newTarget(refractionTexture)); + refractionBuffer.setDepthTarget(FrameBufferTarget.newTarget(depthTexture)); //set viewport to render to offscreen framebuffer refractionView.setOutputFrameBuffer(refractionBuffer); refractionView.addProcessor(new RefractionProcessor()); diff --git a/jme3-examples/src/main/java/jme3test/niftygui/TestNiftyToMesh.java b/jme3-examples/src/main/java/jme3test/niftygui/TestNiftyToMesh.java index 5d20d8c81a..5534f68f0d 100644 --- a/jme3-examples/src/main/java/jme3test/niftygui/TestNiftyToMesh.java +++ b/jme3-examples/src/main/java/jme3test/niftygui/TestNiftyToMesh.java @@ -44,6 +44,9 @@ import com.jme3.texture.Texture.MagFilter; import com.jme3.texture.Texture.MinFilter; import com.jme3.texture.Texture2D; +import com.jme3.texture.FrameBuffer.FrameBufferBufferTarget; +import com.jme3.texture.FrameBuffer.FrameBufferTarget; + import de.lessvoid.nifty.Nifty; public class TestNiftyToMesh extends SimpleApplication{ @@ -67,13 +70,13 @@ public void simpleInitApp() { Texture2D depthTex = new Texture2D(1024, 768, Format.Depth); FrameBuffer fb = new FrameBuffer(1024, 768, 1); - fb.setDepthTexture(depthTex); + fb.setDepthTarget(FrameBufferTarget.newTarget(depthTex)); Texture2D tex = new Texture2D(1024, 768, Format.RGBA8); tex.setMinFilter(MinFilter.Trilinear); tex.setMagFilter(MagFilter.Bilinear); - fb.setColorTexture(tex); + fb.addColorTarget(FrameBufferTarget.newTarget(tex)); niftyView.setClearFlags(true, true, true); niftyView.setOutputFrameBuffer(fb); diff --git a/jme3-examples/src/main/java/jme3test/post/TestFBOPassthrough.java b/jme3-examples/src/main/java/jme3test/post/TestFBOPassthrough.java index 3f8bbd0667..9b4bfe1d1f 100644 --- a/jme3-examples/src/main/java/jme3test/post/TestFBOPassthrough.java +++ b/jme3-examples/src/main/java/jme3test/post/TestFBOPassthrough.java @@ -40,8 +40,12 @@ import com.jme3.scene.Node; import com.jme3.scene.shape.Sphere; import com.jme3.texture.FrameBuffer; +import com.jme3.texture.Texture; import com.jme3.texture.Image.Format; import com.jme3.texture.Texture2D; +import com.jme3.texture.FrameBuffer.FrameBufferBufferTarget; +import com.jme3.texture.FrameBuffer.FrameBufferTarget; +import com.jme3.texture.FrameBuffer.FrameBufferTextureTarget; import com.jme3.ui.Picture; /** @@ -70,8 +74,8 @@ public void simpleInitApp() { fb = new FrameBuffer(w, h, 1); Texture2D fbTex = new Texture2D(w, h, Format.RGBA8); - fb.setDepthBuffer(Format.Depth); - fb.setColorTexture(fbTex); + fb.setDepthTarget(FrameBufferTarget.newTarget(Format.Depth)); + fb.addColorTarget(FrameBufferTarget.newTarget(fbTex)); // setup framebuffer's scene Sphere sphMesh = new Sphere(20, 20, 1); diff --git a/jme3-examples/src/main/java/jme3test/post/TestPostFiltersCompositing.java b/jme3-examples/src/main/java/jme3test/post/TestPostFiltersCompositing.java index b26b8fd66a..2e0dadc0a6 100644 --- a/jme3-examples/src/main/java/jme3test/post/TestPostFiltersCompositing.java +++ b/jme3-examples/src/main/java/jme3test/post/TestPostFiltersCompositing.java @@ -43,6 +43,10 @@ import com.jme3.texture.FrameBuffer; import com.jme3.texture.Image; import com.jme3.texture.Texture2D; +import com.jme3.texture.FrameBuffer.FrameBufferBufferTarget; +import com.jme3.texture.FrameBuffer.FrameBufferTarget; +import com.jme3.texture.FrameBuffer.FrameBufferTextureTarget; +import com.jme3.texture.Image.Format; import com.jme3.util.SkyFactory; /** @@ -78,8 +82,9 @@ public void simpleInitApp() { //creating a frame buffer for the mainviewport FrameBuffer mainVPFrameBuffer = new FrameBuffer(cam.getWidth(), cam.getHeight(), 1); Texture2D mainVPTexture = new Texture2D(cam.getWidth(), cam.getHeight(), Image.Format.RGBA8); - mainVPFrameBuffer.addColorTexture(mainVPTexture); - mainVPFrameBuffer.setDepthBuffer(Image.Format.Depth); + mainVPFrameBuffer.setDepthTarget(FrameBufferTarget.newTarget(Format.Depth)); + mainVPFrameBuffer.addColorTarget(FrameBufferTarget.newTarget(mainVPTexture)); + viewPort.setOutputFrameBuffer(mainVPFrameBuffer); //creating the post processor for the gui viewport diff --git a/jme3-examples/src/main/java/jme3test/post/TestRenderToCubemap.java b/jme3-examples/src/main/java/jme3test/post/TestRenderToCubemap.java index 84f24ad9d1..ea383de893 100644 --- a/jme3-examples/src/main/java/jme3test/post/TestRenderToCubemap.java +++ b/jme3-examples/src/main/java/jme3test/post/TestRenderToCubemap.java @@ -47,6 +47,9 @@ import com.jme3.texture.Image.Format; import com.jme3.texture.Texture; import com.jme3.texture.TextureCubeMap; +import com.jme3.texture.FrameBuffer.FrameBufferBufferTarget; +import com.jme3.texture.FrameBuffer.FrameBufferTarget; +import com.jme3.texture.FrameBuffer.FrameBufferTextureTarget; import com.jme3.util.SkyFactory; import com.jme3.util.SkyFactory.EnvMapType; @@ -86,15 +89,15 @@ public Texture setupOffscreenView(){ offTex.setMagFilter(Texture.MagFilter.Bilinear); //setup framebuffer to use texture - offBuffer.setDepthBuffer(Format.Depth); + offBuffer.setDepthTarget(FrameBufferTarget.newTarget(Format.Depth)); offBuffer.setMultiTarget(true); - offBuffer.addColorTexture(offTex, TextureCubeMap.Face.NegativeX); - offBuffer.addColorTexture(offTex, TextureCubeMap.Face.PositiveX); - offBuffer.addColorTexture(offTex, TextureCubeMap.Face.NegativeY); - offBuffer.addColorTexture(offTex, TextureCubeMap.Face.PositiveY); - offBuffer.addColorTexture(offTex, TextureCubeMap.Face.NegativeZ); - offBuffer.addColorTexture(offTex, TextureCubeMap.Face.PositiveZ); - + offBuffer.addColorTarget(FrameBufferTarget.newTarget(offTex, TextureCubeMap.Face.NegativeX)); + offBuffer.addColorTarget(FrameBufferTarget.newTarget(offTex, TextureCubeMap.Face.PositiveX)); + offBuffer.addColorTarget(FrameBufferTarget.newTarget(offTex, TextureCubeMap.Face.NegativeY)); + offBuffer.addColorTarget(FrameBufferTarget.newTarget(offTex, TextureCubeMap.Face.PositiveY)); + offBuffer.addColorTarget(FrameBufferTarget.newTarget(offTex, TextureCubeMap.Face.NegativeZ)); + offBuffer.addColorTarget(FrameBufferTarget.newTarget(offTex, TextureCubeMap.Face.PositiveZ)); + //set viewport to render to offscreen framebuffer offView.setOutputFrameBuffer(offBuffer); diff --git a/jme3-examples/src/main/java/jme3test/post/TestRenderToMemory.java b/jme3-examples/src/main/java/jme3test/post/TestRenderToMemory.java index 0d992667e6..2efc6eb9bf 100644 --- a/jme3-examples/src/main/java/jme3test/post/TestRenderToMemory.java +++ b/jme3-examples/src/main/java/jme3test/post/TestRenderToMemory.java @@ -49,6 +49,9 @@ import com.jme3.system.AppSettings; import com.jme3.system.JmeContext.Type; import com.jme3.texture.FrameBuffer; +import com.jme3.texture.FrameBuffer.FrameBufferBufferTarget; +import com.jme3.texture.FrameBuffer.FrameBufferTarget; +import com.jme3.texture.FrameBuffer.FrameBufferTextureTarget; import com.jme3.texture.Image.Format; import com.jme3.util.BufferUtils; import com.jme3.util.Screenshots; @@ -192,9 +195,8 @@ public void setupOffscreenView(){ //setup framebuffer to use renderbuffer // this is faster for gpu -> cpu copies - offBuffer.setDepthBuffer(Format.Depth); - offBuffer.setColorBuffer(Format.RGBA8); -// offBuffer.setColorTexture(offTex); + offBuffer.setDepthTarget(FrameBufferTarget.newTarget(Format.Depth)); + offBuffer.addColorTarget(FrameBufferTarget.newTarget(Format.RGBA8)); //set viewport to render to offscreen framebuffer offView.setOutputFrameBuffer(offBuffer); diff --git a/jme3-examples/src/main/java/jme3test/post/TestRenderToTexture.java b/jme3-examples/src/main/java/jme3test/post/TestRenderToTexture.java index 037c959d36..f889ae84af 100644 --- a/jme3-examples/src/main/java/jme3test/post/TestRenderToTexture.java +++ b/jme3-examples/src/main/java/jme3test/post/TestRenderToTexture.java @@ -49,6 +49,9 @@ import com.jme3.texture.Image.Format; import com.jme3.texture.Texture; import com.jme3.texture.Texture2D; +import com.jme3.texture.FrameBuffer.FrameBufferBufferTarget; +import com.jme3.texture.FrameBuffer.FrameBufferTarget; +import com.jme3.texture.FrameBuffer.FrameBufferTextureTarget; /** * This test renders a scene to a texture, then displays the texture on a cube. @@ -86,8 +89,9 @@ public Texture setupOffscreenView(){ offTex.setMagFilter(Texture.MagFilter.Bilinear); //setup framebuffer to use texture - offBuffer.setDepthBuffer(Format.Depth); - offBuffer.setColorTexture(offTex); + offBuffer.setDepthTarget(FrameBufferTarget.newTarget(Format.Depth)); + offBuffer.addColorTarget(FrameBufferTarget.newTarget(offTex)); + //set viewport to render to offscreen framebuffer offView.setOutputFrameBuffer(offBuffer); diff --git a/jme3-examples/src/main/java/jme3test/renderer/TestDepthStencil.java b/jme3-examples/src/main/java/jme3test/renderer/TestDepthStencil.java index 13d95e37d1..8bb2142502 100644 --- a/jme3-examples/src/main/java/jme3test/renderer/TestDepthStencil.java +++ b/jme3-examples/src/main/java/jme3test/renderer/TestDepthStencil.java @@ -48,6 +48,9 @@ import com.jme3.texture.FrameBuffer; import com.jme3.texture.Image.Format; import com.jme3.texture.Texture2D; +import com.jme3.texture.FrameBuffer.FrameBufferBufferTarget; +import com.jme3.texture.FrameBuffer.FrameBufferTarget; +import com.jme3.texture.FrameBuffer.FrameBufferTextureTarget; import com.jme3.ui.Picture; public class TestDepthStencil extends SimpleApplication { @@ -71,8 +74,8 @@ public void simpleInitApp() { fb = new FrameBuffer(w, h, 1); Texture2D fbTex = new Texture2D(w, h, Format.RGB8); - fb.setDepthBuffer(Format.Depth24Stencil8); - fb.setColorTexture(fbTex); + fb.setDepthTarget(FrameBufferTarget.newTarget(Format.Depth24Stencil8)); + fb.addColorTarget(FrameBufferTarget.newTarget(fbTex)); // setup framebuffer's scene Sphere sphMesh = new Sphere(20, 20, 1); diff --git a/jme3-vr/src/main/java/com/jme3/shadow/AbstractShadowRendererVR.java b/jme3-vr/src/main/java/com/jme3/shadow/AbstractShadowRendererVR.java index f88f1cc579..eb5937e46c 100644 --- a/jme3-vr/src/main/java/com/jme3/shadow/AbstractShadowRendererVR.java +++ b/jme3-vr/src/main/java/com/jme3/shadow/AbstractShadowRendererVR.java @@ -59,6 +59,9 @@ import com.jme3.texture.Texture.MinFilter; import com.jme3.texture.Texture.ShadowCompareMode; import com.jme3.texture.Texture2D; +import com.jme3.texture.FrameBuffer.FrameBufferBufferTarget; +import com.jme3.texture.FrameBuffer.FrameBufferTarget; +import com.jme3.texture.FrameBuffer.FrameBufferTextureTarget; import com.jme3.ui.Picture; import java.io.IOException; @@ -169,10 +172,10 @@ private void init(AssetManager assetManager, int nbShadowMaps, int shadowMapSize shadowFB[i] = new FrameBuffer(shadowMapSize, shadowMapSize, 1); shadowMaps[i] = new Texture2D(shadowMapSize, shadowMapSize, Format.Depth); - shadowFB[i].setDepthTexture(shadowMaps[i]); - + shadowFB[i].setDepthTarget(FrameBufferTarget.newTarget(shadowMaps[i])); + //DO NOT COMMENT THIS (It prevents the OSX incomplete read buffer crash.) - shadowFB[i].setColorTexture(dummyTex); + shadowFB[i].addColorTarget(FrameBufferTarget.newTarget(dummyTex)); shadowMapStringCache[i] = "ShadowMap" + i; lightViewStringCache[i] = "LightViewProjectionMatrix" + i; From a3dd6b784700a698ad5e6f2f446690a3f00cac6c Mon Sep 17 00:00:00 2001 From: kevin Date: Fri, 3 Dec 2021 23:36:37 -0600 Subject: [PATCH 15/18] Removing unused imports. --- jme3-core/src/main/java/com/jme3/post/Filter.java | 1 - jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java | 1 - .../src/main/java/com/jme3/water/SimpleWaterProcessor.java | 2 -- .../src/main/java/jme3test/niftygui/TestNiftyToMesh.java | 1 - .../src/main/java/jme3test/post/TestFBOPassthrough.java | 3 --- .../main/java/jme3test/post/TestPostFiltersCompositing.java | 2 -- .../src/main/java/jme3test/post/TestRenderToCubemap.java | 2 -- .../src/main/java/jme3test/post/TestRenderToMemory.java | 2 -- .../src/main/java/jme3test/post/TestRenderToTexture.java | 2 -- .../src/main/java/jme3test/renderer/TestDepthStencil.java | 2 -- .../src/main/java/com/jme3/shadow/AbstractShadowFilterVR.java | 2 -- 11 files changed, 20 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/post/Filter.java b/jme3-core/src/main/java/com/jme3/post/Filter.java index 365c5c3b5a..028bd60310 100644 --- a/jme3-core/src/main/java/com/jme3/post/Filter.java +++ b/jme3-core/src/main/java/com/jme3/post/Filter.java @@ -44,7 +44,6 @@ import com.jme3.texture.Texture; import com.jme3.texture.Texture2D; import com.jme3.texture.FrameBuffer.FrameBufferTarget; - import java.io.IOException; import java.util.Collection; import java.util.Iterator; diff --git a/jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java b/jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java index 3f3bba0ba2..20818f13c3 100644 --- a/jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java +++ b/jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java @@ -41,7 +41,6 @@ import com.jme3.texture.Image.Format; import com.jme3.texture.Texture; import com.jme3.texture.Texture2D; -import com.jme3.texture.FrameBuffer.FrameBufferBufferTarget; import com.jme3.texture.FrameBuffer.FrameBufferTarget; import com.jme3.ui.Picture; import com.jme3.util.SafeArrayList; diff --git a/jme3-effects/src/main/java/com/jme3/water/SimpleWaterProcessor.java b/jme3-effects/src/main/java/com/jme3/water/SimpleWaterProcessor.java index 6ce563042d..92bcb9bd12 100644 --- a/jme3-effects/src/main/java/com/jme3/water/SimpleWaterProcessor.java +++ b/jme3-effects/src/main/java/com/jme3/water/SimpleWaterProcessor.java @@ -42,9 +42,7 @@ import com.jme3.scene.Spatial; import com.jme3.scene.shape.Quad; import com.jme3.texture.*; -import com.jme3.texture.FrameBuffer.FrameBufferBufferTarget; import com.jme3.texture.FrameBuffer.FrameBufferTarget; -import com.jme3.texture.FrameBuffer.FrameBufferTextureTarget; import com.jme3.texture.Image.Format; import com.jme3.texture.Texture.WrapMode; import com.jme3.ui.Picture; diff --git a/jme3-examples/src/main/java/jme3test/niftygui/TestNiftyToMesh.java b/jme3-examples/src/main/java/jme3test/niftygui/TestNiftyToMesh.java index 5534f68f0d..1bbced2ca6 100644 --- a/jme3-examples/src/main/java/jme3test/niftygui/TestNiftyToMesh.java +++ b/jme3-examples/src/main/java/jme3test/niftygui/TestNiftyToMesh.java @@ -44,7 +44,6 @@ import com.jme3.texture.Texture.MagFilter; import com.jme3.texture.Texture.MinFilter; import com.jme3.texture.Texture2D; -import com.jme3.texture.FrameBuffer.FrameBufferBufferTarget; import com.jme3.texture.FrameBuffer.FrameBufferTarget; import de.lessvoid.nifty.Nifty; diff --git a/jme3-examples/src/main/java/jme3test/post/TestFBOPassthrough.java b/jme3-examples/src/main/java/jme3test/post/TestFBOPassthrough.java index 9b4bfe1d1f..899ad5f3c3 100644 --- a/jme3-examples/src/main/java/jme3test/post/TestFBOPassthrough.java +++ b/jme3-examples/src/main/java/jme3test/post/TestFBOPassthrough.java @@ -40,12 +40,9 @@ import com.jme3.scene.Node; import com.jme3.scene.shape.Sphere; import com.jme3.texture.FrameBuffer; -import com.jme3.texture.Texture; import com.jme3.texture.Image.Format; import com.jme3.texture.Texture2D; -import com.jme3.texture.FrameBuffer.FrameBufferBufferTarget; import com.jme3.texture.FrameBuffer.FrameBufferTarget; -import com.jme3.texture.FrameBuffer.FrameBufferTextureTarget; import com.jme3.ui.Picture; /** diff --git a/jme3-examples/src/main/java/jme3test/post/TestPostFiltersCompositing.java b/jme3-examples/src/main/java/jme3test/post/TestPostFiltersCompositing.java index 2e0dadc0a6..eef79e3bbc 100644 --- a/jme3-examples/src/main/java/jme3test/post/TestPostFiltersCompositing.java +++ b/jme3-examples/src/main/java/jme3test/post/TestPostFiltersCompositing.java @@ -43,9 +43,7 @@ import com.jme3.texture.FrameBuffer; import com.jme3.texture.Image; import com.jme3.texture.Texture2D; -import com.jme3.texture.FrameBuffer.FrameBufferBufferTarget; import com.jme3.texture.FrameBuffer.FrameBufferTarget; -import com.jme3.texture.FrameBuffer.FrameBufferTextureTarget; import com.jme3.texture.Image.Format; import com.jme3.util.SkyFactory; diff --git a/jme3-examples/src/main/java/jme3test/post/TestRenderToCubemap.java b/jme3-examples/src/main/java/jme3test/post/TestRenderToCubemap.java index ea383de893..da00ccecd5 100644 --- a/jme3-examples/src/main/java/jme3test/post/TestRenderToCubemap.java +++ b/jme3-examples/src/main/java/jme3test/post/TestRenderToCubemap.java @@ -47,9 +47,7 @@ import com.jme3.texture.Image.Format; import com.jme3.texture.Texture; import com.jme3.texture.TextureCubeMap; -import com.jme3.texture.FrameBuffer.FrameBufferBufferTarget; import com.jme3.texture.FrameBuffer.FrameBufferTarget; -import com.jme3.texture.FrameBuffer.FrameBufferTextureTarget; import com.jme3.util.SkyFactory; import com.jme3.util.SkyFactory.EnvMapType; diff --git a/jme3-examples/src/main/java/jme3test/post/TestRenderToMemory.java b/jme3-examples/src/main/java/jme3test/post/TestRenderToMemory.java index 2efc6eb9bf..1cfa50b9a2 100644 --- a/jme3-examples/src/main/java/jme3test/post/TestRenderToMemory.java +++ b/jme3-examples/src/main/java/jme3test/post/TestRenderToMemory.java @@ -49,9 +49,7 @@ import com.jme3.system.AppSettings; import com.jme3.system.JmeContext.Type; import com.jme3.texture.FrameBuffer; -import com.jme3.texture.FrameBuffer.FrameBufferBufferTarget; import com.jme3.texture.FrameBuffer.FrameBufferTarget; -import com.jme3.texture.FrameBuffer.FrameBufferTextureTarget; import com.jme3.texture.Image.Format; import com.jme3.util.BufferUtils; import com.jme3.util.Screenshots; diff --git a/jme3-examples/src/main/java/jme3test/post/TestRenderToTexture.java b/jme3-examples/src/main/java/jme3test/post/TestRenderToTexture.java index f889ae84af..5888521411 100644 --- a/jme3-examples/src/main/java/jme3test/post/TestRenderToTexture.java +++ b/jme3-examples/src/main/java/jme3test/post/TestRenderToTexture.java @@ -49,9 +49,7 @@ import com.jme3.texture.Image.Format; import com.jme3.texture.Texture; import com.jme3.texture.Texture2D; -import com.jme3.texture.FrameBuffer.FrameBufferBufferTarget; import com.jme3.texture.FrameBuffer.FrameBufferTarget; -import com.jme3.texture.FrameBuffer.FrameBufferTextureTarget; /** * This test renders a scene to a texture, then displays the texture on a cube. diff --git a/jme3-examples/src/main/java/jme3test/renderer/TestDepthStencil.java b/jme3-examples/src/main/java/jme3test/renderer/TestDepthStencil.java index 8bb2142502..bb5c111d55 100644 --- a/jme3-examples/src/main/java/jme3test/renderer/TestDepthStencil.java +++ b/jme3-examples/src/main/java/jme3test/renderer/TestDepthStencil.java @@ -48,9 +48,7 @@ import com.jme3.texture.FrameBuffer; import com.jme3.texture.Image.Format; import com.jme3.texture.Texture2D; -import com.jme3.texture.FrameBuffer.FrameBufferBufferTarget; import com.jme3.texture.FrameBuffer.FrameBufferTarget; -import com.jme3.texture.FrameBuffer.FrameBufferTextureTarget; import com.jme3.ui.Picture; public class TestDepthStencil extends SimpleApplication { diff --git a/jme3-vr/src/main/java/com/jme3/shadow/AbstractShadowFilterVR.java b/jme3-vr/src/main/java/com/jme3/shadow/AbstractShadowFilterVR.java index 66e9cc707b..3144a417e0 100644 --- a/jme3-vr/src/main/java/com/jme3/shadow/AbstractShadowFilterVR.java +++ b/jme3-vr/src/main/java/com/jme3/shadow/AbstractShadowFilterVR.java @@ -43,8 +43,6 @@ import com.jme3.renderer.RenderManager; import com.jme3.renderer.ViewPort; import com.jme3.renderer.queue.RenderQueue; -import com.jme3.shadow.CompareMode; -import com.jme3.shadow.EdgeFilteringMode; import com.jme3.texture.FrameBuffer; import java.io.IOException; From 5889962b53e5f751d41e0b0eae2458bb959c6459 Mon Sep 17 00:00:00 2001 From: kevin Date: Sat, 4 Dec 2021 14:41:43 -0600 Subject: [PATCH 16/18] missed an unused import. --- .../src/main/java/com/jme3/shadow/AbstractShadowRendererVR.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/jme3-vr/src/main/java/com/jme3/shadow/AbstractShadowRendererVR.java b/jme3-vr/src/main/java/com/jme3/shadow/AbstractShadowRendererVR.java index eb5937e46c..f484b9dd29 100644 --- a/jme3-vr/src/main/java/com/jme3/shadow/AbstractShadowRendererVR.java +++ b/jme3-vr/src/main/java/com/jme3/shadow/AbstractShadowRendererVR.java @@ -59,9 +59,7 @@ import com.jme3.texture.Texture.MinFilter; import com.jme3.texture.Texture.ShadowCompareMode; import com.jme3.texture.Texture2D; -import com.jme3.texture.FrameBuffer.FrameBufferBufferTarget; import com.jme3.texture.FrameBuffer.FrameBufferTarget; -import com.jme3.texture.FrameBuffer.FrameBufferTextureTarget; import com.jme3.ui.Picture; import java.io.IOException; From 735c249daf6ca9a0691addd3fc8718f17d70090f Mon Sep 17 00:00:00 2001 From: Stephen Gold Date: Wed, 8 Dec 2021 20:22:38 -0800 Subject: [PATCH 17/18] FrameBuffer: improve formatting of the added sourcecode --- .../java/com/jme3/texture/FrameBuffer.java | 36 ++++++++----------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/texture/FrameBuffer.java b/jme3-core/src/main/java/com/jme3/texture/FrameBuffer.java index f472feb87a..449f16d770 100644 --- a/jme3-core/src/main/java/com/jme3/texture/FrameBuffer.java +++ b/jme3-core/src/main/java/com/jme3/texture/FrameBuffer.java @@ -231,24 +231,21 @@ public static FrameBufferBufferTarget newTarget(Format format){ t.setFormat(format); return t; } - + /** - * Creates a frame buffer texture and sets the face position - * by using the face parameter. - * It uses {@link TextureCubeMap} ordinal number for the - * face position. - * - * @param tx texture to add to the frame buffer - * @param face face to add to the color buffer to - * @return FrameBufferTexture Target + * Creates a frame buffer texture and sets the face position by using the face parameter. It uses + * {@link TextureCubeMap} ordinal number for the face position. + * + * @param tx texture to add to the frame buffer + * @param face face to add to the color buffer to + * @return FrameBufferTexture Target */ - public static FrameBufferTextureTarget newTarget(Texture tx, TextureCubeMap.Face face){ - FrameBufferTextureTarget t=new FrameBufferTextureTarget(); + public static FrameBufferTextureTarget newTarget(Texture tx, TextureCubeMap.Face face) { + FrameBufferTextureTarget t = new FrameBufferTextureTarget(); t.face = face.ordinal(); t.setTexture(tx); return t; } - } /** @@ -268,23 +265,20 @@ public void addColorTarget(FrameBufferTextureTarget colorBuf){ colorBufs.add(colorBuf); } - /** - * Adds a texture to one of the color Buffers Array. - * It uses {@link TextureCubeMap} ordinal number for the + * Adds a texture to one of the color Buffers Array. It uses {@link TextureCubeMap} ordinal number for the * position in the color buffer ArrayList. - * - * @param colorBuf texture to add to the color Buffer - * @param face position to add to the color buffer + * + * @param colorBuf texture to add to the color Buffer + * @param face position to add to the color buffer */ - public void addColorTarget(FrameBufferTextureTarget colorBuf, TextureCubeMap.Face face){ + public void addColorTarget(FrameBufferTextureTarget colorBuf, TextureCubeMap.Face face) { // checkSetTexture(colorBuf.getTexture(), false); // TODO: this won't work for levels. - colorBuf.slot=colorBufs.size(); + colorBuf.slot = colorBufs.size(); colorBuf.face = face.ordinal(); colorBufs.add(colorBuf); } - public void setDepthTarget(FrameBufferBufferTarget depthBuf){ if (!depthBuf.getFormat().isDepthFormat()) throw new IllegalArgumentException("Depth buffer format must be depth."); From c6ebe24ad87e174f6ac7e91d22b7003f3ea2916d Mon Sep 17 00:00:00 2001 From: Stephen Gold Date: Wed, 8 Dec 2021 20:32:30 -0800 Subject: [PATCH 18/18] tweak the whitespace --- jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java | 1 - .../src/main/java/jme3test/niftygui/TestNiftyToMesh.java | 3 +-- .../src/main/java/jme3test/post/TestFBOPassthrough.java | 2 +- .../src/main/java/jme3test/post/TestRenderToTexture.java | 1 - .../src/main/java/jme3test/renderer/TestDepthStencil.java | 2 +- .../main/java/com/jme3/shadow/AbstractShadowRendererVR.java | 2 +- 6 files changed, 4 insertions(+), 7 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java b/jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java index 20818f13c3..fa3af964f0 100644 --- a/jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java +++ b/jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java @@ -183,7 +183,6 @@ private void initFilter(Filter filter, ViewPort vp) { if (filter.isRequiresDepthTexture()) { if (!computeDepth && renderFrameBuffer != null) { depthTexture = new Texture2D(width, height, depthFormat); - renderFrameBuffer.setDepthTarget(FrameBufferTarget.newTarget(depthTexture)); } computeDepth = true; diff --git a/jme3-examples/src/main/java/jme3test/niftygui/TestNiftyToMesh.java b/jme3-examples/src/main/java/jme3test/niftygui/TestNiftyToMesh.java index 1bbced2ca6..8155654249 100644 --- a/jme3-examples/src/main/java/jme3test/niftygui/TestNiftyToMesh.java +++ b/jme3-examples/src/main/java/jme3test/niftygui/TestNiftyToMesh.java @@ -45,7 +45,6 @@ import com.jme3.texture.Texture.MinFilter; import com.jme3.texture.Texture2D; import com.jme3.texture.FrameBuffer.FrameBufferTarget; - import de.lessvoid.nifty.Nifty; public class TestNiftyToMesh extends SimpleApplication{ @@ -75,7 +74,7 @@ public void simpleInitApp() { tex.setMinFilter(MinFilter.Trilinear); tex.setMagFilter(MagFilter.Bilinear); - fb.addColorTarget(FrameBufferTarget.newTarget(tex)); + fb.addColorTarget(FrameBufferTarget.newTarget(tex)); niftyView.setClearFlags(true, true, true); niftyView.setOutputFrameBuffer(fb); diff --git a/jme3-examples/src/main/java/jme3test/post/TestFBOPassthrough.java b/jme3-examples/src/main/java/jme3test/post/TestFBOPassthrough.java index 899ad5f3c3..72a4c875f5 100644 --- a/jme3-examples/src/main/java/jme3test/post/TestFBOPassthrough.java +++ b/jme3-examples/src/main/java/jme3test/post/TestFBOPassthrough.java @@ -72,7 +72,7 @@ public void simpleInitApp() { Texture2D fbTex = new Texture2D(w, h, Format.RGBA8); fb.setDepthTarget(FrameBufferTarget.newTarget(Format.Depth)); - fb.addColorTarget(FrameBufferTarget.newTarget(fbTex)); + fb.addColorTarget(FrameBufferTarget.newTarget(fbTex)); // setup framebuffer's scene Sphere sphMesh = new Sphere(20, 20, 1); diff --git a/jme3-examples/src/main/java/jme3test/post/TestRenderToTexture.java b/jme3-examples/src/main/java/jme3test/post/TestRenderToTexture.java index 5888521411..88de57274d 100644 --- a/jme3-examples/src/main/java/jme3test/post/TestRenderToTexture.java +++ b/jme3-examples/src/main/java/jme3test/post/TestRenderToTexture.java @@ -90,7 +90,6 @@ public Texture setupOffscreenView(){ offBuffer.setDepthTarget(FrameBufferTarget.newTarget(Format.Depth)); offBuffer.addColorTarget(FrameBufferTarget.newTarget(offTex)); - //set viewport to render to offscreen framebuffer offView.setOutputFrameBuffer(offBuffer); diff --git a/jme3-examples/src/main/java/jme3test/renderer/TestDepthStencil.java b/jme3-examples/src/main/java/jme3test/renderer/TestDepthStencil.java index bb5c111d55..0f333ac661 100644 --- a/jme3-examples/src/main/java/jme3test/renderer/TestDepthStencil.java +++ b/jme3-examples/src/main/java/jme3test/renderer/TestDepthStencil.java @@ -73,7 +73,7 @@ public void simpleInitApp() { Texture2D fbTex = new Texture2D(w, h, Format.RGB8); fb.setDepthTarget(FrameBufferTarget.newTarget(Format.Depth24Stencil8)); - fb.addColorTarget(FrameBufferTarget.newTarget(fbTex)); + fb.addColorTarget(FrameBufferTarget.newTarget(fbTex)); // setup framebuffer's scene Sphere sphMesh = new Sphere(20, 20, 1); diff --git a/jme3-vr/src/main/java/com/jme3/shadow/AbstractShadowRendererVR.java b/jme3-vr/src/main/java/com/jme3/shadow/AbstractShadowRendererVR.java index f484b9dd29..783a0a1d74 100644 --- a/jme3-vr/src/main/java/com/jme3/shadow/AbstractShadowRendererVR.java +++ b/jme3-vr/src/main/java/com/jme3/shadow/AbstractShadowRendererVR.java @@ -171,7 +171,7 @@ private void init(AssetManager assetManager, int nbShadowMaps, int shadowMapSize shadowMaps[i] = new Texture2D(shadowMapSize, shadowMapSize, Format.Depth); shadowFB[i].setDepthTarget(FrameBufferTarget.newTarget(shadowMaps[i])); - + //DO NOT COMMENT THIS (It prevents the OSX incomplete read buffer crash.) shadowFB[i].addColorTarget(FrameBufferTarget.newTarget(dummyTex)); shadowMapStringCache[i] = "ShadowMap" + i;