Skip to content

Commit

Permalink
remove 3d eye distance, remove hideall
Browse files Browse the repository at this point in the history
  • Loading branch information
autoandshare committed Feb 26, 2021
1 parent cc26800 commit 3242e13
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
40 changes: 9 additions & 31 deletions src/main/java/autoandshare/headvr/activity/VideoActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
}
Expand Down Expand Up @@ -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
Expand Down
7 changes: 0 additions & 7 deletions src/main/java/autoandshare/headvr/lib/Setting.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@
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;

public enum id {
Brightness,
EyeDistance,
EyeDistance3D,
VerticalDistance,
VideoSize,
MotionSensitivity,
Expand Down Expand Up @@ -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)"));
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/autoandshare/headvr/lib/VideoRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
18 changes: 0 additions & 18 deletions src/main/res/layout/setting_ui.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,6 @@
android:layout_margin="10dp"
android:background="@android:color/darker_gray" />

<TextView
android:id="@+id/textViewEyeDistance3D"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="EyeDistance" />

<SeekBar
android:id="@+id/seekBarEyeDistance3D"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="200" />

<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_margin="10dp"
android:background="@android:color/darker_gray" />

<TextView
android:id="@+id/textViewVerticalDistance"
android:layout_width="wrap_content"
Expand Down

0 comments on commit 3242e13

Please sign in to comment.