Skip to content

Commit a770110

Browse files
committed
Clean up a bunch of commented out code, removed some stale TODOs.
A bunch of other work is tracked in: #3767
1 parent 02efc3c commit a770110

File tree

12 files changed

+41
-209
lines changed

12 files changed

+41
-209
lines changed

Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/Demo_Visualizer/Scripts/DrawOnTexture.cs

Lines changed: 3 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Microsoft.MixedReality.Toolkit.Examples.Demos.EyeTracking
88
{
99
public class DrawOnTexture : MonoBehaviour
1010
{
11-
public Texture2D HeatmapLookUpTable; //TODO: Replace with gradient?
11+
public Texture2D HeatmapLookUpTable;
1212

1313
[SerializeField]
1414
private float drawBrushSize = 2000.0f; // aka spread
@@ -64,9 +64,6 @@ private void DrawAt(Vector2 posUV, Color col)
6464

6565
private void DrawAt2(Vector2 posUV, int maxRadius, float intensity)
6666
{
67-
//TODO:
68-
// * intensity: More efficient data type? should only be between 0 and 1
69-
//
7067
if (MyDrawTexture != null)
7168
{
7269
// Reset on first draw
@@ -87,27 +84,6 @@ private void DrawAt2(Vector2 posUV, int maxRadius, float intensity)
8784

8885
// Determine appropriate radius based on viewing duration: The longer looking in a small region the larger the radius
8986
float dist = maxRadius;
90-
//float dist = Vector2.Distance(center, prevPos);
91-
92-
//if (dist > 10)
93-
//{
94-
// set back to min radius
95-
// dynamicRadius = minRadius;
96-
//}
97-
//else if (dist > 1)
98-
//{
99-
// dynamicRadius = Mathf.Clamp(dynamicRadius + stepSizeRadius / dist, minRadius, maxRadius);
100-
//}
101-
//else
102-
//{
103-
// dynamicRadius = Mathf.Clamp(dynamicRadius + stepSizeRadius, minRadius, maxRadius);
104-
//}
105-
106-
//Debug.Log("dist new vs old: "+ dist + " -- radius = "+ dynamicRadius);
107-
108-
//prevPos = center; //TODO: Should time out after a while;
109-
110-
11187
for (int ix = -(int)(dynamicRadius / 2); ix < dynamicRadius / 2; ix++)
11288
{
11389
for (int iy = -(int)(dynamicRadius / 2); iy < dynamicRadius / 2; iy++)
@@ -125,9 +101,6 @@ private void DrawAt2(Vector2 posUV, int maxRadius, float intensity)
125101
float B = 4f;
126102
float localNormalizedInterest = Mathf.Clamp(1 / (1 + Mathf.Pow(Mathf.Epsilon, -(B * normalizedDist))), 0, 1);
127103

128-
//float quadIncreasePower = 4;
129-
//normValX = (float)Mathf.Pow(normValX, quadIncreasePower);
130-
131104
Color baseColor = MyDrawTexture.GetPixel((int)tx, (int)ty);
132105
float delta = intensity * (1 - Mathf.Abs(localNormalizedInterest));
133106

@@ -146,7 +119,6 @@ private void DrawAt2(Vector2 posUV, int maxRadius, float intensity)
146119
MyDrawTexture.SetPixel((int)(tx), (int)(ty), col);
147120

148121
Color baseColor2 = MyDrawTexture.GetPixel((int)tx, (int)ty);
149-
// Debug.LogFormat(">> adjustedAlphaX = {0}; baseColor2.a = {1}", adjustedAlphaX, baseColor2.a);
150122
}
151123
}
152124
}
@@ -157,9 +129,6 @@ private void DrawAt2(Vector2 posUV, int maxRadius, float intensity)
157129

158130
private IEnumerator DrawAt(Vector2 posUV)
159131
{
160-
//TODO:
161-
// * intensity: More efficient data type? should only be between 0 and 1
162-
//
163132
if (MyDrawTexture != null)
164133
{
165134
// Reset on first draw
@@ -175,11 +144,7 @@ private IEnumerator DrawAt(Vector2 posUV)
175144
neverDrawnOn = false;
176145
}
177146

178-
// Determine appropriate radius based on viewing duration: The longer looking in a small region the larger the radius
179-
//TODO: Implement...
180-
181147
// Assign colors
182-
//TODO: Could be parallelized
183148
yield return null;
184149

185150
StartCoroutine(ComputeHeatmapAt(posUV, true, true));
@@ -246,12 +211,9 @@ private bool ComputeHeatmapColorAt(Vector2 currPnt, Vector2 origPivot, out Color
246211
float amplitude = drawIntensity;
247212
float distCenterToCurrPnt = Vector2.Distance(origPivot, currPnt) / spread;
248213

249-
//float scaledInterest = Mathf.Clamp(1 - (distCenterToCurrPnt / spread), 0, 1) * amplitude;
250-
//float scaledInterest = (1 - (Vector2.Distance(origPivot, currPnt) / spread)) * amplitude;
251-
252-
float B = 2f;// 1 / spread;//2f;
214+
float B = 2f;
253215
float scaledInterest = 1 / (1 + Mathf.Pow(Mathf.Epsilon, -(B * distCenterToCurrPnt)));
254-
float delta = scaledInterest / amplitude ; // Mathf.Abs(localNormalizedInterest);//(1 - Mathf.Abs(localNormalizedInterest));
216+
float delta = scaledInterest / amplitude ;
255217
if (delta < minThreshDeltaHeatMap)
256218
return false;
257219

@@ -297,7 +259,6 @@ private Texture2D MyDrawTexture
297259
}
298260

299261
Material[] mats = MyRenderer.sharedMaterials;
300-
//Debug.Log("mats.length = " + mats.Length);
301262

302263
Material[] mats2 = new Material[mats.Length + 1];
303264
for (int i = 0; i < mats.Length; i++)

Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/Demo_Visualizer/Scripts/InputPointerVisualizer.cs

Lines changed: 1 addition & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,6 @@ namespace Microsoft.MixedReality.Toolkit.Examples.Demos.EyeTracking.Logging
99
/// <summary>
1010
/// This visualizer can be used to represent pointer input data, e.g., from a handheld controller,
1111
/// from hand, head or eye tracking. In general, it assumes a pointing origin and direction,
12-
///
13-
/// ------------
14-
/// *** TODO ***
15-
/// ------------
16-
/// - Load log files
17-
/// - Replace GameObjects with particle systems for higher perf on HoloLens
18-
/// - Question: How to visualize data from multiple ppl? Color lookup table? Limit number of scanpaths visible at a time?
19-
/// - Question: How can users load files from HoloLens? Built-in file explore? Load by session?
20-
/// - Allow for tweaking parameters while viewing the scene, such as "transparency" etc.
21-
/// ------------
2212
/// </summary>
2313
public class InputPointerVisualizer : MonoBehaviour
2414
{
@@ -34,7 +24,6 @@ public enum VisModes
3424

3525
private bool show_Origins = false;
3626
private bool show_Destinations = false;
37-
//private bool show_LinkO2O = false; // Origin to origin
3827
private bool show_LinkD2D = false; // Destination to destination
3928
private bool show_LinkO2D = false; // Origin to destination
4029

@@ -67,7 +56,6 @@ public enum VisModes
6756
[Tooltip("Distance to default to in case of no hit target.")]
6857
public float cursorDist = 2f;
6958

70-
//TODO: Check if the following variables are still required?
7159
public float distThresh = 20.5f;
7260
public float nhist = 20; // Sample-based. Better to make it time-based.
7361
public float saccadeThresh = 20;
@@ -117,7 +105,7 @@ private void InitPointClouds(ref ParticleHeatmap pointCloud, ParticleHeatmap tem
117105
{
118106
// Initialize particle system to represent loaded point cloud data
119107
Debug.Log(">>InitPointClouds 02");
120-
pointCloud = templateParticleSystem; // Instantiate(templateParticleSystem, new Vector3(0, 0, 0), Quaternion.identity) as ParticleDecalPool;
108+
pointCloud = templateParticleSystem;
121109

122110
}
123111
else
@@ -284,7 +272,6 @@ public void UpdateDataVis(Ray cursorRay)
284272
UpdateVis_PointCloud(ref samples_Origins, currentItemIndex, cursorRay.origin, show_Origins);
285273

286274
// Vector destination / hit pos
287-
288275
Vector3? v = PerformHitTest(cursorRay);
289276

290277
if ((!v.HasValue) && (!onlyShowForHitTargets))
@@ -308,25 +295,6 @@ public void UpdateDataVis(Ray cursorRay)
308295
}
309296

310297
lastDestination = v.Value;
311-
312-
// Connecting lines between...
313-
// ... Vector origins
314-
//if (samples_LinkOrigToOrig != null)
315-
//{
316-
// UpdateConnectorLines(ref samples_LinkOrigToOrig, currentItemIndex,
317-
// samples_Origins[GetPrevLineIndex(currentItemIndex, samples_LinkOrigToOrig.Length)].transform.position,
318-
// samples_Origins[currentItemIndex].transform.position, show_LinkO2O);
319-
//}
320-
321-
// ... Vector destinations
322-
//if (samples_LinkDestToDest != null)
323-
//{
324-
// UpdateConnectorLines(ref samples_LinkDestToDest, currentItemIndex,
325-
// samples_Destinations[GetPrevLineIndex(currentItemIndex, samples_LinkDestToDest.Length)].transform.position,
326-
// samples_Destinations[currentItemIndex].transform.position, show_LinkD2D);
327-
//}
328-
329-
// ... origin to destination
330298
if ((samples_Destinations != null) && (samples_LinkOrigToDest != null))
331299
{
332300
Vector3? pos1 = cursorRay.origin;
@@ -375,48 +343,8 @@ void Update()
375343
}
376344
}
377345

378-
//public float TotalDistance()
379-
//{
380-
// float distance = 0;
381-
// List<float> distances = new List<float>();
382-
// int count = 1;
383-
// for (int i = 1; i <= nhist; i++)
384-
// {
385-
// int i2 = currentItemIndex - i;
386-
// if (i2 < 0)
387-
// i2 = samples_Destinations.Length + i2;
388-
389-
// float d = Vector3.Distance(samples_Destinations[i2].transform.position, samples_Destinations[currentItemIndex].transform.position); //samples[i+1].transform.position
390-
391-
// if (d > saccadeThresh)
392-
// break;
393-
394-
// distances.Add(d);
395-
// distance += d;
396-
// count++;
397-
// }
398-
399-
400-
// // Median distance
401-
// // distances.Sort();
402-
// // distance = distances[distances.Count / 2];
403-
404-
// // Average distance
405-
// if (count > minNrOfSamples)
406-
// distance /= count;
407-
// else
408-
// distance = float.MaxValue;
409-
410-
// return distance;
411-
//}
412-
413346
public bool IsDwelling()
414347
{
415-
//if (TotalDistance() < distThresh)
416-
//{
417-
// return true;
418-
//}
419-
420348
return false;
421349
}
422350

Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/Demo_Visualizer/Scripts/LogStructure_EyeGaze.cs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,13 @@ public override string[] GetHeaderColumns()
2121
"SessionType",
2222
// Timestamp
2323
"dt in ms",
24-
//-------------------------------
2524
// Cam / Head tracking
2625
"HeadOrigin.x",
2726
"HeadOrigin.y",
2827
"HeadOrigin.z",
2928
"HeadDir.x",
3029
"HeadDir.y",
3130
"HeadDir.z",
32-
// Raw eye gaze tracking
33-
//"RawEyeOrigin.x",
34-
//"RawEyeOrigin.y",
35-
//"RawEyeOrigin.z",
36-
//"RawEyeDir.x",
37-
//"RawEyeDir.y",
38-
//"RawEyeDir.z",
3931
// Smoothed eye gaze tracking
4032
"EyeOrigin.x",
4133
"EyeOrigin.y",
@@ -60,11 +52,7 @@ public override object[] GetData(string inputType, string inputStatus, EyeTracki
6052

6153

6254
object[] data = new object[]
63-
{
64-
// UserId // WILL BE AUTOMATICALLY ASSIGNED
65-
// SessionType // WILL BE AUTOMATICALLY ASSIGNED
66-
// Timestamp // WILL BE AUTOMATICALLY ASSIGNED
67-
55+
{
6856
//-------------------------------
6957
// Cam / Head tracking
7058
CameraCache.Main.transform.position.x,
@@ -74,9 +62,6 @@ public override object[] GetData(string inputType, string inputStatus, EyeTracki
7462
0,
7563
0,
7664

77-
// Raw eye gaze tracking
78-
// TODO
79-
8065
// Smoothed eye gaze signal
8166
EyeTrackingProvider.IsEyeGazeValid ? EyeTrackingProvider.GazeOrigin.x : 0,
8267
EyeTrackingProvider.IsEyeGazeValid ? EyeTrackingProvider.GazeOrigin.y : 0,

Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/Demo_Visualizer/Scripts/ParticleHeatmap.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,6 @@ public void SetParticle(Vector3 pos)
4545
newParticle.position = pos;
4646
newParticle.radiusInMeter = Random.Range(minParticleSize, maxParticleSize);
4747

48-
//Vector3 particleRotationEuler = Quaternion.LookRotation(CameraCache.Main.transform.position - pos).eulerAngles;
49-
//particleRotationEuler.z = Random.Range(0, 360);
50-
//particleData[particleDecalDataIndex].rotation = particleRotationEuler;
51-
//particleData[particleDecalDataIndex].color = Color.red; // colorGradient.Evaluate(0f);
52-
//newParticle.color = colorGradient.Evaluate(Random.Range(0f, 1f));
53-
//newParticle.color = colorGradient.Evaluate(DetermineNormalizedIntensity(newParticle.position, newParticle.radiusInMeter)); // colorGradient.Evaluate(Random.Range(0f, 1f));
54-
5548
if (particleDecalDataIndex >= particleData.Count)
5649
{
5750
particleData.Add(newParticle);
@@ -62,8 +55,6 @@ public void SetParticle(Vector3 pos)
6255
}
6356

6457
particleDecalDataIndex++;
65-
66-
//UpdateColorForAllParticles();
6758
}
6859

6960
public Vector3? GetPositionOfParticle(int index)
@@ -116,7 +107,6 @@ public void DisplayParticles()
116107
particleArray[i].position = particleData[i].position;
117108
particleArray[i].startColor = particleData[i].color;
118109
particleArray[i].startSize = particleData[i].radiusInMeter;
119-
//particleArray[i].rotation3D = particleData[i].rotation;
120110
}
121111

122112
particleSys.SetParticles(particleArray, particleArray.Length);

Assets/MixedRealityToolkit.Examples/Demos/EyeTracking/Demo_Visualizer/Scripts/UserInput_Playback.cs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class UserInput_Playback : MonoBehaviour
2424
public InputPointerVisualizer _HeadGazeVisualizer;
2525

2626
[SerializeField]
27-
private DrawOnTexture[] heatmapRefs = null; //TODO: How to have one heatmap handler?
27+
private DrawOnTexture[] heatmapRefs = null;
2828

2929
private StreamReader streamReader;
3030
private List<string> loggedLines;
@@ -129,7 +129,6 @@ public void LoadNewFile(string filename)
129129
// Read and display lines from the file until the end of the file is reached.
130130
while ((line = sr.ReadLine()) != null)
131131
{
132-
//TODO trigger events?
133132
loggedLines.Add(line);
134133
}
135134
txt_LoadingUpdate.text = "Finished loading log file. Lines: " + loggedLines.Count;
@@ -270,21 +269,17 @@ private void ShowAllAndFreeze(InputPointerVisualizer visualizer, InputSourceType
270269
{
271270
visualizer.gameObject.SetActive(true);
272271

273-
//if (!DataIsLoaded)
274-
// Let's make sure we load the latest
275272
#if UNITY_EDITOR
276273
Load();
277274
#else
278-
txt_LoadingUpdate.text = "[Load.2] " + FileName;
279-
bool result = AsyncHelpers.RunSync<bool>(() => UWP_Load());
280-
txt_LoadingUpdate.text = "[Load.2] Done. ";
281-
275+
txt_LoadingUpdate.text = "[Load.2] " + FileName;
276+
bool result = AsyncHelpers.RunSync<bool>(() => UWP_Load());
277+
txt_LoadingUpdate.text = "[Load.2] Done. ";
282278
#endif
283279
txt_LoadingUpdate.text = "Loading done. Visualize data...";
284280

285281
// Let's unpause the visualizer to make updates
286282
visualizer.UnpauseApp();
287-
288283

289284
// Let's make sure that the visualizer will show all data at once
290285
visualizer.AmountOfSamples = loggedLines.Count;
@@ -324,11 +319,6 @@ private void ShowHeatmap()
324319

325320
private void LoadingStatus_Hide()
326321
{
327-
//if (txt_LoadingUpdate != null)
328-
//{
329-
// if (txt_LoadingUpdate.gameObject.activeSelf)
330-
// txt_LoadingUpdate.gameObject.SetActive(false);
331-
//}
332322
}
333323

334324
private void LoadingStatus_Show()
@@ -459,7 +449,6 @@ private void UpdateEyeGazeSignal(string[] split, InputPointerVisualizer vizz)
459449

460450
private void UpdateHeadGazeSignal(string[] split, InputPointerVisualizer vizz)
461451
{
462-
//ToDo
463452
}
464453

465454
private void UpdateTargetingSignal(string ox, string oy, string oz, string dirx, string diry, string dirz, Ray cursorRay, InputPointerVisualizer vizz)
@@ -511,7 +500,6 @@ private void PlayNext()
511500

512501
// Let's unpause the visualizer to make updates
513502
// Show only a certain amount of data at once
514-
//TODO: instead of amount, distinguish by time window
515503
if (_EyeGazeVisualizer != null)
516504
{
517505
_EyeGazeVisualizer.UnpauseApp();

0 commit comments

Comments
 (0)