상속: OneIndexPointSearcher
        private static OneIndexPointSearcher GetPointSearcher(DrawMode mode)
        {
            if (pointSearcherDict == null)
            {
                var triangle = new OneIndexPointInTriangleSearcher();
                var quad = new OneIndexPointInQuadSearcher();
                var polygon = new OneIndexPointInPolygonSearcher();
                var dict = new Dictionary<DrawMode, OneIndexPointSearcher>();
                dict.Add(DrawMode.Triangles, triangle);
                dict.Add(DrawMode.TrianglesAdjacency, triangle);
                dict.Add(DrawMode.TriangleStrip, triangle);
                dict.Add(DrawMode.TriangleStripAdjacency, triangle);
                dict.Add(DrawMode.TriangleFan, triangle);
                dict.Add(DrawMode.Quads, quad);
                dict.Add(DrawMode.QuadStrip, quad);
                dict.Add(DrawMode.Polygon, polygon);

                pointSearcherDict = dict;
            }

            OneIndexPointSearcher result = null;
            if (pointSearcherDict.TryGetValue(mode, out result))
            { return result; }
            else
            { return null; }
        }
예제 #2
0
        private static OneIndexPointSearcher GetPointSearcher(DrawMode mode)
        {
            if (pointSearcherDict == null)
            {
                var triangle = new OneIndexPointInTriangleSearcher();
                var quad     = new OneIndexPointInQuadSearcher();
                var polygon  = new OneIndexPointInPolygonSearcher();
                var dict     = new Dictionary <DrawMode, OneIndexPointSearcher>();
                dict.Add(DrawMode.Triangles, triangle);
                dict.Add(DrawMode.TrianglesAdjacency, triangle);
                dict.Add(DrawMode.TriangleStrip, triangle);
                dict.Add(DrawMode.TriangleStripAdjacency, triangle);
                dict.Add(DrawMode.TriangleFan, triangle);
                dict.Add(DrawMode.Quads, quad);
                dict.Add(DrawMode.QuadStrip, quad);
                dict.Add(DrawMode.Polygon, polygon);

                pointSearcherDict = dict;
            }

            OneIndexPointSearcher result = null;

            if (pointSearcherDict.TryGetValue(mode, out result))
            {
                return(result);
            }
            else
            {
                return(null);
            }
        }