Unity SDK Docs 1.5.0-beta.6
Loading...
Searching...
No Matches
GlassesSettings.cs
1/*
2 * Copyright (C) 2020-2023 Tilt Five, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16using UnityEngine;
17
18using Obsolete = System.ObsoleteAttribute;
19
20namespace TiltFive
21{
26 [System.Serializable]
28 {
29 #region Constants
30
34 internal const uint MAX_SUPPORTED_GLASSES_COUNT = 4;
35
36 public const float MIN_FOV = 35f;
37 public const float MAX_FOV = 64f;
38 public const float DEFAULT_FOV = 48f;
39
40 // A default value will be returned by the client API if a custom IPD hasn't been set for
41 // the glasses starting in version 1.1.0+, which means this constant won't be needed. It
42 // is kept for compatibility with older releases.
43 [Obsolete("GlassesSettings.DEFAULT_IPD_UGBD is deprecated.")]
44 public const float DEFAULT_IPD_UGBD = 0.059f;
45 internal const float DEFAULT_IPD_STAGE = 0.059f;
46
47 // Enforce a near clip plane that keeps objects from getting too close to the user's head.
48 // TODO: Determine the threshold for discomfort (plus a small amount of margin) via usability testing.
49 public const float MIN_NEAR_CLIP_DISTANCE_IN_METERS = 0.1f;
50
51 public static readonly string DEFAULT_FRIENDLY_NAME = "Tilt Five Glasses";
52
53 #endregion
54
55
56#if UNITY_EDITOR
60 public bool tiltFiveXR = true;
61
62 public bool copyPlayerOneCameraTemplate = true;
63 public bool copyPlayerOneObjectTemplate = true;
64#if UNITY_2019_1_OR_NEWER && INPUTSYSTEM_AVAILABLE
65 public bool copyPlayerOnePlayerTemplate = true;
66#endif
67 public bool copyCloneCameraTemplateChildren = true;
68 public bool copyPlayerOneCullingMask = true;
69 public bool copyPlayerOneFOVToggle = true;
70 public bool copyPlayerOneFOV = true;
71 public bool copyPlayerOneNearClipPlane = true;
72 public bool copyPlayerOneFarClipPlane = true;
73#endif
77 [System.Obsolete("headPoseCamera is deprecated, and its functionality has been split between " +
78 "GlassesSettings.cameraTemplate (for instantiating eye cameras) " +
79 "and SpectatorSettings.spectatorCamera (for the onscreen preview).")]
80 public Camera headPoseCamera;
81
82 // TODO: make this the default name and get rid of headPoseCamera when we update API in
83 // 2.0.0. We want to hold off until then because changing this will clear every scene's
84 // TiltFiveManager reference to the preview/headpose camera, requiring a manual fix of the
85 // broken reference in every scene.
90 public Camera cameraTemplate {
91 #pragma warning disable 618 // this is for compatibility; disable obsolete warning
92 get { return headPoseCamera; }
93 set { headPoseCamera = value; }
94 #pragma warning restore 618
95 }
96
100 public GameObject objectTemplate;
101
102#if UNITY_2019_1_OR_NEWER && INPUTSYSTEM_AVAILABLE
108 public GameObject playerTemplate;
109#endif
110
115 public bool cloneCameraTemplateChildren = false;
116
120 public LayerMask cullingMask = ~0;
121
125 public float nearClipPlane = MIN_NEAR_CLIP_DISTANCE_IN_METERS;
126
130 public float farClipPlane = 100f;
131
132 public bool overrideFOV = false;
133 public float customFOV = DEFAULT_FOV;
134 public float fieldOfView => overrideFOV
135 ? Mathf.Clamp(customFOV, MIN_FOV, MAX_FOV)
136 : DEFAULT_FOV;
137
138 public GlassesMirrorMode glassesMirrorMode = GlassesMirrorMode.LeftEye;
139
140 public bool usePreviewPose = true;
141 public Transform previewPose;
142
143 public string friendlyName = DEFAULT_FRIENDLY_NAME;
144
145 internal GlassesSettings Copy()
146 {
147 return (GlassesSettings)MemberwiseClone();
148 }
149 }
150}
GlassesSettings encapsulates all configuration data used by the Glasses' tracking runtime to compute ...
Camera cameraTemplate
The camera used as a template for creating the eye cameras at runtime.
float farClipPlane
The far clip plane in physical space (meters), to adjust for content scale and gameboard size.
LayerMask cullingMask
The culling mask to be used by the eye cameras for this pair of glasses.
GameObject objectTemplate
The object used as a template for creating the base Game Object when a specific playerIndex connects.
float nearClipPlane
The near clip plane in physical space (meters), to adjust for content scale and gameboard size.
Camera headPoseCamera
The main camera used for rendering the Scene when the glasses are unavailable, and the gameobject use...
bool cloneCameraTemplateChildren
Whether or not the camera template's child gameobjects should be cloned during eye camera instantiati...