diff --git a/build.gradle b/build.gradle index 90c2c313e..2ec49a9c7 100644 --- a/build.gradle +++ b/build.gradle @@ -43,7 +43,7 @@ dependencies { corelibs dep("org.jmonkeyengine:jme3-awt-dialogs:$jmeVersion-$jmeVersionTag", true, true) corelibs dep("org.jmonkeyengine:jme3-plugins-json:$jmeVersion-$jmeVersionTag", true, true) corelibs dep("org.jmonkeyengine:jme3-plugins-json-gson:$jmeVersion-$jmeVersionTag", true, true) - corelibs dep("org.jmonkeyengine:jme3-lwjgl:$jmeVersion-$jmeVersionTag", true, true) + corelibs dep("org.jmonkeyengine:jme3-lwjgl3:$jmeVersion-$jmeVersionTag", true, true) corelibs dep("org.jmonkeyengine:jme3-effects:$jmeVersion-$jmeVersionTag", true, true) corelibs dep("com.github.stephengold:Minie:9.0.3", true, true) // replacement for bullet-native corelibs dep("com.github.stephengold:Heart:9.3.0", true, true) // requirement for Minie diff --git a/gradle.properties b/gradle.properties index 68e8cf938..1bb801057 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,9 @@ # Version number used for plugins, only 3 numbers (e.g. 3.1.3) -jmeVersion = 3.9.0 +jmeVersion = 3.10.0 # Version used for application and settings folder, no spaces! -jmeMainVersion = 3.9 +jmeMainVersion = 3.10 # Version addition pre-alpha-svn, Stable, Beta -jmeVersionTag = stable +jmeVersionTag = beta2 # Increment this each time jmeVersionTag changes but jmeVersion stays the same #jmeVersionTagID = 0 diff --git a/jme3-core/src/com/jme3/gde/core/Installer.java b/jme3-core/src/com/jme3/gde/core/Installer.java index d6613bcff..6a4c8a0f8 100644 --- a/jme3-core/src/com/jme3/gde/core/Installer.java +++ b/jme3-core/src/com/jme3/gde/core/Installer.java @@ -35,6 +35,7 @@ import java.awt.Component; import java.awt.Frame; import java.io.File; +import java.util.Locale; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JFileChooser; @@ -68,10 +69,49 @@ public void restored() { Logger.getLogger("org.openide.loaders").setLevel(Level.SEVERE); } + /** + * The jME lwjgl3 backend (jME 3.10, LWJGL 3.4) is SDL3-based. SDL probes the + * X11 and Wayland/EGL video backends when the GL context is created, which + * loads libEGL.so.1, and unloads that library again at SDK shutdown + * (SDL_EGL_UnloadLibrary). glvnd registers a pthread_key destructor that + * points into libEGL when the library is first used and never removes it. + * After the dlclose that destructor is dangling, and when the thread that + * touched EGL exits, glibc's __nptl_deallocate_tsd calls it and the JVM + * dies with SIGSEGV. Holding our own reference on the library keeps it + * mapped until the JVM itself terminates, so the destructor stays valid. + * No-op away from Linux. + */ + private static void holdEglLibraryReference() { + if (!System.getProperty("os.name", "").toLowerCase(Locale.ROOT).contains("linux")) { + return; + } + String[] candidates = { + "/usr/lib/x86_64-linux-gnu/libEGL.so.1", + "/usr/lib64/libEGL.so.1", + "/usr/lib/aarch64-linux-gnu/libEGL.so.1", + "/usr/lib/libEGL.so.1", + }; + for (String lib : candidates) { + if (new File(lib).canRead()) { + try { + System.load(lib); + Logger.getLogger(Installer.class.getName()) + .log(Level.INFO, "Holding {0} to prevent SDL/glvnd unloading it at exit", lib); + return; + } catch (UnsatisfiedLinkError | RuntimeException ex) { + Logger.getLogger(Installer.class.getName()) + .log(Level.INFO, "Could not hold a reference on " + lib, ex); + } + } + } + } + static { //set exception report levels System.setProperty("netbeans.exception.report.min.level", "99999"); - System.setProperty("netbeans.exception.alert.min.level", "99999"); + System.setProperty("netbeans.exception.alert.min.level", "99999"); + //keep glvnd's EGL library mapped for the lifetime of the JVM (see holdEglLibraryReference) + holdEglLibraryReference(); //set http agent System.setProperty("http.agent", NbBundle.getBundle("org.netbeans.core.windows.view.ui.Bundle").getString("CTL_MainWindow_Title") + " (" + System.getProperty("os.name") + "/" + System.getProperty("os.version") + ")"); diff --git a/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java b/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java index 99327b32c..dc8b76326 100644 --- a/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java +++ b/jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2010 jMonkeyEngine All rights reserved.

+ * Copyright (c) 2009-2026 jMonkeyEngine All rights reserved.

* Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -196,7 +196,7 @@ public ViewPort getOverlayView() { private void loadFPSText() { BitmapFont font = assetManager.loadFont("Interface/Fonts/Default.fnt"); - fpsText = new BitmapText(font, false); + fpsText = new BitmapText(font); fpsText.setSize(font.getCharSet().getRenderedSize()); fpsText.setLocalTranslation(0, fpsText.getLineHeight(), 0); fpsText.setText("Frames per second"); @@ -234,7 +234,6 @@ public void initialize() { camLight = new PointLight(); camLight.setColor(ColorRGBA.White); - guiNode.setQueueBucket(Bucket.Gui); guiNode.setCullHint(CullHint.Never); loadFPSText(); @@ -535,9 +534,11 @@ public void enableCamLight(final boolean enabled) { if (enabled) { rootNode.removeLight(camLight); rootNode.addLight(camLight); + } else { rootNode.removeLight(camLight); } + enablePBRProbe(enabled); return null; }); } @@ -581,12 +582,12 @@ public void run() { }.start(); } - private void togglePbrProbe(final boolean selected, final Node activeNode) { + private void togglePbrProbe(final boolean enabled, final Node activeNode) { if (pbrLightProbe == null) { createPbrLightProbe(activeNode); } else { enqueue(() -> { - if (selected) { + if (enabled) { activeNode.addLight(pbrLightProbe); } else { activeNode.removeLight(pbrLightProbe); diff --git a/jme3-core/src/com/jme3/gde/core/sceneviewer/SceneViewerTopComponent.form b/jme3-core/src/com/jme3/gde/core/sceneviewer/SceneViewerTopComponent.form index d73cc2e29..36480f17d 100644 --- a/jme3-core/src/com/jme3/gde/core/sceneviewer/SceneViewerTopComponent.form +++ b/jme3-core/src/com/jme3/gde/core/sceneviewer/SceneViewerTopComponent.form @@ -134,37 +134,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jme3-core/src/com/jme3/gde/core/sceneviewer/SceneViewerTopComponent.java b/jme3-core/src/com/jme3/gde/core/sceneviewer/SceneViewerTopComponent.java index c91d3314a..389f3ab11 100644 --- a/jme3-core/src/com/jme3/gde/core/sceneviewer/SceneViewerTopComponent.java +++ b/jme3-core/src/com/jme3/gde/core/sceneviewer/SceneViewerTopComponent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2010 jMonkeyEngine All rights reserved.

+ * Copyright (c) 2009-2026 jMonkeyEngine All rights reserved.

* Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * @@ -60,7 +60,7 @@ import org.openide.windows.WindowManager; /** - * This is the component containing the whole scene/model
+ * This is the component containing the whole scene/model * It also contains the top bar. */ @ConvertAsProperties(dtd = "-//com.jme3.gde.core.sceneviewer//SceneViewer//EN", @@ -90,42 +90,28 @@ public SceneViewerTopComponent() { oglCanvas.setFocusable(false); oGLPanel.add(oglCanvas); - } catch (Exception e) { + } catch (Exception | Error e) { SceneApplication.showStartupErrorMessage(e); - } catch (Error err) { - SceneApplication.showStartupErrorMessage(err); } - //TODO: camera tools (see SwitchFrontViewAction) -// Collection result = Lookups.forPath("CameraTools").lookupAll(Action.class); -// for (Iterator it = result.iterator(); it.hasNext();) { -// Action object = it.next(); -// //System.out.println("lookup object! / " + object); -// } - - //We add a mouse wheel listener to the top conmponent in order to correctly dispatch the event ot the cam controller - //the oGLPanel may naver have the focus. - // if ("true".equals(NbPreferences.forModule(Installer.class).get("use_lwjgl_canvas", "false"))) { - addMouseWheelListener(new MouseWheelListener() { - @Override - public void mouseWheelMoved(final MouseWheelEvent e) { - SceneApplication.getApplication().enqueue(new Callable() { - @Override - public Void call() throws Exception { - String action; - if (e.getWheelRotation() < 0) { - action = "MouseWheel"; - } else if (e.getWheelRotation() > 0) { - action = "MouseWheel-"; - } else { - return null; - } - if (app.getActiveCameraController() != null) { - app.getActiveCameraController().onAnalog(action, e.getWheelRotation(), 0); - } + + addMouseWheelListener((final MouseWheelEvent e) -> { + SceneApplication.getApplication().enqueue(new Callable() { + @Override + public Void call() throws Exception { + String action; + if (e.getWheelRotation() < 0) { + action = "MouseWheel"; + } else if (e.getWheelRotation() > 0) { + action = "MouseWheel-"; + } else { return null; } - }); - } + if (app.getActiveCameraController() != null) { + app.getActiveCameraController().onAnalog(action, e.getWheelRotation(), 0); + } + return null; + } + }); }); addKeyListener(new KeyListener() { @Override @@ -134,37 +120,30 @@ public void keyTyped(KeyEvent evt) { @Override public void keyPressed(final KeyEvent evt) { - SceneApplication.getApplication().enqueue(new Callable() { - @Override - public Void call() throws Exception { - int code = AwtKeyInput.convertAwtKey(evt.getKeyCode()); - KeyInputEvent keyEvent = new KeyInputEvent(code, evt.getKeyChar(), true, false); - keyEvent.setTime(evt.getWhen()); - if (app.getActiveCameraController() != null) { - app.getActiveCameraController().onKeyEvent(keyEvent); - } - return null; + SceneApplication.getApplication().enqueue(() -> { + int code = AwtKeyInput.convertAwtKey(evt.getKeyCode()); + KeyInputEvent keyEvent = new KeyInputEvent(code, evt.getKeyChar(), true, false); + keyEvent.setTime(evt.getWhen()); + if (app.getActiveCameraController() != null) { + app.getActiveCameraController().onKeyEvent(keyEvent); } + return null; }); } @Override public void keyReleased(final KeyEvent evt) { - SceneApplication.getApplication().enqueue(new Callable() { - @Override - public Void call() throws Exception { - int code = AwtKeyInput.convertAwtKey(evt.getKeyCode()); - KeyInputEvent keyEvent = new KeyInputEvent(code, evt.getKeyChar(), false, false); - keyEvent.setTime(evt.getWhen()); - if (app.getActiveCameraController() != null) { - app.getActiveCameraController().onKeyEvent(keyEvent); - } - return null; + SceneApplication.getApplication().enqueue(() -> { + int code = AwtKeyInput.convertAwtKey(evt.getKeyCode()); + KeyInputEvent keyEvent = new KeyInputEvent(code, evt.getKeyChar(), false, false); + keyEvent.setTime(evt.getWhen()); + if (app.getActiveCameraController() != null) { + app.getActiveCameraController().onKeyEvent(keyEvent); } + return null; }); } }); - //} oGLPanel.setDropTarget(new DropTarget(this, new SceneViewerDropTargetListener(this))); } @@ -182,7 +161,6 @@ private void initComponents() { jToggleButton1 = new javax.swing.JToggleButton(); jSeparator1 = new javax.swing.JToolBar.Separator(); enableWireframe = new javax.swing.JToggleButton(); - enablePBREnv = new javax.swing.JToggleButton(); enablePBRSky = new javax.swing.JToggleButton(); enableNormalView = new javax.swing.JToggleButton(); jPanel1 = new javax.swing.JPanel(); @@ -249,23 +227,6 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); jToolBar1.add(enableWireframe); - enablePBREnv.setIcon(IconList.enablePbrEnvironment); - org.openide.awt.Mnemonics.setLocalizedText(enablePBREnv, org.openide.util.NbBundle.getMessage(SceneViewerTopComponent.class, "SceneViewerTopComponent.enablePBREnv.text")); // NOI18N - enablePBREnv.setToolTipText(org.openide.util.NbBundle.getMessage(SceneViewerTopComponent.class, "SceneViewerTopComponent.enablePBREnv.toolTipText")); // NOI18N - enablePBREnv.setFocusable(false); - enablePBREnv.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - enablePBREnv.setMaximumSize(new java.awt.Dimension(32, 32)); - enablePBREnv.setMinimumSize(new java.awt.Dimension(32, 32)); - enablePBREnv.setPreferredSize(new java.awt.Dimension(32, 32)); - enablePBREnv.setSelectedIcon(IconList.enablePbrEnvironment); - enablePBREnv.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - enablePBREnv.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - enablePBREnvActionPerformed(evt); - } - }); - jToolBar1.add(enablePBREnv); - enablePBRSky.setIcon(IconList.enablePbrSky); org.openide.awt.Mnemonics.setLocalizedText(enablePBRSky, org.openide.util.NbBundle.getMessage(SceneViewerTopComponent.class, "SceneViewerTopComponent.enablePBRSky.text")); // NOI18N enablePBRSky.setToolTipText(org.openide.util.NbBundle.getMessage(SceneViewerTopComponent.class, "SceneViewerTopComponent.enablePBRSky.toolTipText")); // NOI18N @@ -334,10 +295,6 @@ private void jToggleButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GE FilterExplorerTopComponent.findInstance().setFilterEnabled(jToggleButton1.isSelected()); }//GEN-LAST:event_jToggleButton1ActionPerformed - private void enablePBREnvActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enablePBREnvActionPerformed - app.enablePBRProbe(enablePBREnv.isSelected()); - }//GEN-LAST:event_enablePBREnvActionPerformed - private void enablePBRSkyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enablePBRSkyActionPerformed app.enablePBRSkybox(enablePBRSky.isSelected()); }//GEN-LAST:event_enablePBRSkyActionPerformed @@ -349,7 +306,6 @@ private void enableNormalViewActionPerformed(java.awt.event.ActionEvent evt) {// // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JToggleButton enableCamLight; private javax.swing.JToggleButton enableNormalView; - private javax.swing.JToggleButton enablePBREnv; private javax.swing.JToggleButton enablePBRSky; private javax.swing.JToggleButton enableStats; private javax.swing.JToggleButton enableWireframe; @@ -388,8 +344,8 @@ public static synchronized SceneViewerTopComponent findInstance() { "Cannot find " + PREFERRED_ID + " component. It will not be located properly in the window system."); return getDefault(); } - if (win instanceof SceneViewerTopComponent) { - return (SceneViewerTopComponent) win; + if (win instanceof SceneViewerTopComponent sceneViewerTopComponent) { + return sceneViewerTopComponent; } Logger.getLogger(SceneViewerTopComponent.class.getName()).warning( "There seem to be multiple components with the '" + PREFERRED_ID