コード例 #1
0
        static IndexBuffer IndexPointsBuffer(int pointsCount)
        {
            Debug.Assert(pointsCount <= VertexThreshold);

            if (indexPointsBuffer == null)
            {
                indexPointsBuffer = new IndexBuffer(VertexThreshold * IndexPoint.GetSizeInShortInts());
                indexPointsBuffer.Map(VertexThreshold * IndexPoint.GetSizeInShortInts());
                using (var istream = indexPointsBuffer.GetIndexStreamPoint())
                {
                    for (int vi = 0; vi < VertexThreshold; ++vi)
                    {
                        istream.AddPoint(new IndexPoint(vi));
                    }
                }
                indexPointsBuffer.Unmap();
            }

            Debug.Assert(indexPointsBuffer.IsValid());
            return(indexPointsBuffer);
        }