예제 #1
0
            /// <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);
            }
예제 #2
0
        public StaticRenderer(IEnumerableSurface <Material> Source)
        {
            IIterator <ColorNormalVertex, VBO <ColorNormalVertex> > vboc = VBO <ColorNormalVertex> .Create();

            IOctreeInteriorSurface <Material> ois = Source.Extend <IOctreeInteriorSurface <Material> >();

            if (ois != null)
            {
                Quadtree <Material>[,] slices = ois.Slices;
                for (int iax = 0; iax < 3; iax++)
                {
                    for (int l = 0; l < ois.Size - 1; l++)
                    {
                        Send(new QuadtreeSurface <Material>(slices[iax, l], Material.Default, (Axis)iax, l), vboc, vboc);
                    }
                }
                this._VBO = vboc.End();
                return;
            }

            Send(Source, vboc);
            this._VBO = vboc.End();
        }