Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions BulletSharp/Collision/DbvtArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace BulletSharp
{
public class DbvtArrayEnumerator : IEnumerator<Dbvt>
public struct DbvtArrayEnumerator : IEnumerator<Dbvt>
{
private int _i;
private int _count;
Expand All @@ -30,7 +30,7 @@ public bool MoveNext()

public void Reset()
{
_i = 0;
_i = -1;
}

public Dbvt Current => _array[_i];
Expand Down Expand Up @@ -92,7 +92,12 @@ public void CopyTo(Dbvt[] array, int arrayIndex)
}
}

public IEnumerator<Dbvt> GetEnumerator()
public DbvtArrayEnumerator GetEnumerator()
{
return new DbvtArrayEnumerator(this);
}

IEnumerator<Dbvt> IEnumerable<Dbvt>.GetEnumerator()
{
return new DbvtArrayEnumerator(this);
}
Expand Down
11 changes: 8 additions & 3 deletions BulletSharp/Collision/DbvtNodePtrArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace BulletSharp
{
public class DbvtNodePtrArrayEnumerator : IEnumerator<DbvtNode>
public struct DbvtNodePtrArrayEnumerator : IEnumerator<DbvtNode>
{
private int _i;
private int _count;
Expand All @@ -30,7 +30,7 @@ public bool MoveNext()

public void Reset()
{
_i = 0;
_i = -1;
}

public DbvtNode Current => _array[_i];
Expand Down Expand Up @@ -92,7 +92,12 @@ public void CopyTo(DbvtNode[] array, int arrayIndex)
}
}

public IEnumerator<DbvtNode> GetEnumerator()
public DbvtNodePtrArrayEnumerator GetEnumerator()
{
return new DbvtNodePtrArrayEnumerator(this);
}

IEnumerator<DbvtNode> IEnumerable<DbvtNode>.GetEnumerator()
{
return new DbvtNodePtrArrayEnumerator(this);
}
Expand Down
4 changes: 2 additions & 2 deletions BulletSharp/Common/GenericListEnumerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace BulletSharp
{
public sealed class GenericListEnumerator<T> : IEnumerator<T>
public struct GenericListEnumerator<T> : IEnumerator<T>
{
private int _i;
private readonly int _count;
Expand All @@ -28,7 +28,7 @@ public bool MoveNext()

public void Reset()
{
_i = 0;
_i = -1;
}

public void Dispose()
Expand Down
14 changes: 10 additions & 4 deletions BulletSharp/LinearMath/AlignedBroadphasePairArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,17 @@ public BroadphasePair[] Items
}
}

public class AlignedBroadphasePairArrayEnumerator : IEnumerator<BroadphasePair>
public struct AlignedBroadphasePairArrayEnumerator : IEnumerator<BroadphasePair>
{
private int _i = -1;
private int _i;
private readonly int _count;
private readonly AlignedBroadphasePairArray _array;

public AlignedBroadphasePairArrayEnumerator(AlignedBroadphasePairArray array)
{
_array = array;
_count = array.Count;
_i = -1;
}

public BroadphasePair Current => _array[_i];
Expand All @@ -57,7 +58,7 @@ public bool MoveNext()

public void Reset()
{
_i = 0;
_i = -1;
}
}

Expand Down Expand Up @@ -144,7 +145,12 @@ public bool Remove(BroadphasePair item)
throw new NotImplementedException();
}

public IEnumerator<BroadphasePair> GetEnumerator()
public AlignedBroadphasePairArrayEnumerator GetEnumerator()
{
return new AlignedBroadphasePairArrayEnumerator(this);
}

IEnumerator<BroadphasePair> IEnumerable<BroadphasePair>.GetEnumerator()
{
return new AlignedBroadphasePairArrayEnumerator(this);
}
Expand Down
14 changes: 10 additions & 4 deletions BulletSharp/LinearMath/AlignedCollisionObjectArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,17 @@ public CollisionObject[] Items
}
}

