Checkstyle, made some changes to improve adherence to classic Java singleton pattern.
* some information from the headset/controllers you should probably look at OpenVRStereoRenderer, ControllerListener,
* or OpenVRState
*/
-public class OpenVRProvider {
+public final class OpenVRProvider {
public static Texture_t[] texType = new Texture_t[2];
private static boolean initialized;
//keyboard
private static boolean keyboardShowing;
private static boolean headIsTracking;
+ private static OpenVRProvider instance;
public OpenVRState vrState = new OpenVRState();
private final VRTextureBounds_t texBounds = new VRTextureBounds_t();
private float nearClip = 0.5f;
private float farClip = 500.0f;
- private static OpenVRProvider instance = null;
+
+ // Call getInstance() to instantiate
+ private OpenVRProvider() {
+ }
// Get a singleton instance.
/*
* of using OpenVRProvider as a singleton.
*/
public static OpenVRProvider getInstance() {
- if (instance == null)
+ if (instance == null) {
instance = new OpenVRProvider();
+ }
return instance;
}
- public OpenVRProvider() {
+ public boolean init() {
for (int handIndex = 0; handIndex < 2; handIndex++) {
controllerDeviceIndex[handIndex] = -1;
controllerStateReference[handIndex] = new VRControllerState_t();
@@ -94,9 +99,6 @@ public OpenVRProvider() {
inputStateRefernceArray[handIndex].setAutoSynch(false);
texType[handIndex] = new Texture_t();
}
- }
-
- public boolean init() {
if (!initializeOpenVRLibrary()) {
logger.warn("JOpenVR library loading failed.");
return false;
