Lemur/SimTools Patch-stravaganza

Ugh, yeah, I’m waaaay overdo for looking at that. There were so many other things to tackle this round that I’m only just now wrapping up.

I’m not sure I’ll be able to get to joysticks this round. Poop.

Edit: hey, is there already an issue entered for this in the Lemur repo? If not then it could improve the visibility of this issue.

Regarding viewports…

I think JME has messed this up somewhere at least with respect to Bucket.Gui. Whatever you set on the camera is essentially ignored except for the viewport… and it’s the camera width/height that’s used to calculate the ortho scaling instead of the viewport size. It seems the code that does that has gone back and forth a few times:

For example:
https://github.com/jMonkeyEngine/jmonkeyengine/commit/a28c2622d9f7f5dca3a1d0c4bbfceb79e8ebeae8

The thing is, even switching back is not a complete fix because clipping is messed up. Even things that are visibly on screen get frustum culled somewhere else.

However, given the way that the Gui bucket is handled… there is no way for the user to fix this issue. Rescaling your root node is not really going to work either because it would need non-uniform scaling which JME doesn’t support like we’d want here.

I’m going to spend a little more time on this trying to setup a regular ortho camera and avoiding the Gui bucket. Barring that, I’m 99% sure I can get it to work with a perspective camera but that has some notable downsides (and upsides) for regular 2D GUIs.

Now there is Joystick input remapping · Issue #67 · jMonkeyEngine-Contributions/Lemur · GitHub

1 Like

Added a demo of using ViewPorts with Lemur:

…it didn’t require any Lemur changes to make it work… though I will perhaps create some convenience classes in the future.

This one eschews the normal (and I think pretty broken) Gui bucket and uses the Transparent bucket in ortho projection instead. It otherwise behaves the same as the guiNode… there should be no difference.

…well, there is one slight difference in that this node also doesn’t have its z squashed to 0 like the regular guiNode does. So if you put 3D models in then they should render correctly as ortho projected 3D. You won’t get the weird mesh sorting issues that you get in the Gui bucket.

(Frankly, I’m inclined to believe that the Gui bucket should be deprecated. The guiNode already gets its own ViewPort, etc. and could just as easily be setup as an ortho view of the Transparent bucket like this is… but whatever.)

2 Likes

I am using 1.10.1 so maybe some of this is due to the version but I see you added a dragHandler to the vp container.

Doesn’t work for this version but the drag handler says is a work in progress so disregard if changed things and were using newer classes.

Touching anything except a button in the panel makes it fly away to the bottom left to what looks like the same distance every time. Something like to the left by half and down by half the size of the Gui viewPort.

I added mouse listener and those work.

If you checkout the Lemur project then you should be able to:
gradle install
…in the root of the lemur project then:
gradle run
…in the demo project.

But the changes to DragHandler were for features not covered in that particular example so it’s weird it’s causing issues. That being said, there have been a lot of other changes since 1.10.1.

Edit: and I’ll be cutting the new release in a few hours anyway.

Unfortunately, netbeans doesn’t work like this for some reason. Everything is there but it cant find the resources.

Executing: gradle :install
Arguments: [-c, C:\Users\Robert\Documents\JMonkey\Tutorial\Lemur\settings.gradle]

:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:jar UP-TO-DATE
:javadoc UP-TO-DATE
:javadocJar UP-TO-DATE
:sourcesJar UP-TO-DATE
:install

BUILD SUCCESSFUL

Total time: 0.318 secs
Executing: gradle :run
Arguments: [-PmainClass=demo.DemoLauncher, -PcmdLineArgs=, -PjvmLineArgs=, -c, C:\Users\Robert\Documents\JMonkey\Tutorial\Lemur\examples\demos\settings.gradle]

:compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':compileClasspath'.
> Could not resolve com.simsilica:lemur:1.11.0-SNAPSHOT.
  Required by:
      project :
   > Could not resolve com.simsilica:lemur:1.11.0-SNAPSHOT.
      > inconsistent module metadata found. Descriptor: com.simsilica:Lemur:1.11.0-SNAPSHOT Errors: bad module name: expected='lemur' found='Lemur'
