Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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

Expand Down
42 changes: 41 additions & 1 deletion jme3-core/src/com/jme3/gde/core/Installer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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") + ")");
Expand Down
11 changes: 6 additions & 5 deletions jme3-core/src/com/jme3/gde/core/scene/SceneApplication.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2010 jMonkeyEngine All rights reserved. <p/>
* Copyright (c) 2009-2026 jMonkeyEngine All rights reserved. <p/>
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -234,7 +234,6 @@ public void initialize() {

camLight = new PointLight();
camLight.setColor(ColorRGBA.White);

guiNode.setQueueBucket(Bucket.Gui);
guiNode.setCullHint(CullHint.Never);
loadFPSText();
Expand Down Expand Up @@ -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;
});
}
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,37 +134,6 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="enableWireframeActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JToggleButton" name="enablePBREnv">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="IconList.enablePbrEnvironment" type="code"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/core/sceneviewer/Bundle.properties" key="SceneViewerTopComponent.enablePBREnv.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/core/sceneviewer/Bundle.properties" key="SceneViewerTopComponent.enablePBREnv.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[32, 32]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[32, 32]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[32, 32]"/>
</Property>
<Property name="selectedIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="IconList.enablePbrEnvironment" type="code"/>
</Property>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="enablePBREnvActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JToggleButton" name="enablePBRSky">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2010 jMonkeyEngine All rights reserved. <p/>
* Copyright (c) 2009-2026 jMonkeyEngine All rights reserved. <p/>
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
Expand Down Expand Up @@ -60,7 +60,7 @@
import org.openide.windows.WindowManager;

/**
* This is the component containing the whole scene/model<br />
* This is the component containing the whole scene/model
* It also contains the top bar.
*/
@ConvertAsProperties(dtd = "-//com.jme3.gde.core.sceneviewer//SceneViewer//EN",
Expand Down Expand Up @@ -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<? extends Action> result = Lookups.forPath("CameraTools").lookupAll(Action.class);
// for (Iterator<? extends Action> 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<Void>() {
@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<Void>() {
@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
Expand All @@ -134,37 +120,30 @@ public void keyTyped(KeyEvent evt) {

@Override
public void keyPressed(final KeyEvent evt) {
SceneApplication.getApplication().enqueue(new Callable<Void>() {
@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<Void>() {
@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)));
}
Expand All @@ -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();
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand Down
Loading