internal override uint[] Search(RenderEventArgs arg,
int x, int y,
RecognizedPrimitiveInfo primitiveInfo,
OneIndexRenderer modernRenderer)
{
uint[] indexList = primitiveInfo.VertexIds;
if (indexList.Length < 3) { throw new ArgumentException(); }
OneIndexBuffer buffer = indexList.GenIndexBuffer(DrawMode.LineLoop, BufferUsage.StaticDraw);
modernRenderer.Render4InnerPicking(arg, buffer);
uint id = ColorCodedPicking.ReadStageVertexId(x, y);
buffer.Dispose();
if (id == indexList[0])
{ return new uint[] { indexList[indexList.Length - 1], id, }; }
else
{
uint[] result = null;
for (int i = 1; i < indexList.Length; i++)
{
if (id == indexList[i])
{
result = new uint[] { indexList[i - 1], indexList[i], };
break;
}
}
if (result != null)
{ return result; }
else
{ throw new Exception("This should not happen!"); }
}
}