CSharpGL.OneIndexRenderer.GetLastIndexIdList C# (CSharp) Method

GetLastIndexIdList() private method

遍历以lastVertexId为最后一个顶点的图元, 瞄准每个图元的索引(例如1个三角形有3个索引)中的最后一个索引, 将此索引在IndexBuffer中的索引(位置)收集起来。
private GetLastIndexIdList ( RenderEventArgs arg, uint lastVertexId ) : List
arg RenderEventArgs
lastVertexId uint
return List
        private List<RecognizedPrimitiveInfo> GetLastIndexIdList(RenderEventArgs arg, uint lastVertexId)
        {
            PrimitiveRecognizer recognizer = PrimitiveRecognizerFactory.Create(
                (arg.PickingGeometryType == PickingGeometryType.Point
                && this.indexBuffer.Mode.ToGeometryType() == PickingGeometryType.Line) ?
                DrawMode.Points : this.indexBuffer.Mode);

            PrimitiveRestartState glState = GetPrimitiveRestartState();

            var buffer = this.indexBuffer as OneIndexBuffer;
            IntPtr pointer = buffer.MapBuffer(MapBufferAccess.ReadOnly);
            List<RecognizedPrimitiveInfo> primitiveInfoList = null;
            if (glState == null)
            { primitiveInfoList = recognizer.Recognize(lastVertexId, pointer, this.indexBuffer as OneIndexBuffer); }
            else
            { primitiveInfoList = recognizer.Recognize(lastVertexId, pointer, this.indexBuffer as OneIndexBuffer, glState.RestartIndex); }
            buffer.UnmapBuffer();

            return primitiveInfoList;
        }