Пример #1
0
            public object Select <T>(IVertexRenderable <T> Renderable)
                where T : struct, IVertex
            {
                Type      verttype = typeof(T);
                BeginMode mode     = Renderable.Mode;
                KeyValuePair <Type, BeginMode> key = new KeyValuePair <Type, BeginMode>(verttype, mode);
                _UntypedVertexList             uvl;

                if (this.VertexStore.TryGetValue(key, out uvl))
                {
                    _VertexList <T> vl = (_VertexList <T>)uvl;
                    foreach (T v in Renderable.Vertices)
                    {
                        vl.Iterator.Next(v);
                    }
                }
                else
                {
                    _VertexList <T> vl = new _VertexList <T>()
                    {
                        Mode = mode, Iterator = VBO <T> .Create()
                    };
                    this.VertexStore[key] = vl;
                }
                return(null);
            }
Пример #2
0
 /// <summary>
 /// Sends the vertices in the set of slices to the accumulator.
 /// </summary>
 private static void _SendVertices(Quadtree <Material>[,] Slices, Axis Direction, int DirectionBound, List <ColorNormalVertex>[,] Accum)
 {
     for (int iax = 0; iax < 3; iax++)
     {
         Axis ax = (Axis)iax;
         if (ax != Direction)
         {
             for (int l = 0; l < DirectionBound - 1; l++)
             {
                 foreach (KeyValuePair <Point <int>, Material> bord in Slices[iax, l].Enumerate(Material.Default))
                 {
                     Vector <int> pos = new Vector <int>(l, bord.Key.X, bord.Key.Y).AxisUnorder(ax);
                     IRenderable  ren = Material.CreateRenderable(new Border <Material>()
                     {
                         Direction = ax, Position = pos, Value = bord.Value
                     });
                     IVertexRenderable <ColorNormalVertex> cnv = ren as IVertexRenderable <ColorNormalVertex>;
                     if (cnv != null)
                     {
                         Accum[pos[Direction], 1].AddRange(cnv.Vertices);
                     }
                 }
             }
         }
         else
         {
             for (int l = 0; l < DirectionBound - 1; l++)
             {
                 var posit = Iterator.ListIterator(Accum[l, 2]);
                 var negit = Iterator.ListIterator(Accum[l + 1, 0]);
                 StaticRenderer.SendQuadtree(Slices[iax, l], Direction, l, new Point <int>(0, 0), posit, negit);
             }
         }
     }
 }
Пример #3
0
        /// <summary>
        /// Sends the vertices in the specified surface to the accumulator.
        /// </summary>
        private static void _SendVertices(IEnumerable <Border <Material> > Source, Axis Direction, int DirectionBound, List <ColorNormalVertex>[,] Accum)
        {
            foreach (Border <Material> bord in Source)
            {
                int l = bord.Position[Direction];
                int d = 1;
                if (bord.Direction == Direction)
                {
                    if (bord.Value.Direction == Polarity.Positive)
                    {
                        d++;
                    }
                    else
                    {
                        l++;
                        d--;
                    }
                }

                IRenderable ren = Material.CreateRenderable(bord);
                IVertexRenderable <ColorNormalVertex> cnv = ren as IVertexRenderable <ColorNormalVertex>;
                if (cnv != null)
                {
                    Accum[l, d].AddRange(cnv.Vertices);
                }
            }
        }
Пример #4
0
        /// <summary>
        /// Sends the given renderable to the specified iterator.
        /// </summary>
        public static void Send <R>(IRenderable Renderable, IIterator <ColorNormalVertex, R> Iterator)
        {
            IVertexRenderable <ColorNormalVertex> vertexrenders = Renderable as IVertexRenderable <ColorNormalVertex>;

            if (vertexrenders != null)
            {
                Cubia.Iterator.Pipe(Iterator, vertexrenders.Vertices);
            }
        }