XRCameraFrame.cs 23.8 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Text;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using UnityEngine.Rendering;

namespace UnityEngine.XR.ARSubsystems
{
    /// <summary>
    /// Represents the properties included in the camera frame.
    /// </summary>
    [Flags]
    public enum XRCameraFrameProperties
    {
        /// <summary>
        /// The timestamp of the frame is included.
        /// </summary>
        [Description("Timestamp")]
        Timestamp = (1 << 0),

        /// <summary>
        /// The average brightness of the frame is included.
        /// </summary>
        [Description("AverageBrightness")]
        AverageBrightness = (1 << 1),

        /// <summary>
        /// The average color temperature of the frame is included.
        /// </summary>
        [Description("AverageColorTemperature")]
        AverageColorTemperature = (1 << 2),

        /// <summary>
        /// The color correction value of the frame is included.
        /// </summary>
        [Description("ColorCorrection")]
        ColorCorrection = (1 << 3),

        /// <summary>
        /// The project matrix for the frame is included.
        /// </summary>
        [Description("ProjectionMatrix")]
        ProjectionMatrix = (1 << 4),

        /// <summary>
        /// The display matrix for the frame is included.
        /// </summary>
        [Description("DisplayMatrix")]
        DisplayMatrix = (1 << 5),

        /// <summary>
        /// The average intensity in lumens is included.
        /// </summary>
        [Description("AverageIntensityInLumens")]
        AverageIntensityInLumens = (1 << 6),

        /// <summary>
        /// The camera exposure duration is included.
        /// </summary>
        [Description("ExposureDuration")]
        ExposureDuration = (1 << 7),

        /// <summary>
        /// The camera exposure offset is included.
        /// </summary>
        [Description("ExposureOffset")]
        ExposureOffset = (1 << 8),

        /// <summary>
        /// The estimated scene main light direction is included.
        /// </summary>
        [Description("MainLightDirection")]
        MainLightDirection = (1 << 9),

        /// <summary>
        /// The estimated scene main light color is included.
        /// </summary>
        [Description("MainLightColor")]
        MainLightColor = (1 << 10),

        /// <summary>
        /// The estimated scene main light intensity in lumens is included.
        /// </summary>
        [Description("MainLightIntensityLumens")]
        MainLightIntensityLumens = (1 << 11),

        /// <summary>
        /// Ambient spherical harmonics are included.
        /// </summary>
        [Description("AmbientSphericalHarmonics")]
        AmbientSphericalHarmonics = (1 << 12),
        
        /// <summary>
        /// The camera grain texture is included.
        /// </summary>
        [Description("CameraGrain")]
        CameraGrain = (1 << 13),

        /// <summary>
        /// The camera grain noise intensity is included.
        /// </summary>
        [Description("NoiseIntensity")]
        NoiseIntensity = (1 << 14),
    }

