Class CameraUtility
Positions a camera based on bounds and automatically sets clipping planes to optimize the camera's depth buffer while containing the Bounds.
Inherited Members
Namespace: Unity.Cloud.DataStreaming.Runtime
Assembly: Unity.Cloud.DataStreaming.Runtime.dll
Syntax
public sealed class CameraUtility
Remarks
This script does not support usePhysicalProperties.
Constructors
CameraUtility(Camera)
Wraps the Camera so it can be manipulated through this class' utility methods.
Declaration
public CameraUtility(Camera camera)
Parameters
| Type | Name | Description |
|---|---|---|
| Camera | camera | The camera this utility class controls. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | The |
Methods
SetClipPlane(DoubleBounds)
Sets the camera's clipping planes to contain the bounds by respecting a ratio between the near and the far clipping plane.
Declaration
public void SetClipPlane(DoubleBounds bounds)
Parameters
| Type | Name | Description |
|---|---|---|
| DoubleBounds | bounds | The bounds contained within the camera's clipping planes. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | One of the provided arguments is out of range. |
| InvalidOperationException | The camera has usePhysicalProperties enabled. |
SetClipPlane(DoubleBounds, float)
Sets the camera's clipping planes to contain the bounds by respecting a ratio between the near and the far clipping plane.
Declaration
public void SetClipPlane(DoubleBounds bounds, float nearToFarRatio)
Parameters
| Type | Name | Description |
|---|---|---|
| DoubleBounds | bounds | The bounds contained within the camera's clipping planes. |
| float | nearToFarRatio | Divide the calculated far clipping plane by this value. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | One of the provided arguments is out of range. |
| InvalidOperationException | The camera has usePhysicalProperties enabled. |
SetClipPlane(Bounds)
Sets the camera's clipping planes to contain the bounds by respecting a ratio between the near and the far clipping plane.
Declaration
public void SetClipPlane(Bounds bounds)
Parameters
| Type | Name | Description |
|---|---|---|
| Bounds | bounds | The bounds contained within the camera's clipping planes. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | One of the provided arguments is out of range. |
| InvalidOperationException | The camera has usePhysicalProperties enabled. |
SetClipPlane(Bounds, float)
Sets the camera's clipping planes to contain the bounds by respecting a ratio between the near and the far clipping plane.
Declaration
public void SetClipPlane(Bounds bounds, float nearToFarRatio)
Parameters
| Type | Name | Description |
|---|---|---|
| Bounds | bounds | The bounds contained within the camera's clipping planes. |
| float | nearToFarRatio | Divide the calculated far clipping plane by this value. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | One of the provided arguments is out of range. |
| InvalidOperationException | The camera has usePhysicalProperties enabled. |
SetView(DoubleBounds)
Positions the Camera to
view the front face of the bounds.
The camera is aligned with the forward
axis, looking in the +Z direction with a distance from the bounds'
center to fit the front face in the camera view, then rotated by pitch degrees. This
method doesn't set the camera's clipping planes.
Declaration
public void SetView(DoubleBounds bounds)
Parameters
| Type | Name | Description |
|---|---|---|
| DoubleBounds | bounds | The bounds contained within the camera's view. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | One of the provided arguments is out of range. |
| InvalidOperationException | The camera has usePhysicalProperties enabled. |
SetView(DoubleBounds, float, float)
Positions the Camera to
view the front face of the bounds.
The camera is aligned with the forward
axis, looking in the +Z direction with a distance from the bounds'
center to fit the front face in the camera view, then rotated by pitch degrees. This
method doesn't set the camera's clipping planes.
Declaration
public void SetView(DoubleBounds bounds, float fillRatio, float pitch)
Parameters
| Type | Name | Description |
|---|---|---|
| DoubleBounds | bounds | The bounds contained within the camera's view. |
| float | fillRatio | The ratio of the screen covered by the front face. A value of 1.0 attempts to fill the entire screen with the given front face of the bounds. |
| float | pitch | The camera's pitch, in degrees. A positive value causes the camera to look down on the model. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | One of the provided arguments is out of range. |
| InvalidOperationException | The camera has usePhysicalProperties enabled. |
SetView(Bounds)
Positions the Camera to
view the front face of the bounds.
The camera is aligned with the forward
axis, looking in the +Z direction with a distance from the bounds'
center to fit the front face in the camera view, then rotated by pitch degrees. This
method doesn't set the camera's clipping planes.
Declaration
public void SetView(Bounds bounds)
Parameters
| Type | Name | Description |
|---|---|---|
| Bounds | bounds | The bounds contained within the camera's view. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | One of the provided arguments is out of range. |
| InvalidOperationException | The camera has usePhysicalProperties enabled. |
SetView(Bounds, float, float)
Positions the Camera to
view the front face of the bounds.
The camera is aligned with the forward
axis, looking in the +Z direction with a distance from the bounds'
center to fit the front face in the camera view, then rotated by pitch degrees. This
method doesn't set the camera's clipping planes.
Declaration
public void SetView(Bounds bounds, float fillRatio, float pitch)
Parameters
| Type | Name | Description |
|---|---|---|
| Bounds | bounds | The bounds contained within the camera's view. |
| float | fillRatio | The ratio of the screen covered by the front face. A value of 1.0 attempts to fill the entire screen with the given front face of the bounds. |
| float | pitch | The camera's pitch, in degrees. A positive value causes the camera to look down on the model. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | One of the provided arguments is out of range. |
| InvalidOperationException | The camera has usePhysicalProperties enabled. |