Skip to content

Commit ce0ece0

Browse files
committed
Refactored some private member variables to have leading underscore camelcase, for consistency.
1 parent 98ef32d commit ce0ece0

4 files changed

Lines changed: 33 additions & 33 deletions

File tree

OSVR-Unity/Assets/OSVRUnity/src/ClientKit.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class ClientKit : MonoBehaviour
2929
[Tooltip("A string uniquely identifying your application, in reverse domain-name format.")]
3030
public string AppID;
3131

32-
private OSVR.ClientKit.ClientContext contextObject;
32+
private OSVR.ClientKit.ClientContext _contextObject;
3333

3434
/// Uses the Unity "Persistent Singleton" pattern, see http://unitypatterns.com/singletons/
3535
private static ClientKit _instance;
@@ -66,21 +66,21 @@ public OSVR.ClientKit.ClientContext context
6666
get
6767
{
6868
EnsureStarted();
69-
return contextObject;
69+
return _contextObject;
7070
}
7171
}
7272

7373
private void EnsureStarted()
7474
{
75-
if (contextObject == null)
75+
if (_contextObject == null)
7676
{
7777
if (0 == AppID.Length)
7878
{
7979
Debug.LogError("OSVR ClientKit instance needs AppID set to a reverse-order DNS name! Using dummy name...");
8080
AppID = "com.osvr.osvr-unity.dummy";
8181
}
8282
Debug.Log("[OSVR] Starting with app ID: " + AppID);
83-
contextObject = new OSVR.ClientKit.ClientContext(AppID, 0);
83+
_contextObject = new OSVR.ClientKit.ClientContext(AppID, 0);
8484
}
8585
}
8686

@@ -113,24 +113,24 @@ void OnEnable()
113113
Debug.Log("[OSVR] In OnEnable()");
114114
EnsureStarted();
115115
}
116-
116+
117117
void Update()
118118
{
119119
EnsureStarted();
120-
contextObject.update();
120+
_contextObject.update();
121121
}
122122

123123
void LateUpdate()
124124
{
125-
contextObject.update();
125+
_contextObject.update();
126126
}
127127
void Stop()
128128
{
129-
if (null != contextObject)
129+
if (null != _contextObject)
130130
{
131131
Debug.Log("Shutting down OSVR.");
132-
contextObject.Dispose();
133-
contextObject = null;
132+
_contextObject.Dispose();
133+
_contextObject = null;
134134
}
135135
}
136136

OSVR-Unity/Assets/OSVRUnity/src/DisplayController.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,20 @@ public class DisplayController : MonoBehaviour
4141

4242
private ClientKit _clientKit;
4343
private OSVR.ClientKit.DisplayConfig _displayConfig;
44-
private VRViewer[] viewers;
45-
private VREye[] eyes;
44+
private VRViewer[] _viewers;
45+
private VREye[] _eyes;
4646
private uint _eyeCount;
4747
private uint _viewerCount;
48-
private bool renderedStereo = false;
49-
private bool displayConfigInitialized = false;
48+
private bool _renderedStereo = false;
49+
private bool _displayConfigInitialized = false;
5050

5151
public OSVR.ClientKit.DisplayConfig DisplayConfig
5252
{
5353
get { return _displayConfig; }
5454
set { _displayConfig = value; }
5555
}
56-
public VRViewer[] Viewers { get { return viewers; } }
57-
public VREye[] Eyes { get { return eyes; } }
56+
public VRViewer[] Viewers { get { return _viewers; } }
57+
public VREye[] Eyes { get { return _eyes; } }
5858
public uint EyeCount { get { return _eyeCount; } }
5959
public uint ViewerCount { get { return _viewerCount; } }
6060
public float nearClippingPlane = 0.01f;
@@ -96,7 +96,7 @@ void SetupDisplay()
9696
{
9797
return;
9898
}
99-
displayConfigInitialized = true;
99+
_displayConfigInitialized = true;
100100

101101
//get the number of viewers, bail if there isn't exactly one viewer for now
102102
_viewerCount = _displayConfig.GetNumViewers();
@@ -123,7 +123,7 @@ private void CreateHeadAndEyes()
123123
Debug.LogError(_viewerCount + " viewers detected. This implementation supports exactly one viewer.");
124124
return;
125125
}
126-
viewers = new VRViewer[_viewerCount];
126+
_viewers = new VRViewer[_viewerCount];
127127
for (uint viewerIndex = 0; viewerIndex < _viewerCount; viewerIndex++)
128128
{
129129
//create a VRViewer
@@ -140,20 +140,20 @@ private void CreateHeadAndEyes()
140140
}
141141
vrViewer.transform.parent = this.transform; //child of DisplayController
142142
vrViewer.transform.localPosition = Vector3.zero;
143-
viewers[viewerIndex] = vrViewerComponent;
143+
_viewers[viewerIndex] = vrViewerComponent;
144144

