crash using debug drawer
Posted: Mon Mar 30, 2015 3:19 pm
hi, i run into an ArgumentOutOfRangeException in line 135 of ModelDisplayObjectBatch.cs
here:
when I try to remove an object from the DebugDrawer like this:
This only happenes when I put so much things into the DebugDrawer that he does not draw all of them any more.
The value of displayObject.BatchInformation.BaseVertexBufferIndex is then -65248
The value got set to that negative value some lines underneath:
where BaseIndexBufferIndex is zero and IndexCount is somewhat huge
thx
here:
Code: Select all
public void Remove(ModelDisplayObject displayObject, InstancedModelDrawer drawer)
{
//Modify vertex buffer
var newVertices = new VertexPositionNormalTexture[vertices.Length - displayObject.BatchInformation.VertexCount];
//Copy the first part back (before the display object)
Array.Copy(vertices, 0, newVertices, 0, displayObject.BatchInformation.BaseVertexBufferIndex); <----- here
...
Code: Select all
DebugDrawer.Remove(_morphableRigidBody);
The value of displayObject.BatchInformation.BaseVertexBufferIndex is then -65248
The value got set to that negative value some lines underneath:
where BaseIndexBufferIndex is zero and IndexCount is somewhat huge
Code: Select all
//Move the subsequent display objects list indices and base vertices/indices.
for (int i = displayObject.BatchInformation.BatchListIndex; i < DisplayObjects.Count; i++)
{
DisplayObjects[i].BatchInformation.BatchListIndex--;
DisplayObjects[i].BatchInformation.BaseVertexBufferIndex -= displayObject.BatchInformation.VertexCount;
DisplayObjects[i].BatchInformation.BaseIndexBufferIndex -= displayObject.BatchInformation.IndexCount;
System.Diagnostics.Debug.Assert(DisplayObjects[i].BatchInformation.BaseVertexBufferIndex >= 0);
}