public class AlignedCollisionObjectArrayEnumerator : IEnumerator<CollisionObject>
public struct AlignedCollisionObjectArrayEnumerator : IEnumerator<CollisionObject>
{
private int _i = -1;
private int _i;
private readonly int _count;
private readonly IList<CollisionObject> _array;

public AlignedCollisionObjectArrayEnumerator(IList<CollisionObject> array)
{
_array = array;
_count = array.Count;
_i = -1;
}

public CollisionObject Current => _array[_i];
Expand All @@ -57,7 +58,7 @@ public bool MoveNext()

public void Reset()
{
_i = 0;
_i = -1;
}
}

Expand Down Expand Up @@ -256,7 +257,12 @@ private void SetBodyBroadphaseHandle(CollisionObject item, BroadphaseInterface b
}
}

public IEnumerator<CollisionObject> GetEnumerator()
public AlignedCollisionObjectArrayEnumerator GetEnumerator()
{
return new AlignedCollisionObjectArrayEnumerator(_backingList ?? this as IList<CollisionObject>);
}

IEnumerator<CollisionObject> IEnumerable<CollisionObject>.GetEnumerator()
{
if (_backingList != null)
{
Expand Down
11 changes: 8 additions & 3 deletions BulletSharp/LinearMath/AlignedIndexedMeshArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public IndexedMesh[] Items
}
}

public class AlignedIndexedMeshArrayEnumerator : IEnumerator<IndexedMesh>
public struct AlignedIndexedMeshArrayEnumerator : IEnumerator<IndexedMesh>
{
private int _i;
private readonly int _count;
Expand Down Expand Up @@ -58,7 +58,7 @@ public bool MoveNext()

public void Reset()
{
_i = 0;
_i = -1;
}
}

Expand Down Expand Up @@ -154,7 +154,12 @@ public bool Remove(IndexedMesh item)
throw new NotImplementedException();
}

public IEnumerator<IndexedMesh> GetEnumerator()
public AlignedIndexedMeshArrayEnumerator GetEnumerator()
{
return new AlignedIndexedMeshArrayEnumerator(this);
}

IEnumerator<IndexedMesh> IEnumerable<IndexedMesh>.GetEnumerator()
{
return _backingList.GetEnumerator();
}
Expand Down
11 changes: 8 additions & 3 deletions BulletSharp/LinearMath/AlignedManifoldArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public PersistentManifold[] Items
}
}

public class AlignedManifoldArrayEnumerator : IEnumerator<PersistentManifold>
public struct AlignedManifoldArrayEnumerator : IEnumerator<PersistentManifold>
{
private int _i;
private readonly int _count;
Expand Down Expand Up @@ -58,7 +58,7 @@ public bool MoveNext()

public void Reset()
{
_i = 0;
_i = -1;
}
}

Expand Down Expand Up @@ -144,7 +144,12 @@ public bool Remove(PersistentManifold item)
throw new NotImplementedException();
}

public IEnumerator<PersistentManifold> GetEnumerator()
public AlignedManifoldArrayEnumerator GetEnumerator()
{
return new AlignedManifoldArrayEnumerator(this);
}

IEnumerator<PersistentManifold> IEnumerable<PersistentManifold>.GetEnumerator()
{
return new AlignedManifoldArrayEnumerator(this);
}
Expand Down
22 changes: 16 additions & 6 deletions BulletSharp/LinearMath/Collections.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public System.Collections.ArrayList Items
}
};

public class CompoundShapeChildArrayEnumerator : IEnumerator<CompoundShapeChild>
public struct CompoundShapeChildArrayEnumerator : IEnumerator<CompoundShapeChild>
{
private int _i;
private int _count;
Expand All @@ -54,15 +54,15 @@ public bool MoveNext()

public void Reset()
{
_i = 0;
_i = -1;
}

public CompoundShapeChild Current => _array[_i];

object System.Collections.IEnumerator.Current => _array[_i];
}

