using System;
using System.Runtime.InteropServices;
using System.Text;
using UnityEngine.Rendering;
namespace UnityEngine.XR.ARSubsystems
{
///
/// Represents the properties included in the camera frame.
///
[Flags]
public enum XRCameraFrameProperties
{
///
/// The timestamp of the frame is included.
///
Timestamp = (1 << 0),
///
/// The average brightness of the frame is included.
///
AverageBrightness = (1 << 1),
///
/// The average color temperature of the frame is included.
///
AverageColorTemperature = (1 << 2),
///
/// The color correction value of the frame is included.
///
ColorCorrection = (1 << 3),
///
/// The projection matrix for the frame is included.
///
ProjectionMatrix = (1 << 4),
///
/// The display matrix for the frame is included.
///
DisplayMatrix = (1 << 5),
///
/// The average intensity in lumens is included.
///
AverageIntensityInLumens = (1 << 6),
///
/// The camera exposure duration is included.
///
ExposureDuration = (1 << 7),
///
/// The camera exposure offset is included.
///
ExposureOffset = (1 << 8),
///
/// The estimated scene main light direction is included.
///
MainLightDirection = (1 << 9),
///
/// The estimated scene main light color is included.
///
MainLightColor = (1 << 10),
///
/// The estimated scene main light intensity in lumens is included.
///
MainLightIntensityLumens = (1 << 11),
///
/// Ambient spherical harmonics are included.
///
AmbientSphericalHarmonics = (1 << 12),
///
/// The camera grain texture is included.
///
CameraGrain = (1 << 13),
///
/// The camera grain noise intensity is included.
///
NoiseIntensity = (1 << 14),
///
/// EXIF data for the frame is included.
///
ExifData = (1 << 15),
}
///
/// Represents a frame captured by the device camera with included metadata.
///
[StructLayout(LayoutKind.Sequential)]
public struct XRCameraFrame : IEquatable
{
///
/// The timestamp of the frame, in nanoseconds.
///
/// The timestamp.
[Obsolete("timestampNs has been deprecated in AR Foundation version 6.0. Use TryGetTimestamp instead.")]
public long timestampNs => m_TimestampNs;
long m_TimestampNs;
///
/// The average pixel intensity of the frame in gamma color space, used to match the intensity of light in the
/// real-world environment. Values are in the range [0.0, 1.0] with zero being black and one being white.
///
/// The average pixel intensity of the frame.
///
[Obsolete("averageBrightness has been deprecated in AR Foundation version 6.0. Use TryGetAverageBrightness instead.")]
public float averageBrightness => m_AverageBrightness;
float m_AverageBrightness;
///
/// The estimated color temperature of ambient light in the frame, in degrees Kelvin.
///
/// The estimated color temperature.
///
/// A value of 6500 represents neutral (pure white) lighting; lower values indicate a "warmer" yellow or
/// orange tint, and higher values indicate a "cooler" blue tint.
///
[Obsolete("averageColorTemperature has been deprecated in AR Foundation version 6.0. Use TryGetAverageColorTemperature instead.")]
public float averageColorTemperature => m_AverageColorTemperature;
float m_AverageColorTemperature;
///
/// The estimated color correction value of the frame.
///
/// The color correction value.
///
/// The RGB scale factors are not intended to brighten nor dim the scene. They are only to shift the color
/// of virtual objects towards the color of the light; not intensity of the light.
///
[Obsolete("colorCorrection has been deprecated in AR Foundation version 6.0. Use TryGetColorCorrection instead.")]
public Color colorCorrection => m_ColorCorrection;
Color m_ColorCorrection;
///
/// The 4x4 projection matrix for the frame.
///
/// The projection matrix.
[Obsolete("projectionMatrix has been deprecated in AR Foundation version 6.0. Use TryGetProjectionMatrix instead.")]
public Matrix4x4 projectionMatrix => m_ProjectionMatrix;
Matrix4x4 m_ProjectionMatrix;
///
/// The 4x4 display matrix for the frame. Defines how to render the frame to the screen.
///
/// The display matrix.
[Obsolete("displayMatrix has been deprecated in AR Foundation version 6.0. Use TryGetDisplayMatrix instead.")]
public Matrix4x4 displayMatrix => m_DisplayMatrix;
Matrix4x4 m_DisplayMatrix;
///
/// The camera's when this frame was captured.
///
/// The tracking state.
public TrackingState trackingState => m_TrackingState;
TrackingState m_TrackingState;
///
/// The native pointer associated with this frame.
/// The data pointed to by this pointer is specific to provider implementation.
///
/// The native pointer.
public IntPtr nativePtr => m_NativePtr;
IntPtr m_NativePtr;
///
/// The set of flags that indicates which properties are included in the frame.
///
/// The included camera frame properties.
public XRCameraFrameProperties properties => m_Properties;
XRCameraFrameProperties m_Properties;
///
/// The estimated intensity of the real-world environment, in lumens.
/// Represents an average of directional light sources.
///
/// The estimated intensity.
///
[Obsolete("averageIntensityInLumens has been deprecated in AR Foundation version 6.0. Use TryGetAverageIntensityInLumens instead.")]
public float averageIntensityInLumens => m_AverageIntensityInLumens;
float m_AverageIntensityInLumens;
///
/// The camera exposure duration of the frame, in seconds with sub-millisecond precision.
///
/// The camera exposure duration.
[Obsolete("exposureDuration has been deprecated in AR Foundation version 6.0. Use TryGetExposureDuration instead.")]
public double exposureDuration => m_ExposureDuration;
double m_ExposureDuration;
///
/// The camera exposure offset of the frame for lighting scaling.
///
/// The camera exposure offset.
[Obsolete("exposureOffset has been deprecated in AR Foundation version 6.0. Use TryGetExposureOffset instead.")]
public float exposureOffset => m_ExposureOffset;
float m_ExposureOffset;
///
/// The estimated intensity in lumens of the strongest directional light source in the real-world environment.
///
/// The estimated intensity of the main light.
[Obsolete("mainLightIntensityLumens has been deprecated in AR Foundation version 6.0. Use TryGetMainLightIntensityLumens instead.")]
public float mainLightIntensityLumens => m_MainLightIntensityLumens;
float m_MainLightIntensityLumens;
///
/// The estimated color of the strongest directional light source in the real-world environment.
///
/// The estimated color of the main light.
[Obsolete("mainLightColor has been deprecated in AR Foundation version 6.0. Use TryGetMainLightColor instead.")]
public Color mainLightColor => m_MainLightColor;
Color m_MainLightColor;
///
/// The estimated direction of the strongest directional light source in the real-world environment.
///
/// The estimated direction of the main light.
[Obsolete("mainLightDirection has been deprecated in AR Foundation version 6.0. Use TryGetMainLightDirection instead.")]
public Vector3 mainLightDirection => m_MainLightDirection;
Vector3 m_MainLightDirection;
///
/// The ambient spherical harmonic coefficients that represent the real-world lighting.
///
/// The ambient spherical harmonic coefficients.
///
/// See Rendering.SphericalHarmonicsL2
/// for further details.
///
[Obsolete("ambientSphericalHarmonics has been deprecated in AR Foundation version 6.0. Use TryGetAmbientSphericalHarmonics instead.")]
public SphericalHarmonicsL2 ambientSphericalHarmonics => m_AmbientSphericalHarmonics;
SphericalHarmonicsL2 m_AmbientSphericalHarmonics;
///
/// A texture that simulates the camera's noise.
///
/// The camera grain texture.
[Obsolete("cameraGrain has been deprecated in AR Foundation version 6.0. Use TryGetCameraGrain instead.")]
public XRTextureDescriptor cameraGrain => m_CameraGrain;
XRTextureDescriptor m_CameraGrain;
///
/// The level of intensity of camera grain noise in a scene.
///
/// The noise intensity.
[Obsolete("noiseIntensity has been deprecated in AR Foundation version 6.0. Use TryGetNoiseIntensity instead.")]
public float noiseIntensity => m_NoiseIntensity;
float m_NoiseIntensity;
///
/// The frame's EXIF data.
///
/// The EXIF data.
XRCameraFrameExifData m_ExifData;
///
/// Indicates whether was assigned a value.
///
/// if the frame has a timestamp. Otherwise, .
[Obsolete("hasTimestamp has been deprecated in AR Foundation version 6.0. Use TryGetTimestamp instead.")]
public bool hasTimestamp => (m_Properties & XRCameraFrameProperties.Timestamp) != 0;
///
/// Indicates whether was assigned a value.
///
/// if the frame has an average brightness value. Otherwise, .
[Obsolete("hasAverageBrightness has been deprecated in AR Foundation version 6.0. Use TryGetAverageBrightness instead.")]
public bool hasAverageBrightness => (m_Properties & XRCameraFrameProperties.AverageBrightness) != 0;
///
/// Indicates whether was assigned a value.
///
/// if the frame has an average color temperature value. Otherwise, .
[Obsolete("hasAverageColorTemperature has been deprecated in AR Foundation version 6.0. Use TryGetAverageColorTemperature instead.")]
public bool hasAverageColorTemperature => (m_Properties & XRCameraFrameProperties.AverageColorTemperature) != 0;
///
/// Indicates whether was assigned a value.
///
/// if the frame has a color correction value. Otherwise, .
[Obsolete("hasColorCorrection has been deprecated in AR Foundation version 6.0. Use TryGetColorCorrection instead.")]
public bool hasColorCorrection => (m_Properties & XRCameraFrameProperties.ColorCorrection) != 0;
///
/// Indicates whether was assigned a value.
///
/// if the frame has a projection matrix. Otherwise, .
[Obsolete("hasProjectionMatrix has been deprecated in AR Foundation version 6.0. Use TryGetProjectionMatrix instead.")]
public bool hasProjectionMatrix => (m_Properties & XRCameraFrameProperties.ProjectionMatrix) != 0;
///
/// Indicates whether was assigned a value.
///
/// if the frame has a display matrix. Otherwise, .
[Obsolete("hasDisplayMatrix has been deprecated in AR Foundation version 6.0. Use TryGetDisplayMatrix instead.")]
public bool hasDisplayMatrix => (m_Properties & XRCameraFrameProperties.DisplayMatrix) != 0;
///
/// Indicates whether was assigned a value.
///
/// if the frame has an average intensity value in lumens. Otherwise, .
[Obsolete("hasAverageIntensityInLumens has been deprecated in AR Foundation version 6.0. Use TryGetAverageIntensityInLumens instead.")]
public bool hasAverageIntensityInLumens => (m_Properties & XRCameraFrameProperties.AverageIntensityInLumens) != 0;
///
/// Indicates whether was assigned a value.
///
/// if the frame has an exposure duration value. Otherwise, .
[Obsolete("hasExposureDuration has been deprecated in AR Foundation version 6.0. Use TryGetExposureDuration instead.")]
public bool hasExposureDuration => (m_Properties & XRCameraFrameProperties.ExposureDuration) != 0;
///
/// Indicates whether was assigned a value.
///
/// if the frame has an exposure offset value. Otherwise, .
[Obsolete("hasExposureOffset has been deprecated in AR Foundation version 6.0. Use TryGetExposureOffset instead.")]
public bool hasExposureOffset => (m_Properties & XRCameraFrameProperties.ExposureOffset) != 0;
///
/// Indicates whether was assigned a value.
///
/// if the frame has an estimated main light intensity value. Otherwise, .
[Obsolete("hasMainLightIntensityLumens has been deprecated in AR Foundation version 6.0. Use TryGetMainLightIntensityLumens instead.")]
public bool hasMainLightIntensityLumens => (m_Properties & XRCameraFrameProperties.MainLightIntensityLumens) != 0;
///
/// Indicates whether was assigned a value.
///
/// if the frame has an estimated main light color value. Otherwise, .
[Obsolete("hasMainLightColor has been deprecated in AR Foundation version 6.0. Use TryGetMainLightColor instead.")]
public bool hasMainLightColor => (m_Properties & XRCameraFrameProperties.MainLightColor) != 0;
///
/// Indicates whether was assigned a value.
///
/// if the frame has an estimated main light direction value. Otherwise, .
[Obsolete("hasMainLightDirection has been deprecated in AR Foundation version 6.0. Use TryGetMainLightDirection instead.")]
public bool hasMainLightDirection => (m_Properties & XRCameraFrameProperties.MainLightDirection) != 0;
///
/// Indicates whether was assigned a value.
///
/// if the frame has values for ambient spherical harmonics coefficients.
/// Otherwise, .
[Obsolete("hasAmbientSphericalHarmonics has been deprecated in AR Foundation version 6.0. Use TryGetAmbientSphericalHarmonics instead.")]
public bool hasAmbientSphericalHarmonics => (m_Properties & XRCameraFrameProperties.AmbientSphericalHarmonics) != 0;
///
/// Indicates whether was assigned a value.
///
/// if the frame has a camera grain texture. Otherwise, .
[Obsolete("hasCameraGrain has been deprecated in AR Foundation version 6.0. Use TryGetCameraGrain instead.")]
public bool hasCameraGrain => (m_Properties & XRCameraFrameProperties.CameraGrain) != 0;
///
/// Indicates whether was assigned a value.
///
/// if the frame has a camera grain noise intensity value. Otherwise, .
[Obsolete("hasNoiseIntensity has been deprecated in AR Foundation version 6.0. Use TryGetNoiseIntensity instead.")]
public bool hasNoiseIntensity => (m_Properties & XRCameraFrameProperties.NoiseIntensity) != 0;
///
/// Creates a .
///
/// The timestamp of the frame, in nanoseconds.
/// The estimated intensity of the frame, in gamma color space.
/// The estimated color temperature of the frame.
/// The estimated color correction value of the frame.
/// The 4x4 projection matrix for the frame.
/// The 4x4 display matrix for the frame.
/// The camera's when the frame was captured.
/// The native pointer associated with the frame.
/// The set of flags that indicates which properties are included in the frame..
/// The estimated intensity of the real-world environment, in lumens.
/// The camera exposure duration of the frame, in seconds with sub-millisecond precision.
/// The camera exposure offset of the frame for lighting scaling.
/// The estimated intensity in lumens of strongest real-world directional light source.
/// The estimated color of the strongest real-world directional light source.
/// The estimated direction of the strongest real-world directional light source.
/// The ambient spherical harmonic coefficients that represent the real-world lighting.
/// A texture that simulates the camera's noise.
/// The level of intensity of camera grain noise in a scene.
public XRCameraFrame(
long timestamp,
float averageBrightness,
float averageColorTemperature,
Color colorCorrection,
Matrix4x4 projectionMatrix,
Matrix4x4 displayMatrix,
TrackingState trackingState,
IntPtr nativePtr,
XRCameraFrameProperties properties,
float averageIntensityInLumens,
double exposureDuration,
float exposureOffset,
float mainLightIntensityInLumens,
Color mainLightColor,
Vector3 mainLightDirection,
SphericalHarmonicsL2 ambientSphericalHarmonics,
XRTextureDescriptor cameraGrain,
float noiseIntensity)
{
m_TimestampNs = timestamp;
m_AverageBrightness = averageBrightness;
m_AverageColorTemperature = averageColorTemperature;
m_ColorCorrection = colorCorrection;
m_ProjectionMatrix = projectionMatrix;
m_DisplayMatrix = displayMatrix;
m_TrackingState = trackingState;
m_NativePtr = nativePtr;
m_Properties = properties;
m_AverageIntensityInLumens = averageIntensityInLumens;
m_ExposureDuration = exposureDuration;
m_ExposureOffset = exposureOffset;
m_MainLightIntensityLumens = mainLightIntensityInLumens;
m_MainLightColor = mainLightColor;
m_MainLightDirection = mainLightDirection;
m_AmbientSphericalHarmonics = ambientSphericalHarmonics;
m_CameraGrain = cameraGrain;
m_NoiseIntensity = noiseIntensity;
m_ExifData = default;
}
///
/// Creates a with EXIF data.
///
/// The timestamp of the frame, in nanoseconds.
/// The estimated intensity of the frame, in gamma color space.
/// The estimated color temperature of the frame.
/// The estimated color correction value of the frame.
/// The 4x4 projection matrix for the frame.
/// The 4x4 display matrix for the frame.
/// The camera's when the frame was captured.
/// The native pointer associated with the frame.
/// The set of flags that indicates which properties are included in the frame.
/// The estimated intensity of the real-world environment, in lumens.
/// The camera exposure duration of the frame, in seconds with sub-millisecond precision.
/// The camera exposure offset of the frame for lighting scaling.
/// The estimated intensity in lumens of strongest real-world directional light source.
/// The estimated color of the strongest real-world directional light source.
/// The estimated direction of the strongest real-world directional light source.
/// The ambient spherical harmonic coefficients that represent the real-world lighting.
/// A texture that simulates the camera's noise.
/// The level of intensity of camera grain noise in a scene.
/// The EXIF data.
public XRCameraFrame(
long timestamp,
float averageBrightness,
float averageColorTemperature,
Color colorCorrection,
Matrix4x4 projectionMatrix,
Matrix4x4 displayMatrix,
TrackingState trackingState,
IntPtr nativePtr,
XRCameraFrameProperties properties,
float averageIntensityInLumens,
double exposureDuration,
float exposureOffset,
float mainLightIntensityInLumens,
Color mainLightColor,
Vector3 mainLightDirection,
SphericalHarmonicsL2 ambientSphericalHarmonics,
XRTextureDescriptor cameraGrain,
float noiseIntensity,
XRCameraFrameExifData exifData)
: this(timestamp, averageBrightness, averageColorTemperature,
colorCorrection, projectionMatrix, displayMatrix,
trackingState, nativePtr, properties,
averageIntensityInLumens, exposureDuration, exposureOffset,
mainLightIntensityInLumens, mainLightColor, mainLightDirection,
ambientSphericalHarmonics, cameraGrain, noiseIntensity)
{
m_ExifData = exifData;
}
///
/// Get the timestamp of the frame if possible.
///
/// The timestamp of the camera frame, equal to .
/// if the frame has a timestamp. Otherwise, .
/// Equal to .
public bool TryGetTimestamp(out long timestampNs)
{
if ((m_Properties & XRCameraFrameProperties.Timestamp) != 0)
{
timestampNs = m_TimestampNs;
return true;
}
timestampNs = default;
return false;
}
///
/// Get the average brightness of the frame if possible.
///
/// The average pixel intensity of the frame, equal to .
/// if the frame has an average brightness value. Otherwise, .
/// Equal to .
public bool TryGetAverageBrightness(out float averageBrightness)
{
if ((m_Properties & XRCameraFrameProperties.AverageBrightness) != 0)
{
averageBrightness = m_AverageBrightness;
return true;
}
averageBrightness = default;
return false;
}
///
/// Get the estimated color temperature of the frame if possible.
///
/// The estimated color temperature of the frame, in degrees Kelvin.
/// Equal to .
/// if the frame has an estimated color temperature value. Otherwise, .
/// Equal to .
public bool TryGetAverageColorTemperature(out float averageColorTemperature)
{
if ((m_Properties & XRCameraFrameProperties.AverageColorTemperature) != 0)
{
averageColorTemperature = m_AverageColorTemperature;
return true;
}
averageColorTemperature = default;
return false;
}
///
/// Get the color correction value of the frame if possible.
///
/// The color correction value of the frame.
/// Equal to .
/// if the frame has a color correction value. Otherwise, .
public bool TryGetColorCorrection(out Color colorCorrection)
{
if ((m_Properties & XRCameraFrameProperties.ColorCorrection) != 0)
{
colorCorrection = m_ColorCorrection;
return true;
}
colorCorrection = default;
return false;
}
///
/// Get the projection matrix for the frame if possible.
///
/// The projection matrix. Equal to .
/// if the frame has a projection matrix. Otherwise, .
public bool TryGetProjectionMatrix(out Matrix4x4 projectionMatrix)
{
if ((m_Properties & XRCameraFrameProperties.ProjectionMatrix) != 0)
{
projectionMatrix = m_ProjectionMatrix;
return true;
}
projectionMatrix = default;
return false;
}
///
/// Get the display matrix for the frame if possible.
///
/// The display matrix. It is row-major and includes flipping the y-axis of the texture
/// coordinates. Equal to .
/// if the frame has a display matrix. Otherwise, .
public bool TryGetDisplayMatrix(out Matrix4x4 displayMatrix)
{
if ((m_Properties & XRCameraFrameProperties.DisplayMatrix) != 0)
{
displayMatrix = m_DisplayMatrix;
return true;
}
displayMatrix = default;
return false;
}
///
/// Get the estimated intensity in lumens of the real-world environment, if possible.
///
/// The estimated intensity. Equal to .
/// if the frame has an estimated intensity value in lumens. Otherwise, .
public bool TryGetAverageIntensityInLumens(out float averageIntensityInLumens)
{
if ((m_Properties & XRCameraFrameProperties.AverageIntensityInLumens) != 0)
{
averageIntensityInLumens = m_AverageIntensityInLumens;
return true;
}
averageIntensityInLumens = default;
return false;
}
///
/// Get the camera exposure duration of the frame, if possible.
///
/// The camera exposure duration of the frame. Equal to .
/// if the frame has an exposure duration value. Otherwise, .
public bool TryGetExposureDuration(out double exposureDuration)
{
if ((m_Properties & XRCameraFrameProperties.ExposureDuration) != 0)
{
exposureDuration = m_ExposureDuration;
return true;
}
exposureDuration = default;
return false;
}
///
/// Get the camera exposure offset of the frame, if possible.
///
/// The camera exposure offset of the frame. Equal to .
/// if the frame has an exposure offset value. Otherwise, .
public bool TryGetExposureOffset(out float exposureOffset)
{
if ((m_Properties & XRCameraFrameProperties.ExposureOffset) != 0)
{
exposureOffset = m_ExposureOffset;
return true;
}
exposureOffset = default;
return false;
}
///
/// Get the estimated main light intensity of the frame, if possible.
///
/// The estimated main light intensity of the frame. Equal to .
/// if the frame has an estimated main light intensity value. Otherwise, .
public bool TryGetMainLightIntensityLumens(out float mainLightIntensityLumens)
{
if ((m_Properties & XRCameraFrameProperties.MainLightIntensityLumens) != 0)
{
mainLightIntensityLumens = m_MainLightIntensityLumens;
return true;
}
mainLightIntensityLumens = default;
return false;
}
///
/// Get the estimated main light color of the frame, if possible.
///
/// The estimated main light color of the frame. Equal to .
/// if the frame has an estimated main light color value. Otherwise, .
public bool TryGetMainLightColor(out Color mainLightColor)
{
if ((m_Properties & XRCameraFrameProperties.MainLightColor) != 0)
{
mainLightColor = m_MainLightColor;
return true;
}
mainLightColor = default;
return false;
}
///
/// Get the estimated main light direction of the frame, if possible.
///
/// The estimated main light direction of the frame. Equal to .
/// if the frame has an estimated main light direction value. Otherwise, .
public bool TryGetMainLightDirection(out Vector3 mainLightDirection)
{
if ((m_Properties & XRCameraFrameProperties.MainLightDirection) != 0)
{
mainLightDirection = m_MainLightDirection;
return true;
}
mainLightDirection = default;
return false;
}
///
/// Get the ambient spherical harmonic coefficients of the frame, if possible.
///
/// The ambient spherical harmonic coefficients of the frame. Equal to .
/// if the frame has values for ambient spherical harmonics coefficients. Otherwise, .
public bool TryGetAmbientSphericalHarmonics(out SphericalHarmonicsL2 ambientSphericalHarmonics)
{
if ((m_Properties & XRCameraFrameProperties.AmbientSphericalHarmonics) != 0)
{
ambientSphericalHarmonics = m_AmbientSphericalHarmonics;
return true;
}
ambientSphericalHarmonics = default;
return false;
}
///
/// Get the camera grain texture of the frame, if possible.
///
/// The camera grain texture of the frame. Equal to .
/// if the frame has a camera grain texture. Otherwise, .
public bool TryGetCameraGrain(out XRTextureDescriptor cameraGrain)
{
if ((m_Properties & XRCameraFrameProperties.CameraGrain) != 0)
{
cameraGrain = m_CameraGrain;
return true;
}
cameraGrain = default;
return false;
}
///
/// Get the camera grain noise intensity of the frame, if possible.
///
/// The camera grain noise intensity of the frame. Equal to .
/// if the frame has a camera grain noise intensity value. Otherwise, .
public bool TryGetNoiseIntensity(out float noiseIntensity)
{
if ((m_Properties & XRCameraFrameProperties.NoiseIntensity) != 0)
{
noiseIntensity = m_NoiseIntensity;
return true;
}
noiseIntensity = default;
return false;
}
///
/// Get the frame's EXIF data, if possible.
///
/// The EXIF data.
/// if the frame has EXIF data.
/// Otherwise, returns .
public bool TryGetExifData(out XRCameraFrameExifData exifData)
{
if ((m_Properties & XRCameraFrameProperties.ExifData) != 0)
{
exifData = m_ExifData;
return true;
}
exifData = default;
return false;
}
///
/// Compares for equality.
///
/// The other to compare against.
/// if the represents the same object.
/// Otherwise, .
public bool Equals(XRCameraFrame other)
{
return (m_TimestampNs.Equals(other.m_TimestampNs) && m_AverageBrightness.Equals(other.m_AverageBrightness)
&& m_AverageColorTemperature.Equals(other.m_AverageColorTemperature)
&& m_ProjectionMatrix.Equals(other.m_ProjectionMatrix)
&& m_DisplayMatrix.Equals(other.m_DisplayMatrix)
&& m_AverageIntensityInLumens.Equals(other.m_AverageIntensityInLumens)
&& m_ExposureDuration.Equals(other.m_ExposureDuration)
&& m_ExposureOffset.Equals(other.m_ExposureOffset)
&& m_MainLightDirection.Equals(other.m_MainLightDirection)
&& m_MainLightIntensityLumens.Equals(other.m_MainLightIntensityLumens)
&& m_MainLightColor.Equals(other.m_MainLightColor)
&& m_AmbientSphericalHarmonics.Equals(other.m_AmbientSphericalHarmonics)
&& m_CameraGrain.Equals(other.m_CameraGrain)
&& m_NoiseIntensity.Equals(other.m_NoiseIntensity)
&& m_ExifData.Equals(other.m_ExifData)
&& (m_Properties == other.m_Properties));
}
///
/// Compares for equality.
///
/// An object to compare against.
/// if is an and
/// is also . Otherwise, .
public override bool Equals(System.Object obj)
{
return ((obj is XRCameraFrame) && Equals((XRCameraFrame)obj));
}
///
/// Compares and for equality using .
///
/// The left-hand-side of the comparison.
/// The right-hand-side of the comparison.
/// if compares equal to .
/// Otherwise, .
public static bool operator ==(XRCameraFrame lhs, XRCameraFrame rhs)
{
return lhs.Equals(rhs);
}
///
/// Compares and for inequality using .
///
/// The left-hand-side of the comparison.
/// The right-hand-side of the comparison.
/// if compares equal to .
/// Otherwise, .
public static bool operator !=(XRCameraFrame lhs, XRCameraFrame rhs)
{
return !lhs.Equals(rhs);
}
///
/// Generates a hash code suitable for use in HashSet and Dictionary.
///
/// A hash of this .
public override int GetHashCode()
{
int hashCode = 486187739;
unchecked
{
hashCode = (hashCode * 486187739) + m_TimestampNs.GetHashCode();
hashCode = (hashCode * 486187739) + m_AverageBrightness.GetHashCode();
hashCode = (hashCode * 486187739) + m_AverageColorTemperature.GetHashCode();
hashCode = (hashCode * 486187739) + m_ColorCorrection.GetHashCode();
hashCode = (hashCode * 486187739) + m_ProjectionMatrix.GetHashCode();
hashCode = (hashCode * 486187739) + m_DisplayMatrix.GetHashCode();
hashCode = (hashCode * 486187739) + m_AverageIntensityInLumens.GetHashCode();
hashCode = (hashCode * 486187739) + m_ExposureDuration.GetHashCode();
hashCode = (hashCode * 486187739) + m_ExposureOffset.GetHashCode();
hashCode = (hashCode * 486187739) + m_MainLightDirection.GetHashCode();
hashCode = (hashCode * 486187739) + m_MainLightColor.GetHashCode();
hashCode = (hashCode * 486187739) + m_AmbientSphericalHarmonics.GetHashCode();
hashCode = (hashCode * 486187739) + m_MainLightIntensityLumens.GetHashCode();
hashCode = (hashCode * 486187739) + m_CameraGrain.GetHashCode();
hashCode = (hashCode * 486187739) + m_NoiseIntensity.GetHashCode();
hashCode = (hashCode * 486187739) + m_ExifData.GetHashCode();
hashCode = (hashCode * 486187739) + m_NativePtr.GetHashCode();
hashCode = (hashCode * 486187739) + ((int)m_Properties).GetHashCode();
}
return hashCode;
}
///
/// Generates a string representation of this suitable for debugging purposes.
///
/// A string representation of this .
public override string ToString()
{
var sb = new StringBuilder();
sb.AppendLine("{");
sb.AppendLine($" TimestampNs: {m_TimestampNs}");
sb.AppendLine($" AverageBrightness: {m_AverageBrightness:0.000}");
sb.AppendLine($" AverageColorTemperature: {m_AverageColorTemperature:0.000}");
sb.AppendLine($" ColorCorrection: {m_ColorCorrection}");
sb.AppendLine($" ProjectionMatrix: {m_ProjectionMatrix:0.000}");
sb.AppendLine($" DisplayMatrix: {m_DisplayMatrix:0.000}");
sb.AppendLine($" ExposureDuration: {m_ExposureDuration:0.000}");
sb.AppendLine($" ExposureOffset: {m_ExposureOffset}");
sb.AppendLine($" MainLightDirection: {m_MainLightDirection:0.000}");
sb.AppendLine($" MainLightIntensityLumens: {m_MainLightIntensityLumens:0.000}");
sb.AppendLine($" MainLightColor: {m_MainLightColor:0.000}");
sb.AppendLine($" AmbientSphericalHarmonics: {m_AmbientSphericalHarmonics}");
sb.AppendLine($" NoiseIntensity: {m_NoiseIntensity:0.000}");
sb.AppendLine($" NativePtr: {m_NativePtr.ToString("X16")}");
sb.AppendLine($" ExifData: {m_ExifData.ToString()}");
sb.AppendLine("}");
return sb.ToString();
}
}
}