Created
June 5, 2015 12:19
-
-
Save mjn33/3e0534062233e98e451c to your computer and use it in GitHub Desktop.
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
diff --git a/FerramAerospaceResearch/FARAeroComponents/VehicleAerodynamics.cs b/FerramAerospaceResearch/FARAeroComponents/VehicleAerodynamics.cs | |
index 6fb0e33..919f912 100644 | |
--- a/FerramAerospaceResearch/FARAeroComponents/VehicleAerodynamics.cs | |
+++ b/FerramAerospaceResearch/FARAeroComponents/VehicleAerodynamics.cs | |
@@ -283,12 +283,15 @@ namespace FerramAerospaceResearch.FARAeroComponents | |
{ | |
try | |
{ | |
+ Debug.Log("[TryVoxelUpdate] Entering try block"); | |
if (voxelizing) //set to true when this function ends; only continue to voxelizing if the voxelization thread has not been queued | |
{ //this should catch conditions where this function is called again before the voxelization thread starts | |
+ Debug.Log("[TryVoxelUpdate] voxelizing == true"); | |
returnVal = false; | |
} | |
else | |
{ | |
+ Debug.Log("[TryVoxelUpdate] voxelizing == false"); | |
//Bunch of voxel setup data | |
_voxelCount = voxelCount; | |
@@ -307,6 +310,7 @@ namespace FerramAerospaceResearch.FARAeroComponents | |
g.UpdateTransformMatrixList(_worldToLocalMatrix); | |
} | |
+ Debug.Log("[TryVoxelUpdate] About to calculate vehicle main axis"); | |
this._vehicleMainAxis = CalculateVehicleMainAxis(); | |
//If the voxel still exists, cleanup everything so we can continue; | |
@@ -317,6 +321,7 @@ namespace FerramAerospaceResearch.FARAeroComponents | |
_voxel.CleanupVoxel(); | |
} | |
+ Debug.Log("[TryVoxelUpdate] about to queue update"); | |
//set flag so that this function can't run again before voxelizing completes and queue voxelizing thread | |
voxelizing = true; | |
ThreadPool.QueueUserWorkItem(CreateVoxel); | |
@@ -325,20 +330,23 @@ namespace FerramAerospaceResearch.FARAeroComponents | |
} | |
finally | |
{ | |
+ Debug.Log("[TryVoxelUpdate] Entering finally block"); | |
Monitor.Exit(this); | |
} | |
} | |
- | |
+ Debug.Log("[TryVoxelUpdate] returning " + returnVal); | |
return returnVal; | |
} | |
//And this actually creates the voxel and then begins the aero properties determination | |
private void CreateVoxel(object nullObj) | |
{ | |
+ Debug.Log("[CreateVoxel] entering method"); | |
lock (this) //lock this object to prevent race with main thread | |
{ | |
try | |
{ | |
+ Debug.Log("[CreateVoxel] entering try block"); | |
//Actually voxelize it | |
_voxel = new VehicleVoxel(_vehiclePartList, _currentGeoModules, _voxelCount); | |
if (_vehicleCrossSection.Length < _voxel.MaxArrayLength) | |
@@ -355,13 +363,16 @@ namespace FerramAerospaceResearch.FARAeroComponents | |
catch (Exception e) | |
{ | |
+ Debug.Log("[CreateVoxel] exception caught"); | |
ThreadSafeDebugLogger.Instance.RegisterException(e); | |
} | |
finally | |
{ | |
+ Debug.Log("[CreateVoxel] in finally block"); | |
//Always, when we finish up, if we're in flight, cleanup the voxel | |
if (HighLogic.LoadedSceneIsFlight && _voxel != null) | |
{ | |
+ Debug.Log("[CreateVoxel] in flight scene -- cleaning up voxel"); | |
_voxel.CleanupVoxel(); | |
_voxel = null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment