Tilt Five™ Unity API  1.4.1
GlassesSettings.cs
Go to the documentation of this file.
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  */
16 using System.Collections;
17 using System.Collections.Generic;
18 using UnityEngine;
19 
20 namespace TiltFive
21 {
26  [System.Serializable]
28  {
29  #region Constants
30 
34  internal const uint MAX_SUPPORTED_GLASSES_COUNT = 4; // TODO: Expand this to 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  public const float DEFAULT_IPD_UGBD = 0.059f;
44 
45  // Enforce a near clip plane that keeps objects from getting too close to the user's head.
46  // TODO: Determine the threshold for discomfort (plus a small amount of margin) via usability testing.
47  public const float MIN_NEAR_CLIP_DISTANCE_IN_METERS = 0.1f;
48 
49  public static readonly string DEFAULT_FRIENDLY_NAME = "Tilt Five Glasses";
50 
51  #endregion
52 
53 
54 #if UNITY_EDITOR
58  public bool tiltFiveXR = true;
59 
60  public bool copyPlayerOneCameraTemplate = true;
61  public bool copyPlayerOneObjectTemplate = true;
62 #if UNITY_2019_1_OR_NEWER && INPUTSYSTEM_AVAILABLE
63  public bool copyPlayerOnePlayerTemplate = true;
64 #endif
65  public bool copyCloneCameraTemplateChildren = true;
66  public bool copyPlayerOneCullingMask = true;
67  public bool copyPlayerOneFOVToggle = true;
68  public bool copyPlayerOneFOV = true;
69  public bool copyPlayerOneNearClipPlane = true;
70  public bool copyPlayerOneFarClipPlane = true;
71 #endif
75  [System.Obsolete("headPoseCamera is deprecated, and its functionality has been split between " +
76  "GlassesSettings.cameraTemplate (for instantiating eye cameras) " +
77  "and SpectatorSettings.spectatorCamera (for the onscreen preview).")]
78  public Camera headPoseCamera;
79 
80  // TODO: make this the default name and get rid of headPoseCamera when we update API in
81  // 2.0.0. We want to hold off until then because changing this will clear every scene's
82  // TiltFiveManager reference to the preview/headpose camera, requiring a manual fix of the
83  // broken reference in every scene.
88  public Camera cameraTemplate {
89  #pragma warning disable 618 // this is for compatibility; disable obsolete warning
90  get { return headPoseCamera; }
91  set { headPoseCamera = value; }
92  #pragma warning restore 618
93  }
94 
98  public GameObject objectTemplate;
99 
100 #if UNITY_2019_1_OR_NEWER && INPUTSYSTEM_AVAILABLE
106  public GameObject playerTemplate;
107 #endif
108 
113  public bool cloneCameraTemplateChildren = false;
114 
118  public LayerMask cullingMask = ~0;
119 
124 
128  public float farClipPlane = 100f;
129 
130  public bool overrideFOV = false;
131  public float customFOV = DEFAULT_FOV;
132  public float fieldOfView => overrideFOV
133  ? Mathf.Clamp(customFOV, MIN_FOV, MAX_FOV)
134  : DEFAULT_FOV;
135 
137 
138  public bool usePreviewPose = true;
139  public Transform previewPose;
140 
142 
143  internal GlassesSettings Copy()
144  {
145  return (GlassesSettings)MemberwiseClone();
146  }
147  }
148 }
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.
GlassesMirrorMode glassesMirrorMode
static readonly string DEFAULT_FRIENDLY_NAME
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
const float MIN_NEAR_CLIP_DISTANCE_IN_METERS
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...
Definition: Log.cs:21