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:
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.
…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.)
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.
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.
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
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.
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.
//Add picking to the guiNode
getState(PickState.class).addCollisionRoot(getState(InitSceneGraphTreeState.class).getMiniMapGuiNode(), miniMapGuiViewPort, PickState.PICK_LAYER_GUI);
Library is big, but you wont need all of it. I just opened my test case files from a while ago.
I use
SpatialAutoManager
SpatialUtil
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)
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.
…after all, it’s kind of silly for a node to return a null world bound under any condition, really.