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

ClassCastException in Uniform class #1065

Closed
rvandoosselaer opened this issue Apr 9, 2019 · 0 comments

Comments

Projects
None yet
2 participants
@rvandoosselaer
Copy link
Contributor

commented Apr 9, 2019

Fix in: #1066

There is an error in the class cast checking in the Uniform class, line 376.

...
//feed this.value with the collected values.
if (this.value instanceof ColorRGBA) {
    ((ColorRGBA) this.value).set(vec4.x, vec4.y, vec4.z, vec4.w);
} else if (value instanceof Vector4f) {
    ((Vector4f) this.value).set(vec4);
} else {
    ((Quaternion) this.value).set(vec4.x, vec4.y, vec4.z, vec4.w);
}
...

the check is looking for value instead of this.value.

Stacktrace:

java.lang.ClassCastException: com.jme3.math.Vector4f cannot be cast to com.jme3.math.Quaternion
        at com.jme3.shader.Uniform.setValue(Uniform.java:379) ~[jme3-core-3.3.0-alpha1.jar:3.3-alpha1]
        at com.jme3.material.Material.updateShaderMaterialParameters(Material.java:847) ~[jme3-core-3.3.0-alpha1.jar:3.3-alpha1]
        at com.jme3.material.Material.render(Material.java:1018) ~[jme3-core-3.3.0-alpha1.jar:3.3-alpha1]
        at com.jme3.renderer.RenderManager.renderGeometry(RenderManager.java:614) ~[jme3-core-3.3.0-alpha1.jar:3.3-alpha1]
        at com.jme3.renderer.queue.RenderQueue.renderGeometryList(RenderQueue.java:266) ~[jme3-core-3.3.0-alpha1.jar:3.3-alpha1]
        at com.jme3.renderer.queue.RenderQueue.renderQueue(RenderQueue.java:305) ~[jme3-core-3.3.0-alpha1.jar:3.3-alpha1]
        at com.jme3.renderer.RenderManager.renderViewPortQueues(RenderManager.java:877) ~[jme3-core-3.3.0-alpha1.jar:3.3-alpha1]
        at com.jme3.renderer.RenderManager.flushQueue(RenderManager.java:779) ~[jme3-core-3.3.0-alpha1.jar:3.3-alpha1]
        at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1108) ~[jme3-core-3.3.0-alpha1.jar:3.3-alpha1]
        at com.jme3.renderer.RenderManager.render(RenderManager.java:1158) ~[jme3-core-3.3.0-alpha1.jar:3.3-alpha1]
        at com.jme3.app.SimpleApplication.update(SimpleApplication.java:270) ~[jme3-core-3.3.0-alpha1.jar:3.3-alpha1]
        at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151) ~[jme3-lwjgl-3.3.0-alpha1.jar:3.3-alpha1]
        at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:197) ~[jme3-lwjgl-3.3.0-alpha1.jar:3.3-alpha1]
        at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:232) ~[jme3-lwjgl-3.3.0-alpha1.jar:3.3-alpha1]

pspeed42 added a commit that referenced this issue Apr 9, 2019

@stephengold stephengold added this to the v3.3.0 milestone Jun 18, 2019

@stephengold stephengold modified the milestones: v3.3.0, v3.2.4 Jun 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.