This test requires mouse cursor visibility; the application crashes when the window is minimized.
Below are my test cases:
package test;
import com.jme3.app.SimpleApplication;
import com.jme3.light.DirectionalLight;
import com.jme3.material.Material;
import com.jme3.math.Vector3f;
import com.jme3.post.FilterPostProcessor;
import com.jme3.post.filters.SoftBloomFilter;
import com.jme3.renderer.queue.RenderQueue;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.shadow.DirectionalLightShadowFilter;
public class TestShadowCrash extends SimpleApplication {
@Override
public void simpleInitApp() {
Geometry box = new Geometry("", new Box(0.5f, 0.5f, 0.5f));
box.setMaterial(new Material(getAssetManager(), "Common/MatDefs/Light/Lighting.j3md"));
box.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
rootNode.attachChild(box);
Geometry floor = new Geometry("", new Box(0.5f, 0.5f, 0.5f));
floor.setMaterial(new Material(getAssetManager(), "Common/MatDefs/Light/Lighting.j3md"));
floor.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
floor.setLocalTranslation(0, -1, 0);
floor.setLocalScale(5, 1, 5);
rootNode.attachChild(floor);
DirectionalLight light = new DirectionalLight(new Vector3f(-1, -1, -1));
rootNode.addLight(light);
FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
viewPort.addProcessor(fpp);
// Need enabling assertions
DirectionalLightShadowFilter shadowFilter = new DirectionalLightShadowFilter(assetManager, 512, 2);
shadowFilter.setLight(light);
fpp.addFilter(shadowFilter);
// The SoftBloomFilter was also affected.
// SoftBloomFilter sbf = new SoftBloomFilter();
// fpp.addFilter(sbf);
// This setting appears to be overridden by FlyCamAppState.
//getInputManager().setCursorVisible(true);
}
@Override
public void simpleUpdate(float tpf) {
super.simpleUpdate(tpf);
// This setting is for testing purposes only.
getInputManager().setCursorVisible(true);
}
public static void main(String[] args) {
TestShadowCrash app = new TestShadowCrash();
app.start();
}
}
plugins {
id 'application'
id 'java'
}
description = 'test'
compileJava.options.encoding = 'UTF-8'
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
//ext.jmeVersion = '3.9.0-stable'
ext.jmeVersion = '3.10.0-alpha1'
dependencies {
implementation "org.jmonkeyengine:jme3-core:$jmeVersion"
implementation "org.jmonkeyengine:jme3-desktop:$jmeVersion"
implementation "org.jmonkeyengine:jme3-effects:$jmeVersion"
implementation "org.jmonkeyengine:jme3-plugins:$jmeVersion"
implementation "org.jmonkeyengine:jme3-terrain:$jmeVersion"
implementation "org.jmonkeyengine:jme3-networking:$jmeVersion"
implementation "org.jmonkeyengine:jme3-jogg:$jmeVersion"
implementation "org.jmonkeyengine:jme3-lwjgl3:$jmeVersion"
}
sourceSets {
main {
java {
srcDirs = ['src']
}
resources {
srcDirs = ['resource']
}
}
}
run {
enableAssertions = true
}
Some issues may require enabling Assertions.
The cause of this problem seems to be that when the window is minimized, both its width and height become 0, causing the camera's frustum to malfunction. This leads to issues with some filters that depend on the camera. Currently, I've tested DirectionalLightShadowFilter and SoftBloomFilter, and there may be others affected.
Test Environment: Win11, Java 21, jMonkeyEngine 3.10.0-alpha1
This test requires mouse cursor visibility; the application crashes when the window is minimized.
Below are my test cases:
Some issues may require enabling Assertions.
The cause of this problem seems to be that when the window is minimized, both its width and height become 0, causing the camera's frustum to malfunction. This leads to issues with some filters that depend on the camera. Currently, I've tested DirectionalLightShadowFilter and SoftBloomFilter, and there may be others affected.
Test Environment: Win11, Java 21, jMonkeyEngine 3.10.0-alpha1