Ejemplo n.º 1
0
        private void createVertexBuffer(SharpDX.Direct3D11.Device device, KeplerVertex[] points)
        {
            if (renderStrategy == RenderStrategy.GeometryShader)
            {
                vertexBuffer = new GenVertexBuffer <KeplerVertex>(device, points);
            }
            else if (renderStrategy == RenderStrategy.Instanced)
            {
                vertexBuffer = new GenVertexBuffer <KeplerVertex>(device, points);
            }
            else
            {
                const int verticesPerPoint = 4;
                var       expandedPoints   = new KeplerVertex[points.Length * verticesPerPoint];

                int index = 0;
                foreach (KeplerVertex p in points)
                {
                    KeplerVertex xp;
                    xp        = p;
                    xp.corner = 0;

                    expandedPoints[index + 0]        = xp;
                    expandedPoints[index + 0].corner = 0x00000000;
                    expandedPoints[index + 1]        = xp;
                    expandedPoints[index + 1].corner = 0xff00ff00;
                    expandedPoints[index + 2]        = xp;
                    expandedPoints[index + 2].corner = 0xffffffff;
                    expandedPoints[index + 3]        = xp;
                    expandedPoints[index + 3].corner = 0x00ff00ff;

                    index += verticesPerPoint;
                }

                fallbackVertexBuffer = new GenVertexBuffer <KeplerVertex>(device, expandedPoints);
            }
        }
Ejemplo n.º 2
0
        public static void InitMPCVertexBuffer()
        {
            MpcMutex.WaitOne();
            try
            {
                if (mpcVertexBuffer == null)
                {
                    var mpcVertexBufferTemp = new KeplerPointSpriteSet[7];
                    ReadMPSCoreFile(@"c:\mpc\MPCORB.DAT");

                    mpcCount = MPCList.Count;
                    //KeplerVertexBuffer11 temp = new KeplerVertexBuffer11(mpcCount, RenderContext11.PrepDevice);

                    var lists = new List<KeplerVertex>[7];
                    for (var i = 0; i < 7; i++)
                    {
                        lists[i] = new List<KeplerVertex>();
                    }

                    foreach (var ee in MPCList)
                    {
                        var listID = 0;
                        if (ee.a < 2.5)
                        {
                            listID = 0;
                        }
                        else if (ee.a < 2.83)
                        {
                            listID = 1;
                        }
                        else if (ee.a < 2.96)
                        {
                            listID = 2;
                        }
                        else if (ee.a < 3.3)
                        {
                            listID = 3;
                        }
                        else if (ee.a < 5)
                        {
                            listID = 4;
                        }
                        else if (ee.a < 10)
                        {
                            listID = 5;
                        }
                        else
                        {
                            listID = 6;
                        }

                        var vert = new KeplerVertex();
                        vert.Fill(ee);

                        lists[listID].Add(vert);
                    }

                    for (var i = 0; i < 7; i++)
                    {
                        mpcVertexBufferTemp[i] = new KeplerPointSpriteSet(RenderContext11.PrepDevice, lists[i].ToArray());
                    }

                    mpcVertexBuffer = mpcVertexBufferTemp;
                }
            }
            finally
            {
                MpcMutex.ReleaseMutex();
            }
        }
Ejemplo n.º 3
0
        public static void InitMPCVertexBuffer()
        {
            MpcMutex.WaitOne();
            try
            {
                if (mpcVertexBuffer == null)
                {
                    KeplerPointSpriteSet[] mpcVertexBufferTemp = new KeplerPointSpriteSet[7];
                    MinorPlanets.ReadMPSCoreFile(@"c:\mpc\MPCORB.DAT");

                    mpcCount = MinorPlanets.MPCList.Count;
                    //KeplerVertexBuffer11 temp = new KeplerVertexBuffer11(mpcCount, RenderContext11.PrepDevice);

                    List <KeplerVertex>[] lists = new List <KeplerVertex> [7];
                    for (int i = 0; i < 7; i++)
                    {
                        lists[i] = new List <KeplerVertex>();
                    }

                    foreach (CAAEllipticalObjectElements ee in MinorPlanets.MPCList)
                    {
                        int listID = 0;
                        if (ee.a < 2.5)
                        {
                            listID = 0;
                        }
                        else if (ee.a < 2.83)
                        {
                            listID = 1;
                        }
                        else if (ee.a < 2.96)
                        {
                            listID = 2;
                        }
                        else if (ee.a < 3.3)
                        {
                            listID = 3;
                        }
                        else if (ee.a < 5)
                        {
                            listID = 4;
                        }
                        else if (ee.a < 10)
                        {
                            listID = 5;
                        }
                        else
                        {
                            listID = 6;
                        }

                        KeplerVertex vert = new KeplerVertex();
                        vert.Fill(ee);

                        lists[listID].Add(vert);
                    }

                    for (int i = 0; i < 7; i++)
                    {
                        mpcVertexBufferTemp[i] = new KeplerPointSpriteSet(RenderContext11.PrepDevice, lists[i].ToArray());
                    }

                    mpcVertexBuffer = mpcVertexBufferTemp;
                }
            }
            finally
            {
                MpcMutex.ReleaseMutex();
            }
        }
        private void createVertexBuffer(Device device, KeplerVertex[] points)
        {
            if (renderStrategy == RenderStrategy.GeometryShader)
            {
                vertexBuffer = new GenVertexBuffer<KeplerVertex>(device, points);
            }
            else if (renderStrategy == RenderStrategy.Instanced)
            {
                vertexBuffer = new GenVertexBuffer<KeplerVertex>(device, points);
            }
            else
            {
                const int verticesPerPoint = 4;
                var expandedPoints = new KeplerVertex[points.Length * verticesPerPoint];

                var index = 0;
                foreach (var p in points)
                {
                    KeplerVertex xp;
                    xp = p;
                    xp.corner = 0;

                    expandedPoints[index + 0] = xp;
                    expandedPoints[index + 0].corner = 0x00000000;
                    expandedPoints[index + 1] = xp;
                    expandedPoints[index + 1].corner = 0xff00ff00;
                    expandedPoints[index + 2] = xp;
                    expandedPoints[index + 2].corner = 0xffffffff;
                    expandedPoints[index + 3] = xp;
                    expandedPoints[index + 3].corner = 0x00ff00ff;

                    index += verticesPerPoint;
                }

                fallbackVertexBuffer = new GenVertexBuffer<KeplerVertex>(device, expandedPoints);
            }
        }
 public KeplerPointSpriteSet(Device device, KeplerVertex[] points)
     : base(device, points)
 {
     createVertexBuffer(device, points);
 }
Ejemplo n.º 6
0
 public KeplerPointSpriteSet(SharpDX.Direct3D11.Device device, KeplerVertex[] points)
     : base(device, points)
 {
     createVertexBuffer(device, points);
 }