Skip to content

Commit f8ef9bb

Browse files
Bugfixes
1 parent 1615699 commit f8ef9bb

File tree

91 files changed

+86
-13821
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+86
-13821
lines changed

Backend/BackendShaderHandler.cs

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public void OnRenderImage(RenderTexture source, RenderTexture destination)
113113

114114
RenderTexture.ReleaseTemporary(processedTexture);
115115

116-
if (vm.CheckForUpdate() || (framesToWait != frameDelay )) {
116+
if (vm.CheckForUpdate() || (framesToWait != frameDelay ) || (vm.calculateAxonMap && axonMap.axonSegmentContributions == null)) {
117117
UpdateAfterFrames(); // Insures the loading screen is loaded before doing calculations
118118
return; }
119119

@@ -124,8 +124,6 @@ public void OnRenderImage(RenderTexture source, RenderTexture destination)
124124
RasterizeElectrodes();
125125

126126
GetGazeScreenPos();
127-
128-
BlurImage(false);
129127

130128
RunPreprocessing();
131129

@@ -137,7 +135,7 @@ public void OnRenderImage(RenderTexture source, RenderTexture destination)
137135

138136
RunTemporal();
139137

140-
BlurImage(true);
138+
BlurImage();
141139

142140
ElectrodeDebug();
143141
Graphics.Blit(processedTexture, destination);
@@ -446,18 +444,18 @@ private void GazeLock() {
446444
/// <summary>
447445
/// If blurFinalImage is true, apply blurShader twice to processedTexture
448446
/// </summary>
449-
private void BlurImage(bool final) {
450-
if((final && vm.blurFinalImage) || (!final && vm.preprocessingBlur){
451-
vm.blurShader.SetInt("_KernelSize", final ? vm.postBlurIntensity : preBlurIntensity);
452-
temp = processedTexture;
453-
processedTexture = RenderTexture.GetTemporary(startingResX, startingResY, 0);
454-
Graphics.Blit(temp, processedTexture, vm.blurShader);
455-
RenderTexture.ReleaseTemporary(temp);
447+
private void BlurImage()
448+
{
449+
vm.postBlurShader.SetInt("_KernelSize", vm.postBlurIntensity );
450+
temp = processedTexture;
451+
processedTexture = RenderTexture.GetTemporary(temp.width, temp.height, 0);
452+
Graphics.Blit(temp, processedTexture, vm.postBlurShader);
453+
RenderTexture.ReleaseTemporary(temp);
456454

457-
temp = processedTexture;
458-
processedTexture = RenderTexture.GetTemporary(startingResX, startingResY, 0);
459-
Graphics.Blit(temp, processedTexture, vm.blurShader);
460-
RenderTexture.ReleaseTemporary(temp); } }
455+
temp = processedTexture;
456+
processedTexture = RenderTexture.GetTemporary(temp.width, temp.height, 0);
457+
Graphics.Blit(temp, processedTexture, vm.postBlurShader);
458+
RenderTexture.ReleaseTemporary(temp); }
461459

462460
/// <summary>
463461
/// If in debugMode, log info to ErrorDebug
@@ -562,12 +560,13 @@ private void UpdateConfiguration()
562560
/// Release buffers
563561
/// </summary>
564562
private void OnApplicationQuit() {
565-
if(electrodesBuffer != null && electrodesBuffer.IsValid())
566-
electrodesBuffer.Release();
567-
if (simulationVariablesBuffer != null && simulationVariablesBuffer.IsValid())
568-
simulationVariablesBuffer.Release();
569-
if (vm.useAxonMap && axonContributionBuffer != null && axonContributionBuffer.IsValid())
570-
axonContributionBuffer.Release(); }
563+
tempVarsBuffer?.Release();
564+
axonSegmentGaussToElectrodes?.Release();
565+
electrodesBuffer?.Release();
566+
axonContributionBuffer?.Release();
567+
axonIdxStartBuffer?.Release();
568+
axonIdxEndBuffer?.Release();
569+
}
571570

572571
private void Start() {
573572
vm = VariableManagerScript.Instance;
@@ -581,8 +580,6 @@ private void Awake() {
581580
System.Runtime.InteropServices.Marshal.SizeOf(typeof(AxonSegment)));
582581
electrodesBuffer = new ComputeBuffer(10,
583582
System.Runtime.InteropServices.Marshal.SizeOf(typeof(Electrode)));
584-
simulationVariablesBuffer = new ComputeBuffer(10,
585-
System.Runtime.InteropServices.Marshal.SizeOf(typeof(AxonMapSettings)));
586583
axonContributionBuffer = new ComputeBuffer(10,
587584
System.Runtime.InteropServices.Marshal.SizeOf(typeof(float)));
588585
axonIdxStartBuffer = new ComputeBuffer(10,

Backend/Resources/AxonMapHandler.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ public void SetAxonMap() {
8686
/// </summary>
8787
public void SetElectrodeToAxonSegmentGauss()
8888
{
89-
Timer time = new Timer("Calc Time");
90-
time.start();
9189
int numberElectrodes = VariableManagerScript.Instance.numberYelectrodes *
9290
VariableManagerScript.Instance.numberXelectrodes;
9391

@@ -157,8 +155,7 @@ public void SetElectrodeToAxonSegmentGauss()
157155
VariableManagerScript.Instance.configurationPath + "_axonElectrodeGauss", electrodeGauss
158156
); } }
159157

160-
ErrorDebug.Log("Finished Calculating Electrode Distances");
161-
time.stopAndLog(); } }
158+
ErrorDebug.Log("Finished Calculating Electrode Distances"); } }
162159

