-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/BenoitGeslain/Visuo-haptic-…
- Loading branch information
Showing
27 changed files
with
1,470 additions
and
528 deletions.
There are no files selected for viewing
1,437 changes: 1,206 additions & 231 deletions
1,437
...lkit/Assets/Visuo-Haptic Toolkit/Sample Scenes/3DInterpolation/3DInterpolation Demo.unity
Large diffs are not rendered by default.
Oops, something went wrong.
108 changes: 0 additions & 108 deletions
108
Visuo-haptic Toolkit/Assets/Visuo-Haptic Toolkit/Sample Scenes/Gradient.mat
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
Visuo-haptic Toolkit/Assets/Visuo-Haptic Toolkit/Sample Scenes/Gradient.mat.meta
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
Visuo-haptic Toolkit/Assets/Visuo-Haptic Toolkit/Scripts/Logging/AbstractFileObserver.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
using System.IO; | ||
using UnityEngine; | ||
|
||
namespace VHToolkit.Logging { | ||
abstract class AbstractFileObserver<T> : IObserver<T> { | ||
protected readonly StreamWriter writer; | ||
private IDisposable unsubscriber; | ||
public void OnCompleted() { | ||
unsubscriber.Dispose(); | ||
writer.Dispose(); | ||
} | ||
|
||
public void Subscribe(IObservable<T> observable) => unsubscriber = observable?.Subscribe(this); | ||
|
||
public void OnError(Exception error) => Debug.LogError(error); | ||
|
||
abstract public void OnNext(T value); | ||
|
||
public AbstractFileObserver(string filename) { | ||
writer = new StreamWriter(filename, append: true); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...o-haptic Toolkit/Assets/Visuo-Haptic Toolkit/Scripts/Logging/AbstractFileObserver.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
Visuo-haptic Toolkit/Assets/Visuo-Haptic Toolkit/Scripts/Logging/Logger.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
using UnityEngine; | ||
|
||
using VHToolkit.Redirection; | ||
|
||
namespace VHToolkit.Logging { | ||
public partial class Logger<T> : MonoBehaviour, IObservable<T> { | ||
public string logDirectoryPath = "LoggedData\\"; | ||
[SerializeField] protected string optionalFilenamePrefix; | ||
protected readonly int bufferSize = 10; // number of records kept before writing to disk | ||
|
||
protected readonly Queue<T> records = new(); | ||
protected readonly HashSet<IObserver<T>> observers = new(); | ||
protected Interaction script; | ||
|
||
protected void WriteRecords(Queue<T> records) { | ||
if (records.Count > bufferSize) { | ||
foreach (var record in records) { | ||
foreach (var observer in observers) { | ||
observer.OnNext(record); | ||
} | ||
} | ||
records.Clear(); | ||
} | ||
} | ||
|
||
IDisposable IObservable<T>.Subscribe(IObserver<T> observer) { | ||
observers.Add(observer); | ||
return new HashSetUnsubscriber<T>(observers, observer); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Visuo-haptic Toolkit/Assets/Visuo-Haptic Toolkit/Scripts/Logging/Logger.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.