Skip to content

Commit 9665dcf

Browse files
authored
LWJGL 3.4.0 and Remove OpenVR (#2581)
* LWJGL 3.4.0 and Remove OpenVR @stephengold notified me that LWJGL 3.4 has been released and has also done some testing in their non jME projects with this new version already. (big thanks for keeping a tab on this area) I still have most of my own jME projects running lwjgl2 ('ve been procrastinating upgrading to LWJGL3 for quite a while now, long overdue), so I will finally do so in my own projects so I can help test as well. OpenVR is also no longer supported in LWJGL 3.4.0 so it appears it needed removed, but (unless I'm mistaken) this should not be an issue since the Tamarin VR library is using the newer openXR, and openVR is considered outdated and deprecated. Any jME apps still relying on openVR can still use v3.9 or earlier without issue (@richardTingle correct me if I'm incorrect on any of this) * Remove OpenVr * Delete jme3-vr directory * Remove OpenVR References from BulletDebugAppState.java * Change int to long for LWJGL 3.4.0 compatibility * Replace switch with if statements * Change int to long in LwjglPlatform.java
1 parent 091c4e3 commit 9665dcf

File tree

236 files changed

+21
-25040
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

236 files changed

+21
-25040
lines changed

gradle/libs.versions.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[versions]
44

55
checkstyle = "9.3"
6-
lwjgl3 = "3.3.6"
6+
lwjgl3 = "3.4.0"
77
nifty = "1.4.3"
88

99
[libraries]
@@ -32,8 +32,6 @@ lwjgl3-jemalloc = { module = "org.lwjgl:lwjgl-jemalloc", version.ref = "lwjgl3"
3232
lwjgl3-openal = { module = "org.lwjgl:lwjgl-openal", version.ref = "lwjgl3" }
3333
lwjgl3-opencl = { module = "org.lwjgl:lwjgl-opencl", version.ref = "lwjgl3" }
3434
lwjgl3-opengl = { module = "org.lwjgl:lwjgl-opengl", version.ref = "lwjgl3" }
35-
lwjgl3-openvr = { module = "org.lwjgl:lwjgl-openvr", version.ref = "lwjgl3" }
36-
lwjgl3-ovr = { module = "org.lwjgl:lwjgl-ovr", version.ref = "lwjgl3" }
3735

3836
mokito-core = "org.mockito:mockito-core:3.12.4"
3937

jme3-jbullet/src/main/java/com/jme3/bullet/debug/BulletDebugAppState.java

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
package com.jme3.bullet.debug;
3333

3434
import com.jme3.app.Application;
35-
import com.jme3.app.VRAppState;
3635
import com.jme3.app.state.AbstractAppState;
3736
import com.jme3.app.state.AppStateManager;
3837
import com.jme3.asset.AssetManager;
@@ -173,17 +172,11 @@ public void initialize(AppStateManager stateManager, Application app) {
173172
setupMaterials(app);
174173
physicsDebugRootNode.setCullHint(Spatial.CullHint.Never);
175174

176-
if (isVr()) {
177-
/* This is a less good solution than the non-vr version (as the debug shapes can be obscured by the regular
178-
* geometry), however it is the best possible as VR does not currently support multiple viewports per eye */
179-
VRAppState vrAppState = stateManager.getState(VRAppState.ID, VRAppState.class);
180-
vrAppState.getLeftViewPort().attachScene(physicsDebugRootNode);
181-
vrAppState.getRightViewPort().attachScene(physicsDebugRootNode);
182-
} else {
183-
viewPort = rm.createMainView("Physics Debug Overlay", app.getCamera());
184-
viewPort.setClearFlags(false, true, false);
185-
viewPort.attachScene(physicsDebugRootNode);
186-
}
175+
176+
viewPort = rm.createMainView("Physics Debug Overlay", app.getCamera());
177+
viewPort.setClearFlags(false, true, false);
178+
viewPort.attachScene(physicsDebugRootNode);
179+
187180
}
188181

189182
/**
@@ -193,15 +186,8 @@ public void initialize(AppStateManager stateManager, Application app) {
193186
* is invoked.
194187
*/
195188
@Override
196-
public void cleanup() {
197-
if (isVr()) {
198-
VRAppState vrAppState = app.getStateManager().getState(VRAppState.ID, VRAppState.class);
199-
vrAppState.getLeftViewPort().detachScene(physicsDebugRootNode);
200-
vrAppState.getRightViewPort().detachScene(physicsDebugRootNode);
201-
} else {
202-
rm.removeMainView(viewPort);
203-
}
204-
189+
public void cleanup() {
190+
rm.removeMainView(viewPort);
205191
super.cleanup();
206192
}
207193

@@ -436,17 +422,4 @@ public static interface DebugAppStateFilter {
436422
*/
437423
public boolean displayObject(Object obj);
438424
}
439-
440-
private boolean isVr() {
441-
if (isVr == null) {
442-
try {
443-
VRAppState vrAppState = app.getStateManager().getState(VRAppState.ID, VRAppState.class);
444-
isVr = vrAppState != null && !vrAppState.DISABLE_VR;
445-
} catch (NoClassDefFoundError e) {
446-
//Vr isn't even on the classpath
447-
isVr = false;
448-
}
449-
}
450-
return isVr;
451-
}
452-
}
425+
}

jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglDevice.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,19 @@ public long getDevice() {
6161
public LwjglPlatform getPlatform() {
6262
return platform;
6363
}
64-
64+
6565
@Override
6666
public DeviceType getDeviceType() {
67-
int type = Info.clGetDeviceInfoInt(device, CL10.CL_DEVICE_TYPE);
68-
switch (type) {
69-
case CL10.CL_DEVICE_TYPE_ACCELERATOR: return DeviceType.ACCELEARTOR;
70-
case CL10.CL_DEVICE_TYPE_CPU: return DeviceType.CPU;
71-
case CL10.CL_DEVICE_TYPE_GPU: return DeviceType.GPU;
72-
default: return DeviceType.DEFAULT;
67+
long type = Info.clGetDeviceInfoInt(device, CL10.CL_DEVICE_TYPE);
68+
69+
if ((type & CL10.CL_DEVICE_TYPE_GPU) != 0) {
70+
return DeviceType.GPU;
71+
} else if ((type & CL10.CL_DEVICE_TYPE_CPU) != 0) {
72+
return DeviceType.CPU;
73+
} else if ((type & CL10.CL_DEVICE_TYPE_ACCELERATOR) != 0) {
74+
return DeviceType.ACCELEARTOR;
75+
} else {
76+
return DeviceType.DEFAULT;
7377
}
7478
}
7579

jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglPlatform.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public List<LwjglDevice> getDevices() {
7878
* @param deviceType the device type
7979
* @return the available devices
8080
*/
81-
private long[] getDevices(int deviceType) {
81+
private long[] getDevices(long deviceType) {
8282
int[] count = new int[1];
8383
int errcode = CL10.clGetDeviceIDs(platform, deviceType, null, count);
8484
if (errcode == CL10.CL_DEVICE_NOT_FOUND) {

jme3-vr/build.gradle

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)