コード例 #1
0
ファイル: VBO.cs プロジェクト: madmaxoft/MineViewer
            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>
            /// 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);
            }
コード例 #3
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();
        }