public void BuildVB()
        {
            if (m_VB == null)
            {
                m_VB = new DataStream(Particle.ParticleVSIn.SizeInBytes() * m_MaxParticles, false, true);
                var vb = Engine.Global.Device3d.CreateBuffer(new Device3dD3d11.SCreateBufferCmd()
                {
                    Name            = "Particle",
                    SizeInBytes     = (int)Particle.ParticleVSIn.SizeInBytes() * m_MaxParticles,
                    BufferBindFlags = BindFlags.VertexBuffer
                });
                m_VBBinding = new VertexBufferBinding(vb, Particle.ParticleVSIn.SizeInBytes(), 0);
            }

            // fill vb with particle data
            Particle.ParticleVSIn[] particle_vsstream = new Particle.ParticleVSIn[m_Alive.Count];
            for (int i = 0; i < m_Alive.Count; ++i)
            {
                particle_vsstream[i].pos  = new Vector4(m_Alive[i].pos, 1.0f);
                particle_vsstream[i].size = m_Alive[i].size;
            }

            m_VB = new DataStream(particle_vsstream, false, true);

            // update gpu buffer
            Engine.Global.Device3d.UpdateBufferData("Particle", m_VB);
        }
        public void BuildVB()
        {
            if (m_VB == null)
            {
                m_VB = new DataStream(Particle.ParticleVSIn.SizeInBytes() * m_MaxParticles, false, true);
                var vb = Engine.Global.Device3d.CreateBuffer(new Device3dD3d11.SCreateBufferCmd()
                {
                    Name = "Particle",
                    SizeInBytes = (int)Particle.ParticleVSIn.SizeInBytes() * m_MaxParticles,
                    BufferBindFlags = BindFlags.VertexBuffer
                });
                m_VBBinding = new VertexBufferBinding(vb, Particle.ParticleVSIn.SizeInBytes(), 0);
            }

            // fill vb with particle data
            Particle.ParticleVSIn[] particle_vsstream = new Particle.ParticleVSIn[m_Alive.Count];
            for (int i = 0; i < m_Alive.Count; ++i)
            {
                particle_vsstream[i].pos = new Vector4(m_Alive[i].pos, 1.0f);
                particle_vsstream[i].size = m_Alive[i].size;
            }

            m_VB = new DataStream(particle_vsstream, false, true);

            // update gpu buffer
            Engine.Global.Device3d.UpdateBufferData("Particle", m_VB);
        }