Пример #1
0
        //---------------------------------------------------------------
        #endregion
        //---------------------------------------------------------------

        //---------------------------------------------------------------
        #region Initialisation
        //---------------------------------------------------------------
        /// <summary>
        /// Creates a new instance of a particle system.
        /// </summary>
        /// <param name="size">The max number of particles.</param>
        public LineParticleSystem(int size) : base( )
        {
            textures  = new Textures();
            particles = new FixedRoundBuffer(size);

            // Create a new format
            VertexFormat format = new VertexFormat(
                new Type[] { typeof(PositionStream), typeof(ColorStream), typeof(TextureStream) });

            // create VertexUnit and IndexStream
            vertexUnit  = new VertexUnit(format, 2 + size * 2);
            indexStream = IndexStream.FromChain(size - 1);

            // load shaders from the resource files
            using (System.IO.Stream fxStream = Purple.IO.ResourceFileSystem.Instance.Open("Purple/Graphics/Particles/LineParticle.fx")) {
                Effect = EffectCompiler.Instance.Compile(fxStream);
            }
        }