> Could not find com.simsilica:lemur-proto:1.9.2-SNAPSHOT.
  Searched in the following locations:
      file:/C:/Users/Robert/.m2/repository/com/simsilica/lemur-proto/1.9.2-SNAPSHOT/maven-metadata.xml
      file:/C:/Users/Robert/.m2/repository/com/simsilica/lemur-proto/1.9.2-SNAPSHOT/lemur-proto-1.9.2-SNAPSHOT.pom
      file:/C:/Users/Robert/.m2/repository/com/simsilica/lemur-proto/1.9.2-SNAPSHOT/lemur-proto-1.9.2-SNAPSHOT.jar
      https://jcenter.bintray.com/com/simsilica/lemur-proto/1.9.2-SNAPSHOT/maven-metadata.xml
      https://jcenter.bintray.com/com/simsilica/lemur-proto/1.9.2-SNAPSHOT/lemur-proto-1.9.2-SNAPSHOT.pom
      https://jcenter.bintray.com/com/simsilica/lemur-proto/1.9.2-SNAPSHOT/lemur-proto-1.9.2-SNAPSHOT.jar
  Required by:
      project :

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
1 actionable task: 1 executed



Build failure (see the Notifications window for stacktrace): gradle :run

Gradle has never been fun for me. Real pain in the ass 100% of the time.

Edit. My typical pattern is to just use it to download sources and create a library from the jars. Always works.

It’s not gradle that’s at fault… it’s the shitty Netbeans integration. (Which is about the confidence I have in netbeans in general these days… after having to turn off “Compile on save” for the 50th project…) Anyway.

Try it from the command line and I bet it would work fine.

But it’s about to not matter in a few minutes.

Lemur 1.11.0 is up on bintray and ready to go. I’ll post some official release notification soon… in the mean time, here it is:

And Lemur-proto, too… thought not as much changed there:

Edit:
Github releases with binaries:

1 Like

PickState came up null.

SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.NullPointerException
	at com.simsilica.lemur.event.PickEventSession.getZBounds(PickEventSession.java:394)
	at com.simsilica.lemur.event.PickEventSession.getPickRay(PickEventSession.java:421)
	at com.simsilica.lemur.event.PickEventSession.cursorMoved(PickEventSession.java:548)
	at com.simsilica.lemur.event.MouseAppState.dispatchMotion(MouseAppState.java:94)
	at com.simsilica.lemur.event.BasePickState.update(BasePickState.java:239)
	at com.jme3.app.state.AppStateManager.update(AppStateManager.java:287)
	at com.jme3.app.SimpleApplication.update(SimpleApplication.java:236)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
	at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:197)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:232)
	at java.lang.Thread.run(Thread.java:748)

Went back and forth between 10 and 11 and 10 works fine.

Have other dependencies updated? Didn’t look like it.

Using it like this for my minimap.

//Add picking to the guiNode
getState(PickState.class).addCollisionRoot(getState(InitSceneGraphTreeState.class).getMiniMapGuiNode(), miniMapGuiViewPort, PickState.PICK_LAYER_GUI);

How are you determining that?

The NullPointerException has nothing to do with that:

…apparently the root spatial you added has a null bounding volume for some reason.

What is the relationship between miniMapGuiViewPort and getState(InitSceneGraphTreeState.class).getMiniMapGuiNode()?

Sets up the nodes for the game, like for terrain or objects, etc. That’s where the miniMap GuiNode is created and updated.

The ViewPort for the minimap where the lemur button lives.

I will go through your ortho setup and see if I can find something compared to this.

Edit: wasnt using it in this app, just going to compare it to what I have.

Library is big, but you wont need all of it. I just opened my test case files from a while ago.
I use

  1. SpatialAutoManager
  2. SpatialUtil
  3. ViewportPanel

to make it work. All classes I had copied from the original library - i did not keep the library.
The author of it is still active, so if asked nicely he could prepare the right classes for possible implementation or at least help. (as I have seen it is on pspeed todo list in one of the threats)

Figured it out.

The jme Gui Node was showing up as having no bounding size.

I tracked it back to the fact I was not using StatsAppState() in my main class constructor. Been almost 2 years doing this and never ran into a problem.

As long as I load the StatsAppState() and then setDisplayFps(false) and setDisplayStatView(false) instead, everything works fine.

Ah, yes… I think this a bug in JME. I can work around it in the Lemur code (and have before) and other parts of JME also seem to work around it… ultimately maybe we should fix the bug in JME. :slight_smile:

…after all, it’s kind of silly for a node to return a null world bound under any condition, really.

Should I report this as an issue?