From e91065c4b070d239d17b1a5d22e4c5bf3ac27222 Mon Sep 17 00:00:00 2001 From: eguven Date: Wed, 3 Oct 2018 07:56:51 -0700 Subject: [PATCH] Remove ProjectionRenderer.EyeType ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=215562599 --- .../ui/spherical/ProjectionRenderer.java | 23 +++++-------------- .../ui/spherical/SceneRenderer.java | 8 +++---- .../ui/spherical/SphericalSurfaceView.java | 3 +-- 3 files changed, 11 insertions(+), 23 deletions(-) diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/spherical/ProjectionRenderer.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/spherical/ProjectionRenderer.java index 47515b023a..5e8a6d71d2 100644 --- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/spherical/ProjectionRenderer.java +++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/spherical/ProjectionRenderer.java @@ -33,18 +33,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; @TargetApi(15) /* package */ final class ProjectionRenderer { - /** Defines the constants identifying the current eye type. */ - /* package */ interface EyeType { - /** Single eye in monocular rendering. */ - int MONOCULAR = 0; - - /** The left eye in stereo rendering. */ - int LEFT = 1; - - /** The right eye in stereo rendering. */ - int RIGHT = 2; - } - /** * Returns whether {@code projection} is supported. At least it should have left mesh and there * should be only one sub mesh per mesh. @@ -148,10 +136,11 @@ import org.checkerframework.checker.nullness.qual.Nullable; * * @param textureId GL_TEXTURE_EXTERNAL_OES used for this mesh. * @param mvpMatrix The Model View Projection matrix. - * @param eyeType An {@link EyeType} value. + * @param rightEye Whether the right eye view should be drawn. If {@code false}, the left eye view + * is drawn. */ - /* package */ void draw(int textureId, float[] mvpMatrix, int eyeType) { - MeshData meshData = eyeType == EyeType.RIGHT ? rightMeshData : leftMeshData; + /* package */ void draw(int textureId, float[] mvpMatrix, boolean rightEye) { + MeshData meshData = rightEye ? rightMeshData : leftMeshData; if (meshData == null) { return; } @@ -166,9 +155,9 @@ import org.checkerframework.checker.nullness.qual.Nullable; float[] texMatrix; if (stereoMode == C.STEREO_MODE_TOP_BOTTOM) { - texMatrix = eyeType == EyeType.RIGHT ? TEX_MATRIX_BOTTOM : TEX_MATRIX_TOP; + texMatrix = rightEye ? TEX_MATRIX_BOTTOM : TEX_MATRIX_TOP; } else if (stereoMode == C.STEREO_MODE_LEFT_RIGHT) { - texMatrix = eyeType == EyeType.RIGHT ? TEX_MATRIX_RIGHT : TEX_MATRIX_LEFT; + texMatrix = rightEye ? TEX_MATRIX_RIGHT : TEX_MATRIX_LEFT; } else { texMatrix = TEX_MATRIX_WHOLE; } diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/spherical/SceneRenderer.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/spherical/SceneRenderer.java index 048c346781..5099b2187d 100644 --- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/spherical/SceneRenderer.java +++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/spherical/SceneRenderer.java @@ -23,7 +23,6 @@ import android.opengl.Matrix; import android.support.annotation.Nullable; import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.Format; -import com.google.android.exoplayer2.ui.spherical.ProjectionRenderer.EyeType; import com.google.android.exoplayer2.util.Assertions; import com.google.android.exoplayer2.util.GlUtil; import com.google.android.exoplayer2.util.TimedValueQueue; @@ -103,9 +102,10 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; * Draws the scene with a given eye pose and type. * * @param viewProjectionMatrix 16 element GL matrix. - * @param eyeType An {@link EyeType} value + * @param rightEye Whether the right eye view should be drawn. If {@code false}, the left eye view + * is drawn. */ - public void drawFrame(float[] viewProjectionMatrix, int eyeType) { + public void drawFrame(float[] viewProjectionMatrix, boolean rightEye) { // glClear isn't strictly necessary when rendering fully spherical panoramas, but it can improve // performance on tiled renderers by causing the GPU to discard previous data. GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); @@ -128,7 +128,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; } } Matrix.multiplyMM(tempMatrix, 0, viewProjectionMatrix, 0, rotationMatrix, 0); - projectionRenderer.draw(textureId, tempMatrix, eyeType); + projectionRenderer.draw(textureId, tempMatrix, rightEye); } // Methods called on playback thread. diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/spherical/SphericalSurfaceView.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/spherical/SphericalSurfaceView.java index 9139137af4..bae29a6858 100644 --- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/spherical/SphericalSurfaceView.java +++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/spherical/SphericalSurfaceView.java @@ -36,7 +36,6 @@ import android.view.Surface; import android.view.WindowManager; import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.Player; -import com.google.android.exoplayer2.ui.spherical.ProjectionRenderer.EyeType; import com.google.android.exoplayer2.util.Assertions; import com.google.android.exoplayer2.util.Util; import javax.microedition.khronos.egl.EGLConfig; @@ -287,7 +286,7 @@ public final class SphericalSurfaceView extends GLSurfaceView { } Matrix.multiplyMM(viewProjectionMatrix, 0, projectionMatrix, 0, viewMatrix, 0); - scene.drawFrame(viewProjectionMatrix, EyeType.MONOCULAR); + scene.drawFrame(viewProjectionMatrix, /* rightEye= */ false); } /** Adjusts the GL camera's rotation based on device rotation. Runs on the sensor thread. */