上一篇文章中介绍了SvrManager中的单例类以及表示SDK运行状态的枚举类型,本文将继续介绍SvrManager中的代码结构。
SvrManager中定义一个类SvrSettings,SvrSettings的代码如下:
[Serializable]
public class SvrSettings
{
public enum eAntiAliasing
{
k1 = 1,
k2 = 2,
k4 = 4,
};
public enum eDepth
{
k16 = 16,
k24 = 24
};
public enum eChromaticAberrationCorrection
{
kDisable = 0,
kEnable = 1
};
public enum eVSyncCount
{
k1 = 1,
k2 = 2,
};
public enum eMasterTextureLimit
{
k0 = 0, // full size
k1 = 1, // half size
k2 = 2, // quarter size
k3 = 3, // ...
k4 = 4 // ...
};
public enum ePerfLevel
{
Minimum = 1,
Medium = 2,
Maximum = 3
};
public enum eFrustumType
{
Camera = 0,
Device = 1,
}
public enum eEyeBufferType
{
//Mono = 0,
StereoSeperate = 1,
//StereoSingle = 2,
//Array = 3,
}
[Tooltip("If head tracking lost, fade the display")]
public bool poseStatusFade = true;
[Tooltip("Use position tracking (if available)")]
public bool trackPosition = false;
[Tooltip("Track position conversion from meters")]
public float trackPositionScale = 1;
[Tooltip("Height of the eyes from base of head")]
public float headHeight = 0.0750f;
[Tooltip("Depth of the eyes from center of head")]
public float headDepth = 0.0805f;
[Tooltip("Distance between the eyes")]
public float interPupilDistance = 0.064f;
[Tooltip("Distance of line-of-sight convergence (0 disabled)")]
public float stereoConvergence = 0;
[Tooltip("Pitch angle to the horizon in degrees")]
public float horizonElevation = 0;
[Tooltip("Eye field of view render target reprojection margin (% of fov) [0..]")]
public float eyeFovMargin = 0.0f;
[Tooltip("Eye render target scale factor")]
public float eyeResolutionScaleFactor = 1.0f;
[Tooltip("Eye render target depth buffer")]
public eDepth eyeDepth = eDepth.k24;
[Tooltip("Eye render target MSAA value")]
public eAntiAliasing eyeAntiAliasing = eAntiAliasing.k2;
[Tooltip("Overlay render target scale factor")]
public float overlayResolutionScaleFactor = 1.0f;
[Tooltip("Overlay render target depth buffer")]
public eDepth overlayDepth = eDepth.k16;
[Tooltip("Overlay render target MSAA value")]
public eAntiAliasing overlayAntiAliasing = eAntiAliasing.k1;
[Tooltip("Limit refresh rate")]
public eVSyncCount vSyncCount = eVSyncCount.k1;
[Tooltip("Chromatic Aberration Correction")]
public eChromaticAberrationCorrection chromaticAberationCorrection = eChromaticAberrationCorrection.kEnable;
[Tooltip("QualitySettings TextureQuality FullRes, HalfRes, etc.")]
public eMasterTextureLimit masterTextureLimit = eMasterTextureLimit.k0;
[Tooltip("CPU performance level")]
public ePerfLevel cpuPerfLevel = ePerfLevel.Medium;
[Tooltip("GPU performance level")]
public ePerfLevel gpuPerfLevel = ePerfLevel.Medium;
[Tooltip("Foveated render gain [1..], 0/feature disabled")]
public Vector2 foveationGain = new Vector2(0.0f, 0.0f);
[Tooltip("Foveated render hires area [0..]")]
public float foveationArea = 0.0f;
[Tooltip("Use perspective of unity camera or device frustum data")]
public eFrustumType frustumType = eFrustumType.Camera;
[Tooltip("Display buffer type (default stereo seperate)")]
public eEyeBufferType displayType = eEyeBufferType.StereoSeperate;
}SvrSettings类的前面添加了[Serializable]标签,该标签表示可以在unity界面的Inspector窗口中直接设置类的公有属性,如下图:
对于开发者来说 SvrSettings可以在Inspector面板中设置也可以通过调用SvrManager.Instance.settings在代码中动态设置settings的属性。具体属性的作用我们将会在下一个章节中介绍。
|