Package com.google.android.exoplayer2.video.spherical

## Class Projection

- java.lang.Object
- - com.google.android.exoplayer2.video.spherical.Projection

-     public final class Projection
      extends Object

  The projection mesh used with 360/VR videos.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static interface` | `Projection.DrawMode` | Enforces allowed (sub) mesh draw modes.
    `static class` | `Projection.Mesh` | A Mesh associated with the projection scene.
    `static class` | `Projection.SubMesh` | The sub mesh associated with the `Projection.Mesh`.

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `DRAW_MODE_TRIANGLES` | Triangle draw mode.
    `static int` | `DRAW_MODE_TRIANGLES_FAN` | Triangle fan draw mode.
    `static int` | `DRAW_MODE_TRIANGLES_STRIP` | Triangle strip draw mode.
    `Projection.Mesh` | `leftMesh` | The Mesh corresponding to the left eye.
    `static int` | `POSITION_COORDS_PER_VERTEX` | Number of texture coordinates per vertex.
    `Projection.Mesh` | `rightMesh` | The Mesh corresponding to the right eye.
    `boolean` | `singleMesh` | Whether the left and right mesh are identical.
    `int` | `stereoMode` | The stereo mode.
    `static int` | `TEXTURE_COORDS_PER_VERTEX` | Number of position coordinates per vertex.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Projection​(Projection.Mesh mesh, int stereoMode)` | Creates a Projection with single mesh.
    `Projection​(Projection.Mesh leftMesh, Projection.Mesh rightMesh, int stereoMode)` | Creates a Projection with dual mesh.

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static Projection` | `createEquirectangular​(float radius, int latitudes, int longitudes, float verticalFovDegrees, float horizontalFovDegrees, int stereoMode)` | Generates an equirectangular projection.
    `static Projection` | `createEquirectangular​(int stereoMode)` | Generates a complete sphere equirectangular projection.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DRAW_MODE_TRIANGLES

          public static final int DRAW_MODE_TRIANGLES

      Triangle draw mode.
      See Also:
        Constant Field Values

    - #### DRAW_MODE_TRIANGLES_STRIP

          public static final int DRAW_MODE_TRIANGLES_STRIP

      Triangle strip draw mode.
      See Also:
        Constant Field Values

    - #### DRAW_MODE_TRIANGLES_FAN

          public static final int DRAW_MODE_TRIANGLES_FAN

      Triangle fan draw mode.
      See Also:
        Constant Field Values

    - #### TEXTURE_COORDS_PER_VERTEX

          public static final int TEXTURE_COORDS_PER_VERTEX

      Number of position coordinates per vertex.
      See Also:
        Constant Field Values

    - #### POSITION_COORDS_PER_VERTEX

          public static final int POSITION_COORDS_PER_VERTEX

      Number of texture coordinates per vertex.
      See Also:
        Constant Field Values

    - #### leftMesh

          public final Projection.Mesh leftMesh

      The Mesh corresponding to the left eye.

    - #### rightMesh

          public final Projection.Mesh rightMesh

      The Mesh corresponding to the right eye. If `singleMesh` is true then this mesh is identical to `leftMesh`.

    - #### stereoMode

          @StereoMode
          public final int stereoMode

      The stereo mode.

    - #### singleMesh

          public final boolean singleMesh

      Whether the left and right mesh are identical.

  - ### Constructor Detail

    - #### Projection

          public Projection​(Projection.Mesh mesh,
                            int stereoMode)

      Creates a Projection with single mesh.
      Parameters:
        `mesh` - the Mesh for both eyes.
        `stereoMode` - A `C.StereoMode` value.

    - #### Projection

          public Projection​(Projection.Mesh leftMesh,
                            Projection.Mesh rightMesh,
                            int stereoMode)

      Creates a Projection with dual mesh. Use `Projection(Mesh, int)` if there is single mesh for both eyes.
      Parameters:
        `leftMesh` - the Mesh corresponding to the left eye.
        `rightMesh` - the Mesh corresponding to the right eye.
        `stereoMode` - A `C.StereoMode` value.

  - ### Method Detail

    - #### createEquirectangular

          public static Projection createEquirectangular​(@StereoMode
                                                         int stereoMode)

      Generates a complete sphere equirectangular projection.
      Parameters:
        `stereoMode` - A `C.StereoMode` value.

    - #### createEquirectangular

          public static Projection createEquirectangular​(float radius,
                                                         int latitudes,
                                                         int longitudes,
                                                         float verticalFovDegrees,
                                                         float horizontalFovDegrees,
                                                         @StereoMode
                                                         int stereoMode)

      Generates an equirectangular projection.
      Parameters:
        `radius` - Size of the sphere. Must be > 0.
        `latitudes` - Number of rows that make up the sphere. Must be >= 1.
        `longitudes` - Number of columns that make up the sphere. Must be >= 1.
        `verticalFovDegrees` - Total latitudinal degrees that are covered by the sphere. Must be in (0, 180].
        `horizontalFovDegrees` - Total longitudinal degrees that are covered by the sphere.Must be in (0, 360].
        `stereoMode` - A `C.StereoMode` value.
      Returns:
        an equirectangular projection.