163160

164161
/// <summary>

Backend/Resources/CollisionHandler.cs

Lines changed: 0 additions & 69 deletions
This file was deleted.

Backend/Resources/CollisionHandler.cs.meta

Lines changed: 0 additions & 11 deletions
This file was deleted.

Backend/Resources/UI_Handler.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ private void Awake()
198198

199199
foreach (var rawImage in UiOverlayPositions)
200200
{
201-
rawImage.enabled = false;
201+
if(rawImage!=null)
202+
rawImage.enabled = false;
202203
}
203204

204205
if ( Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); }

Backend/Shaders/PreProcessingShaders/GreyScaleValues.mat

Lines changed: 0 additions & 33 deletions
This file was deleted.

Backend/Shaders/PreProcessingShaders/GreyScaleValues.mat.meta

Lines changed: 0 additions & 8 deletions
This file was deleted.

Backend/VariableManagerScript.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,9 @@ public class VariableManagerScript : MonoBehaviour {
4141
public bool depthDetection = false;
4242
public bool useBionicVisionShader = true;
4343
public Material perceptShaderMaterial;
44-
public bool preprocessingblur = true;
45-
public int preBlurIntensity = 5;
4644
public bool blurFinalImage= true;
4745
public int postBlurIntensity = 15;
48-
public Material blurShader;
46+
public Material postBlurShader;
4947
public ComputeShader randomShuffler;
5048

5149

@@ -148,7 +146,7 @@ public string GetCurrentConfig()
148146
/// <returns></returns>
149147
public void updateConfigurationPath()
150148
{
151-
backendPath = Application.dataPath + Path.DirectorySeparatorChar + "BionicVisionVR" +
149+
backendPath = Application.dataPath + Path.DirectorySeparatorChar + "BionicVisionXR" +
152150
Path.DirectorySeparatorChar
153151
+ "Backend" + Path.DirectorySeparatorChar ;
154152
configurationPath = backendPath + "PremadeConfigurations" + Path.DirectorySeparatorChar + GetCurrentConfig();

Backend/python/axon_contrib.dat

-17.3 MB
Binary file not shown.
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)