private List<Tuple<Point, PickedGeometry>> ColorCodedPicking(ViewPort viewPort, Rectangle pickingRect, Rectangle clientRectangle, PickingGeometryType pickingGeometryType)
{
var result = new List<Tuple<Point, PickedGeometry>>();
// if depth buffer is valid in specified rect, then maybe something is picked.
//if (DepthBufferValid(pickingRect))
{
lock (this.synObj)
{
var arg = new RenderEventArgs(clientRectangle, viewPort, pickingGeometryType);
// Render all PickableRenderers for color-coded picking.
List<IPickable> pickableRendererList = Render4Picking(arg);
// Read pixels in specified rect and get the VertexIds they represent.
List<Tuple<Point, uint>> stageVertexIdList = ReadPixels(pickingRect);
// Get all picked geometrys.
foreach (Tuple<Point, uint> tuple in stageVertexIdList)
{
int x = tuple.Item1.X;
int y = tuple.Item1.Y;
//if (x < 0 || clientRectangle.Width <= x || y < 0 || clientRectangle.Height <= y) { continue; }
uint stageVertexId = tuple.Item2;
PickedGeometry pickedGeometry = GetPickGeometry(arg,
x, y, stageVertexId, pickableRendererList);
if (pickedGeometry != null)
{
result.Add(new Tuple<Point, PickedGeometry>(new Point(x, y), pickedGeometry));
}
}
}
}
return result;
}