Remove ProjectionRenderer.EyeType

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=215562599
This commit is contained in:
eguven 2018-10-03 07:56:51 -07:00 committed by Oliver Woodman
parent 645f08af73
commit e91065c4b0
3 changed files with 11 additions and 23 deletions

View file

@ -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;
}

View file

@ -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.

View file

@ -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. */