Inheritance: CSharpGL.OneIndexLineSearcher
コード例 #1
0
        private static OneIndexLineSearcher GetLineSearcher(DrawMode mode)
        {
            if (lineSearcherDict == null)
            {
                var triangle = new OneIndexLineInTriangleSearcher();
                var quad = new OneIndexLineInQuadSearcher();
                var polygon = new OneIndexLineInPolygonSearcher();
                var dict = new Dictionary<DrawMode, OneIndexLineSearcher>();
                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);

                lineSearcherDict = dict;
            }

            OneIndexLineSearcher result = null;
            if (lineSearcherDict.TryGetValue(mode, out result))
            { return result; }
            else
            { return null; }
        }
コード例 #2
0
        private static OneIndexLineSearcher GetLineSearcher(DrawMode mode)
        {
            if (lineSearcherDict == null)
            {
                var triangle = new OneIndexLineInTriangleSearcher();
                var quad     = new OneIndexLineInQuadSearcher();
                var polygon  = new OneIndexLineInPolygonSearcher();
                var dict     = new Dictionary <DrawMode, OneIndexLineSearcher>();
                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);

                lineSearcherDict = dict;
            }

            OneIndexLineSearcher result = null;

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