From 3242e136db4c8283f36af7b11cf0c2dfa01b749f Mon Sep 17 00:00:00 2001 From: autoandshare Date: Fri, 26 Feb 2021 09:40:25 +0000 Subject: [PATCH] remove 3d eye distance, remove hideall --- .../headvr/activity/SettingFragment.java | 1 - .../headvr/activity/VideoActivity.java | 40 +++++-------------- .../java/autoandshare/headvr/lib/Setting.java | 7 ---- .../headvr/lib/VideoRenderer.java | 3 +- src/main/res/layout/setting_ui.xml | 18 --------- 5 files changed, 10 insertions(+), 59 deletions(-) diff --git a/src/main/java/autoandshare/headvr/activity/SettingFragment.java b/src/main/java/autoandshare/headvr/activity/SettingFragment.java index 6265f27..64e5b0d 100644 --- a/src/main/java/autoandshare/headvr/activity/SettingFragment.java +++ b/src/main/java/autoandshare/headvr/activity/SettingFragment.java @@ -67,7 +67,6 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { private void initSeekBars(View view) { initSeekBars(view, R.id.seekBarBrightness, Setting.id.Brightness, R.id.textViewBrightness); initSeekBars(view, R.id.seekBarEyeDistance, Setting.id.EyeDistance, R.id.textViewEyeDistance); - initSeekBars(view, R.id.seekBarEyeDistance3D, Setting.id.EyeDistance3D, R.id.textViewEyeDistance3D); initSeekBars(view, R.id.seekBarVerticalDistance, Setting.id.VerticalDistance, R.id.textViewVerticalDistance); initSeekBars(view, R.id.seekBarVideoSize, Setting.id.VideoSize, R.id.textViewVideoSize); initSeekBars(view, R.id.seekBarSensitivity, Setting.id.MotionSensitivity, R.id.textViewSensitivity); diff --git a/src/main/java/autoandshare/headvr/activity/VideoActivity.java b/src/main/java/autoandshare/headvr/activity/VideoActivity.java index b2a33b1..db6df3f 100644 --- a/src/main/java/autoandshare/headvr/activity/VideoActivity.java +++ b/src/main/java/autoandshare/headvr/activity/VideoActivity.java @@ -94,39 +94,26 @@ private Boolean recenter() { if (!videoRenderer.getState().isVR()) { return false; } - - hideAll = true; - new Handler(Looper.getMainLooper()).postDelayed(() -> { - resetRotationMatrix = true; - hideAll = false; - }, 1000); return true; } - private Boolean updateEyeDistance(int i) { - Setting.id id = videoRenderer.getState().drawAs2D() ? - Setting.id.EyeDistance : Setting.id.EyeDistance3D; - - updateEyeDistanceWithId(i, id); - return true; + private void updateSettingWithId(Setting.id id, int i) { + int newValue = setting.update(id, i); + videoRenderer.getState().message = "setting " + id + " to " + newValue; } - private void updateEyeDistanceWithId(int i, Setting.id id) { - int eyeDistance = setting.update(id, i); - videoRenderer.getState().message = "setting " + id + " to " + eyeDistance; + private Boolean updateEyeDistance(int i) { + updateSettingWithId(Setting.id.EyeDistance, i); + return true; } private void updateScreenSize(int i) { - int newScreenSize = setting.update(Setting.id.VideoSize, i); - videoRenderer.getState().message = "setting " + Setting.id.VideoSize - + " to " + newScreenSize; + updateSettingWithId(Setting.id.VideoSize, i); videoRenderer.updateVideoPosition(); } private void updateScreenVertical(int i) { - int newScreenVertial = setting.update(Setting.id.VerticalDistance, i); - videoRenderer.getState().message = "setting " + Setting.id.VerticalDistance - + " to " + newScreenVertial; + updateSettingWithId(Setting.id.VerticalDistance, i); } private Boolean playMediaFromList(int offset) { @@ -139,16 +126,12 @@ private Boolean playMediaFromList(int offset) { if (mw == null) { videoRenderer.getState().errorMessage = "Invalid play list"; } else { - hideAll = true; videoRenderer.playUri(mw); - new Handler(Looper.getMainLooper()).postDelayed(() -> hideAll = false, 1500); } } return true; } - private boolean hideAll = false; - private Boolean prevFile() { return playMediaFromList(-1); } @@ -264,17 +247,12 @@ public void onDrawEye(Eye eye) { GLES20.glEnable(GLES20.GL_DEPTH_TEST); GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT); - if (hideAll) { - return; - } - - videoRenderer.glDraw(eye); - if (uiVisible) { basicUI.glDraw(eye, videoRenderer.getState(), headControl, (playList != null) ? playList.currentIndex() : ""); } + videoRenderer.glDraw(eye); } @Override diff --git a/src/main/java/autoandshare/headvr/lib/Setting.java b/src/main/java/autoandshare/headvr/lib/Setting.java index 3e928ff..04e7199 100644 --- a/src/main/java/autoandshare/headvr/lib/Setting.java +++ b/src/main/java/autoandshare/headvr/lib/Setting.java @@ -8,7 +8,6 @@ public class Setting { public static float Brightness; public static float EyeDistance; - public static float EyeDistance3D; public static float VerticalDistance; public static float VideoSize; public static float MotionSensitivity; @@ -16,7 +15,6 @@ public class Setting { public enum id { Brightness, EyeDistance, - EyeDistance3D, VerticalDistance, VideoSize, MotionSensitivity, @@ -49,7 +47,6 @@ private static class Item { items = new HashMap<>(); items.put(id.Brightness, new Item(0, 100, 25, 0f, 0.5f, "Brightness")); items.put(id.EyeDistance, new Item(-50, 50, 0, -0.4f, 0.4f, "Eye to eye distance (near <-> far)")); - items.put(id.EyeDistance3D, new Item(-50, 50, 0, -0.4f, 0.4f, "Eye to eye distance for 3D content")); items.put(id.VerticalDistance, new Item(-50, 50, 0, -0.6f, 0.6f, "Vertical offset (low <-> high)")); items.put(id.VideoSize, new Item(50, 150, 100, 1.5f, 6.5f, "Video size (small <-> big)")); items.put(id.MotionSensitivity, new Item(-10, 10, 0, 0.09f, 0.01f, "Head motion sensitivity (less <-> more)")); @@ -70,7 +67,6 @@ public void clear() { private void loadValues() { Brightness = getFloat(id.Brightness); EyeDistance = getFloat(id.EyeDistance); - EyeDistance3D = getFloat(id.EyeDistance3D); VerticalDistance = getFloat(id.VerticalDistance); VideoSize = getFloat(id.VideoSize); MotionSensitivity = getFloat(id.MotionSensitivity); @@ -129,9 +125,6 @@ public void set(id name, int value) { case EyeDistance: EyeDistance = getFloat(name); break; - case EyeDistance3D: - EyeDistance3D = getFloat(name); - break; case VerticalDistance: VerticalDistance = getFloat(name); break; diff --git a/src/main/java/autoandshare/headvr/lib/VideoRenderer.java b/src/main/java/autoandshare/headvr/lib/VideoRenderer.java index c371656..b93798f 100644 --- a/src/main/java/autoandshare/headvr/lib/VideoRenderer.java +++ b/src/main/java/autoandshare/headvr/lib/VideoRenderer.java @@ -235,8 +235,7 @@ public static boolean useRightTexture(int eyeType) { } public static float getCurrentEyeDistance() { - return state.drawAs2D() ? - Setting.EyeDistance : Setting.EyeDistance3D; + return Setting.EyeDistance; } private String propertyKey; diff --git a/src/main/res/layout/setting_ui.xml b/src/main/res/layout/setting_ui.xml index e7e7990..0ecc67f 100644 --- a/src/main/res/layout/setting_ui.xml +++ b/src/main/res/layout/setting_ui.xml @@ -68,24 +68,6 @@ android:layout_margin="10dp" android:background="@android:color/darker_gray" /> - - - - - -