コード例 #1
0
        // This updates the visual sector
        public void Update(RenderDevice graphics)
        {
            int numverts = 0;
            int v        = 0;

            // Trash geometry buffer
            if (geobuffer != null)
            {
                geobuffer.Dispose();
            }
            geobuffer = null;

            // Count the number of vertices there are
            foreach (VisualGeometry g in allgeometry)
            {
                if (g.Vertices != null)
                {
                    numverts += g.Vertices.Length;
                }
            }

            // Any vertics?
            if (numverts > 0)
            {
                // Make a new buffer
                geobuffer = new VertexBuffer();
                graphics.SetBufferData(geobuffer, numverts, VertexFormat.World);

                // Fill the buffer
                foreach (VisualGeometry g in allgeometry)
                {
                    if ((g.Vertices != null) && (g.Vertices.Length > 0))
                    {
                        graphics.SetBufferSubdata(geobuffer, v, g.Vertices);
                        g.VertexOffset = v;
                        v += g.Vertices.Length;
                    }
                }
            }

            this.sector.UpdateFogColor();             //mxd

            // Done
            updategeo = false;
        }