Page Summary
-
FieldOfViewencapsulates a 3D field of view using four half-angles (left, right, bottom, top) similar toglFrustum. -
It provides methods to set, retrieve, and copy these angles, as well as generate a perspective projection matrix.
-
You can create a
FieldOfViewinstance using specific angles or by copying an existing one. -
It includes a static method to retrieve the field of view parameters for Cardboard V1.0.0.
-
FieldOfViewoffers utility methods likeequalsfor comparison andtoStringfor a human-readable representation.
Encapsulates a field of view composed of 4 half angles (left, right, bottom, top) as would be passed to glFrustum.
Public Constructors
|
FieldOfView(float left, float right, float bottom, float top)
Creates a new field of view object with the provided params.
|
|
|
FieldOfView(FieldOfView other)
Constructs a new field of view object copying the contents from another.
|
Public Methods
| static FieldOfView |
cardboardV1FieldOfView()
Returns parameters for Cardboard V1.0.0
|
| void | |
| boolean | |
| float |
getBottom()
Returns the bottom field of view half-angle in degrees.
|
| float |
getLeft()
Returns the left field of view half-angle in degrees.
|
| float |
getRight()
Returns the right field of view half-angle in degrees.
|
| float |
getTop()
Returns the top field of view half-angle in degrees.
|
| void |
setAngles(float left, float right, float bottom, float top)
Sets the four half-angles of the field of view.
|
| void |
setBottom(float bottom)
Sets the bottom field of view half-angle in degrees.
|
| void |
setLeft(float left)
Sets the left field of view half-angle in degrees.
|
| void |
setRight(float right)
Sets the right field of view half-angle in degrees.
|
| void |
setTop(float top)
Sets the top field of view half-angle in degrees.
|
| void |
toPerspectiveMatrix(float near, float far, float[] perspective, int offset)
Generates a perspective projection matrix from this object.
|
| String |
toString()
Returns a string containing a concise, human-readable description of this object.
|
Inherited Methods
Public Constructors
public FieldOfView ()
public FieldOfView (float left, float right, float bottom, float top)
Creates a new field of view object with the provided params.
Parameters
| left | The left field of view half-angle in degrees. |
|---|---|
| right | The right field of view half-angle in degrees. |
| bottom | The bottom field of view half-angle in degrees. |
| top | The top field of view half-angle in degrees. |
public FieldOfView (FieldOfView other)
Constructs a new field of view object copying the contents from another.
Parameters
| other | The other FieldOfView to copy from. |
|---|
Public Methods
public void copy (FieldOfView other)
Copies the contents of another FieldOfView into this one.
Parameters
| other | The FieldOfView object to copy from. |
|---|
public boolean equals (Object other)
Compares this instance with the specified object and indicates if they are equal.
Parameters
| other | The object to compare this instance with. |
|---|
Returns
trueif the objects are equal,falseotherwise.
public float getBottom ()
Returns the bottom field of view half-angle in degrees.
Returns
- The bottom field of view half-angle in degrees.
public float getLeft ()
Returns the left field of view half-angle in degrees.
Returns
- The left field of view half-angle in degrees.
public float getRight ()
Returns the right field of view half-angle in degrees.
Returns
- The right field of view half-angle in degrees.
public float getTop ()
Returns the top field of view half-angle in degrees.
Returns
- The top field of view half-angle in degrees.
public void setAngles (float left, float right, float bottom, float top)
Sets the four half-angles of the field of view.
Parameters
| left | The left field of view half-angle in degrees. |
|---|---|
| right | The right field of view half-angle in degrees. |
| bottom | The bottom field of view half-angle in degrees. |
| top | The top field of view half-angle in degrees. |
public void setBottom (float bottom)
Sets the bottom field of view half-angle in degrees.
Parameters
| bottom | The bottom field of view half-angle in degrees. |
|---|
public void setLeft (float left)
Sets the left field of view half-angle in degrees.
Parameters
| left | The left field of view half-angle in degrees. |
|---|
public void setRight (float right)
Sets the right field of view half-angle in degrees.
Parameters
| right | The right field of view half-angle in degrees. |
|---|
public void setTop (float top)
Sets the top field of view half-angle in degrees.
Parameters
| top | The top field of view half-angle in degrees. |
|---|
public void toPerspectiveMatrix (float near, float far, float[] perspective, int offset)
Generates a perspective projection matrix from this object.
Parameters
| near | The near plane. |
|---|---|
| far | The far plane. |
| perspective | The perspective matrix to fill. |
| offset | The offset into the perspective array to write the matrix to. |
Throws
| IllegalArgumentException | If there is not enough space to write the result. |
|---|
public String toString ()
Returns a string containing a concise, human-readable description of this object.
Returns
- A printable representation of this object.