/// <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); } } } }
/// <summary> /// Gets the vertex buffer for the specified level. /// </summary> public VBO <ColorNormalVertex> GetLevel(int Level, Polarity Direction) { if (Direction == Polarity.Negative) { Level--; } VBO <ColorNormalVertex> c = this._Levels[Level, (int)Direction]; if (c == null) { IIterator <ColorNormalVertex, VBO <ColorNormalVertex> > vboc = VBO <ColorNormalVertex> .Create(); IBoundedPlaneSurface <Material> bps = Shape.Slice(this._StratifiedRenderer._Source, this._Axis, Level, delegate(T Lower, T Higher, Axis Axis) { if (Direction == Polarity.Positive && !Higher.Equals(this._StratifiedRenderer._Default)) { return(this._StratifiedRenderer._SurfacizeFunc(Lower, this._StratifiedRenderer._Default, Axis)); } if (Direction == Polarity.Negative && !Lower.Equals(this._StratifiedRenderer._Default)) { return(this._StratifiedRenderer._SurfacizeFunc(this._StratifiedRenderer._Default, Higher, Axis)); } return(Material.Default); }, Material.Default); QuadtreeSurface <Material> qs = bps.Extend <QuadtreeSurface <Material> >(); if (qs != null) { StaticRenderer.Send(qs, vboc, vboc); } else { StaticRenderer.Send(bps, vboc); } this._Levels[Level, (int)Direction] = c = vboc.End(); } return(c); }