145145
//create Viewer's VREyes
146146
_eyeCount = (uint)_displayConfig.GetNumEyesForViewer(viewerIndex); //get the number of eyes
147-
eyes = new VREye[_eyeCount];
147+
_eyes = new VREye[_eyeCount];
148148
for (uint eyeIndex = 0; eyeIndex < _eyeCount; eyeIndex++)
149149
{
150150
GameObject eyeGameObject = new GameObject("Eye" + eyeIndex); //add an eye gameobject to the scene
151151
VREye eye = eyeGameObject.AddComponent<VREye>(); //add the VReye component
152-
eye.Viewer = viewers[viewerIndex]; //ASSUME THERE IS ONLY ONE VIEWER
152+
eye.Viewer = _viewers[viewerIndex]; //ASSUME THERE IS ONLY ONE VIEWER
153153
eye.EyeIndex = eyeIndex; //set the eye's index
154154
eyeGameObject.transform.parent = this.transform; //child of DisplayController
155155
eyeGameObject.transform.localPosition = Vector3.zero;
156-
eyes[eyeIndex] = eye;
156+
_eyes[eyeIndex] = eye;
157157
CreateEyeSurface(eyeIndex);
158158
SetDistortion(eyeIndex);
159159
}
@@ -177,9 +177,9 @@ private void CreateEyeSurface(uint eyeIndex)
177177
surface.Camera.nearClipPlane = nearClippingPlane;
178178
surface.Camera.farClipPlane = farClippingPlane;
179179
surface.Camera.enabled = false;
180-
surfaceGameObject.transform.parent = eyes[eyeIndex].transform; //surface is child of Eye
180+
surfaceGameObject.transform.parent = _eyes[eyeIndex].transform; //surface is child of Eye
181181
surfaceGameObject.transform.localPosition = Vector3.zero;
182-
eyes[eyeIndex].Surface = surface;
182+
_eyes[eyeIndex].Surface = surface;
183183
}
184184

185185
//determines if distortion will be used, and what type of distortion will be used
@@ -207,7 +207,7 @@ private void SetDistortion(uint eyeIndex)
207207
//set distortion parameters for K1 Radial Distortion method
208208
private void SetK1RadialDistortion(uint eyeIndex, float k1Red, float k1Green, float k1Blue, Vector2 center)
209209
{
210-
VREye eye = eyes[eyeIndex];
210+
VREye eye = _eyes[eyeIndex];
211211
// disable distortion if there is no distortion for this HMD
212212
if (k1Red == 0 && k1Green == 0 && k1Blue == 0)
213213
{
@@ -231,7 +231,7 @@ private void SetK1RadialDistortion(uint eyeIndex, float k1Red, float k1Green, fl
231231

232232
void Update()
233233
{
234-
if(!displayConfigInitialized)
234+
if(!_displayConfigInitialized)
235235
{
236236
SetupDisplay();
237237
}

OSVR-Unity/Assets/OSVRUnity/src/VREye.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class VREye : MonoBehaviour
3434
{
3535
#region Private Variables
3636
private VRSurface _surface; //the surface associated with this eye
37-
private VRViewer viewer; //the viewer associated with this eye
37+
private VRViewer _viewer; //the viewer associated with this eye
3838
private uint _eyeIndex;
3939

4040
#endregion
@@ -51,8 +51,8 @@ public VRSurface Surface
5151
}
5252
public VRViewer Viewer
5353
{
54-
get { return viewer; }
55-
set { viewer = value; }
54+
get { return _viewer; }
55+
set { _viewer = value; }
5656
}
5757
[HideInInspector]
5858
public Transform cachedTransform;

OSVR-Unity/Assets/OSVRUnity/src/VRViewer.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public Camera Camera
5353
#region Private Variables
5454
private DisplayController _displayController;
5555
private Camera _camera;
56-
private bool disabledCamera = true;
56+
private bool _disabledCamera = true;
5757
#endregion
5858

5959
void Awake()
@@ -126,18 +126,18 @@ void OnPreCull()
126126
}
127127

128128
// Remember to reenable.
129-
disabledCamera = true;
129+
_disabledCamera = true;
130130
}
131131

132132
IEnumerator EndOfFrame()
133133
{
134134
while (true)
135135
{
136136
//if we disabled the dummy camera, enable it here
137-
if (disabledCamera)
137+
if (_disabledCamera)
138138
{
139139
Camera.enabled = true;
140-
disabledCamera = false;
140+
_disabledCamera = false;
141141
}
142142
yield return new WaitForEndOfFrame();
143143
}

0 commit comments

Comments
 (0)