    /// <summary>
    /// Parameters of the Unity <c>Camera</c> that may be necessary/useful to the provider.
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct XRCameraFrame : IEquatable<XRCameraFrame>
    {
        /// <summary>
        /// The timestamp, in nanoseconds, associated with this frame.
        /// </summary>
        /// <value>
        /// The timestamp, in nanoseconds, associated with this frame.
        /// </value>
        public long timestampNs => m_TimestampNs;
        long m_TimestampNs;

        /// <summary>
        /// The estimated brightness of the scene.
        /// </summary>
        /// <value>
        /// The estimated brightness of the scene.
        /// </value>
        public float averageBrightness => m_AverageBrightness;
        float m_AverageBrightness;

        /// <summary>
        /// The estimated color temperature of the scene.
        /// </summary>
        /// <value>
        /// The estimated color temperature of the scene.
        /// </value>
        public float averageColorTemperature => m_AverageColorTemperature;
        float m_AverageColorTemperature;

        /// <summary>
        /// The estimated color correction value of the scene.
        /// </summary>
        /// <value>
        /// The estimated color correction value of the scene.
        /// </value>
        public Color colorCorrection => m_ColorCorrection;
        Color m_ColorCorrection;

        /// <summary>
        /// The 4x4 projection matrix for the camera frame.
        /// </summary>
        /// <value>
        /// The 4x4 projection matrix for the camera frame.
        /// </value>
        public Matrix4x4 projectionMatrix => m_ProjectionMatrix;
        Matrix4x4 m_ProjectionMatrix;

        /// <summary>
        /// The 4x4 display matrix for the camera frame.
        /// </summary>
        /// <value>
        /// The 4x4 display matrix for the camera frame.
        /// </value>
        public Matrix4x4 displayMatrix => m_DisplayMatrix;
        Matrix4x4 m_DisplayMatrix;

        /// <summary>
        /// The <see cref="TrackingState"/> associated with the camera.
        /// </summary>
        /// <value>
        /// The tracking state associated with the camera.
        /// </value>
        public TrackingState trackingState => m_TrackingState;
        TrackingState m_TrackingState;

        /// <summary>
        /// A native pointer associated with this frame. The data
        /// pointed to by this pointer is specific to provider implementation.
        /// </summary>
        /// <value>
        /// The native pointer associated with this frame.
        /// </value>
        public IntPtr nativePtr => m_NativePtr;
        IntPtr m_NativePtr;

        /// <summary>
        /// The set of all flags indicating which properties are included in the frame.
        /// </summary>
        /// <value>
        /// The set of all flags indicating which properties are included in the frame.
        /// </value>
        public XRCameraFrameProperties properties => m_Properties;
        XRCameraFrameProperties m_Properties;

        /// <summary>
        /// The estimated intensity, in lumens, of the scene.
        /// </summary>
        /// <value>
        /// The estimated intensity, in lumens, of the scene.
        /// </value>
        public float averageIntensityInLumens => m_AverageIntensityInLumens;
        float m_AverageIntensityInLumens;

        /// <summary>
        /// The camera exposure duration, in seconds with sub-millisecond precision, of the scene.
        /// </summary>
        /// <value>
        /// The camera exposure duration, in seconds with sub-millisecond precision, of the scene.
        /// </value>
        public double exposureDuration => m_ExposureDuration;
        double m_ExposureDuration;

        /// <summary>
        /// The camera exposure offset of the scene for lighting scaling
        /// </summary>
        /// <value>
        /// The camera exposure offset of the scene for lighting scaling
        /// </value>
        public float exposureOffset => m_ExposureOffset;
        float m_ExposureOffset;

        /// <summary>
        /// The estimated, intensity in lumens of the most influential, real-world light in the scene.
        /// </summary>
        /// <value>
        /// The estimated, intensity in lumens of the most influential, real-world light in the scene.
        /// </value>
        public float mainLightIntensityLumens => m_MainLightIntensityLumens;
        float m_MainLightIntensityLumens;

        /// <summary>
        /// The estimated, color of the most influential, real-world light in the scene.
        /// </summary>
        /// <value>
        /// The estimated, color of the most influential, real-world light in the scene.
        /// </value>
        public Color mainLightColor => m_MainLightColor;
        Color m_MainLightColor;

        /// <summary>
        /// The estimated direction of the most influential, real-world light in the scene.
        /// </summary>
        /// <value>
        /// The estimated direction of the most influential, real-world light in the scene.
        /// </value>
        public Vector3 mainLightDirection => m_MainLightDirection;
        Vector3 m_MainLightDirection;

        /// <summary>
        /// The ambient spherical harmonic coefficients that represent lighting in the real-world.
        /// </summary>
        /// <value>
        /// The ambient spherical harmonic coefficients that represent lighting in the real-world.
        /// </value>
        /// <remarks>
        /// See <see href="https://docs.unity3d.com/ScriptReference/Rendering.SphericalHarmonicsL2.html">here</see> for further details.
        /// </remarks>
        public SphericalHarmonicsL2 ambientSphericalHarmonics => m_AmbientSphericalHarmonics;
        SphericalHarmonicsL2 m_AmbientSphericalHarmonics;
        
        /// <summary>
        /// A texture that simulates the camera's noise.
        /// </summary>
        /// <value>
        /// A texture that simulates the camera's noise.
        /// </value>
        public XRTextureDescriptor cameraGrain => m_CameraGrain;
        XRTextureDescriptor m_CameraGrain;

        /// <summary>
        /// The level of intensity of camera grain noise in a scene.
        /// </summary>
        /// <value>
        /// The level of intensity of camera grain noise in a scene.
        /// </value>
        public float noiseIntensity => m_NoiseIntensity;
        float m_NoiseIntensity;

        /// <summary>
        /// Whether the frame has a timestamp.
        /// </summary>
        /// <value>
        /// Whether the frame has a timestamp.
        /// </value>
        public bool hasTimestamp => (m_Properties & XRCameraFrameProperties.Timestamp) != 0;

        /// <summary>
        /// Whether the frame has an average brightness.
        /// </summary>
        /// <value>
        /// Whether the frame has an average brightness.
        /// </value>
        public bool hasAverageBrightness => (m_Properties & XRCameraFrameProperties.AverageBrightness) != 0;

        /// <summary>
        /// Whether the frame has an average color temperature.
        /// </summary>
        /// <value>
        /// Whether the frame has an average color temperature.
        /// </value>
        public bool hasAverageColorTemperature => (m_Properties & XRCameraFrameProperties.AverageColorTemperature) != 0;

        /// <summary>
        /// Whether the frame has a color correction value.
        /// </summary>
        /// <value>
        /// Whether the frame has a color correction value.
        /// </value>
        public bool hasColorCorrection => (m_Properties & XRCameraFrameProperties.ColorCorrection) != 0;

        /// <summary>
        /// Whether the frame has a projection matrix.
        /// </summary>
        /// <value>
        /// Whether the frame has a projection matrix.
        /// </value>
        public bool hasProjectionMatrix => (m_Properties & XRCameraFrameProperties.ProjectionMatrix) != 0;

        /// <summary>
        /// Whether the frame has a display matrix.
        /// </summary>
        /// <value>
        /// Whether the frame has a display matrix.
        /// </value>
        public bool hasDisplayMatrix => (m_Properties & XRCameraFrameProperties.DisplayMatrix) != 0;

        /// <summary>
        /// Whether the frame has an average intensity in lumens.
        /// </summary>
        /// <value>
        /// Whether the frame has an average intensity in lumens.
        /// </value>
        public bool hasAverageIntensityInLumens => (m_Properties & XRCameraFrameProperties.AverageIntensityInLumens) != 0;

        /// <summary>
        /// Whether the frame has an exposure duration in seconds with sub-millisecond precision.
        /// </summary>
        /// <value>
        /// Whether the frame has an exposure duration in seconds with sub-millisecond precision.
        /// </value>
        public bool hasExposureDuration => (m_Properties & XRCameraFrameProperties.ExposureDuration) != 0;

        /// <summary>
        /// Whether the frame has an exposure offset for scaling lighting.
        /// </summary>
        /// <value>
        /// Whether the frame has an exposure offset for scaling lighting.
        /// </value>
        public bool hasExposureOffset => (m_Properties & XRCameraFrameProperties.ExposureOffset) != 0;

        /// <summary>
        /// Whether the frame has the estimated main light channel-wise intensity of the scene.
        /// </summary>
        /// <value>
        /// Whether the frame has the estimated main light channel-wise intensity of the scene.
        /// </value>
        public bool hasMainLightIntensityLumens => (m_Properties & XRCameraFrameProperties.MainLightIntensityLumens) != 0;

        /// <summary>
        /// Whether the frame has the estimated main light color of the scene.
        /// </summary>
        /// <value>
        /// Whether the frame has the estimated main light color of the scene.
        /// </value>
        public bool hasMainLightColor => (m_Properties & XRCameraFrameProperties.MainLightColor) != 0;

        /// <summary>
        /// Whether the frame has the estimated main light direction of the scene.
        /// </summary>
        /// <value>
        /// Whether the frame has the estimated main light direction of the scene.
        /// </value>
        public bool hasMainLightDirection => (m_Properties & XRCameraFrameProperties.MainLightDirection) != 0;

        /// <summary>
        /// Whether the frame has the ambient spherical harmonics coefficients of the scene.
        /// </summary>
        /// <value>
        /// Whether the frame has the ambient spherical harmonics coefficients of the scene.
        /// </value>
        public bool hasAmbientSphericalHarmonics => (m_Properties & XRCameraFrameProperties.AmbientSphericalHarmonics) != 0;

        /// <summary>
        /// Whether the frame has a camera grain texture.
        /// </summary>
        /// <value>
        /// Whether the frame has a camera grain texture.
        /// </value>
        public bool hasCameraGrain => (m_Properties & XRCameraFrameProperties.CameraGrain) != 0;

        /// <summary>
        /// Whether the frame has a camera grain noise.
        /// </summary>
        /// <value>
        /// Whether the frame has a camera grain noise.
        /// </value>
        public bool hasNoiseIntensity => (m_Properties & XRCameraFrameProperties.NoiseIntensity) != 0;

        /// <summary>
        /// Provides timestamp of the camera frame.
        /// </summary>
        /// <param name="timestampNs">The timestamp of the camera frame.</param>
        /// <returns>
        /// <c>true</c> if the timestamp was provided. Otherwise, <c>false</c>.
        /// </returns>
        public bool TryGetTimestamp(out long timestampNs)
        {
            timestampNs = this.timestampNs;
            return hasTimestamp;
        }

        /// <summary>
        /// Provides brightness for the whole image as an average of all pixels' brightness.
        /// </summary>
        /// <param name="averageBrightness">An estimated average brightness for the environment.</param>
        /// <returns>
        /// <c>true</c> if average brightness was provided. Otherwise, <c>false</c>.
        /// </returns>
        public bool TryGetAverageBrightness(out float averageBrightness)
        {
            averageBrightness = this.averageBrightness;
            return hasAverageBrightness;
        }

        /// <summary>
        /// Provides color temperature for the whole image as an average of all pixels' color temperature.
        /// </summary>
        /// <param name="averageColorTemperature">An estimated color temperature.</param>
        /// <returns>
        /// <c>true</c> if average color temperature was provided. Otherwise, <c>false</c>.
        /// </returns>
        public bool TryGetAverageColorTemperature(out float averageColorTemperature)
        {
            averageColorTemperature = this.averageColorTemperature;
            return hasAverageColorTemperature;
        }

        /// <summary>
        /// Provides projection matrix for the camera frame.
        /// </summary>
        /// <param name="projectionMatrix">The projection matrix used by the <c>XRCameraSubsystem</c>.</param>
        /// <returns>
        /// <c>true</c> if the projection matrix was provided. Otherwise, <c>false</c>.
        /// </returns>
        public bool TryGetProjectionMatrix(out Matrix4x4 projectionMatrix)
        {
            projectionMatrix = this.projectionMatrix;
            return this.hasProjectionMatrix;
        }

        /// <summary>
        /// Provides display matrix defining how texture is being rendered on the screen.
        /// </summary>
        /// <param name="displayMatrix">The display matrix for rendering.</param>
        /// <returns>
        /// <c>true</c> if the display matrix was provided. Otherwise, <c>false</c>.
        /// </returns>
        public bool TryGetDisplayMatrix(out Matrix4x4 displayMatrix)
        {
            displayMatrix = this.displayMatrix;
            return hasDisplayMatrix;
        }

        /// <summary>
        /// Provides intensity, in lumens, for the environment.
        /// </summary>
        /// <param name="averageIntensityInLumens">An estimated average intensity, in lumens, for the environment.</param>
        /// <returns>
        /// <c>true</c> if average intensity was provided. Otherwise, <c>false</c>.
        /// </returns>
        public bool TryGetAverageIntensityInLumens(out float averageIntensityInLumens)
        {
            averageIntensityInLumens = this.averageIntensityInLumens;
            return hasAverageIntensityInLumens;
        }

        /// <summary>
        /// Compares for equality.
        /// </summary>
        /// <param name="other">The other <see cref="XRCameraFrame"/> to compare against.</param>
        /// <returns><c>true</c> if the <see cref="XRCameraFrame"/> represents the same object.</returns>
        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_Properties == other.m_Properties));
        }

        /// <summary>
        /// Compares for equality.
        /// </summary>
        /// <param name="obj">An <c>object</c> to compare against.</param>
        /// <returns><c>true</c> if <paramref name="obj"/> is an <see cref="XRCameraFrame"/> and
        /// <see cref="Equals(XRCameraFrame)"/> is also <c>true</c>. Otherwise, <c>false</c>.</returns>
        public override bool Equals(System.Object obj)
        {
            return ((obj is XRCameraFrame) && Equals((XRCameraFrame)obj));
        }


        /// <summary>
        /// Compares <paramref name="lhs"/> and <paramref name="rhs"/> for equality using <see cref="Equals(XRCameraFrame)"/>.
        /// </summary>
        /// <param name="lhs">The left-hand-side <see cref="XRCameraFrame"/> of the comparison.</param>
        /// <param name="rhs">The right-hand-side <see cref="XRCameraFrame"/> of the comparison.</param>
        /// <returns><c>true</c> if <paramref name="lhs"/> compares equal to <paramref name="rhs"/>, <c>false</c> otherwise.</returns>
        public static bool operator ==(XRCameraFrame lhs, XRCameraFrame rhs)
        {
            return lhs.Equals(rhs);
        }

        /// <summary>
        /// Compares <paramref name="lhs"/> and <paramref name="rhs"/> for inequality using <see cref="Equals(XRCameraFrame)"/>.
        /// </summary>
        /// <param name="lhs">The left-hand-side <see cref="XRCameraFrame"/> of the comparison.</param>
        /// <param name="rhs">The right-hand-side <see cref="XRCameraFrame"/> of the comparison.</param>
        /// <returns><c>false</c> if <paramref name="lhs"/> compares equal to <paramref name="rhs"/>, <c>true</c> otherwise.</returns>
        public static bool operator !=(XRCameraFrame lhs, XRCameraFrame rhs)
        {
            return !lhs.Equals(rhs);
        }

        /// <summary>
        /// Generates a hash code suitable for use in <c>HashSet</c> and <c>Dictionary</c>.
        /// </summary>
        /// <returns>A hash of the <see cref="XRCameraFrame"/>.</returns>
        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_NativePtr.GetHashCode();
                hashCode = (hashCode * 486187739) + ((int)m_Properties).GetHashCode();
            }
            return hashCode;
        }

        /// <summary>
        /// Generates a string representation of this <see cref="XRCameraFrame"/> suitable for debugging purposes.
        /// </summary>
        /// <returns>A string representation of this <see cref="XRCameraFrame"/>.</returns>
        public override string ToString()
        {
            return $"properties:{m_Properties}\n   timestamp:{m_TimestampNs}ns\n   avgBrightness:{m_AverageBrightness.ToString("0.000")}\n"
                + $"   avgColorTemp:{m_AverageColorTemperature.ToString("0.000")}\n   colorCorrection:{m_ColorCorrection}\n"
                + $"   projection:\n{m_ProjectionMatrix.ToString("0.000")}\n   display:\n{m_DisplayMatrix.ToString("0.000")}\n"
                + $"   exposureDuration: {m_ExposureDuration.ToString("0.000")}sec\n   exposureOffset:{m_ExposureOffset}\n"
                + $"   mainLightDirection: {m_MainLightDirection.ToString("0.000")}\n   mainLightIntensityLumens: {m_MainLightIntensityLumens.ToString("0.000")}\n"
                + $"   MainLightColor: {m_MainLightColor.ToString("0.000")}\n   ambientSphericalHarmonics: \n{m_AmbientSphericalHarmonics}\n"
                + $"   nativePtr: {m_NativePtr.ToString("X16")}\n";
        }
    }
}