private void _AddUpdatedIndices(IntPtr rawUpdatedIndices)
{
int numUpdatedIndices = Marshal.ReadInt32(rawUpdatedIndices, 0);
IntPtr rawIndices = Marshal.ReadIntPtr(rawUpdatedIndices, 4);
lock (m_lockObject)
{
if (m_updatedIndices.Count == 0)
{
// Update in fast mode, no duplicates are possible.
for (int it = 0; it < numUpdatedIndices; ++it)
{
GridIndex index;
index.x = Marshal.ReadInt32(rawIndices, (0 + (it * 3)) * 4);
index.y = Marshal.ReadInt32(rawIndices, (1 + (it * 3)) * 4);
index.z = Marshal.ReadInt32(rawIndices, (2 + (it * 3)) * 4);
m_updatedIndices.Add(index);
}
}
else
{
// Duplicates are possible, need to check while adding.
for (int it = 0; it < numUpdatedIndices; ++it)
{
GridIndex index;
index.x = Marshal.ReadInt32(rawIndices, (0 + (it * 3)) * 4);
index.y = Marshal.ReadInt32(rawIndices, (1 + (it * 3)) * 4);
index.z = Marshal.ReadInt32(rawIndices, (2 + (it * 3)) * 4);
if (!m_updatedIndices.Contains(index))
{
m_updatedIndices.Add(index);
}
}
}
}
}