public class UIntArrayEnumerator : IEnumerator<uint>
public struct UIntArrayEnumerator : IEnumerator<uint>
{
private int _i;
private int _count;
Expand All @@ -87,7 +87,7 @@ public bool MoveNext()

public void Reset()
{
_i = 0;
_i = -1;
}

public uint Current => _array[_i];
Expand Down Expand Up @@ -147,7 +147,12 @@ public void CopyTo(CompoundShapeChild[] array, int arrayIndex)
throw new NotImplementedException();
}

public IEnumerator<CompoundShapeChild> GetEnumerator()
public CompoundShapeChildArrayEnumerator GetEnumerator()
{
return new CompoundShapeChildArrayEnumerator(this);
}

IEnumerator<CompoundShapeChild> IEnumerable<CompoundShapeChild>.GetEnumerator()
{
return new CompoundShapeChildArrayEnumerator(this);
}
Expand Down Expand Up @@ -228,7 +233,12 @@ public void CopyTo(uint[] array, int arrayIndex)
throw new NotImplementedException();
}

public IEnumerator<uint> GetEnumerator()
public UIntArrayEnumerator GetEnumerator()
{
return new UIntArrayEnumerator(this);
}

IEnumerator<uint> IEnumerable<uint>.GetEnumerator()
{
return new UIntArrayEnumerator(this);
}
Expand Down
11 changes: 8 additions & 3 deletions BulletSharp/Math/Vector3Array.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public Vector3[] Items
}
};

public class Vector3ArrayEnumerator : IEnumerator<Vector3>
public struct Vector3ArrayEnumerator : IEnumerator<Vector3>
{
private int _i;
private readonly int _count;
Expand All @@ -51,7 +51,7 @@ public bool MoveNext()

public void Reset()
{
_i = 0;
_i = -1;
}

public Vector3 Current => _array[_i];
Expand Down Expand Up @@ -127,7 +127,12 @@ public void CopyTo(Vector3[] array, int arrayIndex)
}
}

public IEnumerator<Vector3> GetEnumerator()
public Vector3ArrayEnumerator GetEnumerator()
{
return new Vector3ArrayEnumerator(this);
}

IEnumerator<Vector3> IEnumerable<Vector3>.GetEnumerator()
{
return new Vector3ArrayEnumerator(this);
}
Expand Down
11 changes: 8 additions & 3 deletions BulletSharp/SoftBody/AlignedAnchorArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public Anchor[] Items
}
}

public class AlignedAnchorArrayEnumerator : IEnumerator<Anchor>
public struct AlignedAnchorArrayEnumerator : IEnumerator<Anchor>
{
private int _i;
private int _count;
Expand Down Expand Up @@ -59,7 +59,7 @@ public bool MoveNext()

public void Reset()
{
_i = 0;
_i = -1;
}
}

Expand Down Expand Up @@ -131,7 +131,12 @@ public bool Remove(Anchor item)
throw new NotImplementedException();
}

public IEnumerator<Anchor> GetEnumerator()
public AlignedAnchorArrayEnumerator GetEnumerator()
{
return new AlignedAnchorArrayEnumerator(this);
}

IEnumerator<Anchor> IEnumerable<Anchor>.GetEnumerator()
{
return new AlignedAnchorArrayEnumerator(this);
}
Expand Down
11 changes: 8 additions & 3 deletions BulletSharp/SoftBody/AlignedClusterArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public Cluster[] Items
}
}

public class AlignedClusterArrayEnumerator : IEnumerator<Cluster>
public struct AlignedClusterArrayEnumerator : IEnumerator<Cluster>
{
private int _i;
private int _count;
Expand Down Expand Up @@ -59,7 +59,7 @@ public bool MoveNext()

public void Reset()
{
_i = 0;
_i = -1;
}
}

Expand Down Expand Up @@ -131,7 +131,12 @@ public bool Remove(Cluster item)
throw new NotImplementedException();
}

public IEnumerator<Cluster> GetEnumerator()
public AlignedClusterArrayEnumerator GetEnumerator()
{
return new AlignedClusterArrayEnumerator(this);
}

IEnumerator<Cluster> IEnumerable<Cluster>.GetEnumerator()
{
return new AlignedClusterArrayEnumerator(this);
}
Expand Down
Loading