SW 중심대학 OSS GIT 서버
박건태, 이승준, 고기완, 이준호
새로운 배포
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
using System;using System.Runtime.InteropServices;
namespace UnityEngine.XR.ARSubsystems{ // Removing from summary of the configuration class because this has yet to be ported.
// The camera image configuration affects the resolution of the image
// returned by <see cref="XRCameraSubsystem.TryGetLatestImage(Experimental.XR.XRCameraSubsystem, out CameraImage)"/>.
/// <summary>
/// Contains information regarding the camera configuration. Different
/// devices support different camera configurations. This includes
/// the resolution of the image and may include framerate on some platforms.
/// </summary>
[StructLayout(LayoutKind.Sequential)] public struct XRCameraConfiguration : IEquatable<XRCameraConfiguration> { Vector2Int m_Resolution;
int m_Framerate;
/// <summary>
/// The width of the camera resolution
/// </summary>
/// <value>
/// The width, in pixels, of the camera resolution
/// </value>
public int width => m_Resolution.x;
/// <summary>
/// The height of the camera resolution
/// </summary>
/// <value>
/// The height, in pixels, of the camera resolution
/// </value>
public int height => m_Resolution.y;
/// <summary>
/// The camera resolution.
/// </summary>
/// <value>
/// The camera resolution in pixels.
/// </value>
public Vector2Int resolution => m_Resolution;
/// <summary>
/// The framerate, if this camera configuration specifies one.
/// </summary>
/// <value>
/// The framerate, if this camera configuration specifies one. Otherwise, <c>null</c>.
/// </value>
/// <remarks>
/// On some platforms, different resolutions may affect the available framerate.
/// </remarks>
public int? framerate => (m_Framerate > 0) ? new int?(m_Framerate) : new int?();
/// <summary>
/// Constructs a camera configuration with a framerate.
/// </summary>
/// <param name="resolution">The resolution of the camera image.</param>
/// <param name="framerate">The camera framerate. Throws <c>ArgumentOutOfRangeException</c>
/// if <paramref name="framerate"/> is less than or equal to zero.</param>
internal XRCameraConfiguration(Vector2Int resolution, int framerate) { if (framerate <= 0) throw new ArgumentOutOfRangeException( string.Format("{0} is not a valid framerate; it must be greater than zero.", framerate));
m_Resolution = resolution; m_Framerate = framerate; }
/// <summary>
/// Constructs a camera configuration without a framerate.
/// </summary>
/// <param name="resolution">The resolution of the camera image.</param>
internal XRCameraConfiguration(Vector2Int resolution) { m_Resolution = resolution; m_Framerate = 0; }
/// <summary>
/// Converts the configuration to a string, suitable for debug logging.
/// </summary>
/// <returns></returns>
public override string ToString() => $"{width}x{height}" + (framerate.HasValue ? $" at {framerate.Value} Hz" : "");
public override int GetHashCode() { unchecked { var hash = m_Resolution.GetHashCode(); return hash * 486187739 + framerate.GetHashCode(); } }
public override bool Equals(System.Object obj) => ((obj is XRCameraConfiguration) && Equals((XRCameraConfiguration)obj)); public bool Equals(XRCameraConfiguration other) => (m_Resolution == other.m_Resolution) && (framerate == other.framerate); public static bool operator ==(XRCameraConfiguration lhs, XRCameraConfiguration rhs) => lhs.Equals(rhs); public static bool operator !=(XRCameraConfiguration lhs, XRCameraConfiguration rhs) => !lhs.Equals(rhs); }}
|