using System; using System.Collections.Generic; using System.Runtime.InteropServices; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Nuclex.Graphics; namespace Nuclex.Graphics.SpecialEffects.Demo { /// /// Stores the properties of a particle and doubles as vertex /// [StructLayout(LayoutKind.Sequential)] public struct FlareParticle { /// /// Description of this vertex structure for creating a vertex declaration /// public static readonly VertexElement[] VertexElements = VertexDeclarationHelper.BuildElementList(); /// Offset, in bytes, from one particle to the next public static int SizeInBytes = VertexDeclarationHelper.GetStride(); /// Initializes a new simple particle /// Initial position of the particle /// Velocity the particle is moving at /// Color of the particle public FlareParticle(Vector3 position, Vector3 velocity, Color color) { this.Position = position; this.Velocity = velocity; this.Color = color; this.Power = 100.0f; } /// Current position of the particle in space [VertexElement(VertexElementUsage.Position)] public Vector3 Position; /// Velocity the particle is moving at public Vector3 Velocity; /// Power of the flare [VertexElement(VertexElementUsage.PointSize)] public float Power; /// Color if this particle [VertexElement(VertexElementUsage.Color)] public Color Color; } } // namespace Nuclex.Graphics.SpecialEffects.Demo