Skip to content
Snippets Groups Projects
Commit 2033ff7a authored by Knuiman, Bart's avatar Knuiman, Bart
Browse files

Fixes

parent 2dbd0e56
Branches main
No related tags found
No related merge requests found
......@@ -674,7 +674,7 @@ namespace LAZNamespace
#endregion
#region Generic Tasks
public GenericTask StartGenericTask( Action callback, Action onDone=null )
public GenericTask StartGenericTask( Action callback, Action onDone=null, bool executeOnMain=false )
{
// Lazy initialize, if not already on main thread.
if (genericTasks == null)
......@@ -690,6 +690,8 @@ namespace LAZNamespace
gt.done = false;
uint taskIdx = (uint) genericTaskIterator++;
taskIdx %= (uint)numGenericTasks;
if (executeOnMain)
taskIdx = 0; // This allows ordered execution of tasks.
lock (genericTasks[taskIdx])
{
genericTasks[taskIdx].Add( gt );
......
......@@ -495,7 +495,7 @@ namespace LAZNamespace
var verticesSliced = vertices;
if (verticesSliced== null) // Might be unloading the data.
return;
System.Diagnostics.Debug.Assert( Directory.Exists( tree.PathToCacheFolder ) );
Debug.Assert( Directory.Exists( tree.PathToCacheFolder ) );
var filePath = GetPathOnDisk().NormalizePath();
Monitor.Enter( this );
try
......@@ -510,6 +510,7 @@ namespace LAZNamespace
{
verticesSliced[i].Write( br );
}
br.Flush();
}
}
finally
......@@ -556,7 +557,7 @@ namespace LAZNamespace
verticesNew.Add( ver );
}
numPoints = verticesNew.Count;
System.Diagnostics.Debug.Assert( verticesNew.Count==vertCount, "Cache invalid. Clear cache and Reload files." );
Debug.Assert( verticesNew.Count==vertCount, "Cache invalid. Clear cache and Reload files." );
vertices = verticesNew;
}
}
......
......@@ -59,13 +59,13 @@ namespace LAZNamespace
} );
}
}
// Regardless of visible, we must finish the task, otherewise it will only due when visible, but task was already started.
if (loadVoxelTask != null && loadVoxelTask.done)
{
loadVoxelTask = null;
FinalizeMeshData();
UnityEngine.Debug.Log( "done updating mesh" );
}
}
// Regardless of visible, we must finish the task, otherewise it will only due when visible, but task was already started.
if (loadVoxelTask != null && loadVoxelTask.done)
{
loadVoxelTask = null;
FinalizeMeshData();
UnityEngine.Debug.Log( "done updating mesh" );
}
return mesh;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment