Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assertion failure in jme3test.games.CubeField #988

Closed
stephengold opened this issue Dec 30, 2018 · 6 comments
Closed

assertion failure in jme3test.games.CubeField #988

stephengold opened this issue Dec 30, 2018 · 6 comments
Labels
bug Something that is supposed to work, but doesn't. More severe than a "defect".
Milestone

Comments

@stephengold
Copy link
Member

stephengold commented Dec 30, 2018

Currently (in master branch at 3.3-6680) the CubeField app crashes with an AssertionError the 1st time ENTER is pressed. Here is a typical stack trace:

START
Dec 30, 2018 10:27:33 AM com.jme3.app.LegacyApplication handleError
SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.AssertionError
	at com.jme3.scene.Spatial.updateMatParamOverrides(Spatial.java:596)
	at com.jme3.scene.Spatial.updateGeometricState(Spatial.java:911)
	at jme3test.games.CubeField.gameLogic(CubeField.java:284)
	at jme3test.games.CubeField.simpleUpdate(CubeField.java:145)
	at com.jme3.app.SimpleApplication.update(SimpleApplication.java:239)
	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)
@stephengold
Copy link
Member Author

Commenting out line 284 seems to resolve the issue, though I don't fully understand why:

                Geometry playerModel = (Geometry) player.getChild(0);
                Geometry cubeModel = cubeField.get(i);
                //cubeModel.updateGeometricState();

                BoundingVolume pVol = playerModel.getWorldBound();
                BoundingVolume vVol = cubeModel.getWorldBound();

@pspeed42
Copy link
Contributor

a) wouldn't it be nice if JME assertions included a message.
b) calling updateGeometricState() manually is generally incorrect anyway. Not sure why it was being done.

@pspeed42
Copy link
Contributor

pspeed42 commented Dec 30, 2018

I guess the assertion is making sure that the parent's overrides were applied first?

    protected void updateMatParamOverrides() {
        refreshFlags &= ~RF_MATPARAM_OVERRIDE;

        worldOverrides.clear();
        if (parent == null) {
            worldOverrides.addAll(localOverrides);
        } else {
            assert (parent.refreshFlags & RF_MATPARAM_OVERRIDE) == 0;
            worldOverrides.addAll(parent.worldOverrides);
            worldOverrides.addAll(localOverrides);
        }
}

This implies that it is incorrect to ever call updateGeometricState() directly on a child. (which is new... was just ill advised before)

@stephengold
Copy link
Member Author

Thanks for the analysis. I suppose we should remove line 284 at least, since examples should ... set a good example. I'm unsure whether we should remove the assert as well.

@pspeed42
Copy link
Contributor

Well the assert is confirming that the parent has been updated before applying its overrides. If we want to allow direct updateGeometricState calling on children then a lot more work would have to be done other than just removing that line.

It would be nice if we would go through and add messages to our asserts so that they mean something, though.

@stephengold
Copy link
Member Author

Fixed in master branch at SHA id=44801da70687f8fbf9ee609cc1ece7f9144d9341

@stephengold stephengold added the bug Something that is supposed to work, but doesn't. More severe than a "defect". label Dec 31, 2018
@stephengold stephengold added this to the v3.2.3 milestone Feb 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that is supposed to work, but doesn't. More severe than a "defect".
Projects
None yet
Development

No branches or pull requests

2 participants