internal override uint[] Search(RenderEventArgs arg,
int x, int y,
uint lastVertexId, ZeroIndexRenderer modernRenderer)
{
OneIndexBuffer buffer = Buffer.Create(IndexBufferElementType.UInt, 6, DrawMode.Lines, BufferUsage.StaticDraw);
unsafe
{
var array = (uint*)buffer.MapBuffer(MapBufferAccess.WriteOnly);
array[0] = 0; array[1] = lastVertexId - 1;
array[2] = lastVertexId - 1; array[3] = lastVertexId - 0;
array[4] = lastVertexId - 0; array[5] = 0;
buffer.UnmapBuffer();
}
modernRenderer.Render4InnerPicking(arg, buffer);
uint id = ColorCodedPicking.ReadStageVertexId(x, y);
buffer.Dispose();
if (id + 1 == lastVertexId)
{ return new uint[] { 0, lastVertexId - 1, }; }
else if (id == lastVertexId)
{ return new uint[] { lastVertexId - 1, lastVertexId - 0, }; }
else if (id == 0)
{ return new uint[] { lastVertexId - 0, 0, }; }
else
{ throw new Exception("This should not happen!"); }
}